md-editor-v3 6.0.0 → 6.0.1

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,8 +1,8 @@
1
- import { useId as Re, provide as C, computed as S, reactive as oe, watch as w, onMounted as x, ref as U, inject as $, nextTick as G, shallowRef as X, onBeforeUnmount as Y, toRef as ke, defineComponent as le, createVNode as O, Fragment as He } from "vue";
2
- import { deepMerge as Pe, deepClone as Me, randomId as ae, debounce as Le } from "@vavt/util";
3
- import { p as h, g as A, f as ce, s as de, b as _e, a as Ne } from "./config.mjs";
4
- import { b as v, U as Oe, C as Ce, B as q, O as Ie, E as Z, P as ue, F as me, f as fe, g as he, H as pe, h as ge, R as re, e as je, i as ie, d as Be, j as te, k as De, T as Ve } from "./event-bus.mjs";
5
- import { a as L, u as Ue, S as Ge, z as ve } from "./dom.mjs";
1
+ import { useId as Ae, provide as k, computed as F, reactive as ae, watch as w, onMounted as A, ref as V, inject as b, nextTick as U, shallowRef as ee, onBeforeUnmount as te, toRef as Re, defineComponent as ie, createVNode as O, Fragment as He } from "vue";
2
+ import { deepMerge as Pe, deepClone as Me, randomId as re, debounce as Le } from "@vavt/util";
3
+ import { p as h, g as R, f as ce, s as de, b as _e, a as Ne } from "./config.mjs";
4
+ import { b as v, U as Oe, C as ke, B as J, O as Ce, E as Y, P as ue, F as me, f as fe, g as he, H as pe, h as ge, R as le, e as je, i as se, d as Be, j as ne, k as De, T as Ve } from "./event-bus.mjs";
5
+ import { a as _, u as Ue, S as Ge, z as ve } from "./dom.mjs";
6
6
  import ze from "@vavt/copy2clipboard";
7
7
  import We from "markdown-it";
8
8
  import qe from "markdown-it-image-figures";
