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