11 lines
13 KiB
JavaScript
11 lines
13 KiB
JavaScript
/*! third party licenses: js/vendor.LICENSE.txt */
|
|
import{n as R,m as Y,s as q,a as H,c as J,b as Z,g as F,o as V,I as tt,p as et,i as it}from"./index-CyCAgei9.chunk.mjs";import{s as M}from"./isEmpty-nTVdZyYD.chunk.mjs";import{S as st,j as nt,c as rt,r as ot,l as at,s as lt}from"./sankeyLinkHorizontal-CWiUWupv.chunk.mjs";import"./percentages-BXMCSKIN-Cw9SI0WV.chunk.mjs";import{o as ht}from"./ordinal-Bt1svyuw.chunk.mjs";import{s as ct}from"./Tableau10-C5lqCagu.chunk.mjs";import"./whiteboard-main.mjs";import"./index-Anv74-sp.chunk.mjs";import"./vendor-BeFBwUwf.chunk.mjs";import"./index-vg7q3Iku.chunk.mjs";import"./index-Bn0s6V7w.chunk.mjs";import"./init-q33yAy1W.chunk.mjs";var G=function(){var r=function(u,t,e,n){for(e=e||{},n=u.length;n--;e[u[n]]=t);return e},l=[1,9],p=[1,10],v=[1,5,10,12],w={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(u,t,e,n,o,s,h){var m=s.length-1;switch(o){case 7:const E=n.findOrCreateNode(s[m-4].trim().replaceAll('""','"')),A=n.findOrCreateNode(s[m-2].trim().replaceAll('""','"')),S=parseFloat(s[m].trim());n.addLink(E,A,S);break;case 8:case 9:case 11:this.$=s[m];break;case 10:this.$=s[m-1];break}},table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:l,20:p},{1:[2,6],7:11,10:[1,12]},r(p,[2,4],{9:13,5:[1,14]}),{12:[1,15]},r(v,[2,8]),r(v,[2,9]),{19:[1,16]},r(v,[2,11]),{1:[2,1]},{1:[2,5]},r(p,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:l,20:p},{15:18,16:7,17:8,18:l,20:p},{18:[1,19]},r(p,[2,3]),{12:[1,20]},r(v,[2,10]),{15:21,16:7,17:8,18:l,20:p},r([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:function(u,t){if(t.recoverable)this.trace(u);else{var e=new Error(u);throw e.hash=t,e}},parse:function(u){var t=this,e=[0],n=[],o=[null],s=[],h=this.table,m="",E=0,A=0,S=2,T=1,I=s.slice.call(arguments,1),a=Object.create(this.lexer),_={yy:{}};for(var N in this.yy)Object.prototype.hasOwnProperty.call(this.yy,N)&&(_.yy[N]=this.yy[N]);a.setInput(u,_.yy),_.yy.lexer=a,_.yy.parser=this,typeof a.yylloc>"u"&&(a.yylloc={});var x=a.yylloc;s.push(x);var i=a.options&&a.options.ranges;typeof _.yy.parseError=="function"?this.parseError=_.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function y(){var b;return b=n.pop()||a.lex()||T,typeof b!="number"&&(b instanceof Array&&(n=b,b=n.pop()),b=t.symbols_[b]||b),b}for(var c,D,d,W,O={},j,k,B,L;;){if(D=e[e.length-1],this.defaultActions[D]?d=this.defaultActions[D]:((c===null||typeof c>"u")&&(c=y()),d=h[D]&&h[D][c]),typeof d>"u"||!d.length||!d[0]){var z="";L=[];for(j in h[D])this.terminals_[j]&&j>S&&L.push("'"+this.terminals_[j]+"'");a.showPosition?z="Parse error on line "+(E+1)+`:
|
|
`+a.showPosition()+`
|
|
Expecting `+L.join(", ")+", got '"+(this.terminals_[c]||c)+"'":z="Parse error on line "+(E+1)+": Unexpected "+(c==T?"end of input":"'"+(this.terminals_[c]||c)+"'"),this.parseError(z,{text:a.match,token:this.terminals_[c]||c,line:a.yylineno,loc:x,expected:L})}if(d[0]instanceof Array&&d.length>1)throw new Error("Parse Error: multiple actions possible at state: "+D+", token: "+c);switch(d[0]){case 1:e.push(c),o.push(a.yytext),s.push(a.yylloc),e.push(d[1]),c=null,A=a.yyleng,m=a.yytext,E=a.yylineno,x=a.yylloc;break;case 2:if(k=this.productions_[d[1]][1],O.$=o[o.length-k],O._$={first_line:s[s.length-(k||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(k||1)].first_column,last_column:s[s.length-1].last_column},i&&(O._$.range=[s[s.length-(k||1)].range[0],s[s.length-1].range[1]]),W=this.performAction.apply(O,[m,A,E,_.yy,d[1],o,s].concat(I)),typeof W<"u")return W;k&&(e=e.slice(0,-1*k*2),o=o.slice(0,-1*k),s=s.slice(0,-1*k)),e.push(this.productions_[d[1]][0]),o.push(O.$),s.push(O._$),B=h[e[e.length-2]][e[e.length-1]],e.push(B);break;case 3:return!0}}return!0}},f=function(){var u={EOF:1,parseError:function(t,e){if(this.yy.parser)this.yy.parser.parseError(t,e);else throw new Error(t)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,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 t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var o=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),n.length-1&&(this.yylineno-=n.length-1);var s=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:n?(n.length===o.length?this.yylloc.first_column:0)+o[o.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),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(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
|
|
`+e+"^"},test_match:function(t,e){var n,o,s;if(this.options.backtrack_lexer&&(s={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&&(s.yylloc.range=this.yylloc.range.slice(0))),o=t[0].match(/(?:\r\n?|\n).*/g),o&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var h in s)this[h]=s[h];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,n,o;this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),h=0;h<s.length;h++)if(n=this._input.match(this.rules[s[h]]),n&&(!e||n[0].length>e[0].length)){if(e=n,o=h,this.options.backtrack_lexer){if(t=this.test_match(n,s[h]),t!==!1)return t;if(this._backtrack){e=!1;continue}else return!1}else if(!this.options.flex)break}return e?(t=this.test_match(e,s[o]),t!==!1?t:!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 t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){var t=this.conditionStack.length-1;return t>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(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n,o){switch(n){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 u}();w.lexer=f;function g(){this.yy={}}return g.prototype=w,w.Parser=g,new g}();G.parser=G;const P=G;let C=[],U=[],$={};const ut=()=>{C=[],U=[],$={},et()};class yt{constructor(l,p,v=0){this.source=l,this.target=p,this.value=v}}const pt=(r,l,p)=>{C.push(new yt(r,l,p))};class dt{constructor(l){this.ID=l}}const gt=r=>(r=it.sanitizeText(r,F()),$[r]||($[r]=new dt(r),U.push($[r])),$[r]),ft=()=>U,mt=()=>C,_t=()=>({nodes:U.map(r=>({id:r.ID})),links:C.map(r=>({source:r.source.ID,target:r.target.ID,value:r.value}))}),xt={nodesMap:$,getConfig:()=>F().sankey,getNodes:ft,getLinks:mt,getGraph:_t,addLink:pt,findOrCreateNode:gt,getAccTitle:Z,setAccTitle:J,getAccDescription:H,setAccDescription:q,getDiagramTitle:Y,setDiagramTitle:R,clear:ut},Q=class X{static next(l){return new X(l+ ++X.count)}constructor(l){this.id=l,this.href=`#${l}`}toString(){return"url("+this.href+")"}};Q.count=0;let K=Q;const kt={left:at,right:ot,center:rt,justify:nt},bt=function(r,l,p,v){const{securityLevel:w,sankey:f}=F(),g=V.sankey;let u;w==="sandbox"&&(u=M("#i"+l));const t=w==="sandbox"?M(u.nodes()[0].contentDocument.body):M("body"),e=w==="sandbox"?t.select(`[id="${l}"]`):M(`[id="${l}"]`),n=f?.width??g.width,o=f?.height??g.width,s=f?.useMaxWidth??g.useMaxWidth,h=f?.nodeAlignment??g.nodeAlignment,m=f?.prefix??g.prefix,E=f?.suffix??g.suffix,A=f?.showValues??g.showValues,S=v.db.getGraph(),T=kt[h];st().nodeId(i=>i.id).nodeWidth(10).nodePadding(10+(A?15:0)).nodeAlign(T).extent([[0,0],[n,o]])(S);const I=ht(ct);e.append("g").attr("class","nodes").selectAll(".node").data(S.nodes).join("g").attr("class","node").attr("id",i=>(i.uid=K.next("node-")).id).attr("transform",function(i){return"translate("+i.x0+","+i.y0+")"}).attr("x",i=>i.x0).attr("y",i=>i.y0).append("rect").attr("height",i=>i.y1-i.y0).attr("width",i=>i.x1-i.x0).attr("fill",i=>I(i.id));const a=({id:i,value:y})=>A?`${i}
|
|
${m}${Math.round(y*100)/100}${E}`:i;e.append("g").attr("class","node-labels").attr("font-family","sans-serif").attr("font-size",14).selectAll("text").data(S.nodes).join("text").attr("x",i=>i.x0<n/2?i.x1+6:i.x0-6).attr("y",i=>(i.y1+i.y0)/2).attr("dy",`${A?"0":"0.35"}em`).attr("text-anchor",i=>i.x0<n/2?"start":"end").text(a);const _=e.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(S.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),N=f?.linkColor||"gradient";if(N==="gradient"){const i=_.append("linearGradient").attr("id",y=>(y.uid=K.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",y=>y.source.x1).attr("x2",y=>y.target.x0);i.append("stop").attr("offset","0%").attr("stop-color",y=>I(y.source.id)),i.append("stop").attr("offset","100%").attr("stop-color",y=>I(y.target.id))}let x;switch(N){case"gradient":x=i=>i.uid;break;case"source":x=i=>I(i.source.id);break;case"target":x=i=>I(i.target.id);break;default:x=N}_.append("path").attr("d",lt()).attr("stroke",x).attr("stroke-width",i=>Math.max(1,i.width)),tt(void 0,e,0,s)},vt={draw:bt},Et=r=>r.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,`
|
|
`).trim(),At=P.parse.bind(P);P.parse=r=>At(Et(r));const Ct={parser:P,db:xt,renderer:vt};export{Ct as diagram};
|
|
//# sourceMappingURL=sankeyDiagram-04a897e0-DCo9Dzt1.chunk.mjs.map
|