markstream-vue
Version:
Vue 3 Markdown renderer optimized for large docs: progressive Mermaid, streaming diff code blocks, and fast real-time preview.
1,523 lines • 190 kB
JavaScript
var $o = Object.defineProperty, To = Object.defineProperties;
var Io = Object.getOwnPropertyDescriptors;
var Un = Object.getOwnPropertySymbols;
var _o = Object.prototype.hasOwnProperty, So = Object.prototype.propertyIsEnumerable;
var Zn = (e, n, t) => n in e ? $o(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, ie = (e, n) => {
for (var t in n || (n = {}))
_o.call(n, t) && Zn(e, t, n[t]);
if (Un)
for (var t of Un(n))
So.call(n, t) && Zn(e, t, n[t]);
return e;
}, dt = (e, n) => To(e, Io(n));
var j = (e, n, t) => new Promise((l, r) => {
var a = (h) => {
try {
w(t.next(h));
} catch (c) {
r(c);
}
}, i = (h) => {
try {
w(t.throw(h));
} catch (c) {
r(c);
}
}, w = (h) => h.done ? l(h.value) : Promise.resolve(h.value).then(a, i);
w((t = t.apply(e, n)).next());
});
import { getMarkdown as Eo, parseMarkdownToStructure as Lo, setDefaultMathOptions as No } from "stream-markdown-parser";
import { defineComponent as V, createElementBlock as g, openBlock as d, withMemo as zt, createVNode as Ue, unref as $, createElementVNode as m, Fragment as re, renderList as pe, toDisplayString as ee, computed as L, ref as M, watch as U, nextTick as de, onBeforeUnmount as mn, createBlock as me, Teleport as mo, Transition as hn, withCtx as Tt, withDirectives as an, normalizeClass as A, normalizeStyle as ze, vShow as sn, createApp as Ho, h as Tn, inject as Ro, provide as jo, createCommentVNode as se, renderSlot as et, shallowRef as ho, readonly as zo, defineAsyncComponent as Dt, resolveDynamicComponent as He, useAttrs as Do, mergeProps as jt, isMemoSame as fo, onMounted as vo, onUnmounted as Ao, withModifiers as Po, createTextVNode as Gn, markRaw as Jn, reactive as bn } from "vue";
import { autoUpdate as Qn, offset as Vo, flip as Wo, shift as Ko, computePosition as Oo } from "@floating-ui/dom";
const Fo = ["cite"], Xo = /* @__PURE__ */ V({
__name: "BlockquoteNode",
props: {
node: {},
indexKey: {},
typewriter: { type: Boolean }
},
emits: ["copy"],
setup(e) {
return (n, t) => (d(), g("blockquote", {
class: "blockquote",
dir: "auto",
cite: e.node.cite
}, [
zt([e.node.children], () => Ue($(qe), {
"index-key": `blockquote-${e.indexKey}`,
nodes: e.node.children || [],
typewriter: e.typewriter,
onCopy: t[0] || (t[0] = (l) => n.$emit("copy", l))
}, null, 8, ["index-key", "nodes", "typewriter"]), t, 1)
], 8, Fo));
}
}), X = (e, n) => {
const t = e.__vccOpts || e;
for (const [l, r] of n)
t[l] = r;
return t;
}, Ut = /* @__PURE__ */ X(Xo, [["__scopeId", "data-v-adfdba00"]]);
Ut.install = (e) => {
e.component(Ut.__name, Ut);
};
const Yo = { class: "checkbox-node" }, qo = ["checked"], Uo = /* @__PURE__ */ V({
__name: "CheckboxNode",
props: {
node: {}
},
setup(e) {
return (n, t) => (d(), g("span", Yo, [
m("input", {
type: "checkbox",
checked: e.node.checked,
disabled: "",
class: "checkbox-input"
}, null, 8, qo)
]));
}
}), tt = /* @__PURE__ */ X(Uo, [["__scopeId", "data-v-8dc6c46f"]]);
tt.install = (e) => {
e.component(tt.__name, tt);
};
const Zo = { class: "definition-list" }, Go = { class: "definition-term" }, Jo = { class: "definition-desc" }, Qo = /* @__PURE__ */ V({
__name: "DefinitionListNode",
props: {
node: {},
indexKey: {},
typewriter: { type: Boolean }
},
emits: ["copy"],
setup(e) {
return (n, t) => (d(), g("dl", Zo, [
(d(!0), g(re, null, pe(e.node.items, (l, r) => (d(), g(re, { key: r }, [
m("dt", Go, [
Ue($(qe), {
"index-key": `definition-term-${e.indexKey}-${r}`,
nodes: l.term,
typewriter: e.typewriter,
onCopy: t[0] || (t[0] = (a) => n.$emit("copy", a))
}, null, 8, ["index-key", "nodes", "typewriter"])
]),
m("dd", Jo, [
Ue($(qe), {
"index-key": `definition-desc-${e.indexKey}-${r}`,
nodes: l.definition,
typewriter: e.typewriter,
onCopy: t[1] || (t[1] = (a) => n.$emit("copy", a))
}, null, 8, ["index-key", "nodes", "typewriter"])
])
], 64))), 128))
]));
}
}), Zt = /* @__PURE__ */ X(Qo, [["__scopeId", "data-v-5a21f288"]]);
Zt.install = (e) => {
e.component(Zt.__name, Zt);
};
const er = { class: "emoji-node" }, tr = /* @__PURE__ */ V({
__name: "EmojiNode",
props: {
node: {}
},
setup(e) {
return (n, t) => (d(), g("span", er, ee(e.node.name), 1));
}
}), Te = /* @__PURE__ */ X(tr, [["__scopeId", "data-v-de55dc97"]]);
Te.install = (e) => {
e.component(Te.__name, Te);
};
const ln = "__global__", Ct = {};
function As(e, n) {
typeof e == "string" ? Ct[e] = n || {} : Ct[ln] = e || {};
}
function Ze(e) {
return e ? Ct[e] || Ct[ln] || {} : Ct[ln] || {};
}
function Ps(e) {
if (e === ln)
throw new Error("removeCustomComponents: use clearGlobalCustomComponents() to clear the global mapping");
delete Ct[e];
}
function Vs() {
delete Ct[ln];
}
const nr = ["id"], or = ["title"], rr = /* @__PURE__ */ V({
__name: "FootnoteReferenceNode",
props: {
node: {}
},
setup(e) {
const t = `#footnote-${e.node.id}`;
function l() {
if (typeof document == "undefined")
return;
const r = document.querySelector(t);
r ? r.scrollIntoView({ behavior: "smooth" }) : console.warn(`Element with href: ${t} not found`);
}
return (r, a) => (d(), g("sup", {
id: `fnref-${e.node.id}`,
class: "footnote-reference",
onClick: l
}, [
m("span", {
href: t,
title: `查看脚注 ${e.node.id}`,
class: "footnote-link cursor-pointer"
}, "[" + ee(e.node.id) + "]", 9, or)
], 8, nr));
}
}), Ie = /* @__PURE__ */ X(rr, [["__scopeId", "data-v-01af0fee"]]);
Ie.install = (e) => {
e.component(Ie.__name, Ie);
};
const ar = { class: "inline text-[85%] px-1 py-0.5 rounded font-mono bg-secondary whitespace-normal break-words max-w-full before:content-[''] after:content-['']" }, _e = /* @__PURE__ */ V({
__name: "InlineCodeNode",
props: {
node: {}
},
setup(e) {
return (n, t) => (d(), g("code", ar, ee(e.node.code), 1));
}
});
_e.install = (e) => {
e.component(_e.__name, _e);
};
const ir = ["id"], sr = /* @__PURE__ */ V({
__name: "Tooltip",
props: {
visible: { type: Boolean },
anchorEl: {},
content: {},
placement: {},
offset: {},
originX: {},
originY: {},
id: {},
isDark: { type: [Boolean, null] }
},
setup(e) {
const n = e, t = L(() => {
if (n.isDark !== void 0 && n.isDark !== null)
return !!n.isDark;
if (typeof document != "undefined")
try {
if (document.documentElement.classList.contains("dark") || window != null && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches)
return !0;
} catch (h) {
}
return !1;
}), l = M(null), r = M({ transform: "translate3d(0px, 0px, 0px)", left: "0px", top: "0px" }), a = M(!1);
let i = null;
function w() {
return j(this, null, function* () {
var v, B;
if (!n.anchorEl || !l.value)
return;
const h = [Vo((v = n.offset) != null ? v : 8), Wo(), Ko({ padding: 8 })], { x: c, y: k } = yield Oo(n.anchorEl, l.value, {
placement: (B = n.placement) != null ? B : "top",
middleware: h,
strategy: "fixed"
});
r.value.transform = `translate3d(${Math.round(c)}px, ${Math.round(k)}px, 0)`, r.value.left = "0px", r.value.top = "0px";
});
}
return U(
() => n.visible,
(h) => j(null, null, function* () {
if (h)
if (a.value = !1, yield de(), n.anchorEl && l.value)
try {
const c = n.anchorEl.getBoundingClientRect();
yield w();
const k = r.value.transform;
if (n.originX != null && n.originY != null) {
const v = Math.abs(Number(n.originX) - c.left), B = Math.abs(Number(n.originY) - c.top);
Math.hypot(v, B) > 120 ? (r.value.transform = `translate3d(${Math.round(n.originX)}px, ${Math.round(n.originY)}px, 0)`, yield de(), a.value = !0, yield de(), r.value.transform = k) : a.value = !0;
} else
a.value = !0;
i = Qn(n.anchorEl, l.value, w);
} catch (c) {
yield w(), a.value = !0, i = Qn(n.anchorEl, l.value, w);
}
else
a.value = !0;
else
a.value = !1, i && (i(), i = null);
})
), U([
() => n.anchorEl,
() => n.placement,
() => n.content
], () => j(null, null, function* () {
n.visible && n.anchorEl && l.value && (yield de(), yield w());
})), mn(() => {
i && i();
}), (h, c) => (d(), me(mo, { to: "body" }, [
Ue(hn, {
name: "tooltip",
appear: ""
}, {
default: Tt(() => [
an(m("div", {
id: n.id,
ref_key: "tooltip",
ref: l,
style: ze({ position: "fixed", left: r.value.left, top: r.value.top, transform: r.value.transform }),
class: A(["z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border", [t.value ? "bg-gray-900 text-white border-gray-700 border is-dark" : "bg-white text-gray-900 border-gray-200 border"]]),
role: "tooltip"
}, ee(e.content), 15, ir), [
[sn, e.visible && a.value]
])
]),
_: 1
})
]));
}
}), lr = /* @__PURE__ */ X(sr, [["__scopeId", "data-v-993f63aa"]]), An = M(!1), go = M(""), po = M("top"), Gt = M(null), cn = M(null), Pn = M(null), Vn = M(null), wo = M(null);
let Cn = null, Bn = null;
function ko() {
Cn && (clearTimeout(Cn), Cn = null), Bn && (clearTimeout(Bn), Bn = null);
}
let eo = !1;
function cr() {
if (eo || typeof document == "undefined")
return;
eo = !0;
const e = document.createElement("div");
e.setAttribute("data-singleton-tooltip", "1"), document.body.appendChild(e), Ho({
setup() {
return () => {
var t;
return Tn(lr, {
visible: An.value,
"anchor-el": Gt.value,
content: go.value,
placement: po.value,
id: cn.value,
originX: Pn.value,
originY: Vn.value,
isDark: (t = wo.value) != null ? t : void 0
});
};
}
}).mount(e);
}
function un(e, n, t = "top", l = !1, r, a) {
if (!e)
return;
cr(), ko();
const i = () => {
var w, h;
cn.value = `tooltip-${Date.now()}-${Math.floor(Math.random() * 1e3)}`, Gt.value = e, go.value = n, po.value = t, Pn.value = (w = r == null ? void 0 : r.x) != null ? w : null, Vn.value = (h = r == null ? void 0 : r.y) != null ? h : null, wo.value = typeof a == "boolean" ? a : null, An.value = !0;
try {
e.setAttribute("aria-describedby", cn.value);
} catch (c) {
}
};
l ? i() : Cn = setTimeout(i, 80);
}
function Wn(e = !1) {
ko();
const n = () => {
if (Gt.value && cn.value)
try {
Gt.value.removeAttribute("aria-describedby");
} catch (t) {
}
An.value = !1, Gt.value = null, cn.value = null, Pn.value = null, Vn.value = null;
};
e ? n() : Bn = setTimeout(n, 120);
}
function ur(e) {
return (e.split(".").pop() || e).replace(/[_-]/g, " ").replace(/([A-Z])/g, " $1").replace(/\s+/g, " ").replace(/\b\w/g, (t) => t.toUpperCase()).trim();
}
const yo = {
"common.copy": "Copy",
"common.copySuccess": "Copied",
"common.decrease": "Decrease",
"common.reset": "Reset",
"common.increase": "Increase",
"common.expand": "Expand",
"common.collapse": "Collapse",
"common.preview": "Preview",
"common.source": "Source",
"common.export": "Export",
"common.open": "Open",
"common.zoomIn": "Zoom in",
"common.zoomOut": "Zoom out",
"common.resetZoom": "Reset zoom",
"image.loadError": "Image failed to load",
"image.loading": "Loading image..."
};
function Ws(e) {
Object.assign(yo, e);
}
function Kn() {
try {
const n = globalThis.$vueI18nUse || null;
if (n && typeof n == "function")
try {
const t = n();
if (t && typeof t.t == "function")
return { t: t.t.bind(t) };
} catch (t) {
}
} catch (n) {
}
const e = (n) => {
var t;
return (t = yo[n]) != null ? t : ur(n);
};
return j(null, null, function* () {
try {
const n = yield import("vue-i18n"), t = n.useI18n || n.default && n.default.useI18n;
if (t && typeof t == "function")
try {
const l = t();
if (l && typeof l.t == "function")
try {
globalThis.$vueI18nUse = () => l;
} catch (r) {
}
} catch (l) {
}
} catch (n) {
}
}), { t: e };
}
const xo = Symbol("ViewportPriority");
function dr(e, n) {
const t = typeof window != "undefined" && typeof document != "undefined", l = typeof n == "boolean" ? M(n) : n;
let r = null;
const a = /* @__PURE__ */ new WeakMap();
function i() {
var c;
if (r || !t)
return r;
if (typeof IntersectionObserver == "undefined")
return null;
const h = (c = e()) != null ? c : null;
return r = new IntersectionObserver((k) => {
for (const v of k) {
const B = a.get(v.target);
if (!B)
continue;
if (v.isIntersecting || v.intersectionRatio > 0) {
if (!B.visible.value) {
B.visible.value = !0;
try {
B.resolve();
} catch (O) {
}
}
r == null || r.unobserve(v.target), a.delete(v.target);
}
}
}, {
root: h,
rootMargin: "300px",
// prefetch slightly before entering viewport
threshold: 0
}), r;
}
const w = (h, c) => {
const k = M(!1);
let v = !1, B;
const I = new Promise((K) => {
B = () => {
v || (v = !0, K());
};
}), O = () => {
try {
r == null || r.unobserve(h);
} catch (K) {
}
a.delete(h);
};
if (!t || !l.value)
return k.value = !0, B(), { isVisible: k, whenVisible: I, destroy: O };
const D = i();
return D ? (a.set(h, { resolve: B, visible: k }), D.observe(h), { isVisible: k, whenVisible: I, destroy: O }) : (k.value = !0, B(), { isVisible: k, whenVisible: I, destroy: O });
};
return jo(xo, w), w;
}
function On() {
const e = Ro(xo, void 0);
if (e)
return e;
const n = /* @__PURE__ */ new WeakMap();
let t = null;
const l = () => t || (typeof window == "undefined" || typeof IntersectionObserver == "undefined" ? null : (t = new IntersectionObserver((a) => {
for (const i of a) {
const w = n.get(i.target);
if (!w)
continue;
if (i.isIntersecting || i.intersectionRatio > 0) {
if (!w.visible.value) {
w.visible.value = !0;
try {
w.resolve();
} catch (c) {
}
}
t == null || t.unobserve(i.target), n.delete(i.target);
}
}
}, { root: null, rootMargin: "300px", threshold: 0 }), t));
return (a) => {
const i = M(!1);
let w = !1, h;
const c = new Promise((B) => {
h = () => {
w || (w = !0, B());
};
}), k = () => {
try {
t == null || t.unobserve(a);
} catch (B) {
}
n.delete(a);
}, v = l();
return v ? (n.set(a, { resolve: h, visible: i }), v.observe(a), { isVisible: i, whenVisible: c, destroy: k }) : (i.value = !0, h(), { isVisible: i, whenVisible: c, destroy: k });
};
}
const mr = { class: "relative inline-block" }, hr = ["src", "alt", "title", "loading", "tabindex", "aria-label"], fr = { class: "text-sm whitespace-nowrap" }, vr = {
key: 1,
class: "text-sm text-gray-500"
}, gr = {
key: "error",
class: "px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500"
}, pr = { class: "text-sm whitespace-nowrap" }, wr = {
key: 0,
class: "mt-2 text-sm text-gray-500 italic"
}, kr = /* @__PURE__ */ V({
__name: "ImageNode",
props: {
node: {},
fallbackSrc: { default: "" },
showCaption: { type: Boolean, default: !1 },
lazy: { type: Boolean, default: !0 },
svgMinHeight: { default: "12rem" },
usePlaceholder: { type: Boolean, default: !0 }
},
emits: ["load", "error", "click"],
setup(e, { emit: n }) {
const t = e, l = n, r = M(!1), a = M(!1), i = M(!1), w = M(null), h = On(), c = M(null), k = M(typeof window == "undefined");
typeof window != "undefined" && U(
() => w.value,
(N) => {
var W;
if ((W = c.value) == null || W.destroy(), c.value = null, !N) {
k.value = !1;
return;
}
const ke = h(N, { rootMargin: "400px" });
c.value = ke, k.value = ke.isVisible.value, ke.whenVisible.then(() => {
k.value = !0;
});
},
{ immediate: !0 }
), mn(() => {
var N;
(N = c.value) == null || N.destroy(), c.value = null;
});
const v = L(() => a.value && t.fallbackSrc ? t.fallbackSrc : t.node.src), B = L(() => !t.lazy || k.value), I = L(() => /\.svg(?:\?|$)/i.test(v.value));
function O() {
t.fallbackSrc && !i.value ? (i.value = !0, a.value = !0) : (a.value = !0, l("error", t.node.src));
}
function D() {
r.value = !0, a.value = !1, l("load", v.value);
}
function K(N) {
N.preventDefault(), !(!r.value || a.value) && l("click", [N, v.value]);
}
const { t: H } = Kn();
return U(v, () => {
r.value = !1, a.value = !1;
}), (N, ke) => (d(), g("figure", {
ref_key: "figureRef",
ref: w,
class: "text-center my-8"
}, [
m("div", mr, [
Ue(hn, {
name: "img-switch",
mode: "out-in"
}, {
default: Tt(() => {
var W, Z, S, le, te;
return [
!e.node.loading && !a.value && B.value ? (d(), g("img", {
key: "image",
src: v.value,
alt: String((Z = (W = t.node.alt) != null ? W : t.node.title) != null ? Z : ""),
title: String((le = (S = t.node.title) != null ? S : t.node.alt) != null ? le : ""),
class: A(["max-w-96 h-auto rounded-lg transition-opacity duration-200 ease-in-out", { "opacity-0": !r.value, "opacity-100": r.value, "cursor-pointer": r.value }]),
style: ze(I.value ? { minHeight: t.svgMinHeight, width: "100%", height: "auto", objectFit: "contain" } : void 0),
loading: t.lazy ? "lazy" : "eager",
decoding: "async",
tabindex: r.value ? 0 : -1,
"aria-label": (te = t.node.alt) != null ? te : $(H)("image.preview"),
onError: O,
onLoad: D,
onClick: K
}, null, 46, hr)) : a.value ? !e.node.loading && !t.fallbackSrc ? (d(), g("div", gr, [
et(N.$slots, "error", {
node: t.node,
displaySrc: v.value,
imageLoaded: r.value,
hasError: a.value,
fallbackSrc: t.fallbackSrc,
lazy: t.lazy,
isSvg: I.value
}, () => [
ke[1] || (ke[1] = m("svg", {
xmlns: "http://www.w3.org/2000/svg",
width: "16",
height: "16",
viewBox: "0 0 24 24"
}, [
m("path", {
fill: "currentColor",
d: "M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"
})
], -1)),
m("span", pr, ee($(H)("image.loadError")), 1)
], !0)
])) : se("", !0) : (d(), g("div", {
key: "placeholder",
class: "placeholder-layer max-w-96 inline-flex items-center justify-center gap-2",
style: ze(I.value ? { minHeight: t.svgMinHeight, width: "100%" } : { minHeight: "6rem" })
}, [
t.usePlaceholder ? et(N.$slots, "placeholder", {
key: 0,
node: t.node,
displaySrc: v.value,
imageLoaded: r.value,
hasError: a.value,
fallbackSrc: t.fallbackSrc,
lazy: t.lazy,
isSvg: I.value
}, () => [
ke[0] || (ke[0] = m("div", {
class: "w-4 h-4 rounded-full border-2 border-solid border-current border-t-transparent animate-spin",
"aria-hidden": "true"
}, null, -1)),
m("span", fr, ee($(H)("image.loading")), 1)
], !0) : (d(), g("span", vr, ee(e.node.raw), 1))
], 4))
];
}),
_: 3
})
]),
t.showCaption && t.node.alt ? (d(), g("figcaption", wr, ee(t.node.alt), 1)) : se("", !0)
], 512));
}
}), mt = /* @__PURE__ */ X(kr, [["__scopeId", "data-v-7ca79b66"]]);
mt.install = (e) => {
e.component(mt.__name, mt);
};
let Mn = null, to = !1;
function Fn() {
return j(this, null, function* () {
if (Mn)
return Mn;
if (to)
return null;
try {
return Mn = yield import("katex"), yield import("katex/contrib/mhchem"), Mn;
} catch (e) {
return to = !0, null;
}
});
}
const Rn = ho(!1);
let no = null;
function bo() {
return no || (no = Fn().then((e) => {
Rn.value = !!e;
}).catch(() => {
Rn.value = !1;
})), zo(Rn);
}
const yr = /* @__PURE__ */ V({
__name: "TextNode",
props: {
node: {}
},
emits: ["copy"],
setup(e) {
const n = bo();
return (t, l) => (d(), g("span", {
class: A([[$(n) && e.node.center ? "text-node-center" : ""], "whitespace-pre-wrap break-words text-node"])
}, ee(e.node.content), 3));
}
}), we = /* @__PURE__ */ X(yr, [["__scopeId", "data-v-56f30838"]]);
we.install = (e) => {
e.component(we.__name, we);
};
const nt = Dt(() => j(null, null, function* () {
var n, t;
if (typeof globalThis != "undefined" && typeof globalThis.process != "undefined" && ((t = (n = globalThis.process) == null ? void 0 : n.env) == null ? void 0 : t.NODE_ENV) === "test")
return (l) => {
var r, a;
return Tn(we, dt(ie({}, l), {
node: dt(ie({}, l.node), {
content: (a = l.node.raw) != null ? a : `$${(r = l.node.content) != null ? r : ""}$`
})
}));
};
try {
if (yield Fn())
return (yield import("./index-Cc3u_ylp.js")).default;
} catch (l) {
console.warn(
'[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',
l
);
}
return (l) => {
var r, a;
return Tn(we, dt(ie({}, l), {
node: dt(ie({}, l.node), {
content: (a = l.node.raw) != null ? a : `$${(r = l.node.content) != null ? r : ""}$`
})
}));
};
})), xr = Dt(() => j(null, null, function* () {
try {
if (yield Fn())
return (yield import("./index-ELonlW3Z.js")).default;
} catch (e) {
console.warn(
'[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',
e
);
}
return (e) => {
var n, t;
return Tn(we, dt(ie({}, e), {
node: dt(ie({}, e.node), {
content: (t = e.node.raw) != null ? t : `$$${(n = e.node.content) != null ? n : ""}$$`
})
}));
};
})), Se = /* @__PURE__ */ V({
__name: "ReferenceNode",
props: {
node: {},
messageId: {},
threadId: {}
},
emits: ["click", "mouseEnter", "mouseLeave"],
setup(e) {
return (n, t) => (d(), g("span", {
class: "reference-node cursor-pointer bg-accent text-xs rounded-md px-1.5 mx-0.5 hover:bg-secondary",
role: "button",
tabindex: "0",
onClick: t[0] || (t[0] = (l) => n.$emit("click", l, e.node.id, e.messageId, e.threadId)),
onMouseenter: t[1] || (t[1] = (l) => n.$emit("mouseEnter", l, e.node.id, e.messageId, e.threadId)),
onMouseleave: t[2] || (t[2] = (l) => n.$emit("mouseLeave", l, e.node.id, e.messageId, e.threadId))
}, ee(e.node.id), 33));
}
});
Se.install = (e) => {
e.component(Se.__name, Se);
};
const br = { class: "superscript-node" }, Mr = { key: 1 }, Cr = /* @__PURE__ */ V({
__name: "SuperscriptNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
strong: Ee,
emphasis: We,
footnote_reference: Ie,
strikethrough: Le,
highlight: Ve,
insert: Pe,
subscript: Ae,
emoji: Te,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => (d(), g("sup", br, [
(d(!0), g(re, null, pe(e.node.children, (a, i) => (d(), g(re, {
key: `${e.indexKey || "superscript"}-${i}`
}, [
t[a.type] ? (d(), me(He(t[a.type]), {
key: 0,
node: a,
"custom-id": n.customId,
"index-key": `${e.indexKey || "superscript"}-${i}`
}, null, 8, ["node", "custom-id", "index-key"])) : (d(), g("span", Mr, ee(a.content || a.raw), 1))
], 64))), 128))
]));
}
}), De = /* @__PURE__ */ X(Cr, [["__scopeId", "data-v-0ca396bb"]]);
De.install = (e) => {
e.component(De.__name, De);
};
const Br = { class: "subscript-node" }, $r = { key: 1 }, Tr = /* @__PURE__ */ V({
__name: "SubscriptNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
strong: Ee,
emphasis: We,
footnote_reference: Ie,
strikethrough: Le,
highlight: Ve,
insert: Pe,
superscript: De,
emoji: Te,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => (d(), g("sub", Br, [
(d(!0), g(re, null, pe(e.node.children, (a, i) => (d(), g(re, {
key: `${e.indexKey || "subscript"}-${i}`
}, [
t[a.type] ? (d(), me(He(t[a.type]), {
key: 0,
node: a,
"custom-id": n.customId,
"index-key": `${e.indexKey || "subscript"}-${i}`
}, null, 8, ["node", "custom-id", "index-key"])) : (d(), g("span", $r, ee(a.content || a.raw), 1))
], 64))), 128))
]));
}
}), Ae = /* @__PURE__ */ X(Tr, [["__scopeId", "data-v-5e1f04df"]]);
Ae.install = (e) => {
e.component(Ae.__name, Ae);
};
const Ir = { class: "strong-node" }, _r = /* @__PURE__ */ V({
__name: "StrongNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
emphasis: We,
strikethrough: Le,
highlight: Ve,
insert: Pe,
subscript: Ae,
superscript: De,
emoji: Te,
footnote_reference: Ie,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => (d(), g("strong", Ir, [
(d(!0), g(re, null, pe(e.node.children, (a, i) => (d(), me(He(t[a.type]), {
key: `${e.indexKey || "strong"}-${i}`,
"index-key": `${e.indexKey || "strong"}-${i}`,
node: a,
"custom-id": n.customId
}, null, 8, ["index-key", "node", "custom-id"]))), 128))
]));
}
}), Ee = /* @__PURE__ */ X(_r, [["__scopeId", "data-v-53b6c7df"]]);
Ee.install = (e) => {
e.component(Ee.__name, Ee);
};
const Sr = { class: "strikethrough-node" }, Er = /* @__PURE__ */ V({
__name: "StrikethroughNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
strong: Ee,
emphasis: We,
highlight: Ve,
insert: Pe,
subscript: Ae,
superscript: De,
emoji: Te,
footnote_reference: Ie,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => (d(), g("del", Sr, [
(d(!0), g(re, null, pe(e.node.children, (a, i) => (d(), me(He(t[a.type]), {
key: `${e.indexKey || "strikethrough"}-${i}`,
node: a,
"custom-id": n.customId,
"index-key": `${e.indexKey || "strikethrough"}-${i}`
}, null, 8, ["node", "custom-id", "index-key"]))), 128))
]));
}
}), Le = /* @__PURE__ */ X(Er, [["__scopeId", "data-v-3716d25c"]]);
Le.install = (e) => {
e.component(Le.__name, Le);
};
const Lr = ["href", "title", "aria-label", "aria-hidden"], Nr = ["aria-hidden"], Hr = { class: "link-text-wrapper relative inline-flex" }, Rr = { class: "leading-[normal] link-text" }, jr = { class: "leading-[normal] link-text" }, zr = /* @__PURE__ */ V({
__name: "LinkNode",
props: {
node: {},
indexKey: {},
customId: {},
showTooltip: { type: Boolean, default: !0 },
color: {},
underlineHeight: {},
underlineBottom: {},
animationDuration: {},
animationOpacity: {},
animationTiming: {},
animationIteration: {}
},
setup(e) {
const n = e, t = L(() => {
var c, k, v, B, I, O;
const h = n.underlineBottom !== void 0 ? typeof n.underlineBottom == "number" ? `${n.underlineBottom}px` : String(n.underlineBottom) : "-3px";
return {
"--link-color": (c = n.color) != null ? c : "#0366d6",
"--underline-height": `${(k = n.underlineHeight) != null ? k : 2}px`,
"--underline-bottom": h,
"--underline-opacity": String((v = n.animationOpacity) != null ? v : 0.9),
"--underline-duration": `${(B = n.animationDuration) != null ? B : 0.8}s`,
"--underline-timing": (I = n.animationTiming) != null ? I : "linear",
"--underline-iteration": typeof n.animationIteration == "number" ? String(n.animationIteration) : (O = n.animationIteration) != null ? O : "infinite"
};
}), l = {
text: we,
strong: Ee,
strikethrough: Le,
emphasis: We,
image: mt
}, r = Do();
function a(h) {
var B, I, O, D, K, H;
if (!n.showTooltip)
return;
const c = h, k = (c == null ? void 0 : c.clientX) != null && (c == null ? void 0 : c.clientY) != null ? { x: c.clientX, y: c.clientY } : void 0, v = (H = (K = (O = (B = n.node) == null ? void 0 : B.href) != null ? O : (I = n.node) == null ? void 0 : I.title) != null ? K : (D = n.node) == null ? void 0 : D.text) != null ? H : "";
un(h.currentTarget, v, "top", !1, k);
}
function i() {
n.showTooltip && Wn();
}
const w = L(() => {
var h, c;
return String((c = (h = n.node.title) != null ? h : n.node.href) != null ? c : "");
});
return (h, c) => e.node.loading ? (d(), g("span", jt({
key: 1,
class: "link-loading inline-flex items-baseline gap-1.5",
"aria-hidden": e.node.loading ? "false" : "true"
}, $(r), { style: t.value }), [
m("span", Hr, [
m("span", Rr, [
m("span", jr, ee(e.node.text), 1)
]),
c[1] || (c[1] = m("span", {
class: "underline-anim",
"aria-hidden": "true"
}, null, -1))
])
], 16, Nr)) : (d(), g("a", jt({
key: 0,
class: "link-node",
href: e.node.href,
title: w.value,
"aria-label": `Link: ${w.value}`,
"aria-hidden": e.node.loading ? "true" : "false",
target: "_blank",
rel: "noopener noreferrer"
}, $(r), {
style: t.value,
onMouseenter: c[0] || (c[0] = (k) => a(k)),
onMouseleave: i
}), [
(d(!0), g(re, null, pe(e.node.children, (k, v) => (d(), me(He(l[k.type]), {
key: `${e.indexKey || "emphasis"}-${v}`,
node: k,
"custom-id": n.customId,
"index-key": `${e.indexKey || "link-text"}-${v}`
}, null, 8, ["node", "custom-id", "index-key"]))), 128))
], 16, Lr));
}
}), Ne = /* @__PURE__ */ X(zr, [["__scopeId", "data-v-0ea92a03"]]);
Ne.install = (e) => {
e.component(Ne.__name, Ne);
};
const Dr = { class: "insert-node" }, Ar = /* @__PURE__ */ V({
__name: "InsertNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
strong: Ee,
emphasis: We,
strikethrough: Le,
highlight: Ve,
subscript: Ae,
superscript: De,
emoji: Te,
footnote_reference: Ie,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => (d(), g("ins", Dr, [
(d(!0), g(re, null, pe(e.node.children, (a, i) => (d(), me(He(t[a.type]), {
key: `${e.indexKey || "insert"}-${i}`,
node: a,
"custom-id": n.customId,
"index-key": `${e.indexKey || "insert"}-${i}`
}, null, 8, ["node", "custom-id", "index-key"]))), 128))
]));
}
}), Pe = /* @__PURE__ */ X(Ar, [["__scopeId", "data-v-b8737de3"]]);
Pe.install = (e) => {
e.component(Pe.__name, Pe);
};
const Pr = { class: "highlight-node" }, Vr = /* @__PURE__ */ V({
__name: "HighlightNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
strong: Ee,
emphasis: We,
strikethrough: Le,
insert: Pe,
subscript: Ae,
superscript: De,
emoji: Te,
footnote_reference: Ie,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => (d(), g("mark", Pr, [
(d(!0), g(re, null, pe(e.node.children, (a, i) => (d(), me(He(t[a.type]), {
key: `${e.indexKey || "highlight"}-${i}`,
node: a,
"custom-id": n.customId,
"index-key": `${e.indexKey || "highlight"}-${i}`
}, null, 8, ["node", "custom-id", "index-key"]))), 128))
]));
}
}), Ve = /* @__PURE__ */ X(Vr, [["__scopeId", "data-v-fc52b444"]]);
Ve.install = (e) => {
e.component(Ve.__name, Ve);
};
const Wr = { class: "emphasis-node" }, Kr = /* @__PURE__ */ V({
__name: "EmphasisNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
strong: Ee,
strikethrough: Le,
highlight: Ve,
insert: Pe,
subscript: Ae,
superscript: De,
emoji: Te,
footnote_reference: Ie,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => (d(), g("em", Wr, [
(d(!0), g(re, null, pe(e.node.children, (a, i) => (d(), me(He(t[a.type]), {
key: `${e.indexKey || "emphasis"}-${i}`,
node: a,
"custom-id": n.customId,
"index-key": `${e.indexKey || "emphasis"}-${i}`
}, null, 8, ["node", "custom-id", "index-key"]))), 128))
]));
}
}), We = /* @__PURE__ */ X(Kr, [["__scopeId", "data-v-c25e2822"]]);
We.install = (e) => {
e.component(We.__name, We);
};
const Or = ["href", "title"], Fr = /* @__PURE__ */ V({
__name: "FootnoteAnchorNode",
props: {
node: {}
},
setup(e) {
const n = e;
function t(l) {
var i;
if (l.preventDefault(), typeof document == "undefined")
return;
const r = `fnref-${String((i = n.node.id) != null ? i : "")}`, a = document.getElementById(r);
a && a.scrollIntoView({ behavior: "smooth" });
}
return (l, r) => (d(), g("a", {
class: "footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",
href: `#fnref-${e.node.id}`,
title: `返回引用 ${e.node.id}`,
onClick: t
}, " ↩︎ ", 8, Or));
}
}), Nt = /* @__PURE__ */ X(Fr, [["__scopeId", "data-v-4756ce0d"]]);
Nt.install = (e) => {
e.component(Nt.__name, Nt);
};
const Xr = ["id"], Yr = { class: "flex-1" }, Jt = /* @__PURE__ */ V({
__name: "FootnoteNode",
props: {
node: {},
indexKey: {},
typewriter: { type: Boolean }
},
emits: ["copy"],
setup(e) {
return (n, t) => (d(), g("div", {
id: `fnref--${e.node.id}`,
class: "flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2"
}, [
m("div", Yr, [
zt([e.node.children], () => Ue($(qe), {
"index-key": `footnote-${e.indexKey}`,
nodes: e.node.children,
typewriter: e.typewriter,
onCopy: t[0] || (t[0] = (l) => n.$emit("copy", l))
}, null, 8, ["index-key", "nodes", "typewriter"]), t, 1)
])
], 8, Xr));
}
});
Jt.install = (e) => {
e.component(Jt.__name, Jt);
};
const qr = { class: "hard-break" }, Ur = /* @__PURE__ */ V({
__name: "HardBreakNode",
props: {
node: {}
},
setup(e) {
return (n, t) => (d(), g("br", qr));
}
}), Bt = /* @__PURE__ */ X(Ur, [["__scopeId", "data-v-50c58f70"]]);
Bt.install = (e) => {
e.component(Bt.__name, Bt);
};
const Zr = /* @__PURE__ */ V({
__name: "HeadingNode",
props: {
node: {},
customId: {},
indexKey: {}
},
setup(e) {
const n = e, t = ie({
text: we,
inline_code: _e,
link: Ne,
image: mt,
strong: Ee,
emphasis: We,
strikethrough: Le,
highlight: Ve,
insert: Pe,
subscript: Ae,
superscript: De,
emoji: Te,
checkbox: tt,
checkbox_input: tt,
footnote_reference: Ie,
hardbreak: Bt,
math_inline: nt,
reference: Se
}, Ze(n.customId));
return (l, r) => zt([e.node.children], () => (d(), me(He(`h${e.node.level}`), {
class: A(["heading-node", [`heading-${e.node.level}`]]),
dir: "auto"
}, {
default: Tt(() => [
(d(!0), g(re, null, pe(e.node.children, (a, i, w, h) => {
const c = [a];
if (h && h.key === `${e.indexKey || "heading"}-${i}` && fo(h, c)) return h;
const k = (d(), me(He(t[a.type]), {
key: `${e.indexKey || "heading"}-${i}`,
"custom-id": n.customId,
node: a,
"index-key": `${e.indexKey || "heading"}-${i}`
}, null, 8, ["custom-id", "node", "index-key"]));
return k.memo = c, k;
}, r, 0), 128))
]),
_: 1
}, 8, ["class"])), r, 2);
}
}), jn = /* @__PURE__ */ X(Zr, [["__scopeId", "data-v-d8e179e9"]]), Xn = jn;
Xn.install = (e) => {
e.component(jn.__name, jn);
};
const Gr = /* @__PURE__ */ V({
__name: "ListItemNode",
props: {
item: {},
indexKey: {},
value: {},
typewriter: { type: Boolean }
},
emits: ["copy"],
setup(e) {
const n = e, t = L(
() => n.value == null ? {} : { value: n.value }
);
return (l, r) => (d(), g("li", jt({
class: "list-item pl-1.5 my-2",
dir: "auto"
}, t.value), [
zt([n.item.children], () => Ue($(qe), {
"index-key": `list-item-${n.indexKey}`,
nodes: n.item.children,
typewriter: n.typewriter,
"batch-rendering": !1,
onCopy: r[0] || (r[0] = (a) => l.$emit("copy", a))
}, null, 8, ["index-key", "nodes", "typewriter"]), r, 1)
], 16));
}
}), Qt = /* @__PURE__ */ X(Gr, [["__scopeId", "data-v-e7aa2cc3"]]);
Qt.install = (e) => {
e.component(Qt.__name, Qt);
};
const Jr = /* @__PURE__ */ V({
__name: "ListNode",
props: {
node: {},
customId: {},
indexKey: {},
typewriter: { type: Boolean }
},
emits: ["copy"],
setup(e) {
return (n, t) => (d(), me(He(e.node.ordered ? "ol" : "ul"), {
class: A(["list-node", { "list-decimal": e.node.ordered, "list-disc": !e.node.ordered }])
}, {
default: Tt(() => [
(d(!0), g(re, null, pe(e.node.items, (l, r, a, i) => {
var c;
const w = [l];
if (i && i.key === `${e.indexKey || "list"}-${r}` && fo(i, w)) return i;
const h = (d(), me($(Qt), {
key: `${e.indexKey || "list"}-${r}`,
item: l,
"custom-id": e.customId,
"index-key": `${e.indexKey || "list"}-${r}`,
typewriter: e.typewriter,
value: e.node.ordered ? ((c = e.node.start) != null ? c : 1) + r : void 0,
onCopy: t[0] || (t[0] = (k) => n.$emit("copy", k))
}, null, 8, ["item", "custom-id", "index-key", "typewriter", "value"]));
return h.memo = w, h;
}, t, 1), 128))
]),
_: 1
}, 8, ["class"]));
}
}), en = /* @__PURE__ */ X(Jr, [["__scopeId", "data-v-79057d57"]]);
en.install = (e) => {
e.component(en.__name, en);
};
const Qr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20width='16'%20height='16'%3e%3cpath%20fill='none'%20stroke='%23ca9ee6'%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M1.5%202.5c0%206%202.25%205.75%204%207%20.83.67%201.17%202%201%204h3c-.17-2%20.17-3.33%201-4%201.75-1.25%204-1%204-7C12%202.5%2010%203%208%207%206%203%204%202.5%201.5%202.5'%20/%3e%3c/svg%3e";
function ea(e) {
try {
if (typeof globalThis != "undefined" && typeof globalThis.requestAnimationFrame == "function")
return globalThis.requestAnimationFrame(e);
} catch (n) {
}
return globalThis.setTimeout(e, 0);
}
let ge = null, ht = null;
const he = /* @__PURE__ */ new Map(), ta = 5;
let In = ta, zn = !1;
function Ks(e) {
zn = !!e;
}
function Os(e) {
Number.isFinite(e) && e > 0 && (In = Math.floor(e));
}
function Fs() {
return { inFlight: he.size, max: In };
}
const na = "WORKER_BUSY";
function Xs(e) {
ge = e, ht = null;
const n = e;
ge.onmessage = (t) => {
if (ge !== n)
return;
const { id: l, ok: r, result: a, error: i } = t.data, w = he.get(l);
w && (r === !1 || i ? w.reject(new Error(i || "Unknown error")) : w.resolve(a));
}, ge.onerror = (t) => {
var l, r;
if (ge === n) {
if (he.size === 0) {
(l = console.debug) == null || l.call(console, "[mermaidWorkerClient] Worker error (no pending):", (t == null ? void 0 : t.message) || t);
return;
}
try {
zn ? console.error("[mermaidWorkerClient] Worker error:", (t == null ? void 0 : t.message) || t) : (r = console.debug) == null || r.call(console, "[mermaidWorkerClient] Worker error:", (t == null ? void 0 : t.message) || t);
} catch (a) {
}
for (const [a, i] of he.entries())
i.reject(new Error(`Worker error: ${t.message}`));
he.clear();
}
}, ge.onmessageerror = (t) => {
var l, r;
if (ge === n) {
if (he.size === 0) {
(l = console.debug) == null || l.call(console, "[mermaidWorkerClient] Worker messageerror (no pending):", t);
return;
}
try {
zn ? console.error("[mermaidWorkerClient] Worker messageerror:", t) : (r = console.debug) == null || r.call(console, "[mermaidWorkerClient] Worker messageerror:", t);
} catch (a) {
}
for (const [a, i] of he.entries())
i.reject(new Error("Worker messageerror"));
he.clear();
}
};
}
function Ys() {
var e;
if (ge)
try {
for (const [n, t] of he.entries())
t.reject(new Error("Worker cleared"));
he.clear(), (e = ge.terminate) == null || e.call(ge);
} catch (n) {
}
ge = null, ht = null;
}
function oa() {
return ge || (ht = new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."), ht.name = "WorkerInitError", ht.code = "WORKER_INIT_ERROR", null);
}
function Mo(e, n, t = 1400) {
if (ht)
return Promise.reject(ht);
const l = oa();
if (!l)
return Promise.reject(ht);
if (he.size >= In) {
const r = new Error("Worker busy");
return r.name = "WorkerBusy", r.code = na, r.inFlight = he.size, r.max = In, Promise.reject(r);
}
return new Promise((r, a) => {
const i = Math.random().toString(36).slice(2);
let w = !1, h;
const c = () => {
w || (w = !0, h != null && globalThis.clearTimeout(h), he.delete(i));
}, k = {
resolve: (v) => {
c(), r(v);
},
reject: (v) => {
c(), a(v);
}
};
he.set(i, k);
try {
l.postMessage({ id: i, action: e, payload: n });
} catch (v) {
he.delete(i), a(v);
return;
}
h = globalThis.setTimeout(() => {
const v = new Error("Worker call timed out");
v.name = "WorkerTimeout", v.code = "WORKER_TIMEOUT";
const B = he.get(i);
B && B.reject(v);
}, t);
});
}
function ra(e, n, t = 1400) {
return j(this, null, function* () {
try {
return yield Mo("canParse", { code: e, theme: n }, t);
} catch (l) {
return Promise.reject(l);
}
});
}
function aa(e, n, t = 1400) {
return j(this, null, function* () {
try {
return yield Mo("findPrefix", { code: e, theme: n }, t);
} catch (l) {
return Promise.reject(l);
}
});
}
function oo() {
if (ge)
try {
for (const [e, n] of he.entries())
n.reject(new Error("Worker terminated"));
he.clear(), ge.terminate();
} finally {
ge = null;
}
}
let ve = null;
function ia() {
return j(this, null, function* () {
if (ve)
return ve;
try {
const e = yield import("mermaid"), n = e && e.default ? e.default : e;
if (n && (typeof n.render == "function" || typeof n.parse == "function" || typeof n.initialize == "function"))
ve = n;
else if (n && n.mermaidAPI && (typeof n.mermaidAPI.render == "function" || typeof n.mermaidAPI.parse == "function")) {
const t = n.mermaidAPI;
ve = dt(ie({}, n), {
render: t.render.bind(t),
parse: t.parse ? t.parse.bind(t) : void 0,
initialize: (l) => typeof n.initialize == "function" ? n.initialize(l) : t.initialize ? t.initialize(l) : void 0
});
} else e.mermaid && typeof e.mermaid.render == "function" ? ve = e.mermaid : ve = n;
} catch (e) {
throw new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.');
}
try {
const e = ve == null ? void 0 : ve.initialize;
ve.initialize = (n) => {
const t = ie({ suppressErrorRendering: !0 }, n || {});
if (typeof e == "function")
return e.call(ve, t);
if (ve != null && ve.mermaidAPI && typeof ve.mermaidAPI.initialize == "function")
return ve.mermaidAPI.initialize(t);
};
} catch (e) {
}
return ve;
});
}
const sa = { key: 0 }, la = {
key: 1,
class: "flex items-center space-x-2 overflow-hidden"
}, ca = ["src"], ua = { key: 2 }, da = { class: "flex items-center space-x-1" }, ma = { class: "flex items-center space-x-1" }, ha = { key: 4 }, fa = {
key: 5,
class: "flex items-center space-x-1"
}, va = ["aria-pressed"], ga = {
key: 0,
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
"aria-hidden": "true",
role: "img",
width: "1em",
height: "1em",
viewBox: "0 0 24 24",
class: "w-3 h-3"
}, pa = {
key: 1,
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
"aria-hidden": "true",
role: "img",
width: "1em",
height: "1em",
viewBox: "0 0 24 24",
class: "w-3 h-3"
}, wa = ["disabled"], ka = ["disabled"], ya = {
key: 0,
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
"aria-hidden": "true",
role: "img",
width: "0.75rem",
height: "0.75rem",
viewBox: "0 0 24 24"
}, xa = {
key: 1,
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
"aria-hidden": "true",
role: "img",
width: "0.75rem",
height: "0.75rem",
viewBox: "0 0 24 24"
}, ba = {
key: 1,
class: "relative"
}, Ma = {
key: 0,
class: "absolute top-2 right-2 z-10 rounded-lg"
}, Ca = { class: "flex items-center gap-2 backdrop-blur rounded-lg" }, Ba = { class: "absolute top-6 right-6 z-50 flex items-center gap-2" }, $a = 300, Ta = 500, Ia = /* @__PURE__ */ V({
__name: "MermaidBlockNode",
props: {
node: {},
maxHeight: { default: "500px" },
loading: { type: Boolean, default: !0 },
isDark: { type: Boolean },
workerTimeoutMs: { default: 1400 },
parseTimeoutMs: { default: 1800 },
renderTimeoutMs: { default: 2500 },
fullRenderTimeoutMs: { default: 4e3 },
showHeader: { type: Boolean, default: !0 },
showModeToggle: { type: Boolean, default: !0 },
showCopyButton: { type: Boolean, default: !0 },
showExportButton: { type: Boolean, default: !0 },
showFullscreenButton: { type: Boolean, default: !0 },
showCollapseButton: { type: Boolean, default: !0 },
showZoomControls: { type: Boolean, default: !0 }
},
emits: ["copy", "export", "openModal", "toggleMode"],
setup(e, { emit: n }) {
var Yn, qn;
const t = e, l = n, { t: r } = Kn();
let a = null;
const i = M(!1);
typeof window != "undefined" && j(null, null, function* () {
var s;
a = yield ia(), i.value = !!a, (s = a == null ? void 0 : a.initialize) == null || s.call(a, { startOnLoad: !1, securityLevel: "loose" });
});
const w = M(!1), h = M(!1), c = M(), k = M(), v = M(), B = M(), I = M(null), O = On(), D = M(null), K = M(typeof window == "undefined"), H = M(), N = L(() => t.node.code.replace(/\]::([^:])/g, "]:::$1").replace(/:::subgraphNode$/gm, "::subgraphNode"));
function ke(s) {
const o = N.value, b = `%%{init: {"theme": "${s === "dark" ? "dark" : "default"}"}}%%
`;
return o.trim().startsWith("%%{") ? o : b + o;
}
const W = M(1), Z = M(0), S = M(0), le = M(!1), te = M({ x: 0, y: 0 }), Y = M(!1), be = M(!1), G = M(!1), ut = M(null), ot = M(0), rt = M(!1);
let Ke = null;
const ae = M("360px");
let ne