Liga-System/.venv/lib/python3.12/site-packages/nicegui/elements/mermaid/dist/dagre-6U6BRBRP-DNm7ISCW.js

3 lines
11 KiB
JavaScript
Raw Normal View History

2026-02-16 09:18:53 +01:00
import{f as e}from"./chunk-FASC7IG4-_FzvpI2d.js";import{m as t}from"./chunk-ZN7TASNU-DDZ3ESNM.js";import{m as n,aN as r,aO as a,aP as i,aQ as d,t as o,h as s,aR as l,aS as g,aw as c,aT as f,aB as h,ax as p,av as u,aU as w,aV as v}from"./index-Bd_j0xvv.js";import{s as y,_ as m,J as X}from"./chunk-5ZJXQJOJ-BQpwB-Bn.js";function N(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:E(e),edges:b(e)};return y(e.graph())||(t.value=m(e.graph())),t}function E(e){return X(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),a={v:t};return y(n)||(a.value=n),y(r)||(a.parent=r),a})}function b(e){return X(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return y(t.name)||(r.name=t.name),y(n)||(r.value=n),r})}n(N,"write"),n(E,"writeNodes"),n(b,"writeEdges");var C=new Map,S=new Map,x=new Map,I=n(()=>{S.clear(),x.clear(),C.clear()},"clear"),D=n((e,t)=>{let n=S.get(t)||[];return o.trace("In isDescendant",t," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),O=n((e,t)=>{let n=S.get(t)||[];return o.info("Descendants of ",t," is ",n),o.info("Edge is ",e),e.v!==t&&e.w!==t&&(n?n.includes(e.v)||D(e.v,t)||D(e.w,t)||n.includes(e.w):(o.debug("Tilt, ",t,",not in descendants"),!1))},"edgeInCluster"),k=n((e,t,n,r)=>{o.warn("Copying children of ",e,"root",r,"data",t.node(e),r);let a=t.children(e)||[];e!==r&&a.push(e),o.warn("Copying (nodes) clusterId",e,"nodes",a),a.forEach(a=>{if(t.children(a).length>0)k(a,t,n,r);else{let i=t.node(a);o.info("cp ",a," to ",r," with parent ",e),n.setNode(a,i),r!==t.parent(a)&&(o.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==r&&a!==e?(o.debug("Setting parent",a,e),n.setParent(a,e)):(o.info("In copy ",e,"root",r,"data",t.node(e),r),o.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));let d=t.edges(a);o.debug("Copying Edges",d),d.forEach(a=>{o.info("Edge",a);let i=t.edge(a.v,a.w,a.name);o.info("Edge data",i,r);try{O(a,r)?(o.info("Copying as ",a.v,a.w,i,a.name),n.setEdge(a.v,a.w,i,a.name),o.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):o.info("Skipping copy of edge ",a.v,"--\x3e",a.w," rootId: ",r," clusterId:",e)}catch(e){o.error(e)}})}o.debug("Removing node",a),t.removeNode(a)})},"copy"),J=n((e,t)=>{let n=t.children(e),r=[...n];for(let a of n)x.set(a,e),r=[...r,...J(a,t)];return r},"extractDescendants"),G=n((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),a=e.edges().filter(e=>e.v===n||e.w===n),i=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),d=a.map(e=>({v:e.v,w:e.w}));return i.filter(e=>d.some(t=>e.v===t.v&&e.w===t.w))},"findCommonEdges"),P=n((e,t,n)=>{let r,a=t.children(e);if(o.trace("Searching children of id ",e,a),a.length<1)return e;for(let e of a){let a=P(e,t,n),i=G(t,n,a);if(a){if(!(i.length>0))return a;r=a}}return r},"findNonClusterChild"),A=n(e=>C.has(e)&&C.get(e).externalConnections&&C.has(e)?C.get(e).id:e,"getAnchorId"),B=n((e,t)=>{if(!e||t>10)o.debug("Opting out, no graph ");else{o.debug("Opting in, graph "),e.nodes().forEach(function(t){e.children(t).length>0&&(o.warn("Cluster identified",t," Replacement id in edges: ",P(t,e,t)),S.set(t,J(t,e)),C.set(t,{id:P(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(o.debug("Cluster identified",t,S),r.forEach(e=>{D(e.v,t)^D(e.w,t)&&(o.warn("Edge: ",e," leaves cluster ",t),o.warn("Descendants of XXX ",t,": ",S.get(t)),C.get(t).externalConnections=!0)})):o.debug("Not a cluster ",t,S)});for(let t of C.keys()){let n=C.get(t).id,r=e.parent(n);r!==t&&C.has(r)&&!C.get(r).externalConnections&&(C.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);o.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),o.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(e.edge(t)));let r=t.v,a=t.w;if(o.warn("Fix XXX",C,"ids:",t.v,t.w,"Translating: ",C.get(t.v)," --- ",C.get(t.w)),C.get(t.v)||C.get(t.w)){if(o.warn("Fixing and trying - removing XXX",t.v,t.w,t.name),r=A(t.v),a=A(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let a=e.parent(r);C.get(a).externalConnections=!0,n.fromCluster=t.v}if(a!==t.w
//# sourceMappingURL=dagre-6U6BRBRP-DNm7ISCW.js.map