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