import { __name as e } from "./chunk-AGHRB4JF.js";
import { defaultConfig_default as t, getConfig2 as n } from "./chunk-ICPOFSXX.js";
import { parseFontSize as r } from "./chunk-5PVQY5BW.js";
//#region ../../node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.mjs
var i = /* @__PURE__ */ e(({ flowchart: e }) => {
	let t = e?.subGraphTitleMargin?.top ?? 0, n = e?.subGraphTitleMargin?.bottom ?? 0;
	return {
		subGraphTitleTopMargin: t,
		subGraphTitleBottomMargin: n,
		subGraphTitleTotalMargin: t + n
	};
}, "getSubGraphTitleMargins");
async function a(i, a) {
	let o = i.getElementsByTagName("img");
	if (!o || o.length === 0) return;
	let s = a.replace(/<img[^>]*>/g, "").trim() === "";
	await Promise.all([...o].map((i) => new Promise((a) => {
		function o() {
			if (i.style.display = "flex", i.style.flexDirection = "column", s) {
				let [e = t.fontSize] = r(n().fontSize ? n().fontSize : window.getComputedStyle(document.body).fontSize), a = e * 5 + "px";
				i.style.minWidth = a, i.style.maxWidth = a;
			} else i.style.width = "100%";
			a(i);
		}
		e(o, "setupImage"), setTimeout(() => {
			i.complete && o();
		}), i.addEventListener("error", o), i.addEventListener("load", o);
	})));
}
e(a, "configureLabelImages");
//#endregion
export { a as configureLabelImages, i as getSubGraphTitleMargins };

//# sourceMappingURL=chunk-ZZ45TVLE.js.map