import { g as e, h as t, p as n } from "./src-BZm6Awwh.js";
import { B as r, C as i, E as a, V as o, W as s, _ as c, a as l, c as u, d, v as f, y as p } from "./chunk-ICPOFSXX-BQ7-Poft.js";
import { t as m } from "./ordinal-B2RGggQH.js";
import { r as h } from "./chunk-5PVQY5BW-CQdr0IGy.js";
import { t as g } from "./chunk-426QAEUC-b2PRuT9o.js";
import { t as _ } from "./chunk-4BX2VUAB-BkyyJ41z.js";
import { t as v } from "./mermaid-parser.core-D5sUsnWF.js";
import { t as y } from "./chunk-EDXVE4YY-CyZVAPxl.js";
import { i as b, n as x } from "./chunk-X2U36JSP-Dh9T66Fy.js";
//#region ../../node_modules/d3/node_modules/d3-format/src/formatDecimal.js
function S(e) {
	return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
}
function C(e, t) {
	if (!isFinite(e) || e === 0) return null;
	var n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e"), r = e.slice(0, n);
	return [r.length > 1 ? r[0] + r.slice(2) : r, +e.slice(n + 1)];
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/exponent.js
function w(e) {
	return e = C(Math.abs(e)), e ? e[1] : NaN;
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/formatGroup.js
function T(e, t) {
	return function(n, r) {
		for (var i = n.length, a = [], o = 0, s = e[0], c = 0; i > 0 && s > 0 && (c + s + 1 > r && (s = Math.max(1, r - c)), a.push(n.substring(i -= s, i + s)), !((c += s + 1) > r));) s = e[o = (o + 1) % e.length];
		return a.reverse().join(t);
	};
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/formatNumerals.js
function E(e) {
	return function(t) {
		return t.replace(/[0-9]/g, function(t) {
			return e[+t];
		});
	};
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/formatSpecifier.js
var D = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function O(e) {
	if (!(t = D.exec(e))) throw Error("invalid format: " + e);
	var t;
	return new k({
		fill: t[1],
		align: t[2],
		sign: t[3],
		symbol: t[4],
		zero: t[5],
		width: t[6],
		comma: t[7],
		precision: t[8] && t[8].slice(1),
		trim: t[9],
		type: t[10]
	});
}
O.prototype = k.prototype;
function k(e) {
	this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
}
k.prototype.toString = function() {
	return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/formatTrim.js
function A(e) {
	out: for (var t = e.length, n = 1, r = -1, i; n < t; ++n) switch (e[n]) {
		case ".":
			r = i = n;
			break;
		case "0":
			r === 0 && (r = n), i = n;
			break;
		default:
			if (!+e[n]) break out;
			r > 0 && (r = 0);
			break;
	}
	return r > 0 ? e.slice(0, r) + e.slice(i + 1) : e;
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/formatPrefixAuto.js
var j;
function M(e, t) {
	var n = C(e, t);
	if (!n) return j = void 0, e.toPrecision(t);
	var r = n[0], i = n[1], a = i - (j = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, o = r.length;
	return a === o ? r : a > o ? r + Array(a - o + 1).join("0") : a > 0 ? r.slice(0, a) + "." + r.slice(a) : "0." + Array(1 - a).join("0") + C(e, Math.max(0, t + a - 1))[0];
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/formatRounded.js
function N(e, t) {
	var n = C(e, t);
	if (!n) return e + "";
	var r = n[0], i = n[1];
	return i < 0 ? "0." + Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + Array(i - r.length + 2).join("0");
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/formatTypes.js
var P = {
	"%": (e, t) => (e * 100).toFixed(t),
	b: (e) => Math.round(e).toString(2),
	c: (e) => e + "",
	d: S,
	e: (e, t) => e.toExponential(t),
	f: (e, t) => e.toFixed(t),
	g: (e, t) => e.toPrecision(t),
	o: (e) => Math.round(e).toString(8),
	p: (e, t) => N(e * 100, t),
	r: N,
	s: M,
	X: (e) => Math.round(e).toString(16).toUpperCase(),
	x: (e) => Math.round(e).toString(16)
};
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/identity.js
function F(e) {
	return e;
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/locale.js
var I = Array.prototype.map, L = [
	"y",
	"z",
	"a",
	"f",
	"p",
	"n",
	"µ",
	"m",
	"",
	"k",
	"M",
	"G",
	"T",
	"P",
	"E",
	"Z",
	"Y"
];
function ee(e) {
	var t = e.grouping === void 0 || e.thousands === void 0 ? F : T(I.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", r = e.currency === void 0 ? "" : e.currency[1] + "", i = e.decimal === void 0 ? "." : e.decimal + "", a = e.numerals === void 0 ? F : E(I.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", s = e.minus === void 0 ? "−" : e.minus + "", c = e.nan === void 0 ? "NaN" : e.nan + "";
	function l(e, l) {
		e = O(e);
		var u = e.fill, d = e.align, f = e.sign, p = e.symbol, m = e.zero, h = e.width, g = e.comma, _ = e.precision, v = e.trim, y = e.type;
		y === "n" ? (g = !0, y = "g") : P[y] || (_ === void 0 && (_ = 12), v = !0, y = "g"), (m || u === "0" && d === "=") && (m = !0, u = "0", d = "=");
		var b = (l && l.prefix !== void 0 ? l.prefix : "") + (p === "$" ? n : p === "#" && /[boxX]/.test(y) ? "0" + y.toLowerCase() : ""), x = (p === "$" ? r : /[%p]/.test(y) ? o : "") + (l && l.suffix !== void 0 ? l.suffix : ""), S = P[y], C = /[defgprs%]/.test(y);
		_ = _ === void 0 ? 6 : /[gprs]/.test(y) ? Math.max(1, Math.min(21, _)) : Math.max(0, Math.min(20, _));
		function w(e) {
			var n = b, r = x, o, l, p;
			if (y === "c") r = S(e) + r, e = "";
			else {
				e = +e;
				var w = e < 0 || 1 / e < 0;
				if (e = isNaN(e) ? c : S(Math.abs(e), _), v && (e = A(e)), w && +e == 0 && f !== "+" && (w = !1), n = (w ? f === "(" ? f : s : f === "-" || f === "(" ? "" : f) + n, r = (y === "s" && !isNaN(e) && j !== void 0 ? L[8 + j / 3] : "") + r + (w && f === "(" ? ")" : ""), C) {
					for (o = -1, l = e.length; ++o < l;) if (p = e.charCodeAt(o), 48 > p || p > 57) {
						r = (p === 46 ? i + e.slice(o + 1) : e.slice(o)) + r, e = e.slice(0, o);
						break;
					}
				}
			}
			g && !m && (e = t(e, Infinity));
			var T = n.length + e.length + r.length, E = T < h ? Array(h - T + 1).join(u) : "";
			switch (g && m && (e = t(E + e, E.length ? h - r.length : Infinity), E = ""), d) {
				case "<":
					e = n + e + r + E;
					break;
				case "=":
					e = n + E + e + r;
					break;
				case "^":
					e = E.slice(0, T = E.length >> 1) + n + e + r + E.slice(T);
					break;
				default:
					e = E + n + e + r;
					break;
			}
			return a(e);
		}
		return w.toString = function() {
			return e + "";
		}, w;
	}
	function u(e, t) {
		var n = Math.max(-8, Math.min(8, Math.floor(w(t) / 3))) * 3, r = 10 ** -n, i = l((e = O(e), e.type = "f", e), { suffix: L[8 + n / 3] });
		return function(e) {
			return i(r * e);
		};
	}
	return {
		format: l,
		formatPrefix: u
	};
}
//#endregion
//#region ../../node_modules/d3/node_modules/d3-format/src/defaultLocale.js
var R, z;
te({
	thousands: ",",
	grouping: [3],
	currency: ["$", ""]
});
function te(e) {
	return R = ee(e), z = R.format, R.formatPrefix, R;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/count.js
function ne(e) {
	var t = 0, n = e.children, r = n && n.length;
	if (!r) t = 1;
	else for (; --r >= 0;) t += n[r].value;
	e.value = t;
}
function re() {
	return this.eachAfter(ne);
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/each.js
function ie(e, t) {
	let n = -1;
	for (let r of this) e.call(t, r, ++n, this);
	return this;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
function ae(e, t) {
	for (var n = this, r = [n], i, a, o = -1; n = r.pop();) if (e.call(t, n, ++o, this), i = n.children) for (a = i.length - 1; a >= 0; --a) r.push(i[a]);
	return this;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
function oe(e, t) {
	for (var n = this, r = [n], i = [], a, o, s, c = -1; n = r.pop();) if (i.push(n), a = n.children) for (o = 0, s = a.length; o < s; ++o) r.push(a[o]);
	for (; n = i.pop();) e.call(t, n, ++c, this);
	return this;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/find.js
function se(e, t) {
	let n = -1;
	for (let r of this) if (e.call(t, r, ++n, this)) return r;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/sum.js
function ce(e) {
	return this.eachAfter(function(t) {
		for (var n = +e(t.data) || 0, r = t.children, i = r && r.length; --i >= 0;) n += r[i].value;
		t.value = n;
	});
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/sort.js
function le(e) {
	return this.eachBefore(function(t) {
		t.children && t.children.sort(e);
	});
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/path.js
function ue(e) {
	for (var t = this, n = B(t, e), r = [t]; t !== n;) t = t.parent, r.push(t);
	for (var i = r.length; e !== n;) r.splice(i, 0, e), e = e.parent;
	return r;
}
function B(e, t) {
	if (e === t) return e;
	var n = e.ancestors(), r = t.ancestors(), i = null;
	for (e = n.pop(), t = r.pop(); e === t;) i = e, e = n.pop(), t = r.pop();
	return i;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/ancestors.js
function V() {
	for (var e = this, t = [e]; e = e.parent;) t.push(e);
	return t;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/descendants.js
function H() {
	return Array.from(this);
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/leaves.js
function U() {
	var e = [];
	return this.eachBefore(function(t) {
		t.children || e.push(t);
	}), e;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/links.js
function de() {
	var e = this, t = [];
	return e.each(function(n) {
		n !== e && t.push({
			source: n.parent,
			target: n
		});
	}), t;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/iterator.js
function* fe() {
	var e = this, t, n = [e], r, i, a;
	do
		for (t = n.reverse(), n = []; e = t.pop();) if (yield e, r = e.children) for (i = 0, a = r.length; i < a; ++i) n.push(r[i]);
	while (n.length);
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/hierarchy/index.js
function W(e, t) {
	e instanceof Map ? (e = [void 0, e], t === void 0 && (t = he)) : t === void 0 && (t = me);
	for (var n = new G(e), r, i = [n], a, o, s, c; r = i.pop();) if ((o = t(r.data)) && (c = (o = Array.from(o)).length)) for (r.children = o, s = c - 1; s >= 0; --s) i.push(a = o[s] = new G(o[s])), a.parent = r, a.depth = r.depth + 1;
	return n.eachBefore(_e);
}
function pe() {
	return W(this).eachBefore(ge);
}
function me(e) {
	return e.children;
}
function he(e) {
	return Array.isArray(e) ? e[1] : null;
}
function ge(e) {
	e.data.value !== void 0 && (e.value = e.data.value), e.data = e.data.data;
}
function _e(e) {
	var t = 0;
	do
		e.height = t;
	while ((e = e.parent) && e.height < ++t);
}
function G(e) {
	this.data = e, this.depth = this.height = 0, this.parent = null;
}
G.prototype = W.prototype = {
	constructor: G,
	count: re,
	each: ie,
	eachAfter: oe,
	eachBefore: ae,
	find: se,
	sum: ce,
	sort: le,
	path: ue,
	ancestors: V,
	descendants: H,
	leaves: U,
	links: de,
	copy: pe,
	[Symbol.iterator]: fe
};
//#endregion
//#region ../../node_modules/d3-hierarchy/src/accessors.js
function ve(e) {
	if (typeof e != "function") throw Error();
	return e;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/constant.js
function K() {
	return 0;
}
function q(e) {
	return function() {
		return e;
	};
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/treemap/round.js
function ye(e) {
	e.x0 = Math.round(e.x0), e.y0 = Math.round(e.y0), e.x1 = Math.round(e.x1), e.y1 = Math.round(e.y1);
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/treemap/dice.js
function be(e, t, n, r, i) {
	for (var a = e.children, o, s = -1, c = a.length, l = e.value && (r - t) / e.value; ++s < c;) o = a[s], o.y0 = n, o.y1 = i, o.x0 = t, o.x1 = t += o.value * l;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/treemap/slice.js
function xe(e, t, n, r, i) {
	for (var a = e.children, o, s = -1, c = a.length, l = e.value && (i - n) / e.value; ++s < c;) o = a[s], o.x0 = t, o.x1 = r, o.y0 = n, o.y1 = n += o.value * l;
}
//#endregion
//#region ../../node_modules/d3-hierarchy/src/treemap/squarify.js
var Se = (1 + Math.sqrt(5)) / 2;
function Ce(e, t, n, r, i, a) {
	for (var o = [], s = t.children, c, l, u = 0, d = 0, f = s.length, p, m, h = t.value, g, _, v, y, b, x, S; u < f;) {
		p = i - n, m = a - r;
		do
			g = s[d++].value;
		while (!g && d < f);
		for (_ = v = g, x = Math.max(m / p, p / m) / (h * e), S = g * g * x, b = Math.max(v / S, S / _); d < f; ++d) {
			if (g += l = s[d].value, l < _ && (_ = l), l > v && (v = l), S = g * g * x, y = Math.max(v / S, S / _), y > b) {
				g -= l;
				break;
			}
			b = y;
		}
		o.push(c = {
			value: g,
			dice: p < m,
			children: s.slice(u, d)
		}), c.dice ? be(c, n, r, i, h ? r += m * g / h : a) : xe(c, n, r, h ? n += p * g / h : i, a), h -= g, u = d;
	}
	return o;
}
var we = (function e(t) {
	function n(e, n, r, i, a) {
		Ce(t, e, n, r, i, a);
	}
	return n.ratio = function(t) {
		return e((t = +t) > 1 ? t : 1);
	}, n;
})(Se);
//#endregion
//#region ../../node_modules/d3-hierarchy/src/treemap/index.js
function Te() {
	var e = we, t = !1, n = 1, r = 1, i = [0], a = K, o = K, s = K, c = K, l = K;
	function u(e) {
		return e.x0 = e.y0 = 0, e.x1 = n, e.y1 = r, e.eachBefore(d), i = [0], t && e.eachBefore(ye), e;
	}
	function d(t) {
		var n = i[t.depth], r = t.x0 + n, u = t.y0 + n, d = t.x1 - n, f = t.y1 - n;
		d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), t.x0 = r, t.y0 = u, t.x1 = d, t.y1 = f, t.children && (n = i[t.depth + 1] = a(t) / 2, r += l(t) - n, u += o(t) - n, d -= s(t) - n, f -= c(t) - n, d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), e(t, r, u, d, f));
	}
	return u.round = function(e) {
		return arguments.length ? (t = !!e, u) : t;
	}, u.size = function(e) {
		return arguments.length ? (n = +e[0], r = +e[1], u) : [n, r];
	}, u.tile = function(t) {
		return arguments.length ? (e = ve(t), u) : e;
	}, u.padding = function(e) {
		return arguments.length ? u.paddingInner(e).paddingOuter(e) : u.paddingInner();
	}, u.paddingInner = function(e) {
		return arguments.length ? (a = typeof e == "function" ? e : q(+e), u) : a;
	}, u.paddingOuter = function(e) {
		return arguments.length ? u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e) : u.paddingTop();
	}, u.paddingTop = function(e) {
		return arguments.length ? (o = typeof e == "function" ? e : q(+e), u) : o;
	}, u.paddingRight = function(e) {
		return arguments.length ? (s = typeof e == "function" ? e : q(+e), u) : s;
	}, u.paddingBottom = function(e) {
		return arguments.length ? (c = typeof e == "function" ? e : q(+e), u) : c;
	}, u.paddingLeft = function(e) {
		return arguments.length ? (l = typeof e == "function" ? e : q(+e), u) : l;
	}, u;
}
//#endregion
//#region ../../node_modules/mermaid/dist/chunks/mermaid.core/diagram-G4DWMVQ6.mjs
var J = class {
	constructor() {
		this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = o, this.getAccTitle = f, this.setDiagramTitle = s, this.getDiagramTitle = i, this.getAccDescription = c, this.setAccDescription = r;
	}
	static {
		t(this, "TreeMapDB");
	}
	getNodes() {
		return this.nodes;
	}
	getConfig() {
		let e = d, t = p();
		return h({
			...e.treemap,
			...t.treemap ?? {}
		});
	}
	addNode(e, t) {
		this.nodes.push(e), this.levels.set(e, t), t === 0 && (this.outerNodes.push(e), this.root ??= e);
	}
	getRoot() {
		return {
			name: "",
			children: this.outerNodes
		};
	}
	addClass(e, t) {
		let n = this.classes.get(e) ?? {
			id: e,
			styles: [],
			textStyles: []
		}, r = t.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
		r && r.forEach((e) => {
			x(e) && (n?.textStyles ? n.textStyles.push(e) : n.textStyles = [e]), n?.styles ? n.styles.push(e) : n.styles = [e];
		}), this.classes.set(e, n);
	}
	getClasses() {
		return this.classes;
	}
	getStylesForClass(e) {
		return this.classes.get(e)?.styles ?? [];
	}
	clear() {
		l(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
	}
};
function Y(e) {
	if (!e.length) return [];
	let t = [], n = [];
	return e.forEach((e) => {
		let r = {
			name: e.name,
			children: e.type === "Leaf" ? void 0 : []
		};
		for (r.classSelector = e?.classSelector, e?.cssCompiledStyles && (r.cssCompiledStyles = e.cssCompiledStyles), e.type === "Leaf" && e.value !== void 0 && (r.value = e.value); n.length > 0 && n[n.length - 1].level >= e.level;) n.pop();
		if (n.length === 0) t.push(r);
		else {
			let e = n[n.length - 1].node;
			e.children ? e.children.push(r) : e.children = [r];
		}
		e.type !== "Leaf" && n.push({
			node: r,
			level: e.level
		});
	}), t;
}
t(Y, "buildHierarchy");
var Ee = /* @__PURE__ */ t((e, n) => {
	_(e, n);
	let r = [];
	for (let t of e.TreemapRows ?? []) t.$type === "ClassDefStatement" && n.addClass(t.className ?? "", t.styleText ?? "");
	for (let t of e.TreemapRows ?? []) {
		let e = t.item;
		if (!e) continue;
		let i = t.indent ? parseInt(t.indent) : 0, a = X(e), o = e.classSelector ? n.getStylesForClass(e.classSelector) : [], s = o.length > 0 ? o : void 0, c = {
			level: i,
			name: a,
			type: e.$type,
			value: e.value,
			classSelector: e.classSelector,
			cssCompiledStyles: s
		};
		r.push(c);
	}
	let i = Y(r), a = /* @__PURE__ */ t((e, t) => {
		for (let r of e) n.addNode(r, t), r.children && r.children.length > 0 && a(r.children, t + 1);
	}, "addNodesRecursively");
	a(i, 0);
}, "populate"), X = /* @__PURE__ */ t((e) => e.name ? String(e.name) : "", "getItemName"), Z = {
	parser: { yy: void 0 },
	parse: /* @__PURE__ */ t(async (t) => {
		try {
			let n = await v("treemap", t);
			e.debug("Treemap AST:", n);
			let r = Z.parser?.yy;
			if (!(r instanceof J)) throw Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");
			Ee(n, r);
		} catch (t) {
			throw e.error("Error parsing treemap:", t), t;
		}
	}, "parse")
}, De = 10, Q = 10, $ = 25, Oe = {
	draw: /* @__PURE__ */ t((r, i, a, o) => {
		let s = o.db, c = s.getConfig(), l = c.padding ?? De, d = s.getDiagramTitle(), f = s.getRoot(), { themeVariables: h } = p();
		if (!f) return;
		let _ = d ? 30 : 0, v = g(i), x = c.nodeWidth ? c.nodeWidth * Q : 960, S = c.nodeHeight ? c.nodeHeight * Q : 500, C = x, w = S + _;
		v.attr("viewBox", `0 0 ${C} ${w}`), u(v, w, C, c.useMaxWidth);
		let T;
		try {
			let e = c.valueFormat || ",";
			if (e === "$0,0") T = /* @__PURE__ */ t((e) => "$" + z(",")(e), "valueFormat");
			else if (e.startsWith("$") && e.includes(",")) {
				let n = /\.\d+/.exec(e), r = n ? n[0] : "";
				T = /* @__PURE__ */ t((e) => "$" + z("," + r)(e), "valueFormat");
			} else if (e.startsWith("$")) {
				let n = e.substring(1);
				T = /* @__PURE__ */ t((e) => "$" + z(n || "")(e), "valueFormat");
			} else T = z(e);
		} catch (t) {
			e.error("Error creating format function:", t), T = z(",");
		}
		let E = m().range([
			"transparent",
			h.cScale0,
			h.cScale1,
			h.cScale2,
			h.cScale3,
			h.cScale4,
			h.cScale5,
			h.cScale6,
			h.cScale7,
			h.cScale8,
			h.cScale9,
			h.cScale10,
			h.cScale11
		]), D = m().range([
			"transparent",
			h.cScalePeer0,
			h.cScalePeer1,
			h.cScalePeer2,
			h.cScalePeer3,
			h.cScalePeer4,
			h.cScalePeer5,
			h.cScalePeer6,
			h.cScalePeer7,
			h.cScalePeer8,
			h.cScalePeer9,
			h.cScalePeer10,
			h.cScalePeer11
		]), O = m().range([
			h.cScaleLabel0,
			h.cScaleLabel1,
			h.cScaleLabel2,
			h.cScaleLabel3,
			h.cScaleLabel4,
			h.cScaleLabel5,
			h.cScaleLabel6,
			h.cScaleLabel7,
			h.cScaleLabel8,
			h.cScaleLabel9,
			h.cScaleLabel10,
			h.cScaleLabel11
		]);
		d && v.append("text").attr("x", C / 2).attr("y", _ / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(d);
		let k = v.append("g").attr("transform", `translate(0, ${_})`).attr("class", "treemapContainer"), A = W(f).sum((e) => e.value ?? 0).sort((e, t) => (t.value ?? 0) - (e.value ?? 0)), j = Te().size([x, S]).paddingTop((e) => e.children && e.children.length > 0 ? $ + Q : 0).paddingInner(l).paddingLeft((e) => e.children && e.children.length > 0 ? Q : 0).paddingRight((e) => e.children && e.children.length > 0 ? Q : 0).paddingBottom((e) => e.children && e.children.length > 0 ? Q : 0).round(!0)(A), M = j.descendants().filter((e) => e.children && e.children.length > 0), N = k.selectAll(".treemapSection").data(M).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
		N.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", $).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", .6).attr("stroke-width", .6).attr("style", (e) => e.depth === 0 ? "display: none;" : ""), N.append("clipPath").attr("id", (e, t) => `clip-section-${i}-${t}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 12)).attr("height", $), N.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", (e, t) => `treemapSection section${t}`).attr("fill", (e) => E(e.data.name)).attr("fill-opacity", .6).attr("stroke", (e) => D(e.data.name)).attr("stroke-width", 2).attr("stroke-opacity", .4).attr("style", (e) => {
			if (e.depth === 0) return "display: none;";
			let t = b({ cssCompiledStyles: e.data.cssCompiledStyles });
			return t.nodeStyles + ";" + t.borderStyles.join(";");
		}), N.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", $ / 2).attr("dominant-baseline", "middle").text((e) => e.depth === 0 ? "" : e.data.name).attr("font-weight", "bold").attr("style", (e) => e.depth === 0 ? "display: none;" : "dominant-baseline: middle; font-size: 12px; fill:" + O(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" + b({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:")).each(function(e) {
			if (e.depth === 0) return;
			let t = n(this), r = e.data.name;
			t.text(r);
			let i = e.x1 - e.x0, a;
			a = c.showValues !== !1 && e.value ? i - 10 - 30 - 10 - 6 : i - 6 - 6;
			let o = Math.max(15, a), s = t.node();
			if (s.getComputedTextLength() > o) {
				let e = r;
				for (; e.length > 0;) {
					if (e = r.substring(0, e.length - 1), e.length === 0) {
						t.text("..."), s.getComputedTextLength() > o && t.text("");
						break;
					}
					if (t.text(e + "..."), s.getComputedTextLength() <= o) break;
				}
			}
		}), c.showValues !== !1 && N.append("text").attr("class", "treemapSectionValue").attr("x", (e) => e.x1 - e.x0 - 10).attr("y", $ / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((e) => e.value ? T(e.value) : "").attr("font-style", "italic").attr("style", (e) => e.depth === 0 ? "display: none;" : "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + O(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" + b({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:"));
		let P = j.leaves(), F = k.selectAll(".treemapLeafGroup").data(P).enter().append("g").attr("class", (e, t) => `treemapNode treemapLeafGroup leaf${t}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
		F.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", "treemapLeaf").attr("fill", (e) => e.parent ? E(e.parent.data.name) : E(e.data.name)).attr("style", (e) => b({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", .3).attr("stroke", (e) => e.parent ? E(e.parent.data.name) : E(e.data.name)).attr("stroke-width", 3), F.append("clipPath").attr("id", (e, t) => `clip-${i}-${t}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 4)).attr("height", (e) => Math.max(0, e.y1 - e.y0 - 4)), F.append("text").attr("class", "treemapLabel").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", (e) => (e.y1 - e.y0) / 2).attr("style", (e) => "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + O(e.data.name) + ";" + b({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:")).attr("clip-path", (e, t) => `url(#clip-${i}-${t})`).text((e) => e.data.name).each(function(e) {
			let t = n(this), r = e.x1 - e.x0, i = e.y1 - e.y0, a = t.node(), o = r - 8, s = i - 8;
			if (o < 10 || s < 10) {
				t.style("display", "none");
				return;
			}
			let c = parseInt(t.style("font-size"), 10), l = .6;
			for (; a.getComputedTextLength() > o && c > 8;) c--, t.style("font-size", `${c}px`);
			let u = Math.max(6, Math.min(28, Math.round(c * l))), d = c + 2 + u;
			for (; d > s && c > 8 && (c--, u = Math.max(6, Math.min(28, Math.round(c * l))), !(u < 6 && c === 8));) t.style("font-size", `${c}px`), d = c + 2 + u;
			t.style("font-size", `${c}px`), (a.getComputedTextLength() > o || c < 8 || s < c) && t.style("display", "none");
		}), c.showValues !== !1 && F.append("text").attr("class", "treemapValue").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", function(e) {
			return (e.y1 - e.y0) / 2;
		}).attr("style", (e) => "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + O(e.data.name) + ";" + b({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:")).attr("clip-path", (e, t) => `url(#clip-${i}-${t})`).text((e) => e.value ? T(e.value) : "").each(function(e) {
			let t = n(this), r = this.parentNode;
			if (!r) {
				t.style("display", "none");
				return;
			}
			let i = n(r).select(".treemapLabel");
			if (i.empty() || i.style("display") === "none") {
				t.style("display", "none");
				return;
			}
			let a = parseFloat(i.style("font-size")), o = Math.max(6, Math.min(28, Math.round(a * .6)));
			t.style("font-size", `${o}px`);
			let s = (e.y1 - e.y0) / 2 + a / 2 + 2;
			t.attr("y", s);
			let c = e.x1 - e.x0, l = e.y1 - e.y0 - 4, u = c - 8;
			t.node().getComputedTextLength() > u || s + o > l || o < 6 ? t.style("display", "none") : t.style("display", null);
		}), y(v, c.diagramPadding ?? 8, "flowchart", c?.useMaxWidth || !1);
	}, "draw"),
	getClasses: /* @__PURE__ */ t(function(e, t) {
		return t.db.getClasses();
	}, "getClasses")
}, ke = {
	sectionStrokeColor: "black",
	sectionStrokeWidth: "1",
	sectionFillColor: "#efefef",
	leafStrokeColor: "black",
	leafStrokeWidth: "1",
	leafFillColor: "#efefef",
	labelFontSize: "12px",
	valueFontSize: "10px",
	titleFontSize: "14px"
}, Ae = {
	parser: Z,
	get db() {
		return new J();
	},
	renderer: Oe,
	styles: /* @__PURE__ */ t(({ treemap: e } = {}) => {
		let t = h(a(), p().themeVariables), n = h(ke, e), r = n.titleColor ?? t.titleColor, i = n.labelColor ?? t.textColor, o = n.valueColor ?? t.textColor;
		return `
  .treemapNode.section {
    stroke: ${n.sectionStrokeColor};
    stroke-width: ${n.sectionStrokeWidth};
    fill: ${n.sectionFillColor};
  }
  .treemapNode.leaf {
    stroke: ${n.leafStrokeColor};
    stroke-width: ${n.leafStrokeWidth};
    fill: ${n.leafFillColor};
  }
  .treemapLabel {
    fill: ${i};
    font-size: ${n.labelFontSize};
  }
  .treemapValue {
    fill: ${o};
    font-size: ${n.valueFontSize};
  }
  .treemapTitle {
    fill: ${r};
    font-size: ${n.titleFontSize};
  }
  `;
	}, "getStyles")
};
//#endregion
export { Ae as diagram };

//# sourceMappingURL=diagram-G4DWMVQ6-EfJtDPEB.js.map