import { n as e, r as t, t as n } from "./Serializer-D1JYN1kI.js";
import { _ as r, g as i, h as a, p as o } from "./src-CUQ6oOYk.js";
import { t as s } from "./isEmpty-CmA-HYrg.js";
import { a as c, d as l, h as u, i as d, m as f, r as p } from "./chunk-GEFDOKGD-BWpC-zoH.js";
import { F as m, G as h, H as ee, J as te, M as g, N as _, S as ne, T as v, X as y, Y as b, Z as re, c as ie, f as x, g as S, h as ae, l as C, n as oe, p as w, r as T, t as se, w as ce, x as E, y as D, z as le } from "./chunk-7R4GIKGN-QT6IorJ_.js";
import { t as ue } from "./chunk-HHEYEP7N-Cxc7E4dX.js";
import { i as de, o as fe } from "./chunk-PU5JKC2W-DdP8BS-S.js";
import "./chunk-MX3YWQON-BxE-Aq9c.js";
import "./chunk-YBOYWFTD-CvaddD9G.js";
import "./chunk-PQ6SQG4A-D3jtNCWN.js";
import "./chunk-KYZI473N-BHJ3T5Zv.js";
import "./chunk-O4XLMI2P-qjOoGpnx.js";
import { n as pe } from "./chunk-GLR3WWYH-DiXcKb5Y.js";
import { n as me, t as he } from "./chunk-XPW4576I-B0KVSHwE.js";
//#region ../../node_modules/.pnpm/mermaid@11.13.0/node_modules/mermaid/dist/mermaid.core.mjs
var O = "c4", ge = {
	id: O,
	detector: /* @__PURE__ */ a((e) => /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./c4Diagram-IC4MRINW-B1c2x_1Q.js");
		return {
			id: O,
			diagram: e
		};
	}, "loader")
}, k = "flowchart", _e = {
	id: k,
	detector: /* @__PURE__ */ a((e, t) => t?.flowchart?.defaultRenderer === "dagre-wrapper" || t?.flowchart?.defaultRenderer === "elk" ? !1 : /^\s*graph/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./flowDiagram-PKNHOUZH-UeyfgU8z.js");
		return {
			id: k,
			diagram: e
		};
	}, "loader")
}, A = "flowchart-v2", ve = {
	id: A,
	detector: /* @__PURE__ */ a((e, t) => t?.flowchart?.defaultRenderer === "dagre-d3" ? !1 : (t?.flowchart?.defaultRenderer === "elk" && (t.layout = "elk"), /^\s*graph/.test(e) && t?.flowchart?.defaultRenderer === "dagre-wrapper" ? !0 : /^\s*flowchart/.test(e)), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./flowDiagram-PKNHOUZH-UeyfgU8z.js");
		return {
			id: A,
			diagram: e
		};
	}, "loader")
}, j = "er", ye = {
	id: j,
	detector: /* @__PURE__ */ a((e) => /^\s*erDiagram/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./erDiagram-INFDFZHY-BcRXu8Cp.js");
		return {
			id: j,
			diagram: e
		};
	}, "loader")
}, M = "gitGraph", be = {
	id: M,
	detector: /* @__PURE__ */ a((e) => /^\s*gitGraph/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./gitGraphDiagram-K3NZZRJ6-DghWYaFU.js");
		return {
			id: M,
			diagram: e
		};
	}, "loader")
}, N = "gantt", xe = {
	id: N,
	detector: /* @__PURE__ */ a((e) => /^\s*gantt/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./ganttDiagram-A5KZAMGK-txCzqgQ5.js");
		return {
			id: N,
			diagram: e
		};
	}, "loader")
}, P = "info", Se = {
	id: P,
	detector: /* @__PURE__ */ a((e) => /^\s*info/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./infoDiagram-LFFYTUFH-CA-vlAvP.js");
		return {
			id: P,
			diagram: e
		};
	}, "loader")
}, F = "pie", Ce = {
	id: F,
	detector: /* @__PURE__ */ a((e) => /^\s*pie/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./pieDiagram-SKSYHLDU-COvqE_C6.js");
		return {
			id: F,
			diagram: e
		};
	}, "loader")
}, I = "quadrantChart", we = {
	id: I,
	detector: /* @__PURE__ */ a((e) => /^\s*quadrantChart/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./quadrantDiagram-337W2JSQ-Dgv8ccjt.js");
		return {
			id: I,
			diagram: e
		};
	}, "loader")
}, L = "xychart", Te = {
	id: L,
	detector: /* @__PURE__ */ a((e) => /^\s*xychart(-beta)?/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./xychartDiagram-JWTSCODW-Y21jBOTg.js");
		return {
			id: L,
			diagram: e
		};
	}, "loader")
}, R = "requirement", Ee = {
	id: R,
	detector: /* @__PURE__ */ a((e) => /^\s*requirement(Diagram)?/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./requirementDiagram-Z7DCOOCP-B2NyhxO-.js");
		return {
			id: R,
			diagram: e
		};
	}, "loader")
}, z = "sequence", De = {
	id: z,
	detector: /* @__PURE__ */ a((e) => /^\s*sequenceDiagram/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./sequenceDiagram-2WXFIKYE-DXssVQOF.js");
		return {
			id: z,
			diagram: e
		};
	}, "loader")
}, B = "class", Oe = {
	id: B,
	detector: /* @__PURE__ */ a((e, t) => t?.class?.defaultRenderer === "dagre-wrapper" ? !1 : /^\s*classDiagram/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./classDiagram-VBA2DB6C-Co3LMmg8.js");
		return {
			id: B,
			diagram: e
		};
	}, "loader")
}, V = "classDiagram", ke = {
	id: V,
	detector: /* @__PURE__ */ a((e, t) => /^\s*classDiagram/.test(e) && t?.class?.defaultRenderer === "dagre-wrapper" ? !0 : /^\s*classDiagram-v2/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./classDiagram-v2-RAHNMMFH-BZscgdF2.js");
		return {
			id: V,
			diagram: e
		};
	}, "loader")
}, H = "state", Ae = {
	id: H,
	detector: /* @__PURE__ */ a((e, t) => t?.state?.defaultRenderer === "dagre-wrapper" ? !1 : /^\s*stateDiagram/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./stateDiagram-RAJIS63D-DvDLfupV.js");
		return {
			id: H,
			diagram: e
		};
	}, "loader")
}, U = "stateDiagram", je = {
	id: U,
	detector: /* @__PURE__ */ a((e, t) => !!(/^\s*stateDiagram-v2/.test(e) || /^\s*stateDiagram/.test(e) && t?.state?.defaultRenderer === "dagre-wrapper"), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./stateDiagram-v2-FVOUBMTO-DIXyaX9W.js");
		return {
			id: U,
			diagram: e
		};
	}, "loader")
}, Me = "journey", Ne = {
	id: Me,
	detector: /* @__PURE__ */ a((e) => /^\s*journey/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./journeyDiagram-4ABVD52K-CIJfC1fp.js");
		return {
			id: Me,
			diagram: e
		};
	}, "loader")
}, Pe = { draw: /* @__PURE__ */ a((e, t, n) => {
	i.debug("rendering svg for syntax error\n");
	let r = ue(t), a = r.append("g");
	r.attr("viewBox", "0 0 2412 512"), ie(r, 100, 512, !0), a.append("path").attr("class", "error-icon").attr("d", "m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"), a.append("path").attr("class", "error-icon").attr("d", "m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"), a.append("path").attr("class", "error-icon").attr("d", "m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"), a.append("path").attr("class", "error-icon").attr("d", "m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"), a.append("path").attr("class", "error-icon").attr("d", "m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"), a.append("path").attr("class", "error-icon").attr("d", "m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"), a.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text"), a.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${n}`);
}, "draw") }, Fe = Pe, Ie = {
	db: {},
	renderer: Pe,
	parser: { parse: /* @__PURE__ */ a(() => {}, "parse") }
}, Le = "flowchart-elk", Re = {
	id: Le,
	detector: /* @__PURE__ */ a((e, t = {}) => /^\s*flowchart-elk/.test(e) || /^\s*(flowchart|graph)/.test(e) && t?.flowchart?.defaultRenderer === "elk" ? (t.layout = "elk", !0) : !1, "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./flowDiagram-PKNHOUZH-UeyfgU8z.js");
		return {
			id: Le,
			diagram: e
		};
	}, "loader")
}, ze = "timeline", Be = {
	id: ze,
	detector: /* @__PURE__ */ a((e) => /^\s*timeline/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./timeline-definition-YZTLITO2-ErcRjbZf.js");
		return {
			id: ze,
			diagram: e
		};
	}, "loader")
}, Ve = "mindmap", He = {
	id: Ve,
	detector: /* @__PURE__ */ a((e) => /^\s*mindmap/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./mindmap-definition-YRQLILUH-BzTYDYmK.js");
		return {
			id: Ve,
			diagram: e
		};
	}, "loader")
}, Ue = "kanban", We = {
	id: Ue,
	detector: /* @__PURE__ */ a((e) => /^\s*kanban/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./kanban-definition-K7BYSVSG-CC2vwGck.js");
		return {
			id: Ue,
			diagram: e
		};
	}, "loader")
}, Ge = "sankey", Ke = {
	id: Ge,
	detector: /* @__PURE__ */ a((e) => /^\s*sankey(-beta)?/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./sankeyDiagram-WA2Y5GQK-BfnH_gpl.js");
		return {
			id: Ge,
			diagram: e
		};
	}, "loader")
}, qe = "packet", Je = {
	id: qe,
	detector: /* @__PURE__ */ a((e) => /^\s*packet(-beta)?/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./diagram-P4PSJMXO-BlX6jFjZ.js");
		return {
			id: qe,
			diagram: e
		};
	}, "loader")
}, Ye = "radar", Xe = {
	id: Ye,
	detector: /* @__PURE__ */ a((e) => /^\s*radar-beta/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./diagram-IFDJBPK2-9fjvFkSc.js");
		return {
			id: Ye,
			diagram: e
		};
	}, "loader")
}, Ze = "block", Qe = {
	id: Ze,
	detector: /* @__PURE__ */ a((e) => /^\s*block(-beta)?/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./blockDiagram-WCTKOSBZ-lJAan65A.js");
		return {
			id: Ze,
			diagram: e
		};
	}, "loader")
}, $e = "architecture", et = {
	id: $e,
	detector: /* @__PURE__ */ a((e) => /^\s*architecture/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./architectureDiagram-2XIMDMQ5-CmfsCwJk.js");
		return {
			id: $e,
			diagram: e
		};
	}, "loader")
}, tt = "ishikawa", nt = {
	id: tt,
	detector: /* @__PURE__ */ a((e) => /^\s*ishikawa(-beta)?\b/i.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./ishikawaDiagram-PHBUUO56-DjdpS9Lb.js");
		return {
			id: tt,
			diagram: e
		};
	}, "loader")
}, rt = "venn", it = {
	id: rt,
	detector: /* @__PURE__ */ a((e) => /^\s*venn-beta/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./vennDiagram-LZ73GAT5-CDTZUtc8.js");
		return {
			id: rt,
			diagram: e
		};
	}, "loader")
}, at = "treemap", ot = {
	id: at,
	detector: /* @__PURE__ */ a((e) => /^\s*treemap/.test(e), "detector"),
	loader: /* @__PURE__ */ a(async () => {
		let { diagram: e } = await import("./diagram-E7M64L7V-Dz62Vz_a.js");
		return {
			id: at,
			diagram: e
		};
	}, "loader")
}, st = !1, W = /* @__PURE__ */ a(() => {
	st || (st = !0, g("error", Ie, (e) => e.toLowerCase().trim() === "error"), g("---", {
		db: { clear: /* @__PURE__ */ a(() => {}, "clear") },
		styles: {},
		renderer: { draw: /* @__PURE__ */ a(() => {}, "draw") },
		parser: { parse: /* @__PURE__ */ a(() => {
			throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks");
		}, "parse") },
		init: /* @__PURE__ */ a(() => null, "init")
	}, (e) => e.toLowerCase().trimStart().startsWith("---")), _(Re, He, et), _(ge, We, ke, Oe, ye, xe, Se, Ce, Ee, De, ve, _e, Be, be, je, Ae, Ne, we, Ke, Je, Te, Qe, Xe, nt, ot, it));
}, "addDiagrams"), ct = /* @__PURE__ */ a(async () => {
	i.debug("Loading registered diagrams");
	let e = (await Promise.allSettled(Object.entries(w).map(async ([e, { detector: t, loader: n }]) => {
		if (n) try {
			E(e);
		} catch {
			try {
				let { diagram: e, id: r } = await n();
				g(r, e, t);
			} catch (t) {
				throw i.error(`Failed to load external diagram with key ${e}. Removing from detectors.`), delete w[e], t;
			}
		}
	}))).filter((e) => e.status === "rejected");
	if (e.length > 0) {
		i.error(`Failed to load ${e.length} external diagrams`);
		for (let t of e) i.error(t);
		throw Error(`Failed to load ${e.length} external diagrams`);
	}
}, "loadRegisteredDiagrams"), lt = "graphics-document document";
function ut(e, t) {
	e.attr("role", lt), t !== "" && e.attr("aria-roledescription", t);
}
a(ut, "setA11yDiagramInfo");
function dt(e, t, n, r) {
	if (e.insert !== void 0) {
		if (n) {
			let t = `chart-desc-${r}`;
			e.attr("aria-describedby", t), e.insert("desc", ":first-child").attr("id", t).text(n);
		}
		if (t) {
			let n = `chart-title-${r}`;
			e.attr("aria-labelledby", n), e.insert("title", ":first-child").attr("id", n).text(t);
		}
	}
}
a(dt, "addSVGa11yTitleDescription");
var G = class e {
	constructor(e, t, n, r, i) {
		this.type = e, this.text = t, this.db = n, this.parser = r, this.renderer = i;
	}
	static {
		a(this, "Diagram");
	}
	static async fromText(t, n = {}) {
		let r = D(), i = x(t, r);
		t = c(t) + "\n";
		try {
			E(i);
		} catch {
			let e = ne(i);
			if (!e) throw new se(`Diagram ${i} not found.`);
			let { id: t, diagram: n } = await e();
			g(t, n);
		}
		let { db: a, parser: o, renderer: s, init: l } = E(i);
		return o.parser && (o.parser.yy = a), a.clear?.(), l?.(r), n.title && a.setDiagramTitle?.(n.title), await o.parse(t), new e(i, t, a, o, s);
	}
	async render(e, t) {
		await this.renderer.draw(this.text, e, t, this);
	}
	getParser() {
		return this.parser;
	}
	getType() {
		return this.type;
	}
}, ft = [], pt = /* @__PURE__ */ a(() => {
	ft.forEach((e) => {
		e();
	}), ft = [];
}, "attachFunctions"), mt = /* @__PURE__ */ a((e) => e.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart(), "cleanupComments");
function ht(e) {
	let t = e.match(S);
	if (!t) return {
		text: e,
		metadata: {}
	};
	let n = me(t[1], { schema: he }) ?? {};
	n = typeof n == "object" && !Array.isArray(n) ? n : {};
	let r = {};
	return n.displayMode && (r.displayMode = n.displayMode.toString()), n.title && (r.title = n.title.toString()), n.config && (r.config = n.config), {
		text: e.slice(t[0].length),
		metadata: r
	};
}
a(ht, "extractFrontMatter");
var gt = /* @__PURE__ */ a((e) => e.replace(/\r\n?/g, "\n").replace(/<(\w+)([^>]*)>/g, (e, t, n) => "<" + t + n.replace(/="([^"]*)"/g, "='$1'") + ">"), "cleanupText"), _t = /* @__PURE__ */ a((e) => {
	let { text: t, metadata: n } = ht(e), { displayMode: r, title: i, config: a = {} } = n;
	return r && (a.gantt ||= {}, a.gantt.displayMode = r), {
		title: i,
		config: a,
		text: t
	};
}, "processFrontmatter"), vt = /* @__PURE__ */ a((e) => {
	let t = u.detectInit(e) ?? {}, n = u.detectDirective(e, "wrap");
	return Array.isArray(n) ? t.wrap = n.some(({ type: e }) => e === "wrap") : n?.type === "wrap" && (t.wrap = !0), {
		text: f(e),
		directive: t
	};
}, "processDirectives");
function K(e) {
	let t = _t(gt(e)), n = vt(t.text), r = p(t.config, n.directive);
	return e = mt(n.text), {
		code: e,
		title: t.title,
		config: r
	};
}
a(K, "preprocessDiagram");
function yt(e) {
	let t = new TextEncoder().encode(e), n = Array.from(t, (e) => String.fromCodePoint(e)).join("");
	return btoa(n);
}
a(yt, "toBase64");
var bt = 5e4, xt = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa", St = "sandbox", Ct = "loose", wt = "http://www.w3.org/2000/svg", Tt = "http://www.w3.org/1999/xlink", Et = "http://www.w3.org/1999/xhtml", Dt = "100%", Ot = "100%", kt = "border:0;margin:0;", At = "margin:0", jt = "allow-top-navigation-by-user-activation allow-popups", Mt = "The \"iframe\" tag is not supported by your browser.", Nt = ["foreignobject"], Pt = ["dominant-baseline"];
function q(e) {
	let t = K(e);
	return m(), oe(t.config ?? {}), t;
}
a(q, "processAndSetConfigs");
async function Ft(e, t) {
	W();
	try {
		let { code: t, config: n } = q(e);
		return {
			diagramType: (await Y(t)).type,
			config: n
		};
	} catch (e) {
		if (t?.suppressErrors) return !1;
		throw e;
	}
}
a(Ft, "parse");
var It = /* @__PURE__ */ a((e, t, n = []) => `
.${e} ${t} { ${n.join(" !important; ")} !important; }`, "cssImportantStyles"), Lt = /* @__PURE__ */ a((e, t = /* @__PURE__ */ new Map()) => {
	let n = "";
	if (e.themeCSS !== void 0 && (n += `
${e.themeCSS}`), e.fontFamily !== void 0 && (n += `
:root { --mermaid-font-family: ${e.fontFamily}}`), e.altFontFamily !== void 0 && (n += `
:root { --mermaid-alt-font-family: ${e.altFontFamily}}`), t instanceof Map) {
		let r = ce(e) ? ["> *", "span"] : [
			"rect",
			"polygon",
			"ellipse",
			"circle",
			"path"
		];
		t.forEach((e) => {
			s(e.styles) || r.forEach((t) => {
				n += It(e.id, t, e.styles);
			}), s(e.textStyles) || (n += It(e.id, "tspan", (e?.textStyles || []).map((e) => e.replace("color", "fill"))));
		});
	}
	return n;
}, "createCssStyles"), Rt = /* @__PURE__ */ a((r, i, a, o) => n(t(`${o}{${te(i, Lt(r, a), r.themeVariables)}}`), e), "createUserStyles"), zt = /* @__PURE__ */ a((e = "", t, n) => {
	let r = e;
	return !n && !t && (r = r.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g, "marker-end=\"url(#")), r = d(r), r = r.replace(/<br>/g, "<br/>"), r;
}, "cleanUpSvgCode"), Bt = /* @__PURE__ */ a((e = "", t) => `<iframe style="width:${Dt};height:${t?.viewBox?.baseVal?.height ? t.viewBox.baseVal.height + "px" : Ot};${kt}" src="data:text/html;charset=UTF-8;base64,${yt(`<body style="${At}">${e}</body>`)}" sandbox="${jt}">
  ${Mt}
</iframe>`, "putIntoIFrame"), Vt = /* @__PURE__ */ a((e, t, n, r, i) => {
	let a = e.append("div");
	a.attr("id", n), r && a.attr("style", r);
	let o = a.append("svg").attr("id", t).attr("width", "100%").attr("xmlns", wt);
	return i && o.attr("xmlns:xlink", i), o.append("g"), e;
}, "appendDivSvgG");
function J(e, t) {
	return e.append("iframe").attr("id", t).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
}
a(J, "sandboxedIframe");
var Ht = /* @__PURE__ */ a((e, t, n, r) => {
	e.getElementById(t)?.remove(), e.getElementById(n)?.remove(), e.getElementById(r)?.remove();
}, "removeExistingElements"), Ut = /* @__PURE__ */ a(async function(e, t, n) {
	W();
	let r = q(t);
	t = r.code;
	let s = D();
	i.debug(s), t.length > (s?.maxTextSize ?? bt) && (t = xt);
	let c = "#" + e, l = "i" + e, u = "#" + l, d = "d" + e, f = "#" + d, p = /* @__PURE__ */ a(() => {
		let e = o(h ? u : f).node();
		e && "remove" in e && e.remove();
	}, "removeTempElements"), m = o("body"), h = s.securityLevel === St, ee = s.securityLevel === Ct, te = s.fontFamily;
	n === void 0 ? (Ht(document, e, d, l), h ? (m = o(J(o("body"), l).nodes()[0].contentDocument.body), m.node().style.margin = 0) : m = o("body"), Vt(m, e, d)) : (n && (n.innerHTML = ""), h ? (m = o(J(o(n), l).nodes()[0].contentDocument.body), m.node().style.margin = 0) : m = o(n), Vt(m, e, d, `font-family: ${te}`, Tt));
	let g, _;
	try {
		g = await G.fromText(t, { title: r.title });
	} catch (e) {
		if (s.suppressErrorRendering) throw p(), e;
		g = await G.fromText("error"), _ = e;
	}
	let ne = m.select(f).node(), v = g.type, y = ne.firstChild, b = y.firstChild, ie = g.renderer.getClasses?.(t, g), x = Rt(s, v, ie, c), S = document.createElement("style");
	S.innerHTML = x, y.insertBefore(S, b);
	try {
		await g.renderer.draw(t, e, "11.13.0", g);
	} catch (n) {
		throw s.suppressErrorRendering ? p() : Fe.draw(t, e, "11.13.0"), n;
	}
	let C = m.select(`${f} svg`), oe = g.db.getAccTitle?.(), w = g.db.getAccDescription?.();
	Gt(v, C, oe, w), m.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns", Et);
	let T = m.select(f).node().innerHTML;
	if (i.debug("config.arrowMarkerAbsolute", s.arrowMarkerAbsolute), T = zt(T, h, ae(s.arrowMarkerAbsolute)), h) {
		let e = m.select(f + " svg").node();
		T = Bt(T, e);
	} else ee || (T = re.sanitize(T, {
		ADD_TAGS: Nt,
		ADD_ATTR: Pt,
		HTML_INTEGRATION_POINTS: { foreignobject: !0 }
	}));
	if (pt(), _) throw _;
	return p(), {
		diagramType: v,
		svg: T,
		bindFunctions: g.db.bindFunctions
	};
}, "render");
function Wt(e = {}) {
	let t = T({}, e);
	t?.fontFamily && !t.themeVariables?.fontFamily && (t.themeVariables ||= {}, t.themeVariables.fontFamily = t.fontFamily), le(t), t?.theme && t.theme in b ? t.themeVariables = b[t.theme].getThemeVariables(t.themeVariables) : t && (t.themeVariables = b.default.getThemeVariables(t.themeVariables)), r((typeof t == "object" ? h(t) : v()).logLevel), W();
}
a(Wt, "initialize");
var Y = /* @__PURE__ */ a((e, t = {}) => {
	let { code: n } = K(e);
	return G.fromText(n, t);
}, "getDiagramFromText");
function Gt(e, t, n, r) {
	ut(t, e), dt(t, n, r, t.attr("id"));
}
a(Gt, "addA11yInfo");
var X = Object.freeze({
	render: Ut,
	parse: Ft,
	getDiagramFromText: Y,
	initialize: Wt,
	getConfig: D,
	setConfig: ee,
	getSiteConfig: v,
	updateSiteConfig: y,
	reset: /* @__PURE__ */ a(() => {
		m();
	}, "reset"),
	globalReset: /* @__PURE__ */ a(() => {
		m(C);
	}, "globalReset"),
	defaultConfig: C
});
r(D().logLevel), m(D());
var Kt = /* @__PURE__ */ a((e, t, n) => {
	i.warn(e), l(e) ? (n && n(e.str, e.hash), t.push({
		...e,
		message: e.str,
		error: e
	})) : (n && n(e), e instanceof Error && t.push({
		str: e.message,
		message: e.message,
		hash: e.name,
		error: e
	}));
}, "handleError"), qt = /* @__PURE__ */ a(async function(e = { querySelector: ".mermaid" }) {
	try {
		await Jt(e);
	} catch (t) {
		if (l(t) && i.error(t.str), $.parseError && $.parseError(t), !e.suppressErrors) throw i.error("Use the suppressErrors option to suppress these errors"), t;
	}
}, "run"), Jt = /* @__PURE__ */ a(async function({ postRenderCallback: e, querySelector: t, nodes: n } = { querySelector: ".mermaid" }) {
	let r = X.getConfig();
	i.debug(`${e ? "" : "No "}Callback function found`);
	let a;
	if (n) a = n;
	else if (t) a = document.querySelectorAll(t);
	else throw Error("Nodes and querySelector are both undefined");
	i.debug(`Found ${a.length} diagrams`), r?.startOnLoad !== void 0 && (i.debug("Start On Load: " + r?.startOnLoad), X.updateSiteConfig({ startOnLoad: r?.startOnLoad }));
	let o = new u.InitIDGenerator(r.deterministicIds, r.deterministicIDSeed), s, c = [];
	for (let t of Array.from(a)) {
		if (i.info("Rendering diagram: " + t.id), t.getAttribute("data-processed")) continue;
		t.setAttribute("data-processed", "true");
		let n = `mermaid-${o.next()}`;
		s = t.innerHTML, s = fe(u.entityDecode(s)).trim().replace(/<br\s*\/?>/gi, "<br/>");
		let r = u.detectInit(s);
		r && i.debug("Detected early reinit: ", r);
		try {
			let { svg: r, bindFunctions: i } = await nn(n, s, t);
			t.innerHTML = r, e && await e(n), i && i(t);
		} catch (e) {
			Kt(e, c, $.parseError);
		}
	}
	if (c.length > 0) throw c[0];
}, "runThrowsErrors"), Yt = /* @__PURE__ */ a(function(e) {
	X.initialize(e);
}, "initialize"), Xt = /* @__PURE__ */ a(async function(e, t, n) {
	i.warn("mermaid.init is deprecated. Please use run instead."), e && Yt(e);
	let r = {
		postRenderCallback: n,
		querySelector: ".mermaid"
	};
	typeof t == "string" ? r.querySelector = t : t && (t instanceof HTMLElement ? r.nodes = [t] : r.nodes = t), await qt(r);
}, "init"), Zt = /* @__PURE__ */ a(async (e, { lazyLoad: t = !0 } = {}) => {
	W(), _(...e), t === !1 && await ct();
}, "registerExternalDiagrams"), Qt = /* @__PURE__ */ a(function() {
	if ($.startOnLoad) {
		let { startOnLoad: e } = X.getConfig();
		e && $.run().catch((e) => i.error("Mermaid failed to initialize", e));
	}
}, "contentLoaded");
typeof document < "u" && window.addEventListener("load", Qt, !1);
var $t = /* @__PURE__ */ a(function(e) {
	$.parseError = e;
}, "setParseErrorHandler"), Z = [], Q = !1, en = /* @__PURE__ */ a(async () => {
	if (!Q) {
		for (Q = !0; Z.length > 0;) {
			let e = Z.shift();
			if (e) try {
				await e();
			} catch (e) {
				i.error("Error executing queue", e);
			}
		}
		Q = !1;
	}
}, "executeQueue"), tn = /* @__PURE__ */ a(async (e, t) => new Promise((n, r) => {
	let o = /* @__PURE__ */ a(() => new Promise((a, o) => {
		X.parse(e, t).then((e) => {
			a(e), n(e);
		}, (e) => {
			i.error("Error parsing", e), $.parseError?.(e), o(e), r(e);
		});
	}), "performCall");
	Z.push(o), en().catch(r);
}), "parse"), nn = /* @__PURE__ */ a((e, t, n) => new Promise((r, o) => {
	let s = /* @__PURE__ */ a(() => new Promise((a, s) => {
		X.render(e, t, n).then((e) => {
			a(e), r(e);
		}, (e) => {
			i.error("Error parsing", e), $.parseError?.(e), s(e), o(e);
		});
	}), "performCall");
	Z.push(s), en().catch(o);
}), "render"), $ = {
	startOnLoad: !0,
	mermaidAPI: X,
	parse: tn,
	render: nn,
	init: Xt,
	run: qt,
	registerExternalDiagrams: Zt,
	registerLayoutLoaders: pe,
	initialize: Yt,
	parseError: void 0,
	contentLoaded: Qt,
	setParseErrorHandler: $t,
	detectType: x,
	registerIconPacks: de,
	getRegisteredDiagramsMetadata: /* @__PURE__ */ a(() => Object.keys(w).map((e) => ({ id: e })), "getRegisteredDiagramsMetadata")
}, rn = $;
//#endregion
export { rn as default };
