@vscode/markdown-editor 0.0.2-67 → 0.0.2-69
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.d.ts +16 -12
- package/dist/index.js +593 -570
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/view/editor.css +1 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { commands as $t } from "./commands.js";
|
|
2
|
-
import { O as w, S as M, a as
|
|
2
|
+
import { O as w, S as M, a as de, c as ps } from "./stringEdit-CVDbCUBY.js";
|
|
3
3
|
import _s from "katex";
|
|
4
4
|
import { observableValue as C, derived as B, transaction as ee, Disposable as H, runOnChange as vs, autorun as P, constObservable as pi } from "@vscode/observables";
|
|
5
5
|
import { D as _i, f as vi, a as wi, b as bi, c as ki, d as ws, i as He } from "./config-BGeaJqWk.js";
|
|
@@ -232,7 +232,7 @@ function ne(n, e) {
|
|
|
232
232
|
const t = n.get(e);
|
|
233
233
|
return t && t !== e ? t : e;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function re(n, e) {
|
|
236
236
|
return e ? ne(n, e) : void 0;
|
|
237
237
|
}
|
|
238
238
|
class ct extends X {
|
|
@@ -288,16 +288,16 @@ class ve extends Q {
|
|
|
288
288
|
return this._withLeading(this.content);
|
|
289
289
|
}
|
|
290
290
|
get marker() {
|
|
291
|
-
return
|
|
291
|
+
return ae(this.content, "content");
|
|
292
292
|
}
|
|
293
293
|
mapChildren(e) {
|
|
294
|
-
return new ve(D(e, this.content),
|
|
294
|
+
return new ve(D(e, this.content), re(e, this.leadingTrivia));
|
|
295
295
|
}
|
|
296
296
|
withLeadingTrivia(e) {
|
|
297
297
|
return new ve(this.content, e);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function ae(n, e) {
|
|
301
301
|
return n.find((t) => t instanceof y && t.markerKind === e);
|
|
302
302
|
}
|
|
303
303
|
class Wt extends X {
|
|
@@ -399,7 +399,7 @@ class me extends Q {
|
|
|
399
399
|
return this._withLeading(this.content);
|
|
400
400
|
}
|
|
401
401
|
get code() {
|
|
402
|
-
return
|
|
402
|
+
return ae(this.content, "content");
|
|
403
403
|
}
|
|
404
404
|
/**
|
|
405
405
|
* Lossless slices when this raw HTML block starts one comment after optional
|
|
@@ -436,7 +436,7 @@ class me extends Q {
|
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
438
|
mapChildren(e) {
|
|
439
|
-
return new me(this.tokenType, D(e, this.content),
|
|
439
|
+
return new me(this.tokenType, D(e, this.content), re(e, this.leadingTrivia));
|
|
440
440
|
}
|
|
441
441
|
withLeadingTrivia(e) {
|
|
442
442
|
return new me(this.tokenType, this.content, e);
|
|
@@ -454,7 +454,7 @@ class ge extends Q {
|
|
|
454
454
|
return this._withLeading([this.marker, ...this.content]);
|
|
455
455
|
}
|
|
456
456
|
mapChildren(e) {
|
|
457
|
-
return new ge(this.level, ne(e, this.marker), D(e, this.content),
|
|
457
|
+
return new ge(this.level, ne(e, this.marker), D(e, this.content), re(e, this.leadingTrivia));
|
|
458
458
|
}
|
|
459
459
|
withLeadingTrivia(e) {
|
|
460
460
|
return new ge(this.level, this.marker, this.content, e);
|
|
@@ -472,7 +472,7 @@ class se extends Q {
|
|
|
472
472
|
return this._withLeading(this.content);
|
|
473
473
|
}
|
|
474
474
|
mapChildren(e) {
|
|
475
|
-
return new se(D(e, this.content),
|
|
475
|
+
return new se(D(e, this.content), re(e, this.leadingTrivia));
|
|
476
476
|
}
|
|
477
477
|
withLeadingTrivia(e) {
|
|
478
478
|
return new se(this.content, e);
|
|
@@ -487,16 +487,16 @@ class Ce extends Q {
|
|
|
487
487
|
return this._withLeading(this.content);
|
|
488
488
|
}
|
|
489
489
|
get openFence() {
|
|
490
|
-
return
|
|
490
|
+
return ae(this.content, "openFence");
|
|
491
491
|
}
|
|
492
492
|
get closeFence() {
|
|
493
|
-
return
|
|
493
|
+
return ae(this.content, "closeFence");
|
|
494
494
|
}
|
|
495
495
|
get value() {
|
|
496
|
-
return
|
|
496
|
+
return ae(this.content, "content");
|
|
497
497
|
}
|
|
498
498
|
mapChildren(e) {
|
|
499
|
-
return new Ce(D(e, this.content),
|
|
499
|
+
return new Ce(D(e, this.content), re(e, this.leadingTrivia));
|
|
500
500
|
}
|
|
501
501
|
withLeadingTrivia(e) {
|
|
502
502
|
return new Ce(this.content, e);
|
|
@@ -513,13 +513,13 @@ class j extends Q {
|
|
|
513
513
|
return this._withLeading(this.content);
|
|
514
514
|
}
|
|
515
515
|
get openFence() {
|
|
516
|
-
return
|
|
516
|
+
return ae(this.content, "openFence");
|
|
517
517
|
}
|
|
518
518
|
get closeFence() {
|
|
519
|
-
return
|
|
519
|
+
return ae(this.content, "closeFence");
|
|
520
520
|
}
|
|
521
521
|
get code() {
|
|
522
|
-
return
|
|
522
|
+
return ae(this.content, "content");
|
|
523
523
|
}
|
|
524
524
|
/** Relative start offset of the {@link code} marker within this block. */
|
|
525
525
|
get codeOffset() {
|
|
@@ -532,7 +532,7 @@ class j extends Q {
|
|
|
532
532
|
return e;
|
|
533
533
|
}
|
|
534
534
|
mapChildren(e) {
|
|
535
|
-
return new j(this.language, this.infoString, D(e, this.content),
|
|
535
|
+
return new j(this.language, this.infoString, D(e, this.content), re(e, this.leadingTrivia));
|
|
536
536
|
}
|
|
537
537
|
withLeadingTrivia(e) {
|
|
538
538
|
return new j(this.language, this.infoString, this.content, e);
|
|
@@ -569,10 +569,10 @@ class we extends Q {
|
|
|
569
569
|
return this._withLeading(this.content);
|
|
570
570
|
}
|
|
571
571
|
get code() {
|
|
572
|
-
return
|
|
572
|
+
return ae(this.content, "content");
|
|
573
573
|
}
|
|
574
574
|
mapChildren(e) {
|
|
575
|
-
return new we(D(e, this.content),
|
|
575
|
+
return new we(D(e, this.content), re(e, this.leadingTrivia));
|
|
576
576
|
}
|
|
577
577
|
withLeadingTrivia(e) {
|
|
578
578
|
return new we(this.content, e);
|
|
@@ -590,7 +590,7 @@ class Se extends Q {
|
|
|
590
590
|
return this.content.filter(Ut);
|
|
591
591
|
}
|
|
592
592
|
mapChildren(e) {
|
|
593
|
-
return new Se(D(e, this.content),
|
|
593
|
+
return new Se(D(e, this.content), re(e, this.leadingTrivia));
|
|
594
594
|
}
|
|
595
595
|
withLeadingTrivia(e) {
|
|
596
596
|
return new Se(this.content, e);
|
|
@@ -608,7 +608,7 @@ class z extends Q {
|
|
|
608
608
|
return this.content.filter((e) => e instanceof q);
|
|
609
609
|
}
|
|
610
610
|
mapChildren(e) {
|
|
611
|
-
return new z(this.ordered, D(e, this.content),
|
|
611
|
+
return new z(this.ordered, D(e, this.content), re(e, this.leadingTrivia));
|
|
612
612
|
}
|
|
613
613
|
withLeadingTrivia(e) {
|
|
614
614
|
return new z(this.ordered, this.content, e);
|
|
@@ -664,7 +664,7 @@ class Le extends Q {
|
|
|
664
664
|
return this._rows.slice(2);
|
|
665
665
|
}
|
|
666
666
|
mapChildren(e) {
|
|
667
|
-
return new Le(D(e, this.content),
|
|
667
|
+
return new Le(D(e, this.content), re(e, this.leadingTrivia));
|
|
668
668
|
}
|
|
669
669
|
withLeadingTrivia(e) {
|
|
670
670
|
return new Le(this.content, e);
|
|
@@ -715,19 +715,19 @@ class Xt extends X {
|
|
|
715
715
|
function Ut(n) {
|
|
716
716
|
return n instanceof ge || n instanceof se || n instanceof Ce || n instanceof j || n instanceof we || n instanceof ve || n instanceof Se || n instanceof z || n instanceof Le || n instanceof me;
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function ie(n, e) {
|
|
719
719
|
if (n.id === e.id)
|
|
720
720
|
return 0;
|
|
721
721
|
let t = 0;
|
|
722
722
|
for (const s of n.children) {
|
|
723
|
-
const i =
|
|
723
|
+
const i = ie(s, e);
|
|
724
724
|
if (i !== void 0)
|
|
725
725
|
return t + i;
|
|
726
726
|
t += s.length;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
const Bi = /\[[ xX]\]/;
|
|
730
|
-
function
|
|
730
|
+
function Pi(n) {
|
|
731
731
|
if (n.checked === void 0)
|
|
732
732
|
return;
|
|
733
733
|
const e = Bi.exec(bs(n));
|
|
@@ -742,7 +742,7 @@ function bs(n) {
|
|
|
742
742
|
e += bs(t);
|
|
743
743
|
return e;
|
|
744
744
|
}
|
|
745
|
-
function
|
|
745
|
+
function Ai(n) {
|
|
746
746
|
const e = yi({ extensions: [Ci(), Si(), Li(), Mi(), Ti()] }), t = xi()(n, void 0, !0);
|
|
747
747
|
return Ei(e.document().write(t)).map(([i, o]) => ({
|
|
748
748
|
type: i,
|
|
@@ -751,10 +751,10 @@ function Pi(n) {
|
|
|
751
751
|
endOffset: o.end.offset
|
|
752
752
|
}));
|
|
753
753
|
}
|
|
754
|
-
function
|
|
755
|
-
return new
|
|
754
|
+
function Di(n) {
|
|
755
|
+
return new Hi(Ai(n), n).build();
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const Fi = /* @__PURE__ */ new Set([
|
|
758
758
|
"htmlFlow",
|
|
759
759
|
"setextHeading",
|
|
760
760
|
"definition"
|
|
@@ -764,7 +764,7 @@ function We(n) {
|
|
|
764
764
|
for (let t = 0; t < n.length; t++) {
|
|
765
765
|
const s = n[t], i = n[t + 1];
|
|
766
766
|
if (s instanceof W && s.glueKind === "indent") {
|
|
767
|
-
const o = i !== void 0 ?
|
|
767
|
+
const o = i !== void 0 ? Vi(i, s) : void 0;
|
|
768
768
|
if (o) {
|
|
769
769
|
e.push(o), t++;
|
|
770
770
|
continue;
|
|
@@ -781,7 +781,7 @@ function We(n) {
|
|
|
781
781
|
}
|
|
782
782
|
return e;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Vi(n, e) {
|
|
785
785
|
if (n instanceof z) {
|
|
786
786
|
const t = n.content.findIndex((i) => i instanceof q);
|
|
787
787
|
if (t < 0)
|
|
@@ -863,7 +863,7 @@ function _t(n, e) {
|
|
|
863
863
|
}
|
|
864
864
|
return [...n, e];
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function $i(n) {
|
|
867
867
|
return n.some((e) => !(e instanceof W)) ? n : [new se(n)];
|
|
868
868
|
}
|
|
869
869
|
class A {
|
|
@@ -892,7 +892,7 @@ class A {
|
|
|
892
892
|
return i < o && r(i, o), s;
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
|
-
class
|
|
895
|
+
class Hi {
|
|
896
896
|
constructor(e, t) {
|
|
897
897
|
this._events = e, this._source = t;
|
|
898
898
|
}
|
|
@@ -914,7 +914,7 @@ class $i {
|
|
|
914
914
|
} else
|
|
915
915
|
this._idx++;
|
|
916
916
|
}
|
|
917
|
-
return new Xt(
|
|
917
|
+
return new Xt($i(Ke(We(e.build(this._source.length)))));
|
|
918
918
|
}
|
|
919
919
|
_tryParseBlock() {
|
|
920
920
|
switch (this._events[this._idx].tokenType) {
|
|
@@ -976,7 +976,7 @@ class $i {
|
|
|
976
976
|
*/
|
|
977
977
|
_tryParseUnhandled(e) {
|
|
978
978
|
const t = this._events[this._idx], s = t.startOffset;
|
|
979
|
-
if (s >= e &&
|
|
979
|
+
if (s >= e && Fi.has(t.tokenType))
|
|
980
980
|
return { node: this._parseUnhandledBlock(), start: s };
|
|
981
981
|
this._idx++;
|
|
982
982
|
}
|
|
@@ -1471,7 +1471,7 @@ class ys {
|
|
|
1471
1471
|
return e - t;
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
class
|
|
1474
|
+
class Wi {
|
|
1475
1475
|
_byRange = /* @__PURE__ */ new Map();
|
|
1476
1476
|
_byId = /* @__PURE__ */ new Map();
|
|
1477
1477
|
constructor(e) {
|
|
@@ -1509,45 +1509,45 @@ function xs(n, e, t, s, i) {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
const l = t.getOriginalOffset(e), d = l !== void 0 ? s.lookupId(l, c.kind) : void 0;
|
|
1511
1511
|
if (d && d.id !== c.id && (c = c.cloneWithId(d.id)), c instanceof j && d instanceof j && l !== void 0) {
|
|
1512
|
-
const u =
|
|
1512
|
+
const u = Ki(c, d, l, i);
|
|
1513
1513
|
if (u)
|
|
1514
1514
|
return u;
|
|
1515
1515
|
}
|
|
1516
1516
|
return c;
|
|
1517
1517
|
}
|
|
1518
|
-
function
|
|
1518
|
+
function Ki(n, e, t, s) {
|
|
1519
1519
|
const i = e.code, o = n.code;
|
|
1520
1520
|
if (!i || !o || n.infoString !== e.infoString || n.openFence?.content !== e.openFence?.content || n.closeFence?.content !== e.closeFence?.content)
|
|
1521
1521
|
return;
|
|
1522
1522
|
const r = t + e.codeOffset, c = r + i.length;
|
|
1523
|
-
if (!
|
|
1523
|
+
if (!zi(s, r, c))
|
|
1524
1524
|
return;
|
|
1525
|
-
const a =
|
|
1525
|
+
const a = qi(s, -r);
|
|
1526
1526
|
if (a.apply(i.content) === o.content)
|
|
1527
1527
|
return n.withCodeDiff(e, a);
|
|
1528
1528
|
}
|
|
1529
|
-
function
|
|
1529
|
+
function zi(n, e, t) {
|
|
1530
1530
|
for (const s of n.replacements)
|
|
1531
1531
|
if (s.replaceRange.start < e || s.replaceRange.endExclusive > t)
|
|
1532
1532
|
return !1;
|
|
1533
1533
|
return !0;
|
|
1534
1534
|
}
|
|
1535
|
-
function
|
|
1536
|
-
return new M(n.replacements.map((t) =>
|
|
1537
|
-
}
|
|
1538
|
-
function qi(n, e, t) {
|
|
1539
|
-
return xs(n, 0, new ys(t), new Hi(e), t);
|
|
1535
|
+
function qi(n, e) {
|
|
1536
|
+
return new M(n.replacements.map((t) => de.replace(t.replaceRange.delta(e), t.newText)));
|
|
1540
1537
|
}
|
|
1541
1538
|
function Gi(n, e, t) {
|
|
1542
|
-
|
|
1543
|
-
|
|
1539
|
+
return xs(n, 0, new ys(t), new Wi(e), t);
|
|
1540
|
+
}
|
|
1541
|
+
function Xi(n, e, t) {
|
|
1542
|
+
const s = Di(n);
|
|
1543
|
+
return !e || !t ? s : Gi(s, e, t);
|
|
1544
1544
|
}
|
|
1545
|
-
class
|
|
1545
|
+
class Ui {
|
|
1546
1546
|
parse(e, t, s) {
|
|
1547
|
-
return
|
|
1547
|
+
return Xi(e.value, t, s);
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
|
-
function
|
|
1550
|
+
function Yi(n, e, t = 0) {
|
|
1551
1551
|
if (n.children.length === 0) {
|
|
1552
1552
|
const o = Es(e.substring(t, t + n.length));
|
|
1553
1553
|
if (n instanceof Re)
|
|
@@ -1557,7 +1557,7 @@ function Ui(n, e, t = 0) {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
let s = "", i = t;
|
|
1559
1559
|
for (const o of n.children)
|
|
1560
|
-
s +=
|
|
1560
|
+
s += Yi(o, e, i), i += o.length;
|
|
1561
1561
|
return `<${n.kind}${on(n)}>${s}</${n.kind}>`;
|
|
1562
1562
|
}
|
|
1563
1563
|
function on(n) {
|
|
@@ -1567,25 +1567,25 @@ function on(n) {
|
|
|
1567
1567
|
function Es(n) {
|
|
1568
1568
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function ji(n) {
|
|
1571
1571
|
return n instanceof Re ? `text ${JSON.stringify(n.content)}` : n instanceof W ? `glue${n.glueKind ? `(${n.glueKind})` : ""} ${JSON.stringify(n.content)}` : n instanceof y ? `marker(${n.markerKind}) ${JSON.stringify(n.content)}` : n instanceof ve ? `thematicBreak ${JSON.stringify(n.content)}` : n instanceof ge ? `heading(level=${n.level})` : n instanceof z ? `list(ordered=${n.ordered})` : n instanceof q ? n.checked === void 0 ? "listItem" : `listItem(checked=${n.checked})` : n instanceof j ? `codeBlock(language=${JSON.stringify(n.language)})` : n instanceof we ? "mathBlock" : n instanceof Pe ? `link(url=${JSON.stringify(n.url)})` : n instanceof Ae ? `image(alt=${JSON.stringify(n.alt)}, url=${JSON.stringify(n.url)})` : n.kind;
|
|
1572
1572
|
}
|
|
1573
1573
|
const rn = /* @__PURE__ */ new WeakMap();
|
|
1574
|
-
let
|
|
1575
|
-
function
|
|
1574
|
+
let Qi = 0;
|
|
1575
|
+
function Zi(n) {
|
|
1576
1576
|
let e = rn.get(n);
|
|
1577
|
-
return e === void 0 && (e =
|
|
1577
|
+
return e === void 0 && (e = Qi++, rn.set(n, e)), e;
|
|
1578
1578
|
}
|
|
1579
1579
|
function vl(n, e) {
|
|
1580
1580
|
let t = 0;
|
|
1581
1581
|
function s(i) {
|
|
1582
1582
|
const o = t, r = i.children;
|
|
1583
1583
|
let c;
|
|
1584
|
-
return r.length === 0 ? t += i.length : c = r.map(s), { label: `${
|
|
1584
|
+
return r.length === 0 ? t += i.length : c = r.map(s), { label: `${ji(i)} #${Zi(i)} nid=${i.id}`, range: [o, t], children: c };
|
|
1585
1585
|
}
|
|
1586
1586
|
return { $fileExtension: "ast.w", source: e, root: s(n) };
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function Ji(n) {
|
|
1589
1589
|
let e = 0;
|
|
1590
1590
|
const t = [];
|
|
1591
1591
|
for (const s of n.replacements) {
|
|
@@ -1597,33 +1597,33 @@ function Zi(n) {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
return t;
|
|
1599
1599
|
}
|
|
1600
|
-
const
|
|
1600
|
+
const eo = {}, Cs = C(eo, !1), to = Cs;
|
|
1601
1601
|
let Ot, vt;
|
|
1602
|
-
function
|
|
1602
|
+
function no() {
|
|
1603
1603
|
return vt || (vt = Oi({ useWasm: !1 }).then((n) => {
|
|
1604
1604
|
Ot = n, Cs.set(!0, void 0);
|
|
1605
1605
|
}).catch(() => {
|
|
1606
1606
|
})), vt;
|
|
1607
1607
|
}
|
|
1608
|
-
|
|
1609
|
-
function
|
|
1608
|
+
no();
|
|
1609
|
+
function so(n, e) {
|
|
1610
1610
|
if (!Ot)
|
|
1611
1611
|
throw new Error("Diff computer not loaded yet — await ensureDiffComputer() / observe diffComputerReady first.");
|
|
1612
1612
|
const t = Ot.computeDiff(n, e, { extendToSubwords: !0 });
|
|
1613
|
-
return
|
|
1613
|
+
return io(t.edits.stripData());
|
|
1614
1614
|
}
|
|
1615
|
-
function
|
|
1616
|
-
return new M(n.replacements.map((e) =>
|
|
1615
|
+
function io(n) {
|
|
1616
|
+
return new M(n.replacements.map((e) => de.replace(new w(e.range.start, e.range.endExclusive), e.newText)));
|
|
1617
1617
|
}
|
|
1618
|
-
const
|
|
1618
|
+
const oo = /* @__PURE__ */ new Set([
|
|
1619
1619
|
"document",
|
|
1620
1620
|
"list",
|
|
1621
1621
|
"blockQuote",
|
|
1622
1622
|
"table",
|
|
1623
1623
|
"tableRow"
|
|
1624
|
-
]),
|
|
1625
|
-
function
|
|
1626
|
-
const s = new ys(t), i =
|
|
1624
|
+
]), ro = /* @__PURE__ */ new Set(["glue", "marker"]);
|
|
1625
|
+
function co(n, e, t) {
|
|
1626
|
+
const s = new ys(t), i = Ji(t);
|
|
1627
1627
|
return Ss(n, 0, e, 0, s, i);
|
|
1628
1628
|
}
|
|
1629
1629
|
function Ss(n, e, t, s, i, o) {
|
|
@@ -1634,7 +1634,7 @@ function Ss(n, e, t, s, i, o) {
|
|
|
1634
1634
|
for (; l < r.length && h !== void 0 && r[l].start + r[l].node.length <= h; )
|
|
1635
1635
|
a.push(an(r[l], o)), l++;
|
|
1636
1636
|
const f = l < r.length ? r[l] : void 0, m = f ? w.ofStartAndLength(f.start, f.node.length) : void 0, g = i.getOriginalRange(u);
|
|
1637
|
-
g && m && g.equals(m) ? (a.push({ kind: "unchanged", node: d.node, modifiedStart: d.start }), l++) : f && m && f.node.kind === d.node.kind && h !== void 0 && m.contains(h) ? (l++,
|
|
1637
|
+
g && m && g.equals(m) ? (a.push({ kind: "unchanged", node: d.node, modifiedStart: d.start }), l++) : f && m && f.node.kind === d.node.kind && h !== void 0 && m.contains(h) ? (l++, oo.has(d.node.kind) ? a.push({
|
|
1638
1638
|
kind: "nested",
|
|
1639
1639
|
original: f.node,
|
|
1640
1640
|
originalStart: f.start,
|
|
@@ -1649,7 +1649,7 @@ function Ss(n, e, t, s, i, o) {
|
|
|
1649
1649
|
modifiedStart: d.start,
|
|
1650
1650
|
insertedLocal: et(u, d.start, o, "modified", "inserted"),
|
|
1651
1651
|
deletedLocal: et(m, f.start, o, "original", "deleted")
|
|
1652
|
-
})) : a.push(
|
|
1652
|
+
})) : a.push(ao(d, o));
|
|
1653
1653
|
}
|
|
1654
1654
|
for (; l < r.length; )
|
|
1655
1655
|
a.push(an(r[l], o)), l++;
|
|
@@ -1659,10 +1659,10 @@ function cn(n, e) {
|
|
|
1659
1659
|
const t = [];
|
|
1660
1660
|
let s = e;
|
|
1661
1661
|
for (const i of n.children)
|
|
1662
|
-
|
|
1662
|
+
ro.has(i.kind) || t.push({ node: i, start: s }), s += i.length;
|
|
1663
1663
|
return t;
|
|
1664
1664
|
}
|
|
1665
|
-
function
|
|
1665
|
+
function ao(n, e) {
|
|
1666
1666
|
const t = w.ofStartAndLength(n.start, n.node.length);
|
|
1667
1667
|
let s = et(t, n.start, e, "modified", "inserted");
|
|
1668
1668
|
return s.length === 0 && (s = [{ range: w.ofLength(n.node.length), kind: "inserted" }]), { kind: "added", node: n.node, modifiedStart: n.start, insertedLocal: s };
|
|
@@ -1680,9 +1680,9 @@ function et(n, e, t, s, i) {
|
|
|
1680
1680
|
}
|
|
1681
1681
|
return o;
|
|
1682
1682
|
}
|
|
1683
|
-
const
|
|
1683
|
+
const lo = Symbol("NO_ACTIVE_BLOCKS");
|
|
1684
1684
|
class wl {
|
|
1685
|
-
_parser = new
|
|
1685
|
+
_parser = new Ui();
|
|
1686
1686
|
_sourceEditListeners = /* @__PURE__ */ new Set();
|
|
1687
1687
|
_sourceTextIds = /* @__PURE__ */ new WeakMap();
|
|
1688
1688
|
_lastSourceTextId = 0;
|
|
@@ -1698,11 +1698,12 @@ class wl {
|
|
|
1698
1698
|
/**
|
|
1699
1699
|
* Read-only mode. When `true`, the editor never reveals a block's source
|
|
1700
1700
|
* markers (markdown special characters like `**`, `#`, list bullets, code
|
|
1701
|
-
* fences, `$…$`) — every block stays in its clean rendered form regardless
|
|
1702
|
-
*
|
|
1703
|
-
*
|
|
1704
|
-
*
|
|
1705
|
-
*
|
|
1701
|
+
* fences, `$…$`) — every block stays in its clean rendered form regardless of
|
|
1702
|
+
* where the caret/selection is — and text-editing commands are ignored.
|
|
1703
|
+
* Explicit interactions with rendered controls, such as task checkboxes,
|
|
1704
|
+
* remain available. Plain text selection still works everywhere (so the user
|
|
1705
|
+
* can copy). The default (`false`) is the normal editing mode where the active
|
|
1706
|
+
* block reveals its markers.
|
|
1706
1707
|
*/
|
|
1707
1708
|
readonlyMode = C(this, !1);
|
|
1708
1709
|
/**
|
|
@@ -1763,13 +1764,16 @@ class wl {
|
|
|
1763
1764
|
* The parsed document. Threads the previous document into the parser so
|
|
1764
1765
|
* unchanged blocks keep their object identity across reparses (see
|
|
1765
1766
|
* {@link MarkdownParser.parse}). Writing `previous` inside the compute is
|
|
1766
|
-
*
|
|
1767
|
-
*
|
|
1767
|
+
* safe: unchanged source reuses it directly, while changed source produces
|
|
1768
|
+
* a result structurally identical to a full reparse.
|
|
1768
1769
|
*/
|
|
1769
1770
|
document = (() => {
|
|
1770
1771
|
let e, t;
|
|
1771
1772
|
return B(this, (s) => {
|
|
1772
|
-
const i = s.readObservable(this.sourceText)
|
|
1773
|
+
const i = s.readObservable(this.sourceText);
|
|
1774
|
+
if (e && t === i.value)
|
|
1775
|
+
return e;
|
|
1776
|
+
const o = this._pendingEdit, r = o && o.baseText === t && o.newText === i.value ? o.edit : void 0, c = this._parser.parse(i, e, r);
|
|
1773
1777
|
return e = c, t = i.value, c;
|
|
1774
1778
|
});
|
|
1775
1779
|
})();
|
|
@@ -1796,7 +1800,7 @@ class wl {
|
|
|
1796
1800
|
if (e.readObservable(this.pendingParagraph) !== void 0)
|
|
1797
1801
|
return /* @__PURE__ */ new Set();
|
|
1798
1802
|
const t = e.readObservable(this.activeBlocksOverride);
|
|
1799
|
-
if (t ===
|
|
1803
|
+
if (t === lo)
|
|
1800
1804
|
return /* @__PURE__ */ new Set();
|
|
1801
1805
|
if (t !== void 0)
|
|
1802
1806
|
return new Set(t);
|
|
@@ -1822,9 +1826,9 @@ class wl {
|
|
|
1822
1826
|
*/
|
|
1823
1827
|
diff = B(this, (e) => {
|
|
1824
1828
|
const t = e.readObservable(this._baselineDocument), s = e.readObservable(this.baseline);
|
|
1825
|
-
if (!t || !s || !e.readObservable(
|
|
1829
|
+
if (!t || !s || !e.readObservable(to))
|
|
1826
1830
|
return;
|
|
1827
|
-
const i = e.readObservable(this.document), o = e.readObservable(this.sourceText), r =
|
|
1831
|
+
const i = e.readObservable(this.document), o = e.readObservable(this.sourceText), r = so(s.value, o.value), c = co(t, i, r), a = [], l = (u, h) => {
|
|
1828
1832
|
for (const f of u)
|
|
1829
1833
|
if (f.kind === "replaced")
|
|
1830
1834
|
for (const m of f.insertedLocal)
|
|
@@ -1912,6 +1916,16 @@ class wl {
|
|
|
1912
1916
|
`), r = t.replaceRange.start + i.length + s.length, c = M.replace(t.replaceRange, o);
|
|
1913
1917
|
this._applySourceEdit(c, k.collapsed(r));
|
|
1914
1918
|
}
|
|
1919
|
+
/** Sets a rendered task checkbox state in either editing or read-only mode. */
|
|
1920
|
+
setTaskCheckboxChecked(e, t) {
|
|
1921
|
+
if (e.checked === t)
|
|
1922
|
+
return;
|
|
1923
|
+
const s = ie(this.document.get(), e), i = Pi(e);
|
|
1924
|
+
if (s === void 0 || i === void 0)
|
|
1925
|
+
return;
|
|
1926
|
+
const o = M.replace(i.delta(s), t ? "[x]" : "[ ]");
|
|
1927
|
+
this._applySourceEdit(o, this.selection.get() ?? k.collapsed(0));
|
|
1928
|
+
}
|
|
1915
1929
|
applyEdit(e, t) {
|
|
1916
1930
|
if (this.readonlyMode.get())
|
|
1917
1931
|
return;
|
|
@@ -1979,7 +1993,7 @@ class De {
|
|
|
1979
1993
|
}
|
|
1980
1994
|
static EMPTY = new De([]);
|
|
1981
1995
|
static measure(e, t, s = t.capture()) {
|
|
1982
|
-
return
|
|
1996
|
+
return fo(e, t, s);
|
|
1983
1997
|
}
|
|
1984
1998
|
/** Lines backed by source ranges, excluding source-less cursor lines. */
|
|
1985
1999
|
sourceLines;
|
|
@@ -2232,7 +2246,7 @@ class _e {
|
|
|
2232
2246
|
return e < this.sourceStart ? this.sourceStart - e : e > this.sourceEndExclusive ? e - this.sourceEndExclusive : 0;
|
|
2233
2247
|
}
|
|
2234
2248
|
xAtOffset(e) {
|
|
2235
|
-
return this.sourceLength === 0 || e <= this.sourceStart ? this.rect.left : this.source ?
|
|
2249
|
+
return this.sourceLength === 0 || e <= this.sourceStart ? this.rect.left : this.source ? ho(
|
|
2236
2250
|
this.source.textNode,
|
|
2237
2251
|
this.source.textNodeStart + (e - this.sourceStart),
|
|
2238
2252
|
this.rect.left,
|
|
@@ -2243,7 +2257,7 @@ class _e {
|
|
|
2243
2257
|
if (this.rect.width <= 0)
|
|
2244
2258
|
return this.sourceStart;
|
|
2245
2259
|
if (this.source) {
|
|
2246
|
-
const s =
|
|
2260
|
+
const s = uo(
|
|
2247
2261
|
this.source.textNode,
|
|
2248
2262
|
this.source.textNodeStart,
|
|
2249
2263
|
this.source.textNodeStart + this.sourceLength,
|
|
@@ -2256,7 +2270,7 @@ class _e {
|
|
|
2256
2270
|
return e < t ? this.sourceStart : this.sourceEndExclusive;
|
|
2257
2271
|
}
|
|
2258
2272
|
}
|
|
2259
|
-
function
|
|
2273
|
+
function ho(n, e, t, s) {
|
|
2260
2274
|
if (e <= 0)
|
|
2261
2275
|
return t;
|
|
2262
2276
|
const i = document.createRange();
|
|
@@ -2264,7 +2278,7 @@ function lo(n, e, t, s) {
|
|
|
2264
2278
|
const o = i.getBoundingClientRect();
|
|
2265
2279
|
return o.width === 0 && o.height === 0 ? t : s.capture().toLocalRect(o).right;
|
|
2266
2280
|
}
|
|
2267
|
-
function
|
|
2281
|
+
function uo(n, e, t, s, i) {
|
|
2268
2282
|
const o = document.createRange(), r = i.capture();
|
|
2269
2283
|
let c = e, a = 1 / 0;
|
|
2270
2284
|
for (let l = e; l < t; l++) {
|
|
@@ -2278,7 +2292,7 @@ function ho(n, e, t, s, i) {
|
|
|
2278
2292
|
}
|
|
2279
2293
|
return c;
|
|
2280
2294
|
}
|
|
2281
|
-
function
|
|
2295
|
+
function fo(n, e, t) {
|
|
2282
2296
|
const s = [];
|
|
2283
2297
|
for (const u of n) {
|
|
2284
2298
|
const h = s.length;
|
|
@@ -2291,7 +2305,7 @@ function uo(n, e, t) {
|
|
|
2291
2305
|
const p = _.getClientRects();
|
|
2292
2306
|
if (p.length === 0)
|
|
2293
2307
|
return;
|
|
2294
|
-
const v =
|
|
2308
|
+
const v = mo(Array.from(p, (b) => t.toLocalRect(b))), E = po(g.parentElement);
|
|
2295
2309
|
if (f.sourceLength === 0) {
|
|
2296
2310
|
s.push(_e.visualLineAnchor(
|
|
2297
2311
|
m,
|
|
@@ -2306,7 +2320,7 @@ function uo(n, e, t) {
|
|
|
2306
2320
|
{ textNode: g, textNodeStart: 0, coordinateSpace: e }
|
|
2307
2321
|
));
|
|
2308
2322
|
else {
|
|
2309
|
-
const b =
|
|
2323
|
+
const b = go(g, v, t);
|
|
2310
2324
|
for (let x = 0; x < v.length; x++) {
|
|
2311
2325
|
const T = x === 0 ? 0 : b[x - 1], V = x < b.length ? b[x] : g.length;
|
|
2312
2326
|
s.push(new _e(
|
|
@@ -2316,7 +2330,7 @@ function uo(n, e, t) {
|
|
|
2316
2330
|
));
|
|
2317
2331
|
}
|
|
2318
2332
|
}
|
|
2319
|
-
}), s.length === h &&
|
|
2333
|
+
}), s.length === h && _o(s, u.viewNode, u.absoluteStart, t);
|
|
2320
2334
|
}
|
|
2321
2335
|
s.sort((u, h) => u.rect.y - h.rect.y || u.rect.x - h.rect.x);
|
|
2322
2336
|
const i = [];
|
|
@@ -2336,7 +2350,7 @@ function uo(n, e, t) {
|
|
|
2336
2350
|
}
|
|
2337
2351
|
return d(), new De(i);
|
|
2338
2352
|
}
|
|
2339
|
-
function
|
|
2353
|
+
function mo(n) {
|
|
2340
2354
|
const e = [];
|
|
2341
2355
|
for (const t of n) {
|
|
2342
2356
|
const s = e[e.length - 1];
|
|
@@ -2356,7 +2370,7 @@ function fo(n) {
|
|
|
2356
2370
|
function Ms(n, e) {
|
|
2357
2371
|
return Math.min(n.bottom, e.bottom) - Math.max(n.top, e.top) > Math.min(n.height, e.height) / 2;
|
|
2358
2372
|
}
|
|
2359
|
-
function
|
|
2373
|
+
function go(n, e, t) {
|
|
2360
2374
|
const s = [], i = document.createRange();
|
|
2361
2375
|
for (let o = 0; o < e.length - 1; o++) {
|
|
2362
2376
|
const r = e[o + 1].y;
|
|
@@ -2369,7 +2383,7 @@ function mo(n, e, t) {
|
|
|
2369
2383
|
}
|
|
2370
2384
|
return s;
|
|
2371
2385
|
}
|
|
2372
|
-
function
|
|
2386
|
+
function po(n) {
|
|
2373
2387
|
if (!n)
|
|
2374
2388
|
return 0;
|
|
2375
2389
|
const e = getComputedStyle(n);
|
|
@@ -2382,7 +2396,7 @@ function wt(n, e) {
|
|
|
2382
2396
|
const t = (e - n.height) / 2;
|
|
2383
2397
|
return S.fromPointSize(n.x, n.y - t, n.width, e);
|
|
2384
2398
|
}
|
|
2385
|
-
function
|
|
2399
|
+
function _o(n, e, t, s) {
|
|
2386
2400
|
const i = e.dom;
|
|
2387
2401
|
if (i.nodeType !== 1)
|
|
2388
2402
|
return;
|
|
@@ -2395,7 +2409,7 @@ function po(n, e, t, s) {
|
|
|
2395
2409
|
S.fromPointSize(r.x, r.y, r.width, r.height)
|
|
2396
2410
|
));
|
|
2397
2411
|
}
|
|
2398
|
-
class
|
|
2412
|
+
class vo {
|
|
2399
2413
|
_measurements = C(this, []);
|
|
2400
2414
|
measurements = this._measurements;
|
|
2401
2415
|
_virtualLines = C(this, []);
|
|
@@ -2422,23 +2436,23 @@ class _o {
|
|
|
2422
2436
|
});
|
|
2423
2437
|
}
|
|
2424
2438
|
}
|
|
2425
|
-
const ln = /* @__PURE__ */ new WeakMap(),
|
|
2439
|
+
const ln = /* @__PURE__ */ new WeakMap(), wo = 64;
|
|
2426
2440
|
function Me(n, e, t, s) {
|
|
2427
2441
|
const i = s === "right" ? t + 1 : t - 1;
|
|
2428
|
-
return
|
|
2442
|
+
return ce(n, e, t, i, s);
|
|
2429
2443
|
}
|
|
2430
|
-
function
|
|
2444
|
+
function ce(n, e, t, s, i, o = !0) {
|
|
2431
2445
|
s = Math.min(Math.max(s, 0), n.length);
|
|
2432
2446
|
const r = Ts(n, e, t);
|
|
2433
2447
|
if (i === "right")
|
|
2434
|
-
for (let c =
|
|
2448
|
+
for (let c = yo(r, s); c < r.length; c++) {
|
|
2435
2449
|
const a = r[c];
|
|
2436
2450
|
if (a.start > s)
|
|
2437
2451
|
break;
|
|
2438
2452
|
(a.contains(s) || o && a.start === s) && (s = a.endExclusive);
|
|
2439
2453
|
}
|
|
2440
2454
|
else
|
|
2441
|
-
for (let c =
|
|
2455
|
+
for (let c = xo(r, s); c >= 0; c--) {
|
|
2442
2456
|
const a = r[c];
|
|
2443
2457
|
if (a.endExclusive < s)
|
|
2444
2458
|
break;
|
|
@@ -2447,7 +2461,7 @@ function re(n, e, t, s, i, o = !0) {
|
|
|
2447
2461
|
return s;
|
|
2448
2462
|
}
|
|
2449
2463
|
function Ts(n, e, t) {
|
|
2450
|
-
const s =
|
|
2464
|
+
const s = bo(n), i = ko(s, e, t), o = s.rangesByVisibilityKey.get(i);
|
|
2451
2465
|
if (o)
|
|
2452
2466
|
return s.rangesByVisibilityKey.delete(i), s.rangesByVisibilityKey.set(i, o), o;
|
|
2453
2467
|
const r = [];
|
|
@@ -2455,14 +2469,14 @@ function Ts(n, e, t) {
|
|
|
2455
2469
|
if (!e.has(c.block))
|
|
2456
2470
|
r.push(...c.hiddenRanges);
|
|
2457
2471
|
else if (c.block.kind === "list")
|
|
2458
|
-
for (const a of
|
|
2472
|
+
for (const a of Eo(
|
|
2459
2473
|
c.block,
|
|
2460
2474
|
lt(c.block, t - c.start)
|
|
2461
2475
|
))
|
|
2462
2476
|
r.push(a.delta(c.start));
|
|
2463
|
-
return s.rangesByVisibilityKey.set(i, r), s.rangesByVisibilityKey.size >
|
|
2477
|
+
return s.rangesByVisibilityKey.set(i, r), s.rangesByVisibilityKey.size > wo && s.rangesByVisibilityKey.delete(s.rangesByVisibilityKey.keys().next().value), r;
|
|
2464
2478
|
}
|
|
2465
|
-
function
|
|
2479
|
+
function bo(n) {
|
|
2466
2480
|
let e = ln.get(n);
|
|
2467
2481
|
if (e)
|
|
2468
2482
|
return e;
|
|
@@ -2474,7 +2488,7 @@ function wo(n) {
|
|
|
2474
2488
|
block: c,
|
|
2475
2489
|
index: s.length,
|
|
2476
2490
|
start: o,
|
|
2477
|
-
hiddenRanges:
|
|
2491
|
+
hiddenRanges: Co(c).map((l) => l.delta(o))
|
|
2478
2492
|
};
|
|
2479
2493
|
s.push(a), i.set(c, a);
|
|
2480
2494
|
}
|
|
@@ -2482,7 +2496,7 @@ function wo(n) {
|
|
|
2482
2496
|
}
|
|
2483
2497
|
return e = { entries: s, entryByBlock: i, rangesByVisibilityKey: /* @__PURE__ */ new Map() }, ln.set(n, e), e;
|
|
2484
2498
|
}
|
|
2485
|
-
function
|
|
2499
|
+
function ko(n, e, t) {
|
|
2486
2500
|
const s = [];
|
|
2487
2501
|
for (const i of e) {
|
|
2488
2502
|
const o = n.entryByBlock.get(i);
|
|
@@ -2493,7 +2507,7 @@ function bo(n, e, t) {
|
|
|
2493
2507
|
}
|
|
2494
2508
|
return s.sort(), s.join(",");
|
|
2495
2509
|
}
|
|
2496
|
-
function
|
|
2510
|
+
function yo(n, e) {
|
|
2497
2511
|
let t = 0, s = n.length;
|
|
2498
2512
|
for (; t < s; ) {
|
|
2499
2513
|
const i = t + s >>> 1;
|
|
@@ -2501,7 +2515,7 @@ function ko(n, e) {
|
|
|
2501
2515
|
}
|
|
2502
2516
|
return t;
|
|
2503
2517
|
}
|
|
2504
|
-
function
|
|
2518
|
+
function xo(n, e) {
|
|
2505
2519
|
let t = 0, s = n.length;
|
|
2506
2520
|
for (; t < s; ) {
|
|
2507
2521
|
const i = t + s >>> 1;
|
|
@@ -2522,7 +2536,7 @@ function lt(n, e) {
|
|
|
2522
2536
|
}
|
|
2523
2537
|
return s;
|
|
2524
2538
|
}
|
|
2525
|
-
function
|
|
2539
|
+
function Eo(n, e) {
|
|
2526
2540
|
const t = [];
|
|
2527
2541
|
let s = 0;
|
|
2528
2542
|
for (const i of n.children) {
|
|
@@ -2535,7 +2549,7 @@ function xo(n, e) {
|
|
|
2535
2549
|
}
|
|
2536
2550
|
return t.sort((i, o) => i.start - o.start), t;
|
|
2537
2551
|
}
|
|
2538
|
-
function
|
|
2552
|
+
function Co(n) {
|
|
2539
2553
|
const e = [];
|
|
2540
2554
|
return Yt(n, 0, e), e.sort((t, s) => t.start - s.start), e;
|
|
2541
2555
|
}
|
|
@@ -2573,29 +2587,29 @@ function Yt(n, e, t) {
|
|
|
2573
2587
|
for (const i of n.children)
|
|
2574
2588
|
Yt(i, s, t), s += i.length;
|
|
2575
2589
|
}
|
|
2576
|
-
const
|
|
2590
|
+
const So = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "after", "right") : n.selection.isCollapsed ? N.source(Me(
|
|
2577
2591
|
n.document,
|
|
2578
2592
|
n.markerVisibleBlocks,
|
|
2579
2593
|
n.selection.active,
|
|
2580
2594
|
"right"
|
|
2581
|
-
)) : N.source(n.selection.range.endExclusive),
|
|
2595
|
+
)) : N.source(n.selection.range.endExclusive), Lo = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "before", "left") : n.selection.isCollapsed ? N.source(Me(
|
|
2582
2596
|
n.document,
|
|
2583
2597
|
n.markerVisibleBlocks,
|
|
2584
2598
|
n.selection.active,
|
|
2585
2599
|
"left"
|
|
2586
|
-
)) : N.source(n.selection.range.start),
|
|
2600
|
+
)) : N.source(n.selection.range.start), Mo = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "after", "right") : N.source(Me(
|
|
2587
2601
|
n.document,
|
|
2588
2602
|
n.markerVisibleBlocks,
|
|
2589
2603
|
n.selection.active,
|
|
2590
2604
|
"right"
|
|
2591
|
-
)),
|
|
2605
|
+
)), To = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.line, "before", "left") : N.source(Me(
|
|
2592
2606
|
n.document,
|
|
2593
2607
|
n.markerVisibleBlocks,
|
|
2594
2608
|
n.selection.active,
|
|
2595
2609
|
"left"
|
|
2596
|
-
)),
|
|
2610
|
+
)), Oo = (n) => {
|
|
2597
2611
|
const e = n.cursorPosition.kind === "virtual" ? n.cursorPosition.line.sourceOffsetAfter : n.selection.active;
|
|
2598
|
-
return N.source(
|
|
2612
|
+
return N.source(ce(
|
|
2599
2613
|
n.document,
|
|
2600
2614
|
n.markerVisibleBlocks,
|
|
2601
2615
|
n.selection.active,
|
|
@@ -2603,9 +2617,9 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2603
2617
|
"right",
|
|
2604
2618
|
!1
|
|
2605
2619
|
));
|
|
2606
|
-
},
|
|
2620
|
+
}, Ro = (n) => {
|
|
2607
2621
|
const e = n.cursorPosition.kind === "virtual" ? n.cursorPosition.line.sourceOffsetBefore : n.selection.active;
|
|
2608
|
-
return N.source(
|
|
2622
|
+
return N.source(ce(
|
|
2609
2623
|
n.document,
|
|
2610
2624
|
n.markerVisibleBlocks,
|
|
2611
2625
|
n.selection.active,
|
|
@@ -2613,7 +2627,7 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2613
2627
|
"left",
|
|
2614
2628
|
!1
|
|
2615
2629
|
));
|
|
2616
|
-
}, Nt = (n) => n.cursorPosition.kind === "virtual" ? n.cursorPosition : N.source(
|
|
2630
|
+
}, Nt = (n) => n.cursorPosition.kind === "virtual" ? n.cursorPosition : N.source(ce(
|
|
2617
2631
|
n.document,
|
|
2618
2632
|
n.markerVisibleBlocks,
|
|
2619
2633
|
n.selection.active,
|
|
@@ -2625,26 +2639,26 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2625
2639
|
return n.cursorPosition;
|
|
2626
2640
|
const e = n.text.indexOf(`
|
|
2627
2641
|
`, n.selection.active);
|
|
2628
|
-
return N.source(
|
|
2642
|
+
return N.source(ce(
|
|
2629
2643
|
n.document,
|
|
2630
2644
|
n.markerVisibleBlocks,
|
|
2631
2645
|
n.selection.active,
|
|
2632
2646
|
e === -1 ? n.text.length : e,
|
|
2633
2647
|
"left"
|
|
2634
2648
|
));
|
|
2635
|
-
},
|
|
2649
|
+
}, No = (n) => N.source(ce(
|
|
2636
2650
|
n.document,
|
|
2637
2651
|
n.markerVisibleBlocks,
|
|
2638
2652
|
n.selection.active,
|
|
2639
2653
|
0,
|
|
2640
2654
|
"right"
|
|
2641
|
-
)),
|
|
2655
|
+
)), Io = (n) => N.source(ce(
|
|
2642
2656
|
n.document,
|
|
2643
2657
|
n.markerVisibleBlocks,
|
|
2644
2658
|
n.selection.active,
|
|
2645
2659
|
n.text.length,
|
|
2646
2660
|
"left"
|
|
2647
|
-
)),
|
|
2661
|
+
)), Bo = (n) => {
|
|
2648
2662
|
if (n.cursorPosition.kind === "virtual")
|
|
2649
2663
|
return { position: n.cursorPosition, desiredColumn: void 0 };
|
|
2650
2664
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
@@ -2663,7 +2677,7 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2663
2677
|
}
|
|
2664
2678
|
const r = o !== t && n.selection.active !== o ? o : t;
|
|
2665
2679
|
return {
|
|
2666
|
-
position: N.source(
|
|
2680
|
+
position: N.source(ce(
|
|
2667
2681
|
n.document,
|
|
2668
2682
|
n.markerVisibleBlocks,
|
|
2669
2683
|
n.selection.active,
|
|
@@ -2672,7 +2686,7 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2672
2686
|
)),
|
|
2673
2687
|
desiredColumn: void 0
|
|
2674
2688
|
};
|
|
2675
|
-
},
|
|
2689
|
+
}, Po = (n) => {
|
|
2676
2690
|
if (n.cursorPosition.kind === "virtual")
|
|
2677
2691
|
return { position: n.cursorPosition, desiredColumn: void 0 };
|
|
2678
2692
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
@@ -2680,7 +2694,7 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2680
2694
|
return { position: It(n), desiredColumn: void 0 };
|
|
2681
2695
|
const t = n.lineMap.lineEndOffset(e);
|
|
2682
2696
|
return t === void 0 ? { position: It(n), desiredColumn: void 0 } : {
|
|
2683
|
-
position: N.source(
|
|
2697
|
+
position: N.source(ce(
|
|
2684
2698
|
n.document,
|
|
2685
2699
|
n.markerVisibleBlocks,
|
|
2686
2700
|
n.selection.active,
|
|
@@ -2689,16 +2703,16 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2689
2703
|
)),
|
|
2690
2704
|
desiredColumn: void 0
|
|
2691
2705
|
};
|
|
2692
|
-
},
|
|
2706
|
+
}, Ao = (n) => {
|
|
2693
2707
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
2694
2708
|
if (e === void 0)
|
|
2695
|
-
return
|
|
2709
|
+
return Fo(n);
|
|
2696
2710
|
const t = n.desiredColumn ?? n.lineMap.xAtPosition(n.cursorPosition);
|
|
2697
2711
|
return e >= n.lineMap.lineCount - 1 ? { position: n.cursorPosition, desiredColumn: t } : { position: n.lineMap.positionInLineAtX(e + 1, t), desiredColumn: t };
|
|
2698
2712
|
}, dn = (n) => {
|
|
2699
2713
|
const e = n.lineMap.lineIndexOfPosition(n.cursorPosition);
|
|
2700
2714
|
if (e === void 0)
|
|
2701
|
-
return
|
|
2715
|
+
return Do(n);
|
|
2702
2716
|
if (n.cursorPosition.kind === "virtual" && e > 0)
|
|
2703
2717
|
return Os(n, e - 1);
|
|
2704
2718
|
const t = n.desiredColumn ?? n.lineMap.xAtPosition(n.cursorPosition);
|
|
@@ -2706,7 +2720,7 @@ const Co = (n) => n.cursorPosition.kind === "virtual" ? dt(n, n.cursorPosition.l
|
|
|
2706
2720
|
};
|
|
2707
2721
|
function dt(n, e, t, s) {
|
|
2708
2722
|
const i = t === "before" ? e.sourceOffsetBefore : e.sourceOffsetAfter;
|
|
2709
|
-
return N.source(
|
|
2723
|
+
return N.source(ce(
|
|
2710
2724
|
n.document,
|
|
2711
2725
|
n.markerVisibleBlocks,
|
|
2712
2726
|
n.selection.active,
|
|
@@ -2714,13 +2728,13 @@ function dt(n, e, t, s) {
|
|
|
2714
2728
|
s
|
|
2715
2729
|
));
|
|
2716
2730
|
}
|
|
2717
|
-
function
|
|
2731
|
+
function Do(n) {
|
|
2718
2732
|
if (n.cursorPosition.kind !== "virtual" || n.lineMap.isEmpty)
|
|
2719
2733
|
return { position: n.cursorPosition, desiredColumn: n.desiredColumn };
|
|
2720
2734
|
const e = n.lineMap.lineIndexOfOffset(n.cursorPosition.line.sourceOffsetBefore);
|
|
2721
2735
|
return Os(n, e);
|
|
2722
2736
|
}
|
|
2723
|
-
function
|
|
2737
|
+
function Fo(n) {
|
|
2724
2738
|
if (n.cursorPosition.kind !== "virtual" || n.lineMap.isEmpty)
|
|
2725
2739
|
return { position: n.cursorPosition, desiredColumn: n.desiredColumn };
|
|
2726
2740
|
const e = n.lineMap.lineIndexOfOffset(n.cursorPosition.line.sourceOffsetBefore), t = n.desiredColumn ?? n.lineMap.lineRect(e).left;
|
|
@@ -2753,7 +2767,7 @@ const Fe = {
|
|
|
2753
2767
|
edit: M.delete(t),
|
|
2754
2768
|
selection: k.collapsed(t.start)
|
|
2755
2769
|
};
|
|
2756
|
-
},
|
|
2770
|
+
}, Vo = (n) => {
|
|
2757
2771
|
const e = n.selection;
|
|
2758
2772
|
if (!e.isCollapsed)
|
|
2759
2773
|
return {
|
|
@@ -2767,7 +2781,7 @@ const Fe = {
|
|
|
2767
2781
|
edit: M.delete(t),
|
|
2768
2782
|
selection: k.collapsed(t.start)
|
|
2769
2783
|
};
|
|
2770
|
-
},
|
|
2784
|
+
}, $o = (n) => {
|
|
2771
2785
|
const e = n.selection;
|
|
2772
2786
|
if (!e.isCollapsed)
|
|
2773
2787
|
return {
|
|
@@ -2782,7 +2796,7 @@ const Fe = {
|
|
|
2782
2796
|
edit: i,
|
|
2783
2797
|
selection: k.collapsed(i.mapOffset(t))
|
|
2784
2798
|
};
|
|
2785
|
-
},
|
|
2799
|
+
}, Ho = (n) => {
|
|
2786
2800
|
const e = n.selection;
|
|
2787
2801
|
if (!e.isCollapsed)
|
|
2788
2802
|
return {
|
|
@@ -2797,7 +2811,7 @@ const Fe = {
|
|
|
2797
2811
|
edit: i,
|
|
2798
2812
|
selection: k.collapsed(i.mapOffset(e.active))
|
|
2799
2813
|
};
|
|
2800
|
-
},
|
|
2814
|
+
}, Wo = (n) => {
|
|
2801
2815
|
const e = n.selection;
|
|
2802
2816
|
if (!e.isCollapsed)
|
|
2803
2817
|
return {
|
|
@@ -2816,7 +2830,7 @@ const Fe = {
|
|
|
2816
2830
|
edit: s,
|
|
2817
2831
|
selection: k.collapsed(s.mapOffset(t))
|
|
2818
2832
|
};
|
|
2819
|
-
},
|
|
2833
|
+
}, Ko = (n) => {
|
|
2820
2834
|
const e = n.selection;
|
|
2821
2835
|
if (!e.isCollapsed)
|
|
2822
2836
|
return {
|
|
@@ -2845,11 +2859,11 @@ function ht(n, e) {
|
|
|
2845
2859
|
if (!(i.endExclusive <= s)) {
|
|
2846
2860
|
if (i.start >= e.endExclusive)
|
|
2847
2861
|
break;
|
|
2848
|
-
s < i.start && t.push(
|
|
2862
|
+
s < i.start && t.push(de.delete(new w(s, Math.min(i.start, e.endExclusive)))), s = Math.max(s, i.endExclusive);
|
|
2849
2863
|
}
|
|
2850
|
-
return s < e.endExclusive && t.push(
|
|
2864
|
+
return s < e.endExclusive && t.push(de.delete(new w(s, e.endExclusive))), t.length === 0 ? M.empty : new M(t);
|
|
2851
2865
|
}
|
|
2852
|
-
function
|
|
2866
|
+
function zo(n) {
|
|
2853
2867
|
return (e) => {
|
|
2854
2868
|
const t = M.replace(e.selection.range, n), s = e.selection.range.start + n.length;
|
|
2855
2869
|
return {
|
|
@@ -2858,9 +2872,9 @@ function Ko(n) {
|
|
|
2858
2872
|
};
|
|
2859
2873
|
};
|
|
2860
2874
|
}
|
|
2861
|
-
function
|
|
2875
|
+
function qo(n = Fe) {
|
|
2862
2876
|
return ut(n), (e) => {
|
|
2863
|
-
const t = e.selection, s = t.range, i = K(e.text, s.start), o = un(e.text, s.start), c = s.endExclusive <= o && (s.start !== i || s.endExclusive !== o), a = t.isCollapsed ? Ds(e.document, e.text, t.active) : void 0, l = a ?
|
|
2877
|
+
const t = e.selection, s = t.range, i = K(e.text, s.start), o = un(e.text, s.start), c = s.endExclusive <= o && (s.start !== i || s.endExclusive !== o), a = t.isCollapsed ? Ds(e.document, e.text, t.active) : void 0, l = a ? ie(e.document, a.item) : void 0, d = a ? ie(e.document, a.item.marker) : void 0;
|
|
2864
2878
|
if (a && l !== void 0 && d !== void 0 && K(e.text, d) === i) {
|
|
2865
2879
|
const m = Fs(
|
|
2866
2880
|
e.text,
|
|
@@ -2870,7 +2884,7 @@ function zo(n = Fe) {
|
|
|
2870
2884
|
), g = m[0];
|
|
2871
2885
|
if (a.index === 0 && d - g >= Oe.length)
|
|
2872
2886
|
return;
|
|
2873
|
-
const _ = m.filter((v) => v < un(e.text, v)).map((v) =>
|
|
2887
|
+
const _ = m.filter((v) => v < un(e.text, v)).map((v) => de.insert(v, Oe)), p = new M(_);
|
|
2874
2888
|
return {
|
|
2875
2889
|
edit: p,
|
|
2876
2890
|
selection: k.collapsed(p.mapOffset(t.active))
|
|
@@ -2886,24 +2900,24 @@ function zo(n = Fe) {
|
|
|
2886
2900
|
selection: k.collapsed(s.start + m.length)
|
|
2887
2901
|
};
|
|
2888
2902
|
}
|
|
2889
|
-
const u = Is(e.text, s), h = u.map((m) =>
|
|
2903
|
+
const u = Is(e.text, s), h = u.map((m) => de.insert(m, or(n))), f = new M(h);
|
|
2890
2904
|
return {
|
|
2891
2905
|
edit: f,
|
|
2892
|
-
selection:
|
|
2906
|
+
selection: dr(f, t, new Set(u))
|
|
2893
2907
|
};
|
|
2894
2908
|
};
|
|
2895
2909
|
}
|
|
2896
|
-
function
|
|
2910
|
+
function Go(n = Fe) {
|
|
2897
2911
|
return ut(n), (e) => {
|
|
2898
2912
|
if (e.selection.isCollapsed) {
|
|
2899
|
-
const i = Ds(e.document, e.text, e.selection.active), o = i ?
|
|
2913
|
+
const i = Ds(e.document, e.text, e.selection.active), o = i ? ie(e.document, i.item) : void 0, r = i ? ie(e.document, i.item.marker) : void 0;
|
|
2900
2914
|
if (i && o !== void 0 && r !== void 0 && K(e.text, r) === K(e.text, e.selection.active)) {
|
|
2901
2915
|
const c = Fs(
|
|
2902
2916
|
e.text,
|
|
2903
2917
|
o,
|
|
2904
2918
|
o + i.item.length,
|
|
2905
2919
|
Vs(e.text, K(e.text, r), r)
|
|
2906
|
-
).flatMap((l) => e.text.slice(l, l + Oe.length) === Oe ? [
|
|
2920
|
+
).flatMap((l) => e.text.slice(l, l + Oe.length) === Oe ? [de.delete(new w(l, l + Oe.length))] : []);
|
|
2907
2921
|
if (c.length === 0)
|
|
2908
2922
|
return;
|
|
2909
2923
|
const a = new M(c);
|
|
@@ -2915,8 +2929,8 @@ function qo(n = Fe) {
|
|
|
2915
2929
|
}
|
|
2916
2930
|
const t = [];
|
|
2917
2931
|
for (const i of Is(e.text, e.selection.range)) {
|
|
2918
|
-
const o =
|
|
2919
|
-
c !== r && t.push(
|
|
2932
|
+
const o = cr(e.text, i), r = e.text.slice(i, o), c = Ps(r, n);
|
|
2933
|
+
c !== r && t.push(de.replace(
|
|
2920
2934
|
new w(i, o),
|
|
2921
2935
|
c
|
|
2922
2936
|
));
|
|
@@ -2926,11 +2940,11 @@ function qo(n = Fe) {
|
|
|
2926
2940
|
const s = new M(t);
|
|
2927
2941
|
return {
|
|
2928
2942
|
edit: s,
|
|
2929
|
-
selection:
|
|
2943
|
+
selection: lr(s, e.selection)
|
|
2930
2944
|
};
|
|
2931
2945
|
};
|
|
2932
2946
|
}
|
|
2933
|
-
const
|
|
2947
|
+
const Xo = (n) => {
|
|
2934
2948
|
const e = M.replace(n.selection.range, `
|
|
2935
2949
|
|
|
2936
2950
|
`), t = n.selection.range.start + 2;
|
|
@@ -2938,14 +2952,14 @@ const Go = (n) => {
|
|
|
2938
2952
|
edit: e,
|
|
2939
2953
|
selection: k.collapsed(t)
|
|
2940
2954
|
};
|
|
2941
|
-
},
|
|
2955
|
+
}, Uo = (n) => {
|
|
2942
2956
|
const e = M.replace(n.selection.range, `
|
|
2943
2957
|
`), t = n.selection.range.start + 1;
|
|
2944
2958
|
return {
|
|
2945
2959
|
edit: e,
|
|
2946
2960
|
selection: k.collapsed(t)
|
|
2947
2961
|
};
|
|
2948
|
-
},
|
|
2962
|
+
}, Yo = (n) => {
|
|
2949
2963
|
const e = n.selection.range.start;
|
|
2950
2964
|
let t = 0;
|
|
2951
2965
|
for (; t < 2 && n.text[e - 1 - t] === " "; )
|
|
@@ -2972,7 +2986,7 @@ function Ve(n) {
|
|
|
2972
2986
|
case "codeBlock":
|
|
2973
2987
|
return e.closeFence && n.selection.active >= tt(e, t) ? bt(n, e, t) : void 0;
|
|
2974
2988
|
case "blockQuote":
|
|
2975
|
-
return
|
|
2989
|
+
return tr(n);
|
|
2976
2990
|
case "unhandledBlock": {
|
|
2977
2991
|
const s = e.htmlComment;
|
|
2978
2992
|
if (s?.kind !== "complete")
|
|
@@ -2984,32 +2998,32 @@ function Ve(n) {
|
|
|
2984
2998
|
return;
|
|
2985
2999
|
}
|
|
2986
3000
|
}
|
|
2987
|
-
const
|
|
3001
|
+
const jo = (n) => {
|
|
2988
3002
|
const e = n.selection, t = n.activeBlock;
|
|
2989
3003
|
if (!e.isCollapsed || !t)
|
|
2990
|
-
return
|
|
3004
|
+
return le(n);
|
|
2991
3005
|
switch (t.kind) {
|
|
2992
3006
|
case "paragraph":
|
|
2993
3007
|
case "heading":
|
|
2994
3008
|
case "thematicBreak":
|
|
2995
|
-
return
|
|
3009
|
+
return Qo(n, t);
|
|
2996
3010
|
case "frontMatter":
|
|
2997
3011
|
case "codeBlock":
|
|
2998
|
-
return
|
|
3012
|
+
return Zo(n);
|
|
2999
3013
|
case "blockQuote":
|
|
3000
|
-
return
|
|
3014
|
+
return er(n);
|
|
3001
3015
|
case "list":
|
|
3002
|
-
return
|
|
3016
|
+
return nr(n, t);
|
|
3003
3017
|
case "unhandledBlock":
|
|
3004
|
-
return
|
|
3018
|
+
return Jo(n, t);
|
|
3005
3019
|
default:
|
|
3006
|
-
return
|
|
3020
|
+
return le(n);
|
|
3007
3021
|
}
|
|
3008
3022
|
};
|
|
3009
|
-
function
|
|
3023
|
+
function Qo(n, e) {
|
|
3010
3024
|
const t = n.selection, s = ft(n.document, e);
|
|
3011
3025
|
if (s === void 0)
|
|
3012
|
-
return
|
|
3026
|
+
return le(n);
|
|
3013
3027
|
const i = tt(e, s);
|
|
3014
3028
|
return t.active < i ? {
|
|
3015
3029
|
kind: "edit",
|
|
@@ -3017,9 +3031,9 @@ function jo(n, e) {
|
|
|
3017
3031
|
|
|
3018
3032
|
`),
|
|
3019
3033
|
selection: k.collapsed(t.range.start + 2)
|
|
3020
|
-
} : Ve(n) ??
|
|
3034
|
+
} : Ve(n) ?? le(n);
|
|
3021
3035
|
}
|
|
3022
|
-
function
|
|
3036
|
+
function Zo(n, e) {
|
|
3023
3037
|
const t = n.selection, s = Ve(n);
|
|
3024
3038
|
if (s)
|
|
3025
3039
|
return s;
|
|
@@ -3042,13 +3056,13 @@ function bt(n, e, t) {
|
|
|
3042
3056
|
atEof: i >= n.text.length
|
|
3043
3057
|
};
|
|
3044
3058
|
}
|
|
3045
|
-
function
|
|
3046
|
-
return e.htmlComment?.kind !== "complete" ?
|
|
3059
|
+
function Jo(n, e) {
|
|
3060
|
+
return e.htmlComment?.kind !== "complete" ? le(n) : Ve(n) ?? le(n);
|
|
3047
3061
|
}
|
|
3048
3062
|
function tt(n, e) {
|
|
3049
|
-
return e + n.length -
|
|
3063
|
+
return e + n.length - hr(n);
|
|
3050
3064
|
}
|
|
3051
|
-
function
|
|
3065
|
+
function er(n) {
|
|
3052
3066
|
const e = n.selection, t = Rs(n.text, e.active), s = t.prefix ?? "> ";
|
|
3053
3067
|
if (t.content.slice(s.length).trim() === "")
|
|
3054
3068
|
return Ve(n) ?? Ns(n, t.start, t.endExclusive);
|
|
@@ -3056,7 +3070,7 @@ function Jo(n) {
|
|
|
3056
3070
|
` + s.replace(/\s*$/, " ");
|
|
3057
3071
|
return jt(e, o);
|
|
3058
3072
|
}
|
|
3059
|
-
function
|
|
3073
|
+
function tr(n) {
|
|
3060
3074
|
const e = n.activeBlock;
|
|
3061
3075
|
if (!n.selection.isCollapsed || e?.kind !== "blockQuote")
|
|
3062
3076
|
return;
|
|
@@ -3081,7 +3095,7 @@ function er(n) {
|
|
|
3081
3095
|
}
|
|
3082
3096
|
function Rs(n, e) {
|
|
3083
3097
|
const t = n.lastIndexOf(`
|
|
3084
|
-
`, e - 1) + 1, s =
|
|
3098
|
+
`, e - 1) + 1, s = ir(n, e), i = n.slice(t, s);
|
|
3085
3099
|
return {
|
|
3086
3100
|
start: t,
|
|
3087
3101
|
endExclusive: s,
|
|
@@ -3089,20 +3103,20 @@ function Rs(n, e) {
|
|
|
3089
3103
|
prefix: /^(\s*(?:>\s*)+)/.exec(i)?.[1]
|
|
3090
3104
|
};
|
|
3091
3105
|
}
|
|
3092
|
-
function
|
|
3106
|
+
function nr(n, e) {
|
|
3093
3107
|
const t = n.selection, s = ft(n.document, e);
|
|
3094
3108
|
if (s === void 0)
|
|
3095
|
-
return
|
|
3109
|
+
return le(n);
|
|
3096
3110
|
const i = lt(e, t.active - s);
|
|
3097
3111
|
if (i === void 0)
|
|
3098
|
-
return
|
|
3099
|
-
const o = e.items[i], r =
|
|
3112
|
+
return le(n);
|
|
3113
|
+
const o = e.items[i], r = ie(n.document, o);
|
|
3100
3114
|
if (r === void 0)
|
|
3101
|
-
return
|
|
3115
|
+
return le(n);
|
|
3102
3116
|
if (!$s(o))
|
|
3103
3117
|
return Ns(n, r, r + o.length);
|
|
3104
3118
|
const c = `
|
|
3105
|
-
` +
|
|
3119
|
+
` + sr(e, o);
|
|
3106
3120
|
return jt(t, c);
|
|
3107
3121
|
}
|
|
3108
3122
|
function Ns(n, e, t) {
|
|
@@ -3120,7 +3134,7 @@ function Ns(n, e, t) {
|
|
|
3120
3134
|
selection: k.collapsed(e)
|
|
3121
3135
|
};
|
|
3122
3136
|
}
|
|
3123
|
-
function
|
|
3137
|
+
function sr(n, e) {
|
|
3124
3138
|
const t = e.marker.content.trim(), s = t.charAt(0) || "-";
|
|
3125
3139
|
if (e.checked !== void 0)
|
|
3126
3140
|
return `${s} [ ] `;
|
|
@@ -3138,7 +3152,7 @@ function jt(n, e) {
|
|
|
3138
3152
|
selection: k.collapsed(n.range.start + e.length)
|
|
3139
3153
|
};
|
|
3140
3154
|
}
|
|
3141
|
-
function
|
|
3155
|
+
function ir(n, e) {
|
|
3142
3156
|
const t = n.indexOf(`
|
|
3143
3157
|
`, e);
|
|
3144
3158
|
return t === -1 ? n.length : t;
|
|
@@ -3168,7 +3182,7 @@ function Bs(n, e = Fe) {
|
|
|
3168
3182
|
const t = As(n, e.tabSize);
|
|
3169
3183
|
return " ".repeat(e.tabSize - t % e.tabSize);
|
|
3170
3184
|
}
|
|
3171
|
-
function
|
|
3185
|
+
function or(n) {
|
|
3172
3186
|
return n.insertSpaces ? " ".repeat(n.tabSize) : " ";
|
|
3173
3187
|
}
|
|
3174
3188
|
function Ps(n, e = Fe) {
|
|
@@ -3177,9 +3191,9 @@ function Ps(n, e = Fe) {
|
|
|
3177
3191
|
if (t === 0)
|
|
3178
3192
|
return n;
|
|
3179
3193
|
const s = t - (t % e.tabSize || e.tabSize);
|
|
3180
|
-
return
|
|
3194
|
+
return rr(s, e);
|
|
3181
3195
|
}
|
|
3182
|
-
function
|
|
3196
|
+
function rr(n, e) {
|
|
3183
3197
|
return e.insertSpaces ? " ".repeat(n) : " ".repeat(Math.floor(n / e.tabSize)) + " ".repeat(n % e.tabSize);
|
|
3184
3198
|
}
|
|
3185
3199
|
function As(n, e) {
|
|
@@ -3188,7 +3202,7 @@ function As(n, e) {
|
|
|
3188
3202
|
t = s === " " ? t + e - t % e : t + 1;
|
|
3189
3203
|
return t;
|
|
3190
3204
|
}
|
|
3191
|
-
function
|
|
3205
|
+
function cr(n, e) {
|
|
3192
3206
|
let t = e;
|
|
3193
3207
|
for (; n[t] === " " || n[t] === " "; )
|
|
3194
3208
|
t++;
|
|
@@ -3207,7 +3221,7 @@ function Ds(n, e, t) {
|
|
|
3207
3221
|
return f ?? u;
|
|
3208
3222
|
}, i = s(n, 0, void 0, void 0);
|
|
3209
3223
|
if (i) {
|
|
3210
|
-
const c =
|
|
3224
|
+
const c = ie(n, i.item.marker);
|
|
3211
3225
|
if (c !== void 0 && K(e, c) === K(e, t))
|
|
3212
3226
|
return i;
|
|
3213
3227
|
}
|
|
@@ -3215,7 +3229,7 @@ function Ds(n, e, t) {
|
|
|
3215
3229
|
const r = (c) => {
|
|
3216
3230
|
if (c instanceof z)
|
|
3217
3231
|
for (let a = 0; a < c.items.length; a++) {
|
|
3218
|
-
const l = c.items[a], d =
|
|
3232
|
+
const l = c.items[a], d = ie(n, l.marker);
|
|
3219
3233
|
d !== void 0 && K(e, d) === K(e, t) && (o = { item: l, index: a });
|
|
3220
3234
|
}
|
|
3221
3235
|
for (const a of c.children)
|
|
@@ -3227,7 +3241,7 @@ function Fs(n, e, t, s) {
|
|
|
3227
3241
|
const i = [];
|
|
3228
3242
|
let o = K(n, e);
|
|
3229
3243
|
for (; o < t; ) {
|
|
3230
|
-
i.push(
|
|
3244
|
+
i.push(ar(n, o, s));
|
|
3231
3245
|
const r = n.indexOf(`
|
|
3232
3246
|
`, o);
|
|
3233
3247
|
if (r === -1)
|
|
@@ -3248,7 +3262,7 @@ function Vs(n, e, t) {
|
|
|
3248
3262
|
}
|
|
3249
3263
|
return i;
|
|
3250
3264
|
}
|
|
3251
|
-
function
|
|
3265
|
+
function ar(n, e, t) {
|
|
3252
3266
|
let s = e;
|
|
3253
3267
|
for (let i = 0; i < t; i++) {
|
|
3254
3268
|
let o = s;
|
|
@@ -3260,10 +3274,10 @@ function cr(n, e, t) {
|
|
|
3260
3274
|
}
|
|
3261
3275
|
return s;
|
|
3262
3276
|
}
|
|
3263
|
-
function
|
|
3277
|
+
function lr(n, e) {
|
|
3264
3278
|
return new k(n.mapOffset(e.anchor), n.mapOffset(e.active));
|
|
3265
3279
|
}
|
|
3266
|
-
function
|
|
3280
|
+
function dr(n, e, t) {
|
|
3267
3281
|
const s = (i) => {
|
|
3268
3282
|
if (!t.has(i))
|
|
3269
3283
|
return n.mapOffset(i);
|
|
@@ -3284,8 +3298,8 @@ function ut(n) {
|
|
|
3284
3298
|
function $s(n) {
|
|
3285
3299
|
return n instanceof Re ? n.content.trim().length > 0 : n instanceof me ? (n.code?.content.trim().length ?? 0) > 0 : n.children.some($s);
|
|
3286
3300
|
}
|
|
3287
|
-
function
|
|
3288
|
-
const e =
|
|
3301
|
+
function le(n) {
|
|
3302
|
+
const e = Uo(n);
|
|
3289
3303
|
return { kind: "edit", edit: e.edit, selection: e.selection };
|
|
3290
3304
|
}
|
|
3291
3305
|
function ft(n, e) {
|
|
@@ -3296,23 +3310,23 @@ function ft(n, e) {
|
|
|
3296
3310
|
t += s.length;
|
|
3297
3311
|
}
|
|
3298
3312
|
}
|
|
3299
|
-
function
|
|
3313
|
+
function hr(n) {
|
|
3300
3314
|
const e = n.children;
|
|
3301
3315
|
let t = 0;
|
|
3302
3316
|
for (let s = e.length - 1; s >= 0 && e[s] instanceof W; s--)
|
|
3303
3317
|
t += e[s].length;
|
|
3304
3318
|
return t;
|
|
3305
3319
|
}
|
|
3306
|
-
const
|
|
3320
|
+
const ur = (n) => new k(0, n.text.length), fr = (n, e) => {
|
|
3307
3321
|
const t = ws(n.text, e, n.wordNavigationConfig);
|
|
3308
3322
|
return new k(t.start, t.end);
|
|
3309
3323
|
};
|
|
3310
|
-
function
|
|
3324
|
+
function mr(n, e) {
|
|
3311
3325
|
return new k(e.start, e.endExclusive);
|
|
3312
3326
|
}
|
|
3313
3327
|
const fn = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap();
|
|
3314
|
-
class
|
|
3315
|
-
constructor(e, t, s =
|
|
3328
|
+
class oe extends H {
|
|
3329
|
+
constructor(e, t, s = gr) {
|
|
3316
3330
|
super(), this.ast = e, this.dom = t, this._children = s, fn.set(t, this);
|
|
3317
3331
|
for (const i of s)
|
|
3318
3332
|
kt.set(i, this);
|
|
@@ -3420,7 +3434,7 @@ class ie extends H {
|
|
|
3420
3434
|
* until it reaches this node.
|
|
3421
3435
|
*/
|
|
3422
3436
|
resolveSource(e) {
|
|
3423
|
-
let t =
|
|
3437
|
+
let t = oe.forDom(e.node);
|
|
3424
3438
|
if (!t)
|
|
3425
3439
|
return;
|
|
3426
3440
|
let s = t.getLocalSourceRange(e);
|
|
@@ -3464,25 +3478,25 @@ class ie extends H {
|
|
|
3464
3478
|
i.forEachTextLeaf(s, t), s += i.sourceLength;
|
|
3465
3479
|
}
|
|
3466
3480
|
}
|
|
3467
|
-
const
|
|
3468
|
-
function
|
|
3469
|
-
const e =
|
|
3481
|
+
const gr = [];
|
|
3482
|
+
function pr(n) {
|
|
3483
|
+
const e = _r(n), t = vr(n), s = Math.max(e, n.length - t);
|
|
3470
3484
|
return {
|
|
3471
3485
|
text: n.slice(e, s),
|
|
3472
3486
|
sourceOffset: e
|
|
3473
3487
|
};
|
|
3474
3488
|
}
|
|
3475
|
-
function
|
|
3489
|
+
function _r(n) {
|
|
3476
3490
|
return n.startsWith(`\r
|
|
3477
3491
|
`) ? 2 : n.startsWith("\r") || n.startsWith(`
|
|
3478
3492
|
`) ? 1 : 0;
|
|
3479
3493
|
}
|
|
3480
|
-
function
|
|
3494
|
+
function vr(n) {
|
|
3481
3495
|
return n.endsWith(`\r
|
|
3482
3496
|
`) ? 2 : n.endsWith("\r") || n.endsWith(`
|
|
3483
3497
|
`) ? 1 : 0;
|
|
3484
3498
|
}
|
|
3485
|
-
class R extends
|
|
3499
|
+
class R extends oe {
|
|
3486
3500
|
constructor(e, t, s) {
|
|
3487
3501
|
super(e.ast, t, s), this.data = e;
|
|
3488
3502
|
}
|
|
@@ -3532,7 +3546,7 @@ function Y(n, e, t) {
|
|
|
3532
3546
|
return t;
|
|
3533
3547
|
switch (n.kind) {
|
|
3534
3548
|
case "text":
|
|
3535
|
-
return
|
|
3549
|
+
return kr(n, I(t, Qt));
|
|
3536
3550
|
case "marker":
|
|
3537
3551
|
return n.ast.markerKind === "hardBreak" ? new _n(n, I(t, _n)) : new pn(n, I(t, pn));
|
|
3538
3552
|
case "glue":
|
|
@@ -3597,9 +3611,9 @@ function U(n, e, t, s) {
|
|
|
3597
3611
|
const { paired: i, unused: o } = Jt(e, t ?? F), r = e.map((c) => s(c, i.get(c)));
|
|
3598
3612
|
for (const c of o)
|
|
3599
3613
|
c.dispose();
|
|
3600
|
-
return
|
|
3614
|
+
return wr(n, r), r;
|
|
3601
3615
|
}
|
|
3602
|
-
function
|
|
3616
|
+
function wr(n, e) {
|
|
3603
3617
|
te(n, e.map((t) => t.mountNode));
|
|
3604
3618
|
}
|
|
3605
3619
|
function te(n, e) {
|
|
@@ -3668,10 +3682,10 @@ class Pt extends R {
|
|
|
3668
3682
|
}
|
|
3669
3683
|
}
|
|
3670
3684
|
function Ws(n) {
|
|
3671
|
-
return "content" in n ? n.content :
|
|
3685
|
+
return "content" in n ? n.content : br;
|
|
3672
3686
|
}
|
|
3673
|
-
const
|
|
3674
|
-
function
|
|
3687
|
+
const br = [];
|
|
3688
|
+
function kr(n, e) {
|
|
3675
3689
|
const t = n.ast.content, s = {
|
|
3676
3690
|
leftBoundary: n.leftWordBoundary,
|
|
3677
3691
|
rightBoundary: n.rightWordBoundary,
|
|
@@ -3690,8 +3704,8 @@ function gn(n) {
|
|
|
3690
3704
|
return n === " " || n === " " || n === `
|
|
3691
3705
|
` || n === "\r";
|
|
3692
3706
|
}
|
|
3693
|
-
const
|
|
3694
|
-
function
|
|
3707
|
+
const yr = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !1 }, xr = { leftBoundary: !1, rightBoundary: !1, decorateNewline: !1 };
|
|
3708
|
+
function Er(n, e, t) {
|
|
3695
3709
|
const s = e > 0 ? !gn(n[e - 1]) : t.leftBoundary, i = e < n.length - 1 ? !gn(n[e + 1]) : t.rightBoundary;
|
|
3696
3710
|
return s && i;
|
|
3697
3711
|
}
|
|
@@ -3702,7 +3716,7 @@ function Ks(n, e, t) {
|
|
|
3702
3716
|
if (s === `
|
|
3703
3717
|
` || s === "\r")
|
|
3704
3718
|
return t.decorateNewline ? "md-ws-newline" : void 0;
|
|
3705
|
-
if (s === " " && !
|
|
3719
|
+
if (s === " " && !Er(n, e, t))
|
|
3706
3720
|
return "md-ws-space";
|
|
3707
3721
|
}
|
|
3708
3722
|
function zs(n, e) {
|
|
@@ -3714,7 +3728,7 @@ function zs(n, e) {
|
|
|
3714
3728
|
}
|
|
3715
3729
|
return !1;
|
|
3716
3730
|
}
|
|
3717
|
-
function
|
|
3731
|
+
function Cr(n, e) {
|
|
3718
3732
|
const t = [];
|
|
3719
3733
|
let s = -1;
|
|
3720
3734
|
const i = (c) => {
|
|
@@ -3744,7 +3758,7 @@ function Er(n, e) {
|
|
|
3744
3758
|
}
|
|
3745
3759
|
function mt(n, e, t, s) {
|
|
3746
3760
|
const i = [];
|
|
3747
|
-
for (const o of
|
|
3761
|
+
for (const o of Cr(e, t)) {
|
|
3748
3762
|
const r = document.createTextNode(o.display ?? o.text);
|
|
3749
3763
|
if (o.cls) {
|
|
3750
3764
|
const c = document.createElement("span");
|
|
@@ -3760,7 +3774,7 @@ class Qt extends R {
|
|
|
3760
3774
|
super(e, t, F);
|
|
3761
3775
|
}
|
|
3762
3776
|
}
|
|
3763
|
-
class G extends
|
|
3777
|
+
class G extends oe {
|
|
3764
3778
|
_sourceLength;
|
|
3765
3779
|
constructor(e, t, s = F, i = e.length) {
|
|
3766
3780
|
super(e, t, s), this._sourceLength = i;
|
|
@@ -3829,14 +3843,14 @@ class _n extends R {
|
|
|
3829
3843
|
i.className = "md-hardbreak";
|
|
3830
3844
|
const o = document.createElement("span");
|
|
3831
3845
|
o.className = e.visible ? "md-hardbreak-src" : "md-hardbreak-src md-hardbreak-src-hidden";
|
|
3832
|
-
const r = e.visible ? mt(o, s,
|
|
3846
|
+
const r = e.visible ? mt(o, s, yr, e.ast) : Sr(o, s, e.ast);
|
|
3833
3847
|
i.appendChild(o), i.appendChild(document.createElement("br")), super(e, i, r), this._span = i;
|
|
3834
3848
|
}
|
|
3835
3849
|
get mountNode() {
|
|
3836
3850
|
return this._span;
|
|
3837
3851
|
}
|
|
3838
3852
|
}
|
|
3839
|
-
function
|
|
3853
|
+
function Sr(n, e, t) {
|
|
3840
3854
|
const s = document.createTextNode(e);
|
|
3841
3855
|
return n.appendChild(s), [new G(t, s)];
|
|
3842
3856
|
}
|
|
@@ -3854,7 +3868,7 @@ class vn extends R {
|
|
|
3854
3868
|
constructor(e, t, s) {
|
|
3855
3869
|
const i = s?.element ?? document.createElement("blockquote");
|
|
3856
3870
|
s || (i.className = "md-block md-blockquote");
|
|
3857
|
-
const o = U(i, e.content, s?._sourceChildren, he(t)), r =
|
|
3871
|
+
const o = U(i, e.content, s?._sourceChildren, he(t)), r = Lr(e.ast), c = e.showFinalMarkerOnlyLine ? r : r.slice(0, -1);
|
|
3858
3872
|
i.classList.toggle("md-blockquote-marker-only-line", c.length > 0);
|
|
3859
3873
|
const a = new Map(s?._anchors.map((h) => [h.ast.id, h])), l = c.map(({ marker: h }) => {
|
|
3860
3874
|
const f = a.get(h.id) ?? new qs(h, "md-blockquote-line-anchor");
|
|
@@ -3871,7 +3885,7 @@ class vn extends R {
|
|
|
3871
3885
|
te(i, u.map((h) => h.mountNode)), super(e, i, u), this._sourceChildren = o, this._anchors = l;
|
|
3872
3886
|
}
|
|
3873
3887
|
}
|
|
3874
|
-
function
|
|
3888
|
+
function Lr(n) {
|
|
3875
3889
|
const e = [];
|
|
3876
3890
|
for (let t = n.children.length - 1; t >= 0; t--) {
|
|
3877
3891
|
const s = n.children[t];
|
|
@@ -3946,7 +3960,7 @@ class yn extends R {
|
|
|
3946
3960
|
super(e, o, r);
|
|
3947
3961
|
}
|
|
3948
3962
|
}
|
|
3949
|
-
class xn extends
|
|
3963
|
+
class xn extends oe {
|
|
3950
3964
|
constructor(e, t, s) {
|
|
3951
3965
|
const i = s?.dom instanceof HTMLSpanElement ? s.dom : document.createElement("span");
|
|
3952
3966
|
i.className = "md-html-comment-content";
|
|
@@ -4029,7 +4043,7 @@ class Zt extends R {
|
|
|
4029
4043
|
return super.canReuse(e, t) && Object.is(t?.embeddedCodeEditorFactoryVersion, this._embeddedEditorFactoryVersion) && (!this._embeddedEditor || (t?.embeddedCodeEditorReadOnly ?? !1) === this._embeddedEditorReadOnly);
|
|
4030
4044
|
}
|
|
4031
4045
|
constructor(e, t, s) {
|
|
4032
|
-
const i = e.ast, o = i.code?.content ?? "", r = s instanceof Zt ? s : void 0, c = t?.embeddedCodeEditorReadOnly ?? !1, a =
|
|
4046
|
+
const i = e.ast, o = i.code?.content ?? "", r = s instanceof Zt ? s : void 0, c = t?.embeddedCodeEditorReadOnly ?? !1, a = pr(o);
|
|
4033
4047
|
let l;
|
|
4034
4048
|
!e.showMarkup && i.language && i.code && a.sourceOffset > 0 && t?.embeddedCodeEditorFactory && (r?._embeddedEditor && Object.is(t.embeddedCodeEditorFactoryVersion, r._embeddedEditorFactoryVersion) && (i === r.ast || i.getDiff(r.ast)) ? (l = r._embeddedEditor, r._embeddedEditor = void 0) : l = t.embeddedCodeEditorFactory.create(i.language, i.infoString, a.text) ?? void 0), r?._embeddedEditor && (r._embeddedEditor.dispose(), r._embeddedEditor = void 0);
|
|
4035
4049
|
const d = !l && !e.showMarkup && i.language && t?.renderCustomCodeBlock ? t.renderCustomCodeBlock(i.language, o) ?? void 0 : void 0, u = t?.syntaxHighlighter;
|
|
@@ -4051,7 +4065,7 @@ class Zt extends R {
|
|
|
4051
4065
|
const p = l.estimateHeight?.(a.text);
|
|
4052
4066
|
p !== void 0 && (l.element.style.boxSizing = "border-box", l.element.style.minHeight = `${p}px`), l.onEdit = (v) => {
|
|
4053
4067
|
const E = a.sourceOffset === 0 ? v : new M(
|
|
4054
|
-
v.replacements.map((b) =>
|
|
4068
|
+
v.replacements.map((b) => de.replace(b.replaceRange.delta(a.sourceOffset), b.newText))
|
|
4055
4069
|
);
|
|
4056
4070
|
t?.onEmbeddedCodeEditorEdit?.(i, E);
|
|
4057
4071
|
}, l.setReadOnly?.(t?.embeddedCodeEditorReadOnly ?? !1), l.setContent(a.text), m = l.element, g = F;
|
|
@@ -4089,7 +4103,7 @@ class Zt extends R {
|
|
|
4089
4103
|
if (b.visible) {
|
|
4090
4104
|
const V = document.createElement("span");
|
|
4091
4105
|
V.className = "md-marker md-marker-codeIndent";
|
|
4092
|
-
const ue = mt(V, T.content,
|
|
4106
|
+
const ue = mt(V, T.content, xr, T);
|
|
4093
4107
|
v.appendChild(V), E.push(new G(T, V, ue));
|
|
4094
4108
|
} else {
|
|
4095
4109
|
const V = Y(b, t, void 0);
|
|
@@ -4120,7 +4134,7 @@ function Gs(n, e, t, s, i, o, r) {
|
|
|
4120
4134
|
if (e && d.ast === e) {
|
|
4121
4135
|
const u = document.createElement("code");
|
|
4122
4136
|
o && (u.className = `language-${CSS.escape(o)}`);
|
|
4123
|
-
const h =
|
|
4137
|
+
const h = Mr(e, t, u, r);
|
|
4124
4138
|
h instanceof Xs && (l = h), a.push(h), c.appendChild(u);
|
|
4125
4139
|
} else {
|
|
4126
4140
|
const u = Y(d, s, void 0);
|
|
@@ -4128,14 +4142,14 @@ function Gs(n, e, t, s, i, o, r) {
|
|
|
4128
4142
|
}
|
|
4129
4143
|
return { dom: c, children: a, contentNode: l };
|
|
4130
4144
|
}
|
|
4131
|
-
function
|
|
4145
|
+
function Mr(n, e, t, s) {
|
|
4132
4146
|
if (!s) {
|
|
4133
4147
|
const i = document.createTextNode(e);
|
|
4134
4148
|
return t.appendChild(i), new G(n, i);
|
|
4135
4149
|
}
|
|
4136
4150
|
return new Xs(n, t, e, s);
|
|
4137
4151
|
}
|
|
4138
|
-
class Xs extends
|
|
4152
|
+
class Xs extends oe {
|
|
4139
4153
|
constructor(e, t, s, i) {
|
|
4140
4154
|
super(e, t, Sn(e, t, s, i));
|
|
4141
4155
|
}
|
|
@@ -4244,14 +4258,16 @@ class Tn extends R {
|
|
|
4244
4258
|
constructor(e, t, s) {
|
|
4245
4259
|
const i = e.ast, o = document.createElement("li");
|
|
4246
4260
|
e.isActive && o.classList.add("md-list-item-active"), i.checked !== void 0 && o.classList.add("md-task-list-item"), e.isActive || o.classList.add("md-markers-hidden"), o.style.setProperty("--md-list-level", String(e.level));
|
|
4247
|
-
const r =
|
|
4261
|
+
const r = Tr(o, e.content, s, t);
|
|
4248
4262
|
if (!e.isActive && i.checked !== void 0) {
|
|
4249
4263
|
const c = document.createElement("input");
|
|
4250
4264
|
c.type = "checkbox", c.checked = i.checked, c.className = "md-checkbox";
|
|
4251
4265
|
const a = t?.onToggleCheckbox;
|
|
4252
4266
|
if (a) {
|
|
4253
4267
|
const l = i.checked;
|
|
4254
|
-
c.addEventListener("
|
|
4268
|
+
c.addEventListener("pointerdown", (d) => {
|
|
4269
|
+
d.stopPropagation();
|
|
4270
|
+
}), c.addEventListener("click", (d) => {
|
|
4255
4271
|
d.stopPropagation(), d.preventDefault(), a(i, !l);
|
|
4256
4272
|
});
|
|
4257
4273
|
} else
|
|
@@ -4261,7 +4277,7 @@ class Tn extends R {
|
|
|
4261
4277
|
super(e, o, r);
|
|
4262
4278
|
}
|
|
4263
4279
|
}
|
|
4264
|
-
function
|
|
4280
|
+
function Tr(n, e, t, s) {
|
|
4265
4281
|
const { paired: i, unused: o } = Jt(e, t?.children ?? F), r = e.map((d) => Y(d, s, i.get(d)));
|
|
4266
4282
|
for (const d of o)
|
|
4267
4283
|
d.dispose();
|
|
@@ -4392,7 +4408,7 @@ function Jt(n, e) {
|
|
|
4392
4408
|
function js(n) {
|
|
4393
4409
|
return !n.trim().toLowerCase().startsWith("javascript:");
|
|
4394
4410
|
}
|
|
4395
|
-
class en extends
|
|
4411
|
+
class en extends oe {
|
|
4396
4412
|
constructor(e, t, s, i, o) {
|
|
4397
4413
|
super(e, t, i), this.blocks = s, this.pendingParagraph = o;
|
|
4398
4414
|
}
|
|
@@ -4401,7 +4417,7 @@ class en extends ie {
|
|
|
4401
4417
|
i.classList.add("md-document");
|
|
4402
4418
|
const o = new Map(
|
|
4403
4419
|
e.children.filter((f) => f.kind === "block").map((f) => [f.view, f.isActive])
|
|
4404
|
-
), r = s?.children, c = e.children.map((f) => f.view), { paired: a, unused: l } = Jt(c, r ??
|
|
4420
|
+
), r = s?.children, c = e.children.map((f) => f.view), { paired: a, unused: l } = Jt(c, r ?? Or);
|
|
4405
4421
|
let d;
|
|
4406
4422
|
const u = c.map((f, m) => {
|
|
4407
4423
|
const g = a.get(f);
|
|
@@ -4431,7 +4447,7 @@ class en extends ie {
|
|
|
4431
4447
|
return this.dom;
|
|
4432
4448
|
}
|
|
4433
4449
|
}
|
|
4434
|
-
class An extends
|
|
4450
|
+
class An extends oe {
|
|
4435
4451
|
element;
|
|
4436
4452
|
anchorBlock;
|
|
4437
4453
|
cursorLine;
|
|
@@ -4465,8 +4481,8 @@ class An extends ie {
|
|
|
4465
4481
|
return new DOMRect(i?.right ?? e.left, e.top, 0, e.height);
|
|
4466
4482
|
}
|
|
4467
4483
|
}
|
|
4468
|
-
const
|
|
4469
|
-
function
|
|
4484
|
+
const Or = [];
|
|
4485
|
+
function Rr(n) {
|
|
4470
4486
|
const e = document;
|
|
4471
4487
|
if (e.caretPositionFromPoint) {
|
|
4472
4488
|
const s = e.caretPositionFromPoint(n.x, n.y);
|
|
@@ -4495,10 +4511,10 @@ class gt {
|
|
|
4495
4511
|
const e = this._getLocalToClientMatrix();
|
|
4496
4512
|
if (e.is2D === !1 || Math.abs(e.b) > qe || Math.abs(e.c) > qe || e.a <= qe || e.d <= qe)
|
|
4497
4513
|
throw new Error("Markdown editor geometry supports positive axis-aligned scale and translation only");
|
|
4498
|
-
return new
|
|
4514
|
+
return new Nr(e);
|
|
4499
4515
|
}
|
|
4500
4516
|
}
|
|
4501
|
-
class
|
|
4517
|
+
class Nr {
|
|
4502
4518
|
constructor(e) {
|
|
4503
4519
|
this._localToClient = e, this._clientToLocal = e.inverse();
|
|
4504
4520
|
}
|
|
@@ -4528,121 +4544,121 @@ class Qs {
|
|
|
4528
4544
|
}
|
|
4529
4545
|
kind = "document";
|
|
4530
4546
|
}
|
|
4531
|
-
class
|
|
4547
|
+
class Ir {
|
|
4532
4548
|
constructor(e, t) {
|
|
4533
4549
|
this.ast = e, this.content = t;
|
|
4534
4550
|
}
|
|
4535
4551
|
kind = "heading";
|
|
4536
4552
|
}
|
|
4537
|
-
class
|
|
4553
|
+
class Br {
|
|
4538
4554
|
constructor(e, t) {
|
|
4539
4555
|
this.ast = e, this.content = t;
|
|
4540
4556
|
}
|
|
4541
4557
|
kind = "paragraph";
|
|
4542
4558
|
}
|
|
4543
|
-
class
|
|
4559
|
+
class Pr {
|
|
4544
4560
|
constructor(e, t, s, i) {
|
|
4545
4561
|
this.ast = e, this.anchorBlock = t, this.cursorLine = s, this.text = i;
|
|
4546
4562
|
}
|
|
4547
4563
|
kind = "pendingParagraph";
|
|
4548
4564
|
}
|
|
4549
|
-
class
|
|
4565
|
+
class Ar {
|
|
4550
4566
|
constructor(e, t, s) {
|
|
4551
4567
|
this.ast = e, this.showMarkup = t, this.content = s;
|
|
4552
4568
|
}
|
|
4553
4569
|
kind = "frontMatter";
|
|
4554
4570
|
}
|
|
4555
|
-
class
|
|
4571
|
+
class Dr {
|
|
4556
4572
|
constructor(e, t, s) {
|
|
4557
4573
|
this.ast = e, this.showMarkup = t, this.content = s;
|
|
4558
4574
|
}
|
|
4559
4575
|
kind = "codeBlock";
|
|
4560
4576
|
}
|
|
4561
|
-
class
|
|
4577
|
+
class Fr {
|
|
4562
4578
|
constructor(e, t, s) {
|
|
4563
4579
|
this.ast = e, this.showMarkup = t, this.content = s;
|
|
4564
4580
|
}
|
|
4565
4581
|
kind = "mathBlock";
|
|
4566
4582
|
}
|
|
4567
|
-
class
|
|
4583
|
+
class Vr {
|
|
4568
4584
|
constructor(e, t, s) {
|
|
4569
4585
|
this.ast = e, this.content = t, this.showFinalMarkerOnlyLine = s;
|
|
4570
4586
|
}
|
|
4571
4587
|
kind = "blockQuote";
|
|
4572
4588
|
}
|
|
4573
|
-
class
|
|
4589
|
+
class $r {
|
|
4574
4590
|
constructor(e, t) {
|
|
4575
4591
|
this.ast = e, this.content = t;
|
|
4576
4592
|
}
|
|
4577
4593
|
kind = "list";
|
|
4578
4594
|
}
|
|
4579
|
-
class
|
|
4595
|
+
class Hr {
|
|
4580
4596
|
constructor(e, t) {
|
|
4581
4597
|
this.ast = e, this.content = t;
|
|
4582
4598
|
}
|
|
4583
4599
|
kind = "table";
|
|
4584
4600
|
}
|
|
4585
|
-
class
|
|
4601
|
+
class Wr {
|
|
4586
4602
|
constructor(e, t) {
|
|
4587
4603
|
this.ast = e, this.content = t;
|
|
4588
4604
|
}
|
|
4589
4605
|
kind = "strong";
|
|
4590
4606
|
}
|
|
4591
|
-
class
|
|
4607
|
+
class Kr {
|
|
4592
4608
|
constructor(e, t) {
|
|
4593
4609
|
this.ast = e, this.content = t;
|
|
4594
4610
|
}
|
|
4595
4611
|
kind = "emphasis";
|
|
4596
4612
|
}
|
|
4597
|
-
class
|
|
4613
|
+
class zr {
|
|
4598
4614
|
constructor(e, t) {
|
|
4599
4615
|
this.ast = e, this.content = t;
|
|
4600
4616
|
}
|
|
4601
4617
|
kind = "strikethrough";
|
|
4602
4618
|
}
|
|
4603
|
-
class
|
|
4619
|
+
class qr {
|
|
4604
4620
|
constructor(e, t) {
|
|
4605
4621
|
this.ast = e, this.content = t;
|
|
4606
4622
|
}
|
|
4607
4623
|
kind = "inlineCode";
|
|
4608
4624
|
}
|
|
4609
|
-
class
|
|
4625
|
+
class Gr {
|
|
4610
4626
|
constructor(e, t, s) {
|
|
4611
4627
|
this.ast = e, this.showMarkup = t, this.content = s;
|
|
4612
4628
|
}
|
|
4613
4629
|
kind = "inlineMath";
|
|
4614
4630
|
}
|
|
4615
|
-
class
|
|
4631
|
+
class Xr {
|
|
4616
4632
|
constructor(e, t) {
|
|
4617
4633
|
this.ast = e, this.content = t;
|
|
4618
4634
|
}
|
|
4619
4635
|
kind = "link";
|
|
4620
4636
|
}
|
|
4621
|
-
class
|
|
4637
|
+
class Ur {
|
|
4622
4638
|
constructor(e, t, s) {
|
|
4623
4639
|
this.ast = e, this.showMarkup = t, this.content = s;
|
|
4624
4640
|
}
|
|
4625
4641
|
kind = "image";
|
|
4626
4642
|
}
|
|
4627
|
-
class
|
|
4643
|
+
class Yr {
|
|
4628
4644
|
constructor(e, t, s, i) {
|
|
4629
4645
|
this.ast = e, this.isActive = t, this.content = s, this.level = i;
|
|
4630
4646
|
}
|
|
4631
4647
|
kind = "listItem";
|
|
4632
4648
|
}
|
|
4633
|
-
class
|
|
4649
|
+
class jr {
|
|
4634
4650
|
constructor(e, t, s) {
|
|
4635
4651
|
this.ast = e, this.isDelimiter = t, this.content = s;
|
|
4636
4652
|
}
|
|
4637
4653
|
kind = "tableRow";
|
|
4638
4654
|
}
|
|
4639
|
-
class
|
|
4655
|
+
class Qr {
|
|
4640
4656
|
constructor(e, t, s, i) {
|
|
4641
4657
|
this.ast = e, this.isActive = t, this.showTableGlue = s, this.content = i;
|
|
4642
4658
|
}
|
|
4643
4659
|
kind = "tableCell";
|
|
4644
4660
|
}
|
|
4645
|
-
class
|
|
4661
|
+
class Zr {
|
|
4646
4662
|
/**
|
|
4647
4663
|
* Whether non-obvious whitespace in this text is revealed (block is active).
|
|
4648
4664
|
* `leftWordBoundary`/`rightWordBoundary` say whether the inline sibling on
|
|
@@ -4655,19 +4671,19 @@ class Qr {
|
|
|
4655
4671
|
}
|
|
4656
4672
|
kind = "text";
|
|
4657
4673
|
}
|
|
4658
|
-
class
|
|
4674
|
+
class Jr {
|
|
4659
4675
|
constructor(e, t, s) {
|
|
4660
4676
|
this.ast = e, this.showMarkup = t, this.content = s;
|
|
4661
4677
|
}
|
|
4662
4678
|
kind = "thematicBreak";
|
|
4663
4679
|
}
|
|
4664
|
-
class
|
|
4680
|
+
class ec {
|
|
4665
4681
|
constructor(e, t, s) {
|
|
4666
4682
|
this.ast = e, this.showMarkup = t, this.content = s;
|
|
4667
4683
|
}
|
|
4668
4684
|
kind = "unhandledBlock";
|
|
4669
4685
|
}
|
|
4670
|
-
class
|
|
4686
|
+
class tc {
|
|
4671
4687
|
constructor(e, t) {
|
|
4672
4688
|
this.ast = e, this.visible = t;
|
|
4673
4689
|
}
|
|
@@ -4679,7 +4695,7 @@ class Zs {
|
|
|
4679
4695
|
}
|
|
4680
4696
|
kind = "glue";
|
|
4681
4697
|
}
|
|
4682
|
-
class
|
|
4698
|
+
class nc {
|
|
4683
4699
|
constructor(e, t, s, i, o) {
|
|
4684
4700
|
this.ast = e, this.side = t, this.deletedRanges = s, this.whole = i, this.originalStart = o;
|
|
4685
4701
|
}
|
|
@@ -4723,7 +4739,7 @@ function ei(n, e, t, s, i) {
|
|
|
4723
4739
|
a.push({ ast: f, absoluteStart: d, isActive: m, view: p }), l.push({ absoluteStart: d, isActive: m, view: p, kind: "block" }), i && i.anchorBlock === f && l.push({
|
|
4724
4740
|
absoluteStart: d + f.length,
|
|
4725
4741
|
isActive: !0,
|
|
4726
|
-
view: new
|
|
4742
|
+
view: new Pr(i.ast, i.anchorBlock, i.cursorLine, i.text),
|
|
4727
4743
|
kind: "pendingParagraph"
|
|
4728
4744
|
});
|
|
4729
4745
|
} else if (h instanceof W) {
|
|
@@ -4737,10 +4753,10 @@ function ei(n, e, t, s, i) {
|
|
|
4737
4753
|
function At(n, e, t) {
|
|
4738
4754
|
return Te(n, e, t);
|
|
4739
4755
|
}
|
|
4740
|
-
function
|
|
4756
|
+
function sc(n, e, t) {
|
|
4741
4757
|
return At(n, e ? { showMarkup: !0, showTableGlue: !1, selectionInNode: void 0 } : Js, t);
|
|
4742
4758
|
}
|
|
4743
|
-
function
|
|
4759
|
+
function ic(n, e, t = !1) {
|
|
4744
4760
|
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
4745
4761
|
let o = [];
|
|
4746
4762
|
for (const l of e) {
|
|
@@ -4778,7 +4794,7 @@ function yt(n, e, t, s, i, o) {
|
|
|
4778
4794
|
};
|
|
4779
4795
|
}
|
|
4780
4796
|
function Ze(n, e, t, s, i) {
|
|
4781
|
-
return new
|
|
4797
|
+
return new nc(n, sc(n, i || !t), e, t, s);
|
|
4782
4798
|
}
|
|
4783
4799
|
function ti(n, e, t) {
|
|
4784
4800
|
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
@@ -4800,9 +4816,9 @@ function ti(n, e, t) {
|
|
|
4800
4816
|
}
|
|
4801
4817
|
for (const a of o)
|
|
4802
4818
|
c.push(Ze(a.node, a.deletedLocal, !0, a.originalStart, t));
|
|
4803
|
-
return
|
|
4819
|
+
return oc(n, c);
|
|
4804
4820
|
}
|
|
4805
|
-
function
|
|
4821
|
+
function oc(n, e) {
|
|
4806
4822
|
return Object.assign(Object.create(Object.getPrototypeOf(n)), n, { content: e });
|
|
4807
4823
|
}
|
|
4808
4824
|
function ni(n) {
|
|
@@ -4823,63 +4839,63 @@ function Te(n, e, t, s) {
|
|
|
4823
4839
|
const i = n;
|
|
4824
4840
|
switch (i.kind) {
|
|
4825
4841
|
case "text":
|
|
4826
|
-
return O(t, new
|
|
4842
|
+
return O(t, new Zr(i, e.showMarkup, s?.left ?? !1, s?.right ?? !1));
|
|
4827
4843
|
// The trailing gap is revealed as `↵` glyphs by virtue of its `blockGap`
|
|
4828
4844
|
// kind (see `GlueViewNode`), so the break needs no inline-flow opt-in.
|
|
4829
4845
|
case "thematicBreak":
|
|
4830
|
-
return O(t, new Zr(i, e.showMarkup, $(i.children, e, t)));
|
|
4831
|
-
case "unhandledBlock":
|
|
4832
4846
|
return O(t, new Jr(i, e.showMarkup, $(i.children, e, t)));
|
|
4847
|
+
case "unhandledBlock":
|
|
4848
|
+
return O(t, new ec(i, e.showMarkup, $(i.children, e, t)));
|
|
4833
4849
|
case "marker":
|
|
4834
|
-
return O(t, new
|
|
4850
|
+
return O(t, new tc(i, lc(i.markerKind, e)));
|
|
4835
4851
|
case "glue":
|
|
4836
|
-
return O(t, new Zs(i,
|
|
4852
|
+
return O(t, new Zs(i, dc(i.glueKind, e), e.inlineFlow ?? !1));
|
|
4837
4853
|
case "heading":
|
|
4838
|
-
return O(t, new Nr(i, $(i.children, J(e), t)));
|
|
4839
|
-
case "paragraph":
|
|
4840
4854
|
return O(t, new Ir(i, $(i.children, J(e), t)));
|
|
4855
|
+
case "paragraph":
|
|
4856
|
+
return O(t, new Br(i, $(i.children, J(e), t)));
|
|
4841
4857
|
case "frontMatter":
|
|
4842
|
-
return O(t, new Pr(i, e.showMarkup, $(i.children, e, t)));
|
|
4843
|
-
case "codeBlock":
|
|
4844
4858
|
return O(t, new Ar(i, e.showMarkup, $(i.children, e, t)));
|
|
4845
|
-
case "
|
|
4859
|
+
case "codeBlock":
|
|
4846
4860
|
return O(t, new Dr(i, e.showMarkup, $(i.children, e, t)));
|
|
4861
|
+
case "mathBlock":
|
|
4862
|
+
return O(t, new Fr(i, e.showMarkup, $(i.children, e, t)));
|
|
4847
4863
|
case "blockQuote": {
|
|
4848
|
-
const o =
|
|
4849
|
-
return O(t, new
|
|
4864
|
+
const o = ac(i), r = e.pendingAnchorBlock ? ie(e.pendingAnchorBlock, i) : void 0, c = o && r !== void 0 ? o.delta(r) : void 0, a = !c || !e.pendingReplacementInBlock?.containsRange(c);
|
|
4865
|
+
return O(t, new Vr(i, $(i.children, e, t), a));
|
|
4850
4866
|
}
|
|
4851
4867
|
case "list":
|
|
4852
|
-
return O(t,
|
|
4868
|
+
return O(t, hc(i, e, t));
|
|
4853
4869
|
case "listItem":
|
|
4854
4870
|
return O(t, si(i, e, t));
|
|
4855
4871
|
case "table":
|
|
4856
|
-
return O(t,
|
|
4872
|
+
return O(t, uc(i, e, t));
|
|
4857
4873
|
case "tableRow":
|
|
4858
4874
|
return O(t, ii(i, e, !1, t));
|
|
4859
4875
|
case "tableCell":
|
|
4860
4876
|
return O(t, oi(i, e.showMarkup, e.showTableGlue, e.selectionInNode, t));
|
|
4861
4877
|
case "strong":
|
|
4862
|
-
return O(t, new Hr(i, $(i.children, J(e), t)));
|
|
4863
|
-
case "emphasis":
|
|
4864
4878
|
return O(t, new Wr(i, $(i.children, J(e), t)));
|
|
4865
|
-
case "
|
|
4879
|
+
case "emphasis":
|
|
4866
4880
|
return O(t, new Kr(i, $(i.children, J(e), t)));
|
|
4867
|
-
case "
|
|
4881
|
+
case "strikethrough":
|
|
4868
4882
|
return O(t, new zr(i, $(i.children, J(e), t)));
|
|
4883
|
+
case "inlineCode":
|
|
4884
|
+
return O(t, new qr(i, $(i.children, J(e), t)));
|
|
4869
4885
|
case "inlineMath":
|
|
4870
|
-
return O(t, new
|
|
4886
|
+
return O(t, new Gr(i, e.showMarkup, $(i.children, J(e), t)));
|
|
4871
4887
|
case "link":
|
|
4872
|
-
return O(t, new
|
|
4888
|
+
return O(t, new Xr(i, $(i.children, J(e), t)));
|
|
4873
4889
|
case "image":
|
|
4874
|
-
return O(t, new
|
|
4890
|
+
return O(t, new Ur(i, e.showMarkup, $(i.children, J(e), t)));
|
|
4875
4891
|
case "document":
|
|
4876
4892
|
return ei(i, /* @__PURE__ */ new Set(), w.ofLength(0), void 0);
|
|
4877
4893
|
}
|
|
4878
4894
|
}
|
|
4879
4895
|
function Dt(n) {
|
|
4880
|
-
return n.kind === "document" ? n.blocks.map((e) => e.view) : "content" in n ? n.content :
|
|
4896
|
+
return n.kind === "document" ? n.blocks.map((e) => e.view) : "content" in n ? n.content : rc;
|
|
4881
4897
|
}
|
|
4882
|
-
const
|
|
4898
|
+
const rc = [];
|
|
4883
4899
|
function $e(n) {
|
|
4884
4900
|
if (!n)
|
|
4885
4901
|
return;
|
|
@@ -4889,14 +4905,14 @@ function $e(n) {
|
|
|
4889
4905
|
return e;
|
|
4890
4906
|
}
|
|
4891
4907
|
function O(n, e) {
|
|
4892
|
-
if (n && n.kind === e.kind && n.ast === e.ast &&
|
|
4908
|
+
if (n && n.kind === e.kind && n.ast === e.ast && cc(n, e)) {
|
|
4893
4909
|
const t = Dt(n), s = Dt(e);
|
|
4894
4910
|
if (t.length === s.length && t.every((i, o) => i === s[o]))
|
|
4895
4911
|
return n;
|
|
4896
4912
|
}
|
|
4897
4913
|
return e;
|
|
4898
4914
|
}
|
|
4899
|
-
function
|
|
4915
|
+
function cc(n, e) {
|
|
4900
4916
|
switch (n.kind) {
|
|
4901
4917
|
case "text":
|
|
4902
4918
|
return n.showWhitespace === e.showWhitespace && n.leftWordBoundary === e.leftWordBoundary && n.rightWordBoundary === e.rightWordBoundary;
|
|
@@ -4932,7 +4948,7 @@ function rc(n, e) {
|
|
|
4932
4948
|
return !0;
|
|
4933
4949
|
}
|
|
4934
4950
|
}
|
|
4935
|
-
function
|
|
4951
|
+
function ac(n) {
|
|
4936
4952
|
let e = 0, t;
|
|
4937
4953
|
for (const s of n.children)
|
|
4938
4954
|
s instanceof W || (t = s instanceof y && s.markerKind === "blockQuoteMarker" ? w.ofStartAndLength(e, s.length) : void 0), e += s.length;
|
|
@@ -4967,14 +4983,14 @@ function Dn(n, e) {
|
|
|
4967
4983
|
return !1;
|
|
4968
4984
|
}
|
|
4969
4985
|
}
|
|
4970
|
-
function
|
|
4986
|
+
function lc(n, e) {
|
|
4971
4987
|
return e.showMarkup || n === "tableCellGlue" && e.showTableGlue;
|
|
4972
4988
|
}
|
|
4973
|
-
function
|
|
4989
|
+
function dc(n, e) {
|
|
4974
4990
|
return e.showMarkup || n === "tableCellGlue" && e.showTableGlue;
|
|
4975
4991
|
}
|
|
4976
|
-
function
|
|
4977
|
-
const s = $e(t), i =
|
|
4992
|
+
function hc(n, e, t) {
|
|
4993
|
+
const s = $e(t), i = fc(n, e), o = new Set(n.items), r = (e.listLevel ?? 0) + 1, c = [];
|
|
4978
4994
|
let a = 0;
|
|
4979
4995
|
for (const l of n.children) {
|
|
4980
4996
|
if (o.has(l)) {
|
|
@@ -4989,7 +5005,7 @@ function dc(n, e, t) {
|
|
|
4989
5005
|
c.push(Te(l, e, s?.get(l)));
|
|
4990
5006
|
a += l.length;
|
|
4991
5007
|
}
|
|
4992
|
-
return new
|
|
5008
|
+
return new $r(n, c);
|
|
4993
5009
|
}
|
|
4994
5010
|
function si(n, e, t) {
|
|
4995
5011
|
const s = $e(t), i = [];
|
|
@@ -4998,9 +5014,9 @@ function si(n, e, t) {
|
|
|
4998
5014
|
const c = e.selectionInNode ? { ...e, selectionInNode: e.selectionInNode.delta(-o) } : e;
|
|
4999
5015
|
i.push(Te(r, c, s?.get(r))), o += r.length;
|
|
5000
5016
|
}
|
|
5001
|
-
return new
|
|
5017
|
+
return new Yr(n, e.showMarkup, i, e.listLevel ?? 1);
|
|
5002
5018
|
}
|
|
5003
|
-
function
|
|
5019
|
+
function uc(n, e, t) {
|
|
5004
5020
|
const s = $e(t), i = e.showMarkup, o = n.delimiterRow, r = new Set(
|
|
5005
5021
|
[n.headerRow, n.delimiterRow, ...n.bodyRows].filter((l) => l !== void 0)
|
|
5006
5022
|
), c = [];
|
|
@@ -5017,10 +5033,10 @@ function hc(n, e, t) {
|
|
|
5017
5033
|
c.push(Te(l, e, s?.get(l)));
|
|
5018
5034
|
a += l.length;
|
|
5019
5035
|
}
|
|
5020
|
-
return new
|
|
5036
|
+
return new Hr(n, c);
|
|
5021
5037
|
}
|
|
5022
5038
|
function ii(n, e, t, s) {
|
|
5023
|
-
const i = $e(s), o = e.showMarkup, r = t ? void 0 :
|
|
5039
|
+
const i = $e(s), o = e.showMarkup, r = t ? void 0 : mc(n, e), c = new Set(n.cells), a = [];
|
|
5024
5040
|
let l = 0;
|
|
5025
5041
|
for (const d of n.children) {
|
|
5026
5042
|
if (c.has(d)) {
|
|
@@ -5030,14 +5046,14 @@ function ii(n, e, t, s) {
|
|
|
5030
5046
|
a.push(Te(d, e, i?.get(d)));
|
|
5031
5047
|
l += d.length;
|
|
5032
5048
|
}
|
|
5033
|
-
return new
|
|
5049
|
+
return new jr(n, t, a);
|
|
5034
5050
|
}
|
|
5035
5051
|
function oi(n, e, t, s, i) {
|
|
5036
5052
|
const o = { showMarkup: e, showTableGlue: t, selectionInNode: s };
|
|
5037
|
-
return new
|
|
5053
|
+
return new Qr(n, e, t, $(n.children, J(o), i));
|
|
5038
5054
|
}
|
|
5039
5055
|
const st = /* @__PURE__ */ new Set();
|
|
5040
|
-
function
|
|
5056
|
+
function fc(n, e) {
|
|
5041
5057
|
if (!e.showMarkup || !e.selectionInNode)
|
|
5042
5058
|
return st;
|
|
5043
5059
|
const t = e.selectionInNode;
|
|
@@ -5053,12 +5069,12 @@ function uc(n, e) {
|
|
|
5053
5069
|
}
|
|
5054
5070
|
return s;
|
|
5055
5071
|
}
|
|
5056
|
-
function
|
|
5072
|
+
function mc(n, e) {
|
|
5057
5073
|
if (!e.showMarkup || !e.selectionInNode)
|
|
5058
5074
|
return st;
|
|
5059
5075
|
const t = e.selectionInNode;
|
|
5060
5076
|
if (t.isEmpty) {
|
|
5061
|
-
const o =
|
|
5077
|
+
const o = gc(n, t.start);
|
|
5062
5078
|
return o === void 0 ? st : /* @__PURE__ */ new Set([o]);
|
|
5063
5079
|
}
|
|
5064
5080
|
const s = /* @__PURE__ */ new Set();
|
|
@@ -5069,7 +5085,7 @@ function fc(n, e) {
|
|
|
5069
5085
|
}
|
|
5070
5086
|
return s;
|
|
5071
5087
|
}
|
|
5072
|
-
function
|
|
5088
|
+
function gc(n, e) {
|
|
5073
5089
|
let t = 0;
|
|
5074
5090
|
for (const s of n.children) {
|
|
5075
5091
|
const i = t + s.length, o = n.cells.indexOf(s);
|
|
@@ -5078,7 +5094,7 @@ function mc(n, e) {
|
|
|
5078
5094
|
t = i;
|
|
5079
5095
|
}
|
|
5080
5096
|
}
|
|
5081
|
-
function
|
|
5097
|
+
function pc(n) {
|
|
5082
5098
|
const e = [], t = (s, i) => {
|
|
5083
5099
|
const o = s.children;
|
|
5084
5100
|
if (o.length === 0) {
|
|
@@ -5101,11 +5117,11 @@ function Fn(n, e) {
|
|
|
5101
5117
|
function pt(n, e, t = Number.POSITIVE_INFINITY) {
|
|
5102
5118
|
if (t <= 0)
|
|
5103
5119
|
return [];
|
|
5104
|
-
const s =
|
|
5120
|
+
const s = pc(n), i = e.slice().sort((c, a) => c.start - a.start || c.endExclusive - a.endExclusive), o = [];
|
|
5105
5121
|
let r = 0;
|
|
5106
5122
|
for (const c of i) {
|
|
5107
5123
|
if (c.isEmpty) {
|
|
5108
|
-
const a =
|
|
5124
|
+
const a = _c(s, c.start);
|
|
5109
5125
|
if (a && (o.push({ range: Fn(a, c), sourceRange: c }), o.length >= t))
|
|
5110
5126
|
return o;
|
|
5111
5127
|
continue;
|
|
@@ -5128,10 +5144,10 @@ function pt(n, e, t = Number.POSITIVE_INFINITY) {
|
|
|
5128
5144
|
function xt(n, e) {
|
|
5129
5145
|
return pt(n, e).map((t) => t.range);
|
|
5130
5146
|
}
|
|
5131
|
-
function
|
|
5147
|
+
function _c(n, e) {
|
|
5132
5148
|
return n.find((t) => t.start <= e && e <= t.start + t.len);
|
|
5133
5149
|
}
|
|
5134
|
-
class
|
|
5150
|
+
class vc extends H {
|
|
5135
5151
|
constructor(e, t) {
|
|
5136
5152
|
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 = gt.forSvgOverlay(this._coordinateProbe)), this._resizeObserver = new ResizeObserver(() => {
|
|
5137
5153
|
this._last && this._repaint(this._last);
|
|
@@ -5191,14 +5207,14 @@ class _c extends H {
|
|
|
5191
5207
|
this.element.replaceChildren(...t);
|
|
5192
5208
|
}
|
|
5193
5209
|
}
|
|
5194
|
-
class
|
|
5210
|
+
class wc extends H {
|
|
5195
5211
|
element;
|
|
5196
5212
|
rendering;
|
|
5197
5213
|
_path;
|
|
5198
5214
|
constructor(e) {
|
|
5199
5215
|
super(), this.element = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.element.setAttribute("class", "md-selection-layer"), this._path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._path.setAttribute("class", "md-selection-path"), this.element.appendChild(this._path), this.rendering = B(this, (t) => {
|
|
5200
5216
|
const s = t.readObservable(e.selection), i = t.readObservable(e.visualLineMap), o = t.readObservable(e.blocks);
|
|
5201
|
-
return
|
|
5217
|
+
return bc(this._path, s, i, o);
|
|
5202
5218
|
}), this._register(P((t) => {
|
|
5203
5219
|
t.readObservable(this.rendering);
|
|
5204
5220
|
}));
|
|
@@ -5209,13 +5225,13 @@ class Vn {
|
|
|
5209
5225
|
this.rects = e;
|
|
5210
5226
|
}
|
|
5211
5227
|
}
|
|
5212
|
-
function
|
|
5228
|
+
function bc(n, e, t, s) {
|
|
5213
5229
|
if (!e || e.isCollapsed)
|
|
5214
5230
|
return n.setAttribute("d", ""), new Vn([]);
|
|
5215
5231
|
const i = ri(e.range, t, s);
|
|
5216
5232
|
return n.setAttribute("d", ai(i, 4)), new Vn(i);
|
|
5217
5233
|
}
|
|
5218
|
-
const
|
|
5234
|
+
const kc = 0.4;
|
|
5219
5235
|
function ri(n, e, t) {
|
|
5220
5236
|
if (n.isEmpty)
|
|
5221
5237
|
return [];
|
|
@@ -5238,7 +5254,7 @@ function ri(n, e, t) {
|
|
|
5238
5254
|
E = h.xAtOffset(s.endExclusive);
|
|
5239
5255
|
else {
|
|
5240
5256
|
const x = s.endExclusive > p;
|
|
5241
|
-
E = h.rect.right + (x && m ? h.rect.height *
|
|
5257
|
+
E = h.rect.right + (x && m ? h.rect.height * kc : 0);
|
|
5242
5258
|
}
|
|
5243
5259
|
const b = ci(g);
|
|
5244
5260
|
b && (v = Math.max(v, b.left), E = Math.min(E, b.right)), c.push(i(v, h.rect.top, E, h.rect.bottom)), a.push({ left: v, right: E, top: h.rect.top, bottom: h.rect.top + h.rect.height });
|
|
@@ -5262,7 +5278,7 @@ function ri(n, e, t) {
|
|
|
5262
5278
|
const f = t[h], m = t[h + 1], g = f.absoluteStart + f.block.length, _ = m.absoluteStart;
|
|
5263
5279
|
if (g < _ && !s.containsRange(w.fromTo(g, _)) || g >= _ && !(u[h] && u[h + 1]))
|
|
5264
5280
|
continue;
|
|
5265
|
-
const p = f.rect, v = m.rect, E =
|
|
5281
|
+
const p = f.rect, v = m.rect, E = xc(e, m, v.top), b = p.bottom;
|
|
5266
5282
|
if (E <= b)
|
|
5267
5283
|
continue;
|
|
5268
5284
|
const x = d.get(f), T = l.get(m);
|
|
@@ -5297,10 +5313,10 @@ function Et(n, e) {
|
|
|
5297
5313
|
function ci(n) {
|
|
5298
5314
|
return n?.viewportClip;
|
|
5299
5315
|
}
|
|
5300
|
-
function
|
|
5316
|
+
function yc(n, e) {
|
|
5301
5317
|
return n.find((t) => e >= t.absoluteStart && e <= t.absoluteStart + t.block.length);
|
|
5302
5318
|
}
|
|
5303
|
-
function
|
|
5319
|
+
function xc(n, e, t) {
|
|
5304
5320
|
const s = w.ofStartAndLength(e.absoluteStart, e.block.length);
|
|
5305
5321
|
for (const i of n.sourceLines) {
|
|
5306
5322
|
const o = it(i);
|
|
@@ -5318,9 +5334,9 @@ function ai(n, e) {
|
|
|
5318
5334
|
const r = i[i.length - 1], c = r !== void 0 && o.y <= r.y + r.height + 0.5, a = r !== void 0 && Math.max(r.x, o.x) < Math.min(r.x + r.width, o.x + o.width);
|
|
5319
5335
|
c && a ? i.push(o) : (i.length > 0 && s.push(i), i = [o]);
|
|
5320
5336
|
}
|
|
5321
|
-
return i.length > 0 && s.push(i), s.map((o) =>
|
|
5337
|
+
return i.length > 0 && s.push(i), s.map((o) => Ec(o, e)).filter(Boolean).join(" ");
|
|
5322
5338
|
}
|
|
5323
|
-
function
|
|
5339
|
+
function Ec(n, e) {
|
|
5324
5340
|
const t = [];
|
|
5325
5341
|
t.push({ x: n[0].x + n[0].width, y: n[0].y, convex: !0 });
|
|
5326
5342
|
for (let i = 0; i < n.length - 1; i++) {
|
|
@@ -5339,9 +5355,9 @@ function xc(n, e) {
|
|
|
5339
5355
|
t.push({ x: o.x, y: c, convex: a }), t.push({ x: r.x, y: c, convex: !a });
|
|
5340
5356
|
}
|
|
5341
5357
|
}
|
|
5342
|
-
return t.push({ x: n[0].x, y: n[0].y, convex: !0 }),
|
|
5358
|
+
return t.push({ x: n[0].x, y: n[0].y, convex: !0 }), Cc(t, e);
|
|
5343
5359
|
}
|
|
5344
|
-
function
|
|
5360
|
+
function Cc(n, e) {
|
|
5345
5361
|
const t = n.length;
|
|
5346
5362
|
if (t < 3)
|
|
5347
5363
|
return "";
|
|
@@ -5372,7 +5388,7 @@ function Ct(n, e, t) {
|
|
|
5372
5388
|
function Z(n) {
|
|
5373
5389
|
return n.toFixed(2);
|
|
5374
5390
|
}
|
|
5375
|
-
class
|
|
5391
|
+
class Sc extends H {
|
|
5376
5392
|
element;
|
|
5377
5393
|
rendering;
|
|
5378
5394
|
constructor(e) {
|
|
@@ -5383,7 +5399,7 @@ class Cc extends H {
|
|
|
5383
5399
|
const o = i.lineIndexOfPosition(s);
|
|
5384
5400
|
if (o === void 0)
|
|
5385
5401
|
return this.element.style.display = "none", new Xe(s, !1, S.EMPTY);
|
|
5386
|
-
const r = i.lineRect(o).withZeroWidthAt(i.xAtPosition(s)), c = e.blocks ? t.readObservable(e.blocks) : void 0, a = c && s.kind === "source" ? ci(
|
|
5402
|
+
const r = i.lineRect(o).withZeroWidthAt(i.xAtPosition(s)), c = e.blocks ? t.readObservable(e.blocks) : void 0, a = c && s.kind === "source" ? ci(yc(c, s.offset)) : void 0;
|
|
5387
5403
|
return a && (r.x < a.left - 0.5 || r.x > a.right + 0.5) ? (this.element.style.display = "none", new Xe(s, !1, S.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 Xe(s, !0, r));
|
|
5388
5404
|
}), this._register(P((t) => {
|
|
5389
5405
|
t.readObservable(this.rendering);
|
|
@@ -5397,7 +5413,7 @@ class Xe {
|
|
|
5397
5413
|
this.position = e, this.visible = t, this.rect = s;
|
|
5398
5414
|
}
|
|
5399
5415
|
}
|
|
5400
|
-
class
|
|
5416
|
+
class Lc extends H {
|
|
5401
5417
|
element;
|
|
5402
5418
|
rendering;
|
|
5403
5419
|
constructor(e) {
|
|
@@ -5413,7 +5429,7 @@ class Sc extends H {
|
|
|
5413
5429
|
return new $n([]);
|
|
5414
5430
|
const s = [];
|
|
5415
5431
|
for (const i of e) {
|
|
5416
|
-
const o = i.type === "deleted" || i.range.isEmpty ?
|
|
5432
|
+
const o = i.type === "deleted" || i.range.isEmpty ? Tc(i, t) : Mc(i, t);
|
|
5417
5433
|
if (!o)
|
|
5418
5434
|
continue;
|
|
5419
5435
|
const r = document.createElement("div");
|
|
@@ -5427,20 +5443,20 @@ class $n {
|
|
|
5427
5443
|
this.rects = e;
|
|
5428
5444
|
}
|
|
5429
5445
|
}
|
|
5430
|
-
function
|
|
5446
|
+
function Mc(n, e) {
|
|
5431
5447
|
let t = 1 / 0, s = -1 / 0;
|
|
5432
5448
|
for (const i of e.sourceLines) {
|
|
5433
|
-
const o =
|
|
5449
|
+
const o = Oc(i);
|
|
5434
5450
|
!o || !n.range.intersects(o) || (t = Math.min(t, i.rect.top), s = Math.max(s, i.rect.top + i.rect.height));
|
|
5435
5451
|
}
|
|
5436
5452
|
if (!(s <= t))
|
|
5437
5453
|
return { type: n.type, y: t, height: s - t };
|
|
5438
5454
|
}
|
|
5439
|
-
function
|
|
5455
|
+
function Tc(n, e) {
|
|
5440
5456
|
const t = e.lineIndexOfOffset(n.range.start);
|
|
5441
5457
|
return { type: "deleted", y: e.lineRect(t).top, height: 0 };
|
|
5442
5458
|
}
|
|
5443
|
-
function
|
|
5459
|
+
function Oc(n) {
|
|
5444
5460
|
if (n.runs.length === 0)
|
|
5445
5461
|
return;
|
|
5446
5462
|
let e = 1 / 0, t = -1 / 0;
|
|
@@ -5451,7 +5467,7 @@ function Tc(n) {
|
|
|
5451
5467
|
function Hn(n) {
|
|
5452
5468
|
return n.windowHasFocus && n.focusIsUnclaimed;
|
|
5453
5469
|
}
|
|
5454
|
-
function
|
|
5470
|
+
function Rc(n) {
|
|
5455
5471
|
return !n.windowHasFocus;
|
|
5456
5472
|
}
|
|
5457
5473
|
function li(n) {
|
|
@@ -5487,14 +5503,14 @@ function di(n) {
|
|
|
5487
5503
|
n.clientHeight * s
|
|
5488
5504
|
);
|
|
5489
5505
|
}
|
|
5490
|
-
function
|
|
5506
|
+
function Nc(n, e, t) {
|
|
5491
5507
|
const s = n.getBoundingClientRect(), i = n.offsetWidth > 0 ? s.width / n.offsetWidth : 1, o = n.offsetHeight > 0 ? s.height / n.offsetHeight : 1;
|
|
5492
5508
|
return {
|
|
5493
5509
|
x: e / i,
|
|
5494
5510
|
y: t / o
|
|
5495
5511
|
};
|
|
5496
5512
|
}
|
|
5497
|
-
function
|
|
5513
|
+
function Ic(n) {
|
|
5498
5514
|
const t = n.ownerDocument.defaultView ?? window, s = [];
|
|
5499
5515
|
for (let i = n.parentElement; i; i = i.parentElement) {
|
|
5500
5516
|
const o = t.getComputedStyle(i), r = zn(o.overflowX) && i.scrollWidth > i.clientWidth, c = zn(o.overflowY) && i.scrollHeight > i.clientHeight;
|
|
@@ -5511,15 +5527,15 @@ function Kn(n) {
|
|
|
5511
5527
|
function zn(n) {
|
|
5512
5528
|
return n === "auto" || n === "scroll" || n === "hidden";
|
|
5513
5529
|
}
|
|
5514
|
-
const
|
|
5530
|
+
const Bc = 900;
|
|
5515
5531
|
class bl extends H {
|
|
5516
5532
|
constructor(e, t) {
|
|
5517
5533
|
super(), this._model = e, this._options = t, this.element = document.createElement("div"), this.element.className = "md-editor", this._options?.classNames && this.element.classList.add(...this._options.classNames), this.element.tabIndex = 0, this._contentContainer = document.createElement("div"), this._contentContainer.className = "md-editor-content", this.element.appendChild(this._contentContainer);
|
|
5518
|
-
const s = this._options?.limitedWidth ?? pi(
|
|
5534
|
+
const s = this._options?.limitedWidth ?? pi(Bc);
|
|
5519
5535
|
this._register(P((l) => {
|
|
5520
5536
|
const d = s.read(l);
|
|
5521
5537
|
this._contentContainer.style.maxWidth = d === void 0 ? "" : `${d}px`;
|
|
5522
|
-
})), this.measuredLayout = new
|
|
5538
|
+
})), this.measuredLayout = new vo();
|
|
5523
5539
|
let i = -1, o = -1, r = -1;
|
|
5524
5540
|
this._resizeObserver = new ResizeObserver(() => {
|
|
5525
5541
|
this.element.classList.toggle("md-editor-narrow", this.element.clientWidth <= 320);
|
|
@@ -5543,18 +5559,18 @@ class bl extends H {
|
|
|
5543
5559
|
dispose: () => {
|
|
5544
5560
|
this._contentContainer.removeEventListener("scroll", a, { capture: !0 }), c && cancelAnimationFrame(c);
|
|
5545
5561
|
}
|
|
5546
|
-
}), this._selectionView = this._register(new
|
|
5562
|
+
}), this._selectionView = this._register(new wc({
|
|
5547
5563
|
selection: this._model.selection,
|
|
5548
5564
|
visualLineMap: this.measuredLayout.visualLineMap,
|
|
5549
5565
|
blocks: this._selectionBlocksObs
|
|
5550
|
-
})), this._contentContainer.appendChild(this._selectionView.element), this.coordinateSpace = gt.forSvgOverlay(this._selectionView.element), this._cursorView = this._register(new
|
|
5566
|
+
})), this._contentContainer.appendChild(this._selectionView.element), this.coordinateSpace = gt.forSvgOverlay(this._selectionView.element), this._cursorView = this._register(new Sc({
|
|
5551
5567
|
position: this._model.cursorPosition,
|
|
5552
5568
|
visualLineMap: this.measuredLayout.visualLineMap,
|
|
5553
5569
|
blocks: this._selectionBlocksObs
|
|
5554
|
-
})), this._contentContainer.appendChild(this._cursorView.element), this._gutterMarkersView = this._register(new
|
|
5570
|
+
})), this._contentContainer.appendChild(this._cursorView.element), this._gutterMarkersView = this._register(new Lc({
|
|
5555
5571
|
markers: this._model.gutterMarkers,
|
|
5556
5572
|
visualLineMap: this.measuredLayout.visualLineMap
|
|
5557
|
-
})), this._contentContainer.appendChild(this._gutterMarkersView.element), this._diffHighlightsView = this._register(new
|
|
5573
|
+
})), this._contentContainer.appendChild(this._gutterMarkersView.element), this._diffHighlightsView = this._register(new vc(this._contentContainer, this.coordinateSpace)), this._contentContainer.appendChild(this._diffHighlightsView.element), this._register(P((l) => {
|
|
5558
5574
|
const d = this._model.readonlyMode.read(l);
|
|
5559
5575
|
this.element.classList.toggle("md-readonly", d), d || this.element.classList.remove("md-readonly-editing-attempt");
|
|
5560
5576
|
})), this._options?.showReadonlyToggle !== !1 && this._setupReadonlyToggle(), this.editContext = new EditContext({
|
|
@@ -5846,7 +5862,7 @@ class bl extends H {
|
|
|
5846
5862
|
this.focus();
|
|
5847
5863
|
return;
|
|
5848
5864
|
}
|
|
5849
|
-
if (!
|
|
5865
|
+
if (!Rc(e))
|
|
5850
5866
|
return;
|
|
5851
5867
|
const t = this.element.ownerDocument.defaultView ?? window, s = () => {
|
|
5852
5868
|
t.removeEventListener("focus", s), this.tryAutoFocus();
|
|
@@ -5879,7 +5895,7 @@ class bl extends H {
|
|
|
5879
5895
|
const i = this.measuredLayout.visualLineMap.get();
|
|
5880
5896
|
return i.isEmpty ? void 0 : i.offsetAtPoint(this.coordinateSpace.capture().toLocalPoint(e));
|
|
5881
5897
|
}
|
|
5882
|
-
const s =
|
|
5898
|
+
const s = Rr(e);
|
|
5883
5899
|
if (s)
|
|
5884
5900
|
return this._document.get()?.resolveSource(s);
|
|
5885
5901
|
}
|
|
@@ -5896,7 +5912,7 @@ class bl extends H {
|
|
|
5896
5912
|
const i = this._document.get();
|
|
5897
5913
|
if (!i)
|
|
5898
5914
|
return;
|
|
5899
|
-
const o =
|
|
5915
|
+
const o = oe.forDom(s);
|
|
5900
5916
|
if (o?.ast.kind !== "tableCell" || o.dom !== s)
|
|
5901
5917
|
return;
|
|
5902
5918
|
const r = i.resolveSource({ node: s, offset: 0 }), c = i.resolveSource({ node: s, offset: 1 });
|
|
@@ -5909,7 +5925,7 @@ class bl extends H {
|
|
|
5909
5925
|
(f) => f.runs.some(
|
|
5910
5926
|
(m) => m.source !== void 0 && m.sourceStart < h && m.sourceEndExclusive > u
|
|
5911
5927
|
)
|
|
5912
|
-
), d = t ?
|
|
5928
|
+
), d = t ? oe.forDom(t) : void 0;
|
|
5913
5929
|
if (d && d !== o && d.dom instanceof Element) {
|
|
5914
5930
|
const u = i.resolveSource({ node: d.dom, offset: 0 }), h = i.resolveSource({ node: d.dom, offset: 1 });
|
|
5915
5931
|
if (u !== void 0 && h !== void 0 && !l(u, h))
|
|
@@ -5934,14 +5950,15 @@ class bl extends H {
|
|
|
5934
5950
|
return s !== null && t.contains(s);
|
|
5935
5951
|
}
|
|
5936
5952
|
/**
|
|
5937
|
-
* Whether `
|
|
5938
|
-
* selection this editor paints itself from `model.selection`.
|
|
5939
|
-
*
|
|
5940
|
-
*
|
|
5953
|
+
* Whether `range` intersects the rendered source text — the region whose
|
|
5954
|
+
* selection this editor paints itself from `model.selection`. This also
|
|
5955
|
+
* catches select-all ranges whose endpoints surround the rendered content.
|
|
5956
|
+
* Overlays anchored beside the text (comment widgets and the like) are *not*
|
|
5957
|
+
* part of it and keep their own native selection behaviour.
|
|
5941
5958
|
*/
|
|
5942
|
-
|
|
5959
|
+
intersectsRenderedContent(e) {
|
|
5943
5960
|
const t = this._document.get()?.contentDomNode;
|
|
5944
|
-
return !!t &&
|
|
5961
|
+
return !!t && e.intersectsNode(t);
|
|
5945
5962
|
}
|
|
5946
5963
|
// ----- render autorun ------------------------------------------------
|
|
5947
5964
|
_renderAutorun = (e) => {
|
|
@@ -5963,7 +5980,7 @@ class bl extends H {
|
|
|
5963
5980
|
} : void 0
|
|
5964
5981
|
);
|
|
5965
5982
|
this._previousViewData = m;
|
|
5966
|
-
const g = l ?
|
|
5983
|
+
const g = l ? ic(m, l.items, this._options?.diffDecorationsActive) : m;
|
|
5967
5984
|
this._viewData.set(g, void 0);
|
|
5968
5985
|
const _ = this._options?.embeddedCodeEditorFactory ? { ...this._options, embeddedCodeEditorReadOnly: d, embeddedCodeEditorFactoryVersion: u } : this._options, p = en.create(g, _, f);
|
|
5969
5986
|
if (f) {
|
|
@@ -6051,7 +6068,7 @@ class bl extends H {
|
|
|
6051
6068
|
if (!c)
|
|
6052
6069
|
return;
|
|
6053
6070
|
const a = () => {
|
|
6054
|
-
const _ =
|
|
6071
|
+
const _ = Ac(i.flatMap((v) => Array.from(v.range.getClientRects())));
|
|
6055
6072
|
if (_ || !e.isEmpty)
|
|
6056
6073
|
return _;
|
|
6057
6074
|
const p = this.measuredLayout.visualLineMap.get();
|
|
@@ -6076,11 +6093,11 @@ class bl extends H {
|
|
|
6076
6093
|
let u = this._isRevealOccluded(l);
|
|
6077
6094
|
if (Wn(d, l) && !u)
|
|
6078
6095
|
return;
|
|
6079
|
-
const h =
|
|
6096
|
+
const h = Ic(c);
|
|
6080
6097
|
for (let _ = 0; _ < h.length; _++) {
|
|
6081
6098
|
const p = h[_];
|
|
6082
6099
|
l = a() ?? l, u = this._isRevealOccluded(l);
|
|
6083
|
-
const v = di(p), E = p.scrollWidth > p.clientWidth, b = p.scrollHeight > p.clientHeight, x =
|
|
6100
|
+
const v = di(p), E = p.scrollWidth > p.clientWidth, b = p.scrollHeight > p.clientHeight, x = Nc(
|
|
6084
6101
|
p,
|
|
6085
6102
|
l.left + l.width / 2 - (v.left + v.width / 2),
|
|
6086
6103
|
l.top + l.height / 2 - (v.top + v.height / 2)
|
|
@@ -6107,17 +6124,17 @@ class bl extends H {
|
|
|
6107
6124
|
_isRevealOccluded(e) {
|
|
6108
6125
|
for (const t of this._revealOcclusions) {
|
|
6109
6126
|
const i = t.ownerDocument.defaultView?.getComputedStyle(t).visibility;
|
|
6110
|
-
if (t.isConnected && t.getClientRects().length > 0 && i !== "hidden" && i !== "collapse" &&
|
|
6127
|
+
if (t.isConnected && t.getClientRects().length > 0 && i !== "hidden" && i !== "collapse" && Pc(e, Dc(t.getBoundingClientRect())))
|
|
6111
6128
|
return !0;
|
|
6112
6129
|
}
|
|
6113
6130
|
return !1;
|
|
6114
6131
|
}
|
|
6115
6132
|
}
|
|
6116
|
-
function
|
|
6133
|
+
function Pc(n, e) {
|
|
6117
6134
|
const t = n.width === 0 ? e.containsX(n.left) : Math.max(n.left, e.left) < Math.min(n.right, e.right), s = n.height === 0 ? e.containsY(n.top) : Math.max(n.top, e.top) < Math.min(n.bottom, e.bottom);
|
|
6118
6135
|
return t && s;
|
|
6119
6136
|
}
|
|
6120
|
-
function
|
|
6137
|
+
function Ac(n) {
|
|
6121
6138
|
if (n.length === 0)
|
|
6122
6139
|
return;
|
|
6123
6140
|
let e = Number.POSITIVE_INFINITY, t = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY, i = Number.NEGATIVE_INFINITY;
|
|
@@ -6125,11 +6142,11 @@ function Pc(n) {
|
|
|
6125
6142
|
e = Math.min(e, o.left), t = Math.min(t, o.top), s = Math.max(s, o.right), i = Math.max(i, o.bottom);
|
|
6126
6143
|
return S.fromPointPoint(e, t, s, i);
|
|
6127
6144
|
}
|
|
6128
|
-
function
|
|
6145
|
+
function Dc(n) {
|
|
6129
6146
|
return S.fromPointPoint(n.left, n.top, n.right, n.bottom);
|
|
6130
6147
|
}
|
|
6131
|
-
const
|
|
6132
|
-
class
|
|
6148
|
+
const Fc = 1e3, Vc = "md-editor-find-match", $c = "md-editor-find-current", qn = /* @__PURE__ */ new WeakMap();
|
|
6149
|
+
class Hc {
|
|
6133
6150
|
constructor(e) {
|
|
6134
6151
|
this._registry = e;
|
|
6135
6152
|
}
|
|
@@ -6147,24 +6164,24 @@ class $c {
|
|
|
6147
6164
|
}
|
|
6148
6165
|
_refresh() {
|
|
6149
6166
|
const e = [...this._entries].flatMap((s) => s.matches), t = [...this._entries].flatMap((s) => s.current);
|
|
6150
|
-
this._set(
|
|
6167
|
+
this._set(Vc, e), this._set($c, t);
|
|
6151
6168
|
}
|
|
6152
6169
|
_set(e, t) {
|
|
6153
6170
|
t.length === 0 ? this._registry.delete(e) : this._registry.set(e, new Highlight(...t));
|
|
6154
6171
|
}
|
|
6155
6172
|
}
|
|
6156
|
-
function
|
|
6173
|
+
function Wc(n) {
|
|
6157
6174
|
const e = n.defaultView?.CSS.highlights;
|
|
6158
6175
|
if (!e)
|
|
6159
6176
|
return { update: () => {
|
|
6160
6177
|
}, dispose: () => {
|
|
6161
6178
|
} };
|
|
6162
6179
|
let t = qn.get(n);
|
|
6163
|
-
return t || (t = new
|
|
6180
|
+
return t || (t = new Hc(e), qn.set(n, t)), t.add();
|
|
6164
6181
|
}
|
|
6165
|
-
class
|
|
6182
|
+
class Kc extends H {
|
|
6166
6183
|
constructor(e, t) {
|
|
6167
|
-
super(), this._view = e, this._matchesLayer = Xn("md-find-matches-layer"), this._currentLayer = Xn("md-find-current-layer"), this._highlightRegistration = this._register(
|
|
6184
|
+
super(), this._view = e, this._matchesLayer = Xn("md-find-matches-layer"), this._currentLayer = Xn("md-find-current-layer"), this._highlightRegistration = this._register(Wc(this._view.element.ownerDocument)), this._register(this._view.mountOverlay(this._matchesLayer, "below-selection")), this._register(this._view.mountOverlay(this._currentLayer, "above-decorations")), this._register(P((r) => {
|
|
6168
6185
|
const c = t.isRevealed.read(r);
|
|
6169
6186
|
if (!c) {
|
|
6170
6187
|
this._snapshot = void 0, this._schedulePaint();
|
|
@@ -6212,9 +6229,9 @@ class Wc extends H {
|
|
|
6212
6229
|
this._matchesLayer.replaceChildren(), this._currentLayer.replaceChildren(), this._highlightRegistration.update([], []);
|
|
6213
6230
|
return;
|
|
6214
6231
|
}
|
|
6215
|
-
const t = this._view.coordinateSpace.capture(), s = li(this._view.overlayContainer), i = t.toLocalRect(s), o =
|
|
6232
|
+
const t = this._view.coordinateSpace.capture(), s = li(this._view.overlayContainer), i = t.toLocalRect(s), o = zc(
|
|
6216
6233
|
this._view.measuredLayout.visualLineMap.get().sourceLines.flatMap((u) => Math.max(u.rect.top, i.top) >= Math.min(u.rect.bottom, i.bottom) ? [] : u.runs.flatMap((h) => {
|
|
6217
|
-
const f =
|
|
6234
|
+
const f = qc(h, u.rect, i);
|
|
6218
6235
|
return f ? [f] : [];
|
|
6219
6236
|
}))
|
|
6220
6237
|
), r = Un(
|
|
@@ -6227,7 +6244,7 @@ class Wc extends H {
|
|
|
6227
6244
|
e.measurements,
|
|
6228
6245
|
i,
|
|
6229
6246
|
"md-find-match-rect",
|
|
6230
|
-
|
|
6247
|
+
Fc
|
|
6231
6248
|
), d = this._paintRanges(
|
|
6232
6249
|
this._currentLayer,
|
|
6233
6250
|
e.document,
|
|
@@ -6330,7 +6347,7 @@ function Yn(n, e) {
|
|
|
6330
6347
|
return o;
|
|
6331
6348
|
}
|
|
6332
6349
|
}
|
|
6333
|
-
function
|
|
6350
|
+
function zc(n) {
|
|
6334
6351
|
const e = n.slice().sort((s, i) => s.start - i.start || s.endExclusive - i.endExclusive), t = [];
|
|
6335
6352
|
for (const s of e) {
|
|
6336
6353
|
const i = t[t.length - 1];
|
|
@@ -6338,7 +6355,7 @@ function Kc(n) {
|
|
|
6338
6355
|
}
|
|
6339
6356
|
return t;
|
|
6340
6357
|
}
|
|
6341
|
-
function
|
|
6358
|
+
function qc(n, e, t) {
|
|
6342
6359
|
if (n.sourceRange.isEmpty)
|
|
6343
6360
|
return t.left <= n.rect.left && n.rect.left <= t.right ? n.sourceRange : void 0;
|
|
6344
6361
|
let s = n.sourceStart;
|
|
@@ -6375,7 +6392,7 @@ function Qn(n, e, t) {
|
|
|
6375
6392
|
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);
|
|
6376
6393
|
return s < i && o < r ? S.fromPointPoint(s, o, i, r) : void 0;
|
|
6377
6394
|
}
|
|
6378
|
-
const
|
|
6395
|
+
const Gc = 19999;
|
|
6379
6396
|
class ot {
|
|
6380
6397
|
constructor(e, t, s, i, o) {
|
|
6381
6398
|
this._source = e, this._flags = t, this._wholeWord = s, this._wordSeparators = i, this.isEmpty = o;
|
|
@@ -6386,7 +6403,7 @@ class ot {
|
|
|
6386
6403
|
kind: "valid",
|
|
6387
6404
|
pattern: new ot("", "gmu", e.wholeWord, e.wordSeparators, !0)
|
|
6388
6405
|
};
|
|
6389
|
-
const t = e.isRegex ? e.searchString :
|
|
6406
|
+
const t = e.isRegex ? e.searchString : Xc(e.searchString), s = `gmu${e.matchCase ? "" : "i"}`;
|
|
6390
6407
|
try {
|
|
6391
6408
|
new RegExp(t, s);
|
|
6392
6409
|
} catch (i) {
|
|
@@ -6400,7 +6417,7 @@ class ot {
|
|
|
6400
6417
|
pattern: new ot(t, s, e.wholeWord, e.wordSeparators, !1)
|
|
6401
6418
|
};
|
|
6402
6419
|
}
|
|
6403
|
-
findMatches(e, t, s =
|
|
6420
|
+
findMatches(e, t, s = Gc) {
|
|
6404
6421
|
if (this.isEmpty || s <= 0)
|
|
6405
6422
|
return { matches: [], isCapped: !1 };
|
|
6406
6423
|
const i = [];
|
|
@@ -6422,7 +6439,7 @@ class ot {
|
|
|
6422
6439
|
return this._forEachMatch(e, s, (d) => o?.equals(d) ? (l = !0, !0) : (a = d, d.endExclusive <= r && (c = d), !0)), c ?? (i ? a : void 0) ?? (l ? o : void 0);
|
|
6423
6440
|
}
|
|
6424
6441
|
_forEachMatch(e, t, s) {
|
|
6425
|
-
const i =
|
|
6442
|
+
const i = Uc(t, e.length);
|
|
6426
6443
|
if (i?.isEmpty)
|
|
6427
6444
|
return;
|
|
6428
6445
|
const o = new RegExp(this._source, this._flags);
|
|
@@ -6431,29 +6448,29 @@ class ot {
|
|
|
6431
6448
|
if (!r)
|
|
6432
6449
|
return;
|
|
6433
6450
|
const c = w.ofStartAndLength(r.index, r[0].length);
|
|
6434
|
-
if ((!i || i.containsRange(c)) && (!this._wholeWord ||
|
|
6451
|
+
if ((!i || i.containsRange(c)) && (!this._wholeWord || Yc(e, c, this._wordSeparators)) && !s(c))
|
|
6435
6452
|
return;
|
|
6436
|
-
r[0].length === 0 && (o.lastIndex =
|
|
6453
|
+
r[0].length === 0 && (o.lastIndex = jc(e, o.lastIndex));
|
|
6437
6454
|
}
|
|
6438
6455
|
}
|
|
6439
6456
|
}
|
|
6440
6457
|
function hi(n) {
|
|
6441
6458
|
return n.replace(/[\\{}()[\]^$+*?.|]/g, "\\$&");
|
|
6442
6459
|
}
|
|
6443
|
-
function
|
|
6460
|
+
function Xc(n) {
|
|
6444
6461
|
return n.split(/\r\n|\r|\n/).map(hi).join("(?:\\r\\n|[\\r\\n])");
|
|
6445
6462
|
}
|
|
6446
|
-
function
|
|
6463
|
+
function Uc(n, e) {
|
|
6447
6464
|
if (!n)
|
|
6448
6465
|
return;
|
|
6449
6466
|
const t = rt(n.start, 0, e), s = rt(n.endExclusive, 0, e);
|
|
6450
6467
|
return t <= s ? new w(t, s) : w.emptyAt(t);
|
|
6451
6468
|
}
|
|
6452
|
-
function
|
|
6469
|
+
function Yc(n, e, t) {
|
|
6453
6470
|
const s = n[e.start - 1], i = n[e.start], o = n[e.endExclusive - 1], r = n[e.endExclusive], c = e.start === 0 || !He(s, t) || e.length > 0 && !He(i, t), a = e.endExclusive === n.length || !He(r, t) || e.length > 0 && !He(o, t);
|
|
6454
6471
|
return c && a;
|
|
6455
6472
|
}
|
|
6456
|
-
function
|
|
6473
|
+
function jc(n, e) {
|
|
6457
6474
|
if (e >= n.length)
|
|
6458
6475
|
return n.length + 1;
|
|
6459
6476
|
const t = n.charCodeAt(e);
|
|
@@ -6490,7 +6507,7 @@ class ui {
|
|
|
6490
6507
|
return this._observedSourceTextId = t, { sourceIdentityChanged: i, isExpected: o };
|
|
6491
6508
|
}
|
|
6492
6509
|
}
|
|
6493
|
-
class
|
|
6510
|
+
class Qc extends H {
|
|
6494
6511
|
constructor(e) {
|
|
6495
6512
|
super(), this._editorModel = e, this._sourceEditTracker = new ui(this._editorModel);
|
|
6496
6513
|
let t = this._inputSnapshot();
|
|
@@ -6504,7 +6521,7 @@ class jc extends H {
|
|
|
6504
6521
|
});
|
|
6505
6522
|
return;
|
|
6506
6523
|
}
|
|
6507
|
-
const d = r.isRevealed && !t.isRevealed, u = !
|
|
6524
|
+
const d = r.isRevealed && !t.isRevealed, u = !Jc(r, t), h = !ea(r.scope, t.scope) && !a;
|
|
6508
6525
|
if (!r.isRevealed)
|
|
6509
6526
|
t.isRevealed && this.currentMatch.set(void 0, void 0);
|
|
6510
6527
|
else {
|
|
@@ -6515,7 +6532,7 @@ class jc extends H {
|
|
|
6515
6532
|
this._selectFromOrigin(f, this._pendingInitialDirection ?? "next");
|
|
6516
6533
|
else if (a) {
|
|
6517
6534
|
const m = this.currentMatch.get();
|
|
6518
|
-
m && !
|
|
6535
|
+
m && !Zc(f, o, r.scope, m) && this.currentMatch.set(void 0, void 0);
|
|
6519
6536
|
}
|
|
6520
6537
|
}
|
|
6521
6538
|
this._pendingInitialDirection = void 0, this._pendingInitialDirection = void 0, t = r;
|
|
@@ -6621,7 +6638,7 @@ class jc extends H {
|
|
|
6621
6638
|
t && this.searchScope.set(Zn(e.edit, t), e.transaction);
|
|
6622
6639
|
const s = this.currentMatch.get();
|
|
6623
6640
|
s && this.currentMatch.set(
|
|
6624
|
-
|
|
6641
|
+
ta(e.edit, s) ? void 0 : Zn(e.edit, s),
|
|
6625
6642
|
e.transaction
|
|
6626
6643
|
);
|
|
6627
6644
|
}
|
|
@@ -6646,13 +6663,13 @@ class jc extends H {
|
|
|
6646
6663
|
};
|
|
6647
6664
|
}
|
|
6648
6665
|
}
|
|
6649
|
-
function
|
|
6666
|
+
function Zc(n, e, t, s) {
|
|
6650
6667
|
return n.pattern.findNextMatch(e, s.start, t, !1)?.equals(s) ?? !1;
|
|
6651
6668
|
}
|
|
6652
|
-
function
|
|
6669
|
+
function Jc(n, e) {
|
|
6653
6670
|
return n.searchString === e.searchString && n.isRegex === e.isRegex && n.matchCase === e.matchCase && n.wholeWord === e.wholeWord;
|
|
6654
6671
|
}
|
|
6655
|
-
function
|
|
6672
|
+
function ea(n, e) {
|
|
6656
6673
|
return n === e || !!n && !!e && n.equals(e);
|
|
6657
6674
|
}
|
|
6658
6675
|
function Zn(n, e) {
|
|
@@ -6673,7 +6690,7 @@ function Ft(n, e, t) {
|
|
|
6673
6690
|
}
|
|
6674
6691
|
return e + s;
|
|
6675
6692
|
}
|
|
6676
|
-
function
|
|
6693
|
+
function ta(n, e) {
|
|
6677
6694
|
return n.replacements.some((t) => {
|
|
6678
6695
|
const s = t.replaceRange;
|
|
6679
6696
|
return s.isEmpty ? e.start < s.start && s.start < e.endExclusive : e.isEmpty ? s.contains(e.start) : s.intersects(e);
|
|
@@ -6682,7 +6699,7 @@ function ea(n, e) {
|
|
|
6682
6699
|
function St(n, e, t) {
|
|
6683
6700
|
return Math.min(Math.max(n, e), t);
|
|
6684
6701
|
}
|
|
6685
|
-
class
|
|
6702
|
+
class na extends H {
|
|
6686
6703
|
constructor(e, t) {
|
|
6687
6704
|
super(), this._view = e, this._options = t, this.element = document.createElement("div"), this.element.className = "md-find-widget-host", this.element.hidden = !0, this.panelElement = document.createElement("div"), this.panelElement.className = "md-find-widget", this.panelElement.setAttribute("role", "dialog"), this.panelElement.setAttribute("aria-label", "Find"), this.element.appendChild(this.panelElement);
|
|
6688
6705
|
const s = document.createElement("div");
|
|
@@ -6754,16 +6771,16 @@ function Ue(n, e) {
|
|
|
6754
6771
|
function Ye(n, e) {
|
|
6755
6772
|
n.setAttribute("aria-pressed", String(e)), n.classList.toggle("md-find-option-active", e);
|
|
6756
6773
|
}
|
|
6757
|
-
class
|
|
6774
|
+
class sa extends H {
|
|
6758
6775
|
constructor(e, t, s) {
|
|
6759
|
-
super(), this._editorModel = e, this._view = t, this._options = s, this._observedSourceTextId = this._editorModel.getSourceTextId(this._editorModel.sourceText.get()), this._sourceEditTracker = new ui(this._editorModel), this.model = this._register(new
|
|
6776
|
+
super(), this._editorModel = e, this._view = t, this._options = s, this._observedSourceTextId = this._editorModel.getSourceTextId(this._editorModel.sourceText.get()), this._sourceEditTracker = new ui(this._editorModel), this.model = this._register(new Qc(this._editorModel)), this._register(this._editorModel.onWillApplySourceEdit((c) => {
|
|
6760
6777
|
this._sourceEditTracker.record(c);
|
|
6761
6778
|
}));
|
|
6762
6779
|
const i = B(this, (c) => {
|
|
6763
6780
|
const a = this._selectionForScope.read(c);
|
|
6764
6781
|
return !!a && !a.isCollapsed;
|
|
6765
6782
|
});
|
|
6766
|
-
this.widget = this._register(new
|
|
6783
|
+
this.widget = this._register(new na(this._view, {
|
|
6767
6784
|
findModel: this.model,
|
|
6768
6785
|
canFindInSelection: i,
|
|
6769
6786
|
onNext: () => {
|
|
@@ -6774,7 +6791,7 @@ class na extends H {
|
|
|
6774
6791
|
},
|
|
6775
6792
|
onToggleFindInSelection: () => this._toggleFindInSelection(),
|
|
6776
6793
|
onClose: () => this.close()
|
|
6777
|
-
})), this._register(new
|
|
6794
|
+
})), this._register(new Kc(this._view, this.model));
|
|
6778
6795
|
const o = (c) => this._handleKeyDown(c);
|
|
6779
6796
|
this._view.element.addEventListener("keydown", o, !0), this._register({
|
|
6780
6797
|
dispose: () => this._view.element.removeEventListener("keydown", o, !0)
|
|
@@ -6799,7 +6816,7 @@ class na extends H {
|
|
|
6799
6816
|
}
|
|
6800
6817
|
const g = !this._selectedMatch?.equals(h);
|
|
6801
6818
|
let _ = /* @__PURE__ */ new Set();
|
|
6802
|
-
this._forcedMatch?.equals(h) ? _ = new Set(Rt(f, h.start, h.endExclusive)) : (m ?
|
|
6819
|
+
this._forcedMatch?.equals(h) ? _ = new Set(Rt(f, h.start, h.endExclusive)) : (m ? oa(m, h) : !1) ? this._forcedMatch = void 0 : (_ = new Set(Rt(f, h.start, h.endExclusive)), this._forcedMatch = h), ee((p) => {
|
|
6803
6820
|
Jn(this._view.forcedMarkerVisibleBlocks.get(), _) || this._view.forcedMarkerVisibleBlocks.set(_, p);
|
|
6804
6821
|
const v = this._editorModel.selection.get();
|
|
6805
6822
|
g && !d && (!v || !v.range.equals(h)) && (this._editorModel.pendingParagraph.set(void 0, p), this._editorModel.selectionSource.set("find", p), this._editorModel.selection.set(new k(h.start, h.endExclusive), p));
|
|
@@ -6843,7 +6860,7 @@ class na extends H {
|
|
|
6843
6860
|
return;
|
|
6844
6861
|
const t = e.target, s = t instanceof Node && this.widget.panelElement.contains(t);
|
|
6845
6862
|
if (!(t !== this._view.element && !s)) {
|
|
6846
|
-
if (
|
|
6863
|
+
if (ia(e, this._options.keyboardPlatform)) {
|
|
6847
6864
|
Mt(e), this.openAndFocus();
|
|
6848
6865
|
return;
|
|
6849
6866
|
}
|
|
@@ -6901,7 +6918,7 @@ class na extends H {
|
|
|
6901
6918
|
!e || e.isCollapsed || (this.model.setSearchOrigin(e.range.start), this.model.setSearchScope(e.range));
|
|
6902
6919
|
}
|
|
6903
6920
|
}
|
|
6904
|
-
function
|
|
6921
|
+
function ia(n, e) {
|
|
6905
6922
|
return n.key.toLowerCase() === "f" && !n.shiftKey && !n.altKey && (e === "macos" ? n.metaKey && !n.ctrlKey : n.ctrlKey && !n.metaKey);
|
|
6906
6923
|
}
|
|
6907
6924
|
function Mt(n) {
|
|
@@ -6910,7 +6927,7 @@ function Mt(n) {
|
|
|
6910
6927
|
function Jn(n, e) {
|
|
6911
6928
|
return n.size === e.size && Array.from(n).every((t) => e.has(t));
|
|
6912
6929
|
}
|
|
6913
|
-
function
|
|
6930
|
+
function oa(n, e) {
|
|
6914
6931
|
const t = pt(n, [e]);
|
|
6915
6932
|
return e.isEmpty ? t.some((i) => es(i.range)) : t.reduce((i, o) => {
|
|
6916
6933
|
const r = Array.from(o.range.getClientRects()).some((c) => c.width > 0 && c.height > 0) && es(o.range);
|
|
@@ -6929,7 +6946,7 @@ function es(n) {
|
|
|
6929
6946
|
}
|
|
6930
6947
|
return !0;
|
|
6931
6948
|
}
|
|
6932
|
-
class
|
|
6949
|
+
class ra {
|
|
6933
6950
|
connect(e) {
|
|
6934
6951
|
const t = (r) => {
|
|
6935
6952
|
if (Je(r.target, e.element))
|
|
@@ -6965,7 +6982,7 @@ class kl {
|
|
|
6965
6982
|
return;
|
|
6966
6983
|
const r = Je(i.target, e.element);
|
|
6967
6984
|
if (r) {
|
|
6968
|
-
|
|
6985
|
+
ca(i, r, this._clipboard);
|
|
6969
6986
|
return;
|
|
6970
6987
|
}
|
|
6971
6988
|
switch (i.key.toLowerCase()) {
|
|
@@ -7000,7 +7017,7 @@ function Je(n, e) {
|
|
|
7000
7017
|
const s = (n instanceof Element ? n : n.parentElement)?.closest('input, textarea, [contenteditable]:not([contenteditable="false"]), [role="textbox"]');
|
|
7001
7018
|
return s instanceof HTMLElement && e.contains(s) ? s : void 0;
|
|
7002
7019
|
}
|
|
7003
|
-
function
|
|
7020
|
+
function ca(n, e, t) {
|
|
7004
7021
|
switch (n.key.toLowerCase()) {
|
|
7005
7022
|
case "c": {
|
|
7006
7023
|
const s = ts(e);
|
|
@@ -7068,7 +7085,7 @@ const Vt = {
|
|
|
7068
7085
|
...e,
|
|
7069
7086
|
action: n.action
|
|
7070
7087
|
})))
|
|
7071
|
-
},
|
|
7088
|
+
}, aa = /* @__PURE__ */ new Set([
|
|
7072
7089
|
"ArrowLeft",
|
|
7073
7090
|
"ArrowRight",
|
|
7074
7091
|
"ArrowUp",
|
|
@@ -7076,10 +7093,10 @@ const Vt = {
|
|
|
7076
7093
|
"Home",
|
|
7077
7094
|
"End"
|
|
7078
7095
|
]);
|
|
7079
|
-
function aa(n) {
|
|
7080
|
-
return ca.has(n);
|
|
7081
|
-
}
|
|
7082
7096
|
function la(n) {
|
|
7097
|
+
return aa.has(n);
|
|
7098
|
+
}
|
|
7099
|
+
function da(n) {
|
|
7083
7100
|
return n.includes("Macintosh") || n.includes("Mac OS X") ? "macos" : n.includes("Windows") ? "windows" : "linux";
|
|
7084
7101
|
}
|
|
7085
7102
|
function ss(n) {
|
|
@@ -7096,23 +7113,23 @@ function ss(n) {
|
|
|
7096
7113
|
function is(n, e, t = Vt) {
|
|
7097
7114
|
if (n.altGraphKey)
|
|
7098
7115
|
return;
|
|
7099
|
-
const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 :
|
|
7116
|
+
const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 : ha(n.code);
|
|
7100
7117
|
for (const o of t.bindings)
|
|
7101
|
-
if ((o.key === s || o.key === i) && (!o.platforms || o.platforms.includes(e)) &&
|
|
7118
|
+
if ((o.key === s || o.key === i) && (!o.platforms || o.platforms.includes(e)) && ua(n, o.modifiers))
|
|
7102
7119
|
return o.action;
|
|
7103
7120
|
}
|
|
7104
|
-
function
|
|
7121
|
+
function ha(n) {
|
|
7105
7122
|
return /^Key([A-Z])$/.exec(n)?.[1].toLowerCase();
|
|
7106
7123
|
}
|
|
7107
|
-
function
|
|
7124
|
+
function ua(n, e = {}) {
|
|
7108
7125
|
return n.shiftKey === !!e.shift && n.altKey === !!e.alt && n.ctrlKey === !!e.ctrl && n.metaKey === !!e.meta;
|
|
7109
7126
|
}
|
|
7110
|
-
const
|
|
7127
|
+
const fa = 500, os = 5;
|
|
7111
7128
|
class El extends H {
|
|
7112
7129
|
constructor(e, t, s) {
|
|
7113
7130
|
super(), this._model = e, this._view = t;
|
|
7114
7131
|
const i = this._view.element, o = i.ownerDocument.defaultView ?? window;
|
|
7115
|
-
this._keyboardPlatform = s?.keyboardPlatform ??
|
|
7132
|
+
this._keyboardPlatform = s?.keyboardPlatform ?? da(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? Vt, this._forwardedKeyboardProfile = s?.forwardedKeyboardProfile, this._historyStrategy = s?.historyStrategy, this._indentation = s?.indentation ?? Fe, this._tabFocusStatus = this._keyboardProfile === Vt ? this._registerTabFocusAccessibility(i) : void 0, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
|
|
7116
7133
|
dispose: () => {
|
|
7117
7134
|
i.removeEventListener("pointerdown", this._handlePointerDown), i.removeEventListener("keydown", this._handleKeyDown);
|
|
7118
7135
|
}
|
|
@@ -7121,19 +7138,19 @@ class El extends H {
|
|
|
7121
7138
|
o.removeEventListener("keydown", this._updateModifierState), o.removeEventListener("keyup", this._updateModifierState), o.removeEventListener("blur", this._clearModifierState), i.ownerDocument.removeEventListener("selectionchange", this._discardNativeSelection);
|
|
7122
7139
|
}
|
|
7123
7140
|
});
|
|
7124
|
-
const r = s?.clipboardStrategy ?? new
|
|
7141
|
+
const r = s?.clipboardStrategy ?? new ra();
|
|
7125
7142
|
this._register(r.connect({
|
|
7126
7143
|
element: i,
|
|
7127
7144
|
getSelectedText: () => this._selectedText(),
|
|
7128
7145
|
deleteSelection: () => this._executeEditCommand(hn),
|
|
7129
7146
|
insertText: (a) => {
|
|
7130
|
-
this._handlePendingInput(a) || this._executeEditCommand(
|
|
7147
|
+
this._handlePendingInput(a) || this._executeEditCommand(zo(a));
|
|
7131
7148
|
}
|
|
7132
7149
|
}));
|
|
7133
7150
|
const c = this._view.editContext;
|
|
7134
7151
|
c.addEventListener("textupdate", this._handleTextUpdate), this._register({
|
|
7135
7152
|
dispose: () => c.removeEventListener("textupdate", this._handleTextUpdate)
|
|
7136
|
-
}), this.findController = s?.find === !1 ? void 0 : this._register(new
|
|
7153
|
+
}), this.findController = s?.find === !1 ? void 0 : this._register(new sa(this._model, this._view, {
|
|
7137
7154
|
keyboardPlatform: this._keyboardPlatform
|
|
7138
7155
|
}));
|
|
7139
7156
|
}
|
|
@@ -7184,7 +7201,7 @@ class El extends H {
|
|
|
7184
7201
|
if (e.button !== 0)
|
|
7185
7202
|
return;
|
|
7186
7203
|
e.preventDefault(), this._model.cancelPendingParagraph(), this._view.focus(), this._desiredColumn = void 0;
|
|
7187
|
-
const t = new fe(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time <
|
|
7204
|
+
const t = new fe(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time < fa && Math.abs(t.x - s.point.x) < os && Math.abs(t.y - s.point.y) < os;
|
|
7188
7205
|
if (this._clickCount = i ? this._clickCount + 1 : 1, this._lastPointerDown = { time: e.timeStamp, point: t }, !this._view.isPointInContent(t)) {
|
|
7189
7206
|
this._setUserSelection(void 0);
|
|
7190
7207
|
return;
|
|
@@ -7192,12 +7209,12 @@ class El extends H {
|
|
|
7192
7209
|
const o = this._view.resolveOffsetFromPoint(t) ?? this._model.sourceText.get().value.length;
|
|
7193
7210
|
if (this._clickCount === 2) {
|
|
7194
7211
|
const u = this._makeCursorContext();
|
|
7195
|
-
this._setUserSelection(
|
|
7212
|
+
this._setUserSelection(fr(u, o));
|
|
7196
7213
|
return;
|
|
7197
7214
|
}
|
|
7198
7215
|
if (this._clickCount === 3) {
|
|
7199
|
-
const u =
|
|
7200
|
-
u && this._setUserSelection(
|
|
7216
|
+
const u = ga(this._model.document.get(), o);
|
|
7217
|
+
u && this._setUserSelection(mr(this._makeCursorContext(), u));
|
|
7201
7218
|
return;
|
|
7202
7219
|
}
|
|
7203
7220
|
const r = this._clickCount === 1 && !e.shiftKey && this._model.readonlyMode.get();
|
|
@@ -7256,7 +7273,7 @@ class El extends H {
|
|
|
7256
7273
|
this._applyCursorPosition(s.selection, i.position, t), this._desiredColumn = i.desiredColumn;
|
|
7257
7274
|
}
|
|
7258
7275
|
_cursorDown(e) {
|
|
7259
|
-
const t = this._makeVisualCursorContext(), s =
|
|
7276
|
+
const t = this._makeVisualCursorContext(), s = Ao(t);
|
|
7260
7277
|
if (!e && !this._model.readonlyMode.get() && !t.lineMap.isEmpty && t.cursorPosition.kind === "source" && s.position.kind === "source" && s.position.offset === t.selection.active) {
|
|
7261
7278
|
const i = Ve(t);
|
|
7262
7279
|
if (i) {
|
|
@@ -7325,10 +7342,16 @@ class El extends H {
|
|
|
7325
7342
|
if (!this._view.element.contains(e.activeElement))
|
|
7326
7343
|
return;
|
|
7327
7344
|
const t = e.getSelection();
|
|
7328
|
-
!t || t.rangeCount === 0 || t.isCollapsed
|
|
7345
|
+
if (!(!t || t.rangeCount === 0 || t.isCollapsed)) {
|
|
7346
|
+
for (let s = 0; s < t.rangeCount; s++)
|
|
7347
|
+
if (this._view.intersectsRenderedContent(t.getRangeAt(s))) {
|
|
7348
|
+
t.removeAllRanges();
|
|
7349
|
+
return;
|
|
7350
|
+
}
|
|
7351
|
+
}
|
|
7329
7352
|
};
|
|
7330
7353
|
_handleKeyDown = (e) => {
|
|
7331
|
-
if (e.isComposing ||
|
|
7354
|
+
if (e.isComposing || ma(e, this._view.element) || (this._updateModifierState(e), e.key === "Tab" && (this._model.readonlyMode.get() || this._tabMovesFocus)))
|
|
7332
7355
|
return;
|
|
7333
7356
|
if (this._model.pendingParagraph.get() !== void 0 && e.key === "Escape") {
|
|
7334
7357
|
rs(e), this._model.cancelPendingParagraph();
|
|
@@ -7348,7 +7371,7 @@ class El extends H {
|
|
|
7348
7371
|
e.preventDefault();
|
|
7349
7372
|
return;
|
|
7350
7373
|
}
|
|
7351
|
-
|
|
7374
|
+
la(e.key) && e.preventDefault();
|
|
7352
7375
|
return;
|
|
7353
7376
|
}
|
|
7354
7377
|
const s = this._model.pendingParagraph.get() !== void 0;
|
|
@@ -7363,10 +7386,10 @@ class El extends H {
|
|
|
7363
7386
|
const t = e.command;
|
|
7364
7387
|
switch (t) {
|
|
7365
7388
|
case "left":
|
|
7366
|
-
this._executeCursorCommand(e.extend ?
|
|
7389
|
+
this._executeCursorCommand(e.extend ? To : Lo, e.extend);
|
|
7367
7390
|
return;
|
|
7368
7391
|
case "right":
|
|
7369
|
-
this._executeCursorCommand(e.extend ?
|
|
7392
|
+
this._executeCursorCommand(e.extend ? Mo : So, e.extend);
|
|
7370
7393
|
return;
|
|
7371
7394
|
case "up":
|
|
7372
7395
|
this._executeVisualCursorCommand(dn, e.extend);
|
|
@@ -7375,16 +7398,16 @@ class El extends H {
|
|
|
7375
7398
|
this._cursorDown(e.extend);
|
|
7376
7399
|
return;
|
|
7377
7400
|
case "wordLeft":
|
|
7378
|
-
this._executeCursorCommand(
|
|
7401
|
+
this._executeCursorCommand(Ro, e.extend);
|
|
7379
7402
|
return;
|
|
7380
7403
|
case "wordRight":
|
|
7381
|
-
this._executeCursorCommand(
|
|
7404
|
+
this._executeCursorCommand(Oo, e.extend);
|
|
7382
7405
|
return;
|
|
7383
7406
|
case "visualLineStart":
|
|
7384
|
-
this._executeVisualCursorCommand(
|
|
7407
|
+
this._executeVisualCursorCommand(Bo, e.extend);
|
|
7385
7408
|
return;
|
|
7386
7409
|
case "visualLineEnd":
|
|
7387
|
-
this._executeVisualCursorCommand(
|
|
7410
|
+
this._executeVisualCursorCommand(Po, e.extend);
|
|
7388
7411
|
return;
|
|
7389
7412
|
case "logicalLineStart":
|
|
7390
7413
|
this._executeCursorCommand(Nt, e.extend);
|
|
@@ -7393,10 +7416,10 @@ class El extends H {
|
|
|
7393
7416
|
this._executeCursorCommand(It, e.extend);
|
|
7394
7417
|
return;
|
|
7395
7418
|
case "documentStart":
|
|
7396
|
-
this._executeCursorCommand(
|
|
7419
|
+
this._executeCursorCommand(No, e.extend);
|
|
7397
7420
|
return;
|
|
7398
7421
|
case "documentEnd":
|
|
7399
|
-
this._executeCursorCommand(
|
|
7422
|
+
this._executeCursorCommand(Io, e.extend);
|
|
7400
7423
|
return;
|
|
7401
7424
|
default:
|
|
7402
7425
|
return ke(t);
|
|
@@ -7417,19 +7440,19 @@ class El extends H {
|
|
|
7417
7440
|
this._executeEditCommand(hn);
|
|
7418
7441
|
return;
|
|
7419
7442
|
case "deleteRight":
|
|
7420
|
-
this._executeEditCommand(
|
|
7443
|
+
this._executeEditCommand(Vo);
|
|
7421
7444
|
return;
|
|
7422
7445
|
case "deleteWordLeft":
|
|
7423
|
-
this._executeEditCommand(
|
|
7446
|
+
this._executeEditCommand($o);
|
|
7424
7447
|
return;
|
|
7425
7448
|
case "deleteWordRight":
|
|
7426
|
-
this._executeEditCommand(
|
|
7449
|
+
this._executeEditCommand(Ho);
|
|
7427
7450
|
return;
|
|
7428
7451
|
case "deleteLineLeft":
|
|
7429
|
-
this._executeEditCommand(
|
|
7452
|
+
this._executeEditCommand(Wo);
|
|
7430
7453
|
return;
|
|
7431
7454
|
case "deleteLineRight":
|
|
7432
|
-
this._executeEditCommand(
|
|
7455
|
+
this._executeEditCommand(Ko);
|
|
7433
7456
|
return;
|
|
7434
7457
|
default:
|
|
7435
7458
|
return ke(t);
|
|
@@ -7437,7 +7460,7 @@ class El extends H {
|
|
|
7437
7460
|
}
|
|
7438
7461
|
case "selectAll": {
|
|
7439
7462
|
const t = this._makeCursorContext();
|
|
7440
|
-
this._setUserSelection(
|
|
7463
|
+
this._setUserSelection(ur(t));
|
|
7441
7464
|
return;
|
|
7442
7465
|
}
|
|
7443
7466
|
case "history": {
|
|
@@ -7475,10 +7498,10 @@ class El extends H {
|
|
|
7475
7498
|
const s = e.command;
|
|
7476
7499
|
switch (s) {
|
|
7477
7500
|
case "insert":
|
|
7478
|
-
this._executeEditCommand(
|
|
7501
|
+
this._executeEditCommand(qo(this._indentation));
|
|
7479
7502
|
return;
|
|
7480
7503
|
case "outdent":
|
|
7481
|
-
this._executeEditCommand(
|
|
7504
|
+
this._executeEditCommand(Go(this._indentation));
|
|
7482
7505
|
return;
|
|
7483
7506
|
default:
|
|
7484
7507
|
return ke(s);
|
|
@@ -7503,10 +7526,10 @@ class El extends H {
|
|
|
7503
7526
|
this._smartEnter();
|
|
7504
7527
|
return;
|
|
7505
7528
|
case "insertParagraph":
|
|
7506
|
-
this._executeEditCommand(
|
|
7529
|
+
this._executeEditCommand(Xo);
|
|
7507
7530
|
return;
|
|
7508
7531
|
case "insertHardLineBreak":
|
|
7509
|
-
this._executeEditCommand(
|
|
7532
|
+
this._executeEditCommand(Yo);
|
|
7510
7533
|
return;
|
|
7511
7534
|
default:
|
|
7512
7535
|
return ke(t);
|
|
@@ -7525,7 +7548,7 @@ class El extends H {
|
|
|
7525
7548
|
this._view.showReadonlyEditingAttempt();
|
|
7526
7549
|
return;
|
|
7527
7550
|
}
|
|
7528
|
-
const e = this._makeCursorContext(), t =
|
|
7551
|
+
const e = this._makeCursorContext(), t = jo(e);
|
|
7529
7552
|
t.kind === "edit" ? this._runUndoableEdit(() => this._model.applyEdit(t.edit, t.selection), t.edit) : this._model.armPendingParagraph({
|
|
7530
7553
|
anchorBlock: t.anchorBlock,
|
|
7531
7554
|
replaceRange: t.replaceRange,
|
|
@@ -7550,10 +7573,10 @@ function ke(n) {
|
|
|
7550
7573
|
function rs(n) {
|
|
7551
7574
|
n.preventDefault(), n.stopPropagation();
|
|
7552
7575
|
}
|
|
7553
|
-
function
|
|
7576
|
+
function ma(n, e) {
|
|
7554
7577
|
return n.target !== e;
|
|
7555
7578
|
}
|
|
7556
|
-
function
|
|
7579
|
+
function ga(n, e) {
|
|
7557
7580
|
const t = new Set(n.blocks);
|
|
7558
7581
|
let s = 0;
|
|
7559
7582
|
for (const i of n.children) {
|
|
@@ -7568,7 +7591,7 @@ function ma(n, e) {
|
|
|
7568
7591
|
function cs(n, e, t) {
|
|
7569
7592
|
t === null ? n.removeAttribute(e) : n.setAttribute(e, t);
|
|
7570
7593
|
}
|
|
7571
|
-
const
|
|
7594
|
+
const pa = 200;
|
|
7572
7595
|
class Cl {
|
|
7573
7596
|
constructor(e) {
|
|
7574
7597
|
this._model = e, this._lastKnownText = e.sourceText.get().value;
|
|
@@ -7595,7 +7618,7 @@ class Cl {
|
|
|
7595
7618
|
redoEdit: c,
|
|
7596
7619
|
beforeSelection: i,
|
|
7597
7620
|
afterSelection: r
|
|
7598
|
-
}), this._past.length >
|
|
7621
|
+
}), this._past.length > pa && this._past.shift(), this._future.length = 0;
|
|
7599
7622
|
}
|
|
7600
7623
|
undo() {
|
|
7601
7624
|
const e = this._peekApplicable(this._past);
|
|
@@ -7628,7 +7651,7 @@ class Cl {
|
|
|
7628
7651
|
}
|
|
7629
7652
|
}
|
|
7630
7653
|
const as = "md-debug-show-line-rects";
|
|
7631
|
-
function
|
|
7654
|
+
function _a(n, e) {
|
|
7632
7655
|
try {
|
|
7633
7656
|
const t = localStorage.getItem(n);
|
|
7634
7657
|
return t === null ? e : t === "true";
|
|
@@ -7636,7 +7659,7 @@ function pa(n, e) {
|
|
|
7636
7659
|
return e;
|
|
7637
7660
|
}
|
|
7638
7661
|
}
|
|
7639
|
-
function
|
|
7662
|
+
function va(n, e) {
|
|
7640
7663
|
try {
|
|
7641
7664
|
localStorage.setItem(n, String(e));
|
|
7642
7665
|
} catch {
|
|
@@ -7649,7 +7672,7 @@ class Sl extends H {
|
|
|
7649
7672
|
/** Absolute source offsets that map to a rendered DOM character. */
|
|
7650
7673
|
mappedOffsets;
|
|
7651
7674
|
/** Whether the dashed line-bands and run boxes are drawn (persisted). */
|
|
7652
|
-
_showLineRects = C(this,
|
|
7675
|
+
_showLineRects = C(this, _a(as, !0));
|
|
7653
7676
|
constructor(e, t) {
|
|
7654
7677
|
super(), this.overlayElement = document.createElement("div"), this.overlayElement.className = "md-debug-layout-overlay", Object.assign(this.overlayElement.style, {
|
|
7655
7678
|
position: "absolute",
|
|
@@ -7678,12 +7701,12 @@ class Sl extends H {
|
|
|
7678
7701
|
});
|
|
7679
7702
|
const i = document.createElement("input");
|
|
7680
7703
|
i.type = "checkbox", i.checked = this._showLineRects.get(), i.addEventListener("change", () => {
|
|
7681
|
-
this._showLineRects.set(i.checked, void 0),
|
|
7704
|
+
this._showLineRects.set(i.checked, void 0), va(as, i.checked);
|
|
7682
7705
|
}), s.appendChild(i), s.appendChild(document.createTextNode("show line rects")), this.infoElement.appendChild(s);
|
|
7683
7706
|
const o = document.createElement("pre");
|
|
7684
7707
|
o.style.margin = "0", o.style.whiteSpace = "pre", this.infoElement.appendChild(o), this.rendering = B(this, (r) => {
|
|
7685
7708
|
const c = r.readObservable(t.model.measurements), a = r.readObservable(this._showLineRects);
|
|
7686
|
-
return
|
|
7709
|
+
return ba(
|
|
7687
7710
|
this.overlayElement,
|
|
7688
7711
|
o,
|
|
7689
7712
|
c,
|
|
@@ -7695,16 +7718,16 @@ class Sl extends H {
|
|
|
7695
7718
|
}), this.mappedOffsets = B(this, (r) => r.readObservable(this.rendering).mappedOffsets), this._register(P((r) => {
|
|
7696
7719
|
r.readObservable(this.rendering);
|
|
7697
7720
|
const c = t.hoveredOffset ? r.readObservable(t.hoveredOffset) : void 0;
|
|
7698
|
-
t.hoveredOffset &&
|
|
7721
|
+
t.hoveredOffset && ya(this.overlayElement, c);
|
|
7699
7722
|
}));
|
|
7700
7723
|
}
|
|
7701
7724
|
}
|
|
7702
|
-
class
|
|
7725
|
+
class wa {
|
|
7703
7726
|
constructor(e, t, s, i) {
|
|
7704
7727
|
this.blockCount = e, this.mountedCount = t, this.lineCount = s, this.mappedOffsets = i;
|
|
7705
7728
|
}
|
|
7706
7729
|
}
|
|
7707
|
-
function
|
|
7730
|
+
function ba(n, e, t, s, i, o, r) {
|
|
7708
7731
|
n.textContent = "";
|
|
7709
7732
|
const c = s.capture();
|
|
7710
7733
|
let a = 0, l = 0, d = 0;
|
|
@@ -7736,16 +7759,16 @@ function wa(n, e, t, s, i, o, r) {
|
|
|
7736
7759
|
}), n.appendChild(T);
|
|
7737
7760
|
}
|
|
7738
7761
|
}
|
|
7739
|
-
g.viewNode && (d +=
|
|
7762
|
+
g.viewNode && (d += ka(n, c, g.viewNode, g.absoluteStart, u, o, r));
|
|
7740
7763
|
}
|
|
7741
7764
|
const h = `blocks: ${t.length} mounted: ${a} lines: ${l} chars: ${d}`, f = t.map((m, g) => {
|
|
7742
7765
|
const _ = m.isMeasured ? "M" : "e", p = m.visualLineMap?.lines.length ?? 0;
|
|
7743
7766
|
return `${String(g).padStart(2)} ${_} start=${String(m.absoluteStart).padStart(4)} h=${m.height.toFixed(1).padStart(6)} lines=${p} kind=${m.block.kind}`;
|
|
7744
7767
|
});
|
|
7745
7768
|
return e.textContent = [h, ...f].join(`
|
|
7746
|
-
`), new
|
|
7769
|
+
`), new wa(t.length, a, l, u);
|
|
7747
7770
|
}
|
|
7748
|
-
function
|
|
7771
|
+
function ka(n, e, t, s, i, o, r) {
|
|
7749
7772
|
let c = 0;
|
|
7750
7773
|
const a = document.createRange(), l = s + t.sourceLength, d = [];
|
|
7751
7774
|
t.forEachTextLeaf(s, (h, f) => {
|
|
@@ -7778,7 +7801,7 @@ function ba(n, e, t, s, i, o, r) {
|
|
|
7778
7801
|
}
|
|
7779
7802
|
return c;
|
|
7780
7803
|
}
|
|
7781
|
-
function
|
|
7804
|
+
function ya(n, e) {
|
|
7782
7805
|
for (const t of Array.from(n.children)) {
|
|
7783
7806
|
if (!t.style)
|
|
7784
7807
|
continue;
|
|
@@ -7795,7 +7818,7 @@ class Be {
|
|
|
7795
7818
|
this.length = e, this.className = t;
|
|
7796
7819
|
}
|
|
7797
7820
|
}
|
|
7798
|
-
class
|
|
7821
|
+
class xa {
|
|
7799
7822
|
/**
|
|
7800
7823
|
* @param _monaco The Monarch runtime ({@link IMonarchApi}), injected so this
|
|
7801
7824
|
* package depends on `monaco-editor` for types only.
|
|
@@ -7806,7 +7829,7 @@ class ya {
|
|
|
7806
7829
|
}
|
|
7807
7830
|
_tokenizers = /* @__PURE__ */ new Map();
|
|
7808
7831
|
create(e, t) {
|
|
7809
|
-
return new
|
|
7832
|
+
return new Ea(this._tokenizerFor(e), t);
|
|
7810
7833
|
}
|
|
7811
7834
|
dispose() {
|
|
7812
7835
|
for (const e of this._tokenizers.values())
|
|
@@ -7818,10 +7841,10 @@ class ya {
|
|
|
7818
7841
|
if (t === void 0)
|
|
7819
7842
|
return;
|
|
7820
7843
|
let s = this._tokenizers.get(e);
|
|
7821
|
-
return s || (s = new this._monaco.MonarchTokenizer(
|
|
7844
|
+
return s || (s = new this._monaco.MonarchTokenizer(Ma, Ta, e, this._monaco.compile(e, t), Oa), this._tokenizers.set(e, s)), s;
|
|
7822
7845
|
}
|
|
7823
7846
|
}
|
|
7824
|
-
class
|
|
7847
|
+
class Ea {
|
|
7825
7848
|
constructor(e, t) {
|
|
7826
7849
|
this._tokenizer = e, this._initialState = e?.getInitialState(), this._text = t, this._lines = this._tokenizeFrom(0, [], this._initialState, t.split(`
|
|
7827
7850
|
`)), this._lineStarts = this._computeLineStarts(), this._snapshotObs = C("syntaxSnapshot", new ds(this, this._version));
|
|
@@ -7845,7 +7868,7 @@ class xa {
|
|
|
7845
7868
|
const s = hs(this._lines), i = e.apply(this._text), o = e.replacements[0].replaceRange.start, r = this._lineIndexAt(o), c = this._lines.slice(0, r), a = r === 0 ? this._initialState : this._lines[r - 1].endState;
|
|
7846
7869
|
this._text = i, this._lines = this._tokenizeFrom(r, c, a, i.split(`
|
|
7847
7870
|
`)), this._lineStarts = this._computeLineStarts(), this._version++;
|
|
7848
|
-
const l =
|
|
7871
|
+
const l = La(s, hs(this._lines));
|
|
7849
7872
|
this._snapshotObs.set(new ds(this, this._version), t, l);
|
|
7850
7873
|
}
|
|
7851
7874
|
dispose() {
|
|
@@ -7863,7 +7886,7 @@ class xa {
|
|
|
7863
7886
|
const a = i[c], l = c < i.length - 1;
|
|
7864
7887
|
if (this._tokenizer && r) {
|
|
7865
7888
|
const d = this._tokenizer.tokenize(a, l, r);
|
|
7866
|
-
o.push({ text: a, tokens:
|
|
7889
|
+
o.push({ text: a, tokens: Sa(d.tokens, a.length), endState: d.endState }), r = d.endState;
|
|
7867
7890
|
} else
|
|
7868
7891
|
o.push({ text: a, tokens: a.length === 0 ? [] : [new Be(a.length, void 0)], endState: r });
|
|
7869
7892
|
}
|
|
@@ -7908,16 +7931,16 @@ class ds {
|
|
|
7908
7931
|
return this._doc._getTokens(this._version, e);
|
|
7909
7932
|
}
|
|
7910
7933
|
}
|
|
7911
|
-
function
|
|
7934
|
+
function Ca(n) {
|
|
7912
7935
|
return n === "" ? void 0 : n;
|
|
7913
7936
|
}
|
|
7914
|
-
function
|
|
7937
|
+
function Sa(n, e) {
|
|
7915
7938
|
if (n.length === 0)
|
|
7916
7939
|
return e === 0 ? [] : [new Be(e, void 0)];
|
|
7917
7940
|
const t = [];
|
|
7918
7941
|
for (let s = 0; s < n.length; s++) {
|
|
7919
7942
|
const i = n[s].offset, o = s + 1 < n.length ? n[s + 1].offset : e;
|
|
7920
|
-
o > i && t.push(new Be(o - i,
|
|
7943
|
+
o > i && t.push(new Be(o - i, Ca(n[s].type)));
|
|
7921
7944
|
}
|
|
7922
7945
|
return t;
|
|
7923
7946
|
}
|
|
@@ -7939,7 +7962,7 @@ function fs(n) {
|
|
|
7939
7962
|
e += t.length;
|
|
7940
7963
|
return e;
|
|
7941
7964
|
}
|
|
7942
|
-
function
|
|
7965
|
+
function La(n, e) {
|
|
7943
7966
|
const t = n.length, s = e.length;
|
|
7944
7967
|
let i = 0, o = 0;
|
|
7945
7968
|
for (; i < t && i < s && us(n[i], e[i]); )
|
|
@@ -7950,16 +7973,16 @@ function Sa(n, e) {
|
|
|
7950
7973
|
const a = fs(n), l = fs(e), d = new w(o, a - c), u = l - c - o;
|
|
7951
7974
|
return d.isEmpty && u === 0 ? Ee.empty : Ee.replace(d, u);
|
|
7952
7975
|
}
|
|
7953
|
-
const
|
|
7976
|
+
const Ma = {
|
|
7954
7977
|
languageIdCodec: { encodeLanguageId: () => 0, decodeLanguageId: () => "" },
|
|
7955
7978
|
isRegisteredLanguageId: () => !1,
|
|
7956
7979
|
getLanguageIdByLanguageName: () => null,
|
|
7957
7980
|
getLanguageIdByMimeType: () => null,
|
|
7958
7981
|
requestBasicLanguageFeatures: () => {
|
|
7959
7982
|
}
|
|
7960
|
-
}, Ma = {
|
|
7961
|
-
getColorTheme: () => ({ tokenTheme: {} })
|
|
7962
7983
|
}, Ta = {
|
|
7984
|
+
getColorTheme: () => ({ tokenTheme: {} })
|
|
7985
|
+
}, Oa = {
|
|
7963
7986
|
getValue: () => 2e4,
|
|
7964
7987
|
onDidChangeConfiguration: () => ({ dispose() {
|
|
7965
7988
|
} })
|
|
@@ -7982,14 +8005,14 @@ function Ll(n, e) {
|
|
|
7982
8005
|
["yaml", e.yaml],
|
|
7983
8006
|
["yml", e.yaml]
|
|
7984
8007
|
]);
|
|
7985
|
-
return new
|
|
8008
|
+
return new xa(n, t);
|
|
7986
8009
|
}
|
|
7987
|
-
const
|
|
7988
|
-
class
|
|
8010
|
+
const Ra = '<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M14 7v1H8v6H7V8H1V7h6V1h1v6h6z"></path></svg>';
|
|
8011
|
+
class Na extends H {
|
|
7989
8012
|
constructor(e) {
|
|
7990
8013
|
super(), this._options = e, this.element = document.createElement("div"), this.element.className = "md-comment-input", this._textarea = document.createElement("textarea"), this._textarea.className = "md-comment-input-textarea", this._textarea.rows = 1, this._textarea.placeholder = e?.placeholder ?? "Add Comment", this.element.appendChild(this._textarea), this._measure = document.createElement("span"), this._measure.className = "md-comment-input-measure", this._measure.setAttribute("aria-hidden", "true"), this.element.appendChild(this._measure);
|
|
7991
8014
|
const t = document.createElement("div");
|
|
7992
|
-
t.className = "md-comment-input-actions", this.element.appendChild(t), this._submitButton = document.createElement("button"), this._submitButton.type = "button", this._submitButton.className = "md-comment-input-submit", this._submitButton.innerHTML =
|
|
8015
|
+
t.className = "md-comment-input-actions", this.element.appendChild(t), this._submitButton = document.createElement("button"), this._submitButton.type = "button", this._submitButton.className = "md-comment-input-submit", this._submitButton.innerHTML = Ra, this._submitButton.title = "Comment", t.appendChild(this._submitButton);
|
|
7993
8016
|
const s = (c) => {
|
|
7994
8017
|
c.stopPropagation(), !(c.target === this._textarea || this._submitButton.contains(c.target)) && (c.preventDefault(), this._textarea.focus());
|
|
7995
8018
|
};
|
|
@@ -8054,7 +8077,7 @@ class Ra extends H {
|
|
|
8054
8077
|
}
|
|
8055
8078
|
class fi extends H {
|
|
8056
8079
|
constructor(e, t, s) {
|
|
8057
|
-
super(), this._model = e, this._view = t, this._options = s, this._gap = s?.gap ?? 8, this._widget = this._register(new
|
|
8080
|
+
super(), this._model = e, this._view = t, this._options = s, this._gap = s?.gap ?? 8, this._widget = this._register(new Na({
|
|
8058
8081
|
onDidChangeSize: () => {
|
|
8059
8082
|
this._visible && this._layoutHorizontally();
|
|
8060
8083
|
},
|
|
@@ -8087,7 +8110,7 @@ class fi extends H {
|
|
|
8087
8110
|
case "find":
|
|
8088
8111
|
return !1;
|
|
8089
8112
|
default:
|
|
8090
|
-
return
|
|
8113
|
+
return Ia(e);
|
|
8091
8114
|
}
|
|
8092
8115
|
}
|
|
8093
8116
|
_widget;
|
|
@@ -8186,7 +8209,7 @@ class fi extends H {
|
|
|
8186
8209
|
this._submittedRange = t, this._hideAndRefocus(), t && this._options?.onSubmit?.({ text: e, range: t });
|
|
8187
8210
|
}
|
|
8188
8211
|
}
|
|
8189
|
-
function
|
|
8212
|
+
function Ia(n) {
|
|
8190
8213
|
throw new Error(`Unhandled selection source: ${JSON.stringify(n)}`);
|
|
8191
8214
|
}
|
|
8192
8215
|
class Ml {
|
|
@@ -8230,8 +8253,8 @@ class Ml {
|
|
|
8230
8253
|
this._comments.set(this._comments.get().filter((t) => t.id !== e), void 0);
|
|
8231
8254
|
}
|
|
8232
8255
|
}
|
|
8233
|
-
const je = "http://www.w3.org/2000/svg",
|
|
8234
|
-
class
|
|
8256
|
+
const je = "http://www.w3.org/2000/svg", Ba = 260, Pa = 320, Aa = 0.32, Da = 28, ms = 16, Fa = 12, Va = 18, $a = 4, Ha = 2, Wa = 10;
|
|
8257
|
+
class Ka extends H {
|
|
8235
8258
|
constructor(e, t) {
|
|
8236
8259
|
super(), this._model = e, this._view = t, this._layer = this._createLayer("md-comment-shapes"), this._view.overlayContainer.appendChild(this._layer), this._register({
|
|
8237
8260
|
dispose: () => {
|
|
@@ -8316,7 +8339,7 @@ class Wa extends H {
|
|
|
8316
8339
|
}
|
|
8317
8340
|
_fillCard(e) {
|
|
8318
8341
|
const { comment: t } = e, s = t.author ?? "You";
|
|
8319
|
-
e.authorEl.textContent = s, e.avatarEl.textContent =
|
|
8342
|
+
e.authorEl.textContent = s, e.avatarEl.textContent = Ga(s), e.timeEl.textContent = t.createdAt !== void 0 ? Xa(t.createdAt) : "", e.bodyEl.textContent = t.body;
|
|
8320
8343
|
}
|
|
8321
8344
|
_disposeEntry(e) {
|
|
8322
8345
|
for (const t of e.disposables)
|
|
@@ -8331,20 +8354,20 @@ class Wa extends H {
|
|
|
8331
8354
|
return;
|
|
8332
8355
|
}
|
|
8333
8356
|
this._layer.style.display = "";
|
|
8334
|
-
const i = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).width, o = getComputedStyle(s), r = parseFloat(o.maxWidth), c = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0), a = (parseFloat(o.borderLeftWidth) || 0) + (parseFloat(o.borderRightWidth) || 0), l = Number.isNaN(r) ? i : o.boxSizing === "border-box" ? r : r + c + a, d = Math.max(0, (i - Math.min(l, i)) / 2), u = Math.round(Math.max(
|
|
8357
|
+
const i = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).width, o = getComputedStyle(s), r = parseFloat(o.maxWidth), c = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0), a = (parseFloat(o.borderLeftWidth) || 0) + (parseFloat(o.borderRightWidth) || 0), l = Number.isNaN(r) ? i : o.boxSizing === "border-box" ? r : r + c + a, d = Math.max(0, (i - Math.min(l, i)) / 2), u = Math.round(Math.max(Ba, Math.min(Pa, i * Aa))), h = u + Da + ms, f = d >= h ? 0 : Math.min(2 * (h - d), h), m = f > 0 ? `${Math.ceil(f)}px` : "";
|
|
8335
8358
|
t.style.paddingRight !== m && (t.style.paddingRight = m);
|
|
8336
8359
|
const _ = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).right - ms - u, p = s.clientWidth, v = e.map(({ entry: b, rects: x }) => {
|
|
8337
8360
|
b.card.style.left = `${_}px`, b.card.style.width = `${u}px`;
|
|
8338
|
-
const T =
|
|
8361
|
+
const T = za(x), V = x.length > 0 ? Math.min(...x.map((ue) => ue.y)) : 0;
|
|
8339
8362
|
return { entry: b, rects: x, anchor: T, desiredTop: V };
|
|
8340
8363
|
});
|
|
8341
8364
|
v.sort((b, x) => b.desiredTop - x.desiredTop);
|
|
8342
8365
|
let E = -1 / 0;
|
|
8343
8366
|
for (const b of v) {
|
|
8344
|
-
const x = Math.max(b.desiredTop, E +
|
|
8367
|
+
const x = Math.max(b.desiredTop, E + Fa);
|
|
8345
8368
|
b.entry.card.style.top = `${x}px`;
|
|
8346
8369
|
const T = b.entry.card.offsetHeight;
|
|
8347
|
-
E = x + T, b.entry.shapePath.setAttribute("d", ai(b.rects,
|
|
8370
|
+
E = x + T, b.entry.shapePath.setAttribute("d", ai(b.rects, $a)), b.entry.leaderPath.setAttribute("d", b.anchor ? qa(b.anchor, p, { x: _, y: x + Va }) : "");
|
|
8348
8371
|
}
|
|
8349
8372
|
}
|
|
8350
8373
|
_applyHover(e) {
|
|
@@ -8354,27 +8377,27 @@ class Wa extends H {
|
|
|
8354
8377
|
}
|
|
8355
8378
|
}
|
|
8356
8379
|
}
|
|
8357
|
-
function
|
|
8380
|
+
function za(n) {
|
|
8358
8381
|
if (n.length === 0)
|
|
8359
8382
|
return;
|
|
8360
8383
|
let e = n[0];
|
|
8361
8384
|
for (const i of n)
|
|
8362
8385
|
i.y + i.height > e.y + e.height && (e = i);
|
|
8363
8386
|
const t = e.x + e.width;
|
|
8364
|
-
return { x: Math.max(e.x, t -
|
|
8387
|
+
return { x: Math.max(e.x, t - Wa), y: e.y + e.height - Ha / 2 };
|
|
8365
8388
|
}
|
|
8366
|
-
function
|
|
8389
|
+
function qa(n, e, t) {
|
|
8367
8390
|
const s = Math.max(e, n.x + 12), i = t.x - s, o = s + i * 0.55, r = t.x - i * 0.45;
|
|
8368
8391
|
return `M ${n.x} ${n.y} L ${s} ${n.y} C ${o} ${n.y}, ${r} ${t.y}, ${t.x} ${t.y}`;
|
|
8369
8392
|
}
|
|
8370
|
-
function
|
|
8393
|
+
function Ga(n) {
|
|
8371
8394
|
const e = n.trim().split(/\s+/).filter(Boolean);
|
|
8372
8395
|
if (e.length === 0)
|
|
8373
8396
|
return "?";
|
|
8374
8397
|
const t = e[0][0] ?? "", s = e.length > 1 ? e[e.length - 1][0] ?? "" : "";
|
|
8375
8398
|
return (t + s).toUpperCase();
|
|
8376
8399
|
}
|
|
8377
|
-
function
|
|
8400
|
+
function Xa(n) {
|
|
8378
8401
|
const e = Math.max(0, Math.round((Date.now() - n) / 1e3));
|
|
8379
8402
|
if (e < 60)
|
|
8380
8403
|
return "just now";
|
|
@@ -8384,9 +8407,9 @@ function Ga(n) {
|
|
|
8384
8407
|
const s = Math.round(t / 60);
|
|
8385
8408
|
return s < 24 ? `${s}h ago` : `${Math.round(s / 24)}d ago`;
|
|
8386
8409
|
}
|
|
8387
|
-
const
|
|
8388
|
-
function
|
|
8389
|
-
const t = n.element, s = n.overlayContainer, i = t.clientWidth -
|
|
8410
|
+
const Ua = 12, Ya = 8;
|
|
8411
|
+
function ja(n, e) {
|
|
8412
|
+
const t = n.element, s = n.overlayContainer, i = t.clientWidth - Ya - s.offsetLeft, o = [];
|
|
8390
8413
|
for (const c of e) {
|
|
8391
8414
|
if (c.rects.length === 0) {
|
|
8392
8415
|
c.element.style.visibility = "hidden";
|
|
@@ -8397,7 +8420,7 @@ function Ya(n, e) {
|
|
|
8397
8420
|
o.sort((c, a) => c.y - a.y);
|
|
8398
8421
|
let r = -1 / 0;
|
|
8399
8422
|
for (const c of o) {
|
|
8400
|
-
const a = Math.max(c.y, r +
|
|
8423
|
+
const a = Math.max(c.y, r + Ua), l = i - c.element.offsetWidth;
|
|
8401
8424
|
c.element.style.left = `${l}px`, c.element.style.top = `${a}px`, r = a + c.element.offsetHeight;
|
|
8402
8425
|
}
|
|
8403
8426
|
}
|
|
@@ -8442,7 +8465,7 @@ class mi extends H {
|
|
|
8442
8465
|
}
|
|
8443
8466
|
_relayout() {
|
|
8444
8467
|
const e = this._order.map((t) => this._entries.get(t)).filter((t) => t !== void 0).map((t) => ({ element: t.widget.element, rects: t.rects.get() }));
|
|
8445
|
-
|
|
8468
|
+
ja(this.view, e), this._revealPendingComment();
|
|
8446
8469
|
}
|
|
8447
8470
|
_revealPendingComment() {
|
|
8448
8471
|
const e = this._pendingRevealCommentId;
|
|
@@ -8452,9 +8475,9 @@ class mi extends H {
|
|
|
8452
8475
|
!t || t.style.visibility === "hidden" || (this._pendingRevealCommentId = void 0, t.scrollIntoView({ block: "center", inline: "nearest" }));
|
|
8453
8476
|
}
|
|
8454
8477
|
}
|
|
8455
|
-
const
|
|
8478
|
+
const Qa = /^([a-z0-9]+)/i;
|
|
8456
8479
|
function L(n) {
|
|
8457
|
-
const e =
|
|
8480
|
+
const e = Qa.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
|
|
8458
8481
|
return s.length && (t.className = s.join(" ")), t;
|
|
8459
8482
|
}
|
|
8460
8483
|
function ye(n) {
|
|
@@ -8481,7 +8504,7 @@ function Qe(n) {
|
|
|
8481
8504
|
} else s && t.appendChild(document.createTextNode(s));
|
|
8482
8505
|
return e.appendChild(t), e;
|
|
8483
8506
|
}
|
|
8484
|
-
class
|
|
8507
|
+
class Za {
|
|
8485
8508
|
constructor(e, t) {
|
|
8486
8509
|
this._comments = e, this._domNode = L("div.agent-feedback-widget"), this._domNode.classList.add("collapsed"), this._domNode.tabIndex = -1, this._domNode.setAttribute("widgetid", "agent-feedback-widget-0"), this._headerNode = L("div.agent-feedback-widget-header"), this._headerNode.appendChild(Tt("comment")), this._titleNode = L("span.agent-feedback-widget-title"), this._updateTitle(), this._headerNode.appendChild(this._titleNode), this._headerNode.appendChild(L("span.agent-feedback-widget-spacer")), this._toggleButton = L("div.agent-feedback-widget-toggle"), this._updateToggleButton(), this._headerNode.appendChild(this._toggleButton), this._domNode.appendChild(this._headerNode), this._bodyNode = L("div.agent-feedback-widget-body"), this._bodyNode.classList.add("collapsed"), this._buildFeedbackItems(), this._domNode.appendChild(this._bodyNode), this._domNode.appendChild(L("div.agent-feedback-widget-arrow")), this._setupEventHandlers(), this._domNode.classList.add("visible"), t?.expanded && this.expand(), t?.focusedCommentId && this.focusFeedback(t.focusedCommentId);
|
|
8487
8510
|
}
|
|
@@ -8681,7 +8704,7 @@ class Qa {
|
|
|
8681
8704
|
this._disposables.length = 0, this._domNode.remove();
|
|
8682
8705
|
}
|
|
8683
8706
|
}
|
|
8684
|
-
class
|
|
8707
|
+
class Ja extends mi {
|
|
8685
8708
|
createWidget(e) {
|
|
8686
8709
|
const t = this.context?.resolveLine?.(e.range.start) ?? 1, s = {
|
|
8687
8710
|
id: e.id,
|
|
@@ -8690,26 +8713,26 @@ class Za extends mi {
|
|
|
8690
8713
|
startLine: t,
|
|
8691
8714
|
text: e.body
|
|
8692
8715
|
};
|
|
8693
|
-
return new
|
|
8716
|
+
return new Za([s], { expanded: !0 });
|
|
8694
8717
|
}
|
|
8695
8718
|
}
|
|
8696
|
-
const
|
|
8719
|
+
const el = /^([a-z0-9]+)/i;
|
|
8697
8720
|
function xe(n) {
|
|
8698
|
-
const e =
|
|
8721
|
+
const e = el.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
|
|
8699
8722
|
return s.length && (t.className = s.join(" ")), t;
|
|
8700
8723
|
}
|
|
8701
8724
|
function gs(n) {
|
|
8702
8725
|
return `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`;
|
|
8703
8726
|
}
|
|
8704
|
-
const
|
|
8727
|
+
const tl = {
|
|
8705
8728
|
edit: gs('<path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>'),
|
|
8706
8729
|
trash: gs('<polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line>')
|
|
8707
8730
|
};
|
|
8708
|
-
function
|
|
8731
|
+
function nl(n, e) {
|
|
8709
8732
|
const t = document.createElement("button");
|
|
8710
|
-
return t.type = "button", t.className = "vscode-comment-widget-v2-action", t.setAttribute("aria-label", e), t.title = e, t.innerHTML =
|
|
8733
|
+
return t.type = "button", t.className = "vscode-comment-widget-v2-action", t.setAttribute("aria-label", e), t.title = e, t.innerHTML = tl[n] ?? "", t;
|
|
8711
8734
|
}
|
|
8712
|
-
class
|
|
8735
|
+
class sl {
|
|
8713
8736
|
_domNode;
|
|
8714
8737
|
_textNode;
|
|
8715
8738
|
_toggleNode;
|
|
@@ -8747,7 +8770,7 @@ class nl {
|
|
|
8747
8770
|
}
|
|
8748
8771
|
/** A header action button that runs `onClick` (and cleans up on dispose). */
|
|
8749
8772
|
_actionButton(e, t, s) {
|
|
8750
|
-
const i =
|
|
8773
|
+
const i = nl(e, t), o = (r) => {
|
|
8751
8774
|
r.preventDefault(), r.stopPropagation(), s();
|
|
8752
8775
|
};
|
|
8753
8776
|
return i.addEventListener("click", o), this._disposables.push(() => i.removeEventListener("click", o)), i;
|
|
@@ -8759,13 +8782,13 @@ class nl {
|
|
|
8759
8782
|
this._domNode.remove();
|
|
8760
8783
|
}
|
|
8761
8784
|
}
|
|
8762
|
-
const
|
|
8763
|
-
class
|
|
8785
|
+
const il = 80;
|
|
8786
|
+
class ol extends mi {
|
|
8764
8787
|
createWidget(e) {
|
|
8765
|
-
return new
|
|
8788
|
+
return new sl({
|
|
8766
8789
|
username: e.author ?? "You",
|
|
8767
8790
|
body: e.body,
|
|
8768
|
-
state: e.body.length >
|
|
8791
|
+
state: e.body.length > il ? "collapsed" : "short",
|
|
8769
8792
|
// Edit is intentionally omitted (hidden) for now. Delete removes the
|
|
8770
8793
|
// comment from the shared model; the autorun then disposes the card.
|
|
8771
8794
|
onDelete: () => this.model.remove(e.id)
|
|
@@ -8777,9 +8800,9 @@ const Tl = {
|
|
|
8777
8800
|
vscode: "VS Code cards",
|
|
8778
8801
|
"vscode-v2": "Markdown cards (V3)"
|
|
8779
8802
|
}, Ol = {
|
|
8780
|
-
connected: (n, e) => new
|
|
8781
|
-
vscode: (n, e, t) => new
|
|
8782
|
-
"vscode-v2": (n, e, t) => new
|
|
8803
|
+
connected: (n, e) => new Ka(n, e),
|
|
8804
|
+
vscode: (n, e, t) => new Ja(n, e, t),
|
|
8805
|
+
"vscode-v2": (n, e, t) => new ol(n, e, t)
|
|
8783
8806
|
};
|
|
8784
8807
|
export {
|
|
8785
8808
|
X as AstNode,
|
|
@@ -8790,12 +8813,12 @@ export {
|
|
|
8790
8813
|
Tl as COMMENTS_DESIGN_LABELS,
|
|
8791
8814
|
j as CodeBlockAstNode,
|
|
8792
8815
|
Zt as CodeBlockViewNode,
|
|
8793
|
-
|
|
8816
|
+
Na as CommentInputWidget,
|
|
8794
8817
|
fi as CommentModeController,
|
|
8795
8818
|
Ml as CommentsModel,
|
|
8796
|
-
|
|
8819
|
+
Ka as CommentsView,
|
|
8797
8820
|
N as CursorPosition,
|
|
8798
|
-
|
|
8821
|
+
Sc as CursorView,
|
|
8799
8822
|
Xe as CursorViewRendering,
|
|
8800
8823
|
Fe as DEFAULT_INDENTATION_CONFIG,
|
|
8801
8824
|
_i as DEFAULT_WORD_NAVIGATION_CONFIG,
|
|
@@ -8804,16 +8827,16 @@ export {
|
|
|
8804
8827
|
en as DocumentViewNode,
|
|
8805
8828
|
El as EditorController,
|
|
8806
8829
|
gt as EditorCoordinateSpace,
|
|
8807
|
-
|
|
8830
|
+
Nr as EditorCoordinateTransform,
|
|
8808
8831
|
wl as EditorModel,
|
|
8809
8832
|
bl as EditorView,
|
|
8810
8833
|
Kt as EmphasisAstNode,
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8834
|
+
Gc as FIND_MATCH_LIMIT,
|
|
8835
|
+
sa as FindController,
|
|
8836
|
+
Kc as FindHighlightsView,
|
|
8837
|
+
Qc as FindModel,
|
|
8815
8838
|
ot as FindPattern,
|
|
8816
|
-
|
|
8839
|
+
na as FindWidget,
|
|
8817
8840
|
Ce as FrontMatterAstNode,
|
|
8818
8841
|
W as GlueAstNode,
|
|
8819
8842
|
ge as HeadingAstNode,
|
|
@@ -8826,25 +8849,25 @@ export {
|
|
|
8826
8849
|
z as ListAstNode,
|
|
8827
8850
|
q as ListItemAstNode,
|
|
8828
8851
|
Cl as LocalHistoryStrategy,
|
|
8829
|
-
|
|
8852
|
+
Ui as MarkdownParser,
|
|
8830
8853
|
y as MarkerAstNode,
|
|
8831
8854
|
we as MathBlockAstNode,
|
|
8832
|
-
|
|
8855
|
+
wa as MeasuredLayoutDebugRendering,
|
|
8833
8856
|
Sl as MeasuredLayoutDebugView,
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8857
|
+
vo as MeasuredLayoutModel,
|
|
8858
|
+
xa as MonacoSyntaxHighlighter,
|
|
8859
|
+
ra as NativeClipboardStrategy,
|
|
8837
8860
|
w as OffsetRange,
|
|
8838
8861
|
se as ParagraphAstNode,
|
|
8839
8862
|
fe as Point2D,
|
|
8840
8863
|
S as Rect2D,
|
|
8841
8864
|
k as Selection,
|
|
8842
|
-
|
|
8865
|
+
wc as SelectionView,
|
|
8843
8866
|
Vn as SelectionViewRendering,
|
|
8844
8867
|
mi as StackedCommentsPresenter,
|
|
8845
8868
|
zt as StrikethroughAstNode,
|
|
8846
8869
|
M as StringEdit,
|
|
8847
|
-
|
|
8870
|
+
de as StringReplacement,
|
|
8848
8871
|
sn as StringValue,
|
|
8849
8872
|
Wt as StrongAstNode,
|
|
8850
8873
|
Le as TableAstNode,
|
|
@@ -8853,59 +8876,59 @@ export {
|
|
|
8853
8876
|
Re as TextAstNode,
|
|
8854
8877
|
ve as ThematicBreakAstNode,
|
|
8855
8878
|
Be as Token,
|
|
8856
|
-
|
|
8879
|
+
oe as ViewNode,
|
|
8857
8880
|
Ri as VirtualCursorLine,
|
|
8858
8881
|
at as VisualLine,
|
|
8859
8882
|
De as VisualLineMap,
|
|
8860
8883
|
_e as VisualRun,
|
|
8861
|
-
|
|
8862
|
-
|
|
8884
|
+
ol as VsCodeV2CommentsView,
|
|
8885
|
+
Ja as VscodeStackedCommentsView,
|
|
8863
8886
|
Rt as blocksIntersecting,
|
|
8864
8887
|
$t as commands,
|
|
8865
8888
|
Ll as createDefaultMonacoSyntaxHighlighter,
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8889
|
+
Io as cursorDocumentEnd,
|
|
8890
|
+
No as cursorDocumentStart,
|
|
8891
|
+
Ao as cursorDown,
|
|
8892
|
+
Lo as cursorLeft,
|
|
8870
8893
|
It as cursorLineEnd,
|
|
8871
8894
|
Nt as cursorLineStart,
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8895
|
+
To as cursorMoveLeft,
|
|
8896
|
+
Mo as cursorMoveRight,
|
|
8897
|
+
So as cursorRight,
|
|
8875
8898
|
dn as cursorUp,
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8899
|
+
Po as cursorVisualLineEnd,
|
|
8900
|
+
Bo as cursorVisualLineStart,
|
|
8901
|
+
Ro as cursorWordLeft,
|
|
8902
|
+
Oo as cursorWordRight,
|
|
8880
8903
|
hn as deleteLeft,
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8904
|
+
Wo as deleteLineLeft,
|
|
8905
|
+
Ko as deleteLineRight,
|
|
8906
|
+
Vo as deleteRight,
|
|
8907
|
+
$o as deleteWordLeft,
|
|
8908
|
+
Ho as deleteWordRight,
|
|
8886
8909
|
hi as escapeFindRegex,
|
|
8887
8910
|
Ls as findBlockAtOffset,
|
|
8888
|
-
|
|
8911
|
+
ie as findNodeOffsetById,
|
|
8889
8912
|
ws as findWordAt,
|
|
8890
8913
|
vi as findWordBoundaryLeft,
|
|
8891
8914
|
wi as findWordBoundaryRight,
|
|
8892
8915
|
bi as findWordDeleteBoundaryLeft,
|
|
8893
8916
|
ki as findWordDeleteBoundaryRight,
|
|
8894
|
-
|
|
8917
|
+
Yi as getAnnotatedSource,
|
|
8895
8918
|
Ts as hiddenCursorRanges,
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8919
|
+
Yo as insertHardLineBreak,
|
|
8920
|
+
Uo as insertLineBreak,
|
|
8921
|
+
Xo as insertParagraph,
|
|
8922
|
+
jo as insertSmartEnter,
|
|
8923
|
+
qo as insertTab,
|
|
8924
|
+
zo as insertText,
|
|
8902
8925
|
Me as nextCursorPosition,
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8926
|
+
ce as normalizeCursorPosition,
|
|
8927
|
+
Go as outdent,
|
|
8928
|
+
ur as selectAll,
|
|
8929
|
+
mr as selectBlock,
|
|
8930
|
+
fr as selectWord,
|
|
8931
|
+
Pi as taskCheckboxRange,
|
|
8909
8932
|
vl as visualizeAst,
|
|
8910
8933
|
xl as vscodeHostKeyboardProfile,
|
|
8911
8934
|
Vt as vscodeKeyboardProfile,
|