md-editor-v3 3.0.0-beta.1 → 3.0.0-beta.4

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,28 +1,28 @@
1
- var St = Object.defineProperty;
2
- var xt = (e, t, o) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var U = (e, t, o) => (xt(e, typeof t != "symbol" ? t + "" : t, o), o);
4
- import { defineComponent as M, createVNode as i, reactive as N, ref as F, watch as T, onMounted as A, onBeforeUnmount as ye, cloneVNode as Et, inject as x, computed as D, nextTick as z, Fragment as Ce, toRef as Q, shallowRef as de, provide as W, isVNode as Lt } from "vue";
5
- import { minimalSetup as Ht, EditorView as ae } from "codemirror";
6
- import { EditorSelection as fe, EditorState as ce, Compartment as It, StateEffect as At } from "@codemirror/state";
7
- import { EditorView as $e, placeholder as Ft, keymap as Mt } from "@codemirror/view";
8
- import { languages as Rt } from "@codemirror/language-data";
9
- import { markdown as jt } from "@codemirror/lang-markdown";
10
- import { deleteLine as Bt, indentWithTab as Pt, undo as Ot, redo as Dt } from "@codemirror/commands";
11
- import { HighlightStyle as bt, syntaxHighlighting as kt, indentUnit as Nt } from "@codemirror/language";
1
+ var wt = Object.defineProperty;
2
+ var Tt = (e, l, o) => l in e ? wt(e, l, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[l] = o;
3
+ var K = (e, l, o) => (Tt(e, typeof l != "symbol" ? l + "" : l, o), o);
4
+ import { defineComponent as M, createVNode as i, reactive as q, ref as B, watch as S, onMounted as H, onBeforeUnmount as Se, cloneVNode as St, inject as x, computed as U, nextTick as Y, Fragment as xe, toRef as ne, shallowRef as de, provide as Z, isVNode as xt } from "vue";
5
+ import { minimalSetup as Et, EditorView as fe } from "codemirror";
6
+ import { EditorSelection as be, EditorState as ge, Compartment as Lt, StateEffect as At } from "@codemirror/state";
7
+ import { EditorView as Ee, placeholder as It, keymap as Ht } from "@codemirror/view";
8
+ import { languages as Ft } from "@codemirror/language-data";
9
+ import { markdown as Mt } from "@codemirror/lang-markdown";
10
+ import { deleteLine as Bt, indentWithTab as Rt, undo as jt, redo as Pt } from "@codemirror/commands";
11
+ import { HighlightStyle as vt, syntaxHighlighting as pt, indentUnit as Dt } from "@codemirror/language";
12
12
  import { tags as g } from "@lezer/highlight";
13
- import _t from "medium-zoom";
14
- import Vt from "copy-to-clipboard";
15
- import Ut from "markdown-it";
16
- import qt from "markdown-it-image-figures";
17
- import Wt from "markdown-it-task-lists";
18
- import Gt from "lru-cache";
19
- const s = "md-editor", zt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", H = "https://cdnjs.cloudflare.com/ajax/libs", Xt = `${H}/highlight.js/11.7.0/highlight.min.js`, Ke = {
20
- main: `${H}/prettier/2.8.0/standalone.js`,
21
- markdown: `${H}/prettier/2.8.0/parser-markdown.js`
22
- }, Xe = {
23
- css: `${H}/cropperjs/1.5.13/cropper.min.css`,
24
- js: `${H}/cropperjs/1.5.13/cropper.min.js`
25
- }, Zt = `${H}/screenfull.js/5.2.0/screenfull.min.js`, yt = [
13
+ import Ot from "medium-zoom";
14
+ import _t from "copy-to-clipboard";
15
+ import Nt from "markdown-it";
16
+ import Vt from "markdown-it-image-figures";
17
+ import Ut from "markdown-it-task-lists";
18
+ import qt from "lru-cache";
19
+ const s = "md-editor", Wt = "md-editor-v3", Gt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", L = "https://cdnjs.cloudflare.com/ajax/libs", Kt = `${L}/highlight.js/11.7.0/highlight.min.js`, Ge = {
20
+ main: `${L}/prettier/2.8.0/standalone.js`,
21
+ markdown: `${L}/prettier/2.8.0/parser-markdown.js`
22
+ }, Ke = {
23
+ css: `${L}/cropperjs/1.5.13/cropper.min.css`,
24
+ js: `${L}/cropperjs/1.5.13/cropper.min.js`
25
+ }, zt = `${L}/screenfull.js/5.2.0/screenfull.min.js`, bt = [
26
26
  "bold",
27
27
  "underline",
28
28
  "italic",
@@ -55,7 +55,7 @@ const s = "md-editor", zt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font
55
55
  "htmlPreview",
56
56
  "catalog",
57
57
  "github"
58
- ], Ct = ["markdownTotal", "=", "scrollSwitch"], Ze = {
58
+ ], kt = ["markdownTotal", "=", "scrollSwitch"], ze = {
59
59
  "zh-CN": {
60
60
  toolbarTips: {
61
61
  bold: "加粗",
@@ -218,73 +218,73 @@ const s = "md-editor", zt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font
218
218
  scrollAuto: "Scroll Auto"
219
219
  }
220
220
  }
221
- }, Jt = `${H}/mermaid/9.4.0/mermaid.min.js`, Je = {
222
- js: `${H}/KaTeX/0.16.3/katex.min.js`,
223
- css: `${H}/KaTeX/0.16.3/katex.min.css`
224
- }, Ye = {
221
+ }, Xt = `${L}/mermaid/9.4.0/mermaid.min.js`, Xe = {
222
+ js: `${L}/KaTeX/0.16.3/katex.min.js`,
223
+ css: `${L}/KaTeX/0.16.3/katex.min.css`
224
+ }, Ze = {
225
225
  a11y: {
226
- light: `${H}/highlight.js/11.7.0/styles/a11y-light.min.css`,
227
- dark: `${H}/highlight.js/11.7.0/styles/a11y-dark.min.css`
226
+ light: `${L}/highlight.js/11.7.0/styles/a11y-light.min.css`,
227
+ dark: `${L}/highlight.js/11.7.0/styles/a11y-dark.min.css`
228
228
  },
229
229
  atom: {
230
- light: `${H}/highlight.js/11.7.0/styles/atom-one-light.min.css`,
231
- dark: `${H}/highlight.js/11.7.0/styles/atom-one-dark.min.css`
230
+ light: `${L}/highlight.js/11.7.0/styles/atom-one-light.min.css`,
231
+ dark: `${L}/highlight.js/11.7.0/styles/atom-one-dark.min.css`
232
232
  },
233
233
  github: {
234
- light: `${H}/highlight.js/11.7.0/styles/github.min.css`,
235
- dark: `${H}/highlight.js/11.7.0/styles/github-dark.min.css`
234
+ light: `${L}/highlight.js/11.7.0/styles/github.min.css`,
235
+ dark: `${L}/highlight.js/11.7.0/styles/github-dark.min.css`
236
236
  },
237
237
  gradient: {
238
- light: `${H}/highlight.js/11.7.0/styles/gradient-light.min.css`,
239
- dark: `${H}/highlight.js/11.7.0/styles/gradient-dark.min.css`
238
+ light: `${L}/highlight.js/11.7.0/styles/gradient-light.min.css`,
239
+ dark: `${L}/highlight.js/11.7.0/styles/gradient-dark.min.css`
240
240
  },
241
241
  kimbie: {
242
- light: `${H}/highlight.js/11.7.0/styles/kimbie-light.min.css`,
243
- dark: `${H}/highlight.js/11.7.0/styles/kimbie-dark.min.css`
242
+ light: `${L}/highlight.js/11.7.0/styles/kimbie-light.min.css`,
243
+ dark: `${L}/highlight.js/11.7.0/styles/kimbie-dark.min.css`
244
244
  },
245
245
  paraiso: {
246
- light: `${H}/highlight.js/11.7.0/styles/paraiso-light.min.css`,
247
- dark: `${H}/highlight.js/11.7.0/styles/paraiso-dark.min.css`
246
+ light: `${L}/highlight.js/11.7.0/styles/paraiso-light.min.css`,
247
+ dark: `${L}/highlight.js/11.7.0/styles/paraiso-dark.min.css`
248
248
  },
249
249
  qtcreator: {
250
- light: `${H}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,
251
- dark: `${H}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`
250
+ light: `${L}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,
251
+ dark: `${L}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`
252
252
  },
253
253
  stackoverflow: {
254
- light: `${H}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,
255
- dark: `${H}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`
254
+ light: `${L}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,
255
+ dark: `${L}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`
256
256
  }
257
- }, I = {
257
+ }, A = {
258
258
  // markedRenderer: (r) => r,
259
259
  // markedExtensions: [],
260
260
  // markedOptions: {},
261
261
  editorExtensions: {},
262
262
  editorConfig: {},
263
- codeMirrorExtensions: (e, t) => t,
263
+ codeMirrorExtensions: (e, l) => l,
264
264
  markdownItConfig: () => {
265
265
  }
266
- }, Yt = (e) => {
266
+ }, Zt = (e) => {
267
267
  if (e)
268
- for (const t in e) {
269
- const o = e[t];
270
- o && (I[t] = o);
268
+ for (const l in e) {
269
+ const o = e[l];
270
+ o && (A[l] = o);
271
271
  }
272
272
  };
273
- const Qt = /* @__PURE__ */ M({
273
+ const Jt = /* @__PURE__ */ M({
274
274
  setup() {
275
275
  return () => i("div", {
276
276
  class: `${s}-divider`
277
277
  }, null);
278
278
  }
279
- }), _ = ({
279
+ }), W = ({
280
280
  instance: e,
281
- ctx: t,
281
+ ctx: l,
282
282
  props: o = {}
283
- }, l = "default") => {
284
- const r = (e == null ? void 0 : e.$slots[l]) || (t == null ? void 0 : t.slots[l]);
285
- return (r ? r(e) : "") || o[l];
283
+ }, t = "default") => {
284
+ const r = (e == null ? void 0 : e.$slots[t]) || (l == null ? void 0 : l.slots[t]);
285
+ return (r ? r(e) : "") || o[t];
286
286
  };
287
- const el = {
287
+ const Yt = {
288
288
  trigger: {
289
289
  type: String,
290
290
  default: "hover"
@@ -307,141 +307,141 @@ const el = {
307
307
  type: String,
308
308
  default: "html"
309
309
  }
310
- }, Y = /* @__PURE__ */ M({
311
- props: el,
312
- setup(e, t) {
313
- const o = `${s}-dropdown-hidden`, l = N({
310
+ }, oe = /* @__PURE__ */ M({
311
+ props: Yt,
312
+ setup(e, l) {
313
+ const o = `${s}-dropdown-hidden`, t = q({
314
314
  overlayClass: [o],
315
315
  overlayStyle: {},
316
316
  triggerHover: !1,
317
317
  overlayHover: !1
318
- }), r = F(), n = F(), a = () => {
319
- var w;
320
- e.trigger === "hover" && (l.triggerHover = !0);
321
- const f = r.value, h = n.value, v = f.getBoundingClientRect(), b = f.offsetTop, k = f.offsetLeft, p = v.height, y = v.width, $ = ((w = document.querySelector(e.relative)) == null ? void 0 : w.scrollLeft) || 0;
322
- l.overlayStyle = {
323
- ...l.overlayStyle,
324
- top: b + p + "px",
325
- left: k - h.offsetWidth / 2 + y / 2 - $ + "px"
318
+ }), r = B(), n = B(), a = () => {
319
+ var T;
320
+ e.trigger === "hover" && (t.triggerHover = !0);
321
+ const f = r.value, h = n.value, p = f.getBoundingClientRect(), v = f.offsetTop, b = f.offsetLeft, y = p.height, C = p.width, $ = ((T = document.querySelector(e.relative)) == null ? void 0 : T.scrollLeft) || 0;
322
+ t.overlayStyle = {
323
+ ...t.overlayStyle,
324
+ top: v + y + "px",
325
+ left: b - h.offsetWidth / 2 + C / 2 - $ + "px"
326
326
  }, e.onChange(!0);
327
- }, c = () => {
328
- l.overlayHover = !0;
327
+ }, d = () => {
328
+ t.overlayHover = !0;
329
329
  };
330
- T(() => e.visible, (f) => {
331
- f ? l.overlayClass = l.overlayClass.filter((h) => h !== o) : l.overlayClass.push(o);
330
+ S(() => e.visible, (f) => {
331
+ f ? t.overlayClass = t.overlayClass.filter((h) => h !== o) : t.overlayClass.push(o);
332
332
  });
333
333
  const m = (f) => {
334
- const h = r.value, v = n.value;
335
- !h.contains(f.target) && !v.contains(f.target) && e.onChange(!1);
334
+ const h = r.value, p = n.value;
335
+ !h.contains(f.target) && !p.contains(f.target) && e.onChange(!1);
336
336
  };
337
337
  let u = -1;
338
- const d = (f) => {
339
- r.value === f.target ? l.triggerHover = !1 : l.overlayHover = !1, clearTimeout(u), u = window.setTimeout(() => {
340
- !l.overlayHover && !l.triggerHover && e.onChange(!1);
338
+ const c = (f) => {
339
+ r.value === f.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(u), u = window.setTimeout(() => {
340
+ !t.overlayHover && !t.triggerHover && e.onChange(!1);
341
341
  }, 10);
342
342
  };
343
- return A(() => {
344
- e.trigger === "click" ? (r.value.addEventListener("click", a), document.addEventListener("click", m)) : (r.value.addEventListener("mouseenter", a), r.value.addEventListener("mouseleave", d), n.value.addEventListener("mouseenter", c), n.value.addEventListener("mouseleave", d));
345
- }), ye(() => {
346
- e.trigger === "click" ? (r.value.removeEventListener("click", a), document.removeEventListener("click", m)) : (r.value.removeEventListener("mouseenter", a), r.value.removeEventListener("mouseleave", d), n.value.removeEventListener("mouseenter", c), n.value.removeEventListener("mouseleave", d));
343
+ return H(() => {
344
+ e.trigger === "click" ? (r.value.addEventListener("click", a), document.addEventListener("click", m)) : (r.value.addEventListener("mouseenter", a), r.value.addEventListener("mouseleave", c), n.value.addEventListener("mouseenter", d), n.value.addEventListener("mouseleave", c));
345
+ }), Se(() => {
346
+ e.trigger === "click" ? (r.value.removeEventListener("click", a), document.removeEventListener("click", m)) : (r.value.removeEventListener("mouseenter", a), r.value.removeEventListener("mouseleave", c), n.value.removeEventListener("mouseenter", d), n.value.removeEventListener("mouseleave", c));
347
347
  }), () => {
348
- const f = _({
349
- ctx: t
350
- }), h = _({
348
+ const f = W({
349
+ ctx: l
350
+ }), h = W({
351
351
  props: e,
352
- ctx: t
353
- }, "overlay"), v = Et(f instanceof Array ? f[0] : f, {
352
+ ctx: l
353
+ }, "overlay"), p = St(f instanceof Array ? f[0] : f, {
354
354
  ref: r
355
- }), b = i("div", {
356
- class: [`${s}-dropdown`, l.overlayClass],
357
- style: l.overlayStyle,
355
+ }), v = i("div", {
356
+ class: [`${s}-dropdown`, t.overlayClass],
357
+ style: t.overlayStyle,
358
358
  ref: n
359
359
  }, [i("div", {
360
360
  class: `${s}-dropdown-overlay`
361
361
  }, [h instanceof Array ? h[0] : h])]);
362
- return [v, b];
362
+ return [p, v];
363
363
  };
364
364
  }
365
365
  });
366
- class tl {
366
+ class Qt {
367
367
  constructor() {
368
368
  // 事件池
369
- U(this, "pools", {});
369
+ K(this, "pools", {});
370
370
  }
371
371
  // 移除事件监听
372
- remove(t, o, l) {
373
- const n = this.pools[t] && this.pools[t][o];
374
- n && (this.pools[t][o] = n.filter((a) => a !== l));
372
+ remove(l, o, t) {
373
+ const n = this.pools[l] && this.pools[l][o];
374
+ n && (this.pools[l][o] = n.filter((a) => a !== t));
375
375
  }
376
376
  // 清空全部事件,由于单一实例,多次注册会被共享内容
377
- clear(t) {
378
- this.pools[t] = {};
377
+ clear(l) {
378
+ this.pools[l] = {};
379
379
  }
380
380
  // 注册事件监听
381
- on(t, o) {
382
- return this.pools[t] || (this.pools[t] = {}), this.pools[t][o.name] || (this.pools[t][o.name] = []), this.pools[t][o.name].push(o.callback), this.pools[t][o.name].includes(o.callback);
381
+ on(l, o) {
382
+ return this.pools[l] || (this.pools[l] = {}), this.pools[l][o.name] || (this.pools[l][o.name] = []), this.pools[l][o.name].push(o.callback), this.pools[l][o.name].includes(o.callback);
383
383
  }
384
384
  // 触发事件
385
- emit(t, o, ...l) {
386
- this.pools[t] || (this.pools[t] = {});
387
- const n = this.pools[t][o];
385
+ emit(l, o, ...t) {
386
+ this.pools[l] || (this.pools[l] = {});
387
+ const n = this.pools[l][o];
388
388
  n && n.forEach((a) => {
389
389
  try {
390
- a(...l);
391
- } catch (c) {
392
- console.error(`${o} monitor event exception!`, c);
390
+ a(...t);
391
+ } catch (d) {
392
+ console.error(`${o} monitor event exception!`, d);
393
393
  }
394
394
  });
395
395
  }
396
396
  }
397
- const C = new tl(), ll = (e, t = {
397
+ const k = new Qt(), el = (e, l = {
398
398
  newWindow: !0,
399
399
  nofollow: !0
400
400
  }) => {
401
401
  e || console.error("error link!");
402
402
  const o = document.createElement("a");
403
- o.href = e, o.style.display = "none", t.newWindow && (o.target = "_blank"), t.nofollow && (o.rel = "noopener noreferrer"), document.body.appendChild(o), o.click(), document.body.removeChild(o);
404
- }, ol = (e, t = "image.png") => {
405
- const o = e.split(","), l = o[0].match(/:(.*?);/);
406
- if (l) {
407
- const r = l[1], n = atob(o[1]);
403
+ o.href = e, o.style.display = "none", l.newWindow && (o.target = "_blank"), l.nofollow && (o.rel = "noopener noreferrer"), document.body.appendChild(o), o.click(), document.body.removeChild(o);
404
+ }, tl = (e, l = "image.png") => {
405
+ const o = e.split(","), t = o[0].match(/:(.*?);/);
406
+ if (t) {
407
+ const r = t[1], n = atob(o[1]);
408
408
  let a = n.length;
409
- const c = new Uint8Array(a);
409
+ const d = new Uint8Array(a);
410
410
  for (; a--; )
411
- c[a] = n.charCodeAt(a);
412
- return new File([c], t, { type: r });
411
+ d[a] = n.charCodeAt(a);
412
+ return new File([d], l, { type: r });
413
413
  }
414
414
  return null;
415
- }, nl = (e) => {
415
+ }, ll = (e) => {
416
416
  if (!e)
417
417
  return e;
418
- const t = e.split(`
418
+ const l = e.split(`
419
419
  `), o = ['<span rn-wrapper aria-hidden="true">'];
420
- return t.forEach(() => {
420
+ return l.forEach(() => {
421
421
  o.push("<span></span>");
422
422
  }), o.push("</span>"), `<span class="code-block">${e}</span>${o.join("")}`;
423
- }, ee = (e, t = 200) => {
423
+ }, ve = (e, l = 200) => {
424
424
  let o = 0;
425
- return (...l) => new Promise((r) => {
425
+ return (...t) => new Promise((r) => {
426
426
  o && (clearTimeout(o), r("cancel")), o = window.setTimeout(() => {
427
- e.apply(void 0, l), o = 0, r("done");
428
- }, t);
427
+ e.apply(void 0, t), o = 0, r("done");
428
+ }, l);
429
429
  });
430
- }, rl = (e, t = 200) => {
431
- let o = 0, l = null;
430
+ }, ol = (e, l = 200) => {
431
+ let o = 0, t = null;
432
432
  return (...r) => {
433
433
  const n = (a) => {
434
- o === 0 && (o = a), a - o >= t ? (e.apply(void 0, l), l = null, o = 0) : window.requestAnimationFrame(n);
434
+ o === 0 && (o = a), a - o >= l ? (e.apply(void 0, t), t = null, o = 0) : window.requestAnimationFrame(n);
435
435
  };
436
- l === null && window.requestAnimationFrame(n), l = r;
436
+ t === null && window.requestAnimationFrame(n), t = r;
437
437
  };
438
- }, il = (e, t) => {
438
+ }, nl = (e, l) => {
439
439
  const o = e == null ? void 0 : e.getBoundingClientRect();
440
- if (t === document.documentElement)
441
- return o.top - t.clientTop;
442
- const l = t == null ? void 0 : t.getBoundingClientRect();
443
- return o.top - l.top;
444
- }, al = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`, sl = {
440
+ if (l === document.documentElement)
441
+ return o.top - l.clientTop;
442
+ const t = l == null ? void 0 : l.getBoundingClientRect();
443
+ return o.top - t.top;
444
+ }, rl = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`, il = {
445
445
  noPrettier: {
446
446
  type: Boolean
447
447
  },
@@ -482,11 +482,11 @@ const C = new tl(), ll = (e, t = {
482
482
  noUploadImg: {
483
483
  type: Boolean
484
484
  }
485
- }, me = "onSave", we = "changeCatalogVisible", $t = "changeFullscreen", Qe = "pageFullscreenChanged", et = "fullscreenChanged", ve = "previewChanged", tt = "htmlPreviewChanged", lt = "catalogVisibleChanged", wt = "textareaFocus", ot = (e, t) => {
486
- const o = (l) => {
487
- const r = e.parentElement || document.body, n = r.offsetWidth, a = r.offsetHeight, { clientWidth: c } = document.documentElement, { clientHeight: m } = document.documentElement, u = l.offsetX, d = l.offsetY, f = (v) => {
488
- let b = v.x + document.body.scrollLeft - document.body.clientLeft - u, k = v.y + document.body.scrollTop - document.body.clientTop - d;
489
- b = b < 1 ? 1 : b < c - n - 1 ? b : c - n - 1, k = k < 1 ? 1 : k < m - a - 1 ? k : m - a - 1, t ? t(b, k) : (r.style.left = `${b}px`, r.style.top = `${k}px`);
485
+ }, pe = "onSave", Le = "changeCatalogVisible", yt = "changeFullscreen", Je = "pageFullscreenChanged", Ye = "fullscreenChanged", Ce = "previewChanged", Qe = "htmlPreviewChanged", et = "catalogVisibleChanged", Ct = "textareaFocus", tt = (e, l) => {
486
+ const o = (t) => {
487
+ const r = e.parentElement || document.body, n = r.offsetWidth, a = r.offsetHeight, { clientWidth: d } = document.documentElement, { clientHeight: m } = document.documentElement, u = t.offsetX, c = t.offsetY, f = (p) => {
488
+ let v = p.x + document.body.scrollLeft - document.body.clientLeft - u, b = p.y + document.body.scrollTop - document.body.clientTop - c;
489
+ v = v < 1 ? 1 : v < d - n - 1 ? v : d - n - 1, b = b < 1 ? 1 : b < m - a - 1 ? b : m - a - 1, l ? l(v, b) : (r.style.left = `${v}px`, r.style.top = `${b}px`);
490
490
  };
491
491
  document.addEventListener("mousemove", f);
492
492
  const h = () => {
@@ -497,21 +497,23 @@ const C = new tl(), ll = (e, t = {
497
497
  return e.addEventListener("mousedown", o), () => {
498
498
  e.removeEventListener("mousedown", o);
499
499
  };
500
- }, O = (e, t = "") => {
501
- const o = document.getElementById(e.id), l = (r) => {
502
- typeof e.onload == "function" && e.onload(r), e.removeEventListener("load", l);
500
+ }, V = (e, l = "") => {
501
+ const o = document.getElementById(e.id), t = e.onload;
502
+ e.onload = null;
503
+ const r = function(n) {
504
+ typeof t == "function" && t.bind(this)(n), e.removeEventListener("load", r);
503
505
  };
504
- o ? t !== "" && typeof e.onload == "function" && (Reflect.get(window, t) ? e.dispatchEvent(new Event("load")) : o.addEventListener("load", l)) : (e.addEventListener("load", l), document.head.appendChild(e));
505
- }, cl = ee((e, t, o) => {
506
- const l = document.getElementById(e);
507
- l && l.setAttribute(t, o);
508
- }, 10), dl = (e) => {
509
- var m, u, d, f;
510
- const t = x("editorId");
511
- let o = (u = (m = I.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : u.instance;
512
- const l = (f = (d = I.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : f.js, r = F(!1), n = (h) => {
506
+ o ? l !== "" && (o.addEventListener("load", r), Reflect.get(window, l) && o.dispatchEvent(new Event("load"))) : (e.addEventListener("load", r), document.head.appendChild(e));
507
+ }, al = ve((e, l, o) => {
508
+ const t = document.getElementById(e);
509
+ t && t.setAttribute(l, o);
510
+ }, 10), sl = (e) => {
511
+ var m, u, c, f;
512
+ const l = x("editorId");
513
+ let o = (u = (m = A.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : u.instance;
514
+ const t = (f = (c = A.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : f.js, r = B(!1), n = (h) => {
513
515
  if (!o) {
514
- C.emit(t, "errorCatcher", {
516
+ k.emit(l, "errorCatcher", {
515
517
  name: "fullscreen",
516
518
  message: "fullscreen is undefined"
517
519
  });
@@ -522,21 +524,21 @@ const C = new tl(), ll = (e, t = {
522
524
  o && o.isEnabled && o.on("change", () => {
523
525
  (r.value || e.setting.fullscreen) && (r.value = !1, e.updateSetting("fullscreen"));
524
526
  });
525
- }, c = () => {
527
+ }, d = () => {
526
528
  o = window.screenfull, a();
527
529
  };
528
- return A(() => {
530
+ return H(() => {
529
531
  if (a(), !o) {
530
532
  const h = document.createElement("script");
531
- h.src = l || Zt, h.onload = c, h.id = `${s}-screenfull`, O(h, "screenfull");
533
+ h.src = t || zt, h.onload = d, h.id = `${s}-screenfull`, V(h, "screenfull");
532
534
  }
533
- }), A(() => {
534
- C.on(t, {
535
- name: $t,
535
+ }), H(() => {
536
+ k.on(l, {
537
+ name: yt,
536
538
  callback: n
537
539
  });
538
540
  }), { fullscreenHandler: n };
539
- }, ul = {
541
+ }, cl = {
540
542
  tableShape: {
541
543
  type: Array,
542
544
  default: () => [6, 4]
@@ -546,37 +548,37 @@ const C = new tl(), ll = (e, t = {
546
548
  default: () => {
547
549
  }
548
550
  }
549
- }, ml = /* @__PURE__ */ M({
551
+ }, dl = /* @__PURE__ */ M({
550
552
  name: "TableShape",
551
- props: ul,
553
+ props: cl,
552
554
  setup(e) {
553
- const t = N({
555
+ const l = q({
554
556
  x: -1,
555
557
  y: -1
556
558
  });
557
559
  return () => i("div", {
558
560
  class: `${s}-table-shape`,
559
561
  onMouseleave: () => {
560
- t.x = -1, t.y = -1;
562
+ l.x = -1, l.y = -1;
561
563
  }
562
- }, [new Array(e.tableShape[1]).fill("").map((o, l) => i("div", {
564
+ }, [new Array(e.tableShape[1]).fill("").map((o, t) => i("div", {
563
565
  class: `${s}-table-shape-row`,
564
- key: `table-shape-row-${l}`
566
+ key: `table-shape-row-${t}`
565
567
  }, [new Array(e.tableShape[0]).fill("").map((r, n) => i("div", {
566
568
  class: `${s}-table-shape-col`,
567
569
  key: `table-shape-col-${n}`,
568
570
  onMouseenter: () => {
569
- t.x = l, t.y = n;
571
+ l.x = t, l.y = n;
570
572
  },
571
573
  onClick: () => {
572
- e.onSelected(t);
574
+ e.onSelected(l);
573
575
  }
574
576
  }, [i("div", {
575
- class: [`${s}-table-shape-col-default`, l <= t.x && n <= t.y && `${s}-table-shape-col-include`]
577
+ class: [`${s}-table-shape-col-default`, t <= l.x && n <= l.y && `${s}-table-shape-col-include`]
576
578
  }, null)]))]))]);
577
579
  }
578
580
  });
579
- const fl = {
581
+ const ul = {
580
582
  title: {
581
583
  type: String,
582
584
  default: ""
@@ -614,13 +616,13 @@ const fl = {
614
616
  class: {
615
617
  type: String
616
618
  }
617
- }, Te = /* @__PURE__ */ M({
618
- props: fl,
619
- setup(e, t) {
620
- const o = F(e.visible), l = F([`${s}-modal`]), r = F(), n = F();
619
+ }, Ae = /* @__PURE__ */ M({
620
+ props: ul,
621
+ setup(e, l) {
622
+ const o = B(e.visible), t = B([`${s}-modal`]), r = B(), n = B();
621
623
  let a = () => {
622
624
  };
623
- const c = N({
625
+ const d = q({
624
626
  initPos: {
625
627
  left: "0px",
626
628
  top: "0px"
@@ -629,38 +631,38 @@ const fl = {
629
631
  left: "0px",
630
632
  top: "0px"
631
633
  }
632
- }), m = D(() => e.isFullscreen ? {
634
+ }), m = U(() => e.isFullscreen ? {
633
635
  width: "100%",
634
636
  height: "100%"
635
637
  } : {
636
638
  width: e.width,
637
639
  height: e.height
638
640
  });
639
- return A(() => {
640
- a = ot(n.value, (u, d) => {
641
- c.initPos.left = u + "px", c.initPos.top = d + "px";
641
+ return H(() => {
642
+ a = tt(n.value, (u, c) => {
643
+ d.initPos.left = u + "px", d.initPos.top = c + "px";
642
644
  });
643
- }), ye(() => {
645
+ }), Se(() => {
644
646
  a();
645
- }), T(() => e.isFullscreen, (u) => {
646
- u ? a() : a = ot(n.value, (d, f) => {
647
- c.initPos.left = d + "px", c.initPos.top = f + "px";
647
+ }), S(() => e.isFullscreen, (u) => {
648
+ u ? a() : a = tt(n.value, (c, f) => {
649
+ d.initPos.left = c + "px", d.initPos.top = f + "px";
648
650
  });
649
- }), T(() => e.visible, (u) => {
650
- u ? (l.value.push("zoom-in"), o.value = u, z(() => {
651
- const d = r.value.offsetWidth / 2, f = r.value.offsetHeight / 2, h = document.documentElement.clientWidth / 2, v = document.documentElement.clientHeight / 2;
652
- c.initPos.left = h - d + "px", c.initPos.top = v - f + "px";
651
+ }), S(() => e.visible, (u) => {
652
+ u ? (t.value.push("zoom-in"), o.value = u, Y(() => {
653
+ const c = r.value.offsetWidth / 2, f = r.value.offsetHeight / 2, h = document.documentElement.clientWidth / 2, p = document.documentElement.clientHeight / 2;
654
+ d.initPos.left = h - c + "px", d.initPos.top = p - f + "px";
653
655
  }), setTimeout(() => {
654
- l.value = l.value.filter((d) => d !== "zoom-in");
655
- }, 140)) : (l.value.push("zoom-out"), setTimeout(() => {
656
- l.value = l.value.filter((d) => d !== "zoom-out"), o.value = u;
656
+ t.value = t.value.filter((c) => c !== "zoom-in");
657
+ }, 140)) : (t.value.push("zoom-out"), setTimeout(() => {
658
+ t.value = t.value.filter((c) => c !== "zoom-out"), o.value = u;
657
659
  }, 130));
658
660
  }), () => {
659
- const u = _({
660
- ctx: t
661
- }), d = _({
661
+ const u = W({
662
+ ctx: l
663
+ }), c = W({
662
664
  props: e,
663
- ctx: t
665
+ ctx: l
664
666
  }, "title");
665
667
  return i("div", {
666
668
  class: [e.class],
@@ -671,23 +673,23 @@ const fl = {
671
673
  class: `${s}-modal-mask`,
672
674
  onClick: e.onClose
673
675
  }, null), i("div", {
674
- class: l.value,
676
+ class: t.value,
675
677
  style: {
676
- ...c.initPos,
678
+ ...d.initPos,
677
679
  ...m.value
678
680
  },
679
681
  ref: r
680
682
  }, [i("div", {
681
683
  class: `${s}-modal-header`,
682
684
  ref: n
683
- }, [d || ""]), i("div", {
685
+ }, [c || ""]), i("div", {
684
686
  class: `${s}-modal-body`
685
687
  }, [u]), i("div", {
686
688
  class: `${s}-modal-func`
687
689
  }, [e.showAdjust && i("div", {
688
690
  class: `${s}-modal-adjust`,
689
691
  onClick: (f) => {
690
- f.stopPropagation(), e.isFullscreen ? c.initPos = c.historyPos : (c.historyPos = c.initPos, c.initPos = {
692
+ f.stopPropagation(), e.isFullscreen ? d.initPos = d.historyPos : (d.historyPos = d.initPos, d.initPos = {
691
693
  left: "0",
692
694
  top: "0"
693
695
  }), e.onAdjust(!e.isFullscreen);
@@ -710,7 +712,7 @@ const fl = {
710
712
  }, null)])])])])]);
711
713
  };
712
714
  }
713
- }), gl = {
715
+ }), ml = {
714
716
  type: {
715
717
  type: String,
716
718
  default: "link"
@@ -729,47 +731,47 @@ const fl = {
729
731
  default: () => {
730
732
  }
731
733
  }
732
- }, hl = /* @__PURE__ */ M({
733
- props: gl,
734
+ }, fl = /* @__PURE__ */ M({
735
+ props: ml,
734
736
  setup(e) {
735
- const t = x("usedLanguageText"), o = x("editorId"), l = D(() => {
737
+ const l = x("usedLanguageText"), o = x("editorId"), t = U(() => {
736
738
  var n, a;
737
739
  switch (e.type) {
738
740
  case "link":
739
- return (n = t.value.linkModalTips) == null ? void 0 : n.linkTitle;
741
+ return (n = l.value.linkModalTips) == null ? void 0 : n.linkTitle;
740
742
  case "image":
741
- return (a = t.value.linkModalTips) == null ? void 0 : a.imageTitle;
743
+ return (a = l.value.linkModalTips) == null ? void 0 : a.imageTitle;
742
744
  default:
743
745
  return "";
744
746
  }
745
- }), r = N({
747
+ }), r = q({
746
748
  desc: "",
747
749
  url: ""
748
750
  });
749
- return T(() => e.visible, (n) => {
751
+ return S(() => e.visible, (n) => {
750
752
  n || setTimeout(() => {
751
753
  r.desc = "", r.url = "";
752
754
  }, 200);
753
- }), () => i(Te, {
754
- title: l.value,
755
+ }), () => i(Ae, {
756
+ title: t.value,
755
757
  visible: e.visible,
756
758
  onClose: e.onCancel
757
759
  }, {
758
760
  default: () => {
759
- var n, a, c, m, u;
761
+ var n, a, d, m, u;
760
762
  return [i("div", {
761
763
  class: `${s}-form-item`
762
764
  }, [i("label", {
763
765
  class: `${s}-label`,
764
766
  for: `link-desc-${o}`
765
- }, [(n = t.value.linkModalTips) == null ? void 0 : n.descLabel]), i("input", {
766
- placeholder: (a = t.value.linkModalTips) == null ? void 0 : a.descLabelPlaceHolder,
767
+ }, [(n = l.value.linkModalTips) == null ? void 0 : n.descLabel]), i("input", {
768
+ placeholder: (a = l.value.linkModalTips) == null ? void 0 : a.descLabelPlaceHolder,
767
769
  class: `${s}-input`,
768
770
  id: `link-desc-${o}`,
769
771
  type: "text",
770
772
  value: r.desc,
771
- onChange: (d) => {
772
- r.desc = d.target.value;
773
+ onChange: (c) => {
774
+ r.desc = c.target.value;
773
775
  },
774
776
  autocomplete: "off"
775
777
  }, null)]), i("div", {
@@ -777,14 +779,14 @@ const fl = {
777
779
  }, [i("label", {
778
780
  class: `${s}-label`,
779
781
  for: `link-url-${o}`
780
- }, [(c = t.value.linkModalTips) == null ? void 0 : c.urlLabel]), i("input", {
781
- placeholder: (m = t.value.linkModalTips) == null ? void 0 : m.urlLabelPlaceHolder,
782
+ }, [(d = l.value.linkModalTips) == null ? void 0 : d.urlLabel]), i("input", {
783
+ placeholder: (m = l.value.linkModalTips) == null ? void 0 : m.urlLabelPlaceHolder,
782
784
  class: `${s}-input`,
783
785
  id: `link-url-${o}`,
784
786
  type: "text",
785
787
  value: r.url,
786
- onChange: (d) => {
787
- r.url = d.target.value;
788
+ onChange: (c) => {
789
+ r.url = c.target.value;
788
790
  },
789
791
  autocomplete: "off"
790
792
  }, null)]), i("div", {
@@ -795,12 +797,12 @@ const fl = {
795
797
  onClick: () => {
796
798
  e.onOk(r), r.desc = "", r.url = "";
797
799
  }
798
- }, [(u = t.value.linkModalTips) == null ? void 0 : u.buttonOK])])];
800
+ }, [(u = l.value.linkModalTips) == null ? void 0 : u.buttonOK])])];
799
801
  }
800
802
  });
801
803
  }
802
804
  });
803
- const vl = {
805
+ const gl = {
804
806
  visible: {
805
807
  type: Boolean,
806
808
  default: !1
@@ -815,13 +817,13 @@ const vl = {
815
817
  default: () => {
816
818
  }
817
819
  }
818
- }, pl = /* @__PURE__ */ M({
819
- props: vl,
820
+ }, hl = /* @__PURE__ */ M({
821
+ props: gl,
820
822
  setup(e) {
821
- var d, f;
822
- const t = x("usedLanguageText"), o = x("editorId");
823
- let l = (f = (d = I == null ? void 0 : I.editorExtensions) == null ? void 0 : d.cropper) == null ? void 0 : f.instance;
824
- const r = F(), n = F(), a = F(), c = N({
823
+ var c, f;
824
+ const l = x("usedLanguageText"), o = x("editorId");
825
+ let t = (f = (c = A == null ? void 0 : A.editorExtensions) == null ? void 0 : c.cropper) == null ? void 0 : f.instance;
826
+ const r = B(), n = B(), a = B(), d = q({
825
827
  cropperInited: !1,
826
828
  imgSelected: !1,
827
829
  imgSrc: "",
@@ -829,34 +831,34 @@ const vl = {
829
831
  isFullscreen: !1
830
832
  });
831
833
  let m = null;
832
- T(() => e.visible, () => {
833
- e.visible && !c.cropperInited && (l = l || window.Cropper, r.value.onchange = () => {
834
- if (!l) {
835
- C.emit(o, "errorCatcher", {
834
+ S(() => e.visible, () => {
835
+ e.visible && !d.cropperInited && (t = t || window.Cropper, r.value.onchange = () => {
836
+ if (!t) {
837
+ k.emit(o, "errorCatcher", {
836
838
  name: "Cropper",
837
839
  message: "Cropper is undefined"
838
840
  });
839
841
  return;
840
842
  }
841
843
  const h = r.value.files || [];
842
- if (c.imgSelected = !0, (h == null ? void 0 : h.length) > 0) {
843
- const v = new FileReader();
844
- v.onload = (b) => {
845
- c.imgSrc = b.target.result, z(() => {
846
- m = new l(n.value, {
844
+ if (d.imgSelected = !0, (h == null ? void 0 : h.length) > 0) {
845
+ const p = new FileReader();
846
+ p.onload = (v) => {
847
+ d.imgSrc = v.target.result, Y(() => {
848
+ m = new t(n.value, {
847
849
  viewMode: 2,
848
850
  preview: `.${s}-clip-preview-target`
849
851
  // aspectRatio: 16 / 9,
850
852
  });
851
853
  });
852
- }, v.readAsDataURL(h[0]);
854
+ }, p.readAsDataURL(h[0]);
853
855
  }
854
856
  });
855
- }), T(() => [c.imgSelected], () => {
857
+ }), S(() => [d.imgSelected], () => {
856
858
  a.value.style = "";
857
- }), T(() => c.isFullscreen, () => {
858
- z(() => {
859
- m == null || m.destroy(), a.value.style = "", n.value && (m = new l(n.value, {
859
+ }), S(() => d.isFullscreen, () => {
860
+ Y(() => {
861
+ m == null || m.destroy(), a.value.style = "", n.value && (m = new t(n.value, {
860
862
  viewMode: 2,
861
863
  preview: `.${s}-clip-preview-target`
862
864
  // aspectRatio: 16 / 9,
@@ -864,33 +866,33 @@ const vl = {
864
866
  });
865
867
  });
866
868
  const u = () => {
867
- m.clear(), m.destroy(), m = null, r.value.value = "", c.imgSelected = !1;
869
+ m.clear(), m.destroy(), m = null, r.value.value = "", d.imgSelected = !1;
868
870
  };
869
871
  return () => {
870
872
  var h;
871
- return i(Te, {
873
+ return i(Ae, {
872
874
  class: `${s}-modal-clip`,
873
- title: (h = t.value.clipModalTips) == null ? void 0 : h.title,
875
+ title: (h = l.value.clipModalTips) == null ? void 0 : h.title,
874
876
  visible: e.visible,
875
877
  onClose: e.onCancel,
876
878
  showAdjust: !0,
877
- isFullscreen: c.isFullscreen,
878
- onAdjust: (v) => {
879
- c.isFullscreen = v;
879
+ isFullscreen: d.isFullscreen,
880
+ onAdjust: (p) => {
881
+ d.isFullscreen = p;
880
882
  },
881
883
  width: "668px",
882
884
  height: "421px"
883
885
  }, {
884
886
  default: () => {
885
- var v, b;
887
+ var p, v;
886
888
  return [i("div", {
887
889
  class: `${s}-form-item ${s}-clip`
888
890
  }, [i("div", {
889
891
  class: `${s}-clip-main`
890
- }, [c.imgSelected ? i("div", {
892
+ }, [d.imgSelected ? i("div", {
891
893
  class: `${s}-clip-cropper`
892
894
  }, [i("img", {
893
- src: c.imgSrc,
895
+ src: d.imgSrc,
894
896
  ref: n,
895
897
  style: {
896
898
  display: "none"
@@ -926,11 +928,11 @@ const vl = {
926
928
  type: "button",
927
929
  onClick: () => {
928
930
  if (m) {
929
- const k = m.getCroppedCanvas();
930
- C.emit(o, "uploadImage", [ol(k.toDataURL("image/png"))], e.onOk), u();
931
+ const b = m.getCroppedCanvas();
932
+ k.emit(o, "uploadImage", [tl(b.toDataURL("image/png"))], e.onOk), u();
931
933
  }
932
934
  }
933
- }, [((v = t.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((b = t.value.linkModalTips) == null ? void 0 : b.buttonOK)])]), i("input", {
935
+ }, [((p = l.value.clipModalTips) == null ? void 0 : p.buttonUpload) || ((v = l.value.linkModalTips) == null ? void 0 : v.buttonOK)])]), i("input", {
934
936
  ref: r,
935
937
  accept: "image/*",
936
938
  type: "file",
@@ -943,7 +945,7 @@ const vl = {
943
945
  });
944
946
  };
945
947
  }
946
- }), bl = {
948
+ }), vl = {
947
949
  type: {
948
950
  type: String,
949
951
  default: "link"
@@ -966,27 +968,27 @@ const vl = {
966
968
  default: () => {
967
969
  }
968
970
  }
969
- }, kl = /* @__PURE__ */ M({
970
- props: bl,
971
+ }, pl = /* @__PURE__ */ M({
972
+ props: vl,
971
973
  setup(e) {
972
- return () => i(Ce, null, [i(hl, {
974
+ return () => i(xe, null, [i(fl, {
973
975
  type: e.type,
974
976
  visible: e.linkVisible,
975
977
  onOk: e.onOk,
976
978
  onCancel: e.onCancel
977
- }, null), i(pl, {
979
+ }, null), i(hl, {
978
980
  visible: e.clipVisible,
979
981
  onOk: e.onOk,
980
982
  onCancel: e.onCancel
981
983
  }, null)]);
982
984
  }
983
- }), yl = /* @__PURE__ */ M({
985
+ }), bl = /* @__PURE__ */ M({
984
986
  name: "MDEditorToolbar",
985
- props: sl,
987
+ props: il,
986
988
  setup(e) {
987
- const t = x("editorId"), o = x("usedLanguageText"), {
988
- fullscreenHandler: l
989
- } = dl(e), r = `${t}-toolbar-wrapper`, n = N({
989
+ const l = x("editorId"), o = x("usedLanguageText"), {
990
+ fullscreenHandler: t
991
+ } = sl(e), r = `${l}-toolbar-wrapper`, n = q({
990
992
  title: !1,
991
993
  catalog: !1,
992
994
  // 图片上传下拉
@@ -996,40 +998,40 @@ const vl = {
996
998
  // mermaid
997
999
  mermaid: !1,
998
1000
  katex: !1
999
- }), a = (v, b) => {
1000
- C.emit(t, "replace", v, b);
1001
- }, c = N({
1001
+ }), a = (p, v) => {
1002
+ k.emit(l, "replace", p, v);
1003
+ }, d = q({
1002
1004
  type: "link",
1003
1005
  linkVisible: !1,
1004
1006
  clipVisible: !1
1005
- }), m = F();
1006
- A(() => {
1007
- C.on(t, {
1007
+ }), m = B();
1008
+ H(() => {
1009
+ k.on(l, {
1008
1010
  name: "openModals",
1009
- callback(v) {
1010
- c.type = v, c.linkVisible = !0;
1011
+ callback(p) {
1012
+ d.type = p, d.linkVisible = !0;
1011
1013
  }
1012
1014
  });
1013
1015
  });
1014
- const u = D(() => {
1015
- const v = e.toolbars.filter((y) => !e.toolbarsExclude.includes(y)), b = v.indexOf("="), k = b === -1 ? v : v.slice(0, b + 1), p = b === -1 ? [] : v.slice(b, Number.MAX_SAFE_INTEGER);
1016
- return [k, p];
1017
- }), d = F(), f = () => {
1018
- C.emit(t, "uploadImage", Array.from(d.value.files || [])), d.value.value = "";
1016
+ const u = U(() => {
1017
+ const p = e.toolbars.filter((C) => !e.toolbarsExclude.includes(C)), v = p.indexOf("="), b = v === -1 ? p : p.slice(0, v + 1), y = v === -1 ? [] : p.slice(v, Number.MAX_SAFE_INTEGER);
1018
+ return [b, y];
1019
+ }), c = B(), f = () => {
1020
+ k.emit(l, "uploadImage", Array.from(c.value.files || [])), c.value.value = "";
1019
1021
  };
1020
- A(() => {
1021
- d.value.addEventListener("change", f);
1022
+ H(() => {
1023
+ c.value.addEventListener("change", f);
1022
1024
  });
1023
- const h = (v) => {
1024
- var b, k, p, y, $, w, L, S, j, B, q, te, Z, K, P, X, R, V, le, ie, Se, xe, Ee, Le, He, Ie, Ae, Fe, Me, Re, je, Be, Pe, Oe, De, Ne, _e, Ve, Ue, qe, We, Ge, ze;
1025
- if (yt.includes(v))
1026
- switch (v) {
1025
+ const h = (p) => {
1026
+ var v, b, y, C, $, T, I, w, F, j, R, P, _, N, D, Q, z, ue, re, ee, X, ie, te, O, G, ae, me, Ie, He, Fe, Me, Be, Re, je, Pe, De, Oe, _e, Ne, Ve, Ue, qe, We;
1027
+ if (bt.includes(p))
1028
+ switch (p) {
1027
1029
  case "-":
1028
- return i(Qt, null, null);
1030
+ return i(Jt, null, null);
1029
1031
  case "bold":
1030
1032
  return i("div", {
1031
1033
  class: `${s}-toolbar-item`,
1032
- title: (b = o.value.toolbarTips) == null ? void 0 : b.bold,
1034
+ title: (v = o.value.toolbarTips) == null ? void 0 : v.bold,
1033
1035
  onClick: () => {
1034
1036
  a("bold");
1035
1037
  }
@@ -1042,7 +1044,7 @@ const vl = {
1042
1044
  case "underline":
1043
1045
  return i("div", {
1044
1046
  class: `${s}-toolbar-item`,
1045
- title: (k = o.value.toolbarTips) == null ? void 0 : k.underline,
1047
+ title: (b = o.value.toolbarTips) == null ? void 0 : b.underline,
1046
1048
  onClick: () => {
1047
1049
  a("underline");
1048
1050
  }
@@ -1055,7 +1057,7 @@ const vl = {
1055
1057
  case "italic":
1056
1058
  return i("div", {
1057
1059
  class: `${s}-toolbar-item`,
1058
- title: (p = o.value.toolbarTips) == null ? void 0 : p.italic,
1060
+ title: (y = o.value.toolbarTips) == null ? void 0 : y.italic,
1059
1061
  onClick: () => {
1060
1062
  a("italic");
1061
1063
  }
@@ -1068,7 +1070,7 @@ const vl = {
1068
1070
  case "strikeThrough":
1069
1071
  return i("div", {
1070
1072
  class: `${s}-toolbar-item`,
1071
- title: (y = o.value.toolbarTips) == null ? void 0 : y.strikeThrough,
1073
+ title: (C = o.value.toolbarTips) == null ? void 0 : C.strikeThrough,
1072
1074
  onClick: () => {
1073
1075
  a("strikeThrough");
1074
1076
  }
@@ -1079,7 +1081,7 @@ const vl = {
1079
1081
  "xlink:href": "#md-editor-icon-strike-through"
1080
1082
  }, null)])]);
1081
1083
  case "title":
1082
- return i(Y, {
1084
+ return i(oe, {
1083
1085
  relative: `#${r}`,
1084
1086
  visible: n.title,
1085
1087
  onChange: (E) => {
@@ -1100,27 +1102,27 @@ const vl = {
1100
1102
  onClick: () => {
1101
1103
  a("h2");
1102
1104
  }
1103
- }, [(w = o.value.titleItem) == null ? void 0 : w.h2]), i("li", {
1105
+ }, [(T = o.value.titleItem) == null ? void 0 : T.h2]), i("li", {
1104
1106
  class: `${s}-menu-item`,
1105
1107
  onClick: () => {
1106
1108
  a("h3");
1107
1109
  }
1108
- }, [(L = o.value.titleItem) == null ? void 0 : L.h3]), i("li", {
1110
+ }, [(I = o.value.titleItem) == null ? void 0 : I.h3]), i("li", {
1109
1111
  class: `${s}-menu-item`,
1110
1112
  onClick: () => {
1111
1113
  a("h4");
1112
1114
  }
1113
- }, [(S = o.value.titleItem) == null ? void 0 : S.h4]), i("li", {
1115
+ }, [(w = o.value.titleItem) == null ? void 0 : w.h4]), i("li", {
1114
1116
  class: `${s}-menu-item`,
1115
1117
  onClick: () => {
1116
1118
  a("h5");
1117
1119
  }
1118
- }, [(j = o.value.titleItem) == null ? void 0 : j.h5]), i("li", {
1120
+ }, [(F = o.value.titleItem) == null ? void 0 : F.h5]), i("li", {
1119
1121
  class: `${s}-menu-item`,
1120
1122
  onClick: () => {
1121
1123
  a("h6");
1122
1124
  }
1123
- }, [(B = o.value.titleItem) == null ? void 0 : B.h6])])
1125
+ }, [(j = o.value.titleItem) == null ? void 0 : j.h6])])
1124
1126
  }, {
1125
1127
  default: () => {
1126
1128
  var E;
@@ -1138,7 +1140,7 @@ const vl = {
1138
1140
  case "sub":
1139
1141
  return i("div", {
1140
1142
  class: `${s}-toolbar-item`,
1141
- title: (q = o.value.toolbarTips) == null ? void 0 : q.sub,
1143
+ title: (R = o.value.toolbarTips) == null ? void 0 : R.sub,
1142
1144
  onClick: () => {
1143
1145
  a("sub");
1144
1146
  }
@@ -1151,7 +1153,7 @@ const vl = {
1151
1153
  case "sup":
1152
1154
  return i("div", {
1153
1155
  class: `${s}-toolbar-item`,
1154
- title: (te = o.value.toolbarTips) == null ? void 0 : te.sup,
1156
+ title: (P = o.value.toolbarTips) == null ? void 0 : P.sup,
1155
1157
  onClick: () => {
1156
1158
  a("sup");
1157
1159
  }
@@ -1164,7 +1166,7 @@ const vl = {
1164
1166
  case "quote":
1165
1167
  return i("div", {
1166
1168
  class: `${s}-toolbar-item`,
1167
- title: (Z = o.value.toolbarTips) == null ? void 0 : Z.quote,
1169
+ title: (_ = o.value.toolbarTips) == null ? void 0 : _.quote,
1168
1170
  onClick: () => {
1169
1171
  a("quote");
1170
1172
  }
@@ -1177,7 +1179,7 @@ const vl = {
1177
1179
  case "unorderedList":
1178
1180
  return i("div", {
1179
1181
  class: `${s}-toolbar-item`,
1180
- title: (K = o.value.toolbarTips) == null ? void 0 : K.unorderedList,
1182
+ title: (N = o.value.toolbarTips) == null ? void 0 : N.unorderedList,
1181
1183
  onClick: () => {
1182
1184
  a("unorderedList");
1183
1185
  }
@@ -1190,7 +1192,7 @@ const vl = {
1190
1192
  case "orderedList":
1191
1193
  return i("div", {
1192
1194
  class: `${s}-toolbar-item`,
1193
- title: (P = o.value.toolbarTips) == null ? void 0 : P.orderedList,
1195
+ title: (D = o.value.toolbarTips) == null ? void 0 : D.orderedList,
1194
1196
  onClick: () => {
1195
1197
  a("orderedList");
1196
1198
  }
@@ -1203,7 +1205,7 @@ const vl = {
1203
1205
  case "task":
1204
1206
  return i("div", {
1205
1207
  class: `${s}-toolbar-item`,
1206
- title: (X = o.value.toolbarTips) == null ? void 0 : X.task,
1208
+ title: (Q = o.value.toolbarTips) == null ? void 0 : Q.task,
1207
1209
  onClick: () => {
1208
1210
  a("task");
1209
1211
  }
@@ -1216,7 +1218,7 @@ const vl = {
1216
1218
  case "codeRow":
1217
1219
  return i("div", {
1218
1220
  class: `${s}-toolbar-item`,
1219
- title: (R = o.value.toolbarTips) == null ? void 0 : R.codeRow,
1221
+ title: (z = o.value.toolbarTips) == null ? void 0 : z.codeRow,
1220
1222
  onClick: () => {
1221
1223
  a("codeRow");
1222
1224
  }
@@ -1229,7 +1231,7 @@ const vl = {
1229
1231
  case "code":
1230
1232
  return i("div", {
1231
1233
  class: `${s}-toolbar-item`,
1232
- title: (V = o.value.toolbarTips) == null ? void 0 : V.code,
1234
+ title: (ue = o.value.toolbarTips) == null ? void 0 : ue.code,
1233
1235
  onClick: () => {
1234
1236
  a("code");
1235
1237
  }
@@ -1242,9 +1244,9 @@ const vl = {
1242
1244
  case "link":
1243
1245
  return i("div", {
1244
1246
  class: `${s}-toolbar-item`,
1245
- title: (le = o.value.toolbarTips) == null ? void 0 : le.link,
1247
+ title: (re = o.value.toolbarTips) == null ? void 0 : re.link,
1246
1248
  onClick: () => {
1247
- c.type = "link", c.linkVisible = !0;
1249
+ d.type = "link", d.linkVisible = !0;
1248
1250
  }
1249
1251
  }, [i("svg", {
1250
1252
  class: `${s}-icon`,
@@ -1255,16 +1257,16 @@ const vl = {
1255
1257
  case "image":
1256
1258
  return e.noUploadImg ? i("div", {
1257
1259
  class: `${s}-toolbar-item`,
1258
- title: (ie = o.value.toolbarTips) == null ? void 0 : ie.image,
1260
+ title: (ee = o.value.toolbarTips) == null ? void 0 : ee.image,
1259
1261
  onClick: () => {
1260
- c.type = "image", c.linkVisible = !0;
1262
+ d.type = "image", d.linkVisible = !0;
1261
1263
  }
1262
1264
  }, [i("svg", {
1263
1265
  class: `${s}-icon`,
1264
1266
  "aria-hidden": "true"
1265
1267
  }, [i("use", {
1266
1268
  "xlink:href": "#md-editor-icon-image"
1267
- }, null)])]) : i(Y, {
1269
+ }, null)])]) : i(oe, {
1268
1270
  relative: `#${r}`,
1269
1271
  visible: n.image,
1270
1272
  onChange: (E) => {
@@ -1278,19 +1280,19 @@ const vl = {
1278
1280
  }, [i("li", {
1279
1281
  class: `${s}-menu-item`,
1280
1282
  onClick: () => {
1281
- c.type = "image", c.linkVisible = !0;
1283
+ d.type = "image", d.linkVisible = !0;
1282
1284
  }
1283
- }, [(Se = o.value.imgTitleItem) == null ? void 0 : Se.link]), i("li", {
1285
+ }, [(X = o.value.imgTitleItem) == null ? void 0 : X.link]), i("li", {
1284
1286
  class: `${s}-menu-item`,
1285
1287
  onClick: () => {
1286
- d.value.click();
1288
+ c.value.click();
1287
1289
  }
1288
- }, [(xe = o.value.imgTitleItem) == null ? void 0 : xe.upload]), i("li", {
1290
+ }, [(ie = o.value.imgTitleItem) == null ? void 0 : ie.upload]), i("li", {
1289
1291
  class: `${s}-menu-item`,
1290
1292
  onClick: () => {
1291
- c.clipVisible = !0;
1293
+ d.clipVisible = !0;
1292
1294
  }
1293
- }, [(Ee = o.value.imgTitleItem) == null ? void 0 : Ee.clip2upload])])
1295
+ }, [(te = o.value.imgTitleItem) == null ? void 0 : te.clip2upload])])
1294
1296
  }, {
1295
1297
  default: () => {
1296
1298
  var E;
@@ -1306,14 +1308,14 @@ const vl = {
1306
1308
  }
1307
1309
  });
1308
1310
  case "table":
1309
- return i(Y, {
1311
+ return i(oe, {
1310
1312
  relative: `#${r}`,
1311
1313
  visible: n.table,
1312
1314
  onChange: (E) => {
1313
1315
  n.table = E;
1314
1316
  },
1315
1317
  key: "bar-table",
1316
- overlay: i(ml, {
1318
+ overlay: i(dl, {
1317
1319
  tableShape: e.tableShape,
1318
1320
  onSelected: (E) => {
1319
1321
  a("table", {
@@ -1338,9 +1340,9 @@ const vl = {
1338
1340
  case "revoke":
1339
1341
  return i("div", {
1340
1342
  class: `${s}-toolbar-item`,
1341
- title: (Le = o.value.toolbarTips) == null ? void 0 : Le.revoke,
1343
+ title: (O = o.value.toolbarTips) == null ? void 0 : O.revoke,
1342
1344
  onClick: () => {
1343
- C.emit(t, "ctrlZ");
1345
+ k.emit(l, "ctrlZ");
1344
1346
  }
1345
1347
  }, [i("svg", {
1346
1348
  class: `${s}-icon`,
@@ -1351,9 +1353,9 @@ const vl = {
1351
1353
  case "next":
1352
1354
  return i("div", {
1353
1355
  class: `${s}-toolbar-item`,
1354
- title: (He = o.value.toolbarTips) == null ? void 0 : He.next,
1356
+ title: (G = o.value.toolbarTips) == null ? void 0 : G.next,
1355
1357
  onClick: () => {
1356
- C.emit(t, "ctrlShiftZ");
1358
+ k.emit(l, "ctrlShiftZ");
1357
1359
  }
1358
1360
  }, [i("svg", {
1359
1361
  class: `${s}-icon`,
@@ -1364,9 +1366,9 @@ const vl = {
1364
1366
  case "save":
1365
1367
  return i("div", {
1366
1368
  class: `${s}-toolbar-item`,
1367
- title: (Ie = o.value.toolbarTips) == null ? void 0 : Ie.save,
1369
+ title: (ae = o.value.toolbarTips) == null ? void 0 : ae.save,
1368
1370
  onClick: () => {
1369
- C.emit(t, me);
1371
+ k.emit(l, pe);
1370
1372
  }
1371
1373
  }, [i("svg", {
1372
1374
  class: `${s}-icon`,
@@ -1377,7 +1379,7 @@ const vl = {
1377
1379
  case "prettier":
1378
1380
  return e.noPrettier ? "" : i("div", {
1379
1381
  class: `${s}-toolbar-item`,
1380
- title: (Ae = o.value.toolbarTips) == null ? void 0 : Ae.prettier,
1382
+ title: (me = o.value.toolbarTips) == null ? void 0 : me.prettier,
1381
1383
  onClick: () => {
1382
1384
  a("prettier");
1383
1385
  }
@@ -1390,7 +1392,7 @@ const vl = {
1390
1392
  case "pageFullscreen":
1391
1393
  return !e.setting.fullscreen && i("div", {
1392
1394
  class: `${s}-toolbar-item`,
1393
- title: (Fe = o.value.toolbarTips) == null ? void 0 : Fe.pageFullscreen,
1395
+ title: (Ie = o.value.toolbarTips) == null ? void 0 : Ie.pageFullscreen,
1394
1396
  onClick: () => {
1395
1397
  e.updateSetting("pageFullscreen");
1396
1398
  }
@@ -1403,9 +1405,9 @@ const vl = {
1403
1405
  case "fullscreen":
1404
1406
  return i("div", {
1405
1407
  class: `${s}-toolbar-item`,
1406
- title: (Me = o.value.toolbarTips) == null ? void 0 : Me.fullscreen,
1408
+ title: (He = o.value.toolbarTips) == null ? void 0 : He.fullscreen,
1407
1409
  onClick: () => {
1408
- l();
1410
+ t();
1409
1411
  }
1410
1412
  }, [i("svg", {
1411
1413
  class: `${s}-icon`,
@@ -1416,7 +1418,7 @@ const vl = {
1416
1418
  case "preview":
1417
1419
  return i("div", {
1418
1420
  class: `${s}-toolbar-item`,
1419
- title: (Re = o.value.toolbarTips) == null ? void 0 : Re.preview,
1421
+ title: (Fe = o.value.toolbarTips) == null ? void 0 : Fe.preview,
1420
1422
  onClick: () => {
1421
1423
  e.updateSetting("preview");
1422
1424
  }
@@ -1429,7 +1431,7 @@ const vl = {
1429
1431
  case "htmlPreview":
1430
1432
  return i("div", {
1431
1433
  class: `${s}-toolbar-item`,
1432
- title: (je = o.value.toolbarTips) == null ? void 0 : je.htmlPreview,
1434
+ title: (Me = o.value.toolbarTips) == null ? void 0 : Me.htmlPreview,
1433
1435
  onClick: () => {
1434
1436
  e.updateSetting("htmlPreview");
1435
1437
  }
@@ -1444,7 +1446,7 @@ const vl = {
1444
1446
  class: `${s}-toolbar-item`,
1445
1447
  title: (Be = o.value.toolbarTips) == null ? void 0 : Be.catalog,
1446
1448
  onClick: () => {
1447
- C.emit(t, we);
1449
+ k.emit(l, Le);
1448
1450
  },
1449
1451
  key: "bar-catalog"
1450
1452
  }, [i("svg", {
@@ -1456,8 +1458,8 @@ const vl = {
1456
1458
  case "github":
1457
1459
  return i("div", {
1458
1460
  class: `${s}-toolbar-item`,
1459
- title: (Pe = o.value.toolbarTips) == null ? void 0 : Pe.github,
1460
- onClick: () => ll("https://github.com/imzbf/md-editor-v3")
1461
+ title: (Re = o.value.toolbarTips) == null ? void 0 : Re.github,
1462
+ onClick: () => el("https://github.com/imzbf/md-editor-v3")
1461
1463
  }, [i("svg", {
1462
1464
  class: `${s}-icon`,
1463
1465
  "aria-hidden": "true"
@@ -1465,7 +1467,7 @@ const vl = {
1465
1467
  "xlink:href": "#md-editor-icon-github"
1466
1468
  }, null)])]);
1467
1469
  case "mermaid":
1468
- return i(Y, {
1470
+ return i(oe, {
1469
1471
  relative: `#${r}`,
1470
1472
  visible: n.mermaid,
1471
1473
  onChange: (E) => {
@@ -1481,42 +1483,42 @@ const vl = {
1481
1483
  onClick: () => {
1482
1484
  a("flow");
1483
1485
  }
1484
- }, [(Oe = o.value.mermaid) == null ? void 0 : Oe.flow]), i("li", {
1486
+ }, [(je = o.value.mermaid) == null ? void 0 : je.flow]), i("li", {
1485
1487
  class: `${s}-menu-item`,
1486
1488
  onClick: () => {
1487
1489
  a("sequence");
1488
1490
  }
1489
- }, [(De = o.value.mermaid) == null ? void 0 : De.sequence]), i("li", {
1491
+ }, [(Pe = o.value.mermaid) == null ? void 0 : Pe.sequence]), i("li", {
1490
1492
  class: `${s}-menu-item`,
1491
1493
  onClick: () => {
1492
1494
  a("gantt");
1493
1495
  }
1494
- }, [(Ne = o.value.mermaid) == null ? void 0 : Ne.gantt]), i("li", {
1496
+ }, [(De = o.value.mermaid) == null ? void 0 : De.gantt]), i("li", {
1495
1497
  class: `${s}-menu-item`,
1496
1498
  onClick: () => {
1497
1499
  a("class");
1498
1500
  }
1499
- }, [(_e = o.value.mermaid) == null ? void 0 : _e.class]), i("li", {
1501
+ }, [(Oe = o.value.mermaid) == null ? void 0 : Oe.class]), i("li", {
1500
1502
  class: `${s}-menu-item`,
1501
1503
  onClick: () => {
1502
1504
  a("state");
1503
1505
  }
1504
- }, [(Ve = o.value.mermaid) == null ? void 0 : Ve.state]), i("li", {
1506
+ }, [(_e = o.value.mermaid) == null ? void 0 : _e.state]), i("li", {
1505
1507
  class: `${s}-menu-item`,
1506
1508
  onClick: () => {
1507
1509
  a("pie");
1508
1510
  }
1509
- }, [(Ue = o.value.mermaid) == null ? void 0 : Ue.pie]), i("li", {
1511
+ }, [(Ne = o.value.mermaid) == null ? void 0 : Ne.pie]), i("li", {
1510
1512
  class: `${s}-menu-item`,
1511
1513
  onClick: () => {
1512
1514
  a("relationship");
1513
1515
  }
1514
- }, [(qe = o.value.mermaid) == null ? void 0 : qe.relationship]), i("li", {
1516
+ }, [(Ve = o.value.mermaid) == null ? void 0 : Ve.relationship]), i("li", {
1515
1517
  class: `${s}-menu-item`,
1516
1518
  onClick: () => {
1517
1519
  a("journey");
1518
1520
  }
1519
- }, [(We = o.value.mermaid) == null ? void 0 : We.journey])]),
1521
+ }, [(Ue = o.value.mermaid) == null ? void 0 : Ue.journey])]),
1520
1522
  key: "bar-mermaid"
1521
1523
  }, {
1522
1524
  default: () => {
@@ -1533,7 +1535,7 @@ const vl = {
1533
1535
  }
1534
1536
  });
1535
1537
  case "katex":
1536
- return i(Y, {
1538
+ return i(oe, {
1537
1539
  relative: `#${r}`,
1538
1540
  visible: n.katex,
1539
1541
  onChange: (E) => {
@@ -1549,12 +1551,12 @@ const vl = {
1549
1551
  onClick: () => {
1550
1552
  a("katexInline");
1551
1553
  }
1552
- }, [(Ge = o.value.katex) == null ? void 0 : Ge.inline]), i("li", {
1554
+ }, [(qe = o.value.katex) == null ? void 0 : qe.inline]), i("li", {
1553
1555
  class: `${s}-menu-item`,
1554
1556
  onClick: () => {
1555
1557
  a("katexBlock");
1556
1558
  }
1557
- }, [(ze = o.value.katex) == null ? void 0 : ze.block])]),
1559
+ }, [(We = o.value.katex) == null ? void 0 : We.block])]),
1558
1560
  key: "bar-katex"
1559
1561
  }, {
1560
1562
  default: () => {
@@ -1572,11 +1574,11 @@ const vl = {
1572
1574
  });
1573
1575
  }
1574
1576
  else
1575
- return e.defToolbars instanceof Array ? e.defToolbars[v] || "" : e.defToolbars && e.defToolbars.children instanceof Array && e.defToolbars.children[v] || "";
1577
+ return e.defToolbars instanceof Array ? e.defToolbars[p] || "" : e.defToolbars && e.defToolbars.children instanceof Array && e.defToolbars.children[p] || "";
1576
1578
  };
1577
1579
  return () => {
1578
- const v = u.value[0].map((k) => h(k)), b = u.value[1].map((k) => h(k));
1579
- return i(Ce, null, [e.toolbars.length > 0 && i("div", {
1580
+ const p = u.value[0].map((b) => h(b)), v = u.value[1].map((b) => h(b));
1581
+ return i(xe, null, [e.toolbars.length > 0 && i("div", {
1580
1582
  class: `${s}-toolbar-wrapper`,
1581
1583
  id: r
1582
1584
  }, [i("div", {
@@ -1584,52 +1586,49 @@ const vl = {
1584
1586
  }, [i("div", {
1585
1587
  class: `${s}-toolbar-left`,
1586
1588
  ref: m
1587
- }, [v]), i("div", {
1589
+ }, [p]), i("div", {
1588
1590
  class: `${s}-toolbar-right`
1589
- }, [b])])]), i("input", {
1590
- ref: d,
1591
+ }, [v])])]), i("input", {
1592
+ ref: c,
1591
1593
  accept: "image/*",
1592
1594
  type: "file",
1593
1595
  multiple: !0,
1594
1596
  style: {
1595
1597
  display: "none"
1596
1598
  }
1597
- }, null), i(kl, {
1598
- linkVisible: c.linkVisible,
1599
- clipVisible: c.clipVisible,
1600
- type: c.type,
1599
+ }, null), i(pl, {
1600
+ linkVisible: d.linkVisible,
1601
+ clipVisible: d.clipVisible,
1602
+ type: d.type,
1601
1603
  onCancel: () => {
1602
- c.linkVisible = !1, c.clipVisible = !1;
1604
+ d.linkVisible = !1, d.clipVisible = !1;
1603
1605
  },
1604
- onOk: (k) => {
1605
- k && a(c.type, {
1606
- desc: k.desc,
1607
- url: k.url
1608
- }), c.linkVisible = !1, c.clipVisible = !1;
1606
+ onOk: (b) => {
1607
+ b && a(d.type, {
1608
+ desc: b.desc,
1609
+ url: b.url
1610
+ }), d.linkVisible = !1, d.clipVisible = !1;
1609
1611
  }
1610
1612
  }, null)]);
1611
1613
  };
1612
1614
  }
1613
- }), oe = (e, t, o) => {
1614
- let l = e.scrollTop;
1615
+ }), lt = (e, l, o) => {
1616
+ let t = e.scrollTop;
1615
1617
  const r = () => {
1616
- const n = t - l;
1617
- l = l + n / 5, Math.abs(n) < 1 ? (e.scrollTo(0, t), o && o()) : (e.scrollTo(0, l), requestAnimationFrame(r));
1618
+ const n = l - t;
1619
+ t = t + n / 5, Math.abs(n) < 1 ? (e.scrollTo(0, l), o && setTimeout(o, 100)) : (e.scrollTo(0, t), requestAnimationFrame(r));
1618
1620
  };
1619
1621
  r();
1620
- }, se = (e) => {
1621
- const { marginTop: t } = getComputedStyle(e);
1622
- return e.offsetTop - parseFloat(t);
1623
- }, Cl = (e, t) => {
1624
- const o = ee(() => {
1625
- e.removeEventListener("scroll", l), e.addEventListener("scroll", l), t.removeEventListener("scroll", l), t.addEventListener("scroll", l);
1626
- }, 50), l = (r) => {
1627
- const n = e.clientHeight, a = t.clientHeight, c = e.scrollHeight, m = t.scrollHeight, u = (c - n) / (m - a);
1628
- r.target === e ? (t.removeEventListener("scroll", l), t.scrollTo({
1622
+ }, kl = (e, l) => {
1623
+ const o = ve(() => {
1624
+ e.removeEventListener("scroll", t), e.addEventListener("scroll", t), l.removeEventListener("scroll", t), l.addEventListener("scroll", t);
1625
+ }, 50), t = (r) => {
1626
+ const n = e.clientHeight, a = l.clientHeight, d = e.scrollHeight, m = l.scrollHeight, u = (d - n) / (m - a);
1627
+ r.target === e ? (l.removeEventListener("scroll", t), l.scrollTo({
1629
1628
  top: e.scrollTop / u
1630
1629
  // behavior: 'smooth'
1631
- }), o()) : (e.removeEventListener("scroll", l), e.scrollTo({
1632
- top: t.scrollTop * u
1630
+ }), o()) : (e.removeEventListener("scroll", t), e.scrollTo({
1631
+ top: l.scrollTop * u
1633
1632
  // behavior: 'smooth'
1634
1633
  }), o());
1635
1634
  };
@@ -1640,279 +1639,260 @@ const vl = {
1640
1639
  });
1641
1640
  },
1642
1641
  () => {
1643
- e.removeEventListener("scroll", l), t.removeEventListener("scroll", l);
1642
+ e.removeEventListener("scroll", t), l.removeEventListener("scroll", t);
1644
1643
  }
1645
1644
  ];
1646
- }, $l = (e, t, o, l) => {
1647
- const { view: r } = o;
1648
- let n = 0;
1649
- const a = ee(() => {
1650
- e.removeEventListener("scroll", u), e.addEventListener("scroll", u), t.removeEventListener("scroll", u), t.addEventListener("scroll", u);
1651
- }, 50);
1652
- let c = [];
1653
- const m = () => {
1654
- c = [];
1655
- const { width: d, lineHeight: f, fontFamily: h, fontSize: v, whiteSpace: b } = getComputedStyle(
1656
- document.querySelector(".cm-content")
1657
- ), k = document.createElement("div");
1658
- k.style.visibility = "none", k.style.zIndex = "-1", k.style.width = d, k.style.lineHeight = f, k.style.fontFamily = h, k.style.fontSize = v, k.style.whiteSpace = b, document.body.appendChild(k);
1659
- let p = 0;
1660
- l.split(`
1661
- `).forEach((y) => {
1662
- k.innerText = y || "-", p += k.offsetHeight;
1663
- const $ = {
1664
- lineHeight: k.offsetHeight,
1665
- scrollHeight: p
1666
- };
1667
- c.push($);
1668
- }), k.remove();
1669
- }, u = ee((d) => {
1670
- var b, k;
1671
- n++;
1672
- const f = r.lineBlockAtHeight(r.scrollDOM.scrollTop), h = r.state.doc.lineAt(f.from), v = Array.from(t.children[0].children).filter(
1673
- (p) => p.hasAttribute("data-line")
1674
- );
1675
- if (d.target === e) {
1676
- if (t.removeEventListener("scroll", u), e.scrollTop + e.clientHeight >= e.scrollHeight) {
1677
- oe(t, t.scrollHeight - t.clientHeight, () => {
1678
- --n === 0 && a();
1679
- });
1680
- return;
1681
- }
1682
- const { number: p } = h;
1683
- let y = (b = t.firstElementChild) == null ? void 0 : b.firstElementChild, $ = 1, w = v.length === 0 ? (k = t.firstElementChild) == null ? void 0 : k.lastElementChild : v[0], L = v.length === 0 ? 0 : Number(v[0].dataset.line);
1684
- for (let P = 0; P < v.length; P++) {
1685
- const X = Number(v[P].dataset.line) + 1, R = Number(
1686
- P + 1 >= v.length ? -2 : v[P + 1].dataset.line
1687
- );
1688
- if (p >= X && p <= R) {
1689
- y = v[P], w = v[P + 1], $ = X, L = R;
1690
- break;
1691
- }
1692
- }
1693
- if (!y) {
1694
- n--;
1695
- return;
1696
- }
1697
- const S = (r.scrollDOM.scrollTop - c[$ - 1].scrollHeight + c[$ - 1].lineHeight) / (c[L - 1].scrollHeight - c[$ - 1].scrollHeight + c[$ - 1].lineHeight), { marginTop: j } = getComputedStyle(y), B = y.offsetTop - parseFloat(j), { marginTop: q } = getComputedStyle(w), Z = w.offsetTop - parseFloat(q) - B, K = B + Z * S;
1698
- oe(t, K, () => {
1699
- --n === 0 && a();
1645
+ }, yl = (e, l, o) => {
1646
+ const { view: t } = o, r = (f) => t.lineBlockAt(t.state.doc.line(f).from).top, n = (f) => t.lineBlockAt(t.state.doc.line(f).from).height;
1647
+ let a = [];
1648
+ const d = () => {
1649
+ a = [];
1650
+ const f = Array.from(l.querySelectorAll("[data-line]")).map(
1651
+ (b) => Number(b.dataset.line) + 1
1652
+ ), { lines: h } = t.state.doc;
1653
+ let p = 1, v = f.shift() ?? h;
1654
+ for (let b = 1; b <= h; b++)
1655
+ b === v && (p = b, v = f.shift() || h + 1), a.push({
1656
+ start: p,
1657
+ end: v - 1
1700
1658
  });
1701
- } else {
1702
- if (e.removeEventListener("scroll", u), t.scrollTop === 0) {
1703
- oe(e, 0, () => {
1704
- --n === 0 && a();
1705
- });
1706
- return;
1707
- } else if (t.scrollTop + t.clientHeight >= t.scrollHeight) {
1708
- oe(e, e.scrollHeight - e.clientHeight, () => {
1709
- --n === 0 && a();
1659
+ };
1660
+ let m = 0, u = 0;
1661
+ const c = (f) => {
1662
+ var v, b, y, C, $, T, I;
1663
+ if (!((v = l.firstElementChild) != null && v.firstElementChild))
1664
+ return;
1665
+ const h = t.lineBlockAtHeight(t.scrollDOM.scrollTop), { number: p } = t.state.doc.lineAt(h.from);
1666
+ if (!(p > a.length) && !(t.state.doc.lines < a[a.length - 1].end))
1667
+ if (f.target === e) {
1668
+ if (u !== 0)
1669
+ return;
1670
+ m++;
1671
+ const w = a[p - 1], F = r(w.end) + n(w.end);
1672
+ let j = 0;
1673
+ const R = r(w.start), P = l.querySelector(`[data-line="${w.start - 1}"]`) || ((b = l.firstElementChild) == null ? void 0 : b.firstElementChild), _ = l.querySelector(`[data-line="${w.end}"]`) || ((y = l.lastElementChild) == null ? void 0 : y.lastElementChild);
1674
+ let N = 0, D = 0;
1675
+ R === 0 ? (j = (t.scrollDOM.scrollTop - R) / (F - R), N = _.offsetTop) : F > t.scrollDOM.scrollHeight - t.scrollDOM.clientHeight ? (j = (t.scrollDOM.scrollTop - R) / (t.scrollDOM.scrollHeight - t.scrollDOM.clientHeight - R), D = P.offsetTop, N = l.scrollHeight - l.clientHeight - D + 10) : (j = (t.scrollDOM.scrollTop - R) / (F - R), D = P.offsetTop, N = _.offsetTop - D);
1676
+ const Q = D - 10 + N * j;
1677
+ lt(l, Q, () => {
1678
+ m--;
1710
1679
  });
1711
- return;
1712
- }
1713
- const p = t.scrollTop, y = t.scrollHeight;
1714
- let $ = Math.floor(
1715
- Number(v[v.length - 1].dataset.line) * (p / y)
1716
- ), w;
1717
- for (let R = $; R >= 0; R--) {
1718
- const V = t.querySelector(`[data-line="${R}"]`);
1719
- if (V) {
1720
- w = V, $ = R;
1721
- break;
1722
- }
1723
- }
1724
- if (!w) {
1725
- n--;
1726
- return;
1727
- }
1728
- let L, S;
1729
- for (; ; ) {
1730
- const R = v.indexOf(w), V = v[R + 1], le = se(w);
1731
- if (le > p) {
1732
- if (R === 0) {
1733
- L = w, S = V;
1680
+ } else {
1681
+ if (m !== 0)
1682
+ return;
1683
+ u++;
1684
+ const w = Array.from(
1685
+ l.querySelectorAll("[data-line]")
1686
+ ), F = l.scrollTop, j = l.scrollHeight;
1687
+ let R = w.length === 0 ? 1 : Math.ceil(
1688
+ Number(w[w.length - 1].dataset.line) * (F / j)
1689
+ ), P = (C = l.firstElementChild) == null ? void 0 : C.firstElementChild;
1690
+ for (let O = R; O >= 0; O--) {
1691
+ const G = l.querySelector(`[data-line="${O}"]`);
1692
+ if (G) {
1693
+ P = G, R = O;
1734
1694
  break;
1735
1695
  }
1736
- w = v[R - 1];
1737
- continue;
1738
1696
  }
1739
- const ie = se(V);
1740
- if (le <= p && ie > p) {
1741
- L = w, S = V;
1742
- break;
1697
+ let _ = ($ = l.firstElementChild) == null ? void 0 : $.firstElementChild, N = (T = l.firstElementChild) == null ? void 0 : T.lastElementChild;
1698
+ for (; w.length > 0; ) {
1699
+ const O = w.indexOf(P);
1700
+ if (O + 1 >= w.length)
1701
+ break;
1702
+ const G = w[O + 1], ae = P.offsetTop;
1703
+ if (ae > F) {
1704
+ if (O === 0) {
1705
+ _ = P, N = G;
1706
+ break;
1707
+ }
1708
+ P = w[O - 1];
1709
+ continue;
1710
+ }
1711
+ const me = G.offsetTop;
1712
+ if (ae <= F && me > F) {
1713
+ _ = P, N = G;
1714
+ break;
1715
+ }
1716
+ P = G;
1743
1717
  }
1744
- w = V;
1718
+ const D = _.offsetTop, Q = N.offsetTop;
1719
+ let z = 0;
1720
+ const { start: ue, end: re } = a[Number(_.dataset.line || 0)], ee = r(ue);
1721
+ let X = r(re);
1722
+ const ie = n(re);
1723
+ let te = 0;
1724
+ _ === ((I = l.firstElementChild) == null ? void 0 : I.firstElementChild) ? (z = Math.max(F / Q, 0), te = X + ie - ee) : X > t.scrollDOM.scrollHeight - t.scrollDOM.clientHeight ? (z = Math.max(
1725
+ (F - D) / (l.scrollHeight - D - l.clientHeight),
1726
+ 0
1727
+ ), X = r(t.state.doc.lines) + n(t.state.doc.lines), te = 8 + X - ee - e.clientHeight) : (z = Math.max(
1728
+ (F - D) / (Q - D),
1729
+ 0
1730
+ ), te = X + ie - ee), lt(e, ee + te * z, () => {
1731
+ u--;
1732
+ });
1745
1733
  }
1746
- const j = se(L), B = se(S), q = (p - j) / (B - j), te = Number(L.dataset.line), Z = Number(S.dataset.line), K = c[te].scrollHeight, X = c[Z].scrollHeight - K;
1747
- oe(e, K + X * q, () => {
1748
- --n === 0 && a();
1749
- });
1750
- }
1751
- }, 6);
1734
+ };
1752
1735
  return [
1753
1736
  () => {
1754
- m(), a().finally(() => {
1755
- e.dispatchEvent(new Event("scroll"));
1756
- });
1737
+ d(), e.addEventListener("scroll", c), l.addEventListener("scroll", c), e.dispatchEvent(new Event("scroll"));
1757
1738
  },
1758
1739
  () => {
1759
- n = 0, e.removeEventListener("scroll", u), t.removeEventListener("scroll", u);
1740
+ a = [], e.removeEventListener("scroll", c), l.removeEventListener("scroll", c);
1760
1741
  }
1761
1742
  ];
1762
- }, wl = (e, t, o, l, r) => {
1743
+ }, Cl = (e, l, o, t, r) => {
1763
1744
  const n = x("previewOnly");
1764
1745
  let a = () => {
1765
- }, c = () => {
1746
+ }, d = () => {
1766
1747
  };
1767
1748
  const m = () => {
1768
1749
  a();
1769
1750
  const u = document.querySelector(".cm-scroller");
1770
- !n && (o.value || l.value) && ([c, a] = (o.value ? $l : Cl)(
1751
+ !n && (o.value || t.value) && ([d, a] = (o.value ? yl : kl)(
1771
1752
  u,
1772
- o.value || l.value,
1773
- r.value,
1774
- e.value
1775
- )), e.scrollAuto && c();
1753
+ o.value || t.value,
1754
+ r.value
1755
+ )), e.scrollAuto && d();
1776
1756
  };
1777
- T(
1757
+ S(
1778
1758
  [
1779
- t,
1780
- Q(e.setting, "preview"),
1781
- Q(e.setting, "htmlPreview"),
1782
- Q(e.setting, "fullscreen"),
1783
- Q(e.setting, "pageFullscreen")
1759
+ l,
1760
+ ne(e.setting, "preview"),
1761
+ ne(e.setting, "htmlPreview"),
1762
+ ne(e.setting, "fullscreen"),
1763
+ ne(e.setting, "pageFullscreen")
1784
1764
  ],
1785
1765
  () => {
1786
- z(m);
1766
+ Y(m);
1787
1767
  }
1788
- ), T(
1768
+ ), S(
1789
1769
  () => e.scrollAuto,
1790
1770
  (u) => {
1791
- u ? c() : a();
1771
+ u ? d() : a();
1792
1772
  }
1793
- ), A(m);
1794
- }, Tl = (e, t, o) => {
1795
- var d, f, h, v, b, k;
1796
- let l = "", r = 0, n = 0, a = !0, c = !1;
1797
- const m = t.getSelectedText(), u = (d = I.editorConfig) == null ? void 0 : d.mermaidTemplate;
1773
+ ), H(m);
1774
+ }, $l = (e, l, o) => {
1775
+ var c, f, h, p, v, b;
1776
+ let t = "", r = 0, n = 0, a = !0, d = !1;
1777
+ const m = l.getSelectedText(), u = (c = A.editorConfig) == null ? void 0 : c.mermaidTemplate;
1798
1778
  if (/^h[1-6]{1}$/.test(e)) {
1799
- const p = e.replace(/^h(\d)/, (y, $) => new Array(Number($)).fill("#", 0, $).join(""));
1800
- l = `${p} ${m}`, r = p.length + 1;
1779
+ const y = e.replace(/^h(\d)/, (C, $) => new Array(Number($)).fill("#", 0, $).join(""));
1780
+ t = `${y} ${m}`, r = y.length + 1;
1801
1781
  } else if (e === "prettier") {
1802
- const p = window.prettier || ((h = (f = I.editorExtensions) == null ? void 0 : f.prettier) == null ? void 0 : h.prettierInstance), y = [
1803
- ((v = window.prettierPlugins) == null ? void 0 : v.markdown) || ((k = (b = I.editorExtensions) == null ? void 0 : b.prettier) == null ? void 0 : k.parserMarkdownInstance)
1782
+ const y = window.prettier || ((h = (f = A.editorExtensions) == null ? void 0 : f.prettier) == null ? void 0 : h.prettierInstance), C = [
1783
+ ((p = window.prettierPlugins) == null ? void 0 : p.markdown) || ((b = (v = A.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : b.parserMarkdownInstance)
1804
1784
  ];
1805
- !p || y[0] === void 0 ? (C.emit(o.editorId, "errorCatcher", {
1785
+ !y || C[0] === void 0 ? (k.emit(o.editorId, "errorCatcher", {
1806
1786
  name: "prettier",
1807
1787
  message: "prettier is undefined"
1808
- }), l = t.getValue()) : l = p.format(t.getValue(), {
1788
+ }), t = l.getValue()) : t = y.format(l.getValue(), {
1809
1789
  parser: "markdown",
1810
- plugins: y
1811
- }), a = !1, c = !0;
1790
+ plugins: C
1791
+ }), a = !1, d = !0;
1812
1792
  } else
1813
1793
  switch (e) {
1814
1794
  case "bold": {
1815
- l = `**${m}**`, r = 2, n = -2;
1795
+ t = `**${m}**`, r = 2, n = -2;
1816
1796
  break;
1817
1797
  }
1818
1798
  case "underline": {
1819
- l = `<u>${m}</u>`, r = 3, n = -4;
1799
+ t = `<u>${m}</u>`, r = 3, n = -4;
1820
1800
  break;
1821
1801
  }
1822
1802
  case "italic": {
1823
- l = `*${m}*`, r = 1, n = -1;
1803
+ t = `*${m}*`, r = 1, n = -1;
1824
1804
  break;
1825
1805
  }
1826
1806
  case "strikeThrough": {
1827
- l = `~${m}~`, r = 1, n = -1;
1807
+ t = `~${m}~`, r = 1, n = -1;
1828
1808
  break;
1829
1809
  }
1830
1810
  case "sub": {
1831
- l = `<sub>${m}</sub>`, r = 5, n = -6;
1811
+ t = `<sub>${m}</sub>`, r = 5, n = -6;
1832
1812
  break;
1833
1813
  }
1834
1814
  case "sup": {
1835
- l = `<sup>${m}</sup>`, r = 5, n = -6;
1815
+ t = `<sup>${m}</sup>`, r = 5, n = -6;
1836
1816
  break;
1837
1817
  }
1838
1818
  case "codeRow": {
1839
- l = "`" + m + "`", r = 1, n = -1;
1819
+ t = "`" + m + "`", r = 1, n = -1;
1840
1820
  break;
1841
1821
  }
1842
1822
  case "quote": {
1843
- l = `> ${m}`, r = 2;
1823
+ t = `> ${m}`, r = 2;
1844
1824
  break;
1845
1825
  }
1846
1826
  case "orderedList": {
1847
- l = `1. ${m}`, r = 3;
1827
+ t = `1. ${m}`, r = 3;
1848
1828
  break;
1849
1829
  }
1850
1830
  case "unorderedList": {
1851
- l = `- ${m}`, r = 2;
1831
+ t = `- ${m}`, r = 2;
1852
1832
  break;
1853
1833
  }
1854
1834
  case "task": {
1855
- l = `- [ ] ${m}`, r = 6;
1835
+ t = `- [ ] ${m}`, r = 6;
1856
1836
  break;
1857
1837
  }
1858
1838
  case "code": {
1859
- const p = o.text || m || "", y = o.mode || "language";
1860
- l = `\`\`\`${y}
1861
- ${p}
1839
+ const y = o.text || m || "", C = o.mode || "language";
1840
+ t = `\`\`\`${C}
1841
+ ${y}
1862
1842
  \`\`\`
1863
- `, r = 3, n = 3 + y.length - l.length;
1843
+ `, r = 3, n = 3 + C.length - t.length;
1864
1844
  break;
1865
1845
  }
1866
1846
  case "table": {
1867
- l = "|";
1868
- const { selectedShape: p = { x: 1, y: 1 } } = o, { x: y, y: $ } = p;
1869
- for (let w = 0; w <= $; w++)
1870
- l += " col |";
1871
- l += `
1847
+ t = "|";
1848
+ const { selectedShape: y = { x: 1, y: 1 } } = o, { x: C, y: $ } = y;
1849
+ for (let T = 0; T <= $; T++)
1850
+ t += " col |";
1851
+ t += `
1872
1852
  |`;
1873
- for (let w = 0; w <= $; w++)
1874
- l += " - |";
1875
- for (let w = 0; w <= y; w++) {
1876
- l += `
1853
+ for (let T = 0; T <= $; T++)
1854
+ t += " - |";
1855
+ for (let T = 0; T <= C; T++) {
1856
+ t += `
1877
1857
  |`;
1878
- for (let L = 0; L <= $; L++)
1879
- l += " content |";
1858
+ for (let I = 0; I <= $; I++)
1859
+ t += " content |";
1880
1860
  }
1881
- r = 2, n = 5 - l.length;
1861
+ r = 2, n = 5 - t.length;
1882
1862
  break;
1883
1863
  }
1884
1864
  case "link": {
1885
- const { desc: p, url: y } = o;
1886
- l = `[${p}](${y})`, a = !1;
1865
+ const { desc: y, url: C } = o;
1866
+ t = `[${y}](${C})`, a = !1;
1887
1867
  break;
1888
1868
  }
1889
1869
  case "image": {
1890
- const { desc: p, url: y, urls: $ } = o;
1891
- $ instanceof Array ? l = $.reduce((w, L) => w + `![${p}](${L})
1892
- `, "") : l = `![${p}](${y})
1870
+ const { desc: y, url: C, urls: $ } = o;
1871
+ $ instanceof Array ? t = $.reduce((T, I) => T + `![${y}](${I})
1872
+ `, "") : t = `![${y}](${C})
1893
1873
  `, a = !1;
1894
1874
  break;
1895
1875
  }
1896
1876
  case "flow": {
1897
- l = `\`\`\`mermaid
1877
+ t = `\`\`\`mermaid
1898
1878
  ${(u == null ? void 0 : u.flow) || `flowchart TD
1899
1879
  Start --> Stop`}
1900
1880
  \`\`\`
1901
- `, r = 3, n = 10 - l.length;
1881
+ `, r = 3, n = 10 - t.length;
1902
1882
  break;
1903
1883
  }
1904
1884
  case "sequence": {
1905
- l = `\`\`\`mermaid
1885
+ t = `\`\`\`mermaid
1906
1886
  ${(u == null ? void 0 : u.sequence) || `sequenceDiagram
1907
1887
  A->>B: hello!
1908
1888
  B-->>A: hi!
1909
1889
  A-)B: bye!`}
1910
1890
  \`\`\`
1911
- `, r = 3, n = 10 - l.length;
1891
+ `, r = 3, n = 10 - t.length;
1912
1892
  break;
1913
1893
  }
1914
1894
  case "gantt": {
1915
- l = `\`\`\`mermaid
1895
+ t = `\`\`\`mermaid
1916
1896
  ${(u == null ? void 0 : u.gantt) || `gantt
1917
1897
  title A Gantt Diagram
1918
1898
  dateFormat YYYY-MM-DD
@@ -1920,47 +1900,47 @@ section Section
1920
1900
  A task :a1, 2014-01-01, 30d
1921
1901
  Another task :after a1, 20d`}
1922
1902
  \`\`\`
1923
- `, r = 3, n = 10 - l.length;
1903
+ `, r = 3, n = 10 - t.length;
1924
1904
  break;
1925
1905
  }
1926
1906
  case "class": {
1927
- l = `\`\`\`mermaid
1907
+ t = `\`\`\`mermaid
1928
1908
  ${(u == null ? void 0 : u.class) || `classDiagram
1929
1909
  class Animal
1930
1910
  Vehicle <|-- Car`}
1931
1911
  \`\`\`
1932
- `, r = 3, n = 10 - l.length;
1912
+ `, r = 3, n = 10 - t.length;
1933
1913
  break;
1934
1914
  }
1935
1915
  case "state": {
1936
- l = `\`\`\`mermaid
1916
+ t = `\`\`\`mermaid
1937
1917
  ${(u == null ? void 0 : u.state) || `stateDiagram-v2
1938
1918
  s1 --> s2`}
1939
1919
  \`\`\`
1940
- `, r = 3, n = 10 - l.length;
1920
+ `, r = 3, n = 10 - t.length;
1941
1921
  break;
1942
1922
  }
1943
1923
  case "pie": {
1944
- l = `\`\`\`mermaid
1924
+ t = `\`\`\`mermaid
1945
1925
  ${(u == null ? void 0 : u.pie) || `pie title Pets adopted by volunteers
1946
1926
  "Dogs" : 386
1947
1927
  "Cats" : 85
1948
1928
  "Rats" : 15`}
1949
1929
  \`\`\`
1950
- `, r = 3, n = 10 - l.length;
1930
+ `, r = 3, n = 10 - t.length;
1951
1931
  break;
1952
1932
  }
1953
1933
  case "relationship": {
1954
- l = `\`\`\`mermaid
1934
+ t = `\`\`\`mermaid
1955
1935
  ${(u == null ? void 0 : u.relationship) || `erDiagram
1956
1936
  CAR ||--o{ NAMED-DRIVER : allows
1957
1937
  PERSON ||--o{ NAMED-DRIVER : is`}
1958
1938
  \`\`\`
1959
- `, r = 3, n = 10 - l.length;
1939
+ `, r = 3, n = 10 - t.length;
1960
1940
  break;
1961
1941
  }
1962
1942
  case "journey": {
1963
- l = `\`\`\`mermaid
1943
+ t = `\`\`\`mermaid
1964
1944
  ${(u == null ? void 0 : u.journey) || `journey
1965
1945
  title My working day
1966
1946
  section Go to work
@@ -1971,27 +1951,27 @@ ${(u == null ? void 0 : u.journey) || `journey
1971
1951
  Go downstairs: 5: Me
1972
1952
  Sit down: 5: Me`}
1973
1953
  \`\`\`
1974
- `, r = 3, n = 10 - l.length;
1954
+ `, r = 3, n = 10 - t.length;
1975
1955
  break;
1976
1956
  }
1977
1957
  case "katexInline": {
1978
- l = "$$", r = 1, n = -1;
1958
+ t = "$$", r = 1, n = -1;
1979
1959
  break;
1980
1960
  }
1981
1961
  case "katexBlock": {
1982
- l = `$$
1962
+ t = `$$
1983
1963
 
1984
1964
  $$
1985
1965
  `, r = 3, n = -4;
1986
1966
  break;
1987
1967
  }
1988
1968
  case "universal": {
1989
- const { generate: p } = o, y = p(m);
1990
- l = y.targetValue, a = y.select, r = y.deviationStart, n = y.deviationEnd;
1969
+ const { generate: y } = o, C = y(m);
1970
+ t = C.targetValue, a = C.select, r = C.deviationStart, n = C.deviationEnd;
1991
1971
  }
1992
1972
  }
1993
1973
  return {
1994
- text: l,
1974
+ text: t,
1995
1975
  options: {
1996
1976
  // 是否选中
1997
1977
  select: a,
@@ -2000,21 +1980,21 @@ $$
2000
1980
  // 结束的偏移量
2001
1981
  deviationEnd: n,
2002
1982
  // 是否整个替换
2003
- replaceAll: c
1983
+ replaceAll: d
2004
1984
  }
2005
1985
  };
2006
- }, Sl = "#e5c07b", nt = "var(--md-color)", xl = "#56b6c2", El = "#ffffff", ne = "var(--md-color)", rt = "#e5c07b", Ll = "#e5c07b", Hl = "var(--md-color)", it = "#d19a66", Il = "#c678dd", Al = "#21252b", at = "#2c313a", st = "#000", ge = "#353a42", Fl = "#ceedfa33", ct = "#528bff", Ml = $e.theme(
1986
+ }, wl = "#e5c07b", ot = "var(--md-color)", Tl = "#56b6c2", Sl = "#ffffff", se = "var(--md-color)", nt = "#e5c07b", xl = "#e5c07b", El = "var(--md-color)", rt = "#d19a66", Ll = "#c678dd", Al = "#21252b", it = "#2c313a", at = "#000", ke = "#353a42", Il = "#ceedfa33", st = "#528bff", Hl = Ee.theme(
2007
1987
  {
2008
1988
  "&": {
2009
- color: ne,
2010
- backgroundColor: st
1989
+ color: se,
1990
+ backgroundColor: at
2011
1991
  },
2012
1992
  ".cm-content": {
2013
- caretColor: ct
1993
+ caretColor: st
2014
1994
  },
2015
- ".cm-cursor, .cm-dropCursor": { borderLeftColor: ct },
2016
- "&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Fl },
2017
- ".cm-panels": { backgroundColor: Al, color: ne },
1995
+ ".cm-cursor, .cm-dropCursor": { borderLeftColor: st },
1996
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Il },
1997
+ ".cm-panels": { backgroundColor: Al, color: se },
2018
1998
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
2019
1999
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
2020
2000
  ".cm-searchMatch": {
@@ -2030,13 +2010,13 @@ $$
2030
2010
  backgroundColor: "#bad0f847"
2031
2011
  },
2032
2012
  ".cm-gutters": {
2033
- backgroundColor: st,
2034
- color: ne,
2013
+ backgroundColor: at,
2014
+ color: se,
2035
2015
  borderRight: "1px solid",
2036
2016
  borderColor: "var(--md-border-color)"
2037
2017
  },
2038
2018
  ".cm-activeLineGutter": {
2039
- backgroundColor: at
2019
+ backgroundColor: it
2040
2020
  },
2041
2021
  ".cm-foldPlaceholder": {
2042
2022
  backgroundColor: "transparent",
@@ -2045,30 +2025,30 @@ $$
2045
2025
  },
2046
2026
  ".cm-tooltip": {
2047
2027
  border: "none",
2048
- backgroundColor: ge
2028
+ backgroundColor: ke
2049
2029
  },
2050
2030
  ".cm-tooltip .cm-tooltip-arrow:before": {
2051
2031
  borderTopColor: "transparent",
2052
2032
  borderBottomColor: "transparent"
2053
2033
  },
2054
2034
  ".cm-tooltip .cm-tooltip-arrow:after": {
2055
- borderTopColor: ge,
2056
- borderBottomColor: ge
2035
+ borderTopColor: ke,
2036
+ borderBottomColor: ke
2057
2037
  },
2058
2038
  ".cm-tooltip-autocomplete": {
2059
2039
  "& > ul > li[aria-selected]": {
2060
- backgroundColor: at,
2061
- color: ne
2040
+ backgroundColor: it,
2041
+ color: se
2062
2042
  }
2063
2043
  }
2064
2044
  },
2065
2045
  { dark: !0 }
2066
- ), Rl = bt.define([
2067
- { tag: g.keyword, color: Il },
2068
- { tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: nt },
2069
- { tag: [g.function(g.variableName), g.labelName], color: Ll },
2070
- { tag: [g.color, g.constant(g.name), g.standard(g.name)], color: it },
2071
- { tag: [g.definition(g.name), g.separator], color: ne },
2046
+ ), Fl = vt.define([
2047
+ { tag: g.keyword, color: Ll },
2048
+ { tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ot },
2049
+ { tag: [g.function(g.variableName), g.labelName], color: xl },
2050
+ { tag: [g.color, g.constant(g.name), g.standard(g.name)], color: rt },
2051
+ { tag: [g.definition(g.name), g.separator], color: se },
2072
2052
  {
2073
2053
  tag: [
2074
2054
  g.typeName,
@@ -2080,7 +2060,7 @@ $$
2080
2060
  g.self,
2081
2061
  g.namespace
2082
2062
  ],
2083
- color: Sl
2063
+ color: wl
2084
2064
  },
2085
2065
  {
2086
2066
  tag: [
@@ -2092,32 +2072,32 @@ $$
2092
2072
  g.link,
2093
2073
  g.special(g.string)
2094
2074
  ],
2095
- color: xl
2075
+ color: Tl
2096
2076
  },
2097
- { tag: [g.meta, g.comment], color: rt },
2077
+ { tag: [g.meta, g.comment], color: nt },
2098
2078
  { tag: g.strong, fontWeight: "bold" },
2099
2079
  { tag: g.emphasis, fontStyle: "italic" },
2100
2080
  { tag: g.strikethrough, textDecoration: "line-through" },
2101
- { tag: g.link, color: rt, textDecoration: "underline" },
2102
- { tag: g.heading, fontWeight: "bold", color: nt },
2103
- { tag: [g.atom, g.bool, g.special(g.variableName)], color: it },
2104
- { tag: [g.processingInstruction, g.string, g.inserted], color: Hl },
2105
- { tag: g.invalid, color: El }
2106
- ]), jl = [
2107
- Ml,
2108
- kt(Rl)
2109
- ], Bl = "#e5c07b", dt = "#3f4a54", Pl = "#56b6c2", Ol = "#fff", re = "#3f4a54", ut = "#2d8cf0", Dl = "#2d8cf0", Nl = "#3f4a54", mt = "#d19a66", _l = "#c678dd", Vl = "#21252b", ft = "#2c313a", gt = "#fff", he = "#353a42", Ul = "#bad5fa", ht = "#3f4a54", ql = $e.theme(
2081
+ { tag: g.link, color: nt, textDecoration: "underline" },
2082
+ { tag: g.heading, fontWeight: "bold", color: ot },
2083
+ { tag: [g.atom, g.bool, g.special(g.variableName)], color: rt },
2084
+ { tag: [g.processingInstruction, g.string, g.inserted], color: El },
2085
+ { tag: g.invalid, color: Sl }
2086
+ ]), Ml = [
2087
+ Hl,
2088
+ pt(Fl)
2089
+ ], Bl = "#e5c07b", ct = "#3f4a54", Rl = "#56b6c2", jl = "#fff", ce = "#3f4a54", dt = "#2d8cf0", Pl = "#2d8cf0", Dl = "#3f4a54", ut = "#d19a66", Ol = "#c678dd", _l = "#21252b", mt = "#ceedfa33", ft = "#fff", ye = "#353a42", Nl = "#bad5fa", gt = "#3f4a54", Vl = Ee.theme(
2110
2090
  {
2111
2091
  "&": {
2112
- color: re,
2113
- backgroundColor: gt
2092
+ color: ce,
2093
+ backgroundColor: ft
2114
2094
  },
2115
2095
  ".cm-content": {
2116
- caretColor: ht
2096
+ caretColor: gt
2117
2097
  },
2118
- ".cm-cursor, .cm-dropCursor": { borderLeftColor: ht },
2119
- "&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ul },
2120
- ".cm-panels": { backgroundColor: Vl, color: re },
2098
+ ".cm-cursor, .cm-dropCursor": { borderLeftColor: gt },
2099
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Nl },
2100
+ ".cm-panels": { backgroundColor: _l, color: ce },
2121
2101
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
2122
2102
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
2123
2103
  ".cm-searchMatch": {
@@ -2133,13 +2113,13 @@ $$
2133
2113
  backgroundColor: "#bad0f847"
2134
2114
  },
2135
2115
  ".cm-gutters": {
2136
- backgroundColor: gt,
2137
- color: re,
2116
+ backgroundColor: ft,
2117
+ color: ce,
2138
2118
  borderRight: "1px solid",
2139
2119
  borderColor: "var(--md-border-color)"
2140
2120
  },
2141
2121
  ".cm-activeLineGutter": {
2142
- backgroundColor: ft
2122
+ backgroundColor: mt
2143
2123
  },
2144
2124
  ".cm-foldPlaceholder": {
2145
2125
  backgroundColor: "transparent",
@@ -2148,30 +2128,30 @@ $$
2148
2128
  },
2149
2129
  ".cm-tooltip": {
2150
2130
  border: "none",
2151
- backgroundColor: he
2131
+ backgroundColor: ye
2152
2132
  },
2153
2133
  ".cm-tooltip .cm-tooltip-arrow:before": {
2154
2134
  borderTopColor: "transparent",
2155
2135
  borderBottomColor: "transparent"
2156
2136
  },
2157
2137
  ".cm-tooltip .cm-tooltip-arrow:after": {
2158
- borderTopColor: he,
2159
- borderBottomColor: he
2138
+ borderTopColor: ye,
2139
+ borderBottomColor: ye
2160
2140
  },
2161
2141
  ".cm-tooltip-autocomplete": {
2162
2142
  "& > ul > li[aria-selected]": {
2163
- backgroundColor: ft,
2164
- color: re
2143
+ backgroundColor: mt,
2144
+ color: ce
2165
2145
  }
2166
2146
  }
2167
2147
  },
2168
2148
  { dark: !0 }
2169
- ), Wl = bt.define([
2170
- { tag: g.keyword, color: _l },
2171
- { tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: dt },
2172
- { tag: [g.function(g.variableName), g.labelName], color: Dl },
2173
- { tag: [g.color, g.constant(g.name), g.standard(g.name)], color: mt },
2174
- { tag: [g.definition(g.name), g.separator], color: re },
2149
+ ), Ul = vt.define([
2150
+ { tag: g.keyword, color: Ol },
2151
+ { tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ct },
2152
+ { tag: [g.function(g.variableName), g.labelName], color: Pl },
2153
+ { tag: [g.color, g.constant(g.name), g.standard(g.name)], color: ut },
2154
+ { tag: [g.definition(g.name), g.separator], color: ce },
2175
2155
  {
2176
2156
  tag: [
2177
2157
  g.typeName,
@@ -2195,40 +2175,40 @@ $$
2195
2175
  g.link,
2196
2176
  g.special(g.string)
2197
2177
  ],
2198
- color: Pl
2178
+ color: Rl
2199
2179
  },
2200
- { tag: [g.meta, g.comment], color: ut },
2180
+ { tag: [g.meta, g.comment], color: dt },
2201
2181
  { tag: g.strong, fontWeight: "bold" },
2202
2182
  { tag: g.emphasis, fontStyle: "italic" },
2203
2183
  { tag: g.strikethrough, textDecoration: "line-through" },
2204
- { tag: g.link, color: ut, textDecoration: "underline" },
2205
- { tag: g.heading, fontWeight: "bold", color: dt },
2206
- { tag: [g.atom, g.bool, g.special(g.variableName)], color: mt },
2207
- { tag: [g.processingInstruction, g.string, g.inserted], color: Nl },
2208
- { tag: g.invalid, color: Ol }
2209
- ]), Gl = [
2210
- ql,
2211
- kt(Wl)
2212
- ], J = (e) => {
2213
- const t = new It();
2214
- return (l) => (t.get(e.state) ? e.dispatch({ effects: t.reconfigure(l) }) : e.dispatch({
2215
- effects: At.appendConfig.of(t.of(l))
2184
+ { tag: g.link, color: dt, textDecoration: "underline" },
2185
+ { tag: g.heading, fontWeight: "bold", color: ct },
2186
+ { tag: [g.atom, g.bool, g.special(g.variableName)], color: ut },
2187
+ { tag: [g.processingInstruction, g.string, g.inserted], color: Dl },
2188
+ { tag: g.invalid, color: jl }
2189
+ ]), ql = [
2190
+ Vl,
2191
+ pt(Ul)
2192
+ ], le = (e) => {
2193
+ const l = new Lt();
2194
+ return (t) => (l.get(e.state) ? e.dispatch({ effects: l.reconfigure(t) }) : e.dispatch({
2195
+ effects: At.appendConfig.of(l.of(t))
2216
2196
  }), !0);
2217
2197
  };
2218
- class zl {
2219
- constructor(t) {
2220
- U(this, "view");
2198
+ class Wl {
2199
+ constructor(l) {
2200
+ K(this, "view");
2221
2201
  // 切换tabSize的执行方法。切换时,Compartment实例需要相同
2222
- U(this, "toggleTabSize");
2223
- U(this, "togglePlaceholder");
2202
+ K(this, "toggleTabSize");
2203
+ K(this, "togglePlaceholder");
2224
2204
  /**
2225
2205
  * 设置全部的扩展
2226
2206
  */
2227
- U(this, "setExtensions");
2228
- U(this, "toggleDisabled");
2229
- U(this, "toggleReadOnly");
2230
- U(this, "toggleMaxlength");
2231
- this.view = t, this.toggleTabSize = J(this.view), this.togglePlaceholder = J(this.view), this.setExtensions = J(this.view), this.toggleDisabled = J(this.view), this.toggleReadOnly = J(this.view), this.toggleMaxlength = J(this.view);
2207
+ K(this, "setExtensions");
2208
+ K(this, "toggleDisabled");
2209
+ K(this, "toggleReadOnly");
2210
+ K(this, "toggleMaxlength");
2211
+ this.view = l, this.toggleTabSize = le(this.view), this.togglePlaceholder = le(this.view), this.setExtensions = le(this.view), this.toggleDisabled = le(this.view), this.toggleReadOnly = le(this.view), this.toggleMaxlength = le(this.view);
2232
2212
  }
2233
2213
  getValue() {
2234
2214
  return this.view.state.doc.toString();
@@ -2240,12 +2220,12 @@ class zl {
2240
2220
  * @param from 插入开始位置
2241
2221
  * @param to 插入结束位置
2242
2222
  */
2243
- setValue(t, o = 0, l = this.view.state.doc.length) {
2223
+ setValue(l, o = 0, t = this.view.state.doc.length) {
2244
2224
  this.view.dispatch({
2245
2225
  changes: {
2246
2226
  from: o,
2247
- to: l,
2248
- insert: t
2227
+ to: t,
2228
+ insert: l
2249
2229
  }
2250
2230
  });
2251
2231
  }
@@ -2253,8 +2233,8 @@ class zl {
2253
2233
  * 获取选中的文本
2254
2234
  */
2255
2235
  getSelectedText() {
2256
- const { from: t, to: o } = this.view.state.selection.main;
2257
- return this.view.state.sliceDoc(t, o);
2236
+ const { from: l, to: o } = this.view.state.selection.main;
2237
+ return this.view.state.sliceDoc(l, o);
2258
2238
  }
2259
2239
  /**
2260
2240
  * 使用新的内容替换选中的内容
@@ -2262,7 +2242,7 @@ class zl {
2262
2242
  * @param text 待替换内容
2263
2243
  * @param options 替换后是否选中
2264
2244
  */
2265
- replaceSelectedText(t, o = {
2245
+ replaceSelectedText(l, o = {
2266
2246
  // 是否选中
2267
2247
  select: !0,
2268
2248
  // 选中时,开始位置的偏移量
@@ -2273,17 +2253,17 @@ class zl {
2273
2253
  replaceAll: !1
2274
2254
  }) {
2275
2255
  if (o.replaceAll) {
2276
- this.setValue(t);
2256
+ this.setValue(l);
2277
2257
  return;
2278
2258
  }
2279
- const { from: l } = this.view.state.selection.main;
2280
- if (this.view.dispatch(this.view.state.replaceSelection(t)), o.select) {
2281
- const r = l + t.length + o.deviationEnd;
2259
+ const { from: t } = this.view.state.selection.main;
2260
+ if (this.view.dispatch(this.view.state.replaceSelection(l)), o.select) {
2261
+ const r = t + l.length + o.deviationEnd;
2282
2262
  this.view.dispatch({
2283
- selection: fe.create(
2263
+ selection: be.create(
2284
2264
  [
2285
- fe.range(l + o.deviationStart, r),
2286
- fe.cursor(r)
2265
+ be.range(t + o.deviationStart, r),
2266
+ be.cursor(r)
2287
2267
  ],
2288
2268
  1
2289
2269
  )
@@ -2295,10 +2275,10 @@ class zl {
2295
2275
  *
2296
2276
  * @param tabSize 需要切换的大小
2297
2277
  */
2298
- setTabSize(t) {
2278
+ setTabSize(l) {
2299
2279
  this.toggleTabSize([
2300
- ce.tabSize.of(t),
2301
- Nt.of(" ".repeat(t))
2280
+ ge.tabSize.of(l),
2281
+ Dt.of(" ".repeat(l))
2302
2282
  ]);
2303
2283
  }
2304
2284
  /**
@@ -2306,61 +2286,61 @@ class zl {
2306
2286
  *
2307
2287
  * @param t 目标内容
2308
2288
  */
2309
- setPlaceholder(t) {
2310
- this.togglePlaceholder(Ft(t));
2289
+ setPlaceholder(l) {
2290
+ this.togglePlaceholder(It(l));
2311
2291
  }
2312
- foucs() {
2292
+ focus() {
2313
2293
  this.view.focus();
2314
2294
  }
2315
- setDisabled(t) {
2316
- this.toggleDisabled([$e.editable.of(!t)]);
2295
+ setDisabled(l) {
2296
+ this.toggleDisabled([Ee.editable.of(!l)]);
2317
2297
  }
2318
- setReadOnly(t) {
2319
- this.toggleReadOnly([ce.readOnly.of(t)]);
2298
+ setReadOnly(l) {
2299
+ this.toggleReadOnly([ge.readOnly.of(l)]);
2320
2300
  }
2321
- setMaxLength(t) {
2301
+ setMaxLength(l) {
2322
2302
  this.toggleMaxlength([
2323
- ce.changeFilter.of((o) => o.newDoc.length <= t)
2303
+ ge.changeFilter.of((o) => o.newDoc.length <= l)
2324
2304
  ]);
2325
2305
  }
2326
2306
  }
2327
- const Kl = (e) => {
2328
- const t = x("editorId");
2329
- return (l) => {
2330
- if (l.clipboardData) {
2331
- if (l.clipboardData.files.length > 0) {
2332
- const { files: r } = l.clipboardData;
2333
- C.emit(
2334
- t,
2307
+ const Gl = (e) => {
2308
+ const l = x("editorId");
2309
+ return (t) => {
2310
+ if (t.clipboardData) {
2311
+ if (t.clipboardData.files.length > 0) {
2312
+ const { files: r } = t.clipboardData;
2313
+ k.emit(
2314
+ l,
2335
2315
  "uploadImage",
2336
2316
  Array.from(r).filter((n) => /image\/.*/.test(n.type))
2337
- ), l.preventDefault();
2317
+ ), t.preventDefault();
2338
2318
  }
2339
- if (e.autoDetectCode && l.clipboardData.types.includes("vscode-editor-data")) {
2340
- const r = JSON.parse(l.clipboardData.getData("vscode-editor-data"));
2341
- C.emit(t, "replace", "code", {
2319
+ if (e.autoDetectCode && t.clipboardData.types.includes("vscode-editor-data")) {
2320
+ const r = JSON.parse(t.clipboardData.getData("vscode-editor-data"));
2321
+ k.emit(l, "replace", "code", {
2342
2322
  mode: r.mode,
2343
- text: l.clipboardData.getData("text/plain")
2344
- }), l.preventDefault();
2323
+ text: t.clipboardData.getData("text/plain")
2324
+ }), t.preventDefault();
2345
2325
  }
2346
2326
  }
2347
2327
  };
2348
- }, Xl = (e) => {
2349
- const t = x("editorId");
2350
- A(() => {
2351
- C.on(t, {
2352
- name: wt,
2328
+ }, Kl = (e) => {
2329
+ const l = x("editorId");
2330
+ H(() => {
2331
+ k.on(l, {
2332
+ name: Ct,
2353
2333
  callback() {
2354
2334
  var o;
2355
- (o = e.value) == null || o.foucs();
2335
+ (o = e.value) == null || o.focus();
2356
2336
  }
2357
2337
  });
2358
2338
  });
2359
- }, Zl = (e, t) => [
2339
+ }, zl = (e, l) => [
2360
2340
  {
2361
2341
  key: "Ctrl-b",
2362
2342
  mac: "Cmd-b",
2363
- run: () => (C.emit(e, "replace", "bold"), !0)
2343
+ run: () => (k.emit(e, "replace", "bold"), !0)
2364
2344
  },
2365
2345
  {
2366
2346
  key: "Ctrl-d",
@@ -2371,299 +2351,303 @@ const Kl = (e) => {
2371
2351
  {
2372
2352
  key: "Ctrl-s",
2373
2353
  mac: "Cmd-s",
2374
- run: (L) => (C.emit(e, me, L.state.doc.toString()), !0),
2375
- shift: () => (C.emit(e, "replace", "strikeThrough"), !0)
2354
+ run: (I) => (k.emit(e, pe, I.state.doc.toString()), !0),
2355
+ shift: () => (k.emit(e, "replace", "strikeThrough"), !0)
2376
2356
  },
2377
2357
  {
2378
2358
  key: "Ctrl-u",
2379
2359
  mac: "Cmd-u",
2380
- run: () => (C.emit(e, "replace", "underline"), !0),
2381
- shift: () => (C.emit(e, "replace", "unorderedList"), !0)
2360
+ run: () => (k.emit(e, "replace", "underline"), !0),
2361
+ shift: () => (k.emit(e, "replace", "unorderedList"), !0)
2382
2362
  },
2383
2363
  {
2384
2364
  key: "Ctrl-i",
2385
2365
  mac: "Cmd-i",
2386
- run: () => (C.emit(e, "replace", "italic"), !0),
2387
- shift: () => (C.emit(e, "openModals", "image"), !0)
2366
+ run: () => (k.emit(e, "replace", "italic"), !0),
2367
+ shift: () => (k.emit(e, "openModals", "image"), !0)
2388
2368
  },
2389
2369
  {
2390
2370
  key: "Ctrl-1",
2391
2371
  mac: "Cmd-1",
2392
- run: () => (C.emit(e, "replace", "h1"), !0)
2372
+ run: () => (k.emit(e, "replace", "h1"), !0)
2393
2373
  },
2394
2374
  {
2395
2375
  key: "Ctrl-2",
2396
2376
  mac: "Cmd-2",
2397
- run: () => (C.emit(e, "replace", "h2"), !0)
2377
+ run: () => (k.emit(e, "replace", "h2"), !0)
2398
2378
  },
2399
2379
  {
2400
2380
  key: "Ctrl-3",
2401
2381
  mac: "Cmd-3",
2402
- run: () => (C.emit(e, "replace", "h3"), !0)
2382
+ run: () => (k.emit(e, "replace", "h3"), !0)
2403
2383
  },
2404
2384
  {
2405
2385
  key: "Ctrl-4",
2406
2386
  mac: "Cmd-4",
2407
- run: () => (C.emit(e, "replace", "h4"), !0)
2387
+ run: () => (k.emit(e, "replace", "h4"), !0)
2408
2388
  },
2409
2389
  {
2410
2390
  key: "Ctrl-5",
2411
2391
  mac: "Cmd-5",
2412
- run: () => (C.emit(e, "replace", "h5"), !0)
2392
+ run: () => (k.emit(e, "replace", "h5"), !0)
2413
2393
  },
2414
2394
  {
2415
2395
  key: "Ctrl-6",
2416
2396
  mac: "Cmd-6",
2417
- run: () => (C.emit(e, "replace", "h6"), !0)
2397
+ run: () => (k.emit(e, "replace", "h6"), !0)
2418
2398
  },
2419
2399
  {
2420
2400
  key: "Ctrl-ArrowUp",
2421
2401
  mac: "Cmd-ArrowUp",
2422
- run: () => (C.emit(e, "replace", "sup"), !0)
2402
+ run: () => (k.emit(e, "replace", "sup"), !0)
2423
2403
  },
2424
2404
  {
2425
2405
  key: "Ctrl-ArrowDown",
2426
2406
  mac: "Cmd-ArrowDown",
2427
- run: () => (C.emit(e, "replace", "sub"), !0)
2407
+ run: () => (k.emit(e, "replace", "sub"), !0)
2428
2408
  },
2429
2409
  {
2430
2410
  key: "Ctrl-o",
2431
2411
  mac: "Cmd-o",
2432
- run: () => (C.emit(e, "replace", "orderedList"), !0)
2412
+ run: () => (k.emit(e, "replace", "orderedList"), !0)
2433
2413
  },
2434
2414
  {
2435
2415
  key: "Ctrl-c",
2436
2416
  mac: "Cmd-c",
2437
- shift: () => (C.emit(e, "replace", "code"), !0),
2438
- any(L, S) {
2439
- return (S.ctrlKey || S.metaKey) && S.altKey && S.code === "KeyC" ? (C.emit(e, "replace", "codeRow"), !0) : !1;
2417
+ shift: () => (k.emit(e, "replace", "code"), !0),
2418
+ any(I, w) {
2419
+ return (w.ctrlKey || w.metaKey) && w.altKey && w.code === "KeyC" ? (k.emit(e, "replace", "codeRow"), !0) : !1;
2440
2420
  }
2441
2421
  },
2442
2422
  {
2443
2423
  key: "Ctrl-l",
2444
2424
  mac: "Cmd-l",
2445
- run: () => (C.emit(e, "openModals", "link"), !0)
2425
+ run: () => (k.emit(e, "openModals", "link"), !0)
2446
2426
  },
2447
2427
  {
2448
2428
  key: "Ctrl-f",
2449
2429
  mac: "Cmd-f",
2450
- shift: () => t.noPrettier ? !1 : (C.emit(e, "replace", "prettier"), !0)
2430
+ shift: () => l.noPrettier ? !1 : (k.emit(e, "replace", "prettier"), !0)
2451
2431
  },
2452
2432
  {
2453
- any: (L, S) => (S.ctrlKey || S.metaKey) && S.altKey && S.shiftKey && S.code === "KeyT" ? (C.emit(e, "replace", "table"), !0) : !1
2433
+ any: (I, w) => (w.ctrlKey || w.metaKey) && w.altKey && w.shiftKey && w.code === "KeyT" ? (k.emit(e, "replace", "table"), !0) : !1
2454
2434
  }
2455
- ], Jl = (e) => {
2456
- const t = x("tabWidth"), o = x("editorId"), l = x("theme"), r = F(), n = F(), a = Zl(o, e), c = Kl(e), m = [
2457
- Mt.of([...a, Pt]),
2458
- Ht,
2459
- jt({ codeLanguages: Rt }),
2435
+ ], Xl = (e) => {
2436
+ const l = x("tabWidth"), o = x("editorId"), t = x("theme"), r = B(), n = de(), a = zl(o, e), d = Gl(e), m = [
2437
+ Ht.of([...a, Rt]),
2438
+ Et,
2439
+ Mt({ codeLanguages: Ft }),
2460
2440
  // 横向换行
2461
- ae.lineWrapping,
2462
- ae.updateListener.of((d) => {
2463
- e.onChange(d.state.doc.toString());
2441
+ fe.lineWrapping,
2442
+ fe.updateListener.of((c) => {
2443
+ c.docChanged && e.onChange(c.state.doc.toString());
2464
2444
  }),
2465
- ae.domEventHandlers({
2466
- paste: c,
2445
+ fe.domEventHandlers({
2446
+ paste: d,
2467
2447
  blur: e.onBlur,
2468
2448
  focus: e.onFocus
2469
2449
  })
2470
- ], u = () => l.value === "light" ? I.codeMirrorExtensions(
2471
- l.value,
2472
- [...m, Gl],
2450
+ ], u = () => t.value === "light" ? A.codeMirrorExtensions(
2451
+ t.value,
2452
+ [...m, ql],
2473
2453
  a
2474
- ) : I.codeMirrorExtensions(
2475
- l.value,
2476
- [...m, jl],
2454
+ ) : A.codeMirrorExtensions(
2455
+ t.value,
2456
+ [...m, Ml],
2477
2457
  a
2478
2458
  );
2479
- return A(() => {
2480
- const d = ce.create({
2459
+ return H(() => {
2460
+ const c = ge.create({
2481
2461
  doc: e.value
2482
- }), f = new ae({
2483
- state: d,
2462
+ }), f = new fe({
2463
+ state: c,
2484
2464
  parent: r.value
2485
2465
  });
2486
- n.value = new zl(f), n.value.setTabSize(t), n.value.setExtensions(u()), n.value.setPlaceholder(e.placeholder), n.value.setDisabled(e.disabled), n.value.setReadOnly(e.readonly), e.autofocus && f.focus(), e.maxlength && n.value.setMaxLength(e.maxlength), C.on(o, {
2466
+ n.value = new Wl(f), n.value.setTabSize(l), n.value.setExtensions(u()), n.value.setPlaceholder(e.placeholder), n.value.setDisabled(e.disabled), n.value.setReadOnly(e.readonly), e.autofocus && f.focus(), e.maxlength && n.value.setMaxLength(e.maxlength), k.on(o, {
2487
2467
  name: "ctrlZ",
2488
2468
  callback() {
2489
- Ot(f);
2469
+ jt(f);
2490
2470
  }
2491
- }), C.on(o, {
2471
+ }), k.on(o, {
2492
2472
  name: "ctrlShiftZ",
2493
2473
  callback() {
2494
- Dt(f);
2474
+ Pt(f);
2495
2475
  }
2496
- }), C.on(o, {
2476
+ }), k.on(o, {
2497
2477
  name: "replace",
2498
- callback(h, v = {}) {
2499
- var p;
2500
- const { text: b, options: k } = Tl(h, n.value, v);
2501
- (p = n.value) == null || p.replaceSelectedText(b, k);
2478
+ callback(h, p = {}) {
2479
+ var y;
2480
+ const { text: v, options: b } = $l(h, n.value, p);
2481
+ (y = n.value) == null || y.replaceSelectedText(v, b);
2502
2482
  }
2503
2483
  });
2504
- }), T(
2505
- () => l.value,
2484
+ }), S(
2485
+ () => t.value,
2506
2486
  () => {
2507
- var d, f;
2508
- l.value === "dark" ? (d = n.value) == null || d.setExtensions(u()) : (f = n.value) == null || f.setExtensions(u());
2487
+ var c, f;
2488
+ t.value === "dark" ? (c = n.value) == null || c.setExtensions(u()) : (f = n.value) == null || f.setExtensions(u());
2509
2489
  }
2510
- ), T(
2490
+ ), S(
2511
2491
  () => e.value,
2512
2492
  () => {
2513
- var d, f;
2514
- ((d = n.value) == null ? void 0 : d.getValue()) !== e.value && ((f = n.value) == null || f.setValue(e.value));
2493
+ var c, f;
2494
+ ((c = n.value) == null ? void 0 : c.getValue()) !== e.value && ((f = n.value) == null || f.setValue(e.value));
2515
2495
  }
2516
- ), T(
2496
+ ), S(
2517
2497
  () => e.value,
2518
2498
  () => {
2519
- var d;
2520
- (d = n.value) == null || d.setPlaceholder(e.placeholder);
2499
+ var c;
2500
+ (c = n.value) == null || c.setPlaceholder(e.placeholder);
2521
2501
  }
2522
- ), T(
2502
+ ), S(
2523
2503
  () => e.disabled,
2524
2504
  () => {
2525
- var d;
2526
- (d = n.value) == null || d.setDisabled(e.disabled);
2505
+ var c;
2506
+ (c = n.value) == null || c.setDisabled(e.disabled);
2527
2507
  }
2528
- ), T(
2508
+ ), S(
2529
2509
  () => e.readonly,
2530
2510
  () => {
2531
- var d;
2532
- (d = n.value) == null || d.setDisabled(e.readonly);
2511
+ var c;
2512
+ (c = n.value) == null || c.setDisabled(e.readonly);
2533
2513
  }
2534
- ), T(
2514
+ ), S(
2535
2515
  () => e.maxlength,
2536
2516
  () => {
2537
- var d;
2538
- e.maxlength && ((d = n.value) == null || d.setMaxLength(e.maxlength));
2517
+ var c;
2518
+ e.maxlength && ((c = n.value) == null || c.setMaxLength(e.maxlength));
2539
2519
  }
2540
- ), Xl(n), {
2520
+ ), Kl(n), {
2541
2521
  inputWrapperRef: r,
2542
2522
  codeMirrorUt: n
2543
2523
  };
2544
- }, Yl = (e, t) => {
2545
- const o = x("editorId"), l = ee(() => {
2524
+ }, Zl = (e, l) => {
2525
+ const o = x("editorId"), t = ve(() => {
2546
2526
  const r = document.querySelectorAll(`#${o}-preview img`);
2547
- r.length !== 0 && _t(r, {
2527
+ r.length !== 0 && Ot(r, {
2548
2528
  background: "#00000073"
2549
2529
  });
2550
2530
  });
2551
- A(l), T([t, Q(e.setting, "preview")], l);
2552
- }, Ql = (e, t) => {
2553
- const o = x("editorId"), l = x("usedLanguageText"), r = () => {
2554
- document.querySelectorAll(`#${o}-preview pre`).forEach((c) => {
2531
+ H(t), S([l, ne(e.setting, "preview")], t);
2532
+ }, Jl = (e, l) => {
2533
+ const o = x("editorId"), t = x("usedLanguageText"), r = () => {
2534
+ document.querySelectorAll(`#${o}-preview pre`).forEach((d) => {
2555
2535
  var f, h;
2556
2536
  let m = -1;
2557
- (f = c.querySelector(".copy-button")) == null || f.remove();
2558
- const u = ((h = l.value.copyCode) == null ? void 0 : h.text) || "复制代码", d = document.createElement("span");
2559
- d.setAttribute("class", "copy-button"), d.dataset.tips = u, d.innerHTML = `<svg class="${s}-icon" aria-hidden="true"><use xlink:href="#${s}-icon-copy"></use></svg>`, d.addEventListener("click", () => {
2560
- var y, $;
2537
+ (f = d.querySelector(".copy-button")) == null || f.remove();
2538
+ const u = ((h = t.value.copyCode) == null ? void 0 : h.text) || "复制代码", c = document.createElement("span");
2539
+ c.setAttribute("class", "copy-button"), c.dataset.tips = u, c.innerHTML = `<svg class="${s}-icon" aria-hidden="true"><use xlink:href="#${s}-icon-copy"></use></svg>`, c.addEventListener("click", () => {
2540
+ var C, $;
2561
2541
  clearTimeout(m);
2562
- const v = c.querySelector("code").innerText, b = Vt(e.formatCopiedText(v)), k = ((y = l.value.copyCode) == null ? void 0 : y.successTips) || "已复制!", p = (($ = l.value.copyCode) == null ? void 0 : $.failTips) || "已复制!";
2563
- d.dataset.tips = b ? k : p, m = window.setTimeout(() => {
2564
- d.dataset.tips = u;
2542
+ const p = d.querySelector("code").innerText, v = _t(e.formatCopiedText(p)), b = ((C = t.value.copyCode) == null ? void 0 : C.successTips) || "已复制!", y = (($ = t.value.copyCode) == null ? void 0 : $.failTips) || "已复制!";
2543
+ c.dataset.tips = v ? b : y, m = window.setTimeout(() => {
2544
+ c.dataset.tips = u;
2565
2545
  }, 1500);
2566
- }), c.appendChild(d);
2546
+ }), d.appendChild(c);
2567
2547
  });
2568
2548
  }, n = () => {
2569
- z(r);
2570
- }, a = (c) => {
2571
- c && z(r);
2549
+ Y(r);
2550
+ }, a = (d) => {
2551
+ d && Y(r);
2572
2552
  };
2573
- T(() => t.value, n), T(() => e.setting.preview, a), T(() => e.setting.htmlPreview, a), T(() => l.value, r), A(r);
2574
- }, eo = (e) => {
2553
+ S(() => l.value, n), S(() => e.setting.preview, a), S(() => e.setting.htmlPreview, a), S(() => t.value, r), H(r);
2554
+ }, Yl = (e) => {
2575
2555
  var n;
2576
- const t = (n = I.editorExtensions) == null ? void 0 : n.highlight, o = t == null ? void 0 : t.instance, l = x("highlight"), r = de(o);
2577
- return A(() => {
2556
+ const l = (n = A.editorExtensions) == null ? void 0 : n.highlight, o = l == null ? void 0 : l.instance, t = x("highlight"), r = de(o);
2557
+ return H(() => {
2578
2558
  if (e.noHighlight)
2579
2559
  return;
2580
2560
  if (!r.value) {
2581
- const c = document.createElement("script");
2582
- c.src = l.value.js, c.onload = () => {
2561
+ const d = document.createElement("script");
2562
+ d.src = t.value.js, d.onload = () => {
2583
2563
  r.value = window.hljs;
2584
- }, c.id = `${s}-hljs`, O(c, "hljs");
2564
+ }, d.id = `${s}-hljs`, V(d, "hljs");
2585
2565
  }
2586
2566
  const a = document.createElement("link");
2587
- a.rel = "stylesheet", a.href = l.value.css, a.id = `${s}-hlCss`, O(a);
2588
- }), T(
2589
- () => l.value.css,
2567
+ a.rel = "stylesheet", a.href = t.value.css, a.id = `${s}-hlCss`, V(a);
2568
+ }), S(
2569
+ () => t.value.css,
2590
2570
  (a) => {
2591
- cl(`${s}-hlCss`, "href", a);
2571
+ al(`${s}-hlCss`, "href", a);
2592
2572
  }
2593
2573
  ), r;
2594
- }, to = (e) => {
2595
- const t = x("theme"), { editorExtensions: o } = I, l = o == null ? void 0 : o.mermaid, r = de(l == null ? void 0 : l.instance), n = de(!1), a = new Gt({
2574
+ }, Ql = (e) => {
2575
+ const l = x("theme"), { editorExtensions: o } = A, t = o == null ? void 0 : o.mermaid, r = de(t == null ? void 0 : t.instance), n = de(!1), a = new qt({
2596
2576
  max: 1e3,
2597
2577
  // 缓存10分钟
2598
2578
  ttl: 6e5
2599
- }), c = () => {
2600
- const u = (l == null ? void 0 : l.instance) || window.mermaid;
2579
+ }), d = () => {
2580
+ const u = (t == null ? void 0 : t.instance) || window.mermaid;
2601
2581
  !e.noMermaid && u && (u.initialize({
2602
2582
  startOnLoad: !1,
2603
- theme: t.value === "dark" ? "dark" : "default"
2583
+ theme: l.value === "dark" ? "dark" : "default"
2604
2584
  }), n.value = !n.value);
2605
2585
  };
2606
- return T(
2607
- () => t.value,
2586
+ return S(
2587
+ () => l.value,
2608
2588
  () => {
2609
- a.clear(), c();
2589
+ a.clear(), d();
2610
2590
  }
2611
- ), A(() => {
2612
- if (!e.noMermaid && !(l != null && l.instance)) {
2591
+ ), H(() => {
2592
+ if (!e.noMermaid && !(t != null && t.instance)) {
2613
2593
  const u = document.createElement("script");
2614
2594
  u.id = `${s}-mermaid`;
2615
- const d = (l == null ? void 0 : l.js) || Jt;
2616
- /\.mjs/.test(d) ? (u.setAttribute("type", "module"), u.innerHTML = `import mermaid from "${d}";window.mermaid=mermaid;document.getElementById('${s}-mermaid').dispatchEvent(new Event('load'));`) : u.src = d, u.onload = () => {
2617
- r.value = window.mermaid, c();
2618
- }, O(u, "mermaid");
2595
+ const c = (t == null ? void 0 : t.js) || Xt;
2596
+ /\.mjs/.test(c) ? (u.setAttribute("type", "module"), u.innerHTML = `import mermaid from "${c}";window.mermaid=mermaid;document.getElementById('${s}-mermaid').dispatchEvent(new Event('load'));`) : u.src = c, u.onload = () => {
2597
+ r.value = window.mermaid, d();
2598
+ }, V(u, "mermaid");
2619
2599
  }
2620
2600
  }), { mermaidRef: r, reRenderRef: n, replaceMermaid: () => {
2621
- z(() => {
2601
+ Y(() => {
2622
2602
  !e.noMermaid && r.value && document.querySelectorAll(
2623
2603
  `div.${s}-mermaid`
2624
- ).forEach(async (d) => {
2625
- let f = a.get(d.innerText);
2604
+ ).forEach(async (c) => {
2605
+ let f = a.get(c.innerText);
2626
2606
  if (!f) {
2627
- const v = al(), k = await (r.value.renderAsync || r.value.render)(v, d.innerText);
2628
- f = typeof k == "string" ? k : k.svg, a.set(d.innerText, f);
2607
+ const p = rl(), b = await (r.value.renderAsync || r.value.render)(p, c.innerText);
2608
+ f = typeof b == "string" ? b : b.svg, a.set(c.innerText, f);
2629
2609
  }
2630
2610
  const h = document.createElement("p");
2631
- h.className = `${s}-mermaid`, h.setAttribute("data-processed", ""), h.innerHTML = f, d.replaceWith(h);
2611
+ h.className = `${s}-mermaid`, h.setAttribute("data-processed", ""), h.innerHTML = f, c.dataset.line !== void 0 && (h.dataset.line = c.dataset.line), c.replaceWith(h);
2632
2612
  });
2633
2613
  });
2634
2614
  } };
2635
- }, lo = (e) => {
2615
+ }, eo = (e) => {
2636
2616
  var r;
2637
- const t = (r = I.editorExtensions) == null ? void 0 : r.katex, o = t == null ? void 0 : t.instance, l = de(o);
2638
- return A(() => {
2639
- if (!e.noKatex && !l.value) {
2617
+ const l = (r = A.editorExtensions) == null ? void 0 : r.katex, o = l == null ? void 0 : l.instance, t = de(o);
2618
+ return H(() => {
2619
+ if (!e.noKatex && !t.value) {
2640
2620
  const n = document.createElement("script");
2641
- n.src = (t == null ? void 0 : t.js) || Je.js, n.onload = () => {
2642
- l.value = window.katex;
2621
+ n.src = (l == null ? void 0 : l.js) || Xe.js, n.onload = () => {
2622
+ t.value = window.katex;
2643
2623
  }, n.id = `${s}-katex`;
2644
2624
  const a = document.createElement("link");
2645
- a.rel = "stylesheet", a.href = (t == null ? void 0 : t.css) || Je.css, a.id = `${s}-katexCss`, O(n, "katex"), O(a);
2625
+ a.rel = "stylesheet", a.href = (l == null ? void 0 : l.css) || Xe.css, a.id = `${s}-katexCss`, V(n, "katex"), V(a);
2646
2626
  }
2647
- }), l;
2648
- }, oo = (e, t) => {
2627
+ }), t;
2628
+ }, to = (e, l) => {
2649
2629
  const o = e.renderer.rules.fence.bind(e.renderer.rules);
2650
- e.renderer.rules.fence = (l, r, n, a, c) => {
2651
- const m = l[r], u = m.content.trim();
2652
- return m.info === "mermaid" ? `<div class="${s}-mermaid" data-mermaid-theme=${t.themeRef.value}>${u}</div>` : o(l, r, n, a, c);
2630
+ e.renderer.rules.fence = (t, r, n, a, d) => {
2631
+ const m = t[r], u = m.content.trim();
2632
+ if (m.info === "mermaid") {
2633
+ let c;
2634
+ return t[r].map && t[r].level === 0 && (c = t[r].map[0], t[r].attrSet("data-line", String(c))), `<div class="${s}-mermaid" ${c !== void 0 ? "data-line=" + c : ""} data-mermaid-theme=${l.themeRef.value}>${u}</div>`;
2635
+ }
2636
+ return o(t, r, n, a, d);
2653
2637
  };
2654
- }, vt = (e, t) => {
2655
- let o = !0, l = !0;
2656
- const r = e.posMax, n = t > 0 ? e.src.charCodeAt(t - 1) : -1, a = t + 1 <= r ? e.src.charCodeAt(t + 1) : -1;
2657
- return (n === 32 || n === 9 || a >= 48 && a <= 57) && (l = !1), (a === 32 || a === 9) && (o = !1), {
2638
+ }, ht = (e, l) => {
2639
+ let o = !0, t = !0;
2640
+ const r = e.posMax, n = l > 0 ? e.src.charCodeAt(l - 1) : -1, a = l + 1 <= r ? e.src.charCodeAt(l + 1) : -1;
2641
+ return (n === 32 || n === 9 || a >= 48 && a <= 57) && (t = !1), (a === 32 || a === 9) && (o = !1), {
2658
2642
  can_open: o,
2659
- can_close: l
2643
+ can_close: t
2660
2644
  };
2661
- }, no = (e, t) => {
2662
- let o, l, r, n;
2645
+ }, lo = (e, l) => {
2646
+ let o, t, r, n;
2663
2647
  if (e.src[e.pos] !== "$")
2664
2648
  return !1;
2665
- if (r = vt(e, e.pos), !r.can_open)
2666
- return t || (e.pending += "$"), e.pos += 1, !0;
2649
+ if (r = ht(e, e.pos), !r.can_open)
2650
+ return l || (e.pending += "$"), e.pos += 1, !0;
2667
2651
  const a = e.pos + 1;
2668
2652
  for (o = a; (o = e.src.indexOf("$", o)) !== -1; ) {
2669
2653
  for (n = o - 1; e.src[n] === "\\"; )
@@ -2672,31 +2656,31 @@ const Kl = (e) => {
2672
2656
  break;
2673
2657
  o += 1;
2674
2658
  }
2675
- return o === -1 ? (t || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (t || (e.pending += "$$"), e.pos = a + 1, !0) : (r = vt(e, o), r.can_close ? (t || (l = e.push("math_inline", "math", 0), l.markup = "$", l.content = e.src.slice(a, o)), e.pos = o + 1, !0) : (t || (e.pending += "$"), e.pos = a, !0));
2676
- }, ro = (e, t, o, l) => {
2677
- let r, n, a, c, m = !1, u = e.bMarks[t] + e.tShift[t], d = e.eMarks[t];
2678
- if (u + 2 > d || e.src.slice(u, u + 2) !== "$$")
2659
+ return o === -1 ? (l || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (l || (e.pending += "$$"), e.pos = a + 1, !0) : (r = ht(e, o), r.can_close ? (l || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(a, o)), e.pos = o + 1, !0) : (l || (e.pending += "$"), e.pos = a, !0));
2660
+ }, oo = (e, l, o, t) => {
2661
+ let r, n, a, d, m = !1, u = e.bMarks[l] + e.tShift[l], c = e.eMarks[l];
2662
+ if (u + 2 > c || e.src.slice(u, u + 2) !== "$$")
2679
2663
  return !1;
2680
- if (u += 2, r = e.src.slice(u, d), l)
2664
+ if (u += 2, r = e.src.slice(u, c), t)
2681
2665
  return !0;
2682
- for (r.trim().slice(-2) === "$$" && (r = r.trim().slice(0, -2), m = !0), a = t; !m && (a++, !(a >= o || (u = e.bMarks[a] + e.tShift[a], d = e.eMarks[a], u < d && e.tShift[a] < e.blkIndent))); )
2683
- e.src.slice(u, d).trim().slice(-2) === "$$" && (c = e.src.slice(0, d).lastIndexOf("$$"), n = e.src.slice(u, c), m = !0);
2666
+ for (r.trim().slice(-2) === "$$" && (r = r.trim().slice(0, -2), m = !0), a = l; !m && (a++, !(a >= o || (u = e.bMarks[a] + e.tShift[a], c = e.eMarks[a], u < c && e.tShift[a] < e.blkIndent))); )
2667
+ e.src.slice(u, c).trim().slice(-2) === "$$" && (d = e.src.slice(0, c).lastIndexOf("$$"), n = e.src.slice(u, d), m = !0);
2684
2668
  e.line = a + 1;
2685
2669
  const f = e.push("math_block", "math", 0);
2686
2670
  return f.block = !0, f.content = (r && r.trim() ? r + `
2687
- ` : "") + e.getLines(t + 1, a, e.tShift[t], !0) + (n && n.trim() ? n : ""), f.map = [t, e.line], f.markup = "$$", !0;
2688
- }, io = (e, t) => {
2671
+ ` : "") + e.getLines(l + 1, a, e.tShift[l], !0) + (n && n.trim() ? n : ""), f.map = [l, e.line], f.markup = "$$", !0;
2672
+ }, no = (e, l) => {
2689
2673
  const o = (r) => {
2690
- if (t.katexRef.value) {
2691
- const n = t.katexRef.value.renderToString(r, {
2674
+ if (l.katexRef.value) {
2675
+ const n = l.katexRef.value.renderToString(r, {
2692
2676
  throwOnError: !1
2693
2677
  });
2694
2678
  return `<span class="${s}-katex-inline" data-processed>${n}</span>`;
2695
2679
  } else
2696
2680
  return `<span class="${s}-katex-inline">${r}</span>`;
2697
- }, l = (r, n) => {
2698
- if (t.katexRef.value) {
2699
- const a = t.katexRef.value.renderToString(r, {
2681
+ }, t = (r, n) => {
2682
+ if (l.katexRef.value) {
2683
+ const a = l.katexRef.value.renderToString(r, {
2700
2684
  throwOnError: !1,
2701
2685
  displayMode: !0
2702
2686
  });
@@ -2704,113 +2688,127 @@ const Kl = (e) => {
2704
2688
  } else
2705
2689
  return `<p class="${s}-katex-block" data-line=${n}>${r}</p>`;
2706
2690
  };
2707
- e.inline.ruler.after("escape", "math_inline", no), e.block.ruler.after("blockquote", "math_block", ro, {
2691
+ e.inline.ruler.after("escape", "math_inline", lo), e.block.ruler.after("blockquote", "math_block", oo, {
2708
2692
  alt: ["paragraph", "reference", "blockquote", "list"]
2709
- }), e.renderer.rules.math_inline = (r, n) => o(r[n].content), e.renderer.rules.math_block = (r, n) => l(r[n].content, r[n].map[0]) + `
2693
+ }), e.renderer.rules.math_inline = (r, n) => o(r[n].content), e.renderer.rules.math_block = (r, n) => t(r[n].content, r[n].map[0]) + `
2710
2694
  `;
2711
- }, ao = (e, t) => {
2712
- t = t || {};
2713
- const o = 3, l = t.marker || "!", r = l.charCodeAt(0), n = l.length;
2714
- let a = "", c = "";
2715
- const m = (d, f, h, v, b) => {
2716
- const k = d[f];
2717
- return k.type === "admonition_open" ? (d[f].attrPush([
2695
+ }, ro = (e, l) => {
2696
+ l = l || {};
2697
+ const o = 3, t = l.marker || "!", r = t.charCodeAt(0), n = t.length;
2698
+ let a = "", d = "";
2699
+ const m = (c, f, h, p, v) => {
2700
+ const b = c[f];
2701
+ return b.type === "admonition_open" ? (c[f].attrPush([
2718
2702
  "class",
2719
- `${s}-admonition ${s}-admonition-${k.info}`
2720
- ]), d[f].attrSet("data-line", String(d[f].map[0]))) : k.type === "admonition_title_open" && d[f].attrPush(["class", `${s}-admonition-title`]), b.renderToken(d, f, h);
2721
- }, u = (d) => {
2722
- const f = d.trim().split(" ", 2);
2723
- c = "", a = f[0], f.length > 1 && (c = d.substring(a.length + 2)), (c === "" || !c) && (c = a);
2703
+ `${s}-admonition ${s}-admonition-${b.info}`
2704
+ ]), c[f].attrSet("data-line", String(c[f].map[0]))) : b.type === "admonition_title_open" && c[f].attrPush(["class", `${s}-admonition-title`]), v.renderToken(c, f, h);
2705
+ }, u = (c) => {
2706
+ const f = c.trim().split(" ", 2);
2707
+ d = "", a = f[0], f.length > 1 && (d = c.substring(a.length + 2)), (d === "" || !d) && (d = a);
2724
2708
  };
2725
2709
  e.block.ruler.before(
2726
2710
  "code",
2727
2711
  "admonition",
2728
- (d, f, h, v) => {
2729
- let b, k, p, y = !1, $ = d.bMarks[f] + d.tShift[f], w = d.eMarks[f];
2730
- if (r !== d.src.charCodeAt($))
2712
+ (c, f, h, p) => {
2713
+ let v, b, y, C = !1, $ = c.bMarks[f] + c.tShift[f], T = c.eMarks[f];
2714
+ if (r !== c.src.charCodeAt($))
2731
2715
  return !1;
2732
- for (b = $ + 1; b <= w && l[(b - $) % n] === d.src[b]; b++)
2716
+ for (v = $ + 1; v <= T && t[(v - $) % n] === c.src[v]; v++)
2733
2717
  ;
2734
- const L = Math.floor((b - $) / n);
2735
- if (L !== o)
2718
+ const I = Math.floor((v - $) / n);
2719
+ if (I !== o)
2736
2720
  return !1;
2737
- b -= (b - $) % n;
2738
- const S = d.src.slice($, b), j = d.src.slice(b, w);
2739
- if (u(j), v)
2721
+ v -= (v - $) % n;
2722
+ const w = c.src.slice($, v), F = c.src.slice(v, T);
2723
+ if (u(F), p)
2740
2724
  return !0;
2741
- for (k = f; k++, !(k >= h || ($ = d.bMarks[k] + d.tShift[k], w = d.eMarks[k], $ < w && d.sCount[k] < d.blkIndent)); )
2742
- if (r === d.src.charCodeAt($) && !(d.sCount[k] - d.blkIndent >= 4)) {
2743
- for (b = $ + 1; b <= w && l[(b - $) % n] === d.src[b]; b++)
2725
+ for (b = f; b++, !(b >= h || ($ = c.bMarks[b] + c.tShift[b], T = c.eMarks[b], $ < T && c.sCount[b] < c.blkIndent)); )
2726
+ if (r === c.src.charCodeAt($) && !(c.sCount[b] - c.blkIndent >= 4)) {
2727
+ for (v = $ + 1; v <= T && t[(v - $) % n] === c.src[v]; v++)
2744
2728
  ;
2745
- if (!(Math.floor((b - $) / n) < L) && (b -= (b - $) % n, b = d.skipSpaces(b), !(b < w))) {
2746
- y = !0;
2729
+ if (!(Math.floor((v - $) / n) < I) && (v -= (v - $) % n, v = c.skipSpaces(v), !(v < T))) {
2730
+ C = !0;
2747
2731
  break;
2748
2732
  }
2749
2733
  }
2750
- const B = d.parentType, q = d.lineMax;
2751
- return d.parentType = "root", d.lineMax = k, p = d.push("admonition_open", "div", 1), p.markup = S, p.block = !0, p.info = a, p.map = [f, k], p = d.push("admonition_title_open", "p", 1), p.markup = S + " " + a, p.map = [f, k], p = d.push("inline", "", 0), p.content = c, p.map = [f, d.line - 1], p.children = [], p = d.push("admonition_title_close", "p", -1), p.markup = S + " " + a, d.md.block.tokenize(d, f + 1, k), p = d.push("admonition_close", "div", -1), p.markup = d.src.slice($, b), p.block = !0, d.parentType = B, d.lineMax = q, d.line = k + (y ? 1 : 0), !0;
2734
+ const j = c.parentType, R = c.lineMax;
2735
+ return c.parentType = "root", c.lineMax = b, y = c.push("admonition_open", "div", 1), y.markup = w, y.block = !0, y.info = a, y.map = [f, b], y = c.push("admonition_title_open", "p", 1), y.markup = w + " " + a, y.map = [f, b], y = c.push("inline", "", 0), y.content = d, y.map = [f, c.line - 1], y.children = [], y = c.push("admonition_title_close", "p", -1), y.markup = w + " " + a, c.md.block.tokenize(c, f + 1, b), y = c.push("admonition_close", "div", -1), y.markup = c.src.slice($, v), y.block = !0, c.parentType = j, c.lineMax = R, c.line = b + (C ? 1 : 0), !0;
2752
2736
  },
2753
2737
  {
2754
2738
  alt: ["paragraph", "reference", "blockquote", "list"]
2755
2739
  }
2756
2740
  ), e.renderer.rules.admonition_open = m, e.renderer.rules.admonition_title_open = m, e.renderer.rules.admonition_title_close = m, e.renderer.rules.admonition_close = m;
2757
- }, so = (e, t) => {
2741
+ }, io = (e, l) => {
2758
2742
  let o;
2759
- e.core.ruler.push("headingLinks", (l) => {
2760
- o || (o = l.Token);
2761
- }), e.renderer.rules.heading_open = (l, r) => {
2762
- const n = l[r], a = l[r + 1].content, c = n.markup.length;
2763
- return t.headsRef.value.push({
2743
+ e.core.ruler.push("headingLinks", (t) => {
2744
+ o || (o = t.Token);
2745
+ }), e.renderer.rules.heading_open = (t, r) => {
2746
+ const n = t[r], a = t[r + 1].content, d = n.markup.length;
2747
+ return l.headsRef.value.push({
2764
2748
  text: a,
2765
- level: c
2749
+ level: d
2766
2750
  }), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
2767
2751
  "id",
2768
- t.mdHeadingId(a, c, t.headsRef.value.length)
2769
- )), e.renderer.renderToken(l, r, t);
2770
- }, e.renderer.rules.heading_close = (l, r, n, a, c) => c.renderToken(l, r, n);
2771
- }, pt = (e) => e.replace(
2772
- /<pre><code\sclass="language-([^>]*)">/g,
2773
- '<pre><code class="language-$1" language="$1">'
2774
- ), co = (e) => {
2775
- const { editorConfig: t, markdownItConfig: o } = I, l = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), c = F([]), m = eo(e), u = lo(e), { reRenderRef: d, replaceMermaid: f } = to(e), h = Ut({
2752
+ l.mdHeadingId(a, d, l.headsRef.value.length)
2753
+ )), e.renderer.renderToken(t, r, l);
2754
+ }, e.renderer.rules.heading_close = (t, r, n, a, d) => d.renderToken(t, r, n);
2755
+ }, ao = (e) => {
2756
+ [
2757
+ "paragraph_open",
2758
+ "table_open",
2759
+ "ordered_list_open",
2760
+ "bullet_list_open",
2761
+ "blockquote_open",
2762
+ "hr"
2763
+ ].forEach((l) => {
2764
+ e.renderer.rules[l] = (o, t, r, n, a) => {
2765
+ let d;
2766
+ return o[t].map && o[t].level === 0 && (d = o[t].map[0], o[t].attrSet("data-line", String(d))), a.renderToken(o, t, r);
2767
+ };
2768
+ }), ["html_block", "fence"].forEach((l) => {
2769
+ const o = e.renderer.rules[l];
2770
+ e.renderer.rules[l] = (t, r, n, a, d) => {
2771
+ let m;
2772
+ const u = o(t, r, n, a, d);
2773
+ return t[r].map && t[r].level === 0 ? (m = t[r].map[0], u.replace(/^(<[^>]*)/, `$1 data-line="${m}"`)) : u;
2774
+ };
2775
+ });
2776
+ }, so = (e) => {
2777
+ const { editorConfig: l, markdownItConfig: o } = A, t = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), d = B([]), m = Yl(e), u = eo(e), { reRenderRef: c, replaceMermaid: f } = Ql(e), h = Nt({
2776
2778
  html: !0,
2777
2779
  breaks: !0
2778
2780
  });
2779
- h.use(oo, { themeRef: a }), h.use(io, { katexRef: u }), h.use(qt, { figcaption: !0 }), h.use(ao), h.use(Wt), h.use(so, { mdHeadingId: e.mdHeadingId, headsRef: c }), h.renderer.rules.paragraph_open = h.renderer.rules.table_open = (p, y, $, w, L) => {
2780
- let S;
2781
- return p[y].map && p[y].level === 0 && (S = p[y].map[0], p[y].attrSet("data-line", String(S))), L.renderToken(p, y, $);
2782
- }, h.set({
2783
- highlight: (p, y) => {
2784
- if (e.noHighlight || !m.value)
2785
- return p;
2786
- const $ = m.value.getLanguage(y);
2787
- let w;
2788
- return $ ? w = m.value.highlight(p, {
2789
- language: y,
2781
+ h.use(no, { katexRef: u }), h.use(Vt, { figcaption: !0 }), h.use(ro), h.use(Ut), h.use(io, { mdHeadingId: e.mdHeadingId, headsRef: d }), e.noMermaid || h.use(to, { themeRef: a }), h.set({
2782
+ highlight: (y, C) => {
2783
+ let $;
2784
+ !e.noHighlight && m.value ? m.value.getLanguage(C) ? $ = m.value.highlight(y, {
2785
+ language: C,
2790
2786
  ignoreIllegals: !0
2791
- }).value : w = m.value.highlightAuto(p).value, r ? nl(w.trim()) : `<span class="code-block">${w.trim()}</span>`;
2787
+ }).value : $ = m.value.highlightAuto(y).value : $ = h.utils.escapeHtml(y);
2788
+ const T = r ? ll($.trim()) : `<span class="code-block">${$.trim()}</span>`;
2789
+ return `<pre><code class="language-${C}" language=${C}>${T}</code></pre>`;
2792
2790
  }
2793
- }), o(h);
2794
- const v = F(e.sanitize(pt(h.render(e.value)))), b = ee(
2791
+ }), ao(h), o(h);
2792
+ const p = B(e.sanitize(h.render(e.value))), v = ve(
2795
2793
  async () => {
2796
- c.value = [], v.value = e.sanitize(pt(h.render(e.value))), C.emit(l, "buildFinished", v.value), e.onHtmlChanged(v.value), f();
2794
+ d.value = [], p.value = e.sanitize(h.render(e.value)), k.emit(t, "buildFinished", p.value), e.onHtmlChanged(p.value), f();
2797
2795
  },
2798
- (t == null ? void 0 : t.renderDelay) !== void 0 ? t == null ? void 0 : t.renderDelay : n ? 0 : 500
2799
- ), k = D(() => e.noHighlight || m.value);
2800
- return T([Q(e, "value"), k, d], b), T(
2801
- () => c.value,
2802
- (p) => {
2803
- e.onGetCatalog(p), C.emit(l, "catalogChanged", p);
2796
+ (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : n ? 0 : 500
2797
+ ), b = U(() => e.noHighlight || m.value);
2798
+ return S([ne(e, "value"), b, c], v), S(
2799
+ () => d.value,
2800
+ (y) => {
2801
+ e.onGetCatalog(y), k.emit(t, "catalogChanged", y);
2804
2802
  }
2805
- ), A(() => {
2806
- C.on(l, {
2803
+ ), H(() => {
2804
+ k.on(t, {
2807
2805
  name: "pushCatalog",
2808
2806
  callback() {
2809
- C.emit(l, "catalogChanged", c.value);
2807
+ k.emit(t, "catalogChanged", d.value);
2810
2808
  }
2811
2809
  });
2812
- }), { html: v };
2813
- }, uo = {
2810
+ }), { html: p };
2811
+ }, co = {
2814
2812
  value: {
2815
2813
  type: String,
2816
2814
  default: ""
@@ -2900,21 +2898,21 @@ const Kl = (e) => {
2900
2898
  type: Boolean,
2901
2899
  default: !1
2902
2900
  }
2903
- }, mo = /* @__PURE__ */ M({
2901
+ }, uo = /* @__PURE__ */ M({
2904
2902
  name: "MDEditorContent",
2905
- props: uo,
2903
+ props: co,
2906
2904
  setup(e) {
2907
- const t = x("previewOnly"), o = x("showCodeRowNumber"), l = x("previewTheme"), r = x("editorId"), n = F(), a = F(), {
2908
- inputWrapperRef: c,
2905
+ const l = x("previewOnly"), o = x("showCodeRowNumber"), t = x("previewTheme"), r = x("editorId"), n = B(), a = B(), {
2906
+ inputWrapperRef: d,
2909
2907
  codeMirrorUt: m
2910
- } = Jl(e), {
2908
+ } = Xl(e), {
2911
2909
  html: u
2912
- } = co(e);
2913
- return wl(e, u, n, a, m), Ql(e, u), Yl(e, u), () => i("div", {
2910
+ } = so(e);
2911
+ return Cl(e, u, n, a, m), Jl(e, u), Zl(e, u), () => i("div", {
2914
2912
  class: `${s}-content`
2915
- }, [!t && i("div", {
2913
+ }, [!l && i("div", {
2916
2914
  class: `${s}-input-wrapper`,
2917
- ref: c
2915
+ ref: d
2918
2916
  }, null), e.setting.preview && i("div", {
2919
2917
  id: `${r}-preview-wrapper`,
2920
2918
  class: `${s}-preview-wrapper`,
@@ -2922,7 +2920,7 @@ const Kl = (e) => {
2922
2920
  key: "content-preview-wrapper"
2923
2921
  }, [i("article", {
2924
2922
  id: `${r}-preview`,
2925
- class: [`${s}-preview`, `${l == null ? void 0 : l.value}-theme`, o && `${s}-scrn`],
2923
+ class: [`${s}-preview`, `${t == null ? void 0 : t.value}-theme`, o && `${s}-scrn`],
2926
2924
  innerHTML: u.value
2927
2925
  }, null)]), e.setting.htmlPreview && i("div", {
2928
2926
  class: `${s}-preview-wrapper`,
@@ -2932,7 +2930,7 @@ const Kl = (e) => {
2932
2930
  class: `${s}-html`
2933
2931
  }, [u.value])])]);
2934
2932
  }
2935
- }), fo = /* @__PURE__ */ M({
2933
+ }), mo = /* @__PURE__ */ M({
2936
2934
  props: {
2937
2935
  modelValue: {
2938
2936
  type: String,
@@ -2940,18 +2938,18 @@ const Kl = (e) => {
2940
2938
  }
2941
2939
  },
2942
2940
  setup(e) {
2943
- const t = x("usedLanguageText");
2941
+ const l = x("usedLanguageText");
2944
2942
  return () => {
2945
- var o, l;
2943
+ var o, t;
2946
2944
  return i("div", {
2947
2945
  class: `${s}-footer-item`
2948
2946
  }, [i("label", {
2949
2947
  class: `${s}-footer-label`
2950
- }, [`${(o = t.value.footer) == null ? void 0 : o.markdownTotal}:`]), i("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
2948
+ }, [`${(o = l.value.footer) == null ? void 0 : o.markdownTotal}:`]), i("span", null, [((t = e.modelValue) == null ? void 0 : t.length) || 0])]);
2951
2949
  };
2952
2950
  }
2953
2951
  });
2954
- const go = {
2952
+ const fo = {
2955
2953
  checked: {
2956
2954
  type: Boolean,
2957
2955
  default: !1
@@ -2961,8 +2959,8 @@ const go = {
2961
2959
  default: () => {
2962
2960
  }
2963
2961
  }
2964
- }, ho = /* @__PURE__ */ M({
2965
- props: go,
2962
+ }, go = /* @__PURE__ */ M({
2963
+ props: fo,
2966
2964
  setup(e) {
2967
2965
  return () => i("div", {
2968
2966
  class: [`${s}-checkbox`, e.checked && `${s}-checkbox-checked`],
@@ -2971,7 +2969,7 @@ const go = {
2971
2969
  }
2972
2970
  }, null);
2973
2971
  }
2974
- }), vo = {
2972
+ }), ho = {
2975
2973
  scrollAuto: {
2976
2974
  type: Boolean
2977
2975
  },
@@ -2980,10 +2978,10 @@ const go = {
2980
2978
  default: () => {
2981
2979
  }
2982
2980
  }
2983
- }, po = /* @__PURE__ */ M({
2984
- props: vo,
2981
+ }, vo = /* @__PURE__ */ M({
2982
+ props: ho,
2985
2983
  setup(e) {
2986
- const t = x("usedLanguageText");
2984
+ const l = x("usedLanguageText");
2987
2985
  return () => {
2988
2986
  var o;
2989
2987
  return i("div", {
@@ -2993,13 +2991,13 @@ const go = {
2993
2991
  onClick: () => {
2994
2992
  e.onScrollAutoChange(!e.scrollAuto);
2995
2993
  }
2996
- }, [(o = t.value.footer) == null ? void 0 : o.scrollAuto]), i(ho, {
2994
+ }, [(o = l.value.footer) == null ? void 0 : o.scrollAuto]), i(go, {
2997
2995
  checked: e.scrollAuto,
2998
2996
  onChange: e.onScrollAutoChange
2999
2997
  }, null)]);
3000
2998
  };
3001
2999
  }
3002
- }), bo = {
3000
+ }), po = {
3003
3001
  modelValue: {
3004
3002
  type: String,
3005
3003
  default: ""
@@ -3019,41 +3017,41 @@ const go = {
3019
3017
  defFooters: {
3020
3018
  type: Object
3021
3019
  }
3022
- }, ko = /* @__PURE__ */ M({
3020
+ }, bo = /* @__PURE__ */ M({
3023
3021
  name: "MDEditorFooter",
3024
- props: bo,
3022
+ props: po,
3025
3023
  setup(e) {
3026
- const t = D(() => {
3027
- const l = e.footers.indexOf("="), r = l === -1 ? e.footers : e.footers.slice(0, l), n = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
3024
+ const l = U(() => {
3025
+ const t = e.footers.indexOf("="), r = t === -1 ? e.footers : e.footers.slice(0, t), n = t === -1 ? [] : e.footers.slice(t, Number.MAX_SAFE_INTEGER);
3028
3026
  return [r, n];
3029
- }), o = (l) => {
3030
- if (Ct.includes(l))
3031
- switch (l) {
3027
+ }), o = (t) => {
3028
+ if (kt.includes(t))
3029
+ switch (t) {
3032
3030
  case "markdownTotal":
3033
- return i(fo, {
3031
+ return i(mo, {
3034
3032
  modelValue: e.modelValue
3035
3033
  }, null);
3036
3034
  case "scrollSwitch":
3037
- return i(po, {
3035
+ return i(vo, {
3038
3036
  scrollAuto: e.scrollAuto,
3039
3037
  onScrollAutoChange: e.onScrollAutoChange
3040
3038
  }, null);
3041
3039
  }
3042
3040
  else
3043
- return e.defFooters instanceof Array ? e.defFooters[l] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[l] || "";
3041
+ return e.defFooters instanceof Array ? e.defFooters[t] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[t] || "";
3044
3042
  };
3045
3043
  return () => {
3046
- const l = t.value[0].map((n) => o(n)), r = t.value[1].map((n) => o(n));
3044
+ const t = l.value[0].map((n) => o(n)), r = l.value[1].map((n) => o(n));
3047
3045
  return i("div", {
3048
3046
  class: `${s}-footer`
3049
3047
  }, [i("div", {
3050
3048
  class: `${s}-footer-left`
3051
- }, [l]), i("div", {
3049
+ }, [t]), i("div", {
3052
3050
  class: `${s}-footer-right`
3053
3051
  }, [r])]);
3054
3052
  };
3055
3053
  }
3056
- }), yo = {
3054
+ }), ko = {
3057
3055
  tocItem: {
3058
3056
  type: Object,
3059
3057
  default: () => ({})
@@ -3076,27 +3074,27 @@ const go = {
3076
3074
  type: Number,
3077
3075
  default: 0
3078
3076
  }
3079
- }, Tt = /* @__PURE__ */ M({
3080
- props: yo,
3077
+ }, $t = /* @__PURE__ */ M({
3078
+ props: ko,
3081
3079
  setup(e) {
3082
3080
  return () => {
3083
3081
  const {
3084
- tocItem: t,
3082
+ tocItem: l,
3085
3083
  mdHeadingId: o,
3086
- scrollElement: l,
3084
+ scrollElement: t,
3087
3085
  onClick: r,
3088
3086
  scrollElementOffsetTop: n
3089
3087
  } = e;
3090
3088
  return i("div", {
3091
- class: [`${s}-catalog-link`, t.active && `${s}-catalog-active`],
3089
+ class: [`${s}-catalog-link`, l.active && `${s}-catalog-active`],
3092
3090
  onClick: (a) => {
3093
- r(a, t), a.stopPropagation();
3094
- const c = o(t.text, t.level, t.index), m = document.getElementById(c), u = l instanceof Element ? l : document.querySelector(l);
3091
+ r(a, l), a.stopPropagation();
3092
+ const d = o(l.text, l.level, l.index), m = document.getElementById(d), u = t instanceof Element ? t : document.querySelector(t);
3095
3093
  if (m && u) {
3096
- let d = m.offsetParent, f = m.offsetTop;
3097
- if (u.contains(d))
3098
- for (; d && u != d; )
3099
- f += d == null ? void 0 : d.offsetTop, d = d == null ? void 0 : d.offsetParent;
3094
+ let c = m.offsetParent, f = m.offsetTop;
3095
+ if (u.contains(c))
3096
+ for (; c && u != c; )
3097
+ f += c == null ? void 0 : c.offsetTop, c = c == null ? void 0 : c.offsetParent;
3100
3098
  u == null || u.scrollTo({
3101
3099
  top: f - n,
3102
3100
  behavior: "smooth"
@@ -3104,21 +3102,21 @@ const go = {
3104
3102
  }
3105
3103
  }
3106
3104
  }, [i("span", {
3107
- title: t.text
3108
- }, [t.text]), i("div", {
3105
+ title: l.text
3106
+ }, [l.text]), i("div", {
3109
3107
  class: `${s}-catalog-wrapper`
3110
- }, [t.children && t.children.map((a) => i(Tt, {
3108
+ }, [l.children && l.children.map((a) => i($t, {
3111
3109
  mdHeadingId: o,
3112
- key: `${t.text}-link-${a.level}-${a.text}`,
3110
+ key: `${l.text}-link-${a.level}-${a.text}`,
3113
3111
  tocItem: a,
3114
- scrollElement: l,
3112
+ scrollElement: t,
3115
3113
  onClick: r,
3116
3114
  scrollElementOffsetTop: n
3117
3115
  }, null))])]);
3118
3116
  };
3119
3117
  }
3120
3118
  });
3121
- const Co = {
3119
+ const yo = {
3122
3120
  /**
3123
3121
  * 编辑器的Id,务必与需要绑定的编辑器Id相同
3124
3122
  */
@@ -3167,26 +3165,26 @@ const Co = {
3167
3165
  onClick: {
3168
3166
  type: Function
3169
3167
  }
3170
- }, ue = /* @__PURE__ */ M({
3168
+ }, he = /* @__PURE__ */ M({
3171
3169
  name: "MdCatalog",
3172
- props: Co,
3170
+ props: yo,
3173
3171
  emits: ["onClick"],
3174
- setup(e, t) {
3175
- const o = e.editorId, l = N({
3172
+ setup(e, l) {
3173
+ const o = e.editorId, t = q({
3176
3174
  list: [],
3177
3175
  show: !1,
3178
3176
  scrollElement: e.scrollElement || `#${o}-preview-wrapper`
3179
- }), r = D(() => {
3177
+ }), r = U(() => {
3180
3178
  const a = [];
3181
- return l.list.forEach(({
3182
- text: c,
3179
+ return t.list.forEach(({
3180
+ text: d,
3183
3181
  level: m,
3184
3182
  active: u
3185
- }, d) => {
3183
+ }, c) => {
3186
3184
  const f = {
3187
3185
  level: m,
3188
- text: c,
3189
- index: d + 1,
3186
+ text: d,
3187
+ index: c + 1,
3190
3188
  active: !!u
3191
3189
  };
3192
3190
  if (a.length === 0)
@@ -3194,16 +3192,16 @@ const Co = {
3194
3192
  else {
3195
3193
  let h = a[a.length - 1];
3196
3194
  if (f.level > h.level)
3197
- for (let v = h.level + 1; v <= 6; v++) {
3195
+ for (let p = h.level + 1; p <= 6; p++) {
3198
3196
  const {
3199
- children: b
3197
+ children: v
3200
3198
  } = h;
3201
- if (!b) {
3199
+ if (!v) {
3202
3200
  h.children = [f];
3203
3201
  break;
3204
3202
  }
3205
- if (h = b[b.length - 1], f.level <= h.level) {
3206
- b.push(f);
3203
+ if (h = v[v.length - 1], f.level <= h.level) {
3204
+ v.push(f);
3207
3205
  break;
3208
3206
  }
3209
3207
  }
@@ -3212,43 +3210,43 @@ const Co = {
3212
3210
  }
3213
3211
  }), a;
3214
3212
  });
3215
- A(() => {
3216
- C.on(o, {
3213
+ H(() => {
3214
+ k.on(o, {
3217
3215
  name: "catalogChanged",
3218
3216
  callback: (a) => {
3219
- l.list = a.map((c, m) => m === 0 ? {
3220
- ...c,
3217
+ t.list = a.map((d, m) => m === 0 ? {
3218
+ ...d,
3221
3219
  active: !0
3222
3220
  } : {
3223
- ...c
3221
+ ...d
3224
3222
  });
3225
3223
  }
3226
- }), C.emit(o, "pushCatalog");
3224
+ }), k.emit(o, "pushCatalog");
3227
3225
  });
3228
3226
  const n = () => {
3229
- var c;
3230
- const a = l.scrollElement instanceof HTMLElement ? l.scrollElement : document.querySelector(l.scrollElement);
3231
- (c = a === document.documentElement ? window : a) == null || c.addEventListener("scroll", rl(() => {
3232
- if (l.list.length === 0)
3227
+ var d;
3228
+ const a = t.scrollElement instanceof HTMLElement ? t.scrollElement : document.querySelector(t.scrollElement);
3229
+ (d = a === document.documentElement ? window : a) == null || d.addEventListener("scroll", ol(() => {
3230
+ if (t.list.length === 0)
3233
3231
  return !1;
3234
3232
  const {
3235
3233
  activeHead: m
3236
- } = l.list.reduce((u, d, f) => {
3237
- const h = document.getElementById(e.mdHeadingId(d.text, d.level, f + 1));
3234
+ } = t.list.reduce((u, c, f) => {
3235
+ const h = document.getElementById(e.mdHeadingId(c.text, c.level, f + 1));
3238
3236
  if (h instanceof HTMLElement) {
3239
- const v = il(h, a);
3240
- if (v < e.offsetTop && v > u.minTop)
3237
+ const p = nl(h, a);
3238
+ if (p < e.offsetTop && p > u.minTop)
3241
3239
  return {
3242
- activeHead: d,
3243
- minTop: v
3240
+ activeHead: c,
3241
+ minTop: p
3244
3242
  };
3245
3243
  }
3246
3244
  return u;
3247
3245
  }, {
3248
- activeHead: l.list[0],
3246
+ activeHead: t.list[0],
3249
3247
  minTop: Number.MIN_SAFE_INTEGER
3250
3248
  });
3251
- l.list = l.list.map((u) => u === m ? {
3249
+ t.list = t.list.map((u) => u === m ? {
3252
3250
  ...u,
3253
3251
  active: !0
3254
3252
  } : {
@@ -3257,111 +3255,111 @@ const Co = {
3257
3255
  });
3258
3256
  }));
3259
3257
  };
3260
- return A(() => {
3261
- n(), C.on(o, {
3262
- name: ve,
3258
+ return H(() => {
3259
+ n(), k.on(o, {
3260
+ name: Ce,
3263
3261
  callback(a) {
3264
- a && z(n);
3262
+ a && Y(n);
3265
3263
  }
3266
3264
  });
3267
3265
  }), () => i("div", {
3268
3266
  class: `${s}-catalog${e.theme === "dark" ? "-dark" : ""} ${e.class}`
3269
- }, [r.value.map((a) => i(Tt, {
3267
+ }, [r.value.map((a) => i($t, {
3270
3268
  mdHeadingId: e.mdHeadingId,
3271
3269
  tocItem: a,
3272
3270
  key: `link-${a.level}-${a.text}`,
3273
- scrollElement: l.scrollElement,
3274
- onClick: (c, m) => {
3275
- e.onClick ? e.onClick(c, m) : t.emit("onClick", c, m);
3271
+ scrollElement: t.scrollElement,
3272
+ onClick: (d, m) => {
3273
+ e.onClick ? e.onClick(d, m) : l.emit("onClick", d, m);
3276
3274
  },
3277
3275
  scrollElementOffsetTop: e.scrollElementOffsetTop
3278
3276
  }, null))]);
3279
3277
  }
3280
- }), $o = (e, t) => {
3281
- const { editorId: o, previewOnly: l } = e, r = N({
3278
+ }), Co = (e, l) => {
3279
+ const { editorId: o, previewOnly: t } = e, r = q({
3282
3280
  // 是否已编译成html
3283
3281
  buildFinished: !1,
3284
3282
  // 存储当前最新的html
3285
3283
  html: ""
3286
3284
  });
3287
- T(
3285
+ S(
3288
3286
  () => e.modelValue,
3289
3287
  () => {
3290
3288
  r.buildFinished = !1;
3291
3289
  }
3292
- ), A(() => {
3293
- l || (C.on(o, {
3290
+ ), H(() => {
3291
+ t || (k.on(o, {
3294
3292
  name: "buildFinished",
3295
3293
  callback(n) {
3296
3294
  r.buildFinished = !0, r.html = n;
3297
3295
  }
3298
- }), C.on(o, {
3299
- name: me,
3296
+ }), k.on(o, {
3297
+ name: pe,
3300
3298
  callback() {
3301
3299
  const n = new Promise((a) => {
3302
3300
  if (r.buildFinished)
3303
3301
  a(r.html);
3304
3302
  else {
3305
- const c = (m) => {
3306
- a(m), C.remove(o, "buildFinished", c);
3303
+ const d = (m) => {
3304
+ a(m), k.remove(o, "buildFinished", d);
3307
3305
  };
3308
- C.on(o, {
3306
+ k.on(o, {
3309
3307
  name: "buildFinished",
3310
- callback: c
3308
+ callback: d
3311
3309
  });
3312
3310
  }
3313
3311
  });
3314
- e.onSave ? e.onSave(e.modelValue, n) : t.emit("onSave", e.modelValue, n);
3312
+ e.onSave ? e.onSave(e.modelValue, n) : l.emit("onSave", e.modelValue, n);
3315
3313
  }
3316
3314
  }));
3317
3315
  });
3318
- }, wo = (e) => {
3316
+ }, $o = (e) => {
3319
3317
  var n;
3320
- const { editorId: t, previewOnly: o } = e, l = (n = I == null ? void 0 : I.editorExtensions) == null ? void 0 : n.highlight;
3321
- W("editorId", t), W("tabWidth", e.tabWidth), W(
3318
+ const { editorId: l, previewOnly: o } = e, t = (n = A == null ? void 0 : A.editorExtensions) == null ? void 0 : n.highlight;
3319
+ Z("editorId", l), Z("tabWidth", e.tabWidth), Z(
3322
3320
  "theme",
3323
- D(() => e.theme)
3324
- ), W(
3321
+ U(() => e.theme)
3322
+ ), Z(
3325
3323
  "highlight",
3326
- D(() => {
3324
+ U(() => {
3327
3325
  const a = {
3328
- ...Ye,
3329
- ...l == null ? void 0 : l.css
3330
- }, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
3326
+ ...Ze,
3327
+ ...t == null ? void 0 : t.css
3328
+ }, d = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
3331
3329
  return {
3332
- js: (l == null ? void 0 : l.js) || Xt,
3333
- css: a[e.codeTheme] ? a[e.codeTheme][c] : Ye.atom[c]
3330
+ js: (t == null ? void 0 : t.js) || Kt,
3331
+ css: a[e.codeTheme] ? a[e.codeTheme][d] : Ze.atom[d]
3334
3332
  };
3335
3333
  })
3336
- ), W("previewOnly", o), W("showCodeRowNumber", e.showCodeRowNumber);
3337
- const r = D(() => {
3338
- var c;
3334
+ ), Z("previewOnly", o), Z("showCodeRowNumber", e.showCodeRowNumber);
3335
+ const r = U(() => {
3336
+ var d;
3339
3337
  const a = {
3340
- ...Ze,
3341
- ...(c = I == null ? void 0 : I.editorConfig) == null ? void 0 : c.languageUserDefined
3338
+ ...ze,
3339
+ ...(d = A == null ? void 0 : A.editorConfig) == null ? void 0 : d.languageUserDefined
3342
3340
  };
3343
- return a[e.language] ? a[e.language] : Ze["zh-CN"];
3341
+ return a[e.language] ? a[e.language] : ze["zh-CN"];
3344
3342
  });
3345
- W("usedLanguageText", r), W(
3343
+ Z("usedLanguageText", r), Z(
3346
3344
  "previewTheme",
3347
- D(() => e.previewTheme)
3345
+ U(() => e.previewTheme)
3348
3346
  );
3349
- }, To = (e) => {
3350
- var u, d, f, h, v, b;
3351
- const { noPrettier: t, previewOnly: o, noIconfont: l, noUploadImg: r } = e, { editorExtensions: n } = I, a = t || !!((d = (u = I.editorExtensions) == null ? void 0 : u.prettier) != null && d.prettierInstance), c = t || !!((h = (f = I.editorExtensions) == null ? void 0 : f.prettier) != null && h.parserMarkdownInstance), m = r || !!((b = (v = I.editorExtensions) == null ? void 0 : v.cropper) != null && b.instance);
3352
- A(() => {
3353
- var L, S, j, B;
3354
- const k = document.createElement("script");
3355
- k.src = (n == null ? void 0 : n.iconfont) || Kt, k.id = `${s}-icon`;
3356
- const p = document.createElement("script"), y = document.createElement("script");
3357
- p.src = ((L = n == null ? void 0 : n.prettier) == null ? void 0 : L.standaloneJs) || Ke.main, p.id = `${s}-prettier`, y.src = ((S = n == null ? void 0 : n.prettier) == null ? void 0 : S.parserMarkdownJs) || Ke.markdown, y.id = `${s}-prettierMD`;
3347
+ }, wo = (e) => {
3348
+ var u, c, f, h, p, v;
3349
+ const { noPrettier: l, previewOnly: o, noIconfont: t, noUploadImg: r } = e, { editorExtensions: n } = A, a = l || !!((c = (u = A.editorExtensions) == null ? void 0 : u.prettier) != null && c.prettierInstance), d = l || !!((h = (f = A.editorExtensions) == null ? void 0 : f.prettier) != null && h.parserMarkdownInstance), m = r || !!((v = (p = A.editorExtensions) == null ? void 0 : p.cropper) != null && v.instance);
3350
+ H(() => {
3351
+ var I, w, F, j;
3352
+ const b = document.createElement("script");
3353
+ b.src = (n == null ? void 0 : n.iconfont) || Gt, b.id = `${s}-icon`;
3354
+ const y = document.createElement("script"), C = document.createElement("script");
3355
+ y.src = ((I = n == null ? void 0 : n.prettier) == null ? void 0 : I.standaloneJs) || Ge.main, y.id = `${s}-prettier`, C.src = ((w = n == null ? void 0 : n.prettier) == null ? void 0 : w.parserMarkdownJs) || Ge.markdown, C.id = `${s}-prettierMD`;
3358
3356
  const $ = document.createElement("link");
3359
- $.rel = "stylesheet", $.href = ((j = n == null ? void 0 : n.cropper) == null ? void 0 : j.css) || Xe.css, $.id = `${s}-cropperCss`;
3360
- const w = document.createElement("script");
3361
- w.src = ((B = n == null ? void 0 : n.cropper) == null ? void 0 : B.js) || Xe.js, w.id = `${s}-cropper`, l || O(k), o || (m || (O($), O(w)), a || O(p), c || O(y));
3357
+ $.rel = "stylesheet", $.href = ((F = n == null ? void 0 : n.cropper) == null ? void 0 : F.css) || Ke.css, $.id = `${s}-cropperCss`;
3358
+ const T = document.createElement("script");
3359
+ T.src = ((j = n == null ? void 0 : n.cropper) == null ? void 0 : j.js) || Ke.js, T.id = `${s}-cropper`, t || V(b), o || (m || (V($), V(T)), a || V(y), d || V(C));
3362
3360
  });
3363
- }, So = (e, t) => {
3364
- const { editorId: o, previewOnly: l } = e, r = N({
3361
+ }, To = (e, l) => {
3362
+ const { editorId: o, previewOnly: t } = e, r = q({
3365
3363
  pageFullscreen: e.pageFullscreen,
3366
3364
  fullscreen: !1,
3367
3365
  preview: e.preview,
@@ -3370,66 +3368,66 @@ const Co = {
3370
3368
  r[m] = u === void 0 ? !r[m] : u, m === "preview" && r.preview ? r.htmlPreview = !1 : m === "htmlPreview" && r.htmlPreview && (r.preview = !1);
3371
3369
  };
3372
3370
  let a = "";
3373
- const c = () => {
3371
+ const d = () => {
3374
3372
  r.pageFullscreen || r.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = a;
3375
3373
  };
3376
- return T(() => [r.pageFullscreen, r.fullscreen], c), A(() => {
3377
- l || C.on(o, {
3374
+ return S(() => [r.pageFullscreen, r.fullscreen], d), H(() => {
3375
+ t || k.on(o, {
3378
3376
  name: "uploadImage",
3379
3377
  callback(m, u) {
3380
- const d = (f) => {
3381
- C.emit(o, "replace", "image", {
3378
+ const c = (f) => {
3379
+ k.emit(o, "replace", "image", {
3382
3380
  desc: "",
3383
3381
  urls: f
3384
3382
  }), u && u();
3385
3383
  };
3386
- e.onUploadImg ? e.onUploadImg(m, d) : t.emit("onUploadImg", m, d);
3384
+ e.onUploadImg ? e.onUploadImg(m, c) : l.emit("onUploadImg", m, c);
3387
3385
  }
3388
- }), a = document.body.style.overflow, c();
3386
+ }), a = document.body.style.overflow, d();
3389
3387
  }), [r, n];
3390
- }, xo = (e) => {
3391
- const { editorId: t } = e, o = F(!1);
3392
- A(() => {
3393
- C.on(t, {
3394
- name: we,
3388
+ }, So = (e) => {
3389
+ const { editorId: l } = e, o = B(!1);
3390
+ H(() => {
3391
+ k.on(l, {
3392
+ name: Le,
3395
3393
  callback: (r) => {
3396
3394
  r === void 0 ? o.value = !o.value : o.value = r;
3397
3395
  }
3398
3396
  });
3399
3397
  });
3400
- const l = D(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog"));
3401
- return [o, l];
3402
- }, Eo = (e, t, o, l, r) => {
3398
+ const t = U(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog"));
3399
+ return [o, t];
3400
+ }, xo = (e, l, o, t, r) => {
3403
3401
  const { editorId: n } = e;
3404
- T(
3405
- () => l.pageFullscreen,
3406
- (c) => {
3407
- C.emit(n, Qe, c);
3402
+ S(
3403
+ () => t.pageFullscreen,
3404
+ (d) => {
3405
+ k.emit(n, Je, d);
3408
3406
  }
3409
- ), T(
3410
- () => l.fullscreen,
3411
- (c) => {
3412
- C.emit(n, et, c);
3407
+ ), S(
3408
+ () => t.fullscreen,
3409
+ (d) => {
3410
+ k.emit(n, Ye, d);
3413
3411
  }
3414
- ), T(
3415
- () => l.preview,
3416
- (c) => {
3417
- C.emit(n, ve, c);
3412
+ ), S(
3413
+ () => t.preview,
3414
+ (d) => {
3415
+ k.emit(n, Ce, d);
3418
3416
  }
3419
- ), T(
3420
- () => l.htmlPreview,
3421
- (c) => {
3422
- C.emit(n, tt, c);
3417
+ ), S(
3418
+ () => t.htmlPreview,
3419
+ (d) => {
3420
+ k.emit(n, Qe, d);
3423
3421
  }
3424
- ), T(o, (c) => {
3425
- C.emit(n, lt, c);
3422
+ ), S(o, (d) => {
3423
+ k.emit(n, et, d);
3426
3424
  });
3427
3425
  const a = {
3428
- on(c, m) {
3429
- switch (c) {
3426
+ on(d, m) {
3427
+ switch (d) {
3430
3428
  case "pageFullscreen": {
3431
- C.on(n, {
3432
- name: Qe,
3429
+ k.on(n, {
3430
+ name: Je,
3433
3431
  callback(u) {
3434
3432
  m(u);
3435
3433
  }
@@ -3437,8 +3435,8 @@ const Co = {
3437
3435
  break;
3438
3436
  }
3439
3437
  case "fullscreen": {
3440
- C.on(n, {
3441
- name: et,
3438
+ k.on(n, {
3439
+ name: Ye,
3442
3440
  callback(u) {
3443
3441
  m(u);
3444
3442
  }
@@ -3446,8 +3444,8 @@ const Co = {
3446
3444
  break;
3447
3445
  }
3448
3446
  case "preview": {
3449
- C.on(n, {
3450
- name: ve,
3447
+ k.on(n, {
3448
+ name: Ce,
3451
3449
  callback(u) {
3452
3450
  m(u);
3453
3451
  }
@@ -3455,8 +3453,8 @@ const Co = {
3455
3453
  break;
3456
3454
  }
3457
3455
  case "htmlPreview": {
3458
- C.on(n, {
3459
- name: tt,
3456
+ k.on(n, {
3457
+ name: Qe,
3460
3458
  callback(u) {
3461
3459
  m(u);
3462
3460
  }
@@ -3464,8 +3462,8 @@ const Co = {
3464
3462
  break;
3465
3463
  }
3466
3464
  case "catalog": {
3467
- C.on(n, {
3468
- name: lt,
3465
+ k.on(n, {
3466
+ name: et,
3469
3467
  callback(u) {
3470
3468
  m(u);
3471
3469
  }
@@ -3474,33 +3472,33 @@ const Co = {
3474
3472
  }
3475
3473
  }
3476
3474
  },
3477
- togglePageFullscreen(c) {
3478
- r("pageFullscreen", c);
3475
+ togglePageFullscreen(d) {
3476
+ r("pageFullscreen", d);
3479
3477
  },
3480
- toggleFullscreen(c) {
3481
- C.emit(n, $t, c);
3478
+ toggleFullscreen(d) {
3479
+ k.emit(n, yt, d);
3482
3480
  },
3483
- togglePreview(c) {
3484
- r("preview", c);
3481
+ togglePreview(d) {
3482
+ r("preview", d);
3485
3483
  },
3486
- toggleHtmlPreview(c) {
3487
- r("htmlPreview", c);
3484
+ toggleHtmlPreview(d) {
3485
+ r("htmlPreview", d);
3488
3486
  },
3489
- toggleCatalog(c) {
3490
- C.emit(n, we, c);
3487
+ toggleCatalog(d) {
3488
+ k.emit(n, Le, d);
3491
3489
  },
3492
3490
  triggerSave() {
3493
- C.emit(n, me);
3491
+ k.emit(n, pe);
3494
3492
  },
3495
- insert(c) {
3496
- C.emit(n, "replace", "universal", { generate: c });
3493
+ insert(d) {
3494
+ k.emit(n, "replace", "universal", { generate: d });
3497
3495
  },
3498
3496
  focus() {
3499
- C.emit(n, wt);
3497
+ k.emit(n, Ct);
3500
3498
  }
3501
3499
  };
3502
- t.expose(a);
3503
- }, Lo = (e) => e, Ho = {
3500
+ l.expose(a);
3501
+ }, Eo = (e) => e, Lo = {
3504
3502
  /**
3505
3503
  * 主题
3506
3504
  *
@@ -3598,7 +3596,7 @@ const Co = {
3598
3596
  */
3599
3597
  toolbars: {
3600
3598
  type: Array,
3601
- default: yt
3599
+ default: bt
3602
3600
  },
3603
3601
  /**
3604
3602
  * 工具栏选择不显示
@@ -3637,7 +3635,7 @@ const Co = {
3637
3635
  */
3638
3636
  editorId: {
3639
3637
  type: String,
3640
- default: zt
3638
+ default: Wt
3641
3639
  },
3642
3640
  /**
3643
3641
  * 一个tab等于空格数
@@ -3680,7 +3678,7 @@ const Co = {
3680
3678
  */
3681
3679
  mdHeadingId: {
3682
3680
  type: Function,
3683
- default: Lo
3681
+ default: Eo
3684
3682
  },
3685
3683
  /**
3686
3684
  * 表格预设格子数
@@ -3755,7 +3753,7 @@ const Co = {
3755
3753
  */
3756
3754
  footers: {
3757
3755
  type: Array,
3758
- default: Ct
3756
+ default: kt
3759
3757
  },
3760
3758
  /**
3761
3759
  * 是否默认激活输入框和预览框同步滚动
@@ -3871,7 +3869,7 @@ const Co = {
3871
3869
  type: Boolean,
3872
3870
  default: !1
3873
3871
  }
3874
- }, Io = [
3872
+ }, Ao = [
3875
3873
  "onChange",
3876
3874
  "onSave",
3877
3875
  "onUploadImg",
@@ -3882,51 +3880,51 @@ const Co = {
3882
3880
  "onBlur",
3883
3881
  "onFocus"
3884
3882
  ];
3885
- const G = /* @__PURE__ */ M({
3883
+ const J = /* @__PURE__ */ M({
3886
3884
  name: "MdEditorV3",
3887
- props: Ho,
3888
- emits: Io,
3889
- setup(e, t) {
3885
+ props: Lo,
3886
+ emits: Ao,
3887
+ setup(e, l) {
3890
3888
  const {
3891
3889
  editorId: o,
3892
- previewOnly: l,
3890
+ previewOnly: t,
3893
3891
  noKatex: r,
3894
3892
  noMermaid: n,
3895
3893
  noPrettier: a,
3896
- noUploadImg: c,
3894
+ noUploadImg: d,
3897
3895
  noHighlight: m
3898
- } = e, u = N({
3896
+ } = e, u = q({
3899
3897
  scrollAuto: e.scrollAuto
3900
3898
  });
3901
- $o(e, t), wo(e), To(e);
3902
- const [d, f] = So(e, t), [h, v] = xo(e);
3903
- return ye(() => {
3904
- C.clear(o);
3905
- }), Eo(e, t, h, d, f), () => {
3906
- var p;
3907
- const b = _({
3899
+ Co(e, l), $o(e), wo(e);
3900
+ const [c, f] = To(e, l), [h, p] = So(e);
3901
+ return Se(() => {
3902
+ k.clear(o);
3903
+ }), xo(e, l, h, c, f), () => {
3904
+ var y;
3905
+ const v = W({
3908
3906
  props: e,
3909
- ctx: t
3910
- }, "defToolbars"), k = _({
3907
+ ctx: l
3908
+ }, "defToolbars"), b = W({
3911
3909
  props: e,
3912
- ctx: t
3910
+ ctx: l
3913
3911
  }, "defFooters");
3914
3912
  return i("div", {
3915
3913
  id: o,
3916
- class: [s, e.class, e.theme === "dark" && `${s}-dark`, d.fullscreen || d.pageFullscreen ? `${s}-fullscreen` : "", l && `${s}-previewOnly`],
3914
+ class: [s, e.class, e.theme === "dark" && `${s}-dark`, c.fullscreen || c.pageFullscreen ? `${s}-fullscreen` : "", t && `${s}-previewOnly`],
3917
3915
  style: e.style
3918
- }, [!l && i(yl, {
3916
+ }, [!t && i(bl, {
3919
3917
  noPrettier: a,
3920
3918
  toolbars: e.toolbars,
3921
3919
  toolbarsExclude: e.toolbarsExclude,
3922
- setting: d,
3920
+ setting: c,
3923
3921
  updateSetting: f,
3924
3922
  tableShape: e.tableShape,
3925
- defToolbars: b,
3926
- noUploadImg: c
3927
- }, null), i(mo, {
3923
+ defToolbars: v,
3924
+ noUploadImg: d
3925
+ }, null), i(uo, {
3928
3926
  value: e.modelValue,
3929
- setting: d,
3927
+ setting: c,
3930
3928
  mdHeadingId: e.mdHeadingId,
3931
3929
  noMermaid: n,
3932
3930
  noPrettier: a,
@@ -3941,28 +3939,28 @@ const G = /* @__PURE__ */ M({
3941
3939
  maxlength: e.maxLength,
3942
3940
  autoDetectCode: e.autoDetectCode,
3943
3941
  noHighlight: m,
3944
- onChange: (y) => {
3945
- e.onChange ? e.onChange(y) : (t.emit("update:modelValue", y), t.emit("onChange", y));
3942
+ onChange: (C) => {
3943
+ e.onChange ? e.onChange(C) : (l.emit("update:modelValue", C), l.emit("onChange", C));
3946
3944
  },
3947
- onHtmlChanged: (y) => {
3948
- e.onHtmlChanged ? e.onHtmlChanged(y) : t.emit("onHtmlChanged", y);
3945
+ onHtmlChanged: (C) => {
3946
+ e.onHtmlChanged ? e.onHtmlChanged(C) : l.emit("onHtmlChanged", C);
3949
3947
  },
3950
- onGetCatalog: (y) => {
3951
- e.onGetCatalog ? e.onGetCatalog(y) : t.emit("onGetCatalog", y);
3948
+ onGetCatalog: (C) => {
3949
+ e.onGetCatalog ? e.onGetCatalog(C) : l.emit("onGetCatalog", C);
3952
3950
  },
3953
- onBlur: (y) => {
3954
- e.onBlur ? e.onBlur(y) : t.emit("onBlur", y);
3951
+ onBlur: (C) => {
3952
+ e.onBlur ? e.onBlur(C) : l.emit("onBlur", C);
3955
3953
  },
3956
- onFocus: (y) => {
3957
- e.onFocus ? e.onFocus(y) : t.emit("onFocus", y);
3954
+ onFocus: (C) => {
3955
+ e.onFocus ? e.onFocus(C) : l.emit("onFocus", C);
3958
3956
  }
3959
- }, null), !l && ((p = e.footers) == null ? void 0 : p.length) > 0 && i(ko, {
3957
+ }, null), !t && ((y = e.footers) == null ? void 0 : y.length) > 0 && i(bo, {
3960
3958
  modelValue: e.modelValue,
3961
3959
  footers: e.footers,
3962
- defFooters: k,
3960
+ defFooters: b,
3963
3961
  scrollAuto: u.scrollAuto,
3964
- onScrollAutoChange: (y) => u.scrollAuto = y
3965
- }, null), v.value && !l && i(ue, {
3962
+ onScrollAutoChange: (C) => u.scrollAuto = C
3963
+ }, null), p.value && !t && i(he, {
3966
3964
  theme: e.theme,
3967
3965
  style: {
3968
3966
  display: h.value ? "block" : "none"
@@ -3973,7 +3971,7 @@ const G = /* @__PURE__ */ M({
3973
3971
  }, null)]);
3974
3972
  };
3975
3973
  }
3976
- }), Ao = {
3974
+ }), Io = {
3977
3975
  title: {
3978
3976
  type: String,
3979
3977
  default: ""
@@ -3985,26 +3983,26 @@ const G = /* @__PURE__ */ M({
3985
3983
  onClick: {
3986
3984
  type: Function
3987
3985
  }
3988
- }, pe = /* @__PURE__ */ M({
3986
+ }, $e = /* @__PURE__ */ M({
3989
3987
  name: "NormalToolbar",
3990
- props: Ao,
3988
+ props: Io,
3991
3989
  emits: ["onClick"],
3992
- setup(e, t) {
3990
+ setup(e, l) {
3993
3991
  return () => {
3994
- const o = _({
3992
+ const o = W({
3995
3993
  props: e,
3996
- ctx: t
3994
+ ctx: l
3997
3995
  }, "trigger");
3998
3996
  return i("div", {
3999
3997
  class: `${s}-toolbar-item`,
4000
3998
  title: e.title,
4001
- onClick: (l) => {
4002
- e.onClick instanceof Function ? e.onClick(l) : t.emit("onClick", l);
3999
+ onClick: (t) => {
4000
+ e.onClick instanceof Function ? e.onClick(t) : l.emit("onClick", t);
4003
4001
  }
4004
4002
  }, [o]);
4005
4003
  };
4006
4004
  }
4007
- }), Fo = {
4005
+ }), Ho = {
4008
4006
  title: {
4009
4007
  type: String,
4010
4008
  default: ""
@@ -4023,40 +4021,40 @@ const G = /* @__PURE__ */ M({
4023
4021
  overlay: {
4024
4022
  type: [String, Object]
4025
4023
  }
4026
- }, be = /* @__PURE__ */ M({
4024
+ }, we = /* @__PURE__ */ M({
4027
4025
  name: "DropdownToolbar",
4028
- props: Fo,
4026
+ props: Ho,
4029
4027
  emits: ["onChange"],
4030
- setup(e, t) {
4028
+ setup(e, l) {
4031
4029
  const o = x("editorId");
4032
4030
  return () => {
4033
- const l = _({
4031
+ const t = W({
4034
4032
  props: e,
4035
- ctx: t
4036
- }, "trigger"), r = _({
4033
+ ctx: l
4034
+ }, "trigger"), r = W({
4037
4035
  props: e,
4038
- ctx: t
4036
+ ctx: l
4039
4037
  }, "overlay");
4040
- return i(Y, {
4038
+ return i(oe, {
4041
4039
  relative: `#${o}-toolbar-wrapper`,
4042
4040
  visible: e.visible,
4043
4041
  onChange: (n) => {
4044
- e.onChange instanceof Function ? e.onChange(n) : t.emit("onChange", n);
4042
+ e.onChange instanceof Function ? e.onChange(n) : l.emit("onChange", n);
4045
4043
  },
4046
4044
  overlay: r
4047
4045
  }, {
4048
4046
  default: () => [i("div", {
4049
4047
  class: `${s}-toolbar-item`,
4050
4048
  title: e.title || ""
4051
- }, [l])]
4049
+ }, [t])]
4052
4050
  });
4053
4051
  };
4054
4052
  }
4055
4053
  });
4056
- function Mo(e) {
4057
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Lt(e);
4054
+ function Fo(e) {
4055
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !xt(e);
4058
4056
  }
4059
- const Ro = {
4057
+ const Mo = {
4060
4058
  title: {
4061
4059
  type: String,
4062
4060
  default: ""
@@ -4100,50 +4098,50 @@ const Ro = {
4100
4098
  onAdjust: {
4101
4099
  type: Function
4102
4100
  }
4103
- }, ke = /* @__PURE__ */ M({
4101
+ }, Te = /* @__PURE__ */ M({
4104
4102
  name: "ModalToolbar",
4105
- props: Ro,
4103
+ props: Mo,
4106
4104
  emits: ["onClick", "onClose", "onAdjust"],
4107
- setup(e, t) {
4105
+ setup(e, l) {
4108
4106
  return () => {
4109
- const o = _({
4107
+ const o = W({
4110
4108
  props: e,
4111
- ctx: t
4112
- }, "trigger"), l = _({
4109
+ ctx: l
4110
+ }, "trigger"), t = W({
4113
4111
  props: e,
4114
- ctx: t
4112
+ ctx: l
4115
4113
  }, "default");
4116
- return i(Ce, null, [i("div", {
4114
+ return i(xe, null, [i("div", {
4117
4115
  class: `${s}-toolbar-item`,
4118
4116
  title: e.title,
4119
4117
  onClick: () => {
4120
- e.onClick instanceof Function ? e.onClick() : t.emit("onClick");
4118
+ e.onClick instanceof Function ? e.onClick() : l.emit("onClick");
4121
4119
  }
4122
- }, [o]), i(Te, {
4120
+ }, [o]), i(Ae, {
4123
4121
  width: e.width,
4124
4122
  height: e.height,
4125
4123
  title: e.modalTitle,
4126
4124
  visible: e.visible,
4127
4125
  onClose: () => {
4128
- e.onClose instanceof Function ? e.onClose() : t.emit("onClose");
4126
+ e.onClose instanceof Function ? e.onClose() : l.emit("onClose");
4129
4127
  },
4130
4128
  showAdjust: e.showAdjust,
4131
4129
  isFullscreen: e.isFullscreen,
4132
4130
  onAdjust: (r) => {
4133
- e.onAdjust instanceof Function ? e.onAdjust(r) : t.emit("onAdjust", r);
4131
+ e.onAdjust instanceof Function ? e.onAdjust(r) : l.emit("onAdjust", r);
4134
4132
  }
4135
- }, Mo(l) ? l : {
4136
- default: () => [l]
4133
+ }, Fo(t) ? t : {
4134
+ default: () => [t]
4137
4135
  })]);
4138
4136
  };
4139
4137
  }
4140
4138
  });
4141
- G.install = (e) => (e.component(G.name, G), e.component(pe.name, pe), e.component(be.name, be), e.component(ue.name, ue), e.component(ke.name, ke), e);
4142
- G.NormalToolbar = pe;
4143
- G.DropdownToolbar = be;
4144
- G.MdCatalog = ue;
4145
- G.ModalToolbar = ke;
4146
- G.config = Yt;
4139
+ J.install = (e) => (e.component(J.name, J), e.component($e.name, $e), e.component(we.name, we), e.component(he.name, he), e.component(Te.name, Te), e);
4140
+ J.NormalToolbar = $e;
4141
+ J.DropdownToolbar = we;
4142
+ J.MdCatalog = he;
4143
+ J.ModalToolbar = Te;
4144
+ J.config = Zt;
4147
4145
  export {
4148
- G as default
4146
+ J as default
4149
4147
  };