md-editor-v3 4.7.0 → 4.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +17 -1
  2. package/lib/cjs/MdCatalog.cjs +1 -1
  3. package/lib/cjs/MdEditor.cjs +27 -27
  4. package/lib/cjs/MdModal.cjs +1 -1
  5. package/lib/cjs/MdPreview.cjs +1 -1
  6. package/lib/cjs/ModalToolbar.cjs +1 -1
  7. package/lib/cjs/chunks/config.cjs +1 -1
  8. package/lib/cjs/chunks/index.cjs +8 -1
  9. package/lib/cjs/chunks/index3.cjs +1 -2
  10. package/lib/cjs/chunks/index4.cjs +2 -8
  11. package/lib/cjs/config.cjs +1 -1
  12. package/lib/cjs/index.cjs +1 -1
  13. package/lib/es/DropdownToolbar.mjs +2 -2
  14. package/lib/es/MdCatalog.mjs +1 -1
  15. package/lib/es/MdEditor.mjs +717 -674
  16. package/lib/es/MdModal.mjs +1 -1
  17. package/lib/es/MdPreview.mjs +2 -2
  18. package/lib/es/ModalToolbar.mjs +1 -1
  19. package/lib/es/chunks/config.mjs +19 -19
  20. package/lib/es/chunks/index.mjs +1248 -138
  21. package/lib/es/chunks/index2.mjs +2 -2
  22. package/lib/es/chunks/index3.mjs +163 -79
  23. package/lib/es/chunks/index4.mjs +77 -1258
  24. package/lib/es/config.mjs +10 -2
  25. package/lib/es/index.mjs +24 -17
  26. package/lib/style.css +1 -1
  27. package/lib/types/MdEditor/Editor.d.ts +9 -0
  28. package/lib/types/MdEditor/config.d.ts +2 -2
  29. package/lib/types/MdEditor/index.d.ts +15 -0
  30. package/lib/types/MdEditor/layouts/Content/composition/index.d.ts +2 -1
  31. package/lib/types/MdEditor/layouts/Content/composition/useResize.d.ts +12 -0
  32. package/lib/types/MdEditor/layouts/Content/index.d.ts +6 -0
  33. package/lib/types/MdEditor/layouts/Content/props.d.ts +3 -0
  34. package/lib/types/MdEditor/props.d.ts +10 -0
  35. package/lib/types/config.d.ts +3 -1
  36. package/lib/types/index.d.ts +1 -1
  37. package/lib/umd/index.js +31 -31
  38. package/package.json +1 -1
