md-editor-v3 6.4.1 → 6.5.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.
@@ -1,7 +1,7 @@
1
- import { useId as Fe, provide as T, computed as R, reactive as re, watch as k, onMounted as H, ref as G, inject as w, nextTick as U, shallowRef as ee, onBeforeUnmount as te, toRef as Re, defineComponent as ce, createVNode as j, Fragment as Ae, h as He } from "vue";
1
+ import { useId as Fe, provide as I, computed as A, reactive as re, watch as E, onMounted as H, ref as G, inject as C, nextTick as U, shallowRef as ee, onBeforeUnmount as te, toRef as Ae, defineComponent as ce, createVNode as j, Fragment as Re, h as He } from "vue";
2
2
  import { deepMerge as Me, deepClone as Pe, randomId as le, debounce as Le } from "@vavt/util";
3
3
  import { p as f, g as P, f as ue, s as me, b as Oe, a as _e } from "./config.mjs";
4
- import { b as y, U as Be, C as ke, B as X, O as Ee, E as Q, P as fe, F as he, f as pe, g as ge, H as ve, h as ye, R as ie, e as je, i as de, d as Ne, j as oe, k as De, T as Ve } from "./event-bus.mjs";
4
+ import { b as v, U as Be, C as Ee, B as X, O as ke, E as Q, P as fe, F as he, f as pe, g as ge, H as ve, h as ye, R as ie, e as je, i as de, d as Ne, j as oe, k as De, T as Ve } from "./event-bus.mjs";
5
5
  import { a as O, u as Ge, S as Ue, c as ze, z as We } from "./dom.mjs";
6
6
  import qe from "@vavt/copy2clipboard";
7
7
  import Ke from "markdown-it";
@@ -9,8 +9,7 @@ import Ze from "markdown-it-image-figures";
9
9
  import Je from "markdown-it-sub";
10
10
  import Xe from "markdown-it-sup";
11
11
  import { g as Ye } from "./index5.mjs";
