Files
static-php-cli/assets/chunks/chunk-RYQCIY6F.ClwB5JGD.js

1 line
6.9 KiB
JavaScript
Raw Normal View History

import{m as e}from"./src.OgxTg4hg.js";import{n as t}from"./chunk-Y2CYZVJY.DsF7k-Jl.js";import{r as n,t as r}from"./graphlib.DS17s2tU.js";import{r as i,t as a}from"./map.DWGJ5h2_.js";var o=4;function s(e){return i(e,o)}function c(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:l(e),edges:u(e)};return n(e.graph())||(t.value=s(e.graph())),t}function l(e){return a(e.nodes(),function(t){var r=e.node(t),i=e.parent(t),a={v:t};return n(r)||(a.value=r),n(i)||(a.parent=i),a})}function u(e){return a(e.edges(),function(t){var r=e.edge(t),i={v:t.v,w:t.w};return n(t.name)||(i.name=t.name),n(r)||(i.value=r),i})}var d=new Map,f=new Map,p=new Map,m=t(()=>{f.clear(),p.clear(),d.clear()},`clear`),h=t((t,n)=>{let r=f.get(n)||[];return e.trace(`In isDescendant`,n,` `,t,` = `,r.includes(t)),r.includes(t)},`isDescendant`),g=t((t,n)=>{let r=f.get(n)||[];return e.info(`Descendants of `,n,` is `,r),e.info(`Edge is `,t),t.v===n||t.w===n?!1:r?r.includes(t.v)||h(t.v,n)||h(t.w,n)||r.includes(t.w):(e.debug(`Tilt, `,n,`,not in descendants`),!1)},`edgeInCluster`),_=t((t,n,r,i)=>{e.warn(`Copying children of `,t,`root`,i,`data`,n.node(t),i);let a=n.children(t)||[];t!==i&&a.push(t),e.warn(`Copying (nodes) clusterId`,t,`nodes`,a),a.forEach(a=>{if(n.children(a).length>0)_(a,n,r,i);else{let o=n.node(a);e.info(`cp `,a,` to `,i,` with parent `,t),r.setNode(a,o),i!==n.parent(a)&&(e.warn(`Setting parent`,a,n.parent(a)),r.setParent(a,n.parent(a))),t!==i&&a!==t?(e.debug(`Setting parent`,a,t),r.setParent(a,t)):(e.info(`In copy `,t,`root`,i,`data`,n.node(t),i),e.debug(`Not Setting parent for node=`,a,`cluster!==rootId`,t!==i,`node!==clusterId`,a!==t));let s=n.edges(a);e.debug(`Copying Edges`,s),s.forEach(a=>{e.info(`Edge`,a);let o=n.edge(a.v,a.w,a.name);e.info(`Edge data`,o,i);try{if(g(a,i)){let t=f.get(i)||[],s=t.includes(a.v)||h(a.v,i)||a.v===i,c=t.includes(a.w)||h(a.w,i)||a.w===i;if(s&&c)e.info(`Copying as `,a.v,a.w,o,a.name),r.setEdge(a.v,a.w,o,a.name),e.info(`newGraph edges `,r.edges(),r.edge(r.edges()[0]));else{let t=s?i:a.v,r=c?i:a.w;e.info(`Rebinding cross-boundary edge as `,t,r,o,a.name),n.setEdge(t,r,o,a.name)}}else e.info(`Skipping copy of edge `,a.v,`-->`,a.w,` rootId: `,i,` clusterId:`,t)}catch(t){e.error(t)}})}e.debug(`Removing node`,a),n.removeNode(a)})},`copy`),v=t((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)p.set(i,e),r=[...r,...v(i,t)];return r},`extractDescendants`),y=t((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),b=t((t,n,r)=>{let i=n.children(t);if(e.trace(`Searching children of id `,t,i),i.length<1)return t;let a;for(let e of i){let t=b(e,n,r),i=y(n,r,t);if(t)if(i.length>0)a=t;else return t}return a},`findNonClusterChild`),x=t(e=>!d.has(e)||!d.get(e).externalConnections?e:d.has(e)?d.get(e).id:e,`getAnchorId`),S=t((t,n)=>{if(!t||n>10){e.debug(`Opting out, no graph `);return}else e.debug(`Opting in, graph `);t.nodes().forEach(function(n){t.children(n).length>0&&(e.warn(`Cluster identified`,n,` Replacement id in edges: `,b(n,t,n)),f.set(n,v(n,t)),d.set(n,{id:b(n,t,n),clusterData:t.node(n)}))}),t.nodes().forEach(function(n){let r=t.children(n),i=t.edges();r.length>0?(e.debug(`Cluster identified`,n,f),i.forEach(t=>{h(t.v,n)^h(t.w,n)&&(e.warn(`Edge: `,t,` leaves cluster `,n),e.warn(`Descendants of XXX `,n,`: `,f.get(n)),d.get(n).externalConnections=!0)})):e.debug(`Not a cluster `,n,f)});for(let e of d.keys()){let n=d.get(e).id,r=t.parent(n);r!==e&&d.has(r)&&!d.get(r).externalConnections&&(d.get(e).id=r);let i=t.edges().some(t=>t.v===e);if(n&&d.get(e)?.externalConnections&&i&&E(t,n,e)){let r=D(t,e,t.parent(n));r&&(d.get(e).id=r)}}t.edges().forEach(function(n){let r=t.edge(n);e.warn(`Edge `+n.v+` -> `+n.w+`: `+JSON.stringify(n)),e.warn(`Edge `+n.v+` -> `+n.w+`: `+JSON.stringify(t.edge(n)));let i=n.v,a=n.w;if(e.warn(`Fix XXX`,d,`ids:`,n.v,n.w,`Translating: `,d.get(n.v),` --- `,d.get(n.w)),d.get(n.v)