@notmrabhi/flowforge 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/GatewayBranchEdge-BdUVHQJc.js +0 -1263
- package/dist/GatewayBranchEdge-DK6kuCK2.js +0 -1
- package/dist/SchemaBuilderDrawer-157p-2Vj.js +0 -1136
- package/dist/SchemaBuilderDrawer-Wje7pVrn.js +0 -1
- package/dist/bpmn-CcuE2X_Q.js +0 -2
- package/dist/bpmn-CtfWDaOY.js +0 -33
- package/dist/canvas.cjs +0 -1
- package/dist/canvas.d.ts +0 -809
- package/dist/canvas.js +0 -28
- package/dist/canvasTokens-CAD6G24b.js +0 -32
- package/dist/canvasTokens-gKNYrPl4.js +0 -1
- package/dist/core.cjs +0 -1
- package/dist/core.d.ts +0 -374
- package/dist/core.js +0 -24
- package/dist/defaultUi.cjs +0 -1
- package/dist/defaultUi.d.ts +0 -83
- package/dist/defaultUi.js +0 -18
- package/dist/form.cjs +0 -1
- package/dist/form.d.ts +0 -857
- package/dist/form.js +0 -44
- package/dist/index-B31-Y5uO.js +0 -11
- package/dist/index-B3aHpb84.js +0 -13
- package/dist/index-BU09HbVh.js +0 -10176
- package/dist/index-BnzttJ4w.js +0 -13758
- package/dist/index-BysKSEtZ.js +0 -1
- package/dist/index-CQ0cVcHp.js +0 -2
- package/dist/index-CkjEllpd.js +0 -1
- package/dist/index-Codx5QwP.js +0 -41
- package/dist/index-Cw9DC-tf.js +0 -76
- package/dist/index-CzPi8KQC.js +0 -1310
- package/dist/index-D14V8rKX.js +0 -1
- package/dist/index-Da5NHCS2.js +0 -8132
- package/dist/index-a1IOaYsW.js +0 -9
- package/dist/index-a3QMaedZ.js +0 -2553
- package/dist/index-gtgq_241.js +0 -3
- package/dist/index-l6kvDx-m.js +0 -1360
- package/dist/index-lcviy90e.js +0 -613
- package/dist/index-wOnYb3DO.js +0 -567
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1409
- package/dist/index.js +0 -107
- package/dist/messages-CO299wPN.js +0 -22
- package/dist/messages-O9Tw_XXR.js +0 -1
- package/dist/nodeRegistry.cjs +0 -1
- package/dist/nodeRegistry.d.ts +0 -334
- package/dist/nodeRegistry.js +0 -555
- package/dist/style.css +0 -6
- package/dist/templateRegistry.cjs +0 -1
- package/dist/templateRegistry.d.ts +0 -83
- package/dist/templateRegistry.js +0 -43
- package/dist/templateSkeletons--Ol7Sg7H.js +0 -1
- package/dist/templateSkeletons-DcvDac7_.js +0 -2954
package/dist/index-l6kvDx-m.js
DELETED
|
@@ -1,1360 +0,0 @@
|
|
|
1
|
-
import { c as v, E as C, a as T, f as be, g as xe, S as _, s as Pe, b as L, d as O, F as Ce, e as Le, R as Me, P as ee, V as ke, l as G, k as we, A as Be, M as J, h as Fe, i as H, C as Z, T as $e, j as We, m as Ne, D as q, W as Ue, n as je } from "./index-BnzttJ4w.js";
|
|
2
|
-
class ve {
|
|
3
|
-
/**
|
|
4
|
-
Create a new completion context. (Mostly useful for testing
|
|
5
|
-
completion sources—in the editor, the extension will create
|
|
6
|
-
these for you.)
|
|
7
|
-
*/
|
|
8
|
-
constructor(e, t, n, s) {
|
|
9
|
-
this.state = e, this.pos = t, this.explicit = n, this.view = s, this.abortListeners = [], this.abortOnDocChange = !1;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
Get the extent, content, and (if there is a token) type of the
|
|
13
|
-
token before `this.pos`.
|
|
14
|
-
*/
|
|
15
|
-
tokenBefore(e) {
|
|
16
|
-
let t = H(this.state).resolveInner(this.pos, -1);
|
|
17
|
-
for (; t && e.indexOf(t.name) < 0; )
|
|
18
|
-
t = t.parent;
|
|
19
|
-
return t ? {
|
|
20
|
-
from: t.from,
|
|
21
|
-
to: this.pos,
|
|
22
|
-
text: this.state.sliceDoc(t.from, this.pos),
|
|
23
|
-
type: t.type
|
|
24
|
-
} : null;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
Get the match of the given expression directly before the
|
|
28
|
-
cursor.
|
|
29
|
-
*/
|
|
30
|
-
matchBefore(e) {
|
|
31
|
-
let t = this.state.doc.lineAt(this.pos), n = Math.max(t.from, this.pos - 250), s = t.text.slice(n - t.from, this.pos - t.from), o = s.search(Se(e, !1));
|
|
32
|
-
return o < 0 ? null : { from: n + o, to: this.pos, text: s.slice(o) };
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
Yields true when the query has been aborted. Can be useful in
|
|
36
|
-
asynchronous queries to avoid doing work that will be ignored.
|
|
37
|
-
*/
|
|
38
|
-
get aborted() {
|
|
39
|
-
return this.abortListeners == null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
Allows you to register abort handlers, which will be called when
|
|
43
|
-
the query is
|
|
44
|
-
[aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).
|
|
45
|
-
|
|
46
|
-
By default, running queries will not be aborted for regular
|
|
47
|
-
typing or backspacing, on the assumption that they are likely to
|
|
48
|
-
return a result with a
|
|
49
|
-
[`validFor`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.validFor) field that
|
|
50
|
-
allows the result to be used after all. Passing `onDocChange:
|
|
51
|
-
true` will cause this query to be aborted for any document
|
|
52
|
-
change.
|
|
53
|
-
*/
|
|
54
|
-
addEventListener(e, t, n) {
|
|
55
|
-
e == "abort" && this.abortListeners && (this.abortListeners.push(t), n && n.onDocChange && (this.abortOnDocChange = !0));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function ce(i) {
|
|
59
|
-
let e = Object.keys(i).join(""), t = /\w/.test(e);
|
|
60
|
-
return t && (e = e.replace(/\w/g, "")), `[${t ? "\\w" : ""}${e.replace(/[^\w\s]/g, "\\$&")}]`;
|
|
61
|
-
}
|
|
62
|
-
function Ve(i) {
|
|
63
|
-
let e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null);
|
|
64
|
-
for (let { label: s } of i) {
|
|
65
|
-
e[s[0]] = !0;
|
|
66
|
-
for (let o = 1; o < s.length; o++)
|
|
67
|
-
t[s[o]] = !0;
|
|
68
|
-
}
|
|
69
|
-
let n = ce(e) + ce(t) + "*$";
|
|
70
|
-
return [new RegExp("^" + n), new RegExp(n)];
|
|
71
|
-
}
|
|
72
|
-
function He(i) {
|
|
73
|
-
let e = i.map((s) => typeof s == "string" ? { label: s } : s), [t, n] = e.every((s) => /^\w+$/.test(s.label)) ? [/\w*$/, /\w+$/] : Ve(e);
|
|
74
|
-
return (s) => {
|
|
75
|
-
let o = s.matchBefore(n);
|
|
76
|
-
return o || s.explicit ? { from: o ? o.from : s.pos, options: e, validFor: t } : null;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function $t(i, e) {
|
|
80
|
-
return (t) => {
|
|
81
|
-
for (let n = H(t.state).resolveInner(t.pos, -1); n; n = n.parent) {
|
|
82
|
-
if (i.indexOf(n.name) > -1)
|
|
83
|
-
return null;
|
|
84
|
-
if (n.type.isTop)
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
return e(t);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
class fe {
|
|
91
|
-
constructor(e, t, n, s) {
|
|
92
|
-
this.completion = e, this.source = t, this.match = n, this.score = s;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function E(i) {
|
|
96
|
-
return i.selection.main.from;
|
|
97
|
-
}
|
|
98
|
-
function Se(i, e) {
|
|
99
|
-
var t;
|
|
100
|
-
let { source: n } = i, s = e && n[0] != "^", o = n[n.length - 1] != "$";
|
|
101
|
-
return !s && !o ? i : new RegExp(`${s ? "^" : ""}(?:${n})${o ? "$" : ""}`, (t = i.flags) !== null && t !== void 0 ? t : i.ignoreCase ? "i" : "");
|
|
102
|
-
}
|
|
103
|
-
const te = /* @__PURE__ */ Be.define();
|
|
104
|
-
function qe(i, e, t, n) {
|
|
105
|
-
let { main: s } = i.selection, o = t - s.from, l = n - s.from;
|
|
106
|
-
return {
|
|
107
|
-
...i.changeByRange((a) => {
|
|
108
|
-
if (a != s && t != n && i.sliceDoc(a.from + o, a.from + l) != i.sliceDoc(t, n))
|
|
109
|
-
return { range: a };
|
|
110
|
-
let r = i.toText(e);
|
|
111
|
-
return {
|
|
112
|
-
changes: { from: a.from + o, to: n == s.from ? a.to : a.from + l, insert: r },
|
|
113
|
-
range: C.cursor(a.from + o + r.length)
|
|
114
|
-
};
|
|
115
|
-
}),
|
|
116
|
-
scrollIntoView: !0,
|
|
117
|
-
userEvent: "input.complete"
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
const he = /* @__PURE__ */ new WeakMap();
|
|
121
|
-
function ze(i) {
|
|
122
|
-
if (!Array.isArray(i))
|
|
123
|
-
return i;
|
|
124
|
-
let e = he.get(i);
|
|
125
|
-
return e || he.set(i, e = He(i)), e;
|
|
126
|
-
}
|
|
127
|
-
const j = /* @__PURE__ */ O.define(), B = /* @__PURE__ */ O.define();
|
|
128
|
-
class Ke {
|
|
129
|
-
constructor(e) {
|
|
130
|
-
this.pattern = e, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = [];
|
|
131
|
-
for (let t = 0; t < e.length; ) {
|
|
132
|
-
let n = v(e, t), s = T(n);
|
|
133
|
-
this.chars.push(n);
|
|
134
|
-
let o = e.slice(t, t + s), l = o.toUpperCase();
|
|
135
|
-
this.folded.push(v(l == o ? o.toLowerCase() : l, 0)), t += s;
|
|
136
|
-
}
|
|
137
|
-
this.astral = e.length != this.chars.length;
|
|
138
|
-
}
|
|
139
|
-
ret(e, t) {
|
|
140
|
-
return this.score = e, this.matched = t, this;
|
|
141
|
-
}
|
|
142
|
-
// Matches a given word (completion) against the pattern (input).
|
|
143
|
-
// Will return a boolean indicating whether there was a match and,
|
|
144
|
-
// on success, set `this.score` to the score, `this.matched` to an
|
|
145
|
-
// array of `from, to` pairs indicating the matched parts of `word`.
|
|
146
|
-
//
|
|
147
|
-
// The score is a number that is more negative the worse the match
|
|
148
|
-
// is. See `Penalty` above.
|
|
149
|
-
match(e) {
|
|
150
|
-
if (this.pattern.length == 0)
|
|
151
|
-
return this.ret(-100, []);
|
|
152
|
-
if (e.length < this.pattern.length)
|
|
153
|
-
return null;
|
|
154
|
-
let { chars: t, folded: n, any: s, precise: o, byWord: l } = this;
|
|
155
|
-
if (t.length == 1) {
|
|
156
|
-
let d = v(e, 0), D = T(d), S = D == e.length ? 0 : -100;
|
|
157
|
-
if (d != t[0]) if (d == n[0])
|
|
158
|
-
S += -200;
|
|
159
|
-
else
|
|
160
|
-
return null;
|
|
161
|
-
return this.ret(S, [0, D]);
|
|
162
|
-
}
|
|
163
|
-
let a = e.indexOf(this.pattern);
|
|
164
|
-
if (a == 0)
|
|
165
|
-
return this.ret(e.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]);
|
|
166
|
-
let r = t.length, h = 0;
|
|
167
|
-
if (a < 0) {
|
|
168
|
-
for (let d = 0, D = Math.min(e.length, 200); d < D && h < r; ) {
|
|
169
|
-
let S = v(e, d);
|
|
170
|
-
(S == t[h] || S == n[h]) && (s[h++] = d), d += T(S);
|
|
171
|
-
}
|
|
172
|
-
if (h < r)
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
let c = 0, f = 0, p = !1, u = 0, m = -1, y = -1, k = /[a-z]/.test(e), I = !0;
|
|
176
|
-
for (let d = 0, D = Math.min(e.length, 200), S = 0; d < D && f < r; ) {
|
|
177
|
-
let b = v(e, d);
|
|
178
|
-
a < 0 && (c < r && b == t[c] && (o[c++] = d), u < r && (b == t[u] || b == n[u] ? (u == 0 && (m = d), y = d + 1, u++) : u = 0));
|
|
179
|
-
let N, K = b < 255 ? b >= 48 && b <= 57 || b >= 97 && b <= 122 ? 2 : b >= 65 && b <= 90 ? 1 : 0 : (N = be(b)) != N.toLowerCase() ? 1 : N != N.toUpperCase() ? 2 : 0;
|
|
180
|
-
(!d || K == 1 && k || S == 0 && K != 0) && (t[f] == b || n[f] == b && (p = !0) ? l[f++] = d : l.length && (I = !1)), S = K, d += T(b);
|
|
181
|
-
}
|
|
182
|
-
return f == r && l[0] == 0 && I ? this.result(-100 + (p ? -200 : 0), l, e) : u == r && m == 0 ? this.ret(-200 - e.length + (y == e.length ? 0 : -100), [0, y]) : a > -1 ? this.ret(-700 - e.length, [a, a + this.pattern.length]) : u == r ? this.ret(-900 - e.length, [m, y]) : f == r ? this.result(-100 + (p ? -200 : 0) + -700 + (I ? 0 : -1100), l, e) : t.length == 2 ? null : this.result((s[0] ? -700 : 0) + -200 + -1100, s, e);
|
|
183
|
-
}
|
|
184
|
-
result(e, t, n) {
|
|
185
|
-
let s = [], o = 0;
|
|
186
|
-
for (let l of t) {
|
|
187
|
-
let a = l + (this.astral ? T(v(n, l)) : 1);
|
|
188
|
-
o && s[o - 1] == l ? s[o - 1] = a : (s[o++] = l, s[o++] = a);
|
|
189
|
-
}
|
|
190
|
-
return this.ret(e - n.length, s);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
class Qe {
|
|
194
|
-
constructor(e) {
|
|
195
|
-
this.pattern = e, this.matched = [], this.score = 0, this.folded = e.toLowerCase();
|
|
196
|
-
}
|
|
197
|
-
match(e) {
|
|
198
|
-
if (e.length < this.pattern.length)
|
|
199
|
-
return null;
|
|
200
|
-
let t = e.slice(0, this.pattern.length), n = t == this.pattern ? 0 : t.toLowerCase() == this.folded ? -200 : null;
|
|
201
|
-
return n == null ? null : (this.matched = [0, t.length], this.score = n + (e.length == this.pattern.length ? 0 : -100), this);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
const g = /* @__PURE__ */ Ce.define({
|
|
205
|
-
combine(i) {
|
|
206
|
-
return Le(i, {
|
|
207
|
-
activateOnTyping: !0,
|
|
208
|
-
activateOnCompletion: () => !1,
|
|
209
|
-
activateOnTypingDelay: 100,
|
|
210
|
-
selectOnOpen: !0,
|
|
211
|
-
override: null,
|
|
212
|
-
closeOnBlur: !0,
|
|
213
|
-
maxRenderedOptions: 100,
|
|
214
|
-
defaultKeymap: !0,
|
|
215
|
-
tooltipClass: () => "",
|
|
216
|
-
optionClass: () => "",
|
|
217
|
-
aboveCursor: !1,
|
|
218
|
-
icons: !0,
|
|
219
|
-
addToOptions: [],
|
|
220
|
-
positionInfo: Ye,
|
|
221
|
-
filterStrict: !1,
|
|
222
|
-
compareCompletions: (e, t) => (e.sortText || e.label).localeCompare(t.sortText || t.label),
|
|
223
|
-
interactionDelay: 75,
|
|
224
|
-
updateSyncTime: 100
|
|
225
|
-
}, {
|
|
226
|
-
defaultKeymap: (e, t) => e && t,
|
|
227
|
-
closeOnBlur: (e, t) => e && t,
|
|
228
|
-
icons: (e, t) => e && t,
|
|
229
|
-
tooltipClass: (e, t) => (n) => pe(e(n), t(n)),
|
|
230
|
-
optionClass: (e, t) => (n) => pe(e(n), t(n)),
|
|
231
|
-
addToOptions: (e, t) => e.concat(t),
|
|
232
|
-
filterStrict: (e, t) => e || t
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
function pe(i, e) {
|
|
237
|
-
return i ? e ? i + " " + e : i : e;
|
|
238
|
-
}
|
|
239
|
-
function Ye(i, e, t, n, s, o) {
|
|
240
|
-
let l = i.textDirection == je.RTL, a = l, r = !1, h = "top", c, f, p = e.left - s.left, u = s.right - e.right, m = n.right - n.left, y = n.bottom - n.top;
|
|
241
|
-
if (a && p < Math.min(m, u) ? a = !1 : !a && u < Math.min(m, p) && (a = !0), m <= (a ? p : u))
|
|
242
|
-
c = Math.max(s.top, Math.min(t.top, s.bottom - y)) - e.top, f = Math.min(400, a ? p : u);
|
|
243
|
-
else {
|
|
244
|
-
r = !0, f = Math.min(
|
|
245
|
-
400,
|
|
246
|
-
(l ? e.right : s.right - e.left) - 30
|
|
247
|
-
/* Info.Margin */
|
|
248
|
-
);
|
|
249
|
-
let d = s.bottom - e.bottom;
|
|
250
|
-
d >= y || d > e.top ? c = t.bottom - e.top : (h = "bottom", c = e.bottom - t.top);
|
|
251
|
-
}
|
|
252
|
-
let k = (e.bottom - e.top) / o.offsetHeight, I = (e.right - e.left) / o.offsetWidth;
|
|
253
|
-
return {
|
|
254
|
-
style: `${h}: ${c / k}px; max-width: ${f / I}px`,
|
|
255
|
-
class: "cm-completionInfo-" + (r ? l ? "left-narrow" : "right-narrow" : a ? "left" : "right")
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
const ie = /* @__PURE__ */ O.define();
|
|
259
|
-
function Xe(i) {
|
|
260
|
-
let e = i.addToOptions.slice();
|
|
261
|
-
return i.icons && e.push({
|
|
262
|
-
render(t) {
|
|
263
|
-
let n = document.createElement("div");
|
|
264
|
-
return n.classList.add("cm-completionIcon"), t.type && n.classList.add(...t.type.split(/\s+/g).map((s) => "cm-completionIcon-" + s)), n.setAttribute("aria-hidden", "true"), n;
|
|
265
|
-
},
|
|
266
|
-
position: 20
|
|
267
|
-
}), e.push({
|
|
268
|
-
render(t, n, s, o) {
|
|
269
|
-
let l = document.createElement("span");
|
|
270
|
-
l.className = "cm-completionLabel";
|
|
271
|
-
let a = t.displayLabel || t.label, r = 0;
|
|
272
|
-
for (let h = 0; h < o.length; ) {
|
|
273
|
-
let c = o[h++], f = o[h++];
|
|
274
|
-
c > r && l.appendChild(document.createTextNode(a.slice(r, c)));
|
|
275
|
-
let p = l.appendChild(document.createElement("span"));
|
|
276
|
-
p.appendChild(document.createTextNode(a.slice(c, f))), p.className = "cm-completionMatchedText", r = f;
|
|
277
|
-
}
|
|
278
|
-
return r < a.length && l.appendChild(document.createTextNode(a.slice(r))), l;
|
|
279
|
-
},
|
|
280
|
-
position: 50
|
|
281
|
-
}, {
|
|
282
|
-
render(t) {
|
|
283
|
-
if (!t.detail)
|
|
284
|
-
return null;
|
|
285
|
-
let n = document.createElement("span");
|
|
286
|
-
return n.className = "cm-completionDetail", n.textContent = t.detail, n;
|
|
287
|
-
},
|
|
288
|
-
position: 80
|
|
289
|
-
}), e.sort((t, n) => t.position - n.position).map((t) => t.render);
|
|
290
|
-
}
|
|
291
|
-
function Q(i, e, t) {
|
|
292
|
-
if (i <= t)
|
|
293
|
-
return { from: 0, to: i };
|
|
294
|
-
if (e < 0 && (e = 0), e <= i >> 1) {
|
|
295
|
-
let s = Math.floor(e / t);
|
|
296
|
-
return { from: s * t, to: (s + 1) * t };
|
|
297
|
-
}
|
|
298
|
-
let n = Math.floor((i - e) / t);
|
|
299
|
-
return { from: i - (n + 1) * t, to: i - n * t };
|
|
300
|
-
}
|
|
301
|
-
class Ge {
|
|
302
|
-
constructor(e, t, n) {
|
|
303
|
-
this.view = e, this.stateField = t, this.applyCompletion = n, this.info = null, this.infoDestroy = null, this.placeInfoReq = {
|
|
304
|
-
read: () => this.measureInfo(),
|
|
305
|
-
write: (r) => this.placeInfo(r),
|
|
306
|
-
key: this
|
|
307
|
-
}, this.space = null, this.currentClass = "";
|
|
308
|
-
let s = e.state.field(t), { options: o, selected: l } = s.open, a = e.state.facet(g);
|
|
309
|
-
this.optionContent = Xe(a), this.optionClass = a.optionClass, this.tooltipClass = a.tooltipClass, this.range = Q(o.length, l, a.maxRenderedOptions), this.dom = document.createElement("div"), this.dom.className = "cm-tooltip-autocomplete", this.updateTooltipClass(e.state), this.dom.addEventListener("mousedown", (r) => {
|
|
310
|
-
let { options: h } = e.state.field(t).open;
|
|
311
|
-
for (let c = r.target, f; c && c != this.dom; c = c.parentNode)
|
|
312
|
-
if (c.nodeName == "LI" && (f = /-(\d+)$/.exec(c.id)) && +f[1] < h.length) {
|
|
313
|
-
this.applyCompletion(e, h[+f[1]]), r.preventDefault();
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
if (r.target == this.list) {
|
|
317
|
-
let c = this.list.classList.contains("cm-completionListIncompleteTop") && r.clientY < this.list.firstChild.getBoundingClientRect().top ? this.range.from - 1 : this.list.classList.contains("cm-completionListIncompleteBottom") && r.clientY > this.list.lastChild.getBoundingClientRect().bottom ? this.range.to : null;
|
|
318
|
-
c != null && (e.dispatch({ effects: ie.of(c) }), r.preventDefault());
|
|
319
|
-
}
|
|
320
|
-
}), this.dom.addEventListener("focusout", (r) => {
|
|
321
|
-
let h = e.state.field(this.stateField, !1);
|
|
322
|
-
h && h.tooltip && e.state.facet(g).closeOnBlur && r.relatedTarget != e.contentDOM && e.dispatch({ effects: B.of(null) });
|
|
323
|
-
}), this.showOptions(o, s.id);
|
|
324
|
-
}
|
|
325
|
-
mount() {
|
|
326
|
-
this.updateSel();
|
|
327
|
-
}
|
|
328
|
-
showOptions(e, t) {
|
|
329
|
-
this.list && this.list.remove(), this.list = this.dom.appendChild(this.createListBox(e, t, this.range)), this.list.addEventListener("scroll", () => {
|
|
330
|
-
this.info && this.view.requestMeasure(this.placeInfoReq);
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
update(e) {
|
|
334
|
-
var t;
|
|
335
|
-
let n = e.state.field(this.stateField), s = e.startState.field(this.stateField);
|
|
336
|
-
if (this.updateTooltipClass(e.state), n != s) {
|
|
337
|
-
let { options: o, selected: l, disabled: a } = n.open;
|
|
338
|
-
(!s.open || s.open.options != o) && (this.range = Q(o.length, l, e.state.facet(g).maxRenderedOptions), this.showOptions(o, n.id)), this.updateSel(), a != ((t = s.open) === null || t === void 0 ? void 0 : t.disabled) && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!a);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
updateTooltipClass(e) {
|
|
342
|
-
let t = this.tooltipClass(e);
|
|
343
|
-
if (t != this.currentClass) {
|
|
344
|
-
for (let n of this.currentClass.split(" "))
|
|
345
|
-
n && this.dom.classList.remove(n);
|
|
346
|
-
for (let n of t.split(" "))
|
|
347
|
-
n && this.dom.classList.add(n);
|
|
348
|
-
this.currentClass = t;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
positioned(e) {
|
|
352
|
-
this.space = e, this.info && this.view.requestMeasure(this.placeInfoReq);
|
|
353
|
-
}
|
|
354
|
-
updateSel() {
|
|
355
|
-
let e = this.view.state.field(this.stateField), t = e.open;
|
|
356
|
-
(t.selected > -1 && t.selected < this.range.from || t.selected >= this.range.to) && (this.range = Q(t.options.length, t.selected, this.view.state.facet(g).maxRenderedOptions), this.showOptions(t.options, e.id));
|
|
357
|
-
let n = this.updateSelectedOption(t.selected);
|
|
358
|
-
if (n) {
|
|
359
|
-
this.destroyInfo();
|
|
360
|
-
let { completion: s } = t.options[t.selected], { info: o } = s;
|
|
361
|
-
if (!o)
|
|
362
|
-
return;
|
|
363
|
-
let l = typeof o == "string" ? document.createTextNode(o) : o(s);
|
|
364
|
-
if (!l)
|
|
365
|
-
return;
|
|
366
|
-
"then" in l ? l.then((a) => {
|
|
367
|
-
a && this.view.state.field(this.stateField, !1) == e && this.addInfoPane(a, s);
|
|
368
|
-
}).catch((a) => G(this.view.state, a, "completion info")) : (this.addInfoPane(l, s), n.setAttribute("aria-describedby", this.info.id));
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
addInfoPane(e, t) {
|
|
372
|
-
this.destroyInfo();
|
|
373
|
-
let n = this.info = document.createElement("div");
|
|
374
|
-
if (n.className = "cm-tooltip cm-completionInfo", n.id = "cm-completionInfo-" + Math.floor(Math.random() * 65535).toString(16), e.nodeType != null)
|
|
375
|
-
n.appendChild(e), this.infoDestroy = null;
|
|
376
|
-
else {
|
|
377
|
-
let { dom: s, destroy: o } = e;
|
|
378
|
-
n.appendChild(s), this.infoDestroy = o || null;
|
|
379
|
-
}
|
|
380
|
-
this.dom.appendChild(n), this.view.requestMeasure(this.placeInfoReq);
|
|
381
|
-
}
|
|
382
|
-
updateSelectedOption(e) {
|
|
383
|
-
let t = null;
|
|
384
|
-
for (let n = this.list.firstChild, s = this.range.from; n; n = n.nextSibling, s++)
|
|
385
|
-
n.nodeName != "LI" || !n.id ? s-- : s == e ? n.hasAttribute("aria-selected") || (n.setAttribute("aria-selected", "true"), t = n) : n.hasAttribute("aria-selected") && (n.removeAttribute("aria-selected"), n.removeAttribute("aria-describedby"));
|
|
386
|
-
return t && Ze(this.list, t), t;
|
|
387
|
-
}
|
|
388
|
-
measureInfo() {
|
|
389
|
-
let e = this.dom.querySelector("[aria-selected]");
|
|
390
|
-
if (!e || !this.info)
|
|
391
|
-
return null;
|
|
392
|
-
let t = this.dom.getBoundingClientRect(), n = this.info.getBoundingClientRect(), s = e.getBoundingClientRect(), o = this.space;
|
|
393
|
-
if (!o) {
|
|
394
|
-
let l = this.dom.ownerDocument.documentElement;
|
|
395
|
-
o = { left: 0, top: 0, right: l.clientWidth, bottom: l.clientHeight };
|
|
396
|
-
}
|
|
397
|
-
return s.top > Math.min(o.bottom, t.bottom) - 10 || s.bottom < Math.max(o.top, t.top) + 10 ? null : this.view.state.facet(g).positionInfo(this.view, t, s, n, o, this.dom);
|
|
398
|
-
}
|
|
399
|
-
placeInfo(e) {
|
|
400
|
-
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");
|
|
401
|
-
}
|
|
402
|
-
createListBox(e, t, n) {
|
|
403
|
-
const s = document.createElement("ul");
|
|
404
|
-
s.id = t, s.setAttribute("role", "listbox"), s.setAttribute("aria-expanded", "true"), s.setAttribute("aria-label", this.view.state.phrase("Completions")), s.addEventListener("mousedown", (l) => {
|
|
405
|
-
l.target == s && l.preventDefault();
|
|
406
|
-
});
|
|
407
|
-
let o = null;
|
|
408
|
-
for (let l = n.from; l < n.to; l++) {
|
|
409
|
-
let { completion: a, match: r } = e[l], { section: h } = a;
|
|
410
|
-
if (h) {
|
|
411
|
-
let p = typeof h == "string" ? h : h.name;
|
|
412
|
-
if (p != o && (l > n.from || n.from == 0))
|
|
413
|
-
if (o = p, typeof h != "string" && h.header)
|
|
414
|
-
s.appendChild(h.header(h));
|
|
415
|
-
else {
|
|
416
|
-
let u = s.appendChild(document.createElement("completion-section"));
|
|
417
|
-
u.textContent = p;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
const c = s.appendChild(document.createElement("li"));
|
|
421
|
-
c.id = t + "-" + l, c.setAttribute("role", "option");
|
|
422
|
-
let f = this.optionClass(a);
|
|
423
|
-
f && (c.className = f);
|
|
424
|
-
for (let p of this.optionContent) {
|
|
425
|
-
let u = p(a, this.view.state, this.view, r);
|
|
426
|
-
u && c.appendChild(u);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
return n.from && s.classList.add("cm-completionListIncompleteTop"), n.to < e.length && s.classList.add("cm-completionListIncompleteBottom"), s;
|
|
430
|
-
}
|
|
431
|
-
destroyInfo() {
|
|
432
|
-
this.info && (this.infoDestroy && this.infoDestroy(), this.info.remove(), this.info = null);
|
|
433
|
-
}
|
|
434
|
-
destroy() {
|
|
435
|
-
this.destroyInfo();
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
function Je(i, e) {
|
|
439
|
-
return (t) => new Ge(t, i, e);
|
|
440
|
-
}
|
|
441
|
-
function Ze(i, e) {
|
|
442
|
-
let t = i.getBoundingClientRect(), n = e.getBoundingClientRect(), s = t.height / i.offsetHeight;
|
|
443
|
-
n.top < t.top ? i.scrollTop -= (t.top - n.top) / s : n.bottom > t.bottom && (i.scrollTop += (n.bottom - t.bottom) / s);
|
|
444
|
-
}
|
|
445
|
-
function ue(i) {
|
|
446
|
-
return (i.boost || 0) * 100 + (i.apply ? 10 : 0) + (i.info ? 5 : 0) + (i.type ? 1 : 0);
|
|
447
|
-
}
|
|
448
|
-
function _e(i, e) {
|
|
449
|
-
let t = [], n = null, s = null, o = (c) => {
|
|
450
|
-
t.push(c);
|
|
451
|
-
let { section: f } = c.completion;
|
|
452
|
-
if (f) {
|
|
453
|
-
n || (n = []);
|
|
454
|
-
let p = typeof f == "string" ? f : f.name;
|
|
455
|
-
n.some((u) => u.name == p) || n.push(typeof f == "string" ? { name: p } : f);
|
|
456
|
-
}
|
|
457
|
-
}, l = e.facet(g);
|
|
458
|
-
for (let c of i)
|
|
459
|
-
if (c.hasResult()) {
|
|
460
|
-
let f = c.result.getMatch;
|
|
461
|
-
if (c.result.filter === !1)
|
|
462
|
-
for (let p of c.result.options)
|
|
463
|
-
o(new fe(p, c.source, f ? f(p) : [], 1e9 - t.length));
|
|
464
|
-
else {
|
|
465
|
-
let p = e.sliceDoc(c.from, c.to), u, m = l.filterStrict ? new Qe(p) : new Ke(p);
|
|
466
|
-
for (let y of c.result.options)
|
|
467
|
-
if (u = m.match(y.label)) {
|
|
468
|
-
let k = y.displayLabel ? f ? f(y, u.matched) : [] : u.matched, I = u.score + (y.boost || 0);
|
|
469
|
-
if (o(new fe(y, c.source, k, I)), typeof y.section == "object" && y.section.rank === "dynamic") {
|
|
470
|
-
let { name: d } = y.section;
|
|
471
|
-
s || (s = /* @__PURE__ */ Object.create(null)), s[d] = Math.max(I, s[d] || -1e9);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
if (n) {
|
|
477
|
-
let c = /* @__PURE__ */ Object.create(null), f = 0, p = (u, m) => (u.rank === "dynamic" && m.rank === "dynamic" ? s[m.name] - s[u.name] : 0) || (typeof u.rank == "number" ? u.rank : 1e9) - (typeof m.rank == "number" ? m.rank : 1e9) || (u.name < m.name ? -1 : 1);
|
|
478
|
-
for (let u of n.sort(p))
|
|
479
|
-
f -= 1e5, c[u.name] = f;
|
|
480
|
-
for (let u of t) {
|
|
481
|
-
let { section: m } = u.completion;
|
|
482
|
-
m && (u.score += c[typeof m == "string" ? m : m.name]);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
let a = [], r = null, h = l.compareCompletions;
|
|
486
|
-
for (let c of t.sort((f, p) => p.score - f.score || h(f.completion, p.completion))) {
|
|
487
|
-
let f = c.completion;
|
|
488
|
-
!r || r.label != f.label || r.detail != f.detail || r.type != null && f.type != null && r.type != f.type || r.apply != f.apply || r.boost != f.boost ? a.push(c) : ue(c.completion) > ue(r) && (a[a.length - 1] = c), r = c.completion;
|
|
489
|
-
}
|
|
490
|
-
return a;
|
|
491
|
-
}
|
|
492
|
-
class R {
|
|
493
|
-
constructor(e, t, n, s, o, l) {
|
|
494
|
-
this.options = e, this.attrs = t, this.tooltip = n, this.timestamp = s, this.selected = o, this.disabled = l;
|
|
495
|
-
}
|
|
496
|
-
setSelected(e, t) {
|
|
497
|
-
return e == this.selected || e >= this.options.length ? this : new R(this.options, de(t, e), this.tooltip, this.timestamp, e, this.disabled);
|
|
498
|
-
}
|
|
499
|
-
static build(e, t, n, s, o, l) {
|
|
500
|
-
if (s && !l && e.some((h) => h.isPending))
|
|
501
|
-
return s.setDisabled();
|
|
502
|
-
let a = _e(e, t);
|
|
503
|
-
if (!a.length)
|
|
504
|
-
return s && e.some((h) => h.isPending) ? s.setDisabled() : null;
|
|
505
|
-
let r = t.facet(g).selectOnOpen ? 0 : -1;
|
|
506
|
-
if (s && s.selected != r && s.selected != -1) {
|
|
507
|
-
let h = s.options[s.selected].completion;
|
|
508
|
-
for (let c = 0; c < a.length; c++)
|
|
509
|
-
if (a[c].completion == h) {
|
|
510
|
-
r = c;
|
|
511
|
-
break;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return new R(a, de(n, r), {
|
|
515
|
-
pos: e.reduce((h, c) => c.hasResult() ? Math.min(h, c.from) : h, 1e8),
|
|
516
|
-
create: ot,
|
|
517
|
-
above: o.aboveCursor
|
|
518
|
-
}, s ? s.timestamp : Date.now(), r, !1);
|
|
519
|
-
}
|
|
520
|
-
map(e) {
|
|
521
|
-
return new R(this.options, this.attrs, { ...this.tooltip, pos: e.mapPos(this.tooltip.pos) }, this.timestamp, this.selected, this.disabled);
|
|
522
|
-
}
|
|
523
|
-
setDisabled() {
|
|
524
|
-
return new R(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, !0);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
class V {
|
|
528
|
-
constructor(e, t, n) {
|
|
529
|
-
this.active = e, this.id = t, this.open = n;
|
|
530
|
-
}
|
|
531
|
-
static start() {
|
|
532
|
-
return new V(nt, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
|
|
533
|
-
}
|
|
534
|
-
update(e) {
|
|
535
|
-
let { state: t } = e, n = t.facet(g), o = (n.override || t.languageDataAt("autocomplete", E(t)).map(ze)).map((r) => (this.active.find((c) => c.source == r) || new w(
|
|
536
|
-
r,
|
|
537
|
-
this.active.some(
|
|
538
|
-
(c) => c.state != 0
|
|
539
|
-
/* State.Inactive */
|
|
540
|
-
) ? 1 : 0
|
|
541
|
-
/* State.Inactive */
|
|
542
|
-
)).update(e, n));
|
|
543
|
-
o.length == this.active.length && o.every((r, h) => r == this.active[h]) && (o = this.active);
|
|
544
|
-
let l = this.open, a = e.effects.some((r) => r.is(ne));
|
|
545
|
-
l && e.docChanged && (l = l.map(e.changes)), e.selection || o.some((r) => r.hasResult() && e.changes.touchesRange(r.from, r.to)) || !et(o, this.active) || a ? l = R.build(o, t, this.id, l, n, a) : l && l.disabled && !o.some((r) => r.isPending) && (l = null), !l && o.every((r) => !r.isPending) && o.some((r) => r.hasResult()) && (o = o.map((r) => r.hasResult() ? new w(
|
|
546
|
-
r.source,
|
|
547
|
-
0
|
|
548
|
-
/* State.Inactive */
|
|
549
|
-
) : r));
|
|
550
|
-
for (let r of e.effects)
|
|
551
|
-
r.is(ie) && (l = l && l.setSelected(r.value, this.id));
|
|
552
|
-
return o == this.active && l == this.open ? this : new V(o, this.id, l);
|
|
553
|
-
}
|
|
554
|
-
get tooltip() {
|
|
555
|
-
return this.open ? this.open.tooltip : null;
|
|
556
|
-
}
|
|
557
|
-
get attrs() {
|
|
558
|
-
return this.open ? this.open.attrs : this.active.length ? tt : it;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
function et(i, e) {
|
|
562
|
-
if (i == e)
|
|
563
|
-
return !0;
|
|
564
|
-
for (let t = 0, n = 0; ; ) {
|
|
565
|
-
for (; t < i.length && !i[t].hasResult(); )
|
|
566
|
-
t++;
|
|
567
|
-
for (; n < e.length && !e[n].hasResult(); )
|
|
568
|
-
n++;
|
|
569
|
-
let s = t == i.length, o = n == e.length;
|
|
570
|
-
if (s || o)
|
|
571
|
-
return s == o;
|
|
572
|
-
if (i[t++].result != e[n++].result)
|
|
573
|
-
return !1;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
const tt = {
|
|
577
|
-
"aria-autocomplete": "list"
|
|
578
|
-
}, it = {};
|
|
579
|
-
function de(i, e) {
|
|
580
|
-
let t = {
|
|
581
|
-
"aria-autocomplete": "list",
|
|
582
|
-
"aria-haspopup": "listbox",
|
|
583
|
-
"aria-controls": i
|
|
584
|
-
};
|
|
585
|
-
return e > -1 && (t["aria-activedescendant"] = i + "-" + e), t;
|
|
586
|
-
}
|
|
587
|
-
const nt = [];
|
|
588
|
-
function Ie(i, e) {
|
|
589
|
-
if (i.isUserEvent("input.complete")) {
|
|
590
|
-
let n = i.annotation(te);
|
|
591
|
-
if (n && e.activateOnCompletion(n))
|
|
592
|
-
return 12;
|
|
593
|
-
}
|
|
594
|
-
let t = i.isUserEvent("input.type");
|
|
595
|
-
return t && e.activateOnTyping ? 5 : t ? 1 : i.isUserEvent("delete.backward") ? 2 : i.selection ? 8 : i.docChanged ? 16 : 0;
|
|
596
|
-
}
|
|
597
|
-
class w {
|
|
598
|
-
constructor(e, t, n = !1) {
|
|
599
|
-
this.source = e, this.state = t, this.explicit = n;
|
|
600
|
-
}
|
|
601
|
-
hasResult() {
|
|
602
|
-
return !1;
|
|
603
|
-
}
|
|
604
|
-
get isPending() {
|
|
605
|
-
return this.state == 1;
|
|
606
|
-
}
|
|
607
|
-
update(e, t) {
|
|
608
|
-
let n = Ie(e, t), s = this;
|
|
609
|
-
(n & 8 || n & 16 && this.touches(e)) && (s = new w(
|
|
610
|
-
s.source,
|
|
611
|
-
0
|
|
612
|
-
/* State.Inactive */
|
|
613
|
-
)), n & 4 && s.state == 0 && (s = new w(
|
|
614
|
-
this.source,
|
|
615
|
-
1
|
|
616
|
-
/* State.Pending */
|
|
617
|
-
)), s = s.updateFor(e, n);
|
|
618
|
-
for (let o of e.effects)
|
|
619
|
-
if (o.is(j))
|
|
620
|
-
s = new w(s.source, 1, o.value);
|
|
621
|
-
else if (o.is(B))
|
|
622
|
-
s = new w(
|
|
623
|
-
s.source,
|
|
624
|
-
0
|
|
625
|
-
/* State.Inactive */
|
|
626
|
-
);
|
|
627
|
-
else if (o.is(ne))
|
|
628
|
-
for (let l of o.value)
|
|
629
|
-
l.source == s.source && (s = l);
|
|
630
|
-
return s;
|
|
631
|
-
}
|
|
632
|
-
updateFor(e, t) {
|
|
633
|
-
return this.map(e.changes);
|
|
634
|
-
}
|
|
635
|
-
map(e) {
|
|
636
|
-
return this;
|
|
637
|
-
}
|
|
638
|
-
touches(e) {
|
|
639
|
-
return e.changes.touchesRange(E(e.state));
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
class P extends w {
|
|
643
|
-
constructor(e, t, n, s, o, l) {
|
|
644
|
-
super(e, 3, t), this.limit = n, this.result = s, this.from = o, this.to = l;
|
|
645
|
-
}
|
|
646
|
-
hasResult() {
|
|
647
|
-
return !0;
|
|
648
|
-
}
|
|
649
|
-
updateFor(e, t) {
|
|
650
|
-
var n;
|
|
651
|
-
if (!(t & 3))
|
|
652
|
-
return this.map(e.changes);
|
|
653
|
-
let s = this.result;
|
|
654
|
-
s.map && !e.changes.empty && (s = s.map(s, e.changes));
|
|
655
|
-
let o = e.changes.mapPos(this.from), l = e.changes.mapPos(this.to, 1), a = E(e.state);
|
|
656
|
-
if (a > l || !s || t & 2 && (E(e.startState) == this.from || a < this.limit))
|
|
657
|
-
return new w(
|
|
658
|
-
this.source,
|
|
659
|
-
t & 4 ? 1 : 0
|
|
660
|
-
/* State.Inactive */
|
|
661
|
-
);
|
|
662
|
-
let r = e.changes.mapPos(this.limit);
|
|
663
|
-
return st(s.validFor, e.state, o, l) ? new P(this.source, this.explicit, r, s, o, l) : s.update && (s = s.update(s, o, l, new ve(e.state, a, !1))) ? new P(this.source, this.explicit, r, s, s.from, (n = s.to) !== null && n !== void 0 ? n : E(e.state)) : new w(this.source, 1, this.explicit);
|
|
664
|
-
}
|
|
665
|
-
map(e) {
|
|
666
|
-
return e.empty ? this : (this.result.map ? this.result.map(this.result, e) : this.result) ? new P(this.source, this.explicit, e.mapPos(this.limit), this.result, e.mapPos(this.from), e.mapPos(this.to, 1)) : new w(
|
|
667
|
-
this.source,
|
|
668
|
-
0
|
|
669
|
-
/* State.Inactive */
|
|
670
|
-
);
|
|
671
|
-
}
|
|
672
|
-
touches(e) {
|
|
673
|
-
return e.changes.touchesRange(this.from, this.to);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
function st(i, e, t, n) {
|
|
677
|
-
if (!i)
|
|
678
|
-
return !1;
|
|
679
|
-
let s = e.sliceDoc(t, n);
|
|
680
|
-
return typeof i == "function" ? i(s, t, n, e) : Se(i, !0).test(s);
|
|
681
|
-
}
|
|
682
|
-
const ne = /* @__PURE__ */ O.define({
|
|
683
|
-
map(i, e) {
|
|
684
|
-
return i.map((t) => t.map(e));
|
|
685
|
-
}
|
|
686
|
-
}), x = /* @__PURE__ */ _.define({
|
|
687
|
-
create() {
|
|
688
|
-
return V.start();
|
|
689
|
-
},
|
|
690
|
-
update(i, e) {
|
|
691
|
-
return i.update(e);
|
|
692
|
-
},
|
|
693
|
-
provide: (i) => [
|
|
694
|
-
Pe.from(i, (e) => e.tooltip),
|
|
695
|
-
L.contentAttributes.from(i, (e) => e.attrs)
|
|
696
|
-
]
|
|
697
|
-
});
|
|
698
|
-
function se(i, e) {
|
|
699
|
-
const t = e.completion.apply || e.completion.label;
|
|
700
|
-
let n = i.state.field(x).active.find((s) => s.source == e.source);
|
|
701
|
-
return n instanceof P ? (typeof t == "string" ? i.dispatch({
|
|
702
|
-
...qe(i.state, t, n.from, n.to),
|
|
703
|
-
annotations: te.of(e.completion)
|
|
704
|
-
}) : t(i, e.completion, n.from, n.to), !0) : !1;
|
|
705
|
-
}
|
|
706
|
-
const ot = /* @__PURE__ */ Je(x, se);
|
|
707
|
-
function U(i, e = "option") {
|
|
708
|
-
return (t) => {
|
|
709
|
-
let n = t.state.field(x, !1);
|
|
710
|
-
if (!n || !n.open || n.open.disabled || Date.now() - n.open.timestamp < t.state.facet(g).interactionDelay)
|
|
711
|
-
return !1;
|
|
712
|
-
let s = 1, o;
|
|
713
|
-
e == "page" && (o = xe(t, n.open.tooltip)) && (s = Math.max(2, Math.floor(o.dom.offsetHeight / o.dom.querySelector("li").offsetHeight) - 1));
|
|
714
|
-
let { length: l } = n.open.options, a = n.open.selected > -1 ? n.open.selected + s * (i ? 1 : -1) : i ? 0 : l - 1;
|
|
715
|
-
return a < 0 ? a = e == "page" ? 0 : l - 1 : a >= l && (a = e == "page" ? l - 1 : 0), t.dispatch({ effects: ie.of(a) }), !0;
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
const lt = (i) => {
|
|
719
|
-
let e = i.state.field(x, !1);
|
|
720
|
-
return i.state.readOnly || !e || !e.open || e.open.selected < 0 || e.open.disabled || Date.now() - e.open.timestamp < i.state.facet(g).interactionDelay ? !1 : se(i, e.open.options[e.open.selected]);
|
|
721
|
-
}, Y = (i) => i.state.field(x, !1) ? (i.dispatch({ effects: j.of(!0) }), !0) : !1, rt = (i) => {
|
|
722
|
-
let e = i.state.field(x, !1);
|
|
723
|
-
return !e || !e.active.some(
|
|
724
|
-
(t) => t.state != 0
|
|
725
|
-
/* State.Inactive */
|
|
726
|
-
) ? !1 : (i.dispatch({ effects: B.of(null) }), !0);
|
|
727
|
-
};
|
|
728
|
-
class at {
|
|
729
|
-
constructor(e, t) {
|
|
730
|
-
this.active = e, this.context = t, this.time = Date.now(), this.updates = [], this.done = void 0;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
const ct = 50, ft = 1e3, ht = /* @__PURE__ */ ke.fromClass(class {
|
|
734
|
-
constructor(i) {
|
|
735
|
-
this.view = i, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.pendingStart = !1, this.composing = 0;
|
|
736
|
-
for (let e of i.state.field(x).active)
|
|
737
|
-
e.isPending && this.startQuery(e);
|
|
738
|
-
}
|
|
739
|
-
update(i) {
|
|
740
|
-
let e = i.state.field(x), t = i.state.facet(g);
|
|
741
|
-
if (!i.selectionSet && !i.docChanged && i.startState.field(x) == e)
|
|
742
|
-
return;
|
|
743
|
-
let n = i.transactions.some((o) => {
|
|
744
|
-
let l = Ie(o, t);
|
|
745
|
-
return l & 8 || (o.selection || o.docChanged) && !(l & 3);
|
|
746
|
-
});
|
|
747
|
-
for (let o = 0; o < this.running.length; o++) {
|
|
748
|
-
let l = this.running[o];
|
|
749
|
-
if (n || l.context.abortOnDocChange && i.docChanged || l.updates.length + i.transactions.length > ct && Date.now() - l.time > ft) {
|
|
750
|
-
for (let a of l.context.abortListeners)
|
|
751
|
-
try {
|
|
752
|
-
a();
|
|
753
|
-
} catch (r) {
|
|
754
|
-
G(this.view.state, r);
|
|
755
|
-
}
|
|
756
|
-
l.context.abortListeners = null, this.running.splice(o--, 1);
|
|
757
|
-
} else
|
|
758
|
-
l.updates.push(...i.transactions);
|
|
759
|
-
}
|
|
760
|
-
this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), i.transactions.some((o) => o.effects.some((l) => l.is(j))) && (this.pendingStart = !0);
|
|
761
|
-
let s = this.pendingStart ? 50 : t.activateOnTypingDelay;
|
|
762
|
-
if (this.debounceUpdate = e.active.some((o) => o.isPending && !this.running.some((l) => l.active.source == o.source)) ? setTimeout(() => this.startUpdate(), s) : -1, this.composing != 0)
|
|
763
|
-
for (let o of i.transactions)
|
|
764
|
-
o.isUserEvent("input.type") ? this.composing = 2 : this.composing == 2 && o.selection && (this.composing = 3);
|
|
765
|
-
}
|
|
766
|
-
startUpdate() {
|
|
767
|
-
this.debounceUpdate = -1, this.pendingStart = !1;
|
|
768
|
-
let { state: i } = this.view, e = i.field(x);
|
|
769
|
-
for (let t of e.active)
|
|
770
|
-
t.isPending && !this.running.some((n) => n.active.source == t.source) && this.startQuery(t);
|
|
771
|
-
this.running.length && e.open && e.open.disabled && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(g).updateSyncTime));
|
|
772
|
-
}
|
|
773
|
-
startQuery(i) {
|
|
774
|
-
let { state: e } = this.view, t = E(e), n = new ve(e, t, i.explicit, this.view), s = new at(i, n);
|
|
775
|
-
this.running.push(s), Promise.resolve(i.source(n)).then((o) => {
|
|
776
|
-
s.context.aborted || (s.done = o || null, this.scheduleAccept());
|
|
777
|
-
}, (o) => {
|
|
778
|
-
this.view.dispatch({ effects: B.of(null) }), G(this.view.state, o);
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
scheduleAccept() {
|
|
782
|
-
this.running.every((i) => i.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(g).updateSyncTime));
|
|
783
|
-
}
|
|
784
|
-
// For each finished query in this.running, try to create a result
|
|
785
|
-
// or, if appropriate, restart the query.
|
|
786
|
-
accept() {
|
|
787
|
-
var i;
|
|
788
|
-
this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1;
|
|
789
|
-
let e = [], t = this.view.state.facet(g), n = this.view.state.field(x);
|
|
790
|
-
for (let s = 0; s < this.running.length; s++) {
|
|
791
|
-
let o = this.running[s];
|
|
792
|
-
if (o.done === void 0)
|
|
793
|
-
continue;
|
|
794
|
-
if (this.running.splice(s--, 1), o.done) {
|
|
795
|
-
let a = E(o.updates.length ? o.updates[0].startState : this.view.state), r = Math.min(a, o.done.from + (o.active.explicit ? 0 : 1)), h = new P(o.active.source, o.active.explicit, r, o.done, o.done.from, (i = o.done.to) !== null && i !== void 0 ? i : a);
|
|
796
|
-
for (let c of o.updates)
|
|
797
|
-
h = h.update(c, t);
|
|
798
|
-
if (h.hasResult()) {
|
|
799
|
-
e.push(h);
|
|
800
|
-
continue;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
let l = n.active.find((a) => a.source == o.active.source);
|
|
804
|
-
if (l && l.isPending)
|
|
805
|
-
if (o.done == null) {
|
|
806
|
-
let a = new w(
|
|
807
|
-
o.active.source,
|
|
808
|
-
0
|
|
809
|
-
/* State.Inactive */
|
|
810
|
-
);
|
|
811
|
-
for (let r of o.updates)
|
|
812
|
-
a = a.update(r, t);
|
|
813
|
-
a.isPending || e.push(a);
|
|
814
|
-
} else
|
|
815
|
-
this.startQuery(l);
|
|
816
|
-
}
|
|
817
|
-
(e.length || n.open && n.open.disabled) && this.view.dispatch({ effects: ne.of(e) });
|
|
818
|
-
}
|
|
819
|
-
}, {
|
|
820
|
-
eventHandlers: {
|
|
821
|
-
blur(i) {
|
|
822
|
-
let e = this.view.state.field(x, !1);
|
|
823
|
-
if (e && e.tooltip && this.view.state.facet(g).closeOnBlur) {
|
|
824
|
-
let t = e.open && xe(this.view, e.open.tooltip);
|
|
825
|
-
(!t || !t.dom.contains(i.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects: B.of(null) }), 10);
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
compositionstart() {
|
|
829
|
-
this.composing = 1;
|
|
830
|
-
},
|
|
831
|
-
compositionend() {
|
|
832
|
-
this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: j.of(!1) }), 20), this.composing = 0;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}), pt = typeof navigator == "object" && /* @__PURE__ */ /Win/.test(navigator.platform), ut = /* @__PURE__ */ ee.highest(/* @__PURE__ */ L.domEventHandlers({
|
|
836
|
-
keydown(i, e) {
|
|
837
|
-
let t = e.state.field(x, !1);
|
|
838
|
-
if (!t || !t.open || t.open.disabled || t.open.selected < 0 || i.key.length > 1 || i.ctrlKey && !(pt && i.altKey) || i.metaKey)
|
|
839
|
-
return !1;
|
|
840
|
-
let n = t.open.options[t.open.selected], s = t.active.find((l) => l.source == n.source), o = n.completion.commitCharacters || s.result.commitCharacters;
|
|
841
|
-
return o && o.indexOf(i.key) > -1 && se(e, n), !1;
|
|
842
|
-
}
|
|
843
|
-
})), Te = /* @__PURE__ */ L.baseTheme({
|
|
844
|
-
".cm-tooltip.cm-tooltip-autocomplete": {
|
|
845
|
-
"& > ul": {
|
|
846
|
-
fontFamily: "monospace",
|
|
847
|
-
whiteSpace: "nowrap",
|
|
848
|
-
overflow: "hidden auto",
|
|
849
|
-
maxWidth_fallback: "700px",
|
|
850
|
-
maxWidth: "min(700px, 95vw)",
|
|
851
|
-
minWidth: "250px",
|
|
852
|
-
maxHeight: "10em",
|
|
853
|
-
height: "100%",
|
|
854
|
-
listStyle: "none",
|
|
855
|
-
margin: 0,
|
|
856
|
-
padding: 0,
|
|
857
|
-
"& > li, & > completion-section": {
|
|
858
|
-
padding: "1px 3px",
|
|
859
|
-
lineHeight: 1.2
|
|
860
|
-
},
|
|
861
|
-
"& > li": {
|
|
862
|
-
overflowX: "hidden",
|
|
863
|
-
textOverflow: "ellipsis",
|
|
864
|
-
cursor: "pointer"
|
|
865
|
-
},
|
|
866
|
-
"& > completion-section": {
|
|
867
|
-
display: "list-item",
|
|
868
|
-
borderBottom: "1px solid silver",
|
|
869
|
-
paddingLeft: "0.5em",
|
|
870
|
-
opacity: 0.7
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
},
|
|
874
|
-
"&light .cm-tooltip-autocomplete ul li[aria-selected]": {
|
|
875
|
-
background: "#17c",
|
|
876
|
-
color: "white"
|
|
877
|
-
},
|
|
878
|
-
"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {
|
|
879
|
-
background: "#777"
|
|
880
|
-
},
|
|
881
|
-
"&dark .cm-tooltip-autocomplete ul li[aria-selected]": {
|
|
882
|
-
background: "#347",
|
|
883
|
-
color: "white"
|
|
884
|
-
},
|
|
885
|
-
"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {
|
|
886
|
-
background: "#444"
|
|
887
|
-
},
|
|
888
|
-
".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": {
|
|
889
|
-
content: '"···"',
|
|
890
|
-
opacity: 0.5,
|
|
891
|
-
display: "block",
|
|
892
|
-
textAlign: "center"
|
|
893
|
-
},
|
|
894
|
-
".cm-tooltip.cm-completionInfo": {
|
|
895
|
-
position: "absolute",
|
|
896
|
-
padding: "3px 9px",
|
|
897
|
-
width: "max-content",
|
|
898
|
-
maxWidth: "400px",
|
|
899
|
-
boxSizing: "border-box",
|
|
900
|
-
whiteSpace: "pre-line"
|
|
901
|
-
},
|
|
902
|
-
".cm-completionInfo.cm-completionInfo-left": { right: "100%" },
|
|
903
|
-
".cm-completionInfo.cm-completionInfo-right": { left: "100%" },
|
|
904
|
-
".cm-completionInfo.cm-completionInfo-left-narrow": { right: "30px" },
|
|
905
|
-
".cm-completionInfo.cm-completionInfo-right-narrow": { left: "30px" },
|
|
906
|
-
"&light .cm-snippetField": { backgroundColor: "#00000022" },
|
|
907
|
-
"&dark .cm-snippetField": { backgroundColor: "#ffffff22" },
|
|
908
|
-
".cm-snippetFieldPosition": {
|
|
909
|
-
verticalAlign: "text-top",
|
|
910
|
-
width: 0,
|
|
911
|
-
height: "1.15em",
|
|
912
|
-
display: "inline-block",
|
|
913
|
-
margin: "0 -0.7px -.7em",
|
|
914
|
-
borderLeft: "1.4px dotted #888"
|
|
915
|
-
},
|
|
916
|
-
".cm-completionMatchedText": {
|
|
917
|
-
textDecoration: "underline"
|
|
918
|
-
},
|
|
919
|
-
".cm-completionDetail": {
|
|
920
|
-
marginLeft: "0.5em",
|
|
921
|
-
fontStyle: "italic"
|
|
922
|
-
},
|
|
923
|
-
".cm-completionIcon": {
|
|
924
|
-
fontSize: "90%",
|
|
925
|
-
width: ".8em",
|
|
926
|
-
display: "inline-block",
|
|
927
|
-
textAlign: "center",
|
|
928
|
-
paddingRight: ".6em",
|
|
929
|
-
opacity: "0.6",
|
|
930
|
-
boxSizing: "content-box"
|
|
931
|
-
},
|
|
932
|
-
".cm-completionIcon-function, .cm-completionIcon-method": {
|
|
933
|
-
"&:after": { content: "'ƒ'" }
|
|
934
|
-
},
|
|
935
|
-
".cm-completionIcon-class": {
|
|
936
|
-
"&:after": { content: "'○'" }
|
|
937
|
-
},
|
|
938
|
-
".cm-completionIcon-interface": {
|
|
939
|
-
"&:after": { content: "'◌'" }
|
|
940
|
-
},
|
|
941
|
-
".cm-completionIcon-variable": {
|
|
942
|
-
"&:after": { content: "'𝑥'" }
|
|
943
|
-
},
|
|
944
|
-
".cm-completionIcon-constant": {
|
|
945
|
-
"&:after": { content: "'𝐶'" }
|
|
946
|
-
},
|
|
947
|
-
".cm-completionIcon-type": {
|
|
948
|
-
"&:after": { content: "'𝑡'" }
|
|
949
|
-
},
|
|
950
|
-
".cm-completionIcon-enum": {
|
|
951
|
-
"&:after": { content: "'∪'" }
|
|
952
|
-
},
|
|
953
|
-
".cm-completionIcon-property": {
|
|
954
|
-
"&:after": { content: "'□'" }
|
|
955
|
-
},
|
|
956
|
-
".cm-completionIcon-keyword": {
|
|
957
|
-
"&:after": { content: "'🔑︎'" }
|
|
958
|
-
// Disable emoji rendering
|
|
959
|
-
},
|
|
960
|
-
".cm-completionIcon-namespace": {
|
|
961
|
-
"&:after": { content: "'▢'" }
|
|
962
|
-
},
|
|
963
|
-
".cm-completionIcon-text": {
|
|
964
|
-
"&:after": { content: "'abc'", fontSize: "50%", verticalAlign: "middle" }
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
class dt {
|
|
968
|
-
constructor(e, t, n, s) {
|
|
969
|
-
this.field = e, this.line = t, this.from = n, this.to = s;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
class oe {
|
|
973
|
-
constructor(e, t, n) {
|
|
974
|
-
this.field = e, this.from = t, this.to = n;
|
|
975
|
-
}
|
|
976
|
-
map(e) {
|
|
977
|
-
let t = e.mapPos(this.from, -1, J.TrackDel), n = e.mapPos(this.to, 1, J.TrackDel);
|
|
978
|
-
return t == null || n == null ? null : new oe(this.field, t, n);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
class le {
|
|
982
|
-
constructor(e, t) {
|
|
983
|
-
this.lines = e, this.fieldPositions = t;
|
|
984
|
-
}
|
|
985
|
-
instantiate(e, t) {
|
|
986
|
-
let n = [], s = [t], o = e.doc.lineAt(t), l = /^\s*/.exec(o.text)[0];
|
|
987
|
-
for (let r of this.lines) {
|
|
988
|
-
if (n.length) {
|
|
989
|
-
let h = l, c = /^\t*/.exec(r)[0].length;
|
|
990
|
-
for (let f = 0; f < c; f++)
|
|
991
|
-
h += e.facet(Ne);
|
|
992
|
-
s.push(t + h.length - c), r = h + r.slice(c);
|
|
993
|
-
}
|
|
994
|
-
n.push(r), t += r.length + 1;
|
|
995
|
-
}
|
|
996
|
-
let a = this.fieldPositions.map((r) => new oe(r.field, s[r.line] + r.from, s[r.line] + r.to));
|
|
997
|
-
return { text: n, ranges: a };
|
|
998
|
-
}
|
|
999
|
-
static parse(e) {
|
|
1000
|
-
let t = [], n = [], s = [], o;
|
|
1001
|
-
for (let l of e.split(/\r\n?|\n/)) {
|
|
1002
|
-
for (; o = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l); ) {
|
|
1003
|
-
let a = o[1] ? +o[1] : null, r = o[2] || o[3] || "", h = -1, c = r.replace(/\\[{}]/g, (f) => f[1]);
|
|
1004
|
-
for (let f = 0; f < t.length; f++)
|
|
1005
|
-
(a != null ? t[f].seq == a : c && t[f].name == c) && (h = f);
|
|
1006
|
-
if (h < 0) {
|
|
1007
|
-
let f = 0;
|
|
1008
|
-
for (; f < t.length && (a == null || t[f].seq != null && t[f].seq < a); )
|
|
1009
|
-
f++;
|
|
1010
|
-
t.splice(f, 0, { seq: a, name: c }), h = f;
|
|
1011
|
-
for (let p of s)
|
|
1012
|
-
p.field >= h && p.field++;
|
|
1013
|
-
}
|
|
1014
|
-
for (let f of s)
|
|
1015
|
-
if (f.line == n.length && f.from > o.index) {
|
|
1016
|
-
let p = o[2] ? 3 + (o[1] || "").length : 2;
|
|
1017
|
-
f.from -= p, f.to -= p;
|
|
1018
|
-
}
|
|
1019
|
-
s.push(new dt(h, n.length, o.index, o.index + c.length)), l = l.slice(0, o.index) + r + l.slice(o.index + o[0].length);
|
|
1020
|
-
}
|
|
1021
|
-
l = l.replace(/\\([{}])/g, (a, r, h) => {
|
|
1022
|
-
for (let c of s)
|
|
1023
|
-
c.line == n.length && c.from > h && (c.from--, c.to--);
|
|
1024
|
-
return r;
|
|
1025
|
-
}), n.push(l);
|
|
1026
|
-
}
|
|
1027
|
-
return new le(n, s);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
let mt = /* @__PURE__ */ q.widget({ widget: /* @__PURE__ */ new class extends Ue {
|
|
1031
|
-
toDOM() {
|
|
1032
|
-
let i = document.createElement("span");
|
|
1033
|
-
return i.className = "cm-snippetFieldPosition", i;
|
|
1034
|
-
}
|
|
1035
|
-
ignoreEvent() {
|
|
1036
|
-
return !1;
|
|
1037
|
-
}
|
|
1038
|
-
}() }), gt = /* @__PURE__ */ q.mark({ class: "cm-snippetField" });
|
|
1039
|
-
class M {
|
|
1040
|
-
constructor(e, t) {
|
|
1041
|
-
this.ranges = e, this.active = t, this.deco = q.set(e.map((n) => (n.from == n.to ? mt : gt).range(n.from, n.to)), !0);
|
|
1042
|
-
}
|
|
1043
|
-
map(e) {
|
|
1044
|
-
let t = [];
|
|
1045
|
-
for (let n of this.ranges) {
|
|
1046
|
-
let s = n.map(e);
|
|
1047
|
-
if (!s)
|
|
1048
|
-
return null;
|
|
1049
|
-
t.push(s);
|
|
1050
|
-
}
|
|
1051
|
-
return new M(t, this.active);
|
|
1052
|
-
}
|
|
1053
|
-
selectionInsideField(e) {
|
|
1054
|
-
return e.ranges.every((t) => this.ranges.some((n) => n.field == this.active && n.from <= t.from && n.to >= t.to));
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
const W = /* @__PURE__ */ O.define({
|
|
1058
|
-
map(i, e) {
|
|
1059
|
-
return i && i.map(e);
|
|
1060
|
-
}
|
|
1061
|
-
}), yt = /* @__PURE__ */ O.define(), F = /* @__PURE__ */ _.define({
|
|
1062
|
-
create() {
|
|
1063
|
-
return null;
|
|
1064
|
-
},
|
|
1065
|
-
update(i, e) {
|
|
1066
|
-
for (let t of e.effects) {
|
|
1067
|
-
if (t.is(W))
|
|
1068
|
-
return t.value;
|
|
1069
|
-
if (t.is(yt) && i)
|
|
1070
|
-
return new M(i.ranges, t.value);
|
|
1071
|
-
}
|
|
1072
|
-
return i && e.docChanged && (i = i.map(e.changes)), i && e.selection && !i.selectionInsideField(e.selection) && (i = null), i;
|
|
1073
|
-
},
|
|
1074
|
-
provide: (i) => L.decorations.from(i, (e) => e ? e.deco : q.none)
|
|
1075
|
-
});
|
|
1076
|
-
function re(i, e) {
|
|
1077
|
-
return C.create(i.filter((t) => t.field == e).map((t) => C.range(t.from, t.to)));
|
|
1078
|
-
}
|
|
1079
|
-
function bt(i) {
|
|
1080
|
-
let e = le.parse(i);
|
|
1081
|
-
return (t, n, s, o) => {
|
|
1082
|
-
let { text: l, ranges: a } = e.instantiate(t.state, s), { main: r } = t.state.selection, h = {
|
|
1083
|
-
changes: { from: s, to: o == r.from ? r.to : o, insert: We.of(l) },
|
|
1084
|
-
scrollIntoView: !0,
|
|
1085
|
-
annotations: n ? [te.of(n), $e.userEvent.of("input.complete")] : void 0
|
|
1086
|
-
};
|
|
1087
|
-
if (a.length && (h.selection = re(a, 0)), a.some((c) => c.field > 0)) {
|
|
1088
|
-
let c = new M(a, 0), f = h.effects = [W.of(c)];
|
|
1089
|
-
t.state.field(F, !1) === void 0 && f.push(O.appendConfig.of([F, St, It, Te]));
|
|
1090
|
-
}
|
|
1091
|
-
t.dispatch(t.state.update(h));
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
function Oe(i) {
|
|
1095
|
-
return ({ state: e, dispatch: t }) => {
|
|
1096
|
-
let n = e.field(F, !1);
|
|
1097
|
-
if (!n || i < 0 && n.active == 0)
|
|
1098
|
-
return !1;
|
|
1099
|
-
let s = n.active + i, o = i > 0 && !n.ranges.some((l) => l.field == s + i);
|
|
1100
|
-
return t(e.update({
|
|
1101
|
-
selection: re(n.ranges, s),
|
|
1102
|
-
effects: W.of(o ? null : new M(n.ranges, s)),
|
|
1103
|
-
scrollIntoView: !0
|
|
1104
|
-
})), !0;
|
|
1105
|
-
};
|
|
1106
|
-
}
|
|
1107
|
-
const xt = ({ state: i, dispatch: e }) => i.field(F, !1) ? (e(i.update({ effects: W.of(null) })), !0) : !1, Ct = /* @__PURE__ */ Oe(1), wt = /* @__PURE__ */ Oe(-1), vt = [
|
|
1108
|
-
{ key: "Tab", run: Ct, shift: wt },
|
|
1109
|
-
{ key: "Escape", run: xt }
|
|
1110
|
-
], me = /* @__PURE__ */ Ce.define({
|
|
1111
|
-
combine(i) {
|
|
1112
|
-
return i.length ? i[0] : vt;
|
|
1113
|
-
}
|
|
1114
|
-
}), St = /* @__PURE__ */ ee.highest(/* @__PURE__ */ we.compute([me], (i) => i.facet(me)));
|
|
1115
|
-
function Wt(i, e) {
|
|
1116
|
-
return { ...e, apply: bt(i) };
|
|
1117
|
-
}
|
|
1118
|
-
const It = /* @__PURE__ */ L.domEventHandlers({
|
|
1119
|
-
mousedown(i, e) {
|
|
1120
|
-
let t = e.state.field(F, !1), n;
|
|
1121
|
-
if (!t || (n = e.posAtCoords({ x: i.clientX, y: i.clientY })) == null)
|
|
1122
|
-
return !1;
|
|
1123
|
-
let s = t.ranges.find((o) => o.from <= n && o.to >= n);
|
|
1124
|
-
return !s || s.field == t.active ? !1 : (e.dispatch({
|
|
1125
|
-
selection: re(t.ranges, s.field),
|
|
1126
|
-
effects: W.of(t.ranges.some((o) => o.field > s.field) ? new M(t.ranges, s.field) : null),
|
|
1127
|
-
scrollIntoView: !0
|
|
1128
|
-
}), !0);
|
|
1129
|
-
}
|
|
1130
|
-
}), $ = {
|
|
1131
|
-
brackets: ["(", "[", "{", "'", '"'],
|
|
1132
|
-
before: ")]}:;>",
|
|
1133
|
-
stringPrefixes: []
|
|
1134
|
-
}, A = /* @__PURE__ */ O.define({
|
|
1135
|
-
map(i, e) {
|
|
1136
|
-
let t = e.mapPos(i, -1, J.TrackAfter);
|
|
1137
|
-
return t ?? void 0;
|
|
1138
|
-
}
|
|
1139
|
-
}), ae = /* @__PURE__ */ new class extends Fe {
|
|
1140
|
-
}();
|
|
1141
|
-
ae.startSide = 1;
|
|
1142
|
-
ae.endSide = -1;
|
|
1143
|
-
const Ae = /* @__PURE__ */ _.define({
|
|
1144
|
-
create() {
|
|
1145
|
-
return Me.empty;
|
|
1146
|
-
},
|
|
1147
|
-
update(i, e) {
|
|
1148
|
-
if (i = i.map(e.changes), e.selection) {
|
|
1149
|
-
let t = e.state.doc.lineAt(e.selection.main.head);
|
|
1150
|
-
i = i.update({ filter: (n) => n >= t.from && n <= t.to });
|
|
1151
|
-
}
|
|
1152
|
-
for (let t of e.effects)
|
|
1153
|
-
t.is(A) && (i = i.update({ add: [ae.range(t.value, t.value + 1)] }));
|
|
1154
|
-
return i;
|
|
1155
|
-
}
|
|
1156
|
-
});
|
|
1157
|
-
function Nt() {
|
|
1158
|
-
return [Ot, Ae];
|
|
1159
|
-
}
|
|
1160
|
-
const X = "()[]{}<>«»»«[]{}";
|
|
1161
|
-
function Ee(i) {
|
|
1162
|
-
for (let e = 0; e < X.length; e += 2)
|
|
1163
|
-
if (X.charCodeAt(e) == i)
|
|
1164
|
-
return X.charAt(e + 1);
|
|
1165
|
-
return be(i < 128 ? i : i + 1);
|
|
1166
|
-
}
|
|
1167
|
-
function De(i, e) {
|
|
1168
|
-
return i.languageDataAt("closeBrackets", e)[0] || $;
|
|
1169
|
-
}
|
|
1170
|
-
const Tt = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent), Ot = /* @__PURE__ */ L.inputHandler.of((i, e, t, n) => {
|
|
1171
|
-
if ((Tt ? i.composing : i.compositionStarted) || i.state.readOnly)
|
|
1172
|
-
return !1;
|
|
1173
|
-
let s = i.state.selection.main;
|
|
1174
|
-
if (n.length > 2 || n.length == 2 && T(v(n, 0)) == 1 || e != s.from || t != s.to)
|
|
1175
|
-
return !1;
|
|
1176
|
-
let o = Et(i.state, n);
|
|
1177
|
-
return o ? (i.dispatch(o), !0) : !1;
|
|
1178
|
-
}), At = ({ state: i, dispatch: e }) => {
|
|
1179
|
-
if (i.readOnly)
|
|
1180
|
-
return !1;
|
|
1181
|
-
let n = De(i, i.selection.main.head).brackets || $.brackets, s = null, o = i.changeByRange((l) => {
|
|
1182
|
-
if (l.empty) {
|
|
1183
|
-
let a = Dt(i.doc, l.head);
|
|
1184
|
-
for (let r of n)
|
|
1185
|
-
if (r == a && z(i.doc, l.head) == Ee(v(r, 0)))
|
|
1186
|
-
return {
|
|
1187
|
-
changes: { from: l.head - r.length, to: l.head + r.length },
|
|
1188
|
-
range: C.cursor(l.head - r.length)
|
|
1189
|
-
};
|
|
1190
|
-
}
|
|
1191
|
-
return { range: s = l };
|
|
1192
|
-
});
|
|
1193
|
-
return s || e(i.update(o, { scrollIntoView: !0, userEvent: "delete.backward" })), !s;
|
|
1194
|
-
}, Ut = [
|
|
1195
|
-
{ key: "Backspace", run: At }
|
|
1196
|
-
];
|
|
1197
|
-
function Et(i, e) {
|
|
1198
|
-
let t = De(i, i.selection.main.head), n = t.brackets || $.brackets;
|
|
1199
|
-
for (let s of n) {
|
|
1200
|
-
let o = Ee(v(s, 0));
|
|
1201
|
-
if (e == s)
|
|
1202
|
-
return o == s ? Lt(i, s, n.indexOf(s + s + s) > -1, t) : Rt(i, s, o, t.before || $.before);
|
|
1203
|
-
if (e == o && Re(i, i.selection.main.from))
|
|
1204
|
-
return Pt(i, s, o);
|
|
1205
|
-
}
|
|
1206
|
-
return null;
|
|
1207
|
-
}
|
|
1208
|
-
function Re(i, e) {
|
|
1209
|
-
let t = !1;
|
|
1210
|
-
return i.field(Ae).between(0, i.doc.length, (n) => {
|
|
1211
|
-
n == e && (t = !0);
|
|
1212
|
-
}), t;
|
|
1213
|
-
}
|
|
1214
|
-
function z(i, e) {
|
|
1215
|
-
let t = i.sliceString(e, e + 2);
|
|
1216
|
-
return t.slice(0, T(v(t, 0)));
|
|
1217
|
-
}
|
|
1218
|
-
function Dt(i, e) {
|
|
1219
|
-
let t = i.sliceString(e - 2, e);
|
|
1220
|
-
return T(v(t, 0)) == t.length ? t : t.slice(1);
|
|
1221
|
-
}
|
|
1222
|
-
function Rt(i, e, t, n) {
|
|
1223
|
-
let s = null, o = i.changeByRange((l) => {
|
|
1224
|
-
if (!l.empty)
|
|
1225
|
-
return {
|
|
1226
|
-
changes: [{ insert: e, from: l.from }, { insert: t, from: l.to }],
|
|
1227
|
-
effects: A.of(l.to + e.length),
|
|
1228
|
-
range: C.range(l.anchor + e.length, l.head + e.length)
|
|
1229
|
-
};
|
|
1230
|
-
let a = z(i.doc, l.head);
|
|
1231
|
-
return !a || /\s/.test(a) || n.indexOf(a) > -1 ? {
|
|
1232
|
-
changes: { insert: e + t, from: l.head },
|
|
1233
|
-
effects: A.of(l.head + e.length),
|
|
1234
|
-
range: C.cursor(l.head + e.length)
|
|
1235
|
-
} : { range: s = l };
|
|
1236
|
-
});
|
|
1237
|
-
return s ? null : i.update(o, {
|
|
1238
|
-
scrollIntoView: !0,
|
|
1239
|
-
userEvent: "input.type"
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
function Pt(i, e, t) {
|
|
1243
|
-
let n = null, s = i.changeByRange((o) => o.empty && z(i.doc, o.head) == t ? {
|
|
1244
|
-
changes: { from: o.head, to: o.head + t.length, insert: t },
|
|
1245
|
-
range: C.cursor(o.head + t.length)
|
|
1246
|
-
} : n = { range: o });
|
|
1247
|
-
return n ? null : i.update(s, {
|
|
1248
|
-
scrollIntoView: !0,
|
|
1249
|
-
userEvent: "input.type"
|
|
1250
|
-
});
|
|
1251
|
-
}
|
|
1252
|
-
function Lt(i, e, t, n) {
|
|
1253
|
-
let s = n.stringPrefixes || $.stringPrefixes, o = null, l = i.changeByRange((a) => {
|
|
1254
|
-
if (!a.empty)
|
|
1255
|
-
return {
|
|
1256
|
-
changes: [{ insert: e, from: a.from }, { insert: e, from: a.to }],
|
|
1257
|
-
effects: A.of(a.to + e.length),
|
|
1258
|
-
range: C.range(a.anchor + e.length, a.head + e.length)
|
|
1259
|
-
};
|
|
1260
|
-
let r = a.head, h = z(i.doc, r), c;
|
|
1261
|
-
if (h == e) {
|
|
1262
|
-
if (ge(i, r))
|
|
1263
|
-
return {
|
|
1264
|
-
changes: { insert: e + e, from: r },
|
|
1265
|
-
effects: A.of(r + e.length),
|
|
1266
|
-
range: C.cursor(r + e.length)
|
|
1267
|
-
};
|
|
1268
|
-
if (Re(i, r)) {
|
|
1269
|
-
let p = t && i.sliceDoc(r, r + e.length * 3) == e + e + e ? e + e + e : e;
|
|
1270
|
-
return {
|
|
1271
|
-
changes: { from: r, to: r + p.length, insert: p },
|
|
1272
|
-
range: C.cursor(r + p.length)
|
|
1273
|
-
};
|
|
1274
|
-
}
|
|
1275
|
-
} else {
|
|
1276
|
-
if (t && i.sliceDoc(r - 2 * e.length, r) == e + e && (c = ye(i, r - 2 * e.length, s)) > -1 && ge(i, c))
|
|
1277
|
-
return {
|
|
1278
|
-
changes: { insert: e + e + e + e, from: r },
|
|
1279
|
-
effects: A.of(r + e.length),
|
|
1280
|
-
range: C.cursor(r + e.length)
|
|
1281
|
-
};
|
|
1282
|
-
if (i.charCategorizer(r)(h) != Z.Word && ye(i, r, s) > -1 && !Mt(i, r, e, s))
|
|
1283
|
-
return {
|
|
1284
|
-
changes: { insert: e + e, from: r },
|
|
1285
|
-
effects: A.of(r + e.length),
|
|
1286
|
-
range: C.cursor(r + e.length)
|
|
1287
|
-
};
|
|
1288
|
-
}
|
|
1289
|
-
return { range: o = a };
|
|
1290
|
-
});
|
|
1291
|
-
return o ? null : i.update(l, {
|
|
1292
|
-
scrollIntoView: !0,
|
|
1293
|
-
userEvent: "input.type"
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
function ge(i, e) {
|
|
1297
|
-
let t = H(i).resolveInner(e + 1);
|
|
1298
|
-
return t.parent && t.from == e;
|
|
1299
|
-
}
|
|
1300
|
-
function Mt(i, e, t, n) {
|
|
1301
|
-
let s = H(i).resolveInner(e, -1), o = n.reduce((l, a) => Math.max(l, a.length), 0);
|
|
1302
|
-
for (let l = 0; l < 5; l++) {
|
|
1303
|
-
let a = i.sliceDoc(s.from, Math.min(s.to, s.from + t.length + o)), r = a.indexOf(t);
|
|
1304
|
-
if (!r || r > -1 && n.indexOf(a.slice(0, r)) > -1) {
|
|
1305
|
-
let c = s.firstChild;
|
|
1306
|
-
for (; c && c.from == s.from && c.to - c.from > t.length + r; ) {
|
|
1307
|
-
if (i.sliceDoc(c.to - t.length, c.to) == t)
|
|
1308
|
-
return !1;
|
|
1309
|
-
c = c.firstChild;
|
|
1310
|
-
}
|
|
1311
|
-
return !0;
|
|
1312
|
-
}
|
|
1313
|
-
let h = s.to == e && s.parent;
|
|
1314
|
-
if (!h)
|
|
1315
|
-
break;
|
|
1316
|
-
s = h;
|
|
1317
|
-
}
|
|
1318
|
-
return !1;
|
|
1319
|
-
}
|
|
1320
|
-
function ye(i, e, t) {
|
|
1321
|
-
let n = i.charCategorizer(e);
|
|
1322
|
-
if (n(i.sliceDoc(e - 1, e)) != Z.Word)
|
|
1323
|
-
return e;
|
|
1324
|
-
for (let s of t) {
|
|
1325
|
-
let o = e - s.length;
|
|
1326
|
-
if (i.sliceDoc(o, e) == s && n(i.sliceDoc(o - 1, o)) != Z.Word)
|
|
1327
|
-
return o;
|
|
1328
|
-
}
|
|
1329
|
-
return -1;
|
|
1330
|
-
}
|
|
1331
|
-
function jt(i = {}) {
|
|
1332
|
-
return [
|
|
1333
|
-
ut,
|
|
1334
|
-
x,
|
|
1335
|
-
g.of(i),
|
|
1336
|
-
ht,
|
|
1337
|
-
Bt,
|
|
1338
|
-
Te
|
|
1339
|
-
];
|
|
1340
|
-
}
|
|
1341
|
-
const kt = [
|
|
1342
|
-
{ key: "Ctrl-Space", run: Y },
|
|
1343
|
-
{ mac: "Alt-`", run: Y },
|
|
1344
|
-
{ mac: "Alt-i", run: Y },
|
|
1345
|
-
{ key: "Escape", run: rt },
|
|
1346
|
-
{ key: "ArrowDown", run: /* @__PURE__ */ U(!0) },
|
|
1347
|
-
{ key: "ArrowUp", run: /* @__PURE__ */ U(!1) },
|
|
1348
|
-
{ key: "PageDown", run: /* @__PURE__ */ U(!0, "page") },
|
|
1349
|
-
{ key: "PageUp", run: /* @__PURE__ */ U(!1, "page") },
|
|
1350
|
-
{ key: "Enter", run: lt }
|
|
1351
|
-
], Bt = /* @__PURE__ */ ee.highest(/* @__PURE__ */ we.computeN([g], (i) => i.facet(g).defaultKeymap ? [kt] : []));
|
|
1352
|
-
export {
|
|
1353
|
-
Ut as a,
|
|
1354
|
-
kt as b,
|
|
1355
|
-
He as c,
|
|
1356
|
-
Nt as d,
|
|
1357
|
-
jt as e,
|
|
1358
|
-
$t as i,
|
|
1359
|
-
Wt as s
|
|
1360
|
-
};
|