autumnnote 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -141,7 +141,7 @@ function me(e, t) {
141
141
  };
142
142
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
143
143
  }
144
- function he(e, t) {
144
+ function D(e, t) {
145
145
  e.style.cursor = "grab";
146
146
  let n = (n) => {
147
147
  if (n.button !== 0 || n.target.closest("button, input, select, textarea, a")) return;
@@ -163,7 +163,7 @@ function he(e, t) {
163
163
  }
164
164
  //#endregion
165
165
  //#region src/js/core/range.js
166
- var ge = class {
166
+ var he = class {
167
167
  constructor(e, t, n, r) {
168
168
  this.sc = e, this.so = t, this.ec = n, this.eo = r;
169
169
  }
@@ -199,44 +199,44 @@ var ge = class {
199
199
  this.toNativeRange().insertNode(e);
200
200
  }
201
201
  };
202
- function _e(e) {
203
- return new ge(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
202
+ function ge(e) {
203
+ return new he(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
204
204
  }
205
- function ve(e) {
205
+ function _e(e) {
206
206
  let t = globalThis.getSelection();
207
207
  if (!t || t.rangeCount === 0) return null;
208
208
  let n = t.getRangeAt(0);
209
- return e && !e.contains(n.commonAncestorContainer) ? null : _e(n);
209
+ return e && !e.contains(n.commonAncestorContainer) ? null : ge(n);
210
210
  }
211
- function ye(e) {
212
- return new ge(e, 0, e, e.childNodes.length);
211
+ function ve(e) {
212
+ return new he(e, 0, e, e.childNodes.length);
213
213
  }
214
- function be(e, t = 0) {
215
- return new ge(e, t, e, t);
214
+ function ye(e, t = 0) {
215
+ return new he(e, t, e, t);
216
216
  }
217
- function xe(e) {
217
+ function be(e) {
218
218
  let t = globalThis.getSelection();
219
219
  return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
220
220
  }
221
- function Se(e) {
221
+ function xe(e) {
222
222
  let t = globalThis.getSelection();
223
223
  if (!t || t.rangeCount === 0) {
224
224
  e(null);
225
225
  return;
226
226
  }
227
227
  let n = t.getRangeAt(0).cloneRange();
228
- e(_e(n)), t.removeAllRanges(), t.addRange(n);
228
+ e(ge(n)), t.removeAllRanges(), t.addRange(n);
229
229
  }
230
- function Ce(e, t) {
230
+ function Se(e, t) {
231
231
  return [e, e.splitText(t)];
232
232
  }
233
233
  //#endregion
234
234
  //#region src/js/editing/Style.js
235
- function D(e, t = null) {
235
+ function O(e, t = null) {
236
236
  return document.execCommand(e, !1, t);
237
237
  }
238
- var we = () => D("bold"), Te = () => D("italic");
239
- function Ee() {
238
+ var Ce = () => O("bold"), we = () => O("italic");
239
+ function Te() {
240
240
  let e = globalThis.getSelection();
241
241
  if (!e?.rangeCount) return;
242
242
  let t = e.getRangeAt(0).commonAncestorContainer;
@@ -248,9 +248,9 @@ function Ee() {
248
248
  n.remove();
249
249
  return;
250
250
  }
251
- D("underline");
251
+ O("underline");
252
252
  }
253
- function De() {
253
+ function Ee() {
254
254
  let e = globalThis.getSelection();
255
255
  if (!e?.rangeCount) return;
256
256
  let t = e.getRangeAt(0).startContainer;
@@ -262,10 +262,10 @@ function De() {
262
262
  n.remove();
263
263
  return;
264
264
  }
265
- D("strikeThrough");
265
+ O("strikeThrough");
266
266
  }
267
- var Oe = () => D("superscript"), ke = () => D("subscript"), Ae = (e) => D("foreColor", e), je = (e) => D("hiliteColor", e), Me = (e) => D("fontName", e);
268
- function Ne(e, t = document) {
267
+ var De = () => O("superscript"), Oe = () => O("subscript"), ke = (e) => O("foreColor", e), Ae = (e) => O("hiliteColor", e), je = (e) => O("fontName", e);
268
+ function Me(e, t = document) {
269
269
  let n = globalThis.getSelection(), r = !n?.rangeCount || n.getRangeAt(0).collapsed;
270
270
  if (r && n?.rangeCount > 0) {
271
271
  try {
@@ -278,7 +278,7 @@ function Ne(e, t = document) {
278
278
  } catch {}
279
279
  return;
280
280
  }
281
- D("fontSize", "7");
281
+ O("fontSize", "7");
282
282
  let i = t instanceof HTMLElement ? t : document, a = [];
283
283
  if (i.querySelectorAll("font[size=\"7\"]").forEach((t) => {
284
284
  let n = document.createElement("span");
@@ -292,21 +292,21 @@ function Ne(e, t = document) {
292
292
  } catch {}
293
293
  }
294
294
  }
295
- var Pe = (e) => D("formatBlock", `<${e}>`), Fe = () => D("justifyLeft"), Ie = () => D("justifyCenter"), Le = () => D("justifyRight"), Re = () => D("justifyFull"), ze = () => D("indent");
296
- function Be() {
295
+ var Ne = (e) => O("formatBlock", `<${e}>`), Pe = () => O("justifyLeft"), Fe = () => O("justifyCenter"), Ie = () => O("justifyRight"), Le = () => O("justifyFull"), Re = () => O("indent");
296
+ function ze() {
297
297
  let e = globalThis.getSelection();
298
298
  if (e?.rangeCount) {
299
299
  let t = e.getRangeAt(0).commonAncestorContainer;
300
300
  t.nodeType === 3 && (t = t.parentElement);
301
301
  let n = t?.closest(".an-checklist li");
302
302
  if (n) {
303
- Ve(n);
303
+ Be(n);
304
304
  return;
305
305
  }
306
306
  }
307
- D("outdent");
307
+ O("outdent");
308
308
  }
309
- function Ve(e) {
309
+ function Be(e) {
310
310
  let t = e.closest(".an-checklist");
311
311
  if (!t) return;
312
312
  let n = Array.from(t.children), r = n.indexOf(e), i = n.slice(r + 1), a = document.createElement("p");
@@ -323,24 +323,24 @@ function Ve(e) {
323
323
  n && (n.removeAllRanges(), n.addRange(e));
324
324
  } catch {}
325
325
  }
326
- function He() {
326
+ function Ve() {
327
327
  let e = globalThis.getSelection();
328
328
  if (!e?.rangeCount) return null;
329
329
  let t = e.getRangeAt(0).commonAncestorContainer;
330
330
  return t.nodeType === 3 && (t = t.parentElement), t?.closest("ul, ol") || null;
331
331
  }
332
- function Ue(e) {
332
+ function He(e) {
333
333
  e.classList.remove("an-checklist"), e.querySelectorAll("input[type=\"checkbox\"]").forEach((e) => e.remove());
334
334
  }
335
- function We() {
336
- let e = He();
337
- e ? e.classList.contains("an-checklist") ? (Ue(e), e.tagName === "OL" && O(e, "ul")) : e.tagName === "OL" ? O(e, "ul") : D("insertUnorderedList") : D("insertUnorderedList");
335
+ function Ue() {
336
+ let e = Ve();
337
+ e ? e.classList.contains("an-checklist") ? (He(e), e.tagName === "OL" && Je(e, "ul")) : e.tagName === "OL" ? Je(e, "ul") : O("insertUnorderedList") : O("insertUnorderedList");
338
338
  }
339
- function Ge() {
340
- let e = He();
341
- e ? e.classList.contains("an-checklist") ? (Ue(e), O(e, "ol")) : e.tagName === "UL" ? O(e, "ol") : D("insertOrderedList") : D("insertOrderedList");
339
+ function We() {
340
+ let e = Ve();
341
+ e ? e.classList.contains("an-checklist") ? (He(e), Je(e, "ol")) : e.tagName === "UL" ? Je(e, "ol") : O("insertOrderedList") : O("insertOrderedList");
342
342
  }
343
- function Ke(e) {
343
+ function Ge(e) {
344
344
  let t = globalThis.getSelection();
345
345
  if (!t || t.rangeCount === 0) return;
346
346
  let n = t.getRangeAt(0), r = /* @__PURE__ */ new Set([
@@ -383,7 +383,7 @@ function Ke(e) {
383
383
  t.style.lineHeight = e;
384
384
  });
385
385
  }
386
- function qe(e) {
386
+ function Ke(e) {
387
387
  let t = globalThis.getSelection();
388
388
  if (!t?.rangeCount) return;
389
389
  let n = t.getRangeAt(0), r = n.commonAncestorContainer;
@@ -415,7 +415,7 @@ function qe(e) {
415
415
  }
416
416
  }
417
417
  }
418
- function Je() {
418
+ function qe() {
419
419
  let e = globalThis.getSelection();
420
420
  if (!e?.rangeCount) return !1;
421
421
  let t = e.getRangeAt(0).startContainer;
@@ -423,7 +423,7 @@ function Je() {
423
423
  let n = t?.closest("code");
424
424
  return !!(n && !n.closest("pre"));
425
425
  }
426
- function O(e, t) {
426
+ function Je(e, t) {
427
427
  let n = document.createElement(t);
428
428
  for (let t of e.attributes) n.setAttribute(t.name, t.value);
429
429
  for (; e.firstChild;) n.appendChild(e.firstChild);
@@ -456,7 +456,7 @@ function Xe() {
456
456
  }
457
457
  }
458
458
  } else {
459
- let t = O(r, "ul");
459
+ let t = Je(r, "ul");
460
460
  t.classList.add("an-checklist"), Ye(t);
461
461
  let n = t.querySelector("li");
462
462
  if (n) {
@@ -559,13 +559,13 @@ function $e(e) {
559
559
  function et(e) {
560
560
  return Qe.get(e);
561
561
  }
562
- var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryCommandState("bold")), nt = k("italic", "italic", "Italic (Ctrl+I)", () => Te(), () => document.queryCommandState("italic")), rt = k("underline", "underline", "Underline (Ctrl+U)", () => Ee(), () => {
562
+ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryCommandState("bold")), nt = k("italic", "italic", "Italic (Ctrl+I)", () => we(), () => document.queryCommandState("italic")), rt = k("underline", "underline", "Underline (Ctrl+U)", () => Te(), () => {
563
563
  if (document.queryCommandState("underline")) return !0;
564
564
  let e = globalThis.getSelection();
565
565
  if (!e?.rangeCount) return !1;
566
566
  let t = e.getRangeAt(0).startContainer;
567
567
  return t.nodeType === 3 && (t = t.parentElement), !!t?.closest("u");
568
- }), it = k("strikethrough", "strikethrough", "Strikethrough", () => De(), () => document.queryCommandState("strikeThrough")), at = k("superscript", "superscript", "Superscript", () => Oe(), () => document.queryCommandState("superscript")), ot = k("subscript", "subscript", "Subscript", () => ke(), () => document.queryCommandState("subscript")), st = k("alignLeft", "align-left", "Align Left", () => Fe()), ct = k("alignCenter", "align-center", "Align Center", () => Ie()), lt = k("alignRight", "align-right", "Align Right", () => Le()), ut = k("alignJustify", "align-justify", "Justify", () => Re()), dt = k("ul", "list-ul", "Unordered List", () => We()), ft = k("ol", "list-ol", "Ordered List", () => Ge()), pt = k("indent", "indent", "Indent", () => ze()), mt = k("outdent", "outdent", "Outdent", () => Be()), ht = k("undo", "undo", "Undo (Ctrl+Z)", (e) => e.invoke("editor.undo"), void 0, (e) => !e.invoke("editor.canUndo")), gt = k("redo", "redo", "Redo (Ctrl+Y)", (e) => e.invoke("editor.redo"), void 0, (e) => !e.invoke("editor.canRedo")), _t = k("hr", "minus", "Horizontal Rule", () => D("insertHorizontalRule")), vt = k("link", "link", "Insert Link", (e) => e.invoke("linkDialog.show")), yt = k("image", "image", "Insert Image", (e) => e.invoke("imageDialog.show")), bt = k("video", "video", "Insert Video", (e) => e.invoke("videoDialog.show")), xt = k("emoji", "emoji", "Insert Emoji", (e) => e.invoke("emojiDialog.show")), St = k("icon", "icon", "Insert FA Icon", (e) => e.invoke("iconDialog.show")), Ct = {
568
+ }), it = k("strikethrough", "strikethrough", "Strikethrough", () => Ee(), () => document.queryCommandState("strikeThrough")), at = k("superscript", "superscript", "Superscript", () => De(), () => document.queryCommandState("superscript")), ot = k("subscript", "subscript", "Subscript", () => Oe(), () => document.queryCommandState("subscript")), st = k("alignLeft", "align-left", "Align Left", () => Pe()), ct = k("alignCenter", "align-center", "Align Center", () => Fe()), lt = k("alignRight", "align-right", "Align Right", () => Ie()), ut = k("alignJustify", "align-justify", "Justify", () => Le()), dt = k("ul", "list-ul", "Unordered List", () => Ue()), ft = k("ol", "list-ol", "Ordered List", () => We()), pt = k("indent", "indent", "Indent", () => Re()), mt = k("outdent", "outdent", "Outdent", () => ze()), ht = k("undo", "undo", "Undo (Ctrl+Z)", (e) => e.invoke("editor.undo"), void 0, (e) => !e.invoke("editor.canUndo")), gt = k("redo", "redo", "Redo (Ctrl+Y)", (e) => e.invoke("editor.redo"), void 0, (e) => !e.invoke("editor.canRedo")), _t = k("hr", "minus", "Horizontal Rule", () => O("insertHorizontalRule")), vt = k("link", "link", "Insert Link", (e) => e.invoke("linkDialog.show")), yt = k("image", "image", "Insert Image", (e) => e.invoke("imageDialog.show")), bt = k("video", "video", "Insert Video", (e) => e.invoke("videoDialog.show")), xt = k("emoji", "emoji", "Insert Emoji", (e) => e.invoke("emojiDialog.show")), St = k("icon", "icon", "Insert FA Icon", (e) => e.invoke("iconDialog.show")), Ct = {
569
569
  name: "table",
570
570
  type: "grid",
571
571
  icon: "table",
@@ -596,7 +596,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
596
596
  "48px",
597
597
  "72px"
598
598
  ],
599
- action: (e, t) => Ne(t, e.layoutInfo.editable),
599
+ action: (e, t) => Me(t, e.layoutInfo.editable),
600
600
  getValue: (e) => {
601
601
  try {
602
602
  let t = globalThis.getSelection();
@@ -612,14 +612,14 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
612
612
  return "";
613
613
  }
614
614
  }
615
- }, Tt = k("removeFormat", "remove-format", "Remove Format", () => D("removeFormat")), Et = k("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
615
+ }, Tt = k("removeFormat", "remove-format", "Remove Format", () => O("removeFormat")), Et = k("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
616
616
  let t = e.layoutInfo.editable, n = (t.getAttribute("dir") || "ltr") === "ltr" ? "rtl" : "ltr";
617
617
  t.setAttribute("dir", n), t.style.textAlign = n === "rtl" ? "right" : "left", e.invoke("editor.afterCommand");
618
618
  }), Dt = {
619
619
  name: "fontFamily",
620
620
  type: "select",
621
621
  tooltip: "Font Family",
622
- action: (e, t) => Me(t),
622
+ action: (e, t) => je(t),
623
623
  getValue: () => {
624
624
  try {
625
625
  return document.queryCommandValue("fontName") || "";
@@ -671,7 +671,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
671
671
  label: "Code"
672
672
  }
673
673
  ],
674
- action: (e, t) => Pe(t),
674
+ action: (e, t) => Ne(t),
675
675
  getValue: () => {
676
676
  try {
677
677
  let e = document.queryCommandValue("formatBlock").toLowerCase().replace(/[<>]/g, "");
@@ -695,7 +695,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
695
695
  "2.5",
696
696
  "3.0"
697
697
  ],
698
- action: (e, t) => Ke(t),
698
+ action: (e, t) => Ge(t),
699
699
  getValue: () => {
700
700
  try {
701
701
  let e = globalThis.getSelection();
@@ -721,20 +721,20 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
721
721
  return "";
722
722
  }
723
723
  }
724
- }, At = k("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), jt = k("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Mt = k("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), Nt = k("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Pt = k("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Ft = k("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () => Je()), It = k("checklist", "checklist", "Checklist", (e) => e.invoke("editor.toggleChecklist"), () => Ze()), Lt = k("print", "print", "Print", (e) => e.invoke("editor.print")), Rt = {
724
+ }, At = k("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), jt = k("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Mt = k("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), Nt = k("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Pt = k("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Ft = k("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () => qe()), It = k("checklist", "checklist", "Checklist", (e) => e.invoke("editor.toggleChecklist"), () => Ze()), Lt = k("print", "print", "Print", (e) => e.invoke("editor.print")), Rt = {
725
725
  name: "foreColor",
726
726
  type: "colorpicker",
727
727
  icon: "foreColor",
728
728
  tooltip: "Text Color",
729
729
  defaultColor: "#e11d48",
730
- action: (e, t) => Ae(t)
730
+ action: (e, t) => ke(t)
731
731
  }, zt = {
732
732
  name: "backColor",
733
733
  type: "colorpicker",
734
734
  icon: "backColor",
735
735
  tooltip: "Highlight Color",
736
736
  defaultColor: "#fbbf24",
737
- action: (e, t) => je(t)
737
+ action: (e, t) => Ae(t)
738
738
  }, Bt = [
739
739
  [
740
740
  Ot,
@@ -1827,16 +1827,16 @@ function gn(e, t, n = {}) {
1827
1827
  }
1828
1828
  }
1829
1829
  if (P(e, N.TAB)) {
1830
- let r = ve(t);
1830
+ let r = _e(t);
1831
1831
  if (!r) return !1;
1832
1832
  let i = C(r.sc, t);
1833
- if (i && _(i)) return e.preventDefault(), e.shiftKey ? Be() : D("indent"), !0;
1834
- if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize || 4)), !0);
1835
- if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize)), !0);
1833
+ if (i && _(i)) return e.preventDefault(), e.shiftKey ? ze() : O("indent"), !0;
1834
+ if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), O("insertText", " ".repeat(n.tabSize || 4)), !0);
1835
+ if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), O("insertText", " ".repeat(n.tabSize)), !0);
1836
1836
  }
1837
- if (P(e, N.ENTER) && e.shiftKey) return e.preventDefault(), D("insertLineBreak"), !0;
1837
+ if (P(e, N.ENTER) && e.shiftKey) return e.preventDefault(), O("insertLineBreak"), !0;
1838
1838
  if (P(e, N.ENTER) && !e.shiftKey) {
1839
- let n = ve(t);
1839
+ let n = _e(t);
1840
1840
  if (!n) return !1;
1841
1841
  let r = n.sc, i = r.nodeType === 3 ? r.parentElement : r;
1842
1842
  if (i?.nodeName === "I" && /\bfa-/.test(i.className || "")) {
@@ -1877,10 +1877,10 @@ function gn(e, t, n = {}) {
1877
1877
  return l.setStart(c, 0), l.collapse(!0), n.removeAllRanges(), n.addRange(l), !0;
1878
1878
  }
1879
1879
  let s = C(n.sc, t);
1880
- if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(), D("insertText", "\n"), !0;
1880
+ if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(), O("insertText", "\n"), !0;
1881
1881
  if (s?.nodeName.toUpperCase() === "BLOCKQUOTE") {
1882
1882
  let t = n.toNativeRange();
1883
- if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(), D("formatBlock", "<p>"), !0;
1883
+ if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(), O("formatBlock", "<p>"), !0;
1884
1884
  }
1885
1885
  }
1886
1886
  return !1;
@@ -1939,7 +1939,7 @@ function wn(e, t = 0) {
1939
1939
  case "u": return `<u>${i()}</u>`;
1940
1940
  case "span": {
1941
1941
  let e = n.getAttribute("style") || "";
1942
- return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${R(e)}">${i()}</span>` : i();
1942
+ return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${z(e)}">${i()}</span>` : i();
1943
1943
  }
1944
1944
  case "code": {
1945
1945
  if (n.closest("pre")) return i();
@@ -2040,8 +2040,8 @@ function Fn(e) {
2040
2040
  let r = e[n], i = An(r);
2041
2041
  if (i) {
2042
2042
  let r = RegExp(`^ {0,3}\\${i.marker}{${i.length},}[ \t]*$`), a = [];
2043
- for (n++; n < e.length && !r.test(e[n]);) a.push(rr(jn(e[n], i.indent))), n++;
2044
- let o = i.lang ? ` class="language-${R(i.lang)}"` : "";
2043
+ for (n++; n < e.length && !r.test(e[n]);) a.push(nr(jn(e[n], i.indent))), n++;
2044
+ let o = i.lang ? ` class="language-${z(i.lang)}"` : "";
2045
2045
  t.push(`<pre><code${o}>${a.join("\n")}</code></pre>`), n++;
2046
2046
  continue;
2047
2047
  }
@@ -2055,18 +2055,18 @@ function Fn(e) {
2055
2055
  for (; n < t; n++) r.push("");
2056
2056
  continue;
2057
2057
  }
2058
- r.push(rr(jn(e[n], 4))), n++;
2058
+ r.push(nr(jn(e[n], 4))), n++;
2059
2059
  }
2060
2060
  t.push(`<pre><code>${r.join("\n")}</code></pre>`);
2061
2061
  continue;
2062
2062
  }
2063
2063
  if (r.trim() && !Mn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
2064
2064
  if (/^=+\s*$/.test(e[n + 1])) {
2065
- t.push(`<h1>${L(r.trim())}</h1>`), n += 2;
2065
+ t.push(`<h1>${R(r.trim())}</h1>`), n += 2;
2066
2066
  continue;
2067
2067
  }
2068
2068
  if (/^-{2,}\s*$/.test(e[n + 1])) {
2069
- t.push(`<h2>${L(r.trim())}</h2>`), n += 2;
2069
+ t.push(`<h2>${R(r.trim())}</h2>`), n += 2;
2070
2070
  continue;
2071
2071
  }
2072
2072
  }
@@ -2077,7 +2077,7 @@ function Fn(e) {
2077
2077
  let a = /^(#{1,6})\s+(.+)$/.exec(r);
2078
2078
  if (a) {
2079
2079
  let e = a[1].length, r = a[2].replace(/(?:^|\s)#+\s*$/, "");
2080
- t.push(`<h${e}>${L(r)}</h${e}>`), n++;
2080
+ t.push(`<h${e}>${R(r)}</h${e}>`), n++;
2081
2081
  continue;
2082
2082
  }
2083
2083
  if (Dn.test(r)) {
@@ -2087,12 +2087,12 @@ function Fn(e) {
2087
2087
  continue;
2088
2088
  }
2089
2089
  if (/^[-*+] /.test(r)) {
2090
- let { html: r, endIdx: i } = Wn(e, n);
2090
+ let { html: r, endIdx: i } = Un(e, n);
2091
2091
  t.push(r), n = i;
2092
2092
  continue;
2093
2093
  }
2094
2094
  if (/^\d+[.)] /.test(r)) {
2095
- let { html: r, endIdx: i } = Wn(e, n);
2095
+ let { html: r, endIdx: i } = Un(e, n);
2096
2096
  t.push(r), n = i;
2097
2097
  continue;
2098
2098
  }
@@ -2101,17 +2101,17 @@ function Fn(e) {
2101
2101
  continue;
2102
2102
  }
2103
2103
  if (Hn(e, n)) {
2104
- let i = Un(r), a = Un(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2104
+ let i = L(r), a = L(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2105
2105
  n += 2;
2106
2106
  let o = [];
2107
- for (; n < e.length && e[n].trim() !== "" && Vn(e[n]) > 1;) o.push(Un(e[n])), n++;
2108
- let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${L(t)}</${e}>`, c = `<thead><tr>${i.map((e, t) => s("th", e, a[t])).join("")}</tr></thead>`, l = o.length ? `<tbody>${o.map((e) => `<tr>${e.map((e, t) => s("td", e, a[t])).join("")}</tr>`).join("")}</tbody>` : "";
2107
+ for (; n < e.length && e[n].trim() !== "" && Vn(e[n]) > 1;) o.push(L(e[n])), n++;
2108
+ let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${R(t)}</${e}>`, c = `<thead><tr>${i.map((e, t) => s("th", e, a[t])).join("")}</tr></thead>`, l = o.length ? `<tbody>${o.map((e) => `<tr>${e.map((e, t) => s("td", e, a[t])).join("")}</tr>`).join("")}</tbody>` : "";
2109
2109
  t.push(`<table>${c}${l}</table>`);
2110
2110
  continue;
2111
2111
  }
2112
2112
  let o = [];
2113
2113
  for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+[.)] )/.test(e[n]) && !An(e[n]) && !Dn.test(e[n]) && !Mn.test(e[n]) && !Hn(e, n) && !(n + 1 < e.length && /^=+\s*$/.test(e[n + 1])) && !(n + 1 < e.length && /^-{2,}\s*$/.test(e[n + 1]));) o.push(e[n]), n++;
2114
- o.length && t.push(`<p>${L(Bn(o)).replaceAll(Nn, "<br>")}</p>`);
2114
+ o.length && t.push(`<p>${R(Bn(o)).replaceAll(Nn, "<br>")}</p>`);
2115
2115
  }
2116
2116
  return t.join("");
2117
2117
  }
@@ -2181,16 +2181,16 @@ function Bn(e) {
2181
2181
  return t;
2182
2182
  }
2183
2183
  function Vn(e) {
2184
- return Un(e).length;
2184
+ return L(e).length;
2185
2185
  }
2186
2186
  function Hn(e, t) {
2187
2187
  let n = e[t], r = e[t + 1];
2188
2188
  if (r === void 0 || !n.includes("|")) return !1;
2189
2189
  if (/^\|.+\|/.test(n)) return /^\|[\s|:-]+\|/.test(r);
2190
- let i = Un(r);
2190
+ let i = L(r);
2191
2191
  return i.length < 2 || !i.every((e) => /^:?-+:?$/.test(e)) ? !1 : Vn(n) === i.length;
2192
2192
  }
2193
- function Un(e) {
2193
+ function L(e) {
2194
2194
  let t = e.replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
2195
2195
  for (let e = 0; e < t.length; e++) {
2196
2196
  if (t[e] === "\\" && t[e + 1] === "|") {
@@ -2205,7 +2205,7 @@ function Un(e) {
2205
2205
  }
2206
2206
  return n.push(r), n.map((e) => e.trim());
2207
2207
  }
2208
- function Wn(e, t) {
2208
+ function Un(e, t) {
2209
2209
  let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+[.)] /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
2210
2210
  for (; c < e.length;) {
2211
2211
  let t = e[c];
@@ -2234,7 +2234,7 @@ function Wn(e, t) {
2234
2234
  continue;
2235
2235
  }
2236
2236
  if (/^\s*(?:[-*+]|\d+[.)]) /.test(t)) {
2237
- let t = Wn(e, c);
2237
+ let t = Un(e, c);
2238
2238
  i[i.length - 1].sub += t.html, c = t.endIdx, s = !1;
2239
2239
  } else if (s) i[i.length - 1].paras.push(t.trim()), s = !1, c++;
2240
2240
  else {
@@ -2247,24 +2247,24 @@ function Wn(e, t) {
2247
2247
  return {
2248
2248
  html: `${f}${i.map(({ paras: e, isCB: t, checked: n, sub: r }) => {
2249
2249
  let i = t ? `<input type="checkbox" contenteditable="false"${n ? " checked" : ""}>` : "";
2250
- return `<li>${o ? e.map((e, t) => `<p>${t === 0 ? i : ""}${L(e)}</p>`).join("") : `${i}${L(e[0])}`}${r}</li>`;
2250
+ return `<li>${o ? e.map((e, t) => `<p>${t === 0 ? i : ""}${R(e)}</p>`).join("") : `${i}${R(e[0])}`}${r}</li>`;
2251
2251
  }).join("")}${p}`,
2252
2252
  endIdx: c
2253
2253
  };
2254
2254
  }
2255
- var Gn = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, Kn = "\0";
2256
- function qn(e) {
2255
+ var Wn = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, Gn = "\0";
2256
+ function Kn(e) {
2257
2257
  let t = [];
2258
2258
  return {
2259
- text: e.replace(Gn, (e, n) => (t.push(n), `${Kn}${t.length - 1}${Kn}`)),
2259
+ text: e.replace(Wn, (e, n) => (t.push(n), `${Gn}${t.length - 1}${Gn}`)),
2260
2260
  literals: t
2261
2261
  };
2262
2262
  }
2263
- function Jn(e, t) {
2264
- return e.replace(RegExp(`${Kn}(\\d+)${Kn}`, "g"), (e, n) => rr(t[Number(n)]));
2263
+ function qn(e, t) {
2264
+ return e.replace(RegExp(`${Gn}(\\d+)${Gn}`, "g"), (e, n) => nr(t[Number(n)]));
2265
2265
  }
2266
- var Yn = String.raw`(&lt;.*?&gt;(?:\s+(?:"[^"]*"|'[^']*'))?|[^)]*)`, Xn = new RegExp(String.raw`!\[([^\]]*)\]\(${Yn}\)`, "g"), Zn = new RegExp(String.raw`\[([^\]]+)\]\(${Yn}\)`, "g");
2267
- function Qn(e) {
2266
+ var Jn = String.raw`(&lt;.*?&gt;(?:\s+(?:"[^"]*"|'[^']*'))?|[^)]*)`, Yn = new RegExp(String.raw`!\[([^\]]*)\]\(${Jn}\)`, "g"), Xn = new RegExp(String.raw`\[([^\]]+)\]\(${Jn}\)`, "g");
2267
+ function Zn(e) {
2268
2268
  let t = e.trim(), n = /^&lt;([^]*?)&gt;\s*(?:"([^"]*)"|'([^']*)')?\s*$/.exec(t);
2269
2269
  if (n) return {
2270
2270
  href: n[1],
@@ -2279,63 +2279,646 @@ function Qn(e) {
2279
2279
  title: ""
2280
2280
  };
2281
2281
  }
2282
- function $n(e) {
2283
- return e = e.replace(Xn, (e, t, n) => {
2284
- let { href: r, title: i } = Qn(n), a = i ? ` title="${z(i)}"` : "";
2285
- return `<img src="${z(r)}" alt="${z(t)}"${a} class="an-image">`;
2286
- }), e = e.replace(Zn, (e, t, n) => {
2287
- let { href: r, title: i } = Qn(n), a = i ? ` title="${z(i)}"` : "";
2288
- return `<a href="${z(r)}"${a}>${t}</a>`;
2282
+ function Qn(e) {
2283
+ return e = e.replace(Yn, (e, t, n) => {
2284
+ let { href: r, title: i } = Zn(n), a = i ? ` title="${B(i)}"` : "";
2285
+ return `<img src="${B(r)}" alt="${B(t)}"${a} class="an-image">`;
2286
+ }), e = e.replace(Xn, (e, t, n) => {
2287
+ let { href: r, title: i } = Zn(n), a = i ? ` title="${B(i)}"` : "";
2288
+ return `<a href="${B(r)}"${a}>${t}</a>`;
2289
2289
  }), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
2290
- let r = In.get(ir(n || t).trim().toLowerCase());
2290
+ let r = In.get(rr(n || t).trim().toLowerCase());
2291
2291
  if (!r) return e;
2292
- let i = r.title ? ` title="${R(r.title)}"` : "";
2293
- return `<a href="${R(r.href)}"${i}>${t}</a>`;
2292
+ let i = r.title ? ` title="${z(r.title)}"` : "";
2293
+ return `<a href="${z(r.href)}"${i}>${t}</a>`;
2294
2294
  }), e = e.replace(/\[([^\]]+)\]/g, (e, t) => {
2295
- let n = In.get(ir(t).trim().toLowerCase());
2295
+ let n = In.get(rr(t).trim().toLowerCase());
2296
2296
  if (!n) return e;
2297
- let r = n.title ? ` title="${R(n.title)}"` : "";
2298
- return `<a href="${R(n.href)}"${r}>${t}</a>`;
2299
- }), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => Ln.has(ir(t)) ? `<sup>[${t}]</sup>` : e), e;
2297
+ let r = n.title ? ` title="${z(n.title)}"` : "";
2298
+ return `<a href="${z(n.href)}"${r}>${t}</a>`;
2299
+ }), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => Ln.has(rr(t)) ? `<sup>[${t}]</sup>` : e), e;
2300
2300
  }
2301
- function er(e) {
2302
- return e = e.replace(/&lt;(https?:\/\/[^\s&]+?)&gt;/g, (e, t) => `<a href="${z(t)}">${t}</a>`), e = e.replace(/&lt;([\w.!#$%&'*+/=?^`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+)&gt;/g, (e, t) => `<a href="mailto:${z(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
2301
+ function $n(e) {
2302
+ return e = e.replace(/&lt;(https?:\/\/[^\s&]+?)&gt;/g, (e, t) => `<a href="${B(t)}">${t}</a>`), e = e.replace(/&lt;([\w.!#$%&'*+/=?^`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+)&gt;/g, (e, t) => `<a href="mailto:${B(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
2303
2303
  let r = /[.,;:!?)]+$/.exec(n), i = r ? n.slice(0, -r[0].length) : n;
2304
2304
  if (!i) return e;
2305
2305
  let a = r ? r[0] : "";
2306
- return `${t}<a href="${z(i)}">${i}</a>${a}`;
2306
+ return `${t}<a href="${B(i)}">${i}</a>${a}`;
2307
2307
  }), e;
2308
2308
  }
2309
- function tr(e) {
2309
+ function er(e) {
2310
2310
  return e = e.replace(/\*{3}([^*\n]+?)\*{3}/g, (e, t) => `<strong><em>${t}</em></strong>`), e = e.replace(/(?<!\w)_{3}([^_\n]+?)_{3}(?!\w)/g, (e, t) => `<strong><em>${t}</em></strong>`), e = e.replace(/\*{2}([^*\n]+?)\*{2}/g, (e, t) => `<strong>${t}</strong>`), e = e.replace(/(?<!\w)_{2}([^_\n]+?)_{2}(?!\w)/g, (e, t) => `<strong>${t}</strong>`), e = e.replace(/\*([^*\n]+?)\*/g, (e, t) => `<em>${t}</em>`), e = e.replace(/(?<!\w)_([^_\n]+?)_(?!\w)/g, (e, t) => `<em>${t}</em>`), e = e.replace(/~~([^~\n]+?)~~/g, (e, t) => `<del>${t}</del>`), e = e.replace(/``([\s\S]*?)``/g, (e, t) => `<code>${t}</code>`), e = e.replace(/`([^`]+)`/g, (e, t) => `<code>${t}</code>`), e;
2311
2311
  }
2312
- function L(e) {
2313
- let { text: t, literals: n } = qn(e), r = rr(t);
2314
- return r = $n(r), r = er(r), r = tr(r), Jn(r, n);
2312
+ function R(e) {
2313
+ let { text: t, literals: n } = Kn(e), r = nr(t);
2314
+ return r = Qn(r), r = $n(r), r = er(r), qn(r, n);
2315
2315
  }
2316
- var nr = /&(?!#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g;
2317
- function rr(e) {
2318
- return String(e).replace(nr, "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2316
+ var tr = /&(?!#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g;
2317
+ function nr(e) {
2318
+ return String(e).replace(tr, "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2319
2319
  }
2320
- function R(e) {
2320
+ function z(e) {
2321
2321
  return String(e).replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2322
2322
  }
2323
- function z(e) {
2323
+ function B(e) {
2324
2324
  return String(e).replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
2325
2325
  }
2326
- function ir(e) {
2326
+ function rr(e) {
2327
2327
  return String(e).replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
2328
2328
  }
2329
2329
  //#endregion
2330
2330
  //#region src/js/core/detectLang.js
2331
- function ar(e) {
2331
+ var ir = 5, ar = 2, or = [
2332
+ ["typescript", "javascript"],
2333
+ ["scss", "css"],
2334
+ ["cpp", "c"]
2335
+ ], sr = [
2336
+ {
2337
+ lang: "php",
2338
+ w: 10,
2339
+ re: /<\?php\b|<\?=/
2340
+ },
2341
+ {
2342
+ lang: "bash",
2343
+ w: 10,
2344
+ re: /^#!.*\/(?:ba|z|da|fi|k)?sh\b/m
2345
+ },
2346
+ {
2347
+ lang: "rust",
2348
+ w: 10,
2349
+ re: /\b(?:println!|print!|format!|vec!|panic!)\s*[([]/
2350
+ },
2351
+ {
2352
+ lang: "go",
2353
+ w: 10,
2354
+ re: /\bfmt\.(?:Print|Println|Printf|Sprintf|Errorf|Fprintf)\s*\(/
2355
+ },
2356
+ {
2357
+ lang: "java",
2358
+ w: 10,
2359
+ re: /\bSystem\.out\.(?:print|println)\s*\(/
2360
+ },
2361
+ {
2362
+ lang: "csharp",
2363
+ w: 10,
2364
+ re: /\bConsole\.(?:Write|WriteLine)\s*\(/
2365
+ },
2366
+ {
2367
+ lang: "cpp",
2368
+ w: 10,
2369
+ re: /\b(?:cout|cerr)\s*<<|\bcin\s*>>|\busing\s+namespace\s+std\b|\bstd::\w/
2370
+ },
2371
+ {
2372
+ lang: "python",
2373
+ w: 10,
2374
+ re: /\bdef[ \t]+\w+[ \t]*\([^)]*\)[ \t]*(?:->[^:\n]*)?:|\bif[ \t]+__name__[ \t]*==[ \t]*['"]__main__['"]/
2375
+ },
2376
+ {
2377
+ lang: "html",
2378
+ w: 10,
2379
+ re: /^\s*<!DOCTYPE\s+html/i
2380
+ },
2381
+ {
2382
+ lang: "xml",
2383
+ w: 10,
2384
+ re: /^\s*<\?xml\s/i
2385
+ },
2386
+ {
2387
+ lang: "javascript",
2388
+ w: 6,
2389
+ re: /\bconsole\.(?:log|error|warn|info|debug)\s*\(/
2390
+ },
2391
+ {
2392
+ lang: "javascript",
2393
+ w: 6,
2394
+ re: /\b(?:const|let)\s+\w+\s*=|(?:^|\n)\s*var\s+\w+\s*=/
2395
+ },
2396
+ {
2397
+ lang: "javascript",
2398
+ w: 8,
2399
+ re: /\bexport\s+(?:default|const|function|class|async|\{|\*)|\bmodule\.exports\b|\brequire\s*\(\s*['"]/
2400
+ },
2401
+ {
2402
+ lang: "javascript",
2403
+ w: 5,
2404
+ re: /\bfunction(?:[ \t]+\w+)?[ \t]*\([^)]*\)[ \t]*\{|=>[ \t]*[{([`\w'"]/
2405
+ },
2406
+ {
2407
+ lang: "javascript",
2408
+ w: 5,
2409
+ re: /\bimport\b[^'"\n]*[ \t]from[ \t]*['"]/
2410
+ },
2411
+ {
2412
+ lang: "javascript",
2413
+ w: 4,
2414
+ re: /\.(?:map|filter|forEach|reduce|then|catch|find|some|every)\s*\(/
2415
+ },
2416
+ {
2417
+ lang: "javascript",
2418
+ w: 4,
2419
+ re: /\b(?:document|window|globalThis)\.\w/
2420
+ },
2421
+ {
2422
+ lang: "javascript",
2423
+ w: 4,
2424
+ re: /\baddEventListener\s*\(|\bquerySelector(?:All)?\s*\(|\bgetElementById\s*\(/
2425
+ },
2426
+ {
2427
+ lang: "javascript",
2428
+ w: 3,
2429
+ re: /\.(?:innerHTML|textContent|classList|dataset|style)\b|\bJSON\.(?:parse|stringify)\s*\(/
2430
+ },
2431
+ {
2432
+ lang: "javascript",
2433
+ w: 4,
2434
+ re: /\bawait\s+\w|\basync\s+(?:function|\(|\w+\s*=>)|\bnew\s+Promise\s*\(/
2435
+ },
2436
+ {
2437
+ lang: "javascript",
2438
+ w: 3,
2439
+ re: /\bReact\.|\buseState\s*\(|\buseEffect\s*\(/
2440
+ },
2441
+ {
2442
+ lang: "typescript",
2443
+ w: 8,
2444
+ re: /\binterface\s+\w+(?:<[^>]*>)?\s*(?:extends\s[\w<>, ]+)?\{/
2445
+ },
2446
+ {
2447
+ lang: "typescript",
2448
+ w: 8,
2449
+ re: /\btype\s+\w+(?:<[^>]*>)?\s*=/
2450
+ },
2451
+ {
2452
+ lang: "typescript",
2453
+ w: 7,
2454
+ re: /:\s*(?:string|number|boolean|void|never|any|unknown|object)\b/
2455
+ },
2456
+ {
2457
+ lang: "typescript",
2458
+ w: 6,
2459
+ re: /\benum\s+\w+\s*\{|\breadonly\s+\w|\bimplements\s+\w|\bnamespace\s+\w+\s*\{/
2460
+ },
2461
+ {
2462
+ lang: "typescript",
2463
+ w: 6,
2464
+ re: /\b(?:private|public|protected)\s+(?:readonly\s+)?\w+\s*[:?]/
2465
+ },
2466
+ {
2467
+ lang: "typescript",
2468
+ w: 5,
2469
+ re: /\)\s*:\s*[A-Z]\w*(?:<[^>]*>)?\s*(?:\{|=>)|\)\s*:\s*(?:string|number|boolean|void)\b/
2470
+ },
2471
+ {
2472
+ lang: "typescript",
2473
+ w: 4,
2474
+ re: /\bfunction\s+\w+\s*<[^>]+>\s*\(|\bas\s+(?:const\b|[A-Z]\w*)/
2475
+ },
2476
+ {
2477
+ lang: "typescript",
2478
+ w: 3,
2479
+ re: /\w\?\s*:\s*\w|\bimport\s+type\b|\bsatisfies\b/
2480
+ },
2481
+ {
2482
+ lang: "python",
2483
+ w: 6,
2484
+ re: /(?:^|\n)\s*(?:from\s+[\w.]+\s+import\s|import\s+\w+(?:\s*,\s*\w+)*\s*$)/m
2485
+ },
2486
+ {
2487
+ lang: "python",
2488
+ w: 6,
2489
+ re: /(?:^|\n)\s*class\s+\w+(?:\([\w., ]*\))?\s*:/
2490
+ },
2491
+ {
2492
+ lang: "python",
2493
+ w: 5,
2494
+ re: /(?:^|\n)\s*(?:with|elif|except|finally|async\s+def)\b[^\n]*:/
2495
+ },
2496
+ {
2497
+ lang: "python",
2498
+ w: 5,
2499
+ re: /\bself\.\w|\b__init__\b|\bf["'][^"']*\{/
2500
+ },
2501
+ {
2502
+ lang: "python",
2503
+ w: 4,
2504
+ re: /(?:^|\n)[ \t]*for[ \t]+\w+[ \t]+in[ \t][^\n:]*:|\bfor[ \t]+\w+[ \t]+in[ \t]+range[ \t]*\(/
2505
+ },
2506
+ {
2507
+ lang: "python",
2508
+ w: 4,
2509
+ re: /\bprint\s*\(|\blen\s*\(|\brange\s*\(/
2510
+ },
2511
+ {
2512
+ lang: "python",
2513
+ w: 3,
2514
+ re: /\[[^\]\n]*\bfor\s+\w+\s+in\s[^\]\n]*\]|\bNone\b|\bTrue\b|\bFalse\b/
2515
+ },
2516
+ {
2517
+ lang: "python",
2518
+ w: 3,
2519
+ re: /\*\*\w|\bdict[ \t]*\(|\blambda(?:[ \t]+\w+)?[ \t]*:/
2520
+ },
2521
+ {
2522
+ lang: "go",
2523
+ w: 8,
2524
+ re: /(?:^|\n)\s*package\s+\w+\s*$/m
2525
+ },
2526
+ {
2527
+ lang: "go",
2528
+ w: 6,
2529
+ re: /\btype\s+\w+\s+struct\s*\{|\btype\s+\w+\s+interface\s*\{/
2530
+ },
2531
+ {
2532
+ lang: "go",
2533
+ w: 6,
2534
+ re: /\bfunc(?:[ \t]*\([^)]*\))?(?:[ \t]+\w+)?[ \t]*\([^)]*\)[^\n{]{0,40}\{/
2535
+ },
2536
+ {
2537
+ lang: "go",
2538
+ w: 5,
2539
+ re: /\bif\s+err\s*!=\s*nil\b|\berr\s*:=\s|\bdefer\s+\w/
2540
+ },
2541
+ {
2542
+ lang: "go",
2543
+ w: 4,
2544
+ re: /\w+\s*:=\s*\S|\bchan\s+\w|\bgo\s+func\b|\bnil\b/
2545
+ },
2546
+ {
2547
+ lang: "rust",
2548
+ w: 7,
2549
+ re: /\bfn[ \t]+\w+(?:<[^>]*>)?[ \t]*\([^)]*\)[^\n{]{0,40}\{/
2550
+ },
2551
+ {
2552
+ lang: "rust",
2553
+ w: 7,
2554
+ re: /\blet\s+mut\s+\w|\bpub\s+(?:fn|struct|enum|mod|use)\b|\bimpl\s+\w/
2555
+ },
2556
+ {
2557
+ lang: "rust",
2558
+ w: 5,
2559
+ re: /\buse\s+(?:std|crate|self|super)::|\bmatch\s+\w+\s*\{[^}]*=>/
2560
+ },
2561
+ {
2562
+ lang: "rust",
2563
+ w: 4,
2564
+ re: /\b(?:Option|Result|Vec|Box|Rc|Arc|HashMap)\s*<|&(?:mut\s+)?self\b|\b\w+::<|->\s*Result</
2565
+ },
2566
+ {
2567
+ lang: "rust",
2568
+ w: 3,
2569
+ re: /\b(?:i8|i16|i32|i64|u8|u16|u32|u64|usize|isize|f32|f64)\b|\bunwrap\s*\(\)|\bderive\s*\(/
2570
+ },
2571
+ {
2572
+ lang: "java",
2573
+ w: 7,
2574
+ re: /\b(?:public|private|protected)\s+(?:static\s+)?(?:final\s+)?(?:void|int|long|double|boolean|String|[A-Z]\w*(?:<[^>]*>)?)\s+\w+\s*[({]/
2575
+ },
2576
+ {
2577
+ lang: "java",
2578
+ w: 7,
2579
+ re: /\bimport\s+(?:java|javax|org\.springframework)\.[\w.]+;/
2580
+ },
2581
+ {
2582
+ lang: "java",
2583
+ w: 6,
2584
+ re: /@(?:Override|Autowired|Component|Service|Controller|RestController|Entity|Test|SpringBootApplication)\b/
2585
+ },
2586
+ {
2587
+ lang: "java",
2588
+ w: 5,
2589
+ re: /\bnew\s+(?:ArrayList|HashMap|HashSet|LinkedList|StringBuilder)\s*<[^>]*>\s*\(|\bthrows\s+\w*Exception/
2590
+ },
2591
+ {
2592
+ lang: "java",
2593
+ w: 4,
2594
+ re: /\bpublic\s+(?:class|interface|enum)\s+\w|\bextends\s+\w+\s*\{|\bList<\w|\bMap<\w/
2595
+ },
2596
+ {
2597
+ lang: "csharp",
2598
+ w: 8,
2599
+ re: /\busing\s+System(?:\.[\w.]+)?\s*;|\bnamespace\s+[\w.]+\s*[{;]/
2600
+ },
2601
+ {
2602
+ lang: "csharp",
2603
+ w: 8,
2604
+ re: /\{\s*get;\s*(?:private\s+)?set;\s*\}|\b(?:public|private|protected|internal)\s+(?:static\s+)?async\s+Task(?:<[^>]*>)?\s+\w/
2605
+ },
2606
+ {
2607
+ lang: "csharp",
2608
+ w: 6,
2609
+ re: /\basync\s+Task(?:<[^>]*>)?\s+\w|\bawait\s+\w+\.\w+Async\s*\(/
2610
+ },
2611
+ {
2612
+ lang: "csharp",
2613
+ w: 5,
2614
+ re: /\bIEnumerable<|\bvar\s+\w+\s*=\s*new\s+\w|\bpublic\s+override\b|\[\s*(?:HttpGet|HttpPost|Serializable|Required)\s*\]/
2615
+ },
2616
+ {
2617
+ lang: "csharp",
2618
+ w: 3,
2619
+ re: /\.(?:Select|Where|FirstOrDefault|ToList|Any)\s*\(|\bstring\[\]\s+args\b/
2620
+ },
2621
+ {
2622
+ lang: "kotlin",
2623
+ w: 8,
2624
+ re: /\bfun\s+\w+\s*\([^)]*\)\s*(?::\s*[\w<>?.]+\s*)?[={]|\bdata\s+class\s+\w/
2625
+ },
2626
+ {
2627
+ lang: "kotlin",
2628
+ w: 6,
2629
+ re: /\bval[ \t]+\w+(?:[ \t]*:[ \t]*[\w<>?.]+)?[ \t]*=|\bcompanion[ \t]+object\b|\bsuspend[ \t]+fun\b/
2630
+ },
2631
+ {
2632
+ lang: "kotlin",
2633
+ w: 4,
2634
+ re: /\bprintln\s*\(|\bwhen\s*\([^)]*\)\s*\{|\bobject\s+\w+\s*[:{]|\?:\s*\w/
2635
+ },
2636
+ {
2637
+ lang: "swift",
2638
+ w: 8,
2639
+ re: /\bguard\s+(?:let|var)\s[^\n]*\belse\b|\bfunc\s+\w+\s*\([^)]*\)\s*(?:async\s+)?(?:throws\s+)?->\s*[\w<>?[\]]/
2640
+ },
2641
+ {
2642
+ lang: "swift",
2643
+ w: 6,
2644
+ re: /\bprotocol[ \t]+\w+[^\n{]{0,40}\{|\bextension[ \t]+\w+[^\n{]{0,40}\{|\bimport[ \t]+(?:SwiftUI|UIKit|Foundation)\b/
2645
+ },
2646
+ {
2647
+ lang: "swift",
2648
+ w: 6,
2649
+ re: /\b(?:let|var)\s+\w+\s*:\s*(?:Int|String|Double|Float|Bool|Character|Any|\[[A-Z])|@(?:State|Binding|Published|IBOutlet|objc)\b/
2650
+ },
2651
+ {
2652
+ lang: "swift",
2653
+ w: 4,
2654
+ re: /\\\(\w|\bif[ \t]+let[ \t]+\w|\bstruct[ \t]+\w+[ \t]*:[ \t]*View\b|\bfunc[ \t]+\w+[ \t]*\([^)]*:[ \t]*[A-Z]/
2655
+ },
2656
+ {
2657
+ lang: "swift",
2658
+ w: 3,
2659
+ re: /\?\?\s*\w|\b\w+\?\.\w|\bself\.\w+\s*=/
2660
+ },
2661
+ {
2662
+ lang: "cpp",
2663
+ w: 8,
2664
+ re: /#include\s*<(?:iostream|vector|map|set|algorithm|string|memory|utility)>/
2665
+ },
2666
+ {
2667
+ lang: "cpp",
2668
+ w: 6,
2669
+ re: /\btemplate\s*<\s*(?:typename|class)\b|\bnullptr\b|\bnamespace\s+\w+\s*\{/
2670
+ },
2671
+ {
2672
+ lang: "c",
2673
+ w: 8,
2674
+ re: /#include\s*<(?:stdio|stdlib|string|math|time|ctype|unistd)\.h>/
2675
+ },
2676
+ {
2677
+ lang: "c",
2678
+ w: 6,
2679
+ re: /\b(?:printf|scanf|malloc|calloc|free|memcpy|strlen)\s*\(/
2680
+ },
2681
+ {
2682
+ lang: "c",
2683
+ w: 4,
2684
+ re: /\bint\s+main\s*\(\s*(?:void|int\s+argc|\)\s*\{)/
2685
+ },
2686
+ {
2687
+ lang: "c",
2688
+ w: 3,
2689
+ re: /\btypedef\s+struct\b|\bsizeof\s*\(|\bNULL\b/
2690
+ },
2691
+ {
2692
+ lang: "ruby",
2693
+ w: 8,
2694
+ re: /\bdo[ \t]*\|[ \t]*\w[\w, ]*\|/
2695
+ },
2696
+ {
2697
+ lang: "ruby",
2698
+ w: 7,
2699
+ re: /\battr_(?:accessor|reader|writer)\s+:|\brequire(?:_relative)?\s+['"]|\bputs\s+\S/
2700
+ },
2701
+ {
2702
+ lang: "ruby",
2703
+ w: 4,
2704
+ re: /(?:^|\n)[ \t]*def[ \t]+\w/
2705
+ },
2706
+ {
2707
+ lang: "ruby",
2708
+ w: 4,
2709
+ re: /(?:^|\n)[ \t]*end[ \t]*$/m
2710
+ },
2711
+ {
2712
+ lang: "ruby",
2713
+ w: 4,
2714
+ re: /\bnil\?\b|\b\w+\.new\b|=>\s*['"\w]|\bmodule\s+[A-Z]\w*\s*$/m
2715
+ },
2716
+ {
2717
+ lang: "ruby",
2718
+ w: 3,
2719
+ re: /:\w+[ \t]*=>|\bend[ \t]*$/m
2720
+ },
2721
+ {
2722
+ lang: "php",
2723
+ w: 7,
2724
+ re: /\$this->\w|\bfunction\s+\w+\s*\([^)]*\$\w/
2725
+ },
2726
+ {
2727
+ lang: "php",
2728
+ w: 6,
2729
+ re: /\$\w+\s*=\s*\S|\bforeach\s*\(\s*\$\w+\s+as\s+\$/
2730
+ },
2731
+ {
2732
+ lang: "php",
2733
+ w: 5,
2734
+ re: /\becho[ \t][^;\n]*[$'"]|\bnamespace[ \t]+[\w\\]+;|\buse[ \t]+[\w\\]+\\\w+;/
2735
+ },
2736
+ {
2737
+ lang: "php",
2738
+ w: 8,
2739
+ re: /\b(?:public|private|protected)\s+(?:static\s+)?function\s+\w/
2740
+ },
2741
+ {
2742
+ lang: "php",
2743
+ w: 3,
2744
+ re: /->\w+\s*\(|::\w+\s*\(/
2745
+ },
2746
+ {
2747
+ lang: "html",
2748
+ w: 7,
2749
+ re: /<(?:html|head|body|nav|section|article|header|footer|main|form)\b[^>]*>/i
2750
+ },
2751
+ {
2752
+ lang: "html",
2753
+ w: 5,
2754
+ re: /<(?:div|p|span|a|img|ul|ol|li|table|tr|td|input|button|h[1-6])\b[^>]*>[\s\S]*<\/(?:div|p|span|a|ul|ol|li|table|tr|td|button|h[1-6])>/i
2755
+ },
2756
+ {
2757
+ lang: "html",
2758
+ w: 4,
2759
+ re: /<\w+\s+(?:class|id|href|src|type|style)\s*=\s*["']/i
2760
+ },
2761
+ {
2762
+ lang: "xml",
2763
+ w: 6,
2764
+ re: /\bxmlns(?::\w+)?\s*=\s*["']|<\/\w+:\w+>|<\w+:\w+[\s>]/
2765
+ },
2766
+ {
2767
+ lang: "json",
2768
+ w: 8,
2769
+ re: /^\s*[{[][\s\S]*"[\w-]+"\s*:\s*(?:"[^"]*"|-?\d|\{|\[|true|false|null)/
2770
+ },
2771
+ {
2772
+ lang: "json",
2773
+ w: 3,
2774
+ re: /^\s*\{[\s\S]*\}\s*$|^\s*\[[\s\S]*\]\s*$/
2775
+ },
2776
+ {
2777
+ lang: "yaml",
2778
+ w: 8,
2779
+ re: /^---\s*$/m
2780
+ },
2781
+ {
2782
+ lang: "yaml",
2783
+ w: 6,
2784
+ re: /^[ \t]*-\s+\w+\s*:\s*\S/m
2785
+ },
2786
+ {
2787
+ lang: "yaml",
2788
+ w: 5,
2789
+ re: /^[a-z_][\w-]*[ \t]*:(?:[ \t]*$|[ \t]+(?:[|>][-+]?[ \t]*$|['"\w[{]))/im
2790
+ },
2791
+ {
2792
+ lang: "yaml",
2793
+ w: 4,
2794
+ re: /^[ \t]+[a-z_][\w-]*[ \t]*:[ \t]*\S/im
2795
+ },
2796
+ {
2797
+ lang: "yaml",
2798
+ w: 3,
2799
+ re: /^[ \t]*-\s+\S/m
2800
+ },
2801
+ {
2802
+ lang: "markdown",
2803
+ w: 7,
2804
+ re: /^#{1,6}\s+\S/m
2805
+ },
2806
+ {
2807
+ lang: "markdown",
2808
+ w: 6,
2809
+ re: /^```|^\|[^\n|]+\|[^\n]*\n\s*\|[\s:|-]+\|/m
2810
+ },
2811
+ {
2812
+ lang: "markdown",
2813
+ w: 4,
2814
+ re: /\[[^\]\n]+\]\([^)\n]+\)|!\[[^\]\n]*\]\(/
2815
+ },
2816
+ {
2817
+ lang: "markdown",
2818
+ w: 3,
2819
+ re: /\*\*[^*\n]+\*\*|^>\s+\S|^[-*+]\s+\S/m
2820
+ },
2821
+ {
2822
+ lang: "sql",
2823
+ w: 9,
2824
+ re: /(?:^|\n)\s*(?:SELECT\s+[\w*]|INSERT\s+INTO\s|UPDATE\s+\w+\s+SET\s|DELETE\s+FROM\s)/i
2825
+ },
2826
+ {
2827
+ lang: "sql",
2828
+ w: 8,
2829
+ re: /(?:^|\n)\s*(?:CREATE|ALTER|DROP)\s+(?:TABLE|DATABASE|INDEX|VIEW|SCHEMA)\b/i
2830
+ },
2831
+ {
2832
+ lang: "sql",
2833
+ w: 4,
2834
+ re: /\b(?:INNER|LEFT|RIGHT|FULL)\s+(?:OUTER\s+)?JOIN\b|\bGROUP\s+BY\b|\bORDER\s+BY\b|\bWITH\s+\w+\s+AS\s*\(/i
2835
+ },
2836
+ {
2837
+ lang: "scss",
2838
+ w: 9,
2839
+ re: /^[ \t]*\$[\w-]+[ \t]*:[^;\n]+;|@(?:mixin|include|extend|use|forward)[ \t]+[\w"'-]/m
2840
+ },
2841
+ {
2842
+ lang: "scss",
2843
+ w: 7,
2844
+ re: /^[ \t]*&[\s.:[&>+~]|#\{[^}]*\}/m
2845
+ },
2846
+ {
2847
+ lang: "scss",
2848
+ w: 4,
2849
+ re: /^[ \t]*\/\/[ \t]*\S/m
2850
+ },
2851
+ {
2852
+ lang: "css",
2853
+ w: 6,
2854
+ re: /^[ \t]*(?!(?:export|import|return|function|const|let|var|val|if|else|for|while|switch|case|class|new|public|private|protected|internal|def|func|fun|fn|pub|package|type|interface|enum|struct|impl|trait|mod|use|using|namespace|module|data|object|async|await|guard|extension|protocol|template|typedef)\b)[.#]?[\w-]+[^{}\n]{0,60}\{[^{}:]*:[^{};]+[;}]/m
2855
+ },
2856
+ {
2857
+ lang: "css",
2858
+ w: 5,
2859
+ re: /@(?:media|supports|keyframes|font-face|import|charset)\b/
2860
+ },
2861
+ {
2862
+ lang: "css",
2863
+ w: 4,
2864
+ re: /:\s*(?:#[\da-f]{3,8}|\d+(?:px|rem|em|%|vh|vw)|flex|grid|block|none|absolute|relative)\s*[;}]/i
2865
+ },
2866
+ {
2867
+ lang: "css",
2868
+ w: 3,
2869
+ re: /::?(?:hover|focus|active|before|after|first-child|last-child|nth-child)\b/
2870
+ },
2871
+ {
2872
+ lang: "bash",
2873
+ w: 7,
2874
+ re: /(?:^|\n|&&|\|\|)\s*(?:sudo\s+)?(?:apt(?:-get)?|yum|brew|npm|pnpm|yarn|pip3?|docker|kubectl|git|systemctl|curl|wget|chmod|chown|mkdir|rm|cp|mv|tar|ssh|scp)\s+[\w./-]/
2875
+ },
2876
+ {
2877
+ lang: "bash",
2878
+ w: 6,
2879
+ re: /^\s*(?:export|source|alias)\s+\w+|^\s*\w+=\S+\s*$/m
2880
+ },
2881
+ {
2882
+ lang: "bash",
2883
+ w: 6,
2884
+ re: /\bfi[ \t]*$|(?:^|\n)[ \t]*(?:if|for|while)[ \t][^\n]*;[ \t]*(?:then|do)\b|(?:^|\n)[ \t]*done\b/m
2885
+ },
2886
+ {
2887
+ lang: "bash",
2888
+ w: 5,
2889
+ re: /\$\{?\w+\}?[/:]|"\$\w|\becho\s+["'$]|\$\(\w/
2890
+ },
2891
+ {
2892
+ lang: "bash",
2893
+ w: 4,
2894
+ re: /(?:^|\n|\|)\s*(?:grep|awk|sed|cat|ls|cd|pwd|find|xargs|head|tail|sort|uniq|wc)\s+[-\w$'"./]/
2895
+ },
2896
+ {
2897
+ lang: "bash",
2898
+ w: 3,
2899
+ re: /\s\|[ \t]*\w|\s&&\s|\s2>&1|\s-[\w-]+\s/
2900
+ }
2901
+ ], cr = 4e3;
2902
+ function lr(e) {
2903
+ if (e.length <= cr) return e;
2904
+ let t = e.slice(0, cr), n = t.lastIndexOf("\n");
2905
+ return n > 0 ? t.slice(0, n) : t;
2906
+ }
2907
+ function ur(e) {
2332
2908
  if (!e?.trim()) return null;
2333
- let t = e.trim();
2334
- return /(:\s*(string|number|boolean|void|never|any|unknown)\b|interface\s+\w+\s*\{|type\s+\w+\s*[=<(]|<\w+>\s*[;,)]|readonly\s+\w|enum\s+\w+\s*\{|\?\s*:\s*\w|as\s+\w+\s*[;,)\]])/.test(t) ? "typescript" : /\bprintln!\s*\(|\bprint!\s*\(|\bfn\s+\w+\s*(<[^>]*>)?\s*\(|\blet\s+mut\s|\bpub\s+fn\s|\buse\s+std::|\bimpl\s+\w+|\bOption<|\bResult<\w+/.test(t) ? "rust" : /(<\?php\b|<\?=|\becho\s+.*\$\w|\$this->|\$\w+\s*=\s*\w|\bforeach\s*\(\s*\$|Illuminate\\)/.test(t) ? "php" : /\bpublic\s+(class|static|void|int|String)\s+\w|System\.out\.(print|println)\s*\(|@(Override|Autowired|Component|Service|Controller)\b|import\s+java\.(util|io|lang|net)\.|throws\s+\w+Exception/.test(t) ? "java" : /\bfun\s+\w+\s*\(|\bdata\s+class\s+\w+|\bcompanion\s+object\b|\bval\s+\w+\s*:\s*\w|\bprintln\s*\(/.test(t) ? "kotlin" : /\bguard\s+(let|var)\b|\bprotocol\s+\w+\s*\{|\bextension\s+\w+|\bfunc\s+\w+[^(]*\([^)]*\)\s*->\s*\w|\blet\s+\w+\s*:\s*[A-Z]\w*|\bSwiftUI\b/.test(t) ? "swift" : /\bpackage\s+\w+\b|\bfmt\.(Print|Println|Sprintf|Errorf|Fprintf)\s*\(|:=\s*\w|\bgoroutine\b|\bchan\s+\w|\bgo\s+func\b/.test(t) ? "go" : /\b(const\s+\w|let\s+\w+\s*=|var\s+\w+\s*=|function\s+\w|\=>\s*[{(]|import\s+.*\bfrom\b\s*['"]|require\s*\(|console\.(log|error|warn|info)|document\.\w|window\.\w|async\s+function|\bPromise\b|React\.|useState\s*\(|\.then\s*\()/.test(t) ? "javascript" : /^<!DOCTYPE html/i.test(t) || /<(html|head|body|div|section|article|nav|p|a|img|ul|ol|li|table|form|input|button|script|style)\b[^>]*>/i.test(t) ? "html" : /(^|\n)\s*(\/\/\s+\S|&[:.[\w]|\$\w+\s*:|@(mixin|include|extend|each|if|for|use|forward)\b|#\{)/.test(t) && /[\w#.*&[\]:(),>+~ -]+\s*\{/.test(t) ? "scss" : /(^|\n)\s*[\w#.*:[\]&, +-]+\s*\{[^}]*[\w-]+\s*:[^{}:;]+[;}\n]/m.test(t) && !/<\w|function\s|def\s|:\s*(string|number)/.test(t) ? "css" : /^\s*[{[]/.test(t) && /"\w[\w\s-]*"\s*:/.test(t) && !/\bfunction\b|\bdef\b/.test(t) ? "json" : /(^|\n)\s*(SELECT\s|INSERT\s+INTO|UPDATE\s+\w|DELETE\s+FROM|CREATE\s+(TABLE|DATABASE|INDEX|VIEW)|DROP\s+(TABLE|DATABASE)|ALTER\s+TABLE|WITH\s+\w+\s+AS\s*\()/im.test(t) ? "sql" : /\bdef\s+\w+\s*\([^)]*\)\s*:|(^|\n)\s*class\s+\w+.*:\s*$|(^|\n)\s*import\s+\w|(^|\n)\s*from\s+\w+\s+import\s+|\bprint\s*\(|if\s+__name__\s*==\s*['"]__main__['"]/m.test(t) ? "python" : /\bputs\s+\S|\battr_(accessor|reader|writer)\s|\.each\s+do\s*\|\w+\s*\||\bdo\s*\|\w+\s*\|.*\bend\b|\bdef\s+\w+[^:]*\n[\s\S]*?\bend\b/.test(t) ? "ruby" : /^#!.*\/(ba|z|da|fi|k)?sh\b/m.test(t) || /\b(echo\s+["']|grep\s+|awk\s+|sed\s+['"\\/-]|chmod\s+|sudo\s+|apt(-get)?\s+install|brew\s+install|npm\s+(install|run|start|build)|pip\s+(install|3\s)|docker\s+(run|build|compose)|kubectl\s+|git\s+(clone|add|commit|push|pull|checkout))\b/.test(t) ? "bash" : /\bcout\s*<<|\bcin\s*>>|using\s+namespace\s+std\b|std::\w|\btemplate\s*<\w|\b#include\s*<(iostream|vector|map|set|algorithm|string|memory)>/.test(t) ? "cpp" : /\busing\s+System\b|Console\.(Write|WriteLine)\s*\(|\bget;\s*set;|\basync\s+Task[<\s]|IEnumerable<|\bLINQ\b|\.Select\s*\(|\.Where\s*\(/.test(t) ? "csharp" : /\b#include\s*<(stdio|stdlib|string|math|time|ctype)\.h>|\bprintf\s*\(|\bscanf\s*\(|int\s+main\s*\(\s*(void|int\s+argc)|\bmalloc\s*\(|\bfree\s*\(/.test(t) && !/namespace|cout|cin|std::/.test(t) ? "c" : /^<\?xml\s/i.test(t) || /xmlns:|<\/[\w:]+>/.test(t) ? "xml" : null;
2909
+ let t = lr(e.trim()), n = /* @__PURE__ */ new Map();
2910
+ for (let { lang: e, re: r, w: i } of sr) r.test(t) && n.set(e, (n.get(e) || 0) + i);
2911
+ if (n.size === 0) return null;
2912
+ for (let [e, t] of or) {
2913
+ let r = n.get(e);
2914
+ r && n.set(e, r + (n.get(t) || 0));
2915
+ }
2916
+ let r = [...n.entries()].sort((e, t) => t[1] - e[1]), [i, a] = r[0], o = r[1]?.[1] ?? 0;
2917
+ return a < ir || a - o < ar ? null : i;
2335
2918
  }
2336
2919
  //#endregion
2337
2920
  //#region src/js/module/Editor.js
2338
- var or = class {
2921
+ var dr = class {
2339
2922
  constructor(e) {
2340
2923
  this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null;
2341
2924
  }
@@ -2527,10 +3110,10 @@ var or = class {
2527
3110
  return !e && !t;
2528
3111
  }
2529
3112
  insertHTML(e) {
2530
- e && (D("insertHTML", M(e)), this.afterCommand());
3113
+ e && (O("insertHTML", M(e)), this.afterCommand());
2531
3114
  }
2532
3115
  insertText(e) {
2533
- e && (D("insertText", e), this.afterCommand());
3116
+ e && (O("insertText", e), this.afterCommand());
2534
3117
  }
2535
3118
  setMarkdown(e) {
2536
3119
  this.setHTML(Pn(e || ""));
@@ -2566,49 +3149,49 @@ var or = class {
2566
3149
  return !e || !this._history ? !1 : (this._history._restoreSelection(e), !0);
2567
3150
  }
2568
3151
  bold() {
2569
- we(), this.afterCommand();
3152
+ Ce(), this.afterCommand();
2570
3153
  }
2571
3154
  italic() {
2572
- Te(), this.afterCommand();
3155
+ we(), this.afterCommand();
2573
3156
  }
2574
3157
  underline() {
2575
- Ee(), this.afterCommand();
3158
+ Te(), this.afterCommand();
2576
3159
  }
2577
3160
  strikethrough() {
2578
- De(), this.afterCommand();
3161
+ Ee(), this.afterCommand();
2579
3162
  }
2580
3163
  superscript() {
2581
- Oe(), this.afterCommand();
3164
+ De(), this.afterCommand();
2582
3165
  }
2583
3166
  subscript() {
2584
- ke(), this.afterCommand();
3167
+ Oe(), this.afterCommand();
2585
3168
  }
2586
3169
  justifyLeft() {
2587
- Fe(), this.afterCommand();
3170
+ Pe(), this.afterCommand();
2588
3171
  }
2589
3172
  justifyCenter() {
2590
- Ie(), this.afterCommand();
3173
+ Fe(), this.afterCommand();
2591
3174
  }
2592
3175
  justifyRight() {
2593
- Le(), this.afterCommand();
3176
+ Ie(), this.afterCommand();
2594
3177
  }
2595
3178
  justifyFull() {
2596
- Re(), this.afterCommand();
3179
+ Le(), this.afterCommand();
2597
3180
  }
2598
3181
  indent() {
2599
- ze(), this.afterCommand();
3182
+ Re(), this.afterCommand();
2600
3183
  }
2601
3184
  outdent() {
2602
- Be(), this.afterCommand();
3185
+ ze(), this.afterCommand();
2603
3186
  }
2604
3187
  insertUL() {
2605
- We(), this.afterCommand();
3188
+ Ue(), this.afterCommand();
2606
3189
  }
2607
3190
  insertOL() {
2608
- Ge(), this.afterCommand();
3191
+ We(), this.afterCommand();
2609
3192
  }
2610
3193
  inlineCode() {
2611
- qe(this.context.layoutInfo.editable), this.afterCommand();
3194
+ Ke(this.context.layoutInfo.editable), this.afterCommand();
2612
3195
  }
2613
3196
  toggleChecklist() {
2614
3197
  Xe(), this.afterCommand();
@@ -2617,12 +3200,12 @@ var or = class {
2617
3200
  this.context.print();
2618
3201
  }
2619
3202
  formatBlock(e) {
2620
- if (Pe(e), e === "pre") {
3203
+ if (Ne(e), e === "pre") {
2621
3204
  let e = globalThis.getSelection();
2622
3205
  if (e?.rangeCount > 0) {
2623
3206
  let t = e.getRangeAt(0).commonAncestorContainer, n = t.nodeType === 1 ? t.closest("pre") : t.parentElement?.closest("pre");
2624
3207
  if (n && !n.dataset.language) {
2625
- let e = ar(n.textContent || "");
3208
+ let e = ur(n.textContent || "");
2626
3209
  if (e) {
2627
3210
  this.context.invoke("codeTooltip.applyLanguage", n, e);
2628
3211
  return;
@@ -2633,19 +3216,19 @@ var or = class {
2633
3216
  this.afterCommand();
2634
3217
  }
2635
3218
  foreColor(e) {
2636
- Ae(e), this.afterCommand();
3219
+ ke(e), this.afterCommand();
2637
3220
  }
2638
3221
  backColor(e) {
2639
- je(e), this.afterCommand();
3222
+ Ae(e), this.afterCommand();
2640
3223
  }
2641
3224
  fontName(e) {
2642
- Me(e), this.afterCommand();
3225
+ je(e), this.afterCommand();
2643
3226
  }
2644
3227
  fontSize(e) {
2645
- Ne(e, this.context.layoutInfo.editable), this.afterCommand();
3228
+ Me(e, this.context.layoutInfo.editable), this.afterCommand();
2646
3229
  }
2647
3230
  insertHr() {
2648
- D("insertHorizontalRule"), this.afterCommand();
3231
+ O("insertHorizontalRule"), this.afterCommand();
2649
3232
  }
2650
3233
  insertLink(e, t, n = !1) {
2651
3234
  let r = globalThis.getSelection();
@@ -2653,19 +3236,19 @@ var or = class {
2653
3236
  let i = sn(e);
2654
3237
  if (i) {
2655
3238
  if (r.toString().trim().length > 0) {
2656
- if (D("createLink", i), n) {
3239
+ if (O("createLink", i), n) {
2657
3240
  let e = this._getClosestAnchor();
2658
3241
  e && (e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"));
2659
3242
  }
2660
3243
  } else {
2661
3244
  let e = this._escapeAttr(t || i);
2662
- D("insertHTML", `<a href="${this._escapeAttr(i)}"${n ? " target=\"_blank\" rel=\"noopener noreferrer\"" : ""}>${e}</a>`);
3245
+ O("insertHTML", `<a href="${this._escapeAttr(i)}"${n ? " target=\"_blank\" rel=\"noopener noreferrer\"" : ""}>${e}</a>`);
2663
3246
  }
2664
3247
  this.afterCommand();
2665
3248
  }
2666
3249
  }
2667
3250
  unlink() {
2668
- D("unlink"), this.afterCommand();
3251
+ O("unlink"), this.afterCommand();
2669
3252
  }
2670
3253
  insertImage(e, t = "", n = "") {
2671
3254
  let r = sn(e, { allowData: !0 });
@@ -2675,10 +3258,10 @@ var or = class {
2675
3258
  center: "display:block;margin:0 auto",
2676
3259
  right: "float:right;margin:0 0 1em 1em"
2677
3260
  }[n] || "", a = i ? ` style="${i}"` : "";
2678
- D("insertHTML", `<img src="${this._escapeAttr(r)}" alt="${this._escapeAttr(t)}" class="an-image"${a}>`), this.afterCommand();
3261
+ O("insertHTML", `<img src="${this._escapeAttr(r)}" alt="${this._escapeAttr(t)}" class="an-image"${a}>`), this.afterCommand();
2679
3262
  }
2680
3263
  insertVideo(e) {
2681
- e && (D("insertHTML", e), this.afterCommand());
3264
+ e && (O("insertHTML", e), this.afterCommand());
2682
3265
  }
2683
3266
  insertTable(e, t) {
2684
3267
  fn(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
@@ -2696,7 +3279,7 @@ var or = class {
2696
3279
  _escapeAttr(e) {
2697
3280
  return String(e ?? "").replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2698
3281
  }
2699
- }, sr = (e) => typeof e == "string" ? et(e) : e, B = null, cr = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", V = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${cr} style="display:block">${e}</svg>`, H = /* @__PURE__ */ new Map([
3282
+ }, fr = (e) => typeof e == "string" ? et(e) : e, pr = null, mr = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", V = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${mr} style="display:block">${e}</svg>`, H = /* @__PURE__ */ new Map([
2700
3283
  ["bold", V("<path d=\"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/><path d=\"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/>")],
2701
3284
  ["italic", V("<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"/><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"/><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"/>")],
2702
3285
  ["underline", V("<path d=\"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3\"/><line x1=\"4\" y1=\"21\" x2=\"20\" y2=\"21\"/>")],
@@ -2733,7 +3316,7 @@ var or = class {
2733
3316
  ["inline-code", V("<path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\"/><path d=\"M16 3h1a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2a2 2 0 0 1-2 2v5a2 2 0 0 1-2 2h-1\"/>")],
2734
3317
  ["checklist", V("<rect x=\"3\" y=\"4\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"m4 6.5 1 1 2-2\"/><rect x=\"3\" y=\"13\" width=\"5\" height=\"5\" rx=\"1\"/><line x1=\"10\" y1=\"6.5\" x2=\"21\" y2=\"6.5\"/><line x1=\"10\" y1=\"15.5\" x2=\"21\" y2=\"15.5\"/>")],
2735
3318
  ["print", V("<path d=\"M6 9V2h12v7\"/><path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\"/><rect x=\"6\" y=\"14\" width=\"12\" height=\"8\"/>")]
2736
- ]), lr = /* @__PURE__ */ new Map([
3319
+ ]), hr = /* @__PURE__ */ new Map([
2737
3320
  ["bold", "fa-bold"],
2738
3321
  ["italic", "fa-italic"],
2739
3322
  ["underline", "fa-underline"],
@@ -2767,7 +3350,7 @@ var or = class {
2767
3350
  ["inline-code", "fa-code"],
2768
3351
  ["checklist", "fa-list-check"],
2769
3352
  ["print", "fa-print"]
2770
- ]), ur = class {
3353
+ ]), gr = class {
2771
3354
  constructor(e) {
2772
3355
  this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._colorPickerClosers = [], this._refreshRaf = null;
2773
3356
  }
@@ -2777,7 +3360,7 @@ var or = class {
2777
3360
  role: "toolbar",
2778
3361
  "aria-orientation": "horizontal",
2779
3362
  "aria-label": "Editor toolbar"
2780
- }), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(sr).filter(Boolean).map((e) => [e.name, e])), this;
3363
+ }), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(fr).filter(Boolean).map((e) => [e.name, e])), this;
2781
3364
  }
2782
3365
  destroy() {
2783
3366
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = null, this._disposers.forEach((e) => e()), this._disposers = [], this.el?.parentNode && this.el.remove(), this.el = null;
@@ -2787,7 +3370,7 @@ var or = class {
2787
3370
  e.forEach((e) => {
2788
3371
  let n = w("div", { class: "an-btn-group" });
2789
3372
  e.forEach((e) => {
2790
- let t = sr(e);
3373
+ let t = fr(e);
2791
3374
  if (!t) {
2792
3375
  console.warn(`[AutumnNote] Toolbar: button "${e}" not found in registry. Skipped.`);
2793
3376
  return;
@@ -3006,7 +3589,7 @@ var or = class {
3006
3589
  ...typeof e.isActive == "function" ? { "aria-pressed": "false" } : {}
3007
3590
  }), n = this.options.fontAwesomeClass || "fas";
3008
3591
  if (this._faReady) {
3009
- let r = lr.get(e.icon) || lr.get(e.name) || null;
3592
+ let r = hr.get(e.icon) || hr.get(e.name) || null;
3010
3593
  r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` : H.has(e.icon) ? t.innerHTML = H.get(e.icon) : t.textContent = e.icon || e.name;
3011
3594
  } else H.has(e.icon) ? t.innerHTML = H.get(e.icon) : H.has(e.name) ? t.innerHTML = H.get(e.name) : t.textContent = e.icon || e.name;
3012
3595
  let r = E(t, "click", (t) => {
@@ -3052,10 +3635,10 @@ var or = class {
3052
3635
  }
3053
3636
  _detectFontAwesome() {
3054
3637
  if (!this.options.useFontAwesome) return !1;
3055
- if (B !== null) return B;
3056
- if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return B = !0, !0;
3638
+ if (pr !== null) return pr;
3639
+ if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return pr = !0, !0;
3057
3640
  let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).filter((e) => e.id !== "an-fontawesome-css").map((e) => e.href || "").join(" ");
3058
- return B = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), B;
3641
+ return pr = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), pr;
3059
3642
  }
3060
3643
  refresh() {
3061
3644
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = requestAnimationFrame(() => {
@@ -3088,27 +3671,27 @@ var or = class {
3088
3671
  this.el && (this.el.style.display = "none");
3089
3672
  }
3090
3673
  rebuild() {
3091
- this._refreshRaf &&= (cancelAnimationFrame(this._refreshRaf), null), this._disposers.forEach((e) => e()), this._disposers = [], this.el && (this.el.innerHTML = ""), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(sr).filter(Boolean).map((e) => [e.name, e])), this.refresh();
3674
+ this._refreshRaf &&= (cancelAnimationFrame(this._refreshRaf), null), this._disposers.forEach((e) => e()), this._disposers = [], this.el && (this.el.innerHTML = ""), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(fr).filter(Boolean).map((e) => [e.name, e])), this.refresh();
3092
3675
  }
3093
- }, dr = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
3094
- function fr(e) {
3676
+ }, _r = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
3677
+ function vr(e) {
3095
3678
  let t = e.trim();
3096
3679
  if (!t) return 0;
3097
- if (dr) {
3680
+ if (_r) {
3098
3681
  let e = 0;
3099
- for (let n of dr.segment(t)) n.isWordLike && e++;
3682
+ for (let n of _r.segment(t)) n.isWordLike && e++;
3100
3683
  return e;
3101
3684
  }
3102
3685
  return t.split(/\s+/).length;
3103
3686
  }
3104
- function pr(e, t, n) {
3687
+ function yr(e, t, n) {
3105
3688
  if (!n) {
3106
3689
  e.classList.remove("an-count-warn", "an-count-exceeded");
3107
3690
  return;
3108
3691
  }
3109
3692
  t > n ? (e.classList.add("an-count-exceeded"), e.classList.remove("an-count-warn")) : t >= n * .9 ? (e.classList.add("an-count-warn"), e.classList.remove("an-count-exceeded")) : e.classList.remove("an-count-warn", "an-count-exceeded");
3110
3693
  }
3111
- var mr = class {
3694
+ var br = class {
3112
3695
  constructor(e) {
3113
3696
  this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null;
3114
3697
  }
@@ -3161,17 +3744,17 @@ var mr = class {
3161
3744
  }
3162
3745
  update() {
3163
3746
  if (!this._wordCountEl || !this._charCountEl) return;
3164
- let e = this.context.layoutInfo.editable.textContent || "", t = fr(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
3165
- this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), pr(this._wordCountEl, t, r), pr(this._charCountEl, n, i);
3747
+ let e = this.context.layoutInfo.editable.textContent || "", t = vr(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
3748
+ this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), yr(this._wordCountEl, t, r), yr(this._charCountEl, n, i);
3166
3749
  }
3167
3750
  getWordCount() {
3168
3751
  let e = this.context.layoutInfo.editable;
3169
- return fr(e.innerText || "");
3752
+ return vr(e.innerText || "");
3170
3753
  }
3171
3754
  getCharCount() {
3172
3755
  return (this.context.layoutInfo.editable.innerText || "").replaceAll("\n", "").length;
3173
3756
  }
3174
- }, hr = class {
3757
+ }, xr = class {
3175
3758
  constructor(e) {
3176
3759
  this.context = e, this.options = e.options, this._disposers = [];
3177
3760
  }
@@ -3283,20 +3866,20 @@ var mr = class {
3283
3866
  text: t.getData("text/plain") || "",
3284
3867
  html: t.types.includes("text/html") ? t.getData("text/html") : null
3285
3868
  }), n || this.options.pasteAsPlainText) {
3286
- e.preventDefault(), D("insertHTML", t.getData("text/plain").split(/\r?\n/).map((e) => `<p>${this._escapeHTML(e) || "<br>"}</p>`).join("")), this.context.invoke("editor.afterCommand");
3869
+ e.preventDefault(), O("insertHTML", t.getData("text/plain").split(/\r?\n/).map((e) => `<p>${this._escapeHTML(e) || "<br>"}</p>`).join("")), this.context.invoke("editor.afterCommand");
3287
3870
  return;
3288
3871
  }
3289
3872
  if (this.options.markdownPaste !== !1) {
3290
3873
  let n = t.types.includes("text/html"), r = n ? t.getData("text/html") : "", i = !n || this._isTriviallyPlainHtml(r), a = t.getData("text/plain");
3291
3874
  if (a && i && En(a)) {
3292
- e.preventDefault(), D("insertHTML", M(Pn(a))), this.context.invoke("editor.afterCommand");
3875
+ e.preventDefault(), O("insertHTML", M(Pn(a))), this.context.invoke("editor.afterCommand");
3293
3876
  return;
3294
3877
  }
3295
3878
  }
3296
3879
  if (this.options.pasteCleanHTML !== !1 && t.types.includes("text/html")) {
3297
3880
  e.preventDefault();
3298
3881
  let n = t.getData("text/html"), r = /<[a-z]+:[a-z]/i.test(n) || /class="Mso/i.test(n) || /\bmso-/i.test(n), i = /class="[^"]*\b(?:x[a-z0-9]{6,}|r-[a-z0-9]{3,})\b/.test(n), a = n;
3299
- r ? a = this._cleanWordHtml(a) : i && (a = this._cleanSocialHtml(a)), a = this._normalizeExternalTaskLists(a), a = M(a), this.options.pasteStripAttributes && (a = this._stripAttributes(a)), D("insertHTML", a), this.context.invoke("editor.afterCommand");
3882
+ r ? a = this._cleanWordHtml(a) : i && (a = this._cleanSocialHtml(a)), a = this._normalizeExternalTaskLists(a), a = M(a), this.options.pasteStripAttributes && (a = this._stripAttributes(a)), O("insertHTML", a), this.context.invoke("editor.afterCommand");
3300
3883
  }
3301
3884
  }
3302
3885
  _onDragover(e) {
@@ -3328,7 +3911,7 @@ var mr = class {
3328
3911
  }
3329
3912
  let n = new FileReader();
3330
3913
  n.onload = (e) => {
3331
- D("insertHTML", M(Pn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
3914
+ O("insertHTML", M(Pn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
3332
3915
  }, n.onerror = () => {
3333
3916
  let t = `Failed to read dropped markdown file "${e.name}".`;
3334
3917
  console.warn(`[AutumnNote] ${t}`), this.context.triggerEvent("pasteError", { message: t });
@@ -3430,7 +4013,7 @@ var mr = class {
3430
4013
  _escapeHTML(e) {
3431
4014
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#039;");
3432
4015
  }
3433
- }, gr = class {
4016
+ }, Sr = class {
3434
4017
  constructor(e) {
3435
4018
  this.context = e, this.options = e.options, this._disposers = [];
3436
4019
  }
@@ -3447,7 +4030,7 @@ var mr = class {
3447
4030
  let e = this.context.layoutInfo.editable, t = document.activeElement === e, n = !(e.textContent.replaceAll("​", "").trim().length > 0) && !e.querySelector("img, table, hr, .an-video-wrapper");
3448
4031
  e.classList.toggle("an-placeholder", n && !t);
3449
4032
  }
3450
- }, _r = class {
4033
+ }, Cr = class {
3451
4034
  constructor(e) {
3452
4035
  this.context = e, this.options = e.options, this._active = !1, this._textarea = null, this._disposers = [];
3453
4036
  }
@@ -3492,7 +4075,7 @@ var mr = class {
3492
4075
  return /^<[^/!][^>]*[^/]>/.test(r) && !t.test(r) && !/^<(br|hr|img|input|link|meta)/.test(r) && n++, i;
3493
4076
  }).filter(Boolean).join("\n");
3494
4077
  }
3495
- }, vr = class {
4078
+ }, wr = class {
3496
4079
  constructor(e) {
3497
4080
  this.context = e, this._active = !1, this._disposers = [], this._prevHeight = "";
3498
4081
  }
@@ -3535,7 +4118,7 @@ var mr = class {
3535
4118
  this._disposers.forEach((e) => e()), this._disposers = [], this._dialog?.parentNode && this._dialog.remove(), this._dialog = null;
3536
4119
  }
3537
4120
  _saveRange() {
3538
- Se((e) => {
4121
+ xe((e) => {
3539
4122
  this._savedRange = e;
3540
4123
  });
3541
4124
  }
@@ -3554,7 +4137,7 @@ var mr = class {
3554
4137
  }), i = w("div", { class: "an-dialog-box" }), a = w("div", { class: "an-dialog-header" }), o = w("span", { class: "an-dialog-icon" });
3555
4138
  o.innerHTML = t;
3556
4139
  let s = w("h3", { class: "an-dialog-title" });
3557
- s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), he(a, i);
4140
+ s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), D(a, i);
3558
4141
  let c = E(r, "click", (e) => {
3559
4142
  e.target === r && this._close();
3560
4143
  });
@@ -3577,12 +4160,12 @@ var mr = class {
3577
4160
  let o = E(i, "click", n), s = E(a, "click", () => this._close());
3578
4161
  return this._disposers.push(o, s), r;
3579
4162
  }
3580
- }, yr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>", br = class extends U {
4163
+ }, Tr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>", Er = class extends U {
3581
4164
  show() {
3582
4165
  this._saveRange(), this._prefill(), this._open();
3583
4166
  }
3584
4167
  _buildDialog() {
3585
- let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, yr, e.title), r = w("label", { class: "an-label" });
4168
+ let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Tr, e.title), r = w("label", { class: "an-label" });
3586
4169
  r.textContent = e.url;
3587
4170
  let i = w("input", {
3588
4171
  type: "url",
@@ -3652,12 +4235,12 @@ var mr = class {
3652
4235
  }
3653
4236
  this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, n), this._close();
3654
4237
  }
3655
- }, xr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/></svg>", Sr = class extends U {
4238
+ }, Dr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/></svg>", Or = class extends U {
3656
4239
  show({ beforeInsert: e } = {}) {
3657
4240
  this._beforeInsert = typeof e == "function" ? e : null, this._saveRange(), this._urlInput.value = "", this._altInput.value = "", this._fileInput && (this._fileInput.value = ""), this._open();
3658
4241
  }
3659
4242
  _buildDialog() {
3660
- let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, xr, e.title), r = w("label", { class: "an-label" });
4243
+ let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Dr, e.title), r = w("label", { class: "an-label" });
3661
4244
  r.textContent = e.imageUrl;
3662
4245
  let i = w("input", {
3663
4246
  type: "url",
@@ -3784,12 +4367,12 @@ var mr = class {
3784
4367
  _close() {
3785
4368
  this._beforeInsert = null, super._close();
3786
4369
  }
3787
- }, Cr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/></svg>", wr = class extends U {
4370
+ }, kr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/></svg>", Ar = class extends U {
3788
4371
  show() {
3789
4372
  this._saveRange(), this._urlInput.value = "", this._widthInput.value = "560", this._hintEl.textContent = "", this._open();
3790
4373
  }
3791
4374
  _buildDialog() {
3792
- let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Cr, e.title), r = w("label", { class: "an-label" });
4375
+ let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, kr, e.title), r = w("label", { class: "an-label" });
3793
4376
  r.textContent = e.videoUrl;
3794
4377
  let i = w("input", {
3795
4378
  type: "url",
@@ -3870,7 +4453,7 @@ var mr = class {
3870
4453
  let i = sn(e, { media: !0 });
3871
4454
  return i ? `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><video src="${i.replaceAll("\"", "%22")}" width="${t}" height="${r}" controls style="display:block;max-width:100%"></video><div class="an-video-shield"></div></div>` : null;
3872
4455
  }
3873
- }, Tr = [
4456
+ }, jr = [
3874
4457
  {
3875
4458
  pos: "nw",
3876
4459
  cursor: "nw-resize"
@@ -3903,7 +4486,7 @@ var mr = class {
3903
4486
  pos: "w",
3904
4487
  cursor: "w-resize"
3905
4488
  }
3906
- ], Er = class {
4489
+ ], Mr = class {
3907
4490
  constructor(e) {
3908
4491
  this.context = e, this._active = null, this._overlay = null, this._disposers = [], this._positionRaf = null, this._lastOverlayPos = null;
3909
4492
  }
@@ -3956,7 +4539,7 @@ var mr = class {
3956
4539
  }
3957
4540
  _buildOverlay() {
3958
4541
  let e = document.createElement("div");
3959
- return e.className = this._overlayClass, e.style.display = "none", Tr.forEach(({ pos: t }) => {
4542
+ return e.className = this._overlayClass, e.style.display = "none", jr.forEach(({ pos: t }) => {
3960
4543
  let n = document.createElement("div");
3961
4544
  n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "pointerdown", (e) => {
3962
4545
  e.preventDefault(), e.stopPropagation(), this._startResize(e, t);
@@ -4013,7 +4596,7 @@ var mr = class {
4013
4596
  };
4014
4597
  document.addEventListener("pointermove", p), document.addEventListener("pointerup", h), document.addEventListener("pointercancel", h), this._dragDisposers = [m];
4015
4598
  }
4016
- }, Dr = class extends Er {
4599
+ }, Nr = class extends Mr {
4017
4600
  get _overlayClass() {
4018
4601
  return "an-image-resizer";
4019
4602
  }
@@ -4042,7 +4625,7 @@ var mr = class {
4042
4625
  getActiveImage() {
4043
4626
  return this._active;
4044
4627
  }
4045
- }, Or = class extends Er {
4628
+ }, Pr = class extends Mr {
4046
4629
  get _overlayClass() {
4047
4630
  return "an-video-resizer";
4048
4631
  }
@@ -4078,12 +4661,12 @@ var mr = class {
4078
4661
  getActiveWrapper() {
4079
4662
  return this._active;
4080
4663
  }
4081
- }, kr = {
4664
+ }, Fr = {
4082
4665
  open: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/><polyline points=\"15 3 21 3 21 9\"/><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"/></svg>",
4083
4666
  edit: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>",
4084
4667
  unlink: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\"/><path d=\"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\"/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"5\"/><line x1=\"2\" y1=\"8\" x2=\"5\" y2=\"8\"/><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"22\"/><line x1=\"19\" y1=\"16\" x2=\"22\" y2=\"16\"/></svg>",
4085
4668
  copy: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg>"
4086
- }, Ar = 120, jr = 200, Mr = class {
4669
+ }, Ir = 120, Lr = 200, Rr = class {
4087
4670
  constructor(e) {
4088
4671
  this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
4089
4672
  }
@@ -4107,7 +4690,7 @@ var mr = class {
4107
4690
  role: "toolbar",
4108
4691
  "aria-label": e.ariaLabel
4109
4692
  });
4110
- return t.style.display = "none", this._urlLabel = w("span", { class: "an-link-tooltip-url" }), t.appendChild(this._urlLabel), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._openBtn = this._makeBtn(kr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(kr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(kr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(kr.unlink, e.removeLink, () => this._unlink()), t.appendChild(this._openBtn), t.appendChild(this._copyBtn), t.appendChild(this._editBtn), t.appendChild(this._unlinkBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4693
+ return t.style.display = "none", this._urlLabel = w("span", { class: "an-link-tooltip-url" }), t.appendChild(this._urlLabel), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._openBtn = this._makeBtn(Fr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(Fr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(Fr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(Fr.unlink, e.removeLink, () => this._unlink()), t.appendChild(this._openBtn), t.appendChild(this._copyBtn), t.appendChild(this._editBtn), t.appendChild(this._unlinkBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4111
4694
  }
4112
4695
  _makeBtn(e, t, n) {
4113
4696
  let r = w("button", {
@@ -4122,12 +4705,12 @@ var mr = class {
4122
4705
  _scheduleShow(e) {
4123
4706
  this._activeAnchor === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
4124
4707
  this._activeAnchor = e, this._show(e);
4125
- }, Ar));
4708
+ }, Ir));
4126
4709
  }
4127
4710
  _scheduleHide() {
4128
4711
  clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => {
4129
4712
  this._hide();
4130
- }, jr));
4713
+ }, Lr));
4131
4714
  }
4132
4715
  _show(e) {
4133
4716
  let t = this.context.layoutInfo.container.classList.contains("an-disabled"), n = e.getAttribute("href") || "";
@@ -4176,7 +4759,7 @@ var mr = class {
4176
4759
  let t = globalThis.getSelection(), n = document.createRange();
4177
4760
  n.selectNode(e), t.removeAllRanges(), t.addRange(n), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
4178
4761
  }
4179
- }, Nr = class {
4762
+ }, zr = class {
4180
4763
  constructor(e) {
4181
4764
  this.context = e, this.options = e.options, this._el = null, this._active = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
4182
4765
  }
@@ -4228,7 +4811,7 @@ var mr = class {
4228
4811
  rotateLeft: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><polyline points=\"3 3 3 8 8 8\"/></svg>",
4229
4812
  rotateRight: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 12a9 9 0 1 1-9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><polyline points=\"21 3 21 8 16 8\"/></svg>",
4230
4813
  crop: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 2 6 18 22 18\"/><polyline points=\"2 6 18 6 18 22\"/></svg>"
4231
- }, Pr = class extends Nr {
4814
+ }, Br = class extends zr {
4232
4815
  initialize() {
4233
4816
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
4234
4817
  let e = this.context.layoutInfo.editable;
@@ -4328,7 +4911,7 @@ var mr = class {
4328
4911
  originalSize: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"15 3 21 3 21 9\"/><polyline points=\"9 21 3 21 3 15\"/><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"/><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"/></svg>",
4329
4912
  deleteVideo: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\"/></svg>",
4330
4913
  preview: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"5 3 19 12 5 21 5 3\"/></svg>"
4331
- }, Fr = class extends Nr {
4914
+ }, Vr = class extends zr {
4332
4915
  initialize() {
4333
4916
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
4334
4917
  let e = this.context.layoutInfo.editable;
@@ -4434,7 +5017,7 @@ var mr = class {
4434
5017
  };
4435
5018
  //#endregion
4436
5019
  //#region src/js/module/table-grid.js
4437
- function Ir(e) {
5020
+ function Hr(e) {
4438
5021
  let t = e.closest("tr");
4439
5022
  if (!t) return -1;
4440
5023
  let n = 0;
@@ -4453,7 +5036,7 @@ function q(e, t) {
4453
5036
  }
4454
5037
  return null;
4455
5038
  }
4456
- function Lr(e, t) {
5039
+ function Ur(e, t) {
4457
5040
  let n = 0;
4458
5041
  for (let r of e.cells) if (n += r.colSpan || 1, n > t) {
4459
5042
  let e = r.nextElementSibling;
@@ -4461,7 +5044,7 @@ function Lr(e, t) {
4461
5044
  }
4462
5045
  return null;
4463
5046
  }
4464
- function Rr(e) {
5047
+ function Wr(e) {
4465
5048
  let t = Array.from(e.rows), n = {}, r = /* @__PURE__ */ new WeakMap();
4466
5049
  return t.forEach((e, t) => {
4467
5050
  n[t] || (n[t] = {});
@@ -4488,7 +5071,7 @@ function Rr(e) {
4488
5071
  }
4489
5072
  //#endregion
4490
5073
  //#region src/js/module/TableTooltip.js
4491
- var zr = 120, Br = 200, Vr = [
5074
+ var Gr = 120, Kr = 200, qr = [
4492
5075
  "#000000",
4493
5076
  "#434343",
4494
5077
  "#666666",
@@ -4513,7 +5096,7 @@ var zr = 120, Br = 200, Vr = [
4513
5096
  "#c9daf8",
4514
5097
  "#d9d2e9",
4515
5098
  "#ead1dc"
4516
- ], Hr = class {
5099
+ ], Jr = class {
4517
5100
  constructor(e) {
4518
5101
  this.context = e, this._el = null, this._activeTable = null, this._activeCell = null, this._showTimer = null, this._hideTimer = null, this._disposers = [], this._sizePopover = null, this._sizeApply = null, this._sizeTitleEl = null, this._sizeInputEl = null, this._shadePopover = null, this._shadeTitleEl = null, this._shadeColorStrip = null, this._borderColorPopover = null, this._borderColorTitleEl = null, this._borderColorStrip = null, this._borderColorNoBtn = null, this._selectMode = !1, this._selectedCells = [], this._selectStart = null, this._selectDragging = !1, this._selectBtn = null, this._editable = null;
4519
5102
  }
@@ -4571,7 +5154,7 @@ var zr = 120, Br = 200, Vr = [
4571
5154
  });
4572
5155
  }), E(e, "mousedown", (e) => {
4573
5156
  if (!this.context.layoutInfo.container.classList.contains("an-disabled") && !(!t || !n)) {
4574
- if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = Ir(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => q(e, l)).filter(Boolean).filter((e) => (e.colSpan || 1) === 1) : [], s = u.length > 0 ? u[0].offsetWidth : Math.max(30, Math.round(t.offsetWidth / (t.colSpan || 1))), document.body.style.cursor = "col-resize";
5157
+ if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = Hr(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => q(e, l)).filter(Boolean).filter((e) => (e.colSpan || 1) === 1) : [], s = u.length > 0 ? u[0].offsetWidth : Math.max(30, Math.round(t.offsetWidth / (t.colSpan || 1))), document.body.style.cursor = "col-resize";
4575
5158
  else {
4576
5159
  let e = t.closest("tr"), n = (e ? Array.from(f.rows).indexOf(e) : 0) + (t.rowSpan || 1) - 1;
4577
5160
  d = f.rows[n] || e, c = d ? d.offsetHeight : 40, document.body.style.cursor = "row-resize";
@@ -4643,10 +5226,10 @@ var zr = 120, Br = 200, Vr = [
4643
5226
  _scheduleShow(e) {
4644
5227
  this._activeTable === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
4645
5228
  this._activeTable = e, this._show();
4646
- }, zr));
5229
+ }, Gr));
4647
5230
  }
4648
5231
  _scheduleHide() {
4649
- clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Br));
5232
+ clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Kr));
4650
5233
  }
4651
5234
  _show() {
4652
5235
  this._activeTable && (this._el.style.display = "flex", this._syncShadeStrip(), this._syncBorderColorStrip(), requestAnimationFrame(() => {
@@ -4695,7 +5278,7 @@ var zr = 120, Br = 200, Vr = [
4695
5278
  if (!t || e === t) return [e];
4696
5279
  let n = e.closest("table");
4697
5280
  if (!n?.contains(t)) return [e];
4698
- let { gridMap: r, cellPos: i } = Rr(n), a = i.get(e), o = i.get(t);
5281
+ let { gridMap: r, cellPos: i } = Wr(n), a = i.get(e), o = i.get(t);
4699
5282
  if (!a || !o) return [e];
4700
5283
  let s = Math.min(a.r, o.r), c = Math.max(a.r + a.rs - 1, o.r + o.rs - 1), l = Math.min(a.c, o.c), u = Math.max(a.c + a.cs - 1, o.c + o.cs - 1), d = !0;
4701
5284
  for (; d;) {
@@ -4743,7 +5326,7 @@ var zr = 120, Br = 200, Vr = [
4743
5326
  if (!t.length) return;
4744
5327
  let n = t[0].closest("table");
4745
5328
  if (!n) return;
4746
- let r = t.map((e) => Ir(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? q(t, i) : Lr(t, i)), s = a.map((e) => e.closest("thead") !== null);
5329
+ let r = t.map((e) => Hr(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? q(t, i) : Ur(t, i)), s = a.map((e) => e.closest("thead") !== null);
4747
5330
  a.forEach((e, t) => {
4748
5331
  e.insertBefore(w(s[t] ? "th" : "td", {}, ["\xA0"]), o[t]);
4749
5332
  }), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
@@ -4763,7 +5346,7 @@ var zr = 120, Br = 200, Vr = [
4763
5346
  if (!t) return;
4764
5347
  let n = Array.from(t.querySelectorAll("tr"));
4765
5348
  if (n[0] && n[0].cells.length <= 1) return;
4766
- let r = [...new Set(e.map((e) => Ir(e)))];
5349
+ let r = [...new Set(e.map((e) => Hr(e)))];
4767
5350
  if (r.length >= (n[0]?.cells.length ?? 1)) return;
4768
5351
  let i = [];
4769
5352
  r.forEach((e) => {
@@ -4791,7 +5374,7 @@ var zr = 120, Br = 200, Vr = [
4791
5374
  }
4792
5375
  }), n.length < 2) return;
4793
5376
  }
4794
- let { gridMap: r, cellPos: i } = Rr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
5377
+ let { gridMap: r, cellPos: i } = Wr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
4795
5378
  if (n.forEach((e) => {
4796
5379
  let t = i.get(e);
4797
5380
  t && (t.r < a && (a = t.r), t.r + t.rs - 1 > o && (o = t.r + t.rs - 1), t.c < s && (s = t.c), t.c + t.cs - 1 > c && (c = t.c + t.cs - 1));
@@ -4830,7 +5413,7 @@ var zr = 120, Br = 200, Vr = [
4830
5413
  _unmergeOne(e, t) {
4831
5414
  let n = e.colSpan || 1, r = e.rowSpan || 1;
4832
5415
  if (n === 1 && r === 1) return;
4833
- let { cellPos: i } = Rr(t), a = i.get(e);
5416
+ let { cellPos: i } = Wr(t), a = i.get(e);
4834
5417
  if (!a) return;
4835
5418
  let { r: o, c: s } = a, c = Array.from(t.rows), l = e.tagName.toLowerCase();
4836
5419
  if (e.rowSpan = 1, e.colSpan = 1, e.style.verticalAlign = "", n > 1) {
@@ -4917,7 +5500,7 @@ var zr = 120, Br = 200, Vr = [
4917
5500
  let i = t.closest("table");
4918
5501
  if (i) {
4919
5502
  if (n) {
4920
- let t = [...new Set(r.map((e) => Ir(e)))], n = Array.from(i.querySelectorAll("tr"));
5503
+ let t = [...new Set(r.map((e) => Hr(e)))], n = Array.from(i.querySelectorAll("tr"));
4921
5504
  t.forEach((t) => {
4922
5505
  n.forEach((n) => {
4923
5506
  let r = q(n, t);
@@ -4947,7 +5530,7 @@ var zr = 120, Br = 200, Vr = [
4947
5530
  let a = w("div", { class: "an-size-popover-title" });
4948
5531
  i.appendChild(a);
4949
5532
  let o = w("div", { class: "an-context-color-palette" });
4950
- Vr.forEach((e) => {
5533
+ qr.forEach((e) => {
4951
5534
  let n = w("div", {
4952
5535
  class: "an-context-color-swatch",
4953
5536
  title: e
@@ -5067,7 +5650,7 @@ var zr = 120, Br = 200, Vr = [
5067
5650
  if (!t) return;
5068
5651
  let n = this._getCell();
5069
5652
  if (!n) return;
5070
- let r = Ir(n);
5653
+ let r = Hr(n);
5071
5654
  if (r === -1) return;
5072
5655
  let i = t.querySelector("tbody") || t, a = Array.from(i.querySelectorAll(":scope > tr"));
5073
5656
  a.length < 2 || (a.sort((t, n) => {
@@ -5092,13 +5675,43 @@ var zr = 120, Br = 200, Vr = [
5092
5675
  let t = Array.from(e.querySelectorAll("tr")).map((e) => Array.from(e.querySelectorAll("td, th")).map((e) => `"${(e.textContent || "").trim().replace(/"/g, "\"\"")}"`).join(",")).join("\n"), n = new Blob(["" + t], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(n), i = document.createElement("a");
5093
5676
  i.href = r, i.download = "table.csv", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
5094
5677
  }
5095
- }, Ur = 100, Wr = 180, Gr = /language-(\S+)/, Kr = {
5678
+ }, Yr = 100, Xr = 180, Zr = /language-(\S+)/, Qr = {
5096
5679
  copy: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg>",
5097
5680
  wrapOn: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"/><path d=\"M3 12h15a3 3 0 0 1 0 6H3\"/><polyline points=\"6 15 3 18 6 21\"/></svg>",
5098
5681
  toParagraph: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13 4v16\"/><path d=\"M17 4v16\"/><path d=\"M9 4h8a4 4 0 0 1 0 8H9V4z\"/></svg>",
5099
5682
  deleteCode: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\"/></svg>",
5100
5683
  lineNumbers: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"10\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"10\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"10\" y1=\"18\" x2=\"21\" y2=\"18\"/><path d=\"M4 6h1v4\"/><path d=\"M4 10h2\"/><path d=\"M6 18H4c0-1 2-2 2-3s-1-2-2-2\"/></svg>"
5101
- }, qr = class {
5684
+ }, $r = [
5685
+ ["", "Plain text"],
5686
+ ["javascript", "JavaScript"],
5687
+ ["typescript", "TypeScript"],
5688
+ ["python", "Python"],
5689
+ ["html", "HTML"],
5690
+ ["css", "CSS"],
5691
+ ["scss", "SCSS"],
5692
+ ["json", "JSON"],
5693
+ ["yaml", "YAML"],
5694
+ ["markdown", "Markdown"],
5695
+ ["xml", "XML"],
5696
+ ["bash", "Bash / Shell"],
5697
+ ["sql", "SQL"],
5698
+ ["java", "Java"],
5699
+ ["csharp", "C#"],
5700
+ ["php", "PHP"],
5701
+ ["ruby", "Ruby"],
5702
+ ["go", "Go"],
5703
+ ["rust", "Rust"],
5704
+ ["cpp", "C++"],
5705
+ ["c", "C"],
5706
+ ["kotlin", "Kotlin"],
5707
+ ["swift", "Swift"]
5708
+ ];
5709
+ function ei(e, t) {
5710
+ [...e.classList].forEach((t) => {
5711
+ t.startsWith("language-") && e.classList.remove(t);
5712
+ }), t && e.classList.add(`language-${t}`);
5713
+ }
5714
+ var ti = class {
5102
5715
  constructor(e) {
5103
5716
  this.context = e, this._el = null, this._activePre = null, this._showTimer = null, this._hideTimer = null, this._disposers = [], this._copyBtn = null, this._wrapBtn = null, this._lineNumbersBtn = null, this._langSelect = null, this._prismScript = null;
5104
5717
  }
@@ -5130,32 +5743,10 @@ var zr = 120, Br = 200, Vr = [
5130
5743
  class: "an-code-lang-select",
5131
5744
  title: e.syntaxLanguage,
5132
5745
  "aria-label": e.syntaxAriaLabel
5133
- }), [
5134
- ["", "Plain text"],
5135
- ["javascript", "JavaScript"],
5136
- ["typescript", "TypeScript"],
5137
- ["python", "Python"],
5138
- ["html", "HTML"],
5139
- ["css", "CSS"],
5140
- ["scss", "SCSS"],
5141
- ["json", "JSON"],
5142
- ["xml", "XML"],
5143
- ["bash", "Bash / Shell"],
5144
- ["sql", "SQL"],
5145
- ["java", "Java"],
5146
- ["csharp", "C#"],
5147
- ["php", "PHP"],
5148
- ["ruby", "Ruby"],
5149
- ["go", "Go"],
5150
- ["rust", "Rust"],
5151
- ["cpp", "C++"],
5152
- ["c", "C"],
5153
- ["kotlin", "Kotlin"],
5154
- ["swift", "Swift"]
5155
- ].forEach(([e, t]) => {
5746
+ }), $r.forEach(([e, t]) => {
5156
5747
  let n = w("option", { value: e });
5157
5748
  n.textContent = t, this._langSelect.appendChild(n);
5158
- }), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(Kr.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(Kr.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(Kr.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Kr.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Kr.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
5749
+ }), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(Qr.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(Qr.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(Qr.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Qr.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Qr.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
5159
5750
  }
5160
5751
  _sep() {
5161
5752
  return w("div", { class: "an-link-tooltip-sep" });
@@ -5173,10 +5764,10 @@ var zr = 120, Br = 200, Vr = [
5173
5764
  _scheduleShow(e) {
5174
5765
  this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
5175
5766
  this._activePre = e, this._syncWrapBtn(), this._syncLineNumbersBtn(), this._syncLangSelect(), this._show(e);
5176
- }, Ur));
5767
+ }, Yr));
5177
5768
  }
5178
5769
  _scheduleHide() {
5179
- clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), Wr);
5770
+ clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), Xr);
5180
5771
  }
5181
5772
  _show(e) {
5182
5773
  this._el.style.display = "flex", this._positionNear(e);
@@ -5203,7 +5794,7 @@ var zr = 120, Br = 200, Vr = [
5203
5794
  }
5204
5795
  _syncLangSelect() {
5205
5796
  if (!this._activePre || !this._langSelect) return;
5206
- let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Gr.exec(e.className) || [])[1] || "";
5797
+ let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Zr.exec(e.className) || [])[1] || "";
5207
5798
  this._langSelect.value = t || n || "";
5208
5799
  }
5209
5800
  _copyCode() {
@@ -5246,7 +5837,7 @@ var zr = 120, Br = 200, Vr = [
5246
5837
  let e = this._activePre;
5247
5838
  if (!e) return;
5248
5839
  let t = this._langSelect.value, n = globalThis, r = e.querySelector("code");
5249
- r || (r = document.createElement("code"), r.innerHTML = e.innerHTML, e.innerHTML = "", e.appendChild(r)), r.className = t ? `language-${t}` : "", e.className = t ? `language-${t}` : "", t ? e.dataset.language = t : delete e.dataset.language;
5840
+ r || (r = document.createElement("code"), r.innerHTML = e.innerHTML, e.innerHTML = "", e.appendChild(r)), ei(r, t), ei(e, t), t ? e.dataset.language = t : delete e.dataset.language;
5250
5841
  let i = () => {
5251
5842
  r.querySelectorAll("br").forEach((e) => e.replaceWith("\n")), n.Prism.highlightElement(r), this.context.invoke("editor.afterCommand");
5252
5843
  };
@@ -5309,21 +5900,21 @@ var zr = 120, Br = 200, Vr = [
5309
5900
  let e = this._activePre;
5310
5901
  e && (this._hide(), e.remove(), this.context.invoke("editor.afterCommand"));
5311
5902
  }
5312
- }, Jr = null, Yr = null;
5313
- function Xr() {
5314
- return Jr ? Promise.resolve(Jr) : (Yr ??= import("./emoji-data-BDQX5kh-.js").then((e) => (Jr = {
5903
+ }, ni = null, ri = null;
5904
+ function ii() {
5905
+ return ni ? Promise.resolve(ni) : (ri ??= import("./emoji-data-BDQX5kh-.js").then((e) => (ni = {
5315
5906
  EMOJI_CATS: e.EMOJI_CATS,
5316
5907
  EMOJI_LIST: e.EMOJI_LIST
5317
- }, Jr)), Yr);
5908
+ }, ni)), ri);
5318
5909
  }
5319
- var Zr = class extends U {
5910
+ var ai = class extends U {
5320
5911
  _activeCat = "all";
5321
5912
  initialize() {
5322
5913
  return this;
5323
5914
  }
5324
5915
  async show() {
5325
5916
  if (this._saveRange(), !this._dialog) {
5326
- let { EMOJI_CATS: e, EMOJI_LIST: t } = await Xr();
5917
+ let { EMOJI_CATS: e, EMOJI_LIST: t } = await ii();
5327
5918
  this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
5328
5919
  }
5329
5920
  this._activeCat = "all", this._searchInput.value = "", this._updateCatTabs(), this._filterEmojis("", "all"), this._open();
@@ -5380,7 +5971,7 @@ var Zr = class extends U {
5380
5971
  type: "button",
5381
5972
  class: "an-btn"
5382
5973
  });
5383
- p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), he(r, n);
5974
+ p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), D(r, n);
5384
5975
  let m = E(s, "click", () => this._close()), h = E(p, "click", () => this._close()), g = E(t, "click", (e) => {
5385
5976
  e.target === t && this._close();
5386
5977
  }), _ = E(c, "input", () => this._filterEmojis(c.value, this._activeCat)), v = E(l, "click", (e) => {
@@ -5416,14 +6007,14 @@ var Zr = class extends U {
5416
6007
  let s = document.createTextNode(e);
5417
6008
  i.insertNode(s), i.setStartAfter(s), i.collapse(!0), r && (r.removeAllRanges(), r.addRange(i)), this._close(), n.focus(), this.context.invoke("editor.afterCommand");
5418
6009
  }
5419
- }, Qr = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", $r = null, ei = null;
5420
- function ti() {
5421
- return $r ? Promise.resolve($r) : (ei ??= import("./icon-data-V0Xqv-wX.js").then((e) => ($r = {
6010
+ }, oi = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", si = null, ci = null;
6011
+ function li() {
6012
+ return si ? Promise.resolve(si) : (ci ??= import("./icon-data-V0Xqv-wX.js").then((e) => (si = {
5422
6013
  ICON_CATEGORIES: e.ICON_CATEGORIES,
5423
6014
  ICON_LIST: e.ICON_LIST
5424
- }, $r)), ei);
6015
+ }, si)), ci);
5425
6016
  }
5426
- var ni = class extends U {
6017
+ var ui = class extends U {
5427
6018
  _selectedIcon = null;
5428
6019
  _activeCat = "all";
5429
6020
  initialize() {
@@ -5431,7 +6022,7 @@ var ni = class extends U {
5431
6022
  }
5432
6023
  _ensureFontAwesome() {
5433
6024
  if (this.context.options.fontAwesomeAutoInject === !1) return;
5434
- let e = this.context.options.fontAwesomeCDN || Qr;
6025
+ let e = this.context.options.fontAwesomeCDN || oi;
5435
6026
  if (!e || document.getElementById("an-fontawesome-css")) return;
5436
6027
  let t = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).map((e) => e.href || "").join(" ");
5437
6028
  if (/fontawesome|font-awesome/.test(t) || document.querySelector(".fa-solid, .fas, .far, .fab")) return;
@@ -5440,7 +6031,7 @@ var ni = class extends U {
5440
6031
  }
5441
6032
  async show() {
5442
6033
  if (this._saveRange(), this._ensureFontAwesome(), !this._dialog) {
5443
- let { ICON_CATEGORIES: e, ICON_LIST: t } = await ti();
6034
+ let { ICON_CATEGORIES: e, ICON_LIST: t } = await li();
5444
6035
  this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
5445
6036
  }
5446
6037
  this._selectedIcon = null, this._activeCat = "all", this._searchInput.value = "", this._grid.querySelectorAll(".an-icon-cell.active").forEach((e) => e.classList.remove("active")), this._insertBtn.setAttribute("disabled", ""), this._updateCatTabs(), this._filterIcons("", "all"), this._updatePreview(null), this._open();
@@ -5546,7 +6137,7 @@ var ni = class extends U {
5546
6137
  type: "button",
5547
6138
  class: "an-btn"
5548
6139
  });
5549
- C.textContent = e.cancelBtn, te.append(S, C), this._insertBtn = S, n.append(r, c, l, d, f, x, te), t.appendChild(n), he(r, n);
6140
+ C.textContent = e.cancelBtn, te.append(S, C), this._insertBtn = S, n.append(r, c, l, d, f, x, te), t.appendChild(n), D(r, n);
5550
6141
  let ne = E(s, "click", () => this._close()), re = E(C, "click", () => this._close()), ie = E(S, "click", () => this._onInsert()), ae = E(t, "click", (e) => {
5551
6142
  e.target === t && this._close();
5552
6143
  }), T = E(c, "input", () => this._filterIcons(c.value, this._activeCat)), oe = E(l, "click", (e) => {
@@ -5631,7 +6222,7 @@ var ni = class extends U {
5631
6222
  highlightColor: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\"/></svg>",
5632
6223
  noColor: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><line x1=\"4\" y1=\"4\" x2=\"20\" y2=\"20\"/><line x1=\"20\" y1=\"4\" x2=\"4\" y2=\"20\"/></svg>",
5633
6224
  back: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"15 18 9 12 15 6\"/></svg>"
5634
- }, ri = [
6225
+ }, di = [
5635
6226
  "#000000",
5636
6227
  "#434343",
5637
6228
  "#666666",
@@ -5657,19 +6248,19 @@ var ni = class extends U {
5657
6248
  "#d9d2e9",
5658
6249
  "#ead1dc"
5659
6250
  ];
5660
- function ii(e) {
6251
+ function fi(e) {
5661
6252
  let t = e === "foreColor" ? "Text Color" : "Highlight Color", n = e === "foreColor" ? "textColor" : "highlightColor";
5662
6253
  return () => [{
5663
6254
  back: !0,
5664
6255
  label: t,
5665
6256
  localeKey: n,
5666
- navigate: () => ai
6257
+ navigate: () => pi
5667
6258
  }, {
5668
6259
  colorPalette: !0,
5669
6260
  colorType: e
5670
6261
  }];
5671
6262
  }
5672
- var ai = [
6263
+ var pi = [
5673
6264
  {
5674
6265
  name: "cut",
5675
6266
  label: "Cut",
@@ -5733,14 +6324,14 @@ var ai = [
5733
6324
  label: "Text Color",
5734
6325
  icon: J.textColor,
5735
6326
  colorStrip: "foreColor",
5736
- navigate: ii("foreColor")
6327
+ navigate: fi("foreColor")
5737
6328
  },
5738
6329
  {
5739
6330
  name: "highlightColor",
5740
6331
  label: "Highlight Color",
5741
6332
  icon: J.highlightColor,
5742
6333
  colorStrip: "hiliteColor",
5743
- navigate: ii("hiliteColor")
6334
+ navigate: fi("hiliteColor")
5744
6335
  },
5745
6336
  { separator: !0 },
5746
6337
  {
@@ -5787,9 +6378,9 @@ var ai = [
5787
6378
  icon: J.table,
5788
6379
  tableGrid: !0
5789
6380
  }
5790
- ], oi = class {
6381
+ ], mi = class {
5791
6382
  constructor(e) {
5792
- this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || ai, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
6383
+ this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || pi, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
5793
6384
  }
5794
6385
  initialize() {
5795
6386
  this.el = w("div", {
@@ -5875,7 +6466,7 @@ var ai = [
5875
6466
  }
5876
6467
  if (e.colorPalette) {
5877
6468
  let t = w("div", { class: "an-context-color-palette" });
5878
- if (ri.forEach((n) => {
6469
+ if (di.forEach((n) => {
5879
6470
  let r = w("div", {
5880
6471
  class: "an-context-color-swatch",
5881
6472
  title: n,
@@ -6105,7 +6696,7 @@ var ai = [
6105
6696
  } catch {}
6106
6697
  this.context.invoke("editor.afterCommand");
6107
6698
  }
6108
- }, si = [
6699
+ }, hi = [
6109
6700
  {
6110
6701
  category: "Text Formatting",
6111
6702
  items: [
@@ -6178,12 +6769,12 @@ var ai = [
6178
6769
  action: "Show this keyboard shortcuts dialog"
6179
6770
  }]
6180
6771
  }
6181
- ], ci = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"7\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M6 11h.01M10 11h.01M14 11h.01M18 11h.01M6 15h.01M18 15h.01M10 15h4\"/><path d=\"M7 3l5 4 5-4\"/></svg>", li = class extends U {
6772
+ ], gi = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"7\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M6 11h.01M10 11h.01M14 11h.01M18 11h.01M6 15h.01M18 15h.01M10 15h4\"/><path d=\"M7 3l5 4 5-4\"/></svg>", _i = class extends U {
6182
6773
  show() {
6183
6774
  this._open();
6184
6775
  }
6185
6776
  _buildDialog() {
6186
- let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ci, e.title);
6777
+ let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, gi, e.title);
6187
6778
  n.classList.add("an-shortcuts-box");
6188
6779
  let r = w("button", {
6189
6780
  type: "button",
@@ -6191,7 +6782,7 @@ var ai = [
6191
6782
  "aria-label": e.close,
6192
6783
  style: "margin-left:auto"
6193
6784
  });
6194
- r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || si).forEach(({ category: e, items: t }) => {
6785
+ r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || hi).forEach(({ category: e, items: t }) => {
6195
6786
  let r = w("div", { class: "an-shortcuts-cat" });
6196
6787
  r.textContent = e, n.appendChild(r);
6197
6788
  let i = w("div", { class: "an-shortcuts-table" });
@@ -6205,7 +6796,7 @@ var ai = [
6205
6796
  let i = E(r, "click", () => this._close());
6206
6797
  return this._disposers.push(i), t;
6207
6798
  }
6208
- }, ui = class extends U {
6799
+ }, vi = class extends U {
6209
6800
  constructor(e) {
6210
6801
  super(e), this._findInput = null, this._replaceInput = null, this._caseCheckbox = null, this._counterEl = null, this._closeBtn = null, this._matches = [], this._currentIndex = -1, this._caseSensitive = !1, this._useRegex = !1, this._wholeWord = !1, this._mode = "find", this._queryRegex = null, this._lastQuery = null, this._lastCaseSensitive = null, this._lastUseRegex = null, this._lastWholeWord = null, this._focusTimer = null;
6211
6802
  }
@@ -6321,7 +6912,7 @@ var ai = [
6321
6912
  });
6322
6913
  b.textContent = e.replaceAllBtn, _.append(v, y, b), n.appendChild(_);
6323
6914
  let x = w("div", { class: "an-fr-replace-actions" });
6324
- x.style.display = "none", n.appendChild(x), t.appendChild(n), he(r, n);
6915
+ x.style.display = "none", n.appendChild(x), t.appendChild(n), D(r, n);
6325
6916
  let ee = E(s, "click", () => this._close()), te = E(t, "click", (e) => {
6326
6917
  e.target === t && this._close();
6327
6918
  }), S = E(l, "input", () => this._onSearch()), C = E(d, "click", () => {
@@ -6448,8 +7039,8 @@ var ai = [
6448
7039
  this._counterEl.textContent = e ? this.context.locale.findReplace.noResults : "";
6449
7040
  } else this._counterEl.textContent = `${this._currentIndex + 1} / ${e}`;
6450
7041
  }
6451
- }, Y = 20, di = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
6452
- function fi(e, t, n, r) {
7042
+ }, Y = 20, yi = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
7043
+ function bi(e, t, n, r) {
6453
7044
  return new Promise((i) => {
6454
7045
  let a = (e) => {
6455
7046
  let a = document.createElement("canvas");
@@ -6473,7 +7064,7 @@ function fi(e, t, n, r) {
6473
7064
  o.crossOrigin = "anonymous", o.onload = () => a(o), o.onerror = () => i(null), o.src = e.src + (e.src.includes("?") ? "&" : "?") + "_an=" + Date.now();
6474
7065
  });
6475
7066
  }
6476
- var pi = class {
7067
+ var xi = class {
6477
7068
  constructor(e) {
6478
7069
  this.context = e, this._img = null, this._box = null, this._imgRect = null, this._scrim = null, this._cropBox = null, this._handles = {}, this._toolbar = null, this._infoEl = null, this._dragDisposers = null, this._disposers = [];
6479
7070
  }
@@ -6504,7 +7095,7 @@ var pi = class {
6504
7095
  t.className = "an-crop-box", t.style.cssText = `
6505
7096
  position:fixed; z-index:10101;
6506
7097
  box-sizing:border-box;
6507
- border:2px solid ${di};
7098
+ border:2px solid ${yi};
6508
7099
  cursor:move;
6509
7100
  outline: none;
6510
7101
  `;
@@ -6569,7 +7160,7 @@ var pi = class {
6569
7160
  "position:absolute",
6570
7161
  "width:10px",
6571
7162
  "height:10px",
6572
- `background:${di}`,
7163
+ `background:${yi}`,
6573
7164
  "border:2px solid #fff",
6574
7165
  "border-radius:2px",
6575
7166
  "box-sizing:border-box",
@@ -6603,7 +7194,7 @@ var pi = class {
6603
7194
  let a = this._makeToolbarBtn("✓ Crop", "#22c55e", () => this._confirm()), o = this._makeToolbarBtn("✕ Cancel", "#94a3b8", () => this._close(!1)), s = document.createElement("label");
6604
7195
  s.style.cssText = "color:#94a3b8;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;";
6605
7196
  let c = document.createElement("input");
6606
- c.type = "checkbox", c.style.accentColor = di, s.appendChild(c), s.appendChild(document.createTextNode("Lock ratio")), this._arCheck = c, i.appendChild(a), i.appendChild(o), i.appendChild(s), this._toolbar = i, this._disposers.push(E(i, "mousedown", (e) => e.stopPropagation())), document.body.appendChild(e), document.body.appendChild(t), document.body.appendChild(i), this._scrim = e, this._cropBox = t;
7197
+ c.type = "checkbox", c.style.accentColor = yi, s.appendChild(c), s.appendChild(document.createTextNode("Lock ratio")), this._arCheck = c, i.appendChild(a), i.appendChild(o), i.appendChild(s), this._toolbar = i, this._disposers.push(E(i, "mousedown", (e) => e.stopPropagation())), document.body.appendChild(e), document.body.appendChild(t), document.body.appendChild(i), this._scrim = e, this._cropBox = t;
6607
7198
  }
6608
7199
  _makeToolbarBtn(e, t, n) {
6609
7200
  let r = document.createElement("button");
@@ -6688,7 +7279,7 @@ var pi = class {
6688
7279
  this._close(!1);
6689
7280
  return;
6690
7281
  }
6691
- let f = await fi(e, {
7282
+ let f = await bi(e, {
6692
7283
  x: c,
6693
7284
  y: l,
6694
7285
  width: u,
@@ -6732,7 +7323,7 @@ var pi = class {
6732
7323
  e?.remove();
6733
7324
  }), this._scrim = null, this._cropBox = null, this._toolbar = null, this._infoEl = null, this._handles = {}, this._img = null, this._box = null, this._imgRect = null, this._arCheck = null;
6734
7325
  }
6735
- }, mi = class {
7326
+ }, Si = class {
6736
7327
  constructor(e) {
6737
7328
  this.context = e, this.options = e.options, this._banner = null;
6738
7329
  }
@@ -6785,7 +7376,7 @@ var pi = class {
6785
7376
  _removeBanner() {
6786
7377
  this._banner?.remove(), this._banner = null;
6787
7378
  }
6788
- }, hi = class {
7379
+ }, Ci = class {
6789
7380
  constructor(e) {
6790
7381
  this.context = e, this.options = e.options, this._disposers = [];
6791
7382
  }
@@ -6931,7 +7522,7 @@ var pi = class {
6931
7522
  break;
6932
7523
  }
6933
7524
  }
6934
- }, gi = [
7525
+ }, wi = [
6935
7526
  "#000000",
6936
7527
  "#434343",
6937
7528
  "#666666",
@@ -6956,7 +7547,7 @@ var pi = class {
6956
7547
  "#c9daf8",
6957
7548
  "#d9d2e9",
6958
7549
  "#ead1dc"
6959
- ], _i = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", Z = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" ${_i} style="display:block">${e}</svg>`, vi = {
7550
+ ], Ti = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", Z = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" ${Ti} style="display:block">${e}</svg>`, Ei = {
6960
7551
  bold: Z("<path d=\"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/><path d=\"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/>"),
6961
7552
  italic: Z("<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"/><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"/><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"/>"),
6962
7553
  underline: Z("<path d=\"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3\"/><line x1=\"4\" y1=\"21\" x2=\"20\" y2=\"21\"/>"),
@@ -6966,7 +7557,7 @@ var pi = class {
6966
7557
  hiliteColor: Z("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\"/>"),
6967
7558
  removeFormat: Z("<path d=\"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21\"/><path d=\"M22 21H7\"/><path d=\"m5 11 9 9\"/>"),
6968
7559
  inlineCode: Z("<path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\"/><path d=\"M16 3h1a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2a2 2 0 0 1-2 2v5a2 2 0 0 1-2 2h-1\"/>")
6969
- }, yi = {
7560
+ }, Di = {
6970
7561
  bold: (e) => e.invoke("editor.bold"),
6971
7562
  italic: (e) => e.invoke("editor.italic"),
6972
7563
  underline: (e) => e.invoke("editor.underline"),
@@ -6987,15 +7578,15 @@ var pi = class {
6987
7578
  e.invoke("editor.afterCommand");
6988
7579
  },
6989
7580
  inlineCode: (e) => e.invoke("editor.inlineCode")
6990
- }, bi = {
7581
+ }, Oi = {
6991
7582
  bold: () => document.queryCommandState("bold"),
6992
7583
  italic: () => document.queryCommandState("italic"),
6993
7584
  underline: () => document.queryCommandState("underline"),
6994
7585
  strikethrough: () => document.queryCommandState("strikeThrough")
6995
- }, xi = {
7586
+ }, ki = {
6996
7587
  foreColor: !0,
6997
7588
  hiliteColor: !0
6998
- }, Si = class {
7589
+ }, Ai = class {
6999
7590
  constructor(e) {
7000
7591
  this.context = e, this.options = e.options, this._el = null, this._picker = null, this._pickerType = null, this._savedRange = null, this._visible = !1, this._rafId = null, this._contextMenuOpen = !1, this._disposers = [], this._onSelectionChange = this._onSelectionChange.bind(this), this._onMousedown = this._onMousedown.bind(this), this._onKeydown = this._onKeydown.bind(this), this._onContextMenu = this._onContextMenu.bind(this);
7001
7592
  }
@@ -7025,23 +7616,23 @@ var pi = class {
7025
7616
  "removeFormat"
7026
7617
  ];
7027
7618
  for (let n of t) {
7028
- if (!vi[n]) continue;
7619
+ if (!Ei[n]) continue;
7029
7620
  let t = document.createElement("button");
7030
- if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), xi[n]) {
7621
+ if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), ki[n]) {
7031
7622
  t.className = "an-bubble-btn an-bubble-btn--color";
7032
7623
  let e = document.createElement("span");
7033
- e.className = "an-bubble-btn-svg", e.innerHTML = vi[n];
7624
+ e.className = "an-bubble-btn-svg", e.innerHTML = Ei[n];
7034
7625
  let r = document.createElement("span");
7035
7626
  r.className = "an-bubble-color-strip", r.style.background = n === "foreColor" ? "#000000" : "transparent", t.appendChild(e), t.appendChild(r);
7036
- } else t.className = "an-bubble-btn", t.innerHTML = vi[n];
7627
+ } else t.className = "an-bubble-btn", t.innerHTML = Ei[n];
7037
7628
  t.addEventListener("mousedown", (e) => {
7038
7629
  e.preventDefault();
7039
7630
  }), t.addEventListener("click", (e) => {
7040
- if (e.preventDefault(), e.stopPropagation(), xi[n]) {
7631
+ if (e.preventDefault(), e.stopPropagation(), ki[n]) {
7041
7632
  this._openColorPicker(n, t);
7042
7633
  return;
7043
7634
  }
7044
- this.context.invoke("editor.focus"), yi[n] && yi[n](this.context), this._syncActive();
7635
+ this.context.invoke("editor.focus"), Di[n] && Di[n](this.context), this._syncActive();
7045
7636
  }), e.appendChild(t);
7046
7637
  }
7047
7638
  document.body.appendChild(e), this._el = e, this._btnCache = Array.from(e.querySelectorAll(".an-bubble-btn"));
@@ -7050,7 +7641,7 @@ var pi = class {
7050
7641
  let e = document.createElement("div");
7051
7642
  e.className = "an-bubble-color-picker", e.style.display = "none", e.addEventListener("mousedown", (e) => e.preventDefault());
7052
7643
  let t = document.createElement("div");
7053
- t.className = "an-context-color-palette", gi.forEach((e) => {
7644
+ t.className = "an-context-color-palette", wi.forEach((e) => {
7054
7645
  let n = document.createElement("div");
7055
7646
  n.className = "an-context-color-swatch", n.title = e, n.style.background = e, n.setAttribute("role", "button"), n.setAttribute("aria-label", e), n.addEventListener("click", (t) => {
7056
7647
  t.stopPropagation(), this._applyColor(this._pickerType, e);
@@ -7118,7 +7709,7 @@ var pi = class {
7118
7709
  }
7119
7710
  _syncActive() {
7120
7711
  this._btnCache && this._btnCache.forEach((e) => {
7121
- let t = bi[e.dataset.name];
7712
+ let t = Oi[e.dataset.name];
7122
7713
  e.classList.toggle("an-active", !!t?.());
7123
7714
  });
7124
7715
  }
@@ -7169,7 +7760,7 @@ var pi = class {
7169
7760
  _onContextMenu() {
7170
7761
  this._hide();
7171
7762
  }
7172
- }, Ci = class {
7763
+ }, ji = class {
7173
7764
  constructor(e) {
7174
7765
  this.context = e, this._dropdown = null, this._query = "", this._debounceTimer = null, this._activeIndex = -1, this._items = [], this._open = !1, this._triggerNode = null, this._triggerOffset = 0, this._caretRect = null, this._disposers = [];
7175
7766
  }
@@ -7314,7 +7905,7 @@ var pi = class {
7314
7905
  let n;
7315
7906
  typeof this._cfg.onInsert == "function" && (n = this._cfg.onInsert(t)), n ||= `<span class="${this._cfg.mentionClass}" data-mention-id="${t.id}" contenteditable="false">@${t.label}</span>`, this.context.invoke("editor.insertHTML", n + "&#8203;"), this._hideDropdown(), this.context.triggerEvent("change", this.context.getHTML());
7316
7907
  }
7317
- }, wi = class {
7908
+ }, Mi = class {
7318
7909
  constructor(e) {
7319
7910
  this.context = e, this.options = e.options, this._disposers = [], this._menu = null, this._filtered = [], this._activeIndex = -1, this._open = !1, this._query = "", this._textNode = null, this._triggerOffset = 0, this._caretRect = null;
7320
7911
  }
@@ -7541,33 +8132,33 @@ var pi = class {
7541
8132
  this._deleteTriggerText(), this._close(), t.run();
7542
8133
  }
7543
8134
  }
7544
- }, Ti = /* @__PURE__ */ new Map(), Ei = [
8135
+ }, Ni = /* @__PURE__ */ new Map(), Pi = [
7545
8136
  {
7546
8137
  name: "autoSaveRestore",
7547
- Class: mi,
8138
+ Class: Si,
7548
8139
  enabled: (e) => !!e.autoSaveRestore
7549
8140
  },
7550
8141
  {
7551
8142
  name: "markdownShortcuts",
7552
- Class: hi,
8143
+ Class: Ci,
7553
8144
  enabled: (e) => e.markdownShortcuts !== !1
7554
8145
  },
7555
8146
  {
7556
8147
  name: "bubbleToolbar",
7557
- Class: Si,
8148
+ Class: Ai,
7558
8149
  enabled: (e) => !!e.bubbleToolbar
7559
8150
  },
7560
8151
  {
7561
8152
  name: "mention",
7562
- Class: Ci,
8153
+ Class: ji,
7563
8154
  enabled: (e) => !!e.mention
7564
8155
  },
7565
8156
  {
7566
8157
  name: "slashMenu",
7567
- Class: wi,
8158
+ Class: Mi,
7568
8159
  enabled: (e) => e.slashMenu !== !1
7569
8160
  }
7570
- ], Di = /* @__PURE__ */ new Map(), Oi = class {
8161
+ ], Fi = /* @__PURE__ */ new Map(), Ii = class {
7571
8162
  constructor(e, t = {}) {
7572
8163
  this.targetEl = e, this.options = c(A, t), this.locale = Wt(this.options.lang), this.layoutInfo = {}, this._listeners = /* @__PURE__ */ new Map(), this._modules = /* @__PURE__ */ new Map(), this._plugins = /* @__PURE__ */ new Map(), this._disposers = [], this._alive = !1, this._autoSaveTimer = null, this._pendingAutoSave = null, this._suppressedRemoteHTML = null, this._destroyPromise = null;
7573
8164
  }
@@ -7584,12 +8175,12 @@ var pi = class {
7584
8175
  let n = new t(this);
7585
8176
  this._modules.set(e, n), n.initialize();
7586
8177
  };
7587
- e("editor", or), e("toolbar", ur), e("statusbar", mr), e("clipboard", hr), e("contextMenu", oi), e("placeholder", gr), e("codeview", _r), e("fullscreen", vr), e("linkDialog", br), e("imageDialog", Sr), e("videoDialog", wr), e("imageResizer", Dr), e("videoResizer", Or), e("linkTooltip", Mr), e("imageTooltip", Pr), e("videoTooltip", Fr), e("tableTooltip", Hr), e("codeTooltip", qr), e("emojiDialog", Zr), e("iconDialog", ni), e("shortcutsDialog", li), e("findReplace", ui), e("imageCropOverlay", pi);
7588
- for (let { name: t, Class: n, enabled: r } of Ei) r(this.options) && e(t, n);
7589
- if (Ti.size > 0) for (let [t, n] of Ti) e(t, n);
8178
+ e("editor", dr), e("toolbar", gr), e("statusbar", br), e("clipboard", xr), e("contextMenu", mi), e("placeholder", Sr), e("codeview", Cr), e("fullscreen", wr), e("linkDialog", Er), e("imageDialog", Or), e("videoDialog", Ar), e("imageResizer", Nr), e("videoResizer", Pr), e("linkTooltip", Rr), e("imageTooltip", Br), e("videoTooltip", Vr), e("tableTooltip", Jr), e("codeTooltip", ti), e("emojiDialog", ai), e("iconDialog", ui), e("shortcutsDialog", _i), e("findReplace", vi), e("imageCropOverlay", xi);
8179
+ for (let { name: t, Class: n, enabled: r } of Pi) r(this.options) && e(t, n);
8180
+ if (Ni.size > 0) for (let [t, n] of Ni) e(t, n);
7590
8181
  }
7591
8182
  _syncOptionalModules() {
7592
- for (let { name: e, Class: t, enabled: n } of Ei) {
8183
+ for (let { name: e, Class: t, enabled: n } of Pi) {
7593
8184
  let r = n(this.options);
7594
8185
  if (r !== this._modules.has(e)) if (r) {
7595
8186
  let n = new t(this);
@@ -7633,7 +8224,7 @@ var pi = class {
7633
8224
  });
7634
8225
  }
7635
8226
  _applyGlobalPlugins() {
7636
- if (Di.size !== 0) for (let { plugin: e, options: t } of Di.values()) this._installPlugin(e, t);
8227
+ if (Fi.size !== 0) for (let { plugin: e, options: t } of Fi.values()) this._installPlugin(e, t);
7637
8228
  }
7638
8229
  _bindEditorEvents(e) {
7639
8230
  let t = E(e, "input", () => this._syncToTarget()), n = E(e, "focus", () => {
@@ -7889,39 +8480,39 @@ var pi = class {
7889
8480
  };
7890
8481
  //#endregion
7891
8482
  //#region src/js/core/lists.js
7892
- function ki(e) {
8483
+ function Li(e) {
7893
8484
  return e[e.length - 1];
7894
8485
  }
7895
- function Ai(e) {
8486
+ function Ri(e) {
7896
8487
  return e[0];
7897
8488
  }
7898
- function ji(e, t = 1) {
8489
+ function zi(e, t = 1) {
7899
8490
  return e.slice(0, e.length - t);
7900
8491
  }
7901
- function Mi(e, t = 1) {
8492
+ function Bi(e, t = 1) {
7902
8493
  return e.slice(t);
7903
8494
  }
7904
- function Ni(e) {
8495
+ function Vi(e) {
7905
8496
  return e.flat();
7906
8497
  }
7907
- function Pi(e) {
8498
+ function Hi(e) {
7908
8499
  return [...new Set(e)];
7909
8500
  }
7910
- function Fi(e, t) {
8501
+ function Ui(e, t) {
7911
8502
  let n = [];
7912
8503
  for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
7913
8504
  return n;
7914
8505
  }
7915
- function Ii(e, t) {
8506
+ function Wi(e, t) {
7916
8507
  return e.reduce((e, n) => {
7917
8508
  let r = t(n);
7918
8509
  return e[r] || (e[r] = []), e[r].push(n), e;
7919
8510
  }, {});
7920
8511
  }
7921
- function Li(e, t) {
8512
+ function Gi(e, t) {
7922
8513
  return e.every(t);
7923
8514
  }
7924
- function Ri(e, t) {
8515
+ function Ki(e, t) {
7925
8516
  return e.some(t);
7926
8517
  }
7927
8518
  //#endregion
@@ -7929,7 +8520,7 @@ function Ri(e, t) {
7929
8520
  function Q() {
7930
8521
  return globalThis.navigator?.userAgent ?? "";
7931
8522
  }
7932
- var zi = {
8523
+ var qi = {
7933
8524
  get isChrome() {
7934
8525
  return /Chrome\//.test(Q()) && !/Edg\//.test(Q());
7935
8526
  },
@@ -7954,17 +8545,17 @@ var zi = {
7954
8545
  get modifierKey() {
7955
8546
  return /Macintosh/.test(Q()) ? "metaKey" : "ctrlKey";
7956
8547
  }
7957
- }, Bi = { ...A }, $ = /* @__PURE__ */ new WeakMap(), Vi = {
8548
+ }, Ji = { ...A }, $ = /* @__PURE__ */ new WeakMap(), Yi = {
7958
8549
  create(e, t = {}) {
7959
- let n = Hi(e).map((e) => {
8550
+ let n = Xi(e).map((e) => {
7960
8551
  if ($.has(e)) return $.get(e);
7961
- let n = new Oi(e, t);
8552
+ let n = new Ii(e, t);
7962
8553
  return n.initialize(), $.set(e, n), n;
7963
8554
  });
7964
8555
  return n.length === 1 ? n[0] : n;
7965
8556
  },
7966
8557
  destroy(e) {
7967
- Hi(e).forEach((e) => {
8558
+ Xi(e).forEach((e) => {
7968
8559
  let t = $.get(e);
7969
8560
  t && (t.destroy(), $.delete(e));
7970
8561
  });
@@ -7980,20 +8571,20 @@ var zi = {
7980
8571
  Object.assign(A, e);
7981
8572
  },
7982
8573
  resetDefaults() {
7983
- Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, Bi);
8574
+ Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, Ji);
7984
8575
  },
7985
8576
  registerModule(e, t) {
7986
- Ti.set(e, t);
8577
+ Ni.set(e, t);
7987
8578
  },
7988
8579
  use(e, t = {}) {
7989
8580
  if (!e || typeof e.name != "string") throw TypeError("[AutumnNote] AutumnNote.use: plugin must have a string `name` property.");
7990
- return Di.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), Di.set(e.name, {
8581
+ return Fi.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), Fi.set(e.name, {
7991
8582
  plugin: e,
7992
8583
  options: t
7993
8584
  }), this);
7994
8585
  },
7995
8586
  hasPlugin(e) {
7996
- return Di.has(e);
8587
+ return Fi.has(e);
7997
8588
  },
7998
8589
  registerButton(e) {
7999
8590
  return $e(e), this;
@@ -8007,12 +8598,12 @@ var zi = {
8007
8598
  return n >= 0 ? t[n] = e : t.push(e), this;
8008
8599
  },
8009
8600
  buttons: Vt,
8010
- version: "2.3.0"
8601
+ version: "2.4.0"
8011
8602
  };
8012
- function Hi(e) {
8603
+ function Xi(e) {
8013
8604
  return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : e instanceof Element ? [e] : e instanceof NodeList || Array.isArray(e) ? Array.from(e) : [];
8014
8605
  }
8015
8606
  //#endregion
8016
- export { Oi as Context, d as ELEMENT_NODE, f as TEXT_NODE, ge as WrappedRange, Qe as _buttonRegistry, ct as alignCenterBtn, ut as alignJustifyBtn, st as alignLeftBtn, lt as alignRightBtn, Li as all, ne as ancestors, Ri as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, Fi as chunk, e as clamp, S as closest, C as closestPara, At as codeviewBtn, be as collapsedRange, r as compose, w as createElement, ve as currentRange, t as debounce, Vi as default, A as defaultOptions, Bt as defaultToolbar, Et as directionBtn, xt as emojiBtn, zi as env, Nt as findBtn, Pt as findReplaceBtn, Ai as first, Ni as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, _e as fromNativeRange, jt as fullscreenBtn, et as getButton, Ii as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, ji as initial, Ft as inlineCodeBtn, ce as insertAfter, ee as isAnchor, x as isEditable, p as isElement, ue as isEmpty, s as isFunction, te as isImage, b as isInline, pe as isInsideEditable, P as isKey, _ as isLi, v as isList, F as isModifier, a as isNil, g as isPara, l as isPlainObject, xe as isSelectionInside, o as isString, y as isTable, m as isText, h as isVoid, nt as italicBtn, N as key, ki as last, kt as lineHeightBtn, vt as linkBtn, Ht as locales, he as makeDraggable, c as mergeDeep, ae as nextElement, le as nodeValue, ft as olBtn, E as on, mt as outdentBtn, de as outerHtml, Ot as paragraphStyleBtn, fe as placeCaret, ie as prevElement, Lt as printBtn, ye as rangeFromElement, u as rect2bnd, gt as redoBtn, $e as registerButton, Ut as registerLocale, T as remove, Tt as removeFormatBtn, Wt as resolveLocale, M as sanitiseHTML, sn as sanitiseUrl, Mt as shortcutsBtn, Ce as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, Mi as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, Pi as unique, oe as unwrap, bt as videoBtn, Se as withSavedRange, se as wrap };
8607
+ export { Ii as Context, d as ELEMENT_NODE, f as TEXT_NODE, he as WrappedRange, Qe as _buttonRegistry, ct as alignCenterBtn, ut as alignJustifyBtn, st as alignLeftBtn, lt as alignRightBtn, Gi as all, ne as ancestors, Ki as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, Ui as chunk, e as clamp, S as closest, C as closestPara, At as codeviewBtn, ye as collapsedRange, r as compose, w as createElement, _e as currentRange, t as debounce, Yi as default, A as defaultOptions, Bt as defaultToolbar, Et as directionBtn, xt as emojiBtn, qi as env, Nt as findBtn, Pt as findReplaceBtn, Ri as first, Vi as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, ge as fromNativeRange, jt as fullscreenBtn, et as getButton, Wi as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, zi as initial, Ft as inlineCodeBtn, ce as insertAfter, ee as isAnchor, x as isEditable, p as isElement, ue as isEmpty, s as isFunction, te as isImage, b as isInline, pe as isInsideEditable, P as isKey, _ as isLi, v as isList, F as isModifier, a as isNil, g as isPara, l as isPlainObject, be as isSelectionInside, o as isString, y as isTable, m as isText, h as isVoid, nt as italicBtn, N as key, Li as last, kt as lineHeightBtn, vt as linkBtn, Ht as locales, D as makeDraggable, c as mergeDeep, ae as nextElement, le as nodeValue, ft as olBtn, E as on, mt as outdentBtn, de as outerHtml, Ot as paragraphStyleBtn, fe as placeCaret, ie as prevElement, Lt as printBtn, ve as rangeFromElement, u as rect2bnd, gt as redoBtn, $e as registerButton, Ut as registerLocale, T as remove, Tt as removeFormatBtn, Wt as resolveLocale, M as sanitiseHTML, sn as sanitiseUrl, Mt as shortcutsBtn, Se as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, Bi as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, Hi as unique, oe as unwrap, bt as videoBtn, xe as withSavedRange, se as wrap };
8017
8608
 
8018
8609
  //# sourceMappingURL=autumnnote.es.js.map