@vscode/markdown-editor 0.0.2-125 → 0.0.2-126
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 +432 -420
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { commands as
|
|
2
|
-
import { O as v, S as
|
|
1
|
+
import { commands as fn } from "./commands.js";
|
|
2
|
+
import { O as v, S as L, a as _e, c as pi } from "./stringEdit-CVDbCUBY.js";
|
|
3
3
|
import gi from "katex";
|
|
4
|
-
import { observableValue as x, derived as I, transaction as K, Disposable as W, runOnChange as
|
|
5
|
-
import { D as Fo, f as Vo, a as Wo, b as $o, c as Ho, d as _i, i as
|
|
4
|
+
import { observableValue as x, derived as I, transaction as K, Disposable as W, runOnChange as mn, autorun as M, constObservable as $n } from "@vscode/observables";
|
|
5
|
+
import { D as Fo, f as Vo, a as Wo, b as $o, c as Ho, d as _i, i as tt } from "./config-BGeaJqWk.js";
|
|
6
6
|
import { e as kh } from "./config-BGeaJqWk.js";
|
|
7
7
|
import { decodeHTMLAttribute as Hn } from "entities/decode";
|
|
8
8
|
import { decodeString as Ko } from "micromark-util-decode-string";
|
|
@@ -14,13 +14,13 @@ import { gfmTaskListItem as jo } from "micromark-extension-gfm-task-list-item";
|
|
|
14
14
|
import { gfmStrikethrough as Yo } from "micromark-extension-gfm-strikethrough";
|
|
15
15
|
import { gfmAutolinkLiteral as Zo } from "micromark-extension-gfm-autolink-literal";
|
|
16
16
|
import { createDiffComputer as Jo } from "@vscode/diff";
|
|
17
|
-
class
|
|
17
|
+
class pn {
|
|
18
18
|
constructor(e, t) {
|
|
19
19
|
if (this.replaceRange = e, this.newLength = t, t < 0)
|
|
20
20
|
throw new Error(`newLength must be non-negative, got ${t}`);
|
|
21
21
|
}
|
|
22
22
|
static replace(e, t) {
|
|
23
|
-
return new
|
|
23
|
+
return new pn(e, t);
|
|
24
24
|
}
|
|
25
25
|
get lengthDelta() {
|
|
26
26
|
return this.newLength - this.replaceRange.length;
|
|
@@ -38,7 +38,7 @@ class Re {
|
|
|
38
38
|
return new Re([e]);
|
|
39
39
|
}
|
|
40
40
|
static replace(e, t) {
|
|
41
|
-
return new Re([
|
|
41
|
+
return new Re([pn.replace(e, t)]);
|
|
42
42
|
}
|
|
43
43
|
replacements;
|
|
44
44
|
constructor(e) {
|
|
@@ -127,16 +127,16 @@ class se {
|
|
|
127
127
|
return new se(this.x + e, this.y + t);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
class
|
|
130
|
+
class T {
|
|
131
131
|
constructor(e, t, s, i) {
|
|
132
132
|
this.x = e, this.y = t, this.width = s, this.height = i;
|
|
133
133
|
}
|
|
134
|
-
static EMPTY = new
|
|
134
|
+
static EMPTY = new T(0, 0, 0, 0);
|
|
135
135
|
static fromPointPoint(e, t, s, i) {
|
|
136
|
-
return new
|
|
136
|
+
return new T(e, t, s - e, i - t);
|
|
137
137
|
}
|
|
138
138
|
static fromPointSize(e, t, s, i) {
|
|
139
|
-
return new
|
|
139
|
+
return new T(e, t, s, i);
|
|
140
140
|
}
|
|
141
141
|
get left() {
|
|
142
142
|
return this.x;
|
|
@@ -164,10 +164,10 @@ class L {
|
|
|
164
164
|
}
|
|
165
165
|
/** Same y/height, zero-width band at `x = this.left`. Useful for caret rects derived from a line. */
|
|
166
166
|
withZeroWidthAt(e) {
|
|
167
|
-
return new
|
|
167
|
+
return new T(e, this.y, 0, this.height);
|
|
168
168
|
}
|
|
169
169
|
translate(e, t) {
|
|
170
|
-
return new
|
|
170
|
+
return new T(this.x + e, this.y + t, this.width, this.height);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
let tr = 1;
|
|
@@ -303,7 +303,7 @@ class xe extends te {
|
|
|
303
303
|
function he(n, e) {
|
|
304
304
|
return n.find((t) => t instanceof E && t.markerKind === e);
|
|
305
305
|
}
|
|
306
|
-
class
|
|
306
|
+
class gn extends ee {
|
|
307
307
|
constructor(e, t, s) {
|
|
308
308
|
super(), this.openMarker = e, this.content = t, this.closeMarker = s;
|
|
309
309
|
}
|
|
@@ -312,10 +312,10 @@ class pn extends ee {
|
|
|
312
312
|
return [this.openMarker, ...this.content, this.closeMarker];
|
|
313
313
|
}
|
|
314
314
|
mapChildren(e) {
|
|
315
|
-
return new
|
|
315
|
+
return new gn(ue(e, this.openMarker), B(e, this.content), ue(e, this.closeMarker));
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
class
|
|
318
|
+
class _n extends ee {
|
|
319
319
|
constructor(e, t, s) {
|
|
320
320
|
super(), this.openMarker = e, this.content = t, this.closeMarker = s;
|
|
321
321
|
}
|
|
@@ -324,10 +324,10 @@ class gn extends ee {
|
|
|
324
324
|
return [this.openMarker, ...this.content, this.closeMarker];
|
|
325
325
|
}
|
|
326
326
|
mapChildren(e) {
|
|
327
|
-
return new
|
|
327
|
+
return new _n(ue(e, this.openMarker), B(e, this.content), ue(e, this.closeMarker));
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
class
|
|
330
|
+
class vn extends ee {
|
|
331
331
|
constructor(e, t, s) {
|
|
332
332
|
super(), this.openMarker = e, this.content = t, this.closeMarker = s;
|
|
333
333
|
}
|
|
@@ -336,10 +336,10 @@ class _n extends ee {
|
|
|
336
336
|
return [this.openMarker, ...this.content, this.closeMarker];
|
|
337
337
|
}
|
|
338
338
|
mapChildren(e) {
|
|
339
|
-
return new
|
|
339
|
+
return new vn(ue(e, this.openMarker), B(e, this.content), ue(e, this.closeMarker));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
class
|
|
342
|
+
class kn extends ee {
|
|
343
343
|
constructor(e) {
|
|
344
344
|
super(), this.content = e;
|
|
345
345
|
}
|
|
@@ -348,10 +348,10 @@ class vn extends ee {
|
|
|
348
348
|
return this.content;
|
|
349
349
|
}
|
|
350
350
|
mapChildren(e) {
|
|
351
|
-
return new
|
|
351
|
+
return new kn(B(e, this.content));
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
class
|
|
354
|
+
class wn extends ee {
|
|
355
355
|
constructor(e) {
|
|
356
356
|
super(), this.content = e;
|
|
357
357
|
}
|
|
@@ -360,7 +360,7 @@ class kn extends ee {
|
|
|
360
360
|
return this.content;
|
|
361
361
|
}
|
|
362
362
|
mapChildren(e) {
|
|
363
|
-
return new
|
|
363
|
+
return new wn(B(e, this.content));
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
class Ce extends ee {
|
|
@@ -378,7 +378,7 @@ class Ce extends ee {
|
|
|
378
378
|
return this.url === e.url;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
class
|
|
381
|
+
class Ye extends ee {
|
|
382
382
|
constructor(e, t, s) {
|
|
383
383
|
super(), this.alt = e, this.url = t, this.content = s;
|
|
384
384
|
}
|
|
@@ -387,13 +387,13 @@ class je extends ee {
|
|
|
387
387
|
return this.content;
|
|
388
388
|
}
|
|
389
389
|
mapChildren(e) {
|
|
390
|
-
return new
|
|
390
|
+
return new Ye(this.alt, this.url, B(e, this.content));
|
|
391
391
|
}
|
|
392
392
|
_localEquals(e) {
|
|
393
393
|
return this.alt === e.alt && this.url === e.url;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
class
|
|
396
|
+
class Y extends te {
|
|
397
397
|
constructor(e, t, s) {
|
|
398
398
|
super(), this.attributes = e, this.content = t, this.leadingTrivia = s;
|
|
399
399
|
}
|
|
@@ -405,10 +405,10 @@ class j extends te {
|
|
|
405
405
|
return he(this.content, "content");
|
|
406
406
|
}
|
|
407
407
|
mapChildren(e) {
|
|
408
|
-
return new
|
|
408
|
+
return new Y(this.attributes, B(e, this.content), oe(e, this.leadingTrivia));
|
|
409
409
|
}
|
|
410
410
|
withLeadingTrivia(e) {
|
|
411
|
-
return new
|
|
411
|
+
return new Y(this.attributes, this.content, e);
|
|
412
412
|
}
|
|
413
413
|
_localEquals(e) {
|
|
414
414
|
return this.attributes.src === e.attributes.src && this.attributes.title === e.attributes.title && this.attributes.autoplay === e.attributes.autoplay && this.attributes.controls === e.attributes.controls && this.attributes.loop === e.attributes.loop && this.attributes.muted === e.attributes.muted;
|
|
@@ -626,7 +626,7 @@ class ve extends te {
|
|
|
626
626
|
return this._withLeading(this.content);
|
|
627
627
|
}
|
|
628
628
|
get blocks() {
|
|
629
|
-
return this.content.filter(
|
|
629
|
+
return this.content.filter(yn);
|
|
630
630
|
}
|
|
631
631
|
mapChildren(e) {
|
|
632
632
|
return new ve(B(e, this.content), oe(e, this.leadingTrivia));
|
|
@@ -665,7 +665,7 @@ class $ extends ee {
|
|
|
665
665
|
return this.leadingTrivia ? [this.leadingTrivia, this.marker, ...this.content] : [this.marker, ...this.content];
|
|
666
666
|
}
|
|
667
667
|
get blocks() {
|
|
668
|
-
return this.content.filter(
|
|
668
|
+
return this.content.filter(yn);
|
|
669
669
|
}
|
|
670
670
|
get isIncomplete() {
|
|
671
671
|
return !/[ \t]$/.test(this.marker.content) && this.blocks.length === 0;
|
|
@@ -739,7 +739,7 @@ class qe extends ee {
|
|
|
739
739
|
return new qe(B(e, this.content));
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
|
-
class
|
|
742
|
+
class bn extends ee {
|
|
743
743
|
constructor(e) {
|
|
744
744
|
super(), this.content = e;
|
|
745
745
|
}
|
|
@@ -748,21 +748,21 @@ class wn extends ee {
|
|
|
748
748
|
return this.content;
|
|
749
749
|
}
|
|
750
750
|
get blocks() {
|
|
751
|
-
return this.content.filter(
|
|
751
|
+
return this.content.filter(yn);
|
|
752
752
|
}
|
|
753
753
|
mapChildren(e) {
|
|
754
|
-
return new
|
|
754
|
+
return new bn(B(e, this.content));
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
function
|
|
758
|
-
return n instanceof ye || n instanceof ie || n instanceof Ie || n instanceof Ne || n instanceof ae || n instanceof Se || n instanceof xe || n instanceof
|
|
757
|
+
function yn(n) {
|
|
758
|
+
return n instanceof ye || n instanceof ie || n instanceof Ie || n instanceof Ne || n instanceof ae || n instanceof Se || n instanceof xe || n instanceof Y || n instanceof ve || n instanceof H || n instanceof Ae || n instanceof ge;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function G(n, e) {
|
|
761
761
|
if (n.id === e.id)
|
|
762
762
|
return 0;
|
|
763
763
|
let t = 0;
|
|
764
764
|
for (const s of n.children) {
|
|
765
|
-
const i =
|
|
765
|
+
const i = G(s, e);
|
|
766
766
|
if (i !== void 0)
|
|
767
767
|
return t + i;
|
|
768
768
|
t += s.length;
|
|
@@ -866,7 +866,7 @@ function cr(n, e, t) {
|
|
|
866
866
|
});
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function En(n, e) {
|
|
870
870
|
return new pr(or(n, e), n, e).build();
|
|
871
871
|
}
|
|
872
872
|
const ar = /* @__PURE__ */ new Set([
|
|
@@ -879,7 +879,7 @@ function zn(n) {
|
|
|
879
879
|
return lr;
|
|
880
880
|
e += 6;
|
|
881
881
|
const t = n[e];
|
|
882
|
-
if (t !== void 0 && t !== ">" && t !== "/" && !
|
|
882
|
+
if (t !== void 0 && t !== ">" && t !== "/" && !Qt(t))
|
|
883
883
|
return U;
|
|
884
884
|
const s = [];
|
|
885
885
|
let i = !1;
|
|
@@ -908,7 +908,7 @@ function zn(n) {
|
|
|
908
908
|
_ = n.slice(w, e), e++;
|
|
909
909
|
} else {
|
|
910
910
|
const w = e;
|
|
911
|
-
for (; e < n.length && !
|
|
911
|
+
for (; e < n.length && !Qt(n[e]) && n[e] !== ">"; ) {
|
|
912
912
|
const b = n[e];
|
|
913
913
|
if (b === '"' || b === "'" || b === "`" || b === "<" || b === "=")
|
|
914
914
|
return U;
|
|
@@ -961,14 +961,14 @@ function zn(n) {
|
|
|
961
961
|
};
|
|
962
962
|
}
|
|
963
963
|
function pe(n, e) {
|
|
964
|
-
for (;
|
|
964
|
+
for (; Qt(n[e]); )
|
|
965
965
|
e++;
|
|
966
966
|
return e;
|
|
967
967
|
}
|
|
968
968
|
function dr(n) {
|
|
969
969
|
return pe(n, 0) === n.length;
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function Qt(n) {
|
|
972
972
|
return n === " " || n === " " || n === `
|
|
973
973
|
` || n === "\r" || n === "\f";
|
|
974
974
|
}
|
|
@@ -984,7 +984,7 @@ function wi(n, e, t) {
|
|
|
984
984
|
function bi(n, e) {
|
|
985
985
|
return wi(n, e, "<video") ? !ki(n[e + 6]) : !1;
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function nt(n) {
|
|
988
988
|
const e = [];
|
|
989
989
|
for (let t = 0; t < n.length; t++) {
|
|
990
990
|
const s = n[t], i = n[t + 1];
|
|
@@ -1048,7 +1048,7 @@ function fr(n, e) {
|
|
|
1048
1048
|
h && (t[t.length - 1] = h, o = o.slice(r[0].length));
|
|
1049
1049
|
}
|
|
1050
1050
|
const c = e && s + 1 < n.length ? /^(?:\r\n|\r(?!\n)|\n)[ \t]*(?=[\r\n])/.exec(o)?.[0] : void 0, a = t.at(-1);
|
|
1051
|
-
if (c && a &&
|
|
1051
|
+
if (c && a && xn(a)) {
|
|
1052
1052
|
const u = Ei(a, c);
|
|
1053
1053
|
u && (t[t.length - 1] = u, o = o.slice(c.length));
|
|
1054
1054
|
}
|
|
@@ -1097,7 +1097,7 @@ function Ue(n, e) {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
case "video": {
|
|
1099
1099
|
const t = n;
|
|
1100
|
-
return new
|
|
1100
|
+
return new Y(t.attributes, [...t.content, e], t.leadingTrivia);
|
|
1101
1101
|
}
|
|
1102
1102
|
case "unhandledBlock": {
|
|
1103
1103
|
const t = n;
|
|
@@ -1109,11 +1109,11 @@ function Ue(n, e) {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
case "blockQuote": {
|
|
1111
1111
|
const t = n;
|
|
1112
|
-
return new ve(
|
|
1112
|
+
return new ve(Pt(t.content, e), t.leadingTrivia);
|
|
1113
1113
|
}
|
|
1114
1114
|
case "list": {
|
|
1115
1115
|
const t = n;
|
|
1116
|
-
return new H(t.ordered,
|
|
1116
|
+
return new H(t.ordered, Pt(t.content, e), t.leadingTrivia);
|
|
1117
1117
|
}
|
|
1118
1118
|
case "listItem": {
|
|
1119
1119
|
const t = n, s = t.content.length === 0 ? /^[ \t]+/.exec(e.content)?.[0] : void 0;
|
|
@@ -1126,13 +1126,13 @@ function Ue(n, e) {
|
|
|
1126
1126
|
t.leadingTrivia
|
|
1127
1127
|
);
|
|
1128
1128
|
}
|
|
1129
|
-
return new $(t.marker,
|
|
1129
|
+
return new $(t.marker, Pt(t.content, e), t.checked, t.leadingTrivia);
|
|
1130
1130
|
}
|
|
1131
1131
|
default:
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function Pt(n, e) {
|
|
1136
1136
|
const t = n[n.length - 1], s = t !== void 0 ? Ue(t, e) : void 0;
|
|
1137
1137
|
if (s) {
|
|
1138
1138
|
const i = n.slice();
|
|
@@ -1143,12 +1143,12 @@ function At(n, e) {
|
|
|
1143
1143
|
function mr(n) {
|
|
1144
1144
|
return n.some((e) => !(e instanceof S)) ? n : [new ie(n)];
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function xn(n, e = !1) {
|
|
1147
1147
|
if (n instanceof ie)
|
|
1148
1148
|
return e;
|
|
1149
1149
|
if (n instanceof H || n instanceof $ || n instanceof ve) {
|
|
1150
1150
|
const t = n.content.at(-1);
|
|
1151
|
-
return t !== void 0 &&
|
|
1151
|
+
return t !== void 0 && xn(t, e || n instanceof H || n instanceof $);
|
|
1152
1152
|
}
|
|
1153
1153
|
return !1;
|
|
1154
1154
|
}
|
|
@@ -1208,8 +1208,8 @@ class pr {
|
|
|
1208
1208
|
} else
|
|
1209
1209
|
this._idx++;
|
|
1210
1210
|
}
|
|
1211
|
-
const s =
|
|
1212
|
-
if (this._options?.preserveTrailingListContinuation && i instanceof S && r && o &&
|
|
1211
|
+
const s = nt(e.build(this._source.length)), i = s.at(-1), o = s.at(-2), r = i instanceof S && /^[\r\n \t]*$/.test(i.content) ? /^(?:\r\n|\r|\n)[ \t]*/.exec(i.content)?.[0] : void 0;
|
|
1212
|
+
if (this._options?.preserveTrailingListContinuation && i instanceof S && r && o && xn(o)) {
|
|
1213
1213
|
const l = Ei(o, r);
|
|
1214
1214
|
if (l instanceof H || l instanceof ve) {
|
|
1215
1215
|
const d = i.content.slice(r.length);
|
|
@@ -1217,7 +1217,7 @@ class pr {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
}
|
|
1219
1219
|
const c = this._blockGaps(s), a = s.at(-1);
|
|
1220
|
-
return this._options?.explicitFinalEmptyLine && (c.length === 0 || a instanceof S && /[\r\n]$/.test(a.content)) && c.push(new Ie([])), new
|
|
1220
|
+
return this._options?.explicitFinalEmptyLine && (c.length === 0 || a instanceof S && /[\r\n]$/.test(a.content)) && c.push(new Ie([])), new bn(mr(c));
|
|
1221
1221
|
}
|
|
1222
1222
|
_blockGaps(e) {
|
|
1223
1223
|
return this._options?.explicitBlankLineBlocks ? fr(e, this._options.preserveTrailingListContinuation === !0) : ur(e);
|
|
@@ -1251,7 +1251,7 @@ class pr {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
_parseHtmlFlow() {
|
|
1253
1253
|
const e = this._idx, { raw: t, startOffset: s, endOffset: i } = this._consumeVerbatimBlock(), o = [new E("content", t)], r = this._logicalHtmlSource(e, this._idx, s, i), c = zn(r);
|
|
1254
|
-
return c.kind === "supported" ? new
|
|
1254
|
+
return c.kind === "supported" ? new Y(c.attributes, o) : new ge("htmlFlow", o);
|
|
1255
1255
|
}
|
|
1256
1256
|
/**
|
|
1257
1257
|
* Fallback for an unrecognized top-level token (a setext heading or any
|
|
@@ -1284,7 +1284,7 @@ class pr {
|
|
|
1284
1284
|
if (a.kind === "notVideo")
|
|
1285
1285
|
return this._idx = s, this._parseParagraph();
|
|
1286
1286
|
const l = [new E("content", i)];
|
|
1287
|
-
return a.kind === "supported" ? new
|
|
1287
|
+
return a.kind === "supported" ? new Y(a.attributes, l) : new ge("htmlFlow", l);
|
|
1288
1288
|
}
|
|
1289
1289
|
/**
|
|
1290
1290
|
* Remove only Markdown container structure from a physical HTML source
|
|
@@ -1504,7 +1504,7 @@ class pr {
|
|
|
1504
1504
|
new E("blockQuoteMarker", this._source.substring(a.startOffset, a.endOffset)),
|
|
1505
1505
|
a.startOffset
|
|
1506
1506
|
);
|
|
1507
|
-
return new ve(this._blockGaps(
|
|
1507
|
+
return new ve(this._blockGaps(nt(t.build(r.endOffset - e.startOffset))));
|
|
1508
1508
|
}
|
|
1509
1509
|
_parseList() {
|
|
1510
1510
|
const e = this._events[this._idx].tokenType, t = e === "listOrdered", s = this._consume("enter", e), i = new D(s.startOffset, this._source);
|
|
@@ -1513,7 +1513,7 @@ class pr {
|
|
|
1513
1513
|
if (o === void 0 || r === void 0 || a === void 0)
|
|
1514
1514
|
return;
|
|
1515
1515
|
const f = new E("listItemMarker", this._source.substring(r, c)), m = d ?? c, p = a.build(m - c);
|
|
1516
|
-
i.add(new $(f, this._blockGaps(
|
|
1516
|
+
i.add(new $(f, this._blockGaps(nt(p)), l), o);
|
|
1517
1517
|
};
|
|
1518
1518
|
for (; this._notExit(e); ) {
|
|
1519
1519
|
const f = this._events[this._idx];
|
|
@@ -1536,7 +1536,7 @@ class pr {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
u();
|
|
1538
1538
|
const h = this._consume("exit", e);
|
|
1539
|
-
return new H(t, this._blockGaps(
|
|
1539
|
+
return new H(t, this._blockGaps(nt(i.build(h.endOffset - s.startOffset))));
|
|
1540
1540
|
}
|
|
1541
1541
|
_parseTable() {
|
|
1542
1542
|
const e = this._consume("enter", "table"), t = new D(e.startOffset, this._source);
|
|
@@ -1718,7 +1718,7 @@ class pr {
|
|
|
1718
1718
|
const a = this._consume("enter", t), l = this._consume("exit", t), d = new E("openMarker", this._source.substring(i.startOffset, o.endOffset)), u = new E("closeMarker", this._source.substring(a.startOffset, l.endOffset)), h = new D(o.endOffset, this._source);
|
|
1719
1719
|
for (const p of r)
|
|
1720
1720
|
h.add(p.node, p.start);
|
|
1721
|
-
const f = h.build(a.startOffset - o.endOffset), m = s ? new
|
|
1721
|
+
const f = h.build(a.startOffset - o.endOffset), m = s ? new gn(d, f, u) : new _n(d, f, u);
|
|
1722
1722
|
e.push({ node: m, start: i.startOffset });
|
|
1723
1723
|
return;
|
|
1724
1724
|
}
|
|
@@ -1734,7 +1734,7 @@ class pr {
|
|
|
1734
1734
|
c.type === "enter" && c.tokenType === "codeTextSequence" ? (t.add(new E(s ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), s = !0) : c.type === "enter" && c.tokenType === "codeTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
|
|
1735
1735
|
}
|
|
1736
1736
|
const r = this._consume("exit", "codeText");
|
|
1737
|
-
return i !== void 0 && t.add(new E("content", this._source.substring(i, o)), i), { node: new
|
|
1737
|
+
return i !== void 0 && t.add(new E("content", this._source.substring(i, o)), i), { node: new kn(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
|
|
1738
1738
|
}
|
|
1739
1739
|
_parseInlineMath() {
|
|
1740
1740
|
const e = this._consume("enter", "mathText"), t = new D(e.startOffset, this._source);
|
|
@@ -1744,7 +1744,7 @@ class pr {
|
|
|
1744
1744
|
c.type === "enter" && c.tokenType === "mathTextSequence" ? (t.add(new E(s ? "closeMarker" : "openMarker", this._source.substring(c.startOffset, c.endOffset)), c.startOffset), s = !0) : c.type === "enter" && c.tokenType === "mathTextData" && (i === void 0 && (i = c.startOffset), o = c.endOffset), this._idx++;
|
|
1745
1745
|
}
|
|
1746
1746
|
const r = this._consume("exit", "mathText");
|
|
1747
|
-
return i !== void 0 && t.add(new E("content", this._source.substring(i, o)), i), { node: new
|
|
1747
|
+
return i !== void 0 && t.add(new E("content", this._source.substring(i, o)), i), { node: new wn(t.build(r.endOffset - e.startOffset)), start: e.startOffset };
|
|
1748
1748
|
}
|
|
1749
1749
|
_parseStrikethrough() {
|
|
1750
1750
|
const e = this._consume("enter", "strikethrough");
|
|
@@ -1762,7 +1762,7 @@ class pr {
|
|
|
1762
1762
|
for (const l of r)
|
|
1763
1763
|
c.add(l.node, l.start);
|
|
1764
1764
|
const a = c.build(o - i);
|
|
1765
|
-
return { node: new
|
|
1765
|
+
return { node: new vn(t, a, s), start: e.startOffset };
|
|
1766
1766
|
}
|
|
1767
1767
|
_parseAutolink() {
|
|
1768
1768
|
const e = this._events[this._idx++], t = [];
|
|
@@ -1857,7 +1857,7 @@ class pr {
|
|
|
1857
1857
|
this._idx++;
|
|
1858
1858
|
}
|
|
1859
1859
|
const r = this._consume("exit", "image");
|
|
1860
|
-
return { node: new
|
|
1860
|
+
return { node: new Ye(s, i, t.build(r.endOffset - e.startOffset)), start: e.startOffset };
|
|
1861
1861
|
}
|
|
1862
1862
|
_notExit(e) {
|
|
1863
1863
|
if (this._idx >= this._events.length)
|
|
@@ -1969,13 +1969,13 @@ function vr(n, e, t) {
|
|
|
1969
1969
|
return !0;
|
|
1970
1970
|
}
|
|
1971
1971
|
function kr(n, e) {
|
|
1972
|
-
return new
|
|
1972
|
+
return new L(n.replacements.map((t) => _e.replace(t.replaceRange.delta(e), t.newText)));
|
|
1973
1973
|
}
|
|
1974
1974
|
function wr(n, e, t) {
|
|
1975
1975
|
return Ci(n, 0, new xi(t), new gr(e), t);
|
|
1976
1976
|
}
|
|
1977
1977
|
function br(n, e, t, s) {
|
|
1978
|
-
const i =
|
|
1978
|
+
const i = En(n, s);
|
|
1979
1979
|
return !e || !t ? i : wr(i, e, t);
|
|
1980
1980
|
}
|
|
1981
1981
|
class yr {
|
|
@@ -1998,13 +1998,13 @@ function Er(n, e, t = 0) {
|
|
|
1998
1998
|
}
|
|
1999
1999
|
function qn(n) {
|
|
2000
2000
|
const e = {};
|
|
2001
|
-
return n instanceof ye ? e.level = String(n.level) : n instanceof H ? e.ordered = String(n.ordered) : n instanceof ae ? n.language && (e.language = n.language) : n instanceof Ce ? e.url = n.url : n instanceof
|
|
2001
|
+
return n instanceof ye ? e.level = String(n.level) : n instanceof H ? e.ordered = String(n.ordered) : n instanceof ae ? n.language && (e.language = n.language) : n instanceof Ce ? e.url = n.url : n instanceof Ye ? (e.alt = n.alt, e.url = n.url) : n instanceof Y ? (e.src = n.attributes.src, n.attributes.title !== void 0 && (e.title = n.attributes.title), n.attributes.autoplay && (e.autoplay = "true"), n.attributes.controls && (e.controls = "true"), n.attributes.loop && (e.loop = "true"), n.attributes.muted && (e.muted = "true")) : n instanceof $ ? n.checked !== void 0 && (e.checked = String(n.checked)) : n instanceof ge ? e.token = n.tokenType : n instanceof S && n.glueKind && (e.kind = n.glueKind), Object.entries(e).map(([t, s]) => ` ${t}="${Si(s)}"`).join("");
|
|
2002
2002
|
}
|
|
2003
2003
|
function Si(n) {
|
|
2004
2004
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2005
2005
|
}
|
|
2006
2006
|
function xr(n) {
|
|
2007
|
-
return n instanceof Oe ? `text ${JSON.stringify(n.content)}` : n instanceof S ? `glue${n.glueKind ? `(${n.glueKind})` : ""} ${JSON.stringify(n.content)}` : n instanceof E ? `marker(${n.markerKind}) ${JSON.stringify(n.content)}` : n instanceof xe ? `thematicBreak ${JSON.stringify(n.content)}` : n instanceof ye ? `heading(level=${n.level})` : n instanceof H ? `list(ordered=${n.ordered})` : n instanceof $ ? n.checked === void 0 ? "listItem" : `listItem(checked=${n.checked})` : n instanceof ae ? `codeBlock(language=${JSON.stringify(n.language)})` : n instanceof Se ? "mathBlock" : n instanceof Ce ? `link(url=${JSON.stringify(n.url)})` : n instanceof
|
|
2007
|
+
return n instanceof Oe ? `text ${JSON.stringify(n.content)}` : n instanceof S ? `glue${n.glueKind ? `(${n.glueKind})` : ""} ${JSON.stringify(n.content)}` : n instanceof E ? `marker(${n.markerKind}) ${JSON.stringify(n.content)}` : n instanceof xe ? `thematicBreak ${JSON.stringify(n.content)}` : n instanceof ye ? `heading(level=${n.level})` : n instanceof H ? `list(ordered=${n.ordered})` : n instanceof $ ? n.checked === void 0 ? "listItem" : `listItem(checked=${n.checked})` : n instanceof ae ? `codeBlock(language=${JSON.stringify(n.language)})` : n instanceof Se ? "mathBlock" : n instanceof Ce ? `link(url=${JSON.stringify(n.url)})` : n instanceof Ye ? `image(alt=${JSON.stringify(n.alt)}, url=${JSON.stringify(n.url)})` : n instanceof Y ? `video(src=${JSON.stringify(n.attributes.src)})` : n.kind;
|
|
2008
2008
|
}
|
|
2009
2009
|
const Un = /* @__PURE__ */ new WeakMap();
|
|
2010
2010
|
let Cr = 0;
|
|
@@ -2053,22 +2053,22 @@ function Tr(n) {
|
|
|
2053
2053
|
return t;
|
|
2054
2054
|
}
|
|
2055
2055
|
const Mr = {}, Li = x(Mr, !1), Or = Li;
|
|
2056
|
-
let
|
|
2056
|
+
let jt, Bt;
|
|
2057
2057
|
function Rr() {
|
|
2058
|
-
return
|
|
2059
|
-
|
|
2058
|
+
return Bt || (Bt = Jo({ useWasm: !1 }).then((n) => {
|
|
2059
|
+
jt = n, Li.set(!0, void 0);
|
|
2060
2060
|
}).catch(() => {
|
|
2061
|
-
})),
|
|
2061
|
+
})), Bt;
|
|
2062
2062
|
}
|
|
2063
2063
|
Rr();
|
|
2064
2064
|
function Ir(n, e) {
|
|
2065
|
-
if (!
|
|
2065
|
+
if (!jt)
|
|
2066
2066
|
throw new Error("Diff computer not loaded yet — await ensureDiffComputer() / observe diffComputerReady first.");
|
|
2067
|
-
const t =
|
|
2067
|
+
const t = jt.computeDiff(n, e, { extendToSubwords: !0 });
|
|
2068
2068
|
return Nr(t.edits.stripData());
|
|
2069
2069
|
}
|
|
2070
2070
|
function Nr(n) {
|
|
2071
|
-
return new
|
|
2071
|
+
return new L(n.replacements.map((e) => _e.replace(new v(e.range.start, e.range.endExclusive), e.newText)));
|
|
2072
2072
|
}
|
|
2073
2073
|
const Ar = /* @__PURE__ */ new Set([
|
|
2074
2074
|
"document",
|
|
@@ -2102,8 +2102,8 @@ function Ti(n, e, t, s, i, o) {
|
|
|
2102
2102
|
originalStart: f.start,
|
|
2103
2103
|
modified: d.node,
|
|
2104
2104
|
modifiedStart: d.start,
|
|
2105
|
-
insertedLocal:
|
|
2106
|
-
deletedLocal:
|
|
2105
|
+
insertedLocal: ft(u, d.start, o, "modified", "inserted"),
|
|
2106
|
+
deletedLocal: ft(m, f.start, o, "original", "deleted")
|
|
2107
2107
|
})) : a.push(Dr(d, o));
|
|
2108
2108
|
}
|
|
2109
2109
|
for (; l < r.length; )
|
|
@@ -2119,15 +2119,15 @@ function Gn(n, e) {
|
|
|
2119
2119
|
}
|
|
2120
2120
|
function Dr(n, e) {
|
|
2121
2121
|
const t = v.ofStartAndLength(n.start, n.node.length);
|
|
2122
|
-
let s =
|
|
2122
|
+
let s = ft(t, n.start, e, "modified", "inserted");
|
|
2123
2123
|
return s.length === 0 && (s = [{ range: v.ofLength(n.node.length), kind: "inserted" }]), { kind: "added", node: n.node, modifiedStart: n.start, insertedLocal: s };
|
|
2124
2124
|
}
|
|
2125
2125
|
function Xn(n, e) {
|
|
2126
2126
|
const t = v.ofStartAndLength(n.start, n.node.length);
|
|
2127
|
-
let s =
|
|
2127
|
+
let s = ft(t, n.start, e, "original", "deleted");
|
|
2128
2128
|
return s.length === 0 && (s = [{ range: v.ofLength(n.node.length), kind: "deleted" }]), { kind: "removed", node: n.node, originalStart: n.start, deletedLocal: s };
|
|
2129
2129
|
}
|
|
2130
|
-
function
|
|
2130
|
+
function ft(n, e, t, s, i) {
|
|
2131
2131
|
const o = [];
|
|
2132
2132
|
for (const r of t) {
|
|
2133
2133
|
const a = (s === "original" ? r.original : r.modified).intersect(n);
|
|
@@ -2241,7 +2241,7 @@ class th {
|
|
|
2241
2241
|
activeBlock = I(this, (e) => {
|
|
2242
2242
|
const t = e.readObservable(this.document), s = e.readObservable(this.cursorOffset);
|
|
2243
2243
|
if (s !== void 0)
|
|
2244
|
-
return
|
|
2244
|
+
return Cn(t, s);
|
|
2245
2245
|
});
|
|
2246
2246
|
/**
|
|
2247
2247
|
* All blocks whose source range intersects the current selection.
|
|
@@ -2258,7 +2258,7 @@ class th {
|
|
|
2258
2258
|
if (t !== void 0)
|
|
2259
2259
|
return new Set(t);
|
|
2260
2260
|
const s = e.readObservable(this.document), i = e.readObservable(this.selection);
|
|
2261
|
-
return i === void 0 ? /* @__PURE__ */ new Set() : new Set(
|
|
2261
|
+
return i === void 0 ? /* @__PURE__ */ new Set() : new Set(Yt(s, i.range.start, i.range.endExclusive));
|
|
2262
2262
|
});
|
|
2263
2263
|
/**
|
|
2264
2264
|
* The baseline document to diff against. When set, the editor renders in
|
|
@@ -2293,7 +2293,7 @@ class th {
|
|
|
2293
2293
|
};
|
|
2294
2294
|
l(c, !0);
|
|
2295
2295
|
const d = /* @__PURE__ */ new Set(), u = (f) => {
|
|
2296
|
-
if (f instanceof
|
|
2296
|
+
if (f instanceof Y) {
|
|
2297
2297
|
d.add(f);
|
|
2298
2298
|
return;
|
|
2299
2299
|
}
|
|
@@ -2362,7 +2362,7 @@ class th {
|
|
|
2362
2362
|
const t = this.sourceText.get(), s = pi(t.value, e.value), i = this.selection.get();
|
|
2363
2363
|
let o = i;
|
|
2364
2364
|
if (i) {
|
|
2365
|
-
const r =
|
|
2365
|
+
const r = st(s.mapOffset(st(i.anchor, t.value.length)), e.value.length), c = st(s.mapOffset(st(i.active, t.value.length)), e.value.length);
|
|
2366
2366
|
(r !== i.anchor || c !== i.active) && (o = new y(r, c));
|
|
2367
2367
|
}
|
|
2368
2368
|
s.isEmpty || (this._pendingEdit = { baseText: t.value, newText: e.value, edit: s }), K((r) => {
|
|
@@ -2393,17 +2393,17 @@ class th {
|
|
|
2393
2393
|
|
|
2394
2394
|
` : "", o = i + s + (t.atEof ? "" : `
|
|
2395
2395
|
|
|
2396
|
-
`), r = t.replaceRange.start + i.length + s.length, c =
|
|
2396
|
+
`), r = t.replaceRange.start + i.length + s.length, c = L.replace(t.replaceRange, o);
|
|
2397
2397
|
this._applySourceEdit(c, y.collapsed(r));
|
|
2398
2398
|
}
|
|
2399
2399
|
/** Sets a rendered task checkbox state in either editing or read-only mode. */
|
|
2400
2400
|
setTaskCheckboxChecked(e, t) {
|
|
2401
2401
|
if (e.checked === t)
|
|
2402
2402
|
return;
|
|
2403
|
-
const s =
|
|
2403
|
+
const s = G(this.document.get(), e), i = ir(e);
|
|
2404
2404
|
if (s === void 0 || i === void 0)
|
|
2405
2405
|
return;
|
|
2406
|
-
const o =
|
|
2406
|
+
const o = L.replace(i.delta(s), t ? "[x]" : "[ ]");
|
|
2407
2407
|
this._applySourceEdit(o, this.selection.get() ?? y.collapsed(0));
|
|
2408
2408
|
}
|
|
2409
2409
|
applyEdit(e, t) {
|
|
@@ -2437,10 +2437,10 @@ class th {
|
|
|
2437
2437
|
t(e);
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
|
-
function
|
|
2440
|
+
function st(n, e) {
|
|
2441
2441
|
return Math.max(0, Math.min(n, e));
|
|
2442
2442
|
}
|
|
2443
|
-
function
|
|
2443
|
+
function Cn(n, e) {
|
|
2444
2444
|
const t = new Set(n.blocks);
|
|
2445
2445
|
let s = 0, i;
|
|
2446
2446
|
for (const o of n.children) {
|
|
@@ -2454,9 +2454,9 @@ function xn(n, e) {
|
|
|
2454
2454
|
}
|
|
2455
2455
|
return i;
|
|
2456
2456
|
}
|
|
2457
|
-
function
|
|
2457
|
+
function Yt(n, e, t) {
|
|
2458
2458
|
if (e === t) {
|
|
2459
|
-
const r =
|
|
2459
|
+
const r = Cn(n, e);
|
|
2460
2460
|
return r ? [r] : [];
|
|
2461
2461
|
}
|
|
2462
2462
|
const s = [], i = new Set(n.blocks);
|
|
@@ -2467,11 +2467,11 @@ function jt(n, e, t) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
return s;
|
|
2469
2469
|
}
|
|
2470
|
-
class
|
|
2470
|
+
class Ze {
|
|
2471
2471
|
constructor(e) {
|
|
2472
2472
|
this.lines = e, this.sourceLines = e.filter((t) => !t.virtualCursorLine);
|
|
2473
2473
|
}
|
|
2474
|
-
static EMPTY = new
|
|
2474
|
+
static EMPTY = new Ze([]);
|
|
2475
2475
|
static measure(e, t, s = t.capture()) {
|
|
2476
2476
|
return $r(e, t, s);
|
|
2477
2477
|
}
|
|
@@ -2797,14 +2797,14 @@ function $r(n, e, t) {
|
|
|
2797
2797
|
if (f.sourceLength === 0) {
|
|
2798
2798
|
s.push(be.visualLineAnchor(
|
|
2799
2799
|
m,
|
|
2800
|
-
|
|
2800
|
+
Dt(k[0], w)
|
|
2801
2801
|
));
|
|
2802
2802
|
return;
|
|
2803
2803
|
}
|
|
2804
2804
|
if (k.length === 1)
|
|
2805
2805
|
s.push(new be(
|
|
2806
2806
|
v.fromTo(m, m + p.length),
|
|
2807
|
-
|
|
2807
|
+
Dt(k[0], w),
|
|
2808
2808
|
{ textNode: p, textNodeStart: 0, coordinateSpace: e }
|
|
2809
2809
|
));
|
|
2810
2810
|
else {
|
|
@@ -2813,7 +2813,7 @@ function $r(n, e, t) {
|
|
|
2813
2813
|
const A = C === 0 ? 0 : b[C - 1], ne = C < b.length ? b[C] : p.length;
|
|
2814
2814
|
s.push(new be(
|
|
2815
2815
|
v.fromTo(m + A, m + ne),
|
|
2816
|
-
|
|
2816
|
+
Dt(k[C], w),
|
|
2817
2817
|
{ textNode: p, textNodeStart: A, coordinateSpace: e }
|
|
2818
2818
|
));
|
|
2819
2819
|
}
|
|
@@ -2825,21 +2825,21 @@ function $r(n, e, t) {
|
|
|
2825
2825
|
let o = [], r = -1 / 0, c = 0, a = 1 / 0, l = -1 / 0;
|
|
2826
2826
|
const d = () => {
|
|
2827
2827
|
o.length !== 0 && i.push(new yt(
|
|
2828
|
-
|
|
2828
|
+
T.fromPointPoint(a, r, l, r + c),
|
|
2829
2829
|
o
|
|
2830
2830
|
));
|
|
2831
2831
|
};
|
|
2832
2832
|
for (const u of s) {
|
|
2833
2833
|
const h = u.rect;
|
|
2834
2834
|
o.length > 0 && Oi(
|
|
2835
|
-
|
|
2835
|
+
T.fromPointSize(a, r, l - a, c),
|
|
2836
2836
|
h
|
|
2837
2837
|
) ? (o.push(u), c = Math.max(c, h.height), a = Math.min(a, h.left), l = Math.max(l, h.right)) : (d(), o = [u], r = h.y, c = h.height, a = h.left, l = h.right);
|
|
2838
2838
|
}
|
|
2839
|
-
return d(), new
|
|
2839
|
+
return d(), new Ze(i);
|
|
2840
2840
|
}
|
|
2841
2841
|
function Mi(n, e, t, s) {
|
|
2842
|
-
if (e.ast instanceof
|
|
2842
|
+
if (e.ast instanceof Y && e.children.length === 0 && e.dom instanceof Element) {
|
|
2843
2843
|
const o = e.ast.source;
|
|
2844
2844
|
if (!o)
|
|
2845
2845
|
return;
|
|
@@ -2849,7 +2849,7 @@ function Mi(n, e, t, s) {
|
|
|
2849
2849
|
const c = s.toLocalRect(r), a = t + (e.ast.leadingTrivia?.length ?? 0);
|
|
2850
2850
|
n.push(new be(
|
|
2851
2851
|
v.ofStartAndLength(a, o.length),
|
|
2852
|
-
|
|
2852
|
+
T.fromPointSize(c.x, c.y, c.width, c.height)
|
|
2853
2853
|
));
|
|
2854
2854
|
return;
|
|
2855
2855
|
}
|
|
@@ -2865,7 +2865,7 @@ function Hr(n) {
|
|
|
2865
2865
|
e.push(t);
|
|
2866
2866
|
continue;
|
|
2867
2867
|
}
|
|
2868
|
-
e[e.length - 1] =
|
|
2868
|
+
e[e.length - 1] = T.fromPointPoint(
|
|
2869
2869
|
Math.min(s.left, t.left),
|
|
2870
2870
|
Math.min(s.top, t.top),
|
|
2871
2871
|
Math.max(s.right, t.right),
|
|
@@ -2897,11 +2897,11 @@ function zr(n) {
|
|
|
2897
2897
|
let t = parseFloat(e.lineHeight);
|
|
2898
2898
|
return isFinite(t) || (t = parseFloat(e.fontSize) * 1.2), t;
|
|
2899
2899
|
}
|
|
2900
|
-
function
|
|
2900
|
+
function Dt(n, e) {
|
|
2901
2901
|
if (e <= 0)
|
|
2902
|
-
return
|
|
2902
|
+
return T.fromPointSize(n.x, n.y, n.width, n.height);
|
|
2903
2903
|
const t = (e - n.height) / 2;
|
|
2904
|
-
return
|
|
2904
|
+
return T.fromPointSize(n.x, n.y - t, n.width, e);
|
|
2905
2905
|
}
|
|
2906
2906
|
function qr(n, e, t, s) {
|
|
2907
2907
|
const i = e.dom;
|
|
@@ -2913,7 +2913,7 @@ function qr(n, e, t, s) {
|
|
|
2913
2913
|
const r = s.toLocalRect(o);
|
|
2914
2914
|
n.push(new be(
|
|
2915
2915
|
v.fromTo(t, t + e.sourceLength),
|
|
2916
|
-
|
|
2916
|
+
T.fromPointSize(r.x, r.y, r.width, r.height)
|
|
2917
2917
|
));
|
|
2918
2918
|
}
|
|
2919
2919
|
class Ur {
|
|
@@ -2935,7 +2935,7 @@ class Ur {
|
|
|
2935
2935
|
...r.visualLineMap?.lines ?? [],
|
|
2936
2936
|
...i.get(r.block) ?? []
|
|
2937
2937
|
]);
|
|
2938
|
-
return new
|
|
2938
|
+
return new Ze(o);
|
|
2939
2939
|
});
|
|
2940
2940
|
setMeasurements(e, t) {
|
|
2941
2941
|
K((s) => {
|
|
@@ -3011,7 +3011,7 @@ function Xr(n) {
|
|
|
3011
3011
|
}
|
|
3012
3012
|
function Ii(n, e, t) {
|
|
3013
3013
|
for (const s of n.children)
|
|
3014
|
-
s instanceof
|
|
3014
|
+
s instanceof Y ? t.set(s, e) : (s instanceof ve || s instanceof H || s instanceof $) && Ii(s, e, t);
|
|
3015
3015
|
}
|
|
3016
3016
|
function Qr(n, e, t) {
|
|
3017
3017
|
const s = [];
|
|
@@ -3058,20 +3058,20 @@ function Ni(n, e) {
|
|
|
3058
3058
|
}
|
|
3059
3059
|
function Zr(n, e, t) {
|
|
3060
3060
|
const s = [];
|
|
3061
|
-
return
|
|
3061
|
+
return Zt(n, 0, e, s, t), s.sort((i, o) => i.start - o.start), s;
|
|
3062
3062
|
}
|
|
3063
|
-
function
|
|
3063
|
+
function Zt(n, e, t, s, i) {
|
|
3064
3064
|
if (!xt(n))
|
|
3065
3065
|
return;
|
|
3066
3066
|
if (n.kind !== "list") {
|
|
3067
3067
|
let c = e;
|
|
3068
3068
|
for (const a of n.children)
|
|
3069
|
-
|
|
3069
|
+
Zt(a, c, t, s, i), c += a.length;
|
|
3070
3070
|
return;
|
|
3071
3071
|
}
|
|
3072
3072
|
const o = n, r = Ai(o, t.delta(-e));
|
|
3073
3073
|
for (const c of Et(o))
|
|
3074
|
-
r.has(c.index) ?
|
|
3074
|
+
r.has(c.index) ? Zt(c.item, e + c.start, t, s, i) : Sn(c.item, e + c.start, s, i);
|
|
3075
3075
|
}
|
|
3076
3076
|
function Jr(n, e) {
|
|
3077
3077
|
const t = [], s = (i, o) => {
|
|
@@ -3130,10 +3130,10 @@ function xt(n) {
|
|
|
3130
3130
|
}
|
|
3131
3131
|
function Pi(n, e) {
|
|
3132
3132
|
const t = [];
|
|
3133
|
-
return
|
|
3133
|
+
return Sn(n, 0, t, e), t.sort((s, i) => s.start - i.start), t;
|
|
3134
3134
|
}
|
|
3135
|
-
function
|
|
3136
|
-
if (n instanceof
|
|
3135
|
+
function Sn(n, e, t, s) {
|
|
3136
|
+
if (n instanceof Y && s?.has(n))
|
|
3137
3137
|
return;
|
|
3138
3138
|
if (n.children.length === 0) {
|
|
3139
3139
|
(n instanceof E || o(n)) && t.push(v.ofStartAndLength(e, n.length));
|
|
@@ -3179,7 +3179,7 @@ function Cn(n, e, t, s) {
|
|
|
3179
3179
|
}
|
|
3180
3180
|
let r = e;
|
|
3181
3181
|
for (const c of n.children)
|
|
3182
|
-
|
|
3182
|
+
Sn(c, r, t, s), r += c.length;
|
|
3183
3183
|
}
|
|
3184
3184
|
const tc = (n) => n.cursorPosition.kind === "virtual" ? Ct(n, n.cursorPosition.line, "after", "right") : n.selection.isCollapsed ? N.source(Fe(
|
|
3185
3185
|
n.document,
|
|
@@ -3227,7 +3227,7 @@ const tc = (n) => n.cursorPosition.kind === "virtual" ? Ct(n, n.cursorPosition.l
|
|
|
3227
3227
|
!1,
|
|
3228
3228
|
n.markupSelectionRange ?? n.selection.range
|
|
3229
3229
|
));
|
|
3230
|
-
},
|
|
3230
|
+
}, Jt = (n) => n.cursorPosition.kind === "virtual" ? n.cursorPosition : N.source(me(
|
|
3231
3231
|
n.document,
|
|
3232
3232
|
n.markerVisibleBlocks,
|
|
3233
3233
|
n.selection.active,
|
|
@@ -3236,7 +3236,7 @@ const tc = (n) => n.cursorPosition.kind === "virtual" ? Ct(n, n.cursorPosition.l
|
|
|
3236
3236
|
"right",
|
|
3237
3237
|
!0,
|
|
3238
3238
|
n.markupSelectionRange ?? n.selection.range
|
|
3239
|
-
)),
|
|
3239
|
+
)), en = (n) => {
|
|
3240
3240
|
if (n.cursorPosition.kind === "virtual")
|
|
3241
3241
|
return n.cursorPosition;
|
|
3242
3242
|
const e = n.text.indexOf(`
|
|
@@ -3271,10 +3271,10 @@ const tc = (n) => n.cursorPosition.kind === "virtual" ? Ct(n, n.cursorPosition.l
|
|
|
3271
3271
|
return { position: n.cursorPosition, desiredColumn: void 0 };
|
|
3272
3272
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
3273
3273
|
if (e === void 0)
|
|
3274
|
-
return { position:
|
|
3274
|
+
return { position: Jt(n), desiredColumn: void 0 };
|
|
3275
3275
|
const t = n.lineMap.lineStartOffset(e), s = n.lineMap.lineEndOffset(e);
|
|
3276
3276
|
if (t === void 0 || s === void 0)
|
|
3277
|
-
return { position:
|
|
3277
|
+
return { position: Jt(n), desiredColumn: void 0 };
|
|
3278
3278
|
const i = t === 0 ? 0 : n.text.lastIndexOf(`
|
|
3279
3279
|
`, t - 1) + 1;
|
|
3280
3280
|
let o = t;
|
|
@@ -3301,9 +3301,9 @@ const tc = (n) => n.cursorPosition.kind === "virtual" ? Ct(n, n.cursorPosition.l
|
|
|
3301
3301
|
return { position: n.cursorPosition, desiredColumn: void 0 };
|
|
3302
3302
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
3303
3303
|
if (e === void 0)
|
|
3304
|
-
return { position:
|
|
3304
|
+
return { position: en(n), desiredColumn: void 0 };
|
|
3305
3305
|
const t = n.lineMap.lineEndOffset(e);
|
|
3306
|
-
return t === void 0 ? { position:
|
|
3306
|
+
return t === void 0 ? { position: en(n), desiredColumn: void 0 } : {
|
|
3307
3307
|
position: n.lineMap.positionAtOffsetInLine(e, me(
|
|
3308
3308
|
n.document,
|
|
3309
3309
|
n.markerVisibleBlocks,
|
|
@@ -3364,42 +3364,44 @@ function Bi(n, e) {
|
|
|
3364
3364
|
desiredColumn: t
|
|
3365
3365
|
};
|
|
3366
3366
|
}
|
|
3367
|
-
const
|
|
3367
|
+
const Je = {
|
|
3368
3368
|
tabSize: 4,
|
|
3369
3369
|
insertSpaces: !0
|
|
3370
3370
|
}, Ke = " ", mc = /^([ \t]*)(`{3,}|~{3,})([ \t]*)$/, pc = /^([ \t]*)(`{3,}|~{3,})/, Jn = (n) => {
|
|
3371
3371
|
const e = n.selection;
|
|
3372
3372
|
if (!e.isCollapsed)
|
|
3373
3373
|
return {
|
|
3374
|
-
edit:
|
|
3374
|
+
edit: L.delete(e.range),
|
|
3375
3375
|
selection: y.collapsed(e.range.start)
|
|
3376
3376
|
};
|
|
3377
3377
|
if (e.active === 0)
|
|
3378
3378
|
return;
|
|
3379
3379
|
const t = new v(Fe(n.document, n.markerVisibleBlocks, e.active, "left", n.markupSelectionRange ?? e.range), e.active);
|
|
3380
3380
|
return {
|
|
3381
|
-
edit:
|
|
3381
|
+
edit: L.delete(t),
|
|
3382
3382
|
selection: y.collapsed(t.start)
|
|
3383
3383
|
};
|
|
3384
3384
|
}, gc = (n) => {
|
|
3385
3385
|
const e = n.selection;
|
|
3386
3386
|
if (!e.isCollapsed)
|
|
3387
3387
|
return {
|
|
3388
|
-
edit:
|
|
3388
|
+
edit: L.delete(e.range),
|
|
3389
3389
|
selection: y.collapsed(e.range.start)
|
|
3390
3390
|
};
|
|
3391
3391
|
if (e.active >= n.text.length)
|
|
3392
3392
|
return;
|
|
3393
|
-
const t =
|
|
3393
|
+
const t = n.text.startsWith(`\r
|
|
3394
|
+
`, e.active) ? e.active + 2 : n.text[e.active] === `
|
|
3395
|
+
` ? e.active + 1 : Fe(n.document, n.markerVisibleBlocks, e.active, "right", n.markupSelectionRange ?? e.range), s = new v(e.active, t);
|
|
3394
3396
|
return {
|
|
3395
|
-
edit:
|
|
3396
|
-
selection: y.collapsed(
|
|
3397
|
+
edit: L.delete(s),
|
|
3398
|
+
selection: y.collapsed(s.start)
|
|
3397
3399
|
};
|
|
3398
3400
|
}, _c = (n) => {
|
|
3399
3401
|
const e = n.selection;
|
|
3400
3402
|
if (!e.isCollapsed)
|
|
3401
3403
|
return {
|
|
3402
|
-
edit:
|
|
3404
|
+
edit: L.delete(e.range),
|
|
3403
3405
|
selection: y.collapsed(e.range.start)
|
|
3404
3406
|
};
|
|
3405
3407
|
if (e.active === 0)
|
|
@@ -3414,7 +3416,7 @@ const Ze = {
|
|
|
3414
3416
|
const e = n.selection;
|
|
3415
3417
|
if (!e.isCollapsed)
|
|
3416
3418
|
return {
|
|
3417
|
-
edit:
|
|
3419
|
+
edit: L.delete(e.range),
|
|
3418
3420
|
selection: y.collapsed(e.range.start)
|
|
3419
3421
|
};
|
|
3420
3422
|
if (e.active >= n.text.length)
|
|
@@ -3429,7 +3431,7 @@ const Ze = {
|
|
|
3429
3431
|
const e = n.selection;
|
|
3430
3432
|
if (!e.isCollapsed)
|
|
3431
3433
|
return {
|
|
3432
|
-
edit:
|
|
3434
|
+
edit: L.delete(e.range),
|
|
3433
3435
|
selection: y.collapsed(e.range.start)
|
|
3434
3436
|
};
|
|
3435
3437
|
if (e.active === 0)
|
|
@@ -3448,7 +3450,7 @@ const Ze = {
|
|
|
3448
3450
|
const e = n.selection;
|
|
3449
3451
|
if (!e.isCollapsed)
|
|
3450
3452
|
return {
|
|
3451
|
-
edit:
|
|
3453
|
+
edit: L.delete(e.range),
|
|
3452
3454
|
selection: y.collapsed(e.range.start)
|
|
3453
3455
|
};
|
|
3454
3456
|
const t = n.text.indexOf(`
|
|
@@ -3475,27 +3477,27 @@ function St(n, e) {
|
|
|
3475
3477
|
break;
|
|
3476
3478
|
s < i.start && t.push(_e.delete(new v(s, Math.min(i.start, e.endExclusive)))), s = Math.max(s, i.endExclusive);
|
|
3477
3479
|
}
|
|
3478
|
-
return s < e.endExclusive && t.push(_e.delete(new v(s, e.endExclusive))), t.length === 0 ?
|
|
3480
|
+
return s < e.endExclusive && t.push(_e.delete(new v(s, e.endExclusive))), t.length === 0 ? L.empty : new L(t);
|
|
3479
3481
|
}
|
|
3480
3482
|
function bc(n, e) {
|
|
3481
3483
|
return (t) => {
|
|
3482
3484
|
const s = t.selection.range.substring(t.text);
|
|
3483
|
-
if (s.trim() && /^https?:\/\/\S+$/i.test(n) && URL.canParse(n) && !
|
|
3485
|
+
if (s.trim() && /^https?:\/\/\S+$/i.test(n) && URL.canParse(n) && !tn(t.document, (i, o) => o < t.selection.range.endExclusive && o + i.length > t.selection.range.start)) {
|
|
3484
3486
|
const i = n.replace(/&/g, "&").replace(/[\\()<>]/g, "\\$&"), o = s.replace(/\\[\s\S]|[\[\]]/g, (r) => r.length === 1 ? `\\${r}` : r);
|
|
3485
3487
|
for (const r of /* @__PURE__ */ new Set([s, o])) {
|
|
3486
|
-
const c = `[${r}](${i})`, a =
|
|
3487
|
-
if (
|
|
3488
|
+
const c = `[${r}](${i})`, a = L.replace(t.selection.range, c);
|
|
3489
|
+
if (tn(En(a.apply(t.text)), (l, d) => d === t.selection.range.start && l.length === c.length && l.url === n))
|
|
3488
3490
|
return { edit: a, selection: y.collapsed(t.selection.range.start + c.length) };
|
|
3489
3491
|
}
|
|
3490
3492
|
}
|
|
3491
3493
|
return Di(n, e)(t);
|
|
3492
3494
|
};
|
|
3493
3495
|
}
|
|
3494
|
-
function
|
|
3496
|
+
function tn(n, e, t = 0) {
|
|
3495
3497
|
if (n instanceof Ce && e(n, t))
|
|
3496
3498
|
return !0;
|
|
3497
3499
|
for (const s of n.children) {
|
|
3498
|
-
if (
|
|
3500
|
+
if (tn(s, e, t))
|
|
3499
3501
|
return !0;
|
|
3500
3502
|
t += s.length;
|
|
3501
3503
|
}
|
|
@@ -3506,17 +3508,17 @@ function Di(n, e, t = !1) {
|
|
|
3506
3508
|
const i = yc(s, n, e);
|
|
3507
3509
|
if (i)
|
|
3508
3510
|
return i;
|
|
3509
|
-
const o =
|
|
3511
|
+
const o = L.replace(s.selection.range, n), r = s.selection.range.start + n.length;
|
|
3510
3512
|
if (t && s.selection.isCollapsed && /^`{1,3}$/.test(n)) {
|
|
3511
|
-
const c = o.apply(s.text), a = c.slice(r - 3, r) === "```" ?
|
|
3512
|
-
if (a?.block.openFence?.content === "```" && !a.block.closeFence && (
|
|
3513
|
+
const c = o.apply(s.text), a = c.slice(r - 3, r) === "```" ? Ln(En(c), r) : void 0;
|
|
3514
|
+
if (a?.block.openFence?.content === "```" && !a.block.closeFence && (G(a.block, a.block.openFence) ?? -1) + a.block.openFence.length === a.offsetInBlock) {
|
|
3513
3515
|
const l = c.lastIndexOf(`
|
|
3514
3516
|
`, r - 1) + 1, u = c.slice(l, r - 3).replace(/(?:[*+-]|\d+[.)])([ \t]+)/g, (f) => " ".repeat(f.length)), h = s.text.includes(`\r
|
|
3515
3517
|
`) ? `\r
|
|
3516
3518
|
` : `
|
|
3517
3519
|
`;
|
|
3518
3520
|
return {
|
|
3519
|
-
edit:
|
|
3521
|
+
edit: L.replace(s.selection.range, n + h + u + "```"),
|
|
3520
3522
|
selection: y.collapsed(r)
|
|
3521
3523
|
};
|
|
3522
3524
|
}
|
|
@@ -3527,13 +3529,13 @@ function Di(n, e, t = !1) {
|
|
|
3527
3529
|
};
|
|
3528
3530
|
};
|
|
3529
3531
|
}
|
|
3530
|
-
function
|
|
3532
|
+
function Ln(n, e) {
|
|
3531
3533
|
if (n.kind === "codeBlock")
|
|
3532
3534
|
return { block: n, offsetInBlock: e };
|
|
3533
3535
|
let t = 0;
|
|
3534
3536
|
for (const s of n.children) {
|
|
3535
3537
|
if (t <= e && e <= t + s.length) {
|
|
3536
|
-
const i =
|
|
3538
|
+
const i = Ln(s, e - t);
|
|
3537
3539
|
if (i)
|
|
3538
3540
|
return i;
|
|
3539
3541
|
}
|
|
@@ -3552,7 +3554,7 @@ function yc(n, e, t) {
|
|
|
3552
3554
|
const d = l[1];
|
|
3553
3555
|
if (t.start !== o || t.endExclusive > i.start || t.length !== d.length || t.substring(n.text) !== d)
|
|
3554
3556
|
return;
|
|
3555
|
-
const u =
|
|
3557
|
+
const u = G(n.document, s);
|
|
3556
3558
|
if (u === void 0)
|
|
3557
3559
|
return;
|
|
3558
3560
|
const h = n.text.lastIndexOf(`
|
|
@@ -3568,23 +3570,23 @@ function yc(n, e, t) {
|
|
|
3568
3570
|
return;
|
|
3569
3571
|
const _ = g + l[2] + l[3], k = n.text.slice(o, i.start).length + e.length, w = g.length + Math.max(0, k - d.length);
|
|
3570
3572
|
return {
|
|
3571
|
-
edit:
|
|
3573
|
+
edit: L.replace(new v(o, c), _),
|
|
3572
3574
|
selection: y.collapsed(o + w)
|
|
3573
3575
|
};
|
|
3574
3576
|
}
|
|
3575
|
-
function Ec(n =
|
|
3577
|
+
function Ec(n = Je) {
|
|
3576
3578
|
return Lt(n), (e) => {
|
|
3577
|
-
const t = e.selection, s = t.range, i =
|
|
3578
|
-
if (a && l !== void 0 && d !== void 0 &&
|
|
3579
|
+
const t = e.selection, s = t.range, i = j(e.text, s.start), o = ts(e.text, s.start), c = s.endExclusive <= o && (s.start !== i || s.endExclusive !== o), a = t.isCollapsed ? Mn(e.document, e.text, t.active) : void 0, l = a ? G(e.document, a.item) : void 0, d = a ? G(e.document, a.item.marker) : void 0;
|
|
3580
|
+
if (a && l !== void 0 && d !== void 0 && j(e.text, d) === i) {
|
|
3579
3581
|
const m = Gi(
|
|
3580
3582
|
e.text,
|
|
3581
3583
|
l,
|
|
3582
3584
|
l + a.item.length,
|
|
3583
|
-
Xi(e.text,
|
|
3585
|
+
Xi(e.text, j(e.text, d), d)
|
|
3584
3586
|
), p = m[0];
|
|
3585
3587
|
if (a.index === 0 && d - p >= Ke.length)
|
|
3586
3588
|
return;
|
|
3587
|
-
const g = m.filter((k) => k < ts(e.text, k)).map((k) => _e.insert(k, Ke)), _ = new
|
|
3589
|
+
const g = m.filter((k) => k < ts(e.text, k)).map((k) => _e.insert(k, Ke)), _ = new L(g);
|
|
3588
3590
|
return {
|
|
3589
3591
|
edit: _,
|
|
3590
3592
|
selection: y.collapsed(_.mapOffset(t.active))
|
|
@@ -3592,35 +3594,35 @@ function Ec(n = Ze) {
|
|
|
3592
3594
|
}
|
|
3593
3595
|
if (t.isCollapsed || c) {
|
|
3594
3596
|
const m = Ki(
|
|
3595
|
-
e.text.slice(
|
|
3597
|
+
e.text.slice(j(e.text, s.start), s.start),
|
|
3596
3598
|
n
|
|
3597
3599
|
);
|
|
3598
3600
|
return {
|
|
3599
|
-
edit:
|
|
3601
|
+
edit: L.replace(s, m),
|
|
3600
3602
|
selection: y.collapsed(s.start + m.length)
|
|
3601
3603
|
};
|
|
3602
3604
|
}
|
|
3603
|
-
const u = Hi(e.text, s), h = u.map((m) => _e.insert(m, Bc(n))), f = new
|
|
3605
|
+
const u = Hi(e.text, s), h = u.map((m) => _e.insert(m, Bc(n))), f = new L(h);
|
|
3604
3606
|
return {
|
|
3605
3607
|
edit: f,
|
|
3606
3608
|
selection: $c(f, t, new Set(u))
|
|
3607
3609
|
};
|
|
3608
3610
|
};
|
|
3609
3611
|
}
|
|
3610
|
-
function Fi(n =
|
|
3612
|
+
function Fi(n = Je) {
|
|
3611
3613
|
return Lt(n), (e) => {
|
|
3612
3614
|
if (e.selection.isCollapsed) {
|
|
3613
|
-
const i =
|
|
3614
|
-
if (i && o !== void 0 && r !== void 0 &&
|
|
3615
|
+
const i = Mn(e.document, e.text, e.selection.active), o = i ? G(e.document, i.item) : void 0, r = i ? G(e.document, i.item.marker) : void 0;
|
|
3616
|
+
if (i && o !== void 0 && r !== void 0 && j(e.text, r) === j(e.text, e.selection.active)) {
|
|
3615
3617
|
const c = Gi(
|
|
3616
3618
|
e.text,
|
|
3617
3619
|
o,
|
|
3618
3620
|
o + i.item.length,
|
|
3619
|
-
Xi(e.text,
|
|
3621
|
+
Xi(e.text, j(e.text, r), r)
|
|
3620
3622
|
).flatMap((l) => e.text.slice(l, l + Ke.length) === Ke ? [_e.delete(new v(l, l + Ke.length))] : []);
|
|
3621
3623
|
if (c.length === 0)
|
|
3622
3624
|
return;
|
|
3623
|
-
const a = new
|
|
3625
|
+
const a = new L(c);
|
|
3624
3626
|
return {
|
|
3625
3627
|
edit: a,
|
|
3626
3628
|
selection: y.collapsed(a.mapOffset(e.selection.active))
|
|
@@ -3637,7 +3639,7 @@ function Fi(n = Ze) {
|
|
|
3637
3639
|
}
|
|
3638
3640
|
if (t.length === 0)
|
|
3639
3641
|
return;
|
|
3640
|
-
const s = new
|
|
3642
|
+
const s = new L(t);
|
|
3641
3643
|
return {
|
|
3642
3644
|
edit: s,
|
|
3643
3645
|
selection: Wc(s, e.selection)
|
|
@@ -3645,7 +3647,7 @@ function Fi(n = Ze) {
|
|
|
3645
3647
|
};
|
|
3646
3648
|
}
|
|
3647
3649
|
const xc = (n) => {
|
|
3648
|
-
const e =
|
|
3650
|
+
const e = L.replace(n.selection.range, `
|
|
3649
3651
|
|
|
3650
3652
|
`), t = n.selection.range.start + 2;
|
|
3651
3653
|
return {
|
|
@@ -3653,7 +3655,7 @@ const xc = (n) => {
|
|
|
3653
3655
|
selection: y.collapsed(t)
|
|
3654
3656
|
};
|
|
3655
3657
|
}, Cc = (n) => {
|
|
3656
|
-
const e =
|
|
3658
|
+
const e = L.replace(n.selection.range, `
|
|
3657
3659
|
`), t = n.selection.range.start + 1;
|
|
3658
3660
|
return {
|
|
3659
3661
|
edit: e,
|
|
@@ -3665,7 +3667,7 @@ const xc = (n) => {
|
|
|
3665
3667
|
for (; t < 2 && n.text[e - 1 - t] === " "; )
|
|
3666
3668
|
t++;
|
|
3667
3669
|
const i = " ".repeat(2 - t) + `
|
|
3668
|
-
`, o =
|
|
3670
|
+
`, o = L.replace(n.selection.range, i), r = e + i.length;
|
|
3669
3671
|
return {
|
|
3670
3672
|
edit: o,
|
|
3671
3673
|
selection: y.collapsed(r)
|
|
@@ -3675,17 +3677,17 @@ function Ve(n) {
|
|
|
3675
3677
|
const e = n.activeBlock;
|
|
3676
3678
|
if (!n.selection.isCollapsed || !e)
|
|
3677
3679
|
return;
|
|
3678
|
-
const t =
|
|
3680
|
+
const t = Tt(n.document, e);
|
|
3679
3681
|
if (t !== void 0)
|
|
3680
3682
|
switch (e.kind) {
|
|
3681
3683
|
case "paragraph":
|
|
3682
3684
|
case "heading":
|
|
3683
3685
|
case "thematicBreak":
|
|
3684
3686
|
case "video":
|
|
3685
|
-
return n.selection.active >=
|
|
3687
|
+
return n.selection.active >= Ge(e, t) ? Ft(n, e, t) : void 0;
|
|
3686
3688
|
case "frontMatter":
|
|
3687
3689
|
case "codeBlock":
|
|
3688
|
-
return e.closeFence && n.selection.active >=
|
|
3690
|
+
return e.closeFence && n.selection.active >= Ge(e, t) ? Ft(n, e, t) : void 0;
|
|
3689
3691
|
case "blockQuote":
|
|
3690
3692
|
return Ic(n);
|
|
3691
3693
|
case "unhandledBlock": {
|
|
@@ -3693,7 +3695,7 @@ function Ve(n) {
|
|
|
3693
3695
|
if (s?.kind !== "complete")
|
|
3694
3696
|
return;
|
|
3695
3697
|
const i = t + s.leadingWhitespace.length + s.opening.length + s.body.length + s.closing.length;
|
|
3696
|
-
return n.selection.active >= i ?
|
|
3698
|
+
return n.selection.active >= i ? Ft(n, e, t) : void 0;
|
|
3697
3699
|
}
|
|
3698
3700
|
default:
|
|
3699
3701
|
return;
|
|
@@ -3703,8 +3705,18 @@ const Lc = (n, e = !1) => {
|
|
|
3703
3705
|
const t = n.selection, s = n.activeBlock;
|
|
3704
3706
|
if (!t.isCollapsed || !s)
|
|
3705
3707
|
return de(n);
|
|
3708
|
+
if (s.kind === "heading") {
|
|
3709
|
+
const i = Tt(n.document, s), o = G(n.document, s.marker);
|
|
3710
|
+
if (i !== void 0 && o !== void 0 && t.active === o + s.marker.length && t.active < Ge(s, i))
|
|
3711
|
+
return {
|
|
3712
|
+
kind: "edit",
|
|
3713
|
+
edit: L.insert(i, `
|
|
3714
|
+
`),
|
|
3715
|
+
selection: y.collapsed(t.active + 1)
|
|
3716
|
+
};
|
|
3717
|
+
}
|
|
3706
3718
|
if (e) {
|
|
3707
|
-
const i =
|
|
3719
|
+
const i = Ln(n.document, t.active);
|
|
3708
3720
|
if (i?.block.openFence && i.offsetInBlock <= i.block.codeOffset + (i.block.code?.length ?? 0))
|
|
3709
3721
|
return Vi(n, i.block);
|
|
3710
3722
|
const o = Ui(n.document, n.text, t.active);
|
|
@@ -3731,13 +3743,13 @@ const Lc = (n, e = !1) => {
|
|
|
3731
3743
|
}
|
|
3732
3744
|
};
|
|
3733
3745
|
function Tc(n, e) {
|
|
3734
|
-
const t = n.selection, s =
|
|
3746
|
+
const t = n.selection, s = Tt(n.document, e);
|
|
3735
3747
|
if (s === void 0)
|
|
3736
3748
|
return de(n);
|
|
3737
|
-
const i =
|
|
3749
|
+
const i = Ge(e, s);
|
|
3738
3750
|
return t.active < i ? {
|
|
3739
3751
|
kind: "edit",
|
|
3740
|
-
edit:
|
|
3752
|
+
edit: L.replace(t.range, `
|
|
3741
3753
|
|
|
3742
3754
|
`),
|
|
3743
3755
|
selection: y.collapsed(t.range.start + 2)
|
|
@@ -3754,14 +3766,14 @@ function Vi(n, e) {
|
|
|
3754
3766
|
for (; i < t.active && (n.text[i] === " " || n.text[i] === " "); )
|
|
3755
3767
|
i++;
|
|
3756
3768
|
const o = n.text.slice(s, i), r = `
|
|
3757
|
-
` + o, c =
|
|
3769
|
+
` + o, c = Tn(t, r);
|
|
3758
3770
|
return c.kind !== "edit" || e.kind !== "codeBlock" || o.length === 0 ? c : {
|
|
3759
3771
|
...c,
|
|
3760
3772
|
generatedIndentation: v.ofStartAndLength(t.active + 1, o.length)
|
|
3761
3773
|
};
|
|
3762
3774
|
}
|
|
3763
|
-
function
|
|
3764
|
-
const s =
|
|
3775
|
+
function Ft(n, e, t) {
|
|
3776
|
+
const s = Ge(e, t), i = t + e.length;
|
|
3765
3777
|
return {
|
|
3766
3778
|
kind: "pending",
|
|
3767
3779
|
anchorBlock: e,
|
|
@@ -3773,7 +3785,7 @@ function Dt(n, e, t) {
|
|
|
3773
3785
|
function Oc(n, e) {
|
|
3774
3786
|
return e.htmlComment?.kind !== "complete" ? de(n) : Ve(n) ?? de(n);
|
|
3775
3787
|
}
|
|
3776
|
-
function
|
|
3788
|
+
function Ge(n, e) {
|
|
3777
3789
|
return e + n.length - Hc(n);
|
|
3778
3790
|
}
|
|
3779
3791
|
function Rc(n) {
|
|
@@ -3782,7 +3794,7 @@ function Rc(n) {
|
|
|
3782
3794
|
return Ve(n) ?? $i(n, t.start, t.endExclusive);
|
|
3783
3795
|
const o = `
|
|
3784
3796
|
` + s.replace(/\s*$/, " ");
|
|
3785
|
-
return
|
|
3797
|
+
return Tn(e, o);
|
|
3786
3798
|
}
|
|
3787
3799
|
function Ic(n) {
|
|
3788
3800
|
const e = n.activeBlock;
|
|
@@ -3791,7 +3803,7 @@ function Ic(n) {
|
|
|
3791
3803
|
const t = Wi(n.text, n.selection.active);
|
|
3792
3804
|
if (!t.prefix || t.content.slice(t.prefix.length).trim() !== "" || n.selection.active < t.start + t.prefix.length)
|
|
3793
3805
|
return;
|
|
3794
|
-
const s =
|
|
3806
|
+
const s = Tt(n.document, e);
|
|
3795
3807
|
if (s === void 0)
|
|
3796
3808
|
return;
|
|
3797
3809
|
const i = s + e.length;
|
|
@@ -3818,10 +3830,10 @@ function Wi(n, e) {
|
|
|
3818
3830
|
};
|
|
3819
3831
|
}
|
|
3820
3832
|
function es(n) {
|
|
3821
|
-
const e = n.selection, t =
|
|
3833
|
+
const e = n.selection, t = Mn(n.document, n.text, e.active);
|
|
3822
3834
|
if (!t)
|
|
3823
3835
|
return de(n);
|
|
3824
|
-
const { item: s, list: i } = t, o =
|
|
3836
|
+
const { item: s, list: i } = t, o = G(n.document, s);
|
|
3825
3837
|
if (o === void 0)
|
|
3826
3838
|
return de(n);
|
|
3827
3839
|
if (Ac(n, s, o)) {
|
|
@@ -3830,25 +3842,25 @@ function es(n) {
|
|
|
3830
3842
|
}
|
|
3831
3843
|
const r = `
|
|
3832
3844
|
` + Nc(n, i, s);
|
|
3833
|
-
return
|
|
3845
|
+
return Tn(e, r);
|
|
3834
3846
|
}
|
|
3835
3847
|
function $i(n, e, t) {
|
|
3836
3848
|
const s = e > 0 ? n.text.lastIndexOf(`
|
|
3837
3849
|
`, e - 1) : -1;
|
|
3838
3850
|
return s >= 0 ? {
|
|
3839
3851
|
kind: "edit",
|
|
3840
|
-
edit:
|
|
3852
|
+
edit: L.replace(new v(s, t), `
|
|
3841
3853
|
|
|
3842
3854
|
`),
|
|
3843
3855
|
selection: y.collapsed(s + 2)
|
|
3844
3856
|
} : {
|
|
3845
3857
|
kind: "edit",
|
|
3846
|
-
edit:
|
|
3858
|
+
edit: L.replace(new v(e, t), ""),
|
|
3847
3859
|
selection: y.collapsed(e)
|
|
3848
3860
|
};
|
|
3849
3861
|
}
|
|
3850
3862
|
function Nc(n, e, t) {
|
|
3851
|
-
const s =
|
|
3863
|
+
const s = G(n.document, t.marker), i = s === void 0 ? "" : n.text.slice(j(n.text, s), s), o = t.marker.content.trim();
|
|
3852
3864
|
let r = `${o.charAt(0) || "-"} `;
|
|
3853
3865
|
if (e.ordered) {
|
|
3854
3866
|
const c = /^(\d+)([.)])/.exec(o);
|
|
@@ -3857,7 +3869,7 @@ function Nc(n, e, t) {
|
|
|
3857
3869
|
return `${i}${r}${t.checked !== void 0 ? "[ ] " : ""}`;
|
|
3858
3870
|
}
|
|
3859
3871
|
function Ac(n, e, t) {
|
|
3860
|
-
const s =
|
|
3872
|
+
const s = G(n.document, e.marker);
|
|
3861
3873
|
if (s === void 0)
|
|
3862
3874
|
return !1;
|
|
3863
3875
|
const i = n.text.slice(
|
|
@@ -3866,10 +3878,10 @@ function Ac(n, e, t) {
|
|
|
3866
3878
|
);
|
|
3867
3879
|
return e.checked === void 0 && i.startsWith("[]") ? !1 : i.trim().length === 0 || (e.checked !== void 0 ? /^\[[ \txX]?\][ \t\r\n]*$/ : /^\[[ xX]?\](?=[ \t\r\n])[ \t\r\n]*$/).test(i);
|
|
3868
3880
|
}
|
|
3869
|
-
function
|
|
3881
|
+
function Tn(n, e) {
|
|
3870
3882
|
return {
|
|
3871
3883
|
kind: "edit",
|
|
3872
|
-
edit:
|
|
3884
|
+
edit: L.replace(n.range, e),
|
|
3873
3885
|
selection: y.collapsed(n.range.start + e.length)
|
|
3874
3886
|
};
|
|
3875
3887
|
}
|
|
@@ -3878,7 +3890,7 @@ function Pc(n, e) {
|
|
|
3878
3890
|
`, e);
|
|
3879
3891
|
return t === -1 ? n.length : t;
|
|
3880
3892
|
}
|
|
3881
|
-
function
|
|
3893
|
+
function j(n, e) {
|
|
3882
3894
|
return n.lastIndexOf(`
|
|
3883
3895
|
`, Math.max(0, e - 1)) + 1;
|
|
3884
3896
|
}
|
|
@@ -3888,7 +3900,7 @@ function ts(n, e) {
|
|
|
3888
3900
|
return t === -1 ? n.length : t;
|
|
3889
3901
|
}
|
|
3890
3902
|
function Hi(n, e) {
|
|
3891
|
-
const t = [
|
|
3903
|
+
const t = [j(n, e.start)], s = e.endExclusive > e.start && n[e.endExclusive - 1] === `
|
|
3892
3904
|
` ? e.endExclusive - 1 : e.endExclusive;
|
|
3893
3905
|
let i = n.indexOf(`
|
|
3894
3906
|
`, t[0]) + 1;
|
|
@@ -3897,7 +3909,7 @@ function Hi(n, e) {
|
|
|
3897
3909
|
`, i) + 1;
|
|
3898
3910
|
return t;
|
|
3899
3911
|
}
|
|
3900
|
-
function Ki(n, e =
|
|
3912
|
+
function Ki(n, e = Je) {
|
|
3901
3913
|
if (Lt(e), !e.insertSpaces)
|
|
3902
3914
|
return " ";
|
|
3903
3915
|
const t = qi(n, e.tabSize);
|
|
@@ -3906,7 +3918,7 @@ function Ki(n, e = Ze) {
|
|
|
3906
3918
|
function Bc(n) {
|
|
3907
3919
|
return n.insertSpaces ? " ".repeat(n.tabSize) : " ";
|
|
3908
3920
|
}
|
|
3909
|
-
function zi(n, e =
|
|
3921
|
+
function zi(n, e = Je) {
|
|
3910
3922
|
Lt(e);
|
|
3911
3923
|
const t = qi(n, e.tabSize);
|
|
3912
3924
|
if (t === 0)
|
|
@@ -3929,7 +3941,7 @@ function Fc(n, e) {
|
|
|
3929
3941
|
t++;
|
|
3930
3942
|
return t;
|
|
3931
3943
|
}
|
|
3932
|
-
function
|
|
3944
|
+
function Mn(n, e, t) {
|
|
3933
3945
|
const s = (o, r, c, a) => {
|
|
3934
3946
|
const l = o instanceof $ && c !== void 0 && a !== void 0 ? { list: c, item: o, index: a } : void 0;
|
|
3935
3947
|
let d = r, u;
|
|
@@ -3942,8 +3954,8 @@ function Tn(n, e, t) {
|
|
|
3942
3954
|
return u ?? l;
|
|
3943
3955
|
}, i = s(n, 0, void 0, void 0);
|
|
3944
3956
|
if (i) {
|
|
3945
|
-
const o =
|
|
3946
|
-
if (o !== void 0 &&
|
|
3957
|
+
const o = G(n, i.item.marker);
|
|
3958
|
+
if (o !== void 0 && j(e, o) === j(e, t))
|
|
3947
3959
|
return i;
|
|
3948
3960
|
}
|
|
3949
3961
|
return Ui(n, e, t) ?? i;
|
|
@@ -3953,8 +3965,8 @@ function Ui(n, e, t) {
|
|
|
3953
3965
|
const i = (o) => {
|
|
3954
3966
|
if (o instanceof H)
|
|
3955
3967
|
for (let r = 0; r < o.items.length; r++) {
|
|
3956
|
-
const c = o.items[r], a =
|
|
3957
|
-
a !== void 0 &&
|
|
3968
|
+
const c = o.items[r], a = G(n, c.marker);
|
|
3969
|
+
a !== void 0 && j(e, a) === j(e, t) && (s = { list: o, item: c, index: r });
|
|
3958
3970
|
}
|
|
3959
3971
|
for (const r of o.children)
|
|
3960
3972
|
i(r);
|
|
@@ -3963,7 +3975,7 @@ function Ui(n, e, t) {
|
|
|
3963
3975
|
}
|
|
3964
3976
|
function Gi(n, e, t, s) {
|
|
3965
3977
|
const i = [];
|
|
3966
|
-
let o =
|
|
3978
|
+
let o = j(n, e);
|
|
3967
3979
|
for (; o < t; ) {
|
|
3968
3980
|
i.push(Vc(n, o, s));
|
|
3969
3981
|
const r = n.indexOf(`
|
|
@@ -4023,7 +4035,7 @@ function de(n) {
|
|
|
4023
4035
|
const e = Cc(n);
|
|
4024
4036
|
return { kind: "edit", edit: e.edit, selection: e.selection };
|
|
4025
4037
|
}
|
|
4026
|
-
function
|
|
4038
|
+
function Tt(n, e) {
|
|
4027
4039
|
let t = 0;
|
|
4028
4040
|
for (const s of n.children) {
|
|
4029
4041
|
if (s === e)
|
|
@@ -4041,10 +4053,10 @@ function Hc(n) {
|
|
|
4041
4053
|
const Kc = (n) => Qi(n, !1), zc = (n) => Qi(n, !0), qc = (n) => ji(n, !1), Uc = (n) => ji(n, !0), Gc = (n) => {
|
|
4042
4054
|
if (n.text.length === 0)
|
|
4043
4055
|
return;
|
|
4044
|
-
const e =
|
|
4056
|
+
const e = Mt(n), t = n.selection.active - Pe(n.text, n.selection.active);
|
|
4045
4057
|
let s, i;
|
|
4046
4058
|
e.endExclusive < n.text.length ? (s = new v(e.start, e.endExclusive + 1), i = e.start) : e.start > 0 ? (i = Pe(n.text, e.start - 1), s = new v(e.start - 1, e.endExclusive)) : (s = new v(0, n.text.length), i = 0);
|
|
4047
|
-
const o =
|
|
4059
|
+
const o = L.delete(s), r = o.apply(n.text), c = Be(r, i);
|
|
4048
4060
|
return {
|
|
4049
4061
|
edit: o,
|
|
4050
4062
|
selection: y.collapsed(Math.min(i + t, c))
|
|
@@ -4053,19 +4065,19 @@ const Kc = (n) => Qi(n, !1), zc = (n) => Qi(n, !0), qc = (n) => ji(n, !1), Uc =
|
|
|
4053
4065
|
const e = Pe(n.text, n.selection.range.start), t = Be(n.text, e);
|
|
4054
4066
|
if (t === n.text.length)
|
|
4055
4067
|
return;
|
|
4056
|
-
const s =
|
|
4068
|
+
const s = Mt(n), i = s.endExclusive === t ? Be(n.text, t + 1) : s.endExclusive, { text: o, lines: r } = Qc(n.text, e, i), c = L.replace(new v(e, i), o), a = n.selection.isCollapsed ? y.collapsed(r[0].outputEndExclusive) : new y(
|
|
4057
4069
|
ns(r, n.selection.anchor),
|
|
4058
4070
|
ns(r, n.selection.active)
|
|
4059
4071
|
);
|
|
4060
4072
|
return { edit: c, selection: a };
|
|
4061
4073
|
};
|
|
4062
4074
|
function Qi(n, e) {
|
|
4063
|
-
const t =
|
|
4075
|
+
const t = Mt(n), s = e && t.endExclusive === n.text.length ? `
|
|
4064
4076
|
${t.text}` : `${t.text}
|
|
4065
4077
|
`, i = e ? Math.min(t.endExclusive + 1, n.text.length) : t.start, o = e ? t.start + t.text.length + 1 : t.start, r = !e || t.endExclusive < n.text.length;
|
|
4066
4078
|
return {
|
|
4067
|
-
edit:
|
|
4068
|
-
selection:
|
|
4079
|
+
edit: L.insert(i, s),
|
|
4080
|
+
selection: nn(
|
|
4069
4081
|
n.selection,
|
|
4070
4082
|
t.start,
|
|
4071
4083
|
o,
|
|
@@ -4074,18 +4086,18 @@ ${t.text}` : `${t.text}
|
|
|
4074
4086
|
};
|
|
4075
4087
|
}
|
|
4076
4088
|
function ji(n, e) {
|
|
4077
|
-
const t =
|
|
4089
|
+
const t = Mt(n);
|
|
4078
4090
|
if (e) {
|
|
4079
4091
|
if (t.endExclusive === n.text.length)
|
|
4080
4092
|
return;
|
|
4081
4093
|
const o = t.endExclusive + 1, r = Be(n.text, o), c = n.text.slice(o, r), a = t.start + c.length + 1;
|
|
4082
4094
|
return {
|
|
4083
|
-
edit:
|
|
4095
|
+
edit: L.replace(
|
|
4084
4096
|
new v(t.start, r),
|
|
4085
4097
|
`${c}
|
|
4086
4098
|
${t.text}`
|
|
4087
4099
|
),
|
|
4088
|
-
selection:
|
|
4100
|
+
selection: nn(
|
|
4089
4101
|
n.selection,
|
|
4090
4102
|
t.start,
|
|
4091
4103
|
a,
|
|
@@ -4097,12 +4109,12 @@ ${t.text}`
|
|
|
4097
4109
|
return;
|
|
4098
4110
|
const s = Pe(n.text, t.start - 1), i = n.text.slice(s, t.start - 1);
|
|
4099
4111
|
return {
|
|
4100
|
-
edit:
|
|
4112
|
+
edit: L.replace(
|
|
4101
4113
|
new v(s, t.endExclusive),
|
|
4102
4114
|
`${t.text}
|
|
4103
4115
|
${i}`
|
|
4104
4116
|
),
|
|
4105
|
-
selection:
|
|
4117
|
+
selection: nn(
|
|
4106
4118
|
n.selection,
|
|
4107
4119
|
t.start,
|
|
4108
4120
|
s,
|
|
@@ -4110,7 +4122,7 @@ ${i}`
|
|
|
4110
4122
|
)
|
|
4111
4123
|
};
|
|
4112
4124
|
}
|
|
4113
|
-
function
|
|
4125
|
+
function Mt(n) {
|
|
4114
4126
|
const e = n.selection.range, t = Pe(n.text, e.start), s = !n.selection.isCollapsed && e.endExclusive > t && Pe(n.text, e.endExclusive) === e.endExclusive ? e.endExclusive - 1 : e.endExclusive, i = Be(n.text, s);
|
|
4115
4127
|
return {
|
|
4116
4128
|
start: t,
|
|
@@ -4118,7 +4130,7 @@ function Tt(n) {
|
|
|
4118
4130
|
text: n.text.slice(t, i)
|
|
4119
4131
|
};
|
|
4120
4132
|
}
|
|
4121
|
-
function
|
|
4133
|
+
function nn(n, e, t, s) {
|
|
4122
4134
|
const i = (o) => t + Math.min(o - e, s);
|
|
4123
4135
|
return new y(i(n.anchor), i(n.active));
|
|
4124
4136
|
}
|
|
@@ -4172,12 +4184,12 @@ const jc = (n) => new y(0, n.text.length), Yc = (n, e) => {
|
|
|
4172
4184
|
function Zc(n, e) {
|
|
4173
4185
|
return new y(e.start, e.endExclusive);
|
|
4174
4186
|
}
|
|
4175
|
-
const ss = /* @__PURE__ */ new WeakMap(),
|
|
4187
|
+
const ss = /* @__PURE__ */ new WeakMap(), Vt = /* @__PURE__ */ new WeakMap();
|
|
4176
4188
|
class ce extends W {
|
|
4177
4189
|
constructor(e, t, s = Jc) {
|
|
4178
4190
|
super(), this.ast = e, this.dom = t, this._children = s, ss.set(t, this);
|
|
4179
4191
|
for (const i of s)
|
|
4180
|
-
|
|
4192
|
+
Vt.set(i, this);
|
|
4181
4193
|
}
|
|
4182
4194
|
_children;
|
|
4183
4195
|
/** This node's view children (a mirror of `ast.children`). */
|
|
@@ -4198,7 +4210,7 @@ class ce extends W {
|
|
|
4198
4210
|
t.dispose();
|
|
4199
4211
|
this._children = e;
|
|
4200
4212
|
for (const t of e)
|
|
4201
|
-
|
|
4213
|
+
Vt.set(t, this);
|
|
4202
4214
|
}
|
|
4203
4215
|
dispose() {
|
|
4204
4216
|
for (const e of this._children)
|
|
@@ -4225,7 +4237,7 @@ class ce extends W {
|
|
|
4225
4237
|
}
|
|
4226
4238
|
/** The view node that rendered this node's parent, or `undefined` for a root. */
|
|
4227
4239
|
get parent() {
|
|
4228
|
-
return
|
|
4240
|
+
return Vt.get(this);
|
|
4229
4241
|
}
|
|
4230
4242
|
/**
|
|
4231
4243
|
* Closest view node owning `domNode`: the node itself if registered, else
|
|
@@ -4327,7 +4339,7 @@ class ce extends W {
|
|
|
4327
4339
|
}
|
|
4328
4340
|
}
|
|
4329
4341
|
const Jc = [];
|
|
4330
|
-
function
|
|
4342
|
+
function sn(n, e) {
|
|
4331
4343
|
const t = n.ownerDocument?.activeElement, s = t instanceof HTMLElement && e.some((r) => r === t || r instanceof Element && r.contains(t));
|
|
4332
4344
|
let i = n.firstChild, o = 0;
|
|
4333
4345
|
for (; o < e.length && i === e[o]; o++)
|
|
@@ -4415,17 +4427,17 @@ class sa extends W {
|
|
|
4415
4427
|
}
|
|
4416
4428
|
}
|
|
4417
4429
|
}
|
|
4418
|
-
class
|
|
4430
|
+
class Xe {
|
|
4419
4431
|
static create(e) {
|
|
4420
4432
|
const t = document.createElement("span");
|
|
4421
4433
|
t.dataset.mdUrl = e.href, t.setAttribute("role", "link"), t.tabIndex = 0;
|
|
4422
4434
|
const s = document.createElement("span");
|
|
4423
4435
|
s.textContent = e.authoredLabel;
|
|
4424
|
-
const i = new
|
|
4436
|
+
const i = new Xe(t, s);
|
|
4425
4437
|
return i.update(e.presentation), i;
|
|
4426
4438
|
}
|
|
4427
4439
|
static mount(e, t) {
|
|
4428
|
-
return new
|
|
4440
|
+
return new Xe(e, t);
|
|
4429
4441
|
}
|
|
4430
4442
|
static clear(e) {
|
|
4431
4443
|
e.classList.remove("md-rich-link", "md-rich-link-unavailable", "md-rich-link-line-end"), e.style.removeProperty("--md-rich-link-line-width"), delete e.dataset.mdRichLinkKind, delete e.dataset.mdRichLinkStatus, delete e.dataset.mdRichLinkSecondaryStatus, e.removeAttribute("aria-label"), e.removeAttribute("title");
|
|
@@ -4447,17 +4459,17 @@ class Ge {
|
|
|
4447
4459
|
this._renderUnavailable();
|
|
4448
4460
|
return;
|
|
4449
4461
|
}
|
|
4450
|
-
this.element.classList.remove("md-rich-link-unavailable"), this.element.dataset.mdRichLinkKind = e.kind, this._icon.className = `md-rich-link-icon codicon codicon-${ra[e.kind]}`, this.authoredLabel.hidden = !!e.title, this._title.textContent = e.title ?? "", this._title.hidden = !e.title, this._detail.textContent = e.detail ?? "", this._detail.hidden = !e.detail, this._reference.textContent = e.reference ?? "", this._reference.hidden = !e.reference, aa(this._changes, e.changes), os(this.element, e.kind, this._status, e.status, "mdRichLinkStatus"), os(this.element, e.kind, this._secondaryStatus, e.secondaryStatus, "mdRichLinkSecondaryStatus"),
|
|
4462
|
+
this.element.classList.remove("md-rich-link-unavailable"), this.element.dataset.mdRichLinkKind = e.kind, this._icon.className = `md-rich-link-icon codicon codicon-${ra[e.kind]}`, this.authoredLabel.hidden = !!e.title, this._title.textContent = e.title ?? "", this._title.hidden = !e.title, this._detail.textContent = e.detail ?? "", this._detail.hidden = !e.detail, this._reference.textContent = e.reference ?? "", this._reference.hidden = !e.reference, aa(this._changes, e.changes), os(this.element, e.kind, this._status, e.status, "mdRichLinkStatus"), os(this.element, e.kind, this._secondaryStatus, e.secondaryStatus, "mdRichLinkSecondaryStatus"), sn(this.element, ha(e) ? [this._status.root, this.authoredLabel, this._title, this._detail, this._reference, this._changes.root, this._secondaryStatus.root] : [this._icon, this.authoredLabel, this._title, this._detail, this._reference, this._changes.root, this._status.root, this._secondaryStatus.root]), e.ariaLabel ? this.element.setAttribute("aria-label", e.ariaLabel) : this.element.removeAttribute("aria-label"), e.tooltip ? this.element.title = e.tooltip : this.element.removeAttribute("title"), this._layout();
|
|
4451
4463
|
}
|
|
4452
4464
|
_renderUnavailable() {
|
|
4453
|
-
this.element.classList.add("md-rich-link-unavailable"), delete this.element.dataset.mdRichLinkKind, delete this.element.dataset.mdRichLinkStatus, delete this.element.dataset.mdRichLinkSecondaryStatus, this._setDefaultOrder(), this._icon.className = "md-rich-link-icon codicon codicon-link", this.authoredLabel.hidden = !1, this._title.hidden = !0, this._detail.hidden = !0, this._reference.hidden = !0, Ji(this._changes),
|
|
4465
|
+
this.element.classList.add("md-rich-link-unavailable"), delete this.element.dataset.mdRichLinkKind, delete this.element.dataset.mdRichLinkStatus, delete this.element.dataset.mdRichLinkSecondaryStatus, this._setDefaultOrder(), this._icon.className = "md-rich-link-icon codicon codicon-link", this.authoredLabel.hidden = !1, this._title.hidden = !0, this._detail.hidden = !0, this._reference.hidden = !0, Ji(this._changes), on(this._status), on(this._secondaryStatus), this.element.removeAttribute("aria-label"), this.element.removeAttribute("title"), this._layout();
|
|
4454
4466
|
}
|
|
4455
4467
|
_layout() {
|
|
4456
4468
|
const e = this.element.closest(".md-paragraph, .md-heading, td, th");
|
|
4457
4469
|
e?.isConnected && Zi(e);
|
|
4458
4470
|
}
|
|
4459
4471
|
_setDefaultOrder() {
|
|
4460
|
-
|
|
4472
|
+
sn(this.element, [
|
|
4461
4473
|
this._icon,
|
|
4462
4474
|
this.authoredLabel,
|
|
4463
4475
|
this._title,
|
|
@@ -4558,14 +4570,14 @@ function Ji(n) {
|
|
|
4558
4570
|
}
|
|
4559
4571
|
function os(n, e, t, s, i) {
|
|
4560
4572
|
if (!s) {
|
|
4561
|
-
delete n.dataset[i],
|
|
4573
|
+
delete n.dataset[i], on(t);
|
|
4562
4574
|
return;
|
|
4563
4575
|
}
|
|
4564
4576
|
n.dataset[i] = s.kind;
|
|
4565
4577
|
const o = da(e, s.kind);
|
|
4566
4578
|
t.icon.className = `md-rich-link-status-icon codicon codicon-${ua(e, s.kind)}`, t.icon.hidden = o !== void 0, o ? (t.pixelSpinner ??= la(t.label), t.pixelSpinner.classList.toggle("monaco-pixel-spinner-ring", o === "ring")) : (t.pixelSpinner?.remove(), t.pixelSpinner = void 0), t.label.textContent = s.label, t.root.hidden = !1;
|
|
4567
4579
|
}
|
|
4568
|
-
function
|
|
4580
|
+
function on(n) {
|
|
4569
4581
|
n.icon.hidden = !1, n.pixelSpinner?.remove(), n.pixelSpinner = void 0, n.label.textContent = "", n.root.hidden = !0;
|
|
4570
4582
|
}
|
|
4571
4583
|
function la(n) {
|
|
@@ -4689,7 +4701,7 @@ function J(n, e, t) {
|
|
|
4689
4701
|
case "marker":
|
|
4690
4702
|
return n.ast.markerKind === "hardBreak" ? new ds(n, P(t, ds)) : new as(n, P(t, as));
|
|
4691
4703
|
case "glue":
|
|
4692
|
-
return n.ast.glueKind === "blockQuoteLineBreak" ? new ls(n, P(t, ls)) : new
|
|
4704
|
+
return n.ast.glueKind === "blockQuoteLineBreak" ? new ls(n, P(t, ls)) : new Qe(n, e, P(t, Qe));
|
|
4693
4705
|
case "heading":
|
|
4694
4706
|
return new us(n, e, P(t, us));
|
|
4695
4707
|
case "paragraph":
|
|
@@ -4739,9 +4751,9 @@ function J(n, e, t) {
|
|
|
4739
4751
|
case "document":
|
|
4740
4752
|
return new we(n, "div", "", e, Te(t));
|
|
4741
4753
|
case "diffHunk":
|
|
4742
|
-
return new on(n, e, P(t, on));
|
|
4743
|
-
case "diffDecoration":
|
|
4744
4754
|
return new rn(n, e, P(t, rn));
|
|
4755
|
+
case "diffDecoration":
|
|
4756
|
+
return new cn(n, e, P(t, cn));
|
|
4745
4757
|
}
|
|
4746
4758
|
}
|
|
4747
4759
|
function P(n, e) {
|
|
@@ -4759,7 +4771,7 @@ function Z(n, e, t, s) {
|
|
|
4759
4771
|
function fa(n, e) {
|
|
4760
4772
|
z(n, e.map((t) => t.mountNode));
|
|
4761
4773
|
}
|
|
4762
|
-
const z =
|
|
4774
|
+
const z = sn;
|
|
4763
4775
|
function ke(n) {
|
|
4764
4776
|
return (e, t) => J(e, n, t);
|
|
4765
4777
|
}
|
|
@@ -4767,7 +4779,7 @@ function eo(n) {
|
|
|
4767
4779
|
return (e, t) => e.kind === "marker" && e.ast.markerKind === "content" ? new In(e, document.createTextNode(e.ast.content)) : J(e, n, t);
|
|
4768
4780
|
}
|
|
4769
4781
|
const F = [];
|
|
4770
|
-
class
|
|
4782
|
+
class rn extends O {
|
|
4771
4783
|
_originalNode;
|
|
4772
4784
|
_modifiedNode;
|
|
4773
4785
|
constructor(e, t, s) {
|
|
@@ -4786,7 +4798,7 @@ function rs(n, e, t, s) {
|
|
|
4786
4798
|
const i = J(n.view, t, s), o = i.element;
|
|
4787
4799
|
return o.classList.add(e), o.classList.toggle("md-block-active", n.active), o.classList.toggle("md-markers-hidden", !n.active), i;
|
|
4788
4800
|
}
|
|
4789
|
-
class
|
|
4801
|
+
class cn extends O {
|
|
4790
4802
|
sideNode;
|
|
4791
4803
|
constructor(e, t, s) {
|
|
4792
4804
|
const i = s?.dom ?? document.createElement("div");
|
|
@@ -4849,15 +4861,15 @@ function ga(n, e, t) {
|
|
|
4849
4861
|
i.appendChild(o), s.appendChild(i);
|
|
4850
4862
|
const r = document.createTextNode(e.slice(t));
|
|
4851
4863
|
return s.appendChild(r), new O(n, s, [
|
|
4852
|
-
new
|
|
4853
|
-
new
|
|
4864
|
+
new X(n.ast, o, F, t),
|
|
4865
|
+
new X(n.ast, r, F, e.length - t)
|
|
4854
4866
|
]);
|
|
4855
4867
|
}
|
|
4856
4868
|
function cs(n) {
|
|
4857
4869
|
return n === " " || n === " " || n === `
|
|
4858
4870
|
` || n === "\r";
|
|
4859
4871
|
}
|
|
4860
|
-
const _a = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !1 },
|
|
4872
|
+
const _a = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !1 }, lt = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !0 }, On = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !1 };
|
|
4861
4873
|
function va(n, e, t) {
|
|
4862
4874
|
const s = e > 0 ? !cs(n[e - 1]) : t.leftBoundary, i = e < n.length - 1 ? !cs(n[e + 1]) : t.rightBoundary;
|
|
4863
4875
|
return s && i;
|
|
@@ -4919,7 +4931,7 @@ function fe(n, e, t, s) {
|
|
|
4919
4931
|
c.className = o.cls, c.appendChild(r), n.appendChild(c);
|
|
4920
4932
|
} else
|
|
4921
4933
|
n.appendChild(r);
|
|
4922
|
-
i.push(new
|
|
4934
|
+
i.push(new X(s, r, F, o.text.length));
|
|
4923
4935
|
}
|
|
4924
4936
|
return i;
|
|
4925
4937
|
}
|
|
@@ -4928,7 +4940,7 @@ class In extends O {
|
|
|
4928
4940
|
super(e, t, F);
|
|
4929
4941
|
}
|
|
4930
4942
|
}
|
|
4931
|
-
class
|
|
4943
|
+
class X extends ce {
|
|
4932
4944
|
_sourceLength;
|
|
4933
4945
|
constructor(e, t, s = F, i = e.length) {
|
|
4934
4946
|
super(e, t, s), this._sourceLength = i;
|
|
@@ -4937,7 +4949,7 @@ class G extends ce {
|
|
|
4937
4949
|
return this._sourceLength;
|
|
4938
4950
|
}
|
|
4939
4951
|
}
|
|
4940
|
-
class De extends
|
|
4952
|
+
class De extends X {
|
|
4941
4953
|
_span;
|
|
4942
4954
|
constructor(e, t) {
|
|
4943
4955
|
const s = document.createElement("span");
|
|
@@ -4960,15 +4972,15 @@ class as extends O {
|
|
|
4960
4972
|
l.className = "md-list-marker-symbol", a.appendChild(l);
|
|
4961
4973
|
const d = [
|
|
4962
4974
|
...We(l, s.content[0], s),
|
|
4963
|
-
...fe(a, s.content.slice(1),
|
|
4975
|
+
...fe(a, s.content.slice(1), lt, s)
|
|
4964
4976
|
];
|
|
4965
4977
|
super(e, a, d), this._span = a;
|
|
4966
4978
|
return;
|
|
4967
4979
|
}
|
|
4968
|
-
if ((s.markerKind === "listItemMarker" || e.visible && (s.markerKind === "reference" || s.markerKind === "blockQuoteContinuationMarker")) && Rn(s.content,
|
|
4980
|
+
if ((s.markerKind === "listItemMarker" || e.visible && (s.markerKind === "reference" || s.markerKind === "blockQuoteContinuationMarker")) && Rn(s.content, lt)) {
|
|
4969
4981
|
const a = document.createElement("span");
|
|
4970
4982
|
a.className = e.visible ? i : `${i} md-marker-hidden`;
|
|
4971
|
-
const l = fe(a, s.content,
|
|
4983
|
+
const l = fe(a, s.content, lt, s);
|
|
4972
4984
|
super(e, a, l), this._span = a;
|
|
4973
4985
|
return;
|
|
4974
4986
|
}
|
|
@@ -4981,10 +4993,10 @@ class as extends O {
|
|
|
4981
4993
|
return this._span;
|
|
4982
4994
|
}
|
|
4983
4995
|
}
|
|
4984
|
-
class
|
|
4996
|
+
class Qe extends O {
|
|
4985
4997
|
_span;
|
|
4986
4998
|
constructor(e, t, s) {
|
|
4987
|
-
const i =
|
|
4999
|
+
const i = Qe._build(e, t, s);
|
|
4988
5000
|
super(e, i.dom, i.children), this._span = i.span;
|
|
4989
5001
|
}
|
|
4990
5002
|
get mountNode() {
|
|
@@ -5027,7 +5039,7 @@ class ls extends O {
|
|
|
5027
5039
|
constructor(e, t) {
|
|
5028
5040
|
const s = t?._span ?? document.createElement("span");
|
|
5029
5041
|
s.className = "md-glue md-glue-blockQuoteLineBreak md-blockquote-linebreak";
|
|
5030
|
-
const i = t?.data.ast === e.ast && t.data.visible === e.visible, o = i ? t._holder : document.createElement("span"), r = i ? t.children : e.visible ? fe(o, e.ast.content,
|
|
5042
|
+
const i = t?.data.ast === e.ast && t.data.visible === e.visible, o = i ? t._holder : document.createElement("span"), r = i ? t.children : e.visible ? fe(o, e.ast.content, lt, e.ast) : We(o, e.ast.content, e.ast);
|
|
5031
5043
|
o.className = e.visible ? "md-blockquote-linebreak-source" : "md-blockquote-linebreak-source md-blockquote-linebreak-source-hidden";
|
|
5032
5044
|
const c = t?._break ?? document.createElement("br");
|
|
5033
5045
|
z(s, [o, c]), super(e, s, r), this._span = s, this._holder = o, this._break = c;
|
|
@@ -5073,7 +5085,7 @@ function io(n, e) {
|
|
|
5073
5085
|
}
|
|
5074
5086
|
function We(n, e, t) {
|
|
5075
5087
|
const s = document.createTextNode(e);
|
|
5076
|
-
return n.appendChild(s), [new
|
|
5088
|
+
return n.appendChild(s), [new X(t, s, F, e.length)];
|
|
5077
5089
|
}
|
|
5078
5090
|
class mt extends O {
|
|
5079
5091
|
constructor(e, t, s, i = "div") {
|
|
@@ -5111,7 +5123,7 @@ class we extends O {
|
|
|
5111
5123
|
function oo(n) {
|
|
5112
5124
|
for (let e = 0; e < n.length; e++) {
|
|
5113
5125
|
const t = n[e];
|
|
5114
|
-
if (!(t instanceof
|
|
5126
|
+
if (!(t instanceof Qe) || t.data.ast.glueKind !== "indent" || !t.data.listContinuation || t.data.listContinuation.outsideList) {
|
|
5115
5127
|
oo(t.children);
|
|
5116
5128
|
continue;
|
|
5117
5129
|
}
|
|
@@ -5246,8 +5258,8 @@ class gs extends O {
|
|
|
5246
5258
|
const a = Z(c, e.content, i?.children, (l, d) => {
|
|
5247
5259
|
const u = l.ast;
|
|
5248
5260
|
if (l.kind === "marker" && u.markerKind === "content") {
|
|
5249
|
-
const f = (d instanceof
|
|
5250
|
-
return new
|
|
5261
|
+
const f = (d instanceof X && d.dom.nodeType === globalThis.Node.TEXT_NODE && d.dom.data === u.content ? d.dom : void 0) ?? document.createTextNode(u.content);
|
|
5262
|
+
return new X(u, f);
|
|
5251
5263
|
}
|
|
5252
5264
|
return J(l, t, d);
|
|
5253
5265
|
});
|
|
@@ -5290,7 +5302,7 @@ class vs extends ce {
|
|
|
5290
5302
|
z(i, c.map((a) => a.mountNode)), super(e, i, c);
|
|
5291
5303
|
}
|
|
5292
5304
|
}
|
|
5293
|
-
class ks extends
|
|
5305
|
+
class ks extends X {
|
|
5294
5306
|
constructor(e, t, s, i) {
|
|
5295
5307
|
super(e, t, F, i), this._span = s;
|
|
5296
5308
|
}
|
|
@@ -5316,7 +5328,7 @@ class ws extends O {
|
|
|
5316
5328
|
);
|
|
5317
5329
|
if (super(e, d.dom, d.children), this._session = a, a && d.contentNode) {
|
|
5318
5330
|
const u = d.contentNode;
|
|
5319
|
-
this._snapshotSub =
|
|
5331
|
+
this._snapshotSub = mn(a.snapshot, () => {
|
|
5320
5332
|
const h = a.snapshot.get();
|
|
5321
5333
|
u.refresh(r, h.getTokens(v.ofLength(r.length)).tokens);
|
|
5322
5334
|
});
|
|
@@ -5374,7 +5386,7 @@ class An extends O {
|
|
|
5374
5386
|
l.element.classList.add("md-block", "md-code-block", "md-embedded-code-editor");
|
|
5375
5387
|
const w = l.estimateHeight?.(a.text);
|
|
5376
5388
|
w !== void 0 && (l.element.style.boxSizing = "border-box", l.element.style.minHeight = `${w}px`), l.onEdit = (b) => {
|
|
5377
|
-
const C = a.sourceOffset === 0 ? b : new
|
|
5389
|
+
const C = a.sourceOffset === 0 ? b : new L(
|
|
5378
5390
|
b.replacements.map((A) => _e.replace(A.replaceRange.delta(a.sourceOffset), A.newText))
|
|
5379
5391
|
);
|
|
5380
5392
|
t?.onEmbeddedCodeEditorEdit?.(i, C);
|
|
@@ -5406,22 +5418,22 @@ class An extends O {
|
|
|
5406
5418
|
for (const A of e.content) {
|
|
5407
5419
|
const ne = A.ast;
|
|
5408
5420
|
if (A.kind === "marker" && ne.markerKind === "content") {
|
|
5409
|
-
const
|
|
5410
|
-
b.appendChild(
|
|
5421
|
+
const Q = document.createTextNode(ne.content);
|
|
5422
|
+
b.appendChild(Q), C.push(new X(ne, Q));
|
|
5411
5423
|
} else if (A.kind === "marker" && ne.markerKind === "codeIndent") {
|
|
5412
|
-
const
|
|
5424
|
+
const Q = ne;
|
|
5413
5425
|
if (A.visible) {
|
|
5414
5426
|
const q = document.createElement("span");
|
|
5415
5427
|
q.className = "md-marker md-marker-codeIndent";
|
|
5416
|
-
const Le = fe(q,
|
|
5417
|
-
b.appendChild(q), C.push(new
|
|
5428
|
+
const Le = fe(q, Q.content, On, Q);
|
|
5429
|
+
b.appendChild(q), C.push(new X(Q, q, Le));
|
|
5418
5430
|
} else {
|
|
5419
5431
|
const q = J(A, t, void 0);
|
|
5420
5432
|
b.appendChild(q.mountNode), C.push(q);
|
|
5421
5433
|
}
|
|
5422
5434
|
} else {
|
|
5423
|
-
const
|
|
5424
|
-
w.appendChild(
|
|
5435
|
+
const Q = J(A, t, void 0);
|
|
5436
|
+
w.appendChild(Q.mountNode), C.push(Q);
|
|
5425
5437
|
}
|
|
5426
5438
|
}
|
|
5427
5439
|
m = w, p = C;
|
|
@@ -5429,7 +5441,7 @@ class An extends O {
|
|
|
5429
5441
|
const _ = r?.dom ?? document.createElement("div");
|
|
5430
5442
|
_.className = "md-block md-code-block-container";
|
|
5431
5443
|
const k = r?._copyAction ?? new sa(i, t);
|
|
5432
|
-
r && (r._copyAction = void 0), k.update(i, t), z(_, [k.element, m]), super(e, _, p), this._contentElement = m, this._copyAction = k, this._session = h, this._embeddedEditor = l, this._embeddedEditorFactoryVersion = t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorReadOnly = c, h && g && (this._snapshotSub =
|
|
5444
|
+
r && (r._copyAction = void 0), k.update(i, t), z(_, [k.element, m]), super(e, _, p), this._contentElement = m, this._copyAction = k, this._session = h, this._embeddedEditor = l, this._embeddedEditorFactoryVersion = t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorReadOnly = c, h && g && (this._snapshotSub = mn(h.snapshot, () => {
|
|
5433
5445
|
const w = h.snapshot.get();
|
|
5434
5446
|
g.refresh(o, w.getTokens(v.ofLength(o.length)).tokens);
|
|
5435
5447
|
}));
|
|
@@ -5477,7 +5489,7 @@ function ro(n, e, t, s, i, o, r) {
|
|
|
5477
5489
|
function ya(n, e, t, s, i) {
|
|
5478
5490
|
if (!s && !i) {
|
|
5479
5491
|
const o = document.createTextNode(e);
|
|
5480
|
-
return t.appendChild(o), new
|
|
5492
|
+
return t.appendChild(o), new X(n, o);
|
|
5481
5493
|
}
|
|
5482
5494
|
return new co(n, t, e, s ?? [{ length: e.length, className: void 0 }], i);
|
|
5483
5495
|
}
|
|
@@ -5515,7 +5527,7 @@ function bs(n, e, t, s, i) {
|
|
|
5515
5527
|
g.appendChild(p), e.appendChild(g);
|
|
5516
5528
|
} else
|
|
5517
5529
|
e.appendChild(p);
|
|
5518
|
-
o.push(new
|
|
5530
|
+
o.push(new X(n, p, F, m.length));
|
|
5519
5531
|
}
|
|
5520
5532
|
return o;
|
|
5521
5533
|
}
|
|
@@ -5532,10 +5544,10 @@ function lo(n, e, t) {
|
|
|
5532
5544
|
const s = e.filter((c) => c.length > 0 && c.start >= 0 && c.start + c.length <= t).slice().sort((c, a) => c.start - a.start), i = [];
|
|
5533
5545
|
let o = 0;
|
|
5534
5546
|
const r = (c) => {
|
|
5535
|
-
c > 0 && i.push(new
|
|
5547
|
+
c > 0 && i.push(new X(n, document.createTextNode(""), F, c));
|
|
5536
5548
|
};
|
|
5537
5549
|
for (const c of s)
|
|
5538
|
-
c.start < o || (r(c.start - o), i.push(new
|
|
5550
|
+
c.start < o || (r(c.start - o), i.push(new X(n, c.dom, F, c.length)), o = c.start + c.length);
|
|
5539
5551
|
return r(t - o), i;
|
|
5540
5552
|
}
|
|
5541
5553
|
class ys extends O {
|
|
@@ -5550,7 +5562,7 @@ class ys extends O {
|
|
|
5550
5562
|
for (const u of e.content)
|
|
5551
5563
|
if (u.ast === i.code) {
|
|
5552
5564
|
const h = document.createElement("code"), f = document.createTextNode(i.code.content);
|
|
5553
|
-
h.appendChild(f), l.appendChild(h), d.push(new
|
|
5565
|
+
h.appendChild(f), l.appendChild(h), d.push(new X(i.code, f));
|
|
5554
5566
|
} else {
|
|
5555
5567
|
const h = J(u, t, void 0);
|
|
5556
5568
|
l.appendChild(h.mountNode), d.push(h);
|
|
@@ -5723,10 +5735,10 @@ class Ms extends O {
|
|
|
5723
5735
|
}
|
|
5724
5736
|
let c;
|
|
5725
5737
|
const a = i ? r.querySelector(":scope > .md-rich-link-label") ?? document.createElement("span") : r, l = Z(a, e.content, s?.children, ke(t));
|
|
5726
|
-
if (i ? c =
|
|
5738
|
+
if (i ? c = Xe.mount(r, a) : (Xe.clear(r), z(r, l.map((d) => d.mountNode))), super(e, r, l), i && c) {
|
|
5727
5739
|
this._presentation = i;
|
|
5728
5740
|
const d = () => c.update(i.presentation.get());
|
|
5729
|
-
d(), this._presentationSubscription =
|
|
5741
|
+
d(), this._presentationSubscription = mn(i.presentation, d);
|
|
5730
5742
|
}
|
|
5731
5743
|
}
|
|
5732
5744
|
dispose() {
|
|
@@ -5834,13 +5846,13 @@ class Rs extends ce {
|
|
|
5834
5846
|
return new DOMRect(i?.right ?? e.left, e.top, 0, e.height);
|
|
5835
5847
|
}
|
|
5836
5848
|
}
|
|
5837
|
-
const xa = [],
|
|
5838
|
-
class
|
|
5849
|
+
const xa = [], it = 1e-7;
|
|
5850
|
+
class Ot {
|
|
5839
5851
|
constructor(e) {
|
|
5840
5852
|
this._getLocalToClientMatrix = e;
|
|
5841
5853
|
}
|
|
5842
5854
|
static forSvgOverlay(e) {
|
|
5843
|
-
return new
|
|
5855
|
+
return new Ot(() => {
|
|
5844
5856
|
if (!e.isConnected)
|
|
5845
5857
|
return new DOMMatrix();
|
|
5846
5858
|
const t = e.getScreenCTM();
|
|
@@ -5851,7 +5863,7 @@ class Mt {
|
|
|
5851
5863
|
}
|
|
5852
5864
|
capture() {
|
|
5853
5865
|
const e = this._getLocalToClientMatrix();
|
|
5854
|
-
if (e.is2D === !1 || Math.abs(e.b) >
|
|
5866
|
+
if (e.is2D === !1 || Math.abs(e.b) > it || Math.abs(e.c) > it || e.a <= it || e.d <= it)
|
|
5855
5867
|
throw new Error("Markdown editor geometry supports positive axis-aligned scale and translation only");
|
|
5856
5868
|
return new Ca(e);
|
|
5857
5869
|
}
|
|
@@ -5877,7 +5889,7 @@ class Ca {
|
|
|
5877
5889
|
}
|
|
5878
5890
|
_convertRect(e, t) {
|
|
5879
5891
|
const s = new DOMPoint(e.left, e.top).matrixTransform(t), i = new DOMPoint(e.left + e.width, e.top + e.height).matrixTransform(t);
|
|
5880
|
-
return
|
|
5892
|
+
return T.fromPointPoint(s.x, s.y, i.x, i.y);
|
|
5881
5893
|
}
|
|
5882
5894
|
}
|
|
5883
5895
|
class ho {
|
|
@@ -6055,7 +6067,7 @@ class ja {
|
|
|
6055
6067
|
}
|
|
6056
6068
|
kind = "diffDecoration";
|
|
6057
6069
|
}
|
|
6058
|
-
const
|
|
6070
|
+
const an = { showMarkup: !1, showTableGlue: !1, selectionInNode: void 0 };
|
|
6059
6071
|
function re(n) {
|
|
6060
6072
|
return n.inlineFlow ? n : { ...n, inlineFlow: !0 };
|
|
6061
6073
|
}
|
|
@@ -6074,8 +6086,8 @@ function mo(n, e, t, s, i) {
|
|
|
6074
6086
|
const k = i?.anchorBlock === m ? i.replaceRange.delta(-d) : void 0;
|
|
6075
6087
|
let w;
|
|
6076
6088
|
if (!p)
|
|
6077
|
-
w = g && !g.isActive && !k && m.kind !== "emptyBlock" ? g.view :
|
|
6078
|
-
...
|
|
6089
|
+
w = g && !g.isActive && !k && m.kind !== "emptyBlock" ? g.view : ln(m, {
|
|
6090
|
+
...an,
|
|
6079
6091
|
listContinuation: _,
|
|
6080
6092
|
pendingAnchorBlock: k ? m : void 0,
|
|
6081
6093
|
pendingReplacementInBlock: k
|
|
@@ -6085,7 +6097,7 @@ function mo(n, e, t, s, i) {
|
|
|
6085
6097
|
Math.max(0, t.start - d),
|
|
6086
6098
|
Math.min(m.length, t.endExclusive - d)
|
|
6087
6099
|
) : void 0;
|
|
6088
|
-
w =
|
|
6100
|
+
w = ln(m, {
|
|
6089
6101
|
showMarkup: !0,
|
|
6090
6102
|
showTableGlue: !1,
|
|
6091
6103
|
selectionInNode: b,
|
|
@@ -6108,15 +6120,15 @@ function mo(n, e, t, s, i) {
|
|
|
6108
6120
|
}
|
|
6109
6121
|
return new ho(n, a, l);
|
|
6110
6122
|
}
|
|
6111
|
-
function
|
|
6123
|
+
function ln(n, e, t) {
|
|
6112
6124
|
return $e(n, e, t);
|
|
6113
6125
|
}
|
|
6114
6126
|
function Ya(n, e, t, s = !1) {
|
|
6115
6127
|
return po(n, e, s, t);
|
|
6116
6128
|
}
|
|
6117
6129
|
function po(n, e, t, s) {
|
|
6118
|
-
const i = e ? { showMarkup: !0, showTableGlue: !1, selectionInNode: void 0, forceVideoSource: t } : t ? { ...
|
|
6119
|
-
return
|
|
6130
|
+
const i = e ? { showMarkup: !0, showTableGlue: !1, selectionInNode: void 0, forceVideoSource: t } : t ? { ...an, forceVideoSource: !0 } : an;
|
|
6131
|
+
return ln(n, i, s);
|
|
6120
6132
|
}
|
|
6121
6133
|
function Za(n, e, t = !1) {
|
|
6122
6134
|
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
@@ -6137,27 +6149,27 @@ function Za(n, e, t = !1) {
|
|
|
6137
6149
|
}
|
|
6138
6150
|
const d = l.view;
|
|
6139
6151
|
for (const p of i.get(d.ast) ?? [])
|
|
6140
|
-
c.push(
|
|
6152
|
+
c.push(Wt(p.node, p.deletedLocal, l.absoluteStart, !0, p.originalStart, t));
|
|
6141
6153
|
const u = s.get(d.ast);
|
|
6142
|
-
u && u.kind === "replaced" && u.deletedLocal.length > 0 && c.push(
|
|
6154
|
+
u && u.kind === "replaced" && u.deletedLocal.length > 0 && c.push(Wt(u.original, u.deletedLocal, l.absoluteStart, !1, u.originalStart, t));
|
|
6143
6155
|
let h = u && u.kind === "nested" ? go(d, u, t) : d;
|
|
6144
6156
|
u?.kind === "added" && (h = gt(h, "added", !1));
|
|
6145
6157
|
const f = u?.kind === "added" ? "added" : u?.kind === "replaced" ? "modified" : void 0, m = f ? { ...l, view: h, diffKind: f } : h !== d ? { ...l, view: h } : l;
|
|
6146
6158
|
c.push(m), a.push({ ast: d.ast, absoluteStart: l.absoluteStart, isActive: l.isActive, view: h });
|
|
6147
6159
|
}
|
|
6148
6160
|
for (const l of r)
|
|
6149
|
-
c.push(
|
|
6161
|
+
c.push(Wt(l.node, l.deletedLocal, n.ast.length, !0, l.originalStart, t));
|
|
6150
6162
|
return new ho(n.ast, a, c);
|
|
6151
6163
|
}
|
|
6152
|
-
function
|
|
6164
|
+
function Wt(n, e, t, s, i, o) {
|
|
6153
6165
|
return {
|
|
6154
6166
|
absoluteStart: t,
|
|
6155
6167
|
isActive: !1,
|
|
6156
|
-
view:
|
|
6168
|
+
view: dt(n, e, s, i, o),
|
|
6157
6169
|
kind: "diffDecoration"
|
|
6158
6170
|
};
|
|
6159
6171
|
}
|
|
6160
|
-
function
|
|
6172
|
+
function dt(n, e, t, s, i) {
|
|
6161
6173
|
const o = i || !t || n.kind === "video";
|
|
6162
6174
|
return new ja(n, po(n, o, !0), e, t, s);
|
|
6163
6175
|
}
|
|
@@ -6175,22 +6187,22 @@ function go(n, e, t) {
|
|
|
6175
6187
|
const r = n.content ?? [], c = [];
|
|
6176
6188
|
for (const a of r) {
|
|
6177
6189
|
for (const d of i.get(a.ast) ?? [])
|
|
6178
|
-
c.push(
|
|
6190
|
+
c.push(dt(d.node, d.deletedLocal, !0, d.originalStart, t));
|
|
6179
6191
|
const l = s.get(a.ast);
|
|
6180
|
-
l?.kind === "replaced" ? (l.deletedLocal.length > 0 && c.push(
|
|
6192
|
+
l?.kind === "replaced" ? (l.deletedLocal.length > 0 && c.push(dt(l.original, l.deletedLocal, !1, l.originalStart, t)), c.push(gt(a, "modified", !0))) : l?.kind === "added" ? c.push(gt(a, "added", !1)) : l && l.kind === "nested" ? c.push(go(a, l, t)) : c.push(a);
|
|
6181
6193
|
}
|
|
6182
6194
|
for (const a of o)
|
|
6183
|
-
c.push(
|
|
6195
|
+
c.push(dt(a.node, a.deletedLocal, !0, a.originalStart, t));
|
|
6184
6196
|
return _o(n, c);
|
|
6185
6197
|
}
|
|
6186
6198
|
function _o(n, e) {
|
|
6187
6199
|
return Object.assign(Object.create(Object.getPrototypeOf(n)), n, { content: e });
|
|
6188
6200
|
}
|
|
6189
|
-
const
|
|
6201
|
+
const $t = /* @__PURE__ */ new WeakMap();
|
|
6190
6202
|
function gt(n, e, t) {
|
|
6191
6203
|
if (n.kind !== "video" && n.kind !== "blockQuote" && n.kind !== "list" && n.kind !== "listItem")
|
|
6192
6204
|
return n;
|
|
6193
|
-
const s = `${e}:${t}`, i =
|
|
6205
|
+
const s = `${e}:${t}`, i = $t.get(n)?.get(s);
|
|
6194
6206
|
if (i)
|
|
6195
6207
|
return i;
|
|
6196
6208
|
let o;
|
|
@@ -6204,8 +6216,8 @@ function gt(n, e, t) {
|
|
|
6204
6216
|
o = c.every((a, l) => a === n.content[l]) ? n : _o(n, c);
|
|
6205
6217
|
} else
|
|
6206
6218
|
o = n;
|
|
6207
|
-
let r =
|
|
6208
|
-
return r || (r = /* @__PURE__ */ new Map(),
|
|
6219
|
+
let r = $t.get(n);
|
|
6220
|
+
return r || (r = /* @__PURE__ */ new Map(), $t.set(n, r)), r.set(s, o), o;
|
|
6209
6221
|
}
|
|
6210
6222
|
function vo(n) {
|
|
6211
6223
|
switch (n.kind) {
|
|
@@ -6266,7 +6278,7 @@ function $e(n, e, t, s) {
|
|
|
6266
6278
|
case "mathBlock":
|
|
6267
6279
|
return R(t, new Ia(i, e.showMarkup, V(i.children, e, t)));
|
|
6268
6280
|
case "blockQuote": {
|
|
6269
|
-
const o = tl(i), r = e.pendingAnchorBlock ?
|
|
6281
|
+
const o = tl(i), r = e.pendingAnchorBlock ? G(e.pendingAnchorBlock, i) : void 0, c = o && r !== void 0 ? o.delta(r) : void 0, a = !c || !e.pendingReplacementInBlock?.containsRange(c);
|
|
6270
6282
|
return R(t, new Na(i, V(i.children, e, t, !0), a));
|
|
6271
6283
|
}
|
|
6272
6284
|
case "list":
|
|
@@ -6297,21 +6309,21 @@ function $e(n, e, t, s) {
|
|
|
6297
6309
|
return mo(i, /* @__PURE__ */ new Set(), v.ofLength(0), void 0);
|
|
6298
6310
|
}
|
|
6299
6311
|
}
|
|
6300
|
-
function
|
|
6312
|
+
function dn(n) {
|
|
6301
6313
|
return n.kind === "document" ? n.blocks.map((e) => e.view) : "content" in n ? n.content : Ja;
|
|
6302
6314
|
}
|
|
6303
6315
|
const Ja = [];
|
|
6304
|
-
function
|
|
6316
|
+
function et(n) {
|
|
6305
6317
|
if (!n)
|
|
6306
6318
|
return;
|
|
6307
6319
|
const e = /* @__PURE__ */ new Map();
|
|
6308
|
-
for (const t of
|
|
6320
|
+
for (const t of dn(n))
|
|
6309
6321
|
e.set(t.ast, t);
|
|
6310
6322
|
return e;
|
|
6311
6323
|
}
|
|
6312
6324
|
function R(n, e) {
|
|
6313
6325
|
if (n && n.kind === e.kind && n.ast === e.ast && el(n, e)) {
|
|
6314
|
-
const t =
|
|
6326
|
+
const t = dn(n), s = dn(e);
|
|
6315
6327
|
if (t.length === s.length && t.every((i, o) => i === s[o]))
|
|
6316
6328
|
return n;
|
|
6317
6329
|
}
|
|
@@ -6362,7 +6374,7 @@ function tl(n) {
|
|
|
6362
6374
|
return t;
|
|
6363
6375
|
}
|
|
6364
6376
|
function V(n, e, t, s = !1) {
|
|
6365
|
-
const i =
|
|
6377
|
+
const i = et(t);
|
|
6366
6378
|
let o = 0;
|
|
6367
6379
|
return n.map((r, c) => {
|
|
6368
6380
|
const a = r.kind === "text" ? {
|
|
@@ -6415,7 +6427,7 @@ function il(n) {
|
|
|
6415
6427
|
return { text: t, hiddenLength: i + Ns.length };
|
|
6416
6428
|
}
|
|
6417
6429
|
function ol(n, e, t) {
|
|
6418
|
-
const s =
|
|
6430
|
+
const s = et(t), i = al(n, e), o = new Set(n.items), r = (e.listLevel ?? 0) + 1, c = n.items.some((u) => u.checked !== void 0), a = [];
|
|
6419
6431
|
let l, d = 0;
|
|
6420
6432
|
for (const u of n.children) {
|
|
6421
6433
|
if (o.has(u)) {
|
|
@@ -6435,7 +6447,7 @@ function ol(n, e, t) {
|
|
|
6435
6447
|
return new Aa(n, a);
|
|
6436
6448
|
}
|
|
6437
6449
|
function ko(n, e, t, s = !1) {
|
|
6438
|
-
const i =
|
|
6450
|
+
const i = et(t), o = e.listLevel ?? 1, r = wo(n, o, e.listIndentUnit ?? n.marker.length), c = n.blocks[0], a = n.checked !== void 0 && c?.kind === "paragraph" ? c.content[1] : void 0, l = {
|
|
6439
6451
|
...e,
|
|
6440
6452
|
taskLabelNode: a?.kind === "text" ? a : void 0,
|
|
6441
6453
|
listContinuation: { item: n, level: o, indentation: r, mixedTasks: s, outsideList: !1 }
|
|
@@ -6475,7 +6487,7 @@ function rl(n, e) {
|
|
|
6475
6487
|
}
|
|
6476
6488
|
}
|
|
6477
6489
|
function cl(n, e, t) {
|
|
6478
|
-
const s =
|
|
6490
|
+
const s = et(t), i = e.showMarkup, o = n.delimiterRow, r = new Set(
|
|
6479
6491
|
[n.headerRow, n.delimiterRow, ...n.bodyRows].filter((l) => l !== void 0)
|
|
6480
6492
|
), c = [];
|
|
6481
6493
|
let a = 0;
|
|
@@ -6494,7 +6506,7 @@ function cl(n, e, t) {
|
|
|
6494
6506
|
return new Pa(n, c);
|
|
6495
6507
|
}
|
|
6496
6508
|
function bo(n, e, t, s) {
|
|
6497
|
-
const i =
|
|
6509
|
+
const i = et(s), o = e.showMarkup, r = t ? void 0 : ll(n, e), c = new Set(n.cells), a = [];
|
|
6498
6510
|
let l = 0;
|
|
6499
6511
|
for (const d of n.children) {
|
|
6500
6512
|
if (c.has(d)) {
|
|
@@ -6572,7 +6584,7 @@ function As(n, e) {
|
|
|
6572
6584
|
const t = document.createRange();
|
|
6573
6585
|
return t.setStart(n.text, e.start - n.start), t.setEnd(n.text, e.endExclusive - n.start), t;
|
|
6574
6586
|
}
|
|
6575
|
-
function
|
|
6587
|
+
function Rt(n, e, t = Number.POSITIVE_INFINITY) {
|
|
6576
6588
|
if (t <= 0)
|
|
6577
6589
|
return [];
|
|
6578
6590
|
const s = hl(n), i = e.slice().sort((c, a) => c.start - a.start || c.endExclusive - a.endExclusive), o = [];
|
|
@@ -6599,15 +6611,15 @@ function Ot(n, e, t = Number.POSITIVE_INFINITY) {
|
|
|
6599
6611
|
}
|
|
6600
6612
|
return o;
|
|
6601
6613
|
}
|
|
6602
|
-
function
|
|
6603
|
-
return
|
|
6614
|
+
function Ht(n, e) {
|
|
6615
|
+
return Rt(n, e).map((t) => t.range);
|
|
6604
6616
|
}
|
|
6605
6617
|
function ul(n, e) {
|
|
6606
6618
|
return n.find((t) => t.start <= e && e <= t.start + t.len);
|
|
6607
6619
|
}
|
|
6608
6620
|
class fl extends W {
|
|
6609
6621
|
constructor(e, t) {
|
|
6610
|
-
super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-diff-highlight-layer", t ? (this._coordinateSpace = t, this._coordinateProbe = void 0) : (this._coordinateProbe = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._coordinateProbe.setAttribute("aria-hidden", "true"), this._coordinateProbe.style.position = "absolute", this._coordinateProbe.style.inset = "0", this._coordinateProbe.style.width = "100%", this._coordinateProbe.style.height = "100%", this._coordinateProbe.style.visibility = "hidden", this._coordinateProbe.style.pointerEvents = "none", this.element.appendChild(this._coordinateProbe), this._coordinateSpace =
|
|
6622
|
+
super(), this._parent = e, this.element = document.createElement("div"), this.element.className = "md-diff-highlight-layer", t ? (this._coordinateSpace = t, this._coordinateProbe = void 0) : (this._coordinateProbe = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._coordinateProbe.setAttribute("aria-hidden", "true"), this._coordinateProbe.style.position = "absolute", this._coordinateProbe.style.inset = "0", this._coordinateProbe.style.width = "100%", this._coordinateProbe.style.height = "100%", this._coordinateProbe.style.visibility = "hidden", this._coordinateProbe.style.pointerEvents = "none", this.element.appendChild(this._coordinateProbe), this._coordinateSpace = Ot.forSvgOverlay(this._coordinateProbe)), this._resizeObserver = new ResizeObserver(() => {
|
|
6611
6623
|
this._last && this._repaint(this._last);
|
|
6612
6624
|
}), this._resizeObserver.observe(this._parent), this._register({ dispose: () => {
|
|
6613
6625
|
this._resizeObserver.disconnect(), this.element.remove();
|
|
@@ -6633,14 +6645,14 @@ class fl extends W {
|
|
|
6633
6645
|
}
|
|
6634
6646
|
_repaint(e) {
|
|
6635
6647
|
const t = [], s = [];
|
|
6636
|
-
e.inserted && t.push(
|
|
6648
|
+
e.inserted && t.push(...Ht(e.node, e.inserted));
|
|
6637
6649
|
const i = (o) => {
|
|
6638
|
-
if (o instanceof
|
|
6639
|
-
o.whole || s.push(
|
|
6640
|
-
else if (o instanceof
|
|
6650
|
+
if (o instanceof cn)
|
|
6651
|
+
o.whole || s.push(...Ht(o.sideNode, o.deletedRanges.map((r) => r.range)));
|
|
6652
|
+
else if (o instanceof rn)
|
|
6641
6653
|
for (const r of o.sides)
|
|
6642
6654
|
for (const c of r.ranges) {
|
|
6643
|
-
const a =
|
|
6655
|
+
const a = Ht(r.node, [c.range]);
|
|
6644
6656
|
(c.kind === "inserted" ? t : s).push(...a);
|
|
6645
6657
|
}
|
|
6646
6658
|
for (const r of o.children)
|
|
@@ -6693,7 +6705,7 @@ const gl = 0.4;
|
|
|
6693
6705
|
function Eo(n, e, t) {
|
|
6694
6706
|
if (n.isEmpty)
|
|
6695
6707
|
return [];
|
|
6696
|
-
const s = n, i = (h, f, m, p) =>
|
|
6708
|
+
const s = n, i = (h, f, m, p) => T.fromPointPoint(h, f, Math.max(h, m), Math.max(f, p)), o = e.sourceLines, r = [];
|
|
6697
6709
|
for (let h = 0; h < o.length; h++) {
|
|
6698
6710
|
const f = o[h], m = vt(f);
|
|
6699
6711
|
if (!m)
|
|
@@ -6740,14 +6752,14 @@ function Eo(n, e, t) {
|
|
|
6740
6752
|
if (w <= b)
|
|
6741
6753
|
continue;
|
|
6742
6754
|
const C = d.get(f), A = l.get(m);
|
|
6743
|
-
if (C === void 0 &&
|
|
6755
|
+
if (C === void 0 && Kt(e, f) || A === void 0 && Kt(e, m))
|
|
6744
6756
|
continue;
|
|
6745
|
-
const ne = C !== void 0 ? a[C] : { left: _.left, right: _.right },
|
|
6757
|
+
const ne = C !== void 0 ? a[C] : { left: _.left, right: _.right }, Q = A !== void 0 ? a[A] : { left: k.left, right: k.right }, q = Math.max(ne.left, Q.left), Le = Math.min(ne.right, Q.right);
|
|
6746
6758
|
Le <= q || c.push(i(q, b, Le, w));
|
|
6747
6759
|
}
|
|
6748
6760
|
for (const h of t) {
|
|
6749
6761
|
const f = v.ofStartAndLength(h.absoluteStart, h.block.length);
|
|
6750
|
-
s.intersects(f) && (
|
|
6762
|
+
s.intersects(f) && (Kt(e, h) || c.push(h.rect));
|
|
6751
6763
|
}
|
|
6752
6764
|
return c;
|
|
6753
6765
|
}
|
|
@@ -6759,7 +6771,7 @@ function vt(n) {
|
|
|
6759
6771
|
s.sourceStart < e && (e = s.sourceStart), s.sourceEndExclusive > t && (t = s.sourceEndExclusive);
|
|
6760
6772
|
return v.fromTo(e, t);
|
|
6761
6773
|
}
|
|
6762
|
-
function
|
|
6774
|
+
function Kt(n, e) {
|
|
6763
6775
|
const t = v.ofStartAndLength(e.absoluteStart, e.block.length);
|
|
6764
6776
|
for (const s of n.sourceLines) {
|
|
6765
6777
|
const i = vt(s);
|
|
@@ -6821,22 +6833,22 @@ function bl(n, e) {
|
|
|
6821
6833
|
return "";
|
|
6822
6834
|
const s = new Array(t);
|
|
6823
6835
|
for (let r = 0; r < t; r++) {
|
|
6824
|
-
const c = n[(r + t - 1) % t], a = n[(r + 1) % t], l =
|
|
6836
|
+
const c = n[(r + t - 1) % t], a = n[(r + 1) % t], l = ot(n[r], c), d = ot(n[r], a);
|
|
6825
6837
|
s[r] = Math.min(e, l / 2, d / 2);
|
|
6826
6838
|
}
|
|
6827
|
-
const i =
|
|
6839
|
+
const i = zt(n[t - 1], n[0], ot(n[t - 1], n[0]) - s[0]), o = [`M${le(i.x)},${le(i.y)}`];
|
|
6828
6840
|
for (let r = 0; r < t; r++) {
|
|
6829
|
-
const c = n[r], a = n[(r + 1) % t], l = s[r], d =
|
|
6841
|
+
const c = n[r], a = n[(r + 1) % t], l = s[r], d = zt(c, a, l);
|
|
6830
6842
|
l > 0 ? o.push(`A${le(l)},${le(l)} 0 0 ${c.convex ? 1 : 0} ${le(d.x)},${le(d.y)}`) : o.push(`L${le(d.x)},${le(d.y)}`);
|
|
6831
|
-
const u = s[(r + 1) % t], h =
|
|
6843
|
+
const u = s[(r + 1) % t], h = zt(c, a, ot(c, a) - u);
|
|
6832
6844
|
o.push(`L${le(h.x)},${le(h.y)}`);
|
|
6833
6845
|
}
|
|
6834
6846
|
return o.push("Z"), o.join(" ");
|
|
6835
6847
|
}
|
|
6836
|
-
function
|
|
6848
|
+
function ot(n, e) {
|
|
6837
6849
|
return Math.hypot(n.x - e.x, n.y - e.y);
|
|
6838
6850
|
}
|
|
6839
|
-
function
|
|
6851
|
+
function zt(n, e, t) {
|
|
6840
6852
|
const s = e.x - n.x, i = e.y - n.y, o = Math.hypot(s, i);
|
|
6841
6853
|
if (o === 0)
|
|
6842
6854
|
return { x: n.x, y: n.y };
|
|
@@ -6853,12 +6865,12 @@ class yl extends W {
|
|
|
6853
6865
|
super(), this.element = document.createElement("div"), this.element.className = "md-cursor", this.rendering = I(this, (t) => {
|
|
6854
6866
|
const s = t.readObservable(e.position), i = t.readObservable(e.visualLineMap);
|
|
6855
6867
|
if (s === void 0 || i.isEmpty)
|
|
6856
|
-
return this.element.style.display = "none", new
|
|
6868
|
+
return this.element.style.display = "none", new rt(s ?? N.source(0), !1, T.EMPTY);
|
|
6857
6869
|
const o = i.lineIndexOfPosition(s);
|
|
6858
6870
|
if (o === void 0)
|
|
6859
|
-
return this.element.style.display = "none", new
|
|
6871
|
+
return this.element.style.display = "none", new rt(s, !1, T.EMPTY);
|
|
6860
6872
|
const r = i.lineRect(o).withZeroWidthAt(i.xAtPosition(s)), c = e.blocks ? t.readObservable(e.blocks) : void 0, a = c && s.kind === "source" ? xo(_l(c, s.offset)) : void 0;
|
|
6861
|
-
return a && (r.x < a.left - 0.5 || r.x > a.right + 0.5) ? (this.element.style.display = "none", new
|
|
6873
|
+
return a && (r.x < a.left - 0.5 || r.x > a.right + 0.5) ? (this.element.style.display = "none", new rt(s, !1, T.EMPTY)) : (this.element.style.left = `${r.x}px`, this.element.style.top = `${r.y}px`, this.element.style.height = `${r.height}px`, this.element.style.display = "", new rt(s, !0, r));
|
|
6862
6874
|
}), this._register(M((t) => {
|
|
6863
6875
|
t.readObservable(this.rendering);
|
|
6864
6876
|
})), this._register(M((t) => {
|
|
@@ -6866,7 +6878,7 @@ class yl extends W {
|
|
|
6866
6878
|
}));
|
|
6867
6879
|
}
|
|
6868
6880
|
}
|
|
6869
|
-
class
|
|
6881
|
+
class rt {
|
|
6870
6882
|
constructor(e, t, s) {
|
|
6871
6883
|
this.position = e, this.visible = t, this.rect = s;
|
|
6872
6884
|
}
|
|
@@ -6966,7 +6978,7 @@ function Lo(n, e, t) {
|
|
|
6966
6978
|
}
|
|
6967
6979
|
function To(n) {
|
|
6968
6980
|
const e = n.ownerDocument, t = e.defaultView ?? window;
|
|
6969
|
-
let s =
|
|
6981
|
+
let s = T.fromPointSize(
|
|
6970
6982
|
0,
|
|
6971
6983
|
0,
|
|
6972
6984
|
e.documentElement.clientWidth || t.innerWidth,
|
|
@@ -6978,8 +6990,8 @@ function To(n) {
|
|
|
6978
6990
|
continue;
|
|
6979
6991
|
const a = Mo(i), l = r ? Math.max(s.left, a.left) : s.left, d = r ? Math.min(s.right, a.right) : s.right, u = c ? Math.max(s.top, a.top) : s.top, h = c ? Math.min(s.bottom, a.bottom) : s.bottom;
|
|
6980
6992
|
if (d <= l || h <= u)
|
|
6981
|
-
return
|
|
6982
|
-
s =
|
|
6993
|
+
return T.fromPointSize(l, u, 0, 0);
|
|
6994
|
+
s = T.fromPointPoint(
|
|
6983
6995
|
l,
|
|
6984
6996
|
u,
|
|
6985
6997
|
d,
|
|
@@ -6990,7 +7002,7 @@ function To(n) {
|
|
|
6990
7002
|
}
|
|
6991
7003
|
function Mo(n) {
|
|
6992
7004
|
const e = n.getBoundingClientRect(), t = n.offsetWidth > 0 ? e.width / n.offsetWidth : 1, s = n.offsetHeight > 0 ? e.height / n.offsetHeight : 1;
|
|
6993
|
-
return
|
|
7005
|
+
return T.fromPointSize(
|
|
6994
7006
|
e.left + n.clientLeft * t,
|
|
6995
7007
|
e.top + n.clientTop * s,
|
|
6996
7008
|
n.clientWidth * t,
|
|
@@ -7082,7 +7094,7 @@ class nh extends W {
|
|
|
7082
7094
|
selection: this._model.selection,
|
|
7083
7095
|
visualLineMap: this.measuredLayout.visualLineMap,
|
|
7084
7096
|
blocks: this._selectionBlocksObs
|
|
7085
|
-
})), this._contentContainer.appendChild(this._selectionView.element), this.coordinateSpace =
|
|
7097
|
+
})), this._contentContainer.appendChild(this._selectionView.element), this.coordinateSpace = Ot.forSvgOverlay(this._selectionView.element), this._cursorView = this._register(new yl({
|
|
7086
7098
|
position: this._model.cursorPosition,
|
|
7087
7099
|
visualLineMap: this.measuredLayout.visualLineMap,
|
|
7088
7100
|
blocks: this._selectionBlocksObs
|
|
@@ -7542,7 +7554,7 @@ class nh extends W {
|
|
|
7542
7554
|
if (!s)
|
|
7543
7555
|
return;
|
|
7544
7556
|
const i = ce.forDom(t);
|
|
7545
|
-
if (!(i?.ast instanceof
|
|
7557
|
+
if (!(i?.ast instanceof Y) || !(i.dom instanceof HTMLElement) || !i.dom.contains(t))
|
|
7546
7558
|
return;
|
|
7547
7559
|
const o = s.resolveSource({ node: t, offset: 0 });
|
|
7548
7560
|
if (o !== void 0)
|
|
@@ -7673,7 +7685,7 @@ class nh extends W {
|
|
|
7673
7685
|
const p = s.toLocalRect(l.getBoundingClientRect()).left + l.clientLeft;
|
|
7674
7686
|
d = { left: p, right: p + l.clientWidth };
|
|
7675
7687
|
}
|
|
7676
|
-
const f =
|
|
7688
|
+
const f = Ze.measure([{
|
|
7677
7689
|
absoluteStart: c.absoluteStart,
|
|
7678
7690
|
viewNode: c.node
|
|
7679
7691
|
}], this.coordinateSpace, s);
|
|
@@ -7695,7 +7707,7 @@ class nh extends W {
|
|
|
7695
7707
|
afterBlock: o.anchorBlock,
|
|
7696
7708
|
line: yt.virtual(
|
|
7697
7709
|
o.cursorLine,
|
|
7698
|
-
|
|
7710
|
+
T.fromPointSize(a.left, c.top, 0, c.height)
|
|
7699
7711
|
)
|
|
7700
7712
|
});
|
|
7701
7713
|
}
|
|
@@ -7721,7 +7733,7 @@ class nh extends W {
|
|
|
7721
7733
|
const o = this._document.get();
|
|
7722
7734
|
if (!o)
|
|
7723
7735
|
return;
|
|
7724
|
-
const r =
|
|
7736
|
+
const r = Rt(o, [e]);
|
|
7725
7737
|
if (r.length === 0 && !e.isEmpty)
|
|
7726
7738
|
return;
|
|
7727
7739
|
const c = this.measuredLayout.measurements.get().find(
|
|
@@ -7735,7 +7747,7 @@ class nh extends W {
|
|
|
7735
7747
|
return u;
|
|
7736
7748
|
const h = this.measuredLayout.visualLineMap.get();
|
|
7737
7749
|
if (!h.isEmpty) {
|
|
7738
|
-
const f = h.lineIndexOfOffset(e.start), m = h.lineRect(f), p =
|
|
7750
|
+
const f = h.lineIndexOfOffset(e.start), m = h.lineRect(f), p = T.fromPointSize(
|
|
7739
7751
|
h.xAtOffset(e.start),
|
|
7740
7752
|
m.top,
|
|
7741
7753
|
2,
|
|
@@ -7745,7 +7757,7 @@ class nh extends W {
|
|
|
7745
7757
|
}
|
|
7746
7758
|
if (c?.rect)
|
|
7747
7759
|
return this.coordinateSpace.capture().toClientRect(
|
|
7748
|
-
|
|
7760
|
+
T.fromPointSize(c.rect.left, c.rect.top, 2, c.rect.height)
|
|
7749
7761
|
);
|
|
7750
7762
|
};
|
|
7751
7763
|
return this._revealTarget(l, d, t, s, i);
|
|
@@ -7756,29 +7768,29 @@ class nh extends W {
|
|
|
7756
7768
|
return;
|
|
7757
7769
|
const c = To(e);
|
|
7758
7770
|
let a = this._isRevealOccluded(r);
|
|
7759
|
-
if (i !== "top" && Vs(c,
|
|
7771
|
+
if (i !== "top" && Vs(c, qt(r, c, o)) && !a)
|
|
7760
7772
|
return;
|
|
7761
7773
|
const l = Il(e), d = i === "top" ? /* @__PURE__ */ new Map() : void 0, u = i === "top" ? l.find((w) => Rl(w)) : void 0;
|
|
7762
7774
|
for (let w = 0; w < l.length; w++) {
|
|
7763
7775
|
const b = l[w];
|
|
7764
7776
|
r = t() ?? r, a = this._isRevealOccluded(r);
|
|
7765
|
-
const C = Mo(b), A =
|
|
7766
|
-
if (
|
|
7767
|
-
const
|
|
7777
|
+
const C = Mo(b), A = qt(r, C, o), ne = b.scrollWidth > b.clientWidth, Q = b.scrollHeight > b.clientHeight, q = b === u, Le = i === "top" && !q ? "nearest" : i, Bo = q ? this._topRevealInset(C, r) : Ee, Dn = i === "top" && !q ? this._unoccludedViewport(C, r) : C, Fn = Ks(Dn, C), Vn = zs(A, Dn, Le, Bo), Wn = Ml(b, Vn.x, Vn.y), It = ne && (r.left < C.left || r.right > C.right) ? b.scrollLeft + Wn.x : b.scrollLeft, Nt = Q && (q || A.top < Fn.top || A.bottom > Fn.bottom || a) ? b.scrollTop + Wn.y : b.scrollTop, Do = Nt !== b.scrollTop;
|
|
7778
|
+
if (It !== b.scrollLeft || Do) {
|
|
7779
|
+
const At = d ? Tl(b, It, Nt) : void 0;
|
|
7768
7780
|
b.scrollTo({
|
|
7769
|
-
left:
|
|
7770
|
-
top:
|
|
7781
|
+
left: It,
|
|
7782
|
+
top: Nt,
|
|
7771
7783
|
behavior: i === "top" && s === "instant" ? "instant" : "auto"
|
|
7772
|
-
}),
|
|
7784
|
+
}), At && d?.set(At.eventTarget, At);
|
|
7773
7785
|
}
|
|
7774
7786
|
}
|
|
7775
7787
|
r = t() ?? r, a = this._isRevealOccluded(r);
|
|
7776
|
-
const h = this.element.ownerDocument, f = h.defaultView ?? window, m =
|
|
7788
|
+
const h = this.element.ownerDocument, f = h.defaultView ?? window, m = T.fromPointSize(
|
|
7777
7789
|
0,
|
|
7778
7790
|
0,
|
|
7779
7791
|
h.documentElement.clientWidth || f.innerWidth,
|
|
7780
7792
|
h.documentElement.clientHeight || f.innerHeight
|
|
7781
|
-
), p =
|
|
7793
|
+
), p = qt(r, m, o), g = i === "top" && u !== void 0 ? "nearest" : i, _ = g === "top", k = i === "top" && !_ ? this._unoccludedViewport(m, r) : m;
|
|
7782
7794
|
if (_ || !Vs(Ks(k, m), p) || a) {
|
|
7783
7795
|
const w = _ ? this._topRevealInset(m, r) : Ee, b = zs(p, k, g, w), C = r.left < m.left || r.right > m.right ? b.x : 0;
|
|
7784
7796
|
d && d.set(h, Co(f, f.scrollX + C, f.scrollY + b.y)), f.scrollBy({
|
|
@@ -7867,7 +7879,7 @@ class nh extends W {
|
|
|
7867
7879
|
_occludedTopHeight(e, t) {
|
|
7868
7880
|
let s = 0;
|
|
7869
7881
|
for (let i = 0; i <= this._revealOcclusions.size; i++) {
|
|
7870
|
-
const o =
|
|
7882
|
+
const o = T.fromPointPoint(
|
|
7871
7883
|
t.left,
|
|
7872
7884
|
e.top,
|
|
7873
7885
|
t.right,
|
|
@@ -7904,7 +7916,7 @@ class nh extends W {
|
|
|
7904
7916
|
if (s <= 0)
|
|
7905
7917
|
return e;
|
|
7906
7918
|
const i = e.top + s + Ee;
|
|
7907
|
-
return i >= e.bottom ? e :
|
|
7919
|
+
return i >= e.bottom ? e : T.fromPointPoint(
|
|
7908
7920
|
e.left,
|
|
7909
7921
|
i,
|
|
7910
7922
|
e.right,
|
|
@@ -7922,13 +7934,13 @@ function Al(n) {
|
|
|
7922
7934
|
let e = Number.POSITIVE_INFINITY, t = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY, i = Number.NEGATIVE_INFINITY;
|
|
7923
7935
|
for (const o of n)
|
|
7924
7936
|
e = Math.min(e, o.left), t = Math.min(t, o.top), s = Math.max(s, o.right), i = Math.max(i, o.bottom);
|
|
7925
|
-
return
|
|
7937
|
+
return T.fromPointPoint(e, t, s, i);
|
|
7926
7938
|
}
|
|
7927
7939
|
function Pl(n) {
|
|
7928
|
-
return
|
|
7940
|
+
return T.fromPointPoint(n.left, n.top, n.right, n.bottom);
|
|
7929
7941
|
}
|
|
7930
7942
|
function Ks(n, e) {
|
|
7931
|
-
return n === e ? e :
|
|
7943
|
+
return n === e ? e : T.fromPointPoint(
|
|
7932
7944
|
n.left,
|
|
7933
7945
|
n.top - He,
|
|
7934
7946
|
n.right,
|
|
@@ -7947,11 +7959,11 @@ function zs(n, e, t, s = Ee) {
|
|
|
7947
7959
|
const o = n.height > e.height ? n.top - e.top : n.top < e.top ? n.top - e.top - He : n.bottom > e.bottom ? n.bottom - e.bottom + He : 0;
|
|
7948
7960
|
return new se(i, o);
|
|
7949
7961
|
}
|
|
7950
|
-
function
|
|
7962
|
+
function qt(n, e, t) {
|
|
7951
7963
|
if (t === void 0 || t <= 0)
|
|
7952
7964
|
return n;
|
|
7953
7965
|
const s = e.height / t, o = Math.min(s / 2, Ro) * t;
|
|
7954
|
-
return
|
|
7966
|
+
return T.fromPointPoint(
|
|
7955
7967
|
n.left,
|
|
7956
7968
|
n.top - o,
|
|
7957
7969
|
n.right,
|
|
@@ -8081,7 +8093,7 @@ class $l extends W {
|
|
|
8081
8093
|
if (m.isEmpty)
|
|
8082
8094
|
continue;
|
|
8083
8095
|
const p = m.lineIndexOfOffset(f.start), g = m.lineRect(p), _ = Ys(
|
|
8084
|
-
|
|
8096
|
+
T.fromPointSize(
|
|
8085
8097
|
m.xAtOffset(f.start),
|
|
8086
8098
|
g.top,
|
|
8087
8099
|
2,
|
|
@@ -8094,7 +8106,7 @@ class $l extends W {
|
|
|
8094
8106
|
return e.replaceChildren(l), d;
|
|
8095
8107
|
}
|
|
8096
8108
|
const h = Number.isFinite(c) ? Math.max(0, c - u) : Number.POSITIVE_INFINITY;
|
|
8097
|
-
for (const f of
|
|
8109
|
+
for (const f of Rt(
|
|
8098
8110
|
t,
|
|
8099
8111
|
s.filter((m) => !m.isEmpty),
|
|
8100
8112
|
h
|
|
@@ -8203,7 +8215,7 @@ function js(n, e, t) {
|
|
|
8203
8215
|
}
|
|
8204
8216
|
function Ys(n, e, t) {
|
|
8205
8217
|
const s = Math.max(n.left, e.left, t?.left ?? Number.NEGATIVE_INFINITY), i = Math.min(n.right, e.right, t?.right ?? Number.POSITIVE_INFINITY), o = Math.max(n.top, e.top), r = Math.min(n.bottom, e.bottom);
|
|
8206
|
-
return s < i && o < r ?
|
|
8218
|
+
return s < i && o < r ? T.fromPointPoint(s, o, i, r) : void 0;
|
|
8207
8219
|
}
|
|
8208
8220
|
const zl = 19999;
|
|
8209
8221
|
class kt {
|
|
@@ -8280,7 +8292,7 @@ function Ul(n, e) {
|
|
|
8280
8292
|
return t <= s ? new v(t, s) : v.emptyAt(t);
|
|
8281
8293
|
}
|
|
8282
8294
|
function Gl(n, e, t) {
|
|
8283
|
-
const s = n[e.start - 1], i = n[e.start], o = n[e.endExclusive - 1], r = n[e.endExclusive], c = e.start === 0 || !
|
|
8295
|
+
const s = n[e.start - 1], i = n[e.start], o = n[e.endExclusive - 1], r = n[e.endExclusive], c = e.start === 0 || !tt(s, t) || e.length > 0 && !tt(i, t), a = e.endExclusive === n.length || !tt(r, t) || e.length > 0 && !tt(o, t);
|
|
8284
8296
|
return c && a;
|
|
8285
8297
|
}
|
|
8286
8298
|
function Xl(n, e) {
|
|
@@ -8329,7 +8341,7 @@ class Ql extends W {
|
|
|
8329
8341
|
})), this._register(M((s) => {
|
|
8330
8342
|
const i = this._editorModel.sourceText.read(s), o = i.value, r = this._readInputSnapshot(s), c = this._sourceEditTracker.consume(i), a = c.sourceIdentityChanged, l = a && c.isExpected;
|
|
8331
8343
|
if (a && !l) {
|
|
8332
|
-
this._searchOrigin =
|
|
8344
|
+
this._searchOrigin = Ut(this._searchOrigin, 0, o.length), t = { ...r, scope: void 0 }, K((f) => {
|
|
8333
8345
|
this.searchScope.set(void 0, f), this.currentMatch.set(void 0, f);
|
|
8334
8346
|
});
|
|
8335
8347
|
return;
|
|
@@ -8399,7 +8411,7 @@ class Ql extends W {
|
|
|
8399
8411
|
_sourceEditTracker;
|
|
8400
8412
|
_pendingInitialDirection;
|
|
8401
8413
|
reveal(e) {
|
|
8402
|
-
this._searchOrigin =
|
|
8414
|
+
this._searchOrigin = Ut(e.origin, 0, this._editorModel.sourceText.get().value.length), this._pendingInitialDirection = e.direction ?? "next", K((t) => {
|
|
8403
8415
|
e.searchString !== void 0 && this.searchString.set(e.searchString, t), this.isRevealed.set(!0, t);
|
|
8404
8416
|
});
|
|
8405
8417
|
}
|
|
@@ -8409,7 +8421,7 @@ class Ql extends W {
|
|
|
8409
8421
|
});
|
|
8410
8422
|
}
|
|
8411
8423
|
setSearchOrigin(e) {
|
|
8412
|
-
this._searchOrigin =
|
|
8424
|
+
this._searchOrigin = Ut(e, 0, this._editorModel.sourceText.get().value.length);
|
|
8413
8425
|
}
|
|
8414
8426
|
setSearchScope(e) {
|
|
8415
8427
|
this.searchScope.set(e, void 0);
|
|
@@ -8446,7 +8458,7 @@ class Ql extends W {
|
|
|
8446
8458
|
this.currentMatch.set(o, void 0);
|
|
8447
8459
|
}
|
|
8448
8460
|
_mapStateThroughEdit(e) {
|
|
8449
|
-
this._searchOrigin =
|
|
8461
|
+
this._searchOrigin = hn(e.edit, this._searchOrigin, "after");
|
|
8450
8462
|
const t = this.searchScope.get();
|
|
8451
8463
|
t && this.searchScope.set(Zs(e.edit, t), e.transaction);
|
|
8452
8464
|
const s = this.currentMatch.get();
|
|
@@ -8486,10 +8498,10 @@ function Zl(n, e) {
|
|
|
8486
8498
|
return n === e || !!n && !!e && n.equals(e);
|
|
8487
8499
|
}
|
|
8488
8500
|
function Zs(n, e) {
|
|
8489
|
-
const t =
|
|
8501
|
+
const t = hn(n, e.start, "after"), s = hn(n, e.endExclusive, "before");
|
|
8490
8502
|
return new v(Math.min(t, s), Math.max(t, s));
|
|
8491
8503
|
}
|
|
8492
|
-
function
|
|
8504
|
+
function hn(n, e, t) {
|
|
8493
8505
|
let s = 0;
|
|
8494
8506
|
for (const i of n.replacements) {
|
|
8495
8507
|
const o = i.replaceRange;
|
|
@@ -8509,7 +8521,7 @@ function Jl(n, e) {
|
|
|
8509
8521
|
return s.isEmpty ? e.start < s.start && s.start < e.endExclusive : e.isEmpty ? s.contains(e.start) : s.intersects(e);
|
|
8510
8522
|
});
|
|
8511
8523
|
}
|
|
8512
|
-
function
|
|
8524
|
+
function Ut(n, e, t) {
|
|
8513
8525
|
return Math.min(Math.max(n, e), t);
|
|
8514
8526
|
}
|
|
8515
8527
|
class ed extends W {
|
|
@@ -8518,8 +8530,8 @@ class ed extends W {
|
|
|
8518
8530
|
const s = document.createElement("div");
|
|
8519
8531
|
s.className = "md-find-row", this.panelElement.appendChild(s), this._inputShell = document.createElement("div"), this._inputShell.className = "md-find-input-shell", s.appendChild(this._inputShell), this._input = document.createElement("textarea"), this._input.className = "md-find-input", this._input.rows = 1, this._input.spellcheck = !1, this._input.setAttribute("aria-label", "Find"), this._input.placeholder = "Find", this._inputShell.appendChild(this._input);
|
|
8520
8532
|
const i = document.createElement("div");
|
|
8521
|
-
i.className = "md-find-options", this._inputShell.appendChild(i), this._caseButton =
|
|
8522
|
-
const o =
|
|
8533
|
+
i.className = "md-find-options", this._inputShell.appendChild(i), this._caseButton = Gt("Aa", "Match Case"), this._wholeWordButton = Gt("ab", "Match Whole Word", "md-find-option-whole-word"), this._regexButton = Gt(".*", "Use Regular Expression"), i.append(this._caseButton, this._wholeWordButton, this._regexButton), this._matchesCount = document.createElement("div"), this._matchesCount.className = "md-find-count", this._matchesCount.setAttribute("role", "status"), this._matchesCount.setAttribute("aria-live", "polite"), s.appendChild(this._matchesCount), this._previousButton = ct("arrow-up", "Previous Match"), this._nextButton = ct("arrow-down", "Next Match"), this._selectionButton = ct("selection", "Find in Selection");
|
|
8534
|
+
const o = ct("close", "Close");
|
|
8523
8535
|
s.append(this._previousButton, this._nextButton, this._selectionButton, o), this._error = document.createElement("div"), this._error.className = "md-find-error", this._error.setAttribute("role", "alert"), this.panelElement.appendChild(this._error);
|
|
8524
8536
|
const r = () => this._options.findModel.searchString.set(this._input.value, void 0), c = (h) => {
|
|
8525
8537
|
h.isComposing || h.key === "Enter" && !h.ctrlKey && !h.metaKey && !h.altKey && (h.preventDefault(), h.stopPropagation(), h.shiftKey ? this._options.onPrevious() : this._options.onNext());
|
|
@@ -8559,7 +8571,7 @@ class ed extends W {
|
|
|
8559
8571
|
if (!s && this.panelElement.contains(this.panelElement.ownerDocument.activeElement) && this._view.focus(), this.element.hidden = !s, this._view.element.classList.toggle("md-find-visible", s), !s)
|
|
8560
8572
|
return;
|
|
8561
8573
|
const i = t.searchString.read(e), o = t.matchCase.read(e), r = t.wholeWord.read(e), c = t.isRegex.read(e), a = t.searchScope.read(e), l = t.searchResult.read(e), d = t.currentMatchPosition.read(e), u = this._options.canFindInSelection.read(e) || a !== void 0;
|
|
8562
|
-
this._input.value !== i && (this._input.value = i),
|
|
8574
|
+
this._input.value !== i && (this._input.value = i), at(this._caseButton, o), at(this._wholeWordButton, r), at(this._regexButton, c), at(this._selectionButton, a !== void 0), this._selectionButton.disabled = !s || !u;
|
|
8563
8575
|
const h = l.kind === "valid" ? l.matches.length : 0, f = h > 0, m = i.length > 0;
|
|
8564
8576
|
if (this._previousButton.disabled = !s || !f, this._nextButton.disabled = !s || !f, this.panelElement.classList.toggle("md-find-no-results", m && !f && l.kind === "valid"), !f)
|
|
8565
8577
|
this._matchesCount.textContent = "No results";
|
|
@@ -8571,17 +8583,17 @@ class ed extends W {
|
|
|
8571
8583
|
this._input.setAttribute("aria-invalid", String(p.length > 0)), this._inputShell.classList.toggle("md-find-input-invalid", p.length > 0), this._input.title = p, this._error.textContent = p, this._error.hidden = p.length === 0;
|
|
8572
8584
|
}
|
|
8573
8585
|
}
|
|
8574
|
-
function
|
|
8586
|
+
function Gt(n, e, t) {
|
|
8575
8587
|
const s = document.createElement("button");
|
|
8576
8588
|
return s.type = "button", s.className = "md-find-button md-find-option", t && s.classList.add(t), s.textContent = n, s.setAttribute("aria-label", e), s.title = e, s.setAttribute("aria-pressed", "false"), s;
|
|
8577
8589
|
}
|
|
8578
|
-
function
|
|
8590
|
+
function ct(n, e) {
|
|
8579
8591
|
const t = document.createElement("button");
|
|
8580
8592
|
t.type = "button", t.className = "md-find-button", t.setAttribute("aria-label", e), t.title = e;
|
|
8581
8593
|
const s = document.createElement("span");
|
|
8582
8594
|
return s.className = `codicon codicon-${n}`, s.setAttribute("aria-hidden", "true"), t.appendChild(s), t;
|
|
8583
8595
|
}
|
|
8584
|
-
function
|
|
8596
|
+
function at(n, e) {
|
|
8585
8597
|
n.setAttribute("aria-pressed", String(e)), n.classList.toggle("md-find-option-active", e);
|
|
8586
8598
|
}
|
|
8587
8599
|
class td extends W {
|
|
@@ -8629,7 +8641,7 @@ class td extends W {
|
|
|
8629
8641
|
}
|
|
8630
8642
|
const p = !this._selectedMatch?.equals(h);
|
|
8631
8643
|
let g = /* @__PURE__ */ new Set();
|
|
8632
|
-
this._forcedMatch?.equals(h) ? g = new Set(
|
|
8644
|
+
this._forcedMatch?.equals(h) ? g = new Set(Yt(f, h.start, h.endExclusive)) : (m ? sd(m, h) : !1) ? this._forcedMatch = void 0 : (g = new Set(Yt(f, h.start, h.endExclusive)), this._forcedMatch = h), K((_) => {
|
|
8633
8645
|
Js(this._view.forcedMarkerVisibleBlocks.get(), g) || this._view.forcedMarkerVisibleBlocks.set(g, _);
|
|
8634
8646
|
const k = this._editorModel.selection.get();
|
|
8635
8647
|
p && !d && (!k || !k.range.equals(h)) && (this._editorModel.pendingParagraph.set(void 0, _), this._editorModel.selectionSource.set("find", _), this._editorModel.selection.set(new y(h.start, h.endExclusive), _));
|
|
@@ -8674,14 +8686,14 @@ class td extends W {
|
|
|
8674
8686
|
const t = e.target, s = t instanceof Node && this.widget.panelElement.contains(t);
|
|
8675
8687
|
if (!(t !== this._view.element && !s)) {
|
|
8676
8688
|
if (nd(e, this._options.keyboardPlatform)) {
|
|
8677
|
-
|
|
8689
|
+
Xt(e), this.openAndFocus();
|
|
8678
8690
|
return;
|
|
8679
8691
|
}
|
|
8680
8692
|
if (e.key === "F3" && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
8681
|
-
|
|
8693
|
+
Xt(e), this._findByKeyboard(e.shiftKey ? "previous" : "next");
|
|
8682
8694
|
return;
|
|
8683
8695
|
}
|
|
8684
|
-
e.key === "Escape" && this.model.isRevealed.get() && (
|
|
8696
|
+
e.key === "Escape" && this.model.isRevealed.get() && (Xt(e), this.close());
|
|
8685
8697
|
}
|
|
8686
8698
|
}
|
|
8687
8699
|
_cancelRevealRequest() {
|
|
@@ -8734,14 +8746,14 @@ class td extends W {
|
|
|
8734
8746
|
function nd(n, e) {
|
|
8735
8747
|
return n.key.toLowerCase() === "f" && !n.shiftKey && !n.altKey && (e === "macos" ? n.metaKey && !n.ctrlKey : n.ctrlKey && !n.metaKey);
|
|
8736
8748
|
}
|
|
8737
|
-
function
|
|
8749
|
+
function Xt(n) {
|
|
8738
8750
|
n.preventDefault(), n.stopPropagation();
|
|
8739
8751
|
}
|
|
8740
8752
|
function Js(n, e) {
|
|
8741
8753
|
return n.size === e.size && Array.from(n).every((t) => e.has(t));
|
|
8742
8754
|
}
|
|
8743
8755
|
function sd(n, e) {
|
|
8744
|
-
const t =
|
|
8756
|
+
const t = Rt(n, [e]);
|
|
8745
8757
|
return e.isEmpty ? t.some((i) => ei(i.range)) : t.reduce((i, o) => {
|
|
8746
8758
|
const r = Array.from(o.range.getClientRects()).some((c) => c.width > 0 && c.height > 0) && ei(o.range);
|
|
8747
8759
|
return i + (r ? o.sourceRange.length : 0);
|
|
@@ -8777,17 +8789,17 @@ function sh(n, e = () => {
|
|
|
8777
8789
|
class id {
|
|
8778
8790
|
connect(e) {
|
|
8779
8791
|
const t = (r) => {
|
|
8780
|
-
if (
|
|
8792
|
+
if (ht(r.target, e.element) || ut(r.target, e.element))
|
|
8781
8793
|
return;
|
|
8782
8794
|
const c = e.getSelectedText();
|
|
8783
8795
|
c !== void 0 && (r.preventDefault(), r.clipboardData?.setData("text/plain", c));
|
|
8784
8796
|
}, s = (r) => {
|
|
8785
|
-
if (
|
|
8797
|
+
if (ht(r.target, e.element) || ut(r.target, e.element))
|
|
8786
8798
|
return;
|
|
8787
8799
|
const c = e.getSelectedText();
|
|
8788
8800
|
c !== void 0 && (r.preventDefault(), r.clipboardData?.setData("text/plain", c), e.deleteSelection());
|
|
8789
8801
|
}, i = (r) => {
|
|
8790
|
-
if (
|
|
8802
|
+
if (ht(r.target, e.element) || ut(r.target, e.element))
|
|
8791
8803
|
return;
|
|
8792
8804
|
r.preventDefault();
|
|
8793
8805
|
const c = r.clipboardData?.getData("text/plain");
|
|
@@ -8811,12 +8823,12 @@ class ih {
|
|
|
8811
8823
|
const t = (i) => {
|
|
8812
8824
|
if (!(i.ctrlKey || i.metaKey) || i.altKey)
|
|
8813
8825
|
return;
|
|
8814
|
-
const r =
|
|
8826
|
+
const r = ht(i.target, e.element);
|
|
8815
8827
|
if (r) {
|
|
8816
8828
|
od(i, r, this._clipboard);
|
|
8817
8829
|
return;
|
|
8818
8830
|
}
|
|
8819
|
-
if (!
|
|
8831
|
+
if (!ut(i.target, e.element))
|
|
8820
8832
|
switch (i.key.toLowerCase()) {
|
|
8821
8833
|
case "c": {
|
|
8822
8834
|
const c = e.getSelectedText();
|
|
@@ -8847,13 +8859,13 @@ class ih {
|
|
|
8847
8859
|
return s.addEventListener("keydown", t), { dispose: () => s.removeEventListener("keydown", t) };
|
|
8848
8860
|
}
|
|
8849
8861
|
}
|
|
8850
|
-
function
|
|
8862
|
+
function ht(n, e) {
|
|
8851
8863
|
if (!(n instanceof Node) || n === e)
|
|
8852
8864
|
return;
|
|
8853
8865
|
const s = (n instanceof Element ? n : n.parentElement)?.closest('input, textarea, [contenteditable]:not([contenteditable="false"]), [role="textbox"]');
|
|
8854
8866
|
return s instanceof HTMLElement && e.contains(s) ? s : void 0;
|
|
8855
8867
|
}
|
|
8856
|
-
function
|
|
8868
|
+
function ut(n, e) {
|
|
8857
8869
|
if (!(n instanceof Node) || n === e)
|
|
8858
8870
|
return !1;
|
|
8859
8871
|
const s = (n instanceof Element ? n : n.parentElement)?.closest("video, audio");
|
|
@@ -8912,18 +8924,18 @@ function ni(n, e) {
|
|
|
8912
8924
|
data: e
|
|
8913
8925
|
}));
|
|
8914
8926
|
}
|
|
8915
|
-
const
|
|
8916
|
-
bindings:
|
|
8927
|
+
const un = {
|
|
8928
|
+
bindings: fn.flatMap((n) => n.keybindings.map((e) => ({
|
|
8917
8929
|
...e,
|
|
8918
8930
|
action: n.action
|
|
8919
8931
|
})))
|
|
8920
8932
|
}, oh = {
|
|
8921
|
-
bindings:
|
|
8933
|
+
bindings: fn.filter((n) => n.routing === "local").flatMap((n) => n.keybindings.map((e) => ({
|
|
8922
8934
|
...e,
|
|
8923
8935
|
action: n.action
|
|
8924
8936
|
})))
|
|
8925
8937
|
}, rh = {
|
|
8926
|
-
bindings:
|
|
8938
|
+
bindings: fn.filter((n) => n.routing !== "local").flatMap((n) => n.keybindings.map((e) => ({
|
|
8927
8939
|
...e,
|
|
8928
8940
|
action: n.action
|
|
8929
8941
|
})))
|
|
@@ -8952,7 +8964,7 @@ function si(n) {
|
|
|
8952
8964
|
altGraphKey: n.getModifierState("AltGraph")
|
|
8953
8965
|
};
|
|
8954
8966
|
}
|
|
8955
|
-
function ii(n, e, t =
|
|
8967
|
+
function ii(n, e, t = un) {
|
|
8956
8968
|
if (n.altGraphKey)
|
|
8957
8969
|
return;
|
|
8958
8970
|
const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 : ld(n.code);
|
|
@@ -8971,7 +8983,7 @@ class ch extends W {
|
|
|
8971
8983
|
constructor(e, t, s) {
|
|
8972
8984
|
super(), this._model = e, this._view = t;
|
|
8973
8985
|
const i = this._view.element, o = i.ownerDocument.defaultView ?? window;
|
|
8974
|
-
this._keyboardPlatform = s?.keyboardPlatform ?? ad(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ??
|
|
8986
|
+
this._keyboardPlatform = s?.keyboardPlatform ?? ad(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? un, this._forwardedKeyboardProfile = s?.forwardedKeyboardProfile, this._historyStrategy = s?.historyStrategy, this._indentation = s?.indentation ?? Je, this._tabFocusStatus = this._keyboardProfile === un ? this._registerTabFocusAccessibility(i) : void 0, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
|
|
8975
8987
|
dispose: () => {
|
|
8976
8988
|
i.removeEventListener("pointerdown", this._handlePointerDown), i.removeEventListener("keydown", this._handleKeyDown);
|
|
8977
8989
|
}
|
|
@@ -9096,7 +9108,7 @@ class ch extends W {
|
|
|
9096
9108
|
a.addEventListener("pointermove", d), a.addEventListener("pointerup", u), a.addEventListener("pointercancel", u), a.addEventListener("lostpointercapture", u);
|
|
9097
9109
|
};
|
|
9098
9110
|
_makeCursorContext(e) {
|
|
9099
|
-
const t = this._model.document.get(), s = e ?? this._model.selection.get() ?? y.collapsed(0), i = e ?
|
|
9111
|
+
const t = this._model.document.get(), s = e ?? this._model.selection.get() ?? y.collapsed(0), i = e ? Cn(t, s.active) : this._model.activeBlock.get();
|
|
9100
9112
|
return {
|
|
9101
9113
|
text: this._model.sourceText.get().value,
|
|
9102
9114
|
selection: s,
|
|
@@ -9273,10 +9285,10 @@ class ch extends W {
|
|
|
9273
9285
|
this._executeVisualCursorCommand(dc, e.extend);
|
|
9274
9286
|
return;
|
|
9275
9287
|
case "logicalLineStart":
|
|
9276
|
-
this._executeCursorCommand(
|
|
9288
|
+
this._executeCursorCommand(Jt, e.extend);
|
|
9277
9289
|
return;
|
|
9278
9290
|
case "logicalLineEnd":
|
|
9279
|
-
this._executeCursorCommand(
|
|
9291
|
+
this._executeCursorCommand(en, e.extend);
|
|
9280
9292
|
return;
|
|
9281
9293
|
case "documentStart":
|
|
9282
9294
|
this._executeCursorCommand(cc, e.extend);
|
|
@@ -9698,7 +9710,7 @@ function li(n, e, t) {
|
|
|
9698
9710
|
for (const s of Array.from(n.children))
|
|
9699
9711
|
s.style.visibility = t && s !== e ? "hidden" : "";
|
|
9700
9712
|
}
|
|
9701
|
-
class
|
|
9713
|
+
class je {
|
|
9702
9714
|
constructor(e, t) {
|
|
9703
9715
|
this.length = e, this.className = t;
|
|
9704
9716
|
}
|
|
@@ -9773,7 +9785,7 @@ class yd {
|
|
|
9773
9785
|
const d = this._tokenizer.tokenize(a, l, r);
|
|
9774
9786
|
o.push({ text: a, tokens: xd(d.tokens, a.length), endState: d.endState }), r = d.endState;
|
|
9775
9787
|
} else
|
|
9776
|
-
o.push({ text: a, tokens: a.length === 0 ? [] : [new
|
|
9788
|
+
o.push({ text: a, tokens: a.length === 0 ? [] : [new je(a.length, void 0)], endState: r });
|
|
9777
9789
|
}
|
|
9778
9790
|
return o;
|
|
9779
9791
|
}
|
|
@@ -9798,7 +9810,7 @@ class yd {
|
|
|
9798
9810
|
let c = i, a = i, l = !1, d = 0;
|
|
9799
9811
|
const u = (h, f) => {
|
|
9800
9812
|
const m = d, p = d + h;
|
|
9801
|
-
d = p, h !== 0 && m < o && p > i && (l || (c = m, l = !0), r.push(new
|
|
9813
|
+
d = p, h !== 0 && m < o && p > i && (l || (c = m, l = !0), r.push(new je(h, f)), a = p);
|
|
9802
9814
|
};
|
|
9803
9815
|
for (let h = 0; h < this._lines.length && d < o; h++) {
|
|
9804
9816
|
for (const f of this._lines[h].tokens)
|
|
@@ -9821,11 +9833,11 @@ function Ed(n) {
|
|
|
9821
9833
|
}
|
|
9822
9834
|
function xd(n, e) {
|
|
9823
9835
|
if (n.length === 0)
|
|
9824
|
-
return e === 0 ? [] : [new
|
|
9836
|
+
return e === 0 ? [] : [new je(e, void 0)];
|
|
9825
9837
|
const t = [];
|
|
9826
9838
|
for (let s = 0; s < n.length; s++) {
|
|
9827
9839
|
const i = n[s].offset, o = s + 1 < n.length ? n[s + 1].offset : e;
|
|
9828
|
-
o > i && t.push(new
|
|
9840
|
+
o > i && t.push(new je(o - i, Ed(n[s].type)));
|
|
9829
9841
|
}
|
|
9830
9842
|
return t;
|
|
9831
9843
|
}
|
|
@@ -9834,7 +9846,7 @@ function hi(n) {
|
|
|
9834
9846
|
for (let t = 0; t < n.length; t++) {
|
|
9835
9847
|
for (const s of n[t].tokens)
|
|
9836
9848
|
e.push(s);
|
|
9837
|
-
t < n.length - 1 && e.push(new
|
|
9849
|
+
t < n.length - 1 && e.push(new je(1, void 0));
|
|
9838
9850
|
}
|
|
9839
9851
|
return e;
|
|
9840
9852
|
}
|
|
@@ -10039,7 +10051,7 @@ class Po extends W {
|
|
|
10039
10051
|
_show(e, t) {
|
|
10040
10052
|
const s = this._widget.element;
|
|
10041
10053
|
s.style.display = "", this._visible = !0;
|
|
10042
|
-
const i = s.offsetHeight, o = this._getViewportRect(), r = this._view.coordinateSpace.capture(), c = r.toClientRect(e), a = r.toClientRect(
|
|
10054
|
+
const i = s.offsetHeight, o = this._getViewportRect(), r = this._view.coordinateSpace.capture(), c = r.toClientRect(e), a = r.toClientRect(T.fromPointSize(0, 0, 0, i)).height, l = r.toClientRect(T.fromPointSize(0, 0, 0, this._gap)).height, d = c.top, h = c.bottom + l + a <= o.bottom, f = d - l - a >= o.top, p = (t ? f || !h : !h && f) ? e.y - this._gap - i : e.y + e.height + this._gap;
|
|
10043
10055
|
this._anchorX = e.x, this._layoutHorizontally(), s.style.top = `${p}px`;
|
|
10044
10056
|
}
|
|
10045
10057
|
_layoutHorizontally() {
|
|
@@ -10600,18 +10612,18 @@ export {
|
|
|
10600
10612
|
uh as CommentsView,
|
|
10601
10613
|
N as CursorPosition,
|
|
10602
10614
|
yl as CursorView,
|
|
10603
|
-
|
|
10604
|
-
|
|
10615
|
+
rt as CursorViewRendering,
|
|
10616
|
+
Je as DEFAULT_INDENTATION_CONFIG,
|
|
10605
10617
|
Fo as DEFAULT_WORD_NAVIGATION_CONFIG,
|
|
10606
10618
|
kh as DEFAULT_WORD_SEPARATORS,
|
|
10607
|
-
|
|
10619
|
+
bn as DocumentAstNode,
|
|
10608
10620
|
Bn as DocumentViewNode,
|
|
10609
10621
|
ch as EditorController,
|
|
10610
|
-
|
|
10622
|
+
Ot as EditorCoordinateSpace,
|
|
10611
10623
|
Ca as EditorCoordinateTransform,
|
|
10612
10624
|
th as EditorModel,
|
|
10613
10625
|
nh as EditorView,
|
|
10614
|
-
|
|
10626
|
+
_n as EmphasisAstNode,
|
|
10615
10627
|
Ie as EmptyBlockAstNode,
|
|
10616
10628
|
zl as FIND_MATCH_LIMIT,
|
|
10617
10629
|
td as FindController,
|
|
@@ -10622,11 +10634,11 @@ export {
|
|
|
10622
10634
|
Ne as FrontMatterAstNode,
|
|
10623
10635
|
S as GlueAstNode,
|
|
10624
10636
|
ye as HeadingAstNode,
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10637
|
+
Ye as ImageAstNode,
|
|
10638
|
+
kn as InlineCodeAstNode,
|
|
10639
|
+
wn as InlineMathAstNode,
|
|
10628
10640
|
Re as LengthEdit,
|
|
10629
|
-
|
|
10641
|
+
pn as LengthReplacement,
|
|
10630
10642
|
Ce as LinkAstNode,
|
|
10631
10643
|
H as ListAstNode,
|
|
10632
10644
|
$ as ListItemAstNode,
|
|
@@ -10642,18 +10654,18 @@ export {
|
|
|
10642
10654
|
v as OffsetRange,
|
|
10643
10655
|
ie as ParagraphAstNode,
|
|
10644
10656
|
se as Point2D,
|
|
10645
|
-
|
|
10657
|
+
T as Rect2D,
|
|
10646
10658
|
fh as RenameModel,
|
|
10647
10659
|
mh as RenameWidget,
|
|
10648
|
-
|
|
10660
|
+
Xe as RichLink,
|
|
10649
10661
|
y as Selection,
|
|
10650
10662
|
ml as SelectionView,
|
|
10651
10663
|
Ps as SelectionViewRendering,
|
|
10652
|
-
|
|
10653
|
-
|
|
10664
|
+
vn as StrikethroughAstNode,
|
|
10665
|
+
L as StringEdit,
|
|
10654
10666
|
_e as StringReplacement,
|
|
10655
10667
|
Kn as StringValue,
|
|
10656
|
-
|
|
10668
|
+
gn as StrongAstNode,
|
|
10657
10669
|
ph as SuggestModel,
|
|
10658
10670
|
gh as SuggestWidget,
|
|
10659
10671
|
Ae as TableAstNode,
|
|
@@ -10661,15 +10673,15 @@ export {
|
|
|
10661
10673
|
ze as TableRowAstNode,
|
|
10662
10674
|
Oe as TextAstNode,
|
|
10663
10675
|
xe as ThematicBreakAstNode,
|
|
10664
|
-
|
|
10665
|
-
|
|
10676
|
+
je as Token,
|
|
10677
|
+
Y as VideoAstNode,
|
|
10666
10678
|
ce as ViewNode,
|
|
10667
10679
|
er as VirtualCursorLine,
|
|
10668
10680
|
yt as VisualLine,
|
|
10669
|
-
|
|
10681
|
+
Ze as VisualLineMap,
|
|
10670
10682
|
be as VisualRun,
|
|
10671
|
-
|
|
10672
|
-
|
|
10683
|
+
Yt as blocksIntersecting,
|
|
10684
|
+
fn as commands,
|
|
10673
10685
|
zc as copyLinesDown,
|
|
10674
10686
|
Kc as copyLinesUp,
|
|
10675
10687
|
dh as createDefaultMonacoSyntaxHighlighter,
|
|
@@ -10677,8 +10689,8 @@ export {
|
|
|
10677
10689
|
cc as cursorDocumentStart,
|
|
10678
10690
|
hc as cursorDown,
|
|
10679
10691
|
nc as cursorLeft,
|
|
10680
|
-
|
|
10681
|
-
|
|
10692
|
+
en as cursorLineEnd,
|
|
10693
|
+
Jt as cursorLineStart,
|
|
10682
10694
|
ic as cursorMoveLeft,
|
|
10683
10695
|
sc as cursorMoveRight,
|
|
10684
10696
|
tc as cursorRight,
|
|
@@ -10695,8 +10707,8 @@ export {
|
|
|
10695
10707
|
_c as deleteWordLeft,
|
|
10696
10708
|
vc as deleteWordRight,
|
|
10697
10709
|
Io as escapeFindRegex,
|
|
10698
|
-
|
|
10699
|
-
|
|
10710
|
+
Cn as findBlockAtOffset,
|
|
10711
|
+
G as findNodeOffsetById,
|
|
10700
10712
|
_i as findWordAt,
|
|
10701
10713
|
Vo as findWordBoundaryLeft,
|
|
10702
10714
|
Wo as findWordBoundaryRight,
|
|
@@ -10724,7 +10736,7 @@ export {
|
|
|
10724
10736
|
ir as taskCheckboxRange,
|
|
10725
10737
|
eh as visualizeAst,
|
|
10726
10738
|
rh as vscodeHostKeyboardProfile,
|
|
10727
|
-
|
|
10739
|
+
un as vscodeKeyboardProfile,
|
|
10728
10740
|
oh as vscodeLocalKeyboardProfile
|
|
10729
10741
|
};
|
|
10730
10742
|
//# sourceMappingURL=index.js.map
|