md/assets/layout-CQdKReqy.js

2 lines
26 KiB
JavaScript
Raw Normal View History

import{G as g}from"./graph-CrdeYfFz.js";import{b0 as Te,aS as Ie,aV as X,bk as Me,a$ as ce,a_ as ee,aY as F,aX as le,bl as Se,bm as je,aR as $,aC as Fe,aD as Ve,bn as Ae,bo as Be,bp as C,aF as Ye,as as m,bq as T,br as Ge,bs as q}from"./index-EOHikjcP.js";import{d as he,e as ve,a as f,f as _,v as x,r as M}from"./_baseUniq-H04t_fXT.js";import{b as pe,a as De,c as $e,t as V,m as w,d as L,h as we,f as z,l as I,e as qe}from"./min-Dppjuofo.js";function We(e,n){return e==null?e:Te(e,he(n),Ie)}function Xe(e,n){return e&&ve(e,he(n))}function ze(e,n){return e>n}function S(e,n){var r={};return n=X(n),ve(e,function(t,a,i){Me(r,a,n(t,a,i))}),r}function y(e){return e&&e.length?pe(e,ce,ze):void 0}function U(e,n){return e&&e.length?pe(e,X(n),De):void 0}function Ue(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function He(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,i=ee(e),o=n!==void 0,u=n===null,d=n===n,s=ee(n);if(!u&&!s&&!i&&e>n||i&&o&&d&&!u&&!s||t&&o&&d||!r&&d||!a)return 1;if(!t&&!i&&!s&&e<n||s&&r&&a&&!t&&!i||u&&r&&a||!o&&a||!d)return-1}return 0}function Je(e,n,r){for(var t=-1,a=e.criteria,i=n.criteria,o=a.length,u=r.length;++t<o;){var d=He(a[t],i[t]);if(d){if(t>=u)return d;var s=r[t];return d*(s=="desc"?-1:1)}}return e.index-n.index}function Ze(e,n,r){n.length?n=F(n,function(i){return le(i)?function(o){return Se(o,i.length===1?i[0]:i)}:i}):n=[ce];var t=-1;n=F(n,je(X));var a=$e(e,function(i,o,u){var d=F(n,function(s){return s(i)});return{criteria:d,index:++t,value:i}});return Ue(a,function(i,o){return Je(i,o,r)})}var Ke=Math.ceil,Qe=Math.max;function en(e,n,r,t){for(var a=-1,i=Qe(Ke((n-e)/(r||1)),0),o=Array(i);i--;)o[++a]=e,e+=r;return o}function nn(e){return function(n,r,t){return t&&typeof t!="number"&&$(n,r,t)&&(r=t=void 0),n=V(n),r===void 0?(r=n,n=0):r=V(r),t=t===void 0?n<r?1:-1:V(t),en(n,r,t)}}var E=nn(),R=Fe(function(e,n){if(e==null)return[];var r=n.length;return r>1&&$(e,n[0],n[1])?n=[]:r>2&&$(n[0],n[1],n[2])&&(n=[n[0]]),Ze(e,Ve(n),[])}),rn=0;function H(e){var n=++rn;return Ae(e)+n}function tn(e,n,r){for(var t=-1,a=e.length,i=n.length,o={};++t<a;){var u=t<i?n[t]:void 0;r(o,e[t],u)}return o}function an(e,n){return tn(e||[],n||[],Be)}class on{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return ne(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&ne(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,un)),t=t._prev;return"["+n.join(", ")+"]"}}function ne(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function un(e,n){if(e!=="_next"&&e!=="_prev")return n}var dn=Ye(1);function sn(e,n){if(e.nodeCount()<=1)return[];var r=cn(e,n||dn),t=fn(r.graph,r.buckets,r.zeroIdx);return C(w(t,function(a){return e.outEdges(a.v,a.w)}))}function fn(e,n,r){for(var t=[],a=n[n.length-1],i=n[0],o;e.nodeCount();){for(;o=i.dequeue();)A(e,n,r,o);for(;o=a.dequeue();)A(e,n,r,o);if(e.nodeCount()){for(var u=n.length-2;u>0;--u)if(o=n[u].dequeue(),o){t=t.concat(A(e,n,r,o,!0));break}}}return t}function A(e,n,r,t,a){var i=a?[]:void 0;return f(e.inEdges(t.v),function(o){var u=e.edge(o),d=e.node(o.v);a&&i.push({v:o.v,w:o.w}),d.out-=u,W(n,r,d)}),f(e.outEdges(t.v),function(o){var u=e.edge(o),d=o.w,s=e.node(d);s.in-=u,W(n,r,s)}),e.removeNode(t.v),i}function cn(e,n){var r=new g,t=0,a=0;f(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),f(e.edges(),function(u){var d=r.edge(u.v,u.w)||0,s=n(u),c=d+s;r.setEdge(u.v,u.w,c),a=Math.max(a,r.node(u.v).out+=s),t=Math.max(t,r.node(u.w).in+=s)});var i=E(a+t+3).map(function(){return new on}),o=t+1;return f(r.nodes(),function(u){W(i,o,r.node(u))}),{graph:r,buckets:i,zeroIdx:o}}function W(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 ln(e){var n=e.graph().acyclicer==="greedy"?sn(e,r(e)):hn(e);f(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,H("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function hn(e){v