UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

97 lines (95 loc) 24.2 kB
const d=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),I=require("./src-C9EhKhbk.cjs"),E=require("./chunk-WYO6CB5R-u4mJNOcO.cjs");require("./chunk-ICXQ74PX-BbT9JaEW.cjs");require("./chunk-HOUHSVGY-BGB3dOvI.cjs");require("./chunk-Q4XR5HBZ-aBnPq509.cjs");require("./chunk-7BUUIJ7U-DMv_UkjI.cjs");require("./chunk-OGEWGWER-DX8sW1dT.cjs");const ae=require("./chunk-XXDRQBXY-C8VGLZmt.cjs"),oe=require("./chunk-VR4S4FIN-KiwnPF31.cjs");require("./chunk-C7G6YPKG-CKEeW9TM.cjs");require("./chunk-ZGVPDNZ5-Cw5_HJba.cjs");require("./chunk-52WLFC77-BChUrU24.cjs");const te=require("./chunk-FWX5IMBZ-D11-gbhc.cjs");var k=[];for(let e=0;e<256;++e)k.push((e+256).toString(16).slice(1));function ce(e,n=0){return(k[e[n+0]]+k[e[n+1]]+k[e[n+2]]+k[e[n+3]]+"-"+k[e[n+4]]+k[e[n+5]]+"-"+k[e[n+6]]+k[e[n+7]]+"-"+k[e[n+8]]+k[e[n+9]]+"-"+k[e[n+10]]+k[e[n+11]]+k[e[n+12]]+k[e[n+13]]+k[e[n+14]]+k[e[n+15]]).toLowerCase()}var le=new Uint8Array(16);function he(){return crypto.getRandomValues(le)}function de(e,n,c){return!n&&!e&&crypto.randomUUID?crypto.randomUUID():ge(e,n,c)}function ge(e,n,c){e=e||{};const a=e.random??e.rng?.()??he();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,n){if(c=c||0,c<0||c+16>n.length)throw new RangeError(`UUID byte range ${c}:${c+15} is out of buffer bounds`);for(let t=0;t<16;++t)n[c+t]=a[t];return n}return ce(a)}var z=(function(){var e=d.__name(function(s,i,h,o){for(h=h||{},o=s.length;o--;h[s[o]]=i);return h},"o"),n=[1,4],c=[1,13],a=[1,12],t=[1,15],g=[1,16],m=[1,20],p=[1,19],D=[6,7,8],w=[1,26],R=[1,24],y=[1,25],b=[6,7,11],H=[1,6,13,15,16,19,22],W=[1,33],Y=[1,34],A=[1,6,7,11,13,15,16,19,22],V={trace:d.__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:d.__name(function(i,h,o,l,f,r,$){var u=r.length-1;switch(f){case 6:case 7:return l;case 8:l.getLogger().trace("Stop NL ");break;case 9:l.getLogger().trace("Stop EOF ");break;case 11:l.getLogger().trace("Stop NL2 ");break;case 12:l.getLogger().trace("Stop EOF2 ");break;case 15:l.getLogger().info("Node: ",r[u].id),l.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:l.getLogger().trace("Icon: ",r[u]),l.decorateNode({icon:r[u]});break;case 17:case 21:l.decorateNode({class:r[u]});break;case 18:l.getLogger().trace("SPACELIST");break;case 19:l.getLogger().trace("Node: ",r[u].id),l.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:l.decorateNode({icon:r[u]});break;case 25:l.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:l.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:l.nodeType.DEFAULT};break;case 27:l.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:l.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:c,7:[1,10],9:9,12:11,13:a,14:14,15:t,16:g,17:17,18:18,19:m,22:p},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:c,12:21,13:a,14:14,15:t,16:g,17:17,18:18,19:m,22:p},{6:c,9:22,12:11,13:a,14:14,15:t,16:g,17:17,18:18,19:m,22:p},{6:w,7:R,10:23,11:y},e(b,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:m,22:p}),e(b,[2,18]),e(b,[2,19]),e(b,[2,20]),e(b,[2,21]),e(b,[2,23]),e(b,[2,24]),e(b,[2,26],{19:[1,30]}),{20:[1,31]},{6:w,7:R,10:32,11:y},{1:[2,7],6:c,12:21,13:a,14:14,15:t,16:g,17:17,18:18,19:m,22:p},e(H,[2,14],{7:W,11:Y}),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(b,[2,15]),e(b,[2,16]),e(b,[2,17]),{20:[1,35]},{21:[1,36]},e(H,[2,13],{7:W,11:Y}),e(A,[2,11]),e(A,[2,12]),{21:[1,37]},e(b,[2,25]),e(b,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:d.__name(function(i,h){if(h.recoverable)this.trace(i);else{var o=new Error(i);throw o.hash=h,o}},"parseError"),parse:d.__name(function(i){var h=this,o=[0],l=[],f=[null],r=[],$=this.table,u="",M=0,Z=0,J=0,ne=2,Q=1,ie=r.slice.call(arguments,1),_=Object.create(this.lexer),v={yy:{}};for(var q in this.yy)Object.prototype.hasOwnProperty.call(this.yy,q)&&(v.yy[q]=this.yy[q]);_.setInput(i,v.yy),v.yy.lexer=_,v.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var F=_.yylloc;r.push(F);var se=_.options&&_.options.ranges;typeof v.yy.parseError=="function"?this.parseError=v.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(x){o.length=o.length-2*x,f.length=f.length-x,r.length=r.length-x}d.__name(re,"popStack");function K(){var x=l.pop()||_.lex()||Q;return typeof x!="number"&&(x instanceof Array&&(l=x,x=l.pop()),x=h.symbols_[x]||x),x}d.__name(K,"lex");for(var S,G,C,N,j,O={},P,L,ee,U;;){if(C=o[o.length-1],this.defaultActions[C]?N=this.defaultActions[C]:((S===null||typeof S>"u")&&(S=K()),N=$[C]&&$[C][S]),typeof N>"u"||!N.length||!N[0]){var X="";U=[];for(P in $[C])this.terminals_[P]&&P>ne&&U.push("'"+this.terminals_[P]+"'");_.showPosition?X="Parse error on line "+(M+1)+`: `+_.showPosition()+` Expecting `+U.join(", ")+", got '"+(this.terminals_[S]||S)+"'":X="Parse error on line "+(M+1)+": Unexpected "+(S==Q?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[S]||S,line:_.yylineno,loc:F,expected:U})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+S);switch(N[0]){case 1:o.push(S),f.push(_.yytext),r.push(_.yylloc),o.push(N[1]),S=null,G?(S=G,G=null):(Z=_.yyleng,u=_.yytext,M=_.yylineno,F=_.yylloc,J>0&&J--);break;case 2:if(L=this.productions_[N[1]][1],O.$=f[f.length-L],O._$={first_line:r[r.length-(L||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(L||1)].first_column,last_column:r[r.length-1].last_column},se&&(O._$.range=[r[r.length-(L||1)].range[0],r[r.length-1].range[1]]),j=this.performAction.apply(O,[u,Z,M,v.yy,N[1],f,r].concat(ie)),typeof j<"u")return j;L&&(o=o.slice(0,-1*L*2),f=f.slice(0,-1*L),r=r.slice(0,-1*L)),o.push(this.productions_[N[1]][0]),f.push(O.$),r.push(O._$),ee=$[o[o.length-2]][o[o.length-1]],o.push(ee);break;case 3:return!0}}return!0},"parse")};V.lexer=(function(){return{EOF:1,parseError:d.__name(function(i,h){if(this.yy.parser)this.yy.parser.parseError(i,h);else throw new Error(i)},"parseError"),setInput:d.__name(function(s,i){return this.yy=i||this.yy||{},this._input=s,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.__name(function(){var s=this._input[0];return this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s,s.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:d.__name(function(s){var i=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var l=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:h?(h.length===o.length?this.yylloc.first_column:0)+o[o.length-h.length].length-h[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[l[0],l[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:d.__name(function(){return this._more=!0,this},"more"),reject:d.__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:d.__name(function(s){this.unput(this.match.slice(s))},"less"),pastInput:d.__name(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d.__name(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d.__name(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+` `+i+"^"},"showPosition"),test_match:d.__name(function(s,i){var h,o,l;if(this.options.backtrack_lexer&&(l={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&&(l.yylloc.range=this.yylloc.range.slice(0))),o=s[0].match(/(?:\r\n?|\n).*/g),o&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+s[0].length},this.yytext+=s[0],this.match+=s[0],this.matches=s,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(s[0].length),this.matched+=s[0],h=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),h)return h;if(this._backtrack){for(var f in l)this[f]=l[f];return!1}return!1},"test_match"),next:d.__name(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,i,h,o;this._more||(this.yytext="",this.match="");for(var l=this._currentRules(),f=0;f<l.length;f++)if(h=this._input.match(this.rules[l[f]]),h&&(!i||h[0].length>i[0].length)){if(i=h,o=f,this.options.backtrack_lexer){if(s=this.test_match(h,l[f]),s!==!1)return s;if(this._backtrack){i=!1;continue}else return!1}else if(!this.options.flex)break}return i?(s=this.test_match(i,l[o]),s!==!1?s:!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.__name(function(){var i=this.next();return i||this.lex()},"lex"),begin:d.__name(function(i){this.conditionStack.push(i)},"begin"),popState:d.__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:d.__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:d.__name(function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},"topState"),pushState:d.__name(function(i){this.begin(i)},"pushState"),stateStackSize:d.__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:d.__name(function(i,h,o,l){switch(o){case 0:return i.getLogger().trace("Found comment",h.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:i.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return i.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:i.getLogger().trace("end icon"),this.popState();break;case 10:return i.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return i.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return i.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return i.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:i.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return i.getLogger().trace("description:",h.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),i.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),i.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),i.getLogger().trace("node end ...",h.yytext),"NODE_DEND";case 30:return this.popState(),i.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),i.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),i.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),i.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),i.getLogger().trace("node end (("),"NODE_DEND";case 35:return i.getLogger().trace("Long description:",h.yytext),20;case 36:return i.getLogger().trace("Long description:",h.yytext),20}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}}})();function B(){this.yy={}}return d.__name(B,"Parser"),B.prototype=V,V.Parser=B,new B})();z.parser=z;var ue=z,pe=12,T={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},me=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=T,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{d.__name(this,"MindmapDB")}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let n=this.nodes.length-1;n>=0;n--)if(this.nodes[n].level<e)return this.nodes[n];return null}getMindmap(){return this.nodes.length>0?this.nodes[0]:null}addNode(e,n,c,a){I.log.info("addNode",e,n,c,a);let t=!1;this.nodes.length===0?(this.baseLevel=e,e=0,t=!0):this.baseLevel!==void 0&&(e=e-this.baseLevel,t=!1);const g=E.getConfig2();let m=g.mindmap?.padding??E.defaultConfig_default.mindmap.padding;switch(a){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:m*=2;break}const p={id:this.count++,nodeId:E.sanitizeText(n,g),level:e,descr:E.sanitizeText(c,g),type:a,children:[],width:g.mindmap?.maxNodeWidth??E.defaultConfig_default.mindmap.maxNodeWidth,padding:m,isRoot:t},D=this.getParent(e);if(D)D.children.push(p),this.nodes.push(p);else if(t)this.nodes.push(p);else throw new Error(`There can be only one root. No parent could be found for ("${p.descr}")`)}getType(e,n){switch(I.log.debug("In get type",e,n),e){case"[":return this.nodeType.RECT;case"(":return n===")"?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,n){this.elements[e]=n}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;const n=E.getConfig2(),c=this.nodes[this.nodes.length-1];e.icon&&(c.icon=E.sanitizeText(e.icon,n)),e.class&&(c.class=E.sanitizeText(e.class,n))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(e,n){if(e.level===0?e.section=void 0:e.section=n,e.children)for(const[c,a]of e.children.entries()){const t=e.level===0?c%(pe-1):n;this.assignSections(a,t)}}flattenNodes(e,n){const c=E.getConfig2(),a=["mindmap-node"];e.isRoot===!0?a.push("section-root","section--1"):e.section!==void 0&&a.push(`section-${e.section}`),e.class&&a.push(e.class);const t=a.join(" "),g=d.__name(p=>{const D=(c.theme?.toLowerCase()??"").includes("redux");switch(p){case T.CIRCLE:return"mindmapCircle";case T.RECT:return"rect";case T.ROUNDED_RECT:return"rounded";case T.CLOUD:return"cloud";case T.BANG:return"bang";case T.HEXAGON:return"hexagon";case T.DEFAULT:return D?"rounded":"defaultMindmapNode";case T.NO_BORDER:default:return"rect"}},"getShapeFromType"),m={id:e.id.toString(),domId:"node_"+e.id.toString(),label:e.descr,labelType:"markdown",isGroup:!1,shape:g(e.type),width:e.width,height:e.height??0,padding:e.padding,cssClasses:t,cssStyles:[],look:c.look,icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(n.push(m),e.children)for(const p of e.children)this.flattenNodes(p,n)}generateEdges(e,n){if(!e.children)return;const c=E.getConfig2();for(const a of e.children){let t="edge";a.section!==void 0&&(t+=` section-edge-${a.section}`);const g=e.level+1;t+=` edge-depth-${g}`;const m={id:`edge_${e.id}_${a.id}`,start:e.id.toString(),end:a.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:c.look,classes:t,depth:e.level,section:a.section};n.push(m),this.generateEdges(a,n)}}getData(){const e=this.getMindmap(),n=E.getConfig2(),c=E.getUserDefinedConfig().layout!==void 0,a=n;if(c||(a.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:a};I.log.debug("getData: mindmapRoot",e,n),this.assignSections(e);const t=[],g=[];this.flattenNodes(e,t),this.generateEdges(e,g),I.log.debug(`getData: processed ${t.length} nodes and ${g.length} edges`);const m=new Map;for(const p of t)m.set(p.id,{shape:p.shape,width:p.width,height:p.height,padding:p.padding});return{nodes:t,edges:g,config:a,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(m),type:"mindmap",diagramId:"mindmap-"+de()}}getLogger(){return I.log}},fe={draw:d.__name(async(e,n,c,a)=>{I.log.debug(`Rendering mindmap diagram `+e);const t=a.db,g=t.getData(),m=ae.getDiagramElement(n,g.config.securityLevel);if(g.type=a.type,g.layoutAlgorithm=te.getRegisteredLayoutAlgorithm(g.config.layout,{fallback:"cose-bilkent"}),g.diagramId=n,!t.getMindmap())return;g.nodes.forEach(y=>{y.shape==="rounded"?(y.radius=15,y.taper=15,y.stroke="none",y.width=0,y.padding=15):y.shape==="circle"?y.padding=10:y.shape==="rect"?(y.width=0,y.padding=10):y.shape==="hexagon"&&(y.width=0,y.height=0)}),await te.render(g,m);const{themeVariables:p}=E.getConfig(),{useGradient:D,gradientStart:w,gradientStop:R}=p;if(D&&w&&R){const y=m.attr("id"),b=m.append("defs").append("linearGradient").attr("id",`${y}-gradient`).attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");b.append("stop").attr("offset","0%").attr("stop-color",w).attr("stop-opacity",1),b.append("stop").attr("offset","100%").attr("stop-color",R).attr("stop-opacity",1)}oe.setupViewPortForSVG(m,g.config.mindmap?.padding??E.defaultConfig_default.mindmap.padding,"mindmapDiagram",g.config.mindmap?.useMaxWidth??E.defaultConfig_default.mindmap.useMaxWidth)},"draw")},ye=d.__name(e=>{const{theme:n,look:c}=e;let a="";for(let t=0;t<e.THEME_COLOR_LIMIT;t++)e["lineColor"+t]=e["lineColor"+t]||e["cScaleInv"+t],E.isDark(e["lineColor"+t])?e["lineColor"+t]=E.lighten(e["lineColor"+t],20):e["lineColor"+t]=E.darken(e["lineColor"+t],20);for(let t=0;t<e.THEME_COLOR_LIMIT;t++){const g=""+(c==="neo"?Math.max(10-(t-1)*2,2):17-3*t);a+=` .section-${t-1} rect, .section-${t-1} path, .section-${t-1} circle, .section-${t-1} polygon, .section-${t-1} path { fill: ${e["cScale"+t]}; } .section-${t-1} text { fill: ${e["cScaleLabel"+t]}; } .section-${t-1} span { color: ${e["cScaleLabel"+t]}; } .node-icon-${t-1} { font-size: 40px; color: ${e["cScaleLabel"+t]}; } .section-edge-${t-1}{ stroke: ${e["cScale"+t]}; } .edge-depth-${t-1}{ stroke-width: ${g}; } .section-${t-1} line { stroke: ${e["cScaleInv"+t]} ; stroke-width: 3; } .disabled, .disabled circle, .disabled text { fill: lightgray; } .disabled text { fill: #efefef; } [data-look="neo"].mindmap-node.section-${t-1} rect, [data-look="neo"].mindmap-node.section-${t-1} path, [data-look="neo"].mindmap-node.section-${t-1} circle, [data-look="neo"].mindmap-node.section-${t-1} polygon { fill: ${n==="redux"||n==="redux-dark"||n==="neutral"?e.mainBkg:e["cScale"+t]}; stroke: ${n==="redux"||n==="redux-dark"?e.nodeBorder:e["cScale"+t]}; stroke-width: ${e.strokeWidth??2}px; } [data-look="neo"].section-edge-${t-1}{ stroke: ${n?.includes("redux")||n==="neo-dark"?e.nodeBorder:e["cScale"+t]}; } [data-look="neo"].mindmap-node.section-${t-1} text { fill: ${n==="redux"||n==="redux-dark"?e.nodeBorder:e["cScaleLabel"+(n==="neutral"?1:t)]}; } `}return a},"genSections"),_e=d.__name((e,n,c)=>{let a="";for(let t=0;t<e;t++)a+=` [data-look="neo"].mindmap-node.section-${t-1} rect, [data-look="neo"].mindmap-node.section-${t-1} path, [data-look="neo"].mindmap-node.section-${t-1} circle, [data-look="neo"].mindmap-node.section-${t-1} polygon { stroke: url(${n}-gradient); fill: ${c}; } .section-${t-1} line { stroke-width: 0; }`;return a},"genGradient"),Ee={get db(){return new me},renderer:fe,parser:ue,styles:d.__name(e=>{const{theme:n}=e,c=e.svgId,a=e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${c}-drop-shadow)`):"none";return` .edge { stroke-width: 3; } ${ye(e)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${e.git0}; } .section-root text { fill: ${e.gitBranchLabel0}; } .section-root span { color: ${n?.includes("redux")?e.nodeBorder:e.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } .mindmap-node-label { dy: 1em; alignment-baseline: middle; text-anchor: middle; dominant-baseline: middle; text-align: center; } [data-look="neo"].mindmap-node { filter: ${a}; } [data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon { fill: ${n?.includes("redux")?e.mainBkg:e.git0}; } [data-look="neo"].mindmap-node.section-root .text-inner-tspan { fill: ${n?.includes("redux")?e.nodeBorder:e["cScaleLabel"+(n==="neutral"?1:0)]}; } ${e.useGradient&&c&&e.mainBkg?_e(e.THEME_COLOR_LIMIT,c,e.mainBkg):""} `},"getStyles")};exports.diagram=Ee;