All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.chunks.mermaid.esm.min.chunk-BOP2KBYH.mjs Maven / Gradle / Ivy

Go to download

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

There is a newer version: 11.4.0
Show newest version
import{a as y}from"./chunk-6XGRHI2A.mjs";import{D as x,E as B,F as k,G as R,H as A,J as D,K as g,L as O,N as yr,P as C,T as j,U as Z,d as I,f as _r,h as Q,i as wr,k as F,n as u,p as L,q as U,s as w,u as Er,v as br,x as p,z as T}from"./chunk-BKDDFIKN.mjs";import{O as V,T as z,z as vr}from"./chunk-6BY5RJGC.mjs";import{a as f}from"./chunk-GTKDMUJJ.mjs";function N(r,e,n,o){var t;do t=j(o);while(r.hasNode(t));return n.dummy=e,r.setNode(t,n),t}f(N,"addDummyNode");function xr(r){var e=new y().setGraph(r.graph());return u(r.nodes(),function(n){e.setNode(n,r.node(n))}),u(r.edges(),function(n){var o=e.edge(n.v,n.w)||{weight:0,minlen:1},t=r.edge(n);e.setEdge(n.v,n.w,{weight:o.weight+t.weight,minlen:Math.max(o.minlen,t.minlen)})}),e}f(xr,"simplify");function X(r){var e=new y({multigraph:r.isMultigraph()}).setGraph(r.graph());return u(r.nodes(),function(n){r.children(n).length||e.setNode(n,r.node(n))}),u(r.edges(),function(n){e.setEdge(n,r.edge(n))}),e}f(X,"asNonCompoundGraph");function $(r,e){var n=r.x,o=r.y,t=e.x-n,i=e.y-o,a=r.width/2,s=r.height/2;if(!t&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var d,c;return Math.abs(i)*a>Math.abs(t)*s?(i<0&&(s=-s),d=s*t/i,c=s):(t<0&&(a=-a),d=a,c=a*i/t),{x:n+d,y:o+c}}f($,"intersectRect");function S(r){var e=w(g(er(r)+1),function(){return[]});return u(r.nodes(),function(n){var o=r.node(n),t=o.rank;x(t)||(e[t][o.order]=n)}),e}f(S,"buildLayerMatrix");function kr(r){var e=R(w(r.nodes(),function(n){return r.node(n).rank}));u(r.nodes(),function(n){var o=r.node(n);p(o,"rank")&&(o.rank-=e)})}f(kr,"normalizeRanks");function gr(r){var e=R(w(r.nodes(),function(i){return r.node(i).rank})),n=[];u(r.nodes(),function(i){var a=r.node(i).rank-e;n[a]||(n[a]=[]),n[a].push(i)});var o=0,t=r.graph().nodeRankFactor;u(n,function(i,a){x(i)&&a%t!==0?--o:o&&u(i,function(s){r.node(s).rank+=o})})}f(gr,"removeEmptyRanks");function rr(r,e,n,o){var t={width:0,height:0};return arguments.length>=4&&(t.rank=n,t.order=o),N(r,"border",t,e)}f(rr,"addBorderNode");function er(r){return k(w(r.nodes(),function(e){var n=r.node(e).rank;if(!x(n))return n}))}f(er,"maxRank");function Nr(r,e){var n={lhs:[],rhs:[]};return u(r,function(o){e(o)?n.lhs.push(o):n.rhs.push(o)}),n}f(Nr,"partition");function Ir(r,e){var n=Q();try{return e()}finally{console.log(r+" time: "+(Q()-n)+"ms")}}f(Ir,"time");function Lr(r,e){return e()}f(Lr,"notime");function Tr(r){function e(n){var o=r.children(n),t=r.node(n);if(o.length&&u(o,e),p(t,"minRank")){t.borderLeft=[],t.borderRight=[];for(var i=t.minRank,a=t.maxRank+1;i0;--s)if(a=e[s].dequeue(),a){o=o.concat(tr(r,e,n,a,!0));break}}}return o}f(Ee,"doGreedyFAS");function tr(r,e,n,o,t){var i=t?[]:void 0;return u(r.inEdges(o.v),function(a){var s=r.edge(a),d=r.node(a.v);t&&i.push({v:a.v,w:a.w}),d.out-=s,ir(e,n,d)}),u(r.outEdges(o.v),function(a){var s=r.edge(a),d=a.w,c=r.node(d);c.in-=s,ir(e,n,c)}),r.removeNode(o.v),i}f(tr,"removeNode");function be(r,e){var n=new y,o=0,t=0;u(r.nodes(),function(s){n.setNode(s,{v:s,in:0,out:0})}),u(r.edges(),function(s){var d=n.edge(s.v,s.w)||0,c=e(s),h=d+c;n.setEdge(s.v,s.w,h),t=Math.max(t,n.node(s.v).out+=c),o=Math.max(o,n.node(s.w).in+=c)});var i=g(t+o+3).map(function(){return new H}),a=o+1;return u(n.nodes(),function(s){ir(i,a,n.node(s))}),{graph:n,buckets:i,zeroIdx:a}}f(be,"buildState");function ir(r,e,n){n.out?n.in?r[n.out-n.in+e].enqueue(n):r[r.length-1].enqueue(n):r[0].enqueue(n)}f(ir,"assignBucket");function Gr(r){var e=r.graph().acyclicer==="greedy"?Or(r,n(r)):ye(r);u(e,function(o){var t=r.edge(o);r.removeEdge(o),t.forwardName=o.name,t.reversed=!0,r.setEdge(o.w,o.v,t,j("rev"))});function n(o){return function(t){return o.edge(t).weight}}f(n,"weightFn")}f(Gr,"run");function ye(r){var e=[],n={},o={};function t(i){p(o,i)||(o[i]=!0,n[i]=!0,u(r.outEdges(i),function(a){p(n,a.w)?e.push(a):t(a.w)}),delete n[i])}return f(t,"dfs"),u(r.nodes(),t),e}f(ye,"dfsFAS");function Vr(r){u(r.edges(),function(e){var n=r.edge(e);if(n.reversed){r.removeEdge(e);var o=n.forwardName;delete n.reversed,delete n.forwardName,r.setEdge(e.w,e.v,n,o)}})}f(Vr,"undo");function Ar(r){r.graph().dummyChains=[],u(r.edges(),function(e){xe(r,e)})}f(Ar,"run");function xe(r,e){var n=e.v,o=r.node(n).rank,t=e.w,i=r.node(t).rank,a=e.name,s=r.edge(e),d=s.labelRank;if(i!==o+1){r.removeEdge(e);var c,h,l;for(l=0,++o;oa.lim&&(s=a,d=!0);var c=L(e.edges(),function(h){return d===zr(r,r.node(h.v),s)&&d!==zr(r,r.node(h.w),s)});return A(c,function(h){return G(e,h)})}f(Xr,"enterEdge");function Hr(r,e,n,o){var t=n.v,i=n.w;r.removeEdge(t,i),r.setEdge(o.v,o.w,{}),dr(r),ur(r,e),Se(r,e)}f(Hr,"exchangeEdges");function Se(r,e){var n=U(r.nodes(),function(t){return!e.node(t).parent}),o=sr(r,n);o=o.slice(1),u(o,function(t){var i=r.node(t).parent,a=e.edge(t,i),s=!1;a||(a=e.edge(i,t),s=!0),e.node(t).rank=e.node(i).rank+(s?a.minlen:-a.minlen)})}f(Se,"updateRanks");function Me(r,e,n){return r.hasEdge(e,n)}f(Me,"isTreeEdge");function zr(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}f(zr,"isDescendant");function cr(r){switch(r.graph().ranker){case"network-simplex":Jr(r);break;case"tight-tree":Fe(r);break;case"longest-path":Pe(r);break;default:Jr(r)}}f(cr,"rank");var Pe=W;function Fe(r){W(r),J(r)}f(Fe,"tightTreeRanker");function Jr(r){P(r)}f(Jr,"networkSimplexRanker");function Kr(r){var e=N(r,"root",{},"_root"),n=Oe(r),o=k(T(n))-1,t=2*o+1;r.graph().nestingRoot=e,u(r.edges(),function(a){r.edge(a).minlen*=t});var i=Ge(r)+1;u(r.children(),function(a){Qr(r,e,t,i,o,n,a)}),r.graph().nodeRankFactor=t}f(Kr,"run");function Qr(r,e,n,o,t,i,a){var s=r.children(a);if(!s.length){a!==e&&r.setEdge(e,a,{weight:0,minlen:n});return}var d=rr(r,"_bt"),c=rr(r,"_bb"),h=r.node(a);r.setParent(d,a),h.borderTop=d,r.setParent(c,a),h.borderBottom=c,u(s,function(l){Qr(r,e,n,o,t,i,l);var m=r.node(l),v=m.borderTop?m.borderTop:l,_=m.borderBottom?m.borderBottom:l,b=m.borderTop?o:2*o,Y=v!==_?1:t-i[a]+1;r.setEdge(d,v,{weight:b,minlen:Y,nestingEdge:!0}),r.setEdge(_,c,{weight:b,minlen:Y,nestingEdge:!0})}),r.parent(a)||r.setEdge(e,d,{weight:0,minlen:t+i[a]})}f(Qr,"dfs");function Oe(r){var e={};function n(o,t){var i=r.children(o);i&&i.length&&u(i,function(a){n(a,t+1)}),e[o]=t}return f(n,"dfs"),u(r.children(),function(o){n(o,1)}),e}f(Oe,"treeDepths");function Ge(r){return O(r.edges(),function(e,n){return e+r.edge(n).weight},0)}f(Ge,"sumWeights");function Zr(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,u(r.edges(),function(n){var o=r.edge(n);o.nestingEdge&&r.removeEdge(n)})}f(Zr,"cleanup");function $r(r,e,n){var o={},t;u(n,function(i){for(var a=r.parent(i),s,d;a;){if(s=r.parent(a),s?(d=o[s],o[s]=a):(d=t,t=a),d&&d!==a){e.setEdge(d,a);return}a=s}})}f($r,"addSubgraphConstraints");function re(r,e,n){var o=Be(r),t=new y({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(i){return r.node(i)});return u(r.nodes(),function(i){var a=r.node(i),s=r.parent(i);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(t.setNode(i),t.setParent(i,s||o),u(r[n](i),function(d){var c=d.v===i?d.w:d.v,h=t.edge(c,i),l=x(h)?0:h.weight;t.setEdge(c,i,{weight:r.edge(d).weight+l})}),p(a,"minRank")&&t.setNode(i,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),t}f(re,"buildLayerGraph");function Be(r){for(var e;r.hasNode(e=j("_root")););return e}f(Be,"createRootNode");function ee(r,e){for(var n=0,o=1;o0;)h%2&&(l+=s[h+1]),h=h-1>>1,s[h]+=c.weight;d+=c.weight*l})),d}f(Ae,"twoLayerCrossCount");function ne(r){var e={},n=L(r.nodes(),function(s){return!r.children(s).length}),o=k(w(n,function(s){return r.node(s).rank})),t=w(g(o+1),function(){return[]});function i(s){if(!p(e,s)){e[s]=!0;var d=r.node(s);t[d.rank].push(s),u(r.successors(s),i)}}f(i,"dfs");var a=C(n,function(s){return r.node(s).rank});return u(a,i),t}f(ne,"initOrder");function oe(r,e){return w(e,function(n){var o=r.inEdges(n);if(o.length){var t=O(o,function(i,a){var s=r.edge(a),d=r.node(a.v);return{sum:i.sum+s.weight*d.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:t.sum/t.weight,weight:t.weight}}else return{v:n}})}f(oe,"barycenter");function te(r,e){var n={};u(r,function(t,i){var a=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i};x(t.barycenter)||(a.barycenter=t.barycenter,a.weight=t.weight)}),u(e.edges(),function(t){var i=n[t.v],a=n[t.w];!x(i)&&!x(a)&&(a.indegree++,i.out.push(n[t.w]))});var o=L(n,function(t){return!t.indegree});return De(o)}f(te,"resolveConflicts");function De(r){var e=[];function n(i){return function(a){a.merged||(x(a.barycenter)||x(i.barycenter)||a.barycenter>=i.barycenter)&&je(i,a)}}f(n,"handleIn");function o(i){return function(a){a.in.push(i),--a.indegree===0&&r.push(a)}}for(f(o,"handleOut");r.length;){var t=r.pop();e.push(t),u(t.in.reverse(),n(t)),u(t.out,o(t))}return w(L(e,function(i){return!i.merged}),function(i){return D(i,["vs","i","barycenter","weight"])})}f(De,"doResolveConflicts");function je(r,e){var n=0,o=0;r.weight&&(n+=r.barycenter*r.weight,o+=r.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),r.vs=e.vs.concat(r.vs),r.barycenter=n/o,r.weight=o,r.i=Math.min(e.i,r.i),e.merged=!0}f(je,"mergeEntries");function ae(r,e){var n=Nr(r,function(h){return p(h,"barycenter")}),o=n.lhs,t=C(n.rhs,function(h){return-h.i}),i=[],a=0,s=0,d=0;o.sort(Ye(!!e)),d=ie(i,t,d),u(o,function(h){d+=h.vs.length,i.push(h.vs),a+=h.barycenter*h.weight,s+=h.weight,d=ie(i,t,d)});var c={vs:I(i)};return s&&(c.barycenter=a/s,c.weight=s),c}f(ae,"sort");function ie(r,e,n){for(var o;e.length&&(o=F(e)).i<=n;)e.pop(),r.push(o.vs),n++;return n}f(ie,"consumeUnsortable");function Ye(r){return function(e,n){return e.barycentern.barycenter?1:r?n.i-e.i:e.i-n.i}}f(Ye,"compareWithBias");function hr(r,e,n,o){var t=r.children(e),i=r.node(e),a=i?i.borderLeft:void 0,s=i?i.borderRight:void 0,d={};a&&(t=L(t,function(_){return _!==a&&_!==s}));var c=oe(r,t);u(c,function(_){if(r.children(_.v).length){var b=hr(r,_.v,n,o);d[_.v]=b,p(b,"barycenter")&&Ue(_,b)}});var h=te(c,n);ze(h,d);var l=ae(h,o);if(a&&(l.vs=I([a,l.vs,s]),r.predecessors(a).length)){var m=r.node(r.predecessors(a)[0]),v=r.node(r.predecessors(s)[0]);p(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+m.order+v.order)/(l.weight+2),l.weight+=2}return l}f(hr,"sortSubgraph");function ze(r,e){u(r,function(n){n.vs=I(n.vs.map(function(o){return e[o]?e[o].vs:o}))})}f(ze,"expandSubgraphs");function Ue(r,e){x(r.barycenter)?(r.barycenter=e.barycenter,r.weight=e.weight):(r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight)}f(Ue,"mergeBarycenters");function ue(r){var e=er(r),n=fe(r,g(1,e+1),"inEdges"),o=fe(r,g(e-1,-1,-1),"outEdges"),t=ne(r);se(r,t);for(var i=Number.POSITIVE_INFINITY,a,s=0,d=0;d<4;++s,++d){We(s%2?n:o,s%4>=2),t=S(r);var c=ee(r,t);ca||s>e[d].lim));for(c=d,d=o;(d=r.parent(d))!==c;)i.push(d);return{path:t.concat(i.reverse()),lca:c}}f(qe,"findPath");function Xe(r){var e={},n=0;function o(t){var i=n;u(r.children(t),o),e[t]={low:i,lim:n++}}return f(o,"dfs"),u(r.children(),o),e}f(Xe,"postorder");function He(r,e){var n={};function o(t,i){var a=0,s=0,d=t.length,c=F(i);return u(i,function(h,l){var m=Ke(r,h),v=m?r.node(m).order:d;(m||h===c)&&(u(i.slice(s,l+1),function(_){u(r.predecessors(_),function(b){var Y=r.node(b),mr=Y.order;(mrc)&&ce(n,m,h)})})}f(o,"scan");function t(i,a){var s=-1,d,c=0;return u(a,function(h,l){if(r.node(h).dummy==="border"){var m=r.predecessors(h);m.length&&(d=r.node(m[0]).order,o(a,c,l,s,d),c=l,s=d)}o(a,c,a.length,d,i.length)}),a}return f(t,"visitLayer"),O(e,t),n}f(Je,"findType2Conflicts");function Ke(r,e){if(r.node(e).dummy)return U(r.predecessors(e),function(n){return r.node(n).dummy})}f(Ke,"findOtherInnerSegmentNode");function ce(r,e,n){if(e>n){var o=e;e=n,n=o}var t=r[e];t||(r[e]=t={}),t[n]=!0}f(ce,"addConflict");function Qe(r,e,n){if(e>n){var o=e;e=n,n=o}return p(r[e],n)}f(Qe,"hasConflict");function Ze(r,e,n,o){var t={},i={},a={};return u(e,function(s){u(s,function(d,c){t[d]=d,i[d]=d,a[d]=c})}),u(e,function(s){var d=-1;u(s,function(c){var h=o(c);if(h.length){h=C(h,function(b){return a[b]});for(var l=(h.length-1)/2,m=Math.floor(l),v=Math.ceil(l);m<=v;++m){var _=h[m];i[c]===c&&d




© 2015 - 2024 Weber Informatics LLC | Privacy Policy