@editora/core 1.0.22 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +247 -243
  2. package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
  3. package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
  4. package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
  5. package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
  6. package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
  7. package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
  8. package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
  9. package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
  10. package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
  11. package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
  12. package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
  13. package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
  14. package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
  15. package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
  16. package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
  17. package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
  18. package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
  19. package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
  20. package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
  21. package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
  22. package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
  23. package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
  24. package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
  25. package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
  26. package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
  27. package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
  28. package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
  29. package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
  30. package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
  31. package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
  32. package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
  33. package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
  34. package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
  35. package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
  36. package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
  37. package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
  38. package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
  39. package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
  40. package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
  41. package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
  42. package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
  43. package/dist/editora.min.js +21 -21
  44. package/dist/editora.umd.js +10 -10
  45. package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
  46. package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
  47. package/dist/index.cjs.js +1 -1
  48. package/dist/index.esm.js +2 -2
  49. package/dist/katex-DLIObQUm.mjs +11683 -0
  50. package/dist/katex.min--Ws3c9be.mjs +6 -0
  51. package/dist/notify-DCQGpmq-.mjs +60 -0
  52. package/dist/plugin-loader.js +54 -54
  53. package/dist/webcomponent-core.js +305 -234
  54. package/dist/webcomponent-core.min.css +1 -1
  55. package/dist/webcomponent-core.min.js +153 -80
  56. package/dist/webcomponent.cjs.js +1 -1
  57. package/dist/webcomponent.esm.js +1 -1
  58. package/dist/webcomponent.js +631 -560
  59. package/dist/webcomponent.min.css +1 -1
  60. package/dist/webcomponent.min.js +1677 -1328
  61. package/package.json +1 -1
  62. package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
  63. package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
  64. package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
  65. package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
