UNPKG

markdown-flow-ui

Version:

A React UI library for rendering markdown with interactive flow components, typewriter effects, and plugin support

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