Socket
Socket
Sign inDemoInstall

dagre-compound

Package Overview
Dependencies
3
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.6 to 0.0.7

2

dist/dagre-compound.es5.js

@@ -1,1 +0,1 @@

import{graphlib as e,layout as t}from"dagre";var n,i,o,d;!function(e){e[e.META=0]="META",e[e.OP=1]="OP",e[e.SERIES=2]="SERIES"}(n||(n={})),function(e){e[e.META=0]="META",e[e.NODE=1]="NODE",e[e.BRIDGE=2]="BRIDGE"}(i||(i={})),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE",e[e.UNSPECIFIED=2]="UNSPECIFIED"}(o||(o={})),function(e){e[e.META=0]="META",e[e.CORE=1]="CORE",e[e.BRIDGE=2]="BRIDGE"}(d||(d={}));class r{constructor(e){this.cardinality=1,this.include=o.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=i.NODE,this.name=e.name,this.attr=e.attr||{},this.inputs=e.inputs,this.path=e.path||[],this.width=e.width,this.height=e.height}}class a{constructor(){this.nodes={},this.edges=[]}}function s(e){const t=new a;return e.nodes.map((e=>new r(e))).forEach((e=>{t.nodes[e.name]=e,e.inputs.forEach((n=>{!function(e,t,n){n.name!==t.name&&e.edges.push(Object.assign(Object.assign({},n.attr),{v:n.name,w:t.name}))}(t,e,n)}))})),t}class h{constructor(e,t={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=o.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=i.META,this.name=e,this.metaGraph=u(e,d.META,t)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map((e=>this.metaGraph.node(e)))}getRootNode(){let e=this.name.split("/"),t=this.name+"/("+e[e.length-1]+")";return this.metaGraph.node(t)}leaves(){let e,t=[],n=[this];for(;n.length;){let i=n.shift();i.isGroupNode?(e=i.metaGraph,e.nodes().forEach((t=>n.push(e.node(t))))):t.push(i.name)}return t}}class c{constructor(e,t){this.v=e,this.w=t,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,t){this.baseEdgeList.push(e)}}function g(e,t={}){return new h(e,t)}function p(e,t){return new c(e,t)}function u(t,n,i){const o=i||{},d=new e.Graph(o);return d.setGraph({name:t,rankdir:o.rankdir||"BT",type:n}),d}function l(e){return`◬${e}◬`}const f=l("ROOT"),m=l("BRIDGE_GRAPH"),E={graph:{meta:{nodeSep:50,rankSep:50,edgeSep:5}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};class w{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=g(f,this.graphOptions),this.index[f]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,t){this.index[e]=t}getBridgeGraph(e){const t=this.index[e];if(!t)throw Error("Could not find node in hierarchy: "+e);if(!("metaGraph"in t))return null;const n=t;if(n.bridgeGraph)return n.bridgeGraph;const i=u(m,d.BRIDGE,this.graphOptions);if(n.bridgeGraph=i,!t.parentNode||!("metaGraph"in t.parentNode))return i;const o=t.parentNode;return[o.metaGraph,this.getBridgeGraph(o.name)].forEach((t=>{t.edges().filter((t=>t.v===e||t.w===e)).forEach((n=>{const o=n.w===e;t.edge(n).baseEdgeList.forEach((t=>{const[d,r]=o?[t.w,n.v]:[t.v,n.w],a=this.getChildName(e,d),s={v:o?r:a,w:o?a:r};let h=i.edge(s);h||(h=p(s.v,s.w),h.inbound=o,i.setEdge(s.v,s.w,h)),h.addBaseEdge(t,this)}))}))})),i}getChildName(e,t){let n=this.index[t];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+t)}getPredecessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!0)}getSuccessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!1)}getOneWayEdges(e,t){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const i=e.parentNode,o=i.metaGraph,d=this.getBridgeGraph(i.name);return b(o,e,t,n),b(d,e,t,n),n}}function x(e,t){const n=new w({rankdir:t.rankDirection});return function(e,t){Object.keys(t.nodes).forEach((n=>{const i=t.nodes[n],o=i.path;let d=e.root;d.depth=Math.max(o.length,d.depth);for(let t=0;t<o.length&&(d.depth=Math.max(d.depth,o.length-t),d.cardinality+=i.cardinality,t!==o.length-1);t++){const n=o[t];let r=e.node(n);r||(r=g(n,e.graphOptions),r.path=i.path.slice(0,t+1),r.parentNode=d,e.setNode(n,r),d.metaGraph.setNode(n,r)),d=r}e.setNode(i.name,i),i.parentNode=d,d.metaGraph.setNode(i.name,i)}))}(n,e),function(e,t){const n=e.getNodeMap();let i=[],o=[];const d=(e,t)=>{let n=0;for(;e;)t[n++]=e.name,e=e.parentNode;return n-1};t.edges.forEach((r=>{i=[],o=[];let a=d(t.nodes[r.v],i),s=d(t.nodes[r.w],o);for(;i[a]===o[s];)if(a--,s--,a<0||s<0)throw Error("No difference found between ancestor paths.");const h=n[i[a+1]],c=i[a],g=o[s];let u=h.metaGraph.edge(c,g);u||(u=p(c,g),h.metaGraph.setEdge(c,g,u)),u.addBaseEdge(r,e)}))}(n,e),n}function b(e,t,n,i){(n?e.inEdges(t.name):e.outEdges(t.name)).forEach((t=>{const n=e.edge(t);i.push(n)}))}class N{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new O(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(e){if(e in this.hasSubHierarchy)return;this.hasSubHierarchy[e]=!0;const t=this.index[e];if(t.node.type!==i.META)return;const n=t,d=n.node.metaGraph,r=n.coreGraph;d.nodes().forEach((e=>{const t=this.getOrCreateRenderNodeByName(e);r.setNode(e,t)})),d.edges().forEach((e=>{const t=d.edge(e),n=new G(t);r.setEdge(e.v,e.w,n)}));const a=n.node.parentNode;if(!a)return;const s=this.getRenderNodeByName(a.name),h=(e,...t)=>t.concat([e?"IN":"OUT"]).join("~~"),c=this.hierarchy.getBridgeGraph(e);c.edges().forEach((e=>{!!d.node(e.w)?e.v:e.w})),c.edges().forEach((t=>{const n=c.edge(t),g=!!d.node(t.w),[p,u]=g?[t.w,t.v]:[t.v,t.w],l=t=>{const n=g?{v:t,w:e}:{v:e,w:t};return s.coreGraph.edge(n)};let f=l(u);f||(f=l(h(g,u,a.name)));const m=h(g,e),E=h(g,u,e);let w=r.node(E);if(!w){let e=r.node(m);if(!e){const t={name:m,type:i.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:o.UNSPECIFIED,inbound:g,attr:{}};e=new y(t),this.index[m]=e,r.setNode(m,e)}const t={name:E,type:i.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:o.UNSPECIFIED,inbound:g,attr:{}};w=new y(t),this.index[E]=w,r.setNode(E,w),r.setParent(E,m),e.node.cardinality++}const x=new G(n);x.adjoiningMetaEdge=f,g?r.setEdge(E,p,x):r.setEdge(p,E,x)})),[!0,!1].forEach((t=>{const n=h(t,e);r.node(n)&&r.nodes().forEach((e=>{if(r.node(e).node.type===i.BRIDGE)return;t?r.predecessors(e).length:r.successors(e).length}))}))}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const t=this.getNodeByName(e);return t?(this.index[e]=t.isGroupNode?new O(t,this.hierarchy.graphOptions):new y(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class y{constructor(e){this.node=e,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=e.width||0,this.height=e.height||0,this.displayName=e.name,this.attr=e.attr}}class G{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[],this.startMarkerId=null,this.endMarkerId=null}}class O extends y{constructor(e,t){super(e);const n=e.metaGraph.graph();t.compound=!0,this.coreGraph=u(n.name,d.CORE,t)}}function B(e,n=E){e.node.isGroupNode&&function(e,t){e.coreGraph.nodes().map((t=>e.coreGraph.node(t))).forEach((e=>{const{height:n,width:o}=e;switch(e.node.type){case i.NODE:Object.assign(e,t.nodeSize.node),e.height=n||t.nodeSize.node.height,e.width=o||t.nodeSize.node.width;break;case i.BRIDGE:Object.assign(e,t.nodeSize.bridge);break;case i.META:if(e.expanded){B(e,t)}else Object.assign(e,t.nodeSize.meta),e.height=t.nodeSize.meta.height,e.width=t.nodeSize.meta.width;break;default:throw Error("Unrecognized node type: "+e.node.type)}e.expanded||function(e){e.coreBox.width=e.width,e.coreBox.height=e.height;const t=`${e.displayName}`.length,n=3;e.width=Math.max(e.coreBox.width,t*n)}(e)}))}(e,n),e.node.type===i.META&&function(e,n){const o=n.subScene.meta;Object.assign(e,o),Object.assign(e.coreBox,function(e,n){Object.assign(e.graph(),{nodesep:n.nodeSep,ranksep:n.rankSep,edgesep:n.edgeSep});const o=[];if(e.nodes().forEach((t=>{e.node(t).node.type!==i.BRIDGE&&o.push(t)})),!o.length)return{width:0,height:0};t(e);let d=1/0,r=1/0,a=-1/0,s=-1/0;return o.forEach((t=>{const n=e.node(t),i=.5*n.width,o=n.x-i,h=n.x+i;d=o<d?o:d,a=h>a?h:a;const c=.5*n.height,g=n.y-c,p=n.y+c;r=g<r?g:r,s=p>s?p:s})),e.edges().forEach((t=>{const n=e.edge(t),i=e.node(n.metaEdge.v),o=e.node(n.metaEdge.w);if(3===n.points.length&&function(e){let t=S(e[0],e[1]);for(let n=1;n<e.length-1;n++){const i=S(e[n],e[n+1]);if(Math.abs(i-t)>1)return!1;t=i}return!0}(n.points)){if(null!=i){const e=i.expanded?i.x:v(i);n.points[0].x=e}if(null!=o){const e=o.expanded?o.x:v(o);n.points[2].x=e}n.points=[n.points[0],n.points[1]]}const h=n.points[n.points.length-2];null!=o&&(n.points[n.points.length-1]=I(h,o));const c=n.points[1];null!=i&&(n.points[0]=I(c,i)),n.points.forEach((e=>{d=e.x<d?e.x:d,a=e.x>a?e.x:a,r=e.y<r?e.y:r,s=e.y>s?e.y:s}))})),e.nodes().forEach((t=>{const n=e.node(t);n.x-=d,n.y-=r})),e.edges().forEach((t=>{e.edge(t).points.forEach((e=>{e.x-=d,e.y-=r}))})),{width:a-d,height:s-r}}(e.coreGraph,n.graph.meta));let d=0;e.coreGraph.nodeCount()>0&&d++;const r=d<=1?0:d;e.coreBox.width+=r+r,e.coreBox.height=o.labelHeight+e.coreBox.height,e.width=e.coreBox.width+o.paddingLeft+o.paddingRight,e.height=e.paddingTop+e.coreBox.height+e.paddingBottom}(e,n)}function S(e,t){const n=t.x-e.x,i=t.y-e.y;return 180*Math.atan(i/n)/Math.PI}function v(e){if(e.expanded)return e.x;return e.x-e.width/2+0+e.coreBox.width/2}function I(e,t){const n=t.expanded?t.x:v(t),i=t.y,o=e.x-n,d=e.y-i;let r,a,s=t.expanded?t.width:t.coreBox.width,h=t.expanded?t.height:t.coreBox.height;return Math.abs(d)*s/2>Math.abs(o)*h/2?(d<0&&(h=-h),r=0===d?0:h/2*o/d,a=h/2):(o<0&&(s=-s),r=s/2,a=0===o?0:s/2*d/o),{x:n+r,y:i+a}}function M(e,t,n){const i=e.nodes.filter(((e,t,n)=>n.findIndex((t=>t.id===e.id))!==t)).map((e=>e.id));if(i.length)throw new Error(`Duplicated ids found: ${i.join(", ")}`);const o=function(e){const t={nodes:[]},n=Object.keys(e.compound||{}),i=new Map,o=(t,d=[])=>{const r=0===d.length;if(i.has(t))return i.get(t);for(let i=0;i<n.length;i++){let r=n[i];if(e.compound&&-1!==e.compound[r].indexOf(t))return d.unshift(r),o(r,d)}return r&&i.set(t,d),d},d=t=>e.edges.filter((e=>e.w===t)).map((e=>({name:e.v})));return e.nodes.forEach((e=>{const n=e.id,i=[...o(n),n];let r=d(n);t.nodes.push({name:n,path:i,inputs:r,width:e.width,height:e.height,attr:Object.assign({},e)})})),t}(e),d=function(e,t){const n=(e,t)=>{for(let n of t.values())if(n.includes(e))return!0;return!1},i=(e,t=[])=>{if(0===Object.keys(e).length)return[...new Set(t)];const o=new Map(Object.keys(e).map((t=>[t,e[t]]))),d={};for(let[e,i]of o)n(e,o)?d[e]=i:t=t.concat(e,i);return i(d,t)};return i(e).filter((e=>t.includes(e)))}(e.compound||{},(null==t?void 0:t.expanded)||[]),{renderInfo:r}=function(e,t="LR"){const n=x(s(e),{rankDirection:t}),i=function(e){return new N(e)}(n);return{hierarchy:n,renderInfo:i}}(o,t&&t.rankDirection?t.rankDirection:"LR");return function(e,t){t.forEach((t=>{const n=e.getRenderInfoNodes().find((e=>e.displayName===t));let i=n&&n.node&&n.node.name||"";const o=e.getRenderNodeByName(i);if(!o)throw new Error(`No nodes found: ${i}`);o.expanded=!0,e.buildSubHierarchy(i)}))}(r,d),B(r.root,function(e={}){var t,n,i,o;const d=(null===(t=null==e?void 0:e.graph)||void 0===t?void 0:t.meta)||{},r=(null===(n=null==e?void 0:e.subScene)||void 0===n?void 0:n.meta)||{},a=(null===(i=null==e?void 0:e.nodeSize)||void 0===i?void 0:i.meta)||{},s=(null===(o=null==e?void 0:e.nodeSize)||void 0===o?void 0:o.node)||{},h=E.nodeSize.bridge;return{graph:{meta:Object.assign(E.graph.meta,d)},subScene:{meta:Object.assign(E.subScene.meta,r)},nodeSize:{meta:Object.assign(E.nodeSize.meta,a),node:Object.assign(E.nodeSize.node,s),bridge:h}}}(n)),R(r.root)}function R(e){const t=e.coreGraph.nodes().map((t=>e.coreGraph.node(t)));return Object.assign(Object.assign({},j(e)),{expanded:e.expanded,nodes:e.expanded?(n=t,n.map((e=>e.node.type===i.META?R(e):j(e)))):[],edges:e.expanded?D(e):[]});var n}function j(e){return{name:e.node.name,type:e.node.type,attr:e.attr,parentNodeName:e.node.parentNode?e.node.parentNode.name:null,coreBox:Object.assign({},e.coreBox),x:e.x,y:e.y,width:e.width,height:e.height,radius:e.radius,labelHeight:e.labelHeight,labelOffset:e.labelOffset,outboxWidth:e.outboxWidth,paddingLeft:e.paddingLeft,paddingTop:e.paddingTop,paddingRight:e.paddingRight,paddingBottom:e.paddingBottom}}function D(e){return e.coreGraph.edges().map((t=>({renderInfoEdge:e.coreGraph.edge(t),edge:t}))).filter((({renderInfoEdge:e})=>e.metaEdge)).map((({edge:t,renderInfoEdge:n})=>{const i=function(e,t){const n=t.points.map((e=>Object.assign({},e)));if(t.adjoiningMetaEdge){const i=t.adjoiningMetaEdge.points,o=t.metaEdge.inbound,d=o?i[i.length-1]:i[0],r=n[o?0:n.length-1],a=e.x-e.width/2,s=e.y-e.height/2,h=d.x-a,c=d.y-s,g=-e.paddingLeft,p=-(e.paddingTop+e.labelHeight);r.x=h+g,r.y=c+p}return n}(e,n);return{adjoiningEdge:n.adjoiningMetaEdge?{w:n.adjoiningMetaEdge.metaEdge.w,v:n.adjoiningMetaEdge.metaEdge.v}:null,inbound:n.metaEdge.inbound,w:t.w,v:t.v,points:i,weight:n.weight}}))}export{m as BRIDGE_GRAPH_NAME,d as GraphType,n as HierarchyNodeType,o as InclusionType,E as LAYOUT_CONFIG,i as NodeType,f as ROOT_NAME,M as buildGraph};
import{graphlib as e,layout as t}from"dagre";var n,i,o,d;!function(e){e[e.META=0]="META",e[e.OP=1]="OP",e[e.SERIES=2]="SERIES"}(n||(n={})),function(e){e[e.META=0]="META",e[e.NODE=1]="NODE",e[e.BRIDGE=2]="BRIDGE"}(i||(i={})),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE",e[e.UNSPECIFIED=2]="UNSPECIFIED"}(o||(o={})),function(e){e[e.META=0]="META",e[e.CORE=1]="CORE",e[e.BRIDGE=2]="BRIDGE"}(d||(d={}));class r{constructor(e){this.cardinality=1,this.include=o.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=i.NODE,this.name=e.name,this.attr=e.attr||{},this.inputs=e.inputs,this.path=e.path||[],this.width=e.width,this.height=e.height}}class a{constructor(){this.nodes={},this.edges=[]}}function s(e){const t=new a;return e.nodes.map((e=>new r(e))).forEach((e=>{t.nodes[e.name]=e,e.inputs.forEach((n=>{!function(e,t,n){n.name!==t.name&&e.edges.push(Object.assign(Object.assign({},n.attr),{v:n.name,w:t.name}))}(t,e,n)}))})),t}class h{constructor(e,t={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=o.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=i.META,this.name=e,this.metaGraph=u(e,d.META,t)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map((e=>this.metaGraph.node(e)))}getRootNode(){let e=this.name.split("/"),t=this.name+"/("+e[e.length-1]+")";return this.metaGraph.node(t)}leaves(){let e,t=[],n=[this];for(;n.length;){let i=n.shift();i.isGroupNode?(e=i.metaGraph,e.nodes().forEach((t=>n.push(e.node(t))))):t.push(i.name)}return t}}class c{constructor(e,t){this.v=e,this.w=t,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,t){this.baseEdgeList.push(e)}}function g(e,t={}){return new h(e,t)}function p(e,t){return new c(e,t)}function u(t,n,i){const o=i||{},d=new e.Graph(o);return d.setGraph({name:t,rankdir:o.rankdir||"BT",type:n}),d}function l(e){return`◬${e}◬`}const f=l("ROOT"),m=l("BRIDGE_GRAPH"),E={graph:{meta:{nodeSep:50,rankSep:50,edgeSep:5}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};class w{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=g(f,this.graphOptions),this.index[f]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,t){this.index[e]=t}getBridgeGraph(e){const t=this.index[e];if(!t)throw Error("Could not find node in hierarchy: "+e);if(!("metaGraph"in t))return null;const n=t;if(n.bridgeGraph)return n.bridgeGraph;const i=u(m,d.BRIDGE,this.graphOptions);if(n.bridgeGraph=i,!t.parentNode||!("metaGraph"in t.parentNode))return i;const o=t.parentNode;return[o.metaGraph,this.getBridgeGraph(o.name)].forEach((t=>{t.edges().filter((t=>t.v===e||t.w===e)).forEach((n=>{const o=n.w===e;t.edge(n).baseEdgeList.forEach((t=>{const[d,r]=o?[t.w,n.v]:[t.v,n.w],a=this.getChildName(e,d),s={v:o?r:a,w:o?a:r};let h=i.edge(s);h||(h=p(s.v,s.w),h.inbound=o,i.setEdge(s.v,s.w,h)),h.addBaseEdge(t,this)}))}))})),i}getChildName(e,t){let n=this.index[t];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+t)}getPredecessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!0)}getSuccessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!1)}getOneWayEdges(e,t){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const i=e.parentNode,o=i.metaGraph,d=this.getBridgeGraph(i.name);return b(o,e,t,n),b(d,e,t,n),n}}function x(e,t){const n=new w({rankdir:t.rankDirection});return function(e,t){Object.keys(t.nodes).forEach((n=>{const i=t.nodes[n],o=i.path;let d=e.root;d.depth=Math.max(o.length,d.depth);for(let t=0;t<o.length&&(d.depth=Math.max(d.depth,o.length-t),d.cardinality+=i.cardinality,t!==o.length-1);t++){const n=o[t];let r=e.node(n);r||(r=g(n,e.graphOptions),r.path=i.path.slice(0,t+1),r.parentNode=d,e.setNode(n,r),d.metaGraph.setNode(n,r)),d=r}e.setNode(i.name,i),i.parentNode=d,d.metaGraph.setNode(i.name,i)}))}(n,e),function(e,t){const n=e.getNodeMap();let i=[],o=[];const d=(e,t)=>{let n=0;for(;e;)t[n++]=e.name,e=e.parentNode;return n-1};t.edges.forEach((r=>{i=[],o=[];let a=d(t.nodes[r.v],i),s=d(t.nodes[r.w],o);for(;i[a]===o[s];)if(a--,s--,a<0||s<0)throw Error("No difference found between ancestor paths.");const h=n[i[a+1]],c=i[a],g=o[s];let u=h.metaGraph.edge(c,g);u||(u=p(c,g),h.metaGraph.setEdge(c,g,u)),u.addBaseEdge(r,e)}))}(n,e),n}function b(e,t,n,i){(n?e.inEdges(t.name):e.outEdges(t.name)).forEach((t=>{const n=e.edge(t);i.push(n)}))}class N{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new O(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(e){if(e in this.hasSubHierarchy)return;this.hasSubHierarchy[e]=!0;const t=this.index[e];if(t.node.type!==i.META)return;const n=t,d=n.node.metaGraph,r=n.coreGraph;d.nodes().forEach((e=>{const t=this.getOrCreateRenderNodeByName(e);r.setNode(e,t)})),d.edges().forEach((e=>{const t=d.edge(e),n=new G(t);r.setEdge(e.v,e.w,n)}));const a=n.node.parentNode;if(!a)return;const s=this.getRenderNodeByName(a.name),h=(e,...t)=>t.concat([e?"IN":"OUT"]).join("~~"),c=this.hierarchy.getBridgeGraph(e);c.edges().forEach((e=>{!!d.node(e.w)?e.v:e.w})),c.edges().forEach((t=>{const n=c.edge(t),g=!!d.node(t.w),[p,u]=g?[t.w,t.v]:[t.v,t.w],l=t=>{const n=g?{v:t,w:e}:{v:e,w:t};return s.coreGraph.edge(n)};let f=l(u);f||(f=l(h(g,u,a.name)));const m=h(g,e),E=h(g,u,e);let w=r.node(E);if(!w){let e=r.node(m);if(!e){const t={name:m,type:i.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:o.UNSPECIFIED,inbound:g,attr:{}};e=new y(t),this.index[m]=e,r.setNode(m,e)}const t={name:E,type:i.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:o.UNSPECIFIED,inbound:g,attr:{}};w=new y(t),this.index[E]=w,r.setNode(E,w),r.setParent(E,m),e.node.cardinality++}const x=new G(n);x.adjoiningMetaEdge=f,g?r.setEdge(E,p,x):r.setEdge(p,E,x)})),[!0,!1].forEach((t=>{const n=h(t,e);r.node(n)&&r.nodes().forEach((e=>{if(r.node(e).node.type===i.BRIDGE)return;t?r.predecessors(e).length:r.successors(e).length}))}))}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const t=this.getNodeByName(e);return t?(this.index[e]=t.isGroupNode?new O(t,this.hierarchy.graphOptions):new y(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class y{constructor(e){this.node=e,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=e.width||0,this.height=e.height||0,this.displayName=e.name,this.attr=e.attr}}class G{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[],this.startMarkerId=null,this.endMarkerId=null}}class O extends y{constructor(e,t){super(e);const n=e.metaGraph.graph();t.compound=!0,this.coreGraph=u(n.name,d.CORE,t)}}function B(e,n=E){e.node.isGroupNode&&function(e,t){e.coreGraph.nodes().map((t=>e.coreGraph.node(t))).forEach((e=>{const{height:n,width:o}=e;switch(e.node.type){case i.NODE:Object.assign(e,t.nodeSize.node),e.height=n||t.nodeSize.node.height,e.width=o||t.nodeSize.node.width;break;case i.BRIDGE:Object.assign(e,t.nodeSize.bridge);break;case i.META:if(e.expanded){B(e,t)}else Object.assign(e,t.nodeSize.meta),e.height=t.nodeSize.meta.height,e.width=t.nodeSize.meta.width;break;default:throw Error("Unrecognized node type: "+e.node.type)}e.expanded||function(e){e.coreBox.width=e.width,e.coreBox.height=e.height;const t=`${e.displayName}`.length,n=3;e.width=Math.max(e.coreBox.width,t*n)}(e)}))}(e,n),e.node.type===i.META&&function(e,n){const o=n.subScene.meta;Object.assign(e,o),Object.assign(e.coreBox,function(e,n){Object.assign(e.graph(),{nodesep:n.nodeSep,ranksep:n.rankSep,edgesep:n.edgeSep});const o=[];if(e.nodes().forEach((t=>{e.node(t).node.type!==i.BRIDGE&&o.push(t)})),!o.length)return{width:0,height:0};t(e);let d=1/0,r=1/0,a=-1/0,s=-1/0;return o.forEach((t=>{const n=e.node(t),i=.5*n.width,o=n.x-i,h=n.x+i;d=o<d?o:d,a=h>a?h:a;const c=.5*n.height,g=n.y-c,p=n.y+c;r=g<r?g:r,s=p>s?p:s})),e.edges().forEach((t=>{const n=e.edge(t),i=e.node(n.metaEdge.v),o=e.node(n.metaEdge.w);if(3===n.points.length&&function(e){let t=S(e[0],e[1]);for(let n=1;n<e.length-1;n++){const i=S(e[n],e[n+1]);if(Math.abs(i-t)>1)return!1;t=i}return!0}(n.points)){if(null!=i){const e=i.expanded?i.x:v(i);n.points[0].x=e}if(null!=o){const e=o.expanded?o.x:v(o);n.points[2].x=e}n.points=[n.points[0],n.points[1]]}const h=n.points[n.points.length-2];null!=o&&(n.points[n.points.length-1]=I(h,o));const c=n.points[1];null!=i&&(n.points[0]=I(c,i)),n.points.forEach((e=>{d=e.x<d?e.x:d,a=e.x>a?e.x:a,r=e.y<r?e.y:r,s=e.y>s?e.y:s}))})),e.nodes().forEach((t=>{const n=e.node(t);n.x-=d,n.y-=r})),e.edges().forEach((t=>{e.edge(t).points.forEach((e=>{e.x-=d,e.y-=r}))})),{width:a-d,height:s-r}}(e.coreGraph,n.graph.meta));let d=0;e.coreGraph.nodeCount()>0&&d++;const r=d<=1?0:d;e.coreBox.width+=r+r,e.coreBox.height=o.labelHeight+e.coreBox.height,e.width=e.coreBox.width+o.paddingLeft+o.paddingRight,e.height=e.paddingTop+e.coreBox.height+e.paddingBottom}(e,n)}function S(e,t){const n=t.x-e.x,i=t.y-e.y;return 180*Math.atan(i/n)/Math.PI}function v(e){if(e.expanded)return e.x;return e.x-e.width/2+0+e.coreBox.width/2}function I(e,t){const n=t.expanded?t.x:v(t),i=t.y,o=e.x-n,d=e.y-i;let r,a,s=t.expanded?t.width:t.coreBox.width,h=t.expanded?t.height:t.coreBox.height;return Math.abs(d)*s/2>Math.abs(o)*h/2?(d<0&&(h=-h),r=0===d?0:h/2*o/d,a=h/2):(o<0&&(s=-s),r=s/2,a=0===o?0:s/2*d/o),{x:n+r,y:i+a}}function M(e,t,n){const i=e.nodes.filter(((e,t,n)=>n.findIndex((t=>t.id===e.id))!==t)).map((e=>e.id));if(i.length)throw new Error(`Duplicated ids found: ${i.join(", ")}`);const o=function(e){const t={nodes:[]},n=Object.keys(e.compound||{}),i=new Map,o=(t,d=[])=>{const r=0===d.length;if(i.has(t))return i.get(t);for(let i=0;i<n.length;i++){let r=n[i];if(e.compound&&-1!==e.compound[r].indexOf(t))return d.unshift(r),o(r,d)}return r&&i.set(t,d),d},d=t=>e.edges.filter((e=>e.w===t)).map((e=>({name:e.v})));return e.nodes.forEach((e=>{const n=e.id,i=[...o(n),n];let r=d(n);t.nodes.push({name:n,path:i,inputs:r,width:e.width,height:e.height,attr:Object.assign({},e)})})),t}(e),d=function(e,t){const n=(e,t)=>{for(let n of t.values())if(n.includes(e))return!0;return!1},i=(e,t=[])=>{if(0===Object.keys(e).length)return[...new Set(t)];const o=new Map(Object.keys(e).map((t=>[t,e[t]]))),d={};for(let[e,i]of o)n(e,o)?d[e]=i:t=t.concat(e,i);return i(d,t)};return i(e).filter((e=>t.includes(e)))}(e.compound||{},(null==t?void 0:t.expanded)||[]),{renderInfo:r}=function(e,t="LR"){const n=x(s(e),{rankDirection:t}),i=function(e){return new N(e)}(n);return{hierarchy:n,renderInfo:i}}(o,t&&t.rankDirection?t.rankDirection:"LR");return function(e,t){t.forEach((t=>{const n=e.getRenderInfoNodes().find((e=>e.displayName===t));let i=n&&n.node&&n.node.name||"";const o=e.getRenderNodeByName(i);if(!o)throw new Error(`No nodes found: ${i}`);o.expanded=!0,e.buildSubHierarchy(i)}))}(r,d),B(r.root,function(e={}){var t,n,i,o;const d=(null===(t=null==e?void 0:e.graph)||void 0===t?void 0:t.meta)||{},r=(null===(n=null==e?void 0:e.subScene)||void 0===n?void 0:n.meta)||{},a=(null===(i=null==e?void 0:e.nodeSize)||void 0===i?void 0:i.meta)||{},s=(null===(o=null==e?void 0:e.nodeSize)||void 0===o?void 0:o.node)||{},h=E.nodeSize.bridge;return{graph:{meta:Object.assign(E.graph.meta,d)},subScene:{meta:Object.assign(E.subScene.meta,r)},nodeSize:{meta:Object.assign(E.nodeSize.meta,a),node:Object.assign(E.nodeSize.node,s),bridge:h}}}(n)),R(r.root)}function R(e){const t=e.coreGraph.nodes().map((t=>e.coreGraph.node(t)));return Object.assign(Object.assign({},j(e)),{expanded:e.expanded,nodes:e.expanded?(n=t,n.map((e=>e.node.type===i.META?R(e):j(e)))):[],edges:e.expanded?D(e):[]});var n}function j(e){return{name:e.node.name,type:e.node.type,attr:e.attr,parentNodeName:e.node.parentNode?e.node.parentNode.name:null,coreBox:Object.assign({},e.coreBox),x:e.x,y:e.y,width:e.width,height:e.height,radius:e.radius,labelHeight:e.labelHeight,labelOffset:e.labelOffset,outboxWidth:e.outboxWidth,paddingLeft:e.paddingLeft,paddingTop:e.paddingTop,paddingRight:e.paddingRight,paddingBottom:e.paddingBottom}}function D(e){return e.coreGraph.edges().map((t=>({renderInfoEdge:e.coreGraph.edge(t),edge:t}))).filter((({renderInfoEdge:e})=>e.metaEdge)).map((({edge:t,renderInfoEdge:n})=>{const i=function(e,t){const n=t.points.map((e=>Object.assign({},e)));if(t.adjoiningMetaEdge){const i=t.adjoiningMetaEdge.points,o=t.metaEdge.inbound,d=o?i[i.length-1]:i[0],r=n[o?0:n.length-1],a=e.x-e.width/2,s=e.y-e.height/2,h=d.x-a,c=d.y-s,g=-e.paddingLeft,p=-(e.paddingTop+e.labelHeight);r.x=h+g,r.y=c+p}return n}(e,n);return{adjoiningEdge:n.adjoiningMetaEdge?{w:n.adjoiningMetaEdge.metaEdge.w,v:n.adjoiningMetaEdge.metaEdge.v}:null,inbound:n.metaEdge.inbound,w:t.w,v:t.v,points:i,weight:n.weight,baseEdgeList:n.metaEdge.baseEdgeList}}))}export{m as BRIDGE_GRAPH_NAME,d as GraphType,n as HierarchyNodeType,o as InclusionType,E as LAYOUT_CONFIG,i as NodeType,f as ROOT_NAME,M as buildGraph};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("dagre")):"function"==typeof define&&define.amd?define(["exports","dagre"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dagreCompound={},e.dagre)}(this,(function(e,t){"use strict";var n,o,i,d;(n=e.HierarchyNodeType||(e.HierarchyNodeType={}))[n.META=0]="META",n[n.OP=1]="OP",n[n.SERIES=2]="SERIES",(o=e.NodeType||(e.NodeType={}))[o.META=0]="META",o[o.NODE=1]="NODE",o[o.BRIDGE=2]="BRIDGE",(i=e.InclusionType||(e.InclusionType={}))[i.INCLUDE=0]="INCLUDE",i[i.EXCLUDE=1]="EXCLUDE",i[i.UNSPECIFIED=2]="UNSPECIFIED",(d=e.GraphType||(e.GraphType={}))[d.META=0]="META",d[d.CORE=1]="CORE",d[d.BRIDGE=2]="BRIDGE";class r{constructor(t){this.cardinality=1,this.include=e.InclusionType.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=e.NodeType.NODE,this.name=t.name,this.attr=t.attr||{},this.inputs=t.inputs,this.path=t.path||[],this.width=t.width,this.height=t.height}}class a{constructor(){this.nodes={},this.edges=[]}}function s(e){const t=new a;return e.nodes.map((e=>new r(e))).forEach((e=>{t.nodes[e.name]=e,e.inputs.forEach((n=>{!function(e,t,n){n.name!==t.name&&e.edges.push(Object.assign(Object.assign({},n.attr),{v:n.name,w:t.name}))}(t,e,n)}))})),t}class h{constructor(t,n={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=e.InclusionType.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=e.NodeType.META,this.name=t,this.metaGraph=u(t,e.GraphType.META,n)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map((e=>this.metaGraph.node(e)))}getRootNode(){let e=this.name.split("/"),t=this.name+"/("+e[e.length-1]+")";return this.metaGraph.node(t)}leaves(){let e,t=[],n=[this];for(;n.length;){let o=n.shift();o.isGroupNode?(e=o.metaGraph,e.nodes().forEach((t=>n.push(e.node(t))))):t.push(o.name)}return t}}class c{constructor(e,t){this.v=e,this.w=t,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,t){this.baseEdgeList.push(e)}}function p(e,t={}){return new h(e,t)}function g(e,t){return new c(e,t)}function u(e,n,o){const i=o||{},d=new t.graphlib.Graph(i);return d.setGraph({name:e,rankdir:i.rankdir||"BT",type:n}),d}function l(e){return`◬${e}◬`}const f=l("ROOT"),m=l("BRIDGE_GRAPH"),E={graph:{meta:{nodeSep:50,rankSep:50,edgeSep:5}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};class y{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=p(f,this.graphOptions),this.index[f]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,t){this.index[e]=t}getBridgeGraph(t){const n=this.index[t];if(!n)throw Error("Could not find node in hierarchy: "+t);if(!("metaGraph"in n))return null;const o=n;if(o.bridgeGraph)return o.bridgeGraph;const i=u(m,e.GraphType.BRIDGE,this.graphOptions);if(o.bridgeGraph=i,!n.parentNode||!("metaGraph"in n.parentNode))return i;const d=n.parentNode;return[d.metaGraph,this.getBridgeGraph(d.name)].forEach((e=>{e.edges().filter((e=>e.v===t||e.w===t)).forEach((n=>{const o=n.w===t;e.edge(n).baseEdgeList.forEach((e=>{const[d,r]=o?[e.w,n.v]:[e.v,n.w],a=this.getChildName(t,d),s={v:o?r:a,w:o?a:r};let h=i.edge(s);h||(h=g(s.v,s.w),h.inbound=o,i.setEdge(s.v,s.w,h)),h.addBaseEdge(e,this)}))}))})),i}getChildName(e,t){let n=this.index[t];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+t)}getPredecessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!0)}getSuccessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!1)}getOneWayEdges(e,t){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const o=e.parentNode,i=o.metaGraph,d=this.getBridgeGraph(o.name);return w(i,e,t,n),w(d,e,t,n),n}}function N(e,t){const n=new y({rankdir:t.rankDirection});return function(e,t){Object.keys(t.nodes).forEach((n=>{const o=t.nodes[n],i=o.path;let d=e.root;d.depth=Math.max(i.length,d.depth);for(let t=0;t<i.length&&(d.depth=Math.max(d.depth,i.length-t),d.cardinality+=o.cardinality,t!==i.length-1);t++){const n=i[t];let r=e.node(n);r||(r=p(n,e.graphOptions),r.path=o.path.slice(0,t+1),r.parentNode=d,e.setNode(n,r),d.metaGraph.setNode(n,r)),d=r}e.setNode(o.name,o),o.parentNode=d,d.metaGraph.setNode(o.name,o)}))}(n,e),function(e,t){const n=e.getNodeMap();let o=[],i=[];const d=(e,t)=>{let n=0;for(;e;)t[n++]=e.name,e=e.parentNode;return n-1};t.edges.forEach((r=>{o=[],i=[];let a=d(t.nodes[r.v],o),s=d(t.nodes[r.w],i);for(;o[a]===i[s];)if(a--,s--,a<0||s<0)throw Error("No difference found between ancestor paths.");const h=n[o[a+1]],c=o[a],p=i[s];let u=h.metaGraph.edge(c,p);u||(u=g(c,p),h.metaGraph.setEdge(c,p,u)),u.addBaseEdge(r,e)}))}(n,e),n}function w(e,t,n,o){(n?e.inEdges(t.name):e.outEdges(t.name)).forEach((t=>{const n=e.edge(t);o.push(n)}))}class x{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new O(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(t){if(t in this.hasSubHierarchy)return;this.hasSubHierarchy[t]=!0;const n=this.index[t];if(n.node.type!==e.NodeType.META)return;const o=n,i=o.node.metaGraph,d=o.coreGraph;i.nodes().forEach((e=>{const t=this.getOrCreateRenderNodeByName(e);d.setNode(e,t)})),i.edges().forEach((e=>{const t=i.edge(e),n=new G(t);d.setEdge(e.v,e.w,n)}));const r=o.node.parentNode;if(!r)return;const a=this.getRenderNodeByName(r.name),s=(e,...t)=>t.concat([e?"IN":"OUT"]).join("~~"),h=this.hierarchy.getBridgeGraph(t);h.edges().forEach((e=>{!!i.node(e.w)?e.v:e.w})),h.edges().forEach((n=>{const o=h.edge(n),c=!!i.node(n.w),[p,g]=c?[n.w,n.v]:[n.v,n.w],u=e=>{const n=c?{v:e,w:t}:{v:t,w:e};return a.coreGraph.edge(n)};let l=u(g);l||(l=u(s(c,g,r.name)));const f=s(c,t),m=s(c,g,t);let E=d.node(m);if(!E){let t=d.node(f);if(!t){const n={name:f,type:e.NodeType.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:e.InclusionType.UNSPECIFIED,inbound:c,attr:{}};t=new b(n),this.index[f]=t,d.setNode(f,t)}const n={name:m,type:e.NodeType.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:e.InclusionType.UNSPECIFIED,inbound:c,attr:{}};E=new b(n),this.index[m]=E,d.setNode(m,E),d.setParent(m,f),t.node.cardinality++}const y=new G(o);y.adjoiningMetaEdge=l,c?d.setEdge(m,p,y):d.setEdge(p,m,y)})),[!0,!1].forEach((n=>{const o=s(n,t);d.node(o)&&d.nodes().forEach((t=>{if(d.node(t).node.type===e.NodeType.BRIDGE)return;n?d.predecessors(t).length:d.successors(t).length}))}))}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const t=this.getNodeByName(e);return t?(this.index[e]=t.isGroupNode?new O(t,this.hierarchy.graphOptions):new b(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class b{constructor(e){this.node=e,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=e.width||0,this.height=e.height||0,this.displayName=e.name,this.attr=e.attr}}class G{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[],this.startMarkerId=null,this.endMarkerId=null}}class O extends b{constructor(t,n){super(t);const o=t.metaGraph.graph();n.compound=!0,this.coreGraph=u(o.name,e.GraphType.CORE,n)}}function T(n,o=E){n.node.isGroupNode&&function(t,n){t.coreGraph.nodes().map((e=>t.coreGraph.node(e))).forEach((t=>{const{height:o,width:i}=t;switch(t.node.type){case e.NodeType.NODE:Object.assign(t,n.nodeSize.node),t.height=o||n.nodeSize.node.height,t.width=i||n.nodeSize.node.width;break;case e.NodeType.BRIDGE:Object.assign(t,n.nodeSize.bridge);break;case e.NodeType.META:if(t.expanded){T(t,n)}else Object.assign(t,n.nodeSize.meta),t.height=n.nodeSize.meta.height,t.width=n.nodeSize.meta.width;break;default:throw Error("Unrecognized node type: "+t.node.type)}t.expanded||function(e){e.coreBox.width=e.width,e.coreBox.height=e.height;const t=`${e.displayName}`.length,n=3;e.width=Math.max(e.coreBox.width,t*n)}(t)}))}(n,o),n.node.type===e.NodeType.META&&function(n,o){const i=o.subScene.meta;Object.assign(n,i),Object.assign(n.coreBox,function(n,o){Object.assign(n.graph(),{nodesep:o.nodeSep,ranksep:o.rankSep,edgesep:o.edgeSep});const i=[];if(n.nodes().forEach((t=>{n.node(t).node.type!==e.NodeType.BRIDGE&&i.push(t)})),!i.length)return{width:0,height:0};t.layout(n);let d=1/0,r=1/0,a=-1/0,s=-1/0;return i.forEach((e=>{const t=n.node(e),o=.5*t.width,i=t.x-o,h=t.x+o;d=i<d?i:d,a=h>a?h:a;const c=.5*t.height,p=t.y-c,g=t.y+c;r=p<r?p:r,s=g>s?g:s})),n.edges().forEach((e=>{const t=n.edge(e),o=n.node(t.metaEdge.v),i=n.node(t.metaEdge.w);if(3===t.points.length&&function(e){let t=B(e[0],e[1]);for(let n=1;n<e.length-1;n++){const o=B(e[n],e[n+1]);if(Math.abs(o-t)>1)return!1;t=o}return!0}(t.points)){if(null!=o){const e=o.expanded?o.x:I(o);t.points[0].x=e}if(null!=i){const e=i.expanded?i.x:I(i);t.points[2].x=e}t.points=[t.points[0],t.points[1]]}const h=t.points[t.points.length-2];null!=i&&(t.points[t.points.length-1]=S(h,i));const c=t.points[1];null!=o&&(t.points[0]=S(c,o)),t.points.forEach((e=>{d=e.x<d?e.x:d,a=e.x>a?e.x:a,r=e.y<r?e.y:r,s=e.y>s?e.y:s}))})),n.nodes().forEach((e=>{const t=n.node(e);t.x-=d,t.y-=r})),n.edges().forEach((e=>{n.edge(e).points.forEach((e=>{e.x-=d,e.y-=r}))})),{width:a-d,height:s-r}}(n.coreGraph,o.graph.meta));let d=0;n.coreGraph.nodeCount()>0&&d++;const r=d<=1?0:d;n.coreBox.width+=r+r,n.coreBox.height=i.labelHeight+n.coreBox.height,n.width=n.coreBox.width+i.paddingLeft+i.paddingRight,n.height=n.paddingTop+n.coreBox.height+n.paddingBottom}(n,o)}function B(e,t){const n=t.x-e.x,o=t.y-e.y;return 180*Math.atan(o/n)/Math.PI}function I(e){if(e.expanded)return e.x;return e.x-e.width/2+0+e.coreBox.width/2}function S(e,t){const n=t.expanded?t.x:I(t),o=t.y,i=e.x-n,d=e.y-o;let r,a,s=t.expanded?t.width:t.coreBox.width,h=t.expanded?t.height:t.coreBox.height;return Math.abs(d)*s/2>Math.abs(i)*h/2?(d<0&&(h=-h),r=0===d?0:h/2*i/d,a=h/2):(i<0&&(s=-s),r=s/2,a=0===i?0:s/2*d/i),{x:n+r,y:o+a}}function v(t){const n=t.coreGraph.nodes().map((e=>t.coreGraph.node(e)));return Object.assign(Object.assign({},M(t)),{expanded:t.expanded,nodes:t.expanded?(o=n,o.map((t=>t.node.type===e.NodeType.META?v(t):M(t)))):[],edges:t.expanded?R(t):[]});var o}function M(e){return{name:e.node.name,type:e.node.type,attr:e.attr,parentNodeName:e.node.parentNode?e.node.parentNode.name:null,coreBox:Object.assign({},e.coreBox),x:e.x,y:e.y,width:e.width,height:e.height,radius:e.radius,labelHeight:e.labelHeight,labelOffset:e.labelOffset,outboxWidth:e.outboxWidth,paddingLeft:e.paddingLeft,paddingTop:e.paddingTop,paddingRight:e.paddingRight,paddingBottom:e.paddingBottom}}function R(e){return e.coreGraph.edges().map((t=>({renderInfoEdge:e.coreGraph.edge(t),edge:t}))).filter((({renderInfoEdge:e})=>e.metaEdge)).map((({edge:t,renderInfoEdge:n})=>{const o=function(e,t){const n=t.points.map((e=>Object.assign({},e)));if(t.adjoiningMetaEdge){const o=t.adjoiningMetaEdge.points,i=t.metaEdge.inbound,d=i?o[o.length-1]:o[0],r=n[i?0:n.length-1],a=e.x-e.width/2,s=e.y-e.height/2,h=d.x-a,c=d.y-s,p=-e.paddingLeft,g=-(e.paddingTop+e.labelHeight);r.x=h+p,r.y=c+g}return n}(e,n);return{adjoiningEdge:n.adjoiningMetaEdge?{w:n.adjoiningMetaEdge.metaEdge.w,v:n.adjoiningMetaEdge.metaEdge.v}:null,inbound:n.metaEdge.inbound,w:t.w,v:t.v,points:o,weight:n.weight}}))}e.BRIDGE_GRAPH_NAME=m,e.LAYOUT_CONFIG=E,e.ROOT_NAME=f,e.buildGraph=function(e,t,n){const o=e.nodes.filter(((e,t,n)=>n.findIndex((t=>t.id===e.id))!==t)).map((e=>e.id));if(o.length)throw new Error(`Duplicated ids found: ${o.join(", ")}`);const i=function(e){const t={nodes:[]},n=Object.keys(e.compound||{}),o=new Map,i=(t,d=[])=>{const r=0===d.length;if(o.has(t))return o.get(t);for(let o=0;o<n.length;o++){let r=n[o];if(e.compound&&-1!==e.compound[r].indexOf(t))return d.unshift(r),i(r,d)}return r&&o.set(t,d),d},d=t=>e.edges.filter((e=>e.w===t)).map((e=>({name:e.v})));return e.nodes.forEach((e=>{const n=e.id,o=[...i(n),n];let r=d(n);t.nodes.push({name:n,path:o,inputs:r,width:e.width,height:e.height,attr:Object.assign({},e)})})),t}(e),d=function(e,t){const n=(e,t)=>{for(let n of t.values())if(n.includes(e))return!0;return!1},o=(e,t=[])=>{if(0===Object.keys(e).length)return[...new Set(t)];const i=new Map(Object.keys(e).map((t=>[t,e[t]]))),d={};for(let[e,o]of i)n(e,i)?d[e]=o:t=t.concat(e,o);return o(d,t)};return o(e).filter((e=>t.includes(e)))}(e.compound||{},(null==t?void 0:t.expanded)||[]),{renderInfo:r}=function(e,t="LR"){const n=N(s(e),{rankDirection:t}),o=function(e){return new x(e)}(n);return{hierarchy:n,renderInfo:o}}(i,t&&t.rankDirection?t.rankDirection:"LR");return function(e,t){t.forEach((t=>{const n=e.getRenderInfoNodes().find((e=>e.displayName===t));let o=n&&n.node&&n.node.name||"";const i=e.getRenderNodeByName(o);if(!i)throw new Error(`No nodes found: ${o}`);i.expanded=!0,e.buildSubHierarchy(o)}))}(r,d),T(r.root,function(e={}){var t,n,o,i;const d=(null===(t=null==e?void 0:e.graph)||void 0===t?void 0:t.meta)||{},r=(null===(n=null==e?void 0:e.subScene)||void 0===n?void 0:n.meta)||{},a=(null===(o=null==e?void 0:e.nodeSize)||void 0===o?void 0:o.meta)||{},s=(null===(i=null==e?void 0:e.nodeSize)||void 0===i?void 0:i.node)||{},h=E.nodeSize.bridge;return{graph:{meta:Object.assign(E.graph.meta,d)},subScene:{meta:Object.assign(E.subScene.meta,r)},nodeSize:{meta:Object.assign(E.nodeSize.meta,a),node:Object.assign(E.nodeSize.node,s),bridge:h}}}(n)),v(r.root)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("dagre")):"function"==typeof define&&define.amd?define(["exports","dagre"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dagreCompound={},e.dagre)}(this,(function(e,t){"use strict";var n,o,i,d;(n=e.HierarchyNodeType||(e.HierarchyNodeType={}))[n.META=0]="META",n[n.OP=1]="OP",n[n.SERIES=2]="SERIES",(o=e.NodeType||(e.NodeType={}))[o.META=0]="META",o[o.NODE=1]="NODE",o[o.BRIDGE=2]="BRIDGE",(i=e.InclusionType||(e.InclusionType={}))[i.INCLUDE=0]="INCLUDE",i[i.EXCLUDE=1]="EXCLUDE",i[i.UNSPECIFIED=2]="UNSPECIFIED",(d=e.GraphType||(e.GraphType={}))[d.META=0]="META",d[d.CORE=1]="CORE",d[d.BRIDGE=2]="BRIDGE";class r{constructor(t){this.cardinality=1,this.include=e.InclusionType.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=e.NodeType.NODE,this.name=t.name,this.attr=t.attr||{},this.inputs=t.inputs,this.path=t.path||[],this.width=t.width,this.height=t.height}}class a{constructor(){this.nodes={},this.edges=[]}}function s(e){const t=new a;return e.nodes.map((e=>new r(e))).forEach((e=>{t.nodes[e.name]=e,e.inputs.forEach((n=>{!function(e,t,n){n.name!==t.name&&e.edges.push(Object.assign(Object.assign({},n.attr),{v:n.name,w:t.name}))}(t,e,n)}))})),t}class h{constructor(t,n={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=e.InclusionType.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=e.NodeType.META,this.name=t,this.metaGraph=u(t,e.GraphType.META,n)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map((e=>this.metaGraph.node(e)))}getRootNode(){let e=this.name.split("/"),t=this.name+"/("+e[e.length-1]+")";return this.metaGraph.node(t)}leaves(){let e,t=[],n=[this];for(;n.length;){let o=n.shift();o.isGroupNode?(e=o.metaGraph,e.nodes().forEach((t=>n.push(e.node(t))))):t.push(o.name)}return t}}class c{constructor(e,t){this.v=e,this.w=t,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,t){this.baseEdgeList.push(e)}}function p(e,t={}){return new h(e,t)}function g(e,t){return new c(e,t)}function u(e,n,o){const i=o||{},d=new t.graphlib.Graph(i);return d.setGraph({name:e,rankdir:i.rankdir||"BT",type:n}),d}function l(e){return`◬${e}◬`}const f=l("ROOT"),m=l("BRIDGE_GRAPH"),E={graph:{meta:{nodeSep:50,rankSep:50,edgeSep:5}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};class y{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=p(f,this.graphOptions),this.index[f]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,t){this.index[e]=t}getBridgeGraph(t){const n=this.index[t];if(!n)throw Error("Could not find node in hierarchy: "+t);if(!("metaGraph"in n))return null;const o=n;if(o.bridgeGraph)return o.bridgeGraph;const i=u(m,e.GraphType.BRIDGE,this.graphOptions);if(o.bridgeGraph=i,!n.parentNode||!("metaGraph"in n.parentNode))return i;const d=n.parentNode;return[d.metaGraph,this.getBridgeGraph(d.name)].forEach((e=>{e.edges().filter((e=>e.v===t||e.w===t)).forEach((n=>{const o=n.w===t;e.edge(n).baseEdgeList.forEach((e=>{const[d,r]=o?[e.w,n.v]:[e.v,n.w],a=this.getChildName(t,d),s={v:o?r:a,w:o?a:r};let h=i.edge(s);h||(h=g(s.v,s.w),h.inbound=o,i.setEdge(s.v,s.w,h)),h.addBaseEdge(e,this)}))}))})),i}getChildName(e,t){let n=this.index[t];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+t)}getPredecessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!0)}getSuccessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!1)}getOneWayEdges(e,t){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const o=e.parentNode,i=o.metaGraph,d=this.getBridgeGraph(o.name);return w(i,e,t,n),w(d,e,t,n),n}}function N(e,t){const n=new y({rankdir:t.rankDirection});return function(e,t){Object.keys(t.nodes).forEach((n=>{const o=t.nodes[n],i=o.path;let d=e.root;d.depth=Math.max(i.length,d.depth);for(let t=0;t<i.length&&(d.depth=Math.max(d.depth,i.length-t),d.cardinality+=o.cardinality,t!==i.length-1);t++){const n=i[t];let r=e.node(n);r||(r=p(n,e.graphOptions),r.path=o.path.slice(0,t+1),r.parentNode=d,e.setNode(n,r),d.metaGraph.setNode(n,r)),d=r}e.setNode(o.name,o),o.parentNode=d,d.metaGraph.setNode(o.name,o)}))}(n,e),function(e,t){const n=e.getNodeMap();let o=[],i=[];const d=(e,t)=>{let n=0;for(;e;)t[n++]=e.name,e=e.parentNode;return n-1};t.edges.forEach((r=>{o=[],i=[];let a=d(t.nodes[r.v],o),s=d(t.nodes[r.w],i);for(;o[a]===i[s];)if(a--,s--,a<0||s<0)throw Error("No difference found between ancestor paths.");const h=n[o[a+1]],c=o[a],p=i[s];let u=h.metaGraph.edge(c,p);u||(u=g(c,p),h.metaGraph.setEdge(c,p,u)),u.addBaseEdge(r,e)}))}(n,e),n}function w(e,t,n,o){(n?e.inEdges(t.name):e.outEdges(t.name)).forEach((t=>{const n=e.edge(t);o.push(n)}))}class x{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new O(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(t){if(t in this.hasSubHierarchy)return;this.hasSubHierarchy[t]=!0;const n=this.index[t];if(n.node.type!==e.NodeType.META)return;const o=n,i=o.node.metaGraph,d=o.coreGraph;i.nodes().forEach((e=>{const t=this.getOrCreateRenderNodeByName(e);d.setNode(e,t)})),i.edges().forEach((e=>{const t=i.edge(e),n=new G(t);d.setEdge(e.v,e.w,n)}));const r=o.node.parentNode;if(!r)return;const a=this.getRenderNodeByName(r.name),s=(e,...t)=>t.concat([e?"IN":"OUT"]).join("~~"),h=this.hierarchy.getBridgeGraph(t);h.edges().forEach((e=>{!!i.node(e.w)?e.v:e.w})),h.edges().forEach((n=>{const o=h.edge(n),c=!!i.node(n.w),[p,g]=c?[n.w,n.v]:[n.v,n.w],u=e=>{const n=c?{v:e,w:t}:{v:t,w:e};return a.coreGraph.edge(n)};let l=u(g);l||(l=u(s(c,g,r.name)));const f=s(c,t),m=s(c,g,t);let E=d.node(m);if(!E){let t=d.node(f);if(!t){const n={name:f,type:e.NodeType.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:e.InclusionType.UNSPECIFIED,inbound:c,attr:{}};t=new b(n),this.index[f]=t,d.setNode(f,t)}const n={name:m,type:e.NodeType.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:e.InclusionType.UNSPECIFIED,inbound:c,attr:{}};E=new b(n),this.index[m]=E,d.setNode(m,E),d.setParent(m,f),t.node.cardinality++}const y=new G(o);y.adjoiningMetaEdge=l,c?d.setEdge(m,p,y):d.setEdge(p,m,y)})),[!0,!1].forEach((n=>{const o=s(n,t);d.node(o)&&d.nodes().forEach((t=>{if(d.node(t).node.type===e.NodeType.BRIDGE)return;n?d.predecessors(t).length:d.successors(t).length}))}))}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const t=this.getNodeByName(e);return t?(this.index[e]=t.isGroupNode?new O(t,this.hierarchy.graphOptions):new b(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class b{constructor(e){this.node=e,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=e.width||0,this.height=e.height||0,this.displayName=e.name,this.attr=e.attr}}class G{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[],this.startMarkerId=null,this.endMarkerId=null}}class O extends b{constructor(t,n){super(t);const o=t.metaGraph.graph();n.compound=!0,this.coreGraph=u(o.name,e.GraphType.CORE,n)}}function T(n,o=E){n.node.isGroupNode&&function(t,n){t.coreGraph.nodes().map((e=>t.coreGraph.node(e))).forEach((t=>{const{height:o,width:i}=t;switch(t.node.type){case e.NodeType.NODE:Object.assign(t,n.nodeSize.node),t.height=o||n.nodeSize.node.height,t.width=i||n.nodeSize.node.width;break;case e.NodeType.BRIDGE:Object.assign(t,n.nodeSize.bridge);break;case e.NodeType.META:if(t.expanded){T(t,n)}else Object.assign(t,n.nodeSize.meta),t.height=n.nodeSize.meta.height,t.width=n.nodeSize.meta.width;break;default:throw Error("Unrecognized node type: "+t.node.type)}t.expanded||function(e){e.coreBox.width=e.width,e.coreBox.height=e.height;const t=`${e.displayName}`.length,n=3;e.width=Math.max(e.coreBox.width,t*n)}(t)}))}(n,o),n.node.type===e.NodeType.META&&function(n,o){const i=o.subScene.meta;Object.assign(n,i),Object.assign(n.coreBox,function(n,o){Object.assign(n.graph(),{nodesep:o.nodeSep,ranksep:o.rankSep,edgesep:o.edgeSep});const i=[];if(n.nodes().forEach((t=>{n.node(t).node.type!==e.NodeType.BRIDGE&&i.push(t)})),!i.length)return{width:0,height:0};t.layout(n);let d=1/0,r=1/0,a=-1/0,s=-1/0;return i.forEach((e=>{const t=n.node(e),o=.5*t.width,i=t.x-o,h=t.x+o;d=i<d?i:d,a=h>a?h:a;const c=.5*t.height,p=t.y-c,g=t.y+c;r=p<r?p:r,s=g>s?g:s})),n.edges().forEach((e=>{const t=n.edge(e),o=n.node(t.metaEdge.v),i=n.node(t.metaEdge.w);if(3===t.points.length&&function(e){let t=B(e[0],e[1]);for(let n=1;n<e.length-1;n++){const o=B(e[n],e[n+1]);if(Math.abs(o-t)>1)return!1;t=o}return!0}(t.points)){if(null!=o){const e=o.expanded?o.x:I(o);t.points[0].x=e}if(null!=i){const e=i.expanded?i.x:I(i);t.points[2].x=e}t.points=[t.points[0],t.points[1]]}const h=t.points[t.points.length-2];null!=i&&(t.points[t.points.length-1]=S(h,i));const c=t.points[1];null!=o&&(t.points[0]=S(c,o)),t.points.forEach((e=>{d=e.x<d?e.x:d,a=e.x>a?e.x:a,r=e.y<r?e.y:r,s=e.y>s?e.y:s}))})),n.nodes().forEach((e=>{const t=n.node(e);t.x-=d,t.y-=r})),n.edges().forEach((e=>{n.edge(e).points.forEach((e=>{e.x-=d,e.y-=r}))})),{width:a-d,height:s-r}}(n.coreGraph,o.graph.meta));let d=0;n.coreGraph.nodeCount()>0&&d++;const r=d<=1?0:d;n.coreBox.width+=r+r,n.coreBox.height=i.labelHeight+n.coreBox.height,n.width=n.coreBox.width+i.paddingLeft+i.paddingRight,n.height=n.paddingTop+n.coreBox.height+n.paddingBottom}(n,o)}function B(e,t){const n=t.x-e.x,o=t.y-e.y;return 180*Math.atan(o/n)/Math.PI}function I(e){if(e.expanded)return e.x;return e.x-e.width/2+0+e.coreBox.width/2}function S(e,t){const n=t.expanded?t.x:I(t),o=t.y,i=e.x-n,d=e.y-o;let r,a,s=t.expanded?t.width:t.coreBox.width,h=t.expanded?t.height:t.coreBox.height;return Math.abs(d)*s/2>Math.abs(i)*h/2?(d<0&&(h=-h),r=0===d?0:h/2*i/d,a=h/2):(i<0&&(s=-s),r=s/2,a=0===i?0:s/2*d/i),{x:n+r,y:o+a}}function v(t){const n=t.coreGraph.nodes().map((e=>t.coreGraph.node(e)));return Object.assign(Object.assign({},M(t)),{expanded:t.expanded,nodes:t.expanded?(o=n,o.map((t=>t.node.type===e.NodeType.META?v(t):M(t)))):[],edges:t.expanded?R(t):[]});var o}function M(e){return{name:e.node.name,type:e.node.type,attr:e.attr,parentNodeName:e.node.parentNode?e.node.parentNode.name:null,coreBox:Object.assign({},e.coreBox),x:e.x,y:e.y,width:e.width,height:e.height,radius:e.radius,labelHeight:e.labelHeight,labelOffset:e.labelOffset,outboxWidth:e.outboxWidth,paddingLeft:e.paddingLeft,paddingTop:e.paddingTop,paddingRight:e.paddingRight,paddingBottom:e.paddingBottom}}function R(e){return e.coreGraph.edges().map((t=>({renderInfoEdge:e.coreGraph.edge(t),edge:t}))).filter((({renderInfoEdge:e})=>e.metaEdge)).map((({edge:t,renderInfoEdge:n})=>{const o=function(e,t){const n=t.points.map((e=>Object.assign({},e)));if(t.adjoiningMetaEdge){const o=t.adjoiningMetaEdge.points,i=t.metaEdge.inbound,d=i?o[o.length-1]:o[0],r=n[i?0:n.length-1],a=e.x-e.width/2,s=e.y-e.height/2,h=d.x-a,c=d.y-s,p=-e.paddingLeft,g=-(e.paddingTop+e.labelHeight);r.x=h+p,r.y=c+g}return n}(e,n);return{adjoiningEdge:n.adjoiningMetaEdge?{w:n.adjoiningMetaEdge.metaEdge.w,v:n.adjoiningMetaEdge.metaEdge.v}:null,inbound:n.metaEdge.inbound,w:t.w,v:t.v,points:o,weight:n.weight,baseEdgeList:n.metaEdge.baseEdgeList}}))}e.BRIDGE_GRAPH_NAME=m,e.LAYOUT_CONFIG=E,e.ROOT_NAME=f,e.buildGraph=function(e,t,n){const o=e.nodes.filter(((e,t,n)=>n.findIndex((t=>t.id===e.id))!==t)).map((e=>e.id));if(o.length)throw new Error(`Duplicated ids found: ${o.join(", ")}`);const i=function(e){const t={nodes:[]},n=Object.keys(e.compound||{}),o=new Map,i=(t,d=[])=>{const r=0===d.length;if(o.has(t))return o.get(t);for(let o=0;o<n.length;o++){let r=n[o];if(e.compound&&-1!==e.compound[r].indexOf(t))return d.unshift(r),i(r,d)}return r&&o.set(t,d),d},d=t=>e.edges.filter((e=>e.w===t)).map((e=>({name:e.v})));return e.nodes.forEach((e=>{const n=e.id,o=[...i(n),n];let r=d(n);t.nodes.push({name:n,path:o,inputs:r,width:e.width,height:e.height,attr:Object.assign({},e)})})),t}(e),d=function(e,t){const n=(e,t)=>{for(let n of t.values())if(n.includes(e))return!0;return!1},o=(e,t=[])=>{if(0===Object.keys(e).length)return[...new Set(t)];const i=new Map(Object.keys(e).map((t=>[t,e[t]]))),d={};for(let[e,o]of i)n(e,i)?d[e]=o:t=t.concat(e,o);return o(d,t)};return o(e).filter((e=>t.includes(e)))}(e.compound||{},(null==t?void 0:t.expanded)||[]),{renderInfo:r}=function(e,t="LR"){const n=N(s(e),{rankDirection:t}),o=function(e){return new x(e)}(n);return{hierarchy:n,renderInfo:o}}(i,t&&t.rankDirection?t.rankDirection:"LR");return function(e,t){t.forEach((t=>{const n=e.getRenderInfoNodes().find((e=>e.displayName===t));let o=n&&n.node&&n.node.name||"";const i=e.getRenderNodeByName(o);if(!i)throw new Error(`No nodes found: ${o}`);i.expanded=!0,e.buildSubHierarchy(o)}))}(r,d),T(r.root,function(e={}){var t,n,o,i;const d=(null===(t=null==e?void 0:e.graph)||void 0===t?void 0:t.meta)||{},r=(null===(n=null==e?void 0:e.subScene)||void 0===n?void 0:n.meta)||{},a=(null===(o=null==e?void 0:e.nodeSize)||void 0===o?void 0:o.meta)||{},s=(null===(i=null==e?void 0:e.nodeSize)||void 0===i?void 0:i.node)||{},h=E.nodeSize.bridge;return{graph:{meta:Object.assign(E.graph.meta,d)},subScene:{meta:Object.assign(E.subScene.meta,r)},nodeSize:{meta:Object.assign(E.nodeSize.meta,a),node:Object.assign(E.nodeSize.node,s),bridge:h}}}(n)),v(r.root)},Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -1,2 +0,2 @@

import { AttrDef } from './core/interface';
import { AttrDef, BaseEdge } from './core/interface';
export declare enum HierarchyNodeType {

@@ -68,2 +68,3 @@ META = 0,

} | null;
baseEdgeList: BaseEdge[];
}

@@ -70,0 +71,0 @@ export interface HierarchyGraphNodeInfo extends HierarchyBaseNodeInfo {

{
"name": "dagre-compound",
"version": "0.0.6",
"version": "0.0.7",
"description": "A multi-level compound graph layout library based on dagre",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc