${e.children.map(t).join("")}
`:`Unsupported markdown: ${e.type}`})).join("")}(e);return function(t,e,n,i,r=!1){const a=t.append("foreignObject"),o=a.append("xhtml:div"),s=e.label,c=e.isNode?"nodeLabel":"edgeLabel";o.html(`\n "+s+""),function(t,e){e&&t.attr("style",e)}(o,e.labelStyle),o.style("display","table-cell"),o.style("white-space","nowrap"),o.style("max-width",n+"px"),o.attr("xmlns","http://www.w3.org/1999/xhtml"),r&&o.attr("class","labelBkg");let l=o.node().getBoundingClientRect();return l.width===n&&(o.style("display","table"),o.style("white-space","break-spaces"),o.style("width",n+"px"),l=o.node().getBoundingClientRect()),a.style("width",l.width),a.style("height",l.height),a.node()}(t,{isNode:o,label:gf(i).replace(/fa[blrs]?:fa-[\w-]+/g,(t=>``)),labelStyle:n.replace("fill:","color:")},s,r,c)}return function(t,e,n,i=!1){const r=e.append("g"),a=r.insert("rect").attr("class","background"),o=r.append("text").attr("y","-10.1");let s=0;for(const e of n){const n=e=>AL(r,1.1,e)<=t,i=n(e)?[e]:EL(e,n);for(const t of i)LL(CL(o,s,1.1),t),s++}if(i){const t=o.node().getBBox(),e=2;return a.attr("x",-e).attr("y",-e).attr("width",t.width+2*e).attr("height",t.height+2*e),r.node()}return o.node()}(s,t,kL(e),c)},OL=async(t,e,n,i)=>{let r;const a=e.useHtmlLabels||Sc(sg().flowchart.htmlLabels);r=n||"node default";const o=t.insert("g").attr("class",r).attr("id",e.domId||e.id),s=o.insert("g").attr("class","label").attr("style",e.labelStyle);let c;c=void 0===e.labelText?"":"string"==typeof e.labelText?e.labelText:e.labelText[0];const l=s.node();let u;u="markdown"===e.labelType?IL(s,_c(gf(c),sg()),{useHtmlLabels:a,width:e.width||sg().flowchart.wrappingWidth,classes:"markdown-node-label"}):l.appendChild(DA(_c(gf(c),sg()),e.labelStyle,!1,i));let h=u.getBBox();const f=e.padding/2;if(Sc(sg().flowchart.htmlLabels)){const t=u.children[0],e=ee(u),n=t.getElementsByTagName("img");if(n){const t=""===c.replace(/]*>/g,"").trim();await Promise.all([...n].map((e=>new Promise((n=>{function i(){if(e.style.display="flex",e.style.flexDirection="column",t){const t=sg().fontSize?sg().fontSize:window.getComputedStyle(document.body).fontSize,n=5,i=parseInt(t,10)*n+"px";e.style.minWidth=i,e.style.maxWidth=i}else e.style.width="100%";n(e)}setTimeout((()=>{e.complete&&i()})),e.addEventListener("error",i),e.addEventListener("load",i)})))))}h=t.getBoundingClientRect(),e.attr("width",h.width),e.attr("height",h.height)}return a?s.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"):s.attr("transform","translate(0, "+-h.height/2+")"),e.centerLabel&&s.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:o,bbox:h,halfPadding:f,label:s}},NL=(t,e)=>{const n=e.node().getBBox();t.width=n.width,t.height=n.height};function DL(t,e,n,i){return t.insert("polygon",":first-child").attr("points",i.map((function(t){return t.x+","+t.y})).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+n/2+")")}let PL={},BL={},RL={};const FL=(t,e)=>(l.trace("In isDescendant",e," ",t," = ",BL[e].includes(t)),!!BL[e].includes(t)),$L=(t,e,n,i)=>{l.warn("Copying children of ",t,"root",i,"data",e.node(t),i);const r=e.children(t)||[];t!==i&&r.push(t),l.warn("Copying (nodes) clusterId",t,"nodes",r),r.forEach((r=>{if(e.children(r).length>0)$L(r,e,n,i);else{const a=e.node(r);l.info("cp ",r," to ",i," with parent ",t),n.setNode(r,a),i!==e.parent(r)&&(l.warn("Setting parent",r,e.parent(r)),n.setParent(r,e.parent(r))),t!==i&&r!==t?(l.debug("Setting parent",r,t),n.setParent(r,t)):(l.info("In copy ",t,"root",i,"data",e.node(t),i),l.debug("Not Setting parent for node=",r,"cluster!==rootId",t!==i,"node!==clusterId",r!==t));const o=e.edges(r);l.debug("Copying Edges",o),o.forEach((r=>{l.info("Edge",r);const a=e.edge(r.v,r.w,r.name);l.info("Edge data",a,i);try{((t,e)=>(l.info("Descendants of ",e," is ",BL[e]),l.info("Edge is ",t),t.v!==e&&t.w!==e&&(BL[e]?BL[e].includes(t.v)||FL(t.v,e)||FL(t.w,e)||BL[e].includes(t.w):(l.debug("Tilt, ",e,",not in descendants"),!1))))(r,i)?(l.info("Copying as ",r.v,r.w,a,r.name),n.setEdge(r.v,r.w,a,r.name),l.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):l.info("Skipping copy of edge ",r.v,"--\x3e",r.w," rootId: ",i," clusterId:",t)}catch(t){l.error(t)}}))}l.debug("Removing node",r),e.removeNode(r)}))},jL=(t,e)=>{const n=e.children(t);let i=[...n];for(const r of n)RL[r]=t,i=[...i,...jL(r,e)];return i},zL=(t,e)=>{l.trace("Searching",t);const n=e.children(t);if(l.trace("Searching children of id ",t,n),n.length<1)return l.trace("This is a valid node",t),t;for(const i of n){const n=zL(i,e);if(n)return l.trace("Found replacement for",t," => ",n),n}},qL=t=>PL[t]&&PL[t].externalConnections&&PL[t]?PL[t].id:t,HL=(t,e)=>{if(l.warn("extractor - ",e,MA(t),t.children("D")),e>10)return void l.error("Bailing out");let n=t.nodes(),i=!1;for(const e of n){const n=t.children(e);i=i||n.length>0}if(i){l.debug("Nodes = ",n,e);for(const i of n)if(l.debug("Extracting node",i,PL,PL[i]&&!PL[i].externalConnections,!t.parent(i),t.node(i),t.children("D")," Depth ",e),PL[i])if(!PL[i].externalConnections&&t.children(i)&&t.children(i).length>0){l.warn("Cluster without external connections, without a parent and with children",i,e);let n="TB"===t.graph().rankdir?"LR":"TB";PL[i]&&PL[i].clusterData&&PL[i].clusterData.dir&&(n=PL[i].clusterData.dir,l.warn("Fixing dir",PL[i].clusterData.dir,n));const r=new dC({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}}));l.warn("Old graph before copy",MA(t)),$L(i,t,r,i),t.setNode(i,{clusterNode:!0,id:i,clusterData:PL[i].clusterData,labelText:PL[i].labelText,graph:r}),l.warn("New graph after copy node: (",i,")",MA(r)),l.debug("Old graph after copy",MA(t))}else l.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!PL[i].externalConnections," no parent: ",!t.parent(i)," children ",t.children(i)&&t.children(i).length>0,t.children("D"),e),l.debug(PL);else l.debug("Not a cluster",i,e);n=t.nodes(),l.warn("New list of nodes",n);for(const i of n){const n=t.node(i);l.warn(" Now next level",i,n),n.clusterNode&&HL(n.graph,e+1)}}else l.debug("Done, no node has children",t.nodes())},UL=(t,e)=>{if(0===e.length)return[];let n=Object.assign(e);return e.forEach((e=>{const i=t.children(e),r=UL(t,i);n=[...n,...r]})),n};function GL(t,e,n,i){var r=t.x,a=t.y,o=r-i.x,s=a-i.y,c=Math.sqrt(e*e*s*s+n*n*o*o),l=Math.abs(e*n*o/c);i.x