orbitchat 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/orbitchat.js +11 -10
- package/dist/assets/{api-CK3k3ceJ.js → api-uEDUqkTi.js} +1 -1
- package/dist/assets/arc-m8RC5oDD-BT8qBEWK.js +1 -0
- package/dist/assets/{blockDiagram-c4efeb88-NvaZhZFT-B2z-bNEd.js → blockDiagram-c4efeb88-CZ2mpei3-DwC_8AXi.js} +7 -7
- package/dist/assets/{c4Diagram-c83219d4-gPr1eF38-BpklvzfC.js → c4Diagram-c83219d4-DL2EmCLj-Bb77Yjks.js} +2 -2
- package/dist/assets/channel-BKp1WYnX-BpupPR-0.js +1 -0
- package/dist/assets/classDiagram-beda092f-vKbJ2bcD-ByRiBo_z.js +2 -0
- package/dist/assets/classDiagram-v2-2358418a-BHXpn1Du-CsAMUMgi.js +2 -0
- package/dist/assets/clone-B1V2003j-DKfYfMmY.js +1 -0
- package/dist/assets/{createText-1719965b-D9Y3vUMn-UiwO3q8Q.js → createText-1719965b-C2-AT0ab-Ngc7i9D1.js} +2 -2
- package/dist/assets/edges-96097737-Zk-qG_8u-dmc-RUJc.js +4 -0
- package/dist/assets/{erDiagram-0228fc6a-BLw8FsIp-CkgJ5rpM.js → erDiagram-0228fc6a-B94anMjz-CVrsMLr0.js} +3 -3
- package/dist/assets/{flowDb-c6c81e3f-DXVkMlSE-DRQM6L-v.js → flowDb-c6c81e3f-CRRW-bQO-BYHCtAAr.js} +4 -4
- package/dist/assets/{flowDiagram-50d868cf-mkkB0hFd-CL_JosYM.js → flowDiagram-50d868cf-DPzQMhJv-CrArx2UT.js} +4 -4
- package/dist/assets/flowDiagram-v2-4f6560a1-Si9enBmB-CcZjaZir.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-D9IbjnSJ-DWoCBlEO.js → flowchart-elk-definition-6af322e1-CULhtvD--Bc4SZDEI.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-Cqs5_Zht-CyVqot_b.js → ganttDiagram-a2739b55-Bp8yOLEz-DMtD2BxT.js} +3 -3
- package/dist/assets/{gitGraphDiagram-82fe8481-txBzFn40-CZkxfaP2.js → gitGraphDiagram-82fe8481-BYtOQJl0-BxXpgB9C.js} +1 -1
- package/dist/assets/{graph-BZahQKIN-CTgzd5us.js → graph-BV6jB5rk-DcOA8BmL.js} +1 -1
- package/dist/assets/{index-CDwx2U7N.js → index-3H3i7ExC.js} +156 -156
- package/dist/assets/{index-5325376f-DsNDppci-BaFeDo3U.js → index-5325376f-DrY72DrM-BQxxLtiM.js} +1 -1
- package/dist/assets/index-DlFdZiHl-B3vsLXXB.js +134 -0
- package/dist/assets/{infoDiagram-8eee0895-SbmhgTjv-CCnN8bBn.js → infoDiagram-8eee0895-C6GFnrZ7-OKacvbId.js} +4 -4
- package/dist/assets/{journeyDiagram-c64418c1-C7AiwbKr-YZTGwLv1.js → journeyDiagram-c64418c1-daS1W8qe-BkJ9QLFM.js} +4 -4
- package/dist/assets/{layout-j-hMNqAM-C88IAVJC.js → layout-LXMv3mSS-CNNBHyhJ.js} +1 -1
- package/dist/assets/{mindmap-definition-8da855dc-B1WjnfxE-a9TK-xQN.js → mindmap-definition-8da855dc-DmNQYVT1-BsCbTj6n.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-zrkaw4r--BMPBVA0x.js → pieDiagram-a8764435-381urBY5-A6raAt-D.js} +5 -5
- package/dist/assets/{quadrantDiagram-1e28029f-C2Wa5n16-DwWDm6cx.js → quadrantDiagram-1e28029f-hgRmK2bX-CiuNGTtQ.js} +4 -4
- package/dist/assets/{requirementDiagram-08caed73-BtHxx079-zeP-18qR.js → requirementDiagram-08caed73-BB0Q-cI9-T9Fr-hSN.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-DXlmqTKB-BJu62Tg5.js → sankeyDiagram-a04cb91d-BpsipZNt-DeqT-JYz.js} +5 -5
- package/dist/assets/{sequenceDiagram-c5b8d532-BVQF3vcA-GR7-Xw8e.js → sequenceDiagram-c5b8d532-xoAvPcQJ-Dh_25-gi.js} +4 -4
- package/dist/assets/{stateDiagram-1ecb1508-Dybc3i2m-BMJzxrY5.js → stateDiagram-1ecb1508-b721R49K-DfgySJAt.js} +1 -1
- package/dist/assets/stateDiagram-v2-c2b004d7-BmSbrbqZ-BT-EqIcl.js +1 -0
- package/dist/assets/{styles-b4e223ce-BSiU4oYL-9ql-THae.js → styles-b4e223ce-TYmJC5IN-CyGeIEtW.js} +3 -3
- package/dist/assets/{styles-ca3715f6-DU7x0doE-B7zhH0Zm.js → styles-ca3715f6-CfJZu0Yn-Czxwj2Eo.js} +2 -2
- package/dist/assets/{styles-d45a18b0-B_CU21kM--NwLlmWK.js → styles-d45a18b0-DZ8oSYcV-KS40LPFU.js} +3 -3
- package/dist/assets/{svgDrawCommon-b86b1483-sbEe2n2v-CJw2W-Er.js → svgDrawCommon-b86b1483-CXPkN8HW-Dq40yjrO.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-b82QCnJ9-CY85LKH1.js → timeline-definition-faaaa080-LDFf1jfb-CB8wN-VT.js} +6 -6
- package/dist/assets/{xychartDiagram-f5964ef8-BtRcO0uy-ylxrBreP.js → xychartDiagram-f5964ef8-DdhO5-Bp-B3w4U23E.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/arc-CvECY7sY-BAfm7gAl.js +0 -1
- package/dist/assets/channel-6PI3wNcc-1exBkyGg.js +0 -1
- package/dist/assets/classDiagram-beda092f-B8axaKGu-C7KpiekH.js +0 -2
- package/dist/assets/classDiagram-v2-2358418a-DPdf2DxR-CfXv0anP.js +0 -2
- package/dist/assets/clone-D01vUIhD-D0aslzw6.js +0 -1
- package/dist/assets/edges-96097737-Zc6U9nQz-Czq3--42.js +0 -4
- package/dist/assets/flowDiagram-v2-4f6560a1-BRIhxQ3y-BzGZQhJW.js +0 -1
- package/dist/assets/stateDiagram-v2-c2b004d7-Bp8rRkv2-Dm74LB8O.js +0 -1
package/dist/assets/{index-5325376f-DsNDppci-BaFeDo3U.js → index-5325376f-DrY72DrM-BQxxLtiM.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as E,K as j}from"./graph-BZahQKIN-CTgzd5us.js";import{A,w as J}from"./layout-j-hMNqAM-C88IAVJC.js";import{a as K}from"./clone-D01vUIhD-D0aslzw6.js";import{c as z,m as H,o as W,h as q,x as Q,t as T,p as D,g as U,d as V,E as O,R,y as Y,f as Z}from"./edges-96097737-Zc6U9nQz-Czq3--42.js";import{O as i,S as B,v as C,F as G}from"./index-CDwx2U7N.js";import{$ as _}from"./createText-1719965b-D9Y3vUMn-UiwO3q8Q.js";function y(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:ee(r),edges:te(r)};return E(r.graph())||(e.value=K(r.graph())),e}function ee(r){return J(r.nodes(),function(e){var t=r.node(e),a=r.parent(e),n={v:e};return E(t)||(n.value=t),E(a)||(n.parent=a),n})}function te(r){return J(r.edges(),function(e){var t=r.edge(e),a={v:e.v,w:e.w};return E(e.name)||(a.name=e.name),E(t)||(a.value=t),a})}let l={},u={},F={};const re=()=>{u={},F={},l={}},S=(r,e)=>(i.trace("In isDescendant",e," ",r," = ",u[e].includes(r)),!!u[e].includes(r)),ne=(r,e)=>(i.info("Descendants of ",e," is ",u[e]),i.info("Edge is ",r),r.v===e||r.w===e?!1:u[e]?u[e].includes(r.v)||S(r.v,e)||S(r.w,e)||u[e].includes(r.w):(i.debug("Tilt, ",e,",not in descendants"),!1)),$=(r,e,t,a)=>{i.warn("Copying children of ",r,"root",a,"data",e.node(r),a);const n=e.children(r)||[];r!==a&&n.push(r),i.warn("Copying (nodes) clusterId",r,"nodes",n),n.forEach(o=>{if(e.children(o).length>0)$(o,e,t,a);else{const c=e.node(o);i.info("cp ",o," to ",a," with parent ",r),t.setNode(o,c),a!==e.parent(o)&&(i.warn("Setting parent",o,e.parent(o)),t.setParent(o,e.parent(o))),r!==a&&o!==r?(i.debug("Setting parent",o,r),t.setParent(o,r)):(i.info("In copy ",r,"root",a,"data",e.node(r),a),i.debug("Not Setting parent for node=",o,"cluster!==rootId",r!==a,"node!==clusterId",o!==r));const g=e.edges(o);i.debug("Copying Edges",g),g.forEach(h=>{i.info("Edge",h);const f=e.edge(h.v,h.w,h.name);i.info("Edge data",f,a);try{ne(h,a)?(i.info("Copying as ",h.v,h.w,f,h.name),t.setEdge(h.v,h.w,f,h.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",h.v,"-->",h.w," rootId: ",a," clusterId:",r)}catch(w){i.error(w)}})}i.debug("Removing node",o),e.removeNode(o)})},I=(r,e)=>{const t=e.children(r);let a=[...t];for(const n of t)F[n]=r,a=[...a,...I(n,e)];return a},X=(r,e)=>{i.trace("Searching",r);const t=e.children(r);if(i.trace("Searching children of id ",r,t),t.length<1)return i.trace("This is a valid node",r),r;for(const a of t){const n=X(a,e);if(n)return i.trace("Found replacement for",r," => ",n),n}},N=r=>!l[r]||!l[r].externalConnections?r:l[r]?l[r].id:r,ie=(r,e)=>{if(!r||e>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");r.nodes().forEach(function(t){r.children(t).length>0&&(i.warn("Cluster identified",t," Replacement id in edges: ",X(t,r)),u[t]=I(t,r),l[t]={id:X(t,r),clusterData:r.node(t)})}),r.nodes().forEach(function(t){const a=r.children(t),n=r.edges();a.length>0?(i.debug("Cluster identified",t,u),n.forEach(o=>{if(o.v!==t&&o.w!==t){const c=S(o.v,t),g=S(o.w,t);c^g&&(i.warn("Edge: ",o," leaves cluster ",t),i.warn("Descendants of XXX ",t,": ",u[t]),l[t].externalConnections=!0)}})):i.debug("Not a cluster ",t,u)});for(let t of Object.keys(l)){const a=l[t].id,n=r.parent(a);n!==t&&l[n]&&!l[n].externalConnections&&(l[t].id=n)}r.edges().forEach(function(t){const a=r.edge(t);i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r.edge(t)));let n=t.v,o=t.w;if(i.warn("Fix XXX",l,"ids:",t.v,t.w,"Translating: ",l[t.v]," --- ",l[t.w]),l[t.v]&&l[t.w]&&l[t.v]===l[t.w]){i.warn("Fixing and trixing link to self - removing XXX",t.v,t.w,t.name),i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name);const c=t.w+"---"+t.v;r.setNode(c,{domId:c,id:c,labelStyle:"",labelText:a.label,padding:0,shape:"labelRect",style:""});const g=structuredClone(a),h=structuredClone(a);g.label="",g.arrowTypeEnd="none",h.label="",g.fromCluster=t.v,h.toCluster=t.v,r.setEdge(n,c,g,t.name+"-cyclic-special"),r.setEdge(c,o,h,t.name+"-cyclic-special")}else if(l[t.v]||l[t.w]){if(i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name),n!==t.v){const c=r.parent(n);l[c].externalConnections=!0,a.fromCluster=t.v}if(o!==t.w){const c=r.parent(o);l[c].externalConnections=!0,a.toCluster=t.w}i.warn("Fix Replacing with XXX",n,o,t.name),r.setEdge(n,o,a,t.name)}}),i.warn("Adjusted Graph",y(r)),P(r,0),i.trace(l)},P=(r,e)=>{if(i.warn("extractor - ",e,y(r),r.children("D")),e>10){i.error("Bailing out");return}let t=r.nodes(),a=!1;for(const n of t){const o=r.children(n);a=a||o.length>0}if(!a){i.debug("Done, no node has children",r.nodes());return}i.debug("Nodes = ",t,e);for(const n of t)if(i.debug("Extracting node",n,l,l[n]&&!l[n].externalConnections,!r.parent(n),r.node(n),r.children("D")," Depth ",e),!l[n])i.debug("Not a cluster",n,e);else if(!l[n].externalConnections&&r.children(n)&&r.children(n).length>0){i.warn("Cluster without external connections, without a parent and with children",n,e);let o=r.graph().rankdir==="TB"?"LR":"TB";l[n]&&l[n].clusterData&&l[n].clusterData.dir&&(o=l[n].clusterData.dir,i.warn("Fixing dir",l[n].clusterData.dir,o));const c=new j({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",y(r)),$(n,r,c,n),r.setNode(n,{clusterNode:!0,id:n,clusterData:l[n].clusterData,labelText:l[n].labelText,graph:c}),i.warn("New graph after copy node: (",n,")",y(c)),i.debug("Old graph after copy",y(r))}else i.warn("Cluster ** ",n," **not meeting the criteria !externalConnections:",!l[n].externalConnections," no parent: ",!r.parent(n)," children ",r.children(n)&&r.children(n).length>0,r.children("D"),e),i.debug(l);t=r.nodes(),i.warn("New list of nodes",t);for(const n of t){const o=r.node(n);i.warn(" Now next level",n,o),o.clusterNode&&P(o.graph,e+1)}},k=(r,e)=>{if(e.length===0)return[];let t=Object.assign(e);return e.forEach(a=>{const n=r.children(a),o=k(r,n);t=[...t,...o]}),t},ae=r=>k(r,r.children()),oe=(r,e)=>{i.info("Creating subgraph rect for ",e.id,e);const t=B(),a=r.insert("g").attr("class","cluster"+(e.class?" "+e.class:"")).attr("id",e.id),n=a.insert("rect",":first-child"),o=C(t.flowchart.htmlLabels),c=a.insert("g").attr("class","cluster-label"),g=e.labelType==="markdown"?_(c,e.labelText,{style:e.labelStyle,useHtmlLabels:o}):c.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}const f=0*e.padding,w=f/2,p=e.width<=h.width+f?h.width+f:e.width;e.width<=h.width+f?e.diff=(h.width-e.width)/2-e.padding/2:e.diff=-e.padding/2,i.trace("Data ",e,JSON.stringify(e)),n.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-p/2).attr("y",e.y-e.height/2-w).attr("width",p).attr("height",e.height+f);const{subGraphTitleTopMargin:x}=T(t);o?c.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2+x})`):c.attr("transform",`translate(${e.x}, ${e.y-e.height/2+x})`);const v=n.node().getBBox();return e.width=v.width,e.height=v.height,e.intersect=function(d){return O(e,d)},a},de=(r,e)=>{const t=r.insert("g").attr("class","note-cluster").attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2-o).attr("width",e.width+n).attr("height",e.height+n).attr("fill","none");const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.intersect=function(g){return O(e,g)},t},se=(r,e)=>{const t=B(),a=r.insert("g").attr("class",e.classes).attr("id",e.id),n=a.insert("rect",":first-child"),o=a.insert("g").attr("class","cluster-label"),c=a.append("rect"),g=o.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}h=g.getBBox();const f=0*e.padding,w=f/2,p=e.width<=h.width+e.padding?h.width+e.padding:e.width;e.width<=h.width+e.padding?e.diff=(h.width+e.padding*0-e.width)/2:e.diff=-e.padding/2,n.attr("class","outer").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w).attr("width",p+f).attr("height",e.height+f),c.attr("class","inner").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w+h.height-1).attr("width",p+f).attr("height",e.height+f-h.height-3);const{subGraphTitleTopMargin:x}=T(t);o.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2-e.padding/3+(C(t.flowchart.htmlLabels)?5:3)+x})`);const v=n.node().getBBox();return e.height=v.height,e.intersect=function(d){return O(e,d)},a},le=(r,e)=>{const t=r.insert("g").attr("class",e.classes).attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("class","divider").attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2).attr("width",e.width+n).attr("height",e.height+n);const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.diff=-e.padding/2,e.intersect=function(g){return O(e,g)},t},he={rect:oe,roundedWithTitle:se,noteGroup:de,divider:le};let L={};const ce=(r,e)=>{i.trace("Inserting cluster");const t=e.shape||"rect";L[e.id]=he[t](r,e)},ge=()=>{L={}},M=async(r,e,t,a,n,o)=>{i.info("Graph in recursive render: XXX",y(e),n);const c=e.graph().rankdir;i.trace("Dir in recursive render - dir:",c);const g=r.insert("g").attr("class","root");e.nodes()?i.info("Recursive render XXX",e.nodes()):i.info("No nodes found for",e),e.edges().length>0&&i.trace("Recursive edges",e.edge(e.edges()[0]));const h=g.insert("g").attr("class","clusters"),f=g.insert("g").attr("class","edgePaths"),w=g.insert("g").attr("class","edgeLabels"),p=g.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(d){const s=e.node(d);if(n!==void 0){const m=JSON.parse(JSON.stringify(n.clusterData));i.info("Setting data for cluster XXX (",d,") ",m,n),e.setNode(n.id,m),e.parent(d)||(i.trace("Setting parent",d,n.id),e.setParent(d,n.id,m))}if(i.info("(Insert) Node XXX"+d+": "+JSON.stringify(e.node(d))),s&&s.clusterNode){i.info("Cluster identified",d,s.width,e.node(d));const m=await M(p,s.graph,t,a,e.node(d),o),b=m.elem;H(s,b),s.diff=m.diff||0,i.info("Node bounds (abc123)",d,s,s.width,s.x,s.y),W(b,s),i.warn("Recursive render complete ",b,s)}else e.children(d).length>0?(i.info("Cluster - the non recursive path XXX",d,s.id,s,e),i.info(X(s.id,e)),l[s.id]={id:X(s.id,e),node:s}):(i.info("Node - the non recursive path",d,s.id,s),await q(p,e.node(d),c))})),e.edges().forEach(function(d){const s=e.edge(d.v,d.w,d.name);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d)),i.info("Edge "+d.v+" -> "+d.w+": ",d," ",JSON.stringify(e.edge(d))),i.info("Fix",l,"ids:",d.v,d.w,"Translating: ",l[d.v],l[d.w]),Q(w,s)}),e.edges().forEach(function(d){i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d))}),i.info("#############################################"),i.info("### Layout ###"),i.info("#############################################"),i.info(e),A(e),i.info("Graph after layout:",y(e));let x=0;const{subGraphTitleTotalMargin:v}=T(o);return ae(e).forEach(function(d){const s=e.node(d);i.info("Position "+d+": "+JSON.stringify(e.node(d))),i.info("Position "+d+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s&&s.clusterNode?(s.y+=v,D(s)):e.children(d).length>0?(s.height+=v,ce(h,s),l[s.id].node=s):(s.y+=v/2,D(s))}),e.edges().forEach(function(d){const s=e.edge(d);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(s),s),s.points.forEach(b=>b.y+=v/2);const m=U(f,d,s,l,t,e,a);V(s,m)}),e.nodes().forEach(function(d){const s=e.node(d);i.info(d,s.type,s.diff),s.type==="group"&&(x=s.diff)}),{elem:g,diff:x}},me=async(r,e,t,a,n)=>{z(r,t,a,n),Y(),Z(),ge(),re(),i.warn("Graph at first:",JSON.stringify(y(e))),ie(e),i.warn("Graph after:",JSON.stringify(y(e)));const o=B();await M(r,e,a,n,void 0,o)};export{me as b};
|
|
1
|
+
import{P as E,K as j}from"./graph-BV6jB5rk-DcOA8BmL.js";import{A,w as J}from"./layout-LXMv3mSS-CNNBHyhJ.js";import{a as K}from"./clone-B1V2003j-DKfYfMmY.js";import{c as z,m as H,o as W,h as q,x as Q,t as T,p as D,g as U,d as V,E as O,R,y as Y,f as Z}from"./edges-96097737-Zk-qG_8u-dmc-RUJc.js";import{O as i,E as B,x as C,F as G}from"./index-3H3i7ExC.js";import{$ as _}from"./createText-1719965b-C2-AT0ab-Ngc7i9D1.js";function y(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:ee(r),edges:te(r)};return E(r.graph())||(e.value=K(r.graph())),e}function ee(r){return J(r.nodes(),function(e){var t=r.node(e),a=r.parent(e),n={v:e};return E(t)||(n.value=t),E(a)||(n.parent=a),n})}function te(r){return J(r.edges(),function(e){var t=r.edge(e),a={v:e.v,w:e.w};return E(e.name)||(a.name=e.name),E(t)||(a.value=t),a})}let l={},u={},F={};const re=()=>{u={},F={},l={}},S=(r,e)=>(i.trace("In isDescendant",e," ",r," = ",u[e].includes(r)),!!u[e].includes(r)),ne=(r,e)=>(i.info("Descendants of ",e," is ",u[e]),i.info("Edge is ",r),r.v===e||r.w===e?!1:u[e]?u[e].includes(r.v)||S(r.v,e)||S(r.w,e)||u[e].includes(r.w):(i.debug("Tilt, ",e,",not in descendants"),!1)),$=(r,e,t,a)=>{i.warn("Copying children of ",r,"root",a,"data",e.node(r),a);const n=e.children(r)||[];r!==a&&n.push(r),i.warn("Copying (nodes) clusterId",r,"nodes",n),n.forEach(o=>{if(e.children(o).length>0)$(o,e,t,a);else{const c=e.node(o);i.info("cp ",o," to ",a," with parent ",r),t.setNode(o,c),a!==e.parent(o)&&(i.warn("Setting parent",o,e.parent(o)),t.setParent(o,e.parent(o))),r!==a&&o!==r?(i.debug("Setting parent",o,r),t.setParent(o,r)):(i.info("In copy ",r,"root",a,"data",e.node(r),a),i.debug("Not Setting parent for node=",o,"cluster!==rootId",r!==a,"node!==clusterId",o!==r));const g=e.edges(o);i.debug("Copying Edges",g),g.forEach(h=>{i.info("Edge",h);const f=e.edge(h.v,h.w,h.name);i.info("Edge data",f,a);try{ne(h,a)?(i.info("Copying as ",h.v,h.w,f,h.name),t.setEdge(h.v,h.w,f,h.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",h.v,"-->",h.w," rootId: ",a," clusterId:",r)}catch(w){i.error(w)}})}i.debug("Removing node",o),e.removeNode(o)})},I=(r,e)=>{const t=e.children(r);let a=[...t];for(const n of t)F[n]=r,a=[...a,...I(n,e)];return a},X=(r,e)=>{i.trace("Searching",r);const t=e.children(r);if(i.trace("Searching children of id ",r,t),t.length<1)return i.trace("This is a valid node",r),r;for(const a of t){const n=X(a,e);if(n)return i.trace("Found replacement for",r," => ",n),n}},N=r=>!l[r]||!l[r].externalConnections?r:l[r]?l[r].id:r,ie=(r,e)=>{if(!r||e>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");r.nodes().forEach(function(t){r.children(t).length>0&&(i.warn("Cluster identified",t," Replacement id in edges: ",X(t,r)),u[t]=I(t,r),l[t]={id:X(t,r),clusterData:r.node(t)})}),r.nodes().forEach(function(t){const a=r.children(t),n=r.edges();a.length>0?(i.debug("Cluster identified",t,u),n.forEach(o=>{if(o.v!==t&&o.w!==t){const c=S(o.v,t),g=S(o.w,t);c^g&&(i.warn("Edge: ",o," leaves cluster ",t),i.warn("Descendants of XXX ",t,": ",u[t]),l[t].externalConnections=!0)}})):i.debug("Not a cluster ",t,u)});for(let t of Object.keys(l)){const a=l[t].id,n=r.parent(a);n!==t&&l[n]&&!l[n].externalConnections&&(l[t].id=n)}r.edges().forEach(function(t){const a=r.edge(t);i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r.edge(t)));let n=t.v,o=t.w;if(i.warn("Fix XXX",l,"ids:",t.v,t.w,"Translating: ",l[t.v]," --- ",l[t.w]),l[t.v]&&l[t.w]&&l[t.v]===l[t.w]){i.warn("Fixing and trixing link to self - removing XXX",t.v,t.w,t.name),i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name);const c=t.w+"---"+t.v;r.setNode(c,{domId:c,id:c,labelStyle:"",labelText:a.label,padding:0,shape:"labelRect",style:""});const g=structuredClone(a),h=structuredClone(a);g.label="",g.arrowTypeEnd="none",h.label="",g.fromCluster=t.v,h.toCluster=t.v,r.setEdge(n,c,g,t.name+"-cyclic-special"),r.setEdge(c,o,h,t.name+"-cyclic-special")}else if(l[t.v]||l[t.w]){if(i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name),n!==t.v){const c=r.parent(n);l[c].externalConnections=!0,a.fromCluster=t.v}if(o!==t.w){const c=r.parent(o);l[c].externalConnections=!0,a.toCluster=t.w}i.warn("Fix Replacing with XXX",n,o,t.name),r.setEdge(n,o,a,t.name)}}),i.warn("Adjusted Graph",y(r)),P(r,0),i.trace(l)},P=(r,e)=>{if(i.warn("extractor - ",e,y(r),r.children("D")),e>10){i.error("Bailing out");return}let t=r.nodes(),a=!1;for(const n of t){const o=r.children(n);a=a||o.length>0}if(!a){i.debug("Done, no node has children",r.nodes());return}i.debug("Nodes = ",t,e);for(const n of t)if(i.debug("Extracting node",n,l,l[n]&&!l[n].externalConnections,!r.parent(n),r.node(n),r.children("D")," Depth ",e),!l[n])i.debug("Not a cluster",n,e);else if(!l[n].externalConnections&&r.children(n)&&r.children(n).length>0){i.warn("Cluster without external connections, without a parent and with children",n,e);let o=r.graph().rankdir==="TB"?"LR":"TB";l[n]&&l[n].clusterData&&l[n].clusterData.dir&&(o=l[n].clusterData.dir,i.warn("Fixing dir",l[n].clusterData.dir,o));const c=new j({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",y(r)),$(n,r,c,n),r.setNode(n,{clusterNode:!0,id:n,clusterData:l[n].clusterData,labelText:l[n].labelText,graph:c}),i.warn("New graph after copy node: (",n,")",y(c)),i.debug("Old graph after copy",y(r))}else i.warn("Cluster ** ",n," **not meeting the criteria !externalConnections:",!l[n].externalConnections," no parent: ",!r.parent(n)," children ",r.children(n)&&r.children(n).length>0,r.children("D"),e),i.debug(l);t=r.nodes(),i.warn("New list of nodes",t);for(const n of t){const o=r.node(n);i.warn(" Now next level",n,o),o.clusterNode&&P(o.graph,e+1)}},k=(r,e)=>{if(e.length===0)return[];let t=Object.assign(e);return e.forEach(a=>{const n=r.children(a),o=k(r,n);t=[...t,...o]}),t},ae=r=>k(r,r.children()),oe=(r,e)=>{i.info("Creating subgraph rect for ",e.id,e);const t=B(),a=r.insert("g").attr("class","cluster"+(e.class?" "+e.class:"")).attr("id",e.id),n=a.insert("rect",":first-child"),o=C(t.flowchart.htmlLabels),c=a.insert("g").attr("class","cluster-label"),g=e.labelType==="markdown"?_(c,e.labelText,{style:e.labelStyle,useHtmlLabels:o}):c.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}const f=0*e.padding,w=f/2,p=e.width<=h.width+f?h.width+f:e.width;e.width<=h.width+f?e.diff=(h.width-e.width)/2-e.padding/2:e.diff=-e.padding/2,i.trace("Data ",e,JSON.stringify(e)),n.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-p/2).attr("y",e.y-e.height/2-w).attr("width",p).attr("height",e.height+f);const{subGraphTitleTopMargin:x}=T(t);o?c.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2+x})`):c.attr("transform",`translate(${e.x}, ${e.y-e.height/2+x})`);const v=n.node().getBBox();return e.width=v.width,e.height=v.height,e.intersect=function(d){return O(e,d)},a},de=(r,e)=>{const t=r.insert("g").attr("class","note-cluster").attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2-o).attr("width",e.width+n).attr("height",e.height+n).attr("fill","none");const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.intersect=function(g){return O(e,g)},t},se=(r,e)=>{const t=B(),a=r.insert("g").attr("class",e.classes).attr("id",e.id),n=a.insert("rect",":first-child"),o=a.insert("g").attr("class","cluster-label"),c=a.append("rect"),g=o.node().appendChild(R(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}h=g.getBBox();const f=0*e.padding,w=f/2,p=e.width<=h.width+e.padding?h.width+e.padding:e.width;e.width<=h.width+e.padding?e.diff=(h.width+e.padding*0-e.width)/2:e.diff=-e.padding/2,n.attr("class","outer").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w).attr("width",p+f).attr("height",e.height+f),c.attr("class","inner").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w+h.height-1).attr("width",p+f).attr("height",e.height+f-h.height-3);const{subGraphTitleTopMargin:x}=T(t);o.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2-e.padding/3+(C(t.flowchart.htmlLabels)?5:3)+x})`);const v=n.node().getBBox();return e.height=v.height,e.intersect=function(d){return O(e,d)},a},le=(r,e)=>{const t=r.insert("g").attr("class",e.classes).attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("class","divider").attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2).attr("width",e.width+n).attr("height",e.height+n);const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.diff=-e.padding/2,e.intersect=function(g){return O(e,g)},t},he={rect:oe,roundedWithTitle:se,noteGroup:de,divider:le};let L={};const ce=(r,e)=>{i.trace("Inserting cluster");const t=e.shape||"rect";L[e.id]=he[t](r,e)},ge=()=>{L={}},M=async(r,e,t,a,n,o)=>{i.info("Graph in recursive render: XXX",y(e),n);const c=e.graph().rankdir;i.trace("Dir in recursive render - dir:",c);const g=r.insert("g").attr("class","root");e.nodes()?i.info("Recursive render XXX",e.nodes()):i.info("No nodes found for",e),e.edges().length>0&&i.trace("Recursive edges",e.edge(e.edges()[0]));const h=g.insert("g").attr("class","clusters"),f=g.insert("g").attr("class","edgePaths"),w=g.insert("g").attr("class","edgeLabels"),p=g.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(d){const s=e.node(d);if(n!==void 0){const m=JSON.parse(JSON.stringify(n.clusterData));i.info("Setting data for cluster XXX (",d,") ",m,n),e.setNode(n.id,m),e.parent(d)||(i.trace("Setting parent",d,n.id),e.setParent(d,n.id,m))}if(i.info("(Insert) Node XXX"+d+": "+JSON.stringify(e.node(d))),s&&s.clusterNode){i.info("Cluster identified",d,s.width,e.node(d));const m=await M(p,s.graph,t,a,e.node(d),o),b=m.elem;H(s,b),s.diff=m.diff||0,i.info("Node bounds (abc123)",d,s,s.width,s.x,s.y),W(b,s),i.warn("Recursive render complete ",b,s)}else e.children(d).length>0?(i.info("Cluster - the non recursive path XXX",d,s.id,s,e),i.info(X(s.id,e)),l[s.id]={id:X(s.id,e),node:s}):(i.info("Node - the non recursive path",d,s.id,s),await q(p,e.node(d),c))})),e.edges().forEach(function(d){const s=e.edge(d.v,d.w,d.name);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d)),i.info("Edge "+d.v+" -> "+d.w+": ",d," ",JSON.stringify(e.edge(d))),i.info("Fix",l,"ids:",d.v,d.w,"Translating: ",l[d.v],l[d.w]),Q(w,s)}),e.edges().forEach(function(d){i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d))}),i.info("#############################################"),i.info("### Layout ###"),i.info("#############################################"),i.info(e),A(e),i.info("Graph after layout:",y(e));let x=0;const{subGraphTitleTotalMargin:v}=T(o);return ae(e).forEach(function(d){const s=e.node(d);i.info("Position "+d+": "+JSON.stringify(e.node(d))),i.info("Position "+d+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s&&s.clusterNode?(s.y+=v,D(s)):e.children(d).length>0?(s.height+=v,ce(h,s),l[s.id].node=s):(s.y+=v/2,D(s))}),e.edges().forEach(function(d){const s=e.edge(d);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(s),s),s.points.forEach(b=>b.y+=v/2);const m=U(f,d,s,l,t,e,a);V(s,m)}),e.nodes().forEach(function(d){const s=e.node(d);i.info(d,s.type,s.diff),s.type==="group"&&(x=s.diff)}),{elem:g,diff:x}},me=async(r,e,t,a,n)=>{z(r,t,a,n),Y(),Z(),ge(),re(),i.warn("Graph at first:",JSON.stringify(y(e))),ie(e),i.warn("Graph after:",JSON.stringify(y(e)));const o=B();await M(r,e,a,n,void 0,o)};export{me as b};
|