@editora/core 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- class V {
1
+ class _ {
2
2
  constructor(e = "") {
3
3
  this._lines = [], this._version = 0, this.setText(e);
4
4
  }
@@ -37,8 +37,8 @@ class V {
37
37
  }
38
38
  // Replace text in range
39
39
  replaceRange(e, t) {
40
- const i = this.normalizeRange(e), s = this.getTextInRange(i), n = this.getText(), r = this.positionToOffset(i.start), o = this.positionToOffset(i.end), l = n.slice(0, r) + t + n.slice(o);
41
- return this.setText(l), { range: i, text: t, oldText: s };
40
+ const i = this.normalizeRange(e), n = this.getTextInRange(i), s = this.getText(), r = this.positionToOffset(i.start), o = this.positionToOffset(i.end), l = s.slice(0, r) + t + s.slice(o);
41
+ return this.setText(l), { range: i, text: t, oldText: n };
42
42
  }
43
43
  // Insert text at position
44
44
  insertText(e, t) {
@@ -60,10 +60,10 @@ class V {
60
60
  offsetToPosition(e) {
61
61
  let t = e;
62
62
  for (let i = 0; i < this.getLineCount(); i++) {
63
- const s = this.getLine(i).length;
64
- if (t <= s)
63
+ const n = this.getLine(i).length;
64
+ if (t <= n)
65
65
  return { line: i, column: t };
66
- t -= s + 1;
66
+ t -= n + 1;
67
67
  }
68
68
  return {
69
69
  line: this.getLineCount() - 1,
@@ -84,7 +84,7 @@ class V {
84
84
  }
85
85
  // Clone the model
86
86
  clone() {
87
- const e = new V();
87
+ const e = new _();
88
88
  return e._lines = [...this._lines], e._version = this._version, e;
89
89
  }
90
90
  normalizeRange(e) {
@@ -207,14 +207,14 @@ class Q {
207
207
  if (this.updateGutterWidth(e), e === this.lastLineCount)
208
208
  return;
209
209
  this.lastLineCount = e;
210
- const t = Math.max(e, 1), i = Array.from({ length: t }, (s, n) => n + 1);
211
- this.lineNumbersContentElement.innerHTML = i.map((s) => `<div style="height: ${this.lineHeight}px; line-height: ${this.lineHeight}px;">${s}</div>`).join("");
210
+ const t = Math.max(e, 1), i = Array.from({ length: t }, (n, s) => s + 1);
211
+ this.lineNumbersContentElement.innerHTML = i.map((n) => `<div style="height: ${this.lineHeight}px; line-height: ${this.lineHeight}px;">${n}</div>`).join("");
212
212
  }
213
213
  updateGutterWidth(e) {
214
- const t = String(Math.max(e, 1)).length * this.gutterDigitWidth + this.gutterLineNumberPaddingLeft + this.gutterLineNumberPaddingRight, i = Math.ceil(
215
- t + this.gutterFoldColumnGap + this.gutterFoldColumnWidth
214
+ const i = String(Math.max(e, 1)).length * this.gutterDigitWidth + this.gutterLineNumberPaddingLeft + this.gutterLineNumberPaddingRight, n = Math.ceil(
215
+ i + this.gutterFoldColumnGap + this.gutterFoldColumnWidth
216
216
  );
217
- 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`));
217
+ n !== this.gutterWidth && (this.gutterWidth = n, this.lineNumbersElement.style.display !== "none" && (this.lineNumbersElement.style.width = `${this.gutterWidth}px`, this.lineNumbersElement.style.minWidth = `${this.gutterWidth}px`));
218
218
  }
219
219
  setDecorations(e, t) {
220
220
  this.renderLineDecorations(e), this.renderGutterDecorations(t);
@@ -245,17 +245,17 @@ class Q {
245
245
  // Set inner HTML (used for syntax highlighted content)
246
246
  setHTML(e) {
247
247
  this.clearHighlightOverlay(), this.setFoldPlaceholderSources(/* @__PURE__ */ new Map());
248
- const t = /\n$/.test(e), i = /&lt;|&gt;/.test(e), s = /<span\b/i.test(e), n = /<[^>]+>/.test(e);
249
- i && s ? this.contentElement.innerHTML = e : n && !i ? this.contentElement.textContent = e : this.contentElement.innerHTML = e, this.syncTrailingNewlineMarker(t);
250
- const r = (this.contentElement.textContent || "").split(`
248
+ const t = /\n$/.test(e), i = /&lt;|&gt;/.test(e), n = /<span\b/i.test(e), s = /<[^>]+>/.test(e);
249
+ i && n ? this.contentElement.innerHTML = e : s && !i ? this.contentElement.textContent = e : this.contentElement.innerHTML = e, this.syncTrailingNewlineMarker(t);
250
+ const o = (this.contentElement.textContent || "").split(`
251
251
  `).length;
252
- this.updateLineNumbers(r);
252
+ this.updateLineNumbers(o);
253
253
  }
254
254
  setHighlightHTML(e) {
255
255
  e !== this.lastHighlightHTML && (this.highlightElement.innerHTML = e, this.lastHighlightHTML = e), this.highlightElement.style.visibility = "visible", this.highlightOverlayActive = !0, this.contentElement.style.color = "transparent", this.contentElement.style.WebkitTextFillColor = "transparent";
256
- const t = (this.contentElement.textContent || "").split(`
256
+ const i = (this.contentElement.textContent || "").split(`
257
257
  `).length;
258
- this.updateLineNumbers(t);
258
+ this.updateLineNumbers(i);
259
259
  }
260
260
  setLineWrapping(e) {
261
261
  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";
@@ -280,10 +280,10 @@ class Q {
280
280
  }
281
281
  // Set cursor position
282
282
  setCursorPosition(e) {
283
- const t = this.getText(), i = this.positionToTextOffset(e, t), s = window.getSelection(), n = this.createDomRangeFromOffsets(i);
284
- if (n)
283
+ const t = this.getText(), i = this.positionToTextOffset(e, t), n = window.getSelection(), s = this.createDomRangeFromOffsets(i);
284
+ if (s)
285
285
  try {
286
- s == null || s.removeAllRanges(), s == null || s.addRange(n), this.ensureCaretVisible();
286
+ n == null || n.removeAllRanges(), n == null || n.addRange(s), this.ensureCaretVisible();
287
287
  } catch (r) {
288
288
  console.warn("Could not set cursor position:", r);
289
289
  }
@@ -292,7 +292,7 @@ class Q {
292
292
  `[${this.trailingNewlineMarkerAttr}]`
293
293
  ), o = document.createRange();
294
294
  try {
295
- r && r.parentNode === this.contentElement ? o.setStartBefore(r) : (o.selectNodeContents(this.contentElement), o.collapse(!1)), o.collapse(!0), s == null || s.removeAllRanges(), s == null || s.addRange(o), this.ensureCaretVisible();
295
+ r && r.parentNode === this.contentElement ? o.setStartBefore(r) : (o.selectNodeContents(this.contentElement), o.collapse(!1)), o.collapse(!0), n == null || n.removeAllRanges(), n == null || n.addRange(o), this.ensureCaretVisible();
296
296
  } catch (l) {
297
297
  console.warn("Could not set fallback cursor position:", l);
298
298
  }
@@ -322,7 +322,7 @@ class Q {
322
322
  const i = e.anchorNode && this.isNodeInsideContent(e.anchorNode) ? this.sourceOffsetFromBoundary(
323
323
  e.anchorNode,
324
324
  e.anchorOffset
325
- ) : void 0, s = e.focusNode && this.isNodeInsideContent(e.focusNode) ? this.sourceOffsetFromBoundary(
325
+ ) : void 0, n = e.focusNode && this.isNodeInsideContent(e.focusNode) ? this.sourceOffsetFromBoundary(
326
326
  e.focusNode,
327
327
  e.focusOffset
328
328
  ) : void 0;
@@ -338,7 +338,7 @@ class Q {
338
338
  t.endOffset
339
339
  ),
340
340
  anchorOffset: i,
341
- focusOffset: s
341
+ focusOffset: n
342
342
  };
343
343
  }
344
344
  getSelectionState() {
@@ -354,10 +354,10 @@ class Q {
354
354
  isInEditor: !1,
355
355
  isCollapsed: e.isCollapsed
356
356
  };
357
- const i = this.getText(), s = this.sourceOffsetFromBoundary(t.startContainer, t.startOffset), n = this.sourceOffsetFromBoundary(t.endContainer, t.endOffset), r = e.focusNode && this.isNodeInsideContent(e.focusNode) ? this.sourceOffsetFromBoundary(
357
+ const i = this.getText(), n = this.sourceOffsetFromBoundary(t.startContainer, t.startOffset), s = this.sourceOffsetFromBoundary(t.endContainer, t.endOffset), r = e.focusNode && this.isNodeInsideContent(e.focusNode) ? this.sourceOffsetFromBoundary(
358
358
  e.focusNode,
359
359
  e.focusOffset
360
- ) : n, o = this.offsetToPositionInText(s, i), l = this.offsetToPositionInText(n, i), a = this.offsetToPositionInText(r, i);
360
+ ) : s, o = this.offsetToPositionInText(n, i), l = this.offsetToPositionInText(s, i), a = this.offsetToPositionInText(r, i);
361
361
  return {
362
362
  isInEditor: !0,
363
363
  isCollapsed: e.isCollapsed,
@@ -377,12 +377,12 @@ class Q {
377
377
  }
378
378
  }
379
379
  createDomRangeFromOffsets(e, t = e) {
380
- const [i, s] = e <= t ? [e, t] : [t, e], n = this.resolveOffsetToDomPoint(i), r = this.resolveOffsetToDomPoint(s);
381
- if (!n || !r)
380
+ const [i, n] = e <= t ? [e, t] : [t, e], s = this.resolveOffsetToDomPoint(i), r = this.resolveOffsetToDomPoint(n);
381
+ if (!s || !r)
382
382
  return null;
383
383
  const o = document.createRange();
384
384
  try {
385
- return o.setStart(n.node, n.offset), o.setEnd(r.node, r.offset), o;
385
+ return o.setStart(s.node, s.offset), o.setEnd(r.node, r.offset), o;
386
386
  } catch (l) {
387
387
  return null;
388
388
  }
@@ -398,43 +398,43 @@ class Q {
398
398
  const i = this.getDomRangeFromClientPoint(e, t);
399
399
  if (!i || !this.isNodeInsideContent(i.startContainer))
400
400
  return null;
401
- const s = this.sourceOffsetFromBoundary(
401
+ const n = this.sourceOffsetFromBoundary(
402
402
  i.startContainer,
403
403
  i.startOffset
404
404
  );
405
- return this.offsetToPositionInText(s, this.getText());
405
+ return this.offsetToPositionInText(n, this.getText());
406
406
  }
407
407
  setSelectionOffsets(e, t = e) {
408
408
  const i = this.createDomRangeFromOffsets(e, t);
409
409
  if (i)
410
410
  try {
411
- const s = window.getSelection();
412
- s == null || s.removeAllRanges(), s == null || s.addRange(i), this.ensureCaretVisible();
413
- } catch (s) {
414
- console.warn("Could not set selection offsets:", s);
411
+ const n = window.getSelection();
412
+ n == null || n.removeAllRanges(), n == null || n.addRange(i), this.ensureCaretVisible();
413
+ } catch (n) {
414
+ console.warn("Could not set selection offsets:", n);
415
415
  }
416
416
  }
417
417
  setSelectionBoundaryOffsets(e, t) {
418
- const i = this.resolveOffsetToDomPoint(e), s = this.resolveOffsetToDomPoint(t), n = window.getSelection();
419
- if (!i || !s || !n) {
418
+ const i = this.resolveOffsetToDomPoint(e), n = this.resolveOffsetToDomPoint(t), s = window.getSelection();
419
+ if (!i || !n || !s) {
420
420
  this.setSelectionOffsets(e, t);
421
421
  return;
422
422
  }
423
423
  try {
424
- if (n.removeAllRanges(), e === t) {
424
+ if (s.removeAllRanges(), e === t) {
425
425
  const o = document.createRange();
426
- o.setStart(i.node, i.offset), o.collapse(!0), n.addRange(o), this.ensureCaretVisible();
426
+ o.setStart(i.node, i.offset), o.collapse(!0), s.addRange(o), this.ensureCaretVisible();
427
427
  return;
428
428
  }
429
- if (typeof n.extend == "function") {
429
+ if (typeof s.extend == "function") {
430
430
  const o = document.createRange();
431
- o.setStart(i.node, i.offset), o.collapse(!0), n.addRange(o), n.extend(s.node, s.offset), this.ensureCaretVisible();
431
+ o.setStart(i.node, i.offset), o.collapse(!0), s.addRange(o), s.extend(n.node, n.offset), this.ensureCaretVisible();
432
432
  return;
433
433
  }
434
434
  const r = this.createDomRangeFromOffsets(e, t);
435
435
  if (!r)
436
436
  return;
437
- n.addRange(r), this.ensureCaretVisible();
437
+ s.addRange(r), this.ensureCaretVisible();
438
438
  } catch (r) {
439
439
  console.warn("Could not set selection boundary offsets:", r), this.setSelectionOffsets(e, t);
440
440
  }
@@ -459,8 +459,8 @@ class Q {
459
459
  }
460
460
  // Scroll to position
461
461
  scrollToPosition(e) {
462
- const t = Math.max(0, Math.floor(e.line) || 0) * this.lineHeight - this.editorContainer.clientHeight / 2 + this.lineHeight / 2;
463
- this.editorContainer.scrollTop = Math.max(0, t);
462
+ const n = Math.max(0, Math.floor(e.line) || 0) * this.lineHeight - this.editorContainer.clientHeight / 2 + this.lineHeight / 2;
463
+ this.editorContainer.scrollTop = Math.max(0, n);
464
464
  }
465
465
  // Get scroll position
466
466
  getScrollTop() {
@@ -491,39 +491,39 @@ class Q {
491
491
  if (!e || e.rangeCount === 0) return;
492
492
  const t = this.getCaretClientRect(e);
493
493
  if (!t) return;
494
- const i = this.editorContainer.getBoundingClientRect(), s = 12;
495
- t.bottom > i.bottom - s ? this.editorContainer.scrollTop += t.bottom - (i.bottom - s) : t.top < i.top + s && (this.editorContainer.scrollTop -= i.top + s - t.top), t.right > i.right - s ? this.editorContainer.scrollLeft += t.right - (i.right - s) : t.left < i.left + s && (this.editorContainer.scrollLeft -= i.left + s - t.left);
494
+ const i = this.editorContainer.getBoundingClientRect(), n = 12;
495
+ t.bottom > i.bottom - n ? this.editorContainer.scrollTop += t.bottom - (i.bottom - n) : t.top < i.top + n && (this.editorContainer.scrollTop -= i.top + n - t.top), t.right > i.right - n ? this.editorContainer.scrollLeft += t.right - (i.right - n) : t.left < i.left + n && (this.editorContainer.scrollLeft -= i.left + n - t.left);
496
496
  }
497
497
  // Destroy the view
498
498
  destroy() {
499
499
  this.clearDecorations(), this.container && (this.container.innerHTML = ""), this._rafId && (cancelAnimationFrame(this._rafId), this._rafId = void 0);
500
500
  }
501
501
  resolveOffsetToDomPoint(e) {
502
- var n;
502
+ var s;
503
503
  const t = Math.max(0, e);
504
504
  let i = 0;
505
- const s = Array.from(this.contentElement.childNodes);
506
- for (let r = 0; r < s.length; r++) {
507
- const o = s[r];
505
+ const n = Array.from(this.contentElement.childNodes);
506
+ for (let r = 0; r < n.length; r++) {
507
+ const o = n[r];
508
508
  if (o instanceof Text) {
509
509
  const l = o.textContent || "", a = this.buildVisibleToDomMap(l), h = Math.max(0, a.length - 1);
510
510
  if (i + h >= t) {
511
- const d = Math.max(0, t - i), c = (n = a[d]) != null ? n : l.length;
512
- return { node: o, offset: c };
511
+ const c = Math.max(0, t - i), g = (s = a[c]) != null ? s : l.length;
512
+ return { node: o, offset: g };
513
513
  }
514
514
  i += h;
515
515
  continue;
516
516
  }
517
517
  if (o instanceof HTMLElement && !o.hasAttribute(this.trailingNewlineMarkerAttr) && o.hasAttribute(this.foldPlaceholderAttr)) {
518
- const l = this.getFoldPlaceholderSource(o).length;
519
- if (i + l >= t) {
520
- const a = t - i;
518
+ const a = this.getFoldPlaceholderSource(o).length;
519
+ if (i + a >= t) {
520
+ const h = t - i;
521
521
  return {
522
522
  node: this.contentElement,
523
- offset: a <= l / 2 ? r : r + 1
523
+ offset: h <= a / 2 ? r : r + 1
524
524
  };
525
525
  }
526
- i += l;
526
+ i += a;
527
527
  }
528
528
  }
529
529
  return {
@@ -534,14 +534,14 @@ class Q {
534
534
  getDomRangeFromClientPoint(e, t) {
535
535
  const i = document;
536
536
  if (typeof i.caretPositionFromPoint == "function") {
537
- const s = i.caretPositionFromPoint(
537
+ const n = i.caretPositionFromPoint(
538
538
  e,
539
539
  t
540
540
  );
541
- if (s != null && s.offsetNode) {
542
- const n = document.createRange();
541
+ if (n != null && n.offsetNode) {
542
+ const s = document.createRange();
543
543
  try {
544
- return n.setStart(s.offsetNode, s.offset), n.collapse(!0), n;
544
+ return s.setStart(n.offsetNode, n.offset), s.collapse(!0), s;
545
545
  } catch (r) {
546
546
  return null;
547
547
  }
@@ -552,9 +552,9 @@ class Q {
552
552
  buildVisibleToDomMap(e) {
553
553
  const t = [0];
554
554
  let i = 0;
555
- for (let s = 0; s < e.length; s++) {
556
- const n = e[s];
557
- this.virtualMarkerRegex.test(n) || (i += 1, t[i] = s + 1);
555
+ for (let n = 0; n < e.length; n++) {
556
+ const s = e[n];
557
+ this.virtualMarkerRegex.test(s) || (i += 1, t[i] = n + 1);
558
558
  }
559
559
  return t;
560
560
  }
@@ -568,23 +568,23 @@ class Q {
568
568
  const i = this.getUsableRangeRect(t);
569
569
  if (i)
570
570
  return i;
571
- const s = e.focusNode, n = e.focusOffset;
572
- if (s instanceof Text) {
573
- const h = (l = (o = s.textContent) == null ? void 0 : o.length) != null ? l : 0, d = document.createRange();
574
- if (n < h) {
575
- d.setStart(s, n), d.setEnd(s, Math.min(h, n + 1));
576
- const c = this.getUsableRangeRect(d);
577
- if (c)
578
- return c;
571
+ const n = e.focusNode, s = e.focusOffset;
572
+ if (n instanceof Text) {
573
+ const h = (l = (o = n.textContent) == null ? void 0 : o.length) != null ? l : 0, c = document.createRange();
574
+ if (s < h) {
575
+ c.setStart(n, s), c.setEnd(n, Math.min(h, s + 1));
576
+ const g = this.getUsableRangeRect(c);
577
+ if (g)
578
+ return g;
579
579
  }
580
- if (n > 0) {
581
- d.setStart(s, n - 1), d.setEnd(s, n);
582
- const c = this.getUsableRangeRect(d);
583
- if (c)
584
- return c;
580
+ if (s > 0) {
581
+ c.setStart(n, s - 1), c.setEnd(n, s);
582
+ const g = this.getUsableRangeRect(c);
583
+ if (g)
584
+ return g;
585
585
  }
586
586
  }
587
- const r = s instanceof Element ? s : (a = s == null ? void 0 : s.parentElement) != null ? a : null;
587
+ const r = n instanceof Element ? n : (a = n == null ? void 0 : n.parentElement) != null ? a : null;
588
588
  if (r && r !== this.contentElement && r !== this.editorContainer && this.contentElement.contains(r)) {
589
589
  const h = r.getBoundingClientRect();
590
590
  if (this.isUsableRect(h))
@@ -594,9 +594,9 @@ class Q {
594
594
  }
595
595
  getUsableRangeRect(e) {
596
596
  const t = Array.from(e.getClientRects());
597
- for (let s = 0; s < t.length; s++)
598
- if (this.isUsableRect(t[s]))
599
- return t[s];
597
+ for (let n = 0; n < t.length; n++)
598
+ if (this.isUsableRect(t[n]))
599
+ return t[n];
600
600
  const i = e.getBoundingClientRect();
601
601
  return this.isUsableRect(i) ? i : null;
602
602
  }
@@ -629,14 +629,14 @@ class Q {
629
629
  }
630
630
  sourceOffsetFromBoundary(e, t) {
631
631
  let i = 0;
632
- const s = Array.from(this.contentElement.childNodes);
632
+ const n = Array.from(this.contentElement.childNodes);
633
633
  if (e === this.contentElement) {
634
- for (let n = 0; n < Math.min(t, s.length); n++)
635
- i += this.getSourceLength(s[n]);
634
+ for (let s = 0; s < Math.min(t, n.length); s++)
635
+ i += this.getSourceLength(n[s]);
636
636
  return i;
637
637
  }
638
- for (let n = 0; n < s.length; n++) {
639
- const r = s[n];
638
+ for (let s = 0; s < n.length; s++) {
639
+ const r = n[s];
640
640
  if (r === e) {
641
641
  if (r instanceof Text)
642
642
  return i + this.stripVirtualMarkers((r.textContent || "").slice(0, t)).length;
@@ -664,40 +664,40 @@ class Q {
664
664
  return i;
665
665
  }
666
666
  sourceOffsetWithinNode(e, t, i) {
667
- let s = 0;
668
- const n = Array.from(e.childNodes);
667
+ let n = 0;
668
+ const s = Array.from(e.childNodes);
669
669
  if (t === e) {
670
- for (let r = 0; r < Math.min(i, n.length); r++)
671
- s += this.getSourceLength(n[r]);
672
- return s;
670
+ for (let r = 0; r < Math.min(i, s.length); r++)
671
+ n += this.getSourceLength(s[r]);
672
+ return n;
673
673
  }
674
- for (let r = 0; r < n.length; r++) {
675
- const o = n[r];
674
+ for (let r = 0; r < s.length; r++) {
675
+ const o = s[r];
676
676
  if (o === t) {
677
677
  if (o instanceof Text)
678
- return s + this.stripVirtualMarkers((o.textContent || "").slice(0, i)).length;
678
+ return n + this.stripVirtualMarkers((o.textContent || "").slice(0, i)).length;
679
679
  if (o instanceof HTMLElement) {
680
680
  if (o.hasAttribute(this.foldPlaceholderAttr))
681
- return s + this.getFoldPlaceholderBoundaryOffset(
681
+ return n + this.getFoldPlaceholderBoundaryOffset(
682
682
  o,
683
683
  o,
684
684
  i
685
685
  );
686
686
  const l = Array.from(o.childNodes);
687
687
  for (let a = 0; a < Math.min(i, l.length); a++)
688
- s += this.getSourceLength(l[a]);
689
- return s;
688
+ n += this.getSourceLength(l[a]);
689
+ return n;
690
690
  }
691
691
  }
692
692
  if (o instanceof HTMLElement && o.contains(t))
693
- return o.hasAttribute(this.foldPlaceholderAttr) ? s + this.getFoldPlaceholderBoundaryOffset(
693
+ return o.hasAttribute(this.foldPlaceholderAttr) ? n + this.getFoldPlaceholderBoundaryOffset(
694
694
  o,
695
695
  t,
696
696
  i
697
- ) : s + this.sourceOffsetWithinNode(o, t, i);
698
- s += this.getSourceLength(o);
697
+ ) : n + this.sourceOffsetWithinNode(o, t, i);
698
+ n += this.getSourceLength(o);
699
699
  }
700
- return s;
700
+ return n;
701
701
  }
702
702
  getSourceLength(e) {
703
703
  if (e instanceof Text)
@@ -712,44 +712,44 @@ class Q {
712
712
  }), t;
713
713
  }
714
714
  renderLineDecorations(e) {
715
- const t = [...e].filter((n) => Number.isFinite(n.line) && n.line >= 0).sort((n, r) => n.line - r.line || n.id.localeCompare(r.id)), i = t.map(
716
- (n) => `${n.id}:${n.line}:${n.className || ""}:${this.serializeStyleObject(n.style)}`
715
+ const t = [...e].filter((s) => Number.isFinite(s.line) && s.line >= 0).sort((s, r) => s.line - r.line || s.id.localeCompare(r.id)), i = t.map(
716
+ (s) => `${s.id}:${s.line}:${s.className || ""}:${this.serializeStyleObject(s.style)}`
717
717
  ).join("|");
718
718
  if (i === this.lastLineDecorationSnapshot || (this.lineDecorationsElement.innerHTML = "", this.lastLineDecorationSnapshot = i, t.length === 0))
719
719
  return;
720
- const s = document.createDocumentFragment();
721
- for (const n of t) {
720
+ const n = document.createDocumentFragment();
721
+ for (const s of t) {
722
722
  const r = document.createElement("div");
723
723
  r.className = this.joinClassNames(
724
724
  "lce-decoration lce-decoration-line",
725
- n.className
726
- ), r.setAttribute("data-decoration-id", n.id), r.setAttribute("data-decoration-line", String(n.line)), r.style.cssText = this.joinStyleFragments([
725
+ s.className
726
+ ), r.setAttribute("data-decoration-id", s.id), r.setAttribute("data-decoration-line", String(s.line)), r.style.cssText = this.joinStyleFragments([
727
727
  "position: absolute",
728
- `top: ${n.line * this.lineHeight}px`,
728
+ `top: ${s.line * this.lineHeight}px`,
729
729
  `height: ${this.lineHeight}px`,
730
730
  "left: 12px",
731
731
  "right: 12px",
732
732
  "border-radius: 3px",
733
- this.serializeStyleObject(n.style)
734
- ]), s.appendChild(r);
733
+ this.serializeStyleObject(s.style)
734
+ ]), n.appendChild(r);
735
735
  }
736
- this.lineDecorationsElement.appendChild(s);
736
+ this.lineDecorationsElement.appendChild(n);
737
737
  }
738
738
  renderGutterDecorations(e) {
739
- const t = [...e].filter((n) => Number.isFinite(n.line) && n.line >= 0).sort((n, r) => n.line - r.line || n.id.localeCompare(r.id)), i = t.map(
740
- (n) => `${n.id}:${n.line}:${n.label || ""}:${n.title || ""}:${n.className || ""}:${this.serializeStyleObject(n.style)}`
739
+ const t = [...e].filter((s) => Number.isFinite(s.line) && s.line >= 0).sort((s, r) => s.line - r.line || s.id.localeCompare(r.id)), i = t.map(
740
+ (s) => `${s.id}:${s.line}:${s.label || ""}:${s.title || ""}:${s.className || ""}:${this.serializeStyleObject(s.style)}`
741
741
  ).join("|");
742
742
  if (i === this.lastGutterDecorationSnapshot || (this.gutterDecorationsElement.innerHTML = "", this.lastGutterDecorationSnapshot = i, t.length === 0))
743
743
  return;
744
- const s = document.createDocumentFragment();
745
- for (const n of t) {
744
+ const n = document.createDocumentFragment();
745
+ for (const s of t) {
746
746
  const r = document.createElement("div");
747
747
  r.className = this.joinClassNames(
748
748
  "lce-decoration lce-decoration-gutter",
749
- n.className
750
- ), r.setAttribute("data-decoration-id", n.id), r.setAttribute("data-decoration-line", String(n.line)), r.style.cssText = this.joinStyleFragments([
749
+ s.className
750
+ ), r.setAttribute("data-decoration-id", s.id), r.setAttribute("data-decoration-line", String(s.line)), r.style.cssText = this.joinStyleFragments([
751
751
  "position: absolute",
752
- `top: ${n.line * this.lineHeight}px`,
752
+ `top: ${s.line * this.lineHeight}px`,
753
753
  `height: ${this.lineHeight}px`,
754
754
  "left: 0",
755
755
  "right: 0",
@@ -758,10 +758,10 @@ class Q {
758
758
  "justify-content: flex-end",
759
759
  "padding-right: 4px",
760
760
  "box-sizing: border-box",
761
- this.serializeStyleObject(n.style)
762
- ]), n.title && (r.title = n.title), r.textContent = n.label || "", s.appendChild(r);
761
+ this.serializeStyleObject(s.style)
762
+ ]), s.title && (r.title = s.title), r.textContent = s.label || "", n.appendChild(r);
763
763
  }
764
- this.gutterDecorationsElement.appendChild(s);
764
+ this.gutterDecorationsElement.appendChild(n);
765
765
  }
766
766
  joinClassNames(...e) {
767
767
  return e.filter(Boolean).join(" ").trim();
@@ -789,14 +789,14 @@ class Q {
789
789
  positionToTextOffset(e, t) {
790
790
  var o;
791
791
  const i = t.split(`
792
- `), s = Math.max(0, Math.min(e.line, i.length - 1)), n = Math.max(
792
+ `), n = Math.max(0, Math.min(e.line, i.length - 1)), s = Math.max(
793
793
  0,
794
- Math.min(e.column, ((o = i[s]) == null ? void 0 : o.length) || 0)
794
+ Math.min(e.column, ((o = i[n]) == null ? void 0 : o.length) || 0)
795
795
  );
796
796
  let r = 0;
797
- for (let l = 0; l < s; l++)
797
+ for (let l = 0; l < n; l++)
798
798
  r += i[l].length + 1;
799
- return r + n;
799
+ return r + s;
800
800
  }
801
801
  getFoldPlaceholderSource(e) {
802
802
  const t = e.getAttribute(this.foldPlaceholderAttr), i = this.getFoldPlaceholderSources();
@@ -806,26 +806,26 @@ class Q {
806
806
  return this.contentElement.__lceFoldPlaceholderSources || /* @__PURE__ */ new Map();
807
807
  }
808
808
  getFoldPlaceholderBoundaryOffset(e, t, i) {
809
- const s = this.getFoldPlaceholderSource(e).length, n = this.stripVirtualMarkers(e.textContent || "").length;
810
- if (s === 0 || n === 0)
809
+ const n = this.getFoldPlaceholderSource(e).length, s = this.stripVirtualMarkers(e.textContent || "").length;
810
+ if (n === 0 || s === 0)
811
811
  return 0;
812
812
  const r = document.createRange();
813
813
  r.selectNodeContents(e);
814
814
  try {
815
815
  r.setEnd(t, i);
816
- } catch (o) {
816
+ } catch (l) {
817
817
  return 0;
818
818
  }
819
- return this.stripVirtualMarkers(r.toString()).length <= n / 2 ? 0 : s;
819
+ return this.stripVirtualMarkers(r.toString()).length <= s / 2 ? 0 : n;
820
820
  }
821
821
  setFoldPlaceholderSources(e) {
822
822
  this.contentElement.__lceFoldPlaceholderSources = e;
823
823
  }
824
824
  }
825
- let X = 0;
826
- const W = class O {
825
+ let Y = 0;
826
+ const L = class L {
827
827
  constructor(e, t = {}) {
828
- 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 = ++X, 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 = {
828
+ 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 = ++Y, 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 = {
829
829
  value: "",
830
830
  theme: "default",
831
831
  readOnly: !1,
@@ -833,7 +833,7 @@ const W = class O {
833
833
  lineWrapping: !1,
834
834
  lineNumbers: !0,
835
835
  ...t
836
- }, this.textModel = new V(this.config.value), this.view = new Q(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((i) => this.addExtension(i)), this.setTheme(this.config.theme), this.view.setReadOnly(this.config.readOnly || !1), this.renderTextWithHighlight(this.textModel.getText()), this.registerBuiltInCommands();
836
+ }, this.textModel = new _(this.config.value), this.view = new Q(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((i) => this.addExtension(i)), this.setTheme(this.config.theme), this.view.setReadOnly(this.config.readOnly || !1), this.renderTextWithHighlight(this.textModel.getText()), this.registerBuiltInCommands();
837
837
  }
838
838
  // Public accessors for extensions
839
839
  getTextModel() {
@@ -864,10 +864,10 @@ const W = class O {
864
864
  return;
865
865
  }
866
866
  if (t.inputType === "insertFromPaste" || t.inputType === "insertFromPasteAsQuotation" || t.inputType === "insertFromDrop") {
867
- const i = t.dataTransfer, s = this.getPlainTextFromDataTransfer(i);
868
- if (s.length === 0 || (t.preventDefault(), this.pendingInputSnapshot = void 0, Date.now() - this.lastProgrammaticClipboardInsertAt < 80))
867
+ const i = t.dataTransfer, n = this.getPlainTextFromDataTransfer(i);
868
+ if (n.length === 0 || (t.preventDefault(), this.pendingInputSnapshot = void 0, Date.now() - this.lastProgrammaticClipboardInsertAt < 80))
869
869
  return;
870
- this.insertClipboardText(s);
870
+ this.insertClipboardText(n);
871
871
  return;
872
872
  }
873
873
  if (t.inputType === "insertParagraph" || t.inputType === "insertLineBreak") {
@@ -903,29 +903,29 @@ const W = class O {
903
903
  const i = this.getPlainTextFromDataTransfer(t.clipboardData);
904
904
  i.length !== 0 && (t.preventDefault(), this.insertClipboardText(i));
905
905
  }), e.addEventListener("input", () => {
906
- var s;
906
+ var n;
907
907
  const t = this.view.getText(), i = this.textModel.getText();
908
908
  t !== i ? (this.suppressHistory || this.pushUndoSnapshot(
909
- (s = this.pendingInputSnapshot) != null ? s : this.captureHistorySnapshot(i)
909
+ (n = this.pendingInputSnapshot) != null ? n : this.captureHistorySnapshot(i)
910
910
  ), this.pendingInputSnapshot = void 0, this.textModel.setText(t), this.view.syncTrailingNewlineMarkerForText(t), this.hasRenderedFoldPlaceholders() ? this.clearPendingHighlightRender() : (this.clearPendingHighlightRender(), this.highlightTimeout = setTimeout(() => {
911
- const n = this.view.getText();
912
- n !== this.textModel.getText() && this.textModel.setText(n), this.renderTextWithHighlight(this.textModel.getText(), !1), this.highlightTimeout = null;
911
+ const s = this.view.getText();
912
+ s !== this.textModel.getText() && this.textModel.setText(s), this.renderTextWithHighlight(this.textModel.getText(), !1), this.highlightTimeout = null;
913
913
  }, 300)), this.updateLineNumbers(), this.emit("change", [{ range: this.getFullRange(), text: t, oldText: i }])) : this.pendingInputSnapshot = void 0;
914
914
  }), this.documentSelectionChangeHandler = () => {
915
- var s, n, r;
915
+ var n, s, r;
916
916
  const t = this.syncSelectionCacheFromView();
917
917
  if (!t.isInEditor)
918
918
  return;
919
- const i = (s = t.cursor) != null ? s : this.lastKnownCursor;
919
+ const i = (n = t.cursor) != null ? n : this.lastKnownCursor;
920
920
  this.emit("cursor", {
921
921
  position: i,
922
- anchor: (r = (n = t.range) == null ? void 0 : n.start) != null ? r : i
922
+ anchor: (r = (s = t.range) == null ? void 0 : s.start) != null ? r : i
923
923
  }), this.emit("selection", t.isCollapsed ? void 0 : t.range);
924
924
  }, document.addEventListener("selectionchange", this.documentSelectionChangeHandler), e.addEventListener("keydown", (t) => {
925
925
  this.emit("keydown", t);
926
926
  const i = Array.from(this.extensions.values()).reverse();
927
- for (const s of i)
928
- if (s.onKeyDown && s.onKeyDown(t) === !1) {
927
+ for (const n of i)
928
+ if (n.onKeyDown && n.onKeyDown(t) === !1) {
929
929
  t.preventDefault(), t.stopPropagation();
930
930
  return;
931
931
  }
@@ -948,16 +948,16 @@ const W = class O {
948
948
  }), e.addEventListener("mousedown", (t) => {
949
949
  this.emit("mousedown", t);
950
950
  const i = Array.from(this.extensions.values()).reverse();
951
- for (const s of i)
952
- if (s.onMouseDown && s.onMouseDown(t) === !1) {
951
+ for (const n of i)
952
+ if (n.onMouseDown && n.onMouseDown(t) === !1) {
953
953
  t.preventDefault(), t.stopPropagation();
954
954
  return;
955
955
  }
956
956
  }), e.addEventListener("contextmenu", (t) => {
957
957
  this.emit("contextmenu", t);
958
958
  const i = Array.from(this.extensions.values()).reverse();
959
- for (const s of i)
960
- if (s.onContextMenu && s.onContextMenu(t) === !1) {
959
+ for (const n of i)
960
+ if (n.onContextMenu && n.onContextMenu(t) === !1) {
961
961
  t.preventDefault(), t.stopPropagation();
962
962
  return;
963
963
  }
@@ -985,7 +985,7 @@ const W = class O {
985
985
  // Emit events to listeners
986
986
  emit(e, ...t) {
987
987
  const i = this.eventListeners.get(e);
988
- i && i.forEach((s) => s(...t));
988
+ i && i.forEach((n) => n(...t));
989
989
  }
990
990
  // State management
991
991
  getValue() {
@@ -1006,16 +1006,16 @@ const W = class O {
1006
1006
  }
1007
1007
  // Cursor & Selection
1008
1008
  getCursor() {
1009
- var i, s, n;
1009
+ var i, n, s;
1010
1010
  const e = this.syncSelectionCacheFromView(), t = (i = e.cursor) != null ? i : this.lastKnownCursor;
1011
1011
  return {
1012
1012
  position: t,
1013
- anchor: (n = (s = e.range) == null ? void 0 : s.start) != null ? n : t
1013
+ anchor: (s = (n = e.range) == null ? void 0 : n.start) != null ? s : t
1014
1014
  };
1015
1015
  }
1016
1016
  setCursor(e) {
1017
- const t = this.textModel.getText(), i = this.clampPositionToText(e, t), s = this.positionToOffsetInText(i, t);
1018
- this.lastKnownCursor = i, this.lastKnownSelection = void 0, this.view.setSelectionOffsets(s), this.emit("cursor", this.getCursor());
1017
+ const t = this.textModel.getText(), i = this.clampPositionToText(e, t), n = this.positionToOffsetInText(i, t);
1018
+ this.lastKnownCursor = i, this.lastKnownSelection = void 0, this.view.setSelectionOffsets(n), this.emit("cursor", this.getCursor());
1019
1019
  }
1020
1020
  getSelection() {
1021
1021
  const e = this.syncSelectionCacheFromView();
@@ -1026,8 +1026,8 @@ const W = class O {
1026
1026
  const t = this.textModel.getText(), i = this.normalizeRange({
1027
1027
  start: this.clampPositionToText(e.start, t),
1028
1028
  end: this.clampPositionToText(e.end, t)
1029
- }), s = this.positionToOffsetInText(i.start, t), n = this.positionToOffsetInText(i.end, t);
1030
- this.lastKnownSelection = i, this.lastKnownCursor = i.end, this.view.setSelectionOffsets(s, n), this.emit("selection", i);
1029
+ }), n = this.positionToOffsetInText(i.start, t), s = this.positionToOffsetInText(i.end, t);
1030
+ this.lastKnownSelection = i, this.lastKnownCursor = i.end, this.view.setSelectionOffsets(n, s), this.emit("selection", i);
1031
1031
  }
1032
1032
  // Configuration
1033
1033
  setTheme(e) {
@@ -1044,8 +1044,8 @@ const W = class O {
1044
1044
  if (i && typeof i.setTheme == "function")
1045
1045
  try {
1046
1046
  i.setTheme(e === "dark" ? "dark" : "light"), this.renderTextWithHighlight(this.textModel.getText());
1047
- } catch (s) {
1048
- console.warn("Error applying theme to syntax-highlighting extension", s);
1047
+ } catch (n) {
1048
+ console.warn("Error applying theme to syntax-highlighting extension", n);
1049
1049
  }
1050
1050
  }
1051
1051
  setReadOnly(e) {
@@ -1079,7 +1079,7 @@ const W = class O {
1079
1079
  }
1080
1080
  this.decorationLayers.set(
1081
1081
  i,
1082
- t.map((s) => this.cloneDecoration(s))
1082
+ t.map((n) => this.cloneDecoration(n))
1083
1083
  ), this.scheduleDecorationRender();
1084
1084
  }
1085
1085
  clearDecorations(e) {
@@ -1093,7 +1093,7 @@ const W = class O {
1093
1093
  const t = [];
1094
1094
  for (const i of this.decorationLayers.values())
1095
1095
  t.push(
1096
- ...i.map((s) => this.cloneDecoration(s))
1096
+ ...i.map((n) => this.cloneDecoration(n))
1097
1097
  );
1098
1098
  return t;
1099
1099
  }
@@ -1107,68 +1107,68 @@ const W = class O {
1107
1107
  wholeWord: !1,
1108
1108
  regex: !1,
1109
1109
  ...t
1110
- }, s = [], n = this.textModel.getText(), { normalizedText: r, normalizedToRawOffsets: o } = this.buildSearchTextAndOffsetMap(n), l = i.caseSensitive ? r : r.toLowerCase(), a = i.caseSensitive ? e : e.toLowerCase();
1110
+ }, n = [], s = this.textModel.getText(), { normalizedText: r, normalizedToRawOffsets: o } = this.buildSearchTextAndOffsetMap(s), l = i.caseSensitive ? r : r.toLowerCase(), a = i.caseSensitive ? e : e.toLowerCase();
1111
1111
  if (i.regex) {
1112
- let d;
1112
+ let c;
1113
1113
  try {
1114
- d = new RegExp(e, i.caseSensitive ? "g" : "gi");
1115
- } catch (u) {
1114
+ c = new RegExp(e, i.caseSensitive ? "g" : "gi");
1115
+ } catch (f) {
1116
1116
  return [];
1117
1117
  }
1118
- let c;
1119
- for (; (c = d.exec(r)) !== null; ) {
1120
- const u = (h = c[0]) != null ? h : "";
1121
- if (u.length === 0) {
1122
- d.lastIndex = c.index + 1;
1118
+ let g;
1119
+ for (; (g = c.exec(r)) !== null; ) {
1120
+ const f = (h = g[0]) != null ? h : "";
1121
+ if (f.length === 0) {
1122
+ c.lastIndex = g.index + 1;
1123
1123
  continue;
1124
1124
  }
1125
- const g = c.index, f = c.index + u.length;
1126
- i.wholeWord && !this.isWholeWordBoundary(r, g, f) || this.pushSearchResultFromOffsets(
1127
- s,
1128
- g,
1129
- f,
1125
+ const d = g.index, u = g.index + f.length;
1126
+ i.wholeWord && !this.isWholeWordBoundary(r, d, u) || this.pushSearchResultFromOffsets(
1127
+ n,
1128
+ d,
1129
+ u,
1130
1130
  r,
1131
1131
  o
1132
1132
  );
1133
1133
  }
1134
1134
  } else {
1135
- let d = 0, c = l.indexOf(a, d);
1136
- for (; c !== -1; ) {
1137
- const u = c + a.length;
1138
- !i.wholeWord || this.isWholeWordBoundary(r, c, u) ? (this.pushSearchResultFromOffsets(
1139
- s,
1140
- c,
1141
- u,
1135
+ let c = 0, g = l.indexOf(a, c);
1136
+ for (; g !== -1; ) {
1137
+ const f = g + a.length;
1138
+ !i.wholeWord || this.isWholeWordBoundary(r, g, f) ? (this.pushSearchResultFromOffsets(
1139
+ n,
1140
+ g,
1141
+ f,
1142
1142
  r,
1143
1143
  o
1144
- ), d = u) : d = c + 1, c = l.indexOf(a, d);
1144
+ ), c = f) : c = g + 1, g = l.indexOf(a, c);
1145
1145
  }
1146
1146
  }
1147
- return s;
1147
+ return n;
1148
1148
  }
1149
- pushSearchResultFromOffsets(e, t, i, s, n) {
1150
- var h, d;
1151
- const r = (h = n[t]) != null ? h : t, o = (d = n[i]) != null ? d : r, l = this.textModel.offsetToPosition(r), a = this.textModel.offsetToPosition(o);
1149
+ pushSearchResultFromOffsets(e, t, i, n, s) {
1150
+ var h, c;
1151
+ const r = (h = s[t]) != null ? h : t, o = (c = s[i]) != null ? c : r, l = this.textModel.offsetToPosition(r), a = this.textModel.offsetToPosition(o);
1152
1152
  e.push({
1153
1153
  range: { start: l, end: a },
1154
- match: s.substring(t, i)
1154
+ match: n.substring(t, i)
1155
1155
  });
1156
1156
  }
1157
1157
  isWholeWordBoundary(e, t, i) {
1158
- const s = t > 0 ? e[t - 1] : "", n = i < e.length ? e[i] : "";
1159
- return !this.isWordChar(s) && !this.isWordChar(n);
1158
+ const n = t > 0 ? e[t - 1] : "", s = i < e.length ? e[i] : "";
1159
+ return !this.isWordChar(n) && !this.isWordChar(s);
1160
1160
  }
1161
1161
  isWordChar(e) {
1162
1162
  return /^[A-Za-z0-9_]$/.test(e);
1163
1163
  }
1164
1164
  buildSearchTextAndOffsetMap(e) {
1165
1165
  const t = [], i = [0];
1166
- let s = 0;
1167
- for (let n = 0; n < e.length; n++) {
1168
- const r = e[n];
1169
- r === "​" || r === O.CURSOR_SENTINEL || (t.push(r), s += 1, i[s] = n + 1);
1166
+ let n = 0;
1167
+ for (let s = 0; s < e.length; s++) {
1168
+ const r = e[s];
1169
+ r === "​" || r === L.CURSOR_SENTINEL || (t.push(r), n += 1, i[n] = s + 1);
1170
1170
  }
1171
- return i[s] = e.length, {
1171
+ return i[n] = e.length, {
1172
1172
  normalizedText: t.join(""),
1173
1173
  normalizedToRawOffsets: i
1174
1174
  };
@@ -1176,15 +1176,15 @@ const W = class O {
1176
1176
  replace(e, t) {
1177
1177
  const i = this.getValue();
1178
1178
  this.suppressHistory || this.pushUndoSnapshot(this.captureHistorySnapshot(i));
1179
- const s = this.textModel.replaceRange(e, t);
1180
- this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.getValue(), !1), this.expectingProgrammaticCursor = !1, this.emit("change", [s]);
1179
+ const n = this.textModel.replaceRange(e, t);
1180
+ this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.getValue(), !1), this.expectingProgrammaticCursor = !1, this.emit("change", [n]);
1181
1181
  }
1182
1182
  replaceAll(e, t, i = {}) {
1183
- const s = this.search(e, i);
1184
- let n = 0;
1185
- for (let r = s.length - 1; r >= 0; r--)
1186
- this.replace(s[r].range, t), n++;
1187
- return n;
1183
+ const n = this.search(e, i);
1184
+ let s = 0;
1185
+ for (let r = n.length - 1; r >= 0; r--)
1186
+ this.replace(n[r].range, t), s++;
1187
+ return s;
1188
1188
  }
1189
1189
  // Folding (basic implementation)
1190
1190
  fold(e) {
@@ -1193,14 +1193,14 @@ const W = class O {
1193
1193
  if (t.start.line === t.end.line && t.start.column === t.end.column)
1194
1194
  return;
1195
1195
  const i = this.folds.findIndex(
1196
- (n) => this.isSameFoldRange(n, t)
1197
- ), s = {
1196
+ (s) => this.isSameFoldRange(s, t)
1197
+ ), n = {
1198
1198
  start: t.start,
1199
1199
  end: t.end,
1200
1200
  collapsed: !0,
1201
1201
  level: 0
1202
1202
  };
1203
- i !== -1 ? this.folds[i] = s : (this.folds.push(s), this.folds.sort((n, r) => this.comparePositions(n.start, r.start)));
1203
+ i !== -1 ? this.folds[i] = n : (this.folds.push(n), this.folds.sort((s, r) => this.comparePositions(s.start, r.start)));
1204
1204
  }
1205
1205
  unfold(e) {
1206
1206
  this.clearPendingHighlightRender();
@@ -1228,38 +1228,38 @@ const W = class O {
1228
1228
  if (i && typeof i.highlightHTML == "function")
1229
1229
  try {
1230
1230
  if (typeof this.view.setHighlightHTML == "function") {
1231
- const g = this.view.getContentElement();
1232
- (g.querySelector(
1231
+ const u = this.view.getContentElement();
1232
+ (u.querySelector(
1233
1233
  "[data-lce-fold-placeholder]"
1234
- ) || g.textContent !== e) && this.view.setText(e);
1235
- const f = typeof i.highlight == "function" ? i.highlight(e) : i.highlightHTML(e);
1236
- this.view.setHighlightHTML(f), this.view.syncTrailingNewlineMarkerForText(e), this.scheduleDecorationRender();
1234
+ ) || u.textContent !== e) && this.view.setText(e);
1235
+ const m = typeof i.highlight == "function" ? i.highlight(e) : i.highlightHTML(e);
1236
+ this.view.setHighlightHTML(m), this.view.syncTrailingNewlineMarkerForText(e), this.scheduleDecorationRender();
1237
1237
  return;
1238
1238
  }
1239
1239
  const s = !t && !this.expectingProgrammaticCursor;
1240
- let n, r, o, l;
1241
- const a = this.view.getSelectionState(), h = a.isInEditor && !!a.cursor;
1242
- (t || s) && h && (n = a.isCollapsed ? void 0 : a.range, r = this.textModel.positionToOffset(a.cursor), n && (o = this.textModel.positionToOffset(n.start), l = this.textModel.positionToOffset(n.end)));
1243
- const d = h && (t || s) && !n && r !== void 0 && this.hasCollapsedSelectionInEditor(), c = d ? this.insertSentinelAtOffset(e, r) : e, u = typeof i.highlight == "function" ? i.highlight(c) : i.highlightHTML(c);
1244
- typeof this.view.setHighlightHTML == "function" ? this.view.setHighlightHTML(u) : this.view.setHTML(u), this.view.syncTrailingNewlineMarkerForText(e), (t || s) && h && requestAnimationFrame(() => {
1240
+ let r, o, l, a;
1241
+ const h = this.view.getSelectionState(), c = h.isInEditor && !!h.cursor;
1242
+ (t || s) && c && (r = h.isCollapsed ? void 0 : h.range, o = this.textModel.positionToOffset(h.cursor), r && (l = this.textModel.positionToOffset(r.start), a = this.textModel.positionToOffset(r.end)));
1243
+ const g = c && (t || s) && !r && o !== void 0 && this.hasCollapsedSelectionInEditor(), f = g ? this.insertSentinelAtOffset(e, o) : e, d = typeof i.highlight == "function" ? i.highlight(f) : i.highlightHTML(f);
1244
+ typeof this.view.setHighlightHTML == "function" ? this.view.setHighlightHTML(d) : this.view.setHTML(d), this.view.syncTrailingNewlineMarkerForText(e), (t || s) && c && requestAnimationFrame(() => {
1245
1245
  try {
1246
- if (d && this.restoreCursorFromSentinel()) {
1246
+ if (g && this.restoreCursorFromSentinel()) {
1247
1247
  this.view.ensureCaretVisible();
1248
1248
  return;
1249
1249
  }
1250
- if (n && (o !== void 0 || l !== void 0)) {
1251
- const g = o !== void 0 ? o : r, f = l !== void 0 ? l : r, p = Math.min(g, f), m = Math.max(g, f), x = this.textModel.offsetToPosition(p), v = this.textModel.offsetToPosition(m);
1252
- this.view.setSelectionRange({ start: x, end: v });
1253
- } else if (r !== void 0) {
1254
- const g = this.textModel.offsetToPosition(r);
1255
- this.view.setCursorPosition(g);
1250
+ if (r && (l !== void 0 || a !== void 0)) {
1251
+ const u = l !== void 0 ? l : o, p = a !== void 0 ? a : o, m = Math.min(u, p), x = Math.max(u, p), v = this.textModel.offsetToPosition(m), T = this.textModel.offsetToPosition(x);
1252
+ this.view.setSelectionRange({ start: v, end: T });
1253
+ } else if (o !== void 0) {
1254
+ const u = this.textModel.offsetToPosition(o);
1255
+ this.view.setCursorPosition(u);
1256
1256
  }
1257
- } catch (g) {
1257
+ } catch (u) {
1258
1258
  }
1259
1259
  }), this.scheduleDecorationRender();
1260
1260
  return;
1261
- } catch (s) {
1262
- console.warn("Syntax highlighting failed, falling back to plain text", s);
1261
+ } catch (n) {
1262
+ console.warn("Syntax highlighting failed, falling back to plain text", n);
1263
1263
  }
1264
1264
  this.view.setText(e), this.scheduleDecorationRender();
1265
1265
  }
@@ -1277,28 +1277,28 @@ const W = class O {
1277
1277
  const t = e.getRangeAt(0), i = this.view.getContentElement();
1278
1278
  if (!i.contains(t.commonAncestorContainer))
1279
1279
  return;
1280
- const s = t.cloneRange();
1281
- return s.selectNodeContents(i), s.setEnd(t.endContainer, t.endOffset), this.stripVirtualMarkers(s.toString()).length;
1280
+ const n = t.cloneRange();
1281
+ return n.selectNodeContents(i), n.setEnd(t.endContainer, t.endOffset), this.stripVirtualMarkers(n.toString()).length;
1282
1282
  }
1283
1283
  stripVirtualMarkers(e) {
1284
- return e.replace(/\u200B/g, "").split(O.CURSOR_SENTINEL).join("");
1284
+ return e.replace(/\u200B/g, "").split(L.CURSOR_SENTINEL).join("");
1285
1285
  }
1286
1286
  insertSentinelAtOffset(e, t) {
1287
1287
  const i = Math.max(0, Math.min(t, e.length));
1288
- return e.slice(0, i) + O.CURSOR_SENTINEL + e.slice(i);
1288
+ return e.slice(0, i) + L.CURSOR_SENTINEL + e.slice(i);
1289
1289
  }
1290
1290
  restoreCursorFromSentinel() {
1291
1291
  var o;
1292
1292
  const e = this.view.getContentElement(), t = window.getSelection(), i = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
1293
- let s = i.nextNode(), n = null, r = 0;
1294
- for (; s; ) {
1295
- const l = (o = s.textContent) != null ? o : "", a = l.indexOf(O.CURSOR_SENTINEL);
1296
- a !== -1 && (n || (n = s, r = a), s.textContent = l.split(O.CURSOR_SENTINEL).join("")), s = i.nextNode();
1293
+ let n = i.nextNode(), s = null, r = 0;
1294
+ for (; n; ) {
1295
+ const l = (o = n.textContent) != null ? o : "", a = l.indexOf(L.CURSOR_SENTINEL);
1296
+ a !== -1 && (s || (s = n, r = a), n.textContent = l.split(L.CURSOR_SENTINEL).join("")), n = i.nextNode();
1297
1297
  }
1298
- if (!n || !t) return !1;
1298
+ if (!s || !t) return !1;
1299
1299
  try {
1300
1300
  const l = document.createRange();
1301
- return l.setStart(n, r), l.collapse(!0), t.removeAllRanges(), t.addRange(l), !0;
1301
+ return l.setStart(s, r), l.collapse(!0), t.removeAllRanges(), t.addRange(l), !0;
1302
1302
  } catch (l) {
1303
1303
  return !1;
1304
1304
  }
@@ -1356,8 +1356,8 @@ const W = class O {
1356
1356
  }
1357
1357
  deleteSelection() {
1358
1358
  if (this.config.readOnly) return;
1359
- const e = this.textModel.getText(), { startOffset: t, endOffset: i } = this.getActiveSelectionOffsets(e), s = Math.min(t, i), n = Math.max(t, i);
1360
- s !== n && this.replaceOffsetsWithText(s, n, "");
1359
+ const e = this.textModel.getText(), { startOffset: t, endOffset: i } = this.getActiveSelectionOffsets(e), n = Math.min(t, i), s = Math.max(t, i);
1360
+ n !== s && this.replaceOffsetsWithText(n, s, "");
1361
1361
  }
1362
1362
  // Events
1363
1363
  on(e, t) {
@@ -1367,8 +1367,8 @@ const W = class O {
1367
1367
  if (!this.eventListeners.has(e)) return;
1368
1368
  const i = this.eventListeners.get(e);
1369
1369
  if (t) {
1370
- const s = i.indexOf(t);
1371
- s !== -1 && i.splice(s, 1);
1370
+ const n = i.indexOf(t);
1371
+ n !== -1 && i.splice(n, 1);
1372
1372
  } else
1373
1373
  i.length = 0;
1374
1374
  }
@@ -1379,12 +1379,12 @@ const W = class O {
1379
1379
  return e.line !== t.line ? e.line - t.line : e.column - t.column;
1380
1380
  }
1381
1381
  captureHistorySnapshot(e = this.textModel.getText()) {
1382
- const t = this.view.getSelectionState(), i = t.isInEditor && !t.isCollapsed ? t.range : void 0, s = t.isInEditor && t.cursor ? t.cursor : void 0, n = i != null ? i : this.lastKnownSelection, r = s != null ? s : this.lastKnownCursor, o = this.clampPositionToText(r, e), l = {
1382
+ const t = this.view.getSelectionState(), i = t.isInEditor && !t.isCollapsed ? t.range : void 0, n = t.isInEditor && t.cursor ? t.cursor : void 0, s = i != null ? i : this.lastKnownSelection, r = n != null ? n : this.lastKnownCursor, o = this.clampPositionToText(r, e), l = {
1383
1383
  text: e,
1384
1384
  cursorOffset: this.positionToOffsetInText(o, e)
1385
1385
  };
1386
- if (n) {
1387
- const a = this.clampPositionToText(n.start, e), h = this.clampPositionToText(n.end, e);
1386
+ if (s) {
1387
+ const a = this.clampPositionToText(s.start, e), h = this.clampPositionToText(s.end, e);
1388
1388
  l.anchorOffset = this.positionToOffsetInText(a, e), l.focusOffset = this.positionToOffsetInText(h, e);
1389
1389
  }
1390
1390
  return l;
@@ -1393,10 +1393,10 @@ const W = class O {
1393
1393
  this.setValue(e.text), requestAnimationFrame(() => {
1394
1394
  try {
1395
1395
  if (e.anchorOffset !== void 0 && e.focusOffset !== void 0 && e.anchorOffset !== e.focusOffset) {
1396
- const t = Math.min(e.anchorOffset, e.focusOffset), i = Math.max(e.anchorOffset, e.focusOffset);
1396
+ const i = Math.min(e.anchorOffset, e.focusOffset), n = Math.max(e.anchorOffset, e.focusOffset);
1397
1397
  this.setSelection({
1398
- start: this.textModel.offsetToPosition(t),
1399
- end: this.textModel.offsetToPosition(i)
1398
+ start: this.textModel.offsetToPosition(i),
1399
+ end: this.textModel.offsetToPosition(n)
1400
1400
  });
1401
1401
  return;
1402
1402
  }
@@ -1414,23 +1414,23 @@ const W = class O {
1414
1414
  clampPositionToText(e, t) {
1415
1415
  var r, o;
1416
1416
  const i = t.split(`
1417
- `), s = Math.max(0, Math.min(e.line, i.length - 1)), n = Math.max(
1417
+ `), n = Math.max(0, Math.min(e.line, i.length - 1)), s = Math.max(
1418
1418
  0,
1419
- Math.min(e.column, (o = (r = i[s]) == null ? void 0 : r.length) != null ? o : 0)
1419
+ Math.min(e.column, (o = (r = i[n]) == null ? void 0 : r.length) != null ? o : 0)
1420
1420
  );
1421
1421
  return {
1422
- line: s,
1423
- column: n
1422
+ line: n,
1423
+ column: s
1424
1424
  };
1425
1425
  }
1426
1426
  positionToOffsetInText(e, t) {
1427
1427
  var r, o;
1428
1428
  const i = t.split(`
1429
- `), s = this.clampPositionToText(e, t);
1430
- let n = 0;
1431
- for (let l = 0; l < s.line; l++)
1432
- n += ((o = (r = i[l]) == null ? void 0 : r.length) != null ? o : 0) + 1;
1433
- return n + s.column;
1429
+ `), n = this.clampPositionToText(e, t);
1430
+ let s = 0;
1431
+ for (let l = 0; l < n.line; l++)
1432
+ s += ((o = (r = i[l]) == null ? void 0 : r.length) != null ? o : 0) + 1;
1433
+ return s + n.column;
1434
1434
  }
1435
1435
  clearPendingHighlightRender() {
1436
1436
  this.highlightTimeout && (clearTimeout(this.highlightTimeout), this.highlightTimeout = null);
@@ -1440,7 +1440,7 @@ const W = class O {
1440
1440
  }
1441
1441
  replaceSelectionWithText(e) {
1442
1442
  const t = e.replace(/\r\n?/g, `
1443
- `), i = this.textModel.getText(), { startOffset: s, endOffset: n } = this.getActiveSelectionOffsets(i), r = Math.max(0, Math.min(s, n)), o = Math.max(0, Math.max(s, n));
1443
+ `), i = this.textModel.getText(), { startOffset: n, endOffset: s } = this.getActiveSelectionOffsets(i), r = Math.max(0, Math.min(n, s)), o = Math.max(0, Math.max(n, s));
1444
1444
  return this.replaceOffsetsWithText(r, o, t);
1445
1445
  }
1446
1446
  insertClipboardText(e) {
@@ -1493,7 +1493,7 @@ const W = class O {
1493
1493
  "TABLE",
1494
1494
  "TR",
1495
1495
  "UL"
1496
- ]), s = (o) => {
1496
+ ]), n = (o) => {
1497
1497
  var l;
1498
1498
  for (let a = o.length - 1; a >= 0; a--) {
1499
1499
  const h = (l = o[a]) != null ? l : "";
@@ -1502,13 +1502,13 @@ const W = class O {
1502
1502
  `);
1503
1503
  }
1504
1504
  return !1;
1505
- }, n = (o, l) => {
1505
+ }, s = (o, l) => {
1506
1506
  if (o instanceof Text) {
1507
1507
  l.push(o.data);
1508
1508
  return;
1509
1509
  }
1510
1510
  if (!(o instanceof HTMLElement)) {
1511
- o.childNodes.forEach((h) => n(h, l));
1511
+ o.childNodes.forEach((h) => s(h, l));
1512
1512
  return;
1513
1513
  }
1514
1514
  if (o.tagName === "BR") {
@@ -1517,11 +1517,11 @@ const W = class O {
1517
1517
  return;
1518
1518
  }
1519
1519
  const a = i.has(o.tagName);
1520
- a && l.length > 0 && !s(l) && l.push(`
1521
- `), o.childNodes.forEach((h) => n(h, l)), a && !s(l) && l.push(`
1520
+ a && l.length > 0 && !n(l) && l.push(`
1521
+ `), o.childNodes.forEach((h) => s(h, l)), a && !n(l) && l.push(`
1522
1522
  `);
1523
1523
  }, r = [];
1524
- return t.body.childNodes.forEach((o) => n(o, r)), r.join("").replace(/\n{3,}/g, `
1524
+ return t.body.childNodes.forEach((o) => s(o, r)), r.join("").replace(/\n{3,}/g, `
1525
1525
 
1526
1526
  `).replace(/[ \t]+\n/g, `
1527
1527
  `).trimEnd();
@@ -1545,35 +1545,35 @@ const W = class O {
1545
1545
  };
1546
1546
  }
1547
1547
  deleteUsingDirection(e) {
1548
- const t = this.textModel.getText(), { startOffset: i, endOffset: s } = this.getActiveSelectionOffsets(t), n = Math.min(i, s), r = Math.max(i, s);
1549
- if (n !== r) {
1550
- this.replaceOffsetsWithText(n, r, "");
1548
+ const t = this.textModel.getText(), { startOffset: i, endOffset: n } = this.getActiveSelectionOffsets(t), s = Math.min(i, n), r = Math.max(i, n);
1549
+ if (s !== r) {
1550
+ this.replaceOffsetsWithText(s, r, "");
1551
1551
  return;
1552
1552
  }
1553
1553
  if (e === "backward") {
1554
- if (n === 0)
1554
+ if (s === 0)
1555
1555
  return;
1556
- this.replaceOffsetsWithText(n - 1, n, "");
1556
+ this.replaceOffsetsWithText(s - 1, s, "");
1557
1557
  return;
1558
1558
  }
1559
1559
  r >= t.length || this.replaceOffsetsWithText(r, r + 1, "");
1560
1560
  }
1561
1561
  replaceOffsetsWithText(e, t, i) {
1562
- var u;
1562
+ var f;
1563
1563
  this.ensureEditableSurfaceIsUnfolded();
1564
- const s = i.replace(/\r\n?/g, `
1565
- `), n = this.textModel.getText(), r = (u = this.pendingInputSnapshot) != null ? u : this.captureHistorySnapshot(n), o = Math.max(0, Math.min(e, n.length)), l = Math.max(0, Math.min(t, n.length)), a = Math.min(o, l), h = Math.max(o, l), d = this.textModel.replaceRange(
1564
+ const n = i.replace(/\r\n?/g, `
1565
+ `), s = this.textModel.getText(), r = (f = this.pendingInputSnapshot) != null ? f : this.captureHistorySnapshot(s), o = Math.max(0, Math.min(e, s.length)), l = Math.max(0, Math.min(t, s.length)), a = Math.min(o, l), h = Math.max(o, l), c = this.textModel.replaceRange(
1566
1566
  {
1567
1567
  start: this.textModel.offsetToPosition(a),
1568
1568
  end: this.textModel.offsetToPosition(h)
1569
1569
  },
1570
- s
1570
+ n
1571
1571
  );
1572
1572
  this.pendingInputSnapshot = void 0, this.suppressHistory || this.pushUndoSnapshot(r);
1573
- const c = a + s.length;
1574
- return this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), this.setCursor(this.textModel.offsetToPosition(c)), setTimeout(() => {
1573
+ const g = a + n.length;
1574
+ return this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), this.setCursor(this.textModel.offsetToPosition(g)), setTimeout(() => {
1575
1575
  this.expectingProgrammaticCursor = !1;
1576
- }, 20), this.emit("change", [d]), d;
1576
+ }, 20), this.emit("change", [c]), c;
1577
1577
  }
1578
1578
  ensureEditableSurfaceIsUnfolded() {
1579
1579
  !this.hasRenderedFoldPlaceholders() && this.folds.length === 0 || (this.clearPendingHighlightRender(), this.folds = [], this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), setTimeout(() => {
@@ -1606,9 +1606,9 @@ const W = class O {
1606
1606
  return;
1607
1607
  }
1608
1608
  const e = [], t = [], i = [];
1609
- for (const [s, n] of this.decorationLayers.entries())
1610
- for (const r of n) {
1611
- const o = `${s}::${r.id}`;
1609
+ for (const [n, s] of this.decorationLayers.entries())
1610
+ for (const r of s) {
1611
+ const o = `${n}::${r.id}`;
1612
1612
  if (r.type === "line") {
1613
1613
  e.push({
1614
1614
  ...r,
@@ -1661,28 +1661,28 @@ const W = class O {
1661
1661
  }
1662
1662
  if (this.clearInlineDecorationHighlights(), e.length === 0)
1663
1663
  return;
1664
- const s = this.textModel.getText(), n = [];
1664
+ const n = this.textModel.getText(), s = [];
1665
1665
  let r = 0;
1666
1666
  for (const l of e) {
1667
1667
  if (r >= this.decorationHighlightLimit)
1668
1668
  break;
1669
- const a = this.normalizeInlineDecoration(l, s);
1669
+ const a = this.normalizeInlineDecoration(l, n);
1670
1670
  if (!a)
1671
1671
  continue;
1672
1672
  const h = this.view.createDomRangeFromRange(a.range);
1673
1673
  if (!h)
1674
1674
  continue;
1675
- const d = this.buildInlineDecorationHighlightName(
1675
+ const c = this.buildInlineDecorationHighlightName(
1676
1676
  a.id
1677
1677
  );
1678
- t.highlights.set(d, new i(h)), this.inlineDecorationHighlightNames.add(d), n.push(`
1679
- ::highlight(${d}) {
1678
+ t.highlights.set(c, new i(h)), this.inlineDecorationHighlightNames.add(c), s.push(`
1679
+ ::highlight(${c}) {
1680
1680
  ${this.serializeInlineDecorationStyle(a.style)}
1681
1681
  }
1682
1682
  `), r += 1;
1683
1683
  }
1684
1684
  const o = this.ensureDecorationHighlightStyleNode();
1685
- o.textContent = n.join(`
1685
+ o.textContent = s.join(`
1686
1686
  `);
1687
1687
  }
1688
1688
  normalizeInlineDecoration(e, t) {
@@ -1700,11 +1700,11 @@ const W = class O {
1700
1700
  try {
1701
1701
  const i = CSS;
1702
1702
  if (i.highlights)
1703
- for (const s of this.inlineDecorationHighlightNames)
1704
- i.highlights.delete(s);
1703
+ for (const n of this.inlineDecorationHighlightNames)
1704
+ i.highlights.delete(n);
1705
1705
  } catch (i) {
1706
1706
  }
1707
- if (this.inlineDecorationHighlightNames.clear(), typeof document > "u")
1707
+ if (this.inlineDecorationHighlightNames.clear(), typeof document == "undefined")
1708
1708
  return;
1709
1709
  const t = document.getElementById(this.decorationHighlightStyleId);
1710
1710
  if (e) {
@@ -1720,7 +1720,7 @@ const W = class O {
1720
1720
  return e || (e = document.createElement("style"), e.id = this.decorationHighlightStyleId, document.head.appendChild(e), e);
1721
1721
  }
1722
1722
  observeDecorationRelevantMutations() {
1723
- typeof MutationObserver > "u" || (this.decorationMutationObserver = new MutationObserver(() => {
1723
+ typeof MutationObserver != "undefined" && (this.decorationMutationObserver = new MutationObserver(() => {
1724
1724
  this.decorationLayers.size !== 0 && this.scheduleDecorationRender();
1725
1725
  }), this.decorationMutationObserver.observe(this.view.getContentElement(), {
1726
1726
  childList: !0,
@@ -1730,7 +1730,7 @@ const W = class O {
1730
1730
  }
1731
1731
  detectCustomHighlightSupport() {
1732
1732
  try {
1733
- if (typeof CSS > "u" || typeof window > "u")
1733
+ if (typeof CSS == "undefined" || typeof window == "undefined")
1734
1734
  return !1;
1735
1735
  const e = CSS, t = window.Highlight;
1736
1736
  return !!e.highlights && !!t;
@@ -1745,7 +1745,8 @@ const W = class O {
1745
1745
  return e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-");
1746
1746
  }
1747
1747
  serializeInlineDecorationStyle(e) {
1748
- return this.serializeStyleObject(e) || "background-color: var(--lce-inline-decoration-bg, rgba(86, 156, 214, 0.18)); border-radius: 2px;";
1748
+ const t = this.serializeStyleObject(e);
1749
+ return t || "background-color: var(--lce-inline-decoration-bg, rgba(86, 156, 214, 0.18)); border-radius: 2px;";
1749
1750
  }
1750
1751
  serializeStyleObject(e) {
1751
1752
  return e ? Object.entries(e).filter(([, t]) => typeof t == "string" && t.length > 0).map(([t, i]) => `${this.toKebabCase(t)}: ${i};`).join(" ") : "";
@@ -1767,9 +1768,9 @@ const W = class O {
1767
1768
  };
1768
1769
  }
1769
1770
  };
1770
- W.CURSOR_SENTINEL = "";
1771
- let Y = W;
1772
- class J {
1771
+ L.CURSOR_SENTINEL = "";
1772
+ let V = L;
1773
+ class X {
1773
1774
  constructor(e) {
1774
1775
  this.name = "keymap", this.editor = null, this.keymap = {}, this.isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0, this.keymap = e || this.getDefaultKeymap();
1775
1776
  }
@@ -1783,11 +1784,11 @@ class J {
1783
1784
  return this.editor.executeCommand(t.command), e.preventDefault(), e.stopPropagation(), !1;
1784
1785
  }
1785
1786
  findMatchingBinding(e) {
1786
- const { key: t, ctrlKey: i, altKey: s, shiftKey: n, metaKey: r } = e, o = String(t).toLowerCase(), l = this.keymap[o];
1787
+ const { key: t, ctrlKey: i, altKey: n, shiftKey: s, metaKey: r } = e, o = String(t).toLowerCase(), l = this.keymap[o];
1787
1788
  if (!l) return null;
1788
1789
  for (const a of l) {
1789
- const h = a.ctrlKey === void 0 || a.ctrlKey === i, d = a.altKey === void 0 || a.altKey === s, c = a.shiftKey === void 0 || a.shiftKey === n, u = a.metaKey === void 0 || a.metaKey === r;
1790
- if (h && d && c && u)
1790
+ const h = a.ctrlKey === void 0 || a.ctrlKey === i, c = a.altKey === void 0 || a.altKey === n, g = a.shiftKey === void 0 || a.shiftKey === s, f = a.metaKey === void 0 || a.metaKey === r;
1791
+ if (h && c && g && f)
1791
1792
  return a;
1792
1793
  }
1793
1794
  return null;
@@ -1800,11 +1801,11 @@ class J {
1800
1801
  const e = {};
1801
1802
  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", {}, "insertTab"), this.addBinding(e, "t", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "toggleTheme"), this.addBinding(e, "f", { altKey: !0, shiftKey: !0 }, "formatDocument"), e;
1802
1803
  }
1803
- addBinding(e, t, i, s) {
1804
- const n = t.toLowerCase();
1805
- e[n] || (e[n] = []), e[n].push({
1806
- key: n,
1807
- command: s,
1804
+ addBinding(e, t, i, n) {
1805
+ const s = t.toLowerCase();
1806
+ e[s] || (e[s] = []), e[s].push({
1807
+ key: s,
1808
+ command: n,
1808
1809
  ...i
1809
1810
  });
1810
1811
  }
@@ -1821,7 +1822,7 @@ class J {
1821
1822
  }
1822
1823
  removeKeyBinding(e, t) {
1823
1824
  const i = e.toLowerCase();
1824
- t ? this.keymap[i] && (this.keymap[i] = this.keymap[i].filter((s) => s.command !== t), this.keymap[i].length === 0 && delete this.keymap[i]) : delete this.keymap[i];
1825
+ t ? this.keymap[i] && (this.keymap[i] = this.keymap[i].filter((n) => n.command !== t), this.keymap[i].length === 0 && delete this.keymap[i]) : delete this.keymap[i];
1825
1826
  }
1826
1827
  getKeymap() {
1827
1828
  return { ...this.keymap };
@@ -1829,8 +1830,8 @@ class J {
1829
1830
  getBindingsForCommand(e) {
1830
1831
  const t = [];
1831
1832
  for (const i in this.keymap)
1832
- for (const s of this.keymap[i])
1833
- s.command === e && t.push({ ...s });
1833
+ for (const n of this.keymap[i])
1834
+ n.command === e && t.push({ ...n });
1834
1835
  return t;
1835
1836
  }
1836
1837
  getPlatformInfo() {
@@ -1843,7 +1844,7 @@ class J {
1843
1844
  this.keymap = {}, this.editor = null;
1844
1845
  }
1845
1846
  }
1846
- const U = class z {
1847
+ const D = class D {
1847
1848
  constructor() {
1848
1849
  this.name = "transaction", this.transactions = [];
1849
1850
  }
@@ -1855,9 +1856,9 @@ const U = class z {
1855
1856
  effects: [],
1856
1857
  annotations: []
1857
1858
  };
1858
- this.transactions.push(i), this.transactions.length > z.MAX_TRANSACTIONS && this.transactions.splice(
1859
+ this.transactions.push(i), this.transactions.length > D.MAX_TRANSACTIONS && this.transactions.splice(
1859
1860
  0,
1860
- this.transactions.length - z.MAX_TRANSACTIONS
1861
+ this.transactions.length - D.MAX_TRANSACTIONS
1861
1862
  );
1862
1863
  });
1863
1864
  }
@@ -1868,9 +1869,9 @@ const U = class z {
1868
1869
  this.transactions = [];
1869
1870
  }
1870
1871
  };
1871
- U.MAX_TRANSACTIONS = 200;
1872
- let ee = U;
1873
- class te {
1872
+ D.MAX_TRANSACTIONS = 200;
1873
+ let W = D;
1874
+ class J {
1874
1875
  constructor() {
1875
1876
  this.name = "line-numbers", this.editor = null, this.lineNumbersElement = null, this.isEnabled = !0;
1876
1877
  }
@@ -1899,7 +1900,7 @@ class te {
1899
1900
  this.lineNumbersElement = null, this.editor = null;
1900
1901
  }
1901
1902
  }
1902
- class ie {
1903
+ class ee {
1903
1904
  constructor() {
1904
1905
  this.name = "theme", this.editor = null, this.currentTheme = "dark";
1905
1906
  }
@@ -1924,7 +1925,7 @@ class ie {
1924
1925
  this.editor = null;
1925
1926
  }
1926
1927
  }
1927
- class se {
1928
+ class te {
1928
1929
  constructor() {
1929
1930
  this.name = "read-only", this.editor = null, this.isReadOnly = !1;
1930
1931
  }
@@ -1951,14 +1952,14 @@ class se {
1951
1952
  this.editor = null;
1952
1953
  }
1953
1954
  }
1954
- let ne = 0;
1955
- const K = class y {
1955
+ let ie = 0;
1956
+ const y = class y {
1956
1957
  constructor(e = {}) {
1957
1958
  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 = {
1958
1959
  caseSensitive: !1,
1959
1960
  wholeWord: !1,
1960
1961
  regex: !1
1961
- }, this.trailingMarkerAttr = "data-lce-trailing-newline-marker", this.editorContainerSelector = '[data-lce-editor-container="true"]', this.highlightId = ++ne, 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 = {
1962
+ }, this.trailingMarkerAttr = "data-lce-trailing-newline-marker", this.editorContainerSelector = '[data-lce-editor-container="true"]', this.highlightId = ++ie, 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 = {
1962
1963
  replaceAndFindNext: !0,
1963
1964
  ...e
1964
1965
  };
@@ -1991,9 +1992,9 @@ const K = class y {
1991
1992
  if (!this.editor) return;
1992
1993
  const e = this.editor.getView().getContentElement(), t = e.closest(
1993
1994
  this.editorContainerSelector
1994
- ), i = t == null ? void 0 : t.parentElement, s = e.closest(".rte-source-editor-modal") || i || t || e.parentElement;
1995
- if (!s) return;
1996
- window.getComputedStyle(s).position === "static" && (s.style.position = "relative"), this.searchUI = document.createElement("div"), this.searchUI.className = y.css.root, this.searchUI.style.display = "none", this.searchUI.innerHTML = `
1995
+ ), i = t == null ? void 0 : t.parentElement, n = e.closest(".rte-source-editor-modal") || i || t || e.parentElement;
1996
+ if (!n) return;
1997
+ window.getComputedStyle(n).position === "static" && (n.style.position = "relative"), this.searchUI = document.createElement("div"), this.searchUI.className = y.css.root, this.searchUI.style.display = "none", this.searchUI.innerHTML = `
1997
1998
  <div class="${y.css.row}">
1998
1999
  <input type="text" class="${y.css.findInput} ${y.css.inputBase}" placeholder="Find..." />
1999
2000
  <button class="${y.css.prevButton} ${y.css.buttonBase}" type="button" aria-label="Previous match">↑</button>
@@ -2020,7 +2021,7 @@ const K = class y {
2020
2021
  </div>
2021
2022
  <input type="text" class="${y.css.replaceInput} ${y.css.inputBase} ${y.css.replaceInputLayout}" placeholder="Replace with..." />
2022
2023
  `;
2023
- const n = this.searchUI.querySelector(
2024
+ const s = this.searchUI.querySelector(
2024
2025
  `.${y.css.findInput}`
2025
2026
  ), r = this.searchUI.querySelector(
2026
2027
  `.${y.css.replaceInput}`
@@ -2032,32 +2033,32 @@ const K = class y {
2032
2033
  `.${y.css.closeButton}`
2033
2034
  ), h = this.searchUI.querySelector(
2034
2035
  `.${y.css.status}`
2035
- ), d = this.searchUI.querySelector(
2036
- `.${y.css.mode}`
2037
2036
  ), c = this.searchUI.querySelector(
2037
+ `.${y.css.mode}`
2038
+ ), g = this.searchUI.querySelector(
2038
2039
  `.${y.css.caseSensitive}`
2039
- ), u = this.searchUI.querySelector(
2040
+ ), f = this.searchUI.querySelector(
2040
2041
  `.${y.css.wholeWord}`
2041
- ), g = this.searchUI.querySelector(
2042
+ ), d = this.searchUI.querySelector(
2042
2043
  `.${y.css.regex}`
2043
2044
  );
2044
- this.findInput = n, this.replaceInputEl = r, this.statusDiv = h, this.modeDiv = d, this.caseSensitiveInput = c, this.wholeWordInput = u, this.regexInput = g, c.checked = !!this.searchOptions.caseSensitive, u.checked = !!this.searchOptions.wholeWord, g.checked = !!this.searchOptions.regex, n.addEventListener("input", () => {
2045
+ this.findInput = s, this.replaceInputEl = r, this.statusDiv = h, this.modeDiv = c, this.caseSensitiveInput = g, this.wholeWordInput = f, this.regexInput = d, g.checked = !!this.searchOptions.caseSensitive, f.checked = !!this.searchOptions.wholeWord, d.checked = !!this.searchOptions.regex, s.addEventListener("input", () => {
2045
2046
  this.searchDebounceTimer && clearTimeout(this.searchDebounceTimer);
2046
- const p = n.value;
2047
+ const p = s.value;
2047
2048
  this.searchDebounceTimer = setTimeout(() => {
2048
2049
  this.performSearch(p, !1, !1);
2049
2050
  }, 120);
2050
2051
  });
2051
- const f = () => {
2052
- this.searchOptions.caseSensitive = c.checked, this.searchOptions.wholeWord = u.checked, this.searchOptions.regex = g.checked;
2053
- const p = n.value;
2052
+ const u = () => {
2053
+ this.searchOptions.caseSensitive = g.checked, this.searchOptions.wholeWord = f.checked, this.searchOptions.regex = d.checked;
2054
+ const p = s.value;
2054
2055
  p.trim() ? this.performSearch(p, !1, !1) : this.performSearch("", !1, !1);
2055
2056
  };
2056
- c.addEventListener("change", f), u.addEventListener("change", f), g.addEventListener("change", f), n.addEventListener("keydown", (p) => {
2057
+ g.addEventListener("change", u), f.addEventListener("change", u), d.addEventListener("change", u), s.addEventListener("keydown", (p) => {
2057
2058
  p.key === "Enter" ? (p.preventDefault(), p.shiftKey ? this.findPrev() : this.findNext()) : p.key === "Escape" && (p.preventDefault(), this.hideSearch());
2058
2059
  }), r.addEventListener("keydown", (p) => {
2059
- p.key === "Enter" ? (p.preventDefault(), p.shiftKey ? this.replaceAll(n.value, r.value) : this.replaceCurrent(n.value, r.value)) : p.key === "Escape" && (p.preventDefault(), this.hideSearch());
2060
- }), o.addEventListener("click", () => this.findPrev()), l.addEventListener("click", () => this.findNext()), a.addEventListener("click", () => this.hideSearch()), s.appendChild(this.searchUI);
2060
+ p.key === "Enter" ? (p.preventDefault(), p.shiftKey ? this.replaceAll(s.value, r.value) : this.replaceCurrent(s.value, r.value)) : p.key === "Escape" && (p.preventDefault(), this.hideSearch());
2061
+ }), o.addEventListener("click", () => this.findPrev()), l.addEventListener("click", () => this.findNext()), a.addEventListener("click", () => this.hideSearch()), n.appendChild(this.searchUI);
2061
2062
  }
2062
2063
  updateModeHint(e) {
2063
2064
  this.modeDiv && (this.modeDiv.textContent = e ? `Replace: move next ${this.config.replaceAndFindNext ? "ON" : "OFF"}` : "Find mode");
@@ -2072,12 +2073,12 @@ const K = class y {
2072
2073
  return;
2073
2074
  }
2074
2075
  this.currentQuery = e;
2075
- const s = this.currentIndex, n = this.editor.search(e, this.searchOptions);
2076
- if (this.currentResults = n, n.length === 0) {
2076
+ const n = this.currentIndex, s = this.editor.search(e, this.searchOptions);
2077
+ if (this.currentResults = s, s.length === 0) {
2077
2078
  this.currentIndex = -1, this.clearHighlights(), this.updateStatus("No matches");
2078
2079
  return;
2079
2080
  }
2080
- t && s >= 0 ? this.currentIndex = Math.min(s, n.length - 1) : this.currentIndex = 0, this.updateHighlights(i);
2081
+ t && n >= 0 ? this.currentIndex = Math.min(n, s.length - 1) : this.currentIndex = 0, this.updateHighlights(i);
2081
2082
  }
2082
2083
  findNext() {
2083
2084
  if (this.currentResults.length === 0) {
@@ -2097,17 +2098,17 @@ const K = class y {
2097
2098
  if (!this.editor || !e.trim() || ((this.currentQuery !== e || this.currentResults.length === 0) && this.performSearch(e, !1, !0), this.currentIndex < 0 || this.currentResults.length === 0)) return;
2098
2099
  const i = this.currentResults[this.currentIndex];
2099
2100
  if (!i) return;
2100
- const s = this.computeReplacementRange(i.range.start, t);
2101
+ const n = this.computeReplacementRange(i.range.start, t);
2101
2102
  if (this.editor.replace(i.range, t), this.config.replaceAndFindNext) {
2102
2103
  this.currentQuery = e;
2103
- const n = this.editor.search(e, this.searchOptions);
2104
- if (this.currentResults = n, n.length === 0) {
2104
+ const s = this.editor.search(e, this.searchOptions);
2105
+ if (this.currentResults = s, s.length === 0) {
2105
2106
  this.currentIndex = -1, this.clearHighlights(), this.updateStatus("Replaced current occurrence"), this.restoreReplaceInputFocus();
2106
2107
  return;
2107
2108
  }
2108
- this.currentIndex = this.findNextResultIndexAfter(s.end, n), this.updateHighlights(!0);
2109
+ this.currentIndex = this.findNextResultIndexAfter(n.end, s), this.updateHighlights(!0);
2109
2110
  } else
2110
- this.scrollLogicalRangeIntoView(s, !0), this.performSearch(e, !0, !1);
2111
+ this.scrollLogicalRangeIntoView(n, !0), this.performSearch(e, !0, !1);
2111
2112
  this.currentResults.length > 0 || this.showTransientStatus("Replaced current occurrence"), this.restoreReplaceInputFocus(), this.revealActiveResultAfterFocusRestore();
2112
2113
  }
2113
2114
  replaceAll(e, t) {
@@ -2126,10 +2127,10 @@ const K = class y {
2126
2127
  }
2127
2128
  navigateToResult(e, t) {
2128
2129
  if (!this.editor) return;
2129
- const i = document.activeElement, s = !!i && (i === this.findInput || i === this.replaceInputEl);
2130
+ const i = document.activeElement, n = !!i && (i === this.findInput || i === this.replaceInputEl);
2130
2131
  t ? (this.editor.setSelection(e.range), this.centerCurrentSelectionInView()) : this.scrollResultIntoView(e);
2131
- const n = this.editor.getView();
2132
- t && typeof n.ensureCaretVisible == "function" && n.ensureCaretVisible(), t && s && i && requestAnimationFrame(() => {
2132
+ const s = this.editor.getView();
2133
+ t && typeof s.ensureCaretVisible == "function" && s.ensureCaretVisible(), t && n && i && requestAnimationFrame(() => {
2133
2134
  this.focusWithoutScrolling(i);
2134
2135
  });
2135
2136
  }
@@ -2147,18 +2148,18 @@ const K = class y {
2147
2148
  }
2148
2149
  scrollLogicalRangeIntoView(e, t) {
2149
2150
  if (!this.editor) return;
2150
- const i = this.editor.getView().getContentElement(), s = this.editor.getValue(), { lineStarts: n, lines: r } = this.buildLineStarts(s), o = this.buildTextNodeIndex(i);
2151
+ const i = this.editor.getView().getContentElement(), n = this.editor.getValue(), { lineStarts: s, lines: r } = this.buildLineStarts(n), o = this.buildTextNodeIndex(i);
2151
2152
  if (o.length === 0) return;
2152
- const l = this.toDomRange(e, n, r, o);
2153
+ const l = this.toDomRange(e, s, r, o);
2153
2154
  if (!l) return;
2154
2155
  const a = l.startContainer.nodeType === Node.TEXT_NODE ? l.startContainer.parentElement : l.startContainer, h = this.resolveScrollContainer(i);
2155
2156
  if (h) {
2156
- const d = l.getClientRects()[0] || l.getBoundingClientRect(), c = h.getBoundingClientRect(), u = h.scrollTop + (d.top - c.top) - c.height / 2 + d.height / 2, g = 18;
2157
- let f = t ? u : h.scrollTop, p = h.scrollLeft;
2158
- const m = h.scrollLeft + (d.left - c.left), x = m + d.width;
2159
- d.right > c.right - g ? p = x - c.width + g : d.left < c.left + g && (p = Math.max(0, m - g));
2160
- const v = Math.max(0, h.scrollHeight - h.clientHeight), T = Math.max(0, h.scrollWidth - h.clientWidth);
2161
- if (f = Math.min(v, Math.max(0, f)), p = Math.min(T, Math.max(0, p)), v === 0 && T === 0) {
2157
+ const c = l.getClientRects()[0] || l.getBoundingClientRect(), g = h.getBoundingClientRect(), d = h.scrollTop + (c.top - g.top) - g.height / 2 + c.height / 2, u = 18;
2158
+ let p = t ? d : h.scrollTop, m = h.scrollLeft;
2159
+ const x = h.scrollLeft + (c.left - g.left), v = x + c.width;
2160
+ c.right > g.right - u ? m = v - g.width + u : c.left < g.left + u && (m = Math.max(0, x - u));
2161
+ const T = Math.max(0, h.scrollHeight - h.clientHeight), S = Math.max(0, h.scrollWidth - h.clientWidth);
2162
+ if (p = Math.min(T, Math.max(0, p)), m = Math.min(S, Math.max(0, m)), T === 0 && S === 0) {
2162
2163
  a == null || a.scrollIntoView({
2163
2164
  block: t ? "center" : "nearest",
2164
2165
  inline: "nearest",
@@ -2166,9 +2167,9 @@ const K = class y {
2166
2167
  });
2167
2168
  return;
2168
2169
  }
2169
- (f !== h.scrollTop || p !== h.scrollLeft) && h.scrollTo({
2170
- top: f,
2171
- left: p,
2170
+ (p !== h.scrollTop || m !== h.scrollLeft) && h.scrollTo({
2171
+ top: p,
2172
+ left: m,
2172
2173
  behavior: "smooth"
2173
2174
  });
2174
2175
  return;
@@ -2196,32 +2197,32 @@ const K = class y {
2196
2197
  if (!t) return;
2197
2198
  const i = window.getSelection();
2198
2199
  if (!i || i.rangeCount === 0) return;
2199
- const s = i.getRangeAt(0).cloneRange(), n = s.getClientRects()[0] || s.getBoundingClientRect();
2200
- if (!n) return;
2201
- const r = t.getBoundingClientRect(), o = t.scrollTop + (n.top - r.top) - r.height / 2 + n.height / 2, l = Math.max(0, t.scrollHeight - t.clientHeight), a = Math.min(l, Math.max(0, o));
2202
- a !== t.scrollTop && t.scrollTo({
2203
- top: a,
2200
+ const n = i.getRangeAt(0).cloneRange(), s = n.getClientRects()[0] || n.getBoundingClientRect();
2201
+ if (!s) return;
2202
+ const r = t.getBoundingClientRect(), l = t.scrollTop + (s.top - r.top) - r.height / 2 + s.height / 2, a = Math.max(0, t.scrollHeight - t.clientHeight), h = Math.min(a, Math.max(0, l));
2203
+ h !== t.scrollTop && t.scrollTo({
2204
+ top: h,
2204
2205
  behavior: "smooth"
2205
2206
  });
2206
2207
  }
2207
2208
  computeReplacementRange(e, t) {
2208
2209
  const i = t.replace(/\r\n?/g, `
2209
- `), s = i.split(`
2210
+ `), n = i.split(`
2210
2211
  `);
2211
- let n;
2212
- return s.length <= 1 ? (n = {
2212
+ let s;
2213
+ return n.length <= 1 ? (s = {
2213
2214
  start: e,
2214
2215
  end: {
2215
2216
  line: e.line,
2216
2217
  column: e.column + i.length
2217
2218
  }
2218
- }, this.clampRangeToDocument(n)) : (n = {
2219
+ }, this.clampRangeToDocument(s)) : (s = {
2219
2220
  start: e,
2220
2221
  end: {
2221
- line: e.line + s.length - 1,
2222
- column: s[s.length - 1].length
2222
+ line: e.line + n.length - 1,
2223
+ column: n[n.length - 1].length
2223
2224
  }
2224
- }, this.clampRangeToDocument(n));
2225
+ }, this.clampRangeToDocument(s));
2225
2226
  }
2226
2227
  findNextResultIndexAfter(e, t) {
2227
2228
  for (let i = 0; i < t.length; i++)
@@ -2237,15 +2238,15 @@ const K = class y {
2237
2238
  const t = this.editor;
2238
2239
  if (!t) return e;
2239
2240
  const i = t.getValue().split(`
2240
- `), s = Math.max(0, i.length - 1), n = Math.max(0, Math.min(e.start.line, s)), r = Math.max(0, Math.min(e.end.line, s)), o = Math.max(
2241
+ `), n = Math.max(0, i.length - 1), s = Math.max(0, Math.min(e.start.line, n)), r = Math.max(0, Math.min(e.end.line, n)), o = Math.max(
2241
2242
  0,
2242
- Math.min(e.start.column, ((a = i[n]) == null ? void 0 : a.length) || 0)
2243
+ Math.min(e.start.column, ((a = i[s]) == null ? void 0 : a.length) || 0)
2243
2244
  ), l = Math.max(
2244
2245
  0,
2245
2246
  Math.min(e.end.column, ((h = i[r]) == null ? void 0 : h.length) || 0)
2246
2247
  );
2247
2248
  return {
2248
- start: { line: n, column: o },
2249
+ start: { line: s, column: o },
2249
2250
  end: { line: r, column: l }
2250
2251
  };
2251
2252
  }
@@ -2256,36 +2257,36 @@ const K = class y {
2256
2257
  });
2257
2258
  } catch (t) {
2258
2259
  const i = [];
2259
- let s = e.parentElement;
2260
- for (; s; )
2261
- this.canScroll(s) && i.push({
2262
- el: s,
2263
- top: s.scrollTop,
2264
- left: s.scrollLeft
2265
- }), s = s.parentElement;
2266
- const n = window.scrollX, r = window.scrollY;
2260
+ let n = e.parentElement;
2261
+ for (; n; )
2262
+ this.canScroll(n) && i.push({
2263
+ el: n,
2264
+ top: n.scrollTop,
2265
+ left: n.scrollLeft
2266
+ }), n = n.parentElement;
2267
+ const s = window.scrollX, r = window.scrollY;
2267
2268
  e.focus();
2268
2269
  for (let o = 0; o < i.length; o++) {
2269
2270
  const l = i[o];
2270
2271
  l.el.scrollTop = l.top, l.el.scrollLeft = l.left;
2271
2272
  }
2272
- window.scrollTo(n, r);
2273
+ window.scrollTo(s, r);
2273
2274
  }
2274
2275
  }
2275
2276
  findScrollContainer(e) {
2276
2277
  let t = e;
2277
2278
  for (; t; ) {
2278
- const i = window.getComputedStyle(t).overflowY;
2279
- if ((i === "auto" || i === "scroll") && t.scrollHeight > t.clientHeight)
2279
+ const n = window.getComputedStyle(t).overflowY;
2280
+ if ((n === "auto" || n === "scroll") && t.scrollHeight > t.clientHeight)
2280
2281
  return t;
2281
2282
  t = t.parentElement;
2282
2283
  }
2283
2284
  return null;
2284
2285
  }
2285
2286
  resolveScrollContainer(e) {
2286
- var i, s, n;
2287
- const t = ((n = (s = (i = this.editor) == null ? void 0 : i.getView()) == null ? void 0 : s.getScrollElement) == null ? void 0 : n.call(s)) || null;
2288
- return t && this.canScroll(t) ? t : this.findScrollContainer(e);
2287
+ var n, s;
2288
+ const t = (n = this.editor) == null ? void 0 : n.getView(), i = ((s = t == null ? void 0 : t.getScrollElement) == null ? void 0 : s.call(t)) || null;
2289
+ return i && this.canScroll(i) ? i : this.findScrollContainer(e);
2289
2290
  }
2290
2291
  canScroll(e) {
2291
2292
  return e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth;
@@ -2299,123 +2300,122 @@ const K = class y {
2299
2300
  applyCustomHighlights() {
2300
2301
  if (!this.editor || !this.hasCustomHighlightSupport || this.currentResults.length === 0)
2301
2302
  return;
2302
- const e = this.editor.getView().getContentElement(), t = this.editor.getValue(), { lineStarts: i, lines: s } = this.buildLineStarts(t), n = this.buildTextNodeIndex(e);
2303
- if (n.length === 0) return;
2304
- const r = this.buildVisibleDocumentText(n), o = [];
2303
+ const e = this.editor.getView().getContentElement(), t = this.editor.getValue(), { lineStarts: i, lines: n } = this.buildLineStarts(t), s = this.buildTextNodeIndex(e);
2304
+ if (s.length === 0) return;
2305
+ const r = this.buildVisibleDocumentText(s), o = [];
2305
2306
  let l = null;
2306
2307
  const a = Math.min(this.currentResults.length, this.maxCustomHighlightRanges);
2307
2308
  for (let h = 0; h < a; h++) {
2308
- const d = this.currentResults[h], c = this.searchOptions.regex ? d.match || this.currentQuery : this.currentQuery || d.match, u = this.toDomRange(
2309
- d.range,
2309
+ const c = this.currentResults[h], g = this.searchOptions.regex ? c.match || this.currentQuery : this.currentQuery || c.match, f = this.toDomRange(
2310
+ c.range,
2310
2311
  i,
2311
- s,
2312
2312
  n,
2313
+ s,
2313
2314
  r,
2314
- c
2315
+ g
2315
2316
  );
2316
- u && (o.push(u), h === this.currentIndex && (l = u));
2317
+ f && (o.push(f), h === this.currentIndex && (l = f));
2317
2318
  }
2318
2319
  if (o.length !== 0)
2319
2320
  try {
2320
- const h = CSS, d = window.Highlight;
2321
- if (!h.highlights || !d) return;
2322
- h.highlights.set(this.highlightMatchName, new d(...o)), l && h.highlights.set(this.highlightActiveName, new d(l));
2321
+ const h = CSS, c = window.Highlight;
2322
+ if (!h.highlights || !c) return;
2323
+ h.highlights.set(this.highlightMatchName, new c(...o)), l && h.highlights.set(this.highlightActiveName, new c(l));
2323
2324
  } catch (h) {
2324
2325
  }
2325
2326
  }
2326
2327
  buildLineStarts(e) {
2327
2328
  const t = e.split(`
2328
2329
  `), i = new Array(t.length);
2329
- let s = 0;
2330
- for (let n = 0; n < t.length; n++)
2331
- i[n] = s, s += t[n].length + 1;
2330
+ let n = 0;
2331
+ for (let s = 0; s < t.length; s++)
2332
+ i[s] = n, n += t[s].length + 1;
2332
2333
  return { lineStarts: i, lines: t };
2333
2334
  }
2334
2335
  positionToOffset(e, t, i) {
2335
2336
  var r;
2336
- const s = Math.max(0, Math.min(e.line, i.length - 1)), n = Math.max(0, Math.min(e.column, ((r = i[s]) == null ? void 0 : r.length) || 0));
2337
- return t[s] + n;
2337
+ const n = Math.max(0, Math.min(e.line, i.length - 1)), s = Math.max(0, Math.min(e.column, ((r = i[n]) == null ? void 0 : r.length) || 0));
2338
+ return t[n] + s;
2338
2339
  }
2339
2340
  buildTextNodeIndex(e) {
2340
- var r;
2341
2341
  const t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, null), i = [];
2342
- let s = 0, n;
2343
- for (; n = t.nextNode(); ) {
2344
- const o = n;
2345
- if ((r = o.parentElement) != null && r.hasAttribute(this.trailingMarkerAttr))
2342
+ let n = 0, s;
2343
+ for (; s = t.nextNode(); ) {
2344
+ const r = s, o = r.parentElement;
2345
+ if (o != null && o.hasAttribute(this.trailingMarkerAttr))
2346
2346
  continue;
2347
- const l = o.textContent || "", a = this.buildVisibleToDomMap(l), h = Math.max(0, a.length - 1);
2347
+ const l = r.textContent || "", a = this.buildVisibleToDomMap(l), h = Math.max(0, a.length - 1);
2348
2348
  h === 0 && l.length === 0 || (i.push({
2349
- node: o,
2350
- start: s,
2351
- end: s + h,
2349
+ node: r,
2350
+ start: n,
2351
+ end: n + h,
2352
2352
  visibleToDom: a
2353
- }), s += h);
2353
+ }), n += h);
2354
2354
  }
2355
2355
  return i;
2356
2356
  }
2357
2357
  resolveDomPoint(e, t) {
2358
- var n, r, o, l, a, h;
2358
+ var s, r, o, l, a, h;
2359
2359
  const i = Math.max(0, e);
2360
- for (let d = 0; d < t.length; d++) {
2361
- const c = t[d];
2362
- if (i <= c.end) {
2363
- const u = Math.max(0, i - c.start), g = (o = (r = c.visibleToDom[u]) != null ? r : (n = c.node.textContent) == null ? void 0 : n.length) != null ? o : 0;
2360
+ for (let c = 0; c < t.length; c++) {
2361
+ const g = t[c];
2362
+ if (i <= g.end) {
2363
+ const f = Math.max(0, i - g.start), d = (o = (r = g.visibleToDom[f]) != null ? r : (s = g.node.textContent) == null ? void 0 : s.length) != null ? o : 0;
2364
2364
  return {
2365
- node: c.node,
2366
- offset: g
2365
+ node: g.node,
2366
+ offset: d
2367
2367
  };
2368
2368
  }
2369
2369
  }
2370
- const s = t[t.length - 1];
2371
- return s ? {
2372
- node: s.node,
2373
- offset: (h = (a = s.visibleToDom[s.visibleToDom.length - 1]) != null ? a : (l = s.node.textContent) == null ? void 0 : l.length) != null ? h : 0
2370
+ const n = t[t.length - 1];
2371
+ return n ? {
2372
+ node: n.node,
2373
+ offset: (h = (a = n.visibleToDom[n.visibleToDom.length - 1]) != null ? a : (l = n.node.textContent) == null ? void 0 : l.length) != null ? h : 0
2374
2374
  } : null;
2375
2375
  }
2376
- toDomRange(e, t, i, s, n, r) {
2376
+ toDomRange(e, t, i, n, s, r) {
2377
2377
  const o = this.positionToOffset(e.start, t, i), l = this.positionToOffset(e.end, t, i);
2378
2378
  let a = Math.min(o, l), h = Math.max(o, l);
2379
- if (n && r) {
2380
- const g = r, f = n.slice(a, h);
2381
- if (f.length === g.length && f.toLowerCase() !== g.toLowerCase()) {
2379
+ if (s && r) {
2380
+ const d = r, u = s.slice(a, h);
2381
+ if (u.length === d.length && u.toLowerCase() !== d.toLowerCase()) {
2382
2382
  const p = this.findNearestMatchOffset(
2383
- n,
2384
- g,
2383
+ s,
2384
+ d,
2385
2385
  a
2386
2386
  );
2387
- p !== -1 && (a = p, h = p + g.length);
2387
+ p !== -1 && (a = p, h = p + d.length);
2388
2388
  }
2389
2389
  }
2390
- const d = this.resolveDomPoint(a, s), c = this.resolveDomPoint(h, s);
2391
- if (!d || !c) return null;
2392
- const u = document.createRange();
2390
+ const c = this.resolveDomPoint(a, n), g = this.resolveDomPoint(h, n);
2391
+ if (!c || !g) return null;
2392
+ const f = document.createRange();
2393
2393
  try {
2394
- return u.setStart(d.node, d.offset), u.setEnd(c.node, c.offset), u;
2395
- } catch (g) {
2394
+ return f.setStart(c.node, c.offset), f.setEnd(g.node, g.offset), f;
2395
+ } catch (d) {
2396
2396
  return null;
2397
2397
  }
2398
2398
  }
2399
2399
  buildVisibleDocumentText(e) {
2400
2400
  let t = "";
2401
2401
  for (let i = 0; i < e.length; i++) {
2402
- const s = e[i].node.textContent || "";
2403
- for (let n = 0; n < s.length; n++) {
2404
- const r = s[n];
2402
+ const n = e[i].node.textContent || "";
2403
+ for (let s = 0; s < n.length; s++) {
2404
+ const r = n[s];
2405
2405
  this.virtualMarkerRegex.test(r) || (t += r);
2406
2406
  }
2407
2407
  }
2408
2408
  return t;
2409
2409
  }
2410
2410
  findNearestMatchOffset(e, t, i) {
2411
- const s = t.toLowerCase();
2412
- let n = e.toLowerCase().indexOf(s);
2413
- if (n === -1) return -1;
2414
- let r = n, o = Math.abs(n - i);
2415
- for (; n !== -1; ) {
2416
- const l = Math.abs(n - i);
2417
- if (l < o && (o = l, r = n), l === 0) return n;
2418
- n = e.toLowerCase().indexOf(s, n + 1);
2411
+ const n = t.toLowerCase();
2412
+ let s = e.toLowerCase().indexOf(n);
2413
+ if (s === -1) return -1;
2414
+ let r = s, o = Math.abs(s - i);
2415
+ for (; s !== -1; ) {
2416
+ const l = Math.abs(s - i);
2417
+ if (l < o && (o = l, r = s), l === 0) return s;
2418
+ s = e.toLowerCase().indexOf(n, s + 1);
2419
2419
  }
2420
2420
  return r;
2421
2421
  }
@@ -2477,9 +2477,9 @@ const K = class y {
2477
2477
  buildVisibleToDomMap(e) {
2478
2478
  const t = [0];
2479
2479
  let i = 0;
2480
- for (let s = 0; s < e.length; s++) {
2481
- const n = e[s];
2482
- this.virtualMarkerRegex.test(n) || (i += 1, t[i] = s + 1);
2480
+ for (let n = 0; n < e.length; n++) {
2481
+ const s = e[n];
2482
+ this.virtualMarkerRegex.test(s) || (i += 1, t[i] = n + 1);
2483
2483
  }
2484
2484
  return t;
2485
2485
  }
@@ -2503,7 +2503,7 @@ const K = class y {
2503
2503
  e != null && e.parentNode && e.parentNode.removeChild(e), this.editor = null;
2504
2504
  }
2505
2505
  };
2506
- K.css = {
2506
+ y.css = {
2507
2507
  root: "lce-search-ui",
2508
2508
  row: "lce-search-row",
2509
2509
  options: "lce-search-options",
@@ -2526,8 +2526,8 @@ K.css = {
2526
2526
  mode: "search-mode",
2527
2527
  modeLayout: "lce-search-mode"
2528
2528
  };
2529
- let re = K, oe = 0;
2530
- class le {
2529
+ let U = y, ne = 0;
2530
+ class se {
2531
2531
  constructor() {
2532
2532
  this.name = "bracket-matching", this.editor = null, this.bracketPairs = {
2533
2533
  "(": ")",
@@ -2539,7 +2539,7 @@ class le {
2539
2539
  "]": "[",
2540
2540
  "}": "{",
2541
2541
  ">": "<"
2542
- }, this.highlightId = ++oe, 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;
2542
+ }, this.highlightId = ++ne, 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;
2543
2543
  }
2544
2544
  setup(e) {
2545
2545
  this.editor = e, this.hasCustomHighlightSupport = this.detectCustomHighlightSupport(), this.hasCustomHighlightSupport && (this.ensureHighlightStyles(), this.observeContentMutations()), this.cursorHandler = () => {
@@ -2569,17 +2569,17 @@ class le {
2569
2569
  this.clearBracketHighlighting();
2570
2570
  const i = this.getBracketNearPosition(t, e.position);
2571
2571
  if (!i) return;
2572
- const s = this.findMatchingBracket(t, i);
2573
- s && (this.currentMatch = s, this.highlightBrackets(s));
2572
+ const n = this.findMatchingBracket(t, i);
2573
+ n && (this.currentMatch = n, this.highlightBrackets(n));
2574
2574
  }
2575
2575
  getBracketNearPosition(e, t) {
2576
2576
  const i = e.split(`
2577
2577
  `);
2578
2578
  if (t.line < 0 || t.line >= i.length) return null;
2579
- const s = [{ line: t.line, column: t.column }];
2580
- t.column > 0 && s.push({ line: t.line, column: t.column - 1 });
2581
- for (const n of s) {
2582
- const r = this.getBracketAtPosition(i, n);
2579
+ const n = [{ line: t.line, column: t.column }];
2580
+ t.column > 0 && n.push({ line: t.line, column: t.column - 1 });
2581
+ for (const s of n) {
2582
+ const r = this.getBracketAtPosition(i, s);
2583
2583
  if (r)
2584
2584
  return r;
2585
2585
  }
@@ -2589,47 +2589,47 @@ class le {
2589
2589
  if (t.line < 0 || t.line >= e.length) return null;
2590
2590
  const i = e[t.line];
2591
2591
  if (t.column < 0 || t.column >= i.length) return null;
2592
- const s = i[t.column];
2593
- return this.bracketPairs[s] || this.reverseBracketPairs[s] ? { char: s, position: t } : null;
2592
+ const n = i[t.column];
2593
+ return this.bracketPairs[n] || this.reverseBracketPairs[n] ? { char: n, position: t } : null;
2594
2594
  }
2595
2595
  findMatchingBracket(e, t) {
2596
2596
  const i = e.split(`
2597
- `), s = t.position.line, n = t.position.column, r = t.char;
2598
- return this.bracketPairs[r] ? this.findClosingBracket(i, s, n, r) : this.reverseBracketPairs[r] ? this.findOpeningBracket(i, s, n, r) : null;
2597
+ `), n = t.position.line, s = t.position.column, r = t.char;
2598
+ return this.bracketPairs[r] ? this.findClosingBracket(i, n, s, r) : this.reverseBracketPairs[r] ? this.findOpeningBracket(i, n, s, r) : null;
2599
2599
  }
2600
- findClosingBracket(e, t, i, s) {
2601
- const n = this.bracketPairs[s];
2600
+ findClosingBracket(e, t, i, n) {
2601
+ const s = this.bracketPairs[n];
2602
2602
  let r = 0;
2603
2603
  for (let o = t; o < e.length; o++) {
2604
2604
  const l = e[o], a = o === t ? i : 0;
2605
2605
  for (let h = a; h < l.length; h++) {
2606
- const d = l[h];
2607
- if (d === s)
2606
+ const c = l[h];
2607
+ if (c === n)
2608
2608
  r++;
2609
- else if (d === n && (r--, r === 0))
2609
+ else if (c === s && (r--, r === 0))
2610
2610
  return {
2611
2611
  open: { start: { line: t, column: i }, end: { line: t, column: i + 1 } },
2612
2612
  close: { start: { line: o, column: h }, end: { line: o, column: h + 1 } },
2613
- type: s
2613
+ type: n
2614
2614
  };
2615
2615
  }
2616
2616
  }
2617
2617
  return null;
2618
2618
  }
2619
- findOpeningBracket(e, t, i, s) {
2620
- const n = this.reverseBracketPairs[s];
2619
+ findOpeningBracket(e, t, i, n) {
2620
+ const s = this.reverseBracketPairs[n];
2621
2621
  let r = 0;
2622
2622
  for (let o = t; o >= 0; o--) {
2623
2623
  const l = e[o], a = o === t ? i : l.length - 1;
2624
2624
  for (let h = a; h >= 0; h--) {
2625
- const d = l[h];
2626
- if (d === s)
2625
+ const c = l[h];
2626
+ if (c === n)
2627
2627
  r++;
2628
- else if (d === n && (r--, r === 0))
2628
+ else if (c === s && (r--, r === 0))
2629
2629
  return {
2630
2630
  open: { start: { line: o, column: h }, end: { line: o, column: h + 1 } },
2631
2631
  close: { start: { line: t, column: i }, end: { line: t, column: i + 1 } },
2632
- type: n
2632
+ type: s
2633
2633
  };
2634
2634
  }
2635
2635
  }
@@ -2637,13 +2637,13 @@ class le {
2637
2637
  }
2638
2638
  highlightBrackets(e) {
2639
2639
  if (!this.editor || !this.hasCustomHighlightSupport) return;
2640
- const t = this.editor.getView(), i = t.createDomRangeFromRange(e.open), s = t.createDomRangeFromRange(e.close);
2641
- if (!(!i || !s))
2640
+ const t = this.editor.getView(), i = t.createDomRangeFromRange(e.open), n = t.createDomRangeFromRange(e.close);
2641
+ if (!(!i || !n))
2642
2642
  try {
2643
- const n = CSS, r = window.Highlight;
2644
- if (!n.highlights || !r) return;
2645
- n.highlights.set(this.highlightName, new r(i, s));
2646
- } catch (n) {
2643
+ const s = CSS, r = window.Highlight;
2644
+ if (!s.highlights || !r) return;
2645
+ s.highlights.set(this.highlightName, new r(i, n));
2646
+ } catch (s) {
2647
2647
  }
2648
2648
  }
2649
2649
  clearBracketHighlighting() {
@@ -2655,7 +2655,7 @@ class le {
2655
2655
  }
2656
2656
  }
2657
2657
  observeContentMutations() {
2658
- if (!this.editor || typeof MutationObserver > "u") return;
2658
+ if (!this.editor || typeof MutationObserver == "undefined") return;
2659
2659
  const e = this.editor.getView().getContentElement();
2660
2660
  this.observer = new MutationObserver(() => {
2661
2661
  this.clearBracketHighlighting(), this.scheduleBracketUpdate();
@@ -2667,7 +2667,7 @@ class le {
2667
2667
  }
2668
2668
  detectCustomHighlightSupport() {
2669
2669
  try {
2670
- if (typeof CSS > "u" || typeof window > "u")
2670
+ if (typeof CSS == "undefined" || typeof window == "undefined")
2671
2671
  return !1;
2672
2672
  const e = CSS, t = window.Highlight;
2673
2673
  return !!e.highlights && !!t;
@@ -2676,7 +2676,7 @@ class le {
2676
2676
  }
2677
2677
  }
2678
2678
  ensureHighlightStyles() {
2679
- if (typeof document > "u" || document.getElementById(this.highlightStyleId)) return;
2679
+ if (typeof document == "undefined" || document.getElementById(this.highlightStyleId)) return;
2680
2680
  const e = document.createElement("style");
2681
2681
  e.id = this.highlightStyleId, e.textContent = `
2682
2682
  ::highlight(${this.highlightName}) {
@@ -2690,14 +2690,14 @@ class le {
2690
2690
  }
2691
2691
  destroy() {
2692
2692
  var e;
2693
- if (this.pendingUpdateRaf !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(this.pendingUpdateRaf), this.pendingUpdateRaf = null), this.clearBracketHighlighting(), (e = this.observer) == null || e.disconnect(), this.observer = null, this.editor && this.cursorHandler && this.editor.off("cursor", this.cursorHandler), this.editor && this.changeHandler && this.editor.off("change", this.changeHandler), typeof document < "u") {
2693
+ if (this.pendingUpdateRaf !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(this.pendingUpdateRaf), this.pendingUpdateRaf = null), this.clearBracketHighlighting(), (e = this.observer) == null || e.disconnect(), this.observer = null, this.editor && this.cursorHandler && this.editor.off("cursor", this.cursorHandler), this.editor && this.changeHandler && this.editor.off("change", this.changeHandler), typeof document != "undefined") {
2694
2694
  const t = document.getElementById(this.highlightStyleId);
2695
2695
  t != null && t.parentNode && t.parentNode.removeChild(t);
2696
2696
  }
2697
2697
  this.cursorHandler = null, this.changeHandler = null, this.editor = null;
2698
2698
  }
2699
2699
  }
2700
- class ae {
2700
+ class re {
2701
2701
  constructor() {
2702
2702
  this.name = "code-folding", this.lineHeight = 21, this.voidMarkupTags = /* @__PURE__ */ new Set([
2703
2703
  "area",
@@ -2797,14 +2797,14 @@ class ae {
2797
2797
  const e = this.editor.getValue(), t = this.getActiveFolds().map((r) => this.getFoldKey(r)).join("|"), i = `${e}::${t}`;
2798
2798
  if (i === this.lastSnapshot) return;
2799
2799
  this.lastSnapshot = i, this.foldingUI.innerHTML = "";
2800
- const s = this.getRenderableActiveFolds(), n = document.createDocumentFragment();
2800
+ const n = this.getRenderableActiveFolds(), s = document.createDocumentFragment();
2801
2801
  for (const r of this.foldRegions) {
2802
- const o = this.toDisplayLine(r, s);
2802
+ const o = this.toDisplayLine(r, n);
2803
2803
  if (o === null) continue;
2804
2804
  const l = this.isFoldActive(r), a = this.createFoldIndicator(r, o, l);
2805
- n.appendChild(a);
2805
+ s.appendChild(a);
2806
2806
  }
2807
- this.foldingUI.appendChild(n);
2807
+ this.foldingUI.appendChild(s);
2808
2808
  }
2809
2809
  buildFoldRegions(e) {
2810
2810
  const t = this.buildBracketFoldRegions(e), i = this.shouldIncludeMarkupFolds(e) ? this.buildMarkupFoldRegions(e) : [];
@@ -2813,7 +2813,7 @@ class ae {
2813
2813
  buildBracketFoldRegions(e) {
2814
2814
  var o;
2815
2815
  const t = e.split(`
2816
- `), i = [], s = [], n = {
2816
+ `), i = [], n = [], s = {
2817
2817
  "{": "}",
2818
2818
  "[": "]",
2819
2819
  "(": ")"
@@ -2825,38 +2825,38 @@ class ae {
2825
2825
  for (let l = 0; l < t.length; l++) {
2826
2826
  const a = t[l];
2827
2827
  for (let h = 0; h < a.length; h++) {
2828
- const d = a[h];
2829
- if (n[d]) {
2830
- i.push({ char: d, line: l, column: h });
2828
+ const c = a[h];
2829
+ if (s[c]) {
2830
+ i.push({ char: c, line: l, column: h });
2831
2831
  continue;
2832
2832
  }
2833
- const c = r[d];
2834
- if (!c) continue;
2835
- let u = -1;
2833
+ const g = r[c];
2834
+ if (!g) continue;
2835
+ let f = -1;
2836
2836
  for (let m = i.length - 1; m >= 0; m--)
2837
- if (i[m].char === c) {
2838
- u = m;
2837
+ if (i[m].char === g) {
2838
+ f = m;
2839
2839
  break;
2840
2840
  }
2841
- if (u === -1) continue;
2842
- const g = i.splice(u, 1)[0];
2843
- if (g.line >= l) continue;
2844
- const f = ((o = t[g.line]) == null ? void 0 : o.length) || 0, p = {
2845
- start: { line: g.line, column: f },
2841
+ if (f === -1) continue;
2842
+ const d = i.splice(f, 1)[0];
2843
+ if (d.line >= l) continue;
2844
+ const u = ((o = t[d.line]) == null ? void 0 : o.length) || 0, p = {
2845
+ start: { line: d.line, column: u },
2846
2846
  end: { line: l, column: 0 },
2847
2847
  collapsed: !1,
2848
- level: u
2848
+ level: f
2849
2849
  };
2850
- this.isValidFoldRegion(p) && s.push(p);
2850
+ this.isValidFoldRegion(p) && n.push(p);
2851
2851
  }
2852
2852
  }
2853
- return s.sort((l, a) => l.start.line !== a.start.line ? l.start.line - a.start.line : l.end.line !== a.end.line ? l.end.line - a.end.line : l.start.column - a.start.column), s;
2853
+ return n.sort((l, a) => l.start.line !== a.start.line ? l.start.line - a.start.line : l.end.line !== a.end.line ? l.end.line - a.end.line : l.start.column - a.start.column), n;
2854
2854
  }
2855
2855
  shouldIncludeMarkupFolds(e) {
2856
2856
  return /<!DOCTYPE\b/i.test(e) || /<[A-Za-z][\w:-]*(?:\s|>)/.test(e) && /<\/[A-Za-z][\w:-]*\s*>/.test(e);
2857
2857
  }
2858
2858
  buildMarkupFoldRegions(e) {
2859
- const { lineStarts: t, lines: i } = this.buildLineStarts(e), s = [], n = [];
2859
+ const { lineStarts: t, lines: i } = this.buildLineStarts(e), n = [], s = [];
2860
2860
  let r = 0;
2861
2861
  for (; r < e.length; ) {
2862
2862
  if (e[r] !== "<") {
@@ -2879,15 +2879,15 @@ class ae {
2879
2879
  continue;
2880
2880
  }
2881
2881
  if (r = o.endOffset, o.isClosing) {
2882
- const l = n.findIndex((d) => d.name === o.name);
2882
+ const l = s.findIndex((c) => c.name === o.name);
2883
2883
  if (l === -1)
2884
2884
  continue;
2885
- const a = n.splice(l, 1)[0], h = this.createMarkupFoldRegion(
2885
+ const a = s.splice(l, 1)[0], h = this.createMarkupFoldRegion(
2886
2886
  a.openEndLine,
2887
2887
  o.startLine,
2888
2888
  i
2889
2889
  );
2890
- h && s.push(h);
2890
+ h && n.push(h);
2891
2891
  continue;
2892
2892
  }
2893
2893
  if (!(o.isSelfClosing || this.voidMarkupTags.has(o.name))) {
@@ -2905,25 +2905,25 @@ class ae {
2905
2905
  l.startLine,
2906
2906
  i
2907
2907
  );
2908
- a && s.push(a), r = l.endOffset;
2908
+ a && n.push(a), r = l.endOffset;
2909
2909
  }
2910
2910
  continue;
2911
2911
  }
2912
- this.nonFoldableInlineMarkupTags.has(o.name) || n.unshift({
2912
+ this.nonFoldableInlineMarkupTags.has(o.name) || s.unshift({
2913
2913
  name: o.name,
2914
2914
  openEndLine: o.endLine
2915
2915
  });
2916
2916
  }
2917
2917
  }
2918
- return s;
2918
+ return n;
2919
2919
  }
2920
- parseMarkupTag(e, t, i, s) {
2920
+ parseMarkupTag(e, t, i, n) {
2921
2921
  if (e[t] !== "<")
2922
2922
  return null;
2923
- const n = e[t + 1];
2924
- if (!n || n !== "/" && !/[A-Za-z]/.test(n))
2923
+ const s = e[t + 1];
2924
+ if (!s || s !== "/" && !/[A-Za-z]/.test(s))
2925
2925
  return null;
2926
- const r = n === "/";
2926
+ const r = s === "/";
2927
2927
  let o = t + (r ? 2 : 1);
2928
2928
  const l = o;
2929
2929
  for (; o < e.length && /[A-Za-z0-9:-]/.test(e[o]); )
@@ -2933,39 +2933,39 @@ class ae {
2933
2933
  return null;
2934
2934
  let h = null;
2935
2935
  for (; o < e.length; ) {
2936
- const f = e[o];
2936
+ const u = e[o];
2937
2937
  if (h) {
2938
- f === h && (h = null), o += 1;
2938
+ u === h && (h = null), o += 1;
2939
2939
  continue;
2940
2940
  }
2941
- if (f === '"' || f === "'") {
2942
- h = f, o += 1;
2941
+ if (u === '"' || u === "'") {
2942
+ h = u, o += 1;
2943
2943
  continue;
2944
2944
  }
2945
- if (f === ">")
2945
+ if (u === ">")
2946
2946
  break;
2947
2947
  o += 1;
2948
2948
  }
2949
2949
  if (o >= e.length || e[o] !== ">")
2950
2950
  return null;
2951
- const d = e.slice(l, a).toLowerCase();
2952
- if (!d)
2951
+ const c = e.slice(l, a).toLowerCase();
2952
+ if (!c)
2953
2953
  return null;
2954
- const c = e.slice(t, o + 1), u = this.offsetToLine(t, i, s), g = this.offsetToLine(o, i, s);
2954
+ const g = e.slice(t, o + 1), f = this.offsetToLine(t, i, n), d = this.offsetToLine(o, i, n);
2955
2955
  return {
2956
- name: d,
2956
+ name: c,
2957
2957
  isClosing: r,
2958
- isSelfClosing: !r && /\/\s*>$/.test(c),
2959
- startLine: u,
2960
- endLine: g,
2958
+ isSelfClosing: !r && /\/\s*>$/.test(g),
2959
+ startLine: f,
2960
+ endLine: d,
2961
2961
  endOffset: o + 1
2962
2962
  };
2963
2963
  }
2964
- findClosingMarkupTag(e, t, i, s, n) {
2964
+ findClosingMarkupTag(e, t, i, n, s) {
2965
2965
  const r = `</${i}`, o = e.toLowerCase();
2966
2966
  let l = o.indexOf(r, t);
2967
2967
  for (; l !== -1; ) {
2968
- const a = this.parseMarkupTag(e, l, s, n);
2968
+ const a = this.parseMarkupTag(e, l, n, s);
2969
2969
  if (a && a.isClosing && a.name === i)
2970
2970
  return {
2971
2971
  startLine: a.startLine,
@@ -2979,13 +2979,13 @@ class ae {
2979
2979
  var o;
2980
2980
  if (e >= t)
2981
2981
  return null;
2982
- const s = Math.max(0, Math.min(e, i.length - 1)), n = Math.max(0, Math.min(t, i.length - 1)), r = {
2982
+ const n = Math.max(0, Math.min(e, i.length - 1)), s = Math.max(0, Math.min(t, i.length - 1)), r = {
2983
2983
  start: {
2984
- line: s,
2985
- column: ((o = i[s]) == null ? void 0 : o.length) || 0
2984
+ line: n,
2985
+ column: ((o = i[n]) == null ? void 0 : o.length) || 0
2986
2986
  },
2987
2987
  end: {
2988
- line: n,
2988
+ line: s,
2989
2989
  column: 0
2990
2990
  },
2991
2991
  collapsed: !1,
@@ -2997,11 +2997,11 @@ class ae {
2997
2997
  const t = /* @__PURE__ */ new Map();
2998
2998
  for (const i of e)
2999
2999
  this.isValidFoldRegion(i) && t.set(this.getFoldKey(i), i);
3000
- return [...t.values()].sort((i, s) => i.start.line !== s.start.line ? i.start.line - s.start.line : i.end.line !== s.end.line ? i.end.line - s.end.line : i.start.column - s.start.column);
3000
+ return [...t.values()].sort((i, n) => i.start.line !== n.start.line ? i.start.line - n.start.line : i.end.line !== n.end.line ? i.end.line - n.end.line : i.start.column - n.start.column);
3001
3001
  }
3002
3002
  createFoldIndicator(e, t, i) {
3003
- const s = document.createElement("button");
3004
- return s.type = "button", s.style.cssText = `
3003
+ const n = document.createElement("button");
3004
+ return n.type = "button", n.style.cssText = `
3005
3005
  position: absolute;
3006
3006
  left: 0;
3007
3007
  top: ${t * this.lineHeight}px;
@@ -3018,11 +3018,11 @@ class ae {
3018
3018
  padding: 0;
3019
3019
  font-size: 10px;
3020
3020
  user-select: none;
3021
- `, s.textContent = i ? "▶" : "▼", s.title = i ? "Expand folded region" : "Collapse region", s.setAttribute("aria-label", s.title), s.addEventListener("mousedown", (n) => {
3022
- n.preventDefault();
3023
- }), s.addEventListener("click", (n) => {
3024
- n.preventDefault(), n.stopPropagation(), this.toggleFold(e);
3025
- }), s;
3021
+ `, n.textContent = i ? "▶" : "▼", n.title = i ? "Expand folded region" : "Collapse region", n.setAttribute("aria-label", n.title), n.addEventListener("mousedown", (s) => {
3022
+ s.preventDefault();
3023
+ }), n.addEventListener("click", (s) => {
3024
+ s.preventDefault(), s.stopPropagation(), this.toggleFold(e);
3025
+ }), n;
3026
3026
  }
3027
3027
  toggleFold(e) {
3028
3028
  this.editor && (this.isFoldActive(e) ? this.editor.unfold(e) : this.editor.fold(e), this.syncFoldingStatePreservingScroll());
@@ -3057,14 +3057,14 @@ class ae {
3057
3057
  });
3058
3058
  }
3059
3059
  withPreservedScroll(e) {
3060
- var n;
3061
- const t = (n = this.editor) == null ? void 0 : n.getView().getScrollElement();
3060
+ var s;
3061
+ const t = (s = this.editor) == null ? void 0 : s.getView().getScrollElement();
3062
3062
  if (!t) {
3063
3063
  e();
3064
3064
  return;
3065
3065
  }
3066
- const i = t.scrollLeft, s = t.scrollTop;
3067
- e(), this.restoreScrollPosition(t, i, s);
3066
+ const i = t.scrollLeft, n = t.scrollTop;
3067
+ e(), this.restoreScrollPosition(t, i, n);
3068
3068
  }
3069
3069
  restoreScrollPosition(e, t, i) {
3070
3070
  e.scrollLeft = t, e.scrollTop = i, requestAnimationFrame(() => {
@@ -3098,39 +3098,39 @@ class ae {
3098
3098
  this.editor.getView().setText(e);
3099
3099
  }
3100
3100
  buildFoldedProjection(e, t) {
3101
- const { lineStarts: i, lines: s } = this.buildLineStarts(e), n = [...t].sort((h, d) => this.comparePositions(h.start, d.start));
3101
+ const { lineStarts: i, lines: n } = this.buildLineStarts(e), s = [...t].sort((h, c) => this.comparePositions(h.start, c.start));
3102
3102
  let r = "";
3103
3103
  const o = [];
3104
3104
  let l = 0;
3105
- for (const h of n) {
3106
- const d = this.positionToOffset(h.start, i, s), c = this.positionToOffset(h.end, i, s), u = e.slice(l, d), g = this.getFoldPlaceholder(h), f = e.slice(d, c);
3107
- r += u, r += g, u && o.push({ type: "text", text: u }), o.push({
3105
+ for (const h of s) {
3106
+ const c = this.positionToOffset(h.start, i, n), g = this.positionToOffset(h.end, i, n), f = e.slice(l, c), d = this.getFoldPlaceholder(h), u = e.slice(c, g);
3107
+ r += f, r += d, f && o.push({ type: "text", text: f }), o.push({
3108
3108
  type: "placeholder",
3109
- text: g,
3109
+ text: d,
3110
3110
  fold: h,
3111
- hiddenText: f
3112
- }), l = c;
3111
+ hiddenText: u
3112
+ }), l = g;
3113
3113
  }
3114
3114
  const a = e.slice(l);
3115
3115
  return r += a, a && o.push({ type: "text", text: a }), { text: r, segments: o };
3116
3116
  }
3117
3117
  renderFoldPlaceholders(e) {
3118
3118
  if (!this.editor) return;
3119
- const t = this.editor.getView().getContentElement(), i = /* @__PURE__ */ new Map(), s = document.createDocumentFragment();
3120
- for (const n of e.segments) {
3121
- if (n.type === "text") {
3122
- s.appendChild(document.createTextNode(n.text));
3119
+ const t = this.editor.getView().getContentElement(), i = /* @__PURE__ */ new Map(), n = document.createDocumentFragment();
3120
+ for (const s of e.segments) {
3121
+ if (s.type === "text") {
3122
+ n.appendChild(document.createTextNode(s.text));
3123
3123
  continue;
3124
3124
  }
3125
- const r = document.createElement("span"), o = this.getFoldKey(n.fold);
3126
- r.setAttribute("data-lce-fold-placeholder", o), r.setAttribute("aria-label", "Folded region"), r.contentEditable = "false", i.set(o, n.hiddenText), r.style.cssText = `
3125
+ const r = document.createElement("span"), o = this.getFoldKey(s.fold);
3126
+ r.setAttribute("data-lce-fold-placeholder", o), r.setAttribute("aria-label", "Folded region"), r.contentEditable = "false", i.set(o, s.hiddenText), r.style.cssText = `
3127
3127
  cursor: text;
3128
3128
  user-select: text;
3129
3129
  pointer-events: auto;
3130
3130
  white-space: pre;
3131
- `, r.textContent = n.text, s.appendChild(r);
3131
+ `, r.textContent = s.text, n.appendChild(r);
3132
3132
  }
3133
- t.replaceChildren(s), t.__lceFoldPlaceholderSources = i, this.editor.getView().syncTrailingNewlineMarkerForText(e.text);
3133
+ t.replaceChildren(n), t.__lceFoldPlaceholderSources = i, this.editor.getView().syncTrailingNewlineMarkerForText(e.text);
3134
3134
  }
3135
3135
  getFoldPlaceholder(e) {
3136
3136
  const t = Math.max(1, e.end.line - e.start.line);
@@ -3138,7 +3138,7 @@ class ae {
3138
3138
  }
3139
3139
  pruneInvalidFolds(e, t) {
3140
3140
  if (!this.editor) return;
3141
- const i = this.editor.getFolds().filter((a) => a.collapsed !== !1), s = new Set(i.map((a) => this.getFoldKey(a))), n = [], r = /* @__PURE__ */ new Set(), o = this.getLineInfo(e);
3141
+ const i = this.editor.getFolds().filter((a) => a.collapsed !== !1), n = new Set(i.map((a) => this.getFoldKey(a))), s = [], r = /* @__PURE__ */ new Set(), o = this.getLineInfo(e);
3142
3142
  for (const a of i) {
3143
3143
  const h = this.findReplacementFold(
3144
3144
  a,
@@ -3149,14 +3149,14 @@ class ae {
3149
3149
  );
3150
3150
  if (!h)
3151
3151
  continue;
3152
- const d = this.getFoldKey(h);
3153
- n.push(h), r.add(d);
3152
+ const c = this.getFoldKey(h);
3153
+ s.push(h), r.add(c);
3154
3154
  }
3155
- const l = new Set(n.map((a) => this.getFoldKey(a)));
3155
+ const l = new Set(s.map((a) => this.getFoldKey(a)));
3156
3156
  for (const a of i)
3157
3157
  l.has(this.getFoldKey(a)) || this.editor.unfold(a);
3158
- for (const a of n)
3159
- s.has(this.getFoldKey(a)) || this.editor.fold(a);
3158
+ for (const a of s)
3159
+ n.has(this.getFoldKey(a)) || this.editor.fold(a);
3160
3160
  }
3161
3161
  getActiveFolds() {
3162
3162
  return this.editor ? this.editor.getFolds().filter((e) => e.collapsed !== !1) : [];
@@ -3168,80 +3168,80 @@ class ae {
3168
3168
  return this.getTopLevelFoldRegions(this.getActiveFolds());
3169
3169
  }
3170
3170
  getTopLevelFoldRegions(e) {
3171
- const t = [...e].sort((s, n) => this.comparePositions(s.start, n.start)), i = [];
3172
- for (const s of t) {
3173
- const n = i[i.length - 1];
3174
- n && this.containsRange(n, s) || i.push(s);
3171
+ const t = [...e].sort((n, s) => this.comparePositions(n.start, s.start)), i = [];
3172
+ for (const n of t) {
3173
+ const s = i[i.length - 1];
3174
+ s && this.containsRange(s, n) || i.push(n);
3175
3175
  }
3176
3176
  return i;
3177
3177
  }
3178
3178
  toDisplayLine(e, t) {
3179
3179
  let i = 0;
3180
- for (const s of t) {
3181
- if (this.isSameRange(s, e))
3180
+ for (const n of t) {
3181
+ if (this.isSameRange(n, e))
3182
3182
  break;
3183
- if (this.containsRange(s, e))
3183
+ if (this.containsRange(n, e))
3184
3184
  return null;
3185
- s.end.line <= e.start.line && (i += s.end.line - s.start.line);
3185
+ n.end.line <= e.start.line && (i += n.end.line - n.start.line);
3186
3186
  }
3187
3187
  return e.start.line - i;
3188
3188
  }
3189
3189
  findBestRegionForLine(e, t) {
3190
- const i = (t ? this.getActiveFolds() : this.foldRegions).filter(
3190
+ const n = (t ? this.getActiveFolds() : this.foldRegions).filter(
3191
3191
  (s) => s.start.line <= e && s.end.line >= e
3192
3192
  );
3193
- return i.length === 0 ? null : (i.sort((s, n) => {
3194
- const r = s.end.line - s.start.line, o = n.end.line - n.start.line;
3195
- return r !== o ? r - o : this.comparePositions(s.start, n.start);
3196
- }), i[0]);
3193
+ return n.length === 0 ? null : (n.sort((s, r) => {
3194
+ const o = s.end.line - s.start.line, l = r.end.line - r.start.line;
3195
+ return o !== l ? o - l : this.comparePositions(s.start, r.start);
3196
+ }), n[0]);
3197
3197
  }
3198
- findReplacementFold(e, t, i, s, n) {
3198
+ findReplacementFold(e, t, i, n, s) {
3199
3199
  const r = this.getFoldKey(e), o = this.foldRegions.find(
3200
- (c) => this.getFoldKey(c) === r && !i.has(r)
3200
+ (d) => this.getFoldKey(d) === r && !i.has(r)
3201
3201
  );
3202
3202
  if (o)
3203
3203
  return o;
3204
- const l = e.end.line - e.start.line, a = t != null ? t : this.createFoldSnapshot(e, s, n), h = this.foldRegions.filter((c) => !i.has(this.getFoldKey(c))).map((c) => {
3205
- const u = this.createFoldSnapshot(c, s, n), g = a && (u == null ? void 0 : u.startLineText) === a.startLineText ? 1 : 0, f = a && (u == null ? void 0 : u.endLineText) === a.endLineText ? 1 : 0, p = a && (u == null ? void 0 : u.lineSpan) === a.lineSpan ? 1 : 0;
3204
+ const l = e.end.line - e.start.line, a = t != null ? t : this.createFoldSnapshot(e, n, s), c = this.foldRegions.filter((d) => !i.has(this.getFoldKey(d))).map((d) => {
3205
+ const u = this.createFoldSnapshot(d, n, s), p = a && (u == null ? void 0 : u.startLineText) === a.startLineText ? 1 : 0, m = a && (u == null ? void 0 : u.endLineText) === a.endLineText ? 1 : 0, x = a && (u == null ? void 0 : u.lineSpan) === a.lineSpan ? 1 : 0;
3206
3206
  return {
3207
- region: c,
3208
- overlaps: this.lineRangeOverlap(e, c),
3209
- lineDistance: Math.abs(c.start.line - e.start.line) + Math.abs(c.end.line - e.end.line),
3207
+ region: d,
3208
+ overlaps: this.lineRangeOverlap(e, d),
3209
+ lineDistance: Math.abs(d.start.line - e.start.line) + Math.abs(d.end.line - e.end.line),
3210
3210
  spanDistance: Math.abs(
3211
- c.end.line - c.start.line - l
3211
+ d.end.line - d.start.line - l
3212
3212
  ),
3213
- columnDistance: Math.abs(c.start.column - e.start.column) + Math.abs(c.end.column - e.end.column),
3213
+ columnDistance: Math.abs(d.start.column - e.start.column) + Math.abs(d.end.column - e.end.column),
3214
3214
  hiddenTextMatch: a && (u == null ? void 0 : u.hiddenText) === a.hiddenText ? 1 : 0,
3215
- boundaryMatchScore: g + f + p
3215
+ boundaryMatchScore: p + m + x
3216
3216
  };
3217
- }).sort((c, u) => c.hiddenTextMatch !== u.hiddenTextMatch ? u.hiddenTextMatch - c.hiddenTextMatch : c.boundaryMatchScore !== u.boundaryMatchScore ? u.boundaryMatchScore - c.boundaryMatchScore : c.overlaps !== u.overlaps ? u.overlaps - c.overlaps : c.lineDistance !== u.lineDistance ? c.lineDistance - u.lineDistance : c.spanDistance !== u.spanDistance ? c.spanDistance - u.spanDistance : c.columnDistance - u.columnDistance)[0];
3218
- if (!h)
3217
+ }).sort((d, u) => d.hiddenTextMatch !== u.hiddenTextMatch ? u.hiddenTextMatch - d.hiddenTextMatch : d.boundaryMatchScore !== u.boundaryMatchScore ? u.boundaryMatchScore - d.boundaryMatchScore : d.overlaps !== u.overlaps ? u.overlaps - d.overlaps : d.lineDistance !== u.lineDistance ? d.lineDistance - u.lineDistance : d.spanDistance !== u.spanDistance ? d.spanDistance - u.spanDistance : d.columnDistance - u.columnDistance)[0];
3218
+ if (!c)
3219
3219
  return null;
3220
- const d = h.lineDistance <= 2 && h.spanDistance <= 1;
3221
- return !(h.hiddenTextMatch === 1 || h.boundaryMatchScore >= 2) && !d ? null : h.region;
3220
+ const g = c.lineDistance <= 2 && c.spanDistance <= 1;
3221
+ return !(c.hiddenTextMatch === 1 || c.boundaryMatchScore >= 2) && !g ? null : c.region;
3222
3222
  }
3223
3223
  lineRangeOverlap(e, t) {
3224
- const i = Math.max(e.start.line, t.start.line), s = Math.min(e.end.line, t.end.line);
3225
- return Math.max(0, s - i);
3224
+ const i = Math.max(e.start.line, t.start.line), n = Math.min(e.end.line, t.end.line);
3225
+ return Math.max(0, n - i);
3226
3226
  }
3227
3227
  rememberActiveFoldSnapshots(e) {
3228
3228
  const t = /* @__PURE__ */ new Map(), i = this.getLineInfo(e);
3229
- for (const s of this.getActiveFolds()) {
3230
- const n = this.createFoldSnapshot(s, e, i);
3231
- n && t.set(this.getFoldKey(s), n);
3229
+ for (const n of this.getActiveFolds()) {
3230
+ const s = this.createFoldSnapshot(n, e, i);
3231
+ s && t.set(this.getFoldKey(n), s);
3232
3232
  }
3233
3233
  this.foldSnapshots = t;
3234
3234
  }
3235
3235
  createFoldSnapshot(e, t, i = this.getLineInfo(t)) {
3236
- var h, d;
3237
- const { lineStarts: s, lines: n } = i;
3238
- if (n.length === 0)
3236
+ var h, c;
3237
+ const { lineStarts: n, lines: s } = i;
3238
+ if (s.length === 0)
3239
3239
  return null;
3240
- const r = this.positionToOffset(e.start, s, n), o = this.positionToOffset(e.end, s, n), l = Math.max(0, Math.min(e.start.line, n.length - 1)), a = Math.max(0, Math.min(e.end.line, n.length - 1));
3240
+ const r = this.positionToOffset(e.start, n, s), o = this.positionToOffset(e.end, n, s), l = Math.max(0, Math.min(e.start.line, s.length - 1)), a = Math.max(0, Math.min(e.end.line, s.length - 1));
3241
3241
  return {
3242
3242
  hiddenText: t.slice(r, o),
3243
- startLineText: (h = n[l]) != null ? h : "",
3244
- endLineText: (d = n[a]) != null ? d : "",
3243
+ startLineText: (h = s[l]) != null ? h : "",
3244
+ endLineText: (c = s[a]) != null ? c : "",
3245
3245
  lineSpan: e.end.line - e.start.line
3246
3246
  };
3247
3247
  }
@@ -3251,22 +3251,22 @@ class ae {
3251
3251
  e();
3252
3252
  return;
3253
3253
  }
3254
- const t = this.editor.getView(), i = t.getContentElement(), s = document.activeElement === i, n = t.getSelectionOffsets(), r = n.isInEditor;
3254
+ const t = this.editor.getView(), i = t.getContentElement(), n = document.activeElement === i, s = t.getSelectionOffsets(), r = s.isInEditor;
3255
3255
  if (e(), !r)
3256
3256
  return;
3257
3257
  const o = this.remapSelectionOffsetsForVisibleDisplay(
3258
- (l = n.anchorOffset) != null ? l : n.startOffset,
3259
- (a = n.focusOffset) != null ? a : n.endOffset
3258
+ (l = s.anchorOffset) != null ? l : s.startOffset,
3259
+ (a = s.focusOffset) != null ? a : s.endOffset
3260
3260
  );
3261
3261
  t.setSelectionBoundaryOffsets(
3262
3262
  o.startOffset,
3263
3263
  o.endOffset
3264
- ), (s || n.isInEditor) && this.editor.focus();
3264
+ ), (n || s.isInEditor) && this.editor.focus();
3265
3265
  }
3266
3266
  remapSelectionOffsetsForVisibleDisplay(e, t) {
3267
3267
  if (!this.editor)
3268
3268
  return { startOffset: e, endOffset: t };
3269
- const i = this.editor.getValue(), { lineStarts: s, lines: n } = this.getLineInfo(i), r = this.getRenderableActiveFolds();
3269
+ const i = this.editor.getValue(), { lineStarts: n, lines: s } = this.getLineInfo(i), r = this.getRenderableActiveFolds();
3270
3270
  if (r.length === 0) {
3271
3271
  const o = i.length;
3272
3272
  return {
@@ -3278,36 +3278,36 @@ class ae {
3278
3278
  startOffset: this.remapOffsetToVisibleBoundary(
3279
3279
  e,
3280
3280
  r,
3281
- s,
3282
3281
  n,
3282
+ s,
3283
3283
  i.length
3284
3284
  ),
3285
3285
  endOffset: this.remapOffsetToVisibleBoundary(
3286
3286
  t,
3287
3287
  r,
3288
- s,
3289
3288
  n,
3289
+ s,
3290
3290
  i.length
3291
3291
  )
3292
3292
  };
3293
3293
  }
3294
- remapOffsetToVisibleBoundary(e, t, i, s, n) {
3295
- const r = Math.max(0, Math.min(e, n));
3294
+ remapOffsetToVisibleBoundary(e, t, i, n, s) {
3295
+ const r = Math.max(0, Math.min(e, s));
3296
3296
  for (const o of t) {
3297
- const l = this.positionToOffset(o.start, i, s), a = this.positionToOffset(o.end, i, s);
3297
+ const l = this.positionToOffset(o.start, i, n), a = this.positionToOffset(o.end, i, n);
3298
3298
  if (r <= l || r >= a)
3299
3299
  continue;
3300
- const h = r - l, d = a - r;
3301
- return h <= d ? l : a;
3300
+ const h = r - l, c = a - r;
3301
+ return h <= c ? l : a;
3302
3302
  }
3303
3303
  return r;
3304
3304
  }
3305
3305
  buildLineStarts(e) {
3306
3306
  const t = e.split(`
3307
3307
  `), i = new Array(t.length);
3308
- let s = 0;
3309
- for (let n = 0; n < t.length; n++)
3310
- i[n] = s, s += t[n].length + 1;
3308
+ let n = 0;
3309
+ for (let s = 0; s < t.length; s++)
3310
+ i[s] = n, n += t[s].length + 1;
3311
3311
  return { lineStarts: i, lines: t };
3312
3312
  }
3313
3313
  getLineInfo(e) {
@@ -3322,15 +3322,15 @@ class ae {
3322
3322
  }
3323
3323
  offsetToLine(e, t, i) {
3324
3324
  var l;
3325
- const s = t.length > 0 ? t[t.length - 1] + (((l = i[i.length - 1]) == null ? void 0 : l.length) || 0) : 0, n = Math.max(0, Math.min(e, s));
3325
+ const n = t.length > 0 ? t[t.length - 1] + (((l = i[i.length - 1]) == null ? void 0 : l.length) || 0) : 0, s = Math.max(0, Math.min(e, n));
3326
3326
  let r = 0, o = t.length - 1;
3327
3327
  for (; r <= o; ) {
3328
- const a = Math.floor((r + o) / 2), h = t[a], d = a + 1 < t.length ? t[a + 1] : Number.POSITIVE_INFINITY;
3329
- if (n < h) {
3328
+ const a = Math.floor((r + o) / 2), h = t[a], c = a + 1 < t.length ? t[a + 1] : Number.POSITIVE_INFINITY;
3329
+ if (s < h) {
3330
3330
  o = a - 1;
3331
3331
  continue;
3332
3332
  }
3333
- if (n >= d) {
3333
+ if (s >= c) {
3334
3334
  r = a + 1;
3335
3335
  continue;
3336
3336
  }
@@ -3340,8 +3340,8 @@ class ae {
3340
3340
  }
3341
3341
  positionToOffset(e, t, i) {
3342
3342
  var r;
3343
- const s = Math.max(0, Math.min(e.line, i.length - 1)), n = Math.max(0, Math.min(e.column, ((r = i[s]) == null ? void 0 : r.length) || 0));
3344
- return t[s] + n;
3343
+ const n = Math.max(0, Math.min(e.line, i.length - 1)), s = Math.max(0, Math.min(e.column, ((r = i[n]) == null ? void 0 : r.length) || 0));
3344
+ return t[n] + s;
3345
3345
  }
3346
3346
  comparePositions(e, t) {
3347
3347
  return e.line !== t.line ? e.line - t.line : e.column - t.column;
@@ -3365,7 +3365,7 @@ class ae {
3365
3365
  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;
3366
3366
  }
3367
3367
  }
3368
- class he {
3368
+ class oe {
3369
3369
  constructor() {
3370
3370
  this.name = "syntax-highlighting", this.editor = null, this.currentTheme = "dark", this.currentLanguage = null, this.modes = /* @__PURE__ */ new Map();
3371
3371
  }
@@ -3432,10 +3432,10 @@ class he {
3432
3432
  }
3433
3433
  // Public API: highlight a source string using the chosen mode (or detect html)
3434
3434
  highlight(e, t) {
3435
- const i = this.getSyntaxColors(), s = this.normalizeLanguageId(
3435
+ const i = this.getSyntaxColors(), n = this.normalizeLanguageId(
3436
3436
  t || this.currentLanguage || this.detectLanguage(e) || "html"
3437
3437
  );
3438
- return (this.modes.get(s) || this.modes.get("html")).highlight(e, i);
3438
+ return (this.modes.get(n) || this.modes.get("html")).highlight(e, i);
3439
3439
  }
3440
3440
  // Backwards-compatible method
3441
3441
  highlightHTML(e) {
@@ -3481,24 +3481,24 @@ class he {
3481
3481
  }[t] || t || "html";
3482
3482
  }
3483
3483
  restoreHighlightTokens(e, t) {
3484
- return e.replace(/\u0000([a-z]+)\u0000/g, (i, s) => {
3485
- let n = 0;
3486
- for (let r = 0; r < s.length; r++)
3487
- n = n * 26 + (s.charCodeAt(r) - 97 + 1);
3488
- return n = n - 1, t[n] || "";
3484
+ return e.replace(/\u0000([a-z]+)\u0000/g, (i, n) => {
3485
+ let s = 0;
3486
+ for (let r = 0; r < n.length; r++)
3487
+ s = s * 26 + (n.charCodeAt(r) - 97 + 1);
3488
+ return s = s - 1, t[s] || "";
3489
3489
  });
3490
3490
  }
3491
3491
  createTokenStore(e) {
3492
3492
  const t = (i) => {
3493
- let s = "", n = i;
3493
+ let n = "", s = i;
3494
3494
  do
3495
- s = String.fromCharCode(97 + n % 26) + s, n = Math.floor(n / 26) - 1;
3496
- while (n >= 0);
3497
- return s || "a";
3495
+ n = String.fromCharCode(97 + s % 26) + n, s = Math.floor(s / 26) - 1;
3496
+ while (s >= 0);
3497
+ return n || "a";
3498
3498
  };
3499
3499
  return (i) => {
3500
- const s = e.length;
3501
- return e.push(i), `\0${t(s)}\0`;
3500
+ const n = e.length;
3501
+ return e.push(i), `\0${t(n)}\0`;
3502
3502
  };
3503
3503
  }
3504
3504
  refreshEditorHighlight() {
@@ -3509,8 +3509,8 @@ class he {
3509
3509
  unescapeEntitiesRepeated(e) {
3510
3510
  let t = e || "";
3511
3511
  for (let i = 0; i < 5; i++) {
3512
- const s = t;
3513
- if (t = t.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'"), t === s) break;
3512
+ const n = t;
3513
+ if (t = t.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'"), t === n) break;
3514
3514
  }
3515
3515
  return t;
3516
3516
  }
@@ -3523,9 +3523,9 @@ class he {
3523
3523
  if (/^[\[{]/.test(t) && /[\]}]$/.test(t) || /"[^"]+"\s*:/.test(t))
3524
3524
  try {
3525
3525
  return JSON.parse(t), "json";
3526
- } catch (o) {
3526
+ } catch (a) {
3527
3527
  }
3528
- const i = /<\/?[A-Za-z][\w:-]*(?:\s|>|\/>)/.test(t), s = /^<!DOCTYPE\s+html\b/i.test(t) || /<\/?(html|head|body|meta|title|style|script)\b/i.test(t);
3528
+ const i = /<\/?[A-Za-z][\w:-]*(?:\s|>|\/>)/.test(t), n = /^<!DOCTYPE\s+html\b/i.test(t) || /<\/?(html|head|body|meta|title|style|script)\b/i.test(t);
3529
3529
  if ([
3530
3530
  /^---\s*\n[\s\S]*?\n---\s*(?:\n|$)/.test(t),
3531
3531
  /^#{1,6}\s+\S/m.test(t),
@@ -3540,13 +3540,13 @@ class he {
3540
3540
  /(^|\s)(?:\*\*|__)[^*_]+(?:\*\*|__)(?=\s|$|[.,;:!?])/m.test(t)
3541
3541
  ].filter(Boolean).length >= (i ? 2 : 1))
3542
3542
  return "markdown";
3543
- if (s)
3544
- return "html";
3545
- const n = this.detectProgrammingLanguage(t);
3546
3543
  if (n)
3547
- return n;
3548
- const r = /[{][\s\S]*[}]/.test(t) && /[A-Za-z_-][\w-]*\s*:\s*[^;{}]+;?/.test(t) && !/\b(function|const|let|var|return|class|interface|type)\b/.test(t);
3549
- return !i && r ? "css" : null;
3544
+ return "html";
3545
+ const o = this.detectProgrammingLanguage(t);
3546
+ if (o)
3547
+ return o;
3548
+ 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);
3549
+ return !i && l ? "css" : null;
3550
3550
  }
3551
3551
  detectProgrammingLanguage(e) {
3552
3552
  const t = {
@@ -3566,156 +3566,156 @@ class he {
3566
3566
  o.test(e) && (t[r] += l);
3567
3567
  };
3568
3568
  i("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), i("python", /^\s*[A-Za-z_]\w*\s*=\s*(?:\[|\{|\(|["']|\d)/m), i("python", /\b(True|False|None|self|elif|lambda|yield)\b/), i("go", /^\s*package\s+\w+/m, 3), i("go", /\bfunc\s+\w+\s*\(/, 2), i("go", /\b(import|defer|goroutine|chan|struct|interface)\b/), i("cpp", /^\s*#include\s*<[^>]+>/m, 2), i("cpp", /\b(std::|template\s*<|namespace\s+\w+|cout\s*<<|cin\s*>>)\b/, 2), i("cpp", /\b(class|public|private|protected|virtual|typename)\b/), i("c", /^\s*#include\s*[<"][^>"]+[>"]/m), i("c", /\b(int|char|float|double|void)\s+\w+\s*\(/), i("c", /\bprintf\s*\(/), i("java", /^\s*(package|import)\s+[\w.]+;/m, 2), i("java", /\b(public|private|protected)\s+(class|interface|enum)\s+\w+/, 2), i("java", /\bSystem\.out\.println\s*\(/), i("csharp", /^\s*using\s+[\w.]+;/m, 2), i("csharp", /\b(namespace|record|var|string|Console\.WriteLine)\b/), i("csharp", /\b(public|private|protected)\s+(class|interface|struct)\s+\w+/), i("rust", /\bfn\s+\w+\s*\(/, 2), i("rust", /\b(let\s+mut|impl\s+\w+|use\s+[\w:]+|println!\s*\()/), i("rust", /\b(crate|trait|enum|match|Some|None|Ok|Err)\b/), i("ruby", /^\s*(def|class|module)\s+\w+/m, 2), i("ruby", /\b(puts|require|attr_reader|elsif|end)\b/), i("sql", /^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|ALTER|DROP)\b/im, 3), i("sql", /\bFROM\s+\w+|\bWHERE\s+/i), i("yaml", /^---\s*$/m), i("yaml", /^\s*[A-Za-z0-9_.-]+\s*:\s+\S/m, 2), i("yaml", /^\s*-\s+[A-Za-z0-9_.-]+\s*:/m), i("dockerfile", /^\s*FROM\s+\S+/im, 3), i("dockerfile", /^\s*(RUN|COPY|ADD|CMD|ENTRYPOINT|WORKDIR|ENV|ARG)\b/im, 2), i("php", /^<\?(?:php\b|=)/i, 3), i("php", /^\?php\b/i, 3), i("php", /\$[A-Za-z_\x80-\xff][A-Za-z0-9_\x80-\xff]*\s*=/, 2), i("php", /\b(echo|foreach|function|namespace|use|PHP_EOL)\b/, 2);
3569
- const [s, n] = Object.entries(t).sort((r, o) => o[1] - r[1])[0] || ["", 0];
3570
- return n >= 2 ? s : null;
3569
+ const [n, s] = Object.entries(t).sort((r, o) => o[1] - r[1])[0] || ["", 0];
3570
+ return s >= 2 ? n : null;
3571
3571
  }
3572
3572
  _highlightHTML(e, t) {
3573
- const i = t, s = (c) => this.escapeHTML(c), n = [], r = this.createTokenStore(n), o = [], l = (c) => {
3574
- const u = o.length;
3575
- return o.push(c), `ht${u}`;
3573
+ const i = t, n = (g) => this.escapeHTML(g), s = [], r = this.createTokenStore(s), o = [], l = (g) => {
3574
+ const f = o.length;
3575
+ return o.push(g), `ht${f}`;
3576
3576
  };
3577
- let a = s(e);
3577
+ let a = n(e);
3578
3578
  a = a.replace(
3579
3579
  /&lt;\/?(?:(?!&gt;)[^\n\r<])*?(?=$|[\n\r])/g,
3580
- (c) => l(c)
3580
+ (g) => l(g)
3581
3581
  );
3582
3582
  const h = [];
3583
3583
  try {
3584
- e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi, (c, u, g) => (h.push({ attrs: String(u || ""), inner: String(g || "") }), c));
3585
- } catch (c) {
3584
+ e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi, (g, f, d) => (h.push({ attrs: String(f || ""), inner: String(d || "") }), g));
3585
+ } catch (g) {
3586
3586
  }
3587
- let d = 0;
3588
- return a = a.replace(/(&lt;script\b([^&>]*)&gt;)([\s\S]*?)(&lt;\/script&gt;)/gi, (c, u, g, f, p) => {
3589
- var v, T, w;
3590
- const m = (T = (v = h[d++]) == null ? void 0 : v.inner) != null ? T : this.unescapeEntitiesRepeated(f || "");
3591
- (((w = h[d - 1]) == null ? void 0 : w.attrs) || g || "").toLowerCase();
3587
+ let c = 0;
3588
+ return a = a.replace(/(&lt;script\b([^&>]*)&gt;)([\s\S]*?)(&lt;\/script&gt;)/gi, (g, f, d, u, p) => {
3589
+ var v, T, S;
3590
+ const m = (T = (v = h[c++]) == null ? void 0 : v.inner) != null ? T : this.unescapeEntitiesRepeated(u || "");
3591
+ (((S = h[c - 1]) == null ? void 0 : S.attrs) || d || "").toLowerCase();
3592
3592
  const x = this._highlightJS(m, i);
3593
- return `${u}${x}${p}`;
3594
- }), a = a.replace(/(&lt;style\b[^&]*&gt;)([\s\S]*?)(&lt;\/style&gt;)/gi, (c, u, g, f) => {
3595
- const p = this._highlightCSS(this.unescapeEntitiesRepeated(g), i);
3596
- return `${u}${p}${f}`;
3593
+ return `${f}${x}${p}`;
3594
+ }), a = a.replace(/(&lt;style\b[^&]*&gt;)([\s\S]*?)(&lt;\/style&gt;)/gi, (g, f, d, u) => {
3595
+ const p = this._highlightCSS(this.unescapeEntitiesRepeated(d), i);
3596
+ return `${f}${p}${u}`;
3597
3597
  }), a = a.replace(
3598
3598
  /(&lt;!--[\s\S]*?--&gt;)/g,
3599
- (c) => r(`<span style="color: ${i.comment};">${c}</span>`)
3599
+ (g) => r(`<span style="color: ${i.comment};">${g}</span>`)
3600
3600
  ), a = a.replace(
3601
3601
  /(&lt;!DOCTYPE[\s\S]*?&gt;)/i,
3602
- (c) => r(`<span style="color: ${i.doctype};">${c}</span>`)
3603
- ), a = a.replace(/(&lt;\/?\s*)([^\s&>\/]+)([^<]*?)(\/?&gt;)/g, (c, u, g, f, p) => {
3604
- const m = `<span style="color: ${i.tag};">${g}</span>`;
3605
- let x = f;
3602
+ (g) => r(`<span style="color: ${i.doctype};">${g}</span>`)
3603
+ ), a = a.replace(/(&lt;\/?\s*)([^\s&>\/]+)([^<]*?)(\/?&gt;)/g, (g, f, d, u, p) => {
3604
+ const m = `<span style="color: ${i.tag};">${d}</span>`;
3605
+ let x = u;
3606
3606
  return x = x.replace(
3607
3607
  /([\w:-]+)(\s*=\s*)((&quot;[\s\S]*?&quot;|&#39;[\s\S]*?&#39;|[^\s&>]+))/g,
3608
- (v, T, w, S) => {
3609
- const L = String(T).toLowerCase(), I = `<span style="color: ${i.attrName};">${T}</span>`;
3610
- let $ = S, C = "";
3611
- S.startsWith("&quot;") && S.endsWith("&quot;") ? ($ = S.slice(6, -6), C = "&quot;") : S.startsWith("&#39;") && S.endsWith("&#39;") && ($ = S.slice(5, -5), C = "&#39;");
3612
- let M = S;
3613
- if (L === "style") {
3614
- const D = $.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, (F, k, A, H) => `<span style="color: ${i.styleProp};">${k}</span>:<span style="color: ${i.styleVal};">${A}</span>${H}`);
3615
- C ? M = `${C}${D}${C}` : M = D, M = `<span style="color: ${i.attrValue};">${M}</span>`;
3608
+ (v, T, S, w) => {
3609
+ const O = String(T).toLowerCase(), $ = `<span style="color: ${i.attrName};">${T}</span>`;
3610
+ let I = w, C = "";
3611
+ w.startsWith("&quot;") && w.endsWith("&quot;") ? (I = w.slice(6, -6), C = "&quot;") : w.startsWith("&#39;") && w.endsWith("&#39;") && (I = w.slice(5, -5), C = "&#39;");
3612
+ let M = w;
3613
+ if (O === "style") {
3614
+ const N = I.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, (A, R, P, H) => `<span style="color: ${i.styleProp};">${R}</span>:<span style="color: ${i.styleVal};">${P}</span>${H}`);
3615
+ C ? M = `${C}${N}${C}` : M = N, M = `<span style="color: ${i.attrValue};">${M}</span>`;
3616
3616
  } else
3617
- C && (M = `${C}${$}${C}`), M = `<span style="color: ${i.attrValue};">${M}</span>`;
3618
- return `${I}${w}${M}`;
3617
+ C && (M = `${C}${I}${C}`), M = `<span style="color: ${i.attrValue};">${M}</span>`;
3618
+ return `${$}${S}${M}`;
3619
3619
  }
3620
- ), `${u}${m}${x}${p}`;
3621
- }), a = a.replace(/\u0002ht(\d+)\u0002/g, (c, u) => o[Number(u)] || ""), this.restoreHighlightTokens(a, n);
3620
+ ), `${f}${m}${x}${p}`;
3621
+ }), a = a.replace(/\u0002ht(\d+)\u0002/g, (g, f) => o[Number(f)] || ""), this.restoreHighlightTokens(a, s);
3622
3622
  }
3623
3623
  _highlightCSS(e, t) {
3624
- const i = this.unescapeEntitiesRepeated(e), s = [], n = this.createTokenStore(s), r = /(\/\*[\s\S]*?\*\/)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
3624
+ const i = this.unescapeEntitiesRepeated(e), n = [], s = this.createTokenStore(n), r = /(\/\*[\s\S]*?\*\/)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
3625
3625
  let o = 0, l = "", a;
3626
3626
  for (; a = r.exec(i); ) {
3627
3627
  o < a.index && (l += this.escapeHTML(i.slice(o, a.index)));
3628
- const h = a[0], d = h.startsWith("/*") ? t.comment : t.string;
3629
- l += n(`<span style="color: ${d};">${this.escapeHTML(h)}</span>`), o = r.lastIndex;
3628
+ const h = a[0], c = h.startsWith("/*") ? t.comment : t.string;
3629
+ l += s(`<span style="color: ${c};">${this.escapeHTML(h)}</span>`), o = r.lastIndex;
3630
3630
  }
3631
3631
  return o < i.length && (l += this.escapeHTML(i.slice(o))), l = l.replace(
3632
3632
  /(@[\w-]+)/g,
3633
- (h) => n(`<span style="color: ${t.keyword};">${h}</span>`)
3633
+ (h) => s(`<span style="color: ${t.keyword};">${h}</span>`)
3634
3634
  ), l = l.replace(
3635
3635
  /([A-Za-z_-][\w-]*)(\s*:)/g,
3636
- (h, d, c) => `${n(`<span style="color: ${t.styleProp};">${d}</span>`)}${c}`
3636
+ (h, c, g) => `${s(`<span style="color: ${t.styleProp};">${c}</span>`)}${g}`
3637
3637
  ), l = l.replace(
3638
3638
  /(#(?:[0-9a-fA-F]{3,8})\b)/g,
3639
- (h) => n(`<span style="color: ${t.number};">${h}</span>`)
3639
+ (h) => s(`<span style="color: ${t.number};">${h}</span>`)
3640
3640
  ), l = l.replace(
3641
3641
  /\b(-?\d*\.?\d+(?:px|em|rem|vh|vw|vmin|vmax|%|s|ms|deg|turn|fr)?)\b/g,
3642
- (h) => n(`<span style="color: ${t.number};">${h}</span>`)
3642
+ (h) => s(`<span style="color: ${t.number};">${h}</span>`)
3643
3643
  ), l = l.replace(
3644
3644
  /\b(important|inherit|initial|unset|revert|auto|none|block|inline|flex|grid|absolute|relative|fixed|sticky)\b/g,
3645
- (h) => n(`<span style="color: ${t.styleVal};">${h}</span>`)
3646
- ), this.restoreHighlightTokens(l, s);
3645
+ (h) => s(`<span style="color: ${t.styleVal};">${h}</span>`)
3646
+ ), this.restoreHighlightTokens(l, n);
3647
3647
  }
3648
3648
  _highlightJSON(e, t) {
3649
- const i = this.unescapeEntitiesRepeated(e), s = /("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}\[\],:]/g;
3650
- let n = 0, r = "", o;
3651
- for (; o = s.exec(i); ) {
3652
- n < o.index && (r += this.escapeHTML(i.slice(n, o.index)));
3653
- const l = o[0], a = o[1], h = o[2] || "", d = o[3];
3649
+ const i = this.unescapeEntitiesRepeated(e), n = /("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}\[\],:]/g;
3650
+ let s = 0, r = "", o;
3651
+ for (; o = n.exec(i); ) {
3652
+ s < o.index && (r += this.escapeHTML(i.slice(s, o.index)));
3653
+ const l = o[0], a = o[1], h = o[2] || "", c = o[3];
3654
3654
  if (a) {
3655
- const c = h ? t.attrName : t.string;
3656
- r += `<span style="color: ${c};">${this.escapeHTML(a)}</span>${this.escapeHTML(h)}`;
3657
- } 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>`;
3658
- n = s.lastIndex;
3655
+ const g = h ? t.attrName : t.string;
3656
+ r += `<span style="color: ${g};">${this.escapeHTML(a)}</span>${this.escapeHTML(h)}`;
3657
+ } else c ? 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>`;
3658
+ s = n.lastIndex;
3659
3659
  }
3660
- return n < i.length && (r += this.escapeHTML(i.slice(n))), r;
3660
+ return s < i.length && (r += this.escapeHTML(i.slice(s))), r;
3661
3661
  }
3662
3662
  _highlightMarkdown(e, t) {
3663
- var l;
3664
- const i = this.unescapeEntitiesRepeated(e).split(`
3663
+ var a;
3664
+ const n = this.unescapeEntitiesRepeated(e).split(`
3665
3665
  `);
3666
- let s = !1, n = "", r = "", o = ((l = i[0]) == null ? void 0 : l.trim()) === "---";
3667
- return i.map((a, h) => {
3668
- const d = [], c = this.createTokenStore(d);
3669
- if (o) {
3670
- const f = a.trim() === "---", p = `<span style="color: ${f ? t.keyword : t.attrName};">${this.escapeHTML(a)}</span>`;
3671
- return h > 0 && f && (o = !1), p;
3666
+ let s = !1, r = "", o = "", l = ((a = n[0]) == null ? void 0 : a.trim()) === "---";
3667
+ return n.map((h, c) => {
3668
+ const g = [], f = this.createTokenStore(g);
3669
+ if (l) {
3670
+ const p = h.trim() === "---", x = `<span style="color: ${p ? t.keyword : t.attrName};">${this.escapeHTML(h)}</span>`;
3671
+ return c > 0 && p && (l = !1), x;
3672
3672
  }
3673
- const u = a.match(/^(\s*)(`{3,}|~{3,})(.*)$/);
3674
- if (u) {
3675
- const f = u[2];
3676
- return s = !(s && f[0] === n[0]), n = s ? f : "", r = s ? this.extractMarkdownFenceLanguage(u[3] || "") : "", [
3677
- this.escapeHTML(u[1]),
3678
- `<span style="color: ${t.keyword}; font-weight: 700;">${this.escapeHTML(f)}</span>`,
3679
- `<span style="color: ${t.string};">${this.escapeHTML(u[3] || "")}</span>`
3673
+ const d = h.match(/^(\s*)(`{3,}|~{3,})(.*)$/);
3674
+ if (d) {
3675
+ const p = d[2];
3676
+ return s = !(s && p[0] === r[0]), r = s ? p : "", o = s ? this.extractMarkdownFenceLanguage(d[3] || "") : "", [
3677
+ this.escapeHTML(d[1]),
3678
+ `<span style="color: ${t.keyword}; font-weight: 700;">${this.escapeHTML(p)}</span>`,
3679
+ `<span style="color: ${t.string};">${this.escapeHTML(d[3] || "")}</span>`
3680
3680
  ].join("");
3681
3681
  }
3682
3682
  if (s)
3683
- return this.highlightMarkdownFenceLine(a, r, t);
3684
- let g = this.escapeHTML(a).replace(
3683
+ return this.highlightMarkdownFenceLine(h, o, t);
3684
+ let u = this.escapeHTML(h).replace(
3685
3685
  /(`[^`]+`)/g,
3686
- (f) => c(`<span style="color: ${t.string}; background: rgba(148, 163, 184, 0.16); border-radius: 3px;">${f}</span>`)
3686
+ (p) => f(`<span style="color: ${t.string}; background: rgba(148, 163, 184, 0.16); border-radius: 3px;">${p}</span>`)
3687
3687
  ).replace(
3688
3688
  /(!?\[[^\]\n]*\])(\([^)]+\))/g,
3689
- (f, p, m) => c(`<span style="color: ${t.attrName};">${p}</span><span style="color: ${t.attrValue};">${m}</span>`)
3689
+ (p, m, x) => f(`<span style="color: ${t.attrName};">${m}</span><span style="color: ${t.attrValue};">${x}</span>`)
3690
3690
  ).replace(
3691
3691
  /(\*\*|__)(.+?)\1/g,
3692
- (f, p, m) => c(`<span style="color: ${t.keyword};">${p}</span><span style="color: ${t.tag}; font-weight: 700;">${m}</span><span style="color: ${t.keyword};">${p}</span>`)
3692
+ (p, m, x) => f(`<span style="color: ${t.keyword};">${m}</span><span style="color: ${t.tag}; font-weight: 700;">${x}</span><span style="color: ${t.keyword};">${m}</span>`)
3693
3693
  ).replace(
3694
3694
  /(~~)(.+?)\1/g,
3695
- (f, p, m) => c(`<span style="color: ${t.keyword};">${p}</span><span style="color: ${t.comment}; text-decoration: line-through;">${m}</span><span style="color: ${t.keyword};">${p}</span>`)
3695
+ (p, m, x) => f(`<span style="color: ${t.keyword};">${m}</span><span style="color: ${t.comment}; text-decoration: line-through;">${x}</span><span style="color: ${t.keyword};">${m}</span>`)
3696
3696
  ).replace(
3697
3697
  /(\*|_)([^*_]+?)\1/g,
3698
- (f, p, m) => c(`<span style="color: ${t.keyword};">${p}</span><span style="color: ${t.styleVal}; font-style: italic;">${m}</span><span style="color: ${t.keyword};">${p}</span>`)
3698
+ (p, m, x) => f(`<span style="color: ${t.keyword};">${m}</span><span style="color: ${t.styleVal}; font-style: italic;">${x}</span><span style="color: ${t.keyword};">${m}</span>`)
3699
3699
  );
3700
- return g = g.replace(
3700
+ return u = u.replace(
3701
3701
  /^(\s{0,3}#{1,6})(\s+.*)?$/,
3702
- (f, p, m = "") => `<span style="color: ${t.keyword}; font-weight: 700;">${p}</span><span style="color: ${t.tag}; font-weight: 700;">${m}</span>`
3703
- ), g = g.replace(
3702
+ (p, m, x = "") => `<span style="color: ${t.keyword}; font-weight: 700;">${m}</span><span style="color: ${t.tag}; font-weight: 700;">${x}</span>`
3703
+ ), u = u.replace(
3704
3704
  /^(\s{0,3})((?:-\s*){3,}|(?:\*\s*){3,}|(?:_\s*){3,})$/,
3705
- (f, p, m) => `${p}<span style="color: ${t.comment};">${m}</span>`
3706
- ), g = g.replace(
3705
+ (p, m, x) => `${m}<span style="color: ${t.comment};">${x}</span>`
3706
+ ), u = u.replace(
3707
3707
  /^(\s{0,3}&gt;)(.*)$/,
3708
- (f, p, m) => `<span style="color: ${t.comment};">${p}</span>${m}`
3709
- ), g = g.replace(
3708
+ (p, m, x) => `<span style="color: ${t.comment};">${m}</span>${x}`
3709
+ ), u = u.replace(
3710
3710
  /^(\s*)([-*+])(\s+\[[ xX]\])(\s+)/,
3711
- (f, p, m, x, v) => `${p}<span style="color: ${t.keyword};">${m}</span><span style="color: ${t.attrName};">${x}</span>${v}`
3712
- ), g = g.replace(
3711
+ (p, m, x, v, T) => `${m}<span style="color: ${t.keyword};">${x}</span><span style="color: ${t.attrName};">${v}</span>${T}`
3712
+ ), u = u.replace(
3713
3713
  /^(\s*)([-*+]|\d+\.)(\s+)/,
3714
- (f, p, m, x) => `${p}<span style="color: ${t.keyword};">${m}</span>${x}`
3715
- ), g = g.replace(
3714
+ (p, m, x, v) => `${m}<span style="color: ${t.keyword};">${x}</span>${v}`
3715
+ ), u = u.replace(
3716
3716
  /^(\s*\|.*\|\s*)$/,
3717
- (f) => f.replace(/\|/g, (p) => `<span style="color: ${t.keyword};">${p}</span>`)
3718
- ), this.restoreHighlightTokens(g, d);
3717
+ (p) => p.replace(/\|/g, (m) => `<span style="color: ${t.keyword};">${m}</span>`)
3718
+ ), this.restoreHighlightTokens(u, g);
3719
3719
  }).join(`
3720
3720
  `);
3721
3721
  }
@@ -3725,27 +3725,27 @@ class he {
3725
3725
  return t ? this.normalizeLanguageId(t) : "";
3726
3726
  }
3727
3727
  highlightMarkdownFenceLine(e, t, i) {
3728
- const s = t ? this.modes.get(t) : void 0;
3729
- return !s || s.name === "markdown" ? `<span style="color: ${i.text};">${this.escapeHTML(e)}</span>` : s.highlight(e, i);
3728
+ const n = t ? this.modes.get(t) : void 0;
3729
+ return !n || n.name === "markdown" ? `<span style="color: ${i.text};">${this.escapeHTML(e)}</span>` : n.highlight(e, i);
3730
3730
  }
3731
3731
  _highlightShell(e, t) {
3732
- const i = this.unescapeEntitiesRepeated(e), s = [], n = this.createTokenStore(s), r = /(#[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|(\$\{?[A-Za-z_][\w]*\}?|\$[0-9@#?$*!])/g;
3732
+ const i = this.unescapeEntitiesRepeated(e), n = [], s = this.createTokenStore(n), r = /(#[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')|(\$\{?[A-Za-z_][\w]*\}?|\$[0-9@#?$*!])/g;
3733
3733
  let o = 0, l = "", a;
3734
3734
  for (; a = r.exec(i); ) {
3735
3735
  o < a.index && (l += this.escapeHTML(i.slice(o, a.index)));
3736
- const h = a[0], d = h.startsWith("#") ? t.comment : h.startsWith("$") ? t.variable : t.string;
3737
- l += n(`<span style="color: ${d};">${this.escapeHTML(h)}</span>`), o = r.lastIndex;
3736
+ const h = a[0], c = h.startsWith("#") ? t.comment : h.startsWith("$") ? t.variable : t.string;
3737
+ l += s(`<span style="color: ${c};">${this.escapeHTML(h)}</span>`), o = r.lastIndex;
3738
3738
  }
3739
3739
  return o < i.length && (l += this.escapeHTML(i.slice(o))), l = l.replace(
3740
3740
  /(^|\s)(--?[A-Za-z0-9][\w-]*)(?=\s|=|$)/g,
3741
- (h, d, c) => `${d}${n(`<span style="color: ${t.attrName};">${c}</span>`)}`
3741
+ (h, c, g) => `${c}${s(`<span style="color: ${t.attrName};">${g}</span>`)}`
3742
3742
  ), l = l.replace(
3743
3743
  /\b(if|then|else|elif|fi|for|while|until|do|done|case|esac|function|export|unset|alias|source|return|in)\b/g,
3744
- (h) => n(`<span style="color: ${t.keyword};">${h}</span>`)
3744
+ (h) => s(`<span style="color: ${t.keyword};">${h}</span>`)
3745
3745
  ), l = l.replace(
3746
3746
  /(^|\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,
3747
- (h, d, c) => `${d}${n(`<span style="color: ${t.tag};">${c}</span>`)}`
3748
- ), this.restoreHighlightTokens(l, s);
3747
+ (h, c, g) => `${c}${s(`<span style="color: ${t.tag};">${g}</span>`)}`
3748
+ ), this.restoreHighlightTokens(l, n);
3749
3749
  }
3750
3750
  getLanguageKeywords(e) {
3751
3751
  const t = ["true", "false", "null", "nil", "none"];
@@ -3762,101 +3762,101 @@ class he {
3762
3762
  }[e] || [], ...t];
3763
3763
  }
3764
3764
  _highlightGenericCode(e, t, i) {
3765
- const s = this.unescapeEntitiesRepeated(e), n = [], r = this.createTokenStore(n), o = i === "python" || i === "ruby" || i === "sql" ? "#[^\\n\\r]*|--[^\\n\\r]*" : "\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\n\\r]*", l = new RegExp(
3765
+ const n = this.unescapeEntitiesRepeated(e), s = [], r = this.createTokenStore(s), o = i === "python" || i === "ruby" || i === "sql" ? "#[^\\n\\r]*|--[^\\n\\r]*" : "\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\n\\r]*", l = new RegExp(
3766
3766
  `(${o})|("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`,
3767
3767
  "g"
3768
3768
  );
3769
- let a = 0, h = "", d;
3770
- for (; d = l.exec(s); ) {
3771
- a < d.index && (h += this.escapeHTML(s.slice(a, d.index)));
3772
- const u = d[0], g = u.startsWith("//") || u.startsWith("/*") || u.startsWith("#") || u.startsWith("--") ? t.comment : t.string;
3773
- h += r(`<span style="color: ${g};">${this.escapeHTML(u)}</span>`), a = l.lastIndex;
3769
+ let a = 0, h = "", c;
3770
+ for (; c = l.exec(n); ) {
3771
+ a < c.index && (h += this.escapeHTML(n.slice(a, c.index)));
3772
+ const f = c[0], d = f.startsWith("//") || f.startsWith("/*") || f.startsWith("#") || f.startsWith("--") ? t.comment : t.string;
3773
+ h += r(`<span style="color: ${d};">${this.escapeHTML(f)}</span>`), a = l.lastIndex;
3774
3774
  }
3775
- a < s.length && (h += this.escapeHTML(s.slice(a)));
3776
- const c = Array.from(new Set(this.getLanguageKeywords(i)));
3777
- if (c.length > 0) {
3778
- const u = new RegExp(
3779
- `\\b(${c.map((g) => g.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})\\b`,
3775
+ a < n.length && (h += this.escapeHTML(n.slice(a)));
3776
+ const g = Array.from(new Set(this.getLanguageKeywords(i)));
3777
+ if (g.length > 0) {
3778
+ const f = new RegExp(
3779
+ `\\b(${g.map((d) => d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})\\b`,
3780
3780
  i === "sql" ? "gi" : "g"
3781
3781
  );
3782
3782
  h = h.replace(
3783
- u,
3784
- (g) => r(`<span style="color: ${t.keyword};">${g}</span>`)
3783
+ f,
3784
+ (d) => r(`<span style="color: ${t.keyword};">${d}</span>`)
3785
3785
  );
3786
3786
  }
3787
3787
  return h = h.replace(
3788
3788
  /\b([A-Z][A-Za-z0-9_]*|[A-Za-z_][\w]*(?=\s*\())\b/g,
3789
- (u) => r(`<span style="color: ${t.tag};">${u}</span>`)
3789
+ (f) => r(`<span style="color: ${t.tag};">${f}</span>`)
3790
3790
  ), h = h.replace(
3791
3791
  /\b(-?0x[0-9a-fA-F]+|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)(?:[uUlLfFdD]*)\b/g,
3792
- (u) => r(`<span style="color: ${t.number};">${u}</span>`)
3792
+ (f) => r(`<span style="color: ${t.number};">${f}</span>`)
3793
3793
  ), h = h.replace(
3794
3794
  /(@[A-Za-z_][\w]*|#[A-Za-z_][\w]*|::[A-Za-z_][\w]*)/g,
3795
- (u) => r(`<span style="color: ${t.attrName};">${u}</span>`)
3796
- ), this.restoreHighlightTokens(h, n);
3795
+ (f) => r(`<span style="color: ${t.attrName};">${f}</span>`)
3796
+ ), this.restoreHighlightTokens(h, s);
3797
3797
  }
3798
3798
  _highlightYAML(e, t) {
3799
- const i = this.unescapeEntitiesRepeated(e), s = [], n = this.createTokenStore(s);
3799
+ const i = this.unescapeEntitiesRepeated(e), n = [], s = this.createTokenStore(n);
3800
3800
  let r = this.escapeHTML(i).replace(
3801
3801
  /(#.*)$/gm,
3802
- (o) => n(`<span style="color: ${t.comment};">${o}</span>`)
3802
+ (o) => s(`<span style="color: ${t.comment};">${o}</span>`)
3803
3803
  ).replace(
3804
3804
  /^(\s*[-?]?\s*)([A-Za-z0-9_.-]+)(\s*:)/gm,
3805
- (o, l, a, h) => `${l}${n(`<span style="color: ${t.attrName};">${a}</span>`)}${h}`
3805
+ (o, l, a, h) => `${l}${s(`<span style="color: ${t.attrName};">${a}</span>`)}${h}`
3806
3806
  ).replace(
3807
3807
  /\b(true|false|null|yes|no|on|off)\b/gi,
3808
- (o) => n(`<span style="color: ${t.keyword};">${o}</span>`)
3808
+ (o) => s(`<span style="color: ${t.keyword};">${o}</span>`)
3809
3809
  ).replace(
3810
3810
  /\b(-?\d+(?:\.\d+)?)\b/g,
3811
- (o) => n(`<span style="color: ${t.number};">${o}</span>`)
3811
+ (o) => s(`<span style="color: ${t.number};">${o}</span>`)
3812
3812
  );
3813
3813
  return r = r.replace(
3814
3814
  /(&quot;[^&]*?&quot;|&#39;[^&]*?&#39;)/g,
3815
- (o) => n(`<span style="color: ${t.string};">${o}</span>`)
3816
- ), this.restoreHighlightTokens(r, s);
3815
+ (o) => s(`<span style="color: ${t.string};">${o}</span>`)
3816
+ ), this.restoreHighlightTokens(r, n);
3817
3817
  }
3818
3818
  _highlightXML(e, t) {
3819
3819
  return this._highlightHTML(e, t);
3820
3820
  }
3821
3821
  _highlightJSX(e, t) {
3822
- const i = [], s = e.replace(
3822
+ const i = [], n = e.replace(
3823
3823
  /<\/?[A-Za-z][\w.:-]*(?:\s+[^<>]*?)?\/?>/g,
3824
- (n) => {
3825
- const r = i.length, o = this.escapeHTML(n).replace(
3824
+ (s) => {
3825
+ const r = i.length, o = this.escapeHTML(s).replace(
3826
3826
  /(&lt;\/?)([A-Za-z][\w.:-]*)([\s\S]*?)(\/?&gt;)/,
3827
- (l, a, h, d, c) => {
3828
- const u = String(d || "").replace(
3827
+ (l, a, h, c, g) => {
3828
+ const f = String(c || "").replace(
3829
3829
  /([A-Za-z_:][\w:.-]*)(\s*=\s*)/g,
3830
3830
  `<span style="color: ${t.attrName};">$1</span>$2`
3831
3831
  );
3832
- return `${a}<span style="color: ${t.tag};">${h}</span>${u}${c}`;
3832
+ return `${a}<span style="color: ${t.tag};">${h}</span>${f}${g}`;
3833
3833
  }
3834
3834
  );
3835
3835
  return i.push(o), `jsx${r}`;
3836
3836
  }
3837
3837
  );
3838
- return this._highlightJS(s, t).replace(
3838
+ return this._highlightJS(n, t).replace(
3839
3839
  /\u0004jsx(\d+)\u0004/g,
3840
- (n, r) => i[Number(r)] || ""
3840
+ (s, r) => i[Number(r)] || ""
3841
3841
  );
3842
3842
  }
3843
3843
  _highlightEJS(e, t) {
3844
- const i = [], s = e.replace(/<%[\s\S]*?%>/g, (n) => {
3844
+ const i = [], n = e.replace(/<%[\s\S]*?%>/g, (s) => {
3845
3845
  const r = i.length;
3846
- return i.push(`<span style="color: ${t.keyword};">${this.escapeHTML(n)}</span>`), `ejs${r}`;
3846
+ return i.push(`<span style="color: ${t.keyword};">${this.escapeHTML(s)}</span>`), `ejs${r}`;
3847
3847
  });
3848
- return this._highlightHTML(s, t).replace(
3848
+ return this._highlightHTML(n, t).replace(
3849
3849
  /\u0003ejs(\d+)\u0003/g,
3850
- (n, r) => i[Number(r)] || ""
3850
+ (s, r) => i[Number(r)] || ""
3851
3851
  );
3852
3852
  }
3853
3853
  _highlightDockerfile(e, t) {
3854
3854
  return this.unescapeEntitiesRepeated(e).split(`
3855
- `).map((i) => {
3856
- const s = this.escapeHTML(i);
3857
- return /^\s*#/.test(i) ? `<span style="color: ${t.comment};">${s}</span>` : s.replace(
3855
+ `).map((n) => {
3856
+ const s = this.escapeHTML(n);
3857
+ return /^\s*#/.test(n) ? `<span style="color: ${t.comment};">${s}</span>` : s.replace(
3858
3858
  /^(\s*)(FROM|RUN|CMD|LABEL|MAINTAINER|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL)(\b)/i,
3859
- (n, r, o, l) => `${r}<span style="color: ${t.keyword};">${o}</span>${l}`
3859
+ (r, o, l, a) => `${o}<span style="color: ${t.keyword};">${l}</span>${a}`
3860
3860
  );
3861
3861
  }).join(`
3862
3862
  `);
@@ -3864,78 +3864,78 @@ class he {
3864
3864
  _highlightJS(e, t) {
3865
3865
  const i = this.unescapeEntitiesRepeated(e);
3866
3866
  this.escapeHTML(i);
3867
- const s = [], n = (c) => {
3868
- let u = "", g = c;
3867
+ const n = [], s = (f) => {
3868
+ let d = "", u = f;
3869
3869
  do
3870
- u = String.fromCharCode(97 + g % 26) + u, g = Math.floor(g / 26) - 1;
3871
- while (g >= 0);
3872
- return u || "a";
3873
- }, r = (c) => `\0${n(c)}\0`, o = (c) => {
3874
- const u = s.length;
3875
- return s.push(c), r(u);
3870
+ d = String.fromCharCode(97 + u % 26) + d, u = Math.floor(u / 26) - 1;
3871
+ while (u >= 0);
3872
+ return d || "a";
3873
+ }, r = (f) => `\0${s(f)}\0`, o = (f) => {
3874
+ const d = n.length;
3875
+ return n.push(f), r(d);
3876
3876
  };
3877
3877
  let l;
3878
3878
  const a = /(\/\*[\s\S]*?\*\/)|(\/\/[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)/g;
3879
- let h = 0, d = "";
3879
+ let h = 0, c = "";
3880
3880
  for (; l = a.exec(i); ) {
3881
- const c = l.index;
3882
- h < c && (d += this.escapeHTML(i.slice(h, c)));
3883
- const u = l[0];
3884
- /^\/\*/.test(u) || /^\/\//.test(u) ? d += o(`<span style="color: ${t.comment};">${this.escapeHTML(u)}</span>`) : d += o(`<span style="color: ${t.string};">${this.escapeHTML(u)}</span>`), h = a.lastIndex;
3881
+ const f = l.index;
3882
+ h < f && (c += this.escapeHTML(i.slice(h, f)));
3883
+ const d = l[0];
3884
+ /^\/\*/.test(d) || /^\/\//.test(d) ? c += o(`<span style="color: ${t.comment};">${this.escapeHTML(d)}</span>`) : c += o(`<span style="color: ${t.string};">${this.escapeHTML(d)}</span>`), h = a.lastIndex;
3885
3885
  }
3886
- return h < i.length && (d += this.escapeHTML(i.slice(h))), d = d.replace(/\b(0x[0-9a-fA-F]+|\d+\.?\d*|\d*\.\d+)\b/g, (c, u, g) => {
3887
- const f = d[g - 1] || "", p = d[g + c.length] || "";
3888
- return f === "&" || f === "#" || p === ";" || p === "#" ? c : `<span style="color: ${t.number};">${c}</span>`;
3889
- }), 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, (c, u) => {
3890
- let g = 0;
3891
- for (let f = 0; f < u.length; f++)
3892
- g = g * 26 + (u.charCodeAt(f) - 97 + 1);
3893
- return g = g - 1, s[g] || "";
3886
+ return h < i.length && (c += this.escapeHTML(i.slice(h))), c = c.replace(/\b(0x[0-9a-fA-F]+|\d+\.?\d*|\d*\.\d+)\b/g, (f, d, u) => {
3887
+ const p = c[u - 1] || "", m = c[u + f.length] || "";
3888
+ return p === "&" || p === "#" || m === ";" || m === "#" ? f : `<span style="color: ${t.number};">${f}</span>`;
3889
+ }), c = c.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>`), c.replace(/\u0000([a-z]+)\u0000/g, (f, d) => {
3890
+ let u = 0;
3891
+ for (let p = 0; p < d.length; p++)
3892
+ u = u * 26 + (d.charCodeAt(p) - 97 + 1);
3893
+ return u = u - 1, n[u] || "";
3894
3894
  });
3895
3895
  }
3896
3896
  _highlightPHP(e, t) {
3897
3897
  const i = this.unescapeEntitiesRepeated(e);
3898
- let s = this.escapeHTML(i);
3899
- const n = [], r = (g) => {
3900
- let f = "", p = g;
3898
+ let n = this.escapeHTML(i);
3899
+ const s = [], r = (d) => {
3900
+ let u = "", p = d;
3901
3901
  do
3902
- f = String.fromCharCode(97 + p % 26) + f, p = Math.floor(p / 26) - 1;
3902
+ u = String.fromCharCode(97 + p % 26) + u, p = Math.floor(p / 26) - 1;
3903
3903
  while (p >= 0);
3904
- return f || "a";
3905
- }, o = (g) => {
3906
- const f = n.length;
3907
- return n.push(g), `\0${r(f)}\0`;
3908
- }, l = (g, f) => {
3909
- const p = s.indexOf(g);
3910
- return p === -1 ? !1 : (s = s.slice(0, p) + f + s.slice(p + g.length), !0);
3904
+ return u || "a";
3905
+ }, o = (d) => {
3906
+ const u = s.length;
3907
+ return s.push(d), `\0${r(u)}\0`;
3908
+ }, l = (d, u) => {
3909
+ const p = n.indexOf(d);
3910
+ return p === -1 ? !1 : (n = n.slice(0, p) + u + n.slice(p + d.length), !0);
3911
3911
  };
3912
3912
  let a;
3913
- const h = /\/\*[\s\S]*?\*\//g, d = /\/\/[^\n\r]*/g, c = /\#([^\n\r]*)/g, u = /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
3913
+ const h = /\/\*[\s\S]*?\*\//g, c = /\/\/[^\n\r]*/g, g = /\#([^\n\r]*)/g, f = /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
3914
3914
  for (; a = h.exec(i); ) {
3915
- const g = a[0];
3916
- l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
3917
- }
3918
- for (; a = d.exec(i); ) {
3919
- const g = a[0];
3920
- l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
3915
+ const d = a[0];
3916
+ l(this.escapeHTML(d), o(`<span style="color: ${t.comment};">${this.escapeHTML(d)}</span>`));
3921
3917
  }
3922
3918
  for (; a = c.exec(i); ) {
3923
- const g = a[0];
3924
- l(this.escapeHTML(g), o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`));
3919
+ const d = a[0];
3920
+ l(this.escapeHTML(d), o(`<span style="color: ${t.comment};">${this.escapeHTML(d)}</span>`));
3921
+ }
3922
+ for (; a = g.exec(i); ) {
3923
+ const d = a[0];
3924
+ l(this.escapeHTML(d), o(`<span style="color: ${t.comment};">${this.escapeHTML(d)}</span>`));
3925
3925
  }
3926
- for (; a = u.exec(i); ) {
3927
- const g = a[0];
3928
- l(this.escapeHTML(g), o(`<span style="color: ${t.string};">${this.escapeHTML(g)}</span>`));
3926
+ for (; a = f.exec(i); ) {
3927
+ const d = a[0];
3928
+ l(this.escapeHTML(d), o(`<span style="color: ${t.string};">${this.escapeHTML(d)}</span>`));
3929
3929
  }
3930
- return s = s.replace(
3930
+ return n = n.replace(
3931
3931
  /(&lt;\?(?:php\b|=)?|\?&gt;)/gi,
3932
- (g) => o(`<span style="color: ${t.keyword};">${g}</span>`)
3933
- ), s = s.replace(/(\$[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/g, `<span style="color: ${t.variable};">$1</span>`), s = s.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>`), s = s.replace(/\u0000([a-z]+)\u0000/g, (g, f) => {
3932
+ (d) => o(`<span style="color: ${t.keyword};">${d}</span>`)
3933
+ ), n = n.replace(/(\$[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/g, `<span style="color: ${t.variable};">$1</span>`), n = n.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>`), n = n.replace(/\u0000([a-z]+)\u0000/g, (d, u) => {
3934
3934
  let p = 0;
3935
- for (let m = 0; m < f.length; m++)
3936
- p = p * 26 + (f.charCodeAt(m) - 97 + 1);
3937
- return p = p - 1, n[p] || "";
3938
- }), s;
3935
+ for (let m = 0; m < u.length; m++)
3936
+ p = p * 26 + (u.charCodeAt(m) - 97 + 1);
3937
+ return p = p - 1, s[p] || "";
3938
+ }), n;
3939
3939
  }
3940
3940
  // Method to check if content contains syntax that should be highlighted
3941
3941
  shouldHighlight(e) {
@@ -3945,11 +3945,11 @@ class he {
3945
3945
  this.editor = null, this.modes.clear();
3946
3946
  }
3947
3947
  }
3948
- function ce(E, e) {
3948
+ function le(E, e) {
3949
3949
  const t = { ...e };
3950
- return t.extensions || (t.extensions = []), t.extensions.some((i) => i.name === "keymap") || t.extensions.unshift(new J(t.keymap)), t.extensions.some((i) => i.name === "transaction") || t.extensions.unshift(new ee()), new Y(E, t);
3950
+ return t.extensions || (t.extensions = []), t.extensions.some((s) => s.name === "keymap") || t.extensions.unshift(new X(t.keymap)), t.extensions.some((s) => s.name === "transaction") || t.extensions.unshift(new W()), new V(E, t);
3951
3951
  }
3952
- const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Editor Dialog Styles */
3952
+ const z = '[data-theme="dark"], .dark, .editora-theme-dark', ae = `/* Source Editor Dialog Styles */
3953
3953
  .rte-source-editor-overlay {
3954
3954
  position: fixed !important;
3955
3955
  top: 0 !important;
@@ -4326,7 +4326,7 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4326
4326
  flex: 1;
4327
4327
  text-align: center;
4328
4328
  }
4329
- }`, ue = () => ({
4329
+ }`, he = () => ({
4330
4330
  name: "code",
4331
4331
  // Toolbar button configuration
4332
4332
  toolbar: [
@@ -4347,9 +4347,9 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4347
4347
  toggleSourceView: () => {
4348
4348
  const e = (() => {
4349
4349
  var o, l, a;
4350
- const n = window.getSelection();
4351
- if (n && n.anchorNode) {
4352
- let h = n.anchorNode instanceof HTMLElement ? n.anchorNode : n.anchorNode.parentElement;
4350
+ const s = window.getSelection();
4351
+ if (s && s.anchorNode) {
4352
+ let h = s.anchorNode instanceof HTMLElement ? s.anchorNode : s.anchorNode.parentElement;
4353
4353
  for (; h; ) {
4354
4354
  if ((o = h.classList) != null && o.contains("rte-content"))
4355
4355
  return h;
@@ -4363,10 +4363,10 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4363
4363
  for (; h && h !== document.body; ) {
4364
4364
  if ((a = h.classList) != null && a.contains("rte-content"))
4365
4365
  return h;
4366
- const d = h.querySelector(
4366
+ const c = h.querySelector(
4367
4367
  ".rte-content"
4368
4368
  );
4369
- if (d) return d;
4369
+ if (c) return c;
4370
4370
  h = h.parentElement;
4371
4371
  }
4372
4372
  }
@@ -4383,9 +4383,9 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4383
4383
  return console.error("[CodePlugin] Editor content area not found"), alert(
4384
4384
  "Editor content area not found. Please click inside the editor first."
4385
4385
  ), !1;
4386
- const t = e.innerHTML, i = (n) => {
4386
+ const t = e.innerHTML, i = (s) => {
4387
4387
  let r = "", o = 0;
4388
- const l = 2, a = n.split(/(<\/?[a-zA-Z][^>]*>)/);
4388
+ const l = 2, a = s.split(/(<\/?[a-zA-Z][^>]*>)/);
4389
4389
  for (const h of a)
4390
4390
  h.trim() && (h.match(/^<\/[a-zA-Z]/) ? (o = Math.max(0, o - 1), r += `
4391
4391
  ` + " ".repeat(o * l) + h) : h.match(/^<[a-zA-Z]/) && !h.match(/\/>$/) ? (r += `
@@ -4395,11 +4395,11 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4395
4395
  };
4396
4396
  return (() => {
4397
4397
  const r = i(t);
4398
- let o = null, l = "dark", a = !1, h = !1, d = !1, c = !1;
4399
- const u = !!e.closest(B) || document.body.matches(B) || document.documentElement.matches(B), g = document.createElement("div");
4400
- g.className = "rte-source-editor-overlay", u && g.classList.add("rte-theme-dark");
4401
- const f = document.createElement("div");
4402
- f.className = "rte-source-editor-modal", f.setAttribute("role", "dialog"), f.setAttribute("aria-modal", "true"), f.setAttribute("aria-labelledby", "source-editor-title");
4398
+ let o = null, l = "dark", a = !1, h = !1, c = !1, g = !1;
4399
+ const f = !!e.closest(z) || document.body.matches(z) || document.documentElement.matches(z), d = document.createElement("div");
4400
+ d.className = "rte-source-editor-overlay", f && d.classList.add("rte-theme-dark");
4401
+ const u = document.createElement("div");
4402
+ u.className = "rte-source-editor-modal", u.setAttribute("role", "dialog"), u.setAttribute("aria-modal", "true"), u.setAttribute("aria-labelledby", "source-editor-title");
4403
4403
  const p = document.createElement("div");
4404
4404
  p.className = "rte-source-editor-header", p.innerHTML = `
4405
4405
  <h2 id="source-editor-title">Source Editor</h2>
@@ -4446,8 +4446,8 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4446
4446
  v.className = "rte-source-editor-warning", v.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
4447
4447
  const T = document.createElement("div");
4448
4448
  T.className = "rte-source-editor-light-editor", T.style.height = "400px", x.appendChild(v), x.appendChild(T), m.appendChild(x);
4449
- const w = document.createElement("div");
4450
- if (w.className = "rte-source-editor-footer", w.innerHTML = `
4449
+ const S = document.createElement("div");
4450
+ if (S.className = "rte-source-editor-footer", S.innerHTML = `
4451
4451
  <div class="rte-source-editor-footer-info">
4452
4452
  <span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
4453
4453
  </div>
@@ -4455,40 +4455,40 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4455
4455
  <button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
4456
4456
  <button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
4457
4457
  </div>
4458
- `, f.appendChild(p), f.appendChild(m), f.appendChild(w), g.appendChild(f), !document.getElementById("rte-source-editor-styles")) {
4458
+ `, u.appendChild(p), u.appendChild(m), u.appendChild(S), d.appendChild(u), !document.getElementById("rte-source-editor-styles")) {
4459
4459
  const b = document.createElement("style");
4460
- b.id = "rte-source-editor-styles", b.textContent = de, document.head.appendChild(b);
4460
+ b.id = "rte-source-editor-styles", b.textContent = ae, document.head.appendChild(b);
4461
4461
  }
4462
- const S = p.querySelector(
4462
+ const w = p.querySelector(
4463
4463
  ".theme-toggle-btn"
4464
- ), L = p.querySelector(
4464
+ ), O = p.querySelector(
4465
4465
  ".readonly-toggle-btn"
4466
- ), I = p.querySelector(
4467
- ".rte-source-editor-fullscreen-btn"
4468
4466
  ), $ = p.querySelector(
4467
+ ".rte-source-editor-fullscreen-btn"
4468
+ ), I = p.querySelector(
4469
4469
  ".rte-source-editor-close-btn"
4470
- ), C = w.querySelector(
4470
+ ), C = S.querySelector(
4471
4471
  ".rte-source-editor-btn-cancel"
4472
- ), M = w.querySelector(
4472
+ ), M = S.querySelector(
4473
4473
  ".rte-source-editor-btn-save"
4474
- ), D = w.querySelector(
4474
+ ), N = S.querySelector(
4475
4475
  ".unsaved-changes"
4476
- ), F = [], k = (b, R, P, N) => {
4477
- b.addEventListener(R, P, N), F.push(
4478
- () => b.removeEventListener(R, P, N)
4476
+ ), A = [], R = (b, k, B, F) => {
4477
+ b.addEventListener(k, B, F), A.push(
4478
+ () => b.removeEventListener(k, B, F)
4479
4479
  );
4480
- }, A = (b) => {
4481
- d !== b && (d = b, D && (D.style.display = d ? "inline" : "none"));
4480
+ }, P = (b) => {
4481
+ c !== b && (c = b, N && (N.style.display = c ? "inline" : "none"));
4482
4482
  }, H = () => {
4483
- if (!c) {
4484
- for (c = !0; F.length; ) {
4485
- const b = F.pop();
4483
+ if (!g) {
4484
+ for (g = !0; A.length; ) {
4485
+ const b = A.pop();
4486
4486
  b == null || b();
4487
4487
  }
4488
- o && (o.destroy(), o = null), g.isConnected && g.remove();
4488
+ o && (o.destroy(), o = null), d.isConnected && d.remove();
4489
4489
  }
4490
- }, _ = () => {
4491
- l = l === "dark" ? "light" : "dark", o == null || o.setTheme(l), S && (S.innerHTML = l === "light" ? `
4490
+ }, K = () => {
4491
+ l = l === "dark" ? "light" : "dark", o == null || o.setTheme(l), w && (w.innerHTML = l === "light" ? `
4492
4492
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4493
4493
  <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
4494
4494
  </svg>
@@ -4506,7 +4506,7 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4506
4506
  </svg>
4507
4507
  `);
4508
4508
  }, j = () => {
4509
- a = !a, o == null || o.setReadOnly(a), L && (L.classList.toggle("active", a), L.innerHTML = a ? `
4509
+ a = !a, o == null || o.setReadOnly(a), O && (O.classList.toggle("active", a), O.innerHTML = a ? `
4510
4510
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4511
4511
  <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
4512
4512
  <circle cx="12" cy="16" r="1"/>
@@ -4519,7 +4519,7 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4519
4519
  </svg>
4520
4520
  `);
4521
4521
  }, q = () => {
4522
- h = !h, g.classList.toggle("fullscreen", h), T.style.height = h ? "calc(100vh - 200px)" : "400px", I && (I.innerHTML = h ? `
4522
+ h = !h, d.classList.toggle("fullscreen", h), T.style.height = h ? "calc(100vh - 200px)" : "400px", $ && ($.innerHTML = h ? `
4523
4523
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4524
4524
  <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"/>
4525
4525
  </svg>
@@ -4529,13 +4529,13 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4529
4529
  </svg>
4530
4530
  `);
4531
4531
  }, G = () => {
4532
- d && !confirm("You have unsaved changes. Are you sure you want to cancel?") || H();
4532
+ c && !confirm("You have unsaved changes. Are you sure you want to cancel?") || H();
4533
4533
  }, Z = () => {
4534
4534
  try {
4535
- const b = (o == null ? void 0 : o.getValue()) || "", R = document.createElement("div");
4536
- R.innerHTML = b, R.querySelectorAll(
4535
+ const b = (o == null ? void 0 : o.getValue()) || "", k = document.createElement("div");
4536
+ k.innerHTML = b, k.querySelectorAll(
4537
4537
  'script, iframe[src^="javascript:"], object, embed'
4538
- ).forEach((N) => N.remove()), e.innerHTML = R.innerHTML;
4538
+ ).forEach((F) => F.remove()), e.innerHTML = k.innerHTML;
4539
4539
  try {
4540
4540
  e.dispatchEvent(
4541
4541
  new InputEvent("input", {
@@ -4544,42 +4544,42 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4544
4544
  inputType: "insertReplacementText"
4545
4545
  })
4546
4546
  );
4547
- } catch (N) {
4547
+ } catch (F) {
4548
4548
  e.dispatchEvent(
4549
4549
  new Event("input", { bubbles: !0 })
4550
4550
  );
4551
4551
  }
4552
4552
  e.dispatchEvent(
4553
4553
  new Event("change", { bubbles: !0 })
4554
- ), A(!1), H();
4554
+ ), P(!1), H();
4555
4555
  } catch (b) {
4556
4556
  alert("Failed to update HTML. Please check your syntax."), console.error("HTML update error:", b);
4557
4557
  }
4558
4558
  };
4559
- S && k(S, "click", _), L && k(L, "click", j), I && k(I, "click", q), $ && k($, "click", H), C && k(C, "click", G), M && k(M, "click", Z), k(g, "click", (b) => {
4560
- b.target === g && H();
4561
- }), k(document, "keydown", (b) => {
4562
- const R = b;
4563
- R.key === "Escape" && (R.preventDefault(), H());
4564
- }), document.body.appendChild(g), requestAnimationFrame(() => {
4565
- if (!(c || !g.isConnected))
4559
+ w && R(w, "click", K), O && R(O, "click", j), $ && R($, "click", q), I && R(I, "click", H), C && R(C, "click", G), M && R(M, "click", Z), R(d, "click", (b) => {
4560
+ b.target === d && H();
4561
+ }), R(document, "keydown", (b) => {
4562
+ const k = b;
4563
+ k.key === "Escape" && (k.preventDefault(), H());
4564
+ }), document.body.appendChild(d), requestAnimationFrame(() => {
4565
+ if (!(g || !d.isConnected))
4566
4566
  try {
4567
- o = ce(T, {
4567
+ o = le(T, {
4568
4568
  value: r,
4569
4569
  theme: "dark",
4570
4570
  readOnly: !1,
4571
4571
  extensions: [
4572
+ new J(),
4573
+ new ee(),
4572
4574
  new te(),
4573
- new ie(),
4574
4575
  new se(),
4575
- new le(),
4576
+ new U(),
4576
4577
  new re(),
4577
- new ae(),
4578
- new he()
4578
+ new oe()
4579
4579
  ]
4580
4580
  }), o.on("change", () => {
4581
4581
  const b = (o == null ? void 0 : o.getValue()) || "";
4582
- A(b !== r);
4582
+ P(b !== r);
4583
4583
  }), requestAnimationFrame(() => o == null ? void 0 : o.focus());
4584
4584
  } catch (b) {
4585
4585
  console.error("Failed to initialize code editor:", b);
@@ -4595,6 +4595,6 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4595
4595
  }
4596
4596
  });
4597
4597
  export {
4598
- ue as CodePlugin
4598
+ he as CodePlugin
4599
4599
  };
4600
- //# sourceMappingURL=CodePlugin.native-veDC_kx5.mjs.map
4600
+ //# sourceMappingURL=CodePlugin.native-knhM8NNo.mjs.map