@pi-outpost/embed 0.62.3 → 0.63.1
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/{CodeEditor-C2mtBAxz.js → CodeEditor-BW8cShfE.js} +870 -869
- package/dist/CodeEditor-BZfOQyjO.cjs +9 -0
- package/dist/{conversationExport-jRLUX0kH.js → conversationExport-BHXWfKKh.js} +37 -37
- package/dist/{conversationExport-DXxmgLoF.cjs → conversationExport-CWUOyeJO.cjs} +2 -2
- package/dist/{conversationHistory-C6PqGsO9.cjs → conversationHistory-0ds9dEO5.cjs} +26 -4
- package/dist/{conversationHistory-3pDBlkZZ.js → conversationHistory-xEFHYA2a.js} +94 -61
- package/dist/{dist-B9wvGgxB.js → dist-B-n0qSdY.js} +134 -133
- package/dist/{dist-LBUs7dVk.js → dist-B53CIh_q.js} +62 -61
- package/dist/{dist-DeLxY4Ia.js → dist-BBPYf4ef.js} +30 -29
- package/dist/dist-BFbWWJdM.cjs +23 -0
- package/dist/dist-BLE5-Y8p.cjs +9 -0
- package/dist/dist-BQCPWecG.cjs +1 -0
- package/dist/dist-BmjjdWVL.cjs +1 -0
- package/dist/{dist-kpPXlS4A.cjs → dist-Bo7aGd2O.cjs} +2 -2
- package/dist/{dist-Bk3hLKgL.js → dist-BoHwBqKn.js} +49 -49
- package/dist/{dist-VWDOErn8.js → dist-BpRy8-Lq.js} +47 -47
- package/dist/dist-BzV3uXd3.js +2842 -0
- package/dist/dist-C3wOZTh_.cjs +1 -0
- package/dist/dist-C6485_TJ.cjs +1 -0
- package/dist/{dist-BIMxMB--.js → dist-CEPaeNz_.js} +57 -57
- package/dist/dist-CbNZ-oK_.cjs +11 -0
- package/dist/dist-CewGgiCl.cjs +1 -0
- package/dist/dist-Cgkuh5Wk.cjs +11 -0
- package/dist/dist-ChIJFFop.cjs +3 -0
- package/dist/dist-Cqy-WSUm.cjs +6 -0
- package/dist/{dist-Bg1-NGne.js → dist-D1XDfvdG.js} +17 -17
- package/dist/{dist-qeX2QqDc.js → dist-DAh__jUg.js} +6724 -9561
- package/dist/dist-DV7vb3Vn.cjs +1 -0
- package/dist/dist-DWOMmaS_.cjs +1 -0
- package/dist/{dist-BWAsFrsx.js → dist-DcevhA0K.js} +73 -73
- package/dist/dist-DdI6ugoG.cjs +1 -0
- package/dist/{dist-CpOA8cNn.js → dist-DhtR0qbm.js} +49 -49
- package/dist/{dist-CwPu13CG.js → dist-DlwWvZ4d.js} +46 -46
- package/dist/{dist-nQ2aeIgK.js → dist-DnmbmV7C.js} +495 -494
- package/dist/dist-DsOiUWHL.cjs +1 -0
- package/dist/dist-DuyBYmw-.cjs +1 -0
- package/dist/{dist-DUziszL2.js → dist-T7rNKseu.js} +32 -32
- package/dist/{dist-CcTOENSK.js → dist-XKeyr4Om.js} +26 -26
- package/dist/{dist-CvxwObne.js → dist-n29rG6c2.js} +117 -117
- package/dist/{dist-DCT8mdeU.js → dist-s8hmOD0A.js} +52 -52
- package/dist/pi-outpost-embed.cjs +46 -44
- package/dist/pi-outpost-embed.js +5022 -4147
- package/package.json +1 -1
- package/dist/CodeEditor-CHKp59kP.cjs +0 -9
- package/dist/dist-B9TXDASo.cjs +0 -1
- package/dist/dist-BMzIUMhf.cjs +0 -1
- package/dist/dist-BawiB8yE.cjs +0 -23
- package/dist/dist-BjxwUutQ.cjs +0 -6
- package/dist/dist-BlUoR-U1.cjs +0 -13
- package/dist/dist-Bnsp4Y3i.cjs +0 -9
- package/dist/dist-CM2l_BHt.cjs +0 -1
- package/dist/dist-CkDnvyBs.cjs +0 -1
- package/dist/dist-CpsCEkIr.cjs +0 -1
- package/dist/dist-DJYmQsI-.cjs +0 -1
- package/dist/dist-F6qtkv2Q.cjs +0 -11
- package/dist/dist-Lxxq5IH0.cjs +0 -1
- package/dist/dist-c-DRw6Dh.cjs +0 -1
- package/dist/dist-sM-IE5EO.cjs +0 -1
- package/dist/dist-vBlUeRrZ.cjs +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { n as e } from "./rolldown-runtime-5HNE8Q1r.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { A as t, B as n, C as r, D as i, E as a, F as o, H as s, I as c, L as l, N as u, O as d, P as f, R as p, S as m, T as h, U as ee, V as g, _, a as v, c as y, d as te, f as ne, g as re, h as ie, i as ae, j as oe, k as se, l as ce, m as le, n as ue, o as de, p as fe, r as b, s as pe, t as x, u as me, v as he, w as S, x as ge, y as _e, z as C } from "./dist-DAh__jUg.js";
|
|
3
|
+
import { C as ve, E as w, I as ye, O as be, S as xe, b as Se, c as Ce, g as we, j as Te, k as T, m as Ee, s as De, t as Oe, w as ke, y as Ae } from "./dist-BzV3uXd3.js";
|
|
4
|
+
import { useEffect as je, useImperativeHandle as Me, useRef as Ne } from "react";
|
|
5
|
+
import { jsx as Pe } from "react/jsx-runtime";
|
|
5
6
|
//#region ../node_modules/@codemirror/autocomplete/dist/index.js
|
|
6
|
-
var
|
|
7
|
+
var Fe = class {
|
|
7
8
|
constructor(e, t, n, r) {
|
|
8
9
|
this.state = e, this.pos = t, this.explicit = n, this.view = r, this.abortListeners = [], this.abortOnDocChange = !1;
|
|
9
10
|
}
|
|
10
11
|
tokenBefore(e) {
|
|
11
|
-
let t =
|
|
12
|
+
let t = T(this.state).resolveInner(this.pos, -1);
|
|
12
13
|
for (; t && e.indexOf(t.name) < 0;) t = t.parent;
|
|
13
14
|
return t ? {
|
|
14
15
|
from: t.from,
|
|
@@ -18,7 +19,7 @@ var Ne = class {
|
|
|
18
19
|
} : null;
|
|
19
20
|
}
|
|
20
21
|
matchBefore(e) {
|
|
21
|
-
let t = this.state.doc.lineAt(this.pos), n = Math.max(t.from, this.pos - 250), r = t.text.slice(n - t.from, this.pos - t.from), i = r.search(
|
|
22
|
+
let t = this.state.doc.lineAt(this.pos), n = Math.max(t.from, this.pos - 250), r = t.text.slice(n - t.from, this.pos - t.from), i = r.search(Ve(e, !1));
|
|
22
23
|
return i < 0 ? null : {
|
|
23
24
|
from: n + i,
|
|
24
25
|
to: this.pos,
|
|
@@ -32,21 +33,21 @@ var Ne = class {
|
|
|
32
33
|
e == "abort" && this.abortListeners && (this.abortListeners.push(t), n && n.onDocChange && (this.abortOnDocChange = !0));
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
|
-
function
|
|
36
|
+
function Ie(e) {
|
|
36
37
|
let t = Object.keys(e).join(""), n = /\w/.test(t);
|
|
37
38
|
return n && (t = t.replace(/\w/g, "")), `[${n ? "\\w" : ""}${t.replace(/[^\w\s]/g, "\\$&")}]`;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function Le(e) {
|
|
40
41
|
let t = Object.create(null), n = Object.create(null);
|
|
41
42
|
for (let { label: r } of e) {
|
|
42
43
|
t[r[0]] = !0;
|
|
43
44
|
for (let e = 1; e < r.length; e++) n[r[e]] = !0;
|
|
44
45
|
}
|
|
45
|
-
let r =
|
|
46
|
+
let r = Ie(t) + Ie(n) + "*$";
|
|
46
47
|
return [RegExp("^" + r), new RegExp(r)];
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
let t = e.map((e) => typeof e == "string" ? { label: e } : e), [n, r] = t.every((e) => /^\w+$/.test(e.label)) ? [/\w*$/, /\w+$/] :
|
|
49
|
+
function Re(e) {
|
|
50
|
+
let t = e.map((e) => typeof e == "string" ? { label: e } : e), [n, r] = t.every((e) => /^\w+$/.test(e.label)) ? [/\w*$/, /\w+$/] : Le(t);
|
|
50
51
|
return (e) => {
|
|
51
52
|
let i = e.matchBefore(r);
|
|
52
53
|
return i || e.explicit ? {
|
|
@@ -56,61 +57,61 @@ function Ie(e) {
|
|
|
56
57
|
} : null;
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function ze(e, t) {
|
|
60
61
|
return (n) => {
|
|
61
|
-
for (let t =
|
|
62
|
+
for (let t = T(n.state).resolveInner(n.pos, -1); t; t = t.parent) {
|
|
62
63
|
if (e.indexOf(t.name) > -1) return null;
|
|
63
64
|
if (t.type.isTop) break;
|
|
64
65
|
}
|
|
65
66
|
return t(n);
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
var
|
|
69
|
+
var Be = class {
|
|
69
70
|
constructor(e, t, n, r) {
|
|
70
71
|
this.completion = e, this.source = t, this.match = n, this.score = r;
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
|
-
function
|
|
74
|
+
function E(e) {
|
|
74
75
|
return e.selection.main.from;
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
+
function Ve(e, t) {
|
|
77
78
|
let { source: n } = e, r = t && n[0] != "^", i = n[n.length - 1] != "$";
|
|
78
79
|
return !r && !i ? e : RegExp(`${r ? "^" : ""}(?:${n})${i ? "$" : ""}`, e.flags ?? (e.ignoreCase ? "i" : ""));
|
|
79
80
|
}
|
|
80
|
-
var
|
|
81
|
-
function
|
|
82
|
-
let { main: i } = e.selection,
|
|
81
|
+
var He = /*@__PURE__*/ ge.define();
|
|
82
|
+
function Ue(e, t, n, r) {
|
|
83
|
+
let { main: i } = e.selection, o = n - i.from, s = r - i.from;
|
|
83
84
|
return {
|
|
84
|
-
...e.changeByRange((
|
|
85
|
-
if (
|
|
86
|
-
let
|
|
85
|
+
...e.changeByRange((c) => {
|
|
86
|
+
if (c != i && n != r && e.sliceDoc(c.from + o, c.from + s) != e.sliceDoc(n, r)) return { range: c };
|
|
87
|
+
let l = e.toText(t);
|
|
87
88
|
return {
|
|
88
89
|
changes: {
|
|
89
|
-
from:
|
|
90
|
-
to: r == i.from ?
|
|
91
|
-
insert:
|
|
90
|
+
from: c.from + o,
|
|
91
|
+
to: r == i.from ? c.to : c.from + s,
|
|
92
|
+
insert: l
|
|
92
93
|
},
|
|
93
|
-
range:
|
|
94
|
+
range: a.cursor(c.from + o + l.length)
|
|
94
95
|
};
|
|
95
96
|
}),
|
|
96
97
|
scrollIntoView: !0,
|
|
97
98
|
userEvent: "input.complete"
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
|
-
var
|
|
101
|
-
function
|
|
101
|
+
var We = /*@__PURE__*/ new WeakMap();
|
|
102
|
+
function Ge(e) {
|
|
102
103
|
if (!Array.isArray(e)) return e;
|
|
103
|
-
let t =
|
|
104
|
-
return t ||
|
|
104
|
+
let t = We.get(e);
|
|
105
|
+
return t || We.set(e, t = Re(e)), t;
|
|
105
106
|
}
|
|
106
|
-
var
|
|
107
|
+
var Ke = /*@__PURE__*/ f.define(), D = /*@__PURE__*/ f.define(), qe = class {
|
|
107
108
|
constructor(e) {
|
|
108
109
|
this.pattern = e, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = [];
|
|
109
110
|
for (let t = 0; t < e.length;) {
|
|
110
|
-
let n =
|
|
111
|
+
let n = p(e, t), r = C(n);
|
|
111
112
|
this.chars.push(n);
|
|
112
113
|
let i = e.slice(t, t + r), a = i.toUpperCase();
|
|
113
|
-
this.folded.push(
|
|
114
|
+
this.folded.push(p(a == i ? i.toLowerCase() : a, 0)), t += r;
|
|
114
115
|
}
|
|
115
116
|
this.astral = e.length != this.chars.length;
|
|
116
117
|
}
|
|
@@ -122,7 +123,7 @@ var We = /*@__PURE__*/ D.define(), k = /*@__PURE__*/ D.define(), Ge = class {
|
|
|
122
123
|
if (e.length < this.pattern.length) return null;
|
|
123
124
|
let { chars: t, folded: n, any: r, precise: i, byWord: a } = this;
|
|
124
125
|
if (t.length == 1) {
|
|
125
|
-
let r =
|
|
126
|
+
let r = p(e, 0), i = C(r), a = i == e.length ? 0 : -100;
|
|
126
127
|
if (r != t[0]) {
|
|
127
128
|
if (r == n[0]) a += -200;
|
|
128
129
|
else return null;
|
|
@@ -134,29 +135,29 @@ var We = /*@__PURE__*/ D.define(), k = /*@__PURE__*/ D.define(), Ge = class {
|
|
|
134
135
|
let s = t.length, c = 0;
|
|
135
136
|
if (o < 0) {
|
|
136
137
|
for (let i = 0, a = Math.min(e.length, 200); i < a && c < s;) {
|
|
137
|
-
let a =
|
|
138
|
-
(a == t[c] || a == n[c]) && (r[c++] = i), i +=
|
|
138
|
+
let a = p(e, i);
|
|
139
|
+
(a == t[c] || a == n[c]) && (r[c++] = i), i += C(a);
|
|
139
140
|
}
|
|
140
141
|
if (c < s) return null;
|
|
141
142
|
}
|
|
142
|
-
let l = 0, u = 0, d = !1, f = 0,
|
|
143
|
-
for (let r = 0, c = Math.min(e.length, 200),
|
|
144
|
-
let c =
|
|
145
|
-
o < 0 && (l < s && c == t[l] && (i[l++] = r), f < s && (c == t[f] || c == n[f] ? (f == 0 && (
|
|
146
|
-
let
|
|
147
|
-
(!r ||
|
|
143
|
+
let l = 0, u = 0, d = !1, f = 0, m = -1, h = -1, g = /[a-z]/.test(e), _ = !0;
|
|
144
|
+
for (let r = 0, c = Math.min(e.length, 200), v = 0; r < c && u < s;) {
|
|
145
|
+
let c = p(e, r);
|
|
146
|
+
o < 0 && (l < s && c == t[l] && (i[l++] = r), f < s && (c == t[f] || c == n[f] ? (f == 0 && (m = r), h = r + 1, f++) : f = 0));
|
|
147
|
+
let y, te = c < 255 ? c >= 48 && c <= 57 || c >= 97 && c <= 122 ? 2 : +(c >= 65 && c <= 90) : (y = ee(c)) == y.toLowerCase() ? y == y.toUpperCase() ? 0 : 2 : 1;
|
|
148
|
+
(!r || te == 1 && g || v == 0 && te != 0) && (t[u] == c || n[u] == c && (d = !0) ? a[u++] = r : a.length && (_ = !1)), v = te, r += C(c);
|
|
148
149
|
}
|
|
149
|
-
return u == s && a[0] == 0 &&
|
|
150
|
+
return u == s && a[0] == 0 && _ ? this.result(-100 + (d ? -200 : 0), a, e) : f == s && m == 0 ? this.ret(-200 - e.length + (h == e.length ? 0 : -100), [0, h]) : o > -1 ? this.ret(-700 - e.length, [o, o + this.pattern.length]) : f == s ? this.ret(-900 - e.length, [m, h]) : u == s ? this.result(-100 + (d ? -200 : 0) + -700 + (_ ? 0 : -1100), a, e) : t.length == 2 ? null : this.result((r[0] ? -700 : 0) + -200 + -1100, r, e);
|
|
150
151
|
}
|
|
151
152
|
result(e, t, n) {
|
|
152
153
|
let r = [], i = 0;
|
|
153
154
|
for (let e of t) {
|
|
154
|
-
let t = e + (this.astral ?
|
|
155
|
+
let t = e + (this.astral ? C(p(n, e)) : 1);
|
|
155
156
|
i && r[i - 1] == e ? r[i - 1] = t : (r[i++] = e, r[i++] = t);
|
|
156
157
|
}
|
|
157
158
|
return this.ret(e - n.length, r);
|
|
158
159
|
}
|
|
159
|
-
},
|
|
160
|
+
}, Je = class {
|
|
160
161
|
constructor(e) {
|
|
161
162
|
this.pattern = e, this.matched = [], this.score = 0, this.folded = e.toLowerCase();
|
|
162
163
|
}
|
|
@@ -165,8 +166,8 @@ var We = /*@__PURE__*/ D.define(), k = /*@__PURE__*/ D.define(), Ge = class {
|
|
|
165
166
|
let t = e.slice(0, this.pattern.length), n = t == this.pattern ? 0 : t.toLowerCase() == this.folded ? -200 : null;
|
|
166
167
|
return n == null ? null : (this.matched = [0, t.length], this.score = n + (e.length == this.pattern.length ? 0 : -100), this);
|
|
167
168
|
}
|
|
168
|
-
},
|
|
169
|
-
return
|
|
169
|
+
}, O = /*@__PURE__*/ d.define({ combine(e) {
|
|
170
|
+
return n(e, {
|
|
170
171
|
activateOnTyping: !0,
|
|
171
172
|
activateOnCompletion: () => !1,
|
|
172
173
|
activateOnTypingDelay: 100,
|
|
@@ -180,7 +181,7 @@ var We = /*@__PURE__*/ D.define(), k = /*@__PURE__*/ D.define(), Ge = class {
|
|
|
180
181
|
aboveCursor: !1,
|
|
181
182
|
icons: !0,
|
|
182
183
|
addToOptions: [],
|
|
183
|
-
positionInfo:
|
|
184
|
+
positionInfo: Xe,
|
|
184
185
|
filterStrict: !1,
|
|
185
186
|
compareCompletions: (e, t) => (e.sortText || e.label).localeCompare(t.sortText || t.label),
|
|
186
187
|
interactionDelay: 75,
|
|
@@ -189,31 +190,31 @@ var We = /*@__PURE__*/ D.define(), k = /*@__PURE__*/ D.define(), Ge = class {
|
|
|
189
190
|
defaultKeymap: (e, t) => e && t,
|
|
190
191
|
closeOnBlur: (e, t) => e && t,
|
|
191
192
|
icons: (e, t) => e && t,
|
|
192
|
-
tooltipClass: (e, t) => (n) =>
|
|
193
|
-
optionClass: (e, t) => (n) =>
|
|
193
|
+
tooltipClass: (e, t) => (n) => Ye(e(n), t(n)),
|
|
194
|
+
optionClass: (e, t) => (n) => Ye(e(n), t(n)),
|
|
194
195
|
addToOptions: (e, t) => e.concat(t),
|
|
195
196
|
filterStrict: (e, t) => e || t
|
|
196
197
|
});
|
|
197
198
|
} });
|
|
198
|
-
function
|
|
199
|
+
function Ye(e, t) {
|
|
199
200
|
return e ? t ? e + " " + t : e : t;
|
|
200
201
|
}
|
|
201
|
-
function
|
|
202
|
-
let o = e.textDirection ==
|
|
202
|
+
function Xe(e, t, n, r, i, a) {
|
|
203
|
+
let o = e.textDirection == ue.RTL, s = o, c = !1, l = "top", u, d, f = t.left - i.left, p = i.right - t.right, m = r.right - r.left, h = r.bottom - r.top;
|
|
203
204
|
if (s && f < Math.min(m, p) ? s = !1 : !s && p < Math.min(m, f) && (s = !0), m <= (s ? f : p)) u = Math.max(i.top, Math.min(n.top, i.bottom - h)) - t.top, d = Math.min(400, s ? f : p);
|
|
204
205
|
else {
|
|
205
206
|
c = !0, d = Math.min(400, (o ? t.right : i.right - t.left) - 30);
|
|
206
207
|
let e = i.bottom - t.bottom;
|
|
207
208
|
e >= h || e > t.top ? u = n.bottom - t.top : (l = "bottom", u = t.bottom - n.top);
|
|
208
209
|
}
|
|
209
|
-
let
|
|
210
|
+
let ee = (t.bottom - t.top) / a.offsetHeight, g = (t.right - t.left) / a.offsetWidth;
|
|
210
211
|
return {
|
|
211
|
-
style: `${l}: ${u /
|
|
212
|
+
style: `${l}: ${u / ee}px; max-width: ${d / g}px`,
|
|
212
213
|
class: "cm-completionInfo-" + (c ? o ? "left-narrow" : "right-narrow" : s ? "left" : "right")
|
|
213
214
|
};
|
|
214
215
|
}
|
|
215
|
-
var
|
|
216
|
-
function
|
|
216
|
+
var Ze = /*@__PURE__*/ f.define();
|
|
217
|
+
function Qe(e) {
|
|
217
218
|
let t = e.addToOptions.slice();
|
|
218
219
|
return e.icons && t.push({
|
|
219
220
|
render(e) {
|
|
@@ -244,7 +245,7 @@ function Xe(e) {
|
|
|
244
245
|
position: 80
|
|
245
246
|
}), t.sort((e, t) => e.position - t.position).map((e) => e.render);
|
|
246
247
|
}
|
|
247
|
-
function
|
|
248
|
+
function $e(e, t, n) {
|
|
248
249
|
if (e <= n) return {
|
|
249
250
|
from: 0,
|
|
250
251
|
to: e
|
|
@@ -262,15 +263,15 @@ function Ze(e, t, n) {
|
|
|
262
263
|
to: e - (r - 1) * n
|
|
263
264
|
};
|
|
264
265
|
}
|
|
265
|
-
var
|
|
266
|
+
var et = class {
|
|
266
267
|
constructor(e, t, n) {
|
|
267
268
|
this.view = e, this.stateField = t, this.applyCompletion = n, this.info = null, this.infoDestroy = null, this.placeInfoReq = {
|
|
268
269
|
read: () => this.measureInfo(),
|
|
269
270
|
write: (e) => this.placeInfo(e),
|
|
270
271
|
key: this
|
|
271
272
|
}, this.space = null, this.currentClass = "";
|
|
272
|
-
let r = e.state.field(t), { options: i, selected: a } = r.open, o = e.state.facet(
|
|
273
|
-
this.optionContent =
|
|
273
|
+
let r = e.state.field(t), { options: i, selected: a } = r.open, o = e.state.facet(O);
|
|
274
|
+
this.optionContent = Qe(o), this.optionClass = o.optionClass, this.tooltipClass = o.tooltipClass, this.range = $e(i.length, a, o.maxRenderedOptions), this.dom = document.createElement("div"), this.dom.className = "cm-tooltip-autocomplete", this.updateTooltipClass(e.state), this.dom.addEventListener("mousedown", (n) => {
|
|
274
275
|
let { options: r } = e.state.field(t).open;
|
|
275
276
|
for (let t = n.target, i; t && t != this.dom; t = t.parentNode) if (t.nodeName == "LI" && (i = /-(\d+)$/.exec(t.id)) && +i[1] < r.length) {
|
|
276
277
|
this.applyCompletion(e, r[+i[1]]), n.preventDefault();
|
|
@@ -278,11 +279,11 @@ var Qe = class {
|
|
|
278
279
|
}
|
|
279
280
|
if (n.target == this.list) {
|
|
280
281
|
let t = this.list.classList.contains("cm-completionListIncompleteTop") && n.clientY < this.list.firstChild.getBoundingClientRect().top ? this.range.from - 1 : this.list.classList.contains("cm-completionListIncompleteBottom") && n.clientY > this.list.lastChild.getBoundingClientRect().bottom ? this.range.to : null;
|
|
281
|
-
t != null && (e.dispatch({ effects:
|
|
282
|
+
t != null && (e.dispatch({ effects: Ze.of(t) }), n.preventDefault());
|
|
282
283
|
}
|
|
283
284
|
}), this.dom.addEventListener("focusout", (t) => {
|
|
284
285
|
let n = e.state.field(this.stateField, !1);
|
|
285
|
-
n && n.tooltip && e.state.facet(
|
|
286
|
+
n && n.tooltip && e.state.facet(O).closeOnBlur && t.relatedTarget != e.contentDOM && e.dispatch({ effects: D.of(null) });
|
|
286
287
|
}), this.showOptions(i, r.id);
|
|
287
288
|
}
|
|
288
289
|
mount() {
|
|
@@ -297,7 +298,7 @@ var Qe = class {
|
|
|
297
298
|
let t = e.state.field(this.stateField), n = e.startState.field(this.stateField);
|
|
298
299
|
if (this.updateTooltipClass(e.state), t != n) {
|
|
299
300
|
let { options: r, selected: i, disabled: a } = t.open;
|
|
300
|
-
(!n.open || n.open.options != r) && (this.range =
|
|
301
|
+
(!n.open || n.open.options != r) && (this.range = $e(r.length, i, e.state.facet(O).maxRenderedOptions), this.showOptions(r, t.id)), this.updateSel(), a != n.open?.disabled && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!a);
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
updateTooltipClass(e) {
|
|
@@ -313,7 +314,7 @@ var Qe = class {
|
|
|
313
314
|
}
|
|
314
315
|
updateSel() {
|
|
315
316
|
let e = this.view.state.field(this.stateField), t = e.open;
|
|
316
|
-
(t.selected > -1 && t.selected < this.range.from || t.selected >= this.range.to) && (this.range =
|
|
317
|
+
(t.selected > -1 && t.selected < this.range.from || t.selected >= this.range.to) && (this.range = $e(t.options.length, t.selected, this.view.state.facet(O).maxRenderedOptions), this.showOptions(t.options, e.id));
|
|
317
318
|
let n = this.updateSelectedOption(t.selected);
|
|
318
319
|
if (n) {
|
|
319
320
|
this.destroyInfo();
|
|
@@ -323,7 +324,7 @@ var Qe = class {
|
|
|
323
324
|
if (!a) return;
|
|
324
325
|
"then" in a ? a.then((t) => {
|
|
325
326
|
t && this.view.state.field(this.stateField, !1) == e && this.addInfoPane(t, r);
|
|
326
|
-
}).catch((e) =>
|
|
327
|
+
}).catch((e) => _(this.view.state, e, "completion info")) : (this.addInfoPane(a, r), n.setAttribute("aria-describedby", this.info.id));
|
|
327
328
|
}
|
|
328
329
|
}
|
|
329
330
|
addInfoPane(e, t) {
|
|
@@ -339,7 +340,7 @@ var Qe = class {
|
|
|
339
340
|
updateSelectedOption(e) {
|
|
340
341
|
let t = null;
|
|
341
342
|
for (let n = this.list.firstChild, r = this.range.from; n; n = n.nextSibling, r++) n.nodeName != "LI" || !n.id ? r-- : r == e ? n.hasAttribute("aria-selected") || (n.setAttribute("aria-selected", "true"), t = n) : n.hasAttribute("aria-selected") && (n.removeAttribute("aria-selected"), n.removeAttribute("aria-describedby"));
|
|
342
|
-
return t &&
|
|
343
|
+
return t && nt(this.list, t), t;
|
|
343
344
|
}
|
|
344
345
|
measureInfo() {
|
|
345
346
|
let e = this.dom.querySelector("[aria-selected]");
|
|
@@ -354,7 +355,7 @@ var Qe = class {
|
|
|
354
355
|
bottom: e.clientHeight
|
|
355
356
|
};
|
|
356
357
|
}
|
|
357
|
-
return r.top > Math.min(i.bottom, t.bottom) - 10 || r.bottom < Math.max(i.top, t.top) + 10 ? null : this.view.state.facet(
|
|
358
|
+
return r.top > Math.min(i.bottom, t.bottom) - 10 || r.bottom < Math.max(i.top, t.top) + 10 ? null : this.view.state.facet(O).positionInfo(this.view, t, r, n, i, this.dom);
|
|
358
359
|
}
|
|
359
360
|
placeInfo(e) {
|
|
360
361
|
this.info && (e ? (e.style && (this.info.style.cssText = e.style), this.info.className = "cm-tooltip cm-completionInfo " + (e.class || "")) : this.info.style.cssText = "top: -1e6px");
|
|
@@ -395,17 +396,17 @@ var Qe = class {
|
|
|
395
396
|
this.destroyInfo();
|
|
396
397
|
}
|
|
397
398
|
};
|
|
398
|
-
function
|
|
399
|
-
return (n) => new
|
|
399
|
+
function tt(e, t) {
|
|
400
|
+
return (n) => new et(n, e, t);
|
|
400
401
|
}
|
|
401
|
-
function
|
|
402
|
+
function nt(e, t) {
|
|
402
403
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = n.height / e.offsetHeight;
|
|
403
404
|
r.top < n.top ? e.scrollTop -= (n.top - r.top) / i : r.bottom > n.bottom && (e.scrollTop += (r.bottom - n.bottom) / i);
|
|
404
405
|
}
|
|
405
|
-
function
|
|
406
|
+
function rt(e) {
|
|
406
407
|
return (e.boost || 0) * 100 + (e.apply ? 10 : 0) + (e.info ? 5 : 0) + +!!e.type;
|
|
407
408
|
}
|
|
408
|
-
function
|
|
409
|
+
function it(e, t) {
|
|
409
410
|
let n = [], r = null, i = null, a = (e) => {
|
|
410
411
|
n.push(e);
|
|
411
412
|
let { section: t } = e.completion;
|
|
@@ -414,15 +415,15 @@ function nt(e, t) {
|
|
|
414
415
|
let e = typeof t == "string" ? t : t.name;
|
|
415
416
|
r.some((t) => t.name == e) || r.push(typeof t == "string" ? { name: e } : t);
|
|
416
417
|
}
|
|
417
|
-
}, o = t.facet(
|
|
418
|
+
}, o = t.facet(O);
|
|
418
419
|
for (let r of e) if (r.hasResult()) {
|
|
419
420
|
let e = r.result.getMatch;
|
|
420
|
-
if (r.result.filter === !1) for (let t of r.result.options) a(new
|
|
421
|
+
if (r.result.filter === !1) for (let t of r.result.options) a(new Be(t, r.source, e ? e(t) : [], 1e9 - n.length));
|
|
421
422
|
else {
|
|
422
|
-
let n = t.sliceDoc(r.from, r.to), s, c = o.filterStrict ? new
|
|
423
|
+
let n = t.sliceDoc(r.from, r.to), s, c = o.filterStrict ? new Je(n) : new qe(n);
|
|
423
424
|
for (let t of r.result.options) if (s = c.match(t.label)) {
|
|
424
425
|
let n = t.displayLabel ? e ? e(t, s.matched) : [] : s.matched, o = s.score + (t.boost || 0);
|
|
425
|
-
if (a(new
|
|
426
|
+
if (a(new Be(t, r.source, n, o)), typeof t.section == "object" && t.section.rank === "dynamic") {
|
|
426
427
|
let { name: e } = t.section;
|
|
427
428
|
i ||= Object.create(null), i[e] = Math.max(o, i[e] || -1e9);
|
|
428
429
|
}
|
|
@@ -440,22 +441,22 @@ function nt(e, t) {
|
|
|
440
441
|
let s = [], c = null, l = o.compareCompletions;
|
|
441
442
|
for (let e of n.sort((e, t) => t.score - e.score || l(e.completion, t.completion))) {
|
|
442
443
|
let t = e.completion;
|
|
443
|
-
!c || c.label != t.label || c.detail != t.detail || c.type != null && t.type != null && c.type != t.type || c.apply != t.apply || c.boost != t.boost ? s.push(e) :
|
|
444
|
+
!c || c.label != t.label || c.detail != t.detail || c.type != null && t.type != null && c.type != t.type || c.apply != t.apply || c.boost != t.boost ? s.push(e) : rt(e.completion) > rt(c) && (s[s.length - 1] = e), c = e.completion;
|
|
444
445
|
}
|
|
445
446
|
return s;
|
|
446
447
|
}
|
|
447
|
-
var
|
|
448
|
+
var at = class e {
|
|
448
449
|
constructor(e, t, n, r, i, a) {
|
|
449
450
|
this.options = e, this.attrs = t, this.tooltip = n, this.timestamp = r, this.selected = i, this.disabled = a;
|
|
450
451
|
}
|
|
451
452
|
setSelected(t, n) {
|
|
452
|
-
return t == this.selected || t >= this.options.length ? this : new e(this.options,
|
|
453
|
+
return t == this.selected || t >= this.options.length ? this : new e(this.options, ut(n, t), this.tooltip, this.timestamp, t, this.disabled);
|
|
453
454
|
}
|
|
454
455
|
static build(t, n, r, i, a, o) {
|
|
455
456
|
if (i && !o && t.some((e) => e.isPending)) return i.setDisabled();
|
|
456
|
-
let s =
|
|
457
|
+
let s = it(t, n);
|
|
457
458
|
if (!s.length) return i && t.some((e) => e.isPending) ? i.setDisabled() : null;
|
|
458
|
-
let c = n.facet(
|
|
459
|
+
let c = n.facet(O).selectOnOpen ? 0 : -1;
|
|
459
460
|
if (i && i.selected != c && i.selected != -1) {
|
|
460
461
|
let e = i.options[i.selected].completion;
|
|
461
462
|
for (let t = 0; t < s.length; t++) if (s[t].completion == e) {
|
|
@@ -463,9 +464,9 @@ var rt = class e {
|
|
|
463
464
|
break;
|
|
464
465
|
}
|
|
465
466
|
}
|
|
466
|
-
return new e(s,
|
|
467
|
+
return new e(s, ut(r, c), {
|
|
467
468
|
pos: t.reduce((e, t) => t.hasResult() ? Math.min(e, t.from) : e, 1e8),
|
|
468
|
-
create:
|
|
469
|
+
create: _t,
|
|
469
470
|
above: a.aboveCursor
|
|
470
471
|
}, i ? i.timestamp : Date.now(), c, !1);
|
|
471
472
|
}
|
|
@@ -478,29 +479,29 @@ var rt = class e {
|
|
|
478
479
|
setDisabled() {
|
|
479
480
|
return new e(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, !0);
|
|
480
481
|
}
|
|
481
|
-
},
|
|
482
|
+
}, ot = class e {
|
|
482
483
|
constructor(e, t, n) {
|
|
483
484
|
this.active = e, this.id = t, this.open = n;
|
|
484
485
|
}
|
|
485
486
|
static start() {
|
|
486
|
-
return new e(
|
|
487
|
+
return new e(dt, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
|
|
487
488
|
}
|
|
488
489
|
update(t) {
|
|
489
|
-
let { state: n } = t, r = n.facet(
|
|
490
|
+
let { state: n } = t, r = n.facet(O), i = (r.override || n.languageDataAt("autocomplete", E(n)).map(Ge)).map((e) => (this.active.find((t) => t.source == e) || new k(e, +!!this.active.some((e) => e.state != 0))).update(t, r));
|
|
490
491
|
i.length == this.active.length && i.every((e, t) => e == this.active[t]) && (i = this.active);
|
|
491
|
-
let a = this.open, o = t.effects.some((e) => e.is(
|
|
492
|
-
a && t.docChanged && (a = a.map(t.changes)), t.selection || i.some((e) => e.hasResult() && t.changes.touchesRange(e.from, e.to)) || !
|
|
493
|
-
for (let e of t.effects) e.is(
|
|
492
|
+
let a = this.open, o = t.effects.some((e) => e.is(ht));
|
|
493
|
+
a && t.docChanged && (a = a.map(t.changes)), t.selection || i.some((e) => e.hasResult() && t.changes.touchesRange(e.from, e.to)) || !st(i, this.active) || o ? a = at.build(i, n, this.id, a, r, o) : a && a.disabled && !i.some((e) => e.isPending) && (a = null), !a && i.every((e) => !e.isPending) && i.some((e) => e.hasResult()) && (i = i.map((e) => e.hasResult() ? new k(e.source, 0) : e));
|
|
494
|
+
for (let e of t.effects) e.is(Ze) && (a &&= a.setSelected(e.value, this.id));
|
|
494
495
|
return i == this.active && a == this.open ? this : new e(i, this.id, a);
|
|
495
496
|
}
|
|
496
497
|
get tooltip() {
|
|
497
498
|
return this.open ? this.open.tooltip : null;
|
|
498
499
|
}
|
|
499
500
|
get attrs() {
|
|
500
|
-
return this.open ? this.open.attrs : this.active.length ?
|
|
501
|
+
return this.open ? this.open.attrs : this.active.length ? ct : lt;
|
|
501
502
|
}
|
|
502
503
|
};
|
|
503
|
-
function
|
|
504
|
+
function st(e, t) {
|
|
504
505
|
if (e == t) return !0;
|
|
505
506
|
for (let n = 0, r = 0;;) {
|
|
506
507
|
for (; n < e.length && !e[n].hasResult();) n++;
|
|
@@ -510,8 +511,8 @@ function at(e, t) {
|
|
|
510
511
|
if (e[n++].result != t[r++].result) return !1;
|
|
511
512
|
}
|
|
512
513
|
}
|
|
513
|
-
var
|
|
514
|
-
function
|
|
514
|
+
var ct = { "aria-autocomplete": "list" }, lt = {};
|
|
515
|
+
function ut(e, t) {
|
|
515
516
|
let n = {
|
|
516
517
|
"aria-autocomplete": "list",
|
|
517
518
|
"aria-haspopup": "listbox",
|
|
@@ -519,16 +520,16 @@ function ct(e, t) {
|
|
|
519
520
|
};
|
|
520
521
|
return t > -1 && (n["aria-activedescendant"] = e + "-" + t), n;
|
|
521
522
|
}
|
|
522
|
-
var
|
|
523
|
-
function
|
|
523
|
+
var dt = [];
|
|
524
|
+
function ft(e, t) {
|
|
524
525
|
if (e.isUserEvent("input.complete")) {
|
|
525
|
-
let n = e.annotation(
|
|
526
|
+
let n = e.annotation(He);
|
|
526
527
|
if (n && t.activateOnCompletion(n)) return 12;
|
|
527
528
|
}
|
|
528
529
|
let n = e.isUserEvent("input.type");
|
|
529
530
|
return n && t.activateOnTyping ? 5 : n ? 1 : e.isUserEvent("delete.backward") ? 2 : e.selection ? 8 : e.docChanged ? 16 : 0;
|
|
530
531
|
}
|
|
531
|
-
var
|
|
532
|
+
var k = class e {
|
|
532
533
|
constructor(e, t, n = !1) {
|
|
533
534
|
this.source = e, this.state = t, this.explicit = n;
|
|
534
535
|
}
|
|
@@ -539,11 +540,11 @@ var j = class e {
|
|
|
539
540
|
return this.state == 1;
|
|
540
541
|
}
|
|
541
542
|
update(t, n) {
|
|
542
|
-
let r =
|
|
543
|
+
let r = ft(t, n), i = this;
|
|
543
544
|
(r & 8 || r & 16 && this.touches(t)) && (i = new e(i.source, 0)), r & 4 && i.state == 0 && (i = new e(this.source, 1)), i = i.updateFor(t, r);
|
|
544
|
-
for (let n of t.effects) if (n.is(
|
|
545
|
-
else if (n.is(
|
|
546
|
-
else if (n.is(
|
|
545
|
+
for (let n of t.effects) if (n.is(Ke)) i = new e(i.source, 1, n.value);
|
|
546
|
+
else if (n.is(D)) i = new e(i.source, 0);
|
|
547
|
+
else if (n.is(ht)) for (let e of n.value) e.source == i.source && (i = e);
|
|
547
548
|
return i;
|
|
548
549
|
}
|
|
549
550
|
updateFor(e, t) {
|
|
@@ -553,9 +554,9 @@ var j = class e {
|
|
|
553
554
|
return this;
|
|
554
555
|
}
|
|
555
556
|
touches(e) {
|
|
556
|
-
return e.changes.touchesRange(
|
|
557
|
+
return e.changes.touchesRange(E(e.state));
|
|
557
558
|
}
|
|
558
|
-
},
|
|
559
|
+
}, pt = class e extends k {
|
|
559
560
|
constructor(e, t, n, r, i, a) {
|
|
560
561
|
super(e, 3, t), this.limit = n, this.result = r, this.from = i, this.to = a;
|
|
561
562
|
}
|
|
@@ -566,116 +567,116 @@ var j = class e {
|
|
|
566
567
|
if (!(n & 3)) return this.map(t.changes);
|
|
567
568
|
let r = this.result;
|
|
568
569
|
r.map && !t.changes.empty && (r = r.map(r, t.changes));
|
|
569
|
-
let i = t.changes.mapPos(this.from), a = t.changes.mapPos(this.to, 1), o =
|
|
570
|
-
if (o > a || !r || n & 2 && (
|
|
570
|
+
let i = t.changes.mapPos(this.from), a = t.changes.mapPos(this.to, 1), o = E(t.state);
|
|
571
|
+
if (o > a || !r || n & 2 && (E(t.startState) == this.from || o < this.limit)) return new k(this.source, n & 4 ? 1 : 0);
|
|
571
572
|
let s = t.changes.mapPos(this.limit);
|
|
572
|
-
return
|
|
573
|
+
return mt(r.validFor, t.state, i, a) ? new e(this.source, this.explicit, s, r, i, a) : r.update && (r = r.update(r, i, a, new Fe(t.state, o, !1))) ? new e(this.source, this.explicit, s, r, r.from, r.to ?? E(t.state)) : new k(this.source, 1, this.explicit);
|
|
573
574
|
}
|
|
574
575
|
map(t) {
|
|
575
576
|
if (t.empty) return this;
|
|
576
577
|
let n = this.result.map ? this.result.map(this.result, t) : this.result;
|
|
577
|
-
return n ? new e(this.source, this.explicit, t.mapPos(this.limit), n, t.mapPos(this.from), t.mapPos(this.to, 1)) : new
|
|
578
|
+
return n ? new e(this.source, this.explicit, t.mapPos(this.limit), n, t.mapPos(this.from), t.mapPos(this.to, 1)) : new k(this.source, 0);
|
|
578
579
|
}
|
|
579
580
|
touches(e) {
|
|
580
581
|
return e.changes.touchesRange(this.from, this.to);
|
|
581
582
|
}
|
|
582
583
|
};
|
|
583
|
-
function
|
|
584
|
+
function mt(e, t, n, r) {
|
|
584
585
|
if (!e) return !1;
|
|
585
586
|
let i = t.sliceDoc(n, r);
|
|
586
|
-
return typeof e == "function" ? e(i, n, r, t) :
|
|
587
|
+
return typeof e == "function" ? e(i, n, r, t) : Ve(e, !0).test(i);
|
|
587
588
|
}
|
|
588
|
-
var
|
|
589
|
+
var ht = /*@__PURE__*/ f.define({ map(e, t) {
|
|
589
590
|
return e.map((e) => e.map(t));
|
|
590
|
-
} }),
|
|
591
|
+
} }), A = /*@__PURE__*/ o.define({
|
|
591
592
|
create() {
|
|
592
|
-
return
|
|
593
|
+
return ot.start();
|
|
593
594
|
},
|
|
594
595
|
update(e, t) {
|
|
595
596
|
return e.update(t);
|
|
596
597
|
},
|
|
597
|
-
provide: (e) => [
|
|
598
|
+
provide: (e) => [_e.from(e, (e) => e.tooltip), b.contentAttributes.from(e, (e) => e.attrs)]
|
|
598
599
|
});
|
|
599
|
-
function
|
|
600
|
-
let n = t.completion.apply || t.completion.label, r = e.state.field(
|
|
601
|
-
return r instanceof
|
|
602
|
-
...
|
|
603
|
-
annotations:
|
|
600
|
+
function gt(e, t) {
|
|
601
|
+
let n = t.completion.apply || t.completion.label, r = e.state.field(A).active.find((e) => e.source == t.source);
|
|
602
|
+
return r instanceof pt && (typeof n == "string" ? e.dispatch({
|
|
603
|
+
...Ue(e.state, n, r.from, r.to),
|
|
604
|
+
annotations: He.of(t.completion)
|
|
604
605
|
}) : n(e, t.completion, r.from, r.to), !0);
|
|
605
606
|
}
|
|
606
|
-
var
|
|
607
|
-
function
|
|
607
|
+
var _t = /*@__PURE__*/ tt(A, gt);
|
|
608
|
+
function vt(e, t = "option") {
|
|
608
609
|
return (n) => {
|
|
609
|
-
let r = n.state.field(
|
|
610
|
-
if (!r || !r.open || r.open.disabled || Date.now() - r.open.timestamp < n.state.facet(
|
|
610
|
+
let r = n.state.field(A, !1);
|
|
611
|
+
if (!r || !r.open || r.open.disabled || Date.now() - r.open.timestamp < n.state.facet(O).interactionDelay) return !1;
|
|
611
612
|
let i = 1, a;
|
|
612
|
-
t == "page" && (a =
|
|
613
|
+
t == "page" && (a = me(n, r.open.tooltip)) && (i = Math.max(2, Math.floor(a.dom.offsetHeight / a.dom.querySelector("li").offsetHeight) - 1));
|
|
613
614
|
let { length: o } = r.open.options, s = r.open.selected > -1 ? r.open.selected + i * (e ? 1 : -1) : e ? 0 : o - 1;
|
|
614
|
-
return s < 0 ? s = t == "page" ? 0 : o - 1 : s >= o && (s = t == "page" ? o - 1 : 0), n.dispatch({ effects:
|
|
615
|
+
return s < 0 ? s = t == "page" ? 0 : o - 1 : s >= o && (s = t == "page" ? o - 1 : 0), n.dispatch({ effects: Ze.of(s) }), !0;
|
|
615
616
|
};
|
|
616
617
|
}
|
|
617
|
-
var
|
|
618
|
-
let t = e.state.field(
|
|
619
|
-
return e.state.readOnly || !t || !t.open || t.open.selected < 0 || t.open.disabled || Date.now() - t.open.timestamp < e.state.facet(
|
|
620
|
-
},
|
|
621
|
-
let t = e.state.field(
|
|
622
|
-
return !t || !t.active.some((e) => e.state != 0) ? !1 : (e.dispatch({ effects:
|
|
623
|
-
},
|
|
618
|
+
var yt = (e) => {
|
|
619
|
+
let t = e.state.field(A, !1);
|
|
620
|
+
return e.state.readOnly || !t || !t.open || t.open.selected < 0 || t.open.disabled || Date.now() - t.open.timestamp < e.state.facet(O).interactionDelay ? !1 : gt(e, t.open.options[t.open.selected]);
|
|
621
|
+
}, bt = (e) => e.state.field(A, !1) ? (e.dispatch({ effects: Ke.of(!0) }), !0) : !1, xt = (e) => {
|
|
622
|
+
let t = e.state.field(A, !1);
|
|
623
|
+
return !t || !t.active.some((e) => e.state != 0) ? !1 : (e.dispatch({ effects: D.of(null) }), !0);
|
|
624
|
+
}, St = class {
|
|
624
625
|
constructor(e, t) {
|
|
625
626
|
this.active = e, this.context = t, this.time = Date.now(), this.updates = [], this.done = void 0;
|
|
626
627
|
}
|
|
627
|
-
},
|
|
628
|
+
}, Ct = 50, wt = 1e3, Tt = /*@__PURE__*/ v.fromClass(class {
|
|
628
629
|
constructor(e) {
|
|
629
630
|
this.view = e, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.pendingStart = !1, this.composing = 0;
|
|
630
|
-
for (let t of e.state.field(
|
|
631
|
+
for (let t of e.state.field(A).active) t.isPending && this.startQuery(t);
|
|
631
632
|
}
|
|
632
633
|
update(e) {
|
|
633
|
-
let t = e.state.field(
|
|
634
|
-
if (!e.selectionSet && !e.docChanged && e.startState.field(
|
|
634
|
+
let t = e.state.field(A), n = e.state.facet(O);
|
|
635
|
+
if (!e.selectionSet && !e.docChanged && e.startState.field(A) == t) return;
|
|
635
636
|
let r = e.transactions.some((e) => {
|
|
636
|
-
let t =
|
|
637
|
+
let t = ft(e, n);
|
|
637
638
|
return t & 8 || (e.selection || e.docChanged) && !(t & 3);
|
|
638
639
|
});
|
|
639
640
|
for (let t = 0; t < this.running.length; t++) {
|
|
640
641
|
let n = this.running[t];
|
|
641
|
-
if (r || n.context.abortOnDocChange && e.docChanged || n.updates.length + e.transactions.length >
|
|
642
|
+
if (r || n.context.abortOnDocChange && e.docChanged || n.updates.length + e.transactions.length > Ct && Date.now() - n.time > wt) {
|
|
642
643
|
for (let e of n.context.abortListeners) try {
|
|
643
644
|
e();
|
|
644
645
|
} catch (e) {
|
|
645
|
-
|
|
646
|
+
_(this.view.state, e);
|
|
646
647
|
}
|
|
647
648
|
n.context.abortListeners = null, this.running.splice(t--, 1);
|
|
648
649
|
} else n.updates.push(...e.transactions);
|
|
649
650
|
}
|
|
650
|
-
this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), e.transactions.some((e) => e.effects.some((e) => e.is(
|
|
651
|
+
this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), e.transactions.some((e) => e.effects.some((e) => e.is(Ke))) && (this.pendingStart = !0);
|
|
651
652
|
let i = this.pendingStart ? 50 : n.activateOnTypingDelay;
|
|
652
653
|
if (this.debounceUpdate = t.active.some((e) => e.isPending && !this.running.some((t) => t.active.source == e.source)) ? setTimeout(() => this.startUpdate(), i) : -1, this.composing != 0) for (let t of e.transactions) t.isUserEvent("input.type") ? this.composing = 2 : this.composing == 2 && t.selection && (this.composing = 3);
|
|
653
654
|
}
|
|
654
655
|
startUpdate() {
|
|
655
656
|
this.debounceUpdate = -1, this.pendingStart = !1;
|
|
656
|
-
let { state: e } = this.view, t = e.field(
|
|
657
|
+
let { state: e } = this.view, t = e.field(A);
|
|
657
658
|
for (let e of t.active) e.isPending && !this.running.some((t) => t.active.source == e.source) && this.startQuery(e);
|
|
658
|
-
this.running.length && t.open && t.open.disabled && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(
|
|
659
|
+
this.running.length && t.open && t.open.disabled && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(O).updateSyncTime));
|
|
659
660
|
}
|
|
660
661
|
startQuery(e) {
|
|
661
|
-
let { state: t } = this.view, n = new
|
|
662
|
+
let { state: t } = this.view, n = new Fe(t, E(t), e.explicit, this.view), r = new St(e, n);
|
|
662
663
|
this.running.push(r), Promise.resolve(e.source(n)).then((e) => {
|
|
663
664
|
r.context.aborted || (r.done = e || null, this.scheduleAccept());
|
|
664
665
|
}, (e) => {
|
|
665
|
-
this.view.dispatch({ effects:
|
|
666
|
+
this.view.dispatch({ effects: D.of(null) }), _(this.view.state, e);
|
|
666
667
|
});
|
|
667
668
|
}
|
|
668
669
|
scheduleAccept() {
|
|
669
|
-
this.running.every((e) => e.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(
|
|
670
|
+
this.running.every((e) => e.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(O).updateSyncTime));
|
|
670
671
|
}
|
|
671
672
|
accept() {
|
|
672
673
|
this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1;
|
|
673
|
-
let e = [], t = this.view.state.facet(
|
|
674
|
+
let e = [], t = this.view.state.facet(O), n = this.view.state.field(A);
|
|
674
675
|
for (let r = 0; r < this.running.length; r++) {
|
|
675
676
|
let i = this.running[r];
|
|
676
677
|
if (i.done === void 0) continue;
|
|
677
678
|
if (this.running.splice(r--, 1), i.done) {
|
|
678
|
-
let n =
|
|
679
|
+
let n = E(i.updates.length ? i.updates[0].startState : this.view.state), r = Math.min(n, i.done.from + +!i.active.explicit), a = new pt(i.active.source, i.active.explicit, r, i.done, i.done.from, i.done.to ?? n);
|
|
679
680
|
for (let e of i.updates) a = a.update(e, t);
|
|
680
681
|
if (a.hasResult()) {
|
|
681
682
|
e.push(a);
|
|
@@ -685,34 +686,34 @@ var _t = (e) => {
|
|
|
685
686
|
let a = n.active.find((e) => e.source == i.active.source);
|
|
686
687
|
if (a && a.isPending) {
|
|
687
688
|
if (i.done == null) {
|
|
688
|
-
let n = new
|
|
689
|
+
let n = new k(i.active.source, 0);
|
|
689
690
|
for (let e of i.updates) n = n.update(e, t);
|
|
690
691
|
n.isPending || e.push(n);
|
|
691
692
|
} else this.startQuery(a);
|
|
692
693
|
}
|
|
693
694
|
}
|
|
694
|
-
(e.length || n.open && n.open.disabled) && this.view.dispatch({ effects:
|
|
695
|
+
(e.length || n.open && n.open.disabled) && this.view.dispatch({ effects: ht.of(e) });
|
|
695
696
|
}
|
|
696
697
|
}, { eventHandlers: {
|
|
697
698
|
blur(e) {
|
|
698
|
-
let t = this.view.state.field(
|
|
699
|
-
if (t && t.tooltip && this.view.state.facet(
|
|
700
|
-
let n = t.open &&
|
|
701
|
-
(!n || !n.dom.contains(e.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects:
|
|
699
|
+
let t = this.view.state.field(A, !1);
|
|
700
|
+
if (t && t.tooltip && this.view.state.facet(O).closeOnBlur) {
|
|
701
|
+
let n = t.open && me(this.view, t.open.tooltip);
|
|
702
|
+
(!n || !n.dom.contains(e.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects: D.of(null) }), 10);
|
|
702
703
|
}
|
|
703
704
|
},
|
|
704
705
|
compositionstart() {
|
|
705
706
|
this.composing = 1;
|
|
706
707
|
},
|
|
707
708
|
compositionend() {
|
|
708
|
-
this.composing == 3 && setTimeout(() => this.view.dispatch({ effects:
|
|
709
|
+
this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: Ke.of(!1) }), 20), this.composing = 0;
|
|
709
710
|
}
|
|
710
|
-
} }),
|
|
711
|
-
let n = t.state.field(
|
|
712
|
-
if (!n || !n.open || n.open.disabled || n.open.selected < 0 || e.key.length > 1 || e.ctrlKey && !(
|
|
711
|
+
} }), Et = typeof navigator == "object" && /*@__PURE__*/ /Win/.test(navigator.platform), Dt = /*@__PURE__*/ t.highest(/*@__PURE__*/ b.domEventHandlers({ keydown(e, t) {
|
|
712
|
+
let n = t.state.field(A, !1);
|
|
713
|
+
if (!n || !n.open || n.open.disabled || n.open.selected < 0 || e.key.length > 1 || e.ctrlKey && !(Et && e.altKey) || e.metaKey) return !1;
|
|
713
714
|
let r = n.open.options[n.open.selected], i = n.active.find((e) => e.source == r.source), a = r.completion.commitCharacters || i.result.commitCharacters;
|
|
714
|
-
return a && a.indexOf(e.key) > -1 &&
|
|
715
|
-
} })),
|
|
715
|
+
return a && a.indexOf(e.key) > -1 && gt(t, r), !1;
|
|
716
|
+
} })), Ot = /*@__PURE__*/ b.baseTheme({
|
|
716
717
|
".cm-tooltip.cm-tooltip-autocomplete": { "& > ul": {
|
|
717
718
|
fontFamily: "monospace",
|
|
718
719
|
whiteSpace: "nowrap",
|
|
@@ -809,19 +810,19 @@ var _t = (e) => {
|
|
|
809
810
|
fontSize: "50%",
|
|
810
811
|
verticalAlign: "middle"
|
|
811
812
|
} }
|
|
812
|
-
}),
|
|
813
|
+
}), kt = class {
|
|
813
814
|
constructor(e, t, n, r) {
|
|
814
815
|
this.field = e, this.line = t, this.from = n, this.to = r;
|
|
815
816
|
}
|
|
816
|
-
},
|
|
817
|
+
}, At = class e {
|
|
817
818
|
constructor(e, t, n) {
|
|
818
819
|
this.field = e, this.from = t, this.to = n;
|
|
819
820
|
}
|
|
820
821
|
map(t) {
|
|
821
|
-
let n = t.mapPos(this.from, -1,
|
|
822
|
+
let n = t.mapPos(this.from, -1, se.TrackDel), r = t.mapPos(this.to, 1, se.TrackDel);
|
|
822
823
|
return n == null || r == null ? null : new e(this.field, n, r);
|
|
823
824
|
}
|
|
824
|
-
},
|
|
825
|
+
}, jt = class e {
|
|
825
826
|
constructor(e, t) {
|
|
826
827
|
this.lines = e, this.fieldPositions = t;
|
|
827
828
|
}
|
|
@@ -830,14 +831,14 @@ var _t = (e) => {
|
|
|
830
831
|
for (let i of this.lines) {
|
|
831
832
|
if (n.length) {
|
|
832
833
|
let n = a, o = /^\t*/.exec(i)[0].length;
|
|
833
|
-
for (let t = 0; t < o; t++) n += e.facet(
|
|
834
|
+
for (let t = 0; t < o; t++) n += e.facet(ke);
|
|
834
835
|
r.push(t + n.length - o), i = n + i.slice(o);
|
|
835
836
|
}
|
|
836
837
|
n.push(i), t += i.length + 1;
|
|
837
838
|
}
|
|
838
839
|
return {
|
|
839
840
|
text: n,
|
|
840
|
-
ranges: this.fieldPositions.map((e) => new
|
|
841
|
+
ranges: this.fieldPositions.map((e) => new At(e.field, r[e.line] + e.from, r[e.line] + e.to))
|
|
841
842
|
};
|
|
842
843
|
}
|
|
843
844
|
static parse(t) {
|
|
@@ -861,7 +862,7 @@ var _t = (e) => {
|
|
|
861
862
|
let t = a[2] ? 3 + (a[1] || "").length : 2;
|
|
862
863
|
e.from -= t, e.to -= t;
|
|
863
864
|
}
|
|
864
|
-
i.push(new
|
|
865
|
+
i.push(new kt(s, r.length, a.index, a.index + c.length)), e = e.slice(0, a.index) + o + e.slice(a.index + a[0].length);
|
|
865
866
|
}
|
|
866
867
|
e = e.replace(/\\([{}])/g, (e, t, n) => {
|
|
867
868
|
for (let e of i) e.line == r.length && e.from > n && (e.from--, e.to--);
|
|
@@ -870,7 +871,7 @@ var _t = (e) => {
|
|
|
870
871
|
}
|
|
871
872
|
return new e(r, i);
|
|
872
873
|
}
|
|
873
|
-
},
|
|
874
|
+
}, Mt = /*@__PURE__*/ x.widget({ widget: /*@__PURE__*/ new class extends de {
|
|
874
875
|
toDOM() {
|
|
875
876
|
let e = document.createElement("span");
|
|
876
877
|
return e.className = "cm-snippetFieldPosition", e;
|
|
@@ -878,9 +879,9 @@ var _t = (e) => {
|
|
|
878
879
|
ignoreEvent() {
|
|
879
880
|
return !1;
|
|
880
881
|
}
|
|
881
|
-
}() }),
|
|
882
|
+
}() }), Nt = /*@__PURE__*/ x.mark({ class: "cm-snippetField" }), Pt = class e {
|
|
882
883
|
constructor(e, t) {
|
|
883
|
-
this.ranges = e, this.active = t, this.deco =
|
|
884
|
+
this.ranges = e, this.active = t, this.deco = x.set(e.map((e) => (e.from == e.to ? Mt : Nt).range(e.from, e.to)), !0);
|
|
884
885
|
}
|
|
885
886
|
map(t) {
|
|
886
887
|
let n = [];
|
|
@@ -894,89 +895,89 @@ var _t = (e) => {
|
|
|
894
895
|
selectionInsideField(e) {
|
|
895
896
|
return e.ranges.every((e) => this.ranges.some((t) => t.field == this.active && t.from <= e.from && t.to >= e.to));
|
|
896
897
|
}
|
|
897
|
-
},
|
|
898
|
+
}, j = /*@__PURE__*/ f.define({ map(e, t) {
|
|
898
899
|
return e && e.map(t);
|
|
899
|
-
} }),
|
|
900
|
+
} }), Ft = /*@__PURE__*/ f.define(), M = /*@__PURE__*/ o.define({
|
|
900
901
|
create() {
|
|
901
902
|
return null;
|
|
902
903
|
},
|
|
903
904
|
update(e, t) {
|
|
904
905
|
for (let n of t.effects) {
|
|
905
|
-
if (n.is(
|
|
906
|
-
if (n.is(
|
|
906
|
+
if (n.is(j)) return n.value;
|
|
907
|
+
if (n.is(Ft) && e) return new Pt(e.ranges, n.value);
|
|
907
908
|
}
|
|
908
909
|
return e && t.docChanged && (e = e.map(t.changes)), e && t.selection && !e.selectionInsideField(t.selection) && (e = null), e;
|
|
909
910
|
},
|
|
910
|
-
provide: (e) =>
|
|
911
|
+
provide: (e) => b.decorations.from(e, (e) => e ? e.deco : x.none)
|
|
911
912
|
});
|
|
912
|
-
function
|
|
913
|
-
return
|
|
913
|
+
function It(e, t) {
|
|
914
|
+
return a.create(e.filter((e) => e.field == t).map((e) => a.range(e.from, e.to)));
|
|
914
915
|
}
|
|
915
|
-
function
|
|
916
|
-
let t =
|
|
916
|
+
function Lt(e) {
|
|
917
|
+
let t = jt.parse(e);
|
|
917
918
|
return (e, n, r, i) => {
|
|
918
|
-
let { text: a, ranges: o } = t.instantiate(e.state, r), { main: s } = e.state.selection,
|
|
919
|
+
let { text: a, ranges: o } = t.instantiate(e.state, r), { main: s } = e.state.selection, u = {
|
|
919
920
|
changes: {
|
|
920
921
|
from: r,
|
|
921
922
|
to: i == s.from ? s.to : i,
|
|
922
|
-
insert:
|
|
923
|
+
insert: c.of(a)
|
|
923
924
|
},
|
|
924
925
|
scrollIntoView: !0,
|
|
925
|
-
annotations: n ? [
|
|
926
|
+
annotations: n ? [He.of(n), l.userEvent.of("input.complete")] : void 0
|
|
926
927
|
};
|
|
927
|
-
if (o.length && (
|
|
928
|
-
let t = new
|
|
929
|
-
e.state.field(
|
|
930
|
-
|
|
931
|
-
zt,
|
|
928
|
+
if (o.length && (u.selection = It(o, 0)), o.some((e) => e.field > 0)) {
|
|
929
|
+
let t = new Pt(o, 0), n = u.effects = [j.of(t)];
|
|
930
|
+
e.state.field(M, !1) === void 0 && n.push(f.appendConfig.of([
|
|
931
|
+
M,
|
|
932
932
|
Vt,
|
|
933
|
-
|
|
933
|
+
Ut,
|
|
934
|
+
Ot
|
|
934
935
|
]));
|
|
935
936
|
}
|
|
936
|
-
e.dispatch(e.state.update(
|
|
937
|
+
e.dispatch(e.state.update(u));
|
|
937
938
|
};
|
|
938
939
|
}
|
|
939
|
-
function
|
|
940
|
+
function Rt(e) {
|
|
940
941
|
return ({ state: t, dispatch: n }) => {
|
|
941
|
-
let r = t.field(
|
|
942
|
+
let r = t.field(M, !1);
|
|
942
943
|
if (!r || e < 0 && r.active == 0) return !1;
|
|
943
944
|
let i = r.active + e, a = e > 0 && !r.ranges.some((t) => t.field == i + e);
|
|
944
945
|
return n(t.update({
|
|
945
|
-
selection:
|
|
946
|
-
effects:
|
|
946
|
+
selection: It(r.ranges, i),
|
|
947
|
+
effects: j.of(a ? null : new Pt(r.ranges, i)),
|
|
947
948
|
scrollIntoView: !0
|
|
948
949
|
})), !0;
|
|
949
950
|
};
|
|
950
951
|
}
|
|
951
|
-
var
|
|
952
|
+
var zt = [{
|
|
952
953
|
key: "Tab",
|
|
953
|
-
run: /* @__PURE__ */
|
|
954
|
-
shift: /* @__PURE__ */
|
|
954
|
+
run: /* @__PURE__ */ Rt(1),
|
|
955
|
+
shift: /* @__PURE__ */ Rt(-1)
|
|
955
956
|
}, {
|
|
956
957
|
key: "Escape",
|
|
957
|
-
run: ({ state: e, dispatch: t }) => e.field(
|
|
958
|
-
}],
|
|
959
|
-
return e.length ? e[0] :
|
|
960
|
-
} }),
|
|
961
|
-
function
|
|
958
|
+
run: ({ state: e, dispatch: t }) => e.field(M, !1) ? (t(e.update({ effects: j.of(null) })), !0) : !1
|
|
959
|
+
}], Bt = /*@__PURE__*/ d.define({ combine(e) {
|
|
960
|
+
return e.length ? e[0] : zt;
|
|
961
|
+
} }), Vt = /*@__PURE__*/ t.highest(/*@__PURE__*/ ie.compute([Bt], (e) => e.facet(Bt)));
|
|
962
|
+
function Ht(e, t) {
|
|
962
963
|
return {
|
|
963
964
|
...t,
|
|
964
|
-
apply:
|
|
965
|
+
apply: Lt(e)
|
|
965
966
|
};
|
|
966
967
|
}
|
|
967
|
-
var
|
|
968
|
-
let n = t.state.field(
|
|
968
|
+
var Ut = /*@__PURE__*/ b.domEventHandlers({ mousedown(e, t) {
|
|
969
|
+
let n = t.state.field(M, !1), r;
|
|
969
970
|
if (!n || (r = t.posAtCoords({
|
|
970
971
|
x: e.clientX,
|
|
971
972
|
y: e.clientY
|
|
972
973
|
})) == null) return !1;
|
|
973
974
|
let i = n.ranges.find((e) => e.from <= r && e.to >= r);
|
|
974
975
|
return !i || i.field == n.active ? !1 : (t.dispatch({
|
|
975
|
-
selection:
|
|
976
|
-
effects:
|
|
976
|
+
selection: It(n.ranges, i.field),
|
|
977
|
+
effects: j.of(n.ranges.some((e) => e.field > i.field) ? new Pt(n.ranges, i.field) : null),
|
|
977
978
|
scrollIntoView: !0
|
|
978
979
|
}), !0);
|
|
979
|
-
} }),
|
|
980
|
+
} }), N = {
|
|
980
981
|
brackets: [
|
|
981
982
|
"(",
|
|
982
983
|
"[",
|
|
@@ -986,53 +987,53 @@ var Vt = /*@__PURE__*/ m.domEventHandlers({ mousedown(e, t) {
|
|
|
986
987
|
],
|
|
987
988
|
before: ")]}:;>",
|
|
988
989
|
stringPrefixes: []
|
|
989
|
-
},
|
|
990
|
-
return t.mapPos(e, -1,
|
|
991
|
-
} }),
|
|
992
|
-
|
|
993
|
-
var
|
|
990
|
+
}, P = /*@__PURE__*/ f.define({ map(e, t) {
|
|
991
|
+
return t.mapPos(e, -1, se.TrackAfter) ?? void 0;
|
|
992
|
+
} }), Wt = /*@__PURE__*/ new class extends u {}();
|
|
993
|
+
Wt.startSide = 1, Wt.endSide = -1;
|
|
994
|
+
var Gt = /*@__PURE__*/ o.define({
|
|
994
995
|
create() {
|
|
995
|
-
return
|
|
996
|
+
return oe.empty;
|
|
996
997
|
},
|
|
997
998
|
update(e, t) {
|
|
998
999
|
if (e = e.map(t.changes), t.selection) {
|
|
999
1000
|
let n = t.state.doc.lineAt(t.selection.main.head);
|
|
1000
1001
|
e = e.update({ filter: (e) => e >= n.from && e <= n.to });
|
|
1001
1002
|
}
|
|
1002
|
-
for (let n of t.effects) n.is(
|
|
1003
|
+
for (let n of t.effects) n.is(P) && (e = e.update({ add: [Wt.range(n.value, n.value + 1)] }));
|
|
1003
1004
|
return e;
|
|
1004
1005
|
}
|
|
1005
1006
|
});
|
|
1006
|
-
function
|
|
1007
|
-
return [
|
|
1007
|
+
function Kt() {
|
|
1008
|
+
return [Zt, Gt];
|
|
1008
1009
|
}
|
|
1009
|
-
var
|
|
1010
|
-
function
|
|
1011
|
-
for (let t = 0; t < 16; t += 2) if (
|
|
1012
|
-
return
|
|
1010
|
+
var qt = "()[]{}<>«»»«[]{}";
|
|
1011
|
+
function Jt(e) {
|
|
1012
|
+
for (let t = 0; t < 16; t += 2) if (qt.charCodeAt(t) == e) return qt.charAt(t + 1);
|
|
1013
|
+
return ee(e < 128 ? e : e + 1);
|
|
1013
1014
|
}
|
|
1014
|
-
function
|
|
1015
|
-
return e.languageDataAt("closeBrackets", t)[0] ||
|
|
1015
|
+
function Yt(e, t) {
|
|
1016
|
+
return e.languageDataAt("closeBrackets", t)[0] || N;
|
|
1016
1017
|
}
|
|
1017
|
-
var
|
|
1018
|
-
if ((
|
|
1018
|
+
var Xt = typeof navigator == "object" && /*@__PURE__*/ /Android\b/.test(navigator.userAgent), Zt = /*@__PURE__*/ b.inputHandler.of((e, t, n, r) => {
|
|
1019
|
+
if ((Xt ? e.composing : e.compositionStarted) || e.state.readOnly) return !1;
|
|
1019
1020
|
let i = e.state.selection.main;
|
|
1020
|
-
if (r.length > 2 || r.length == 2 &&
|
|
1021
|
-
let a =
|
|
1021
|
+
if (r.length > 2 || r.length == 2 && C(p(r, 0)) == 1 || t != i.from || n != i.to) return !1;
|
|
1022
|
+
let a = $t(e.state, r);
|
|
1022
1023
|
return a ? (e.dispatch(a), !0) : !1;
|
|
1023
|
-
}),
|
|
1024
|
+
}), Qt = [{
|
|
1024
1025
|
key: "Backspace",
|
|
1025
1026
|
run: ({ state: e, dispatch: t }) => {
|
|
1026
1027
|
if (e.readOnly) return !1;
|
|
1027
|
-
let n =
|
|
1028
|
+
let n = Yt(e, e.selection.main.head).brackets || N.brackets, r = null, i = e.changeByRange((t) => {
|
|
1028
1029
|
if (t.empty) {
|
|
1029
|
-
let r =
|
|
1030
|
-
for (let i of n) if (i == r &&
|
|
1030
|
+
let r = nn(e.doc, t.head);
|
|
1031
|
+
for (let i of n) if (i == r && tn(e.doc, t.head) == Jt(p(i, 0))) return {
|
|
1031
1032
|
changes: {
|
|
1032
1033
|
from: t.head - i.length,
|
|
1033
1034
|
to: t.head + i.length
|
|
1034
1035
|
},
|
|
1035
|
-
range:
|
|
1036
|
+
range: a.cursor(t.head - i.length)
|
|
1036
1037
|
};
|
|
1037
1038
|
}
|
|
1038
1039
|
return { range: r = t };
|
|
@@ -1043,73 +1044,73 @@ var Jt = typeof navigator == "object" && /*@__PURE__*/ /Android\b/.test(navigato
|
|
|
1043
1044
|
})), !r;
|
|
1044
1045
|
}
|
|
1045
1046
|
}];
|
|
1046
|
-
function
|
|
1047
|
-
let n =
|
|
1047
|
+
function $t(e, t) {
|
|
1048
|
+
let n = Yt(e, e.selection.main.head), r = n.brackets || N.brackets;
|
|
1048
1049
|
for (let i of r) {
|
|
1049
|
-
let a =
|
|
1050
|
-
if (t == i) return a == i ?
|
|
1051
|
-
if (t == a &&
|
|
1050
|
+
let a = Jt(p(i, 0));
|
|
1051
|
+
if (t == i) return a == i ? on(e, i, r.indexOf(i + i + i) > -1, n) : rn(e, i, a, n.before || N.before);
|
|
1052
|
+
if (t == a && en(e, e.selection.main.from)) return an(e, i, a);
|
|
1052
1053
|
}
|
|
1053
1054
|
return null;
|
|
1054
1055
|
}
|
|
1055
|
-
function
|
|
1056
|
+
function en(e, t) {
|
|
1056
1057
|
let n = !1;
|
|
1057
|
-
return e.field(
|
|
1058
|
+
return e.field(Gt).between(0, e.doc.length, (e) => {
|
|
1058
1059
|
e == t && (n = !0);
|
|
1059
1060
|
}), n;
|
|
1060
1061
|
}
|
|
1061
|
-
function
|
|
1062
|
+
function tn(e, t) {
|
|
1062
1063
|
let n = e.sliceString(t, t + 2);
|
|
1063
|
-
return n.slice(0,
|
|
1064
|
+
return n.slice(0, C(p(n, 0)));
|
|
1064
1065
|
}
|
|
1065
|
-
function
|
|
1066
|
+
function nn(e, t) {
|
|
1066
1067
|
let n = e.sliceString(t - 2, t);
|
|
1067
|
-
return
|
|
1068
|
+
return C(p(n, 0)) == n.length ? n : n.slice(1);
|
|
1068
1069
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let i = null,
|
|
1071
|
-
if (!
|
|
1070
|
+
function rn(e, t, n, r) {
|
|
1071
|
+
let i = null, o = e.changeByRange((o) => {
|
|
1072
|
+
if (!o.empty) return {
|
|
1072
1073
|
changes: [{
|
|
1073
1074
|
insert: t,
|
|
1074
|
-
from:
|
|
1075
|
+
from: o.from
|
|
1075
1076
|
}, {
|
|
1076
1077
|
insert: n,
|
|
1077
|
-
from:
|
|
1078
|
+
from: o.to
|
|
1078
1079
|
}],
|
|
1079
|
-
effects:
|
|
1080
|
-
range:
|
|
1080
|
+
effects: P.of(o.to + t.length),
|
|
1081
|
+
range: a.range(o.anchor + t.length, o.head + t.length)
|
|
1081
1082
|
};
|
|
1082
|
-
let
|
|
1083
|
-
return !
|
|
1083
|
+
let s = tn(e.doc, o.head);
|
|
1084
|
+
return !s || /\s/.test(s) || r.indexOf(s) > -1 ? {
|
|
1084
1085
|
changes: {
|
|
1085
1086
|
insert: t + n,
|
|
1086
|
-
from:
|
|
1087
|
+
from: o.head
|
|
1087
1088
|
},
|
|
1088
|
-
effects:
|
|
1089
|
-
range:
|
|
1090
|
-
} : { range: i =
|
|
1089
|
+
effects: P.of(o.head + t.length),
|
|
1090
|
+
range: a.cursor(o.head + t.length)
|
|
1091
|
+
} : { range: i = o };
|
|
1091
1092
|
});
|
|
1092
|
-
return i ? null : e.update(
|
|
1093
|
+
return i ? null : e.update(o, {
|
|
1093
1094
|
scrollIntoView: !0,
|
|
1094
1095
|
userEvent: "input.type"
|
|
1095
1096
|
});
|
|
1096
1097
|
}
|
|
1097
|
-
function
|
|
1098
|
-
let r = null, i = e.changeByRange((t) => t.empty &&
|
|
1098
|
+
function an(e, t, n) {
|
|
1099
|
+
let r = null, i = e.changeByRange((t) => t.empty && tn(e.doc, t.head) == n ? {
|
|
1099
1100
|
changes: {
|
|
1100
1101
|
from: t.head,
|
|
1101
1102
|
to: t.head + n.length,
|
|
1102
1103
|
insert: n
|
|
1103
1104
|
},
|
|
1104
|
-
range:
|
|
1105
|
+
range: a.cursor(t.head + n.length)
|
|
1105
1106
|
} : r = { range: t });
|
|
1106
1107
|
return r ? null : e.update(i, {
|
|
1107
1108
|
scrollIntoView: !0,
|
|
1108
1109
|
userEvent: "input.type"
|
|
1109
1110
|
});
|
|
1110
1111
|
}
|
|
1111
|
-
function
|
|
1112
|
-
let i = r.stringPrefixes ||
|
|
1112
|
+
function on(e, t, n, r) {
|
|
1113
|
+
let i = r.stringPrefixes || N.stringPrefixes, o = null, s = e.changeByRange((r) => {
|
|
1113
1114
|
if (!r.empty) return {
|
|
1114
1115
|
changes: [{
|
|
1115
1116
|
insert: t,
|
|
@@ -1118,59 +1119,59 @@ function rn(e, t, n, r) {
|
|
|
1118
1119
|
insert: t,
|
|
1119
1120
|
from: r.to
|
|
1120
1121
|
}],
|
|
1121
|
-
effects:
|
|
1122
|
-
range:
|
|
1122
|
+
effects: P.of(r.to + t.length),
|
|
1123
|
+
range: a.range(r.anchor + t.length, r.head + t.length)
|
|
1123
1124
|
};
|
|
1124
|
-
let
|
|
1125
|
-
if (
|
|
1126
|
-
if (
|
|
1125
|
+
let s = r.head, c = tn(e.doc, s), l;
|
|
1126
|
+
if (c == t) {
|
|
1127
|
+
if (sn(e, s)) return {
|
|
1127
1128
|
changes: {
|
|
1128
1129
|
insert: t + t,
|
|
1129
|
-
from:
|
|
1130
|
+
from: s
|
|
1130
1131
|
},
|
|
1131
|
-
effects:
|
|
1132
|
-
range:
|
|
1132
|
+
effects: P.of(s + t.length),
|
|
1133
|
+
range: a.cursor(s + t.length)
|
|
1133
1134
|
};
|
|
1134
|
-
if (
|
|
1135
|
-
let r = n && e.sliceDoc(
|
|
1135
|
+
if (en(e, s)) {
|
|
1136
|
+
let r = n && e.sliceDoc(s, s + t.length * 3) == t + t + t ? t + t + t : t;
|
|
1136
1137
|
return {
|
|
1137
1138
|
changes: {
|
|
1138
|
-
from:
|
|
1139
|
-
to:
|
|
1139
|
+
from: s,
|
|
1140
|
+
to: s + r.length,
|
|
1140
1141
|
insert: r
|
|
1141
1142
|
},
|
|
1142
|
-
range:
|
|
1143
|
+
range: a.cursor(s + r.length)
|
|
1143
1144
|
};
|
|
1144
1145
|
}
|
|
1145
|
-
} else if (n && e.sliceDoc(
|
|
1146
|
+
} else if (n && e.sliceDoc(s - 2 * t.length, s) == t + t && (l = ln(e, s - 2 * t.length, i)) > -1 && sn(e, l)) return {
|
|
1146
1147
|
changes: {
|
|
1147
1148
|
insert: t + t + t + t,
|
|
1148
|
-
from:
|
|
1149
|
+
from: s
|
|
1149
1150
|
},
|
|
1150
|
-
effects:
|
|
1151
|
-
range:
|
|
1151
|
+
effects: P.of(s + t.length),
|
|
1152
|
+
range: a.cursor(s + t.length)
|
|
1152
1153
|
};
|
|
1153
|
-
else if (e.charCategorizer(
|
|
1154
|
+
else if (e.charCategorizer(s)(c) != S.Word && ln(e, s, i) > -1 && !cn(e, s, t, i)) return {
|
|
1154
1155
|
changes: {
|
|
1155
1156
|
insert: t + t,
|
|
1156
|
-
from:
|
|
1157
|
+
from: s
|
|
1157
1158
|
},
|
|
1158
|
-
effects:
|
|
1159
|
-
range:
|
|
1159
|
+
effects: P.of(s + t.length),
|
|
1160
|
+
range: a.cursor(s + t.length)
|
|
1160
1161
|
};
|
|
1161
|
-
return { range:
|
|
1162
|
+
return { range: o = r };
|
|
1162
1163
|
});
|
|
1163
|
-
return
|
|
1164
|
+
return o ? null : e.update(s, {
|
|
1164
1165
|
scrollIntoView: !0,
|
|
1165
1166
|
userEvent: "input.type"
|
|
1166
1167
|
});
|
|
1167
1168
|
}
|
|
1168
|
-
function
|
|
1169
|
-
let n =
|
|
1169
|
+
function sn(e, t) {
|
|
1170
|
+
let n = T(e).resolveInner(t + 1);
|
|
1170
1171
|
return n.parent && n.from == t;
|
|
1171
1172
|
}
|
|
1172
|
-
function
|
|
1173
|
-
let i =
|
|
1173
|
+
function cn(e, t, n, r) {
|
|
1174
|
+
let i = T(e).resolveInner(t, -1), a = r.reduce((e, t) => Math.max(e, t.length), 0);
|
|
1174
1175
|
for (let o = 0; o < 5; o++) {
|
|
1175
1176
|
let o = e.sliceDoc(i.from, Math.min(i.to, i.from + n.length + a)), s = o.indexOf(n);
|
|
1176
1177
|
if (!s || s > -1 && r.indexOf(o.slice(0, s)) > -1) {
|
|
@@ -1187,81 +1188,81 @@ function on(e, t, n, r) {
|
|
|
1187
1188
|
}
|
|
1188
1189
|
return !1;
|
|
1189
1190
|
}
|
|
1190
|
-
function
|
|
1191
|
+
function ln(e, t, n) {
|
|
1191
1192
|
let r = e.charCategorizer(t);
|
|
1192
|
-
if (r(e.sliceDoc(t - 1, t)) !=
|
|
1193
|
+
if (r(e.sliceDoc(t - 1, t)) != S.Word) return t;
|
|
1193
1194
|
for (let i of n) {
|
|
1194
1195
|
let n = t - i.length;
|
|
1195
|
-
if (e.sliceDoc(n, t) == i && r(e.sliceDoc(n - 1, n)) !=
|
|
1196
|
+
if (e.sliceDoc(n, t) == i && r(e.sliceDoc(n - 1, n)) != S.Word) return n;
|
|
1196
1197
|
}
|
|
1197
1198
|
return -1;
|
|
1198
1199
|
}
|
|
1199
|
-
function
|
|
1200
|
+
function un(e = {}) {
|
|
1200
1201
|
return [
|
|
1202
|
+
Dt,
|
|
1203
|
+
A,
|
|
1204
|
+
O.of(e),
|
|
1201
1205
|
Tt,
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
Ct,
|
|
1205
|
-
un,
|
|
1206
|
-
Et
|
|
1206
|
+
fn,
|
|
1207
|
+
Ot
|
|
1207
1208
|
];
|
|
1208
1209
|
}
|
|
1209
|
-
var
|
|
1210
|
+
var dn = [
|
|
1210
1211
|
{
|
|
1211
1212
|
key: "Ctrl-Space",
|
|
1212
|
-
run:
|
|
1213
|
+
run: bt
|
|
1213
1214
|
},
|
|
1214
1215
|
{
|
|
1215
1216
|
mac: "Alt-`",
|
|
1216
|
-
run:
|
|
1217
|
+
run: bt
|
|
1217
1218
|
},
|
|
1218
1219
|
{
|
|
1219
1220
|
mac: "Alt-i",
|
|
1220
|
-
run:
|
|
1221
|
+
run: bt
|
|
1221
1222
|
},
|
|
1222
1223
|
{
|
|
1223
1224
|
key: "Escape",
|
|
1224
|
-
run:
|
|
1225
|
+
run: xt
|
|
1225
1226
|
},
|
|
1226
1227
|
{
|
|
1227
1228
|
key: "ArrowDown",
|
|
1228
|
-
run: /*@__PURE__*/
|
|
1229
|
+
run: /*@__PURE__*/ vt(!0)
|
|
1229
1230
|
},
|
|
1230
1231
|
{
|
|
1231
1232
|
key: "ArrowUp",
|
|
1232
|
-
run: /*@__PURE__*/
|
|
1233
|
+
run: /*@__PURE__*/ vt(!1)
|
|
1233
1234
|
},
|
|
1234
1235
|
{
|
|
1235
1236
|
key: "PageDown",
|
|
1236
|
-
run: /*@__PURE__*/
|
|
1237
|
+
run: /*@__PURE__*/ vt(!0, "page")
|
|
1237
1238
|
},
|
|
1238
1239
|
{
|
|
1239
1240
|
key: "PageUp",
|
|
1240
|
-
run: /*@__PURE__*/
|
|
1241
|
+
run: /*@__PURE__*/ vt(!1, "page")
|
|
1241
1242
|
},
|
|
1242
1243
|
{
|
|
1243
1244
|
key: "Enter",
|
|
1244
|
-
run:
|
|
1245
|
+
run: yt
|
|
1245
1246
|
}
|
|
1246
|
-
],
|
|
1247
|
-
let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r =
|
|
1248
|
-
return r.line ?
|
|
1247
|
+
], fn = /*@__PURE__*/ t.highest(/*@__PURE__*/ ie.computeN([O], (e) => e.facet(O).defaultKeymap ? [dn] : [])), pn = (e) => {
|
|
1248
|
+
let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r = vn(e.state, n.from);
|
|
1249
|
+
return r.line ? hn(e) : r.block ? _n(e) : !1;
|
|
1249
1250
|
};
|
|
1250
|
-
function
|
|
1251
|
+
function mn(e, t) {
|
|
1251
1252
|
return ({ state: n, dispatch: r }) => {
|
|
1252
1253
|
if (n.readOnly) return !1;
|
|
1253
1254
|
let i = e(t, n);
|
|
1254
1255
|
return i ? (r(n.update(i)), !0) : !1;
|
|
1255
1256
|
};
|
|
1256
1257
|
}
|
|
1257
|
-
var
|
|
1258
|
-
function
|
|
1258
|
+
var hn = /*@__PURE__*/ mn(Cn, 0), gn = /*@__PURE__*/ mn(Sn, 0), _n = /*@__PURE__*/ mn((e, t) => Sn(e, t, xn(t)), 0);
|
|
1259
|
+
function vn(e, t) {
|
|
1259
1260
|
let n = e.languageDataAt("commentTokens", t, 1);
|
|
1260
1261
|
return n.length ? n[0] : {};
|
|
1261
1262
|
}
|
|
1262
|
-
var
|
|
1263
|
-
function
|
|
1264
|
-
let a = e.sliceDoc(r -
|
|
1263
|
+
var yn = 50;
|
|
1264
|
+
function bn(e, { open: t, close: n }, r, i) {
|
|
1265
|
+
let a = e.sliceDoc(r - yn, r), o = e.sliceDoc(i, i + yn), s = /\s*$/.exec(a)[0].length, c = /^\s*/.exec(o)[0].length, l = a.length - s;
|
|
1265
1266
|
if (a.slice(l - t.length, l) == t && o.slice(c, c + n.length) == n) return {
|
|
1266
1267
|
open: {
|
|
1267
1268
|
pos: r - s,
|
|
@@ -1273,7 +1274,7 @@ function vn(e, { open: t, close: n }, r, i) {
|
|
|
1273
1274
|
}
|
|
1274
1275
|
};
|
|
1275
1276
|
let u, d;
|
|
1276
|
-
i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r +
|
|
1277
|
+
i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r + yn), d = e.sliceDoc(i - yn, i));
|
|
1277
1278
|
let f = /^\s*/.exec(u)[0].length, p = /\s*$/.exec(d)[0].length, m = d.length - p - n.length;
|
|
1278
1279
|
return u.slice(f, f + t.length) == t && d.slice(m, m + n.length) == n ? {
|
|
1279
1280
|
open: {
|
|
@@ -1286,7 +1287,7 @@ function vn(e, { open: t, close: n }, r, i) {
|
|
|
1286
1287
|
}
|
|
1287
1288
|
} : null;
|
|
1288
1289
|
}
|
|
1289
|
-
function
|
|
1290
|
+
function xn(e) {
|
|
1290
1291
|
let t = [];
|
|
1291
1292
|
for (let n of e.selection.ranges) {
|
|
1292
1293
|
let r = e.doc.lineAt(n.from), i = n.to <= r.to ? r : e.doc.lineAt(n.to);
|
|
@@ -1299,10 +1300,10 @@ function yn(e) {
|
|
|
1299
1300
|
}
|
|
1300
1301
|
return t;
|
|
1301
1302
|
}
|
|
1302
|
-
function
|
|
1303
|
-
let r = n.map((e) =>
|
|
1303
|
+
function Sn(e, t, n = t.selection.ranges) {
|
|
1304
|
+
let r = n.map((e) => vn(t, e.from).block);
|
|
1304
1305
|
if (!r.every((e) => e)) return null;
|
|
1305
|
-
let i = n.map((e, n) =>
|
|
1306
|
+
let i = n.map((e, n) => bn(t, r[n], e.from, e.to));
|
|
1306
1307
|
if (e != 2 && !i.every((e) => e)) return { changes: t.changes(n.map((e, t) => i[t] ? [] : [{
|
|
1307
1308
|
from: e.from,
|
|
1308
1309
|
insert: r[t].open + " "
|
|
@@ -1326,13 +1327,13 @@ function bn(e, t, n = t.selection.ranges) {
|
|
|
1326
1327
|
}
|
|
1327
1328
|
return null;
|
|
1328
1329
|
}
|
|
1329
|
-
function
|
|
1330
|
+
function Cn(e, t, n = t.selection.ranges) {
|
|
1330
1331
|
let r = [], i = -1;
|
|
1331
1332
|
ranges: for (let { from: e, to: a } of n) {
|
|
1332
1333
|
let n = r.length, o = 1e9, s;
|
|
1333
1334
|
for (let n = e; n <= a;) {
|
|
1334
1335
|
let c = t.doc.lineAt(n);
|
|
1335
|
-
if (s == null && (s =
|
|
1336
|
+
if (s == null && (s = vn(t, c.from).line, !s)) continue ranges;
|
|
1336
1337
|
if (c.from > i && (e == a || a > c.from)) {
|
|
1337
1338
|
i = c.from;
|
|
1338
1339
|
let e = /^\s*/.exec(c.text)[0].length, t = e == c.length, n = c.text.slice(e, e + s.length) == s ? e : -1;
|
|
@@ -1375,8 +1376,8 @@ function xn(e, t, n = t.selection.ranges) {
|
|
|
1375
1376
|
}
|
|
1376
1377
|
return null;
|
|
1377
1378
|
}
|
|
1378
|
-
var
|
|
1379
|
-
return
|
|
1379
|
+
var wn = /*@__PURE__*/ ge.define(), Tn = /*@__PURE__*/ ge.define(), En = /*@__PURE__*/ d.define(), Dn = /*@__PURE__*/ d.define({ combine(e) {
|
|
1380
|
+
return n(e, {
|
|
1380
1381
|
minDepth: 100,
|
|
1381
1382
|
newGroupDelay: 500,
|
|
1382
1383
|
joinToEvent: (e, t) => t
|
|
@@ -1385,19 +1386,19 @@ var Sn = /*@__PURE__*/ oe.define(), Cn = /*@__PURE__*/ oe.define(), wn = /*@__PU
|
|
|
1385
1386
|
newGroupDelay: Math.min,
|
|
1386
1387
|
joinToEvent: (e, t) => (n, r) => e(n, r) || t(n, r)
|
|
1387
1388
|
});
|
|
1388
|
-
} }),
|
|
1389
|
+
} }), On = /*@__PURE__*/ o.define({
|
|
1389
1390
|
create() {
|
|
1390
|
-
return
|
|
1391
|
+
return L.empty;
|
|
1391
1392
|
},
|
|
1392
1393
|
update(e, t) {
|
|
1393
|
-
let n = t.state.facet(
|
|
1394
|
+
let n = t.state.facet(Dn), r = t.annotation(wn);
|
|
1394
1395
|
if (r) {
|
|
1395
|
-
let i =
|
|
1396
|
-
return o = i ?
|
|
1396
|
+
let i = F.fromTransaction(t, r.selection), a = r.side, o = a == 0 ? e.undone : e.done;
|
|
1397
|
+
return o = i ? Fn(o, o.length, n.minDepth, i) : Bn(o, t.startState.selection), new L(a == 0 ? r.rest : o, a == 0 ? o : r.rest);
|
|
1397
1398
|
}
|
|
1398
|
-
let i = t.annotation(
|
|
1399
|
-
if ((i == "full" || i == "before") && (e = e.isolate()), t.annotation(
|
|
1400
|
-
let a =
|
|
1399
|
+
let i = t.annotation(Tn);
|
|
1400
|
+
if ((i == "full" || i == "before") && (e = e.isolate()), t.annotation(l.addToHistory) === !1) return t.changes.empty ? e : e.addMapping(t.changes.desc);
|
|
1401
|
+
let a = F.fromTransaction(t), o = t.annotation(l.time), s = t.annotation(l.userEvent);
|
|
1401
1402
|
return a ? e = e.addChanges(a, o, s, n, t) : t.selection && (e = e.addSelection(t.startState.selection, o, s, n.newGroupDelay)), (i == "full" || i == "after") && (e = e.isolate()), e;
|
|
1402
1403
|
},
|
|
1403
1404
|
toJSON(e) {
|
|
@@ -1407,29 +1408,29 @@ var Sn = /*@__PURE__*/ oe.define(), Cn = /*@__PURE__*/ oe.define(), wn = /*@__PU
|
|
|
1407
1408
|
};
|
|
1408
1409
|
},
|
|
1409
1410
|
fromJSON(e) {
|
|
1410
|
-
return new
|
|
1411
|
+
return new L(e.done.map(F.fromJSON), e.undone.map(F.fromJSON));
|
|
1411
1412
|
}
|
|
1412
1413
|
});
|
|
1413
|
-
function
|
|
1414
|
+
function kn(e = {}) {
|
|
1414
1415
|
return [
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
let n = e.inputType == "historyUndo" ?
|
|
1416
|
+
On,
|
|
1417
|
+
Dn.of(e),
|
|
1418
|
+
b.domEventHandlers({ beforeinput(e, t) {
|
|
1419
|
+
let n = e.inputType == "historyUndo" ? jn : e.inputType == "historyRedo" ? Mn : null;
|
|
1419
1420
|
return n ? (e.preventDefault(), n(t)) : !1;
|
|
1420
1421
|
} })
|
|
1421
1422
|
];
|
|
1422
1423
|
}
|
|
1423
|
-
function
|
|
1424
|
+
function An(e, t) {
|
|
1424
1425
|
return function({ state: n, dispatch: r }) {
|
|
1425
1426
|
if (!t && n.readOnly) return !1;
|
|
1426
|
-
let i = n.field(
|
|
1427
|
+
let i = n.field(On, !1);
|
|
1427
1428
|
if (!i) return !1;
|
|
1428
1429
|
let a = i.pop(e, n, t);
|
|
1429
1430
|
return a ? (r(a), !0) : !1;
|
|
1430
1431
|
};
|
|
1431
1432
|
}
|
|
1432
|
-
var
|
|
1433
|
+
var jn = /*@__PURE__*/ An(0, !1), Mn = /*@__PURE__*/ An(1, !1), Nn = /*@__PURE__*/ An(0, !0), Pn = /*@__PURE__*/ An(1, !0), F = class e {
|
|
1433
1434
|
constructor(e, t, n, r, i) {
|
|
1434
1435
|
this.changes = e, this.effects = t, this.mapped = n, this.startSelection = r, this.selectionsAfter = i;
|
|
1435
1436
|
}
|
|
@@ -1445,25 +1446,25 @@ var kn = /*@__PURE__*/ On(0, !1), An = /*@__PURE__*/ On(1, !1), jn = /*@__PURE__
|
|
|
1445
1446
|
};
|
|
1446
1447
|
}
|
|
1447
1448
|
static fromJSON(t) {
|
|
1448
|
-
return new e(t.changes &&
|
|
1449
|
+
return new e(t.changes && r.fromJSON(t.changes), [], t.mapped && m.fromJSON(t.mapped), t.startSelection && a.fromJSON(t.startSelection), t.selectionsAfter.map(a.fromJSON));
|
|
1449
1450
|
}
|
|
1450
1451
|
static fromTransaction(t, n) {
|
|
1451
|
-
let r =
|
|
1452
|
-
for (let e of t.startState.facet(
|
|
1452
|
+
let r = I;
|
|
1453
|
+
for (let e of t.startState.facet(En)) {
|
|
1453
1454
|
let n = e(t);
|
|
1454
1455
|
n.length && (r = r.concat(n));
|
|
1455
1456
|
}
|
|
1456
|
-
return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection,
|
|
1457
|
+
return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, I);
|
|
1457
1458
|
}
|
|
1458
1459
|
static selection(t) {
|
|
1459
|
-
return new e(void 0,
|
|
1460
|
+
return new e(void 0, I, void 0, void 0, t);
|
|
1460
1461
|
}
|
|
1461
1462
|
};
|
|
1462
|
-
function
|
|
1463
|
+
function Fn(e, t, n, r) {
|
|
1463
1464
|
let i = t + 1 > n + 20 ? t - n - 1 : 0, a = e.slice(i, t);
|
|
1464
1465
|
return a.push(r), a;
|
|
1465
1466
|
}
|
|
1466
|
-
function
|
|
1467
|
+
function In(e, t) {
|
|
1467
1468
|
let n = [], r = !1;
|
|
1468
1469
|
return e.iterChangedRanges((e, t) => n.push(e, t)), t.iterChangedRanges((e, t, i, a) => {
|
|
1469
1470
|
for (let e = 0; e < n.length;) {
|
|
@@ -1472,44 +1473,44 @@ function Pn(e, t) {
|
|
|
1472
1473
|
}
|
|
1473
1474
|
}), r;
|
|
1474
1475
|
}
|
|
1475
|
-
function
|
|
1476
|
+
function Ln(e, t) {
|
|
1476
1477
|
return e.ranges.length == t.ranges.length && e.ranges.filter((e, n) => e.empty != t.ranges[n].empty).length === 0;
|
|
1477
1478
|
}
|
|
1478
|
-
function
|
|
1479
|
+
function Rn(e, t) {
|
|
1479
1480
|
return e.length ? t.length ? e.concat(t) : e : t;
|
|
1480
1481
|
}
|
|
1481
|
-
var
|
|
1482
|
-
function
|
|
1482
|
+
var I = [], zn = 200;
|
|
1483
|
+
function Bn(e, t) {
|
|
1483
1484
|
if (e.length) {
|
|
1484
|
-
let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length -
|
|
1485
|
-
return r.length && r[r.length - 1].eq(t) ? e : (r.push(t),
|
|
1485
|
+
let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length - zn));
|
|
1486
|
+
return r.length && r[r.length - 1].eq(t) ? e : (r.push(t), Fn(e, e.length - 1, 1e9, n.setSelAfter(r)));
|
|
1486
1487
|
}
|
|
1487
|
-
return [
|
|
1488
|
+
return [F.selection([t])];
|
|
1488
1489
|
}
|
|
1489
|
-
function
|
|
1490
|
+
function Vn(e) {
|
|
1490
1491
|
let t = e[e.length - 1], n = e.slice();
|
|
1491
1492
|
return n[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), n;
|
|
1492
1493
|
}
|
|
1493
|
-
function
|
|
1494
|
+
function Hn(e, t) {
|
|
1494
1495
|
if (!e.length) return e;
|
|
1495
|
-
let n = e.length, r =
|
|
1496
|
+
let n = e.length, r = I;
|
|
1496
1497
|
for (; n;) {
|
|
1497
|
-
let i =
|
|
1498
|
+
let i = Un(e[n - 1], t, r);
|
|
1498
1499
|
if (i.changes && !i.changes.empty || i.effects.length) {
|
|
1499
1500
|
let t = e.slice(0, n);
|
|
1500
1501
|
return t[n - 1] = i, t;
|
|
1501
1502
|
}
|
|
1502
1503
|
t = i.mapped, n--, r = i.selectionsAfter;
|
|
1503
1504
|
}
|
|
1504
|
-
return r.length ? [
|
|
1505
|
+
return r.length ? [F.selection(r)] : I;
|
|
1505
1506
|
}
|
|
1506
|
-
function
|
|
1507
|
-
let r =
|
|
1508
|
-
if (!e.changes) return
|
|
1507
|
+
function Un(e, t, n) {
|
|
1508
|
+
let r = Rn(e.selectionsAfter.length ? e.selectionsAfter.map((e) => e.map(t)) : I, n);
|
|
1509
|
+
if (!e.changes) return F.selection(r);
|
|
1509
1510
|
let i = e.changes.map(t), a = t.mapDesc(e.changes, !0), o = e.mapped ? e.mapped.composeDesc(a) : a;
|
|
1510
|
-
return new
|
|
1511
|
+
return new F(i, f.mapEffects(e.effects, t), o, e.startSelection.map(a), r);
|
|
1511
1512
|
}
|
|
1512
|
-
var
|
|
1513
|
+
var Wn = /^(input\.type|delete)($|\.)/, L = class e {
|
|
1513
1514
|
constructor(e, t, n = 0, r = void 0) {
|
|
1514
1515
|
this.done = e, this.undone = t, this.prevTime = n, this.prevUserEvent = r;
|
|
1515
1516
|
}
|
|
@@ -1518,14 +1519,14 @@ var Hn = /^(input\.type|delete)($|\.)/, z = class e {
|
|
|
1518
1519
|
}
|
|
1519
1520
|
addChanges(t, n, r, i, a) {
|
|
1520
1521
|
let o = this.done, s = o[o.length - 1];
|
|
1521
|
-
return o = s && s.changes && !s.changes.empty && t.changes && (!r ||
|
|
1522
|
+
return o = s && s.changes && !s.changes.empty && t.changes && (!r || Wn.test(r)) && (!s.selectionsAfter.length && n - this.prevTime < i.newGroupDelay && i.joinToEvent(a, In(s.changes, t.changes)) || r == "input.type.compose") ? Fn(o, o.length - 1, i.minDepth, new F(t.changes.compose(s.changes), Rn(f.mapEffects(t.effects, s.changes), s.effects), s.mapped, s.startSelection, I)) : Fn(o, o.length, i.minDepth, t), new e(o, I, n, r);
|
|
1522
1523
|
}
|
|
1523
1524
|
addSelection(t, n, r, i) {
|
|
1524
|
-
let a = this.done.length ? this.done[this.done.length - 1].selectionsAfter :
|
|
1525
|
-
return a.length > 0 && n - this.prevTime < i && r == this.prevUserEvent && r && /^select($|\.)/.test(r) &&
|
|
1525
|
+
let a = this.done.length ? this.done[this.done.length - 1].selectionsAfter : I;
|
|
1526
|
+
return a.length > 0 && n - this.prevTime < i && r == this.prevUserEvent && r && /^select($|\.)/.test(r) && Ln(a[a.length - 1], t) ? this : new e(Bn(this.done, t), this.undone, n, r);
|
|
1526
1527
|
}
|
|
1527
1528
|
addMapping(t) {
|
|
1528
|
-
return new e(
|
|
1529
|
+
return new e(Hn(this.done, t), Hn(this.undone, t), this.prevTime, this.prevUserEvent);
|
|
1529
1530
|
}
|
|
1530
1531
|
pop(e, t, n) {
|
|
1531
1532
|
let r = e == 0 ? this.done : this.undone;
|
|
@@ -1533,21 +1534,21 @@ var Hn = /^(input\.type|delete)($|\.)/, z = class e {
|
|
|
1533
1534
|
let i = r[r.length - 1], a = i.selectionsAfter[0] || (i.startSelection ? i.startSelection.map(i.changes.invertedDesc, 1) : t.selection);
|
|
1534
1535
|
if (n && i.selectionsAfter.length) return t.update({
|
|
1535
1536
|
selection: i.selectionsAfter[i.selectionsAfter.length - 1],
|
|
1536
|
-
annotations:
|
|
1537
|
+
annotations: wn.of({
|
|
1537
1538
|
side: e,
|
|
1538
|
-
rest:
|
|
1539
|
+
rest: Vn(r),
|
|
1539
1540
|
selection: a
|
|
1540
1541
|
}),
|
|
1541
1542
|
userEvent: e == 0 ? "select.undo" : "select.redo",
|
|
1542
1543
|
scrollIntoView: !0
|
|
1543
1544
|
});
|
|
1544
1545
|
if (i.changes) {
|
|
1545
|
-
let n = r.length == 1 ?
|
|
1546
|
-
return i.mapped && (n =
|
|
1546
|
+
let n = r.length == 1 ? I : r.slice(0, r.length - 1);
|
|
1547
|
+
return i.mapped && (n = Hn(n, i.mapped)), t.update({
|
|
1547
1548
|
changes: i.changes,
|
|
1548
1549
|
selection: i.startSelection,
|
|
1549
1550
|
effects: i.effects,
|
|
1550
|
-
annotations:
|
|
1551
|
+
annotations: wn.of({
|
|
1551
1552
|
side: e,
|
|
1552
1553
|
rest: n,
|
|
1553
1554
|
selection: a
|
|
@@ -1560,93 +1561,93 @@ var Hn = /^(input\.type|delete)($|\.)/, z = class e {
|
|
|
1560
1561
|
return null;
|
|
1561
1562
|
}
|
|
1562
1563
|
};
|
|
1563
|
-
|
|
1564
|
-
var
|
|
1564
|
+
L.empty = /*@__PURE__*/ new L(I, I);
|
|
1565
|
+
var Gn = [
|
|
1565
1566
|
{
|
|
1566
1567
|
key: "Mod-z",
|
|
1567
|
-
run:
|
|
1568
|
+
run: jn,
|
|
1568
1569
|
preventDefault: !0
|
|
1569
1570
|
},
|
|
1570
1571
|
{
|
|
1571
1572
|
key: "Mod-y",
|
|
1572
1573
|
mac: "Mod-Shift-z",
|
|
1573
|
-
run:
|
|
1574
|
+
run: Mn,
|
|
1574
1575
|
preventDefault: !0
|
|
1575
1576
|
},
|
|
1576
1577
|
{
|
|
1577
1578
|
linux: "Ctrl-Shift-z",
|
|
1578
|
-
run:
|
|
1579
|
+
run: Mn,
|
|
1579
1580
|
preventDefault: !0
|
|
1580
1581
|
},
|
|
1581
1582
|
{
|
|
1582
1583
|
key: "Mod-u",
|
|
1583
|
-
run:
|
|
1584
|
+
run: Nn,
|
|
1584
1585
|
preventDefault: !0
|
|
1585
1586
|
},
|
|
1586
1587
|
{
|
|
1587
1588
|
key: "Alt-u",
|
|
1588
1589
|
mac: "Mod-Shift-u",
|
|
1589
|
-
run:
|
|
1590
|
+
run: Pn,
|
|
1590
1591
|
preventDefault: !0
|
|
1591
1592
|
}
|
|
1592
1593
|
];
|
|
1593
|
-
function
|
|
1594
|
-
return
|
|
1594
|
+
function R(e, t) {
|
|
1595
|
+
return a.create(e.ranges.map(t), e.mainIndex);
|
|
1595
1596
|
}
|
|
1596
|
-
function
|
|
1597
|
+
function z(e, t) {
|
|
1597
1598
|
return e.update({
|
|
1598
1599
|
selection: t,
|
|
1599
1600
|
scrollIntoView: !0,
|
|
1600
1601
|
userEvent: "select"
|
|
1601
1602
|
});
|
|
1602
1603
|
}
|
|
1603
|
-
function
|
|
1604
|
-
let r =
|
|
1605
|
-
return !r.eq(e.selection, !0) && (t(
|
|
1604
|
+
function B({ state: e, dispatch: t }, n) {
|
|
1605
|
+
let r = R(e.selection, n);
|
|
1606
|
+
return !r.eq(e.selection, !0) && (t(z(e, r)), !0);
|
|
1606
1607
|
}
|
|
1607
|
-
function
|
|
1608
|
-
return
|
|
1608
|
+
function Kn(e, t) {
|
|
1609
|
+
return a.cursor(t ? e.to : e.from);
|
|
1609
1610
|
}
|
|
1610
|
-
function
|
|
1611
|
-
return
|
|
1611
|
+
function qn(e, t) {
|
|
1612
|
+
return B(e, (n) => n.empty ? e.moveByChar(n, t) : Kn(n, t));
|
|
1612
1613
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return e.textDirectionAt(e.state.selection.main.head) ==
|
|
1614
|
+
function V(e) {
|
|
1615
|
+
return e.textDirectionAt(e.state.selection.main.head) == ue.LTR;
|
|
1615
1616
|
}
|
|
1616
|
-
var
|
|
1617
|
-
function
|
|
1618
|
-
return
|
|
1617
|
+
var Jn = (e) => qn(e, !V(e)), Yn = (e) => qn(e, V(e));
|
|
1618
|
+
function Xn(e, t) {
|
|
1619
|
+
return B(e, (n) => n.empty ? e.moveByGroup(n, t) : Kn(n, t));
|
|
1619
1620
|
}
|
|
1620
|
-
var
|
|
1621
|
+
var Zn = (e) => Xn(e, !V(e)), Qn = (e) => Xn(e, V(e));
|
|
1621
1622
|
typeof Intl < "u" && Intl.Segmenter;
|
|
1622
|
-
function
|
|
1623
|
+
function $n(e, t, n) {
|
|
1623
1624
|
if (t.type.prop(n)) return !0;
|
|
1624
1625
|
let r = t.to - t.from;
|
|
1625
1626
|
return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
|
|
1626
1627
|
}
|
|
1627
|
-
function
|
|
1628
|
-
let r =
|
|
1628
|
+
function er(e, t, n) {
|
|
1629
|
+
let r = T(e).resolveInner(t.head), i = n ? ye.closedBy : ye.openedBy;
|
|
1629
1630
|
for (let a = t.head;;) {
|
|
1630
1631
|
let t = n ? r.childAfter(a) : r.childBefore(a);
|
|
1631
1632
|
if (!t) break;
|
|
1632
|
-
|
|
1633
|
+
$n(e, t, i) ? r = t : a = n ? t.to : t.from;
|
|
1633
1634
|
}
|
|
1634
|
-
let
|
|
1635
|
-
return
|
|
1635
|
+
let o = r.type.prop(i), s, c;
|
|
1636
|
+
return c = o && (s = n ? w(e, r.from, 1) : w(e, r.to, -1)) && s.matched ? n ? s.end.to : s.end.from : n ? r.to : r.from, a.cursor(c, n ? -1 : 1);
|
|
1636
1637
|
}
|
|
1637
|
-
var
|
|
1638
|
-
function
|
|
1639
|
-
return
|
|
1640
|
-
if (!n.empty) return
|
|
1638
|
+
var tr = (e) => B(e, (t) => er(e.state, t, !V(e))), nr = (e) => B(e, (t) => er(e.state, t, V(e)));
|
|
1639
|
+
function rr(e, t) {
|
|
1640
|
+
return B(e, (n) => {
|
|
1641
|
+
if (!n.empty) return Kn(n, t);
|
|
1641
1642
|
let r = e.moveVertically(n, t);
|
|
1642
1643
|
return r.head == n.head ? e.moveToLineBoundary(n, t) : r;
|
|
1643
1644
|
});
|
|
1644
1645
|
}
|
|
1645
|
-
var
|
|
1646
|
-
function
|
|
1646
|
+
var ir = (e) => rr(e, !1), ar = (e) => rr(e, !0);
|
|
1647
|
+
function or(e) {
|
|
1647
1648
|
let t = e.scrollDOM.clientHeight < e.scrollDOM.scrollHeight - 2, n = 0, r = 0, i;
|
|
1648
1649
|
if (t) {
|
|
1649
|
-
for (let t of e.state.facet(
|
|
1650
|
+
for (let t of e.state.facet(b.scrollMargins)) {
|
|
1650
1651
|
let i = t(e);
|
|
1651
1652
|
i?.top && (n = Math.max(i?.top, n)), i?.bottom && (r = Math.max(i?.bottom, r));
|
|
1652
1653
|
}
|
|
@@ -1659,109 +1660,109 @@ function ir(e) {
|
|
|
1659
1660
|
height: Math.max(e.defaultLineHeight, i - 5)
|
|
1660
1661
|
};
|
|
1661
1662
|
}
|
|
1662
|
-
function
|
|
1663
|
-
let n =
|
|
1663
|
+
function sr(e, t) {
|
|
1664
|
+
let n = or(e), { state: r } = e, i = R(r.selection, (r) => r.empty ? e.moveVertically(r, t, n.height) : Kn(r, t));
|
|
1664
1665
|
if (i.eq(r.selection)) return !1;
|
|
1665
1666
|
let a;
|
|
1666
1667
|
if (n.selfScroll) {
|
|
1667
1668
|
let t = e.coordsAtPos(r.selection.main.head), o = e.scrollDOM.getBoundingClientRect(), s = o.top + n.marginTop, c = o.bottom - n.marginBottom;
|
|
1668
|
-
t && t.top > s && t.bottom < c && (a =
|
|
1669
|
+
t && t.top > s && t.bottom < c && (a = b.scrollIntoView(i.main.head, {
|
|
1669
1670
|
y: "start",
|
|
1670
1671
|
yMargin: t.top - s
|
|
1671
1672
|
}));
|
|
1672
1673
|
}
|
|
1673
|
-
return e.dispatch(
|
|
1674
|
+
return e.dispatch(z(r, i), { effects: a }), !0;
|
|
1674
1675
|
}
|
|
1675
|
-
var
|
|
1676
|
-
function
|
|
1676
|
+
var cr = (e) => sr(e, !1), lr = (e) => sr(e, !0);
|
|
1677
|
+
function H(e, t, n) {
|
|
1677
1678
|
let r = e.lineBlockAt(t.head), i = e.moveToLineBoundary(t, n);
|
|
1678
1679
|
if (i.head == t.head && i.head != (n ? r.to : r.from) && (i = e.moveToLineBoundary(t, n, !1)), !n && i.head == r.from && r.length) {
|
|
1679
1680
|
let n = /^\s*/.exec(e.state.sliceDoc(r.from, Math.min(r.from + 100, r.to)))[0].length;
|
|
1680
|
-
n && t.head != r.from + n && (i =
|
|
1681
|
+
n && t.head != r.from + n && (i = a.cursor(r.from + n));
|
|
1681
1682
|
}
|
|
1682
1683
|
return i;
|
|
1683
1684
|
}
|
|
1684
|
-
var
|
|
1685
|
-
function
|
|
1686
|
-
let r = !1, i =
|
|
1687
|
-
let i =
|
|
1685
|
+
var ur = (e) => B(e, (t) => H(e, t, !0)), dr = (e) => B(e, (t) => H(e, t, !1)), fr = (e) => B(e, (t) => H(e, t, !V(e))), pr = (e) => B(e, (t) => H(e, t, V(e))), mr = (e) => B(e, (t) => e.moveToLineBoundary(t, !1, !1)), hr = (e) => B(e, (t) => e.moveToLineBoundary(t, !0, !1));
|
|
1686
|
+
function gr(e, t, n) {
|
|
1687
|
+
let r = !1, i = R(e.selection, (t) => {
|
|
1688
|
+
let i = w(e, t.head, -1) || w(e, t.head, 1) || t.head > 0 && w(e, t.head - 1, 1) || t.head < e.doc.length && w(e, t.head + 1, -1);
|
|
1688
1689
|
if (!i || !i.end) return t;
|
|
1689
1690
|
r = !0;
|
|
1690
|
-
let
|
|
1691
|
-
return n ?
|
|
1691
|
+
let o = i.start.from == t.head ? i.end.to : i.end.from;
|
|
1692
|
+
return n ? a.range(t.anchor, o) : a.cursor(o);
|
|
1692
1693
|
});
|
|
1693
|
-
return r ? (t(
|
|
1694
|
+
return r ? (t(z(e, i)), !0) : !1;
|
|
1694
1695
|
}
|
|
1695
|
-
var
|
|
1696
|
-
function
|
|
1697
|
-
let r =
|
|
1698
|
-
e.undirectional && e.head >= e.anchor != t && (e =
|
|
1696
|
+
var _r = ({ state: e, dispatch: t }) => gr(e, t, !1);
|
|
1697
|
+
function U(e, t, n) {
|
|
1698
|
+
let r = R(e.state.selection, (e) => {
|
|
1699
|
+
e.undirectional && e.head >= e.anchor != t && (e = a.range(e.head, e.anchor));
|
|
1699
1700
|
let r = n(e);
|
|
1700
|
-
return
|
|
1701
|
+
return a.range(e.anchor, r.head, r.goalColumn, r.bidiLevel || void 0, r.assoc);
|
|
1701
1702
|
});
|
|
1702
|
-
return !r.eq(e.state.selection) && (e.dispatch(
|
|
1703
|
+
return !r.eq(e.state.selection) && (e.dispatch(z(e.state, r)), !0);
|
|
1703
1704
|
}
|
|
1704
|
-
function
|
|
1705
|
-
return
|
|
1705
|
+
function vr(e, t) {
|
|
1706
|
+
return U(e, t, (n) => e.moveByChar(n, t));
|
|
1706
1707
|
}
|
|
1707
|
-
var
|
|
1708
|
-
function
|
|
1709
|
-
return
|
|
1708
|
+
var yr = (e) => vr(e, !V(e)), br = (e) => vr(e, V(e));
|
|
1709
|
+
function xr(e, t) {
|
|
1710
|
+
return U(e, t, (n) => e.moveByGroup(n, t));
|
|
1710
1711
|
}
|
|
1711
|
-
var
|
|
1712
|
-
let t = !
|
|
1713
|
-
return
|
|
1714
|
-
},
|
|
1715
|
-
let t =
|
|
1716
|
-
return
|
|
1712
|
+
var Sr = (e) => xr(e, !V(e)), Cr = (e) => xr(e, V(e)), wr = (e) => {
|
|
1713
|
+
let t = !V(e);
|
|
1714
|
+
return U(e, t, (n) => er(e.state, n, t));
|
|
1715
|
+
}, Tr = (e) => {
|
|
1716
|
+
let t = V(e);
|
|
1717
|
+
return U(e, t, (n) => er(e.state, n, t));
|
|
1717
1718
|
};
|
|
1718
|
-
function
|
|
1719
|
-
return
|
|
1720
|
-
}
|
|
1721
|
-
var
|
|
1722
|
-
function
|
|
1723
|
-
return
|
|
1724
|
-
}
|
|
1725
|
-
var
|
|
1726
|
-
let t = !
|
|
1727
|
-
return
|
|
1728
|
-
},
|
|
1729
|
-
let t =
|
|
1730
|
-
return
|
|
1731
|
-
},
|
|
1719
|
+
function Er(e, t) {
|
|
1720
|
+
return U(e, t, (n) => e.moveVertically(n, t));
|
|
1721
|
+
}
|
|
1722
|
+
var Dr = (e) => Er(e, !1), Or = (e) => Er(e, !0);
|
|
1723
|
+
function kr(e, t) {
|
|
1724
|
+
return U(e, t, (n) => e.moveVertically(n, t, or(e).height));
|
|
1725
|
+
}
|
|
1726
|
+
var Ar = (e) => kr(e, !1), jr = (e) => kr(e, !0), Mr = (e) => U(e, !0, (t) => H(e, t, !0)), Nr = (e) => U(e, !1, (t) => H(e, t, !1)), Pr = (e) => {
|
|
1727
|
+
let t = !V(e);
|
|
1728
|
+
return U(e, t, (n) => H(e, n, t));
|
|
1729
|
+
}, Fr = (e) => {
|
|
1730
|
+
let t = V(e);
|
|
1731
|
+
return U(e, t, (n) => H(e, n, t));
|
|
1732
|
+
}, Ir = (e) => U(e, !1, (t) => a.cursor(e.lineBlockAt(t.head).from)), Lr = (e) => U(e, !0, (t) => a.cursor(e.lineBlockAt(t.head).to)), Rr = ({ state: e, dispatch: t }) => (t(z(e, { anchor: 0 })), !0), zr = ({ state: e, dispatch: t }) => (t(z(e, { anchor: e.doc.length })), !0), Br = ({ state: e, dispatch: t }) => (t(z(e, {
|
|
1732
1733
|
anchor: e.selection.main.anchor,
|
|
1733
1734
|
head: 0
|
|
1734
|
-
})), !0),
|
|
1735
|
+
})), !0), Vr = ({ state: e, dispatch: t }) => (t(z(e, {
|
|
1735
1736
|
anchor: e.selection.main.anchor,
|
|
1736
1737
|
head: e.doc.length
|
|
1737
|
-
})), !0),
|
|
1738
|
+
})), !0), Hr = ({ state: e, dispatch: t }) => (t(e.update({
|
|
1738
1739
|
selection: {
|
|
1739
1740
|
anchor: 0,
|
|
1740
1741
|
head: e.doc.length
|
|
1741
1742
|
},
|
|
1742
1743
|
userEvent: "select"
|
|
1743
|
-
})), !0),
|
|
1744
|
-
let n =
|
|
1744
|
+
})), !0), Ur = ({ state: e, dispatch: t }) => {
|
|
1745
|
+
let n = si(e).map(({ from: t, to: n }) => a.undirectionalRange(t, Math.min(n + 1, e.doc.length)));
|
|
1745
1746
|
return t(e.update({
|
|
1746
|
-
selection:
|
|
1747
|
+
selection: a.create(n),
|
|
1747
1748
|
userEvent: "select"
|
|
1748
1749
|
})), !0;
|
|
1749
|
-
},
|
|
1750
|
-
let n =
|
|
1751
|
-
let n =
|
|
1750
|
+
}, Wr = ({ state: e, dispatch: t }) => {
|
|
1751
|
+
let n = R(e.selection, (t) => {
|
|
1752
|
+
let n = T(e), r = n.resolveStack(t.from, 1);
|
|
1752
1753
|
if (t.empty) {
|
|
1753
1754
|
let e = n.resolveStack(t.from, -1);
|
|
1754
1755
|
e.node.from >= r.node.from && e.node.to <= r.node.to && (r = e);
|
|
1755
1756
|
}
|
|
1756
1757
|
for (let e = r; e; e = e.next) {
|
|
1757
1758
|
let { node: n } = e;
|
|
1758
|
-
if ((n.from < t.from && n.to >= t.to || n.to > t.to && n.from <= t.from) && e.next) return
|
|
1759
|
+
if ((n.from < t.from && n.to >= t.to || n.to > t.to && n.from <= t.from) && e.next) return a.undirectionalRange(n.from, n.to);
|
|
1759
1760
|
}
|
|
1760
1761
|
return t;
|
|
1761
1762
|
});
|
|
1762
|
-
return !n.eq(e.selection) && (t(
|
|
1763
|
+
return !n.eq(e.selection) && (t(z(e, n)), !0);
|
|
1763
1764
|
};
|
|
1764
|
-
function
|
|
1765
|
+
function Gr(e, t) {
|
|
1765
1766
|
let { state: n } = e, r = n.selection, i = n.selection.ranges.slice();
|
|
1766
1767
|
for (let r of n.selection.ranges) {
|
|
1767
1768
|
let a = n.doc.lineAt(r.head);
|
|
@@ -1775,96 +1776,96 @@ function Ur(e, t) {
|
|
|
1775
1776
|
n = r;
|
|
1776
1777
|
}
|
|
1777
1778
|
}
|
|
1778
|
-
return i.length != r.ranges.length && (e.dispatch(
|
|
1779
|
+
return i.length != r.ranges.length && (e.dispatch(z(n, a.create(i, i.length - 1))), !0);
|
|
1779
1780
|
}
|
|
1780
|
-
var
|
|
1781
|
+
var Kr = (e) => Gr(e, !1), qr = (e) => Gr(e, !0), Jr = ({ state: e, dispatch: t }) => {
|
|
1781
1782
|
let n = e.selection, r = null;
|
|
1782
|
-
return n.ranges.length > 1 ? r =
|
|
1783
|
+
return n.ranges.length > 1 ? r = a.create([n.main]) : n.main.empty || (r = a.create([a.cursor(n.main.head)])), r ? (t(z(e, r)), !0) : !1;
|
|
1783
1784
|
};
|
|
1784
|
-
function
|
|
1785
|
+
function W(e, t) {
|
|
1785
1786
|
if (e.state.readOnly) return !1;
|
|
1786
1787
|
let n = "delete.selection", { state: r } = e, i = r.changeByRange((r) => {
|
|
1787
|
-
let { from: i, to:
|
|
1788
|
-
if (i ==
|
|
1789
|
-
let
|
|
1790
|
-
|
|
1791
|
-
} else i =
|
|
1792
|
-
return i ==
|
|
1788
|
+
let { from: i, to: o } = r;
|
|
1789
|
+
if (i == o) {
|
|
1790
|
+
let a = t(r);
|
|
1791
|
+
a < i ? (n = "delete.backward", a = Yr(e, a, !1)) : a > i && (n = "delete.forward", a = Yr(e, a, !0)), i = Math.min(i, a), o = Math.max(o, a);
|
|
1792
|
+
} else i = Yr(e, i, !1), o = Yr(e, o, !0);
|
|
1793
|
+
return i == o ? { range: r } : {
|
|
1793
1794
|
changes: {
|
|
1794
1795
|
from: i,
|
|
1795
|
-
to:
|
|
1796
|
+
to: o
|
|
1796
1797
|
},
|
|
1797
|
-
range:
|
|
1798
|
+
range: a.cursor(i, i < r.head ? -1 : 1)
|
|
1798
1799
|
};
|
|
1799
1800
|
});
|
|
1800
1801
|
return !i.changes.empty && (e.dispatch(r.update(i, {
|
|
1801
1802
|
scrollIntoView: !0,
|
|
1802
1803
|
userEvent: n,
|
|
1803
|
-
effects: n == "delete.selection" ?
|
|
1804
|
+
effects: n == "delete.selection" ? b.announce.of(r.phrase("Selection deleted")) : void 0
|
|
1804
1805
|
})), !0);
|
|
1805
1806
|
}
|
|
1806
|
-
function
|
|
1807
|
-
if (e instanceof
|
|
1807
|
+
function Yr(e, t, n) {
|
|
1808
|
+
if (e instanceof b) for (let r of e.state.facet(b.atomicRanges).map((t) => t(e))) r.between(t, t, (e, r) => {
|
|
1808
1809
|
e < t && r > t && (t = n ? r : e);
|
|
1809
1810
|
});
|
|
1810
1811
|
return t;
|
|
1811
1812
|
}
|
|
1812
|
-
var
|
|
1813
|
-
let i = r.from, { state: a } = e, o = a.doc.lineAt(i),
|
|
1814
|
-
if (n && !t && i > o.from && i < o.from + 200 && !/[^ \t]/.test(
|
|
1815
|
-
if (
|
|
1816
|
-
let e =
|
|
1817
|
-
for (let t = 0; t < e &&
|
|
1818
|
-
|
|
1819
|
-
} else
|
|
1820
|
-
return
|
|
1821
|
-
}),
|
|
1813
|
+
var Xr = (e, t, n) => W(e, (r) => {
|
|
1814
|
+
let i = r.from, { state: a } = e, o = a.doc.lineAt(i), c, l;
|
|
1815
|
+
if (n && !t && i > o.from && i < o.from + 200 && !/[^ \t]/.test(c = o.text.slice(0, i - o.from))) {
|
|
1816
|
+
if (c[c.length - 1] == " ") return i - 1;
|
|
1817
|
+
let e = g(c, a.tabSize) % Ae(a) || Ae(a);
|
|
1818
|
+
for (let t = 0; t < e && c[c.length - 1 - t] == " "; t++) i--;
|
|
1819
|
+
l = i;
|
|
1820
|
+
} else l = s(o.text, i - o.from, t, t) + o.from, l == i && o.number != (t ? a.doc.lines : 1) ? l += t ? 1 : -1 : !t && /[\ufe00-\ufe0f]/.test(o.text.slice(l - o.from, i - o.from)) && (l = s(o.text, l - o.from, !1, !1) + o.from);
|
|
1821
|
+
return l;
|
|
1822
|
+
}), Zr = (e) => Xr(e, !1, !0), Qr = (e) => Xr(e, !0, !1), $r = (e, t) => W(e, (n) => {
|
|
1822
1823
|
let r = n.head, { state: i } = e, a = i.doc.lineAt(r), o = i.charCategorizer(r);
|
|
1823
1824
|
for (let e = null;;) {
|
|
1824
1825
|
if (r == (t ? a.to : a.from)) {
|
|
1825
1826
|
r == n.head && a.number != (t ? i.doc.lines : 1) && (r += t ? 1 : -1);
|
|
1826
1827
|
break;
|
|
1827
1828
|
}
|
|
1828
|
-
let
|
|
1829
|
-
if (e != null &&
|
|
1830
|
-
(
|
|
1829
|
+
let c = s(a.text, r - a.from, t) + a.from, l = a.text.slice(Math.min(r, c) - a.from, Math.max(r, c) - a.from), u = o(l);
|
|
1830
|
+
if (e != null && u != e) break;
|
|
1831
|
+
(l != " " || r != n.head) && (e = u), r = c;
|
|
1831
1832
|
}
|
|
1832
1833
|
return r;
|
|
1833
|
-
}),
|
|
1834
|
+
}), ei = (e) => $r(e, !1), ti = (e) => $r(e, !0), ni = (e) => W(e, (t) => {
|
|
1834
1835
|
let n = e.lineBlockAt(t.head).to;
|
|
1835
1836
|
return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
|
|
1836
|
-
}),
|
|
1837
|
+
}), ri = (e) => W(e, (t) => {
|
|
1837
1838
|
let n = e.moveToLineBoundary(t, !1).head;
|
|
1838
1839
|
return t.head > n ? n : Math.max(0, t.head - 1);
|
|
1839
|
-
}),
|
|
1840
|
+
}), ii = (e) => W(e, (t) => {
|
|
1840
1841
|
let n = e.moveToLineBoundary(t, !0).head;
|
|
1841
1842
|
return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
|
|
1842
|
-
}),
|
|
1843
|
+
}), ai = ({ state: e, dispatch: t }) => {
|
|
1843
1844
|
if (e.readOnly) return !1;
|
|
1844
1845
|
let n = e.changeByRange((e) => ({
|
|
1845
1846
|
changes: {
|
|
1846
1847
|
from: e.from,
|
|
1847
1848
|
to: e.to,
|
|
1848
|
-
insert:
|
|
1849
|
+
insert: c.of(["", ""])
|
|
1849
1850
|
},
|
|
1850
|
-
range:
|
|
1851
|
+
range: a.cursor(e.from)
|
|
1851
1852
|
}));
|
|
1852
1853
|
return t(e.update(n, {
|
|
1853
1854
|
scrollIntoView: !0,
|
|
1854
1855
|
userEvent: "input"
|
|
1855
1856
|
})), !0;
|
|
1856
|
-
},
|
|
1857
|
+
}, oi = ({ state: e, dispatch: t }) => {
|
|
1857
1858
|
if (e.readOnly) return !1;
|
|
1858
1859
|
let n = e.changeByRange((t) => {
|
|
1859
1860
|
if (!t.empty || t.from == 0 || t.from == e.doc.length) return { range: t };
|
|
1860
|
-
let n = t.from, r = e.doc.lineAt(n), i = n == r.from ? n - 1 :
|
|
1861
|
+
let n = t.from, r = e.doc.lineAt(n), i = n == r.from ? n - 1 : s(r.text, n - r.from, !1) + r.from, o = n == r.to ? n + 1 : s(r.text, n - r.from, !0) + r.from;
|
|
1861
1862
|
return {
|
|
1862
1863
|
changes: {
|
|
1863
1864
|
from: i,
|
|
1864
|
-
to:
|
|
1865
|
-
insert: e.doc.slice(n,
|
|
1865
|
+
to: o,
|
|
1866
|
+
insert: e.doc.slice(n, o).append(e.doc.slice(i, n))
|
|
1866
1867
|
},
|
|
1867
|
-
range:
|
|
1868
|
+
range: a.cursor(o)
|
|
1868
1869
|
};
|
|
1869
1870
|
});
|
|
1870
1871
|
return !n.changes.empty && (t(e.update(n, {
|
|
@@ -1872,7 +1873,7 @@ var Yr = (e, t, n) => qr(e, (r) => {
|
|
|
1872
1873
|
userEvent: "move.character"
|
|
1873
1874
|
})), !0);
|
|
1874
1875
|
};
|
|
1875
|
-
function
|
|
1876
|
+
function si(e) {
|
|
1876
1877
|
let t = [], n = -1;
|
|
1877
1878
|
for (let r of e.selection.ranges) {
|
|
1878
1879
|
let i = e.doc.lineAt(r.from), a = e.doc.lineAt(r.to);
|
|
@@ -1888,44 +1889,44 @@ function oi(e) {
|
|
|
1888
1889
|
}
|
|
1889
1890
|
return t;
|
|
1890
1891
|
}
|
|
1891
|
-
function
|
|
1892
|
+
function ci(e, t, n) {
|
|
1892
1893
|
if (e.readOnly) return !1;
|
|
1893
1894
|
let r = [], i = [];
|
|
1894
|
-
for (let t of
|
|
1895
|
+
for (let t of si(e)) {
|
|
1895
1896
|
if (n ? t.to == e.doc.length : t.from == 0) continue;
|
|
1896
|
-
let
|
|
1897
|
+
let o = e.doc.lineAt(n ? t.to + 1 : t.from - 1), s = o.length + 1;
|
|
1897
1898
|
if (n) {
|
|
1898
1899
|
r.push({
|
|
1899
1900
|
from: t.to,
|
|
1900
|
-
to:
|
|
1901
|
+
to: o.to
|
|
1901
1902
|
}, {
|
|
1902
1903
|
from: t.from,
|
|
1903
|
-
insert:
|
|
1904
|
+
insert: o.text + e.lineBreak
|
|
1904
1905
|
});
|
|
1905
|
-
for (let n of t.ranges) i.push(
|
|
1906
|
+
for (let n of t.ranges) i.push(a.range(Math.min(e.doc.length, n.anchor + s), Math.min(e.doc.length, n.head + s)));
|
|
1906
1907
|
} else {
|
|
1907
1908
|
r.push({
|
|
1908
|
-
from:
|
|
1909
|
+
from: o.from,
|
|
1909
1910
|
to: t.from
|
|
1910
1911
|
}, {
|
|
1911
1912
|
from: t.to,
|
|
1912
|
-
insert: e.lineBreak +
|
|
1913
|
+
insert: e.lineBreak + o.text
|
|
1913
1914
|
});
|
|
1914
|
-
for (let e of t.ranges) i.push(
|
|
1915
|
+
for (let e of t.ranges) i.push(a.range(e.anchor - s, e.head - s));
|
|
1915
1916
|
}
|
|
1916
1917
|
}
|
|
1917
1918
|
return r.length ? (t(e.update({
|
|
1918
1919
|
changes: r,
|
|
1919
1920
|
scrollIntoView: !0,
|
|
1920
|
-
selection:
|
|
1921
|
+
selection: a.create(i, e.selection.mainIndex),
|
|
1921
1922
|
userEvent: "move.line"
|
|
1922
1923
|
})), !0) : !1;
|
|
1923
1924
|
}
|
|
1924
|
-
var
|
|
1925
|
-
function
|
|
1925
|
+
var li = ({ state: e, dispatch: t }) => ci(e, t, !1), ui = ({ state: e, dispatch: t }) => ci(e, t, !0);
|
|
1926
|
+
function di(e, t, n) {
|
|
1926
1927
|
if (e.readOnly) return !1;
|
|
1927
1928
|
let r = [];
|
|
1928
|
-
for (let t of
|
|
1929
|
+
for (let t of si(e)) n ? r.push({
|
|
1929
1930
|
from: t.from,
|
|
1930
1931
|
insert: e.doc.slice(t.from, t.to) + e.lineBreak
|
|
1931
1932
|
}) : r.push({
|
|
@@ -1940,12 +1941,12 @@ function ui(e, t, n) {
|
|
|
1940
1941
|
userEvent: "input.copyline"
|
|
1941
1942
|
})), !0;
|
|
1942
1943
|
}
|
|
1943
|
-
var
|
|
1944
|
+
var fi = ({ state: e, dispatch: t }) => di(e, t, !1), pi = ({ state: e, dispatch: t }) => di(e, t, !0), mi = (e) => {
|
|
1944
1945
|
if (e.state.readOnly) return !1;
|
|
1945
|
-
let { state: t } = e, n = t.changes(
|
|
1946
|
+
let { state: t } = e, n = t.changes(si(t).map(({ from: e, to: n }) => (e > 0 ? e-- : n < t.doc.length && n++, {
|
|
1946
1947
|
from: e,
|
|
1947
1948
|
to: n
|
|
1948
|
-
}))), r =
|
|
1949
|
+
}))), r = R(t.selection, (t) => {
|
|
1949
1950
|
let n;
|
|
1950
1951
|
if (e.lineWrapping) {
|
|
1951
1952
|
let r = e.lineBlockAt(t.head), i = e.coordsAtPos(t.head, t.assoc || 1);
|
|
@@ -1960,38 +1961,38 @@ var di = ({ state: e, dispatch: t }) => ui(e, t, !1), fi = ({ state: e, dispatch
|
|
|
1960
1961
|
userEvent: "delete.line"
|
|
1961
1962
|
}), !0;
|
|
1962
1963
|
};
|
|
1963
|
-
function
|
|
1964
|
+
function hi(e, t) {
|
|
1964
1965
|
if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1))) return {
|
|
1965
1966
|
from: t,
|
|
1966
1967
|
to: t
|
|
1967
1968
|
};
|
|
1968
|
-
let n =
|
|
1969
|
-
return r && i && r.to <= t && i.from >= t && (
|
|
1969
|
+
let n = T(e).resolveInner(t), r = n.childBefore(t), i = n.childAfter(t), a;
|
|
1970
|
+
return r && i && r.to <= t && i.from >= t && (a = r.type.prop(ye.closedBy)) && a.indexOf(i.name) > -1 && e.doc.lineAt(r.to).from == e.doc.lineAt(i.from).from && !/\S/.test(e.sliceDoc(r.to, i.from)) ? {
|
|
1970
1971
|
from: r.to,
|
|
1971
1972
|
to: i.from
|
|
1972
1973
|
} : null;
|
|
1973
1974
|
}
|
|
1974
|
-
var
|
|
1975
|
-
function
|
|
1975
|
+
var gi = /*@__PURE__*/ vi(!1), _i = /*@__PURE__*/ vi(!0);
|
|
1976
|
+
function vi(e) {
|
|
1976
1977
|
return ({ state: t, dispatch: n }) => {
|
|
1977
1978
|
if (t.readOnly) return !1;
|
|
1978
1979
|
let r = t.changeByRange((n) => {
|
|
1979
|
-
let { from: r, to:
|
|
1980
|
-
e && (r =
|
|
1981
|
-
let
|
|
1980
|
+
let { from: r, to: i } = n, o = t.doc.lineAt(r), s = !e && r == i && hi(t, r);
|
|
1981
|
+
e && (r = i = (i <= o.to ? o : t.doc.lineAt(i)).to);
|
|
1982
|
+
let l = new Oe(t, {
|
|
1982
1983
|
simulateBreak: r,
|
|
1983
1984
|
simulateDoubleBreak: !!s
|
|
1984
|
-
}),
|
|
1985
|
-
for (
|
|
1986
|
-
s ? {from: r, to:
|
|
1987
|
-
let
|
|
1988
|
-
return s &&
|
|
1985
|
+
}), u = Se(l, r);
|
|
1986
|
+
for (u ??= g(/^\s*/.exec(t.doc.lineAt(r).text)[0], t.tabSize); i < o.to && /\s/.test(o.text[i - o.from]);) i++;
|
|
1987
|
+
s ? {from: r, to: i} = s : r > o.from && r < o.from + 100 && !/\S/.test(o.text.slice(0, r)) && (r = o.from);
|
|
1988
|
+
let d = ["", ve(t, u)];
|
|
1989
|
+
return s && d.push(ve(t, l.lineIndent(o.from, -1))), {
|
|
1989
1990
|
changes: {
|
|
1990
1991
|
from: r,
|
|
1991
|
-
to:
|
|
1992
|
-
insert:
|
|
1992
|
+
to: i,
|
|
1993
|
+
insert: c.of(d)
|
|
1993
1994
|
},
|
|
1994
|
-
range:
|
|
1995
|
+
range: a.cursor(r + 1 + d[1].length)
|
|
1995
1996
|
};
|
|
1996
1997
|
});
|
|
1997
1998
|
return n(t.update(r, {
|
|
@@ -2000,7 +2001,7 @@ function _i(e) {
|
|
|
2000
2001
|
})), !0;
|
|
2001
2002
|
};
|
|
2002
2003
|
}
|
|
2003
|
-
function
|
|
2004
|
+
function yi(e, t) {
|
|
2004
2005
|
let n = -1;
|
|
2005
2006
|
return e.changeByRange((r) => {
|
|
2006
2007
|
let i = [];
|
|
@@ -2008,354 +2009,354 @@ function vi(e, t) {
|
|
|
2008
2009
|
let o = e.doc.lineAt(a);
|
|
2009
2010
|
o.number > n && (r.empty || r.to > o.from) && (t(o, i, r), n = o.number), a = o.to + 1;
|
|
2010
2011
|
}
|
|
2011
|
-
let
|
|
2012
|
+
let o = e.changes(i);
|
|
2012
2013
|
return {
|
|
2013
2014
|
changes: i,
|
|
2014
|
-
range:
|
|
2015
|
+
range: a.range(o.mapPos(r.anchor, 1), o.mapPos(r.head, 1))
|
|
2015
2016
|
};
|
|
2016
2017
|
});
|
|
2017
2018
|
}
|
|
2018
|
-
var
|
|
2019
|
+
var bi = ({ state: e, dispatch: t }) => {
|
|
2019
2020
|
if (e.readOnly) return !1;
|
|
2020
|
-
let n = Object.create(null), r = new
|
|
2021
|
-
let
|
|
2022
|
-
if (
|
|
2023
|
-
/\S/.test(t.text) || (
|
|
2024
|
-
let
|
|
2025
|
-
(
|
|
2021
|
+
let n = Object.create(null), r = new Oe(e, { overrideIndentation: (e) => n[e] ?? -1 }), i = yi(e, (t, i, a) => {
|
|
2022
|
+
let o = Se(r, t.from);
|
|
2023
|
+
if (o == null) return;
|
|
2024
|
+
/\S/.test(t.text) || (o = 0);
|
|
2025
|
+
let s = /^\s*/.exec(t.text)[0], c = ve(e, o);
|
|
2026
|
+
(s != c || a.from < t.from + s.length) && (n[t.from] = o, i.push({
|
|
2026
2027
|
from: t.from,
|
|
2027
|
-
to: t.from +
|
|
2028
|
-
insert:
|
|
2028
|
+
to: t.from + s.length,
|
|
2029
|
+
insert: c
|
|
2029
2030
|
}));
|
|
2030
2031
|
});
|
|
2031
|
-
return
|
|
2032
|
-
},
|
|
2032
|
+
return i.changes.empty || t(e.update(i, { userEvent: "indent" })), !0;
|
|
2033
|
+
}, xi = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(yi(e, (t, n) => {
|
|
2033
2034
|
n.push({
|
|
2034
2035
|
from: t.from,
|
|
2035
|
-
insert: e.facet(
|
|
2036
|
+
insert: e.facet(ke)
|
|
2036
2037
|
});
|
|
2037
|
-
}), { userEvent: "input.indent" })), !0),
|
|
2038
|
+
}), { userEvent: "input.indent" })), !0), Si = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(yi(e, (t, n) => {
|
|
2038
2039
|
let r = /^\s*/.exec(t.text)[0];
|
|
2039
2040
|
if (!r) return;
|
|
2040
|
-
let
|
|
2041
|
-
for (;
|
|
2041
|
+
let i = g(r, e.tabSize), a = 0, o = ve(e, Math.max(0, i - Ae(e)));
|
|
2042
|
+
for (; a < r.length && a < o.length && r.charCodeAt(a) == o.charCodeAt(a);) a++;
|
|
2042
2043
|
n.push({
|
|
2043
|
-
from: t.from +
|
|
2044
|
+
from: t.from + a,
|
|
2044
2045
|
to: t.from + r.length,
|
|
2045
|
-
insert:
|
|
2046
|
+
insert: o.slice(a)
|
|
2046
2047
|
});
|
|
2047
|
-
}), { userEvent: "delete.dedent" })), !0),
|
|
2048
|
+
}), { userEvent: "delete.dedent" })), !0), Ci = (e) => (e.setTabFocusMode(), !0), wi = [
|
|
2048
2049
|
{
|
|
2049
2050
|
key: "Ctrl-b",
|
|
2050
|
-
run:
|
|
2051
|
-
shift:
|
|
2051
|
+
run: Jn,
|
|
2052
|
+
shift: yr,
|
|
2052
2053
|
preventDefault: !0
|
|
2053
2054
|
},
|
|
2054
2055
|
{
|
|
2055
2056
|
key: "Ctrl-f",
|
|
2056
|
-
run:
|
|
2057
|
-
shift:
|
|
2057
|
+
run: Yn,
|
|
2058
|
+
shift: br
|
|
2058
2059
|
},
|
|
2059
2060
|
{
|
|
2060
2061
|
key: "Ctrl-p",
|
|
2061
|
-
run:
|
|
2062
|
-
shift:
|
|
2062
|
+
run: ir,
|
|
2063
|
+
shift: Dr
|
|
2063
2064
|
},
|
|
2064
2065
|
{
|
|
2065
2066
|
key: "Ctrl-n",
|
|
2066
|
-
run:
|
|
2067
|
-
shift:
|
|
2067
|
+
run: ar,
|
|
2068
|
+
shift: Or
|
|
2068
2069
|
},
|
|
2069
2070
|
{
|
|
2070
2071
|
key: "Ctrl-a",
|
|
2071
|
-
run:
|
|
2072
|
-
shift:
|
|
2072
|
+
run: mr,
|
|
2073
|
+
shift: Ir
|
|
2073
2074
|
},
|
|
2074
2075
|
{
|
|
2075
2076
|
key: "Ctrl-e",
|
|
2076
|
-
run:
|
|
2077
|
-
shift:
|
|
2077
|
+
run: hr,
|
|
2078
|
+
shift: Lr
|
|
2078
2079
|
},
|
|
2079
2080
|
{
|
|
2080
2081
|
key: "Ctrl-d",
|
|
2081
|
-
run:
|
|
2082
|
+
run: Qr
|
|
2082
2083
|
},
|
|
2083
2084
|
{
|
|
2084
2085
|
key: "Ctrl-h",
|
|
2085
|
-
run:
|
|
2086
|
+
run: Zr
|
|
2086
2087
|
},
|
|
2087
2088
|
{
|
|
2088
2089
|
key: "Ctrl-k",
|
|
2089
|
-
run:
|
|
2090
|
+
run: ni
|
|
2090
2091
|
},
|
|
2091
2092
|
{
|
|
2092
2093
|
key: "Ctrl-Alt-h",
|
|
2093
|
-
run:
|
|
2094
|
+
run: ei
|
|
2094
2095
|
},
|
|
2095
2096
|
{
|
|
2096
2097
|
key: "Ctrl-o",
|
|
2097
|
-
run:
|
|
2098
|
+
run: ai
|
|
2098
2099
|
},
|
|
2099
2100
|
{
|
|
2100
2101
|
key: "Ctrl-t",
|
|
2101
|
-
run:
|
|
2102
|
+
run: oi
|
|
2102
2103
|
},
|
|
2103
2104
|
{
|
|
2104
2105
|
key: "Ctrl-v",
|
|
2105
|
-
run:
|
|
2106
|
+
run: lr
|
|
2106
2107
|
}
|
|
2107
|
-
],
|
|
2108
|
+
], Ti = /*@__PURE__*/ [
|
|
2108
2109
|
{
|
|
2109
2110
|
key: "ArrowLeft",
|
|
2110
|
-
run:
|
|
2111
|
-
shift:
|
|
2111
|
+
run: Jn,
|
|
2112
|
+
shift: yr,
|
|
2112
2113
|
preventDefault: !0
|
|
2113
2114
|
},
|
|
2114
2115
|
{
|
|
2115
2116
|
key: "Mod-ArrowLeft",
|
|
2116
2117
|
mac: "Alt-ArrowLeft",
|
|
2117
|
-
run:
|
|
2118
|
-
shift:
|
|
2118
|
+
run: Zn,
|
|
2119
|
+
shift: Sr,
|
|
2119
2120
|
preventDefault: !0
|
|
2120
2121
|
},
|
|
2121
2122
|
{
|
|
2122
2123
|
mac: "Cmd-ArrowLeft",
|
|
2123
|
-
run:
|
|
2124
|
-
shift:
|
|
2124
|
+
run: fr,
|
|
2125
|
+
shift: Pr,
|
|
2125
2126
|
preventDefault: !0
|
|
2126
2127
|
},
|
|
2127
2128
|
{
|
|
2128
2129
|
key: "ArrowRight",
|
|
2129
|
-
run:
|
|
2130
|
-
shift:
|
|
2130
|
+
run: Yn,
|
|
2131
|
+
shift: br,
|
|
2131
2132
|
preventDefault: !0
|
|
2132
2133
|
},
|
|
2133
2134
|
{
|
|
2134
2135
|
key: "Mod-ArrowRight",
|
|
2135
2136
|
mac: "Alt-ArrowRight",
|
|
2136
|
-
run:
|
|
2137
|
-
shift:
|
|
2137
|
+
run: Qn,
|
|
2138
|
+
shift: Cr,
|
|
2138
2139
|
preventDefault: !0
|
|
2139
2140
|
},
|
|
2140
2141
|
{
|
|
2141
2142
|
mac: "Cmd-ArrowRight",
|
|
2142
|
-
run:
|
|
2143
|
-
shift:
|
|
2143
|
+
run: pr,
|
|
2144
|
+
shift: Fr,
|
|
2144
2145
|
preventDefault: !0
|
|
2145
2146
|
},
|
|
2146
2147
|
{
|
|
2147
2148
|
key: "ArrowUp",
|
|
2148
|
-
run:
|
|
2149
|
-
shift:
|
|
2149
|
+
run: ir,
|
|
2150
|
+
shift: Dr,
|
|
2150
2151
|
preventDefault: !0
|
|
2151
2152
|
},
|
|
2152
2153
|
{
|
|
2153
2154
|
mac: "Cmd-ArrowUp",
|
|
2154
|
-
run:
|
|
2155
|
-
shift:
|
|
2155
|
+
run: Rr,
|
|
2156
|
+
shift: Br
|
|
2156
2157
|
},
|
|
2157
2158
|
{
|
|
2158
2159
|
mac: "Ctrl-ArrowUp",
|
|
2159
|
-
run:
|
|
2160
|
-
shift:
|
|
2160
|
+
run: cr,
|
|
2161
|
+
shift: Ar
|
|
2161
2162
|
},
|
|
2162
2163
|
{
|
|
2163
2164
|
key: "ArrowDown",
|
|
2164
|
-
run:
|
|
2165
|
-
shift:
|
|
2165
|
+
run: ar,
|
|
2166
|
+
shift: Or,
|
|
2166
2167
|
preventDefault: !0
|
|
2167
2168
|
},
|
|
2168
2169
|
{
|
|
2169
2170
|
mac: "Cmd-ArrowDown",
|
|
2170
|
-
run:
|
|
2171
|
-
shift:
|
|
2171
|
+
run: zr,
|
|
2172
|
+
shift: Vr
|
|
2172
2173
|
},
|
|
2173
2174
|
{
|
|
2174
2175
|
mac: "Ctrl-ArrowDown",
|
|
2175
|
-
run:
|
|
2176
|
-
shift:
|
|
2176
|
+
run: lr,
|
|
2177
|
+
shift: jr
|
|
2177
2178
|
},
|
|
2178
2179
|
{
|
|
2179
2180
|
key: "PageUp",
|
|
2180
|
-
run:
|
|
2181
|
-
shift:
|
|
2181
|
+
run: cr,
|
|
2182
|
+
shift: Ar
|
|
2182
2183
|
},
|
|
2183
2184
|
{
|
|
2184
2185
|
key: "PageDown",
|
|
2185
|
-
run:
|
|
2186
|
-
shift:
|
|
2186
|
+
run: lr,
|
|
2187
|
+
shift: jr
|
|
2187
2188
|
},
|
|
2188
2189
|
{
|
|
2189
2190
|
key: "Home",
|
|
2190
|
-
run:
|
|
2191
|
-
shift:
|
|
2191
|
+
run: dr,
|
|
2192
|
+
shift: Nr,
|
|
2192
2193
|
preventDefault: !0
|
|
2193
2194
|
},
|
|
2194
2195
|
{
|
|
2195
2196
|
key: "Mod-Home",
|
|
2196
|
-
run:
|
|
2197
|
-
shift:
|
|
2197
|
+
run: Rr,
|
|
2198
|
+
shift: Br
|
|
2198
2199
|
},
|
|
2199
2200
|
{
|
|
2200
2201
|
key: "End",
|
|
2201
|
-
run:
|
|
2202
|
-
shift:
|
|
2202
|
+
run: ur,
|
|
2203
|
+
shift: Mr,
|
|
2203
2204
|
preventDefault: !0
|
|
2204
2205
|
},
|
|
2205
2206
|
{
|
|
2206
2207
|
key: "Mod-End",
|
|
2207
|
-
run:
|
|
2208
|
-
shift:
|
|
2208
|
+
run: zr,
|
|
2209
|
+
shift: Vr
|
|
2209
2210
|
},
|
|
2210
2211
|
{
|
|
2211
2212
|
key: "Enter",
|
|
2212
|
-
run:
|
|
2213
|
-
shift:
|
|
2213
|
+
run: gi,
|
|
2214
|
+
shift: gi
|
|
2214
2215
|
},
|
|
2215
2216
|
{
|
|
2216
2217
|
key: "Mod-a",
|
|
2217
|
-
run:
|
|
2218
|
+
run: Hr
|
|
2218
2219
|
},
|
|
2219
2220
|
{
|
|
2220
2221
|
key: "Backspace",
|
|
2221
|
-
run:
|
|
2222
|
-
shift:
|
|
2222
|
+
run: Zr,
|
|
2223
|
+
shift: Zr,
|
|
2223
2224
|
preventDefault: !0
|
|
2224
2225
|
},
|
|
2225
2226
|
{
|
|
2226
2227
|
key: "Delete",
|
|
2227
|
-
run:
|
|
2228
|
+
run: Qr,
|
|
2228
2229
|
preventDefault: !0
|
|
2229
2230
|
},
|
|
2230
2231
|
{
|
|
2231
2232
|
key: "Mod-Backspace",
|
|
2232
2233
|
mac: "Alt-Backspace",
|
|
2233
|
-
run:
|
|
2234
|
+
run: ei,
|
|
2234
2235
|
preventDefault: !0
|
|
2235
2236
|
},
|
|
2236
2237
|
{
|
|
2237
2238
|
key: "Mod-Delete",
|
|
2238
2239
|
mac: "Alt-Delete",
|
|
2239
|
-
run:
|
|
2240
|
+
run: ti,
|
|
2240
2241
|
preventDefault: !0
|
|
2241
2242
|
},
|
|
2242
2243
|
{
|
|
2243
2244
|
mac: "Mod-Backspace",
|
|
2244
|
-
run:
|
|
2245
|
+
run: ri,
|
|
2245
2246
|
preventDefault: !0
|
|
2246
2247
|
},
|
|
2247
2248
|
{
|
|
2248
2249
|
mac: "Mod-Delete",
|
|
2249
|
-
run:
|
|
2250
|
+
run: ii,
|
|
2250
2251
|
preventDefault: !0
|
|
2251
2252
|
}
|
|
2252
|
-
].concat(/*@__PURE__*/
|
|
2253
|
+
].concat(/*@__PURE__*/ wi.map((e) => ({
|
|
2253
2254
|
mac: e.key,
|
|
2254
2255
|
run: e.run,
|
|
2255
2256
|
shift: e.shift
|
|
2256
|
-
}))),
|
|
2257
|
+
}))), Ei = /*@__PURE__*/ [
|
|
2257
2258
|
{
|
|
2258
2259
|
key: "Alt-ArrowLeft",
|
|
2259
2260
|
mac: "Ctrl-ArrowLeft",
|
|
2260
|
-
run:
|
|
2261
|
-
shift:
|
|
2261
|
+
run: tr,
|
|
2262
|
+
shift: wr
|
|
2262
2263
|
},
|
|
2263
2264
|
{
|
|
2264
2265
|
key: "Alt-ArrowRight",
|
|
2265
2266
|
mac: "Ctrl-ArrowRight",
|
|
2266
|
-
run:
|
|
2267
|
-
shift:
|
|
2267
|
+
run: nr,
|
|
2268
|
+
shift: Tr
|
|
2268
2269
|
},
|
|
2269
2270
|
{
|
|
2270
2271
|
key: "Alt-ArrowUp",
|
|
2271
|
-
run:
|
|
2272
|
+
run: li
|
|
2272
2273
|
},
|
|
2273
2274
|
{
|
|
2274
2275
|
key: "Shift-Alt-ArrowUp",
|
|
2275
|
-
run:
|
|
2276
|
+
run: fi
|
|
2276
2277
|
},
|
|
2277
2278
|
{
|
|
2278
2279
|
key: "Alt-ArrowDown",
|
|
2279
|
-
run:
|
|
2280
|
+
run: ui
|
|
2280
2281
|
},
|
|
2281
2282
|
{
|
|
2282
2283
|
key: "Shift-Alt-ArrowDown",
|
|
2283
|
-
run:
|
|
2284
|
+
run: pi
|
|
2284
2285
|
},
|
|
2285
2286
|
{
|
|
2286
2287
|
key: "Mod-Alt-ArrowUp",
|
|
2287
|
-
run:
|
|
2288
|
+
run: Kr
|
|
2288
2289
|
},
|
|
2289
2290
|
{
|
|
2290
2291
|
key: "Mod-Alt-ArrowDown",
|
|
2291
|
-
run:
|
|
2292
|
+
run: qr
|
|
2292
2293
|
},
|
|
2293
2294
|
{
|
|
2294
2295
|
key: "Escape",
|
|
2295
|
-
run:
|
|
2296
|
+
run: Jr
|
|
2296
2297
|
},
|
|
2297
2298
|
{
|
|
2298
2299
|
key: "Mod-Enter",
|
|
2299
|
-
run:
|
|
2300
|
+
run: _i
|
|
2300
2301
|
},
|
|
2301
2302
|
{
|
|
2302
2303
|
key: "Alt-l",
|
|
2303
2304
|
mac: "Ctrl-l",
|
|
2304
|
-
run:
|
|
2305
|
+
run: Ur
|
|
2305
2306
|
},
|
|
2306
2307
|
{
|
|
2307
2308
|
key: "Mod-i",
|
|
2308
|
-
run:
|
|
2309
|
+
run: Wr,
|
|
2309
2310
|
preventDefault: !0
|
|
2310
2311
|
},
|
|
2311
2312
|
{
|
|
2312
2313
|
key: "Mod-[",
|
|
2313
|
-
run:
|
|
2314
|
+
run: Si
|
|
2314
2315
|
},
|
|
2315
2316
|
{
|
|
2316
2317
|
key: "Mod-]",
|
|
2317
|
-
run:
|
|
2318
|
+
run: xi
|
|
2318
2319
|
},
|
|
2319
2320
|
{
|
|
2320
2321
|
key: "Mod-Alt-\\",
|
|
2321
|
-
run:
|
|
2322
|
+
run: bi
|
|
2322
2323
|
},
|
|
2323
2324
|
{
|
|
2324
2325
|
key: "Shift-Mod-k",
|
|
2325
|
-
run:
|
|
2326
|
+
run: mi
|
|
2326
2327
|
},
|
|
2327
2328
|
{
|
|
2328
2329
|
key: "Shift-Mod-\\",
|
|
2329
|
-
run:
|
|
2330
|
+
run: _r
|
|
2330
2331
|
},
|
|
2331
2332
|
{
|
|
2332
2333
|
key: "Mod-/",
|
|
2333
|
-
run:
|
|
2334
|
+
run: pn
|
|
2334
2335
|
},
|
|
2335
2336
|
{
|
|
2336
2337
|
key: "Alt-A",
|
|
2337
2338
|
mac: "Ctrl-A",
|
|
2338
|
-
run:
|
|
2339
|
+
run: gn
|
|
2339
2340
|
},
|
|
2340
2341
|
{
|
|
2341
2342
|
key: "Ctrl-m",
|
|
2342
2343
|
mac: "Shift-Alt-m",
|
|
2343
|
-
run:
|
|
2344
|
+
run: Ci
|
|
2344
2345
|
}
|
|
2345
|
-
].concat(
|
|
2346
|
+
].concat(Ti), Di = typeof String.prototype.normalize == "function" ? (e) => e.normalize("NFKD") : (e) => e, Oi = class {
|
|
2346
2347
|
constructor(e, t, n = 0, r = e.length, i, a) {
|
|
2347
2348
|
this.test = a, this.value = {
|
|
2348
2349
|
from: 0,
|
|
2349
2350
|
to: 0,
|
|
2350
2351
|
precise: !1
|
|
2351
|
-
}, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, r), this.bufferStart = n, this.normalize = i ? (e) => i(
|
|
2352
|
+
}, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, r), this.bufferStart = n, this.normalize = i ? (e) => i(Di(e)) : Di, this.query = this.normalize(t);
|
|
2352
2353
|
}
|
|
2353
2354
|
peek() {
|
|
2354
2355
|
if (this.bufferPos == this.buffer.length) {
|
|
2355
2356
|
if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done) return -1;
|
|
2356
2357
|
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
2357
2358
|
}
|
|
2358
|
-
return
|
|
2359
|
+
return p(this.buffer, this.bufferPos);
|
|
2359
2360
|
}
|
|
2360
2361
|
next() {
|
|
2361
2362
|
for (; this.matches.length;) this.matches.pop();
|
|
@@ -2365,8 +2366,8 @@ var yi = ({ state: e, dispatch: t }) => {
|
|
|
2365
2366
|
for (;;) {
|
|
2366
2367
|
let e = this.peek();
|
|
2367
2368
|
if (e < 0) return this.done = !0, this;
|
|
2368
|
-
let t =
|
|
2369
|
-
this.bufferPos +=
|
|
2369
|
+
let t = ee(e), n = this.bufferStart + this.bufferPos;
|
|
2370
|
+
this.bufferPos += C(e);
|
|
2370
2371
|
let r = this.normalize(t);
|
|
2371
2372
|
if (r.length) for (let e = 0, i = n, a = !0;; e++) {
|
|
2372
2373
|
let n = r.charCodeAt(e), o = this.match(n, i, a, this.bufferPos + this.bufferStart, e == r.length - 1);
|
|
@@ -2397,20 +2398,20 @@ var yi = ({ state: e, dispatch: t }) => {
|
|
|
2397
2398
|
})), a && this.test && !this.test(a.from, a.to, this.buffer, this.bufferStart) && (a = null), a;
|
|
2398
2399
|
}
|
|
2399
2400
|
};
|
|
2400
|
-
typeof Symbol < "u" && (
|
|
2401
|
+
typeof Symbol < "u" && (Oi.prototype[Symbol.iterator] = function() {
|
|
2401
2402
|
return this;
|
|
2402
2403
|
});
|
|
2403
|
-
var
|
|
2404
|
+
var ki = {
|
|
2404
2405
|
from: -1,
|
|
2405
2406
|
to: -1,
|
|
2406
2407
|
match: /*@__PURE__*/ /.*/.exec(""),
|
|
2407
2408
|
precise: !0
|
|
2408
|
-
},
|
|
2409
|
+
}, Ai = "gm" + (/x/.unicode == null ? "" : "u"), ji = class {
|
|
2409
2410
|
constructor(e, t, n, r = 0, i = e.length) {
|
|
2410
|
-
if (this.text = e, this.to = i, this.curLine = "", this.done = !1, this.value =
|
|
2411
|
-
this.re = new RegExp(t,
|
|
2411
|
+
if (this.text = e, this.to = i, this.curLine = "", this.done = !1, this.value = ki, /\\[sWDnr]|\n|\r|\[\^/.test(t)) return new Pi(e, t, n, r, i);
|
|
2412
|
+
this.re = new RegExp(t, Ai + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.iter = e.iter();
|
|
2412
2413
|
let a = e.lineAt(r);
|
|
2413
|
-
this.curLineStart = a.from, this.matchPos =
|
|
2414
|
+
this.curLineStart = a.from, this.matchPos = Fi(e, r), this.getLine(this.curLineStart);
|
|
2414
2415
|
}
|
|
2415
2416
|
getLine(e) {
|
|
2416
2417
|
this.iter.next(e), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next());
|
|
@@ -2424,7 +2425,7 @@ var Oi = {
|
|
|
2424
2425
|
let t = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
2425
2426
|
if (t) {
|
|
2426
2427
|
let n = this.curLineStart + t.index, r = n + t[0].length;
|
|
2427
|
-
if (this.matchPos =
|
|
2428
|
+
if (this.matchPos = Fi(this.text, r + +(n == r)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < r || n > this.value.to) && (!this.test || this.test(n, r, t))) return this.value = {
|
|
2428
2429
|
from: n,
|
|
2429
2430
|
to: r,
|
|
2430
2431
|
precise: !0,
|
|
@@ -2435,7 +2436,7 @@ var Oi = {
|
|
|
2435
2436
|
else return this.done = !0, this;
|
|
2436
2437
|
}
|
|
2437
2438
|
}
|
|
2438
|
-
},
|
|
2439
|
+
}, Mi = /*@__PURE__*/ new WeakMap(), Ni = class e {
|
|
2439
2440
|
constructor(e, t) {
|
|
2440
2441
|
this.from = e, this.text = t;
|
|
2441
2442
|
}
|
|
@@ -2443,18 +2444,18 @@ var Oi = {
|
|
|
2443
2444
|
return this.from + this.text.length;
|
|
2444
2445
|
}
|
|
2445
2446
|
static get(t, n, r) {
|
|
2446
|
-
let i =
|
|
2447
|
+
let i = Mi.get(t);
|
|
2447
2448
|
if (!i || i.from >= r || i.to <= n) {
|
|
2448
2449
|
let i = new e(n, t.sliceString(n, r));
|
|
2449
|
-
return
|
|
2450
|
+
return Mi.set(t, i), i;
|
|
2450
2451
|
}
|
|
2451
2452
|
if (i.from == n && i.to == r) return i;
|
|
2452
2453
|
let { text: a, from: o } = i;
|
|
2453
|
-
return o > n && (a = t.sliceString(n, o) + a, o = n), i.to < r && (a += t.sliceString(i.to, r)),
|
|
2454
|
+
return o > n && (a = t.sliceString(n, o) + a, o = n), i.to < r && (a += t.sliceString(i.to, r)), Mi.set(t, new e(o, a)), new e(n, a.slice(n - o, r - o));
|
|
2454
2455
|
}
|
|
2455
|
-
},
|
|
2456
|
+
}, Pi = class {
|
|
2456
2457
|
constructor(e, t, n, r, i) {
|
|
2457
|
-
this.text = e, this.to = i, this.done = !1, this.value =
|
|
2458
|
+
this.text = e, this.to = i, this.done = !1, this.value = ki, this.matchPos = Fi(e, r), this.re = new RegExp(t, Ai + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.flat = Ni.get(e, r, this.chunkEnd(r + 5e3));
|
|
2458
2459
|
}
|
|
2459
2460
|
chunkEnd(e) {
|
|
2460
2461
|
return e >= this.to ? this.to : this.text.lineAt(e).to;
|
|
@@ -2469,46 +2470,46 @@ var Oi = {
|
|
|
2469
2470
|
to: n,
|
|
2470
2471
|
precise: !0,
|
|
2471
2472
|
match: t
|
|
2472
|
-
}, this.matchPos =
|
|
2473
|
+
}, this.matchPos = Fi(this.text, n + +(e == n)), this;
|
|
2473
2474
|
}
|
|
2474
2475
|
if (this.flat.to == this.to) return this.done = !0, this;
|
|
2475
|
-
this.flat =
|
|
2476
|
+
this.flat = Ni.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
2476
2477
|
}
|
|
2477
2478
|
}
|
|
2478
2479
|
};
|
|
2479
|
-
typeof Symbol < "u" && (
|
|
2480
|
+
typeof Symbol < "u" && (ji.prototype[Symbol.iterator] = Pi.prototype[Symbol.iterator] = function() {
|
|
2480
2481
|
return this;
|
|
2481
2482
|
});
|
|
2482
|
-
function
|
|
2483
|
+
function Fi(e, t) {
|
|
2483
2484
|
if (t >= e.length) return t;
|
|
2484
2485
|
let n = e.lineAt(t), r;
|
|
2485
2486
|
for (; t < n.to && (r = n.text.charCodeAt(t - n.from)) >= 56320 && r < 57344;) t++;
|
|
2486
2487
|
return t;
|
|
2487
2488
|
}
|
|
2488
|
-
var
|
|
2489
|
+
var Ii = {
|
|
2489
2490
|
highlightWordAroundCursor: !1,
|
|
2490
2491
|
minSelectionLength: 1,
|
|
2491
2492
|
maxMatches: 100,
|
|
2492
2493
|
wholeWords: !1
|
|
2493
|
-
},
|
|
2494
|
-
return
|
|
2494
|
+
}, Li = /*@__PURE__*/ d.define({ combine(e) {
|
|
2495
|
+
return n(e, Ii, {
|
|
2495
2496
|
highlightWordAroundCursor: (e, t) => e || t,
|
|
2496
2497
|
minSelectionLength: Math.min,
|
|
2497
2498
|
maxMatches: Math.min
|
|
2498
2499
|
});
|
|
2499
2500
|
} });
|
|
2500
|
-
function
|
|
2501
|
-
let t = [
|
|
2502
|
-
return e && t.push(
|
|
2503
|
-
}
|
|
2504
|
-
var Ri = /*@__PURE__*/ n.mark({ class: "cm-selectionMatch" }), zi = /*@__PURE__*/ n.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
2505
|
-
function Bi(e, t, n, r) {
|
|
2506
|
-
return (n == 0 || e(t.sliceDoc(n - 1, n)) != v.Word) && (r == t.doc.length || e(t.sliceDoc(r, r + 1)) != v.Word);
|
|
2501
|
+
function Ri(e) {
|
|
2502
|
+
let t = [Wi, Ui];
|
|
2503
|
+
return e && t.push(Li.of(e)), t;
|
|
2507
2504
|
}
|
|
2505
|
+
var zi = /*@__PURE__*/ x.mark({ class: "cm-selectionMatch" }), Bi = /*@__PURE__*/ x.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
2508
2506
|
function Vi(e, t, n, r) {
|
|
2509
|
-
return e(t.sliceDoc(n, n
|
|
2507
|
+
return (n == 0 || e(t.sliceDoc(n - 1, n)) != S.Word) && (r == t.doc.length || e(t.sliceDoc(r, r + 1)) != S.Word);
|
|
2508
|
+
}
|
|
2509
|
+
function Hi(e, t, n, r) {
|
|
2510
|
+
return e(t.sliceDoc(n, n + 1)) == S.Word && e(t.sliceDoc(r - 1, r)) == S.Word;
|
|
2510
2511
|
}
|
|
2511
|
-
var
|
|
2512
|
+
var Ui = /*@__PURE__*/ v.fromClass(class {
|
|
2512
2513
|
constructor(e) {
|
|
2513
2514
|
this.decorations = this.getDeco(e);
|
|
2514
2515
|
}
|
|
@@ -2516,43 +2517,43 @@ var Hi = /*@__PURE__*/ _.fromClass(class {
|
|
|
2516
2517
|
(e.selectionSet || e.docChanged || e.viewportChanged) && (this.decorations = this.getDeco(e.view));
|
|
2517
2518
|
}
|
|
2518
2519
|
getDeco(e) {
|
|
2519
|
-
let t = e.state.facet(
|
|
2520
|
-
if (
|
|
2521
|
-
let
|
|
2522
|
-
if (
|
|
2523
|
-
if (!t.highlightWordAroundCursor) return
|
|
2524
|
-
let e =
|
|
2525
|
-
if (!e) return
|
|
2526
|
-
|
|
2520
|
+
let t = e.state.facet(Li), { state: n } = e, r = n.selection;
|
|
2521
|
+
if (r.ranges.length > 1) return x.none;
|
|
2522
|
+
let i = r.main, a, o = null;
|
|
2523
|
+
if (i.empty) {
|
|
2524
|
+
if (!t.highlightWordAroundCursor) return x.none;
|
|
2525
|
+
let e = n.wordAt(i.head);
|
|
2526
|
+
if (!e) return x.none;
|
|
2527
|
+
o = n.charCategorizer(i.head), a = n.sliceDoc(e.from, e.to);
|
|
2527
2528
|
} else {
|
|
2528
|
-
let e =
|
|
2529
|
-
if (e < t.minSelectionLength || e > 200) return
|
|
2529
|
+
let e = i.to - i.from;
|
|
2530
|
+
if (e < t.minSelectionLength || e > 200) return x.none;
|
|
2530
2531
|
if (t.wholeWords) {
|
|
2531
|
-
if (
|
|
2532
|
-
} else if (
|
|
2532
|
+
if (a = n.sliceDoc(i.from, i.to), o = n.charCategorizer(i.head), !(Vi(o, n, i.from, i.to) && Hi(o, n, i.from, i.to))) return x.none;
|
|
2533
|
+
} else if (a = n.sliceDoc(i.from, i.to), !a) return x.none;
|
|
2533
2534
|
}
|
|
2534
|
-
let
|
|
2535
|
-
for (let
|
|
2536
|
-
let e = new
|
|
2535
|
+
let s = [];
|
|
2536
|
+
for (let r of e.visibleRanges) {
|
|
2537
|
+
let e = new Oi(n.doc, a, r.from, r.to);
|
|
2537
2538
|
for (; !e.next().done;) {
|
|
2538
|
-
let { from:
|
|
2539
|
-
if ((!
|
|
2539
|
+
let { from: r, to: a } = e.value;
|
|
2540
|
+
if ((!o || Vi(o, n, r, a)) && (i.empty && r <= i.from && a >= i.to ? s.push(Bi.range(r, a)) : (r >= i.to || a <= i.from) && s.push(zi.range(r, a)), s.length > t.maxMatches)) return x.none;
|
|
2540
2541
|
}
|
|
2541
2542
|
}
|
|
2542
|
-
return
|
|
2543
|
+
return x.set(s);
|
|
2543
2544
|
}
|
|
2544
|
-
}, { decorations: (e) => e.decorations }),
|
|
2545
|
+
}, { decorations: (e) => e.decorations }), Wi = /*@__PURE__*/ b.baseTheme({
|
|
2545
2546
|
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
2546
2547
|
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
2547
|
-
}),
|
|
2548
|
-
let { selection: n } = e, r =
|
|
2548
|
+
}), Gi = ({ state: e, dispatch: t }) => {
|
|
2549
|
+
let { selection: n } = e, r = a.create(n.ranges.map((t) => e.wordAt(t.head) || a.cursor(t.head)), n.mainIndex);
|
|
2549
2550
|
return !r.eq(n) && (t(e.update({ selection: r })), !0);
|
|
2550
2551
|
};
|
|
2551
|
-
function
|
|
2552
|
+
function Ki(e, t) {
|
|
2552
2553
|
let { main: n, ranges: r } = e.selection, i = e.wordAt(n.head), a = i && i.from == n.from && i.to == n.to;
|
|
2553
|
-
for (let n = !1, i = new
|
|
2554
|
+
for (let n = !1, i = new Oi(e.doc, t, r[r.length - 1].to);;) if (i.next(), i.done) {
|
|
2554
2555
|
if (n) return null;
|
|
2555
|
-
i = new
|
|
2556
|
+
i = new Oi(e.doc, t, 0, Math.max(0, r[r.length - 1].from - 1)), n = !0;
|
|
2556
2557
|
} else {
|
|
2557
2558
|
if (n && r.some((e) => e.from == i.value.from)) continue;
|
|
2558
2559
|
if (a) {
|
|
@@ -2562,83 +2563,83 @@ function Gi(e, t) {
|
|
|
2562
2563
|
return i.value;
|
|
2563
2564
|
}
|
|
2564
2565
|
}
|
|
2565
|
-
var
|
|
2566
|
+
var qi = ({ state: e, dispatch: t }) => {
|
|
2566
2567
|
let { ranges: n } = e.selection;
|
|
2567
|
-
if (n.some((e) => e.from === e.to)) return
|
|
2568
|
+
if (n.some((e) => e.from === e.to)) return Gi({
|
|
2568
2569
|
state: e,
|
|
2569
2570
|
dispatch: t
|
|
2570
2571
|
});
|
|
2571
2572
|
let r = e.sliceDoc(n[0].from, n[0].to);
|
|
2572
2573
|
if (e.selection.ranges.some((t) => e.sliceDoc(t.from, t.to) != r)) return !1;
|
|
2573
|
-
let i =
|
|
2574
|
+
let i = Ki(e, r);
|
|
2574
2575
|
return i ? (t(e.update({
|
|
2575
|
-
selection: e.selection.addRange(
|
|
2576
|
-
effects:
|
|
2576
|
+
selection: e.selection.addRange(a.range(i.from, i.to), !1),
|
|
2577
|
+
effects: b.scrollIntoView(i.to)
|
|
2577
2578
|
})), !0) : !1;
|
|
2578
2579
|
};
|
|
2579
2580
|
//#endregion
|
|
2580
2581
|
//#region ../ui/src/components/codeEditorLanguages.ts
|
|
2581
|
-
async function
|
|
2582
|
-
return
|
|
2582
|
+
async function G(e) {
|
|
2583
|
+
return De.define(await e());
|
|
2583
2584
|
}
|
|
2584
|
-
var
|
|
2585
|
+
var Ji = async () => (await import("./dist-B-n0qSdY.js").then((e) => e.t)).javascript({ typescript: !0 }), Yi = async () => (await import("./dist-B-n0qSdY.js").then((e) => e.t)).javascript({
|
|
2585
2586
|
typescript: !0,
|
|
2586
2587
|
jsx: !0
|
|
2587
|
-
}),
|
|
2588
|
-
ts:
|
|
2589
|
-
mts:
|
|
2590
|
-
cts:
|
|
2591
|
-
tsx:
|
|
2592
|
-
js:
|
|
2593
|
-
jsx:
|
|
2594
|
-
mjs:
|
|
2595
|
-
cjs:
|
|
2596
|
-
json:
|
|
2597
|
-
jsonc:
|
|
2598
|
-
css:
|
|
2599
|
-
scss:
|
|
2600
|
-
less:
|
|
2601
|
-
html:
|
|
2602
|
-
htm:
|
|
2603
|
-
xml:
|
|
2604
|
-
svg:
|
|
2605
|
-
md:
|
|
2606
|
-
markdown:
|
|
2607
|
-
py:
|
|
2608
|
-
go:
|
|
2609
|
-
rs:
|
|
2610
|
-
java:
|
|
2611
|
-
c:
|
|
2612
|
-
h:
|
|
2613
|
-
cpp:
|
|
2614
|
-
cc:
|
|
2615
|
-
cxx:
|
|
2616
|
-
hpp:
|
|
2617
|
-
php:
|
|
2618
|
-
sql:
|
|
2619
|
-
yaml:
|
|
2620
|
-
yml:
|
|
2621
|
-
sh:
|
|
2622
|
-
bash:
|
|
2623
|
-
zsh:
|
|
2624
|
-
toml:
|
|
2625
|
-
ini:
|
|
2626
|
-
cfg:
|
|
2627
|
-
properties:
|
|
2628
|
-
env:
|
|
2629
|
-
rb: () =>
|
|
2630
|
-
cs: () =>
|
|
2588
|
+
}), Xi = async () => (await import("./dist-B-n0qSdY.js").then((e) => e.t)).javascript({ jsx: !0 }), Zi = async () => (await import("./dist-D1XDfvdG.js")).json(), Qi = async () => (await import("./dist-DhtR0qbm.js").then((e) => e.r)).css(), $i = async () => (await import("./dist-B53CIh_q.js")).html(), ea = async () => (await import("./dist-BBPYf4ef.js")).xml(), ta = async () => (await import("./dist-DnmbmV7C.js")).markdown(), na = async () => (await import("./dist-BpRy8-Lq.js")).python(), ra = async () => (await import("./dist-BoHwBqKn.js")).go(), ia = async () => (await import("./dist-s8hmOD0A.js")).rust(), aa = async () => (await import("./dist-DlwWvZ4d.js")).java(), K = async () => (await import("./dist-CEPaeNz_.js")).cpp(), oa = async () => (await import("./dist-n29rG6c2.js")).php(), sa = async () => (await import("./dist-T7rNKseu.js")).sql(), ca = async () => (await import("./dist-XKeyr4Om.js")).yaml(), la = () => G(async () => (await import("./shell-CevoiH_y.js")).shell), ua = () => G(async () => (await import("./dockerfile-4x0UkDoN.js")).dockerFile), da = () => G(async () => (await import("./toml-CPJF62TK.js")).toml), q = () => G(async () => (await import("./properties-C85NeSsH.js")).properties), fa = {
|
|
2589
|
+
ts: Ji,
|
|
2590
|
+
mts: Ji,
|
|
2591
|
+
cts: Ji,
|
|
2592
|
+
tsx: Yi,
|
|
2593
|
+
js: Xi,
|
|
2594
|
+
jsx: Xi,
|
|
2595
|
+
mjs: Xi,
|
|
2596
|
+
cjs: Xi,
|
|
2597
|
+
json: Zi,
|
|
2598
|
+
jsonc: Zi,
|
|
2599
|
+
css: Qi,
|
|
2600
|
+
scss: Qi,
|
|
2601
|
+
less: Qi,
|
|
2602
|
+
html: $i,
|
|
2603
|
+
htm: $i,
|
|
2604
|
+
xml: ea,
|
|
2605
|
+
svg: ea,
|
|
2606
|
+
md: ta,
|
|
2607
|
+
markdown: ta,
|
|
2608
|
+
py: na,
|
|
2609
|
+
go: ra,
|
|
2610
|
+
rs: ia,
|
|
2611
|
+
java: aa,
|
|
2612
|
+
c: K,
|
|
2613
|
+
h: K,
|
|
2614
|
+
cpp: K,
|
|
2615
|
+
cc: K,
|
|
2616
|
+
cxx: K,
|
|
2617
|
+
hpp: K,
|
|
2618
|
+
php: oa,
|
|
2619
|
+
sql: sa,
|
|
2620
|
+
yaml: ca,
|
|
2621
|
+
yml: ca,
|
|
2622
|
+
sh: la,
|
|
2623
|
+
bash: la,
|
|
2624
|
+
zsh: la,
|
|
2625
|
+
toml: da,
|
|
2626
|
+
ini: q,
|
|
2627
|
+
cfg: q,
|
|
2628
|
+
properties: q,
|
|
2629
|
+
env: q,
|
|
2630
|
+
rb: () => G(async () => (await import("./ruby-CjYBP7RB.js")).ruby),
|
|
2631
|
+
cs: () => G(async () => (await import("./clike-VB7owi7S.js")).csharp)
|
|
2631
2632
|
};
|
|
2632
|
-
function
|
|
2633
|
+
function pa(e) {
|
|
2633
2634
|
let t = e.split("/").pop() ?? e;
|
|
2634
|
-
if (/^dockerfile$/i.test(t)) return
|
|
2635
|
-
if (/^\.env(\..+)?$/.test(t)) return
|
|
2636
|
-
let n = t.lastIndexOf("."), r = n < 0 ? void 0 :
|
|
2635
|
+
if (/^dockerfile$/i.test(t)) return ua();
|
|
2636
|
+
if (/^\.env(\..+)?$/.test(t)) return q();
|
|
2637
|
+
let n = t.lastIndexOf("."), r = n < 0 ? void 0 : fa[t.slice(n + 1).toLowerCase()];
|
|
2637
2638
|
return r === void 0 ? Promise.resolve(null) : r();
|
|
2638
2639
|
}
|
|
2639
2640
|
//#endregion
|
|
2640
2641
|
//#region ../node_modules/@codemirror/merge/dist/index.js
|
|
2641
|
-
var
|
|
2642
|
+
var J = class e {
|
|
2642
2643
|
constructor(e, t, n, r) {
|
|
2643
2644
|
this.fromA = e, this.toA = t, this.fromB = n, this.toB = r;
|
|
2644
2645
|
}
|
|
@@ -2646,40 +2647,40 @@ var Y = class e {
|
|
|
2646
2647
|
return new e(this.fromA + t, this.toA + t, this.fromB + n, this.toB + n);
|
|
2647
2648
|
}
|
|
2648
2649
|
};
|
|
2649
|
-
function
|
|
2650
|
+
function Y(e, t, n, r, i, a) {
|
|
2650
2651
|
if (e == r) return [];
|
|
2651
2652
|
let o = xa(e, t, n, r, i, a), s = Sa(e, t + o, n, r, i + o, a);
|
|
2652
2653
|
t += o, n -= s, i += o, a -= s;
|
|
2653
2654
|
let c = n - t, l = a - i;
|
|
2654
|
-
if (!c || !l) return [new
|
|
2655
|
+
if (!c || !l) return [new J(t, n, i, a)];
|
|
2655
2656
|
if (c > l) {
|
|
2656
2657
|
let o = e.slice(t, n).indexOf(r.slice(i, a));
|
|
2657
|
-
if (o > -1) return [new
|
|
2658
|
+
if (o > -1) return [new J(t, t + o, i, i), new J(t + o + l, n, a, a)];
|
|
2658
2659
|
} else if (l > c) {
|
|
2659
2660
|
let o = r.slice(i, a).indexOf(e.slice(t, n));
|
|
2660
|
-
if (o > -1) return [new
|
|
2661
|
+
if (o > -1) return [new J(t, t, i, i + o), new J(n, n, i + o + c, a)];
|
|
2661
2662
|
}
|
|
2662
|
-
if (c == 1 || l == 1) return [new
|
|
2663
|
+
if (c == 1 || l == 1) return [new J(t, n, i, a)];
|
|
2663
2664
|
let u = wa(e, t, n, r, i, a);
|
|
2664
2665
|
if (u) {
|
|
2665
2666
|
let [o, s, c] = u;
|
|
2666
|
-
return
|
|
2667
|
+
return Y(e, t, o, r, i, s).concat(Y(e, o + c, n, r, s + c, a));
|
|
2667
2668
|
}
|
|
2668
2669
|
return ha(e, t, n, r, i, a);
|
|
2669
2670
|
}
|
|
2670
|
-
var
|
|
2671
|
+
var X = 1e9, ma = 0;
|
|
2671
2672
|
function ha(e, t, n, r, i, a) {
|
|
2672
2673
|
let o = n - t, s = a - i;
|
|
2673
|
-
if (
|
|
2674
|
+
if (X < 1e9 && Math.min(o, s) > X * 16 || ma > 0 && Date.now() > ma) return Math.min(o, s) > X * 64 ? [new J(t, n, i, a)] : Ta(e, t, n, r, i, a);
|
|
2674
2675
|
let c = Math.ceil((o + s) / 2);
|
|
2675
2676
|
_a.reset(c), va.reset(c);
|
|
2676
2677
|
let l = (n, a) => e.charCodeAt(t + n) == r.charCodeAt(i + a), u = (t, i) => e.charCodeAt(n - t - 1) == r.charCodeAt(a - i - 1), d = (o - s) % 2 == 0 ? null : va, f = d ? null : _a;
|
|
2677
2678
|
for (let p = 0; p < c; p++) {
|
|
2678
|
-
if (p >
|
|
2679
|
+
if (p > X || ma > 0 && !(p & 63) && Date.now() > ma) return Ta(e, t, n, r, i, a);
|
|
2679
2680
|
let m = _a.advance(p, o, s, c, d, !1, l) || va.advance(p, o, s, c, f, !0, u);
|
|
2680
2681
|
if (m) return ya(e, t, n, t + m[0], r, i, a, i + m[1]);
|
|
2681
2682
|
}
|
|
2682
|
-
return [new
|
|
2683
|
+
return [new J(t, n, i, a)];
|
|
2683
2684
|
}
|
|
2684
2685
|
var ga = class {
|
|
2685
2686
|
constructor() {
|
|
@@ -2714,7 +2715,7 @@ var ga = class {
|
|
|
2714
2715
|
}, _a = /*@__PURE__*/ new ga(), va = /*@__PURE__*/ new ga();
|
|
2715
2716
|
function ya(e, t, n, r, i, a, o, s) {
|
|
2716
2717
|
let c = !1;
|
|
2717
|
-
return !Z(e, r) && ++r == n && (c = !0), !Z(i, s) && ++s == o && (c = !0), c ? [new
|
|
2718
|
+
return !Z(e, r) && ++r == n && (c = !0), !Z(i, s) && ++s == o && (c = !0), c ? [new J(t, n, a, o)] : Y(e, t, r, i, a, s).concat(Y(e, r, n, i, s, o));
|
|
2718
2719
|
}
|
|
2719
2720
|
function ba(e, t) {
|
|
2720
2721
|
let n = 1, r = Math.min(e, t);
|
|
@@ -2790,14 +2791,14 @@ function Ta(e, t, n, r, i, a) {
|
|
|
2790
2791
|
s[2]
|
|
2791
2792
|
];
|
|
2792
2793
|
} else c = Ca(e, t, n, r, i, a, Math.floor(s / 6), 50);
|
|
2793
|
-
if (!c) return [new
|
|
2794
|
+
if (!c) return [new J(t, n, i, a)];
|
|
2794
2795
|
let [l, u, d] = c;
|
|
2795
|
-
return
|
|
2796
|
+
return Y(e, t, l, r, i, u).concat(Y(e, l + d, n, r, u + d, a));
|
|
2796
2797
|
}
|
|
2797
2798
|
function Ea(e, t) {
|
|
2798
2799
|
for (let n = 1; n < e.length; n++) {
|
|
2799
2800
|
let r = e[n - 1], i = e[n];
|
|
2800
|
-
r.toA > i.fromA - t && r.toB > i.fromB - t && (e[n - 1] = new
|
|
2801
|
+
r.toA > i.fromA - t && r.toB > i.fromB - t && (e[n - 1] = new J(r.fromA, i.toA, r.fromB, i.toB), e.splice(n--, 1));
|
|
2801
2802
|
}
|
|
2802
2803
|
}
|
|
2803
2804
|
function Da(e, t, n) {
|
|
@@ -2806,13 +2807,13 @@ function Da(e, t, n) {
|
|
|
2806
2807
|
let r = !1;
|
|
2807
2808
|
for (let i = 0; i < n.length; i++) {
|
|
2808
2809
|
let a = n[i], o, s;
|
|
2809
|
-
(o = xa(e, a.fromA, a.toA, t, a.fromB, a.toB)) && (a = n[i] = new
|
|
2810
|
+
(o = xa(e, a.fromA, a.toA, t, a.fromB, a.toB)) && (a = n[i] = new J(a.fromA + o, a.toA, a.fromB + o, a.toB)), (s = Sa(e, a.fromA, a.toA, t, a.fromB, a.toB)) && (a = n[i] = new J(a.fromA, a.toA - s, a.fromB, a.toB - s));
|
|
2810
2811
|
let c = a.toA - a.fromA, l = a.toB - a.fromB;
|
|
2811
2812
|
if (c && l) continue;
|
|
2812
2813
|
let u = a.fromA - (i ? n[i - 1].toA : 0), d = (i < n.length - 1 ? n[i + 1].fromA : e.length) - a.toA;
|
|
2813
2814
|
if (!u || !d) continue;
|
|
2814
2815
|
let f = c ? e.slice(a.fromA, a.toA) : t.slice(a.fromB, a.toB);
|
|
2815
|
-
u <= f.length && e.slice(a.fromA - u, a.fromA) == f.slice(f.length - u) ? (n[i] = new
|
|
2816
|
+
u <= f.length && e.slice(a.fromA - u, a.fromA) == f.slice(f.length - u) ? (n[i] = new J(a.fromA - u, a.toA - u, a.fromB - u, a.toB - u), r = !0) : d <= f.length && e.slice(a.toA, a.toA + d) == f.slice(0, d) && (n[i] = new J(a.fromA + d, a.toA + d, a.fromB + d, a.toB + d), r = !0);
|
|
2816
2817
|
}
|
|
2817
2818
|
if (!r) break;
|
|
2818
2819
|
}
|
|
@@ -2824,7 +2825,7 @@ function Z(e, t) {
|
|
|
2824
2825
|
}
|
|
2825
2826
|
function Aa(e, t, n) {
|
|
2826
2827
|
let r = n?.override;
|
|
2827
|
-
return r ? r(e, t) : (
|
|
2828
|
+
return r ? r(e, t) : (X = (n?.scanLimit ?? 1e9) >> 1, ma = n?.timeout ? Date.now() + n.timeout : 0, Da(e, t, Y(e, 0, e.length, t, 0, t.length)));
|
|
2828
2829
|
}
|
|
2829
2830
|
//#endregion
|
|
2830
2831
|
//#region ../ui/src/components/gitGutter.ts
|
|
@@ -2867,27 +2868,27 @@ function Ra(e, t, n) {
|
|
|
2867
2868
|
return {
|
|
2868
2869
|
from: t,
|
|
2869
2870
|
to: t,
|
|
2870
|
-
insert:
|
|
2871
|
+
insert: c.of([...r, ""])
|
|
2871
2872
|
};
|
|
2872
2873
|
}
|
|
2873
2874
|
return {
|
|
2874
2875
|
from: e.length,
|
|
2875
2876
|
to: e.length,
|
|
2876
|
-
insert:
|
|
2877
|
+
insert: c.of(["", ...r])
|
|
2877
2878
|
};
|
|
2878
2879
|
}
|
|
2879
2880
|
let i = e.line(n.fromB + 1).from, a = e.line(n.toB).to;
|
|
2880
2881
|
return r.length === 0 ? (n.toB < e.lines ? a = e.line(n.toB + 1).from : n.fromB > 0 && (i = e.line(n.fromB).to), {
|
|
2881
2882
|
from: i,
|
|
2882
2883
|
to: a,
|
|
2883
|
-
insert:
|
|
2884
|
+
insert: c.empty
|
|
2884
2885
|
}) : {
|
|
2885
2886
|
from: i,
|
|
2886
2887
|
to: a,
|
|
2887
|
-
insert:
|
|
2888
|
+
insert: c.of(r)
|
|
2888
2889
|
};
|
|
2889
2890
|
}
|
|
2890
|
-
var za =
|
|
2891
|
+
var za = f.define(), Ba = f.define();
|
|
2891
2892
|
function Va(e) {
|
|
2892
2893
|
let t = [];
|
|
2893
2894
|
for (let n = e.iterLines(); !n.next().done;) t.push(n.value);
|
|
@@ -2900,7 +2901,7 @@ function Ua(e, t) {
|
|
|
2900
2901
|
let n = t.findIndex((t) => t.fromA === e.fromA && t.toA === e.toA);
|
|
2901
2902
|
return n === -1 ? null : n;
|
|
2902
2903
|
}
|
|
2903
|
-
var Q =
|
|
2904
|
+
var Q = o.define({
|
|
2904
2905
|
create: () => ({
|
|
2905
2906
|
baseline: null,
|
|
2906
2907
|
hunks: [],
|
|
@@ -2920,7 +2921,7 @@ var Q = y.define({
|
|
|
2920
2921
|
open: i
|
|
2921
2922
|
};
|
|
2922
2923
|
}
|
|
2923
|
-
}), Wa = class extends
|
|
2924
|
+
}), Wa = class extends ae {
|
|
2924
2925
|
kind;
|
|
2925
2926
|
index;
|
|
2926
2927
|
atEnd;
|
|
@@ -2950,9 +2951,9 @@ function Ga(e) {
|
|
|
2950
2951
|
r.push(new Wa(t, e, a).range(n.line(a ? n.lines : i.fromB + 1).from));
|
|
2951
2952
|
} else for (let a = i.fromB; a < i.toB; a++) r.push(new Wa(t, e).range(n.line(a + 1).from));
|
|
2952
2953
|
}
|
|
2953
|
-
return
|
|
2954
|
+
return oe.of(r, !0);
|
|
2954
2955
|
}
|
|
2955
|
-
var Ka = class extends
|
|
2956
|
+
var Ka = class extends de {
|
|
2956
2957
|
index;
|
|
2957
2958
|
kind;
|
|
2958
2959
|
old;
|
|
@@ -2992,17 +2993,17 @@ var Ka = class extends s {
|
|
|
2992
2993
|
};
|
|
2993
2994
|
function qa(e) {
|
|
2994
2995
|
let t = e.field(Q);
|
|
2995
|
-
if (t.open === null || t.baseline === null) return
|
|
2996
|
-
let
|
|
2997
|
-
if (
|
|
2998
|
-
let
|
|
2999
|
-
return
|
|
3000
|
-
widget:
|
|
2996
|
+
if (t.open === null || t.baseline === null) return x.none;
|
|
2997
|
+
let n = t.hunks[t.open];
|
|
2998
|
+
if (n === void 0) return x.none;
|
|
2999
|
+
let r = e.doc, i = ja(n), a = t.baseline.slice(n.fromA, n.toA), o = new Ka(t.open, i, a, !e.readOnly), s = i !== "deleted", c = s ? r.line(n.toB) : n.fromB < r.lines ? r.line(n.fromB + 1) : r.line(r.lines), l = s || n.fromB >= r.lines;
|
|
3000
|
+
return x.set(x.widget({
|
|
3001
|
+
widget: o,
|
|
3001
3002
|
block: !0,
|
|
3002
|
-
side:
|
|
3003
|
-
}).range(
|
|
3003
|
+
side: l ? 1 : -1
|
|
3004
|
+
}).range(l ? c.to : c.from));
|
|
3004
3005
|
}
|
|
3005
|
-
var Ja =
|
|
3006
|
+
var Ja = v.fromClass(class {
|
|
3006
3007
|
dom = document.createElement("div");
|
|
3007
3008
|
view;
|
|
3008
3009
|
destroyed = !1;
|
|
@@ -3027,7 +3028,7 @@ var Ja = _.fromClass(class {
|
|
|
3027
3028
|
let n = this.view.state.doc.line(Math.min(e.fromB + 1, this.view.state.doc.lines)).from;
|
|
3028
3029
|
this.view.dispatch({
|
|
3029
3030
|
selection: { anchor: n },
|
|
3030
|
-
effects:
|
|
3031
|
+
effects: b.scrollIntoView(n, { y: "center" })
|
|
3031
3032
|
}), this.view.focus();
|
|
3032
3033
|
}), this.dom.append(i);
|
|
3033
3034
|
}
|
|
@@ -3062,7 +3063,7 @@ function Ya() {
|
|
|
3062
3063
|
return [
|
|
3063
3064
|
Q,
|
|
3064
3065
|
Ja,
|
|
3065
|
-
|
|
3066
|
+
b.theme({
|
|
3066
3067
|
"&": { position: "relative" },
|
|
3067
3068
|
".cm-scroller": { marginRight: "10px" },
|
|
3068
3069
|
".cm-git-overview": {
|
|
@@ -3089,8 +3090,8 @@ function Ya() {
|
|
|
3089
3090
|
outlineOffset: "1px"
|
|
3090
3091
|
}
|
|
3091
3092
|
}),
|
|
3092
|
-
|
|
3093
|
-
|
|
3093
|
+
b.decorations.compute([Q], qa),
|
|
3094
|
+
te({
|
|
3094
3095
|
class: "cm-git-gutter",
|
|
3095
3096
|
markers: (e) => Ga(e.state),
|
|
3096
3097
|
lineMarkerChange: (e) => e.startState.field(Q) !== e.state.field(Q)
|
|
@@ -3103,13 +3104,13 @@ var Xa = /* @__PURE__ */ e({
|
|
|
3103
3104
|
CodeEditor: () => no,
|
|
3104
3105
|
detectIndentUnit: () => $a,
|
|
3105
3106
|
documentPosition: () => $
|
|
3106
|
-
}), Za =
|
|
3107
|
-
create: () =>
|
|
3107
|
+
}), Za = f.define(), Qa = o.define({
|
|
3108
|
+
create: () => x.none,
|
|
3108
3109
|
update(e, t) {
|
|
3109
|
-
for (let e of t.effects) if (e.is(Za)) return
|
|
3110
|
+
for (let e of t.effects) if (e.is(Za)) return x.set(e.value.map(({ from: e, to: t, current: n }) => x.mark({ class: n ? "find-match-current" : "find-match" }).range(e, t)), !0);
|
|
3110
3111
|
return e.map(t.changes);
|
|
3111
3112
|
},
|
|
3112
|
-
provide: (e) =>
|
|
3113
|
+
provide: (e) => b.decorations.from(e)
|
|
3113
3114
|
});
|
|
3114
3115
|
function $a(e) {
|
|
3115
3116
|
if (/^\t/m.test(e)) return " ";
|
|
@@ -3121,25 +3122,25 @@ function $(e, t) {
|
|
|
3121
3122
|
for (let r = e.indexOf("\r\n"); r !== -1 && r < t - 1; r = e.indexOf("\r\n", r + 2)) n++;
|
|
3122
3123
|
return t - n;
|
|
3123
3124
|
}
|
|
3124
|
-
var eo = ({ state: e, dispatch: t }) => e.selection.ranges.some((e) => !e.empty) ?
|
|
3125
|
+
var eo = ({ state: e, dispatch: t }) => e.selection.ranges.some((e) => !e.empty) ? xi({
|
|
3125
3126
|
state: e,
|
|
3126
3127
|
dispatch: t
|
|
3127
|
-
}) : (t(e.update(e.replaceSelection(e.facet(
|
|
3128
|
+
}) : (t(e.update(e.replaceSelection(e.facet(ke)), {
|
|
3128
3129
|
scrollIntoView: !0,
|
|
3129
3130
|
userEvent: "input"
|
|
3130
3131
|
})), !0);
|
|
3131
3132
|
function to(e) {
|
|
3132
3133
|
return [
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3134
|
+
fe(),
|
|
3135
|
+
kn(),
|
|
3136
|
+
ce(),
|
|
3137
|
+
i.allowMultipleSelections.of(!0),
|
|
3138
|
+
xe(),
|
|
3139
|
+
Kt(),
|
|
3140
|
+
un({ activateOnTyping: !1 }),
|
|
3141
|
+
he(),
|
|
3142
|
+
pe(),
|
|
3143
|
+
ne(),
|
|
3143
3144
|
ie.of([
|
|
3144
3145
|
...["Ctrl-s", "Meta-s"].map((t) => ({
|
|
3145
3146
|
key: t,
|
|
@@ -3148,43 +3149,43 @@ function to(e) {
|
|
|
3148
3149
|
})),
|
|
3149
3150
|
{
|
|
3150
3151
|
key: "Mod-d",
|
|
3151
|
-
run:
|
|
3152
|
+
run: qi,
|
|
3152
3153
|
preventDefault: !0
|
|
3153
3154
|
},
|
|
3154
|
-
...
|
|
3155
|
-
...
|
|
3156
|
-
...
|
|
3157
|
-
...
|
|
3158
|
-
...
|
|
3155
|
+
...Qt,
|
|
3156
|
+
...Ei,
|
|
3157
|
+
...Gn,
|
|
3158
|
+
...we,
|
|
3159
|
+
...dn,
|
|
3159
3160
|
{
|
|
3160
3161
|
key: "Tab",
|
|
3161
3162
|
run: eo,
|
|
3162
|
-
shift:
|
|
3163
|
+
shift: Si,
|
|
3163
3164
|
preventDefault: !0
|
|
3164
3165
|
}
|
|
3165
3166
|
]),
|
|
3166
|
-
|
|
3167
|
+
b.updateListener.of((t) => {
|
|
3167
3168
|
t.docChanged && e.current.onChange?.(t.state.sliceDoc());
|
|
3168
3169
|
})
|
|
3169
3170
|
];
|
|
3170
3171
|
}
|
|
3171
|
-
function no({ value: e, path:
|
|
3172
|
-
let d =
|
|
3173
|
-
onChange:
|
|
3174
|
-
onSave:
|
|
3172
|
+
function no({ value: e, path: t, onChange: n, onSave: r, handle: o, onReady: s, readOnly: c = !1, baseline: l = null, label: u = c ? "File source" : "File editor" }) {
|
|
3173
|
+
let d = Ne(null), f = Ne(null), p = Ne({
|
|
3174
|
+
onChange: n,
|
|
3175
|
+
onSave: r
|
|
3175
3176
|
});
|
|
3176
|
-
|
|
3177
|
-
onChange:
|
|
3178
|
-
onSave:
|
|
3179
|
-
},
|
|
3177
|
+
p.current = {
|
|
3178
|
+
onChange: n,
|
|
3179
|
+
onSave: r
|
|
3180
|
+
}, Me(o, () => ({
|
|
3180
3181
|
focus: () => f.current?.focus(),
|
|
3181
3182
|
select(e, t) {
|
|
3182
3183
|
let n = f.current;
|
|
3183
3184
|
if (n === null) return;
|
|
3184
|
-
let r = n.state.sliceDoc(), i = n.state.doc.length,
|
|
3185
|
+
let r = n.state.sliceDoc(), i = n.state.doc.length, o = Math.min($(r, e), i), s = Math.min($(r, t), i);
|
|
3185
3186
|
n.dispatch({
|
|
3186
|
-
selection:
|
|
3187
|
-
effects:
|
|
3187
|
+
selection: a.single(o, s),
|
|
3188
|
+
effects: b.scrollIntoView(o, { y: "center" })
|
|
3188
3189
|
});
|
|
3189
3190
|
},
|
|
3190
3191
|
markMatches(e, t) {
|
|
@@ -3197,45 +3198,45 @@ function no({ value: e, path: n, onChange: r, onSave: i, handle: a, onReady: o,
|
|
|
3197
3198
|
})).filter(({ from: e, to: t }) => e < t);
|
|
3198
3199
|
n.dispatch({ effects: Za.of(a) });
|
|
3199
3200
|
}
|
|
3200
|
-
})),
|
|
3201
|
-
let
|
|
3201
|
+
})), je(() => {
|
|
3202
|
+
let n = new h(), r = new b({
|
|
3202
3203
|
parent: d.current,
|
|
3203
|
-
state:
|
|
3204
|
+
state: i.create({
|
|
3204
3205
|
doc: e,
|
|
3205
3206
|
extensions: [
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3207
|
+
i.lineSeparator.of(e.includes("\r\n") ? "\r\n" : "\n"),
|
|
3208
|
+
ke.of($a(e)),
|
|
3209
|
+
re(),
|
|
3209
3210
|
Ya(),
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3211
|
+
le(),
|
|
3212
|
+
Ee(),
|
|
3213
|
+
y(),
|
|
3214
|
+
be(Te),
|
|
3215
|
+
Ce(),
|
|
3216
|
+
Ri(),
|
|
3216
3217
|
Qa,
|
|
3217
|
-
|
|
3218
|
-
|
|
3218
|
+
b.lineWrapping,
|
|
3219
|
+
b.contentAttributes.of({
|
|
3219
3220
|
"aria-label": u,
|
|
3220
3221
|
spellcheck: "false"
|
|
3221
3222
|
}),
|
|
3222
|
-
...
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
ie.of(
|
|
3226
|
-
] : to(
|
|
3227
|
-
|
|
3223
|
+
...c ? [
|
|
3224
|
+
i.readOnly.of(!0),
|
|
3225
|
+
b.editable.of(!1),
|
|
3226
|
+
ie.of(we)
|
|
3227
|
+
] : to(p),
|
|
3228
|
+
n.of([])
|
|
3228
3229
|
]
|
|
3229
3230
|
})
|
|
3230
3231
|
});
|
|
3231
|
-
f.current =
|
|
3232
|
+
f.current = r, s?.(), l !== null && r.dispatch({ effects: za.of(l) }), c || r.focus();
|
|
3232
3233
|
let a = !0;
|
|
3233
|
-
return
|
|
3234
|
-
a && e !== null &&
|
|
3234
|
+
return pa(t).then((e) => {
|
|
3235
|
+
a && e !== null && r.dispatch({ effects: n.reconfigure(e) });
|
|
3235
3236
|
}, () => {}), () => {
|
|
3236
|
-
a = !1,
|
|
3237
|
+
a = !1, r.destroy(), f.current = null;
|
|
3237
3238
|
};
|
|
3238
|
-
}, []),
|
|
3239
|
+
}, []), je(() => {
|
|
3239
3240
|
let t = f.current;
|
|
3240
3241
|
t !== null && t.state.sliceDoc() !== e && t.dispatch({ changes: {
|
|
3241
3242
|
from: 0,
|
|
@@ -3243,15 +3244,15 @@ function no({ value: e, path: n, onChange: r, onSave: i, handle: a, onReady: o,
|
|
|
3243
3244
|
insert: e
|
|
3244
3245
|
} });
|
|
3245
3246
|
}, [e]);
|
|
3246
|
-
let
|
|
3247
|
-
return
|
|
3247
|
+
let m = Ne(l);
|
|
3248
|
+
return je(() => {
|
|
3248
3249
|
let e = f.current;
|
|
3249
|
-
e !== null &&
|
|
3250
|
-
}, [l]), /* @__PURE__ */
|
|
3250
|
+
e !== null && m.current !== l && (m.current = l, e.dispatch({ effects: za.of(l) }));
|
|
3251
|
+
}, [l]), /* @__PURE__ */ Pe("div", {
|
|
3251
3252
|
ref: d,
|
|
3252
3253
|
className: "code-editor h-full w-full",
|
|
3253
|
-
"data-testid":
|
|
3254
|
+
"data-testid": c ? "file-source" : "file-editor"
|
|
3254
3255
|
});
|
|
3255
3256
|
}
|
|
3256
3257
|
//#endregion
|
|
3257
|
-
export { no as CodeEditor,
|
|
3258
|
+
export { no as CodeEditor, Ht as a, $a as detectIndentUnit, $ as documentPosition, ze as i, Fe as n, Re as r, Xa as t };
|