vendor: 10,627 bytes, lines 1-4
1import{f as B}from"./chunk-R7JDMUKV-BZt3hZWo.js";import{m as y,bi as E,a as G,am as k,p as f,bj as O,bk as A,bl as J,bm as $,bn as F,bo as X,bp as w,bq as Y,b2 as C,br as q,aZ as N,aX as z,b1 as Z,b3 as j}from"./mermaid.esm.min-U7CnX3ab.js";import"./app-BsECO0k0.js";var D=y((a,e,r)=>Math.max(e,Math.min(r,a)),"clamp"),T=y((a="TB")=>{switch(a){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),H=y(a=>a==="flowchart"||a==="flowchart-v2"||a==="stateDiagram"||a==="er"||a==="classDiagram","shouldMergeSelfLoopSegments"),K=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Q=y((a,e,r,o,n)=>{let l=[],h=new Set;if(r.forEach(({start:i,end:t})=>{i!==o&&h.add(i),t!==o&&h.add(t)}),h.forEach(i=>{let t=a.node(i);typeof t?.x=="number"&&typeof t?.y=="number"&&l.push(t)}),l.length===0&&r.forEach(({edge:i})=>{(i.points??[]).forEach(t=>{typeof t?.x=="number"&&typeof t?.y=="number"&&l.push(t)})}),l.length===0)return T(n);let g=l.reduce((i,t)=>({x:i.x+t.x/l.length,y:i.y+t.y/l.length}),{x:0,y:0}),s=g.x-e.x,d=g.y-e.y;return Math.abs(s)>Math.abs(d)?s>0?"right":"left":Math.abs(d)>0?d>0?"bottom":"top":T(n)},"getSelfLoopSide"),U=y((a,e="top",r=0,o=0)=>{let n=a.x,l=a.y-r,h=a.width/2,g=a.height/2,s=Math.max(36,Math.min(100,a.width*.8)),d=D(Math.max(o,a.width*.35),36,s),i=D(Math.min(a.width,a.height)*.45,24,48);switch(e){case"bottom":{let t=l+g;return[{x:n-d/2,y:t},{x:n-d/2,y:t+i},{x:n+d/2,y:t+i},{x:n+d/2,y:t}]}case"right":{let t=n+h;return[{x:t,y:l-d/2},{x:t+i,y:l-d/2},{x:t+i,y:l+d/2},{x:t,y:l+d/2}]}case"left":{let t=n-h;return[{x:t,y:l-d/2},{x:t-i,y:l-d/2},{x:t-i,y:l+d/2},{x:t,y:l+d/2}]}case"top":default:{let t=l-g;return[{x:n-d/2,y:t},{x:n-d/2,y:t-i},{x:n+d/2,y:t-i},{x:n+d/2,y:t}]}}},"getSelfLoopPoints"),V=y((a,e,r="top",o=0,n={})=>{let l=a.x,h=a.y-o,g=n.width??0,s=n.height??0;switch(r){case"bottom":return{x:l,y:Math.max(...e.map(d=>d.y))+s/2+4};case"right":return{x:Math.max(...e.map(d=>d.x))+g/2+4,y:h};case"left":return{x:Math.min(...e.map(d=>d.x))-g/2-4,y:h};case"top":default:return{x:l,y:Math.min(...e.map(d=>d.y))-s/2-4}}},"getSelfLoopLabelPosition"),v=y((a,e=0,{mergeSelfLoops:r=!0}={})=>{let o=new Map,n=[],l=a.graph()?.rankdir;return a.edges().forEach(h=>{let g=a.edge(h);if(r&&g.selfLoop){let s=g.selfLoop.id;o.has(s)||o.set(s,[]),o.get(s).push({edge:g,start:h.v,end:h.w})}else n.push({edge:g,start:h.v,end:h.w})}),o.forEach(h=>{if(h.length!==3){h.forEach(L=>n.push(L));return}h.sort((L,x)=>L.edge.selfLoop.order-x.edge.selfLoop.order);let[g,s,d]=h,i=g.edge.originalEdge??s.edge.originalEdge??d.edge.originalEdge??s.edge,t=a.node(i.start);if(!t){h.forEach(L=>n.push(L));return}let m={width:s.edge.width,height:s.edge.height},b=Q(a,t,h,i.start,l),c=U(t,b,e,m.width??0),p=V(t,c,b,e,m),u={...s.edge,...i,id:i.id,points:c,start:i.start,end:i.end,x:p.x,y:p.y,width:m.width,height:m.height,labelStyle:s.edge.labelStyle,fromCluster:g.edge.fromCluster??s.edge.fromCluster??d.edge.fromCluster,toCluster:g.edge.toCluster??s.edge.toCluster??d.edge.toCluster};delete u.selfLoop,delete u.originalEdge,n.push({edge:u,start:u.start,end:u.end})}),n},"getEdgesToRender"),M=y(async({element:a,graph:e,diagramType:r,id:o,parentCluster:n,siteConfig:l})=>{let h=e.graph().rankdir;f.trace("Dir in recursive render - dir:",h);let{clusters:g,edgePaths:s,edgeLabels:d,nodes:i,rootGroups:t}=J(a,{edgePathsClass:"edgePaths"});e.nodes()?f.info("Recursive render XXX",e.nodes()):f.info("No nodes found for",e),e.edges().length>0&&f.info("Recursive edges",e.edge(e.edges()[0]));let m=H(r);await Promise.all(e.nodes().map(async function(c){let p=e.node(c);if(n!==void 0){let u=JSON.parse(JSON.stringify(n.clusterData));f.trace(`Setting data for parent cluster XXX 2 Node.id = `,c,` 3 data=`,u.height,` 4Parent cluster`,n.height),e.setNode(n.id,u),e.parent(c)||(f.trace("Setting parent",c,n.id),e.setParent(c,n.id,u))}if(f.info("(Insert) Node XXX"+c+": "+JSON.stringify(e.node(c))),p?.clusterNode){f.info("Cluster identified XBX",c,p.width,e.node(c));let{ranksep:u,nodesep:L}=e.graph();p.graph.setGraph({...p.graph.graph(),ranksep:u+25,nodesep:L});let x=await ae({element:i,graph:p.graph,diagramType:r,id:o,parentCluster:e.node(c),siteConfig:l}),S=x.elem;$(p,S),p.diff=x.diff||0,f.info("New compound node after recursive render XAX",c,"width",p.width,"height",p.height),F(S,p)}else e.children(c).length>0?(f.trace("Cluster - the non recursive path XBX",c,p.id,p,p.width,"Graph:",e),f.trace(X(p.id,e)),w.set(p.id,{id:X(p.id,e),node:p})):(f.trace("Node - the non recursive path XAX",c,i,e.node(c),h),await Y(i,e.node(c),{config:l,dir:h}))})),await y(async()=>{let c=e.edges().map(async function(p){let u=e.edge(p.v,p.w,p.name);if(f.info("Edge "+p.v+" -> "+p.w+": "+JSON.stringify(p)),f.info("Edge "+p.v+" -> "+p.w+": ",p," ",JSON.stringify(e.edge(p))),f.info("Fix",w,"ids:",p.v,p.w,"Translating: ",w.get(p.v),w.get(p.w)),m&&u.selfLoop){if(u.selfLoop.order!==1)return;let L={...u.originalEdge,...u,id:u.selfLoop.id,startLabelLeft:u.originalEdge?.startLabelLeft??u.startLabelLeft,startLabelRight:u.originalEdge?.startLabelRight??u.startLabelRight,endLabelLeft:u.originalEdge?.endLabelLeft??u.endLabelLeft,endLabelRight:u.originalEdge?.endLabelRight??u.endLabelRight};await C(d,L),u.width=L.width,u.height=L.height,u.labelStyle=L.labelStyle;return}await C(d,u)});await Promise.all(c)},"processEdges")();let{subGraphTitleTotalMargin:b}=q(l);return{elem:t,graph:e,groups:{clusters:g,edgePaths:s,edgeLabels:d,nodes:i,rootGroups:t},diagramType:r,id:o,mergeSelfLoops:m,subGraphTitleTotalMargin:b}},"measureDagreGraph"),P=y(a=>{f.info("############################################# XXX"),f.info("### Layout ### XXX"),f.info("############################################# XXX"),B(a)},"runDagreGraphLayout"),W=y((a,e,r)=>{let o=a.node(e);if(!o)return;let n={...o};return o?.clusterNode?n.y=(o.y??0)+r:a.children(e).length>0?n.height=(o.height??0)+r:n.y=(o.y??0)+r/2,n},"normalizeDagreNode"),R=y((a,e)=>{K.forEach(r=>{e[r]!==void 0&&(a[r]=e[r])})},"applyDagreNodeLayout"),_=y((a,e,r,o)=>({...a,start:a.start??e,end:a.end??r,points:(a.points??[]).map(n=>({...n,y:typeof n.y=="number"?n.y+o:n.y}))}),"normalizeDagreEdge"),ee=y((a,e)=>{let{graph:r,mergeSelfLoops:o,subGraphTitleTotalMargin:n=0}=e,l=new Map(a.nodes.map(g=>[g.id,g]));E(r).forEach(g=>{let s=W(r,g,n);if(!s)return;R(r.node(g),s);let d=l.get(g);d&&R(d,s)});let h=n/2;return a.edges=v(r,h,{mergeSelfLoops:o}).map(({edge:g,start:s,end:d})=>_(g,s,d,h)),a},"applyDagreLayoutResult"),te=y(async({elem:a,graph:e,groups:{clusters:r,edgePaths:o},diagramType:n,id:l,mergeSelfLoops:h,subGraphTitleTotalMargin:g})=>{let s=0;await Promise.all(E(e).map(async function(i){let t=e.node(i);if(f.info("Position XBX => "+i+": ("+t.x,","+t.y,") width: ",t.width," height: ",t.height),t?.clusterNode)t.y+=g,f.info("A tainted cluster node XBX1",i,t.id,t.width,t.height,t.x,t.y,e.parent(i)),w.get(t.id).node=t,N(t);else if(e.children(i).length>0){f.info("A pure cluster node XBX1",i,t.id,t.x,t.y,t.width,t.height,e.parent(i)),t.height+=g,e.node(t.parentId);let m=t?.padding/2||0,b=t?.labelBBox?.height||0,c=b-m||0;f.debug("OffsetY",c,"labelHeight",b,"halfPadding",m),await z(r,t),w.get(t.id).node=t}else{let m=e.node(t.parentId);t.y+=g/2,f.info("A regular node XBX1 - using the padding",t.id,"parent",t.parentId,t.width,t.height,t.x,t.y,"offsetY",t.offsetY,"parent",m,m?.offsetY,t),N(t)}}));let d=g/2;return v(e,d,{mergeSelfLoops:h}).forEach(function({edge:i,start:t,end:m}){f.info("Edge "+t+" -> "+m+": "+JSON.stringify(i),i),i.points.forEach(u=>u.y+=d);let b=e.node(t),c=e.node(m),p=Z(o,i,w,n,b,c,l);j(i,p)}),e.nodes().forEach(function(i){let t=e.node(i);f.info(i,t.type,t.diff),t.isGroup&&(s=t.diff)}),f.warn("Returning from recursive render XAX",a,s),{elem:a,diff:s}},"paintDagreLayoutCore"),ae=y(async a=>{let e=await M(a);return P(e.graph),await te(e)},"renderDagreSubgraph"),I=y(a=>{let e=new k({multigraph:!0,compound:!0}).setGraph({rankdir:a.direction,nodesep:a.config?.nodeSpacing||a.nodeSpacing||a.config?.flowchart?.nodeSpacing,ranksep:a.config?.rankSpacing||a.rankSpacing||a.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return a.nodes.forEach(r=>{e.setNode(r.id,{...r}),r.parentId&&e.setParent(r.id,r.parentId)}),f.debug("Edges:",a.edges),a.edges.forEach(r=>{if(r.start===r.end){let o=r.start,n=o+"---"+o+"---1",l=o+"---"+o+"---2",h=e.node(o);e.setNode(n,{domId:n,id:n,parentId:h.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(n,h.parentId),e.setNode(l,{domId:l,id:l,parentId:h.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(l,h.parentId);let g=structuredClone(r),s=structuredClone(r),d=structuredClone(r),i=structuredClone(r);s.originalEdge=g,s.selfLoop={id:g.id,order:0},d.originalEdge=g,d.selfLoop={id:g.id,order:1},i.originalEdge=g,i.selfLoop={id:g.id,order:2},s.label="",s.arrowTypeEnd="none",s.endLabelLeft="",s.endLabelRight="",s.startLabelLeft="",s.id=o+"-cyclic-special-1",d.startLabelRight="",d.startLabelLeft="",d.endLabelLeft="",d.endLabelRight="",d.arrowTypeStart="none",d.arrowTypeEnd="none",d.id=o+"-cyclic-special-mid",i.label="",i.startLabelRight="",i.startLabelLeft="",i.arrowTypeStart="none",h.isGroup&&(s.fromCluster=o,i.toCluster=o),i.id=o+"-cyclic-special-2",i.arrowTypeStart="none",e.setEdge(o,n,s,o+"-cyclic-special-0"),e.setEdge(n,l,d,o+"-cyclic-special-1"),e.setEdge(l,o,i,o+"-cyclic-special-2")}else e.setEdge(r.start,r.end,{...r},r.id)}),O(e),{graph:e}},"prepareLayoutForDagre"),re=y(async(a,{element:e,preparedLayout:r})=>{let o=r??I(a),n=G(),l=await M({element:e,graph:o.graph,diagramType:a.type,id:a.diagramId,parentCluster:void 0,siteConfig:n});return o.measuredLayout=l,l},"measureDagreLayout"),ie=y((a,e)=>{let r=e.preparedLayout?.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return P(r.graph),ee(a,r),r},"runDagreLayoutCore"),de=y((a,{measure:e})=>E(e.graph).map(r=>e.graph.node(r)).filter(Boolean),"getDagrePaintNodes"),ne=y((a,e,{measure:r})=>a?r.graph.node(a):void 0,"getDagreEdgeNode"),ge=A({prepareLayout:I,measureLayout:re,runLayoutCore:ie,paintOptions:{clusterDb:w,getNodes:de,getEdgeNode:ne,skipNode:y((a,{measure:e})=>!e.graph.hasNode(a.id),"skipNode"),isCluster:y((a,{measure:e})=>e.graph.hasNode(a.id)&&(e.graph.children(a.id)??[]).length>0,"isCluster")}});export{ee as applyDagreLayoutResult,v as getEdgesToRender,re as measureDagreLayout,I as prepareLayoutForDagre,ge as render,ie as runDagreLayoutCore};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.