import { C as e, E as t, S as n, T as r, a as i, b as a, c as o, i as s, n as c, s as l, t as u, w as d, x as f } from "./reduce-DbMsJ4nx.js";
import { C as p, E as m, g as ee, h, l as g, p as te, u as _, v, w as ne } from "./_baseFor-DZ1vnh4H.js";
import { n as y, t as b } from "./isEmpty-CVG4Bj-P.js";
import { A as re, C as x, D as S, E as ie, M as ae, O as oe, T as se, j as C, k as ce, w, x as T, y as le } from "./chunk-5PVQY5BW-BCjrVrWB.js";
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js
function ue(e, t) {
	return e && w(t, f(t), e);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js
function de(e, t) {
	return e && w(t, x(t), e);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js
function fe(e, t) {
	return w(e, n(e), t);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js
var E = Object.getOwnPropertySymbols ? function(e) {
	for (var t = []; e;) r(t, n(e)), e = oe(e);
	return t;
} : e;
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js
function pe(e, t) {
	return w(e, E(e), t);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js
function me(e) {
	return d(e, x, E);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js
var he = Object.prototype.hasOwnProperty;
function ge(e) {
	var t = e.length, n = new e.constructor(t);
	return t && typeof e[0] == "string" && he.call(e, "index") && (n.index = e.index, n.input = e.input), n;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js
function _e(e, t) {
	var n = t ? C(e.buffer) : e.buffer;
	return new e.constructor(n, e.byteOffset, e.byteLength);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js
var D = /\w*$/;
function O(e) {
	var t = new e.constructor(e.source, D.exec(e));
	return t.lastIndex = e.lastIndex, t;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js
var k = m ? m.prototype : void 0, A = k ? k.valueOf : void 0;
function j(e) {
	return A ? Object(A.call(e)) : {};
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js
var M = "[object Boolean]", N = "[object Date]", P = "[object Map]", F = "[object Number]", I = "[object RegExp]", ve = "[object Set]", ye = "[object String]", be = "[object Symbol]", xe = "[object ArrayBuffer]", Se = "[object DataView]", Ce = "[object Float32Array]", we = "[object Float64Array]", Te = "[object Int8Array]", Ee = "[object Int16Array]", De = "[object Int32Array]", Oe = "[object Uint8Array]", ke = "[object Uint8ClampedArray]", Ae = "[object Uint16Array]", je = "[object Uint32Array]";
function Me(e, t, n) {
	var r = e.constructor;
	switch (t) {
		case xe: return C(e);
		case M:
		case N: return new r(+e);
		case Se: return _e(e, n);
		case Ce:
		case we:
		case Te:
		case Ee:
		case De:
		case Oe:
		case ke:
		case Ae:
		case je: return re(e, n);
		case P: return new r();
		case F:
		case ye: return new r(e);
		case I: return O(e);
		case ve: return new r();
		case be: return j(e);
	}
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js
var Ne = "[object Map]";
function Pe(e) {
	return h(e) && y(e) == Ne;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js
var L = g && g.isMap, Fe = L ? _(L) : Pe, Ie = "[object Set]";
function Le(e) {
	return h(e) && y(e) == Ie;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js
var R = g && g.isSet, Re = R ? _(R) : Le, ze = 1, Be = 2, Ve = 4, z = "[object Arguments]", He = "[object Array]", Ue = "[object Boolean]", We = "[object Date]", Ge = "[object Error]", B = "[object Function]", Ke = "[object GeneratorFunction]", qe = "[object Map]", Je = "[object Number]", V = "[object Object]", Ye = "[object RegExp]", Xe = "[object Set]", Ze = "[object String]", Qe = "[object Symbol]", $e = "[object WeakMap]", et = "[object ArrayBuffer]", tt = "[object DataView]", nt = "[object Float32Array]", rt = "[object Float64Array]", it = "[object Int8Array]", at = "[object Int16Array]", ot = "[object Int32Array]", st = "[object Uint8Array]", ct = "[object Uint8ClampedArray]", lt = "[object Uint16Array]", ut = "[object Uint32Array]", H = {};
H[z] = H[He] = H[et] = H[tt] = H[Ue] = H[We] = H[nt] = H[rt] = H[it] = H[at] = H[ot] = H[qe] = H[Je] = H[V] = H[Ye] = H[Xe] = H[Ze] = H[Qe] = H[st] = H[ct] = H[lt] = H[ut] = !0, H[Ge] = H[B] = H[$e] = !1;
function U(e, t, n, r, i, o) {
	var c, l = t & ze, u = t & Be, d = t & Ve;
	if (n && (c = i ? n(e, r, i, o) : n(e)), c !== void 0) return c;
	if (!ne(e)) return e;
	var p = ee(e);
	if (p) {
		if (c = ge(e), !l) return ce(e, c);
	} else {
		var m = y(e), h = m == B || m == Ke;
		if (te(e)) return ae(e, l);
		if (m == V || m == z || h && !i) {
			if (c = u || h ? {} : S(e), !l) return u ? pe(e, de(c, e)) : fe(e, ue(c, e));
		} else {
			if (!H[m]) return i ? e : {};
			c = Me(e, m, l);
		}
	}
	o ||= new v();
	var g = o.get(e);
	if (g) return g;
	o.set(e, c), Re(e) ? e.forEach(function(r) {
		c.add(U(r, t, n, r, e, o));
	}) : Fe(e) && e.forEach(function(r, i) {
		c.set(i, U(r, t, n, i, e, o));
	});
	var _ = p ? void 0 : (d ? u ? me : a : u ? x : f)(e);
	return s(_ || e, function(r, i) {
		_ && (i = r, r = e[i]), se(c, i, U(r, t, n, i, e, o));
	}), c;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseValues.js
function W(e, n) {
	return t(n, function(t) {
		return e[t];
	});
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/values.js
function G(e) {
	return e == null ? [] : W(e, f(e));
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js
function K(e) {
	return e === void 0;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/union.js
var dt = le(function(e) {
	return i(l(e, 1, ie, !0));
}), ft = "\0", q = "\0", J = "", Y = class {
	constructor(e = {}) {
		this._isDirected = Object.prototype.hasOwnProperty.call(e, "directed") ? e.directed : !0, this._isMultigraph = Object.prototype.hasOwnProperty.call(e, "multigraph") ? e.multigraph : !1, this._isCompound = Object.prototype.hasOwnProperty.call(e, "compound") ? e.compound : !1, this._label = void 0, this._defaultNodeLabelFn = T(void 0), this._defaultEdgeLabelFn = T(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[q] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
	}
	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 p(e) || (e = T(e)), this._defaultNodeLabelFn = e, this;
	}
	nodeCount() {
		return this._nodeCount;
	}
	nodes() {
		return f(this._nodes);
	}
	sources() {
		var e = this;
		return o(this.nodes(), function(t) {
			return b(e._in[t]);
		});
	}
	sinks() {
		var e = this;
		return o(this.nodes(), function(t) {
			return b(e._out[t]);
		});
	}
	setNodes(e, t) {
		var n = arguments, r = this;
		return c(e, function(e) {
			n.length > 1 ? r.setNode(e, t) : r.setNode(e);
		}), this;
	}
	setNode(e, t) {
		return Object.prototype.hasOwnProperty.call(this._nodes, e) ? (arguments.length > 1 && (this._nodes[e] = t), this) : (this._nodes[e] = arguments.length > 1 ? t : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = q, this._children[e] = {}, this._children[q][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 Object.prototype.hasOwnProperty.call(this._nodes, e);
	}
	removeNode(e) {
		if (Object.prototype.hasOwnProperty.call(this._nodes, e)) {
			var t = (e) => this.removeEdge(this._edgeObjs[e]);
			delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], c(this.children(e), (e) => {
				this.setParent(e);
			}), delete this._children[e]), c(f(this._in[e]), t), delete this._in[e], delete this._preds[e], c(f(this._out[e]), t), delete this._out[e], delete this._sucs[e], --this._nodeCount;
		}
		return this;
	}
	setParent(e, t) {
		if (!this._isCompound) throw Error("Cannot set parent in a non-compound graph");
		if (K(t)) t = q;
		else {
			t += "";
			for (var n = t; !K(n); n = this.parent(n)) if (n === e) throw 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;
	}
	_removeFromParentsChildList(e) {
		delete this._children[this._parent[e]][e];
	}
	parent(e) {
		if (this._isCompound) {
			var t = this._parent[e];
			if (t !== q) return t;
		}
	}
	children(e) {
		if (K(e) && (e = q), this._isCompound) {
			var t = this._children[e];
			if (t) return f(t);
		} else if (e === q) return this.nodes();
		else if (this.hasNode(e)) return [];
	}
	predecessors(e) {
		var t = this._preds[e];
		if (t) return f(t);
	}
	successors(e) {
		var t = this._sucs[e];
		if (t) return f(t);
	}
	neighbors(e) {
		var t = this.predecessors(e);
		if (t) return dt(t, this.successors(e));
	}
	isLeaf(e) {
		return (this.isDirected() ? this.successors(e) : this.neighbors(e)).length === 0;
	}
	filterNodes(e) {
		var t = new this.constructor({
			directed: this._isDirected,
			multigraph: this._isMultigraph,
			compound: this._isCompound
		});
		t.setGraph(this.graph());
		var n = this;
		c(this._nodes, function(n, r) {
			e(r) && t.setNode(r, n);
		}), c(this._edgeObjs, function(e) {
			t.hasNode(e.v) && t.hasNode(e.w) && t.setEdge(e, n.edge(e));
		});
		var r = {};
		function i(e) {
			var a = n.parent(e);
			return a === void 0 || t.hasNode(a) ? (r[e] = a, a) : a in r ? r[a] : i(a);
		}
		return this._isCompound && c(t.nodes(), function(e) {
			t.setParent(e, i(e));
		}), t;
	}
	setDefaultEdgeLabel(e) {
		return p(e) || (e = T(e)), this._defaultEdgeLabelFn = e, this;
	}
	edgeCount() {
		return this._edgeCount;
	}
	edges() {
		return G(this._edgeObjs);
	}
	setPath(e, t) {
		var n = this, r = arguments;
		return u(e, function(e, i) {
			return r.length > 1 ? n.setEdge(e, i, t) : n.setEdge(e, i), i;
		}), this;
	}
	setEdge() {
		var e, t, n, r, i = !1, a = arguments[0];
		typeof a == "object" && a && "v" in a ? (e = a.v, t = a.w, n = a.name, arguments.length === 2 && (r = arguments[1], i = !0)) : (e = a, t = arguments[1], n = arguments[3], arguments.length > 2 && (r = arguments[2], i = !0)), e = "" + e, t = "" + t, K(n) || (n = "" + n);
		var o = Q(this._isDirected, e, t, n);
		if (Object.prototype.hasOwnProperty.call(this._edgeLabels, o)) return i && (this._edgeLabels[o] = r), this;
		if (!K(n) && !this._isMultigraph) throw Error("Cannot set a named edge when isMultigraph = false");
		this.setNode(e), this.setNode(t), this._edgeLabels[o] = i ? r : this._defaultEdgeLabelFn(e, t, n);
		var s = pt(this._isDirected, e, t, n);
		return e = s.v, t = s.w, Object.freeze(s), this._edgeObjs[o] = s, X(this._preds[t], e), X(this._sucs[e], t), this._in[t][o] = s, this._out[e][o] = s, this._edgeCount++, this;
	}
	edge(e, t, n) {
		var r = arguments.length === 1 ? $(this._isDirected, arguments[0]) : Q(this._isDirected, e, t, n);
		return this._edgeLabels[r];
	}
	hasEdge(e, t, n) {
		var r = arguments.length === 1 ? $(this._isDirected, arguments[0]) : Q(this._isDirected, e, t, n);
		return Object.prototype.hasOwnProperty.call(this._edgeLabels, r);
	}
	removeEdge(e, t, n) {
		var r = arguments.length === 1 ? $(this._isDirected, arguments[0]) : Q(this._isDirected, e, t, n), i = this._edgeObjs[r];
		return i && (e = i.v, t = i.w, delete this._edgeLabels[r], delete this._edgeObjs[r], Z(this._preds[t], e), Z(this._sucs[e], t), delete this._in[t][r], delete this._out[e][r], this._edgeCount--), this;
	}
	inEdges(e, t) {
		var n = this._in[e];
		if (n) {
			var r = G(n);
			return t ? o(r, function(e) {
				return e.v === t;
			}) : r;
		}
	}
	outEdges(e, t) {
		var n = this._out[e];
		if (n) {
			var r = G(n);
			return t ? o(r, function(e) {
				return e.w === t;
			}) : r;
		}
	}
	nodeEdges(e, t) {
		var n = this.inEdges(e, t);
		if (n) return n.concat(this.outEdges(e, t));
	}
};
Y.prototype._nodeCount = 0, Y.prototype._edgeCount = 0;
function X(e, t) {
	e[t] ? e[t]++ : e[t] = 1;
}
function Z(e, t) {
	--e[t] || delete e[t];
}
function Q(e, t, n, r) {
	var i = "" + t, a = "" + n;
	if (!e && i > a) {
		var o = i;
		i = a, a = o;
	}
	return i + J + a + J + (K(r) ? ft : r);
}
function pt(e, t, n, r) {
	var i = "" + t, a = "" + n;
	if (!e && i > a) {
		var o = i;
		i = a, a = o;
	}
	var s = {
		v: i,
		w: a
	};
	return r && (s.name = r), s;
}
function $(e, t) {
	return Q(e, t.v, t.w, t.name);
}
//#endregion
export { U as i, K as n, G as r, Y as t };
