import{_ as d,q as _t,t as mt,s as xt,g as kt,b as vt,a as bt,c as ot,A as wt,d as V,ac as St,z as Et,k as Lt}from"./mermaid.core-BxtrgwOm.chunk.mjs";import{o as Mt}from"./ordinal-D6YK7yj2.chunk.mjs";import"./index-CYtgifWR.chunk.mjs";import"./emoji-picker-B23JpFV7.chunk.mjs";import"./NcLoadingIcon-zQCGdPwE.chunk.mjs";import"./vue.runtime.esm-fahCO3eG.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";import"./init-CLzSasj9.chunk.mjs";function At(t){for(var e=t.length/6|0,r=new Array(e),a=0;a=a)&&(r=a);else{let a=-1;for(let l of t)(l=e(l,++a,t))!=null&&(r=l)&&(r=l)}return r}function gt(t,e){let r;if(e===void 0)for(const a of t)a!=null&&(r>a||r===void 0&&a>=a)&&(r=a);else{let a=-1;for(let l of t)(l=e(l,++a,t))!=null&&(r>l||r===void 0&&l>=l)&&(r=l)}return r}function J(t,e){let r=0;if(e===void 0)for(let a of t)(a=+a)&&(r+=a);else{let a=-1;for(let l of t)(l=+e(l,++a,t))&&(r+=l)}return r}function Pt(t){return t.target.depth}function Nt(t){return t.depth}function Ot(t,e){return e-1-t.height}function pt(t,e){return t.sourceLinks.length?t.depth:e-1}function Ct(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?gt(t.sourceLinks,Pt)-1:0}function X(t){return function(){return t}}function ct(t,e){return Q(t.source,e.source)||t.index-e.index}function lt(t,e){return Q(t.target,e.target)||t.index-e.index}function Q(t,e){return t.y0-e.y0}function tt(t){return t.value}function It(t){return t.index}function Dt(t){return t.nodes}function $t(t){return t.links}function ht(t,e){const r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function ut({nodes:t}){for(const e of t){let r=e.y0,a=r;for(const l of e.sourceLinks)l.y0=r+l.width/2,r+=l.width;for(const l of e.targetLinks)l.y1=a+l.width/2,a+=l.width}}function jt(){let t=0,e=0,r=1,a=1,l=24,b=8,_,m=It,i=pt,o,f,p=Dt,y=$t,w=6;function k(){const n={nodes:p.apply(null,arguments),links:y.apply(null,arguments)};return N(n),A(n),T(n),I(n),O(n),ut(n),n}k.update=function(n){return ut(n),n},k.nodeId=function(n){return arguments.length?(m=typeof n=="function"?n:X(n),k):m},k.nodeAlign=function(n){return arguments.length?(i=typeof n=="function"?n:X(n),k):i},k.nodeSort=function(n){return arguments.length?(o=n,k):o},k.nodeWidth=function(n){return arguments.length?(l=+n,k):l},k.nodePadding=function(n){return arguments.length?(b=_=+n,k):b},k.nodes=function(n){return arguments.length?(p=typeof n=="function"?n:X(n),k):p},k.links=function(n){return arguments.length?(y=typeof n=="function"?n:X(n),k):y},k.linkSort=function(n){return arguments.length?(f=n,k):f},k.size=function(n){return arguments.length?(t=e=0,r=+n[0],a=+n[1],k):[r-t,a-e]},k.extent=function(n){return arguments.length?(t=+n[0][0],r=+n[1][0],e=+n[0][1],a=+n[1][1],k):[[t,e],[r,a]]},k.iterations=function(n){return arguments.length?(w=+n,k):w};function N({nodes:n,links:u}){for(const[h,s]of n.entries())s.index=h,s.sourceLinks=[],s.targetLinks=[];const c=new Map(n.map((h,s)=>[m(h,s,n),h]));for(const[h,s]of u.entries()){s.index=h;let{source:x,target:v}=s;typeof x!="object"&&(x=s.source=ht(c,x)),typeof v!="object"&&(v=s.target=ht(c,v)),x.sourceLinks.push(s),v.targetLinks.push(s)}if(f!=null)for(const{sourceLinks:h,targetLinks:s}of n)h.sort(f),s.sort(f)}function A({nodes:n}){for(const u of n)u.value=u.fixedValue===void 0?Math.max(J(u.sourceLinks,tt),J(u.targetLinks,tt)):u.fixedValue}function T({nodes:n}){const u=n.length;let c=new Set(n),h=new Set,s=0;for(;c.size;){for(const x of c){x.depth=s;for(const{target:v}of x.sourceLinks)h.add(v)}if(++s>u)throw new Error("circular link");c=h,h=new Set}}function I({nodes:n}){const u=n.length;let c=new Set(n),h=new Set,s=0;for(;c.size;){for(const x of c){x.height=s;for(const{source:v}of x.targetLinks)h.add(v)}if(++s>u)throw new Error("circular link");c=h,h=new Set}}function P({nodes:n}){const u=at(n,s=>s.depth)+1,c=(r-t-l)/(u-1),h=new Array(u);for(const s of n){const x=Math.max(0,Math.min(u-1,Math.floor(i.call(null,s,u))));s.layer=x,s.x0=t+x*c,s.x1=s.x0+l,h[x]?h[x].push(s):h[x]=[s]}if(o)for(const s of h)s.sort(o);return h}function S(n){const u=gt(n,c=>(a-e-(c.length-1)*_)/J(c,tt));for(const c of n){let h=e;for(const s of c){s.y0=h,s.y1=h+s.value*u,h=s.y1+_;for(const x of s.sourceLinks)x.width=x.value*u}h=(a-h+_)/(c.length+1);for(let s=0;sc.length)-1)),S(u);for(let c=0;c0))continue;let G=(W/j-v.y0)*u;v.y0+=G,v.y1+=G,E(v)}o===void 0&&x.sort(Q),g(x,c)}}function C(n,u,c){for(let h=n.length,s=h-2;s>=0;--s){const x=n[s];for(const v of x){let W=0,j=0;for(const{target:q,value:H}of v.sourceLinks){let R=H*(q.layer-v.layer);W+=U(v,q)*R,j+=R}if(!(j>0))continue;let G=(W/j-v.y0)*u;v.y0+=G,v.y1+=G,E(v)}o===void 0&&x.sort(Q),g(x,c)}}function g(n,u){const c=n.length>>1,h=n[c];F(n,h.y0-_,c-1,u),L(n,h.y1+_,c+1,u),F(n,a,n.length-1,u),L(n,e,0,u)}function L(n,u,c,h){for(;c1e-6&&(s.y0+=x,s.y1+=x),u=s.y1+_}}function F(n,u,c,h){for(;c>=0;--c){const s=n[c],x=(s.y1-u)*h;x>1e-6&&(s.y0-=x,s.y1-=x),u=s.y0-_}}function E({sourceLinks:n,targetLinks:u}){if(f===void 0){for(const{source:{sourceLinks:c}}of u)c.sort(lt);for(const{target:{targetLinks:c}}of n)c.sort(ct)}}function $(n){if(f===void 0)for(const{sourceLinks:u,targetLinks:c}of n)u.sort(lt),c.sort(ct)}function M(n,u){let c=n.y0-(n.sourceLinks.length-1)*_/2;for(const{target:h,width:s}of n.sourceLinks){if(h===u)break;c+=s+_}for(const{source:h,width:s}of u.targetLinks){if(h===n)break;c-=s}return c}function U(n,u){let c=u.y0-(u.targetLinks.length-1)*_/2;for(const{source:h,width:s}of u.targetLinks){if(h===n)break;c+=s+_}for(const{target:h,width:s}of n.sourceLinks){if(h===u)break;c-=s}return c}return k}var nt=Math.PI,et=2*nt,z=1e-6,zt=et-z;function it(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function dt(){return new it}it.prototype=dt.prototype={constructor:it,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,a){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+a)},bezierCurveTo:function(t,e,r,a,l,b){this._+="C"+ +t+","+ +e+","+ +r+","+ +a+","+(this._x1=+l)+","+(this._y1=+b)},arcTo:function(t,e,r,a,l){t=+t,e=+e,r=+r,a=+a,l=+l;var b=this._x1,_=this._y1,m=r-t,i=a-e,o=b-t,f=_-e,p=o*o+f*f;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(p>z)if(!(Math.abs(f*m-i*o)>z)||!l)this._+="L"+(this._x1=t)+","+(this._y1=e);else{var y=r-b,w=a-_,k=m*m+i*i,N=y*y+w*w,A=Math.sqrt(k),T=Math.sqrt(p),I=l*Math.tan((nt-Math.acos((k+p-N)/(2*A*T)))/2),P=I/T,S=I/A;Math.abs(P-1)>z&&(this._+="L"+(t+P*o)+","+(e+P*f)),this._+="A"+l+","+l+",0,0,"+ +(f*y>o*w)+","+(this._x1=t+S*m)+","+(this._y1=e+S*i)}},arc:function(t,e,r,a,l,b){t=+t,e=+e,r=+r,b=!!b;var _=r*Math.cos(a),m=r*Math.sin(a),i=t+_,o=e+m,f=1^b,p=b?a-l:l-a;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+i+","+o:(Math.abs(this._x1-i)>z||Math.abs(this._y1-o)>z)&&(this._+="L"+i+","+o),r&&(p<0&&(p=p%et+et),p>zt?this._+="A"+r+","+r+",0,1,"+f+","+(t-_)+","+(e-m)+"A"+r+","+r+",0,1,"+f+","+(this._x1=i)+","+(this._y1=o):p>z&&(this._+="A"+r+","+r+",0,"+ +(p>=nt)+","+f+","+(this._x1=t+r*Math.cos(l))+","+(this._y1=e+r*Math.sin(l))))},rect:function(t,e,r,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +a+"h"+-r+"Z"},toString:function(){return this._}};function ft(t){return function(){return t}}function Ft(t){return t[0]}function Ut(t){return t[1]}var Wt=Array.prototype.slice;function Gt(t){return t.source}function qt(t){return t.target}function Rt(t){var e=Gt,r=qt,a=Ft,l=Ut,b=null;function _(){var m,i=Wt.call(arguments),o=e.apply(this,i),f=r.apply(this,i);if(b||(b=m=dt()),t(b,+a.apply(this,(i[0]=o,i)),+l.apply(this,i),+a.apply(this,(i[0]=f,i)),+l.apply(this,i)),m)return b=null,m+""||null}return _.source=function(m){return arguments.length?(e=m,_):e},_.target=function(m){return arguments.length?(r=m,_):r},_.x=function(m){return arguments.length?(a=typeof m=="function"?m:ft(+m),_):a},_.y=function(m){return arguments.length?(l=typeof m=="function"?m:ft(+m),_):l},_.context=function(m){return arguments.length?(b=m??null,_):b},_}function Vt(t,e,r,a,l){t.moveTo(e,r),t.bezierCurveTo(e=(e+a)/2,r,e,l,a,l)}function Xt(){return Rt(Vt)}function Qt(t){return[t.source.x1,t.y0]}function Yt(t){return[t.target.x0,t.y1]}function Zt(){return Xt().source(Qt).target(Yt)}var rt=(function(){var t=d(function(m,i,o,f){for(o=o||{},f=m.length;f--;o[m[f]]=i);return o},"o"),e=[1,9],r=[1,10],a=[1,5,10,12],l={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:d(function(m,i,o,f,p,y,w){var k=y.length-1;switch(p){case 7:const N=f.findOrCreateNode(y[k-4].trim().replaceAll('""','"')),A=f.findOrCreateNode(y[k-2].trim().replaceAll('""','"')),T=parseFloat(y[k].trim());f.addLink(N,A,T);break;case 8:case 9:case 11:this.$=y[k];break;case 10:this.$=y[k-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:e,20:r},{1:[2,6],7:11,10:[1,12]},t(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:e,20:r},{15:18,16:7,17:8,18:e,20:r},{18:[1,19]},t(r,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:e,20:r},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:d(function(m,i){if(i.recoverable)this.trace(m);else{var o=new Error(m);throw o.hash=i,o}},"parseError"),parse:d(function(m){var i=this,o=[0],f=[],p=[null],y=[],w=this.table,k="",N=0,A=0,T=2,I=1,P=y.slice.call(arguments,1),S=Object.create(this.lexer),O={yy:{}};for(var D in this.yy)Object.prototype.hasOwnProperty.call(this.yy,D)&&(O.yy[D]=this.yy[D]);S.setInput(m,O.yy),O.yy.lexer=S,O.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var C=S.yylloc;y.push(C);var g=S.options&&S.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function L(v){o.length=o.length-2*v,p.length=p.length-v,y.length=y.length-v}d(L,"popStack");function F(){var v;return v=f.pop()||S.lex()||I,typeof v!="number"&&(v instanceof Array&&(f=v,v=f.pop()),v=i.symbols_[v]||v),v}d(F,"lex");for(var E,$,M,U,n={},u,c,h,s;;){if($=o[o.length-1],this.defaultActions[$]?M=this.defaultActions[$]:((E===null||typeof E>"u")&&(E=F()),M=w[$]&&w[$][E]),typeof M>"u"||!M.length||!M[0]){var x="";s=[];for(u in w[$])this.terminals_[u]&&u>T&&s.push("'"+this.terminals_[u]+"'");S.showPosition?x="Parse error on line "+(N+1)+`: `+S.showPosition()+` Expecting `+s.join(", ")+", got '"+(this.terminals_[E]||E)+"'":x="Parse error on line "+(N+1)+": Unexpected "+(E==I?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(x,{text:S.match,token:this.terminals_[E]||E,line:S.yylineno,loc:C,expected:s})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+E);switch(M[0]){case 1:o.push(E),p.push(S.yytext),y.push(S.yylloc),o.push(M[1]),E=null,A=S.yyleng,k=S.yytext,N=S.yylineno,C=S.yylloc;break;case 2:if(c=this.productions_[M[1]][1],n.$=p[p.length-c],n._$={first_line:y[y.length-(c||1)].first_line,last_line:y[y.length-1].last_line,first_column:y[y.length-(c||1)].first_column,last_column:y[y.length-1].last_column},g&&(n._$.range=[y[y.length-(c||1)].range[0],y[y.length-1].range[1]]),U=this.performAction.apply(n,[k,A,N,O.yy,M[1],p,y].concat(P)),typeof U<"u")return U;c&&(o=o.slice(0,-1*c*2),p=p.slice(0,-1*c),y=y.slice(0,-1*c)),o.push(this.productions_[M[1]][0]),p.push(n.$),y.push(n._$),h=w[o[o.length-2]][o[o.length-1]],o.push(h);break;case 3:return!0}}return!0},"parse")},b=(function(){var m={EOF:1,parseError:d(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:d(function(i,o){return this.yy=o||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var o=i.match(/(?:\r\n?|\n).*/g);return o?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:d(function(i){var o=i.length,f=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o),this.offset-=o;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===p.length?this.yylloc.first_column:0)+p[p.length-f.length].length-f[0].length:this.yylloc.first_column-o},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-o]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(i){this.unput(this.match.slice(i))},"less"),pastInput:d(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var i=this.pastInput(),o=new Array(i.length+1).join("-");return i+this.upcomingInput()+` `+o+"^"},"showPosition"),test_match:d(function(i,o){var f,p,y;if(this.options.backtrack_lexer&&(y={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(y.yylloc.range=this.yylloc.range.slice(0))),p=i[0].match(/(?:\r\n?|\n).*/g),p&&(this.yylineno+=p.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:p?p[p.length-1].length-p[p.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],f=this.performAction.call(this,this.yy,this,o,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),f)return f;if(this._backtrack){for(var w in y)this[w]=y[w];return!1}return!1},"test_match"),next:d(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,o,f,p;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),w=0;wo[0].length)){if(o=f,p=w,this.options.backtrack_lexer){if(i=this.test_match(f,y[w]),i!==!1)return i;if(this._backtrack){o=!1;continue}else return!1}else if(!this.options.flex)break}return o?(i=this.test_match(o,y[p]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:d(function(){var i=this.next();return i||this.lex()},"lex"),begin:d(function(i){this.conditionStack.push(i)},"begin"),popState:d(function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:d(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:d(function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},"topState"),pushState:d(function(i){this.begin(i)},"pushState"),stateStackSize:d(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:d(function(i,o,f,p){switch(f){case 0:return this.pushState("csv"),4;case 1:return this.pushState("csv"),4;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;case 6:return 20;case 7:return this.popState("escaped_text"),18;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return m})();l.lexer=b;function _(){this.yy={}}return d(_,"Parser"),_.prototype=l,l.Parser=_,new _})();rt.parser=rt;var Y=rt,B=[],K=[],Z=new Map,Bt=d(()=>{B=[],K=[],Z=new Map,Et()},"clear"),Kt=class{constructor(t,e,r=0){this.source=t,this.target=e,this.value=r}static{d(this,"SankeyLink")}},Ht=d((t,e,r)=>{B.push(new Kt(t,e,r))},"addLink"),Jt=class{constructor(t){this.ID=t}static{d(this,"SankeyNode")}},tn=d(t=>{t=Lt.sanitizeText(t,ot());let e=Z.get(t);return e===void 0&&(e=new Jt(t),Z.set(t,e),K.push(e)),e},"findOrCreateNode"),nn=d(()=>K,"getNodes"),en=d(()=>B,"getLinks"),rn=d(()=>({nodes:K.map(t=>({id:t.ID})),links:B.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),"getGraph"),sn={nodesMap:Z,getConfig:d(()=>ot().sankey,"getConfig"),getNodes:nn,getLinks:en,getGraph:rn,addLink:Ht,findOrCreateNode:tn,getAccTitle:bt,setAccTitle:vt,getAccDescription:kt,setAccDescription:xt,getDiagramTitle:mt,setDiagramTitle:_t,clear:Bt},yt=class st{static{d(this,"Uid")}static{this.count=0}static next(e){return new st(e+ ++st.count)}constructor(e){this.id=e,this.href=`#${e}`}toString(){return"url("+this.href+")"}},on={left:Nt,right:Ot,center:Ct,justify:pt},an=d(function(t,e,r,a){const{securityLevel:l,sankey:b}=ot(),_=wt.sankey;let m;l==="sandbox"&&(m=V("#i"+e));const i=l==="sandbox"?V(m.nodes()[0].contentDocument.body):V("body"),o=l==="sandbox"?i.select(`[id="${e}"]`):V(`[id="${e}"]`),f=b?.width??_.width,p=b?.height??_.width,y=b?.useMaxWidth??_.useMaxWidth,w=b?.nodeAlignment??_.nodeAlignment,k=b?.prefix??_.prefix,N=b?.suffix??_.suffix,A=b?.showValues??_.showValues,T=a.db.getGraph(),I=on[w];jt().nodeId(g=>g.id).nodeWidth(10).nodePadding(10+(A?15:0)).nodeAlign(I).extent([[0,0],[f,p]])(T);const P=Mt(Tt);o.append("g").attr("class","nodes").selectAll(".node").data(T.nodes).join("g").attr("class","node").attr("id",g=>(g.uid=yt.next("node-")).id).attr("transform",function(g){return"translate("+g.x0+","+g.y0+")"}).attr("x",g=>g.x0).attr("y",g=>g.y0).append("rect").attr("height",g=>g.y1-g.y0).attr("width",g=>g.x1-g.x0).attr("fill",g=>P(g.id));const S=d(({id:g,value:L})=>A?`${g} ${k}${Math.round(L*100)/100}${N}`:g,"getText");o.append("g").attr("class","node-labels").attr("font-size",14).selectAll("text").data(T.nodes).join("text").attr("x",g=>g.x0(g.y1+g.y0)/2).attr("dy",`${A?"0":"0.35"}em`).attr("text-anchor",g=>g.x0(L.uid=yt.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",L=>L.source.x1).attr("x2",L=>L.target.x0);g.append("stop").attr("offset","0%").attr("stop-color",L=>P(L.source.id)),g.append("stop").attr("offset","100%").attr("stop-color",L=>P(L.target.id))}let C;switch(D){case"gradient":C=d(g=>g.uid,"coloring");break;case"source":C=d(g=>P(g.source.id),"coloring");break;case"target":C=d(g=>P(g.target.id),"coloring");break;default:C=D}O.append("path").attr("d",Zt()).attr("stroke",C).attr("stroke-width",g=>Math.max(1,g.width)),St(void 0,o,0,y)},"draw"),cn={draw:an},ln=d(t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,` `).trim(),"prepareTextForParsing"),hn=d(t=>`.label { font-family: ${t.fontFamily}; }`,"getStyles"),un=hn,fn=Y.parse.bind(Y);Y.parse=t=>fn(ln(t));var vn={styles:un,parser:Y,db:sn,renderer:cn};export{vn as diagram}; //# sourceMappingURL=sankeyDiagram-TZEHDZUN-bJrJnnw9.chunk.mjs.map