@hjd-hitsz/claudex-web 4.1.2 → 4.1.3
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/CHANGELOG.md +22 -0
- package/build-info.json +4 -4
- package/client/dist/_baseMerge.js +1 -1
- package/client/dist/app.js +91 -90
- package/client/dist/code-highlight-style.js +48 -13
- package/client/dist/dagre-NK4GIZVX.js +2 -2
- package/client/dist/document-editor.js +101 -136
- package/client/dist/file-panel.js +5 -1
- package/client/dist/graph.js +1 -1
- package/client/dist/index.js +2 -2
- package/client/dist/index10.js +1 -1
- package/client/dist/index11.js +1 -1
- package/client/dist/index12.js +1 -1
- package/client/dist/index13.js +2 -2
- package/client/dist/index14.js +1 -1
- package/client/dist/index15.js +1 -1
- package/client/dist/index16.js +2 -2
- package/client/dist/index17.js +1 -1
- package/client/dist/index18.js +2 -2
- package/client/dist/index19.js +1 -1
- package/client/dist/index20.js +1 -1
- package/client/dist/index21.js +1 -1
- package/client/dist/index22.js +1 -1
- package/client/dist/index3.js +1 -1
- package/client/dist/index4.js +1 -1
- package/client/dist/index5.js +1 -1
- package/client/dist/index6.js +2 -2
- package/client/dist/index7.js +1 -1
- package/client/dist/index8.js +1 -1
- package/client/dist/index9.js +1 -1
- package/client/dist/isArrayLikeObject.js +1 -1
- package/client/dist/style.css +1 -1
- package/docs/architecture/backend-regressions.md +2 -1
- package/docs/architecture/behavior.md +14 -2
- package/docs/architecture.md +7 -2
- package/docs/cli-command-coverage.md +1 -1
- package/docs/deployment.md +4 -2
- package/docs/development.md +14 -0
- package/docs/images/desktop-dark.png +0 -0
- package/docs/images/desktop-light.png +0 -0
- package/docs/releases/v4.1.3.md +8 -0
- package/package.json +1 -1
- package/packages/translation-engine/package.json +1 -1
- package/server/src/backends/claude/execution-session.mjs +27 -4
- package/server/src/backends/claude/native-provider.mjs +35 -0
- package/server/src/backends/claude/provider-environment.mjs +63 -11
- package/server/src/backends/claude/provider-transport.mjs +45 -9
- package/server/src/backends/claude/runtime.mjs +19 -4
- package/server/src/backends/claude/worker-client.mjs +2 -0
- package/server/src/backends/codex/adapter.mjs +9 -2
- package/server/src/backends/codex/requests.mjs +6 -2
- package/server/src/backends/codex/resume-lifecycle.mjs +38 -0
- package/server/src/backends/codex/subagent-model.mjs +19 -0
- package/server/src/backends/codex/upstream.mjs +9 -0
- package/server/src/backends/configuration.mjs +37 -0
- package/server/src/backends/manager.mjs +19 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as ae,a as xn,c as Ln,b as Nn,f as we,e as k,i as On}from"./chunk-ZCHMQSOR.js";import{_ as E,c as kn,l as m,by as Tn,bz as Sn,aC as Pn,aB as me,ao as ye,am as Cn,ay as Rn,b7 as In}from"./mermaid.core.js";import{b as Xe,g as oe,a as jn,c as Mn,d as R,k as _n,e as An,f as Dn,h as B,i as $e,j as Ge,l as Bn,m as Ye,t as Fn,n as Ve,o as Xn,p as $n,G as N,q as l,r as L,s as A,v as P,u as U}from"./graph.js";import{B as Gn,C as Yn,u as Ee,j as Ue,D as ie,E as $,a as ee,l as Vn,S as Un,n as q,f as qe,e as qn,b as ze,t as zn,i as ne,z as se,c as Wn,A as Hn}from"./isArrayLikeObject.js";import{t as Jn,c as We,a as Kn,b as Zn,i as Qn,d as de,e as G,k as He,f as er,g as nr,h as rr}from"./_baseMerge.js";import"./app.js";import"./purify.es.js";var xe=1/0,tr=17976931348623157e292;function F(e){if(!e)return e===0?e:0;if(e=Jn(e),e===xe||e===-xe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ar(e){var n=F(e),r=n%1;return n===n?r?n-r:n:0}function I(e){var n=e==null?0:e.length;return n?Xe(e):[]}function or(e){return Gn(Yn(e,void 0,I),e+"")}var ir=Object.prototype,sr=ir.hasOwnProperty;function dr(e){var n=e.length,r=new e.constructor(n);return n&&typeof e[0]=="string"&&sr.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function ur(e,n){var r=We(e.buffer);return new e.constructor(r,e.byteOffset,e.byteLength)}var fr=/\w*$/;function cr(e){var n=new e.constructor(e.source,fr.exec(e));return n.lastIndex=e.lastIndex,n}var Le=Ee?Ee.prototype:void 0,Ne=Le?Le.valueOf:void 0;function lr(e){return Ne?Object(Ne.call(e)):{}}var hr="[object Boolean]",pr="[object Date]",gr="[object Map]",vr="[object Number]",br="[object RegExp]",wr="[object Set]",mr="[object String]",yr="[object Symbol]",Er="[object ArrayBuffer]",xr="[object DataView]",Lr="[object Float32Array]",Nr="[object Float64Array]",Or="[object Int8Array]",kr="[object Int16Array]",Tr="[object Int32Array]",Sr="[object Uint8Array]",Pr="[object Uint8ClampedArray]",Cr="[object Uint16Array]",Rr="[object Uint32Array]";function Ir(e,n,r){var t=e.constructor;switch(n){case Er:return We(e);case hr:case pr:return new t(+e);case xr:return ur(e);case Lr:case Nr:case Or:case kr:case Tr:case Sr:case Pr:case Cr:case Rr:return Kn(e,r);case gr:return new t;case vr:case mr:return new t(e);case br:return cr(e);case wr:return new t;case yr:return lr(e)}}var jr="[object Map]";function Mr(e){return Ue(e)&&oe(e)==jr}var Oe=$&&$.isMap,_r=Oe?ie(Oe):Mr,Ar="[object Set]";function Dr(e){return Ue(e)&&oe(e)==Ar}var ke=$&&$.isSet,Br=ke?ie(ke):Dr,Fr=1,Je="[object Arguments]",Xr="[object Array]",$r="[object Boolean]",Gr="[object Date]",Yr="[object Error]",Ke="[object Function]",Vr="[object GeneratorFunction]",Ur="[object Map]",qr="[object Number]",Ze="[object Object]",zr="[object RegExp]",Wr="[object Set]",Hr="[object String]",Jr="[object Symbol]",Kr="[object WeakMap]",Zr="[object ArrayBuffer]",Qr="[object DataView]",et="[object Float32Array]",nt="[object Float64Array]",rt="[object Int8Array]",tt="[object Int16Array]",at="[object Int32Array]",ot="[object Uint8Array]",it="[object Uint8ClampedArray]",st="[object Uint16Array]",dt="[object Uint32Array]",y={};y[Je]=y[Xr]=y[Zr]=y[Qr]=y[$r]=y[Gr]=y[et]=y[nt]=y[rt]=y[tt]=y[at]=y[Ur]=y[qr]=y[Ze]=y[zr]=y[Wr]=y[Hr]=y[Jr]=y[ot]=y[it]=y[st]=y[dt]=!0;y[Yr]=y[Ke]=y[Kr]=!1;function X(e,n,r,t,a,i){var o,s=n&Fr;if(o!==void 0)return o;if(!ee(e))return e;var d=q(e);if(d)o=dr(e);else{var u=oe(e),f=u==Ke||u==Vr;if(Vn(e))return Zn(e,s);if(u==Ze||u==Je||f&&!a)o=f?{}:Qn(e);else{if(!y[u])return a?e:{};o=Ir(e,u,s)}}i||(i=new Un);var c=i.get(e);if(c)return c;i.set(e,o),Br(e)?e.forEach(function(g){o.add(X(g,n,r,g,e,i))}):_r(e)&&e.forEach(function(g,p){o.set(p,X(g,n,r,p,e,i))});var h=Mn,v=d?void 0:h(e);return jn(v||e,function(g,p){v&&(p=g,g=e[p]),de(o,p,X(g,n,r,p,e,i))}),o}var ut=1,ft=4;function ct(e){return X(e,ut|ft)}var Qe=Object.prototype,lt=Qe.hasOwnProperty,ht=qe(function(e,n){e=Object(e);var r=-1,t=n.length,a=t>2?n[2]:void 0;for(a&&G(n[0],n[1],a)&&(t=1);++r<t;)for(var i=n[r],o=He(i),s=-1,d=o.length;++s<d;){var u=o[s],f=e[u];(f===void 0||qn(f,Qe[u])&&!lt.call(e,u))&&(e[u]=i[u])}return e});function Y(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}function pt(e){return function(n,r,t){var a=Object(n);if(!ze(n)){var i=R(r);n=_n(n),r=function(s){return i(a[s],s,a)}}var o=e(n,r,t);return o>-1?a[i?n[o]:o]:void 0}}var gt=Math.max;function vt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var a=r==null?0:ar(r);return a<0&&(a=gt(t+a,0)),An(e,R(n),a)}var ue=pt(vt);function en(e,n){var r=-1,t=ze(e)?Array(e.length):[];return Dn(e,function(a,i,o){t[++r]=n(a,i,o)}),t}function x(e,n){var r=q(e)?B:en;return r(e,R(n))}function bt(e,n){return e==null?e:zn(e,$e(n),He)}function wt(e,n){return e&&Ge(e,$e(n))}function mt(e,n){return e>n}var yt=Object.prototype,Et=yt.hasOwnProperty;function xt(e,n){return e!=null&&Et.call(e,n)}function nn(e,n){return e!=null&&Bn(e,n,xt)}function rn(e,n){return e<n}function z(e,n){var r={};return n=R(n),Ge(e,function(t,a,i){er(r,a,n(t,a,i))}),r}function fe(e,n,r){for(var t=-1,a=e.length;++t<a;){var i=e[t],o=n(i);if(o!=null&&(s===void 0?o===o&&!ne(o):r(o,s)))var s=o,d=i}return d}function T(e){return e&&e.length?fe(e,se,mt):void 0}var re=nr(function(e,n,r){rr(e,n,r)});function M(e){return e&&e.length?fe(e,se,rn):void 0}function ce(e,n){return e&&e.length?fe(e,R(n),rn):void 0}function Lt(e,n,r,t){if(!ee(e))return e;n=Ye(n,e);for(var a=-1,i=n.length,o=i-1,s=e;s!=null&&++a<i;){var d=Fn(n[a]),u=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(a!=o){var f=s[d];u=void 0,u===void 0&&(u=ee(f)?f:Wn(n[a+1])?[]:{})}de(s,d,u),s=s[d]}return e}function Nt(e,n,r){for(var t=-1,a=n.length,i={};++t<a;){var o=n[t],s=Ve(e,o);r(s,o)&&Lt(i,Ye(o,e),s)}return i}function Ot(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function kt(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,i=ne(e),o=n!==void 0,s=n===null,d=n===n,u=ne(n);if(!s&&!u&&!i&&e>n||i&&o&&d&&!s&&!u||t&&o&&d||!r&&d||!a)return 1;if(!t&&!i&&!u&&e<n||u&&r&&a&&!t&&!i||s&&r&&a||!o&&a||!d)return-1}return 0}function Tt(e,n,r){for(var t=-1,a=e.criteria,i=n.criteria,o=a.length,s=r.length;++t<o;){var d=kt(a[t],i[t]);if(d){if(t>=s)return d;var u=r[t];return d*(u=="desc"?-1:1)}}return e.index-n.index}function St(e,n,r){n.length?n=B(n,function(i){return q(i)?function(o){return Ve(o,i.length===1?i[0]:i)}:i}):n=[se];var t=-1;n=B(n,ie(R));var a=en(e,function(i,o,s){var d=B(n,function(u){return u(i)});return{criteria:d,index:++t,value:i}});return Ot(a,function(i,o){return Tt(i,o,r)})}function Pt(e,n){return Nt(e,n,function(r,t){return Xn(e,t)})}var V=or(function(e,n){return e==null?{}:Pt(e,n)}),Ct=Math.ceil,Rt=Math.max;function It(e,n,r,t){for(var a=-1,i=Rt(Ct((n-e)/(r||1)),0),o=Array(i);i--;)o[++a]=e,e+=r;return o}function jt(e){return function(n,r,t){return t&&typeof t!="number"&&G(n,r,t)&&(r=t=void 0),n=F(n),r===void 0?(r=n,n=0):r=F(r),t=t===void 0?n<r?1:-1:F(t),It(n,r,t)}}var C=jt(),D=qe(function(e,n){if(e==null)return[];var r=n.length;return r>1&&G(e,n[0],n[1])?n=[]:r>2&&G(n[0],n[1],n[2])&&(n=[n[0]]),St(e,Xe(n),[])}),Mt=0;function le(e){var n=++Mt;return $n(e)+n}function _t(e,n,r){for(var t=-1,a=e.length,i=n.length,o={};++t<a;){var s=t<i?n[t]:void 0;r(o,e[t],s)}return o}function At(e,n){return _t(e||[],n||[],de)}class Dt{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return Te(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&Te(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,Bt)),t=t._prev;return"["+n.join(", ")+"]"}}function Te(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Bt(e,n){if(e!=="_next"&&e!=="_prev")return n}var Ft=Hn(1);function Xt(e,n){if(e.nodeCount()<=1)return[];var r=Gt(e,n||Ft),t=$t(r.graph,r.buckets,r.zeroIdx);return I(x(t,function(a){return e.outEdges(a.v,a.w)}))}function $t(e,n,r){for(var t=[],a=n[n.length-1],i=n[0],o;e.nodeCount();){for(;o=i.dequeue();)H(e,n,r,o);for(;o=a.dequeue();)H(e,n,r,o);if(e.nodeCount()){for(var s=n.length-2;s>0;--s)if(o=n[s].dequeue(),o){t=t.concat(H(e,n,r,o,!0));break}}}return t}function H(e,n,r,t,a){var i=a?[]:void 0;return l(e.inEdges(t.v),function(o){var s=e.edge(o),d=e.node(o.v);a&&i.push({v:o.v,w:o.w}),d.out-=s,te(n,r,d)}),l(e.outEdges(t.v),function(o){var s=e.edge(o),d=o.w,u=e.node(d);u.in-=s,te(n,r,u)}),e.removeNode(t.v),i}function Gt(e,n){var r=new N,t=0,a=0;l(e.nodes(),function(s){r.setNode(s,{v:s,in:0,out:0})}),l(e.edges(),function(s){var d=r.edge(s.v,s.w)||0,u=n(s),f=d+u;r.setEdge(s.v,s.w,f),a=Math.max(a,r.node(s.v).out+=u),t=Math.max(t,r.node(s.w).in+=u)});var i=C(a+t+3).map(function(){return new Dt}),o=t+1;return l(r.nodes(),function(s){te(i,o,r.node(s))}),{graph:r,buckets:i,zeroIdx:o}}function te(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Yt(e){var n=e.graph().acyclicer==="greedy"?Xt(e,r(e)):Vt(e);l(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,le("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function Vt(e){var n=[],r={},t={};function a(i){Object.prototype.hasOwnProperty.call(t,i)||(t[i]=!0,r[i]=!0,l(e.outEdges(i),function(o){Object.prototype.hasOwnProperty.call(r,o.w)?n.push(o):a(o.w)}),delete r[i])}return l(e.nodes(),a),n}function Ut(e){l(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function j(e,n,r,t){var a;do a=le(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function qt(e){var n=new N().setGraph(e.graph());return l(e.nodes(),function(r){n.setNode(r,e.node(r))}),l(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function tn(e){var n=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),l(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Se(e,n){var r=e.x,t=e.y,a=n.x-r,i=n.y-t,o=e.width/2,s=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var d,u;return Math.abs(i)*o>Math.abs(a)*s?(i<0&&(s=-s),d=s*a/i,u=s):(a<0&&(o=-o),d=o,u=o*i/a),{x:r+d,y:t+u}}function W(e){var n=x(C(an(e)+1),function(){return[]});return l(e.nodes(),function(r){var t=e.node(r),a=t.rank;L(a)||(n[a][t.order]=r)}),n}function zt(e){var n=M(x(e.nodes(),function(r){return e.node(r).rank}));l(e.nodes(),function(r){var t=e.node(r);nn(t,"rank")&&(t.rank-=n)})}function Wt(e){var n=M(x(e.nodes(),function(i){return e.node(i).rank})),r=[];l(e.nodes(),function(i){var o=e.node(i).rank-n;r[o]||(r[o]=[]),r[o].push(i)});var t=0,a=e.graph().nodeRankFactor;l(r,function(i,o){L(i)&&o%a!==0?--t:t&&l(i,function(s){e.node(s).rank+=t})})}function Pe(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),j(e,"border",a,n)}function an(e){return T(x(e.nodes(),function(n){var r=e.node(n).rank;if(!L(r))return r}))}function Ht(e,n){var r={lhs:[],rhs:[]};return l(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Jt(e,n){return n()}function Kt(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&l(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,o=a.maxRank+1;i<o;++i)Ce(e,"borderLeft","_bl",r,a,i),Ce(e,"borderRight","_br",r,a,i)}}l(e.children(),n)}function Ce(e,n,r,t,a,i){var o={width:0,height:0,rank:i,borderType:n},s=a[n][i-1],d=j(e,"border",o,r);a[n][i]=d,e.setParent(d,t),s&&e.setEdge(s,d,{weight:1})}function Zt(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&on(e)}function Qt(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&ea(e),(n==="lr"||n==="rl")&&(na(e),on(e))}function on(e){l(e.nodes(),function(n){Re(e.node(n))}),l(e.edges(),function(n){Re(e.edge(n))})}function Re(e){var n=e.width;e.width=e.height,e.height=n}function ea(e){l(e.nodes(),function(n){J(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,J),Object.prototype.hasOwnProperty.call(r,"y")&&J(r)})}function J(e){e.y=-e.y}function na(e){l(e.nodes(),function(n){K(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,K),Object.prototype.hasOwnProperty.call(r,"x")&&K(r)})}function K(e){var n=e.x;e.x=e.y,e.y=n}function ra(e){e.graph().dummyChains=[],l(e.edges(),function(n){ta(e,n)})}function ta(e,n){var r=n.v,t=e.node(r).rank,a=n.w,i=e.node(a).rank,o=n.name,s=e.edge(n),d=s.labelRank;if(i!==t+1){e.removeEdge(n);var u=void 0,f,c;for(c=0,++t;t<i;++c,++t)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:n,rank:t},f=j(e,"edge",u,"_d"),t===d&&(u.width=s.width,u.height=s.height,u.dummy="edge-label",u.labelpos=s.labelpos),e.setEdge(r,f,{weight:s.weight},o),c===0&&e.graph().dummyChains.push(f),r=f;e.setEdge(r,a,{weight:s.weight},o)}}function aa(e){l(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function he(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var i=M(x(e.outEdges(t),function(o){return r(o.w)-e.edge(o).minlen}));return(i===Number.POSITIVE_INFINITY||i===void 0||i===null)&&(i=0),a.rank=i}l(e.sources(),r)}function _(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function sn(e){var n=new N({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,i;oa(n,e)<t;)a=ia(n,e),i=n.hasNode(a.v)?_(e,a):-_(e,a),sa(n,e,i);return n}function oa(e,n){function r(t){l(n.nodeEdges(t),function(a){var i=a.v,o=t===i?a.w:i;!e.hasNode(o)&&!_(n,a)&&(e.setNode(o,{}),e.setEdge(t,o,{}),r(o))})}return l(e.nodes(),r),e.nodeCount()}function ia(e,n){return ce(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return _(n,r)})}function sa(e,n,r){l(e.nodes(),function(t){n.node(t).rank+=r})}function da(){}da.prototype=new Error;function dn(e,n,r){q(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],i={};return l(n,function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);un(e,o,r==="post",i,t,a)}),a}function un(e,n,r,t,a,i){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||i.push(n),l(a(n),function(o){un(e,o,r,t,a,i)}),r&&i.push(n))}function ua(e,n){return dn(e,n,"post")}function fa(e,n){return dn(e,n,"pre")}S.initLowLimValues=ge;S.initCutValues=pe;S.calcCutValue=fn;S.leaveEdge=ln;S.enterEdge=hn;S.exchangeEdges=pn;function S(e){e=qt(e),he(e);var n=sn(e);ge(n),pe(n,e);for(var r,t;r=ln(n);)t=hn(n,e,r),pn(n,e,r,t)}function pe(e,n){var r=ua(e,e.nodes());r=r.slice(0,r.length-1),l(r,function(t){ca(e,n,t)})}function ca(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=fn(e,n,r)}function fn(e,n,r){var t=e.node(r),a=t.parent,i=!0,o=n.edge(r,a),s=0;return o||(i=!1,o=n.edge(a,r)),s=o.weight,l(n.nodeEdges(r),function(d){var u=d.v===r,f=u?d.w:d.v;if(f!==a){var c=u===i,h=n.edge(d).weight;if(s+=c?h:-h,ha(e,r,f)){var v=e.edge(r,f).cutvalue;s+=c?-v:v}}}),s}function ge(e,n){arguments.length<2&&(n=e.nodes()[0]),cn(e,{},1,n)}function cn(e,n,r,t,a){var i=r,o=e.node(t);return n[t]=!0,l(e.neighbors(t),function(s){Object.prototype.hasOwnProperty.call(n,s)||(r=cn(e,n,r,s,t))}),o.low=i,o.lim=r++,a?o.parent=a:delete o.parent,r}function ln(e){return ue(e.edges(),function(n){return e.edge(n).cutvalue<0})}function hn(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var i=e.node(t),o=e.node(a),s=i,d=!1;i.lim>o.lim&&(s=o,d=!0);var u=A(n.edges(),function(f){return d===Ie(e,e.node(f.v),s)&&d!==Ie(e,e.node(f.w),s)});return ce(u,function(f){return _(n,f)})}function pn(e,n,r,t){var a=r.v,i=r.w;e.removeEdge(a,i),e.setEdge(t.v,t.w,{}),ge(e),pe(e,n),la(e,n)}function la(e,n){var r=ue(e.nodes(),function(a){return!n.node(a).parent}),t=fa(e,r);t=t.slice(1),l(t,function(a){var i=e.node(a).parent,o=n.edge(a,i),s=!1;o||(o=n.edge(i,a),s=!0),n.node(a).rank=n.node(i).rank+(s?o.minlen:-o.minlen)})}function ha(e,n,r){return e.hasEdge(n,r)}function Ie(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function pa(e){switch(e.graph().ranker){case"network-simplex":je(e);break;case"tight-tree":va(e);break;case"longest-path":ga(e);break;default:je(e)}}var ga=he;function va(e){he(e),sn(e)}function je(e){S(e)}function ba(e){var n=j(e,"root",{},"_root"),r=wa(e),t=T(P(r))-1,a=2*t+1;e.graph().nestingRoot=n,l(e.edges(),function(o){e.edge(o).minlen*=a});var i=ma(e)+1;l(e.children(),function(o){gn(e,n,a,i,t,r,o)}),e.graph().nodeRankFactor=a}function gn(e,n,r,t,a,i,o){var s=e.children(o);if(!s.length){o!==n&&e.setEdge(n,o,{weight:0,minlen:r});return}var d=Pe(e,"_bt"),u=Pe(e,"_bb"),f=e.node(o);e.setParent(d,o),f.borderTop=d,e.setParent(u,o),f.borderBottom=u,l(s,function(c){gn(e,n,r,t,a,i,c);var h=e.node(c),v=h.borderTop?h.borderTop:c,g=h.borderBottom?h.borderBottom:c,p=h.borderTop?t:2*t,b=v!==g?1:a-i[o]+1;e.setEdge(d,v,{weight:p,minlen:b,nestingEdge:!0}),e.setEdge(g,u,{weight:p,minlen:b,nestingEdge:!0})}),e.parent(o)||e.setEdge(n,d,{weight:0,minlen:a+i[o]})}function wa(e){var n={};function r(t,a){var i=e.children(t);i&&i.length&&l(i,function(o){r(o,a+1)}),n[t]=a}return l(e.children(),function(t){r(t,1)}),n}function ma(e){return U(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function ya(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,l(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Ea(e,n,r){var t={},a;l(r,function(i){for(var o=e.parent(i),s,d;o;){if(s=e.parent(o),s?(d=t[s],t[s]=o):(d=a,a=o),d&&d!==o){n.setEdge(d,o);return}o=s}})}function xa(e,n,r){var t=La(e),a=new N({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(i){return e.node(i)});return l(e.nodes(),function(i){var o=e.node(i),s=e.parent(i);(o.rank===n||o.minRank<=n&&n<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||t),l(e[r](i),function(d){var u=d.v===i?d.w:d.v,f=a.edge(u,i),c=L(f)?0:f.weight;a.setEdge(u,i,{weight:e.edge(d).weight+c})}),Object.prototype.hasOwnProperty.call(o,"minRank")&&a.setNode(i,{borderLeft:o.borderLeft[n],borderRight:o.borderRight[n]}))}),a}function La(e){for(var n;e.hasNode(n=le("_root")););return n}function Na(e,n){for(var r=0,t=1;t<n.length;++t)r+=Oa(e,n[t-1],n[t]);return r}function Oa(e,n,r){for(var t=At(r,x(r,function(u,f){return f})),a=I(x(n,function(u){return D(x(e.outEdges(u),function(f){return{pos:t[f.w],weight:e.edge(f).weight}}),"pos")})),i=1;i<r.length;)i<<=1;var o=2*i-1;i-=1;var s=x(new Array(o),function(){return 0}),d=0;return l(a.forEach(function(u){var f=u.pos+i;s[f]+=u.weight;for(var c=0;f>0;)f%2&&(c+=s[f+1]),f=f-1>>1,s[f]+=u.weight;d+=u.weight*c})),d}function ka(e){var n={},r=A(e.nodes(),function(s){return!e.children(s).length}),t=T(x(r,function(s){return e.node(s).rank})),a=x(C(t+1),function(){return[]});function i(s){if(!nn(n,s)){n[s]=!0;var d=e.node(s);a[d.rank].push(s),l(e.successors(s),i)}}var o=D(r,function(s){return e.node(s).rank});return l(o,i),a}function Ta(e,n){return x(n,function(r){var t=e.inEdges(r);if(t.length){var a=U(t,function(i,o){var s=e.edge(o),d=e.node(o.v);return{sum:i.sum+s.weight*d.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function Sa(e,n){var r={};l(e,function(a,i){var o=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};L(a.barycenter)||(o.barycenter=a.barycenter,o.weight=a.weight)}),l(n.edges(),function(a){var i=r[a.v],o=r[a.w];!L(i)&&!L(o)&&(o.indegree++,i.out.push(r[a.w]))});var t=A(r,function(a){return!a.indegree});return Pa(t)}function Pa(e){var n=[];function r(i){return function(o){o.merged||(L(o.barycenter)||L(i.barycenter)||o.barycenter>=i.barycenter)&&Ca(i,o)}}function t(i){return function(o){o.in.push(i),--o.indegree===0&&e.push(o)}}for(;e.length;){var a=e.pop();n.push(a),l(a.in.reverse(),r(a)),l(a.out,t(a))}return x(A(n,function(i){return!i.merged}),function(i){return V(i,["vs","i","barycenter","weight"])})}function Ca(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function Ra(e,n){var r=Ht(e,function(f){return Object.prototype.hasOwnProperty.call(f,"barycenter")}),t=r.lhs,a=D(r.rhs,function(f){return-f.i}),i=[],o=0,s=0,d=0;t.sort(Ia(!!n)),d=Me(i,a,d),l(t,function(f){d+=f.vs.length,i.push(f.vs),o+=f.barycenter*f.weight,s+=f.weight,d=Me(i,a,d)});var u={vs:I(i)};return s&&(u.barycenter=o/s,u.weight=s),u}function Me(e,n,r){for(var t;n.length&&(t=Y(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ia(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function vn(e,n,r,t){var a=e.children(n),i=e.node(n),o=i?i.borderLeft:void 0,s=i?i.borderRight:void 0,d={};o&&(a=A(a,function(g){return g!==o&&g!==s}));var u=Ta(e,a);l(u,function(g){if(e.children(g.v).length){var p=vn(e,g.v,r,t);d[g.v]=p,Object.prototype.hasOwnProperty.call(p,"barycenter")&&Ma(g,p)}});var f=Sa(u,r);ja(f,d);var c=Ra(f,t);if(o&&(c.vs=I([o,c.vs,s]),e.predecessors(o).length)){var h=e.node(e.predecessors(o)[0]),v=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+h.order+v.order)/(c.weight+2),c.weight+=2}return c}function ja(e,n){l(e,function(r){r.vs=I(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Ma(e,n){L(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function _a(e){var n=an(e),r=_e(e,C(1,n+1),"inEdges"),t=_e(e,C(n-1,-1,-1),"outEdges"),a=ka(e);Ae(e,a);for(var i=Number.POSITIVE_INFINITY,o,s=0,d=0;d<4;++s,++d){Aa(s%2?r:t,s%4>=2),a=W(e);var u=Na(e,a);u<i&&(d=0,o=ct(a),i=u)}Ae(e,o)}function _e(e,n,r){return x(n,function(t){return xa(e,t,r)})}function Aa(e,n){var r=new N;l(e,function(t){var a=t.graph().root,i=vn(t,a,r,n);l(i.vs,function(o,s){t.node(o).order=s}),Ea(t,r,i.vs)})}function Ae(e,n){l(n,function(r){l(r,function(t,a){e.node(t).order=a})})}function Da(e){var n=Fa(e);l(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,i=Ba(e,n,a.v,a.w),o=i.path,s=i.lca,d=0,u=o[d],f=!0;r!==a.w;){if(t=e.node(r),f){for(;(u=o[d])!==s&&e.node(u).maxRank<t.rank;)d++;u===s&&(f=!1)}if(!f){for(;d<o.length-1&&e.node(u=o[d+1]).minRank<=t.rank;)d++;u=o[d]}e.setParent(r,u),r=e.successors(r)[0]}})}function Ba(e,n,r,t){var a=[],i=[],o=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim),d,u;d=r;do d=e.parent(d),a.push(d);while(d&&(n[d].low>o||s>n[d].lim));for(u=d,d=t;(d=e.parent(d))!==u;)i.push(d);return{path:a.concat(i.reverse()),lca:u}}function Fa(e){var n={},r=0;function t(a){var i=r;l(e.children(a),t),n[a]={low:i,lim:r++}}return l(e.children(),t),n}function Xa(e,n){var r={};function t(a,i){var o=0,s=0,d=a.length,u=Y(i);return l(i,function(f,c){var h=Ga(e,f),v=h?e.node(h).order:d;(h||f===u)&&(l(i.slice(s,c+1),function(g){l(e.predecessors(g),function(p){var b=e.node(p),w=b.order;(w<o||v<w)&&!(b.dummy&&e.node(g).dummy)&&bn(r,p,g)})}),s=c+1,o=v)}),i}return U(n,t),r}function $a(e,n){var r={};function t(i,o,s,d,u){var f;l(C(o,s),function(c){f=i[c],e.node(f).dummy&&l(e.predecessors(f),function(h){var v=e.node(h);v.dummy&&(v.order<d||v.order>u)&&bn(r,h,f)})})}function a(i,o){var s=-1,d,u=0;return l(o,function(f,c){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(d=e.node(h[0]).order,t(o,u,c,s,d),u=c,s=d)}t(o,u,o.length,d,i.length)}),o}return U(n,a),r}function Ga(e,n){if(e.node(n).dummy)return ue(e.predecessors(n),function(r){return e.node(r).dummy})}function bn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ya(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function Va(e,n,r,t){var a={},i={},o={};return l(n,function(s){l(s,function(d,u){a[d]=d,i[d]=d,o[d]=u})}),l(n,function(s){var d=-1;l(s,function(u){var f=t(u);if(f.length){f=D(f,function(p){return o[p]});for(var c=(f.length-1)/2,h=Math.floor(c),v=Math.ceil(c);h<=v;++h){var g=f[h];i[u]===u&&d<o[g]&&!Ya(r,u,g)&&(i[g]=u,i[u]=a[u]=a[g],d=o[g])}}})}),{root:a,align:i}}function Ua(e,n,r,t,a){var i={},o=qa(e,n,r,a),s=a?"borderLeft":"borderRight";function d(c,h){for(var v=o.nodes(),g=v.pop(),p={};g;)p[g]?c(g):(p[g]=!0,v.push(g),v=v.concat(h(g))),g=v.pop()}function u(c){i[c]=o.inEdges(c).reduce(function(h,v){return Math.max(h,i[v.v]+o.edge(v))},0)}function f(c){var h=o.outEdges(c).reduce(function(g,p){return Math.min(g,i[p.w]-o.edge(p))},Number.POSITIVE_INFINITY),v=e.node(c);h!==Number.POSITIVE_INFINITY&&v.borderType!==s&&(i[c]=Math.max(i[c],h))}return d(u,o.predecessors.bind(o)),d(f,o.successors.bind(o)),l(t,function(c){i[c]=i[r[c]]}),i}function qa(e,n,r,t){var a=new N,i=e.graph(),o=Ka(i.nodesep,i.edgesep,t);return l(n,function(s){var d;l(s,function(u){var f=r[u];if(a.setNode(f),d){var c=r[d],h=a.edge(c,f);a.setEdge(c,f,Math.max(o(e,u,d),h||0))}d=u})}),a}function za(e,n){return ce(P(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return bt(r,function(i,o){var s=Za(e,o)/2;t=Math.max(i+s,t),a=Math.min(i-s,a)}),t-a})}function Wa(e,n){var r=P(n),t=M(r),a=T(r);l(["u","d"],function(i){l(["l","r"],function(o){var s=i+o,d=e[s],u;if(d!==n){var f=P(d);u=o==="l"?t-M(f):a-T(f),u&&(e[s]=z(d,function(c){return c+u}))}})})}function Ha(e,n){return z(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=D(x(e,t));return(a[1]+a[2])/2})}function Ja(e){var n=W(e),r=re(Xa(e,n),$a(e,n)),t={},a;l(["u","d"],function(o){a=o==="u"?n:P(n).reverse(),l(["l","r"],function(s){s==="r"&&(a=x(a,function(c){return P(c).reverse()}));var d=(o==="u"?e.predecessors:e.successors).bind(e),u=Va(e,a,r,d),f=Ua(e,a,u.root,u.align,s==="r");s==="r"&&(f=z(f,function(c){return-c})),t[o+s]=f})});var i=za(e,t);return Wa(t,i),Ha(t,e.graph().align)}function Ka(e,n,r){return function(t,a,i){var o=t.node(a),s=t.node(i),d=0,u;if(d+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=-o.width/2;break;case"r":u=o.width/2;break}if(u&&(d+=r?u:-u),u=0,d+=(o.dummy?n:e)/2,d+=(s.dummy?n:e)/2,d+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(d+=r?u:-u),u=0,d}}function Za(e,n){return e.node(n).width}function Qa(e){e=tn(e),eo(e),wt(Ja(e),function(n,r){e.node(r).x=n})}function eo(e){var n=W(e),r=e.graph().ranksep,t=0;l(n,function(a){var i=T(x(a,function(o){return e.node(o).height}));l(a,function(o){e.node(o).y=t+i/2}),t+=i+r})}function no(e,n){var r=Jt;r("layout",()=>{var t=r(" buildLayoutGraph",()=>ho(e));r(" runLayout",()=>ro(t,r)),r(" updateInputGraph",()=>to(e,t))})}function ro(e,n){n(" makeSpaceForEdgeLabels",()=>po(e)),n(" removeSelfEdges",()=>Lo(e)),n(" acyclic",()=>Yt(e)),n(" nestingGraph.run",()=>ba(e)),n(" rank",()=>pa(tn(e))),n(" injectEdgeLabelProxies",()=>go(e)),n(" removeEmptyRanks",()=>Wt(e)),n(" nestingGraph.cleanup",()=>ya(e)),n(" normalizeRanks",()=>zt(e)),n(" assignRankMinMax",()=>vo(e)),n(" removeEdgeLabelProxies",()=>bo(e)),n(" normalize.run",()=>ra(e)),n(" parentDummyChains",()=>Da(e)),n(" addBorderSegments",()=>Kt(e)),n(" order",()=>_a(e)),n(" insertSelfEdges",()=>No(e)),n(" adjustCoordinateSystem",()=>Zt(e)),n(" position",()=>Qa(e)),n(" positionSelfEdges",()=>Oo(e)),n(" removeBorderNodes",()=>xo(e)),n(" normalize.undo",()=>aa(e)),n(" fixupEdgeLabelCoords",()=>yo(e)),n(" undoCoordinateSystem",()=>Qt(e)),n(" translateGraph",()=>wo(e)),n(" assignNodeIntersects",()=>mo(e)),n(" reversePoints",()=>Eo(e)),n(" acyclic.undo",()=>Ut(e))}function to(e,n){l(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),l(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var ao=["nodesep","edgesep","ranksep","marginx","marginy"],oo={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},io=["acyclicer","ranker","rankdir","align"],so=["width","height"],uo={width:0,height:0},fo=["minlen","weight","width","height","labeloffset"],co={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lo=["labelpos"];function ho(e){var n=new N({multigraph:!0,compound:!0}),r=Q(e.graph());return n.setGraph(re({},oo,Z(r,ao),V(r,io))),l(e.nodes(),function(t){var a=Q(e.node(t));n.setNode(t,ht(Z(a,so),uo)),n.setParent(t,e.parent(t))}),l(e.edges(),function(t){var a=Q(e.edge(t));n.setEdge(t,re({},co,Z(a,fo),V(a,lo)))}),n}function po(e){var n=e.graph();n.ranksep/=2,l(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function go(e){l(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),i={rank:(a.rank-t.rank)/2+t.rank,e:n};j(e,"edge-proxy",i,"_ep")}})}function vo(e){var n=0;l(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=T(n,t.maxRank))}),e.graph().maxRank=n}function bo(e){l(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function wo(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,i=e.graph(),o=i.marginx||0,s=i.marginy||0;function d(u){var f=u.x,c=u.y,h=u.width,v=u.height;n=Math.min(n,f-h/2),r=Math.max(r,f+h/2),t=Math.min(t,c-v/2),a=Math.max(a,c+v/2)}l(e.nodes(),function(u){d(e.node(u))}),l(e.edges(),function(u){var f=e.edge(u);Object.prototype.hasOwnProperty.call(f,"x")&&d(f)}),n-=o,t-=s,l(e.nodes(),function(u){var f=e.node(u);f.x-=n,f.y-=t}),l(e.edges(),function(u){var f=e.edge(u);l(f.points,function(c){c.x-=n,c.y-=t}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=n),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=t)}),i.width=r-n+o,i.height=a-t+s}function mo(e){l(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),i,o;r.points?(i=r.points[0],o=r.points[r.points.length-1]):(r.points=[],i=a,o=t),r.points.unshift(Se(t,i)),r.points.push(Se(a,o))})}function yo(e){l(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Eo(e){l(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function xo(e){l(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),i=e.node(Y(r.borderLeft)),o=e.node(Y(r.borderRight));r.width=Math.abs(o.x-i.x),r.height=Math.abs(a.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}}),l(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Lo(e){l(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function No(e){var n=W(e);l(n,function(r){var t=0;l(r,function(a,i){var o=e.node(a);o.order=i+t,l(o.selfEdges,function(s){j(e,"selfedge",{width:s.label.width,height:s.label.height,rank:o.rank,order:i+ ++t,e:s.e,label:s.label},"_se")}),delete o.selfEdges})})}function Oo(e){l(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,i=t.y,o=r.x-a,s=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*o/3,y:i-s},{x:a+5*o/6,y:i-s},{x:a+o,y:i},{x:a+5*o/6,y:i+s},{x:a+2*o/3,y:i+s}],r.label.x=r.x,r.label.y=r.y}})}function Z(e,n){return z(V(e,n),Number)}function Q(e){var n={};return l(e,function(r,t){n[t.toLowerCase()]=r}),n}var De=E((e,n,r)=>Math.max(n,Math.min(r,e)),"clamp"),Be=E((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),ko=E(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram"||e==="er"||e==="classDiagram","shouldMergeSelfLoopSegments"),To=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],So=E((e,n,r,t,a)=>{const i=[],o=new Set;if(r.forEach(({start:f,end:c})=>{f!==t&&o.add(f),c!==t&&o.add(c)}),o.forEach(f=>{const c=e.node(f);typeof c?.x=="number"&&typeof c?.y=="number"&&i.push(c)}),i.length===0&&r.forEach(({edge:f})=>{(f.points??[]).forEach(c=>{typeof c?.x=="number"&&typeof c?.y=="number"&&i.push(c)})}),i.length===0)return Be(a);const s=i.reduce((f,c)=>({x:f.x+c.x/i.length,y:f.y+c.y/i.length}),{x:0,y:0}),d=s.x-n.x,u=s.y-n.y;return Math.abs(d)>Math.abs(u)?d>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":Be(a)},"getSelfLoopSide"),Po=E((e,n="top",r=0,t=0)=>{const a=e.x,i=e.y-r,o=e.width/2,s=e.height/2,d=Math.max(36,Math.min(100,e.width*.8)),u=De(Math.max(t,e.width*.35),36,d),f=De(Math.min(e.width,e.height)*.45,24,48);switch(n){case"bottom":{const c=i+s;return[{x:a-u/2,y:c},{x:a-u/2,y:c+f},{x:a+u/2,y:c+f},{x:a+u/2,y:c}]}case"right":{const c=a+o;return[{x:c,y:i-u/2},{x:c+f,y:i-u/2},{x:c+f,y:i+u/2},{x:c,y:i+u/2}]}case"left":{const c=a-o;return[{x:c,y:i-u/2},{x:c-f,y:i-u/2},{x:c-f,y:i+u/2},{x:c,y:i+u/2}]}default:{const c=i-s;return[{x:a-u/2,y:c},{x:a-u/2,y:c-f},{x:a+u/2,y:c-f},{x:a+u/2,y:c}]}}},"getSelfLoopPoints"),Co=E((e,n,r="top",t=0,a={})=>{const o=e.x,s=e.y-t,d=a.width??0,u=a.height??0;switch(r){case"bottom":return{x:o,y:Math.max(...n.map(f=>f.y))+u/2+4};case"right":return{x:Math.max(...n.map(f=>f.x))+d/2+4,y:s};case"left":return{x:Math.min(...n.map(f=>f.x))-d/2-4,y:s};default:return{x:o,y:Math.min(...n.map(f=>f.y))-u/2-4}}},"getSelfLoopLabelPosition"),wn=E((e,n=0,{mergeSelfLoops:r=!0}={})=>{const t=new Map,a=[],i=e.graph()?.rankdir;return e.edges().forEach(o=>{const s=e.edge(o);if(r&&s.selfLoop){const d=s.selfLoop.id;t.has(d)||t.set(d,[]),t.get(d).push({edge:s,start:o.v,end:o.w})}else a.push({edge:s,start:o.v,end:o.w})}),t.forEach(o=>{if(o.length!==3){o.forEach(w=>a.push(w));return}o.sort((w,O)=>w.edge.selfLoop.order-O.edge.selfLoop.order);const[s,d,u]=o,f=s.edge.originalEdge??d.edge.originalEdge??u.edge.originalEdge??d.edge,c=e.node(f.start);if(!c){o.forEach(w=>a.push(w));return}const h={width:d.edge.width,height:d.edge.height},v=So(e,c,o,f.start,i),g=Po(c,v,n,h.width??0),p=Co(c,g,v,n,h),b={...d.edge,...f,id:f.id,points:g,start:f.start,end:f.end,x:p.x,y:p.y,width:h.width,height:h.height,labelStyle:d.edge.labelStyle,fromCluster:s.edge.fromCluster??d.edge.fromCluster??u.edge.fromCluster,toCluster:s.edge.toCluster??d.edge.toCluster??u.edge.toCluster};delete b.selfLoop,delete b.originalEdge,a.push({edge:b,start:b.start,end:b.end})}),a},"getEdgesToRender"),mn=E(async({element:e,graph:n,diagramType:r,id:t,parentCluster:a,siteConfig:i})=>{const o=n.graph().rankdir;m.trace("Dir in recursive render - dir:",o);const{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c}=Nn(e,{edgePathsClass:"edgePaths"});n.nodes()?m.info("Recursive render XXX",n.nodes()):m.info("No nodes found for",n),n.edges().length>0&&m.info("Recursive edges",n.edge(n.edges()[0]));const h=ko(r);await Promise.all(n.nodes().map(async function(p){const b=n.node(p);if(a!==void 0){const w=JSON.parse(JSON.stringify(a.clusterData));m.trace(`Setting data for parent cluster XXX
|
|
1
|
+
import{s as ae,a as xn,c as Ln,b as Nn,f as we,e as k,i as On}from"./chunk-ZCHMQSOR.js";import{_ as E,c as kn,l as m,by as Tn,bz as Sn,aC as Pn,aB as me,ao as ye,am as Cn,ay as Rn,b7 as In}from"./mermaid.core.js";import{b as Xe,g as oe,a as jn,c as Mn,d as R,k as _n,e as An,f as Dn,h as B,i as $e,j as Ge,l as Bn,m as Ye,t as Fn,n as Ve,o as Xn,p as $n,G as N,q as l,r as L,s as A,v as P,u as U}from"./graph.js";import{C as Gn,D as Yn,v as Ee,j as Ue,E as ie,F as $,a as ee,l as Vn,S as Un,n as q,f as qe,e as qn,b as We,t as Wn,i as ne,A as se,c as zn,B as Hn}from"./isArrayLikeObject.js";import{t as Jn,a as ze,d as Kn,e as Zn,i as Qn,f as de,g as G,k as He,h as er,c as nr,b as rr}from"./_baseMerge.js";import"./app.js";import"./purify.es.js";var xe=1/0,tr=17976931348623157e292;function F(e){if(!e)return e===0?e:0;if(e=Jn(e),e===xe||e===-xe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ar(e){var n=F(e),r=n%1;return n===n?r?n-r:n:0}function I(e){var n=e==null?0:e.length;return n?Xe(e):[]}function or(e){return Gn(Yn(e,void 0,I),e+"")}var ir=Object.prototype,sr=ir.hasOwnProperty;function dr(e){var n=e.length,r=new e.constructor(n);return n&&typeof e[0]=="string"&&sr.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function ur(e,n){var r=ze(e.buffer);return new e.constructor(r,e.byteOffset,e.byteLength)}var fr=/\w*$/;function cr(e){var n=new e.constructor(e.source,fr.exec(e));return n.lastIndex=e.lastIndex,n}var Le=Ee?Ee.prototype:void 0,Ne=Le?Le.valueOf:void 0;function lr(e){return Ne?Object(Ne.call(e)):{}}var hr="[object Boolean]",pr="[object Date]",gr="[object Map]",vr="[object Number]",br="[object RegExp]",wr="[object Set]",mr="[object String]",yr="[object Symbol]",Er="[object ArrayBuffer]",xr="[object DataView]",Lr="[object Float32Array]",Nr="[object Float64Array]",Or="[object Int8Array]",kr="[object Int16Array]",Tr="[object Int32Array]",Sr="[object Uint8Array]",Pr="[object Uint8ClampedArray]",Cr="[object Uint16Array]",Rr="[object Uint32Array]";function Ir(e,n,r){var t=e.constructor;switch(n){case Er:return ze(e);case hr:case pr:return new t(+e);case xr:return ur(e);case Lr:case Nr:case Or:case kr:case Tr:case Sr:case Pr:case Cr:case Rr:return Kn(e,r);case gr:return new t;case vr:case mr:return new t(e);case br:return cr(e);case wr:return new t;case yr:return lr(e)}}var jr="[object Map]";function Mr(e){return Ue(e)&&oe(e)==jr}var Oe=$&&$.isMap,_r=Oe?ie(Oe):Mr,Ar="[object Set]";function Dr(e){return Ue(e)&&oe(e)==Ar}var ke=$&&$.isSet,Br=ke?ie(ke):Dr,Fr=1,Je="[object Arguments]",Xr="[object Array]",$r="[object Boolean]",Gr="[object Date]",Yr="[object Error]",Ke="[object Function]",Vr="[object GeneratorFunction]",Ur="[object Map]",qr="[object Number]",Ze="[object Object]",Wr="[object RegExp]",zr="[object Set]",Hr="[object String]",Jr="[object Symbol]",Kr="[object WeakMap]",Zr="[object ArrayBuffer]",Qr="[object DataView]",et="[object Float32Array]",nt="[object Float64Array]",rt="[object Int8Array]",tt="[object Int16Array]",at="[object Int32Array]",ot="[object Uint8Array]",it="[object Uint8ClampedArray]",st="[object Uint16Array]",dt="[object Uint32Array]",y={};y[Je]=y[Xr]=y[Zr]=y[Qr]=y[$r]=y[Gr]=y[et]=y[nt]=y[rt]=y[tt]=y[at]=y[Ur]=y[qr]=y[Ze]=y[Wr]=y[zr]=y[Hr]=y[Jr]=y[ot]=y[it]=y[st]=y[dt]=!0;y[Yr]=y[Ke]=y[Kr]=!1;function X(e,n,r,t,a,i){var o,s=n&Fr;if(o!==void 0)return o;if(!ee(e))return e;var d=q(e);if(d)o=dr(e);else{var u=oe(e),f=u==Ke||u==Vr;if(Vn(e))return Zn(e,s);if(u==Ze||u==Je||f&&!a)o=f?{}:Qn(e);else{if(!y[u])return a?e:{};o=Ir(e,u,s)}}i||(i=new Un);var c=i.get(e);if(c)return c;i.set(e,o),Br(e)?e.forEach(function(g){o.add(X(g,n,r,g,e,i))}):_r(e)&&e.forEach(function(g,p){o.set(p,X(g,n,r,p,e,i))});var h=Mn,v=d?void 0:h(e);return jn(v||e,function(g,p){v&&(p=g,g=e[p]),de(o,p,X(g,n,r,p,e,i))}),o}var ut=1,ft=4;function ct(e){return X(e,ut|ft)}var Qe=Object.prototype,lt=Qe.hasOwnProperty,ht=qe(function(e,n){e=Object(e);var r=-1,t=n.length,a=t>2?n[2]:void 0;for(a&&G(n[0],n[1],a)&&(t=1);++r<t;)for(var i=n[r],o=He(i),s=-1,d=o.length;++s<d;){var u=o[s],f=e[u];(f===void 0||qn(f,Qe[u])&&!lt.call(e,u))&&(e[u]=i[u])}return e});function Y(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}function pt(e){return function(n,r,t){var a=Object(n);if(!We(n)){var i=R(r);n=_n(n),r=function(s){return i(a[s],s,a)}}var o=e(n,r,t);return o>-1?a[i?n[o]:o]:void 0}}var gt=Math.max;function vt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var a=r==null?0:ar(r);return a<0&&(a=gt(t+a,0)),An(e,R(n),a)}var ue=pt(vt);function en(e,n){var r=-1,t=We(e)?Array(e.length):[];return Dn(e,function(a,i,o){t[++r]=n(a,i,o)}),t}function x(e,n){var r=q(e)?B:en;return r(e,R(n))}function bt(e,n){return e==null?e:Wn(e,$e(n),He)}function wt(e,n){return e&&Ge(e,$e(n))}function mt(e,n){return e>n}var yt=Object.prototype,Et=yt.hasOwnProperty;function xt(e,n){return e!=null&&Et.call(e,n)}function nn(e,n){return e!=null&&Bn(e,n,xt)}function rn(e,n){return e<n}function W(e,n){var r={};return n=R(n),Ge(e,function(t,a,i){er(r,a,n(t,a,i))}),r}function fe(e,n,r){for(var t=-1,a=e.length;++t<a;){var i=e[t],o=n(i);if(o!=null&&(s===void 0?o===o&&!ne(o):r(o,s)))var s=o,d=i}return d}function T(e){return e&&e.length?fe(e,se,mt):void 0}var re=nr(function(e,n,r){rr(e,n,r)});function M(e){return e&&e.length?fe(e,se,rn):void 0}function ce(e,n){return e&&e.length?fe(e,R(n),rn):void 0}function Lt(e,n,r,t){if(!ee(e))return e;n=Ye(n,e);for(var a=-1,i=n.length,o=i-1,s=e;s!=null&&++a<i;){var d=Fn(n[a]),u=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(a!=o){var f=s[d];u=void 0,u===void 0&&(u=ee(f)?f:zn(n[a+1])?[]:{})}de(s,d,u),s=s[d]}return e}function Nt(e,n,r){for(var t=-1,a=n.length,i={};++t<a;){var o=n[t],s=Ve(e,o);r(s,o)&&Lt(i,Ye(o,e),s)}return i}function Ot(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function kt(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,i=ne(e),o=n!==void 0,s=n===null,d=n===n,u=ne(n);if(!s&&!u&&!i&&e>n||i&&o&&d&&!s&&!u||t&&o&&d||!r&&d||!a)return 1;if(!t&&!i&&!u&&e<n||u&&r&&a&&!t&&!i||s&&r&&a||!o&&a||!d)return-1}return 0}function Tt(e,n,r){for(var t=-1,a=e.criteria,i=n.criteria,o=a.length,s=r.length;++t<o;){var d=kt(a[t],i[t]);if(d){if(t>=s)return d;var u=r[t];return d*(u=="desc"?-1:1)}}return e.index-n.index}function St(e,n,r){n.length?n=B(n,function(i){return q(i)?function(o){return Ve(o,i.length===1?i[0]:i)}:i}):n=[se];var t=-1;n=B(n,ie(R));var a=en(e,function(i,o,s){var d=B(n,function(u){return u(i)});return{criteria:d,index:++t,value:i}});return Ot(a,function(i,o){return Tt(i,o,r)})}function Pt(e,n){return Nt(e,n,function(r,t){return Xn(e,t)})}var V=or(function(e,n){return e==null?{}:Pt(e,n)}),Ct=Math.ceil,Rt=Math.max;function It(e,n,r,t){for(var a=-1,i=Rt(Ct((n-e)/(r||1)),0),o=Array(i);i--;)o[++a]=e,e+=r;return o}function jt(e){return function(n,r,t){return t&&typeof t!="number"&&G(n,r,t)&&(r=t=void 0),n=F(n),r===void 0?(r=n,n=0):r=F(r),t=t===void 0?n<r?1:-1:F(t),It(n,r,t)}}var C=jt(),D=qe(function(e,n){if(e==null)return[];var r=n.length;return r>1&&G(e,n[0],n[1])?n=[]:r>2&&G(n[0],n[1],n[2])&&(n=[n[0]]),St(e,Xe(n),[])}),Mt=0;function le(e){var n=++Mt;return $n(e)+n}function _t(e,n,r){for(var t=-1,a=e.length,i=n.length,o={};++t<a;){var s=t<i?n[t]:void 0;r(o,e[t],s)}return o}function At(e,n){return _t(e||[],n||[],de)}class Dt{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return Te(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&Te(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,Bt)),t=t._prev;return"["+n.join(", ")+"]"}}function Te(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Bt(e,n){if(e!=="_next"&&e!=="_prev")return n}var Ft=Hn(1);function Xt(e,n){if(e.nodeCount()<=1)return[];var r=Gt(e,n||Ft),t=$t(r.graph,r.buckets,r.zeroIdx);return I(x(t,function(a){return e.outEdges(a.v,a.w)}))}function $t(e,n,r){for(var t=[],a=n[n.length-1],i=n[0],o;e.nodeCount();){for(;o=i.dequeue();)H(e,n,r,o);for(;o=a.dequeue();)H(e,n,r,o);if(e.nodeCount()){for(var s=n.length-2;s>0;--s)if(o=n[s].dequeue(),o){t=t.concat(H(e,n,r,o,!0));break}}}return t}function H(e,n,r,t,a){var i=a?[]:void 0;return l(e.inEdges(t.v),function(o){var s=e.edge(o),d=e.node(o.v);a&&i.push({v:o.v,w:o.w}),d.out-=s,te(n,r,d)}),l(e.outEdges(t.v),function(o){var s=e.edge(o),d=o.w,u=e.node(d);u.in-=s,te(n,r,u)}),e.removeNode(t.v),i}function Gt(e,n){var r=new N,t=0,a=0;l(e.nodes(),function(s){r.setNode(s,{v:s,in:0,out:0})}),l(e.edges(),function(s){var d=r.edge(s.v,s.w)||0,u=n(s),f=d+u;r.setEdge(s.v,s.w,f),a=Math.max(a,r.node(s.v).out+=u),t=Math.max(t,r.node(s.w).in+=u)});var i=C(a+t+3).map(function(){return new Dt}),o=t+1;return l(r.nodes(),function(s){te(i,o,r.node(s))}),{graph:r,buckets:i,zeroIdx:o}}function te(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Yt(e){var n=e.graph().acyclicer==="greedy"?Xt(e,r(e)):Vt(e);l(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,le("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function Vt(e){var n=[],r={},t={};function a(i){Object.prototype.hasOwnProperty.call(t,i)||(t[i]=!0,r[i]=!0,l(e.outEdges(i),function(o){Object.prototype.hasOwnProperty.call(r,o.w)?n.push(o):a(o.w)}),delete r[i])}return l(e.nodes(),a),n}function Ut(e){l(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function j(e,n,r,t){var a;do a=le(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function qt(e){var n=new N().setGraph(e.graph());return l(e.nodes(),function(r){n.setNode(r,e.node(r))}),l(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function tn(e){var n=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),l(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Se(e,n){var r=e.x,t=e.y,a=n.x-r,i=n.y-t,o=e.width/2,s=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var d,u;return Math.abs(i)*o>Math.abs(a)*s?(i<0&&(s=-s),d=s*a/i,u=s):(a<0&&(o=-o),d=o,u=o*i/a),{x:r+d,y:t+u}}function z(e){var n=x(C(an(e)+1),function(){return[]});return l(e.nodes(),function(r){var t=e.node(r),a=t.rank;L(a)||(n[a][t.order]=r)}),n}function Wt(e){var n=M(x(e.nodes(),function(r){return e.node(r).rank}));l(e.nodes(),function(r){var t=e.node(r);nn(t,"rank")&&(t.rank-=n)})}function zt(e){var n=M(x(e.nodes(),function(i){return e.node(i).rank})),r=[];l(e.nodes(),function(i){var o=e.node(i).rank-n;r[o]||(r[o]=[]),r[o].push(i)});var t=0,a=e.graph().nodeRankFactor;l(r,function(i,o){L(i)&&o%a!==0?--t:t&&l(i,function(s){e.node(s).rank+=t})})}function Pe(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),j(e,"border",a,n)}function an(e){return T(x(e.nodes(),function(n){var r=e.node(n).rank;if(!L(r))return r}))}function Ht(e,n){var r={lhs:[],rhs:[]};return l(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Jt(e,n){return n()}function Kt(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&l(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,o=a.maxRank+1;i<o;++i)Ce(e,"borderLeft","_bl",r,a,i),Ce(e,"borderRight","_br",r,a,i)}}l(e.children(),n)}function Ce(e,n,r,t,a,i){var o={width:0,height:0,rank:i,borderType:n},s=a[n][i-1],d=j(e,"border",o,r);a[n][i]=d,e.setParent(d,t),s&&e.setEdge(s,d,{weight:1})}function Zt(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&on(e)}function Qt(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&ea(e),(n==="lr"||n==="rl")&&(na(e),on(e))}function on(e){l(e.nodes(),function(n){Re(e.node(n))}),l(e.edges(),function(n){Re(e.edge(n))})}function Re(e){var n=e.width;e.width=e.height,e.height=n}function ea(e){l(e.nodes(),function(n){J(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,J),Object.prototype.hasOwnProperty.call(r,"y")&&J(r)})}function J(e){e.y=-e.y}function na(e){l(e.nodes(),function(n){K(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,K),Object.prototype.hasOwnProperty.call(r,"x")&&K(r)})}function K(e){var n=e.x;e.x=e.y,e.y=n}function ra(e){e.graph().dummyChains=[],l(e.edges(),function(n){ta(e,n)})}function ta(e,n){var r=n.v,t=e.node(r).rank,a=n.w,i=e.node(a).rank,o=n.name,s=e.edge(n),d=s.labelRank;if(i!==t+1){e.removeEdge(n);var u=void 0,f,c;for(c=0,++t;t<i;++c,++t)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:n,rank:t},f=j(e,"edge",u,"_d"),t===d&&(u.width=s.width,u.height=s.height,u.dummy="edge-label",u.labelpos=s.labelpos),e.setEdge(r,f,{weight:s.weight},o),c===0&&e.graph().dummyChains.push(f),r=f;e.setEdge(r,a,{weight:s.weight},o)}}function aa(e){l(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function he(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var i=M(x(e.outEdges(t),function(o){return r(o.w)-e.edge(o).minlen}));return(i===Number.POSITIVE_INFINITY||i===void 0||i===null)&&(i=0),a.rank=i}l(e.sources(),r)}function _(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function sn(e){var n=new N({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,i;oa(n,e)<t;)a=ia(n,e),i=n.hasNode(a.v)?_(e,a):-_(e,a),sa(n,e,i);return n}function oa(e,n){function r(t){l(n.nodeEdges(t),function(a){var i=a.v,o=t===i?a.w:i;!e.hasNode(o)&&!_(n,a)&&(e.setNode(o,{}),e.setEdge(t,o,{}),r(o))})}return l(e.nodes(),r),e.nodeCount()}function ia(e,n){return ce(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return _(n,r)})}function sa(e,n,r){l(e.nodes(),function(t){n.node(t).rank+=r})}function da(){}da.prototype=new Error;function dn(e,n,r){q(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],i={};return l(n,function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);un(e,o,r==="post",i,t,a)}),a}function un(e,n,r,t,a,i){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||i.push(n),l(a(n),function(o){un(e,o,r,t,a,i)}),r&&i.push(n))}function ua(e,n){return dn(e,n,"post")}function fa(e,n){return dn(e,n,"pre")}S.initLowLimValues=ge;S.initCutValues=pe;S.calcCutValue=fn;S.leaveEdge=ln;S.enterEdge=hn;S.exchangeEdges=pn;function S(e){e=qt(e),he(e);var n=sn(e);ge(n),pe(n,e);for(var r,t;r=ln(n);)t=hn(n,e,r),pn(n,e,r,t)}function pe(e,n){var r=ua(e,e.nodes());r=r.slice(0,r.length-1),l(r,function(t){ca(e,n,t)})}function ca(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=fn(e,n,r)}function fn(e,n,r){var t=e.node(r),a=t.parent,i=!0,o=n.edge(r,a),s=0;return o||(i=!1,o=n.edge(a,r)),s=o.weight,l(n.nodeEdges(r),function(d){var u=d.v===r,f=u?d.w:d.v;if(f!==a){var c=u===i,h=n.edge(d).weight;if(s+=c?h:-h,ha(e,r,f)){var v=e.edge(r,f).cutvalue;s+=c?-v:v}}}),s}function ge(e,n){arguments.length<2&&(n=e.nodes()[0]),cn(e,{},1,n)}function cn(e,n,r,t,a){var i=r,o=e.node(t);return n[t]=!0,l(e.neighbors(t),function(s){Object.prototype.hasOwnProperty.call(n,s)||(r=cn(e,n,r,s,t))}),o.low=i,o.lim=r++,a?o.parent=a:delete o.parent,r}function ln(e){return ue(e.edges(),function(n){return e.edge(n).cutvalue<0})}function hn(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var i=e.node(t),o=e.node(a),s=i,d=!1;i.lim>o.lim&&(s=o,d=!0);var u=A(n.edges(),function(f){return d===Ie(e,e.node(f.v),s)&&d!==Ie(e,e.node(f.w),s)});return ce(u,function(f){return _(n,f)})}function pn(e,n,r,t){var a=r.v,i=r.w;e.removeEdge(a,i),e.setEdge(t.v,t.w,{}),ge(e),pe(e,n),la(e,n)}function la(e,n){var r=ue(e.nodes(),function(a){return!n.node(a).parent}),t=fa(e,r);t=t.slice(1),l(t,function(a){var i=e.node(a).parent,o=n.edge(a,i),s=!1;o||(o=n.edge(i,a),s=!0),n.node(a).rank=n.node(i).rank+(s?o.minlen:-o.minlen)})}function ha(e,n,r){return e.hasEdge(n,r)}function Ie(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function pa(e){switch(e.graph().ranker){case"network-simplex":je(e);break;case"tight-tree":va(e);break;case"longest-path":ga(e);break;default:je(e)}}var ga=he;function va(e){he(e),sn(e)}function je(e){S(e)}function ba(e){var n=j(e,"root",{},"_root"),r=wa(e),t=T(P(r))-1,a=2*t+1;e.graph().nestingRoot=n,l(e.edges(),function(o){e.edge(o).minlen*=a});var i=ma(e)+1;l(e.children(),function(o){gn(e,n,a,i,t,r,o)}),e.graph().nodeRankFactor=a}function gn(e,n,r,t,a,i,o){var s=e.children(o);if(!s.length){o!==n&&e.setEdge(n,o,{weight:0,minlen:r});return}var d=Pe(e,"_bt"),u=Pe(e,"_bb"),f=e.node(o);e.setParent(d,o),f.borderTop=d,e.setParent(u,o),f.borderBottom=u,l(s,function(c){gn(e,n,r,t,a,i,c);var h=e.node(c),v=h.borderTop?h.borderTop:c,g=h.borderBottom?h.borderBottom:c,p=h.borderTop?t:2*t,b=v!==g?1:a-i[o]+1;e.setEdge(d,v,{weight:p,minlen:b,nestingEdge:!0}),e.setEdge(g,u,{weight:p,minlen:b,nestingEdge:!0})}),e.parent(o)||e.setEdge(n,d,{weight:0,minlen:a+i[o]})}function wa(e){var n={};function r(t,a){var i=e.children(t);i&&i.length&&l(i,function(o){r(o,a+1)}),n[t]=a}return l(e.children(),function(t){r(t,1)}),n}function ma(e){return U(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function ya(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,l(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Ea(e,n,r){var t={},a;l(r,function(i){for(var o=e.parent(i),s,d;o;){if(s=e.parent(o),s?(d=t[s],t[s]=o):(d=a,a=o),d&&d!==o){n.setEdge(d,o);return}o=s}})}function xa(e,n,r){var t=La(e),a=new N({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(i){return e.node(i)});return l(e.nodes(),function(i){var o=e.node(i),s=e.parent(i);(o.rank===n||o.minRank<=n&&n<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||t),l(e[r](i),function(d){var u=d.v===i?d.w:d.v,f=a.edge(u,i),c=L(f)?0:f.weight;a.setEdge(u,i,{weight:e.edge(d).weight+c})}),Object.prototype.hasOwnProperty.call(o,"minRank")&&a.setNode(i,{borderLeft:o.borderLeft[n],borderRight:o.borderRight[n]}))}),a}function La(e){for(var n;e.hasNode(n=le("_root")););return n}function Na(e,n){for(var r=0,t=1;t<n.length;++t)r+=Oa(e,n[t-1],n[t]);return r}function Oa(e,n,r){for(var t=At(r,x(r,function(u,f){return f})),a=I(x(n,function(u){return D(x(e.outEdges(u),function(f){return{pos:t[f.w],weight:e.edge(f).weight}}),"pos")})),i=1;i<r.length;)i<<=1;var o=2*i-1;i-=1;var s=x(new Array(o),function(){return 0}),d=0;return l(a.forEach(function(u){var f=u.pos+i;s[f]+=u.weight;for(var c=0;f>0;)f%2&&(c+=s[f+1]),f=f-1>>1,s[f]+=u.weight;d+=u.weight*c})),d}function ka(e){var n={},r=A(e.nodes(),function(s){return!e.children(s).length}),t=T(x(r,function(s){return e.node(s).rank})),a=x(C(t+1),function(){return[]});function i(s){if(!nn(n,s)){n[s]=!0;var d=e.node(s);a[d.rank].push(s),l(e.successors(s),i)}}var o=D(r,function(s){return e.node(s).rank});return l(o,i),a}function Ta(e,n){return x(n,function(r){var t=e.inEdges(r);if(t.length){var a=U(t,function(i,o){var s=e.edge(o),d=e.node(o.v);return{sum:i.sum+s.weight*d.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function Sa(e,n){var r={};l(e,function(a,i){var o=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};L(a.barycenter)||(o.barycenter=a.barycenter,o.weight=a.weight)}),l(n.edges(),function(a){var i=r[a.v],o=r[a.w];!L(i)&&!L(o)&&(o.indegree++,i.out.push(r[a.w]))});var t=A(r,function(a){return!a.indegree});return Pa(t)}function Pa(e){var n=[];function r(i){return function(o){o.merged||(L(o.barycenter)||L(i.barycenter)||o.barycenter>=i.barycenter)&&Ca(i,o)}}function t(i){return function(o){o.in.push(i),--o.indegree===0&&e.push(o)}}for(;e.length;){var a=e.pop();n.push(a),l(a.in.reverse(),r(a)),l(a.out,t(a))}return x(A(n,function(i){return!i.merged}),function(i){return V(i,["vs","i","barycenter","weight"])})}function Ca(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function Ra(e,n){var r=Ht(e,function(f){return Object.prototype.hasOwnProperty.call(f,"barycenter")}),t=r.lhs,a=D(r.rhs,function(f){return-f.i}),i=[],o=0,s=0,d=0;t.sort(Ia(!!n)),d=Me(i,a,d),l(t,function(f){d+=f.vs.length,i.push(f.vs),o+=f.barycenter*f.weight,s+=f.weight,d=Me(i,a,d)});var u={vs:I(i)};return s&&(u.barycenter=o/s,u.weight=s),u}function Me(e,n,r){for(var t;n.length&&(t=Y(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ia(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function vn(e,n,r,t){var a=e.children(n),i=e.node(n),o=i?i.borderLeft:void 0,s=i?i.borderRight:void 0,d={};o&&(a=A(a,function(g){return g!==o&&g!==s}));var u=Ta(e,a);l(u,function(g){if(e.children(g.v).length){var p=vn(e,g.v,r,t);d[g.v]=p,Object.prototype.hasOwnProperty.call(p,"barycenter")&&Ma(g,p)}});var f=Sa(u,r);ja(f,d);var c=Ra(f,t);if(o&&(c.vs=I([o,c.vs,s]),e.predecessors(o).length)){var h=e.node(e.predecessors(o)[0]),v=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+h.order+v.order)/(c.weight+2),c.weight+=2}return c}function ja(e,n){l(e,function(r){r.vs=I(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Ma(e,n){L(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function _a(e){var n=an(e),r=_e(e,C(1,n+1),"inEdges"),t=_e(e,C(n-1,-1,-1),"outEdges"),a=ka(e);Ae(e,a);for(var i=Number.POSITIVE_INFINITY,o,s=0,d=0;d<4;++s,++d){Aa(s%2?r:t,s%4>=2),a=z(e);var u=Na(e,a);u<i&&(d=0,o=ct(a),i=u)}Ae(e,o)}function _e(e,n,r){return x(n,function(t){return xa(e,t,r)})}function Aa(e,n){var r=new N;l(e,function(t){var a=t.graph().root,i=vn(t,a,r,n);l(i.vs,function(o,s){t.node(o).order=s}),Ea(t,r,i.vs)})}function Ae(e,n){l(n,function(r){l(r,function(t,a){e.node(t).order=a})})}function Da(e){var n=Fa(e);l(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,i=Ba(e,n,a.v,a.w),o=i.path,s=i.lca,d=0,u=o[d],f=!0;r!==a.w;){if(t=e.node(r),f){for(;(u=o[d])!==s&&e.node(u).maxRank<t.rank;)d++;u===s&&(f=!1)}if(!f){for(;d<o.length-1&&e.node(u=o[d+1]).minRank<=t.rank;)d++;u=o[d]}e.setParent(r,u),r=e.successors(r)[0]}})}function Ba(e,n,r,t){var a=[],i=[],o=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim),d,u;d=r;do d=e.parent(d),a.push(d);while(d&&(n[d].low>o||s>n[d].lim));for(u=d,d=t;(d=e.parent(d))!==u;)i.push(d);return{path:a.concat(i.reverse()),lca:u}}function Fa(e){var n={},r=0;function t(a){var i=r;l(e.children(a),t),n[a]={low:i,lim:r++}}return l(e.children(),t),n}function Xa(e,n){var r={};function t(a,i){var o=0,s=0,d=a.length,u=Y(i);return l(i,function(f,c){var h=Ga(e,f),v=h?e.node(h).order:d;(h||f===u)&&(l(i.slice(s,c+1),function(g){l(e.predecessors(g),function(p){var b=e.node(p),w=b.order;(w<o||v<w)&&!(b.dummy&&e.node(g).dummy)&&bn(r,p,g)})}),s=c+1,o=v)}),i}return U(n,t),r}function $a(e,n){var r={};function t(i,o,s,d,u){var f;l(C(o,s),function(c){f=i[c],e.node(f).dummy&&l(e.predecessors(f),function(h){var v=e.node(h);v.dummy&&(v.order<d||v.order>u)&&bn(r,h,f)})})}function a(i,o){var s=-1,d,u=0;return l(o,function(f,c){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(d=e.node(h[0]).order,t(o,u,c,s,d),u=c,s=d)}t(o,u,o.length,d,i.length)}),o}return U(n,a),r}function Ga(e,n){if(e.node(n).dummy)return ue(e.predecessors(n),function(r){return e.node(r).dummy})}function bn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ya(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function Va(e,n,r,t){var a={},i={},o={};return l(n,function(s){l(s,function(d,u){a[d]=d,i[d]=d,o[d]=u})}),l(n,function(s){var d=-1;l(s,function(u){var f=t(u);if(f.length){f=D(f,function(p){return o[p]});for(var c=(f.length-1)/2,h=Math.floor(c),v=Math.ceil(c);h<=v;++h){var g=f[h];i[u]===u&&d<o[g]&&!Ya(r,u,g)&&(i[g]=u,i[u]=a[u]=a[g],d=o[g])}}})}),{root:a,align:i}}function Ua(e,n,r,t,a){var i={},o=qa(e,n,r,a),s=a?"borderLeft":"borderRight";function d(c,h){for(var v=o.nodes(),g=v.pop(),p={};g;)p[g]?c(g):(p[g]=!0,v.push(g),v=v.concat(h(g))),g=v.pop()}function u(c){i[c]=o.inEdges(c).reduce(function(h,v){return Math.max(h,i[v.v]+o.edge(v))},0)}function f(c){var h=o.outEdges(c).reduce(function(g,p){return Math.min(g,i[p.w]-o.edge(p))},Number.POSITIVE_INFINITY),v=e.node(c);h!==Number.POSITIVE_INFINITY&&v.borderType!==s&&(i[c]=Math.max(i[c],h))}return d(u,o.predecessors.bind(o)),d(f,o.successors.bind(o)),l(t,function(c){i[c]=i[r[c]]}),i}function qa(e,n,r,t){var a=new N,i=e.graph(),o=Ka(i.nodesep,i.edgesep,t);return l(n,function(s){var d;l(s,function(u){var f=r[u];if(a.setNode(f),d){var c=r[d],h=a.edge(c,f);a.setEdge(c,f,Math.max(o(e,u,d),h||0))}d=u})}),a}function Wa(e,n){return ce(P(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return bt(r,function(i,o){var s=Za(e,o)/2;t=Math.max(i+s,t),a=Math.min(i-s,a)}),t-a})}function za(e,n){var r=P(n),t=M(r),a=T(r);l(["u","d"],function(i){l(["l","r"],function(o){var s=i+o,d=e[s],u;if(d!==n){var f=P(d);u=o==="l"?t-M(f):a-T(f),u&&(e[s]=W(d,function(c){return c+u}))}})})}function Ha(e,n){return W(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=D(x(e,t));return(a[1]+a[2])/2})}function Ja(e){var n=z(e),r=re(Xa(e,n),$a(e,n)),t={},a;l(["u","d"],function(o){a=o==="u"?n:P(n).reverse(),l(["l","r"],function(s){s==="r"&&(a=x(a,function(c){return P(c).reverse()}));var d=(o==="u"?e.predecessors:e.successors).bind(e),u=Va(e,a,r,d),f=Ua(e,a,u.root,u.align,s==="r");s==="r"&&(f=W(f,function(c){return-c})),t[o+s]=f})});var i=Wa(e,t);return za(t,i),Ha(t,e.graph().align)}function Ka(e,n,r){return function(t,a,i){var o=t.node(a),s=t.node(i),d=0,u;if(d+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=-o.width/2;break;case"r":u=o.width/2;break}if(u&&(d+=r?u:-u),u=0,d+=(o.dummy?n:e)/2,d+=(s.dummy?n:e)/2,d+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(d+=r?u:-u),u=0,d}}function Za(e,n){return e.node(n).width}function Qa(e){e=tn(e),eo(e),wt(Ja(e),function(n,r){e.node(r).x=n})}function eo(e){var n=z(e),r=e.graph().ranksep,t=0;l(n,function(a){var i=T(x(a,function(o){return e.node(o).height}));l(a,function(o){e.node(o).y=t+i/2}),t+=i+r})}function no(e,n){var r=Jt;r("layout",()=>{var t=r(" buildLayoutGraph",()=>ho(e));r(" runLayout",()=>ro(t,r)),r(" updateInputGraph",()=>to(e,t))})}function ro(e,n){n(" makeSpaceForEdgeLabels",()=>po(e)),n(" removeSelfEdges",()=>Lo(e)),n(" acyclic",()=>Yt(e)),n(" nestingGraph.run",()=>ba(e)),n(" rank",()=>pa(tn(e))),n(" injectEdgeLabelProxies",()=>go(e)),n(" removeEmptyRanks",()=>zt(e)),n(" nestingGraph.cleanup",()=>ya(e)),n(" normalizeRanks",()=>Wt(e)),n(" assignRankMinMax",()=>vo(e)),n(" removeEdgeLabelProxies",()=>bo(e)),n(" normalize.run",()=>ra(e)),n(" parentDummyChains",()=>Da(e)),n(" addBorderSegments",()=>Kt(e)),n(" order",()=>_a(e)),n(" insertSelfEdges",()=>No(e)),n(" adjustCoordinateSystem",()=>Zt(e)),n(" position",()=>Qa(e)),n(" positionSelfEdges",()=>Oo(e)),n(" removeBorderNodes",()=>xo(e)),n(" normalize.undo",()=>aa(e)),n(" fixupEdgeLabelCoords",()=>yo(e)),n(" undoCoordinateSystem",()=>Qt(e)),n(" translateGraph",()=>wo(e)),n(" assignNodeIntersects",()=>mo(e)),n(" reversePoints",()=>Eo(e)),n(" acyclic.undo",()=>Ut(e))}function to(e,n){l(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),l(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var ao=["nodesep","edgesep","ranksep","marginx","marginy"],oo={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},io=["acyclicer","ranker","rankdir","align"],so=["width","height"],uo={width:0,height:0},fo=["minlen","weight","width","height","labeloffset"],co={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lo=["labelpos"];function ho(e){var n=new N({multigraph:!0,compound:!0}),r=Q(e.graph());return n.setGraph(re({},oo,Z(r,ao),V(r,io))),l(e.nodes(),function(t){var a=Q(e.node(t));n.setNode(t,ht(Z(a,so),uo)),n.setParent(t,e.parent(t))}),l(e.edges(),function(t){var a=Q(e.edge(t));n.setEdge(t,re({},co,Z(a,fo),V(a,lo)))}),n}function po(e){var n=e.graph();n.ranksep/=2,l(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function go(e){l(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),i={rank:(a.rank-t.rank)/2+t.rank,e:n};j(e,"edge-proxy",i,"_ep")}})}function vo(e){var n=0;l(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=T(n,t.maxRank))}),e.graph().maxRank=n}function bo(e){l(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function wo(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,i=e.graph(),o=i.marginx||0,s=i.marginy||0;function d(u){var f=u.x,c=u.y,h=u.width,v=u.height;n=Math.min(n,f-h/2),r=Math.max(r,f+h/2),t=Math.min(t,c-v/2),a=Math.max(a,c+v/2)}l(e.nodes(),function(u){d(e.node(u))}),l(e.edges(),function(u){var f=e.edge(u);Object.prototype.hasOwnProperty.call(f,"x")&&d(f)}),n-=o,t-=s,l(e.nodes(),function(u){var f=e.node(u);f.x-=n,f.y-=t}),l(e.edges(),function(u){var f=e.edge(u);l(f.points,function(c){c.x-=n,c.y-=t}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=n),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=t)}),i.width=r-n+o,i.height=a-t+s}function mo(e){l(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),i,o;r.points?(i=r.points[0],o=r.points[r.points.length-1]):(r.points=[],i=a,o=t),r.points.unshift(Se(t,i)),r.points.push(Se(a,o))})}function yo(e){l(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Eo(e){l(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function xo(e){l(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),i=e.node(Y(r.borderLeft)),o=e.node(Y(r.borderRight));r.width=Math.abs(o.x-i.x),r.height=Math.abs(a.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}}),l(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Lo(e){l(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function No(e){var n=z(e);l(n,function(r){var t=0;l(r,function(a,i){var o=e.node(a);o.order=i+t,l(o.selfEdges,function(s){j(e,"selfedge",{width:s.label.width,height:s.label.height,rank:o.rank,order:i+ ++t,e:s.e,label:s.label},"_se")}),delete o.selfEdges})})}function Oo(e){l(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,i=t.y,o=r.x-a,s=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*o/3,y:i-s},{x:a+5*o/6,y:i-s},{x:a+o,y:i},{x:a+5*o/6,y:i+s},{x:a+2*o/3,y:i+s}],r.label.x=r.x,r.label.y=r.y}})}function Z(e,n){return W(V(e,n),Number)}function Q(e){var n={};return l(e,function(r,t){n[t.toLowerCase()]=r}),n}var De=E((e,n,r)=>Math.max(n,Math.min(r,e)),"clamp"),Be=E((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),ko=E(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram"||e==="er"||e==="classDiagram","shouldMergeSelfLoopSegments"),To=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],So=E((e,n,r,t,a)=>{const i=[],o=new Set;if(r.forEach(({start:f,end:c})=>{f!==t&&o.add(f),c!==t&&o.add(c)}),o.forEach(f=>{const c=e.node(f);typeof c?.x=="number"&&typeof c?.y=="number"&&i.push(c)}),i.length===0&&r.forEach(({edge:f})=>{(f.points??[]).forEach(c=>{typeof c?.x=="number"&&typeof c?.y=="number"&&i.push(c)})}),i.length===0)return Be(a);const s=i.reduce((f,c)=>({x:f.x+c.x/i.length,y:f.y+c.y/i.length}),{x:0,y:0}),d=s.x-n.x,u=s.y-n.y;return Math.abs(d)>Math.abs(u)?d>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":Be(a)},"getSelfLoopSide"),Po=E((e,n="top",r=0,t=0)=>{const a=e.x,i=e.y-r,o=e.width/2,s=e.height/2,d=Math.max(36,Math.min(100,e.width*.8)),u=De(Math.max(t,e.width*.35),36,d),f=De(Math.min(e.width,e.height)*.45,24,48);switch(n){case"bottom":{const c=i+s;return[{x:a-u/2,y:c},{x:a-u/2,y:c+f},{x:a+u/2,y:c+f},{x:a+u/2,y:c}]}case"right":{const c=a+o;return[{x:c,y:i-u/2},{x:c+f,y:i-u/2},{x:c+f,y:i+u/2},{x:c,y:i+u/2}]}case"left":{const c=a-o;return[{x:c,y:i-u/2},{x:c-f,y:i-u/2},{x:c-f,y:i+u/2},{x:c,y:i+u/2}]}default:{const c=i-s;return[{x:a-u/2,y:c},{x:a-u/2,y:c-f},{x:a+u/2,y:c-f},{x:a+u/2,y:c}]}}},"getSelfLoopPoints"),Co=E((e,n,r="top",t=0,a={})=>{const o=e.x,s=e.y-t,d=a.width??0,u=a.height??0;switch(r){case"bottom":return{x:o,y:Math.max(...n.map(f=>f.y))+u/2+4};case"right":return{x:Math.max(...n.map(f=>f.x))+d/2+4,y:s};case"left":return{x:Math.min(...n.map(f=>f.x))-d/2-4,y:s};default:return{x:o,y:Math.min(...n.map(f=>f.y))-u/2-4}}},"getSelfLoopLabelPosition"),wn=E((e,n=0,{mergeSelfLoops:r=!0}={})=>{const t=new Map,a=[],i=e.graph()?.rankdir;return e.edges().forEach(o=>{const s=e.edge(o);if(r&&s.selfLoop){const d=s.selfLoop.id;t.has(d)||t.set(d,[]),t.get(d).push({edge:s,start:o.v,end:o.w})}else a.push({edge:s,start:o.v,end:o.w})}),t.forEach(o=>{if(o.length!==3){o.forEach(w=>a.push(w));return}o.sort((w,O)=>w.edge.selfLoop.order-O.edge.selfLoop.order);const[s,d,u]=o,f=s.edge.originalEdge??d.edge.originalEdge??u.edge.originalEdge??d.edge,c=e.node(f.start);if(!c){o.forEach(w=>a.push(w));return}const h={width:d.edge.width,height:d.edge.height},v=So(e,c,o,f.start,i),g=Po(c,v,n,h.width??0),p=Co(c,g,v,n,h),b={...d.edge,...f,id:f.id,points:g,start:f.start,end:f.end,x:p.x,y:p.y,width:h.width,height:h.height,labelStyle:d.edge.labelStyle,fromCluster:s.edge.fromCluster??d.edge.fromCluster??u.edge.fromCluster,toCluster:s.edge.toCluster??d.edge.toCluster??u.edge.toCluster};delete b.selfLoop,delete b.originalEdge,a.push({edge:b,start:b.start,end:b.end})}),a},"getEdgesToRender"),mn=E(async({element:e,graph:n,diagramType:r,id:t,parentCluster:a,siteConfig:i})=>{const o=n.graph().rankdir;m.trace("Dir in recursive render - dir:",o);const{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c}=Nn(e,{edgePathsClass:"edgePaths"});n.nodes()?m.info("Recursive render XXX",n.nodes()):m.info("No nodes found for",n),n.edges().length>0&&m.info("Recursive edges",n.edge(n.edges()[0]));const h=ko(r);await Promise.all(n.nodes().map(async function(p){const b=n.node(p);if(a!==void 0){const w=JSON.parse(JSON.stringify(a.clusterData));m.trace(`Setting data for parent cluster XXX
|
|
2
2
|
Node.id = `,p,`
|
|
3
3
|
data=`,w.height,`
|
|
4
|
-
Parent cluster`,a.height),n.setNode(a.id,w),n.parent(p)||(m.trace("Setting parent",p,a.id),n.setParent(p,a.id,w))}if(m.info("(Insert) Node XXX"+p+": "+JSON.stringify(n.node(p))),b?.clusterNode){m.info("Cluster identified XBX",p,b.width,n.node(p));const{ranksep:w,nodesep:O}=n.graph();b.graph.setGraph({...b.graph.graph(),ranksep:w+25,nodesep:O});const ve=await _o({element:f,graph:b.graph,diagramType:r,id:t,parentCluster:n.node(p),siteConfig:i}),be=ve.elem;Tn(b,be),b.diff=ve.diff||0,m.info("New compound node after recursive render XAX",p,"width",b.width,"height",b.height),Sn(be,b)}else n.children(p).length>0?(m.trace("Cluster - the non recursive path XBX",p,b.id,b,b.width,"Graph:",n),m.trace(we(b.id,n)),k.set(b.id,{id:we(b.id,n),node:b})):(m.trace("Node - the non recursive path XAX",p,f,n.node(p),o),await On(f,n.node(p),{config:i,dir:o}))})),await E(async()=>{const p=n.edges().map(async function(b){const w=n.edge(b.v,b.w,b.name);if(m.info("Edge "+b.v+" -> "+b.w+": "+JSON.stringify(b)),m.info("Edge "+b.v+" -> "+b.w+": ",b," ",JSON.stringify(n.edge(b))),m.info("Fix",k,"ids:",b.v,b.w,"Translating: ",k.get(b.v),k.get(b.w)),h&&w.selfLoop){if(w.selfLoop.order!==1)return;const O={...w.originalEdge,...w,id:w.selfLoop.id,startLabelLeft:w.originalEdge?.startLabelLeft??w.startLabelLeft,startLabelRight:w.originalEdge?.startLabelRight??w.startLabelRight,endLabelLeft:w.originalEdge?.endLabelLeft??w.endLabelLeft,endLabelRight:w.originalEdge?.endLabelRight??w.endLabelRight};await me(u,O),w.width=O.width,w.height=O.height,w.labelStyle=O.labelStyle;return}await me(u,w)});await Promise.all(p)},"processEdges")();const{subGraphTitleTotalMargin:g}=Pn(i);return{elem:c,graph:n,groups:{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c},diagramType:r,id:t,mergeSelfLoops:h,subGraphTitleTotalMargin:g}},"measureDagreGraph"),yn=E(e=>{m.info("############################################# XXX"),m.info("### Layout ### XXX"),m.info("############################################# XXX"),no(e)},"runDagreGraphLayout"),Ro=E((e,n,r)=>{const t=e.node(n);if(!t)return;const a={...t};return t?.clusterNode?a.y=(t.y??0)+r:e.children(n).length>0?a.height=(t.height??0)+r:a.y=(t.y??0)+r/2,a},"normalizeDagreNode"),Fe=E((e,n)=>{To.forEach(r=>{n[r]!==void 0&&(e[r]=n[r])})},"applyDagreNodeLayout"),Io=E((e,n,r,t)=>({...e,start:e.start??n,end:e.end??r,points:(e.points??[]).map(a=>({...a,y:typeof a.y=="number"?a.y+t:a.y}))}),"normalizeDagreEdge"),jo=E((e,n)=>{const{graph:r,mergeSelfLoops:t,subGraphTitleTotalMargin:a=0}=n,i=new Map(e.nodes.map(s=>[s.id,s]));ae(r).forEach(s=>{const d=Ro(r,s,a);if(!d)return;Fe(r.node(s),d);const u=i.get(s);u&&Fe(u,d)});const o=a/2;return e.edges=wn(r,o,{mergeSelfLoops:t}).map(({edge:s,start:d,end:u})=>Io(s,d,u,o)),e},"applyDagreLayoutResult"),Mo=E(async({elem:e,graph:n,groups:{clusters:r,edgePaths:t},diagramType:a,id:i,mergeSelfLoops:o,subGraphTitleTotalMargin:s})=>{let d=0;await Promise.all(ae(n).map(async function(c){const h=n.node(c);if(m.info("Position XBX => "+c+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=s,m.info("A tainted cluster node XBX1",c,h.id,h.width,h.height,h.x,h.y,n.parent(c)),k.get(h.id).node=h,ye(h);else if(n.children(c).length>0){m.info("A pure cluster node XBX1",c,h.id,h.x,h.y,h.width,h.height,n.parent(c)),h.height+=s,n.node(h.parentId);const v=h?.padding/2||0,g=h?.labelBBox?.height||0,p=g-v||0;m.debug("OffsetY",p,"labelHeight",g,"halfPadding",v),await Cn(r,h),k.get(h.id).node=h}else{const v=n.node(h.parentId);h.y+=s/2,m.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",v,v?.offsetY,h),ye(h)}}));const u=s/2;return wn(n,u,{mergeSelfLoops:o}).forEach(function({edge:c,start:h,end:v}){m.info("Edge "+h+" -> "+v+": "+JSON.stringify(c),c),c.points.forEach(w=>w.y+=u);const g=n.node(h),p=n.node(v),b=Rn(t,c,k,a,g,p,i);In(c,b)}),n.nodes().forEach(function(c){const h=n.node(c);m.info(c,h.type,h.diff),h.isGroup&&(d=h.diff)}),m.warn("Returning from recursive render XAX",e,d),{elem:e,diff:d}},"paintDagreLayoutCore"),_o=E(async e=>{const n=await mn(e);return yn(n.graph),await Mo(n)},"renderDagreSubgraph"),En=E(e=>{const n=new N({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(r=>{n.setNode(r.id,{...r}),r.parentId&&n.setParent(r.id,r.parentId)}),m.debug("Edges:",e.edges),e.edges.forEach(r=>{if(r.start===r.end){const t=r.start,a=t+"---"+t+"---1",i=t+"---"+t+"---2",o=n.node(t);n.setNode(a,{domId:a,id:a,parentId:o.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(a,o.parentId),n.setNode(i,{domId:i,id:i,parentId:o.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(i,o.parentId);const s=structuredClone(r),d=structuredClone(r),u=structuredClone(r),f=structuredClone(r);d.originalEdge=s,d.selfLoop={id:s.id,order:0},u.originalEdge=s,u.selfLoop={id:s.id,order:1},f.originalEdge=s,f.selfLoop={id:s.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=t+"-cyclic-special-1",u.startLabelRight="",u.startLabelLeft="",u.endLabelLeft="",u.endLabelRight="",u.arrowTypeStart="none",u.arrowTypeEnd="none",u.id=t+"-cyclic-special-mid",f.label="",f.startLabelRight="",f.startLabelLeft="",f.arrowTypeStart="none",o.isGroup&&(d.fromCluster=t,f.toCluster=t),f.id=t+"-cyclic-special-2",f.arrowTypeStart="none",n.setEdge(t,a,d,t+"-cyclic-special-0"),n.setEdge(a,i,u,t+"-cyclic-special-1"),n.setEdge(i,t,f,t+"-cyclic-special-2")}else n.setEdge(r.start,r.end,{...r},r.id)}),xn(n),{graph:n}},"prepareLayoutForDagre"),Ao=E(async(e,{element:n,preparedLayout:r})=>{const t=r??En(e),a=kn(),i=await mn({element:n,graph:t.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return t.measuredLayout=i,i},"measureDagreLayout"),Do=E((e,n)=>{const r=n.preparedLayout?.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return yn(r.graph),jo(e,r),r},"runDagreLayoutCore"),Bo=E((e,{measure:n})=>ae(n.graph).map(r=>n.graph.node(r)).filter(Boolean),"getDagrePaintNodes"),Fo=E((e,n,{measure:r})=>e?r.graph.node(e):void 0,"getDagreEdgeNode"),
|
|
4
|
+
Parent cluster`,a.height),n.setNode(a.id,w),n.parent(p)||(m.trace("Setting parent",p,a.id),n.setParent(p,a.id,w))}if(m.info("(Insert) Node XXX"+p+": "+JSON.stringify(n.node(p))),b?.clusterNode){m.info("Cluster identified XBX",p,b.width,n.node(p));const{ranksep:w,nodesep:O}=n.graph();b.graph.setGraph({...b.graph.graph(),ranksep:w+25,nodesep:O});const ve=await _o({element:f,graph:b.graph,diagramType:r,id:t,parentCluster:n.node(p),siteConfig:i}),be=ve.elem;Tn(b,be),b.diff=ve.diff||0,m.info("New compound node after recursive render XAX",p,"width",b.width,"height",b.height),Sn(be,b)}else n.children(p).length>0?(m.trace("Cluster - the non recursive path XBX",p,b.id,b,b.width,"Graph:",n),m.trace(we(b.id,n)),k.set(b.id,{id:we(b.id,n),node:b})):(m.trace("Node - the non recursive path XAX",p,f,n.node(p),o),await On(f,n.node(p),{config:i,dir:o}))})),await E(async()=>{const p=n.edges().map(async function(b){const w=n.edge(b.v,b.w,b.name);if(m.info("Edge "+b.v+" -> "+b.w+": "+JSON.stringify(b)),m.info("Edge "+b.v+" -> "+b.w+": ",b," ",JSON.stringify(n.edge(b))),m.info("Fix",k,"ids:",b.v,b.w,"Translating: ",k.get(b.v),k.get(b.w)),h&&w.selfLoop){if(w.selfLoop.order!==1)return;const O={...w.originalEdge,...w,id:w.selfLoop.id,startLabelLeft:w.originalEdge?.startLabelLeft??w.startLabelLeft,startLabelRight:w.originalEdge?.startLabelRight??w.startLabelRight,endLabelLeft:w.originalEdge?.endLabelLeft??w.endLabelLeft,endLabelRight:w.originalEdge?.endLabelRight??w.endLabelRight};await me(u,O),w.width=O.width,w.height=O.height,w.labelStyle=O.labelStyle;return}await me(u,w)});await Promise.all(p)},"processEdges")();const{subGraphTitleTotalMargin:g}=Pn(i);return{elem:c,graph:n,groups:{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c},diagramType:r,id:t,mergeSelfLoops:h,subGraphTitleTotalMargin:g}},"measureDagreGraph"),yn=E(e=>{m.info("############################################# XXX"),m.info("### Layout ### XXX"),m.info("############################################# XXX"),no(e)},"runDagreGraphLayout"),Ro=E((e,n,r)=>{const t=e.node(n);if(!t)return;const a={...t};return t?.clusterNode?a.y=(t.y??0)+r:e.children(n).length>0?a.height=(t.height??0)+r:a.y=(t.y??0)+r/2,a},"normalizeDagreNode"),Fe=E((e,n)=>{To.forEach(r=>{n[r]!==void 0&&(e[r]=n[r])})},"applyDagreNodeLayout"),Io=E((e,n,r,t)=>({...e,start:e.start??n,end:e.end??r,points:(e.points??[]).map(a=>({...a,y:typeof a.y=="number"?a.y+t:a.y}))}),"normalizeDagreEdge"),jo=E((e,n)=>{const{graph:r,mergeSelfLoops:t,subGraphTitleTotalMargin:a=0}=n,i=new Map(e.nodes.map(s=>[s.id,s]));ae(r).forEach(s=>{const d=Ro(r,s,a);if(!d)return;Fe(r.node(s),d);const u=i.get(s);u&&Fe(u,d)});const o=a/2;return e.edges=wn(r,o,{mergeSelfLoops:t}).map(({edge:s,start:d,end:u})=>Io(s,d,u,o)),e},"applyDagreLayoutResult"),Mo=E(async({elem:e,graph:n,groups:{clusters:r,edgePaths:t},diagramType:a,id:i,mergeSelfLoops:o,subGraphTitleTotalMargin:s})=>{let d=0;await Promise.all(ae(n).map(async function(c){const h=n.node(c);if(m.info("Position XBX => "+c+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=s,m.info("A tainted cluster node XBX1",c,h.id,h.width,h.height,h.x,h.y,n.parent(c)),k.get(h.id).node=h,ye(h);else if(n.children(c).length>0){m.info("A pure cluster node XBX1",c,h.id,h.x,h.y,h.width,h.height,n.parent(c)),h.height+=s,n.node(h.parentId);const v=h?.padding/2||0,g=h?.labelBBox?.height||0,p=g-v||0;m.debug("OffsetY",p,"labelHeight",g,"halfPadding",v),await Cn(r,h),k.get(h.id).node=h}else{const v=n.node(h.parentId);h.y+=s/2,m.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",v,v?.offsetY,h),ye(h)}}));const u=s/2;return wn(n,u,{mergeSelfLoops:o}).forEach(function({edge:c,start:h,end:v}){m.info("Edge "+h+" -> "+v+": "+JSON.stringify(c),c),c.points.forEach(w=>w.y+=u);const g=n.node(h),p=n.node(v),b=Rn(t,c,k,a,g,p,i);In(c,b)}),n.nodes().forEach(function(c){const h=n.node(c);m.info(c,h.type,h.diff),h.isGroup&&(d=h.diff)}),m.warn("Returning from recursive render XAX",e,d),{elem:e,diff:d}},"paintDagreLayoutCore"),_o=E(async e=>{const n=await mn(e);return yn(n.graph),await Mo(n)},"renderDagreSubgraph"),En=E(e=>{const n=new N({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(r=>{n.setNode(r.id,{...r}),r.parentId&&n.setParent(r.id,r.parentId)}),m.debug("Edges:",e.edges),e.edges.forEach(r=>{if(r.start===r.end){const t=r.start,a=t+"---"+t+"---1",i=t+"---"+t+"---2",o=n.node(t);n.setNode(a,{domId:a,id:a,parentId:o.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(a,o.parentId),n.setNode(i,{domId:i,id:i,parentId:o.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(i,o.parentId);const s=structuredClone(r),d=structuredClone(r),u=structuredClone(r),f=structuredClone(r);d.originalEdge=s,d.selfLoop={id:s.id,order:0},u.originalEdge=s,u.selfLoop={id:s.id,order:1},f.originalEdge=s,f.selfLoop={id:s.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=t+"-cyclic-special-1",u.startLabelRight="",u.startLabelLeft="",u.endLabelLeft="",u.endLabelRight="",u.arrowTypeStart="none",u.arrowTypeEnd="none",u.id=t+"-cyclic-special-mid",f.label="",f.startLabelRight="",f.startLabelLeft="",f.arrowTypeStart="none",o.isGroup&&(d.fromCluster=t,f.toCluster=t),f.id=t+"-cyclic-special-2",f.arrowTypeStart="none",n.setEdge(t,a,d,t+"-cyclic-special-0"),n.setEdge(a,i,u,t+"-cyclic-special-1"),n.setEdge(i,t,f,t+"-cyclic-special-2")}else n.setEdge(r.start,r.end,{...r},r.id)}),xn(n),{graph:n}},"prepareLayoutForDagre"),Ao=E(async(e,{element:n,preparedLayout:r})=>{const t=r??En(e),a=kn(),i=await mn({element:n,graph:t.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return t.measuredLayout=i,i},"measureDagreLayout"),Do=E((e,n)=>{const r=n.preparedLayout?.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return yn(r.graph),jo(e,r),r},"runDagreLayoutCore"),Bo=E((e,{measure:n})=>ae(n.graph).map(r=>n.graph.node(r)).filter(Boolean),"getDagrePaintNodes"),Fo=E((e,n,{measure:r})=>e?r.graph.node(e):void 0,"getDagreEdgeNode"),Wo=Ln({prepareLayout:En,measureLayout:Ao,runLayoutCore:Do,paintOptions:{clusterDb:k,getNodes:Bo,getEdgeNode:Fo,skipNode:E((e,{measure:n})=>!n.graph.hasNode(e.id),"skipNode"),isCluster:E((e,{measure:n})=>n.graph.hasNode(e.id)&&(n.graph.children(e.id)??[]).length>0,"isCluster")}});export{jo as applyDagreLayoutResult,wn as getEdgesToRender,Ao as measureDagreLayout,En as prepareLayoutForDagre,Wo as render,Do as runDagreLayoutCore};
|