@@ -25,7 +25,7 @@ const P = {
25
25
  katexcss: `${h}-katexCss`,
26
26
  echarts: `${h}-echarts`
27
27
  }, Kt = (e, t, r) => {
28
- const { editorId: n } = r, o = oe({
28
+ const { editorId: o } = r, n = ae({
29
29
  // 是否已编译成html
30
30
  buildFinished: !1,
31
31
  // 存储当前最新的html
@@ -34,26 +34,26 @@ const P = {
34
34
  w(
35
35
  () => e.modelValue,
36
36
  () => {
37
- o.buildFinished = !1;
37
+ n.buildFinished = !1;
38
38
  }
39
- ), x(() => {
40
- v.on(n, {
41
- name: q,
39
+ ), A(() => {
40
+ v.on(o, {
41
+ name: J,
42
42
  callback(m) {
43
- o.buildFinished = !0, o.html = m;
43
+ n.buildFinished = !0, n.html = m;
44
44
  }
45
- }), v.on(n, {
46
- name: Ie,
45
+ }), v.on(o, {
46
+ name: Ce,
47
47
  callback() {
48
48
  const m = new Promise((s) => {
49
- if (o.buildFinished)
50
- s(o.html);
49
+ if (n.buildFinished)
50
+ s(n.html);
51
51
  else {
52
52
  const d = (i) => {
53
- s(i), v.remove(n, q, d);
53
+ s(i), v.remove(o, J, d);
54
54
  };
55
- v.on(n, {
56
- name: q,
55
+ v.on(o, {
56
+ name: J,
57
57
  callback: d
58
58
  });
59
59
  }
@@ -62,205 +62,215 @@ const P = {
62
62
  }
63
63
  });
64
64
  });
65
- }, Te = (e, { editorId: t, rootRef: r }) => {
66
- const n = A.editorExtensions.highlight, o = A.editorExtensionsAttrs.highlight;
67
- C("editorId", t), C("rootRef", r), C(
65
+ }, Ie = (e, {
66
+ editorId: t,
67
+ rootRef: r,
68
+ setting: o
69
+ }) => {
70
+ const n = R.editorExtensions.highlight, m = R.editorExtensionsAttrs.highlight;
71
+ k("editorId", t), k("rootRef", r), k(
68
72
  "theme",
69
- S(() => e.theme)
70
- ), C(
73
+ F(() => e.theme)
74
+ ), k(
71
75
  "language",
72
- S(() => e.language)
73
- ), C(
76
+ F(() => e.language)
77
+ ), k(
74
78
  "highlight",
75
- S(() => {
76
- const { js: s } = n, d = {
79
+ F(() => {
80
+ const { js: d } = n, i = {
77
81
  ...ce,
78
82
  ...n.css
79
- }, { js: i, css: c = {} } = o || {}, l = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, a = d[e.codeTheme] ? d[e.codeTheme][l] : ce.atom[l], u = d[e.codeTheme] && c[e.codeTheme] ? c[e.codeTheme][l] : c.atom ? c.atom[l] : {};
83
+ }, { js: u, css: l = {} } = m || {}, a = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, c = i[e.codeTheme] ? i[e.codeTheme][a] : ce.atom[a], p = i[e.codeTheme] && l[e.codeTheme] ? l[e.codeTheme][a] : l.atom ? l.atom[a] : {};
80
84
  return {
81
85
  js: {
82
- src: s,
83
- ...i
86
+ src: d,
87
+ ...u
84
88
  },
85
89
  css: {
86
- href: a,
87
- ...u
90
+ href: c,
91
+ ...p
88
92
  }
89
93
  };
90
94
  })
91
- ), C("showCodeRowNumber", e.showCodeRowNumber);
92
- const m = S(() => {
93
- const s = {
95
+ ), k("showCodeRowNumber", e.showCodeRowNumber);
96
+ const s = F(() => {
97
+ const d = {
94
98
  ...de,
95
- ...A.editorConfig.languageUserDefined
99
+ ...R.editorConfig.languageUserDefined
96
100
  };
97
101
  return Pe(
98
102
  Me(de["en-US"]),
99
- s[e.language] || {}
103
+ d[e.language] || {}
100
104
  );
101
105
  });
102
- return C("usedLanguageText", m), C(
106
+ return k("usedLanguageText", s), k(
103
107
  "previewTheme",
104
- S(() => e.previewTheme)
105
- ), C(
108
+ F(() => e.previewTheme)
109
+ ), k(
106
110
  "customIcon",
107
- S(() => e.customIcon)
111
+ F(() => e.customIcon)
112
+ ), k(
113
+ "setting",
114
+ F(() => o ? {
115
+ // setting是reactive,不转化是可以直接赋值的
116
+ ...o
117
+ } : {
118
+ preview: !0,
119
+ htmlPreview: !1,
120
+ previewOnly: !1,
121
+ pageFullscreen: !1,
122
+ fullscreen: !1
123
+ })
108
124
  ), { editorId: t };
109
- }, Zt = (e, t) => (C("tabWidth", e.tabWidth), C(
125
+ }, Zt = (e, t) => (k("tabWidth", e.tabWidth), k(
110
126
  "disabled",
111
- S(() => e.disabled)
112
- ), C(
127
+ F(() => e.disabled)
128
+ ), k(
113
129
  "showToolbarName",
114
- S(() => e.showToolbarName)
115
- ), C("noUploadImg", e.noUploadImg), C(
130
+ F(() => e.showToolbarName)
131
+ ), k("noUploadImg", e.noUploadImg), k(
116
132
  "tableShape",
117
- S(() => e.tableShape)
118
- ), C("noPrettier", e.noPrettier), C(
133
+ F(() => e.tableShape)
134
+ ), k("noPrettier", e.noPrettier), k(
119
135
  "codeTheme",
120
- S(() => e.codeTheme)
121
- ), C(
122
- "setting",
123
- S(() => ({
124
- // setting是reactive,不转化是可以直接赋值的
125
- ...t.setting
126
- }))
127
- ), C("updateSetting", t.updateSetting), C(
136
+ F(() => e.codeTheme)
137
+ ), k("updateSetting", t.updateSetting), k(
128
138
  "catalogVisible",
129
- S(() => t.catalogVisible.value)
130
- ), C("defToolbars", t.defToolbars), C(
139
+ F(() => t.catalogVisible.value)
140
+ ), k("defToolbars", t.defToolbars), k(
131
141
  "floatingToolbars",
132
- S(() => e.floatingToolbars)
133
- ), Te(e, t)), Jt = (e) => {
134
- const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: n, editorExtensionsAttrs: o } = A, m = t || n.prettier.prettierInstance, s = t || n.prettier.parserMarkdownInstance, d = r || n.cropper.instance;
135
- x(() => {
142
+ F(() => e.floatingToolbars)
143
+ ), Ie(e, t)), Jt = (e) => {
144
+ const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: o, editorExtensionsAttrs: n } = R, m = t || o.prettier.prettierInstance, s = t || o.prettier.parserMarkdownInstance, d = r || o.cropper.instance;
145
+ A(() => {
136
146
  if (!d) {
137
- const { js: i = {}, css: c = {} } = o.cropper || {};
138
- L("link", {
139
- ...c,
147
+ const { js: i = {}, css: u = {} } = n.cropper || {};
148
+ _("link", {
149
+ ...u,
140
150
  rel: "stylesheet",
141
- href: n.cropper.css,
151
+ href: o.cropper.css,
142
152
  id: P.croppercss
143
- }), L("script", {
153
+ }), _("script", {
144
154
  ...i,
145
- src: n.cropper.js,
155
+ src: o.cropper.js,
146
156
  id: P.cropperjs
147
157
  });
148
158
  }
149
159
  if (!m) {
150
- const { standaloneJs: i = {} } = o.prettier || {};
151
- L("script", {
160
+ const { standaloneJs: i = {} } = n.prettier || {};
161
+ _("script", {
152
162
  ...i,
153
- src: n.prettier.standaloneJs,
163
+ src: o.prettier.standaloneJs,
154
164
  id: P.prettier
155
165
  });
156
166
  }
157
167
  if (!s) {
158
- const { parserMarkdownJs: i = {} } = o.prettier || {};
159
- L("script", {
168
+ const { parserMarkdownJs: i = {} } = n.prettier || {};
169
+ _("script", {
160
170
  ...i,
161
- src: n.prettier.parserMarkdownJs,
171
+ src: o.prettier.parserMarkdownJs,
162
172
  id: P.prettierMD
163
173
  });
164
174
  }
165
175
  });
166
176
  }, Xt = (e, t, r) => {
167
- const { editorId: n } = r;
168
- x(() => {
169
- v.on(n, {
170
- name: Z,
171
- callback: (o) => {
172
- e.onError?.(o), t.emit("onError", o);
177
+ const { editorId: o } = r;
178
+ A(() => {
179
+ v.on(o, {
180
+ name: Y,
181
+ callback: (n) => {
182
+ e.onError?.(n), t.emit("onError", n);
173
183
  }
174
184
  });
175
185
  });
176
186
  }, Yt = (e, t, r) => {
177
- const { editorId: n } = r, o = oe({
187
+ const { editorId: o } = r, n = ae({
178
188
  pageFullscreen: e.pageFullscreen,
179
189
  fullscreen: !1,
180
190
  preview: e.preview,
181
191
  htmlPreview: e.preview ? !1 : e.htmlPreview,
182
192
  previewOnly: !1
183
- }), m = oe({ ...o }), s = (c, l) => {
184
- const a = l === void 0 ? !o[c] : l;
185
- switch (c) {
193
+ }), m = ae({ ...n }), s = (u, l) => {
194
+ const a = l === void 0 ? !n[u] : l;
195
+ switch (u) {
186
196
  case "preview": {
187
- o.htmlPreview = !1, o.previewOnly = !1;
197
+ n.htmlPreview = !1, n.previewOnly = !1;
188
198
  break;
189
199
  }
190
200
  case "htmlPreview": {
191
- o.preview = !1, o.previewOnly = !1;
201
+ n.preview = !1, n.previewOnly = !1;
192
202
  break;
193
203
  }
194
204
  case "previewOnly": {
195
- a ? !o.preview && !o.htmlPreview && (o.preview = !0) : (m.preview || (o.preview = !1), m.htmlPreview || (o.htmlPreview = !1));
205
+ a ? !n.preview && !n.htmlPreview && (n.preview = !0) : (m.preview || (n.preview = !1), m.htmlPreview || (n.htmlPreview = !1));
196
206
  break;
197
207
  }
198
208
  }
199
- m[c] = a, o[c] = a;
209
+ m[u] = a, n[u] = a;
200
210
  };
201
211
  let d = "";
202
212
  const i = () => {
203
- o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = d;
213
+ n.pageFullscreen || n.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = d;
204
214
  };
205
- return w(() => [o.pageFullscreen, o.fullscreen], i), x(() => {
206
- v.on(n, {
215
+ return w(() => [n.pageFullscreen, n.fullscreen], i), A(() => {
216
+ v.on(o, {
207
217
  name: Oe,
208
- callback(c, l) {
209
- const a = (u) => {
210
- v.emit(n, re, "image", {
218
+ callback(u, l) {
219
+ const a = (c) => {
220
+ v.emit(o, le, "image", {
211
221
  desc: "",
212
- urls: u
222
+ urls: c
213
223
  }), l?.();
214
224
  };
215
- e.onUploadImg ? e.onUploadImg(c, a) : t.emit("onUploadImg", c, a);
225
+ e.onUploadImg ? e.onUploadImg(u, a) : t.emit("onUploadImg", u, a);
216
226
  }
217
227
  }), d = document.body.style.overflow, i();
218
- }), [o, s];
228
+ }), [n, s];
219
229
  }, Qt = (e, t) => {
220
- const { editorId: r } = t, n = U(!1);
221
- return x(() => {
230
+ const { editorId: r } = t, o = V(!1);
231
+ return A(() => {
222
232
  v.on(r, {
223
- name: Ce,
224
- callback: (o) => {
225
- o === void 0 ? n.value = !n.value : n.value = o;
233
+ name: ke,
234
+ callback: (n) => {
235
+ n === void 0 ? o.value = !o.value : o.value = n;
226
236
  }
227
237
  });
228
- }), n;
238
+ }), o;
229
239
  }, en = (e, t, r) => {
230
- const { editorId: n, catalogVisible: o, setting: m, updateSetting: s, codeRef: d } = r;
240
+ const { editorId: o, catalogVisible: n, setting: m, updateSetting: s, codeRef: d } = r;
231
241
  w(
232
242
  () => m.pageFullscreen,
233
- (c) => {
234
- v.emit(n, ue, c);
243
+ (u) => {
244
+ v.emit(o, ue, u);
235
245
  }
236
246
  ), w(
237
247
  () => m.fullscreen,
238
- (c) => {
239
- v.emit(n, me, c);
248
+ (u) => {
249
+ v.emit(o, me, u);
240
250
  }
241
251
  ), w(
242
252
  () => m.preview,
243
- (c) => {
244
- v.emit(n, fe, c);
253
+ (u) => {
254
+ v.emit(o, fe, u);
245
255
  }
246
256
  ), w(
247
257
  () => m.previewOnly,
248
- (c) => {
249
- v.emit(n, he, c);
258
+ (u) => {
259
+ v.emit(o, he, u);
250
260
  }
251
261
  ), w(
252
262
  () => m.htmlPreview,
253
- (c) => {
254
- v.emit(n, pe, c);
263
+ (u) => {
264
+ v.emit(o, pe, u);
255
265
  }
256
- ), w(o, (c) => {
257
- v.emit(n, ge, c);
266
+ ), w(n, (u) => {
267
+ v.emit(o, ge, u);
258
268
  });
259
269
  const i = {
260
- on(c, l) {
261
- switch (c) {
270
+ on(u, l) {
271
+ switch (u) {
262
272
  case "pageFullscreen": {
263
- v.on(n, {
273
+ v.on(o, {
264
274
  name: ue,
265
275
  callback(a) {
266
276
  l(a);
@@ -269,7 +279,7 @@ const P = {
269
279
  break;
270
280
  }
271
281
  case "fullscreen": {
272
- v.on(n, {
282
+ v.on(o, {
273
283
  name: me,
274
284
  callback(a) {
275
285
  l(a);
@@ -278,7 +288,7 @@ const P = {
278
288
  break;
279
289
  }
280
290
  case "preview": {
281
- v.on(n, {
291
+ v.on(o, {
282
292
  name: fe,
283
293
  callback(a) {
284
294
  l(a);
@@ -287,7 +297,7 @@ const P = {
287
297
  break;
288
298
  }
289
299
  case "previewOnly": {
290
- v.on(n, {
300
+ v.on(o, {
291
301
  name: he,
292
302
  callback(a) {
293
303
  l(a);
@@ -296,7 +306,7 @@ const P = {
296
306
  break;
297
307
  }
298
308
  case "htmlPreview": {
299
- v.on(n, {
309
+ v.on(o, {
300
310
  name: pe,
301
311
  callback(a) {
302
312
  l(a);
@@ -305,7 +315,7 @@ const P = {
305
315
  break;
306
316
  }
307
317
  case "catalog": {
308
- v.on(n, {
318
+ v.on(o, {
309
319
  name: ge,
310
320
  callback(a) {
311
321
  l(a);
@@ -315,35 +325,35 @@ const P = {
315
325
  }
316
326
  }
317
327
  },
318
- togglePageFullscreen(c) {
319
- s("pageFullscreen", c);
328
+ togglePageFullscreen(u) {
329
+ s("pageFullscreen", u);
320
330
  },
321
- toggleFullscreen(c) {
322
- v.emit(n, Be, c);
331
+ toggleFullscreen(u) {
332
+ v.emit(o, Be, u);
323
333
  },
324
- togglePreview(c) {
325
- s("preview", c);
334
+ togglePreview(u) {
335
+ s("preview", u);
326
336
  },
327
- togglePreviewOnly(c) {
328
- s("previewOnly", c);
337
+ togglePreviewOnly(u) {
338
+ s("previewOnly", u);
329
339
  },
330
- toggleHtmlPreview(c) {
331
- s("htmlPreview", c);
340
+ toggleHtmlPreview(u) {
341
+ s("htmlPreview", u);
332
342
  },
333
- toggleCatalog(c) {
334
- v.emit(n, Ce, c);
343
+ toggleCatalog(u) {
344
+ v.emit(o, ke, u);
335
345
  },
336
346
  triggerSave() {
337
- v.emit(n, Ie);
347
+ v.emit(o, Ce);
338
348
  },
339
- insert(c) {
340
- v.emit(n, re, "universal", { generate: c });
349
+ insert(u) {
350
+ v.emit(o, le, "universal", { generate: u });
341
351
  },
342
- focus(c) {
343
- d.value?.focus(c);
352
+ focus(u) {
353
+ d.value?.focus(u);
344
354
  },
345
355
  rerender() {
346
- v.emit(n, ie);
356
+ v.emit(o, se);
347
357
  },
348
358
  getSelectedText() {
349
359
  return d.value?.getSelectedText();
@@ -351,11 +361,11 @@ const P = {
351
361
  resetHistory() {
352
362
  d.value?.resetHistory();
353
363
  },
354
- domEventHandlers(c) {
355
- v.emit(n, je, c);
364
+ domEventHandlers(u) {
365
+ v.emit(o, je, u);
356
366
  },
357
- execCommand(c) {
358
- v.emit(n, re, c);
367
+ execCommand(u) {
368
+ v.emit(o, le, u);
359
369
  },
360
370
  getEditorView() {
361
371
  return d.value?.getEditorView();
@@ -363,38 +373,38 @@ const P = {
363
373
  };
364
374
  t.expose(i);
365
375
  }, Qe = (e) => {
366
- const t = Re();
376
+ const t = Ae();
367
377
  return e.id || e.editorId || `${h}-${t}`;
368
378
  }, et = (e, t, r) => {
369
- const n = $("editorId"), o = $("rootRef"), m = $("usedLanguageText"), s = () => {
370
- o.value.querySelectorAll(`#${n} .${h}-preview .${h}-code`).forEach((c) => {
371
- let l = -1;
372
- const a = c.querySelector(
379
+ const o = b("editorId"), n = b("rootRef"), m = b("usedLanguageText"), s = b("setting"), d = () => {
380
+ n.value.querySelectorAll(`#${o} .${h}-preview .${h}-code`).forEach((l) => {
381
+ let a = -1;
382
+ const c = l.querySelector(
373
383
  `.${h}-copy-button`
374
384
  );
375
- a && (a.onclick = (u) => {
376
- u.preventDefault(), clearTimeout(l);
377
- const f = (c.querySelector("input:checked + pre code") || c.querySelector("pre code")).textContent, { text: g, successTips: y, failTips: F } = m.value.copyCode;
378
- let b = y;
379
- ze(e.formatCopiedText(f)).catch(() => {
380
- b = F;
385
+ c && (c.onclick = (p) => {
386
+ p.preventDefault(), clearTimeout(a);
387
+ const g = (l.querySelector("input:checked + pre code") || l.querySelector("pre code")).textContent, { text: y, successTips: S, failTips: $ } = m.value.copyCode;
388
+ let C = S;
389
+ ze(e.formatCopiedText(g || "")).catch(() => {
390
+ C = $;
381
391
  }).finally(() => {
382
- a.dataset.isIcon ? a.dataset.tips = b : a.innerHTML = b, l = window.setTimeout(() => {
383
- a.dataset.isIcon ? a.dataset.tips = g : a.innerHTML = g;
392
+ c.dataset.isIcon ? c.dataset.tips = C : c.innerHTML = C, a = window.setTimeout(() => {
393
+ c.dataset.isIcon ? c.dataset.tips = y : c.innerHTML = y;
384
394
  }, 1500);
385
395
  });
386
396
  });
387
397
  });
388
- }, d = () => {
389
- G(s);
390
- }, i = (c) => {
391
- c && G(s);
398
+ }, i = () => {
399
+ U(d);
400
+ }, u = (l) => {
401
+ l && U(d);
392
402
  };
393
- w([t, r], d), w(() => e.setting.preview, i), w(() => e.setting.htmlPreview, i), x(s);
403
+ w([t, r], i), w(() => s.value.preview, u), w(() => s.value.htmlPreview, u), A(d);
394
404
  }, tt = (e) => {
395
- const t = $("editorId"), r = $("theme"), n = $("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m } = A;
396
- let s = o.echarts.instance;
397
- const d = X(-1), i = () => {
405
+ const t = b("editorId"), r = b("theme"), o = b("rootRef"), { editorExtensions: n, editorExtensionsAttrs: m } = R;
406
+ let s = n.echarts.instance;
407
+ const d = ee(-1), i = () => {
398
408
  !e.noEcharts && s && (d.value = d.value + 1);
399
409
  };
400
410
  w(
@@ -402,11 +412,11 @@ const P = {
402
412
  () => {
403
413
  i();
404
414
  }
405
- ), x(() => {
415
+ ), A(() => {
406
416
  if (e.noEcharts || s)
407
417
  return;
408
- const f = o.echarts.js;
409
- L(
418
+ const f = n.echarts.js;
419
+ _(
410
420
  "script",
411
421
  {
412
422
  ...m.echarts?.js,
@@ -419,30 +429,30 @@ const P = {
419
429
  "echarts"
420
430
  );
421
431
  });
422
- let c, l = [], a = [];
423
- const u = () => {
432
+ let u, l = [], a = [];
433
+ const c = () => {
424
434
  l.forEach((f) => {
425
435
  f.dispose();
426
436
  }), a.forEach((f) => {
427
437
  f.disconnect();
428
- }), l = [], c = [], a = [];
438
+ }), l = [], u = [], a = [];
429
439
  }, p = () => {
430
- u(), !e.noEcharts && s && (c = Array.from(
431
- n.value.querySelectorAll(
440
+ c(), !e.noEcharts && s && (u = Array.from(
441
+ o.value.querySelectorAll(
432
442
  `#${t} div.${h}-echarts:not([data-processed])`
433
443
  )
434
- ), c.forEach((f) => {
444
+ ), u.forEach((f) => {
435
445
  if (f.dataset.closed === "false")
436
446
  return !1;
437
447
  try {
438
448
  const g = new Function(`return ${f.innerText}`)(), y = s.init(f, r.value);
439
449
  y.setOption(g), f.setAttribute("data-processed", ""), l.push(y);
440
- const F = new ResizeObserver(() => {
450
+ const S = new ResizeObserver(() => {
441
451
  y.resize();
442
452
  });
443
- F.observe(f), a.push(F);
453
+ S.observe(f), a.push(S);
444
454
  } catch (g) {
445
- v.emit(t, Z, {
455
+ v.emit(t, Y, {
446
456
  name: "echarts",
447
457
  message: g?.message,
448
458
  error: g
@@ -450,17 +460,17 @@ const P = {
450
460
  }
451
461
  }));
452
462
  };
453
- return Y(() => {
454
- u();
463
+ return te(() => {
464
+ c();
455
465
  }), { reRenderEcharts: d, replaceEcharts: p };
456
466
  }, nt = (e) => {
457
- const t = $("highlight"), r = X(A.editorExtensions.highlight.instance);
458
- return x(() => {
459
- e.noHighlight || r.value || (L("link", {
467
+ const t = b("highlight"), r = ee(R.editorExtensions.highlight.instance);
468
+ return A(() => {
469
+ e.noHighlight || r.value || (_("link", {
460
470
  ...t.value.css,
461
471
  rel: "stylesheet",
462
472
  id: P.hlcss
463
- }), L(
473
+ }), _(
464
474
  "script",
465
475
  {
466
476
  ...t.value.js,
@@ -474,7 +484,7 @@ const P = {
474
484
  }), w(
475
485
  () => t.value.css,
476
486
  () => {
477
- e.noHighlight || A.editorExtensions.highlight.instance || Ue("link", {
487
+ e.noHighlight || R.editorExtensions.highlight.instance || Ue("link", {
478
488
  ...t.value.css,
479
489
  rel: "stylesheet",
480
490
  id: P.hlcss
@@ -482,15 +492,15 @@ const P = {
482
492
  }
483
493
  ), r;
484
494
  }, ot = (e) => {
485
- const t = X(A.editorExtensions.katex.instance);
486
- return x(() => {
495
+ const t = ee(R.editorExtensions.katex.instance);
496
+ return A(() => {
487
497
  if (e.noKatex || t.value)
488
498
  return;
489
- const { editorExtensions: r, editorExtensionsAttrs: n } = A;
490
- L(
499
+ const { editorExtensions: r, editorExtensionsAttrs: o } = R;
500
+ _(
491
501
  "script",
492
502
  {
493
- ...n.katex?.js,
503
+ ...o.katex?.js,
494
504
  src: r.katex.js,
495
505
  id: P.katexjs,
496
506
  onload() {
@@ -498,21 +508,21 @@ const P = {
498
508
  }
499
509
  },
500
510
  "katex"
501
- ), L("link", {
502
- ...n.katex?.css,
511
+ ), _("link", {
512
+ ...o.katex?.css,
503
513
  rel: "stylesheet",
504
514
  href: r.katex.css,
505
515
  id: P.katexcss
506
516
  });
507
517
  }), t;
508
- }, K = new Xe({
518
+ }, X = new Xe({
509
519
  max: 1e3,
510
520
  // 缓存10分钟
511
521
  ttl: 6e5
512
522
  }), at = (e) => {
513
- const t = $("editorId"), r = $("theme"), n = $("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m, mermaidConfig: s } = A;
514
- let d = o.mermaid.instance;
515
- const i = X(-1), c = () => {
523
+ const t = b("editorId"), r = b("theme"), o = b("rootRef"), { editorExtensions: n, editorExtensionsAttrs: m, mermaidConfig: s } = R;
524
+ let d = n.mermaid.instance;
525
+ const i = ee(-1), u = () => {
516
526
  !e.noMermaid && d && (d.initialize(
517
527
  s({
518
528
  startOnLoad: !1,
@@ -523,13 +533,13 @@ const P = {
523
533
  return w(
524
534
  () => r.value,
525
535
  () => {
526
- K.clear(), c();
536
+ X.clear(), u();
527
537
  }
528
- ), x(() => {
538
+ ), A(() => {
529
539
  if (e.noMermaid || d)
530
540
  return;
531
- const a = o.mermaid.js;
532
- /\.mjs/.test(a) ? (L("link", {
541
+ const a = n.mermaid.js;
542
+ /\.mjs/.test(a) ? (_("link", {
533
543
  ...m.mermaid?.js,
534
544
  rel: "modulepreload",
535
545
  href: a,
@@ -538,54 +548,54 @@ const P = {
538
548
  /* @vite-ignore */
539
549
  /* webpackIgnore: true */
540
550
  a
541
- ).then((u) => {
542
- d = u.default, c();
543
- }).catch((u) => {
544
- v.emit(t, Z, {
551
+ ).then((c) => {
552
+ d = c.default, u();
553
+ }).catch((c) => {
554
+ v.emit(t, Y, {
545
555
  name: "mermaid",
546
- message: `Failed to load mermaid module: ${u.message}`,
547
- error: u
556
+ message: `Failed to load mermaid module: ${c.message}`,
557
+ error: c
548
558
  });
549
- })) : L(
559
+ })) : _(
550
560
  "script",
551
561
  {
552
562
  ...m.mermaid?.js,
553
563
  src: a,
554
564
  id: P.mermaid,
555
565
  onload() {
556
- d = window.mermaid, c();
566
+ d = window.mermaid, u();
557
567
  }
558
568
  },
559
569
  "mermaid"
560
570
  );
561
571
  }), { reRenderRef: i, replaceMermaid: async () => {
562
572
  if (!e.noMermaid && d) {
563
- const a = n.value.querySelectorAll(
573
+ const a = o.value.querySelectorAll(
564
574
  `div.${h}-mermaid`
565
- ), u = document.createElement("div"), p = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, f = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
566
- u.style.width = p + "px", u.style.height = f + "px", u.style.position = "fixed", u.style.zIndex = "-10000", u.style.top = "-10000";
575
+ ), c = document.createElement("div"), p = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, f = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
576
+ c.style.width = p + "px", c.style.height = f + "px", c.style.position = "fixed", c.style.zIndex = "-10000", c.style.top = "-10000";
567
577
  let g = a.length;
568
- g > 0 && document.body.appendChild(u), await Promise.allSettled(
569
- Array.from(a).map((y) => (async (b) => {
570
- if (b.dataset.closed === "false")
578
+ g > 0 && document.body.appendChild(c), await Promise.allSettled(
579
+ Array.from(a).map((y) => (async ($) => {
580
+ if ($.dataset.closed === "false")
571
581
  return !1;
572
- const E = b.innerText;
573
- let R = K.get(E);
574
- if (!R) {
575
- const k = ae();
576
- let H = { svg: "" };
582
+ const C = $.innerText;
583
+ let M = X.get(C);
584
+ if (!M) {
585
+ const T = re();
586
+ let E = { svg: "" };
577
587
  try {
578
- H = await d.render(k, E, u), R = await e.sanitizeMermaid(H.svg);
588
+ E = await d.render(T, C, c), M = await e.sanitizeMermaid(E.svg);
579
589
  const I = document.createElement("p");
580
- I.className = `${h}-mermaid`, I.setAttribute("data-processed", ""), I.innerHTML = R, I.children[0]?.removeAttribute("height"), K.set(E, I.innerHTML), b.dataset.line !== void 0 && (I.dataset.line = b.dataset.line), b.replaceWith(I);
590
+ I.className = `${h}-mermaid`, I.setAttribute("data-processed", ""), I.innerHTML = M, I.children[0]?.removeAttribute("height"), X.set(C, I.innerHTML), $.dataset.line !== void 0 && (I.dataset.line = $.dataset.line), $.replaceWith(I);
581
591
  } catch (I) {
582
- v.emit(t, Z, {
592
+ v.emit(t, Y, {
583
593
  name: "mermaid",
584
594
  message: I.message,
585
595
  error: I
586
596
  });
587
597
  }
588
- --g === 0 && u.remove();
598
+ --g === 0 && c.remove();
589
599
  }
590
600
  })(y))
591
601
  );
@@ -593,187 +603,187 @@ const P = {
593
603
  } };
594
604
  }, rt = (e, t) => {
595
605
  t = t || {};
596
- const r = 3, n = t.marker || "!", o = n.charCodeAt(0), m = n.length;
606
+ const r = 3, o = t.marker || "!", n = o.charCodeAt(0), m = o.length;
597
607
  let s = "", d = "";
598
- const i = (l, a, u, p, f) => {
608
+ const i = (l, a, c, p, f) => {
599
609
  const g = l[a];
600
610
  return g.type === "admonition_open" ? l[a].attrPush([
601
611
  "class",
602
612
  `${h}-admonition ${h}-admonition-${g.info}`
603
- ]) : g.type === "admonition_title_open" && l[a].attrPush(["class", `${h}-admonition-title`]), f.renderToken(l, a, u);
604
- }, c = (l) => {
613
+ ]) : g.type === "admonition_title_open" && l[a].attrPush(["class", `${h}-admonition-title`]), f.renderToken(l, a, c);
614
+ }, u = (l) => {
605
615
  const a = l.trim().split(" ", 2);
606
616
  d = "", s = a[0], a.length > 1 && (d = l.substring(s.length + 2));
607
617
  };
608
618
  e.block.ruler.before(
609
619
  "code",
610
620
  "admonition",
611
- (l, a, u, p) => {
612
- let f, g, y, F = !1, b = l.bMarks[a] + l.tShift[a], E = l.eMarks[a];
613
- if (o !== l.src.charCodeAt(b))
621
+ (l, a, c, p) => {
622
+ let f, g, y, S = !1, $ = l.bMarks[a] + l.tShift[a], C = l.eMarks[a];
623
+ if (n !== l.src.charCodeAt($))
614
624
  return !1;
615
- for (f = b + 1; f <= E && n[(f - b) % m] === l.src[f]; f++)
625
+ for (f = $ + 1; f <= C && o[(f - $) % m] === l.src[f]; f++)
616
626
  ;
617
- const R = Math.floor((f - b) / m);
618
- if (R !== r)
627
+ const M = Math.floor((f - $) / m);
628
+ if (M !== r)
619
629
  return !1;
620
- f -= (f - b) % m;
621
- const k = l.src.slice(b, f), H = l.src.slice(f, E);
622
- if (c(H), p)
630
+ f -= (f - $) % m;
631
+ const T = l.src.slice($, f), E = l.src.slice(f, C);
632
+ if (u(E), p)
623
633
  return !0;
624
- for (g = a; g++, !(g >= u || (b = l.bMarks[g] + l.tShift[g], E = l.eMarks[g], b < E && l.sCount[g] < l.blkIndent)); )
625
- if (o === l.src.charCodeAt(b) && !(l.sCount[g] - l.blkIndent >= 4)) {
626
- for (f = b + 1; f <= E && n[(f - b) % m] === l.src[f]; f++)
634
+ for (g = a; g++, !(g >= c || ($ = l.bMarks[g] + l.tShift[g], C = l.eMarks[g], $ < C && l.sCount[g] < l.blkIndent)); )
635
+ if (n === l.src.charCodeAt($) && !(l.sCount[g] - l.blkIndent >= 4)) {
636
+ for (f = $ + 1; f <= C && o[(f - $) % m] === l.src[f]; f++)
627
637
  ;
628
- if (!(Math.floor((f - b) / m) < R) && (f -= (f - b) % m, f = l.skipSpaces(f), !(f < E))) {
629
- F = !0;
638
+ if (!(Math.floor((f - $) / m) < M) && (f -= (f - $) % m, f = l.skipSpaces(f), !(f < C))) {
639
+ S = !0;
630
640
  break;
631
641
  }
632
642
  }
633
643
  const I = l.parentType, N = l.lineMax;
634
- return l.parentType = "root", l.lineMax = g, y = l.push("admonition_open", "div", 1), y.markup = k, y.block = !0, y.info = s, y.map = [a, g], d && (y = l.push("admonition_title_open", "p", 1), y.markup = k + " " + s, y.map = [a, g], y = l.push("inline", "", 0), y.content = d, y.map = [a, l.line - 1], y.children = [], y = l.push("admonition_title_close", "p", -1), y.markup = k + " " + s), l.md.block.tokenize(l, a + 1, g), y = l.push("admonition_close", "div", -1), y.markup = l.src.slice(b, f), y.block = !0, l.parentType = I, l.lineMax = N, l.line = g + (F ? 1 : 0), !0;
644
+ return l.parentType = "root", l.lineMax = g, y = l.push("admonition_open", "div", 1), y.markup = T, y.block = !0, y.info = s, y.map = [a, g], d && (y = l.push("admonition_title_open", "p", 1), y.markup = T + " " + s, y.map = [a, g], y = l.push("inline", "", 0), y.content = d, y.map = [a, l.line - 1], y.children = [], y = l.push("admonition_title_close", "p", -1), y.markup = T + " " + s), l.md.block.tokenize(l, a + 1, g), y = l.push("admonition_close", "div", -1), y.markup = l.src.slice($, f), y.block = !0, l.parentType = I, l.lineMax = N, l.line = g + (S ? 1 : 0), !0;
635
645
  },
636
646
  {
637
647
  alt: ["paragraph", "reference", "blockquote", "list"]
638
648
  }
639
649
  ), e.renderer.rules.admonition_open = i, e.renderer.rules.admonition_title_open = i, e.renderer.rules.admonition_title_close = i, e.renderer.rules.admonition_close = i;
640
- }, J = (e, t) => {
650
+ }, Q = (e, t) => {
641
651
  const r = e.attrs ? e.attrs.slice() : [];
642
- return t.forEach((n) => {
643
- const o = e.attrIndex(n[0]);
644
- o < 0 ? r.push(n) : (r[o] = r[o].slice(), r[o][1] += ` ${n[1]}`);
652
+ return t.forEach((o) => {
653
+ const n = e.attrIndex(o[0]);
654
+ n < 0 ? r.push(o) : (r[n] = r[n].slice(), r[n][1] += ` ${o[1]}`);
645
655
  }), r;
646
656
  }, lt = (e, t) => {
647
- const r = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/, m = /::(open|close)/, s = (a) => a.info ? n(a.info).trim() : "", d = (a) => {
648
- const u = s(a), [p = null, f = ""] = (o.exec(u) || []).slice(1);
657
+ const r = e.renderer.rules.fence, o = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/, m = /::(open|close)/, s = (a) => a.info ? o(a.info).trim() : "", d = (a) => {
658
+ const c = s(a), [p = null, f = ""] = (n.exec(c) || []).slice(1);
649
659
  return [p, f];
650
660
  }, i = (a) => {
651
- const u = s(a);
652
- return u ? u.split(/(\s+)/g)[0] : "";
653
- }, c = (a) => {
654
- const u = a.info.match(m) || [], p = u[1] === "open" || u[1] !== "close" && t.codeFoldable && a.content.trim().split(`
655
- `).length < t.autoFoldThreshold, f = u[1] || t.codeFoldable ? "details" : "div", g = u[1] || t.codeFoldable ? "summary" : "div";
661
+ const c = s(a);
662
+ return c ? c.split(/(\s+)/g)[0] : "";
663
+ }, u = (a) => {
664
+ const c = a.info.match(m) || [], p = c[1] === "open" || c[1] !== "close" && t.codeFoldable && a.content.trim().split(`
665
+ `).length < t.autoFoldThreshold, f = c[1] || t.codeFoldable ? "details" : "div", g = c[1] || t.codeFoldable ? "summary" : "div";
656
666
  return { open: p, tagContainer: f, tagHeader: g };
657
- }, l = (a, u, p, f, g) => {
658
- if (a[u].hidden)
667
+ }, l = (a, c, p, f, g) => {
668
+ if (a[c].hidden)
659
669
  return "";
660
- const y = t.usedLanguageTextRef.value?.copyCode.text, F = t.customIconRef.value.copy || y, b = !!t.customIconRef.value.copy, E = `<span class="${h}-collapse-tips">${Ge("collapse-tips", t.customIconRef.value)}</span>`, [R] = d(a[u]);
661
- if (R === null) {
662
- const { open: T, tagContainer: _, tagHeader: V } = c(a[u]), se = [["class", `${h}-code`]];
663
- T && se.push(["open", ""]);
664
- const Fe = {
665
- attrs: J(a[u], se)
670
+ const y = t.usedLanguageTextRef.value?.copyCode.text, S = t.customIconRef.value.copy || y, $ = !!t.customIconRef.value.copy, C = `<span class="${h}-collapse-tips">${Ge("collapse-tips", t.customIconRef.value)}</span>`, [M] = d(a[c]);
671
+ if (M === null) {
672
+ const { open: H, tagContainer: x, tagHeader: Z } = u(a[c]), D = [["class", `${h}-code`]];
673
+ H && D.push(["open", ""]);
674
+ const xe = {
675
+ attrs: Q(a[c], D)
666
676
  };
667
- a[u].info = a[u].info.replace(m, "");
668
- const Ae = r(a, u, p, f, g);
677
+ a[c].info = a[c].info.replace(m, "");
678
+ const Fe = r(a, c, p, f, g);
669
679
  return `
670
- <${_} ${g.renderAttrs(Fe)}>
671
- <${V} class="${h}-code-head">
680
+ <${x} ${g.renderAttrs(xe)}>
681
+ <${Z} class="${h}-code-head">
672
682
  <div class="${h}-code-flag"><span></span><span></span><span></span></div>
673
683
  <div class="${h}-code-action">
674
- <span class="${h}-code-lang">${e.utils.escapeHtml(a[u].info.trim())}</span>
675
- <span class="${h}-copy-button" data-tips="${y}"${b ? " data-is-icon=true" : ""}>${F}</span>
676
- ${t.extraTools instanceof Function ? t.extraTools({ lang: a[u].info.trim() }) : t.extraTools || ""}
677
- ${_ === "details" ? E : ""}
684
+ <span class="${h}-code-lang">${e.utils.escapeHtml(a[c].info.trim())}</span>
685
+ <span class="${h}-copy-button" data-tips="${y}"${$ ? " data-is-icon=true" : ""}>${S}</span>
686
+ ${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
687
+ ${x === "details" ? C : ""}
678
688
  </div>
679
- </${V}>
680
- ${Ae}
681
- </${_}>
689
+ </${Z}>
690
+ ${Fe}
691
+ </${x}>
682
692
  `;
683
693
  }
684
- let k, H, I, N, j = "", z = "", W = "";
685
- const { open: Q, tagContainer: D, tagHeader: M } = c(a[u]), B = [["class", `${h}-code`]];
686
- Q && B.push(["open", ""]);
687
- const ee = {
688
- attrs: J(a[u], B)
694
+ let T, E, I, N, G = "", j = "", z = "";
695
+ const { open: K, tagContainer: W, tagHeader: q } = u(a[c]), L = [["class", `${h}-code`]];
696
+ K && L.push(["open", ""]);
697
+ const B = {
698
+ attrs: Q(a[c], L)
689
699
  };
690
- for (let T = u; T < a.length && (k = a[T], [H, I] = d(k), H === R); T++) {
691
- k.info = k.info.replace(o, "").replace(m, ""), k.hidden = !0;
692
- const _ = `${h}-codetab-${t.editorId}-${u}-${T - u}`;
693
- N = T - u > 0 ? "" : "checked", j += `
700
+ for (let H = c; H < a.length && (T = a[H], [E, I] = d(T), E === M); H++) {
701
+ T.info = T.info.replace(n, "").replace(m, ""), T.hidden = !0;
702
+ const x = `${h}-codetab-${t.editorId}-${c}-${H - c}`;
703
+ N = H - c > 0 ? "" : "checked", G += `
694
704
  <li>
695
705
  <input
696
706
  type="radio"
697
- id="label-${h}-codetab-label-1-${t.editorId}-${u}-${T - u}"
698
- name="${h}-codetab-label-${t.editorId}-${u}"
699
- class="${_}"
707
+ id="label-${h}-codetab-label-1-${t.editorId}-${c}-${H - c}"
708
+ name="${h}-codetab-label-${t.editorId}-${c}"
709
+ class="${x}"
700
710
  ${N}
701
711
  >
702
712
  <label
703
- for="label-${h}-codetab-label-1-${t.editorId}-${u}-${T - u}"
704
- onclick="this.getRootNode().querySelectorAll('.${_}').forEach(e => e.click())"
713
+ for="label-${h}-codetab-label-1-${t.editorId}-${c}-${H - c}"
714
+ onclick="this.getRootNode().querySelectorAll('.${x}').forEach(e => e.click())"
705
715
  >
706
- ${e.utils.escapeHtml(I || i(k))}
716
+ ${e.utils.escapeHtml(I || i(T))}
707
717
  </label>
708
- </li>`, z += `
718
+ </li>`, j += `
709
719
  <div role="tabpanel">
710
720
  <input
711
721
  type="radio"
712
- name="${h}-codetab-pre-${t.editorId}-${u}"
713
- class="${_}"
722
+ name="${h}-codetab-pre-${t.editorId}-${c}"
723
+ class="${x}"
714
724
  ${N}
715
725
  role="presentation">
716
- ${r(a, T, p, f, g)}
717
- </div>`, W += `
726
+ ${r(a, H, p, f, g)}
727
+ </div>`, z += `
718
728
  <input
719
729
  type="radio"
720
- name="${h}-codetab-lang-${t.editorId}-${u}"
721
- class="${_}"
730
+ name="${h}-codetab-lang-${t.editorId}-${c}"
731
+ class="${x}"
722
732
  ${N}
723
733
  role="presentation">
724
- <span class=${h}-code-lang role="note">${e.utils.escapeHtml(i(k))}</span>`;
734
+ <span class=${h}-code-lang role="note">${e.utils.escapeHtml(i(T))}</span>`;
725
735
  }
726
736
  return `
727
- <${D} ${g.renderAttrs(ee)}>
728
- <${M} class="${h}-code-head">
737
+ <${W} ${g.renderAttrs(B)}>
738
+ <${q} class="${h}-code-head">
729
739
  <div class="${h}-code-flag">
730
- <ul class="${h}-codetab-label" role="tablist">${j}</ul>
740
+ <ul class="${h}-codetab-label" role="tablist">${G}</ul>
731
741
  </div>
732
742
  <div class="${h}-code-action">
733
- <span class="${h}-codetab-lang">${W}</span>
734
- <span class="${h}-copy-button" data-tips="${y}"${b ? " data-is-icon=true" : ""}>${F}</span>
735
- ${t.extraTools instanceof Function ? t.extraTools({ lang: a[u].info.trim() }) : t.extraTools || ""}
736
- ${D === "details" ? E : ""}
743
+ <span class="${h}-codetab-lang">${z}</span>
744
+ <span class="${h}-copy-button" data-tips="${y}"${$ ? " data-is-icon=true" : ""}>${S}</span>
745
+ ${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
746
+ ${W === "details" ? C : ""}
737
747
  </div>
738
- </${M}>
739
- ${z}
740
- </${D}>
748
+ </${q}>
749
+ ${j}
750
+ </${W}>
741
751
  `;
742
752
  };
743
753
  e.renderer.rules.fence = l, e.renderer.rules.code_block = l;
744
754
  }, it = (e, t) => {
745
755
  const r = e.renderer.rules.fence.bind(e.renderer.rules);
746
- e.renderer.rules.fence = (n, o, m, s, d) => {
747
- const i = n[o], c = i.content.trim();
756
+ e.renderer.rules.fence = (o, n, m, s, d) => {
757
+ const i = o[n], u = i.content.trim();
748
758
  if (i.info === "echarts") {
749
759
  if (i.attrSet("class", `${h}-echarts`), i.attrSet("data-echarts-theme", t.themeRef.value), i.map && i.level === 0) {
750
- const l = i.map[1] - 1, u = !!s.srcLines[l]?.trim()?.startsWith("```");
751
- i.attrSet("data-closed", `${u}`), i.attrSet("data-line", String(i.map[0]));
760
+ const l = i.map[1] - 1, c = !!s.srcLines[l]?.trim()?.startsWith("```");
761
+ i.attrSet("data-closed", `${c}`), i.attrSet("data-line", String(i.map[0]));
752
762
  }
753
- return `<div ${d.renderAttrs(i)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(c)}</div>`;
763
+ return `<div ${d.renderAttrs(i)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(u)}</div>`;
754
764
  }
755
- return r(n, o, m, s, d);
765
+ return r(o, n, m, s, d);
756
766
  };
757
767
  }, st = (e, t) => {
758
- e.renderer.rules.heading_open = (r, n) => {
759
- const o = r[n], m = r[n + 1].children?.reduce((d, i) => d + (["text", "code_inline", "math_inline"].includes(i.type) && i.content || ""), "") || "", s = o.markup.length;
768
+ e.renderer.rules.heading_open = (r, o) => {
769
+ const n = r[o], m = r[o + 1].children?.reduce((d, i) => d + (["text", "code_inline", "math_inline"].includes(i.type) && i.content || ""), "") || "", s = n.markup.length;
760
770
  return t.headsRef.value.push({
761
771
  text: m,
762
772
  level: s,
763
- line: o.map[0],
764
- currentToken: o,
765
- nextToken: r[n + 1]
766
- }), o.map && o.level === 0 && o.attrSet(
773
+ line: n.map[0],
774
+ currentToken: n,
775
+ nextToken: r[o + 1]
776
+ }), n.map && n.level === 0 && n.attrSet(
767
777
  "id",
768
778
  t.mdHeadingId({
769
779
  text: m,
770
780
  level: s,
771
781
  index: t.headsRef.value.length,
772
- currentToken: o,
773
- nextToken: r[n + 1]
782
+ currentToken: n,
783
+ nextToken: r[o + 1]
774
784
  })
775
- ), e.renderer.renderToken(r, n, t);
776
- }, e.renderer.rules.heading_close = (r, n, o, m, s) => s.renderToken(r, n, o);
785
+ ), e.renderer.renderToken(r, o, t);
786
+ }, e.renderer.rules.heading_close = (r, o, n, m, s) => s.renderToken(r, o, n);
777
787
  }, ye = {
778
788
  block: [
779
789
  { open: "$$", close: "$$" },
@@ -786,74 +796,74 @@ const P = {
786
796
  { open: "\\(", close: "\\)" }
787
797
  ]
788
798
  }, ct = (e) => (t, r) => {
789
- const n = e.delimiters;
790
- let o, m, s;
791
- for (const d of n)
799
+ const o = e.delimiters;
800
+ let n, m, s;
801
+ for (const d of o)
792
802
  if (t.src.startsWith(d.open, t.pos)) {
793
803
  const i = t.pos + d.open.length;
794
- for (o = i; (o = t.src.indexOf(d.close, o)) !== -1; ) {
795
- for (s = o - 1; t.src[s] === "\\"; )
804
+ for (n = i; (n = t.src.indexOf(d.close, n)) !== -1; ) {
805
+ for (s = n - 1; t.src[s] === "\\"; )
796
806
  s -= 1;
797
- if ((o - s) % 2 === 1)
807
+ if ((n - s) % 2 === 1)
798
808
  break;
799
- o += d.close.length;
809
+ n += d.close.length;
800
810
  }
801
- if (o === -1)
811
+ if (n === -1)
802
812
  return r || (t.pending += d.open), t.pos = i, !0;
803
- if (o - i === 0)
813
+ if (n - i === 0)
804
814
  return r || (t.pending += d.open + d.close), t.pos = i + d.close.length, !0;
805
815
  if (!r) {
806
- const c = t.src.slice(i, o);
807
- m = t.push("math_inline", "math", 0), m.markup = d.open, m.content = c;
816
+ const u = t.src.slice(i, n);
817
+ m = t.push("math_inline", "math", 0), m.markup = d.open, m.content = u;
808
818
  }
809
- return t.pos = o + d.close.length, !0;
819
+ return t.pos = n + d.close.length, !0;
810
820
  }
811
821
  return !1;
812
- }, dt = (e) => (t, r, n, o) => {
822
+ }, dt = (e) => (t, r, o, n) => {
813
823
  const m = e.delimiters;
814
- let s, d, i, c, l = !1, a = t.bMarks[r] + t.tShift[r], u = t.eMarks[r];
824
+ let s, d, i, u, l = !1, a = t.bMarks[r] + t.tShift[r], c = t.eMarks[r];
815
825
  for (const p of m)
816
- if (t.src.slice(a, a + p.open.length) === p.open && t.src.slice(u - p.close.length, u) === p.close) {
817
- if (a += p.open.length, s = t.src.slice(a, u), o)
826
+ if (t.src.slice(a, a + p.open.length) === p.open && t.src.slice(c - p.close.length, c) === p.close) {
827
+ if (a += p.open.length, s = t.src.slice(a, c), n)
818
828
  return !0;
819
- for (s.trim().slice(-p.close.length) === p.close && (s = s.trim().slice(0, -p.close.length), l = !0), i = r; !l && (i++, !(i >= n || (a = t.bMarks[i] + t.tShift[i], u = t.eMarks[i], a < u && t.tShift[i] < t.blkIndent))); )
820
- t.src.slice(a, u).trim().slice(-p.close.length) === p.close && (c = t.src.slice(0, u).lastIndexOf(p.close), d = t.src.slice(a, c), l = !0);
829
+ for (s.trim().slice(-p.close.length) === p.close && (s = s.trim().slice(0, -p.close.length), l = !0), i = r; !l && (i++, !(i >= o || (a = t.bMarks[i] + t.tShift[i], c = t.eMarks[i], a < c && t.tShift[i] < t.blkIndent))); )
830
+ t.src.slice(a, c).trim().slice(-p.close.length) === p.close && (u = t.src.slice(0, c).lastIndexOf(p.close), d = t.src.slice(a, u), l = !0);
821
831
  t.line = i + 1;
822
832
  const f = t.push("math_block", "math", 0);
823
833
  return f.block = !0, f.content = (s && s.trim() ? s + `
824
834
  ` : "") + t.getLines(r + 1, i, t.tShift[r], !0) + (d && d.trim() ? d : ""), f.map = [r, t.line], f.markup = p.open, !0;
825
835
  }
826
836
  return !1;
827
- }, ut = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters: n }) => {
828
- const o = (s, d, i, c, l) => {
829
- const a = s[d], u = {
830
- attrs: J(a, [["class", `${h}-katex-inline`]])
837
+ }, ut = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters: o }) => {
838
+ const n = (s, d, i, u, l) => {
839
+ const a = s[d], c = {
840
+ attrs: Q(a, [["class", `${h}-katex-inline`]])
831
841
  };
832
842
  if (t.value) {
833
843
  const p = t.value.renderToString(
834
844
  a.content,
835
- A.katexConfig({
845
+ R.katexConfig({
836
846
  throwOnError: !1
837
847
  })
838
848
  );
839
- return `<span ${l.renderAttrs(u)} data-processed>${p}</span>`;
849
+ return `<span ${l.renderAttrs(c)} data-processed>${p}</span>`;
840
850
  } else
841
- return `<span ${l.renderAttrs(u)}>${a.content}</span>`;
842
- }, m = (s, d, i, c, l) => {
843
- const a = s[d], u = {
844
- attrs: J(a, [["class", `${h}-katex-block`]])
851
+ return `<span ${l.renderAttrs(c)}>${a.content}</span>`;
852
+ }, m = (s, d, i, u, l) => {
853
+ const a = s[d], c = {
854
+ attrs: Q(a, [["class", `${h}-katex-block`]])
845
855
  };
846
856
  if (t.value) {
847
857
  const p = t.value.renderToString(
848
858
  a.content,
849
- A.katexConfig({
859
+ R.katexConfig({
850
860
  throwOnError: !1,
851
861
  displayMode: !0
852
862
  })
853
863
  );
854
- return `<p ${l.renderAttrs(u)} data-processed>${p}</p>`;
864
+ return `<p ${l.renderAttrs(c)} data-processed>${p}</p>`;
855
865
  } else
856
- return `<p ${l.renderAttrs(u)}>${a.content}</p>`;
866
+ return `<p ${l.renderAttrs(c)}>${a.content}</p>`;
857
867
  };
858
868
  e.inline.ruler.before(
859
869
  "escape",
@@ -865,34 +875,34 @@ const P = {
865
875
  "blockquote",
866
876
  "math_block",
867
877
  dt({
868
- delimiters: n || ye.block
878
+ delimiters: o || ye.block
869
879
  }),
870
880
  {
871
881
  alt: ["paragraph", "reference", "blockquote", "list"]
872
882
  }
873
- ), e.renderer.rules.math_inline = o, e.renderer.rules.math_block = m;
883
+ ), e.renderer.rules.math_inline = n, e.renderer.rules.math_block = m;
874
884
  }, mt = (e, t) => {
875
885
  const r = e.renderer.rules.fence.bind(e.renderer.rules);
876
- e.renderer.rules.fence = (n, o, m, s, d) => {
877
- const i = n[o], c = i.content.trim();
886
+ e.renderer.rules.fence = (o, n, m, s, d) => {
887
+ const i = o[n], u = i.content.trim();
878
888
  if (i.info === "mermaid") {
879
889
  if (i.attrSet("class", `${h}-mermaid`), i.attrSet("data-mermaid-theme", t.themeRef.value), i.map && i.level === 0) {
880
890
  const a = i.map[1] - 1, p = !!s.srcLines[a]?.trim()?.startsWith("```");
881
891
  i.attrSet("data-closed", `${p}`), i.attrSet("data-line", String(i.map[0]));
882
892
  }
883
- const l = K.get(c);
884
- return l ? (i.attrSet("data-processed", ""), `<p ${d.renderAttrs(i)}>${l}</p>`) : `<div ${d.renderAttrs(i)}>${e.utils.escapeHtml(c)}</div>`;
893
+ const l = X.get(u);
894
+ return l ? (i.attrSet("data-processed", ""), `<p ${d.renderAttrs(i)}>${l}</p>`) : `<div ${d.renderAttrs(i)}>${e.utils.escapeHtml(u)}</div>`;
885
895
  }
886
- return r(n, o, m, s, d);
896
+ return r(o, n, m, s, d);
887
897
  };
888
898
  }, be = (e, t, r) => {
889
- const n = e.attrIndex(t), o = [t, r];
890
- n < 0 ? e.attrPush(o) : (e.attrs = e.attrs || [], e.attrs[n] = o);
899
+ const o = e.attrIndex(t), n = [t, r];
900
+ o < 0 ? e.attrPush(n) : (e.attrs = e.attrs || [], e.attrs[o] = n);
891
901
  }, ft = (e) => e.type === "inline", ht = (e) => e.type === "paragraph_open", pt = (e) => e.type === "list_item_open", gt = (e) => e.content.indexOf("[ ] ") === 0 || e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0, vt = (e, t) => ft(e[t]) && ht(e[t - 1]) && pt(e[t - 2]) && gt(e[t]), yt = (e, t) => {
892
902
  const r = e[t].level - 1;
893
- for (let n = t - 1; n >= 0; n--)
894
- if (e[n].level === r)
895
- return n;
903
+ for (let o = t - 1; o >= 0; o--)
904
+ if (e[o].level === r)
905
+ return o;
896
906
  return -1;
897
907
  }, bt = (e) => {
898
908
  const t = new e("html_inline", "", 0);
@@ -901,48 +911,48 @@ const P = {
901
911
  const t = new e("html_inline", "", 0);
902
912
  return t.content = "</label>", t;
903
913
  }, wt = (e, t, r) => {
904
- const n = new r("html_inline", "", 0);
905
- return n.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", n.attrs = [["for", t]], n;
914
+ const o = new r("html_inline", "", 0);
915
+ return o.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", o.attrs = [["for", t]], o;
906
916
  }, kt = (e, t, r) => {
907
- const n = new t("html_inline", "", 0), o = r.enabled ? " " : ' disabled="" ';
908
- 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;
917
+ const o = new t("html_inline", "", 0), n = r.enabled ? " " : ' disabled="" ';
918
+ return e.content.indexOf("[ ] ") === 0 ? o.content = '<input class="task-list-item-checkbox"' + n + 'type="checkbox">' : (e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0) && (o.content = '<input class="task-list-item-checkbox" checked=""' + n + 'type="checkbox">'), o;
909
919
  }, Ct = (e, t, r) => {
910
920
  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)
911
921
  if (r.labelAfter) {
912
922
  e.children.pop();
913
- const n = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
914
- e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(wt(e.content, n, t));
923
+ const o = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
924
+ e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + o + '">', e.children.push(wt(e.content, o, t));
915
925
  } else
916
926
  e.children.unshift(bt(t)), e.children.push($t(t));
917
927
  }, It = (e, t = {}) => {
918
928
  e.core.ruler.after("inline", "github-task-lists", (r) => {
919
- const n = r.tokens;
920
- for (let o = 2; o < n.length; o++)
921
- vt(n, o) && (Ct(n[o], r.Token, t), be(
922
- n[o - 2],
929
+ const o = r.tokens;
930
+ for (let n = 2; n < o.length; n++)
931
+ vt(o, n) && (Ct(o[n], r.Token, t), be(
932
+ o[n - 2],
923
933
  "class",
924
934
  "task-list-item" + (t.enabled ? " enabled" : " ")
925
- ), be(n[yt(n, o - 2)], "class", "contains-task-list"));
935
+ ), be(o[yt(o, n - 2)], "class", "contains-task-list"));
926
936
  });
927
937
  }, Tt = (e) => {
928
938
  e.core.ruler.push("init-line-number", (t) => (t.tokens.forEach((r) => {
929
939
  r.map && (r.attrs || (r.attrs = []), r.attrs.push(["data-line", r.map[0].toString()]));
930
940
  }), !0));
931
941
  }, Et = (e, t) => {
932
- const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions: m } = A, s = $("editorId"), d = $("language"), i = $(
942
+ const { editorConfig: r, markdownItConfig: o, markdownItPlugins: n, editorExtensions: m } = R, s = b("editorId"), d = b("language"), i = b(
933
943
  "usedLanguageText"
934
- ), c = $("showCodeRowNumber"), l = $("theme"), a = $("customIcon"), u = $("rootRef"), p = U([]);
935
- let f = () => {
944
+ ), u = b("showCodeRowNumber"), l = b("theme"), a = b("customIcon"), c = b("rootRef"), p = b("setting"), f = V([]);
945
+ let g = () => {
936
946
  };
937
- const g = nt(e), y = ot(e), { reRenderRef: F, replaceMermaid: b } = at(e), { reRenderEcharts: E, replaceEcharts: R } = tt(e), k = We({
947
+ const y = nt(e), S = ot(e), { reRenderRef: $, replaceMermaid: C } = at(e), { reRenderEcharts: M, replaceEcharts: T } = tt(e), E = We({
938
948
  html: !0,
939
949
  breaks: !0,
940
950
  linkify: !0
941
951
  });
942
- n(k, {
952
+ o(E, {
943
953
  editorId: s
944
954
  });
945
- const H = [
955
+ const I = [
946
956
  {
947
957
  type: "image",
948
958
  plugin: qe,
@@ -961,7 +971,7 @@ const P = {
961
971
  {
962
972
  type: "heading",
963
973
  plugin: st,
964
- options: { mdHeadingId: e.mdHeadingId, headsRef: p }
974
+ options: { mdHeadingId: e.mdHeadingId, headsRef: f }
965
975
  },
966
976
  {
967
977
  type: "code",
@@ -986,125 +996,125 @@ const P = {
986
996
  options: {}
987
997
  }
988
998
  ];
989
- e.noKatex || H.push({
999
+ e.noKatex || I.push({
990
1000
  type: "katex",
991
1001
  plugin: ut,
992
- options: { katexRef: y }
993
- }), e.noMermaid || H.push({
1002
+ options: { katexRef: S }
1003
+ }), e.noMermaid || I.push({
994
1004
  type: "mermaid",
995
1005
  plugin: mt,
996
1006
  options: { themeRef: l }
997
- }), e.noEcharts || H.push({
1007
+ }), e.noEcharts || I.push({
998
1008
  type: "echarts",
999
1009
  plugin: it,
1000
1010
  options: { themeRef: l }
1001
- }), o(H, {
1011
+ }), n(I, {
1002
1012
  editorId: s
1003
- }).forEach((M) => {
1004
- k.use(M.plugin, M.options);
1013
+ }).forEach((L) => {
1014
+ E.use(L.plugin, L.options);
1005
1015
  });
1006
- const I = k.options.highlight;
1007
- k.set({
1008
- highlight: (M, B, ee) => {
1009
- if (I) {
1010
- const V = I(M, B, ee);
1011
- if (V)
1012
- return V;
1016
+ const N = E.options.highlight;
1017
+ E.set({
1018
+ highlight: (L, B, H) => {
1019
+ if (N) {
1020
+ const D = N(L, B, H);
1021
+ if (D)
1022
+ return D;
1013
1023
  }
1014
- let T;
1015
- !e.noHighlight && g.value ? g.value.getLanguage(B) ? T = g.value.highlight(M, {
1024
+ let x;
1025
+ !e.noHighlight && y.value ? y.value.getLanguage(B) ? x = y.value.highlight(L, {
1016
1026
  language: B,
1017
1027
  ignoreIllegals: !0
1018
- }).value : T = g.value.highlightAuto(M).value : T = k.utils.escapeHtml(M);
1019
- const _ = c ? Je(
1020
- T.replace(/^\n+|\n+$/g, ""),
1021
- M.replace(/^\n+|\n+$/g, "")
1022
- ) : `<span class="${h}-code-block">${T.replace(/^\n+|\n+$/g, "")}</span>`;
1023
- return `<pre><code class="language-${B}" language=${B}>${_}</code></pre>`;
1028
+ }).value : x = y.value.highlightAuto(L).value : x = E.utils.escapeHtml(L);
1029
+ const Z = u ? Je(
1030
+ x.replace(/^\n+|\n+$/g, ""),
1031
+ L.replace(/^\n+|\n+$/g, "")
1032
+ ) : `<span class="${h}-code-block">${x.replace(/^\n+|\n+$/g, "")}</span>`;
1033
+ return `<pre><code class="language-${B}" language=${B}>${Z}</code></pre>`;
1024
1034
  }
1025
- }), Tt(k);
1026
- const N = U(`_article-key_${ae()}`), j = U(
1035
+ }), Tt(E);
1036
+ const G = V(`_article-key_${re()}`), j = V(
1027
1037
  e.sanitize(
1028
- k.render(e.modelValue, {
1038
+ E.render(e.modelValue, {
1029
1039
  srcLines: e.modelValue.split(`
1030
1040
  `)
1031
1041
  })
1032
1042
  )
1033
1043
  ), z = () => {
1034
- v.emit(s, q, j.value), e.onHtmlChanged(j.value), e.onGetCatalog(p.value), v.emit(s, te, p.value), G(() => {
1035
- b().then(() => {
1036
- m.mermaid?.enableZoom && (f(), f = ve(
1037
- u.value?.querySelectorAll(
1044
+ v.emit(s, J, j.value), e.onHtmlChanged(j.value), e.onGetCatalog(f.value), v.emit(s, ne, f.value), U(() => {
1045
+ C().then(() => {
1046
+ m.mermaid?.enableZoom && (g(), g = ve(
1047
+ c.value?.querySelectorAll(
1038
1048
  `#${s} p.${h}-mermaid:not([data-closed=false])`
1039
1049
  ),
1040
1050
  {
1041
1051
  customIcon: a.value
1042
1052
  }
1043
1053
  ));
1044
- }), R();
1054
+ }), T();
1045
1055
  });
1046
- }, W = () => {
1047
- p.value = [], j.value = e.sanitize(
1048
- k.render(e.modelValue, {
1056
+ }, K = () => {
1057
+ f.value = [], j.value = e.sanitize(
1058
+ E.render(e.modelValue, {
1049
1059
  srcLines: e.modelValue.split(`
1050
1060
  `)
1051
1061
  })
1052
1062
  );
1053
- }, Q = S(() => (e.noKatex || !!y.value) && (e.noHighlight || !!g.value));
1054
- let D = -1;
1055
- return w([ke(e, "modelValue"), Q, F, d], () => {
1056
- D = window.setTimeout(
1063
+ }, W = F(() => (e.noKatex || !!S.value) && (e.noHighlight || !!y.value));
1064
+ let q = -1;
1065
+ return w([Re(e, "modelValue"), W, $, d], () => {
1066
+ q = window.setTimeout(
1057
1067
  () => {
1058
- W();
1068
+ K();
1059
1069
  },
1060
1070
  t ? 0 : r.renderDelay
1061
1071
  );
1062
1072
  }), w(
1063
- () => e.setting.preview,
1073
+ () => p.value.preview,
1064
1074
  () => {
1065
- e.setting.preview && G(() => {
1066
- b().then(() => {
1067
- m.mermaid?.enableZoom && (f(), f = ve(
1068
- u.value?.querySelectorAll(
1075
+ p.value.preview && U(() => {
1076
+ C().then(() => {
1077
+ m.mermaid?.enableZoom && (g(), g = ve(
1078
+ c.value?.querySelectorAll(
1069
1079
  `#${s} p.${h}-mermaid:not([data-closed=false])`
1070
1080
  ),
1071
1081
  {
1072
1082
  customIcon: a.value
1073
1083
  }
1074
1084
  ));
1075
- }), R(), v.emit(s, te, p.value);
1085
+ }), T(), v.emit(s, ne, f.value);
1076
1086
  });
1077
1087
  }
1078
- ), w([j, E], () => {
1088
+ ), w([j, M], () => {
1079
1089
  z();
1080
- }), x(z), x(() => {
1090
+ }), A(z), A(() => {
1081
1091
  v.on(s, {
1082
1092
  name: De,
1083
1093
  callback() {
1084
- v.emit(s, te, p.value);
1094
+ v.emit(s, ne, f.value);
1085
1095
  }
1086
1096
  }), v.on(s, {
1087
- name: ie,
1097
+ name: se,
1088
1098
  callback: () => {
1089
- N.value = `_article-key_${ae()}`, W();
1099
+ G.value = `_article-key_${re()}`, K();
1090
1100
  }
1091
1101
  });
1092
- }), Y(() => {
1093
- f(), clearTimeout(D);
1094
- }), { html: j, key: N };
1102
+ }), te(() => {
1103
+ g(), clearTimeout(q);
1104
+ }), { html: j, key: G };
1095
1105
  }, St = (e, t) => {
1096
- const r = $("editorId"), { noImgZoomIn: n } = e, o = Le(() => {
1097
- const m = document.querySelectorAll(
1106
+ const r = b("editorId"), o = b("setting"), { noImgZoomIn: n } = e, m = Le(() => {
1107
+ const s = document.querySelectorAll(
1098
1108
  `#${r}-preview img:not(.not-zoom):not(.medium-zoom-image)`
1099
1109
  );
1100
- m.length !== 0 && Ye(m, {
1110
+ s.length !== 0 && Ye(s, {
1101
1111
  background: "#00000073"
1102
1112
  });
1103
1113
  });
1104
- x(async () => {
1105
- !n && e.setting.preview && await o();
1106
- }), w([t, ke(e.setting, "preview")], async () => {
1107
- !n && e.setting.preview && await o();
1114
+ A(async () => {
1115
+ !n && o.value.preview && await m();
1116
+ }), w([t, () => o.value.preview], async () => {
1117
+ !n && o.value.preview && await m();
1108
1118
  });
1109
1119
  }, $e = {
1110
1120
  checked: {
@@ -1116,54 +1126,54 @@ const P = {
1116
1126
  value: "- [x]"
1117
1127
  }
1118
1128
  }, xt = (e, t) => {
1119
- const r = $("editorId"), n = $("rootRef");
1120
- let o = () => {
1129
+ const r = b("editorId"), o = b("rootRef");
1130
+ let n = () => {
1121
1131
  };
1122
1132
  const m = () => {
1123
- if (!n.value)
1133
+ if (!o.value)
1124
1134
  return !1;
1125
- const s = n.value.querySelectorAll(".task-list-item.enabled"), d = (i) => {
1135
+ const s = o.value.querySelectorAll(".task-list-item.enabled"), d = (i) => {
1126
1136
  i.preventDefault();
1127
- const c = i.target.checked ? "unChecked" : "checked", l = i.target.parentElement?.dataset.line;
1137
+ const u = i.target.checked ? "unChecked" : "checked", l = i.target.parentElement?.dataset.line;
1128
1138
  if (!l)
1129
1139
  return;
1130
- const a = Number(l), u = e.modelValue.split(`
1131
- `), p = u[Number(a)].replace(
1132
- $e[c].regexp,
1133
- $e[c].value
1140
+ const a = Number(l), c = e.modelValue.split(`
1141
+ `), p = c[Number(a)].replace(
1142
+ $e[u].regexp,
1143
+ $e[u].value
1134
1144
  );
1135
- e.previewOnly ? (u[Number(a)] = p, e.onChange(u.join(`
1145
+ e.previewOnly ? (c[Number(a)] = p, e.onChange(c.join(`
1136
1146
  `))) : v.emit(r, Ve, a + 1, p);
1137
1147
  };
1138
1148
  s.forEach((i) => {
1139
1149
  i.addEventListener("click", d);
1140
- }), o = () => {
1150
+ }), n = () => {
1141
1151
  s.forEach((i) => {
1142
1152
  i.removeEventListener("click", d);
1143
1153
  });
1144
1154
  };
1145
1155
  };
1146
- Y(() => {
1147
- o();
1156
+ te(() => {
1157
+ n();
1148
1158
  }), w(
1149
1159
  [t],
1150
1160
  () => {
1151
- o(), G(m);
1161
+ n(), U(m);
1152
1162
  },
1153
1163
  {
1154
1164
  immediate: !0
1155
1165
  }
1156
1166
  );
1157
1167
  }, Ft = (e, t, r) => {
1158
- const n = () => {
1159
- G(() => {
1168
+ const o = b("setting"), n = () => {
1169
+ U(() => {
1160
1170
  e.onRemount?.();
1161
1171
  });
1162
- }, o = (m) => {
1163
- m && n();
1172
+ }, m = (s) => {
1173
+ s && n();
1164
1174
  };
1165
- w([t, r], n), w(() => e.setting.preview, o), w(() => e.setting.htmlPreview, o), x(n);
1166
- }, Ee = {
1175
+ w([t, r], n), w(() => o.value.preview, m), w(() => o.value.htmlPreview, m), A(n);
1176
+ }, Te = {
1167
1177
  modelValue: {
1168
1178
  type: String,
1169
1179
  default: ""
@@ -1173,10 +1183,6 @@ const P = {
1173
1183
  default: () => {
1174
1184
  }
1175
1185
  },
1176
- setting: {
1177
- type: Object,
1178
- default: () => ({ preview: !0 })
1179
- },
1180
1186
  onHtmlChanged: {
1181
1187
  type: Function,
1182
1188
  default: () => {
@@ -1235,7 +1241,7 @@ const P = {
1235
1241
  type: Boolean
1236
1242
  }
1237
1243
  }, tn = {
1238
- ...Ee,
1244
+ ...Te,
1239
1245
  updateModelValue: {
1240
1246
  type: Function,
1241
1247
  default: () => {
@@ -1307,28 +1313,28 @@ const P = {
1307
1313
  const r = new DOMParser().parseFromString(e, "text/html");
1308
1314
  return Array.from(r.body.childNodes);
1309
1315
  }, Rt = (e, t) => {
1310
- const r = [], n = [];
1311
- if (e.forEach((o, m) => {
1316
+ const r = [], o = [];
1317
+ if (e.forEach((n, m) => {
1312
1318
  const s = t[m];
1313
1319
  if (!s) {
1314
1320
  r.push({
1315
1321
  index: m,
1316
- newNode: o
1322
+ newNode: n
1317
1323
  });
1318
1324
  return;
1319
1325
  }
1320
- (o.nodeType !== s.nodeType || o.textContent !== s.textContent || o.nodeType === 1 && o.outerHTML !== s.outerHTML) && r.push({
1326
+ (n.nodeType !== s.nodeType || n.textContent !== s.textContent || n.nodeType === 1 && n.outerHTML !== s.outerHTML) && r.push({
1321
1327
  index: m,
1322
- newNode: o
1328
+ newNode: n
1323
1329
  });
1324
1330
  }), t.length > e.length)
1325
- for (let o = e.length; o < t.length; o++)
1326
- n.push(t[o]);
1331
+ for (let n = e.length; n < t.length; n++)
1332
+ o.push(t[n]);
1327
1333
  return {
1328
1334
  updates: r,
1329
- deletes: n
1335
+ deletes: o
1330
1336
  };
1331
- }, we = /* @__PURE__ */ le({
1337
+ }, we = /* @__PURE__ */ ie({
1332
1338
  name: "UpdateOnDemand",
1333
1339
  props: {
1334
1340
  html: {
@@ -1337,57 +1343,57 @@ const P = {
1337
1343
  }
1338
1344
  },
1339
1345
  setup(e) {
1340
- const t = $("editorId"), r = $("previewTheme"), n = $("showCodeRowNumber"), o = U(), m = e.html, s = (d, i) => {
1341
- o.value && (i.forEach((c) => {
1342
- c.remove();
1346
+ const t = b("editorId"), r = b("previewTheme"), o = b("showCodeRowNumber"), n = V(), m = e.html, s = (d, i) => {
1347
+ n.value && (i.forEach((u) => {
1348
+ u.remove();
1343
1349
  }), d.forEach(({
1344
- index: c,
1350
+ index: u,
1345
1351
  newNode: l
1346
1352
  }) => {
1347
- const a = o.value?.childNodes[c];
1348
- a ? o.value?.replaceChild(l.cloneNode(!0), a) : o.value?.appendChild(l.cloneNode(!0));
1353
+ const a = n.value?.childNodes[u];
1354
+ a ? n.value?.replaceChild(l.cloneNode(!0), a) : n.value?.appendChild(l.cloneNode(!0));
1349
1355
  }));
1350
1356
  };
1351
1357
  return w(() => e.html, (d) => {
1352
- const i = At(d), c = Array.from(o.value?.childNodes || []), {
1358
+ const i = At(d), u = Array.from(n.value?.childNodes || []), {
1353
1359
  updates: l,
1354
1360
  deletes: a
1355
- } = Rt(i, c);
1361
+ } = Rt(i, u);
1356
1362
  s(l, a);
1357
1363
  }), () => O("div", {
1358
1364
  id: `${t}-preview`,
1359
- class: [`${h}-preview`, `${r?.value}-theme`, n && `${h}-scrn`],
1365
+ class: [`${h}-preview`, `${r?.value}-theme`, o && `${h}-scrn`],
1360
1366
  innerHTML: m,
1361
- ref: o
1367
+ ref: n
1362
1368
  }, null);
1363
1369
  }
1364
- }), Ht = /* @__PURE__ */ le({
1370
+ }), Ht = /* @__PURE__ */ ie({
1365
1371
  name: "ContentPreview",
1366
- props: Ee,
1372
+ props: Te,
1367
1373
  setup(e) {
1368
- const t = $("editorId"), {
1369
- html: r,
1374
+ const t = b("editorId"), r = b("setting"), {
1375
+ html: o,
1370
1376
  key: n
1371
1377
  } = Et(e, e.previewOnly);
1372
- return et(e, r, n), St(e, r), xt(e, r), Ft(e, r, n), () => O(He, null, [e.setting.preview && (e.previewOnly ? O(we, {
1378
+ return et(e, o, n), St(e, o), xt(e, o), Ft(e, o, n), () => O(He, null, [r.value.preview && (e.previewOnly ? O(we, {
1373
1379
  key: n.value,
1374
- html: r.value
1380
+ html: o.value
1375
1381
  }, null) : O("div", {
1376
1382
  id: `${t}-preview-wrapper`,
1377
1383
  class: `${h}-preview-wrapper`,
1378
1384
  key: "content-preview-wrapper"
1379
1385
  }, [O(we, {
1380
1386
  key: n.value,
1381
- html: r.value
1382
- }, null)])), e.setting.htmlPreview && O("div", {
1387
+ html: o.value
1388
+ }, null)])), r.value.htmlPreview && O("div", {
1383
1389
  id: `${t}-html-wrapper`,
1384
1390
  class: `${h}-preview-wrapper`,
1385
1391
  key: "html-preview-wrapper"
1386
1392
  }, [O("div", {
1387
1393
  class: `${h}-html`
1388
- }, [r.value])])]);
1394
+ }, [o.value])])]);
1389
1395
  }
1390
- }), Pt = ({ text: e }) => e, Se = {
1396
+ }), Pt = ({ text: e }) => e, Ee = {
1391
1397
  /**
1392
1398
  * markdown content.
1393
1399
  *
@@ -1622,7 +1628,7 @@ const P = {
1622
1628
  default: !1
1623
1629
  }
1624
1630
  }, nn = {
1625
- ...Se,
1631
+ ...Ee,
1626
1632
  /**
1627
1633
  * input回调事件
1628
1634
  */
@@ -1927,14 +1933,14 @@ const P = {
1927
1933
  type: Number,
1928
1934
  default: void 0
1929
1935
  }
1930
- }, xe = [
1936
+ }, Se = [
1931
1937
  "onHtmlChanged",
1932
1938
  "onGetCatalog",
1933
1939
  "onChange",
1934
1940
  "onRemount",
1935
1941
  "update:modelValue"
1936
1942
  ], on = [
1937
- ...xe,
1943
+ ...Se,
1938
1944
  "onSave",
1939
1945
  "onUploadImg",
1940
1946
  "onError",
@@ -1944,28 +1950,28 @@ const P = {
1944
1950
  "onDrop",
1945
1951
  "oninputBoxWidthChange"
1946
1952
  ], Mt = (e, t, r) => {
1947
- const { editorId: n } = r, o = {
1953
+ const { editorId: o } = r, n = {
1948
1954
  rerender() {
1949
- v.emit(n, ie);
1955
+ v.emit(o, se);
1950
1956
  }
1951
1957
  };
1952
- t.expose(o);
1953
- }, ne = /* @__PURE__ */ le({
1958
+ t.expose(n);
1959
+ }, oe = /* @__PURE__ */ ie({
1954
1960
  name: "MdPreview",
1955
- props: Se,
1956
- emits: xe,
1961
+ props: Ee,
1962
+ emits: Se,
1957
1963
  setup(e, t) {
1958
1964
  const {
1959
1965
  noKatex: r,
1960
- noMermaid: n,
1961
- noHighlight: o
1962
- } = e, m = U(), s = Qe(e);
1963
- return Te(e, {
1966
+ noMermaid: o,
1967
+ noHighlight: n
1968
+ } = e, m = V(), s = Qe(e);
1969
+ return Ie(e, {
1964
1970
  rootRef: m,
1965
1971
  editorId: s
1966
1972
  }), Mt(e, t, {
1967
1973
  editorId: s
1968
- }), Y(() => {
1974
+ }), te(() => {
1969
1975
  v.clear(s);
1970
1976
  }), () => O("div", {
1971
1977
  id: s,
@@ -1984,11 +1990,11 @@ const P = {
1984
1990
  e.onGetCatalog?.(d), t.emit("onGetCatalog", d);
1985
1991
  },
1986
1992
  mdHeadingId: e.mdHeadingId,
1987
- noMermaid: n,
1993
+ noMermaid: o,
1988
1994
  sanitize: e.sanitize,
1989
1995
  noKatex: r,
1990
1996
  formatCopiedText: e.formatCopiedText,
1991
- noHighlight: o,
1997
+ noHighlight: n,
1992
1998
  noImgZoomIn: e.noImgZoomIn,
1993
1999
  previewOnly: !0,
1994
2000
  sanitizeMermaid: e.sanitizeMermaid,
@@ -2001,10 +2007,10 @@ const P = {
2001
2007
  }, null)]);
2002
2008
  }
2003
2009
  });
2004
- ne.install = (e) => (e.component(ne.name, ne), e);
2010
+ oe.install = (e) => (e.component(oe.name, oe), e);
2005
2011
  export {
2006
2012
  P as C,
2007
- ne as M,
2013
+ oe as M,
2008
2014
  Ht as a,
2009
2015
  nn as b,
2010
2016
  tn as c,