@vscode/markdown-editor 0.0.2-53 → 0.0.2-54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { commands as Mt } from "./commands.js";
2
- import { O as w, S as T, a as ie, c as os } from "./stringEdit-CVDbCUBY.js";
1
+ import { commands as Tt } from "./commands.js";
2
+ import { O as w, S as M, a as ie, c as os } from "./stringEdit-CVDbCUBY.js";
3
3
  import rs from "katex";
4
- import { o as C, d as B, t as ne, n as V, V as cs, q as N, A as ii } from "./runOnChange-e7FtCqOQ.js";
4
+ import { o as C, d as B, t as ne, n as $, V as cs, q as N, A as ii } from "./runOnChange-e7FtCqOQ.js";
5
5
  import { D as oi, f as ri, a as ci, b as ai, c as li, d as as, i as Fe } from "./config-BGeaJqWk.js";
6
6
  import { e as pl } from "./config-BGeaJqWk.js";
7
7
  import { parse as di, preprocess as hi, postprocess as ui } from "micromark";
@@ -76,12 +76,12 @@ class Yt {
76
76
  return this.value;
77
77
  }
78
78
  }
79
- class b {
79
+ class k {
80
80
  constructor(e, t) {
81
81
  this.anchor = e, this.active = t;
82
82
  }
83
83
  static collapsed(e) {
84
- return new b(e, e);
84
+ return new k(e, e);
85
85
  }
86
86
  get isCollapsed() {
87
87
  return this.anchor === this.active;
@@ -93,19 +93,19 @@ class b {
93
93
  return this.isForward ? new w(this.anchor, this.active) : new w(this.active, this.anchor);
94
94
  }
95
95
  collapseToActive() {
96
- return b.collapsed(this.active);
96
+ return k.collapsed(this.active);
97
97
  }
98
98
  withActive(e) {
99
- return new b(this.anchor, e);
99
+ return new k(this.anchor, e);
100
100
  }
101
101
  }
102
- class ae {
102
+ class le {
103
103
  constructor(e, t) {
104
104
  this.x = e, this.y = t;
105
105
  }
106
- static ZERO = new ae(0, 0);
106
+ static ZERO = new le(0, 0);
107
107
  translate(e, t) {
108
- return new ae(this.x + e, this.y + t);
108
+ return new le(this.x + e, this.y + t);
109
109
  }
110
110
  }
111
111
  class S {
@@ -132,7 +132,7 @@ class S {
132
132
  return this.y + this.height;
133
133
  }
134
134
  get topLeft() {
135
- return new ae(this.x, this.y);
135
+ return new le(this.x, this.y);
136
136
  }
137
137
  containsX(e) {
138
138
  return e >= this.left && e < this.right;
@@ -152,7 +152,7 @@ class S {
152
152
  }
153
153
  }
154
154
  let wi = 1;
155
- class z {
155
+ class q {
156
156
  /**
157
157
  * A stable identity. Every node has one: it is minted on construction and
158
158
  * carried across edits by reconciliation, so a node that survives an edit
@@ -219,7 +219,7 @@ function J(n, e) {
219
219
  function te(n, e) {
220
220
  return e ? J(n, e) : void 0;
221
221
  }
222
- class st extends z {
222
+ class st extends q {
223
223
  get children() {
224
224
  return bi;
225
225
  }
@@ -248,7 +248,7 @@ class E extends st {
248
248
  return this.markerKind === e.markerKind && this.content === e.content;
249
249
  }
250
250
  }
251
- class H extends st {
251
+ class W extends st {
252
252
  constructor(e, t) {
253
253
  super(), this.content = e, this.glueKind = t;
254
254
  }
@@ -257,13 +257,13 @@ class H extends st {
257
257
  return this.content === e.content && this.glueKind === e.glueKind;
258
258
  }
259
259
  }
260
- class Y extends z {
260
+ class Y extends q {
261
261
  /** Prepends {@link leadingTrivia}, if any, ahead of the block's own children. */
262
262
  _withLeading(e) {
263
263
  return this.leadingTrivia ? [this.leadingTrivia, ...e] : e;
264
264
  }
265
265
  }
266
- class me extends Y {
266
+ class ge extends Y {
267
267
  constructor(e, t) {
268
268
  super(), this.content = e, this.leadingTrivia = t;
269
269
  }
@@ -275,16 +275,16 @@ class me extends Y {
275
275
  return se(this.content, "content");
276
276
  }
277
277
  mapChildren(e) {
278
- return new me(A(e, this.content), te(e, this.leadingTrivia));
278
+ return new ge(A(e, this.content), te(e, this.leadingTrivia));
279
279
  }
280
280
  withLeadingTrivia(e) {
281
- return new me(this.content, e);
281
+ return new ge(this.content, e);
282
282
  }
283
283
  }
284
284
  function se(n, e) {
285
285
  return n.find((t) => t instanceof E && t.markerKind === e);
286
286
  }
287
- class Rt extends z {
287
+ class Rt extends q {
288
288
  constructor(e, t, s) {
289
289
  super(), this.openMarker = e, this.content = t, this.closeMarker = s;
290
290
  }
@@ -296,7 +296,7 @@ class Rt extends z {
296
296
  return new Rt(J(e, this.openMarker), A(e, this.content), J(e, this.closeMarker));
297
297
  }
298
298
  }
299
- class Nt extends z {
299
+ class Nt extends q {
300
300
  constructor(e, t, s) {
301
301
  super(), this.openMarker = e, this.content = t, this.closeMarker = s;
302
302
  }
@@ -308,7 +308,7 @@ class Nt extends z {
308
308
  return new Nt(J(e, this.openMarker), A(e, this.content), J(e, this.closeMarker));
309
309
  }
310
310
  }
311
- class It extends z {
311
+ class It extends q {
312
312
  constructor(e, t, s) {
313
313
  super(), this.openMarker = e, this.content = t, this.closeMarker = s;
314
314
  }
@@ -320,7 +320,7 @@ class It extends z {
320
320
  return new It(J(e, this.openMarker), A(e, this.content), J(e, this.closeMarker));
321
321
  }
322
322
  }
323
- class Bt extends z {
323
+ class Bt extends q {
324
324
  constructor(e) {
325
325
  super(), this.content = e;
326
326
  }
@@ -332,7 +332,7 @@ class Bt extends z {
332
332
  return new Bt(A(e, this.content));
333
333
  }
334
334
  }
335
- class At extends z {
335
+ class At extends q {
336
336
  constructor(e) {
337
337
  super(), this.content = e;
338
338
  }
@@ -344,7 +344,7 @@ class At extends z {
344
344
  return new At(A(e, this.content));
345
345
  }
346
346
  }
347
- class Be extends z {
347
+ class Be extends q {
348
348
  constructor(e, t) {
349
349
  super(), this.url = e, this.content = t;
350
350
  }
@@ -359,7 +359,7 @@ class Be extends z {
359
359
  return this.url === e.url;
360
360
  }
361
361
  }
362
- class Ae extends z {
362
+ class Ae extends q {
363
363
  constructor(e, t, s) {
364
364
  super(), this.alt = e, this.url = t, this.content = s;
365
365
  }
@@ -374,7 +374,7 @@ class Ae extends z {
374
374
  return this.alt === e.alt && this.url === e.url;
375
375
  }
376
376
  }
377
- class ge extends Y {
377
+ class pe extends Y {
378
378
  constructor(e, t, s) {
379
379
  super(), this.tokenType = e, this.content = t, this.leadingTrivia = s;
380
380
  }
@@ -386,16 +386,16 @@ class ge extends Y {
386
386
  return se(this.content, "content");
387
387
  }
388
388
  mapChildren(e) {
389
- return new ge(this.tokenType, A(e, this.content), te(e, this.leadingTrivia));
389
+ return new pe(this.tokenType, A(e, this.content), te(e, this.leadingTrivia));
390
390
  }
391
391
  withLeadingTrivia(e) {
392
- return new ge(this.tokenType, this.content, e);
392
+ return new pe(this.tokenType, this.content, e);
393
393
  }
394
394
  _localEquals(e) {
395
395
  return this.tokenType === e.tokenType;
396
396
  }
397
397
  }
398
- class le extends Y {
398
+ class de extends Y {
399
399
  constructor(e, t, s, i) {
400
400
  super(), this.level = e, this.marker = t, this.content = s, this.leadingTrivia = i;
401
401
  }
@@ -404,10 +404,10 @@ class le extends Y {
404
404
  return this._withLeading([this.marker, ...this.content]);
405
405
  }
406
406
  mapChildren(e) {
407
- return new le(this.level, J(e, this.marker), A(e, this.content), te(e, this.leadingTrivia));
407
+ return new de(this.level, J(e, this.marker), A(e, this.content), te(e, this.leadingTrivia));
408
408
  }
409
409
  withLeadingTrivia(e) {
410
- return new le(this.level, this.marker, this.content, e);
410
+ return new de(this.level, this.marker, this.content, e);
411
411
  }
412
412
  _localEquals(e) {
413
413
  return this.level === e.level;
@@ -510,7 +510,7 @@ class U extends Y {
510
510
  return { stringEdit: this._contentEdit };
511
511
  }
512
512
  }
513
- class pe extends Y {
513
+ class _e extends Y {
514
514
  constructor(e, t) {
515
515
  super(), this.content = e, this.leadingTrivia = t;
516
516
  }
@@ -522,10 +522,10 @@ class pe extends Y {
522
522
  return se(this.content, "content");
523
523
  }
524
524
  mapChildren(e) {
525
- return new pe(A(e, this.content), te(e, this.leadingTrivia));
525
+ return new _e(A(e, this.content), te(e, this.leadingTrivia));
526
526
  }
527
527
  withLeadingTrivia(e) {
528
- return new pe(this.content, e);
528
+ return new _e(this.content, e);
529
529
  }
530
530
  }
531
531
  class Ce extends Y {
@@ -546,7 +546,7 @@ class Ce extends Y {
546
546
  return new Ce(this.content, e);
547
547
  }
548
548
  }
549
- class W extends Y {
549
+ class K extends Y {
550
550
  constructor(e, t, s) {
551
551
  super(), this.ordered = e, this.content = t, this.leadingTrivia = s;
552
552
  }
@@ -555,19 +555,19 @@ class W extends Y {
555
555
  return this._withLeading(this.content);
556
556
  }
557
557
  get items() {
558
- return this.content.filter((e) => e instanceof K);
558
+ return this.content.filter((e) => e instanceof z);
559
559
  }
560
560
  mapChildren(e) {
561
- return new W(this.ordered, A(e, this.content), te(e, this.leadingTrivia));
561
+ return new K(this.ordered, A(e, this.content), te(e, this.leadingTrivia));
562
562
  }
563
563
  withLeadingTrivia(e) {
564
- return new W(this.ordered, this.content, e);
564
+ return new K(this.ordered, this.content, e);
565
565
  }
566
566
  _localEquals(e) {
567
567
  return this.ordered === e.ordered;
568
568
  }
569
569
  }
570
- class K extends z {
570
+ class z extends q {
571
571
  constructor(e, t, s, i) {
572
572
  super(), this.marker = e, this.content = t, this.checked = s, this.leadingTrivia = i;
573
573
  }
@@ -579,7 +579,7 @@ class K extends z {
579
579
  return this.content.filter(Dt);
580
580
  }
581
581
  mapChildren(e) {
582
- return new K(
582
+ return new z(
583
583
  J(e, this.marker),
584
584
  A(e, this.content),
585
585
  this.checked,
@@ -587,7 +587,7 @@ class K extends z {
587
587
  );
588
588
  }
589
589
  withLeadingTrivia(e) {
590
- return new K(this.marker, this.content, this.checked, e);
590
+ return new z(this.marker, this.content, this.checked, e);
591
591
  }
592
592
  _localEquals(e) {
593
593
  return this.checked === e.checked;
@@ -620,7 +620,7 @@ class Se extends Y {
620
620
  return new Se(this.content, e);
621
621
  }
622
622
  }
623
- class Re extends z {
623
+ class Re extends q {
624
624
  constructor(e) {
625
625
  super(), this.content = e;
626
626
  }
@@ -635,7 +635,7 @@ class Re extends z {
635
635
  return new Re(A(e, this.content));
636
636
  }
637
637
  }
638
- class Ne extends z {
638
+ class Ne extends q {
639
639
  constructor(e) {
640
640
  super(), this.content = e;
641
641
  }
@@ -647,7 +647,7 @@ class Ne extends z {
647
647
  return new Ne(A(e, this.content));
648
648
  }
649
649
  }
650
- class Pt extends z {
650
+ class Pt extends q {
651
651
  constructor(e) {
652
652
  super(), this.content = e;
653
653
  }
@@ -663,14 +663,14 @@ class Pt extends z {
663
663
  }
664
664
  }
665
665
  function Dt(n) {
666
- return n instanceof le || n instanceof ee || n instanceof Ee || n instanceof U || n instanceof pe || n instanceof me || n instanceof Ce || n instanceof W || n instanceof Se || n instanceof ge;
666
+ return n instanceof de || n instanceof ee || n instanceof Ee || n instanceof U || n instanceof _e || n instanceof ge || n instanceof Ce || n instanceof K || n instanceof Se || n instanceof pe;
667
667
  }
668
- function de(n, e) {
668
+ function he(n, e) {
669
669
  if (n.id === e.id)
670
670
  return 0;
671
671
  let t = 0;
672
672
  for (const s of n.children) {
673
- const i = de(s, e);
673
+ const i = he(s, e);
674
674
  if (i !== void 0)
675
675
  return t + i;
676
676
  t += s.length;
@@ -713,15 +713,15 @@ function Ve(n) {
713
713
  const e = [];
714
714
  for (let t = 0; t < n.length; t++) {
715
715
  const s = n[t], i = n[t + 1];
716
- if (s instanceof H && s.glueKind === "indent") {
716
+ if (s instanceof W && s.glueKind === "indent") {
717
717
  const o = i !== void 0 ? Ci(i, s) : void 0;
718
718
  if (o) {
719
719
  e.push(o), t++;
720
720
  continue;
721
721
  }
722
722
  const r = e[e.length - 1];
723
- if (r instanceof H && r.glueKind === void 0) {
724
- e[e.length - 1] = new H(r.content + s.content);
723
+ if (r instanceof W && r.glueKind === void 0) {
724
+ e[e.length - 1] = new W(r.content + s.content);
725
725
  continue;
726
726
  }
727
727
  e.push(s);
@@ -732,22 +732,22 @@ function Ve(n) {
732
732
  return e;
733
733
  }
734
734
  function Ci(n, e) {
735
- if (n instanceof W) {
736
- const t = n.content.findIndex((i) => i instanceof K);
735
+ if (n instanceof K) {
736
+ const t = n.content.findIndex((i) => i instanceof z);
737
737
  if (t < 0)
738
738
  return;
739
739
  const s = n.content.map((i, o) => o === t ? i.withLeadingTrivia(e) : i);
740
- return new W(n.ordered, s, n.leadingTrivia);
740
+ return new K(n.ordered, s, n.leadingTrivia);
741
741
  }
742
- if (n instanceof K || n instanceof Y)
742
+ if (n instanceof z || n instanceof Y)
743
743
  return n.withLeadingTrivia(e);
744
744
  }
745
745
  function $e(n) {
746
746
  const e = [];
747
747
  for (let t = 0; t < n.length; t++) {
748
748
  const s = n[t];
749
- if (s instanceof H && s.glueKind === void 0) {
750
- const i = e[e.length - 1], o = n[t + 1], r = i instanceof ee && o instanceof ee, c = new H(s.content, r ? "blockBreak" : "blockGap"), a = i !== void 0 ? ds(i, c) : void 0;
749
+ if (s instanceof W && s.glueKind === void 0) {
750
+ const i = e[e.length - 1], o = n[t + 1], r = i instanceof ee && o instanceof ee, c = new W(s.content, r ? "blockBreak" : "blockGap"), a = i !== void 0 ? ds(i, c) : void 0;
751
751
  a ? e[e.length - 1] = a : e.push(c);
752
752
  continue;
753
753
  }
@@ -763,7 +763,7 @@ function ds(n, e) {
763
763
  }
764
764
  case "heading": {
765
765
  const t = n;
766
- return new le(t.level, t.marker, [...t.content, e], t.leadingTrivia);
766
+ return new de(t.level, t.marker, [...t.content, e], t.leadingTrivia);
767
767
  }
768
768
  case "codeBlock": {
769
769
  const t = n;
@@ -775,15 +775,15 @@ function ds(n, e) {
775
775
  }
776
776
  case "mathBlock": {
777
777
  const t = n;
778
- return new pe([...t.content, e], t.leadingTrivia);
778
+ return new _e([...t.content, e], t.leadingTrivia);
779
779
  }
780
780
  case "thematicBreak": {
781
781
  const t = n;
782
- return new me([...t.content, e], t.leadingTrivia);
782
+ return new ge([...t.content, e], t.leadingTrivia);
783
783
  }
784
784
  case "unhandledBlock": {
785
785
  const t = n;
786
- return new ge(t.tokenType, [...t.content, e], t.leadingTrivia);
786
+ return new pe(t.tokenType, [...t.content, e], t.leadingTrivia);
787
787
  }
788
788
  case "table": {
789
789
  const t = n;
@@ -795,11 +795,11 @@ function ds(n, e) {
795
795
  }
796
796
  case "list": {
797
797
  const t = n;
798
- return new W(t.ordered, lt(t.content, e), t.leadingTrivia);
798
+ return new K(t.ordered, lt(t.content, e), t.leadingTrivia);
799
799
  }
800
800
  case "listItem": {
801
801
  const t = n;
802
- return new K(t.marker, lt(t.content, e), t.checked, t.leadingTrivia);
802
+ return new z(t.marker, lt(t.content, e), t.checked, t.leadingTrivia);
803
803
  }
804
804
  default:
805
805
  return;
@@ -814,7 +814,7 @@ function lt(n, e) {
814
814
  return [...n, e];
815
815
  }
816
816
  function Si(n) {
817
- return n.some((e) => !(e instanceof H)) ? n : [new ee(n)];
817
+ return n.some((e) => !(e instanceof W)) ? n : [new ee(n)];
818
818
  }
819
819
  class I {
820
820
  constructor(e, t) {
@@ -831,11 +831,11 @@ class I {
831
831
  const o = this._parentStart + e, r = (c, a) => {
832
832
  const l = this._source.substring(c, a), d = t ? null : /\n[^\S\n]+$/.exec(l);
833
833
  if (!d) {
834
- s.push(new H(l, t));
834
+ s.push(new W(l, t));
835
835
  return;
836
836
  }
837
837
  const u = l.slice(d.index + 1);
838
- s.push(new H(l.slice(0, l.length - u.length))), s.push(new H(u, "indent"));
838
+ s.push(new W(l.slice(0, l.length - u.length))), s.push(new W(u, "indent"));
839
839
  };
840
840
  for (const { node: c, start: a } of this._entries)
841
841
  c.length !== 0 && (a > i && r(i, a), s.push(c), i = a + c.length);
@@ -910,7 +910,7 @@ class Li {
910
910
  r.tokenType === t && (s += r.type === "enter" ? 1 : -1), s === 0 && (i = r), this._idx++;
911
911
  }
912
912
  const o = this._source.substring(e.startOffset, i.endOffset);
913
- return new ge(t, [new E("content", o)]);
913
+ return new pe(t, [new E("content", o)]);
914
914
  }
915
915
  /**
916
916
  * Decides what to do with an unrecognized `enter` token at the top of a
@@ -947,7 +947,7 @@ class Li {
947
947
  for (const d of o)
948
948
  a.add(d.node, d.start);
949
949
  const l = a.build(r.endOffset - i);
950
- return new le(t, c, l);
950
+ return new de(t, c, l);
951
951
  }
952
952
  _parseParagraph() {
953
953
  const e = this._consume("enter", "paragraph"), t = [];
@@ -1050,14 +1050,14 @@ class Li {
1050
1050
  } else c.tokenType === "mathFlowValue" || c.tokenType === "lineEnding" ? (i === void 0 && (i = c.startOffset), o = c.endOffset, this._idx++) : this._idx++;
1051
1051
  }
1052
1052
  const r = this._consume("exit", "mathFlow");
1053
- return i !== void 0 && t.add(new E("content", this._source.substring(i, o)), i), new pe(t.build(r.endOffset - e.startOffset));
1053
+ return i !== void 0 && t.add(new E("content", this._source.substring(i, o)), i), new _e(t.build(r.endOffset - e.startOffset));
1054
1054
  }
1055
1055
  _parseThematicBreak() {
1056
1056
  const e = this._consume("enter", "thematicBreak");
1057
1057
  for (; this._notExit("thematicBreak"); )
1058
1058
  this._idx++;
1059
1059
  const t = this._consume("exit", "thematicBreak"), s = new E("content", this._source.substring(e.startOffset, t.endOffset));
1060
- return new me([s]);
1060
+ return new ge([s]);
1061
1061
  }
1062
1062
  _parseBlockQuote() {
1063
1063
  const e = this._consume("enter", "blockQuote"), t = new I(e.startOffset, this._source);
@@ -1091,7 +1091,7 @@ class Li {
1091
1091
  if (o === void 0 || r === void 0 || a === void 0)
1092
1092
  return;
1093
1093
  const f = new E("listItemMarker", this._source.substring(r, c)), m = d ?? c, g = a.build(m - c);
1094
- i.add(new K(f, $e(Ve(g)), l), o);
1094
+ i.add(new z(f, $e(Ve(g)), l), o);
1095
1095
  };
1096
1096
  for (; this._notExit(e); ) {
1097
1097
  const f = this._events[this._idx];
@@ -1104,15 +1104,15 @@ class Li {
1104
1104
  if (g && a)
1105
1105
  a.add(g, m), d = m + g.length, l === void 0 && this._checkChecked !== void 0 && (l = this._checkChecked);
1106
1106
  else if (!g) {
1107
- const p = this._tryParseUnhandled(d ?? c ?? m);
1108
- p && a && (a.add(p.node, p.start), d = p.start + p.node.length);
1107
+ const _ = this._tryParseUnhandled(d ?? c ?? m);
1108
+ _ && a && (a.add(_.node, _.start), d = _.start + _.node.length);
1109
1109
  }
1110
1110
  } else
1111
1111
  this._idx++;
1112
1112
  }
1113
1113
  u();
1114
1114
  const h = this._consume("exit", e);
1115
- return new W(t, $e(Ve(i.build(h.endOffset - s.startOffset))));
1115
+ return new K(t, $e(Ve(i.build(h.endOffset - s.startOffset))));
1116
1116
  }
1117
1117
  _parseTable() {
1118
1118
  const e = this._consume("enter", "table"), t = new I(e.startOffset, this._source);
@@ -1406,7 +1406,7 @@ class hs {
1406
1406
  return e - t;
1407
1407
  }
1408
1408
  }
1409
- class Ti {
1409
+ class Mi {
1410
1410
  _byRange = /* @__PURE__ */ new Map();
1411
1411
  _byId = /* @__PURE__ */ new Map();
1412
1412
  constructor(e) {
@@ -1444,13 +1444,13 @@ function us(n, e, t, s, i) {
1444
1444
  }
1445
1445
  const l = t.getOriginalOffset(e), d = l !== void 0 ? s.lookupId(l, c.kind) : void 0;
1446
1446
  if (d && d.id !== c.id && (c = c.cloneWithId(d.id)), c instanceof U && d instanceof U && l !== void 0) {
1447
- const u = Mi(c, d, l, i);
1447
+ const u = Ti(c, d, l, i);
1448
1448
  if (u)
1449
1449
  return u;
1450
1450
  }
1451
1451
  return c;
1452
1452
  }
1453
- function Mi(n, e, t, s) {
1453
+ function Ti(n, e, t, s) {
1454
1454
  const i = e.code, o = n.code;
1455
1455
  if (!i || !o || n.language !== e.language || n.openFence?.content !== e.openFence?.content || n.closeFence?.content !== e.closeFence?.content)
1456
1456
  return;
@@ -1468,10 +1468,10 @@ function Oi(n, e, t) {
1468
1468
  return !0;
1469
1469
  }
1470
1470
  function Ri(n, e) {
1471
- return new T(n.replacements.map((t) => ie.replace(t.replaceRange.delta(e), t.newText)));
1471
+ return new M(n.replacements.map((t) => ie.replace(t.replaceRange.delta(e), t.newText)));
1472
1472
  }
1473
1473
  function Ni(n, e, t) {
1474
- return us(n, 0, new hs(t), new Ti(e), t);
1474
+ return us(n, 0, new hs(t), new Mi(e), t);
1475
1475
  }
1476
1476
  function Ii(n, e, t) {
1477
1477
  const s = xi(n);
@@ -1497,13 +1497,13 @@ function Ai(n, e, t = 0) {
1497
1497
  }
1498
1498
  function jt(n) {
1499
1499
  const e = {};
1500
- return n instanceof le ? e.level = String(n.level) : n instanceof W ? e.ordered = String(n.ordered) : n instanceof U ? n.language && (e.language = n.language) : n instanceof Be ? e.url = n.url : n instanceof Ae ? (e.alt = n.alt, e.url = n.url) : n instanceof K ? n.checked !== void 0 && (e.checked = String(n.checked)) : n instanceof ge ? e.token = n.tokenType : n instanceof H && n.glueKind && (e.kind = n.glueKind), Object.entries(e).map(([t, s]) => ` ${t}="${fs(s)}"`).join("");
1500
+ return n instanceof de ? e.level = String(n.level) : n instanceof K ? e.ordered = String(n.ordered) : n instanceof U ? n.language && (e.language = n.language) : n instanceof Be ? e.url = n.url : n instanceof Ae ? (e.alt = n.alt, e.url = n.url) : n instanceof z ? n.checked !== void 0 && (e.checked = String(n.checked)) : n instanceof pe ? e.token = n.tokenType : n instanceof W && n.glueKind && (e.kind = n.glueKind), Object.entries(e).map(([t, s]) => ` ${t}="${fs(s)}"`).join("");
1501
1501
  }
1502
1502
  function fs(n) {
1503
1503
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1504
1504
  }
1505
1505
  function Pi(n) {
1506
- return n instanceof Oe ? `text ${JSON.stringify(n.content)}` : n instanceof H ? `glue${n.glueKind ? `(${n.glueKind})` : ""} ${JSON.stringify(n.content)}` : n instanceof E ? `marker(${n.markerKind}) ${JSON.stringify(n.content)}` : n instanceof me ? `thematicBreak ${JSON.stringify(n.content)}` : n instanceof le ? `heading(level=${n.level})` : n instanceof W ? `list(ordered=${n.ordered})` : n instanceof K ? n.checked === void 0 ? "listItem" : `listItem(checked=${n.checked})` : n instanceof U ? `codeBlock(language=${JSON.stringify(n.language)})` : n instanceof pe ? "mathBlock" : n instanceof Be ? `link(url=${JSON.stringify(n.url)})` : n instanceof Ae ? `image(alt=${JSON.stringify(n.alt)}, url=${JSON.stringify(n.url)})` : n.kind;
1506
+ return n instanceof Oe ? `text ${JSON.stringify(n.content)}` : n instanceof W ? `glue${n.glueKind ? `(${n.glueKind})` : ""} ${JSON.stringify(n.content)}` : n instanceof E ? `marker(${n.markerKind}) ${JSON.stringify(n.content)}` : n instanceof ge ? `thematicBreak ${JSON.stringify(n.content)}` : n instanceof de ? `heading(level=${n.level})` : n instanceof K ? `list(ordered=${n.ordered})` : n instanceof z ? n.checked === void 0 ? "listItem" : `listItem(checked=${n.checked})` : n instanceof U ? `codeBlock(language=${JSON.stringify(n.language)})` : n instanceof _e ? "mathBlock" : n instanceof Be ? `link(url=${JSON.stringify(n.url)})` : n instanceof Ae ? `image(alt=${JSON.stringify(n.alt)}, url=${JSON.stringify(n.url)})` : n.kind;
1507
1507
  }
1508
1508
  const Qt = /* @__PURE__ */ new WeakMap();
1509
1509
  let Di = 0;
@@ -1548,7 +1548,7 @@ function Ki(n, e) {
1548
1548
  return zi(t.edits.stripData());
1549
1549
  }
1550
1550
  function zi(n) {
1551
- return new T(n.replacements.map((e) => ie.replace(new w(e.range.start, e.range.endExclusive), e.newText)));
1551
+ return new M(n.replacements.map((e) => ie.replace(new w(e.range.start, e.range.endExclusive), e.newText)));
1552
1552
  }
1553
1553
  const qi = /* @__PURE__ */ new Set([
1554
1554
  "document",
@@ -1787,7 +1787,7 @@ class nl {
1787
1787
  */
1788
1788
  armPendingParagraph(e) {
1789
1789
  ne((t) => {
1790
- this.pendingParagraph.set({ ...e, syntheticAst: new ee([]) }, t), this.selectionSource.set("user", t), this.selection.set(b.collapsed(e.replaceRange.start), t);
1790
+ this.pendingParagraph.set({ ...e, syntheticAst: new ee([]) }, t), this.selectionSource.set("user", t), this.selection.set(k.collapsed(e.replaceRange.start), t);
1791
1791
  });
1792
1792
  }
1793
1793
  /** Discard the pending paragraph (if any) without touching the source. */
@@ -1800,7 +1800,7 @@ class nl {
1800
1800
  * state anchored to the previous parse.
1801
1801
  */
1802
1802
  replaceSourceText(e) {
1803
- const t = this.sourceText.get(), s = os(t.value, e.value), i = this.selection.get(), o = i ? new b(
1803
+ const t = this.sourceText.get(), s = os(t.value, e.value), i = this.selection.get(), o = i ? new k(
1804
1804
  He(s.mapOffset(He(i.anchor, t.value.length)), e.value.length),
1805
1805
  He(s.mapOffset(He(i.active, t.value.length)), e.value.length)
1806
1806
  ) : void 0;
@@ -1823,20 +1823,20 @@ class nl {
1823
1823
 
1824
1824
  ` + e + (t.atEof ? "" : `
1825
1825
 
1826
- `), i = t.replaceRange.start + 2 + e.length, o = T.replace(t.replaceRange, s);
1827
- this._applySourceEdit(o, b.collapsed(i));
1826
+ `), i = t.replaceRange.start + 2 + e.length, o = M.replace(t.replaceRange, s);
1827
+ this._applySourceEdit(o, k.collapsed(i));
1828
1828
  }
1829
1829
  applyEdit(e, t) {
1830
1830
  if (this.readonlyMode.get())
1831
1831
  return;
1832
- const s = this.selection.get() ?? b.collapsed(0), i = e.mapOffset(s.active);
1833
- this._applySourceEdit(e, t ?? b.collapsed(i));
1832
+ const s = this.selection.get() ?? k.collapsed(0), i = e.mapOffset(s.active);
1833
+ this._applySourceEdit(e, t ?? k.collapsed(i));
1834
1834
  }
1835
1835
  applyEditForSelection(e) {
1836
1836
  if (this.readonlyMode.get())
1837
1837
  return;
1838
- const t = this.selection.get() ?? b.collapsed(0), s = e.mapOffset(t.range.endExclusive);
1839
- this._applySourceEdit(e, b.collapsed(s));
1838
+ const t = this.selection.get() ?? k.collapsed(0), s = e.mapOffset(t.range.endExclusive);
1839
+ this._applySourceEdit(e, k.collapsed(s));
1840
1840
  }
1841
1841
  _applySourceEdit(e, t) {
1842
1842
  const s = this.sourceText.get(), i = new Yt(e.apply(s.value));
@@ -2146,33 +2146,33 @@ function Ji(n, e, t) {
2146
2146
  const g = f.dom;
2147
2147
  if (g.length === 0)
2148
2148
  return;
2149
- const p = document.createRange();
2150
- p.selectNodeContents(g);
2151
- const _ = p.getClientRects();
2152
- if (_.length === 0)
2149
+ const _ = document.createRange();
2150
+ _.selectNodeContents(g);
2151
+ const p = _.getClientRects();
2152
+ if (p.length === 0)
2153
2153
  return;
2154
- const v = eo(Array.from(_, (y) => t.toLocalRect(y))), k = no(g.parentElement);
2154
+ const v = eo(Array.from(p, (b) => t.toLocalRect(b))), y = no(g.parentElement);
2155
2155
  if (f.sourceLength === 0) {
2156
2156
  s.push(ye.visualLineAnchor(
2157
2157
  m,
2158
- ht(v[0], k)
2158
+ ht(v[0], y)
2159
2159
  ));
2160
2160
  return;
2161
2161
  }
2162
2162
  if (v.length === 1)
2163
2163
  s.push(new ye(
2164
2164
  w.fromTo(m, m + g.length),
2165
- ht(v[0], k),
2165
+ ht(v[0], y),
2166
2166
  { textNode: g, textNodeStart: 0, coordinateSpace: e }
2167
2167
  ));
2168
2168
  else {
2169
- const y = to(g, v, t);
2169
+ const b = to(g, v, t);
2170
2170
  for (let x = 0; x < v.length; x++) {
2171
- const O = x === 0 ? 0 : y[x - 1], G = x < y.length ? y[x] : g.length;
2171
+ const T = x === 0 ? 0 : b[x - 1], D = x < b.length ? b[x] : g.length;
2172
2172
  s.push(new ye(
2173
- w.fromTo(m + O, m + G),
2174
- ht(v[x], k),
2175
- { textNode: g, textNodeStart: O, coordinateSpace: e }
2173
+ w.fromTo(m + T, m + D),
2174
+ ht(v[x], y),
2175
+ { textNode: g, textNodeStart: T, coordinateSpace: e }
2176
2176
  ));
2177
2177
  }
2178
2178
  }
@@ -2525,40 +2525,40 @@ const fo = (n) => n.selection.isCollapsed ? Le(
2525
2525
  }, Vt = {
2526
2526
  tabSize: 4,
2527
2527
  insertSpaces: !0
2528
- }, Me = " ", sn = (n) => {
2528
+ }, Te = " ", sn = (n) => {
2529
2529
  const e = n.selection;
2530
2530
  if (!e.isCollapsed)
2531
2531
  return {
2532
- edit: T.delete(e.range),
2533
- selection: b.collapsed(e.range.start)
2532
+ edit: M.delete(e.range),
2533
+ selection: k.collapsed(e.range.start)
2534
2534
  };
2535
2535
  if (e.active === 0)
2536
2536
  return;
2537
2537
  const t = new w(Le(n.document, n.markerVisibleBlocks, e.active, "left"), e.active);
2538
2538
  return {
2539
- edit: T.delete(t),
2540
- selection: b.collapsed(t.start)
2539
+ edit: M.delete(t),
2540
+ selection: k.collapsed(t.start)
2541
2541
  };
2542
2542
  }, xo = (n) => {
2543
2543
  const e = n.selection;
2544
2544
  if (!e.isCollapsed)
2545
2545
  return {
2546
- edit: T.delete(e.range),
2547
- selection: b.collapsed(e.range.start)
2546
+ edit: M.delete(e.range),
2547
+ selection: k.collapsed(e.range.start)
2548
2548
  };
2549
2549
  if (e.active >= n.text.length)
2550
2550
  return;
2551
2551
  const t = new w(e.active, Le(n.document, n.markerVisibleBlocks, e.active, "right"));
2552
2552
  return {
2553
- edit: T.delete(t),
2554
- selection: b.collapsed(t.start)
2553
+ edit: M.delete(t),
2554
+ selection: k.collapsed(t.start)
2555
2555
  };
2556
2556
  }, Eo = (n) => {
2557
2557
  const e = n.selection;
2558
2558
  if (!e.isCollapsed)
2559
2559
  return {
2560
- edit: T.delete(e.range),
2561
- selection: b.collapsed(e.range.start)
2560
+ edit: M.delete(e.range),
2561
+ selection: k.collapsed(e.range.start)
2562
2562
  };
2563
2563
  if (e.active === 0)
2564
2564
  return;
@@ -2566,14 +2566,14 @@ const fo = (n) => n.selection.isCollapsed ? Le(
2566
2566
  if (!i.isEmpty)
2567
2567
  return {
2568
2568
  edit: i,
2569
- selection: b.collapsed(i.mapOffset(t))
2569
+ selection: k.collapsed(i.mapOffset(t))
2570
2570
  };
2571
2571
  }, Co = (n) => {
2572
2572
  const e = n.selection;
2573
2573
  if (!e.isCollapsed)
2574
2574
  return {
2575
- edit: T.delete(e.range),
2576
- selection: b.collapsed(e.range.start)
2575
+ edit: M.delete(e.range),
2576
+ selection: k.collapsed(e.range.start)
2577
2577
  };
2578
2578
  if (e.active >= n.text.length)
2579
2579
  return;
@@ -2581,14 +2581,14 @@ const fo = (n) => n.selection.isCollapsed ? Le(
2581
2581
  if (!i.isEmpty)
2582
2582
  return {
2583
2583
  edit: i,
2584
- selection: b.collapsed(i.mapOffset(e.active))
2584
+ selection: k.collapsed(i.mapOffset(e.active))
2585
2585
  };
2586
2586
  }, So = (n) => {
2587
2587
  const e = n.selection;
2588
2588
  if (!e.isCollapsed)
2589
2589
  return {
2590
- edit: T.delete(e.range),
2591
- selection: b.collapsed(e.range.start)
2590
+ edit: M.delete(e.range),
2591
+ selection: k.collapsed(e.range.start)
2592
2592
  };
2593
2593
  if (e.active === 0)
2594
2594
  return;
@@ -2600,14 +2600,14 @@ const fo = (n) => n.selection.isCollapsed ? Le(
2600
2600
  if (!s.isEmpty)
2601
2601
  return {
2602
2602
  edit: s,
2603
- selection: b.collapsed(s.mapOffset(t))
2603
+ selection: k.collapsed(s.mapOffset(t))
2604
2604
  };
2605
2605
  }, Lo = (n) => {
2606
2606
  const e = n.selection;
2607
2607
  if (!e.isCollapsed)
2608
2608
  return {
2609
- edit: T.delete(e.range),
2610
- selection: b.collapsed(e.range.start)
2609
+ edit: M.delete(e.range),
2610
+ selection: k.collapsed(e.range.start)
2611
2611
  };
2612
2612
  const t = n.text.indexOf(`
2613
2613
  `, e.active), s = t === -1 ? n.text.length : t === e.active ? t + 1 : t;
@@ -2617,7 +2617,7 @@ const fo = (n) => n.selection.isCollapsed ? Le(
2617
2617
  if (!i.isEmpty)
2618
2618
  return {
2619
2619
  edit: i,
2620
- selection: b.collapsed(i.mapOffset(e.active))
2620
+ selection: k.collapsed(i.mapOffset(e.active))
2621
2621
  };
2622
2622
  };
2623
2623
  function ot(n, e) {
@@ -2633,43 +2633,43 @@ function ot(n, e) {
2633
2633
  break;
2634
2634
  s < i.start && t.push(ie.delete(new w(s, Math.min(i.start, e.endExclusive)))), s = Math.max(s, i.endExclusive);
2635
2635
  }
2636
- return s < e.endExclusive && t.push(ie.delete(new w(s, e.endExclusive))), t.length === 0 ? T.empty : new T(t);
2636
+ return s < e.endExclusive && t.push(ie.delete(new w(s, e.endExclusive))), t.length === 0 ? M.empty : new M(t);
2637
2637
  }
2638
- function To(n) {
2638
+ function Mo(n) {
2639
2639
  return (e) => {
2640
- const t = T.replace(e.selection.range, n), s = e.selection.range.start + n.length;
2640
+ const t = M.replace(e.selection.range, n), s = e.selection.range.start + n.length;
2641
2641
  return {
2642
2642
  edit: t,
2643
- selection: b.collapsed(s)
2643
+ selection: k.collapsed(s)
2644
2644
  };
2645
2645
  };
2646
2646
  }
2647
- function Mo(n = Vt) {
2648
- return Ts(n), (e) => {
2649
- const t = e.selection, s = t.range, i = $(e.text, s.start), o = on(e.text, s.start), c = s.endExclusive <= o && (s.start !== i || s.endExclusive !== o), a = t.isCollapsed ? Cs(e.document, e.text, t.active) : void 0, l = a ? de(e.document, a.item) : void 0, d = a ? de(e.document, a.item.marker) : void 0;
2650
- if (a && l !== void 0 && d !== void 0 && $(e.text, d) === i) {
2647
+ function To(n = Vt) {
2648
+ return Ms(n), (e) => {
2649
+ const t = e.selection, s = t.range, i = H(e.text, s.start), o = on(e.text, s.start), c = s.endExclusive <= o && (s.start !== i || s.endExclusive !== o), a = t.isCollapsed ? Cs(e.document, e.text, t.active) : void 0, l = a ? he(e.document, a.item) : void 0, d = a ? he(e.document, a.item.marker) : void 0;
2650
+ if (a && l !== void 0 && d !== void 0 && H(e.text, d) === i) {
2651
2651
  const m = Ss(
2652
2652
  e.text,
2653
2653
  l,
2654
2654
  l + a.item.length,
2655
- Ls(e.text, $(e.text, d), d)
2655
+ Ls(e.text, H(e.text, d), d)
2656
2656
  ), g = m[0];
2657
- if (a.index === 0 && d - g >= Me.length)
2657
+ if (a.index === 0 && d - g >= Te.length)
2658
2658
  return;
2659
- const p = m.filter((v) => v < on(e.text, v)).map((v) => ie.insert(v, Me)), _ = new T(p);
2659
+ const _ = m.filter((v) => v < on(e.text, v)).map((v) => ie.insert(v, Te)), p = new M(_);
2660
2660
  return {
2661
- edit: _,
2662
- selection: b.collapsed(_.mapOffset(t.active))
2661
+ edit: p,
2662
+ selection: k.collapsed(p.mapOffset(t.active))
2663
2663
  };
2664
2664
  }
2665
2665
  if (t.isCollapsed || c) {
2666
2666
  const m = Ho(e.text, s.start, n);
2667
2667
  return {
2668
- edit: T.replace(s, m),
2669
- selection: b.collapsed(s.start + m.length)
2668
+ edit: M.replace(s, m),
2669
+ selection: k.collapsed(s.start + m.length)
2670
2670
  };
2671
2671
  }
2672
- const u = xs(e.text, s), h = u.map((m) => ie.insert(m, Wo(n))), f = new T(h);
2672
+ const u = xs(e.text, s), h = u.map((m) => ie.insert(m, Wo(n))), f = new M(h);
2673
2673
  return {
2674
2674
  edit: f,
2675
2675
  selection: Uo(f, t, new Set(u))
@@ -2677,22 +2677,22 @@ function Mo(n = Vt) {
2677
2677
  };
2678
2678
  }
2679
2679
  function Oo(n = Vt) {
2680
- return Ts(n), (e) => {
2680
+ return Ms(n), (e) => {
2681
2681
  if (e.selection.isCollapsed) {
2682
- const i = Cs(e.document, e.text, e.selection.active), o = i ? de(e.document, i.item) : void 0, r = i ? de(e.document, i.item.marker) : void 0;
2683
- if (i && o !== void 0 && r !== void 0 && $(e.text, r) === $(e.text, e.selection.active)) {
2682
+ const i = Cs(e.document, e.text, e.selection.active), o = i ? he(e.document, i.item) : void 0, r = i ? he(e.document, i.item.marker) : void 0;
2683
+ if (i && o !== void 0 && r !== void 0 && H(e.text, r) === H(e.text, e.selection.active)) {
2684
2684
  const c = Ss(
2685
2685
  e.text,
2686
2686
  o,
2687
2687
  o + i.item.length,
2688
- Ls(e.text, $(e.text, r), r)
2689
- ).flatMap((l) => e.text.slice(l, l + Me.length) === Me ? [ie.delete(new w(l, l + Me.length))] : []);
2688
+ Ls(e.text, H(e.text, r), r)
2689
+ ).flatMap((l) => e.text.slice(l, l + Te.length) === Te ? [ie.delete(new w(l, l + Te.length))] : []);
2690
2690
  if (c.length === 0)
2691
2691
  return;
2692
- const a = new T(c);
2692
+ const a = new M(c);
2693
2693
  return {
2694
2694
  edit: a,
2695
- selection: b.collapsed(a.mapOffset(e.selection.active))
2695
+ selection: k.collapsed(a.mapOffset(e.selection.active))
2696
2696
  };
2697
2697
  }
2698
2698
  }
@@ -2709,7 +2709,7 @@ function Oo(n = Vt) {
2709
2709
  }
2710
2710
  if (t.length === 0)
2711
2711
  return;
2712
- const s = new T(t);
2712
+ const s = new M(t);
2713
2713
  return {
2714
2714
  edit: s,
2715
2715
  selection: Go(s, e.selection)
@@ -2717,19 +2717,19 @@ function Oo(n = Vt) {
2717
2717
  };
2718
2718
  }
2719
2719
  const Ro = (n) => {
2720
- const e = T.replace(n.selection.range, `
2720
+ const e = M.replace(n.selection.range, `
2721
2721
 
2722
2722
  `), t = n.selection.range.start + 2;
2723
2723
  return {
2724
2724
  edit: e,
2725
- selection: b.collapsed(t)
2725
+ selection: k.collapsed(t)
2726
2726
  };
2727
2727
  }, No = (n) => {
2728
- const e = T.replace(n.selection.range, `
2728
+ const e = M.replace(n.selection.range, `
2729
2729
  `), t = n.selection.range.start + 1;
2730
2730
  return {
2731
2731
  edit: e,
2732
- selection: b.collapsed(t)
2732
+ selection: k.collapsed(t)
2733
2733
  };
2734
2734
  }, Io = (n) => {
2735
2735
  const e = n.selection.range.start;
@@ -2737,10 +2737,10 @@ const Ro = (n) => {
2737
2737
  for (; t < 2 && n.text[e - 1 - t] === " "; )
2738
2738
  t++;
2739
2739
  const i = " ".repeat(2 - t) + `
2740
- `, o = T.replace(n.selection.range, i), r = e + i.length;
2740
+ `, o = M.replace(n.selection.range, i), r = e + i.length;
2741
2741
  return {
2742
2742
  edit: o,
2743
- selection: b.collapsed(r)
2743
+ selection: k.collapsed(r)
2744
2744
  };
2745
2745
  }, Bo = (n) => {
2746
2746
  const e = n.selection, t = n.activeBlock;
@@ -2769,10 +2769,10 @@ function Ao(n, e) {
2769
2769
  const i = $t(e, s);
2770
2770
  return t.active < i ? {
2771
2771
  kind: "edit",
2772
- edit: T.replace(t.range, `
2772
+ edit: M.replace(t.range, `
2773
2773
 
2774
2774
  `),
2775
- selection: b.collapsed(t.range.start + 2)
2775
+ selection: k.collapsed(t.range.start + 2)
2776
2776
  } : ks(n, e, s);
2777
2777
  }
2778
2778
  function Po(n, e) {
@@ -2816,10 +2816,10 @@ function Fo(n, e) {
2816
2816
  const i = it(e, t.active - s);
2817
2817
  if (i === void 0)
2818
2818
  return xe(n);
2819
- const o = e.items[i], r = de(n.document, o);
2819
+ const o = e.items[i], r = he(n.document, o);
2820
2820
  if (r === void 0)
2821
2821
  return xe(n);
2822
- if (!Ms(o))
2822
+ if (!Ts(o))
2823
2823
  return ys(n, r, r + o.length);
2824
2824
  const c = `
2825
2825
  ` + Vo(e, o);
@@ -2830,14 +2830,14 @@ function ys(n, e, t) {
2830
2830
  `, e - 1) : -1;
2831
2831
  return s >= 0 ? {
2832
2832
  kind: "edit",
2833
- edit: T.replace(new w(s, t), `
2833
+ edit: M.replace(new w(s, t), `
2834
2834
 
2835
2835
  `),
2836
- selection: b.collapsed(s + 2)
2836
+ selection: k.collapsed(s + 2)
2837
2837
  } : {
2838
2838
  kind: "edit",
2839
- edit: T.replace(new w(e, t), ""),
2840
- selection: b.collapsed(e)
2839
+ edit: M.replace(new w(e, t), ""),
2840
+ selection: k.collapsed(e)
2841
2841
  };
2842
2842
  }
2843
2843
  function Vo(n, e) {
@@ -2854,8 +2854,8 @@ function Vo(n, e) {
2854
2854
  function Ht(n, e) {
2855
2855
  return {
2856
2856
  kind: "edit",
2857
- edit: T.replace(n.range, e),
2858
- selection: b.collapsed(n.range.start + e.length)
2857
+ edit: M.replace(n.range, e),
2858
+ selection: k.collapsed(n.range.start + e.length)
2859
2859
  };
2860
2860
  }
2861
2861
  function $o(n, e) {
@@ -2863,7 +2863,7 @@ function $o(n, e) {
2863
2863
  `, e);
2864
2864
  return t === -1 ? n.length : t;
2865
2865
  }
2866
- function $(n, e) {
2866
+ function H(n, e) {
2867
2867
  return n.lastIndexOf(`
2868
2868
  `, Math.max(0, e - 1)) + 1;
2869
2869
  }
@@ -2873,7 +2873,7 @@ function on(n, e) {
2873
2873
  return t === -1 ? n.length : t;
2874
2874
  }
2875
2875
  function xs(n, e) {
2876
- const t = [$(n, e.start)], s = e.endExclusive > e.start && n[e.endExclusive - 1] === `
2876
+ const t = [H(n, e.start)], s = e.endExclusive > e.start && n[e.endExclusive - 1] === `
2877
2877
  ` ? e.endExclusive - 1 : e.endExclusive;
2878
2878
  let i = n.indexOf(`
2879
2879
  `, t[0]) + 1;
@@ -2885,7 +2885,7 @@ function xs(n, e) {
2885
2885
  function Ho(n, e, t) {
2886
2886
  if (!t.insertSpaces)
2887
2887
  return " ";
2888
- const s = Es(n.slice($(n, e), e), t.tabSize);
2888
+ const s = Es(n.slice(H(n, e), e), t.tabSize);
2889
2889
  return " ".repeat(t.tabSize - s % t.tabSize);
2890
2890
  }
2891
2891
  function Wo(n) {
@@ -2908,27 +2908,27 @@ function zo(n, e) {
2908
2908
  }
2909
2909
  function Cs(n, e, t) {
2910
2910
  const s = (c, a, l, d) => {
2911
- const u = c instanceof K && l !== void 0 && d !== void 0 ? { item: c, index: d } : void 0;
2911
+ const u = c instanceof z && l !== void 0 && d !== void 0 ? { item: c, index: d } : void 0;
2912
2912
  let h = a, f;
2913
2913
  for (const m of c.children) {
2914
- const g = h + m.length, p = c instanceof W && m instanceof K ? c : l, _ = c instanceof W && m instanceof K ? c.items.indexOf(m) : d;
2914
+ const g = h + m.length, _ = c instanceof K && m instanceof z ? c : l, p = c instanceof K && m instanceof z ? c.items.indexOf(m) : d;
2915
2915
  if (h <= t && t < g)
2916
- return s(m, h, p, _) ?? u;
2917
- g === t && (f = s(m, h, p, _) ?? u), h = g;
2916
+ return s(m, h, _, p) ?? u;
2917
+ g === t && (f = s(m, h, _, p) ?? u), h = g;
2918
2918
  }
2919
2919
  return f ?? u;
2920
2920
  }, i = s(n, 0, void 0, void 0);
2921
2921
  if (i) {
2922
- const c = de(n, i.item.marker);
2923
- if (c !== void 0 && $(e, c) === $(e, t))
2922
+ const c = he(n, i.item.marker);
2923
+ if (c !== void 0 && H(e, c) === H(e, t))
2924
2924
  return i;
2925
2925
  }
2926
2926
  let o;
2927
2927
  const r = (c) => {
2928
- if (c instanceof W)
2928
+ if (c instanceof K)
2929
2929
  for (let a = 0; a < c.items.length; a++) {
2930
- const l = c.items[a], d = de(n, l.marker);
2931
- d !== void 0 && $(e, d) === $(e, t) && (o = { item: l, index: a });
2930
+ const l = c.items[a], d = he(n, l.marker);
2931
+ d !== void 0 && H(e, d) === H(e, t) && (o = { item: l, index: a });
2932
2932
  }
2933
2933
  for (const a of c.children)
2934
2934
  r(a);
@@ -2937,7 +2937,7 @@ function Cs(n, e, t) {
2937
2937
  }
2938
2938
  function Ss(n, e, t, s) {
2939
2939
  const i = [];
2940
- let o = $(n, e);
2940
+ let o = H(n, e);
2941
2941
  for (; o < t; ) {
2942
2942
  i.push(qo(n, o, s));
2943
2943
  const r = n.indexOf(`
@@ -2973,7 +2973,7 @@ function qo(n, e, t) {
2973
2973
  return s;
2974
2974
  }
2975
2975
  function Go(n, e) {
2976
- return new b(n.mapOffset(e.anchor), n.mapOffset(e.active));
2976
+ return new k(n.mapOffset(e.anchor), n.mapOffset(e.active));
2977
2977
  }
2978
2978
  function Uo(n, e, t) {
2979
2979
  const s = (i) => {
@@ -2987,14 +2987,14 @@ function Uo(n, e, t) {
2987
2987
  }
2988
2988
  return i + o;
2989
2989
  };
2990
- return new b(s(e.anchor), s(e.active));
2990
+ return new k(s(e.anchor), s(e.active));
2991
2991
  }
2992
- function Ts(n) {
2992
+ function Ms(n) {
2993
2993
  if (!Number.isInteger(n.tabSize) || n.tabSize <= 0)
2994
2994
  throw new RangeError(`tabSize must be a positive integer, got ${n.tabSize}`);
2995
2995
  }
2996
- function Ms(n) {
2997
- return n instanceof Oe ? n.content.trim().length > 0 : n.children.some(Ms);
2996
+ function Ts(n) {
2997
+ return n instanceof Oe ? n.content.trim().length > 0 : n.children.some(Ts);
2998
2998
  }
2999
2999
  function xe(n) {
3000
3000
  const e = No(n);
@@ -3011,19 +3011,19 @@ function Wt(n, e) {
3011
3011
  function Xo(n) {
3012
3012
  const e = n.children;
3013
3013
  let t = 0;
3014
- for (let s = e.length - 1; s >= 0 && e[s] instanceof H; s--)
3014
+ for (let s = e.length - 1; s >= 0 && e[s] instanceof W; s--)
3015
3015
  t += e[s].length;
3016
3016
  return t;
3017
3017
  }
3018
- const Yo = (n) => new b(0, n.text.length), jo = (n, e) => {
3018
+ const Yo = (n) => new k(0, n.text.length), jo = (n, e) => {
3019
3019
  const t = as(n.text, e, n.wordNavigationConfig);
3020
- return new b(t.start, t.end);
3020
+ return new k(t.start, t.end);
3021
3021
  };
3022
3022
  function Qo(n, e) {
3023
- return new b(e.start, e.endExclusive);
3023
+ return new k(e.start, e.endExclusive);
3024
3024
  }
3025
3025
  const rn = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap();
3026
- class oe extends V {
3026
+ class oe extends $ {
3027
3027
  constructor(e, t, s = Zo) {
3028
3028
  super(), this.ast = e, this.dom = t, this._children = s, rn.set(t, this);
3029
3029
  for (const i of s)
@@ -3224,7 +3224,7 @@ class R extends oe {
3224
3224
  * single identity check captures "nothing in my subtree changed" — and its
3225
3225
  * whole subtree, and any session it owns, are kept as-is.
3226
3226
  */
3227
- canReuse(e) {
3227
+ canReuse(e, t) {
3228
3228
  return this.data === e;
3229
3229
  }
3230
3230
  /**
@@ -3238,7 +3238,7 @@ class R extends oe {
3238
3238
  }
3239
3239
  function X(n, e, t) {
3240
3240
  if (t instanceof R) {
3241
- if (t.canReuse(n))
3241
+ if (t.canReuse(n, e))
3242
3242
  return t;
3243
3243
  } else if (t?.ast === n.ast)
3244
3244
  return t;
@@ -3252,7 +3252,7 @@ function X(n, e, t) {
3252
3252
  case "heading":
3253
3253
  return new hn(n, e, P(t, hn));
3254
3254
  case "paragraph":
3255
- return new ce(n, "p", "md-block md-paragraph", e, ue(t));
3255
+ return new ae(n, "p", "md-block md-paragraph", e, fe(t));
3256
3256
  case "frontMatter":
3257
3257
  return new mn(n, e, P(t, mn));
3258
3258
  case "codeBlock":
@@ -3264,7 +3264,7 @@ function X(n, e, t) {
3264
3264
  case "unhandledBlock":
3265
3265
  return new fn(n, e, P(t, fn));
3266
3266
  case "blockQuote":
3267
- return new ce(n, "blockquote", "md-block md-blockquote", e, ue(t));
3267
+ return new ae(n, "blockquote", "md-block md-blockquote", e, fe(t));
3268
3268
  case "list":
3269
3269
  return new _n(n, e, P(t, _n));
3270
3270
  case "listItem":
@@ -3274,13 +3274,13 @@ function X(n, e, t) {
3274
3274
  case "tableRow":
3275
3275
  return new bn(n, e, P(t, bn));
3276
3276
  case "tableCell":
3277
- return new ce(n, "td", "", e, ue(t));
3277
+ return new ae(n, "td", "", e, fe(t));
3278
3278
  case "strong":
3279
- return new ce(n, "strong", "", e, ue(t));
3279
+ return new ae(n, "strong", "", e, fe(t));
3280
3280
  case "emphasis":
3281
- return new ce(n, "em", "", e, ue(t));
3281
+ return new ae(n, "em", "", e, fe(t));
3282
3282
  case "strikethrough":
3283
- return new ce(n, "del", "", e, ue(t));
3283
+ return new ae(n, "del", "", e, fe(t));
3284
3284
  case "inlineCode":
3285
3285
  return new kn(n, e, P(t, kn));
3286
3286
  case "inlineMath":
@@ -3290,7 +3290,7 @@ function X(n, e, t) {
3290
3290
  case "image":
3291
3291
  return new En(n, e, P(t, En));
3292
3292
  case "document":
3293
- return new ce(n, "div", "", e, ue(t));
3293
+ return new ae(n, "div", "", e, fe(t));
3294
3294
  case "diffHunk":
3295
3295
  return new xt(n, e, P(t, xt));
3296
3296
  case "diffDecoration":
@@ -3300,19 +3300,19 @@ function X(n, e, t) {
3300
3300
  function P(n, e) {
3301
3301
  return n instanceof e ? n : void 0;
3302
3302
  }
3303
- function ue(n) {
3304
- return n instanceof ce ? n : void 0;
3303
+ function fe(n) {
3304
+ return n instanceof ae ? n : void 0;
3305
3305
  }
3306
3306
  function j(n, e, t, s) {
3307
- const { paired: i, unused: o } = qt(e, t ?? D), r = e.map((c) => s(c, i.get(c)));
3307
+ const { paired: i, unused: o } = qt(e, t ?? F), r = e.map((c) => s(c, i.get(c)));
3308
3308
  for (const c of o)
3309
3309
  c.dispose();
3310
3310
  return nr(n, r), r;
3311
3311
  }
3312
3312
  function nr(n, e) {
3313
- fe(n, e.map((t) => t.mountNode));
3313
+ me(n, e.map((t) => t.mountNode));
3314
3314
  }
3315
- function fe(n, e) {
3315
+ function me(n, e) {
3316
3316
  let t = n.firstChild, s = 0;
3317
3317
  for (; s < e.length && t === e[s]; s++)
3318
3318
  t = t.nextSibling;
@@ -3327,13 +3327,13 @@ function fe(n, e) {
3327
3327
  }
3328
3328
  }
3329
3329
  }
3330
- function he(n) {
3330
+ function ue(n) {
3331
3331
  return (e, t) => X(e, n, t);
3332
3332
  }
3333
3333
  function Os(n) {
3334
3334
  return (e, t) => e.kind === "marker" && e.ast.markerKind === "content" ? new Kt(e, document.createTextNode(e.ast.content)) : X(e, n, t);
3335
3335
  }
3336
- const D = [];
3336
+ const F = [];
3337
3337
  class xt extends R {
3338
3338
  _originalNode;
3339
3339
  _modifiedNode;
@@ -3341,7 +3341,7 @@ class xt extends R {
3341
3341
  const i = s?.dom ?? document.createElement("div");
3342
3342
  i.className = "md-block md-diff-hunk";
3343
3343
  const o = [], r = [], c = e.original ? cn(e.original, "md-diff-original", t, s?._originalNode) : void 0, a = e.modified ? cn(e.modified, "md-diff-modified", t, s?._modifiedNode) : void 0;
3344
- c && (o.push(c), r.push(c.mountNode)), a && (o.push(a), r.push(a.mountNode)), fe(i, r), super(e, i, o), this._originalNode = c, this._modifiedNode = a;
3344
+ c && (o.push(c), r.push(c.mountNode)), a && (o.push(a), r.push(a.mountNode)), me(i, r), super(e, i, o), this._originalNode = c, this._modifiedNode = a;
3345
3345
  }
3346
3346
  /** The mounted sides with their highlight ranges, for the diff highlighter. */
3347
3347
  get sides() {
@@ -3359,7 +3359,7 @@ class Et extends R {
3359
3359
  const i = s?.dom ?? document.createElement("div");
3360
3360
  i.className = "md-block md-diff-decoration", i.style.pointerEvents = "none";
3361
3361
  const o = X(e.side, t, s?.sideNode), r = o.element, c = !e.whole;
3362
- r.classList.add(e.whole ? "md-diff-removed" : "md-diff-original"), r.classList.toggle("md-block-active", c), r.classList.toggle("md-markers-hidden", !c), fe(i, [o.mountNode]), super(e, i, [o]), this.sideNode = o;
3362
+ r.classList.add(e.whole ? "md-diff-removed" : "md-diff-original"), r.classList.toggle("md-block-active", c), r.classList.toggle("md-markers-hidden", !c), me(i, [o.mountNode]), super(e, i, [o]), this.sideNode = o;
3363
3363
  }
3364
3364
  /** A decoration has no presence in the modified document's source space. */
3365
3365
  get sourceLength() {
@@ -3461,31 +3461,31 @@ function rt(n, e, t, s) {
3461
3461
  c.className = o.cls, c.appendChild(r), n.appendChild(c);
3462
3462
  } else
3463
3463
  n.appendChild(r);
3464
- i.push(new q(s, r, D, o.text.length));
3464
+ i.push(new G(s, r, F, o.text.length));
3465
3465
  }
3466
3466
  return i;
3467
3467
  }
3468
3468
  class Kt extends R {
3469
3469
  constructor(e, t) {
3470
- super(e, t, D);
3470
+ super(e, t, F);
3471
3471
  }
3472
3472
  }
3473
- class q extends oe {
3473
+ class G extends oe {
3474
3474
  _sourceLength;
3475
- constructor(e, t, s = D, i = e.length) {
3475
+ constructor(e, t, s = F, i = e.length) {
3476
3476
  super(e, t, s), this._sourceLength = i;
3477
3477
  }
3478
3478
  get sourceLength() {
3479
3479
  return this._sourceLength;
3480
3480
  }
3481
3481
  }
3482
- class lr extends q {
3482
+ class lr extends G {
3483
3483
  _span;
3484
3484
  constructor(e) {
3485
3485
  const t = document.createElement("span");
3486
3486
  t.setAttribute("aria-hidden", "true"), t.style.userSelect = "none";
3487
3487
  const s = document.createTextNode("​");
3488
- t.appendChild(s), super(e, s, D, 0), this._span = t;
3488
+ t.appendChild(s), super(e, s, F, 0), this._span = t;
3489
3489
  }
3490
3490
  get mountNode() {
3491
3491
  return this._span;
@@ -3497,7 +3497,7 @@ class ln extends R {
3497
3497
  const s = e.ast, i = `md-marker md-marker-${s.markerKind}`, o = t && t.dom instanceof globalThis.Text && t.dom.data === s.content, r = o ? t._span : document.createElement("span");
3498
3498
  r.className = e.visible ? i : `${i} md-marker-hidden`;
3499
3499
  const c = o ? t.dom : document.createTextNode(s.content);
3500
- o || r.appendChild(c), super(e, c, D), this._span = r;
3500
+ o || r.appendChild(c), super(e, c, F), this._span = r;
3501
3501
  }
3502
3502
  get mountNode() {
3503
3503
  return this._span;
@@ -3529,7 +3529,7 @@ class Ze extends R {
3529
3529
  const a = t && t.dom instanceof globalThis.Text && t.dom.data === s.content && t.children.length === 0, l = a ? t._span : document.createElement("span");
3530
3530
  l.className = e.visible ? i : `${i} md-glue-hidden`;
3531
3531
  const d = a ? t.dom : document.createTextNode(s.content);
3532
- return a || l.appendChild(d), { span: l, dom: d, children: D };
3532
+ return a || l.appendChild(d), { span: l, dom: d, children: F };
3533
3533
  }
3534
3534
  }
3535
3535
  class dn extends R {
@@ -3548,13 +3548,13 @@ class dn extends R {
3548
3548
  }
3549
3549
  function dr(n, e, t) {
3550
3550
  const s = document.createTextNode(e);
3551
- return n.appendChild(s), [new q(t, s)];
3551
+ return n.appendChild(s), [new G(t, s)];
3552
3552
  }
3553
- class ce extends R {
3553
+ class ae extends R {
3554
3554
  constructor(e, t, s, i, o) {
3555
3555
  const r = o?.element ?? document.createElement(t);
3556
3556
  !o && s && (r.className = s);
3557
- const c = j(r, Rs(e), o?.children, he(i));
3557
+ const c = j(r, Rs(e), o?.children, ue(i));
3558
3558
  super(e, r, c);
3559
3559
  }
3560
3560
  }
@@ -3562,7 +3562,7 @@ class hn extends R {
3562
3562
  constructor(e, t, s) {
3563
3563
  const i = s && s.element.tagName === `H${e.ast.level}`, o = i ? s.element : document.createElement(`h${e.ast.level}`);
3564
3564
  i || (o.className = "md-block md-heading");
3565
- const r = j(o, e.content, s?.children, he(t));
3565
+ const r = j(o, e.content, s?.children, ue(t));
3566
3566
  super(e, o, r);
3567
3567
  }
3568
3568
  }
@@ -3572,14 +3572,14 @@ class un extends R {
3572
3572
  if (e.showMarkup) {
3573
3573
  const r = s?.data.showMarkup ? s : void 0, c = r?.dom ?? document.createElement("div");
3574
3574
  r || (c.className = "md-block md-thematic-break-source");
3575
- const a = j(c, e.content, r?.children, he(t));
3575
+ const a = j(c, e.content, r?.children, ue(t));
3576
3576
  super(e, c, a), this._contentEl = c;
3577
3577
  return;
3578
3578
  }
3579
3579
  const i = document.createElement("div");
3580
3580
  i.className = "md-block md-thematic-break-wrapper";
3581
3581
  const o = document.createElement("hr");
3582
- o.className = "md-block md-thematic-break", i.appendChild(o), super(e, i, D), this._contentEl = o;
3582
+ o.className = "md-block md-thematic-break", i.appendChild(o), super(e, i, F), this._contentEl = o;
3583
3583
  }
3584
3584
  get element() {
3585
3585
  return this._contentEl;
@@ -3597,8 +3597,8 @@ class fn extends R {
3597
3597
  const a = j(c, e.content, i?.children, (l, d) => {
3598
3598
  const u = l.ast;
3599
3599
  if (l.kind === "marker" && u.markerKind === "content") {
3600
- const f = (d instanceof q && d.dom.nodeType === globalThis.Node.TEXT_NODE && d.dom.data === u.content ? d.dom : void 0) ?? document.createTextNode(u.content);
3601
- return new q(u, f);
3600
+ const f = (d instanceof G && d.dom.nodeType === globalThis.Node.TEXT_NODE && d.dom.data === u.content ? d.dom : void 0) ?? document.createTextNode(u.content);
3601
+ return new G(u, f);
3602
3602
  }
3603
3603
  return X(l, t, d);
3604
3604
  });
@@ -3656,35 +3656,39 @@ class zt extends R {
3656
3656
  */
3657
3657
  _embeddedEditor;
3658
3658
  _embeddedEditorFactoryVersion;
3659
+ _embeddedEditorReadOnly;
3660
+ canReuse(e, t) {
3661
+ return super.canReuse(e, t) && Object.is(t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorFactoryVersion) && (!this._embeddedEditor || (t?.embeddedCodeEditorReadOnly ?? !1) === this._embeddedEditorReadOnly);
3662
+ }
3659
3663
  constructor(e, t, s) {
3660
- const i = e.ast, o = i.code?.content ?? "", r = s instanceof zt ? s : void 0, c = Jo(o);
3661
- let a;
3662
- !e.showMarkup && i.language && i.code && c.sourceOffset > 0 && t?.embeddedCodeEditorFactory && (r?._embeddedEditor && Object.is(t.embeddedCodeEditorFactoryVersion, r._embeddedEditorFactoryVersion) && (i === r.ast || i.getDiff(r.ast)) ? (a = r._embeddedEditor, r._embeddedEditor = void 0) : a = t.embeddedCodeEditorFactory.create(i.language, c.text) ?? void 0), r?._embeddedEditor && (r._embeddedEditor.dispose(), r._embeddedEditor = void 0);
3663
- const l = !a && !e.showMarkup && i.language && t?.renderCustomCodeBlock ? t.renderCustomCodeBlock(i.language, o) ?? void 0 : void 0, d = t?.syntaxHighlighter;
3664
- let u;
3665
- if (!a && !l && d && i.language) {
3664
+ const i = e.ast, o = i.code?.content ?? "", r = s instanceof zt ? s : void 0, c = t?.embeddedCodeEditorReadOnly ?? !1, a = Jo(o);
3665
+ let l;
3666
+ !e.showMarkup && i.language && i.code && a.sourceOffset > 0 && t?.embeddedCodeEditorFactory && (r?._embeddedEditor && Object.is(t.embeddedCodeEditorFactoryVersion, r._embeddedEditorFactoryVersion) && (i === r.ast || i.getDiff(r.ast)) ? (l = r._embeddedEditor, r._embeddedEditor = void 0) : l = t.embeddedCodeEditorFactory.create(i.language, a.text) ?? void 0), r?._embeddedEditor && (r._embeddedEditor.dispose(), r._embeddedEditor = void 0);
3667
+ const d = !l && !e.showMarkup && i.language && t?.renderCustomCodeBlock ? t.renderCustomCodeBlock(i.language, o) ?? void 0 : void 0, u = t?.syntaxHighlighter;
3668
+ let h;
3669
+ if (!l && !d && u && i.language) {
3666
3670
  if (r?._session && i === r.ast)
3667
- u = r._session, r._session = void 0;
3671
+ h = r._session, r._session = void 0;
3668
3672
  else if (r?._session) {
3669
3673
  const p = i.getDiff(r.ast);
3670
- p && (u = r._session, r._session = void 0, ne((_) => u.update(p.stringEdit, _)));
3674
+ p && (h = r._session, r._session = void 0, ne((v) => h.update(p.stringEdit, v)));
3671
3675
  }
3672
- u || (u = d.create(i.language, o));
3676
+ h || (h = u.create(i.language, o));
3673
3677
  }
3674
3678
  r?._session && (r._session.dispose(), r._session = void 0), r?._snapshotSub?.dispose(), r && (r._snapshotSub = void 0);
3675
- const h = u ? u.snapshot.get().getTokens(w.ofLength(o.length)).tokens : void 0;
3676
- let f, m, g;
3677
- if (a) {
3678
- a.element.classList.add("md-block", "md-code-block");
3679
- const p = a.estimateHeight?.(c.text);
3680
- p !== void 0 && (a.element.style.boxSizing = "border-box", a.element.style.minHeight = `${p}px`), a.onEdit = (_) => {
3681
- const v = c.sourceOffset === 0 ? _ : new T(
3682
- _.replacements.map((k) => ie.replace(k.replaceRange.delta(c.sourceOffset), k.newText))
3679
+ const f = h ? h.snapshot.get().getTokens(w.ofLength(o.length)).tokens : void 0;
3680
+ let m, g, _;
3681
+ if (l) {
3682
+ l.element.classList.add("md-block", "md-code-block");
3683
+ const p = l.estimateHeight?.(a.text);
3684
+ p !== void 0 && (l.element.style.boxSizing = "border-box", l.element.style.minHeight = `${p}px`), l.onEdit = (v) => {
3685
+ const y = a.sourceOffset === 0 ? v : new M(
3686
+ v.replacements.map((b) => ie.replace(b.replaceRange.delta(a.sourceOffset), b.newText))
3683
3687
  );
3684
- t?.onEmbeddedCodeEditorEdit?.(i, v);
3685
- }, a.setReadOnly?.(t?.embeddedCodeEditorReadOnly ?? !1), a.setContent(c.text), f = a.element, m = D;
3686
- } else if (l)
3687
- l.classList.add("md-block", "md-code-block"), f = l, m = D;
3688
+ t?.onEmbeddedCodeEditorEdit?.(i, y);
3689
+ }, l.setReadOnly?.(t?.embeddedCodeEditorReadOnly ?? !1), l.setContent(a.text), m = l.element, g = F;
3690
+ } else if (d)
3691
+ d.classList.add("md-block", "md-code-block"), m = d, g = F;
3688
3692
  else if (i.openFence) {
3689
3693
  const p = Bs(
3690
3694
  e.content,
@@ -3693,46 +3697,46 @@ class zt extends R {
3693
3697
  t,
3694
3698
  "md-block md-code-block",
3695
3699
  i.language || void 0,
3696
- h
3697
- ), _ = p.dom, v = p.children;
3698
- if (g = p.contentNode, !i.closeFence && i.code && o.endsWith(`
3700
+ f
3701
+ ), v = p.dom, y = p.children;
3702
+ if (_ = p.contentNode, !i.closeFence && i.code && o.endsWith(`
3699
3703
  `)) {
3700
- const k = new lr(i.code);
3701
- _.appendChild(k.mountNode), v.push(k);
3704
+ const b = new lr(i.code);
3705
+ v.appendChild(b.mountNode), y.push(b);
3702
3706
  }
3703
- f = _, m = v;
3707
+ m = v, g = y;
3704
3708
  } else {
3705
3709
  const p = document.createElement("pre");
3706
3710
  p.className = "md-block md-code-block";
3707
- const _ = document.createElement("code");
3708
- p.appendChild(_);
3709
- const v = [];
3710
- for (const k of e.content) {
3711
- const y = k.ast;
3712
- if (k.kind === "marker" && y.markerKind === "content") {
3713
- const x = document.createTextNode(y.content);
3714
- _.appendChild(x), v.push(new q(y, x));
3715
- } else if (k.kind === "marker" && y.markerKind === "codeIndent") {
3716
- const x = y;
3717
- if (k.visible) {
3718
- const O = document.createElement("span");
3719
- O.className = "md-marker md-marker-codeIndent";
3720
- const G = rt(O, x.content, rr, x);
3721
- _.appendChild(O), v.push(new q(x, O, G));
3711
+ const v = document.createElement("code");
3712
+ p.appendChild(v);
3713
+ const y = [];
3714
+ for (const b of e.content) {
3715
+ const x = b.ast;
3716
+ if (b.kind === "marker" && x.markerKind === "content") {
3717
+ const T = document.createTextNode(x.content);
3718
+ v.appendChild(T), y.push(new G(x, T));
3719
+ } else if (b.kind === "marker" && x.markerKind === "codeIndent") {
3720
+ const T = x;
3721
+ if (b.visible) {
3722
+ const D = document.createElement("span");
3723
+ D.className = "md-marker md-marker-codeIndent";
3724
+ const ce = rt(D, T.content, rr, T);
3725
+ v.appendChild(D), y.push(new G(T, D, ce));
3722
3726
  } else {
3723
- const O = X(k, t, void 0);
3724
- _.appendChild(O.mountNode), v.push(O);
3727
+ const D = X(b, t, void 0);
3728
+ v.appendChild(D.mountNode), y.push(D);
3725
3729
  }
3726
3730
  } else {
3727
- const x = X(k, t, void 0);
3728
- p.appendChild(x.mountNode), v.push(x);
3731
+ const T = X(b, t, void 0);
3732
+ p.appendChild(T.mountNode), y.push(T);
3729
3733
  }
3730
3734
  }
3731
- f = p, m = v;
3735
+ m = p, g = y;
3732
3736
  }
3733
- super(e, f, m), this._session = u, this._embeddedEditor = a, this._embeddedEditorFactoryVersion = t?.embeddedCodeEditorFactoryVersion, u && g && (this._snapshotSub = cs(u.snapshot, () => {
3734
- const p = u.snapshot.get();
3735
- g.refresh(o, p.getTokens(w.ofLength(o.length)).tokens);
3737
+ super(e, m, g), this._session = h, this._embeddedEditor = l, this._embeddedEditorFactoryVersion = t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorReadOnly = c, h && _ && (this._snapshotSub = cs(h.snapshot, () => {
3738
+ const p = h.snapshot.get();
3739
+ _.refresh(o, p.getTokens(w.ofLength(o.length)).tokens);
3736
3740
  }));
3737
3741
  }
3738
3742
  dispose() {
@@ -3759,7 +3763,7 @@ function Bs(n, e, t, s, i, o, r) {
3759
3763
  function hr(n, e, t, s) {
3760
3764
  if (!s) {
3761
3765
  const i = document.createTextNode(e);
3762
- return t.appendChild(i), new q(n, i);
3766
+ return t.appendChild(i), new G(n, i);
3763
3767
  }
3764
3768
  return new As(n, t, e, s);
3765
3769
  }
@@ -3787,7 +3791,7 @@ function gn(n, e, t, s) {
3787
3791
  l.appendChild(a), e.appendChild(l);
3788
3792
  } else
3789
3793
  e.appendChild(a);
3790
- i.push(new q(n, a, D, c.length));
3794
+ i.push(new G(n, a, F, c.length));
3791
3795
  }
3792
3796
  return i;
3793
3797
  }
@@ -3804,10 +3808,10 @@ function Ds(n, e, t) {
3804
3808
  const s = e.filter((c) => c.length > 0 && c.start >= 0 && c.start + c.length <= t).slice().sort((c, a) => c.start - a.start), i = [];
3805
3809
  let o = 0;
3806
3810
  const r = (c) => {
3807
- c > 0 && i.push(new q(n, document.createTextNode(""), D, c));
3811
+ c > 0 && i.push(new G(n, document.createTextNode(""), F, c));
3808
3812
  };
3809
3813
  for (const c of s)
3810
- c.start < o || (r(c.start - o), i.push(new q(n, c.dom, D, c.length)), o = c.start + c.length);
3814
+ c.start < o || (r(c.start - o), i.push(new G(n, c.dom, F, c.length)), o = c.start + c.length);
3811
3815
  return r(t - o), i;
3812
3816
  }
3813
3817
  class pn extends R {
@@ -3828,7 +3832,7 @@ class pn extends R {
3828
3832
  for (const u of e.content)
3829
3833
  if (u.ast === i.code) {
3830
3834
  const h = document.createElement("code"), f = document.createTextNode(i.code.content);
3831
- h.appendChild(f), l.appendChild(h), d.push(new q(i.code, f));
3835
+ h.appendChild(f), l.appendChild(h), d.push(new G(i.code, f));
3832
3836
  } else {
3833
3837
  const h = X(u, t, void 0);
3834
3838
  l.appendChild(h.mountNode), d.push(h);
@@ -3854,7 +3858,7 @@ class pn extends R {
3854
3858
  } catch {
3855
3859
  a.textContent = r;
3856
3860
  }
3857
- super(e, a, D), this._renderedHeight = o;
3861
+ super(e, a, F), this._renderedHeight = o;
3858
3862
  }
3859
3863
  recordMeasuredHeight(e) {
3860
3864
  this.data.showMarkup || (this._renderedHeight = e);
@@ -3864,7 +3868,7 @@ class _n extends R {
3864
3868
  constructor(e, t, s) {
3865
3869
  const i = e.ast.ordered ? "ol" : "ul", o = s && s.element.tagName === i.toUpperCase(), r = o ? s.element : document.createElement(i);
3866
3870
  o || (r.className = "md-block md-list");
3867
- const c = j(r, e.content, s?.children, he(t));
3871
+ const c = j(r, e.content, s?.children, ue(t));
3868
3872
  super(e, r, c);
3869
3873
  }
3870
3874
  }
@@ -3890,20 +3894,20 @@ class vn extends R {
3890
3894
  }
3891
3895
  }
3892
3896
  function ur(n, e, t, s) {
3893
- const { paired: i, unused: o } = qt(e, t?.children ?? D), r = e.map((d) => X(d, s, i.get(d)));
3897
+ const { paired: i, unused: o } = qt(e, t?.children ?? F), r = e.map((d) => X(d, s, i.get(d)));
3894
3898
  for (const d of o)
3895
3899
  d.dispose();
3896
3900
  if (!(e.length >= 2 && e[0].kind === "glue" && e[0].ast.glueKind === "indent" && e[1].kind === "marker" && e[1].ast.markerKind === "listItemMarker"))
3897
- return fe(n, r.map((d) => d.mountNode)), r;
3901
+ return me(n, r.map((d) => d.mountNode)), r;
3898
3902
  const a = n.firstElementChild, l = a && a.classList.contains("md-list-gutter") ? a : document.createElement("span");
3899
- return l.className = "md-list-gutter", fe(l, [r[0].mountNode, r[1].mountNode]), fe(n, [l, ...r.slice(2).map((d) => d.mountNode)]), r;
3903
+ return l.className = "md-list-gutter", me(l, [r[0].mountNode, r[1].mountNode]), me(n, [l, ...r.slice(2).map((d) => d.mountNode)]), r;
3900
3904
  }
3901
3905
  class wn extends R {
3902
3906
  _table;
3903
3907
  constructor(e, t, s) {
3904
3908
  const i = s?.dom ?? document.createElement("div"), o = s?._table ?? document.createElement("table");
3905
3909
  s || (i.className = "md-block md-table-wrapper", o.className = "md-block md-table", i.appendChild(o));
3906
- const r = j(o, Rs(e), s?.children, he(t));
3910
+ const r = j(o, Rs(e), s?.children, ue(t));
3907
3911
  super(e, i, r), this._table = o;
3908
3912
  }
3909
3913
  get element() {
@@ -3917,7 +3921,7 @@ class bn extends R {
3917
3921
  constructor(e, t, s) {
3918
3922
  const i = s?.element ?? document.createElement("tr");
3919
3923
  e.isDelimiter && i.classList.add("md-table-delimiter-row");
3920
- const o = j(i, e.content, s?.children, he(t));
3924
+ const o = j(i, e.content, s?.children, ue(t));
3921
3925
  e.isDelimiter || e.content.forEach((r, c) => {
3922
3926
  r.kind === "tableCell" && o[c].element.classList.toggle("md-table-cell-active", r.isActive);
3923
3927
  }), super(e, i, o);
@@ -3958,7 +3962,7 @@ class yn extends R {
3958
3962
  } catch {
3959
3963
  c.textContent = o;
3960
3964
  }
3961
- super(e, c, D);
3965
+ super(e, c, F);
3962
3966
  }
3963
3967
  }
3964
3968
  class xn extends R {
@@ -3988,7 +3992,7 @@ class xn extends R {
3988
3992
  };
3989
3993
  i.addEventListener("click", l), i.addEventListener("auxclick", l);
3990
3994
  }
3991
- const o = j(i, e.content, s?.children, he(t));
3995
+ const o = j(i, e.content, s?.children, ue(t));
3992
3996
  super(e, i, o);
3993
3997
  }
3994
3998
  }
@@ -3998,12 +4002,12 @@ class En extends R {
3998
4002
  if (e.showMarkup) {
3999
4003
  const r = document.createElement("span");
4000
4004
  r.className = "md-image-source";
4001
- const c = j(r, e.content, s?.children, he(t));
4005
+ const c = j(r, e.content, s?.children, ue(t));
4002
4006
  super(e, r, c);
4003
4007
  return;
4004
4008
  }
4005
4009
  const o = document.createElement("img");
4006
- Fs(i.url) && (o.src = i.url), o.alt = i.alt, super(e, o, D);
4010
+ Fs(i.url) && (o.src = i.url), o.alt = i.alt, super(e, o, F);
4007
4011
  }
4008
4012
  }
4009
4013
  function qt(n, e) {
@@ -4034,21 +4038,21 @@ class Gt extends oe {
4034
4038
  const u = c.map((f, m) => {
4035
4039
  const g = a.get(f);
4036
4040
  if (e.children[m].kind === "pendingParagraph") {
4037
- const _ = g instanceof Cn ? g : new Cn(f);
4038
- return d = _.element, _;
4041
+ const p = g instanceof Cn ? g : new Cn(f);
4042
+ return d = p.element, p;
4039
4043
  }
4040
- const p = X(f, t, g);
4044
+ const _ = X(f, t, g);
4041
4045
  if (e.children[m].kind === "block") {
4042
- const _ = o.get(f);
4043
- _ !== void 0 && (p.element.classList.toggle("md-block-active", _), p.element.classList.toggle("md-markers-hidden", !_));
4046
+ const p = o.get(f);
4047
+ p !== void 0 && (_.element.classList.toggle("md-block-active", p), _.element.classList.toggle("md-markers-hidden", !p));
4044
4048
  const v = e.children[m].diffKind;
4045
- p.element.classList.toggle("md-diff-added", v === "added"), p.element.classList.toggle("md-diff-modified", v === "modified");
4049
+ _.element.classList.toggle("md-diff-added", v === "added"), _.element.classList.toggle("md-diff-modified", v === "modified");
4046
4050
  }
4047
- return p;
4051
+ return _;
4048
4052
  });
4049
4053
  for (const f of l)
4050
4054
  f.dispose();
4051
- fe(i, u.map((f) => f.mountNode));
4055
+ me(i, u.map((f) => f.mountNode));
4052
4056
  const h = [];
4053
4057
  return e.children.forEach((f, m) => {
4054
4058
  f.kind === "block" && h.push({ node: u[m], absoluteStart: f.absoluteStart });
@@ -4106,11 +4110,11 @@ class gr {
4106
4110
  _clientToLocal;
4107
4111
  toLocalPoint(e) {
4108
4112
  const t = new DOMPoint(e.x, e.y).matrixTransform(this._clientToLocal);
4109
- return new ae(t.x, t.y);
4113
+ return new le(t.x, t.y);
4110
4114
  }
4111
4115
  toClientPoint(e) {
4112
4116
  const t = new DOMPoint(e.x, e.y).matrixTransform(this._localToClient);
4113
- return new ae(t.x, t.y);
4117
+ return new le(t.x, t.y);
4114
4118
  }
4115
4119
  toLocalRect(e) {
4116
4120
  return this._convertRect(e, this._clientToLocal);
@@ -4201,13 +4205,13 @@ class Lr {
4201
4205
  }
4202
4206
  kind = "strikethrough";
4203
4207
  }
4204
- class Tr {
4208
+ class Mr {
4205
4209
  constructor(e, t) {
4206
4210
  this.ast = e, this.content = t;
4207
4211
  }
4208
4212
  kind = "inlineCode";
4209
4213
  }
4210
- class Mr {
4214
+ class Tr {
4211
4215
  constructor(e, t, s) {
4212
4216
  this.ast = e, this.showMarkup = t, this.content = s;
4213
4217
  }
@@ -4301,24 +4305,24 @@ function Ws(n, e, t, s, i) {
4301
4305
  const h = r[u];
4302
4306
  if (c.has(h)) {
4303
4307
  const f = h, m = e.has(f), g = o.get(f);
4304
- let p;
4308
+ let _;
4305
4309
  if (!m)
4306
- p = g && !g.isActive ? g.view : Ct(f, Hs, g?.view);
4310
+ _ = g && !g.isActive ? g.view : Ct(f, Hs, g?.view);
4307
4311
  else {
4308
- const _ = t && t.endExclusive >= d && t.start <= d + f.length ? new w(
4312
+ const p = t && t.endExclusive >= d && t.start <= d + f.length ? new w(
4309
4313
  Math.max(0, t.start - d),
4310
4314
  Math.min(f.length, t.endExclusive - d)
4311
4315
  ) : void 0;
4312
- p = Ct(f, { showMarkup: !0, showTableGlue: !1, selectionInNode: _ }, g?.view);
4316
+ _ = Ct(f, { showMarkup: !0, showTableGlue: !1, selectionInNode: p }, g?.view);
4313
4317
  }
4314
- a.push({ ast: f, absoluteStart: d, isActive: m, view: p }), l.push({ absoluteStart: d, isActive: m, view: p, kind: "block" }), i && i.anchorBlock === f && l.push({
4318
+ a.push({ ast: f, absoluteStart: d, isActive: m, view: _ }), l.push({ absoluteStart: d, isActive: m, view: _, kind: "block" }), i && i.anchorBlock === f && l.push({
4315
4319
  absoluteStart: d + f.length,
4316
4320
  isActive: !0,
4317
4321
  view: new vr(i.ast),
4318
4322
  kind: "pendingParagraph"
4319
4323
  });
4320
- } else if (h instanceof H) {
4321
- const f = o.get(h), m = M(f?.view, new $s(h, !1, !1));
4324
+ } else if (h instanceof W) {
4325
+ const f = o.get(h), m = O(f?.view, new $s(h, !1, !1));
4322
4326
  l.push({ absoluteStart: d, isActive: !1, view: m, kind: "glue" });
4323
4327
  }
4324
4328
  d += h.length;
@@ -4326,7 +4330,7 @@ function Ws(n, e, t, s, i) {
4326
4330
  return new Vs(n, a, l);
4327
4331
  }
4328
4332
  function Ct(n, e, t) {
4329
- return Te(n, e, t);
4333
+ return Me(n, e, t);
4330
4334
  }
4331
4335
  function $r(n, e, t) {
4332
4336
  return Ct(n, e ? { showMarkup: !0, showTableGlue: !1, selectionInNode: void 0 } : Hs, t);
@@ -4410,57 +4414,57 @@ function zs(n) {
4410
4414
  return;
4411
4415
  }
4412
4416
  }
4413
- function Te(n, e, t, s) {
4417
+ function Me(n, e, t, s) {
4414
4418
  const i = n;
4415
4419
  switch (i.kind) {
4416
4420
  case "text":
4417
- return M(t, new Ar(i, e.showMarkup, s?.left ?? !1, s?.right ?? !1));
4421
+ return O(t, new Ar(i, e.showMarkup, s?.left ?? !1, s?.right ?? !1));
4418
4422
  // The trailing gap is revealed as `↵` glyphs by virtue of its `blockGap`
4419
4423
  // kind (see `GlueViewNode`), so the break needs no inline-flow opt-in.
4420
4424
  case "thematicBreak":
4421
- return M(t, new Pr(i, e.showMarkup, F(i.children, e, t)));
4425
+ return O(t, new Pr(i, e.showMarkup, V(i.children, e, t)));
4422
4426
  case "unhandledBlock":
4423
- return M(t, new Dr(i, F(i.children, e, t)));
4427
+ return O(t, new Dr(i, V(i.children, e, t)));
4424
4428
  case "marker":
4425
- return M(t, new Fr(i, qr(i.markerKind, e)));
4429
+ return O(t, new Fr(i, qr(i.markerKind, e)));
4426
4430
  case "glue":
4427
- return M(t, new $s(i, Gr(i.glueKind, e), e.inlineFlow ?? !1));
4431
+ return O(t, new $s(i, Gr(i.glueKind, e), e.inlineFlow ?? !1));
4428
4432
  case "heading":
4429
- return M(t, new pr(i, F(i.children, Z(e), t)));
4433
+ return O(t, new pr(i, V(i.children, Z(e), t)));
4430
4434
  case "paragraph":
4431
- return M(t, new _r(i, F(i.children, Z(e), t)));
4435
+ return O(t, new _r(i, V(i.children, Z(e), t)));
4432
4436
  case "frontMatter":
4433
- return M(t, new wr(i, e.showMarkup, F(i.children, e, t)));
4437
+ return O(t, new wr(i, e.showMarkup, V(i.children, e, t)));
4434
4438
  case "codeBlock":
4435
- return M(t, new br(i, e.showMarkup, F(i.children, e, t)));
4439
+ return O(t, new br(i, e.showMarkup, V(i.children, e, t)));
4436
4440
  case "mathBlock":
4437
- return M(t, new kr(i, e.showMarkup, F(i.children, e, t)));
4441
+ return O(t, new kr(i, e.showMarkup, V(i.children, e, t)));
4438
4442
  case "blockQuote":
4439
- return M(t, new yr(i, F(i.children, e, t)));
4443
+ return O(t, new yr(i, V(i.children, e, t)));
4440
4444
  case "list":
4441
- return M(t, Ur(i, e, t));
4445
+ return O(t, Ur(i, e, t));
4442
4446
  case "listItem":
4443
- return M(t, qs(i, e, t));
4447
+ return O(t, qs(i, e, t));
4444
4448
  case "table":
4445
- return M(t, Xr(i, e, t));
4449
+ return O(t, Xr(i, e, t));
4446
4450
  case "tableRow":
4447
- return M(t, Gs(i, e, !1, t));
4451
+ return O(t, Gs(i, e, !1, t));
4448
4452
  case "tableCell":
4449
- return M(t, Us(i, e.showMarkup, e.showTableGlue, e.selectionInNode, t));
4453
+ return O(t, Us(i, e.showMarkup, e.showTableGlue, e.selectionInNode, t));
4450
4454
  case "strong":
4451
- return M(t, new Cr(i, F(i.children, Z(e), t)));
4455
+ return O(t, new Cr(i, V(i.children, Z(e), t)));
4452
4456
  case "emphasis":
4453
- return M(t, new Sr(i, F(i.children, Z(e), t)));
4457
+ return O(t, new Sr(i, V(i.children, Z(e), t)));
4454
4458
  case "strikethrough":
4455
- return M(t, new Lr(i, F(i.children, Z(e), t)));
4459
+ return O(t, new Lr(i, V(i.children, Z(e), t)));
4456
4460
  case "inlineCode":
4457
- return M(t, new Tr(i, F(i.children, Z(e), t)));
4461
+ return O(t, new Mr(i, V(i.children, Z(e), t)));
4458
4462
  case "inlineMath":
4459
- return M(t, new Mr(i, e.showMarkup, F(i.children, Z(e), t)));
4463
+ return O(t, new Tr(i, e.showMarkup, V(i.children, Z(e), t)));
4460
4464
  case "link":
4461
- return M(t, new Or(i, F(i.children, Z(e), t)));
4465
+ return O(t, new Or(i, V(i.children, Z(e), t)));
4462
4466
  case "image":
4463
- return M(t, new Rr(i, e.showMarkup, F(i.children, Z(e), t)));
4467
+ return O(t, new Rr(i, e.showMarkup, V(i.children, Z(e), t)));
4464
4468
  case "document":
4465
4469
  return Ws(i, /* @__PURE__ */ new Set(), w.ofLength(0), void 0);
4466
4470
  }
@@ -4477,7 +4481,7 @@ function De(n) {
4477
4481
  e.set(t.ast, t);
4478
4482
  return e;
4479
4483
  }
4480
- function M(n, e) {
4484
+ function O(n, e) {
4481
4485
  if (n && n.kind === e.kind && n.ast === e.ast && zr(n, e)) {
4482
4486
  const t = St(n), s = St(e);
4483
4487
  if (t.length === s.length && t.every((i, o) => i === s[o]))
@@ -4517,14 +4521,14 @@ function zr(n, e) {
4517
4521
  return !0;
4518
4522
  }
4519
4523
  }
4520
- function F(n, e, t) {
4524
+ function V(n, e, t) {
4521
4525
  const s = De(t);
4522
4526
  return n.map((i, o) => {
4523
4527
  const r = i.kind === "text" ? {
4524
4528
  left: o > 0 && Sn(n[o - 1], "end"),
4525
4529
  right: o < n.length - 1 && Sn(n[o + 1], "start")
4526
4530
  } : void 0;
4527
- return Te(i, e, s?.get(i), r);
4531
+ return Me(i, e, s?.get(i), r);
4528
4532
  });
4529
4533
  }
4530
4534
  function Sn(n, e) {
@@ -4563,9 +4567,9 @@ function Ur(n, e, t) {
4563
4567
  selectionInNode: u && e.selectionInNode ? e.selectionInNode.delta(-a) : void 0,
4564
4568
  listLevel: r
4565
4569
  };
4566
- c.push(M(s?.get(d), qs(d, h, s?.get(d))));
4570
+ c.push(O(s?.get(d), qs(d, h, s?.get(d))));
4567
4571
  } else
4568
- c.push(Te(l, e, s?.get(l)));
4572
+ c.push(Me(l, e, s?.get(l)));
4569
4573
  a += l.length;
4570
4574
  }
4571
4575
  return new xr(n, c);
@@ -4575,7 +4579,7 @@ function qs(n, e, t) {
4575
4579
  let o = 0;
4576
4580
  for (const r of n.children) {
4577
4581
  const c = e.selectionInNode ? { ...e, selectionInNode: e.selectionInNode.delta(-o) } : e;
4578
- i.push(Te(r, c, s?.get(r))), o += r.length;
4582
+ i.push(Me(r, c, s?.get(r))), o += r.length;
4579
4583
  }
4580
4584
  return new Nr(n, e.showMarkup, i, e.listLevel ?? 1);
4581
4585
  }
@@ -4591,9 +4595,9 @@ function Xr(n, e, t) {
4591
4595
  showTableGlue: i,
4592
4596
  selectionInNode: !u && i && e.selectionInNode ? e.selectionInNode.delta(-a) : void 0
4593
4597
  };
4594
- c.push(M(s?.get(d), Gs(d, h, u, s?.get(d))));
4598
+ c.push(O(s?.get(d), Gs(d, h, u, s?.get(d))));
4595
4599
  } else
4596
- c.push(Te(l, e, s?.get(l)));
4600
+ c.push(Me(l, e, s?.get(l)));
4597
4601
  a += l.length;
4598
4602
  }
4599
4603
  return new Er(n, c);
@@ -4606,14 +4610,14 @@ function Gs(n, e, t, s) {
4606
4610
  const u = d, h = t ? o : r.has(n.cells.indexOf(u)), f = h && e.selectionInNode ? e.selectionInNode.delta(-l) : void 0;
4607
4611
  a.push(Us(u, h, o, f, i?.get(u)));
4608
4612
  } else
4609
- a.push(Te(d, e, i?.get(d)));
4613
+ a.push(Me(d, e, i?.get(d)));
4610
4614
  l += d.length;
4611
4615
  }
4612
4616
  return new Ir(n, t, a);
4613
4617
  }
4614
4618
  function Us(n, e, t, s, i) {
4615
4619
  const o = { showMarkup: e, showTableGlue: t, selectionInNode: s };
4616
- return new Br(n, e, t, F(n.children, Z(o), i));
4620
+ return new Br(n, e, t, V(n.children, Z(o), i));
4617
4621
  }
4618
4622
  const Je = /* @__PURE__ */ new Set();
4619
4623
  function Yr(n, e) {
@@ -4710,7 +4714,7 @@ function mt(n, e) {
4710
4714
  function Jr(n, e) {
4711
4715
  return n.find((t) => t.start <= e && e <= t.start + t.len);
4712
4716
  }
4713
- class ec extends V {
4717
+ class ec extends $ {
4714
4718
  constructor(e, t) {
4715
4719
  super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-diff-highlight-layer", t ? (this._coordinateSpace = t, this._coordinateProbe = void 0) : (this._coordinateProbe = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._coordinateProbe.setAttribute("aria-hidden", "true"), this._coordinateProbe.style.position = "absolute", this._coordinateProbe.style.inset = "0", this._coordinateProbe.style.width = "100%", this._coordinateProbe.style.height = "100%", this._coordinateProbe.style.visibility = "hidden", this._coordinateProbe.style.pointerEvents = "none", this.element.appendChild(this._coordinateProbe), this._coordinateSpace = ct.forSvgOverlay(this._coordinateProbe)), this._resizeObserver = new ResizeObserver(() => {
4716
4720
  this._last && this._repaint(this._last);
@@ -4770,7 +4774,7 @@ class ec extends V {
4770
4774
  this.element.replaceChildren(...t);
4771
4775
  }
4772
4776
  }
4773
- class tc extends V {
4777
+ class tc extends $ {
4774
4778
  element;
4775
4779
  rendering;
4776
4780
  _path;
@@ -4783,16 +4787,16 @@ class tc extends V {
4783
4787
  }));
4784
4788
  }
4785
4789
  }
4786
- class Tn {
4790
+ class Mn {
4787
4791
  constructor(e) {
4788
4792
  this.rects = e;
4789
4793
  }
4790
4794
  }
4791
4795
  function nc(n, e, t, s) {
4792
4796
  if (!e || e.isCollapsed)
4793
- return n.setAttribute("d", ""), new Tn([]);
4797
+ return n.setAttribute("d", ""), new Mn([]);
4794
4798
  const i = Xs(e.range, t, s);
4795
- return n.setAttribute("d", js(i, 4)), new Tn(i);
4799
+ return n.setAttribute("d", js(i, 4)), new Mn(i);
4796
4800
  }
4797
4801
  const sc = 0.4;
4798
4802
  function Xs(n, e, t) {
@@ -4803,31 +4807,31 @@ function Xs(n, e, t) {
4803
4807
  const f = o[h], m = et(f);
4804
4808
  if (!m)
4805
4809
  continue;
4806
- const g = h + 1 < o.length ? et(o[h + 1]) : void 0, p = !g || g.start > m.endExclusive, _ = s.intersects(m), v = p && s.start <= m.endExclusive && s.endExclusive > m.endExclusive;
4807
- if (!_ && !v)
4810
+ const g = h + 1 < o.length ? et(o[h + 1]) : void 0, _ = !g || g.start > m.endExclusive, p = s.intersects(m), v = _ && s.start <= m.endExclusive && s.endExclusive > m.endExclusive;
4811
+ if (!p && !v)
4808
4812
  continue;
4809
- const k = t.find((y) => w.ofStartAndLength(y.absoluteStart, y.block.length).containsRange(m));
4810
- r.push({ line: f, lineRange: m, block: k, hardBreak: p });
4813
+ const y = t.find((b) => w.ofStartAndLength(b.absoluteStart, b.block.length).containsRange(m));
4814
+ r.push({ line: f, lineRange: m, block: y, hardBreak: _ });
4811
4815
  }
4812
4816
  const c = [], a = [];
4813
4817
  for (const { line: h, lineRange: f, hardBreak: m, block: g } of r) {
4814
- const p = f.start, _ = f.endExclusive;
4815
- let v = s.start <= p ? h.rect.left : h.xAtOffset(s.start), k;
4816
- if (s.endExclusive < _)
4817
- k = h.xAtOffset(s.endExclusive);
4818
+ const _ = f.start, p = f.endExclusive;
4819
+ let v = s.start <= _ ? h.rect.left : h.xAtOffset(s.start), y;
4820
+ if (s.endExclusive < p)
4821
+ y = h.xAtOffset(s.endExclusive);
4818
4822
  else {
4819
- const x = s.endExclusive > _;
4820
- k = h.rect.right + (x && m ? h.rect.height * sc : 0);
4823
+ const x = s.endExclusive > p;
4824
+ y = h.rect.right + (x && m ? h.rect.height * sc : 0);
4821
4825
  }
4822
- const y = Ys(g);
4823
- y && (v = Math.max(v, y.left), k = Math.min(k, y.right)), c.push(i(v, h.rect.top, k, h.rect.bottom)), a.push({ left: v, right: k, top: h.rect.top, bottom: h.rect.top + h.rect.height });
4826
+ const b = Ys(g);
4827
+ b && (v = Math.max(v, b.left), y = Math.min(y, b.right)), c.push(i(v, h.rect.top, y, h.rect.bottom)), a.push({ left: v, right: y, top: h.rect.top, bottom: h.rect.top + h.rect.height });
4824
4828
  }
4825
4829
  for (let h = 0; h < a.length - 1; h++) {
4826
4830
  const f = a[h], m = a[h + 1];
4827
4831
  if (m.top <= f.bottom)
4828
4832
  continue;
4829
- const g = Math.max(f.left, m.left), p = Math.min(f.right, m.right);
4830
- p <= g || c.push(i(g, f.bottom, p, m.top));
4833
+ const g = Math.max(f.left, m.left), _ = Math.min(f.right, m.right);
4834
+ _ <= g || c.push(i(g, f.bottom, _, m.top));
4831
4835
  }
4832
4836
  const l = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
4833
4837
  for (let h = 0; h < r.length; h++) {
@@ -4838,17 +4842,17 @@ function Xs(n, e, t) {
4838
4842
  (h) => s.intersects(w.ofStartAndLength(h.absoluteStart, h.block.length))
4839
4843
  );
4840
4844
  for (let h = 0; h < t.length - 1; h++) {
4841
- const f = t[h], m = t[h + 1], g = f.absoluteStart + f.block.length, p = m.absoluteStart;
4842
- if (g < p && !s.containsRange(w.fromTo(g, p)) || g >= p && !(u[h] && u[h + 1]))
4845
+ const f = t[h], m = t[h + 1], g = f.absoluteStart + f.block.length, _ = m.absoluteStart;
4846
+ if (g < _ && !s.containsRange(w.fromTo(g, _)) || g >= _ && !(u[h] && u[h + 1]))
4843
4847
  continue;
4844
- const _ = f.rect, v = m.rect, k = oc(e, m, v.top), y = _.bottom;
4845
- if (k <= y)
4848
+ const p = f.rect, v = m.rect, y = oc(e, m, v.top), b = p.bottom;
4849
+ if (y <= b)
4846
4850
  continue;
4847
- const x = d.get(f), O = l.get(m);
4848
- if (x === void 0 && gt(e, f) || O === void 0 && gt(e, m))
4851
+ const x = d.get(f), T = l.get(m);
4852
+ if (x === void 0 && gt(e, f) || T === void 0 && gt(e, m))
4849
4853
  continue;
4850
- const G = x !== void 0 ? a[x] : { left: _.left, right: _.right }, _e = O !== void 0 ? a[O] : { left: v.left, right: v.right }, Ut = Math.max(G.left, _e.left), Xt = Math.min(G.right, _e.right);
4851
- Xt <= Ut || c.push(i(Ut, y, Xt, k));
4854
+ const D = x !== void 0 ? a[x] : { left: p.left, right: p.right }, ce = T !== void 0 ? a[T] : { left: v.left, right: v.right }, Ut = Math.max(D.left, ce.left), Xt = Math.min(D.right, ce.right);
4855
+ Xt <= Ut || c.push(i(Ut, b, Xt, y));
4852
4856
  }
4853
4857
  for (const h of t) {
4854
4858
  const f = w.ofStartAndLength(h.absoluteStart, h.block.length);
@@ -4951,7 +4955,7 @@ function pt(n, e, t) {
4951
4955
  function Q(n) {
4952
4956
  return n.toFixed(2);
4953
4957
  }
4954
- class ac extends V {
4958
+ class ac extends $ {
4955
4959
  element;
4956
4960
  rendering;
4957
4961
  constructor(e) {
@@ -4976,7 +4980,7 @@ class ze {
4976
4980
  this.offset = e, this.visible = t, this.rect = s;
4977
4981
  }
4978
4982
  }
4979
- class lc extends V {
4983
+ class lc extends $ {
4980
4984
  element;
4981
4985
  rendering;
4982
4986
  constructor(e) {
@@ -4989,7 +4993,7 @@ class lc extends V {
4989
4993
  }
4990
4994
  _render(e, t) {
4991
4995
  if (this.element.replaceChildren(), t.isEmpty)
4992
- return new Mn([]);
4996
+ return new Tn([]);
4993
4997
  const s = [];
4994
4998
  for (const i of e) {
4995
4999
  const o = i.type === "deleted" || i.range.isEmpty ? hc(i, t) : dc(i, t);
@@ -4998,10 +5002,10 @@ class lc extends V {
4998
5002
  const r = document.createElement("div");
4999
5003
  r.className = `md-gutter-marker md-gutter-marker-${o.type}`, r.style.top = `${o.y}px`, o.height > 0 && (r.style.height = `${o.height}px`), this.element.appendChild(r), s.push(o);
5000
5004
  }
5001
- return new Mn(s);
5005
+ return new Tn(s);
5002
5006
  }
5003
5007
  }
5004
- class Mn {
5008
+ class Tn {
5005
5009
  constructor(e) {
5006
5010
  this.rects = e;
5007
5011
  }
@@ -5091,7 +5095,7 @@ function In(n) {
5091
5095
  return n === "auto" || n === "scroll" || n === "hidden";
5092
5096
  }
5093
5097
  const pc = 900;
5094
- class sl extends V {
5098
+ class sl extends $ {
5095
5099
  constructor(e, t) {
5096
5100
  super(), this._model = e, this._options = t, this.element = document.createElement("div"), this.element.className = "md-editor", this._options?.classNames && this.element.classList.add(...this._options.classNames), this.element.tabIndex = 0, this._contentContainer = document.createElement("div"), this._contentContainer.className = "md-editor-content", this.element.appendChild(this._contentContainer);
5097
5101
  const s = this._options?.limitedWidth ?? ii(pc);
@@ -5099,18 +5103,17 @@ class sl extends V {
5099
5103
  const d = s.read(l);
5100
5104
  this._contentContainer.style.maxWidth = d === void 0 ? "" : `${d}px`;
5101
5105
  })), this.measuredLayout = new io();
5102
- let i = -1, o = -1;
5103
- const r = new ResizeObserver(() => {
5106
+ let i = -1, o = -1, r = -1;
5107
+ this._resizeObserver = new ResizeObserver(() => {
5104
5108
  this.element.classList.toggle("md-editor-narrow", this.element.clientWidth <= 320);
5105
5109
  const l = getComputedStyle(this._contentContainer), d = this._contentContainer.clientWidth - parseFloat(l.paddingLeft) - parseFloat(l.paddingRight);
5106
5110
  this.element.classList.toggle("md-find-compact", d <= 400);
5107
5111
  const u = this._document.get();
5108
5112
  if (!u)
5109
5113
  return;
5110
- const h = this._contentContainer.clientWidth, f = this._contentContainer.clientHeight;
5111
- Math.abs(h - i) < 0.5 && Math.abs(f - o) < 0.5 || (i = h, o = f, this._publishMeasurements(u));
5112
- });
5113
- r.observe(this.element), r.observe(this._contentContainer), this._register({ dispose: () => r.disconnect() });
5114
+ const h = this._contentContainer.clientWidth, f = this._contentContainer.clientHeight, m = u.contentDomNode.getBoundingClientRect().height;
5115
+ Math.abs(h - i) < 0.5 && Math.abs(f - o) < 0.5 && Math.abs(m - r) < 0.5 || (i = h, o = f, r = m, this._publishMeasurements(u));
5116
+ }), this._resizeObserver.observe(this.element), this._resizeObserver.observe(this._contentContainer), this._register({ dispose: () => this._resizeObserver.disconnect() });
5114
5117
  let c = 0;
5115
5118
  const a = () => {
5116
5119
  c || (c = requestAnimationFrame(() => {
@@ -5163,6 +5166,7 @@ class sl extends V {
5163
5166
  * to their parent's box) stay aligned with the content.
5164
5167
  */
5165
5168
  _contentContainer;
5169
+ _resizeObserver;
5166
5170
  _cursorView;
5167
5171
  _selectionView;
5168
5172
  _gutterMarkersView;
@@ -5546,20 +5550,20 @@ class sl extends V {
5546
5550
  this._previousViewData = m;
5547
5551
  const g = l ? Hr(m, l.items, this._options?.diffDecorationsActive) : m;
5548
5552
  this._viewData.set(g, void 0);
5549
- const p = this._options?.embeddedCodeEditorFactory ? { ...this._options, embeddedCodeEditorReadOnly: d, embeddedCodeEditorFactoryVersion: u } : this._options, _ = Gt.create(g, p, f);
5553
+ const _ = this._options?.embeddedCodeEditorFactory ? { ...this._options, embeddedCodeEditorReadOnly: d, embeddedCodeEditorFactoryVersion: u } : this._options, p = Gt.create(g, _, f);
5550
5554
  if (f) {
5551
- if (_.contentDomNode !== f.contentDomNode)
5555
+ if (p.contentDomNode !== f.contentDomNode)
5552
5556
  throw new Error("DocumentViewNode.contentDomNode must be stable across rebuilds");
5553
5557
  } else
5554
- this._contentContainer.insertBefore(_.contentDomNode, this._selectionView.element);
5555
- this._document.set(_, void 0), this._publishMeasurements(_);
5556
- const v = _.pendingElement;
5558
+ this._contentContainer.insertBefore(p.contentDomNode, this._selectionView.element), this._resizeObserver.observe(p.contentDomNode);
5559
+ this._document.set(p, void 0), this._publishMeasurements(p);
5560
+ const v = p.pendingElement;
5557
5561
  if (v) {
5558
- const k = this.coordinateSpace.capture().toLocalRect(v.getBoundingClientRect());
5559
- this._pendingCaretRect.set(S.fromPointSize(k.left, k.top, 2, k.height), void 0);
5562
+ const y = this.coordinateSpace.capture().toLocalRect(v.getBoundingClientRect());
5563
+ this._pendingCaretRect.set(S.fromPointSize(y.left, y.top, 2, y.height), void 0);
5560
5564
  } else
5561
5565
  this._pendingCaretRect.set(void 0, void 0);
5562
- l ? this._paintDiff(_, l.insertedRanges) : this._clearDiff();
5566
+ l ? this._paintDiff(p, l.insertedRanges) : this._clearDiff();
5563
5567
  };
5564
5568
  /** Current mounted blocks, or empty before the first render. */
5565
5569
  get _blocks() {
@@ -5623,23 +5627,23 @@ class sl extends V {
5623
5627
  if (i.length === 0 && !e.isEmpty)
5624
5628
  return;
5625
5629
  const o = this.measuredLayout.measurements.get().find(
5626
- (p) => p.absoluteStart <= e.start && e.start <= p.absoluteStart + p.block.length
5630
+ (_) => _.absoluteStart <= e.start && e.start <= _.absoluteStart + _.block.length
5627
5631
  ), r = i[0]?.range.startContainer ?? o?.viewNode?.dom, c = r instanceof Element ? r : r?.parentElement;
5628
5632
  if (!c)
5629
5633
  return;
5630
5634
  const a = () => {
5631
- const p = vc(i.flatMap((v) => Array.from(v.range.getClientRects())));
5632
- if (p || !e.isEmpty)
5633
- return p;
5634
- const _ = this.measuredLayout.visualLineMap.get();
5635
- if (!_.isEmpty) {
5636
- const v = _.lineIndexOfOffset(e.start), k = _.lineRect(v), y = S.fromPointSize(
5637
- _.xAtOffset(e.start),
5638
- k.top,
5635
+ const _ = vc(i.flatMap((v) => Array.from(v.range.getClientRects())));
5636
+ if (_ || !e.isEmpty)
5637
+ return _;
5638
+ const p = this.measuredLayout.visualLineMap.get();
5639
+ if (!p.isEmpty) {
5640
+ const v = p.lineIndexOfOffset(e.start), y = p.lineRect(v), b = S.fromPointSize(
5641
+ p.xAtOffset(e.start),
5642
+ y.top,
5639
5643
  2,
5640
- k.height
5644
+ y.height
5641
5645
  );
5642
- return this.coordinateSpace.capture().toClientRect(y);
5646
+ return this.coordinateSpace.capture().toClientRect(b);
5643
5647
  }
5644
5648
  if (o?.rect)
5645
5649
  return this.coordinateSpace.capture().toClientRect(
@@ -5654,17 +5658,17 @@ class sl extends V {
5654
5658
  if (Rn(d, l) && !u)
5655
5659
  return;
5656
5660
  const h = gc(c);
5657
- for (let p = 0; p < h.length; p++) {
5658
- const _ = h[p];
5661
+ for (let _ = 0; _ < h.length; _++) {
5662
+ const p = h[_];
5659
5663
  l = a() ?? l, u = this._isRevealOccluded(l);
5660
- const v = Zs(_), k = _.scrollWidth > _.clientWidth, y = _.scrollHeight > _.clientHeight, x = mc(
5661
- _,
5664
+ const v = Zs(p), y = p.scrollWidth > p.clientWidth, b = p.scrollHeight > p.clientHeight, x = mc(
5665
+ p,
5662
5666
  l.left + l.width / 2 - (v.left + v.width / 2),
5663
5667
  l.top + l.height / 2 - (v.top + v.height / 2)
5664
- ), O = k && (l.left < v.left || l.right > v.right) ? _.scrollLeft + x.x : _.scrollLeft, G = y && (l.top < v.top || l.bottom > v.bottom || u) ? _.scrollTop + x.y : _.scrollTop, _e = G !== _.scrollTop;
5665
- (O !== _.scrollLeft || _e) && _.scrollTo({
5666
- left: O,
5667
- top: G,
5668
+ ), T = y && (l.left < v.left || l.right > v.right) ? p.scrollLeft + x.x : p.scrollLeft, D = b && (l.top < v.top || l.bottom > v.bottom || u) ? p.scrollTop + x.y : p.scrollTop, ce = D !== p.scrollTop;
5669
+ (T !== p.scrollLeft || ce) && p.scrollTo({
5670
+ left: T,
5671
+ top: D,
5668
5672
  behavior: "auto"
5669
5673
  });
5670
5674
  }
@@ -5739,7 +5743,7 @@ function Ec(n) {
5739
5743
  let t = Bn.get(n);
5740
5744
  return t || (t = new xc(e), Bn.set(n, t)), t.add();
5741
5745
  }
5742
- class Cc extends V {
5746
+ class Cc extends $ {
5743
5747
  constructor(e, t) {
5744
5748
  super(), this._view = e, this._matchesLayer = Pn("md-find-matches-layer"), this._currentLayer = Pn("md-find-current-layer"), this._highlightRegistration = this._register(Ec(this._view.element.ownerDocument)), this._register(this._view.mountOverlay(this._matchesLayer, "below-selection")), this._register(this._view.mountOverlay(this._currentLayer, "above-decorations")), this._register(N((r) => {
5745
5749
  const c = t.isRevealed.read(r);
@@ -5827,17 +5831,17 @@ class Cc extends V {
5827
5831
  const m = this._view.measuredLayout.visualLineMap.get();
5828
5832
  if (m.isEmpty)
5829
5833
  continue;
5830
- const g = m.lineIndexOfOffset(f.start), p = m.lineRect(g), _ = $n(
5834
+ const g = m.lineIndexOfOffset(f.start), _ = m.lineRect(g), p = $n(
5831
5835
  S.fromPointSize(
5832
5836
  m.xAtOffset(f.start),
5833
- p.top,
5837
+ _.top,
5834
5838
  2,
5835
- p.height
5839
+ _.height
5836
5840
  ),
5837
5841
  o,
5838
5842
  Fn(i, f.start)?.viewportClip
5839
5843
  );
5840
- if (_ && (l.appendChild(An(`${r} md-find-zero-width-rect`, _)), u++, u >= c))
5844
+ if (p && (l.appendChild(An(`${r} md-find-zero-width-rect`, p)), u++, u >= c))
5841
5845
  return e.replaceChildren(l), d;
5842
5846
  }
5843
5847
  const h = Number.isFinite(c) ? Math.max(0, c - u) : Number.POSITIVE_INFINITY;
@@ -5848,13 +5852,13 @@ class Cc extends V {
5848
5852
  )) {
5849
5853
  const m = Fn(i, f.sourceRange.start);
5850
5854
  let g = !1;
5851
- for (const p of f.range.getClientRects()) {
5852
- const _ = $n(
5853
- a.toLocalRect(p),
5855
+ for (const _ of f.range.getClientRects()) {
5856
+ const p = $n(
5857
+ a.toLocalRect(_),
5854
5858
  o,
5855
5859
  m?.viewportClip
5856
5860
  );
5857
- if (!(!_ || _.width === 0 || _.height === 0) && (g = !0, l.appendChild(An(r, _)), u++, u >= c))
5861
+ if (!(!p || p.width === 0 || p.height === 0) && (g = !0, l.appendChild(An(r, p)), u++, u >= c))
5858
5862
  return g && d.push(f.range), e.replaceChildren(l), d;
5859
5863
  }
5860
5864
  g && d.push(f.range);
@@ -5922,20 +5926,20 @@ function Lc(n, e, t) {
5922
5926
  const i = n.sourceEndExclusive;
5923
5927
  if (s >= i)
5924
5928
  return;
5925
- const o = n.xAtOffset(i), r = n.xAtOffset(s + 1), c = o >= r, a = n.rect.width > 0 ? n.rect : e, l = c ? a.left : a.right, d = (p) => p === s ? l : n.xAtOffset(p), u = (p) => c ? p : -p, h = u(c ? t.left : t.right), f = u(c ? t.right : t.left);
5929
+ const o = n.xAtOffset(i), r = n.xAtOffset(s + 1), c = o >= r, a = n.rect.width > 0 ? n.rect : e, l = c ? a.left : a.right, d = (_) => _ === s ? l : n.xAtOffset(_), u = (_) => c ? _ : -_, h = u(c ? t.left : t.right), f = u(c ? t.right : t.left);
5926
5930
  if (u(o) < h || u(l) > f)
5927
5931
  return;
5928
5932
  const m = Vn(
5929
5933
  s,
5930
5934
  i,
5931
- (p) => u(d(p)) >= h
5935
+ (_) => u(d(_)) >= h
5932
5936
  );
5933
5937
  if (m > i)
5934
5938
  return;
5935
5939
  const g = Math.min(i, Vn(
5936
5940
  m,
5937
5941
  i,
5938
- (p) => u(d(p)) > f
5942
+ (_) => u(d(_)) > f
5939
5943
  ));
5940
5944
  if (!(m >= g))
5941
5945
  return new w(m, g);
@@ -5952,7 +5956,7 @@ function $n(n, e, t) {
5952
5956
  const s = Math.max(n.left, e.left, t?.left ?? Number.NEGATIVE_INFINITY), i = Math.min(n.right, e.right, t?.right ?? Number.POSITIVE_INFINITY), o = Math.max(n.top, e.top), r = Math.min(n.bottom, e.bottom);
5953
5957
  return s < i && o < r ? S.fromPointPoint(s, o, i, r) : void 0;
5954
5958
  }
5955
- const Tc = 19999;
5959
+ const Mc = 19999;
5956
5960
  class tt {
5957
5961
  constructor(e, t, s, i, o) {
5958
5962
  this._source = e, this._flags = t, this._wholeWord = s, this._wordSeparators = i, this.isEmpty = o;
@@ -5963,7 +5967,7 @@ class tt {
5963
5967
  kind: "valid",
5964
5968
  pattern: new tt("", "gmu", e.wholeWord, e.wordSeparators, !0)
5965
5969
  };
5966
- const t = e.isRegex ? e.searchString : Mc(e.searchString), s = `gmu${e.matchCase ? "" : "i"}`;
5970
+ const t = e.isRegex ? e.searchString : Tc(e.searchString), s = `gmu${e.matchCase ? "" : "i"}`;
5967
5971
  try {
5968
5972
  new RegExp(t, s);
5969
5973
  } catch (i) {
@@ -5977,7 +5981,7 @@ class tt {
5977
5981
  pattern: new tt(t, s, e.wholeWord, e.wordSeparators, !1)
5978
5982
  };
5979
5983
  }
5980
- findMatches(e, t, s = Tc) {
5984
+ findMatches(e, t, s = Mc) {
5981
5985
  if (this.isEmpty || s <= 0)
5982
5986
  return { matches: [], isCapped: !1 };
5983
5987
  const i = [];
@@ -6017,7 +6021,7 @@ class tt {
6017
6021
  function Js(n) {
6018
6022
  return n.replace(/[\\{}()[\]^$+*?.|]/g, "\\$&");
6019
6023
  }
6020
- function Mc(n) {
6024
+ function Tc(n) {
6021
6025
  return n.split(/\r\n|\r|\n/).map(Js).join("(?:\\r\\n|[\\r\\n])");
6022
6026
  }
6023
6027
  function Oc(n, e) {
@@ -6067,7 +6071,7 @@ class ei {
6067
6071
  return this._observedSourceTextId = t, { sourceIdentityChanged: i, isExpected: o };
6068
6072
  }
6069
6073
  }
6070
- class Ic extends V {
6074
+ class Ic extends $ {
6071
6075
  constructor(e) {
6072
6076
  super(), this._editorModel = e, this._sourceEditTracker = new ei(this._editorModel);
6073
6077
  let t = this._inputSnapshot();
@@ -6259,7 +6263,7 @@ function Dc(n, e) {
6259
6263
  function _t(n, e, t) {
6260
6264
  return Math.min(Math.max(n, e), t);
6261
6265
  }
6262
- class Fc extends V {
6266
+ class Fc extends $ {
6263
6267
  constructor(e, t) {
6264
6268
  super(), this._view = e, this._options = t, this.element = document.createElement("div"), this.element.className = "md-find-widget-host", this.element.hidden = !0, this.panelElement = document.createElement("div"), this.panelElement.className = "md-find-widget", this.panelElement.setAttribute("role", "dialog"), this.panelElement.setAttribute("aria-label", "Find"), this.element.appendChild(this.panelElement);
6265
6269
  const s = document.createElement("div");
@@ -6311,8 +6315,8 @@ class Fc extends V {
6311
6315
  if (this._previousButton.disabled = !s || !f, this._nextButton.disabled = !s || !f, this.panelElement.classList.toggle("md-find-no-results", m && !f && l.kind === "valid"), !f)
6312
6316
  this._matchesCount.textContent = "No results";
6313
6317
  else {
6314
- const p = l.kind === "valid" && l.isCapped ? `${h}+` : String(h);
6315
- this._matchesCount.textContent = `${d || "?"} of ${p}`;
6318
+ const _ = l.kind === "valid" && l.isCapped ? `${h}+` : String(h);
6319
+ this._matchesCount.textContent = `${d || "?"} of ${_}`;
6316
6320
  }
6317
6321
  const g = l.kind === "invalid" ? l.error.message : "";
6318
6322
  this._input.setAttribute("aria-invalid", String(g.length > 0)), this._inputShell.classList.toggle("md-find-input-invalid", g.length > 0), this._input.title = g, this._error.textContent = g, this._error.hidden = g.length === 0;
@@ -6331,7 +6335,7 @@ function qe(n, e) {
6331
6335
  function Ge(n, e) {
6332
6336
  n.setAttribute("aria-pressed", String(e)), n.classList.toggle("md-find-option-active", e);
6333
6337
  }
6334
- class Vc extends V {
6338
+ class Vc extends $ {
6335
6339
  constructor(e, t, s) {
6336
6340
  super(), this._editorModel = e, this._view = t, this._options = s, this._observedSourceTextId = this._editorModel.getSourceTextId(this._editorModel.sourceText.get()), this._sourceEditTracker = new ei(this._editorModel), this.model = this._register(new Ic(this._editorModel)), this._register(this._editorModel.onWillApplySourceEdit((c) => {
6337
6341
  this._sourceEditTracker.record(c);
@@ -6375,11 +6379,11 @@ class Vc extends V {
6375
6379
  return;
6376
6380
  }
6377
6381
  const g = !this._selectedMatch?.equals(h);
6378
- let p = /* @__PURE__ */ new Set();
6379
- this._forcedMatch?.equals(h) ? p = new Set(yt(f, h.start, h.endExclusive)) : (m ? Hc(m, h) : !1) ? this._forcedMatch = void 0 : (p = new Set(yt(f, h.start, h.endExclusive)), this._forcedMatch = h), ne((_) => {
6380
- Wn(this._view.forcedMarkerVisibleBlocks.get(), p) || this._view.forcedMarkerVisibleBlocks.set(p, _);
6382
+ let _ = /* @__PURE__ */ new Set();
6383
+ this._forcedMatch?.equals(h) ? _ = new Set(yt(f, h.start, h.endExclusive)) : (m ? Hc(m, h) : !1) ? this._forcedMatch = void 0 : (_ = new Set(yt(f, h.start, h.endExclusive)), this._forcedMatch = h), ne((p) => {
6384
+ Wn(this._view.forcedMarkerVisibleBlocks.get(), _) || this._view.forcedMarkerVisibleBlocks.set(_, p);
6381
6385
  const v = this._editorModel.selection.get();
6382
- g && !d && (!v || !v.range.equals(h)) && (this._editorModel.pendingParagraph.set(void 0, _), this._editorModel.selectionSource.set("find", _), this._editorModel.selection.set(new b(h.start, h.endExclusive), _));
6386
+ g && !d && (!v || !v.range.equals(h)) && (this._editorModel.pendingParagraph.set(void 0, p), this._editorModel.selectionSource.set("find", p), this._editorModel.selection.set(new k(h.start, h.endExclusive), p));
6383
6387
  }), this._selectedMatch = h, this._observedSourceTextId = l, g && !d && (this._cancelRevealRequest(), this._revealRequest = this._view.revealRangeInCenterIfOutsideViewport(h, "auto"));
6384
6388
  })), this._register({
6385
6389
  dispose: () => {
@@ -6403,7 +6407,7 @@ class Vc extends V {
6403
6407
  this.widget.focusAndSelect();
6404
6408
  return;
6405
6409
  }
6406
- const e = this._editorModel.selection.get() ?? b.collapsed(0);
6410
+ const e = this._editorModel.selection.get() ?? k.collapsed(0);
6407
6411
  this._selectionForScope.set(e, void 0);
6408
6412
  const { searchString: t, origin: s } = this._querySeed(e, this.model.searchString.get());
6409
6413
  this.model.reveal({
@@ -6439,7 +6443,7 @@ class Vc extends V {
6439
6443
  e === "next" ? this.model.moveToNextMatch() : this.model.moveToPreviousMatch();
6440
6444
  return;
6441
6445
  }
6442
- const t = this._editorModel.selection.get() ?? b.collapsed(0);
6446
+ const t = this._editorModel.selection.get() ?? k.collapsed(0);
6443
6447
  this._selectionForScope.set(t, void 0);
6444
6448
  const s = this.model.searchString.get() || this._querySeed(t).searchString, i = e === "next" ? t.range.endExclusive : t.range.start;
6445
6449
  this.model.reveal({ origin: i, searchString: s, direction: e });
@@ -6630,18 +6634,18 @@ function qn(n, e) {
6630
6634
  data: e
6631
6635
  }));
6632
6636
  }
6633
- const Tt = {
6634
- bindings: Mt.flatMap((n) => n.keybindings.map((e) => ({
6637
+ const Mt = {
6638
+ bindings: Tt.flatMap((n) => n.keybindings.map((e) => ({
6635
6639
  ...e,
6636
6640
  action: n.action
6637
6641
  })))
6638
6642
  }, ol = {
6639
- bindings: Mt.filter((n) => n.routing === "local").flatMap((n) => n.keybindings.map((e) => ({
6643
+ bindings: Tt.filter((n) => n.routing === "local").flatMap((n) => n.keybindings.map((e) => ({
6640
6644
  ...e,
6641
6645
  action: n.action
6642
6646
  })))
6643
6647
  }, rl = {
6644
- bindings: Mt.filter((n) => n.routing !== "local").flatMap((n) => n.keybindings.map((e) => ({
6648
+ bindings: Tt.filter((n) => n.routing !== "local").flatMap((n) => n.keybindings.map((e) => ({
6645
6649
  ...e,
6646
6650
  action: n.action
6647
6651
  })))
@@ -6670,7 +6674,7 @@ function Gn(n) {
6670
6674
  altGraphKey: n.getModifierState("AltGraph")
6671
6675
  };
6672
6676
  }
6673
- function Un(n, e, t = Tt) {
6677
+ function Un(n, e, t = Mt) {
6674
6678
  if (n.altGraphKey)
6675
6679
  return;
6676
6680
  const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 : Uc(n.code);
@@ -6685,11 +6689,11 @@ function Xc(n, e = {}) {
6685
6689
  return n.shiftKey === !!e.shift && n.altKey === !!e.alt && n.ctrlKey === !!e.ctrl && n.metaKey === !!e.meta;
6686
6690
  }
6687
6691
  const Yc = 500, Xn = 5;
6688
- class cl extends V {
6692
+ class cl extends $ {
6689
6693
  constructor(e, t, s) {
6690
6694
  super(), this._model = e, this._view = t;
6691
6695
  const i = this._view.element, o = i.ownerDocument.defaultView ?? window;
6692
- this._keyboardPlatform = s?.keyboardPlatform ?? Gc(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? Tt, this._forwardedKeyboardProfile = s?.forwardedKeyboardProfile, this._historyStrategy = s?.historyStrategy, this._indentation = s?.indentation ?? Vt, this._tabFocusStatus = this._keyboardProfile === Tt ? this._registerTabFocusAccessibility(i) : void 0, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
6696
+ this._keyboardPlatform = s?.keyboardPlatform ?? Gc(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? Mt, this._forwardedKeyboardProfile = s?.forwardedKeyboardProfile, this._historyStrategy = s?.historyStrategy, this._indentation = s?.indentation ?? Vt, this._tabFocusStatus = this._keyboardProfile === Mt ? this._registerTabFocusAccessibility(i) : void 0, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
6693
6697
  dispose: () => {
6694
6698
  i.removeEventListener("pointerdown", this._handlePointerDown), i.removeEventListener("keydown", this._handleKeyDown);
6695
6699
  }
@@ -6704,7 +6708,7 @@ class cl extends V {
6704
6708
  getSelectedText: () => this._selectedText(),
6705
6709
  deleteSelection: () => this._executeEditCommand(sn),
6706
6710
  insertText: (a) => {
6707
- this._model.pendingParagraph.get() !== void 0 ? this._runUndoableEdit(() => this._model.materializePendingParagraph(a)) : this._executeEditCommand(To(a));
6711
+ this._model.pendingParagraph.get() !== void 0 ? this._runUndoableEdit(() => this._model.materializePendingParagraph(a)) : this._executeEditCommand(Mo(a));
6708
6712
  }
6709
6713
  }));
6710
6714
  const c = this._view.editContext;
@@ -6736,7 +6740,7 @@ class cl extends V {
6736
6740
  e.text.length > 0 ? this._runUndoableEdit(() => this._model.materializePendingParagraph(e.text)) : this._model.cancelPendingParagraph();
6737
6741
  return;
6738
6742
  }
6739
- const t = T.replace(
6743
+ const t = M.replace(
6740
6744
  new w(e.updateRangeStart, e.updateRangeEnd),
6741
6745
  e.text
6742
6746
  );
@@ -6746,7 +6750,7 @@ class cl extends V {
6746
6750
  if (e.button !== 0)
6747
6751
  return;
6748
6752
  e.preventDefault(), this._model.cancelPendingParagraph(), this._view.focus(), this._desiredColumn = void 0;
6749
- const t = new ae(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time < Yc && Math.abs(t.x - s.point.x) < Xn && Math.abs(t.y - s.point.y) < Xn;
6753
+ const t = new le(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time < Yc && Math.abs(t.x - s.point.x) < Xn && Math.abs(t.y - s.point.y) < Xn;
6750
6754
  if (this._clickCount = i ? this._clickCount + 1 : 1, this._lastPointerDown = { time: e.timeStamp, point: t }, !this._view.isPointInContent(t)) {
6751
6755
  this._setUserSelection(void 0);
6752
6756
  return;
@@ -6764,15 +6768,15 @@ class cl extends V {
6764
6768
  }
6765
6769
  const r = this._clickCount === 1 && !e.shiftKey && this._model.readonlyMode.get();
6766
6770
  if (e.shiftKey) {
6767
- const u = this._model.selection.get() ?? b.collapsed(o);
6771
+ const u = this._model.selection.get() ?? k.collapsed(o);
6768
6772
  this._setUserSelection(u.withActive(o));
6769
6773
  } else
6770
- this._setUserSelection(b.collapsed(o));
6774
+ this._setUserSelection(k.collapsed(o));
6771
6775
  const c = this._view.element, a = e.pointerId;
6772
6776
  c.setPointerCapture(a), this._model.isSelecting.set(!0, void 0);
6773
6777
  const l = (u) => {
6774
- const h = this._model.selection.get() ?? b.collapsed(o), f = this._view.resolveOffsetFromPoint(new ae(u.clientX, u.clientY)) ?? h.active;
6775
- this._setUserSelection(new b(h.anchor, f));
6778
+ const h = this._model.selection.get() ?? k.collapsed(o), f = this._view.resolveOffsetFromPoint(new le(u.clientX, u.clientY)) ?? h.active;
6779
+ this._setUserSelection(new k(h.anchor, f));
6776
6780
  }, d = () => {
6777
6781
  this._model.isSelecting.set(!1, void 0), r && (this._model.selection.get()?.isCollapsed ?? !0) && this._view.showReadonlyEditingAttempt(), c.removeEventListener("pointermove", l), c.removeEventListener("pointerup", d), c.removeEventListener("pointercancel", d), c.removeEventListener("lostpointercapture", d);
6778
6782
  };
@@ -6782,7 +6786,7 @@ class cl extends V {
6782
6786
  const e = this._model.activeBlock.get();
6783
6787
  return {
6784
6788
  text: this._model.sourceText.get().value,
6785
- selection: this._model.selection.get() ?? b.collapsed(0),
6789
+ selection: this._model.selection.get() ?? k.collapsed(0),
6786
6790
  document: this._model.document.get(),
6787
6791
  activeBlock: e,
6788
6792
  markerVisibleBlocks: this._model.markerVisibleBlocks.get(),
@@ -6798,7 +6802,7 @@ class cl extends V {
6798
6802
  }
6799
6803
  _executeCursorCommand(e, t) {
6800
6804
  const s = this._makeCursorContext(), i = e(s), o = s.selection;
6801
- this._setUserSelection(t ? o.withActive(i) : b.collapsed(i)), this._desiredColumn = void 0;
6805
+ this._setUserSelection(t ? o.withActive(i) : k.collapsed(i)), this._desiredColumn = void 0;
6802
6806
  }
6803
6807
  _executeEditCommand(e) {
6804
6808
  if (this._model.readonlyMode.get()) {
@@ -6815,7 +6819,7 @@ class cl extends V {
6815
6819
  _executeVisualCursorCommand(e, t) {
6816
6820
  const s = this._makeVisualCursorContext(), i = e(s);
6817
6821
  this._setUserSelection(
6818
- t ? s.selection.withActive(i.offset) : b.collapsed(i.offset)
6822
+ t ? s.selection.withActive(i.offset) : k.collapsed(i.offset)
6819
6823
  ), this._desiredColumn = i.desiredColumn;
6820
6824
  }
6821
6825
  _setUserSelection(e) {
@@ -7010,7 +7014,7 @@ class cl extends V {
7010
7014
  const t = e.command;
7011
7015
  switch (t) {
7012
7016
  case "insert":
7013
- this._executeEditCommand(Mo(this._indentation));
7017
+ this._executeEditCommand(To(this._indentation));
7014
7018
  return;
7015
7019
  case "outdent":
7016
7020
  this._executeEditCommand(Oo(this._indentation));
@@ -7172,7 +7176,7 @@ function ea(n, e) {
7172
7176
  } catch {
7173
7177
  }
7174
7178
  }
7175
- class ll extends V {
7179
+ class ll extends $ {
7176
7180
  overlayElement;
7177
7181
  infoElement;
7178
7182
  rendering;
@@ -7240,22 +7244,22 @@ function na(n, e, t, s, i, o, r) {
7240
7244
  let a = 0, l = 0, d = 0;
7241
7245
  const u = /* @__PURE__ */ new Set();
7242
7246
  for (let m = 0; m < t.length; m++) {
7243
- const g = t[m], p = g.visualLineMap?.lines ?? [];
7244
- if (g.isMeasured && a++, l += p.length, i)
7245
- for (let _ = 0; _ < p.length; _++) {
7246
- const v = p[_], k = v.rect, y = document.createElement("div");
7247
- Object.assign(y.style, {
7247
+ const g = t[m], _ = g.visualLineMap?.lines ?? [];
7248
+ if (g.isMeasured && a++, l += _.length, i)
7249
+ for (let p = 0; p < _.length; p++) {
7250
+ const v = _[p], y = v.rect, b = document.createElement("div");
7251
+ Object.assign(b.style, {
7248
7252
  position: "absolute",
7249
7253
  left: "0",
7250
7254
  right: "0",
7251
- top: `${k.y}px`,
7252
- height: `${k.height}px`,
7255
+ top: `${y.y}px`,
7256
+ height: `${y.height}px`,
7253
7257
  border: "1px dashed rgba(180, 0, 200, 0.45)",
7254
7258
  boxSizing: "border-box"
7255
- }), n.appendChild(y);
7259
+ }), n.appendChild(b);
7256
7260
  for (const x of v.runs) {
7257
- const O = document.createElement("div");
7258
- Object.assign(O.style, {
7261
+ const T = document.createElement("div");
7262
+ Object.assign(T.style, {
7259
7263
  position: "absolute",
7260
7264
  left: `${x.rect.x}px`,
7261
7265
  top: `${x.rect.y}px`,
@@ -7263,14 +7267,14 @@ function na(n, e, t, s, i, o, r) {
7263
7267
  height: `${x.rect.height}px`,
7264
7268
  outline: "1px solid rgba(255, 100, 0, 0.45)",
7265
7269
  boxSizing: "border-box"
7266
- }), n.appendChild(O);
7270
+ }), n.appendChild(T);
7267
7271
  }
7268
7272
  }
7269
7273
  g.viewNode && (d += sa(n, c, g.viewNode, g.absoluteStart, u, o, r));
7270
7274
  }
7271
7275
  const h = `blocks: ${t.length} mounted: ${a} lines: ${l} chars: ${d}`, f = t.map((m, g) => {
7272
- const p = m.isMeasured ? "M" : "e", _ = m.visualLineMap?.lines.length ?? 0;
7273
- return `${String(g).padStart(2)} ${p} start=${String(m.absoluteStart).padStart(4)} h=${m.height.toFixed(1).padStart(6)} lines=${_} kind=${m.block.kind}`;
7276
+ const _ = m.isMeasured ? "M" : "e", p = m.visualLineMap?.lines.length ?? 0;
7277
+ return `${String(g).padStart(2)} ${_} start=${String(m.absoluteStart).padStart(4)} h=${m.height.toFixed(1).padStart(6)} lines=${p} kind=${m.block.kind}`;
7274
7278
  });
7275
7279
  return e.textContent = [h, ...f].join(`
7276
7280
  `), new ta(t.length, a, l, u);
@@ -7292,19 +7296,19 @@ function sa(n, e, t, s, i, o, r) {
7292
7296
  const m = a.getBoundingClientRect();
7293
7297
  if (m.height === 0)
7294
7298
  continue;
7295
- const g = e.toLocalRect(m), p = g.width === 0 ? 2 : g.width, _ = document.createElement("div");
7296
- Object.assign(_.style, {
7299
+ const g = e.toLocalRect(m), _ = g.width === 0 ? 2 : g.width, p = document.createElement("div");
7300
+ Object.assign(p.style, {
7297
7301
  position: "absolute",
7298
7302
  left: `${g.x}px`,
7299
7303
  top: `${g.y}px`,
7300
- width: `${p}px`,
7304
+ width: `${_}px`,
7301
7305
  height: `${g.height}px`,
7302
7306
  background: o?.(h) ?? "rgba(0, 120, 220, 0.30)",
7303
7307
  boxSizing: "border-box",
7304
7308
  pointerEvents: "auto"
7305
7309
  });
7306
7310
  const v = f.node.data?.[f.offset - 1] ?? "";
7307
- _.title = `offset ${h}: ${JSON.stringify(v)}`, _.dataset.offset = String(h), r ? (_.addEventListener("mouseenter", () => r.set(h, void 0)), _.addEventListener("mouseleave", () => r.set(void 0, void 0))) : (_.addEventListener("mouseenter", () => Zn(n, _, !0)), _.addEventListener("mouseleave", () => Zn(n, _, !1))), n.appendChild(_), i.add(h), c++;
7311
+ p.title = `offset ${h}: ${JSON.stringify(v)}`, p.dataset.offset = String(h), r ? (p.addEventListener("mouseenter", () => r.set(h, void 0)), p.addEventListener("mouseleave", () => r.set(void 0, void 0))) : (p.addEventListener("mouseenter", () => Zn(n, p, !0)), p.addEventListener("mouseleave", () => Zn(n, p, !1))), n.appendChild(p), i.add(h), c++;
7308
7312
  }
7309
7313
  return c;
7310
7314
  }
@@ -7515,7 +7519,7 @@ function dl(n, e) {
7515
7519
  return new oa(n, t);
7516
7520
  }
7517
7521
  const fa = '<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M14 7v1H8v6H7V8H1V7h6V1h1v6h6z"></path></svg>';
7518
- class ma extends V {
7522
+ class ma extends $ {
7519
7523
  constructor(e) {
7520
7524
  super(), this._options = e, this.element = document.createElement("div"), this.element.className = "md-comment-input", this._textarea = document.createElement("textarea"), this._textarea.className = "md-comment-input-textarea", this._textarea.rows = 1, this._textarea.placeholder = e?.placeholder ?? "Add Comment", this.element.appendChild(this._textarea), this._measure = document.createElement("span"), this._measure.className = "md-comment-input-measure", this._measure.setAttribute("aria-hidden", "true"), this.element.appendChild(this._measure);
7521
7525
  const t = document.createElement("div");
@@ -7582,7 +7586,7 @@ class ma extends V {
7582
7586
  r > 0 && (this._textarea.style.height = `${r}px`), this._options?.onDidChangeSize?.();
7583
7587
  }
7584
7588
  }
7585
- class ti extends V {
7589
+ class ti extends $ {
7586
7590
  constructor(e, t, s) {
7587
7591
  super(), this._model = e, this._view = t, this._options = s, this._gap = s?.gap ?? 8, this._widget = this._register(new ma({
7588
7592
  onDidChangeSize: () => {
@@ -7761,7 +7765,7 @@ class hl {
7761
7765
  }
7762
7766
  }
7763
7767
  const Ue = "http://www.w3.org/2000/svg", pa = 260, _a = 320, va = 0.32, wa = 28, ss = 16, ba = 12, ka = 18, ya = 4, xa = 2, Ea = 10;
7764
- class Ca extends V {
7768
+ class Ca extends $ {
7765
7769
  constructor(e, t) {
7766
7770
  super(), this._model = e, this._view = t, this._layer = this._createLayer("md-comment-shapes"), this._view.overlayContainer.appendChild(this._layer), this._register({
7767
7771
  dispose: () => {
@@ -7837,16 +7841,16 @@ class Ca extends V {
7837
7841
  avatarEl: c,
7838
7842
  timeEl: l,
7839
7843
  disposables: []
7840
- }, m = (_) => this._model.hoveredId.set(_ ? e.id : void 0, void 0), g = () => m(!0), p = () => m(!1);
7841
- return o.addEventListener("mouseenter", g), o.addEventListener("mouseleave", p), f.disposables.push({
7844
+ }, m = (p) => this._model.hoveredId.set(p ? e.id : void 0, void 0), g = () => m(!0), _ = () => m(!1);
7845
+ return o.addEventListener("mouseenter", g), o.addEventListener("mouseleave", _), f.disposables.push({
7842
7846
  dispose: () => {
7843
- o.removeEventListener("mouseenter", g), o.removeEventListener("mouseleave", p);
7847
+ o.removeEventListener("mouseenter", g), o.removeEventListener("mouseleave", _);
7844
7848
  }
7845
7849
  }), this._fillCard(f), f;
7846
7850
  }
7847
7851
  _fillCard(e) {
7848
7852
  const { comment: t } = e, s = t.author ?? "You";
7849
- e.authorEl.textContent = s, e.avatarEl.textContent = Ta(s), e.timeEl.textContent = t.createdAt !== void 0 ? Ma(t.createdAt) : "", e.bodyEl.textContent = t.body;
7853
+ e.authorEl.textContent = s, e.avatarEl.textContent = Ma(s), e.timeEl.textContent = t.createdAt !== void 0 ? Ta(t.createdAt) : "", e.bodyEl.textContent = t.body;
7850
7854
  }
7851
7855
  _disposeEntry(e) {
7852
7856
  for (const t of e.disposables)
@@ -7863,18 +7867,18 @@ class Ca extends V {
7863
7867
  this._layer.style.display = "";
7864
7868
  const i = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).width, o = getComputedStyle(s), r = parseFloat(o.maxWidth), c = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0), a = (parseFloat(o.borderLeftWidth) || 0) + (parseFloat(o.borderRightWidth) || 0), l = Number.isNaN(r) ? i : o.boxSizing === "border-box" ? r : r + c + a, d = Math.max(0, (i - Math.min(l, i)) / 2), u = Math.round(Math.max(pa, Math.min(_a, i * va))), h = u + wa + ss, f = d >= h ? 0 : Math.min(2 * (h - d), h), m = f > 0 ? `${Math.ceil(f)}px` : "";
7865
7869
  t.style.paddingRight !== m && (t.style.paddingRight = m);
7866
- const p = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).right - ss - u, _ = s.clientWidth, v = e.map(({ entry: y, rects: x }) => {
7867
- y.card.style.left = `${p}px`, y.card.style.width = `${u}px`;
7868
- const O = Sa(x), G = x.length > 0 ? Math.min(...x.map((_e) => _e.y)) : 0;
7869
- return { entry: y, rects: x, anchor: O, desiredTop: G };
7870
+ const _ = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).right - ss - u, p = s.clientWidth, v = e.map(({ entry: b, rects: x }) => {
7871
+ b.card.style.left = `${_}px`, b.card.style.width = `${u}px`;
7872
+ const T = Sa(x), D = x.length > 0 ? Math.min(...x.map((ce) => ce.y)) : 0;
7873
+ return { entry: b, rects: x, anchor: T, desiredTop: D };
7870
7874
  });
7871
- v.sort((y, x) => y.desiredTop - x.desiredTop);
7872
- let k = -1 / 0;
7873
- for (const y of v) {
7874
- const x = Math.max(y.desiredTop, k + ba);
7875
- y.entry.card.style.top = `${x}px`;
7876
- const O = y.entry.card.offsetHeight;
7877
- k = x + O, y.entry.shapePath.setAttribute("d", js(y.rects, ya)), y.entry.leaderPath.setAttribute("d", y.anchor ? La(y.anchor, _, { x: p, y: x + ka }) : "");
7875
+ v.sort((b, x) => b.desiredTop - x.desiredTop);
7876
+ let y = -1 / 0;
7877
+ for (const b of v) {
7878
+ const x = Math.max(b.desiredTop, y + ba);
7879
+ b.entry.card.style.top = `${x}px`;
7880
+ const T = b.entry.card.offsetHeight;
7881
+ y = x + T, b.entry.shapePath.setAttribute("d", js(b.rects, ya)), b.entry.leaderPath.setAttribute("d", b.anchor ? La(b.anchor, p, { x: _, y: x + ka }) : "");
7878
7882
  }
7879
7883
  }
7880
7884
  _applyHover(e) {
@@ -7897,14 +7901,14 @@ function La(n, e, t) {
7897
7901
  const s = Math.max(e, n.x + 12), i = t.x - s, o = s + i * 0.55, r = t.x - i * 0.45;
7898
7902
  return `M ${n.x} ${n.y} L ${s} ${n.y} C ${o} ${n.y}, ${r} ${t.y}, ${t.x} ${t.y}`;
7899
7903
  }
7900
- function Ta(n) {
7904
+ function Ma(n) {
7901
7905
  const e = n.trim().split(/\s+/).filter(Boolean);
7902
7906
  if (e.length === 0)
7903
7907
  return "?";
7904
7908
  const t = e[0][0] ?? "", s = e.length > 1 ? e[e.length - 1][0] ?? "" : "";
7905
7909
  return (t + s).toUpperCase();
7906
7910
  }
7907
- function Ma(n) {
7911
+ function Ta(n) {
7908
7912
  const e = Math.max(0, Math.round((Date.now() - n) / 1e3));
7909
7913
  if (e < 60)
7910
7914
  return "just now";
@@ -7931,7 +7935,7 @@ function Na(n, e) {
7931
7935
  c.element.style.left = `${l}px`, c.element.style.top = `${a}px`, r = a + c.element.offsetHeight;
7932
7936
  }
7933
7937
  }
7934
- class ni extends V {
7938
+ class ni extends $ {
7935
7939
  // Public so subclasses inherit a public constructor (the class is abstract,
7936
7940
  // so it still cannot be instantiated directly).
7937
7941
  constructor(e, t, s) {
@@ -8312,7 +8316,7 @@ const ul = {
8312
8316
  "vscode-v2": (n, e, t) => new Ha(n, e, t)
8313
8317
  };
8314
8318
  export {
8315
- z as AstNode,
8319
+ q as AstNode,
8316
8320
  il as AsyncClipboardStrategy,
8317
8321
  Ce as BlockQuoteAstNode,
8318
8322
  R as BlockViewNode,
@@ -8337,27 +8341,27 @@ export {
8337
8341
  nl as EditorModel,
8338
8342
  sl as EditorView,
8339
8343
  Nt as EmphasisAstNode,
8340
- Tc as FIND_MATCH_LIMIT,
8344
+ Mc as FIND_MATCH_LIMIT,
8341
8345
  Vc as FindController,
8342
8346
  Cc as FindHighlightsView,
8343
8347
  Ic as FindModel,
8344
8348
  tt as FindPattern,
8345
8349
  Fc as FindWidget,
8346
8350
  Ee as FrontMatterAstNode,
8347
- H as GlueAstNode,
8348
- le as HeadingAstNode,
8351
+ W as GlueAstNode,
8352
+ de as HeadingAstNode,
8349
8353
  Ae as ImageAstNode,
8350
8354
  Bt as InlineCodeAstNode,
8351
8355
  At as InlineMathAstNode,
8352
8356
  ke as LengthEdit,
8353
8357
  Ot as LengthReplacement,
8354
8358
  Be as LinkAstNode,
8355
- W as ListAstNode,
8356
- K as ListItemAstNode,
8359
+ K as ListAstNode,
8360
+ z as ListItemAstNode,
8357
8361
  al as LocalHistoryStrategy,
8358
8362
  Bi as MarkdownParser,
8359
8363
  E as MarkerAstNode,
8360
- pe as MathBlockAstNode,
8364
+ _e as MathBlockAstNode,
8361
8365
  ta as MeasuredLayoutDebugRendering,
8362
8366
  ll as MeasuredLayoutDebugView,
8363
8367
  io as MeasuredLayoutModel,
@@ -8365,14 +8369,14 @@ export {
8365
8369
  Wc as NativeClipboardStrategy,
8366
8370
  w as OffsetRange,
8367
8371
  ee as ParagraphAstNode,
8368
- ae as Point2D,
8372
+ le as Point2D,
8369
8373
  S as Rect2D,
8370
- b as Selection,
8374
+ k as Selection,
8371
8375
  tc as SelectionView,
8372
- Tn as SelectionViewRendering,
8376
+ Mn as SelectionViewRendering,
8373
8377
  ni as StackedCommentsPresenter,
8374
8378
  It as StrikethroughAstNode,
8375
- T as StringEdit,
8379
+ M as StringEdit,
8376
8380
  ie as StringReplacement,
8377
8381
  Yt as StringValue,
8378
8382
  Rt as StrongAstNode,
@@ -8380,7 +8384,7 @@ export {
8380
8384
  Ne as TableCellAstNode,
8381
8385
  Re as TableRowAstNode,
8382
8386
  Oe as TextAstNode,
8383
- me as ThematicBreakAstNode,
8387
+ ge as ThematicBreakAstNode,
8384
8388
  Ie as Token,
8385
8389
  oe as ViewNode,
8386
8390
  ji as VisualLine,
@@ -8389,7 +8393,7 @@ export {
8389
8393
  Ha as VsCodeV2CommentsView,
8390
8394
  Aa as VscodeStackedCommentsView,
8391
8395
  yt as blocksIntersecting,
8392
- Mt as commands,
8396
+ Tt as commands,
8393
8397
  dl as createDefaultMonacoSyntaxHighlighter,
8394
8398
  bo as cursorDocumentEnd,
8395
8399
  wo as cursorDocumentStart,
@@ -8413,7 +8417,7 @@ export {
8413
8417
  Co as deleteWordRight,
8414
8418
  Js as escapeFindRegex,
8415
8419
  ps as findBlockAtOffset,
8416
- de as findNodeOffsetById,
8420
+ he as findNodeOffsetById,
8417
8421
  as as findWordAt,
8418
8422
  ri as findWordBoundaryLeft,
8419
8423
  ci as findWordBoundaryRight,
@@ -8425,8 +8429,8 @@ export {
8425
8429
  No as insertLineBreak,
8426
8430
  Ro as insertParagraph,
8427
8431
  Bo as insertSmartEnter,
8428
- Mo as insertTab,
8429
- To as insertText,
8432
+ To as insertTab,
8433
+ Mo as insertText,
8430
8434
  Le as nextCursorPosition,
8431
8435
  re as normalizeCursorPosition,
8432
8436
  Oo as outdent,
@@ -8436,7 +8440,7 @@ export {
8436
8440
  el as taskCheckboxRange,
8437
8441
  tl as visualizeAst,
8438
8442
  rl as vscodeHostKeyboardProfile,
8439
- Tt as vscodeKeyboardProfile,
8443
+ Mt as vscodeKeyboardProfile,
8440
8444
  ol as vscodeLocalKeyboardProfile
8441
8445
  };
8442
8446
  //# sourceMappingURL=index.js.map