@@ -1,24 +1,24 @@
1
- function Yn(m) {
1
+ function ni(f) {
2
2
  let e = !1;
3
- m.addEventListener(
3
+ f.addEventListener(
4
4
  "pointerdown",
5
5
  (t) => {
6
- e = t.target !== m;
6
+ e = t.target !== f;
7
7
  },
8
8
  !0
9
- ), m.addEventListener(
9
+ ), f.addEventListener(
10
10
  "click",
11
11
  (t) => {
12
- t.target === m && e && t.stopImmediatePropagation(), e = !1;
12
+ t.target === f && e && t.stopImmediatePropagation(), e = !1;
13
13
  },
14
14
  !0
15
15
  );
16
16
  }
17
- const an = "rte-dialog-base-styles";
18
- function Zn() {
19
- if (typeof document == "undefined" || document.getElementById(an)) return;
20
- const m = document.createElement("style");
21
- m.id = an, m.textContent = `
17
+ const cn = "rte-dialog-base-styles";
18
+ function ii() {
19
+ if (typeof document == "undefined" || document.getElementById(cn)) return;
20
+ const f = document.createElement("style");
21
+ f.id = cn, f.textContent = `
22
22
  [data-rte-dialog] {
23
23
  font-family: var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
24
24
  }
@@ -29,12 +29,249 @@ function Zn() {
29
29
  :where([data-rte-dialog]) :where(button, input, select, textarea) {
30
30
  font-family: inherit;
31
31
  }
32
- `, document.head.appendChild(m);
32
+ `, document.head.appendChild(f);
33
33
  }
34
- function Xn(m) {
35
- m.setAttribute("data-rte-dialog", ""), Zn(), Yn(m);
34
+ function An(f) {
35
+ f.setAttribute("data-rte-dialog", ""), ii(), ni(f), ci(f);
36
36
  }
37
- class Ot {
37
+ const si = 'a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';
38
+ function ri(f, e) {
39
+ for (let t = f; t; t = t.parentElement) {
40
+ if (t.hidden || t.getAttribute("aria-hidden") === "true") return !1;
41
+ const n = window.getComputedStyle(t);
42
+ if (n.display === "none" || n.visibility === "hidden") return !1;
43
+ if (t === e) break;
44
+ }
45
+ return !0;
46
+ }
47
+ function Ln(f) {
48
+ return Array.from(f.querySelectorAll(si)).filter(
49
+ (e) => !e.disabled && e.getAttribute("tabindex") !== "-1" && ri(e, f)
50
+ );
51
+ }
52
+ function oi(f) {
53
+ const e = Ln(f);
54
+ return e.filter((t) => {
55
+ var s;
56
+ if (!(t instanceof HTMLInputElement) || t.type !== "radio" || !t.name) return !0;
57
+ const n = e.filter(
58
+ (r) => r instanceof HTMLInputElement && r.type === "radio" && r.name === t.name
59
+ ), i = (s = n.find((r) => r.checked)) != null ? s : n[0];
60
+ return t === i;
61
+ });
62
+ }
63
+ function ai(f) {
64
+ var n, i, s, r;
65
+ const e = `${(n = f.getAttribute("aria-label")) != null ? n : ""} ${(s = (i = f.className) == null ? void 0 : i.toString()) != null ? s : ""}`.toLowerCase(), t = ((r = f.textContent) != null ? r : "").trim();
66
+ return /close|dismiss/.test(e) || /^[\u00d7\u2715\u2716x]$/i.test(t);
67
+ }
68
+ function li(f) {
69
+ var n;
70
+ const e = f.querySelector(
71
+ 'h1, h2, h3, h4, [class*="title"], [class*="header"], header, [role="heading"]'
72
+ );
73
+ if (!e) return "";
74
+ const t = e.cloneNode(!0);
75
+ return t.querySelectorAll('button, [role="button"], [aria-label*="lose"], [class*="close"]').forEach((i) => i.remove()), ((n = t.textContent) != null ? n : "").replace(/\s+/g, " ").trim();
76
+ }
77
+ function ci(f) {
78
+ var h, c;
79
+ const e = document.activeElement instanceof HTMLElement ? document.activeElement : null, t = window.getSelection(), n = t && t.rangeCount > 0 ? t.getRangeAt(0).cloneRange() : null, i = n && (c = (h = n.commonAncestorContainer instanceof HTMLElement ? n.commonAncestorContainer : n.commonAncestorContainer.parentElement) == null ? void 0 : h.closest('[contenteditable="true"]')) != null ? c : null, s = i ? i.innerHTML : null;
80
+ f.addEventListener("keydown", (d) => {
81
+ if (d.key !== "Tab" || d.defaultPrevented) return;
82
+ const g = oi(f);
83
+ if (g.length === 0) {
84
+ d.preventDefault();
85
+ return;
86
+ }
87
+ const m = g.indexOf(document.activeElement), p = d.shiftKey ? -1 : 1, y = m === -1 ? d.shiftKey ? g[g.length - 1] : g[0] : g[(m + p + g.length) % g.length];
88
+ d.preventDefault(), y.focus();
89
+ });
90
+ let r = !1;
91
+ const o = (d) => {
92
+ var b, w, E, D;
93
+ if (!f.isConnected) {
94
+ d < 3 && window.setTimeout(() => o(d + 1), 50);
95
+ return;
96
+ }
97
+ r = !0;
98
+ const m = (E = (w = (b = ((M) => {
99
+ var k;
100
+ return ["dialog", "alertdialog"].includes((k = M.getAttribute("role")) != null ? k : "");
101
+ })(f) ? f : null) != null ? b : f.querySelector('[role="dialog"], [role="alertdialog"]')) != null ? w : f.firstElementChild instanceof HTMLElement ? f.firstElementChild : null) != null ? E : f;
102
+ m.getAttribute("role") || m.setAttribute("role", "dialog"), m.hasAttribute("aria-modal") || m.setAttribute("aria-modal", "true");
103
+ const p = m.getAttribute("aria-labelledby");
104
+ if (!(!!m.getAttribute("aria-label") || !!p && !!document.getElementById(p.split(/\s+/)[0]))) {
105
+ const M = li(m);
106
+ M && (m.removeAttribute("aria-labelledby"), m.setAttribute("aria-label", M));
107
+ }
108
+ if (!f.contains(document.activeElement)) {
109
+ const M = Ln(f), k = (D = M.find((H) => !ai(H))) != null ? D : M[0];
110
+ k ? k.focus({ preventScroll: !0 }) : (m.setAttribute("tabindex", "-1"), m.focus({ preventScroll: !0 }));
111
+ }
112
+ };
113
+ window.setTimeout(() => o(0), 0);
114
+ const a = new MutationObserver(() => {
115
+ if (f.isConnected && (r = !0), f.isConnected || !r) return;
116
+ a.disconnect();
117
+ const d = document.activeElement;
118
+ if (!d || d === document.body || f.contains(d)) {
119
+ const m = i != null && i.isConnected ? i : e;
120
+ m && m.isConnected && m.focus({ preventScroll: !0 });
121
+ }
122
+ if (n && i && i.isConnected && i.innerHTML === s && t) {
123
+ const m = t.rangeCount > 0 ? t.getRangeAt(0) : null;
124
+ !(m && m.compareBoundaryPoints(Range.START_TO_START, n) === 0 && m.compareBoundaryPoints(Range.END_TO_END, n) === 0) && i.contains(n.startContainer) && i.contains(n.endContainer) && (t.removeAllRanges(), t.addRange(n));
125
+ }
126
+ });
127
+ a.observe(document.body, { childList: !0, subtree: !0 });
128
+ }
129
+ const ke = "data-rte-notices", hn = "rte-notice-styles", hi = { info: 5e3, error: 8e3 };
130
+ function di() {
131
+ if (document.getElementById(hn)) return;
132
+ const f = document.createElement("style");
133
+ f.id = hn, f.textContent = `
134
+ [${ke}] {
135
+ position: fixed;
136
+ left: 50%;
137
+ bottom: 24px;
138
+ transform: translateX(-50%);
139
+ z-index: 100001;
140
+ display: flex;
141
+ flex-direction: column;
142
+ align-items: center;
143
+ gap: 8px;
144
+ max-width: min(92vw, 480px);
145
+ pointer-events: none;
146
+ }
147
+ [${ke}] .rte-notice {
148
+ pointer-events: auto;
149
+ cursor: pointer;
150
+ padding: 10px 16px;
151
+ border-radius: 8px;
152
+ font: 14px/1.4 var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
153
+ color: #fff;
154
+ background: #1f2937;
155
+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
156
+ }
157
+ [${ke}] .rte-notice[data-kind="error"] {
158
+ background: #b91c1c;
159
+ }
160
+ @media (prefers-reduced-motion: no-preference) {
161
+ [${ke}] .rte-notice { animation: rte-notice-in 160ms ease-out; }
162
+ @keyframes rte-notice-in { from { opacity: 0; transform: translateY(8px); } }
163
+ }
164
+ `, document.head.appendChild(f);
165
+ }
166
+ function ui(f) {
167
+ const e = f === "error" ? "assertive" : "polite";
168
+ let t = document.querySelector(`[${ke}="${e}"]`);
169
+ return t || (t = document.createElement("div"), t.setAttribute(ke, e), t.setAttribute("aria-live", e), t.setAttribute("role", f === "error" ? "alert" : "status"), t.setAttribute("aria-atomic", "false"), document.body.appendChild(t)), t;
170
+ }
171
+ function dn(f, e = "info") {
172
+ if (typeof document == "undefined" || !document.body) return;
173
+ di();
174
+ const t = ui(e);
175
+ Array.from(t.children).forEach((r) => {
176
+ r.textContent === f && r.remove();
177
+ });
178
+ const n = document.createElement("div");
179
+ n.className = "rte-notice", n.setAttribute("data-kind", e), n.textContent = f, n.title = "Dismiss";
180
+ const i = () => {
181
+ window.clearTimeout(s), n.remove(), t.children.length || t.remove();
182
+ }, s = window.setTimeout(i, hi[e]);
183
+ n.addEventListener("click", i), t.appendChild(n);
184
+ }
185
+ function tt(f) {
186
+ return String(f != null ? f : "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
187
+ }
188
+ const un = "rte-confirm-styles", fi = '[data-theme="dark"], .dark, .editora-theme-dark';
189
+ let gi = 0;
190
+ function pi() {
191
+ if (document.getElementById(un)) return;
192
+ const f = document.createElement("style");
193
+ f.id = un, f.textContent = `
194
+ .rte-confirm-overlay {
195
+ position: fixed; inset: 0; z-index: 100002; display: flex; align-items: center; justify-content: center;
196
+ padding: 16px; background: rgba(15, 23, 36, 0.56);
197
+ --rte-confirm-bg: #ffffff; --rte-confirm-text: #101828; --rte-confirm-muted: #5f6b7d; --rte-confirm-border: #d6dbe4;
198
+ --rte-confirm-accent: #1f75fe; --rte-confirm-danger: #c62828;
199
+ }
200
+ .rte-confirm-overlay.rte-confirm-dark {
201
+ --rte-confirm-bg: #1f2937; --rte-confirm-text: #e5e7eb; --rte-confirm-muted: #9ca3af; --rte-confirm-border: #3b4657;
202
+ --rte-confirm-accent: #3b82f6; --rte-confirm-danger: #ef4444;
203
+ }
204
+ .rte-confirm-dialog {
205
+ box-sizing: border-box; width: min(100%, 420px); padding: 20px; border-radius: 10px;
206
+ background: var(--rte-confirm-bg); color: var(--rte-confirm-text); border: 1px solid var(--rte-confirm-border);
207
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35); font-size: 14px; line-height: 1.45;
208
+ }
209
+ .rte-confirm-title { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
210
+ .rte-confirm-message { margin: 0 0 14px; color: var(--rte-confirm-muted); }
211
+ .rte-confirm-field { display: block; margin: 0 0 6px; }
212
+ .rte-confirm-input {
213
+ box-sizing: border-box; width: 100%; padding: 8px 10px; border-radius: 6px; font: inherit;
214
+ border: 1px solid var(--rte-confirm-border); background: transparent; color: inherit;
215
+ }
216
+ .rte-confirm-input[aria-invalid="true"] { border-color: var(--rte-confirm-danger); }
217
+ .rte-confirm-error { margin: 6px 0 0; color: var(--rte-confirm-danger); font-size: 13px; }
218
+ .rte-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
219
+ .rte-confirm-button {
220
+ padding: 8px 14px; border-radius: 6px; font: inherit; cursor: pointer;
221
+ border: 1px solid var(--rte-confirm-border); background: transparent; color: inherit;
222
+ }
223
+ .rte-confirm-button.primary { background: var(--rte-confirm-accent); border-color: var(--rte-confirm-accent); color: #fff; }
224
+ .rte-confirm-button.danger { background: var(--rte-confirm-danger); border-color: var(--rte-confirm-danger); color: #fff; }
225
+ .rte-confirm-button:focus-visible, .rte-confirm-input:focus-visible { outline: 2px solid var(--rte-confirm-accent); outline-offset: 2px; }
226
+ `, document.head.appendChild(f);
227
+ }
228
+ function mi(f, e, t) {
229
+ var d, g, m, p;
230
+ pi();
231
+ const n = `rte-confirm-${++gi}`, i = document.createElement("div");
232
+ An(i), i.className = "rte-confirm-overlay";
233
+ const s = (d = e.context) != null ? d : document.activeElement instanceof Element ? document.activeElement : null;
234
+ s != null && s.closest(fi) && i.classList.add("rte-confirm-dark");
235
+ const r = (g = e.title) != null ? g : "Please confirm", o = (m = e.confirmText) != null ? m : "Confirm", a = (p = e.cancelText) != null ? p : "Cancel", h = e.danger === !0, c = document.createElement("div");
236
+ return c.className = "rte-confirm-dialog", c.setAttribute("role", "alertdialog"), c.setAttribute("aria-modal", "true"), c.setAttribute("aria-labelledby", `${n}-title`), c.setAttribute("aria-describedby", `${n}-message`), c.innerHTML = `
237
+ <h2 class="rte-confirm-title" id="${n}-title">${tt(r)}</h2>
238
+ <p class="rte-confirm-message" id="${n}-message">${tt(f)}</p>
239
+
240
+ <div class="rte-confirm-actions">
241
+ <button type="button" class="rte-confirm-button" data-action="cancel">${tt(a)}</button>
242
+ <button type="button" class="rte-confirm-button ${h ? "danger" : "primary"}" data-action="confirm">${tt(o)}</button>
243
+ </div>
244
+ `, i.appendChild(c), {
245
+ overlay: i,
246
+ confirmButton: c.querySelector('[data-action="confirm"]'),
247
+ cancelButton: c.querySelector('[data-action="cancel"]'),
248
+ input: c.querySelector("input"),
249
+ error: c.querySelector(".rte-confirm-error")
250
+ };
251
+ }
252
+ function yi(f, e) {
253
+ return new Promise((t) => {
254
+ var h;
255
+ const { overlay: n, confirmButton: i, cancelButton: s } = f;
256
+ let r = !1;
257
+ const o = (c) => {
258
+ const d = e(c);
259
+ d !== void 0 && (r || (r = !0, window.removeEventListener("keydown", a, !0), n.remove(), t(d)));
260
+ }, a = (c) => {
261
+ c.key !== "Escape" || !n.isConnected || (c.preventDefault(), c.stopPropagation(), o(!1));
262
+ };
263
+ window.addEventListener("keydown", a, !0), s.addEventListener("click", () => o(!1)), i.addEventListener("click", () => o(!0)), n.addEventListener("click", (c) => {
264
+ c.target === n && o(!1);
265
+ }), (h = f.input) == null || h.addEventListener("keydown", (c) => {
266
+ c.key === "Enter" && (c.preventDefault(), o(!0));
267
+ }), document.body.appendChild(n);
268
+ });
269
+ }
270
+ function bi(f, e = {}) {
271
+ const t = mi(f, e);
272
+ return yi(t, (n) => n);
273
+ }
274
+ class It {
38
275
  constructor(e = "") {
39
276
  this._lines = [], this._version = 0, this.setText(e);
40
277
  }
@@ -73,8 +310,8 @@ class Ot {
73
310
  }
74
311
  // Replace text in range
75
312
  replaceRange(e, t) {
76
- const n = this.normalizeRange(e), i = this.getTextInRange(n), s = this.getText(), r = this.positionToOffset(n.start), o = this.positionToOffset(n.end), l = s.slice(0, r) + t + s.slice(o);
77
- return this.setText(l), { range: n, text: t, oldText: i };
313
+ const n = this.normalizeRange(e), i = this.getTextInRange(n), s = this.getText(), r = this.positionToOffset(n.start), o = this.positionToOffset(n.end), a = s.slice(0, r) + t + s.slice(o);
314
+ return this.setText(a), { range: n, text: t, oldText: i };
78
315
  }
79
316
  // Insert text at position
80
317
  insertText(e, t) {
@@ -120,7 +357,7 @@ class Ot {
120
357
  }
121
358
  // Clone the model
122
359
  clone() {
123
- const e = new Ot();
360
+ const e = new It();
124
361
  return e._lines = [...this._lines], e._version = this._version, e;
125
362
  }
126
363
  normalizeRange(e) {
@@ -133,7 +370,7 @@ class Ot {
133
370
  return e.line !== t.line ? e.line - t.line : e.column - t.column;
134
371
  }
135
372
  }
136
- class Qn {
373
+ class Ti {
137
374
  constructor(e) {
138
375
  this.gutterWidth = 50, this.gutterFoldColumnWidth = 24, this.gutterFoldColumnGap = 4, this.gutterLineNumberPaddingLeft = 8, this.gutterLineNumberPaddingRight = 4, this.gutterDigitWidth = 9, this.lineHeight = 24, this.trailingNewlineMarkerAttr = "data-lce-trailing-newline-marker", this.foldPlaceholderAttr = "data-lce-fold-placeholder", this.virtualMarkerRegex = /[\u200B\uE000]/, this.virtualMarkerGlobalRegex = /[\u200B\uE000]/g, this.lastLineCount = 0, this.lastHighlightHTML = "", this.highlightOverlayActive = !1, this.lastLineDecorationSnapshot = "", this.lastGutterDecorationSnapshot = "", this.lineDecorations = [], this.gutterDecorations = [], this.lineWrapping = !1, this.measuredHeights = null, this.measuredTops = [], this.measuredLines = null, this.measuredSignature = "", this.measureQueued = !1, this.measurer = null, this.resizeObserver = null, this.destroyed = !1, this.container = e, this.createDOM();
139
376
  }
@@ -284,17 +521,17 @@ class Qn {
284
521
  return;
285
522
  }
286
523
  const s = this.wrapSignature(i), r = this.measuredLines, o = this.measuredHeights;
287
- let l;
524
+ let a;
288
525
  if (r && o && o.length === r.length && s === this.measuredSignature) {
289
- const c = Math.min(r.length, n.length);
290
- let h = 0;
291
- for (; h < c && r[h] === n[h]; ) h += 1;
526
+ const h = Math.min(r.length, n.length);
527
+ let c = 0;
528
+ for (; c < h && r[c] === n[c]; ) c += 1;
292
529
  let d = 0;
293
- for (; d < c - h && r[r.length - 1 - d] === n[n.length - 1 - d]; ) d += 1;
294
- l = o.slice(0, h).concat(this.measureLines(n.slice(h, n.length - d), i), o.slice(o.length - d));
530
+ for (; d < h - c && r[r.length - 1 - d] === n[n.length - 1 - d]; ) d += 1;
531
+ a = o.slice(0, c).concat(this.measureLines(n.slice(c, n.length - d), i), o.slice(o.length - d));
295
532
  } else
296
- l = this.measureLines(n, i);
297
- this.measuredLines = n, this.measuredSignature = s, this.applyMeasuredHeights(l);
533
+ a = this.measureLines(n, i);
534
+ this.measuredLines = n, this.measuredSignature = s, this.applyMeasuredHeights(a);
298
535
  }
299
536
  /** Lays each line out as a block of its own in the hidden copy of the content, and returns how tall each came out. */
300
537
  measureLines(e, t) {
@@ -342,17 +579,17 @@ class Qn {
342
579
  applyMeasuredHeights(e) {
343
580
  var s, r;
344
581
  const t = this.measuredHeights;
345
- if (t === e || t !== null && e !== null && t.length === e.length && t.every((o, l) => o === e[l])) return;
582
+ if (t === e || t !== null && e !== null && t.length === e.length && t.every((o, a) => o === e[a])) return;
346
583
  if (this.measuredHeights = e, this.measuredTops = [], e) {
347
584
  let o = 0;
348
- for (const l of e)
349
- this.measuredTops.push(o), o += l;
585
+ for (const a of e)
586
+ this.measuredTops.push(o), o += a;
350
587
  } else
351
588
  this.measuredLines = null;
352
589
  const i = this.lineNumbersContentElement.children;
353
590
  for (let o = 0; o < i.length; o += 1) {
354
- const l = (s = t == null ? void 0 : t[o]) != null ? s : this.lineHeight, c = (r = e == null ? void 0 : e[o]) != null ? r : this.lineHeight;
355
- l !== c && (i[o].style.height = `${c}px`);
591
+ const a = (s = t == null ? void 0 : t[o]) != null ? s : this.lineHeight, h = (r = e == null ? void 0 : e[o]) != null ? r : this.lineHeight;
592
+ a !== h && (i[o].style.height = `${h}px`);
356
593
  }
357
594
  this.lastLineDecorationSnapshot = "", this.lastGutterDecorationSnapshot = "", this.renderLineDecorations(this.lineDecorations), this.renderGutterDecorations(this.gutterDecorations);
358
595
  }
@@ -440,8 +677,8 @@ class Qn {
440
677
  ), o = document.createRange();
441
678
  try {
442
679
  r && r.parentNode === this.contentElement ? o.setStartBefore(r) : (o.selectNodeContents(this.contentElement), o.collapse(!1)), o.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(o), this.ensureCaretVisible();
443
- } catch (l) {
444
- console.warn("Could not set fallback cursor position:", l);
680
+ } catch (a) {
681
+ console.warn("Could not set fallback cursor position:", a);
445
682
  }
446
683
  }
447
684
  }
@@ -504,12 +741,12 @@ class Qn {
504
741
  const n = this.getText(), i = this.sourceOffsetFromBoundary(t.startContainer, t.startOffset), s = this.sourceOffsetFromBoundary(t.endContainer, t.endOffset), r = e.focusNode && this.isNodeInsideContent(e.focusNode) ? this.sourceOffsetFromBoundary(
505
742
  e.focusNode,
506
743
  e.focusOffset
507
- ) : s, o = this.offsetToPositionInText(i, n), l = this.offsetToPositionInText(s, n), c = this.offsetToPositionInText(r, n);
744
+ ) : s, o = this.offsetToPositionInText(i, n), a = this.offsetToPositionInText(s, n), h = this.offsetToPositionInText(r, n);
508
745
  return {
509
746
  isInEditor: !0,
510
747
  isCollapsed: e.isCollapsed,
511
- cursor: c,
512
- range: e.isCollapsed ? void 0 : { start: o, end: l }
748
+ cursor: h,
749
+ range: e.isCollapsed ? void 0 : { start: o, end: a }
513
750
  };
514
751
  }
515
752
  // Set selection range
@@ -530,7 +767,7 @@ class Qn {
530
767
  const o = document.createRange();
531
768
  try {
532
769
  return o.setStart(s.node, s.offset), o.setEnd(r.node, r.offset), o;
533
- } catch (l) {
770
+ } catch (a) {
534
771
  return null;
535
772
  }
536
773
  }
@@ -654,24 +891,24 @@ class Qn {
654
891
  for (let r = 0; r < i.length; r++) {
655
892
  const o = i[r];
656
893
  if (o instanceof Text) {
657
- const l = o.textContent || "", c = this.buildVisibleToDomMap(l), h = Math.max(0, c.length - 1);
658
- if (n + h >= t) {
659
- const d = Math.max(0, t - n), f = (s = c[d]) != null ? s : l.length;
660
- return { node: o, offset: f };
894
+ const a = o.textContent || "", h = this.buildVisibleToDomMap(a), c = Math.max(0, h.length - 1);
895
+ if (n + c >= t) {
896
+ const d = Math.max(0, t - n), g = (s = h[d]) != null ? s : a.length;
897
+ return { node: o, offset: g };
661
898
  }
662
- n += h;
899
+ n += c;
663
900
  continue;
664
901
  }
665
902
  if (o instanceof HTMLElement && !o.hasAttribute(this.trailingNewlineMarkerAttr) && o.hasAttribute(this.foldPlaceholderAttr)) {
666
- const c = this.getFoldPlaceholderSource(o).length;
667
- if (n + c >= t) {
668
- const h = t - n;
903
+ const h = this.getFoldPlaceholderSource(o).length;
904
+ if (n + h >= t) {
905
+ const c = t - n;
669
906
  return {
670
907
  node: this.contentElement,
671
- offset: h <= c / 2 ? r : r + 1
908
+ offset: c <= h / 2 ? r : r + 1
672
909
  };
673
910
  }
674
- n += c;
911
+ n += h;
675
912
  }
676
913
  }
677
914
  return {
@@ -710,7 +947,7 @@ class Qn {
710
947
  return e === this.contentElement || this.contentElement.contains(e);
711
948
  }
712
949
  getCaretClientRect(e) {
713
- var o, l, c;
950
+ var o, a, h;
714
951
  const t = e.getRangeAt(0).cloneRange();
715
952
  t.collapse(!1);
716
953
  const n = this.getUsableRangeRect(t);
@@ -718,25 +955,25 @@ class Qn {
718
955
  return n;
719
956
  const i = e.focusNode, s = e.focusOffset;
720
957
  if (i instanceof Text) {
721
- const h = (l = (o = i.textContent) == null ? void 0 : o.length) != null ? l : 0, d = document.createRange();
722
- if (s < h) {
723
- d.setStart(i, s), d.setEnd(i, Math.min(h, s + 1));
724
- const f = this.getUsableRangeRect(d);
725
- if (f)
726
- return f;
958
+ const c = (a = (o = i.textContent) == null ? void 0 : o.length) != null ? a : 0, d = document.createRange();
959
+ if (s < c) {
960
+ d.setStart(i, s), d.setEnd(i, Math.min(c, s + 1));
961
+ const g = this.getUsableRangeRect(d);
962
+ if (g)
963
+ return g;
727
964
  }
728
965
  if (s > 0) {
729
966
  d.setStart(i, s - 1), d.setEnd(i, s);
730
- const f = this.getUsableRangeRect(d);
731
- if (f)
732
- return f;
967
+ const g = this.getUsableRangeRect(d);
968
+ if (g)
969
+ return g;
733
970
  }
734
971
  }
735
- const r = i instanceof Element ? i : (c = i == null ? void 0 : i.parentElement) != null ? c : null;
972
+ const r = i instanceof Element ? i : (h = i == null ? void 0 : i.parentElement) != null ? h : null;
736
973
  if (r && r !== this.contentElement && r !== this.editorContainer && this.contentElement.contains(r)) {
737
- const h = r.getBoundingClientRect();
738
- if (this.isUsableRect(h))
739
- return h;
974
+ const c = r.getBoundingClientRect();
975
+ if (this.isUsableRect(c))
976
+ return c;
740
977
  }
741
978
  return null;
742
979
  }
@@ -796,8 +1033,8 @@ class Qn {
796
1033
  t
797
1034
  );
798
1035
  const o = Array.from(r.childNodes);
799
- for (let l = 0; l < Math.min(t, o.length); l++)
800
- n += this.getSourceLength(o[l]);
1036
+ for (let a = 0; a < Math.min(t, o.length); a++)
1037
+ n += this.getSourceLength(o[a]);
801
1038
  return n;
802
1039
  }
803
1040
  }
@@ -831,9 +1068,9 @@ class Qn {
831
1068
  o,
832
1069
  n
833
1070
  );
834
- const l = Array.from(o.childNodes);
835
- for (let c = 0; c < Math.min(n, l.length); c++)
836
- i += this.getSourceLength(l[c]);
1071
+ const a = Array.from(o.childNodes);
1072
+ for (let h = 0; h < Math.min(n, a.length); h++)
1073
+ i += this.getSourceLength(a[h]);
837
1074
  return i;
838
1075
  }
839
1076
  }
@@ -942,8 +1179,8 @@ class Qn {
942
1179
  Math.min(e.column, ((o = n[i]) == null ? void 0 : o.length) || 0)
943
1180
  );
944
1181
  let r = 0;
945
- for (let l = 0; l < i; l++)
946
- r += n[l].length + 1;
1182
+ for (let a = 0; a < i; a++)
1183
+ r += n[a].length + 1;
947
1184
  return r + s;
948
1185
  }
949
1186
  getFoldPlaceholderSource(e) {
@@ -961,7 +1198,7 @@ class Qn {
961
1198
  r.selectNodeContents(e);
962
1199
  try {
963
1200
  r.setEnd(t, n);
964
- } catch (l) {
1201
+ } catch (a) {
965
1202
  return 0;
966
1203
  }
967
1204
  return this.stripVirtualMarkers(r.toString()).length <= s / 2 ? 0 : i;
@@ -970,10 +1207,10 @@ class Qn {
970
1207
  this.contentElement.__lceFoldPlaceholderSources = e;
971
1208
  }
972
1209
  }
973
- let Jn = 0;
974
- const V = class V {
1210
+ let xi = 0;
1211
+ const Si = 200, wi = 1e3, vi = 8e3, B = class B {
975
1212
  constructor(e, t = {}) {
976
- this.extensions = /* @__PURE__ */ new Map(), this.commands = /* @__PURE__ */ new Map(), this.eventListeners = /* @__PURE__ */ new Map(), this.folds = [], this.currentTheme = "default", this.isDestroyed = !1, this.undoStack = [], this.redoStack = [], this.suppressHistory = !1, this.highlightTimeout = null, this.expectingProgrammaticCursor = !1, this.lastKnownCursor = { line: 0, column: 0 }, this.editorInstanceId = ++Jn, this.decorationHighlightStyleId = `editora-decoration-style-${this.editorInstanceId}`, this.decorationHighlightLimit = 1e3, this.decorationLayers = /* @__PURE__ */ new Map(), this.inlineDecorationHighlightNames = /* @__PURE__ */ new Set(), this.decorationRenderRaf = null, this.decorationMutationObserver = null, this.hasCustomDecorationHighlightSupport = !1, this.lastProgrammaticClipboardInsertAt = 0, this.tabReleased = !1, this.config = {
1213
+ this.extensions = /* @__PURE__ */ new Map(), this.commands = /* @__PURE__ */ new Map(), this.eventListeners = /* @__PURE__ */ new Map(), this.folds = [], this.currentTheme = "default", this.isDestroyed = !1, this.undoStack = [], this.redoStack = [], this.suppressHistory = !1, this.highlightTimeout = null, this.expectingProgrammaticCursor = !1, this.lastKnownCursor = { line: 0, column: 0 }, this.typingRun = null, this.editorInstanceId = ++xi, this.decorationHighlightStyleId = `editora-decoration-style-${this.editorInstanceId}`, this.decorationHighlightLimit = 1e3, this.decorationLayers = /* @__PURE__ */ new Map(), this.inlineDecorationHighlightNames = /* @__PURE__ */ new Set(), this.decorationRenderRaf = null, this.decorationMutationObserver = null, this.hasCustomDecorationHighlightSupport = !1, this.lastProgrammaticClipboardInsertAt = 0, this.tabReleased = !1, this.config = {
977
1214
  value: "",
978
1215
  theme: "default",
979
1216
  readOnly: !1,
@@ -981,7 +1218,7 @@ const V = class V {
981
1218
  lineWrapping: !1,
982
1219
  lineNumbers: !0,
983
1220
  ...t
984
- }, this.textModel = new Ot(this.config.value), this.view = new Qn(e), this.view.setTabSize(this.config.tabSize || 2), this.view.setLineWrapping(!!this.config.lineWrapping), this.view.setLineNumbersVisible(this.config.lineNumbers !== !1), this.hasCustomDecorationHighlightSupport = this.detectCustomHighlightSupport(), this.observeDecorationRelevantMutations(), this.setupEventHandlers(), this.config.extensions && this.config.extensions.forEach((n) => this.addExtension(n)), this.setTheme(this.config.theme), this.view.setReadOnly(this.config.readOnly || !1), this.renderTextWithHighlight(this.textModel.getText()), this.registerBuiltInCommands();
1221
+ }, this.textModel = new It(this.config.value), this.view = new Ti(e), this.view.setTabSize(this.config.tabSize || 2), this.view.setLineWrapping(!!this.config.lineWrapping), this.view.setLineNumbersVisible(this.config.lineNumbers !== !1), this.hasCustomDecorationHighlightSupport = this.detectCustomHighlightSupport(), this.observeDecorationRelevantMutations(), this.setupEventHandlers(), this.config.extensions && this.config.extensions.forEach((n) => this.addExtension(n)), this.setTheme(this.config.theme), this.view.setReadOnly(this.config.readOnly || !1), this.renderTextWithHighlight(this.textModel.getText()), this.registerBuiltInCommands();
985
1222
  }
986
1223
  // Public accessors for extensions
987
1224
  getTextModel() {
@@ -1025,12 +1262,12 @@ const V = class V {
1025
1262
  return;
1026
1263
  }
1027
1264
  if (!t.isComposing) {
1028
- const n = V.deletionUnit(t.inputType, "Backward");
1265
+ const n = B.deletionUnit(t.inputType, "Backward");
1029
1266
  if (n) {
1030
1267
  t.preventDefault(), this.pendingInputSnapshot = void 0, this.deleteBackward(n);
1031
1268
  return;
1032
1269
  }
1033
- const i = V.deletionUnit(t.inputType, "Forward");
1270
+ const i = B.deletionUnit(t.inputType, "Forward");
1034
1271
  if (i) {
1035
1272
  t.preventDefault(), this.pendingInputSnapshot = void 0, this.deleteForward(i);
1036
1273
  return;
@@ -1059,12 +1296,22 @@ const V = class V {
1059
1296
  }), e.addEventListener("input", () => {
1060
1297
  var i;
1061
1298
  const t = this.view.getText(), n = this.textModel.getText();
1062
- t !== n ? (this.suppressHistory || this.pushUndoSnapshot(
1063
- (i = this.pendingInputSnapshot) != null ? i : this.captureHistorySnapshot(n)
1064
- ), this.pendingInputSnapshot = void 0, this.textModel.setText(t), this.view.syncTrailingNewlineMarkerForText(t), this.hasRenderedFoldPlaceholders() ? this.clearPendingHighlightRender() : (this.clearPendingHighlightRender(), this.highlightTimeout = setTimeout(() => {
1065
- const s = this.view.getText();
1066
- s !== this.textModel.getText() && this.textModel.setText(s), this.renderTextWithHighlight(this.textModel.getText(), !1), this.highlightTimeout = null;
1067
- }, 300)), this.updateLineNumbers(), this.emit("change", [{ range: this.getFullRange(), text: t, oldText: n }])) : this.pendingInputSnapshot = void 0;
1299
+ if (t !== n) {
1300
+ if (!this.suppressHistory) {
1301
+ const s = B.describeEdit(n, t);
1302
+ this.recordUndoStep(
1303
+ (i = this.pendingInputSnapshot) != null ? i : this.captureHistorySnapshot(n),
1304
+ s.removedLength,
1305
+ s.inserted,
1306
+ t
1307
+ );
1308
+ }
1309
+ this.pendingInputSnapshot = void 0, this.textModel.setText(t), this.view.syncTrailingNewlineMarkerForText(t), this.hasRenderedFoldPlaceholders() ? this.clearPendingHighlightRender() : (this.clearPendingHighlightRender(), this.highlightTimeout = setTimeout(() => {
1310
+ const s = this.view.getText();
1311
+ s !== this.textModel.getText() && this.textModel.setText(s), this.renderTextWithHighlight(this.textModel.getText(), !1), this.highlightTimeout = null;
1312
+ }, 300)), this.updateLineNumbers(), this.emit("change", [{ range: this.getFullRange(), text: t, oldText: n }]);
1313
+ } else
1314
+ this.pendingInputSnapshot = void 0;
1068
1315
  }), this.documentSelectionChangeHandler = () => {
1069
1316
  var i, s, r;
1070
1317
  const t = this.syncSelectionCacheFromView();
@@ -1078,7 +1325,7 @@ const V = class V {
1078
1325
  }, document.addEventListener("selectionchange", this.documentSelectionChangeHandler), e.addEventListener("blur", () => {
1079
1326
  this.tabReleased = !1;
1080
1327
  }), e.addEventListener("keydown", (t) => {
1081
- if (this.emit("keydown", t), t.key === "Tab" && this.tabReleased && !t.ctrlKey && !t.metaKey && !t.altKey) {
1328
+ if (/^(Arrow(Left|Right|Up|Down)|Home|End|Page(Up|Down))$/.test(t.key) && this.closeTypingRun(), this.emit("keydown", t), t.key === "Tab" && this.tabReleased && !t.ctrlKey && !t.metaKey && !t.altKey) {
1082
1329
  this.tabReleased = !1;
1083
1330
  return;
1084
1331
  }
@@ -1107,7 +1354,7 @@ const V = class V {
1107
1354
  return;
1108
1355
  }
1109
1356
  }), e.addEventListener("mousedown", (t) => {
1110
- this.emit("mousedown", t);
1357
+ this.closeTypingRun(), this.emit("mousedown", t);
1111
1358
  const n = Array.from(this.extensions.values()).reverse();
1112
1359
  for (const i of n)
1113
1360
  if (i.onMouseDown && i.onMouseDown(t) === !1) {
@@ -1260,7 +1507,7 @@ const V = class V {
1260
1507
  }
1261
1508
  // Search & Navigation
1262
1509
  search(e, t = {}) {
1263
- var h;
1510
+ var c;
1264
1511
  if (!e) return [];
1265
1512
  const n = {
1266
1513
  query: e,
@@ -1268,50 +1515,50 @@ const V = class V {
1268
1515
  wholeWord: !1,
1269
1516
  regex: !1,
1270
1517
  ...t
1271
- }, i = [], s = this.textModel.getText(), { normalizedText: r, normalizedToRawOffsets: o } = this.buildSearchTextAndOffsetMap(s), l = n.caseSensitive ? r : r.toLowerCase(), c = n.caseSensitive ? e : e.toLowerCase();
1518
+ }, i = [], s = this.textModel.getText(), { normalizedText: r, normalizedToRawOffsets: o } = this.buildSearchTextAndOffsetMap(s), a = n.caseSensitive ? r : r.toLowerCase(), h = n.caseSensitive ? e : e.toLowerCase();
1272
1519
  if (n.regex) {
1273
1520
  let d;
1274
1521
  try {
1275
1522
  d = new RegExp(e, n.caseSensitive ? "g" : "gi");
1276
- } catch (y) {
1523
+ } catch (m) {
1277
1524
  return [];
1278
1525
  }
1279
- let f;
1280
- for (; (f = d.exec(r)) !== null; ) {
1281
- const y = (h = f[0]) != null ? h : "";
1282
- if (y.length === 0) {
1283
- d.lastIndex = f.index + 1;
1526
+ let g;
1527
+ for (; (g = d.exec(r)) !== null; ) {
1528
+ const m = (c = g[0]) != null ? c : "";
1529
+ if (m.length === 0) {
1530
+ d.lastIndex = g.index + 1;
1284
1531
  continue;
1285
1532
  }
1286
- const g = f.index, p = f.index + y.length;
1287
- n.wholeWord && !this.isWholeWordBoundary(r, g, p) || this.pushSearchResultFromOffsets(
1533
+ const p = g.index, y = g.index + m.length;
1534
+ n.wholeWord && !this.isWholeWordBoundary(r, p, y) || this.pushSearchResultFromOffsets(
1288
1535
  i,
1289
- g,
1290
1536
  p,
1537
+ y,
1291
1538
  r,
1292
1539
  o
1293
1540
  );
1294
1541
  }
1295
1542
  } else {
1296
- let d = 0, f = l.indexOf(c, d);
1297
- for (; f !== -1; ) {
1298
- const y = f + c.length;
1299
- !n.wholeWord || this.isWholeWordBoundary(r, f, y) ? (this.pushSearchResultFromOffsets(
1543
+ let d = 0, g = a.indexOf(h, d);
1544
+ for (; g !== -1; ) {
1545
+ const m = g + h.length;
1546
+ !n.wholeWord || this.isWholeWordBoundary(r, g, m) ? (this.pushSearchResultFromOffsets(
1300
1547
  i,
1301
- f,
1302
- y,
1548
+ g,
1549
+ m,
1303
1550
  r,
1304
1551
  o
1305
- ), d = y) : d = f + 1, f = l.indexOf(c, d);
1552
+ ), d = m) : d = g + 1, g = a.indexOf(h, d);
1306
1553
  }
1307
1554
  }
1308
1555
  return i;
1309
1556
  }
1310
1557
  pushSearchResultFromOffsets(e, t, n, i, s) {
1311
- var h, d;
1312
- const r = (h = s[t]) != null ? h : t, o = (d = s[n]) != null ? d : r, l = this.textModel.offsetToPosition(r), c = this.textModel.offsetToPosition(o);
1558
+ var c, d;
1559
+ const r = (c = s[t]) != null ? c : t, o = (d = s[n]) != null ? d : r, a = this.textModel.offsetToPosition(r), h = this.textModel.offsetToPosition(o);
1313
1560
  e.push({
1314
- range: { start: l, end: c },
1561
+ range: { start: a, end: h },
1315
1562
  match: i.substring(t, n)
1316
1563
  });
1317
1564
  }
@@ -1327,7 +1574,7 @@ const V = class V {
1327
1574
  let i = 0;
1328
1575
  for (let s = 0; s < e.length; s++) {
1329
1576
  const r = e[s];
1330
- r === "​" || r === V.CURSOR_SENTINEL || (t.push(r), i += 1, n[i] = s + 1);
1577
+ r === "​" || r === B.CURSOR_SENTINEL || (t.push(r), i += 1, n[i] = s + 1);
1331
1578
  }
1332
1579
  return n[i] = e.length, {
1333
1580
  normalizedText: t.join(""),
@@ -1391,33 +1638,33 @@ const V = class V {
1391
1638
  if (n && typeof n.highlightHTML == "function")
1392
1639
  try {
1393
1640
  if (typeof this.view.setHighlightHTML == "function") {
1394
- const p = this.view.getContentElement();
1395
- (p.querySelector(
1641
+ const y = this.view.getContentElement();
1642
+ (y.querySelector(
1396
1643
  "[data-lce-fold-placeholder]"
1397
- ) || p.textContent !== e) && this.view.setText(e);
1644
+ ) || y.textContent !== e) && this.view.setText(e);
1398
1645
  const w = typeof n.highlight == "function" ? n.highlight(e) : n.highlightHTML(e);
1399
1646
  this.view.setHighlightHTML(w), this.view.syncTrailingNewlineMarkerForText(e), this.scheduleDecorationRender();
1400
1647
  return;
1401
1648
  }
1402
1649
  const s = !t && !this.expectingProgrammaticCursor;
1403
- let r, o, l, c;
1404
- const h = this.view.getSelectionState(), d = h.isInEditor && !!h.cursor;
1405
- (t || s) && d && (r = h.isCollapsed ? void 0 : h.range, o = this.textModel.positionToOffset(h.cursor), r && (l = this.textModel.positionToOffset(r.start), c = this.textModel.positionToOffset(r.end)));
1406
- const f = d && (t || s) && !r && o !== void 0 && this.hasCollapsedSelectionInEditor(), y = f ? this.insertSentinelAtOffset(e, o) : e, g = typeof n.highlight == "function" ? n.highlight(y) : n.highlightHTML(y);
1407
- typeof this.view.setHighlightHTML == "function" ? this.view.setHighlightHTML(g) : this.view.setHTML(g), this.view.syncTrailingNewlineMarkerForText(e), (t || s) && d && requestAnimationFrame(() => {
1650
+ let r, o, a, h;
1651
+ const c = this.view.getSelectionState(), d = c.isInEditor && !!c.cursor;
1652
+ (t || s) && d && (r = c.isCollapsed ? void 0 : c.range, o = this.textModel.positionToOffset(c.cursor), r && (a = this.textModel.positionToOffset(r.start), h = this.textModel.positionToOffset(r.end)));
1653
+ const g = d && (t || s) && !r && o !== void 0 && this.hasCollapsedSelectionInEditor(), m = g ? this.insertSentinelAtOffset(e, o) : e, p = typeof n.highlight == "function" ? n.highlight(m) : n.highlightHTML(m);
1654
+ typeof this.view.setHighlightHTML == "function" ? this.view.setHighlightHTML(p) : this.view.setHTML(p), this.view.syncTrailingNewlineMarkerForText(e), (t || s) && d && requestAnimationFrame(() => {
1408
1655
  try {
1409
- if (f && this.restoreCursorFromSentinel()) {
1656
+ if (g && this.restoreCursorFromSentinel()) {
1410
1657
  this.view.ensureCaretVisible();
1411
1658
  return;
1412
1659
  }
1413
- if (r && (l !== void 0 || c !== void 0)) {
1414
- const p = l !== void 0 ? l : o, b = c !== void 0 ? c : o, w = Math.min(p, b), E = Math.max(p, b), F = this.textModel.offsetToPosition(w), A = this.textModel.offsetToPosition(E);
1415
- this.view.setSelectionRange({ start: F, end: A });
1660
+ if (r && (a !== void 0 || h !== void 0)) {
1661
+ const y = a !== void 0 ? a : o, b = h !== void 0 ? h : o, w = Math.min(y, b), E = Math.max(y, b), D = this.textModel.offsetToPosition(w), M = this.textModel.offsetToPosition(E);
1662
+ this.view.setSelectionRange({ start: D, end: M });
1416
1663
  } else if (o !== void 0) {
1417
- const p = this.textModel.offsetToPosition(o);
1418
- this.view.setCursorPosition(p);
1664
+ const y = this.textModel.offsetToPosition(o);
1665
+ this.view.setCursorPosition(y);
1419
1666
  }
1420
- } catch (p) {
1667
+ } catch (y) {
1421
1668
  }
1422
1669
  }), this.scheduleDecorationRender();
1423
1670
  return;
@@ -1444,25 +1691,25 @@ const V = class V {
1444
1691
  return i.selectNodeContents(n), i.setEnd(t.endContainer, t.endOffset), this.stripVirtualMarkers(i.toString()).length;
1445
1692
  }
1446
1693
  stripVirtualMarkers(e) {
1447
- return e.replace(/\u200B/g, "").split(V.CURSOR_SENTINEL).join("");
1694
+ return e.replace(/\u200B/g, "").split(B.CURSOR_SENTINEL).join("");
1448
1695
  }
1449
1696
  insertSentinelAtOffset(e, t) {
1450
1697
  const n = Math.max(0, Math.min(t, e.length));
1451
- return e.slice(0, n) + V.CURSOR_SENTINEL + e.slice(n);
1698
+ return e.slice(0, n) + B.CURSOR_SENTINEL + e.slice(n);
1452
1699
  }
1453
1700
  restoreCursorFromSentinel() {
1454
1701
  var o;
1455
1702
  const e = this.view.getContentElement(), t = window.getSelection(), n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
1456
1703
  let i = n.nextNode(), s = null, r = 0;
1457
1704
  for (; i; ) {
1458
- const l = (o = i.textContent) != null ? o : "", c = l.indexOf(V.CURSOR_SENTINEL);
1459
- c !== -1 && (s || (s = i, r = c), i.textContent = l.split(V.CURSOR_SENTINEL).join("")), i = n.nextNode();
1705
+ const a = (o = i.textContent) != null ? o : "", h = a.indexOf(B.CURSOR_SENTINEL);
1706
+ h !== -1 && (s || (s = i, r = h), i.textContent = a.split(B.CURSOR_SENTINEL).join("")), i = n.nextNode();
1460
1707
  }
1461
1708
  if (!s || !t) return !1;
1462
1709
  try {
1463
- const l = document.createRange();
1464
- return l.setStart(s, r), l.collapse(!0), t.removeAllRanges(), t.addRange(l), !0;
1465
- } catch (l) {
1710
+ const a = document.createRange();
1711
+ return a.setStart(s, r), a.collapse(!0), t.removeAllRanges(), t.addRange(a), !0;
1712
+ } catch (a) {
1466
1713
  return !1;
1467
1714
  }
1468
1715
  }
@@ -1478,7 +1725,9 @@ const V = class V {
1478
1725
  // History: undo/redo
1479
1726
  undo() {
1480
1727
  if (this.undoStack.length === 0) return;
1481
- const e = this.undoStack.pop(), t = this.captureHistorySnapshot();
1728
+ const e = this.undoStack.pop();
1729
+ this.closeTypingRun();
1730
+ const t = this.captureHistorySnapshot();
1482
1731
  this.pushSnapshot(this.redoStack, t);
1483
1732
  try {
1484
1733
  this.suppressHistory = !0, this.expectingProgrammaticCursor = !0, this.restoreHistorySnapshot(e), setTimeout(() => {
@@ -1490,7 +1739,9 @@ const V = class V {
1490
1739
  }
1491
1740
  redo() {
1492
1741
  if (this.redoStack.length === 0) return;
1493
- const e = this.redoStack.pop(), t = this.captureHistorySnapshot();
1742
+ const e = this.redoStack.pop();
1743
+ this.closeTypingRun();
1744
+ const t = this.captureHistorySnapshot();
1494
1745
  this.pushSnapshot(this.undoStack, t);
1495
1746
  try {
1496
1747
  this.suppressHistory = !0, this.expectingProgrammaticCursor = !0, this.restoreHistorySnapshot(e), setTimeout(() => {
@@ -1517,29 +1768,29 @@ const V = class V {
1517
1768
  const t = this.textModel.getText(), { startOffset: n, endOffset: i } = this.getActiveSelectionOffsets(t), s = Math.min(n, i), r = Math.max(n, i);
1518
1769
  if (!e && !t.slice(s, r).includes(`
1519
1770
  `)) return !1;
1520
- const o = " ".repeat(this.config.tabSize || 2), l = t.lastIndexOf(`
1521
- `, s - 1) + 1, c = r > s && t[r - 1] === `
1522
- ` ? r - 1 : r, h = t.indexOf(`
1523
- `, c), d = h === -1 ? t.length : h, f = t.slice(l, d).split(`
1771
+ const o = " ".repeat(this.config.tabSize || 2), a = t.lastIndexOf(`
1772
+ `, s - 1) + 1, h = r > s && t[r - 1] === `
1773
+ ` ? r - 1 : r, c = t.indexOf(`
1774
+ `, h), d = c === -1 ? t.length : c, g = t.slice(a, d).split(`
1524
1775
  `);
1525
- let y = 0, g = 0;
1526
- const p = f.map((E, F) => {
1527
- let A = E;
1776
+ let m = 0, p = 0;
1777
+ const y = g.map((E, D) => {
1778
+ let M = E;
1528
1779
  if (!e)
1529
- A = E.length === 0 ? E : o + E;
1780
+ M = E.length === 0 ? E : o + E;
1530
1781
  else if (E.startsWith(" "))
1531
- A = E.slice(1);
1782
+ M = E.slice(1);
1532
1783
  else {
1533
- const $ = /^ */.exec(E)[0].length;
1534
- A = E.slice(Math.min($, o.length));
1784
+ const H = /^ */.exec(E)[0].length;
1785
+ M = E.slice(Math.min(H, o.length));
1535
1786
  }
1536
- const I = A.length - E.length;
1537
- return F === 0 && (y = I), g += I, A;
1787
+ const k = M.length - E.length;
1788
+ return D === 0 && (m = k), p += k, M;
1538
1789
  });
1539
- if (g === 0) return !0;
1540
- this.replaceOffsetsWithText(l, d, p.join(`
1790
+ if (p === 0) return !0;
1791
+ this.replaceOffsetsWithText(a, d, y.join(`
1541
1792
  `));
1542
- const b = Math.max(l, s + y), w = Math.max(b, r + g);
1793
+ const b = Math.max(a, s + m), w = Math.max(b, r + p);
1543
1794
  return s === r ? this.setCursor(this.textModel.offsetToPosition(b)) : this.setSelection({
1544
1795
  start: this.textModel.offsetToPosition(b),
1545
1796
  end: this.textModel.offsetToPosition(w)
@@ -1585,15 +1836,15 @@ const V = class V {
1585
1836
  return e.line !== t.line ? e.line - t.line : e.column - t.column;
1586
1837
  }
1587
1838
  captureHistorySnapshot(e = this.textModel.getText()) {
1588
- const t = this.view.getSelectionState(), n = t.isInEditor && !t.isCollapsed ? t.range : void 0, i = t.isInEditor && t.cursor ? t.cursor : void 0, s = n != null ? n : this.lastKnownSelection, r = i != null ? i : this.lastKnownCursor, o = this.clampPositionToText(r, e), l = {
1839
+ const t = this.view.getSelectionState(), n = t.isInEditor && !t.isCollapsed ? t.range : void 0, i = t.isInEditor && t.cursor ? t.cursor : void 0, s = n != null ? n : this.lastKnownSelection, r = i != null ? i : this.lastKnownCursor, o = this.clampPositionToText(r, e), a = {
1589
1840
  text: e,
1590
1841
  cursorOffset: this.positionToOffsetInText(o, e)
1591
1842
  };
1592
1843
  if (s) {
1593
- const c = this.clampPositionToText(s.start, e), h = this.clampPositionToText(s.end, e);
1594
- l.anchorOffset = this.positionToOffsetInText(c, e), l.focusOffset = this.positionToOffsetInText(h, e);
1844
+ const h = this.clampPositionToText(s.start, e), c = this.clampPositionToText(s.end, e);
1845
+ a.anchorOffset = this.positionToOffsetInText(h, e), a.focusOffset = this.positionToOffsetInText(c, e);
1595
1846
  }
1596
- return l;
1847
+ return a;
1597
1848
  }
1598
1849
  restoreHistorySnapshot(e) {
1599
1850
  this.setValue(e.text), requestAnimationFrame(() => {
@@ -1614,8 +1865,40 @@ const V = class V {
1614
1865
  pushUndoSnapshot(e) {
1615
1866
  this.pushSnapshot(this.undoStack, e), this.redoStack.length = 0;
1616
1867
  }
1868
+ /** A change of one or two characters, nothing else replaced, is typing; anything bigger is an edit of its own. */
1869
+ static typingKind(e, t) {
1870
+ return e === 0 && t.length > 0 && t.length <= 2 && !t.includes(`
1871
+ `) ? "insert" : e > 0 && e <= 2 && t.length === 0 ? "delete" : null;
1872
+ }
1873
+ /** What changed between two versions of the text, found from both ends. */
1874
+ static describeEdit(e, t) {
1875
+ const n = Math.min(e.length, t.length);
1876
+ let i = 0;
1877
+ for (; i < n && e.charCodeAt(i) === t.charCodeAt(i); ) i++;
1878
+ let s = 0;
1879
+ for (; s < n - i && e.charCodeAt(e.length - 1 - s) === t.charCodeAt(t.length - 1 - s); )
1880
+ s++;
1881
+ return { removedLength: e.length - i - s, inserted: t.slice(i, t.length - s) };
1882
+ }
1883
+ /**
1884
+ * Records the state before an edit as an undo step, unless the edit continues the typing (or deleting) the
1885
+ * newest step is already collecting: then one Undo takes back the whole word, not one letter. A space or a
1886
+ * line end finishes a word (it stays with the word before it); a pause, a click, a caret key, Undo and Redo
1887
+ * start a new step.
1888
+ */
1889
+ recordUndoStep(e, t, n, i) {
1890
+ const s = B.typingKind(t, n), r = Date.now(), o = s === "insert" && /\s/.test(n), a = this.typingRun;
1891
+ if (s && a && a.kind === s && !a.closed && a.endText === e.text && r - a.updatedAt <= wi && r - a.startedAt <= vi) {
1892
+ a.endText = i, a.updatedAt = r, o && (a.closed = !0);
1893
+ return;
1894
+ }
1895
+ this.pushUndoSnapshot(e), this.typingRun = s ? { kind: s, startedAt: r, updatedAt: r, endText: i, closed: o } : null;
1896
+ }
1897
+ closeTypingRun() {
1898
+ this.typingRun && (this.typingRun.closed = !0);
1899
+ }
1617
1900
  pushSnapshot(e, t) {
1618
- e.push(t), e.length > 100 && e.shift();
1901
+ e.push(t), e.length > Si && e.shift();
1619
1902
  }
1620
1903
  clampPositionToText(e, t) {
1621
1904
  var r, o;
@@ -1634,8 +1917,8 @@ const V = class V {
1634
1917
  const n = t.split(`
1635
1918
  `), i = this.clampPositionToText(e, t);
1636
1919
  let s = 0;
1637
- for (let l = 0; l < i.line; l++)
1638
- s += ((o = (r = n[l]) == null ? void 0 : r.length) != null ? o : 0) + 1;
1920
+ for (let a = 0; a < i.line; a++)
1921
+ s += ((o = (r = n[a]) == null ? void 0 : r.length) != null ? o : 0) + 1;
1639
1922
  return s + i.column;
1640
1923
  }
1641
1924
  clearPendingHighlightRender() {
@@ -1700,31 +1983,31 @@ const V = class V {
1700
1983
  "TR",
1701
1984
  "UL"
1702
1985
  ]), i = (o) => {
1703
- var l;
1704
- for (let c = o.length - 1; c >= 0; c--) {
1705
- const h = (l = o[c]) != null ? l : "";
1706
- if (h.length !== 0)
1707
- return h.endsWith(`
1986
+ var a;
1987
+ for (let h = o.length - 1; h >= 0; h--) {
1988
+ const c = (a = o[h]) != null ? a : "";
1989
+ if (c.length !== 0)
1990
+ return c.endsWith(`
1708
1991
  `);
1709
1992
  }
1710
1993
  return !1;
1711
- }, s = (o, l) => {
1994
+ }, s = (o, a) => {
1712
1995
  if (o instanceof Text) {
1713
- l.push(o.data);
1996
+ a.push(o.data);
1714
1997
  return;
1715
1998
  }
1716
1999
  if (!(o instanceof HTMLElement)) {
1717
- o.childNodes.forEach((h) => s(h, l));
2000
+ o.childNodes.forEach((c) => s(c, a));
1718
2001
  return;
1719
2002
  }
1720
2003
  if (o.tagName === "BR") {
1721
- l.push(`
2004
+ a.push(`
1722
2005
  `);
1723
2006
  return;
1724
2007
  }
1725
- const c = n.has(o.tagName);
1726
- c && l.length > 0 && !i(l) && l.push(`
1727
- `), o.childNodes.forEach((h) => s(h, l)), c && !i(l) && l.push(`
2008
+ const h = n.has(o.tagName);
2009
+ h && a.length > 0 && !i(a) && a.push(`
2010
+ `), o.childNodes.forEach((c) => s(c, a)), h && !i(a) && a.push(`
1728
2011
  `);
1729
2012
  }, r = [];
1730
2013
  return t.body.childNodes.forEach((o) => s(o, r)), r.join("").replace(/\n{3,}/g, `
@@ -1759,21 +2042,21 @@ const V = class V {
1759
2042
  if (e === "backward") {
1760
2043
  if (r === 0)
1761
2044
  return;
1762
- const c = V.deletionBoundary(n, r, "backward", t);
1763
- this.replaceOffsetsWithText(c, r, "");
2045
+ const h = B.deletionBoundary(n, r, "backward", t);
2046
+ this.replaceOffsetsWithText(h, r, "");
1764
2047
  return;
1765
2048
  }
1766
2049
  if (o >= n.length)
1767
2050
  return;
1768
- const l = V.deletionBoundary(n, o, "forward", t);
1769
- this.replaceOffsetsWithText(o, l, "");
2051
+ const a = B.deletionBoundary(n, o, "forward", t);
2052
+ this.replaceOffsetsWithText(o, a, "");
1770
2053
  }
1771
2054
  static getGraphemeSegmenter() {
1772
- if (V.graphemeSegmenter === void 0) {
2055
+ if (B.graphemeSegmenter === void 0) {
1773
2056
  const e = Intl.Segmenter;
1774
- V.graphemeSegmenter = e ? new e(void 0, { granularity: "grapheme" }) : null;
2057
+ B.graphemeSegmenter = e ? new e(void 0, { granularity: "grapheme" }) : null;
1775
2058
  }
1776
- return V.graphemeSegmenter;
2059
+ return B.graphemeSegmenter;
1777
2060
  }
1778
2061
  /**
1779
2062
  * Where a deletion of `unit` starting at `offset` ends. Characters are whole grapheme
@@ -1782,80 +2065,80 @@ const V = class V {
1782
2065
  * which is invalid text once saved.
1783
2066
  */
1784
2067
  static deletionBoundary(e, t, n, i) {
1785
- const s = (f) => /[A-Za-z0-9_]/.test(f), r = (f) => f === " " || f === " ";
2068
+ const s = (g) => /[A-Za-z0-9_]/.test(g), r = (g) => g === " " || g === " ";
1786
2069
  if (i === "line") {
1787
2070
  if (n === "backward") {
1788
- const g = e.lastIndexOf(`
2071
+ const p = e.lastIndexOf(`
1789
2072
  `, t - 1) + 1;
1790
- return g === t ? t - 1 : g;
2073
+ return p === t ? t - 1 : p;
1791
2074
  }
1792
- const f = e.indexOf(`
1793
- `, t), y = f === -1 ? e.length : f;
1794
- return y === t ? Math.min(e.length, t + 1) : y;
2075
+ const g = e.indexOf(`
2076
+ `, t), m = g === -1 ? e.length : g;
2077
+ return m === t ? Math.min(e.length, t + 1) : m;
1795
2078
  }
1796
2079
  if (i === "word") {
1797
- let f = t;
2080
+ let g = t;
1798
2081
  if (n === "backward") {
1799
- if (e[f - 1] === `
1800
- `) return f - 1;
1801
- for (; f > 0 && r(e[f - 1]); ) f--;
1802
- if (f > 0 && e[f - 1] !== `
2082
+ if (e[g - 1] === `
2083
+ `) return g - 1;
2084
+ for (; g > 0 && r(e[g - 1]); ) g--;
2085
+ if (g > 0 && e[g - 1] !== `
1803
2086
  `) {
1804
- const y = s(e[f - 1]);
1805
- for (; f > 0 && e[f - 1] !== `
1806
- ` && !r(e[f - 1]) && s(e[f - 1]) === y; ) f--;
2087
+ const m = s(e[g - 1]);
2088
+ for (; g > 0 && e[g - 1] !== `
2089
+ ` && !r(e[g - 1]) && s(e[g - 1]) === m; ) g--;
1807
2090
  }
1808
- return f;
2091
+ return g;
1809
2092
  }
1810
- if (e[f] === `
1811
- `) return f + 1;
1812
- for (; f < e.length && r(e[f]); ) f++;
1813
- if (f < e.length && e[f] !== `
2093
+ if (e[g] === `
2094
+ `) return g + 1;
2095
+ for (; g < e.length && r(e[g]); ) g++;
2096
+ if (g < e.length && e[g] !== `
1814
2097
  `) {
1815
- const y = s(e[f]);
1816
- for (; f < e.length && e[f] !== `
1817
- ` && !r(e[f]) && s(e[f]) === y; ) f++;
2098
+ const m = s(e[g]);
2099
+ for (; g < e.length && e[g] !== `
2100
+ ` && !r(e[g]) && s(e[g]) === m; ) g++;
1818
2101
  }
1819
- return f;
2102
+ return g;
1820
2103
  }
1821
2104
  if (n === "backward") {
1822
- const f = e.lastIndexOf(`
2105
+ const g = e.lastIndexOf(`
1823
2106
  `, t - 1) + 1;
1824
- if (f === t) return t - 1;
1825
- const y = V.getGraphemeSegmenter();
1826
- if (y) {
2107
+ if (g === t) return t - 1;
2108
+ const m = B.getGraphemeSegmenter();
2109
+ if (m) {
1827
2110
  let b = 1;
1828
- for (const { segment: w } of y.segment(e.slice(f, t))) b = w.length;
2111
+ for (const { segment: w } of m.segment(e.slice(g, t))) b = w.length;
1829
2112
  return t - b;
1830
2113
  }
1831
- const g = e.charCodeAt(t - 1), p = t >= 2 ? e.charCodeAt(t - 2) : 0;
1832
- return g >= 56320 && g <= 57343 && p >= 55296 && p <= 56319 ? t - 2 : t - 1;
2114
+ const p = e.charCodeAt(t - 1), y = t >= 2 ? e.charCodeAt(t - 2) : 0;
2115
+ return p >= 56320 && p <= 57343 && y >= 55296 && y <= 56319 ? t - 2 : t - 1;
1833
2116
  }
1834
2117
  if (e[t] === `
1835
2118
  `) return t + 1;
1836
2119
  const o = e.indexOf(`
1837
- `, t), l = o === -1 ? e.length : o, c = V.getGraphemeSegmenter();
1838
- if (c) {
1839
- for (const { segment: f } of c.segment(e.slice(t, l))) return t + f.length;
2120
+ `, t), a = o === -1 ? e.length : o, h = B.getGraphemeSegmenter();
2121
+ if (h) {
2122
+ for (const { segment: g } of h.segment(e.slice(t, a))) return t + g.length;
1840
2123
  return t + 1;
1841
2124
  }
1842
- const h = e.charCodeAt(t), d = t + 1 < e.length ? e.charCodeAt(t + 1) : 0;
1843
- return h >= 55296 && h <= 56319 && d >= 56320 && d <= 57343 ? t + 2 : t + 1;
2125
+ const c = e.charCodeAt(t), d = t + 1 < e.length ? e.charCodeAt(t + 1) : 0;
2126
+ return c >= 55296 && c <= 56319 && d >= 56320 && d <= 57343 ? t + 2 : t + 1;
1844
2127
  }
1845
2128
  replaceOffsetsWithText(e, t, n) {
1846
- var y;
2129
+ var m;
1847
2130
  this.ensureEditableSurfaceIsUnfolded();
1848
2131
  const i = n.replace(/\r\n?/g, `
1849
- `), s = this.textModel.getText(), r = (y = this.pendingInputSnapshot) != null ? y : this.captureHistorySnapshot(s), o = Math.max(0, Math.min(e, s.length)), l = Math.max(0, Math.min(t, s.length)), c = Math.min(o, l), h = Math.max(o, l), d = this.textModel.replaceRange(
2132
+ `), s = this.textModel.getText(), r = (m = this.pendingInputSnapshot) != null ? m : this.captureHistorySnapshot(s), o = Math.max(0, Math.min(e, s.length)), a = Math.max(0, Math.min(t, s.length)), h = Math.min(o, a), c = Math.max(o, a), d = this.textModel.replaceRange(
1850
2133
  {
1851
- start: this.textModel.offsetToPosition(c),
1852
- end: this.textModel.offsetToPosition(h)
2134
+ start: this.textModel.offsetToPosition(h),
2135
+ end: this.textModel.offsetToPosition(c)
1853
2136
  },
1854
2137
  i
1855
2138
  );
1856
- this.pendingInputSnapshot = void 0, this.suppressHistory || this.pushUndoSnapshot(r);
1857
- const f = c + i.length;
1858
- return this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), this.setCursor(this.textModel.offsetToPosition(f)), setTimeout(() => {
2139
+ this.pendingInputSnapshot = void 0, this.suppressHistory || this.recordUndoStep(r, c - h, i, this.textModel.getText());
2140
+ const g = h + i.length;
2141
+ return this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), this.setCursor(this.textModel.offsetToPosition(g)), setTimeout(() => {
1859
2142
  this.expectingProgrammaticCursor = !1;
1860
2143
  }, 20), this.emit("change", [d]), d;
1861
2144
  }
@@ -1947,21 +2230,21 @@ const V = class V {
1947
2230
  return;
1948
2231
  const i = this.textModel.getText(), s = [];
1949
2232
  let r = 0;
1950
- for (const l of e) {
2233
+ for (const a of e) {
1951
2234
  if (r >= this.decorationHighlightLimit)
1952
2235
  break;
1953
- const c = this.normalizeInlineDecoration(l, i);
1954
- if (!c)
1955
- continue;
1956
- const h = this.view.createDomRangeFromRange(c.range);
2236
+ const h = this.normalizeInlineDecoration(a, i);
1957
2237
  if (!h)
1958
2238
  continue;
2239
+ const c = this.view.createDomRangeFromRange(h.range);
2240
+ if (!c)
2241
+ continue;
1959
2242
  const d = this.buildInlineDecorationHighlightName(
1960
- c.id
2243
+ h.id
1961
2244
  );
1962
- t.highlights.set(d, new n(h)), this.inlineDecorationHighlightNames.add(d), s.push(`
2245
+ t.highlights.set(d, new n(c)), this.inlineDecorationHighlightNames.add(d), s.push(`
1963
2246
  ::highlight(${d}) {
1964
- ${this.serializeInlineDecorationStyle(c.style)}
2247
+ ${this.serializeInlineDecorationStyle(h.style)}
1965
2248
  }
1966
2249
  `), r += 1;
1967
2250
  }
@@ -2052,9 +2335,9 @@ const V = class V {
2052
2335
  };
2053
2336
  }
2054
2337
  };
2055
- V.CURSOR_SENTINEL = "";
2056
- let Ct = V;
2057
- class ei {
2338
+ B.CURSOR_SENTINEL = "";
2339
+ let Rt = B;
2340
+ class Ei {
2058
2341
  constructor(e) {
2059
2342
  this.name = "keymap", this.editor = null, this.keymap = {}, this.isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0, this.keymap = e || this.getDefaultKeymap();
2060
2343
  }
@@ -2068,12 +2351,12 @@ class ei {
2068
2351
  return this.editor.executeCommand(t.command), e.preventDefault(), e.stopPropagation(), !1;
2069
2352
  }
2070
2353
  findMatchingBinding(e) {
2071
- const { key: t, ctrlKey: n, altKey: i, shiftKey: s, metaKey: r } = e, o = String(t).toLowerCase(), l = this.keymap[o];
2072
- if (!l) return null;
2073
- for (const c of l) {
2074
- const h = c.ctrlKey === void 0 || c.ctrlKey === n, d = c.altKey === void 0 || c.altKey === i, f = c.shiftKey === void 0 || c.shiftKey === s, y = c.metaKey === void 0 || c.metaKey === r;
2075
- if (h && d && f && y)
2076
- return c;
2354
+ const { key: t, ctrlKey: n, altKey: i, shiftKey: s, metaKey: r } = e, o = String(t).toLowerCase(), a = this.keymap[o];
2355
+ if (!a) return null;
2356
+ for (const h of a) {
2357
+ const c = h.ctrlKey === void 0 || h.ctrlKey === n, d = h.altKey === void 0 || h.altKey === i, g = h.shiftKey === void 0 || h.shiftKey === s, m = h.metaKey === void 0 || h.metaKey === r;
2358
+ if (c && d && g && m)
2359
+ return h;
2077
2360
  }
2078
2361
  return null;
2079
2362
  }
@@ -2083,7 +2366,7 @@ class ei {
2083
2366
  }
2084
2367
  getDefaultKeymap() {
2085
2368
  const e = {};
2086
- return this.addBinding(e, "f", { ctrlKey: !this.isMac, metaKey: this.isMac }, "find"), this.addBinding(e, "h", { ctrlKey: !this.isMac, metaKey: this.isMac }, "replace"), this.addBinding(e, "f3", {}, "findNext"), this.addBinding(e, "f3", { shiftKey: !0 }, "findPrev"), this.addBinding(e, "g", { ctrlKey: !this.isMac, metaKey: this.isMac }, "findNext"), this.addBinding(e, "[", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "fold"), this.addBinding(e, "]", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "unfold"), this.addBinding(e, "s", { ctrlKey: !0 }, "save"), this.addBinding(e, "s", { metaKey: !0 }, "save"), this.addBinding(e, "z", { ctrlKey: !0 }, "undo"), this.addBinding(e, "z", { metaKey: !0 }, "undo"), this.addBinding(e, "y", { ctrlKey: !0 }, "redo"), this.addBinding(e, "y", { metaKey: !0 }, "redo"), this.addBinding(e, "z", { ctrlKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "z", { metaKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "tab", { shiftKey: !0 }, "outdent"), this.addBinding(e, "tab", { shiftKey: !1, ctrlKey: !1, altKey: !1, metaKey: !1 }, "insertTab"), this.addBinding(e, "t", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "toggleTheme"), this.addBinding(e, "f", { altKey: !0, shiftKey: !0 }, "formatDocument"), e;
2369
+ return this.addBinding(e, "f", { ctrlKey: !this.isMac, metaKey: this.isMac }, "find"), this.addBinding(e, "h", { ctrlKey: !this.isMac, metaKey: this.isMac }, "replace"), this.addBinding(e, "f3", {}, "findNext"), this.addBinding(e, "f3", { shiftKey: !0 }, "findPrev"), this.addBinding(e, "g", { ctrlKey: !this.isMac, metaKey: this.isMac }, "findNext"), this.addBinding(e, "[", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "fold"), this.addBinding(e, "]", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "unfold"), this.addBinding(e, "s", { ctrlKey: !0 }, "save"), this.addBinding(e, "s", { metaKey: !0 }, "save"), this.addBinding(e, "z", { ctrlKey: !0, shiftKey: !1 }, "undo"), this.addBinding(e, "z", { metaKey: !0, shiftKey: !1 }, "undo"), this.addBinding(e, "y", { ctrlKey: !0 }, "redo"), this.addBinding(e, "y", { metaKey: !0 }, "redo"), this.addBinding(e, "z", { ctrlKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "z", { metaKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "tab", { shiftKey: !0 }, "outdent"), this.addBinding(e, "tab", { shiftKey: !1, ctrlKey: !1, altKey: !1, metaKey: !1 }, "insertTab"), this.addBinding(e, "t", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "toggleTheme"), this.addBinding(e, "f", { altKey: !0, shiftKey: !0 }, "formatDocument"), e;
2087
2370
  }
2088
2371
  addBinding(e, t, n, i) {
2089
2372
  const s = t.toLowerCase();
@@ -2128,7 +2411,7 @@ class ei {
2128
2411
  this.keymap = {}, this.editor = null;
2129
2412
  }
2130
2413
  }
2131
- const $e = class $e {
2414
+ const ze = class ze {
2132
2415
  constructor() {
2133
2416
  this.name = "transaction", this.transactions = [];
2134
2417
  }
@@ -2140,9 +2423,9 @@ const $e = class $e {
2140
2423
  effects: [],
2141
2424
  annotations: []
2142
2425
  };
2143
- this.transactions.push(n), this.transactions.length > $e.MAX_TRANSACTIONS && this.transactions.splice(
2426
+ this.transactions.push(n), this.transactions.length > ze.MAX_TRANSACTIONS && this.transactions.splice(
2144
2427
  0,
2145
- this.transactions.length - $e.MAX_TRANSACTIONS
2428
+ this.transactions.length - ze.MAX_TRANSACTIONS
2146
2429
  );
2147
2430
  });
2148
2431
  }
@@ -2153,9 +2436,9 @@ const $e = class $e {
2153
2436
  this.transactions = [];
2154
2437
  }
2155
2438
  };
2156
- $e.MAX_TRANSACTIONS = 200;
2157
- let Mt = $e;
2158
- class ti {
2439
+ ze.MAX_TRANSACTIONS = 200;
2440
+ let At = ze;
2441
+ class Ci {
2159
2442
  constructor() {
2160
2443
  this.name = "line-numbers", this.editor = null, this.lineNumbersElement = null, this.isEnabled = !0;
2161
2444
  }
@@ -2184,7 +2467,7 @@ class ti {
2184
2467
  this.lineNumbersElement = null, this.editor = null;
2185
2468
  }
2186
2469
  }
2187
- class ni {
2470
+ class Mi {
2188
2471
  constructor() {
2189
2472
  this.name = "theme", this.editor = null, this.currentTheme = "dark";
2190
2473
  }
@@ -2209,7 +2492,7 @@ class ni {
2209
2492
  this.editor = null;
2210
2493
  }
2211
2494
  }
2212
- class ii {
2495
+ class Ri {
2213
2496
  constructor() {
2214
2497
  this.name = "read-only", this.editor = null, this.isReadOnly = !1;
2215
2498
  }
@@ -2236,14 +2519,14 @@ class ii {
2236
2519
  this.editor = null;
2237
2520
  }
2238
2521
  }
2239
- let si = 0;
2522
+ let Ai = 0;
2240
2523
  const C = class C {
2241
2524
  constructor(e = {}) {
2242
2525
  this.name = "search", this.editor = null, this.searchUI = null, this.isVisible = !1, this.currentResults = [], this.currentIndex = -1, this.searchDebounceTimer = null, this.liveRefreshTimer = null, this.statusResetTimer = null, this.statusFreezeUntil = 0, this.findInput = null, this.replaceInputEl = null, this.statusDiv = null, this.modeDiv = null, this.caseSensitiveInput = null, this.wholeWordInput = null, this.regexInput = null, this.currentQuery = "", this.savedCursor = null, this.editorChangeHandler = null, this.searchOptions = {
2243
2526
  caseSensitive: !1,
2244
2527
  wholeWord: !1,
2245
2528
  regex: !1
2246
- }, this.trailingMarkerAttr = "data-lce-trailing-newline-marker", this.editorContainerSelector = '[data-lce-editor-container="true"]', this.highlightId = ++si, this.highlightMatchName = `editora-search-match-${this.highlightId}`, this.highlightActiveName = `editora-search-active-${this.highlightId}`, this.highlightStyleId = `editora-search-highlight-style-${this.highlightId}`, this.maxCustomHighlightRanges = 2e3, this.virtualMarkerRegex = /[\u200B\uE000]/, this.hasCustomHighlightSupport = !1, this.config = {
2529
+ }, this.trailingMarkerAttr = "data-lce-trailing-newline-marker", this.editorContainerSelector = '[data-lce-editor-container="true"]', this.highlightId = ++Ai, this.highlightMatchName = `editora-search-match-${this.highlightId}`, this.highlightActiveName = `editora-search-active-${this.highlightId}`, this.highlightStyleId = `editora-search-highlight-style-${this.highlightId}`, this.maxCustomHighlightRanges = 2e3, this.virtualMarkerRegex = /[\u200B\uE000]/, this.hasCustomHighlightSupport = !1, this.config = {
2247
2530
  replaceAndFindNext: !0,
2248
2531
  ...e
2249
2532
  };
@@ -2311,38 +2594,38 @@ const C = class C {
2311
2594
  `.${C.css.replaceInput}`
2312
2595
  ), o = this.searchUI.querySelector(
2313
2596
  `.${C.css.prevButton}`
2314
- ), l = this.searchUI.querySelector(
2597
+ ), a = this.searchUI.querySelector(
2315
2598
  `.${C.css.nextButton}`
2316
- ), c = this.searchUI.querySelector(
2317
- `.${C.css.closeButton}`
2318
2599
  ), h = this.searchUI.querySelector(
2600
+ `.${C.css.closeButton}`
2601
+ ), c = this.searchUI.querySelector(
2319
2602
  `.${C.css.status}`
2320
2603
  ), d = this.searchUI.querySelector(
2321
2604
  `.${C.css.mode}`
2322
- ), f = this.searchUI.querySelector(
2605
+ ), g = this.searchUI.querySelector(
2323
2606
  `.${C.css.caseSensitive}`
2324
- ), y = this.searchUI.querySelector(
2607
+ ), m = this.searchUI.querySelector(
2325
2608
  `.${C.css.wholeWord}`
2326
- ), g = this.searchUI.querySelector(
2609
+ ), p = this.searchUI.querySelector(
2327
2610
  `.${C.css.regex}`
2328
2611
  );
2329
- this.findInput = s, this.replaceInputEl = r, this.statusDiv = h, this.modeDiv = d, this.caseSensitiveInput = f, this.wholeWordInput = y, this.regexInput = g, f.checked = !!this.searchOptions.caseSensitive, y.checked = !!this.searchOptions.wholeWord, g.checked = !!this.searchOptions.regex, s.addEventListener("input", () => {
2612
+ this.findInput = s, this.replaceInputEl = r, this.statusDiv = c, this.modeDiv = d, this.caseSensitiveInput = g, this.wholeWordInput = m, this.regexInput = p, g.checked = !!this.searchOptions.caseSensitive, m.checked = !!this.searchOptions.wholeWord, p.checked = !!this.searchOptions.regex, s.addEventListener("input", () => {
2330
2613
  this.searchDebounceTimer && clearTimeout(this.searchDebounceTimer);
2331
2614
  const b = s.value;
2332
2615
  this.searchDebounceTimer = setTimeout(() => {
2333
2616
  this.performSearch(b, !1, !1);
2334
2617
  }, 120);
2335
2618
  });
2336
- const p = () => {
2337
- this.searchOptions.caseSensitive = f.checked, this.searchOptions.wholeWord = y.checked, this.searchOptions.regex = g.checked;
2619
+ const y = () => {
2620
+ this.searchOptions.caseSensitive = g.checked, this.searchOptions.wholeWord = m.checked, this.searchOptions.regex = p.checked;
2338
2621
  const b = s.value;
2339
2622
  b.trim() ? this.performSearch(b, !1, !1) : this.performSearch("", !1, !1);
2340
2623
  };
2341
- f.addEventListener("change", p), y.addEventListener("change", p), g.addEventListener("change", p), s.addEventListener("keydown", (b) => {
2624
+ g.addEventListener("change", y), m.addEventListener("change", y), p.addEventListener("change", y), s.addEventListener("keydown", (b) => {
2342
2625
  b.key === "Enter" ? (b.preventDefault(), b.shiftKey ? this.findPrev() : this.findNext()) : b.key === "Escape" && (b.preventDefault(), this.hideSearch());
2343
2626
  }), r.addEventListener("keydown", (b) => {
2344
2627
  b.key === "Enter" ? (b.preventDefault(), b.shiftKey ? this.replaceAll(s.value, r.value) : this.replaceCurrent(s.value, r.value)) : b.key === "Escape" && (b.preventDefault(), this.hideSearch());
2345
- }), o.addEventListener("click", () => this.findPrev()), l.addEventListener("click", () => this.findNext()), c.addEventListener("click", () => this.hideSearch()), i.appendChild(this.searchUI);
2628
+ }), o.addEventListener("click", () => this.findPrev()), a.addEventListener("click", () => this.findNext()), h.addEventListener("click", () => this.hideSearch()), i.appendChild(this.searchUI);
2346
2629
  }
2347
2630
  updateModeHint(e) {
2348
2631
  this.modeDiv && (this.modeDiv.textContent = e ? `Replace: move next ${this.config.replaceAndFindNext ? "ON" : "OFF"}` : "Find mode");
@@ -2434,31 +2717,31 @@ const C = class C {
2434
2717
  if (!this.editor) return;
2435
2718
  const n = this.editor.getView().getContentElement(), i = this.editor.getValue(), { lineStarts: s, lines: r } = this.buildLineStarts(i), o = this.buildTextNodeIndex(n);
2436
2719
  if (o.length === 0) return;
2437
- const l = this.toDomRange(e, s, r, o);
2438
- if (!l) return;
2439
- const c = l.startContainer.nodeType === Node.TEXT_NODE ? l.startContainer.parentElement : l.startContainer, h = this.resolveScrollContainer(n);
2440
- if (h) {
2441
- const d = l.getClientRects()[0] || l.getBoundingClientRect(), f = h.getBoundingClientRect(), g = h.scrollTop + (d.top - f.top) - f.height / 2 + d.height / 2, p = 18;
2442
- let b = t ? g : h.scrollTop, w = h.scrollLeft;
2443
- const E = h.scrollLeft + (d.left - f.left), F = E + d.width;
2444
- d.right > f.right - p ? w = F - f.width + p : d.left < f.left + p && (w = Math.max(0, E - p));
2445
- const A = Math.max(0, h.scrollHeight - h.clientHeight), I = Math.max(0, h.scrollWidth - h.clientWidth);
2446
- if (b = Math.min(A, Math.max(0, b)), w = Math.min(I, Math.max(0, w)), A === 0 && I === 0) {
2447
- c == null || c.scrollIntoView({
2720
+ const a = this.toDomRange(e, s, r, o);
2721
+ if (!a) return;
2722
+ const h = a.startContainer.nodeType === Node.TEXT_NODE ? a.startContainer.parentElement : a.startContainer, c = this.resolveScrollContainer(n);
2723
+ if (c) {
2724
+ const d = a.getClientRects()[0] || a.getBoundingClientRect(), g = c.getBoundingClientRect(), p = c.scrollTop + (d.top - g.top) - g.height / 2 + d.height / 2, y = 18;
2725
+ let b = t ? p : c.scrollTop, w = c.scrollLeft;
2726
+ const E = c.scrollLeft + (d.left - g.left), D = E + d.width;
2727
+ d.right > g.right - y ? w = D - g.width + y : d.left < g.left + y && (w = Math.max(0, E - y));
2728
+ const M = Math.max(0, c.scrollHeight - c.clientHeight), k = Math.max(0, c.scrollWidth - c.clientWidth);
2729
+ if (b = Math.min(M, Math.max(0, b)), w = Math.min(k, Math.max(0, w)), M === 0 && k === 0) {
2730
+ h == null || h.scrollIntoView({
2448
2731
  block: t ? "center" : "nearest",
2449
2732
  inline: "nearest",
2450
2733
  behavior: "smooth"
2451
2734
  });
2452
2735
  return;
2453
2736
  }
2454
- (b !== h.scrollTop || w !== h.scrollLeft) && h.scrollTo({
2737
+ (b !== c.scrollTop || w !== c.scrollLeft) && c.scrollTo({
2455
2738
  top: b,
2456
2739
  left: w,
2457
2740
  behavior: "smooth"
2458
2741
  });
2459
2742
  return;
2460
2743
  }
2461
- c == null || c.scrollIntoView({
2744
+ h == null || h.scrollIntoView({
2462
2745
  block: t ? "center" : "nearest",
2463
2746
  inline: "nearest",
2464
2747
  behavior: "smooth"
@@ -2483,9 +2766,9 @@ const C = class C {
2483
2766
  if (!n || n.rangeCount === 0) return;
2484
2767
  const i = n.getRangeAt(0).cloneRange(), s = i.getClientRects()[0] || i.getBoundingClientRect();
2485
2768
  if (!s) return;
2486
- const r = t.getBoundingClientRect(), l = t.scrollTop + (s.top - r.top) - r.height / 2 + s.height / 2, c = Math.max(0, t.scrollHeight - t.clientHeight), h = Math.min(c, Math.max(0, l));
2487
- h !== t.scrollTop && t.scrollTo({
2488
- top: h,
2769
+ const r = t.getBoundingClientRect(), a = t.scrollTop + (s.top - r.top) - r.height / 2 + s.height / 2, h = Math.max(0, t.scrollHeight - t.clientHeight), c = Math.min(h, Math.max(0, a));
2770
+ c !== t.scrollTop && t.scrollTo({
2771
+ top: c,
2489
2772
  behavior: "smooth"
2490
2773
  });
2491
2774
  }
@@ -2518,20 +2801,20 @@ const C = class C {
2518
2801
  return e.line !== t.line ? e.line - t.line : e.column - t.column;
2519
2802
  }
2520
2803
  clampRangeToDocument(e) {
2521
- var c, h;
2804
+ var h, c;
2522
2805
  const t = this.editor;
2523
2806
  if (!t) return e;
2524
2807
  const n = t.getValue().split(`
2525
2808
  `), i = Math.max(0, n.length - 1), s = Math.max(0, Math.min(e.start.line, i)), r = Math.max(0, Math.min(e.end.line, i)), o = Math.max(
2526
2809
  0,
2527
- Math.min(e.start.column, ((c = n[s]) == null ? void 0 : c.length) || 0)
2528
- ), l = Math.max(
2810
+ Math.min(e.start.column, ((h = n[s]) == null ? void 0 : h.length) || 0)
2811
+ ), a = Math.max(
2529
2812
  0,
2530
- Math.min(e.end.column, ((h = n[r]) == null ? void 0 : h.length) || 0)
2813
+ Math.min(e.end.column, ((c = n[r]) == null ? void 0 : c.length) || 0)
2531
2814
  );
2532
2815
  return {
2533
2816
  start: { line: s, column: o },
2534
- end: { line: r, column: l }
2817
+ end: { line: r, column: a }
2535
2818
  };
2536
2819
  }
2537
2820
  focusWithoutScrolling(e) {
@@ -2551,8 +2834,8 @@ const C = class C {
2551
2834
  const s = window.scrollX, r = window.scrollY;
2552
2835
  e.focus();
2553
2836
  for (let o = 0; o < n.length; o++) {
2554
- const l = n[o];
2555
- l.el.scrollTop = l.top, l.el.scrollLeft = l.left;
2837
+ const a = n[o];
2838
+ a.el.scrollTop = a.top, a.el.scrollLeft = a.left;
2556
2839
  }
2557
2840
  window.scrollTo(s, r);
2558
2841
  }
@@ -2587,25 +2870,25 @@ const C = class C {
2587
2870
  const e = this.editor.getView().getContentElement(), t = this.editor.getValue(), { lineStarts: n, lines: i } = this.buildLineStarts(t), s = this.buildTextNodeIndex(e);
2588
2871
  if (s.length === 0) return;
2589
2872
  const r = this.buildVisibleDocumentText(s), o = [];
2590
- let l = null;
2591
- const c = Math.min(this.currentResults.length, this.maxCustomHighlightRanges);
2592
- for (let h = 0; h < c; h++) {
2593
- const d = this.currentResults[h], f = this.searchOptions.regex ? d.match || this.currentQuery : this.currentQuery || d.match, y = this.toDomRange(
2873
+ let a = null;
2874
+ const h = Math.min(this.currentResults.length, this.maxCustomHighlightRanges);
2875
+ for (let c = 0; c < h; c++) {
2876
+ const d = this.currentResults[c], g = this.searchOptions.regex ? d.match || this.currentQuery : this.currentQuery || d.match, m = this.toDomRange(
2594
2877
  d.range,
2595
2878
  n,
2596
2879
  i,
2597
2880
  s,
2598
2881
  r,
2599
- f
2882
+ g
2600
2883
  );
2601
- y && (o.push(y), h === this.currentIndex && (l = y));
2884
+ m && (o.push(m), c === this.currentIndex && (a = m));
2602
2885
  }
2603
2886
  if (o.length !== 0)
2604
2887
  try {
2605
- const h = CSS, d = window.Highlight;
2606
- if (!h.highlights || !d) return;
2607
- h.highlights.set(this.highlightMatchName, new d(...o)), l && h.highlights.set(this.highlightActiveName, new d(l));
2608
- } catch (h) {
2888
+ const c = CSS, d = window.Highlight;
2889
+ if (!c.highlights || !d) return;
2890
+ c.highlights.set(this.highlightMatchName, new d(...o)), a && c.highlights.set(this.highlightActiveName, new d(a));
2891
+ } catch (c) {
2609
2892
  }
2610
2893
  }
2611
2894
  buildLineStarts(e) {
@@ -2628,55 +2911,55 @@ const C = class C {
2628
2911
  const r = s, o = r.parentElement;
2629
2912
  if (o != null && o.hasAttribute(this.trailingMarkerAttr))
2630
2913
  continue;
2631
- const l = r.textContent || "", c = this.buildVisibleToDomMap(l), h = Math.max(0, c.length - 1);
2632
- h === 0 && l.length === 0 || (n.push({
2914
+ const a = r.textContent || "", h = this.buildVisibleToDomMap(a), c = Math.max(0, h.length - 1);
2915
+ c === 0 && a.length === 0 || (n.push({
2633
2916
  node: r,
2634
2917
  start: i,
2635
- end: i + h,
2636
- visibleToDom: c
2637
- }), i += h);
2918
+ end: i + c,
2919
+ visibleToDom: h
2920
+ }), i += c);
2638
2921
  }
2639
2922
  return n;
2640
2923
  }
2641
2924
  resolveDomPoint(e, t) {
2642
- var s, r, o, l, c, h;
2925
+ var s, r, o, a, h, c;
2643
2926
  const n = Math.max(0, e);
2644
2927
  for (let d = 0; d < t.length; d++) {
2645
- const f = t[d];
2646
- if (n <= f.end) {
2647
- const y = Math.max(0, n - f.start), g = (o = (r = f.visibleToDom[y]) != null ? r : (s = f.node.textContent) == null ? void 0 : s.length) != null ? o : 0;
2928
+ const g = t[d];
2929
+ if (n <= g.end) {
2930
+ const m = Math.max(0, n - g.start), p = (o = (r = g.visibleToDom[m]) != null ? r : (s = g.node.textContent) == null ? void 0 : s.length) != null ? o : 0;
2648
2931
  return {
2649
- node: f.node,
2650
- offset: g
2932
+ node: g.node,
2933
+ offset: p
2651
2934
  };
2652
2935
  }
2653
2936
  }
2654
2937
  const i = t[t.length - 1];
2655
2938
  return i ? {
2656
2939
  node: i.node,
2657
- offset: (h = (c = i.visibleToDom[i.visibleToDom.length - 1]) != null ? c : (l = i.node.textContent) == null ? void 0 : l.length) != null ? h : 0
2940
+ offset: (c = (h = i.visibleToDom[i.visibleToDom.length - 1]) != null ? h : (a = i.node.textContent) == null ? void 0 : a.length) != null ? c : 0
2658
2941
  } : null;
2659
2942
  }
2660
2943
  toDomRange(e, t, n, i, s, r) {
2661
- const o = this.positionToOffset(e.start, t, n), l = this.positionToOffset(e.end, t, n);
2662
- let c = Math.min(o, l), h = Math.max(o, l);
2944
+ const o = this.positionToOffset(e.start, t, n), a = this.positionToOffset(e.end, t, n);
2945
+ let h = Math.min(o, a), c = Math.max(o, a);
2663
2946
  if (s && r) {
2664
- const g = r, p = s.slice(c, h);
2665
- if (p.length === g.length && p.toLowerCase() !== g.toLowerCase()) {
2947
+ const p = r, y = s.slice(h, c);
2948
+ if (y.length === p.length && y.toLowerCase() !== p.toLowerCase()) {
2666
2949
  const b = this.findNearestMatchOffset(
2667
2950
  s,
2668
- g,
2669
- c
2951
+ p,
2952
+ h
2670
2953
  );
2671
- b !== -1 && (c = b, h = b + g.length);
2954
+ b !== -1 && (h = b, c = b + p.length);
2672
2955
  }
2673
2956
  }
2674
- const d = this.resolveDomPoint(c, i), f = this.resolveDomPoint(h, i);
2675
- if (!d || !f) return null;
2676
- const y = document.createRange();
2957
+ const d = this.resolveDomPoint(h, i), g = this.resolveDomPoint(c, i);
2958
+ if (!d || !g) return null;
2959
+ const m = document.createRange();
2677
2960
  try {
2678
- return y.setStart(d.node, d.offset), y.setEnd(f.node, f.offset), y;
2679
- } catch (g) {
2961
+ return m.setStart(d.node, d.offset), m.setEnd(g.node, g.offset), m;
2962
+ } catch (p) {
2680
2963
  return null;
2681
2964
  }
2682
2965
  }
@@ -2697,8 +2980,8 @@ const C = class C {
2697
2980
  if (s === -1) return -1;
2698
2981
  let r = s, o = Math.abs(s - n);
2699
2982
  for (; s !== -1; ) {
2700
- const l = Math.abs(s - n);
2701
- if (l < o && (o = l, r = s), l === 0) return s;
2983
+ const a = Math.abs(s - n);
2984
+ if (a < o && (o = a, r = s), a === 0) return s;
2702
2985
  s = e.toLowerCase().indexOf(i, s + 1);
2703
2986
  }
2704
2987
  return r;
@@ -2810,8 +3093,8 @@ C.css = {
2810
3093
  mode: "search-mode",
2811
3094
  modeLayout: "lce-search-mode"
2812
3095
  };
2813
- let Rt = C, ri = 0;
2814
- class oi {
3096
+ let Lt = C, Li = 0;
3097
+ class ki {
2815
3098
  constructor() {
2816
3099
  this.name = "bracket-matching", this.editor = null, this.bracketPairs = {
2817
3100
  "(": ")",
@@ -2823,7 +3106,7 @@ class oi {
2823
3106
  "]": "[",
2824
3107
  "}": "{",
2825
3108
  ">": "<"
2826
- }, this.highlightId = ++ri, this.highlightName = `editora-bracket-match-${this.highlightId}`, this.highlightStyleId = `editora-bracket-match-style-${this.highlightId}`, this.currentMatch = null, this.hasCustomHighlightSupport = !1, this.observer = null, this.pendingUpdateRaf = null, this.updateRequestVersion = 0, this.cursorHandler = null, this.changeHandler = null;
3109
+ }, this.highlightId = ++Li, this.highlightName = `editora-bracket-match-${this.highlightId}`, this.highlightStyleId = `editora-bracket-match-style-${this.highlightId}`, this.currentMatch = null, this.hasCustomHighlightSupport = !1, this.observer = null, this.pendingUpdateRaf = null, this.updateRequestVersion = 0, this.cursorHandler = null, this.changeHandler = null;
2827
3110
  }
2828
3111
  setup(e) {
2829
3112
  this.editor = e, this.hasCustomHighlightSupport = this.detectCustomHighlightSupport(), this.hasCustomHighlightSupport && (this.ensureHighlightStyles(), this.observeContentMutations()), this.cursorHandler = () => {
@@ -2885,15 +3168,15 @@ class oi {
2885
3168
  const s = this.bracketPairs[i];
2886
3169
  let r = 0;
2887
3170
  for (let o = t; o < e.length; o++) {
2888
- const l = e[o], c = o === t ? n : 0;
2889
- for (let h = c; h < l.length; h++) {
2890
- const d = l[h];
3171
+ const a = e[o], h = o === t ? n : 0;
3172
+ for (let c = h; c < a.length; c++) {
3173
+ const d = a[c];
2891
3174
  if (d === i)
2892
3175
  r++;
2893
3176
  else if (d === s && (r--, r === 0))
2894
3177
  return {
2895
3178
  open: { start: { line: t, column: n }, end: { line: t, column: n + 1 } },
2896
- close: { start: { line: o, column: h }, end: { line: o, column: h + 1 } },
3179
+ close: { start: { line: o, column: c }, end: { line: o, column: c + 1 } },
2897
3180
  type: i
2898
3181
  };
2899
3182
  }
@@ -2904,14 +3187,14 @@ class oi {
2904
3187
  const s = this.reverseBracketPairs[i];
2905
3188
  let r = 0;
2906
3189
  for (let o = t; o >= 0; o--) {
2907
- const l = e[o], c = o === t ? n : l.length - 1;
2908
- for (let h = c; h >= 0; h--) {
2909
- const d = l[h];
3190
+ const a = e[o], h = o === t ? n : a.length - 1;
3191
+ for (let c = h; c >= 0; c--) {
3192
+ const d = a[c];
2910
3193
  if (d === i)
2911
3194
  r++;
2912
3195
  else if (d === s && (r--, r === 0))
2913
3196
  return {
2914
- open: { start: { line: o, column: h }, end: { line: o, column: h + 1 } },
3197
+ open: { start: { line: o, column: c }, end: { line: o, column: c + 1 } },
2915
3198
  close: { start: { line: t, column: n }, end: { line: t, column: n + 1 } },
2916
3199
  type: s
2917
3200
  };
@@ -2981,7 +3264,7 @@ class oi {
2981
3264
  this.cursorHandler = null, this.changeHandler = null, this.editor = null;
2982
3265
  }
2983
3266
  }
2984
- class ai {
3267
+ class Oi {
2985
3268
  constructor() {
2986
3269
  this.name = "code-folding", this.lineHeight = 24, this.voidMarkupTags = /* @__PURE__ */ new Set([
2987
3270
  "area",
@@ -3085,8 +3368,8 @@ class ai {
3085
3368
  for (const r of this.foldRegions) {
3086
3369
  const o = this.toDisplayLine(r, i);
3087
3370
  if (o === null) continue;
3088
- const l = this.isFoldActive(r), c = this.createFoldIndicator(r, o, l);
3089
- s.appendChild(c);
3371
+ const a = this.isFoldActive(r), h = this.createFoldIndicator(r, o, a);
3372
+ s.appendChild(h);
3090
3373
  }
3091
3374
  this.foldingUI.appendChild(s);
3092
3375
  }
@@ -3106,35 +3389,35 @@ class ai {
3106
3389
  "]": "[",
3107
3390
  ")": "("
3108
3391
  };
3109
- for (let l = 0; l < t.length; l++) {
3110
- const c = t[l];
3111
- for (let h = 0; h < c.length; h++) {
3112
- const d = c[h];
3392
+ for (let a = 0; a < t.length; a++) {
3393
+ const h = t[a];
3394
+ for (let c = 0; c < h.length; c++) {
3395
+ const d = h[c];
3113
3396
  if (s[d]) {
3114
- n.push({ char: d, line: l, column: h });
3397
+ n.push({ char: d, line: a, column: c });
3115
3398
  continue;
3116
3399
  }
3117
- const f = r[d];
3118
- if (!f) continue;
3119
- let y = -1;
3400
+ const g = r[d];
3401
+ if (!g) continue;
3402
+ let m = -1;
3120
3403
  for (let w = n.length - 1; w >= 0; w--)
3121
- if (n[w].char === f) {
3122
- y = w;
3404
+ if (n[w].char === g) {
3405
+ m = w;
3123
3406
  break;
3124
3407
  }
3125
- if (y === -1) continue;
3126
- const g = n.splice(y, 1)[0];
3127
- if (g.line >= l) continue;
3128
- const p = ((o = t[g.line]) == null ? void 0 : o.length) || 0, b = {
3129
- start: { line: g.line, column: p },
3130
- end: { line: l, column: 0 },
3408
+ if (m === -1) continue;
3409
+ const p = n.splice(m, 1)[0];
3410
+ if (p.line >= a) continue;
3411
+ const y = ((o = t[p.line]) == null ? void 0 : o.length) || 0, b = {
3412
+ start: { line: p.line, column: y },
3413
+ end: { line: a, column: 0 },
3131
3414
  collapsed: !1,
3132
- level: y
3415
+ level: m
3133
3416
  };
3134
3417
  this.isValidFoldRegion(b) && i.push(b);
3135
3418
  }
3136
3419
  }
3137
- return i.sort((l, c) => l.start.line !== c.start.line ? l.start.line - c.start.line : l.end.line !== c.end.line ? l.end.line - c.end.line : l.start.column - c.start.column), i;
3420
+ return i.sort((a, h) => a.start.line !== h.start.line ? a.start.line - h.start.line : a.end.line !== h.end.line ? a.end.line - h.end.line : a.start.column - h.start.column), i;
3138
3421
  }
3139
3422
  shouldIncludeMarkupFolds(e) {
3140
3423
  return /<!DOCTYPE\b/i.test(e) || /<[A-Za-z][\w:-]*(?:\s|>)/.test(e) && /<\/[A-Za-z][\w:-]*\s*>/.test(e);
@@ -3148,13 +3431,13 @@ class ai {
3148
3431
  continue;
3149
3432
  }
3150
3433
  if (e.startsWith("<!--", r)) {
3151
- const l = e.indexOf("-->", r + 4);
3152
- r = l === -1 ? e.length : l + 3;
3434
+ const a = e.indexOf("-->", r + 4);
3435
+ r = a === -1 ? e.length : a + 3;
3153
3436
  continue;
3154
3437
  }
3155
3438
  if (e.startsWith("<![CDATA[", r)) {
3156
- const l = e.indexOf("]]>", r + 9);
3157
- r = l === -1 ? e.length : l + 3;
3439
+ const a = e.indexOf("]]>", r + 9);
3440
+ r = a === -1 ? e.length : a + 3;
3158
3441
  continue;
3159
3442
  }
3160
3443
  const o = this.parseMarkupTag(e, r, t, n);
@@ -3163,33 +3446,33 @@ class ai {
3163
3446
  continue;
3164
3447
  }
3165
3448
  if (r = o.endOffset, o.isClosing) {
3166
- const l = s.findIndex((d) => d.name === o.name);
3167
- if (l === -1)
3449
+ const a = s.findIndex((d) => d.name === o.name);
3450
+ if (a === -1)
3168
3451
  continue;
3169
- const c = s.splice(l, 1)[0], h = this.createMarkupFoldRegion(
3170
- c.openEndLine,
3452
+ const h = s.splice(a, 1)[0], c = this.createMarkupFoldRegion(
3453
+ h.openEndLine,
3171
3454
  o.startLine,
3172
3455
  n
3173
3456
  );
3174
- h && i.push(h);
3457
+ c && i.push(c);
3175
3458
  continue;
3176
3459
  }
3177
3460
  if (!(o.isSelfClosing || this.voidMarkupTags.has(o.name))) {
3178
3461
  if (this.rawTextMarkupTags.has(o.name)) {
3179
- const l = this.findClosingMarkupTag(
3462
+ const a = this.findClosingMarkupTag(
3180
3463
  e,
3181
3464
  o.endOffset,
3182
3465
  o.name,
3183
3466
  t,
3184
3467
  n
3185
3468
  );
3186
- if (l) {
3187
- const c = this.createMarkupFoldRegion(
3469
+ if (a) {
3470
+ const h = this.createMarkupFoldRegion(
3188
3471
  o.endLine,
3189
- l.startLine,
3472
+ a.startLine,
3190
3473
  n
3191
3474
  );
3192
- c && i.push(c), r = l.endOffset;
3475
+ h && i.push(h), r = a.endOffset;
3193
3476
  }
3194
3477
  continue;
3195
3478
  }
@@ -3209,53 +3492,53 @@ class ai {
3209
3492
  return null;
3210
3493
  const r = s === "/";
3211
3494
  let o = t + (r ? 2 : 1);
3212
- const l = o;
3495
+ const a = o;
3213
3496
  for (; o < e.length && /[A-Za-z0-9:-]/.test(e[o]); )
3214
3497
  o += 1;
3215
- const c = o;
3216
- if (o === l)
3498
+ const h = o;
3499
+ if (o === a)
3217
3500
  return null;
3218
- let h = null;
3501
+ let c = null;
3219
3502
  for (; o < e.length; ) {
3220
- const p = e[o];
3221
- if (h) {
3222
- p === h && (h = null), o += 1;
3503
+ const y = e[o];
3504
+ if (c) {
3505
+ y === c && (c = null), o += 1;
3223
3506
  continue;
3224
3507
  }
3225
- if (p === '"' || p === "'") {
3226
- h = p, o += 1;
3508
+ if (y === '"' || y === "'") {
3509
+ c = y, o += 1;
3227
3510
  continue;
3228
3511
  }
3229
- if (p === ">")
3512
+ if (y === ">")
3230
3513
  break;
3231
3514
  o += 1;
3232
3515
  }
3233
3516
  if (o >= e.length || e[o] !== ">")
3234
3517
  return null;
3235
- const d = e.slice(l, c).toLowerCase();
3518
+ const d = e.slice(a, h).toLowerCase();
3236
3519
  if (!d)
3237
3520
  return null;
3238
- const f = e.slice(t, o + 1), y = this.offsetToLine(t, n, i), g = this.offsetToLine(o, n, i);
3521
+ const g = e.slice(t, o + 1), m = this.offsetToLine(t, n, i), p = this.offsetToLine(o, n, i);
3239
3522
  return {
3240
3523
  name: d,
3241
3524
  isClosing: r,
3242
- isSelfClosing: !r && /\/\s*>$/.test(f),
3243
- startLine: y,
3244
- endLine: g,
3525
+ isSelfClosing: !r && /\/\s*>$/.test(g),
3526
+ startLine: m,
3527
+ endLine: p,
3245
3528
  endOffset: o + 1
3246
3529
  };
3247
3530
  }
3248
3531
  findClosingMarkupTag(e, t, n, i, s) {
3249
3532
  const r = `</${n}`, o = e.toLowerCase();
3250
- let l = o.indexOf(r, t);
3251
- for (; l !== -1; ) {
3252
- const c = this.parseMarkupTag(e, l, i, s);
3253
- if (c && c.isClosing && c.name === n)
3533
+ let a = o.indexOf(r, t);
3534
+ for (; a !== -1; ) {
3535
+ const h = this.parseMarkupTag(e, a, i, s);
3536
+ if (h && h.isClosing && h.name === n)
3254
3537
  return {
3255
- startLine: c.startLine,
3256
- endOffset: c.endOffset
3538
+ startLine: h.startLine,
3539
+ endOffset: h.endOffset
3257
3540
  };
3258
- l = o.indexOf(r, l + r.length);
3541
+ a = o.indexOf(r, a + r.length);
3259
3542
  }
3260
3543
  return null;
3261
3544
  }
@@ -3382,21 +3665,21 @@ class ai {
3382
3665
  this.editor.getView().setText(e);
3383
3666
  }
3384
3667
  buildFoldedProjection(e, t) {
3385
- const { lineStarts: n, lines: i } = this.buildLineStarts(e), s = [...t].sort((h, d) => this.comparePositions(h.start, d.start));
3668
+ const { lineStarts: n, lines: i } = this.buildLineStarts(e), s = [...t].sort((c, d) => this.comparePositions(c.start, d.start));
3386
3669
  let r = "";
3387
3670
  const o = [];
3388
- let l = 0;
3389
- for (const h of s) {
3390
- const d = this.positionToOffset(h.start, n, i), f = this.positionToOffset(h.end, n, i), y = e.slice(l, d), g = this.getFoldPlaceholder(h), p = e.slice(d, f);
3391
- r += y, r += g, y && o.push({ type: "text", text: y }), o.push({
3671
+ let a = 0;
3672
+ for (const c of s) {
3673
+ const d = this.positionToOffset(c.start, n, i), g = this.positionToOffset(c.end, n, i), m = e.slice(a, d), p = this.getFoldPlaceholder(c), y = e.slice(d, g);
3674
+ r += m, r += p, m && o.push({ type: "text", text: m }), o.push({
3392
3675
  type: "placeholder",
3393
- text: g,
3394
- fold: h,
3395
- hiddenText: p
3396
- }), l = f;
3676
+ text: p,
3677
+ fold: c,
3678
+ hiddenText: y
3679
+ }), a = g;
3397
3680
  }
3398
- const c = e.slice(l);
3399
- return r += c, c && o.push({ type: "text", text: c }), { text: r, segments: o };
3681
+ const h = e.slice(a);
3682
+ return r += h, h && o.push({ type: "text", text: h }), { text: r, segments: o };
3400
3683
  }
3401
3684
  renderFoldPlaceholders(e) {
3402
3685
  if (!this.editor) return;
@@ -3422,25 +3705,25 @@ class ai {
3422
3705
  }
3423
3706
  pruneInvalidFolds(e, t) {
3424
3707
  if (!this.editor) return;
3425
- const n = this.editor.getFolds().filter((c) => c.collapsed !== !1), i = new Set(n.map((c) => this.getFoldKey(c))), s = [], r = /* @__PURE__ */ new Set(), o = this.getLineInfo(e);
3426
- for (const c of n) {
3427
- const h = this.findReplacementFold(
3428
- c,
3429
- t.get(this.getFoldKey(c)),
3708
+ const n = this.editor.getFolds().filter((h) => h.collapsed !== !1), i = new Set(n.map((h) => this.getFoldKey(h))), s = [], r = /* @__PURE__ */ new Set(), o = this.getLineInfo(e);
3709
+ for (const h of n) {
3710
+ const c = this.findReplacementFold(
3711
+ h,
3712
+ t.get(this.getFoldKey(h)),
3430
3713
  r,
3431
3714
  e,
3432
3715
  o
3433
3716
  );
3434
- if (!h)
3717
+ if (!c)
3435
3718
  continue;
3436
- const d = this.getFoldKey(h);
3437
- s.push(h), r.add(d);
3719
+ const d = this.getFoldKey(c);
3720
+ s.push(c), r.add(d);
3438
3721
  }
3439
- const l = new Set(s.map((c) => this.getFoldKey(c)));
3440
- for (const c of n)
3441
- l.has(this.getFoldKey(c)) || this.editor.unfold(c);
3442
- for (const c of s)
3443
- i.has(this.getFoldKey(c)) || this.editor.fold(c);
3722
+ const a = new Set(s.map((h) => this.getFoldKey(h)));
3723
+ for (const h of n)
3724
+ a.has(this.getFoldKey(h)) || this.editor.unfold(h);
3725
+ for (const h of s)
3726
+ i.has(this.getFoldKey(h)) || this.editor.fold(h);
3444
3727
  }
3445
3728
  getActiveFolds() {
3446
3729
  return this.editor ? this.editor.getFolds().filter((e) => e.collapsed !== !1) : [];
@@ -3475,34 +3758,34 @@ class ai {
3475
3758
  (s) => s.start.line <= e && s.end.line >= e
3476
3759
  );
3477
3760
  return i.length === 0 ? null : (i.sort((s, r) => {
3478
- const o = s.end.line - s.start.line, l = r.end.line - r.start.line;
3479
- return o !== l ? o - l : this.comparePositions(s.start, r.start);
3761
+ const o = s.end.line - s.start.line, a = r.end.line - r.start.line;
3762
+ return o !== a ? o - a : this.comparePositions(s.start, r.start);
3480
3763
  }), i[0]);
3481
3764
  }
3482
3765
  findReplacementFold(e, t, n, i, s) {
3483
3766
  const r = this.getFoldKey(e), o = this.foldRegions.find(
3484
- (g) => this.getFoldKey(g) === r && !n.has(r)
3767
+ (p) => this.getFoldKey(p) === r && !n.has(r)
3485
3768
  );
3486
3769
  if (o)
3487
3770
  return o;
3488
- const l = e.end.line - e.start.line, c = t != null ? t : this.createFoldSnapshot(e, i, s), d = this.foldRegions.filter((g) => !n.has(this.getFoldKey(g))).map((g) => {
3489
- const p = this.createFoldSnapshot(g, i, s), b = c && (p == null ? void 0 : p.startLineText) === c.startLineText ? 1 : 0, w = c && (p == null ? void 0 : p.endLineText) === c.endLineText ? 1 : 0, E = c && (p == null ? void 0 : p.lineSpan) === c.lineSpan ? 1 : 0;
3771
+ const a = e.end.line - e.start.line, h = t != null ? t : this.createFoldSnapshot(e, i, s), d = this.foldRegions.filter((p) => !n.has(this.getFoldKey(p))).map((p) => {
3772
+ const y = this.createFoldSnapshot(p, i, s), b = h && (y == null ? void 0 : y.startLineText) === h.startLineText ? 1 : 0, w = h && (y == null ? void 0 : y.endLineText) === h.endLineText ? 1 : 0, E = h && (y == null ? void 0 : y.lineSpan) === h.lineSpan ? 1 : 0;
3490
3773
  return {
3491
- region: g,
3492
- overlaps: this.lineRangeOverlap(e, g),
3493
- lineDistance: Math.abs(g.start.line - e.start.line) + Math.abs(g.end.line - e.end.line),
3774
+ region: p,
3775
+ overlaps: this.lineRangeOverlap(e, p),
3776
+ lineDistance: Math.abs(p.start.line - e.start.line) + Math.abs(p.end.line - e.end.line),
3494
3777
  spanDistance: Math.abs(
3495
- g.end.line - g.start.line - l
3778
+ p.end.line - p.start.line - a
3496
3779
  ),
3497
- columnDistance: Math.abs(g.start.column - e.start.column) + Math.abs(g.end.column - e.end.column),
3498
- hiddenTextMatch: c && (p == null ? void 0 : p.hiddenText) === c.hiddenText ? 1 : 0,
3780
+ columnDistance: Math.abs(p.start.column - e.start.column) + Math.abs(p.end.column - e.end.column),
3781
+ hiddenTextMatch: h && (y == null ? void 0 : y.hiddenText) === h.hiddenText ? 1 : 0,
3499
3782
  boundaryMatchScore: b + w + E
3500
3783
  };
3501
- }).sort((g, p) => g.hiddenTextMatch !== p.hiddenTextMatch ? p.hiddenTextMatch - g.hiddenTextMatch : g.boundaryMatchScore !== p.boundaryMatchScore ? p.boundaryMatchScore - g.boundaryMatchScore : g.overlaps !== p.overlaps ? p.overlaps - g.overlaps : g.lineDistance !== p.lineDistance ? g.lineDistance - p.lineDistance : g.spanDistance !== p.spanDistance ? g.spanDistance - p.spanDistance : g.columnDistance - p.columnDistance)[0];
3784
+ }).sort((p, y) => p.hiddenTextMatch !== y.hiddenTextMatch ? y.hiddenTextMatch - p.hiddenTextMatch : p.boundaryMatchScore !== y.boundaryMatchScore ? y.boundaryMatchScore - p.boundaryMatchScore : p.overlaps !== y.overlaps ? y.overlaps - p.overlaps : p.lineDistance !== y.lineDistance ? p.lineDistance - y.lineDistance : p.spanDistance !== y.spanDistance ? p.spanDistance - y.spanDistance : p.columnDistance - y.columnDistance)[0];
3502
3785
  if (!d)
3503
3786
  return null;
3504
- const f = d.lineDistance <= 2 && d.spanDistance <= 1;
3505
- return !(d.hiddenTextMatch === 1 || d.boundaryMatchScore >= 2) && !f ? null : d.region;
3787
+ const g = d.lineDistance <= 2 && d.spanDistance <= 1;
3788
+ return !(d.hiddenTextMatch === 1 || d.boundaryMatchScore >= 2) && !g ? null : d.region;
3506
3789
  }
3507
3790
  lineRangeOverlap(e, t) {
3508
3791
  const n = Math.max(e.start.line, t.start.line), i = Math.min(e.end.line, t.end.line);
@@ -3517,20 +3800,20 @@ class ai {
3517
3800
  this.foldSnapshots = t;
3518
3801
  }
3519
3802
  createFoldSnapshot(e, t, n = this.getLineInfo(t)) {
3520
- var h, d;
3803
+ var c, d;
3521
3804
  const { lineStarts: i, lines: s } = n;
3522
3805
  if (s.length === 0)
3523
3806
  return null;
3524
- const r = this.positionToOffset(e.start, i, s), o = this.positionToOffset(e.end, i, s), l = Math.max(0, Math.min(e.start.line, s.length - 1)), c = Math.max(0, Math.min(e.end.line, s.length - 1));
3807
+ const r = this.positionToOffset(e.start, i, s), o = this.positionToOffset(e.end, i, s), a = Math.max(0, Math.min(e.start.line, s.length - 1)), h = Math.max(0, Math.min(e.end.line, s.length - 1));
3525
3808
  return {
3526
3809
  hiddenText: t.slice(r, o),
3527
- startLineText: (h = s[l]) != null ? h : "",
3528
- endLineText: (d = s[c]) != null ? d : "",
3810
+ startLineText: (c = s[a]) != null ? c : "",
3811
+ endLineText: (d = s[h]) != null ? d : "",
3529
3812
  lineSpan: e.end.line - e.start.line
3530
3813
  };
3531
3814
  }
3532
3815
  withPreservedSelection(e) {
3533
- var l, c;
3816
+ var a, h;
3534
3817
  if (!this.editor) {
3535
3818
  e();
3536
3819
  return;
@@ -3539,8 +3822,8 @@ class ai {
3539
3822
  if (e(), !r)
3540
3823
  return;
3541
3824
  const o = this.remapSelectionOffsetsForVisibleDisplay(
3542
- (l = s.anchorOffset) != null ? l : s.startOffset,
3543
- (c = s.focusOffset) != null ? c : s.endOffset
3825
+ (a = s.anchorOffset) != null ? a : s.startOffset,
3826
+ (h = s.focusOffset) != null ? h : s.endOffset
3544
3827
  );
3545
3828
  t.setSelectionBoundaryOffsets(
3546
3829
  o.startOffset,
@@ -3578,11 +3861,11 @@ class ai {
3578
3861
  remapOffsetToVisibleBoundary(e, t, n, i, s) {
3579
3862
  const r = Math.max(0, Math.min(e, s));
3580
3863
  for (const o of t) {
3581
- const l = this.positionToOffset(o.start, n, i), c = this.positionToOffset(o.end, n, i);
3582
- if (r <= l || r >= c)
3864
+ const a = this.positionToOffset(o.start, n, i), h = this.positionToOffset(o.end, n, i);
3865
+ if (r <= a || r >= h)
3583
3866
  continue;
3584
- const h = r - l, d = c - r;
3585
- return h <= d ? l : c;
3867
+ const c = r - a, d = h - r;
3868
+ return c <= d ? a : h;
3586
3869
  }
3587
3870
  return r;
3588
3871
  }
@@ -3605,20 +3888,20 @@ class ai {
3605
3888
  return this.cachedLineInfo = t, t;
3606
3889
  }
3607
3890
  offsetToLine(e, t, n) {
3608
- var l;
3609
- const i = t.length > 0 ? t[t.length - 1] + (((l = n[n.length - 1]) == null ? void 0 : l.length) || 0) : 0, s = Math.max(0, Math.min(e, i));
3891
+ var a;
3892
+ const i = t.length > 0 ? t[t.length - 1] + (((a = n[n.length - 1]) == null ? void 0 : a.length) || 0) : 0, s = Math.max(0, Math.min(e, i));
3610
3893
  let r = 0, o = t.length - 1;
3611
3894
  for (; r <= o; ) {
3612
- const c = Math.floor((r + o) / 2), h = t[c], d = c + 1 < t.length ? t[c + 1] : Number.POSITIVE_INFINITY;
3613
- if (s < h) {
3614
- o = c - 1;
3895
+ const h = Math.floor((r + o) / 2), c = t[h], d = h + 1 < t.length ? t[h + 1] : Number.POSITIVE_INFINITY;
3896
+ if (s < c) {
3897
+ o = h - 1;
3615
3898
  continue;
3616
3899
  }
3617
3900
  if (s >= d) {
3618
- r = c + 1;
3901
+ r = h + 1;
3619
3902
  continue;
3620
3903
  }
3621
- return c;
3904
+ return h;
3622
3905
  }
3623
3906
  return Math.max(0, Math.min(r, t.length - 1));
3624
3907
  }
@@ -3649,7 +3932,7 @@ class ai {
3649
3932
  this.pendingUpdateRaf !== null && (cancelAnimationFrame(this.pendingUpdateRaf), this.pendingUpdateRaf = null), this.editor && this.changeHandler && this.editor.off("change", this.changeHandler), this.foldingUI && this.foldingUI.parentNode && this.foldingUI.parentNode.removeChild(this.foldingUI), this.restoreFullDisplay(), this.changeHandler = null, this.lastSnapshot = "", this.lastParsedText = null, this.foldingUI = null, this.foldRegions = [], this.cachedLineInfo = null, this.editor = null;
3650
3933
  }
3651
3934
  }
3652
- class li {
3935
+ class Ii {
3653
3936
  constructor() {
3654
3937
  this.name = "syntax-highlighting", this.editor = null, this.currentTheme = "dark", this.currentLanguage = null, this.modes = /* @__PURE__ */ new Map();
3655
3938
  }
@@ -3807,7 +4090,7 @@ class li {
3807
4090
  if (/^[\[{]/.test(t) && /[\]}]$/.test(t) || /"[^"]+"\s*:/.test(t))
3808
4091
  try {
3809
4092
  return JSON.parse(t), "json";
3810
- } catch (c) {
4093
+ } catch (h) {
3811
4094
  }
3812
4095
  const n = /<\/?[A-Za-z][\w:-]*(?:\s|>|\/>)/.test(t), i = /^<!DOCTYPE\s+html\b/i.test(t) || /<\/?(html|head|body|meta|title|style|script)\b/i.test(t);
3813
4096
  if ([
@@ -3829,8 +4112,8 @@ class li {
3829
4112
  const o = this.detectProgrammingLanguage(t);
3830
4113
  if (o)
3831
4114
  return o;
3832
- const l = /[{][\s\S]*[}]/.test(t) && /[A-Za-z_-][\w-]*\s*:\s*[^;{}]+;?/.test(t) && !/\b(function|const|let|var|return|class|interface|type)\b/.test(t);
3833
- return !n && l ? "css" : null;
4115
+ const a = /[{][\s\S]*[}]/.test(t) && /[A-Za-z_-][\w-]*\s*:\s*[^;{}]+;?/.test(t) && !/\b(function|const|let|var|return|class|interface|type)\b/.test(t);
4116
+ return !n && a ? "css" : null;
3834
4117
  }
3835
4118
  detectProgrammingLanguage(e) {
3836
4119
  const t = {
@@ -3846,160 +4129,160 @@ class li {
3846
4129
  sql: 0,
3847
4130
  yaml: 0,
3848
4131
  dockerfile: 0
3849
- }, n = (r, o, l = 1) => {
3850
- o.test(e) && (t[r] += l);
4132
+ }, n = (r, o, a = 1) => {
4133
+ o.test(e) && (t[r] += a);
3851
4134
  };
3852
4135
  n("python", /^\s*(from\s+\w+\s+import|import\s+\w+|def\s+\w+\s*\(|class\s+\w+|for\s+\w+\s+in\s+.+:|if\s+.+:|while\s+.+:|print\s*\()/m, 2), n("python", /^\s*[A-Za-z_]\w*\s*=\s*(?:\[|\{|\(|["']|\d)/m), n("python", /\b(True|False|None|self|elif|lambda|yield)\b/), n("go", /^\s*package\s+\w+/m, 3), n("go", /\bfunc\s+\w+\s*\(/, 2), n("go", /\b(import|defer|goroutine|chan|struct|interface)\b/), n("cpp", /^\s*#include\s*<[^>]+>/m, 2), n("cpp", /\b(std::|template\s*<|namespace\s+\w+|cout\s*<<|cin\s*>>)\b/, 2), n("cpp", /\b(class|public|private|protected|virtual|typename)\b/), n("c", /^\s*#include\s*[<"][^>"]+[>"]/m), n("c", /\b(int|char|float|double|void)\s+\w+\s*\(/), n("c", /\bprintf\s*\(/), n("java", /^\s*(package|import)\s+[\w.]+;/m, 2), n("java", /\b(public|private|protected)\s+(class|interface|enum)\s+\w+/, 2), n("java", /\bSystem\.out\.println\s*\(/), n("csharp", /^\s*using\s+[\w.]+;/m, 2), n("csharp", /\b(namespace|record|var|string|Console\.WriteLine)\b/), n("csharp", /\b(public|private|protected)\s+(class|interface|struct)\s+\w+/), n("rust", /\bfn\s+\w+\s*\(/, 2), n("rust", /\b(let\s+mut|impl\s+\w+|use\s+[\w:]+|println!\s*\()/), n("rust", /\b(crate|trait|enum|match|Some|None|Ok|Err)\b/), n("ruby", /^\s*(def|class|module)\s+\w+/m, 2), n("ruby", /\b(puts|require|attr_reader|elsif|end)\b/), n("sql", /^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|ALTER|DROP)\b/im, 3), n("sql", /\bFROM\s+\w+|\bWHERE\s+/i), n("yaml", /^---\s*$/m), n("yaml", /^\s*[A-Za-z0-9_.-]+\s*:\s+\S/m, 2), n("yaml", /^\s*-\s+[A-Za-z0-9_.-]+\s*:/m), n("dockerfile", /^\s*FROM\s+\S+/im, 3), n("dockerfile", /^\s*(RUN|COPY|ADD|CMD|ENTRYPOINT|WORKDIR|ENV|ARG)\b/im, 2), n("php", /^<\?(?:php\b|=)/i, 3), n("php", /^\?php\b/i, 3), n("php", /\$[A-Za-z_\x80-\xff][A-Za-z0-9_\x80-\xff]*\s*=/, 2), n("php", /\b(echo|foreach|function|namespace|use|PHP_EOL)\b/, 2);
3853
4136
  const [i, s] = Object.entries(t).sort((r, o) => o[1] - r[1])[0] || ["", 0];
3854
4137
  return s >= 2 ? i : null;
3855
4138
  }
3856
4139
  _highlightHTML(e, t) {
3857
- const n = t, i = (f) => this.escapeHTML(f), s = [], r = this.createTokenStore(s), o = [], l = (f) => {
3858
- const y = o.length;
3859
- return o.push(f), `ht${y}`;
4140
+ const n = t, i = (g) => this.escapeHTML(g), s = [], r = this.createTokenStore(s), o = [], a = (g) => {
4141
+ const m = o.length;
4142
+ return o.push(g), `ht${m}`;
3860
4143
  };
3861
- let c = i(e);
3862
- c = c.replace(
4144
+ let h = i(e);
4145
+ h = h.replace(
3863
4146
  /&lt;\/?(?:(?!&gt;)[^\n\r<])*?(?=$|[\n\r])/g,
3864
- (f) => l(f)
4147
+ (g) => a(g)
3865
4148
  );
3866
- const h = [];
4149
+ const c = [];
3867
4150
  try {
3868
- e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi, (f, y, g) => (h.push({ attrs: String(y || ""), inner: String(g || "") }), f));
3869
- } catch (f) {
4151
+ e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi, (g, m, p) => (c.push({ attrs: String(m || ""), inner: String(p || "") }), g));
4152
+ } catch (g) {
3870
4153
  }
3871
4154
  let d = 0;
3872
- return c = c.replace(/(&lt;script\b([^&>]*)&gt;)([\s\S]*?)(&lt;\/script&gt;)/gi, (f, y, g, p, b) => {
3873
- var F, A, I;
3874
- const w = (A = (F = h[d++]) == null ? void 0 : F.inner) != null ? A : this.unescapeEntitiesRepeated(p || "");
3875
- (((I = h[d - 1]) == null ? void 0 : I.attrs) || g || "").toLowerCase();
4155
+ return h = h.replace(/(&lt;script\b([^&>]*)&gt;)([\s\S]*?)(&lt;\/script&gt;)/gi, (g, m, p, y, b) => {
4156
+ var D, M, k;
4157
+ const w = (M = (D = c[d++]) == null ? void 0 : D.inner) != null ? M : this.unescapeEntitiesRepeated(y || "");
4158
+ (((k = c[d - 1]) == null ? void 0 : k.attrs) || p || "").toLowerCase();
3876
4159
  const E = this._highlightJS(w, n);
3877
- return `${y}${E}${b}`;
3878
- }), c = c.replace(/(&lt;style\b[^&]*&gt;)([\s\S]*?)(&lt;\/style&gt;)/gi, (f, y, g, p) => {
3879
- const b = this._highlightCSS(this.unescapeEntitiesRepeated(g), n);
3880
- return `${y}${b}${p}`;
3881
- }), c = c.replace(
4160
+ return `${m}${E}${b}`;
4161
+ }), h = h.replace(/(&lt;style\b[^&]*&gt;)([\s\S]*?)(&lt;\/style&gt;)/gi, (g, m, p, y) => {
4162
+ const b = this._highlightCSS(this.unescapeEntitiesRepeated(p), n);
4163
+ return `${m}${b}${y}`;
4164
+ }), h = h.replace(
3882
4165
  /(&lt;!--[\s\S]*?--&gt;)/g,
3883
- (f) => r(`<span style="color: ${n.comment};">${f}</span>`)
3884
- ), c = c.replace(
4166
+ (g) => r(`<span style="color: ${n.comment};">${g}</span>`)
4167
+ ), h = h.replace(
3885
4168
  /(&lt;!DOCTYPE[\s\S]*?&gt;)/i,
3886
- (f) => r(`<span style="color: ${n.doctype};">${f}</span>`)
3887
- ), c = c.replace(/(&lt;\/?\s*)([^\s&>\/]+)([^<]*?)(\/?&gt;)/g, (f, y, g, p, b) => {
3888
- const w = `<span style="color: ${n.tag};">${g}</span>`;
3889
- let E = p;
4169
+ (g) => r(`<span style="color: ${n.doctype};">${g}</span>`)
4170
+ ), h = h.replace(/(&lt;\/?\s*)([^\s&>\/]+)([^<]*?)(\/?&gt;)/g, (g, m, p, y, b) => {
4171
+ const w = `<span style="color: ${n.tag};">${p}</span>`;
4172
+ let E = y;
3890
4173
  return E = E.replace(
3891
4174
  /([\w:-]+)(\s*=\s*)((&quot;[\s\S]*?&quot;|&#39;[\s\S]*?&#39;|[^\s&>]+))/g,
3892
- (F, A, I, $) => {
3893
- const Y = String(A).toLowerCase(), ie = `<span style="color: ${n.attrName};">${A}</span>`;
3894
- let _ = $, U = "";
3895
- $.startsWith("&quot;") && $.endsWith("&quot;") ? (_ = $.slice(6, -6), U = "&quot;") : $.startsWith("&#39;") && $.endsWith("&#39;") && (_ = $.slice(5, -5), U = "&#39;");
3896
- let j = $;
4175
+ (D, M, k, H) => {
4176
+ const Y = String(M).toLowerCase(), ie = `<span style="color: ${n.attrName};">${M}</span>`;
4177
+ let F = H, U = "";
4178
+ H.startsWith("&quot;") && H.endsWith("&quot;") ? (F = H.slice(6, -6), U = "&quot;") : H.startsWith("&#39;") && H.endsWith("&#39;") && (F = H.slice(5, -5), U = "&#39;");
4179
+ let j = H;
3897
4180
  if (Y === "style") {
3898
- const ce = _.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, (se, Z, ne, le) => `<span style="color: ${n.styleProp};">${Z}</span>:<span style="color: ${n.styleVal};">${ne}</span>${le}`);
4181
+ const ce = F.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, (se, Z, ne, le) => `<span style="color: ${n.styleProp};">${Z}</span>:<span style="color: ${n.styleVal};">${ne}</span>${le}`);
3899
4182
  U ? j = `${U}${ce}${U}` : j = ce, j = `<span style="color: ${n.attrValue};">${j}</span>`;
3900
4183
  } else
3901
- U && (j = `${U}${_}${U}`), j = `<span style="color: ${n.attrValue};">${j}</span>`;
3902
- return `${ie}${I}${j}`;
4184
+ U && (j = `${U}${F}${U}`), j = `<span style="color: ${n.attrValue};">${j}</span>`;
4185
+ return `${ie}${k}${j}`;
3903
4186
  }
3904
- ), `${y}${w}${E}${b}`;
3905
- }), c = c.replace(/\u0002ht(\d+)\u0002/g, (f, y) => o[Number(y)] || ""), this.restoreHighlightTokens(c, s);
4187
+ ), `${m}${w}${E}${b}`;
4188
+ }), h = h.replace(/\u0002ht(\d+)\u0002/g, (g, m) => o[Number(m)] || ""), this.restoreHighlightTokens(h, s);
3906
4189
  }
3907
4190
  _highlightCSS(e, t) {
3908
4191
  const n = this.unescapeEntitiesRepeated(e), i = [], s = this.createTokenStore(i), r = /(\/\*[\s\S]*?\*\/)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
3909
- let o = 0, l = "", c;
3910
- for (; c = r.exec(n); ) {
3911
- o < c.index && (l += this.escapeHTML(n.slice(o, c.index)));
3912
- const h = c[0], d = h.startsWith("/*") ? t.comment : t.string;
3913
- l += s(`<span style="color: ${d};">${this.escapeHTML(h)}</span>`), o = r.lastIndex;
4192
+ let o = 0, a = "", h;
4193
+ for (; h = r.exec(n); ) {
4194
+ o < h.index && (a += this.escapeHTML(n.slice(o, h.index)));
4195
+ const c = h[0], d = c.startsWith("/*") ? t.comment : t.string;
4196
+ a += s(`<span style="color: ${d};">${this.escapeHTML(c)}</span>`), o = r.lastIndex;
3914
4197
  }
3915
- return o < n.length && (l += this.escapeHTML(n.slice(o))), l = l.replace(
4198
+ return o < n.length && (a += this.escapeHTML(n.slice(o))), a = a.replace(
3916
4199
  /(@[\w-]+)/g,
3917
- (h) => s(`<span style="color: ${t.keyword};">${h}</span>`)
3918
- ), l = l.replace(
4200
+ (c) => s(`<span style="color: ${t.keyword};">${c}</span>`)
4201
+ ), a = a.replace(
3919
4202
  /([A-Za-z_-][\w-]*)(\s*:)/g,
3920
- (h, d, f) => `${s(`<span style="color: ${t.styleProp};">${d}</span>`)}${f}`
3921
- ), l = l.replace(
4203
+ (c, d, g) => `${s(`<span style="color: ${t.styleProp};">${d}</span>`)}${g}`
4204
+ ), a = a.replace(
3922
4205
  /(#(?:[0-9a-fA-F]{3,8})\b)/g,
3923
- (h) => s(`<span style="color: ${t.number};">${h}</span>`)
3924
- ), l = l.replace(
4206
+ (c) => s(`<span style="color: ${t.number};">${c}</span>`)
4207
+ ), a = a.replace(
3925
4208
  /\b(-?\d*\.?\d+(?:px|em|rem|vh|vw|vmin|vmax|%|s|ms|deg|turn|fr)?)\b/g,
3926
- (h) => s(`<span style="color: ${t.number};">${h}</span>`)
3927
- ), l = l.replace(
4209
+ (c) => s(`<span style="color: ${t.number};">${c}</span>`)
4210
+ ), a = a.replace(
3928
4211
  /\b(important|inherit|initial|unset|revert|auto|none|block|inline|flex|grid|absolute|relative|fixed|sticky)\b/g,
3929
- (h) => s(`<span style="color: ${t.styleVal};">${h}</span>`)
3930
- ), this.restoreHighlightTokens(l, i);
4212
+ (c) => s(`<span style="color: ${t.styleVal};">${c}</span>`)
4213
+ ), this.restoreHighlightTokens(a, i);
3931
4214
  }
3932
4215
  _highlightJSON(e, t) {
3933
4216
  const n = this.unescapeEntitiesRepeated(e), i = /("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}\[\],:]/g;
3934
4217
  let s = 0, r = "", o;
3935
4218
  for (; o = i.exec(n); ) {
3936
4219
  s < o.index && (r += this.escapeHTML(n.slice(s, o.index)));
3937
- const l = o[0], c = o[1], h = o[2] || "", d = o[3];
3938
- if (c) {
3939
- const f = h ? t.attrName : t.string;
3940
- r += `<span style="color: ${f};">${this.escapeHTML(c)}</span>${this.escapeHTML(h)}`;
3941
- } else d ? r += `<span style="color: ${t.keyword};">${l}</span>` : /^-?\d/.test(l) ? r += `<span style="color: ${t.number};">${l}</span>` : r += `<span style="color: ${t.tag};">${this.escapeHTML(l)}</span>`;
4220
+ const a = o[0], h = o[1], c = o[2] || "", d = o[3];
4221
+ if (h) {
4222
+ const g = c ? t.attrName : t.string;
4223
+ r += `<span style="color: ${g};">${this.escapeHTML(h)}</span>${this.escapeHTML(c)}`;
4224
+ } else d ? r += `<span style="color: ${t.keyword};">${a}</span>` : /^-?\d/.test(a) ? r += `<span style="color: ${t.number};">${a}</span>` : r += `<span style="color: ${t.tag};">${this.escapeHTML(a)}</span>`;
3942
4225
  s = i.lastIndex;
3943
4226
  }
3944
4227
  return s < n.length && (r += this.escapeHTML(n.slice(s))), r;
3945
4228
  }
3946
4229
  _highlightMarkdown(e, t) {
3947
- var c;
4230
+ var h;
3948
4231
  const i = this.unescapeEntitiesRepeated(e).split(`
3949
4232
  `);
3950
- let s = !1, r = "", o = "", l = ((c = i[0]) == null ? void 0 : c.trim()) === "---";
3951
- return i.map((h, d) => {
3952
- const f = [], y = this.createTokenStore(f);
3953
- if (l) {
3954
- const b = h.trim() === "---", E = `<span style="color: ${b ? t.keyword : t.attrName};">${this.escapeHTML(h)}</span>`;
3955
- return d > 0 && b && (l = !1), E;
4233
+ let s = !1, r = "", o = "", a = ((h = i[0]) == null ? void 0 : h.trim()) === "---";
4234
+ return i.map((c, d) => {
4235
+ const g = [], m = this.createTokenStore(g);
4236
+ if (a) {
4237
+ const b = c.trim() === "---", E = `<span style="color: ${b ? t.keyword : t.attrName};">${this.escapeHTML(c)}</span>`;
4238
+ return d > 0 && b && (a = !1), E;
3956
4239
  }
3957
- const g = h.match(/^(\s*)(`{3,}|~{3,})(.*)$/);
3958
- if (g) {
3959
- const b = g[2];
3960
- return s = !(s && b[0] === r[0]), r = s ? b : "", o = s ? this.extractMarkdownFenceLanguage(g[3] || "") : "", [
3961
- this.escapeHTML(g[1]),
4240
+ const p = c.match(/^(\s*)(`{3,}|~{3,})(.*)$/);
4241
+ if (p) {
4242
+ const b = p[2];
4243
+ return s = !(s && b[0] === r[0]), r = s ? b : "", o = s ? this.extractMarkdownFenceLanguage(p[3] || "") : "", [
4244
+ this.escapeHTML(p[1]),
3962
4245
  `<span style="color: ${t.keyword}; font-weight: 700;">${this.escapeHTML(b)}</span>`,
3963
- `<span style="color: ${t.string};">${this.escapeHTML(g[3] || "")}</span>`
4246
+ `<span style="color: ${t.string};">${this.escapeHTML(p[3] || "")}</span>`
3964
4247
  ].join("");
3965
4248
  }
3966
4249
  if (s)
3967
- return this.highlightMarkdownFenceLine(h, o, t);
3968
- let p = this.escapeHTML(h).replace(
4250
+ return this.highlightMarkdownFenceLine(c, o, t);
4251
+ let y = this.escapeHTML(c).replace(
3969
4252
  /(`[^`]+`)/g,
3970
- (b) => y(`<span style="color: ${t.string}; background: rgba(148, 163, 184, 0.16); border-radius: 3px;">${b}</span>`)
4253
+ (b) => m(`<span style="color: ${t.string}; background: rgba(148, 163, 184, 0.16); border-radius: 3px;">${b}</span>`)
3971
4254
  ).replace(
3972
4255
  /(!?\[[^\]\n]*\])(\([^)]+\))/g,
3973
- (b, w, E) => y(`<span style="color: ${t.attrName};">${w}</span><span style="color: ${t.attrValue};">${E}</span>`)
4256
+ (b, w, E) => m(`<span style="color: ${t.attrName};">${w}</span><span style="color: ${t.attrValue};">${E}</span>`)
3974
4257
  ).replace(
3975
4258
  /(\*\*|__)(.+?)\1/g,
3976
- (b, w, E) => y(`<span style="color: ${t.keyword};">${w}</span><span style="color: ${t.tag}; font-weight: 700;">${E}</span><span style="color: ${t.keyword};">${w}</span>`)
4259
+ (b, w, E) => m(`<span style="color: ${t.keyword};">${w}</span><span style="color: ${t.tag}; font-weight: 700;">${E}</span><span style="color: ${t.keyword};">${w}</span>`)
3977
4260
  ).replace(
3978
4261
  /(~~)(.+?)\1/g,
3979
- (b, w, E) => y(`<span style="color: ${t.keyword};">${w}</span><span style="color: ${t.comment}; text-decoration: line-through;">${E}</span><span style="color: ${t.keyword};">${w}</span>`)
4262
+ (b, w, E) => m(`<span style="color: ${t.keyword};">${w}</span><span style="color: ${t.comment}; text-decoration: line-through;">${E}</span><span style="color: ${t.keyword};">${w}</span>`)
3980
4263
  ).replace(
3981
4264
  /(\*|_)([^*_]+?)\1/g,
3982
- (b, w, E) => y(`<span style="color: ${t.keyword};">${w}</span><span style="color: ${t.styleVal}; font-style: italic;">${E}</span><span style="color: ${t.keyword};">${w}</span>`)
4265
+ (b, w, E) => m(`<span style="color: ${t.keyword};">${w}</span><span style="color: ${t.styleVal}; font-style: italic;">${E}</span><span style="color: ${t.keyword};">${w}</span>`)
3983
4266
  );
3984
- return p = p.replace(
4267
+ return y = y.replace(
3985
4268
  /^(\s{0,3}#{1,6})(\s+.*)?$/,
3986
4269
  (b, w, E = "") => `<span style="color: ${t.keyword}; font-weight: 700;">${w}</span><span style="color: ${t.tag}; font-weight: 700;">${E}</span>`
3987
- ), p = p.replace(
4270
+ ), y = y.replace(
3988
4271
  /^(\s{0,3})((?:-\s*){3,}|(?:\*\s*){3,}|(?:_\s*){3,})$/,
3989
4272
  (b, w, E) => `${w}<span style="color: ${t.comment};">${E}</span>`
3990
- ), p = p.replace(
4273
+ ), y = y.replace(
3991
4274
  /^(\s{0,3}&gt;)(.*)$/,
3992
4275
  (b, w, E) => `<span style="color: ${t.comment};">${w}</span>${E}`
3993
- ), p = p.replace(
4276
+ ), y = y.replace(
3994
4277
  /^(\s*)([-*+])(\s+\[[ xX]\])(\s+)/,
3995
- (b, w, E, F, A) => `${w}<span style="color: ${t.keyword};">${E}</span><span style="color: ${t.attrName};">${F}</span>${A}`
3996
- ), p = p.replace(
4278
+ (b, w, E, D, M) => `${w}<span style="color: ${t.keyword};">${E}</span><span style="color: ${t.attrName};">${D}</span>${M}`
4279
+ ), y = y.replace(
3997
4280
  /^(\s*)([-*+]|\d+\.)(\s+)/,
3998
- (b, w, E, F) => `${w}<span style="color: ${t.keyword};">${E}</span>${F}`
3999
- ), p = p.replace(
4281
+ (b, w, E, D) => `${w}<span style="color: ${t.keyword};">${E}</span>${D}`
4282
+ ), y = y.replace(
4000
4283
  /^(\s*\|.*\|\s*)$/,
4001
4284
  (b) => b.replace(/\|/g, (w) => `<span style="color: ${t.keyword};">${w}</span>`)
4002
- ), this.restoreHighlightTokens(p, f);
4285
+ ), this.restoreHighlightTokens(y, g);
4003
4286
  }).join(`
4004
4287
  `);
4005
4288
  }
@@ -4014,22 +4297,22 @@ class li {
4014
4297
  }
4015
4298
  _highlightShell(e, t) {
4016
4299
  const n = this.unescapeEntitiesRepeated(e), i = [], s = this.createTokenStore(i), r = /(#[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|(\$\{?[A-Za-z_][\w]*\}?|\$[0-9@#?$*!])/g;
4017
- let o = 0, l = "", c;
4018
- for (; c = r.exec(n); ) {
4019
- o < c.index && (l += this.escapeHTML(n.slice(o, c.index)));
4020
- const h = c[0], d = h.startsWith("#") ? t.comment : h.startsWith("$") ? t.variable : t.string;
4021
- l += s(`<span style="color: ${d};">${this.escapeHTML(h)}</span>`), o = r.lastIndex;
4300
+ let o = 0, a = "", h;
4301
+ for (; h = r.exec(n); ) {
4302
+ o < h.index && (a += this.escapeHTML(n.slice(o, h.index)));
4303
+ const c = h[0], d = c.startsWith("#") ? t.comment : c.startsWith("$") ? t.variable : t.string;
4304
+ a += s(`<span style="color: ${d};">${this.escapeHTML(c)}</span>`), o = r.lastIndex;
4022
4305
  }
4023
- return o < n.length && (l += this.escapeHTML(n.slice(o))), l = l.replace(
4306
+ return o < n.length && (a += this.escapeHTML(n.slice(o))), a = a.replace(
4024
4307
  /(^|\s)(--?[A-Za-z0-9][\w-]*)(?=\s|=|$)/g,
4025
- (h, d, f) => `${d}${s(`<span style="color: ${t.attrName};">${f}</span>`)}`
4026
- ), l = l.replace(
4308
+ (c, d, g) => `${d}${s(`<span style="color: ${t.attrName};">${g}</span>`)}`
4309
+ ), a = a.replace(
4027
4310
  /\b(if|then|else|elif|fi|for|while|until|do|done|case|esac|function|export|unset|alias|source|return|in)\b/g,
4028
- (h) => s(`<span style="color: ${t.keyword};">${h}</span>`)
4029
- ), l = l.replace(
4311
+ (c) => s(`<span style="color: ${t.keyword};">${c}</span>`)
4312
+ ), a = a.replace(
4030
4313
  /(^|\s)(npm|npx|pnpm|yarn|bun|node|git|cd|mkdir|touch|cp|mv|rm|cat|grep|rg|find|curl|wget|echo|printf|sudo|chmod|chown|docker|kubectl)(?=\s|$)/g,
4031
- (h, d, f) => `${d}${s(`<span style="color: ${t.tag};">${f}</span>`)}`
4032
- ), this.restoreHighlightTokens(l, i);
4314
+ (c, d, g) => `${d}${s(`<span style="color: ${t.tag};">${g}</span>`)}`
4315
+ ), this.restoreHighlightTokens(a, i);
4033
4316
  }
4034
4317
  getLanguageKeywords(e) {
4035
4318
  const t = ["true", "false", "null", "nil", "none"];
@@ -4046,38 +4329,38 @@ class li {
4046
4329
  }[e] || [], ...t];
4047
4330
  }
4048
4331
  _highlightGenericCode(e, t, n) {
4049
- const i = this.unescapeEntitiesRepeated(e), s = [], r = this.createTokenStore(s), o = n === "python" || n === "ruby" || n === "sql" ? "#[^\\n\\r]*|--[^\\n\\r]*" : "\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\n\\r]*", l = new RegExp(
4332
+ const i = this.unescapeEntitiesRepeated(e), s = [], r = this.createTokenStore(s), o = n === "python" || n === "ruby" || n === "sql" ? "#[^\\n\\r]*|--[^\\n\\r]*" : "\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\n\\r]*", a = new RegExp(
4050
4333
  `(${o})|("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`,
4051
4334
  "g"
4052
4335
  );
4053
- let c = 0, h = "", d;
4054
- for (; d = l.exec(i); ) {
4055
- c < d.index && (h += this.escapeHTML(i.slice(c, d.index)));
4056
- const y = d[0], g = y.startsWith("//") || y.startsWith("/*") || y.startsWith("#") || y.startsWith("--") ? t.comment : t.string;
4057
- h += r(`<span style="color: ${g};">${this.escapeHTML(y)}</span>`), c = l.lastIndex;
4058
- }
4059
- c < i.length && (h += this.escapeHTML(i.slice(c)));
4060
- const f = Array.from(new Set(this.getLanguageKeywords(n)));
4061
- if (f.length > 0) {
4062
- const y = new RegExp(
4063
- `\\b(${f.map((g) => g.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})\\b`,
4336
+ let h = 0, c = "", d;
4337
+ for (; d = a.exec(i); ) {
4338
+ h < d.index && (c += this.escapeHTML(i.slice(h, d.index)));
4339
+ const m = d[0], p = m.startsWith("//") || m.startsWith("/*") || m.startsWith("#") || m.startsWith("--") ? t.comment : t.string;
4340
+ c += r(`<span style="color: ${p};">${this.escapeHTML(m)}</span>`), h = a.lastIndex;
4341
+ }
4342
+ h < i.length && (c += this.escapeHTML(i.slice(h)));
4343
+ const g = Array.from(new Set(this.getLanguageKeywords(n)));
4344
+ if (g.length > 0) {
4345
+ const m = new RegExp(
4346
+ `\\b(${g.map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})\\b`,
4064
4347
  n === "sql" ? "gi" : "g"
4065
4348
  );
4066
- h = h.replace(
4067
- y,
4068
- (g) => r(`<span style="color: ${t.keyword};">${g}</span>`)
4349
+ c = c.replace(
4350
+ m,
4351
+ (p) => r(`<span style="color: ${t.keyword};">${p}</span>`)
4069
4352
  );
4070
4353
  }
4071
- return h = h.replace(
4354
+ return c = c.replace(
4072
4355
  /\b([A-Z][A-Za-z0-9_]*|[A-Za-z_][\w]*(?=\s*\())\b/g,
4073
- (y) => r(`<span style="color: ${t.tag};">${y}</span>`)
4074
- ), h = h.replace(
4356
+ (m) => r(`<span style="color: ${t.tag};">${m}</span>`)
4357
+ ), c = c.replace(
4075
4358
  /\b(-?0x[0-9a-fA-F]+|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)(?:[uUlLfFdD]*)\b/g,
4076
- (y) => r(`<span style="color: ${t.number};">${y}</span>`)
4077
- ), h = h.replace(
4359
+ (m) => r(`<span style="color: ${t.number};">${m}</span>`)
4360
+ ), c = c.replace(
4078
4361
  /(@[A-Za-z_][\w]*|#[A-Za-z_][\w]*|::[A-Za-z_][\w]*)/g,
4079
- (y) => r(`<span style="color: ${t.attrName};">${y}</span>`)
4080
- ), this.restoreHighlightTokens(h, s);
4362
+ (m) => r(`<span style="color: ${t.attrName};">${m}</span>`)
4363
+ ), this.restoreHighlightTokens(c, s);
4081
4364
  }
4082
4365
  _highlightYAML(e, t) {
4083
4366
  const n = this.unescapeEntitiesRepeated(e), i = [], s = this.createTokenStore(i);
@@ -4086,7 +4369,7 @@ class li {
4086
4369
  (o) => s(`<span style="color: ${t.comment};">${o}</span>`)
4087
4370
  ).replace(
4088
4371
  /^(\s*[-?]?\s*)([A-Za-z0-9_.-]+)(\s*:)/gm,
4089
- (o, l, c, h) => `${l}${s(`<span style="color: ${t.attrName};">${c}</span>`)}${h}`
4372
+ (o, a, h, c) => `${a}${s(`<span style="color: ${t.attrName};">${h}</span>`)}${c}`
4090
4373
  ).replace(
4091
4374
  /\b(true|false|null|yes|no|on|off)\b/gi,
4092
4375
  (o) => s(`<span style="color: ${t.keyword};">${o}</span>`)
@@ -4108,12 +4391,12 @@ class li {
4108
4391
  (s) => {
4109
4392
  const r = n.length, o = this.escapeHTML(s).replace(
4110
4393
  /(&lt;\/?)([A-Za-z][\w.:-]*)([\s\S]*?)(\/?&gt;)/,
4111
- (l, c, h, d, f) => {
4112
- const y = String(d || "").replace(
4394
+ (a, h, c, d, g) => {
4395
+ const m = String(d || "").replace(
4113
4396
  /([A-Za-z_:][\w:.-]*)(\s*=\s*)/g,
4114
4397
  `<span style="color: ${t.attrName};">$1</span>$2`
4115
4398
  );
4116
- return `${c}<span style="color: ${t.tag};">${h}</span>${y}${f}`;
4399
+ return `${h}<span style="color: ${t.tag};">${c}</span>${m}${g}`;
4117
4400
  }
4118
4401
  );
4119
4402
  return n.push(o), `jsx${r}`;
@@ -4140,7 +4423,7 @@ class li {
4140
4423
  const s = this.escapeHTML(i);
4141
4424
  return /^\s*#/.test(i) ? `<span style="color: ${t.comment};">${s}</span>` : s.replace(
4142
4425
  /^(\s*)(FROM|RUN|CMD|LABEL|MAINTAINER|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL)(\b)/i,
4143
- (r, o, l, c) => `${o}<span style="color: ${t.keyword};">${l}</span>${c}`
4426
+ (r, o, a, h) => `${o}<span style="color: ${t.keyword};">${a}</span>${h}`
4144
4427
  );
4145
4428
  }).join(`
4146
4429
  `);
@@ -4148,76 +4431,76 @@ class li {
4148
4431
  _highlightJS(e, t) {
4149
4432
  const n = this.unescapeEntitiesRepeated(e);
4150
4433
  this.escapeHTML(n);
4151
- const i = [], s = (y) => {
4152
- let g = "", p = y;
4434
+ const i = [], s = (m) => {
4435
+ let p = "", y = m;
4153
4436
  do
4154
- g = String.fromCharCode(97 + p % 26) + g, p = Math.floor(p / 26) - 1;
4155
- while (p >= 0);
4156
- return g || "a";
4157
- }, r = (y) => `\0${s(y)}\0`, o = (y) => {
4158
- const g = i.length;
4159
- return i.push(y), r(g);
4437
+ p = String.fromCharCode(97 + y % 26) + p, y = Math.floor(y / 26) - 1;
4438
+ while (y >= 0);
4439
+ return p || "a";
4440
+ }, r = (m) => `\0${s(m)}\0`, o = (m) => {
4441
+ const p = i.length;
4442
+ return i.push(m), r(p);
4160
4443
  };
4161
- let l;
4162
- const c = /(\/\*[\s\S]*?\*\/)|(\/\/[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)/g;
4163
- let h = 0, d = "";
4164
- for (; l = c.exec(n); ) {
4165
- const y = l.index;
4166
- h < y && (d += this.escapeHTML(n.slice(h, y)));
4167
- const g = l[0];
4168
- /^\/\*/.test(g) || /^\/\//.test(g) ? d += o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`) : d += o(`<span style="color: ${t.string};">${this.escapeHTML(g)}</span>`), h = c.lastIndex;
4169
- }
4170
- return h < n.length && (d += this.escapeHTML(n.slice(h))), d = d.replace(/\b(0x[0-9a-fA-F]+|\d+\.?\d*|\d*\.\d+)\b/g, (y, g, p) => {
4171
- const b = d[p - 1] || "", w = d[p + y.length] || "";
4172
- return b === "&" || b === "#" || w === ";" || w === "#" ? y : `<span style="color: ${t.number};">${y}</span>`;
4173
- }), d = d.replace(/\b(const|let|var|function|class|if|else|return|for|while|switch|case|break|import|from|export|extends|new|try|catch|finally|throw|await|async|interface|type)\b/g, `<span style="color: ${t.keyword};">$1</span>`), d.replace(/\u0000([a-z]+)\u0000/g, (y, g) => {
4174
- let p = 0;
4175
- for (let b = 0; b < g.length; b++)
4176
- p = p * 26 + (g.charCodeAt(b) - 97 + 1);
4177
- return p = p - 1, i[p] || "";
4444
+ let a;
4445
+ const h = /(\/\*[\s\S]*?\*\/)|(\/\/[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)/g;
4446
+ let c = 0, d = "";
4447
+ for (; a = h.exec(n); ) {
4448
+ const m = a.index;
4449
+ c < m && (d += this.escapeHTML(n.slice(c, m)));
4450
+ const p = a[0];
4451
+ /^\/\*/.test(p) || /^\/\//.test(p) ? d += o(`<span style="color: ${t.comment};">${this.escapeHTML(p)}</span>`) : d += o(`<span style="color: ${t.string};">${this.escapeHTML(p)}</span>`), c = h.lastIndex;
4452
+ }
4453
+ return c < n.length && (d += this.escapeHTML(n.slice(c))), d = d.replace(/\b(0x[0-9a-fA-F]+|\d+\.?\d*|\d*\.\d+)\b/g, (m, p, y) => {
4454
+ const b = d[y - 1] || "", w = d[y + m.length] || "";
4455
+ return b === "&" || b === "#" || w === ";" || w === "#" ? m : `<span style="color: ${t.number};">${m}</span>`;
4456
+ }), d = d.replace(/\b(const|let|var|function|class|if|else|return|for|while|switch|case|break|import|from|export|extends|new|try|catch|finally|throw|await|async|interface|type)\b/g, `<span style="color: ${t.keyword};">$1</span>`), d.replace(/\u0000([a-z]+)\u0000/g, (m, p) => {
4457
+ let y = 0;
4458
+ for (let b = 0; b < p.length; b++)
4459
+ y = y * 26 + (p.charCodeAt(b) - 97 + 1);
4460
+ return y = y - 1, i[y] || "";
4178
4461
  });
4179
4462
  }
4180
4463
  _highlightPHP(e, t) {
4181
4464
  const n = this.unescapeEntitiesRepeated(e);
4182
4465
  let i = this.escapeHTML(n);
4183
- const s = [], r = (g) => {
4184
- let p = "", b = g;
4466
+ const s = [], r = (p) => {
4467
+ let y = "", b = p;
4185
4468
  do
4186
- p = String.fromCharCode(97 + b % 26) + p, b = Math.floor(b / 26) - 1;
4469
+ y = String.fromCharCode(97 + b % 26) + y, b = Math.floor(b / 26) - 1;
4187
4470
  while (b >= 0);
4188
- return p || "a";
4189
- }, o = (g) => {
4190
- const p = s.length;
4191
- return s.push(g), `\0${r(p)}\0`;
4192
- }, l = (g, p) => {
4193
- const b = i.indexOf(g);
4194
- return b === -1 ? !1 : (i = i.slice(0, b) + p + i.slice(b + g.length), !0);
4471
+ return y || "a";
4472
+ }, o = (p) => {
4473
+ const y = s.length;
4474
+ return s.push(p), `\0${r(y)}\0`;
4475
+ }, a = (p, y) => {
4476
+ const b = i.indexOf(p);
4477
+ return b === -1 ? !1 : (i = i.slice(0, b) + y + i.slice(b + p.length), !0);
4195
4478
  };
4196
- let c;
4197
- const h = /\/\*[\s\S]*?\*\//g, d = /\/\/[^\n\r]*/g, f = /\#([^\n\r]*)/g, y = /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
4198
- for (; c = h.exec(n); ) {
4199
- const g = c[0];
4200
- l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
4479
+ let h;
4480
+ const c = /\/\*[\s\S]*?\*\//g, d = /\/\/[^\n\r]*/g, g = /\#([^\n\r]*)/g, m = /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
4481
+ for (; h = c.exec(n); ) {
4482
+ const p = h[0];
4483
+ a(this.escapeHTML(p), o(`<span style="color: ${t.comment};">${this.escapeHTML(p)}</span>`));
4201
4484
  }
4202
- for (; c = d.exec(n); ) {
4203
- const g = c[0];
4204
- l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
4485
+ for (; h = d.exec(n); ) {
4486
+ const p = h[0];
4487
+ a(this.escapeHTML(p), o(`<span style="color: ${t.comment};">${this.escapeHTML(p)}</span>`));
4205
4488
  }
4206
- for (; c = f.exec(n); ) {
4207
- const g = c[0];
4208
- l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
4489
+ for (; h = g.exec(n); ) {
4490
+ const p = h[0];
4491
+ a(this.escapeHTML(p), o(`<span style="color: ${t.comment};">${this.escapeHTML(p)}</span>`));
4209
4492
  }
4210
- for (; c = y.exec(n); ) {
4211
- const g = c[0];
4212
- l(this.escapeHTML(g), o(`<span style="color: ${t.string};">${this.escapeHTML(g)}</span>`));
4493
+ for (; h = m.exec(n); ) {
4494
+ const p = h[0];
4495
+ a(this.escapeHTML(p), o(`<span style="color: ${t.string};">${this.escapeHTML(p)}</span>`));
4213
4496
  }
4214
4497
  return i = i.replace(
4215
4498
  /(&lt;\?(?:php\b|=)?|\?&gt;)/gi,
4216
- (g) => o(`<span style="color: ${t.keyword};">${g}</span>`)
4217
- ), i = i.replace(/(\$[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/g, `<span style="color: ${t.variable};">$1</span>`), i = i.replace(/\b(echo|print|function|class|if|else|elseif|foreach|as|return|namespace|use|new|extends|public|protected|private|static)\b/g, `<span style="color: ${t.keyword};">$1</span>`), i = i.replace(/\u0000([a-z]+)\u0000/g, (g, p) => {
4499
+ (p) => o(`<span style="color: ${t.keyword};">${p}</span>`)
4500
+ ), i = i.replace(/(\$[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/g, `<span style="color: ${t.variable};">$1</span>`), i = i.replace(/\b(echo|print|function|class|if|else|elseif|foreach|as|return|namespace|use|new|extends|public|protected|private|static)\b/g, `<span style="color: ${t.keyword};">$1</span>`), i = i.replace(/\u0000([a-z]+)\u0000/g, (p, y) => {
4218
4501
  let b = 0;
4219
- for (let w = 0; w < p.length; w++)
4220
- b = b * 26 + (p.charCodeAt(w) - 97 + 1);
4502
+ for (let w = 0; w < y.length; w++)
4503
+ b = b * 26 + (y.charCodeAt(w) - 97 + 1);
4221
4504
  return b = b - 1, s[b] || "";
4222
4505
  }), i;
4223
4506
  }
@@ -4229,157 +4512,157 @@ class li {
4229
4512
  this.editor = null, this.modes.clear();
4230
4513
  }
4231
4514
  }
4232
- function ci(m, e) {
4515
+ function Di(f, e) {
4233
4516
  const t = { ...e };
4234
- return t.extensions || (t.extensions = []), t.extensions.some((s) => s.name === "keymap") || t.extensions.unshift(new ei(t.keymap)), t.extensions.some((s) => s.name === "transaction") || t.extensions.unshift(new Mt()), new Ct(m, t);
4517
+ return t.extensions || (t.extensions = []), t.extensions.some((s) => s.name === "keymap") || t.extensions.unshift(new Ei(t.keymap)), t.extensions.some((s) => s.name === "transaction") || t.extensions.unshift(new At()), new Rt(f, t);
4235
4518
  }
4236
- function ln(m, e) {
4237
- (e == null || e > m.length) && (e = m.length);
4238
- for (var t = 0, n = Array(e); t < e; t++) n[t] = m[t];
4519
+ function fn(f, e) {
4520
+ (e == null || e > f.length) && (e = f.length);
4521
+ for (var t = 0, n = Array(e); t < e; t++) n[t] = f[t];
4239
4522
  return n;
4240
4523
  }
4241
- function hi(m) {
4242
- if (Array.isArray(m)) return m;
4524
+ function Ni(f) {
4525
+ if (Array.isArray(f)) return f;
4243
4526
  }
4244
- function ui(m, e) {
4245
- var t = m == null ? null : typeof Symbol != "undefined" && m[Symbol.iterator] || m["@@iterator"];
4527
+ function _i(f, e) {
4528
+ var t = f == null ? null : typeof Symbol != "undefined" && f[Symbol.iterator] || f["@@iterator"];
4246
4529
  if (t != null) {
4247
- var n, i, s, r, o = [], l = !0, c = !1;
4530
+ var n, i, s, r, o = [], a = !0, h = !1;
4248
4531
  try {
4249
- if (s = (t = t.call(m)).next, e !== 0) for (; !(l = (n = s.call(t)).done) && (o.push(n.value), o.length !== e); l = !0) ;
4250
- } catch (h) {
4251
- c = !0, i = h;
4532
+ if (s = (t = t.call(f)).next, e !== 0) for (; !(a = (n = s.call(t)).done) && (o.push(n.value), o.length !== e); a = !0) ;
4533
+ } catch (c) {
4534
+ h = !0, i = c;
4252
4535
  } finally {
4253
4536
  try {
4254
- if (!l && t.return != null && (r = t.return(), Object(r) !== r)) return;
4537
+ if (!a && t.return != null && (r = t.return(), Object(r) !== r)) return;
4255
4538
  } finally {
4256
- if (c) throw i;
4539
+ if (h) throw i;
4257
4540
  }
4258
4541
  }
4259
4542
  return o;
4260
4543
  }
4261
4544
  }
4262
- function di() {
4545
+ function Hi() {
4263
4546
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4264
4547
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
4265
4548
  }
4266
- function fi(m, e) {
4267
- return hi(m) || ui(m, e) || gi(m, e) || di();
4549
+ function Fi(f, e) {
4550
+ return Ni(f) || _i(f, e) || Pi(f, e) || Hi();
4268
4551
  }
4269
- function gi(m, e) {
4270
- if (m) {
4271
- if (typeof m == "string") return ln(m, e);
4272
- var t = {}.toString.call(m).slice(8, -1);
4273
- return t === "Object" && m.constructor && (t = m.constructor.name), t === "Map" || t === "Set" ? Array.from(m) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? ln(m, e) : void 0;
4552
+ function Pi(f, e) {
4553
+ if (f) {
4554
+ if (typeof f == "string") return fn(f, e);
4555
+ var t = {}.toString.call(f).slice(8, -1);
4556
+ return t === "Object" && f.constructor && (t = f.constructor.name), t === "Map" || t === "Set" ? Array.from(f) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? fn(f, e) : void 0;
4274
4557
  }
4275
4558
  }
4276
- const vn = Object.entries, cn = Object.setPrototypeOf, pi = Object.isFrozen, mi = Object.getPrototypeOf, yi = Object.getOwnPropertyDescriptor;
4277
- let B = Object.freeze, W = Object.seal, Ae = Object.create, En = typeof Reflect != "undefined" && Reflect, Lt = En.apply, At = En.construct;
4278
- B || (B = function(e) {
4559
+ const kn = Object.entries, gn = Object.setPrototypeOf, $i = Object.isFrozen, zi = Object.getPrototypeOf, Ui = Object.getOwnPropertyDescriptor;
4560
+ let W = Object.freeze, V = Object.seal, Le = Object.create, On = typeof Reflect != "undefined" && Reflect, kt = On.apply, Ot = On.construct;
4561
+ W || (W = function(e) {
4279
4562
  return e;
4280
4563
  });
4281
- W || (W = function(e) {
4564
+ V || (V = function(e) {
4282
4565
  return e;
4283
4566
  });
4284
- Lt || (Lt = function(e, t) {
4567
+ kt || (kt = function(e, t) {
4285
4568
  for (var n = arguments.length, i = new Array(n > 2 ? n - 2 : 0), s = 2; s < n; s++) i[s - 2] = arguments[s];
4286
4569
  return e.apply(t, i);
4287
4570
  });
4288
- At || (At = function(e) {
4571
+ Ot || (Ot = function(e) {
4289
4572
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++) n[i - 1] = arguments[i];
4290
4573
  return new e(...n);
4291
4574
  });
4292
- const Te = z(Array.prototype.forEach), bi = z(Array.prototype.lastIndexOf), hn = z(Array.prototype.pop), _e = z(Array.prototype.push), Ti = z(Array.prototype.splice), Oe = Array.isArray, Pe = z(String.prototype.toLowerCase), bt = z(String.prototype.toString), un = z(String.prototype.match), He = z(String.prototype.replace), dn = z(String.prototype.indexOf), xi = z(String.prototype.trim), Si = z(Number.prototype.toString), wi = z(Boolean.prototype.toString), fn = typeof BigInt == "undefined" ? null : z(BigInt.prototype.toString), gn = typeof Symbol == "undefined" ? null : z(Symbol.prototype.toString), q = z(Object.prototype.hasOwnProperty), Fe = z(Object.prototype.toString), K = z(RegExp.prototype.test), ge = vi(TypeError);
4293
- function z(m) {
4575
+ const Te = z(Array.prototype.forEach), Bi = z(Array.prototype.lastIndexOf), pn = z(Array.prototype.pop), He = z(Array.prototype.push), Wi = z(Array.prototype.splice), Oe = Array.isArray, $e = z(String.prototype.toLowerCase), xt = z(String.prototype.toString), mn = z(String.prototype.match), Fe = z(String.prototype.replace), yn = z(String.prototype.indexOf), Vi = z(String.prototype.trim), Ki = z(Number.prototype.toString), ji = z(Boolean.prototype.toString), bn = typeof BigInt == "undefined" ? null : z(BigInt.prototype.toString), Tn = typeof Symbol == "undefined" ? null : z(Symbol.prototype.toString), q = z(Object.prototype.hasOwnProperty), Pe = z(Object.prototype.toString), K = z(RegExp.prototype.test), ge = Gi(TypeError);
4576
+ function z(f) {
4294
4577
  return function(e) {
4295
4578
  e instanceof RegExp && (e.lastIndex = 0);
4296
4579
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++) n[i - 1] = arguments[i];
4297
- return Lt(m, e, n);
4580
+ return kt(f, e, n);
4298
4581
  };
4299
4582
  }
4300
- function vi(m) {
4583
+ function Gi(f) {
4301
4584
  return function() {
4302
4585
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
4303
- return At(m, t);
4586
+ return Ot(f, t);
4304
4587
  };
4305
4588
  }
4306
- function L(m, e) {
4307
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Pe;
4308
- if (cn && cn(m, null), !Oe(e)) return m;
4589
+ function L(f, e) {
4590
+ let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : $e;
4591
+ if (gn && gn(f, null), !Oe(e)) return f;
4309
4592
  let n = e.length;
4310
4593
  for (; n--; ) {
4311
4594
  let i = e[n];
4312
4595
  if (typeof i == "string") {
4313
4596
  const s = t(i);
4314
- s !== i && (pi(e) || (e[n] = s), i = s);
4597
+ s !== i && ($i(e) || (e[n] = s), i = s);
4315
4598
  }
4316
- m[i] = !0;
4599
+ f[i] = !0;
4317
4600
  }
4318
- return m;
4601
+ return f;
4319
4602
  }
4320
- function Ei(m) {
4321
- for (let e = 0; e < m.length; e++) q(m, e) || (m[e] = null);
4322
- return m;
4603
+ function qi(f) {
4604
+ for (let e = 0; e < f.length; e++) q(f, e) || (f[e] = null);
4605
+ return f;
4323
4606
  }
4324
- function J(m) {
4325
- const e = Ae(null);
4326
- for (const n of vn(m)) {
4327
- var t = fi(n, 2);
4607
+ function J(f) {
4608
+ const e = Le(null);
4609
+ for (const n of kn(f)) {
4610
+ var t = Fi(n, 2);
4328
4611
  const i = t[0], s = t[1];
4329
- q(m, i) && (Oe(s) ? e[i] = Ei(s) : s && typeof s == "object" && s.constructor === Object ? e[i] = J(s) : e[i] = s);
4612
+ q(f, i) && (Oe(s) ? e[i] = qi(s) : s && typeof s == "object" && s.constructor === Object ? e[i] = J(s) : e[i] = s);
4330
4613
  }
4331
4614
  return e;
4332
4615
  }
4333
- function Ci(m) {
4334
- switch (typeof m) {
4616
+ function Yi(f) {
4617
+ switch (typeof f) {
4335
4618
  case "string":
4336
- return m;
4619
+ return f;
4337
4620
  case "number":
4338
- return Si(m);
4621
+ return Ki(f);
4339
4622
  case "boolean":
4340
- return wi(m);
4623
+ return ji(f);
4341
4624
  case "bigint":
4342
- return fn ? fn(m) : "0";
4625
+ return bn ? bn(f) : "0";
4343
4626
  case "symbol":
4344
- return gn ? gn(m) : "Symbol()";
4627
+ return Tn ? Tn(f) : "Symbol()";
4345
4628
  case "undefined":
4346
- return Fe(m);
4629
+ return Pe(f);
4347
4630
  case "function":
4348
4631
  case "object": {
4349
- if (m === null) return Fe(m);
4350
- const e = m, t = te(e, "toString");
4632
+ if (f === null) return Pe(f);
4633
+ const e = f, t = te(e, "toString");
4351
4634
  if (typeof t == "function") {
4352
4635
  const n = t(e);
4353
- return typeof n == "string" ? n : Fe(n);
4636
+ return typeof n == "string" ? n : Pe(n);
4354
4637
  }
4355
- return Fe(m);
4638
+ return Pe(f);
4356
4639
  }
4357
4640
  default:
4358
- return Fe(m);
4641
+ return Pe(f);
4359
4642
  }
4360
4643
  }
4361
- function te(m, e) {
4362
- for (; m !== null; ) {
4363
- const n = yi(m, e);
4644
+ function te(f, e) {
4645
+ for (; f !== null; ) {
4646
+ const n = Ui(f, e);
4364
4647
  if (n) {
4365
4648
  if (n.get) return z(n.get);
4366
4649
  if (typeof n.value == "function") return z(n.value);
4367
4650
  }
4368
- m = mi(m);
4651
+ f = zi(f);
4369
4652
  }
4370
4653
  function t() {
4371
4654
  return null;
4372
4655
  }
4373
4656
  return t;
4374
4657
  }
4375
- function Mi(m) {
4658
+ function Zi(f) {
4376
4659
  try {
4377
- return K(m, ""), !0;
4660
+ return K(f, ""), !0;
4378
4661
  } catch (e) {
4379
4662
  return !1;
4380
4663
  }
4381
4664
  }
4382
- const pn = B([
4665
+ const xn = W([
4383
4666
  "a",
4384
4667
  "abbr",
4385
4668
  "acronym",
@@ -4499,7 +4782,7 @@ const pn = B([
4499
4782
  "var",
4500
4783
  "video",
4501
4784
  "wbr"
4502
- ]), Tt = B([
4785
+ ]), St = W([
4503
4786
  "svg",
4504
4787
  "a",
4505
4788
  "altglyph",
@@ -4547,7 +4830,7 @@ const pn = B([
4547
4830
  "tspan",
4548
4831
  "view",
4549
4832
  "vkern"
4550
- ]), xt = B([
4833
+ ]), wt = W([
4551
4834
  "feBlend",
4552
4835
  "feColorMatrix",
4553
4836
  "feComponentTransfer",
@@ -4573,7 +4856,7 @@ const pn = B([
4573
4856
  "feSpotLight",
4574
4857
  "feTile",
4575
4858
  "feTurbulence"
4576
- ]), Ri = B([
4859
+ ]), Xi = W([
4577
4860
  "animate",
4578
4861
  "color-profile",
4579
4862
  "cursor",
@@ -4596,7 +4879,7 @@ const pn = B([
4596
4879
  "solidcolor",
4597
4880
  "unknown",
4598
4881
  "use"
4599
- ]), St = B([
4882
+ ]), vt = W([
4600
4883
  "math",
4601
4884
  "menclose",
4602
4885
  "merror",
@@ -4627,7 +4910,7 @@ const pn = B([
4627
4910
  "munder",
4628
4911
  "munderover",
4629
4912
  "mprescripts"
4630
- ]), Li = B([
4913
+ ]), Qi = W([
4631
4914
  "maction",
4632
4915
  "maligngroup",
4633
4916
  "malignmark",
@@ -4643,7 +4926,7 @@ const pn = B([
4643
4926
  "annotation-xml",
4644
4927
  "mprescripts",
4645
4928
  "none"
4646
- ]), mn = B(["#text"]), yn = B([
4929
+ ]), Sn = W(["#text"]), wn = W([
4647
4930
  "accept",
4648
4931
  "action",
4649
4932
  "align",
@@ -4762,7 +5045,7 @@ const pn = B([
4762
5045
  "width",
4763
5046
  "wrap",
4764
5047
  "xmlns"
4765
- ]), wt = B([
5048
+ ]), Et = W([
4766
5049
  "accent-height",
4767
5050
  "accumulate",
4768
5051
  "additive",
@@ -4955,7 +5238,7 @@ const pn = B([
4955
5238
  "y2",
4956
5239
  "z",
4957
5240
  "zoomandpan"
4958
- ]), bn = B([
5241
+ ]), vn = W([
4959
5242
  "accent",
4960
5243
  "accentunder",
4961
5244
  "align",
@@ -5010,13 +5293,13 @@ const pn = B([
5010
5293
  "voffset",
5011
5294
  "width",
5012
5295
  "xmlns"
5013
- ]), et = B([
5296
+ ]), nt = W([
5014
5297
  "xlink:href",
5015
5298
  "xml:id",
5016
5299
  "xlink:title",
5017
5300
  "xml:space",
5018
5301
  "xmlns:xlink"
5019
- ]), Ai = W(/{{[\w\W]*|^[\w\W]*}}/g), Oi = W(/<%[\w\W]*|^[\w\W]*%>/g), ki = W(/\${[\w\W]*/g), Ii = W(/^data-[\-\w.\u00B7-\uFFFF]+$/), Di = W(/^aria-[\-\w]+$/), Tn = W(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Ni = W(/^(?:\w+script|data):/i), _i = W(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Hi = W(/^html$/i), Fi = W(/^[a-z][.\w]*(-[.\w]+)+$/i), xn = W(/<[/\w!]/g), Sn = W(/<[/\w]/g), Pi = W(/<\/no(script|embed|frames)/i), $i = W(/\/>/i), Q = {
5302
+ ]), Ji = V(/{{[\w\W]*|^[\w\W]*}}/g), es = V(/<%[\w\W]*|^[\w\W]*%>/g), ts = V(/\${[\w\W]*/g), ns = V(/^data-[\-\w.\u00B7-\uFFFF]+$/), is = V(/^aria-[\-\w]+$/), En = V(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), ss = V(/^(?:\w+script|data):/i), rs = V(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), os = V(/^html$/i), as = V(/^[a-z][.\w]*(-[.\w]+)+$/i), Cn = V(/<[/\w!]/g), Mn = V(/<[/\w]/g), ls = V(/<\/no(script|embed|frames)/i), cs = V(/\/>/i), Q = {
5020
5303
  element: 1,
5021
5304
  attribute: 2,
5022
5305
  text: 3,
@@ -5029,7 +5312,7 @@ const pn = B([
5029
5312
  documentType: 10,
5030
5313
  documentFragment: 11,
5031
5314
  notation: 12
5032
- }, Cn = [
5315
+ }, In = [
5033
5316
  "style",
5034
5317
  "script",
5035
5318
  "xmp",
@@ -5038,14 +5321,14 @@ const pn = B([
5038
5321
  "noframes",
5039
5322
  "plaintext",
5040
5323
  "noscript"
5041
- ], zi = B(L({}, Cn)), Ui = (function() {
5042
- const m = {};
5043
- return Te(Cn, (e) => {
5044
- m[e] = W(new RegExp("</" + e + "(?=[\\t\\n\\f\\r />])", "i"));
5045
- }), B(m);
5046
- })(), Bi = function() {
5324
+ ], hs = W(L({}, In)), ds = (function() {
5325
+ const f = {};
5326
+ return Te(In, (e) => {
5327
+ f[e] = V(new RegExp("</" + e + "(?=[\\t\\n\\f\\r />])", "i"));
5328
+ }), W(f);
5329
+ })(), us = function() {
5047
5330
  return typeof window == "undefined" ? null : window;
5048
- }, Wi = function(e, t) {
5331
+ }, fs = function(e, t) {
5049
5332
  if (typeof e != "object" || typeof e.createPolicy != "function") return null;
5050
5333
  let n = null;
5051
5334
  const i = "data-tt-policy-suffix";
@@ -5063,7 +5346,7 @@ const pn = B([
5063
5346
  } catch (r) {
5064
5347
  return console.warn("TrustedTypes policy " + s + " could not be created."), null;
5065
5348
  }
5066
- }, wn = function() {
5349
+ }, Rn = function() {
5067
5350
  return {
5068
5351
  afterSanitizeAttributes: [],
5069
5352
  afterSanitizeElements: [],
@@ -5077,68 +5360,68 @@ const pn = B([
5077
5360
  };
5078
5361
  }, pe = function(e, t, n, i) {
5079
5362
  return q(e, t) && Oe(e[t]) ? L(i.base ? J(i.base) : {}, e[t], i.transform) : n;
5080
- }, vt = function(e, t, n) {
5363
+ }, Ct = function(e, t, n) {
5081
5364
  const i = q(e, t) ? e[t] : void 0;
5082
5365
  return i && typeof i == "object" ? J(i) : n();
5083
5366
  };
5084
- function Mn() {
5085
- let m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Bi();
5086
- const e = (x) => Mn(x);
5087
- if (e.version = "3.4.16", e.removed = [], !m || !m.document || m.document.nodeType !== Q.document || !m.Element)
5367
+ function Dn() {
5368
+ let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : us();
5369
+ const e = (x) => Dn(x);
5370
+ if (e.version = "3.4.16", e.removed = [], !f || !f.document || f.document.nodeType !== Q.document || !f.Element)
5088
5371
  return e.isSupported = !1, e;
5089
- let t = m.document;
5372
+ let t = f.document;
5090
5373
  const n = t, i = n.currentScript;
5091
- m.DocumentFragment;
5092
- const s = m.HTMLTemplateElement, r = m.Node, o = m.Element, l = m.NodeFilter;
5093
- m.NamedNodeMap === void 0 && (m.NamedNodeMap || m.MozNamedAttrMap), m.HTMLFormElement;
5094
- const c = m.DOMParser, h = m.trustedTypes, d = o.prototype, f = te(d, "cloneNode"), y = te(d, "remove"), g = te(d, "removeAttributeNode"), p = te(d, "nextSibling"), b = te(d, "childNodes"), w = te(d, "parentNode"), E = te(d, "shadowRoot"), F = te(d, "attributes"), A = r && r.prototype ? te(r.prototype, "nodeType") : null, I = r && r.prototype ? te(r.prototype, "nodeName") : null, $ = r && r.prototype ? te(r.prototype, "ownerDocument") : null, Y = function(a) {
5095
- return A ? A(a) : a.nodeType;
5096
- }, ie = function(a) {
5097
- return I ? I(a) : a.nodeName;
5374
+ f.DocumentFragment;
5375
+ const s = f.HTMLTemplateElement, r = f.Node, o = f.Element, a = f.NodeFilter;
5376
+ f.NamedNodeMap === void 0 && (f.NamedNodeMap || f.MozNamedAttrMap), f.HTMLFormElement;
5377
+ const h = f.DOMParser, c = f.trustedTypes, d = o.prototype, g = te(d, "cloneNode"), m = te(d, "remove"), p = te(d, "removeAttributeNode"), y = te(d, "nextSibling"), b = te(d, "childNodes"), w = te(d, "parentNode"), E = te(d, "shadowRoot"), D = te(d, "attributes"), M = r && r.prototype ? te(r.prototype, "nodeType") : null, k = r && r.prototype ? te(r.prototype, "nodeName") : null, H = r && r.prototype ? te(r.prototype, "ownerDocument") : null, Y = function(l) {
5378
+ return M ? M(l) : l.nodeType;
5379
+ }, ie = function(l) {
5380
+ return k ? k(l) : l.nodeName;
5098
5381
  };
5099
5382
  if (typeof s == "function") {
5100
5383
  const x = t.createElement("template");
5101
5384
  x.content && x.content.ownerDocument && (t = x.content.ownerDocument);
5102
5385
  }
5103
- let _, U = "", j, ce = !1, se = 0;
5386
+ let F, U = "", j, ce = !1, se = 0;
5104
5387
  const Z = function() {
5105
5388
  if (se > 0) throw ge('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
5106
- }, ne = function(a) {
5389
+ }, ne = function(l) {
5107
5390
  Z(), se++;
5108
5391
  try {
5109
- return _.createHTML(a);
5392
+ return F.createHTML(l);
5110
5393
  } finally {
5111
5394
  se--;
5112
5395
  }
5113
- }, le = function(a) {
5396
+ }, le = function(l) {
5114
5397
  Z(), se++;
5115
5398
  try {
5116
- return _.createScriptURL(a);
5399
+ return F.createScriptURL(l);
5117
5400
  } finally {
5118
5401
  se--;
5119
5402
  }
5120
- }, tt = function() {
5121
- return ce || (j = Wi(h, i), ce = !0), j;
5122
- }, xe = t, ke = xe.implementation, ze = xe.createNodeIterator, nt = xe.createDocumentFragment, O = xe.getElementsByTagName, he = n.importNode;
5123
- let k = wn();
5124
- e.isSupported = typeof vn == "function" && typeof w == "function" && ke && ke.createHTMLDocument !== void 0;
5125
- const Ue = Ai, Rn = Oi, Ln = ki, An = Ii, On = Di, kn = Ni, kt = _i, In = Fi;
5126
- let It = Tn, D = null;
5127
- const it = L({}, [
5128
- ...pn,
5129
- ...Tt,
5130
- ...xt,
5403
+ }, it = function() {
5404
+ return ce || (j = fs(c, i), ce = !0), j;
5405
+ }, xe = t, Ie = xe.implementation, Ue = xe.createNodeIterator, st = xe.createDocumentFragment, O = xe.getElementsByTagName, he = n.importNode;
5406
+ let I = Rn();
5407
+ e.isSupported = typeof kn == "function" && typeof w == "function" && Ie && Ie.createHTMLDocument !== void 0;
5408
+ const Be = Ji, Nn = es, _n = ts, Hn = ns, Fn = is, Pn = ss, Dt = rs, $n = as;
5409
+ let Nt = En, N = null;
5410
+ const rt = L({}, [
5411
+ ...xn,
5131
5412
  ...St,
5132
- ...mn
5133
- ]);
5134
- let N = null;
5135
- const st = L({}, [
5136
- ...yn,
5137
5413
  ...wt,
5138
- ...bn,
5139
- ...et
5414
+ ...vt,
5415
+ ...Sn
5416
+ ]);
5417
+ let _ = null;
5418
+ const ot = L({}, [
5419
+ ...wn,
5420
+ ...Et,
5421
+ ...vn,
5422
+ ...nt
5140
5423
  ]);
5141
- let re = Object.seal(Ae(null, {
5424
+ let re = Object.seal(Le(null, {
5142
5425
  tagNameCheck: {
5143
5426
  writable: !0,
5144
5427
  configurable: !1,
@@ -5157,8 +5440,8 @@ function Mn() {
5157
5440
  enumerable: !0,
5158
5441
  value: !1
5159
5442
  }
5160
- })), Ie = null, Dt = null;
5161
- const ue = Object.seal(Ae(null, {
5443
+ })), De = null, _t = null;
5444
+ const de = Object.seal(Le(null, {
5162
5445
  tagCheck: {
5163
5446
  writable: !0,
5164
5447
  configurable: !1,
@@ -5172,10 +5455,10 @@ function Mn() {
5172
5455
  value: null
5173
5456
  }
5174
5457
  }));
5175
- let Nt = !0, rt = !0, _t = !1, Ht = !0, de = !1, me = !0, ye = !1, ot = !1, Be = null, We = null, at = !1, Se = !1, Ve = !1, Ke = !1, Ft = !0, Pt = !1;
5176
- const $t = "user-content-";
5177
- let lt = !0, ct = !1, we = {}, ve = null;
5178
- const zt = L({}, [
5458
+ let Ht = !0, at = !0, Ft = !1, Pt = !0, ue = !1, me = !0, ye = !1, lt = !1, We = null, Ve = null, ct = !1, Se = !1, Ke = !1, je = !1, $t = !0, zt = !1;
5459
+ const Ut = "user-content-";
5460
+ let ht = !0, dt = !1, we = {}, ve = null;
5461
+ const Bt = L({}, [
5179
5462
  "annotation-xml",
5180
5463
  "audio",
5181
5464
  "colgroup",
@@ -5203,8 +5486,8 @@ function Mn() {
5203
5486
  "video",
5204
5487
  "xmp"
5205
5488
  ]);
5206
- let Ut = null;
5207
- const Bt = L({}, [
5489
+ let Wt = null;
5490
+ const Vt = L({}, [
5208
5491
  "audio",
5209
5492
  "video",
5210
5493
  "img",
@@ -5212,8 +5495,8 @@ function Mn() {
5212
5495
  "image",
5213
5496
  "track"
5214
5497
  ]);
5215
- let Wt = null;
5216
- const Vt = L({}, [
5498
+ let Kt = null;
5499
+ const jt = L({}, [
5217
5500
  "alt",
5218
5501
  "class",
5219
5502
  "for",
@@ -5228,294 +5511,294 @@ function Mn() {
5228
5511
  "value",
5229
5512
  "style",
5230
5513
  "xmlns"
5231
- ]), je = "http://www.w3.org/1998/Math/MathML", Ge = "http://www.w3.org/2000/svg", oe = "http://www.w3.org/1999/xhtml";
5232
- let Ee = oe, ht = !1, ut = null;
5233
- const Dn = L({}, [
5234
- je,
5514
+ ]), Ge = "http://www.w3.org/1998/Math/MathML", qe = "http://www.w3.org/2000/svg", oe = "http://www.w3.org/1999/xhtml";
5515
+ let Ee = oe, ut = !1, ft = null;
5516
+ const zn = L({}, [
5235
5517
  Ge,
5518
+ qe,
5236
5519
  oe
5237
- ], bt), Kt = B([
5520
+ ], xt), Gt = W([
5238
5521
  "mi",
5239
5522
  "mo",
5240
5523
  "mn",
5241
5524
  "ms",
5242
5525
  "mtext"
5243
5526
  ]);
5244
- let dt = L({}, Kt);
5245
- const jt = B(["annotation-xml"]);
5246
- let ft = L({}, jt);
5247
- const Nn = L({}, [
5527
+ let gt = L({}, Gt);
5528
+ const qt = W(["annotation-xml"]);
5529
+ let pt = L({}, qt);
5530
+ const Un = L({}, [
5248
5531
  "title",
5249
5532
  "style",
5250
5533
  "font",
5251
5534
  "a",
5252
5535
  "script"
5253
5536
  ]);
5254
- let De = null;
5255
- const _n = ["application/xhtml+xml", "text/html"], Hn = "text/html";
5256
- let P = null, Ce = null;
5257
- const Fn = t.createElement("form"), Gt = function(a) {
5258
- return a instanceof RegExp || a instanceof Function;
5259
- }, gt = function() {
5260
- let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
5261
- if (Ce && Ce === a) return;
5262
- (!a || typeof a != "object") && (a = {}), a = J(a), De = _n.indexOf(a.PARSER_MEDIA_TYPE) === -1 ? Hn : a.PARSER_MEDIA_TYPE, P = De === "application/xhtml+xml" ? bt : Pe, D = pe(a, "ALLOWED_TAGS", it, { transform: P }), N = pe(a, "ALLOWED_ATTR", st, { transform: P }), ut = pe(a, "ALLOWED_NAMESPACES", Dn, { transform: bt }), Wt = pe(a, "ADD_URI_SAFE_ATTR", Vt, {
5263
- transform: P,
5537
+ let Ne = null;
5538
+ const Bn = ["application/xhtml+xml", "text/html"], Wn = "text/html";
5539
+ let $ = null, Ce = null;
5540
+ const Vn = t.createElement("form"), Yt = function(l) {
5541
+ return l instanceof RegExp || l instanceof Function;
5542
+ }, mt = function() {
5543
+ let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
5544
+ if (Ce && Ce === l) return;
5545
+ (!l || typeof l != "object") && (l = {}), l = J(l), Ne = Bn.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Wn : l.PARSER_MEDIA_TYPE, $ = Ne === "application/xhtml+xml" ? xt : $e, N = pe(l, "ALLOWED_TAGS", rt, { transform: $ }), _ = pe(l, "ALLOWED_ATTR", ot, { transform: $ }), ft = pe(l, "ALLOWED_NAMESPACES", zn, { transform: xt }), Kt = pe(l, "ADD_URI_SAFE_ATTR", jt, {
5546
+ transform: $,
5547
+ base: jt
5548
+ }), Wt = pe(l, "ADD_DATA_URI_TAGS", Vt, {
5549
+ transform: $,
5264
5550
  base: Vt
5265
- }), Ut = pe(a, "ADD_DATA_URI_TAGS", Bt, {
5266
- transform: P,
5267
- base: Bt
5268
- }), ve = pe(a, "FORBID_CONTENTS", zt, { transform: P }), Ie = pe(a, "FORBID_TAGS", J({}), { transform: P }), Dt = pe(a, "FORBID_ATTR", J({}), { transform: P }), we = q(a, "USE_PROFILES") ? a.USE_PROFILES && typeof a.USE_PROFILES == "object" ? J(a.USE_PROFILES) : a.USE_PROFILES : !1, Nt = a.ALLOW_ARIA_ATTR !== !1, rt = a.ALLOW_DATA_ATTR !== !1, _t = a.ALLOW_UNKNOWN_PROTOCOLS || !1, Ht = a.ALLOW_SELF_CLOSE_IN_ATTR !== !1, de = a.SAFE_FOR_TEMPLATES || !1, me = a.SAFE_FOR_XML !== !1, ye = a.WHOLE_DOCUMENT || !1, Se = a.RETURN_DOM || !1, Ve = a.RETURN_DOM_FRAGMENT || !1, Ke = a.RETURN_TRUSTED_TYPE || !1, at = a.FORCE_BODY || !1, Ft = a.SANITIZE_DOM !== !1, Pt = a.SANITIZE_NAMED_PROPS || !1, lt = a.KEEP_CONTENT !== !1, ct = a.IN_PLACE || !1, It = Mi(a.ALLOWED_URI_REGEXP) ? a.ALLOWED_URI_REGEXP : Tn, Ee = typeof a.NAMESPACE == "string" ? a.NAMESPACE : oe, dt = vt(a, "MATHML_TEXT_INTEGRATION_POINTS", () => L({}, Kt)), ft = vt(a, "HTML_INTEGRATION_POINTS", () => L({}, jt));
5269
- const u = vt(a, "CUSTOM_ELEMENT_HANDLING", () => Ae(null));
5270
- if (re = Ae(null), q(u, "tagNameCheck") && Gt(u.tagNameCheck) && (re.tagNameCheck = u.tagNameCheck), q(u, "attributeNameCheck") && Gt(u.attributeNameCheck) && (re.attributeNameCheck = u.attributeNameCheck), q(u, "allowCustomizedBuiltInElements") && typeof u.allowCustomizedBuiltInElements == "boolean" && (re.allowCustomizedBuiltInElements = u.allowCustomizedBuiltInElements), W(re), de && (rt = !1), Ve && (Se = !0), we && (D = L({}, mn), N = Ae(null), we.html === !0 && (L(D, pn), L(N, yn)), we.svg === !0 && (L(D, Tt), L(N, wt), L(N, et)), we.svgFilters === !0 && (L(D, xt), L(N, wt), L(N, et)), we.mathMl === !0 && (L(D, St), L(N, bn), L(N, et))), ue.tagCheck = null, ue.attributeCheck = null, q(a, "ADD_TAGS") && (typeof a.ADD_TAGS == "function" ? ue.tagCheck = a.ADD_TAGS : Oe(a.ADD_TAGS) && (D === it && (D = J(D)), L(D, a.ADD_TAGS, P))), q(a, "ADD_ATTR") && (typeof a.ADD_ATTR == "function" ? ue.attributeCheck = a.ADD_ATTR : Oe(a.ADD_ATTR) && (N === st && (N = J(N)), L(N, a.ADD_ATTR, P))), q(a, "ADD_FORBID_CONTENTS") && Oe(a.ADD_FORBID_CONTENTS) && (ve === zt && (ve = J(ve)), L(ve, a.ADD_FORBID_CONTENTS, P)), lt && (D["#text"] = !0), ye && L(D, [
5551
+ }), ve = pe(l, "FORBID_CONTENTS", Bt, { transform: $ }), De = pe(l, "FORBID_TAGS", J({}), { transform: $ }), _t = pe(l, "FORBID_ATTR", J({}), { transform: $ }), we = q(l, "USE_PROFILES") ? l.USE_PROFILES && typeof l.USE_PROFILES == "object" ? J(l.USE_PROFILES) : l.USE_PROFILES : !1, Ht = l.ALLOW_ARIA_ATTR !== !1, at = l.ALLOW_DATA_ATTR !== !1, Ft = l.ALLOW_UNKNOWN_PROTOCOLS || !1, Pt = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, ue = l.SAFE_FOR_TEMPLATES || !1, me = l.SAFE_FOR_XML !== !1, ye = l.WHOLE_DOCUMENT || !1, Se = l.RETURN_DOM || !1, Ke = l.RETURN_DOM_FRAGMENT || !1, je = l.RETURN_TRUSTED_TYPE || !1, ct = l.FORCE_BODY || !1, $t = l.SANITIZE_DOM !== !1, zt = l.SANITIZE_NAMED_PROPS || !1, ht = l.KEEP_CONTENT !== !1, dt = l.IN_PLACE || !1, Nt = Zi(l.ALLOWED_URI_REGEXP) ? l.ALLOWED_URI_REGEXP : En, Ee = typeof l.NAMESPACE == "string" ? l.NAMESPACE : oe, gt = Ct(l, "MATHML_TEXT_INTEGRATION_POINTS", () => L({}, Gt)), pt = Ct(l, "HTML_INTEGRATION_POINTS", () => L({}, qt));
5552
+ const u = Ct(l, "CUSTOM_ELEMENT_HANDLING", () => Le(null));
5553
+ if (re = Le(null), q(u, "tagNameCheck") && Yt(u.tagNameCheck) && (re.tagNameCheck = u.tagNameCheck), q(u, "attributeNameCheck") && Yt(u.attributeNameCheck) && (re.attributeNameCheck = u.attributeNameCheck), q(u, "allowCustomizedBuiltInElements") && typeof u.allowCustomizedBuiltInElements == "boolean" && (re.allowCustomizedBuiltInElements = u.allowCustomizedBuiltInElements), V(re), ue && (at = !1), Ke && (Se = !0), we && (N = L({}, Sn), _ = Le(null), we.html === !0 && (L(N, xn), L(_, wn)), we.svg === !0 && (L(N, St), L(_, Et), L(_, nt)), we.svgFilters === !0 && (L(N, wt), L(_, Et), L(_, nt)), we.mathMl === !0 && (L(N, vt), L(_, vn), L(_, nt))), de.tagCheck = null, de.attributeCheck = null, q(l, "ADD_TAGS") && (typeof l.ADD_TAGS == "function" ? de.tagCheck = l.ADD_TAGS : Oe(l.ADD_TAGS) && (N === rt && (N = J(N)), L(N, l.ADD_TAGS, $))), q(l, "ADD_ATTR") && (typeof l.ADD_ATTR == "function" ? de.attributeCheck = l.ADD_ATTR : Oe(l.ADD_ATTR) && (_ === ot && (_ = J(_)), L(_, l.ADD_ATTR, $))), q(l, "ADD_FORBID_CONTENTS") && Oe(l.ADD_FORBID_CONTENTS) && (ve === Bt && (ve = J(ve)), L(ve, l.ADD_FORBID_CONTENTS, $)), ht && (N["#text"] = !0), ye && L(N, [
5271
5554
  "html",
5272
5555
  "head",
5273
5556
  "body"
5274
- ]), D.table && (L(D, ["tbody"]), delete Ie.tbody), a.TRUSTED_TYPES_POLICY) {
5275
- if (typeof a.TRUSTED_TYPES_POLICY.createHTML != "function") throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
5276
- if (typeof a.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
5277
- const T = _;
5278
- _ = a.TRUSTED_TYPES_POLICY;
5557
+ ]), N.table && (L(N, ["tbody"]), delete De.tbody), l.TRUSTED_TYPES_POLICY) {
5558
+ if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function") throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
5559
+ if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
5560
+ const T = F;
5561
+ F = l.TRUSTED_TYPES_POLICY;
5279
5562
  try {
5280
5563
  U = ne("");
5281
5564
  } catch (S) {
5282
- throw _ = T, S;
5565
+ throw F = T, S;
5283
5566
  }
5284
- } else a.TRUSTED_TYPES_POLICY === null ? (_ = void 0, U = "") : (_ === void 0 && (_ = tt()), _ && typeof U == "string" && (U = ne("")));
5285
- B && B(a), Ce = a;
5286
- }, qt = L({}, [
5287
- ...Tt,
5288
- ...xt,
5289
- ...Ri
5290
- ]), Yt = L({}, [...St, ...Li]), Pn = function(a, u, T) {
5291
- return u.namespaceURI === oe ? a === "svg" : u.namespaceURI === je ? a === "svg" && (T === "annotation-xml" || dt[T]) : !!qt[a];
5292
- }, $n = function(a, u, T) {
5293
- return u.namespaceURI === oe ? a === "math" : u.namespaceURI === Ge ? a === "math" && ft[T] : !!Yt[a];
5294
- }, zn = function(a, u, T) {
5295
- return u.namespaceURI === Ge && !ft[T] || u.namespaceURI === je && !dt[T] ? !1 : !Yt[a] && (Nn[a] || !qt[a]);
5296
- }, Un = function(a) {
5297
- let u = w(a);
5567
+ } else l.TRUSTED_TYPES_POLICY === null ? (F = void 0, U = "") : (F === void 0 && (F = it()), F && typeof U == "string" && (U = ne("")));
5568
+ W && W(l), Ce = l;
5569
+ }, Zt = L({}, [
5570
+ ...St,
5571
+ ...wt,
5572
+ ...Xi
5573
+ ]), Xt = L({}, [...vt, ...Qi]), Kn = function(l, u, T) {
5574
+ return u.namespaceURI === oe ? l === "svg" : u.namespaceURI === Ge ? l === "svg" && (T === "annotation-xml" || gt[T]) : !!Zt[l];
5575
+ }, jn = function(l, u, T) {
5576
+ return u.namespaceURI === oe ? l === "math" : u.namespaceURI === qe ? l === "math" && pt[T] : !!Xt[l];
5577
+ }, Gn = function(l, u, T) {
5578
+ return u.namespaceURI === qe && !pt[T] || u.namespaceURI === Ge && !gt[T] ? !1 : !Xt[l] && (Un[l] || !Zt[l]);
5579
+ }, qn = function(l) {
5580
+ let u = w(l);
5298
5581
  (!u || !u.tagName) && (u = {
5299
5582
  namespaceURI: Ee,
5300
5583
  tagName: "template"
5301
5584
  });
5302
- const T = Pe(a.tagName), S = Pe(u.tagName);
5303
- return ut[a.namespaceURI] ? a.namespaceURI === Ge ? Pn(T, u, S) : a.namespaceURI === je ? $n(T, u, S) : a.namespaceURI === oe ? zn(T, u, S) : !!(De === "application/xhtml+xml" && ut[a.namespaceURI]) : !1;
5304
- }, fe = function(a) {
5305
- _e(e.removed, { element: a });
5585
+ const T = $e(l.tagName), S = $e(u.tagName);
5586
+ return ft[l.namespaceURI] ? l.namespaceURI === qe ? Kn(T, u, S) : l.namespaceURI === Ge ? jn(T, u, S) : l.namespaceURI === oe ? Gn(T, u, S) : !!(Ne === "application/xhtml+xml" && ft[l.namespaceURI]) : !1;
5587
+ }, fe = function(l) {
5588
+ He(e.removed, { element: l });
5306
5589
  try {
5307
- w(a).removeChild(a);
5590
+ w(l).removeChild(l);
5308
5591
  } catch (u) {
5309
- if (y(a), !w(a)) throw ge("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
5592
+ if (m(l), !w(l)) throw ge("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
5310
5593
  }
5311
- }, Zt = function(a, u, T) {
5594
+ }, Qt = function(l, u, T) {
5312
5595
  try {
5313
- g(a, u);
5596
+ p(l, u);
5314
5597
  } catch (S) {
5315
5598
  try {
5316
- a.removeAttribute(T);
5599
+ l.removeAttribute(T);
5317
5600
  } catch (v) {
5318
5601
  }
5319
5602
  }
5320
- }, qe = function(a) {
5321
- Ye(a);
5322
- const u = b(a);
5603
+ }, Ye = function(l) {
5604
+ Ze(l);
5605
+ const u = b(l);
5323
5606
  if (u) {
5324
5607
  const S = [];
5325
5608
  Te(u, (v) => {
5326
- _e(S, v);
5609
+ He(S, v);
5327
5610
  }), Te(S, (v) => {
5328
5611
  try {
5329
- y(v);
5330
- } catch (M) {
5612
+ m(v);
5613
+ } catch (R) {
5331
5614
  }
5332
5615
  });
5333
5616
  }
5334
- const T = F(a);
5617
+ const T = D(l);
5335
5618
  if (T) for (let S = T.length - 1; S >= 0; --S) {
5336
- const v = T[S], M = v && v.name;
5337
- typeof M == "string" && Zt(a, v, M);
5619
+ const v = T[S], R = v && v.name;
5620
+ typeof R == "string" && Qt(l, v, R);
5338
5621
  }
5339
- }, be = function(a, u, T) {
5622
+ }, be = function(l, u, T) {
5340
5623
  if (!T) try {
5341
- T = u.getAttributeNode(a);
5624
+ T = u.getAttributeNode(l);
5342
5625
  } catch (S) {
5343
5626
  T = null;
5344
5627
  }
5345
- _e(e.removed, {
5628
+ He(e.removed, {
5346
5629
  attribute: T || null,
5347
5630
  from: u
5348
5631
  });
5349
5632
  try {
5350
- T ? g(u, T) : u.removeAttribute(a);
5633
+ T ? p(u, T) : u.removeAttribute(l);
5351
5634
  } catch (S) {
5352
5635
  try {
5353
- u.removeAttribute(a);
5636
+ u.removeAttribute(l);
5354
5637
  } catch (v) {
5355
5638
  }
5356
5639
  }
5357
- if (a === "is")
5358
- if (Se || Ve) try {
5640
+ if (l === "is")
5641
+ if (Se || Ke) try {
5359
5642
  fe(u);
5360
5643
  } catch (S) {
5361
5644
  }
5362
5645
  else try {
5363
- u.setAttribute(a, "");
5646
+ u.setAttribute(l, "");
5364
5647
  } catch (S) {
5365
5648
  }
5366
- }, Bn = function(a) {
5367
- const u = F(a);
5649
+ }, Yn = function(l) {
5650
+ const u = D(l);
5368
5651
  if (u)
5369
5652
  for (let T = u.length - 1; T >= 0; --T) {
5370
5653
  const S = u[T], v = S && S.name;
5371
- typeof v != "string" || N[P(v)] || Zt(a, S, v);
5654
+ typeof v != "string" || _[$(v)] || Qt(l, S, v);
5372
5655
  }
5373
- }, Ye = function(a) {
5374
- const u = [a];
5656
+ }, Ze = function(l) {
5657
+ const u = [l];
5375
5658
  for (; u.length > 0; ) {
5376
5659
  const T = u.pop();
5377
- Y(T) === Q.element && Bn(T);
5660
+ Y(T) === Q.element && Yn(T);
5378
5661
  const S = b(T);
5379
5662
  if (S) for (let v = S.length - 1; v >= 0; --v) u.push(S[v]);
5380
5663
  }
5381
- }, Xt = function(a, u) {
5382
- return me ? a === "patchsrc" ? !0 : a === "for" && u !== "label" && u !== "output" : !1;
5383
- }, Wn = function(a) {
5664
+ }, Jt = function(l, u) {
5665
+ return me ? l === "patchsrc" ? !0 : l === "for" && u !== "label" && u !== "output" : !1;
5666
+ }, Zn = function(l) {
5384
5667
  if (!me) return;
5385
- const u = [a];
5668
+ const u = [l];
5386
5669
  for (; u.length > 0; ) {
5387
5670
  const T = u.pop(), S = Y(T);
5388
- if (S === Q.processingInstruction || S === Q.comment && K(Sn, T.data)) {
5671
+ if (S === Q.processingInstruction || S === Q.comment && K(Mn, T.data)) {
5389
5672
  try {
5390
- y(T);
5391
- } catch (M) {
5673
+ m(T);
5674
+ } catch (R) {
5392
5675
  }
5393
5676
  continue;
5394
5677
  }
5395
5678
  if (S === Q.element) {
5396
- const M = T, R = P(ie(T));
5679
+ const R = T, A = $(ie(T));
5397
5680
  try {
5398
- M.hasAttribute && M.hasAttribute("patchsrc") && M.removeAttribute("patchsrc"), M.hasAttribute && M.hasAttribute("for") && Xt("for", R) && M.removeAttribute("for");
5399
- } catch (H) {
5681
+ R.hasAttribute && R.hasAttribute("patchsrc") && R.removeAttribute("patchsrc"), R.hasAttribute && R.hasAttribute("for") && Jt("for", A) && R.removeAttribute("for");
5682
+ } catch (P) {
5400
5683
  }
5401
5684
  }
5402
5685
  const v = b(T);
5403
- if (v) for (let M = v.length - 1; M >= 0; --M) u.push(v[M]);
5686
+ if (v) for (let R = v.length - 1; R >= 0; --R) u.push(v[R]);
5404
5687
  }
5405
- }, Qt = function(a) {
5688
+ }, en = function(l) {
5406
5689
  let u = null, T = null;
5407
- if (at) a = "<remove></remove>" + a;
5690
+ if (ct) l = "<remove></remove>" + l;
5408
5691
  else {
5409
- const M = un(a, /^[\r\n\t ]+/);
5410
- T = M && M[0];
5692
+ const R = mn(l, /^[\r\n\t ]+/);
5693
+ T = R && R[0];
5411
5694
  }
5412
- De === "application/xhtml+xml" && Ee === oe && (a = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + a + "</body></html>");
5413
- const S = _ ? ne(a) : a;
5695
+ Ne === "application/xhtml+xml" && Ee === oe && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
5696
+ const S = F ? ne(l) : l;
5414
5697
  if (Ee === oe) try {
5415
- u = new c().parseFromString(S, De);
5416
- } catch (M) {
5698
+ u = new h().parseFromString(S, Ne);
5699
+ } catch (R) {
5417
5700
  }
5418
5701
  if (!u || !u.documentElement) {
5419
- u = ke.createDocument(Ee, "template", null);
5702
+ u = Ie.createDocument(Ee, "template", null);
5420
5703
  try {
5421
- u.documentElement.innerHTML = ht ? U : S;
5422
- } catch (M) {
5704
+ u.documentElement.innerHTML = ut ? U : S;
5705
+ } catch (R) {
5423
5706
  }
5424
5707
  }
5425
5708
  const v = u.body || u.documentElement;
5426
- return a && T && v.insertBefore(t.createTextNode(T), v.childNodes[0] || null), Ee === oe ? O.call(u, ye ? "html" : "body")[0] : ye ? u.documentElement : v;
5427
- }, Jt = function(a) {
5428
- const u = $ ? $(a) : a.ownerDocument;
5429
- return ze.call(u || a, a, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
5430
- }, Ze = function(a) {
5431
- return a = He(a, Ue, " "), a = He(a, Rn, " "), a = He(a, Ln, " "), a;
5432
- }, pt = function(a) {
5709
+ return l && T && v.insertBefore(t.createTextNode(T), v.childNodes[0] || null), Ee === oe ? O.call(u, ye ? "html" : "body")[0] : ye ? u.documentElement : v;
5710
+ }, tn = function(l) {
5711
+ const u = H ? H(l) : l.ownerDocument;
5712
+ return Ue.call(u || l, l, a.SHOW_ELEMENT | a.SHOW_COMMENT | a.SHOW_TEXT | a.SHOW_PROCESSING_INSTRUCTION | a.SHOW_CDATA_SECTION, null);
5713
+ }, Xe = function(l) {
5714
+ return l = Fe(l, Be, " "), l = Fe(l, Nn, " "), l = Fe(l, _n, " "), l;
5715
+ }, yt = function(l) {
5433
5716
  var u;
5434
- a.normalize();
5435
- const T = $ ? $(a) : a.ownerDocument, S = ze.call(T || a, a, l.SHOW_TEXT | l.SHOW_COMMENT | l.SHOW_CDATA_SECTION | l.SHOW_PROCESSING_INSTRUCTION, null);
5717
+ l.normalize();
5718
+ const T = H ? H(l) : l.ownerDocument, S = Ue.call(T || l, l, a.SHOW_TEXT | a.SHOW_COMMENT | a.SHOW_CDATA_SECTION | a.SHOW_PROCESSING_INSTRUCTION, null);
5436
5719
  let v = S.nextNode();
5437
5720
  for (; v; )
5438
- v.data = Ze(v.data), v = S.nextNode();
5439
- const M = (u = a.querySelectorAll) === null || u === void 0 ? void 0 : u.call(a, "template");
5440
- M && Te(M, (R) => {
5441
- Me(R.content) && pt(R.content);
5721
+ v.data = Xe(v.data), v = S.nextNode();
5722
+ const R = (u = l.querySelectorAll) === null || u === void 0 ? void 0 : u.call(l, "template");
5723
+ R && Te(R, (A) => {
5724
+ Me(A.content) && yt(A.content);
5442
5725
  });
5443
- }, Xe = function(a) {
5444
- const u = I ? I(a) : null;
5445
- return typeof u != "string" || P(u) !== "form" ? !1 : typeof a.nodeName != "string" || typeof a.textContent != "string" || typeof a.removeChild != "function" || a.attributes !== F(a) || typeof a.removeAttribute != "function" || typeof a.removeAttributeNode != "function" || typeof a.getAttributeNode != "function" || typeof a.setAttribute != "function" || typeof a.namespaceURI != "string" || typeof a.insertBefore != "function" || typeof a.hasChildNodes != "function" || a.nodeType !== A(a) || a.childNodes !== b(a);
5446
- }, Me = function(a) {
5447
- if (!A || typeof a != "object" || a === null) return !1;
5726
+ }, Qe = function(l) {
5727
+ const u = k ? k(l) : null;
5728
+ return typeof u != "string" || $(u) !== "form" ? !1 : typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || l.attributes !== D(l) || typeof l.removeAttribute != "function" || typeof l.removeAttributeNode != "function" || typeof l.getAttributeNode != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function" || l.nodeType !== M(l) || l.childNodes !== b(l);
5729
+ }, Me = function(l) {
5730
+ if (!M || typeof l != "object" || l === null) return !1;
5448
5731
  try {
5449
- return A(a) === Q.documentFragment;
5732
+ return M(l) === Q.documentFragment;
5450
5733
  } catch (u) {
5451
5734
  return !1;
5452
5735
  }
5453
- }, Ne = function(a) {
5454
- if (!A || typeof a != "object" || a === null) return !1;
5736
+ }, _e = function(l) {
5737
+ if (!M || typeof l != "object" || l === null) return !1;
5455
5738
  try {
5456
- return typeof A(a) == "number";
5739
+ return typeof M(l) == "number";
5457
5740
  } catch (u) {
5458
5741
  return !1;
5459
5742
  }
5460
5743
  };
5461
- function ae(x, a, u) {
5744
+ function ae(x, l, u) {
5462
5745
  x.length !== 0 && Te(x, (T) => {
5463
- T.call(e, a, u, Ce);
5746
+ T.call(e, l, u, Ce);
5464
5747
  });
5465
5748
  }
5466
- const Vn = function(a, u) {
5467
- return !!(me && a.hasChildNodes() && !Ne(a.firstElementChild) && K(xn, a.textContent) && K(xn, a.innerHTML) || me && a.namespaceURI === oe && zi[u] && (Ne(a.firstElementChild) || typeof a.textContent == "string" && K(Ui[u], a.textContent)) || a.nodeType === Q.processingInstruction || me && a.nodeType === Q.comment && K(Sn, a.data));
5468
- }, Qe = function(a, u) {
5469
- if (a instanceof RegExp) return K(a, u);
5470
- if (a instanceof Function) {
5749
+ const Xn = function(l, u) {
5750
+ return !!(me && l.hasChildNodes() && !_e(l.firstElementChild) && K(Cn, l.textContent) && K(Cn, l.innerHTML) || me && l.namespaceURI === oe && hs[u] && (_e(l.firstElementChild) || typeof l.textContent == "string" && K(ds[u], l.textContent)) || l.nodeType === Q.processingInstruction || me && l.nodeType === Q.comment && K(Mn, l.data));
5751
+ }, Je = function(l, u) {
5752
+ if (l instanceof RegExp) return K(l, u);
5753
+ if (l instanceof Function) {
5471
5754
  for (var T = arguments.length, S = new Array(T > 2 ? T - 2 : 0), v = 2; v < T; v++) S[v - 2] = arguments[v];
5472
- return !!a(u, ...S);
5755
+ return !!l(u, ...S);
5473
5756
  }
5474
5757
  return !1;
5475
- }, Kn = function(a, u, T) {
5476
- if (!Ie[u] && sn(u) && Qe(re.tagNameCheck, u)) return !1;
5477
- if (lt && !ve[u]) {
5478
- const S = w(a), v = b(a);
5758
+ }, Qn = function(l, u, T) {
5759
+ if (!De[u] && on(u) && Je(re.tagNameCheck, u)) return !1;
5760
+ if (ht && !ve[u]) {
5761
+ const S = w(l), v = b(l);
5479
5762
  if (v && S) {
5480
- const M = v.length;
5481
- for (let R = M - 1; R >= 0; --R) {
5482
- const H = a === T ? f(v[R], !0) : v[R];
5483
- S.insertBefore(H, p(a));
5763
+ const R = v.length;
5764
+ for (let A = R - 1; A >= 0; --A) {
5765
+ const P = l === T ? g(v[A], !0) : v[A];
5766
+ S.insertBefore(P, y(l));
5484
5767
  }
5485
5768
  }
5486
5769
  }
5487
- return fe(a), !0;
5488
- }, en = function(a, u, T, S) {
5489
- return a.length === 0 ? u : u === T || u === S ? J(u) : u;
5490
- }, Re = function(a, u) {
5491
- return a === u || w(a) !== null ? !1 : (ct && Ye(a), !0);
5492
- }, tn = function(a, u) {
5493
- if (ae(k.beforeSanitizeElements, a, null), Re(a, u)) return !0;
5494
- if (Xe(a))
5495
- return fe(a), !0;
5496
- const T = P(ie(a));
5497
- if (D = en(k.uponSanitizeElement, D, it, Be), ae(k.uponSanitizeElement, a, {
5770
+ return fe(l), !0;
5771
+ }, nn = function(l, u, T, S) {
5772
+ return l.length === 0 ? u : u === T || u === S ? J(u) : u;
5773
+ }, Re = function(l, u) {
5774
+ return l === u || w(l) !== null ? !1 : (dt && Ze(l), !0);
5775
+ }, sn = function(l, u) {
5776
+ if (ae(I.beforeSanitizeElements, l, null), Re(l, u)) return !0;
5777
+ if (Qe(l))
5778
+ return fe(l), !0;
5779
+ const T = $(ie(l));
5780
+ if (N = nn(I.uponSanitizeElement, N, rt, We), ae(I.uponSanitizeElement, l, {
5498
5781
  tagName: T,
5499
- allowedTags: D
5500
- }), Re(a, u)) return !0;
5501
- if (Vn(a, T))
5502
- return fe(a), !0;
5503
- if (Ie[T] || !(ue.tagCheck instanceof Function && ue.tagCheck(T)) && !D[T]) {
5504
- const S = Kn(a, T, u);
5505
- return S === !1 && (ae(k.afterSanitizeElements, a, null), Re(a, u)) ? !0 : S;
5506
- }
5507
- if (Y(a) === Q.element && !Un(a) || (T === "noscript" || T === "noembed" || T === "noframes") && K(Pi, a.innerHTML))
5508
- return fe(a), !0;
5509
- if (de && a.nodeType === Q.text) {
5510
- const S = Ze(a.textContent);
5511
- a.textContent !== S && (_e(e.removed, { element: a.cloneNode() }), a.textContent = S);
5512
- }
5513
- return ae(k.afterSanitizeElements, a, null), Re(a, u);
5514
- }, nn = function(a, u, T) {
5515
- if (Dt[u] || Xt(u, a) || Ft && (u === "id" || u === "name") && (T in t || T in Fn)) return !1;
5516
- const S = N[u] || ue.attributeCheck instanceof Function && ue.attributeCheck(u, a);
5517
- return rt && K(An, u) || Nt && K(On, u) ? !0 : S ? Wt[u] || K(It, He(T, kt, "")) || (u === "src" || u === "xlink:href" || u === "href") && a !== "script" && dn(T, "data:") === 0 && Ut[a] || _t && !K(kn, He(T, kt, "")) ? !0 : !T : sn(a) && Qe(re.tagNameCheck, a) && Qe(re.attributeNameCheck, u, a) || u === "is" && re.allowCustomizedBuiltInElements && Qe(re.tagNameCheck, T);
5518
- }, jn = L({}, [
5782
+ allowedTags: N
5783
+ }), Re(l, u)) return !0;
5784
+ if (Xn(l, T))
5785
+ return fe(l), !0;
5786
+ if (De[T] || !(de.tagCheck instanceof Function && de.tagCheck(T)) && !N[T]) {
5787
+ const S = Qn(l, T, u);
5788
+ return S === !1 && (ae(I.afterSanitizeElements, l, null), Re(l, u)) ? !0 : S;
5789
+ }
5790
+ if (Y(l) === Q.element && !qn(l) || (T === "noscript" || T === "noembed" || T === "noframes") && K(ls, l.innerHTML))
5791
+ return fe(l), !0;
5792
+ if (ue && l.nodeType === Q.text) {
5793
+ const S = Xe(l.textContent);
5794
+ l.textContent !== S && (He(e.removed, { element: l.cloneNode() }), l.textContent = S);
5795
+ }
5796
+ return ae(I.afterSanitizeElements, l, null), Re(l, u);
5797
+ }, rn = function(l, u, T) {
5798
+ if (_t[u] || Jt(u, l) || $t && (u === "id" || u === "name") && (T in t || T in Vn)) return !1;
5799
+ const S = _[u] || de.attributeCheck instanceof Function && de.attributeCheck(u, l);
5800
+ return at && K(Hn, u) || Ht && K(Fn, u) ? !0 : S ? Kt[u] || K(Nt, Fe(T, Dt, "")) || (u === "src" || u === "xlink:href" || u === "href") && l !== "script" && yn(T, "data:") === 0 && Wt[l] || Ft && !K(Pn, Fe(T, Dt, "")) ? !0 : !T : on(l) && Je(re.tagNameCheck, l) && Je(re.attributeNameCheck, u, l) || u === "is" && re.allowCustomizedBuiltInElements && Je(re.tagNameCheck, T);
5801
+ }, Jn = L({}, [
5519
5802
  "annotation-xml",
5520
5803
  "color-profile",
5521
5804
  "font-face",
@@ -5524,201 +5807,201 @@ function Mn() {
5524
5807
  "font-face-src",
5525
5808
  "font-face-uri",
5526
5809
  "missing-glyph"
5527
- ]), sn = function(a) {
5528
- return !jn[Pe(a)] && K(In, a);
5529
- }, Gn = function(a, u, T, S) {
5530
- if (_ && typeof h == "object" && typeof h.getAttributeType == "function" && !T) switch (h.getAttributeType(a, u)) {
5810
+ ]), on = function(l) {
5811
+ return !Jn[$e(l)] && K($n, l);
5812
+ }, ei = function(l, u, T, S) {
5813
+ if (F && typeof c == "object" && typeof c.getAttributeType == "function" && !T) switch (c.getAttributeType(l, u)) {
5531
5814
  case "TrustedHTML":
5532
5815
  return ne(S);
5533
5816
  case "TrustedScriptURL":
5534
5817
  return le(S);
5535
5818
  }
5536
5819
  return S;
5537
- }, qn = function(a, u, T, S) {
5820
+ }, ti = function(l, u, T, S) {
5538
5821
  try {
5539
- return T ? a.setAttributeNS(T, u, S) : a.setAttribute(u, S), Xe(a) ? (fe(a), !1) : !0;
5822
+ return T ? l.setAttributeNS(T, u, S) : l.setAttribute(u, S), Qe(l) ? (fe(l), !1) : !0;
5540
5823
  } catch (v) {
5541
- return be(u, a), !1;
5824
+ return be(u, l), !1;
5542
5825
  }
5543
- }, rn = function(a, u) {
5544
- if (ae(k.beforeSanitizeAttributes, a, null), Re(a, u)) return;
5545
- const T = a.attributes;
5546
- if (!T || Xe(a)) return;
5547
- N = en(k.uponSanitizeAttribute, N, st, We);
5826
+ }, an = function(l, u) {
5827
+ if (ae(I.beforeSanitizeAttributes, l, null), Re(l, u)) return;
5828
+ const T = l.attributes;
5829
+ if (!T || Qe(l)) return;
5830
+ _ = nn(I.uponSanitizeAttribute, _, ot, Ve);
5548
5831
  const S = {
5549
5832
  attrName: "",
5550
5833
  attrValue: "",
5551
5834
  keepAttr: !0,
5552
- allowedAttributes: N,
5835
+ allowedAttributes: _,
5553
5836
  forceKeepAttr: void 0
5554
5837
  };
5555
5838
  let v = T.length;
5556
- const M = P(a.nodeName);
5839
+ const R = $(l.nodeName);
5557
5840
  for (; v--; ) {
5558
- const R = T[v], H = R.name, ee = R.namespaceURI, X = R.value, Le = P(H), yt = X;
5559
- let G = H === "value" ? yt : xi(yt), on = !1;
5560
- if (S.attrName = Le, S.attrValue = G, S.keepAttr = !0, S.forceKeepAttr = void 0, ae(k.uponSanitizeAttribute, a, S), G = S.attrValue, Pt && (Le === "id" || Le === "name") && dn(G, $t) !== 0 && (be(H, a, R), G = $t + G, on = !0), me && K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, G)) {
5561
- be(H, a, R);
5841
+ const A = T[v], P = A.name, ee = A.namespaceURI, X = A.value, Ae = $(P), Tt = X;
5842
+ let G = P === "value" ? Tt : Vi(Tt), ln = !1;
5843
+ if (S.attrName = Ae, S.attrValue = G, S.keepAttr = !0, S.forceKeepAttr = void 0, ae(I.uponSanitizeAttribute, l, S), G = S.attrValue, zt && (Ae === "id" || Ae === "name") && yn(G, Ut) !== 0 && (be(P, l, A), G = Ut + G, ln = !0), me && K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, G)) {
5844
+ be(P, l, A);
5562
5845
  continue;
5563
5846
  }
5564
- if (Le === "attributename" && un(G, "href")) {
5565
- be(H, a, R);
5847
+ if (Ae === "attributename" && mn(G, "href")) {
5848
+ be(P, l, A);
5566
5849
  continue;
5567
5850
  }
5568
5851
  if (!S.forceKeepAttr) {
5569
5852
  if (!S.keepAttr) {
5570
- be(H, a, R);
5853
+ be(P, l, A);
5571
5854
  continue;
5572
5855
  }
5573
- if (!Ht && K($i, G)) {
5574
- be(H, a, R);
5856
+ if (!Pt && K(cs, G)) {
5857
+ be(P, l, A);
5575
5858
  continue;
5576
5859
  }
5577
- if (de && (G = Ze(G)), !nn(M, Le, G)) {
5578
- be(H, a, R);
5860
+ if (ue && (G = Xe(G)), !rn(R, Ae, G)) {
5861
+ be(P, l, A);
5579
5862
  continue;
5580
5863
  }
5581
- G = Gn(M, Le, ee, G), G !== yt && qn(a, H, ee, G) && on && hn(e.removed);
5864
+ G = ei(R, Ae, ee, G), G !== Tt && ti(l, P, ee, G) && ln && pn(e.removed);
5582
5865
  }
5583
5866
  }
5584
- ae(k.afterSanitizeAttributes, a, null), Re(a, u);
5585
- }, Je = function(a) {
5867
+ ae(I.afterSanitizeAttributes, l, null), Re(l, u);
5868
+ }, et = function(l) {
5586
5869
  let u = null;
5587
- const T = Jt(a);
5588
- for (ae(k.beforeSanitizeShadowDOM, a, null); u = T.nextNode(); )
5589
- if (ae(k.uponSanitizeShadowNode, u, null), tn(u, a), rn(u, a), Me(u.content) && Je(u.content), Y(u) === Q.element) {
5870
+ const T = tn(l);
5871
+ for (ae(I.beforeSanitizeShadowDOM, l, null); u = T.nextNode(); )
5872
+ if (ae(I.uponSanitizeShadowNode, u, null), sn(u, l), an(u, l), Me(u.content) && et(u.content), Y(u) === Q.element) {
5590
5873
  const S = E(u);
5591
- Me(S) && (mt(S), Je(S));
5874
+ Me(S) && (bt(S), et(S));
5592
5875
  }
5593
- ae(k.afterSanitizeShadowDOM, a, null);
5594
- }, mt = function(a) {
5876
+ ae(I.afterSanitizeShadowDOM, l, null);
5877
+ }, bt = function(l) {
5595
5878
  const u = [{
5596
- node: a,
5879
+ node: l,
5597
5880
  shadow: null
5598
5881
  }];
5599
5882
  for (; u.length > 0; ) {
5600
5883
  const T = u.pop();
5601
5884
  if (T.shadow) {
5602
- Je(T.shadow);
5885
+ et(T.shadow);
5603
5886
  continue;
5604
5887
  }
5605
- const S = T.node, v = Y(S) === Q.element, M = b(S);
5606
- if (M) for (let R = M.length - 1; R >= 0; --R) u.push({
5607
- node: M[R],
5888
+ const S = T.node, v = Y(S) === Q.element, R = b(S);
5889
+ if (R) for (let A = R.length - 1; A >= 0; --A) u.push({
5890
+ node: R[A],
5608
5891
  shadow: null
5609
5892
  });
5610
5893
  if (v) {
5611
- const R = I ? I(S) : null;
5612
- if (typeof R == "string" && P(R) === "template") {
5613
- const H = S.content;
5614
- Me(H) && u.push({
5615
- node: H,
5894
+ const A = k ? k(S) : null;
5895
+ if (typeof A == "string" && $(A) === "template") {
5896
+ const P = S.content;
5897
+ Me(P) && u.push({
5898
+ node: P,
5616
5899
  shadow: null
5617
5900
  });
5618
5901
  }
5619
5902
  }
5620
5903
  if (v) {
5621
- const R = E(S);
5622
- Me(R) && u.push({
5904
+ const A = E(S);
5905
+ Me(A) && u.push({
5623
5906
  node: null,
5624
- shadow: R
5907
+ shadow: A
5625
5908
  }, {
5626
- node: R,
5909
+ node: A,
5627
5910
  shadow: null
5628
5911
  });
5629
5912
  }
5630
5913
  }
5631
5914
  };
5632
5915
  return e.sanitize = function(x) {
5633
- let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, T = null, S = null, v = null;
5634
- if (ht = !x, ht && (x = "<!-->"), typeof x != "string" && !Ne(x) && (x = Ci(x), typeof x != "string"))
5916
+ let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, T = null, S = null, v = null;
5917
+ if (ut = !x, ut && (x = "<!-->"), typeof x != "string" && !_e(x) && (x = Yi(x), typeof x != "string"))
5635
5918
  throw ge("dirty is not a string, aborting");
5636
5919
  if (!e.isSupported) return x;
5637
- ot ? (D = Be, N = We) : gt(a), (k.uponSanitizeElement.length > 0 || k.uponSanitizeAttribute.length > 0) && (D = J(D)), k.uponSanitizeAttribute.length > 0 && (N = J(N)), e.removed = [];
5638
- const M = ct && typeof x != "string" && Ne(x);
5639
- if (M) {
5640
- Wn(x);
5920
+ lt ? (N = We, _ = Ve) : mt(l), (I.uponSanitizeElement.length > 0 || I.uponSanitizeAttribute.length > 0) && (N = J(N)), I.uponSanitizeAttribute.length > 0 && (_ = J(_)), e.removed = [];
5921
+ const R = dt && typeof x != "string" && _e(x);
5922
+ if (R) {
5923
+ Zn(x);
5641
5924
  const ee = ie(x);
5642
5925
  if (typeof ee == "string") {
5643
- const X = P(ee);
5644
- if (!D[X] || Ie[X])
5645
- throw qe(x), ge("root node is forbidden and cannot be sanitized in-place");
5926
+ const X = $(ee);
5927
+ if (!N[X] || De[X])
5928
+ throw Ye(x), ge("root node is forbidden and cannot be sanitized in-place");
5646
5929
  }
5647
- if (Xe(x))
5648
- throw qe(x), ge("root node is clobbered and cannot be sanitized in-place");
5930
+ if (Qe(x))
5931
+ throw Ye(x), ge("root node is clobbered and cannot be sanitized in-place");
5649
5932
  try {
5650
- mt(x);
5933
+ bt(x);
5651
5934
  } catch (X) {
5652
- throw qe(x), X;
5935
+ throw Ye(x), X;
5653
5936
  }
5654
- } else if (Ne(x))
5655
- u = Qt("<!---->"), T = u.ownerDocument.importNode(x, !0), T.nodeType === Q.element && T.nodeName === "BODY" || T.nodeName === "HTML" ? u = T : u.appendChild(T), mt(u);
5937
+ } else if (_e(x))
5938
+ u = en("<!---->"), T = u.ownerDocument.importNode(x, !0), T.nodeType === Q.element && T.nodeName === "BODY" || T.nodeName === "HTML" ? u = T : u.appendChild(T), bt(u);
5656
5939
  else {
5657
- if (!Se && !de && !ye && x.indexOf("<") === -1) return _ && Ke ? ne(x) : x;
5658
- if (u = Qt(x), !u) return Se ? null : Ke ? U : "";
5940
+ if (!Se && !ue && !ye && x.indexOf("<") === -1) return F && je ? ne(x) : x;
5941
+ if (u = en(x), !u) return Se ? null : je ? U : "";
5659
5942
  }
5660
- u && at && fe(u.firstChild);
5661
- const R = M ? x : u;
5943
+ u && ct && fe(u.firstChild);
5944
+ const A = R ? x : u;
5662
5945
  try {
5663
- const ee = Jt(R);
5946
+ const ee = tn(A);
5664
5947
  for (; S = ee.nextNode(); )
5665
- tn(S, R), rn(S, R), Me(S.content) && Je(S.content);
5948
+ sn(S, A), an(S, A), Me(S.content) && et(S.content);
5666
5949
  } catch (ee) {
5667
- throw M && (qe(x), Te(e.removed, (X) => {
5668
- X.element && Ye(X.element);
5950
+ throw R && (Ye(x), Te(e.removed, (X) => {
5951
+ X.element && Ze(X.element);
5669
5952
  })), ee;
5670
5953
  }
5671
- if (M) {
5954
+ if (R) {
5672
5955
  let ee = !1;
5673
5956
  if (Te(e.removed, (X) => {
5674
- X.element && (X.element === x && (ee = !0), Ye(X.element));
5957
+ X.element && (X.element === x && (ee = !0), Ze(X.element));
5675
5958
  }), ee) throw ge("a node selected for removal could not be safely returned; refusing to sanitize in place");
5676
- return de && pt(x), x;
5959
+ return ue && yt(x), x;
5677
5960
  }
5678
5961
  if (Se) {
5679
- if (de && pt(u), Ve)
5680
- for (v = nt.call(u.ownerDocument); u.firstChild; ) v.appendChild(u.firstChild);
5962
+ if (ue && yt(u), Ke)
5963
+ for (v = st.call(u.ownerDocument); u.firstChild; ) v.appendChild(u.firstChild);
5681
5964
  else v = u;
5682
- return (N.shadowroot || N.shadowrootmode) && (v = he.call(n, v, !0)), v;
5965
+ return (_.shadowroot || _.shadowrootmode) && (v = he.call(n, v, !0)), v;
5683
5966
  }
5684
- let H = ye ? u.outerHTML : u.innerHTML;
5685
- return ye && D["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && K(Hi, u.ownerDocument.doctype.name) && (H = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
5686
- ` + H), de && (H = Ze(H)), _ && Ke ? ne(H) : H;
5967
+ let P = ye ? u.outerHTML : u.innerHTML;
5968
+ return ye && N["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && K(os, u.ownerDocument.doctype.name) && (P = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
5969
+ ` + P), ue && (P = Xe(P)), F && je ? ne(P) : P;
5687
5970
  }, e.setConfig = function() {
5688
5971
  let x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
5689
- gt(x), ot = !0, Be = D, We = N;
5972
+ mt(x), lt = !0, We = N, Ve = _;
5690
5973
  }, e.clearConfig = function() {
5691
- Ce = null, ot = !1, Be = null, We = null, _ = j, U = "";
5692
- }, e.isValidAttribute = function(x, a, u) {
5693
- Ce || gt({});
5694
- const T = P(x), S = P(a);
5695
- return nn(T, S, u);
5696
- }, e.addHook = function(x, a) {
5697
- typeof a == "function" && q(k, x) && _e(k[x], a);
5698
- }, e.removeHook = function(x, a) {
5699
- if (q(k, x)) {
5700
- if (a !== void 0) {
5701
- const u = bi(k[x], a);
5702
- return u === -1 ? void 0 : Ti(k[x], u, 1)[0];
5974
+ Ce = null, lt = !1, We = null, Ve = null, F = j, U = "";
5975
+ }, e.isValidAttribute = function(x, l, u) {
5976
+ Ce || mt({});
5977
+ const T = $(x), S = $(l);
5978
+ return rn(T, S, u);
5979
+ }, e.addHook = function(x, l) {
5980
+ typeof l == "function" && q(I, x) && He(I[x], l);
5981
+ }, e.removeHook = function(x, l) {
5982
+ if (q(I, x)) {
5983
+ if (l !== void 0) {
5984
+ const u = Bi(I[x], l);
5985
+ return u === -1 ? void 0 : Wi(I[x], u, 1)[0];
5703
5986
  }
5704
- return hn(k[x]);
5987
+ return pn(I[x]);
5705
5988
  }
5706
5989
  }, e.removeHooks = function(x) {
5707
- q(k, x) && (k[x] = []);
5990
+ q(I, x) && (I[x] = []);
5708
5991
  }, e.removeAllHooks = function() {
5709
- k = wn();
5992
+ I = Rn();
5710
5993
  }, e;
5711
5994
  }
5712
- var Vi = Mn();
5713
- function Ki(m) {
5714
- return m ? Vi.sanitize(m, {
5995
+ var gs = Dn();
5996
+ function ps(f) {
5997
+ return f ? gs.sanitize(f, {
5715
5998
  USE_PROFILES: { html: !0 },
5716
5999
  // <style> can restyle or exfiltrate through CSS; <form> and friends have no place in document content.
5717
6000
  FORBID_TAGS: ["style", "form", "input", "button", "textarea", "select", "option", "base", "meta", "link"],
5718
6001
  ADD_ATTR: ["target"]
5719
6002
  }) : "";
5720
6003
  }
5721
- const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Editor Dialog Styles */
6004
+ const Mt = '[data-theme="dark"], .dark, .editora-theme-dark', ms = `/* Source Editor Dialog Styles */
5722
6005
  .rte-source-editor-overlay {
5723
6006
  position: fixed !important;
5724
6007
  top: 0 !important;
@@ -6017,7 +6300,7 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6017
6300
  }
6018
6301
 
6019
6302
  .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
6020
- background: #3b82f6;
6303
+ background: #2563eb;
6021
6304
  color: #ffffff;
6022
6305
  }
6023
6306
 
@@ -6059,11 +6342,11 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6059
6342
  }
6060
6343
 
6061
6344
  .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
6062
- background: #3b82f6;
6345
+ background: #2563eb;
6063
6346
  }
6064
6347
 
6065
6348
  .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
6066
- background: #2563eb;
6349
+ background: #1d4ed8;
6067
6350
  }
6068
6351
 
6069
6352
  /* Responsive design */
@@ -6095,7 +6378,7 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6095
6378
  flex: 1;
6096
6379
  text-align: center;
6097
6380
  }
6098
- }`, Gi = () => ({
6381
+ }`, ys = () => ({
6099
6382
  name: "code",
6100
6383
  // Toolbar button configuration
6101
6384
  toolbar: [
@@ -6115,61 +6398,61 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6115
6398
  */
6116
6399
  toggleSourceView: () => {
6117
6400
  const e = (() => {
6118
- var o, l, c;
6401
+ var o, a, h;
6119
6402
  const s = window.getSelection();
6120
6403
  if (s && s.anchorNode) {
6121
- let h = s.anchorNode instanceof HTMLElement ? s.anchorNode : s.anchorNode.parentElement;
6122
- for (; h; ) {
6123
- if ((o = h.classList) != null && o.contains("rte-content"))
6124
- return h;
6125
- h = h.parentElement;
6404
+ let c = s.anchorNode instanceof HTMLElement ? s.anchorNode : s.anchorNode.parentElement;
6405
+ for (; c; ) {
6406
+ if ((o = c.classList) != null && o.contains("rte-content"))
6407
+ return c;
6408
+ c = c.parentElement;
6126
6409
  }
6127
6410
  }
6128
6411
  if (document.activeElement) {
6129
- let h = document.activeElement;
6130
- if ((l = h.classList) != null && l.contains("rte-content"))
6131
- return h;
6132
- for (; h && h !== document.body; ) {
6133
- if ((c = h.classList) != null && c.contains("rte-content"))
6134
- return h;
6135
- const d = h.querySelector(
6412
+ let c = document.activeElement;
6413
+ if ((a = c.classList) != null && a.contains("rte-content"))
6414
+ return c;
6415
+ for (; c && c !== document.body; ) {
6416
+ if ((h = c.classList) != null && h.contains("rte-content"))
6417
+ return c;
6418
+ const d = c.querySelector(
6136
6419
  ".rte-content"
6137
6420
  );
6138
6421
  if (d) return d;
6139
- h = h.parentElement;
6422
+ c = c.parentElement;
6140
6423
  }
6141
6424
  }
6142
6425
  const r = document.querySelector("[data-editora-editor]");
6143
6426
  if (r) {
6144
- const h = r.querySelector(
6427
+ const c = r.querySelector(
6145
6428
  ".rte-content"
6146
6429
  );
6147
- if (h) return h;
6430
+ if (c) return c;
6148
6431
  }
6149
6432
  return document.querySelector(".rte-content");
6150
6433
  })();
6151
6434
  if (!e)
6152
- return console.error("[CodePlugin] Editor content area not found"), alert(
6435
+ return console.error("[CodePlugin] Editor content area not found"), dn(
6153
6436
  "Editor content area not found. Please click inside the editor first."
6154
6437
  ), !1;
6155
6438
  const t = e.innerHTML, n = (s) => {
6156
6439
  let r = "", o = 0;
6157
- const l = 2, c = s.split(/(<\/?[a-zA-Z][^>]*>)/);
6158
- for (const h of c)
6159
- h.trim() && (h.match(/^<\/[a-zA-Z]/) ? (o = Math.max(0, o - 1), r += `
6160
- ` + " ".repeat(o * l) + h) : h.match(/^<[a-zA-Z]/) && !h.match(/\/>$/) ? (r += `
6161
- ` + " ".repeat(o * l) + h, o++) : h.match(/^<[a-zA-Z].*\/>$/) ? r += `
6162
- ` + " ".repeat(o * l) + h : r += h.trim());
6440
+ const a = 2, h = s.split(/(<\/?[a-zA-Z][^>]*>)/);
6441
+ for (const c of h)
6442
+ c.trim() && (c.match(/^<\/[a-zA-Z]/) ? (o = Math.max(0, o - 1), r += `
6443
+ ` + " ".repeat(o * a) + c) : c.match(/^<[a-zA-Z]/) && !c.match(/\/>$/) ? (r += `
6444
+ ` + " ".repeat(o * a) + c, o++) : c.match(/^<[a-zA-Z].*\/>$/) ? r += `
6445
+ ` + " ".repeat(o * a) + c : r += c.trim());
6163
6446
  return r.trim();
6164
6447
  };
6165
6448
  return (() => {
6166
6449
  document.querySelectorAll(".rte-source-editor-overlay").forEach((O) => O.remove());
6167
6450
  const r = n(t);
6168
- let o = null, l = "dark", c = !1, h = !1, d = !1, f = !1;
6169
- const y = !!e.closest(Et) || document.body.matches(Et) || document.documentElement.matches(Et), g = document.createElement("div");
6170
- Xn(g), g.className = "rte-source-editor-overlay", y && g.classList.add("rte-theme-dark");
6171
- const p = document.createElement("div");
6172
- p.className = "rte-source-editor-modal", p.setAttribute("role", "dialog"), p.setAttribute("aria-modal", "true"), p.setAttribute("aria-labelledby", "source-editor-title");
6451
+ let o = null, a = "dark", h = !1, c = !1, d = !1, g = !1;
6452
+ const m = !!e.closest(Mt) || document.body.matches(Mt) || document.documentElement.matches(Mt), p = document.createElement("div");
6453
+ An(p), p.className = "rte-source-editor-overlay", m && p.classList.add("rte-theme-dark");
6454
+ const y = document.createElement("div");
6455
+ y.className = "rte-source-editor-modal", y.setAttribute("role", "dialog"), y.setAttribute("aria-modal", "true"), y.setAttribute("aria-labelledby", "source-editor-title");
6173
6456
  const b = document.createElement("div");
6174
6457
  b.className = "rte-source-editor-header", b.innerHTML = `
6175
6458
  <h2 id="source-editor-title">Source Editor</h2>
@@ -6212,12 +6495,12 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6212
6495
  w.className = "rte-source-editor-body";
6213
6496
  const E = document.createElement("div");
6214
6497
  E.className = "rte-source-editor-content";
6215
- const F = document.createElement("div");
6216
- F.className = "rte-source-editor-warning", F.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
6217
- const A = document.createElement("div");
6218
- A.className = "rte-source-editor-light-editor", A.style.height = "400px", E.appendChild(F), E.appendChild(A), w.appendChild(E);
6219
- const I = document.createElement("div");
6220
- if (I.className = "rte-source-editor-footer", I.innerHTML = `
6498
+ const D = document.createElement("div");
6499
+ D.className = "rte-source-editor-warning", D.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
6500
+ const M = document.createElement("div");
6501
+ M.className = "rte-source-editor-light-editor", M.style.height = "400px", E.appendChild(D), E.appendChild(M), w.appendChild(E);
6502
+ const k = document.createElement("div");
6503
+ if (k.className = "rte-source-editor-footer", k.innerHTML = `
6221
6504
  <div class="rte-source-editor-footer-info">
6222
6505
  <span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
6223
6506
  </div>
@@ -6225,40 +6508,40 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6225
6508
  <button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
6226
6509
  <button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
6227
6510
  </div>
6228
- `, p.appendChild(b), p.appendChild(w), p.appendChild(I), g.appendChild(p), !document.getElementById("rte-source-editor-styles")) {
6511
+ `, y.appendChild(b), y.appendChild(w), y.appendChild(k), p.appendChild(y), !document.getElementById("rte-source-editor-styles")) {
6229
6512
  const O = document.createElement("style");
6230
- O.id = "rte-source-editor-styles", O.textContent = ji, document.head.appendChild(O);
6513
+ O.id = "rte-source-editor-styles", O.textContent = ms, document.head.appendChild(O);
6231
6514
  }
6232
- const $ = b.querySelector(
6515
+ const H = b.querySelector(
6233
6516
  ".theme-toggle-btn"
6234
6517
  ), Y = b.querySelector(
6235
6518
  ".readonly-toggle-btn"
6236
6519
  ), ie = b.querySelector(
6237
6520
  ".rte-source-editor-fullscreen-btn"
6238
- ), _ = b.querySelector(
6521
+ ), F = b.querySelector(
6239
6522
  ".rte-source-editor-close-btn"
6240
- ), U = I.querySelector(
6523
+ ), U = k.querySelector(
6241
6524
  ".rte-source-editor-btn-cancel"
6242
- ), j = I.querySelector(
6525
+ ), j = k.querySelector(
6243
6526
  ".rte-source-editor-btn-save"
6244
- ), ce = I.querySelector(
6527
+ ), ce = k.querySelector(
6245
6528
  ".unsaved-changes"
6246
- ), se = [], Z = (O, he, k, Ue) => {
6247
- O.addEventListener(he, k, Ue), se.push(
6248
- () => O.removeEventListener(he, k, Ue)
6529
+ ), se = [], Z = (O, he, I, Be) => {
6530
+ O.addEventListener(he, I, Be), se.push(
6531
+ () => O.removeEventListener(he, I, Be)
6249
6532
  );
6250
6533
  }, ne = (O) => {
6251
6534
  d !== O && (d = O, ce && (ce.style.display = d ? "inline" : "none"));
6252
6535
  }, le = () => {
6253
- if (!f) {
6254
- for (f = !0; se.length; ) {
6536
+ if (!g) {
6537
+ for (g = !0; se.length; ) {
6255
6538
  const O = se.pop();
6256
6539
  O == null || O();
6257
6540
  }
6258
- o && (o.destroy(), o = null), g.isConnected && g.remove();
6541
+ o && (o.destroy(), o = null), p.isConnected && p.remove();
6259
6542
  }
6260
- }, tt = () => {
6261
- l = l === "dark" ? "light" : "dark", o == null || o.setTheme(l), $ && ($.innerHTML = l === "light" ? `
6543
+ }, it = () => {
6544
+ a = a === "dark" ? "light" : "dark", o == null || o.setTheme(a), H && (H.innerHTML = a === "light" ? `
6262
6545
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
6263
6546
  <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
6264
6547
  </svg>
@@ -6276,7 +6559,7 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6276
6559
  </svg>
6277
6560
  `);
6278
6561
  }, xe = () => {
6279
- c = !c, o == null || o.setReadOnly(c), Y && (Y.classList.toggle("active", c), Y.innerHTML = c ? `
6562
+ h = !h, o == null || o.setReadOnly(h), Y && (Y.classList.toggle("active", h), Y.innerHTML = h ? `
6280
6563
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
6281
6564
  <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
6282
6565
  <circle cx="12" cy="16" r="1"/>
@@ -6288,8 +6571,8 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6288
6571
  <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
6289
6572
  </svg>
6290
6573
  `);
6291
- }, ke = () => {
6292
- h = !h, g.classList.toggle("fullscreen", h), A.style.height = h ? "calc(100vh - 200px)" : "400px", ie && (ie.innerHTML = h ? `
6574
+ }, Ie = () => {
6575
+ c = !c, p.classList.toggle("fullscreen", c), M.style.height = c ? "calc(100vh - 200px)" : "400px", ie && (ie.innerHTML = c ? `
6293
6576
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
6294
6577
  <path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
6295
6578
  </svg>
@@ -6298,12 +6581,18 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6298
6581
  <path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
6299
6582
  </svg>
6300
6583
  `);
6301
- }, ze = () => {
6302
- d && !confirm("You have unsaved changes. Are you sure you want to cancel?") || le();
6303
- }, nt = () => {
6584
+ }, Ue = async () => {
6585
+ d && !await bi("You have unsaved changes. Are you sure you want to cancel?", {
6586
+ title: "Discard changes?",
6587
+ confirmText: "Discard changes",
6588
+ cancelText: "Keep editing",
6589
+ danger: !0,
6590
+ context: e
6591
+ }) || le();
6592
+ }, st = () => {
6304
6593
  try {
6305
6594
  const O = (o == null ? void 0 : o.getValue()) || "";
6306
- e.innerHTML = Ki(O);
6595
+ e.innerHTML = ps(O);
6307
6596
  try {
6308
6597
  e.dispatchEvent(
6309
6598
  new InputEvent("input", {
@@ -6321,29 +6610,29 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6321
6610
  new Event("change", { bubbles: !0 })
6322
6611
  ), ne(!1), le();
6323
6612
  } catch (O) {
6324
- alert("Failed to update HTML. Please check your syntax."), console.error("HTML update error:", O);
6613
+ dn("Failed to update HTML. Please check your syntax.", "error"), console.error("HTML update error:", O);
6325
6614
  }
6326
6615
  };
6327
- $ && Z($, "click", tt), Y && Z(Y, "click", xe), ie && Z(ie, "click", ke), _ && Z(_, "click", le), U && Z(U, "click", ze), j && Z(j, "click", nt), Z(g, "click", (O) => {
6328
- O.target === g && le();
6616
+ H && Z(H, "click", it), Y && Z(Y, "click", xe), ie && Z(ie, "click", Ie), F && Z(F, "click", le), U && Z(U, "click", Ue), j && Z(j, "click", st), Z(p, "click", (O) => {
6617
+ O.target === p && le();
6329
6618
  }), Z(document, "keydown", (O) => {
6330
6619
  const he = O;
6331
6620
  he.key === "Escape" && (he.preventDefault(), le());
6332
- }), document.body.appendChild(g), requestAnimationFrame(() => {
6333
- if (!(f || !g.isConnected))
6621
+ }), document.body.appendChild(p), requestAnimationFrame(() => {
6622
+ if (!(g || !p.isConnected))
6334
6623
  try {
6335
- o = ci(A, {
6624
+ o = Di(M, {
6336
6625
  value: r,
6337
6626
  theme: "dark",
6338
6627
  readOnly: !1,
6339
6628
  extensions: [
6340
- new ti(),
6341
- new ni(),
6342
- new ii(),
6343
- new oi(),
6344
- new Rt(),
6345
- new ai(),
6346
- new li()
6629
+ new Ci(),
6630
+ new Mi(),
6631
+ new Ri(),
6632
+ new ki(),
6633
+ new Lt(),
6634
+ new Oi(),
6635
+ new Ii()
6347
6636
  ]
6348
6637
  }), o.on("change", () => {
6349
6638
  const O = (o == null ? void 0 : o.getValue()) || "";
@@ -6363,6 +6652,6 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
6363
6652
  }
6364
6653
  });
6365
6654
  export {
6366
- Gi as CodePlugin
6655
+ ys as CodePlugin
6367
6656
  };
6368
- //# sourceMappingURL=CodePlugin.native-DZgIez08.mjs.map
6657
+ //# sourceMappingURL=CodePlugin.native-CPfKDrkr.mjs.map