import{D as vt,J as Ut,Oa as bt,b as Wt,c as Ft,eb as St,fb as wt,gb as Lt,h as X,hb as At,ib as Et,jb as Tt,kb as Ct,l as _t,lb as Mt,nb as Q,pb as Ot}from"./chunk-VMREMWJS.min.js";import{d as ot}from"./chunk-P42HNYSU.min.js";function G(t,n){let o;if(n===void 0)for(let l of t)l!=null&&(o=l)&&(o=l);else{let l=-1;for(let f of t)(f=n(f,++l,t))!=null&&(o=f)&&(o=f)}return o}function $(t,n){let o;if(n===void 0)for(let l of t)l!=null&&(o>l||o===void 0&&l>=l)&&(o=l);else{let l=-1;for(let f of t)(f=n(f,++l,t))!=null&&(o>f||o===void 0&&f>=f)&&(o=f)}return o}function B(t,n){let o=0;if(n===void 0)for(let l of t)(l=+l)&&(o+=l);else{let l=-1;for(let f of t)(f=+n(f,++l,t))&&(o+=f)}return o}function qt(t){return t.target.depth}function st(t){return t.depth}function it(t,n){return n-1-t.height}function K(t,n){return t.sourceLinks.length?t.depth:n-1}function at(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?$(t.sourceLinks,qt)-1:0}function V(t){return function(){return t}}function It(t,n){return J(t.source,n.source)||t.index-n.index}function Nt(t,n){return J(t.target,n.target)||t.index-n.index}function J(t,n){return t.y0-n.y0}function lt(t){return t.value}function Yt(t){return t.index}function Ht(t){return t.nodes}function Xt(t){return t.links}function Pt(t,n){let o=t.get(n);if(!o)throw new Error("missing: "+n);return o}function Rt({nodes:t}){for(let n of t){let o=n.y0,l=o;for(let f of n.sourceLinks)f.y0=o+f.width/2,o+=f.width;for(let f of n.targetLinks)f.y1=l+f.width/2,l+=f.width}}function Z(){let t=0,n=0,o=1,l=1,f=24,k=8,y,m=Yt,r=K,i,u,g=Ht,b=Xt,d=6;function _(){let e={nodes:g.apply(null,arguments),links:b.apply(null,arguments)};return A(e),L(e),E(e),M(e),w(e),Rt(e),e}_.update=function(e){return Rt(e),e},_.nodeId=function(e){return arguments.length?(m=typeof e=="function"?e:V(e),_):m},_.nodeAlign=function(e){return arguments.length?(r=typeof e=="function"?e:V(e),_):r},_.nodeSort=function(e){return arguments.length?(i=e,_):i},_.nodeWidth=function(e){return arguments.length?(f=+e,_):f},_.nodePadding=function(e){return arguments.length?(k=y=+e,_):k},_.nodes=function(e){return arguments.length?(g=typeof e=="function"?e:V(e),_):g},_.links=function(e){return arguments.length?(b=typeof e=="function"?e:V(e),_):b},_.linkSort=function(e){return arguments.length?(u=e,_):u},_.size=function(e){return arguments.length?(t=n=0,o=+e[0],l=+e[1],_):[o-t,l-n]},_.extent=function(e){return arguments.length?(t=+e[0][0],o=+e[1][0],n=+e[0][1],l=+e[1][1],_):[[t,n],[o,l]]},_.iterations=function(e){return arguments.length?(d=+e,_):d};function A({nodes:e,links:h}){for(let[c,s]of e.entries())s.index=c,s.sourceLinks=[],s.targetLinks=[];let a=new Map(e.map((c,s)=>[m(c,s,e),c]));for(let[c,s]of h.entries()){s.index=c;let{source:x,target:v}=s;typeof x!="object"&&(x=s.source=Pt(a,x)),typeof v!="object"&&(v=s.target=Pt(a,v)),x.sourceLinks.push(s),v.targetLinks.push(s)}if(u!=null)for(let{sourceLinks:c,targetLinks:s}of e)c.sort(u),s.sort(u)}function L({nodes:e}){for(let h of e)h.value=h.fixedValue===void 0?Math.max(B(h.sourceLinks,lt),B(h.targetLinks,lt)):h.fixedValue}function E({nodes:e}){let h=e.length,a=new Set(e),c=new Set,s=0;for(;a.size;){for(let x of a){x.depth=s;for(let{target:v}of x.sourceLinks)c.add(v)}if(++s>h)throw new Error("circular link");a=c,c=new Set}}function M({nodes:e}){let h=e.length,a=new Set(e),c=new Set,s=0;for(;a.size;){for(let x of a){x.height=s;for(let{source:v}of x.targetLinks)c.add(v)}if(++s>h)throw new Error("circular link");a=c,c=new Set}}function N({nodes:e}){let h=G(e,s=>s.depth)+1,a=(o-t-f)/(h-1),c=new Array(h);for(let s of e){let x=Math.max(0,Math.min(h-1,Math.floor(r.call(null,s,h))));s.layer=x,s.x0=t+x*a,s.x1=s.x0+f,c[x]?c[x].push(s):c[x]=[s]}if(i)for(let s of c)s.sort(i);return c}function z(e){let h=$(e,a=>(l-n-(a.length-1)*y)/B(a,lt));for(let a of e){let c=n;for(let s of a){s.y0=c,s.y1=c+s.value*h,c=s.y1+y;for(let x of s.sourceLinks)x.width=x.value*h}c=(l-c+y)/(a.length+1);for(let s=0;sa.length)-1)),z(h);for(let a=0;a0))continue;let q=(U/D-v.y0)*h;v.y0+=q,v.y1+=q,S(v)}i===void 0&&x.sort(J),O(x,a)}}function R(e,h,a){for(let c=e.length,s=c-2;s>=0;--s){let x=e[s];for(let v of x){let U=0,D=0;for(let{target:Y,value:rt}of v.sourceLinks){let H=rt*(Y.layer-v.layer);U+=F(v,Y)*H,D+=H}if(!(D>0))continue;let q=(U/D-v.y0)*h;v.y0+=q,v.y1+=q,S(v)}i===void 0&&x.sort(J),O(x,a)}}function O(e,h){let a=e.length>>1,c=e[a];p(e,c.y0-y,a-1,h),I(e,c.y1+y,a+1,h),p(e,l,e.length-1,h),I(e,n,0,h)}function I(e,h,a,c){for(;a1e-6&&(s.y0+=x,s.y1+=x),h=s.y1+y}}function p(e,h,a,c){for(;a>=0;--a){let s=e[a],x=(s.y1-h)*c;x>1e-6&&(s.y0-=x,s.y1-=x),h=s.y0-y}}function S({sourceLinks:e,targetLinks:h}){if(u===void 0){for(let{source:{sourceLinks:a}}of h)a.sort(Nt);for(let{target:{targetLinks:a}}of e)a.sort(It)}}function P(e){if(u===void 0)for(let{sourceLinks:h,targetLinks:a}of e)h.sort(Nt),a.sort(It)}function T(e,h){let a=e.y0-(e.sourceLinks.length-1)*y/2;for(let{target:c,width:s}of e.sourceLinks){if(c===h)break;a+=s+y}for(let{source:c,width:s}of h.targetLinks){if(c===e)break;a-=s}return a}function F(e,h){let a=h.y0-(h.targetLinks.length-1)*y/2;for(let{source:c,width:s}of h.targetLinks){if(c===e)break;a+=s+y}for(let{target:c,width:s}of e.sourceLinks){if(c===h)break;a-=s}return a}return _}var ut=Math.PI,ft=2*ut,j=1e-6,Gt=ft-j;function ct(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function zt(){return new ct}ct.prototype=zt.prototype={constructor:ct,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,o,l){this._+="Q"+ +t+","+ +n+","+(this._x1=+o)+","+(this._y1=+l)},bezierCurveTo:function(t,n,o,l,f,k){this._+="C"+ +t+","+ +n+","+ +o+","+ +l+","+(this._x1=+f)+","+(this._y1=+k)},arcTo:function(t,n,o,l,f){t=+t,n=+n,o=+o,l=+l,f=+f;var k=this._x1,y=this._y1,m=o-t,r=l-n,i=k-t,u=y-n,g=i*i+u*u;if(f<0)throw new Error("negative radius: "+f);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(g>j)if(!(Math.abs(u*m-r*i)>j)||!f)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var b=o-k,d=l-y,_=m*m+r*r,A=b*b+d*d,L=Math.sqrt(_),E=Math.sqrt(g),M=f*Math.tan((ut-Math.acos((_+g-A)/(2*L*E)))/2),N=M/E,z=M/L;Math.abs(N-1)>j&&(this._+="L"+(t+N*i)+","+(n+N*u)),this._+="A"+f+","+f+",0,0,"+ +(u*b>i*d)+","+(this._x1=t+z*m)+","+(this._y1=n+z*r)}},arc:function(t,n,o,l,f,k){t=+t,n=+n,o=+o,k=!!k;var y=o*Math.cos(l),m=o*Math.sin(l),r=t+y,i=n+m,u=1^k,g=k?l-f:f-l;if(o<0)throw new Error("negative radius: "+o);this._x1===null?this._+="M"+r+","+i:(Math.abs(this._x1-r)>j||Math.abs(this._y1-i)>j)&&(this._+="L"+r+","+i),o&&(g<0&&(g=g%ft+ft),g>Gt?this._+="A"+o+","+o+",0,1,"+u+","+(t-y)+","+(n-m)+"A"+o+","+o+",0,1,"+u+","+(this._x1=r)+","+(this._y1=i):g>j&&(this._+="A"+o+","+o+",0,"+ +(g>=ut)+","+u+","+(this._x1=t+o*Math.cos(f))+","+(this._y1=n+o*Math.sin(f))))},rect:function(t,n,o,l){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +o+"v"+ +l+"h"+-o+"Z"},toString:function(){return this._}};var ht=zt;function dt(t){return function(){return t}}function Dt(t){return t[0]}function jt(t){return t[1]}var $t=Array.prototype.slice;function Kt(t){return t.source}function Qt(t){return t.target}function Jt(t){var n=Kt,o=Qt,l=Dt,f=jt,k=null;function y(){var m,r=$t.call(arguments),i=n.apply(this,r),u=o.apply(this,r);if(k||(k=m=ht()),t(k,+l.apply(this,(r[0]=i,r)),+f.apply(this,r),+l.apply(this,(r[0]=u,r)),+f.apply(this,r)),m)return k=null,m+""||null}return y.source=function(m){return arguments.length?(n=m,y):n},y.target=function(m){return arguments.length?(o=m,y):o},y.x=function(m){return arguments.length?(l=typeof m=="function"?m:dt(+m),y):l},y.y=function(m){return arguments.length?(f=typeof m=="function"?m:dt(+m),y):f},y.context=function(m){return arguments.length?(k=m??null,y):k},y}function Zt(t,n,o,l,f){t.moveTo(n,o),t.bezierCurveTo(n=(n+l)/2,o,n,f,l,f)}function pt(){return Jt(Zt)}function te(t){return[t.source.x1,t.y0]}function ee(t){return[t.target.x0,t.y1]}function yt(){return pt().source(te).target(ee)}var Ze=ot(Wt(),1),tn=ot(Ft(),1),en=ot(Ut(),1);var mt=function(){var t=function(m,r,i,u){for(i=i||{},u=m.length;u--;i[m[u]]=r);return i},n=[1,9],o=[1,10],l=[1,5,10,12],f={trace:function(){},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:function(r,i,u,g,b,d,_){var A=d.length-1;switch(b){case 7:let L=g.findOrCreateNode(d[A-4].trim().replaceAll('""','"')),E=g.findOrCreateNode(d[A-2].trim().replaceAll('""','"')),M=parseFloat(d[A].trim());g.addLink(L,E,M);break;case 8:case 9:case 11:this.$=d[A];break;case 10:this.$=d[A-1];break}},table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:o},{1:[2,6],7:11,10:[1,12]},t(o,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(l,[2,8]),t(l,[2,9]),{19:[1,16]},t(l,[2,11]),{1:[2,1]},{1:[2,5]},t(o,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:o},{15:18,16:7,17:8,18:n,20:o},{18:[1,19]},t(o,[2,3]),{12:[1,20]},t(l,[2,10]),{15:21,16:7,17:8,18:n,20:o},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:function(r,i){if(i.recoverable)this.trace(r);else{var u=new Error(r);throw u.hash=i,u}},parse:function(r){var i=this,u=[0],g=[],b=[null],d=[],_=this.table,A="",L=0,E=0,M=2,N=1,z=d.slice.call(arguments,1),w=Object.create(this.lexer),C={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(C.yy[R]=this.yy[R]);w.setInput(r,C.yy),C.yy.lexer=w,C.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var O=w.yylloc;d.push(O);var I=w.options&&w.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function p(){var v;return v=g.pop()||w.lex()||N,typeof v!="number"&&(v instanceof Array&&(g=v,v=g.pop()),v=i.symbols_[v]||v),v}for(var S,P,T,F,e={},h,a,c,s;;){if(P=u[u.length-1],this.defaultActions[P]?T=this.defaultActions[P]:((S===null||typeof S>"u")&&(S=p()),T=_[P]&&_[P][S]),typeof T>"u"||!T.length||!T[0]){var x="";s=[];for(h in _[P])this.terminals_[h]&&h>M&&s.push("'"+this.terminals_[h]+"'");w.showPosition?x="Parse error on line "+(L+1)+`: `+w.showPosition()+` Expecting `+s.join(", ")+", got '"+(this.terminals_[S]||S)+"'":x="Parse error on line "+(L+1)+": Unexpected "+(S==N?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(x,{text:w.match,token:this.terminals_[S]||S,line:w.yylineno,loc:O,expected:s})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+S);switch(T[0]){case 1:u.push(S),b.push(w.yytext),d.push(w.yylloc),u.push(T[1]),S=null,E=w.yyleng,A=w.yytext,L=w.yylineno,O=w.yylloc;break;case 2:if(a=this.productions_[T[1]][1],e.$=b[b.length-a],e._$={first_line:d[d.length-(a||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(a||1)].first_column,last_column:d[d.length-1].last_column},I&&(e._$.range=[d[d.length-(a||1)].range[0],d[d.length-1].range[1]]),F=this.performAction.apply(e,[A,E,L,C.yy,T[1],b,d].concat(z)),typeof F<"u")return F;a&&(u=u.slice(0,-1*a*2),b=b.slice(0,-1*a),d=d.slice(0,-1*a)),u.push(this.productions_[T[1]][0]),b.push(e.$),d.push(e._$),c=_[u[u.length-2]][u[u.length-1]],u.push(c);break;case 3:return!0}}return!0}},k=function(){var m={EOF:1,parseError:function(i,u){if(this.yy.parser)this.yy.parser.parseError(i,u);else throw new Error(i)},setInput:function(r,i){return this.yy=i||this.yy||{},this._input=r,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},input:function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var i=r.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var i=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var g=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),u.length-1&&(this.yylineno-=u.length-1);var b=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:u?(u.length===g.length?this.yylloc.first_column:0)+g[g.length-u.length].length-u[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[b[0],b[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject: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},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),i=new Array(r.length+1).join("-");return r+this.upcomingInput()+` `+i+"^"},test_match:function(r,i){var u,g,b;if(this.options.backtrack_lexer&&(b={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&&(b.yylloc.range=this.yylloc.range.slice(0))),g=r[0].match(/(?:\r\n?|\n).*/g),g&&(this.yylineno+=g.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,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(r[0].length),this.matched+=r[0],u=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var d in b)this[d]=b[d];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,i,u,g;this._more||(this.yytext="",this.match="");for(var b=this._currentRules(),d=0;di[0].length)){if(i=u,g=d,this.options.backtrack_lexer){if(r=this.test_match(u,b[d]),r!==!1)return r;if(this._backtrack){i=!1;continue}else return!1}else if(!this.options.flex)break}return i?(r=this.test_match(i,b[g]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var i=this.next();return i||this.lex()},begin:function(i){this.conditionStack.push(i)},popState:function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},pushState:function(i){this.begin(i)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(i,u,g,b){switch(g){case 0:return this.pushState("csv"),4;case 1:return 10;case 2:return 5;case 3:return 12;case 4:return this.pushState("escaped_text"),18;case 5:return 20;case 6:return this.popState("escaped_text"),18;case 7:return 19}},rules:[/^(?:sankey-beta\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:[1,2,3,4,5,6,7],inclusive:!1},escaped_text:{rules:[6,7],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return m}();f.lexer=k;function y(){this.yy={}}return y.prototype=f,f.Parser=y,new y}();mt.parser=mt;var tt=mt,et=[],nt=[],W={},ne=()=>{et=[],nt=[],W={},wt()},gt=class{constructor(n,o,l=0){this.source=n,this.target=o,this.value=l}},re=(t,n,o)=>{et.push(new gt(t,n,o))},xt=class{constructor(n){this.ID=n}},oe=t=>(t=bt.sanitizeText(t,Q()),W[t]||(W[t]=new xt(t),nt.push(W[t])),W[t]),se=()=>nt,ie=()=>et,ae=()=>({nodes:nt.map(t=>({id:t.ID})),links:et.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),le={nodesMap:W,getConfig:()=>Q().sankey,getNodes:se,getLinks:ie,getGraph:ae,addLink:re,findOrCreateNode:oe,getAccTitle:At,setAccTitle:Lt,getAccDescription:Tt,setAccDescription:Et,getDiagramTitle:Mt,setDiagramTitle:Ct,clear:ne},Vt=class kt{static next(n){return new kt(n+ ++kt.count)}constructor(n){this.id=n,this.href=`#${n}`}toString(){return"url("+this.href+")"}};Vt.count=0;var Bt=Vt,ue={left:st,right:it,center:at,justify:K},fe=function(t,n,o,l){let{securityLevel:f,sankey:k}=Q(),y=Ot.sankey,m;f==="sandbox"&&(m=X("#i"+n));let r=f==="sandbox"?X(m.nodes()[0].contentDocument.body):X("body"),i=f==="sandbox"?r.select(`[id="${n}"]`):X(`[id="${n}"]`),u=k?.width??y.width,g=k?.height??y.width,b=k?.useMaxWidth??y.useMaxWidth,d=k?.nodeAlignment??y.nodeAlignment,_=k?.prefix??y.prefix,A=k?.suffix??y.suffix,L=k?.showValues??y.showValues,E=l.db.getGraph(),M=ue[d];Z().nodeId(p=>p.id).nodeWidth(10).nodePadding(10+(L?15:0)).nodeAlign(M).extent([[0,0],[u,g]])(E);let w=_t(vt);i.append("g").attr("class","nodes").selectAll(".node").data(E.nodes).join("g").attr("class","node").attr("id",p=>(p.uid=Bt.next("node-")).id).attr("transform",function(p){return"translate("+p.x0+","+p.y0+")"}).attr("x",p=>p.x0).attr("y",p=>p.y0).append("rect").attr("height",p=>p.y1-p.y0).attr("width",p=>p.x1-p.x0).attr("fill",p=>w(p.id));let C=({id:p,value:S})=>L?`${p} ${_}${Math.round(S*100)/100}${A}`:p;i.append("g").attr("class","node-labels").attr("font-family","sans-serif").attr("font-size",14).selectAll("text").data(E.nodes).join("text").attr("x",p=>p.x0(p.y1+p.y0)/2).attr("dy",`${L?"0":"0.35"}em`).attr("text-anchor",p=>p.x0(S.uid=Bt.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",S=>S.source.x1).attr("x2",S=>S.target.x0);p.append("stop").attr("offset","0%").attr("stop-color",S=>w(S.source.id)),p.append("stop").attr("offset","100%").attr("stop-color",S=>w(S.target.id))}let I;switch(O){case"gradient":I=p=>p.uid;break;case"source":I=p=>w(p.source.id);break;case"target":I=p=>w(p.target.id);break;default:I=O}R.append("path").attr("d",yt()).attr("stroke",I).attr("stroke-width",p=>Math.max(1,p.width)),St(void 0,i,0,b)},ce={draw:fe},he=t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,` `).trim(),de=tt.parse.bind(tt);tt.parse=t=>de(he(t));var nn={parser:tt,db:le,renderer:ce};export{nn as diagram}; //# sourceMappingURL=sankeyDiagram-97764748-HSUD3MIA.min.js.map