UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

130 lines (114 loc) 40.3 kB
import{C as we}from"./chunk-4CAJECRU.mjs";import{a as _e}from"./chunk-AZZRMDJM.mjs";import{f as ke,g as Le,h as ye,i as Ee}from"./chunk-4OADUZ5Q.mjs";import{b as se,e as De}from"./chunk-VRZKL3EH.mjs";import"./chunk-Z6V44ARX.mjs";import"./chunk-5IMINLNL.mjs";import"./chunk-ZNLK7HRR.mjs";import"./chunk-DZP67EKU.mjs";import"./chunk-2NMSUPJH.mjs";import{a as xe,f as Se}from"./chunk-VY2OSTJR.mjs";import"./chunk-STOV2HOB.mjs";import{G as fe,O as be,S as me,_ as X,b as de,c as pe,t as v}from"./chunk-QJSWEUOL.mjs";import{b as k,h as Y}from"./chunk-H7VHZCWX.mjs";import{a as l}from"./chunk-AQ6EADP3.mjs";var ie=(function(){var e=l(function(I,h,s,n){for(s=s||{},n=I.length;n--;s[I[n]]=h);return s},"o"),o=[1,15],c=[1,7],a=[1,13],g=[1,14],p=[1,19],r=[1,16],u=[1,17],x=[1,18],L=[8,30],m=[8,10,21,28,29,30,31,39,43,46],f=[1,23],S=[1,24],E=[8,10,15,16,21,28,29,30,31,39,43,46],b=[8,10,15,16,21,27,28,29,30,31,39,43,46],w=[1,49],D={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:l(function(h,s,n,d,y,t,K){var i=t.length-1;switch(y){case 4:d.getLogger().debug("Rule: separator (NL) ");break;case 5:d.getLogger().debug("Rule: separator (Space) ");break;case 6:d.getLogger().debug("Rule: separator (EOF) ");break;case 7:d.getLogger().debug("Rule: hierarchy: ",t[i-1]),d.setHierarchy(t[i-1]);break;case 8:d.getLogger().debug("Stop NL ");break;case 9:d.getLogger().debug("Stop EOF ");break;case 10:d.getLogger().debug("Stop NL2 ");break;case 11:d.getLogger().debug("Stop EOF2 ");break;case 12:d.getLogger().debug("Rule: statement: ",t[i]),typeof t[i].length=="number"?this.$=t[i]:this.$=[t[i]];break;case 13:d.getLogger().debug("Rule: statement #2: ",t[i-1]),this.$=[t[i-1]].concat(t[i]);break;case 14:d.getLogger().debug("Rule: link: ",t[i],h),this.$={edgeTypeStr:t[i],label:""};break;case 15:d.getLogger().debug("Rule: LABEL link: ",t[i-3],t[i-1],t[i]),this.$={edgeTypeStr:t[i],label:t[i-1]};break;case 18:let F=parseInt(t[i]),V=d.generateId();this.$={id:V,type:"space",label:"",width:F,children:[]};break;case 23:d.getLogger().debug("Rule: (nodeStatement link node) ",t[i-2],t[i-1],t[i]," typestr: ",t[i-1].edgeTypeStr);let j=d.edgeStrToEdgeData(t[i-1].edgeTypeStr),J=d.edgeStrToEdgeStartData(t[i-1].edgeTypeStr),G=d.edgeStrToThickness(t[i-1].edgeTypeStr),Z=d.edgeStrToPattern(t[i-1].edgeTypeStr);this.$=[{id:t[i-2].id,label:t[i-2].label,type:t[i-2].type,directions:t[i-2].directions},{id:t[i-2].id+"-"+t[i].id,start:t[i-2].id,end:t[i].id,label:t[i-1].label,type:"edge",thickness:G,pattern:Z,directions:t[i].directions,arrowTypeEnd:j,arrowTypeStart:J},{id:t[i].id,label:t[i].label,type:d.typeStr2Type(t[i].typeStr),directions:t[i].directions}];break;case 24:d.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[i-1],t[i]),this.$={id:t[i-1].id,label:t[i-1].label,type:d.typeStr2Type(t[i-1].typeStr),directions:t[i-1].directions,widthInColumns:parseInt(t[i],10)};break;case 25:d.getLogger().debug("Rule: nodeStatement (node) ",t[i]),this.$={id:t[i].id,label:t[i].label,type:d.typeStr2Type(t[i].typeStr),directions:t[i].directions,widthInColumns:1};break;case 26:d.getLogger().debug("APA123",this?this:"na"),d.getLogger().debug("COLUMNS: ",t[i]),this.$={type:"column-setting",columns:t[i]==="auto"?-1:parseInt(t[i])};break;case 27:d.getLogger().debug("Rule: id-block statement : ",t[i-2],t[i-1]);let _=d.generateId();this.$={...t[i-2],type:"composite",children:t[i-1]};break;case 28:d.getLogger().debug("Rule: blockStatement : ",t[i-2],t[i-1],t[i]);let A=d.generateId();this.$={id:A,type:"composite",label:"",children:t[i-1]};break;case 29:d.getLogger().debug("Rule: node (NODE_ID separator): ",t[i]),this.$={id:t[i]};break;case 30:d.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[i-1],t[i]),this.$={id:t[i-1],label:t[i].label,typeStr:t[i].typeStr,directions:t[i].directions};break;case 31:d.getLogger().debug("Rule: dirList: ",t[i]),this.$=[t[i]];break;case 32:d.getLogger().debug("Rule: dirList: ",t[i-1],t[i]),this.$=[t[i-1]].concat(t[i]);break;case 33:d.getLogger().debug("Rule: nodeShapeNLabel: ",t[i-2],t[i-1],t[i]),this.$={typeStr:t[i-2]+t[i],label:t[i-1]};break;case 34:d.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[i-3],t[i-2]," #3:",t[i-1],t[i]),this.$={typeStr:t[i-3]+t[i],label:t[i-2],directions:t[i-1]};break;case 35:case 36:this.$={type:"classDef",id:t[i-1].trim(),css:t[i].trim()};break;case 37:this.$={type:"applyClass",id:t[i-1].trim(),styleClass:t[i].trim()};break;case 38:this.$={type:"applyStyles",id:t[i-1].trim(),stylesStr:t[i].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:o,11:3,13:4,19:5,20:6,21:c,22:8,23:9,24:10,25:11,26:12,28:a,29:g,31:p,39:r,43:u,46:x},{8:[1,20]},e(L,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:o,21:c,28:a,29:g,31:p,39:r,43:u,46:x}),e(m,[2,16],{14:22,15:f,16:S}),e(m,[2,17]),e(m,[2,18]),e(m,[2,19]),e(m,[2,20]),e(m,[2,21]),e(m,[2,22]),e(E,[2,25],{27:[1,25]}),e(m,[2,26]),{19:26,26:12,31:p},{10:o,11:27,13:4,19:5,20:6,21:c,22:8,23:9,24:10,25:11,26:12,28:a,29:g,31:p,39:r,43:u,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(b,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(L,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(E,[2,24]),{10:o,11:37,13:4,14:22,15:f,16:S,19:5,20:6,21:c,22:8,23:9,24:10,25:11,26:12,28:a,29:g,31:p,39:r,43:u,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(b,[2,30]),{18:[1,43]},{18:[1,44]},e(E,[2,23]),{18:[1,45]},{30:[1,46]},e(m,[2,28]),e(m,[2,35]),e(m,[2,36]),e(m,[2,37]),e(m,[2,38]),{36:[1,47]},{33:48,34:w},{15:[1,50]},e(m,[2,27]),e(b,[2,33]),{38:[1,51]},{33:52,34:w,38:[2,31]},{31:[2,15]},e(b,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:l(function(h,s){if(s.recoverable)this.trace(h);else{var n=new Error(h);throw n.hash=s,n}},"parseError"),parse:l(function(h){var s=this,n=[0],d=[],y=[null],t=[],K=this.table,i="",F=0,V=0,j=0,J=2,G=1,Z=t.slice.call(arguments,1),_=Object.create(this.lexer),A={yy:{}};for(var Q in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Q)&&(A.yy[Q]=this.yy[Q]);_.setInput(h,A.yy),A.yy.lexer=_,A.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var $=_.yylloc;t.push($);var je=_.options&&_.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Dt(T){n.length=n.length-2*T,y.length=y.length-T,t.length=t.length-T}l(Dt,"popStack");function Ge(){var T;return T=d.pop()||_.lex()||G,typeof T!="number"&&(T instanceof Array&&(d=T,T=d.pop()),T=s.symbols_[T]||T),T}l(Ge,"lex");for(var N,ee,P,C,wt,te,M={},H,R,ue,U;;){if(P=n[n.length-1],this.defaultActions[P]?C=this.defaultActions[P]:((N===null||typeof N>"u")&&(N=Ge()),C=K[P]&&K[P][N]),typeof C>"u"||!C.length||!C[0]){var re="";U=[];for(H in K[P])this.terminals_[H]&&H>J&&U.push("'"+this.terminals_[H]+"'");_.showPosition?re="Parse error on line "+(F+1)+`: `+_.showPosition()+` Expecting `+U.join(", ")+", got '"+(this.terminals_[N]||N)+"'":re="Parse error on line "+(F+1)+": Unexpected "+(N==G?"end of input":"'"+(this.terminals_[N]||N)+"'"),this.parseError(re,{text:_.match,token:this.terminals_[N]||N,line:_.yylineno,loc:$,expected:U})}if(C[0]instanceof Array&&C.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+N);switch(C[0]){case 1:n.push(N),y.push(_.yytext),t.push(_.yylloc),n.push(C[1]),N=null,ee?(N=ee,ee=null):(V=_.yyleng,i=_.yytext,F=_.yylineno,$=_.yylloc,j>0&&j--);break;case 2:if(R=this.productions_[C[1]][1],M.$=y[y.length-R],M._$={first_line:t[t.length-(R||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(R||1)].first_column,last_column:t[t.length-1].last_column},je&&(M._$.range=[t[t.length-(R||1)].range[0],t[t.length-1].range[1]]),te=this.performAction.apply(M,[i,V,F,A.yy,C[1],y,t].concat(Z)),typeof te<"u")return te;R&&(n=n.slice(0,-1*R*2),y=y.slice(0,-1*R),t=t.slice(0,-1*R)),n.push(this.productions_[C[1]][0]),y.push(M.$),t.push(M._$),ue=K[n[n.length-2]][n[n.length-1]],n.push(ue);break;case 3:return!0}}return!0},"parse")},B=(function(){var I={EOF:1,parseError:l(function(s,n){if(this.yy.parser)this.yy.parser.parseError(s,n);else throw new Error(s)},"parseError"),setInput:l(function(h,s){return this.yy=s||this.yy||{},this._input=h,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:l(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var s=h.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:l(function(h){var s=h.length,n=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var d=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 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:n?(n.length===d.length?this.yylloc.first_column:0)+d[d.length-n.length].length-n[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(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:l(function(h){this.unput(this.match.slice(h))},"less"),pastInput:l(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var h=this.pastInput(),s=new Array(h.length+1).join("-");return h+this.upcomingInput()+` `+s+"^"},"showPosition"),test_match:l(function(h,s){var n,d,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))),d=h[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,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(h[0].length),this.matched+=h[0],n=this.performAction.call(this,this.yy,this,s,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var t in y)this[t]=y[t];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var h,s,n,d;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),t=0;t<y.length;t++)if(n=this._input.match(this.rules[y[t]]),n&&(!s||n[0].length>s[0].length)){if(s=n,d=t,this.options.backtrack_lexer){if(h=this.test_match(n,y[t]),h!==!1)return h;if(this._backtrack){s=!1;continue}else return!1}else if(!this.options.flex)break}return s?(h=this.test_match(s,y[d]),h!==!1?h:!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:l(function(){var s=this.next();return s||this.lex()},"lex"),begin:l(function(s){this.conditionStack.push(s)},"begin"),popState:l(function(){var s=this.conditionStack.length-1;return s>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(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:l(function(s){return s=this.conditionStack.length-1-Math.abs(s||0),s>=0?this.conditionStack[s]:"INITIAL"},"topState"),pushState:l(function(s){this.begin(s)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:l(function(s,n,d,y){var t=y;switch(d){case 0:return s.getLogger().debug("Found block-beta"),10;break;case 1:return s.getLogger().debug("Found id-block"),29;break;case 2:return s.getLogger().debug("Found block"),10;break;case 3:s.getLogger().debug(".",n.yytext);break;case 4:s.getLogger().debug("_",n.yytext);break;case 5:return 5;case 6:return n.yytext=-1,28;break;case 7:return n.yytext=n.yytext.replace(/columns\s+/,""),s.getLogger().debug("COLUMNS (LEX)",n.yytext),28;break;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:s.getLogger().debug("LEX: POPPING STR:",n.yytext),this.popState();break;case 13:return s.getLogger().debug("LEX: STR end:",n.yytext),"STR";break;case 14:return n.yytext=n.yytext.replace(/space\:/,""),s.getLogger().debug("SPACE NUM (LEX)",n.yytext),21;break;case 15:return n.yytext="1",s.getLogger().debug("COLUMNS (LEX)",n.yytext),21;break;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;break;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 21:return this.popState(),this.pushState("CLASSDEFID"),40;break;case 22:return this.popState(),41;break;case 23:return this.pushState("CLASS"),43;break;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;break;case 25:return this.popState(),45;break;case 26:return this.pushState("STYLE_STMNT"),46;break;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;break;case 28:return this.popState(),48;break;case 29:return this.pushState("acc_title"),"acc_title";break;case 30:return this.popState(),"acc_title_value";break;case 31:return this.pushState("acc_descr"),"acc_descr";break;case 32:return this.popState(),"acc_descr_value";break;case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 38:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),s.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 40:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 41:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),s.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 43:return this.popState(),s.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 44:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 45:return this.popState(),s.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 46:return this.popState(),s.getLogger().debug("Lex: ("),"NODE_DEND";break;case 47:return this.popState(),s.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 48:return this.popState(),s.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 49:return this.popState(),s.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),s.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 51:return this.popState(),s.getLogger().debug("Lex: )"),"NODE_DEND";break;case 52:return this.popState(),s.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 53:return this.popState(),s.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 54:return s.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;break;case 55:return s.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;break;case 56:return s.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;break;case 57:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 58:return s.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;break;case 59:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 60:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 61:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 62:return s.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;break;case 63:return s.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;break;case 64:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 65:return this.pushState("NODE"),35;break;case 66:return this.pushState("NODE"),35;break;case 67:return this.pushState("NODE"),35;break;case 68:return this.pushState("NODE"),35;break;case 69:return this.pushState("NODE"),35;break;case 70:return this.pushState("NODE"),35;break;case 71:return this.pushState("NODE"),35;break;case 72:return s.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;break;case 73:return this.pushState("BLOCK_ARROW"),s.getLogger().debug("LEX ARR START"),37;break;case 74:return s.getLogger().debug("Lex: NODE_ID",n.yytext),31;break;case 75:return s.getLogger().debug("Lex: EOF",n.yytext),8;break;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:s.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:s.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return s.getLogger().debug("LEX: NODE_DESCR:",n.yytext),"NODE_DESCR";break;case 83:s.getLogger().debug("LEX POPPING"),this.popState();break;case 84:s.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (right): dir:",n.yytext),"DIR";break;case 86:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (left):",n.yytext),"DIR";break;case 87:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (x):",n.yytext),"DIR";break;case 88:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (y):",n.yytext),"DIR";break;case 89:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (up):",n.yytext),"DIR";break;case 90:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (down):",n.yytext),"DIR";break;case 91:return n.yytext="]>",s.getLogger().debug("Lex (ARROW_DIR end):",n.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 92:return s.getLogger().debug("Lex: LINK","#"+n.yytext+"#"),15;break;case 93:return s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 94:return s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 95:return s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 96:return s.getLogger().debug("Lex: START_LINK",n.yytext),this.pushState("LLABEL"),16;break;case 97:return s.getLogger().debug("Lex: START_LINK",n.yytext),this.pushState("LLABEL"),16;break;case 98:return s.getLogger().debug("Lex: START_LINK",n.yytext),this.pushState("LLABEL"),16;break;case 99:this.pushState("md_string");break;case 100:return s.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 101:return this.popState(),s.getLogger().debug("Lex: LINK","#"+n.yytext+"#"),15;break;case 102:return this.popState(),s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 103:return this.popState(),s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 104:return s.getLogger().debug("Lex: COLON",n.yytext),n.yytext=n.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return I})();D.lexer=B;function O(){this.yy={}}return l(O,"Parser"),O.prototype=D,D.Parser=O,new O})();ie.parser=ie;var Be=ie;var z=new Map,ae=[],ne=new Map,Ne="color",Te="fill",Ue="bgFill",Ce=",",q=new Map,oe="",Xe=l(e=>fe.sanitizeText(e,X()),"sanitizeText"),qe=l(function(e,o=""){let c=q.get(e);c||(c={id:e,styles:[],textStyles:[]},q.set(e,c)),o?.split(Ce).forEach(a=>{let g=a.replace(/([^;]*);/,"$1").trim();if(RegExp(Ne).exec(a)){let r=g.replace(Te,Ue).replace(Ne,Te);c.textStyles.push(r)}c.styles.push(g)})},"addStyleClass"),Je=l(function(e,o=""){let c=z.get(e);o!=null&&(c.styles=o.split(Ce))},"addStyle2Node"),Ze=l(function(e,o){e.split(",").forEach(function(c){let a=z.get(c);if(a===void 0){let g=c.trim();a={id:g,type:"na",children:[]},z.set(g,a)}a.classes||(a.classes=[]),a.classes.push(o)})},"setCssClass"),Oe=l((e,o)=>{let c=e.flat(),a=[],p=c.find(r=>r?.type==="column-setting")?.columns??-1;for(let r of c){if(typeof p=="number"&&p>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>p&&k.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${p}`),r.label&&(r.label=Xe(r.label)),r.type==="classDef"){qe(r.id,r.css);continue}if(r.type==="applyClass"){Ze(r.id,r?.styleClass??"");continue}if(r.type==="applyStyles"){r?.stylesStr&&Je(r.id,r?.stylesStr);continue}if(r.type==="column-setting")o.columns=r.columns??-1;else if(r.type==="edge"){let u=(ne.get(r.id)??0)+1;ne.set(r.id,u),r.id=u+"-"+r.id,ae.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);let u=z.get(r.id);if(u===void 0?z.set(r.id,r):(r.type!=="na"&&(u.type=r.type),r.label!==r.id&&(u.label=r.label)),r.children&&Oe(r.children,r),r.type==="space"){let x=r.width??1;for(let L=0;L<x;L++){let m=xe(r);m.id=m.id+"-"+L,z.set(m.id,m),a.push(m)}}else u===void 0&&a.push(r)}}o.children=a},"populateBlockDatabase"),le=[],W={id:"root",type:"composite",children:[],columns:-1},Qe=l(()=>{k.debug("Clear called"),me(),W={id:"root",type:"composite",children:[],columns:-1},z=new Map([["root",W]]),le=[],q=new Map,ae=[],ne=new Map,oe=""},"clear");function $e(e){switch(k.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return k.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}l($e,"typeStr2Type");function et(e){switch(k.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}l(et,"edgeTypeStr2Type");function tt(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}l(tt,"edgeStrToEdgeData");function rt(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}l(rt,"edgeStrToEdgeStartData");function st(e){return e.includes("==")?"thick":"normal"}l(st,"edgeStrToThickness");function it(e){return e.includes(".-")?"dotted":"solid"}l(it,"edgeStrToPattern");var Ie=0,nt=l(()=>(Ie++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Ie),"generateId"),at=l(e=>{W.children=e,Oe(e,W),le=W.children},"setHierarchy"),ot=l(e=>{let o=z.get(e);return o?o.columns?o.columns:o.children?o.children.length:-1:-1},"getColumns"),lt=l(()=>[...z.values()],"getBlocksFlat"),ct=l(()=>le||[],"getBlocks"),gt=l(()=>ae,"getEdges"),ht=l(e=>z.get(e),"getBlock"),ut=l(e=>{z.set(e.id,e)},"setBlock"),dt=l(e=>{oe=e},"setDiagramId"),pt=l(()=>oe,"getDiagramId"),ft=l(()=>k,"getLogger"),bt=l(function(){return q},"getClasses"),mt={getConfig:l(()=>v().block,"getConfig"),typeStr2Type:$e,edgeTypeStr2Type:et,edgeStrToEdgeData:tt,edgeStrToEdgeStartData:rt,edgeStrToThickness:st,edgeStrToPattern:it,getLogger:ft,getBlocksFlat:lt,getBlocks:ct,getEdges:gt,setHierarchy:at,getBlock:ht,setBlock:ut,getColumns:ot,getClasses:bt,clear:Qe,generateId:nt,setDiagramId:dt,getDiagramId:pt},ze=mt;var ce=l((e,o)=>{let c=pe,a=c(e,"r"),g=c(e,"g"),p=c(e,"b");return de(a,g,p,o)},"fade"),xt=l(e=>`.label { font-family: ${e.fontFamily}; color: ${e.nodeTextColor||e.textColor}; } .cluster-label text { fill: ${e.titleColor}; } .cluster-label span { color: ${e.titleColor}; } .label text,span { fill: ${e.nodeTextColor||e.textColor}; color: ${e.nodeTextColor||e.textColor}; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: 1px; } .flowchart-label text { text-anchor: middle; } // .flowchart-label .text-outer-tspan { // text-anchor: middle; // } // .flowchart-label .text-inner-tspan { // text-anchor: start; // } .node .label { text-align: center; } .node.clickable { cursor: pointer; } .arrowheadPath { fill: ${e.arrowheadColor}; } .edgePaths .path { stroke: ${e.lineColor}; stroke-width: 2.0px; } .flowchart-link { stroke: ${e.lineColor}; fill: none; } .edgeLabel { background-color: ${e.edgeLabelBackground}; /* * This is for backward compatibility with existing code that didn't * add a \`<p>\` around edge labels. * * TODO: We should probably remove this in a future release. */ p { margin: 0; padding: 0; display: inline; } rect { opacity: 0.5; background-color: ${e.edgeLabelBackground}; fill: ${e.edgeLabelBackground}; } text-align: center; } /* For html labels only */ .labelBkg { background-color: ${e.edgeLabelBackground}; } .node .cluster { // fill: ${ce(e.mainBkg,.5)}; fill: ${ce(e.clusterBkg,.5)}; stroke: ${ce(e.clusterBorder,.2)}; box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; stroke-width: 1px; } .cluster text { fill: ${e.titleColor}; } .cluster span { color: ${e.titleColor}; } /* .cluster div { color: ${e.titleColor}; } */ div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: ${e.fontFamily}; font-size: 12px; background: ${e.tertiaryColor}; border: 1px solid ${e.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .flowchartTitleText { text-anchor: middle; font-size: 18px; fill: ${e.textColor}; } ${_e()} `,"getStyles"),Ae=xt;function Re(e,o){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(o<0||!Number.isInteger(o))throw new Error("Position must be a non-negative integer."+o);if(e<0)return{px:o,py:0};if(e===1)return{px:0,py:o};let c=o%e,a=Math.floor(o/e);return{px:c,py:a}}l(Re,"calculateBlockPosition");var St=l(e=>{let o=0,c=0;for(let a of e.children){let{width:g,height:p,x:r,y:u}=a.size??{width:0,height:0,x:0,y:0};if(k.debug("getMaxChildSize abc95 child:",a.id,"width:",g,"height:",p,"x:",r,"y:",u,a.type),a.type==="space")continue;let x=g/(a.widthInColumns??1);x>o&&(o=x),p>c&&(c=p)}return{width:o,height:c}},"getMaxChildSize");function ge(e,o,c=0,a=0,g=8){k.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",c),e?.size?.width||(e.size={width:c,height:a,x:0,y:0});let p=0,r=0;if(e.children?.length>0){for(let b of e.children)ge(b,o,0,0,g);let u=St(e);p=u.width,r=u.height,k.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",p,r);for(let b of e.children)b.size&&(k.debug(`abc95 Setting size of children of ${e.id} id=${b.id} ${p} ${r} ${JSON.stringify(b.size)}`),b.size.width=p*(b.widthInColumns??1)+g*((b.widthInColumns??1)-1),b.size.height=r,b.size.x=0,b.size.y=0,k.debug(`abc95 updating size of ${e.id} children child:${b.id} maxWidth:${p} maxHeight:${r}`));for(let b of e.children)ge(b,o,p,r,g);let x=e.columns??-1,L=0;for(let b of e.children)L+=b.widthInColumns??1;let m=e.children.length;x>0&&x<L&&(m=x);let f=Math.ceil(L/m),S=m*(p+g)+g,E=f*(r+g)+g;if(S<c){k.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${c} siblingHeight ${a} width ${S}`),S=c,E=a;let b=(c-m*g-g)/m,w=(a-f*g-g)/f;k.debug("Size indata abc88",e.id,"childWidth",b,"maxWidth",p),k.debug("Size indata abc88",e.id,"childHeight",w,"maxHeight",r),k.debug("Size indata abc88 xSize",m,"padding",g);for(let D of e.children)D.size&&(D.size.width=b,D.size.height=w,D.size.x=0,D.size.y=0)}if(k.debug(`abc95 (finale calc) ${e.id} xSize ${m} ySize ${f} columns ${x}${e.children.length} width=${Math.max(S,e.size?.width||0)}`),S<(e?.size?.width||0)){S=e?.size?.width||0;let b=x>0?Math.min(e.children.length,x):e.children.length;if(b>0){let w=(S-b*g-g)/b;k.debug("abc95 (growing to fit) width",e.id,S,e.size?.width,w);for(let D of e.children)D.size&&(D.size.width=w)}}e.size={width:S,height:E,x:0,y:0}}k.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}l(ge,"setBlockSizes");function ve(e,o,c=8){k.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let a=e.columns??-1;if(k.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){let g=e?.children[0]?.size?.width??0,p=e.children.length*g+(e.children.length-1)*c;k.debug("widthOfChildren 88",p,"posX");let r=new Map;{let f=0;for(let S of e.children){if(!S.size)continue;let{py:E}=Re(a,f),b=r.get(E)??0;S.size.height>b&&r.set(E,S.size.height);let w=S?.widthInColumns??1;a>0&&(w=Math.min(w,a-f%a)),f+=w}}let u=new Map;{let f=0,S=[...r.keys()].sort((E,b)=>E-b);for(let E of S)u.set(E,f),f+=(r.get(E)??0)+c}let x=0;k.debug("abc91 block?.size?.x",e.id,e?.size?.x);let L=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-c,m=0;for(let f of e.children){let S=e;if(!f.size)continue;let{width:E,height:b}=f.size,{px:w,py:D}=Re(a,x);if(D!=m&&(m=D,L=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-c,k.debug("New row in layout for block",e.id," and child ",f.id,m)),k.debug(`abc89 layout blocks (child) id: ${f.id} Pos: ${x} (px, py) ${w},${D} (${S?.size?.x},${S?.size?.y}) parent: ${S.id} width: ${E}${c}`),S.size){let O=E/2;f.size.x=L+c+O,k.debug(`abc91 layout blocks (calc) px, pyid:${f.id} startingPos=X${L} new startingPosX${f.size.x} ${O} padding=${c} width=${E} halfWidth=${O} => x:${f.size.x} y:${f.size.y} ${f.widthInColumns} (width * (child?.w || 1)) / 2 ${E*(f?.widthInColumns??1)/2}`),L=f.size.x+O;let I=u.get(D)??0,h=r.get(D)??b;f.size.y=S.size.y-S.size.height/2+I+h/2+c,k.debug(`abc88 layout blocks (calc) px, pyid:${f.id}startingPosX${L}${c}${O}=>x:${f.size.x}y:${f.size.y}${f.widthInColumns}(width * (child?.w || 1)) / 2${E*(f?.widthInColumns??1)/2}`)}f.children&&ve(f,o,c);let B=f?.widthInColumns??1;a>0&&(B=Math.min(B,a-x%a)),x+=B,k.debug("abc88 columnsPos",f,x)}}k.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}l(ve,"layoutBlocks");function Pe(e,{minX:o,minY:c,maxX:a,maxY:g}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:p,y:r,width:u,height:x}=e.size;p-u/2<o&&(o=p-u/2),r-x/2<c&&(c=r-x/2),p+u/2>a&&(a=p+u/2),r+x/2>g&&(g=r+x/2)}if(e.children)for(let p of e.children)({minX:o,minY:c,maxX:a,maxY:g}=Pe(p,{minX:o,minY:c,maxX:a,maxY:g}));return{minX:o,minY:c,maxX:a,maxY:g}}l(Pe,"findBounds");function Fe(e){let o=e.getBlock("root");if(!o)return;let c=X()?.block?.padding??8;ge(o,e,0,0,c),ve(o,e,c),k.debug("getBlocks",JSON.stringify(o,null,2));let{minX:a,minY:g,maxX:p,maxY:r}=Pe(o),u=r-g,x=p-a;return{x:a,y:g,width:x,height:u}}l(Fe,"layout");function Me(e,o,c=!1){let a=e,g="default";(a?.classes?.length||0)>0&&(g=(a?.classes??[]).join(" ")),g=g+" flowchart-label";let p=(a?.classes??[]).flatMap(b=>o.getClasses().get(b)?.styles??[]),r=0,u="rect",x;switch(a.type){case"round":r=5,u="rect";break;case"composite":r=0,u="composite",x=0;break;case"square":u="rect";break;case"diamond":u="question";break;case"hexagon":u="hexagon";break;case"block_arrow":u="block_arrow";break;case"odd":u="rect_left_inv_arrow";break;case"lean_right":u="lean_right";break;case"lean_left":u="lean_left";break;case"trapezoid":u="trapezoid";break;case"inv_trapezoid":u="inv_trapezoid";break;case"rect_left_inv_arrow":u="rect_left_inv_arrow";break;case"circle":u="circle";break;case"ellipse":u="ellipse";break;case"stadium":u="stadium";break;case"subroutine":u="subroutine";break;case"cylinder":u="cylinder";break;case"group":u="rect";break;case"doublecircle":u="doublecircle";break;default:u="rect"}let L=Se(a?.styles??[]),m=a.label,f=a.size??{width:0,height:0,x:0,y:0},S=o.getDiagramId();return{labelStyle:L.labelStyle,shape:u,label:m,labelText:m,rx:r,ry:r,class:g,cssClasses:g,cssStyles:a?.styles??[],cssCompiledStyles:p,style:L.style,id:a.id,domId:S?`${S}-${a.id}`:a.id,isGroup:!1,directions:a.directions,width:f.width||void 0,height:f.height||void 0,wrappingWidth:f.width||Number.POSITIVE_INFINITY,x:f.x,y:f.y,positioned:c,intersect:void 0,padding:x??v()?.block?.padding??0,widthInColumns:a.widthInColumns??1}}l(Me,"getNodeFromBlock");async function kt(e,o,c){let a=Me(o,c,!1);if(o.type==="group")return;let g=v(),p=await se(e,a,{config:g}),r=p.node()?.getBBox()??{width:0,height:0},u=c.getBlock(a.id);u.size={width:r.width,height:r.height,x:0,y:0,node:p},c.setBlock(u),p.remove()}l(kt,"calculateBlockSize");async function Lt(e,o,c){let a=Me(o,c,!0);if(c.getBlock(a.id).type!=="space"){let p=v();await se(e,a,{config:p}),o.intersect=a?.intersect,De(a)}}l(Lt,"insertBlockPositioned");async function he(e,o,c,a){for(let g of o)await a(e,g,c),g.children&&await he(e,g.children,c,a)}l(he,"performOperations");async function Ke(e,o,c){await he(e,o,c,kt)}l(Ke,"calculateBlockSizes");async function Ye(e,o,c){await he(e,o,c,Lt)}l(Ye,"insertBlocks");async function We(e,o,c,a,g){let p=new we({multigraph:!0,compound:!0});p.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let r of c)r.size&&p.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(let r of o)if(r.start&&r.end){let u=a.getBlock(r.start),x=a.getBlock(r.end);if(u?.size&&x?.size){let L=u.size,m=x.size,f=[{x:L.x,y:L.y},{x:L.x+(m.x-L.x)/2,y:L.y+(m.y-L.y)/2},{x:m.x,y:m.y}],S=g?`${g}-${r.id}`:r.id,E=r.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",b=r.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",w=`${E} ${b} flowchart-link LS-a1 LE-b1`;ye(e,{...r,id:S,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:f,classes:w},{},"block",p.node(r.start),p.node(r.end),g),r.label&&(await ke(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:f,classes:w}),Le({...r,x:f[1].x,y:f[1].y},{originalPath:f}))}}}l(We,"insertEdges");var yt=l(function(e,o){return o.db.getClasses()},"getClasses"),Et=l(async function(e,o,c,a){let{securityLevel:g,block:p}=v(),r=a.db;r.setDiagramId(o);let u;g==="sandbox"&&(u=Y("#i"+o));let x=g==="sandbox"?Y(u.nodes()[0].contentDocument.body):Y("body"),L=g==="sandbox"?x.select(`[id="${o}"]`):Y(`[id="${o}"]`);Ee(L,["point","circle","cross"],a.type,o);let f=r.getBlocks(),S=r.getBlocksFlat(),E=r.getEdges(),b=L.insert("g").attr("class","block");await Ke(b,f,r);let w=Fe(r);await Ye(b,f,r),await We(b,E,S,r,o);let D=b.node()?.getBBox(),B=D&&Number.isFinite(D.width)&&Number.isFinite(D.height)?D:w;if(B){let O=Math.max(1,Math.round(.125*(B.width/B.height))),I=B.height+O+10,h=B.width+10,{useMaxWidth:s}=p;be(L,I,h,!!s),k.debug("Here Bounds",w,B),L.attr("viewBox",`${B.x-5} ${B.y-5} ${B.width+10} ${B.height+10}`)}},"draw"),Ve={draw:Et,getClasses:yt};var lr={parser:Be,db:ze,renderer:Ve,styles:Ae};export{lr as diagram};