import { EnterNode as e } from "./enter.js";
import t from "../constant.js";
import { Selection as n } from "./index.js";
//#region ../../node_modules/d3-selection/src/selection/data.js
function r(t, n, r, i, a, o) {
	for (var s = 0, c, l = n.length, u = o.length; s < u; ++s) (c = n[s]) ? (c.__data__ = o[s], i[s] = c) : r[s] = new e(t, o[s]);
	for (; s < l; ++s) (c = n[s]) && (a[s] = c);
}
function i(t, n, r, i, a, o, s) {
	var c, l, u = /* @__PURE__ */ new Map(), d = n.length, f = o.length, p = Array(d), m;
	for (c = 0; c < d; ++c) (l = n[c]) && (p[c] = m = s.call(l, l.__data__, c, n) + "", u.has(m) ? a[c] = l : u.set(m, l));
	for (c = 0; c < f; ++c) m = s.call(t, o[c], c, o) + "", (l = u.get(m)) ? (i[c] = l, l.__data__ = o[c], u.delete(m)) : r[c] = new e(t, o[c]);
	for (c = 0; c < d; ++c) (l = n[c]) && u.get(p[c]) === l && (a[c] = l);
}
function a(e) {
	return e.__data__;
}
function o(e, o) {
	if (!arguments.length) return Array.from(this, a);
	var c = o ? i : r, l = this._parents, u = this._groups;
	typeof e != "function" && (e = t(e));
	for (var d = u.length, f = Array(d), p = Array(d), m = Array(d), h = 0; h < d; ++h) {
		var g = l[h], _ = u[h], v = _.length, y = s(e.call(g, g && g.__data__, h, l)), b = y.length, x = p[h] = Array(b), S = f[h] = Array(b);
		c(g, _, x, S, m[h] = Array(v), y, o);
		for (var C = 0, w = 0, T, E; C < b; ++C) if (T = x[C]) {
			for (C >= w && (w = C + 1); !(E = S[w]) && ++w < b;);
			T._next = E || null;
		}
	}
	return f = new n(f, l), f._enter = p, f._exit = m, f;
}
function s(e) {
	return typeof e == "object" && "length" in e ? e : Array.from(e);
}
//#endregion
export { o as default };
