import{p as Ke,d as Ze,t as Cn,Q as Ge,H as Qe,c as Je,o as je,b as tr,k as nr,n as er,s as rr}from"./index-bVOhw2NF.js";import{c as ir}from"./cloneDeep-C6NKQlMO.js";import"./_initCloneObject-K-Y0ueWp.js";import"./_getTag-BJ2nhJXz.js";function Rn(t,n){let e;if(n===void 0)for(const r of t)r!=null&&(e=r)&&(e=r);else{let r=-1;for(let i of t)(i=n(i,++r,t))!=null&&(e=i)&&(e=i)}return e}function ue(t,n){let e;if(n===void 0)for(const r of t)r!=null&&(e>r||e===void 0&&r>=r)&&(e=r);else{let r=-1;for(let i of t)(i=n(i,++r,t))!=null&&(e>i||e===void 0&&i>=i)&&(e=i)}return e}function Gt(t,n){let e=0;if(n===void 0)for(let r of t)(r=+r)&&(e+=r);else{let r=-1;for(let i of t)(i=+n(i,++r,t))&&(e+=i)}return e}class In extends Map{constructor(n,e=le){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),n!=null)for(const[r,i]of n)this.set(r,i)}get(n){return super.get(tn(this,n))}has(n){return super.has(tn(this,n))}set(n,e){return super.set(fe(this,n),e)}delete(n){return super.delete(ce(this,n))}}class or extends Set{constructor(n,e=le){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),n!=null)for(const r of n)this.add(r)}has(n){return super.has(tn(this,n))}add(n){return super.add(fe(this,n))}delete(n){return super.delete(ce(this,n))}}function tn({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function fe({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function ce({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function le(t){return t!==null&&typeof t=="object"?t.valueOf():t}function q(t,n){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");if(typeof n!="function")throw new TypeError("mapper is not a function");return Array.from(t,(e,r)=>n(e,r,t))}function sr(...t){const n=new or;for(const e of t)for(const r of e)n.add(r);return n}var ar={value:()=>{}};function he(){for(var t=0,n=arguments.length,e={},r;t=0&&(r=e.slice(i+1),e=e.slice(0,i)),e&&!n.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}Ht.prototype=he.prototype={constructor:Ht,on:function(t,n){var e=this._,r=ur(t+"",e),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var e=new Array(i),r=0,i,o;r=0&&(n=t.slice(0,e))!=="xmlns"&&(t=t.slice(e+1)),zn.hasOwnProperty(n)?{space:zn[n],local:t}:t}function cr(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===nn&&n.documentElement.namespaceURI===nn?n.createElement(t):n.createElementNS(e,t)}}function lr(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function dn(t){var n=Ut(t);return(n.local?lr:cr)(n)}function hr(){}function pn(t){return t==null?hr:function(){return this.querySelector(t)}}function dr(t){typeof t!="function"&&(t=pn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i=M&&(M=T+1);!(E=N[M])&&++M<_;);I._next=E||null}}return s=new H(s,r),s._enter=a,s._exit=u,s}function Rr(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Ir(){return new H(this._exit||this._groups.map(ye),this._parents)}function Hr(t,n,e){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),n!=null&&(i=n(i),i&&(i=i.selection())),e==null?o.remove():e(o),r&&i?r.merge(i).order():i}function zr(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,s=Math.min(i,o),a=new Array(i),u=0;u=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Pr(t){t||(t=Or);function n(h,y){return h&&y?t(h.__data__,y.__data__):!h-!y}for(var e=this._groups,r=e.length,i=new Array(r),o=0;on?1:t>=n?0:NaN}function Dr(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function qr(){return Array.from(this)}function Br(){for(var t=this._groups,n=0,e=t.length;n1?this.each((n==null?jr:typeof n=="function"?ni:ti)(t,n,e??"")):ct(this.node(),t)}function ct(t,n){return t.style.getPropertyValue(n)||me(t).getComputedStyle(t,null).getPropertyValue(n)}function ri(t){return function(){delete this[t]}}function ii(t,n){return function(){this[t]=n}}function oi(t,n){return function(){var e=n.apply(this,arguments);e==null?delete this[t]:this[t]=e}}function si(t,n){return arguments.length>1?this.each((n==null?ri:typeof n=="function"?oi:ii)(t,n)):this.node()[t]}function xe(t){return t.trim().split(/^|\s+/)}function gn(t){return t.classList||new _e(t)}function _e(t){this._node=t,this._names=xe(t.getAttribute("class")||"")}_e.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function we(t,n){for(var e=gn(t),r=-1,i=n.length;++r=0&&(e=n.slice(r+1),n=n.slice(0,r)),{type:n,name:e}})}function Ii(t){return function(){var n=this.__on;if(n){for(var e=0,r=-1,i=n.length,o;e>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):e===8?Tt(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):e===4?Tt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Vi.exec(t))?new R(n[1],n[2],n[3],1):(n=Yi.exec(t))?new R(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Ui.exec(t))?Tt(n[1],n[2],n[3],n[4]):(n=Wi.exec(t))?Tt(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Ki.exec(t))?Xn(n[1],n[2]/100,n[3]/100,1):(n=Zi.exec(t))?Xn(n[1],n[2]/100,n[3]/100,n[4]):Fn.hasOwnProperty(t)?Dn(Fn[t]):t==="transparent"?new R(NaN,NaN,NaN,0):null}function Dn(t){return new R(t>>16&255,t>>8&255,t&255,1)}function Tt(t,n,e,r){return r<=0&&(t=n=e=NaN),new R(t,n,e,r)}function Ji(t){return t instanceof At||(t=bt(t)),t?(t=t.rgb(),new R(t.r,t.g,t.b,t.opacity)):new R}function en(t,n,e,r){return arguments.length===1?Ji(t):new R(t,n,e,r??1)}function R(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}yn(R,en,$e(At,{brighter(t){return t=t==null?Ot:Math.pow(Ot,t),new R(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?wt:Math.pow(wt,t),new R(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new R(it(this.r),it(this.g),it(this.b),Dt(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:qn,formatHex:qn,formatHex8:ji,formatRgb:Bn,toString:Bn}));function qn(){return`#${rt(this.r)}${rt(this.g)}${rt(this.b)}`}function ji(){return`#${rt(this.r)}${rt(this.g)}${rt(this.b)}${rt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Bn(){const t=Dt(this.opacity);return`${t===1?"rgb(":"rgba("}${it(this.r)}, ${it(this.g)}, ${it(this.b)}${t===1?")":`, ${t})`}`}function Dt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function it(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function rt(t){return t=it(t),(t<16?"0":"")+t.toString(16)}function Xn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new B(t,n,e,r)}function Ae(t){if(t instanceof B)return new B(t.h,t.s,t.l,t.opacity);if(t instanceof At||(t=bt(t)),!t)return new B;if(t instanceof B)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),s=NaN,a=o-i,u=(o+i)/2;return a?(n===o?s=(e-r)/a+(e0&&u<1?0:s,new B(s,a,u,t.opacity)}function to(t,n,e,r){return arguments.length===1?Ae(t):new B(t,n,e,r??1)}function B(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}yn(B,to,$e(At,{brighter(t){return t=t==null?Ot:Math.pow(Ot,t),new B(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?wt:Math.pow(wt,t),new B(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new R(Qt(t>=240?t-240:t+120,i,r),Qt(t,i,r),Qt(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new B(Vn(this.h),Lt(this.s),Lt(this.l),Dt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Dt(this.opacity);return`${t===1?"hsl(":"hsla("}${Vn(this.h)}, ${Lt(this.s)*100}%, ${Lt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Vn(t){return t=(t||0)%360,t<0?t+360:t}function Lt(t){return Math.max(0,Math.min(1,t||0))}function Qt(t,n,e){return(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)*255}const Se=t=>()=>t;function no(t,n){return function(e){return t+e*n}}function eo(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function ro(t){return(t=+t)==1?Ne:function(n,e){return e-n?eo(n,e,t):Se(isNaN(n)?e:n)}}function Ne(t,n){var e=n-t;return e?no(t,e):Se(isNaN(t)?n:t)}const Yn=function t(n){var e=ro(n);function r(i,o){var s=e((i=en(i)).r,(o=en(o)).r),a=e(i.g,o.g),u=e(i.b,o.b),f=Ne(i.opacity,o.opacity);return function(c){return i.r=s(c),i.g=a(c),i.b=u(c),i.opacity=f(c),i+""}}return r.gamma=t,r}(1);function Z(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var rn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jt=new RegExp(rn.source,"g");function io(t){return function(){return t}}function oo(t){return function(n){return t(n)+""}}function so(t,n){var e=rn.lastIndex=Jt.lastIndex=0,r,i,o,s=-1,a=[],u=[];for(t=t+"",n=n+"";(r=rn.exec(t))&&(i=Jt.exec(n));)(o=i.index)>e&&(o=n.slice(e,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,u.push({i:s,x:Z(r,i)})),e=Jt.lastIndex;return e180?c+=360:c-f>180&&(f+=360),y.push({i:h.push(i(h)+"rotate(",null,r)-2,x:Z(f,c)})):c&&h.push(i(h)+"rotate("+c+r)}function a(f,c,h,y){f!==c?y.push({i:h.push(i(h)+"skewX(",null,r)-2,x:Z(f,c)}):c&&h.push(i(h)+"skewX("+c+r)}function u(f,c,h,y,m,_){if(f!==h||c!==y){var $=m.push(i(m)+"scale(",null,",",null,")");_.push({i:$-4,x:Z(f,h)},{i:$-2,x:Z(c,y)})}else(h!==1||y!==1)&&m.push(i(m)+"scale("+h+","+y+")")}return function(f,c){var h=[],y=[];return f=t(f),c=t(c),o(f.translateX,f.translateY,c.translateX,c.translateY,h,y),s(f.rotate,c.rotate,h,y),a(f.skewX,c.skewX,h,y),u(f.scaleX,f.scaleY,c.scaleX,c.scaleY,h,y),f=c=null,function(m){for(var _=-1,$=y.length,N;++_<$;)h[(N=y[_]).i]=N.x(m);return h.join("")}}}var fo=Ee(ao,"px, ","px)","deg)"),co=Ee(uo,", ",")",")"),lt=0,mt=0,yt=0,Te=1e3,qt,xt,Bt=0,ot=0,Wt=0,kt=typeof performance=="object"&&performance.now?performance:Date,Le=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function mn(){return ot||(Le(lo),ot=kt.now()+Wt)}function lo(){ot=0}function Xt(){this._call=this._time=this._next=null}Xt.prototype=Ce.prototype={constructor:Xt,restart:function(t,n,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?mn():+e)+(n==null?0:+n),!this._next&&xt!==this&&(xt?xt._next=this:qt=this,xt=this),this._call=t,this._time=e,sn()},stop:function(){this._call&&(this._call=null,this._time=1/0,sn())}};function Ce(t,n,e){var r=new Xt;return r.restart(t,n,e),r}function ho(){mn(),++lt;for(var t=qt,n;t;)(n=ot-t._time)>=0&&t._call.call(void 0,n),t=t._next;--lt}function Wn(){ot=(Bt=kt.now())+Wt,lt=mt=0;try{ho()}finally{lt=0,go(),ot=0}}function po(){var t=kt.now(),n=t-Bt;n>Te&&(Wt-=n,Bt=t)}function go(){for(var t,n=qt,e,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:qt=e);xt=t,sn(r)}function sn(t){if(!lt){mt&&(mt=clearTimeout(mt));var n=t-ot;n>24?(t<1/0&&(mt=setTimeout(Wn,t-kt.now()-Wt)),yt&&(yt=clearInterval(yt))):(yt||(Bt=kt.now(),yt=setInterval(po,Te)),lt=1,Le(Wn))}}function Kn(t,n,e){var r=new Xt;return n=n==null?0:+n,r.restart(i=>{r.stop(),t(i+n)},n,e),r}var yo=he("start","end","cancel","interrupt"),mo=[],Re=0,Zn=1,an=2,zt=3,Gn=4,un=5,Ft=6;function Kt(t,n,e,r,i,o){var s=t.__transition;if(!s)t.__transition={};else if(e in s)return;xo(t,e,{name:n,index:r,group:i,on:yo,tween:mo,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Re})}function xn(t,n){var e=X(t,n);if(e.state>Re)throw new Error("too late; already scheduled");return e}function U(t,n){var e=X(t,n);if(e.state>zt)throw new Error("too late; already running");return e}function X(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function xo(t,n,e){var r=t.__transition,i;r[n]=e,e.timer=Ce(o,0,e.time);function o(f){e.state=Zn,e.timer.restart(s,e.delay,e.time),e.delay<=f&&s(f-e.delay)}function s(f){var c,h,y,m;if(e.state!==Zn)return u();for(c in r)if(m=r[c],m.name===e.name){if(m.state===zt)return Kn(s);m.state===Gn?(m.state=Ft,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete r[c]):+can&&r.state=0&&(n=n.slice(0,e)),!n||n==="start"})}function Zo(t,n,e){var r,i,o=Ko(n)?xn:U;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(n,e),s.on=i}}function Go(t,n){var e=this._id;return arguments.length<2?X(this.node(),e).on.on(t):this.each(Zo(e,t,n))}function Qo(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function Jo(){return this.on("end.remove",Qo(this._id))}function jo(t){var n=this._name,e=this._id;typeof t!="function"&&(t=pn(t));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Vt(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function As(t){return t=Vt(Math.abs(t)),t?t[1]:NaN}function Ss(t,n){return function(e,r){for(var i=e.length,o=[],s=0,a=t[0],u=0;i>0&&a>0&&(u+a+1>r&&(a=Math.max(1,r-u)),o.push(e.substring(i-=a,i+a)),!((u+=a+1)>r));)a=t[s=(s+1)%t.length];return o.reverse().join(n)}}function Ns(t){return function(n){return n.replace(/[0-9]/g,function(e){return t[+e]})}}var Ms=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fn(t){if(!(n=Ms.exec(t)))throw new Error("invalid format: "+t);var n;return new wn({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}fn.prototype=wn.prototype;function wn(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}wn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Es(t){t:for(var n=t.length,e=1,r=-1,i;e0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Fe;function Ts(t,n){var e=Vt(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Fe=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Vt(t,Math.max(0,n+o-1))[0]}function Qn(t,n){var e=Vt(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Jn={"%":(t,n)=>(t*100).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:$s,e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>Qn(t*100,n),r:Qn,s:Ts,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function jn(t){return t}var te=Array.prototype.map,ne=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ls(t){var n=t.grouping===void 0||t.thousands===void 0?jn:Ss(te.call(t.grouping,Number),t.thousands+""),e=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?jn:Ns(te.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function f(h){h=fn(h);var y=h.fill,m=h.align,_=h.sign,$=h.symbol,N=h.zero,C=h.width,T=h.comma,M=h.precision,I=h.trim,E=h.type;E==="n"?(T=!0,E="g"):Jn[E]||(M===void 0&&(M=12),I=!0,E="g"),(N||y==="0"&&m==="=")&&(N=!0,y="0",m="=");var ht=$==="$"?e:$==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():"",dt=$==="$"?r:/[%p]/.test(E)?s:"",G=Jn[E],st=/[defgprs%]/.test(E);M=M===void 0?6:/[gprs]/.test(E)?Math.max(1,Math.min(21,M)):Math.max(0,Math.min(20,M));function Q(k){var F=ht,L=dt,P,l,w;if(E==="c")L=G(k)+L,k="";else{k=+k;var g=k<0||1/k<0;if(k=isNaN(k)?u:G(Math.abs(k),M),I&&(k=Es(k)),g&&+k==0&&_!=="+"&&(g=!1),F=(g?_==="("?_:a:_==="-"||_==="("?"":_)+F,L=(E==="s"?ne[8+Fe/3]:"")+L+(g&&_==="("?")":""),st){for(P=-1,l=k.length;++Pw||w>57){L=(w===46?i+k.slice(P+1):k.slice(P))+L,k=k.slice(0,P);break}}}T&&!N&&(k=n(k,1/0));var x=F.length+k.length+L.length,p=x>1)+F+k+L+p.slice(x);break;default:k=p+F+k+L;break}return o(k)}return Q.toString=function(){return h+""},Q}function c(h,y){var m=f((h=fn(h),h.type="f",h)),_=Math.max(-8,Math.min(8,Math.floor(As(y)/3)))*3,$=Math.pow(10,-_),N=ne[8+_/3];return function(C){return m($*C)+N}}return{format:f,formatPrefix:c}}var Rt,Pe;Cs({thousands:",",grouping:[3],currency:["$",""]});function Cs(t){return Rt=Ls(t),Pe=Rt.format,Rt.formatPrefix,Rt}function Rs(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t);break}return this}const ee=Symbol("implicit");function Oe(){var t=new In,n=[],e=[],r=ee;function i(o){let s=t.get(o);if(s===void 0){if(r!==ee)return r;t.set(o,s=n.push(o)-1)}return e[s%e.length]}return i.domain=function(o){if(!arguments.length)return n.slice();n=[],t=new In;for(const s of o)t.has(s)||t.set(s,n.push(s)-1);return i},i.range=function(o){return arguments.length?(e=Array.from(o),i):e.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Oe(n,e).unknown(r)},Rs.apply(i,arguments),i}function St(t){for(var n=t.length/6|0,e=new Array(n),r=0;r[a(x,p,l),x]));for(const[x,p]of w.entries()){p.index=x;let{source:b,target:A}=p;typeof b!="object"&&(b=p.source=oe(g,b)),typeof A!="object"&&(A=p.target=oe(g,A)),b.sourceLinks.push(p),A.targetLinks.push(p)}if(c!=null)for(const{sourceLinks:x,targetLinks:p}of l)x.sort(c),p.sort(c)}function N({nodes:l}){for(const w of l)w.value=w.fixedValue===void 0?Math.max(Gt(w.sourceLinks,jt),Gt(w.targetLinks,jt)):w.fixedValue}function C({nodes:l}){const w=l.length;let g=new Set(l),x=new Set,p=0;for(;g.size;){for(const b of g){b.depth=p;for(const{target:A}of b.sourceLinks)x.add(A)}if(++p>w)throw new Error("circular link");g=x,x=new Set}}function T({nodes:l}){const w=l.length;let g=new Set(l),x=new Set,p=0;for(;g.size;){for(const b of g){b.height=p;for(const{source:A}of b.targetLinks)x.add(A)}if(++p>w)throw new Error("circular link");g=x,x=new Set}}function M({nodes:l}){const w=Rn(l,p=>p.depth)+1,g=(e-t-i)/(w-1),x=new Array(w);for(const p of l){const b=Math.max(0,Math.min(w-1,Math.floor(u.call(null,p,w))));p.layer=b,p.x0=t+b*g,p.x1=p.x0+i,x[b]?x[b].push(p):x[b]=[p]}if(f)for(const p of x)p.sort(f);return x}function I(l){const w=ue(l,g=>(r-n-(g.length-1)*s)/Gt(g,jt));for(const g of l){let x=n;for(const p of g){p.y0=x,p.y1=x+p.value*w,x=p.y1+s;for(const b of p.sourceLinks)b.width=b.value*w}x=(r-x+s)/(g.length+1);for(let p=0;pg.length)-1)),I(w);for(let g=0;g0))continue;let J=(O/D-A.y0)*w;A.y0+=J,A.y1+=J,k(A)}f===void 0&&b.sort(Yt),G(b,g)}}function dt(l,w,g){for(let x=l.length,p=x-2;p>=0;--p){const b=l[p];for(const A of b){let O=0,D=0;for(const{target:j,value:pt}of A.sourceLinks){let tt=pt*(j.layer-A.layer);O+=P(A,j)*tt,D+=tt}if(!(D>0))continue;let J=(O/D-A.y0)*w;A.y0+=J,A.y1+=J,k(A)}f===void 0&&b.sort(Yt),G(b,g)}}function G(l,w){const g=l.length>>1,x=l[g];Q(l,x.y0-s,g-1,w),st(l,x.y1+s,g+1,w),Q(l,r,l.length-1,w),st(l,n,0,w)}function st(l,w,g,x){for(;g1e-6&&(p.y0+=b,p.y1+=b),w=p.y1+s}}function Q(l,w,g,x){for(;g>=0;--g){const p=l[g],b=(p.y1-w)*x;b>1e-6&&(p.y0-=b,p.y1-=b),w=p.y0-s}}function k({sourceLinks:l,targetLinks:w}){if(c===void 0){for(const{source:{sourceLinks:g}}of w)g.sort(ie);for(const{target:{targetLinks:g}}of l)g.sort(re)}}function F(l){if(c===void 0)for(const{sourceLinks:w,targetLinks:g}of l)w.sort(ie),g.sort(re)}function L(l,w){let g=l.y0-(l.sourceLinks.length-1)*s/2;for(const{target:x,width:p}of l.sourceLinks){if(x===w)break;g+=p+s}for(const{source:x,width:p}of w.targetLinks){if(x===l)break;g-=p}return g}function P(l,w){let g=w.y0-(w.targetLinks.length-1)*s/2;for(const{source:x,width:p}of w.targetLinks){if(x===l)break;g+=p+s}for(const{target:x,width:p}of l.sourceLinks){if(x===w)break;g-=p}return g}return _}var cn=Math.PI,ln=2*cn,et=1e-6,Ws=ln-et;function hn(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qe(){return new hn}hn.prototype=qe.prototype={constructor:hn,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,s=this._y1,a=e-t,u=r-n,f=o-t,c=s-n,h=f*f+c*c;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(h>et)if(!(Math.abs(c*a-u*f)>et)||!i)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var y=e-o,m=r-s,_=a*a+u*u,$=y*y+m*m,N=Math.sqrt(_),C=Math.sqrt(h),T=i*Math.tan((cn-Math.acos((_+h-$)/(2*N*C)))/2),M=T/C,I=T/N;Math.abs(M-1)>et&&(this._+="L"+(t+M*f)+","+(n+M*c)),this._+="A"+i+","+i+",0,0,"+ +(c*y>f*m)+","+(this._x1=t+I*a)+","+(this._y1=n+I*u)}},arc:function(t,n,e,r,i,o){t=+t,n=+n,e=+e,o=!!o;var s=e*Math.cos(r),a=e*Math.sin(r),u=t+s,f=n+a,c=1^o,h=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);this._x1===null?this._+="M"+u+","+f:(Math.abs(this._x1-u)>et||Math.abs(this._y1-f)>et)&&(this._+="L"+u+","+f),e&&(h<0&&(h=h%ln+ln),h>Ws?this._+="A"+e+","+e+",0,1,"+c+","+(t-s)+","+(n-a)+"A"+e+","+e+",0,1,"+c+","+(this._x1=u)+","+(this._y1=f):h>et&&(this._+="A"+e+","+e+",0,"+ +(h>=cn)+","+c+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};function ae(t){return function(){return t}}function Ks(t){return t[0]}function Zs(t){return t[1]}var Gs=Array.prototype.slice;function Qs(t){return t.source}function Js(t){return t.target}function js(t){var n=Qs,e=Js,r=Ks,i=Zs,o=null;function s(){var a,u=Gs.call(arguments),f=n.apply(this,u),c=e.apply(this,u);if(o||(o=a=qe()),t(o,+r.apply(this,(u[0]=f,u)),+i.apply(this,u),+r.apply(this,(u[0]=c,u)),+i.apply(this,u)),a)return o=null,a+""||null}return s.source=function(a){return arguments.length?(n=a,s):n},s.target=function(a){return arguments.length?(e=a,s):e},s.x=function(a){return arguments.length?(r=typeof a=="function"?a:ae(+a),s):r},s.y=function(a){return arguments.length?(i=typeof a=="function"?a:ae(+a),s):i},s.context=function(a){return arguments.length?(o=a??null,s):o},s}function ta(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function na(){return js(ta)}function ea(t){return[t.source.x1,t.y0]}function ra(t){return[t.target.x0,t.y1]}function ia(){return na().source(ea).target(ra)}const oa=Ze({name:"EsSankeychart",components:{},props:{options:{type:Object,default:()=>({})},datasets:{type:[String,Number,Array,Object],default:()=>[]},eventData:{type:[String,Boolean,Number],default:""},element:{type:Object,default:()=>({})}},setup(t){function n({nodes:r,links:i},{format:o=",",align:s="center",nodeId:a=S=>S.id,nodeGroup:u=S=>S.id.split(/\W/)[0],nodeGroups:f,nodeLabel:c,nodeLabelPosition:h="inside",nodeLabelColor:y="#eee",nodeUnit:m=({unit:S})=>S,nodeTitle:_=S=>`${S.id} ${o(S.value)} ${m(S)||""}`,nodeAlign:$=s,nodeSort:N,nodeWidth:C=15,nodePadding:T=14,leftNodeLabelPadding:M=6,rightNodeLabelPadding:I=6,middleNodeLabelPadding:E=6,nodeLabelFontSize:ht=14,nodeStroke:dt="currentColor",nodeStrokeWidth:G,nodeStrokeOpacity:st=1,nodeStrokeLinejoin:Q,linkSource:k=({source:S})=>S,linkTarget:F=({target:S})=>S,linkValue:L=({value:S})=>S,linkUnit:P=({unit:S})=>S,linkPath:l=ia(),linkTitle:w=S=>`${S.source.id} → ${S.target.id} ${o(S.value)} ${P(S)||""}`,linkColor:g="source-target",linkStrokeOpacity:x=.5,linkColorNoOpacity:p=!1,linkMixBlendMode:b="multiply",colors:A=Fs.concat(Hs).concat(zs).concat(Ps).concat(Is),width:O=1920,height:D=1080,marginTop:J=5,marginRight:j=1,marginBottom:pt=5,marginLeft:tt=1,enableAutoFlow:Be=!0}={}){typeof $!="function"&&($={left:Ds,right:qs,center:Bs}[$]??De);function S(d){return d!==null&&typeof d=="object"?d.valueOf():d}const vn=q(i,k).map(S),bn=q(i,F).map(S),Xe=q(i,L),kn=q(i,P);r===void 0&&(r=Array.from(sr(vn,bn),d=>({id:d})));const Zt=q(r,a).map(S),V=u==null?null:q(r,u).map(S);r=q(r,(d,v)=>({id:Zt[v],unit:kn[v]})),i=q(i,(d,v)=>({source:vn[v],target:bn[v],value:Xe[v],unit:kn[v]})),!V&&["source","target","source-target"].includes(g)&&(g="currentColor"),V&&f===void 0&&(f=V);const nt=u==null?null:Oe(f,A);Us().nodeId(({index:d})=>Zt[d]).nodeAlign($).nodeWidth(C).nodePadding(T).nodeSort(N).extent([[tt,J],[O-j,D-pt]])({nodes:r,links:i}),typeof o!="function"&&(o=Pe(o));const $n=c===void 0?Zt:c==null?null:q(r,c),An=_==null?null:q(r,_),Sn=w==null?null:q(i,w),at=`O-${Math.random().toString(16).slice(2)}`,Nt=Bi("svg").attr("width",O).attr("height",D).attr("viewBox",[0,0,O,D]).attr("style","max-width: 100%; height: auto; height: intrinsic;"),Nn=Nt.append("g").attr("fill","none").attr("stroke-opacity",x).selectAll("g").data(i).join("g").style("mix-blend-mode",b),Mn=function(d){if(d.length===0)return;const v=d.pop();ut(`#${at}-path-${v.index}`).attr("stroke-dashoffset",5e3).transition().duration(1500).attr("stroke-dashoffset",0).on("end",()=>{Mn(window.structuredClone(d))})},Ve=function(){ut(this).attr("stroke-dasharray",5e3).attr("stroke-dashoffset",0)},En=Nt.append("g").attr("stroke",dt).attr("stroke-width",G).attr("stroke-opacity",st).attr("stroke-linejoin",Q).selectAll("rect").data(r).join("rect").attr("x",d=>d.x0).attr("y",d=>d.y0).attr("height",d=>d.y1-d.y0<3?3:d.y1-d.y0).attr("width",d=>d.x1-d.x0).attr("fill",(d,v)=>A[v]).attr("id",d=>d.id).on("mouseover",(d,v)=>{Mn(window.structuredClone(v.sourceLinks))}).on("mouseout",(d,v)=>{v.sourceLinks.forEach(z=>{Ve.call(document.getElementById(`#${at}-path-${z.index}`))})});V&&En.attr("fill",({index:d})=>nt(V[d])),An&&En.append("title").text(({index:d})=>An[d]),g==="source-target"&&Nn.append("linearGradient").attr("id",d=>`${at}-link-${d.index}`).attr("gradientUnits","userSpaceOnUse").attr("x1",d=>d.source.x1).attr("x2",d=>d.target.x0).call(d=>d.append("stop").attr("offset","0%").attr("stop-color",({source:{index:v}})=>nt(V[v]))).call(d=>d.append("stop").attr("offset","100%").attr("stop-color",({target:{index:v},source:{index:z}})=>nt(p?V[z]:V[v]))),Nn.append("path").attr("d",l).attr("class","sankeyPath").attr("id",({index:d})=>`${at}-path-${d}`).attr("stroke",g==="source-target"?({index:d})=>`url(#${at}-link-${d})`:g==="source"?({source:{index:d}})=>nt(V[d]):g==="target"?({target:{index:d}})=>nt(V[d]):g).attr("stroke-width",({width:d})=>Math.max(1,d)).attr("stroke-dasharray",5e3).attr("stroke-dashoffset",5e3).call(Sn?d=>{d.append("title").text(({index:v})=>Sn[v])}:()=>{}).each((d,v,z)=>{const Et=(v+1)*50;setTimeout(()=>{ut(z[v]).transition().duration(1500).attr("stroke-dashoffset",0)},Et)});const Tn=Math.max(...new Set(r.map(d=>d.layer)));$n&&Nt.append("g").attr("font-family","sans-serif").attr("font-size",10).selectAll("text").data(r).join("text").attr("x",d=>{if(h==="inside")return d.layer===0?d.x1+M:d.layer===Tn?d.x0-I:d.x1+E;if(h==="outside")return d.layer===0?d.x0-M:d.layer===Tn?d.x1+I:d.x1+E}).attr("y",d=>(d.y1+d.y0)/2).attr("dy","0.35em").attr("font-size",ht).attr("fill",y).attr("text-anchor",d=>d.x0$n[d]);const Ye=r.reduce((d,v)=>v.layer===0?d+(v.y1-v.y0)+T:d,0),Ue=r.reduce((d,v)=>v.layer===1?d+(v.y1-v.y0)+T:d,0),We=r.reduce((d,v)=>v.layer===2?d+(v.y1-v.y0)+T:d,0),Ln=Math.max(Ye,Ue,We),gt=Nt.node();gt.style.overflow="visible",gt.setAttribute("height",Ln),gt.setAttribute("viewBox",`0 0 ${O} ${Ln}`);const Mt=rr(!1);if(Be){const d=function(v){if(v.length===0){Mt.value=!1;return}const z=v.pop();ut(`#${at}-path-${z.index}`).attr("stroke-dashoffset",5e3).transition().duration(1500).attr("stroke-dashoffset",0).on("end",()=>{d(window.structuredClone(v))})};setTimeout(()=>{const v=r.reduce((z,Et)=>Et.sourceLinks.length!==0?z.concat(Et.sourceLinks):z,[]);Mt.value=!0,d(window.structuredClone(v)),Cn(Mt,z=>{z===!1&&(Mt.value=!0,d(window.structuredClone(v)))})},2e3)}Object.assign(gt,{scales:{color:nt}}),ut(`.chart-${t.element.id}`).selectAll("*").remove(),document.querySelector(`.chart-${t.element.id}`).appendChild(gt)}return Cn([()=>t.datasets,()=>t.options],([r,i])=>{r&&Ge(()=>{const o=ir(Qe(i));if(o.colors.length===0)delete o.colors;else{const s=o.colors.map(a=>a.color);o.colors=s}n({links:r},o)})},{immediate:!0,deep:!0}),{margins:Je(()=>{const{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}=t.options;return{padding:`${r}px ${i}px ${o}px ${s}px`}})}}});function sa(t,n,e,r,i,o){return je(),tr("div",{class:nr(`chart-${t.element.id}`),width:"100%",height:"100%",style:er(t.margins)},null,6)}const da=Ke(oa,[["render",sa]]);export{da as default};