import{aH as $,aI as He,aJ as T,ay as y,aK as Ye,aL as qe,ax as Ae,aM as Ze,aN as Oe,aO as D,av as Z,aP as Xe,aQ as Te,aR as Je,aS as C,aE as Ee,aT as x,aq as me,aU as Qe,aV as Y,aW as We,aX as ze,aY as L,aD as Ve,aZ as ke,aw as en,a_ as ne,a$ as nn,b0 as rn,aC as tn,aB as we,az as sn,b1 as j,at as an,b2 as un,aF as N,ad as re,b3 as te}from"./intro-yEGgrrvb.js";var fn="[object Symbol]";function X(e){return typeof e=="symbol"||$(e)&&He(e)==fn}function Pe(e,n){for(var r=-1,t=e==null?0:e.length,i=Array(t);++r-1}function O(e){return Ae(e)?Ye(e):qe(e)}var _n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pn=/^\w*$/;function J(e,n){if(y(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||X(e)?!0:pn.test(e)||!_n.test(e)||n!=null&&e in Object(n)}var bn=500;function yn(e){var n=Ze(e,function(t){return r.size===bn&&r.clear(),t}),r=n.cache;return n}var An=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,On=/\\(\\)?/g,Tn=yn(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(""),e.replace(An,function(r,t,i,s){n.push(i?s.replace(On,"$1"):t||r)}),n});function En(e){return e==null?"":ve(e)}function $e(e,n){return y(e)?e:J(e,n)?[e]:Tn(En(e))}function G(e){if(typeof e=="string"||X(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}function Ce(e,n){n=$e(n,e);for(var r=0,t=n.length;e!=null&&ru))return!1;var g=s.get(e),l=s.get(n);if(g&&l)return g==n&&l==e;var o=-1,h=!0,A=r&qr?new I:void 0;for(s.set(e,n),s.set(n,e);++o=Dt){var g=xt(e);if(g)return z(g);a=!1,i=De,f=new I}else f=u;e:for(;++t1?i.setNode(s,r):i.setNode(s)}),this}setNode(n,r){return Object.prototype.hasOwnProperty.call(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=w,this._children[n]={},this._children[w][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)}node(n){return this._nodes[n]}hasNode(n){return Object.prototype.hasOwnProperty.call(this._nodes,n)}removeNode(n){if(Object.prototype.hasOwnProperty.call(this._nodes,n)){var r=t=>this.removeEdge(this._edgeObjs[t]);delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],m(this.children(n),t=>{this.setParent(t)}),delete this._children[n]),m(O(this._in[n]),r),delete this._in[n],delete this._preds[n],m(O(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this}setParent(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(P(r))r=w;else{r+="";for(var t=r;!P(t);t=this.parent(t))if(t===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this}_removeFromParentsChildList(n){delete this._children[this._parent[n]][n]}parent(n){if(this._isCompound){var r=this._parent[n];if(r!==w)return r}}children(n){if(P(n)&&(n=w),this._isCompound){var r=this._children[n];if(r)return O(r)}else{if(n===w)return this.nodes();if(this.hasNode(n))return[]}}predecessors(n){var r=this._preds[n];if(r)return O(r)}successors(n){var r=this._sucs[n];if(r)return O(r)}neighbors(n){var r=this.predecessors(n);if(r)return jt(r,this.successors(n))}isLeaf(n){var r;return this.isDirected()?r=this.successors(n):r=this.neighbors(n),r.length===0}filterNodes(n){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var t=this;m(this._nodes,function(a,u){n(u)&&r.setNode(u,a)}),m(this._edgeObjs,function(a){r.hasNode(a.v)&&r.hasNode(a.w)&&r.setEdge(a,t.edge(a))});var i={};function s(a){var u=t.parent(a);return u===void 0||r.hasNode(u)?(i[a]=u,u):u in i?i[u]:s(u)}return this._isCompound&&m(r.nodes(),function(a){r.setParent(a,s(a))}),r}setDefaultEdgeLabel(n){return re(n)||(n=N(n)),this._defaultEdgeLabelFn=n,this}edgeCount(){return this._edgeCount}edges(){return K(this._edgeObjs)}setPath(n,r){var t=this,i=arguments;return Mt(n,function(s,a){return i.length>1?t.setEdge(s,a,r):t.setEdge(s,a),a}),this}setEdge(){var n,r,t,i,s=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(n=a.v,r=a.w,t=a.name,arguments.length===2&&(i=arguments[1],s=!0)):(n=a,r=arguments[1],t=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),n=""+n,r=""+r,P(t)||(t=""+t);var u=v(this._isDirected,n,r,t);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,u))return s&&(this._edgeLabels[u]=i),this;if(!P(t)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(r),this._edgeLabels[u]=s?i:this._defaultEdgeLabelFn(n,r,t);var f=Bt(this._isDirected,n,r,t);return n=f.v,r=f.w,Object.freeze(f),this._edgeObjs[u]=f,be(this._preds[r],n),be(this._sucs[n],r),this._in[r][u]=f,this._out[n][u]=f,this._edgeCount++,this}edge(n,r,t){var i=arguments.length===1?H(this._isDirected,arguments[0]):v(this._isDirected,n,r,t);return this._edgeLabels[i]}hasEdge(n,r,t){var i=arguments.length===1?H(this._isDirected,arguments[0]):v(this._isDirected,n,r,t);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(n,r,t){var i=arguments.length===1?H(this._isDirected,arguments[0]):v(this._isDirected,n,r,t),s=this._edgeObjs[i];return s&&(n=s.v,r=s.w,delete this._edgeLabels[i],delete this._edgeObjs[i],ye(this._preds[r],n),ye(this._sucs[n],r),delete this._in[r][i],delete this._out[n][i],this._edgeCount--),this}inEdges(n,r){var t=this._in[n];if(t){var i=K(t);return r?R(i,function(s){return s.v===r}):i}}outEdges(n,r){var t=this._out[n];if(t){var i=K(t);return r?R(i,function(s){return s.w===r}):i}}nodeEdges(n,r){var t=this.inEdges(n,r);if(t)return t.concat(this.outEdges(n,r))}}Ke.prototype._nodeCount=0;Ke.prototype._edgeCount=0;function be(e,n){e[n]?e[n]++:e[n]=1}function ye(e,n){--e[n]||delete e[n]}function v(e,n,r,t){var i=""+n,s=""+r;if(!e&&i>s){var a=i;i=s,s=a}return i+pe+s+pe+(P(t)?Ut:t)}function Bt(e,n,r,t){var i=""+n,s=""+r;if(!e&&i>s){var a=i;i=s,s=a}var u={v:i,w:s};return t&&(u.name=t),u}function H(e,n){return v(e,n.v,n.w,n.name)}export{Ke as G,X as a,U as b,Pn as c,Be as d,dn as e,k as f,Pe as g,It as h,P as i,$t as j,O as k,Ot as l,$e as m,Ce as n,Tt as o,En as p,m as q,R as r,Mt as s,G as t,K as v};