UNPKG

racing-bars

Version:

Bar chart race made easy 📶

2 lines • 144 kB
"use strict";var racingBars=(()=>{var br=Object.defineProperty;var sa=Object.getOwnPropertyDescriptor;var ua=Object.getOwnPropertyNames;var la=Object.prototype.hasOwnProperty;var Kt=(t,e)=>{for(var r in e)br(t,r,{get:e[r],enumerable:!0})},ca=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ua(e))!la.call(t,o)&&o!==r&&br(t,o,{get:()=>e[o],enumerable:!(n=sa(e,o))||n.enumerable});return t};var fa=t=>ca(br({},"__esModule",{value:!0}),t);var Jl={};Kt(Jl,{defaultOptions:()=>ye,generateId:()=>yt,loadData:()=>de,race:()=>An});var vn={};Kt(vn,{actionTypes:()=>Lt,changeOptions:()=>ha,defaultOptions:()=>ye,loadOptions:()=>pa,optionsReducer:()=>wn,validateOptions:()=>gr});var Lt={loadOptions:"options/load",changeOptions:"options/change"},pa=t=>({type:Lt.loadOptions,payload:t}),ha=t=>({type:Lt.changeOptions,payload:t});var kr={};Kt(kr,{actionTypes:()=>we,containerReducer:()=>Dr,setContainer:()=>ma});var we={setContainer:"container/set"},ma=t=>({type:we.setContainer,payload:t.element});var da={element:document.body},Dr=(t=da,e)=>{switch(e.type){case we.setContainer:return{...t,element:e.payload};default:return t}};var Tr={};Kt(Tr,{actionTypes:()=>F,addDateSlice:()=>Aa,addFilter:()=>ya,addSelection:()=>ba,allExceptFilter:()=>_a,clearDateSlices:()=>Ta,dataLoaded:()=>ga,dataReducer:()=>Ar,removeFilter:()=>xa,removeSelection:()=>Da,resetFilters:()=>wa,resetSelections:()=>Sa,toggleFilter:()=>va,toggleSelection:()=>ka});var F={dataLoaded:"data/loaded",addFilter:"data/addFilter",removeFilter:"data/removeFilter",toggleFilter:"data/toggleFilter",resetFilters:"data/resetFilters",allExceptFilter:"data/allExceptFilter",addSelection:"data/addSelection",removeSelection:"data/removeSelection",toggleSelection:"data/toggleSelection",resetSelections:"data/resetSelections",addDateSlice:"data/addDateSlice",clearDateSlices:"data/clearDateSlices"},ga=t=>({type:F.dataLoaded,payload:t}),ya=t=>({type:F.addFilter,payload:t}),xa=t=>({type:F.removeFilter,payload:t}),va=t=>({type:F.toggleFilter,payload:t}),wa=()=>({type:F.resetFilters}),_a=t=>({type:F.allExceptFilter,payload:t}),ba=t=>({type:F.addSelection,payload:t}),Da=t=>({type:F.removeSelection,payload:t}),ka=t=>({type:F.toggleSelection,payload:t}),Sa=()=>({type:F.resetSelections}),Aa=(t,e)=>{let r={};return r[t]=e,{type:F.addDateSlice,payload:r,triggerRender:!1}},Ta=()=>({type:F.clearDateSlices});var Ma={names:[],groups:[],datesCache:[],groupFilter:[],selected:[],dateSlices:{}},Ar=(t=Ma,e)=>{switch(e.type){case F.dataLoaded:return{...t,names:[...e.payload.names],groups:[...e.payload.groups],datesCache:[...e.payload.datesCache]};case F.addFilter:return{...t,groupFilter:Sr(t.groupFilter,e.payload)};case F.removeFilter:return{...t,groupFilter:_e(t.groupFilter,e.payload)};case F.toggleFilter:return{...t,groupFilter:Tn(t.groupFilter,e.payload)};case F.resetFilters:return{...t,groupFilter:[]};case F.allExceptFilter:return{...t,groupFilter:_e(t.groups,e.payload)};case F.addSelection:return{...t,selected:Sr(t.selected,e.payload)};case F.removeSelection:return{...t,selected:_e(t.selected,e.payload)};case F.toggleSelection:return{...t,selected:Tn(t.selected,e.payload)};case F.resetSelections:return{...t,selected:[]};case F.addDateSlice:return{...t,dateSlices:{...t.dateSlices,...e.payload}};case F.clearDateSlices:return{...t,dateSlices:{}};default:return t}};function Sr(t,e){let r=[...t];return r.includes(e)||r.push(e),r}function _e(t,e){return t.filter(r=>r!==e)}function Tn(t,e){return t.includes(e)?_e(t,e):Sr(t,e)}var xn={};Kt(xn,{actionTypes:()=>U,changeDates:()=>Ca,createTicker:()=>yn,dec:()=>La,inc:()=>Ia,initialize:()=>Ea,setFirst:()=>Fa,setLast:()=>Oa,setRunning:()=>Ra,tickerReducer:()=>Mr,updateDate:()=>Na});var U={initialize:"ticker/initialize",changeDates:"ticker/changeDates",updateDate:"ticker/updateDate",setRunning:"ticker/setRunning",setFirst:"ticker/setFirst",setLast:"ticker/setLast",inc:"ticker/inc",dec:"ticker/dec"},Ea=t=>({type:U.initialize,payload:t}),Ca=t=>({type:U.changeDates,payload:t}),Na=t=>({type:U.updateDate,payload:t}),Ra=t=>({type:U.setRunning,payload:t}),Fa=()=>({type:U.setFirst}),Oa=()=>({type:U.setLast}),Ia=(t=1)=>({type:U.inc,payload:t}),La=(t=1)=>({type:U.dec,payload:t});var Pa={isRunning:!1,currentDate:"",isFirstDate:!0,isLastDate:!1,dates:[]},Mr=(t=Pa,e)=>{switch(e.type){case U.initialize:{let r=e.payload;return{...t,isRunning:!1,currentDate:r[0],isFirstDate:!0,isLastDate:!1,dates:r}}case U.changeDates:{let r=e.payload,n=r.indexOf(t.currentDate)!==-1?t.currentDate:t.currentDate<r[0]?r[0]:t.currentDate>r[r.length-1]?r[r.length-1]:r[[...r,t.currentDate].sort().indexOf(t.currentDate)];return{...t,currentDate:n,isFirstDate:n===r[0],isLastDate:n===r[r.length-1],dates:r}}case U.updateDate:{let r=e.payload;return t.dates.indexOf(r)===-1?{...t}:{...t,currentDate:r,isFirstDate:r===t.dates[0],isLastDate:r===t.dates[t.dates.length-1]}}case U.setRunning:return{...t,isRunning:e.payload};case U.setFirst:return{...t,currentDate:t.dates[0],isFirstDate:!0,isLastDate:!1};case U.setLast:return{...t,currentDate:t.dates[t.dates.length-1],isFirstDate:!1,isLastDate:!0};case U.inc:{let r=t.dates.indexOf(t.currentDate),n=t.dates.length-1,o=e.payload,i=r+o>n?t.dates[n]:t.dates[r+o];return{...t,currentDate:i,isFirstDate:i===t.dates[0],isLastDate:i===t.dates[n]}}case U.dec:{let r=t.dates.indexOf(t.currentDate),n=e.payload,o=r-n<0?t.dates[0]:t.dates[r-n];return{...t,currentDate:o,isFirstDate:o===t.dates[0],isLastDate:o===t.dates[t.dates.length-1]}}default:return t}};function wt(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Er(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function be(t){let e,r,n;t.length!==2?(e=wt,r=(s,l)=>wt(t(s),l),n=(s,l)=>t(s)-l):(e=t===wt||t===Er?t:za,r=t,n=t);function o(s,l,u=0,c=s.length){if(u<c){if(e(l,l)!==0)return c;do{let f=u+c>>>1;r(s[f],l)<0?u=f+1:c=f}while(u<c)}return u}function i(s,l,u=0,c=s.length){if(u<c){if(e(l,l)!==0)return c;do{let f=u+c>>>1;r(s[f],l)<=0?u=f+1:c=f}while(u<c)}return u}function a(s,l,u=0,c=s.length){let f=o(s,l,u,c-1);return f>u&&n(s[f-1],l)>-n(s[f],l)?f-1:f}return{left:o,center:a,right:i}}function za(){return 0}function Cr(t){return t===null?NaN:+t}var Mn=be(wt),En=Mn.right,Ha=Mn.left,$a=be(Cr).center,Nr=En;var Ba=Math.sqrt(50),Va=Math.sqrt(10),Ya=Math.sqrt(2);function De(t,e,r){let n=(e-t)/Math.max(0,r),o=Math.floor(Math.log10(n)),i=n/Math.pow(10,o),a=i>=Ba?10:i>=Va?5:i>=Ya?2:1,s,l,u;return o<0?(u=Math.pow(10,-o)/a,s=Math.round(t*u),l=Math.round(e*u),s/u<t&&++s,l/u>e&&--l,u=-u):(u=Math.pow(10,o)*a,s=Math.round(t/u),l=Math.round(e/u),s*u<t&&++s,l*u>e&&--l),l<s&&.5<=r&&r<2?De(t,e,r*2):[s,l,u]}function ke(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];let n=e<t,[o,i,a]=n?De(e,t,r):De(t,e,r);if(!(i>=o))return[];let s=i-o+1,l=new Array(s);if(n)if(a<0)for(let u=0;u<s;++u)l[u]=(i-u)/-a;else for(let u=0;u<s;++u)l[u]=(i-u)*a;else if(a<0)for(let u=0;u<s;++u)l[u]=(o+u)/-a;else for(let u=0;u<s;++u)l[u]=(o+u)*a;return l}function Zt(t,e,r){return e=+e,t=+t,r=+r,De(t,e,r)[2]}function Rr(t,e,r){e=+e,t=+t,r=+r;let n=e<t,o=n?Zt(e,t,r):Zt(t,e,r);return(n?-1:1)*(o<0?1/-o:o)}function _t(t,e){let r;if(e===void 0)for(let n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let o of t)(o=e(o,++n,t))!=null&&(r<o||r===void 0&&o>=o)&&(r=o)}return r}function Cn(t){return t}var Ae=1,Fr=2,Nn=3,Se=4,Rn=1e-6;function Ua(t){return"translate("+t+",0)"}function qa(t){return"translate(0,"+t+")"}function Wa(t){return e=>+t(e)}function Xa(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function ja(){return!this.__axis}function Ga(t,e){var r=[],n=null,o=null,i=6,a=6,s=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=t===Ae||t===Se?-1:1,c=t===Se||t===Fr?"x":"y",f=t===Ae||t===Nn?Ua:qa;function p(h){var m=n??(e.ticks?e.ticks.apply(e,r):e.domain()),g=o??(e.tickFormat?e.tickFormat.apply(e,r):Cn),x=Math.max(i,0)+s,b=e.range(),D=+b[0]+l,k=+b[b.length-1]+l,S=(e.bandwidth?Xa:Wa)(e.copy(),l),d=h.selection?h.selection():h,w=d.selectAll(".domain").data([null]),E=d.selectAll(".tick").data(m,e).order(),R=E.exit(),I=E.enter().append("g").attr("class","tick"),H=E.select("line"),_=E.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),E=E.merge(I),H=H.merge(I.append("line").attr("stroke","currentColor").attr(c+"2",u*i)),_=_.merge(I.append("text").attr("fill","currentColor").attr(c,u*x).attr("dy",t===Ae?"0em":t===Nn?"0.71em":"0.32em")),h!==d&&(w=w.transition(h),E=E.transition(h),H=H.transition(h),_=_.transition(h),R=R.transition(h).attr("opacity",Rn).attr("transform",function(C){return isFinite(C=S(C))?f(C+l):this.getAttribute("transform")}),I.attr("opacity",Rn).attr("transform",function(C){var A=this.parentNode.__axis;return f((A&&isFinite(A=A(C))?A:S(C))+l)})),R.remove(),w.attr("d",t===Se||t===Fr?a?"M"+u*a+","+D+"H"+l+"V"+k+"H"+u*a:"M"+l+","+D+"V"+k:a?"M"+D+","+u*a+"V"+l+"H"+k+"V"+u*a:"M"+D+","+l+"H"+k),E.attr("opacity",1).attr("transform",function(C){return f(S(C)+l)}),H.attr(c+"2",u*i),_.attr(c,u*x).text(g),d.filter(ja).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Fr?"start":t===Se?"end":"middle"),d.each(function(){this.__axis=S})}return p.scale=function(h){return arguments.length?(e=h,p):e},p.ticks=function(){return r=Array.from(arguments),p},p.tickArguments=function(h){return arguments.length?(r=h==null?[]:Array.from(h),p):r.slice()},p.tickValues=function(h){return arguments.length?(n=h==null?null:Array.from(h),p):n&&n.slice()},p.tickFormat=function(h){return arguments.length?(o=h,p):o},p.tickSize=function(h){return arguments.length?(i=a=+h,p):i},p.tickSizeInner=function(h){return arguments.length?(i=+h,p):i},p.tickSizeOuter=function(h){return arguments.length?(a=+h,p):a},p.tickPadding=function(h){return arguments.length?(s=+h,p):s},p.offset=function(h){return arguments.length?(l=+h,p):l},p}function Te(t){return Ga(Ae,t)}var Ka={value:()=>{}};function On(){for(var t=0,e=arguments.length,r={},n;t<e;++t){if(!(n=arguments[t]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new Me(r)}function Me(t){this._=t}function Za(t,e){return t.trim().split(/^|\s+/).map(function(r){var n="",o=r.indexOf(".");if(o>=0&&(n=r.slice(o+1),r=r.slice(0,o)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}Me.prototype=On.prototype={constructor:Me,on:function(t,e){var r=this._,n=Za(t+"",r),o,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((o=(t=n[i]).type)&&(o=Qa(r[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<a;)if(o=(t=n[i]).type)r[o]=Fn(r[o],t.name,e);else if(e==null)for(o in r)r[o]=Fn(r[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Me(t)},call:function(t,e){if((o=arguments.length-2)>0)for(var r=new Array(o),n=0,o,i;n<o;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],n=0,o=i.length;n<o;++n)i[n].value.apply(e,r)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};function Qa(t,e){for(var r=0,n=t.length,o;r<n;++r)if((o=t[r]).name===e)return o.value}function Fn(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=Ka,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var Or=On;var Ee="http://www.w3.org/1999/xhtml",Ir={svg:"http://www.w3.org/2000/svg",xhtml:Ee,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ct(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),Ir.hasOwnProperty(e)?{space:Ir[e],local:t}:t}function Ja(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Ee&&e.documentElement.namespaceURI===Ee?e.createElement(t):e.createElementNS(r,t)}}function ts(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ce(t){var e=ct(t);return(e.local?ts:Ja)(e)}function es(){}function bt(t){return t==null?es:function(){return this.querySelector(t)}}function In(t){typeof t!="function"&&(t=bt(t));for(var e=this._groups,r=e.length,n=new Array(r),o=0;o<r;++o)for(var i=e[o],a=i.length,s=n[o]=new Array(a),l,u,c=0;c<a;++c)(l=i[c])&&(u=t.call(l,l.__data__,c,i))&&("__data__"in l&&(u.__data__=l.__data__),s[c]=u);return new P(n,this._parents)}function Lr(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function rs(){return[]}function Qt(t){return t==null?rs:function(){return this.querySelectorAll(t)}}function ns(t){return function(){return Lr(t.apply(this,arguments))}}function Ln(t){typeof t=="function"?t=ns(t):t=Qt(t);for(var e=this._groups,r=e.length,n=[],o=[],i=0;i<r;++i)for(var a=e[i],s=a.length,l,u=0;u<s;++u)(l=a[u])&&(n.push(t.call(l,l.__data__,u,a)),o.push(l));return new P(n,o)}function Jt(t){return function(){return this.matches(t)}}function Ne(t){return function(e){return e.matches(t)}}var os=Array.prototype.find;function is(t){return function(){return os.call(this.children,t)}}function as(){return this.firstElementChild}function Pn(t){return this.select(t==null?as:is(typeof t=="function"?t:Ne(t)))}var ss=Array.prototype.filter;function us(){return Array.from(this.children)}function ls(t){return function(){return ss.call(this.children,t)}}function zn(t){return this.selectAll(t==null?us:ls(typeof t=="function"?t:Ne(t)))}function Hn(t){typeof t!="function"&&(t=Jt(t));for(var e=this._groups,r=e.length,n=new Array(r),o=0;o<r;++o)for(var i=e[o],a=i.length,s=n[o]=[],l,u=0;u<a;++u)(l=i[u])&&t.call(l,l.__data__,u,i)&&s.push(l);return new P(n,this._parents)}function Re(t){return new Array(t.length)}function $n(){return new P(this._enter||this._groups.map(Re),this._parents)}function te(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}te.prototype={constructor:te,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Bn(t){return function(){return t}}function cs(t,e,r,n,o,i){for(var a=0,s,l=e.length,u=i.length;a<u;++a)(s=e[a])?(s.__data__=i[a],n[a]=s):r[a]=new te(t,i[a]);for(;a<l;++a)(s=e[a])&&(o[a]=s)}function fs(t,e,r,n,o,i,a){var s,l,u=new Map,c=e.length,f=i.length,p=new Array(c),h;for(s=0;s<c;++s)(l=e[s])&&(p[s]=h=a.call(l,l.__data__,s,e)+"",u.has(h)?o[s]=l:u.set(h,l));for(s=0;s<f;++s)h=a.call(t,i[s],s,i)+"",(l=u.get(h))?(n[s]=l,l.__data__=i[s],u.delete(h)):r[s]=new te(t,i[s]);for(s=0;s<c;++s)(l=e[s])&&u.get(p[s])===l&&(o[s]=l)}function ps(t){return t.__data__}function Vn(t,e){if(!arguments.length)return Array.from(this,ps);var r=e?fs:cs,n=this._parents,o=this._groups;typeof t!="function"&&(t=Bn(t));for(var i=o.length,a=new Array(i),s=new Array(i),l=new Array(i),u=0;u<i;++u){var c=n[u],f=o[u],p=f.length,h=hs(t.call(c,c&&c.__data__,u,n)),m=h.length,g=s[u]=new Array(m),x=a[u]=new Array(m),b=l[u]=new Array(p);r(c,f,g,x,b,h,e);for(var D=0,k=0,S,d;D<m;++D)if(S=g[D]){for(D>=k&&(k=D+1);!(d=x[k])&&++k<m;);S._next=d||null}}return a=new P(a,n),a._enter=s,a._exit=l,a}function hs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Yn(){return new P(this._exit||this._groups.map(Re),this._parents)}function Un(t,e,r){var n=this.enter(),o=this,i=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),r==null?i.remove():r(i),n&&o?n.merge(o).order():o}function qn(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,o=r.length,i=n.length,a=Math.min(o,i),s=new Array(o),l=0;l<a;++l)for(var u=r[l],c=n[l],f=u.length,p=s[l]=new Array(f),h,m=0;m<f;++m)(h=u[m]||c[m])&&(p[m]=h);for(;l<o;++l)s[l]=r[l];return new P(s,this._parents)}function Wn(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n=t[e],o=n.length-1,i=n[o],a;--o>=0;)(a=n[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Xn(t){t||(t=ms);function e(f,p){return f&&p?t(f.__data__,p.__data__):!f-!p}for(var r=this._groups,n=r.length,o=new Array(n),i=0;i<n;++i){for(var a=r[i],s=a.length,l=o[i]=new Array(s),u,c=0;c<s;++c)(u=a[c])&&(l[c]=u);l.sort(e)}return new P(o,this._parents).order()}function ms(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function jn(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Gn(){return Array.from(this)}function Kn(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],o=0,i=n.length;o<i;++o){var a=n[o];if(a)return a}return null}function Zn(){let t=0;for(let e of this)++t;return t}function Qn(){return!this.node()}function Jn(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var o=e[r],i=0,a=o.length,s;i<a;++i)(s=o[i])&&t.call(s,s.__data__,i,o);return this}function ds(t){return function(){this.removeAttribute(t)}}function gs(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ys(t,e){return function(){this.setAttribute(t,e)}}function xs(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function vs(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function ws(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function to(t,e){var r=ct(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((e==null?r.local?gs:ds:typeof e=="function"?r.local?ws:vs:r.local?xs:ys)(r,e))}function Fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function _s(t){return function(){this.style.removeProperty(t)}}function bs(t,e,r){return function(){this.style.setProperty(t,e,r)}}function Ds(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function eo(t,e,r){return arguments.length>1?this.each((e==null?_s:typeof e=="function"?Ds:bs)(t,e,r??"")):ht(this.node(),t)}function ht(t,e){return t.style.getPropertyValue(e)||Fe(t).getComputedStyle(t,null).getPropertyValue(e)}function ks(t){return function(){delete this[t]}}function Ss(t,e){return function(){this[t]=e}}function As(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function ro(t,e){return arguments.length>1?this.each((e==null?ks:typeof e=="function"?As:Ss)(t,e)):this.node()[t]}function no(t){return t.trim().split(/^|\s+/)}function Pr(t){return t.classList||new oo(t)}function oo(t){this._node=t,this._names=no(t.getAttribute("class")||"")}oo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function io(t,e){for(var r=Pr(t),n=-1,o=e.length;++n<o;)r.add(e[n])}function ao(t,e){for(var r=Pr(t),n=-1,o=e.length;++n<o;)r.remove(e[n])}function Ts(t){return function(){io(this,t)}}function Ms(t){return function(){ao(this,t)}}function Es(t,e){return function(){(e.apply(this,arguments)?io:ao)(this,t)}}function so(t,e){var r=no(t+"");if(arguments.length<2){for(var n=Pr(this.node()),o=-1,i=r.length;++o<i;)if(!n.contains(r[o]))return!1;return!0}return this.each((typeof e=="function"?Es:e?Ts:Ms)(r,e))}function Cs(){this.textContent=""}function Ns(t){return function(){this.textContent=t}}function Rs(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function uo(t){return arguments.length?this.each(t==null?Cs:(typeof t=="function"?Rs:Ns)(t)):this.node().textContent}function Fs(){this.innerHTML=""}function Os(t){return function(){this.innerHTML=t}}function Is(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function lo(t){return arguments.length?this.each(t==null?Fs:(typeof t=="function"?Is:Os)(t)):this.node().innerHTML}function Ls(){this.nextSibling&&this.parentNode.appendChild(this)}function co(){return this.each(Ls)}function Ps(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function fo(){return this.each(Ps)}function po(t){var e=typeof t=="function"?t:Ce(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function zs(){return null}function ho(t,e){var r=typeof t=="function"?t:Ce(t),n=e==null?zs:typeof e=="function"?e:bt(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function Hs(){var t=this.parentNode;t&&t.removeChild(this)}function mo(){return this.each(Hs)}function $s(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Bs(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function go(t){return this.select(t?Bs:$s)}function yo(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Vs(t){return function(e){t.call(this,e,this.__data__)}}function Ys(t){return t.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");return n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function Us(t){return function(){var e=this.__on;if(e){for(var r=0,n=-1,o=e.length,i;r<o;++r)i=e[r],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++n]=i;++n?e.length=n:delete this.__on}}}function qs(t,e,r){return function(){var n=this.__on,o,i=Vs(e);if(n){for(var a=0,s=n.length;a<s;++a)if((o=n[a]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=r),o.value=e;return}}this.addEventListener(t.type,i,r),o={type:t.type,name:t.name,value:e,listener:i,options:r},n?n.push(o):this.__on=[o]}}function xo(t,e,r){var n=Ys(t+""),o,i=n.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,u=s.length,c;l<u;++l)for(o=0,c=s[l];o<i;++o)if((a=n[o]).type===c.type&&a.name===c.name)return c.value}return}for(s=e?qs:Us,o=0;o<i;++o)this.each(s(n[o],e,r));return this}function vo(t,e,r){var n=Fe(t),o=n.CustomEvent;typeof o=="function"?o=new o(e,r):(o=n.document.createEvent("Event"),r?(o.initEvent(e,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Ws(t,e){return function(){return vo(this,t,e)}}function Xs(t,e){return function(){return vo(this,t,e.apply(this,arguments))}}function wo(t,e){return this.each((typeof e=="function"?Xs:Ws)(t,e))}function*_o(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],o=0,i=n.length,a;o<i;++o)(a=n[o])&&(yield a)}var zr=[null];function P(t,e){this._groups=t,this._parents=e}function bo(){return new P([[document.documentElement]],zr)}function js(){return this}P.prototype=bo.prototype={constructor:P,select:In,selectAll:Ln,selectChild:Pn,selectChildren:zn,filter:Hn,data:Vn,enter:$n,exit:Yn,join:Un,merge:qn,selection:js,order:Wn,sort:Xn,call:jn,nodes:Gn,node:Kn,size:Zn,empty:Qn,each:Jn,attr:to,style:eo,property:ro,classed:so,text:uo,html:lo,raise:co,lower:fo,append:po,insert:ho,remove:mo,clone:go,datum:yo,on:xo,dispatch:wo,[Symbol.iterator]:_o};var ft=bo;function j(t){return typeof t=="string"?new P([[document.querySelector(t)]],[document.documentElement]):new P([[t]],zr)}function Oe(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Hr(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function ne(){}var ee=.7,Pe=1/ee,Pt="\\s*([+-]?\\d+)\\s*",re="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gs=/^#([0-9a-f]{3,8})$/,Ks=new RegExp(`^rgb\\(${Pt},${Pt},${Pt}\\)$`),Zs=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),Qs=new RegExp(`^rgba\\(${Pt},${Pt},${Pt},${re}\\)$`),Js=new RegExp(`^rgba\\(${at},${at},${at},${re}\\)$`),tu=new RegExp(`^hsl\\(${re},${at},${at}\\)$`),eu=new RegExp(`^hsla\\(${re},${at},${at},${re}\\)$`),Do={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};Oe(ne,rt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ko,formatHex:ko,formatHex8:ru,formatHsl:nu,formatRgb:So,toString:So});function ko(){return this.rgb().formatHex()}function ru(){return this.rgb().formatHex8()}function nu(){return No(this).formatHsl()}function So(){return this.rgb().formatRgb()}function rt(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Gs.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?Ao(e):r===3?new Z(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Ie(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Ie(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ks.exec(t))?new Z(e[1],e[2],e[3],1):(e=Zs.exec(t))?new Z(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Qs.exec(t))?Ie(e[1],e[2],e[3],e[4]):(e=Js.exec(t))?Ie(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=tu.exec(t))?Eo(e[1],e[2]/100,e[3]/100,1):(e=eu.exec(t))?Eo(e[1],e[2]/100,e[3]/100,e[4]):Do.hasOwnProperty(t)?Ao(Do[t]):t==="transparent"?new Z(NaN,NaN,NaN,0):null}function Ao(t){return new Z(t>>16&255,t>>8&255,t&255,1)}function Ie(t,e,r,n){return n<=0&&(t=e=r=NaN),new Z(t,e,r,n)}function ou(t){return t instanceof ne||(t=rt(t)),t?(t=t.rgb(),new Z(t.r,t.g,t.b,t.opacity)):new Z}function zt(t,e,r,n){return arguments.length===1?ou(t):new Z(t,e,r,n??1)}function Z(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Oe(Z,zt,Hr(ne,{brighter(t){return t=t==null?Pe:Math.pow(Pe,t),new Z(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ee:Math.pow(ee,t),new Z(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Z(kt(this.r),kt(this.g),kt(this.b),ze(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:To,formatHex:To,formatHex8:iu,formatRgb:Mo,toString:Mo}));function To(){return`#${Dt(this.r)}${Dt(this.g)}${Dt(this.b)}`}function iu(){return`#${Dt(this.r)}${Dt(this.g)}${Dt(this.b)}${Dt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mo(){let t=ze(this.opacity);return`${t===1?"rgb(":"rgba("}${kt(this.r)}, ${kt(this.g)}, ${kt(this.b)}${t===1?")":`, ${t})`}`}function ze(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function kt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Dt(t){return t=kt(t),(t<16?"0":"")+t.toString(16)}function Eo(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new et(t,e,r,n)}function No(t){if(t instanceof et)return new et(t.h,t.s,t.l,t.opacity);if(t instanceof ne||(t=rt(t)),!t)return new et;if(t instanceof et)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,s=i-o,l=(i+o)/2;return s?(e===i?a=(r-n)/s+(r<n)*6:r===i?a=(n-e)/s+2:a=(e-r)/s+4,s/=l<.5?i+o:2-i-o,a*=60):s=l>0&&l<1?0:a,new et(a,s,l,t.opacity)}function oe(t,e,r,n){return arguments.length===1?No(t):new et(t,e,r,n??1)}function et(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Oe(et,oe,Hr(ne,{brighter(t){return t=t==null?Pe:Math.pow(Pe,t),new et(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ee:Math.pow(ee,t),new et(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,o=2*r-n;return new Z($r(t>=240?t-240:t+120,o,n),$r(t,o,n),$r(t<120?t+240:t-120,o,n),this.opacity)},clamp(){return new et(Co(this.h),Le(this.s),Le(this.l),ze(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(){let t=ze(this.opacity);return`${t===1?"hsl(":"hsla("}${Co(this.h)}, ${Le(this.s)*100}%, ${Le(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Co(t){return t=(t||0)%360,t<0?t+360:t}function Le(t){return Math.max(0,Math.min(1,t||0))}function $r(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function Br(t,e,r,n,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*r+(1+3*t+3*i-3*a)*n+a*o)/6}function Ro(t){var e=t.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,e-1):Math.floor(r*e),o=t[n],i=t[n+1],a=n>0?t[n-1]:2*o-i,s=n<e-1?t[n+2]:2*i-o;return Br((r-n/e)*e,a,o,i,s)}}function Fo(t){var e=t.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*e),o=t[(n+e-1)%e],i=t[n%e],a=t[(n+1)%e],s=t[(n+2)%e];return Br((r-n/e)*e,o,i,a,s)}}var ie=t=>()=>t;function au(t,e){return function(r){return t+r*e}}function su(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function Oo(t){return(t=+t)==1?He:function(e,r){return r-e?su(e,r,t):ie(isNaN(e)?r:e)}}function He(t,e){var r=e-t;return r?au(t,r):ie(isNaN(t)?e:t)}var St=function t(e){var r=Oo(e);function n(o,i){var a=r((o=zt(o)).r,(i=zt(i)).r),s=r(o.g,i.g),l=r(o.b,i.b),u=He(o.opacity,i.opacity);return function(c){return o.r=a(c),o.g=s(c),o.b=l(c),o.opacity=u(c),o+""}}return n.gamma=t,n}(1);function Io(t){return function(e){var r=e.length,n=new Array(r),o=new Array(r),i=new Array(r),a,s;for(a=0;a<r;++a)s=zt(e[a]),n[a]=s.r||0,o[a]=s.g||0,i[a]=s.b||0;return n=t(n),o=t(o),i=t(i),s.opacity=1,function(l){return s.r=n(l),s.g=o(l),s.b=i(l),s+""}}}var uu=Io(Ro),lu=Io(Fo);function Lo(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),o;return function(i){for(o=0;o<r;++o)n[o]=t[o]*(1-i)+e[o]*i;return n}}function Po(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function zo(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,o=new Array(n),i=new Array(r),a;for(a=0;a<n;++a)o[a]=st(t[a],e[a]);for(;a<r;++a)i[a]=e[a];return function(s){for(a=0;a<n;++a)i[a]=o[a](s);return i}}function Ho(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function q(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function $o(t,e){var r={},n={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?r[o]=st(t[o],e[o]):n[o]=e[o];return function(i){for(o in r)n[o]=r[o](i);return n}}var Yr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Vr=new RegExp(Yr.source,"g");function cu(t){return function(){return t}}function fu(t){return function(e){return t(e)+""}}function ae(t,e){var r=Yr.lastIndex=Vr.lastIndex=0,n,o,i,a=-1,s=[],l=[];for(t=t+"",e=e+"";(n=Yr.exec(t))&&(o=Vr.exec(e));)(i=o.index)>r&&(i=e.slice(r,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,l.push({i:a,x:q(n,o)})),r=Vr.lastIndex;return r<e.length&&(i=e.slice(r),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?fu(l[0].x):cu(e):(e=l.length,function(u){for(var c=0,f;c<e;++c)s[(f=l[c]).i]=f.x(u);return s.join("")})}function st(t,e){var r=typeof e,n;return e==null||r==="boolean"?ie(e):(r==="number"?q:r==="string"?(n=rt(e))?(e=n,St):ae:e instanceof rt?St:e instanceof Date?Ho:Po(e)?Lo:Array.isArray(e)?zo:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?$o:q)(t,e)}function $e(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var Bo=180/Math.PI,Be={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ur(t,e,r,n,o,i){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,l/=s),t*n<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Bo,skewX:Math.atan(l)*Bo,scaleX:a,scaleY:s}}var Ve;function Vo(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Be:Ur(e.a,e.b,e.c,e.d,e.e,e.f)}function Yo(t){return t==null?Be:(Ve||(Ve=document.createElementNS("http://www.w3.org/2000/svg","g")),Ve.setAttribute("transform",t),(t=Ve.transform.baseVal.consolidate())?(t=t.matrix,Ur(t.a,t.b,t.c,t.d,t.e,t.f)):Be)}function Uo(t,e,r,n){function o(u){return u.length?u.pop()+" ":""}function i(u,c,f,p,h,m){if(u!==f||c!==p){var g=h.push("translate(",null,e,null,r);m.push({i:g-4,x:q(u,f)},{i:g-2,x:q(c,p)})}else(f||p)&&h.push("translate("+f+e+p+r)}function a(u,c,f,p){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),p.push({i:f.push(o(f)+"rotate(",null,n)-2,x:q(u,c)})):c&&f.push(o(f)+"rotate("+c+n)}function s(u,c,f,p){u!==c?p.push({i:f.push(o(f)+"skewX(",null,n)-2,x:q(u,c)}):c&&f.push(o(f)+"skewX("+c+n)}function l(u,c,f,p,h,m){if(u!==f||c!==p){var g=h.push(o(h)+"scale(",null,",",null,")");m.push({i:g-4,x:q(u,f)},{i:g-2,x:q(c,p)})}else(f!==1||p!==1)&&h.push(o(h)+"scale("+f+","+p+")")}return function(u,c){var f=[],p=[];return u=t(u),c=t(c),i(u.translateX,u.translateY,c.translateX,c.translateY,f,p),a(u.rotate,c.rotate,f,p),s(u.skewX,c.skewX,f,p),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,f,p),u=c=null,function(h){for(var m=-1,g=p.length,x;++m<g;)f[(x=p[m]).i]=x.x(h);return f.join("")}}}var qr=Uo(Vo,"px, ","px)","deg)"),Wr=Uo(Yo,", ",")",")");var Ht=0,ue=0,se=0,Wo=1e3,Ye,le,Ue=0,At=0,qe=0,ce=typeof performance=="object"&&performance.now?performance:Date,Xo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Mt(){return At||(Xo(pu),At=ce.now()+qe)}function pu(){At=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=We.prototype={constructor:Tt,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?Mt():+r)+(e==null?0:+e),!this._next&&le!==this&&(le?le._next=this:Ye=this,le=this),this._call=t,this._time=r,Xr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xr())}};function We(t,e,r){var n=new Tt;return n.restart(t,e,r),n}function jo(){Mt(),++Ht;for(var t=Ye,e;t;)(e=At-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ht}function qo(){At=(Ue=ce.now())+qe,Ht=ue=0;try{jo()}finally{Ht=0,mu(),At=0}}function hu(){var t=ce.now(),e=t-Ue;e>Wo&&(qe-=e,Ue=t)}function mu(){for(var t,e=Ye,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Ye=r);le=t,Xr(n)}function Xr(t){if(!Ht){ue&&(ue=clearTimeout(ue));var e=t-At;e>24?(t<1/0&&(ue=setTimeout(qo,t-ce.now()-qe)),se&&(se=clearInterval(se))):(se||(Ue=ce.now(),se=setInterval(hu,Wo)),Ht=1,Xo(qo))}}function Xe(t,e,r){var n=new Tt;return e=e==null?0:+e,n.restart(o=>{n.stop(),t(o+e)},e,r),n}function je(t,e,r){var n=new Tt,o=e;return e==null?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(i,a,s){a=+a,s=s==null?Mt():+s,n._restart(function l(u){u+=o,n._restart(l,o+=a,s),i(u)},a,s)},n.restart(t,e,r),n)}var du=Or("start","end","cancel","interrupt"),gu=[],Zo=0,Go=1,Ke=2,Ge=3,Ko=4,Ze=5,fe=6;function mt(t,e,r,n,o,i){var a=t.__transition;if(!a)t.__transition={};else if(r in a)return;yu(t,r,{name:e,index:n,group:o,on:du,tween:gu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zo})}function pe(t,e){var r=V(t,e);if(r.state>Zo)throw new Error("too late; already scheduled");return r}function W(t,e){var r=V(t,e);if(r.state>Ge)throw new Error("too late; already running");return r}function V(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function yu(t,e,r){var n=t.__transition,o;n[e]=r,r.timer=We(i,0,r.time);function i(u){r.state=Go,r.timer.restart(a,r.delay,r.time),r.delay<=u&&a(u-r.delay)}function a(u){var c,f,p,h;if(r.state!==Go)return l();for(c in n)if(h=n[c],h.name===r.name){if(h.state===Ge)return Xe(a);h.state===Ko?(h.state=fe,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete n[c]):+c<e&&(h.state=fe,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete n[c])}if(Xe(function(){r.state===Ge&&(r.state=Ko,r.timer.restart(s,r.delay,r.time),s(u))}),r.state=Ke,r.on.call("start",t,t.__data__,r.index,r.group),r.state===Ke){for(r.state=Ge,o=new Array(p=r.tween.length),c=0,f=-1;c<p;++c)(h=r.tween[c].value.call(t,t.__data__,r.index,r.group))&&(o[++f]=h);o.length=f+1}}function s(u){for(var c=u<r.duration?r.ease.call(null,u/r.duration):(r.timer.restart(l),r.state=Ze,1),f=-1,p=o.length;++f<p;)o[f].call(t,c);r.state===Ze&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=fe,r.timer.stop(),delete n[e];for(var u in n)return;delete t.__transition}}function Qe(t,e){var r=t.__transition,n,o,i=!0,a;if(r){e=e==null?null:e+"";for(a in r){if((n=r[a]).name!==e){i=!1;continue}o=n.state>Ke&&n.state<Ze,n.state=fe,n.timer.stop(),n.on.call(o?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[a]}i&&delete t.__transition}}function Qo(t){return this.each(function(){Qe(this,t)})}function xu(t,e){var r,n;return function(){var o=W(this,t),i=o.tween;if(i!==r){n=r=i;for(var a=0,s=n.length;a<s;++a)if(n[a].name===e){n=n.slice(),n.splice(a,1);break}}o.tween=n}}function vu(t,e,r){var n,o;if(typeof r!="function")throw new Error;return function(){var i=W(this,t),a=i.tween;if(a!==n){o=(n=a).slice();for(var s={name:e,value:r},l=0,u=o.length;l<u;++l)if(o[l].name===e){o[l]=s;break}l===u&&o.push(s)}i.tween=o}}function Jo(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=V(this.node(),r).tween,o=0,i=n.length,a;o<i;++o)if((a=n[o]).name===t)return a.value;return null}return this.each((e==null?xu:vu)(r,t,e))}function $t(t,e,r){var n=t._id;return t.each(function(){var o=W(this,n);(o.value||(o.value={}))[e]=r.apply(this,arguments)}),function(o){return V(o,n).value[e]}}function Je(t,e){var r;return(typeof e=="number"?q:e instanceof rt?St:(r=rt(e))?(e=r,St):ae)(t,e)}function wu(t){return function(){this.removeAttribute(t)}}function _u(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bu(t,e,r){var n,o=r+"",i;return function(){var a=this.getAttribute(t);return a===o?null:a===n?i:i=e(n=a,r)}}function Du(t,e,r){var n,o=r+"",i;return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===n?i:i=e(n=a,r)}}function ku(t,e,r){var n,o,i;return function(){var a,s=r(this),l;return s==null?void this.removeAttribute(t):(a=this.getAttribute(t),l=s+"",a===l?null:a===n&&l===o?i:(o=l,i=e(n=a,s)))}}function Su(t,e,r){var n,o,i;return function(){var a,s=r(this),l;return s==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),l=s+"",a===l?null:a===n&&l===o?i:(o=l,i=e(n=a,s)))}}function ti(t,e){var r=ct(t),n=r==="transform"?Wr:Je;return this.attrTween(t,typeof e=="function"?(r.local?Su:ku)(r,n,$t(this,"attr."+t,e)):e==null?(r.local?_u:wu)(r):(r.local?Du:bu)(r,n,e))}function Au(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function Tu(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function Mu(t,e){var r,n;function o(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&Tu(t,i)),r}return o._value=e,o}function Eu(t,e){var r,n;function o(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&Au(t,i)),r}return o._value=e,o}function ei(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;var n=ct(t);return this.tween(r,(n.local?Mu:Eu)(n,e))}function Cu(t,e){return function(){pe(this,t).delay=+e.apply(this,arguments)}}function Nu(t,e){return e=+e,function(){pe(this,t).delay=e}}function ri(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Cu:Nu)(e,t)):V(this.node(),e).delay}function Ru(t,e){return function(){W(this,t).duration=+e.apply(this,arguments)}}function Fu(t,e){return e=+e,function(){W(this,t).duration=e}}function ni(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Ru:Fu)(e,t)):V(this.node(),e).duration}function Ou(t,e){if(typeof e!="function")throw new Error;return function(){W(this,t).ease=e}}function oi(t){var e=this._id;return arguments.length?this.each(Ou(e,t)):V(this.node(),e).ease}function Iu(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;W(this,t).ease=r}}function ii(t){if(typeof t!="function")throw new Error;return this.each(Iu(this._id,t))}function ai(t){typeof t!="function"&&(t=Jt(t));for(var e=this._groups,r=e.length,n=new Array(r),o=0;o<r;++o)for(var i=e[o],a=i.length,s=n[o]=[],l,u=0;u<a;++u)(l=i[u])&&t.call(l,l.__data__,u,i)&&s.push(l);return new K(n,this._parents,this._name,this._id)}function si(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,o=r.length,i=Math.min(n,o),a=new Array(n),s=0;s<i;++s)for(var l=e[s],u=r[s],c=l.length,f=a[s]=new Array(c),p,h=0;h<c;++h)(p=l[h]||u[h])&&(f[h]=p);for(;s<n;++s)a[s]=e[s];return new K(a,this._parents,this._name,this._id)}function Lu(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function Pu(t,e,r){var n,o,i=Lu(e)?pe:W;return function(){var a=i(this,t),s=a.on;s!==n&&(o=(n=s).copy()).on(e,r),a.on=o}}function ui(t,e){var r=this._id;return arguments.length<2?V(this.node(),r).on.on(t):this.each(Pu(r,t,e))}function zu(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function li(){return this.on("end.remove",zu(this._id))}function ci(t){var e=this._name,r=this._id;typeof t!="function"&&(t=bt(t));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var s=n[a],l=s.length,u=i[a]=new Array(l),c,f,p=0;p<l;++p)(c=s[p])&&(f=t.call(c,c.__data__,p,s))&&("__data__"in c&&(f.__data__=c.__data__),u[p]=f,mt(u[p],e,r,p,u,V(c,r)));return new K(i,this._parents,e,r)}function fi(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Qt(t));for(var n=this._groups,o=n.length,i=[],a=[],s=0;s<o;++s)for(var l=n[s],u=l.length,c,f=0;f<u;++f)if(c=l[f]){for(var p=t.call(c,c.__data__,f,l),h,m=V(c,r),g=0,x=p.length;g<x;++g)(h=p[g])&&mt(h,e,r,g,p,m);i.push(p),a.push(c)}return new K(i,a,e,r)}var Hu=ft.prototype.constructor;function pi(){return new Hu(this._groups,this._parents)}function $u(t,e){var r,n,o;return function(){var i=ht(this,t),a=(this.style.removeProperty(t),ht(this,t));return i===a?null:i===r&&a===n?o:o=e(r=i,n=a)}}function hi(t){return function(){this.style.removeProperty(t)}}function Bu(t,e,r){var n,o=r+"",i;return function(){var a=ht(this,t);return a===o?null:a===n?i:i=e(n=a,r)}}function Vu(t,e,r){var n,o,i;return function(){var a=ht(this,t),s=r(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(t),ht(this,t))),a===l?null:a===n&&l===o?i:(o=l,i=e(n=a,s))}}function Yu(t,e){var r,n,o,i="style."+e,a="end."+i,s;return function(){var l=W(this,t),u=l.on,c=l.value[i]==null?s||(s=hi(e)):void 0;(u!==r||o!==c)&&(n=(r=u).copy()).on(a,o=c),l.on=n}}function mi(t,e,r){var n=(t+="")=="transform"?qr:Je;return e==null?this.styleTween(t,$u(t,n)).on("end.style."+t,hi(t)):typeof e=="function"?this.styleTween(t,Vu(t,n,$t(this,"style."+t,e))).each(Yu(this._id,t)):this.styleTween(t,Bu(t,n,e),r).on("end.style."+t,null)}function Uu(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function qu(t,e,r){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&Uu(t,a,r)),n}return i._value=e,i}function di(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,qu(t,e,r??""))}function Wu(t){return function(){this.textContent=t}}function Xu(t){return function(){var e=t(this);this.textContent=e??""}}function gi(t){return this.tween("text",typeof t=="function"?Xu($t(this,"text",t)):Wu(t==null?"":t+""))}function ju(t){return function(e){this.textContent=t.call(this,e)}}function Gu(t){var e,r;function n(){var o=t.apply(this,arguments);return o!==r&&(e=(r=o)&&ju(o)),e}return n._value=t,n}function yi(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Gu(t))}function xi(){for(var t=this._name,e=this._id,r=tr(),n=this._groups,o=n.length,i=0;i<o;++i)for(var a=n[i],s=a.length,l,u=0;u<s;++u)if(l=a[u]){var c=V(l,e);mt(l,t,r,u,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new K(n,this._parents,t,r)}function vi(){var t,e,r=this,n=r._id,o=r.size();return new Promise(function(i,a){var s={value:a},l={value:function(){--o===0&&i()}};r.each(function(){var u=W(this,n),c=u.on;c!==t&&(e=(t=c).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),u.on=e}),o===0&&i()})}var Ku=0;function K(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function wi(t){return ft().transition(t)}function tr(){return++Ku}var pt=ft.prototype;K.prototype=wi.prototype={constructor:K,select:ci,selectAll:fi,selectChild:pt.selectChild,selectChildren:pt.selectChildren,filter:ai,merge:si,selection:pi,transition:xi,call:pt.call,nodes:pt.nodes,node:pt.node,size:pt.size,empty:pt.empty,each:pt.each,on:ui,attr:ti,attrTween:ei,style:mi,styleTween:di,text:gi,textTween:yi,remove:li,tween:Jo,delay:ri,duration:ni,ease:oi,easeVarying:ii,end:vi,[Symbol.iterator]:pt[Symbol.iterator]};var X=t=>+t;function er(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Zu={time:null,delay:0,duration:250,ease:er};function Qu(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}function _i(t){var e,r;t instanceof K?(e=t._id,t=t._name):(e=tr(),(r=Zu).time=Mt(),t=t==null?null:t+"");for(var n=this._groups,o=n.length,i=0;i<o;++i)for(var a=n[i],s=a.length,l,u=0;u<s;++u)(l=a[u])&&mt(l,t,e,u,a,r||Qu(l,e));return new K(n,this._parents,t,e)}ft.prototype.interrupt=Qo;ft.prototype.transition=_i;var{abs:ig,max:ag,min:sg}=Math;function bi(t){return[+t[0],+t[1]]}function Ju(t){return[bi(t[0]),bi(t[1])]}var ug={name:"x",handles:["w","e"].map(jr),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},lg={name:"y",handles:["n","s"].map(jr),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},cg={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(jr),input:function(t){return t==null?null:Ju(t)},output:function(t){return t}};function jr(t){return{type:t}}var Di={},Gr={},Kr=34,he=10,Zr=13;function Si(t){return new Function("d","return {"+t.map(function(e,r){return JSON.stringify(e)+": d["+r+'] || ""'}).join(",")+"}")}function tl(t,e){var r=Si(t);return function(n,o){return e(r(n),o,t)}}function ki(t){var e=Object.create(null),r=[];return t.forEach(function(n){for(var o in n)o in e||r.push(e[o]=o)}),r}function Q(t,e){var r=t+"",n=r.length;return n<e?new Array(e-n+1).join(0)+r:r}function el(t){return t<0?"-"+Q(-t,6):t>9999?"+"+Q(t,6):Q(t,4)}function rl(t){var e=t.getUTCHours(),r=t.getUTCMinutes(),n=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":el(t.getUTCFullYear(),4)+"-"+Q(t.getUTCMonth()+1,2)+"-"+Q(t.getUTCDate(),2)+(o?"T"+Q(e,2)+":"+Q(r,2)+":"+Q(n,2)+"."+Q(o,3)+"Z":n?"T"+Q(e,2)+":"+Q(r,2)+":"+Q(n,2)+"Z":r||e?"T"+Q(e,2)+":"+Q(r,2)+"Z":"")}function me(t){var e=new RegExp('["'+t+` \r]`),r=t.charCodeAt(0);function n(f,p){var h,m,g=o(f,function(x,b){if(h)return h(x,b-1);m=x,h=p?tl(x,p):Si(x)});return g.columns=m||[],g}function o(f,