import{g as le}from"./chunk-FMBD7UC4-C-YJ9Twg.chunk.mjs";import{_ as g,G as rt,d as I,e as ce,l as m,z as de,B as he,c as B,al as ge,a9 as ue,aa as ye,a6 as pe,am as H,an as Mt,ao as xe,u as Q,k as be,ap as fe,aq as pt,i as xt,ar as we}from"./mermaid.core-BxtrgwOm.chunk.mjs";import{c as me}from"./clone-Cq87TdKW.chunk.mjs";import{G as Le}from"./graph-BOcm7ic5.chunk.mjs";import{c as Se}from"./channel-BMFyKOlW.chunk.mjs";import"./index-CYtgifWR.chunk.mjs";import"./emoji-picker-B23JpFV7.chunk.mjs";import"./NcLoadingIcon-zQCGdPwE.chunk.mjs";import"./vue.runtime.esm-fahCO3eG.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";import"./_baseUniq-08qBA_if.chunk.mjs";var bt=(function(){var e=g(function(v,c,p,w){for(p=p||{},w=v.length;w--;p[v[w]]=c);return p},"o"),t=[1,15],a=[1,7],i=[1,13],o=[1,14],r=[1,19],s=[1,16],n=[1,17],l=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],x=[1,23],f=[1,24],b=[8,10,15,16,21,28,29,30,31,39,43,46],L=[8,10,15,16,21,27,28,29,30,31,39,43,46],S=[1,49],k={trace:g(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:g(function(v,c,p,w,E,d,_){var y=d.length-1;switch(E){case 4:w.getLogger().debug("Rule: separator (NL) ");break;case 5:w.getLogger().debug("Rule: separator (Space) ");break;case 6:w.getLogger().debug("Rule: separator (EOF) ");break;case 7:w.getLogger().debug("Rule: hierarchy: ",d[y-1]),w.setHierarchy(d[y-1]);break;case 8:w.getLogger().debug("Stop NL ");break;case 9:w.getLogger().debug("Stop EOF ");break;case 10:w.getLogger().debug("Stop NL2 ");break;case 11:w.getLogger().debug("Stop EOF2 ");break;case 12:w.getLogger().debug("Rule: statement: ",d[y]),typeof d[y].length=="number"?this.$=d[y]:this.$=[d[y]];break;case 13:w.getLogger().debug("Rule: statement #2: ",d[y-1]),this.$=[d[y-1]].concat(d[y]);break;case 14:w.getLogger().debug("Rule: link: ",d[y],v),this.$={edgeTypeStr:d[y],label:""};break;case 15:w.getLogger().debug("Rule: LABEL link: ",d[y-3],d[y-1],d[y]),this.$={edgeTypeStr:d[y],label:d[y-1]};break;case 18:const A=parseInt(d[y]),O=w.generateId();this.$={id:O,type:"space",label:"",width:A,children:[]};break;case 23:w.getLogger().debug("Rule: (nodeStatement link node) ",d[y-2],d[y-1],d[y]," typestr: ",d[y-1].edgeTypeStr);const q=w.edgeStrToEdgeData(d[y-1].edgeTypeStr);this.$=[{id:d[y-2].id,label:d[y-2].label,type:d[y-2].type,directions:d[y-2].directions},{id:d[y-2].id+"-"+d[y].id,start:d[y-2].id,end:d[y].id,label:d[y-1].label,type:"edge",directions:d[y].directions,arrowTypeEnd:q,arrowTypeStart:"arrow_open"},{id:d[y].id,label:d[y].label,type:w.typeStr2Type(d[y].typeStr),directions:d[y].directions}];break;case 24:w.getLogger().debug("Rule: nodeStatement (abc88 node size) ",d[y-1],d[y]),this.$={id:d[y-1].id,label:d[y-1].label,type:w.typeStr2Type(d[y-1].typeStr),directions:d[y-1].directions,widthInColumns:parseInt(d[y],10)};break;case 25:w.getLogger().debug("Rule: nodeStatement (node) ",d[y]),this.$={id:d[y].id,label:d[y].label,type:w.typeStr2Type(d[y].typeStr),directions:d[y].directions,widthInColumns:1};break;case 26:w.getLogger().debug("APA123",this?this:"na"),w.getLogger().debug("COLUMNS: ",d[y]),this.$={type:"column-setting",columns:d[y]==="auto"?-1:parseInt(d[y])};break;case 27:w.getLogger().debug("Rule: id-block statement : ",d[y-2],d[y-1]),w.generateId(),this.$={...d[y-2],type:"composite",children:d[y-1]};break;case 28:w.getLogger().debug("Rule: blockStatement : ",d[y-2],d[y-1],d[y]);const j=w.generateId();this.$={id:j,type:"composite",label:"",children:d[y-1]};break;case 29:w.getLogger().debug("Rule: node (NODE_ID separator): ",d[y]),this.$={id:d[y]};break;case 30:w.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",d[y-1],d[y]),this.$={id:d[y-1],label:d[y].label,typeStr:d[y].typeStr,directions:d[y].directions};break;case 31:w.getLogger().debug("Rule: dirList: ",d[y]),this.$=[d[y]];break;case 32:w.getLogger().debug("Rule: dirList: ",d[y-1],d[y]),this.$=[d[y-1]].concat(d[y]);break;case 33:w.getLogger().debug("Rule: nodeShapeNLabel: ",d[y-2],d[y-1],d[y]),this.$={typeStr:d[y-2]+d[y],label:d[y-1]};break;case 34:w.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",d[y-3],d[y-2]," #3:",d[y-1],d[y]),this.$={typeStr:d[y-3]+d[y],label:d[y-2],directions:d[y-1]};break;case 35:case 36:this.$={type:"classDef",id:d[y-1].trim(),css:d[y].trim()};break;case 37:this.$={type:"applyClass",id:d[y-1].trim(),styleClass:d[y].trim()};break;case 38:this.$={type:"applyStyles",id:d[y-1].trim(),stylesStr:d[y].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:o,31:r,39:s,43:n,46:l},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:i,29:o,31:r,39:s,43:n,46:l}),e(h,[2,16],{14:22,15:x,16:f}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(b,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:r},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:o,31:r,39:s,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(L,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:r},{31:[2,14]},{17:[1,36]},e(b,[2,24]),{10:t,11:37,13:4,14:22,15:x,16:f,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:o,31:r,39:s,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(L,[2,30]),{18:[1,43]},{18:[1,44]},e(b,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:S},{15:[1,50]},e(h,[2,27]),e(L,[2,33]),{38:[1,51]},{33:52,34:S,38:[2,31]},{31:[2,15]},e(L,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(v,c){if(c.recoverable)this.trace(v);else{var p=new Error(v);throw p.hash=c,p}},"parseError"),parse:g(function(v){var c=this,p=[0],w=[],E=[null],d=[],_=this.table,y="",A=0,O=0,q=2,j=1,ie=d.slice.call(arguments,1),z=Object.create(this.lexer),V={yy:{}};for(var ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ht)&&(V.yy[ht]=this.yy[ht]);z.setInput(v,V.yy),V.yy.lexer=z,V.yy.parser=this,typeof z.yylloc>"u"&&(z.yylloc={});var gt=z.yylloc;d.push(gt);var ne=z.options&&z.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function oe(Y){p.length=p.length-2*Y,E.length=E.length-Y,d.length=d.length-Y}g(oe,"popStack");function vt(){var Y;return Y=w.pop()||z.lex()||j,typeof Y!="number"&&(Y instanceof Array&&(w=Y,Y=w.pop()),Y=c.symbols_[Y]||Y),Y}g(vt,"lex");for(var P,G,X,ut,J={},at,Z,Nt,st;;){if(G=p[p.length-1],this.defaultActions[G]?X=this.defaultActions[G]:((P===null||typeof P>"u")&&(P=vt()),X=_[G]&&_[G][P]),typeof X>"u"||!X.length||!X[0]){var yt="";st=[];for(at in _[G])this.terminals_[at]&&at>q&&st.push("'"+this.terminals_[at]+"'");z.showPosition?yt="Parse error on line "+(A+1)+`: `+z.showPosition()+` Expecting `+st.join(", ")+", got '"+(this.terminals_[P]||P)+"'":yt="Parse error on line "+(A+1)+": Unexpected "+(P==j?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(yt,{text:z.match,token:this.terminals_[P]||P,line:z.yylineno,loc:gt,expected:st})}if(X[0]instanceof Array&&X.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+P);switch(X[0]){case 1:p.push(P),E.push(z.yytext),d.push(z.yylloc),p.push(X[1]),P=null,O=z.yyleng,y=z.yytext,A=z.yylineno,gt=z.yylloc;break;case 2:if(Z=this.productions_[X[1]][1],J.$=E[E.length-Z],J._$={first_line:d[d.length-(Z||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(Z||1)].first_column,last_column:d[d.length-1].last_column},ne&&(J._$.range=[d[d.length-(Z||1)].range[0],d[d.length-1].range[1]]),ut=this.performAction.apply(J,[y,O,A,V.yy,X[1],E,d].concat(ie)),typeof ut<"u")return ut;Z&&(p=p.slice(0,-1*Z*2),E=E.slice(0,-1*Z),d=d.slice(0,-1*Z)),p.push(this.productions_[X[1]][0]),E.push(J.$),d.push(J._$),Nt=_[p[p.length-2]][p[p.length-1]],p.push(Nt);break;case 3:return!0}}return!0},"parse")},T=(function(){var v={EOF:1,parseError:g(function(c,p){if(this.yy.parser)this.yy.parser.parseError(c,p);else throw new Error(c)},"parseError"),setInput:g(function(c,p){return this.yy=p||this.yy||{},this._input=c,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:g(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var p=c.match(/(?:\r\n?|\n).*/g);return p?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},"input"),unput:g(function(c){var p=c.length,w=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-p),this.offset-=p;var E=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),w.length-1&&(this.yylineno-=w.length-1);var d=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:w?(w.length===E.length?this.yylloc.first_column:0)+E[E.length-w.length].length-w[0].length:this.yylloc.first_column-p},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-p]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(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:g(function(c){this.unput(this.match.slice(c))},"less"),pastInput:g(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var c=this.pastInput(),p=new Array(c.length+1).join("-");return c+this.upcomingInput()+` `+p+"^"},"showPosition"),test_match:g(function(c,p){var w,E,d;if(this.options.backtrack_lexer&&(d={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&&(d.yylloc.range=this.yylloc.range.slice(0))),E=c[0].match(/(?:\r\n?|\n).*/g),E&&(this.yylineno+=E.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:E?E[E.length-1].length-E[E.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+c[0].length},this.yytext+=c[0],this.match+=c[0],this.matches=c,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(c[0].length),this.matched+=c[0],w=this.performAction.call(this,this.yy,this,p,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),w)return w;if(this._backtrack){for(var _ in d)this[_]=d[_];return!1}return!1},"test_match"),next:g(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var c,p,w,E;this._more||(this.yytext="",this.match="");for(var d=this._currentRules(),_=0;_p[0].length)){if(p=w,E=_,this.options.backtrack_lexer){if(c=this.test_match(w,d[_]),c!==!1)return c;if(this._backtrack){p=!1;continue}else return!1}else if(!this.options.flex)break}return p?(c=this.test_match(p,d[E]),c!==!1?c:!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:g(function(){var c=this.next();return c||this.lex()},"lex"),begin:g(function(c){this.conditionStack.push(c)},"begin"),popState:g(function(){var c=this.conditionStack.length-1;return c>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:g(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:g(function(c){return c=this.conditionStack.length-1-Math.abs(c||0),c>=0?this.conditionStack[c]:"INITIAL"},"topState"),pushState:g(function(c){this.begin(c)},"pushState"),stateStackSize:g(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:g(function(c,p,w,E){switch(w){case 0:return c.getLogger().debug("Found block-beta"),10;case 1:return c.getLogger().debug("Found id-block"),29;case 2:return c.getLogger().debug("Found block"),10;case 3:c.getLogger().debug(".",p.yytext);break;case 4:c.getLogger().debug("_",p.yytext);break;case 5:return 5;case 6:return p.yytext=-1,28;case 7:return p.yytext=p.yytext.replace(/columns\s+/,""),c.getLogger().debug("COLUMNS (LEX)",p.yytext),28;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:c.getLogger().debug("LEX: POPPING STR:",p.yytext),this.popState();break;case 13:return c.getLogger().debug("LEX: STR end:",p.yytext),"STR";case 14:return p.yytext=p.yytext.replace(/space\:/,""),c.getLogger().debug("SPACE NUM (LEX)",p.yytext),21;case 15:return p.yytext="1",c.getLogger().debug("COLUMNS (LEX)",p.yytext),21;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 21:return this.popState(),this.pushState("CLASSDEFID"),40;case 22:return this.popState(),41;case 23:return this.pushState("CLASS"),43;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;case 25:return this.popState(),45;case 26:return this.pushState("STYLE_STMNT"),46;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;case 28:return this.popState(),48;case 29:return this.pushState("acc_title"),"acc_title";case 30:return this.popState(),"acc_title_value";case 31:return this.pushState("acc_descr"),"acc_descr";case 32:return this.popState(),"acc_descr_value";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(),c.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),c.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),c.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),c.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),c.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),c.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),c.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),c.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),c.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),c.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),c.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),c.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),c.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),c.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),c.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),c.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),c.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return c.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return c.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return c.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return c.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return c.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return c.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return c.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return c.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return c.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return c.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return c.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 65:return this.pushState("NODE"),35;case 66:return this.pushState("NODE"),35;case 67:return this.pushState("NODE"),35;case 68:return this.pushState("NODE"),35;case 69:return this.pushState("NODE"),35;case 70:return this.pushState("NODE"),35;case 71:return this.pushState("NODE"),35;case 72:return c.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),c.getLogger().debug("LEX ARR START"),37;case 74:return c.getLogger().debug("Lex: NODE_ID",p.yytext),31;case 75:return c.getLogger().debug("Lex: EOF",p.yytext),8;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:c.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:c.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return c.getLogger().debug("LEX: NODE_DESCR:",p.yytext),"NODE_DESCR";case 83:c.getLogger().debug("LEX POPPING"),this.popState();break;case 84:c.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return p.yytext=p.yytext.replace(/^,\s*/,""),c.getLogger().debug("Lex (right): dir:",p.yytext),"DIR";case 86:return p.yytext=p.yytext.replace(/^,\s*/,""),c.getLogger().debug("Lex (left):",p.yytext),"DIR";case 87:return p.yytext=p.yytext.replace(/^,\s*/,""),c.getLogger().debug("Lex (x):",p.yytext),"DIR";case 88:return p.yytext=p.yytext.replace(/^,\s*/,""),c.getLogger().debug("Lex (y):",p.yytext),"DIR";case 89:return p.yytext=p.yytext.replace(/^,\s*/,""),c.getLogger().debug("Lex (up):",p.yytext),"DIR";case 90:return p.yytext=p.yytext.replace(/^,\s*/,""),c.getLogger().debug("Lex (down):",p.yytext),"DIR";case 91:return p.yytext="]>",c.getLogger().debug("Lex (ARROW_DIR end):",p.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return c.getLogger().debug("Lex: LINK","#"+p.yytext+"#"),15;case 93:return c.getLogger().debug("Lex: LINK",p.yytext),15;case 94:return c.getLogger().debug("Lex: LINK",p.yytext),15;case 95:return c.getLogger().debug("Lex: LINK",p.yytext),15;case 96:return c.getLogger().debug("Lex: START_LINK",p.yytext),this.pushState("LLABEL"),16;case 97:return c.getLogger().debug("Lex: START_LINK",p.yytext),this.pushState("LLABEL"),16;case 98:return c.getLogger().debug("Lex: START_LINK",p.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return c.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),c.getLogger().debug("Lex: LINK","#"+p.yytext+"#"),15;case 102:return this.popState(),c.getLogger().debug("Lex: LINK",p.yytext),15;case 103:return this.popState(),c.getLogger().debug("Lex: LINK",p.yytext),15;case 104:return c.getLogger().debug("Lex: COLON",p.yytext),p.yytext=p.yytext.slice(1),27}},"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 v})();k.lexer=T;function D(){this.yy={}}return g(D,"Parser"),D.prototype=k,k.Parser=D,new D})();bt.parser=bt;var ke=bt,U=new Map,St=[],ft=new Map,$t="color",Tt="fill",_e="bgFill",Pt=",",Ee=B(),ot=new Map,De=g(e=>be.sanitizeText(e,Ee),"sanitizeText"),ve=g(function(e,t=""){let a=ot.get(e);a||(a={id:e,styles:[],textStyles:[]},ot.set(e,a)),t?.split(Pt).forEach(i=>{const o=i.replace(/([^;]*);/,"$1").trim();if(RegExp($t).exec(i)){const r=o.replace(Tt,_e).replace($t,Tt);a.textStyles.push(r)}a.styles.push(o)})},"addStyleClass"),Ne=g(function(e,t=""){const a=U.get(e);t!=null&&(a.styles=t.split(Pt))},"addStyle2Node"),$e=g(function(e,t){e.split(",").forEach(function(a){let i=U.get(a);if(i===void 0){const o=a.trim();i={id:o,type:"na",children:[]},U.set(o,i)}i.classes||(i.classes=[]),i.classes.push(t)})},"setCssClass"),Yt=g((e,t)=>{const a=e.flat(),i=[],o=a.find(r=>r?.type==="column-setting")?.columns??-1;for(const r of a){if(typeof o=="number"&&o>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>o&&m.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${o}`),r.label&&(r.label=De(r.label)),r.type==="classDef"){ve(r.id,r.css);continue}if(r.type==="applyClass"){$e(r.id,r?.styleClass??"");continue}if(r.type==="applyStyles"){r?.stylesStr&&Ne(r.id,r?.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const s=(ft.get(r.id)??0)+1;ft.set(r.id,s),r.id=s+"-"+r.id,St.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const s=U.get(r.id);if(s===void 0?U.set(r.id,r):(r.type!=="na"&&(s.type=r.type),r.label!==r.id&&(s.label=r.label)),r.children&&Yt(r.children,r),r.type==="space"){const n=r.width??1;for(let l=0;l{m.debug("Clear called"),de(),et={id:"root",type:"composite",children:[],columns:-1},U=new Map([["root",et]]),kt=[],ot=new Map,St=[],ft=new Map},"clear");function Wt(e){switch(m.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return m.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"}}g(Wt,"typeStr2Type");function Xt(e){return(m.debug("typeStr2Type",e),e)==="=="?"thick":"normal"}g(Xt,"edgeTypeStr2Type");function Kt(e){switch(e.replace(/^[\s-]+|[\s-]+$/g,"")){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}g(Kt,"edgeStrToEdgeData");var Ct=0,Ce=g(()=>(Ct++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Ct),"generateId"),Ie=g(e=>{et.children=e,Yt(e,et),kt=et.children},"setHierarchy"),Be=g(e=>{const t=U.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),Oe=g(()=>[...U.values()],"getBlocksFlat"),ze=g(()=>kt||[],"getBlocks"),Re=g(()=>St,"getEdges"),Ae=g(e=>U.get(e),"getBlock"),Me=g(e=>{U.set(e.id,e)},"setBlock"),Pe=g(()=>m,"getLogger"),Ye=g(function(){return ot},"getClasses"),We={getConfig:g(()=>rt().block,"getConfig"),typeStr2Type:Wt,edgeTypeStr2Type:Xt,edgeStrToEdgeData:Kt,getLogger:Pe,getBlocksFlat:Oe,getBlocks:ze,getEdges:Re,setHierarchy:Ie,getBlock:Ae,setBlock:Me,getColumns:Be,getClasses:Ye,clear:Te,generateId:Ce},Xe=We,it=g((e,t)=>{const a=Se,i=a(e,"r"),o=a(e,"g"),r=a(e,"b");return he(i,o,r,t)},"fade"),Ke=g(e=>`.label { font-family: ${e.fontFamily}; color: ${e.nodeTextColor||e.textColor}; } .cluster-label text { fill: ${e.titleColor}; } .cluster-label span,p { color: ${e.titleColor}; } .label text,span,p { 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}; } .edgePath .path { stroke: ${e.lineColor}; stroke-width: 2.0px; } .flowchart-link { stroke: ${e.lineColor}; fill: none; } .edgeLabel { background-color: ${e.edgeLabelBackground}; rect { opacity: 0.5; background-color: ${e.edgeLabelBackground}; fill: ${e.edgeLabelBackground}; } text-align: center; } /* For html labels only */ .labelBkg { background-color: ${it(e.edgeLabelBackground,.5)}; // background-color: } .node .cluster { // fill: ${it(e.mainBkg,.5)}; fill: ${it(e.clusterBkg,.5)}; stroke: ${it(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,p { 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}; } ${le()} `,"getStyles"),Ue=Ke,Fe=g((e,t,a,i)=>{t.forEach(o=>{er[o](e,a,i)})},"insertMarkers"),je=g((e,t,a)=>{m.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),He=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Ze=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),qe=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),Ve=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Ge=g((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Je=g((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),Qe=g((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),tr=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),er={extension:je,composition:He,aggregation:Ze,dependency:qe,lollipop:Ve,point:Ge,circle:Je,cross:Qe,barb:tr},rr=Fe,C=B()?.block?.padding??8;function Ut(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};const a=t%e,i=Math.floor(t/e);return{px:a,py:i}}g(Ut,"calculateBlockPosition");var ar=g(e=>{let t=0,a=0;for(const i of e.children){const{width:o,height:r,x:s,y:n}=i.size??{width:0,height:0,x:0,y:0};m.debug("getMaxChildSize abc95 child:",i.id,"width:",o,"height:",r,"x:",s,"y:",n,i.type),i.type!=="space"&&(o>t&&(t=o/(e.widthInColumns??1)),r>a&&(a=r))}return{width:t,height:a}},"getMaxChildSize");function lt(e,t,a=0,i=0){m.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",a),e?.size?.width||(e.size={width:a,height:i,x:0,y:0});let o=0,r=0;if(e.children?.length>0){for(const b of e.children)lt(b,t);const s=ar(e);o=s.width,r=s.height,m.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",o,r);for(const b of e.children)b.size&&(m.debug(`abc95 Setting size of children of ${e.id} id=${b.id} ${o} ${r} ${JSON.stringify(b.size)}`),b.size.width=o*(b.widthInColumns??1)+C*((b.widthInColumns??1)-1),b.size.height=r,b.size.x=0,b.size.y=0,m.debug(`abc95 updating size of ${e.id} children child:${b.id} maxWidth:${o} maxHeight:${r}`));for(const b of e.children)lt(b,t,o,r);const n=e.columns??-1;let l=0;for(const b of e.children)l+=b.widthInColumns??1;let u=e.children.length;n>0&&n0?Math.min(e.children.length,n):e.children.length;if(b>0){const L=(x-b*C-C)/b;m.debug("abc95 (growing to fit) width",e.id,x,e.size?.width,L);for(const S of e.children)S.size&&(S.size.width=L)}}e.size={width:x,height:f,x:0,y:0}}m.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}g(lt,"setBlockSizes");function _t(e,t){m.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);const a=e.columns??-1;if(m.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const i=e?.children[0]?.size?.width??0,o=e.children.length*i+(e.children.length-1)*C;m.debug("widthOfChildren 88",o,"posX");let r=0;m.debug("abc91 block?.size?.x",e.id,e?.size?.x);let s=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-C,n=0;for(const l of e.children){const u=e;if(!l.size)continue;const{width:h,height:x}=l.size,{px:f,py:b}=Ut(a,r);if(b!=n&&(n=b,s=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-C,m.debug("New row in layout for block",e.id," and child ",l.id,n)),m.debug(`abc89 layout blocks (child) id: ${l.id} Pos: ${r} (px, py) ${f},${b} (${u?.size?.x},${u?.size?.y}) parent: ${u.id} width: ${h}${C}`),u.size){const S=h/2;l.size.x=s+C+S,m.debug(`abc91 layout blocks (calc) px, pyid:${l.id} startingPos=X${s} new startingPosX${l.size.x} ${S} padding=${C} width=${h} halfWidth=${S} => x:${l.size.x} y:${l.size.y} ${l.widthInColumns} (width * (child?.w || 1)) / 2 ${h*(l?.widthInColumns??1)/2}`),s=l.size.x+S,l.size.y=u.size.y-u.size.height/2+b*(x+C)+x/2+C,m.debug(`abc88 layout blocks (calc) px, pyid:${l.id}startingPosX${s}${C}${S}=>x:${l.size.x}y:${l.size.y}${l.widthInColumns}(width * (child?.w || 1)) / 2${h*(l?.widthInColumns??1)/2}`)}l.children&&_t(l);let L=l?.widthInColumns??1;a>0&&(L=Math.min(L,a-r%a)),r+=L,m.debug("abc88 columnsPos",l,r)}}m.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}g(_t,"layoutBlocks");function Et(e,{minX:t,minY:a,maxX:i,maxY:o}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:r,y:s,width:n,height:l}=e.size;r-n/2i&&(i=r+n/2),s+l/2>o&&(o=s+l/2)}if(e.children)for(const r of e.children)({minX:t,minY:a,maxX:i,maxY:o}=Et(r,{minX:t,minY:a,maxX:i,maxY:o}));return{minX:t,minY:a,maxX:i,maxY:o}}g(Et,"findBounds");function Ft(e){const t=e.getBlock("root");if(!t)return;lt(t,e,0,0),_t(t),m.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:i,maxX:o,maxY:r}=Et(t),s=r-i,n=o-a;return{x:a,y:i,width:n,height:s}}g(Ft,"layout");function wt(e,t){t&&e.attr("style",t)}g(wt,"applyStyle");function jt(e,t){const a=I(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),i=a.append("xhtml:div"),o=e.label,r=e.isNode?"nodeLabel":"edgeLabel",s=i.append("span");return s.html(xt(o,t)),wt(s,e.labelStyle),s.attr("class",r),wt(i,e.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap"),i.attr("xmlns","http://www.w3.org/1999/xhtml"),a.node()}g(jt,"addHtmlLabel");var sr=g(async(e,t,a,i)=>{let o=e||"";typeof o=="object"&&(o=o[0]);const r=B();if(H(r.flowchart.htmlLabels)){o=o.replace(/\\n|\n/g,"
"),m.debug("vertexText"+o);const s=await fe(pt(o)),n={isNode:i,label:s,labelStyle:t.replace("fill:","color:")};return jt(n,r)}else{const s=document.createElementNS("http://www.w3.org/2000/svg","text");s.setAttribute("style",t.replace("color:","fill:"));let n=[];typeof o=="string"?n=o.split(/\\n|\n|/gi):Array.isArray(o)?n=o:n=[];for(const l of n){const u=document.createElementNS("http://www.w3.org/2000/svg","tspan");u.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),u.setAttribute("dy","1em"),u.setAttribute("x","0"),a?u.setAttribute("class","title-row"):u.setAttribute("class","row"),u.textContent=l.trim(),s.appendChild(u)}return s}},"createLabel"),K=sr,ir=g((e,t,a,i,o)=>{t.arrowTypeStart&&It(e,"start",t.arrowTypeStart,a,i,o),t.arrowTypeEnd&&It(e,"end",t.arrowTypeEnd,a,i,o)},"addEdgeMarkers"),nr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},It=g((e,t,a,i,o,r)=>{const s=nr[a];if(!s){m.warn(`Unknown arrow type: ${a}`);return}const n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${i}#${o}_${r}-${s}${n})`)},"addEdgeMarker"),mt={},M={},or=g(async(e,t)=>{const a=B(),i=H(a.flowchart.htmlLabels),o=t.labelType==="markdown"?Mt(e,t.label,{style:t.labelStyle,useHtmlLabels:i,addSvgBackground:!0},a):await K(t.label,t.labelStyle),r=e.insert("g").attr("class","edgeLabel"),s=r.insert("g").attr("class","label");s.node().appendChild(o);let n=o.getBBox();if(i){const u=o.children[0],h=I(o);n=u.getBoundingClientRect(),h.attr("width",n.width),h.attr("height",n.height)}s.attr("transform","translate("+-n.width/2+", "+-n.height/2+")"),mt[t.id]=r,t.width=n.width,t.height=n.height;let l;if(t.startLabelLeft){const u=await K(t.startLabelLeft,t.labelStyle),h=e.insert("g").attr("class","edgeTerminals"),x=h.insert("g").attr("class","inner");l=x.node().appendChild(u);const f=u.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),M[t.id]||(M[t.id]={}),M[t.id].startLeft=h,tt(l,t.startLabelLeft)}if(t.startLabelRight){const u=await K(t.startLabelRight,t.labelStyle),h=e.insert("g").attr("class","edgeTerminals"),x=h.insert("g").attr("class","inner");l=h.node().appendChild(u),x.node().appendChild(u);const f=u.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),M[t.id]||(M[t.id]={}),M[t.id].startRight=h,tt(l,t.startLabelRight)}if(t.endLabelLeft){const u=await K(t.endLabelLeft,t.labelStyle),h=e.insert("g").attr("class","edgeTerminals"),x=h.insert("g").attr("class","inner");l=x.node().appendChild(u);const f=u.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),h.node().appendChild(u),M[t.id]||(M[t.id]={}),M[t.id].endLeft=h,tt(l,t.endLabelLeft)}if(t.endLabelRight){const u=await K(t.endLabelRight,t.labelStyle),h=e.insert("g").attr("class","edgeTerminals"),x=h.insert("g").attr("class","inner");l=x.node().appendChild(u);const f=u.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),h.node().appendChild(u),M[t.id]||(M[t.id]={}),M[t.id].endRight=h,tt(l,t.endLabelRight)}return o},"insertEdgeLabel");function tt(e,t){B().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}g(tt,"setTerminalWidth");var lr=g((e,t)=>{m.debug("Moving label abc88 ",e.id,e.label,mt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const i=B(),{subGraphTitleTotalMargin:o}=xe(i);if(e.label){const r=mt[e.id];let s=e.x,n=e.y;if(a){const l=Q.calcLabelPosition(a);m.debug("Moving label "+e.label+" from (",s,",",n,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(s=l.x,n=l.y)}r.attr("transform",`translate(${s}, ${n+o/2})`)}if(e.startLabelLeft){const r=M[e.id].startLeft;let s=e.x,n=e.y;if(a){const l=Q.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);s=l.x,n=l.y}r.attr("transform",`translate(${s}, ${n})`)}if(e.startLabelRight){const r=M[e.id].startRight;let s=e.x,n=e.y;if(a){const l=Q.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);s=l.x,n=l.y}r.attr("transform",`translate(${s}, ${n})`)}if(e.endLabelLeft){const r=M[e.id].endLeft;let s=e.x,n=e.y;if(a){const l=Q.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);s=l.x,n=l.y}r.attr("transform",`translate(${s}, ${n})`)}if(e.endLabelRight){const r=M[e.id].endRight;let s=e.x,n=e.y;if(a){const l=Q.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);s=l.x,n=l.y}r.attr("transform",`translate(${s}, ${n})`)}},"positionEdgeLabel"),cr=g((e,t)=>{const a=e.x,i=e.y,o=Math.abs(t.x-a),r=Math.abs(t.y-i),s=e.width/2,n=e.height/2;return o>=s||r>=n},"outsideNode"),dr=g((e,t,a)=>{m.debug(`intersection calc abc89: outsidePoint: ${JSON.stringify(t)} insidePoint : ${JSON.stringify(a)} node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,o=e.y,r=Math.abs(i-a.x),s=e.width/2;let n=a.xMath.abs(i-t.x)*l){let x=a.y{m.debug("abc88 cutPathAtIntersect",e,t);let a=[],i=e[0],o=!1;return e.forEach(r=>{if(!cr(t,r)&&!o){const s=dr(t,i,r);let n=!1;a.forEach(l=>{n=n||l.x===s.x&&l.y===s.y}),a.some(l=>l.x===s.x&&l.y===s.y)||a.push(s),o=!0}else i=r,o||a.push(r)}),a},"cutPathAtIntersect"),hr=g(function(e,t,a,i,o,r,s){let n=a.points;m.debug("abc88 InsertEdge: edge=",a,"e=",t);let l=!1;const u=r.node(t.v);var h=r.node(t.w);h?.intersect&&u?.intersect&&(n=n.slice(1,a.points.length-1),n.unshift(u.intersect(n[0])),n.push(h.intersect(n[n.length-1]))),a.toCluster&&(m.debug("to cluster abc88",i[a.toCluster]),n=Bt(a.points,i[a.toCluster].node),l=!0),a.fromCluster&&(m.debug("from cluster abc88",i[a.fromCluster]),n=Bt(n.reverse(),i[a.fromCluster].node).reverse(),l=!0);const x=n.filter(c=>!Number.isNaN(c.y));let f=ye;a.curve&&(o==="graph"||o==="flowchart")&&(f=a.curve);const{x:b,y:L}=ge(a),S=ue().x(b).y(L).curve(f);let k;switch(a.thickness){case"normal":k="edge-thickness-normal";break;case"thick":k="edge-thickness-thick";break;case"invisible":k="edge-thickness-thick";break;default:k=""}switch(a.pattern){case"solid":k+=" edge-pattern-solid";break;case"dotted":k+=" edge-pattern-dotted";break;case"dashed":k+=" edge-pattern-dashed";break}const T=e.append("path").attr("d",S(x)).attr("id",a.id).attr("class"," "+k+(a.classes?" "+a.classes:"")).attr("style",a.style);let D="";(B().flowchart.arrowMarkerAbsolute||B().state.arrowMarkerAbsolute)&&(D=pe(!0)),ir(T,a,D,s,o);let v={};return l&&(v.updatedPath=n),v.originalPath=a.points,v},"insertEdge"),gr=g(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a);break}return t},"expandAndDeduplicateDirections"),ur=g((e,t,a)=>{const i=gr(e),o=2,r=t.height+2*a.padding,s=r/o,n=t.width+2*s+a.padding,l=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:s,y:0},{x:n/2,y:2*l},{x:n-s,y:0},{x:n,y:0},{x:n,y:-r/3},{x:n+2*l,y:-r/2},{x:n,y:-2*r/3},{x:n,y:-r},{x:n-s,y:-r},{x:n/2,y:-r-2*l},{x:s,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*l,y:-r/2},{x:0,y:-r/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:s,y:0},{x:n-s,y:0},{x:n,y:-r/2},{x:n-s,y:-r},{x:s,y:-r},{x:0,y:-r/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:s,y:-r},{x:n-s,y:-r},{x:n,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:n,y:-s},{x:n,y:-r+s},{x:0,y:-r}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:n,y:0},{x:0,y:-s},{x:0,y:-r+s},{x:n,y:-r}]:i.has("right")&&i.has("left")?[{x:s,y:0},{x:s,y:-l},{x:n-s,y:-l},{x:n-s,y:0},{x:n,y:-r/2},{x:n-s,y:-r},{x:n-s,y:-r+l},{x:s,y:-r+l},{x:s,y:-r},{x:0,y:-r/2}]:i.has("up")&&i.has("down")?[{x:n/2,y:0},{x:0,y:-l},{x:s,y:-l},{x:s,y:-r+l},{x:0,y:-r+l},{x:n/2,y:-r},{x:n,y:-r+l},{x:n-s,y:-r+l},{x:n-s,y:-l},{x:n,y:-l}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:n,y:-s},{x:0,y:-r}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:n,y:0},{x:0,y:-r}]:i.has("left")&&i.has("up")?[{x:n,y:0},{x:0,y:-s},{x:n,y:-r}]:i.has("left")&&i.has("down")?[{x:n,y:0},{x:0,y:0},{x:n,y:-r}]:i.has("right")?[{x:s,y:-l},{x:s,y:-l},{x:n-s,y:-l},{x:n-s,y:0},{x:n,y:-r/2},{x:n-s,y:-r},{x:n-s,y:-r+l},{x:s,y:-r+l},{x:s,y:-r+l}]:i.has("left")?[{x:s,y:0},{x:s,y:-l},{x:n-s,y:-l},{x:n-s,y:-r+l},{x:s,y:-r+l},{x:s,y:-r},{x:0,y:-r/2}]:i.has("up")?[{x:s,y:-l},{x:s,y:-r+l},{x:0,y:-r+l},{x:n/2,y:-r},{x:n,y:-r+l},{x:n-s,y:-r+l},{x:n-s,y:-l}]:i.has("down")?[{x:n/2,y:0},{x:0,y:-l},{x:s,y:-l},{x:s,y:-r+l},{x:n-s,y:-r+l},{x:n-s,y:-l},{x:n,y:-l}]:[{x:0,y:0}]},"getArrowPoints");function Ht(e,t){return e.intersect(t)}g(Ht,"intersectNode");var yr=Ht;function Zt(e,t,a,i){var o=e.x,r=e.y,s=o-i.x,n=r-i.y,l=Math.sqrt(t*t*n*n+a*a*s*s),u=Math.abs(t*a*s/l);i.x0}g(Lt,"sameSign");var xr=Gt,br=Jt;function Jt(e,t,a){var i=e.x,o=e.y,r=[],s=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(L){s=Math.min(s,L.x),n=Math.min(n,L.y)}):(s=Math.min(s,t.x),n=Math.min(n,t.y));for(var l=i-e.width/2-s,u=o-e.height/2-n,h=0;h1&&r.sort(function(L,S){var k=L.x-a.x,T=L.y-a.y,D=Math.sqrt(k*k+T*T),v=S.x-a.x,c=S.y-a.y,p=Math.sqrt(v*v+c*c);return D{var a=e.x,i=e.y,o=t.x-a,r=t.y-i,s=e.width/2,n=e.height/2,l,u;return Math.abs(r)*s>Math.abs(o)*n?(r<0&&(n=-n),l=r===0?0:n*o/r,u=n):(o<0&&(s=-s),l=s,u=o===0?0:s*r/o),{x:a+l,y:i+u}},"intersectRect"),wr=fr,N={node:yr,circle:pr,ellipse:qt,polygon:br,rect:wr},R=g(async(e,t,a,i)=>{const o=B();let r;const s=t.useHtmlLabels||H(o.flowchart.htmlLabels);a?r=a:r="node default";const n=e.insert("g").attr("class",r).attr("id",t.domId||t.id),l=n.insert("g").attr("class","label").attr("style",t.labelStyle);let u;t.labelText===void 0?u="":u=typeof t.labelText=="string"?t.labelText:t.labelText[0];const h=l.node();let x;t.labelType==="markdown"?x=Mt(l,xt(pt(u),o),{useHtmlLabels:s,width:t.width||o.flowchart.wrappingWidth,classes:"markdown-node-label"},o):x=h.appendChild(await K(xt(pt(u),o),t.labelStyle,!1,i));let f=x.getBBox();const b=t.padding/2;if(H(o.flowchart.htmlLabels)){const L=x.children[0],S=I(x),k=L.getElementsByTagName("img");if(k){const T=u.replace(/]*>/g,"").trim()==="";await Promise.all([...k].map(D=>new Promise(v=>{function c(){if(D.style.display="flex",D.style.flexDirection="column",T){const p=o.fontSize?o.fontSize:window.getComputedStyle(document.body).fontSize,w=parseInt(p,10)*5+"px";D.style.minWidth=w,D.style.maxWidth=w}else D.style.width="100%";v(D)}g(c,"setupImage"),setTimeout(()=>{D.complete&&c()}),D.addEventListener("error",c),D.addEventListener("load",c)})))}f=L.getBoundingClientRect(),S.attr("width",f.width),S.attr("height",f.height)}return s?l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):l.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:n,bbox:f,halfPadding:b,label:l}},"labelHelper"),$=g((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function F(e,t,a,i){return e.insert("polygon",":first-child").attr("points",i.map(function(o){return o.x+","+o.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}g(F,"insertPolygonShape");var mr=g(async(e,t)=>{t.useHtmlLabels||B().flowchart.htmlLabels||(t.centerLabel=!0);const{shapeSvg:a,bbox:i,halfPadding:o}=await R(e,t,"node "+t.classes,!0);m.info("Classes = ",t.classes);const r=a.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-i.width/2-o).attr("y",-i.height/2-o).attr("width",i.width+t.padding).attr("height",i.height+t.padding),$(t,r),t.intersect=function(s){return N.rect(t,s)},a},"note"),Lr=mr,Ot=g(e=>e?" "+e:"","formatClass"),W=g((e,t)=>`${t||"node default"}${Ot(e.classes)} ${Ot(e.class)}`,"getClassesFromNode"),zt=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=i.height+t.padding,s=o+r,n=[{x:s/2,y:0},{x:s,y:-s/2},{x:s/2,y:-s},{x:0,y:-s/2}];m.info("Question main (Circle)");const l=F(a,s,s,n);return l.attr("style",t.style),$(t,l),t.intersect=function(u){return m.warn("Intersect called"),N.polygon(t,n,u)},a},"question"),Sr=g((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=28,o=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}];return a.insert("polygon",":first-child").attr("points",o.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return N.circle(t,14,r)},a},"choice"),kr=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=4,r=i.height+t.padding,s=r/o,n=i.width+2*s+t.padding,l=[{x:s,y:0},{x:n-s,y:0},{x:n,y:-r/2},{x:n-s,y:-r},{x:s,y:-r},{x:0,y:-r/2}],u=F(a,n,r,l);return u.attr("style",t.style),$(t,u),t.intersect=function(h){return N.polygon(t,l,h)},a},"hexagon"),_r=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,void 0,!0),o=2,r=i.height+2*t.padding,s=r/o,n=i.width+2*s+t.padding,l=ur(t.directions,i,t),u=F(a,n,r,l);return u.attr("style",t.style),$(t,u),t.intersect=function(h){return N.polygon(t,l,h)},a},"block_arrow"),Er=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=i.height+t.padding,s=[{x:-r/2,y:0},{x:o,y:0},{x:o,y:-r},{x:-r/2,y:-r},{x:0,y:-r/2}];return F(a,o,r,s).attr("style",t.style),t.width=o+r,t.height=r,t.intersect=function(n){return N.polygon(t,s,n)},a},"rect_left_inv_arrow"),Dr=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t),!0),o=i.width+t.padding,r=i.height+t.padding,s=[{x:-2*r/6,y:0},{x:o-r/6,y:0},{x:o+2*r/6,y:-r},{x:r/6,y:-r}],n=F(a,o,r,s);return n.attr("style",t.style),$(t,n),t.intersect=function(l){return N.polygon(t,s,l)},a},"lean_right"),vr=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=i.height+t.padding,s=[{x:2*r/6,y:0},{x:o+r/6,y:0},{x:o-2*r/6,y:-r},{x:-r/6,y:-r}],n=F(a,o,r,s);return n.attr("style",t.style),$(t,n),t.intersect=function(l){return N.polygon(t,s,l)},a},"lean_left"),Nr=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=i.height+t.padding,s=[{x:-2*r/6,y:0},{x:o+2*r/6,y:0},{x:o-r/6,y:-r},{x:r/6,y:-r}],n=F(a,o,r,s);return n.attr("style",t.style),$(t,n),t.intersect=function(l){return N.polygon(t,s,l)},a},"trapezoid"),$r=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=i.height+t.padding,s=[{x:r/6,y:0},{x:o-r/6,y:0},{x:o+2*r/6,y:-r},{x:-2*r/6,y:-r}],n=F(a,o,r,s);return n.attr("style",t.style),$(t,n),t.intersect=function(l){return N.polygon(t,s,l)},a},"inv_trapezoid"),Tr=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=i.height+t.padding,s=[{x:0,y:0},{x:o+r/2,y:0},{x:o,y:-r/2},{x:o+r/2,y:-r},{x:0,y:-r}],n=F(a,o,r,s);return n.attr("style",t.style),$(t,n),t.intersect=function(l){return N.polygon(t,s,l)},a},"rect_right_inv_arrow"),Cr=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=o/2,s=r/(2.5+o/50),n=i.height+s+t.padding,l="M 0,"+s+" a "+r+","+s+" 0,0,0 "+o+" 0 a "+r+","+s+" 0,0,0 "+-o+" 0 l 0,"+n+" a "+r+","+s+" 0,0,0 "+o+" 0 l 0,"+-n,u=a.attr("label-offset-y",s).insert("path",":first-child").attr("style",t.style).attr("d",l).attr("transform","translate("+-o/2+","+-(n/2+s)+")");return $(t,u),t.intersect=function(h){const x=N.rect(t,h),f=x.x-t.x;if(r!=0&&(Math.abs(f)t.height/2-s)){let b=s*s*(1-f*f/(r*r));b!=0&&(b=Math.sqrt(b)),b=s-b,h.y-t.y>0&&(b=-b),x.y+=b}return x},a},"cylinder"),Ir=g(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:o}=await R(e,t,"node "+t.classes+" "+t.class,!0),r=a.insert("rect",":first-child"),s=t.positioned?t.width:i.width+t.padding,n=t.positioned?t.height:i.height+t.padding,l=t.positioned?-s/2:-i.width/2-o,u=t.positioned?-n/2:-i.height/2-o;if(r.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",n),t.props){const h=new Set(Object.keys(t.props));t.props.borders&&(ct(r,t.props.borders,s,n),h.delete("borders")),h.forEach(x=>{m.warn(`Unknown node property ${x}`)})}return $(t,r),t.intersect=function(h){return N.rect(t,h)},a},"rect"),Br=g(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:o}=await R(e,t,"node "+t.classes,!0),r=a.insert("rect",":first-child"),s=t.positioned?t.width:i.width+t.padding,n=t.positioned?t.height:i.height+t.padding,l=t.positioned?-s/2:-i.width/2-o,u=t.positioned?-n/2:-i.height/2-o;if(r.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",n),t.props){const h=new Set(Object.keys(t.props));t.props.borders&&(ct(r,t.props.borders,s,n),h.delete("borders")),h.forEach(x=>{m.warn(`Unknown node property ${x}`)})}return $(t,r),t.intersect=function(h){return N.rect(t,h)},a},"composite"),Or=g(async(e,t)=>{const{shapeSvg:a}=await R(e,t,"label",!0);m.trace("Classes = ",t.class);const i=a.insert("rect",":first-child"),o=0,r=0;if(i.attr("width",o).attr("height",r),a.attr("class","label edgeLabel"),t.props){const s=new Set(Object.keys(t.props));t.props.borders&&(ct(i,t.props.borders,o,r),s.delete("borders")),s.forEach(n=>{m.warn(`Unknown node property ${n}`)})}return $(t,i),t.intersect=function(s){return N.rect(t,s)},a},"labelRect");function ct(e,t,a,i){const o=[],r=g(n=>{o.push(n,0)},"addBorder"),s=g(n=>{o.push(0,n)},"skipBorder");t.includes("t")?(m.debug("add top border"),r(a)):s(a),t.includes("r")?(m.debug("add right border"),r(i)):s(i),t.includes("b")?(m.debug("add bottom border"),r(a)):s(a),t.includes("l")?(m.debug("add left border"),r(i)):s(i),e.attr("stroke-dasharray",o.join(" "))}g(ct,"applyNodePropertyBorders");var zr=g(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";const i=e.insert("g").attr("class",a).attr("id",t.domId||t.id),o=i.insert("rect",":first-child"),r=i.insert("line"),s=i.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText;let l="";typeof n=="object"?l=n[0]:l=n,m.info("Label text abc79",l,n,typeof n=="object");const u=s.node().appendChild(await K(l,t.labelStyle,!0,!0));let h={width:0,height:0};if(H(B().flowchart.htmlLabels)){const S=u.children[0],k=I(u);h=S.getBoundingClientRect(),k.attr("width",h.width),k.attr("height",h.height)}m.info("Text 2",n);const x=n.slice(1,n.length);let f=u.getBBox();const b=s.node().appendChild(await K(x.join?x.join("
"):x,t.labelStyle,!0,!0));if(H(B().flowchart.htmlLabels)){const S=b.children[0],k=I(b);h=S.getBoundingClientRect(),k.attr("width",h.width),k.attr("height",h.height)}const L=t.padding/2;return I(b).attr("transform","translate( "+(h.width>f.width?0:(f.width-h.width)/2)+", "+(f.height+L+5)+")"),I(u).attr("transform","translate( "+(h.width{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.height+t.padding,r=i.width+o/4+t.padding,s=a.insert("rect",":first-child").attr("style",t.style).attr("rx",o/2).attr("ry",o/2).attr("x",-r/2).attr("y",-o/2).attr("width",r).attr("height",o);return $(t,s),t.intersect=function(n){return N.rect(t,n)},a},"stadium"),Ar=g(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:o}=await R(e,t,W(t,void 0),!0),r=a.insert("circle",":first-child");return r.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+o).attr("width",i.width+t.padding).attr("height",i.height+t.padding),m.info("Circle main"),$(t,r),t.intersect=function(s){return m.info("Circle intersect",t,i.width/2+o,s),N.circle(t,i.width/2+o,s)},a},"circle"),Mr=g(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:o}=await R(e,t,W(t,void 0),!0),r=5,s=a.insert("g",":first-child"),n=s.insert("circle"),l=s.insert("circle");return s.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+o+r).attr("width",i.width+t.padding+r*2).attr("height",i.height+t.padding+r*2),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+o).attr("width",i.width+t.padding).attr("height",i.height+t.padding),m.info("DoubleCircle main"),$(t,n),t.intersect=function(u){return m.info("DoubleCircle intersect",t,i.width/2+o+r,u),N.circle(t,i.width/2+o+r,u)},a},"doublecircle"),Pr=g(async(e,t)=>{const{shapeSvg:a,bbox:i}=await R(e,t,W(t,void 0),!0),o=i.width+t.padding,r=i.height+t.padding,s=[{x:0,y:0},{x:o,y:0},{x:o,y:-r},{x:0,y:-r},{x:0,y:0},{x:-8,y:0},{x:o+8,y:0},{x:o+8,y:-r},{x:-8,y:-r},{x:-8,y:0}],n=F(a,o,r,s);return n.attr("style",t.style),$(t,n),t.intersect=function(l){return N.polygon(t,s,l)},a},"subroutine"),Yr=g((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=a.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),$(t,i),t.intersect=function(o){return N.circle(t,7,o)},a},"start"),Rt=g((e,t,a)=>{const i=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let o=70,r=10;a==="LR"&&(o=10,r=70);const s=i.append("rect").attr("x",-1*o/2).attr("y",-1*r/2).attr("width",o).attr("height",r).attr("class","fork-join");return $(t,s),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return N.rect(t,n)},i},"forkJoin"),Wr=g((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=a.insert("circle",":first-child"),o=a.insert("circle",":first-child");return o.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),i.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),$(t,o),t.intersect=function(r){return N.circle(t,7,r)},a},"end"),Xr=g(async(e,t)=>{const a=t.padding/2,i=4,o=8;let r;t.classes?r="node "+t.classes:r="node default";const s=e.insert("g").attr("class",r).attr("id",t.domId||t.id),n=s.insert("rect",":first-child"),l=s.insert("line"),u=s.insert("line");let h=0,x=i;const f=s.insert("g").attr("class","label");let b=0;const L=t.classData.annotations?.[0],S=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",k=f.node().appendChild(await K(S,t.labelStyle,!0,!0));let T=k.getBBox();if(H(B().flowchart.htmlLabels)){const d=k.children[0],_=I(k);T=d.getBoundingClientRect(),_.attr("width",T.width),_.attr("height",T.height)}t.classData.annotations[0]&&(x+=T.height+i,h+=T.width);let D=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(B().flowchart.htmlLabels?D+="<"+t.classData.type+">":D+="<"+t.classData.type+">");const v=f.node().appendChild(await K(D,t.labelStyle,!0,!0));I(v).attr("class","classTitle");let c=v.getBBox();if(H(B().flowchart.htmlLabels)){const d=v.children[0],_=I(v);c=d.getBoundingClientRect(),_.attr("width",c.width),_.attr("height",c.height)}x+=c.height+i,c.width>h&&(h=c.width);const p=[];t.classData.members.forEach(async d=>{const _=d.getDisplayDetails();let y=_.displayText;B().flowchart.htmlLabels&&(y=y.replace(//g,">"));const A=f.node().appendChild(await K(y,_.cssStyle?_.cssStyle:t.labelStyle,!0,!0));let O=A.getBBox();if(H(B().flowchart.htmlLabels)){const q=A.children[0],j=I(A);O=q.getBoundingClientRect(),j.attr("width",O.width),j.attr("height",O.height)}O.width>h&&(h=O.width),x+=O.height+i,p.push(A)}),x+=o;const w=[];if(t.classData.methods.forEach(async d=>{const _=d.getDisplayDetails();let y=_.displayText;B().flowchart.htmlLabels&&(y=y.replace(//g,">"));const A=f.node().appendChild(await K(y,_.cssStyle?_.cssStyle:t.labelStyle,!0,!0));let O=A.getBBox();if(H(B().flowchart.htmlLabels)){const q=A.children[0],j=I(A);O=q.getBoundingClientRect(),j.attr("width",O.width),j.attr("height",O.height)}O.width>h&&(h=O.width),x+=O.height+i,w.push(A)}),x+=o,L){let d=(h-T.width)/2;I(k).attr("transform","translate( "+(-1*h/2+d)+", "+-1*x/2+")"),b=T.height+i}let E=(h-c.width)/2;return I(v).attr("transform","translate( "+(-1*h/2+E)+", "+(-1*x/2+b)+")"),b+=c.height+i,l.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-x/2-a+o+b).attr("y2",-x/2-a+o+b),b+=o,p.forEach(d=>{I(d).attr("transform","translate( "+-h/2+", "+(-1*x/2+b+o/2)+")");const _=d?.getBBox();b+=(_?.height??0)+i}),b+=o,u.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-x/2-a+o+b).attr("y2",-x/2-a+o+b),b+=o,w.forEach(d=>{I(d).attr("transform","translate( "+-h/2+", "+(-1*x/2+b)+")");const _=d?.getBBox();b+=(_?.height??0)+i}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-h/2-a).attr("y",-(x/2)-a).attr("width",h+t.padding).attr("height",x+t.padding),$(t,n),t.intersect=function(d){return N.rect(t,d)},s},"class_box"),At={rhombus:zt,composite:Br,question:zt,rect:Ir,labelRect:Or,rectWithTitle:zr,choice:Sr,circle:Ar,doublecircle:Mr,stadium:Rr,hexagon:kr,block_arrow:_r,rect_left_inv_arrow:Er,lean_right:Dr,lean_left:vr,trapezoid:Nr,inv_trapezoid:$r,rect_right_inv_arrow:Tr,cylinder:Cr,start:Yr,end:Wr,note:Lr,subroutine:Pr,fork:Rt,join:Rt,class_box:Xr},nt={},Qt=g(async(e,t,a)=>{let i,o;if(t.link){let r;B().securityLevel==="sandbox"?r="_top":t.linkTarget&&(r=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",r),o=await At[t.shape](i,t,a)}else o=await At[t.shape](e,t,a),i=o;return t.tooltip&&o.attr("title",t.tooltip),t.class&&o.attr("class","node default "+t.class),nt[t.id]=i,t.haveCallback&&nt[t.id].attr("class",nt[t.id].attr("class")+" clickable"),i},"insertNode"),Kr=g(e=>{const t=nt[e.id];m.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-a)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode");function Dt(e,t,a=!1){const i=e;let o="default";(i?.classes?.length||0)>0&&(o=(i?.classes??[]).join(" ")),o=o+" flowchart-label";let r=0,s="",n;switch(i.type){case"round":r=5,s="rect";break;case"composite":r=0,s="composite",n=0;break;case"square":s="rect";break;case"diamond":s="question";break;case"hexagon":s="hexagon";break;case"block_arrow":s="block_arrow";break;case"odd":s="rect_left_inv_arrow";break;case"lean_right":s="lean_right";break;case"lean_left":s="lean_left";break;case"trapezoid":s="trapezoid";break;case"inv_trapezoid":s="inv_trapezoid";break;case"rect_left_inv_arrow":s="rect_left_inv_arrow";break;case"circle":s="circle";break;case"ellipse":s="ellipse";break;case"stadium":s="stadium";break;case"subroutine":s="subroutine";break;case"cylinder":s="cylinder";break;case"group":s="rect";break;case"doublecircle":s="doublecircle";break;default:s="rect"}const l=we(i?.styles??[]),u=i.label,h=i.size??{width:0,height:0,x:0,y:0};return{labelStyle:l.labelStyle,shape:s,labelText:u,rx:r,ry:r,class:o,style:l.style,id:i.id,directions:i.directions,width:h.width,height:h.height,x:h.x,y:h.y,positioned:a,intersect:void 0,type:i.type,padding:n??rt()?.block?.padding??0}}g(Dt,"getNodeFromBlock");async function te(e,t,a){const i=Dt(t,a,!1);if(i.type==="group")return;const o=rt(),r=await Qt(e,i,{config:o}),s=r.node().getBBox(),n=a.getBlock(i.id);n.size={width:s.width,height:s.height,x:0,y:0,node:r},a.setBlock(n),r.remove()}g(te,"calculateBlockSize");async function ee(e,t,a){const i=Dt(t,a,!0);if(a.getBlock(i.id).type!=="space"){const o=rt();await Qt(e,i,{config:o}),t.intersect=i?.intersect,Kr(i)}}g(ee,"insertBlockPositioned");async function dt(e,t,a,i){for(const o of t)await i(e,o,a),o.children&&await dt(e,o.children,a,i)}g(dt,"performOperations");async function re(e,t,a){await dt(e,t,a,te)}g(re,"calculateBlockSizes");async function ae(e,t,a){await dt(e,t,a,ee)}g(ae,"insertBlocks");async function se(e,t,a,i,o){const r=new Le({multigraph:!0,compound:!0});r.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const s of a)s.size&&r.setNode(s.id,{width:s.size.width,height:s.size.height,intersect:s.intersect});for(const s of t)if(s.start&&s.end){const n=i.getBlock(s.start),l=i.getBlock(s.end);if(n?.size&&l?.size){const u=n.size,h=l.size,x=[{x:u.x,y:u.y},{x:u.x+(h.x-u.x)/2,y:u.y+(h.y-u.y)/2},{x:h.x,y:h.y}];hr(e,{v:s.start,w:s.end,name:s.id},{...s,arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",r,o),s.label&&(await or(e,{...s,label:s.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),lr({...s,x:x[1].x,y:x[1].y},{originalPath:x}))}}}g(se,"insertEdges");var Ur=g(function(e,t){return t.db.getClasses()},"getClasses"),Fr=g(async function(e,t,a,i){const{securityLevel:o,block:r}=rt(),s=i.db;let n;o==="sandbox"&&(n=I("#i"+t));const l=o==="sandbox"?I(n.nodes()[0].contentDocument.body):I("body"),u=o==="sandbox"?l.select(`[id="${t}"]`):I(`[id="${t}"]`);rr(u,["point","circle","cross"],i.type,t);const h=s.getBlocks(),x=s.getBlocksFlat(),f=s.getEdges(),b=u.insert("g").attr("class","block");await re(b,h,s);const L=Ft(s);if(await ae(b,h,s),await se(b,f,x,s,t),L){const S=L,k=Math.max(1,Math.round(.125*(S.width/S.height))),T=S.height+k+10,D=S.width+10,{useMaxWidth:v}=r;ce(u,T,D,!!v),m.debug("Here Bounds",L,S),u.attr("viewBox",`${S.x-5} ${S.y-5} ${S.width+10} ${S.height+10}`)}},"draw"),jr={draw:Fr,getClasses:Ur},sa={parser:ke,db:Xe,renderer:jr,styles:Ue};export{sa as diagram}; //# sourceMappingURL=blockDiagram-VD42YOAC-DK0_Jwr9.chunk.mjs.map