You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9480],{79480:function(e,t,a){a.d(t,{diagram:function(){return S}});var r=a(9490),n=a(36783),o=a(33549),l=a(51893),i=a(97908);a(89539),a(99824),a(68985);let s=(e,t,a)=>{let{parentById:r}=a,n=new Set,o=e;for(;o;){if(n.add(o),o===t)return o;o=r[o]}for(o=t;o;){if(n.has(o))return o;o=r[o]}return"root"},c=new i,d={},h={},p={},u=async function(e,t,a,r,n,i,s){let c=a.select('[id="'.concat(t,'"]')).insert("g").attr("class","nodes"),d=Object.keys(e);return await Promise.all(d.map(async function(t){let a,s;let d=e[t],h="default";d.classes.length>0&&(h=d.classes.join(" ")),h+=" flowchart-label";let u=(0,l.k)(d.styles),b=void 0!==d.text?d.text:d.id,g={width:0,height:0},y=[{id:d.id+"-west",layoutOptions:{"port.side":"WEST"}},{id:d.id+"-east",layoutOptions:{"port.side":"EAST"}},{id:d.id+"-south",layoutOptions:{"port.side":"SOUTH"}},{id:d.id+"-north",layoutOptions:{"port.side":"NORTH"}}],w=0,k="",f={};switch(d.type){case"round":w=5,k="rect";break;case"square":case"group":default:k="rect";break;case"diamond":k="question",f={portConstraints:"FIXED_SIDE"};break;case"hexagon":k="hexagon";break;case"odd":case"odd_right":k="rect_left_inv_arrow";break;case"lean_right":k="lean_right";break;case"lean_left":k="lean_left";break;case"trapezoid":k="trapezoid";break;case"inv_trapezoid":k="inv_trapezoid";break;case"circle":k="circle";break;case"ellipse":k="ellipse";break;case"stadium":k="stadium";break;case"subroutine":k="subroutine";break;case"cylinder":k="cylinder";break;case"doublecircle":k="doublecircle"}let x={labelStyle:u.labelStyle,shape:k,labelText:b,labelType:d.labelType,rx:w,ry:w,class:h,style:u.style,id:d.id,link:d.link,linkTarget:d.linkTarget,tooltip:n.db.getTooltip(d.id)||"",domId:n.db.lookUpDomId(d.id),haveCallback:d.haveCallback,width:"group"===d.type?500:void 0,dir:d.dir,type:d.type,props:d.props,padding:(0,l.E)().flowchart.padding};if("group"!==x.type)a=(s=await (0,o.e)(c,x,d.dir)).node().getBBox();else{r.createElementNS("http://www.w3.org/2000/svg","text");let{shapeSvg:e,bbox:t}=await (0,o.l)(c,x,void 0,!0);g.width=t.width,g.wrappingWidth=(0,l.E)().flowchart.wrappingWidth,g.height=t.height,g.labelNode=e.node(),x.labelData=g}let m={id:d.id,ports:"diamond"===d.type?y:[],layoutOptions:f,labelText:b,labelData:g,domId:n.db.lookUpDomId(d.id),width:null==a?void 0:a.width,height:null==a?void 0:a.height,type:d.type,el:s,parent:i.parentById[d.id]};p[x.id]=m})),s},b=(e,t,a)=>{let r={TB:{in:{north:"north"},out:{south:"west",west:"east",east:"south"}},LR:{in:{west:"west"},out:{east:"south",south:"north",north:"east"}},RL:{in:{east:"east"},out:{west:"north",north:"south",south:"west"}},BT:{in:{south:"south"},out:{north:"east",east:"west",west:"north"}}};return r.TD=r.TB,l.l.info("abc88",a,t,e),r[a][t][e]},g=(e,t,a)=>{if(l.l.info("getNextPort abc88",{node:e,edgeDirection:t,graphDirection:a}),!d[e])switch(a){case"TB":case"TD":d[e]={inPosition:"north",outPosition:"south"};break;case"BT":d[e]={inPosition:"south",outPosition:"north"};break;case"RL":d[e]={inPosition:"east",outPosition:"west"};break;case"LR":d[e]={inPosition:"west",outPosition:"east"}}let r="in"===t?d[e].inPosition:d[e].outPosition;return"in"===t?d[e].inPosition=b(d[e].inPosition,t,a):d[e].outPosition=b(d[e].outPosition,t,a),r},y=(e,t)=>{let a=e.start,r=e.end,n=a,o=r,l=p[a],i=p[r];return l&&i?("diamond"===l.type&&(a="".concat(a,"-").concat(g(a,"out",t))),"diamond"===i.type&&(r="".concat(r,"-").concat(g(r,"in",t))),{source:a,target:r,sourceId:n,targetId:o}):{source:a,target:r}},w=function(e,t,a,r){let i,s;l.l.info("abc78 edges = ",e);let c=r.insert("g").attr("class","edgeLabels"),d={},p=t.db.getDirection();if(void 0!==e.defaultStyle){let t=(0,l.k)(e.defaultStyle);i=t.style,s=t.labelStyle}return e.forEach(function(t){let r="L-"+t.start+"-"+t.end;void 0===d[r]?d[r]=0:d[r]++,l.l.info("abc78 new entry",r,d[r]);let u=r+"-"+d[r];l.l.info("abc78 new link id to be used is",r,u,d[r]);let b="LS-"+t.start,g="LE-"+t.end,w={style:"",labelStyle:""};switch(w.minlen=t.length||1,"arrow_open"===t.type?w.arrowhead="none":w.arrowhead="normal",w.arrowTypeStart="arrow_open",w.arrowTypeEnd="arrow_open",t.type){case"double_arrow_cross":w.arrowTypeStart="arrow_cross";case"arrow_cross":w.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":w.arrowTypeStart="arrow_point";case"arrow_point":w.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":w.arrowTypeStart="arrow_circle";case"arrow_circle":w.arrowTypeEnd="arrow_circle"}let k="",f="";switch(t.stroke){case"normal":k="fill:none;",void 0!==i&&(k=i),void 0!==s&&(f=s),w.thickness="normal",w.pattern="solid";break;case"dotted":w.thickness="normal",w.pattern="dotted",w.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":w.thickness="thick",w.pattern="solid",w.style="stroke-width: 3.5px;fill:none;"}if(void 0!==t.style){let e=(0,l.k)(t.style);k=e.style,f=e.labelStyle}w.style=w.style+=k,w.labelStyle=w.labelStyle+=f,void 0!==t.interpolate?w.curve=(0,l.n)(t.interpolate,n.c_6):void 0!==e.defaultInterpolate?w.curve=(0,l.n)(e.defaultInterpolate,n.c_6):w.curve=(0,l.n)(h.curve,n.c_6),void 0===t.text?void 0!==t.style&&(w.arrowheadStyle="fill: #333"):(w.arrowheadStyle="fill: #333",w.labelpos="c"),w.labelType=t.labelType,w.label=t.text.replace(l.e.lineBreakRegex,"\n"),void 0===t.style&&(w.style=w.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),w.labelStyle=w.labelStyle.replace("color:","fill:"),w.id=u,w.classes="flowchart-link "+b+" "+g;let x=(0,o.f)(c,w),{source:m,target:_,sourceId:E,targetId:T}=y(t,p);l.l.debug("abc78 source and target",m,_),a.edges.push({id:"e"+t.start+t.end,sources:[m],targets:[_],sourceId:E,targetId:T,labelEl:x,labels:[{width:w.width,height:w.height,orgWidth:w.width,orgHeight:w.height,text:w.label,layoutOptions:{"edgeLabels.inline":"true","edgeLabels.placement":"CENTER"}}],edgeData:w})}),a},k=function(e,t,a,r,n){let o="";switch(r&&(o=(o=(o=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search).replace(/\(/g,"\\(")).replace(/\)/g,"\\)")),t.arrowTypeStart){case"arrow_cross":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-crossStart)");break;case"arrow_point":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-pointStart)");break;case"arrow_barb":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-barbStart)");break;case"arrow_circle":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-circleStart)");break;case"aggregation":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-aggregationStart)");break;case"extension":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-extensionStart)");break;case"composition":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-compositionStart)");break;case"dependency":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-dependencyStart)");break;case"lollipop":e.attr("marker-start","url("+o+"#"+n+"_"+a+"-lollipopStart)")}switch(t.arrowTypeEnd){case"arrow_cross":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-crossEnd)");break;case"arrow_point":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-pointEnd)");break;case"arrow_barb":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-barbEnd)");break;case"arrow_circle":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-circleEnd)");break;case"aggregation":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-aggregationEnd)");break;case"extension":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-extensionEnd)");break;case"composition":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-compositionEnd)");break;case"dependency":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-dependencyEnd)");break;case"lollipop":e.attr("marker-end","url("+o+"#"+n+"_"+a+"-lollipopEnd)")}},f=function(e){let t={parentById:{},childrenById:{}},a=e.getSubGraphs();return l.l.info("Subgraphs - ",a),a.forEach(function(e){e.nodes.forEach(function(a){t.parentById[a]=e.id,void 0===t.childrenById[e.id]&&(t.childrenById[e.id]=[]),t.childrenById[e.id].push(a)})}),a.forEach(function(e){e.id,void 0!==t.parentById[e.id]&&t.parentById[e.id]}),t},x=function(e,t,a){let r=s(e,t,a);if(void 0===r||"root"===r)return{x:0,y:0};let n=p[r].offset;return{x:n.posX,y:n.posY}},m=function(e,t,a,r,l,i){let s=x(t.sourceId,t.targetId,l),c=t.sections[0].startPoint,d=t.sections[0].endPoint,h=(t.sections[0].bendPoints?t.sections[0].bendPoints:[]).map(e=>[e.x+s.x,e.y+s.y]),p=[[c.x+s.x,c.y+s.y],...h,[d.x+s.x,d.y+s.y]],{x:u,y:b}=(0,o.j)(t.edgeData),g=(0,n.jvg)().x(u).y(b).curve(n.c_6),y=e.insert("path").attr("d",g(p)).attr("class","path "+a.classes).attr("fill","none"),w=e.insert("g").attr("class","edgeLabel"),f=(0,n.Ys)(w.node().appendChild(t.labelEl)),m=f.node().firstChild.getBoundingClientRect();f.attr("width",m.width),f.attr("height",m.height),w.attr("transform","translate(".concat(t.labels[0].x+s.x,", ").concat(t.labels[0].y+s.y,")")),k(y,a,r.type,r.arrowMarkerAbsolute,i)},_=(e,t)=>{e.forEach(e=>{e.children||(e.children=[]);let a=t.childrenById[e.id];a&&a.forEach(t=>{e.children.push(p[t])}),_(e.children,t)})},E=async function(e,t,a,r){var i;let s,h;r.db.clear(),p={},d={},r.db.setGen("gen-2"),r.parser.parse(e);let b=(0,n.Ys)("body").append("div").attr("style","height:400px").attr("id","cy"),g={id:"root",layoutOptions:{"elk.hierarchyHandling":"INCLUDE_CHILDREN","org.eclipse.elk.padding":"[top=100, left=100, bottom=110, right=110]","elk.layered.spacing.edgeNodeBetweenLayers":"30","elk.direction":"DOWN"},children:[],edges:[]};switch(l.l.info("Drawing flowchart using v3 renderer",c),r.db.getDirection()){case"BT":g.layoutOptions["elk.direction"]="UP";break;case"TB":g.layoutOptions["elk.direction"]="DOWN";break;case"LR":g.layoutOptions["elk.direction"]="RIGHT";break;case"RL":g.layoutOptions["elk.direction"]="LEFT"}let{securityLevel:y,flowchart:k}=(0,l.E)();"sandbox"===y&&(s=(0,n.Ys)("#i"+t));let x="sandbox"===y?(0,n.Ys)(s.nodes()[0].contentDocument.body):(0,n.Ys)("body"),E="sandbox"===y?s.nodes()[0].contentDocument:document,v=x.select('[id="'.concat(t,'"]'));(0,o.a)(v,["point","circle","cross"],r.type,t);let S=r.db.getVertices(),C=r.db.getSubGraphs();l.l.info("Subgraphs - ",C);for(let e=C.length-1;e>=0;e--)h=C[e],r.db.addVertex(h.id,{text:h.title,type:h.labelType},"group",void 0,h.classes,h.dir);let B=v.insert("g").attr("class","subgraphs"),I=f(r.db);g=await u(S,t,x,E,r,I,g);let P=v.insert("g").attr("class","edges edgePath");g=w(r.db.getEdges(),r,g,v),Object.keys(p).forEach(e=>{let t=p[e];t.parent||g.children.push(t),void 0!==I.childrenById[e]&&(t.labels=[{text:t.labelText,layoutOptions:{"nodeLabels.placement":"[H_CENTER, V_TOP, INSIDE]"},width:t.labelData.width,height:t.labelData.height}],delete t.x,delete t.y,delete t.width,delete t.height)}),_(g.children,I),l.l.info("after layout",JSON.stringify(g,null,2));let D=await c.layout(g);T(0,0,D.children,v,B,r,0),l.l.info("after layout",D),null==(i=D.edges)||i.map(e=>{m(P,e,e.edgeData,r,I,t)}),(0,l.o)({},v,k.diagramPadding,k.useMaxWidth),b.remove()},T=(e,t,a,r,n,o,i)=>{a.forEach(function(a){if(a){if(p[a.id].offset={posX:a.x+e,posY:a.y+t,x:e,y:t,depth:i,width:a.width,height:a.height},"group"===a.type){let r=n.insert("g").attr("class","subgraph");r.insert("rect").attr("class","subgraph subgraph-lvl-"+i%5+" node").attr("x",a.x+e).attr("y",a.y+t).attr("width",a.width).attr("height",a.height);let o=r.insert("g").attr("class","label"),s=(0,l.E)().flowchart.htmlLabels?a.labelData.width/2:0;o.attr("transform","translate(".concat(a.labels[0].x+e+a.x+s,", ").concat(a.labels[0].y+t+a.y+3,")")),o.node().appendChild(a.labelData.labelNode),l.l.info("Id (UGH)= ",a.type,a.labels)}else l.l.info("Id (UGH)= ",a.id),a.el.attr("transform","translate(".concat(a.x+e+a.width/2,", ").concat(a.y+t+a.height/2,")"))}}),a.forEach(function(a){a&&"group"===a.type&&T(e+a.x,t+a.y,a.children,r,n,o,i+1)})},v=e=>{let t="";for(let a=0;a<5;a++)t+="\n .subgraph-lvl-".concat(a," {\n fill: ").concat(e["surface".concat(a)],";\n stroke: ").concat(e["surfacePeer".concat(a)],";\n }\n ");return t},S={db:r.d,renderer:{getClasses:function(e,t){return l.l.info("Extracting classes"),t.db.getClasses()},draw:E},parser:r.p,styles:e=>".label {\n font-family: ".concat(e.fontFamily,";\n color: ").concat(e.nodeTextColor||e.textColor,";\n }\n .cluster-label text {\n fill: ").concat(e.titleColor,";\n }\n .cluster-label span {\n color: ").concat(e.titleColor,";\n }\n\n .label text,span {\n fill: ").concat(e.nodeTextColor||e.textColor,";\n color: ").concat(e.nodeTextColor||e.textColor,";\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(e.mainBkg,";\n stroke: ").concat(e.nodeBorder,";\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ").concat(e.arrowheadColor,";\n }\n\n .edgePath .path {\n stroke: ").concat(e.lineColor,";\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ").concat(e.lineColor,";\n fill: none;\n }\n\n .edgeLabel {\n background-color: ").concat(e.edgeLabelBackground,";\n rect {\n opacity: 0.85;\n background-color: ").concat(e.edgeLabelBackground,";\n fill: ").concat(e.edgeLabelBackground,";\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ").concat(e.clusterBkg,";\n stroke: ").concat(e.clusterBorder,";\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ").concat(e.titleColor,";\n }\n\n .cluster span {\n color: ").concat(e.titleColor,";\n }\n /* .cluster div {\n color: ").concat(e.titleColor,";\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ").concat(e.fontFamily,";\n font-size: 12px;\n background: ").concat(e.tertiaryColor,";\n border: 1px solid ").concat(e.border2,";\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ").concat(e.textColor,";\n }\n .subgraph {\n stroke-width:2;\n rx:3;\n }\n // .subgraph-lvl-1 {\n // fill:#ccc;\n // // stroke:black;\n // }\n\n .flowchart-label text {\n text-anchor: middle;\n }\n\n ").concat(v(e),"\n")}}}]); |