import { A as e, C as t, D as n, E as r, M as i, O as a, T as o, j as s, k as ee, w as c, x as l, y as u } from "./chunk-5PVQY5BW-De02jDY6.js";
import { C as d, E as f, S as p, T as m, a as h, b as te, c as g, i as ne, n as _, s as v, t as re, w as y, x as b } from "./reduce-BM17lgVY.js";
import { C as x, E as S, g as ie, h as C, l as w, p as ae, u as T, v as oe, w as se } from "./_baseFor-Cankmnlb.js";
import { n as E, t as D } from "./isEmpty-KjELx5uD.js";
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js
function ce(e, t) {
	return e && c(t, b(t), e);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js
function le(e, n) {
	return e && c(n, t(n), e);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js
function ue(e, t) {
	return c(e, p(e), t);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js
var O = Object.getOwnPropertySymbols ? function(e) {
	for (var t = []; e;) m(t, p(e)), e = a(e);
	return t;
} : d;
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js
function de(e, t) {
	return c(e, O(e), t);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js
function fe(e) {
	return y(e, t, O);
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js
var pe = Object.prototype.hasOwnProperty;
function me(e) {
	var t = e.length, n = new e.constructor(t);
	return t && typeof e[0] == "string" && pe.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 he(e, t) {
	var n = t ? s(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 ge = /\w*$/;
function _e(e) {
	var t = new e.constructor(e.source, ge.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 = S ? S.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(t, n, r) {
	var i = t.constructor;
	switch (n) {
		case xe: return s(t);
		case M:
		case N: return new i(+t);
		case Se: return he(t, r);
		case Ce:
		case we:
		case Te:
		case Ee:
		case De:
		case Oe:
		case ke:
		case Ae:
		case je: return e(t, r);
		case P: return new i();
		case F:
		case ye: return new i(t);
		case I: return _e(t);
		case ve: return new i();
		case be: return j(t);
	}
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js
var Ne = "[object Map]";
function Pe(e) {
	return C(e) && E(e) == Ne;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js
var L = w && w.isMap, Fe = L ? T(L) : Pe, Ie = "[object Set]";
function Le(e) {
	return C(e) && E(e) == Ie;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js
var R = w && w.isSet, Re = R ? T(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, r, a, s, c, l) {
	var u, d = r & ze, f = r & Be, p = r & Ve;
	if (a && (u = c ? a(e, s, c, l) : a(e)), u !== void 0) return u;
	if (!se(e)) return e;
	var m = ie(e);
	if (m) {
		if (u = me(e), !d) return ee(e, u);
	} else {
		var h = E(e), g = h == B || h == Ke;
		if (ae(e)) return i(e, d);
		if (h == V || h == z || g && !c) {
			if (u = f || g ? {} : n(e), !d) return f ? de(e, le(u, e)) : ue(e, ce(u, e));
		} else {
			if (!H[h]) return c ? e : {};
			u = Me(e, h, d);
		}
	}
	l ||= new oe();
	var _ = l.get(e);
	if (_) return _;
	l.set(e, u), Re(e) ? e.forEach(function(t) {
		u.add(U(t, r, a, t, e, l));
	}) : Fe(e) && e.forEach(function(t, n) {
		u.set(n, U(t, r, a, n, e, l));
	});
	var v = m ? void 0 : (p ? f ? fe : te : f ? t : b)(e);
	return ne(v || e, function(t, n) {
		v && (n = t, t = e[n]), o(u, n, U(t, r, a, n, e, l));
	}), u;
}
//#endregion
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseValues.js
function W(e, t) {
	return f(t, 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, b(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 = u(function(e) {
	return h(v(e, 1, r, !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 = l(void 0), this._defaultEdgeLabelFn = l(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 x(e) || (e = l(e)), this._defaultNodeLabelFn = e, this;
	}
	nodeCount() {
		return this._nodeCount;
	}
	nodes() {
		return b(this._nodes);
	}
	sources() {
		var e = this;
		return g(this.nodes(), function(t) {
			return D(e._in[t]);
		});
	}
	sinks() {
		var e = this;
		return g(this.nodes(), function(t) {
			return D(e._out[t]);
		});
	}
	setNodes(e, t) {
		var n = arguments, r = this;
		return _(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], _(this.children(e), (e) => {
				this.setParent(e);
			}), delete this._children[e]), _(b(this._in[e]), t), delete this._in[e], delete this._preds[e], _(b(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 b(t);
		} else if (e === q) return this.nodes();
		else if (this.hasNode(e)) return [];
	}
	predecessors(e) {
		var t = this._preds[e];
		if (t) return b(t);
	}
	successors(e) {
		var t = this._sucs[e];
		if (t) return b(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;
		_(this._nodes, function(n, r) {
			e(r) && t.setNode(r, n);
		}), _(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 && _(t.nodes(), function(e) {
			t.setParent(e, i(e));
		}), t;
	}
	setDefaultEdgeLabel(e) {
		return x(e) || (e = l(e)), this._defaultEdgeLabelFn = e, this;
	}
	edgeCount() {
		return this._edgeCount;
	}
	edges() {
		return G(this._edgeObjs);
	}
	setPath(e, t) {
		var n = this, r = arguments;
		return re(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 ? g(r, function(e) {
				return e.v === t;
			}) : r;
		}
	}
	outEdges(e, t) {
		var n = this._out[e];
		if (n) {
			var r = G(n);
			return t ? g(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 };