@@ -1,1268 +1,87 @@
1
- import { inject as P, onMounted as S, watch as $, toRef as X, nextTick as L, shallowRef as R, ref as B, computed as F, defineComponent as Q, createVNode as A, Fragment as ue, reactive as Y, provide as H, onBeforeUnmount as de } from "vue";
2
- import { c as C, p, m as me, k as O, a as U, h as fe, s as j, i as pe, b as he, d as G, e as D, f as ge, g as ye, j as ve } from "./config.mjs";
3
- import { u as be, a as we, b as g, P as ke, C as V, B as M, O as ee, E as $e, U as Ce, c as te, d as z, F as K, e as q, H as Z, f as W, R as ne, h as Ie, T as Se } from "./index3.mjs";
4
- import { a as _, u as Ee } from "./dom.mjs";
5
- import Pe from "medium-zoom";
6
- import { debounce as oe } from "@vavt/util";
7
- import Te from "copy-to-clipboard";
8
- import _e from "markdown-it";
9
- import He from "markdown-it-image-figures";
10
- import Fe from "markdown-it-task-lists";
11
- import Ae from "lru-cache";
12
- const Me = (e, a) => {
13
- const l = P("editorId"), { noImgZoomIn: t } = e, n = oe(() => {
14
- const r = document.querySelectorAll(`#${l}-preview img`);
15
- r.length !== 0 && Pe(r, {
16
- background: "#00000073"
17
- });
18
- });
19
- S(() => {
20
- !t && n();
21
- }), $([a, X(e.setting, "preview")], () => {
22
- !t && n();
23
- });
24
- }, Re = Me, xe = (e, a) => {
25
- if (typeof a[e] == "string")
26
- return a[e];
27
- const l = `<i class="${p}-iconfont ${p}-icon-${e}"></i>`;
28
- switch (C.iconfontType) {
29
- case "svg":
30
- return `<svg class="${p}-icon" aria-hidden="true"><use xlink:href="#${p}-icon-${e}"></use></svg>`;
31
- default:
32
- return l;
33
- }
34
- }, Le = (e, a) => {
35
- const l = P("editorId"), t = P("usedLanguageText"), n = P("customIcon"), r = () => {
36
- document.querySelectorAll(`#${l}-preview pre`).forEach((u) => {
37
- var b, v;
38
- let s = -1;
39
- (b = u.querySelector(".copy-button")) == null || b.remove();
40
- const o = ((v = t.value.copyCode) == null ? void 0 : v.text) || "复制代码", d = document.createElement("span");
41
- d.setAttribute("class", "copy-button"), d.dataset.tips = o, d.innerHTML = xe("copy", n.value), d.addEventListener("click", () => {
42
- var y, w;
43
- clearTimeout(s);
44
- const m = u.querySelector("code").innerText, h = Te(e.formatCopiedText(m)), f = ((y = t.value.copyCode) == null ? void 0 : y.successTips) || "已复制!", k = ((w = t.value.copyCode) == null ? void 0 : w.failTips) || "已复制!";
45
- d.dataset.tips = h ? f : k, s = window.setTimeout(() => {
46
- d.dataset.tips = o;
47
- }, 1500);
48
- }), u.appendChild(d);
49
- });
50
- }, i = () => {
51
- L(r);
52
- }, c = (u) => {
53
- u && L(r);
54
- };
55
- $(() => a.value, i), $(() => e.setting.preview, c), $(() => e.setting.htmlPreview, c), $(() => t.value, r), S(r);
56
- }, Be = Le, Ne = (e) => {
57
- var r;
58
- const a = (r = C.editorExtensions) == null ? void 0 : r.highlight, l = a == null ? void 0 : a.instance, t = P("highlight"), n = R(l);
59
- return S(() => {
60
- if (!e.noHighlight && !n.value) {
61
- const i = document.createElement("script");
62
- i.src = t.value.js, i.onload = () => {
63
- n.value = window.hljs;
64
- }, i.id = `${p}-hljs`, _(i, "hljs");
65
- const c = document.createElement("link");
66
- c.rel = "stylesheet", c.href = t.value.css, c.id = `${p}-hlCss`, _(c);
67
- }
68
- }), $(
69
- () => t.value.css,
70
- (i) => {
71
- Ee(`${p}-hlCss`, "href", i);
72
- }
73
- ), n;
74
- }, Oe = Ne, Ue = (e) => {
75
- const a = P("theme"), { editorExtensions: l } = C, t = l == null ? void 0 : l.mermaid, n = R(t == null ? void 0 : t.instance), r = R(-1), i = new Ae({
76
- max: 1e3,
77
- // 缓存10分钟
78
- ttl: 6e5
79
- }), c = () => {
80
- const s = n.value;
81
- !e.noMermaid && s && (s.initialize({
82
- startOnLoad: !1,
83
- theme: a.value === "dark" ? "dark" : "default"
84
- }), r.value = r.value + 1);
85
- };
86
- return $(
87
- () => a.value,
88
- () => {
89
- i.clear(), c();
90
- }
91
- ), S(() => {
92
- if (!e.noMermaid && !(t != null && t.instance)) {
93
- const s = (t == null ? void 0 : t.js) || me;
94
- if (/\.mjs/.test(s))
95
- import(
96
- /* @vite-ignore */
97
- /* webpackIgnore: true */
98
- s
99
- ).then((o) => {
100
- n.value = o.default, c();
101
- });
102
- else {
103
- const o = document.createElement("script");
104
- o.id = `${p}-mermaid`, o.src = s, o.onload = () => {
105
- n.value = window.mermaid, c();
106
- }, _(o, "mermaid");
107
- }
108
- }
109
- }), { mermaidRef: n, reRenderRef: r, replaceMermaid: () => {
110
- L(() => {
111
- if (!e.noMermaid && n.value) {
112
- const s = document.querySelectorAll(
113
- `div.${p}-mermaid`
114
- ), o = document.createElement("div");
115
- o.style.width = document.body.offsetWidth + "px", o.style.height = document.body.offsetHeight + "px", o.style.position = "fixed", o.style.zIndex = "-10000", o.style.top = "-10000";
116
- let d = s.length;
117
- d > 0 && document.body.appendChild(o), s.forEach(async (b) => {
118
- let v = i.get(b.innerText);
119
- if (!v) {
120
- const h = be(), f = n.value.renderAsync || n.value.render;
121
- let k = "";
122
- try {
123
- k = await f(h, b.innerText, o);
124
- } catch {
125
- }
126
- v = typeof k == "string" ? k : k.svg, i.set(b.innerText, v);
127
- }
128
- const m = document.createElement("p");
129
- m.className = `${p}-mermaid`, m.setAttribute("data-processed", ""), m.innerHTML = v, b.dataset.line !== void 0 && (m.dataset.line = b.dataset.line), b.replaceWith(m), --d === 0 && o.remove();
130
- });
131
- }
132
- });
133
- } };
134
- }, je = Ue, Ge = (e) => {
135
- var n;
136
- const a = (n = C.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = R(l);
137
- return S(() => {
138
- if (!e.noKatex && !t.value) {
139
- const r = document.createElement("script");
140
- r.src = (a == null ? void 0 : a.js) || O.js, r.onload = () => {
141
- t.value = window.katex;
142
- }, r.id = `${p}-katex`;
143
- const i = document.createElement("link");
144
- i.rel = "stylesheet", i.href = (a == null ? void 0 : a.css) || O.css, i.id = `${p}-katexCss`, _(r, "katex"), _(i);
145
- }
146
- }), t;
147
- }, De = Ge, Ve = (e, a) => {
148
- const l = e.renderer.rules.fence.bind(e.renderer.rules);
149
- e.renderer.rules.fence = (t, n, r, i, c) => {
150
- const u = t[n], s = u.content.trim();
151
- if (u.info === "mermaid") {
152
- let o;
153
- return t[n].map && t[n].level === 0 && (o = t[n].map[0], t[n].attrSet("data-line", String(o))), `<div class="${p}-mermaid" ${o !== void 0 ? "data-line=" + o : ""} data-mermaid-theme=${a.themeRef.value}>${s}</div>`;
154
- }
155
- return l(t, n, r, i, c);
156
- };
157
- }, ze = Ve, J = (e, a) => {
158
- let l = !0, t = !0;
159
- const n = e.posMax, r = a > 0 ? e.src.charCodeAt(a - 1) : -1, i = a + 1 <= n ? e.src.charCodeAt(a + 1) : -1;
160
- return (r === 32 || r === 9 || i >= 48 && i <= 57) && (t = !1), (i === 32 || i === 9) && (l = !1), {
161
- can_open: l,
162
- can_close: t
163
- };
164
- }, Ke = (e, a) => {
165
- let l, t, n, r;
166
- if (e.src[e.pos] !== "$")
167
- return !1;
168
- if (n = J(e, e.pos), !n.can_open)
169
- return a || (e.pending += "$"), e.pos += 1, !0;
170
- const i = e.pos + 1;
171
- for (l = i; (l = e.src.indexOf("$", l)) !== -1; ) {
172
- for (r = l - 1; e.src[r] === "\\"; )
173
- r -= 1;
174
- if ((l - r) % 2 == 1)
175
- break;
176
- l += 1;
177
- }
178
- return l === -1 ? (a || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (a || (e.pending += "$$"), e.pos = i + 1, !0) : (n = J(e, l), n.can_close ? (a || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(i, l)), e.pos = l + 1, !0) : (a || (e.pending += "$"), e.pos = i, !0));
179
- }, qe = (e, a, l, t) => {
180
- let n, r, i, c, u = !1, s = e.bMarks[a] + e.tShift[a], o = e.eMarks[a];
181
- if (s + 2 > o || e.src.slice(s, s + 2) !== "$$")
182
- return !1;
183
- if (s += 2, n = e.src.slice(s, o), t)
184
- return !0;
185
- for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2), u = !0), i = a; !u && (i++, !(i >= l || (s = e.bMarks[i] + e.tShift[i], o = e.eMarks[i], s < o && e.tShift[i] < e.blkIndent))); )
186
- e.src.slice(s, o).trim().slice(-2) === "$$" && (c = e.src.slice(0, o).lastIndexOf("$$"), r = e.src.slice(s, c), u = !0);
187
- e.line = i + 1;
188
- const d = e.push("math_block", "math", 0);
189
- return d.block = !0, d.content = (n && n.trim() ? n + `
190
- ` : "") + e.getLines(a + 1, i, e.tShift[a], !0) + (r && r.trim() ? r : ""), d.map = [a, e.line], d.markup = "$$", !0;
191
- }, Ze = (e, a) => {
192
- const l = (n) => {
193
- if (a.katexRef.value) {
194
- const r = a.katexRef.value.renderToString(n, {
195
- throwOnError: !1
196
- });
197
- return `<span class="${p}-katex-inline" data-processed>${r}</span>`;
198
- } else
199
- return `<span class="${p}-katex-inline">${n}</span>`;
200
- }, t = (n, r) => {
201
- if (a.katexRef.value) {
202
- const i = a.katexRef.value.renderToString(n, {
203
- throwOnError: !1,
204
- displayMode: !0
205
- });
206
- return `<p class="${p}-katex-block" data-line=${r} data-processed>${i}</p>`;
207
- } else
208
- return `<p class="${p}-katex-block" data-line=${r}>${n}</p>`;
209
- };
210
- e.inline.ruler.after("escape", "math_inline", Ke), e.block.ruler.after("blockquote", "math_block", qe, {
211
- alt: ["paragraph", "reference", "blockquote", "list"]
212
- }), e.renderer.rules.math_inline = (n, r) => l(n[r].content), e.renderer.rules.math_block = (n, r) => t(n[r].content, n[r].map[0]) + `
213
- `;
214
- }, We = Ze, Je = (e, a) => {
215
- a = a || {};
216
- const l = 3, t = a.marker || "!", n = t.charCodeAt(0), r = t.length;
217
- let i = "", c = "";
218
- const u = (o, d, b, v, m) => {
219
- const h = o[d];
220
- return h.type === "admonition_open" ? (o[d].attrPush([
221
- "class",
222
- `${p}-admonition ${p}-admonition-${h.info}`
223
- ]), o[d].attrSet("data-line", String(o[d].map[0]))) : h.type === "admonition_title_open" && o[d].attrPush(["class", `${p}-admonition-title`]), m.renderToken(o, d, b);
224
- }, s = (o) => {
225
- const d = o.trim().split(" ", 2);
226
- c = "", i = d[0], d.length > 1 && (c = o.substring(i.length + 2)), (c === "" || !c) && (c = i);
227
- };
228
- e.block.ruler.before(
229
- "code",
230
- "admonition",
231
- (o, d, b, v) => {
232
- let m, h, f, k = !1, y = o.bMarks[d] + o.tShift[d], w = o.eMarks[d];
233
- if (n !== o.src.charCodeAt(y))
234
- return !1;
235
- for (m = y + 1; m <= w && t[(m - y) % r] === o.src[m]; m++)
236
- ;
237
- const I = Math.floor((m - y) / r);
238
- if (I !== l)
239
- return !1;
240
- m -= (m - y) % r;
241
- const E = o.src.slice(y, m), T = o.src.slice(m, w);
242
- if (s(T), v)
243
- return !0;
244
- for (h = d; h++, !(h >= b || (y = o.bMarks[h] + o.tShift[h], w = o.eMarks[h], y < w && o.sCount[h] < o.blkIndent)); )
245
- if (n === o.src.charCodeAt(y) && !(o.sCount[h] - o.blkIndent >= 4)) {
246
- for (m = y + 1; m <= w && t[(m - y) % r] === o.src[m]; m++)
247
- ;
248
- if (!(Math.floor((m - y) / r) < I) && (m -= (m - y) % r, m = o.skipSpaces(m), !(m < w))) {
249
- k = !0;
250
- break;
251
- }
252
- }
253
- const N = o.parentType, se = o.lineMax;
254
- return o.parentType = "root", o.lineMax = h, f = o.push("admonition_open", "div", 1), f.markup = E, f.block = !0, f.info = i, f.map = [d, h], f = o.push("admonition_title_open", "p", 1), f.markup = E + " " + i, f.map = [d, h], f = o.push("inline", "", 0), f.content = c, f.map = [d, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = E + " " + i, o.md.block.tokenize(o, d + 1, h), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(y, m), f.block = !0, o.parentType = N, o.lineMax = se, o.line = h + (k ? 1 : 0), !0;
255
- },
256
- {
257
- alt: ["paragraph", "reference", "blockquote", "list"]
258
- }
259
- ), e.renderer.rules.admonition_open = u, e.renderer.rules.admonition_title_open = u, e.renderer.rules.admonition_title_close = u, e.renderer.rules.admonition_close = u;
260
- }, Xe = Je, Qe = (e, a) => {
261
- e.renderer.rules.heading_open = (l, t) => {
262
- var c;
263
- const n = l[t], r = ((c = l[t + 1].children) == null ? void 0 : c.reduce((u, s) => u + (s.content || ""), "")) || "", i = n.markup.length;
264
- return a.headsRef.value.push({
265
- text: r,
266
- level: i
267
- }), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
268
- "id",
269
- a.mdHeadingId(r, i, a.headsRef.value.length)
270
- )), e.renderer.renderToken(l, t, a);
271
- }, e.renderer.rules.heading_close = (l, t, n, r, i) => i.renderToken(l, t, n);
272
- }, Ye = Qe, et = (e, a) => {
273
- const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
274
- function r(s) {
275
- return s.info ? t(s.info).trim() : "";
276
- }
277
- function i(s) {
278
- const o = r(s), [d = null, b = ""] = (n.exec(o) || []).slice(1);
279
- return [d, b];
1
+ var r = Object.defineProperty;
2
+ var p = (o, s, t) => s in o ? r(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
+ var i = (o, s, t) => (p(o, typeof s != "symbol" ? s + "" : s, t), t);
4
+ class h {
5
+ constructor() {
6
+ // 事件池
7
+ i(this, "pools", {});
280
8
  }
281
- function c(s) {
282
- const o = r(s);
283
- return o ? o.split(/(\s+)/g)[0] : "";
284
- }
285
- const u = (s, o, d, b, v) => {
286
- if (s[o].hidden)
287
- return "";
288
- const [m, h] = i(s[o]);
289
- if (m === null)
290
- return l(s, o, d, b, v);
291
- let f, k, y, w, I = "", E = "";
292
- for (let T = o; T < s.length && (f = s[T], [k, y] = i(f), k === m); T++)
293
- f.info = f.info.replace(n, ""), f.hidden = !0, w = T - o > 0 ? "" : " checked", I += `<li><input type="radio" name="label-group-${a.editorId}-${o}"${w}><label for="group-${a.editorId}-${o}-tab-${T - o}" onclick="this.previousElementSibling.click()">${y || c(f)}</label></li>
294
- `, E += `<input type="radio" id="group-${a.editorId}-${o}-tab-${T - o}" name="group-${a.editorId}-${o}"${w}>
295
- ` + l(s, T, d, b, v);
296
- return `<div class="code-tabs">
297
- <ul>
298
- ` + I + `</ul>
299
- ` + E + "</div>";
300
- };
301
- e.renderer.rules.fence = u;
302
- }, tt = et, nt = (e) => {
303
- [
304
- "paragraph_open",
305
- "table_open",
306
- "ordered_list_open",
307
- "bullet_list_open",
308
- "blockquote_open",
309
- "hr",
310
- "html_block",
311
- "fence"
312
- ].forEach((a) => {
313
- const l = e.renderer.rules[a];
314
- l ? e.renderer.rules[a] = (t, n, r, i, c) => {
315
- let u;
316
- const s = l(t, n, r, i, c);
317
- return t[n].map && t[n].level === 0 ? (u = t[n].map[0], s.replace(/^(<[^>]*)/, `$1 data-line="${u}"`)) : s;
318
- } : e.renderer.rules[a] = (t, n, r, i, c) => {
319
- let u;
320
- return t[n].map && t[n].level === 0 && (u = t[n].map[0], t[n].attrSet("data-line", String(u))), c.renderToken(t, n, r);
321
- };
322
- });
323
- }, ot = (e, a) => {
324
- const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = C, r = P("editorId"), i = P("showCodeRowNumber"), c = P("theme"), u = B([]), s = Oe(e), o = De(e), { reRenderRef: d, replaceMermaid: b } = je(e), v = _e({
325
- html: !0,
326
- breaks: !0
327
- });
328
- t(v);
329
- const m = [
330
- {
331
- type: "katex",
332
- plugin: We,
333
- options: { katexRef: o }
334
- },
335
- {
336
- type: "image",
337
- plugin: He,
338
- options: { figcaption: !0, classes: "md-zoom" }
339
- },
340
- {
341
- type: "admonition",
342
- plugin: Xe,
343
- options: {}
344
- },
345
- {
346
- type: "taskList",
347
- plugin: Fe,
348
- options: {}
349
- },
350
- {
351
- type: "heading",
352
- plugin: Ye,
353
- options: { mdHeadingId: e.mdHeadingId, headsRef: u }
354
- },
355
- {
356
- type: "codeTabs",
357
- plugin: tt,
358
- options: { editorId: r }
359
- }
360
- ];
361
- e.noMermaid || m.push({
362
- type: "mermaid",
363
- plugin: ze,
364
- options: { themeRef: c }
365
- }), n(m).forEach((w) => {
366
- v.use(w.plugin, w.options);
367
- }), v.set({
368
- highlight: (w, I) => {
369
- let E;
370
- !e.noHighlight && s.value ? s.value.getLanguage(I) ? E = s.value.highlight(w, {
371
- language: I,
372
- ignoreIllegals: !0
373
- }).value : E = s.value.highlightAuto(w).value : E = v.utils.escapeHtml(w);
374
- const T = i ? we(E.trim()) : `<span class="code-block">${E.trim()}</span>`;
375
- return `<pre><code class="language-${I}" language=${I}>${T}</code></pre>`;
376
- }
377
- }), nt(v);
378
- const h = B(e.sanitize(v.render(e.modelValue))), f = () => {
379
- g.emit(r, M, h.value), e.onHtmlChanged(h.value), e.onGetCatalog(u.value), g.emit(r, V, u.value), b();
380
- };
381
- S(f);
382
- const k = oe(
383
- async () => {
384
- u.value = [], h.value = e.sanitize(v.render(e.modelValue)), f();
385
- },
386
- (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : a ? 0 : 500
387
- ), y = F(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
388
- return $([X(e, "modelValue"), y, d], k), S(() => {
389
- g.on(r, {
390
- name: ke,
391
- callback() {
392
- g.emit(r, V, u.value);
393
- }
394
- });
395
- }), { html: h };
396
- }, rt = ot, re = {
397
- modelValue: {
398
- type: String,
399
- default: ""
400
- },
401
- setting: {
402
- type: Object,
403
- default: () => ({})
404
- },
405
- onHtmlChanged: {
406
- type: Function,
407
- default: () => {
408
- }
409
- },
410
- onGetCatalog: {
411
- type: Function,
412
- default: () => {
413
- }
414
- },
415
- mdHeadingId: {
416
- type: Function,
417
- default: () => ""
418
- },
419
- noMermaid: {
420
- type: Boolean,
421
- default: !1
422
- },
423
- sanitize: {
424
- type: Function,
425
- default: (e) => e
426
- },
427
- // 不使用该函数功能
428
- noKatex: {
429
- type: Boolean,
430
- default: !1
431
- },
432
- formatCopiedText: {
433
- type: Function,
434
- default: (e) => e
435
- },
436
- noHighlight: {
437
- type: Boolean,
438
- default: !1
439
- },
440
- previewOnly: {
441
- type: Boolean,
442
- default: !1
443
- },
444
- noImgZoomIn: {
445
- type: Boolean
9
+ // 移除事件监听
10
+ remove(s, t, n) {
11
+ const a = this.pools[s] && this.pools[s][t];
12
+ a && (this.pools[s][t] = a.filter((e) => e !== n));
446
13
  }
447
- }, bt = {
448
- ...re,
449
- onChange: {
450
- type: Function,
451
- default: () => {
452
- }
453
- },
454
- placeholder: {
455
- type: String,
456
- default: ""
457
- },
458
- scrollAuto: {
459
- type: Boolean
460
- },
461
- autofocus: {
462
- type: Boolean
463
- },
464
- disabled: {
465
- type: Boolean
466
- },
467
- readonly: {
468
- type: Boolean
469
- },
470
- maxlength: {
471
- type: Number
472
- },
473
- autoDetectCode: {
474
- type: Boolean
475
- },
476
- /**
477
- * 输入框失去焦点时触发事件
478
- */
479
- onBlur: {
480
- type: Function,
481
- default: () => {
482
- }
483
- },
484
- /**
485
- * 输入框获得焦点时触发事件
486
- */
487
- onFocus: {
488
- type: Function,
489
- default: () => {
490
- }
491
- },
492
- noPrettier: {
493
- type: Boolean
494
- },
495
- completions: {
496
- type: Array
497
- },
498
- catalogVisible: {
499
- type: Boolean
500
- },
501
- theme: {
502
- type: String,
503
- default: "light"
504
- },
505
- onInput: {
506
- type: Function
507
- },
508
- onDrop: {
509
- type: Function,
510
- default: () => {
511
- }
14
+ // 清空全部事件,由于单一实例,多次注册会被共享内容
15
+ clear(s) {
16
+ this.pools[s] = {};
512
17
  }
513
- }, at = /* @__PURE__ */ Q({
514
- name: "ContentPreview",
515
- props: re,
516
- setup(e) {
517
- const a = P("editorId"), l = P("previewTheme"), t = P("showCodeRowNumber"), {
518
- html: n
519
- } = rt(e, e.previewOnly);
520
- return Be(e, n), Re(e, n), () => A(ue, null, [A("div", {
521
- id: `${a}-preview-wrapper`,
522
- class: `${p}-preview-wrapper`,
523
- "data-show": e.setting.preview,
524
- key: "content-preview-wrapper"
525
- }, [A("article", {
526
- id: `${a}-preview`,
527
- class: [`${p}-preview`, `${l == null ? void 0 : l.value}-theme`, t && `${p}-scrn`],
528
- innerHTML: n.value
529
- }, null)]), !e.previewOnly && A("div", {
530
- id: `${a}-html-wrapper`,
531
- class: `${p}-preview-wrapper`,
532
- "data-show": e.setting.htmlPreview,
533
- key: "html-preview-wrapper"
534
- }, [A("div", {
535
- class: `${p}-html`
536
- }, [n.value])])]);
18
+ // 注册事件监听
19
+ on(s, t) {
20
+ return this.pools[s] || (this.pools[s] = {}), this.pools[s][t.name] || (this.pools[s][t.name] = []), this.pools[s][t.name].push(t.callback), this.pools[s][t.name].includes(t.callback);
537
21
  }
538
- }), wt = (e, a) => {
539
- const { editorId: l } = e, t = Y({
540
- // 是否已编译成html
541
- buildFinished: !1,
542
- // 存储当前最新的html
543
- html: ""
544
- });
545
- $(
546
- () => e.modelValue,
547
- () => {
548
- t.buildFinished = !1;
549
- }
550
- ), S(() => {
551
- g.on(l, {
552
- name: M,
553
- callback(n) {
554
- t.buildFinished = !0, t.html = n;
555
- }
556
- }), g.on(l, {
557
- name: ee,
558
- callback() {
559
- const n = new Promise((r) => {
560
- if (t.buildFinished)
561
- r(t.html);
562
- else {
563
- const i = (c) => {
564
- r(c), g.remove(l, M, i);
565
- };
566
- g.on(l, {
567
- name: M,
568
- callback: i
569
- });
570
- }
571
- });
572
- e.onSave ? e.onSave(e.modelValue, n) : a.emit("onSave", e.modelValue, n);
573
- }
574
- });
575
- });
576
- }, ae = (e) => {
577
- var n, r;
578
- const { editorId: a } = e, l = (r = (n = C) == null ? void 0 : n.editorExtensions) == null ? void 0 : r.highlight;
579
- H("editorId", a), H(
580
- "theme",
581
- F(() => e.theme)
582
- ), H(
583
- "language",
584
- F(() => e.language)
585
- ), H(
586
- "highlight",
587
- F(() => {
588
- const i = {
589
- ...U,
590
- ...l == null ? void 0 : l.css
591
- }, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
592
- return {
593
- js: (l == null ? void 0 : l.js) || fe,
594
- css: i[e.codeTheme] ? i[e.codeTheme][c] : U.atom[c]
595
- };
596
- })
597
- ), H("showCodeRowNumber", e.showCodeRowNumber);
598
- const t = F(() => {
599
- var c, u;
600
- const i = {
601
- ...j,
602
- ...(u = (c = C) == null ? void 0 : c.editorConfig) == null ? void 0 : u.languageUserDefined
603
- };
604
- return i[e.language] ? i[e.language] : j["zh-CN"];
605
- });
606
- H("usedLanguageText", t), H(
607
- "previewTheme",
608
- F(() => e.previewTheme)
609
- ), H(
610
- "customIcon",
611
- F(() => e.customIcon)
612
- );
613
- }, kt = (e) => {
614
- ae(e), H("tabWidth", e.tabWidth);
615
- }, le = (e) => {
616
- S(() => {
617
- var a, l;
618
- if (!e.noIconfont)
619
- if (C.iconfontType === "svg") {
620
- const t = document.createElement("script");
621
- t.src = ((a = C.editorExtensions) == null ? void 0 : a.iconfont) || pe, t.id = `${p}-icon`, _(t);
622
- } else {
623
- const t = document.createElement("link");
624
- t.rel = "stylesheet", t.href = ((l = C.editorExtensions) == null ? void 0 : l.iconfontClass) || he, t.id = `${p}-icon-class`, _(t);
625
- }
626
- });
627
- }, $t = (e) => {
628
- var c, u, s, o, d, b;
629
- const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = C, n = a || !!((u = (c = C.editorExtensions) == null ? void 0 : c.prettier) != null && u.prettierInstance), r = a || !!((o = (s = C.editorExtensions) == null ? void 0 : s.prettier) != null && o.parserMarkdownInstance), i = l || !!((b = (d = C.editorExtensions) == null ? void 0 : d.cropper) != null && b.instance);
630
- S(() => {
631
- var k, y, w, I;
632
- const v = document.createElement("script"), m = document.createElement("script");
633
- v.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || G.main, v.id = `${p}-prettier`, m.src = ((y = t == null ? void 0 : t.prettier) == null ? void 0 : y.parserMarkdownJs) || G.markdown, m.id = `${p}-prettierMD`;
634
- const h = document.createElement("link");
635
- h.rel = "stylesheet", h.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || D.css, h.id = `${p}-cropperCss`;
636
- const f = document.createElement("script");
637
- f.src = ((I = t == null ? void 0 : t.cropper) == null ? void 0 : I.js) || D.js, f.id = `${p}-cropper`, i || (_(h), _(f)), n || _(v), r || _(m);
638
- }), le(e);
639
- }, Ct = (e, a) => {
640
- const { editorId: l } = e;
641
- S(() => {
642
- g.on(l, {
643
- name: $e,
644
- callback: (t) => {
645
- e.onError instanceof Function ? e.onError(t) : a.emit("onError", t);
22
+ // 触发事件
23
+ emit(s, t, ...n) {
24
+ this.pools[s] || (this.pools[s] = {});
25
+ const a = this.pools[s][t];
26
+ a && a.forEach((e) => {
27
+ try {
28
+ e(...n);
29
+ } catch (c) {
30
+ console.error(`${t} monitor event exception!`, c);
646
31
  }
647
32
  });
648
- });
649
- }, It = (e, a) => {
650
- const { editorId: l } = e, t = Y({
651
- pageFullscreen: e.pageFullscreen,
652
- fullscreen: !1,
653
- preview: e.preview,
654
- htmlPreview: e.preview ? !1 : e.htmlPreview
655
- }), n = (c, u) => {
656
- t[c] = u === void 0 ? !t[c] : u, c === "preview" && t.preview ? t.htmlPreview = !1 : c === "htmlPreview" && t.htmlPreview && (t.preview = !1);
657
- };
658
- let r = "";
659
- const i = () => {
660
- t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = r;
661
- };
662
- return $(() => [t.pageFullscreen, t.fullscreen], i), S(() => {
663
- g.on(l, {
664
- name: Ce,
665
- callback(c, u) {
666
- const s = (o) => {
667
- g.emit(l, ne, "image", {
668
- desc: "",
669
- urls: o
670
- }), u && u();
671
- };
672
- e.onUploadImg ? e.onUploadImg(c, s) : a.emit("onUploadImg", c, s);
673
- }
674
- }), r = document.body.style.overflow, i();
675
- }), [t, n];
676
- }, St = (e) => {
677
- const { editorId: a } = e, l = B(!1);
678
- return S(() => {
679
- g.on(a, {
680
- name: te,
681
- callback: (n) => {
682
- n === void 0 ? l.value = !l.value : l.value = n;
683
- }
684
- });
685
- }), F(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
686
- }, Et = (e, a, l, t, n) => {
687
- const { editorId: r } = e;
688
- $(
689
- () => t.pageFullscreen,
690
- (c) => {
691
- g.emit(r, z, c);
692
- }
693
- ), $(
694
- () => t.fullscreen,
695
- (c) => {
696
- g.emit(r, K, c);
697
- }
698
- ), $(
699
- () => t.preview,
700
- (c) => {
701
- g.emit(r, q, c);
702
- }
703
- ), $(
704
- () => t.htmlPreview,
705
- (c) => {
706
- g.emit(r, Z, c);
707
- }
708
- ), $(l, (c) => {
709
- g.emit(r, W, c);
710
- });
711
- const i = {
712
- on(c, u) {
713
- switch (c) {
714
- case "pageFullscreen": {
715
- g.on(r, {
716
- name: z,
717
- callback(s) {
718
- u(s);
719
- }
720
- });
721
- break;
722
- }
723
- case "fullscreen": {
724
- g.on(r, {
725
- name: K,
726
- callback(s) {
727
- u(s);
728
- }
729
- });
730
- break;
731
- }
732
- case "preview": {
733
- g.on(r, {
734
- name: q,
735
- callback(s) {
736
- u(s);
737
- }
738
- });
739
- break;
740
- }
741
- case "htmlPreview": {
742
- g.on(r, {
743
- name: Z,
744
- callback(s) {
745
- u(s);
746
- }
747
- });
748
- break;
749
- }
750
- case "catalog": {
751
- g.on(r, {
752
- name: W,
753
- callback(s) {
754
- u(s);
755
- }
756
- });
757
- break;
758
- }
759
- }
760
- },
761
- togglePageFullscreen(c) {
762
- n("pageFullscreen", c);
763
- },
764
- toggleFullscreen(c) {
765
- g.emit(r, Ie, c);
766
- },
767
- togglePreview(c) {
768
- n("preview", c);
769
- },
770
- toggleHtmlPreview(c) {
771
- n("htmlPreview", c);
772
- },
773
- toggleCatalog(c) {
774
- g.emit(r, te, c);
775
- },
776
- triggerSave() {
777
- g.emit(r, ee);
778
- },
779
- insert(c) {
780
- g.emit(r, ne, "universal", { generate: c });
781
- },
782
- focus(c) {
783
- g.emit(r, Se, c);
784
- }
785
- };
786
- a.expose(i);
787
- }, lt = (e) => e, ie = {
788
- /**
789
- * markdown content.
790
- *
791
- * @default ''
792
- */
793
- modelValue: {
794
- type: String,
795
- default: ""
796
- },
797
- /**
798
- * 主题,支持light和dark
799
- *
800
- * @default 'light'
801
- */
802
- theme: {
803
- type: String,
804
- default: "light"
805
- },
806
- /**
807
- * 外层类名
808
- *
809
- * @default ''
810
- */
811
- class: {
812
- type: String,
813
- default: ""
814
- },
815
- /**
816
- * 预设语言名称
817
- *
818
- * @default 'zh-CN'
819
- */
820
- language: {
821
- type: String,
822
- default: "zh-CN"
823
- },
824
- /**
825
- * html变化事件
826
- */
827
- onHtmlChanged: {
828
- type: Function
829
- },
830
- /**
831
- * 获取目录结构
832
- */
833
- onGetCatalog: {
834
- type: Function
835
- },
836
- /**
837
- * 编辑器唯一标识
838
- *
839
- * @default 'md-editor-v3'
840
- */
841
- editorId: {
842
- type: String,
843
- default: ge
844
- },
845
- /**
846
- * 预览中代码是否显示行号
847
- *
848
- * @default false
849
- */
850
- showCodeRowNumber: {
851
- type: Boolean,
852
- default: !1
853
- },
854
- /**
855
- * 预览内容样式
856
- *
857
- * @default 'default'
858
- */
859
- previewTheme: {
860
- type: String,
861
- default: "default"
862
- },
863
- /**
864
- * 编辑器样式
865
- */
866
- style: {
867
- type: Object,
868
- default: () => ({})
869
- },
870
- /**
871
- * 标题的id生成方式
872
- *
873
- * @default (text: string) => text
874
- */
875
- mdHeadingId: {
876
- type: Function,
877
- default: lt
878
- },
879
- /**
880
- *
881
- * 不能保证文本正确的情况,在marked编译md文本后通过该方法处理
882
- * 推荐DOMPurify、sanitize-html
883
- *
884
- * @default (text: string) => text
885
- */
886
- sanitize: {
887
- type: Function,
888
- default: (e) => e
889
- },
890
- /**
891
- * 不使用该mermaid
892
- *
893
- * @default false
894
- */
895
- noMermaid: {
896
- type: Boolean,
897
- default: !1
898
- },
899
- /**
900
- * 不使用katex
901
- *
902
- * @default false
903
- */
904
- noKatex: {
905
- type: Boolean,
906
- default: !1
907
- },
908
- /**
909
- * 代码主题
910
- *
911
- * @default 'atom'
912
- */
913
- codeTheme: {
914
- type: String,
915
- default: "atom"
916
- },
917
- /**
918
- * 不插入iconfont链接
919
- *
920
- * @default false
921
- */
922
- noIconfont: {
923
- type: Boolean
924
- },
925
- /**
926
- * 复制代码格式化方法
927
- *
928
- * @default (text) => text
929
- */
930
- formatCopiedText: {
931
- type: Function,
932
- default: (e) => e
933
- },
934
- /**
935
- * 某些预览主题的代码模块背景是暗色系
936
- * 将这个属性设置为true,会自动在该主题下的light模式下使用暗色系的代码风格
937
- *
938
- * @default true
939
- */
940
- codeStyleReverse: {
941
- type: Boolean,
942
- default: !0
943
- },
944
- /**
945
- * 需要自动调整的预览主题
946
- *
947
- * @default ['default', 'mk-cute']
948
- */
949
- codeStyleReverseList: {
950
- type: Array,
951
- default: ["default", "mk-cute"]
952
- },
953
- noHighlight: {
954
- type: Boolean,
955
- default: !1
956
- },
957
- /**
958
- * 是否关闭编辑器默认的放大缩小功能
959
- */
960
- noImgZoomIn: {
961
- type: Boolean,
962
- default: !1
963
- },
964
- /**
965
- * 自定义的图标
966
- */
967
- customIcon: {
968
- type: Object,
969
- default: {}
970
- }
971
- }, Pt = {
972
- ...ie,
973
- /**
974
- * input回调事件
975
- */
976
- onChange: {
977
- type: Function
978
- },
979
- /**
980
- * input回调事件
981
- */
982
- onSave: {
983
- type: Function
984
- },
985
- /**
986
- * 上传图片事件
987
- */
988
- onUploadImg: {
989
- type: Function
990
- },
991
- /**
992
- * 是否页面内全屏
993
- *
994
- * @default false
995
- */
996
- pageFullscreen: {
997
- type: Boolean,
998
- default: !1
999
- },
1000
- /**
1001
- * 是否展开预览
1002
- *
1003
- * @default true
1004
- */
1005
- preview: {
1006
- type: Boolean,
1007
- default: !0
1008
- },
1009
- /**
1010
- * 是否展开html预览
1011
- *
1012
- * @default false
1013
- */
1014
- htmlPreview: {
1015
- type: Boolean,
1016
- default: !1
1017
- },
1018
- /**
1019
- * 仅预览模式,不显示toolbar和编辑框
1020
- *
1021
- * @4.0.0开始移除该设置,使用组件MdPreview替换
1022
- *
1023
- * @default false
1024
- */
1025
- // previewOnly: {
1026
- // type: Boolean as PropType<boolean>,
1027
- // default: false
1028
- // },
1029
- /**
1030
- * 工具栏选择显示
1031
- *
1032
- * @default allToolbar
1033
- */
1034
- toolbars: {
1035
- type: Array,
1036
- default: ye
1037
- },
1038
- /**
1039
- * 工具栏选择不显示
1040
- *
1041
- * @default []
1042
- */
1043
- toolbarsExclude: {
1044
- type: Array,
1045
- default: []
1046
- },
1047
- /**
1048
- * 格式化md
1049
- *
1050
- * @default true
1051
- */
1052
- noPrettier: {
1053
- type: Boolean,
1054
- default: !1
1055
- },
1056
- /**
1057
- * 一个tab等于空格数
1058
- *
1059
- * @default 2
1060
- */
1061
- tabWidth: {
1062
- type: Number,
1063
- default: 2
1064
- },
1065
- /**
1066
- * 表格预设格子数
1067
- *
1068
- * @default [6, 4]
1069
- */
1070
- tableShape: {
1071
- type: Array,
1072
- default: () => [6, 4]
1073
- },
1074
- /**
1075
- * 空提示
1076
- *
1077
- * @default ''
1078
- */
1079
- placeholder: {
1080
- type: String,
1081
- default: ""
1082
- },
1083
- /**
1084
- * 自定义的工具栏列表
1085
- */
1086
- defToolbars: {
1087
- type: [String, Object]
1088
- },
1089
- /**
1090
- * 内部错误捕获
1091
- */
1092
- onError: {
1093
- type: Function
1094
- },
1095
- /**
1096
- * 页脚列表显示顺序
1097
- */
1098
- footers: {
1099
- type: Array,
1100
- default: ve
1101
- },
1102
- /**
1103
- * 是否默认激活输入框和预览框同步滚动
1104
- *
1105
- * @default true
1106
- */
1107
- scrollAuto: {
1108
- type: Boolean,
1109
- default: !0
1110
- },
1111
- /**
1112
- * 自定义的也叫工具组件列表
1113
- */
1114
- defFooters: {
1115
- type: [String, Object]
1116
- },
1117
- /**
1118
- * 是否禁用上传图片
1119
- *
1120
- * @default false
1121
- */
1122
- noUploadImg: {
1123
- type: Boolean
1124
- },
1125
- /**
1126
- * 文本区域自动获得焦点
1127
- *
1128
- * @default false
1129
- */
1130
- autoFocus: {
1131
- type: Boolean
1132
- },
1133
- /**
1134
- * 禁用文本区域
1135
- *
1136
- * @default false
1137
- */
1138
- disabled: {
1139
- type: Boolean
1140
- },
1141
- /**
1142
- * 文本区域为只读
1143
- *
1144
- * @default false
1145
- */
1146
- readOnly: {
1147
- type: Boolean
1148
- },
1149
- /**
1150
- * 文本区域允许的最大字符数
1151
- */
1152
- maxLength: {
1153
- type: Number
1154
- },
1155
- /**
1156
- * 是否启用自动识别粘贴代码类别
1157
- * 目前支持 vscode 复制的代码识别
1158
- *
1159
- * @default false
1160
- */
1161
- autoDetectCode: {
1162
- type: Boolean
1163
- },
1164
- /**
1165
- * 输入框失去焦点时触发事件
1166
- */
1167
- onBlur: {
1168
- type: Function
1169
- },
1170
- /**
1171
- * 输入框获得焦点时触发事件
1172
- */
1173
- onFocus: {
1174
- type: Function
1175
- },
1176
- /**
1177
- * @codemirror/autocomplete匹配关键词的方法列表
1178
- *
1179
- * 它会被像下面这样嵌入编辑器
1180
- *
1181
- * import { autocompletion } from '@codemirror/autocomplete';
1182
- * autocompletion({
1183
- * override: [...completions]
1184
- * })
1185
- */
1186
- completions: {
1187
- type: Array
1188
- },
1189
- /**
1190
- * 是否在工具栏下面显示对应的文字名称
1191
- *
1192
- * @default false
1193
- */
1194
- showToolbarName: {
1195
- type: Boolean,
1196
- default: !1
1197
- },
1198
- /**
1199
- * 字符输入事件
1200
- */
1201
- onInput: {
1202
- type: Function
1203
- },
1204
- onDrop: {
1205
- type: Function
1206
33
  }
1207
- }, ce = ["onHtmlChanged", "onGetCatalog"], Tt = [
1208
- ...ce,
1209
- "onChange",
1210
- "onSave",
1211
- "onUploadImg",
1212
- "onError",
1213
- "update:modelValue",
1214
- "onBlur",
1215
- "onFocus",
1216
- "onInput",
1217
- "onDrop"
1218
- ], it = /* @__PURE__ */ Q({
1219
- name: "MdPreview",
1220
- props: ie,
1221
- emits: ce,
1222
- setup(e, a) {
1223
- const {
1224
- editorId: l,
1225
- noKatex: t,
1226
- noMermaid: n,
1227
- noHighlight: r
1228
- } = e;
1229
- return ae(e), le(e), de(() => {
1230
- g.clear(l);
1231
- }), () => A("div", {
1232
- id: l,
1233
- class: [p, e.class, e.theme === "dark" && `${p}-dark`, `${p}-previewOnly`],
1234
- style: e.style
1235
- }, [A(at, {
1236
- modelValue: e.modelValue,
1237
- onHtmlChanged: (i) => {
1238
- e.onHtmlChanged ? e.onHtmlChanged(i) : a.emit("onHtmlChanged", i);
1239
- },
1240
- onGetCatalog: (i) => {
1241
- e.onGetCatalog ? e.onGetCatalog(i) : a.emit("onGetCatalog", i);
1242
- },
1243
- mdHeadingId: e.mdHeadingId,
1244
- noMermaid: n,
1245
- sanitize: e.sanitize,
1246
- noKatex: t,
1247
- formatCopiedText: e.formatCopiedText,
1248
- noHighlight: r,
1249
- noImgZoomIn: e.noImgZoomIn,
1250
- previewOnly: !0
1251
- }, null)]);
34
+ }
35
+ const C = new h(), E = "onSave", g = "changeCatalogVisible", A = "changeFullscreen", R = "pageFullscreenChanged", _ = "fullscreenChanged", d = "previewChanged", L = "htmlPreviewChanged", N = "catalogVisibleChanged", f = "textareaFocus", S = "buildFinished", b = "errorCatcher", G = "replace", H = "uploadImage", T = "openModals", F = "ctrlZ", m = "ctrlShiftZ", I = "catalogChanged", D = "pushCatalog", O = (o, s = "image.png") => {
36
+ const t = o.split(","), n = t[0].match(/:(.*?);/);
37
+ if (n) {
38
+ const l = n[1], a = atob(t[1]);
39
+ let e = a.length;
40
+ const c = new Uint8Array(e);
41
+ for (; e--; )
42
+ c[e] = a.charCodeAt(e);
43
+ return new File([c], s, { type: l });
1252
44
  }
1253
- }), x = it;
1254
- x.install = (e) => (e.component(x.name, x), e);
45
+ return null;
46
+ }, w = (o) => {
47
+ if (!o)
48
+ return o;
49
+ const s = o.split(`
50
+ `), t = ['<span rn-wrapper aria-hidden="true">'];
51
+ return s.forEach(() => {
52
+ t.push("<span></span>");
53
+ }), t.push("</span>"), `<span class="code-block">${o}</span>${t.join("")}`;
54
+ }, P = (o, s) => {
55
+ if (!o || !s)
56
+ return 0;
57
+ const t = o == null ? void 0 : o.getBoundingClientRect();
58
+ if (s === document.documentElement)
59
+ return t.top - s.clientTop;
60
+ const n = s == null ? void 0 : s.getBoundingClientRect();
61
+ return t.top - n.top;
62
+ }, U = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`;
1255
63
  export {
1256
- at as C,
1257
- x as M,
1258
- Tt as a,
1259
- kt as b,
1260
- bt as c,
1261
- $t as d,
1262
- Pt as e,
1263
- Ct as f,
1264
- It as g,
1265
- St as h,
1266
- Et as i,
1267
- wt as u
64
+ S as B,
65
+ I as C,
66
+ b as E,
67
+ _ as F,
68
+ L as H,
69
+ E as O,
70
+ D as P,
71
+ G as R,
72
+ f as T,
73
+ H as U,
74
+ w as a,
75
+ C as b,
76
+ g as c,
77
+ R as d,
78
+ d as e,
79
+ N as f,
80
+ P as g,
81
+ A as h,
82
+ O as i,
83
+ T as j,
84
+ m as k,
85
+ F as l,
86
+ U as u
1268
87
  };