UNPKG

epic-designer-gold

Version:

基于vue3的设计器,可视化开发页面表单

133 lines 74.2 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("./chunk-FMBD7UC4-BjaiL6Q2.cjs"),n=require("./mermaid.core-amipJqhv.cjs"),ee=require("./clone-C6ujOTzW.cjs"),re=require("./graph-CxxKh2B7.cjs"),ae=require("./channel-CD0wv0JE.cjs");var gt=function(){var e=n.__name(function(T,y,u,f){for(u=u||{},f=T.length;f--;u[T[f]]=y);return u},"o"),t=[1,15],a=[1,7],i=[1,13],c=[1,14],s=[1,19],r=[1,16],l=[1,17],o=[1,18],x=[8,30],g=[8,10,21,28,29,30,31,39,43,46],p=[1,23],_=[1,24],m=[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],E=[1,49],w={trace:n.__name(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:n.__name(function(y,u,f,L,S,h,v){var d=h.length-1;switch(S){case 4:L.getLogger().debug("Rule: separator (NL) ");break;case 5:L.getLogger().debug("Rule: separator (Space) ");break;case 6:L.getLogger().debug("Rule: separator (EOF) ");break;case 7:L.getLogger().debug("Rule: hierarchy: ",h[d-1]),L.setHierarchy(h[d-1]);break;case 8:L.getLogger().debug("Stop NL ");break;case 9:L.getLogger().debug("Stop EOF ");break;case 10:L.getLogger().debug("Stop NL2 ");break;case 11:L.getLogger().debug("Stop EOF2 ");break;case 12:L.getLogger().debug("Rule: statement: ",h[d]),typeof h[d].length=="number"?this.$=h[d]:this.$=[h[d]];break;case 13:L.getLogger().debug("Rule: statement #2: ",h[d-1]),this.$=[h[d-1]].concat(h[d]);break;case 14:L.getLogger().debug("Rule: link: ",h[d],y),this.$={edgeTypeStr:h[d],label:""};break;case 15:L.getLogger().debug("Rule: LABEL link: ",h[d-3],h[d-1],h[d]),this.$={edgeTypeStr:h[d],label:h[d-1]};break;case 18:const k=parseInt(h[d]),D=L.generateId();this.$={id:D,type:"space",label:"",width:k,children:[]};break;case 23:L.getLogger().debug("Rule: (nodeStatement link node) ",h[d-2],h[d-1],h[d]," typestr: ",h[d-1].edgeTypeStr);const H=L.edgeStrToEdgeData(h[d-1].edgeTypeStr);this.$=[{id:h[d-2].id,label:h[d-2].label,type:h[d-2].type,directions:h[d-2].directions},{id:h[d-2].id+"-"+h[d].id,start:h[d-2].id,end:h[d].id,label:h[d-1].label,type:"edge",directions:h[d].directions,arrowTypeEnd:H,arrowTypeStart:"arrow_open"},{id:h[d].id,label:h[d].label,type:L.typeStr2Type(h[d].typeStr),directions:h[d].directions}];break;case 24:L.getLogger().debug("Rule: nodeStatement (abc88 node size) ",h[d-1],h[d]),this.$={id:h[d-1].id,label:h[d-1].label,type:L.typeStr2Type(h[d-1].typeStr),directions:h[d-1].directions,widthInColumns:parseInt(h[d],10)};break;case 25:L.getLogger().debug("Rule: nodeStatement (node) ",h[d]),this.$={id:h[d].id,label:h[d].label,type:L.typeStr2Type(h[d].typeStr),directions:h[d].directions,widthInColumns:1};break;case 26:L.getLogger().debug("APA123",this?this:"na"),L.getLogger().debug("COLUMNS: ",h[d]),this.$={type:"column-setting",columns:h[d]==="auto"?-1:parseInt(h[d])};break;case 27:L.getLogger().debug("Rule: id-block statement : ",h[d-2],h[d-1]),L.generateId(),this.$={...h[d-2],type:"composite",children:h[d-1]};break;case 28:L.getLogger().debug("Rule: blockStatement : ",h[d-2],h[d-1],h[d]);const A=L.generateId();this.$={id:A,type:"composite",label:"",children:h[d-1]};break;case 29:L.getLogger().debug("Rule: node (NODE_ID separator): ",h[d]),this.$={id:h[d]};break;case 30:L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",h[d-1],h[d]),this.$={id:h[d-1],label:h[d].label,typeStr:h[d].typeStr,directions:h[d].directions};break;case 31:L.getLogger().debug("Rule: dirList: ",h[d]),this.$=[h[d]];break;case 32:L.getLogger().debug("Rule: dirList: ",h[d-1],h[d]),this.$=[h[d-1]].concat(h[d]);break;case 33:L.getLogger().debug("Rule: nodeShapeNLabel: ",h[d-2],h[d-1],h[d]),this.$={typeStr:h[d-2]+h[d],label:h[d-1]};break;case 34:L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",h[d-3],h[d-2]," #3:",h[d-1],h[d]),this.$={typeStr:h[d-3]+h[d],label:h[d-2],directions:h[d-1]};break;case 35:case 36:this.$={type:"classDef",id:h[d-1].trim(),css:h[d].trim()};break;case 37:this.$={type:"applyClass",id:h[d-1].trim(),styleClass:h[d].trim()};break;case 38:this.$={type:"applyStyles",id:h[d-1].trim(),stylesStr:h[d].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:c,31:s,39:r,43:l,46:o},{8:[1,20]},e(x,[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:c,31:s,39:r,43:l,46:o}),e(g,[2,16],{14:22,15:p,16:_}),e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),e(g,[2,21]),e(g,[2,22]),e(m,[2,25],{27:[1,25]}),e(g,[2,26]),{19:26,26:12,31:s},{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:c,31:s,39:r,43:l,46:o},{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(x,[2,13]),{26:35,31:s},{31:[2,14]},{17:[1,36]},e(m,[2,24]),{10:t,11:37,13:4,14:22,15:p,16:_,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:c,31:s,39:r,43:l,46:o},{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(m,[2,23]),{18:[1,45]},{30:[1,46]},e(g,[2,28]),e(g,[2,35]),e(g,[2,36]),e(g,[2,37]),e(g,[2,38]),{36:[1,47]},{33:48,34:E},{15:[1,50]},e(g,[2,27]),e(b,[2,33]),{38:[1,51]},{33:52,34:E,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:n.__name(function(y,u){if(u.recoverable)this.trace(y);else{var f=new Error(y);throw f.hash=u,f}},"parseError"),parse:n.__name(function(y){var u=this,f=[0],L=[],S=[null],h=[],v=this.table,d="",k=0,D=0,H=2,A=1,q=h.slice.call(arguments,1),B=Object.create(this.lexer),P={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(P.yy[J]=this.yy[J]);B.setInput(y,P.yy),P.yy.lexer=B,P.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var Q=B.yylloc;h.push(Q);var Qt=B.options&&B.options.ranges;typeof P.yy.parseError=="function"?this.parseError=P.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function $t(W){f.length=f.length-2*W,S.length=S.length-W,h.length=h.length-W}n.__name($t,"popStack");function wt(){var W;return W=L.pop()||B.lex()||A,typeof W!="number"&&(W instanceof Array&&(L=W,W=L.pop()),W=u.symbols_[W]||W),W}n.__name(wt,"lex");for(var F,Z,K,ct,G={},et,V,Lt,rt;;){if(Z=f[f.length-1],this.defaultActions[Z]?K=this.defaultActions[Z]:((F===null||typeof F>"u")&&(F=wt()),K=v[Z]&&v[Z][F]),typeof K>"u"||!K.length||!K[0]){var ot="";rt=[];for(et in v[Z])this.terminals_[et]&&et>H&&rt.push("'"+this.terminals_[et]+"'");B.showPosition?ot="Parse error on line "+(k+1)+`:
`+B.showPosition()+`
Expecting `+rt.join(", ")+", got '"+(this.terminals_[F]||F)+"'":ot="Parse error on line "+(k+1)+": Unexpected "+(F==A?"end of input":"'"+(this.terminals_[F]||F)+"'"),this.parseError(ot,{text:B.match,token:this.terminals_[F]||F,line:B.yylineno,loc:Q,expected:rt})}if(K[0]instanceof Array&&K.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Z+", token: "+F);switch(K[0]){case 1:f.push(F),S.push(B.yytext),h.push(B.yylloc),f.push(K[1]),F=null,D=B.yyleng,d=B.yytext,k=B.yylineno,Q=B.yylloc;break;case 2:if(V=this.productions_[K[1]][1],G.$=S[S.length-V],G._$={first_line:h[h.length-(V||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(V||1)].first_column,last_column:h[h.length-1].last_column},Qt&&(G._$.range=[h[h.length-(V||1)].range[0],h[h.length-1].range[1]]),ct=this.performAction.apply(G,[d,D,k,P.yy,K[1],S,h].concat(q)),typeof ct<"u")return ct;V&&(f=f.slice(0,-1*V*2),S=S.slice(0,-1*V),h=h.slice(0,-1*V)),f.push(this.productions_[K[1]][0]),S.push(G.$),h.push(G._$),Lt=v[f[f.length-2]][f[f.length-1]],f.push(Lt);break;case 3:return!0}}return!0},"parse")},N=function(){var T={EOF:1,parseError:n.__name(function(u,f){if(this.yy.parser)this.yy.parser.parseError(u,f);else throw new Error(u)},"parseError"),setInput:n.__name(function(y,u){return this.yy=u||this.yy||{},this._input=y,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:n.__name(function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.offset++,this.match+=y,this.matched+=y;var u=y.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),y},"input"),unput:n.__name(function(y){var u=y.length,f=y.split(/(?:\r\n?|\n)/g);this._input=y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var L=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),f.length-1&&(this.yylineno-=f.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===L.length?this.yylloc.first_column:0)+L[L.length-f.length].length-f[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:n.__name(function(){return this._more=!0,this},"more"),reject:n.__name(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n.__name(function(y){this.unput(this.match.slice(y))},"less"),pastInput:n.__name(function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n.__name(function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n.__name(function(){var y=this.pastInput(),u=new Array(y.length+1).join("-");return y+this.upcomingInput()+`
`+u+"^"},"showPosition"),test_match:n.__name(function(y,u){var f,L,S;if(this.options.backtrack_lexer&&(S={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(S.yylloc.range=this.yylloc.range.slice(0))),L=y[0].match(/(?:\r\n?|\n).*/g),L&&(this.yylineno+=L.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:L?L[L.length-1].length-L[L.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+y[0].length},this.yytext+=y[0],this.match+=y[0],this.matches=y,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(y[0].length),this.matched+=y[0],f=this.performAction.call(this,this.yy,this,u,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),f)return f;if(this._backtrack){for(var h in S)this[h]=S[h];return!1}return!1},"test_match"),next:n.__name(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var y,u,f,L;this._more||(this.yytext="",this.match="");for(var S=this._currentRules(),h=0;h<S.length;h++)if(f=this._input.match(this.rules[S[h]]),f&&(!u||f[0].length>u[0].length)){if(u=f,L=h,this.options.backtrack_lexer){if(y=this.test_match(f,S[h]),y!==!1)return y;if(this._backtrack){u=!1;continue}else return!1}else if(!this.options.flex)break}return u?(y=this.test_match(u,S[L]),y!==!1?y:!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:n.__name(function(){var u=this.next();return u||this.lex()},"lex"),begin:n.__name(function(u){this.conditionStack.push(u)},"begin"),popState:n.__name(function(){var u=this.conditionStack.length-1;return u>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:n.__name(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:n.__name(function(u){return u=this.conditionStack.length-1-Math.abs(u||0),u>=0?this.conditionStack[u]:"INITIAL"},"topState"),pushState:n.__name(function(u){this.begin(u)},"pushState"),stateStackSize:n.__name(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:n.__name(function(u,f,L,S){switch(L){case 0:return u.getLogger().debug("Found block-beta"),10;case 1:return u.getLogger().debug("Found id-block"),29;case 2:return u.getLogger().debug("Found block"),10;case 3:u.getLogger().debug(".",f.yytext);break;case 4:u.getLogger().debug("_",f.yytext);break;case 5:return 5;case 6:return f.yytext=-1,28;case 7:return f.yytext=f.yytext.replace(/columns\s+/,""),u.getLogger().debug("COLUMNS (LEX)",f.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:u.getLogger().debug("LEX: POPPING STR:",f.yytext),this.popState();break;case 13:return u.getLogger().debug("LEX: STR end:",f.yytext),"STR";case 14:return f.yytext=f.yytext.replace(/space\:/,""),u.getLogger().debug("SPACE NUM (LEX)",f.yytext),21;case 15:return f.yytext="1",u.getLogger().debug("COLUMNS (LEX)",f.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(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),u.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),u.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),u.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),u.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),u.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),u.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),u.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),u.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),u.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),u.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),u.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),u.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return u.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return u.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return u.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return u.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return u.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return u.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return u.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 u.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),u.getLogger().debug("LEX ARR START"),37;case 74:return u.getLogger().debug("Lex: NODE_ID",f.yytext),31;case 75:return u.getLogger().debug("Lex: EOF",f.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:u.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:u.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return u.getLogger().debug("LEX: NODE_DESCR:",f.yytext),"NODE_DESCR";case 83:u.getLogger().debug("LEX POPPING"),this.popState();break;case 84:u.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return f.yytext=f.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (right): dir:",f.yytext),"DIR";case 86:return f.yytext=f.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (left):",f.yytext),"DIR";case 87:return f.yytext=f.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (x):",f.yytext),"DIR";case 88:return f.yytext=f.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (y):",f.yytext),"DIR";case 89:return f.yytext=f.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (up):",f.yytext),"DIR";case 90:return f.yytext=f.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (down):",f.yytext),"DIR";case 91:return f.yytext="]>",u.getLogger().debug("Lex (ARROW_DIR end):",f.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return u.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 93:return u.getLogger().debug("Lex: LINK",f.yytext),15;case 94:return u.getLogger().debug("Lex: LINK",f.yytext),15;case 95:return u.getLogger().debug("Lex: LINK",f.yytext),15;case 96:return u.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 97:return u.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 98:return u.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return u.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),u.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 102:return this.popState(),u.getLogger().debug("Lex: LINK",f.yytext),15;case 103:return this.popState(),u.getLogger().debug("Lex: LINK",f.yytext),15;case 104:return u.getLogger().debug("Lex: COLON",f.yytext),f.yytext=f.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 T}();w.lexer=N;function C(){this.yy={}}return n.__name(C,"Parser"),C.prototype=w,w.Parser=C,new C}();gt.parser=gt;var se=gt,X=new Map,xt=[],dt=new Map,St="color",vt="fill",ie="bgFill",Rt=",",ne=n.getConfig2(),st=new Map,le=n.__name(e=>n.common_default.sanitizeText(e,ne),"sanitizeText"),ce=n.__name(function(e,t=""){let a=st.get(e);a||(a={id:e,styles:[],textStyles:[]},st.set(e,a)),t!=null&&t.split(Rt).forEach(i=>{const c=i.replace(/([^;]*);/,"$1").trim();if(RegExp(St).exec(i)){const r=c.replace(vt,ie).replace(St,vt);a.textStyles.push(r)}a.styles.push(c)})},"addStyleClass"),oe=n.__name(function(e,t=""){const a=X.get(e);t!=null&&(a.styles=t.split(Rt))},"addStyle2Node"),he=n.__name(function(e,t){e.split(",").forEach(function(a){let i=X.get(a);if(i===void 0){const c=a.trim();i={id:c,type:"na",children:[]},X.set(c,i)}i.classes||(i.classes=[]),i.classes.push(t)})},"setCssClass"),zt=n.__name((e,t)=>{const a=e.flat(),i=[],c=a.find(r=>(r==null?void 0:r.type)==="column-setting"),s=(c==null?void 0:c.columns)??-1;for(const r of a){if(typeof s=="number"&&s>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>s&&n.log.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${s}`),r.label&&(r.label=le(r.label)),r.type==="classDef"){ce(r.id,r.css);continue}if(r.type==="applyClass"){he(r.id,(r==null?void 0:r.styleClass)??"");continue}if(r.type==="applyStyles"){r!=null&&r.stylesStr&&oe(r.id,r==null?void 0:r.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const l=(dt.get(r.id)??0)+1;dt.set(r.id,l),r.id=l+"-"+r.id,xt.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const l=X.get(r.id);if(l===void 0?X.set(r.id,r):(r.type!=="na"&&(l.type=r.type),r.label!==r.id&&(l.label=r.label)),r.children&&zt(r.children,r),r.type==="space"){const o=r.width??1;for(let x=0;x<o;x++){const g=ee.clone(r);g.id=g.id+"-"+x,X.set(g.id,g),i.push(g)}}else l===void 0&&i.push(r)}}t.children=i},"populateBlockDatabase"),yt=[],tt={id:"root",type:"composite",children:[],columns:-1},ge=n.__name(()=>{n.log.debug("Clear called"),n.clear(),tt={id:"root",type:"composite",children:[],columns:-1},X=new Map([["root",tt]]),yt=[],st=new Map,xt=[],dt=new Map},"clear");function At(e){switch(n.log.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return n.log.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"}}n.__name(At,"typeStr2Type");function Mt(e){switch(n.log.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}n.__name(Mt,"edgeTypeStr2Type");function Ft(e){switch(e.replace(/^[\s-]+|[\s-]+$/g,"")){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}n.__name(Ft,"edgeStrToEdgeData");var Et=0,de=n.__name(()=>(Et++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Et),"generateId"),ue=n.__name(e=>{tt.children=e,zt(e,tt),yt=tt.children},"setHierarchy"),fe=n.__name(e=>{const t=X.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),pe=n.__name(()=>[...X.values()],"getBlocksFlat"),xe=n.__name(()=>yt||[],"getBlocks"),ye=n.__name(()=>xt,"getEdges"),me=n.__name(e=>X.get(e),"getBlock"),_e=n.__name(e=>{X.set(e.id,e)},"setBlock"),be=n.__name(()=>n.log,"getLogger"),we=n.__name(function(){return st},"getClasses"),Le={getConfig:n.__name(()=>n.getConfig().block,"getConfig"),typeStr2Type:At,edgeTypeStr2Type:Mt,edgeStrToEdgeData:Ft,getLogger:be,getBlocksFlat:pe,getBlocks:xe,getEdges:ye,setHierarchy:ue,getBlock:me,setBlock:_e,getColumns:fe,getClasses:we,clear:ge,generateId:de},Se=Le,ht=n.__name((e,t)=>{const a=ae.channel,i=a(e,"r"),c=a(e,"g"),s=a(e,"b");return n.rgba(i,c,s,t)},"fade"),ve=n.__name(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};
    /*
     * 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: ${ht(e.mainBkg,.5)};
    fill: ${ht(e.clusterBkg,.5)};
    stroke: ${ht(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};
  }
  ${te.getIconStyles()}
`,"getStyles"),Ee=ve,ke=n.__name((e,t,a,i)=>{t.forEach(c=>{Ae[c](e,a,i)})},"insertMarkers"),De=n.__name((e,t,a)=>{n.log.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"),Te=n.__name((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"),Ce=n.__name((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"),Ne=n.__name((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"),Ie=n.__name((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"),Be=n.__name((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"),Oe=n.__name((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"),Re=n.__name((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"),ze=n.__name((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"),Ae={extension:De,composition:Te,aggregation:Ce,dependency:Ne,lollipop:Ie,point:Be,circle:Oe,cross:Re,barb:ze},Me=ke,Bt,Ot,R=((Ot=(Bt=n.getConfig2())==null?void 0:Bt.block)==null?void 0:Ot.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}}n.__name(ut,"calculateBlockPosition");var Fe=n.__name(e=>{let t=0,a=0;for(const i of e.children){const{width:c,height:s,x:r,y:l}=i.size??{width:0,height:0,x:0,y:0};n.log.debug("getMaxChildSize abc95 child:",i.id,"width:",c,"height:",s,"x:",r,"y:",l,i.type),i.type!=="space"&&(c>t&&(t=c/(i.widthInColumns??1)),s>a&&(a=s))}return{width:t,height:a}},"getMaxChildSize");function it(e,t,a=0,i=0){var r,l,o,x,g,p,_,m,b,E,w;n.log.debug("setBlockSizes abc95 (start)",e.id,(r=e==null?void 0:e.size)==null?void 0:r.x,"block width =",e==null?void 0:e.size,"siblingWidth",a),(l=e==null?void 0:e.size)!=null&&l.width||(e.size={width:a,height:i,x:0,y:0});let c=0,s=0;if(((o=e.children)==null?void 0:o.length)>0){for(const S of e.children)it(S,t);const N=Fe(e);c=N.width,s=N.height,n.log.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",c,s);for(const S of e.children)S.size&&(n.log.debug(`abc95 Setting size of children of ${e.id} id=${S.id} ${c} ${s} ${JSON.stringify(S.size)}`),S.size.width=c*(S.widthInColumns??1)+R*((S.widthInColumns??1)-1),S.size.height=s,S.size.x=0,S.size.y=0,n.log.debug(`abc95 updating size of ${e.id} children child:${S.id} maxWidth:${c} maxHeight:${s}`));for(const S of e.children)it(S,t,c,s);const C=e.columns??-1;let T=0;for(const S of e.children)T+=S.widthInColumns??1;let y=e.children.length;C>0&&C<T&&(y=C);const u=Math.ceil(T/y);let f=y*(c+R)+R,L=u*(s+R)+R;if(f<a){n.log.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${i} width ${f}`),f=a,L=i;const S=(a-y*R-R)/y,h=(i-u*R-R)/u;n.log.debug("Size indata abc88",e.id,"childWidth",S,"maxWidth",c),n.log.debug("Size indata abc88",e.id,"childHeight",h,"maxHeight",s),n.log.debug("Size indata abc88 xSize",y,"padding",R);for(const v of e.children)v.size&&(v.size.width=S,v.size.height=h,v.size.x=0,v.size.y=0)}if(n.log.debug(`abc95 (finale calc) ${e.id} xSize ${y} ySize ${u} columns ${C}${e.children.length} width=${Math.max(f,((x=e.size)==null?void 0:x.width)||0)}`),f<(((g=e==null?void 0:e.size)==null?void 0:g.width)||0)){f=((p=e==null?void 0:e.size)==null?void 0:p.width)||0;const S=C>0?Math.min(e.children.length,C):e.children.length;if(S>0){const h=(f-S*R-R)/S;n.log.debug("abc95 (growing to fit) width",e.id,f,(_=e.size)==null?void 0:_.width,h);for(const v of e.children)v.size&&(v.size.width=h)}}e.size={width:f,height:L,x:0,y:0}}n.log.debug("setBlockSizes abc94 (done)",e.id,(m=e==null?void 0:e.size)==null?void 0:m.x,(b=e==null?void 0:e.size)==null?void 0:b.width,(E=e==null?void 0:e.size)==null?void 0:E.y,(w=e==null?void 0:e.size)==null?void 0:w.height)}n.__name(it,"setBlockSizes");function mt(e,t){var i,c,s,r,l,o,x,g,p,_,m,b,E,w,N,C,T;n.log.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(i=e==null?void 0:e.size)==null?void 0:i.x} y: ${(c=e==null?void 0:e.size)==null?void 0:c.y} width: ${(s=e==null?void 0:e.size)==null?void 0:s.width}`);const a=e.columns??-1;if(n.log.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const y=((l=(r=e==null?void 0:e.children[0])==null?void 0:r.size)==null?void 0:l.width)??0,u=e.children.length*y+(e.children.length-1)*R;n.log.debug("widthOfChildren 88",u,"posX");const f=new Map;{let d=0;for(const k of e.children){if(!k.size)continue;const{py:D}=ut(a,d),H=f.get(D)??0;k.size.height>H&&f.set(D,k.size.height);let A=(k==null?void 0:k.widthInColumns)??1;a>0&&(A=Math.min(A,a-d%a)),d+=A}}const L=new Map;{let d=0;const k=[...f.keys()].sort((D,H)=>D-H);for(const D of k)L.set(D,d),d+=(f.get(D)??0)+R}let S=0;n.log.debug("abc91 block?.size?.x",e.id,(o=e==null?void 0:e.size)==null?void 0:o.x);let h=(x=e==null?void 0:e.size)!=null&&x.x?((g=e==null?void 0:e.size)==null?void 0:g.x)+(-((p=e==null?void 0:e.size)==null?void 0:p.width)/2||0):-R,v=0;for(const d of e.children){const k=e;if(!d.size)continue;const{width:D,height:H}=d.size,{px:A,py:q}=ut(a,S);if(q!=v&&(v=q,h=(_=e==null?void 0:e.size)!=null&&_.x?((m=e==null?void 0:e.size)==null?void 0:m.x)+(-((b=e==null?void 0:e.size)==null?void 0:b.width)/2||0):-R,n.log.debug("New row in layout for block",e.id," and child ",d.id,v)),n.log.debug(`abc89 layout blocks (child) id: ${d.id} Pos: ${S} (px, py) ${A},${q} (${(E=k==null?void 0:k.size)==null?void 0:E.x},${(w=k==null?void 0:k.size)==null?void 0:w.y}) parent: ${k.id} width: ${D}${R}`),k.size){const P=D/2;d.size.x=h+R+P,n.log.debug(`abc91 layout blocks (calc) px, pyid:${d.id} startingPos=X${h} new startingPosX${d.size.x} ${P} padding=${R} width=${D} halfWidth=${P} => x:${d.size.x} y:${d.size.y} ${d.widthInColumns} (width * (child?.w || 1)) / 2 ${D*((d==null?void 0:d.widthInColumns)??1)/2}`),h=d.size.x+P;const J=L.get(q)??0,Q=f.get(q)??H;d.size.y=k.size.y-k.size.height/2+J+Q/2+R,n.log.debug(`abc88 layout blocks (calc) px, pyid:${d.id}startingPosX${h}${R}${P}=>x:${d.size.x}y:${d.size.y}${d.widthInColumns}(width * (child?.w || 1)) / 2${D*((d==null?void 0:d.widthInColumns)??1)/2}`)}d.children&&mt(d);let B=(d==null?void 0:d.widthInColumns)??1;a>0&&(B=Math.min(B,a-S%a)),S+=B,n.log.debug("abc88 columnsPos",d,S)}}n.log.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${(N=e==null?void 0:e.size)==null?void 0:N.x} y: ${(C=e==null?void 0:e.size)==null?void 0:C.y} width: ${(T=e==null?void 0:e.size)==null?void 0:T.width}`)}n.__name(mt,"layoutBlocks");function _t(e,{minX:t,minY:a,maxX:i,maxY:c}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:s,y:r,width:l,height:o}=e.size;s-l/2<t&&(t=s-l/2),r-o/2<a&&(a=r-o/2),s+l/2>i&&(i=s+l/2),r+o/2>c&&(c=r+o/2)}if(e.children)for(const s of e.children)({minX:t,minY:a,maxX:i,maxY:c}=_t(s,{minX:t,minY:a,maxX:i,maxY:c}));return{minX:t,minY:a,maxX:i,maxY:c}}n.__name(_t,"findBounds");function Ht(e){const t=e.getBlock("root");if(!t)return;it(t,e,0,0),mt(t),n.log.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:i,maxX:c,maxY:s}=_t(t),r=s-i,l=c-a;return{x:a,y:i,width:l,height:r}}n.__name(Ht,"layout");var He=n.__name(async(e,t,a,i=!1,c=!1)=>{let s=t||"";typeof s=="object"&&(s=s[0]);const r=n.getConfig2(),l=n.getEffectiveHtmlLabels(r);return await n.createText(e,s,{style:a,isTitle:i,useHtmlLabels:l,markdown:!1,isNode:c,width:Number.POSITIVE_INFINITY},r)},"createLabel"),U=He,Pe=n.__name((e,t,a,i,c)=>{t.arrowTypeStart&&kt(e,"start",t.arrowTypeStart,a,i,c),t.arrowTypeEnd&&kt(e,"end",t.arrowTypeEnd,a,i,c)},"addEdgeMarkers"),We={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},kt=n.__name((e,t,a,i,c,s)=>{const r=We[a];if(!r){n.log.warn(`Unknown arrow type: ${a}`);return}const l=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${i}#${c}_${s}-${r}${l})`)},"addEdgeMarker"),ft={},M={},Ye=n.__name(async(e,t)=>{const a=n.getConfig2(),i=n.getEffectiveHtmlLabels(a),c=e.insert("g").attr("class","edgeLabel"),s=c.insert("g").attr("class","label"),r=t.labelType==="markdown",l=await n.createText(e,t.label,{style:t.labelStyle,useHtmlLabels:i,addSvgBackground:r,isNode:!1,markdown:r,width:r?void 0:Number.POSITIVE_INFINITY},a);s.node().appendChild(l);let o=l.getBBox(),x=o;if(i){const p=l.children[0],_=n.select(l);o=p.getBoundingClientRect(),x=o,_.attr("width",o.width),_.attr("height",o.height)}else{const p=n.select(l).select("text").node();p&&typeof p.getBBox=="function"&&(x=p.getBBox())}s.attr("transform",n.computeLabelTransform(x,i)),ft[t.id]=c,t.width=o.width,t.height=o.height;let g;if(t.startLabelLeft){const p=e.insert("g").attr("class","edgeTerminals"),_=p.insert("g").attr("class","inner"),m=await U(_,t.startLabelLeft,t.labelStyle);g=m;let b=m.getBBox();if(i){const E=m.children[0],w=n.select(m);b=E.getBoundingClientRect(),w.attr("width",b.width),w.attr("height",b.height)}_.attr("transform",n.computeLabelTransform(b,i)),M[t.id]||(M[t.id]={}),M[t.id].startLeft=p,$(g,t.startLabelLeft)}if(t.startLabelRight){const p=e.insert("g").attr("class","edgeTerminals"),_=p.insert("g").attr("class","inner"),m=await U(p,t.startLabelRight,t.labelStyle);g=m,_.node().appendChild(m);let b=m.getBBox();if(i){const E=m.children[0],w=n.select(m);b=E.getBoundingClientRect(),w.attr("width",b.width),w.attr("height",b.height)}_.attr("transform",n.computeLabelTransform(b,i)),M[t.id]||(M[t.id]={}),M[t.id].startRight=p,$(g,t.startLabelRight)}if(t.endLabelLeft){const p=e.insert("g").attr("class","edgeTerminals"),_=p.insert("g").attr("class","inner"),m=await U(_,t.endLabelLeft,t.labelStyle);g=m;let b=m.getBBox();if(i){const E=m.children[0],w=n.select(m);b=E.getBoundingClientRect(),w.attr("width",b.width),w.attr("height",b.height)}_.attr("transform",n.computeLabelTransform(b,i)),p.node().appendChild(m),M[t.id]||(M[t.id]={}),M[t.id].endLeft=p,$(g,t.endLabelLeft)}if(t.endLabelRight){const p=e.insert("g").attr("class","edgeTerminals"),_=p.insert("g").attr("class","inner"),m=await U(_,t.endLabelRight,t.labelStyle);g=m;let b=m.getBBox();if(i){const E=m.children[0],w=n.select(m);b=E.getBoundingClientRect(),w.attr("width",b.width),w.attr("height",b.height)}_.attr("transform",n.computeLabelTransform(b,i)),p.node().appendChild(m),M[t.id]||(M[t.id]={}),M[t.id].endRight=p,$(g,t.endLabelRight)}return l},"insertEdgeLabel");function $(e,t){n.getEffectiveHtmlLabels(n.getConfig2())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}n.__name($,"setTerminalWidth");var Ke=n.__name((e,t)=>{n.log.debug("Moving label abc88 ",e.id,e.label,ft[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const i=n.getConfig2(),{subGraphTitleTotalMargin:c}=n.getSubGraphTitleMargins(i);if(e.label){const s=ft[e.id];let r=e.x,l=e.y;if(a){const o=n.utils_default.calcLabelPosition(a);n.log.debug("Moving label "+e.label+" from (",r,",",l,") to (",o.x,",",o.y,") abc88"),t.updatedPath&&(r=o.x,l=o.y)}s.attr("transform",`translate(${r}, ${l+c/2})`)}if(e.startLabelLeft){const s=M[e.id].startLeft;let r=e.x,l=e.y;if(a){const o=n.utils_default.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);r=o.x,l=o.y}s.attr("transform",`translate(${r}, ${l})`)}if(e.startLabelRight){const s=M[e.id].startRight;let r=e.x,l=e.y;if(a){const o=n.utils_default.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);r=o.x,l=o.y}s.attr("transform",`translate(${r}, ${l})`)}if(e.endLabelLeft){const s=M[e.id].endLeft;let r=e.x,l=e.y;if(a){const o=n.utils_default.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);r=o.x,l=o.y}s.attr("transform",`translate(${r}, ${l})`)}if(e.endLabelRight){const s=M[e.id].endRight;let r=e.x,l=e.y;if(a){const o=n.utils_default.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);r=o.x,l=o.y}s.attr("transform",`translate(${r}, ${l})`)}},"positionEdgeLabel"),Ue=n.__name((e,t)=>{const a=e.x,i=e.y,c=Math.abs(t.x-a),s=Math.abs(t.y-i),r=e.width/2,l=e.height/2;return c>=r||s>=l},"outsideNode"),Xe=n.__name((e,t,a)=>{n.log.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,c=e.y,s=Math.abs(i-a.x),r=e.width/2;let l=a.x<t.x?r-s:r+s;const o=e.height/2,x=Math.abs(t.y-a.y),g=Math.abs(t.x-a.x);if(Math.abs(c-t.y)*r>Math.abs(i-t.x)*o){let p=a.y<t.y?t.y-o-c:c-o-t.y;l=g*p/x;const _={x:a.x<t.x?a.x+l:a.x-g+l,y:a.y<t.y?a.y+x-p:a.y-x+p};return l===0&&(_.x=t.x,_.y=t.y),g===0&&(_.x=t.x),x===0&&(_.y=t.y),n.log.debug(`abc89 topp/bott calc, Q ${x}, q ${p}, R ${g}, r ${l}`,_),_}else{a.x<t.x?l=t.x-r-i:l=i-r-t.x;let p=x*l/g,_=a.x<t.x?a.x+g-l:a.x-g+l,m=a.y<t.y?a.y+p:a.y-p;return n.log.debug(`sides calc abc89, Q ${x}, q ${p}, R ${g}, r ${l}`,{_x:_,_y:m}),l===0&&(_=t.x,m=t.y),g===0&&(_=t.x),x===0&&(m=t.y),{x:_,y:m}}},"intersection"),Dt=n.__name((e,t)=>{n.log.debug("abc88 cutPathAtIntersect",e,t);let a=[],i=e[0],c=!1;return e.forEach(s=>{if(!Ue(t,s)&&!c){const r=Xe(t,i,s);let l=!1;a.forEach(o=>{l=l||o.x===r.x&&o.y===r.y}),a.some(o=>o.x===r.x&&o.y===r.y)||a.push(r),c=!0}else i=s,c||a.push(s)}),a},"cutPathAtIntersect"),je=n.__name(function(e,t,a,i,c,s,r){let l=a.points;n.log.debug("abc88 InsertEdge: edge=",a,"e=",t);let o=!1;const x=s.node(t.v);var g=s.node(t.w);g!=null&&g.intersect&&(x!=null&&x.intersect)&&(l=l.slice(1,a.points.length-1),l.unshift(x.intersect(l[0])),l.push(g.intersect(l[l.length-1]))),a.toCluster&&(n.log.debug("to cluster abc88",i[a.toCluster]),l=Dt(a.points,i[a.toCluster].node),o=!0),a.fromCluster&&(n.log.debug("from cluster abc88",i[a.fromCluster]),l=Dt(l.reverse(),i[a.fromCluster].node).reverse(),o=!0);const p=l.filter(y=>!Number.isNaN(y.y));let _=n.curveBasis;a.curve&&(c==="graph"||c==="flowchart")&&(_=a.curve);const{x:m,y:b}=n.getLineFunctionsWithOffset(a),E=n.line().x(m).y(b).curve(_);let w;switch(a.thickness){case"normal":w="edge-thickness-normal";break;case"thick":w="edge-thickness-thick";break;case"invisible":w="edge-thickness-thick";break;default:w=""}switch(a.pattern){case"solid":w+=" edge-pattern-solid";break;case"dotted":w+=" edge-pattern-dotted";break;case"dashed":w+=" edge-pattern-dashed";break}const N=e.append("path").attr("d",E(p)).attr("id",a.id).attr("class"," "+w+(a.classes?" "+a.classes:"")).attr("style",a.style);let C="";(n.getConfig2().flowchart.arrowMarkerAbsolute||n.getConfig2().state.arrowMarkerAbsolute)&&(C=n.getUrl(!0)),Pe(N,a,C,r,c);let T={};return o&&(T.updatedPath=l),T.originalPath=a.points,T},"insertEdge"),Ve=n.__name(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"),qe=n.__name((e,t,a)=>{const i=Ve(e),c=2,s=t.height+2*a.padding,r=s/c,l=t.width+2*r+a.padding,o=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:r,y:0},{x:l/2,y:2*o},{x:l-r,y:0},{x:l,y:0},{x:l,y:-s/3},{x:l+2*o,y:-s/2},{x:l,y:-2*s/3},{x:l,y:-s},{x:l-r,y:-s},{x:l/2,y:-s-2*o},{x:r,y:-s},{x:0,y:-s},{x:0,y:-2*s/3},{x:-2*o,y:-s/2},{x:0,y:-s/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:r,y:0},{x:l-r,y:0},{x:l,y:-s/2},{x:l-r,y:-s},{x:r,y:-s},{x:0,y:-s/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:r,y:-s},{x:l-r,y:-s},{x:l,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:l,y:-r},{x:l,y:-s+r},{x:0,y:-s}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:l,y:0},{x:0,y:-r},{x:0,y:-s+r},{x:l,y:-s}]:i.has("right")&&i.has("left")?[{x:r,y:0},{x:r,y:-o},{x:l-r,y:-o},{x:l-r,y:0},{x:l,y:-s/2},{x:l-r,y:-s},{x:l-r,y:-s+o},{x:r,y:-s+o},{x:r,y:-s},{x:0,y:-s/2}]:i.has("up")&&i.has("down")?[{x:l/2,y:0},{x:0,y:-o},{x:r,y:-o},{x:r,y:-s+o},{x:0,y:-s+o},{x:l/2,y:-s},{x:l,y:-s+o},{x:l-r,y:-s+o},{x:l-r,y:-o},{x:l,y:-o}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:l,y:-r},{x:0,y:-s}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:l,y:0},{x:0,y:-s}]:i.has("left")&&i.has("up")?[{x:l,y:0},{x:0,y:-r},{x:l,y:-s}]:i.has("left")&&i.has("down")?[{x:l,y:0},{x:0,y:0},{x:l,y:-s}]:i.has("right")?[{x:r,y:-o},{x:r,y:-o},{x:l-r,y:-o},{x:l-r,y:0},{x:l,y:-s/2},{x:l-r,y:-s},{x:l-r,y:-s+o},{x:r,y:-s+o},{x:r,y:-s+o}]:i.has("left")?[{x:r,y:0},{x:r,y:-o},{x:l-r,y:-o},{x:l-r,y:-s+o},{x:r,y:-s+o},{x:r,y:-s},{x:0,y:-s/2}]:i.has("up")?[{x:r,y:-o},{x:r,y:-s+o},{x:0,y:-s+o},{x:l/2,y:-s},{x:l,y:-s+o},{x:l-r,y:-s+o},{x:l-r,y:-o}]:i.has("down")?[{x:l/2,y:0},{x:0,y:-o},{x:r,y:-o},{x:r,y:-s+o},{x:l-r,y:-s+o},{x:l-r,y:-o},{x:l,y:-o}]:[{x:0,y:0}]},"getArrowPoints");function Pt(e,t){return e.intersect(t)}n.__name(Pt,"intersectNode");var Ze=Pt;function Wt(e,t,a,i){var c=e.x,s=e.y,r=c-i.x,l=s-i.y,o=Math.sqrt(t*t*l*l+a*a*r*r),x=Math.abs(t*a*r/o);i.x<c&&(x=-x);var g=Math.abs(t*a*l/o);return i.y<s&&(g=-g),{x:c+x,y:s+g}}n.__name(Wt,"intersectEllipse");var Yt=Wt;function Kt(e,t,a){return Yt(e,t,t,a)}n.__name(Kt,"intersectCircle");var Ge=Kt;function Ut(e,t,a,i){var c,s,r,l,o,x,g,p,_,m,b,E,w,N,C;if(c=t.y-e.y,r=e.x-t.x,o=t.x*e.y-e.x*t.y,_=c*a.x+r*a.y+o,m=c*i.x+r*i.y+o,!(_!==0&&m!==0&&pt(_,m))&&(s=i.y-a.y,l=a.x-i.x,x=i.x*a.y-a.x*i.y,g=s*e.x+l*e.y+x,p=s*t.x+l*t.y+x,!(g!==0&&p!==0&&pt(g,p))&&(b=c*l-s*r,b!==0)))return E=Math.abs(b/2),w=r*x-l*o,N=w<0?(w-E)/b:(w+E)/b,w=s*o-c*x,C=w<0?(w-E)/b:(w+E)/b,{x:N,y:C}}n.__name(Ut,"intersectLine");function pt(e,t){return e*t>0}n.__name(pt,"sameSign");var Je=Ut,Qe=Xt;function Xt(e,t,a){var i=e.x,c=e.y,s=[],r=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(b){r=Math.min(r,b.x),l=Math.min(l,b.y)}):(r=Math.min(r,t.x),l=Math.min(l,t.y));for(var o=i-e.width/2-r,x=c-e.height/2-l,g=0;g<t.length;g++){var p=t[g],_=t[g<t.length-1?g+1:0],m=Je(e,a,{x:o+p.x,y:x+p.y},{x:o+_.x,y:x+_.y});m&&s.push(m)}return s.length?(s.length>1&&s.sort(function(b,E){var w=b.x-a.x,N=b.y-a.y,C=Math.sqrt(w*w+N*N),T=E.x-a.x,y=E.y-a.y,u=Math.sqrt(T*T+y*y);return C<u?-1:C===u?0:1}),s[0]):e}n.__name(Xt,"intersectPolygon");var $e=n.__name((e,t)=>{var a=e.x,i=e.y,c=t.x-a,s=t.y-i,r=e.width/2,l=e.height/2,o,x;return Math.abs(s)*r>Math.abs(c)*l?(s<0&&(l=-l),o=s===0?0:l*c/s,x=l):(c<0&&(r=-r),o=r,x=c===0?0:r*s/c),{x:a+o,y:i+x}},"intersectRect"),tr=$e,I={node:Ze,circle:Ge,ellipse:Yt,polygon:Qe,rect:tr},z=n.__name(async(e,t,a,i)=>{const c=n.getConfig2();let s;const r=t.useHtmlLabels||n.getEffectiveHtmlLabels(c);a?s=a:s="node default";const l=e.insert("g").attr("class",s).attr("id",t.domId||t.id),o=l.insert("g").attr("class","label").attr("style",t.labelStyle);let x;t.labelText===void 0?x="":x=typeof t.labelText=="string"?t.labelText:t.labelText[0];let g;t.labelType==="markdown"?g=n.createText(o,n.sanitizeText(n.decodeEntities(x),c),{useHtmlLabels:r,width:t.width||c.flowchart.wrappingWidth,classes:"markdown-node-label"},c):g=await U(o,n.sanitizeText(n.decodeEntities(x),c),t.labelStyle,!1,i);let p=g.getBBox();const _=t.padding/2;if(n.getEffectiveHtmlLabels(c)){const m=g.children[0],b=n.select(g);await n.configureLabelImages(m,x),p=m.getBoundingClientRect(),b.attr("width",p.width),b.attr("height",p.height)}return r?o.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"):o.attr("transform","translate(0, "+-p.height/2+")"),t.centerLabel&&o.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:l,bbox:p,halfPadding:_,label:o}},"labelHelper"),O=n.__name((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function j(e,t,a,i){return e.insert("polygon",":first-child").attr("points",i.map(function(c){return c.x+","+c.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}n.__name(j,"insertPolygonShape");var er=n.__name(async(e,t)=>{t.useHtmlLabels||n.getEffectiveHtmlLabels(n.getConfig2())||(t.centerLabel=!0);const{shapeSvg:i,bbox:c,halfPadding:s}=await z(e,t,"node "+t.classes,!0);n.log.info("Classes = ",t.classes);const r=i.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-c.width/2-s).attr("y",-c.height/2-s).attr("width",c.width+t.padding).attr("height",c.height+t.padding),O(t,r),t.intersect=function(l){return I.rect(t,l)},i},"note"),rr=er,Tt=n.__name(e=>e?" "+e:"","formatClass"),Y=n.__name((e,t)=>`${t||"node default"}${Tt(e.classes)} ${Tt(e.class)}`,"getClassesFromNode"),Ct=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=i.height+t.padding,r=c+s,l=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];n.log.info("Question main (Circle)");const o=j(a,r,r,l);return o.attr("style",t.style),O(t,o),t.intersect=function(x){return n.log.warn("Intersect called"),I.polygon(t,l,x)},a},"question"),ar=n.__name((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=28,c=[{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",c.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 I.circle(t,14,r)},a},"choice"),sr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=4,s=i.height+t.padding,r=s/c,l=i.width+2*r+t.padding,o=[{x:r,y:0},{x:l-r,y:0},{x:l,y:-s/2},{x:l-r,y:-s},{x:r,y:-s},{x:0,y:-s/2}],x=j(a,l,s,o);return x.attr("style",t.style),O(t,x),t.intersect=function(g){return I.polygon(t,o,g)},a},"hexagon"),ir=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,void 0,!0),c=2,s=i.height+2*t.padding,r=s/c,l=i.width+2*r+t.padding,o=qe(t.directions,i,t),x=j(a,l,s,o);return x.attr("style",t.style),O(t,x),t.intersect=function(g){return I.polygon(t,o,g)},a},"block_arrow"),nr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=i.height+t.padding,r=[{x:-s/2,y:0},{x:c,y:0},{x:c,y:-s},{x:-s/2,y:-s},{x:0,y:-s/2}];return j(a,c,s,r).attr("style",t.style),t.width=c+s,t.height=s,t.intersect=function(o){return I.polygon(t,r,o)},a},"rect_left_inv_arrow"),lr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t),!0),c=i.width+t.padding,s=i.height+t.padding,r=[{x:-2*s/6,y:0},{x:c-s/6,y:0},{x:c+2*s/6,y:-s},{x:s/6,y:-s}],l=j(a,c,s,r);return l.attr("style",t.style),O(t,l),t.intersect=function(o){return I.polygon(t,r,o)},a},"lean_right"),cr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=i.height+t.padding,r=[{x:2*s/6,y:0},{x:c+s/6,y:0},{x:c-2*s/6,y:-s},{x:-s/6,y:-s}],l=j(a,c,s,r);return l.attr("style",t.style),O(t,l),t.intersect=function(o){return I.polygon(t,r,o)},a},"lean_left"),or=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=i.height+t.padding,r=[{x:-2*s/6,y:0},{x:c+2*s/6,y:0},{x:c-s/6,y:-s},{x:s/6,y:-s}],l=j(a,c,s,r);return l.attr("style",t.style),O(t,l),t.intersect=function(o){return I.polygon(t,r,o)},a},"trapezoid"),hr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=i.height+t.padding,r=[{x:s/6,y:0},{x:c-s/6,y:0},{x:c+2*s/6,y:-s},{x:-2*s/6,y:-s}],l=j(a,c,s,r);return l.attr("style",t.style),O(t,l),t.intersect=function(o){return I.polygon(t,r,o)},a},"inv_trapezoid"),gr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=i.height+t.padding,r=[{x:0,y:0},{x:c+s/2,y:0},{x:c,y:-s/2},{x:c+s/2,y:-s},{x:0,y:-s}],l=j(a,c,s,r);return l.attr("style",t.style),O(t,l),t.intersect=function(o){return I.polygon(t,r,o)},a},"rect_right_inv_arrow"),dr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=c/2,r=s/(2.5+c/50),l=i.height+r+t.padding,o="M 0,"+r+" a "+s+","+r+" 0,0,0 "+c+" 0 a "+s+","+r+" 0,0,0 "+-c+" 0 l 0,"+l+" a "+s+","+r+" 0,0,0 "+c+" 0 l 0,"+-l,x=a.attr("label-offset-y",r).insert("path",":first-child").attr("style",t.style).attr("d",o).attr("transform","translate("+-c/2+","+-(l/2+r)+")");return O(t,x),t.intersect=function(g){const p=I.rect(t,g),_=p.x-t.x;if(s!=0&&(Math.abs(_)<t.width/2||Math.abs(_)==t.width/2&&Math.abs(p.y-t.y)>t.height/2-r)){let m=r*r*(1-_*_/(s*s));m!=0&&(m=Math.sqrt(m)),m=r-m,g.y-t.y>0&&(m=-m),p.y+=m}return p},a},"cylinder"),ur=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:c}=await z(e,t,"node "+t.classes+" "+t.class,!0),s=a.insert("rect",":first-child"),r=t.positioned?t.width:i.width+t.padding,l=t.positioned?t.height:i.height+t.padding,o=t.positioned?-r/2:-i.width/2-c,x=t.positioned?-l/2:-i.height/2-c;if(s.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",o).attr("y",x).attr("width",r).attr("height",l),t.props){const g=new Set(Object.keys(t.props));t.props.borders&&(nt(s,t.props.borders,r,l),g.delete("borders")),g.forEach(p=>{n.log.warn(`Unknown node property ${p}`)})}return O(t,s),t.intersect=function(g){return I.rect(t,g)},a},"rect"),fr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:c}=await z(e,t,"node "+t.classes,!0),s=a.insert("rect",":first-child"),r=t.positioned?t.width:i.width+t.padding,l=t.positioned?t.height:i.height+t.padding,o=t.positioned?-r/2:-i.width/2-c,x=t.positioned?-l/2:-i.height/2-c;if(s.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",o).attr("y",x).attr("width",r).attr("height",l),t.props){const g=new Set(Object.keys(t.props));t.props.borders&&(nt(s,t.props.borders,r,l),g.delete("borders")),g.forEach(p=>{n.log.warn(`Unknown node property ${p}`)})}return O(t,s),t.intersect=function(g){return I.rect(t,g)},a},"composite"),pr=n.__name(async(e,t)=>{const{shapeSvg:a}=await z(e,t,"label",!0);n.log.trace("Classes = ",t.class);const i=a.insert("rect",":first-child"),c=0,s=0;if(i.attr("width",c).attr("height",s),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(nt(i,t.props.borders,c,s),r.delete("borders")),r.forEach(l=>{n.log.warn(`Unknown node property ${l}`)})}return O(t,i),t.intersect=function(r){return I.rect(t,r)},a},"labelRect");function nt(e,t,a,i){const c=[],s=n.__name(l=>{c.push(l,0)},"addBorder"),r=n.__name(l=>{c.push(0,l)},"skipBorder");t.includes("t")?(n.log.debug("add top border"),s(a)):r(a),t.includes("r")?(n.log.debug("add right border"),s(i)):r(i),t.includes("b")?(n.log.debug("add bottom border"),s(a)):r(a),t.includes("l")?(n.log.debug("add left border"),s(i)):r(i),e.attr("stroke-dasharray",c.join(" "))}n.__name(nt,"applyNodePropertyBorders");var xr=n.__name(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),c=i.insert("rect",":first-child"),s=i.insert("line"),r=i.insert("g").attr("class","label"),l=t.labelText.flat?t.labelText.flat():t.labelText;let o="";typeof l=="object"?o=l[0]:o=l,n.log.info("Label text abc79",o,l,typeof l=="object");const x=await U(r,o,t.labelStyle,!0,!0);let g={width:0,height:0};if(n.getEffectiveHtmlLabels(n.getConfig2())){const E=x.children[0],w=n.select(x);g=E.getBoundingClientRect(),w.attr("width",g.width),w.attr("height",g.height)}n.log.info("Text 2",l);const p=l.slice(1,l.length);let _=x.getBBox();const m=await U(r,p.join?p.join("<br/>"):p,t.labelStyle,!0,!0);if(n.getEffectiveHtmlLabels(n.getConfig2())){const E=m.children[0],w=n.select(m);g=E.getBoundingClientRect(),w.attr("width",g.width),w.attr("height",g.height)}const b=t.padding/2;return n.select(m).attr("transform","translate( "+(g.width>_.width?0:(_.width-g.width)/2)+", "+(_.height+b+5)+")"),n.select(x).attr("transform","translate( "+(g.width<_.width?0:-(_.width-g.width)/2)+", 0)"),g=r.node().getBBox(),r.attr("transform","translate("+-g.width/2+", "+(-g.height/2-b+3)+")"),c.attr("class","outer title-state").attr("x",-g.width/2-b).attr("y",-g.height/2-b).attr("width",g.width+t.padding).attr("height",g.height+t.padding),s.attr("class","divider").attr("x1",-g.width/2-b).attr("x2",g.width/2+b).attr("y1",-g.height/2-b+_.height+b).attr("y2",-g.height/2-b+_.height+b),O(t,c),t.intersect=function(E){return I.rect(t,E)},i},"rectWithTitle"),yr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.height+t.padding,s=i.width+c/4+t.padding,r=a.insert("rect",":first-child").attr("style",t.style).attr("rx",c/2).attr("ry",c/2).attr("x",-s/2).attr("y",-c/2).attr("width",s).attr("height",c);return O(t,r),t.intersect=function(l){return I.rect(t,l)},a},"stadium"),mr=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:c}=await z(e,t,Y(t,void 0),!0),s=a.insert("circle",":first-child");return s.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+c).attr("width",i.width+t.padding).attr("height",i.height+t.padding),n.log.info("Circle main"),O(t,s),t.intersect=function(r){return n.log.info("Circle intersect",t,i.width/2+c,r),I.circle(t,i.width/2+c,r)},a},"circle"),_r=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:c}=await z(e,t,Y(t,void 0),!0),s=5,r=a.insert("g",":first-child"),l=r.insert("circle"),o=r.insert("circle");return r.attr("class",t.class),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+c+s).attr("width",i.width+t.padding+s*2).attr("height",i.height+t.padding+s*2),o.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+c).attr("width",i.width+t.padding).attr("height",i.height+t.padding),n.log.info("DoubleCircle main"),O(t,l),t.intersect=function(x){return n.log.info("DoubleCircle intersect",t,i.width/2+c+s,x),I.circle(t,i.width/2+c+s,x)},a},"doublecircle"),br=n.__name(async(e,t)=>{const{shapeSvg:a,bbox:i}=await z(e,t,Y(t,void 0),!0),c=i.width+t.padding,s=i.height+t.padding,r=[{x:0,y:0},{x:c,y:0},{x:c,y:-s},{x:0,y:-s},{x:0,y:0},{x:-8,y:0},{x:c+8,y:0},{x:c+8,y:-s},{x:-8,y:-s},{x:-8,y:0}],l=j(a,c,s,r);return l.attr("style",t.style),O(t,l),t.intersect=function(o){return I.polygon(t,r,o)},a},"subroutine"),wr=n.__name((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),O(t,i),t.intersect=function(c){return I.circle(t,7,c)},a},"start"),Nt=n.__name((e,t,a)=>{const i=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let c=70,s=10;a==="LR"&&(c=10,s=70);const r=i.append("rect").attr("x",-1*c/2).attr("y",-1*s/2).attr("width",c).attr("height",s).attr("class","fork-join");return O(t,r),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(l){return I.rect(t,l)},i},"forkJoin"),Lr=n.__name((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=a.insert("circle",":first-child"),c=a.insert("circle",":first-child");return c.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),O(t,c),t.intersect=function(s){return I.circle(t,7,s)},a},"end"),Sr=n.__name(async(e,t)=>{var S;const a=t.padding/2,i=4,c=8;let s;t.classes?s="node "+t.classes:s="node default";const r=e.insert("g").attr("class",s).attr("id",t.domId||t.id),l=r.insert("rect",":first-child"),o=r.insert("line"),x=r.insert("line");let g=0,p=i;const _=r.insert("g").attr("class","label");let m=0;const b=(S=t.classData.annotations)==null?void 0:S[0],E=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",w=await U(_,E,t.labelStyle,!0,!0);let N=w.getBBox();if(n.getEffectiveHtmlLabels(n.getConfig2())){const h=w.children[0],v=n.select(w);N=h.getBoundingClientRect(),v.attr("width",N.width),v.attr("height",N.height)}t.classData.annotations[0]&&(p+=N.height+i,g+=N.width);let C=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(n.getEffectiveHtmlLabels(n.getConfig2())?C+="&lt;"+t.classData.type+"&gt;":C+="<"+t.classData.type+">");const T=await U(_,C,t.labelStyle,!0,!0);n.select(T).attr("class","classTitle");let y=T.getBBox();if(n.getEffectiveHtmlLabels(n.getConfig2())){const h=T.children[0],v=n.select(T);y=h.getBoundingClientRect(),v.attr("width",y.width),v.attr("height",y.height)}p+=y.height+i,y.width>g&&(g=y.width);const u=[];t.classData.members.forEach(async h=>{const v=h.getDisplayDetails();let d=v.displayText;n.getEffectiveHtmlLabels(n.getConfig2())&&(d=d.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const k=await U(_,d,v.cssStyle?v.cssStyle:t.labelStyle,!0,!0);let D=k.getBBox();if(n.getEffectiveHtmlLabels(n.getConfig2())){const H=k.children[0],A=n.select(k);D=H.getBoundingClientRect(),A.attr("width",D.width),A.attr("height",D.height)}D.width>g&&(g=D.width),p+=D.height+i,u.push(k)}),p+=c;const f=[];if(t.classData.methods.forEach(async h=>{const v=h.getDisplayDetails();let d=v.displayText;n.getEffectiveHtmlLabels(n.getConfig2())&&(d=d.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const k=await U(_,d,v.cssStyle?v.cssStyle:t.labelStyle,!0,!0);let D=k.getBBox();if(n.getEffectiveHtmlLabels(n.getConfig2())){const H=k.children[0],A=n.select(k);D=H.getBoundingClientRect(),A.attr("width",D.width),A.attr("height",D.height)}D.width>g&&(g=D.width),p+=D.height+i,f.push(k)}),p+=c,b){let h=(g-N.width)/2;n.select(w).attr("transform","translate( "+(-1*g/2+h)+", "+-1*p/2+")"),m=N.height+i}let L=(g-y.width)/2;return n.select(T).attr("transform","translate( "+(-1*g/2+L)+", "+(-1*p/2+m)+")"),m+=y.height+i,o.attr("class","divider").attr("x1",-g/2-a).attr("x2",g/2+a).attr("y1",-p/2-a+c+m).attr("y2",-p/2-a+c+m),m+=c,u.forEach(h=>{n.select(h).attr("transform","translate( "+-g/2+", "+(-1*p/2+m+c/2)+")");const v=h==null?void 0:h.getBBox();m+=((v==null?void 0:v.height)??0)+i}),m+=c,x.attr("class","divider").attr("x1",-g/2-a).attr("x2",g/2+a).attr("y1",-p/2-a+c+m).attr("y2",-p/2-a+c+m),m+=c,f.forEach(h=>{n.select(h).attr("transform","translate( "+-g/2+", "+(-1*p/2+m)+")");const v=h==null?void 0:h.getBBox();m+=((v==null?void 0:v.height)??0)+i}),l.attr("style",t.style).attr("class","outer title-state").attr("x",-g/2-a).attr("y",-(p/2)-a).attr("width",g+t.padding).attr("height",p+t.padding),O(t,l),t.intersect=function(h){return I.rect(t,h)},r},"class_box"),It={rhombus:Ct,composite:fr,question:Ct,rect:ur,labelRect:pr,rectWithTitle:xr,choice:ar,circle:mr,doublecircle:_r,stadium:yr,hexagon:sr,block_arrow:ir,rect_left_inv_arrow:nr,lean_right:lr,lean_left:cr,trapezoid:or,inv_trapezoid:hr,rect_right_inv_arrow:gr,cylinder:dr,start:wr,end:Lr,note:rr,subroutine:br,fork:Nt,join:Nt,class_box:Sr},at={},jt=n.__name(async(e,t,a)=>{let i,c;if(t.link){let s;n.getConfig2().securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s),c=await It[t.shape](i,t,a)}else c=await It[t.shape](e,t,a),i=c;return t.tooltip&&c.attr("title",t.tooltip),t.class&&c.attr("class","node default "+t.class),at[t.id]=i,t.haveCallback&&at[t.id].attr("class",at[t.id].attr("class")+" clickable"),i},"insertNode"),vr=n.__name(e=>{const t=at[e.id];n.log.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 bt(e,t,a=!1){var _,m,b;const i=e;let c="default";(((_=i==null?void 0:i.classes)==null?void 0:_.length)||0)>0&&(c=((i==null?void 0:i.classes)??[]).join(" ")),c=c+" flowchart-label";let s=0,r="",l;switch(i.type){case"round":s=5,r="rect";break;case"composite":s=0,r="composite",l=0;break;case"square":r="rect";break;case"diamond":r="question";break;case"hexagon":r="hexagon";break;case"block_arrow":r="block_arrow";break;case"odd":r="rect_left_inv_arrow";break;case"lean_right":r="lean_right";break;case"lean_left":r="lean_left";break;case"trapezoid":r="trapezoid";break;case"inv_trapezoid":r="inv_trapezoid";break;case"rect_left_inv_arrow":r="rect_left_inv_arrow";break;case"circle":r="circle";break;case"ellipse":r="ellipse";break;case"stadium":r="stadium";break;case"subroutine":r="subroutine";break;case"cylinder":r="cylinder";break;case"group":r="rect";break;case"doublecircle":r="doublecircle";break;default:r="rect"}const o=n.getStylesFromArray((i==null?void 0:i.styles)??[]),x=i.label,g=i.size??{width:0,height:0,x:0,y:0};return{labelStyle:o.labelStyle,shape:r,labelText:x,rx:s,ry:s,class:c,style:o.style,id:i.id,directions:i.directions,width:g.width,height:g.height,x:g.x,y:g.y,positioned:a,intersect:void 0,type:i.type,padding:l??((b=(m=n.getConfig())==null?void 0:m.block)==null?void 0:b.padding)??0}}n.__name(bt,"getNodeFromBlock");async function Vt(e,t,a){const i=bt(t,a,!1);if(i.type==="group")return;const c=n.getConfig(),s=await jt(e,i,{config:c}),r=s.node().getBBox(),l=a.getBlock(i.id);l.size={width:r.width,height:r.height,x:0,y:0,node:s},a.setBlock(l),s.remove()}n.__name(Vt,"calculateBlockSize");async function qt(e,t,a){const i=bt(t,a,!0);if(a.getBlock(i.id).type!=="space"){const s=n.getConfig();await jt(e,i,{config:s}),t.intersect=i==null?void 0:i.intersect,vr(i)}}n.__name(qt,"insertBlockPositioned");async function lt(e,t,a,i){for(const c of t)await i(e,c,a),c.children&&await lt(e,c.children,a,i)}n.__name(lt,"performOperations");async function Zt(e,t,a){await lt(e,t,a,Vt)}n.__name(Zt,"calculateBlockSizes");async function Gt(e,t,a){await lt(e,t,a,qt)}n.__name(Gt,"insertBlocks");async function Jt(e,t,a,i,c){const s=new re.Graph({multigraph:!0,compound:!0});s.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const r of a)r.size&&s.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(const r of t)if(r.start&&r.end){const l=i.getBlock(r.start),o=i.getBlock(r.end);if(l!=null&&l.size&&(o!=null&&o.size)){const x=l.size,g=o.size,p=[{x:x.x,y:x.y},{x:x.x+(g.x-x.x)/2,y:x.y+(g.y-x.y)/2},{x:g.x,y:g.y}];je(e,{v:r.start,w:r.end,name:r.id},{...r,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:p,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",s,c),r.label&&(await Ye(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:p,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),Ke({...r,x:p[1].x,y:p[1].y},{originalPath:p}))}}}n.__name(Jt,"insertEdges");var Er=n.__name(function(e,t){return t.db.getClasses()},"getClasses"),kr=n.__name(async function(e,t,a,i){const{securityLevel:c,block:s}=n.getConfig(),r=i.db;let l;c==="sandbox"&&(l=n.select("#i"+t));const o=c==="sandbox"?n.select(l.nodes()[0].contentDocument.body):n.select("body"),x=c==="sandbox"?o.select(`[id="${t}"]`):n.select(`[id="${t}"]`);Me(x,["point","circle","cross"],i.type,t);const p=r.getBlocks(),_=r.getBlocksFlat(),m=r.getEdges(),b=x.insert("g").attr("class","block");await Zt(b,p,r);const E=Ht(r);if(await Gt(b,p,r),await Jt(b,m,_,r,t),E){const w=E,N=Math.max(1,Math.round(.125*(w.width/w.height))),C=w.height+N+10,T=w.width+10,{useMaxWidth:y}=s;n.configureSvgSize(x,C,T,!!y),n.log.debug("Here Bounds",E,w),x.attr("viewBox",`${w.x-5} ${w.y-5} ${w.width+10} ${w.height+10}`)}},"draw"),Dr={draw:kr,getClasses:Er},Tr={parser:se,db:Se,renderer:Dr,styles:Ee};exports.diagram=Tr;