//#region components/mermaid/loader.ts
var mermaidInstance = null;
var mermaidPromise = null;
var pendingInitializeConfig = null;
async function loadMermaid() {
	if (mermaidInstance) return mermaidInstance;
	if (!mermaidPromise) mermaidPromise = import("mermaid/dist/mermaid.core.mjs").then((mod) => mod.default).then((instance) => {
		mermaidInstance = instance;
		if (pendingInitializeConfig) {
			instance.initialize(pendingInitializeConfig);
			pendingInitializeConfig = null;
		}
		return instance;
	});
	return mermaidPromise;
}
function initializeMermaid(config) {
	pendingInitializeConfig = config;
	if (mermaidInstance) {
		mermaidInstance.initialize(config);
		pendingInitializeConfig = null;
		return;
	}
	loadMermaid();
}
async function parseMermaid(content, options) {
	return (await loadMermaid()).parse(content, options);
}
async function renderMermaid(id, content, container) {
	return (await loadMermaid()).render(id, content, container);
}
//#endregion
export { initializeMermaid, parseMermaid, renderMermaid };
