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