12
- import { LRUCache as Qe } from "lru-cache";
13
- import et from "medium-zoom";
12
+ import Qe from "medium-zoom";
14
13
  const M = {
15
14
  hljs: `${f}-hljs`,
16
15
  hlcss: `${f}-hlCss`,
@@ -24,41 +23,41 @@ const M = {
24
23
  katexjs: `${f}-katex`,
25
24
  katexcss: `${f}-katexCss`,
26
25
  echarts: `${f}-echarts`
27
- }, Jt = (e, t, r) => {
26
+ }, Zt = (e, t, r) => {
28
27
  const { editorId: n } = r, o = re({
29
28
  // 是否已编译成html
30
29
  buildFinished: !1,
31
30
  // 存储当前最新的html
32
31
  html: ""
33
32
  });
34
- k(
33
+ E(
35
34
  () => e.modelValue,
36
35
  () => {
37
36
  o.buildFinished = !1;
38
37
  }
39
38
  ), H(() => {
40
- y.on(n, {
39
+ v.on(n, {
41
40
  name: X,
42
- callback(u) {
43
- o.buildFinished = !0, o.html = u;
41
+ callback(m) {
42
+ o.buildFinished = !0, o.html = m;
44
43
  }
45
- }), y.on(n, {
46
- name: Ee,
44
+ }), v.on(n, {
45
+ name: ke,
47
46
  callback() {
48
- const u = new Promise((c) => {
47
+ const m = new Promise((d) => {
49
48
  if (o.buildFinished)
50
- c(o.html);
49
+ d(o.html);
51
50
  else {
52
- const m = (s) => {
53
- c(s), y.remove(n, X, m);
51
+ const u = (s) => {
52
+ d(s), v.remove(n, X, u);
54
53
  };
55
- y.on(n, {
54
+ v.on(n, {
56
55
  name: X,
57
- callback: m
56
+ callback: u
58
57
  });
59
58
  }
60
59
  });
61
- e.onSave ? e.onSave(e.modelValue, u) : t.emit("onSave", e.modelValue, u);
60
+ e.onSave ? e.onSave(e.modelValue, m) : t.emit("onSave", e.modelValue, m);
62
61
  }
63
62
  });
64
63
  });
@@ -67,51 +66,51 @@ const M = {
67
66
  rootRef: r,
68
67
  setting: n
69
68
  }) => {
70
- const o = P.editorExtensions.highlight, u = P.editorExtensionsAttrs.highlight;
71
- T("editorId", t), T("rootRef", r), T(
69
+ const o = P.editorExtensions.highlight, m = P.editorExtensionsAttrs.highlight;
70
+ I("editorId", t), I("rootRef", r), I(
72
71
  "theme",
73
- R(() => e.theme)
74
- ), T(
72
+ A(() => e.theme)
73
+ ), I(
75
74
  "language",
76
- R(() => e.language)
77
- ), T(
75
+ A(() => e.language)
76
+ ), I(
78
77
  "highlight",
79
- R(() => {
80
- const { js: m } = o, s = {
78
+ A(() => {
79
+ const { js: u } = o, s = {
81
80
  ...ue,
82
81
  ...o.css
83
- }, { js: l, css: i = {} } = u || {}, a = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, d = s[e.codeTheme] ? s[e.codeTheme][a] : ue.atom[a], $ = s[e.codeTheme] && i[e.codeTheme] ? i[e.codeTheme][a] : i.atom ? i.atom[a] : {};
82
+ }, { js: l, css: i = {} } = m || {}, a = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, c = s[e.codeTheme] ? s[e.codeTheme][a] : ue.atom[a], $ = s[e.codeTheme] && i[e.codeTheme] ? i[e.codeTheme][a] : i.atom ? i.atom[a] : {};
84
83
  return {
85
84
  js: {
86
- src: m,
85
+ src: u,
87
86
  ...l
88
87
  },
89
88
  css: {
90
- href: d,
89
+ href: c,
91
90
  ...$
92
91
  }
93
92
  };
94
93
  })
95
- ), T("showCodeRowNumber", e.showCodeRowNumber);
96
- const c = R(() => {
97
- const m = {
94
+ ), I("showCodeRowNumber", e.showCodeRowNumber);
95
+ const d = A(() => {
96
+ const u = {
98
97
  ...me,
99
98
  ...P.editorConfig.languageUserDefined
100
99
  };
101
100
  return Me(
102
101
  Pe(me["en-US"]),
103
- m[e.language] || {}
102
+ u[e.language] || {}
104
103
  );
105
104
  });
106
- return T("usedLanguageText", c), T(
105
+ return I("usedLanguageText", d), I(
107
106
  "previewTheme",
108
- R(() => e.previewTheme)
109
- ), T(
107
+ A(() => e.previewTheme)
108
+ ), I(
110
109
  "customIcon",
111
- R(() => e.customIcon)
112
- ), T(
110
+ A(() => e.customIcon)
111
+ ), I(
113
112
  "setting",
114
- R(() => n ? {
113
+ A(() => n ? {
115
114
  // setting是reactive,不转化是可以直接赋值的
116
115
  ...n
117
116
  } : {
@@ -122,28 +121,28 @@ const M = {
122
121
  fullscreen: !1
123
122
  })
124
123
  ), { editorId: t };
125
- }, Xt = (e, t) => (T("tabWidth", e.tabWidth), T(
124
+ }, Jt = (e, t) => (I("tabWidth", e.tabWidth), I(
126
125
  "disabled",
127
- R(() => e.disabled)
128
- ), T(
126
+ A(() => e.disabled)
127
+ ), I(
129
128
  "showToolbarName",
130
- R(() => e.showToolbarName)
131
- ), T("noUploadImg", e.noUploadImg), T(
129
+ A(() => e.showToolbarName)
130
+ ), I("noUploadImg", e.noUploadImg), I(
132
131
  "tableShape",
133
- R(() => e.tableShape)
134
- ), T("noPrettier", e.noPrettier), T(
132
+ A(() => e.tableShape)
133
+ ), I("noPrettier", e.noPrettier), I(
135
134
  "codeTheme",
136
- R(() => e.codeTheme)
137
- ), T("updateSetting", t.updateSetting), T(
135
+ A(() => e.codeTheme)
136
+ ), I("updateSetting", t.updateSetting), I(
138
137
  "catalogVisible",
139
- R(() => t.catalogVisible.value)
140
- ), T("defToolbars", t.defToolbars), T(
138
+ A(() => t.catalogVisible.value)
139
+ ), I("defToolbars", t.defToolbars), I(
141
140
  "floatingToolbars",
142
- R(() => e.floatingToolbars)
143
- ), Te(e, t)), Yt = (e) => {
144
- const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: n, editorExtensionsAttrs: o } = P, u = t || n.prettier.prettierInstance, c = t || n.prettier.parserMarkdownInstance, m = r || n.cropper.instance;
141
+ A(() => e.floatingToolbars)
142
+ ), Te(e, t)), Xt = (e) => {
143
+ const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: n, editorExtensionsAttrs: o } = P, m = t || n.prettier.prettierInstance, d = t || n.prettier.parserMarkdownInstance, u = r || n.cropper.instance;
145
144
  H(() => {
146
- if (!m) {
145
+ if (!u) {
147
146
  const { js: s = {}, css: l = {} } = o.cropper || {};
148
147
  O("link", {
149
148
  ...l,
@@ -156,7 +155,7 @@ const M = {
156
155
  id: M.cropperjs
157
156
  });
158
157
  }
159
- if (!u) {
158
+ if (!m) {
160
159
  const { standaloneJs: s = {} } = o.prettier || {};
161
160
  O("script", {
162
161
  ...s,
@@ -164,7 +163,7 @@ const M = {
164
163
  id: M.prettier
165
164
  });
166
165
  }
167
- if (!c) {
166
+ if (!d) {
168
167
  const { parserMarkdownJs: s = {} } = o.prettier || {};
169
168
  O("script", {
170
169
  ...s,
@@ -173,24 +172,24 @@ const M = {
173
172
  });
174
173
  }
175
174
  });
176
- }, Qt = (e, t, r) => {
175
+ }, Yt = (e, t, r) => {
177
176
  const { editorId: n } = r;
178
177
  H(() => {
179
- y.on(n, {
178
+ v.on(n, {
180
179
  name: Q,
181
180
  callback: (o) => {
182
181
  e.onError?.(o), t.emit("onError", o);
183
182
  }
184
183
  });
185
184
  });
186
- }, en = (e, t, r) => {
185
+ }, Qt = (e, t, r) => {
187
186
  const { editorId: n } = r, o = re({
188
187
  pageFullscreen: e.pageFullscreen,
189
188
  fullscreen: !1,
190
189
  preview: e.preview,
191
190
  htmlPreview: e.preview ? !1 : e.htmlPreview,
192
191
  previewOnly: !1
193
- }), u = re({ ...o }), c = (l, i) => {
192
+ }), m = re({ ...o }), d = (l, i) => {
194
193
  const a = i === void 0 ? !o[l] : i;
195
194
  switch (l) {
196
195
  case "preview": {
@@ -202,75 +201,75 @@ const M = {
202
201
  break;
203
202
  }
204
203
  case "previewOnly": {
205
- a ? !o.preview && !o.htmlPreview && (o.preview = !0) : (u.preview || (o.preview = !1), u.htmlPreview || (o.htmlPreview = !1));
204
+ a ? !o.preview && !o.htmlPreview && (o.preview = !0) : (m.preview || (o.preview = !1), m.htmlPreview || (o.htmlPreview = !1));
206
205
  break;
207
206
  }
208
207
  }
209
- u[l] = a, o[l] = a;
208
+ m[l] = a, o[l] = a;
210
209
  };
211
- let m = "";
210
+ let u = "";
212
211
  const s = () => {
213
- o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = m;
212
+ o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = u;
214
213
  };
215
- return k(() => [o.pageFullscreen, o.fullscreen], s), H(() => {
216
- y.on(n, {
214
+ return E(() => [o.pageFullscreen, o.fullscreen], s), H(() => {
215
+ v.on(n, {
217
216
  name: Be,
218
217
  callback(l, i) {
219
- const a = (d) => {
220
- y.emit(n, ie, "image", {
218
+ const a = (c) => {
219
+ v.emit(n, ie, "image", {
221
220
  desc: "",
222
- urls: d
221
+ urls: c
223
222
  }), i?.();
224
223
  };
225
224
  e.onUploadImg ? e.onUploadImg(l, a) : t.emit("onUploadImg", l, a);
226
225
  }
227
- }), m = document.body.style.overflow, s();
228
- }), [o, c];
229
- }, tn = (e, t) => {
226
+ }), u = document.body.style.overflow, s();
227
+ }), [o, d];
228
+ }, en = (e, t) => {
230
229
  const { editorId: r } = t, n = G(!1);
231
230
  return H(() => {
232
- y.on(r, {
233
- name: ke,
231
+ v.on(r, {
232
+ name: Ee,
234
233
  callback: (o) => {
235
234
  o === void 0 ? n.value = !n.value : n.value = o;
236
235
  }
237
236
  });
238
237
  }), n;
239
- }, nn = (e, t, r) => {
240
- const { editorId: n, catalogVisible: o, setting: u, updateSetting: c, codeRef: m } = r;
241
- k(
242
- () => u.pageFullscreen,
238
+ }, tn = (e, t, r) => {
239
+ const { editorId: n, catalogVisible: o, setting: m, updateSetting: d, codeRef: u } = r;
240
+ E(
241
+ () => m.pageFullscreen,
243
242
  (l) => {
244
- y.emit(n, fe, l);
243
+ v.emit(n, fe, l);
245
244
  }
246
- ), k(
247
- () => u.fullscreen,
245
+ ), E(
246
+ () => m.fullscreen,
248
247
  (l) => {
249
- y.emit(n, he, l);
248
+ v.emit(n, he, l);
250
249
  }
251
- ), k(
252
- () => u.preview,
250
+ ), E(
251
+ () => m.preview,
253
252
  (l) => {
254
- y.emit(n, pe, l);
253
+ v.emit(n, pe, l);
255
254
  }
256
- ), k(
257
- () => u.previewOnly,
255
+ ), E(
256
+ () => m.previewOnly,
258
257
  (l) => {
259
- y.emit(n, ge, l);
258
+ v.emit(n, ge, l);
260
259
  }
261
- ), k(
262
- () => u.htmlPreview,
260
+ ), E(
261
+ () => m.htmlPreview,
263
262
  (l) => {
264
- y.emit(n, ve, l);
263
+ v.emit(n, ve, l);
265
264
  }
266
- ), k(o, (l) => {
267
- y.emit(n, ye, l);
265
+ ), E(o, (l) => {
266
+ v.emit(n, ye, l);
268
267
  });
269
268
  const s = {
270
269
  on(l, i) {
271
270
  switch (l) {
272
271
  case "pageFullscreen": {
273
- y.on(n, {
272
+ v.on(n, {
274
273
  name: fe,
275
274
  callback(a) {
276
275
  i(a);
@@ -279,7 +278,7 @@ const M = {
279
278
  break;
280
279
  }
281
280
  case "fullscreen": {
282
- y.on(n, {
281
+ v.on(n, {
283
282
  name: he,
284
283
  callback(a) {
285
284
  i(a);
@@ -288,7 +287,7 @@ const M = {
288
287
  break;
289
288
  }
290
289
  case "preview": {
291
- y.on(n, {
290
+ v.on(n, {
292
291
  name: pe,
293
292
  callback(a) {
294
293
  i(a);
@@ -297,7 +296,7 @@ const M = {
297
296
  break;
298
297
  }
299
298
  case "previewOnly": {
300
- y.on(n, {
299
+ v.on(n, {
301
300
  name: ge,
302
301
  callback(a) {
303
302
  i(a);
@@ -306,7 +305,7 @@ const M = {
306
305
  break;
307
306
  }
308
307
  case "htmlPreview": {
309
- y.on(n, {
308
+ v.on(n, {
310
309
  name: ve,
311
310
  callback(a) {
312
311
  i(a);
@@ -315,7 +314,7 @@ const M = {
315
314
  break;
316
315
  }
317
316
  case "catalog": {
318
- y.on(n, {
317
+ v.on(n, {
319
318
  name: ye,
320
319
  callback(a) {
321
320
  i(a);
@@ -326,157 +325,160 @@ const M = {
326
325
  }
327
326
  },
328
327
  togglePageFullscreen(l) {
329
- c("pageFullscreen", l);
328
+ d("pageFullscreen", l);
330
329
  },
331
330
  toggleFullscreen(l) {
332
- y.emit(n, Ne, l);
331
+ v.emit(n, Ne, l);
333
332
  },
334
333
  togglePreview(l) {
335
- c("preview", l);
334
+ d("preview", l);
336
335
  },
337
336
  togglePreviewOnly(l) {
338
- c("previewOnly", l);
337
+ d("previewOnly", l);
339
338
  },
340
339
  toggleHtmlPreview(l) {
341
- c("htmlPreview", l);
340
+ d("htmlPreview", l);
342
341
  },
343
342
  toggleCatalog(l) {
344
- y.emit(n, ke, l);
343
+ v.emit(n, Ee, l);
345
344
  },
346
345
  triggerSave() {
347
- y.emit(n, Ee);
346
+ v.emit(n, ke);
348
347
  },
349
348
  insert(l) {
350
- y.emit(n, ie, "universal", { generate: l });
349
+ v.emit(n, ie, "universal", { generate: l });
351
350
  },
352
351
  focus(l) {
353
- m.value?.focus(l);
352
+ u.value?.focus(l);
354
353
  },
355
354
  rerender() {
356
- y.emit(n, de);
355
+ v.emit(n, de);
357
356
  },
358
357
  getSelectedText() {
359
- return m.value?.getSelectedText();
358
+ return u.value?.getSelectedText();
360
359
  },
361
360
  resetHistory() {
362
- m.value?.resetHistory();
361
+ u.value?.resetHistory();
363
362
  },
364
363
  domEventHandlers(l) {
365
- y.emit(n, je, l);
364
+ v.emit(n, je, l);
366
365
  },
367
366
  execCommand(l) {
368
- y.emit(n, ie, l);
367
+ v.emit(n, ie, l);
369
368
  },
370
369
  getEditorView() {
371
- return m.value?.getEditorView();
370
+ return u.value?.getEditorView();
372
371
  }
373
372
  };
374
373
  t.expose(s);
375
- }, tt = (e) => {
374
+ }, et = (e) => {
376
375
  const t = Fe();
377
376
  return e.id || e.editorId || `${f}-${t}`;
378
- }, nt = (e, t, r) => {
379
- const n = w("editorId"), o = w("rootRef"), u = w("usedLanguageText"), c = w("setting"), m = () => {
377
+ }, tt = (e, t, r) => {
378
+ const n = C("editorId"), o = C("rootRef"), m = C("usedLanguageText"), d = C("setting"), u = () => {
380
379
  o.value.querySelectorAll(`#${n} .${f}-preview .${f}-code`).forEach((i) => {
381
380
  let a = -1;
382
- const d = i.querySelector(
381
+ const c = i.querySelector(
383
382
  `.${f}-copy-button:not([data-processed])`
384
383
  );
385
- d && (d.onclick = ($) => {
384
+ c && (c.onclick = ($) => {
386
385
  $.preventDefault(), clearTimeout(a);
387
- const p = (i.querySelector("input:checked + pre code") || i.querySelector("pre code")).textContent, { text: g, successTips: I, failTips: v } = u.value.copyCode;
388
- let C = I;
389
- qe(e.formatCopiedText(p || "")).catch(() => {
390
- C = v;
386
+ const g = (i.querySelector("input:checked + pre code") || i.querySelector("pre code")).textContent, { text: h, successTips: T, failTips: y } = m.value.copyCode;
387
+ let b = T;
388
+ qe(e.formatCopiedText(g || "")).catch(() => {
389
+ b = y;
391
390
  }).finally(() => {
392
- d.dataset.isIcon ? d.dataset.tips = C : d.innerHTML = C, a = window.setTimeout(() => {
393
- d.dataset.isIcon ? d.dataset.tips = g : d.innerHTML = g;
391
+ c.dataset.isIcon ? c.dataset.tips = b : c.innerHTML = b, a = window.setTimeout(() => {
392
+ c.dataset.isIcon ? c.dataset.tips = h : c.innerHTML = h;
394
393
  }, 1500);
395
394
  });
396
- }, d.setAttribute("data-processed", "true"));
395
+ }, c.setAttribute("data-processed", "true"));
397
396
  });
398
397
  }, s = () => {
399
- U(m);
398
+ U(u);
400
399
  }, l = (i) => {
401
- i && U(m);
400
+ i && U(u);
402
401
  };
403
- k([t, r], s), k(() => c.value.preview, l), k(() => c.value.htmlPreview, l), H(m);
404
- }, ot = (e) => {
405
- const t = w("editorId"), r = w("theme"), n = w("rootRef"), { editorExtensions: o, editorExtensionsAttrs: u } = P;
406
- let c = o.echarts.instance;
407
- const m = ee(-1), s = () => {
408
- !e.noEcharts && c && (m.value = m.value + 1);
402
+ E([t, r], s), E(() => d.value.preview, l), E(() => d.value.htmlPreview, l), H(u);
403
+ }, nt = (e) => {
404
+ const t = C("editorId"), r = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m, echartsConfig: d } = P;
405
+ let u = o.echarts.instance;
406
+ const s = ee(-1), l = () => {
407
+ !e.noEcharts && u && (s.value = s.value + 1);
409
408
  };
410
- k(
409
+ E(
411
410
  () => r.value,
412
411
  () => {
413
- s();
412
+ l();
414
413
  }
415
414
  ), H(() => {
416
- if (e.noEcharts || c)
415
+ if (e.noEcharts || u)
417
416
  return;
418
- const h = o.echarts.js;
417
+ const g = o.echarts.js;
419
418
  O(
420
419
  "script",
421
420
  {
422
- ...u.echarts?.js,
423
- src: h,
421
+ ...m.echarts?.js,
422
+ src: g,
424
423
  id: M.echarts,
425
424
  onload() {
426
- c = window.echarts, s();
425
+ u = window.echarts, l();
427
426
  }
428
427
  },
429
428
  "echarts"
430
429
  );
431
430
  });
432
- let l = [], i = [], a = [];
433
- const d = (h = !1) => {
434
- if (!l.length) {
435
- h && (i.forEach((v) => {
436
- v.dispose?.();
437
- }), a.forEach((v) => {
438
- v.disconnect?.();
439
- }), i = [], a = []);
431
+ let i = [], a = [], c = [];
432
+ const $ = (g = !1) => {
433
+ if (!i.length) {
434
+ g && (a.forEach((b) => {
435
+ b.dispose?.();
436
+ }), c.forEach((b) => {
437
+ b.disconnect?.();
438
+ }), a = [], c = []);
440
439
  return;
441
440
  }
442
- const p = [], g = [], I = [];
443
- l.forEach((v, C) => {
444
- const x = i[C], b = a[C];
445
- if (h || !v || !v.isConnected || (n?.value ? !n.value.contains(v) : !1)) {
446
- x?.dispose?.(), b?.disconnect?.();
441
+ const h = [], T = [], y = [];
442
+ i.forEach((b, S) => {
443
+ const w = a[S], F = c[S];
444
+ if (g || !b || !b.isConnected || (n?.value ? !n.value.contains(b) : !1)) {
445
+ w?.dispose?.(), F?.disconnect?.();
447
446
  return;
448
447
  }
449
- p.push(v), x && g.push(x), b && I.push(b);
450
- }), l = p, i = g, a = I;
451
- }, $ = () => {
452
- d(), !e.noEcharts && c && Array.from(
448
+ h.push(b), w && T.push(w), F && y.push(F);
449
+ }), i = h, a = T, c = y;
450
+ }, p = () => {
451
+ $(), !e.noEcharts && u && Array.from(
453
452
  n.value.querySelectorAll(
454
453
  `#${t} div.${f}-echarts:not([data-processed])`
455
454
  )
456
- ).forEach((p) => {
457
- if (p.dataset.closed === "false")
455
+ ).forEach((h) => {
456
+ if (h.dataset.closed === "false")
458
457
  return !1;
459
458
  try {
460
- const g = new Function(`return ${p.innerText}`)(), I = c.init(p, r.value);
461
- I.setOption(g), p.setAttribute("data-processed", ""), l.push(p), i.push(I);
462
- const v = new ResizeObserver(() => {
463
- I.resize();
459
+ const T = o.echarts.parseOption(h.innerText, {
460
+ editorId: t,
461
+ element: h
462
+ }), y = d(T), b = u.init(h, r.value);
463
+ b.setOption(y), h.setAttribute("data-processed", ""), i.push(h), a.push(b);
464
+ const S = new ResizeObserver(() => {
465
+ b.resize();
464
466
  });
465
- v.observe(p), a.push(v);
466
- } catch (g) {
467
- y.emit(t, Q, {
467
+ S.observe(h), c.push(S);
468
+ } catch (T) {
469
+ v.emit(t, Q, {
468
470
  name: "echarts",
469
- message: g?.message,
470
- error: g
471
+ message: T?.message,
472
+ error: T
471
473
  });
472
474
  }
473
475
  });
474
476
  };
475
477
  return te(() => {
476
- d(!0);
477
- }), { reRenderEcharts: m, replaceEcharts: $ };
478
- }, at = (e) => {
479
- const t = w("highlight"), r = ee(P.editorExtensions.highlight.instance);
478
+ $(!0);
479
+ }), { reRenderEcharts: s, replaceEcharts: p };
480
+ }, ot = (e) => {
481
+ const t = C("highlight"), r = ee(P.editorExtensions.highlight.instance);
480
482
  return H(() => {
481
483
  e.noHighlight || r.value || (O("link", {
482
484
  ...t.value.css,
@@ -493,7 +495,7 @@ const M = {
493
495
  },
494
496
  "hljs"
495
497
  ));
496
- }), k(
498
+ }), E(
497
499
  () => t.value.css,
498
500
  () => {
499
501
  e.noHighlight || P.editorExtensions.highlight.instance || Ge("link", {
@@ -503,7 +505,7 @@ const M = {
503
505
  });
504
506
  }
505
507
  ), r;
506
- }, rt = (e) => {
508
+ }, at = (e) => {
507
509
  const t = ee(P.editorExtensions.katex.instance);
508
510
  return H(() => {
509
511
  if (e.noKatex || t.value)
@@ -527,15 +529,54 @@ const M = {
527
529
  id: M.katexcss
528
530
  });
529
531
  }), t;
530
- }, Y = new Qe({
532
+ };
533
+ class rt {
534
+ constructor(t) {
535
+ this.options = t;
536
+ }
537
+ cache = /* @__PURE__ */ new Map();
538
+ isExpired(t) {
539
+ return t.expiresAt <= Date.now();
540
+ }
541
+ deleteExpired(t, r) {
542
+ const n = r ?? this.cache.get(t);
543
+ return !n || !this.isExpired(n) ? !1 : (this.cache.delete(t), !0);
544
+ }
545
+ trim() {
546
+ for (const [t, r] of this.cache)
547
+ if (!this.deleteExpired(t, r))
548
+ break;
549
+ for (; this.cache.size > this.options.max; ) {
550
+ const t = this.cache.keys().next().value;
551
+ if (t === void 0)
552
+ break;
553
+ this.cache.delete(t);
554
+ }
555
+ }
556
+ get(t) {
557
+ const r = this.cache.get(t);
558
+ if (!(!r || this.deleteExpired(t, r)))
559
+ return this.cache.delete(t), this.cache.set(t, r), r.value;
560
+ }
561
+ set(t, r) {
562
+ this.cache.delete(t), this.cache.set(t, {
563
+ value: r,
564
+ expiresAt: Date.now() + this.options.ttl
565
+ }), this.trim();
566
+ }
567
+ clear() {
568
+ this.cache.clear();
569
+ }
570
+ }
571
+ const Y = new rt({
531
572
  max: 1e3,
532
573
  // 缓存10分钟
533
574
  ttl: 6e5
534
575
  }), lt = (e) => {
535
- const t = w("editorId"), r = w("theme"), n = w("rootRef"), { editorExtensions: o, editorExtensionsAttrs: u, mermaidConfig: c } = P;
536
- let m = o.mermaid.instance;
576
+ const t = C("editorId"), r = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m, mermaidConfig: d } = P;
577
+ let u = o.mermaid.instance;
537
578
  const s = ee(-1), l = () => {
538
- if (!e.noMermaid && m) {
579
+ if (!e.noMermaid && u) {
539
580
  const a = r.value === "dark" ? {
540
581
  startOnLoad: !1,
541
582
  theme: "dark"
@@ -555,20 +596,20 @@ const M = {
555
596
  clusterBorder: "#b7c0cc"
556
597
  }
557
598
  };
558
- m.initialize(c(a)), s.value = s.value + 1;
599
+ u.initialize(d(a)), s.value = s.value + 1;
559
600
  }
560
601
  };
561
- return k(
602
+ return E(
562
603
  () => r.value,
563
604
  () => {
564
605
  Y.clear(), l();
565
606
  }
566
607
  ), H(() => {
567
- if (e.noMermaid || m)
608
+ if (e.noMermaid || u)
568
609
  return;
569
610
  const a = o.mermaid.js;
570
611
  /\.mjs/.test(a) ? (O("link", {
571
- ...u.mermaid?.js,
612
+ ...m.mermaid?.js,
572
613
  rel: "modulepreload",
573
614
  href: a,
574
615
  id: M.mermaidM
@@ -576,100 +617,100 @@ const M = {
576
617
  /* @vite-ignore */
577
618
  /* webpackIgnore: true */
578
619
  a
579
- ).then((d) => {
580
- m = d.default, l();
581
- }).catch((d) => {
582
- y.emit(t, Q, {
620
+ ).then((c) => {
621
+ u = c.default, l();
622
+ }).catch((c) => {
623
+ v.emit(t, Q, {
583
624
  name: "mermaid",
584
- message: `Failed to load mermaid module: ${d.message}`,
585
- error: d
625
+ message: `Failed to load mermaid module: ${c.message}`,
626
+ error: c
586
627
  });
587
628
  })) : O(
588
629
  "script",
589
630
  {
590
- ...u.mermaid?.js,
631
+ ...m.mermaid?.js,
591
632
  src: a,
592
633
  id: M.mermaid,
593
634
  onload() {
594
- m = window.mermaid, l();
635
+ u = window.mermaid, l();
595
636
  }
596
637
  },
597
638
  "mermaid"
598
639
  );
599
640
  }), { reRenderRef: s, replaceMermaid: async () => {
600
- if (!e.noMermaid && m) {
641
+ if (!e.noMermaid && u) {
601
642
  const a = n.value.querySelectorAll(
602
643
  `div.${f}-mermaid`
603
- ), d = document.createElement("div"), $ = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, h = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
604
- d.style.width = $ + "px", d.style.height = h + "px", d.style.position = "fixed", d.style.zIndex = "-10000", d.style.top = "-10000";
605
- let p = a.length;
606
- p > 0 && document.body.appendChild(d), await Promise.allSettled(
607
- Array.from(a).map((g) => (async (v) => {
608
- if (v.dataset.closed === "false")
644
+ ), c = document.createElement("div"), $ = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, p = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
645
+ c.style.width = $ + "px", c.style.height = p + "px", c.style.position = "fixed", c.style.zIndex = "-10000", c.style.top = "-10000";
646
+ let g = a.length;
647
+ g > 0 && document.body.appendChild(c), await Promise.allSettled(
648
+ Array.from(a).map((h) => (async (y) => {
649
+ if (y.dataset.closed === "false")
609
650
  return !1;
610
- const C = v.innerText;
611
- let x = Y.get(C);
612
- if (!x) {
613
- const b = le();
651
+ const b = y.innerText;
652
+ let S = Y.get(b);
653
+ if (!S) {
654
+ const w = le();
614
655
  let F = { svg: "" };
615
656
  try {
616
- F = await m.render(b, C, d), x = await e.sanitizeMermaid(F.svg);
617
- const S = document.createElement("p");
618
- S.className = `${f}-mermaid`, S.setAttribute("data-processed", ""), S.setAttribute("data-content", C), S.innerHTML = x, S.children[0]?.removeAttribute("height"), Y.set(C, S.innerHTML), v.dataset.line !== void 0 && (S.dataset.line = v.dataset.line), v.replaceWith(S);
619
- } catch (S) {
620
- y.emit(t, Q, {
657
+ F = await u.render(w, b, c), S = await e.sanitizeMermaid(F.svg);
658
+ const x = document.createElement("p");
659
+ x.className = `${f}-mermaid`, x.setAttribute("data-processed", ""), x.setAttribute("data-content", b), x.innerHTML = S, x.children[0]?.removeAttribute("height"), Y.set(b, x.innerHTML), y.dataset.line !== void 0 && (x.dataset.line = y.dataset.line), y.replaceWith(x);
660
+ } catch (x) {
661
+ v.emit(t, Q, {
621
662
  name: "mermaid",
622
- message: S.message,
623
- error: S
663
+ message: x.message,
664
+ error: x
624
665
  });
625
666
  }
626
- --p === 0 && d.remove();
667
+ --g === 0 && c.remove();
627
668
  }
628
- })(g))
669
+ })(h))
629
670
  );
630
671
  }
631
672
  } };
632
673
  }, it = (e, t) => {
633
674
  t = t || {};
634
- const r = 3, n = t.marker || "!", o = n.charCodeAt(0), u = n.length;
635
- let c = "", m = "";
636
- const s = (i, a, d, $, h) => {
637
- const p = i[a];
638
- return p.type === "admonition_open" ? i[a].attrPush([
675
+ const r = 3, n = t.marker || "!", o = n.charCodeAt(0), m = n.length;
676
+ let d = "", u = "";
677
+ const s = (i, a, c, $, p) => {
678
+ const g = i[a];
679
+ return g.type === "admonition_open" ? i[a].attrPush([
639
680
  "class",
640
- `${f}-admonition ${f}-admonition-${p.info}`
641
- ]) : p.type === "admonition_title_open" && i[a].attrPush(["class", `${f}-admonition-title`]), h.renderToken(i, a, d);
681
+ `${f}-admonition ${f}-admonition-${g.info}`
682
+ ]) : g.type === "admonition_title_open" && i[a].attrPush(["class", `${f}-admonition-title`]), p.renderToken(i, a, c);
642
683
  }, l = (i) => {
643
684
  const a = i.trim().split(" ", 2);
644
- m = "", c = a[0], a.length > 1 && (m = i.substring(c.length + 2));
685
+ u = "", d = a[0], a.length > 1 && (u = i.substring(d.length + 2));
645
686
  };
646
687
  e.block.ruler.before(
647
688
  "code",
648
689
  "admonition",
649
- (i, a, d, $) => {
650
- let h, p, g, I = !1, v = i.bMarks[a] + i.tShift[a], C = i.eMarks[a];
651
- if (o !== i.src.charCodeAt(v))
690
+ (i, a, c, $) => {
691
+ let p, g, h, T = !1, y = i.bMarks[a] + i.tShift[a], b = i.eMarks[a];
692
+ if (o !== i.src.charCodeAt(y))
652
693
  return !1;
653
- for (h = v + 1; h <= C && n[(h - v) % u] === i.src[h]; h++)
694
+ for (p = y + 1; p <= b && n[(p - y) % m] === i.src[p]; p++)
654
695
  ;
655
- const x = Math.floor((h - v) / u);
656
- if (x !== r)
696
+ const S = Math.floor((p - y) / m);
697
+ if (S !== r)
657
698
  return !1;
658
- h -= (h - v) % u;
659
- const b = i.src.slice(v, h), F = i.src.slice(h, C);
699
+ p -= (p - y) % m;
700
+ const w = i.src.slice(y, p), F = i.src.slice(p, b);
660
701
  if (l(F), $)
661
702
  return !0;
662
- for (p = a; p++, !(p >= d || (v = i.bMarks[p] + i.tShift[p], C = i.eMarks[p], v < C && i.sCount[p] < i.blkIndent)); )
663
- if (o === i.src.charCodeAt(v) && !(i.sCount[p] - i.blkIndent >= 4)) {
664
- for (h = v + 1; h <= C && n[(h - v) % u] === i.src[h]; h++)
703
+ for (g = a; g++, !(g >= c || (y = i.bMarks[g] + i.tShift[g], b = i.eMarks[g], y < b && i.sCount[g] < i.blkIndent)); )
704
+ if (o === i.src.charCodeAt(y) && !(i.sCount[g] - i.blkIndent >= 4)) {
705
+ for (p = y + 1; p <= b && n[(p - y) % m] === i.src[p]; p++)
665
706
  ;
666
- if (!(Math.floor((h - v) / u) < x) && (h -= (h - v) % u, h = i.skipSpaces(h), !(h < C))) {
667
- I = !0;
707
+ if (!(Math.floor((p - y) / m) < S) && (p -= (p - y) % m, p = i.skipSpaces(p), !(p < b))) {
708
+ T = !0;
668
709
  break;
669
710
  }
670
711
  }
671
- const S = i.parentType, L = i.lineMax;
672
- return i.parentType = "root", i.lineMax = p, g = i.push("admonition_open", "div", 1), g.markup = b, g.block = !0, g.info = c, g.map = [a, p], m && (g = i.push("admonition_title_open", "p", 1), g.markup = b + " " + c, g.map = [a, p], g = i.push("inline", "", 0), g.content = m, g.map = [a, i.line - 1], g.children = [], g = i.push("admonition_title_close", "p", -1), g.markup = b + " " + c), i.md.block.tokenize(i, a + 1, p), g = i.push("admonition_close", "div", -1), g.markup = i.src.slice(v, h), g.block = !0, i.parentType = S, i.lineMax = L, i.line = p + (I ? 1 : 0), !0;
712
+ const x = i.parentType, L = i.lineMax;
713
+ return i.parentType = "root", i.lineMax = g, h = i.push("admonition_open", "div", 1), h.markup = w, h.block = !0, h.info = d, h.map = [a, g], u && (h = i.push("admonition_title_open", "p", 1), h.markup = w + " " + d, h.map = [a, g], h = i.push("inline", "", 0), h.content = u, h.map = [a, i.line - 1], h.children = [], h = i.push("admonition_title_close", "p", -1), h.markup = w + " " + d), i.md.block.tokenize(i, a + 1, g), h = i.push("admonition_close", "div", -1), h.markup = i.src.slice(y, p), h.block = !0, i.parentType = x, i.lineMax = L, i.line = g + (T ? 1 : 0), !0;
673
714
  },
674
715
  {
675
716
  alt: ["paragraph", "reference", "blockquote", "list"]
@@ -682,96 +723,96 @@ const M = {
682
723
  o < 0 ? r.push(n) : (r[o] = r[o].slice(), r[o][1] += ` ${n[1]}`);
683
724
  }), r;
684
725
  }, st = (e, t) => {
685
- const r = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/, u = /::(open|close)/, c = (a) => a.info ? n(a.info).trim() : "", m = (a) => {
686
- const d = c(a), [$ = null, h = ""] = (o.exec(d) || []).slice(1);
687
- return [$, h];
726
+ const r = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/, m = /::(open|close)/, d = (a) => a.info ? n(a.info).trim() : "", u = (a) => {
727
+ const c = d(a), [$ = null, p = ""] = (o.exec(c) || []).slice(1);
728
+ return [$, p];
688
729
  }, s = (a) => {
689
- const d = c(a);
690
- return d ? d.split(/(\s+)/g)[0] : "";
730
+ const c = d(a);
731
+ return c ? c.split(/(\s+)/g)[0] : "";
691
732
  }, l = (a) => {
692
- const d = a.info.match(u) || [], $ = d[1] === "open" || d[1] !== "close" && t.codeFoldable && a.content.trim().split(`
693
- `).length < t.autoFoldThreshold, h = d[1] || t.codeFoldable ? "details" : "div", p = d[1] || t.codeFoldable ? "summary" : "div";
694
- return { open: $, tagContainer: h, tagHeader: p };
695
- }, i = (a, d, $, h, p) => {
696
- if (a[d].hidden)
733
+ const c = a.info.match(m) || [], $ = c[1] === "open" || c[1] !== "close" && t.codeFoldable && a.content.trim().split(`
734
+ `).length < t.autoFoldThreshold, p = c[1] || t.codeFoldable ? "details" : "div", g = c[1] || t.codeFoldable ? "summary" : "div";
735
+ return { open: $, tagContainer: p, tagHeader: g };
736
+ }, i = (a, c, $, p, g) => {
737
+ if (a[c].hidden)
697
738
  return "";
698
- const g = t.usedLanguageTextRef.value?.copyCode.text, I = t.customIconRef.value.copy || g, v = !!t.customIconRef.value.copy, C = `<span class="${f}-collapse-tips">${Ue("collapse-tips", t.customIconRef.value)}</span>`, [x] = m(a[d]);
699
- if (x === null) {
700
- const { open: E, tagContainer: A, tagHeader: J } = l(a[d]), B = [["class", `${f}-code`]];
701
- E && B.push(["open", ""]);
739
+ const h = t.usedLanguageTextRef.value?.copyCode.text, T = t.customIconRef.value.copy || h, y = !!t.customIconRef.value.copy, b = `<span class="${f}-collapse-tips">${Ue("collapse-tips", t.customIconRef.value)}</span>`, [S] = u(a[c]);
740
+ if (S === null) {
741
+ const { open: k, tagContainer: R, tagHeader: J } = l(a[c]), B = [["class", `${f}-code`]];
742
+ k && B.push(["open", ""]);
702
743
  const ne = {
703
- attrs: se(a[d], B)
744
+ attrs: se(a[c], B)
704
745
  };
705
- a[d].info = a[d].info.replace(u, "");
706
- const W = r(a, d, $, h, p);
746
+ a[c].info = a[c].info.replace(m, "");
747
+ const W = r(a, c, $, p, g);
707
748
  return `
708
- <${A} ${p.renderAttrs(ne)}>
749
+ <${R} ${g.renderAttrs(ne)}>
709
750
  <${J} class="${f}-code-head">
710
751
  <div class="${f}-code-flag"><span></span><span></span><span></span></div>
711
752
  <div class="${f}-code-action">
712
- <span class="${f}-code-lang">${e.utils.escapeHtml(a[d].info.trim())}</span>
713
- <span class="${f}-copy-button" data-tips="${g}"${v ? " data-is-icon=true" : ""}>${I}</span>
714
- ${t.extraTools instanceof Function ? t.extraTools({ lang: a[d].info.trim() }) : t.extraTools || ""}
715
- ${A === "details" ? C : ""}
753
+ <span class="${f}-code-lang">${e.utils.escapeHtml(a[c].info.trim())}</span>
754
+ <span class="${f}-copy-button" data-tips="${h}"${y ? " data-is-icon=true" : ""}>${T}</span>
755
+ ${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
756
+ ${R === "details" ? b : ""}
716
757
  </div>
717
758
  </${J}>
718
759
  ${W}
719
- </${A}>
760
+ </${R}>
720
761
  `;
721
762
  }
722
- let b, F, S, L, _ = "", N = "", D = "";
723
- const { open: q, tagContainer: V, tagHeader: z } = l(a[d]), K = [["class", `${f}-code`]];
763
+ let w, F, x, L, _ = "", N = "", D = "";
764
+ const { open: q, tagContainer: V, tagHeader: z } = l(a[c]), K = [["class", `${f}-code`]];
724
765
  q && K.push(["open", ""]);
725
766
  const Z = {
726
- attrs: se(a[d], K)
767
+ attrs: se(a[c], K)
727
768
  };
728
- for (let E = d; E < a.length && (b = a[E], [F, S] = m(b), F === x); E++) {
729
- b.info = b.info.replace(o, "").replace(u, ""), b.hidden = !0;
730
- const A = `${f}-codetab-${t.editorId}-${d}-${E - d}`;
731
- L = E - d > 0 ? "" : "checked", _ += `
769
+ for (let k = c; k < a.length && (w = a[k], [F, x] = u(w), F === S); k++) {
770
+ w.info = w.info.replace(o, "").replace(m, ""), w.hidden = !0;
771
+ const R = `${f}-codetab-${t.editorId}-${c}-${k - c}`;
772
+ L = k - c > 0 ? "" : "checked", _ += `
732
773
  <li>
733
774
  <input
734
775
  type="radio"
735
- id="label-${f}-codetab-label-1-${t.editorId}-${d}-${E - d}"
736
- name="${f}-codetab-label-${t.editorId}-${d}"
737
- class="${A}"
776
+ id="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
777
+ name="${f}-codetab-label-${t.editorId}-${c}"
778
+ class="${R}"
738
779
  ${L}
739
780
  >
740
781
  <label
741
- for="label-${f}-codetab-label-1-${t.editorId}-${d}-${E - d}"
742
- onclick="this.getRootNode().querySelectorAll('.${A}').forEach(e => e.click())"
782
+ for="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
783
+ onclick="this.getRootNode().querySelectorAll('.${R}').forEach(e => e.click())"
743
784
  >
744
- ${e.utils.escapeHtml(S || s(b))}
785
+ ${e.utils.escapeHtml(x || s(w))}
745
786
  </label>
746
787
  </li>`, N += `
747
788
  <div role="tabpanel">
748
789
  <input
749
790
  type="radio"
750
- name="${f}-codetab-pre-${t.editorId}-${d}"
751
- class="${A}"
791
+ name="${f}-codetab-pre-${t.editorId}-${c}"
792
+ class="${R}"
752
793
  ${L}
753
794
  role="presentation">
754
- ${r(a, E, $, h, p)}
795
+ ${r(a, k, $, p, g)}
755
796
  </div>`, D += `
756
797
  <input
757
798
  type="radio"
758
- name="${f}-codetab-lang-${t.editorId}-${d}"
759
- class="${A}"
799
+ name="${f}-codetab-lang-${t.editorId}-${c}"
800
+ class="${R}"
760
801
  ${L}
761
802
  role="presentation">
762
- <span class=${f}-code-lang role="note">${e.utils.escapeHtml(s(b))}</span>`;
803
+ <span class=${f}-code-lang role="note">${e.utils.escapeHtml(s(w))}</span>`;
763
804
  }
764
805
  return `
765
- <${V} ${p.renderAttrs(Z)}>
806
+ <${V} ${g.renderAttrs(Z)}>
766
807
  <${z} class="${f}-code-head">
767
808
  <div class="${f}-code-flag">
768
809
  <ul class="${f}-codetab-label" role="tablist">${_}</ul>
769
810
  </div>
770
811
  <div class="${f}-code-action">
771
812
  <span class="${f}-codetab-lang">${D}</span>
772
- <span class="${f}-copy-button" data-tips="${g}"${v ? " data-is-icon=true" : ""}>${I}</span>
773
- ${t.extraTools instanceof Function ? t.extraTools({ lang: a[d].info.trim() }) : t.extraTools || ""}
774
- ${V === "details" ? C : ""}
813
+ <span class="${f}-copy-button" data-tips="${h}"${y ? " data-is-icon=true" : ""}>${T}</span>
814
+ ${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
815
+ ${V === "details" ? b : ""}
775
816
  </div>
776
817
  </${z}>
777
818
  ${N}
@@ -781,37 +822,37 @@ const M = {
781
822
  e.renderer.rules.fence = i, e.renderer.rules.code_block = i;
782
823
  }, ct = (e, t) => {
783
824
  const r = e.renderer.rules.fence.bind(e.renderer.rules);
784
- e.renderer.rules.fence = (n, o, u, c, m) => {
825
+ e.renderer.rules.fence = (n, o, m, d, u) => {
785
826
  const s = n[o], l = s.content.trim();
786
827
  if (s.info === "echarts") {
787
828
  if (s.attrSet("class", `${f}-echarts`), s.attrSet("data-echarts-theme", t.themeRef.value), s.map && s.level === 0) {
788
- const i = s.map[1] - 1, d = !!c.srcLines[i]?.trim()?.startsWith("```");
789
- s.attrSet("data-closed", `${d}`), s.attrSet("data-line", String(s.map[0]));
829
+ const i = s.map[1] - 1, c = !!d.srcLines[i]?.trim()?.startsWith("```");
830
+ s.attrSet("data-closed", `${c}`), s.attrSet("data-line", String(s.map[0]));
790
831
  }
791
- return `<div ${m.renderAttrs(s)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(l)}</div>`;
832
+ return `<div ${u.renderAttrs(s)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(l)}</div>`;
792
833
  }
793
- return r(n, o, u, c, m);
834
+ return r(n, o, m, d, u);
794
835
  };
795
836
  }, dt = (e, t) => {
796
837
  e.renderer.rules.heading_open = (r, n) => {
797
- const o = r[n], u = r[n + 1].children?.reduce((m, s) => m + (["text", "code_inline", "math_inline"].includes(s.type) && s.content || ""), "") || "", c = o.markup.length;
838
+ const o = r[n], m = r[n + 1].children?.reduce((u, s) => u + (["text", "code_inline", "math_inline"].includes(s.type) && s.content || ""), "") || "", d = o.markup.length;
798
839
  return t.headsRef.value.push({
799
- text: u,
800
- level: c,
840
+ text: m,
841
+ level: d,
801
842
  line: o.map[0],
802
843
  currentToken: o,
803
844
  nextToken: r[n + 1]
804
845
  }), o.map && o.level === 0 && o.attrSet(
805
846
  "id",
806
847
  t.mdHeadingId({
807
- text: u,
808
- level: c,
848
+ text: m,
849
+ level: d,
809
850
  index: t.headsRef.value.length,
810
851
  currentToken: o,
811
852
  nextToken: r[n + 1]
812
853
  })
813
854
  ), e.renderer.renderToken(r, n, t);
814
- }, e.renderer.rules.heading_close = (r, n, o, u, c) => c.renderToken(r, n, o);
855
+ }, e.renderer.rules.heading_close = (r, n, o, m, d) => d.renderToken(r, n, o);
815
856
  }, be = {
816
857
  block: [
817
858
  { open: "$$", close: "$$" },
@@ -828,81 +869,81 @@ const M = {
828
869
  for (const o of n) {
829
870
  if (!t.src.startsWith(o.open, t.pos))
830
871
  continue;
831
- const u = t.pos + o.open.length;
832
- let c = u;
833
- for (; (c = t.src.indexOf(o.close, c)) !== -1; ) {
834
- let m = 0, s = c - 1;
872
+ const m = t.pos + o.open.length;
873
+ let d = m;
874
+ for (; (d = t.src.indexOf(o.close, d)) !== -1; ) {
875
+ let u = 0, s = d - 1;
835
876
  for (; s >= 0 && t.src[s] === "\\"; )
836
- m++, s--;
837
- if (m % 2 === 0)
877
+ u++, s--;
878
+ if (u % 2 === 0)
838
879
  break;
839
- c += o.close.length;
880
+ d += o.close.length;
840
881
  }
841
- if (c !== -1) {
842
- if (c - u === 0)
843
- return r || (t.pending += o.open + o.close), t.pos = c + o.close.length, !0;
882
+ if (d !== -1) {
883
+ if (d - m === 0)
884
+ return r || (t.pending += o.open + o.close), t.pos = d + o.close.length, !0;
844
885
  if (!r) {
845
- const m = t.push("math_inline", "math", 0);
846
- m.markup = o.open, m.content = t.src.slice(u, c);
886
+ const u = t.push("math_inline", "math", 0);
887
+ u.markup = o.open, u.content = t.src.slice(m, d);
847
888
  }
848
- return t.pos = c + o.close.length, !0;
889
+ return t.pos = d + o.close.length, !0;
849
890
  }
850
891
  }
851
892
  return !1;
852
893
  }, mt = (e) => (t, r, n, o) => {
853
- const u = e.delimiters, c = t.bMarks[r] + t.tShift[r], m = t.eMarks[r], s = (l, i, a) => {
894
+ const m = e.delimiters, d = t.bMarks[r] + t.tShift[r], u = t.eMarks[r], s = (l, i, a) => {
854
895
  t.line = i;
855
- const d = t.push("math_block", "math", 0);
856
- return d.block = !0, d.content = l, d.map = [r, t.line], d.markup = a, !0;
896
+ const c = t.push("math_block", "math", 0);
897
+ return c.block = !0, c.content = l, c.map = [r, t.line], c.markup = a, !0;
857
898
  };
858
- for (const l of u) {
859
- const i = c;
899
+ for (const l of m) {
900
+ const i = d;
860
901
  if (t.src.slice(i, i + l.open.length) !== l.open)
861
902
  continue;
862
- const a = i + l.open.length, d = t.src.slice(a, m).trim(), $ = d === "", h = d === l.close, p = d.endsWith(l.close);
863
- if (!$ && !h && !p)
903
+ const a = i + l.open.length, c = t.src.slice(a, u).trim(), $ = c === "", p = c === l.close, g = c.endsWith(l.close);
904
+ if (!$ && !p && !g)
864
905
  continue;
865
906
  if (o)
866
907
  return !0;
867
- if (h)
908
+ if (p)
868
909
  return s("", r + 1, l.open);
869
- if (!$ && p) {
870
- const b = d.slice(0, -l.close.length);
871
- return s(b, r + 1, l.open);
910
+ if (!$ && g) {
911
+ const w = c.slice(0, -l.close.length);
912
+ return s(w, r + 1, l.open);
872
913
  }
873
- let g = r + 1, I = !1, v = "";
874
- for (; g < n; g++) {
875
- const b = t.bMarks[g] + t.tShift[g], F = t.eMarks[g];
876
- if (b < F && t.tShift[g] < t.blkIndent)
914
+ let h = r + 1, T = !1, y = "";
915
+ for (; h < n; h++) {
916
+ const w = t.bMarks[h] + t.tShift[h], F = t.eMarks[h];
917
+ if (w < F && t.tShift[h] < t.blkIndent)
877
918
  break;
878
- if (t.src.slice(b, F).trim().endsWith(l.close)) {
919
+ if (t.src.slice(w, F).trim().endsWith(l.close)) {
879
920
  const L = t.src.slice(0, F).lastIndexOf(l.close);
880
- v = t.src.slice(b, L), I = !0;
921
+ y = t.src.slice(w, L), T = !0;
881
922
  break;
882
923
  }
883
924
  }
884
- if (!I)
925
+ if (!T)
885
926
  continue;
886
- const x = t.getLines(r + 1, g, t.tShift[r], !0) + (v.trim() ? v : "");
887
- return s(x, g + 1, l.open);
927
+ const S = t.getLines(r + 1, h, t.tShift[r], !0) + (y.trim() ? y : "");
928
+ return s(S, h + 1, l.open);
888
929
  }
889
930
  return !1;
890
931
  }, ft = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters: n }) => {
891
- const o = (m, s, l, i, a = !1) => {
892
- const d = {
893
- attrs: se(m, [["class", s]])
894
- }, $ = i.renderAttrs(d);
932
+ const o = (u, s, l, i, a = !1) => {
933
+ const c = {
934
+ attrs: se(u, [["class", s]])
935
+ }, $ = i.renderAttrs(c);
895
936
  if (!t.value)
896
- return `<${l} ${$}>${m.content}</${l}>`;
897
- const h = t.value.renderToString(
898
- m.content,
937
+ return `<${l} ${$}>${u.content}</${l}>`;
938
+ const p = t.value.renderToString(
939
+ u.content,
899
940
  P.katexConfig({
900
941
  throwOnError: !1,
901
942
  displayMode: a
902
943
  })
903
944
  );
904
- return `<${l} ${$} data-processed>${h}</${l}>`;
905
- }, u = (m, s, l, i, a) => o(m[s], `${f}-katex-inline`, "span", a), c = (m, s, l, i, a) => o(m[s], `${f}-katex-block`, "p", a, !0);
945
+ return `<${l} ${$} data-processed>${p}</${l}>`;
946
+ }, m = (u, s, l, i, a) => o(u[s], `${f}-katex-inline`, "span", a), d = (u, s, l, i, a) => o(u[s], `${f}-katex-block`, "p", a, !0);
906
947
  e.inline.ruler.before(
907
948
  "escape",
908
949
  "math_inline",
@@ -918,20 +959,20 @@ const M = {
918
959
  {
919
960
  alt: ["paragraph", "reference", "blockquote", "list"]
920
961
  }
921
- ), e.renderer.rules.math_inline = u, e.renderer.rules.math_block = c;
962
+ ), e.renderer.rules.math_inline = m, e.renderer.rules.math_block = d;
922
963
  }, ht = (e, t) => {
923
964
  const r = e.renderer.rules.fence.bind(e.renderer.rules);
924
- e.renderer.rules.fence = (n, o, u, c, m) => {
965
+ e.renderer.rules.fence = (n, o, m, d, u) => {
925
966
  const s = n[o], l = s.content.trim();
926
967
  if (s.info === "mermaid") {
927
968
  if (s.attrSet("class", `${f}-mermaid`), s.attrSet("data-mermaid-theme", t.themeRef.value), s.map && s.level === 0) {
928
- const a = s.map[1] - 1, $ = !!c.srcLines[a]?.trim()?.startsWith("```");
969
+ const a = s.map[1] - 1, $ = !!d.srcLines[a]?.trim()?.startsWith("```");
929
970
  s.attrSet("data-closed", `${$}`), s.attrSet("data-line", String(s.map[0]));
930
971
  }
931
972
  const i = Y.get(l);
932
- return i ? (s.attrSet("data-processed", ""), s.attrSet("data-content", l), `<p ${m.renderAttrs(s)}>${i}</p>`) : `<div ${m.renderAttrs(s)}>${e.utils.escapeHtml(l)}</div>`;
973
+ return i ? (s.attrSet("data-processed", ""), s.attrSet("data-content", l), `<p ${u.renderAttrs(s)}>${i}</p>`) : `<div ${u.renderAttrs(s)}>${e.utils.escapeHtml(l)}</div>`;
933
974
  }
934
- return r(n, o, u, c, m);
975
+ return r(n, o, m, d, u);
935
976
  };
936
977
  }, $e = (e, t, r) => {
937
978
  const n = e.attrIndex(t), o = [t, r];
@@ -948,21 +989,21 @@ const M = {
948
989
  }, Ct = (e) => {
949
990
  const t = new e("html_inline", "", 0);
950
991
  return t.content = "</label>", t;
951
- }, kt = (e, t, r) => {
992
+ }, Et = (e, t, r) => {
952
993
  const n = new r("html_inline", "", 0);
953
994
  return n.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", n.attrs = [["for", t]], n;
954
- }, Et = (e, t, r) => {
995
+ }, kt = (e, t, r) => {
955
996
  const n = new t("html_inline", "", 0), o = r.enabled ? " " : ' disabled="" ';
956
997
  return e.content.indexOf("[ ] ") === 0 ? n.content = '<input class="task-list-item-checkbox"' + o + 'type="checkbox">' : (e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0) && (n.content = '<input class="task-list-item-checkbox" checked=""' + o + 'type="checkbox">'), n;
957
998
  }, Tt = (e, t, r) => {
958
- if (e.children = e.children || [], e.children.unshift(Et(e, t, r)), e.children[1].content = e.children[1].content.slice(3), e.content = e.content.slice(3), r.label)
999
+ if (e.children = e.children || [], e.children.unshift(kt(e, t, r)), e.children[1].content = e.children[1].content.slice(3), e.content = e.content.slice(3), r.label)
959
1000
  if (r.labelAfter) {
960
1001
  e.children.pop();
961
1002
  const n = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
962
- e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(kt(e.content, n, t));
1003
+ e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(Et(e.content, n, t));
963
1004
  } else
964
1005
  e.children.unshift(wt(t)), e.children.push(Ct(t));
965
- }, It = (e, t = {}) => {
1006
+ }, xt = (e, t = {}) => {
966
1007
  e.core.ruler.after("inline", "github-task-lists", (r) => {
967
1008
  const n = r.tokens;
968
1009
  for (let o = 2; o < n.length; o++)
@@ -972,20 +1013,20 @@ const M = {
972
1013
  "task-list-item" + (t.enabled ? " enabled" : " ")
973
1014
  ), $e(n[$t(n, o - 2)], "class", "contains-task-list"));
974
1015
  });
975
- }, St = (e) => {
1016
+ }, It = (e) => {
976
1017
  e.core.ruler.push("init-line-number", (t) => (t.tokens.forEach((r) => {
977
1018
  r.map && (r.attrs || (r.attrs = []), r.attrs.push(["data-line", r.map[0].toString()]));
978
1019
  }), !0));
979
- }, xt = (e, t) => {
980
- const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions: u } = P, c = w("editorId"), m = w("language"), s = w(
1020
+ }, St = (e, t) => {
1021
+ const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions: m } = P, d = C("editorId"), u = C("language"), s = C(
981
1022
  "usedLanguageText"
982
- ), l = w("showCodeRowNumber"), i = w("theme"), a = w("customIcon"), d = w("rootRef"), $ = w("setting"), h = G([]), p = at(e), g = rt(e), { reRenderRef: I, replaceMermaid: v } = lt(e), { reRenderEcharts: C, replaceEcharts: x } = ot(e), b = Ke({
1023
+ ), l = C("showCodeRowNumber"), i = C("theme"), a = C("customIcon"), c = C("rootRef"), $ = C("setting"), p = G([]), g = ot(e), h = at(e), { reRenderRef: T, replaceMermaid: y } = lt(e), { reRenderEcharts: b, replaceEcharts: S } = nt(e), w = Ke({
983
1024
  html: !0,
984
1025
  breaks: !0,
985
1026
  linkify: !0
986
1027
  });
987
- n(b, {
988
- editorId: c
1028
+ n(w, {
1029
+ editorId: d
989
1030
  });
990
1031
  const F = [
991
1032
  {
@@ -1000,19 +1041,19 @@ const M = {
1000
1041
  },
1001
1042
  {
1002
1043
  type: "taskList",
1003
- plugin: It,
1044
+ plugin: xt,
1004
1045
  options: {}
1005
1046
  },
1006
1047
  {
1007
1048
  type: "heading",
1008
1049
  plugin: dt,
1009
- options: { mdHeadingId: e.mdHeadingId, headsRef: h }
1050
+ options: { mdHeadingId: e.mdHeadingId, headsRef: p }
1010
1051
  },
1011
1052
  {
1012
1053
  type: "code",
1013
1054
  plugin: st,
1014
1055
  options: {
1015
- editorId: c,
1056
+ editorId: d,
1016
1057
  usedLanguageTextRef: s,
1017
1058
  // showCodeRowNumber,
1018
1059
  codeFoldable: e.codeFoldable,
@@ -1034,7 +1075,7 @@ const M = {
1034
1075
  e.noKatex || F.push({
1035
1076
  type: "katex",
1036
1077
  plugin: ft,
1037
- options: { katexRef: g }
1078
+ options: { katexRef: h }
1038
1079
  }), e.noMermaid || F.push({
1039
1080
  type: "mermaid",
1040
1081
  plugin: ht,
@@ -1044,33 +1085,33 @@ const M = {
1044
1085
  plugin: ct,
1045
1086
  options: { themeRef: i }
1046
1087
  }), o(F, {
1047
- editorId: c
1048
- }).forEach((E) => {
1049
- b.use(E.plugin, E.options);
1088
+ editorId: d
1089
+ }).forEach((k) => {
1090
+ w.use(k.plugin, k.options);
1050
1091
  });
1051
- const S = b.options.highlight;
1052
- b.set({
1053
- highlight: (E, A, J) => {
1054
- if (S) {
1055
- const W = S(E, A, J);
1092
+ const x = w.options.highlight;
1093
+ w.set({
1094
+ highlight: (k, R, J) => {
1095
+ if (x) {
1096
+ const W = x(k, R, J);
1056
1097
  if (W)
1057
1098
  return W;
1058
1099
  }
1059
1100
  let B;
1060
- !e.noHighlight && p.value ? p.value.getLanguage(A) ? B = p.value.highlight(E, {
1061
- language: A,
1101
+ !e.noHighlight && g.value ? g.value.getLanguage(R) ? B = g.value.highlight(k, {
1102
+ language: R,
1062
1103
  ignoreIllegals: !0
1063
- }).value : B = p.value.highlightAuto(E).value : B = b.utils.escapeHtml(E);
1104
+ }).value : B = g.value.highlightAuto(k).value : B = w.utils.escapeHtml(k);
1064
1105
  const ne = l ? Ye(
1065
1106
  B.replace(/^\n+|\n+$/g, ""),
1066
- E.replace(/^\n+|\n+$/g, "")
1107
+ k.replace(/^\n+|\n+$/g, "")
1067
1108
  ) : `<span class="${f}-code-block">${B.replace(/^\n+|\n+$/g, "")}</span>`;
1068
- return `<pre><code class="language-${A}" language=${A}>${ne}</code></pre>`;
1109
+ return `<pre><code class="language-${R}" language=${R}>${ne}</code></pre>`;
1069
1110
  }
1070
- }), St(b);
1111
+ }), It(w);
1071
1112
  const L = G(`_article-key_${le()}`), _ = G(
1072
1113
  e.sanitize(
1073
- b.render(e.modelValue, {
1114
+ w.render(e.modelValue, {
1074
1115
  srcLines: e.modelValue.split(`
1075
1116
  `)
1076
1117
  })
@@ -1080,50 +1121,50 @@ const M = {
1080
1121
  }, D = () => {
1081
1122
  };
1082
1123
  const q = () => {
1083
- const E = d.value?.querySelectorAll(
1084
- `#${c} p.${f}-mermaid:not([data-closed=false])`
1124
+ const k = c.value?.querySelectorAll(
1125
+ `#${d} p.${f}-mermaid:not([data-closed=false])`
1085
1126
  );
1086
- D(), D = ze(E, {
1127
+ D(), D = ze(k, {
1087
1128
  customIcon: a.value
1088
- }), u.mermaid?.enableZoom && (N(), N = We(E, {
1129
+ }), m.mermaid?.enableZoom && (N(), N = We(k, {
1089
1130
  customIcon: a.value
1090
1131
  }));
1091
1132
  }, V = () => {
1092
- y.emit(c, X, _.value), e.onHtmlChanged(_.value), e.onGetCatalog(h.value), y.emit(c, oe, h.value), U(() => {
1093
- v().then(q), x();
1133
+ v.emit(d, X, _.value), e.onHtmlChanged(_.value), e.onGetCatalog(p.value), v.emit(d, oe, p.value), U(() => {
1134
+ y().then(q), S();
1094
1135
  });
1095
1136
  }, z = () => {
1096
- h.value = [], _.value = e.sanitize(
1097
- b.render(e.modelValue, {
1137
+ p.value = [], _.value = e.sanitize(
1138
+ w.render(e.modelValue, {
1098
1139
  srcLines: e.modelValue.split(`
1099
1140
  `)
1100
1141
  })
1101
1142
  );
1102
- }, K = R(() => (e.noKatex || !!g.value) && (e.noHighlight || !!p.value));
1143
+ }, K = A(() => (e.noKatex || !!h.value) && (e.noHighlight || !!g.value));
1103
1144
  let Z = -1;
1104
- return k([Re(e, "modelValue"), K, I, m], () => {
1145
+ return E([Ae(e, "modelValue"), K, T, u], () => {
1105
1146
  Z = window.setTimeout(
1106
1147
  () => {
1107
1148
  z();
1108
1149
  },
1109
1150
  t ? 0 : r.renderDelay
1110
1151
  );
1111
- }), k(
1152
+ }), E(
1112
1153
  () => $.value.preview,
1113
1154
  () => {
1114
1155
  $.value.preview && U(() => {
1115
- v().then(q), x(), y.emit(c, oe, h.value);
1156
+ y().then(q), S(), v.emit(d, oe, p.value);
1116
1157
  });
1117
1158
  }
1118
- ), k([_, C], () => {
1159
+ ), E([_, b], () => {
1119
1160
  V();
1120
1161
  }), H(V), H(() => {
1121
- y.on(c, {
1162
+ v.on(d, {
1122
1163
  name: De,
1123
1164
  callback() {
1124
- y.emit(c, oe, h.value);
1165
+ v.emit(d, oe, p.value);
1125
1166
  }
1126
- }), y.on(c, {
1167
+ }), v.on(d, {
1127
1168
  name: de,
1128
1169
  callback: () => {
1129
1170
  L.value = `_article-key_${le()}`, z();
@@ -1133,18 +1174,18 @@ const M = {
1133
1174
  N(), D(), clearTimeout(Z);
1134
1175
  }), { html: _, key: L };
1135
1176
  }, Ft = (e, t) => {
1136
- const r = w("editorId"), n = w("setting"), { noImgZoomIn: o } = e, u = Le(() => {
1137
- const c = document.querySelectorAll(
1177
+ const r = C("editorId"), n = C("setting"), { noImgZoomIn: o } = e, m = Le(() => {
1178
+ const d = document.querySelectorAll(
1138
1179
  `#${r}-preview img:not(.not-zoom):not(.medium-zoom-image)`
1139
1180
  );
1140
- c.length !== 0 && et(c, {
1181
+ d.length !== 0 && Qe(d, {
1141
1182
  background: "#00000073"
1142
1183
  });
1143
1184
  });
1144
1185
  H(async () => {
1145
- !o && n.value.preview && await u();
1146
- }), k([t, () => n.value.preview], async () => {
1147
- !o && n.value.preview && await u();
1186
+ !o && n.value.preview && await m();
1187
+ }), E([t, () => n.value.preview], async () => {
1188
+ !o && n.value.preview && await m();
1148
1189
  });
1149
1190
  }, we = {
1150
1191
  checked: {
@@ -1155,55 +1196,55 @@ const M = {
1155
1196
  regexp: /- \[\s\]/,
1156
1197
  value: "- [x]"
1157
1198
  }
1158
- }, Rt = (e, t) => {
1159
- const r = w("editorId"), n = w("rootRef");
1199
+ }, At = (e, t) => {
1200
+ const r = C("editorId"), n = C("rootRef");
1160
1201
  let o = () => {
1161
1202
  };
1162
- const u = () => {
1203
+ const m = () => {
1163
1204
  if (!n.value)
1164
1205
  return !1;
1165
- const c = n.value.querySelectorAll(".task-list-item.enabled"), m = (s) => {
1206
+ const d = n.value.querySelectorAll(".task-list-item.enabled"), u = (s) => {
1166
1207
  s.preventDefault();
1167
1208
  const l = s.target.checked ? "unChecked" : "checked", i = s.target.parentElement?.dataset.line;
1168
1209
  if (!i)
1169
1210
  return;
1170
- const a = Number(i), d = e.modelValue.split(`
1171
- `), $ = d[Number(a)].replace(
1211
+ const a = Number(i), c = e.modelValue.split(`
1212
+ `), $ = c[Number(a)].replace(
1172
1213
  we[l].regexp,
1173
1214
  we[l].value
1174
1215
  );
1175
- e.previewOnly ? (d[Number(a)] = $, e.onChange(d.join(`
1176
- `))) : y.emit(r, Ve, a + 1, $);
1216
+ e.previewOnly ? (c[Number(a)] = $, e.onChange(c.join(`
1217
+ `))) : v.emit(r, Ve, a + 1, $);
1177
1218
  };
1178
- c.forEach((s) => {
1179
- s.addEventListener("click", m);
1219
+ d.forEach((s) => {
1220
+ s.addEventListener("click", u);
1180
1221
  }), o = () => {
1181
- c.forEach((s) => {
1182
- s.removeEventListener("click", m);
1222
+ d.forEach((s) => {
1223
+ s.removeEventListener("click", u);
1183
1224
  });
1184
1225
  };
1185
1226
  };
1186
1227
  te(() => {
1187
1228
  o();
1188
- }), k(
1229
+ }), E(
1189
1230
  [t],
1190
1231
  () => {
1191
- o(), U(u);
1232
+ o(), U(m);
1192
1233
  },
1193
1234
  {
1194
1235
  immediate: !0
1195
1236
  }
1196
1237
  );
1197
- }, At = (e, t, r) => {
1198
- const n = w("setting"), o = () => {
1238
+ }, Rt = (e, t, r) => {
1239
+ const n = C("setting"), o = () => {
1199
1240
  U(() => {
1200
1241
  e.onRemount?.();
1201
1242
  });
1202
- }, u = (c) => {
1203
- c && o();
1243
+ }, m = (d) => {
1244
+ d && o();
1204
1245
  };
1205
- k([t, r], o), k(() => n.value.preview, u), k(() => n.value.htmlPreview, u), H(o);
1206
- }, Ie = {
1246
+ E([t, r], o), E(() => n.value.preview, m), E(() => n.value.htmlPreview, m), H(o);
1247
+ }, xe = {
1207
1248
  modelValue: {
1208
1249
  type: String,
1209
1250
  default: ""
@@ -1274,8 +1315,8 @@ const M = {
1274
1315
  type: [Object, Function],
1275
1316
  default: void 0
1276
1317
  }
1277
- }, on = {
1278
- ...Ie,
1318
+ }, nn = {
1319
+ ...xe,
1279
1320
  updateModelValue: {
1280
1321
  type: Function,
1281
1322
  default: () => {
@@ -1363,31 +1404,31 @@ const M = {
1363
1404
  }
1364
1405
  },
1365
1406
  setup(e) {
1366
- const t = G(), r = e.html, n = (o, u) => {
1407
+ const t = G(), r = e.html, n = (o, m) => {
1367
1408
  if (!t.value) return;
1368
- const c = t.value, m = Array.from(c.childNodes), s = Math.min(o.length, u.length);
1409
+ const d = t.value, u = Array.from(d.childNodes), s = Math.min(o.length, m.length);
1369
1410
  let l = -1;
1370
1411
  for (let a = 0; a < s; a++)
1371
- if (!Ht(o[a], u[a])) {
1412
+ if (!Ht(o[a], m[a])) {
1372
1413
  l = a;
1373
1414
  break;
1374
1415
  }
1375
1416
  if (l === -1)
1376
- if (u.length > o.length)
1417
+ if (m.length > o.length)
1377
1418
  l = o.length;
1378
- else if (o.length > u.length)
1379
- l = u.length;
1419
+ else if (o.length > m.length)
1420
+ l = m.length;
1380
1421
  else
1381
1422
  return;
1382
- const i = Math.min(l, m.length);
1383
- for (let a = m.length - 1; a >= i; a--)
1384
- m[a].remove();
1423
+ const i = Math.min(l, u.length);
1424
+ for (let a = u.length - 1; a >= i; a--)
1425
+ u[a].remove();
1385
1426
  for (let a = l; a < o.length; a++)
1386
- c.appendChild(o[a].cloneNode(!0));
1427
+ d.appendChild(o[a].cloneNode(!0));
1387
1428
  };
1388
- return k(() => e.html, (o, u) => {
1389
- const c = Ce(o), m = Ce(u || "");
1390
- n(c, m);
1429
+ return E(() => e.html, (o, m) => {
1430
+ const d = Ce(o), u = Ce(m || "");
1431
+ n(d, u);
1391
1432
  }), () => j("div", {
1392
1433
  id: e.id,
1393
1434
  class: e.class,
@@ -1397,28 +1438,28 @@ const M = {
1397
1438
  }
1398
1439
  }), Pt = /* @__PURE__ */ ce({
1399
1440
  name: "ContentPreview",
1400
- props: Ie,
1441
+ props: xe,
1401
1442
  setup(e) {
1402
- const t = w("editorId"), r = w("setting"), n = w("previewTheme"), o = w("showCodeRowNumber"), {
1403
- html: u,
1404
- key: c
1405
- } = xt(e, e.previewOnly);
1406
- nt(e, u, c), Ft(e, u), Rt(e, u), At(e, u, c);
1407
- const m = R(() => [`${f}-preview`, `${n?.value}-theme`, o && `${f}-scrn`].filter(Boolean)), s = () => {
1443
+ const t = C("editorId"), r = C("setting"), n = C("previewTheme"), o = C("showCodeRowNumber"), {
1444
+ html: m,
1445
+ key: d
1446
+ } = St(e, e.previewOnly);
1447
+ tt(e, m, d), Ft(e, m), At(e, m), Rt(e, m, d);
1448
+ const u = A(() => [`${f}-preview`, `${n?.value}-theme`, o && `${f}-scrn`].filter(Boolean)), s = () => {
1408
1449
  const l = `${t}-preview`;
1409
1450
  return e.previewComponent ? He(e.previewComponent, {
1410
- key: c.value,
1411
- html: u.value,
1451
+ key: d.value,
1452
+ html: m.value,
1412
1453
  id: l,
1413
- class: m.value
1454
+ class: u.value
1414
1455
  }) : j(Mt, {
1415
- key: c.value,
1416
- html: u.value,
1456
+ key: d.value,
1457
+ html: m.value,
1417
1458
  id: l,
1418
- class: m.value
1459
+ class: u.value
1419
1460
  }, null);
1420
1461
  };
1421
- return () => j(Ae, null, [r.value.preview && (e.previewOnly ? s() : j("div", {
1462
+ return () => j(Re, null, [r.value.preview && (e.previewOnly ? s() : j("div", {
1422
1463
  id: `${t}-preview-wrapper`,
1423
1464
  class: `${f}-preview-wrapper`,
1424
1465
  key: "content-preview-wrapper"
@@ -1428,9 +1469,9 @@ const M = {
1428
1469
  key: "html-preview-wrapper"
1429
1470
  }, [j("div", {
1430
1471
  class: `${f}-html`
1431
- }, [u.value])])]);
1472
+ }, [m.value])])]);
1432
1473
  }
1433
- }), Lt = ({ text: e }) => e, Se = {
1474
+ }), Lt = ({ text: e }) => e, Ie = {
1434
1475
  /**
1435
1476
  * markdown content.
1436
1477
  *
@@ -1668,8 +1709,8 @@ const M = {
1668
1709
  type: [Object, Function],
1669
1710
  default: void 0
1670
1711
  }
1671
- }, an = {
1672
- ...Se,
1712
+ }, on = {
1713
+ ...Ie,
1673
1714
  /**
1674
1715
  * input回调事件
1675
1716
  */
@@ -1974,14 +2015,14 @@ const M = {
1974
2015
  type: Number,
1975
2016
  default: void 0
1976
2017
  }
1977
- }, xe = [
2018
+ }, Se = [
1978
2019
  "onHtmlChanged",
1979
2020
  "onGetCatalog",
1980
2021
  "onChange",
1981
2022
  "onRemount",
1982
2023
  "update:modelValue"
1983
- ], rn = [
1984
- ...xe,
2024
+ ], an = [
2025
+ ...Se,
1985
2026
  "onSave",
1986
2027
  "onUploadImg",
1987
2028
  "onError",
@@ -1993,29 +2034,29 @@ const M = {
1993
2034
  ], Ot = (e, t, r) => {
1994
2035
  const { editorId: n } = r, o = {
1995
2036
  rerender() {
1996
- y.emit(n, de);
2037
+ v.emit(n, de);
1997
2038
  }
1998
2039
  };
1999
2040
  t.expose(o);
2000
2041
  }, ae = /* @__PURE__ */ ce({
2001
2042
  name: "MdPreview",
2002
- props: Se,
2003
- emits: xe,
2043
+ props: Ie,
2044
+ emits: Se,
2004
2045
  setup(e, t) {
2005
2046
  const {
2006
2047
  noKatex: r,
2007
2048
  noMermaid: n,
2008
2049
  noHighlight: o
2009
- } = e, u = G(), c = tt(e);
2050
+ } = e, m = G(), d = et(e);
2010
2051
  Te(e, {
2011
- rootRef: u,
2012
- editorId: c
2052
+ rootRef: m,
2053
+ editorId: d
2013
2054
  }), Ot(e, t, {
2014
- editorId: c
2055
+ editorId: d
2015
2056
  }), te(() => {
2016
- y.clear(c);
2057
+ v.clear(d);
2017
2058
  });
2018
- const m = (a) => {
2059
+ const u = (a) => {
2019
2060
  e.onChange?.(a), t.emit("onChange", a), t.emit("update:modelValue", a);
2020
2061
  }, s = (a) => {
2021
2062
  e.onHtmlChanged?.(a), t.emit("onHtmlChanged", a);
@@ -2025,13 +2066,13 @@ const M = {
2025
2066
  e.onRemount?.(), t.emit("onRemount");
2026
2067
  };
2027
2068
  return () => j("div", {
2028
- id: c,
2069
+ id: d,
2029
2070
  class: [f, e.class, e.theme === "dark" && `${f}-dark`, `${f}-previewOnly`],
2030
2071
  style: e.style,
2031
- ref: u
2072
+ ref: m
2032
2073
  }, [j(Pt, {
2033
2074
  modelValue: e.modelValue,
2034
- onChange: m,
2075
+ onChange: u,
2035
2076
  onHtmlChanged: s,
2036
2077
  onGetCatalog: l,
2037
2078
  mdHeadingId: e.mdHeadingId,
@@ -2056,15 +2097,15 @@ export {
2056
2097
  M as C,
2057
2098
  ae as M,
2058
2099
  Pt as a,
2059
- an as b,
2060
- on as c,
2061
- en as d,
2062
- rn as e,
2063
- tn as f,
2064
- Jt as g,
2065
- Yt as h,
2066
- Qt as i,
2067
- nn as j,
2068
- Xt as k,
2069
- tt as u
2100
+ on as b,
2101
+ nn as c,
2102
+ Qt as d,
2103
+ an as e,
2104
+ en as f,
2105
+ Zt as g,
2106
+ Xt as h,
2107
+ Yt as i,
2108
+ tn as j,
2109
+ Jt as k,
2110
+ et as u
2070
2111
  };