import e from "./dice.js";
import t from "./slice.js";
//#region ../../node_modules/d3-hierarchy/src/treemap/squarify.js
var n = (1 + Math.sqrt(5)) / 2;
function r(n, r, i, a, o, s) {
	for (var c = [], l = r.children, u, d, f = 0, p = 0, m = l.length, h, g, _ = r.value, v, y, b, x, S, C, w; f < m;) {
		h = o - i, g = s - a;
		do
			v = l[p++].value;
		while (!v && p < m);
		for (y = b = v, C = Math.max(g / h, h / g) / (_ * n), w = v * v * C, S = Math.max(b / w, w / y); p < m; ++p) {
			if (v += d = l[p].value, d < y && (y = d), d > b && (b = d), w = v * v * C, x = Math.max(b / w, w / y), x > S) {
				v -= d;
				break;
			}
			S = x;
		}
		c.push(u = {
			value: v,
			dice: h < g,
			children: l.slice(f, p)
		}), u.dice ? e(u, i, a, o, _ ? a += g * v / _ : s) : t(u, i, a, _ ? i += h * v / _ : o, s), _ -= v, f = p;
	}
	return c;
}
var i = (function e(t) {
	function n(e, n, i, a, o) {
		r(t, e, n, i, a, o);
	}
	return n.ratio = function(t) {
		return e((t = +t) > 1 ? t : 1);
	}, n;
})(n);
//#endregion
export { i as default };
