@reside-ic/skadi-chart 1.1.9-alpha.0 → 1.1.9-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2775,21 +2775,21 @@ class of extends WA {
2775
2775
  });
2776
2776
  })), i.chartOptions.logScale[r] || (h = this.drawLinePerpendicularToAxis(r, n(0), i, "darkgrey")), { layer: Q, axis: w, line: h };
2777
2777
  }, this.drawLinePerpendicularToAxis = (r, n, i, s = "black") => {
2778
- var g;
2779
- const a = i.coreLayers[D.BaseLayer], { height: o, width: B, margin: c } = i.bounds, l = r === "x" ? "y" : "x", u = (g = i.scaleConfig.categoricalScales[l]) == null ? void 0 : g.main;
2778
+ var C;
2779
+ const a = i.coreLayers[D.BaseLayer], { height: o, width: B, margin: c } = i.bounds, l = r === "x" ? "y" : "x", u = (C = i.scaleConfig.categoricalScales[l]) == null ? void 0 : C.main;
2780
2780
  if (!u) {
2781
- let C = { [r]: { start: n, end: n } };
2782
- return r === "x" ? C.y = { start: c.top, end: o - c.bottom } : C.x = { start: c.left, end: B - c.right }, Xi(a, C, s);
2781
+ let h = { [r]: { start: n, end: n } };
2782
+ return r === "x" ? h.y = { start: c.top, end: o - c.bottom } : h.x = { start: c.left, end: B - c.right }, Xi(a, h, s);
2783
2783
  }
2784
- const f = u.bandwidth();
2785
- u.domain().forEach((C) => {
2786
- const h = u(C);
2787
- if (h === void 0) return;
2788
- const w = {
2784
+ const f = u.bandwidth(), g = l === "x" ? o - c.bottom : c.left;
2785
+ u.domain().forEach((h) => {
2786
+ const w = u(h);
2787
+ if (w === void 0 || n === g) return;
2788
+ const Q = {
2789
2789
  [r]: { start: n, end: n },
2790
- [l]: { start: h, end: h + f }
2790
+ [l]: { start: w, end: w + f }
2791
2791
  };
2792
- Xi(a, w, s);
2792
+ Xi(a, Q, s);
2793
2793
  });
2794
2794
  }, this.axisConfig = (r, n) => {
2795
2795
  const { height: i, margin: s } = n.bounds, a = r === "x" ? "y" : "x", o = r === "x" ? i - s.bottom : s.left;
@@ -1,4 +1,4 @@
1
- (function(RA,$A){typeof exports=="object"&&typeof module<"u"?$A(exports):typeof define=="function"&&define.amd?define(["exports"],$A):(RA=typeof globalThis<"u"?globalThis:RA||self,$A(RA["skadi-chart"]={}))})(this,(function(RA){"use strict";var $A="http://www.w3.org/1999/xhtml";const ai={svg:"http://www.w3.org/2000/svg",xhtml:$A,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function oe(A){var t=A+="",e=t.indexOf(":");return e>=0&&(t=A.slice(0,e))!=="xmlns"&&(A=A.slice(e+1)),ai.hasOwnProperty(t)?{space:ai[t],local:A}:A}function Do(A){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===$A&&t.documentElement.namespaceURI===$A?t.createElement(A):t.createElementNS(e,A)}}function To(A){return function(){return this.ownerDocument.createElementNS(A.space,A.local)}}function yr(A){var t=oe(A);return(t.local?To:Do)(t)}function Mo(){}function vr(A){return A==null?Mo:function(){return this.querySelector(A)}}function _o(A){typeof A!="function"&&(A=vr(A));for(var t=this._groups,e=t.length,r=new Array(e),n=0;n<e;++n)for(var i=t[n],s=i.length,a=r[n]=new Array(s),o,B,c=0;c<s;++c)(o=i[c])&&(B=A.call(o,o.__data__,c,i))&&("__data__"in o&&(B.__data__=o.__data__),a[c]=B);return new uA(r,this._parents)}function Oo(A){return A==null?[]:Array.isArray(A)?A:Array.from(A)}function Ro(){return[]}function oi(A){return A==null?Ro:function(){return this.querySelectorAll(A)}}function No(A){return function(){return Oo(A.apply(this,arguments))}}function Go(A){typeof A=="function"?A=No(A):A=oi(A);for(var t=this._groups,e=t.length,r=[],n=[],i=0;i<e;++i)for(var s=t[i],a=s.length,o,B=0;B<a;++B)(o=s[B])&&(r.push(A.call(o,o.__data__,B,s)),n.push(o));return new uA(r,n)}function Bi(A){return function(){return this.matches(A)}}function ci(A){return function(t){return t.matches(A)}}var Vo=Array.prototype.find;function ko(A){return function(){return Vo.call(this.children,A)}}function Po(){return this.firstElementChild}function Xo(A){return this.select(A==null?Po:ko(typeof A=="function"?A:ci(A)))}var Jo=Array.prototype.filter;function Yo(){return Array.from(this.children)}function Wo(A){return function(){return Jo.call(this.children,A)}}function Zo(A){return this.selectAll(A==null?Yo:Wo(typeof A=="function"?A:ci(A)))}function $o(A){typeof A!="function"&&(A=Bi(A));for(var t=this._groups,e=t.length,r=new Array(e),n=0;n<e;++n)for(var i=t[n],s=i.length,a=r[n]=[],o,B=0;B<s;++B)(o=i[B])&&A.call(o,o.__data__,B,i)&&a.push(o);return new uA(r,this._parents)}function li(A){return new Array(A.length)}function zo(){return new uA(this._enter||this._groups.map(li),this._parents)}function Be(A,t){this.ownerDocument=A.ownerDocument,this.namespaceURI=A.namespaceURI,this._next=null,this._parent=A,this.__data__=t}Be.prototype={constructor:Be,appendChild:function(A){return this._parent.insertBefore(A,this._next)},insertBefore:function(A,t){return this._parent.insertBefore(A,t)},querySelector:function(A){return this._parent.querySelector(A)},querySelectorAll:function(A){return this._parent.querySelectorAll(A)}};function qo(A){return function(){return A}}function jo(A,t,e,r,n,i){for(var s=0,a,o=t.length,B=i.length;s<B;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):e[s]=new Be(A,i[s]);for(;s<o;++s)(a=t[s])&&(n[s]=a)}function AB(A,t,e,r,n,i,s){var a,o,B=new Map,c=t.length,l=i.length,u=new Array(c),f;for(a=0;a<c;++a)(o=t[a])&&(u[a]=f=s.call(o,o.__data__,a,t)+"",B.has(f)?n[a]=o:B.set(f,o));for(a=0;a<l;++a)f=s.call(A,i[a],a,i)+"",(o=B.get(f))?(r[a]=o,o.__data__=i[a],B.delete(f)):e[a]=new Be(A,i[a]);for(a=0;a<c;++a)(o=t[a])&&B.get(u[a])===o&&(n[a]=o)}function tB(A){return A.__data__}function eB(A,t){if(!arguments.length)return Array.from(this,tB);var e=t?AB:jo,r=this._parents,n=this._groups;typeof A!="function"&&(A=qo(A));for(var i=n.length,s=new Array(i),a=new Array(i),o=new Array(i),B=0;B<i;++B){var c=r[B],l=n[B],u=l.length,f=rB(A.call(c,c&&c.__data__,B,r)),g=f.length,C=a[B]=new Array(g),h=s[B]=new Array(g),w=o[B]=new Array(u);e(c,l,C,h,w,f,t);for(var Q=0,p=0,F,U;Q<g;++Q)if(F=C[Q]){for(Q>=p&&(p=Q+1);!(U=h[p])&&++p<g;);F._next=U||null}}return s=new uA(s,r),s._enter=a,s._exit=o,s}function rB(A){return typeof A=="object"&&"length"in A?A:Array.from(A)}function nB(){return new uA(this._exit||this._groups.map(li),this._parents)}function iB(A,t,e){var r=this.enter(),n=this,i=this.exit();return typeof A=="function"?(r=A(r),r&&(r=r.selection())):r=r.append(A+""),t!=null&&(n=t(n),n&&(n=n.selection())),e==null?i.remove():e(i),r&&n?r.merge(n).order():n}function sB(A){for(var t=A.selection?A.selection():A,e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),a=new Array(n),o=0;o<s;++o)for(var B=e[o],c=r[o],l=B.length,u=a[o]=new Array(l),f,g=0;g<l;++g)(f=B[g]||c[g])&&(u[g]=f);for(;o<n;++o)a[o]=e[o];return new uA(a,this._parents)}function aB(){for(var A=this._groups,t=-1,e=A.length;++t<e;)for(var r=A[t],n=r.length-1,i=r[n],s;--n>=0;)(s=r[n])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function oB(A){A||(A=BB);function t(l,u){return l&&u?A(l.__data__,u.__data__):!l-!u}for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i){for(var s=e[i],a=s.length,o=n[i]=new Array(a),B,c=0;c<a;++c)(B=s[c])&&(o[c]=B);o.sort(t)}return new uA(n,this._parents).order()}function BB(A,t){return A<t?-1:A>t?1:A>=t?0:NaN}function cB(){var A=arguments[0];return arguments[0]=this,A.apply(null,arguments),this}function lB(){return Array.from(this)}function uB(){for(var A=this._groups,t=0,e=A.length;t<e;++t)for(var r=A[t],n=0,i=r.length;n<i;++n){var s=r[n];if(s)return s}return null}function fB(){let A=0;for(const t of this)++A;return A}function gB(){return!this.node()}function hB(A){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length,a;i<s;++i)(a=n[i])&&A.call(a,a.__data__,i,n);return this}function wB(A){return function(){this.removeAttribute(A)}}function QB(A){return function(){this.removeAttributeNS(A.space,A.local)}}function CB(A,t){return function(){this.setAttribute(A,t)}}function dB(A,t){return function(){this.setAttributeNS(A.space,A.local,t)}}function UB(A,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(A):this.setAttribute(A,e)}}function FB(A,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(A.space,A.local):this.setAttributeNS(A.space,A.local,e)}}function pB(A,t){var e=oe(A);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((t==null?e.local?QB:wB:typeof t=="function"?e.local?FB:UB:e.local?dB:CB)(e,t))}function ui(A){return A.ownerDocument&&A.ownerDocument.defaultView||A.document&&A||A.defaultView}function yB(A){return function(){this.style.removeProperty(A)}}function vB(A,t,e){return function(){this.style.setProperty(A,t,e)}}function EB(A,t,e){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(A):this.style.setProperty(A,r,e)}}function mB(A,t,e){return arguments.length>1?this.each((t==null?yB:typeof t=="function"?EB:vB)(A,t,e??"")):ot(this.node(),A)}function ot(A,t){return A.style.getPropertyValue(t)||ui(A).getComputedStyle(A,null).getPropertyValue(t)}function HB(A){return function(){delete this[A]}}function IB(A,t){return function(){this[A]=t}}function xB(A,t){return function(){var e=t.apply(this,arguments);e==null?delete this[A]:this[A]=e}}function LB(A,t){return arguments.length>1?this.each((t==null?HB:typeof t=="function"?xB:IB)(A,t)):this.node()[A]}function fi(A){return A.trim().split(/^|\s+/)}function Er(A){return A.classList||new gi(A)}function gi(A){this._node=A,this._names=fi(A.getAttribute("class")||"")}gi.prototype={add:function(A){var t=this._names.indexOf(A);t<0&&(this._names.push(A),this._node.setAttribute("class",this._names.join(" ")))},remove:function(A){var t=this._names.indexOf(A);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(A){return this._names.indexOf(A)>=0}};function hi(A,t){for(var e=Er(A),r=-1,n=t.length;++r<n;)e.add(t[r])}function wi(A,t){for(var e=Er(A),r=-1,n=t.length;++r<n;)e.remove(t[r])}function bB(A){return function(){hi(this,A)}}function KB(A){return function(){wi(this,A)}}function SB(A,t){return function(){(t.apply(this,arguments)?hi:wi)(this,A)}}function DB(A,t){var e=fi(A+"");if(arguments.length<2){for(var r=Er(this.node()),n=-1,i=e.length;++n<i;)if(!r.contains(e[n]))return!1;return!0}return this.each((typeof t=="function"?SB:t?bB:KB)(e,t))}function TB(){this.textContent=""}function MB(A){return function(){this.textContent=A}}function _B(A){return function(){var t=A.apply(this,arguments);this.textContent=t??""}}function OB(A){return arguments.length?this.each(A==null?TB:(typeof A=="function"?_B:MB)(A)):this.node().textContent}function RB(){this.innerHTML=""}function NB(A){return function(){this.innerHTML=A}}function GB(A){return function(){var t=A.apply(this,arguments);this.innerHTML=t??""}}function VB(A){return arguments.length?this.each(A==null?RB:(typeof A=="function"?GB:NB)(A)):this.node().innerHTML}function kB(){this.nextSibling&&this.parentNode.appendChild(this)}function PB(){return this.each(kB)}function XB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function JB(){return this.each(XB)}function YB(A){var t=typeof A=="function"?A:yr(A);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function WB(){return null}function ZB(A,t){var e=typeof A=="function"?A:yr(A),r=t==null?WB:typeof t=="function"?t:vr(t);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})}function $B(){var A=this.parentNode;A&&A.removeChild(this)}function zB(){return this.each($B)}function qB(){var A=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(A,this.nextSibling):A}function jB(){var A=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(A,this.nextSibling):A}function Ac(A){return this.select(A?jB:qB)}function tc(A){return arguments.length?this.property("__data__",A):this.node().__data__}function ec(A){return function(t){A.call(this,t,this.__data__)}}function rc(A){return A.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}})}function nc(A){return function(){var t=this.__on;if(t){for(var e=0,r=-1,n=t.length,i;e<n;++e)i=t[e],(!A.type||i.type===A.type)&&i.name===A.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function ic(A,t,e){return function(){var r=this.__on,n,i=ec(t);if(r){for(var s=0,a=r.length;s<a;++s)if((n=r[s]).type===A.type&&n.name===A.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=i,n.options=e),n.value=t;return}}this.addEventListener(A.type,i,e),n={type:A.type,name:A.name,value:t,listener:i,options:e},r?r.push(n):this.__on=[n]}}function sc(A,t,e){var r=rc(A+""),n,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var o=0,B=a.length,c;o<B;++o)for(n=0,c=a[o];n<i;++n)if((s=r[n]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?ic:nc,n=0;n<i;++n)this.each(a(r[n],t,e));return this}function Qi(A,t,e){var r=ui(A),n=r.CustomEvent;typeof n=="function"?n=new n(t,e):(n=r.document.createEvent("Event"),e?(n.initEvent(t,e.bubbles,e.cancelable),n.detail=e.detail):n.initEvent(t,!1,!1)),A.dispatchEvent(n)}function ac(A,t){return function(){return Qi(this,A,t)}}function oc(A,t){return function(){return Qi(this,A,t.apply(this,arguments))}}function Bc(A,t){return this.each((typeof t=="function"?oc:ac)(A,t))}function*cc(){for(var A=this._groups,t=0,e=A.length;t<e;++t)for(var r=A[t],n=0,i=r.length,s;n<i;++n)(s=r[n])&&(yield s)}var Ci=[null];function uA(A,t){this._groups=A,this._parents=t}function Bt(){return new uA([[document.documentElement]],Ci)}function lc(){return this}uA.prototype=Bt.prototype={constructor:uA,select:_o,selectAll:Go,selectChild:Xo,selectChildren:Zo,filter:$o,data:eB,enter:zo,exit:nB,join:iB,merge:sB,selection:lc,order:aB,sort:oB,call:cB,nodes:lB,node:uB,size:fB,empty:gB,each:hB,attr:pB,style:mB,property:LB,classed:DB,text:OB,html:VB,raise:PB,lower:JB,append:YB,insert:ZB,remove:zB,clone:Ac,datum:tc,on:sc,dispatch:Bc,[Symbol.iterator]:cc};function LA(A){return typeof A=="string"?new uA([[document.querySelector(A)]],[document.documentElement]):new uA([[A]],Ci)}function di(A){return LA(yr(A).call(document.documentElement))}function uc(A){let t;for(;t=A.sourceEvent;)A=t;return A}function mr(A,t){if(A=uc(A),t===void 0&&(t=A.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=A.clientX,r.y=A.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[A.clientX-n.left-t.clientLeft,A.clientY-n.top-t.clientTop]}}return[A.pageX,A.pageY]}var fc={value:()=>{}};function Hr(){for(var A=0,t=arguments.length,e={},r;A<t;++A){if(!(r=arguments[A]+"")||r in e||/[\s.]/.test(r))throw new Error("illegal type: "+r);e[r]=[]}return new ce(e)}function ce(A){this._=A}function gc(A,t){return A.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");if(n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}ce.prototype=Hr.prototype={constructor:ce,on:function(A,t){var e=this._,r=gc(A+"",e),n,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((n=(A=r[i]).type)&&(n=hc(e[n],A.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(n=(A=r[i]).type)e[n]=Ui(e[n],A.name,t);else if(t==null)for(n in e)e[n]=Ui(e[n],A.name,null);return this},copy:function(){var A={},t=this._;for(var e in t)A[e]=t[e].slice();return new ce(A)},call:function(A,t){if((n=arguments.length-2)>0)for(var e=new Array(n),r=0,n,i;r<n;++r)e[r]=arguments[r+2];if(!this._.hasOwnProperty(A))throw new Error("unknown type: "+A);for(i=this._[A],r=0,n=i.length;r<n;++r)i[r].value.apply(t,e)},apply:function(A,t,e){if(!this._.hasOwnProperty(A))throw new Error("unknown type: "+A);for(var r=this._[A],n=0,i=r.length;n<i;++n)r[n].value.apply(t,e)}};function hc(A,t){for(var e=0,r=A.length,n;e<r;++e)if((n=A[e]).name===t)return n.value}function Ui(A,t,e){for(var r=0,n=A.length;r<n;++r)if(A[r].name===t){A[r]=fc,A=A.slice(0,r).concat(A.slice(r+1));break}return e!=null&&A.push({name:t,value:e}),A}var ct=0,xt=0,Lt=0,Fi=1e3,le,bt,ue=0,zA=0,fe=0,Kt=typeof performance=="object"&&performance.now?performance:Date,pi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(A){setTimeout(A,17)};function Ir(){return zA||(pi(wc),zA=Kt.now()+fe)}function wc(){zA=0}function ge(){this._call=this._time=this._next=null}ge.prototype=yi.prototype={constructor:ge,restart:function(A,t,e){if(typeof A!="function")throw new TypeError("callback is not a function");e=(e==null?Ir():+e)+(t==null?0:+t),!this._next&&bt!==this&&(bt?bt._next=this:le=this,bt=this),this._call=A,this._time=e,xr()},stop:function(){this._call&&(this._call=null,this._time=1/0,xr())}};function yi(A,t,e){var r=new ge;return r.restart(A,t,e),r}function Qc(){Ir(),++ct;for(var A=le,t;A;)(t=zA-A._time)>=0&&A._call.call(void 0,t),A=A._next;--ct}function vi(){zA=(ue=Kt.now())+fe,ct=xt=0;try{Qc()}finally{ct=0,dc(),zA=0}}function Cc(){var A=Kt.now(),t=A-ue;t>Fi&&(fe-=t,ue=A)}function dc(){for(var A,t=le,e,r=1/0;t;)t._call?(r>t._time&&(r=t._time),A=t,t=t._next):(e=t._next,t._next=null,t=A?A._next=e:le=e);bt=A,xr(r)}function xr(A){if(!ct){xt&&(xt=clearTimeout(xt));var t=A-zA;t>24?(A<1/0&&(xt=setTimeout(vi,A-Kt.now()-fe)),Lt&&(Lt=clearInterval(Lt))):(Lt||(ue=Kt.now(),Lt=setInterval(Cc,Fi)),ct=1,pi(vi))}}function Ei(A,t,e){var r=new ge;return t=t==null?0:+t,r.restart(n=>{r.stop(),A(n+t)},t,e),r}var Uc=Hr("start","end","cancel","interrupt"),Fc=[],mi=0,Hi=1,Lr=2,he=3,Ii=4,br=5,we=6;function Qe(A,t,e,r,n,i){var s=A.__transition;if(!s)A.__transition={};else if(e in s)return;pc(A,e,{name:t,index:r,group:n,on:Uc,tween:Fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mi})}function Kr(A,t){var e=dA(A,t);if(e.state>mi)throw new Error("too late; already scheduled");return e}function EA(A,t){var e=dA(A,t);if(e.state>he)throw new Error("too late; already running");return e}function dA(A,t){var e=A.__transition;if(!e||!(e=e[t]))throw new Error("transition not found");return e}function pc(A,t,e){var r=A.__transition,n;r[t]=e,e.timer=yi(i,0,e.time);function i(B){e.state=Hi,e.timer.restart(s,e.delay,e.time),e.delay<=B&&s(B-e.delay)}function s(B){var c,l,u,f;if(e.state!==Hi)return o();for(c in r)if(f=r[c],f.name===e.name){if(f.state===he)return Ei(s);f.state===Ii?(f.state=we,f.timer.stop(),f.on.call("interrupt",A,A.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=we,f.timer.stop(),f.on.call("cancel",A,A.__data__,f.index,f.group),delete r[c])}if(Ei(function(){e.state===he&&(e.state=Ii,e.timer.restart(a,e.delay,e.time),a(B))}),e.state=Lr,e.on.call("start",A,A.__data__,e.index,e.group),e.state===Lr){for(e.state=he,n=new Array(u=e.tween.length),c=0,l=-1;c<u;++c)(f=e.tween[c].value.call(A,A.__data__,e.index,e.group))&&(n[++l]=f);n.length=l+1}}function a(B){for(var c=B<e.duration?e.ease.call(null,B/e.duration):(e.timer.restart(o),e.state=br,1),l=-1,u=n.length;++l<u;)n[l].call(A,c);e.state===br&&(e.on.call("end",A,A.__data__,e.index,e.group),o())}function o(){e.state=we,e.timer.stop(),delete r[t];for(var B in r)return;delete A.__transition}}function Sr(A,t){var e=A.__transition,r,n,i=!0,s;if(e){t=t==null?null:t+"";for(s in e){if((r=e[s]).name!==t){i=!1;continue}n=r.state>Lr&&r.state<br,r.state=we,r.timer.stop(),r.on.call(n?"interrupt":"cancel",A,A.__data__,r.index,r.group),delete e[s]}i&&delete A.__transition}}function yc(A){return this.each(function(){Sr(this,A)})}function Dr(A,t,e){A.prototype=t.prototype=e,e.constructor=A}function xi(A,t){var e=Object.create(A.prototype);for(var r in t)e[r]=t[r];return e}function St(){}var Dt=.7,Ce=1/Dt,lt="\\s*([+-]?\\d+)\\s*",Tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mA="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vc=/^#([0-9a-f]{3,8})$/,Ec=new RegExp(`^rgb\\(${lt},${lt},${lt}\\)$`),mc=new RegExp(`^rgb\\(${mA},${mA},${mA}\\)$`),Hc=new RegExp(`^rgba\\(${lt},${lt},${lt},${Tt}\\)$`),Ic=new RegExp(`^rgba\\(${mA},${mA},${mA},${Tt}\\)$`),xc=new RegExp(`^hsl\\(${Tt},${mA},${mA}\\)$`),Lc=new RegExp(`^hsla\\(${Tt},${mA},${mA},${Tt}\\)$`),Li={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};Dr(St,qA,{copy(A){return Object.assign(new this.constructor,this,A)},displayable(){return this.rgb().displayable()},hex:bi,formatHex:bi,formatHex8:bc,formatHsl:Kc,formatRgb:Ki,toString:Ki});function bi(){return this.rgb().formatHex()}function bc(){return this.rgb().formatHex8()}function Kc(){return _i(this).formatHsl()}function Ki(){return this.rgb().formatRgb()}function qA(A){var t,e;return A=(A+"").trim().toLowerCase(),(t=vc.exec(A))?(e=t[1].length,t=parseInt(t[1],16),e===6?Si(t):e===3?new BA(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?de(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?de(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ec.exec(A))?new BA(t[1],t[2],t[3],1):(t=mc.exec(A))?new BA(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Hc.exec(A))?de(t[1],t[2],t[3],t[4]):(t=Ic.exec(A))?de(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xc.exec(A))?Mi(t[1],t[2]/100,t[3]/100,1):(t=Lc.exec(A))?Mi(t[1],t[2]/100,t[3]/100,t[4]):Li.hasOwnProperty(A)?Si(Li[A]):A==="transparent"?new BA(NaN,NaN,NaN,0):null}function Si(A){return new BA(A>>16&255,A>>8&255,A&255,1)}function de(A,t,e,r){return r<=0&&(A=t=e=NaN),new BA(A,t,e,r)}function Sc(A){return A instanceof St||(A=qA(A)),A?(A=A.rgb(),new BA(A.r,A.g,A.b,A.opacity)):new BA}function Tr(A,t,e,r){return arguments.length===1?Sc(A):new BA(A,t,e,r??1)}function BA(A,t,e,r){this.r=+A,this.g=+t,this.b=+e,this.opacity=+r}Dr(BA,Tr,xi(St,{brighter(A){return A=A==null?Ce:Math.pow(Ce,A),new BA(this.r*A,this.g*A,this.b*A,this.opacity)},darker(A){return A=A==null?Dt:Math.pow(Dt,A),new BA(this.r*A,this.g*A,this.b*A,this.opacity)},rgb(){return this},clamp(){return new BA(jA(this.r),jA(this.g),jA(this.b),Ue(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:Di,formatHex:Di,formatHex8:Dc,formatRgb:Ti,toString:Ti}));function Di(){return`#${At(this.r)}${At(this.g)}${At(this.b)}`}function Dc(){return`#${At(this.r)}${At(this.g)}${At(this.b)}${At((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ti(){const A=Ue(this.opacity);return`${A===1?"rgb(":"rgba("}${jA(this.r)}, ${jA(this.g)}, ${jA(this.b)}${A===1?")":`, ${A})`}`}function Ue(A){return isNaN(A)?1:Math.max(0,Math.min(1,A))}function jA(A){return Math.max(0,Math.min(255,Math.round(A)||0))}function At(A){return A=jA(A),(A<16?"0":"")+A.toString(16)}function Mi(A,t,e,r){return r<=0?A=t=e=NaN:e<=0||e>=1?A=t=NaN:t<=0&&(A=NaN),new UA(A,t,e,r)}function _i(A){if(A instanceof UA)return new UA(A.h,A.s,A.l,A.opacity);if(A instanceof St||(A=qA(A)),!A)return new UA;if(A instanceof UA)return A;A=A.rgb();var t=A.r/255,e=A.g/255,r=A.b/255,n=Math.min(t,e,r),i=Math.max(t,e,r),s=NaN,a=i-n,o=(i+n)/2;return a?(t===i?s=(e-r)/a+(e<r)*6:e===i?s=(r-t)/a+2:s=(t-e)/a+4,a/=o<.5?i+n:2-i-n,s*=60):a=o>0&&o<1?0:s,new UA(s,a,o,A.opacity)}function Tc(A,t,e,r){return arguments.length===1?_i(A):new UA(A,t,e,r??1)}function UA(A,t,e,r){this.h=+A,this.s=+t,this.l=+e,this.opacity=+r}Dr(UA,Tc,xi(St,{brighter(A){return A=A==null?Ce:Math.pow(Ce,A),new UA(this.h,this.s,this.l*A,this.opacity)},darker(A){return A=A==null?Dt:Math.pow(Dt,A),new UA(this.h,this.s,this.l*A,this.opacity)},rgb(){var A=this.h%360+(this.h<0)*360,t=isNaN(A)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*t,n=2*e-r;return new BA(Mr(A>=240?A-240:A+120,n,r),Mr(A,n,r),Mr(A<120?A+240:A-120,n,r),this.opacity)},clamp(){return new UA(Oi(this.h),Fe(this.s),Fe(this.l),Ue(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 A=Ue(this.opacity);return`${A===1?"hsl(":"hsla("}${Oi(this.h)}, ${Fe(this.s)*100}%, ${Fe(this.l)*100}%${A===1?")":`, ${A})`}`}}));function Oi(A){return A=(A||0)%360,A<0?A+360:A}function Fe(A){return Math.max(0,Math.min(1,A||0))}function Mr(A,t,e){return(A<60?t+(e-t)*A/60:A<180?e:A<240?t+(e-t)*(240-A)/60:t)*255}const _r=A=>()=>A;function Mc(A,t){return function(e){return A+e*t}}function _c(A,t,e){return A=Math.pow(A,e),t=Math.pow(t,e)-A,e=1/e,function(r){return Math.pow(A+r*t,e)}}function Oc(A){return(A=+A)==1?Ri:function(t,e){return e-t?_c(t,e,A):_r(isNaN(t)?e:t)}}function Ri(A,t){var e=t-A;return e?Mc(A,e):_r(isNaN(A)?t:A)}const pe=(function A(t){var e=Oc(t);function r(n,i){var s=e((n=Tr(n)).r,(i=Tr(i)).r),a=e(n.g,i.g),o=e(n.b,i.b),B=Ri(n.opacity,i.opacity);return function(c){return n.r=s(c),n.g=a(c),n.b=o(c),n.opacity=B(c),n+""}}return r.gamma=A,r})(1);function Rc(A,t){t||(t=[]);var e=A?Math.min(t.length,A.length):0,r=t.slice(),n;return function(i){for(n=0;n<e;++n)r[n]=A[n]*(1-i)+t[n]*i;return r}}function Nc(A){return ArrayBuffer.isView(A)&&!(A instanceof DataView)}function Gc(A,t){var e=t?t.length:0,r=A?Math.min(e,A.length):0,n=new Array(r),i=new Array(e),s;for(s=0;s<r;++s)n[s]=ye(A[s],t[s]);for(;s<e;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=n[s](a);return i}}function Vc(A,t){var e=new Date;return A=+A,t=+t,function(r){return e.setTime(A*(1-r)+t*r),e}}function FA(A,t){return A=+A,t=+t,function(e){return A*(1-e)+t*e}}function kc(A,t){var e={},r={},n;(A===null||typeof A!="object")&&(A={}),(t===null||typeof t!="object")&&(t={});for(n in t)n in A?e[n]=ye(A[n],t[n]):r[n]=t[n];return function(i){for(n in e)r[n]=e[n](i);return r}}var Or=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rr=new RegExp(Or.source,"g");function Pc(A){return function(){return A}}function Xc(A){return function(t){return A(t)+""}}function Ni(A,t){var e=Or.lastIndex=Rr.lastIndex=0,r,n,i,s=-1,a=[],o=[];for(A=A+"",t=t+"";(r=Or.exec(A))&&(n=Rr.exec(t));)(i=n.index)>e&&(i=t.slice(e,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(n=n[0])?a[s]?a[s]+=n:a[++s]=n:(a[++s]=null,o.push({i:s,x:FA(r,n)})),e=Rr.lastIndex;return e<t.length&&(i=t.slice(e),a[s]?a[s]+=i:a[++s]=i),a.length<2?o[0]?Xc(o[0].x):Pc(t):(t=o.length,function(B){for(var c=0,l;c<t;++c)a[(l=o[c]).i]=l.x(B);return a.join("")})}function ye(A,t){var e=typeof t,r;return t==null||e==="boolean"?_r(t):(e==="number"?FA:e==="string"?(r=qA(t))?(t=r,pe):Ni:t instanceof qA?pe:t instanceof Date?Vc:Nc(t)?Rc:Array.isArray(t)?Gc:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?kc:FA)(A,t)}function Jc(A,t){return A=+A,t=+t,function(e){return Math.round(A*(1-e)+t*e)}}var Gi=180/Math.PI,Nr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vi(A,t,e,r,n,i){var s,a,o;return(s=Math.sqrt(A*A+t*t))&&(A/=s,t/=s),(o=A*e+t*r)&&(e-=A*o,r-=t*o),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,o/=a),A*r<t*e&&(A=-A,t=-t,o=-o,s=-s),{translateX:n,translateY:i,rotate:Math.atan2(t,A)*Gi,skewX:Math.atan(o)*Gi,scaleX:s,scaleY:a}}var ve;function Yc(A){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(A+"");return t.isIdentity?Nr:Vi(t.a,t.b,t.c,t.d,t.e,t.f)}function Wc(A){return A==null||(ve||(ve=document.createElementNS("http://www.w3.org/2000/svg","g")),ve.setAttribute("transform",A),!(A=ve.transform.baseVal.consolidate()))?Nr:(A=A.matrix,Vi(A.a,A.b,A.c,A.d,A.e,A.f))}function ki(A,t,e,r){function n(B){return B.length?B.pop()+" ":""}function i(B,c,l,u,f,g){if(B!==l||c!==u){var C=f.push("translate(",null,t,null,e);g.push({i:C-4,x:FA(B,l)},{i:C-2,x:FA(c,u)})}else(l||u)&&f.push("translate("+l+t+u+e)}function s(B,c,l,u){B!==c?(B-c>180?c+=360:c-B>180&&(B+=360),u.push({i:l.push(n(l)+"rotate(",null,r)-2,x:FA(B,c)})):c&&l.push(n(l)+"rotate("+c+r)}function a(B,c,l,u){B!==c?u.push({i:l.push(n(l)+"skewX(",null,r)-2,x:FA(B,c)}):c&&l.push(n(l)+"skewX("+c+r)}function o(B,c,l,u,f,g){if(B!==l||c!==u){var C=f.push(n(f)+"scale(",null,",",null,")");g.push({i:C-4,x:FA(B,l)},{i:C-2,x:FA(c,u)})}else(l!==1||u!==1)&&f.push(n(f)+"scale("+l+","+u+")")}return function(B,c){var l=[],u=[];return B=A(B),c=A(c),i(B.translateX,B.translateY,c.translateX,c.translateY,l,u),s(B.rotate,c.rotate,l,u),a(B.skewX,c.skewX,l,u),o(B.scaleX,B.scaleY,c.scaleX,c.scaleY,l,u),B=c=null,function(f){for(var g=-1,C=u.length,h;++g<C;)l[(h=u[g]).i]=h.x(f);return l.join("")}}}var Zc=ki(Yc,"px, ","px)","deg)"),$c=ki(Wc,", ",")",")");function zc(A,t){var e,r;return function(){var n=EA(this,A),i=n.tween;if(i!==e){r=e=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}n.tween=r}}function qc(A,t,e){var r,n;if(typeof e!="function")throw new Error;return function(){var i=EA(this,A),s=i.tween;if(s!==r){n=(r=s).slice();for(var a={name:t,value:e},o=0,B=n.length;o<B;++o)if(n[o].name===t){n[o]=a;break}o===B&&n.push(a)}i.tween=n}}function jc(A,t){var e=this._id;if(A+="",arguments.length<2){for(var r=dA(this.node(),e).tween,n=0,i=r.length,s;n<i;++n)if((s=r[n]).name===A)return s.value;return null}return this.each((t==null?zc:qc)(e,A,t))}function Gr(A,t,e){var r=A._id;return A.each(function(){var n=EA(this,r);(n.value||(n.value={}))[t]=e.apply(this,arguments)}),function(n){return dA(n,r).value[t]}}function Pi(A,t){var e;return(typeof t=="number"?FA:t instanceof qA?pe:(e=qA(t))?(t=e,pe):Ni)(A,t)}function Al(A){return function(){this.removeAttribute(A)}}function tl(A){return function(){this.removeAttributeNS(A.space,A.local)}}function el(A,t,e){var r,n=e+"",i;return function(){var s=this.getAttribute(A);return s===n?null:s===r?i:i=t(r=s,e)}}function rl(A,t,e){var r,n=e+"",i;return function(){var s=this.getAttributeNS(A.space,A.local);return s===n?null:s===r?i:i=t(r=s,e)}}function nl(A,t,e){var r,n,i;return function(){var s,a=e(this),o;return a==null?void this.removeAttribute(A):(s=this.getAttribute(A),o=a+"",s===o?null:s===r&&o===n?i:(n=o,i=t(r=s,a)))}}function il(A,t,e){var r,n,i;return function(){var s,a=e(this),o;return a==null?void this.removeAttributeNS(A.space,A.local):(s=this.getAttributeNS(A.space,A.local),o=a+"",s===o?null:s===r&&o===n?i:(n=o,i=t(r=s,a)))}}function sl(A,t){var e=oe(A),r=e==="transform"?$c:Pi;return this.attrTween(A,typeof t=="function"?(e.local?il:nl)(e,r,Gr(this,"attr."+A,t)):t==null?(e.local?tl:Al)(e):(e.local?rl:el)(e,r,t))}function al(A,t){return function(e){this.setAttribute(A,t.call(this,e))}}function ol(A,t){return function(e){this.setAttributeNS(A.space,A.local,t.call(this,e))}}function Bl(A,t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&ol(A,i)),e}return n._value=t,n}function cl(A,t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&al(A,i)),e}return n._value=t,n}function ll(A,t){var e="attr."+A;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;var r=oe(A);return this.tween(e,(r.local?Bl:cl)(r,t))}function ul(A,t){return function(){Kr(this,A).delay=+t.apply(this,arguments)}}function fl(A,t){return t=+t,function(){Kr(this,A).delay=t}}function gl(A){var t=this._id;return arguments.length?this.each((typeof A=="function"?ul:fl)(t,A)):dA(this.node(),t).delay}function hl(A,t){return function(){EA(this,A).duration=+t.apply(this,arguments)}}function wl(A,t){return t=+t,function(){EA(this,A).duration=t}}function Ql(A){var t=this._id;return arguments.length?this.each((typeof A=="function"?hl:wl)(t,A)):dA(this.node(),t).duration}function Cl(A,t){if(typeof t!="function")throw new Error;return function(){EA(this,A).ease=t}}function dl(A){var t=this._id;return arguments.length?this.each(Cl(t,A)):dA(this.node(),t).ease}function Ul(A,t){return function(){var e=t.apply(this,arguments);if(typeof e!="function")throw new Error;EA(this,A).ease=e}}function Fl(A){if(typeof A!="function")throw new Error;return this.each(Ul(this._id,A))}function pl(A){typeof A!="function"&&(A=Bi(A));for(var t=this._groups,e=t.length,r=new Array(e),n=0;n<e;++n)for(var i=t[n],s=i.length,a=r[n]=[],o,B=0;B<s;++B)(o=i[B])&&A.call(o,o.__data__,B,i)&&a.push(o);return new bA(r,this._parents,this._name,this._id)}function yl(A){if(A._id!==this._id)throw new Error;for(var t=this._groups,e=A._groups,r=t.length,n=e.length,i=Math.min(r,n),s=new Array(r),a=0;a<i;++a)for(var o=t[a],B=e[a],c=o.length,l=s[a]=new Array(c),u,f=0;f<c;++f)(u=o[f]||B[f])&&(l[f]=u);for(;a<r;++a)s[a]=t[a];return new bA(s,this._parents,this._name,this._id)}function vl(A){return(A+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||t==="start"})}function El(A,t,e){var r,n,i=vl(t)?Kr:EA;return function(){var s=i(this,A),a=s.on;a!==r&&(n=(r=a).copy()).on(t,e),s.on=n}}function ml(A,t){var e=this._id;return arguments.length<2?dA(this.node(),e).on.on(A):this.each(El(e,A,t))}function Hl(A){return function(){var t=this.parentNode;for(var e in this.__transition)if(+e!==A)return;t&&t.removeChild(this)}}function Il(){return this.on("end.remove",Hl(this._id))}function xl(A){var t=this._name,e=this._id;typeof A!="function"&&(A=vr(A));for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s)for(var a=r[s],o=a.length,B=i[s]=new Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=A.call(c,c.__data__,u,a))&&("__data__"in c&&(l.__data__=c.__data__),B[u]=l,Qe(B[u],t,e,u,B,dA(c,e)));return new bA(i,this._parents,t,e)}function Ll(A){var t=this._name,e=this._id;typeof A!="function"&&(A=oi(A));for(var r=this._groups,n=r.length,i=[],s=[],a=0;a<n;++a)for(var o=r[a],B=o.length,c,l=0;l<B;++l)if(c=o[l]){for(var u=A.call(c,c.__data__,l,o),f,g=dA(c,e),C=0,h=u.length;C<h;++C)(f=u[C])&&Qe(f,t,e,C,u,g);i.push(u),s.push(c)}return new bA(i,s,t,e)}var bl=Bt.prototype.constructor;function Kl(){return new bl(this._groups,this._parents)}function Sl(A,t){var e,r,n;return function(){var i=ot(this,A),s=(this.style.removeProperty(A),ot(this,A));return i===s?null:i===e&&s===r?n:n=t(e=i,r=s)}}function Xi(A){return function(){this.style.removeProperty(A)}}function Dl(A,t,e){var r,n=e+"",i;return function(){var s=ot(this,A);return s===n?null:s===r?i:i=t(r=s,e)}}function Tl(A,t,e){var r,n,i;return function(){var s=ot(this,A),a=e(this),o=a+"";return a==null&&(o=a=(this.style.removeProperty(A),ot(this,A))),s===o?null:s===r&&o===n?i:(n=o,i=t(r=s,a))}}function Ml(A,t){var e,r,n,i="style."+t,s="end."+i,a;return function(){var o=EA(this,A),B=o.on,c=o.value[i]==null?a||(a=Xi(t)):void 0;(B!==e||n!==c)&&(r=(e=B).copy()).on(s,n=c),o.on=r}}function _l(A,t,e){var r=(A+="")=="transform"?Zc:Pi;return t==null?this.styleTween(A,Sl(A,r)).on("end.style."+A,Xi(A)):typeof t=="function"?this.styleTween(A,Tl(A,r,Gr(this,"style."+A,t))).each(Ml(this._id,A)):this.styleTween(A,Dl(A,r,t),e).on("end.style."+A,null)}function Ol(A,t,e){return function(r){this.style.setProperty(A,t.call(this,r),e)}}function Rl(A,t,e){var r,n;function i(){var s=t.apply(this,arguments);return s!==n&&(r=(n=s)&&Ol(A,s,e)),r}return i._value=t,i}function Nl(A,t,e){var r="style."+(A+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Rl(A,t,e??""))}function Gl(A){return function(){this.textContent=A}}function Vl(A){return function(){var t=A(this);this.textContent=t??""}}function kl(A){return this.tween("text",typeof A=="function"?Vl(Gr(this,"text",A)):Gl(A==null?"":A+""))}function Pl(A){return function(t){this.textContent=A.call(this,t)}}function Xl(A){var t,e;function r(){var n=A.apply(this,arguments);return n!==e&&(t=(e=n)&&Pl(n)),t}return r._value=A,r}function Jl(A){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(A==null)return this.tween(t,null);if(typeof A!="function")throw new Error;return this.tween(t,Xl(A))}function Yl(){for(var A=this._name,t=this._id,e=Yi(),r=this._groups,n=r.length,i=0;i<n;++i)for(var s=r[i],a=s.length,o,B=0;B<a;++B)if(o=s[B]){var c=dA(o,t);Qe(o,A,e,B,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new bA(r,this._parents,A,e)}function Wl(){var A,t,e=this,r=e._id,n=e.size();return new Promise(function(i,s){var a={value:s},o={value:function(){--n===0&&i()}};e.each(function(){var B=EA(this,r),c=B.on;c!==A&&(t=(A=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(o)),B.on=t}),n===0&&i()})}var Zl=0;function bA(A,t,e,r){this._groups=A,this._parents=t,this._name=e,this._id=r}function Ji(A){return Bt().transition(A)}function Yi(){return++Zl}var KA=Bt.prototype;bA.prototype=Ji.prototype={constructor:bA,select:xl,selectAll:Ll,selectChild:KA.selectChild,selectChildren:KA.selectChildren,filter:pl,merge:yl,selection:Kl,transition:Yl,call:KA.call,nodes:KA.nodes,node:KA.node,size:KA.size,empty:KA.empty,each:KA.each,on:ml,attr:sl,attrTween:ll,style:_l,styleTween:Nl,text:kl,textTween:Jl,remove:Il,tween:jc,delay:gl,duration:Ql,ease:dl,easeVarying:Fl,end:Wl,[Symbol.iterator]:KA[Symbol.iterator]};function $l(A){return((A*=2)<=1?A*A*A:(A-=2)*A*A+2)/2}var zl={time:null,delay:0,duration:250,ease:$l};function ql(A,t){for(var e;!(e=A.__transition)||!(e=e[t]);)if(!(A=A.parentNode))throw new Error(`transition ${t} not found`);return e}function jl(A){var t,e;A instanceof bA?(t=A._id,A=A._name):(t=Yi(),(e=zl).time=Ir(),A=A==null?null:A+"");for(var r=this._groups,n=r.length,i=0;i<n;++i)for(var s=r[i],a=s.length,o,B=0;B<a;++B)(o=s[B])&&Qe(o,A,t,B,s,e||ql(o,t));return new bA(r,this._parents,A,t)}Bt.prototype.interrupt=yc,Bt.prototype.transition=jl;function Au(A){return A}var Vr=1,kr=2,Pr=3,Mt=4,Wi=1e-6;function tu(A){return"translate("+A+",0)"}function eu(A){return"translate(0,"+A+")"}function ru(A){return t=>+A(t)}function nu(A,t){return t=Math.max(0,A.bandwidth()-t*2)/2,A.round()&&(t=Math.round(t)),e=>+A(e)+t}function iu(){return!this.__axis}function Zi(A,t){var e=[],r=null,n=null,i=6,s=6,a=3,o=typeof window<"u"&&window.devicePixelRatio>1?0:.5,B=A===Vr||A===Mt?-1:1,c=A===Mt||A===kr?"x":"y",l=A===Vr||A===Pr?tu:eu;function u(f){var g=r??(t.ticks?t.ticks.apply(t,e):t.domain()),C=n??(t.tickFormat?t.tickFormat.apply(t,e):Au),h=Math.max(i,0)+a,w=t.range(),Q=+w[0]+o,p=+w[w.length-1]+o,F=(t.bandwidth?nu:ru)(t.copy(),o),U=f.selection?f.selection():f,d=U.selectAll(".domain").data([null]),m=U.selectAll(".tick").data(g,t).order(),y=m.exit(),E=m.enter().append("g").attr("class","tick"),L=m.select("line"),v=m.select("text");d=d.merge(d.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),m=m.merge(E),L=L.merge(E.append("line").attr("stroke","currentColor").attr(c+"2",B*i)),v=v.merge(E.append("text").attr("fill","currentColor").attr(c,B*h).attr("dy",A===Vr?"0em":A===Pr?"0.71em":"0.32em")),f!==U&&(d=d.transition(f),m=m.transition(f),L=L.transition(f),v=v.transition(f),y=y.transition(f).attr("opacity",Wi).attr("transform",function(K){return isFinite(K=F(K))?l(K+o):this.getAttribute("transform")}),E.attr("opacity",Wi).attr("transform",function(K){var I=this.parentNode.__axis;return l((I&&isFinite(I=I(K))?I:F(K))+o)})),y.remove(),d.attr("d",A===Mt||A===kr?s?"M"+B*s+","+Q+"H"+o+"V"+p+"H"+B*s:"M"+o+","+Q+"V"+p:s?"M"+Q+","+B*s+"V"+o+"H"+p+"V"+B*s:"M"+Q+","+o+"H"+p),m.attr("opacity",1).attr("transform",function(K){return l(F(K)+o)}),L.attr(c+"2",B*i),v.attr(c,B*h).text(C),U.filter(iu).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",A===kr?"start":A===Mt?"end":"middle"),U.each(function(){this.__axis=F})}return u.scale=function(f){return arguments.length?(t=f,u):t},u.ticks=function(){return e=Array.from(arguments),u},u.tickArguments=function(f){return arguments.length?(e=f==null?[]:Array.from(f),u):e.slice()},u.tickValues=function(f){return arguments.length?(r=f==null?null:Array.from(f),u):r&&r.slice()},u.tickFormat=function(f){return arguments.length?(n=f,u):n},u.tickSize=function(f){return arguments.length?(i=s=+f,u):i},u.tickSizeInner=function(f){return arguments.length?(i=+f,u):i},u.tickSizeOuter=function(f){return arguments.length?(s=+f,u):s},u.tickPadding=function(f){return arguments.length?(a=+f,u):a},u.offset=function(f){return arguments.length?(o=+f,u):o},u}function su(A){return Zi(Pr,A)}function au(A){return Zi(Mt,A)}const Xr={capture:!0,passive:!1};function Jr(A){A.preventDefault(),A.stopImmediatePropagation()}function ou(A){var t=A.document.documentElement,e=LA(A).on("dragstart.drag",Jr,Xr);"onselectstart"in t?e.on("selectstart.drag",Jr,Xr):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Bu(A,t){var e=A.document.documentElement,r=LA(A).on("dragstart.drag",null);t&&(r.on("click.drag",Jr,Xr),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}const Yr=A=>()=>A;function cu(A,{sourceEvent:t,target:e,selection:r,mode:n,dispatch:i}){Object.defineProperties(this,{type:{value:A,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function lu(A){A.stopImmediatePropagation()}function Wr(A){A.preventDefault(),A.stopImmediatePropagation()}var $i={name:"drag"},Zr={name:"space"},ut={name:"handle"},ft={name:"center"};const{abs:zi,max:nA,min:iA}=Math;function qi(A){return[+A[0],+A[1]]}function $r(A){return[qi(A[0]),qi(A[1])]}var zr={},qr={},uu={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(jr),input:function(A){return A==null?null:$r(A)},output:function(A){return A}},SA={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ji={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},As={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},fu={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},gu={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function jr(A){return{type:A}}function hu(A){return!A.ctrlKey&&!A.button}function wu(){var A=this.ownerSVGElement||this;return A.hasAttribute("viewBox")?(A=A.viewBox.baseVal,[[A.x,A.y],[A.x+A.width,A.y+A.height]]):[[0,0],[A.width.baseVal.value,A.height.baseVal.value]]}function Qu(){return navigator.maxTouchPoints||"ontouchstart"in this}function An(A){for(;!A.__brush;)if(!(A=A.parentNode))return;return A.__brush}function Cu(A){return A[0][0]===A[1][0]||A[0][1]===A[1][1]}function du(){return Uu(uu)}function Uu(A){var t=wu,e=hu,r=Qu,n=!0,i=Hr("start","brush","end"),s=6,a;function o(h){var w=h.property("__brush",C).selectAll(".overlay").data([jr("overlay")]);w.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",SA.overlay).merge(w).each(function(){var p=An(this).extent;LA(this).attr("x",p[0][0]).attr("y",p[0][1]).attr("width",p[1][0]-p[0][0]).attr("height",p[1][1]-p[0][1])}),h.selectAll(".selection").data([jr("selection")]).enter().append("rect").attr("class","selection").attr("cursor",SA.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var Q=h.selectAll(".handle").data(A.handles,function(p){return p.type});Q.exit().remove(),Q.enter().append("rect").attr("class",function(p){return"handle handle--"+p.type}).attr("cursor",function(p){return SA[p.type]}),h.each(B).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",u).filter(r).on("touchstart.brush",u).on("touchmove.brush",f).on("touchend.brush touchcancel.brush",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o.move=function(h,w,Q){h.tween?h.on("start.brush",function(p){c(this,arguments).beforestart().start(p)}).on("interrupt.brush end.brush",function(p){c(this,arguments).end(p)}).tween("brush",function(){var p=this,F=p.__brush,U=c(p,arguments),d=F.selection,m=A.input(typeof w=="function"?w.apply(this,arguments):w,F.extent),y=ye(d,m);function E(L){F.selection=L===1&&m===null?null:y(L),B.call(p),U.brush()}return d!==null&&m!==null?E:E(1)}):h.each(function(){var p=this,F=arguments,U=p.__brush,d=A.input(typeof w=="function"?w.apply(p,F):w,U.extent),m=c(p,F).beforestart();Sr(p),U.selection=d===null?null:d,B.call(p),m.start(Q).brush(Q).end(Q)})},o.clear=function(h,w){o.move(h,null,w)};function B(){var h=LA(this),w=An(this).selection;w?(h.selectAll(".selection").style("display",null).attr("x",w[0][0]).attr("y",w[0][1]).attr("width",w[1][0]-w[0][0]).attr("height",w[1][1]-w[0][1]),h.selectAll(".handle").style("display",null).attr("x",function(Q){return Q.type[Q.type.length-1]==="e"?w[1][0]-s/2:w[0][0]-s/2}).attr("y",function(Q){return Q.type[0]==="s"?w[1][1]-s/2:w[0][1]-s/2}).attr("width",function(Q){return Q.type==="n"||Q.type==="s"?w[1][0]-w[0][0]+s:s}).attr("height",function(Q){return Q.type==="e"||Q.type==="w"?w[1][1]-w[0][1]+s:s})):h.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function c(h,w,Q){var p=h.__brush.emitter;return p&&(!Q||!p.clean)?p:new l(h,w,Q)}function l(h,w,Q){this.that=h,this.args=w,this.state=h.__brush,this.active=0,this.clean=Q}l.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(h,w){return this.starting?(this.starting=!1,this.emit("start",h,w)):this.emit("brush",h),this},brush:function(h,w){return this.emit("brush",h,w),this},end:function(h,w){return--this.active===0&&(delete this.state.emitter,this.emit("end",h,w)),this},emit:function(h,w,Q){var p=LA(this.that).datum();i.call(h,this.that,new cu(h,{sourceEvent:w,target:o,selection:A.output(this.state.selection),mode:Q,dispatch:i}),p)}};function u(h){if(a&&!h.touches||!e.apply(this,arguments))return;var w=this,Q=h.target.__data__.type,p=(n&&h.metaKey?Q="overlay":Q)==="selection"?$i:n&&h.altKey?ft:ut,F=A===qr?null:fu[Q],U=A===zr?null:gu[Q],d=An(w),m=d.extent,y=d.selection,E=m[0][0],L,v,K=m[0][1],I,S,Y=m[1][0],O,R,J=m[1][1],T,b,M=0,G=0,rA,CA=F&&U&&n&&h.shiftKey,lA,vA,z=Array.from(h.touches||[h],_=>{const j=_.identifier;return _=mr(_,w),_.point0=_.slice(),_.identifier=j,_});Sr(w);var ie=c(w,arguments,!0).beforestart();if(Q==="overlay"){y&&(rA=!0);const _=[z[0],z[1]||z[0]];d.selection=y=[[L=A===qr?E:iA(_[0][0],_[1][0]),I=A===zr?K:iA(_[0][1],_[1][1])],[O=A===qr?Y:nA(_[0][0],_[1][0]),T=A===zr?J:nA(_[0][1],_[1][1])]],z.length>1&&at(h)}else L=y[0][0],I=y[0][1],O=y[1][0],T=y[1][1];v=L,S=I,R=O,b=T;var Lo=LA(w).attr("pointer-events","none"),se=Lo.selectAll(".overlay").attr("cursor",SA[Q]);if(h.touches)ie.moved=Ko,ie.ended=So;else{var bo=LA(h.view).on("mousemove.brush",Ko,!0).on("mouseup.brush",So,!0);n&&bo.on("keydown.brush",VC,!0).on("keyup.brush",kC,!0),ou(h.view)}B.call(w),ie.start(h,p.name);function Ko(_){for(const j of _.changedTouches||[_])for(const ae of z)ae.identifier===j.identifier&&(ae.cur=mr(j,w));if(CA&&!lA&&!vA&&z.length===1){const j=z[0];zi(j.cur[0]-j[0])>zi(j.cur[1]-j[1])?vA=!0:lA=!0}for(const j of z)j.cur&&(j[0]=j.cur[0],j[1]=j.cur[1]);rA=!0,Wr(_),at(_)}function at(_){const j=z[0],ae=j.point0;var ZA;switch(M=j[0]-ae[0],G=j[1]-ae[1],p){case Zr:case $i:{F&&(M=nA(E-L,iA(Y-O,M)),v=L+M,R=O+M),U&&(G=nA(K-I,iA(J-T,G)),S=I+G,b=T+G);break}case ut:{z[1]?(F&&(v=nA(E,iA(Y,z[0][0])),R=nA(E,iA(Y,z[1][0])),F=1),U&&(S=nA(K,iA(J,z[0][1])),b=nA(K,iA(J,z[1][1])),U=1)):(F<0?(M=nA(E-L,iA(Y-L,M)),v=L+M,R=O):F>0&&(M=nA(E-O,iA(Y-O,M)),v=L,R=O+M),U<0?(G=nA(K-I,iA(J-I,G)),S=I+G,b=T):U>0&&(G=nA(K-T,iA(J-T,G)),S=I,b=T+G));break}case ft:{F&&(v=nA(E,iA(Y,L-M*F)),R=nA(E,iA(Y,O+M*F))),U&&(S=nA(K,iA(J,I-G*U)),b=nA(K,iA(J,T+G*U)));break}}R<v&&(F*=-1,ZA=L,L=O,O=ZA,ZA=v,v=R,R=ZA,Q in ji&&se.attr("cursor",SA[Q=ji[Q]])),b<S&&(U*=-1,ZA=I,I=T,T=ZA,ZA=S,S=b,b=ZA,Q in As&&se.attr("cursor",SA[Q=As[Q]])),d.selection&&(y=d.selection),lA&&(v=y[0][0],R=y[1][0]),vA&&(S=y[0][1],b=y[1][1]),(y[0][0]!==v||y[0][1]!==S||y[1][0]!==R||y[1][1]!==b)&&(d.selection=[[v,S],[R,b]],B.call(w),ie.brush(_,p.name))}function So(_){if(lu(_),_.touches){if(_.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Bu(_.view,rA),bo.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Lo.attr("pointer-events","all"),se.attr("cursor",SA.overlay),d.selection&&(y=d.selection),Cu(y)&&(d.selection=null,B.call(w)),ie.end(_,p.name)}function VC(_){switch(_.keyCode){case 16:{CA=F&&U;break}case 18:{p===ut&&(F&&(O=R-M*F,L=v+M*F),U&&(T=b-G*U,I=S+G*U),p=ft,at(_));break}case 32:{(p===ut||p===ft)&&(F<0?O=R-M:F>0&&(L=v-M),U<0?T=b-G:U>0&&(I=S-G),p=Zr,se.attr("cursor",SA.selection),at(_));break}default:return}Wr(_)}function kC(_){switch(_.keyCode){case 16:{CA&&(lA=vA=CA=!1,at(_));break}case 18:{p===ft&&(F<0?O=R:F>0&&(L=v),U<0?T=b:U>0&&(I=S),p=ut,at(_));break}case 32:{p===Zr&&(_.altKey?(F&&(O=R-M*F,L=v+M*F),U&&(T=b-G*U,I=S+G*U),p=ft):(F<0?O=R:F>0&&(L=v),U<0?T=b:U>0&&(I=S),p=ut),se.attr("cursor",SA[Q]),at(_));break}default:return}Wr(_)}}function f(h){c(this,arguments).moved(h)}function g(h){c(this,arguments).ended(h)}function C(){var h=this.__brush||{selection:null};return h.extent=$r(t.apply(this,arguments)),h.dim=A,h}return o.extent=function(h){return arguments.length?(t=typeof h=="function"?h:Yr($r(h)),o):t},o.filter=function(h){return arguments.length?(e=typeof h=="function"?h:Yr(!!h),o):e},o.touchable=function(h){return arguments.length?(r=typeof h=="function"?h:Yr(!!h),o):r},o.handleSize=function(h){return arguments.length?(s=+h,o):s},o.keyModifiers=function(h){return arguments.length?(n=!!h,o):n},o.on=function(){var h=i.on.apply(i,arguments);return h===i?o:h},o}function Ee(A,t){return A==null||t==null?NaN:A<t?-1:A>t?1:A>=t?0:NaN}function Fu(A,t){return A==null||t==null?NaN:t<A?-1:t>A?1:t>=A?0:NaN}function ts(A){let t,e,r;A.length!==2?(t=Ee,e=(a,o)=>Ee(A(a),o),r=(a,o)=>A(a)-o):(t=A===Ee||A===Fu?A:pu,e=A,r=A);function n(a,o,B=0,c=a.length){if(B<c){if(t(o,o)!==0)return c;do{const l=B+c>>>1;e(a[l],o)<0?B=l+1:c=l}while(B<c)}return B}function i(a,o,B=0,c=a.length){if(B<c){if(t(o,o)!==0)return c;do{const l=B+c>>>1;e(a[l],o)<=0?B=l+1:c=l}while(B<c)}return B}function s(a,o,B=0,c=a.length){const l=n(a,o,B,c-1);return l>B&&r(a[l-1],o)>-r(a[l],o)?l-1:l}return{left:n,center:s,right:i}}function pu(){return 0}function yu(A){return A===null?NaN:+A}const vu=ts(Ee).right;ts(yu).center;class es extends Map{constructor(t,e=Hu){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),t!=null)for(const[r,n]of t)this.set(r,n)}get(t){return super.get(rs(this,t))}has(t){return super.has(rs(this,t))}set(t,e){return super.set(Eu(this,t),e)}delete(t){return super.delete(mu(this,t))}}function rs({_intern:A,_key:t},e){const r=t(e);return A.has(r)?A.get(r):e}function Eu({_intern:A,_key:t},e){const r=t(e);return A.has(r)?A.get(r):(A.set(r,e),e)}function mu({_intern:A,_key:t},e){const r=t(e);return A.has(r)&&(e=A.get(r),A.delete(r)),e}function Hu(A){return A!==null&&typeof A=="object"?A.valueOf():A}const Iu=Math.sqrt(50),xu=Math.sqrt(10),Lu=Math.sqrt(2);function me(A,t,e){const r=(t-A)/Math.max(0,e),n=Math.floor(Math.log10(r)),i=r/Math.pow(10,n),s=i>=Iu?10:i>=xu?5:i>=Lu?2:1;let a,o,B;return n<0?(B=Math.pow(10,-n)/s,a=Math.round(A*B),o=Math.round(t*B),a/B<A&&++a,o/B>t&&--o,B=-B):(B=Math.pow(10,n)*s,a=Math.round(A/B),o=Math.round(t/B),a*B<A&&++a,o*B>t&&--o),o<a&&.5<=e&&e<2?me(A,t,e*2):[a,o,B]}function tn(A,t,e){if(t=+t,A=+A,e=+e,!(e>0))return[];if(A===t)return[A];const r=t<A,[n,i,s]=r?me(t,A,e):me(A,t,e);if(!(i>=n))return[];const a=i-n+1,o=new Array(a);if(r)if(s<0)for(let B=0;B<a;++B)o[B]=(i-B)/-s;else for(let B=0;B<a;++B)o[B]=(i-B)*s;else if(s<0)for(let B=0;B<a;++B)o[B]=(n+B)/-s;else for(let B=0;B<a;++B)o[B]=(n+B)*s;return o}function en(A,t,e){return t=+t,A=+A,e=+e,me(A,t,e)[2]}function bu(A,t,e){t=+t,A=+A,e=+e;const r=t<A,n=r?en(t,A,e):en(A,t,e);return(r?-1:1)*(n<0?1/-n:n)}function Ku(A,t,e){A=+A,t=+t,e=(n=arguments.length)<2?(t=A,A=0,1):n<3?1:+e;for(var r=-1,n=Math.max(0,Math.ceil((t-A)/e))|0,i=new Array(n);++r<n;)i[r]=A+r*e;return i}function He(A,t){switch(arguments.length){case 0:break;case 1:this.range(A);break;default:this.range(t).domain(A);break}return this}const ns=Symbol("implicit");function is(){var A=new es,t=[],e=[],r=ns;function n(i){let s=A.get(i);if(s===void 0){if(r!==ns)return r;A.set(i,s=t.push(i)-1)}return e[s%e.length]}return n.domain=function(i){if(!arguments.length)return t.slice();t=[],A=new es;for(const s of i)A.has(s)||A.set(s,t.push(s)-1);return n},n.range=function(i){return arguments.length?(e=Array.from(i),n):e.slice()},n.unknown=function(i){return arguments.length?(r=i,n):r},n.copy=function(){return is(t,e).unknown(r)},He.apply(n,arguments),n}function ss(){var A=is().unknown(void 0),t=A.domain,e=A.range,r=0,n=1,i,s,a=!1,o=0,B=0,c=.5;delete A.unknown;function l(){var u=t().length,f=n<r,g=f?n:r,C=f?r:n;i=(C-g)/Math.max(1,u-o+B*2),a&&(i=Math.floor(i)),g+=(C-g-i*(u-o))*c,s=i*(1-o),a&&(g=Math.round(g),s=Math.round(s));var h=Ku(u).map(function(w){return g+i*w});return e(f?h.reverse():h)}return A.domain=function(u){return arguments.length?(t(u),l()):t()},A.range=function(u){return arguments.length?([r,n]=u,r=+r,n=+n,l()):[r,n]},A.rangeRound=function(u){return[r,n]=u,r=+r,n=+n,a=!0,l()},A.bandwidth=function(){return s},A.step=function(){return i},A.round=function(u){return arguments.length?(a=!!u,l()):a},A.padding=function(u){return arguments.length?(o=Math.min(1,B=+u),l()):o},A.paddingInner=function(u){return arguments.length?(o=Math.min(1,u),l()):o},A.paddingOuter=function(u){return arguments.length?(B=+u,l()):B},A.align=function(u){return arguments.length?(c=Math.max(0,Math.min(1,u)),l()):c},A.copy=function(){return ss(t(),[r,n]).round(a).paddingInner(o).paddingOuter(B).align(c)},He.apply(l(),arguments)}function Su(A){return function(){return A}}function Du(A){return+A}var as=[0,1];function gt(A){return A}function rn(A,t){return(t-=A=+A)?function(e){return(e-A)/t}:Su(isNaN(t)?NaN:.5)}function Tu(A,t){var e;return A>t&&(e=A,A=t,t=e),function(r){return Math.max(A,Math.min(t,r))}}function Mu(A,t,e){var r=A[0],n=A[1],i=t[0],s=t[1];return n<r?(r=rn(n,r),i=e(s,i)):(r=rn(r,n),i=e(i,s)),function(a){return i(r(a))}}function _u(A,t,e){var r=Math.min(A.length,t.length)-1,n=new Array(r),i=new Array(r),s=-1;for(A[r]<A[0]&&(A=A.slice().reverse(),t=t.slice().reverse());++s<r;)n[s]=rn(A[s],A[s+1]),i[s]=e(t[s],t[s+1]);return function(a){var o=vu(A,a,1,r)-1;return i[o](n[o](a))}}function os(A,t){return t.domain(A.domain()).range(A.range()).interpolate(A.interpolate()).clamp(A.clamp()).unknown(A.unknown())}function Bs(){var A=as,t=as,e=ye,r,n,i,s=gt,a,o,B;function c(){var u=Math.min(A.length,t.length);return s!==gt&&(s=Tu(A[0],A[u-1])),a=u>2?_u:Mu,o=B=null,l}function l(u){return u==null||isNaN(u=+u)?i:(o||(o=a(A.map(r),t,e)))(r(s(u)))}return l.invert=function(u){return s(n((B||(B=a(t,A.map(r),FA)))(u)))},l.domain=function(u){return arguments.length?(A=Array.from(u,Du),c()):A.slice()},l.range=function(u){return arguments.length?(t=Array.from(u),c()):t.slice()},l.rangeRound=function(u){return t=Array.from(u),e=Jc,c()},l.clamp=function(u){return arguments.length?(s=u?!0:gt,c()):s!==gt},l.interpolate=function(u){return arguments.length?(e=u,c()):e},l.unknown=function(u){return arguments.length?(i=u,l):i},function(u,f){return r=u,n=f,c()}}function Ou(){return Bs()(gt,gt)}function Ru(A){return Math.abs(A=Math.round(A))>=1e21?A.toLocaleString("en").replace(/,/g,""):A.toString(10)}function Ie(A,t){if((e=(A=t?A.toExponential(t-1):A.toExponential()).indexOf("e"))<0)return null;var e,r=A.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+A.slice(e+1)]}function ht(A){return A=Ie(Math.abs(A)),A?A[1]:NaN}function Nu(A,t){return function(e,r){for(var n=e.length,i=[],s=0,a=A[0],o=0;n>0&&a>0&&(o+a+1>r&&(a=Math.max(1,r-o)),i.push(e.substring(n-=a,n+a)),!((o+=a+1)>r));)a=A[s=(s+1)%A.length];return i.reverse().join(t)}}function Gu(A){return function(t){return t.replace(/[0-9]/g,function(e){return A[+e]})}}var Vu=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _t(A){if(!(t=Vu.exec(A)))throw new Error("invalid format: "+A);var t;return new nn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}_t.prototype=nn.prototype;function nn(A){this.fill=A.fill===void 0?" ":A.fill+"",this.align=A.align===void 0?">":A.align+"",this.sign=A.sign===void 0?"-":A.sign+"",this.symbol=A.symbol===void 0?"":A.symbol+"",this.zero=!!A.zero,this.width=A.width===void 0?void 0:+A.width,this.comma=!!A.comma,this.precision=A.precision===void 0?void 0:+A.precision,this.trim=!!A.trim,this.type=A.type===void 0?"":A.type+""}nn.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 ku(A){A:for(var t=A.length,e=1,r=-1,n;e<t;++e)switch(A[e]){case".":r=n=e;break;case"0":r===0&&(r=e),n=e;break;default:if(!+A[e])break A;r>0&&(r=0);break}return r>0?A.slice(0,r)+A.slice(n+1):A}var cs;function Pu(A,t){var e=Ie(A,t);if(!e)return A+"";var r=e[0],n=e[1],i=n-(cs=Math.max(-8,Math.min(8,Math.floor(n/3)))*3)+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Ie(A,Math.max(0,t+i-1))[0]}function ls(A,t){var e=Ie(A,t);if(!e)return A+"";var r=e[0],n=e[1];return n<0?"0."+new Array(-n).join("0")+r:r.length>n+1?r.slice(0,n+1)+"."+r.slice(n+1):r+new Array(n-r.length+2).join("0")}const us={"%":(A,t)=>(A*100).toFixed(t),b:A=>Math.round(A).toString(2),c:A=>A+"",d:Ru,e:(A,t)=>A.toExponential(t),f:(A,t)=>A.toFixed(t),g:(A,t)=>A.toPrecision(t),o:A=>Math.round(A).toString(8),p:(A,t)=>ls(A*100,t),r:ls,s:Pu,X:A=>Math.round(A).toString(16).toUpperCase(),x:A=>Math.round(A).toString(16)};function fs(A){return A}var gs=Array.prototype.map,hs=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xu(A){var t=A.grouping===void 0||A.thousands===void 0?fs:Nu(gs.call(A.grouping,Number),A.thousands+""),e=A.currency===void 0?"":A.currency[0]+"",r=A.currency===void 0?"":A.currency[1]+"",n=A.decimal===void 0?".":A.decimal+"",i=A.numerals===void 0?fs:Gu(gs.call(A.numerals,String)),s=A.percent===void 0?"%":A.percent+"",a=A.minus===void 0?"−":A.minus+"",o=A.nan===void 0?"NaN":A.nan+"";function B(l){l=_t(l);var u=l.fill,f=l.align,g=l.sign,C=l.symbol,h=l.zero,w=l.width,Q=l.comma,p=l.precision,F=l.trim,U=l.type;U==="n"?(Q=!0,U="g"):us[U]||(p===void 0&&(p=12),F=!0,U="g"),(h||u==="0"&&f==="=")&&(h=!0,u="0",f="=");var d=C==="$"?e:C==="#"&&/[boxX]/.test(U)?"0"+U.toLowerCase():"",m=C==="$"?r:/[%p]/.test(U)?s:"",y=us[U],E=/[defgprs%]/.test(U);p=p===void 0?6:/[gprs]/.test(U)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p));function L(v){var K=d,I=m,S,Y,O;if(U==="c")I=y(v)+I,v="";else{v=+v;var R=v<0||1/v<0;if(v=isNaN(v)?o:y(Math.abs(v),p),F&&(v=ku(v)),R&&+v==0&&g!=="+"&&(R=!1),K=(R?g==="("?g:a:g==="-"||g==="("?"":g)+K,I=(U==="s"?hs[8+cs/3]:"")+I+(R&&g==="("?")":""),E){for(S=-1,Y=v.length;++S<Y;)if(O=v.charCodeAt(S),48>O||O>57){I=(O===46?n+v.slice(S+1):v.slice(S))+I,v=v.slice(0,S);break}}}Q&&!h&&(v=t(v,1/0));var J=K.length+v.length+I.length,T=J<w?new Array(w-J+1).join(u):"";switch(Q&&h&&(v=t(T+v,T.length?w-I.length:1/0),T=""),f){case"<":v=K+v+I+T;break;case"=":v=K+T+v+I;break;case"^":v=T.slice(0,J=T.length>>1)+K+v+I+T.slice(J);break;default:v=T+K+v+I;break}return i(v)}return L.toString=function(){return l+""},L}function c(l,u){var f=B((l=_t(l),l.type="f",l)),g=Math.max(-8,Math.min(8,Math.floor(ht(u)/3)))*3,C=Math.pow(10,-g),h=hs[8+g/3];return function(w){return f(C*w)+h}}return{format:B,formatPrefix:c}}var xe,sn,ws;Ju({thousands:",",grouping:[3],currency:["$",""]});function Ju(A){return xe=Xu(A),sn=xe.format,ws=xe.formatPrefix,xe}function Yu(A){return Math.max(0,-ht(Math.abs(A)))}function Wu(A,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ht(t)/3)))*3-ht(Math.abs(A)))}function Zu(A,t){return A=Math.abs(A),t=Math.abs(t)-A,Math.max(0,ht(t)-ht(A))+1}function $u(A,t,e,r){var n=bu(A,t,e),i;switch(r=_t(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(A),Math.abs(t));return r.precision==null&&!isNaN(i=Wu(n,s))&&(r.precision=i),ws(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=Zu(n,Math.max(Math.abs(A),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=Yu(n))&&(r.precision=i-(r.type==="%")*2);break}}return sn(r)}function zu(A){var t=A.domain;return A.ticks=function(e){var r=t();return tn(r[0],r[r.length-1],e??10)},A.tickFormat=function(e,r){var n=t();return $u(n[0],n[n.length-1],e??10,r)},A.nice=function(e){e==null&&(e=10);var r=t(),n=0,i=r.length-1,s=r[n],a=r[i],o,B,c=10;for(a<s&&(B=s,s=a,a=B,B=n,n=i,i=B);c-- >0;){if(B=en(s,a,e),B===o)return r[n]=s,r[i]=a,t(r);if(B>0)s=Math.floor(s/B)*B,a=Math.ceil(a/B)*B;else if(B<0)s=Math.ceil(s*B)/B,a=Math.floor(a*B)/B;else break;o=B}return A},A}function Qs(){var A=Ou();return A.copy=function(){return os(A,Qs())},He.apply(A,arguments),zu(A)}function qu(A,t){A=A.slice();var e=0,r=A.length-1,n=A[e],i=A[r],s;return i<n&&(s=e,e=r,r=s,s=n,n=i,i=s),A[e]=t.floor(n),A[r]=t.ceil(i),A}function Cs(A){return Math.log(A)}function ds(A){return Math.exp(A)}function ju(A){return-Math.log(-A)}function Af(A){return-Math.exp(-A)}function tf(A){return isFinite(A)?+("1e"+A):A<0?0:A}function ef(A){return A===10?tf:A===Math.E?Math.exp:t=>Math.pow(A,t)}function rf(A){return A===Math.E?Math.log:A===10&&Math.log10||A===2&&Math.log2||(A=Math.log(A),t=>Math.log(t)/A)}function Us(A){return(t,e)=>-A(-t,e)}function nf(A){const t=A(Cs,ds),e=t.domain;let r=10,n,i;function s(){return n=rf(r),i=ef(r),e()[0]<0?(n=Us(n),i=Us(i),A(ju,Af)):A(Cs,ds),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(e(a),s()):e()},t.ticks=a=>{const o=e();let B=o[0],c=o[o.length-1];const l=c<B;l&&([B,c]=[c,B]);let u=n(B),f=n(c),g,C;const h=a==null?10:+a;let w=[];if(!(r%1)&&f-u<h){if(u=Math.floor(u),f=Math.ceil(f),B>0){for(;u<=f;++u)for(g=1;g<r;++g)if(C=u<0?g/i(-u):g*i(u),!(C<B)){if(C>c)break;w.push(C)}}else for(;u<=f;++u)for(g=r-1;g>=1;--g)if(C=u>0?g/i(-u):g*i(u),!(C<B)){if(C>c)break;w.push(C)}w.length*2<h&&(w=tn(B,c,h))}else w=tn(u,f,Math.min(f-u,h)).map(i);return l?w.reverse():w},t.tickFormat=(a,o)=>{if(a==null&&(a=10),o==null&&(o=r===10?"s":","),typeof o!="function"&&(!(r%1)&&(o=_t(o)).precision==null&&(o.trim=!0),o=sn(o)),a===1/0)return o;const B=Math.max(1,r*a/t.ticks().length);return c=>{let l=c/i(Math.round(n(c)));return l*r<r-.5&&(l*=r),l<=B?o(c):""}},t.nice=()=>e(qu(e(),{floor:a=>i(Math.floor(n(a))),ceil:a=>i(Math.ceil(n(a)))})),t}function Fs(){const A=nf(Bs()).domain([1,10]);return A.copy=()=>os(A,Fs()).base(A.base()),He.apply(A,arguments),A}LA.prototype.transition=Ji;var D=(A=>(A.Svg="svg",A.ClipPath="clipPath",A.BaseLayer="baseLayer",A.Axes="axes",A.Area="area",A.Zoom="zoom",A.Trace="trace",A.Tooltip="skadi-chart-tooltip",A.Grid="grid",A.Scatter="scatter",A.Custom="custom",A))(D||{});class DA{constructor(){this.properties=null}brushStart(){}beforeZoom(t){}async zoom(t){}afterZoom(t){}}const ps=A=>Math.floor(A*10)/10,an=(A,t)=>t+ps(A.x)+","+ps(A.y),wt=(A,t)=>{const{width:e,height:r,margin:n}=t.clipPathBounds,i={x:[n.left,e-n.right],y:[r-n.bottom,n.top]},s=[];let a="";const{x:o,y:B}=A[0];let c=i.x[0]<=o&&o<=i.x[1]&&i.y[1]<=B&&B<=i.y[0];for(let l=0;l<A.length;l++){const{x:u,y:f}=A[l],g=i.x[0]<=u&&u<=i.x[1]&&i.y[1]<=f&&f<=i.y[0];c?a+=an(A[l],a?"L":"M"):g&&(a&&s.push(a),a="",a+=an(A[l-1],"M"),a+=an(A[l],"L")),c=g}return a&&s.push(a),s},tt=(A,t)=>{const{x:e,y:r}=t.scaleConfig.numericalScales,{x:n,y:i}=t.scaleConfig.categoricalScales,{x:s,y:a}=A||{};return{x:s&&n?n.bands[s]:e,y:a&&i?i.bands[a]:r}},ys=A=>{const t={x:{start:1/0,end:-1/0},y:{start:1/0,end:-1/0}};for(let e=0;e<A.length;e++){const{x:r,y:n}=A[e];r<t.x.start&&(t.x.start=r),r>t.x.end&&(t.x.end=r),n<t.y.start&&(t.y.start=n),n>t.y.end&&(t.y.end=n)}return t},on=(A,t,e,r)=>`M${A},${e}L${A},${r}L${t},${r}L${t},${e}Z`,vs=(A,t)=>{const{categoricalScales:e,numericalScales:r}={...A.scaleConfig},n=Object.fromEntries(Object.entries(e).map(([s,a])=>{const o=s;return[o,Object.fromEntries(Object.entries((a==null?void 0:a.bands)??{}).map(([B,c])=>[B,t(c,o)]))]}));return[Object.fromEntries(Object.entries(r).map(([s,a])=>{const o=s;return[o,t(a,o)]})),n]},Es=(A,t,e)=>A.append("g").append("line").attr("x1",t.x.start).attr("x2",t.x.end).attr("y1",t.y.start).attr("y2",t.y.end).style("stroke",e).style("stroke-width",.5);class sf extends DA{constructor(t,e){super(),this.labels=t,this.labelPositions=e,this.type=D.Axes,this.drawAxis=(r,n)=>{const{width:i,height:s,margin:a}=n.bounds,{getHtmlId:o}=n,B=n.scaleConfig.numericalScales[r];if(this.labels[r]){const c=n.coreLayers[D.Svg].append("text").attr("id",`${o(D.Axes)}-label${r}`).style("font-size","1.2rem").attr("text-anchor","middle").text(this.labels[r]);if(r==="y"){const l=s-a.top-a.bottom;c.attr("x",-l/2-a.top).attr("y",a.left*this.labelPositions.y).attr("transform","rotate(-90)")}else{const l=i-a.left-a.right;c.attr("x",l/2+a.left).attr("y",s-a.bottom*this.labelPositions.x)}}return n.scaleConfig.categoricalScales[r]?this.drawCategoricalAxis(r,n):this.drawNumericalAxis(r,B,n,12)},this.draw=r=>{const{x:n,y:i}=r.scaleConfig.numericalScales,{animationDuration:s}=r.globals,{layer:a,axis:o,line:B}=this.drawAxis("x",r),{layer:c,axis:l,line:u}=this.drawAxis("y",r);this.zoom=async()=>{const f=a==null?void 0:a.transition().duration(s).call(o).end(),g=c==null?void 0:c.transition().duration(s).call(l).end(),C=B==null?void 0:B.transition().duration(s).attr("x1",n(0)).attr("x2",n(0)).end(),h=u==null?void 0:u.transition().duration(s).attr("y1",i(0)).attr("y2",i(0)).end();await Promise.all([f,g,C,h])}},this.drawCategoricalAxis=(r,n)=>{var p;const i=n.scaleConfig.categoricalScales[r].main,{margin:s}=n.bounds,a=n.coreLayers[D.Svg],{getHtmlId:o}=n,{padding:B,size:c,formatter:l}=n.globals.tickConfig.categorical[r],{translation:u,axisConstructor:f}=this.axisConfig(r,n),g=i.bandwidth(),h=(r==="x"?s.bottom:s.left)*(1-((p=this.labelPositions)==null?void 0:p[r]))/3,w=f(i).tickSize(c??0).tickPadding(B??h);return l&&w.tickFormat(l),a.append("g").attr("id",`${o(D.Axes)}-${r}`).style("font-size","0.75rem").attr("transform",`translate(${u.x},${u.y})`).call(w),Object.entries(n.scaleConfig.categoricalScales[r].bands).forEach(([F,U])=>{const d=i(F);n.globals.tickConfig.numerical[r].count&&this.drawNumericalAxis(r,U,n,6),i.paddingInner()&&this.drawLinePerpendicularToAxis(r,d,n),this.drawLinePerpendicularToAxis(r,d+g,n)}),{layer:null,axis:null,line:null}},this.drawNumericalAxis=(r,n,i,s)=>{const{getHtmlId:a}=i,{count:o,specifier:B,padding:c,size:l,formatter:u,enableMathJax:f}=i.globals.tickConfig.numerical[r],{translation:g,axisConstructor:C}=this.axisConfig(r,i);let h=null;const w=C(n).ticks(o??0,B).tickSize(l??0).tickPadding(c??s);u&&(f?w.tickFormat(()=>""):w.tickFormat((p,F)=>u(p,F)));const Q=i.coreLayers[D.Svg].append("g").attr("id",`${a(D.Axes)}-${r}`).style("font-size","0.75rem").attr("transform",`translate(${g.x},${g.y})`).call(w);return Q.select(".domain").style("stroke-opacity",0),u&&f&&(console.warn("enableMathJax is currently not compatible with zoom layer and is only available for the x axis"),Q.selectAll("g").data(w.scale().ticks()).append("foreignObject").attr("width",50).attr("height",50).attr("x",0).attr("y",c??s).append("xhtml:span").attr("class","tick-mathjax").text((p,F)=>u(p,F)),MathJax.typesetPromise().then(()=>{i.coreLayers[D.Svg].selectAll("span.tick-mathjax").nodes().forEach(F=>{const{width:U}=F.getBoundingClientRect(),d=F.parentElement;d.x.baseVal.value=-U/2})})),i.chartOptions.logScale[r]||(h=this.drawLinePerpendicularToAxis(r,n(0),i,"darkgrey")),{layer:Q,axis:w,line:h}},this.drawLinePerpendicularToAxis=(r,n,i,s="black")=>{var g;const a=i.coreLayers[D.BaseLayer],{height:o,width:B,margin:c}=i.bounds,l=r==="x"?"y":"x",u=(g=i.scaleConfig.categoricalScales[l])==null?void 0:g.main;if(!u){let C={[r]:{start:n,end:n}};return r==="x"?C.y={start:c.top,end:o-c.bottom}:C.x={start:c.left,end:B-c.right},Es(a,C,s)}const f=u.bandwidth();u.domain().forEach(C=>{const h=u(C);if(h===void 0)return;const w={[r]:{start:n,end:n},[l]:{start:h,end:h+f}};Es(a,w,s)})},this.axisConfig=(r,n)=>{const{height:i,margin:s}=n.bounds,a=r==="x"?"y":"x",o=r==="x"?i-s.bottom:s.left;return{translation:{[r]:0,[a]:o},axisConstructor:r==="x"?su:au}}}}const af=(A,t,e,r)=>A*r.x-t*r.y+e,ms=A=>{const t=Math.round(A.x),e=Math.round(A.y);return{x:t,y:e}},Bn=(A,t,e)=>{const r=A[t[0]],n=A[t[1]],i=n.y-r.y,s=n.x-r.x,a=n.x*r.y-n.y*r.x;let o=0,B=0;const c=Math.abs;for(let u=t[0];u<t[1];u++){const f=c(af(i,s,a,A[u]));f>o&&(o=f,B=u)}if(o/Math.sqrt(i*i+s*s)>e){const u=[t[0],B],f=Bn(A,u,e),g=[B,t[1]],C=Bn(A,g,e);return[...f.slice(0,-1),...C]}else{const u=ms(A[t[0]]),f=ms(A[t[1]]);return[u,f]}},of=(A,t)=>A.map(e=>{const r=[0,e.length-1];return Bn(e,r,t)});class Bf extends DA{constructor(t,e){super(),this.linesDC=t,this.options=e,this.type=D.Trace,this.traces=[],this.lowResLinesSC=[],this.getNewPoint=null,this.getNewPointInverse=null,this.customTween=(r,n)=>{const i=this.lowResLinesSC[r];return s=>{const a=i.map(({x:o,y:B})=>this.getNewPoint(o,B,s));return wt(a,n).join("")}},this.updateLowResLinesSC=r=>{const n=this.linesDC.map(i=>{const s=tt(i.bands,r);return i.points.map(a=>({x:s.x(a.x),y:s.y(a.y)}))});this.options.RDPEpsilon!==null?this.lowResLinesSC=of(n,this.options.RDPEpsilon):this.lowResLinesSC=n},this.draw=(r,n)=>{this.updateLowResLinesSC(r),this.traces=this.linesDC.map((i,s)=>{const a=wt(this.lowResLinesSC[s],r).join("");return r.coreLayers[D.BaseLayer].append("path").attr("id",`${r.getHtmlId(D.Trace)}-${s}`).attr("pointer-events","none").attr("fill","none").attr("stroke",i.style.strokeColor||"black").attr("opacity",i.style.opacity||1).attr("stroke-width",i.style.strokeWidth||.5).attr("stroke-dasharray",i.style.strokeDasharray||"").attr("d",a)}),this.beforeZoom=i=>{const{x:s,y:a}=r.scaleConfig.numericalScales,o=i.x,B=i.y,c=[s(o[0]),s(o[1])],l=[a(B[0]),a(B[1])],u=s.domain(),f=a.domain(),g=[s(u[0]),s(u[1])],C=[a(f[0]),a(f[1])],h=(g[1]-g[0])/(c[1]-c[0]),w=(C[1]-C[0])/(l[1]-l[0]),Q=h*s(o[0])-s(u[0]),p=w*a(B[0])-a(f[0]),F=h-1,U=w-1;this.getNewPoint=(d,m,y)=>({x:d*(y*F+1)-y*Q,y:m*(y*U+1)-y*p}),this.getNewPointInverse=(d,m,y)=>({x:(d+y*Q)/(y*F+1),y:(m+y*p)/(y*U+1)})},this.zoom=async i=>{const s=[];for(let a=0;a<this.linesDC.length;a++){const o=this.traces[a].transition().duration(r.globals.animationDuration).attrTween("d",()=>this.customTween(a,r)).end();s.push(o)}await Promise.all(s),this.updateLowResLinesSC(r),this.traces.forEach((a,o)=>{a.attr("d",wt(this.lowResLinesSC[o],r).join(""))})}}}}class cf extends DA{constructor(t){super(),this.options=t,this.type=D.Zoom,this.zooming=!1,this.selectionMask=null,this.overlay=null,this.processSelection=(e,r)=>{const{width:n,height:i,margin:s}=r.bounds,[[a,o],[B,c]]=e.selection,l=30,u=Math.abs(a-B),f=Math.abs(o-c);return this.options.lockAxis==="y"?[[a,s.top],[B,i-s.bottom]]:this.options.lockAxis==="x"?[[s.left,o],[n-s.right,c]]:u>l&&f<=l?[[a,s.top],[B,i-s.bottom]]:u<=l&&f>l?[[s.left,o],[n-s.right,c]]:[[a,o],[B,c]]},this.handleZoom=async(e,r)=>{if(this.zooming)return;this.zooming=!0;const{x:n,y:i}=r.scaleConfig.numericalScales;r.optionalLayers.forEach(a=>a.beforeZoom(e)),e.x&&n.domain(e.x),e.y&&i.domain(e.y);const s=[];r.optionalLayers.forEach(a=>s.push(a.zoom(e))),await Promise.all(s),r.optionalLayers.forEach(a=>a.afterZoom(e)),this.zooming=!1},this.handleBrushEnd=(e,r,n)=>{if(this.overlay.style("display","none"),this.selectionMask.attr("x",0).attr("y",0).attr("width",0).attr("height",0),!e.selection){n.optionalLayers.forEach(w=>w.afterZoom(null));return}r.call(e.target.move,null);const[[i,s],[a,o]]=this.processSelection(e,n),B=n.scaleConfig.numericalScales.x,c=B.invert(i),l=B.invert(a),u=n.scaleConfig.numericalScales.y,f=u.invert(o),g=u.invert(s),C=10;if(Math.abs(i-a)<C||Math.abs(s-o)<C){n.optionalLayers.forEach(w=>w.afterZoom(null));return}const h={x:[c,l],y:[f,g],eventType:"brush"};this.handleZoom(h,n)},this.handleBrushMove=(e,r)=>{if(!e.selection)return;this.overlay.style("display","");const[[n,i],[s,a]]=this.processSelection(e,r);this.selectionMask.attr("x",Math.min(n,s)).attr("y",Math.min(i,a)).attr("width",Math.abs(n-s)).attr("height",Math.abs(i-a))},this.draw=e=>{const r=e.scaleConfig.categoricalScales;if(r.x&&r.y){console.warn("You have tried to use zoom with two categorical axes, but this is not supported.");return}Object.entries(r).forEach(([w,Q])=>{Q&&(this.options.lockAxis=w)});const{width:n,height:i,margin:s}=e.bounds,a=e.coreLayers[D.Svg],o=du().extent([[s.left,s.top],[n-s.right,i-s.bottom]]),B=e.coreLayers[D.BaseLayer].append("g").attr("id",`${e.getHtmlId(D.Zoom)}-brush`).style("opacity",0).call(o),c=`${e.getHtmlId(D.Zoom)}-overlay`;a.select("defs").append("svg:mask").attr("id",c).append("svg:rect").attr("width",n-s.right-s.left).attr("height",i-s.bottom-s.top).attr("x",s.left).attr("y",s.top).attr("fill","white").attr("fill-opacity",.15).style("mask-type","alpha");const l=`${e.getHtmlId(D.Zoom)}-selection`;this.selectionMask=a.select("defs").append("svg:mask").attr("id",l).append("svg:rect").attr("width",0).attr("height",0).attr("x",0).attr("y",0).attr("fill","white").style("mask-type","alpha"),this.overlay=a.append("svg:rect").attr("width",n-s.right-s.left).attr("height",i-s.bottom-s.top).attr("x",s.left).attr("y",s.top).style("display","none").style("mask-image",`url(#${c}), url(#${l})`).style("mask-composite","subtract"),o.on("start",()=>e.optionalLayers.forEach(w=>w.brushStart())),o.on("brush",w=>this.handleBrushMove(w,e)),o.on("end",w=>this.handleBrushEnd(w,B,e));const{x:u,y:f}=e.scaleConfig.scaleExtents,{x:g,y:C}=e.scaleConfig.numericalScales,h={x:[u.start,u.end],y:[f.start,f.end],eventType:"dblclick"};this.options.lockAxis==="y"&&(h.y=C.domain()),this.options.lockAxis==="x"&&(h.x=g.domain()),e.coreLayers[D.Svg].on("dblclick",()=>this.handleZoom(h,e))}}}class lf extends DA{constructor(t,e=25,r){super(),this.tooltipHtmlCallback=t,this.radiusPx=e,this.distanceAxis=r,this.type=D.Tooltip,this.tooltipRadiusSq=625,this.getDistanceSq=(n,i)=>{const s=n.x-i.x,a=n.y-i.y;return s*s+a*a},this.getDistanceSqSC=(n,i,s)=>{const a={x:n.x*s.x,y:n.y*s.y},o={x:i.x*s.x,y:i.y*s.y};return this.getDistanceSq(a,o)},this.convertSCPointToCC=(n,i)=>{const s=i.coreLayers[D.Svg].node().getScreenCTM(),{a,c:o,b:B,d:c}=s,{e:l,f:u}=s;return{x:a*n.x+o*n.y+l,y:B*n.x+c*n.y+u}},this.handleMouseMove=(n,i,s,a)=>{const o=mr(n),B={x:o[0],y:o[1]},c=this.distanceAxis,[l,u]=vs(i,(F,U)=>F.invert(B[U])),[f,g]=vs(i,F=>{const U=Math.abs(F.domain()[1]-F.domain()[0])||1;return(Math.abs(F.range()[1]-F.range()[0])||1)/U});let C=1/0;const h=a.reduce((F,U)=>{const d=U.bands||{},m={x:d.x?u.x[d.x]:l.x,y:d.y?u.y[d.y]:l.y},y={x:d.x?g.x[d.x]:f.x,y:d.y?g.y[d.y]:f.y};if(c){const[L,v]=[U,F].map(K=>{const I=m[c]*y[c],S=K[c]*y[c];return(I-S)**2});if(L>v)return F}const E=this.getDistanceSqSC(m,U,y);return E>=C?F:(C=E,U)},{x:0,y:0}),w=tt(h.bands,i),Q={x:w.x(h.x),y:w.y(h.y)};if(this.getDistanceSq(B,Q)>this.tooltipRadiusSq)s.style("opacity",0);else{const F=this.convertSCPointToCC(Q,i);s.html(this.tooltipHtmlCallback(h)).style("left",`${F.x}px`).style("top",`${F.y}px`).style("opacity",1)}},this.draw=n=>{const i=n.optionalLayers.filter(u=>u.type===D.Trace),s=n.optionalLayers.filter(u=>u.type===D.Scatter);if(i.length===0&&s.length===0){console.warn("Tooltip Layer was added without a Traces Layer or a Scatter Layer.");return}const a=di("div").attr("id",`${n.getHtmlId(this.type)}`).style("position","fixed").style("pointer-events","none");let o=i.reduce((u,f)=>[...f.linesDC.flatMap(({points:C,metadata:h,bands:w})=>C.map(Q=>({...Q,metadata:h,bands:w}))),...u],[]);o=s.reduce((u,f)=>[...f.points,...u],o);const B=n.coreLayers[D.Svg];let c,l=!1;B.on("mousemove",u=>{var f;c===void 0&&!l&&((f=document.querySelectorAll(`*[id*="${this.type}"]`))==null||f.forEach(g=>g.innerHTML=""),this.handleMouseMove(u,n,a,o),c=setTimeout(()=>{c=void 0},25))}),this.brushStart=()=>{l=!0,a.html("")},this.afterZoom=()=>{l=!1},B.on("mouseleave",()=>a.remove()),B.on("mouseenter",()=>document.body.append(a.node()))},this.tooltipRadiusSq=e*e}}class uf extends DA{constructor(t){super(),this.directions=t,this.type=D.Grid,this.draw=e=>{const{width:r,height:n,margin:i}=e.bounds,{x:s,y:a}=e.scaleConfig.numericalScales,o=e.coreLayers[D.Svg],{animationDuration:B,tickConfig:c}=e.globals,{getHtmlId:l}=e,u=.15,f=.5,g={},C=w=>{w.selectAll("line").data(s.ticks(c.numerical.x.count)).join("line").style("stroke","black").style("stroke-width",f).attr("pointer-events","none").attr("x1",Q=>s(Q)).attr("x2",Q=>s(Q)).attr("y1",i.top).attr("y2",n-i.bottom)},h=w=>{w.selectAll("line").data(a.ticks(c.numerical.y.count)).join("line").style("stroke","black").style("stroke-width",f).attr("pointer-events","none").attr("x1",i.left).attr("x2",r-i.right).attr("y1",Q=>a(Q)).attr("y2",Q=>a(Q))};this.directions.x&&(g.x=o.append("g").call(C).attr("opacity",u).attr("id",`${l(this.type)}-x`)),this.directions.y&&(g.y=o.append("g").call(h).attr("opacity",u).attr("id",`${l(this.type)}-y`)),this.zoom=async()=>{var U,d,m,y;const w=(U=g.x)==null?void 0:U.selectAll("line").transition().duration(B/2).style("opacity",0).remove().end(),Q=(d=g.y)==null?void 0:d.selectAll("line").transition().duration(B/2).style("opacity",0).remove().end();await Promise.all([w,Q]);const p=(m=g.x)==null?void 0:m.call(C).style("opacity",0).transition().duration(B/2).style("opacity",u).end(),F=(y=g.y)==null?void 0:y.call(h).style("opacity",0).transition().duration(B/2).style("opacity",u).end();await Promise.all([p,F])}}}}/*!
1
+ (function(RA,$A){typeof exports=="object"&&typeof module<"u"?$A(exports):typeof define=="function"&&define.amd?define(["exports"],$A):(RA=typeof globalThis<"u"?globalThis:RA||self,$A(RA["skadi-chart"]={}))})(this,(function(RA){"use strict";var $A="http://www.w3.org/1999/xhtml";const ai={svg:"http://www.w3.org/2000/svg",xhtml:$A,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function oe(A){var t=A+="",e=t.indexOf(":");return e>=0&&(t=A.slice(0,e))!=="xmlns"&&(A=A.slice(e+1)),ai.hasOwnProperty(t)?{space:ai[t],local:A}:A}function Do(A){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===$A&&t.documentElement.namespaceURI===$A?t.createElement(A):t.createElementNS(e,A)}}function To(A){return function(){return this.ownerDocument.createElementNS(A.space,A.local)}}function yr(A){var t=oe(A);return(t.local?To:Do)(t)}function Mo(){}function vr(A){return A==null?Mo:function(){return this.querySelector(A)}}function _o(A){typeof A!="function"&&(A=vr(A));for(var t=this._groups,e=t.length,r=new Array(e),n=0;n<e;++n)for(var i=t[n],s=i.length,a=r[n]=new Array(s),o,B,c=0;c<s;++c)(o=i[c])&&(B=A.call(o,o.__data__,c,i))&&("__data__"in o&&(B.__data__=o.__data__),a[c]=B);return new uA(r,this._parents)}function Oo(A){return A==null?[]:Array.isArray(A)?A:Array.from(A)}function Ro(){return[]}function oi(A){return A==null?Ro:function(){return this.querySelectorAll(A)}}function No(A){return function(){return Oo(A.apply(this,arguments))}}function Go(A){typeof A=="function"?A=No(A):A=oi(A);for(var t=this._groups,e=t.length,r=[],n=[],i=0;i<e;++i)for(var s=t[i],a=s.length,o,B=0;B<a;++B)(o=s[B])&&(r.push(A.call(o,o.__data__,B,s)),n.push(o));return new uA(r,n)}function Bi(A){return function(){return this.matches(A)}}function ci(A){return function(t){return t.matches(A)}}var Vo=Array.prototype.find;function ko(A){return function(){return Vo.call(this.children,A)}}function Po(){return this.firstElementChild}function Xo(A){return this.select(A==null?Po:ko(typeof A=="function"?A:ci(A)))}var Jo=Array.prototype.filter;function Yo(){return Array.from(this.children)}function Wo(A){return function(){return Jo.call(this.children,A)}}function Zo(A){return this.selectAll(A==null?Yo:Wo(typeof A=="function"?A:ci(A)))}function $o(A){typeof A!="function"&&(A=Bi(A));for(var t=this._groups,e=t.length,r=new Array(e),n=0;n<e;++n)for(var i=t[n],s=i.length,a=r[n]=[],o,B=0;B<s;++B)(o=i[B])&&A.call(o,o.__data__,B,i)&&a.push(o);return new uA(r,this._parents)}function li(A){return new Array(A.length)}function zo(){return new uA(this._enter||this._groups.map(li),this._parents)}function Be(A,t){this.ownerDocument=A.ownerDocument,this.namespaceURI=A.namespaceURI,this._next=null,this._parent=A,this.__data__=t}Be.prototype={constructor:Be,appendChild:function(A){return this._parent.insertBefore(A,this._next)},insertBefore:function(A,t){return this._parent.insertBefore(A,t)},querySelector:function(A){return this._parent.querySelector(A)},querySelectorAll:function(A){return this._parent.querySelectorAll(A)}};function qo(A){return function(){return A}}function jo(A,t,e,r,n,i){for(var s=0,a,o=t.length,B=i.length;s<B;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):e[s]=new Be(A,i[s]);for(;s<o;++s)(a=t[s])&&(n[s]=a)}function AB(A,t,e,r,n,i,s){var a,o,B=new Map,c=t.length,l=i.length,u=new Array(c),f;for(a=0;a<c;++a)(o=t[a])&&(u[a]=f=s.call(o,o.__data__,a,t)+"",B.has(f)?n[a]=o:B.set(f,o));for(a=0;a<l;++a)f=s.call(A,i[a],a,i)+"",(o=B.get(f))?(r[a]=o,o.__data__=i[a],B.delete(f)):e[a]=new Be(A,i[a]);for(a=0;a<c;++a)(o=t[a])&&B.get(u[a])===o&&(n[a]=o)}function tB(A){return A.__data__}function eB(A,t){if(!arguments.length)return Array.from(this,tB);var e=t?AB:jo,r=this._parents,n=this._groups;typeof A!="function"&&(A=qo(A));for(var i=n.length,s=new Array(i),a=new Array(i),o=new Array(i),B=0;B<i;++B){var c=r[B],l=n[B],u=l.length,f=rB(A.call(c,c&&c.__data__,B,r)),g=f.length,C=a[B]=new Array(g),h=s[B]=new Array(g),w=o[B]=new Array(u);e(c,l,C,h,w,f,t);for(var Q=0,p=0,F,U;Q<g;++Q)if(F=C[Q]){for(Q>=p&&(p=Q+1);!(U=h[p])&&++p<g;);F._next=U||null}}return s=new uA(s,r),s._enter=a,s._exit=o,s}function rB(A){return typeof A=="object"&&"length"in A?A:Array.from(A)}function nB(){return new uA(this._exit||this._groups.map(li),this._parents)}function iB(A,t,e){var r=this.enter(),n=this,i=this.exit();return typeof A=="function"?(r=A(r),r&&(r=r.selection())):r=r.append(A+""),t!=null&&(n=t(n),n&&(n=n.selection())),e==null?i.remove():e(i),r&&n?r.merge(n).order():n}function sB(A){for(var t=A.selection?A.selection():A,e=this._groups,r=t._groups,n=e.length,i=r.length,s=Math.min(n,i),a=new Array(n),o=0;o<s;++o)for(var B=e[o],c=r[o],l=B.length,u=a[o]=new Array(l),f,g=0;g<l;++g)(f=B[g]||c[g])&&(u[g]=f);for(;o<n;++o)a[o]=e[o];return new uA(a,this._parents)}function aB(){for(var A=this._groups,t=-1,e=A.length;++t<e;)for(var r=A[t],n=r.length-1,i=r[n],s;--n>=0;)(s=r[n])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function oB(A){A||(A=BB);function t(l,u){return l&&u?A(l.__data__,u.__data__):!l-!u}for(var e=this._groups,r=e.length,n=new Array(r),i=0;i<r;++i){for(var s=e[i],a=s.length,o=n[i]=new Array(a),B,c=0;c<a;++c)(B=s[c])&&(o[c]=B);o.sort(t)}return new uA(n,this._parents).order()}function BB(A,t){return A<t?-1:A>t?1:A>=t?0:NaN}function cB(){var A=arguments[0];return arguments[0]=this,A.apply(null,arguments),this}function lB(){return Array.from(this)}function uB(){for(var A=this._groups,t=0,e=A.length;t<e;++t)for(var r=A[t],n=0,i=r.length;n<i;++n){var s=r[n];if(s)return s}return null}function fB(){let A=0;for(const t of this)++A;return A}function gB(){return!this.node()}function hB(A){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],i=0,s=n.length,a;i<s;++i)(a=n[i])&&A.call(a,a.__data__,i,n);return this}function wB(A){return function(){this.removeAttribute(A)}}function QB(A){return function(){this.removeAttributeNS(A.space,A.local)}}function CB(A,t){return function(){this.setAttribute(A,t)}}function dB(A,t){return function(){this.setAttributeNS(A.space,A.local,t)}}function UB(A,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttribute(A):this.setAttribute(A,e)}}function FB(A,t){return function(){var e=t.apply(this,arguments);e==null?this.removeAttributeNS(A.space,A.local):this.setAttributeNS(A.space,A.local,e)}}function pB(A,t){var e=oe(A);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((t==null?e.local?QB:wB:typeof t=="function"?e.local?FB:UB:e.local?dB:CB)(e,t))}function ui(A){return A.ownerDocument&&A.ownerDocument.defaultView||A.document&&A||A.defaultView}function yB(A){return function(){this.style.removeProperty(A)}}function vB(A,t,e){return function(){this.style.setProperty(A,t,e)}}function EB(A,t,e){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(A):this.style.setProperty(A,r,e)}}function mB(A,t,e){return arguments.length>1?this.each((t==null?yB:typeof t=="function"?EB:vB)(A,t,e??"")):ot(this.node(),A)}function ot(A,t){return A.style.getPropertyValue(t)||ui(A).getComputedStyle(A,null).getPropertyValue(t)}function HB(A){return function(){delete this[A]}}function IB(A,t){return function(){this[A]=t}}function xB(A,t){return function(){var e=t.apply(this,arguments);e==null?delete this[A]:this[A]=e}}function LB(A,t){return arguments.length>1?this.each((t==null?HB:typeof t=="function"?xB:IB)(A,t)):this.node()[A]}function fi(A){return A.trim().split(/^|\s+/)}function Er(A){return A.classList||new gi(A)}function gi(A){this._node=A,this._names=fi(A.getAttribute("class")||"")}gi.prototype={add:function(A){var t=this._names.indexOf(A);t<0&&(this._names.push(A),this._node.setAttribute("class",this._names.join(" ")))},remove:function(A){var t=this._names.indexOf(A);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(A){return this._names.indexOf(A)>=0}};function hi(A,t){for(var e=Er(A),r=-1,n=t.length;++r<n;)e.add(t[r])}function wi(A,t){for(var e=Er(A),r=-1,n=t.length;++r<n;)e.remove(t[r])}function bB(A){return function(){hi(this,A)}}function KB(A){return function(){wi(this,A)}}function SB(A,t){return function(){(t.apply(this,arguments)?hi:wi)(this,A)}}function DB(A,t){var e=fi(A+"");if(arguments.length<2){for(var r=Er(this.node()),n=-1,i=e.length;++n<i;)if(!r.contains(e[n]))return!1;return!0}return this.each((typeof t=="function"?SB:t?bB:KB)(e,t))}function TB(){this.textContent=""}function MB(A){return function(){this.textContent=A}}function _B(A){return function(){var t=A.apply(this,arguments);this.textContent=t??""}}function OB(A){return arguments.length?this.each(A==null?TB:(typeof A=="function"?_B:MB)(A)):this.node().textContent}function RB(){this.innerHTML=""}function NB(A){return function(){this.innerHTML=A}}function GB(A){return function(){var t=A.apply(this,arguments);this.innerHTML=t??""}}function VB(A){return arguments.length?this.each(A==null?RB:(typeof A=="function"?GB:NB)(A)):this.node().innerHTML}function kB(){this.nextSibling&&this.parentNode.appendChild(this)}function PB(){return this.each(kB)}function XB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function JB(){return this.each(XB)}function YB(A){var t=typeof A=="function"?A:yr(A);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function WB(){return null}function ZB(A,t){var e=typeof A=="function"?A:yr(A),r=t==null?WB:typeof t=="function"?t:vr(t);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})}function $B(){var A=this.parentNode;A&&A.removeChild(this)}function zB(){return this.each($B)}function qB(){var A=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(A,this.nextSibling):A}function jB(){var A=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(A,this.nextSibling):A}function Ac(A){return this.select(A?jB:qB)}function tc(A){return arguments.length?this.property("__data__",A):this.node().__data__}function ec(A){return function(t){A.call(this,t,this.__data__)}}function rc(A){return A.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");return r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),{type:t,name:e}})}function nc(A){return function(){var t=this.__on;if(t){for(var e=0,r=-1,n=t.length,i;e<n;++e)i=t[e],(!A.type||i.type===A.type)&&i.name===A.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function ic(A,t,e){return function(){var r=this.__on,n,i=ec(t);if(r){for(var s=0,a=r.length;s<a;++s)if((n=r[s]).type===A.type&&n.name===A.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=i,n.options=e),n.value=t;return}}this.addEventListener(A.type,i,e),n={type:A.type,name:A.name,value:t,listener:i,options:e},r?r.push(n):this.__on=[n]}}function sc(A,t,e){var r=rc(A+""),n,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var o=0,B=a.length,c;o<B;++o)for(n=0,c=a[o];n<i;++n)if((s=r[n]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?ic:nc,n=0;n<i;++n)this.each(a(r[n],t,e));return this}function Qi(A,t,e){var r=ui(A),n=r.CustomEvent;typeof n=="function"?n=new n(t,e):(n=r.document.createEvent("Event"),e?(n.initEvent(t,e.bubbles,e.cancelable),n.detail=e.detail):n.initEvent(t,!1,!1)),A.dispatchEvent(n)}function ac(A,t){return function(){return Qi(this,A,t)}}function oc(A,t){return function(){return Qi(this,A,t.apply(this,arguments))}}function Bc(A,t){return this.each((typeof t=="function"?oc:ac)(A,t))}function*cc(){for(var A=this._groups,t=0,e=A.length;t<e;++t)for(var r=A[t],n=0,i=r.length,s;n<i;++n)(s=r[n])&&(yield s)}var Ci=[null];function uA(A,t){this._groups=A,this._parents=t}function Bt(){return new uA([[document.documentElement]],Ci)}function lc(){return this}uA.prototype=Bt.prototype={constructor:uA,select:_o,selectAll:Go,selectChild:Xo,selectChildren:Zo,filter:$o,data:eB,enter:zo,exit:nB,join:iB,merge:sB,selection:lc,order:aB,sort:oB,call:cB,nodes:lB,node:uB,size:fB,empty:gB,each:hB,attr:pB,style:mB,property:LB,classed:DB,text:OB,html:VB,raise:PB,lower:JB,append:YB,insert:ZB,remove:zB,clone:Ac,datum:tc,on:sc,dispatch:Bc,[Symbol.iterator]:cc};function LA(A){return typeof A=="string"?new uA([[document.querySelector(A)]],[document.documentElement]):new uA([[A]],Ci)}function di(A){return LA(yr(A).call(document.documentElement))}function uc(A){let t;for(;t=A.sourceEvent;)A=t;return A}function mr(A,t){if(A=uc(A),t===void 0&&(t=A.currentTarget),t){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=A.clientX,r.y=A.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[A.clientX-n.left-t.clientLeft,A.clientY-n.top-t.clientTop]}}return[A.pageX,A.pageY]}var fc={value:()=>{}};function Hr(){for(var A=0,t=arguments.length,e={},r;A<t;++A){if(!(r=arguments[A]+"")||r in e||/[\s.]/.test(r))throw new Error("illegal type: "+r);e[r]=[]}return new ce(e)}function ce(A){this._=A}function gc(A,t){return A.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");if(n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}ce.prototype=Hr.prototype={constructor:ce,on:function(A,t){var e=this._,r=gc(A+"",e),n,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((n=(A=r[i]).type)&&(n=hc(e[n],A.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(n=(A=r[i]).type)e[n]=Ui(e[n],A.name,t);else if(t==null)for(n in e)e[n]=Ui(e[n],A.name,null);return this},copy:function(){var A={},t=this._;for(var e in t)A[e]=t[e].slice();return new ce(A)},call:function(A,t){if((n=arguments.length-2)>0)for(var e=new Array(n),r=0,n,i;r<n;++r)e[r]=arguments[r+2];if(!this._.hasOwnProperty(A))throw new Error("unknown type: "+A);for(i=this._[A],r=0,n=i.length;r<n;++r)i[r].value.apply(t,e)},apply:function(A,t,e){if(!this._.hasOwnProperty(A))throw new Error("unknown type: "+A);for(var r=this._[A],n=0,i=r.length;n<i;++n)r[n].value.apply(t,e)}};function hc(A,t){for(var e=0,r=A.length,n;e<r;++e)if((n=A[e]).name===t)return n.value}function Ui(A,t,e){for(var r=0,n=A.length;r<n;++r)if(A[r].name===t){A[r]=fc,A=A.slice(0,r).concat(A.slice(r+1));break}return e!=null&&A.push({name:t,value:e}),A}var ct=0,xt=0,Lt=0,Fi=1e3,le,bt,ue=0,zA=0,fe=0,Kt=typeof performance=="object"&&performance.now?performance:Date,pi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(A){setTimeout(A,17)};function Ir(){return zA||(pi(wc),zA=Kt.now()+fe)}function wc(){zA=0}function ge(){this._call=this._time=this._next=null}ge.prototype=yi.prototype={constructor:ge,restart:function(A,t,e){if(typeof A!="function")throw new TypeError("callback is not a function");e=(e==null?Ir():+e)+(t==null?0:+t),!this._next&&bt!==this&&(bt?bt._next=this:le=this,bt=this),this._call=A,this._time=e,xr()},stop:function(){this._call&&(this._call=null,this._time=1/0,xr())}};function yi(A,t,e){var r=new ge;return r.restart(A,t,e),r}function Qc(){Ir(),++ct;for(var A=le,t;A;)(t=zA-A._time)>=0&&A._call.call(void 0,t),A=A._next;--ct}function vi(){zA=(ue=Kt.now())+fe,ct=xt=0;try{Qc()}finally{ct=0,dc(),zA=0}}function Cc(){var A=Kt.now(),t=A-ue;t>Fi&&(fe-=t,ue=A)}function dc(){for(var A,t=le,e,r=1/0;t;)t._call?(r>t._time&&(r=t._time),A=t,t=t._next):(e=t._next,t._next=null,t=A?A._next=e:le=e);bt=A,xr(r)}function xr(A){if(!ct){xt&&(xt=clearTimeout(xt));var t=A-zA;t>24?(A<1/0&&(xt=setTimeout(vi,A-Kt.now()-fe)),Lt&&(Lt=clearInterval(Lt))):(Lt||(ue=Kt.now(),Lt=setInterval(Cc,Fi)),ct=1,pi(vi))}}function Ei(A,t,e){var r=new ge;return t=t==null?0:+t,r.restart(n=>{r.stop(),A(n+t)},t,e),r}var Uc=Hr("start","end","cancel","interrupt"),Fc=[],mi=0,Hi=1,Lr=2,he=3,Ii=4,br=5,we=6;function Qe(A,t,e,r,n,i){var s=A.__transition;if(!s)A.__transition={};else if(e in s)return;pc(A,e,{name:t,index:r,group:n,on:Uc,tween:Fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mi})}function Kr(A,t){var e=dA(A,t);if(e.state>mi)throw new Error("too late; already scheduled");return e}function EA(A,t){var e=dA(A,t);if(e.state>he)throw new Error("too late; already running");return e}function dA(A,t){var e=A.__transition;if(!e||!(e=e[t]))throw new Error("transition not found");return e}function pc(A,t,e){var r=A.__transition,n;r[t]=e,e.timer=yi(i,0,e.time);function i(B){e.state=Hi,e.timer.restart(s,e.delay,e.time),e.delay<=B&&s(B-e.delay)}function s(B){var c,l,u,f;if(e.state!==Hi)return o();for(c in r)if(f=r[c],f.name===e.name){if(f.state===he)return Ei(s);f.state===Ii?(f.state=we,f.timer.stop(),f.on.call("interrupt",A,A.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=we,f.timer.stop(),f.on.call("cancel",A,A.__data__,f.index,f.group),delete r[c])}if(Ei(function(){e.state===he&&(e.state=Ii,e.timer.restart(a,e.delay,e.time),a(B))}),e.state=Lr,e.on.call("start",A,A.__data__,e.index,e.group),e.state===Lr){for(e.state=he,n=new Array(u=e.tween.length),c=0,l=-1;c<u;++c)(f=e.tween[c].value.call(A,A.__data__,e.index,e.group))&&(n[++l]=f);n.length=l+1}}function a(B){for(var c=B<e.duration?e.ease.call(null,B/e.duration):(e.timer.restart(o),e.state=br,1),l=-1,u=n.length;++l<u;)n[l].call(A,c);e.state===br&&(e.on.call("end",A,A.__data__,e.index,e.group),o())}function o(){e.state=we,e.timer.stop(),delete r[t];for(var B in r)return;delete A.__transition}}function Sr(A,t){var e=A.__transition,r,n,i=!0,s;if(e){t=t==null?null:t+"";for(s in e){if((r=e[s]).name!==t){i=!1;continue}n=r.state>Lr&&r.state<br,r.state=we,r.timer.stop(),r.on.call(n?"interrupt":"cancel",A,A.__data__,r.index,r.group),delete e[s]}i&&delete A.__transition}}function yc(A){return this.each(function(){Sr(this,A)})}function Dr(A,t,e){A.prototype=t.prototype=e,e.constructor=A}function xi(A,t){var e=Object.create(A.prototype);for(var r in t)e[r]=t[r];return e}function St(){}var Dt=.7,Ce=1/Dt,lt="\\s*([+-]?\\d+)\\s*",Tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mA="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vc=/^#([0-9a-f]{3,8})$/,Ec=new RegExp(`^rgb\\(${lt},${lt},${lt}\\)$`),mc=new RegExp(`^rgb\\(${mA},${mA},${mA}\\)$`),Hc=new RegExp(`^rgba\\(${lt},${lt},${lt},${Tt}\\)$`),Ic=new RegExp(`^rgba\\(${mA},${mA},${mA},${Tt}\\)$`),xc=new RegExp(`^hsl\\(${Tt},${mA},${mA}\\)$`),Lc=new RegExp(`^hsla\\(${Tt},${mA},${mA},${Tt}\\)$`),Li={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};Dr(St,qA,{copy(A){return Object.assign(new this.constructor,this,A)},displayable(){return this.rgb().displayable()},hex:bi,formatHex:bi,formatHex8:bc,formatHsl:Kc,formatRgb:Ki,toString:Ki});function bi(){return this.rgb().formatHex()}function bc(){return this.rgb().formatHex8()}function Kc(){return _i(this).formatHsl()}function Ki(){return this.rgb().formatRgb()}function qA(A){var t,e;return A=(A+"").trim().toLowerCase(),(t=vc.exec(A))?(e=t[1].length,t=parseInt(t[1],16),e===6?Si(t):e===3?new BA(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?de(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?de(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ec.exec(A))?new BA(t[1],t[2],t[3],1):(t=mc.exec(A))?new BA(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Hc.exec(A))?de(t[1],t[2],t[3],t[4]):(t=Ic.exec(A))?de(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xc.exec(A))?Mi(t[1],t[2]/100,t[3]/100,1):(t=Lc.exec(A))?Mi(t[1],t[2]/100,t[3]/100,t[4]):Li.hasOwnProperty(A)?Si(Li[A]):A==="transparent"?new BA(NaN,NaN,NaN,0):null}function Si(A){return new BA(A>>16&255,A>>8&255,A&255,1)}function de(A,t,e,r){return r<=0&&(A=t=e=NaN),new BA(A,t,e,r)}function Sc(A){return A instanceof St||(A=qA(A)),A?(A=A.rgb(),new BA(A.r,A.g,A.b,A.opacity)):new BA}function Tr(A,t,e,r){return arguments.length===1?Sc(A):new BA(A,t,e,r??1)}function BA(A,t,e,r){this.r=+A,this.g=+t,this.b=+e,this.opacity=+r}Dr(BA,Tr,xi(St,{brighter(A){return A=A==null?Ce:Math.pow(Ce,A),new BA(this.r*A,this.g*A,this.b*A,this.opacity)},darker(A){return A=A==null?Dt:Math.pow(Dt,A),new BA(this.r*A,this.g*A,this.b*A,this.opacity)},rgb(){return this},clamp(){return new BA(jA(this.r),jA(this.g),jA(this.b),Ue(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:Di,formatHex:Di,formatHex8:Dc,formatRgb:Ti,toString:Ti}));function Di(){return`#${At(this.r)}${At(this.g)}${At(this.b)}`}function Dc(){return`#${At(this.r)}${At(this.g)}${At(this.b)}${At((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ti(){const A=Ue(this.opacity);return`${A===1?"rgb(":"rgba("}${jA(this.r)}, ${jA(this.g)}, ${jA(this.b)}${A===1?")":`, ${A})`}`}function Ue(A){return isNaN(A)?1:Math.max(0,Math.min(1,A))}function jA(A){return Math.max(0,Math.min(255,Math.round(A)||0))}function At(A){return A=jA(A),(A<16?"0":"")+A.toString(16)}function Mi(A,t,e,r){return r<=0?A=t=e=NaN:e<=0||e>=1?A=t=NaN:t<=0&&(A=NaN),new UA(A,t,e,r)}function _i(A){if(A instanceof UA)return new UA(A.h,A.s,A.l,A.opacity);if(A instanceof St||(A=qA(A)),!A)return new UA;if(A instanceof UA)return A;A=A.rgb();var t=A.r/255,e=A.g/255,r=A.b/255,n=Math.min(t,e,r),i=Math.max(t,e,r),s=NaN,a=i-n,o=(i+n)/2;return a?(t===i?s=(e-r)/a+(e<r)*6:e===i?s=(r-t)/a+2:s=(t-e)/a+4,a/=o<.5?i+n:2-i-n,s*=60):a=o>0&&o<1?0:s,new UA(s,a,o,A.opacity)}function Tc(A,t,e,r){return arguments.length===1?_i(A):new UA(A,t,e,r??1)}function UA(A,t,e,r){this.h=+A,this.s=+t,this.l=+e,this.opacity=+r}Dr(UA,Tc,xi(St,{brighter(A){return A=A==null?Ce:Math.pow(Ce,A),new UA(this.h,this.s,this.l*A,this.opacity)},darker(A){return A=A==null?Dt:Math.pow(Dt,A),new UA(this.h,this.s,this.l*A,this.opacity)},rgb(){var A=this.h%360+(this.h<0)*360,t=isNaN(A)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*t,n=2*e-r;return new BA(Mr(A>=240?A-240:A+120,n,r),Mr(A,n,r),Mr(A<120?A+240:A-120,n,r),this.opacity)},clamp(){return new UA(Oi(this.h),Fe(this.s),Fe(this.l),Ue(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 A=Ue(this.opacity);return`${A===1?"hsl(":"hsla("}${Oi(this.h)}, ${Fe(this.s)*100}%, ${Fe(this.l)*100}%${A===1?")":`, ${A})`}`}}));function Oi(A){return A=(A||0)%360,A<0?A+360:A}function Fe(A){return Math.max(0,Math.min(1,A||0))}function Mr(A,t,e){return(A<60?t+(e-t)*A/60:A<180?e:A<240?t+(e-t)*(240-A)/60:t)*255}const _r=A=>()=>A;function Mc(A,t){return function(e){return A+e*t}}function _c(A,t,e){return A=Math.pow(A,e),t=Math.pow(t,e)-A,e=1/e,function(r){return Math.pow(A+r*t,e)}}function Oc(A){return(A=+A)==1?Ri:function(t,e){return e-t?_c(t,e,A):_r(isNaN(t)?e:t)}}function Ri(A,t){var e=t-A;return e?Mc(A,e):_r(isNaN(A)?t:A)}const pe=(function A(t){var e=Oc(t);function r(n,i){var s=e((n=Tr(n)).r,(i=Tr(i)).r),a=e(n.g,i.g),o=e(n.b,i.b),B=Ri(n.opacity,i.opacity);return function(c){return n.r=s(c),n.g=a(c),n.b=o(c),n.opacity=B(c),n+""}}return r.gamma=A,r})(1);function Rc(A,t){t||(t=[]);var e=A?Math.min(t.length,A.length):0,r=t.slice(),n;return function(i){for(n=0;n<e;++n)r[n]=A[n]*(1-i)+t[n]*i;return r}}function Nc(A){return ArrayBuffer.isView(A)&&!(A instanceof DataView)}function Gc(A,t){var e=t?t.length:0,r=A?Math.min(e,A.length):0,n=new Array(r),i=new Array(e),s;for(s=0;s<r;++s)n[s]=ye(A[s],t[s]);for(;s<e;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=n[s](a);return i}}function Vc(A,t){var e=new Date;return A=+A,t=+t,function(r){return e.setTime(A*(1-r)+t*r),e}}function FA(A,t){return A=+A,t=+t,function(e){return A*(1-e)+t*e}}function kc(A,t){var e={},r={},n;(A===null||typeof A!="object")&&(A={}),(t===null||typeof t!="object")&&(t={});for(n in t)n in A?e[n]=ye(A[n],t[n]):r[n]=t[n];return function(i){for(n in e)r[n]=e[n](i);return r}}var Or=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rr=new RegExp(Or.source,"g");function Pc(A){return function(){return A}}function Xc(A){return function(t){return A(t)+""}}function Ni(A,t){var e=Or.lastIndex=Rr.lastIndex=0,r,n,i,s=-1,a=[],o=[];for(A=A+"",t=t+"";(r=Or.exec(A))&&(n=Rr.exec(t));)(i=n.index)>e&&(i=t.slice(e,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(n=n[0])?a[s]?a[s]+=n:a[++s]=n:(a[++s]=null,o.push({i:s,x:FA(r,n)})),e=Rr.lastIndex;return e<t.length&&(i=t.slice(e),a[s]?a[s]+=i:a[++s]=i),a.length<2?o[0]?Xc(o[0].x):Pc(t):(t=o.length,function(B){for(var c=0,l;c<t;++c)a[(l=o[c]).i]=l.x(B);return a.join("")})}function ye(A,t){var e=typeof t,r;return t==null||e==="boolean"?_r(t):(e==="number"?FA:e==="string"?(r=qA(t))?(t=r,pe):Ni:t instanceof qA?pe:t instanceof Date?Vc:Nc(t)?Rc:Array.isArray(t)?Gc:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?kc:FA)(A,t)}function Jc(A,t){return A=+A,t=+t,function(e){return Math.round(A*(1-e)+t*e)}}var Gi=180/Math.PI,Nr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vi(A,t,e,r,n,i){var s,a,o;return(s=Math.sqrt(A*A+t*t))&&(A/=s,t/=s),(o=A*e+t*r)&&(e-=A*o,r-=t*o),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,o/=a),A*r<t*e&&(A=-A,t=-t,o=-o,s=-s),{translateX:n,translateY:i,rotate:Math.atan2(t,A)*Gi,skewX:Math.atan(o)*Gi,scaleX:s,scaleY:a}}var ve;function Yc(A){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(A+"");return t.isIdentity?Nr:Vi(t.a,t.b,t.c,t.d,t.e,t.f)}function Wc(A){return A==null||(ve||(ve=document.createElementNS("http://www.w3.org/2000/svg","g")),ve.setAttribute("transform",A),!(A=ve.transform.baseVal.consolidate()))?Nr:(A=A.matrix,Vi(A.a,A.b,A.c,A.d,A.e,A.f))}function ki(A,t,e,r){function n(B){return B.length?B.pop()+" ":""}function i(B,c,l,u,f,g){if(B!==l||c!==u){var C=f.push("translate(",null,t,null,e);g.push({i:C-4,x:FA(B,l)},{i:C-2,x:FA(c,u)})}else(l||u)&&f.push("translate("+l+t+u+e)}function s(B,c,l,u){B!==c?(B-c>180?c+=360:c-B>180&&(B+=360),u.push({i:l.push(n(l)+"rotate(",null,r)-2,x:FA(B,c)})):c&&l.push(n(l)+"rotate("+c+r)}function a(B,c,l,u){B!==c?u.push({i:l.push(n(l)+"skewX(",null,r)-2,x:FA(B,c)}):c&&l.push(n(l)+"skewX("+c+r)}function o(B,c,l,u,f,g){if(B!==l||c!==u){var C=f.push(n(f)+"scale(",null,",",null,")");g.push({i:C-4,x:FA(B,l)},{i:C-2,x:FA(c,u)})}else(l!==1||u!==1)&&f.push(n(f)+"scale("+l+","+u+")")}return function(B,c){var l=[],u=[];return B=A(B),c=A(c),i(B.translateX,B.translateY,c.translateX,c.translateY,l,u),s(B.rotate,c.rotate,l,u),a(B.skewX,c.skewX,l,u),o(B.scaleX,B.scaleY,c.scaleX,c.scaleY,l,u),B=c=null,function(f){for(var g=-1,C=u.length,h;++g<C;)l[(h=u[g]).i]=h.x(f);return l.join("")}}}var Zc=ki(Yc,"px, ","px)","deg)"),$c=ki(Wc,", ",")",")");function zc(A,t){var e,r;return function(){var n=EA(this,A),i=n.tween;if(i!==e){r=e=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}n.tween=r}}function qc(A,t,e){var r,n;if(typeof e!="function")throw new Error;return function(){var i=EA(this,A),s=i.tween;if(s!==r){n=(r=s).slice();for(var a={name:t,value:e},o=0,B=n.length;o<B;++o)if(n[o].name===t){n[o]=a;break}o===B&&n.push(a)}i.tween=n}}function jc(A,t){var e=this._id;if(A+="",arguments.length<2){for(var r=dA(this.node(),e).tween,n=0,i=r.length,s;n<i;++n)if((s=r[n]).name===A)return s.value;return null}return this.each((t==null?zc:qc)(e,A,t))}function Gr(A,t,e){var r=A._id;return A.each(function(){var n=EA(this,r);(n.value||(n.value={}))[t]=e.apply(this,arguments)}),function(n){return dA(n,r).value[t]}}function Pi(A,t){var e;return(typeof t=="number"?FA:t instanceof qA?pe:(e=qA(t))?(t=e,pe):Ni)(A,t)}function Al(A){return function(){this.removeAttribute(A)}}function tl(A){return function(){this.removeAttributeNS(A.space,A.local)}}function el(A,t,e){var r,n=e+"",i;return function(){var s=this.getAttribute(A);return s===n?null:s===r?i:i=t(r=s,e)}}function rl(A,t,e){var r,n=e+"",i;return function(){var s=this.getAttributeNS(A.space,A.local);return s===n?null:s===r?i:i=t(r=s,e)}}function nl(A,t,e){var r,n,i;return function(){var s,a=e(this),o;return a==null?void this.removeAttribute(A):(s=this.getAttribute(A),o=a+"",s===o?null:s===r&&o===n?i:(n=o,i=t(r=s,a)))}}function il(A,t,e){var r,n,i;return function(){var s,a=e(this),o;return a==null?void this.removeAttributeNS(A.space,A.local):(s=this.getAttributeNS(A.space,A.local),o=a+"",s===o?null:s===r&&o===n?i:(n=o,i=t(r=s,a)))}}function sl(A,t){var e=oe(A),r=e==="transform"?$c:Pi;return this.attrTween(A,typeof t=="function"?(e.local?il:nl)(e,r,Gr(this,"attr."+A,t)):t==null?(e.local?tl:Al)(e):(e.local?rl:el)(e,r,t))}function al(A,t){return function(e){this.setAttribute(A,t.call(this,e))}}function ol(A,t){return function(e){this.setAttributeNS(A.space,A.local,t.call(this,e))}}function Bl(A,t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&ol(A,i)),e}return n._value=t,n}function cl(A,t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&al(A,i)),e}return n._value=t,n}function ll(A,t){var e="attr."+A;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;var r=oe(A);return this.tween(e,(r.local?Bl:cl)(r,t))}function ul(A,t){return function(){Kr(this,A).delay=+t.apply(this,arguments)}}function fl(A,t){return t=+t,function(){Kr(this,A).delay=t}}function gl(A){var t=this._id;return arguments.length?this.each((typeof A=="function"?ul:fl)(t,A)):dA(this.node(),t).delay}function hl(A,t){return function(){EA(this,A).duration=+t.apply(this,arguments)}}function wl(A,t){return t=+t,function(){EA(this,A).duration=t}}function Ql(A){var t=this._id;return arguments.length?this.each((typeof A=="function"?hl:wl)(t,A)):dA(this.node(),t).duration}function Cl(A,t){if(typeof t!="function")throw new Error;return function(){EA(this,A).ease=t}}function dl(A){var t=this._id;return arguments.length?this.each(Cl(t,A)):dA(this.node(),t).ease}function Ul(A,t){return function(){var e=t.apply(this,arguments);if(typeof e!="function")throw new Error;EA(this,A).ease=e}}function Fl(A){if(typeof A!="function")throw new Error;return this.each(Ul(this._id,A))}function pl(A){typeof A!="function"&&(A=Bi(A));for(var t=this._groups,e=t.length,r=new Array(e),n=0;n<e;++n)for(var i=t[n],s=i.length,a=r[n]=[],o,B=0;B<s;++B)(o=i[B])&&A.call(o,o.__data__,B,i)&&a.push(o);return new bA(r,this._parents,this._name,this._id)}function yl(A){if(A._id!==this._id)throw new Error;for(var t=this._groups,e=A._groups,r=t.length,n=e.length,i=Math.min(r,n),s=new Array(r),a=0;a<i;++a)for(var o=t[a],B=e[a],c=o.length,l=s[a]=new Array(c),u,f=0;f<c;++f)(u=o[f]||B[f])&&(l[f]=u);for(;a<r;++a)s[a]=t[a];return new bA(s,this._parents,this._name,this._id)}function vl(A){return(A+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||t==="start"})}function El(A,t,e){var r,n,i=vl(t)?Kr:EA;return function(){var s=i(this,A),a=s.on;a!==r&&(n=(r=a).copy()).on(t,e),s.on=n}}function ml(A,t){var e=this._id;return arguments.length<2?dA(this.node(),e).on.on(A):this.each(El(e,A,t))}function Hl(A){return function(){var t=this.parentNode;for(var e in this.__transition)if(+e!==A)return;t&&t.removeChild(this)}}function Il(){return this.on("end.remove",Hl(this._id))}function xl(A){var t=this._name,e=this._id;typeof A!="function"&&(A=vr(A));for(var r=this._groups,n=r.length,i=new Array(n),s=0;s<n;++s)for(var a=r[s],o=a.length,B=i[s]=new Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=A.call(c,c.__data__,u,a))&&("__data__"in c&&(l.__data__=c.__data__),B[u]=l,Qe(B[u],t,e,u,B,dA(c,e)));return new bA(i,this._parents,t,e)}function Ll(A){var t=this._name,e=this._id;typeof A!="function"&&(A=oi(A));for(var r=this._groups,n=r.length,i=[],s=[],a=0;a<n;++a)for(var o=r[a],B=o.length,c,l=0;l<B;++l)if(c=o[l]){for(var u=A.call(c,c.__data__,l,o),f,g=dA(c,e),C=0,h=u.length;C<h;++C)(f=u[C])&&Qe(f,t,e,C,u,g);i.push(u),s.push(c)}return new bA(i,s,t,e)}var bl=Bt.prototype.constructor;function Kl(){return new bl(this._groups,this._parents)}function Sl(A,t){var e,r,n;return function(){var i=ot(this,A),s=(this.style.removeProperty(A),ot(this,A));return i===s?null:i===e&&s===r?n:n=t(e=i,r=s)}}function Xi(A){return function(){this.style.removeProperty(A)}}function Dl(A,t,e){var r,n=e+"",i;return function(){var s=ot(this,A);return s===n?null:s===r?i:i=t(r=s,e)}}function Tl(A,t,e){var r,n,i;return function(){var s=ot(this,A),a=e(this),o=a+"";return a==null&&(o=a=(this.style.removeProperty(A),ot(this,A))),s===o?null:s===r&&o===n?i:(n=o,i=t(r=s,a))}}function Ml(A,t){var e,r,n,i="style."+t,s="end."+i,a;return function(){var o=EA(this,A),B=o.on,c=o.value[i]==null?a||(a=Xi(t)):void 0;(B!==e||n!==c)&&(r=(e=B).copy()).on(s,n=c),o.on=r}}function _l(A,t,e){var r=(A+="")=="transform"?Zc:Pi;return t==null?this.styleTween(A,Sl(A,r)).on("end.style."+A,Xi(A)):typeof t=="function"?this.styleTween(A,Tl(A,r,Gr(this,"style."+A,t))).each(Ml(this._id,A)):this.styleTween(A,Dl(A,r,t),e).on("end.style."+A,null)}function Ol(A,t,e){return function(r){this.style.setProperty(A,t.call(this,r),e)}}function Rl(A,t,e){var r,n;function i(){var s=t.apply(this,arguments);return s!==n&&(r=(n=s)&&Ol(A,s,e)),r}return i._value=t,i}function Nl(A,t,e){var r="style."+(A+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Rl(A,t,e??""))}function Gl(A){return function(){this.textContent=A}}function Vl(A){return function(){var t=A(this);this.textContent=t??""}}function kl(A){return this.tween("text",typeof A=="function"?Vl(Gr(this,"text",A)):Gl(A==null?"":A+""))}function Pl(A){return function(t){this.textContent=A.call(this,t)}}function Xl(A){var t,e;function r(){var n=A.apply(this,arguments);return n!==e&&(t=(e=n)&&Pl(n)),t}return r._value=A,r}function Jl(A){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(A==null)return this.tween(t,null);if(typeof A!="function")throw new Error;return this.tween(t,Xl(A))}function Yl(){for(var A=this._name,t=this._id,e=Yi(),r=this._groups,n=r.length,i=0;i<n;++i)for(var s=r[i],a=s.length,o,B=0;B<a;++B)if(o=s[B]){var c=dA(o,t);Qe(o,A,e,B,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new bA(r,this._parents,A,e)}function Wl(){var A,t,e=this,r=e._id,n=e.size();return new Promise(function(i,s){var a={value:s},o={value:function(){--n===0&&i()}};e.each(function(){var B=EA(this,r),c=B.on;c!==A&&(t=(A=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(o)),B.on=t}),n===0&&i()})}var Zl=0;function bA(A,t,e,r){this._groups=A,this._parents=t,this._name=e,this._id=r}function Ji(A){return Bt().transition(A)}function Yi(){return++Zl}var KA=Bt.prototype;bA.prototype=Ji.prototype={constructor:bA,select:xl,selectAll:Ll,selectChild:KA.selectChild,selectChildren:KA.selectChildren,filter:pl,merge:yl,selection:Kl,transition:Yl,call:KA.call,nodes:KA.nodes,node:KA.node,size:KA.size,empty:KA.empty,each:KA.each,on:ml,attr:sl,attrTween:ll,style:_l,styleTween:Nl,text:kl,textTween:Jl,remove:Il,tween:jc,delay:gl,duration:Ql,ease:dl,easeVarying:Fl,end:Wl,[Symbol.iterator]:KA[Symbol.iterator]};function $l(A){return((A*=2)<=1?A*A*A:(A-=2)*A*A+2)/2}var zl={time:null,delay:0,duration:250,ease:$l};function ql(A,t){for(var e;!(e=A.__transition)||!(e=e[t]);)if(!(A=A.parentNode))throw new Error(`transition ${t} not found`);return e}function jl(A){var t,e;A instanceof bA?(t=A._id,A=A._name):(t=Yi(),(e=zl).time=Ir(),A=A==null?null:A+"");for(var r=this._groups,n=r.length,i=0;i<n;++i)for(var s=r[i],a=s.length,o,B=0;B<a;++B)(o=s[B])&&Qe(o,A,t,B,s,e||ql(o,t));return new bA(r,this._parents,A,t)}Bt.prototype.interrupt=yc,Bt.prototype.transition=jl;function Au(A){return A}var Vr=1,kr=2,Pr=3,Mt=4,Wi=1e-6;function tu(A){return"translate("+A+",0)"}function eu(A){return"translate(0,"+A+")"}function ru(A){return t=>+A(t)}function nu(A,t){return t=Math.max(0,A.bandwidth()-t*2)/2,A.round()&&(t=Math.round(t)),e=>+A(e)+t}function iu(){return!this.__axis}function Zi(A,t){var e=[],r=null,n=null,i=6,s=6,a=3,o=typeof window<"u"&&window.devicePixelRatio>1?0:.5,B=A===Vr||A===Mt?-1:1,c=A===Mt||A===kr?"x":"y",l=A===Vr||A===Pr?tu:eu;function u(f){var g=r??(t.ticks?t.ticks.apply(t,e):t.domain()),C=n??(t.tickFormat?t.tickFormat.apply(t,e):Au),h=Math.max(i,0)+a,w=t.range(),Q=+w[0]+o,p=+w[w.length-1]+o,F=(t.bandwidth?nu:ru)(t.copy(),o),U=f.selection?f.selection():f,d=U.selectAll(".domain").data([null]),m=U.selectAll(".tick").data(g,t).order(),y=m.exit(),E=m.enter().append("g").attr("class","tick"),L=m.select("line"),v=m.select("text");d=d.merge(d.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),m=m.merge(E),L=L.merge(E.append("line").attr("stroke","currentColor").attr(c+"2",B*i)),v=v.merge(E.append("text").attr("fill","currentColor").attr(c,B*h).attr("dy",A===Vr?"0em":A===Pr?"0.71em":"0.32em")),f!==U&&(d=d.transition(f),m=m.transition(f),L=L.transition(f),v=v.transition(f),y=y.transition(f).attr("opacity",Wi).attr("transform",function(K){return isFinite(K=F(K))?l(K+o):this.getAttribute("transform")}),E.attr("opacity",Wi).attr("transform",function(K){var I=this.parentNode.__axis;return l((I&&isFinite(I=I(K))?I:F(K))+o)})),y.remove(),d.attr("d",A===Mt||A===kr?s?"M"+B*s+","+Q+"H"+o+"V"+p+"H"+B*s:"M"+o+","+Q+"V"+p:s?"M"+Q+","+B*s+"V"+o+"H"+p+"V"+B*s:"M"+Q+","+o+"H"+p),m.attr("opacity",1).attr("transform",function(K){return l(F(K)+o)}),L.attr(c+"2",B*i),v.attr(c,B*h).text(C),U.filter(iu).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",A===kr?"start":A===Mt?"end":"middle"),U.each(function(){this.__axis=F})}return u.scale=function(f){return arguments.length?(t=f,u):t},u.ticks=function(){return e=Array.from(arguments),u},u.tickArguments=function(f){return arguments.length?(e=f==null?[]:Array.from(f),u):e.slice()},u.tickValues=function(f){return arguments.length?(r=f==null?null:Array.from(f),u):r&&r.slice()},u.tickFormat=function(f){return arguments.length?(n=f,u):n},u.tickSize=function(f){return arguments.length?(i=s=+f,u):i},u.tickSizeInner=function(f){return arguments.length?(i=+f,u):i},u.tickSizeOuter=function(f){return arguments.length?(s=+f,u):s},u.tickPadding=function(f){return arguments.length?(a=+f,u):a},u.offset=function(f){return arguments.length?(o=+f,u):o},u}function su(A){return Zi(Pr,A)}function au(A){return Zi(Mt,A)}const Xr={capture:!0,passive:!1};function Jr(A){A.preventDefault(),A.stopImmediatePropagation()}function ou(A){var t=A.document.documentElement,e=LA(A).on("dragstart.drag",Jr,Xr);"onselectstart"in t?e.on("selectstart.drag",Jr,Xr):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Bu(A,t){var e=A.document.documentElement,r=LA(A).on("dragstart.drag",null);t&&(r.on("click.drag",Jr,Xr),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}const Yr=A=>()=>A;function cu(A,{sourceEvent:t,target:e,selection:r,mode:n,dispatch:i}){Object.defineProperties(this,{type:{value:A,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function lu(A){A.stopImmediatePropagation()}function Wr(A){A.preventDefault(),A.stopImmediatePropagation()}var $i={name:"drag"},Zr={name:"space"},ut={name:"handle"},ft={name:"center"};const{abs:zi,max:nA,min:iA}=Math;function qi(A){return[+A[0],+A[1]]}function $r(A){return[qi(A[0]),qi(A[1])]}var zr={},qr={},uu={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(jr),input:function(A){return A==null?null:$r(A)},output:function(A){return A}},SA={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ji={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},As={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},fu={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},gu={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function jr(A){return{type:A}}function hu(A){return!A.ctrlKey&&!A.button}function wu(){var A=this.ownerSVGElement||this;return A.hasAttribute("viewBox")?(A=A.viewBox.baseVal,[[A.x,A.y],[A.x+A.width,A.y+A.height]]):[[0,0],[A.width.baseVal.value,A.height.baseVal.value]]}function Qu(){return navigator.maxTouchPoints||"ontouchstart"in this}function An(A){for(;!A.__brush;)if(!(A=A.parentNode))return;return A.__brush}function Cu(A){return A[0][0]===A[1][0]||A[0][1]===A[1][1]}function du(){return Uu(uu)}function Uu(A){var t=wu,e=hu,r=Qu,n=!0,i=Hr("start","brush","end"),s=6,a;function o(h){var w=h.property("__brush",C).selectAll(".overlay").data([jr("overlay")]);w.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",SA.overlay).merge(w).each(function(){var p=An(this).extent;LA(this).attr("x",p[0][0]).attr("y",p[0][1]).attr("width",p[1][0]-p[0][0]).attr("height",p[1][1]-p[0][1])}),h.selectAll(".selection").data([jr("selection")]).enter().append("rect").attr("class","selection").attr("cursor",SA.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var Q=h.selectAll(".handle").data(A.handles,function(p){return p.type});Q.exit().remove(),Q.enter().append("rect").attr("class",function(p){return"handle handle--"+p.type}).attr("cursor",function(p){return SA[p.type]}),h.each(B).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",u).filter(r).on("touchstart.brush",u).on("touchmove.brush",f).on("touchend.brush touchcancel.brush",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o.move=function(h,w,Q){h.tween?h.on("start.brush",function(p){c(this,arguments).beforestart().start(p)}).on("interrupt.brush end.brush",function(p){c(this,arguments).end(p)}).tween("brush",function(){var p=this,F=p.__brush,U=c(p,arguments),d=F.selection,m=A.input(typeof w=="function"?w.apply(this,arguments):w,F.extent),y=ye(d,m);function E(L){F.selection=L===1&&m===null?null:y(L),B.call(p),U.brush()}return d!==null&&m!==null?E:E(1)}):h.each(function(){var p=this,F=arguments,U=p.__brush,d=A.input(typeof w=="function"?w.apply(p,F):w,U.extent),m=c(p,F).beforestart();Sr(p),U.selection=d===null?null:d,B.call(p),m.start(Q).brush(Q).end(Q)})},o.clear=function(h,w){o.move(h,null,w)};function B(){var h=LA(this),w=An(this).selection;w?(h.selectAll(".selection").style("display",null).attr("x",w[0][0]).attr("y",w[0][1]).attr("width",w[1][0]-w[0][0]).attr("height",w[1][1]-w[0][1]),h.selectAll(".handle").style("display",null).attr("x",function(Q){return Q.type[Q.type.length-1]==="e"?w[1][0]-s/2:w[0][0]-s/2}).attr("y",function(Q){return Q.type[0]==="s"?w[1][1]-s/2:w[0][1]-s/2}).attr("width",function(Q){return Q.type==="n"||Q.type==="s"?w[1][0]-w[0][0]+s:s}).attr("height",function(Q){return Q.type==="e"||Q.type==="w"?w[1][1]-w[0][1]+s:s})):h.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function c(h,w,Q){var p=h.__brush.emitter;return p&&(!Q||!p.clean)?p:new l(h,w,Q)}function l(h,w,Q){this.that=h,this.args=w,this.state=h.__brush,this.active=0,this.clean=Q}l.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(h,w){return this.starting?(this.starting=!1,this.emit("start",h,w)):this.emit("brush",h),this},brush:function(h,w){return this.emit("brush",h,w),this},end:function(h,w){return--this.active===0&&(delete this.state.emitter,this.emit("end",h,w)),this},emit:function(h,w,Q){var p=LA(this.that).datum();i.call(h,this.that,new cu(h,{sourceEvent:w,target:o,selection:A.output(this.state.selection),mode:Q,dispatch:i}),p)}};function u(h){if(a&&!h.touches||!e.apply(this,arguments))return;var w=this,Q=h.target.__data__.type,p=(n&&h.metaKey?Q="overlay":Q)==="selection"?$i:n&&h.altKey?ft:ut,F=A===qr?null:fu[Q],U=A===zr?null:gu[Q],d=An(w),m=d.extent,y=d.selection,E=m[0][0],L,v,K=m[0][1],I,S,Y=m[1][0],O,R,J=m[1][1],T,b,M=0,G=0,rA,CA=F&&U&&n&&h.shiftKey,lA,vA,z=Array.from(h.touches||[h],_=>{const j=_.identifier;return _=mr(_,w),_.point0=_.slice(),_.identifier=j,_});Sr(w);var ie=c(w,arguments,!0).beforestart();if(Q==="overlay"){y&&(rA=!0);const _=[z[0],z[1]||z[0]];d.selection=y=[[L=A===qr?E:iA(_[0][0],_[1][0]),I=A===zr?K:iA(_[0][1],_[1][1])],[O=A===qr?Y:nA(_[0][0],_[1][0]),T=A===zr?J:nA(_[0][1],_[1][1])]],z.length>1&&at(h)}else L=y[0][0],I=y[0][1],O=y[1][0],T=y[1][1];v=L,S=I,R=O,b=T;var Lo=LA(w).attr("pointer-events","none"),se=Lo.selectAll(".overlay").attr("cursor",SA[Q]);if(h.touches)ie.moved=Ko,ie.ended=So;else{var bo=LA(h.view).on("mousemove.brush",Ko,!0).on("mouseup.brush",So,!0);n&&bo.on("keydown.brush",VC,!0).on("keyup.brush",kC,!0),ou(h.view)}B.call(w),ie.start(h,p.name);function Ko(_){for(const j of _.changedTouches||[_])for(const ae of z)ae.identifier===j.identifier&&(ae.cur=mr(j,w));if(CA&&!lA&&!vA&&z.length===1){const j=z[0];zi(j.cur[0]-j[0])>zi(j.cur[1]-j[1])?vA=!0:lA=!0}for(const j of z)j.cur&&(j[0]=j.cur[0],j[1]=j.cur[1]);rA=!0,Wr(_),at(_)}function at(_){const j=z[0],ae=j.point0;var ZA;switch(M=j[0]-ae[0],G=j[1]-ae[1],p){case Zr:case $i:{F&&(M=nA(E-L,iA(Y-O,M)),v=L+M,R=O+M),U&&(G=nA(K-I,iA(J-T,G)),S=I+G,b=T+G);break}case ut:{z[1]?(F&&(v=nA(E,iA(Y,z[0][0])),R=nA(E,iA(Y,z[1][0])),F=1),U&&(S=nA(K,iA(J,z[0][1])),b=nA(K,iA(J,z[1][1])),U=1)):(F<0?(M=nA(E-L,iA(Y-L,M)),v=L+M,R=O):F>0&&(M=nA(E-O,iA(Y-O,M)),v=L,R=O+M),U<0?(G=nA(K-I,iA(J-I,G)),S=I+G,b=T):U>0&&(G=nA(K-T,iA(J-T,G)),S=I,b=T+G));break}case ft:{F&&(v=nA(E,iA(Y,L-M*F)),R=nA(E,iA(Y,O+M*F))),U&&(S=nA(K,iA(J,I-G*U)),b=nA(K,iA(J,T+G*U)));break}}R<v&&(F*=-1,ZA=L,L=O,O=ZA,ZA=v,v=R,R=ZA,Q in ji&&se.attr("cursor",SA[Q=ji[Q]])),b<S&&(U*=-1,ZA=I,I=T,T=ZA,ZA=S,S=b,b=ZA,Q in As&&se.attr("cursor",SA[Q=As[Q]])),d.selection&&(y=d.selection),lA&&(v=y[0][0],R=y[1][0]),vA&&(S=y[0][1],b=y[1][1]),(y[0][0]!==v||y[0][1]!==S||y[1][0]!==R||y[1][1]!==b)&&(d.selection=[[v,S],[R,b]],B.call(w),ie.brush(_,p.name))}function So(_){if(lu(_),_.touches){if(_.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Bu(_.view,rA),bo.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);Lo.attr("pointer-events","all"),se.attr("cursor",SA.overlay),d.selection&&(y=d.selection),Cu(y)&&(d.selection=null,B.call(w)),ie.end(_,p.name)}function VC(_){switch(_.keyCode){case 16:{CA=F&&U;break}case 18:{p===ut&&(F&&(O=R-M*F,L=v+M*F),U&&(T=b-G*U,I=S+G*U),p=ft,at(_));break}case 32:{(p===ut||p===ft)&&(F<0?O=R-M:F>0&&(L=v-M),U<0?T=b-G:U>0&&(I=S-G),p=Zr,se.attr("cursor",SA.selection),at(_));break}default:return}Wr(_)}function kC(_){switch(_.keyCode){case 16:{CA&&(lA=vA=CA=!1,at(_));break}case 18:{p===ft&&(F<0?O=R:F>0&&(L=v),U<0?T=b:U>0&&(I=S),p=ut,at(_));break}case 32:{p===Zr&&(_.altKey?(F&&(O=R-M*F,L=v+M*F),U&&(T=b-G*U,I=S+G*U),p=ft):(F<0?O=R:F>0&&(L=v),U<0?T=b:U>0&&(I=S),p=ut),se.attr("cursor",SA[Q]),at(_));break}default:return}Wr(_)}}function f(h){c(this,arguments).moved(h)}function g(h){c(this,arguments).ended(h)}function C(){var h=this.__brush||{selection:null};return h.extent=$r(t.apply(this,arguments)),h.dim=A,h}return o.extent=function(h){return arguments.length?(t=typeof h=="function"?h:Yr($r(h)),o):t},o.filter=function(h){return arguments.length?(e=typeof h=="function"?h:Yr(!!h),o):e},o.touchable=function(h){return arguments.length?(r=typeof h=="function"?h:Yr(!!h),o):r},o.handleSize=function(h){return arguments.length?(s=+h,o):s},o.keyModifiers=function(h){return arguments.length?(n=!!h,o):n},o.on=function(){var h=i.on.apply(i,arguments);return h===i?o:h},o}function Ee(A,t){return A==null||t==null?NaN:A<t?-1:A>t?1:A>=t?0:NaN}function Fu(A,t){return A==null||t==null?NaN:t<A?-1:t>A?1:t>=A?0:NaN}function ts(A){let t,e,r;A.length!==2?(t=Ee,e=(a,o)=>Ee(A(a),o),r=(a,o)=>A(a)-o):(t=A===Ee||A===Fu?A:pu,e=A,r=A);function n(a,o,B=0,c=a.length){if(B<c){if(t(o,o)!==0)return c;do{const l=B+c>>>1;e(a[l],o)<0?B=l+1:c=l}while(B<c)}return B}function i(a,o,B=0,c=a.length){if(B<c){if(t(o,o)!==0)return c;do{const l=B+c>>>1;e(a[l],o)<=0?B=l+1:c=l}while(B<c)}return B}function s(a,o,B=0,c=a.length){const l=n(a,o,B,c-1);return l>B&&r(a[l-1],o)>-r(a[l],o)?l-1:l}return{left:n,center:s,right:i}}function pu(){return 0}function yu(A){return A===null?NaN:+A}const vu=ts(Ee).right;ts(yu).center;class es extends Map{constructor(t,e=Hu){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),t!=null)for(const[r,n]of t)this.set(r,n)}get(t){return super.get(rs(this,t))}has(t){return super.has(rs(this,t))}set(t,e){return super.set(Eu(this,t),e)}delete(t){return super.delete(mu(this,t))}}function rs({_intern:A,_key:t},e){const r=t(e);return A.has(r)?A.get(r):e}function Eu({_intern:A,_key:t},e){const r=t(e);return A.has(r)?A.get(r):(A.set(r,e),e)}function mu({_intern:A,_key:t},e){const r=t(e);return A.has(r)&&(e=A.get(r),A.delete(r)),e}function Hu(A){return A!==null&&typeof A=="object"?A.valueOf():A}const Iu=Math.sqrt(50),xu=Math.sqrt(10),Lu=Math.sqrt(2);function me(A,t,e){const r=(t-A)/Math.max(0,e),n=Math.floor(Math.log10(r)),i=r/Math.pow(10,n),s=i>=Iu?10:i>=xu?5:i>=Lu?2:1;let a,o,B;return n<0?(B=Math.pow(10,-n)/s,a=Math.round(A*B),o=Math.round(t*B),a/B<A&&++a,o/B>t&&--o,B=-B):(B=Math.pow(10,n)*s,a=Math.round(A/B),o=Math.round(t/B),a*B<A&&++a,o*B>t&&--o),o<a&&.5<=e&&e<2?me(A,t,e*2):[a,o,B]}function tn(A,t,e){if(t=+t,A=+A,e=+e,!(e>0))return[];if(A===t)return[A];const r=t<A,[n,i,s]=r?me(t,A,e):me(A,t,e);if(!(i>=n))return[];const a=i-n+1,o=new Array(a);if(r)if(s<0)for(let B=0;B<a;++B)o[B]=(i-B)/-s;else for(let B=0;B<a;++B)o[B]=(i-B)*s;else if(s<0)for(let B=0;B<a;++B)o[B]=(n+B)/-s;else for(let B=0;B<a;++B)o[B]=(n+B)*s;return o}function en(A,t,e){return t=+t,A=+A,e=+e,me(A,t,e)[2]}function bu(A,t,e){t=+t,A=+A,e=+e;const r=t<A,n=r?en(t,A,e):en(A,t,e);return(r?-1:1)*(n<0?1/-n:n)}function Ku(A,t,e){A=+A,t=+t,e=(n=arguments.length)<2?(t=A,A=0,1):n<3?1:+e;for(var r=-1,n=Math.max(0,Math.ceil((t-A)/e))|0,i=new Array(n);++r<n;)i[r]=A+r*e;return i}function He(A,t){switch(arguments.length){case 0:break;case 1:this.range(A);break;default:this.range(t).domain(A);break}return this}const ns=Symbol("implicit");function is(){var A=new es,t=[],e=[],r=ns;function n(i){let s=A.get(i);if(s===void 0){if(r!==ns)return r;A.set(i,s=t.push(i)-1)}return e[s%e.length]}return n.domain=function(i){if(!arguments.length)return t.slice();t=[],A=new es;for(const s of i)A.has(s)||A.set(s,t.push(s)-1);return n},n.range=function(i){return arguments.length?(e=Array.from(i),n):e.slice()},n.unknown=function(i){return arguments.length?(r=i,n):r},n.copy=function(){return is(t,e).unknown(r)},He.apply(n,arguments),n}function ss(){var A=is().unknown(void 0),t=A.domain,e=A.range,r=0,n=1,i,s,a=!1,o=0,B=0,c=.5;delete A.unknown;function l(){var u=t().length,f=n<r,g=f?n:r,C=f?r:n;i=(C-g)/Math.max(1,u-o+B*2),a&&(i=Math.floor(i)),g+=(C-g-i*(u-o))*c,s=i*(1-o),a&&(g=Math.round(g),s=Math.round(s));var h=Ku(u).map(function(w){return g+i*w});return e(f?h.reverse():h)}return A.domain=function(u){return arguments.length?(t(u),l()):t()},A.range=function(u){return arguments.length?([r,n]=u,r=+r,n=+n,l()):[r,n]},A.rangeRound=function(u){return[r,n]=u,r=+r,n=+n,a=!0,l()},A.bandwidth=function(){return s},A.step=function(){return i},A.round=function(u){return arguments.length?(a=!!u,l()):a},A.padding=function(u){return arguments.length?(o=Math.min(1,B=+u),l()):o},A.paddingInner=function(u){return arguments.length?(o=Math.min(1,u),l()):o},A.paddingOuter=function(u){return arguments.length?(B=+u,l()):B},A.align=function(u){return arguments.length?(c=Math.max(0,Math.min(1,u)),l()):c},A.copy=function(){return ss(t(),[r,n]).round(a).paddingInner(o).paddingOuter(B).align(c)},He.apply(l(),arguments)}function Su(A){return function(){return A}}function Du(A){return+A}var as=[0,1];function gt(A){return A}function rn(A,t){return(t-=A=+A)?function(e){return(e-A)/t}:Su(isNaN(t)?NaN:.5)}function Tu(A,t){var e;return A>t&&(e=A,A=t,t=e),function(r){return Math.max(A,Math.min(t,r))}}function Mu(A,t,e){var r=A[0],n=A[1],i=t[0],s=t[1];return n<r?(r=rn(n,r),i=e(s,i)):(r=rn(r,n),i=e(i,s)),function(a){return i(r(a))}}function _u(A,t,e){var r=Math.min(A.length,t.length)-1,n=new Array(r),i=new Array(r),s=-1;for(A[r]<A[0]&&(A=A.slice().reverse(),t=t.slice().reverse());++s<r;)n[s]=rn(A[s],A[s+1]),i[s]=e(t[s],t[s+1]);return function(a){var o=vu(A,a,1,r)-1;return i[o](n[o](a))}}function os(A,t){return t.domain(A.domain()).range(A.range()).interpolate(A.interpolate()).clamp(A.clamp()).unknown(A.unknown())}function Bs(){var A=as,t=as,e=ye,r,n,i,s=gt,a,o,B;function c(){var u=Math.min(A.length,t.length);return s!==gt&&(s=Tu(A[0],A[u-1])),a=u>2?_u:Mu,o=B=null,l}function l(u){return u==null||isNaN(u=+u)?i:(o||(o=a(A.map(r),t,e)))(r(s(u)))}return l.invert=function(u){return s(n((B||(B=a(t,A.map(r),FA)))(u)))},l.domain=function(u){return arguments.length?(A=Array.from(u,Du),c()):A.slice()},l.range=function(u){return arguments.length?(t=Array.from(u),c()):t.slice()},l.rangeRound=function(u){return t=Array.from(u),e=Jc,c()},l.clamp=function(u){return arguments.length?(s=u?!0:gt,c()):s!==gt},l.interpolate=function(u){return arguments.length?(e=u,c()):e},l.unknown=function(u){return arguments.length?(i=u,l):i},function(u,f){return r=u,n=f,c()}}function Ou(){return Bs()(gt,gt)}function Ru(A){return Math.abs(A=Math.round(A))>=1e21?A.toLocaleString("en").replace(/,/g,""):A.toString(10)}function Ie(A,t){if((e=(A=t?A.toExponential(t-1):A.toExponential()).indexOf("e"))<0)return null;var e,r=A.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+A.slice(e+1)]}function ht(A){return A=Ie(Math.abs(A)),A?A[1]:NaN}function Nu(A,t){return function(e,r){for(var n=e.length,i=[],s=0,a=A[0],o=0;n>0&&a>0&&(o+a+1>r&&(a=Math.max(1,r-o)),i.push(e.substring(n-=a,n+a)),!((o+=a+1)>r));)a=A[s=(s+1)%A.length];return i.reverse().join(t)}}function Gu(A){return function(t){return t.replace(/[0-9]/g,function(e){return A[+e]})}}var Vu=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _t(A){if(!(t=Vu.exec(A)))throw new Error("invalid format: "+A);var t;return new nn({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}_t.prototype=nn.prototype;function nn(A){this.fill=A.fill===void 0?" ":A.fill+"",this.align=A.align===void 0?">":A.align+"",this.sign=A.sign===void 0?"-":A.sign+"",this.symbol=A.symbol===void 0?"":A.symbol+"",this.zero=!!A.zero,this.width=A.width===void 0?void 0:+A.width,this.comma=!!A.comma,this.precision=A.precision===void 0?void 0:+A.precision,this.trim=!!A.trim,this.type=A.type===void 0?"":A.type+""}nn.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 ku(A){A:for(var t=A.length,e=1,r=-1,n;e<t;++e)switch(A[e]){case".":r=n=e;break;case"0":r===0&&(r=e),n=e;break;default:if(!+A[e])break A;r>0&&(r=0);break}return r>0?A.slice(0,r)+A.slice(n+1):A}var cs;function Pu(A,t){var e=Ie(A,t);if(!e)return A+"";var r=e[0],n=e[1],i=n-(cs=Math.max(-8,Math.min(8,Math.floor(n/3)))*3)+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Ie(A,Math.max(0,t+i-1))[0]}function ls(A,t){var e=Ie(A,t);if(!e)return A+"";var r=e[0],n=e[1];return n<0?"0."+new Array(-n).join("0")+r:r.length>n+1?r.slice(0,n+1)+"."+r.slice(n+1):r+new Array(n-r.length+2).join("0")}const us={"%":(A,t)=>(A*100).toFixed(t),b:A=>Math.round(A).toString(2),c:A=>A+"",d:Ru,e:(A,t)=>A.toExponential(t),f:(A,t)=>A.toFixed(t),g:(A,t)=>A.toPrecision(t),o:A=>Math.round(A).toString(8),p:(A,t)=>ls(A*100,t),r:ls,s:Pu,X:A=>Math.round(A).toString(16).toUpperCase(),x:A=>Math.round(A).toString(16)};function fs(A){return A}var gs=Array.prototype.map,hs=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xu(A){var t=A.grouping===void 0||A.thousands===void 0?fs:Nu(gs.call(A.grouping,Number),A.thousands+""),e=A.currency===void 0?"":A.currency[0]+"",r=A.currency===void 0?"":A.currency[1]+"",n=A.decimal===void 0?".":A.decimal+"",i=A.numerals===void 0?fs:Gu(gs.call(A.numerals,String)),s=A.percent===void 0?"%":A.percent+"",a=A.minus===void 0?"−":A.minus+"",o=A.nan===void 0?"NaN":A.nan+"";function B(l){l=_t(l);var u=l.fill,f=l.align,g=l.sign,C=l.symbol,h=l.zero,w=l.width,Q=l.comma,p=l.precision,F=l.trim,U=l.type;U==="n"?(Q=!0,U="g"):us[U]||(p===void 0&&(p=12),F=!0,U="g"),(h||u==="0"&&f==="=")&&(h=!0,u="0",f="=");var d=C==="$"?e:C==="#"&&/[boxX]/.test(U)?"0"+U.toLowerCase():"",m=C==="$"?r:/[%p]/.test(U)?s:"",y=us[U],E=/[defgprs%]/.test(U);p=p===void 0?6:/[gprs]/.test(U)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p));function L(v){var K=d,I=m,S,Y,O;if(U==="c")I=y(v)+I,v="";else{v=+v;var R=v<0||1/v<0;if(v=isNaN(v)?o:y(Math.abs(v),p),F&&(v=ku(v)),R&&+v==0&&g!=="+"&&(R=!1),K=(R?g==="("?g:a:g==="-"||g==="("?"":g)+K,I=(U==="s"?hs[8+cs/3]:"")+I+(R&&g==="("?")":""),E){for(S=-1,Y=v.length;++S<Y;)if(O=v.charCodeAt(S),48>O||O>57){I=(O===46?n+v.slice(S+1):v.slice(S))+I,v=v.slice(0,S);break}}}Q&&!h&&(v=t(v,1/0));var J=K.length+v.length+I.length,T=J<w?new Array(w-J+1).join(u):"";switch(Q&&h&&(v=t(T+v,T.length?w-I.length:1/0),T=""),f){case"<":v=K+v+I+T;break;case"=":v=K+T+v+I;break;case"^":v=T.slice(0,J=T.length>>1)+K+v+I+T.slice(J);break;default:v=T+K+v+I;break}return i(v)}return L.toString=function(){return l+""},L}function c(l,u){var f=B((l=_t(l),l.type="f",l)),g=Math.max(-8,Math.min(8,Math.floor(ht(u)/3)))*3,C=Math.pow(10,-g),h=hs[8+g/3];return function(w){return f(C*w)+h}}return{format:B,formatPrefix:c}}var xe,sn,ws;Ju({thousands:",",grouping:[3],currency:["$",""]});function Ju(A){return xe=Xu(A),sn=xe.format,ws=xe.formatPrefix,xe}function Yu(A){return Math.max(0,-ht(Math.abs(A)))}function Wu(A,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ht(t)/3)))*3-ht(Math.abs(A)))}function Zu(A,t){return A=Math.abs(A),t=Math.abs(t)-A,Math.max(0,ht(t)-ht(A))+1}function $u(A,t,e,r){var n=bu(A,t,e),i;switch(r=_t(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(A),Math.abs(t));return r.precision==null&&!isNaN(i=Wu(n,s))&&(r.precision=i),ws(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=Zu(n,Math.max(Math.abs(A),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=Yu(n))&&(r.precision=i-(r.type==="%")*2);break}}return sn(r)}function zu(A){var t=A.domain;return A.ticks=function(e){var r=t();return tn(r[0],r[r.length-1],e??10)},A.tickFormat=function(e,r){var n=t();return $u(n[0],n[n.length-1],e??10,r)},A.nice=function(e){e==null&&(e=10);var r=t(),n=0,i=r.length-1,s=r[n],a=r[i],o,B,c=10;for(a<s&&(B=s,s=a,a=B,B=n,n=i,i=B);c-- >0;){if(B=en(s,a,e),B===o)return r[n]=s,r[i]=a,t(r);if(B>0)s=Math.floor(s/B)*B,a=Math.ceil(a/B)*B;else if(B<0)s=Math.ceil(s*B)/B,a=Math.floor(a*B)/B;else break;o=B}return A},A}function Qs(){var A=Ou();return A.copy=function(){return os(A,Qs())},He.apply(A,arguments),zu(A)}function qu(A,t){A=A.slice();var e=0,r=A.length-1,n=A[e],i=A[r],s;return i<n&&(s=e,e=r,r=s,s=n,n=i,i=s),A[e]=t.floor(n),A[r]=t.ceil(i),A}function Cs(A){return Math.log(A)}function ds(A){return Math.exp(A)}function ju(A){return-Math.log(-A)}function Af(A){return-Math.exp(-A)}function tf(A){return isFinite(A)?+("1e"+A):A<0?0:A}function ef(A){return A===10?tf:A===Math.E?Math.exp:t=>Math.pow(A,t)}function rf(A){return A===Math.E?Math.log:A===10&&Math.log10||A===2&&Math.log2||(A=Math.log(A),t=>Math.log(t)/A)}function Us(A){return(t,e)=>-A(-t,e)}function nf(A){const t=A(Cs,ds),e=t.domain;let r=10,n,i;function s(){return n=rf(r),i=ef(r),e()[0]<0?(n=Us(n),i=Us(i),A(ju,Af)):A(Cs,ds),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(e(a),s()):e()},t.ticks=a=>{const o=e();let B=o[0],c=o[o.length-1];const l=c<B;l&&([B,c]=[c,B]);let u=n(B),f=n(c),g,C;const h=a==null?10:+a;let w=[];if(!(r%1)&&f-u<h){if(u=Math.floor(u),f=Math.ceil(f),B>0){for(;u<=f;++u)for(g=1;g<r;++g)if(C=u<0?g/i(-u):g*i(u),!(C<B)){if(C>c)break;w.push(C)}}else for(;u<=f;++u)for(g=r-1;g>=1;--g)if(C=u>0?g/i(-u):g*i(u),!(C<B)){if(C>c)break;w.push(C)}w.length*2<h&&(w=tn(B,c,h))}else w=tn(u,f,Math.min(f-u,h)).map(i);return l?w.reverse():w},t.tickFormat=(a,o)=>{if(a==null&&(a=10),o==null&&(o=r===10?"s":","),typeof o!="function"&&(!(r%1)&&(o=_t(o)).precision==null&&(o.trim=!0),o=sn(o)),a===1/0)return o;const B=Math.max(1,r*a/t.ticks().length);return c=>{let l=c/i(Math.round(n(c)));return l*r<r-.5&&(l*=r),l<=B?o(c):""}},t.nice=()=>e(qu(e(),{floor:a=>i(Math.floor(n(a))),ceil:a=>i(Math.ceil(n(a)))})),t}function Fs(){const A=nf(Bs()).domain([1,10]);return A.copy=()=>os(A,Fs()).base(A.base()),He.apply(A,arguments),A}LA.prototype.transition=Ji;var D=(A=>(A.Svg="svg",A.ClipPath="clipPath",A.BaseLayer="baseLayer",A.Axes="axes",A.Area="area",A.Zoom="zoom",A.Trace="trace",A.Tooltip="skadi-chart-tooltip",A.Grid="grid",A.Scatter="scatter",A.Custom="custom",A))(D||{});class DA{constructor(){this.properties=null}brushStart(){}beforeZoom(t){}async zoom(t){}afterZoom(t){}}const ps=A=>Math.floor(A*10)/10,an=(A,t)=>t+ps(A.x)+","+ps(A.y),wt=(A,t)=>{const{width:e,height:r,margin:n}=t.clipPathBounds,i={x:[n.left,e-n.right],y:[r-n.bottom,n.top]},s=[];let a="";const{x:o,y:B}=A[0];let c=i.x[0]<=o&&o<=i.x[1]&&i.y[1]<=B&&B<=i.y[0];for(let l=0;l<A.length;l++){const{x:u,y:f}=A[l],g=i.x[0]<=u&&u<=i.x[1]&&i.y[1]<=f&&f<=i.y[0];c?a+=an(A[l],a?"L":"M"):g&&(a&&s.push(a),a="",a+=an(A[l-1],"M"),a+=an(A[l],"L")),c=g}return a&&s.push(a),s},tt=(A,t)=>{const{x:e,y:r}=t.scaleConfig.numericalScales,{x:n,y:i}=t.scaleConfig.categoricalScales,{x:s,y:a}=A||{};return{x:s&&n?n.bands[s]:e,y:a&&i?i.bands[a]:r}},ys=A=>{const t={x:{start:1/0,end:-1/0},y:{start:1/0,end:-1/0}};for(let e=0;e<A.length;e++){const{x:r,y:n}=A[e];r<t.x.start&&(t.x.start=r),r>t.x.end&&(t.x.end=r),n<t.y.start&&(t.y.start=n),n>t.y.end&&(t.y.end=n)}return t},on=(A,t,e,r)=>`M${A},${e}L${A},${r}L${t},${r}L${t},${e}Z`,vs=(A,t)=>{const{categoricalScales:e,numericalScales:r}={...A.scaleConfig},n=Object.fromEntries(Object.entries(e).map(([s,a])=>{const o=s;return[o,Object.fromEntries(Object.entries((a==null?void 0:a.bands)??{}).map(([B,c])=>[B,t(c,o)]))]}));return[Object.fromEntries(Object.entries(r).map(([s,a])=>{const o=s;return[o,t(a,o)]})),n]},Es=(A,t,e)=>A.append("g").append("line").attr("x1",t.x.start).attr("x2",t.x.end).attr("y1",t.y.start).attr("y2",t.y.end).style("stroke",e).style("stroke-width",.5);class sf extends DA{constructor(t,e){super(),this.labels=t,this.labelPositions=e,this.type=D.Axes,this.drawAxis=(r,n)=>{const{width:i,height:s,margin:a}=n.bounds,{getHtmlId:o}=n,B=n.scaleConfig.numericalScales[r];if(this.labels[r]){const c=n.coreLayers[D.Svg].append("text").attr("id",`${o(D.Axes)}-label${r}`).style("font-size","1.2rem").attr("text-anchor","middle").text(this.labels[r]);if(r==="y"){const l=s-a.top-a.bottom;c.attr("x",-l/2-a.top).attr("y",a.left*this.labelPositions.y).attr("transform","rotate(-90)")}else{const l=i-a.left-a.right;c.attr("x",l/2+a.left).attr("y",s-a.bottom*this.labelPositions.x)}}return n.scaleConfig.categoricalScales[r]?this.drawCategoricalAxis(r,n):this.drawNumericalAxis(r,B,n,12)},this.draw=r=>{const{x:n,y:i}=r.scaleConfig.numericalScales,{animationDuration:s}=r.globals,{layer:a,axis:o,line:B}=this.drawAxis("x",r),{layer:c,axis:l,line:u}=this.drawAxis("y",r);this.zoom=async()=>{const f=a==null?void 0:a.transition().duration(s).call(o).end(),g=c==null?void 0:c.transition().duration(s).call(l).end(),C=B==null?void 0:B.transition().duration(s).attr("x1",n(0)).attr("x2",n(0)).end(),h=u==null?void 0:u.transition().duration(s).attr("y1",i(0)).attr("y2",i(0)).end();await Promise.all([f,g,C,h])}},this.drawCategoricalAxis=(r,n)=>{var p;const i=n.scaleConfig.categoricalScales[r].main,{margin:s}=n.bounds,a=n.coreLayers[D.Svg],{getHtmlId:o}=n,{padding:B,size:c,formatter:l}=n.globals.tickConfig.categorical[r],{translation:u,axisConstructor:f}=this.axisConfig(r,n),g=i.bandwidth(),h=(r==="x"?s.bottom:s.left)*(1-((p=this.labelPositions)==null?void 0:p[r]))/3,w=f(i).tickSize(c??0).tickPadding(B??h);return l&&w.tickFormat(l),a.append("g").attr("id",`${o(D.Axes)}-${r}`).style("font-size","0.75rem").attr("transform",`translate(${u.x},${u.y})`).call(w),Object.entries(n.scaleConfig.categoricalScales[r].bands).forEach(([F,U])=>{const d=i(F);n.globals.tickConfig.numerical[r].count&&this.drawNumericalAxis(r,U,n,6),i.paddingInner()&&this.drawLinePerpendicularToAxis(r,d,n),this.drawLinePerpendicularToAxis(r,d+g,n)}),{layer:null,axis:null,line:null}},this.drawNumericalAxis=(r,n,i,s)=>{const{getHtmlId:a}=i,{count:o,specifier:B,padding:c,size:l,formatter:u,enableMathJax:f}=i.globals.tickConfig.numerical[r],{translation:g,axisConstructor:C}=this.axisConfig(r,i);let h=null;const w=C(n).ticks(o??0,B).tickSize(l??0).tickPadding(c??s);u&&(f?w.tickFormat(()=>""):w.tickFormat((p,F)=>u(p,F)));const Q=i.coreLayers[D.Svg].append("g").attr("id",`${a(D.Axes)}-${r}`).style("font-size","0.75rem").attr("transform",`translate(${g.x},${g.y})`).call(w);return Q.select(".domain").style("stroke-opacity",0),u&&f&&(console.warn("enableMathJax is currently not compatible with zoom layer and is only available for the x axis"),Q.selectAll("g").data(w.scale().ticks()).append("foreignObject").attr("width",50).attr("height",50).attr("x",0).attr("y",c??s).append("xhtml:span").attr("class","tick-mathjax").text((p,F)=>u(p,F)),MathJax.typesetPromise().then(()=>{i.coreLayers[D.Svg].selectAll("span.tick-mathjax").nodes().forEach(F=>{const{width:U}=F.getBoundingClientRect(),d=F.parentElement;d.x.baseVal.value=-U/2})})),i.chartOptions.logScale[r]||(h=this.drawLinePerpendicularToAxis(r,n(0),i,"darkgrey")),{layer:Q,axis:w,line:h}},this.drawLinePerpendicularToAxis=(r,n,i,s="black")=>{var C;const a=i.coreLayers[D.BaseLayer],{height:o,width:B,margin:c}=i.bounds,l=r==="x"?"y":"x",u=(C=i.scaleConfig.categoricalScales[l])==null?void 0:C.main;if(!u){let h={[r]:{start:n,end:n}};return r==="x"?h.y={start:c.top,end:o-c.bottom}:h.x={start:c.left,end:B-c.right},Es(a,h,s)}const f=u.bandwidth(),g=l==="x"?o-c.bottom:c.left;u.domain().forEach(h=>{const w=u(h);if(w===void 0||n===g)return;const Q={[r]:{start:n,end:n},[l]:{start:w,end:w+f}};Es(a,Q,s)})},this.axisConfig=(r,n)=>{const{height:i,margin:s}=n.bounds,a=r==="x"?"y":"x",o=r==="x"?i-s.bottom:s.left;return{translation:{[r]:0,[a]:o},axisConstructor:r==="x"?su:au}}}}const af=(A,t,e,r)=>A*r.x-t*r.y+e,ms=A=>{const t=Math.round(A.x),e=Math.round(A.y);return{x:t,y:e}},Bn=(A,t,e)=>{const r=A[t[0]],n=A[t[1]],i=n.y-r.y,s=n.x-r.x,a=n.x*r.y-n.y*r.x;let o=0,B=0;const c=Math.abs;for(let u=t[0];u<t[1];u++){const f=c(af(i,s,a,A[u]));f>o&&(o=f,B=u)}if(o/Math.sqrt(i*i+s*s)>e){const u=[t[0],B],f=Bn(A,u,e),g=[B,t[1]],C=Bn(A,g,e);return[...f.slice(0,-1),...C]}else{const u=ms(A[t[0]]),f=ms(A[t[1]]);return[u,f]}},of=(A,t)=>A.map(e=>{const r=[0,e.length-1];return Bn(e,r,t)});class Bf extends DA{constructor(t,e){super(),this.linesDC=t,this.options=e,this.type=D.Trace,this.traces=[],this.lowResLinesSC=[],this.getNewPoint=null,this.getNewPointInverse=null,this.customTween=(r,n)=>{const i=this.lowResLinesSC[r];return s=>{const a=i.map(({x:o,y:B})=>this.getNewPoint(o,B,s));return wt(a,n).join("")}},this.updateLowResLinesSC=r=>{const n=this.linesDC.map(i=>{const s=tt(i.bands,r);return i.points.map(a=>({x:s.x(a.x),y:s.y(a.y)}))});this.options.RDPEpsilon!==null?this.lowResLinesSC=of(n,this.options.RDPEpsilon):this.lowResLinesSC=n},this.draw=(r,n)=>{this.updateLowResLinesSC(r),this.traces=this.linesDC.map((i,s)=>{const a=wt(this.lowResLinesSC[s],r).join("");return r.coreLayers[D.BaseLayer].append("path").attr("id",`${r.getHtmlId(D.Trace)}-${s}`).attr("pointer-events","none").attr("fill","none").attr("stroke",i.style.strokeColor||"black").attr("opacity",i.style.opacity||1).attr("stroke-width",i.style.strokeWidth||.5).attr("stroke-dasharray",i.style.strokeDasharray||"").attr("d",a)}),this.beforeZoom=i=>{const{x:s,y:a}=r.scaleConfig.numericalScales,o=i.x,B=i.y,c=[s(o[0]),s(o[1])],l=[a(B[0]),a(B[1])],u=s.domain(),f=a.domain(),g=[s(u[0]),s(u[1])],C=[a(f[0]),a(f[1])],h=(g[1]-g[0])/(c[1]-c[0]),w=(C[1]-C[0])/(l[1]-l[0]),Q=h*s(o[0])-s(u[0]),p=w*a(B[0])-a(f[0]),F=h-1,U=w-1;this.getNewPoint=(d,m,y)=>({x:d*(y*F+1)-y*Q,y:m*(y*U+1)-y*p}),this.getNewPointInverse=(d,m,y)=>({x:(d+y*Q)/(y*F+1),y:(m+y*p)/(y*U+1)})},this.zoom=async i=>{const s=[];for(let a=0;a<this.linesDC.length;a++){const o=this.traces[a].transition().duration(r.globals.animationDuration).attrTween("d",()=>this.customTween(a,r)).end();s.push(o)}await Promise.all(s),this.updateLowResLinesSC(r),this.traces.forEach((a,o)=>{a.attr("d",wt(this.lowResLinesSC[o],r).join(""))})}}}}class cf extends DA{constructor(t){super(),this.options=t,this.type=D.Zoom,this.zooming=!1,this.selectionMask=null,this.overlay=null,this.processSelection=(e,r)=>{const{width:n,height:i,margin:s}=r.bounds,[[a,o],[B,c]]=e.selection,l=30,u=Math.abs(a-B),f=Math.abs(o-c);return this.options.lockAxis==="y"?[[a,s.top],[B,i-s.bottom]]:this.options.lockAxis==="x"?[[s.left,o],[n-s.right,c]]:u>l&&f<=l?[[a,s.top],[B,i-s.bottom]]:u<=l&&f>l?[[s.left,o],[n-s.right,c]]:[[a,o],[B,c]]},this.handleZoom=async(e,r)=>{if(this.zooming)return;this.zooming=!0;const{x:n,y:i}=r.scaleConfig.numericalScales;r.optionalLayers.forEach(a=>a.beforeZoom(e)),e.x&&n.domain(e.x),e.y&&i.domain(e.y);const s=[];r.optionalLayers.forEach(a=>s.push(a.zoom(e))),await Promise.all(s),r.optionalLayers.forEach(a=>a.afterZoom(e)),this.zooming=!1},this.handleBrushEnd=(e,r,n)=>{if(this.overlay.style("display","none"),this.selectionMask.attr("x",0).attr("y",0).attr("width",0).attr("height",0),!e.selection){n.optionalLayers.forEach(w=>w.afterZoom(null));return}r.call(e.target.move,null);const[[i,s],[a,o]]=this.processSelection(e,n),B=n.scaleConfig.numericalScales.x,c=B.invert(i),l=B.invert(a),u=n.scaleConfig.numericalScales.y,f=u.invert(o),g=u.invert(s),C=10;if(Math.abs(i-a)<C||Math.abs(s-o)<C){n.optionalLayers.forEach(w=>w.afterZoom(null));return}const h={x:[c,l],y:[f,g],eventType:"brush"};this.handleZoom(h,n)},this.handleBrushMove=(e,r)=>{if(!e.selection)return;this.overlay.style("display","");const[[n,i],[s,a]]=this.processSelection(e,r);this.selectionMask.attr("x",Math.min(n,s)).attr("y",Math.min(i,a)).attr("width",Math.abs(n-s)).attr("height",Math.abs(i-a))},this.draw=e=>{const r=e.scaleConfig.categoricalScales;if(r.x&&r.y){console.warn("You have tried to use zoom with two categorical axes, but this is not supported.");return}Object.entries(r).forEach(([w,Q])=>{Q&&(this.options.lockAxis=w)});const{width:n,height:i,margin:s}=e.bounds,a=e.coreLayers[D.Svg],o=du().extent([[s.left,s.top],[n-s.right,i-s.bottom]]),B=e.coreLayers[D.BaseLayer].append("g").attr("id",`${e.getHtmlId(D.Zoom)}-brush`).style("opacity",0).call(o),c=`${e.getHtmlId(D.Zoom)}-overlay`;a.select("defs").append("svg:mask").attr("id",c).append("svg:rect").attr("width",n-s.right-s.left).attr("height",i-s.bottom-s.top).attr("x",s.left).attr("y",s.top).attr("fill","white").attr("fill-opacity",.15).style("mask-type","alpha");const l=`${e.getHtmlId(D.Zoom)}-selection`;this.selectionMask=a.select("defs").append("svg:mask").attr("id",l).append("svg:rect").attr("width",0).attr("height",0).attr("x",0).attr("y",0).attr("fill","white").style("mask-type","alpha"),this.overlay=a.append("svg:rect").attr("width",n-s.right-s.left).attr("height",i-s.bottom-s.top).attr("x",s.left).attr("y",s.top).style("display","none").style("mask-image",`url(#${c}), url(#${l})`).style("mask-composite","subtract"),o.on("start",()=>e.optionalLayers.forEach(w=>w.brushStart())),o.on("brush",w=>this.handleBrushMove(w,e)),o.on("end",w=>this.handleBrushEnd(w,B,e));const{x:u,y:f}=e.scaleConfig.scaleExtents,{x:g,y:C}=e.scaleConfig.numericalScales,h={x:[u.start,u.end],y:[f.start,f.end],eventType:"dblclick"};this.options.lockAxis==="y"&&(h.y=C.domain()),this.options.lockAxis==="x"&&(h.x=g.domain()),e.coreLayers[D.Svg].on("dblclick",()=>this.handleZoom(h,e))}}}class lf extends DA{constructor(t,e=25,r){super(),this.tooltipHtmlCallback=t,this.radiusPx=e,this.distanceAxis=r,this.type=D.Tooltip,this.tooltipRadiusSq=625,this.getDistanceSq=(n,i)=>{const s=n.x-i.x,a=n.y-i.y;return s*s+a*a},this.getDistanceSqSC=(n,i,s)=>{const a={x:n.x*s.x,y:n.y*s.y},o={x:i.x*s.x,y:i.y*s.y};return this.getDistanceSq(a,o)},this.convertSCPointToCC=(n,i)=>{const s=i.coreLayers[D.Svg].node().getScreenCTM(),{a,c:o,b:B,d:c}=s,{e:l,f:u}=s;return{x:a*n.x+o*n.y+l,y:B*n.x+c*n.y+u}},this.handleMouseMove=(n,i,s,a)=>{const o=mr(n),B={x:o[0],y:o[1]},c=this.distanceAxis,[l,u]=vs(i,(F,U)=>F.invert(B[U])),[f,g]=vs(i,F=>{const U=Math.abs(F.domain()[1]-F.domain()[0])||1;return(Math.abs(F.range()[1]-F.range()[0])||1)/U});let C=1/0;const h=a.reduce((F,U)=>{const d=U.bands||{},m={x:d.x?u.x[d.x]:l.x,y:d.y?u.y[d.y]:l.y},y={x:d.x?g.x[d.x]:f.x,y:d.y?g.y[d.y]:f.y};if(c){const[L,v]=[U,F].map(K=>{const I=m[c]*y[c],S=K[c]*y[c];return(I-S)**2});if(L>v)return F}const E=this.getDistanceSqSC(m,U,y);return E>=C?F:(C=E,U)},{x:0,y:0}),w=tt(h.bands,i),Q={x:w.x(h.x),y:w.y(h.y)};if(this.getDistanceSq(B,Q)>this.tooltipRadiusSq)s.style("opacity",0);else{const F=this.convertSCPointToCC(Q,i);s.html(this.tooltipHtmlCallback(h)).style("left",`${F.x}px`).style("top",`${F.y}px`).style("opacity",1)}},this.draw=n=>{const i=n.optionalLayers.filter(u=>u.type===D.Trace),s=n.optionalLayers.filter(u=>u.type===D.Scatter);if(i.length===0&&s.length===0){console.warn("Tooltip Layer was added without a Traces Layer or a Scatter Layer.");return}const a=di("div").attr("id",`${n.getHtmlId(this.type)}`).style("position","fixed").style("pointer-events","none");let o=i.reduce((u,f)=>[...f.linesDC.flatMap(({points:C,metadata:h,bands:w})=>C.map(Q=>({...Q,metadata:h,bands:w}))),...u],[]);o=s.reduce((u,f)=>[...f.points,...u],o);const B=n.coreLayers[D.Svg];let c,l=!1;B.on("mousemove",u=>{var f;c===void 0&&!l&&((f=document.querySelectorAll(`*[id*="${this.type}"]`))==null||f.forEach(g=>g.innerHTML=""),this.handleMouseMove(u,n,a,o),c=setTimeout(()=>{c=void 0},25))}),this.brushStart=()=>{l=!0,a.html("")},this.afterZoom=()=>{l=!1},B.on("mouseleave",()=>a.remove()),B.on("mouseenter",()=>document.body.append(a.node()))},this.tooltipRadiusSq=e*e}}class uf extends DA{constructor(t){super(),this.directions=t,this.type=D.Grid,this.draw=e=>{const{width:r,height:n,margin:i}=e.bounds,{x:s,y:a}=e.scaleConfig.numericalScales,o=e.coreLayers[D.Svg],{animationDuration:B,tickConfig:c}=e.globals,{getHtmlId:l}=e,u=.15,f=.5,g={},C=w=>{w.selectAll("line").data(s.ticks(c.numerical.x.count)).join("line").style("stroke","black").style("stroke-width",f).attr("pointer-events","none").attr("x1",Q=>s(Q)).attr("x2",Q=>s(Q)).attr("y1",i.top).attr("y2",n-i.bottom)},h=w=>{w.selectAll("line").data(a.ticks(c.numerical.y.count)).join("line").style("stroke","black").style("stroke-width",f).attr("pointer-events","none").attr("x1",i.left).attr("x2",r-i.right).attr("y1",Q=>a(Q)).attr("y2",Q=>a(Q))};this.directions.x&&(g.x=o.append("g").call(C).attr("opacity",u).attr("id",`${l(this.type)}-x`)),this.directions.y&&(g.y=o.append("g").call(h).attr("opacity",u).attr("id",`${l(this.type)}-y`)),this.zoom=async()=>{var U,d,m,y;const w=(U=g.x)==null?void 0:U.selectAll("line").transition().duration(B/2).style("opacity",0).remove().end(),Q=(d=g.y)==null?void 0:d.selectAll("line").transition().duration(B/2).style("opacity",0).remove().end();await Promise.all([w,Q]);const p=(m=g.x)==null?void 0:m.call(C).style("opacity",0).transition().duration(B/2).style("opacity",u).end(),F=(y=g.y)==null?void 0:y.call(h).style("opacity",0).transition().duration(B/2).style("opacity",u).end();await Promise.all([p,F])}}}}/*!
2
2
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
3
3
  * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
4
4
  * Released under MIT License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reside-ic/skadi-chart",
3
- "version": "1.1.9-alpha.0",
3
+ "version": "1.1.9-alpha.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"