import { required as e } from "../accessors.js";
import t, { constantZero as n } from "../constant.js";
import r from "./round.js";
import i from "./squarify.js";
//#region ../../node_modules/d3-hierarchy/src/treemap/index.js
function a() {
	var a = i, o = !1, s = 1, c = 1, l = [0], u = n, d = n, f = n, p = n, m = n;
	function h(e) {
		return e.x0 = e.y0 = 0, e.x1 = s, e.y1 = c, e.eachBefore(g), l = [0], o && e.eachBefore(r), e;
	}
	function g(e) {
		var t = l[e.depth], n = e.x0 + t, r = e.y0 + t, i = e.x1 - t, o = e.y1 - t;
		i < n && (n = i = (n + i) / 2), o < r && (r = o = (r + o) / 2), e.x0 = n, e.y0 = r, e.x1 = i, e.y1 = o, e.children && (t = l[e.depth + 1] = u(e) / 2, n += m(e) - t, r += d(e) - t, i -= f(e) - t, o -= p(e) - t, i < n && (n = i = (n + i) / 2), o < r && (r = o = (r + o) / 2), a(e, n, r, i, o));
	}
	return h.round = function(e) {
		return arguments.length ? (o = !!e, h) : o;
	}, h.size = function(e) {
		return arguments.length ? (s = +e[0], c = +e[1], h) : [s, c];
	}, h.tile = function(t) {
		return arguments.length ? (a = e(t), h) : a;
	}, h.padding = function(e) {
		return arguments.length ? h.paddingInner(e).paddingOuter(e) : h.paddingInner();
	}, h.paddingInner = function(e) {
		return arguments.length ? (u = typeof e == "function" ? e : t(+e), h) : u;
	}, h.paddingOuter = function(e) {
		return arguments.length ? h.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e) : h.paddingTop();
	}, h.paddingTop = function(e) {
		return arguments.length ? (d = typeof e == "function" ? e : t(+e), h) : d;
	}, h.paddingRight = function(e) {
		return arguments.length ? (f = typeof e == "function" ? e : t(+e), h) : f;
	}, h.paddingBottom = function(e) {
		return arguments.length ? (p = typeof e == "function" ? e : t(+e), h) : p;
	}, h.paddingLeft = function(e) {
		return arguments.length ? (m = typeof e == "function" ? e : t(+e), h) : m;
	}, h;
}
//#endregion
export { a as default };
