@editora/core 1.0.21 → 1.0.23
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.
- package/README.md +247 -243
- package/dist/{CodePlugin.native-AoJ_idGz.mjs → CodePlugin.native-CAHk9ecG.mjs} +211 -93
- package/dist/{CodePlugin.native-CEgR1DWC.mjs → CodePlugin.native-DZgIez08.mjs} +371 -253
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/{index-Ct3Aik7_.js → index-C1sO7DAC.js} +2 -2
- package/dist/{index-6i4_TH66.mjs → index-DGMYWPLx.mjs} +3 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/webcomponent-core.js +3 -1
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +16 -15
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +3 -1
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +64 -63
- package/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -135,7 +135,7 @@ class Ot {
|
|
|
135
135
|
}
|
|
136
136
|
class Qn {
|
|
137
137
|
constructor(e) {
|
|
138
|
-
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.container = e, this.createDOM();
|
|
138
|
+
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
139
|
}
|
|
140
140
|
createDOM() {
|
|
141
141
|
this.container.innerHTML = "";
|
|
@@ -240,11 +240,121 @@ class Qn {
|
|
|
240
240
|
}
|
|
241
241
|
// Update line numbers
|
|
242
242
|
updateLineNumbers(e) {
|
|
243
|
-
|
|
243
|
+
this.updateGutterWidth(e), this.queueWrapMeasure(), e !== this.lastLineCount && (this.lastLineCount = e, this.syncGutterRows(Math.max(e, 1)));
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* One row per line, numbered in order, so a different number of lines only adds rows at the end or takes them
|
|
247
|
+
* away from it. The rows that stay keep their heights (see applyMeasuredHeights).
|
|
248
|
+
*/
|
|
249
|
+
syncGutterRows(e) {
|
|
250
|
+
const t = this.lineNumbersContentElement;
|
|
251
|
+
for (; t.children.length > e; )
|
|
252
|
+
t.lastElementChild.remove();
|
|
253
|
+
let n = "";
|
|
254
|
+
for (let i = t.children.length + 1; i <= e; i += 1)
|
|
255
|
+
n += `<div style="height: ${this.lineHeight}px; line-height: ${this.lineHeight}px;">${i}</div>`;
|
|
256
|
+
n && t.insertAdjacentHTML("beforeend", n);
|
|
257
|
+
}
|
|
258
|
+
/** Where a line starts, in pixels from the top of the content. */
|
|
259
|
+
lineTop(e) {
|
|
260
|
+
var t;
|
|
261
|
+
return (t = this.measuredTops[e]) != null ? t : e * this.lineHeight;
|
|
262
|
+
}
|
|
263
|
+
/** How tall a line is: one row, or as many as it wraps to. */
|
|
264
|
+
lineHeightAt(e) {
|
|
265
|
+
var t, n;
|
|
266
|
+
return (n = (t = this.measuredHeights) == null ? void 0 : t[e]) != null ? n : this.lineHeight;
|
|
267
|
+
}
|
|
268
|
+
queueWrapMeasure() {
|
|
269
|
+
!this.lineWrapping || this.measureQueued || this.destroyed || (this.measureQueued = !0, Promise.resolve().then(() => {
|
|
270
|
+
this.measureQueued = !1, this.measureWrappedLines();
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Finds out how many rows each line wraps to, by laying the same text out one block per line in a hidden copy
|
|
275
|
+
* of the content, and sizes the line numbers to match. Done in one layout pass: all blocks are built, then all
|
|
276
|
+
* heights are read.
|
|
277
|
+
*/
|
|
278
|
+
measureWrappedLines() {
|
|
279
|
+
if (!this.lineWrapping || this.destroyed || !this.contentElement.isConnected) return;
|
|
280
|
+
const e = this.contentElement.__lceFoldPlaceholderSources, t = this.lineNumbersContentElement.children, n = (this.contentElement.textContent || "").split(`
|
|
281
|
+
`), i = this.contentElement.clientWidth;
|
|
282
|
+
if (e && e.size > 0 || t.length !== n.length || i === 0) {
|
|
283
|
+
this.applyMeasuredHeights(null);
|
|
244
284
|
return;
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
285
|
+
}
|
|
286
|
+
const s = this.wrapSignature(i), r = this.measuredLines, o = this.measuredHeights;
|
|
287
|
+
let l;
|
|
288
|
+
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;
|
|
292
|
+
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));
|
|
295
|
+
} else
|
|
296
|
+
l = this.measureLines(n, i);
|
|
297
|
+
this.measuredLines = n, this.measuredSignature = s, this.applyMeasuredHeights(l);
|
|
298
|
+
}
|
|
299
|
+
/** 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
|
+
measureLines(e, t) {
|
|
301
|
+
if (e.length === 0) return [];
|
|
302
|
+
const n = this.ensureMeasurer(t);
|
|
303
|
+
n.innerHTML = e.map((s) => `<div>${s === "" ? "​" : s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</div>`).join("");
|
|
304
|
+
const i = Array.from(n.children, (s) => s.offsetHeight);
|
|
305
|
+
return n.textContent = "", i;
|
|
306
|
+
}
|
|
307
|
+
/** What the height of a line depends on besides its text. When this changes, every line is measured again. */
|
|
308
|
+
wrapSignature(e) {
|
|
309
|
+
const t = getComputedStyle(this.contentElement);
|
|
310
|
+
return [
|
|
311
|
+
e,
|
|
312
|
+
t.fontFamily,
|
|
313
|
+
t.fontSize,
|
|
314
|
+
t.fontWeight,
|
|
315
|
+
t.letterSpacing,
|
|
316
|
+
t.tabSize,
|
|
317
|
+
t.paddingLeft,
|
|
318
|
+
t.paddingRight,
|
|
319
|
+
t.whiteSpace,
|
|
320
|
+
t.overflowWrap,
|
|
321
|
+
t.wordBreak
|
|
322
|
+
].join("|");
|
|
323
|
+
}
|
|
324
|
+
ensureMeasurer(e) {
|
|
325
|
+
if (!this.measurer) {
|
|
326
|
+
const t = document.createElement("div");
|
|
327
|
+
t.setAttribute("aria-hidden", "true"), t.setAttribute("data-editor-measurer", "true"), this.contentSurface.appendChild(t), this.measurer = t;
|
|
328
|
+
}
|
|
329
|
+
return this.measurer.style.cssText = this.contentElement.style.cssText, Object.assign(this.measurer.style, {
|
|
330
|
+
position: "absolute",
|
|
331
|
+
top: "0",
|
|
332
|
+
left: "0",
|
|
333
|
+
zIndex: "-1",
|
|
334
|
+
visibility: "hidden",
|
|
335
|
+
pointerEvents: "none",
|
|
336
|
+
width: `${e}px`,
|
|
337
|
+
minWidth: "0",
|
|
338
|
+
minHeight: "0",
|
|
339
|
+
height: "auto"
|
|
340
|
+
}), this.measurer;
|
|
341
|
+
}
|
|
342
|
+
applyMeasuredHeights(e) {
|
|
343
|
+
var s, r;
|
|
344
|
+
const t = this.measuredHeights;
|
|
345
|
+
if (t === e || t !== null && e !== null && t.length === e.length && t.every((o, l) => o === e[l])) return;
|
|
346
|
+
if (this.measuredHeights = e, this.measuredTops = [], e) {
|
|
347
|
+
let o = 0;
|
|
348
|
+
for (const l of e)
|
|
349
|
+
this.measuredTops.push(o), o += l;
|
|
350
|
+
} else
|
|
351
|
+
this.measuredLines = null;
|
|
352
|
+
const i = this.lineNumbersContentElement.children;
|
|
353
|
+
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`);
|
|
356
|
+
}
|
|
357
|
+
this.lastLineDecorationSnapshot = "", this.lastGutterDecorationSnapshot = "", this.renderLineDecorations(this.lineDecorations), this.renderGutterDecorations(this.gutterDecorations);
|
|
248
358
|
}
|
|
249
359
|
updateGutterWidth(e) {
|
|
250
360
|
const n = String(Math.max(e, 1)).length * this.gutterDigitWidth + this.gutterLineNumberPaddingLeft + this.gutterLineNumberPaddingRight, i = Math.ceil(
|
|
@@ -253,7 +363,7 @@ class Qn {
|
|
|
253
363
|
i !== this.gutterWidth && (this.gutterWidth = i, this.lineNumbersElement.style.display !== "none" && (this.lineNumbersElement.style.width = `${this.gutterWidth}px`, this.lineNumbersElement.style.minWidth = `${this.gutterWidth}px`));
|
|
254
364
|
}
|
|
255
365
|
setDecorations(e, t) {
|
|
256
|
-
this.renderLineDecorations(e), this.renderGutterDecorations(t);
|
|
366
|
+
this.lineDecorations = e, this.gutterDecorations = t, this.renderLineDecorations(e), this.renderGutterDecorations(t);
|
|
257
367
|
}
|
|
258
368
|
clearDecorations() {
|
|
259
369
|
this.lastLineDecorationSnapshot && (this.lineDecorationsElement.innerHTML = "", this.lastLineDecorationSnapshot = ""), this.lastGutterDecorationSnapshot && (this.gutterDecorationsElement.innerHTML = "", this.lastGutterDecorationSnapshot = "");
|
|
@@ -294,7 +404,8 @@ class Qn {
|
|
|
294
404
|
this.updateLineNumbers(n);
|
|
295
405
|
}
|
|
296
406
|
setLineWrapping(e) {
|
|
297
|
-
|
|
407
|
+
var t;
|
|
408
|
+
this.lineWrapping = e, e ? (!this.resizeObserver && typeof ResizeObserver != "undefined" && (this.resizeObserver = new ResizeObserver(() => this.queueWrapMeasure()), this.resizeObserver.observe(this.contentElement)), this.queueWrapMeasure()) : ((t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = null, this.applyMeasuredHeights(null)), this.contentElement.style.whiteSpace = e ? "pre-wrap" : "pre", this.contentElement.style.overflow = "visible", this.contentElement.style.minWidth = e ? "100%" : "max-content", this.contentSurface.style.minWidth = e ? "100%" : "max-content", this.contentElement.style.wordBreak = "normal", this.contentElement.style.overflowWrap = e ? "anywhere" : "normal", this.highlightElement.style.whiteSpace = e ? "pre-wrap" : "pre", this.highlightElement.style.wordBreak = "normal", this.highlightElement.style.overflowWrap = e ? "anywhere" : "normal";
|
|
298
409
|
}
|
|
299
410
|
setLineNumbersVisible(e) {
|
|
300
411
|
this.lineNumbersElement.style.display = e ? "table-cell" : "none", this.lineNumbersElement.style.width = e ? `${this.gutterWidth}px` : "0", this.lineNumbersElement.style.minWidth = e ? `${this.gutterWidth}px` : "0", this.lineNumbersElement.style.borderRightWidth = e ? "1px" : "0", this.scrollWrapper.style.width = "100%", this.scrollWrapper.style.minWidth = "100%";
|
|
@@ -495,7 +606,7 @@ class Qn {
|
|
|
495
606
|
}
|
|
496
607
|
// Scroll to position
|
|
497
608
|
scrollToPosition(e) {
|
|
498
|
-
const
|
|
609
|
+
const t = Math.max(0, Math.floor(e.line) || 0), i = this.lineTop(t) - this.editorContainer.clientHeight / 2 + this.lineHeight / 2;
|
|
499
610
|
this.editorContainer.scrollTop = Math.max(0, i);
|
|
500
611
|
}
|
|
501
612
|
// Get scroll position
|
|
@@ -532,7 +643,8 @@ class Qn {
|
|
|
532
643
|
}
|
|
533
644
|
// Destroy the view
|
|
534
645
|
destroy() {
|
|
535
|
-
|
|
646
|
+
var e;
|
|
647
|
+
this.destroyed = !0, (e = this.resizeObserver) == null || e.disconnect(), this.resizeObserver = null, this.clearDecorations(), this.container && (this.container.innerHTML = ""), this._rafId && (cancelAnimationFrame(this._rafId), this._rafId = void 0);
|
|
536
648
|
}
|
|
537
649
|
resolveOffsetToDomPoint(e) {
|
|
538
650
|
var s;
|
|
@@ -544,7 +656,7 @@ class Qn {
|
|
|
544
656
|
if (o instanceof Text) {
|
|
545
657
|
const l = o.textContent || "", c = this.buildVisibleToDomMap(l), h = Math.max(0, c.length - 1);
|
|
546
658
|
if (n + h >= t) {
|
|
547
|
-
const
|
|
659
|
+
const d = Math.max(0, t - n), f = (s = c[d]) != null ? s : l.length;
|
|
548
660
|
return { node: o, offset: f };
|
|
549
661
|
}
|
|
550
662
|
n += h;
|
|
@@ -606,16 +718,16 @@ class Qn {
|
|
|
606
718
|
return n;
|
|
607
719
|
const i = e.focusNode, s = e.focusOffset;
|
|
608
720
|
if (i instanceof Text) {
|
|
609
|
-
const h = (l = (o = i.textContent) == null ? void 0 : o.length) != null ? l : 0,
|
|
721
|
+
const h = (l = (o = i.textContent) == null ? void 0 : o.length) != null ? l : 0, d = document.createRange();
|
|
610
722
|
if (s < h) {
|
|
611
|
-
|
|
612
|
-
const f = this.getUsableRangeRect(
|
|
723
|
+
d.setStart(i, s), d.setEnd(i, Math.min(h, s + 1));
|
|
724
|
+
const f = this.getUsableRangeRect(d);
|
|
613
725
|
if (f)
|
|
614
726
|
return f;
|
|
615
727
|
}
|
|
616
728
|
if (s > 0) {
|
|
617
|
-
|
|
618
|
-
const f = this.getUsableRangeRect(
|
|
729
|
+
d.setStart(i, s - 1), d.setEnd(i, s);
|
|
730
|
+
const f = this.getUsableRangeRect(d);
|
|
619
731
|
if (f)
|
|
620
732
|
return f;
|
|
621
733
|
}
|
|
@@ -761,8 +873,8 @@ class Qn {
|
|
|
761
873
|
s.className
|
|
762
874
|
), r.setAttribute("data-decoration-id", s.id), r.setAttribute("data-decoration-line", String(s.line)), r.style.cssText = this.joinStyleFragments([
|
|
763
875
|
"position: absolute",
|
|
764
|
-
`top: ${s.line
|
|
765
|
-
`height: ${this.
|
|
876
|
+
`top: ${this.lineTop(s.line)}px`,
|
|
877
|
+
`height: ${this.lineHeightAt(s.line)}px`,
|
|
766
878
|
"left: 12px",
|
|
767
879
|
"right: 12px",
|
|
768
880
|
"border-radius: 3px",
|
|
@@ -785,8 +897,8 @@ class Qn {
|
|
|
785
897
|
s.className
|
|
786
898
|
), r.setAttribute("data-decoration-id", s.id), r.setAttribute("data-decoration-line", String(s.line)), r.style.cssText = this.joinStyleFragments([
|
|
787
899
|
"position: absolute",
|
|
788
|
-
`top: ${s.line
|
|
789
|
-
`height: ${this.
|
|
900
|
+
`top: ${this.lineTop(s.line)}px`,
|
|
901
|
+
`height: ${this.lineHeightAt(s.line)}px`,
|
|
790
902
|
"left: 0",
|
|
791
903
|
"right: 0",
|
|
792
904
|
"display: flex",
|
|
@@ -861,7 +973,7 @@ class Qn {
|
|
|
861
973
|
let Jn = 0;
|
|
862
974
|
const V = class V {
|
|
863
975
|
constructor(e, t = {}) {
|
|
864
|
-
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.config = {
|
|
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 = {
|
|
865
977
|
value: "",
|
|
866
978
|
theme: "default",
|
|
867
979
|
readOnly: !1,
|
|
@@ -963,15 +1075,21 @@ const V = class V {
|
|
|
963
1075
|
position: n,
|
|
964
1076
|
anchor: (r = (s = t.range) == null ? void 0 : s.start) != null ? r : n
|
|
965
1077
|
}), this.emit("selection", t.isCollapsed ? void 0 : t.range);
|
|
966
|
-
}, document.addEventListener("selectionchange", this.documentSelectionChangeHandler), e.addEventListener("
|
|
967
|
-
this.
|
|
1078
|
+
}, document.addEventListener("selectionchange", this.documentSelectionChangeHandler), e.addEventListener("blur", () => {
|
|
1079
|
+
this.tabReleased = !1;
|
|
1080
|
+
}), e.addEventListener("keydown", (t) => {
|
|
1081
|
+
if (this.emit("keydown", t), t.key === "Tab" && this.tabReleased && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
1082
|
+
this.tabReleased = !1;
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
t.key !== "Escape" && t.key !== "Shift" && t.key !== "Control" && t.key !== "Alt" && t.key !== "Meta" && (this.tabReleased = !1);
|
|
968
1086
|
const n = Array.from(this.extensions.values()).reverse();
|
|
969
1087
|
for (const r of n)
|
|
970
1088
|
if (r.onKeyDown && r.onKeyDown(t) === !1) {
|
|
971
1089
|
t.preventDefault(), t.stopPropagation();
|
|
972
1090
|
return;
|
|
973
1091
|
}
|
|
974
|
-
if (t.key === "Tab" && !this.config.readOnly) {
|
|
1092
|
+
if (t.key === "Escape" && !t.defaultPrevented && (this.tabReleased = !0), t.key === "Tab" && !this.config.readOnly) {
|
|
975
1093
|
t.shiftKey ? this.shiftSelectedLines(!0) : this.insertTab(), t.preventDefault(), t.stopPropagation();
|
|
976
1094
|
return;
|
|
977
1095
|
}
|
|
@@ -1152,17 +1270,17 @@ const V = class V {
|
|
|
1152
1270
|
...t
|
|
1153
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();
|
|
1154
1272
|
if (n.regex) {
|
|
1155
|
-
let
|
|
1273
|
+
let d;
|
|
1156
1274
|
try {
|
|
1157
|
-
|
|
1275
|
+
d = new RegExp(e, n.caseSensitive ? "g" : "gi");
|
|
1158
1276
|
} catch (y) {
|
|
1159
1277
|
return [];
|
|
1160
1278
|
}
|
|
1161
1279
|
let f;
|
|
1162
|
-
for (; (f =
|
|
1280
|
+
for (; (f = d.exec(r)) !== null; ) {
|
|
1163
1281
|
const y = (h = f[0]) != null ? h : "";
|
|
1164
1282
|
if (y.length === 0) {
|
|
1165
|
-
|
|
1283
|
+
d.lastIndex = f.index + 1;
|
|
1166
1284
|
continue;
|
|
1167
1285
|
}
|
|
1168
1286
|
const g = f.index, p = f.index + y.length;
|
|
@@ -1175,7 +1293,7 @@ const V = class V {
|
|
|
1175
1293
|
);
|
|
1176
1294
|
}
|
|
1177
1295
|
} else {
|
|
1178
|
-
let
|
|
1296
|
+
let d = 0, f = l.indexOf(c, d);
|
|
1179
1297
|
for (; f !== -1; ) {
|
|
1180
1298
|
const y = f + c.length;
|
|
1181
1299
|
!n.wholeWord || this.isWholeWordBoundary(r, f, y) ? (this.pushSearchResultFromOffsets(
|
|
@@ -1184,14 +1302,14 @@ const V = class V {
|
|
|
1184
1302
|
y,
|
|
1185
1303
|
r,
|
|
1186
1304
|
o
|
|
1187
|
-
),
|
|
1305
|
+
), d = y) : d = f + 1, f = l.indexOf(c, d);
|
|
1188
1306
|
}
|
|
1189
1307
|
}
|
|
1190
1308
|
return i;
|
|
1191
1309
|
}
|
|
1192
1310
|
pushSearchResultFromOffsets(e, t, n, i, s) {
|
|
1193
|
-
var h,
|
|
1194
|
-
const r = (h = s[t]) != null ? h : t, o = (
|
|
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);
|
|
1195
1313
|
e.push({
|
|
1196
1314
|
range: { start: l, end: c },
|
|
1197
1315
|
match: i.substring(t, n)
|
|
@@ -1283,10 +1401,10 @@ const V = class V {
|
|
|
1283
1401
|
}
|
|
1284
1402
|
const s = !t && !this.expectingProgrammaticCursor;
|
|
1285
1403
|
let r, o, l, c;
|
|
1286
|
-
const h = this.view.getSelectionState(),
|
|
1287
|
-
(t || s) &&
|
|
1288
|
-
const f =
|
|
1289
|
-
typeof this.view.setHighlightHTML == "function" ? this.view.setHighlightHTML(g) : this.view.setHTML(g), this.view.syncTrailingNewlineMarkerForText(e), (t || s) &&
|
|
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(() => {
|
|
1290
1408
|
try {
|
|
1291
1409
|
if (f && this.restoreCursorFromSentinel()) {
|
|
1292
1410
|
this.view.ensureCaretVisible();
|
|
@@ -1402,7 +1520,7 @@ const V = class V {
|
|
|
1402
1520
|
const o = " ".repeat(this.config.tabSize || 2), l = t.lastIndexOf(`
|
|
1403
1521
|
`, s - 1) + 1, c = r > s && t[r - 1] === `
|
|
1404
1522
|
` ? r - 1 : r, h = t.indexOf(`
|
|
1405
|
-
`, c),
|
|
1523
|
+
`, c), d = h === -1 ? t.length : h, f = t.slice(l, d).split(`
|
|
1406
1524
|
`);
|
|
1407
1525
|
let y = 0, g = 0;
|
|
1408
1526
|
const p = f.map((E, F) => {
|
|
@@ -1419,7 +1537,7 @@ const V = class V {
|
|
|
1419
1537
|
return F === 0 && (y = I), g += I, A;
|
|
1420
1538
|
});
|
|
1421
1539
|
if (g === 0) return !0;
|
|
1422
|
-
this.replaceOffsetsWithText(l,
|
|
1540
|
+
this.replaceOffsetsWithText(l, d, p.join(`
|
|
1423
1541
|
`));
|
|
1424
1542
|
const b = Math.max(l, s + y), w = Math.max(b, r + g);
|
|
1425
1543
|
return s === r ? this.setCursor(this.textModel.offsetToPosition(b)) : this.setSelection({
|
|
@@ -1721,14 +1839,14 @@ const V = class V {
|
|
|
1721
1839
|
for (const { segment: f } of c.segment(e.slice(t, l))) return t + f.length;
|
|
1722
1840
|
return t + 1;
|
|
1723
1841
|
}
|
|
1724
|
-
const h = e.charCodeAt(t),
|
|
1725
|
-
return h >= 55296 && h <= 56319 &&
|
|
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;
|
|
1726
1844
|
}
|
|
1727
1845
|
replaceOffsetsWithText(e, t, n) {
|
|
1728
1846
|
var y;
|
|
1729
1847
|
this.ensureEditableSurfaceIsUnfolded();
|
|
1730
1848
|
const i = n.replace(/\r\n?/g, `
|
|
1731
|
-
`), 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),
|
|
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(
|
|
1732
1850
|
{
|
|
1733
1851
|
start: this.textModel.offsetToPosition(c),
|
|
1734
1852
|
end: this.textModel.offsetToPosition(h)
|
|
@@ -1739,7 +1857,7 @@ const V = class V {
|
|
|
1739
1857
|
const f = c + i.length;
|
|
1740
1858
|
return this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), this.setCursor(this.textModel.offsetToPosition(f)), setTimeout(() => {
|
|
1741
1859
|
this.expectingProgrammaticCursor = !1;
|
|
1742
|
-
}, 20), this.emit("change", [
|
|
1860
|
+
}, 20), this.emit("change", [d]), d;
|
|
1743
1861
|
}
|
|
1744
1862
|
ensureEditableSurfaceIsUnfolded() {
|
|
1745
1863
|
!this.hasRenderedFoldPlaceholders() && this.folds.length === 0 || (this.clearPendingHighlightRender(), this.folds = [], this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), setTimeout(() => {
|
|
@@ -1838,11 +1956,11 @@ const V = class V {
|
|
|
1838
1956
|
const h = this.view.createDomRangeFromRange(c.range);
|
|
1839
1957
|
if (!h)
|
|
1840
1958
|
continue;
|
|
1841
|
-
const
|
|
1959
|
+
const d = this.buildInlineDecorationHighlightName(
|
|
1842
1960
|
c.id
|
|
1843
1961
|
);
|
|
1844
|
-
t.highlights.set(
|
|
1845
|
-
::highlight(${
|
|
1962
|
+
t.highlights.set(d, new n(h)), this.inlineDecorationHighlightNames.add(d), s.push(`
|
|
1963
|
+
::highlight(${d}) {
|
|
1846
1964
|
${this.serializeInlineDecorationStyle(c.style)}
|
|
1847
1965
|
}
|
|
1848
1966
|
`), r += 1;
|
|
@@ -1953,8 +2071,8 @@ class ei {
|
|
|
1953
2071
|
const { key: t, ctrlKey: n, altKey: i, shiftKey: s, metaKey: r } = e, o = String(t).toLowerCase(), l = this.keymap[o];
|
|
1954
2072
|
if (!l) return null;
|
|
1955
2073
|
for (const c of l) {
|
|
1956
|
-
const h = c.ctrlKey === void 0 || c.ctrlKey === n,
|
|
1957
|
-
if (h &&
|
|
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)
|
|
1958
2076
|
return c;
|
|
1959
2077
|
}
|
|
1960
2078
|
return null;
|
|
@@ -2199,7 +2317,7 @@ const C = class C {
|
|
|
2199
2317
|
`.${C.css.closeButton}`
|
|
2200
2318
|
), h = this.searchUI.querySelector(
|
|
2201
2319
|
`.${C.css.status}`
|
|
2202
|
-
),
|
|
2320
|
+
), d = this.searchUI.querySelector(
|
|
2203
2321
|
`.${C.css.mode}`
|
|
2204
2322
|
), f = this.searchUI.querySelector(
|
|
2205
2323
|
`.${C.css.caseSensitive}`
|
|
@@ -2208,7 +2326,7 @@ const C = class C {
|
|
|
2208
2326
|
), g = this.searchUI.querySelector(
|
|
2209
2327
|
`.${C.css.regex}`
|
|
2210
2328
|
);
|
|
2211
|
-
this.findInput = s, this.replaceInputEl = r, this.statusDiv = h, this.modeDiv =
|
|
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", () => {
|
|
2212
2330
|
this.searchDebounceTimer && clearTimeout(this.searchDebounceTimer);
|
|
2213
2331
|
const b = s.value;
|
|
2214
2332
|
this.searchDebounceTimer = setTimeout(() => {
|
|
@@ -2320,10 +2438,10 @@ const C = class C {
|
|
|
2320
2438
|
if (!l) return;
|
|
2321
2439
|
const c = l.startContainer.nodeType === Node.TEXT_NODE ? l.startContainer.parentElement : l.startContainer, h = this.resolveScrollContainer(n);
|
|
2322
2440
|
if (h) {
|
|
2323
|
-
const
|
|
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;
|
|
2324
2442
|
let b = t ? g : h.scrollTop, w = h.scrollLeft;
|
|
2325
|
-
const E = h.scrollLeft + (
|
|
2326
|
-
|
|
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));
|
|
2327
2445
|
const A = Math.max(0, h.scrollHeight - h.clientHeight), I = Math.max(0, h.scrollWidth - h.clientWidth);
|
|
2328
2446
|
if (b = Math.min(A, Math.max(0, b)), w = Math.min(I, Math.max(0, w)), A === 0 && I === 0) {
|
|
2329
2447
|
c == null || c.scrollIntoView({
|
|
@@ -2472,8 +2590,8 @@ const C = class C {
|
|
|
2472
2590
|
let l = null;
|
|
2473
2591
|
const c = Math.min(this.currentResults.length, this.maxCustomHighlightRanges);
|
|
2474
2592
|
for (let h = 0; h < c; h++) {
|
|
2475
|
-
const
|
|
2476
|
-
|
|
2593
|
+
const d = this.currentResults[h], f = this.searchOptions.regex ? d.match || this.currentQuery : this.currentQuery || d.match, y = this.toDomRange(
|
|
2594
|
+
d.range,
|
|
2477
2595
|
n,
|
|
2478
2596
|
i,
|
|
2479
2597
|
s,
|
|
@@ -2484,9 +2602,9 @@ const C = class C {
|
|
|
2484
2602
|
}
|
|
2485
2603
|
if (o.length !== 0)
|
|
2486
2604
|
try {
|
|
2487
|
-
const h = CSS,
|
|
2488
|
-
if (!h.highlights || !
|
|
2489
|
-
h.highlights.set(this.highlightMatchName, new
|
|
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));
|
|
2490
2608
|
} catch (h) {
|
|
2491
2609
|
}
|
|
2492
2610
|
}
|
|
@@ -2523,8 +2641,8 @@ const C = class C {
|
|
|
2523
2641
|
resolveDomPoint(e, t) {
|
|
2524
2642
|
var s, r, o, l, c, h;
|
|
2525
2643
|
const n = Math.max(0, e);
|
|
2526
|
-
for (let
|
|
2527
|
-
const f = t[
|
|
2644
|
+
for (let d = 0; d < t.length; d++) {
|
|
2645
|
+
const f = t[d];
|
|
2528
2646
|
if (n <= f.end) {
|
|
2529
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;
|
|
2530
2648
|
return {
|
|
@@ -2553,11 +2671,11 @@ const C = class C {
|
|
|
2553
2671
|
b !== -1 && (c = b, h = b + g.length);
|
|
2554
2672
|
}
|
|
2555
2673
|
}
|
|
2556
|
-
const
|
|
2557
|
-
if (!
|
|
2674
|
+
const d = this.resolveDomPoint(c, i), f = this.resolveDomPoint(h, i);
|
|
2675
|
+
if (!d || !f) return null;
|
|
2558
2676
|
const y = document.createRange();
|
|
2559
2677
|
try {
|
|
2560
|
-
return y.setStart(
|
|
2678
|
+
return y.setStart(d.node, d.offset), y.setEnd(f.node, f.offset), y;
|
|
2561
2679
|
} catch (g) {
|
|
2562
2680
|
return null;
|
|
2563
2681
|
}
|
|
@@ -2769,10 +2887,10 @@ class oi {
|
|
|
2769
2887
|
for (let o = t; o < e.length; o++) {
|
|
2770
2888
|
const l = e[o], c = o === t ? n : 0;
|
|
2771
2889
|
for (let h = c; h < l.length; h++) {
|
|
2772
|
-
const
|
|
2773
|
-
if (
|
|
2890
|
+
const d = l[h];
|
|
2891
|
+
if (d === i)
|
|
2774
2892
|
r++;
|
|
2775
|
-
else if (
|
|
2893
|
+
else if (d === s && (r--, r === 0))
|
|
2776
2894
|
return {
|
|
2777
2895
|
open: { start: { line: t, column: n }, end: { line: t, column: n + 1 } },
|
|
2778
2896
|
close: { start: { line: o, column: h }, end: { line: o, column: h + 1 } },
|
|
@@ -2788,10 +2906,10 @@ class oi {
|
|
|
2788
2906
|
for (let o = t; o >= 0; o--) {
|
|
2789
2907
|
const l = e[o], c = o === t ? n : l.length - 1;
|
|
2790
2908
|
for (let h = c; h >= 0; h--) {
|
|
2791
|
-
const
|
|
2792
|
-
if (
|
|
2909
|
+
const d = l[h];
|
|
2910
|
+
if (d === i)
|
|
2793
2911
|
r++;
|
|
2794
|
-
else if (
|
|
2912
|
+
else if (d === s && (r--, r === 0))
|
|
2795
2913
|
return {
|
|
2796
2914
|
open: { start: { line: o, column: h }, end: { line: o, column: h + 1 } },
|
|
2797
2915
|
close: { start: { line: t, column: n }, end: { line: t, column: n + 1 } },
|
|
@@ -2991,12 +3109,12 @@ class ai {
|
|
|
2991
3109
|
for (let l = 0; l < t.length; l++) {
|
|
2992
3110
|
const c = t[l];
|
|
2993
3111
|
for (let h = 0; h < c.length; h++) {
|
|
2994
|
-
const
|
|
2995
|
-
if (s[
|
|
2996
|
-
n.push({ char:
|
|
3112
|
+
const d = c[h];
|
|
3113
|
+
if (s[d]) {
|
|
3114
|
+
n.push({ char: d, line: l, column: h });
|
|
2997
3115
|
continue;
|
|
2998
3116
|
}
|
|
2999
|
-
const f = r[
|
|
3117
|
+
const f = r[d];
|
|
3000
3118
|
if (!f) continue;
|
|
3001
3119
|
let y = -1;
|
|
3002
3120
|
for (let w = n.length - 1; w >= 0; w--)
|
|
@@ -3045,7 +3163,7 @@ class ai {
|
|
|
3045
3163
|
continue;
|
|
3046
3164
|
}
|
|
3047
3165
|
if (r = o.endOffset, o.isClosing) {
|
|
3048
|
-
const l = s.findIndex((
|
|
3166
|
+
const l = s.findIndex((d) => d.name === o.name);
|
|
3049
3167
|
if (l === -1)
|
|
3050
3168
|
continue;
|
|
3051
3169
|
const c = s.splice(l, 1)[0], h = this.createMarkupFoldRegion(
|
|
@@ -3114,12 +3232,12 @@ class ai {
|
|
|
3114
3232
|
}
|
|
3115
3233
|
if (o >= e.length || e[o] !== ">")
|
|
3116
3234
|
return null;
|
|
3117
|
-
const
|
|
3118
|
-
if (!
|
|
3235
|
+
const d = e.slice(l, c).toLowerCase();
|
|
3236
|
+
if (!d)
|
|
3119
3237
|
return null;
|
|
3120
3238
|
const f = e.slice(t, o + 1), y = this.offsetToLine(t, n, i), g = this.offsetToLine(o, n, i);
|
|
3121
3239
|
return {
|
|
3122
|
-
name:
|
|
3240
|
+
name: d,
|
|
3123
3241
|
isClosing: r,
|
|
3124
3242
|
isSelfClosing: !r && /\/\s*>$/.test(f),
|
|
3125
3243
|
startLine: y,
|
|
@@ -3264,12 +3382,12 @@ class ai {
|
|
|
3264
3382
|
this.editor.getView().setText(e);
|
|
3265
3383
|
}
|
|
3266
3384
|
buildFoldedProjection(e, t) {
|
|
3267
|
-
const { lineStarts: n, lines: i } = this.buildLineStarts(e), s = [...t].sort((h,
|
|
3385
|
+
const { lineStarts: n, lines: i } = this.buildLineStarts(e), s = [...t].sort((h, d) => this.comparePositions(h.start, d.start));
|
|
3268
3386
|
let r = "";
|
|
3269
3387
|
const o = [];
|
|
3270
3388
|
let l = 0;
|
|
3271
3389
|
for (const h of s) {
|
|
3272
|
-
const
|
|
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);
|
|
3273
3391
|
r += y, r += g, y && o.push({ type: "text", text: y }), o.push({
|
|
3274
3392
|
type: "placeholder",
|
|
3275
3393
|
text: g,
|
|
@@ -3315,8 +3433,8 @@ class ai {
|
|
|
3315
3433
|
);
|
|
3316
3434
|
if (!h)
|
|
3317
3435
|
continue;
|
|
3318
|
-
const
|
|
3319
|
-
s.push(h), r.add(
|
|
3436
|
+
const d = this.getFoldKey(h);
|
|
3437
|
+
s.push(h), r.add(d);
|
|
3320
3438
|
}
|
|
3321
3439
|
const l = new Set(s.map((c) => this.getFoldKey(c)));
|
|
3322
3440
|
for (const c of n)
|
|
@@ -3367,7 +3485,7 @@ class ai {
|
|
|
3367
3485
|
);
|
|
3368
3486
|
if (o)
|
|
3369
3487
|
return o;
|
|
3370
|
-
const l = e.end.line - e.start.line, c = t != null ? t : this.createFoldSnapshot(e, i, s),
|
|
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) => {
|
|
3371
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;
|
|
3372
3490
|
return {
|
|
3373
3491
|
region: g,
|
|
@@ -3381,10 +3499,10 @@ class ai {
|
|
|
3381
3499
|
boundaryMatchScore: b + w + E
|
|
3382
3500
|
};
|
|
3383
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];
|
|
3384
|
-
if (!
|
|
3502
|
+
if (!d)
|
|
3385
3503
|
return null;
|
|
3386
|
-
const f =
|
|
3387
|
-
return !(
|
|
3504
|
+
const f = d.lineDistance <= 2 && d.spanDistance <= 1;
|
|
3505
|
+
return !(d.hiddenTextMatch === 1 || d.boundaryMatchScore >= 2) && !f ? null : d.region;
|
|
3388
3506
|
}
|
|
3389
3507
|
lineRangeOverlap(e, t) {
|
|
3390
3508
|
const n = Math.max(e.start.line, t.start.line), i = Math.min(e.end.line, t.end.line);
|
|
@@ -3399,7 +3517,7 @@ class ai {
|
|
|
3399
3517
|
this.foldSnapshots = t;
|
|
3400
3518
|
}
|
|
3401
3519
|
createFoldSnapshot(e, t, n = this.getLineInfo(t)) {
|
|
3402
|
-
var h,
|
|
3520
|
+
var h, d;
|
|
3403
3521
|
const { lineStarts: i, lines: s } = n;
|
|
3404
3522
|
if (s.length === 0)
|
|
3405
3523
|
return null;
|
|
@@ -3407,7 +3525,7 @@ class ai {
|
|
|
3407
3525
|
return {
|
|
3408
3526
|
hiddenText: t.slice(r, o),
|
|
3409
3527
|
startLineText: (h = s[l]) != null ? h : "",
|
|
3410
|
-
endLineText: (
|
|
3528
|
+
endLineText: (d = s[c]) != null ? d : "",
|
|
3411
3529
|
lineSpan: e.end.line - e.start.line
|
|
3412
3530
|
};
|
|
3413
3531
|
}
|
|
@@ -3463,8 +3581,8 @@ class ai {
|
|
|
3463
3581
|
const l = this.positionToOffset(o.start, n, i), c = this.positionToOffset(o.end, n, i);
|
|
3464
3582
|
if (r <= l || r >= c)
|
|
3465
3583
|
continue;
|
|
3466
|
-
const h = r - l,
|
|
3467
|
-
return h <=
|
|
3584
|
+
const h = r - l, d = c - r;
|
|
3585
|
+
return h <= d ? l : c;
|
|
3468
3586
|
}
|
|
3469
3587
|
return r;
|
|
3470
3588
|
}
|
|
@@ -3491,12 +3609,12 @@ class ai {
|
|
|
3491
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));
|
|
3492
3610
|
let r = 0, o = t.length - 1;
|
|
3493
3611
|
for (; r <= o; ) {
|
|
3494
|
-
const c = Math.floor((r + o) / 2), h = t[c],
|
|
3612
|
+
const c = Math.floor((r + o) / 2), h = t[c], d = c + 1 < t.length ? t[c + 1] : Number.POSITIVE_INFINITY;
|
|
3495
3613
|
if (s < h) {
|
|
3496
3614
|
o = c - 1;
|
|
3497
3615
|
continue;
|
|
3498
3616
|
}
|
|
3499
|
-
if (s >=
|
|
3617
|
+
if (s >= d) {
|
|
3500
3618
|
r = c + 1;
|
|
3501
3619
|
continue;
|
|
3502
3620
|
}
|
|
@@ -3750,11 +3868,11 @@ class li {
|
|
|
3750
3868
|
e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi, (f, y, g) => (h.push({ attrs: String(y || ""), inner: String(g || "") }), f));
|
|
3751
3869
|
} catch (f) {
|
|
3752
3870
|
}
|
|
3753
|
-
let
|
|
3871
|
+
let d = 0;
|
|
3754
3872
|
return c = c.replace(/(<script\b([^&>]*)>)([\s\S]*?)(<\/script>)/gi, (f, y, g, p, b) => {
|
|
3755
3873
|
var F, A, I;
|
|
3756
|
-
const w = (A = (F = h[
|
|
3757
|
-
(((I = h[
|
|
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();
|
|
3758
3876
|
const E = this._highlightJS(w, n);
|
|
3759
3877
|
return `${y}${E}${b}`;
|
|
3760
3878
|
}), c = c.replace(/(<style\b[^&]*>)([\s\S]*?)(<\/style>)/gi, (f, y, g, p) => {
|
|
@@ -3791,15 +3909,15 @@ class li {
|
|
|
3791
3909
|
let o = 0, l = "", c;
|
|
3792
3910
|
for (; c = r.exec(n); ) {
|
|
3793
3911
|
o < c.index && (l += this.escapeHTML(n.slice(o, c.index)));
|
|
3794
|
-
const h = c[0],
|
|
3795
|
-
l += s(`<span style="color: ${
|
|
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;
|
|
3796
3914
|
}
|
|
3797
3915
|
return o < n.length && (l += this.escapeHTML(n.slice(o))), l = l.replace(
|
|
3798
3916
|
/(@[\w-]+)/g,
|
|
3799
3917
|
(h) => s(`<span style="color: ${t.keyword};">${h}</span>`)
|
|
3800
3918
|
), l = l.replace(
|
|
3801
3919
|
/([A-Za-z_-][\w-]*)(\s*:)/g,
|
|
3802
|
-
(h,
|
|
3920
|
+
(h, d, f) => `${s(`<span style="color: ${t.styleProp};">${d}</span>`)}${f}`
|
|
3803
3921
|
), l = l.replace(
|
|
3804
3922
|
/(#(?:[0-9a-fA-F]{3,8})\b)/g,
|
|
3805
3923
|
(h) => s(`<span style="color: ${t.number};">${h}</span>`)
|
|
@@ -3816,11 +3934,11 @@ class li {
|
|
|
3816
3934
|
let s = 0, r = "", o;
|
|
3817
3935
|
for (; o = i.exec(n); ) {
|
|
3818
3936
|
s < o.index && (r += this.escapeHTML(n.slice(s, o.index)));
|
|
3819
|
-
const l = o[0], c = o[1], h = o[2] || "",
|
|
3937
|
+
const l = o[0], c = o[1], h = o[2] || "", d = o[3];
|
|
3820
3938
|
if (c) {
|
|
3821
3939
|
const f = h ? t.attrName : t.string;
|
|
3822
3940
|
r += `<span style="color: ${f};">${this.escapeHTML(c)}</span>${this.escapeHTML(h)}`;
|
|
3823
|
-
} else
|
|
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>`;
|
|
3824
3942
|
s = i.lastIndex;
|
|
3825
3943
|
}
|
|
3826
3944
|
return s < n.length && (r += this.escapeHTML(n.slice(s))), r;
|
|
@@ -3830,11 +3948,11 @@ class li {
|
|
|
3830
3948
|
const i = this.unescapeEntitiesRepeated(e).split(`
|
|
3831
3949
|
`);
|
|
3832
3950
|
let s = !1, r = "", o = "", l = ((c = i[0]) == null ? void 0 : c.trim()) === "---";
|
|
3833
|
-
return i.map((h,
|
|
3951
|
+
return i.map((h, d) => {
|
|
3834
3952
|
const f = [], y = this.createTokenStore(f);
|
|
3835
3953
|
if (l) {
|
|
3836
3954
|
const b = h.trim() === "---", E = `<span style="color: ${b ? t.keyword : t.attrName};">${this.escapeHTML(h)}</span>`;
|
|
3837
|
-
return
|
|
3955
|
+
return d > 0 && b && (l = !1), E;
|
|
3838
3956
|
}
|
|
3839
3957
|
const g = h.match(/^(\s*)(`{3,}|~{3,})(.*)$/);
|
|
3840
3958
|
if (g) {
|
|
@@ -3899,18 +4017,18 @@ class li {
|
|
|
3899
4017
|
let o = 0, l = "", c;
|
|
3900
4018
|
for (; c = r.exec(n); ) {
|
|
3901
4019
|
o < c.index && (l += this.escapeHTML(n.slice(o, c.index)));
|
|
3902
|
-
const h = c[0],
|
|
3903
|
-
l += s(`<span style="color: ${
|
|
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;
|
|
3904
4022
|
}
|
|
3905
4023
|
return o < n.length && (l += this.escapeHTML(n.slice(o))), l = l.replace(
|
|
3906
4024
|
/(^|\s)(--?[A-Za-z0-9][\w-]*)(?=\s|=|$)/g,
|
|
3907
|
-
(h,
|
|
4025
|
+
(h, d, f) => `${d}${s(`<span style="color: ${t.attrName};">${f}</span>`)}`
|
|
3908
4026
|
), l = l.replace(
|
|
3909
4027
|
/\b(if|then|else|elif|fi|for|while|until|do|done|case|esac|function|export|unset|alias|source|return|in)\b/g,
|
|
3910
4028
|
(h) => s(`<span style="color: ${t.keyword};">${h}</span>`)
|
|
3911
4029
|
), l = l.replace(
|
|
3912
4030
|
/(^|\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,
|
|
3913
|
-
(h,
|
|
4031
|
+
(h, d, f) => `${d}${s(`<span style="color: ${t.tag};">${f}</span>`)}`
|
|
3914
4032
|
), this.restoreHighlightTokens(l, i);
|
|
3915
4033
|
}
|
|
3916
4034
|
getLanguageKeywords(e) {
|
|
@@ -3932,10 +4050,10 @@ class li {
|
|
|
3932
4050
|
`(${o})|("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`,
|
|
3933
4051
|
"g"
|
|
3934
4052
|
);
|
|
3935
|
-
let c = 0, h = "",
|
|
3936
|
-
for (;
|
|
3937
|
-
c <
|
|
3938
|
-
const y =
|
|
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;
|
|
3939
4057
|
h += r(`<span style="color: ${g};">${this.escapeHTML(y)}</span>`), c = l.lastIndex;
|
|
3940
4058
|
}
|
|
3941
4059
|
c < i.length && (h += this.escapeHTML(i.slice(c)));
|
|
@@ -3990,8 +4108,8 @@ class li {
|
|
|
3990
4108
|
(s) => {
|
|
3991
4109
|
const r = n.length, o = this.escapeHTML(s).replace(
|
|
3992
4110
|
/(<\/?)([A-Za-z][\w.:-]*)([\s\S]*?)(\/?>)/,
|
|
3993
|
-
(l, c, h,
|
|
3994
|
-
const y = String(
|
|
4111
|
+
(l, c, h, d, f) => {
|
|
4112
|
+
const y = String(d || "").replace(
|
|
3995
4113
|
/([A-Za-z_:][\w:.-]*)(\s*=\s*)/g,
|
|
3996
4114
|
`<span style="color: ${t.attrName};">$1</span>$2`
|
|
3997
4115
|
);
|
|
@@ -4042,17 +4160,17 @@ class li {
|
|
|
4042
4160
|
};
|
|
4043
4161
|
let l;
|
|
4044
4162
|
const c = /(\/\*[\s\S]*?\*\/)|(\/\/[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)/g;
|
|
4045
|
-
let h = 0,
|
|
4163
|
+
let h = 0, d = "";
|
|
4046
4164
|
for (; l = c.exec(n); ) {
|
|
4047
4165
|
const y = l.index;
|
|
4048
|
-
h < y && (
|
|
4166
|
+
h < y && (d += this.escapeHTML(n.slice(h, y)));
|
|
4049
4167
|
const g = l[0];
|
|
4050
|
-
/^\/\*/.test(g) || /^\/\//.test(g) ?
|
|
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;
|
|
4051
4169
|
}
|
|
4052
|
-
return h < n.length && (
|
|
4053
|
-
const b =
|
|
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] || "";
|
|
4054
4172
|
return b === "&" || b === "#" || w === ";" || w === "#" ? y : `<span style="color: ${t.number};">${y}</span>`;
|
|
4055
|
-
}),
|
|
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) => {
|
|
4056
4174
|
let p = 0;
|
|
4057
4175
|
for (let b = 0; b < g.length; b++)
|
|
4058
4176
|
p = p * 26 + (g.charCodeAt(b) - 97 + 1);
|
|
@@ -4076,12 +4194,12 @@ class li {
|
|
|
4076
4194
|
return b === -1 ? !1 : (i = i.slice(0, b) + p + i.slice(b + g.length), !0);
|
|
4077
4195
|
};
|
|
4078
4196
|
let c;
|
|
4079
|
-
const h = /\/\*[\s\S]*?\*\//g,
|
|
4197
|
+
const h = /\/\*[\s\S]*?\*\//g, d = /\/\/[^\n\r]*/g, f = /\#([^\n\r]*)/g, y = /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
|
|
4080
4198
|
for (; c = h.exec(n); ) {
|
|
4081
4199
|
const g = c[0];
|
|
4082
4200
|
l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
|
|
4083
4201
|
}
|
|
4084
|
-
for (; c =
|
|
4202
|
+
for (; c = d.exec(n); ) {
|
|
4085
4203
|
const g = c[0];
|
|
4086
4204
|
l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
|
|
4087
4205
|
}
|
|
@@ -4123,7 +4241,7 @@ function ln(m, e) {
|
|
|
4123
4241
|
function hi(m) {
|
|
4124
4242
|
if (Array.isArray(m)) return m;
|
|
4125
4243
|
}
|
|
4126
|
-
function
|
|
4244
|
+
function ui(m, e) {
|
|
4127
4245
|
var t = m == null ? null : typeof Symbol != "undefined" && m[Symbol.iterator] || m["@@iterator"];
|
|
4128
4246
|
if (t != null) {
|
|
4129
4247
|
var n, i, s, r, o = [], l = !0, c = !1;
|
|
@@ -4141,12 +4259,12 @@ function di(m, e) {
|
|
|
4141
4259
|
return o;
|
|
4142
4260
|
}
|
|
4143
4261
|
}
|
|
4144
|
-
function
|
|
4262
|
+
function di() {
|
|
4145
4263
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4146
4264
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
4147
4265
|
}
|
|
4148
4266
|
function fi(m, e) {
|
|
4149
|
-
return hi(m) ||
|
|
4267
|
+
return hi(m) || ui(m, e) || gi(m, e) || di();
|
|
4150
4268
|
}
|
|
4151
4269
|
function gi(m, e) {
|
|
4152
4270
|
if (m) {
|
|
@@ -4171,7 +4289,7 @@ At || (At = function(e) {
|
|
|
4171
4289
|
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++) n[i - 1] = arguments[i];
|
|
4172
4290
|
return new e(...n);
|
|
4173
4291
|
});
|
|
4174
|
-
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),
|
|
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);
|
|
4175
4293
|
function z(m) {
|
|
4176
4294
|
return function(e) {
|
|
4177
4295
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
@@ -4973,7 +5091,7 @@ function Mn() {
|
|
|
4973
5091
|
m.DocumentFragment;
|
|
4974
5092
|
const s = m.HTMLTemplateElement, r = m.Node, o = m.Element, l = m.NodeFilter;
|
|
4975
5093
|
m.NamedNodeMap === void 0 && (m.NamedNodeMap || m.MozNamedAttrMap), m.HTMLFormElement;
|
|
4976
|
-
const c = m.DOMParser, h = m.trustedTypes,
|
|
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) {
|
|
4977
5095
|
return A ? A(a) : a.nodeType;
|
|
4978
5096
|
}, ie = function(a) {
|
|
4979
5097
|
return I ? I(a) : a.nodeName;
|
|
@@ -5040,7 +5158,7 @@ function Mn() {
|
|
|
5040
5158
|
value: !1
|
|
5041
5159
|
}
|
|
5042
5160
|
})), Ie = null, Dt = null;
|
|
5043
|
-
const
|
|
5161
|
+
const ue = Object.seal(Ae(null, {
|
|
5044
5162
|
tagCheck: {
|
|
5045
5163
|
writable: !0,
|
|
5046
5164
|
configurable: !1,
|
|
@@ -5054,7 +5172,7 @@ function Mn() {
|
|
|
5054
5172
|
value: null
|
|
5055
5173
|
}
|
|
5056
5174
|
}));
|
|
5057
|
-
let Nt = !0, rt = !0, _t = !1, Ht = !0,
|
|
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;
|
|
5058
5176
|
const $t = "user-content-";
|
|
5059
5177
|
let lt = !0, ct = !1, we = {}, ve = null;
|
|
5060
5178
|
const zt = L({}, [
|
|
@@ -5111,7 +5229,7 @@ function Mn() {
|
|
|
5111
5229
|
"style",
|
|
5112
5230
|
"xmlns"
|
|
5113
5231
|
]), je = "http://www.w3.org/1998/Math/MathML", Ge = "http://www.w3.org/2000/svg", oe = "http://www.w3.org/1999/xhtml";
|
|
5114
|
-
let Ee = oe, ht = !1,
|
|
5232
|
+
let Ee = oe, ht = !1, ut = null;
|
|
5115
5233
|
const Dn = L({}, [
|
|
5116
5234
|
je,
|
|
5117
5235
|
Ge,
|
|
@@ -5123,7 +5241,7 @@ function Mn() {
|
|
|
5123
5241
|
"ms",
|
|
5124
5242
|
"mtext"
|
|
5125
5243
|
]);
|
|
5126
|
-
let
|
|
5244
|
+
let dt = L({}, Kt);
|
|
5127
5245
|
const jt = B(["annotation-xml"]);
|
|
5128
5246
|
let ft = L({}, jt);
|
|
5129
5247
|
const Nn = L({}, [
|
|
@@ -5141,15 +5259,15 @@ function Mn() {
|
|
|
5141
5259
|
}, gt = function() {
|
|
5142
5260
|
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
5143
5261
|
if (Ce && Ce === a) return;
|
|
5144
|
-
(!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 }),
|
|
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, {
|
|
5145
5263
|
transform: P,
|
|
5146
5264
|
base: Vt
|
|
5147
5265
|
}), Ut = pe(a, "ADD_DATA_URI_TAGS", Bt, {
|
|
5148
5266
|
transform: P,
|
|
5149
5267
|
base: Bt
|
|
5150
|
-
}), 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,
|
|
5151
|
-
const
|
|
5152
|
-
if (re = Ae(null), q(
|
|
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, [
|
|
5153
5271
|
"html",
|
|
5154
5272
|
"head",
|
|
5155
5273
|
"body"
|
|
@@ -5169,30 +5287,30 @@ function Mn() {
|
|
|
5169
5287
|
...Tt,
|
|
5170
5288
|
...xt,
|
|
5171
5289
|
...Ri
|
|
5172
|
-
]), Yt = L({}, [...St, ...Li]), Pn = function(a,
|
|
5173
|
-
return
|
|
5174
|
-
}, $n = function(a,
|
|
5175
|
-
return
|
|
5176
|
-
}, zn = function(a,
|
|
5177
|
-
return
|
|
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]);
|
|
5178
5296
|
}, Un = function(a) {
|
|
5179
|
-
let
|
|
5180
|
-
(!
|
|
5297
|
+
let u = w(a);
|
|
5298
|
+
(!u || !u.tagName) && (u = {
|
|
5181
5299
|
namespaceURI: Ee,
|
|
5182
5300
|
tagName: "template"
|
|
5183
5301
|
});
|
|
5184
|
-
const T = Pe(a.tagName), S = Pe(
|
|
5185
|
-
return
|
|
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;
|
|
5186
5304
|
}, fe = function(a) {
|
|
5187
5305
|
_e(e.removed, { element: a });
|
|
5188
5306
|
try {
|
|
5189
5307
|
w(a).removeChild(a);
|
|
5190
|
-
} catch (
|
|
5308
|
+
} catch (u) {
|
|
5191
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");
|
|
5192
5310
|
}
|
|
5193
|
-
}, Zt = function(a,
|
|
5311
|
+
}, Zt = function(a, u, T) {
|
|
5194
5312
|
try {
|
|
5195
|
-
g(a,
|
|
5313
|
+
g(a, u);
|
|
5196
5314
|
} catch (S) {
|
|
5197
5315
|
try {
|
|
5198
5316
|
a.removeAttribute(T);
|
|
@@ -5201,10 +5319,10 @@ function Mn() {
|
|
|
5201
5319
|
}
|
|
5202
5320
|
}, qe = function(a) {
|
|
5203
5321
|
Ye(a);
|
|
5204
|
-
const
|
|
5205
|
-
if (
|
|
5322
|
+
const u = b(a);
|
|
5323
|
+
if (u) {
|
|
5206
5324
|
const S = [];
|
|
5207
|
-
Te(
|
|
5325
|
+
Te(u, (v) => {
|
|
5208
5326
|
_e(S, v);
|
|
5209
5327
|
}), Te(S, (v) => {
|
|
5210
5328
|
try {
|
|
@@ -5218,55 +5336,55 @@ function Mn() {
|
|
|
5218
5336
|
const v = T[S], M = v && v.name;
|
|
5219
5337
|
typeof M == "string" && Zt(a, v, M);
|
|
5220
5338
|
}
|
|
5221
|
-
}, be = function(a,
|
|
5339
|
+
}, be = function(a, u, T) {
|
|
5222
5340
|
if (!T) try {
|
|
5223
|
-
T =
|
|
5341
|
+
T = u.getAttributeNode(a);
|
|
5224
5342
|
} catch (S) {
|
|
5225
5343
|
T = null;
|
|
5226
5344
|
}
|
|
5227
5345
|
_e(e.removed, {
|
|
5228
5346
|
attribute: T || null,
|
|
5229
|
-
from:
|
|
5347
|
+
from: u
|
|
5230
5348
|
});
|
|
5231
5349
|
try {
|
|
5232
|
-
T ? g(
|
|
5350
|
+
T ? g(u, T) : u.removeAttribute(a);
|
|
5233
5351
|
} catch (S) {
|
|
5234
5352
|
try {
|
|
5235
|
-
|
|
5353
|
+
u.removeAttribute(a);
|
|
5236
5354
|
} catch (v) {
|
|
5237
5355
|
}
|
|
5238
5356
|
}
|
|
5239
5357
|
if (a === "is")
|
|
5240
5358
|
if (Se || Ve) try {
|
|
5241
|
-
fe(
|
|
5359
|
+
fe(u);
|
|
5242
5360
|
} catch (S) {
|
|
5243
5361
|
}
|
|
5244
5362
|
else try {
|
|
5245
|
-
|
|
5363
|
+
u.setAttribute(a, "");
|
|
5246
5364
|
} catch (S) {
|
|
5247
5365
|
}
|
|
5248
5366
|
}, Bn = function(a) {
|
|
5249
|
-
const
|
|
5250
|
-
if (
|
|
5251
|
-
for (let T =
|
|
5252
|
-
const S =
|
|
5367
|
+
const u = F(a);
|
|
5368
|
+
if (u)
|
|
5369
|
+
for (let T = u.length - 1; T >= 0; --T) {
|
|
5370
|
+
const S = u[T], v = S && S.name;
|
|
5253
5371
|
typeof v != "string" || N[P(v)] || Zt(a, S, v);
|
|
5254
5372
|
}
|
|
5255
5373
|
}, Ye = function(a) {
|
|
5256
|
-
const
|
|
5257
|
-
for (;
|
|
5258
|
-
const T =
|
|
5374
|
+
const u = [a];
|
|
5375
|
+
for (; u.length > 0; ) {
|
|
5376
|
+
const T = u.pop();
|
|
5259
5377
|
Y(T) === Q.element && Bn(T);
|
|
5260
5378
|
const S = b(T);
|
|
5261
|
-
if (S) for (let v = S.length - 1; v >= 0; --v)
|
|
5379
|
+
if (S) for (let v = S.length - 1; v >= 0; --v) u.push(S[v]);
|
|
5262
5380
|
}
|
|
5263
|
-
}, Xt = function(a,
|
|
5264
|
-
return me ? a === "patchsrc" ? !0 : a === "for" &&
|
|
5381
|
+
}, Xt = function(a, u) {
|
|
5382
|
+
return me ? a === "patchsrc" ? !0 : a === "for" && u !== "label" && u !== "output" : !1;
|
|
5265
5383
|
}, Wn = function(a) {
|
|
5266
5384
|
if (!me) return;
|
|
5267
|
-
const
|
|
5268
|
-
for (;
|
|
5269
|
-
const T =
|
|
5385
|
+
const u = [a];
|
|
5386
|
+
for (; u.length > 0; ) {
|
|
5387
|
+
const T = u.pop(), S = Y(T);
|
|
5270
5388
|
if (S === Q.processingInstruction || S === Q.comment && K(Sn, T.data)) {
|
|
5271
5389
|
try {
|
|
5272
5390
|
y(T);
|
|
@@ -5282,81 +5400,81 @@ function Mn() {
|
|
|
5282
5400
|
}
|
|
5283
5401
|
}
|
|
5284
5402
|
const v = b(T);
|
|
5285
|
-
if (v) for (let M = v.length - 1; M >= 0; --M)
|
|
5403
|
+
if (v) for (let M = v.length - 1; M >= 0; --M) u.push(v[M]);
|
|
5286
5404
|
}
|
|
5287
5405
|
}, Qt = function(a) {
|
|
5288
|
-
let
|
|
5406
|
+
let u = null, T = null;
|
|
5289
5407
|
if (at) a = "<remove></remove>" + a;
|
|
5290
5408
|
else {
|
|
5291
|
-
const M =
|
|
5409
|
+
const M = un(a, /^[\r\n\t ]+/);
|
|
5292
5410
|
T = M && M[0];
|
|
5293
5411
|
}
|
|
5294
5412
|
De === "application/xhtml+xml" && Ee === oe && (a = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + a + "</body></html>");
|
|
5295
5413
|
const S = _ ? ne(a) : a;
|
|
5296
5414
|
if (Ee === oe) try {
|
|
5297
|
-
|
|
5415
|
+
u = new c().parseFromString(S, De);
|
|
5298
5416
|
} catch (M) {
|
|
5299
5417
|
}
|
|
5300
|
-
if (!
|
|
5301
|
-
|
|
5418
|
+
if (!u || !u.documentElement) {
|
|
5419
|
+
u = ke.createDocument(Ee, "template", null);
|
|
5302
5420
|
try {
|
|
5303
|
-
|
|
5421
|
+
u.documentElement.innerHTML = ht ? U : S;
|
|
5304
5422
|
} catch (M) {
|
|
5305
5423
|
}
|
|
5306
5424
|
}
|
|
5307
|
-
const v =
|
|
5308
|
-
return a && T && v.insertBefore(t.createTextNode(T), v.childNodes[0] || null), Ee === oe ? O.call(
|
|
5425
|
+
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;
|
|
5309
5427
|
}, Jt = function(a) {
|
|
5310
|
-
const
|
|
5311
|
-
return ze.call(
|
|
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);
|
|
5312
5430
|
}, Ze = function(a) {
|
|
5313
5431
|
return a = He(a, Ue, " "), a = He(a, Rn, " "), a = He(a, Ln, " "), a;
|
|
5314
5432
|
}, pt = function(a) {
|
|
5315
|
-
var
|
|
5433
|
+
var u;
|
|
5316
5434
|
a.normalize();
|
|
5317
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);
|
|
5318
5436
|
let v = S.nextNode();
|
|
5319
5437
|
for (; v; )
|
|
5320
5438
|
v.data = Ze(v.data), v = S.nextNode();
|
|
5321
|
-
const M = (
|
|
5439
|
+
const M = (u = a.querySelectorAll) === null || u === void 0 ? void 0 : u.call(a, "template");
|
|
5322
5440
|
M && Te(M, (R) => {
|
|
5323
5441
|
Me(R.content) && pt(R.content);
|
|
5324
5442
|
});
|
|
5325
5443
|
}, Xe = function(a) {
|
|
5326
|
-
const
|
|
5327
|
-
return typeof
|
|
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);
|
|
5328
5446
|
}, Me = function(a) {
|
|
5329
5447
|
if (!A || typeof a != "object" || a === null) return !1;
|
|
5330
5448
|
try {
|
|
5331
5449
|
return A(a) === Q.documentFragment;
|
|
5332
|
-
} catch (
|
|
5450
|
+
} catch (u) {
|
|
5333
5451
|
return !1;
|
|
5334
5452
|
}
|
|
5335
5453
|
}, Ne = function(a) {
|
|
5336
5454
|
if (!A || typeof a != "object" || a === null) return !1;
|
|
5337
5455
|
try {
|
|
5338
5456
|
return typeof A(a) == "number";
|
|
5339
|
-
} catch (
|
|
5457
|
+
} catch (u) {
|
|
5340
5458
|
return !1;
|
|
5341
5459
|
}
|
|
5342
5460
|
};
|
|
5343
|
-
function ae(x, a,
|
|
5461
|
+
function ae(x, a, u) {
|
|
5344
5462
|
x.length !== 0 && Te(x, (T) => {
|
|
5345
|
-
T.call(e, a,
|
|
5463
|
+
T.call(e, a, u, Ce);
|
|
5346
5464
|
});
|
|
5347
5465
|
}
|
|
5348
|
-
const Vn = function(a,
|
|
5349
|
-
return !!(me && a.hasChildNodes() && !Ne(a.firstElementChild) && K(xn, a.textContent) && K(xn, a.innerHTML) || me && a.namespaceURI === oe && zi[
|
|
5350
|
-
}, Qe = function(a,
|
|
5351
|
-
if (a instanceof RegExp) return K(a,
|
|
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);
|
|
5352
5470
|
if (a instanceof Function) {
|
|
5353
5471
|
for (var T = arguments.length, S = new Array(T > 2 ? T - 2 : 0), v = 2; v < T; v++) S[v - 2] = arguments[v];
|
|
5354
|
-
return !!a(
|
|
5472
|
+
return !!a(u, ...S);
|
|
5355
5473
|
}
|
|
5356
5474
|
return !1;
|
|
5357
|
-
}, Kn = function(a,
|
|
5358
|
-
if (!Ie[
|
|
5359
|
-
if (lt && !ve[
|
|
5475
|
+
}, Kn = function(a, u, T) {
|
|
5476
|
+
if (!Ie[u] && sn(u) && Qe(re.tagNameCheck, u)) return !1;
|
|
5477
|
+
if (lt && !ve[u]) {
|
|
5360
5478
|
const S = w(a), v = b(a);
|
|
5361
5479
|
if (v && S) {
|
|
5362
5480
|
const M = v.length;
|
|
@@ -5367,36 +5485,36 @@ function Mn() {
|
|
|
5367
5485
|
}
|
|
5368
5486
|
}
|
|
5369
5487
|
return fe(a), !0;
|
|
5370
|
-
}, en = function(a,
|
|
5371
|
-
return a.length === 0 ?
|
|
5372
|
-
}, Re = function(a,
|
|
5373
|
-
return a ===
|
|
5374
|
-
}, tn = function(a,
|
|
5375
|
-
if (ae(k.beforeSanitizeElements, a, null), Re(a,
|
|
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;
|
|
5376
5494
|
if (Xe(a))
|
|
5377
5495
|
return fe(a), !0;
|
|
5378
5496
|
const T = P(ie(a));
|
|
5379
5497
|
if (D = en(k.uponSanitizeElement, D, it, Be), ae(k.uponSanitizeElement, a, {
|
|
5380
5498
|
tagName: T,
|
|
5381
5499
|
allowedTags: D
|
|
5382
|
-
}), Re(a,
|
|
5500
|
+
}), Re(a, u)) return !0;
|
|
5383
5501
|
if (Vn(a, T))
|
|
5384
5502
|
return fe(a), !0;
|
|
5385
|
-
if (Ie[T] || !(
|
|
5386
|
-
const S = Kn(a, T,
|
|
5387
|
-
return S === !1 && (ae(k.afterSanitizeElements, a, null), Re(a,
|
|
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;
|
|
5388
5506
|
}
|
|
5389
5507
|
if (Y(a) === Q.element && !Un(a) || (T === "noscript" || T === "noembed" || T === "noframes") && K(Pi, a.innerHTML))
|
|
5390
5508
|
return fe(a), !0;
|
|
5391
|
-
if (
|
|
5509
|
+
if (de && a.nodeType === Q.text) {
|
|
5392
5510
|
const S = Ze(a.textContent);
|
|
5393
5511
|
a.textContent !== S && (_e(e.removed, { element: a.cloneNode() }), a.textContent = S);
|
|
5394
5512
|
}
|
|
5395
|
-
return ae(k.afterSanitizeElements, a, null), Re(a,
|
|
5396
|
-
}, nn = function(a,
|
|
5397
|
-
if (Dt[
|
|
5398
|
-
const S = N[
|
|
5399
|
-
return rt && K(An,
|
|
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);
|
|
5400
5518
|
}, jn = L({}, [
|
|
5401
5519
|
"annotation-xml",
|
|
5402
5520
|
"color-profile",
|
|
@@ -5408,22 +5526,22 @@ function Mn() {
|
|
|
5408
5526
|
"missing-glyph"
|
|
5409
5527
|
]), sn = function(a) {
|
|
5410
5528
|
return !jn[Pe(a)] && K(In, a);
|
|
5411
|
-
}, Gn = function(a,
|
|
5412
|
-
if (_ && typeof h == "object" && typeof h.getAttributeType == "function" && !T) switch (h.getAttributeType(a,
|
|
5529
|
+
}, Gn = function(a, u, T, S) {
|
|
5530
|
+
if (_ && typeof h == "object" && typeof h.getAttributeType == "function" && !T) switch (h.getAttributeType(a, u)) {
|
|
5413
5531
|
case "TrustedHTML":
|
|
5414
5532
|
return ne(S);
|
|
5415
5533
|
case "TrustedScriptURL":
|
|
5416
5534
|
return le(S);
|
|
5417
5535
|
}
|
|
5418
5536
|
return S;
|
|
5419
|
-
}, qn = function(a,
|
|
5537
|
+
}, qn = function(a, u, T, S) {
|
|
5420
5538
|
try {
|
|
5421
|
-
return T ? a.setAttributeNS(T,
|
|
5539
|
+
return T ? a.setAttributeNS(T, u, S) : a.setAttribute(u, S), Xe(a) ? (fe(a), !1) : !0;
|
|
5422
5540
|
} catch (v) {
|
|
5423
|
-
return be(
|
|
5541
|
+
return be(u, a), !1;
|
|
5424
5542
|
}
|
|
5425
|
-
}, rn = function(a,
|
|
5426
|
-
if (ae(k.beforeSanitizeAttributes, a, null), Re(a,
|
|
5543
|
+
}, rn = function(a, u) {
|
|
5544
|
+
if (ae(k.beforeSanitizeAttributes, a, null), Re(a, u)) return;
|
|
5427
5545
|
const T = a.attributes;
|
|
5428
5546
|
if (!T || Xe(a)) return;
|
|
5429
5547
|
N = en(k.uponSanitizeAttribute, N, st, We);
|
|
@@ -5439,11 +5557,11 @@ function Mn() {
|
|
|
5439
5557
|
for (; v--; ) {
|
|
5440
5558
|
const R = T[v], H = R.name, ee = R.namespaceURI, X = R.value, Le = P(H), yt = X;
|
|
5441
5559
|
let G = H === "value" ? yt : xi(yt), on = !1;
|
|
5442
|
-
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") &&
|
|
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)) {
|
|
5443
5561
|
be(H, a, R);
|
|
5444
5562
|
continue;
|
|
5445
5563
|
}
|
|
5446
|
-
if (Le === "attributename" &&
|
|
5564
|
+
if (Le === "attributename" && un(G, "href")) {
|
|
5447
5565
|
be(H, a, R);
|
|
5448
5566
|
continue;
|
|
5449
5567
|
}
|
|
@@ -5456,36 +5574,36 @@ function Mn() {
|
|
|
5456
5574
|
be(H, a, R);
|
|
5457
5575
|
continue;
|
|
5458
5576
|
}
|
|
5459
|
-
if (
|
|
5577
|
+
if (de && (G = Ze(G)), !nn(M, Le, G)) {
|
|
5460
5578
|
be(H, a, R);
|
|
5461
5579
|
continue;
|
|
5462
5580
|
}
|
|
5463
5581
|
G = Gn(M, Le, ee, G), G !== yt && qn(a, H, ee, G) && on && hn(e.removed);
|
|
5464
5582
|
}
|
|
5465
5583
|
}
|
|
5466
|
-
ae(k.afterSanitizeAttributes, a, null), Re(a,
|
|
5584
|
+
ae(k.afterSanitizeAttributes, a, null), Re(a, u);
|
|
5467
5585
|
}, Je = function(a) {
|
|
5468
|
-
let
|
|
5586
|
+
let u = null;
|
|
5469
5587
|
const T = Jt(a);
|
|
5470
|
-
for (ae(k.beforeSanitizeShadowDOM, a, null);
|
|
5471
|
-
if (ae(k.uponSanitizeShadowNode,
|
|
5472
|
-
const S = E(
|
|
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) {
|
|
5590
|
+
const S = E(u);
|
|
5473
5591
|
Me(S) && (mt(S), Je(S));
|
|
5474
5592
|
}
|
|
5475
5593
|
ae(k.afterSanitizeShadowDOM, a, null);
|
|
5476
5594
|
}, mt = function(a) {
|
|
5477
|
-
const
|
|
5595
|
+
const u = [{
|
|
5478
5596
|
node: a,
|
|
5479
5597
|
shadow: null
|
|
5480
5598
|
}];
|
|
5481
|
-
for (;
|
|
5482
|
-
const T =
|
|
5599
|
+
for (; u.length > 0; ) {
|
|
5600
|
+
const T = u.pop();
|
|
5483
5601
|
if (T.shadow) {
|
|
5484
5602
|
Je(T.shadow);
|
|
5485
5603
|
continue;
|
|
5486
5604
|
}
|
|
5487
5605
|
const S = T.node, v = Y(S) === Q.element, M = b(S);
|
|
5488
|
-
if (M) for (let R = M.length - 1; R >= 0; --R)
|
|
5606
|
+
if (M) for (let R = M.length - 1; R >= 0; --R) u.push({
|
|
5489
5607
|
node: M[R],
|
|
5490
5608
|
shadow: null
|
|
5491
5609
|
});
|
|
@@ -5493,7 +5611,7 @@ function Mn() {
|
|
|
5493
5611
|
const R = I ? I(S) : null;
|
|
5494
5612
|
if (typeof R == "string" && P(R) === "template") {
|
|
5495
5613
|
const H = S.content;
|
|
5496
|
-
Me(H) &&
|
|
5614
|
+
Me(H) && u.push({
|
|
5497
5615
|
node: H,
|
|
5498
5616
|
shadow: null
|
|
5499
5617
|
});
|
|
@@ -5501,7 +5619,7 @@ function Mn() {
|
|
|
5501
5619
|
}
|
|
5502
5620
|
if (v) {
|
|
5503
5621
|
const R = E(S);
|
|
5504
|
-
Me(R) &&
|
|
5622
|
+
Me(R) && u.push({
|
|
5505
5623
|
node: null,
|
|
5506
5624
|
shadow: R
|
|
5507
5625
|
}, {
|
|
@@ -5512,7 +5630,7 @@ function Mn() {
|
|
|
5512
5630
|
}
|
|
5513
5631
|
};
|
|
5514
5632
|
return e.sanitize = function(x) {
|
|
5515
|
-
let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5633
|
+
let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, T = null, S = null, v = null;
|
|
5516
5634
|
if (ht = !x, ht && (x = "<!-->"), typeof x != "string" && !Ne(x) && (x = Ci(x), typeof x != "string"))
|
|
5517
5635
|
throw ge("dirty is not a string, aborting");
|
|
5518
5636
|
if (!e.isSupported) return x;
|
|
@@ -5534,13 +5652,13 @@ function Mn() {
|
|
|
5534
5652
|
throw qe(x), X;
|
|
5535
5653
|
}
|
|
5536
5654
|
} else if (Ne(x))
|
|
5537
|
-
|
|
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);
|
|
5538
5656
|
else {
|
|
5539
|
-
if (!Se && !
|
|
5540
|
-
if (
|
|
5657
|
+
if (!Se && !de && !ye && x.indexOf("<") === -1) return _ && Ke ? ne(x) : x;
|
|
5658
|
+
if (u = Qt(x), !u) return Se ? null : Ke ? U : "";
|
|
5541
5659
|
}
|
|
5542
|
-
|
|
5543
|
-
const R = M ? x :
|
|
5660
|
+
u && at && fe(u.firstChild);
|
|
5661
|
+
const R = M ? x : u;
|
|
5544
5662
|
try {
|
|
5545
5663
|
const ee = Jt(R);
|
|
5546
5664
|
for (; S = ee.nextNode(); )
|
|
@@ -5555,33 +5673,33 @@ function Mn() {
|
|
|
5555
5673
|
if (Te(e.removed, (X) => {
|
|
5556
5674
|
X.element && (X.element === x && (ee = !0), Ye(X.element));
|
|
5557
5675
|
}), ee) throw ge("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
5558
|
-
return
|
|
5676
|
+
return de && pt(x), x;
|
|
5559
5677
|
}
|
|
5560
5678
|
if (Se) {
|
|
5561
|
-
if (
|
|
5562
|
-
for (v = nt.call(
|
|
5563
|
-
else v =
|
|
5679
|
+
if (de && pt(u), Ve)
|
|
5680
|
+
for (v = nt.call(u.ownerDocument); u.firstChild; ) v.appendChild(u.firstChild);
|
|
5681
|
+
else v = u;
|
|
5564
5682
|
return (N.shadowroot || N.shadowrootmode) && (v = he.call(n, v, !0)), v;
|
|
5565
5683
|
}
|
|
5566
|
-
let H = ye ?
|
|
5567
|
-
return ye && D["!doctype"] &&
|
|
5568
|
-
` + H),
|
|
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;
|
|
5569
5687
|
}, e.setConfig = function() {
|
|
5570
5688
|
let x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
5571
5689
|
gt(x), ot = !0, Be = D, We = N;
|
|
5572
5690
|
}, e.clearConfig = function() {
|
|
5573
5691
|
Ce = null, ot = !1, Be = null, We = null, _ = j, U = "";
|
|
5574
|
-
}, e.isValidAttribute = function(x, a,
|
|
5692
|
+
}, e.isValidAttribute = function(x, a, u) {
|
|
5575
5693
|
Ce || gt({});
|
|
5576
5694
|
const T = P(x), S = P(a);
|
|
5577
|
-
return nn(T, S,
|
|
5695
|
+
return nn(T, S, u);
|
|
5578
5696
|
}, e.addHook = function(x, a) {
|
|
5579
5697
|
typeof a == "function" && q(k, x) && _e(k[x], a);
|
|
5580
5698
|
}, e.removeHook = function(x, a) {
|
|
5581
5699
|
if (q(k, x)) {
|
|
5582
5700
|
if (a !== void 0) {
|
|
5583
|
-
const
|
|
5584
|
-
return
|
|
5701
|
+
const u = bi(k[x], a);
|
|
5702
|
+
return u === -1 ? void 0 : Ti(k[x], u, 1)[0];
|
|
5585
5703
|
}
|
|
5586
5704
|
return hn(k[x]);
|
|
5587
5705
|
}
|
|
@@ -6014,10 +6132,10 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
|
|
|
6014
6132
|
for (; h && h !== document.body; ) {
|
|
6015
6133
|
if ((c = h.classList) != null && c.contains("rte-content"))
|
|
6016
6134
|
return h;
|
|
6017
|
-
const
|
|
6135
|
+
const d = h.querySelector(
|
|
6018
6136
|
".rte-content"
|
|
6019
6137
|
);
|
|
6020
|
-
if (
|
|
6138
|
+
if (d) return d;
|
|
6021
6139
|
h = h.parentElement;
|
|
6022
6140
|
}
|
|
6023
6141
|
}
|
|
@@ -6047,7 +6165,7 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
|
|
|
6047
6165
|
return (() => {
|
|
6048
6166
|
document.querySelectorAll(".rte-source-editor-overlay").forEach((O) => O.remove());
|
|
6049
6167
|
const r = n(t);
|
|
6050
|
-
let o = null, l = "dark", c = !1, h = !1,
|
|
6168
|
+
let o = null, l = "dark", c = !1, h = !1, d = !1, f = !1;
|
|
6051
6169
|
const y = !!e.closest(Et) || document.body.matches(Et) || document.documentElement.matches(Et), g = document.createElement("div");
|
|
6052
6170
|
Xn(g), g.className = "rte-source-editor-overlay", y && g.classList.add("rte-theme-dark");
|
|
6053
6171
|
const p = document.createElement("div");
|
|
@@ -6130,7 +6248,7 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
|
|
|
6130
6248
|
() => O.removeEventListener(he, k, Ue)
|
|
6131
6249
|
);
|
|
6132
6250
|
}, ne = (O) => {
|
|
6133
|
-
|
|
6251
|
+
d !== O && (d = O, ce && (ce.style.display = d ? "inline" : "none"));
|
|
6134
6252
|
}, le = () => {
|
|
6135
6253
|
if (!f) {
|
|
6136
6254
|
for (f = !0; se.length; ) {
|
|
@@ -6181,7 +6299,7 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
|
|
|
6181
6299
|
</svg>
|
|
6182
6300
|
`);
|
|
6183
6301
|
}, ze = () => {
|
|
6184
|
-
|
|
6302
|
+
d && !confirm("You have unsaved changes. Are you sure you want to cancel?") || le();
|
|
6185
6303
|
}, nt = () => {
|
|
6186
6304
|
try {
|
|
6187
6305
|
const O = (o == null ? void 0 : o.getValue()) || "";
|
|
@@ -6247,4 +6365,4 @@ const Et = '[data-theme="dark"], .dark, .editora-theme-dark', ji = `/* Source Ed
|
|
|
6247
6365
|
export {
|
|
6248
6366
|
Gi as CodePlugin
|
|
6249
6367
|
};
|
|
6250
|
-
//# sourceMappingURL=CodePlugin.native-
|
|
6368
|
+
//# sourceMappingURL=CodePlugin.native-DZgIez08.mjs.map
|