@oomol-lab/open-flow 0.1.0-alpha.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/LICENSE +201 -0
- package/NOTICE +47 -0
- package/README.md +18 -0
- package/dist/browser/_virtual_open-flow-twemoji-DJwKsM_w.js +5067 -0
- package/dist/browser/addNodeOptions-DqoIueCR.js +33746 -0
- package/dist/browser/assets/font-00b26ac825e20950.woff2 +0 -0
- package/dist/browser/assets/font-036d4e95149b69ff.woff2 +0 -0
- package/dist/browser/assets/font-07d8e303ce4fc12b.ttf +0 -0
- package/dist/browser/assets/font-08ce98e51b04d589.ttf +0 -0
- package/dist/browser/assets/font-0cdd387c9590a1a9.woff2 +0 -0
- package/dist/browser/assets/font-0d85ae7cc30f2379.ttf +0 -0
- package/dist/browser/assets/font-0f60d1b897938ec9.woff2 +0 -0
- package/dist/browser/assets/font-11e4dc8a6471ff6d.woff +0 -0
- package/dist/browser/assets/font-138ac28d1663b303.ttf +0 -0
- package/dist/browser/assets/font-1ae6bd7475590e97.woff +0 -0
- package/dist/browser/assets/font-1c67f068fea8bb09.ttf +0 -0
- package/dist/browser/assets/font-1e6f9579e90e2cac.ttf +0 -0
- package/dist/browser/assets/font-1ece03f79f95277d.ttf +0 -0
- package/dist/browser/assets/font-2014c523c3210bcc.woff +0 -0
- package/dist/browser/assets/font-30da91e84c893f87.woff +0 -0
- package/dist/browser/assets/font-3398dd02302557a7.woff +0 -0
- package/dist/browser/assets/font-3931dd81faed86ba.ttf +0 -0
- package/dist/browser/assets/font-500e04d54f0d5166.ttf +0 -0
- package/dist/browser/assets/font-51814d270d06ff02.woff2 +0 -0
- package/dist/browser/assets/font-5d53e70ad607c235.woff2 +0 -0
- package/dist/browser/assets/font-5e28753be717dac9.woff +0 -0
- package/dist/browser/assets/font-68534840bcfdd2bf.ttf +0 -0
- package/dist/browser/assets/font-68e8c73ef42afd3c.woff2 +0 -0
- package/dist/browser/assets/font-6ab6b62e9b62dae2.woff +0 -0
- package/dist/browser/assets/font-6b47c40166b6dbe2.woff2 +0 -0
- package/dist/browser/assets/font-70ee1f64a20f2048.ttf +0 -0
- package/dist/browser/assets/font-71d517d67827787c.woff2 +0 -0
- package/dist/browser/assets/font-73d591271b160496.woff2 +0 -0
- package/dist/browser/assets/font-74444efd593c005e.woff2 +0 -0
- package/dist/browser/assets/font-7af58c5ec8f132a2.woff2 +0 -0
- package/dist/browser/assets/font-850c0af5c2238497.woff +0 -0
- package/dist/browser/assets/font-8a8d244581371912.woff +0 -0
- package/dist/browser/assets/font-9163df9c7122432e.ttf +0 -0
- package/dist/browser/assets/font-91ee67500cc0129a.woff +0 -0
- package/dist/browser/assets/font-95b6d2f1a50173bf.ttf +0 -0
- package/dist/browser/assets/font-97479ca6cce906ab.woff2 +0 -0
- package/dist/browser/assets/font-99cd42a3c072d918.woff2 +0 -0
- package/dist/browser/assets/font-99f9c6750b489c94.woff +0 -0
- package/dist/browser/assets/font-9be7ceb88004ab8a.woff +0 -0
- package/dist/browser/assets/font-a4af7d414440a1c1.woff2 +0 -0
- package/dist/browser/assets/font-a6b2099fb555c60e.ttf +0 -0
- package/dist/browser/assets/font-a6f7ec0d846ac7ad.woff +0 -0
- package/dist/browser/assets/font-c2342cd8b869e017.woff2 +0 -0
- package/dist/browser/assets/font-c6368d87e8a1a3a5.woff +0 -0
- package/dist/browser/assets/font-c647367d1dd4e162.ttf +0 -0
- package/dist/browser/assets/font-c76c5d696297d51b.woff +0 -0
- package/dist/browser/assets/font-c943cc986384f59e.woff +0 -0
- package/dist/browser/assets/font-d0332f52868370fd.ttf +0 -0
- package/dist/browser/assets/font-d04c54219f9eaec6.woff2 +0 -0
- package/dist/browser/assets/font-d96cdf2b3bdd4d64.woff +0 -0
- package/dist/browser/assets/font-dc47344dbb6cb5b6.woff2 +0 -0
- package/dist/browser/assets/font-de7701e42cf1f4cf.woff2 +0 -0
- package/dist/browser/assets/font-e14fed02b1aba7ce.woff +0 -0
- package/dist/browser/assets/font-e99ae51144bf1232.woff2 +0 -0
- package/dist/browser/assets/font-ece03cfd83e22c21.woff +0 -0
- package/dist/browser/assets/font-ed0b74372feefcbb.ttf +0 -0
- package/dist/browser/assets/font-f01f3e87d9c6a61c.ttf +0 -0
- package/dist/browser/assets/font-f1d6ef86f3b11a52.woff +0 -0
- package/dist/browser/assets/font-f36ea897e19f4a2e.ttf +0 -0
- package/dist/browser/assets/font-f9377ab0271cda59.ttf +0 -0
- package/dist/browser/carbon-nMY84Amv.js +53 -0
- package/dist/browser/composite-7VwgfnXx.js +6088 -0
- package/dist/browser/createResourceDialog-ByuJWdSL.js +439 -0
- package/dist/browser/dist-7oZK9QXZ.js +50088 -0
- package/dist/browser/dist-B9OV3YTx.js +881 -0
- package/dist/browser/dist-BLk5M0uK.js +1816 -0
- package/dist/browser/dist-BbyiRq3c.js +3285 -0
- package/dist/browser/dist-CIq6ue3I.js +6646 -0
- package/dist/browser/dist-CLZJNoWB.js +89 -0
- package/dist/browser/dist-CvcmLAMW.js +1620 -0
- package/dist/browser/dist-DL0SDskM.js +2327 -0
- package/dist/browser/dist-Djd02JSy.js +1247 -0
- package/dist/browser/dist-aWSZx4q1.js +850 -0
- package/dist/browser/dist-n-z5HtaO.js +4 -0
- package/dist/browser/dist-o4dBuwiG.js +320 -0
- package/dist/browser/dist-zyY--HOV.js +1543 -0
- package/dist/browser/esm-DXw7EADW.js +218 -0
- package/dist/browser/favicon.svg +7 -0
- package/dist/browser/flowWorkspace-DwVMpcar.js +22092 -0
- package/dist/browser/lib-S4ccuMeT.js +7857 -0
- package/dist/browser/licenses.md +4973 -0
- package/dist/browser/markdownContent-ZZFfSRqO.js +44545 -0
- package/dist/browser/project-change.d.ts +311 -0
- package/dist/browser/project-change.js +259 -0
- package/dist/browser/project-notifications.d.ts +12 -0
- package/dist/browser/rolldown-runtime-CEFd7nDs.js +30 -0
- package/dist/browser/workbench-contract.d.ts +28 -0
- package/dist/browser/workbench.css +2 -0
- package/dist/browser/workbench.css.d.ts +1 -0
- package/dist/browser/workbench.d.ts +14 -0
- package/dist/browser/workbench.js +3364 -0
- package/dist/common/connector-action.d.ts +20 -0
- package/dist/common/connector-action.js +106 -0
- package/dist/common/connector-proxy.d.ts +14 -0
- package/dist/common/connector-proxy.js +0 -0
- package/dist/common/control-api-conformance.d.ts +13 -0
- package/dist/common/control-api-conformance.js +518 -0
- package/dist/common/control-api-errors.d.ts +121 -0
- package/dist/common/control-api.d.ts +349 -0
- package/dist/common/control-api.js +884 -0
- package/dist/common/cron-trigger.d.ts +21 -0
- package/dist/common/cron-trigger.js +834 -0
- package/dist/common/engine-contract.d.ts +7 -0
- package/dist/common/favicon.svg +7 -0
- package/dist/common/integration-trigger.d.ts +111 -0
- package/dist/common/integration-trigger.js +290 -0
- package/dist/common/licenses.md +27 -0
- package/dist/common/poll-trigger.d.ts +69 -0
- package/dist/common/poll-trigger.js +155 -0
- package/dist/common/project-encoding.d.ts +11 -0
- package/dist/common/project-encoding.js +242 -0
- package/dist/common/project-notifications.d.ts +12 -0
- package/dist/common/project-semantics.d.ts +55 -0
- package/dist/common/project-semantics.js +8687 -0
- package/dist/common/provider-triggers.d.ts +6 -0
- package/dist/common/provider-triggers.js +4614 -0
- package/dist/common/run-events.d.ts +9 -0
- package/dist/common/run-events.js +192 -0
- package/dist/common/run-lifecycle.d.ts +69 -0
- package/dist/common/run-lifecycle.js +169 -0
- package/dist/common/runtime-contract.d.ts +53 -0
- package/dist/common/runtime-contract.js +151 -0
- package/dist/common/scheduler.d.ts +99 -0
- package/dist/common/scheduler.js +379 -0
- package/dist/common/webhook-trigger.d.ts +22 -0
- package/dist/common/webhook-trigger.js +270 -0
- package/dist/index.d.ts +66 -0
- package/package.json +102 -0
|
@@ -0,0 +1,1247 @@
|
|
|
1
|
+
import { _ as e, a as t, c as n, f as r, g as i, h as a, i as o, l as s, m as c, p as l, s as u, t as d, u as f, v as p, w as m, y as h } from "./dist-BLk5M0uK.js";
|
|
2
|
+
import { E as g, a as _, n as v, o as y, p as b, r as x, t as S, x as C, y as ee } from "./dist-CIq6ue3I.js";
|
|
3
|
+
import { E as te, j as w } from "./dist-CvcmLAMW.js";
|
|
4
|
+
//#region ../../node_modules/@codemirror/autocomplete/dist/index.js
|
|
5
|
+
var T = class {
|
|
6
|
+
constructor(e, t, n, r) {
|
|
7
|
+
this.state = e, this.pos = t, this.explicit = n, this.view = r, this.abortListeners = [], this.abortOnDocChange = !1;
|
|
8
|
+
}
|
|
9
|
+
tokenBefore(e) {
|
|
10
|
+
let t = w(this.state).resolveInner(this.pos, -1);
|
|
11
|
+
for (; t && e.indexOf(t.name) < 0;) t = t.parent;
|
|
12
|
+
return t ? {
|
|
13
|
+
from: t.from,
|
|
14
|
+
to: this.pos,
|
|
15
|
+
text: this.state.sliceDoc(t.from, this.pos),
|
|
16
|
+
type: t.type
|
|
17
|
+
} : null;
|
|
18
|
+
}
|
|
19
|
+
matchBefore(e) {
|
|
20
|
+
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(O(e, !1));
|
|
21
|
+
return i < 0 ? null : {
|
|
22
|
+
from: n + i,
|
|
23
|
+
to: this.pos,
|
|
24
|
+
text: r.slice(i)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
get aborted() {
|
|
28
|
+
return this.abortListeners == null;
|
|
29
|
+
}
|
|
30
|
+
addEventListener(e, t, n) {
|
|
31
|
+
e == "abort" && this.abortListeners && (this.abortListeners.push(t), n && n.onDocChange && (this.abortOnDocChange = !0));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function ne(e) {
|
|
35
|
+
let t = Object.keys(e).join(""), n = /\w/.test(t);
|
|
36
|
+
return n && (t = t.replace(/\w/g, "")), `[${n ? "\\w" : ""}${t.replace(/[^\w\s]/g, "\\$&")}]`;
|
|
37
|
+
}
|
|
38
|
+
function re(e) {
|
|
39
|
+
let t = Object.create(null), n = Object.create(null);
|
|
40
|
+
for (let { label: r } of e) {
|
|
41
|
+
t[r[0]] = !0;
|
|
42
|
+
for (let e = 1; e < r.length; e++) n[r[e]] = !0;
|
|
43
|
+
}
|
|
44
|
+
let r = ne(t) + ne(n) + "*$";
|
|
45
|
+
return [RegExp("^" + r), new RegExp(r)];
|
|
46
|
+
}
|
|
47
|
+
function ie(e) {
|
|
48
|
+
let t = e.map((e) => typeof e == "string" ? { label: e } : e), [n, r] = t.every((e) => /^\w+$/.test(e.label)) ? [/\w*$/, /\w+$/] : re(t);
|
|
49
|
+
return (e) => {
|
|
50
|
+
let i = e.matchBefore(r);
|
|
51
|
+
return i || e.explicit ? {
|
|
52
|
+
from: i ? i.from : e.pos,
|
|
53
|
+
options: t,
|
|
54
|
+
validFor: n
|
|
55
|
+
} : null;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function ae(e, t) {
|
|
59
|
+
return (n) => {
|
|
60
|
+
for (let t = w(n.state).resolveInner(n.pos, -1); t; t = t.parent) {
|
|
61
|
+
if (e.indexOf(t.name) > -1) return null;
|
|
62
|
+
if (t.type.isTop) break;
|
|
63
|
+
}
|
|
64
|
+
return t(n);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
var E = class {
|
|
68
|
+
constructor(e, t, n, r) {
|
|
69
|
+
this.completion = e, this.source = t, this.match = n, this.score = r;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function D(e) {
|
|
73
|
+
return e.selection.main.from;
|
|
74
|
+
}
|
|
75
|
+
function O(e, t) {
|
|
76
|
+
let { source: n } = e, r = t && n[0] != "^", i = n[n.length - 1] != "$";
|
|
77
|
+
return !r && !i ? e : RegExp(`${r ? "^" : ""}(?:${n})${i ? "$" : ""}`, e.flags ?? (e.ignoreCase ? "i" : ""));
|
|
78
|
+
}
|
|
79
|
+
var k = /*@__PURE__*/ d.define();
|
|
80
|
+
function oe(e, n, r, i) {
|
|
81
|
+
let { main: a } = e.selection, o = r - a.from, s = i - a.from;
|
|
82
|
+
return {
|
|
83
|
+
...e.changeByRange((c) => {
|
|
84
|
+
if (c != a && r != i && e.sliceDoc(c.from + o, c.from + s) != e.sliceDoc(r, i)) return { range: c };
|
|
85
|
+
let l = e.toText(n);
|
|
86
|
+
return {
|
|
87
|
+
changes: {
|
|
88
|
+
from: c.from + o,
|
|
89
|
+
to: i == a.from ? c.to : c.from + s,
|
|
90
|
+
insert: l
|
|
91
|
+
},
|
|
92
|
+
range: t.cursor(c.from + o + l.length)
|
|
93
|
+
};
|
|
94
|
+
}),
|
|
95
|
+
scrollIntoView: !0,
|
|
96
|
+
userEvent: "input.complete"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
var se = /*@__PURE__*/ new WeakMap();
|
|
100
|
+
function ce(e) {
|
|
101
|
+
if (!Array.isArray(e)) return e;
|
|
102
|
+
let t = se.get(e);
|
|
103
|
+
return t || se.set(e, t = ie(e)), t;
|
|
104
|
+
}
|
|
105
|
+
var A = /*@__PURE__*/ l.define(), j = /*@__PURE__*/ l.define(), le = class {
|
|
106
|
+
constructor(t) {
|
|
107
|
+
this.pattern = t, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = [];
|
|
108
|
+
for (let n = 0; n < t.length;) {
|
|
109
|
+
let r = e(t, n), i = p(r);
|
|
110
|
+
this.chars.push(r);
|
|
111
|
+
let a = t.slice(n, n + i), o = a.toUpperCase();
|
|
112
|
+
this.folded.push(e(o == a ? a.toLowerCase() : o, 0)), n += i;
|
|
113
|
+
}
|
|
114
|
+
this.astral = t.length != this.chars.length;
|
|
115
|
+
}
|
|
116
|
+
ret(e, t) {
|
|
117
|
+
return this.score = e, this.matched = t, this;
|
|
118
|
+
}
|
|
119
|
+
match(t) {
|
|
120
|
+
if (this.pattern.length == 0) return this.ret(-100, []);
|
|
121
|
+
if (t.length < this.pattern.length) return null;
|
|
122
|
+
let { chars: n, folded: r, any: i, precise: a, byWord: o } = this;
|
|
123
|
+
if (n.length == 1) {
|
|
124
|
+
let i = e(t, 0), a = p(i), o = a == t.length ? 0 : -100;
|
|
125
|
+
if (i != n[0]) {
|
|
126
|
+
if (i == r[0]) o += -200;
|
|
127
|
+
else return null;
|
|
128
|
+
}
|
|
129
|
+
return this.ret(o, [0, a]);
|
|
130
|
+
}
|
|
131
|
+
let s = t.indexOf(this.pattern);
|
|
132
|
+
if (s == 0) return this.ret(t.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]);
|
|
133
|
+
let c = n.length, l = 0;
|
|
134
|
+
if (s < 0) {
|
|
135
|
+
for (let a = 0, o = Math.min(t.length, 200); a < o && l < c;) {
|
|
136
|
+
let o = e(t, a);
|
|
137
|
+
(o == n[l] || o == r[l]) && (i[l++] = a), a += p(o);
|
|
138
|
+
}
|
|
139
|
+
if (l < c) return null;
|
|
140
|
+
}
|
|
141
|
+
let u = 0, d = 0, f = !1, h = 0, g = -1, _ = -1, v = /[a-z]/.test(t), y = !0;
|
|
142
|
+
for (let i = 0, l = Math.min(t.length, 200), b = 0; i < l && d < c;) {
|
|
143
|
+
let l = e(t, i);
|
|
144
|
+
s < 0 && (u < c && l == n[u] && (a[u++] = i), h < c && (l == n[h] || l == r[h] ? (h == 0 && (g = i), _ = i + 1, h++) : h = 0));
|
|
145
|
+
let x, S = l < 255 ? l >= 48 && l <= 57 || l >= 97 && l <= 122 ? 2 : +(l >= 65 && l <= 90) : (x = m(l)) == x.toLowerCase() ? x == x.toUpperCase() ? 0 : 2 : 1;
|
|
146
|
+
(!i || S == 1 && v || b == 0 && S != 0) && (n[d] == l || r[d] == l && (f = !0) ? o[d++] = i : o.length && (y = !1)), b = S, i += p(l);
|
|
147
|
+
}
|
|
148
|
+
return d == c && o[0] == 0 && y ? this.result(-100 + (f ? -200 : 0), o, t) : h == c && g == 0 ? this.ret(-200 - t.length + (_ == t.length ? 0 : -100), [0, _]) : s > -1 ? this.ret(-700 - t.length, [s, s + this.pattern.length]) : h == c ? this.ret(-900 - t.length, [g, _]) : d == c ? this.result(-100 + (f ? -200 : 0) + -700 + (y ? 0 : -1100), o, t) : n.length == 2 ? null : this.result((i[0] ? -700 : 0) + -200 + -1100, i, t);
|
|
149
|
+
}
|
|
150
|
+
result(t, n, r) {
|
|
151
|
+
let i = [], a = 0;
|
|
152
|
+
for (let t of n) {
|
|
153
|
+
let n = t + (this.astral ? p(e(r, t)) : 1);
|
|
154
|
+
a && i[a - 1] == t ? i[a - 1] = n : (i[a++] = t, i[a++] = n);
|
|
155
|
+
}
|
|
156
|
+
return this.ret(t - r.length, i);
|
|
157
|
+
}
|
|
158
|
+
}, ue = class {
|
|
159
|
+
constructor(e) {
|
|
160
|
+
this.pattern = e, this.matched = [], this.score = 0, this.folded = e.toLowerCase();
|
|
161
|
+
}
|
|
162
|
+
match(e) {
|
|
163
|
+
if (e.length < this.pattern.length) return null;
|
|
164
|
+
let t = e.slice(0, this.pattern.length), n = t == this.pattern ? 0 : t.toLowerCase() == this.folded ? -200 : null;
|
|
165
|
+
return n == null ? null : (this.matched = [0, t.length], this.score = n + (e.length == this.pattern.length ? 0 : -100), this);
|
|
166
|
+
}
|
|
167
|
+
}, M = /*@__PURE__*/ u.define({ combine(e) {
|
|
168
|
+
return h(e, {
|
|
169
|
+
activateOnTyping: !0,
|
|
170
|
+
activateOnCompletion: () => !1,
|
|
171
|
+
activateOnTypingDelay: 100,
|
|
172
|
+
selectOnOpen: !0,
|
|
173
|
+
override: null,
|
|
174
|
+
closeOnBlur: !0,
|
|
175
|
+
maxRenderedOptions: 100,
|
|
176
|
+
defaultKeymap: !0,
|
|
177
|
+
tooltipClass: () => "",
|
|
178
|
+
optionClass: () => "",
|
|
179
|
+
aboveCursor: !1,
|
|
180
|
+
icons: !0,
|
|
181
|
+
addToOptions: [],
|
|
182
|
+
positionInfo: de,
|
|
183
|
+
filterStrict: !1,
|
|
184
|
+
compareCompletions: (e, t) => (e.sortText || e.label).localeCompare(t.sortText || t.label),
|
|
185
|
+
interactionDelay: 75,
|
|
186
|
+
updateSyncTime: 100
|
|
187
|
+
}, {
|
|
188
|
+
defaultKeymap: (e, t) => e && t,
|
|
189
|
+
closeOnBlur: (e, t) => e && t,
|
|
190
|
+
icons: (e, t) => e && t,
|
|
191
|
+
tooltipClass: (e, t) => (n) => N(e(n), t(n)),
|
|
192
|
+
optionClass: (e, t) => (n) => N(e(n), t(n)),
|
|
193
|
+
addToOptions: (e, t) => e.concat(t),
|
|
194
|
+
filterStrict: (e, t) => e || t
|
|
195
|
+
});
|
|
196
|
+
} });
|
|
197
|
+
function N(e, t) {
|
|
198
|
+
return e ? t ? e + " " + t : e : t;
|
|
199
|
+
}
|
|
200
|
+
function de(e, t, n, r, i, a) {
|
|
201
|
+
let o = e.textDirection == v.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;
|
|
202
|
+
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);
|
|
203
|
+
else {
|
|
204
|
+
c = !0, d = Math.min(400, (o ? t.right : i.right - t.left) - 30);
|
|
205
|
+
let e = i.bottom - t.bottom;
|
|
206
|
+
e >= h || e > t.top ? u = n.bottom - t.top : (l = "bottom", u = t.bottom - n.top);
|
|
207
|
+
}
|
|
208
|
+
let g = (t.bottom - t.top) / a.offsetHeight, _ = (t.right - t.left) / a.offsetWidth;
|
|
209
|
+
return {
|
|
210
|
+
style: `${l}: ${u / g}px; max-width: ${d / _}px`,
|
|
211
|
+
class: "cm-completionInfo-" + (c ? o ? "left-narrow" : "right-narrow" : s ? "left" : "right")
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
var P = /*@__PURE__*/ l.define();
|
|
215
|
+
function fe(e) {
|
|
216
|
+
let t = e.addToOptions.slice();
|
|
217
|
+
return e.icons && t.push({
|
|
218
|
+
render(e) {
|
|
219
|
+
let t = document.createElement("div");
|
|
220
|
+
return t.classList.add("cm-completionIcon"), e.type && t.classList.add(...e.type.split(/\s+/g).map((e) => "cm-completionIcon-" + e)), t.setAttribute("aria-hidden", "true"), t;
|
|
221
|
+
},
|
|
222
|
+
position: 20
|
|
223
|
+
}), t.push({
|
|
224
|
+
render(e, t, n, r) {
|
|
225
|
+
let i = document.createElement("span");
|
|
226
|
+
i.className = "cm-completionLabel";
|
|
227
|
+
let a = e.displayLabel || e.label, o = 0;
|
|
228
|
+
for (let e = 0; e < r.length;) {
|
|
229
|
+
let t = r[e++], n = r[e++];
|
|
230
|
+
t > o && i.appendChild(document.createTextNode(a.slice(o, t)));
|
|
231
|
+
let s = i.appendChild(document.createElement("span"));
|
|
232
|
+
s.appendChild(document.createTextNode(a.slice(t, n))), s.className = "cm-completionMatchedText", o = n;
|
|
233
|
+
}
|
|
234
|
+
return o < a.length && i.appendChild(document.createTextNode(a.slice(o))), i;
|
|
235
|
+
},
|
|
236
|
+
position: 50
|
|
237
|
+
}, {
|
|
238
|
+
render(e) {
|
|
239
|
+
if (!e.detail) return null;
|
|
240
|
+
let t = document.createElement("span");
|
|
241
|
+
return t.className = "cm-completionDetail", t.textContent = e.detail, t;
|
|
242
|
+
},
|
|
243
|
+
position: 80
|
|
244
|
+
}), t.sort((e, t) => e.position - t.position).map((e) => e.render);
|
|
245
|
+
}
|
|
246
|
+
function F(e, t, n) {
|
|
247
|
+
if (e <= n) return {
|
|
248
|
+
from: 0,
|
|
249
|
+
to: e
|
|
250
|
+
};
|
|
251
|
+
if (t < 0 && (t = 0), t <= e >> 1) {
|
|
252
|
+
let e = Math.floor(t / n);
|
|
253
|
+
return {
|
|
254
|
+
from: e * n,
|
|
255
|
+
to: (e + 1) * n
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
let r = Math.ceil((e - t) / n);
|
|
259
|
+
return {
|
|
260
|
+
from: e - r * n,
|
|
261
|
+
to: e - (r - 1) * n
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
var pe = class {
|
|
265
|
+
constructor(e, t, n) {
|
|
266
|
+
this.view = e, this.stateField = t, this.applyCompletion = n, this.info = null, this.infoDestroy = null, this.placeInfoReq = {
|
|
267
|
+
read: () => this.measureInfo(),
|
|
268
|
+
write: (e) => this.placeInfo(e),
|
|
269
|
+
key: this
|
|
270
|
+
}, this.space = null, this.currentClass = "";
|
|
271
|
+
let r = e.state.field(t), { options: i, selected: a } = r.open, o = e.state.facet(M);
|
|
272
|
+
this.optionContent = fe(o), this.optionClass = o.optionClass, this.tooltipClass = o.tooltipClass, this.range = F(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) => {
|
|
273
|
+
let { options: r } = e.state.field(t).open;
|
|
274
|
+
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) {
|
|
275
|
+
this.applyCompletion(e, r[+i[1]]), n.preventDefault();
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (n.target == this.list) {
|
|
279
|
+
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;
|
|
280
|
+
t != null && (e.dispatch({ effects: P.of(t) }), n.preventDefault());
|
|
281
|
+
}
|
|
282
|
+
}), this.dom.addEventListener("focusout", (t) => {
|
|
283
|
+
let n = e.state.field(this.stateField, !1);
|
|
284
|
+
n && n.tooltip && e.state.facet(M).closeOnBlur && t.relatedTarget != e.contentDOM && e.dispatch({ effects: j.of(null) });
|
|
285
|
+
}), this.showOptions(i, r.id);
|
|
286
|
+
}
|
|
287
|
+
mount() {
|
|
288
|
+
this.updateSel();
|
|
289
|
+
}
|
|
290
|
+
showOptions(e, t) {
|
|
291
|
+
this.list && this.list.remove(), this.list = this.dom.appendChild(this.createListBox(e, t, this.range)), this.list.addEventListener("scroll", () => {
|
|
292
|
+
this.info && this.view.requestMeasure(this.placeInfoReq);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
update(e) {
|
|
296
|
+
let t = e.state.field(this.stateField), n = e.startState.field(this.stateField);
|
|
297
|
+
if (this.updateTooltipClass(e.state), t != n) {
|
|
298
|
+
let { options: r, selected: i, disabled: a } = t.open;
|
|
299
|
+
(!n.open || n.open.options != r) && (this.range = F(r.length, i, e.state.facet(M).maxRenderedOptions), this.showOptions(r, t.id)), this.updateSel(), a != n.open?.disabled && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!a);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
updateTooltipClass(e) {
|
|
303
|
+
let t = this.tooltipClass(e);
|
|
304
|
+
if (t != this.currentClass) {
|
|
305
|
+
for (let e of this.currentClass.split(" ")) e && this.dom.classList.remove(e);
|
|
306
|
+
for (let e of t.split(" ")) e && this.dom.classList.add(e);
|
|
307
|
+
this.currentClass = t;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
positioned(e) {
|
|
311
|
+
this.space = e, this.info && this.view.requestMeasure(this.placeInfoReq);
|
|
312
|
+
}
|
|
313
|
+
updateSel() {
|
|
314
|
+
let e = this.view.state.field(this.stateField), t = e.open;
|
|
315
|
+
(t.selected > -1 && t.selected < this.range.from || t.selected >= this.range.to) && (this.range = F(t.options.length, t.selected, this.view.state.facet(M).maxRenderedOptions), this.showOptions(t.options, e.id));
|
|
316
|
+
let n = this.updateSelectedOption(t.selected);
|
|
317
|
+
if (n) {
|
|
318
|
+
this.destroyInfo();
|
|
319
|
+
let { completion: r } = t.options[t.selected], { info: i } = r;
|
|
320
|
+
if (!i) return;
|
|
321
|
+
let a = typeof i == "string" ? document.createTextNode(i) : i(r);
|
|
322
|
+
if (!a) return;
|
|
323
|
+
"then" in a ? a.then((t) => {
|
|
324
|
+
t && this.view.state.field(this.stateField, !1) == e && this.addInfoPane(t, r);
|
|
325
|
+
}).catch((e) => C(this.view.state, e, "completion info")) : (this.addInfoPane(a, r), n.setAttribute("aria-describedby", this.info.id));
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
addInfoPane(e, t) {
|
|
329
|
+
this.destroyInfo();
|
|
330
|
+
let n = this.info = document.createElement("div");
|
|
331
|
+
if (n.className = "cm-tooltip cm-completionInfo", n.id = "cm-completionInfo-" + Math.floor(Math.random() * 65535).toString(16), e.nodeType != null) n.appendChild(e), this.infoDestroy = null;
|
|
332
|
+
else {
|
|
333
|
+
let { dom: t, destroy: r } = e;
|
|
334
|
+
n.appendChild(t), this.infoDestroy = r || null;
|
|
335
|
+
}
|
|
336
|
+
this.dom.appendChild(n), this.view.requestMeasure(this.placeInfoReq);
|
|
337
|
+
}
|
|
338
|
+
updateSelectedOption(e) {
|
|
339
|
+
let t = null;
|
|
340
|
+
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"));
|
|
341
|
+
return t && he(this.list, t), t;
|
|
342
|
+
}
|
|
343
|
+
measureInfo() {
|
|
344
|
+
let e = this.dom.querySelector("[aria-selected]");
|
|
345
|
+
if (!e || !this.info) return null;
|
|
346
|
+
let t = this.dom.getBoundingClientRect(), n = this.info.getBoundingClientRect(), r = e.getBoundingClientRect(), i = this.space;
|
|
347
|
+
if (!i) {
|
|
348
|
+
let e = this.dom.ownerDocument.documentElement;
|
|
349
|
+
i = {
|
|
350
|
+
left: 0,
|
|
351
|
+
top: 0,
|
|
352
|
+
right: e.clientWidth,
|
|
353
|
+
bottom: e.clientHeight
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
return r.top > Math.min(i.bottom, t.bottom) - 10 || r.bottom < Math.max(i.top, t.top) + 10 ? null : this.view.state.facet(M).positionInfo(this.view, t, r, n, i, this.dom);
|
|
357
|
+
}
|
|
358
|
+
placeInfo(e) {
|
|
359
|
+
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");
|
|
360
|
+
}
|
|
361
|
+
createListBox(e, t, n) {
|
|
362
|
+
let r = document.createElement("ul");
|
|
363
|
+
r.id = t, r.setAttribute("role", "listbox"), r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-label", this.view.state.phrase("Completions")), r.addEventListener("mousedown", (e) => {
|
|
364
|
+
e.target == r && e.preventDefault();
|
|
365
|
+
});
|
|
366
|
+
let i = null;
|
|
367
|
+
for (let a = n.from; a < n.to; a++) {
|
|
368
|
+
let { completion: o, match: s } = e[a], { section: c } = o;
|
|
369
|
+
if (c) {
|
|
370
|
+
let e = typeof c == "string" ? c : c.name;
|
|
371
|
+
if (e != i && (a > n.from || n.from == 0)) {
|
|
372
|
+
if (i = e, typeof c != "string" && c.header) r.appendChild(c.header(c));
|
|
373
|
+
else {
|
|
374
|
+
let t = r.appendChild(document.createElement("completion-section"));
|
|
375
|
+
t.textContent = e;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
let l = r.appendChild(document.createElement("li"));
|
|
380
|
+
l.id = t + "-" + a, l.setAttribute("role", "option");
|
|
381
|
+
let u = this.optionClass(o);
|
|
382
|
+
u && (l.className = u);
|
|
383
|
+
for (let e of this.optionContent) {
|
|
384
|
+
let t = e(o, this.view.state, this.view, s);
|
|
385
|
+
t && l.appendChild(t);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return n.from && r.classList.add("cm-completionListIncompleteTop"), n.to < e.length && r.classList.add("cm-completionListIncompleteBottom"), r;
|
|
389
|
+
}
|
|
390
|
+
destroyInfo() {
|
|
391
|
+
this.info &&= (this.infoDestroy && this.infoDestroy(), this.info.remove(), null);
|
|
392
|
+
}
|
|
393
|
+
destroy() {
|
|
394
|
+
this.destroyInfo();
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
function me(e, t) {
|
|
398
|
+
return (n) => new pe(n, e, t);
|
|
399
|
+
}
|
|
400
|
+
function he(e, t) {
|
|
401
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = n.height / e.offsetHeight;
|
|
402
|
+
r.top < n.top ? e.scrollTop -= (n.top - r.top) / i : r.bottom > n.bottom && (e.scrollTop += (r.bottom - n.bottom) / i);
|
|
403
|
+
}
|
|
404
|
+
function I(e) {
|
|
405
|
+
return (e.boost || 0) * 100 + (e.apply ? 10 : 0) + (e.info ? 5 : 0) + +!!e.type;
|
|
406
|
+
}
|
|
407
|
+
function ge(e, t) {
|
|
408
|
+
let n = [], r = null, i = null, a = (e) => {
|
|
409
|
+
n.push(e);
|
|
410
|
+
let { section: t } = e.completion;
|
|
411
|
+
if (t) {
|
|
412
|
+
r ||= [];
|
|
413
|
+
let e = typeof t == "string" ? t : t.name;
|
|
414
|
+
r.some((t) => t.name == e) || r.push(typeof t == "string" ? { name: e } : t);
|
|
415
|
+
}
|
|
416
|
+
}, o = t.facet(M);
|
|
417
|
+
for (let r of e) if (r.hasResult()) {
|
|
418
|
+
let e = r.result.getMatch;
|
|
419
|
+
if (r.result.filter === !1) for (let t of r.result.options) a(new E(t, r.source, e ? e(t) : [], 1e9 - n.length));
|
|
420
|
+
else {
|
|
421
|
+
let n = t.sliceDoc(r.from, r.to), s, c = o.filterStrict ? new ue(n) : new le(n);
|
|
422
|
+
for (let t of r.result.options) if (s = c.match(t.label)) {
|
|
423
|
+
let n = t.displayLabel ? e ? e(t, s.matched) : [] : s.matched, o = s.score + (t.boost || 0);
|
|
424
|
+
if (a(new E(t, r.source, n, o)), typeof t.section == "object" && t.section.rank === "dynamic") {
|
|
425
|
+
let { name: e } = t.section;
|
|
426
|
+
i ||= Object.create(null), i[e] = Math.max(o, i[e] || -1e9);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (r) {
|
|
432
|
+
let e = Object.create(null), t = 0, a = (e, t) => (e.rank === "dynamic" && t.rank === "dynamic" ? i[t.name] - i[e.name] : 0) || (typeof e.rank == "number" ? e.rank : 1e9) - (typeof t.rank == "number" ? t.rank : 1e9) || (e.name < t.name ? -1 : 1);
|
|
433
|
+
for (let n of r.sort(a)) t -= 1e5, e[n.name] = t;
|
|
434
|
+
for (let t of n) {
|
|
435
|
+
let { section: n } = t.completion;
|
|
436
|
+
n && (t.score += e[typeof n == "string" ? n : n.name]);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
let s = [], c = null, l = o.compareCompletions;
|
|
440
|
+
for (let e of n.sort((e, t) => t.score - e.score || l(e.completion, t.completion))) {
|
|
441
|
+
let t = e.completion;
|
|
442
|
+
!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) : I(e.completion) > I(c) && (s[s.length - 1] = e), c = e.completion;
|
|
443
|
+
}
|
|
444
|
+
return s;
|
|
445
|
+
}
|
|
446
|
+
var _e = class e {
|
|
447
|
+
constructor(e, t, n, r, i, a) {
|
|
448
|
+
this.options = e, this.attrs = t, this.tooltip = n, this.timestamp = r, this.selected = i, this.disabled = a;
|
|
449
|
+
}
|
|
450
|
+
setSelected(t, n) {
|
|
451
|
+
return t == this.selected || t >= this.options.length ? this : new e(this.options, L(n, t), this.tooltip, this.timestamp, t, this.disabled);
|
|
452
|
+
}
|
|
453
|
+
static build(t, n, r, i, a, o) {
|
|
454
|
+
if (i && !o && t.some((e) => e.isPending)) return i.setDisabled();
|
|
455
|
+
let s = ge(t, n);
|
|
456
|
+
if (!s.length) return i && t.some((e) => e.isPending) ? i.setDisabled() : null;
|
|
457
|
+
let c = n.facet(M).selectOnOpen ? 0 : -1;
|
|
458
|
+
if (i && i.selected != c && i.selected != -1) {
|
|
459
|
+
let e = i.options[i.selected].completion;
|
|
460
|
+
for (let t = 0; t < s.length; t++) if (s[t].completion == e) {
|
|
461
|
+
c = t;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return new e(s, L(r, c), {
|
|
466
|
+
pos: t.reduce((e, t) => t.hasResult() ? Math.min(e, t.from) : e, 1e8),
|
|
467
|
+
create: Ee,
|
|
468
|
+
above: a.aboveCursor
|
|
469
|
+
}, i ? i.timestamp : Date.now(), c, !1);
|
|
470
|
+
}
|
|
471
|
+
map(t) {
|
|
472
|
+
return new e(this.options, this.attrs, {
|
|
473
|
+
...this.tooltip,
|
|
474
|
+
pos: t.mapPos(this.tooltip.pos)
|
|
475
|
+
}, this.timestamp, this.selected, this.disabled);
|
|
476
|
+
}
|
|
477
|
+
setDisabled() {
|
|
478
|
+
return new e(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, !0);
|
|
479
|
+
}
|
|
480
|
+
}, ve = class e {
|
|
481
|
+
constructor(e, t, n) {
|
|
482
|
+
this.active = e, this.id = t, this.open = n;
|
|
483
|
+
}
|
|
484
|
+
static start() {
|
|
485
|
+
return new e(Se, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
|
|
486
|
+
}
|
|
487
|
+
update(t) {
|
|
488
|
+
let { state: n } = t, r = n.facet(M), i = (r.override || n.languageDataAt("autocomplete", D(n)).map(ce)).map((e) => (this.active.find((t) => t.source == e) || new R(e, +!!this.active.some((e) => e.state != 0))).update(t, r));
|
|
489
|
+
i.length == this.active.length && i.every((e, t) => e == this.active[t]) && (i = this.active);
|
|
490
|
+
let a = this.open, o = t.effects.some((e) => e.is(z));
|
|
491
|
+
a && t.docChanged && (a = a.map(t.changes)), t.selection || i.some((e) => e.hasResult() && t.changes.touchesRange(e.from, e.to)) || !ye(i, this.active) || o ? a = _e.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 R(e.source, 0) : e));
|
|
492
|
+
for (let e of t.effects) e.is(P) && (a &&= a.setSelected(e.value, this.id));
|
|
493
|
+
return i == this.active && a == this.open ? this : new e(i, this.id, a);
|
|
494
|
+
}
|
|
495
|
+
get tooltip() {
|
|
496
|
+
return this.open ? this.open.tooltip : null;
|
|
497
|
+
}
|
|
498
|
+
get attrs() {
|
|
499
|
+
return this.open ? this.open.attrs : this.active.length ? be : xe;
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
function ye(e, t) {
|
|
503
|
+
if (e == t) return !0;
|
|
504
|
+
for (let n = 0, r = 0;;) {
|
|
505
|
+
for (; n < e.length && !e[n].hasResult();) n++;
|
|
506
|
+
for (; r < t.length && !t[r].hasResult();) r++;
|
|
507
|
+
let i = n == e.length, a = r == t.length;
|
|
508
|
+
if (i || a) return i == a;
|
|
509
|
+
if (e[n++].result != t[r++].result) return !1;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
var be = { "aria-autocomplete": "list" }, xe = {};
|
|
513
|
+
function L(e, t) {
|
|
514
|
+
let n = {
|
|
515
|
+
"aria-autocomplete": "list",
|
|
516
|
+
"aria-haspopup": "listbox",
|
|
517
|
+
"aria-controls": e
|
|
518
|
+
};
|
|
519
|
+
return t > -1 && (n["aria-activedescendant"] = e + "-" + t), n;
|
|
520
|
+
}
|
|
521
|
+
var Se = [];
|
|
522
|
+
function Ce(e, t) {
|
|
523
|
+
if (e.isUserEvent("input.complete")) {
|
|
524
|
+
let n = e.annotation(k);
|
|
525
|
+
if (n && t.activateOnCompletion(n)) return 12;
|
|
526
|
+
}
|
|
527
|
+
let n = e.isUserEvent("input.type");
|
|
528
|
+
return n && t.activateOnTyping ? 5 : n ? 1 : e.isUserEvent("delete.backward") ? 2 : e.selection ? 8 : e.docChanged ? 16 : 0;
|
|
529
|
+
}
|
|
530
|
+
var R = class e {
|
|
531
|
+
constructor(e, t, n = !1) {
|
|
532
|
+
this.source = e, this.state = t, this.explicit = n;
|
|
533
|
+
}
|
|
534
|
+
hasResult() {
|
|
535
|
+
return !1;
|
|
536
|
+
}
|
|
537
|
+
get isPending() {
|
|
538
|
+
return this.state == 1;
|
|
539
|
+
}
|
|
540
|
+
update(t, n) {
|
|
541
|
+
let r = Ce(t, n), i = this;
|
|
542
|
+
(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);
|
|
543
|
+
for (let n of t.effects) if (n.is(A)) i = new e(i.source, 1, n.value);
|
|
544
|
+
else if (n.is(j)) i = new e(i.source, 0);
|
|
545
|
+
else if (n.is(z)) for (let e of n.value) e.source == i.source && (i = e);
|
|
546
|
+
return i;
|
|
547
|
+
}
|
|
548
|
+
updateFor(e, t) {
|
|
549
|
+
return this.map(e.changes);
|
|
550
|
+
}
|
|
551
|
+
map(e) {
|
|
552
|
+
return this;
|
|
553
|
+
}
|
|
554
|
+
touches(e) {
|
|
555
|
+
return e.changes.touchesRange(D(e.state));
|
|
556
|
+
}
|
|
557
|
+
}, we = class e extends R {
|
|
558
|
+
constructor(e, t, n, r, i, a) {
|
|
559
|
+
super(e, 3, t), this.limit = n, this.result = r, this.from = i, this.to = a;
|
|
560
|
+
}
|
|
561
|
+
hasResult() {
|
|
562
|
+
return !0;
|
|
563
|
+
}
|
|
564
|
+
updateFor(t, n) {
|
|
565
|
+
if (!(n & 3)) return this.map(t.changes);
|
|
566
|
+
let r = this.result;
|
|
567
|
+
r.map && !t.changes.empty && (r = r.map(r, t.changes));
|
|
568
|
+
let i = t.changes.mapPos(this.from), a = t.changes.mapPos(this.to, 1), o = D(t.state);
|
|
569
|
+
if (o > a || !r || n & 2 && (D(t.startState) == this.from || o < this.limit)) return new R(this.source, n & 4 ? 1 : 0);
|
|
570
|
+
let s = t.changes.mapPos(this.limit);
|
|
571
|
+
return Te(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 T(t.state, o, !1))) ? new e(this.source, this.explicit, s, r, r.from, r.to ?? D(t.state)) : new R(this.source, 1, this.explicit);
|
|
572
|
+
}
|
|
573
|
+
map(t) {
|
|
574
|
+
if (t.empty) return this;
|
|
575
|
+
let n = this.result.map ? this.result.map(this.result, t) : this.result;
|
|
576
|
+
return n ? new e(this.source, this.explicit, t.mapPos(this.limit), n, t.mapPos(this.from), t.mapPos(this.to, 1)) : new R(this.source, 0);
|
|
577
|
+
}
|
|
578
|
+
touches(e) {
|
|
579
|
+
return e.changes.touchesRange(this.from, this.to);
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
function Te(e, t, n, r) {
|
|
583
|
+
if (!e) return !1;
|
|
584
|
+
let i = t.sliceDoc(n, r);
|
|
585
|
+
return typeof e == "function" ? e(i, n, r, t) : O(e, !0).test(i);
|
|
586
|
+
}
|
|
587
|
+
var z = /*@__PURE__*/ l.define({ map(e, t) {
|
|
588
|
+
return e.map((e) => e.map(t));
|
|
589
|
+
} }), B = /*@__PURE__*/ c.define({
|
|
590
|
+
create() {
|
|
591
|
+
return ve.start();
|
|
592
|
+
},
|
|
593
|
+
update(e, t) {
|
|
594
|
+
return e.update(t);
|
|
595
|
+
},
|
|
596
|
+
provide: (e) => [g.from(e, (e) => e.tooltip), x.contentAttributes.from(e, (e) => e.attrs)]
|
|
597
|
+
});
|
|
598
|
+
function V(e, t) {
|
|
599
|
+
let n = t.completion.apply || t.completion.label, r = e.state.field(B).active.find((e) => e.source == t.source);
|
|
600
|
+
return r instanceof we && (typeof n == "string" ? e.dispatch({
|
|
601
|
+
...oe(e.state, n, r.from, r.to),
|
|
602
|
+
annotations: k.of(t.completion)
|
|
603
|
+
}) : n(e, t.completion, r.from, r.to), !0);
|
|
604
|
+
}
|
|
605
|
+
var Ee = /*@__PURE__*/ me(B, V);
|
|
606
|
+
function H(e, t = "option") {
|
|
607
|
+
return (n) => {
|
|
608
|
+
let r = n.state.field(B, !1);
|
|
609
|
+
if (!r || !r.open || r.open.disabled || Date.now() - r.open.timestamp < n.state.facet(M).interactionDelay) return !1;
|
|
610
|
+
let i = 1, a;
|
|
611
|
+
t == "page" && (a = b(n, r.open.tooltip)) && (i = Math.max(2, Math.floor(a.dom.offsetHeight / a.dom.querySelector("li").offsetHeight) - 1));
|
|
612
|
+
let { length: o } = r.open.options, s = r.open.selected > -1 ? r.open.selected + i * (e ? 1 : -1) : e ? 0 : o - 1;
|
|
613
|
+
return s < 0 ? s = t == "page" ? 0 : o - 1 : s >= o && (s = t == "page" ? o - 1 : 0), n.dispatch({ effects: P.of(s) }), !0;
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
var De = (e) => {
|
|
617
|
+
let t = e.state.field(B, !1);
|
|
618
|
+
return e.state.readOnly || !t || !t.open || t.open.selected < 0 || t.open.disabled || Date.now() - t.open.timestamp < e.state.facet(M).interactionDelay ? !1 : V(e, t.open.options[t.open.selected]);
|
|
619
|
+
}, U = (e) => e.state.field(B, !1) ? (e.dispatch({ effects: A.of(!0) }), !0) : !1, Oe = (e) => {
|
|
620
|
+
let t = e.state.field(B, !1);
|
|
621
|
+
return !t || !t.active.some((e) => e.state != 0) ? !1 : (e.dispatch({ effects: j.of(null) }), !0);
|
|
622
|
+
}, ke = class {
|
|
623
|
+
constructor(e, t) {
|
|
624
|
+
this.active = e, this.context = t, this.time = Date.now(), this.updates = [], this.done = void 0;
|
|
625
|
+
}
|
|
626
|
+
}, Ae = 50, je = 1e3, Me = /*@__PURE__*/ _.fromClass(class {
|
|
627
|
+
constructor(e) {
|
|
628
|
+
this.view = e, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.pendingStart = !1, this.composing = 0;
|
|
629
|
+
for (let t of e.state.field(B).active) t.isPending && this.startQuery(t);
|
|
630
|
+
}
|
|
631
|
+
update(e) {
|
|
632
|
+
let t = e.state.field(B), n = e.state.facet(M);
|
|
633
|
+
if (!e.selectionSet && !e.docChanged && e.startState.field(B) == t) return;
|
|
634
|
+
let r = e.transactions.some((e) => {
|
|
635
|
+
let t = Ce(e, n);
|
|
636
|
+
return t & 8 || (e.selection || e.docChanged) && !(t & 3);
|
|
637
|
+
});
|
|
638
|
+
for (let t = 0; t < this.running.length; t++) {
|
|
639
|
+
let n = this.running[t];
|
|
640
|
+
if (r || n.context.abortOnDocChange && e.docChanged || n.updates.length + e.transactions.length > Ae && Date.now() - n.time > je) {
|
|
641
|
+
for (let e of n.context.abortListeners) try {
|
|
642
|
+
e();
|
|
643
|
+
} catch (e) {
|
|
644
|
+
C(this.view.state, e);
|
|
645
|
+
}
|
|
646
|
+
n.context.abortListeners = null, this.running.splice(t--, 1);
|
|
647
|
+
} else n.updates.push(...e.transactions);
|
|
648
|
+
}
|
|
649
|
+
this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), e.transactions.some((e) => e.effects.some((e) => e.is(A))) && (this.pendingStart = !0);
|
|
650
|
+
let i = this.pendingStart ? 50 : n.activateOnTypingDelay;
|
|
651
|
+
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);
|
|
652
|
+
}
|
|
653
|
+
startUpdate() {
|
|
654
|
+
this.debounceUpdate = -1, this.pendingStart = !1;
|
|
655
|
+
let { state: e } = this.view, t = e.field(B);
|
|
656
|
+
for (let e of t.active) e.isPending && !this.running.some((t) => t.active.source == e.source) && this.startQuery(e);
|
|
657
|
+
this.running.length && t.open && t.open.disabled && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(M).updateSyncTime));
|
|
658
|
+
}
|
|
659
|
+
startQuery(e) {
|
|
660
|
+
let { state: t } = this.view, n = new T(t, D(t), e.explicit, this.view), r = new ke(e, n);
|
|
661
|
+
this.running.push(r), Promise.resolve(e.source(n)).then((e) => {
|
|
662
|
+
r.context.aborted || (r.done = e || null, this.scheduleAccept());
|
|
663
|
+
}, (e) => {
|
|
664
|
+
this.view.dispatch({ effects: j.of(null) }), C(this.view.state, e);
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
scheduleAccept() {
|
|
668
|
+
this.running.every((e) => e.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(M).updateSyncTime));
|
|
669
|
+
}
|
|
670
|
+
accept() {
|
|
671
|
+
this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1;
|
|
672
|
+
let e = [], t = this.view.state.facet(M), n = this.view.state.field(B);
|
|
673
|
+
for (let r = 0; r < this.running.length; r++) {
|
|
674
|
+
let i = this.running[r];
|
|
675
|
+
if (i.done === void 0) continue;
|
|
676
|
+
if (this.running.splice(r--, 1), i.done) {
|
|
677
|
+
let n = D(i.updates.length ? i.updates[0].startState : this.view.state), r = Math.min(n, i.done.from + +!i.active.explicit), a = new we(i.active.source, i.active.explicit, r, i.done, i.done.from, i.done.to ?? n);
|
|
678
|
+
for (let e of i.updates) a = a.update(e, t);
|
|
679
|
+
if (a.hasResult()) {
|
|
680
|
+
e.push(a);
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
let a = n.active.find((e) => e.source == i.active.source);
|
|
685
|
+
if (a && a.isPending) {
|
|
686
|
+
if (i.done == null) {
|
|
687
|
+
let n = new R(i.active.source, 0);
|
|
688
|
+
for (let e of i.updates) n = n.update(e, t);
|
|
689
|
+
n.isPending || e.push(n);
|
|
690
|
+
} else this.startQuery(a);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
(e.length || n.open && n.open.disabled) && this.view.dispatch({ effects: z.of(e) });
|
|
694
|
+
}
|
|
695
|
+
}, { eventHandlers: {
|
|
696
|
+
blur(e) {
|
|
697
|
+
let t = this.view.state.field(B, !1);
|
|
698
|
+
if (t && t.tooltip && this.view.state.facet(M).closeOnBlur) {
|
|
699
|
+
let n = t.open && b(this.view, t.open.tooltip);
|
|
700
|
+
(!n || !n.dom.contains(e.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects: j.of(null) }), 10);
|
|
701
|
+
}
|
|
702
|
+
},
|
|
703
|
+
compositionstart() {
|
|
704
|
+
this.composing = 1;
|
|
705
|
+
},
|
|
706
|
+
compositionend() {
|
|
707
|
+
this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: A.of(!1) }), 20), this.composing = 0;
|
|
708
|
+
}
|
|
709
|
+
} }), Ne = typeof navigator == "object" && /*@__PURE__*/ /Win/.test(navigator.platform), Pe = /*@__PURE__*/ s.highest(/*@__PURE__*/ x.domEventHandlers({ keydown(e, t) {
|
|
710
|
+
let n = t.state.field(B, !1);
|
|
711
|
+
if (!n || !n.open || n.open.disabled || n.open.selected < 0 || e.key.length > 1 || e.ctrlKey && !(Ne && e.altKey) || e.metaKey) return !1;
|
|
712
|
+
let r = n.open.options[n.open.selected], i = n.active.find((e) => e.source == r.source), a = r.completion.commitCharacters || i.result.commitCharacters;
|
|
713
|
+
return a && a.indexOf(e.key) > -1 && V(t, r), !1;
|
|
714
|
+
} })), W = /*@__PURE__*/ x.baseTheme({
|
|
715
|
+
".cm-tooltip.cm-tooltip-autocomplete": { "& > ul": {
|
|
716
|
+
fontFamily: "monospace",
|
|
717
|
+
whiteSpace: "nowrap",
|
|
718
|
+
overflow: "hidden auto",
|
|
719
|
+
maxWidth_fallback: "700px",
|
|
720
|
+
maxWidth: "min(700px, 95vw)",
|
|
721
|
+
minWidth: "250px",
|
|
722
|
+
maxHeight: "10em",
|
|
723
|
+
height: "100%",
|
|
724
|
+
listStyle: "none",
|
|
725
|
+
margin: 0,
|
|
726
|
+
padding: 0,
|
|
727
|
+
"& > li, & > completion-section": {
|
|
728
|
+
padding: "1px 3px",
|
|
729
|
+
lineHeight: 1.2
|
|
730
|
+
},
|
|
731
|
+
"& > li": {
|
|
732
|
+
overflowX: "hidden",
|
|
733
|
+
textOverflow: "ellipsis",
|
|
734
|
+
cursor: "pointer"
|
|
735
|
+
},
|
|
736
|
+
"& > completion-section": {
|
|
737
|
+
display: "list-item",
|
|
738
|
+
borderBottom: "1px solid silver",
|
|
739
|
+
paddingLeft: "0.5em",
|
|
740
|
+
opacity: .7
|
|
741
|
+
}
|
|
742
|
+
} },
|
|
743
|
+
"&light .cm-tooltip-autocomplete ul li[aria-selected]": {
|
|
744
|
+
background: "#17c",
|
|
745
|
+
color: "white"
|
|
746
|
+
},
|
|
747
|
+
"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#777" },
|
|
748
|
+
"&dark .cm-tooltip-autocomplete ul li[aria-selected]": {
|
|
749
|
+
background: "#347",
|
|
750
|
+
color: "white"
|
|
751
|
+
},
|
|
752
|
+
"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#444" },
|
|
753
|
+
".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": {
|
|
754
|
+
content: "\"···\"",
|
|
755
|
+
opacity: .5,
|
|
756
|
+
display: "block",
|
|
757
|
+
textAlign: "center",
|
|
758
|
+
cursor: "pointer"
|
|
759
|
+
},
|
|
760
|
+
".cm-tooltip.cm-completionInfo": {
|
|
761
|
+
position: "absolute",
|
|
762
|
+
padding: "3px 9px",
|
|
763
|
+
width: "max-content",
|
|
764
|
+
maxWidth: "400px",
|
|
765
|
+
boxSizing: "border-box",
|
|
766
|
+
whiteSpace: "pre-line"
|
|
767
|
+
},
|
|
768
|
+
".cm-completionInfo.cm-completionInfo-left": { right: "100%" },
|
|
769
|
+
".cm-completionInfo.cm-completionInfo-right": { left: "100%" },
|
|
770
|
+
".cm-completionInfo.cm-completionInfo-left-narrow": { right: "30px" },
|
|
771
|
+
".cm-completionInfo.cm-completionInfo-right-narrow": { left: "30px" },
|
|
772
|
+
"&light .cm-snippetField": { backgroundColor: "#00000022" },
|
|
773
|
+
"&dark .cm-snippetField": { backgroundColor: "#ffffff22" },
|
|
774
|
+
".cm-snippetFieldPosition": {
|
|
775
|
+
verticalAlign: "text-top",
|
|
776
|
+
width: 0,
|
|
777
|
+
height: "1.15em",
|
|
778
|
+
display: "inline-block",
|
|
779
|
+
margin: "0 -0.7px -.7em",
|
|
780
|
+
borderLeft: "1.4px dotted #888"
|
|
781
|
+
},
|
|
782
|
+
".cm-completionMatchedText": { textDecoration: "underline" },
|
|
783
|
+
".cm-completionDetail": {
|
|
784
|
+
marginLeft: "0.5em",
|
|
785
|
+
fontStyle: "italic"
|
|
786
|
+
},
|
|
787
|
+
".cm-completionIcon": {
|
|
788
|
+
fontSize: "90%",
|
|
789
|
+
width: ".8em",
|
|
790
|
+
display: "inline-block",
|
|
791
|
+
textAlign: "center",
|
|
792
|
+
paddingRight: ".6em",
|
|
793
|
+
opacity: "0.6",
|
|
794
|
+
boxSizing: "content-box"
|
|
795
|
+
},
|
|
796
|
+
".cm-completionIcon-function, .cm-completionIcon-method": { "&:after": { content: "'ƒ'" } },
|
|
797
|
+
".cm-completionIcon-class": { "&:after": { content: "'○'" } },
|
|
798
|
+
".cm-completionIcon-interface": { "&:after": { content: "'◌'" } },
|
|
799
|
+
".cm-completionIcon-variable": { "&:after": { content: "'𝑥'" } },
|
|
800
|
+
".cm-completionIcon-constant": { "&:after": { content: "'𝐶'" } },
|
|
801
|
+
".cm-completionIcon-type": { "&:after": { content: "'𝑡'" } },
|
|
802
|
+
".cm-completionIcon-enum": { "&:after": { content: "'∪'" } },
|
|
803
|
+
".cm-completionIcon-property": { "&:after": { content: "'□'" } },
|
|
804
|
+
".cm-completionIcon-keyword": { "&:after": { content: "'🔑︎'" } },
|
|
805
|
+
".cm-completionIcon-namespace": { "&:after": { content: "'▢'" } },
|
|
806
|
+
".cm-completionIcon-text": { "&:after": {
|
|
807
|
+
content: "'abc'",
|
|
808
|
+
fontSize: "50%",
|
|
809
|
+
verticalAlign: "middle"
|
|
810
|
+
} }
|
|
811
|
+
}), Fe = class {
|
|
812
|
+
constructor(e, t, n, r) {
|
|
813
|
+
this.field = e, this.line = t, this.from = n, this.to = r;
|
|
814
|
+
}
|
|
815
|
+
}, Ie = class e {
|
|
816
|
+
constructor(e, t, n) {
|
|
817
|
+
this.field = e, this.from = t, this.to = n;
|
|
818
|
+
}
|
|
819
|
+
map(t) {
|
|
820
|
+
let r = t.mapPos(this.from, -1, n.TrackDel), i = t.mapPos(this.to, 1, n.TrackDel);
|
|
821
|
+
return r == null || i == null ? null : new e(this.field, r, i);
|
|
822
|
+
}
|
|
823
|
+
}, Le = class e {
|
|
824
|
+
constructor(e, t) {
|
|
825
|
+
this.lines = e, this.fieldPositions = t;
|
|
826
|
+
}
|
|
827
|
+
instantiate(e, t) {
|
|
828
|
+
let n = [], r = [t], i = e.doc.lineAt(t), a = /^\s*/.exec(i.text)[0];
|
|
829
|
+
for (let i of this.lines) {
|
|
830
|
+
if (n.length) {
|
|
831
|
+
let n = a, o = /^\t*/.exec(i)[0].length;
|
|
832
|
+
for (let t = 0; t < o; t++) n += e.facet(te);
|
|
833
|
+
r.push(t + n.length - o), i = n + i.slice(o);
|
|
834
|
+
}
|
|
835
|
+
n.push(i), t += i.length + 1;
|
|
836
|
+
}
|
|
837
|
+
return {
|
|
838
|
+
text: n,
|
|
839
|
+
ranges: this.fieldPositions.map((e) => new Ie(e.field, r[e.line] + e.from, r[e.line] + e.to))
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
static parse(t) {
|
|
843
|
+
let n = [], r = [], i = [], a;
|
|
844
|
+
for (let e of t.split(/\r\n?|\n/)) {
|
|
845
|
+
for (; a = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);) {
|
|
846
|
+
let t = a[1] ? +a[1] : null, o = a[2] || a[3] || "", s = -1;
|
|
847
|
+
t === 0 && (t = 1e9);
|
|
848
|
+
let c = o.replace(/\\[{}]/g, (e) => e[1]);
|
|
849
|
+
for (let e = 0; e < n.length; e++) (t == null ? c && n[e].name == c : n[e].seq == t) && (s = e);
|
|
850
|
+
if (s < 0) {
|
|
851
|
+
let e = 0;
|
|
852
|
+
for (; e < n.length && (t == null || n[e].seq != null && n[e].seq < t);) e++;
|
|
853
|
+
n.splice(e, 0, {
|
|
854
|
+
seq: t,
|
|
855
|
+
name: c
|
|
856
|
+
}), s = e;
|
|
857
|
+
for (let e of i) e.field >= s && e.field++;
|
|
858
|
+
}
|
|
859
|
+
for (let e of i) if (e.line == r.length && e.from > a.index) {
|
|
860
|
+
let t = a[2] ? 3 + (a[1] || "").length : 2;
|
|
861
|
+
e.from -= t, e.to -= t;
|
|
862
|
+
}
|
|
863
|
+
i.push(new Fe(s, r.length, a.index, a.index + c.length)), e = e.slice(0, a.index) + o + e.slice(a.index + a[0].length);
|
|
864
|
+
}
|
|
865
|
+
e = e.replace(/\\([{}])/g, (e, t, n) => {
|
|
866
|
+
for (let e of i) e.line == r.length && e.from > n && (e.from--, e.to--);
|
|
867
|
+
return t;
|
|
868
|
+
}), r.push(e);
|
|
869
|
+
}
|
|
870
|
+
return new e(r, i);
|
|
871
|
+
}
|
|
872
|
+
}, Re = /*@__PURE__*/ S.widget({ widget: /*@__PURE__*/ new class extends y {
|
|
873
|
+
toDOM() {
|
|
874
|
+
let e = document.createElement("span");
|
|
875
|
+
return e.className = "cm-snippetFieldPosition", e;
|
|
876
|
+
}
|
|
877
|
+
ignoreEvent() {
|
|
878
|
+
return !1;
|
|
879
|
+
}
|
|
880
|
+
}() }), ze = /*@__PURE__*/ S.mark({ class: "cm-snippetField" }), G = class e {
|
|
881
|
+
constructor(e, t) {
|
|
882
|
+
this.ranges = e, this.active = t, this.deco = S.set(e.map((e) => (e.from == e.to ? Re : ze).range(e.from, e.to)), !0);
|
|
883
|
+
}
|
|
884
|
+
map(t) {
|
|
885
|
+
let n = [];
|
|
886
|
+
for (let e of this.ranges) {
|
|
887
|
+
let r = e.map(t);
|
|
888
|
+
if (!r) return null;
|
|
889
|
+
n.push(r);
|
|
890
|
+
}
|
|
891
|
+
return new e(n, this.active);
|
|
892
|
+
}
|
|
893
|
+
selectionInsideField(e) {
|
|
894
|
+
return e.ranges.every((e) => this.ranges.some((t) => t.field == this.active && t.from <= e.from && t.to >= e.to));
|
|
895
|
+
}
|
|
896
|
+
}, K = /*@__PURE__*/ l.define({ map(e, t) {
|
|
897
|
+
return e && e.map(t);
|
|
898
|
+
} }), Be = /*@__PURE__*/ l.define(), q = /*@__PURE__*/ c.define({
|
|
899
|
+
create() {
|
|
900
|
+
return null;
|
|
901
|
+
},
|
|
902
|
+
update(e, t) {
|
|
903
|
+
for (let n of t.effects) {
|
|
904
|
+
if (n.is(K)) return n.value;
|
|
905
|
+
if (n.is(Be) && e) return new G(e.ranges, n.value);
|
|
906
|
+
}
|
|
907
|
+
return e && t.docChanged && (e = e.map(t.changes)), e && t.selection && !e.selectionInsideField(t.selection) && (e = null), e;
|
|
908
|
+
},
|
|
909
|
+
provide: (e) => x.decorations.from(e, (e) => e ? e.deco : S.none)
|
|
910
|
+
});
|
|
911
|
+
function J(e, n) {
|
|
912
|
+
return t.create(e.filter((e) => e.field == n).map((e) => t.range(e.from, e.to)));
|
|
913
|
+
}
|
|
914
|
+
function Ve(e) {
|
|
915
|
+
let t = Le.parse(e);
|
|
916
|
+
return (e, n, r, o) => {
|
|
917
|
+
let { text: s, ranges: c } = t.instantiate(e.state, r), { main: u } = e.state.selection, d = {
|
|
918
|
+
changes: {
|
|
919
|
+
from: r,
|
|
920
|
+
to: o == u.from ? u.to : o,
|
|
921
|
+
insert: a.of(s)
|
|
922
|
+
},
|
|
923
|
+
scrollIntoView: !0,
|
|
924
|
+
annotations: n ? [k.of(n), i.userEvent.of("input.complete")] : void 0
|
|
925
|
+
};
|
|
926
|
+
if (c.length && (d.selection = J(c, 0)), c.some((e) => e.field > 0)) {
|
|
927
|
+
let t = new G(c, 0), n = d.effects = [K.of(t)];
|
|
928
|
+
e.state.field(q, !1) === void 0 && n.push(l.appendConfig.of([
|
|
929
|
+
q,
|
|
930
|
+
Ge,
|
|
931
|
+
qe,
|
|
932
|
+
W
|
|
933
|
+
]));
|
|
934
|
+
}
|
|
935
|
+
e.dispatch(e.state.update(d));
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
function He(e) {
|
|
939
|
+
return ({ state: t, dispatch: n }) => {
|
|
940
|
+
let r = t.field(q, !1);
|
|
941
|
+
if (!r || e < 0 && r.active == 0) return !1;
|
|
942
|
+
let i = r.active + e, a = e > 0 && !r.ranges.some((t) => t.field == i + e);
|
|
943
|
+
return n(t.update({
|
|
944
|
+
selection: J(r.ranges, i),
|
|
945
|
+
effects: K.of(a ? null : new G(r.ranges, i)),
|
|
946
|
+
scrollIntoView: !0
|
|
947
|
+
})), !0;
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
var Ue = [{
|
|
951
|
+
key: "Tab",
|
|
952
|
+
run: /* @__PURE__ */ He(1),
|
|
953
|
+
shift: /* @__PURE__ */ He(-1)
|
|
954
|
+
}, {
|
|
955
|
+
key: "Escape",
|
|
956
|
+
run: ({ state: e, dispatch: t }) => e.field(q, !1) ? (t(e.update({ effects: K.of(null) })), !0) : !1
|
|
957
|
+
}], We = /*@__PURE__*/ u.define({ combine(e) {
|
|
958
|
+
return e.length ? e[0] : Ue;
|
|
959
|
+
} }), Ge = /*@__PURE__*/ s.highest(/*@__PURE__*/ ee.compute([We], (e) => e.facet(We)));
|
|
960
|
+
function Ke(e, t) {
|
|
961
|
+
return {
|
|
962
|
+
...t,
|
|
963
|
+
apply: Ve(e)
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
var qe = /*@__PURE__*/ x.domEventHandlers({ mousedown(e, t) {
|
|
967
|
+
let n = t.state.field(q, !1), r;
|
|
968
|
+
if (!n || (r = t.posAtCoords({
|
|
969
|
+
x: e.clientX,
|
|
970
|
+
y: e.clientY
|
|
971
|
+
})) == null) return !1;
|
|
972
|
+
let i = n.ranges.find((e) => e.from <= r && e.to >= r);
|
|
973
|
+
return !i || i.field == n.active ? !1 : (t.dispatch({
|
|
974
|
+
selection: J(n.ranges, i.field),
|
|
975
|
+
effects: K.of(n.ranges.some((e) => e.field > i.field) ? new G(n.ranges, i.field) : null),
|
|
976
|
+
scrollIntoView: !0
|
|
977
|
+
}), !0);
|
|
978
|
+
} }), Y = {
|
|
979
|
+
brackets: [
|
|
980
|
+
"(",
|
|
981
|
+
"[",
|
|
982
|
+
"{",
|
|
983
|
+
"'",
|
|
984
|
+
"\""
|
|
985
|
+
],
|
|
986
|
+
before: ")]}:;>",
|
|
987
|
+
stringPrefixes: []
|
|
988
|
+
}, X = /*@__PURE__*/ l.define({ map(e, t) {
|
|
989
|
+
return t.mapPos(e, -1, n.TrackAfter) ?? void 0;
|
|
990
|
+
} }), Z = /*@__PURE__*/ new class extends r {}();
|
|
991
|
+
Z.startSide = 1, Z.endSide = -1;
|
|
992
|
+
var Je = /*@__PURE__*/ c.define({
|
|
993
|
+
create() {
|
|
994
|
+
return f.empty;
|
|
995
|
+
},
|
|
996
|
+
update(e, t) {
|
|
997
|
+
if (e = e.map(t.changes), t.selection) {
|
|
998
|
+
let n = t.state.doc.lineAt(t.selection.main.head);
|
|
999
|
+
e = e.update({ filter: (e) => e >= n.from && e <= n.to });
|
|
1000
|
+
}
|
|
1001
|
+
for (let n of t.effects) n.is(X) && (e = e.update({ add: [Z.range(n.value, n.value + 1)] }));
|
|
1002
|
+
return e;
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
function Ye() {
|
|
1006
|
+
return [et, Je];
|
|
1007
|
+
}
|
|
1008
|
+
var Xe = "()[]{}<>«»»«[]{}";
|
|
1009
|
+
function Ze(e) {
|
|
1010
|
+
for (let t = 0; t < 16; t += 2) if (Xe.charCodeAt(t) == e) return Xe.charAt(t + 1);
|
|
1011
|
+
return m(e < 128 ? e : e + 1);
|
|
1012
|
+
}
|
|
1013
|
+
function Qe(e, t) {
|
|
1014
|
+
return e.languageDataAt("closeBrackets", t)[0] || Y;
|
|
1015
|
+
}
|
|
1016
|
+
var $e = typeof navigator == "object" && /*@__PURE__*/ /Android\b/.test(navigator.userAgent), et = /*@__PURE__*/ x.inputHandler.of((t, n, r, i) => {
|
|
1017
|
+
if (($e ? t.composing : t.compositionStarted) || t.state.readOnly) return !1;
|
|
1018
|
+
let a = t.state.selection.main;
|
|
1019
|
+
if (i.length > 2 || i.length == 2 && p(e(i, 0)) == 1 || n != a.from || r != a.to) return !1;
|
|
1020
|
+
let o = nt(t.state, i);
|
|
1021
|
+
return o ? (t.dispatch(o), !0) : !1;
|
|
1022
|
+
}), tt = [{
|
|
1023
|
+
key: "Backspace",
|
|
1024
|
+
run: ({ state: n, dispatch: r }) => {
|
|
1025
|
+
if (n.readOnly) return !1;
|
|
1026
|
+
let i = Qe(n, n.selection.main.head).brackets || Y.brackets, a = null, o = n.changeByRange((r) => {
|
|
1027
|
+
if (r.empty) {
|
|
1028
|
+
let a = rt(n.doc, r.head);
|
|
1029
|
+
for (let o of i) if (o == a && $(n.doc, r.head) == Ze(e(o, 0))) return {
|
|
1030
|
+
changes: {
|
|
1031
|
+
from: r.head - o.length,
|
|
1032
|
+
to: r.head + o.length
|
|
1033
|
+
},
|
|
1034
|
+
range: t.cursor(r.head - o.length)
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
return { range: a = r };
|
|
1038
|
+
});
|
|
1039
|
+
return a || r(n.update(o, {
|
|
1040
|
+
scrollIntoView: !0,
|
|
1041
|
+
userEvent: "delete.backward"
|
|
1042
|
+
})), !a;
|
|
1043
|
+
}
|
|
1044
|
+
}];
|
|
1045
|
+
function nt(t, n) {
|
|
1046
|
+
let r = Qe(t, t.selection.main.head), i = r.brackets || Y.brackets;
|
|
1047
|
+
for (let a of i) {
|
|
1048
|
+
let o = Ze(e(a, 0));
|
|
1049
|
+
if (n == a) return o == a ? ot(t, a, i.indexOf(a + a + a) > -1, r) : it(t, a, o, r.before || Y.before);
|
|
1050
|
+
if (n == o && Q(t, t.selection.main.from)) return at(t, a, o);
|
|
1051
|
+
}
|
|
1052
|
+
return null;
|
|
1053
|
+
}
|
|
1054
|
+
function Q(e, t) {
|
|
1055
|
+
let n = !1;
|
|
1056
|
+
return e.field(Je).between(0, e.doc.length, (e) => {
|
|
1057
|
+
e == t && (n = !0);
|
|
1058
|
+
}), n;
|
|
1059
|
+
}
|
|
1060
|
+
function $(t, n) {
|
|
1061
|
+
let r = t.sliceString(n, n + 2);
|
|
1062
|
+
return r.slice(0, p(e(r, 0)));
|
|
1063
|
+
}
|
|
1064
|
+
function rt(t, n) {
|
|
1065
|
+
let r = t.sliceString(n - 2, n);
|
|
1066
|
+
return p(e(r, 0)) == r.length ? r : r.slice(1);
|
|
1067
|
+
}
|
|
1068
|
+
function it(e, n, r, i) {
|
|
1069
|
+
let a = null, o = e.changeByRange((o) => {
|
|
1070
|
+
if (!o.empty) return {
|
|
1071
|
+
changes: [{
|
|
1072
|
+
insert: n,
|
|
1073
|
+
from: o.from
|
|
1074
|
+
}, {
|
|
1075
|
+
insert: r,
|
|
1076
|
+
from: o.to
|
|
1077
|
+
}],
|
|
1078
|
+
effects: X.of(o.to + n.length),
|
|
1079
|
+
range: t.range(o.anchor + n.length, o.head + n.length)
|
|
1080
|
+
};
|
|
1081
|
+
let s = $(e.doc, o.head);
|
|
1082
|
+
return !s || /\s/.test(s) || i.indexOf(s) > -1 ? {
|
|
1083
|
+
changes: {
|
|
1084
|
+
insert: n + r,
|
|
1085
|
+
from: o.head
|
|
1086
|
+
},
|
|
1087
|
+
effects: X.of(o.head + n.length),
|
|
1088
|
+
range: t.cursor(o.head + n.length)
|
|
1089
|
+
} : { range: a = o };
|
|
1090
|
+
});
|
|
1091
|
+
return a ? null : e.update(o, {
|
|
1092
|
+
scrollIntoView: !0,
|
|
1093
|
+
userEvent: "input.type"
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function at(e, n, r) {
|
|
1097
|
+
let i = null, a = e.changeByRange((n) => n.empty && $(e.doc, n.head) == r ? {
|
|
1098
|
+
changes: {
|
|
1099
|
+
from: n.head,
|
|
1100
|
+
to: n.head + r.length,
|
|
1101
|
+
insert: r
|
|
1102
|
+
},
|
|
1103
|
+
range: t.cursor(n.head + r.length)
|
|
1104
|
+
} : i = { range: n });
|
|
1105
|
+
return i ? null : e.update(a, {
|
|
1106
|
+
scrollIntoView: !0,
|
|
1107
|
+
userEvent: "input.type"
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
function ot(e, n, r, i) {
|
|
1111
|
+
let a = i.stringPrefixes || Y.stringPrefixes, s = null, c = e.changeByRange((i) => {
|
|
1112
|
+
if (!i.empty) return {
|
|
1113
|
+
changes: [{
|
|
1114
|
+
insert: n,
|
|
1115
|
+
from: i.from
|
|
1116
|
+
}, {
|
|
1117
|
+
insert: n,
|
|
1118
|
+
from: i.to
|
|
1119
|
+
}],
|
|
1120
|
+
effects: X.of(i.to + n.length),
|
|
1121
|
+
range: t.range(i.anchor + n.length, i.head + n.length)
|
|
1122
|
+
};
|
|
1123
|
+
let c = i.head, l = $(e.doc, c), u;
|
|
1124
|
+
if (l == n) {
|
|
1125
|
+
if (st(e, c)) return {
|
|
1126
|
+
changes: {
|
|
1127
|
+
insert: n + n,
|
|
1128
|
+
from: c
|
|
1129
|
+
},
|
|
1130
|
+
effects: X.of(c + n.length),
|
|
1131
|
+
range: t.cursor(c + n.length)
|
|
1132
|
+
};
|
|
1133
|
+
if (Q(e, c)) {
|
|
1134
|
+
let i = r && e.sliceDoc(c, c + n.length * 3) == n + n + n ? n + n + n : n;
|
|
1135
|
+
return {
|
|
1136
|
+
changes: {
|
|
1137
|
+
from: c,
|
|
1138
|
+
to: c + i.length,
|
|
1139
|
+
insert: i
|
|
1140
|
+
},
|
|
1141
|
+
range: t.cursor(c + i.length)
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
} else if (r && e.sliceDoc(c - 2 * n.length, c) == n + n && (u = lt(e, c - 2 * n.length, a)) > -1 && st(e, u)) return {
|
|
1145
|
+
changes: {
|
|
1146
|
+
insert: n + n + n + n,
|
|
1147
|
+
from: c
|
|
1148
|
+
},
|
|
1149
|
+
effects: X.of(c + n.length),
|
|
1150
|
+
range: t.cursor(c + n.length)
|
|
1151
|
+
};
|
|
1152
|
+
else if (e.charCategorizer(c)(l) != o.Word && lt(e, c, a) > -1 && !ct(e, c, n, a)) return {
|
|
1153
|
+
changes: {
|
|
1154
|
+
insert: n + n,
|
|
1155
|
+
from: c
|
|
1156
|
+
},
|
|
1157
|
+
effects: X.of(c + n.length),
|
|
1158
|
+
range: t.cursor(c + n.length)
|
|
1159
|
+
};
|
|
1160
|
+
return { range: s = i };
|
|
1161
|
+
});
|
|
1162
|
+
return s ? null : e.update(c, {
|
|
1163
|
+
scrollIntoView: !0,
|
|
1164
|
+
userEvent: "input.type"
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
function st(e, t) {
|
|
1168
|
+
let n = w(e).resolveInner(t + 1);
|
|
1169
|
+
return n.parent && n.from == t;
|
|
1170
|
+
}
|
|
1171
|
+
function ct(e, t, n, r) {
|
|
1172
|
+
let i = w(e).resolveInner(t, -1), a = r.reduce((e, t) => Math.max(e, t.length), 0);
|
|
1173
|
+
for (let o = 0; o < 5; o++) {
|
|
1174
|
+
let o = e.sliceDoc(i.from, Math.min(i.to, i.from + n.length + a)), s = o.indexOf(n);
|
|
1175
|
+
if (!s || s > -1 && r.indexOf(o.slice(0, s)) > -1) {
|
|
1176
|
+
let t = i.firstChild;
|
|
1177
|
+
for (; t && t.from == i.from && t.to - t.from > n.length + s;) {
|
|
1178
|
+
if (e.sliceDoc(t.to - n.length, t.to) == n) return !1;
|
|
1179
|
+
t = t.firstChild;
|
|
1180
|
+
}
|
|
1181
|
+
return !0;
|
|
1182
|
+
}
|
|
1183
|
+
let c = i.to == t && i.parent;
|
|
1184
|
+
if (!c) break;
|
|
1185
|
+
i = c;
|
|
1186
|
+
}
|
|
1187
|
+
return !1;
|
|
1188
|
+
}
|
|
1189
|
+
function lt(e, t, n) {
|
|
1190
|
+
let r = e.charCategorizer(t);
|
|
1191
|
+
if (r(e.sliceDoc(t - 1, t)) != o.Word) return t;
|
|
1192
|
+
for (let i of n) {
|
|
1193
|
+
let n = t - i.length;
|
|
1194
|
+
if (e.sliceDoc(n, t) == i && r(e.sliceDoc(n - 1, n)) != o.Word) return n;
|
|
1195
|
+
}
|
|
1196
|
+
return -1;
|
|
1197
|
+
}
|
|
1198
|
+
function ut(e = {}) {
|
|
1199
|
+
return [
|
|
1200
|
+
Pe,
|
|
1201
|
+
B,
|
|
1202
|
+
M.of(e),
|
|
1203
|
+
Me,
|
|
1204
|
+
ft,
|
|
1205
|
+
W
|
|
1206
|
+
];
|
|
1207
|
+
}
|
|
1208
|
+
var dt = [
|
|
1209
|
+
{
|
|
1210
|
+
key: "Ctrl-Space",
|
|
1211
|
+
run: U
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
mac: "Alt-`",
|
|
1215
|
+
run: U
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
mac: "Alt-i",
|
|
1219
|
+
run: U
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
key: "Escape",
|
|
1223
|
+
run: Oe
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
key: "ArrowDown",
|
|
1227
|
+
run: /*@__PURE__*/ H(!0)
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
key: "ArrowUp",
|
|
1231
|
+
run: /*@__PURE__*/ H(!1)
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
key: "PageDown",
|
|
1235
|
+
run: /*@__PURE__*/ H(!0, "page")
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
key: "PageUp",
|
|
1239
|
+
run: /*@__PURE__*/ H(!1, "page")
|
|
1240
|
+
},
|
|
1241
|
+
{
|
|
1242
|
+
key: "Enter",
|
|
1243
|
+
run: De
|
|
1244
|
+
}
|
|
1245
|
+
], ft = /*@__PURE__*/ s.highest(/*@__PURE__*/ ee.computeN([M], (e) => e.facet(M).defaultKeymap ? [dt] : []));
|
|
1246
|
+
//#endregion
|
|
1247
|
+
export { ie as a, Ke as c, tt as i, ut as n, dt as o, Ye as r, ae as s, T as t };
|