{"version":3,"file":"worker.generated.js","names":[],"sources":["esm/layout/worker.generated.js"],"sourcesContent":["const layoutWorkerSource = '\"use strict\";(()=>{var je=Object.defineProperty,ot=(e,t,r)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,it=(e,t)=>{for(var r in t)je(e,r,{get:t[r],enumerable:!0})},st=(e,t,r)=>ot(e,typeof t!=\"symbol\"?t+\"\":t,r),dt={};it(dt,{Graph:()=>T,alg:()=>ne});var lt=Object.defineProperty,Ce=(e,t)=>{for(var r in t)lt(e,r,{get:t[r],enumerable:!0})},re=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=\"directed\"in e?e.directed:!0,this._isMultigraph=\"multigraph\"in e?e.multigraph:!1,this._isCompound=\"compound\"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[\"\\\\0\"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!=\"function\"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(r=>{t!==void 0?this.setNode(r,t):this.setNode(r)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=\"\\\\0\",this._children[e]={},this._children[\"\\\\0\"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=r=>this.removeEdge(this._edgeObjs[r]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(r=>{this.setParent(r)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error(\"Cannot set parent in a non-compound graph\");if(t===void 0)t=\"\\\\0\";else{t+=\"\";for(let r=t;r!==void 0;r=this.parent(r))if(r===e)throw new Error(\"Setting \"+t+\" as parent of \"+e+\" would create a cycle\");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==\"\\\\0\")return t}}children(e=\"\\\\0\"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===\"\\\\0\")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let r=new Set(t),n=this.successors(e);if(n)for(let o of n)r.add(o);return Array.from(r.values())}}isLeaf(e){var t;let r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),((t=r==null?void 0:r.length)!=null?t:0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let r={},n=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(r[o]=i,i):i in r?r[i]:n(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,n(o))),t}setDefaultEdgeLabel(e){return typeof e!=\"function\"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((r,n)=>(t!==void 0?this.setEdge(r,n,t):this.setEdge(r,n),n)),this}setEdge(e,t,r,n){let o,i,s,d,a=!1;typeof e==\"object\"&&e!==null&&\"v\"in e?(o=e.v,i=e.w,s=e.name,arguments.length===2&&(d=t,a=!0)):(o=e,i=t,s=n,arguments.length>2&&(d=r,a=!0)),o=\"\"+o,i=\"\"+i,s!==void 0&&(s=\"\"+s);let l=A(this._isDirected,o,i,s);if(l in this._edgeLabels)return a&&(this._edgeLabels[l]=d),this;if(s!==void 0&&!this._isMultigraph)throw new Error(\"Cannot set a named edge when isMultigraph = false\");this.setNode(o),this.setNode(i),this._edgeLabels[l]=a?d:this._defaultEdgeLabelFn(o,i,s);let u=at(this._isDirected,o,i,s);return o=u.v,i=u.w,Object.freeze(u),this._edgeObjs[l]=u,ae(this._preds[i],o),ae(this._sucs[o],i),this._in[i][l]=u,this._out[o][l]=u,this._edgeCount++,this}edge(e,t,r){let n=arguments.length===1?K(this._isDirected,e):A(this._isDirected,e,t,r);return this._edgeLabels[n]}edgeAsObj(e,t,r){let n=arguments.length===1?this.edge(e):this.edge(e,t,r);return typeof n!=\"object\"||n===null?{label:n}:n}hasEdge(e,t,r){return(arguments.length===1?K(this._isDirected,e):A(this._isDirected,e,t,r))in this._edgeLabels}removeEdge(e,t,r){let n=arguments.length===1?K(this._isDirected,e):A(this._isDirected,e,t,r),o=this._edgeObjs[n];if(o){let i=o.v,s=o.w;delete this._edgeLabels[n],delete this._edgeObjs[n],ue(this._preds[s],i),ue(this._sucs[i],s),delete this._in[s][n],delete this._out[i][n],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,r){if(!e)return;let n=Object.values(e);return r?n.filter(o=>o.v===t&&o.w===r||o.v===r&&o.w===t):n}};function ae(e,t){e[t]?e[t]++:e[t]=1}function ue(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function A(e,t,r,n){let o=\"\"+t,i=\"\"+r;if(!e&&o>i){let s=o;o=i,i=s}return o+\"\u0001\"+i+\"\u0001\"+(n===void 0?\"\\\\0\":n)}function at(e,t,r,n){let o=\"\"+t,i=\"\"+r;if(!e&&o>i){let d=o;o=i,i=d}let s={v:o,w:i};return n&&(s.name=n),s}function K(e,t){return A(e,t.v,t.w,t.name)}var ut={};Ce(ut,{read:()=>gt,write:()=>ht});function ht(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ct(e),edges:ft(e)},r=e.graph();return r!==void 0&&(t.value=structuredClone(r)),t}function ct(e){return e.nodes().map(t=>{let r=e.node(t),n=e.parent(t),o={v:t};return r!==void 0&&(o.value=r),n!==void 0&&(o.parent=n),o})}function ft(e){return e.edges().map(t=>{let r=e.edge(t),n={v:t.v,w:t.w};return t.name!==void 0&&(n.name=t.name),r!==void 0&&(n.value=r),n})}function gt(e){let t=new re(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(r=>{t.setNode(r.v,r.value),r.parent&&t.setParent(r.v,r.parent)}),e.edges.forEach(r=>{t.setEdge({v:r.v,w:r.w,name:r.name},r.value)}),t}var ne={};Ce(ne,{CycleException:()=>W,bellmanFord:()=>Le,components:()=>wt,dijkstra:()=>B,dijkstraAll:()=>Et,findCycles:()=>yt,floydWarshall:()=>kt,isAcyclic:()=>Nt,postorder:()=>It,preorder:()=>jt,prim:()=>Ct,shortestPaths:()=>Lt,tarjan:()=>Me,topsort:()=>Te});var pt=()=>1;function Le(e,t,r,n){return mt(e,String(t),r||pt,n||function(o){var i;return(i=e.outEdges(o))!=null?i:[]})}function mt(e,t,r,n){let o={},i,s=0,d=e.nodes(),a=function(h){let c=o[h.v],g=o[h.w];if(!c||!g)return;let w=r(h);c.distance+w<g.distance&&(o[h.w]={distance:c.distance+w,predecessor:h.v},i=!0)},l=function(){d.forEach(function(h){n(h).forEach(function(c){let g=c.v===h?c.v:c.w,w=g===c.v?c.w:c.v;a({v:g,w})})})};d.forEach(function(h){let c=h===t?0:Number.POSITIVE_INFINITY;o[h]={distance:c,predecessor:\"\"}});let u=d.length;for(let h=1;h<u&&(i=!1,s++,l(),!!i);h++);if(s===u-1&&(i=!1,l(),i))throw new Error(\"The graph contains a negative weight cycle\");return o}function wt(e){let t={},r=[],n;function o(i){var s,d;i in t||(t[i]=!0,n.push(i),(s=e.successors(i))==null||s.forEach(o),(d=e.predecessors(i))==null||d.forEach(o))}return e.nodes().forEach(function(i){n=[],o(i),n.length&&r.push(n)}),r}var Se=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error(\"Queue underflow\");return this._arr[0].key}add(e,t){let r=this._keyIndices,n=String(e);if(!(n in r)){let o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw new Error(\"Queue underflow\");this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let r=this._keyIndices[e];if(r===void 0)throw new Error(`Key not found: ${e}`);let n=this._arr[r].priority;if(t>n)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${n} New: ${t}`);this._arr[r].priority=t,this._decrease(r)}_heapify(e){let t=this._arr,r=2*e,n=r+1,o=e;r<t.length&&(o=t[r].priority<t[o].priority?r:o,n<t.length&&(o=t[n].priority<t[o].priority?n:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,r=t[e].priority,n;for(;e!==0&&(n=e>>1,!(t[n].priority<r));)this._swap(e,n),e=n}_swap(e,t){let r=this._arr,n=this._keyIndices,o=r[e],i=r[t];r[e]=i,r[t]=o,n[i.key]=e,n[o.key]=t}},vt=()=>1;function B(e,t,r,n){let o=function(i){var s;return(s=e.outEdges(i))!=null?s:[]};return bt(e,String(t),r||vt,n||o)}function bt(e,t,r,n){let o={},i=new Se,s,d,a=function(l){let u=l.v!==s?l.v:l.w,h=o[u];if(!h)return;let c=r(l),g=d.distance+c;if(c<0)throw new Error(\"dijkstra does not allow negative edge weights. Bad edge: \"+l+\" Weight: \"+c);g<h.distance&&(h.distance=g,h.predecessor=s,i.decrease(u,g))};for(e.nodes().forEach(function(l){let u=l===t?0:Number.POSITIVE_INFINITY;o[l]={distance:u,predecessor:\"\"},i.add(l,u)});i.size()>0;){s=i.removeMin();let l=o[s];if(!l||l.distance===Number.POSITIVE_INFINITY)break;d=l,n(s).forEach(a)}return o}function Et(e,t,r){return e.nodes().reduce(function(n,o){return n[o]=B(e,o,t,r),n},{})}function Me(e){let t=0,r=[],n={},o=[];function i(s){var d;let a=n[s]={onStack:!0,lowlink:t,index:t++};if(r.push(s),(d=e.successors(s))==null||d.forEach(function(l){if(l in n){let u=n[l];u!=null&&u.onStack&&(a.lowlink=Math.min(a.lowlink,u.index))}else{i(l);let u=n[l];u&&(a.lowlink=Math.min(a.lowlink,u.lowlink))}}),a.lowlink===a.index){let l=[],u;do{u=r.pop();let h=n[u];h&&(h.onStack=!1),l.push(u)}while(s!==u);o.push(l)}}return e.nodes().forEach(function(s){s in n||i(s)}),o}function yt(e){return Me(e).filter(function(t){var r;let n=t[0];return n?t.length>1||t.length===1&&((r=e.outEdges(n,n))!=null?r:[]).length>0:!1})}var _t=()=>1;function kt(e,t,r){return xt(e,t||_t,r||function(n){var o;return(o=e.outEdges(n))!=null?o:[]})}function xt(e,t,r){let n={},o=e.nodes();return o.forEach(function(i){let s={};n[i]=s,s[i]={distance:0,predecessor:\"\"},o.forEach(function(d){i!==d&&(s[d]={distance:Number.POSITIVE_INFINITY,predecessor:\"\"})}),r(i).forEach(function(d){let a=d.v===i?d.w:d.v,l=t(d);s[a]={distance:l,predecessor:i}})}),o.forEach(function(i){let s=n[i];s&&o.forEach(function(d){let a=n[d];a&&o.forEach(function(l){let u=a[i],h=s[l],c=a[l];if(u&&h&&c){let g=u.distance+h.distance;g<c.distance&&(c.distance=g,c.predecessor=h.predecessor)}})})}),n}var W=class extends Error{constructor(e){super(e),this.name=\"CycleException\"}};function Te(e){let t={},r={},n=[];function o(i){var s;if(i in r)throw new W;i in t||(r[i]=!0,t[i]=!0,(s=e.predecessors(i))==null||s.forEach(o),delete r[i],n.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new W;return n}function Nt(e){try{Te(e)}catch(t){if(t instanceof W)return!1;throw t}return!0}function Ot(e,t,r,n,o){Array.isArray(t)||(t=[t]);let i=(d=>{var a;return(a=e.isDirected()?e.successors(d):e.neighbors(d))!=null?a:[]}),s={};return t.forEach(function(d){if(!e.hasNode(d))throw new Error(\"Graph does not have node: \"+d);o=Re(e,d,r===\"post\",s,i,n,o)}),o}function Re(e,t,r,n,o,i,s){return t in n||(n[t]=!0,r||(s=i(s,t)),o(t).forEach(function(d){s=Re(e,d,r,n,o,i,s)}),r&&(s=i(s,t))),s}function Pe(e,t,r){return Ot(e,t,r,function(n,o){return n.push(o),n},[])}function It(e,t){return Pe(e,t,\"post\")}function jt(e,t){return Pe(e,t,\"pre\")}function Ct(e,t){var r;let n=new re,o={},i=new Se,s;function d(u){let h=u.v===s?u.w:u.v,c=i.priority(h);if(c!==void 0){let g=t(u);g<c&&(o[h]=s,i.decrease(h,g))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(u){i.add(u,Number.POSITIVE_INFINITY),n.setNode(u)});let a=e.nodes()[0];a!==void 0&&i.decrease(a,0);let l=!1;for(;i.size()>0;){if(s=i.removeMin(),s in o)n.setEdge(s,o[s]);else{if(l)throw new Error(\"Input graph is not connected: \"+e);l=!0}(r=e.nodeEdges(s))==null||r.forEach(d)}return n}function Lt(e,t,r,n){return St(e,t,r,n!=null?n:(o=>{var i;return(i=e.outEdges(o))!=null?i:[]}))}function St(e,t,r,n){if(r===void 0)return B(e,t,r,n);let o=!1,i=e.nodes();for(let s=0;s<i.length;s++){let d=i[s];if(d===void 0)continue;let a=n(d);for(let l=0;l<a.length;l++){let u=a[l];if(!u)continue;let h=u.v===d?u.v:u.w,c=h===u.v?u.w:u.v;r({v:h,w:c})<0&&(o=!0)}if(o)return Le(e,t,r,n)}return B(e,t,r,n)}var T=re;function D(e,t,r,n){let o=n;for(;e.hasNode(o);)o=oe(n);return r.dummy=t,e.setNode(o,r),o}function Mt(e){let t=new T().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})}),t}function Fe(e){let t=new T({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t}function he(e,t){let r=e.x,n=e.y,o=t.x-r,i=t.y-n,s=e.width/2,d=e.height/2;if(!o&&!i)throw new Error(\"Not possible to find intersection inside of the rectangle\");let a,l;return Math.abs(i)*s>Math.abs(o)*d?(i<0&&(d=-d),a=d*o/i,l=d):(o<0&&(s=-s),a=s,l=s*i/o),{x:r+a,y:n+l}}function q(e){let t=G(De(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),o=n.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][n.order]=r)}),t}function Tt(e){let t=e.nodes().map(n=>{let o=e.node(n).rank;return o===void 0?Number.MAX_VALUE:o}),r=R(Math.min,t);e.nodes().forEach(n=>{let o=e.node(n);Object.hasOwn(o,\"rank\")&&(o.rank-=r)})}function Rt(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),r=R(Math.min,t),n=[];e.nodes().forEach(s=>{let d=e.node(s).rank-r;n[d]||(n[d]=[]),n[d].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(n).forEach((s,d)=>{s===void 0&&d%i!==0?--o:s!==void 0&&o&&s.forEach(a=>e.node(a).rank+=o)})}function ce(e,t,r,n){let o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=n),D(e,\"border\",o,t)}function Pt(e,t=Ye){let r=[];for(let n=0;n<e.length;n+=t){let o=e.slice(n,n+t);r.push(o)}return r}var Ye=65535;function R(e,t){if(t.length>Ye){let r=Pt(t);return e(...r.map(n=>e(...n)))}else return e(...t)}function De(e){let t=e.nodes().map(r=>{let n=e.node(r).rank;return n===void 0?Number.MIN_VALUE:n});return R(Math.max,t)}function Ft(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function Yt(e,t){return t()}var Dt=0;function oe(e){let t=++Dt;return e+(\"\"+t)}function G(e,t,r=1){t==null&&(t=e,e=0);let n=i=>i<t;r<0&&(n=i=>t<i);let o=[];for(let i=e;n(i);i+=r)o.push(i);return o}function X(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}function z(e,t){let r;return typeof t==\"string\"?r=n=>n[t]:r=t,Object.entries(e).reduce((n,[o,i])=>(n[o]=r(i,o),n),{})}function Vt(e,t){return e.reduce((r,n,o)=>(r[n]=t[o],r),{})}var $=\"\\\\0\";function Ve(e,t,r){var n,o,i,s,d,a;if(!(e&&t&&r&&t.dummy===\"edge\"&&r.dummy===\"edge\"&&t.edgeObj&&r.edgeObj&&e[t.edgeObj.v]&&e[r.edgeObj.v]&&e[t.edgeObj.w]&&e[r.edgeObj.w]))return 0;let l=!0;t.edgeObj.w===r.edgeObj.w&&(l=!1);let u=l?(o=(n=e[t.edgeObj.v])==null?void 0:n.rank)!=null?o:NaN+1:(s=(i=e[t.edgeObj.w])==null?void 0:i.rank)!=null?s:NaN-1,h=Object.entries(e).find(b=>{var y,v;return((y=b[1].edgeObj)==null?void 0:y.v)===t.edgeObj.v&&((v=b[1].edgeObj)==null?void 0:v.w)===t.edgeObj.w&&b[1].rank===u}),c=Object.entries(e).find(b=>{var y,v;return((y=b[1].edgeObj)==null?void 0:y.v)===r.edgeObj.v&&((v=b[1].edgeObj)==null?void 0:v.w)===r.edgeObj.w&&b[1].rank===u});if(!h||!c)return 0;let g=(d=h[1].order)!=null?d:NaN,w=(a=c[1].order)!=null?a:NaN;return isNaN(g-w)?0:g-w}var At=class{constructor(){st(this,\"_sentinel\");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return fe(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&fe(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,r=t._prev;for(;r!==t;)e.push(JSON.stringify(r,Gt)),r=r._prev;return\"[\"+e.join(\", \")+\"]\"}};function fe(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Gt(e,t){if(e!==\"_next\"&&e!==\"_prev\")return t}var Bt=At,Wt=()=>1;function Xt(e,t){if(e.nodeCount()<=1)return[];let r=zt(e,t||Wt);return qt(r.graph,r.buckets,r.zeroIdx).flatMap(n=>e.outEdges(n.v,n.w)||[])}function qt(e,t,r){var n;let o=[],i=t[t.length-1],s=t[0],d;for(;e.nodeCount();){for(;d=s.dequeue();)Q(e,t,r,d);for(;d=i.dequeue();)Q(e,t,r,d);if(e.nodeCount()){for(let a=t.length-2;a>0;--a)if(d=(n=t[a])==null?void 0:n.dequeue(),d){o=o.concat(Q(e,t,r,d,!0)||[]);break}}}return o}function Q(e,t,r,n,o){let i=[],s=o?i:void 0;return(e.inEdges(n.v)||[]).forEach(d=>{let a=e.edge(d),l=e.node(d.v);o&&i.push({v:d.v,w:d.w}),l.out-=a,te(t,r,l)}),(e.outEdges(n.v)||[]).forEach(d=>{let a=e.edge(d),l=d.w,u=e.node(l);u.in-=a,te(t,r,u)}),e.removeNode(n.v),s}function zt(e,t){let r=new T,n=0,o=0;e.nodes().forEach(d=>{r.setNode(d,{v:d,in:0,out:0})}),e.edges().forEach(d=>{let a=r.edge(d.v,d.w)||0,l=t(d),u=a+l;r.setEdge(d.v,d.w,u);let h=r.node(d.v),c=r.node(d.w);o=Math.max(o,h.out+=l),n=Math.max(n,c.in+=l)});let i=$t(o+n+3).map(()=>new Bt),s=n+1;return r.nodes().forEach(d=>{te(i,s,r.node(d))}),{graph:r,buckets:i,zeroIdx:s}}function te(e,t,r){var n,o,i;r.out?r.in?(i=e[r.out-r.in+t])==null||i.enqueue(r):(o=e[e.length-1])==null||o.enqueue(r):(n=e[0])==null||n.enqueue(r)}function $t(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t}function Jt(e,t){(e.graph().acyclicer===\"greedy\"?Xt(e,r(e)):Kt(e,t!=null?t:null)).forEach(n=>{let o=e.edge(n);e.removeEdge(n),o.forwardName=n.name,o.reversed=!0,e.setEdge(n.w,n.v,o,oe(\"rev\"))});function r(n){return o=>n.edge(o).weight}}function Kt(e,t){let r=[],n={},o={};function i(a){Object.hasOwn(o,a)||(o[a]=!0,n[a]=!0,e.outEdges(a).forEach(l=>{Object.hasOwn(n,l.w)?r.push(l):i(l.w)}),delete n[a])}function s(a){var l;Object.hasOwn(o,a)||(o[a]=!0,n[a]=!0,(l=e.outEdges(a))==null||l.forEach(u=>{var h,c;Object.hasOwn(n,u.w)||((h=t.node(a))==null?void 0:h.rank)>((c=t.node(u.w))==null?void 0:c.rank)&&Ut(e,u.w,u)?r.push(u):s(u.w)}),delete n[a])}let d=i;return t&&typeof t.node==\"function\"&&(d=s),e.sources().forEach(d),e.nodes().forEach(d),r}function Qt(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}function Ut(e,t,r){let n=new Set;function o(i){var s;if(e.sources().includes(i))return!0;n.add(i);for(let d of(s=e.inEdges(i))!=null?s:[])if(!(d.v===r.v&&d.w===r.w)&&!n.has(d.v)&&o(d.v))return!0;return!1}return o(t)}function Ht(e){e.graph().dummyChains=[],e.edges().forEach(t=>Zt(e,t))}function Zt(e,t){let r=t.v,n=e.node(r).rank,o=t.w,i=e.node(o).rank,s=t.name,d=e.edge(t),a=d.labelRank;if(i===n+1)return;e.removeEdge(t);let l,u,h;for(h=0,++n;n<i;++h,++n)d.points=[],u={width:0,height:0,edgeLabel:d,edgeObj:t,rank:n},l=D(e,\"edge\",u,\"_d\"),n===a&&(u.width=d.width,u.height=d.height,u.dummy=\"edge-label\",u.labelpos=d.labelpos),e.setEdge(r,l,{weight:d.weight},s),h===0&&e.graph().dummyChains.push(l),r=l;e.setEdge(r,o,{weight:d.weight},s)}function er(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,o;for(e.setEdge(r.edgeObj,n);r.dummy;)o=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),r.dummy===\"edge-label\"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=o,r=e.node(t)})}function ie(e){let t={};function r(n){let o=e.node(n);if(Object.hasOwn(t,n))return o.rank;t[n]=!0;let i=e.outEdges(n),s=i?i.map(a=>a==null?Number.POSITIVE_INFINITY:r(a.w)-e.edge(a).minlen):[],d=R(Math.min,s);return d===Number.POSITIVE_INFINITY&&(d=0),o.rank=d}e.sources().forEach(r)}function Y(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Ae=tr;function tr(e){let t=new T({directed:!1}),r=e.nodes();if(r.length===0)throw new Error(\"Graph must have at least one node\");let n=r[0],o=e.nodeCount();t.setNode(n,{});let i,s;for(;rr(t,e)<o&&(i=nr(t,e),!!i);)s=t.hasNode(i.v)?Y(e,i):-Y(e,i),or(t,e,s);return t}function rr(e,t){function r(n){let o=t.nodeEdges(n);o&&o.forEach(i=>{let s=i.v,d=n===s?i.w:s;!e.hasNode(d)&&!Y(t,i)&&(e.setNode(d,{}),e.setEdge(n,d,{}),r(d))})}return e.nodes().forEach(r),e.nodeCount()}function nr(e,t){return t.edges().reduce((r,n)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(n.v)!==e.hasNode(n.w)&&(o=Y(t,n)),o<r[0]?[o,n]:r},[Number.POSITIVE_INFINITY,null])[1]}function or(e,t,r){e.nodes().forEach(n=>t.node(n).rank+=r)}var{preorder:ir,postorder:sr}=ne,dr=P;P.initLowLimValues=de;P.initCutValues=se;P.calcCutValue=Ge;P.leaveEdge=We;P.enterEdge=Xe;P.exchangeEdges=qe;function P(e){e=Mt(e),ie(e);let t=Ae(e);de(t),se(t,e);let r,n;for(;r=We(t);)n=Xe(t,e,r),qe(t,e,r,n)}function se(e,t){let r=sr(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>lr(e,t,n))}function lr(e,t,r){let n=e.node(r).parent,o=e.edge(r,n);o.cutvalue=Ge(e,t,r)}function Ge(e,t,r){let n=e.node(r).parent,o=!0,i=t.edge(r,n),s=0;i||(o=!1,i=t.edge(n,r)),s=i.weight;let d=t.nodeEdges(r);return d&&d.forEach(a=>{let l=a.v===r,u=l?a.w:a.v;if(u!==n){let h=l===o,c=t.edge(a).weight;if(s+=h?c:-c,ur(e,r,u)){let g=e.edge(r,u).cutvalue;s+=h?-g:g}}}),s}function de(e,t){arguments.length<2&&(t=e.nodes()[0]),Be(e,{},1,t)}function Be(e,t,r,n,o){let i=r,s=e.node(n);t[n]=!0;let d=e.neighbors(n);return d&&d.forEach(a=>{Object.hasOwn(t,a)||(r=Be(e,t,r,a,n))}),s.low=i,s.lim=r++,o?s.parent=o:delete s.parent,r}function We(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Xe(e,t,r){let n=r.v,o=r.w;t.hasEdge(n,o)||(n=r.w,o=r.v);let i=e.node(n),s=e.node(o),d=i,a=!1;return i.lim>s.lim&&(d=s,a=!0),t.edges().filter(l=>a===ge(e,e.node(l.v),d)&&a!==ge(e,e.node(l.w),d)).reduce((l,u)=>Y(t,u)<Y(t,l)?u:l)}function qe(e,t,r,n){let o=r.v,i=r.w;e.removeEdge(o,i),e.setEdge(n.v,n.w,{}),de(e),se(e,t),ar(e,t)}function ar(e,t){let r=e.nodes().find(o=>!e.node(o).parent);if(!r)return;let n=ir(e,[r]);n=n.slice(1),n.forEach(o=>{let i=e.node(o).parent,s=t.edge(o,i),d=!1;s||(s=t.edge(i,o),d=!0),t.node(o).rank=t.node(i).rank+(d?s.minlen:-s.minlen)})}function ur(e,t,r){return e.hasEdge(t,r)}function ge(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}var hr=cr;function cr(e){let t=e.graph().ranker;if(typeof t==\"function\")return t(e);switch(t){case\"network-simplex\":pe(e);break;case\"tight-tree\":gr(e);break;case\"longest-path\":fr(e);break;case\"none\":break;default:pe(e)}}var fr=ie;function gr(e){ie(e),Ae(e)}function pe(e){dr(e)}var pr=mr;function mr(e){let t=vr(e),r=e.graph();Array.isArray(r.dummyChains)&&r.dummyChains.forEach(n=>{let o=e.node(n),i=o.edgeObj,s=wr(e,t,i.v,i.w),d=s.path,a=s.lca,l=0,u=d[l],h=!0;for(;n!==i.w;){if(o=e.node(n),h){for(;(u=d[l])!==a&&e.node(u).maxRank<o.rank;)l++;u===a&&(h=!1)}if(!h){for(;l<d.length-1&&e.node(d[l+1]).minRank<=o.rank;)l++;u=d[l]}u!==void 0&&e.setParent(n,u),n=e.successors(n)[0]}})}function wr(e,t,r,n){let o=[],i=[],s=Math.min(t[r].low,t[n].low),d=Math.max(t[r].lim,t[n].lim),a;a=r;do a=e.parent(a),o.push(a);while(a&&(t[a].low>s||d>t[a].lim));let l=a,u=n;for(;(u=e.parent(u))!==l;)i.push(u);return{path:o.concat(i.reverse()),lca:l}}function vr(e){let t={},r=0;function n(o){let i=r;e.children(o).forEach(n),t[o]={low:i,lim:r++}}return e.children($).forEach(n),t}function br(e){let t=D(e,\"root\",{},\"_root\"),r=Er(e),n=Object.values(r),o=R(Math.max,n)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(d=>e.edge(d).minlen*=i);let s=yr(e)+1;e.children($).forEach(d=>{ze(e,t,i,s,o,r,d)}),e.graph().nodeRankFactor=i}function ze(e,t,r,n,o,i,s){var d;let a=e.children(s);if(!a.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}let l=ce(e,\"_bt\"),u=ce(e,\"_bb\"),h=e.node(s);e.setParent(l,s),h.borderTop=l,e.setParent(u,s),h.borderBottom=u,a.forEach(c=>{var g;ze(e,t,r,n,o,i,c);let w=e.node(c),b=w.borderTop?w.borderTop:c,y=w.borderBottom?w.borderBottom:c,v=w.borderTop?n:2*n,p=b!==y?1:o-((g=i[s])!=null?g:0)+1;e.setEdge(l,b,{weight:v,minlen:p,nestingEdge:!0}),e.setEdge(y,u,{weight:v,minlen:p,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:o+((d=i[s])!=null?d:0)})}function Er(e){let t={};function r(n,o){let i=e.children(n);i&&i.length&&i.forEach(s=>r(s,o+1)),t[n]=o}return e.children($).forEach(n=>r(n,1)),t}function yr(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function _r(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(r=>{e.edge(r).nestingEdge&&e.removeEdge(r)})}var kr=xr;function xr(e){function t(r){let n=e.children(r),o=e.node(r);if(n.length&&n.forEach(t),o&&Object.hasOwn(o,\"minRank\")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;i<s;++i)me(e,\"borderLeft\",\"_bl\",r,o,i),me(e,\"borderRight\",\"_br\",r,o,i)}}e.children($).forEach(t)}function me(e,t,r,n,o,i){let s={width:0,height:0,rank:i,borderType:t},d=o[t][i-1],a=D(e,\"border\",s,r);o[t][i]=a,e.setParent(a,n),d&&e.setEdge(d,a,{weight:1})}function Nr(e){var t;let r=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(r===\"lr\"||r===\"rl\")&&$e(e)}function Or(e){var t;let r=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(r===\"bt\"||r===\"rl\")&&Ir(e),(r===\"lr\"||r===\"rl\")&&(jr(e),$e(e))}function $e(e){e.nodes().forEach(t=>we(e.node(t))),e.edges().forEach(t=>we(e.edge(t)))}function we(e){let t=e.width;e.width=e.height,e.height=t}function Ir(e){e.nodes().forEach(t=>U(e.node(t))),e.edges().forEach(t=>{var r;let n=e.edge(t);(r=n.points)==null||r.forEach(U),Object.hasOwn(n,\"y\")&&U(n)})}function U(e){e.y=-e.y}function jr(e){e.nodes().forEach(t=>H(e.node(t))),e.edges().forEach(t=>{var r;let n=e.edge(t);(r=n.points)==null||r.forEach(H),Object.hasOwn(n,\"x\")&&H(n)})}function H(e){let t=e.x;e.x=e.y,e.y=t}function Cr(e,t=null){let r={},n=e.nodes().filter(l=>!e.children(l).length),o=n.map(l=>e.node(l).rank),i=R(Math.max,o),s=G(i+1).map(()=>[]);function d(l){if(r[l])return;r[l]=!0;let u=e.node(l);s[u.rank].push(l);let h=e.successors(l);h&&[...h].sort((c,g)=>a(c,g)).forEach(d)}n.sort((l,u)=>e.node(l).rank-e.node(u).rank).forEach(d);function a(l,u){let h=e.node(l),c=e.node(u);return Ve(t,h,c)}return s}function Lr(e,t){let r=0;for(let n=1;n<t.length;++n)r+=Sr(e,t[n-1],t[n]);return r}function Sr(e,t,r){let n=Vt(r,r.map((l,u)=>u)),o=t.flatMap(l=>{let u=e.outEdges(l);return u?u.map(h=>({pos:n[h.w],weight:e.edge(h).weight})).sort((h,c)=>h.pos-c.pos):[]}),i=1;for(;i<r.length;)i<<=1;let s=2*i-1;i-=1;let d=new Array(s).fill(0),a=0;return o.forEach(l=>{let u=l.pos+i;d[u]+=l.weight;let h=0;for(;u>0;)u%2&&(h+=d[u+1]),u=u-1>>1,d[u]+=l.weight;a+=l.weight*h}),a}function Mr(e,t=[]){return t.map(r=>{let n=e.inEdges(r);if(!n||!n.length)return{v:r};{let o=n.reduce((i,s)=>{let d=e.edge(s),a=e.node(s.v);return{sum:i.sum+d.weight*a.order,weight:i.weight+d.weight}},{sum:0,weight:0});return{v:r,barycenter:o.sum/o.weight,weight:o.weight}}})}function Tr(e,t){let r={};e.forEach((o,i)=>{let s={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight),r[o.v]=s}),t.edges().forEach(o=>{let i=r[o.v],s=r[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(s))});let n=Object.values(r).filter(o=>!o.indegree);return Rr(n)}function Rr(e){let t=[];function r(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&Pr(o,i)}}function n(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(r(o)),o.out.forEach(n(o))}return t.filter(o=>!o.merged).map(o=>X(o,[\"vs\",\"i\",\"barycenter\",\"weight\"]))}function Pr(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}function Fr(e,t,r,n,o){let i={},s=null,d=null,a=o;typeof t==\"boolean\"?(a=t,i={}):t&&(i=t,s=r!=null?r:null,d=n!=null?n:null);let l=Ft(e,v=>Object.hasOwn(v,\"barycenter\")),u=l.lhs,h=l.rhs.sort((v,p)=>p.i-v.i),c=[],g=0,w=0,b=0;u.sort(Yr(d,s,!!a));for(let[v,p]of Object.entries(i)){let f=u.findIndex(m=>m.vs[0]===v);u.splice(f+1,0,p)}b=ve(c,h,b),u.forEach(v=>{b+=v.vs.length,c.push(v.vs),g+=v.barycenter*v.weight,w+=v.weight,b=ve(c,h,b)});let y={vs:c.flat(1)};return w&&(y.barycenter=g/w,y.weight=w),y}function ve(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}function Yr(e,t,r){return(n,o)=>{if(n.barycenter<o.barycenter)return-1;if(n.barycenter>o.barycenter)return 1;if(e&&(typeof n.vs[0]==\"string\"||typeof o.vs[0]==\"string\")){let i=e.node(n.vs[0]),s=e.node(o.vs[0]),d=Ve(t,i,s);if(d!==0)return d}return r?o.i-n.i:n.i-o.i}}function Je(e,t,r,n,o){var i,s,d,a,l,u,h,c,g,w,b;let y=null,v=o;typeof n==\"boolean\"?(v=n,y=null):n!==void 0&&(y=n);let p=e.children(t),f=e.node(t),m=f?f.borderLeft:void 0,E=f?f.borderRight:void 0,N={};m&&(p=p.filter(x=>x!==m&&x!==E));let S=Mr(e,p);S.forEach(x=>{if(e.children(x.v).length){let{result:j}=Je(e,x.v,r,y,v);N[x.v]=j,Object.hasOwn(j,\"barycenter\")&&Vr(x,j)}});let _=Tr(S,r);Dr(_,N);let L={},M=!1;for(let x=0;x<_.length;x++)for(let j=x+1;j<_.length;j++)if(!(!_[x]||!_[j]||!((i=_[x])!=null&&i.barycenter)||!((s=_[j])!=null&&s.barycenter))&&((d=_[x])==null?void 0:d.barycenter)===_[j].barycenter){let O=(l=(a=_[x])==null?void 0:a.vs[0])!=null?l:\"\",k=(h=(u=_[j])==null?void 0:u.vs[0])!=null?h:\"\",C=e.node(O),F=e.node(k);if(C.dummy===\"edge\"&&F.dummy===\"edge\"&&((c=C.edgeObj)==null?void 0:c.v)===((g=F.edgeObj)==null?void 0:g.v)&&((w=C.edgeObj)==null?void 0:w.w)===((b=F.edgeObj)==null?void 0:b.w))if(C.edgeLabel.reversed){L[k]=_[x],_.splice(x,1),x--;break}else L[O]=_[j],_.splice(j,1),j--;else M=!0}let I=Fr(_,L,y,e,v);if(m&&E){I.vs=[m,I.vs,E].flat(1);let x=e.predecessors(m);if(x&&x.length){let j=e.node(x[0]),O=e.predecessors(E),k=e.node(O[0]);Object.hasOwn(I,\"barycenter\")||(I.barycenter=0,I.weight=0),I.barycenter=(I.barycenter*I.weight+j.order+k.order)/(I.weight+2),I.weight+=2}}return Object.defineProperty(I,\"result\",{value:I,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(I,\"usedBias\",{value:M,enumerable:!1,configurable:!0,writable:!0}),I}function Dr(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function Vr(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Ar(e,t,r,n){n||(n=e.nodes());let o=Gr(e),i=new T({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return n.forEach(s=>{let d=e.node(s),a=e.parent(s);if(d.rank===t||d.minRank<=t&&t<=d.maxRank){i.setNode(s),i.setParent(s,a||o);let l=e[r](s);l&&l.forEach(u=>{let h=u.v===s?u.w:u.v,c=i.edge(h,s),g=c!==void 0?c.weight:0;i.setEdge(h,s,{weight:e.edge(u).weight+g})}),Object.hasOwn(d,\"minRank\")&&i.setNode(s,{borderLeft:d.borderLeft[t],borderRight:d.borderRight[t]})}}),i}function Gr(e){let t;for(;e.hasNode(t=oe(\"_root\")););return t}function Br(e,t,r){let n={},o;r.forEach(i=>{let s=e.parent(i),d,a;for(;s;){if(d=e.parent(s),d?(a=n[d],n[d]=s):(a=o,o=s),a&&a!==s){t.setEdge(a,s);return}s=d}})}function Ke(e,t={},r=null){if(typeof t.customOrder==\"function\"){t.customOrder(e,Ke);return}let n=De(e),o=be(e,G(1,n+1),\"inEdges\"),i=be(e,G(n-1,-1,-1),\"outEdges\"),s=Cr(e,r);if(Ee(e,s),t.disableOptimalOrderHeuristic)return;let d=Number.POSITIVE_INFINITY,a,l=t.constraints||[];for(let u=0,h=0;h<4;++u,++h){Wr(u%2?o:i,u%4>=2,l,r),s=q(e);let c=Lr(e,s);c<d?(h=0,a=Object.assign({},s),d=c):c===d&&(a=structuredClone(s))}Ee(e,a)}function be(e,t,r){let n=new Map,o=(i,s)=>{n.has(i)||n.set(i,[]),n.get(i).push(s)};for(let i of e.nodes()){let s=e.node(i);if(typeof s.rank==\"number\"&&o(s.rank,i),typeof s.minRank==\"number\"&&typeof s.maxRank==\"number\")for(let d=s.minRank;d<=s.maxRank;d++)d!==s.rank&&o(d,i)}return t.map(function(i){return Ar(e,i,r,n.get(i)||[])})}function Wr(e,t,r,n){let o=!0,i=new T;e.forEach(function(s){r.forEach(u=>i.setEdge(u.left,u.right));let d=s.graph().root,{result:a,usedBias:l}=Je(s,d,i,n,o);t&&l&&(o=!o),a.vs.forEach((u,h)=>s.node(u).order=h),Br(s,i,a.vs)})}function Ee(e,t){Object.values(t).forEach(r=>r.forEach((n,o)=>e.node(n).order=o))}function Xr(e,t){let r={};function n(o,i){let s=0,d=0,a=o.length,l=i[i.length-1];return i.forEach((u,h)=>{let c=zr(e,u),g=c?e.node(c).order:a;(c||u===l)&&(i.slice(d,h+1).forEach(w=>{let b=e.predecessors(w);b&&b.forEach(y=>{let v=e.node(y),p=v.order;(p<s||g<p)&&!(v.dummy&&e.node(w).dummy)&&Qe(r,y,w)})}),d=h+1,s=g)}),i}return t.length&&t.reduce(n),r}function qr(e,t){let r={};function n(i,s,d,a,l){G(s,d).forEach(u=>{let h=i[u];if(h!==void 0&&e.node(h).dummy){let c=e.predecessors(h);c&&c.forEach(g=>{if(g===void 0)return;let w=e.node(g);w.dummy&&(w.order<a||w.order>l)&&Qe(r,g,h)})}})}function o(i,s){let d=-1,a=-1,l=0;return s.forEach((u,h)=>{if(e.node(u).dummy===\"border\"){let c=e.predecessors(u);if(c&&c.length){let g=c[0];if(g===void 0)return;a=e.node(g).order,n(s,l,h,d,a),l=h,d=a}}n(s,l,s.length,a,i.length)}),s}return t.length&&t.reduce(o),r}function zr(e,t){if(e.node(t).dummy){let r=e.predecessors(t);if(r)return r.find(n=>e.node(n).dummy)}}function Qe(e,t,r){if(t>r){let o=t;t=r,r=o}let n=e[t];n||(e[t]=n={}),n[r]=!0}function $r(e,t,r){if(t>r){let o=t;t=r,r=o}let n=e[t];return n!==void 0&&Object.hasOwn(n,r)}function Jr(e,t,r,n,o){let i={},s={},d={};return t.forEach(a=>{a.forEach((l,u)=>{i[l]=l,s[l]=l,d[l]=u})}),t.forEach(a=>{let l=-1,u=-1,h=!1,c=a,g=a.findIndex(w=>(o==null?void 0:o.includes(w))||ye(w,e,o));g>0&&(c=[a[g],...a.slice(0,g),...a.slice(g+1)],h=!0),c.forEach(w=>{var b;let y=n(w);if(y&&y.length){o!=null&&o.includes(w)&&(y=y.filter(f=>ye(f,e,o)));let v=y.sort((f,m)=>{let E=d[f],N=d[m];return(E!==void 0?E:0)-(N!==void 0?N:0)}),p=(v.length-1)/2;for(let f=Math.floor(p),m=Math.ceil(p);f<=m;++f){let E=v[f];if(E===void 0)continue;let N=d[E];if(N!==void 0&&s[w]===w&&l<N&&d[E]!==u&&!$r(r,w,E)){let S=i[E];S!==void 0&&(s[E]=w,s[w]=i[w]=S,l=N,h&&(l=-1,u=(b=d[E])!=null?b:-1,h=!1))}}}})}),{root:i,align:s}}function Kr(e,t,r,n,o=!1){let i={},s=Qr(e,t,r,o),d=o?\"borderLeft\":\"borderRight\";function a(g,w){let b=s.nodes().slice(),y={},v=b.pop();for(;v;){if(y[v])g(v);else{y[v]=!0,b.push(v);for(let p of w(v))b.push(p)}v=b.pop()}}function l(g){let w=s.inEdges(g);w?i[g]=w.reduce((b,y)=>{var v;let p=(v=i[y.v])!=null?v:0,f=s.edge(y);return Math.max(b,p+(f!==void 0?f:0))},0):i[g]=0}function u(g){let w=s.outEdges(g),b=Number.POSITIVE_INFINITY;w&&(b=w.reduce((v,p)=>{let f=i[p.w],m=s.edge(p);return Math.min(v,(f!==void 0?f:0)-(m!==void 0?m:0))},Number.POSITIVE_INFINITY));let y=e.node(g);b!==Number.POSITIVE_INFINITY&&y.borderType!==d&&(i[g]=Math.max(i[g]!==void 0?i[g]:0,b))}function h(g){return s.predecessors(g)||[]}function c(g){return s.successors(g)||[]}return a(l,h),a(u,c),Object.keys(n).forEach(g=>{var w;let b=r[g];b!==void 0&&(i[g]=(w=i[b])!=null?w:0)}),i}function Qr(e,t,r,n){let o=new T,i=e.graph(),s=tn(i.nodesep,i.edgesep,n);return t.forEach(d=>{let a;d.forEach(l=>{let u=r[l];if(u!==void 0){if(o.setNode(u),a!==void 0){let h=r[a];if(h!==void 0){let c=o.edge(h,u);o.setEdge(h,u,Math.max(s(e,l,a),c||0))}}a=l}})}),o}function Ur(e,t){return Object.values(t).reduce((r,n)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([d,a])=>{let l=rn(e,d)/2;o=Math.max(a+l,o),i=Math.min(a-l,i)});let s=o-i;return s<r[0]&&(r=[s,n]),r},[Number.POSITIVE_INFINITY,null])[1]}function Hr(e,t){let r=Object.values(t),n=R(Math.min,r),o=R(Math.max,r);[\"u\",\"d\"].forEach(i=>{[\"l\",\"r\"].forEach(s=>{let d=i+s,a=e[d];if(!a||a===t)return;let l=Object.values(a),u=n-R(Math.min,l);s!==\"l\"&&(u=o-R(Math.max,l)),u&&(e[d]=z(a,h=>h+u))})})}function Zr(e,t=void 0){let r=e.ul;return r?z(r,(n,o)=>{var i,s;if(t){let a=t.toLowerCase(),l=e[a];if(l&&l[o]!==void 0)return l[o]}let d=Object.values(e).map(a=>{let l=a[o];return l!==void 0?l:0}).sort((a,l)=>a-l);return(((i=d[1])!=null?i:0)+((s=d[2])!=null?s:0))/2}):{}}function en(e,t){let r=q(e),n=Object.assign(Xr(e,r),qr(e,r)),o={},i;[\"u\",\"d\"].forEach(d=>{i=d===\"u\"?r:Object.values(r).reverse(),[\"l\",\"r\"].forEach(a=>{a===\"r\"&&(i=i.map(h=>Object.values(h).reverse()));let l=Jr(e,i,n,h=>(d===\"u\"?e.predecessors(h):e.successors(h))||[],t),u=Kr(e,i,l.root,l.align,a===\"r\");a===\"r\"&&(u=z(u,h=>-h)),o[d+a]=u})});let s=Ur(e,o);return Hr(o,s),Zr(o,e.graph().align)}function tn(e,t,r){return(n,o,i)=>{let s=n.node(o),d=n.node(i),a=0,l;if(a+=s.width/2,Object.hasOwn(s,\"labelpos\"))switch(s.labelpos.toLowerCase()){case\"l\":l=-s.width/2;break;case\"r\":l=s.width/2;break}if(l&&(a+=r?l:-l),l=void 0,a+=(s.dummy?t:e)/2,a+=(d.dummy?t:e)/2,a+=d.width/2,Object.hasOwn(d,\"labelpos\"))switch(d.labelpos.toLowerCase()){case\"l\":l=d.width/2;break;case\"r\":l=-d.width/2;break}return l&&(a+=r?l:-l),a}}function rn(e,t){return e.node(t).width}function ye(e,t,r){var n;if(!r)return!1;let o=(n=t.node(e))==null?void 0:n.edgeObj;if(!o||t.node(e).edgeLabel.reversed)return!1;let i=r.indexOf(o==null?void 0:o.v),s=r.indexOf(o==null?void 0:o.w);return i!==-1&&s!==-1&&i===(s+1)%r.length||i===(s-1)%r.length}function nn(e,t){e=Fe(e),on(e),Object.entries(en(e,t)).forEach(([r,n])=>e.node(r).x=n)}function on(e){let t=q(e),r=e.graph(),n=r.ranksep,o=r.rankalign,i=0;t.forEach(s=>{let d=s.reduce((a,l)=>{var u;let h=(u=e.node(l).height)!=null?u:0;return a>h?a:h},0);s.forEach(a=>{let l=e.node(a);o===\"top\"?l.y=i+l.height/2:o===\"bottom\"?l.y=i+d-l.height/2:l.y=i+d/2}),i+=d+n})}var _e=new WeakMap;function Ue(e,t={}){return He(e,Yt,t),e}function ke(e,t,r){let n=t;for(;n!==void 0;){let o=e.parent(n);if(o===r)return n;n=o}}function He(e,t,r){var n;let o=e.nodes().filter(p=>e.children(p).length),i={};o.forEach(p=>{let f=e.node(p);if(f&&f.rankdir){let m=new T({multigraph:!0,compound:!0});m.setGraph({rankdir:f.rankdir});let E=e.children(p);E.forEach(O=>{let k={...e.node(O)};m.setNode(O,k);let C=e.parent(O);C&&C!==p&&E.includes(C)&&m.setParent(O,C)});let N=new Set;e.edges().forEach(O=>{let k=ke(e,O.v,p),C=ke(e,O.w,p);if(k&&C&&k!==C){let F=`${k}\\\\0${C}`;N.has(F)||(N.add(F),m.setEdge(k,C,{...e.edge(O)}))}}),He(m,t,r);let S=Ie(m);xe(S,t,r,null),Ne(m,S);let _=1/0,L=1/0,M=-1/0,I=-1/0;m.nodes().forEach(O=>{if(O===p)return;let k=m.node(O);k&&typeof k.x==\"number\"&&typeof k.y==\"number\"&&typeof k.width==\"number\"&&typeof k.height==\"number\"&&(_=Math.min(_,k.x-k.width/2),M=Math.max(M,k.x+k.width/2),L=Math.min(L,k.y-k.height/2),I=Math.max(I,k.y+k.height/2))}),(!isFinite(_)||!isFinite(L)||!isFinite(M)||!isFinite(I))&&(_=L=0,M=I=0);let x=M-_,j=I-L;i[p]={minX:_,minY:L,maxX:M,maxY:I,width:x,height:j,offsetX:_,offsetY:L},f._dagreClusterSubgraph=m}});let s=[],d=p=>{let f=[],m=(e.children(p)||[]).filter(E=>E!==p);for(;m.length>0;){let E=m.shift();f.push(E),(e.children(E)||[]).filter(N=>N!==E).forEach(N=>m.push(N))}return f},a=new Map;o.forEach(p=>{let f=e.node(p);f&&f.rankdir&&i[p]&&a.set(p,(e.children(p)||[]).filter(m=>m!==p))});let l=new Set([...a.values()].flat()),u=new Map;a.forEach((p,f)=>{l.has(f)||u.set(f,d(f))});let h=new Set([...u.values()].flat()),c=p=>{for(let[f,m]of u)if(m.includes(p))return f;return p},g=[];e.edges().forEach(p=>{(h.has(p.v)||h.has(p.w))&&g.push({edge:p,label:e.edge(p)})});let w=new Map;h.forEach(p=>{let f=e.parent(p);w.set(p,typeof f==\"string\"?f:void 0)}),u.forEach((p,f)=>{let m=e.node(f),E=[];p.forEach(_=>{let L=e.node(_);L&&(E.push({id:_,node:L,parent:w.get(_)}),e.removeNode(_))});let N=g.filter(({edge:_})=>p.includes(_.v)||p.includes(_.w)),S=i[f];m&&(s.push({clusterId:f,subgraph:m._dagreClusterSubgraph,bounds:S,children:p,removedNodes:E,removedEdges:N}),m.width=S.width,m.height=S.height)});let b=new Set;g.forEach(({edge:p,label:f})=>{let m=c(p.v),E=c(p.w);if(m!==E&&e.hasNode(m)&&e.hasNode(E)){let N=`${m}\\\\0${E}`;b.has(N)||(b.add(N),e.setEdge(m,E,{...f,width:0,height:0}))}});let y=Ie(e),v=xe(y,t,r,(n=_e.get(e))!=null?n:null);_e.set(e,v),Ne(e,y),b.forEach(p=>{let f=p.indexOf(\"\\\\0\"),m=p.slice(0,f),E=p.slice(f+1);e.hasEdge(m,E)&&e.removeEdge(m,E)}),s.forEach(({clusterId:p,subgraph:f,bounds:m,removedNodes:E,removedEdges:N})=>{var S,_;let L=e.node(p),M=(S=L==null?void 0:L.x)!=null?S:0,I=(_=L==null?void 0:L.y)!=null?_:0,x=(m.minX+m.maxX)/2,j=(m.minY+m.maxY)/2;E.forEach(({id:O,node:k,parent:C})=>{e.setNode(O,k),C!==void 0&&e.setParent(O,C)}),N.forEach(({edge:O,label:k})=>{e.setEdge(O,k)}),f.nodes().forEach(O=>{if(O===p)return;let k=f.node(O),C=e.node(O);C&&k&&typeof k.x==\"number\"&&typeof k.y==\"number\"&&(C.x=M+(k.x-x),C.y=I+(k.y-j))}),delete L._dagreClusterSubgraph}),o.forEach(p=>{var f,m;let E=e.node(p),N=i[p];if(E&&E.rankdir&&E._dagreClusterSubgraph&&N){let S=E._dagreClusterSubgraph,_=(f=E.x)!=null?f:0,L=(m=E.y)!=null?m:0,M=(N.minX+N.maxX)/2,I=(N.minY+N.maxY)/2;S.nodes().forEach(x=>{if(x===p)return;let j=S.node(x),O=e.node(x);if(O&&j&&typeof j.x==\"number\"&&typeof j.y==\"number\"){let k=j.x-M,C=j.y-I;O.x=_+k,O.y=L+C}}),delete E._dagreClusterSubgraph}})}function xe(e,t,r,n=null){var o,i;let s=(r==null?void 0:r.useDynamic)!==!1,d=s&&(o=n==null?void 0:n.graph)!=null?o:null,a=s&&(i=n==null?void 0:n.rawNodes)!=null?i:null;t(\"    makeSpaceForEdgeLabels\",()=>fn(e)),t(\"    removeSelfEdges\",()=>_n(e)),t(\"    acyclic\",()=>Jt(e,d)),t(\"    nestingGraph.run\",()=>br(e)),t(\"    rank\",()=>hr(Fe(e))),t(\"    injectEdgeLabelProxies\",()=>gn(e)),t(\"    removeEmptyRanks\",()=>Rt(e)),t(\"    nestingGraph.cleanup\",()=>_r(e)),t(\"    normalizeRanks\",()=>Tt(e)),t(\"    assignRankMinMax\",()=>pn(e)),t(\"    removeEdgeLabelProxies\",()=>mn(e)),t(\"    normalize.run\",()=>Ht(e)),t(\"    parentDummyChains\",()=>pr(e)),t(\"    addBorderSegments\",()=>kr(e)),t(\"    order\",()=>Ke(e,r,a)),t(\"    insertSelfEdges\",()=>kn(e)),t(\"    adjustCoordinateSystem\",()=>Nr(e)),t(\"    position\",()=>nn(e,r.corePath)),t(\"    positionSelfEdges\",()=>xn(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(\"    removeBorderNodes\",()=>yn(e)),t(\"    normalize.undo\",()=>er(e)),t(\"    fixupEdgeLabelCoords\",()=>bn(e)),t(\"    undoCoordinateSystem\",()=>Or(e)),t(\"    translateGraph\",()=>wn(e)),t(\"    assignNodeIntersects\",()=>vn(e)),t(\"    reversePoints\",()=>En(e)),t(\"    acyclic.undo\",()=>Qt(e)),{graph:e,rawNodes:l}}function Ne(e,t){e.nodes().forEach(r=>{let n=e.node(r),o=t.node(r);n&&(n.x=o.x,n.y=o.y,n.order=o.order,n.rank=o.rank,t.children(r).length&&(n.width=o.width,n.height=o.height))}),e.edges().forEach(r=>{let n=e.edge(r),o=t.edge(r);n.points=o.points,Object.hasOwn(o,\"x\")&&(n.x=o.x,n.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var sn=[\"nodesep\",\"edgesep\",\"ranksep\",\"marginx\",\"marginy\"],dn={ranksep:50,edgesep:20,nodesep:50,rankdir:\"TB\",rankalign:\"center\"},ln=[\"acyclicer\",\"ranker\",\"rankdir\",\"align\",\"rankalign\"],an=[\"width\",\"height\",\"rank\"],Oe={width:0,height:0},un=[\"minlen\",\"weight\",\"width\",\"height\",\"labeloffset\"],hn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:\"r\"},cn=[\"labelpos\"];function Ie(e){let t=new T({multigraph:!0,compound:!0}),r=ee(e.graph());return t.setGraph(Object.assign({},dn,Z(r,sn),X(r,ln))),e.nodes().forEach(n=>{let o=ee(e.node(n)),i=Z(o,an);Object.keys(Oe).forEach(d=>{i[d]===void 0&&(i[d]=Oe[d])}),t.setNode(n,i);let s=e.parent(n);s!==void 0&&t.setParent(n,s)}),e.edges().forEach(n=>{let o=ee(e.edge(n));t.setEdge(n,Object.assign({},hn,Z(o,un),X(o,cn)))}),t}function fn(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(r=>{var n;let o=e.edge(r);o.minlen*=2,((n=o.labelpos)!=null?n:\"r\").toLowerCase()!==\"c\"&&(t.rankdir===\"TB\"||t.rankdir===\"BT\"?o.width+=o.labeloffset:o.height+=o.labeloffset)})}function gn(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.width&&r.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};D(e,\"edge-proxy\",o,\"_ep\")}})}function pn(e){let t=0;e.nodes().forEach(r=>{let n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Math.max(t,n.maxRank))}),e.graph().maxRank=t}function mn(e){e.nodes().forEach(t=>{let r=e.node(t);if(r.dummy===\"edge-proxy\"){let n=r;e.edge(n.e).labelRank=r.rank,e.removeNode(t)}})}function wn(e){let t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,d=i.marginy||0;function a(l){let u=l.x,h=l.y,c=l.width,g=l.height;t=Math.min(t,u-c/2),r=Math.max(r,u+c/2),n=Math.min(n,h-g/2),o=Math.max(o,h+g/2)}e.nodes().forEach(l=>a(e.node(l))),e.edges().forEach(l=>{let u=e.edge(l);Object.hasOwn(u,\"x\")&&a(u)}),t-=s,n-=d,e.nodes().forEach(l=>{let u=e.node(l);u.x-=t,u.y-=n}),e.edges().forEach(l=>{let u=e.edge(l);u.points.forEach(h=>{h.x-=t,h.y-=n}),Object.hasOwn(u,\"x\")&&(u.x-=t),Object.hasOwn(u,\"y\")&&(u.y-=n)}),i.width=r-t+s,i.height=o-n+d}function vn(e){e.edges().forEach(t=>{if(t.v===t.w)return;let r=e.edge(t),n=e.node(t.v),o=e.node(t.w),i,s;r.points?(i=r.points[0],s=r.points[r.points.length-1]):(r.points=[],i=o,s=n),r.points.unshift(he(n,i)),r.points.push(he(o,s))})}function bn(e){e.edges().forEach(t=>{let r=e.edge(t);if(Object.hasOwn(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 En(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function yn(e){e.nodes().forEach(t=>{if(e.children(t).length){let r=e.node(t),n=e.node(r.borderTop),o=e.node(r.borderBottom),i=e.node(r.borderLeft[r.borderLeft.length-1]),s=e.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-i.x),r.height=Math.abs(o.y-n.y),r.x=i.x+r.width/2,r.y=n.y+r.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===\"border\"&&e.removeNode(t)})}function _n(e){e.edges().forEach(t=>{if(t.v===t.w){let r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function kn(e){q(e).forEach(t=>{let r=0;t.forEach((n,o)=>{let i=e.node(n);typeof i.rank!=\"number\"&&(i.rank=0),i.order=o+r,(i.selfEdges||[]).forEach(s=>{D(e,\"selfedge\",{width:s.label.width,height:s.label.height,rank:i.rank,order:o+ ++r,e:s.e,edgeLabel:s.label},\"_se\"),(!Array.isArray(s.label.points)||s.label.points.length!==7)&&(s.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function xn(e){e.nodes().forEach(t=>{let r=e.node(t),n=o=>typeof o==\"number\"&&isFinite(o);if(r.dummy===\"selfedge\"){let o=r,i=e.node(o.e.v),s=n(i==null?void 0:i.x)?i.x:0,d=n(i==null?void 0:i.y)?i.y:0,a=n(i==null?void 0:i.width)?i.width:0,l=n(i==null?void 0:i.height)?i.height:0,u=n(r.x)?r.x:s,h=n(r.y)?r.y:d,c=a/2,g=l/2;o.edgeLabel.points=[{x:u+c,y:h-g},{x:u+c,y:h-g},{x:u,y:h},{x:u-c,y:h+g},{x:u-c,y:h+g},{x:u,y:h},{x:u,y:h}],o.edgeLabel.x=u,o.edgeLabel.y=h,e.setEdge(o.e,o.edgeLabel),e.removeNode(t)}else r&&Array.isArray(r.selfEdges)&&r.selfEdges.forEach(o=>{if(!Array.isArray(o.label.points)||o.label.points.length!==7){let i=n(r.x)?r.x:0,s=n(r.y)?r.y:0,d=n(r.width)?r.width:0,a=n(r.height)?r.height:0,l=d/2,u=a/2;o.label.points=[{x:i+l,y:s-u},{x:i+l,y:s-u},{x:i,y:s},{x:i-l,y:s+u},{x:i-l,y:s+u},{x:i,y:s},{x:i,y:s}]}})})}function Z(e,t){return z(X(e,t),Number)}function ee(e){let t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r==\"string\"&&(r=r.toLowerCase()),t[r]=n}),t}/*! For license information please see dagre.esm.js.LEGAL.txt */function V(e,t){var i,s;if(e===null||typeof e!=\"object\"){if(typeof e==\"function\")throw new TypeError(\"structuredClone: a function could not be cloned.\");return e}let r=t.get(e);if(r!==void 0)return r;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e)){let d=Array.from({length:e.length});t.set(e,d);for(let a=0;a<e.length;a+=1)d[a]=V(e[a],t);return d}if(e instanceof Map){let d=new Map;t.set(e,d);for(let[a,l]of e)d.set(V(a,t),V(l,t));return d}if(e instanceof Set){let d=new Set;t.set(e,d);for(let a of e)d.add(V(a,t));return d}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw new TypeError(`structuredClone: ${(s=(i=n==null?void 0:n.constructor)==null?void 0:i.name)!=null?s:\"object\"} could not be cloned.`);let o={};t.set(e,o);for(let[d,a]of Object.entries(e))o[d]=V(a,t);return o}function Nn(e){return V(e,new Map)}function Ze(){let e=globalThis;typeof e.structuredClone!=\"function\"&&(e.structuredClone=Nn)}var J={direction:\"TB\",nodeSpacing:60,rankSpacing:90,edgeSpacing:20};function le(){return typeof performance!=\"undefined\"&&typeof performance.now==\"function\"?performance.now():Date.now()}function et(e){return Math.round(e*100)/100}function tt(e,t){return e.id<t.id?-1:e.id>t.id?1:0}function rt(e){let t=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let n of e)n.x<t&&(t=n.x),n.y<r&&(r=n.y);return{x:t,y:r}}function nt(e){var w,b,y,v,p;Ze();let t=le(),r=(w=e.options)!=null?w:{},n=[...e.nodes].sort(tt),o=r.subset?new Set(r.subset):void 0,i=o?n.filter(f=>o.has(f.id)):n,s=new Set(i.map(f=>f.id)),d={};for(let f of n)d[f.id]=f.position;if(i.length===0)return{positions:d,moved:[],engine:\"dagre\",ms:le()-t};let a=new T({multigraph:!0,compound:!1,directed:!0});a.setGraph({rankdir:(b=r.direction)!=null?b:J.direction,nodesep:(y=r.nodeSpacing)!=null?y:J.nodeSpacing,ranksep:(v=r.rankSpacing)!=null?v:J.rankSpacing,edgesep:(p=r.edgeSpacing)!=null?p:J.edgeSpacing,marginx:0,marginy:0}),a.setDefaultEdgeLabel(()=>({}));for(let f of i)a.setNode(f.id,{width:f.width,height:f.height});for(let f of[...e.edges].sort(tt))!s.has(f.source)||!s.has(f.target)||a.setEdge(f.source,f.target,{},f.id);Ue(a);let l={};for(let f of i){let m=a.node(f.id);l[f.id]=m&&Number.isFinite(m.x)&&Number.isFinite(m.y)?{x:m.x-f.width/2,y:m.y-f.height/2}:f.position}let u=rt(i.map(f=>f.position)),h=rt(i.map(f=>l[f.id])),c=u.x-h.x,g=u.y-h.y;for(let f of i)d[f.id]={x:et(l[f.id].x+c),y:et(l[f.id].y+g)};return{positions:d,moved:i.map(f=>f.id),engine:\"dagre\",ms:le()-t}}function On(e){let t=e;if(!(!t||typeof t!=\"object\")){if(t.t===\"ping\")return{t:\"pong\"};if(t.t===\"layout\")try{return{t:\"result\",id:t.id,result:nt(t.request)}}catch(r){return{t:\"error\",id:t.id,message:r instanceof Error?r.message:String(r)}}}}function In(){return typeof WorkerGlobalScope!=\"undefined\"&&typeof self!=\"undefined\"&&self instanceof WorkerGlobalScope}In()&&self.addEventListener(\"message\",e=>{let t=On(e.data);t&&self.postMessage(t)});})();\\n';\nconst layoutWorkerSha256 = \"d8f40e8264dee88e361017837607069470eea6f61591cef70bb4b29c0e3a09dd\";\nconst layoutWorkerBytes = 50854;\nexport {\n  layoutWorkerBytes,\n  layoutWorkerSha256,\n  layoutWorkerSource\n};\n//# sourceMappingURL=worker.generated.js.map\n"],"mappings":";AAAA,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB"}