@vscode/markdown-editor 0.0.2-20 → 0.0.2-21

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,182 +1,12 @@
1
- import { parse as Gn, preprocess as jn, postprocess as Un } from "micromark";
2
- import { math as Xn } from "micromark-extension-math";
3
- import { gfmTable as Qn } from "micromark-extension-gfm-table";
4
- import { gfmTaskListItem as Yn } from "micromark-extension-gfm-task-list-item";
5
- import { gfmStrikethrough as Zn } from "micromark-extension-gfm-strikethrough";
6
- import { o as N, d as $, D as W, t as Jn, r as es, a as P, c as ts } from "./runOnChange-CkxK2gSn.js";
7
- import { createDiffComputer as ns } from "@vscode/diff";
1
+ import { O as v, S, a as it } from "./stringEdit-DzLs4E1d.js";
8
2
  import an from "katex";
9
- class _ {
10
- constructor(e, t) {
11
- if (this.start = e, this.endExclusive = t, e > t)
12
- throw new Error(`Invalid range: [${e}, ${t})`);
13
- }
14
- static fromTo(e, t) {
15
- return new _(e, t);
16
- }
17
- static ofLength(e) {
18
- return new _(0, e);
19
- }
20
- static ofStartAndLength(e, t) {
21
- return new _(e, e + t);
22
- }
23
- static emptyAt(e) {
24
- return new _(e, e);
25
- }
26
- get isEmpty() {
27
- return this.start === this.endExclusive;
28
- }
29
- get length() {
30
- return this.endExclusive - this.start;
31
- }
32
- delta(e) {
33
- return new _(this.start + e, this.endExclusive + e);
34
- }
35
- deltaStart(e) {
36
- return new _(this.start + e, this.endExclusive);
37
- }
38
- deltaEnd(e) {
39
- return new _(this.start, this.endExclusive + e);
40
- }
41
- contains(e) {
42
- return this.start <= e && e < this.endExclusive;
43
- }
44
- containsRange(e) {
45
- return this.start <= e.start && e.endExclusive <= this.endExclusive;
46
- }
47
- intersects(e) {
48
- return Math.max(this.start, e.start) < Math.min(this.endExclusive, e.endExclusive);
49
- }
50
- intersectsOrTouches(e) {
51
- return Math.max(this.start, e.start) <= Math.min(this.endExclusive, e.endExclusive);
52
- }
53
- intersect(e) {
54
- const t = Math.max(this.start, e.start), n = Math.min(this.endExclusive, e.endExclusive);
55
- if (t <= n)
56
- return new _(t, n);
57
- }
58
- join(e) {
59
- return new _(
60
- Math.min(this.start, e.start),
61
- Math.max(this.endExclusive, e.endExclusive)
62
- );
63
- }
64
- isBefore(e) {
65
- return this.endExclusive <= e.start;
66
- }
67
- isAfter(e) {
68
- return this.start >= e.endExclusive;
69
- }
70
- substring(e) {
71
- return e.substring(this.start, this.endExclusive);
72
- }
73
- slice(e) {
74
- return e.slice(this.start, this.endExclusive);
75
- }
76
- equals(e) {
77
- return this.start === e.start && this.endExclusive === e.endExclusive;
78
- }
79
- toString() {
80
- return `[${this.start}, ${this.endExclusive})`;
81
- }
82
- }
83
- class z {
84
- constructor(e, t) {
85
- this.replaceRange = e, this.newText = t;
86
- }
87
- static insert(e, t) {
88
- return new z(_.emptyAt(e), t);
89
- }
90
- static replace(e, t) {
91
- return new z(e, t);
92
- }
93
- static delete(e) {
94
- return new z(e, "");
95
- }
96
- get isEmpty() {
97
- return this.replaceRange.isEmpty && this.newText.length === 0;
98
- }
99
- equals(e) {
100
- return this.replaceRange.equals(e.replaceRange) && this.newText === e.newText;
101
- }
102
- toString() {
103
- return `${this.replaceRange} -> ${JSON.stringify(this.newText)}`;
104
- }
105
- }
106
- class T {
107
- static empty = new T([]);
108
- static single(e) {
109
- return new T([e]);
110
- }
111
- static replace(e, t) {
112
- return new T([z.replace(e, t)]);
113
- }
114
- static insert(e, t) {
115
- return new T([z.insert(e, t)]);
116
- }
117
- static delete(e) {
118
- return new T([z.delete(e)]);
119
- }
120
- replacements;
121
- constructor(e) {
122
- let t = -1;
123
- for (const n of e) {
124
- if (n.replaceRange.start < t)
125
- throw new Error(
126
- `Edits must be disjoint and sorted. Found ${n} after ${t}`
127
- );
128
- t = n.replaceRange.endExclusive;
129
- }
130
- this.replacements = e;
131
- }
132
- get isEmpty() {
133
- return this.replacements.length === 0;
134
- }
135
- apply(e) {
136
- const t = [];
137
- let n = 0;
138
- for (const i of this.replacements)
139
- t.push(e.substring(n, i.replaceRange.start)), t.push(i.newText), n = i.replaceRange.endExclusive;
140
- return t.push(e.substring(n)), t.join("");
141
- }
142
- inverse(e) {
143
- const t = [];
144
- let n = 0;
145
- for (const i of this.replacements) {
146
- const o = e.substring(i.replaceRange.start, i.replaceRange.endExclusive);
147
- t.push(
148
- z.replace(
149
- _.ofStartAndLength(i.replaceRange.start + n, i.newText.length),
150
- o
151
- )
152
- ), n += i.newText.length - i.replaceRange.length;
153
- }
154
- return new T(t);
155
- }
156
- equals(e) {
157
- if (this.replacements.length !== e.replacements.length)
158
- return !1;
159
- for (let t = 0; t < this.replacements.length; t++)
160
- if (!this.replacements[t].equals(e.replacements[t]))
161
- return !1;
162
- return !0;
163
- }
164
- mapOffset(e) {
165
- let t = 0;
166
- for (const n of this.replacements) {
167
- if (n.replaceRange.start > e)
168
- break;
169
- if (n.replaceRange.endExclusive <= e)
170
- t += n.newText.length - n.replaceRange.length;
171
- else
172
- return n.replaceRange.start + t + n.newText.length;
173
- }
174
- return e + t;
175
- }
176
- toString() {
177
- return `[${this.replacements.map((e) => e.toString()).join(", ")}]`;
178
- }
179
- }
3
+ import { o as N, d as P, D as W, t as qn, r as jn, a as $, c as Un } from "./runOnChange-CkxK2gSn.js";
4
+ import { parse as Xn, preprocess as Qn, postprocess as Yn } from "micromark";
5
+ import { math as Zn } from "micromark-extension-math";
6
+ import { gfmTable as Jn } from "micromark-extension-gfm-table";
7
+ import { gfmTaskListItem as es } from "micromark-extension-gfm-task-list-item";
8
+ import { gfmStrikethrough as ts } from "micromark-extension-gfm-strikethrough";
9
+ import { createDiffComputer as ns } from "@vscode/diff";
180
10
  class ot {
181
11
  constructor(e, t) {
182
12
  if (this.replaceRange = e, this.newLength = t, t < 0)
@@ -195,13 +25,13 @@ class ot {
195
25
  return `${this.replaceRange} -> +${this.newLength}`;
196
26
  }
197
27
  }
198
- class me {
199
- static empty = new me([]);
28
+ class ge {
29
+ static empty = new ge([]);
200
30
  static single(e) {
201
- return new me([e]);
31
+ return new ge([e]);
202
32
  }
203
33
  static replace(e, t) {
204
- return new me([ot.replace(e, t)]);
34
+ return new ge([ot.replace(e, t)]);
205
35
  }
206
36
  replacements;
207
37
  constructor(e) {
@@ -228,7 +58,7 @@ class me {
228
58
  return this.isEmpty ? "LengthEdit.empty" : this.replacements.join(", ");
229
59
  }
230
60
  }
231
- class Me {
61
+ class Se {
232
62
  constructor(e) {
233
63
  this.value = e;
234
64
  }
@@ -242,12 +72,12 @@ class Me {
242
72
  return this.value;
243
73
  }
244
74
  }
245
- class x {
75
+ class b {
246
76
  constructor(e, t) {
247
77
  this.anchor = e, this.active = t;
248
78
  }
249
79
  static collapsed(e) {
250
- return new x(e, e);
80
+ return new b(e, e);
251
81
  }
252
82
  get isCollapsed() {
253
83
  return this.anchor === this.active;
@@ -256,22 +86,22 @@ class x {
256
86
  return this.active >= this.anchor;
257
87
  }
258
88
  get range() {
259
- return this.isForward ? new _(this.anchor, this.active) : new _(this.active, this.anchor);
89
+ return this.isForward ? new v(this.anchor, this.active) : new v(this.active, this.anchor);
260
90
  }
261
91
  collapseToActive() {
262
- return x.collapsed(this.active);
92
+ return b.collapsed(this.active);
263
93
  }
264
94
  withActive(e) {
265
- return new x(this.anchor, e);
95
+ return new b(this.anchor, e);
266
96
  }
267
97
  }
268
- class ve {
98
+ class _e {
269
99
  constructor(e, t) {
270
100
  this.x = e, this.y = t;
271
101
  }
272
- static ZERO = new ve(0, 0);
102
+ static ZERO = new _e(0, 0);
273
103
  translate(e, t) {
274
- return new ve(this.x + e, this.y + t);
104
+ return new _e(this.x + e, this.y + t);
275
105
  }
276
106
  }
277
107
  class V {
@@ -298,7 +128,7 @@ class V {
298
128
  return this.y + this.height;
299
129
  }
300
130
  get topLeft() {
301
- return new ve(this.x, this.y);
131
+ return new _e(this.x, this.y);
302
132
  }
303
133
  containsX(e) {
304
134
  return e >= this.left && e < this.right;
@@ -434,14 +264,14 @@ function R(s, e) {
434
264
  }
435
265
  return t ?? e;
436
266
  }
437
- function Y(s, e) {
267
+ function Q(s, e) {
438
268
  const t = s.get(e);
439
269
  return t && t !== e ? t : e;
440
270
  }
441
- function se(s, e) {
442
- return e ? Y(s, e) : void 0;
271
+ function ne(s, e) {
272
+ return e ? Q(s, e) : void 0;
443
273
  }
444
- class Ke extends F {
274
+ class Fe extends F {
445
275
  get children() {
446
276
  return os;
447
277
  }
@@ -452,7 +282,7 @@ class Ke extends F {
452
282
  return this;
453
283
  }
454
284
  }
455
- class be extends Ke {
285
+ class be extends Fe {
456
286
  constructor(e) {
457
287
  super(), this.content = e;
458
288
  }
@@ -461,7 +291,7 @@ class be extends Ke {
461
291
  return this.content === e.content;
462
292
  }
463
293
  }
464
- class b extends Ke {
294
+ class x extends Fe {
465
295
  constructor(e, t) {
466
296
  super(), this.markerKind = e, this.content = t;
467
297
  }
@@ -470,7 +300,7 @@ class b extends Ke {
470
300
  return this.markerKind === e.markerKind && this.content === e.content;
471
301
  }
472
302
  }
473
- class H extends Ke {
303
+ class H extends Fe {
474
304
  constructor(e, t) {
475
305
  super(), this.content = e, this.glueKind = t;
476
306
  }
@@ -479,13 +309,13 @@ class H extends Ke {
479
309
  return this.content === e.content && this.glueKind === e.glueKind;
480
310
  }
481
311
  }
482
- class te extends F {
312
+ class ee extends F {
483
313
  /** Prepends {@link leadingTrivia}, if any, ahead of the block's own children. */
484
314
  _withLeading(e) {
485
315
  return this.leadingTrivia ? [this.leadingTrivia, ...e] : e;
486
316
  }
487
317
  }
488
- class le extends te {
318
+ class ae extends ee {
489
319
  constructor(e, t) {
490
320
  super(), this.content = e, this.leadingTrivia = t;
491
321
  }
@@ -494,17 +324,17 @@ class le extends te {
494
324
  return this._withLeading(this.content);
495
325
  }
496
326
  get marker() {
497
- return pe(this.content, "content");
327
+ return me(this.content, "content");
498
328
  }
499
329
  mapChildren(e) {
500
- return new le(R(e, this.content), se(e, this.leadingTrivia));
330
+ return new ae(R(e, this.content), ne(e, this.leadingTrivia));
501
331
  }
502
332
  withLeadingTrivia(e) {
503
- return new le(this.content, e);
333
+ return new ae(this.content, e);
504
334
  }
505
335
  }
506
- function pe(s, e) {
507
- return s.find((t) => t instanceof b && t.markerKind === e);
336
+ function me(s, e) {
337
+ return s.find((t) => t instanceof x && t.markerKind === e);
508
338
  }
509
339
  class rt extends F {
510
340
  constructor(e, t, n) {
@@ -515,7 +345,7 @@ class rt extends F {
515
345
  return [this.openMarker, ...this.content, this.closeMarker];
516
346
  }
517
347
  mapChildren(e) {
518
- return new rt(Y(e, this.openMarker), R(e, this.content), Y(e, this.closeMarker));
348
+ return new rt(Q(e, this.openMarker), R(e, this.content), Q(e, this.closeMarker));
519
349
  }
520
350
  }
521
351
  class ct extends F {
@@ -527,7 +357,7 @@ class ct extends F {
527
357
  return [this.openMarker, ...this.content, this.closeMarker];
528
358
  }
529
359
  mapChildren(e) {
530
- return new ct(Y(e, this.openMarker), R(e, this.content), Y(e, this.closeMarker));
360
+ return new ct(Q(e, this.openMarker), R(e, this.content), Q(e, this.closeMarker));
531
361
  }
532
362
  }
533
363
  class at extends F {
@@ -539,7 +369,7 @@ class at extends F {
539
369
  return [this.openMarker, ...this.content, this.closeMarker];
540
370
  }
541
371
  mapChildren(e) {
542
- return new at(Y(e, this.openMarker), R(e, this.content), Y(e, this.closeMarker));
372
+ return new at(Q(e, this.openMarker), R(e, this.content), Q(e, this.closeMarker));
543
373
  }
544
374
  }
545
375
  class lt extends F {
@@ -566,7 +396,7 @@ class dt extends F {
566
396
  return new dt(R(e, this.content));
567
397
  }
568
398
  }
569
- class Le extends F {
399
+ class Ce extends F {
570
400
  constructor(e, t) {
571
401
  super(), this.url = e, this.content = t;
572
402
  }
@@ -575,13 +405,13 @@ class Le extends F {
575
405
  return this.content;
576
406
  }
577
407
  mapChildren(e) {
578
- return new Le(this.url, R(e, this.content));
408
+ return new Ce(this.url, R(e, this.content));
579
409
  }
580
410
  _localEquals(e) {
581
411
  return this.url === e.url;
582
412
  }
583
413
  }
584
- class Te extends F {
414
+ class Le extends F {
585
415
  constructor(e, t, n) {
586
416
  super(), this.alt = e, this.url = t, this.content = n;
587
417
  }
@@ -590,13 +420,13 @@ class Te extends F {
590
420
  return this.content;
591
421
  }
592
422
  mapChildren(e) {
593
- return new Te(this.alt, this.url, R(e, this.content));
423
+ return new Le(this.alt, this.url, R(e, this.content));
594
424
  }
595
425
  _localEquals(e) {
596
426
  return this.alt === e.alt && this.url === e.url;
597
427
  }
598
428
  }
599
- class de extends te {
429
+ class le extends ee {
600
430
  constructor(e, t, n) {
601
431
  super(), this.tokenType = e, this.content = t, this.leadingTrivia = n;
602
432
  }
@@ -605,19 +435,19 @@ class de extends te {
605
435
  return this._withLeading(this.content);
606
436
  }
607
437
  get code() {
608
- return pe(this.content, "content");
438
+ return me(this.content, "content");
609
439
  }
610
440
  mapChildren(e) {
611
- return new de(this.tokenType, R(e, this.content), se(e, this.leadingTrivia));
441
+ return new le(this.tokenType, R(e, this.content), ne(e, this.leadingTrivia));
612
442
  }
613
443
  withLeadingTrivia(e) {
614
- return new de(this.tokenType, this.content, e);
444
+ return new le(this.tokenType, this.content, e);
615
445
  }
616
446
  _localEquals(e) {
617
447
  return this.tokenType === e.tokenType;
618
448
  }
619
449
  }
620
- class oe extends te {
450
+ class ie extends ee {
621
451
  constructor(e, t, n, i) {
622
452
  super(), this.level = e, this.marker = t, this.content = n, this.leadingTrivia = i;
623
453
  }
@@ -626,16 +456,16 @@ class oe extends te {
626
456
  return this._withLeading([this.marker, ...this.content]);
627
457
  }
628
458
  mapChildren(e) {
629
- return new oe(this.level, Y(e, this.marker), R(e, this.content), se(e, this.leadingTrivia));
459
+ return new ie(this.level, Q(e, this.marker), R(e, this.content), ne(e, this.leadingTrivia));
630
460
  }
631
461
  withLeadingTrivia(e) {
632
- return new oe(this.level, this.marker, this.content, e);
462
+ return new ie(this.level, this.marker, this.content, e);
633
463
  }
634
464
  _localEquals(e) {
635
465
  return this.level === e.level;
636
466
  }
637
467
  }
638
- class Z extends te {
468
+ class Y extends ee {
639
469
  constructor(e, t) {
640
470
  super(), this.content = e, this.leadingTrivia = t;
641
471
  }
@@ -644,13 +474,13 @@ class Z extends te {
644
474
  return this._withLeading(this.content);
645
475
  }
646
476
  mapChildren(e) {
647
- return new Z(R(e, this.content), se(e, this.leadingTrivia));
477
+ return new Y(R(e, this.content), ne(e, this.leadingTrivia));
648
478
  }
649
479
  withLeadingTrivia(e) {
650
- return new Z(this.content, e);
480
+ return new Y(this.content, e);
651
481
  }
652
482
  }
653
- class G extends te {
483
+ class G extends ee {
654
484
  constructor(e, t, n) {
655
485
  super(), this.language = e, this.content = t, this.leadingTrivia = n;
656
486
  }
@@ -661,13 +491,13 @@ class G extends te {
661
491
  return this._withLeading(this.content);
662
492
  }
663
493
  get openFence() {
664
- return pe(this.content, "openFence");
494
+ return me(this.content, "openFence");
665
495
  }
666
496
  get closeFence() {
667
- return pe(this.content, "closeFence");
497
+ return me(this.content, "closeFence");
668
498
  }
669
499
  get code() {
670
- return pe(this.content, "content");
500
+ return me(this.content, "content");
671
501
  }
672
502
  /** Relative start offset of the {@link code} marker within this block. */
673
503
  get codeOffset() {
@@ -680,7 +510,7 @@ class G extends te {
680
510
  return e;
681
511
  }
682
512
  mapChildren(e) {
683
- return new G(this.language, R(e, this.content), se(e, this.leadingTrivia));
513
+ return new G(this.language, R(e, this.content), ne(e, this.leadingTrivia));
684
514
  }
685
515
  withLeadingTrivia(e) {
686
516
  return new G(this.language, this.content, e);
@@ -708,7 +538,7 @@ class G extends te {
708
538
  return { stringEdit: this._contentEdit };
709
539
  }
710
540
  }
711
- class he extends te {
541
+ class de extends ee {
712
542
  constructor(e, t) {
713
543
  super(), this.content = e, this.leadingTrivia = t;
714
544
  }
@@ -717,16 +547,16 @@ class he extends te {
717
547
  return this._withLeading(this.content);
718
548
  }
719
549
  get code() {
720
- return pe(this.content, "content");
550
+ return me(this.content, "content");
721
551
  }
722
552
  mapChildren(e) {
723
- return new he(R(e, this.content), se(e, this.leadingTrivia));
553
+ return new de(R(e, this.content), ne(e, this.leadingTrivia));
724
554
  }
725
555
  withLeadingTrivia(e) {
726
- return new he(this.content, e);
556
+ return new de(this.content, e);
727
557
  }
728
558
  }
729
- class we extends te {
559
+ class ve extends ee {
730
560
  constructor(e, t) {
731
561
  super(), this.content = e, this.leadingTrivia = t;
732
562
  }
@@ -738,13 +568,13 @@ class we extends te {
738
568
  return this.content.filter(ut);
739
569
  }
740
570
  mapChildren(e) {
741
- return new we(R(e, this.content), se(e, this.leadingTrivia));
571
+ return new ve(R(e, this.content), ne(e, this.leadingTrivia));
742
572
  }
743
573
  withLeadingTrivia(e) {
744
- return new we(this.content, e);
574
+ return new ve(this.content, e);
745
575
  }
746
576
  }
747
- class J extends te {
577
+ class Z extends ee {
748
578
  constructor(e, t, n) {
749
579
  super(), this.ordered = e, this.content = t, this.leadingTrivia = n;
750
580
  }
@@ -753,19 +583,19 @@ class J extends te {
753
583
  return this._withLeading(this.content);
754
584
  }
755
585
  get items() {
756
- return this.content.filter((e) => e instanceof ee);
586
+ return this.content.filter((e) => e instanceof J);
757
587
  }
758
588
  mapChildren(e) {
759
- return new J(this.ordered, R(e, this.content), se(e, this.leadingTrivia));
589
+ return new Z(this.ordered, R(e, this.content), ne(e, this.leadingTrivia));
760
590
  }
761
591
  withLeadingTrivia(e) {
762
- return new J(this.ordered, this.content, e);
592
+ return new Z(this.ordered, this.content, e);
763
593
  }
764
594
  _localEquals(e) {
765
595
  return this.ordered === e.ordered;
766
596
  }
767
597
  }
768
- class ee extends F {
598
+ class J extends F {
769
599
  constructor(e, t, n, i) {
770
600
  super(), this.marker = e, this.content = t, this.checked = n, this.leadingTrivia = i;
771
601
  }
@@ -777,21 +607,21 @@ class ee extends F {
777
607
  return this.content.filter(ut);
778
608
  }
779
609
  mapChildren(e) {
780
- return new ee(
781
- Y(e, this.marker),
610
+ return new J(
611
+ Q(e, this.marker),
782
612
  R(e, this.content),
783
613
  this.checked,
784
- this.leadingTrivia ? Y(e, this.leadingTrivia) : void 0
614
+ this.leadingTrivia ? Q(e, this.leadingTrivia) : void 0
785
615
  );
786
616
  }
787
617
  withLeadingTrivia(e) {
788
- return new ee(this.marker, this.content, this.checked, e);
618
+ return new J(this.marker, this.content, this.checked, e);
789
619
  }
790
620
  _localEquals(e) {
791
621
  return this.checked === e.checked;
792
622
  }
793
623
  }
794
- class ke extends te {
624
+ class we extends ee {
795
625
  constructor(e, t) {
796
626
  super(), this.content = e, this.leadingTrivia = t;
797
627
  }
@@ -800,7 +630,7 @@ class ke extends te {
800
630
  return this._withLeading(this.content);
801
631
  }
802
632
  get _rows() {
803
- return this.content.filter((e) => e instanceof ye);
633
+ return this.content.filter((e) => e instanceof xe);
804
634
  }
805
635
  get headerRow() {
806
636
  return this._rows[0];
@@ -812,13 +642,13 @@ class ke extends te {
812
642
  return this._rows.slice(2);
813
643
  }
814
644
  mapChildren(e) {
815
- return new ke(R(e, this.content), se(e, this.leadingTrivia));
645
+ return new we(R(e, this.content), ne(e, this.leadingTrivia));
816
646
  }
817
647
  withLeadingTrivia(e) {
818
- return new ke(this.content, e);
648
+ return new we(this.content, e);
819
649
  }
820
650
  }
821
- class ye extends F {
651
+ class xe extends F {
822
652
  constructor(e) {
823
653
  super(), this.content = e;
824
654
  }
@@ -827,13 +657,13 @@ class ye extends F {
827
657
  return this.content;
828
658
  }
829
659
  get cells() {
830
- return this.content.filter((e) => e instanceof Ee);
660
+ return this.content.filter((e) => e instanceof ye);
831
661
  }
832
662
  mapChildren(e) {
833
- return new ye(R(e, this.content));
663
+ return new xe(R(e, this.content));
834
664
  }
835
665
  }
836
- class Ee extends F {
666
+ class ye extends F {
837
667
  constructor(e) {
838
668
  super(), this.content = e;
839
669
  }
@@ -842,7 +672,7 @@ class Ee extends F {
842
672
  return this.content;
843
673
  }
844
674
  mapChildren(e) {
845
- return new Ee(R(e, this.content));
675
+ return new ye(R(e, this.content));
846
676
  }
847
677
  }
848
678
  class ht extends F {
@@ -861,7 +691,7 @@ class ht extends F {
861
691
  }
862
692
  }
863
693
  function ut(s) {
864
- return s instanceof oe || s instanceof Z || s instanceof G || s instanceof he || s instanceof le || s instanceof we || s instanceof J || s instanceof ke || s instanceof de;
694
+ return s instanceof ie || s instanceof Y || s instanceof G || s instanceof de || s instanceof ae || s instanceof ve || s instanceof Z || s instanceof we || s instanceof le;
865
695
  }
866
696
  function hn(s, e) {
867
697
  if (s.id === e.id)
@@ -875,15 +705,15 @@ function hn(s, e) {
875
705
  }
876
706
  }
877
707
  const rs = /\[[ xX]\]/;
878
- function Nr(s) {
708
+ function Rr(s) {
879
709
  if (s.checked === void 0)
880
710
  return;
881
711
  const e = rs.exec(un(s));
882
712
  if (e)
883
- return _.ofStartAndLength(e.index, e[0].length);
713
+ return v.ofStartAndLength(e.index, e[0].length);
884
714
  }
885
715
  function un(s) {
886
- if (s instanceof Ke)
716
+ if (s instanceof Fe)
887
717
  return s.content;
888
718
  let e = "";
889
719
  for (const t of s.children)
@@ -891,8 +721,8 @@ function un(s) {
891
721
  return e;
892
722
  }
893
723
  function cs(s) {
894
- const e = Gn({ extensions: [Xn(), Qn(), Yn(), Zn()] }), t = jn()(s, void 0, !0);
895
- return Un(e.document().write(t)).map(([i, o]) => ({
724
+ const e = Xn({ extensions: [Zn(), Jn(), es(), ts()] }), t = Qn()(s, void 0, !0);
725
+ return Yn(e.document().write(t)).map(([i, o]) => ({
896
726
  type: i,
897
727
  tokenType: o.type,
898
728
  startOffset: o.start.offset,
@@ -907,7 +737,7 @@ const ls = /* @__PURE__ */ new Set([
907
737
  "setextHeading",
908
738
  "definition"
909
739
  ]);
910
- function Ne(s) {
740
+ function Me(s) {
911
741
  const e = [];
912
742
  for (let t = 0; t < s.length; t++) {
913
743
  const n = s[t], i = s[t + 1];
@@ -930,22 +760,22 @@ function Ne(s) {
930
760
  return e;
931
761
  }
932
762
  function ds(s, e) {
933
- if (s instanceof J) {
934
- const t = s.content.findIndex((i) => i instanceof ee);
763
+ if (s instanceof Z) {
764
+ const t = s.content.findIndex((i) => i instanceof J);
935
765
  if (t < 0)
936
766
  return;
937
767
  const n = s.content.map((i, o) => o === t ? i.withLeadingTrivia(e) : i);
938
- return new J(s.ordered, n, s.leadingTrivia);
768
+ return new Z(s.ordered, n, s.leadingTrivia);
939
769
  }
940
- if (s instanceof ee || s instanceof te)
770
+ if (s instanceof J || s instanceof ee)
941
771
  return s.withLeadingTrivia(e);
942
772
  }
943
- function Re(s) {
773
+ function Ne(s) {
944
774
  const e = [];
945
775
  for (let t = 0; t < s.length; t++) {
946
776
  const n = s[t];
947
777
  if (n instanceof H && n.glueKind === void 0) {
948
- const i = e[e.length - 1], o = s[t + 1], r = i instanceof Z && o instanceof Z, c = new H(n.content, r ? "blockBreak" : "blockGap"), a = i !== void 0 ? fn(i, c) : void 0;
778
+ const i = e[e.length - 1], o = s[t + 1], r = i instanceof Y && o instanceof Y, c = new H(n.content, r ? "blockBreak" : "blockGap"), a = i !== void 0 ? fn(i, c) : void 0;
949
779
  a ? e[e.length - 1] = a : e.push(c);
950
780
  continue;
951
781
  }
@@ -957,11 +787,11 @@ function fn(s, e) {
957
787
  switch (s.kind) {
958
788
  case "paragraph": {
959
789
  const t = s;
960
- return new Z([...t.content, e], t.leadingTrivia);
790
+ return new Y([...t.content, e], t.leadingTrivia);
961
791
  }
962
792
  case "heading": {
963
793
  const t = s;
964
- return new oe(t.level, t.marker, [...t.content, e], t.leadingTrivia);
794
+ return new ie(t.level, t.marker, [...t.content, e], t.leadingTrivia);
965
795
  }
966
796
  case "codeBlock": {
967
797
  const t = s;
@@ -969,37 +799,37 @@ function fn(s, e) {
969
799
  }
970
800
  case "mathBlock": {
971
801
  const t = s;
972
- return new he([...t.content, e], t.leadingTrivia);
802
+ return new de([...t.content, e], t.leadingTrivia);
973
803
  }
974
804
  case "thematicBreak": {
975
805
  const t = s;
976
- return new le([...t.content, e], t.leadingTrivia);
806
+ return new ae([...t.content, e], t.leadingTrivia);
977
807
  }
978
808
  case "unhandledBlock": {
979
809
  const t = s;
980
- return new de(t.tokenType, [...t.content, e], t.leadingTrivia);
810
+ return new le(t.tokenType, [...t.content, e], t.leadingTrivia);
981
811
  }
982
812
  case "table": {
983
813
  const t = s;
984
- return new ke([...t.content, e], t.leadingTrivia);
814
+ return new we([...t.content, e], t.leadingTrivia);
985
815
  }
986
816
  case "blockQuote": {
987
817
  const t = s;
988
- return new we(qe(t.content, e), t.leadingTrivia);
818
+ return new ve(ze(t.content, e), t.leadingTrivia);
989
819
  }
990
820
  case "list": {
991
821
  const t = s;
992
- return new J(t.ordered, qe(t.content, e), t.leadingTrivia);
822
+ return new Z(t.ordered, ze(t.content, e), t.leadingTrivia);
993
823
  }
994
824
  case "listItem": {
995
825
  const t = s;
996
- return new ee(t.marker, qe(t.content, e), t.checked, t.leadingTrivia);
826
+ return new J(t.marker, ze(t.content, e), t.checked, t.leadingTrivia);
997
827
  }
998
828
  default:
999
829
  return;
1000
830
  }
1001
831
  }
1002
- function qe(s, e) {
832
+ function ze(s, e) {
1003
833
  const t = s[s.length - 1], n = t !== void 0 ? fn(t, e) : void 0;
1004
834
  if (n) {
1005
835
  const i = s.slice();
@@ -1008,7 +838,7 @@ function qe(s, e) {
1008
838
  return [...s, e];
1009
839
  }
1010
840
  function hs(s) {
1011
- return s.some((e) => !(e instanceof H)) ? s : [new Z(s)];
841
+ return s.some((e) => !(e instanceof H)) ? s : [new Y(s)];
1012
842
  }
1013
843
  class M {
1014
844
  constructor(e, t) {
@@ -1058,7 +888,7 @@ class us {
1058
888
  } else
1059
889
  this._idx++;
1060
890
  }
1061
- return new ht(hs(Re(Ne(e.build(this._source.length)))));
891
+ return new ht(hs(Ne(Me(e.build(this._source.length)))));
1062
892
  }
1063
893
  _tryParseBlock() {
1064
894
  switch (this._events[this._idx].tokenType) {
@@ -1102,7 +932,7 @@ class us {
1102
932
  r.tokenType === t && (n += r.type === "enter" ? 1 : -1), n === 0 && (i = r), this._idx++;
1103
933
  }
1104
934
  const o = this._source.substring(e.startOffset, i.endOffset);
1105
- return new de(t, [new b("content", o)]);
935
+ return new le(t, [new x("content", o)]);
1106
936
  }
1107
937
  /**
1108
938
  * Decides what to do with an unrecognized `enter` token at the top of a
@@ -1135,11 +965,11 @@ class us {
1135
965
  }
1136
966
  const r = this._consume("exit", "atxHeading");
1137
967
  i > n && o.length > 0 && (i = o[0].start);
1138
- const c = new b("headingMarker", this._source.substring(e.startOffset, i)), a = new M(i, this._source);
968
+ const c = new x("headingMarker", this._source.substring(e.startOffset, i)), a = new M(i, this._source);
1139
969
  for (const d of o)
1140
970
  a.add(d.node, d.start);
1141
971
  const l = a.build(r.endOffset - i);
1142
- return new oe(t, c, l);
972
+ return new ie(t, c, l);
1143
973
  }
1144
974
  _parseParagraph() {
1145
975
  const e = this._consume("enter", "paragraph"), t = [];
@@ -1148,7 +978,7 @@ class us {
1148
978
  const n = this._consume("exit", "paragraph"), i = new M(e.startOffset, this._source);
1149
979
  for (const o of t)
1150
980
  i.add(o.node, o.start);
1151
- return new Z(i.build(n.endOffset - e.startOffset));
981
+ return new Y(i.build(n.endOffset - e.startOffset));
1152
982
  }
1153
983
  _parseCodeFenced() {
1154
984
  const e = this._consume("enter", "codeFenced");
@@ -1171,14 +1001,14 @@ class us {
1171
1001
  this._idx++;
1172
1002
  }
1173
1003
  const d = this._consume("exit", "codeFencedFence");
1174
- n.add(new b(
1004
+ n.add(new x(
1175
1005
  i ? "closeFence" : "openFence",
1176
1006
  this._source.substring(l.startOffset, d.endOffset)
1177
1007
  ), l.startOffset), i = !0;
1178
1008
  } else a.tokenType === "codeFlowValue" || a.tokenType === "lineEnding" ? (o === void 0 && (o = a.startOffset), r = a.endOffset, this._idx++) : this._idx++;
1179
1009
  }
1180
1010
  const c = this._consume("exit", "codeFenced");
1181
- return o !== void 0 && n.add(new b("content", this._source.substring(o, r)), o), new G(t, n.build(c.endOffset - e.startOffset));
1011
+ return o !== void 0 && n.add(new x("content", this._source.substring(o, r)), o), new G(t, n.build(c.endOffset - e.startOffset));
1182
1012
  }
1183
1013
  /**
1184
1014
  * An indented code block has no fences and no info string: micromark strips a
@@ -1192,14 +1022,14 @@ class us {
1192
1022
  const e = this._consume("enter", "codeIndented"), t = new M(e.startOffset, this._source);
1193
1023
  let n, i;
1194
1024
  const o = () => {
1195
- n !== void 0 && (t.add(new b("content", this._source.substring(n, i)), n), n = void 0);
1025
+ n !== void 0 && (t.add(new x("content", this._source.substring(n, i)), n), n = void 0);
1196
1026
  };
1197
1027
  for (; this._notExit("codeIndented"); ) {
1198
1028
  const c = this._events[this._idx];
1199
1029
  if (c.type === "enter" && c.tokenType === "linePrefix") {
1200
1030
  o();
1201
1031
  const a = this._consume("enter", "linePrefix"), l = this._consume("exit", "linePrefix");
1202
- t.add(new b("codeIndent", this._source.substring(a.startOffset, l.endOffset)), a.startOffset);
1032
+ t.add(new x("codeIndent", this._source.substring(a.startOffset, l.endOffset)), a.startOffset);
1203
1033
  } else c.tokenType === "codeFlowValue" || c.tokenType === "lineEnding" ? (n === void 0 && (n = c.startOffset), i = c.endOffset, this._idx++) : this._idx++;
1204
1034
  }
1205
1035
  o();
@@ -1216,21 +1046,21 @@ class us {
1216
1046
  for (; this._notExit("mathFlowFence"); )
1217
1047
  this._idx++;
1218
1048
  const l = this._consume("exit", "mathFlowFence");
1219
- t.add(new b(
1049
+ t.add(new x(
1220
1050
  n ? "closeFence" : "openFence",
1221
1051
  this._source.substring(a.startOffset, l.endOffset)
1222
1052
  ), a.startOffset), n = !0;
1223
1053
  } else c.tokenType === "mathFlowValue" || c.tokenType === "lineEnding" ? (i === void 0 && (i = c.startOffset), o = c.endOffset, this._idx++) : this._idx++;
1224
1054
  }
1225
1055
  const r = this._consume("exit", "mathFlow");
1226
- return i !== void 0 && t.add(new b("content", this._source.substring(i, o)), i), new he(t.build(r.endOffset - e.startOffset));
1056
+ return i !== void 0 && t.add(new x("content", this._source.substring(i, o)), i), new de(t.build(r.endOffset - e.startOffset));
1227
1057
  }
1228
1058
  _parseThematicBreak() {
1229
1059
  const e = this._consume("enter", "thematicBreak");
1230
1060
  for (; this._notExit("thematicBreak"); )
1231
1061
  this._idx++;
1232
- const t = this._consume("exit", "thematicBreak"), n = new b("content", this._source.substring(e.startOffset, t.endOffset));
1233
- return new le([n]);
1062
+ const t = this._consume("exit", "thematicBreak"), n = new x("content", this._source.substring(e.startOffset, t.endOffset));
1063
+ return new ae([n]);
1234
1064
  }
1235
1065
  _parseBlockQuote() {
1236
1066
  const e = this._consume("enter", "blockQuote"), t = new M(e.startOffset, this._source);
@@ -1242,7 +1072,7 @@ class us {
1242
1072
  for (; this._notExit("blockQuotePrefix"); )
1243
1073
  this._idx++;
1244
1074
  const a = this._consume("exit", "blockQuotePrefix");
1245
- n || t.add(new b("blockQuoteMarker", this._source.substring(c.startOffset, a.endOffset)), c.startOffset), i = Math.max(i, a.endOffset);
1075
+ n || t.add(new x("blockQuoteMarker", this._source.substring(c.startOffset, a.endOffset)), c.startOffset), i = Math.max(i, a.endOffset);
1246
1076
  } else if (r.type === "enter") {
1247
1077
  const c = r.startOffset, a = this._tryParseBlock();
1248
1078
  if (a)
@@ -1255,7 +1085,7 @@ class us {
1255
1085
  this._idx++;
1256
1086
  }
1257
1087
  const o = this._consume("exit", "blockQuote");
1258
- return new we(Re(Ne(t.build(o.endOffset - e.startOffset))));
1088
+ return new ve(Ne(Me(t.build(o.endOffset - e.startOffset))));
1259
1089
  }
1260
1090
  _parseList() {
1261
1091
  const e = this._events[this._idx].tokenType, t = e === "listOrdered", n = this._consume("enter", e), i = new M(n.startOffset, this._source);
@@ -1263,8 +1093,8 @@ class us {
1263
1093
  const u = () => {
1264
1094
  if (o === void 0 || r === void 0 || a === void 0)
1265
1095
  return;
1266
- const h = new b("listItemMarker", this._source.substring(r, c)), g = d ?? c, m = a.build(g - c);
1267
- i.add(new ee(h, Re(Ne(m)), l), o);
1096
+ const h = new x("listItemMarker", this._source.substring(r, c)), g = d ?? c, m = a.build(g - c);
1097
+ i.add(new J(h, Ne(Me(m)), l), o);
1268
1098
  };
1269
1099
  for (; this._notExit(e); ) {
1270
1100
  const h = this._events[this._idx];
@@ -1285,7 +1115,7 @@ class us {
1285
1115
  }
1286
1116
  u();
1287
1117
  const f = this._consume("exit", e);
1288
- return new J(t, Re(Ne(i.build(f.endOffset - n.startOffset))));
1118
+ return new Z(t, Ne(Me(i.build(f.endOffset - n.startOffset))));
1289
1119
  }
1290
1120
  _parseTable() {
1291
1121
  const e = this._consume("enter", "table"), t = new M(e.startOffset, this._source);
@@ -1318,7 +1148,7 @@ class us {
1318
1148
  this._idx++;
1319
1149
  }
1320
1150
  const i = this._consume("exit", "table");
1321
- return new ke(t.build(i.endOffset - e.startOffset));
1151
+ return new we(t.build(i.endOffset - e.startOffset));
1322
1152
  }
1323
1153
  _buildDelimiterRow(e, t, n) {
1324
1154
  const i = this._source.substring(e, t), o = [];
@@ -1336,9 +1166,9 @@ class us {
1336
1166
  const a = new M(e, this._source);
1337
1167
  for (let l = 0; l < r.length; l++) {
1338
1168
  const d = r[l], u = l + 1 < r.length ? r[l + 1] : i.length, f = new M(e + d, this._source), h = i.substring(d, u);
1339
- l === r.length - 1 && h.length > 1 && h.endsWith("|") ? (f.add(new b("tableDelimiter", h.slice(0, -1)), e + d), f.add(new b("tableDelimiterClose", "|"), e + d + h.length - 1)) : f.add(new b("tableDelimiter", h), e + d), a.add(new Ee(f.build(u - d)), e + d);
1169
+ l === r.length - 1 && h.length > 1 && h.endsWith("|") ? (f.add(new x("tableDelimiter", h.slice(0, -1)), e + d), f.add(new x("tableDelimiterClose", "|"), e + d + h.length - 1)) : f.add(new x("tableDelimiter", h), e + d), a.add(new ye(f.build(u - d)), e + d);
1340
1170
  }
1341
- return new ye(a.build(t - e));
1171
+ return new xe(a.build(t - e));
1342
1172
  }
1343
1173
  _parseTableRow(e) {
1344
1174
  const t = this._consume("enter", "tableRow"), n = new M(t.startOffset, this._source);
@@ -1358,12 +1188,12 @@ class us {
1358
1188
  const a = this._consume("exit", e), l = new M(r.startOffset, this._source);
1359
1189
  for (const d of c)
1360
1190
  l.add(d.node, d.start);
1361
- n.add(new Ee(l.build(a.endOffset - r.startOffset, "tableCellGlue")), r.startOffset);
1191
+ n.add(new ye(l.build(a.endOffset - r.startOffset, "tableCellGlue")), r.startOffset);
1362
1192
  } else
1363
1193
  this._idx++;
1364
1194
  }
1365
1195
  const i = this._consume("exit", "tableRow");
1366
- return new ye(n.build(i.endOffset - t.startOffset));
1196
+ return new xe(n.build(i.endOffset - t.startOffset));
1367
1197
  }
1368
1198
  _parseInlines(e, t) {
1369
1199
  for (; this._idx < this._events.length; ) {
@@ -1417,14 +1247,14 @@ class us {
1417
1247
  this._idx++;
1418
1248
  let n = this._consume("exit", t).endOffset;
1419
1249
  const i = this._events[this._idx];
1420
- return i && i.type === "enter" && i.tokenType === "lineEnding" && (this._consume("enter", "lineEnding"), n = this._consume("exit", "lineEnding").endOffset), { node: new b("hardBreak", this._source.substring(e.startOffset, n)), start: e.startOffset };
1250
+ return i && i.type === "enter" && i.tokenType === "lineEnding" && (this._consume("enter", "lineEnding"), n = this._consume("exit", "lineEnding").endOffset), { node: new x("hardBreak", this._source.substring(e.startOffset, n)), start: e.startOffset };
1421
1251
  }
1422
1252
  _parseEmphasisOrStrong(e) {
1423
1253
  const t = this._events[this._idx].tokenType, n = t === "strongSequence", i = this._consume("enter", t), o = this._consume("exit", t), r = [];
1424
1254
  for (; this._idx < this._events.length; ) {
1425
1255
  const c = this._events[this._idx];
1426
1256
  if (c.type === "enter" && c.tokenType === t) {
1427
- const a = this._consume("enter", t), l = this._consume("exit", t), d = new b("openMarker", this._source.substring(i.startOffset, o.endOffset)), u = new b("closeMarker", this._source.substring(a.startOffset, l.endOffset)), f = new M(o.endOffset, this._source);
1257
+ const a = this._consume("enter", t), l = this._consume("exit", t), d = new x("openMarker", this._source.substring(i.startOffset, o.endOffset)), u = new x("closeMarker", this._source.substring(a.startOffset, l.endOffset)), f = new M(o.endOffset, this._source);
1428
1258
  for (const m of r)
1429
1259
  f.add(m.node, m.start);
1430
1260
  const h = f.build(a.startOffset - o.endOffset), g = n ? new rt(d, h, u) : new ct(d, h, u);
@@ -1440,20 +1270,20 @@ class us {
1440
1270
  let n = !1, i, o;
1441
1271
  for (; this._notExit("codeText"); ) {
1442
1272
  const c = this._events[this._idx];
1443
- c.type === "enter" && c.tokenType === "codeTextSequence" ? (t.add(new b(n ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), n = !0) : c.type === "enter" && c.tokenType === "codeTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
1273
+ c.type === "enter" && c.tokenType === "codeTextSequence" ? (t.add(new x(n ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), n = !0) : c.type === "enter" && c.tokenType === "codeTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
1444
1274
  }
1445
1275
  const r = this._consume("exit", "codeText");
1446
- return i !== void 0 && t.add(new b("content", this._source.substring(i, o)), i), { node: new lt(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1276
+ return i !== void 0 && t.add(new x("content", this._source.substring(i, o)), i), { node: new lt(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1447
1277
  }
1448
1278
  _parseInlineMath() {
1449
1279
  const e = this._consume("enter", "mathText"), t = new M(e.startOffset, this._source);
1450
1280
  let n = !1, i, o;
1451
1281
  for (; this._notExit("mathText"); ) {
1452
1282
  const c = this._events[this._idx];
1453
- c.type === "enter" && c.tokenType === "mathTextSequence" ? (t.add(new b(n ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), n = !0) : c.type === "enter" && c.tokenType === "mathTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
1283
+ c.type === "enter" && c.tokenType === "mathTextSequence" ? (t.add(new x(n ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), n = !0) : c.type === "enter" && c.tokenType === "mathTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
1454
1284
  }
1455
1285
  const r = this._consume("exit", "mathText");
1456
- return i !== void 0 && t.add(new b("content", this._source.substring(i, o)), i), { node: new dt(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1286
+ return i !== void 0 && t.add(new x("content", this._source.substring(i, o)), i), { node: new dt(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1457
1287
  }
1458
1288
  _parseStrikethrough() {
1459
1289
  const e = this._consume("enter", "strikethrough");
@@ -1463,7 +1293,7 @@ class us {
1463
1293
  const l = this._events[this._idx];
1464
1294
  if (l.type === "enter" && l.tokenType === "strikethroughSequence") {
1465
1295
  const d = this._source.substring(l.startOffset, l.endOffset);
1466
- t ? (n = new b("closeMarker", d), o = l.startOffset) : (t = new b("openMarker", d), i = l.endOffset), this._idx++;
1296
+ t ? (n = new x("closeMarker", d), o = l.startOffset) : (t = new x("openMarker", d), i = l.endOffset), this._idx++;
1467
1297
  } else l.type === "enter" && l.tokenType === "strikethroughText" ? (this._consume("enter", "strikethroughText"), this._parseInlines(r, "strikethroughText"), this._consume("exit", "strikethroughText")) : this._idx++;
1468
1298
  }
1469
1299
  this._consume("exit", "strikethrough");
@@ -1482,7 +1312,7 @@ class us {
1482
1312
  for (this._consume("enter", "label"); this._notExit("label"); ) {
1483
1313
  const a = this._events[this._idx];
1484
1314
  if (a.type === "enter" && a.tokenType === "labelMarker")
1485
- t.add(new b(o ? "closeBracket" : "openBracket", this._source.substring(a.startOffset, a.endOffset)), a.startOffset), o = !0;
1315
+ t.add(new x(o ? "closeBracket" : "openBracket", this._source.substring(a.startOffset, a.endOffset)), a.startOffset), o = !0;
1486
1316
  else if (a.type === "enter" && a.tokenType === "labelText") {
1487
1317
  this._consume("enter", "labelText"), this._parseInlines(n, "labelText"), this._consume("exit", "labelText");
1488
1318
  continue;
@@ -1495,7 +1325,7 @@ class us {
1495
1325
  let a = !1;
1496
1326
  for (; this._notExit("resource"); ) {
1497
1327
  const l = this._events[this._idx];
1498
- l.type === "enter" && l.tokenType === "resourceMarker" ? (t.add(new b(a ? "closeParen" : "openParen", this._source.substring(l.startOffset, l.endOffset)), l.startOffset), a = !0) : l.type === "enter" && l.tokenType === "resourceDestinationString" && (i = this._source.substring(l.startOffset, l.endOffset), t.add(new b("url", i), l.startOffset)), this._idx++;
1328
+ l.type === "enter" && l.tokenType === "resourceMarker" ? (t.add(new x(a ? "closeParen" : "openParen", this._source.substring(l.startOffset, l.endOffset)), l.startOffset), a = !0) : l.type === "enter" && l.tokenType === "resourceDestinationString" && (i = this._source.substring(l.startOffset, l.endOffset), t.add(new x("url", i), l.startOffset)), this._idx++;
1499
1329
  }
1500
1330
  this._consume("exit", "resource");
1501
1331
  } else
@@ -1504,7 +1334,7 @@ class us {
1504
1334
  const r = this._consume("exit", "link");
1505
1335
  for (const c of n)
1506
1336
  t.add(c.node, c.start);
1507
- return { node: new Le(i, t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1337
+ return { node: new Ce(i, t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1508
1338
  }
1509
1339
  _parseImage() {
1510
1340
  const e = this._consume("enter", "image"), t = new M(e.startOffset, this._source);
@@ -1514,7 +1344,7 @@ class us {
1514
1344
  if (c.type === "enter" && c.tokenType === "label") {
1515
1345
  for (this._consume("enter", "label"); this._notExit("label"); ) {
1516
1346
  const a = this._events[this._idx];
1517
- a.type === "enter" && a.tokenType === "labelImageMarker" ? t.add(new b("bangBracket", this._source.substring(a.startOffset, a.endOffset)), a.startOffset) : a.type === "enter" && a.tokenType === "labelMarker" ? (t.add(new b(o ? "closeBracket" : "openBracket", this._source.substring(a.startOffset, a.endOffset)), a.startOffset), o = !0) : a.type === "enter" && a.tokenType === "labelText" && (n = this._source.substring(a.startOffset, a.endOffset)), this._idx++;
1347
+ a.type === "enter" && a.tokenType === "labelImageMarker" ? t.add(new x("bangBracket", this._source.substring(a.startOffset, a.endOffset)), a.startOffset) : a.type === "enter" && a.tokenType === "labelMarker" ? (t.add(new x(o ? "closeBracket" : "openBracket", this._source.substring(a.startOffset, a.endOffset)), a.startOffset), o = !0) : a.type === "enter" && a.tokenType === "labelText" && (n = this._source.substring(a.startOffset, a.endOffset)), this._idx++;
1518
1348
  }
1519
1349
  this._consume("exit", "label");
1520
1350
  } else if (c.type === "enter" && c.tokenType === "resource") {
@@ -1522,14 +1352,14 @@ class us {
1522
1352
  let a = !1;
1523
1353
  for (; this._notExit("resource"); ) {
1524
1354
  const l = this._events[this._idx];
1525
- l.type === "enter" && l.tokenType === "resourceMarker" ? (t.add(new b(a ? "closeParen" : "openParen", this._source.substring(l.startOffset, l.endOffset)), l.startOffset), a = !0) : l.type === "enter" && l.tokenType === "resourceDestinationString" && (i = this._source.substring(l.startOffset, l.endOffset)), this._idx++;
1355
+ l.type === "enter" && l.tokenType === "resourceMarker" ? (t.add(new x(a ? "closeParen" : "openParen", this._source.substring(l.startOffset, l.endOffset)), l.startOffset), a = !0) : l.type === "enter" && l.tokenType === "resourceDestinationString" && (i = this._source.substring(l.startOffset, l.endOffset)), this._idx++;
1526
1356
  }
1527
1357
  this._consume("exit", "resource");
1528
1358
  } else
1529
1359
  this._idx++;
1530
1360
  }
1531
1361
  const r = this._consume("exit", "image");
1532
- return { node: new Te(n, i, t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1362
+ return { node: new Le(n, i, t.build(r.endOffset - e.startOffset)), start: e.startOffset };
1533
1363
  }
1534
1364
  _notExit(e) {
1535
1365
  if (this._idx >= this._events.length)
@@ -1609,7 +1439,7 @@ function mn(s, e, t, n, i) {
1609
1439
  f !== u && (o ??= /* @__PURE__ */ new Map()).set(u, f), r += u.length;
1610
1440
  }
1611
1441
  let c = o ? s.mapChildren(o) : s;
1612
- const a = t.getOriginalRange(_.ofStartAndLength(e, s.length));
1442
+ const a = t.getOriginalRange(v.ofStartAndLength(e, s.length));
1613
1443
  if (a) {
1614
1444
  const u = n.lookupExact(a, c.kind);
1615
1445
  if (u && c.equalsShallow(u))
@@ -1641,7 +1471,7 @@ function ms(s, e, t) {
1641
1471
  return !0;
1642
1472
  }
1643
1473
  function ps(s, e) {
1644
- return new T(s.replacements.map((t) => z.replace(t.replaceRange.delta(e), t.newText)));
1474
+ return new S(s.replacements.map((t) => it.replace(t.replaceRange.delta(e), t.newText)));
1645
1475
  }
1646
1476
  function _s(s, e, t) {
1647
1477
  return mn(s, 0, new gn(t), new fs(e), t);
@@ -1660,36 +1490,36 @@ function ks(s, e, t = 0) {
1660
1490
  const o = pn(e.substring(t, t + s.length));
1661
1491
  if (s instanceof be)
1662
1492
  return o;
1663
- const r = s instanceof b ? s.markerKind : s.kind;
1664
- return `<${r}${xt(s)}>${o}</${r}>`;
1493
+ const r = s instanceof x ? s.markerKind : s.kind;
1494
+ return `<${r}${bt(s)}>${o}</${r}>`;
1665
1495
  }
1666
1496
  let n = "", i = t;
1667
1497
  for (const o of s.children)
1668
1498
  n += ks(o, e, i), i += o.length;
1669
- return `<${s.kind}${xt(s)}>${n}</${s.kind}>`;
1499
+ return `<${s.kind}${bt(s)}>${n}</${s.kind}>`;
1670
1500
  }
1671
- function xt(s) {
1501
+ function bt(s) {
1672
1502
  const e = {};
1673
- return s instanceof oe ? e.level = String(s.level) : s instanceof J ? e.ordered = String(s.ordered) : s instanceof G ? s.language && (e.language = s.language) : s instanceof Le ? e.url = s.url : s instanceof Te ? (e.alt = s.alt, e.url = s.url) : s instanceof ee ? s.checked !== void 0 && (e.checked = String(s.checked)) : s instanceof de ? e.token = s.tokenType : s instanceof H && s.glueKind && (e.kind = s.glueKind), Object.entries(e).map(([t, n]) => ` ${t}="${pn(n)}"`).join("");
1503
+ return s instanceof ie ? e.level = String(s.level) : s instanceof Z ? e.ordered = String(s.ordered) : s instanceof G ? s.language && (e.language = s.language) : s instanceof Ce ? e.url = s.url : s instanceof Le ? (e.alt = s.alt, e.url = s.url) : s instanceof J ? s.checked !== void 0 && (e.checked = String(s.checked)) : s instanceof le ? e.token = s.tokenType : s instanceof H && s.glueKind && (e.kind = s.glueKind), Object.entries(e).map(([t, n]) => ` ${t}="${pn(n)}"`).join("");
1674
1504
  }
1675
1505
  function pn(s) {
1676
1506
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1677
1507
  }
1678
- function xs(s) {
1679
- return s instanceof be ? `text ${JSON.stringify(s.content)}` : s instanceof H ? `glue${s.glueKind ? `(${s.glueKind})` : ""} ${JSON.stringify(s.content)}` : s instanceof b ? `marker(${s.markerKind}) ${JSON.stringify(s.content)}` : s instanceof le ? `thematicBreak ${JSON.stringify(s.content)}` : s instanceof oe ? `heading(level=${s.level})` : s instanceof J ? `list(ordered=${s.ordered})` : s instanceof ee ? s.checked === void 0 ? "listItem" : `listItem(checked=${s.checked})` : s instanceof G ? `codeBlock(language=${JSON.stringify(s.language)})` : s instanceof he ? "mathBlock" : s instanceof Le ? `link(url=${JSON.stringify(s.url)})` : s instanceof Te ? `image(alt=${JSON.stringify(s.alt)}, url=${JSON.stringify(s.url)})` : s.kind;
1508
+ function bs(s) {
1509
+ return s instanceof be ? `text ${JSON.stringify(s.content)}` : s instanceof H ? `glue${s.glueKind ? `(${s.glueKind})` : ""} ${JSON.stringify(s.content)}` : s instanceof x ? `marker(${s.markerKind}) ${JSON.stringify(s.content)}` : s instanceof ae ? `thematicBreak ${JSON.stringify(s.content)}` : s instanceof ie ? `heading(level=${s.level})` : s instanceof Z ? `list(ordered=${s.ordered})` : s instanceof J ? s.checked === void 0 ? "listItem" : `listItem(checked=${s.checked})` : s instanceof G ? `codeBlock(language=${JSON.stringify(s.language)})` : s instanceof de ? "mathBlock" : s instanceof Ce ? `link(url=${JSON.stringify(s.url)})` : s instanceof Le ? `image(alt=${JSON.stringify(s.alt)}, url=${JSON.stringify(s.url)})` : s.kind;
1680
1510
  }
1681
- const bt = /* @__PURE__ */ new WeakMap();
1682
- let bs = 0;
1511
+ const xt = /* @__PURE__ */ new WeakMap();
1512
+ let xs = 0;
1683
1513
  function ys(s) {
1684
- let e = bt.get(s);
1685
- return e === void 0 && (e = bs++, bt.set(s, e)), e;
1514
+ let e = xt.get(s);
1515
+ return e === void 0 && (e = xs++, xt.set(s, e)), e;
1686
1516
  }
1687
- function Rr(s, e) {
1517
+ function Br(s, e) {
1688
1518
  let t = 0;
1689
1519
  function n(i) {
1690
1520
  const o = t, r = i.children;
1691
1521
  let c;
1692
- return r.length === 0 ? t += i.length : c = r.map(n), { label: `${xs(i)} #${ys(i)} nid=${i.id}`, range: [o, t], children: c };
1522
+ return r.length === 0 ? t += i.length : c = r.map(n), { label: `${bs(i)} #${ys(i)} nid=${i.id}`, range: [o, t], children: c };
1693
1523
  }
1694
1524
  return { $fileExtension: "ast.w", source: e, root: n(s) };
1695
1525
  }
@@ -1700,28 +1530,28 @@ function Es(s) {
1700
1530
  const i = n.replaceRange.start + e;
1701
1531
  t.push({
1702
1532
  original: n.replaceRange,
1703
- modified: _.ofStartAndLength(i, n.newText.length)
1533
+ modified: v.ofStartAndLength(i, n.newText.length)
1704
1534
  }), e += n.newText.length - n.replaceRange.length;
1705
1535
  }
1706
1536
  return t;
1707
1537
  }
1708
1538
  const Cs = {}, _n = N(Cs, !1), Ls = _n;
1709
- let Je, Ge;
1539
+ let Ze, Ge;
1710
1540
  function Ts() {
1711
1541
  return Ge || (Ge = ns({ useWasm: !1 }).then((s) => {
1712
- Je = s, _n.set(!0, void 0);
1542
+ Ze = s, _n.set(!0, void 0);
1713
1543
  }).catch(() => {
1714
1544
  })), Ge;
1715
1545
  }
1716
1546
  Ts();
1717
- function Ss(s, e) {
1718
- if (!Je)
1547
+ function Os(s, e) {
1548
+ if (!Ze)
1719
1549
  throw new Error("Diff computer not loaded yet — await ensureDiffComputer() / observe diffComputerReady first.");
1720
- const t = Je.computeDiff(s, e, { extendToSubwords: !0 });
1721
- return Os(t.edits.stripData());
1550
+ const t = Ze.computeDiff(s, e, { extendToSubwords: !0 });
1551
+ return Ss(t.edits.stripData());
1722
1552
  }
1723
- function Os(s) {
1724
- return new T(s.replacements.map((e) => z.replace(new _(e.range.start, e.range.endExclusive), e.newText)));
1553
+ function Ss(s) {
1554
+ return new S(s.replacements.map((e) => it.replace(new v(e.range.start, e.range.endExclusive), e.newText)));
1725
1555
  }
1726
1556
  const Ms = /* @__PURE__ */ new Set([
1727
1557
  "document",
@@ -1738,10 +1568,10 @@ function vn(s, e, t, n, i, o) {
1738
1568
  const r = yt(s, e), c = yt(t, n), a = [];
1739
1569
  let l = 0;
1740
1570
  for (const d of c) {
1741
- const u = _.ofStartAndLength(d.start, d.node.length), f = i.getOriginalOffset(d.start);
1571
+ const u = v.ofStartAndLength(d.start, d.node.length), f = i.getOriginalOffset(d.start);
1742
1572
  for (; l < r.length && f !== void 0 && r[l].start + r[l].node.length <= f; )
1743
1573
  a.push(Et(r[l], o)), l++;
1744
- const h = l < r.length ? r[l] : void 0, g = h ? _.ofStartAndLength(h.start, h.node.length) : void 0, m = i.getOriginalRange(u);
1574
+ const h = l < r.length ? r[l] : void 0, g = h ? v.ofStartAndLength(h.start, h.node.length) : void 0, m = i.getOriginalRange(u);
1745
1575
  m && g && m.equals(g) ? (a.push({ kind: "unchanged", node: d.node, modifiedStart: d.start }), l++) : h && g && h.node.kind === d.node.kind && f !== void 0 && g.contains(f) ? (l++, Ms.has(d.node.kind) ? a.push({
1746
1576
  kind: "nested",
1747
1577
  original: h.node,
@@ -1757,7 +1587,7 @@ function vn(s, e, t, n, i, o) {
1757
1587
  modifiedStart: d.start,
1758
1588
  insertedLocal: Pe(u, d.start, o, "modified", "inserted"),
1759
1589
  deletedLocal: Pe(g, h.start, o, "original", "deleted")
1760
- })) : a.push(Is(d, o));
1590
+ })) : a.push(Bs(d, o));
1761
1591
  }
1762
1592
  for (; l < r.length; )
1763
1593
  a.push(Et(r[l], o)), l++;
@@ -1770,15 +1600,15 @@ function yt(s, e) {
1770
1600
  Ns.has(i.kind) || t.push({ node: i, start: n }), n += i.length;
1771
1601
  return t;
1772
1602
  }
1773
- function Is(s, e) {
1774
- const t = _.ofStartAndLength(s.start, s.node.length);
1603
+ function Bs(s, e) {
1604
+ const t = v.ofStartAndLength(s.start, s.node.length);
1775
1605
  let n = Pe(t, s.start, e, "modified", "inserted");
1776
- return n.length === 0 && (n = [{ range: _.ofLength(s.node.length), kind: "inserted" }]), { kind: "added", node: s.node, modifiedStart: s.start, insertedLocal: n };
1606
+ return n.length === 0 && (n = [{ range: v.ofLength(s.node.length), kind: "inserted" }]), { kind: "added", node: s.node, modifiedStart: s.start, insertedLocal: n };
1777
1607
  }
1778
1608
  function Et(s, e) {
1779
- const t = _.ofStartAndLength(s.start, s.node.length);
1609
+ const t = v.ofStartAndLength(s.start, s.node.length);
1780
1610
  let n = Pe(t, s.start, e, "original", "deleted");
1781
- return n.length === 0 && (n = [{ range: _.ofLength(s.node.length), kind: "deleted" }]), { kind: "removed", node: s.node, originalStart: s.start, deletedLocal: n };
1611
+ return n.length === 0 && (n = [{ range: v.ofLength(s.node.length), kind: "deleted" }]), { kind: "removed", node: s.node, originalStart: s.start, deletedLocal: n };
1782
1612
  }
1783
1613
  function Pe(s, e, t, n, i) {
1784
1614
  const o = [];
@@ -1788,7 +1618,7 @@ function Pe(s, e, t, n, i) {
1788
1618
  }
1789
1619
  return o;
1790
1620
  }
1791
- const Bs = Symbol("NO_ACTIVE_BLOCKS");
1621
+ const Is = Symbol("NO_ACTIVE_BLOCKS");
1792
1622
  class Ir {
1793
1623
  _parser = new ws();
1794
1624
  /**
@@ -1798,7 +1628,7 @@ class Ir {
1798
1628
  * source text (see {@link document}).
1799
1629
  */
1800
1630
  _pendingEdit;
1801
- sourceText = N(this, new Me(""));
1631
+ sourceText = N(this, new Se(""));
1802
1632
  /**
1803
1633
  * Read-only mode. When `true`, the editor never reveals a block's source
1804
1634
  * markers (markdown special characters like `**`, `#`, list bullets, code
@@ -1851,7 +1681,7 @@ class Ir {
1851
1681
  * and the next keystroke.
1852
1682
  */
1853
1683
  pendingParagraph = N(this, void 0);
1854
- cursorOffset = $(
1684
+ cursorOffset = P(
1855
1685
  this,
1856
1686
  (e) => e.readObservable(this.selection)?.active
1857
1687
  );
@@ -1864,7 +1694,7 @@ class Ir {
1864
1694
  */
1865
1695
  document = (() => {
1866
1696
  let e, t;
1867
- return $(this, (n) => {
1697
+ return P(this, (n) => {
1868
1698
  const i = n.readObservable(this.sourceText), o = this._pendingEdit, r = o && o.baseText === t && o.newText === i.value ? o.edit : void 0, c = this._parser.parse(i, e, r);
1869
1699
  return e = c, t = i.value, c;
1870
1700
  });
@@ -1875,7 +1705,7 @@ class Ir {
1875
1705
  * visible. Unaffected by {@link activeBlocksOverride} because
1876
1706
  * navigation is independent of rendering.
1877
1707
  */
1878
- activeBlock = $(this, (e) => {
1708
+ activeBlock = P(this, (e) => {
1879
1709
  const t = e.readObservable(this.document), n = e.readObservable(this.cursorOffset);
1880
1710
  if (n !== void 0)
1881
1711
  return wn(t, n);
@@ -1886,13 +1716,13 @@ class Ir {
1886
1716
  * their expanded (markers-visible) form. When the selection is
1887
1717
  * collapsed this is a one-element set holding {@link activeBlock}.
1888
1718
  */
1889
- activeBlocks = $(this, (e) => {
1719
+ activeBlocks = P(this, (e) => {
1890
1720
  if (this.readonlyMode.read(e))
1891
1721
  return /* @__PURE__ */ new Set();
1892
1722
  if (e.readObservable(this.pendingParagraph) !== void 0)
1893
1723
  return /* @__PURE__ */ new Set();
1894
1724
  const t = e.readObservable(this.activeBlocksOverride);
1895
- if (t === Bs)
1725
+ if (t === Is)
1896
1726
  return /* @__PURE__ */ new Set();
1897
1727
  if (t !== void 0)
1898
1728
  return new Set(t);
@@ -1906,7 +1736,7 @@ class Ir {
1906
1736
  * `undefined` (the default) renders normally.
1907
1737
  */
1908
1738
  baseline = N(this, void 0);
1909
- _baselineDocument = $(this, (e) => {
1739
+ _baselineDocument = P(this, (e) => {
1910
1740
  const t = e.readObservable(this.baseline);
1911
1741
  return t ? this._parser.parse(t) : void 0;
1912
1742
  });
@@ -1916,11 +1746,11 @@ class Ir {
1916
1746
  * decorations; `insertedRanges` (modified-side change spans) drive the green
1917
1747
  * word-level highlight.
1918
1748
  */
1919
- diff = $(this, (e) => {
1749
+ diff = P(this, (e) => {
1920
1750
  const t = e.readObservable(this._baselineDocument), n = e.readObservable(this.baseline);
1921
1751
  if (!t || !n || !e.readObservable(Ls))
1922
1752
  return;
1923
- const i = e.readObservable(this.document), o = e.readObservable(this.sourceText), r = Ss(n.value, o.value), c = Rs(t, i, r), a = [], l = (u, f) => {
1753
+ const i = e.readObservable(this.document), o = e.readObservable(this.sourceText), r = Os(n.value, o.value), c = Rs(t, i, r), a = [], l = (u, f) => {
1924
1754
  for (const h of u)
1925
1755
  if (h.kind === "replaced")
1926
1756
  for (const g of h.insertedLocal)
@@ -1942,7 +1772,7 @@ class Ir {
1942
1772
  * applied — the blank line exists only in the view until it is materialized.
1943
1773
  */
1944
1774
  armPendingParagraph(e) {
1945
- this.pendingParagraph.set({ ...e, syntheticAst: new Z([]) }, void 0), this.selection.set(x.collapsed(e.replaceRange.start), void 0);
1775
+ this.pendingParagraph.set({ ...e, syntheticAst: new Y([]) }, void 0), this.selection.set(b.collapsed(e.replaceRange.start), void 0);
1946
1776
  }
1947
1777
  /** Discard the pending paragraph (if any) without touching the source. */
1948
1778
  cancelPendingParagraph() {
@@ -1963,23 +1793,23 @@ class Ir {
1963
1793
 
1964
1794
  ` + e + (t.atEof ? "" : `
1965
1795
 
1966
- `), i = t.replaceRange.start + 2 + e.length, o = T.replace(t.replaceRange, n);
1796
+ `), i = t.replaceRange.start + 2 + e.length, o = S.replace(t.replaceRange, n);
1967
1797
  this.pendingParagraph.set(void 0, void 0);
1968
- const r = this.sourceText.get(), c = new Me(o.apply(r.value));
1969
- this._pendingEdit = { baseText: r.value, newText: c.value, edit: o }, this.sourceText.set(c, void 0), this.selection.set(x.collapsed(i), void 0);
1798
+ const r = this.sourceText.get(), c = new Se(o.apply(r.value));
1799
+ this._pendingEdit = { baseText: r.value, newText: c.value, edit: o }, this.sourceText.set(c, void 0), this.selection.set(b.collapsed(i), void 0);
1970
1800
  }
1971
1801
  applyEdit(e) {
1972
1802
  if (this.readonlyMode.get())
1973
1803
  return;
1974
1804
  this.cancelPendingParagraph();
1975
- const t = this.sourceText.get(), n = new Me(e.apply(t.value)), i = this.selection.get() ?? x.collapsed(0), o = e.mapOffset(i.active);
1976
- this._pendingEdit = { baseText: t.value, newText: n.value, edit: e }, this.sourceText.set(n, void 0), this.selection.set(x.collapsed(o), void 0);
1805
+ const t = this.sourceText.get(), n = new Se(e.apply(t.value)), i = this.selection.get() ?? b.collapsed(0), o = e.mapOffset(i.active);
1806
+ this._pendingEdit = { baseText: t.value, newText: n.value, edit: e }, this.sourceText.set(n, void 0), this.selection.set(b.collapsed(o), void 0);
1977
1807
  }
1978
1808
  applyEditForSelection(e) {
1979
1809
  if (this.readonlyMode.get())
1980
1810
  return;
1981
- const t = this.sourceText.get(), n = new Me(e.apply(t.value)), i = this.selection.get() ?? x.collapsed(0), o = e.mapOffset(i.range.endExclusive);
1982
- this._pendingEdit = { baseText: t.value, newText: n.value, edit: e }, this.sourceText.set(n, void 0), this.selection.set(x.collapsed(o), void 0);
1811
+ const t = this.sourceText.get(), n = new Se(e.apply(t.value)), i = this.selection.get() ?? b.collapsed(0), o = e.mapOffset(i.range.endExclusive);
1812
+ this._pendingEdit = { baseText: t.value, newText: n.value, edit: e }, this.sourceText.set(n, void 0), this.selection.set(b.collapsed(o), void 0);
1983
1813
  }
1984
1814
  }
1985
1815
  function wn(s, e) {
@@ -2008,11 +1838,11 @@ function Ds(s, e, t) {
2008
1838
  }
2009
1839
  return n;
2010
1840
  }
2011
- class Se {
1841
+ class Te {
2012
1842
  constructor(e) {
2013
1843
  this.lines = e;
2014
1844
  }
2015
- static EMPTY = new Se([]);
1845
+ static EMPTY = new Te([]);
2016
1846
  static measure(e) {
2017
1847
  return Vs(e);
2018
1848
  }
@@ -2176,7 +2006,7 @@ class As {
2176
2006
  return e <= t.rect.left ? t.sourceRange.start : t.sourceRange.endExclusive;
2177
2007
  }
2178
2008
  }
2179
- class et {
2009
+ class Je {
2180
2010
  constructor(e, t, n) {
2181
2011
  this.sourceRange = e, this.rect = t, this.source = n;
2182
2012
  }
@@ -2196,20 +2026,20 @@ class et {
2196
2026
  return e < this.sourceStart ? this.sourceStart - e : e > this.sourceEndExclusive ? e - this.sourceEndExclusive : 0;
2197
2027
  }
2198
2028
  xAtOffset(e) {
2199
- return this.sourceLength === 0 ? this.rect.left : this.source ? $s(this.source.textNode, this.source.textNodeStart + (e - this.sourceStart), this.rect.left) : (e - this.sourceStart) / this.sourceLength <= 0.5 ? this.rect.left : this.rect.right;
2029
+ return this.sourceLength === 0 ? this.rect.left : this.source ? Ps(this.source.textNode, this.source.textNodeStart + (e - this.sourceStart), this.rect.left) : (e - this.sourceStart) / this.sourceLength <= 0.5 ? this.rect.left : this.rect.right;
2200
2030
  }
2201
2031
  offsetAtX(e) {
2202
2032
  if (this.rect.width <= 0)
2203
2033
  return this.sourceStart;
2204
2034
  if (this.source) {
2205
- const n = Ps(this.source.textNode, this.source.textNodeStart, this.source.textNodeStart + this.sourceLength, e);
2035
+ const n = $s(this.source.textNode, this.source.textNodeStart, this.source.textNodeStart + this.sourceLength, e);
2206
2036
  return this.sourceStart + (n - this.source.textNodeStart);
2207
2037
  }
2208
2038
  const t = (this.rect.left + this.rect.right) / 2;
2209
2039
  return e < t ? this.sourceStart : this.sourceEndExclusive;
2210
2040
  }
2211
2041
  }
2212
- function $s(s, e, t) {
2042
+ function Ps(s, e, t) {
2213
2043
  if (e <= 0)
2214
2044
  return t;
2215
2045
  const n = document.createRange();
@@ -2217,7 +2047,7 @@ function $s(s, e, t) {
2217
2047
  const i = n.getBoundingClientRect();
2218
2048
  return i.width === 0 && i.height === 0 ? t : i.right;
2219
2049
  }
2220
- function Ps(s, e, t, n) {
2050
+ function $s(s, e, t, n) {
2221
2051
  const i = document.createRange();
2222
2052
  let o = e, r = 1 / 0;
2223
2053
  for (let c = e; c < t; c++) {
@@ -2246,8 +2076,8 @@ function Vs(s) {
2246
2076
  return;
2247
2077
  const p = Fs(h);
2248
2078
  if (m.length === 1)
2249
- e.push(new et(
2250
- _.fromTo(f, f + h.length),
2079
+ e.push(new Je(
2080
+ v.fromTo(f, f + h.length),
2251
2081
  Ct(m[0], p),
2252
2082
  { textNode: h, textNodeStart: 0 }
2253
2083
  ));
@@ -2255,8 +2085,8 @@ function Vs(s) {
2255
2085
  const k = Hs(h, m);
2256
2086
  for (let w = 0; w < m.length; w++) {
2257
2087
  const y = w === 0 ? 0 : k[w - 1], E = w < k.length ? k[w] : h.length;
2258
- e.push(new et(
2259
- _.fromTo(f + y, f + E),
2088
+ e.push(new Je(
2089
+ v.fromTo(f + y, f + E),
2260
2090
  Ct(m[w], p),
2261
2091
  { textNode: h, textNodeStart: y }
2262
2092
  ));
@@ -2277,7 +2107,7 @@ function Vs(s) {
2277
2107
  const d = l.rect, u = Math.min(i + o, d.y + d.height) - Math.max(i, d.y);
2278
2108
  n.length > 0 && u > Math.min(o, d.height) / 2 ? (n.push(l), o = Math.max(o, d.y + d.height - i), r = Math.min(r, d.left), c = Math.max(c, d.right)) : (a(), n = [l], i = d.y, o = d.height, r = d.left, c = d.right);
2279
2109
  }
2280
- return a(), new Se(t);
2110
+ return a(), new Te(t);
2281
2111
  }
2282
2112
  function Hs(s, e) {
2283
2113
  const t = [], n = document.createRange();
@@ -2311,8 +2141,8 @@ function Ks(s, e, t) {
2311
2141
  if (n.nodeType !== 1)
2312
2142
  return;
2313
2143
  const i = n.getBoundingClientRect();
2314
- i.width === 0 && i.height === 0 || s.push(new et(
2315
- _.fromTo(t, t + e.sourceLength),
2144
+ i.width === 0 && i.height === 0 || s.push(new Je(
2145
+ v.fromTo(t, t + e.sourceLength),
2316
2146
  V.fromPointSize(i.x, i.y, i.width, i.height)
2317
2147
  ));
2318
2148
  }
@@ -2324,9 +2154,9 @@ class Ws {
2324
2154
  * uses absolute client coordinates from `getClientRects()`, so the
2325
2155
  * concatenation is well-formed without re-sorting.
2326
2156
  */
2327
- visualLineMap = $(this, (e) => {
2157
+ visualLineMap = P(this, (e) => {
2328
2158
  const n = e.readObservable(this.measurements).flatMap((i) => i.visualLineMap?.lines ?? []);
2329
- return new Se(n);
2159
+ return new Te(n);
2330
2160
  });
2331
2161
  }
2332
2162
  function kn(s, e, t, n) {
@@ -2334,7 +2164,7 @@ function kn(s, e, t, n) {
2334
2164
  for (const r of s.children) {
2335
2165
  if (s.blocks.includes(r)) {
2336
2166
  const a = r, l = zs(a, a === e, t - o);
2337
- i = qs(i, o, l, n);
2167
+ i = Gs(i, o, l, n);
2338
2168
  }
2339
2169
  o += r.length;
2340
2170
  }
@@ -2345,11 +2175,11 @@ function zs(s, e, t) {
2345
2175
  return js(s);
2346
2176
  if (s.kind === "list") {
2347
2177
  const n = ft(s, t);
2348
- return Gs(s, n);
2178
+ return qs(s, n);
2349
2179
  }
2350
2180
  return [];
2351
2181
  }
2352
- function qs(s, e, t, n) {
2182
+ function Gs(s, e, t, n) {
2353
2183
  if (n === "right")
2354
2184
  for (const i of t) {
2355
2185
  const o = s - e;
@@ -2375,7 +2205,7 @@ function ft(s, e) {
2375
2205
  }
2376
2206
  return n;
2377
2207
  }
2378
- function Gs(s, e) {
2208
+ function qs(s, e) {
2379
2209
  const t = [];
2380
2210
  let n = 0;
2381
2211
  for (const i of s.children) {
@@ -2394,7 +2224,7 @@ function js(s) {
2394
2224
  }
2395
2225
  function gt(s, e, t) {
2396
2226
  if (s.children.length === 0) {
2397
- s instanceof b && t.push(_.ofStartAndLength(e, s.length));
2227
+ s instanceof x && t.push(v.ofStartAndLength(e, s.length));
2398
2228
  return;
2399
2229
  }
2400
2230
  switch (s.kind) {
@@ -2402,14 +2232,14 @@ function gt(s, e, t) {
2402
2232
  case "mathBlock": {
2403
2233
  let i = e;
2404
2234
  for (const o of s.children)
2405
- o instanceof b && (o.markerKind === "openFence" || o.markerKind === "closeFence") && t.push(_.ofStartAndLength(i, o.length)), i += o.length;
2235
+ o instanceof x && (o.markerKind === "openFence" || o.markerKind === "closeFence") && t.push(v.ofStartAndLength(i, o.length)), i += o.length;
2406
2236
  return;
2407
2237
  }
2408
2238
  case "inlineCode":
2409
2239
  case "inlineMath": {
2410
2240
  let i = e;
2411
2241
  for (const o of s.children)
2412
- o instanceof b && (o.markerKind === "openMarker" || o.markerKind === "closeMarker") && t.push(_.ofStartAndLength(i, o.length)), i += o.length;
2242
+ o instanceof x && (o.markerKind === "openMarker" || o.markerKind === "closeMarker") && t.push(v.ofStartAndLength(i, o.length)), i += o.length;
2413
2243
  return;
2414
2244
  }
2415
2245
  case "thematicBreak":
@@ -2417,7 +2247,7 @@ function gt(s, e, t) {
2417
2247
  case "unhandledBlock":
2418
2248
  return;
2419
2249
  case "image": {
2420
- t.push(_.ofStartAndLength(e, s.length));
2250
+ t.push(v.ofStartAndLength(e, s.length));
2421
2251
  return;
2422
2252
  }
2423
2253
  }
@@ -2433,89 +2263,89 @@ const Us = (s) => s.selection.isCollapsed ? Math.min(s.selection.active + 1, s.t
2433
2263
  }, ti = () => 0, ni = (s) => s.text.length, Tt = (s) => {
2434
2264
  const e = s.lineMap.lineIndexOfOffset(s.selection.active), t = s.desiredColumn ?? s.lineMap.xAtOffset(s.selection.active);
2435
2265
  return e >= s.lineMap.lineCount - 1 ? { offset: s.selection.active, desiredColumn: t } : { offset: s.lineMap.offsetInLineAtX(e + 1, t), desiredColumn: t };
2436
- }, St = (s) => {
2266
+ }, Ot = (s) => {
2437
2267
  const e = s.lineMap.lineIndexOfOffset(s.selection.active), t = s.desiredColumn ?? s.lineMap.xAtOffset(s.selection.active);
2438
2268
  return e <= 0 ? { offset: s.selection.active, desiredColumn: t } : { offset: s.lineMap.offsetInLineAtX(e - 1, t), desiredColumn: t };
2439
- }, Ot = (s) => {
2269
+ }, St = (s) => {
2440
2270
  const e = s.selection;
2441
2271
  if (!e.isCollapsed)
2442
2272
  return {
2443
- edit: T.delete(e.range),
2444
- selection: x.collapsed(e.range.start)
2273
+ edit: S.delete(e.range),
2274
+ selection: b.collapsed(e.range.start)
2445
2275
  };
2446
2276
  if (e.active === 0)
2447
2277
  return;
2448
- const t = new _(kn(s.document, s.activeBlock, e.active, "left"), e.active);
2278
+ const t = new v(kn(s.document, s.activeBlock, e.active, "left"), e.active);
2449
2279
  return {
2450
- edit: T.delete(t),
2451
- selection: x.collapsed(t.start)
2280
+ edit: S.delete(t),
2281
+ selection: b.collapsed(t.start)
2452
2282
  };
2453
2283
  }, si = (s) => {
2454
2284
  const e = s.selection;
2455
2285
  if (!e.isCollapsed)
2456
2286
  return {
2457
- edit: T.delete(e.range),
2458
- selection: x.collapsed(e.range.start)
2287
+ edit: S.delete(e.range),
2288
+ selection: b.collapsed(e.range.start)
2459
2289
  };
2460
2290
  if (e.active >= s.text.length)
2461
2291
  return;
2462
- const t = new _(e.active, kn(s.document, s.activeBlock, e.active, "right"));
2292
+ const t = new v(e.active, kn(s.document, s.activeBlock, e.active, "right"));
2463
2293
  return {
2464
- edit: T.delete(t),
2465
- selection: x.collapsed(t.start)
2294
+ edit: S.delete(t),
2295
+ selection: b.collapsed(t.start)
2466
2296
  };
2467
2297
  }, ii = (s) => {
2468
2298
  const e = s.selection;
2469
2299
  if (!e.isCollapsed)
2470
2300
  return {
2471
- edit: T.delete(e.range),
2472
- selection: x.collapsed(e.range.start)
2301
+ edit: S.delete(e.range),
2302
+ selection: b.collapsed(e.range.start)
2473
2303
  };
2474
2304
  if (e.active === 0)
2475
2305
  return;
2476
- const t = ln(s.text, e.active), n = new _(t, e.active);
2306
+ const t = ln(s.text, e.active), n = new v(t, e.active);
2477
2307
  return {
2478
- edit: T.delete(n),
2479
- selection: x.collapsed(t)
2308
+ edit: S.delete(n),
2309
+ selection: b.collapsed(t)
2480
2310
  };
2481
2311
  }, oi = (s) => {
2482
2312
  const e = s.selection;
2483
2313
  if (!e.isCollapsed)
2484
2314
  return {
2485
- edit: T.delete(e.range),
2486
- selection: x.collapsed(e.range.start)
2315
+ edit: S.delete(e.range),
2316
+ selection: b.collapsed(e.range.start)
2487
2317
  };
2488
2318
  if (e.active >= s.text.length)
2489
2319
  return;
2490
- const t = dn(s.text, e.active), n = new _(e.active, t);
2320
+ const t = dn(s.text, e.active), n = new v(e.active, t);
2491
2321
  return {
2492
- edit: T.delete(n),
2493
- selection: x.collapsed(e.active)
2322
+ edit: S.delete(n),
2323
+ selection: b.collapsed(e.active)
2494
2324
  };
2495
2325
  };
2496
2326
  function ri(s) {
2497
2327
  return (e) => {
2498
- const t = T.replace(e.selection.range, s), n = e.selection.range.start + s.length;
2328
+ const t = S.replace(e.selection.range, s), n = e.selection.range.start + s.length;
2499
2329
  return {
2500
2330
  edit: t,
2501
- selection: x.collapsed(n)
2331
+ selection: b.collapsed(n)
2502
2332
  };
2503
2333
  };
2504
2334
  }
2505
2335
  const ci = (s) => {
2506
- const e = T.replace(s.selection.range, `
2336
+ const e = S.replace(s.selection.range, `
2507
2337
 
2508
2338
  `), t = s.selection.range.start + 2;
2509
2339
  return {
2510
2340
  edit: e,
2511
- selection: x.collapsed(t)
2341
+ selection: b.collapsed(t)
2512
2342
  };
2513
2343
  }, ai = (s) => {
2514
- const e = T.replace(s.selection.range, `
2344
+ const e = S.replace(s.selection.range, `
2515
2345
  `), t = s.selection.range.start + 1;
2516
2346
  return {
2517
2347
  edit: e,
2518
- selection: x.collapsed(t)
2348
+ selection: b.collapsed(t)
2519
2349
  };
2520
2350
  }, li = (s) => {
2521
2351
  const e = s.selection.range.start;
@@ -2523,15 +2353,15 @@ const ci = (s) => {
2523
2353
  for (; t < 2 && s.text[e - 1 - t] === " "; )
2524
2354
  t++;
2525
2355
  const i = " ".repeat(2 - t) + `
2526
- `, o = T.replace(s.selection.range, i), r = e + i.length;
2356
+ `, o = S.replace(s.selection.range, i), r = e + i.length;
2527
2357
  return {
2528
2358
  edit: o,
2529
- selection: x.collapsed(r)
2359
+ selection: b.collapsed(r)
2530
2360
  };
2531
2361
  }, di = (s) => {
2532
2362
  const e = s.selection, t = s.activeBlock;
2533
2363
  if (!e.isCollapsed || !t)
2534
- return _e(s);
2364
+ return pe(s);
2535
2365
  switch (t.kind) {
2536
2366
  case "paragraph":
2537
2367
  case "heading":
@@ -2544,27 +2374,27 @@ const ci = (s) => {
2544
2374
  case "list":
2545
2375
  return gi(s, t);
2546
2376
  default:
2547
- return _e(s);
2377
+ return pe(s);
2548
2378
  }
2549
2379
  };
2550
2380
  function hi(s, e) {
2551
2381
  const t = s.selection, n = yn(s.document, e);
2552
2382
  if (n === void 0)
2553
- return _e(s);
2383
+ return pe(s);
2554
2384
  const i = n + e.length - _i(e);
2555
2385
  if (t.active < i)
2556
2386
  return {
2557
2387
  kind: "edit",
2558
- edit: T.replace(t.range, `
2388
+ edit: S.replace(t.range, `
2559
2389
 
2560
2390
  `),
2561
- selection: x.collapsed(t.range.start + 2)
2391
+ selection: b.collapsed(t.range.start + 2)
2562
2392
  };
2563
2393
  const o = n + e.length;
2564
2394
  return {
2565
2395
  kind: "pending",
2566
2396
  anchorBlock: e,
2567
- replaceRange: new _(i, o),
2397
+ replaceRange: new v(i, o),
2568
2398
  atEof: o >= s.text.length
2569
2399
  };
2570
2400
  }
@@ -2582,7 +2412,7 @@ function fi(s) {
2582
2412
  const e = s.selection, t = s.text.lastIndexOf(`
2583
2413
  `, e.active - 1) + 1, n = pi(s.text, e.active), i = s.text.slice(t, n), o = /^(\s*(?:>\s*)+)/.exec(i), r = o ? o[1] : "> ";
2584
2414
  if (i.slice(r.length).trim() === "")
2585
- return xn(s, t, n);
2415
+ return bn(s, t, n);
2586
2416
  const a = `
2587
2417
  ` + r.replace(/\s*$/, " ");
2588
2418
  return mt(e, a);
@@ -2590,32 +2420,32 @@ function fi(s) {
2590
2420
  function gi(s, e) {
2591
2421
  const t = s.selection, n = yn(s.document, e);
2592
2422
  if (n === void 0)
2593
- return _e(s);
2423
+ return pe(s);
2594
2424
  const i = ft(e, t.active - n);
2595
2425
  if (i === void 0)
2596
- return _e(s);
2426
+ return pe(s);
2597
2427
  const o = e.items[i], r = hn(s.document, o);
2598
2428
  if (r === void 0)
2599
- return _e(s);
2600
- if (!bn(o))
2601
- return xn(s, r, r + o.length);
2429
+ return pe(s);
2430
+ if (!xn(o))
2431
+ return bn(s, r, r + o.length);
2602
2432
  const c = `
2603
2433
  ` + mi(e, o);
2604
2434
  return mt(t, c);
2605
2435
  }
2606
- function xn(s, e, t) {
2436
+ function bn(s, e, t) {
2607
2437
  const n = e > 0 ? s.text.lastIndexOf(`
2608
2438
  `, e - 1) : -1;
2609
2439
  return n >= 0 ? {
2610
2440
  kind: "edit",
2611
- edit: T.replace(new _(n, t), `
2441
+ edit: S.replace(new v(n, t), `
2612
2442
 
2613
2443
  `),
2614
- selection: x.collapsed(n + 2)
2444
+ selection: b.collapsed(n + 2)
2615
2445
  } : {
2616
2446
  kind: "edit",
2617
- edit: T.replace(new _(e, t), ""),
2618
- selection: x.collapsed(e)
2447
+ edit: S.replace(new v(e, t), ""),
2448
+ selection: b.collapsed(e)
2619
2449
  };
2620
2450
  }
2621
2451
  function mi(s, e) {
@@ -2632,8 +2462,8 @@ function mi(s, e) {
2632
2462
  function mt(s, e) {
2633
2463
  return {
2634
2464
  kind: "edit",
2635
- edit: T.replace(s.range, e),
2636
- selection: x.collapsed(s.range.start + e.length)
2465
+ edit: S.replace(s.range, e),
2466
+ selection: b.collapsed(s.range.start + e.length)
2637
2467
  };
2638
2468
  }
2639
2469
  function pi(s, e) {
@@ -2641,10 +2471,10 @@ function pi(s, e) {
2641
2471
  `, e);
2642
2472
  return t === -1 ? s.length : t;
2643
2473
  }
2644
- function bn(s) {
2645
- return s instanceof be ? s.content.trim().length > 0 : s.children.some(bn);
2474
+ function xn(s) {
2475
+ return s instanceof be ? s.content.trim().length > 0 : s.children.some(xn);
2646
2476
  }
2647
- function _e(s) {
2477
+ function pe(s) {
2648
2478
  const e = ai(s);
2649
2479
  return { kind: "edit", edit: e.edit, selection: e.selection };
2650
2480
  }
@@ -2663,19 +2493,19 @@ function _i(s) {
2663
2493
  t += e[n].length;
2664
2494
  return t;
2665
2495
  }
2666
- const vi = (s) => new x(0, s.text.length), wi = (s, e) => {
2496
+ const vi = (s) => new b(0, s.text.length), wi = (s, e) => {
2667
2497
  const t = ss(s.text, e);
2668
- return new x(t.start, t.end);
2498
+ return new b(t.start, t.end);
2669
2499
  };
2670
2500
  function ki(s, e) {
2671
- return new x(e.start, e.endExclusive);
2501
+ return new b(e.start, e.endExclusive);
2672
2502
  }
2673
- const Mt = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap();
2674
- class ne extends W {
2675
- constructor(e, t, n = xi) {
2503
+ const Mt = /* @__PURE__ */ new WeakMap(), qe = /* @__PURE__ */ new WeakMap();
2504
+ class te extends W {
2505
+ constructor(e, t, n = bi) {
2676
2506
  super(), this.ast = e, this.dom = t, this._children = n, Mt.set(t, this);
2677
2507
  for (const i of n)
2678
- je.set(i, this);
2508
+ qe.set(i, this);
2679
2509
  }
2680
2510
  _children;
2681
2511
  /** This node's view children (a mirror of `ast.children`). */
@@ -2696,7 +2526,7 @@ class ne extends W {
2696
2526
  t.dispose();
2697
2527
  this._children = e;
2698
2528
  for (const t of e)
2699
- je.set(t, this);
2529
+ qe.set(t, this);
2700
2530
  }
2701
2531
  dispose() {
2702
2532
  for (const e of this._children)
@@ -2723,7 +2553,7 @@ class ne extends W {
2723
2553
  }
2724
2554
  /** The view node that rendered this node's parent, or `undefined` for a root. */
2725
2555
  get parent() {
2726
- return je.get(this);
2556
+ return qe.get(this);
2727
2557
  }
2728
2558
  /**
2729
2559
  * Closest view node owning `domNode`: the node itself if registered, else
@@ -2769,7 +2599,7 @@ class ne extends W {
2769
2599
  * "after" side) → end. Subclasses may override for finer control.
2770
2600
  */
2771
2601
  getLocalSourceRange(e) {
2772
- return this.dom === e.node && this.dom.nodeType === 3 ? _.emptyAt(Math.max(0, Math.min(e.offset, this.sourceLength))) : _.emptyAt(e.offset >= 1 ? this.sourceLength : 0);
2602
+ return this.dom === e.node && this.dom.nodeType === 3 ? v.emptyAt(Math.max(0, Math.min(e.offset, this.sourceLength))) : v.emptyAt(e.offset >= 1 ? this.sourceLength : 0);
2773
2603
  }
2774
2604
  /**
2775
2605
  * DOM hit (any node + offset within it) → source offset relative to THIS
@@ -2780,7 +2610,7 @@ class ne extends W {
2780
2610
  * until it reaches this node.
2781
2611
  */
2782
2612
  resolveSource(e) {
2783
- let t = ne.forDom(e.node);
2613
+ let t = te.forDom(e.node);
2784
2614
  if (!t)
2785
2615
  return;
2786
2616
  let n = t.getLocalSourceRange(e);
@@ -2824,8 +2654,8 @@ class ne extends W {
2824
2654
  i.forEachTextLeaf(n, t), n += i.sourceLength;
2825
2655
  }
2826
2656
  }
2827
- const xi = [];
2828
- class O extends ne {
2657
+ const bi = [];
2658
+ class O extends te {
2829
2659
  constructor(e, t, n) {
2830
2660
  super(e.ast, t, n), this.data = e;
2831
2661
  }
@@ -2867,7 +2697,7 @@ class O extends ne {
2867
2697
  recordMeasuredHeight(e) {
2868
2698
  }
2869
2699
  }
2870
- function q(s, e, t) {
2700
+ function z(s, e, t) {
2871
2701
  if (t instanceof O) {
2872
2702
  if (t.canReuse(s))
2873
2703
  return t;
@@ -2875,73 +2705,73 @@ function q(s, e, t) {
2875
2705
  return t;
2876
2706
  switch (s.kind) {
2877
2707
  case "text":
2878
- return Ei(s, I(t, pt));
2708
+ return Ei(s, B(t, pt));
2879
2709
  case "marker":
2880
- return s.ast.markerKind === "hardBreak" ? new Bt(s, I(t, Bt)) : new It(s, I(t, It));
2710
+ return s.ast.markerKind === "hardBreak" ? new It(s, B(t, It)) : new Bt(s, B(t, Bt));
2881
2711
  case "glue":
2882
- return new Ve(s, I(t, Ve));
2712
+ return new $e(s, B(t, $e));
2883
2713
  case "heading":
2884
- return new Dt(s, e, I(t, Dt));
2714
+ return new Dt(s, e, B(t, Dt));
2885
2715
  case "paragraph":
2886
- return new ie(s, "p", "md-block md-paragraph", e, ce(t));
2716
+ return new se(s, "p", "md-block md-paragraph", e, re(t));
2887
2717
  case "codeBlock":
2888
2718
  return new _t(s, e, t);
2889
2719
  case "mathBlock":
2890
- return new Vt(s, e, I(t, Vt));
2720
+ return new Vt(s, e, B(t, Vt));
2891
2721
  case "thematicBreak":
2892
- return new At(s, e, I(t, At));
2722
+ return new At(s, e, B(t, At));
2893
2723
  case "unhandledBlock":
2894
- return new $t(s, e, I(t, $t));
2724
+ return new Pt(s, e, B(t, Pt));
2895
2725
  case "blockQuote":
2896
- return new ie(s, "blockquote", "md-block md-blockquote", e, ce(t));
2726
+ return new se(s, "blockquote", "md-block md-blockquote", e, re(t));
2897
2727
  case "list":
2898
- return new Ht(s, e, I(t, Ht));
2728
+ return new Ht(s, e, B(t, Ht));
2899
2729
  case "listItem":
2900
- return new Ft(s, e, I(t, Ft));
2730
+ return new Ft(s, e, B(t, Ft));
2901
2731
  case "table":
2902
- return new Kt(s, e, I(t, Kt));
2732
+ return new Kt(s, e, B(t, Kt));
2903
2733
  case "tableRow":
2904
- return new Wt(s, e, I(t, Wt));
2734
+ return new Wt(s, e, B(t, Wt));
2905
2735
  case "tableCell":
2906
- return new ie(s, "td", "", e, ce(t));
2736
+ return new se(s, "td", "", e, re(t));
2907
2737
  case "strong":
2908
- return new ie(s, "strong", "", e, ce(t));
2738
+ return new se(s, "strong", "", e, re(t));
2909
2739
  case "emphasis":
2910
- return new ie(s, "em", "", e, ce(t));
2740
+ return new se(s, "em", "", e, re(t));
2911
2741
  case "strikethrough":
2912
- return new ie(s, "del", "", e, ce(t));
2742
+ return new se(s, "del", "", e, re(t));
2913
2743
  case "inlineCode":
2914
- return new zt(s, e, I(t, zt));
2744
+ return new zt(s, e, B(t, zt));
2915
2745
  case "inlineMath":
2916
- return new qt(s, e, I(t, qt));
2746
+ return new Gt(s, e, B(t, Gt));
2917
2747
  case "link":
2918
- return new Gt(s, e, I(t, Gt));
2748
+ return new qt(s, e, B(t, qt));
2919
2749
  case "image":
2920
- return new jt(s, e, I(t, jt));
2750
+ return new jt(s, e, B(t, jt));
2921
2751
  case "document":
2922
- return new ie(s, "div", "", e, ce(t));
2752
+ return new se(s, "div", "", e, re(t));
2923
2753
  case "diffHunk":
2924
- return new tt(s, e, I(t, tt));
2754
+ return new et(s, e, B(t, et));
2925
2755
  case "diffDecoration":
2926
- return new nt(s, e, I(t, nt));
2756
+ return new tt(s, e, B(t, tt));
2927
2757
  }
2928
2758
  }
2929
- function I(s, e) {
2759
+ function B(s, e) {
2930
2760
  return s instanceof e ? s : void 0;
2931
2761
  }
2932
- function ce(s) {
2933
- return s instanceof ie ? s : void 0;
2762
+ function re(s) {
2763
+ return s instanceof se ? s : void 0;
2934
2764
  }
2935
- function U(s, e, t, n) {
2765
+ function j(s, e, t, n) {
2936
2766
  const { paired: i, unused: o } = vt(e, t ?? D), r = e.map((c) => n(c, i.get(c)));
2937
2767
  for (const c of o)
2938
2768
  c.dispose();
2939
- return bi(s, r), r;
2769
+ return xi(s, r), r;
2940
2770
  }
2941
- function bi(s, e) {
2942
- ae(s, e.map((t) => t.mountNode));
2771
+ function xi(s, e) {
2772
+ ce(s, e.map((t) => t.mountNode));
2943
2773
  }
2944
- function ae(s, e) {
2774
+ function ce(s, e) {
2945
2775
  let t = s.firstChild, n = 0;
2946
2776
  for (; n < e.length && t === e[n]; n++)
2947
2777
  t = t.nextSibling;
@@ -2956,21 +2786,21 @@ function ae(s, e) {
2956
2786
  }
2957
2787
  }
2958
2788
  }
2959
- function re(s) {
2960
- return (e, t) => q(e, s, t);
2789
+ function oe(s) {
2790
+ return (e, t) => z(e, s, t);
2961
2791
  }
2962
2792
  function En(s) {
2963
- return (e, t) => e.kind === "marker" && e.ast.markerKind === "content" ? new pt(e, document.createTextNode(e.ast.content)) : q(e, s, t);
2793
+ return (e, t) => e.kind === "marker" && e.ast.markerKind === "content" ? new pt(e, document.createTextNode(e.ast.content)) : z(e, s, t);
2964
2794
  }
2965
2795
  const D = [];
2966
- class tt extends O {
2796
+ class et extends O {
2967
2797
  _originalNode;
2968
2798
  _modifiedNode;
2969
2799
  constructor(e, t, n) {
2970
2800
  const i = n?.dom ?? document.createElement("div");
2971
2801
  i.className = "md-block md-diff-hunk";
2972
2802
  const o = [], r = [], c = e.original ? Nt(e.original, "md-diff-original", t, n?._originalNode) : void 0, a = e.modified ? Nt(e.modified, "md-diff-modified", t, n?._modifiedNode) : void 0;
2973
- c && (o.push(c), r.push(c.mountNode)), a && (o.push(a), r.push(a.mountNode)), ae(i, r), super(e, i, o), this._originalNode = c, this._modifiedNode = a;
2803
+ c && (o.push(c), r.push(c.mountNode)), a && (o.push(a), r.push(a.mountNode)), ce(i, r), super(e, i, o), this._originalNode = c, this._modifiedNode = a;
2974
2804
  }
2975
2805
  /** The mounted sides with their highlight ranges, for the diff highlighter. */
2976
2806
  get sides() {
@@ -2979,16 +2809,16 @@ class tt extends O {
2979
2809
  }
2980
2810
  }
2981
2811
  function Nt(s, e, t, n) {
2982
- const i = q(s.view, t, n), o = i.element;
2812
+ const i = z(s.view, t, n), o = i.element;
2983
2813
  return o.classList.add(e), o.classList.toggle("md-block-active", s.active), o.classList.toggle("md-markers-hidden", !s.active), i;
2984
2814
  }
2985
- class nt extends O {
2815
+ class tt extends O {
2986
2816
  sideNode;
2987
2817
  constructor(e, t, n) {
2988
2818
  const i = n?.dom ?? document.createElement("div");
2989
2819
  i.className = "md-block md-diff-decoration", i.style.pointerEvents = "none";
2990
- const o = q(e.side, t, n?.sideNode), r = o.element, c = !e.whole;
2991
- 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), ae(i, [o.mountNode]), super(e, i, [o]), this.sideNode = o;
2820
+ const o = z(e.side, t, n?.sideNode), r = o.element, c = !e.whole;
2821
+ 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), ce(i, [o.mountNode]), super(e, i, [o]), this.sideNode = o;
2992
2822
  }
2993
2823
  /** A decoration has no presence in the modified document's source space. */
2994
2824
  get sourceLength() {
@@ -3019,7 +2849,7 @@ function Ei(s, e) {
3019
2849
  if (s.showWhitespace && Tn(t, n)) {
3020
2850
  const r = document.createElement("span");
3021
2851
  r.className = "md-text";
3022
- const c = We(r, t, n, s.ast);
2852
+ const c = Ke(r, t, n, s.ast);
3023
2853
  return new O(s, r, c);
3024
2854
  }
3025
2855
  const i = e?.dom, o = i instanceof globalThis.Text && i.data === t ? i : document.createTextNode(t);
@@ -3053,7 +2883,7 @@ function Tn(s, e) {
3053
2883
  }
3054
2884
  return !1;
3055
2885
  }
3056
- function Si(s, e) {
2886
+ function Oi(s, e) {
3057
2887
  const t = [];
3058
2888
  let n = -1;
3059
2889
  const i = (c) => {
@@ -3081,16 +2911,16 @@ function Si(s, e) {
3081
2911
  }
3082
2912
  return i(s.length), t;
3083
2913
  }
3084
- function We(s, e, t, n) {
2914
+ function Ke(s, e, t, n) {
3085
2915
  const i = [];
3086
- for (const o of Si(e, t)) {
2916
+ for (const o of Oi(e, t)) {
3087
2917
  const r = document.createTextNode(o.display ?? o.text);
3088
2918
  if (o.cls) {
3089
2919
  const c = document.createElement("span");
3090
2920
  c.className = o.cls, c.appendChild(r), s.appendChild(c);
3091
2921
  } else
3092
2922
  s.appendChild(r);
3093
- i.push(new j(n, r, D, o.text.length));
2923
+ i.push(new q(n, r, D, o.text.length));
3094
2924
  }
3095
2925
  return i;
3096
2926
  }
@@ -3099,7 +2929,7 @@ class pt extends O {
3099
2929
  super(e, t, D);
3100
2930
  }
3101
2931
  }
3102
- class j extends ne {
2932
+ class q extends te {
3103
2933
  _sourceLength;
3104
2934
  constructor(e, t, n = D, i = e.length) {
3105
2935
  super(e, t, n), this._sourceLength = i;
@@ -3108,7 +2938,7 @@ class j extends ne {
3108
2938
  return this._sourceLength;
3109
2939
  }
3110
2940
  }
3111
- class It extends O {
2941
+ class Bt extends O {
3112
2942
  _span;
3113
2943
  constructor(e, t) {
3114
2944
  const n = e.ast, i = `md-marker md-marker-${n.markerKind}`, o = t && t.dom instanceof globalThis.Text && t.dom.data === n.content, r = o ? t._span : document.createElement("span");
@@ -3120,10 +2950,10 @@ class It extends O {
3120
2950
  return this._span;
3121
2951
  }
3122
2952
  }
3123
- class Ve extends O {
2953
+ class $e extends O {
3124
2954
  _span;
3125
2955
  constructor(e, t) {
3126
- const n = Ve._build(e, t);
2956
+ const n = $e._build(e, t);
3127
2957
  super(e, n.dom, n.children), this._span = n.span;
3128
2958
  }
3129
2959
  get mountNode() {
@@ -3140,7 +2970,7 @@ class Ve extends O {
3140
2970
  if (e.visible && Tn(n.content, r)) {
3141
2971
  const u = document.createElement("span");
3142
2972
  u.className = i;
3143
- const f = We(u, n.content, r, n);
2973
+ const f = Ke(u, n.content, r, n);
3144
2974
  return { span: u, dom: u, children: f };
3145
2975
  }
3146
2976
  const a = t && t.dom instanceof globalThis.Text && t.dom.data === n.content && t.children.length === 0, l = a ? t._span : document.createElement("span");
@@ -3149,29 +2979,29 @@ class Ve extends O {
3149
2979
  return a || l.appendChild(d), { span: l, dom: d, children: D };
3150
2980
  }
3151
2981
  }
3152
- class Bt extends O {
2982
+ class It extends O {
3153
2983
  _span;
3154
2984
  constructor(e, t) {
3155
2985
  const n = e.ast.content, i = document.createElement("span");
3156
2986
  i.className = "md-hardbreak";
3157
2987
  const o = document.createElement("span");
3158
2988
  o.className = e.visible ? "md-hardbreak-src" : "md-hardbreak-src md-hardbreak-src-hidden";
3159
- const r = e.visible ? We(o, n, Ci, e.ast) : Oi(o, n, e.ast);
2989
+ const r = e.visible ? Ke(o, n, Ci, e.ast) : Si(o, n, e.ast);
3160
2990
  i.appendChild(o), i.appendChild(document.createElement("br")), super(e, i, r), this._span = i;
3161
2991
  }
3162
2992
  get mountNode() {
3163
2993
  return this._span;
3164
2994
  }
3165
2995
  }
3166
- function Oi(s, e, t) {
2996
+ function Si(s, e, t) {
3167
2997
  const n = document.createTextNode(e);
3168
- return s.appendChild(n), [new j(t, n)];
2998
+ return s.appendChild(n), [new q(t, n)];
3169
2999
  }
3170
- class ie extends O {
3000
+ class se extends O {
3171
3001
  constructor(e, t, n, i, o) {
3172
3002
  const r = o?.element ?? document.createElement(t);
3173
3003
  !o && n && (r.className = n);
3174
- const c = U(r, Cn(e), o?.children, re(i));
3004
+ const c = j(r, Cn(e), o?.children, oe(i));
3175
3005
  super(e, r, c);
3176
3006
  }
3177
3007
  }
@@ -3179,7 +3009,7 @@ class Dt extends O {
3179
3009
  constructor(e, t, n) {
3180
3010
  const i = n && n.element.tagName === `H${e.ast.level}`, o = i ? n.element : document.createElement(`h${e.ast.level}`);
3181
3011
  i || (o.className = "md-block md-heading");
3182
- const r = U(o, e.content, n?.children, re(t));
3012
+ const r = j(o, e.content, n?.children, oe(t));
3183
3013
  super(e, o, r);
3184
3014
  }
3185
3015
  }
@@ -3189,7 +3019,7 @@ class At extends O {
3189
3019
  if (e.showMarkup) {
3190
3020
  const r = n?.data.showMarkup ? n : void 0, c = r?.dom ?? document.createElement("div");
3191
3021
  r || (c.className = "md-block md-thematic-break-source");
3192
- const a = U(c, e.content, r?.children, re(t));
3022
+ const a = j(c, e.content, r?.children, oe(t));
3193
3023
  super(e, c, a), this._contentEl = c;
3194
3024
  return;
3195
3025
  }
@@ -3202,7 +3032,7 @@ class At extends O {
3202
3032
  return this._contentEl;
3203
3033
  }
3204
3034
  }
3205
- class $t extends O {
3035
+ class Pt extends O {
3206
3036
  _scroller;
3207
3037
  constructor(e, t, n) {
3208
3038
  const i = n && n.dom instanceof HTMLDivElement ? n : void 0, o = i?.dom ?? document.createElement("div");
@@ -3211,13 +3041,13 @@ class $t extends O {
3211
3041
  i || (r.className = "md-code-block md-unhandled-scroll", o.appendChild(r));
3212
3042
  const c = (i ? r.querySelector("code") : null) ?? document.createElement("code");
3213
3043
  i || r.appendChild(c);
3214
- const a = U(c, e.content, i?.children, (l, d) => {
3044
+ const a = j(c, e.content, i?.children, (l, d) => {
3215
3045
  const u = l.ast;
3216
3046
  if (l.kind === "marker" && u.markerKind === "content") {
3217
- const h = (d instanceof j && d.dom.nodeType === globalThis.Node.TEXT_NODE && d.dom.data === u.content ? d.dom : void 0) ?? document.createTextNode(u.content);
3218
- return new j(u, h);
3047
+ const h = (d instanceof q && d.dom.nodeType === globalThis.Node.TEXT_NODE && d.dom.data === u.content ? d.dom : void 0) ?? document.createTextNode(u.content);
3048
+ return new q(u, h);
3219
3049
  }
3220
- return q(l, t, d);
3050
+ return z(l, t, d);
3221
3051
  });
3222
3052
  super(e, o, a), this._scroller = r;
3223
3053
  }
@@ -3257,19 +3087,19 @@ class _t extends O {
3257
3087
  h = r._session, r._session = void 0;
3258
3088
  else if (r?._session) {
3259
3089
  const w = i.getDiff(r.ast);
3260
- w && (h = r._session, r._session = void 0, Jn((y) => h.update(w.stringEdit, y)));
3090
+ w && (h = r._session, r._session = void 0, qn((y) => h.update(w.stringEdit, y)));
3261
3091
  }
3262
3092
  h || (h = f.create(i.language, o));
3263
3093
  }
3264
3094
  r?._session && (r._session.dispose(), r._session = void 0), r?._snapshotSub?.dispose(), r && (r._snapshotSub = void 0);
3265
- const g = h ? h.snapshot.get().getTokens(_.ofLength(o.length)).tokens : void 0;
3095
+ const g = h ? h.snapshot.get().getTokens(v.ofLength(o.length)).tokens : void 0;
3266
3096
  let m, p, k;
3267
3097
  if (d) {
3268
3098
  d.element.classList.add("md-block", "md-code-block");
3269
3099
  const w = d.estimateHeight?.(l);
3270
3100
  w !== void 0 && (d.element.style.boxSizing = "border-box", d.element.style.minHeight = `${w}px`), d.onEdit = (y) => {
3271
- const E = c === 0 ? y : new T(
3272
- y.replacements.map((v) => z.replace(v.replaceRange.delta(c), v.newText))
3101
+ const E = c === 0 ? y : new S(
3102
+ y.replacements.map((_) => it.replace(_.replaceRange.delta(c), _.newText))
3273
3103
  );
3274
3104
  t?.onEmbeddedCodeEditorEdit?.(i, E);
3275
3105
  }, d.setContent(l), m = d.element, p = D;
@@ -3281,13 +3111,13 @@ class _t extends O {
3281
3111
  const y = [];
3282
3112
  for (const E of e.content)
3283
3113
  if (E.ast === i.code) {
3284
- const v = document.createElement("code");
3285
- i.language && (v.className = `language-${CSS.escape(i.language)}`);
3286
- const C = Mi(i.code, o, v, g);
3287
- C instanceof Sn && (k = C), y.push(C), w.appendChild(v);
3114
+ const _ = document.createElement("code");
3115
+ i.language && (_.className = `language-${CSS.escape(i.language)}`);
3116
+ const C = Mi(i.code, o, _, g);
3117
+ C instanceof On && (k = C), y.push(C), w.appendChild(_);
3288
3118
  } else {
3289
- const v = q(E, t, void 0);
3290
- w.appendChild(v.mountNode), y.push(v);
3119
+ const _ = z(E, t, void 0);
3120
+ w.appendChild(_.mountNode), y.push(_);
3291
3121
  }
3292
3122
  m = w, p = y;
3293
3123
  } else {
@@ -3296,32 +3126,32 @@ class _t extends O {
3296
3126
  const y = document.createElement("code");
3297
3127
  w.appendChild(y);
3298
3128
  const E = [];
3299
- for (const v of e.content) {
3300
- const C = v.ast;
3301
- if (v.kind === "marker" && C.markerKind === "content") {
3302
- const B = document.createTextNode(C.content);
3303
- y.appendChild(B), E.push(new j(C, B));
3304
- } else if (v.kind === "marker" && C.markerKind === "codeIndent") {
3305
- const B = C;
3306
- if (v.visible) {
3129
+ for (const _ of e.content) {
3130
+ const C = _.ast;
3131
+ if (_.kind === "marker" && C.markerKind === "content") {
3132
+ const I = document.createTextNode(C.content);
3133
+ y.appendChild(I), E.push(new q(C, I));
3134
+ } else if (_.kind === "marker" && C.markerKind === "codeIndent") {
3135
+ const I = C;
3136
+ if (_.visible) {
3307
3137
  const K = document.createElement("span");
3308
3138
  K.className = "md-marker md-marker-codeIndent";
3309
- const ue = We(K, B.content, Li, B);
3310
- y.appendChild(K), E.push(new j(B, K, ue));
3139
+ const he = Ke(K, I.content, Li, I);
3140
+ y.appendChild(K), E.push(new q(I, K, he));
3311
3141
  } else {
3312
- const K = q(v, t, void 0);
3142
+ const K = z(_, t, void 0);
3313
3143
  y.appendChild(K.mountNode), E.push(K);
3314
3144
  }
3315
3145
  } else {
3316
- const B = q(v, t, void 0);
3317
- w.appendChild(B.mountNode), E.push(B);
3146
+ const I = z(_, t, void 0);
3147
+ w.appendChild(I.mountNode), E.push(I);
3318
3148
  }
3319
3149
  }
3320
3150
  m = w, p = E;
3321
3151
  }
3322
- super(e, m, p), this._session = h, this._embeddedEditor = d, h && k && (this._snapshotSub = es(h.snapshot, () => {
3152
+ super(e, m, p), this._session = h, this._embeddedEditor = d, h && k && (this._snapshotSub = jn(h.snapshot, () => {
3323
3153
  const w = h.snapshot.get();
3324
- k.refresh(o, w.getTokens(_.ofLength(o.length)).tokens);
3154
+ k.refresh(o, w.getTokens(v.ofLength(o.length)).tokens);
3325
3155
  }));
3326
3156
  }
3327
3157
  dispose() {
@@ -3331,21 +3161,21 @@ class _t extends O {
3331
3161
  function Mi(s, e, t, n) {
3332
3162
  if (!n) {
3333
3163
  const i = document.createTextNode(e);
3334
- return t.appendChild(i), new j(s, i);
3164
+ return t.appendChild(i), new q(s, i);
3335
3165
  }
3336
- return new Sn(s, t, e, n);
3166
+ return new On(s, t, e, n);
3337
3167
  }
3338
- class Sn extends ne {
3168
+ class On extends te {
3339
3169
  constructor(e, t, n, i) {
3340
- super(e, t, Pt(e, t, n, i));
3170
+ super(e, t, $t(e, t, n, i));
3341
3171
  }
3342
3172
  /** Re-render the token spans for a new colouring, in place. */
3343
3173
  refresh(e, t) {
3344
3174
  const n = this.dom;
3345
- n.replaceChildren(), this._replaceChildren(Pt(this.ast, n, e, t));
3175
+ n.replaceChildren(), this._replaceChildren($t(this.ast, n, e, t));
3346
3176
  }
3347
3177
  }
3348
- function Pt(s, e, t, n) {
3178
+ function $t(s, e, t, n) {
3349
3179
  const i = [];
3350
3180
  let o = 0;
3351
3181
  for (const r of n) {
@@ -3359,11 +3189,11 @@ function Pt(s, e, t, n) {
3359
3189
  l.appendChild(a), e.appendChild(l);
3360
3190
  } else
3361
3191
  e.appendChild(a);
3362
- i.push(new j(s, a, D, c.length));
3192
+ i.push(new q(s, a, D, c.length));
3363
3193
  }
3364
3194
  return i;
3365
3195
  }
3366
- function On(s) {
3196
+ function Sn(s) {
3367
3197
  let e = 0;
3368
3198
  for (const t of s) {
3369
3199
  if (t.kind === "marker" && t.markerKind === "content")
@@ -3376,10 +3206,10 @@ function Mn(s, e, t) {
3376
3206
  const n = e.filter((c) => c.length > 0 && c.start >= 0 && c.start + c.length <= t).slice().sort((c, a) => c.start - a.start), i = [];
3377
3207
  let o = 0;
3378
3208
  const r = (c) => {
3379
- c > 0 && i.push(new j(s, document.createTextNode(""), D, c));
3209
+ c > 0 && i.push(new q(s, document.createTextNode(""), D, c));
3380
3210
  };
3381
3211
  for (const c of n)
3382
- c.start < o || (r(c.start - o), i.push(new j(s, c.dom, D, c.length)), o = c.start + c.length);
3212
+ c.start < o || (r(c.start - o), i.push(new q(s, c.dom, D, c.length)), o = c.start + c.length);
3383
3213
  return r(t - o), i;
3384
3214
  }
3385
3215
  class Vt extends O {
@@ -3400,9 +3230,9 @@ class Vt extends O {
3400
3230
  for (const u of e.content)
3401
3231
  if (u.ast === i.code) {
3402
3232
  const f = document.createElement("code"), h = document.createTextNode(i.code.content);
3403
- f.appendChild(h), l.appendChild(f), d.push(new j(i.code, h));
3233
+ f.appendChild(h), l.appendChild(f), d.push(new q(i.code, h));
3404
3234
  } else {
3405
- const f = q(u, t, void 0);
3235
+ const f = z(u, t, void 0);
3406
3236
  l.appendChild(f.mountNode), d.push(f);
3407
3237
  }
3408
3238
  super(e, l, d), this._renderedHeight = o;
@@ -3413,7 +3243,7 @@ class Vt extends O {
3413
3243
  displayMode: !0,
3414
3244
  className: "md-block md-math-block",
3415
3245
  nodeLength: i.length,
3416
- contentStart: On(i.content)
3246
+ contentStart: Sn(i.content)
3417
3247
  });
3418
3248
  if (c) {
3419
3249
  super(e, c.dom, Mn(i, c.segments, i.length)), this._renderedHeight = o;
@@ -3436,7 +3266,7 @@ class Ht extends O {
3436
3266
  constructor(e, t, n) {
3437
3267
  const i = e.ast.ordered ? "ol" : "ul", o = n && n.element.tagName === i.toUpperCase(), r = o ? n.element : document.createElement(i);
3438
3268
  o || (r.className = "md-block md-list");
3439
- const c = U(r, e.content, n?.children, re(t));
3269
+ const c = j(r, e.content, n?.children, oe(t));
3440
3270
  super(e, r, c);
3441
3271
  }
3442
3272
  }
@@ -3462,20 +3292,20 @@ class Ft extends O {
3462
3292
  }
3463
3293
  }
3464
3294
  function Ni(s, e, t, n) {
3465
- const { paired: i, unused: o } = vt(e, t?.children ?? D), r = e.map((d) => q(d, n, i.get(d)));
3295
+ const { paired: i, unused: o } = vt(e, t?.children ?? D), r = e.map((d) => z(d, n, i.get(d)));
3466
3296
  for (const d of o)
3467
3297
  d.dispose();
3468
3298
  if (!(e.length >= 2 && e[0].kind === "glue" && e[0].ast.glueKind === "indent" && e[1].kind === "marker" && e[1].ast.markerKind === "listItemMarker"))
3469
- return ae(s, r.map((d) => d.mountNode)), r;
3299
+ return ce(s, r.map((d) => d.mountNode)), r;
3470
3300
  const a = s.firstElementChild, l = a && a.classList.contains("md-list-gutter") ? a : document.createElement("span");
3471
- return l.className = "md-list-gutter", ae(l, [r[0].mountNode, r[1].mountNode]), ae(s, [l, ...r.slice(2).map((d) => d.mountNode)]), r;
3301
+ return l.className = "md-list-gutter", ce(l, [r[0].mountNode, r[1].mountNode]), ce(s, [l, ...r.slice(2).map((d) => d.mountNode)]), r;
3472
3302
  }
3473
3303
  class Kt extends O {
3474
3304
  _table;
3475
3305
  constructor(e, t, n) {
3476
3306
  const i = n?.dom ?? document.createElement("div"), o = n?._table ?? document.createElement("table");
3477
3307
  n || (i.className = "md-block md-table-wrapper", o.className = "md-block md-table", i.appendChild(o));
3478
- const r = U(o, Cn(e), n?.children, re(t));
3308
+ const r = j(o, Cn(e), n?.children, oe(t));
3479
3309
  super(e, i, r), this._table = o;
3480
3310
  }
3481
3311
  get element() {
@@ -3489,7 +3319,7 @@ class Wt extends O {
3489
3319
  constructor(e, t, n) {
3490
3320
  const i = n?.element ?? document.createElement("tr");
3491
3321
  e.isDelimiter && i.classList.add("md-table-delimiter-row");
3492
- const o = U(i, e.content, n?.children, re(t));
3322
+ const o = j(i, e.content, n?.children, oe(t));
3493
3323
  e.isDelimiter || e.content.forEach((r, c) => {
3494
3324
  r.kind === "tableCell" && o[c].element.classList.toggle("md-table-cell-active", r.isActive);
3495
3325
  }), super(e, i, o);
@@ -3497,16 +3327,16 @@ class Wt extends O {
3497
3327
  }
3498
3328
  class zt extends O {
3499
3329
  constructor(e, t, n) {
3500
- const i = n?.element ?? document.createElement("code"), o = U(i, e.content, n?.children, En(t));
3330
+ const i = n?.element ?? document.createElement("code"), o = j(i, e.content, n?.children, En(t));
3501
3331
  super(e, i, o);
3502
3332
  }
3503
3333
  }
3504
- class qt extends O {
3334
+ class Gt extends O {
3505
3335
  constructor(e, t, n) {
3506
3336
  if (e.showMarkup) {
3507
3337
  const a = document.createElement("span");
3508
3338
  a.className = "md-inline-math";
3509
- const l = U(a, e.content, n?.children, En(t));
3339
+ const l = j(a, e.content, n?.children, En(t));
3510
3340
  super(e, a, l);
3511
3341
  return;
3512
3342
  }
@@ -3517,7 +3347,7 @@ class qt extends O {
3517
3347
  displayMode: !1,
3518
3348
  className: "md-inline-math",
3519
3349
  nodeLength: e.ast.length,
3520
- contentStart: On(e.ast.content)
3350
+ contentStart: Sn(e.ast.content)
3521
3351
  });
3522
3352
  if (r) {
3523
3353
  super(e, r.dom, Mn(e.ast, r.segments, e.ast.length));
@@ -3533,7 +3363,7 @@ class qt extends O {
3533
3363
  super(e, c, D);
3534
3364
  }
3535
3365
  }
3536
- class Gt extends O {
3366
+ class qt extends O {
3537
3367
  constructor(e, t, n) {
3538
3368
  const i = n?.element ?? document.createElement("a");
3539
3369
  if (Nn(e.ast.url) ? (i.href = e.ast.url, i.dataset.mdUrl = e.ast.url) : (i.removeAttribute("href"), delete i.dataset.mdUrl), !n) {
@@ -3560,7 +3390,7 @@ class Gt extends O {
3560
3390
  };
3561
3391
  i.addEventListener("click", l), i.addEventListener("auxclick", l);
3562
3392
  }
3563
- const o = U(i, e.content, n?.children, re(t));
3393
+ const o = j(i, e.content, n?.children, oe(t));
3564
3394
  super(e, i, o);
3565
3395
  }
3566
3396
  }
@@ -3570,7 +3400,7 @@ class jt extends O {
3570
3400
  if (e.showMarkup) {
3571
3401
  const r = document.createElement("span");
3572
3402
  r.className = "md-image-source";
3573
- const c = U(r, e.content, n?.children, re(t));
3403
+ const c = j(r, e.content, n?.children, oe(t));
3574
3404
  super(e, r, c);
3575
3405
  return;
3576
3406
  }
@@ -3592,12 +3422,14 @@ function vt(s, e) {
3592
3422
  function Nn(s) {
3593
3423
  return !s.trim().toLowerCase().startsWith("javascript:");
3594
3424
  }
3595
- class wt extends ne {
3425
+ class wt extends te {
3596
3426
  constructor(e, t, n, i, o) {
3597
3427
  super(e, t, i), this.blocks = n, this.pendingElement = o;
3598
3428
  }
3599
3429
  static create(e, t, n) {
3600
- const i = n?.contentDomNode ?? document.createElement("div"), o = new Map(
3430
+ const i = n?.contentDomNode ?? document.createElement("div");
3431
+ i.classList.add("md-document");
3432
+ const o = new Map(
3601
3433
  e.children.filter((h) => h.kind === "block").map((h) => [h.view, h.isActive])
3602
3434
  ), r = n?.children, c = e.children.map((h) => h.view), { paired: a, unused: l } = vt(c, r ?? Ri);
3603
3435
  let d;
@@ -3607,7 +3439,7 @@ class wt extends ne {
3607
3439
  const k = m instanceof Ut ? m : new Ut(h);
3608
3440
  return d = k.element, k;
3609
3441
  }
3610
- const p = q(h, t, m);
3442
+ const p = z(h, t, m);
3611
3443
  if (e.children[g].kind === "block") {
3612
3444
  const k = o.get(h);
3613
3445
  k !== void 0 && (p.element.classList.toggle("md-block-active", k), p.element.classList.toggle("md-markers-hidden", !k));
@@ -3618,7 +3450,7 @@ class wt extends ne {
3618
3450
  });
3619
3451
  for (const h of l)
3620
3452
  h.dispose();
3621
- ae(i, u.map((h) => h.mountNode));
3453
+ ce(i, u.map((h) => h.mountNode));
3622
3454
  const f = [];
3623
3455
  return e.children.forEach((h, g) => {
3624
3456
  h.kind === "block" && f.push({ node: u[g], absoluteStart: h.absoluteStart });
@@ -3629,7 +3461,7 @@ class wt extends ne {
3629
3461
  return this.dom;
3630
3462
  }
3631
3463
  }
3632
- class Ut extends ne {
3464
+ class Ut extends te {
3633
3465
  element;
3634
3466
  constructor(e) {
3635
3467
  const t = document.createElement("p");
@@ -3637,7 +3469,7 @@ class Ut extends ne {
3637
3469
  }
3638
3470
  }
3639
3471
  const Ri = [];
3640
- function Ii(s) {
3472
+ function Bi(s) {
3641
3473
  const e = document;
3642
3474
  if (e.caretPositionFromPoint) {
3643
3475
  const n = e.caretPositionFromPoint(s.x, s.y);
@@ -3653,7 +3485,7 @@ class Rn {
3653
3485
  }
3654
3486
  kind = "document";
3655
3487
  }
3656
- class Bi {
3488
+ class Ii {
3657
3489
  constructor(e, t) {
3658
3490
  this.ast = e, this.content = t;
3659
3491
  }
@@ -3671,13 +3503,13 @@ class Ai {
3671
3503
  }
3672
3504
  kind = "pendingParagraph";
3673
3505
  }
3674
- class $i {
3506
+ class Pi {
3675
3507
  constructor(e, t, n) {
3676
3508
  this.ast = e, this.showMarkup = t, this.content = n;
3677
3509
  }
3678
3510
  kind = "codeBlock";
3679
3511
  }
3680
- class Pi {
3512
+ class $i {
3681
3513
  constructor(e, t, n) {
3682
3514
  this.ast = e, this.showMarkup = t, this.content = n;
3683
3515
  }
@@ -3719,13 +3551,13 @@ class zi {
3719
3551
  }
3720
3552
  kind = "strikethrough";
3721
3553
  }
3722
- class qi {
3554
+ class Gi {
3723
3555
  constructor(e, t) {
3724
3556
  this.ast = e, this.content = t;
3725
3557
  }
3726
3558
  kind = "inlineCode";
3727
3559
  }
3728
- class Gi {
3560
+ class qi {
3729
3561
  constructor(e, t, n) {
3730
3562
  this.ast = e, this.showMarkup = t, this.content = n;
3731
3563
  }
@@ -3792,7 +3624,7 @@ class to {
3792
3624
  }
3793
3625
  kind = "marker";
3794
3626
  }
3795
- class In {
3627
+ class Bn {
3796
3628
  constructor(e, t, n) {
3797
3629
  this.ast = e, this.visible = t, this.decorateNewline = n;
3798
3630
  }
@@ -3804,8 +3636,8 @@ class no {
3804
3636
  }
3805
3637
  kind = "diffDecoration";
3806
3638
  }
3807
- const Bn = { showMarkup: !1, showTableGlue: !1, selectionInNode: void 0 };
3808
- function Q(s) {
3639
+ const In = { showMarkup: !1, showTableGlue: !1, selectionInNode: void 0 };
3640
+ function X(s) {
3809
3641
  return s.inlineFlow ? s : { ...s, inlineFlow: !0 };
3810
3642
  }
3811
3643
  function Dn(s, e, t, n, i) {
@@ -3821,13 +3653,13 @@ function Dn(s, e, t, n, i) {
3821
3653
  const h = f, g = e.has(h), m = o.get(h);
3822
3654
  let p;
3823
3655
  if (!g)
3824
- p = m && !m.isActive ? m.view : st(h, Bn, m?.view);
3656
+ p = m && !m.isActive ? m.view : nt(h, In, m?.view);
3825
3657
  else {
3826
- const k = t && t.endExclusive >= d && t.start <= d + h.length ? new _(
3658
+ const k = t && t.endExclusive >= d && t.start <= d + h.length ? new v(
3827
3659
  Math.max(0, t.start - d),
3828
3660
  Math.min(h.length, t.endExclusive - d)
3829
3661
  ) : void 0;
3830
- p = st(h, { showMarkup: !0, showTableGlue: !1, selectionInNode: k }, m?.view);
3662
+ p = nt(h, { showMarkup: !0, showTableGlue: !1, selectionInNode: k }, m?.view);
3831
3663
  }
3832
3664
  a.push({ ast: h, absoluteStart: d, isActive: g, view: p }), l.push({ absoluteStart: d, isActive: g, view: p, kind: "block" }), i && i.anchorBlock === h && l.push({
3833
3665
  absoluteStart: d + h.length,
@@ -3836,18 +3668,18 @@ function Dn(s, e, t, n, i) {
3836
3668
  kind: "pendingParagraph"
3837
3669
  });
3838
3670
  } else if (f instanceof H) {
3839
- const h = o.get(f), g = S(h?.view, new In(f, !1, !1));
3671
+ const h = o.get(f), g = T(h?.view, new Bn(f, !1, !1));
3840
3672
  l.push({ absoluteStart: d, isActive: !1, view: g, kind: "glue" });
3841
3673
  }
3842
3674
  d += f.length;
3843
3675
  }
3844
3676
  return new Rn(s, a, l);
3845
3677
  }
3846
- function st(s, e, t) {
3847
- return xe(s, e, t);
3678
+ function nt(s, e, t) {
3679
+ return ke(s, e, t);
3848
3680
  }
3849
3681
  function so(s, e, t) {
3850
- return st(s, e ? { showMarkup: !0, showTableGlue: !1, selectionInNode: void 0 } : Bn, t);
3682
+ return nt(s, e ? { showMarkup: !0, showTableGlue: !1, selectionInNode: void 0 } : In, t);
3851
3683
  }
3852
3684
  function io(s, e, t = !1) {
3853
3685
  const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
@@ -3857,7 +3689,7 @@ function io(s, e, t = !1) {
3857
3689
  o.push(l);
3858
3690
  continue;
3859
3691
  }
3860
- const d = $n(l);
3692
+ const d = Pn(l);
3861
3693
  d && (o.length && (i.set(d, o), o = []), n.set(d, l));
3862
3694
  }
3863
3695
  const r = o, c = [], a = [];
@@ -3868,25 +3700,25 @@ function io(s, e, t = !1) {
3868
3700
  }
3869
3701
  const d = l.view;
3870
3702
  for (const m of i.get(d.ast) ?? [])
3871
- c.push(Ue(m.node, m.deletedLocal, l.absoluteStart, !0, m.originalStart, t));
3703
+ c.push(je(m.node, m.deletedLocal, l.absoluteStart, !0, m.originalStart, t));
3872
3704
  const u = n.get(d.ast);
3873
- u && u.kind === "replaced" && u.deletedLocal.length > 0 && c.push(Ue(u.original, u.deletedLocal, l.absoluteStart, !1, u.originalStart, t));
3705
+ u && u.kind === "replaced" && u.deletedLocal.length > 0 && c.push(je(u.original, u.deletedLocal, l.absoluteStart, !1, u.originalStart, t));
3874
3706
  const f = u && u.kind === "nested" ? An(d, u, t) : d, h = u?.kind === "added" ? "added" : u?.kind === "replaced" ? "modified" : void 0, g = h ? { ...l, diffKind: h } : f !== d ? { ...l, view: f } : l;
3875
3707
  c.push(g), a.push({ ast: d.ast, absoluteStart: l.absoluteStart, isActive: l.isActive, view: f });
3876
3708
  }
3877
3709
  for (const l of r)
3878
- c.push(Ue(l.node, l.deletedLocal, s.ast.length, !0, l.originalStart, t));
3710
+ c.push(je(l.node, l.deletedLocal, s.ast.length, !0, l.originalStart, t));
3879
3711
  return new Rn(s.ast, a, c);
3880
3712
  }
3881
- function Ue(s, e, t, n, i, o) {
3713
+ function je(s, e, t, n, i, o) {
3882
3714
  return {
3883
3715
  absoluteStart: t,
3884
3716
  isActive: !1,
3885
- view: $e(s, e, n, i, o),
3717
+ view: Ae(s, e, n, i, o),
3886
3718
  kind: "diffDecoration"
3887
3719
  };
3888
3720
  }
3889
- function $e(s, e, t, n, i) {
3721
+ function Ae(s, e, t, n, i) {
3890
3722
  return new no(s, so(s, i || !t), e, t, n);
3891
3723
  }
3892
3724
  function An(s, e, t) {
@@ -3897,24 +3729,24 @@ function An(s, e, t) {
3897
3729
  o.push(a);
3898
3730
  continue;
3899
3731
  }
3900
- const l = $n(a);
3732
+ const l = Pn(a);
3901
3733
  l && (o.length && (i.set(l, o), o = []), n.set(l, a));
3902
3734
  }
3903
3735
  const r = s.content ?? [], c = [];
3904
3736
  for (const a of r) {
3905
3737
  for (const d of i.get(a.ast) ?? [])
3906
- c.push($e(d.node, d.deletedLocal, !0, d.originalStart, t));
3738
+ c.push(Ae(d.node, d.deletedLocal, !0, d.originalStart, t));
3907
3739
  const l = n.get(a.ast);
3908
- l && l.kind === "replaced" && l.deletedLocal.length > 0 ? (c.push($e(l.original, l.deletedLocal, !1, l.originalStart, t)), c.push(a)) : l && l.kind === "nested" ? c.push(An(a, l, t)) : c.push(a);
3740
+ l && l.kind === "replaced" && l.deletedLocal.length > 0 ? (c.push(Ae(l.original, l.deletedLocal, !1, l.originalStart, t)), c.push(a)) : l && l.kind === "nested" ? c.push(An(a, l, t)) : c.push(a);
3909
3741
  }
3910
3742
  for (const a of o)
3911
- c.push($e(a.node, a.deletedLocal, !0, a.originalStart, t));
3743
+ c.push(Ae(a.node, a.deletedLocal, !0, a.originalStart, t));
3912
3744
  return oo(s, c);
3913
3745
  }
3914
3746
  function oo(s, e) {
3915
3747
  return Object.assign(Object.create(Object.getPrototypeOf(s)), s, { content: e });
3916
3748
  }
3917
- function $n(s) {
3749
+ function Pn(s) {
3918
3750
  switch (s.kind) {
3919
3751
  case "unchanged":
3920
3752
  return s.node;
@@ -3928,60 +3760,60 @@ function $n(s) {
3928
3760
  return;
3929
3761
  }
3930
3762
  }
3931
- function xe(s, e, t, n) {
3763
+ function ke(s, e, t, n) {
3932
3764
  const i = s;
3933
3765
  switch (i.kind) {
3934
3766
  case "text":
3935
- return S(t, new Zi(i, e.showMarkup, n?.left ?? !1, n?.right ?? !1));
3767
+ return T(t, new Zi(i, e.showMarkup, n?.left ?? !1, n?.right ?? !1));
3936
3768
  // The trailing gap is revealed as `↵` glyphs by virtue of its `blockGap`
3937
3769
  // kind (see `GlueViewNode`), so the break needs no inline-flow opt-in.
3938
3770
  case "thematicBreak":
3939
- return S(t, new Ji(i, e.showMarkup, A(i.children, e, t)));
3771
+ return T(t, new Ji(i, e.showMarkup, A(i.children, e, t)));
3940
3772
  case "unhandledBlock":
3941
- return S(t, new eo(i, A(i.children, e, t)));
3773
+ return T(t, new eo(i, A(i.children, e, t)));
3942
3774
  case "marker":
3943
- return S(t, new to(i, ao(i.markerKind, e)));
3775
+ return T(t, new to(i, ao(i.markerKind, e)));
3944
3776
  case "glue":
3945
- return S(t, new In(i, lo(i.glueKind, e), e.inlineFlow ?? !1));
3777
+ return T(t, new Bn(i, lo(i.glueKind, e), e.inlineFlow ?? !1));
3946
3778
  case "heading":
3947
- return S(t, new Bi(i, A(i.children, Q(e), t)));
3779
+ return T(t, new Ii(i, A(i.children, X(e), t)));
3948
3780
  case "paragraph":
3949
- return S(t, new Di(i, A(i.children, Q(e), t)));
3781
+ return T(t, new Di(i, A(i.children, X(e), t)));
3950
3782
  case "codeBlock":
3951
- return S(t, new $i(i, e.showMarkup, A(i.children, e, t)));
3783
+ return T(t, new Pi(i, e.showMarkup, A(i.children, e, t)));
3952
3784
  case "mathBlock":
3953
- return S(t, new Pi(i, e.showMarkup, A(i.children, e, t)));
3785
+ return T(t, new $i(i, e.showMarkup, A(i.children, e, t)));
3954
3786
  case "blockQuote":
3955
- return S(t, new Vi(i, A(i.children, e, t)));
3787
+ return T(t, new Vi(i, A(i.children, e, t)));
3956
3788
  case "list":
3957
- return S(t, ho(i, e, t));
3789
+ return T(t, ho(i, e, t));
3958
3790
  case "listItem":
3959
- return S(t, Pn(i, e, t));
3791
+ return T(t, $n(i, e, t));
3960
3792
  case "table":
3961
- return S(t, uo(i, e, t));
3793
+ return T(t, uo(i, e, t));
3962
3794
  case "tableRow":
3963
- return S(t, Vn(i, e, !1, t));
3795
+ return T(t, Vn(i, e, !1, t));
3964
3796
  case "tableCell":
3965
- return S(t, Hn(i, e.showMarkup, e.showTableGlue, e.selectionInNode, t));
3797
+ return T(t, Hn(i, e.showMarkup, e.showTableGlue, e.selectionInNode, t));
3966
3798
  case "strong":
3967
- return S(t, new Ki(i, A(i.children, Q(e), t)));
3799
+ return T(t, new Ki(i, A(i.children, X(e), t)));
3968
3800
  case "emphasis":
3969
- return S(t, new Wi(i, A(i.children, Q(e), t)));
3801
+ return T(t, new Wi(i, A(i.children, X(e), t)));
3970
3802
  case "strikethrough":
3971
- return S(t, new zi(i, A(i.children, Q(e), t)));
3803
+ return T(t, new zi(i, A(i.children, X(e), t)));
3972
3804
  case "inlineCode":
3973
- return S(t, new qi(i, A(i.children, Q(e), t)));
3805
+ return T(t, new Gi(i, A(i.children, X(e), t)));
3974
3806
  case "inlineMath":
3975
- return S(t, new Gi(i, e.showMarkup, A(i.children, Q(e), t)));
3807
+ return T(t, new qi(i, e.showMarkup, A(i.children, X(e), t)));
3976
3808
  case "link":
3977
- return S(t, new ji(i, A(i.children, Q(e), t)));
3809
+ return T(t, new ji(i, A(i.children, X(e), t)));
3978
3810
  case "image":
3979
- return S(t, new Ui(i, e.showMarkup, A(i.children, Q(e), t)));
3811
+ return T(t, new Ui(i, e.showMarkup, A(i.children, X(e), t)));
3980
3812
  case "document":
3981
- return Dn(i, /* @__PURE__ */ new Set(), _.ofLength(0), void 0);
3813
+ return Dn(i, /* @__PURE__ */ new Set(), v.ofLength(0), void 0);
3982
3814
  }
3983
3815
  }
3984
- function it(s) {
3816
+ function st(s) {
3985
3817
  return s.kind === "document" ? s.blocks.map((e) => e.view) : "content" in s ? s.content : ro;
3986
3818
  }
3987
3819
  const ro = [];
@@ -3989,13 +3821,13 @@ function Oe(s) {
3989
3821
  if (!s)
3990
3822
  return;
3991
3823
  const e = /* @__PURE__ */ new Map();
3992
- for (const t of it(s))
3824
+ for (const t of st(s))
3993
3825
  e.set(t.ast, t);
3994
3826
  return e;
3995
3827
  }
3996
- function S(s, e) {
3828
+ function T(s, e) {
3997
3829
  if (s && s.kind === e.kind && s.ast === e.ast && co(s, e)) {
3998
- const t = it(s), n = it(e);
3830
+ const t = st(s), n = st(e);
3999
3831
  if (t.length === n.length && t.every((i, o) => i === n[o]))
4000
3832
  return s;
4001
3833
  }
@@ -4038,7 +3870,7 @@ function A(s, e, t) {
4038
3870
  left: o > 0 && Xt(s[o - 1], "end"),
4039
3871
  right: o < s.length - 1 && Xt(s[o + 1], "start")
4040
3872
  } : void 0;
4041
- return xe(i, e, n?.get(i), r);
3873
+ return ke(i, e, n?.get(i), r);
4042
3874
  });
4043
3875
  }
4044
3876
  function Xt(s, e) {
@@ -4077,19 +3909,19 @@ function ho(s, e, t) {
4077
3909
  selectionInNode: u && e.selectionInNode ? e.selectionInNode.delta(-a) : void 0,
4078
3910
  listLevel: r
4079
3911
  };
4080
- c.push(S(n?.get(d), Pn(d, f, n?.get(d))));
3912
+ c.push(T(n?.get(d), $n(d, f, n?.get(d))));
4081
3913
  } else
4082
- c.push(xe(l, e, n?.get(l)));
3914
+ c.push(ke(l, e, n?.get(l)));
4083
3915
  a += l.length;
4084
3916
  }
4085
3917
  return new Hi(s, c);
4086
3918
  }
4087
- function Pn(s, e, t) {
3919
+ function $n(s, e, t) {
4088
3920
  const n = Oe(t), i = [];
4089
3921
  let o = 0;
4090
3922
  for (const r of s.children) {
4091
3923
  const c = e.selectionInNode ? { ...e, selectionInNode: e.selectionInNode.delta(-o) } : e;
4092
- i.push(xe(r, c, n?.get(r))), o += r.length;
3924
+ i.push(ke(r, c, n?.get(r))), o += r.length;
4093
3925
  }
4094
3926
  return new Xi(s, e.showMarkup, i, e.listLevel ?? 1);
4095
3927
  }
@@ -4105,9 +3937,9 @@ function uo(s, e, t) {
4105
3937
  showTableGlue: i,
4106
3938
  selectionInNode: !u && i && e.selectionInNode ? e.selectionInNode.delta(-a) : void 0
4107
3939
  };
4108
- c.push(S(n?.get(d), Vn(d, f, u, n?.get(d))));
3940
+ c.push(T(n?.get(d), Vn(d, f, u, n?.get(d))));
4109
3941
  } else
4110
- c.push(xe(l, e, n?.get(l)));
3942
+ c.push(ke(l, e, n?.get(l)));
4111
3943
  a += l.length;
4112
3944
  }
4113
3945
  return new Fi(s, c);
@@ -4120,23 +3952,23 @@ function Vn(s, e, t, n) {
4120
3952
  const u = d, f = t ? o : r.has(s.cells.indexOf(u)), h = f && e.selectionInNode ? e.selectionInNode.delta(-l) : void 0;
4121
3953
  a.push(Hn(u, f, o, h, i?.get(u)));
4122
3954
  } else
4123
- a.push(xe(d, e, i?.get(d)));
3955
+ a.push(ke(d, e, i?.get(d)));
4124
3956
  l += d.length;
4125
3957
  }
4126
3958
  return new Qi(s, t, a);
4127
3959
  }
4128
3960
  function Hn(s, e, t, n, i) {
4129
3961
  const o = { showMarkup: e, showTableGlue: t, selectionInNode: n };
4130
- return new Yi(s, e, t, A(s.children, Q(o), i));
3962
+ return new Yi(s, e, t, A(s.children, X(o), i));
4131
3963
  }
4132
- const He = /* @__PURE__ */ new Set();
3964
+ const Ve = /* @__PURE__ */ new Set();
4133
3965
  function fo(s, e) {
4134
3966
  if (!e.showMarkup || !e.selectionInNode)
4135
- return He;
3967
+ return Ve;
4136
3968
  const t = e.selectionInNode;
4137
3969
  if (t.isEmpty) {
4138
3970
  const o = ft(s, t.start);
4139
- return o === void 0 ? He : /* @__PURE__ */ new Set([o]);
3971
+ return o === void 0 ? Ve : /* @__PURE__ */ new Set([o]);
4140
3972
  }
4141
3973
  const n = /* @__PURE__ */ new Set();
4142
3974
  let i = 0;
@@ -4148,11 +3980,11 @@ function fo(s, e) {
4148
3980
  }
4149
3981
  function go(s, e) {
4150
3982
  if (!e.showMarkup || !e.selectionInNode)
4151
- return He;
3983
+ return Ve;
4152
3984
  const t = e.selectionInNode;
4153
3985
  if (t.isEmpty) {
4154
3986
  const o = mo(s, t.start);
4155
- return o === void 0 ? He : /* @__PURE__ */ new Set([o]);
3987
+ return o === void 0 ? Ve : /* @__PURE__ */ new Set([o]);
4156
3988
  }
4157
3989
  const n = /* @__PURE__ */ new Set();
4158
3990
  let i = 0;
@@ -4195,7 +4027,7 @@ function _o(s, e, t) {
4195
4027
  const c = document.createRange();
4196
4028
  return c.setStart(n, i), c.setEnd(o, r), c;
4197
4029
  }
4198
- function Xe(s, e) {
4030
+ function Ue(s, e) {
4199
4031
  const t = po(s), n = [];
4200
4032
  for (const i of e) {
4201
4033
  if (i.isEmpty)
@@ -4231,14 +4063,14 @@ class vo extends W {
4231
4063
  }
4232
4064
  _repaint(e) {
4233
4065
  const t = [], n = [];
4234
- e.inserted && t.push(...Xe(e.node, e.inserted));
4066
+ e.inserted && t.push(...Ue(e.node, e.inserted));
4235
4067
  const i = (o) => {
4236
- if (o instanceof nt)
4237
- o.whole || n.push(...Xe(o.sideNode, o.deletedRanges.map((r) => r.range)));
4238
- else if (o instanceof tt)
4068
+ if (o instanceof tt)
4069
+ o.whole || n.push(...Ue(o.sideNode, o.deletedRanges.map((r) => r.range)));
4070
+ else if (o instanceof et)
4239
4071
  for (const r of o.sides)
4240
4072
  for (const c of r.ranges) {
4241
- const a = Xe(r.node, [c.range]);
4073
+ const a = Ue(r.node, [c.range]);
4242
4074
  (c.kind === "inserted" ? t : n).push(...a);
4243
4075
  }
4244
4076
  for (const r of o.children)
@@ -4261,10 +4093,10 @@ class vo extends W {
4261
4093
  }
4262
4094
  class wo extends W {
4263
4095
  constructor(e, t) {
4264
- super(), this._parent = e, this.element = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.element.setAttribute("class", "md-selection-layer"), this._path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._path.setAttribute("class", "md-selection-path"), this.element.appendChild(this._path), this.rendering = $(this, (n) => {
4096
+ super(), this._parent = e, this.element = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.element.setAttribute("class", "md-selection-layer"), this._path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._path.setAttribute("class", "md-selection-path"), this.element.appendChild(this._path), this.rendering = P(this, (n) => {
4265
4097
  const i = n.readObservable(t.selection), o = n.readObservable(t.visualLineMap), r = n.readObservable(t.blocks);
4266
4098
  return ko(this._path, this._parent, i, o, r);
4267
- }), this._register(P((n) => {
4099
+ }), this._register($((n) => {
4268
4100
  n.readObservable(this.rendering);
4269
4101
  }));
4270
4102
  }
@@ -4283,19 +4115,19 @@ function ko(s, e, t, n, i) {
4283
4115
  const o = Fn(t.range, e, n, i);
4284
4116
  return s.setAttribute("d", Wn(o, 4)), new Qt(o);
4285
4117
  }
4286
- const xo = 0.4;
4118
+ const bo = 0.4;
4287
4119
  function Fn(s, e, t, n) {
4288
4120
  if (s.isEmpty)
4289
4121
  return [];
4290
4122
  const i = s, o = e.getBoundingClientRect(), r = t.lines, c = [];
4291
4123
  for (let h = 0; h < r.length; h++) {
4292
- const g = r[h], m = Fe(g);
4124
+ const g = r[h], m = He(g);
4293
4125
  if (!m)
4294
4126
  continue;
4295
- const p = h + 1 < r.length ? Fe(r[h + 1]) : void 0, k = !p || p.start > m.endExclusive, w = i.intersects(m), y = k && i.start <= m.endExclusive && i.endExclusive > m.endExclusive;
4127
+ const p = h + 1 < r.length ? He(r[h + 1]) : void 0, k = !p || p.start > m.endExclusive, w = i.intersects(m), y = k && i.start <= m.endExclusive && i.endExclusive > m.endExclusive;
4296
4128
  if (!w && !y)
4297
4129
  continue;
4298
- const E = n.find((v) => _.ofStartAndLength(v.absoluteStart, v.block.length).containsRange(m));
4130
+ const E = n.find((_) => v.ofStartAndLength(_.absoluteStart, _.block.length).containsRange(m));
4299
4131
  c.push({ line: g, lineRange: m, block: E, hardBreak: k });
4300
4132
  }
4301
4133
  const a = [], l = [];
@@ -4306,10 +4138,10 @@ function Fn(s, e, t, n) {
4306
4138
  E = h.xAtOffset(i.endExclusive);
4307
4139
  else {
4308
4140
  const C = i.endExclusive > w;
4309
- E = h.rect.right + (C && m ? h.rect.height * xo : 0);
4141
+ E = h.rect.right + (C && m ? h.rect.height * bo : 0);
4310
4142
  }
4311
- const v = Kn(p);
4312
- v && (y = Math.max(y, v.left), E = Math.min(E, v.right)), a.push({
4143
+ const _ = Kn(p);
4144
+ _ && (y = Math.max(y, _.left), E = Math.min(E, _.right)), a.push({
4313
4145
  x: y - o.left,
4314
4146
  y: h.rect.top - o.top,
4315
4147
  width: Math.max(0, E - y),
@@ -4334,29 +4166,29 @@ function Fn(s, e, t, n) {
4334
4166
  g && (d.has(g) || d.set(g, h), u.set(g, h));
4335
4167
  }
4336
4168
  const f = n.map(
4337
- (h) => i.intersects(_.ofStartAndLength(h.absoluteStart, h.block.length))
4169
+ (h) => i.intersects(v.ofStartAndLength(h.absoluteStart, h.block.length))
4338
4170
  );
4339
4171
  for (let h = 0; h < n.length - 1; h++) {
4340
4172
  const g = n[h], m = n[h + 1], p = g.absoluteStart + g.block.length, k = m.absoluteStart;
4341
- if (p < k && !i.containsRange(_.fromTo(p, k)) || p >= k && !(f[h] && f[h + 1]))
4173
+ if (p < k && !i.containsRange(v.fromTo(p, k)) || p >= k && !(f[h] && f[h + 1]))
4342
4174
  continue;
4343
- const w = g.element.getBoundingClientRect(), y = m.element.getBoundingClientRect(), E = yo(t, m, y.top), v = w.bottom;
4344
- if (E <= v)
4175
+ const w = g.element.getBoundingClientRect(), y = m.element.getBoundingClientRect(), E = yo(t, m, y.top), _ = w.bottom;
4176
+ if (E <= _)
4345
4177
  continue;
4346
- const C = u.get(g), B = d.get(m);
4347
- if (C === void 0 && Qe(t, g) || B === void 0 && Qe(t, m))
4178
+ const C = u.get(g), I = d.get(m);
4179
+ if (C === void 0 && Xe(t, g) || I === void 0 && Xe(t, m))
4348
4180
  continue;
4349
- const K = C !== void 0 ? l[C] : { left: w.left, right: w.right }, ue = B !== void 0 ? l[B] : { left: y.left, right: y.right }, ze = Math.max(K.left, ue.left), kt = Math.min(K.right, ue.right);
4350
- kt <= ze || a.push({
4351
- x: ze - o.left,
4352
- y: v - o.top,
4353
- width: kt - ze,
4354
- height: E - v
4181
+ const K = C !== void 0 ? l[C] : { left: w.left, right: w.right }, he = I !== void 0 ? l[I] : { left: y.left, right: y.right }, We = Math.max(K.left, he.left), kt = Math.min(K.right, he.right);
4182
+ kt <= We || a.push({
4183
+ x: We - o.left,
4184
+ y: _ - o.top,
4185
+ width: kt - We,
4186
+ height: E - _
4355
4187
  });
4356
4188
  }
4357
4189
  for (const h of n) {
4358
- const g = _.ofStartAndLength(h.absoluteStart, h.block.length);
4359
- if (!i.intersects(g) || Qe(t, h))
4190
+ const g = v.ofStartAndLength(h.absoluteStart, h.block.length);
4191
+ if (!i.intersects(g) || Xe(t, h))
4360
4192
  continue;
4361
4193
  const m = h.element.getBoundingClientRect();
4362
4194
  a.push({
@@ -4368,18 +4200,18 @@ function Fn(s, e, t, n) {
4368
4200
  }
4369
4201
  return a;
4370
4202
  }
4371
- function Fe(s) {
4203
+ function He(s) {
4372
4204
  if (s.runs.length === 0)
4373
4205
  return;
4374
4206
  let e = 1 / 0, t = -1 / 0;
4375
4207
  for (const n of s.runs)
4376
4208
  n.sourceStart < e && (e = n.sourceStart), n.sourceEndExclusive > t && (t = n.sourceEndExclusive);
4377
- return _.fromTo(e, t);
4209
+ return v.fromTo(e, t);
4378
4210
  }
4379
- function Qe(s, e) {
4380
- const t = _.ofStartAndLength(e.absoluteStart, e.block.length);
4211
+ function Xe(s, e) {
4212
+ const t = v.ofStartAndLength(e.absoluteStart, e.block.length);
4381
4213
  for (const n of s.lines) {
4382
- const i = Fe(n);
4214
+ const i = He(n);
4383
4215
  if (i && t.containsRange(i))
4384
4216
  return !0;
4385
4217
  }
@@ -4394,13 +4226,13 @@ function Kn(s) {
4394
4226
  const n = e.getBoundingClientRect().left + e.clientLeft;
4395
4227
  return { left: n, right: n + e.clientWidth };
4396
4228
  }
4397
- function bo(s, e) {
4229
+ function xo(s, e) {
4398
4230
  return s.find((t) => e >= t.absoluteStart && e <= t.absoluteStart + t.block.length);
4399
4231
  }
4400
4232
  function yo(s, e, t) {
4401
- const n = _.ofStartAndLength(e.absoluteStart, e.block.length);
4233
+ const n = v.ofStartAndLength(e.absoluteStart, e.block.length);
4402
4234
  for (const i of s.lines) {
4403
- const o = Fe(i);
4235
+ const o = He(i);
4404
4236
  if (o && n.containsRange(o))
4405
4237
  return i.rect.top;
4406
4238
  }
@@ -4444,34 +4276,34 @@ function Co(s, e) {
4444
4276
  return "";
4445
4277
  const n = new Array(t);
4446
4278
  for (let r = 0; r < t; r++) {
4447
- const c = s[(r + t - 1) % t], a = s[(r + 1) % t], l = Ie(s[r], c), d = Ie(s[r], a);
4279
+ const c = s[(r + t - 1) % t], a = s[(r + 1) % t], l = Re(s[r], c), d = Re(s[r], a);
4448
4280
  n[r] = Math.min(e, l / 2, d / 2);
4449
4281
  }
4450
- const i = Ye(s[t - 1], s[0], Ie(s[t - 1], s[0]) - n[0]), o = [`M${X(i.x)},${X(i.y)}`];
4282
+ const i = Qe(s[t - 1], s[0], Re(s[t - 1], s[0]) - n[0]), o = [`M${U(i.x)},${U(i.y)}`];
4451
4283
  for (let r = 0; r < t; r++) {
4452
- const c = s[r], a = s[(r + 1) % t], l = n[r], d = Ye(c, a, l);
4453
- l > 0 ? o.push(`A${X(l)},${X(l)} 0 0 ${c.convex ? 1 : 0} ${X(d.x)},${X(d.y)}`) : o.push(`L${X(d.x)},${X(d.y)}`);
4454
- const u = n[(r + 1) % t], f = Ye(c, a, Ie(c, a) - u);
4455
- o.push(`L${X(f.x)},${X(f.y)}`);
4284
+ const c = s[r], a = s[(r + 1) % t], l = n[r], d = Qe(c, a, l);
4285
+ l > 0 ? o.push(`A${U(l)},${U(l)} 0 0 ${c.convex ? 1 : 0} ${U(d.x)},${U(d.y)}`) : o.push(`L${U(d.x)},${U(d.y)}`);
4286
+ const u = n[(r + 1) % t], f = Qe(c, a, Re(c, a) - u);
4287
+ o.push(`L${U(f.x)},${U(f.y)}`);
4456
4288
  }
4457
4289
  return o.push("Z"), o.join(" ");
4458
4290
  }
4459
- function Ie(s, e) {
4291
+ function Re(s, e) {
4460
4292
  return Math.hypot(s.x - e.x, s.y - e.y);
4461
4293
  }
4462
- function Ye(s, e, t) {
4294
+ function Qe(s, e, t) {
4463
4295
  const n = e.x - s.x, i = e.y - s.y, o = Math.hypot(n, i);
4464
4296
  if (o === 0)
4465
4297
  return { x: s.x, y: s.y };
4466
4298
  const r = t / o;
4467
4299
  return { x: s.x + n * r, y: s.y + i * r };
4468
4300
  }
4469
- function X(s) {
4301
+ function U(s) {
4470
4302
  return s.toFixed(2);
4471
4303
  }
4472
4304
  class Lo extends W {
4473
4305
  constructor(e, t) {
4474
- super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-cursor", this.rendering = $(this, (n) => {
4306
+ super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-cursor", this.rendering = P(this, (n) => {
4475
4307
  const i = t.pendingCaretRect ? n.readObservable(t.pendingCaretRect) : void 0;
4476
4308
  if (i) {
4477
4309
  const h = this._parent.getBoundingClientRect(), g = i.translate(-h.left, -h.top);
@@ -4480,14 +4312,14 @@ class Lo extends W {
4480
4312
  const o = n.readObservable(t.offset), r = n.readObservable(t.visualLineMap);
4481
4313
  if (o === void 0 || r.isEmpty)
4482
4314
  return this.element.style.display = "none", new Be(o ?? 0, !1, V.EMPTY);
4483
- const c = r.lineIndexOfOffset(o), a = r.lineRect(c).withZeroWidthAt(r.xAtOffset(o)), l = t.blocks ? n.readObservable(t.blocks) : void 0, d = l ? Kn(bo(l, o)) : void 0;
4315
+ const c = r.lineIndexOfOffset(o), a = r.lineRect(c).withZeroWidthAt(r.xAtOffset(o)), l = t.blocks ? n.readObservable(t.blocks) : void 0, d = l ? Kn(xo(l, o)) : void 0;
4484
4316
  if (d && (a.x < d.left - 0.5 || a.x > d.right + 0.5))
4485
4317
  return this.element.style.display = "none", new Be(o, !1, V.EMPTY);
4486
4318
  const u = this._parent.getBoundingClientRect(), f = a.translate(-u.left, -u.top);
4487
4319
  return this.element.style.left = `${f.x}px`, this.element.style.top = `${f.y}px`, this.element.style.height = `${f.height}px`, this.element.style.display = "", new Be(o, !0, f);
4488
- }), this._register(P((n) => {
4320
+ }), this._register($((n) => {
4489
4321
  n.readObservable(this.rendering);
4490
- })), this._register(P((n) => {
4322
+ })), this._register($((n) => {
4491
4323
  n.readObservable(t.offset), this.element.style.animation = "none", this.element.offsetWidth, this.element.style.animation = "";
4492
4324
  }));
4493
4325
  }
@@ -4501,10 +4333,10 @@ class Be {
4501
4333
  }
4502
4334
  class To extends W {
4503
4335
  constructor(e, t) {
4504
- super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-gutter-layer", this.rendering = $(this, (n) => {
4336
+ super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-gutter-layer", this.rendering = P(this, (n) => {
4505
4337
  const i = n.readObservable(t.markers), o = n.readObservable(t.visualLineMap);
4506
4338
  return this._render(i, o);
4507
- }), this._register(P((n) => {
4339
+ }), this._register($((n) => {
4508
4340
  n.readObservable(this.rendering);
4509
4341
  }));
4510
4342
  }
@@ -4515,7 +4347,7 @@ class To extends W {
4515
4347
  return new Yt([]);
4516
4348
  const n = this._parent.getBoundingClientRect(), i = [];
4517
4349
  for (const o of e) {
4518
- const r = o.type === "deleted" || o.range.isEmpty ? Oo(o, t, n.top) : So(o, t, n.top);
4350
+ const r = o.type === "deleted" || o.range.isEmpty ? So(o, t, n.top) : Oo(o, t, n.top);
4519
4351
  if (!r)
4520
4352
  continue;
4521
4353
  const c = document.createElement("div");
@@ -4529,7 +4361,7 @@ class Yt {
4529
4361
  this.rects = e;
4530
4362
  }
4531
4363
  }
4532
- function So(s, e, t) {
4364
+ function Oo(s, e, t) {
4533
4365
  let n = 1 / 0, i = -1 / 0;
4534
4366
  for (const o of e.lines) {
4535
4367
  const r = Mo(o);
@@ -4538,7 +4370,7 @@ function So(s, e, t) {
4538
4370
  if (!(i <= n))
4539
4371
  return { type: s.type, y: n - t, height: i - n };
4540
4372
  }
4541
- function Oo(s, e, t) {
4373
+ function So(s, e, t) {
4542
4374
  const n = e.lineIndexOfOffset(s.range.start);
4543
4375
  return { type: "deleted", y: e.lineRect(n).top - t, height: 0 };
4544
4376
  }
@@ -4548,14 +4380,14 @@ function Mo(s) {
4548
4380
  let e = 1 / 0, t = -1 / 0;
4549
4381
  for (const n of s.runs)
4550
4382
  n.sourceStart < e && (e = n.sourceStart), n.sourceEndExclusive > t && (t = n.sourceEndExclusive);
4551
- return _.fromTo(e, t);
4383
+ return v.fromTo(e, t);
4552
4384
  }
4553
4385
  const No = 900;
4554
- class Br extends W {
4386
+ class Dr extends W {
4555
4387
  constructor(e, t) {
4556
4388
  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);
4557
- const n = this._options?.limitedWidth ?? ts(No);
4558
- this._register(P((a) => {
4389
+ const n = this._options?.limitedWidth ?? Un(No);
4390
+ this._register($((a) => {
4559
4391
  const l = n.read(a);
4560
4392
  this._contentContainer.style.maxWidth = l === void 0 ? "" : `${l}px`;
4561
4393
  })), this.measuredLayout = new Ws();
@@ -4596,7 +4428,7 @@ class Br extends W {
4596
4428
  text: this._model.sourceText.get().value,
4597
4429
  selectionStart: 0,
4598
4430
  selectionEnd: 0
4599
- }), this.element.editContext = this.editContext, this._register(P(this._renderAutorun)), this._setupModifierTracking(), this._register(P((a) => {
4431
+ }), this.element.editContext = this.editContext, this._register($(this._renderAutorun)), this._setupModifierTracking(), this._register($((a) => {
4600
4432
  const l = a.readObservable(this._model.selection)?.range;
4601
4433
  this.editContext.updateSelection(l?.start ?? 0, l?.endExclusive ?? 0);
4602
4434
  })), this._register({ dispose: () => {
@@ -4617,6 +4449,7 @@ class Br extends W {
4617
4449
  _selectionView;
4618
4450
  _gutterMarkersView;
4619
4451
  _diffHighlightsView;
4452
+ _readonlyToggleButton;
4620
4453
  /**
4621
4454
  * The mounted block sequence, in source order. Rebuilt (not mutated) each
4622
4455
  * frame by {@link DocumentViewNode.create}; the view just swaps one
@@ -4652,7 +4485,7 @@ class Br extends W {
4652
4485
  * react to mount/unmount. Derived from {@link _document}, so it stays in
4653
4486
  * lock-step without any manual bookkeeping.
4654
4487
  */
4655
- _selectionBlocksObs = $(this, (e) => {
4488
+ _selectionBlocksObs = P(this, (e) => {
4656
4489
  const t = this._document.read(e);
4657
4490
  return t ? t.blocks.map((n) => ({
4658
4491
  block: n.node.block,
@@ -4669,7 +4502,7 @@ class Br extends W {
4669
4502
  * contributions (e.g. comment mode) can anchor an overlay to the active end of
4670
4503
  * the selection — where the user's cursor is — without re-deriving geometry.
4671
4504
  */
4672
- _caretRect = $(this, (e) => {
4505
+ _caretRect = P(this, (e) => {
4673
4506
  const t = this._cursorView.rendering.read(e);
4674
4507
  return t.visible ? t.rect : void 0;
4675
4508
  });
@@ -4692,7 +4525,7 @@ class Br extends W {
4692
4525
  * anchor overlays to them. Recomputes when the measured layout changes.
4693
4526
  */
4694
4527
  rangeRects(e) {
4695
- return $(this, (t) => {
4528
+ return P(this, (t) => {
4696
4529
  const n = this.measuredLayout.visualLineMap.read(t), i = this._selectionBlocksObs.read(t);
4697
4530
  return Fn(e, this._contentContainer, n, i);
4698
4531
  });
@@ -4704,7 +4537,7 @@ class Br extends W {
4704
4537
  * a plain click, but an active link only opens with the modifier held.
4705
4538
  */
4706
4539
  _setupModifierTracking() {
4707
- this._register(P((e) => {
4540
+ this._register($((e) => {
4708
4541
  this.element.classList.toggle("md-mod-down", this._model.ctrlOrMetaDown.read(e));
4709
4542
  }));
4710
4543
  }
@@ -4713,15 +4546,16 @@ class Br extends W {
4713
4546
  * {@link EditorModel.readonlyMode}: when locked (read-only) every block stays
4714
4547
  * in its clean rendered form (no markdown markers revealed) and edits are
4715
4548
  * ignored, while text selection still works. The control lives in a
4716
- * zero-height *sticky* host so the lock stays pinned to the top-right corner
4717
- * of the scroll container as the document scrolls. The current mode is also
4718
- * mirrored onto the root as `.md-readonly` for any CSS hooks.
4549
+ * zero-height *sticky* host inside the centered content container, so the
4550
+ * lock follows the content's right edge and remains pinned as the document
4551
+ * scrolls. The current mode is also mirrored onto the root as `.md-readonly`
4552
+ * for any CSS hooks.
4719
4553
  */
4720
4554
  _setupReadonlyToggle() {
4721
4555
  const e = document.createElement("div");
4722
- e.className = "md-readonly-toggle-host";
4556
+ e.className = "md-readonly-toggle-host", this._contentContainer.classList.add("md-editor-content-with-readonly-toggle");
4723
4557
  const t = document.createElement("button");
4724
- t.type = "button", t.className = "md-readonly-toggle";
4558
+ t.type = "button", t.className = "md-readonly-toggle", this._readonlyToggleButton = t;
4725
4559
  const n = document.createElement("span");
4726
4560
  n.className = "md-readonly-toggle-indicator", n.setAttribute("aria-hidden", "true");
4727
4561
  const i = document.createElementNS("http://www.w3.org/2000/svg", "svg");
@@ -4733,26 +4567,33 @@ class Br extends W {
4733
4567
  const c = document.createElementNS("http://www.w3.org/2000/svg", "svg");
4734
4568
  c.classList.add("md-readonly-toggle-icon", "md-readonly-toggle-icon-editing"), c.setAttribute("viewBox", "0 0 16 16"), c.setAttribute("fill", "currentColor"), c.setAttribute("aria-hidden", "true");
4735
4569
  const a = document.createElementNS("http://www.w3.org/2000/svg", "path");
4736
- a.setAttribute("d", "M14.236 1.76386C13.2123 0.740172 11.5525 0.740171 10.5289 1.76386L2.65722 9.63549C2.28304 10.0097 2.01623 10.4775 1.88467 10.99L1.01571 14.3755C0.971767 14.5467 1.02148 14.7284 1.14646 14.8534C1.27144 14.9783 1.45312 15.028 1.62432 14.9841L5.00978 14.1151C5.52234 13.9836 5.99015 13.7168 6.36433 13.3426L14.236 5.47097C15.2596 4.44728 15.2596 2.78755 14.236 1.76386ZM11.236 2.47097C11.8691 1.8378 12.8957 1.8378 13.5288 2.47097C14.162 3.10413 14.162 4.1307 13.5288 4.76386L12.75 5.54269L10.4571 3.24979L11.236 2.47097ZM9.75002 3.9569L12.0429 6.24979L5.65722 12.6355C5.40969 12.883 5.10023 13.0595 4.76117 13.1465L2.19447 13.8053L2.85327 11.2386C2.9403 10.8996 3.1168 10.5901 3.36433 10.3426L9.75002 3.9569Z"), c.appendChild(a), t.append(n, i, c), e.appendChild(t), this.element.style.position || (this.element.style.position = "relative");
4570
+ a.setAttribute("d", "M14.236 1.76386C13.2123 0.740172 11.5525 0.740171 10.5289 1.76386L2.65722 9.63549C2.28304 10.0097 2.01623 10.4775 1.88467 10.99L1.01571 14.3755C0.971767 14.5467 1.02148 14.7284 1.14646 14.8534C1.27144 14.9783 1.45312 15.028 1.62432 14.9841L5.00978 14.1151C5.52234 13.9836 5.99015 13.7168 6.36433 13.3426L14.236 5.47097C15.2596 4.44728 15.2596 2.78755 14.236 1.76386ZM11.236 2.47097C11.8691 1.8378 12.8957 1.8378 13.5288 2.47097C14.162 3.10413 14.162 4.1307 13.5288 4.76386L12.75 5.54269L10.4571 3.24979L11.236 2.47097ZM9.75002 3.9569L12.0429 6.24979L5.65722 12.6355C5.40969 12.883 5.10023 13.0595 4.76117 13.1465L2.19447 13.8053L2.85327 11.2386C2.9403 10.8996 3.1168 10.5901 3.36433 10.3426L9.75002 3.9569Z"), c.appendChild(a), t.append(n, i, c), e.appendChild(t);
4737
4571
  const l = () => {
4738
4572
  this._model.readonlyMode.set(!this._model.readonlyMode.get(), void 0);
4739
- }, d = (g) => {
4740
- g.button === 0 && (g.preventDefault(), g.stopPropagation(), this.focus());
4741
- }, u = (g) => {
4742
- g.stopPropagation();
4573
+ }, d = (m) => {
4574
+ m.button === 0 && (m.preventDefault(), m.stopPropagation(), this.focus());
4575
+ }, u = (m) => {
4576
+ m.stopPropagation();
4743
4577
  }, f = () => {
4744
4578
  this.element.editContext = null;
4745
4579
  }, h = () => {
4746
4580
  this.element.editContext = this.editContext;
4581
+ }, g = (m) => {
4582
+ m.animationName === "md-readonly-toggle-shine" && t.classList.remove("md-readonly-toggle-shine");
4747
4583
  };
4748
- t.addEventListener("pointerdown", d), t.addEventListener("keydown", u), t.addEventListener("focus", f), t.addEventListener("blur", h), t.addEventListener("click", l), this._register({
4584
+ t.addEventListener("pointerdown", d), t.addEventListener("keydown", u), t.addEventListener("focus", f), t.addEventListener("blur", h), t.addEventListener("animationend", g), t.addEventListener("click", l), this._register({
4749
4585
  dispose: () => {
4750
- t.removeEventListener("pointerdown", d), t.removeEventListener("keydown", u), t.removeEventListener("focus", f), t.removeEventListener("blur", h), t.removeEventListener("click", l), this.element.editContext === null && (this.element.editContext = this.editContext);
4586
+ t.removeEventListener("pointerdown", d), t.removeEventListener("keydown", u), t.removeEventListener("focus", f), t.removeEventListener("blur", h), t.removeEventListener("animationend", g), t.removeEventListener("click", l), this._readonlyToggleButton === t && (this._readonlyToggleButton = void 0), this.element.editContext === null && (this.element.editContext = this.editContext);
4751
4587
  }
4752
- }), this._register(P((g) => {
4753
- const m = this._model.readonlyMode.read(g);
4754
- t.classList.toggle("md-readonly-toggle-locked", m), t.setAttribute("aria-pressed", String(m)), t.setAttribute("aria-label", m ? "Locked; switch to editing" : "Editing; switch to locked mode"), t.title = m ? "Read-only: markers hidden, editing disabled. Click to edit." : "Editing: click to lock (hide markers, disable editing).", this.element.classList.toggle("md-readonly", m);
4755
- })), this.element.insertBefore(e, this.element.firstChild);
4588
+ }), this._register($((m) => {
4589
+ const p = this._model.readonlyMode.read(m);
4590
+ t.classList.toggle("md-readonly-toggle-locked", p), t.setAttribute("aria-pressed", String(p)), t.setAttribute("aria-label", p ? "Locked; switch to editing" : "Editing; switch to locked mode"), t.title = p ? "Read-only: markers hidden, editing disabled. Click to edit." : "Editing: click to lock (hide markers, disable editing).", p || t.classList.remove("md-readonly-toggle-shine"), this.element.classList.toggle("md-readonly", p);
4591
+ })), this._contentContainer.insertBefore(e, this._contentContainer.firstChild);
4592
+ }
4593
+ /** Draws attention to the mode toggle after text input is attempted while locked. */
4594
+ showReadonlyEditingAttempt() {
4595
+ const e = this._readonlyToggleButton;
4596
+ !e || e.classList.contains("md-readonly-toggle-shine") || e.classList.add("md-readonly-toggle-shine");
4756
4597
  }
4757
4598
  focus() {
4758
4599
  this.element.focus({ preventScroll: !0 });
@@ -4783,7 +4624,7 @@ class Br extends W {
4783
4624
  const i = this.measuredLayout.visualLineMap.get();
4784
4625
  return i.isEmpty ? void 0 : i.offsetAtPoint(e);
4785
4626
  }
4786
- const n = Ii(e);
4627
+ const n = Bi(e);
4787
4628
  if (n)
4788
4629
  return this._document.get()?.resolveSource(n);
4789
4630
  }
@@ -4800,7 +4641,7 @@ class Br extends W {
4800
4641
  const i = this._document.get();
4801
4642
  if (!i)
4802
4643
  return;
4803
- const o = ne.forDom(n);
4644
+ const o = te.forDom(n);
4804
4645
  if (o?.ast.kind !== "tableCell" || o.dom !== n)
4805
4646
  return;
4806
4647
  const r = i.resolveSource({ node: n, offset: 0 }), c = i.resolveSource({ node: n, offset: 1 });
@@ -4813,7 +4654,7 @@ class Br extends W {
4813
4654
  (h) => h.runs.some(
4814
4655
  (g) => g.source !== void 0 && g.sourceStart < f && g.sourceEndExclusive > u
4815
4656
  )
4816
- ), d = t ? ne.forDom(t) : void 0;
4657
+ ), d = t ? te.forDom(t) : void 0;
4817
4658
  if (d && d !== o && d.dom instanceof Element) {
4818
4659
  const u = i.resolveSource({ node: d.dom, offset: 0 }), f = i.resolveSource({ node: d.dom, offset: 1 });
4819
4660
  if (u !== void 0 && f !== void 0 && !l(u, f))
@@ -4856,7 +4697,7 @@ class Br extends W {
4856
4697
  if (u.contentDomNode !== a.contentDomNode)
4857
4698
  throw new Error("DocumentViewNode.contentDomNode must be stable across rebuilds");
4858
4699
  } else
4859
- this._contentContainer.insertBefore(u.contentDomNode, this._contentContainer.firstChild);
4700
+ this._contentContainer.insertBefore(u.contentDomNode, this._selectionView.element);
4860
4701
  this._document.set(u, void 0), this._publishMeasurements(u);
4861
4702
  const f = u.pendingElement;
4862
4703
  if (f) {
@@ -4880,7 +4721,7 @@ class Br extends W {
4880
4721
  for (const n of e.blocks) {
4881
4722
  const i = n.node.element.getBoundingClientRect();
4882
4723
  n.node.recordMeasuredHeight(i.height);
4883
- const o = Se.measure([{
4724
+ const o = Te.measure([{
4884
4725
  absoluteStart: n.absoluteStart,
4885
4726
  viewNode: n.node
4886
4727
  }]);
@@ -4929,7 +4770,7 @@ class Ro {
4929
4770
  };
4930
4771
  }
4931
4772
  }
4932
- class Dr {
4773
+ class Ar {
4933
4774
  constructor(e = navigator.clipboard) {
4934
4775
  this._clipboard = e;
4935
4776
  }
@@ -4962,8 +4803,8 @@ class Dr {
4962
4803
  return n.addEventListener("keydown", t), { dispose: () => n.removeEventListener("keydown", t) };
4963
4804
  }
4964
4805
  }
4965
- const Io = 500, Zt = 5;
4966
- class Ar extends W {
4806
+ const Bo = 500, Zt = 5;
4807
+ class Pr extends W {
4967
4808
  constructor(e, t, n) {
4968
4809
  super(), this._model = e, this._view = t;
4969
4810
  const i = this._view.element;
@@ -4982,7 +4823,7 @@ class Ar extends W {
4982
4823
  this._register(r.connect({
4983
4824
  element: i,
4984
4825
  getSelectedText: () => this._selectedText(),
4985
- deleteSelection: () => this._executeEditCommand(Ot),
4826
+ deleteSelection: () => this._executeEditCommand(St),
4986
4827
  insertText: (a) => {
4987
4828
  this._model.pendingParagraph.get() !== void 0 ? this._model.materializePendingParagraph(a) : this._executeEditCommand(ri(a));
4988
4829
  }
@@ -4998,12 +4839,12 @@ class Ar extends W {
4998
4839
  /** Timestamp and position of the previous pointer-down, for multi-click detection. */
4999
4840
  _lastPointerDown;
5000
4841
  _handleTextUpdate = (e) => {
5001
- if (this._model.pendingParagraph.get() !== void 0) {
4842
+ if (this._model.readonlyMode.get() && e.text.length > 0 && this._view.showReadonlyEditingAttempt(), this._model.pendingParagraph.get() !== void 0) {
5002
4843
  e.text.length > 0 ? this._model.materializePendingParagraph(e.text) : this._model.cancelPendingParagraph();
5003
4844
  return;
5004
4845
  }
5005
- const t = T.replace(
5006
- new _(e.updateRangeStart, e.updateRangeEnd),
4846
+ const t = S.replace(
4847
+ new v(e.updateRangeStart, e.updateRangeEnd),
5007
4848
  e.text
5008
4849
  );
5009
4850
  this._model.applyEdit(t);
@@ -5012,41 +4853,42 @@ class Ar extends W {
5012
4853
  if (e.button !== 0)
5013
4854
  return;
5014
4855
  e.preventDefault(), this._model.cancelPendingParagraph(), this._view.focus(), this._desiredColumn = void 0;
5015
- const t = new ve(e.clientX, e.clientY), n = this._lastPointerDown, i = n !== void 0 && e.timeStamp - n.time < Io && Math.abs(t.x - n.point.x) < Zt && Math.abs(t.y - n.point.y) < Zt;
4856
+ const t = new _e(e.clientX, e.clientY), n = this._lastPointerDown, i = n !== void 0 && e.timeStamp - n.time < Bo && Math.abs(t.x - n.point.x) < Zt && Math.abs(t.y - n.point.y) < Zt;
5016
4857
  if (this._clickCount = i ? this._clickCount + 1 : 1, this._lastPointerDown = { time: e.timeStamp, point: t }, !this._view.isPointInContent(t)) {
5017
4858
  this._model.selection.set(void 0, void 0);
5018
4859
  return;
5019
4860
  }
5020
4861
  const o = this._view.resolveOffsetFromPoint(t) ?? this._model.sourceText.get().value.length;
5021
4862
  if (this._clickCount === 2) {
5022
- const d = this._makeCursorContext();
5023
- this._model.selection.set(wi(d, o), void 0);
4863
+ const u = this._makeCursorContext();
4864
+ this._model.selection.set(wi(u, o), void 0);
5024
4865
  return;
5025
4866
  }
5026
4867
  if (this._clickCount === 3) {
5027
- const d = Bo(this._model.document.get(), o);
5028
- d && this._model.selection.set(ki(this._makeCursorContext(), d), void 0);
4868
+ const u = Io(this._model.document.get(), o);
4869
+ u && this._model.selection.set(ki(this._makeCursorContext(), u), void 0);
5029
4870
  return;
5030
4871
  }
4872
+ const r = this._clickCount === 1 && !e.shiftKey && this._model.readonlyMode.get();
5031
4873
  if (e.shiftKey) {
5032
- const d = this._model.selection.get() ?? x.collapsed(o);
5033
- this._model.selection.set(d.withActive(o), void 0);
4874
+ const u = this._model.selection.get() ?? b.collapsed(o);
4875
+ this._model.selection.set(u.withActive(o), void 0);
5034
4876
  } else
5035
- this._model.selection.set(x.collapsed(o), void 0);
5036
- const r = this._view.element, c = e.pointerId;
5037
- r.setPointerCapture(c), this._model.isSelecting.set(!0, void 0);
5038
- const a = (d) => {
5039
- const u = this._model.selection.get() ?? x.collapsed(o), f = this._view.resolveOffsetFromPoint(new ve(d.clientX, d.clientY)) ?? u.active;
5040
- this._model.selection.set(new x(u.anchor, f), void 0);
5041
- }, l = () => {
5042
- this._model.isSelecting.set(!1, void 0), r.removeEventListener("pointermove", a), r.removeEventListener("pointerup", l), r.removeEventListener("pointercancel", l), r.removeEventListener("lostpointercapture", l);
4877
+ this._model.selection.set(b.collapsed(o), void 0);
4878
+ const c = this._view.element, a = e.pointerId;
4879
+ c.setPointerCapture(a), this._model.isSelecting.set(!0, void 0);
4880
+ const l = (u) => {
4881
+ const f = this._model.selection.get() ?? b.collapsed(o), h = this._view.resolveOffsetFromPoint(new _e(u.clientX, u.clientY)) ?? f.active;
4882
+ this._model.selection.set(new b(f.anchor, h), void 0);
4883
+ }, d = () => {
4884
+ 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);
5043
4885
  };
5044
- r.addEventListener("pointermove", a), r.addEventListener("pointerup", l), r.addEventListener("pointercancel", l), r.addEventListener("lostpointercapture", l);
4886
+ c.addEventListener("pointermove", l), c.addEventListener("pointerup", d), c.addEventListener("pointercancel", d), c.addEventListener("lostpointercapture", d);
5045
4887
  };
5046
4888
  _makeCursorContext() {
5047
4889
  return {
5048
4890
  text: this._model.sourceText.get().value,
5049
- selection: this._model.selection.get() ?? x.collapsed(0),
4891
+ selection: this._model.selection.get() ?? b.collapsed(0),
5050
4892
  document: this._model.document.get(),
5051
4893
  activeBlock: this._model.activeBlock.get()
5052
4894
  };
@@ -5061,7 +4903,7 @@ class Ar extends W {
5061
4903
  _executeCursorCommand(e, t) {
5062
4904
  const n = this._makeCursorContext(), i = e(n), o = n.selection;
5063
4905
  this._model.selection.set(
5064
- t ? o.withActive(i) : x.collapsed(i),
4906
+ t ? o.withActive(i) : b.collapsed(i),
5065
4907
  void 0
5066
4908
  ), this._desiredColumn = void 0;
5067
4909
  }
@@ -5072,7 +4914,7 @@ class Ar extends W {
5072
4914
  _executeVisualCursorCommand(e, t) {
5073
4915
  const n = this._makeVisualCursorContext(), i = e(n);
5074
4916
  this._model.selection.set(
5075
- t ? n.selection.withActive(i.offset) : x.collapsed(i.offset),
4917
+ t ? n.selection.withActive(i.offset) : b.collapsed(i.offset),
5076
4918
  void 0
5077
4919
  ), this._desiredColumn = i.desiredColumn;
5078
4920
  }
@@ -5082,7 +4924,7 @@ class Ar extends W {
5082
4924
  }
5083
4925
  /** Move the cursor up one visual line (Arrow Up). */
5084
4926
  cursorUp(e = !1) {
5085
- this._executeVisualCursorCommand(St, e);
4927
+ this._executeVisualCursorCommand(Ot, e);
5086
4928
  }
5087
4929
  _selectedText() {
5088
4930
  const e = this._model.selection.get();
@@ -5109,7 +4951,7 @@ class Ar extends W {
5109
4951
  else if (e.key === "ArrowRight")
5110
4952
  e.preventDefault(), t ? this._executeCursorCommand(Zs, e.shiftKey) : e.shiftKey ? this._executeCursorCommand(Qs, !0) : this._executeCursorCommand(Us, !1);
5111
4953
  else if (e.key === "ArrowUp")
5112
- e.preventDefault(), this._executeVisualCursorCommand(St, e.shiftKey);
4954
+ e.preventDefault(), this._executeVisualCursorCommand(Ot, e.shiftKey);
5113
4955
  else if (e.key === "ArrowDown")
5114
4956
  e.preventDefault(), this._executeVisualCursorCommand(Tt, e.shiftKey);
5115
4957
  else if (e.key === "Home")
@@ -5120,7 +4962,7 @@ class Ar extends W {
5120
4962
  e.preventDefault();
5121
4963
  const n = this._makeCursorContext();
5122
4964
  this._model.selection.set(vi(n), void 0);
5123
- } else e.key === "Backspace" ? (e.preventDefault(), this._executeEditCommand(t ? ii : Ot)) : e.key === "Delete" ? (e.preventDefault(), this._executeEditCommand(t ? oi : si)) : e.key === "Enter" && (e.preventDefault(), t ? this._executeEditCommand(ci) : e.shiftKey ? this._executeEditCommand(li) : this._smartEnter());
4965
+ } else e.key === "Backspace" ? (e.preventDefault(), this._executeEditCommand(t ? ii : St)) : e.key === "Delete" ? (e.preventDefault(), this._executeEditCommand(t ? oi : si)) : e.key === "Enter" && (e.preventDefault(), t ? this._executeEditCommand(ci) : e.shiftKey ? this._executeEditCommand(li) : this._smartEnter());
5124
4966
  };
5125
4967
  /**
5126
4968
  * Context-aware Enter: splits / line-breaks via {@link insertSmartEnter}, or
@@ -5135,11 +4977,11 @@ class Ar extends W {
5135
4977
  }), this._desiredColumn = void 0;
5136
4978
  }
5137
4979
  }
5138
- function Bo(s, e) {
4980
+ function Io(s, e) {
5139
4981
  let t = 0;
5140
4982
  for (const n of s.children) {
5141
4983
  if (s.blocks.includes(n)) {
5142
- const i = _.ofStartAndLength(t, n.length);
4984
+ const i = v.ofStartAndLength(t, n.length);
5143
4985
  if (i.contains(e) || i.endExclusive === e)
5144
4986
  return i;
5145
4987
  }
@@ -5193,10 +5035,10 @@ class $r extends W {
5193
5035
  this._showLineRects.set(i.checked, void 0), Ao(Jt, i.checked);
5194
5036
  }), n.appendChild(i), n.appendChild(document.createTextNode("show line rects")), this.infoElement.appendChild(n);
5195
5037
  const o = document.createElement("pre");
5196
- o.style.margin = "0", o.style.whiteSpace = "pre", this.infoElement.appendChild(o), this.rendering = $(this, (r) => {
5038
+ o.style.margin = "0", o.style.whiteSpace = "pre", this.infoElement.appendChild(o), this.rendering = P(this, (r) => {
5197
5039
  const c = r.readObservable(t.model.measurements), a = r.readObservable(this._showLineRects);
5198
- return Po(this.overlayElement, o, this._overlayParent, c, a, t.colorForOffset, t.hoveredOffset);
5199
- }), this.mappedOffsets = $(this, (r) => r.readObservable(this.rendering).mappedOffsets), this._register(P((r) => {
5040
+ return $o(this.overlayElement, o, this._overlayParent, c, a, t.colorForOffset, t.hoveredOffset);
5041
+ }), this.mappedOffsets = P(this, (r) => r.readObservable(this.rendering).mappedOffsets), this._register($((r) => {
5200
5042
  r.readObservable(this.rendering);
5201
5043
  const c = t.hoveredOffset ? r.readObservable(t.hoveredOffset) : void 0;
5202
5044
  t.hoveredOffset && Ho(this.overlayElement, c);
@@ -5210,12 +5052,12 @@ class $r extends W {
5210
5052
  /** Whether the dashed line-bands and run boxes are drawn (persisted). */
5211
5053
  _showLineRects = N(this, Do(Jt, !0));
5212
5054
  }
5213
- class $o {
5055
+ class Po {
5214
5056
  constructor(e, t, n, i) {
5215
5057
  this.blockCount = e, this.mountedCount = t, this.lineCount = n, this.mappedOffsets = i;
5216
5058
  }
5217
5059
  }
5218
- function Po(s, e, t, n, i, o, r) {
5060
+ function $o(s, e, t, n, i, o, r) {
5219
5061
  s.textContent = "";
5220
5062
  const c = t.getBoundingClientRect();
5221
5063
  let a = 0, l = 0, d = 0;
@@ -5234,14 +5076,14 @@ function Po(s, e, t, n, i, o, r) {
5234
5076
  border: "1px dashed rgba(180, 0, 200, 0.45)",
5235
5077
  boxSizing: "border-box"
5236
5078
  }), s.appendChild(E);
5237
- for (const v of w.runs) {
5079
+ for (const _ of w.runs) {
5238
5080
  const C = document.createElement("div");
5239
5081
  Object.assign(C.style, {
5240
5082
  position: "absolute",
5241
- left: `${v.rect.x - c.left}px`,
5242
- top: `${v.rect.y - c.top}px`,
5243
- width: `${v.rect.width}px`,
5244
- height: `${v.rect.height}px`,
5083
+ left: `${_.rect.x - c.left}px`,
5084
+ top: `${_.rect.y - c.top}px`,
5085
+ width: `${_.rect.width}px`,
5086
+ height: `${_.rect.height}px`,
5245
5087
  outline: "1px solid rgba(255, 100, 0, 0.45)",
5246
5088
  boxSizing: "border-box"
5247
5089
  }), s.appendChild(C);
@@ -5254,7 +5096,7 @@ function Po(s, e, t, n, i, o, r) {
5254
5096
  return `${String(m).padStart(2)} ${p} start=${String(g.absoluteStart).padStart(4)} h=${g.height.toFixed(1).padStart(6)} lines=${k} kind=${g.block.kind}`;
5255
5097
  });
5256
5098
  return e.textContent = [f, ...h].join(`
5257
- `), new $o(n.length, a, l, u);
5099
+ `), new Po(n.length, a, l, u);
5258
5100
  }
5259
5101
  function Vo(s, e, t, n, i, o, r) {
5260
5102
  let c = 0;
@@ -5301,7 +5143,7 @@ function en(s, e, t) {
5301
5143
  for (const n of Array.from(s.children))
5302
5144
  n.style.visibility = t && n !== e ? "hidden" : "";
5303
5145
  }
5304
- class Ce {
5146
+ class Ee {
5305
5147
  constructor(e, t) {
5306
5148
  this.length = e, this.className = t;
5307
5149
  }
@@ -5329,7 +5171,7 @@ class Fo {
5329
5171
  if (t === void 0)
5330
5172
  return;
5331
5173
  let n = this._tokenizers.get(e);
5332
- return n || (n = new this._monaco.MonarchTokenizer(Go, jo, e, this._monaco.compile(e, t), Uo), this._tokenizers.set(e, n)), n;
5174
+ return n || (n = new this._monaco.MonarchTokenizer(qo, jo, e, this._monaco.compile(e, t), Uo), this._tokenizers.set(e, n)), n;
5333
5175
  }
5334
5176
  }
5335
5177
  class Ko {
@@ -5356,7 +5198,7 @@ class Ko {
5356
5198
  const n = nn(this._lines), i = e.apply(this._text), o = e.replacements[0].replaceRange.start, r = this._lineIndexAt(o), c = this._lines.slice(0, r), a = r === 0 ? this._initialState : this._lines[r - 1].endState;
5357
5199
  this._text = i, this._lines = this._tokenizeFrom(r, c, a, i.split(`
5358
5200
  `)), this._lineStarts = this._computeLineStarts(), this._version++;
5359
- const l = qo(n, nn(this._lines));
5201
+ const l = Go(n, nn(this._lines));
5360
5202
  this._snapshotObs.set(new tn(this, this._version), t, l);
5361
5203
  }
5362
5204
  dispose() {
@@ -5376,7 +5218,7 @@ class Ko {
5376
5218
  const d = this._tokenizer.tokenize(a, l, r);
5377
5219
  o.push({ text: a, tokens: zo(d.tokens, a.length), endState: d.endState }), r = d.endState;
5378
5220
  } else
5379
- o.push({ text: a, tokens: a.length === 0 ? [] : [new Ce(a.length, void 0)], endState: r });
5221
+ o.push({ text: a, tokens: a.length === 0 ? [] : [new Ee(a.length, void 0)], endState: r });
5380
5222
  }
5381
5223
  return o;
5382
5224
  }
@@ -5401,14 +5243,14 @@ class Ko {
5401
5243
  let c = i, a = i, l = !1, d = 0;
5402
5244
  const u = (f, h) => {
5403
5245
  const g = d, m = d + f;
5404
- d = m, f !== 0 && g < o && m > i && (l || (c = g, l = !0), r.push(new Ce(f, h)), a = m);
5246
+ d = m, f !== 0 && g < o && m > i && (l || (c = g, l = !0), r.push(new Ee(f, h)), a = m);
5405
5247
  };
5406
5248
  for (let f = 0; f < this._lines.length && d < o; f++) {
5407
5249
  for (const h of this._lines[f].tokens)
5408
5250
  u(h.length, h.className);
5409
5251
  f < this._lines.length - 1 && u(1, void 0);
5410
5252
  }
5411
- return { range: new _(c, l ? a : i), tokens: r };
5253
+ return { range: new v(c, l ? a : i), tokens: r };
5412
5254
  }
5413
5255
  }
5414
5256
  class tn {
@@ -5424,11 +5266,11 @@ function Wo(s) {
5424
5266
  }
5425
5267
  function zo(s, e) {
5426
5268
  if (s.length === 0)
5427
- return e === 0 ? [] : [new Ce(e, void 0)];
5269
+ return e === 0 ? [] : [new Ee(e, void 0)];
5428
5270
  const t = [];
5429
5271
  for (let n = 0; n < s.length; n++) {
5430
5272
  const i = s[n].offset, o = n + 1 < s.length ? s[n + 1].offset : e;
5431
- o > i && t.push(new Ce(o - i, Wo(s[n].type)));
5273
+ o > i && t.push(new Ee(o - i, Wo(s[n].type)));
5432
5274
  }
5433
5275
  return t;
5434
5276
  }
@@ -5437,7 +5279,7 @@ function nn(s) {
5437
5279
  for (let t = 0; t < s.length; t++) {
5438
5280
  for (const n of s[t].tokens)
5439
5281
  e.push(n);
5440
- t < s.length - 1 && e.push(new Ce(1, void 0));
5282
+ t < s.length - 1 && e.push(new Ee(1, void 0));
5441
5283
  }
5442
5284
  return e;
5443
5285
  }
@@ -5450,7 +5292,7 @@ function on(s) {
5450
5292
  e += t.length;
5451
5293
  return e;
5452
5294
  }
5453
- function qo(s, e) {
5295
+ function Go(s, e) {
5454
5296
  const t = s.length, n = e.length;
5455
5297
  let i = 0, o = 0;
5456
5298
  for (; i < t && i < n && sn(s[i], e[i]); )
@@ -5458,10 +5300,10 @@ function qo(s, e) {
5458
5300
  let r = 0, c = 0;
5459
5301
  for (; r < t - i && r < n - i && sn(s[t - 1 - r], e[n - 1 - r]); )
5460
5302
  c += s[t - 1 - r].length, r++;
5461
- const a = on(s), l = on(e), d = new _(o, a - c), u = l - c - o;
5462
- return d.isEmpty && u === 0 ? me.empty : me.replace(d, u);
5303
+ const a = on(s), l = on(e), d = new v(o, a - c), u = l - c - o;
5304
+ return d.isEmpty && u === 0 ? ge.empty : ge.replace(d, u);
5463
5305
  }
5464
- const Go = {
5306
+ const qo = {
5465
5307
  languageIdCodec: { encodeLanguageId: () => 0, decodeLanguageId: () => "" },
5466
5308
  isRegisteredLanguageId: () => !1,
5467
5309
  getLanguageIdByLanguageName: () => null,
@@ -5475,7 +5317,7 @@ const Go = {
5475
5317
  onDidChangeConfiguration: () => ({ dispose() {
5476
5318
  } })
5477
5319
  };
5478
- function Pr(s, e) {
5320
+ function Vr(s, e) {
5479
5321
  const t = /* @__PURE__ */ new Map([
5480
5322
  ["typescript", e.typescript],
5481
5323
  ["ts", e.typescript],
@@ -5516,7 +5358,7 @@ class Qo extends W {
5516
5358
  };
5517
5359
  this._textarea.addEventListener("keydown", o), this._register({ dispose: () => this._textarea.removeEventListener("keydown", o) });
5518
5360
  const r = () => this._submit();
5519
- this._submitButton.addEventListener("click", r), this._register({ dispose: () => this._submitButton.removeEventListener("click", r) }), this._register(P((c) => {
5361
+ this._submitButton.addEventListener("click", r), this._register({ dispose: () => this._submitButton.removeEventListener("click", r) }), this._register($((c) => {
5520
5362
  const a = this._value.read(c).trim().length > 0;
5521
5363
  this._submitButton.disabled = !a, this.element.classList.toggle("md-comment-input-empty", !a);
5522
5364
  })), this._autoSize();
@@ -5561,7 +5403,7 @@ class Qo extends W {
5561
5403
  r > 0 && (this._textarea.style.height = `${r}px`), this._options?.onDidChangeSize?.();
5562
5404
  }
5563
5405
  }
5564
- class Vr extends W {
5406
+ class Hr extends W {
5565
5407
  constructor(e, t, n) {
5566
5408
  super(), this._model = e, this._view = t, this._options = n, this._gap = n?.gap ?? 8, this._widget = this._register(new Qo({
5567
5409
  onDidChangeSize: () => {
@@ -5575,7 +5417,7 @@ class Vr extends W {
5575
5417
  const o = new ResizeObserver(() => {
5576
5418
  this._visible && this._layoutHorizontally();
5577
5419
  });
5578
- o.observe(i), o.observe(this._view.overlayContainer), this._register({ dispose: () => o.disconnect() }), this._register(P((d) => this._update(d)));
5420
+ o.observe(i), o.observe(this._view.overlayContainer), this._register({ dispose: () => o.disconnect() }), this._register($((d) => this._update(d)));
5579
5421
  const r = this._view.element.ownerDocument, c = () => {
5580
5422
  this._view.element.classList.add("md-comment-active");
5581
5423
  };
@@ -5681,7 +5523,7 @@ class Vr extends W {
5681
5523
  this._submittedRange = t, this._hideAndRefocus(), t && this._options?.onSubmit?.({ text: e, range: t });
5682
5524
  }
5683
5525
  }
5684
- class Hr {
5526
+ class Fr {
5685
5527
  _comments = N(this, []);
5686
5528
  /** Monotonic counter for ids of comments created via {@link create}. */
5687
5529
  _sequence = 0;
@@ -5722,7 +5564,7 @@ class Hr {
5722
5564
  this._comments.set(this._comments.get().filter((t) => t.id !== e), void 0);
5723
5565
  }
5724
5566
  }
5725
- const De = "http://www.w3.org/2000/svg", Yo = 260, Zo = 320, Jo = 0.32, er = 28, rn = 16, tr = 12, nr = 18, sr = 4, ir = 2, or = 10;
5567
+ const Ie = "http://www.w3.org/2000/svg", Yo = 260, Zo = 320, Jo = 0.32, er = 28, rn = 16, tr = 12, nr = 18, sr = 4, ir = 2, or = 10;
5726
5568
  class rr extends W {
5727
5569
  constructor(e, t) {
5728
5570
  super(), this._model = e, this._view = t, this._layer = this._createLayer("md-comment-shapes"), this._view.overlayContainer.appendChild(this._layer), this._register({
@@ -5732,12 +5574,12 @@ class rr extends W {
5732
5574
  this._disposeEntry(n);
5733
5575
  this._entries.clear(), this._view.element.style.paddingRight = "";
5734
5576
  }
5735
- }), this._register(P((n) => this._update(n)));
5577
+ }), this._register($((n) => this._update(n)));
5736
5578
  }
5737
5579
  _layer;
5738
5580
  _entries = /* @__PURE__ */ new Map();
5739
5581
  _createLayer(e) {
5740
- const t = document.createElementNS(De, "svg");
5582
+ const t = document.createElementNS(Ie, "svg");
5741
5583
  return t.setAttribute("class", e), t;
5742
5584
  }
5743
5585
  _update(e) {
@@ -5765,11 +5607,11 @@ class rr extends W {
5765
5607
  t.has(n) || (this._disposeEntry(i), this._entries.delete(n));
5766
5608
  }
5767
5609
  _createEntry(e) {
5768
- const t = document.createElementNS(De, "g");
5610
+ const t = document.createElementNS(Ie, "g");
5769
5611
  t.setAttribute("class", "md-comment-group"), this._layer.appendChild(t);
5770
- const n = document.createElementNS(De, "path");
5612
+ const n = document.createElementNS(Ie, "path");
5771
5613
  n.setAttribute("class", "md-comment-leader-path"), t.appendChild(n);
5772
- const i = document.createElementNS(De, "path");
5614
+ const i = document.createElementNS(Ie, "path");
5773
5615
  i.setAttribute("class", "md-comment-shape-path"), t.appendChild(i);
5774
5616
  const o = document.createElement("div");
5775
5617
  o.className = "md-comment-card";
@@ -5825,18 +5667,18 @@ class rr extends W {
5825
5667
  this._layer.style.display = "";
5826
5668
  const i = t.getBoundingClientRect(), o = i.width, r = getComputedStyle(n), c = parseFloat(r.maxWidth), a = (parseFloat(r.paddingLeft) || 0) + (parseFloat(r.paddingRight) || 0), l = (parseFloat(r.borderLeftWidth) || 0) + (parseFloat(r.borderRightWidth) || 0), d = Number.isNaN(c) ? o : r.boxSizing === "border-box" ? c : c + a + l, u = Math.max(0, (o - Math.min(d, o)) / 2), f = Math.round(Math.max(Yo, Math.min(Zo, o * Jo))), h = f + er + rn, g = u >= h ? 0 : Math.min(2 * (h - u), h), m = g > 0 ? `${Math.ceil(g)}px` : "";
5827
5669
  t.style.paddingRight !== m && (t.style.paddingRight = m);
5828
- const p = n.getBoundingClientRect(), k = i.right - rn - f - p.left, w = n.clientWidth, y = e.map(({ entry: v, rects: C }) => {
5829
- v.card.style.left = `${k}px`, v.card.style.width = `${f}px`;
5830
- const B = cr(C), K = C.length > 0 ? Math.min(...C.map((ue) => ue.y)) : 0;
5831
- return { entry: v, rects: C, anchor: B, desiredTop: K };
5670
+ const p = n.getBoundingClientRect(), k = i.right - rn - f - p.left, w = n.clientWidth, y = e.map(({ entry: _, rects: C }) => {
5671
+ _.card.style.left = `${k}px`, _.card.style.width = `${f}px`;
5672
+ const I = cr(C), K = C.length > 0 ? Math.min(...C.map((he) => he.y)) : 0;
5673
+ return { entry: _, rects: C, anchor: I, desiredTop: K };
5832
5674
  });
5833
- y.sort((v, C) => v.desiredTop - C.desiredTop);
5675
+ y.sort((_, C) => _.desiredTop - C.desiredTop);
5834
5676
  let E = -1 / 0;
5835
- for (const v of y) {
5836
- const C = Math.max(v.desiredTop, E + tr);
5837
- v.entry.card.style.top = `${C}px`;
5838
- const B = v.entry.card.offsetHeight;
5839
- E = C + B, v.entry.shapePath.setAttribute("d", Wn(v.rects, sr)), v.entry.leaderPath.setAttribute("d", v.anchor ? ar(v.anchor, w, { x: k, y: C + nr }) : "");
5677
+ for (const _ of y) {
5678
+ const C = Math.max(_.desiredTop, E + tr);
5679
+ _.entry.card.style.top = `${C}px`;
5680
+ const I = _.entry.card.offsetHeight;
5681
+ E = C + I, _.entry.shapePath.setAttribute("d", Wn(_.rects, sr)), _.entry.leaderPath.setAttribute("d", _.anchor ? ar(_.anchor, w, { x: k, y: C + nr }) : "");
5840
5682
  }
5841
5683
  }
5842
5684
  _applyHover(e) {
@@ -5903,7 +5745,7 @@ class zn extends W {
5903
5745
  o.widget.dispose();
5904
5746
  this._entries.clear(), this._layer.remove();
5905
5747
  }
5906
- }), this._register(P((o) => {
5748
+ }), this._register($((o) => {
5907
5749
  const r = this.model.comments.read(o);
5908
5750
  this._reconcile(r);
5909
5751
  for (const c of r)
@@ -5938,22 +5780,22 @@ function L(s) {
5938
5780
  const e = gr.exec(s)?.[1] ?? "div", t = document.createElement(e), n = s.slice(e.length).split(".").filter(Boolean);
5939
5781
  return n.length && (t.className = n.join(" ")), t;
5940
5782
  }
5941
- function fe(s) {
5783
+ function ue(s) {
5942
5784
  return `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s}</svg>`;
5943
5785
  }
5944
- const qn = {
5945
- comment: fe('<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>'),
5946
- "comment-discussion": fe('<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path>'),
5947
- "chevron-down": fe('<polyline points="6 9 12 15 18 9"></polyline>'),
5948
- "chevron-up": fe('<polyline points="18 15 12 9 6 15"></polyline>'),
5949
- edit: fe('<path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>'),
5950
- close: fe('<line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>')
5786
+ const Gn = {
5787
+ comment: ue('<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>'),
5788
+ "comment-discussion": ue('<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path>'),
5789
+ "chevron-down": ue('<polyline points="6 9 12 15 18 9"></polyline>'),
5790
+ "chevron-up": ue('<polyline points="18 15 12 9 6 15"></polyline>'),
5791
+ edit: ue('<path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>'),
5792
+ close: ue('<line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line>')
5951
5793
  };
5952
- function Ze(s) {
5794
+ function Ye(s) {
5953
5795
  const e = L(`span.codicon.codicon-${s}`);
5954
- return e.setAttribute("aria-hidden", "true"), e.innerHTML = qn[s] ?? "", e;
5796
+ return e.setAttribute("aria-hidden", "true"), e.innerHTML = Gn[s] ?? "", e;
5955
5797
  }
5956
- function Ae(s) {
5798
+ function De(s) {
5957
5799
  const e = L("div.rendered-markdown"), t = document.createElement("p");
5958
5800
  for (const n of s.split(/(`[^`]+`)/g))
5959
5801
  if (/^`[^`]+`$/.test(n)) {
@@ -5964,7 +5806,7 @@ function Ae(s) {
5964
5806
  }
5965
5807
  class mr {
5966
5808
  constructor(e, t) {
5967
- this._comments = e, this._domNode = L("div.agent-feedback-widget"), this._domNode.classList.add("collapsed"), this._domNode.tabIndex = -1, this._domNode.setAttribute("widgetid", "agent-feedback-widget-0"), this._headerNode = L("div.agent-feedback-widget-header"), this._headerNode.appendChild(Ze("comment")), this._titleNode = L("span.agent-feedback-widget-title"), this._updateTitle(), this._headerNode.appendChild(this._titleNode), this._headerNode.appendChild(L("span.agent-feedback-widget-spacer")), this._toggleButton = L("div.agent-feedback-widget-toggle"), this._updateToggleButton(), this._headerNode.appendChild(this._toggleButton), this._domNode.appendChild(this._headerNode), this._bodyNode = L("div.agent-feedback-widget-body"), this._bodyNode.classList.add("collapsed"), this._buildFeedbackItems(), this._domNode.appendChild(this._bodyNode), this._domNode.appendChild(L("div.agent-feedback-widget-arrow")), this._setupEventHandlers(), this._domNode.classList.add("visible"), t?.expanded && this.expand(), t?.focusedCommentId && this.focusFeedback(t.focusedCommentId);
5809
+ this._comments = e, this._domNode = L("div.agent-feedback-widget"), this._domNode.classList.add("collapsed"), this._domNode.tabIndex = -1, this._domNode.setAttribute("widgetid", "agent-feedback-widget-0"), this._headerNode = L("div.agent-feedback-widget-header"), this._headerNode.appendChild(Ye("comment")), this._titleNode = L("span.agent-feedback-widget-title"), this._updateTitle(), this._headerNode.appendChild(this._titleNode), this._headerNode.appendChild(L("span.agent-feedback-widget-spacer")), this._toggleButton = L("div.agent-feedback-widget-toggle"), this._updateToggleButton(), this._headerNode.appendChild(this._toggleButton), this._domNode.appendChild(this._headerNode), this._bodyNode = L("div.agent-feedback-widget-body"), this._bodyNode.classList.add("collapsed"), this._buildFeedbackItems(), this._domNode.appendChild(this._bodyNode), this._domNode.appendChild(L("div.agent-feedback-widget-arrow")), this._setupEventHandlers(), this._domNode.classList.add("visible"), t?.expanded && this.expand(), t?.focusedCommentId && this.focusFeedback(t.focusedCommentId);
5968
5810
  }
5969
5811
  _domNode;
5970
5812
  _headerNode;
@@ -5984,7 +5826,7 @@ class mr {
5984
5826
  this._titleNode.textContent = e === 1 ? this._comments[0].text : `${e} comments`;
5985
5827
  }
5986
5828
  _updateToggleButton() {
5987
- this._toggleButton.textContent = "", this._isExpanded ? (this._toggleButton.appendChild(Ze("chevron-up")), this._toggleButton.title = "Collapse") : (this._toggleButton.appendChild(Ze("chevron-down")), this._toggleButton.title = "Expand");
5829
+ this._toggleButton.textContent = "", this._isExpanded ? (this._toggleButton.appendChild(Ye("chevron-up")), this._toggleButton.title = "Collapse") : (this._toggleButton.appendChild(Ye("chevron-down")), this._toggleButton.title = "Expand");
5988
5830
  }
5989
5831
  _setupEventHandlers() {
5990
5832
  this._listen(this._toggleButton, "click", (e) => {
@@ -6009,7 +5851,7 @@ class mr {
6009
5851
  }
6010
5852
  n.appendChild(i);
6011
5853
  const c = L("div.agent-feedback-widget-text"), a = this._buildItemActions(e, t, c);
6012
- n.appendChild(a.container), t.appendChild(n), c.appendChild(Ae(e.text)), t.appendChild(c), e.suggestion?.edits.length && t.appendChild(this._renderSuggestion(e)), e.replies?.length && t.appendChild(this._renderReplies(e.replies)), this._listen(t, "click", (l) => {
5854
+ n.appendChild(a.container), t.appendChild(n), c.appendChild(De(e.text)), t.appendChild(c), e.suggestion?.edits.length && t.appendChild(this._renderSuggestion(e)), e.replies?.length && t.appendChild(this._renderReplies(e.replies)), this._listen(t, "click", (l) => {
6013
5855
  const d = l.target;
6014
5856
  if (!(d?.closest(".monaco-action-bar") || d?.closest(".agent-feedback-widget-add-reply"))) {
6015
5857
  if (d?.closest(".agent-feedback-widget-text, .agent-feedback-widget-suggestion-text, .agent-feedback-widget-reply-text")) {
@@ -6049,7 +5891,7 @@ class mr {
6049
5891
  }
6050
5892
  _actionLabel(e, t) {
6051
5893
  const n = document.createElement("a");
6052
- return n.className = `action-label codicon codicon-${e}`, n.setAttribute("role", "button"), n.setAttribute("aria-label", t), n.title = t, n.tabIndex = 0, n.innerHTML = qn[e] ?? "", n;
5894
+ return n.className = `action-label codicon codicon-${e}`, n.setAttribute("role", "button"), n.setAttribute("aria-label", t), n.title = t, n.tabIndex = 0, n.innerHTML = Gn[e] ?? "", n;
6053
5895
  }
6054
5896
  _lineLabel(e, t) {
6055
5897
  return t === void 0 || t === e ? `Line ${e}` : `Lines ${e}-${t}`;
@@ -6078,7 +5920,7 @@ class mr {
6078
5920
  const t = L("div.agent-feedback-widget-replies");
6079
5921
  for (const n of e) {
6080
5922
  const i = L("div.agent-feedback-widget-reply"), o = L("div.agent-feedback-widget-reply-text");
6081
- o.appendChild(Ae(n)), i.appendChild(o), t.appendChild(i);
5923
+ o.appendChild(De(n)), i.appendChild(o), t.appendChild(i);
6082
5924
  }
6083
5925
  return t;
6084
5926
  }
@@ -6103,7 +5945,7 @@ class mr {
6103
5945
  if (a.key === "Enter" && !a.shiftKey) {
6104
5946
  a.preventDefault(), a.stopPropagation();
6105
5947
  const l = o.value.trim();
6106
- t.classList.remove("editing"), t.textContent = "", t.appendChild(Ae(l || e.text)), n.setEnabled(!0);
5948
+ t.classList.remove("editing"), t.textContent = "", t.appendChild(De(l || e.text)), n.setEnabled(!0);
6107
5949
  } else a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), c());
6108
5950
  }), this._listen(o, "blur", c), o.focus();
6109
5951
  }
@@ -6130,7 +5972,7 @@ class mr {
6130
5972
  let d = t.querySelector(".agent-feedback-widget-replies");
6131
5973
  d || (d = this._renderReplies([]), t.insertBefore(d, i));
6132
5974
  const u = L("div.agent-feedback-widget-reply"), f = L("div.agent-feedback-widget-reply-text");
6133
- f.appendChild(Ae(l)), u.appendChild(f), d.appendChild(u);
5975
+ f.appendChild(De(l)), u.appendChild(f), d.appendChild(u);
6134
5976
  }
6135
5977
  c();
6136
5978
  } else a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), c());
@@ -6175,7 +6017,7 @@ class pr extends zn {
6175
6017
  }
6176
6018
  }
6177
6019
  const _r = /^([a-z0-9]+)/i;
6178
- function ge(s) {
6020
+ function fe(s) {
6179
6021
  const e = _r.exec(s)?.[1] ?? "div", t = document.createElement(e), n = s.slice(e.length).split(".").filter(Boolean);
6180
6022
  return n.length && (t.className = n.join(" ")), t;
6181
6023
  }
@@ -6207,12 +6049,12 @@ class kr {
6207
6049
  return this._state === "expanded";
6208
6050
  }
6209
6051
  constructor(e) {
6210
- this._state = e.state ?? "short", this._onToggle = e.onToggle, this._domNode = ge("div.vscode-comment-widget-v2");
6211
- const t = ge("div.vscode-comment-widget-v2-header"), n = ge("div.vscode-comment-widget-v2-title-group"), i = ge("span.vscode-comment-widget-v2-username");
6052
+ this._state = e.state ?? "short", this._onToggle = e.onToggle, this._domNode = fe("div.vscode-comment-widget-v2");
6053
+ const t = fe("div.vscode-comment-widget-v2-header"), n = fe("div.vscode-comment-widget-v2-title-group"), i = fe("span.vscode-comment-widget-v2-username");
6212
6054
  i.textContent = e.username, n.appendChild(i), t.appendChild(n);
6213
- const o = ge("div.vscode-comment-widget-v2-actions");
6055
+ const o = fe("div.vscode-comment-widget-v2-actions");
6214
6056
  e.onEdit && o.appendChild(this._actionButton("edit", "Edit", e.onEdit)), e.onDelete && o.appendChild(this._actionButton("trash", "Delete", e.onDelete)), t.appendChild(o), this._domNode.appendChild(t);
6215
- const r = ge("div.vscode-comment-widget-v2-body");
6057
+ const r = fe("div.vscode-comment-widget-v2-body");
6216
6058
  if (this._textNode = document.createElement("p"), this._textNode.className = "vscode-comment-widget-v2-text", this._textNode.textContent = e.body, r.appendChild(this._textNode), this._state !== "short") {
6217
6059
  const c = document.createElement("button");
6218
6060
  c.type = "button", c.className = "vscode-comment-widget-v2-toggle", c.addEventListener("click", this._onToggleClick), this._toggleNode = c, r.appendChild(c);
@@ -6240,93 +6082,93 @@ class kr {
6240
6082
  this._domNode.remove();
6241
6083
  }
6242
6084
  }
6243
- const xr = 80;
6244
- class br extends zn {
6085
+ const br = 80;
6086
+ class xr extends zn {
6245
6087
  createWidget(e) {
6246
6088
  return new kr({
6247
6089
  username: e.author ?? "You",
6248
6090
  body: e.body,
6249
- state: e.body.length > xr ? "collapsed" : "short",
6091
+ state: e.body.length > br ? "collapsed" : "short",
6250
6092
  // Edit is intentionally omitted (hidden) for now. Delete removes the
6251
6093
  // comment from the shared model; the autorun then disposes the card.
6252
6094
  onDelete: () => this.model.remove(e.id)
6253
6095
  });
6254
6096
  }
6255
6097
  }
6256
- const Fr = {
6098
+ const Kr = {
6257
6099
  connected: "Connected lines (original)",
6258
6100
  vscode: "VS Code cards",
6259
6101
  "vscode-v2": "Markdown cards (V2)"
6260
- }, Kr = {
6102
+ }, Wr = {
6261
6103
  connected: (s, e) => new rr(s, e),
6262
6104
  vscode: (s, e, t) => new pr(s, e, t),
6263
- "vscode-v2": (s, e, t) => new br(s, e, t)
6105
+ "vscode-v2": (s, e, t) => new xr(s, e, t)
6264
6106
  };
6265
6107
  export {
6266
6108
  F as AstNode,
6267
- Dr as AsyncClipboardStrategy,
6268
- we as BlockQuoteAstNode,
6109
+ Ar as AsyncClipboardStrategy,
6110
+ ve as BlockQuoteAstNode,
6269
6111
  O as BlockViewNode,
6270
- Kr as COMMENTS_DESIGNS,
6271
- Fr as COMMENTS_DESIGN_LABELS,
6112
+ Wr as COMMENTS_DESIGNS,
6113
+ Kr as COMMENTS_DESIGN_LABELS,
6272
6114
  G as CodeBlockAstNode,
6273
6115
  _t as CodeBlockViewNode,
6274
6116
  Qo as CommentInputWidget,
6275
- Vr as CommentModeController,
6276
- Hr as CommentsModel,
6117
+ Hr as CommentModeController,
6118
+ Fr as CommentsModel,
6277
6119
  rr as CommentsView,
6278
6120
  Lo as CursorView,
6279
6121
  Be as CursorViewRendering,
6280
6122
  ht as DocumentAstNode,
6281
6123
  wt as DocumentViewNode,
6282
- Ar as EditorController,
6124
+ Pr as EditorController,
6283
6125
  Ir as EditorModel,
6284
- Br as EditorView,
6126
+ Dr as EditorView,
6285
6127
  ct as EmphasisAstNode,
6286
6128
  H as GlueAstNode,
6287
- oe as HeadingAstNode,
6288
- Te as ImageAstNode,
6129
+ ie as HeadingAstNode,
6130
+ Le as ImageAstNode,
6289
6131
  lt as InlineCodeAstNode,
6290
6132
  dt as InlineMathAstNode,
6291
- me as LengthEdit,
6133
+ ge as LengthEdit,
6292
6134
  ot as LengthReplacement,
6293
- Le as LinkAstNode,
6294
- J as ListAstNode,
6295
- ee as ListItemAstNode,
6135
+ Ce as LinkAstNode,
6136
+ Z as ListAstNode,
6137
+ J as ListItemAstNode,
6296
6138
  ws as MarkdownParser,
6297
- b as MarkerAstNode,
6298
- he as MathBlockAstNode,
6299
- $o as MeasuredLayoutDebugRendering,
6139
+ x as MarkerAstNode,
6140
+ de as MathBlockAstNode,
6141
+ Po as MeasuredLayoutDebugRendering,
6300
6142
  $r as MeasuredLayoutDebugView,
6301
6143
  Ws as MeasuredLayoutModel,
6302
6144
  Fo as MonacoSyntaxHighlighter,
6303
6145
  Ro as NativeClipboardStrategy,
6304
- _ as OffsetRange,
6305
- Z as ParagraphAstNode,
6306
- ve as Point2D,
6146
+ v as OffsetRange,
6147
+ Y as ParagraphAstNode,
6148
+ _e as Point2D,
6307
6149
  V as Rect2D,
6308
- x as Selection,
6150
+ b as Selection,
6309
6151
  wo as SelectionView,
6310
6152
  Qt as SelectionViewRendering,
6311
6153
  zn as StackedCommentsPresenter,
6312
6154
  at as StrikethroughAstNode,
6313
- T as StringEdit,
6314
- z as StringReplacement,
6315
- Me as StringValue,
6155
+ S as StringEdit,
6156
+ it as StringReplacement,
6157
+ Se as StringValue,
6316
6158
  rt as StrongAstNode,
6317
- ke as TableAstNode,
6318
- Ee as TableCellAstNode,
6319
- ye as TableRowAstNode,
6159
+ we as TableAstNode,
6160
+ ye as TableCellAstNode,
6161
+ xe as TableRowAstNode,
6320
6162
  be as TextAstNode,
6321
- le as ThematicBreakAstNode,
6322
- Ce as Token,
6323
- ne as ViewNode,
6163
+ ae as ThematicBreakAstNode,
6164
+ Ee as Token,
6165
+ te as ViewNode,
6324
6166
  As as VisualLine,
6325
- Se as VisualLineMap,
6326
- et as VisualRun,
6327
- br as VsCodeV2CommentsView,
6167
+ Te as VisualLineMap,
6168
+ Je as VisualRun,
6169
+ xr as VsCodeV2CommentsView,
6328
6170
  pr as VscodeStackedCommentsView,
6329
- Pr as createDefaultMonacoSyntaxHighlighter,
6171
+ Vr as createDefaultMonacoSyntaxHighlighter,
6330
6172
  ni as cursorDocumentEnd,
6331
6173
  ti as cursorDocumentStart,
6332
6174
  Tt as cursorDown,
@@ -6336,10 +6178,10 @@ export {
6336
6178
  Ys as cursorMoveLeft,
6337
6179
  Qs as cursorMoveRight,
6338
6180
  Us as cursorRight,
6339
- St as cursorUp,
6181
+ Ot as cursorUp,
6340
6182
  Lt as cursorWordLeft,
6341
6183
  Zs as cursorWordRight,
6342
- Ot as deleteLeft,
6184
+ St as deleteLeft,
6343
6185
  si as deleteRight,
6344
6186
  ii as deleteWordLeft,
6345
6187
  oi as deleteWordRight,
@@ -6357,7 +6199,7 @@ export {
6357
6199
  vi as selectAll,
6358
6200
  ki as selectBlock,
6359
6201
  wi as selectWord,
6360
- Nr as taskCheckboxRange,
6361
- Rr as visualizeAst
6202
+ Rr as taskCheckboxRange,
6203
+ Br as visualizeAst
6362
6204
  };
6363
6205
  //# sourceMappingURL=index.js.map