1import{_ as e,az as n,aA as t,aB as r,aC as a,l as i,c as o,aD as s,aE as d,ah as c,an as g,ai as l,ag as f,aF as p,aG as h,aH as u}from"./index-C16DHWFp.js";import{G as w}from"./graph-C_ZsycKk.js";import{l as m}from"./layout-CmQUdn0S.js";import{i as v}from"./_baseUniq-BjWlgG8Y.js";import{c as y}from"./clone-VMOlTGG7.js";import{m as X}from"./_basePickBy-bVyxPQRR.js";import"./vendor-react-DejgYtBM.js";import"./vendor-semi-D8d7bTtM.js";import"./index-BeIIFw6E.js";import"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./vendor-katex-BuQuj6Fv.js";import"./dayjs.min-CASHsil8.js";import"./purify.es-Bm-lHtoJ.js";import"./index-DcbB2zxU.js";import"./vendor-highlight-CaHTjBxz.js";import"./index-B_PxGnmD.js";function E(e){var n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:b(e),edges:N(e)};return v(e.graph())||(n.value=y(e.graph())),n}function b(e){return X(e.nodes(),function(n){var t=e.node(n),r=e.parent(n),a={v:n};return v(t)||(a.value=t),v(r)||(a.parent=r),a})}function N(e){return X(e.edges(),function(n){var t=e.edge(n),r={v:n.v,w:n.w};return v(n.name)||(r.name=n.name),v(t)||(r.value=t),r})}var x=new Map,C=new Map,S=new Map,I=e(()=>{C.clear(),S.clear(),x.clear()},"clear"),D=e((e,n)=>{const t=C.get(n)||[];return i.trace("In isDescendant",n," ",e," = ",t.includes(e)),t.includes(e)},"isDescendant"),j=e((e,n)=>{const t=C.get(n)||[];return i.info("Descendants of ",n," is ",t),i.info("Edge is ",e),e.v!==n&&e.w!==n&&(t?t.includes(e.v)||D(e.v,n)||D(e.w,n)||t.includes(e.w):(i.debug("Tilt, ",n,",not in descendants"),!1))},"edgeInCluster"),O=e((e,n,t,r)=>{i.warn("Copying children of ",e,"root",r,"data",n.node(e),r);const a=n.children(e)||[];e!==r&&a.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",a),a.forEach(a=>{if(n.children(a).length>0)O(a,n,t,r);else{const o=n.node(a);i.info("cp ",a," to ",r," with parent ",e),t.setNode(a,o),r!==n.parent(a)&&(i.warn("Setting parent",a,n.parent(a)),t.setParent(a,n.parent(a))),e!==r&&a!==e?(i.debug("Setting parent",a,e),t.setParent(a,e)):(i.info("In copy ",e,"root",r,"data",n.node(e),r),i.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));const s=n.edges(a);i.debug("Copying Edges",s),s.forEach(a=>{i.info("Edge",a);const o=n.edge(a.v,a.w,a.name);i.info("Edge data",o,r);try{j(a,r)?(i.info("Copying as ",a.v,a.w,o,a.name),t.setEdge(a.v,a.w,o,a.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",a.v,"--\x3e",a.w," rootId: ",r," clusterId:",e)}catch(s){i.error(s)}})}i.debug("Removing node",a),n.removeNode(a)})},"copy"),k=e((e,n)=>{const t=n.children(e);let r=[...t];for(const a of t)S.set(a,e),r=[...r,...k(a,n)];return r},"extractDescendants"),G=e((e,n,t)=>{const r=e.edges().filter(e=>e.v===n||e.w===n),a=e.edges().filter(e=>e.v===t||e.w===t),i=r.map(e=>({v:e.v===n?t:e.v,w:e.w===n?n:e.w})),o=a.map(e=>({v:e.v,w:e.w}));return i.filter(e=>o.some(n=>e.v===n.v&&e.w===n.w))},"findCommonEdges"),B=e((e,n,t)=>{const r=n.children(e);if(i.trace("Searching children of id ",e,r),r.length<1)return e;let a;for(const i of r){const e=B(i,n,t),r=G(n,t,e);if(e){if(!(r.length>0))return e;a=e}}return a},"findNonClusterChild"),P=e(e=>x.has(e)&&x.get(e).externalConnections&&x.has(e)?x.get(e).id:e,"getAnchorId"),A=e((e,n)=>{if(!e||n>10)i.debug("Opting out, no graph ");else{i.debug("Opting in, graph "),e.nodes().forEach(function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",B(n,e,n)),C.set(n,k(n,e)),x.set(n,{id:B(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const t=e.children(n),r=e.edges();t.length>0?(i.debug("Cluster identified",n,C),r.forEach(e=>{D(e.v,n)^D(e.w,n)&&(i.warn("Edge: ",e," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",C.get(n)),x.get(n).externalConnections=!0)})):i.debug("Not a cluster ",n,C)});for(let n of x.keys()){const t=x.get(n).id,r=e.parent(t);r!==n&&x.has(r)&&!x.get(r).externalConnections&&(x.get(n).id=r)}
1e.edges().forEach(function(n){const t=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let r=n.v,a=n.w;if(i.warn("Fix XXX",x,"ids:",n.v,n.w,"Translating: ",x.get(n.v)," --- ",x.get(n.w)),x.get(n.v)||x.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),r=P(n.v),a=P(n.w),e.removeEdge(n.v,n.w,n.name),r!==n.v){const a=e.parent(r);x.get(a).externalConnections=!0,t.fromCluster=n.v}if(a!==n.w){const r=e.parent(a);x.get(r).externalConnections=!0,t.toCluster=n.w}i.warn("Fix Replacing with XXX",r,a,n.name),e.setEdge(r,a,t,n.name)}}),i.warn("Adjusted Graph",E(e)),J(e,0),i.trace(x)}},"adjustClustersAndEdges"),J=e((e,n)=>{if(i.warn("extractor - ",n,E(e),e.children("D")),n>10)return void i.error("Bailing out");let t=e.nodes(),r=!1;for(const a of t){const n=e.children(a);r=r||n.length>0}if(r){i.debug("Nodes = ",t,n);for(const r of t)if(i.debug("Extracting node",r,x,x.has(r)&&!x.get(r).externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",n),x.has(r))if(!x.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){i.warn("Cluster without external connections, without a parent and with children",r,n);let t="TB"===e.graph().rankdir?"LR":"TB";x.get(r)?.clusterData?.dir&&(t=x.get(r).clusterData.dir,i.warn("Fixing dir",x.get(r).clusterData.dir,t));const a=new w({multigraph:!0,compound:!0}).setGraph({rankdir:t,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",E(e)),O(r,e,a,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:x.get(r).clusterData,label:x.get(r).label,graph:a}),i.warn("New graph after copy node: (",r,")",E(a)),i.debug("Old graph after copy",E(e))}else i.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!x.get(r).externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),n),i.debug(x);else i.debug("Not a cluster",r,n);t=e.nodes(),i.warn("New list of nodes",t);for(const r of t){const t=e.node(r);i.warn(" Now next level",r,t),t?.clusterNode&&J(t.graph,n+1)}}else i.debug("Done, no node has children",e.nodes())},"extractor"),T=e((e,n)=>{if(0===n.length)return[];let t=Object.assign([],n);return n.forEach(n=>{const r=e.children(n),a=T(e,r);t=[...t,...a]}),t},"sorter"),R=e(e=>T(e,e.children()),"sortNodesByHierarchy"),F=e(async(n,t,r,a,o,w)=>{i.warn("Graph in recursive render:XAX",E(t),o);const v=t.graph().rankdir;i.trace("Dir in recursive render - dir:",v);const y=n.insert("g").attr("class","root");t.nodes()?i.info("Recursive render XXX",t.nodes()):i.info("No nodes found for",t),t.edges().length>0&&i.info("Recursive edges",t.edge(t.edges()[0]));const X=y.insert("g").attr("class","clusters"),b=y.insert("g").attr("class","edgePaths"),N=y.insert("g").attr("class","edgeLabels"),C=y.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(e){const n=t.node(e);if(void 0!==o){const n=JSON.parse(JSON.stringify(o.clusterData));i.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",n.height,"\nParent cluster",o.height),t.setNode(o.id,n),t.parent(e)||(i.trace("Setting parent",e,o.id),t.setParent(e,o.id,n))}if(i.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),n?.clusterNode){i.info("Cluster identified XBX",e,n.width,t.node(e));const{ranksep:o,nodesep:c}=t.graph();n.graph.setGraph({...n.graph.graph(),ranksep:o+25,nodesep:c});const g=await F(C,n.graph,r,a,t.node(e),w),l=g.elem;s(n,l),n.diff=g.diff||0,i.info("New compound node after recursive render XAX",e,"width",n.width,"height",n.height),d(l,n)}else t.children(e).length>0?(i.trace("Cluster - the non recursive path XBX",e,n.id,n,n.width,"Graph:",t),i.trace(B(n.id,t)),x.set(n.id,{id:B(n.id,t),node:n})):(i.trace("Node - the non recursive path XAX",e,C,t.node(e),v),await c(C,t.node(e),{config:w,dir:v}))}));const S=e(async()=>{const e=t.edges().map(async function(e){const n=t.edge(e.v,e.w,e.name);i.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),i.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),i.info("Fix",x,"ids:",e.v,e.w,"Translating: ",x.get(e.v),x.get(e.w)),await u(N,n)});await Promise.all(e)},"processEdges");await S(),i.info("Graph before layout:",JSON.stringify(E(t))),i.info("############################################# XXX"),i.info("### Layout ### XXX"),i.info("############################################# XXX"),m(t),i.info("Graph after layout:",JSON.stringify(E(t)));let I=0,{subGraphTitleTotalMargin:D}=g(w);return await Promise.all(R(t).map(async function(e){const n=t.node(e);if(i.info("Position XBX => "+e+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n?.clusterNode)n.y+=D,i.info("A tainted cluster node XBX1",e,n.id,n.width,n.height,n.x,n.y,t.parent(e)),x.get(n.id).node=n,l(n);else if(t.children(e).length>0){i.info("A pure cluster node XBX1",e,n.id,n.x,n.y,n.width,n.height,t.parent(e)),n.height+=D,t.node(n.parentId);const r=n?.padding/2||0,a=n?.labelBBox?.height||0,o=a-r||0;i.debug("OffsetY",o,"labelHeight",a,"halfPadding",r),await f(X,n),x.get(n.id).node=n}else{const e=t.node(n.parentId);n.y+=D/2,i.info("A regular node XBX1 - using the padding",n.id,"parent",n.parentId,n.width,n.height,n.x,n.y,"offsetY",n.offsetY,"parent",e,e?.offsetY,n),l(n)}}
vendor: 1,949 bytes, line 1
1)),t.edges().forEach(function(e){const n=t.edge(e);i.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(n),n),n.points.forEach(e=>e.y+=D/2);const o=t.node(e.v);var s=t.node(e.w);const d=p(b,n,x,r,o,s,a);h(n,d)}),t.nodes().forEach(function(e){const n=t.node(e);i.info(e,n.type,n.diff),n.isGroup&&(I=n.diff)}),i.warn("Returning from recursive render XAX",y,I),{elem:y,diff:I}},"recursiveRender"),L=e(async(e,s)=>{const d=new w({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),c=s.select("g");n(c,e.markers,e.type,e.diagramId),t(),r(),a(),I(),e.nodes.forEach(e=>{d.setNode(e.id,{...e}),e.parentId&&d.setParent(e.id,e.parentId)}),i.debug("Edges:",e.edges),e.edges.forEach(e=>{if(e.start===e.end){const n=e.start,t=n+"---"+n+"---1",r=n+"---"+n+"---2",a=d.node(n);d.setNode(t,{domId:t,id:t,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),d.setParent(t,a.parentId),d.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),d.setParent(r,a.parentId);const i=structuredClone(e),o=structuredClone(e),s=structuredClone(e);i.label="",i.arrowTypeEnd="none",i.id=n+"-cyclic-special-1",o.arrowTypeStart="none",o.arrowTypeEnd="none",o.id=n+"-cyclic-special-mid",s.label="",a.isGroup&&(i.fromCluster=n,s.toCluster=n),s.id=n+"-cyclic-special-2",s.arrowTypeStart="none",d.setEdge(n,t,i,n+"-cyclic-special-0"),d.setEdge(t,r,o,n+"-cyclic-special-1"),d.setEdge(r,n,s,n+"-cyc<lic-special-2")}else d.setEdge(e.start,e.end,{...e},e.id)}),i.warn("Graph at first:",JSON.stringify(E(d))),A(d),i.warn("Graph after XAX:",JSON.stringify(E(d)));const g=o();await F(c,d,e.type,e.diagramId,void 0,g)},"render");export{L as render};
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.