@oomol-lab/open-flow 0.1.0-beta.4 → 0.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/{DesignerIcon-DdfuH2jW.js → DesignerIcon-XKBRy_0Q.js} +640 -640
- package/dist/browser/createResourceDialog-Cf7QpXp6.js +505 -0
- package/dist/browser/{dist-BMqL-qR5.js → dist-BMRLCebL.js} +291 -292
- package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
- package/dist/browser/{dist-CJpzJrLM.js → dist-Cc0y2Pli.js} +811 -812
- package/dist/browser/{dist-DUzA0Ukh.js → dist-Dg_VXC8f.js} +134 -135
- package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
- package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
- package/dist/browser/dist-DxahK_I8.js +2688 -0
- package/dist/browser/{dist-CPuF50D9.js → dist-meg_oHVR.js} +335 -335
- package/dist/browser/{esm-C9jQK70n.js → esm-xWDFFpGd.js} +5 -6
- package/dist/browser/flow-authoring-module.d.ts +2 -2
- package/dist/browser/flow-authoring-node.d.ts +2 -2
- package/dist/browser/flow-authoring.js +469 -209
- package/dist/browser/flow-change.d.ts +96 -8
- package/dist/browser/flow-change.js +319 -96
- package/dist/browser/{flowChanges-Bs-ZcJV8.js → flowChanges-CeMiiZIO.js} +1578 -1541
- package/dist/browser/{flowRunInputEditorStore-BYa8zFLC.js → flowRunInputEditorStore-DDidwd8h.js} +9 -1
- package/dist/browser/{flowWorkspace-BewofPeU.js → flowWorkspace-VnS8nLMT.js} +9354 -9349
- package/dist/browser/{getPseudoElementBounds-qDxSDwzN.js → getPseudoElementBounds-5LArT6Xc.js} +494 -474
- package/dist/browser/icons-CRxvozBE.js +726 -0
- package/dist/browser/{typeScriptSession-CwMPjseS.js → typeScriptSession-Bj2HDFRd.js} +255 -256
- package/dist/browser/{waitNotificationInputs-DtrPBwA1.js → waitNotificationInputs-ClCAEIAM.js} +2 -2
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.js +547 -611
- package/dist/browser/{workbenchSelect-CX8KtT7L.js → workbenchSelect-Cf1zlVm9.js} +398 -398
- package/dist/common/control-api-conformance.js +21 -19
- package/dist/common/control-api.d.ts +4 -11
- package/dist/common/control-api.js +6 -18
- package/package.json +1 -1
- package/dist/browser/createResourceDialog-4YQKl8lG.js +0 -505
- package/dist/browser/dist-BpopSHwP.js +0 -1543
- package/dist/browser/dist-CUSrALSX.js +0 -1620
- package/dist/browser/icons-DRoMXL5h.js +0 -521
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { D as ee,
|
|
1
|
+
import { E as e, M as t } from "./dist-DxahK_I8.js";
|
|
2
|
+
import { _ as n, a as r, c as i, f as a, g as o, h as s, i as c, l, m as u, p as d, s as f, t as p, u as m, v as h, w as g, y as _ } from "./dist-Mecbzdl2.js";
|
|
3
|
+
import { D as v, S as y, a as b, b as x, m as S, n as ee, o as te, r as C, t as w } from "./dist-BKuSVKCC.js";
|
|
4
4
|
//#region ../../node_modules/.bun/@codemirror+autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js
|
|
5
|
-
var
|
|
5
|
+
var T = class {
|
|
6
6
|
constructor(e, t, n, r) {
|
|
7
7
|
this.state = e, this.pos = t, this.explicit = n, this.view = r, this.abortListeners = [], this.abortOnDocChange = !1;
|
|
8
8
|
}
|
|
9
9
|
tokenBefore(e) {
|
|
10
|
-
let
|
|
11
|
-
for (;
|
|
12
|
-
return
|
|
13
|
-
from:
|
|
10
|
+
let n = t(this.state).resolveInner(this.pos, -1);
|
|
11
|
+
for (; n && e.indexOf(n.name) < 0;) n = n.parent;
|
|
12
|
+
return n ? {
|
|
13
|
+
from: n.from,
|
|
14
14
|
to: this.pos,
|
|
15
|
-
text: this.state.sliceDoc(
|
|
16
|
-
type:
|
|
15
|
+
text: this.state.sliceDoc(n.from, this.pos),
|
|
16
|
+
type: n.type
|
|
17
17
|
} : null;
|
|
18
18
|
}
|
|
19
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(
|
|
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
21
|
return i < 0 ? null : {
|
|
22
22
|
from: n + i,
|
|
23
23
|
to: this.pos,
|
|
@@ -31,7 +31,7 @@ var E = class {
|
|
|
31
31
|
e == "abort" && this.abortListeners && (this.abortListeners.push(t), n && n.onDocChange && (this.abortOnDocChange = !0));
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
function
|
|
34
|
+
function E(e) {
|
|
35
35
|
let t = Object.keys(e).join(""), n = /\w/.test(t);
|
|
36
36
|
return n && (t = t.replace(/\w/g, "")), `[${n ? "\\w" : ""}${t.replace(/[^\w\s]/g, "\\$&")}]`;
|
|
37
37
|
}
|
|
@@ -41,7 +41,7 @@ function ne(e) {
|
|
|
41
41
|
t[r[0]] = !0;
|
|
42
42
|
for (let e = 1; e < r.length; e++) n[r[e]] = !0;
|
|
43
43
|
}
|
|
44
|
-
let r =
|
|
44
|
+
let r = E(t) + E(n) + "*$";
|
|
45
45
|
return [RegExp("^" + r), new RegExp(r)];
|
|
46
46
|
}
|
|
47
47
|
function re(e) {
|
|
@@ -55,107 +55,107 @@ function re(e) {
|
|
|
55
55
|
} : null;
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
function ie(e,
|
|
59
|
-
return (
|
|
60
|
-
for (let
|
|
61
|
-
if (e.indexOf(
|
|
62
|
-
if (
|
|
58
|
+
function ie(e, n) {
|
|
59
|
+
return (r) => {
|
|
60
|
+
for (let n = t(r.state).resolveInner(r.pos, -1); n; n = n.parent) {
|
|
61
|
+
if (e.indexOf(n.name) > -1) return null;
|
|
62
|
+
if (n.type.isTop) break;
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return n(r);
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
var
|
|
67
|
+
var ae = class {
|
|
68
68
|
constructor(e, t, n, r) {
|
|
69
69
|
this.completion = e, this.source = t, this.match = n, this.score = r;
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
function
|
|
72
|
+
function D(e) {
|
|
73
73
|
return e.selection.main.from;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function O(e, t) {
|
|
76
76
|
let { source: n } = e, r = t && n[0] != "^", i = n[n.length - 1] != "$";
|
|
77
77
|
return !r && !i ? e : RegExp(`${r ? "^" : ""}(?:${n})${i ? "$" : ""}`, e.flags ?? (e.ignoreCase ? "i" : ""));
|
|
78
78
|
}
|
|
79
|
-
var
|
|
80
|
-
function
|
|
81
|
-
let { main: a } = e.selection, o =
|
|
79
|
+
var k = /*@__PURE__*/ p.define();
|
|
80
|
+
function oe(e, t, n, i) {
|
|
81
|
+
let { main: a } = e.selection, o = n - a.from, s = i - a.from;
|
|
82
82
|
return {
|
|
83
83
|
...e.changeByRange((c) => {
|
|
84
|
-
if (c != a &&
|
|
85
|
-
let l = e.toText(
|
|
84
|
+
if (c != a && n != i && e.sliceDoc(c.from + o, c.from + s) != e.sliceDoc(n, i)) return { range: c };
|
|
85
|
+
let l = e.toText(t);
|
|
86
86
|
return {
|
|
87
87
|
changes: {
|
|
88
88
|
from: c.from + o,
|
|
89
89
|
to: i == a.from ? c.to : c.from + s,
|
|
90
90
|
insert: l
|
|
91
91
|
},
|
|
92
|
-
range:
|
|
92
|
+
range: r.cursor(c.from + o + l.length)
|
|
93
93
|
};
|
|
94
94
|
}),
|
|
95
95
|
scrollIntoView: !0,
|
|
96
96
|
userEvent: "input.complete"
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
var
|
|
100
|
-
function
|
|
99
|
+
var se = /*@__PURE__*/ new WeakMap();
|
|
100
|
+
function ce(e) {
|
|
101
101
|
if (!Array.isArray(e)) return e;
|
|
102
|
-
let t =
|
|
103
|
-
return t ||
|
|
102
|
+
let t = se.get(e);
|
|
103
|
+
return t || se.set(e, t = re(e)), t;
|
|
104
104
|
}
|
|
105
|
-
var
|
|
106
|
-
constructor(
|
|
107
|
-
this.pattern =
|
|
108
|
-
for (let
|
|
109
|
-
let r = e
|
|
105
|
+
var A = /*@__PURE__*/ d.define(), j = /*@__PURE__*/ d.define(), le = class {
|
|
106
|
+
constructor(e) {
|
|
107
|
+
this.pattern = e, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = [];
|
|
108
|
+
for (let t = 0; t < e.length;) {
|
|
109
|
+
let r = n(e, t), i = h(r);
|
|
110
110
|
this.chars.push(r);
|
|
111
|
-
let a =
|
|
112
|
-
this.folded.push(
|
|
111
|
+
let a = e.slice(t, t + i), o = a.toUpperCase();
|
|
112
|
+
this.folded.push(n(o == a ? a.toLowerCase() : o, 0)), t += i;
|
|
113
113
|
}
|
|
114
|
-
this.astral =
|
|
114
|
+
this.astral = e.length != this.chars.length;
|
|
115
115
|
}
|
|
116
116
|
ret(e, t) {
|
|
117
117
|
return this.score = e, this.matched = t, this;
|
|
118
118
|
}
|
|
119
|
-
match(
|
|
119
|
+
match(e) {
|
|
120
120
|
if (this.pattern.length == 0) return this.ret(-100, []);
|
|
121
|
-
if (
|
|
122
|
-
let { chars:
|
|
123
|
-
if (
|
|
124
|
-
let i = e
|
|
125
|
-
if (i !=
|
|
121
|
+
if (e.length < this.pattern.length) return null;
|
|
122
|
+
let { chars: t, folded: r, any: i, precise: a, byWord: o } = this;
|
|
123
|
+
if (t.length == 1) {
|
|
124
|
+
let i = n(e, 0), a = h(i), o = a == e.length ? 0 : -100;
|
|
125
|
+
if (i != t[0]) {
|
|
126
126
|
if (i == r[0]) o += -200;
|
|
127
127
|
else return null;
|
|
128
128
|
}
|
|
129
129
|
return this.ret(o, [0, a]);
|
|
130
130
|
}
|
|
131
|
-
let s =
|
|
132
|
-
if (s == 0) return this.ret(
|
|
133
|
-
let c =
|
|
131
|
+
let s = e.indexOf(this.pattern);
|
|
132
|
+
if (s == 0) return this.ret(e.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]);
|
|
133
|
+
let c = t.length, l = 0;
|
|
134
134
|
if (s < 0) {
|
|
135
|
-
for (let a = 0, o = Math.min(
|
|
136
|
-
let o = e
|
|
137
|
-
(o ==
|
|
135
|
+
for (let a = 0, o = Math.min(e.length, 200); a < o && l < c;) {
|
|
136
|
+
let o = n(e, a);
|
|
137
|
+
(o == t[l] || o == r[l]) && (i[l++] = a), a += h(o);
|
|
138
138
|
}
|
|
139
139
|
if (l < c) return null;
|
|
140
140
|
}
|
|
141
|
-
let u = 0, d = 0, f = !1,
|
|
142
|
-
for (let i = 0, l = Math.min(
|
|
143
|
-
let l = e
|
|
144
|
-
s < 0 && (u < c && l ==
|
|
145
|
-
let x, S = l < 255 ? l >= 48 && l <= 57 || l >= 97 && l <= 122 ? 2 : +(l >= 65 && l <= 90) : (x =
|
|
146
|
-
(!i || S == 1 && v || b == 0 && S != 0) && (
|
|
141
|
+
let u = 0, d = 0, f = !1, p = 0, m = -1, _ = -1, v = /[a-z]/.test(e), y = !0;
|
|
142
|
+
for (let i = 0, l = Math.min(e.length, 200), b = 0; i < l && d < c;) {
|
|
143
|
+
let l = n(e, i);
|
|
144
|
+
s < 0 && (u < c && l == t[u] && (a[u++] = i), p < c && (l == t[p] || l == r[p] ? (p == 0 && (m = i), _ = i + 1, p++) : p = 0));
|
|
145
|
+
let x, S = l < 255 ? l >= 48 && l <= 57 || l >= 97 && l <= 122 ? 2 : +(l >= 65 && l <= 90) : (x = g(l)) == x.toLowerCase() ? x == x.toUpperCase() ? 0 : 2 : 1;
|
|
146
|
+
(!i || S == 1 && v || b == 0 && S != 0) && (t[d] == l || r[d] == l && (f = !0) ? o[d++] = i : o.length && (y = !1)), b = S, i += h(l);
|
|
147
147
|
}
|
|
148
|
-
return d == c && o[0] == 0 && y ? this.result(-100 + (f ? -200 : 0), o,
|
|
148
|
+
return d == c && o[0] == 0 && y ? this.result(-100 + (f ? -200 : 0), o, e) : p == c && m == 0 ? this.ret(-200 - e.length + (_ == e.length ? 0 : -100), [0, _]) : s > -1 ? this.ret(-700 - e.length, [s, s + this.pattern.length]) : p == c ? this.ret(-900 - e.length, [m, _]) : d == c ? this.result(-100 + (f ? -200 : 0) + -700 + (y ? 0 : -1100), o, e) : t.length == 2 ? null : this.result((i[0] ? -700 : 0) + -200 + -1100, i, e);
|
|
149
149
|
}
|
|
150
|
-
result(
|
|
150
|
+
result(e, t, r) {
|
|
151
151
|
let i = [], a = 0;
|
|
152
|
-
for (let
|
|
153
|
-
let
|
|
154
|
-
a && i[a - 1] ==
|
|
152
|
+
for (let e of t) {
|
|
153
|
+
let t = e + (this.astral ? h(n(r, e)) : 1);
|
|
154
|
+
a && i[a - 1] == e ? i[a - 1] = t : (i[a++] = e, i[a++] = t);
|
|
155
155
|
}
|
|
156
|
-
return this.ret(
|
|
156
|
+
return this.ret(e - r.length, i);
|
|
157
157
|
}
|
|
158
|
-
},
|
|
158
|
+
}, ue = class {
|
|
159
159
|
constructor(e) {
|
|
160
160
|
this.pattern = e, this.matched = [], this.score = 0, this.folded = e.toLowerCase();
|
|
161
161
|
}
|
|
@@ -164,8 +164,8 @@ var j = /*@__PURE__*/ l.define(), M = /*@__PURE__*/ l.define(), ce = class {
|
|
|
164
164
|
let t = e.slice(0, this.pattern.length), n = t == this.pattern ? 0 : t.toLowerCase() == this.folded ? -200 : null;
|
|
165
165
|
return n == null ? null : (this.matched = [0, t.length], this.score = n + (e.length == this.pattern.length ? 0 : -100), this);
|
|
166
166
|
}
|
|
167
|
-
},
|
|
168
|
-
return
|
|
167
|
+
}, M = /*@__PURE__*/ f.define({ combine(e) {
|
|
168
|
+
return _(e, {
|
|
169
169
|
activateOnTyping: !0,
|
|
170
170
|
activateOnCompletion: () => !1,
|
|
171
171
|
activateOnTypingDelay: 100,
|
|
@@ -188,17 +188,17 @@ var j = /*@__PURE__*/ l.define(), M = /*@__PURE__*/ l.define(), ce = class {
|
|
|
188
188
|
defaultKeymap: (e, t) => e && t,
|
|
189
189
|
closeOnBlur: (e, t) => e && t,
|
|
190
190
|
icons: (e, t) => e && t,
|
|
191
|
-
tooltipClass: (e, t) => (n) =>
|
|
192
|
-
optionClass: (e, t) => (n) =>
|
|
191
|
+
tooltipClass: (e, t) => (n) => N(e(n), t(n)),
|
|
192
|
+
optionClass: (e, t) => (n) => N(e(n), t(n)),
|
|
193
193
|
addToOptions: (e, t) => e.concat(t),
|
|
194
194
|
filterStrict: (e, t) => e || t
|
|
195
195
|
});
|
|
196
196
|
} });
|
|
197
|
-
function
|
|
197
|
+
function N(e, t) {
|
|
198
198
|
return e ? t ? e + " " + t : e : t;
|
|
199
199
|
}
|
|
200
200
|
function de(e, t, n, r, i, a) {
|
|
201
|
-
let o = e.textDirection ==
|
|
201
|
+
let o = e.textDirection == ee.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
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
203
|
else {
|
|
204
204
|
c = !0, d = Math.min(400, (o ? t.right : i.right - t.left) - 30);
|
|
@@ -211,7 +211,7 @@ function de(e, t, n, r, i, a) {
|
|
|
211
211
|
class: "cm-completionInfo-" + (c ? o ? "left-narrow" : "right-narrow" : s ? "left" : "right")
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
var P = /*@__PURE__*/
|
|
214
|
+
var P = /*@__PURE__*/ d.define();
|
|
215
215
|
function fe(e) {
|
|
216
216
|
let t = e.addToOptions.slice();
|
|
217
217
|
return e.icons && t.push({
|
|
@@ -268,7 +268,7 @@ var pe = class {
|
|
|
268
268
|
write: (e) => this.placeInfo(e),
|
|
269
269
|
key: this
|
|
270
270
|
}, this.space = null, this.currentClass = "";
|
|
271
|
-
let r = e.state.field(t), { options: i, selected: a } = r.open, o = e.state.facet(
|
|
271
|
+
let r = e.state.field(t), { options: i, selected: a } = r.open, o = e.state.facet(M);
|
|
272
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
273
|
let { options: r } = e.state.field(t).open;
|
|
274
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) {
|
|
@@ -281,7 +281,7 @@ var pe = class {
|
|
|
281
281
|
}
|
|
282
282
|
}), this.dom.addEventListener("focusout", (t) => {
|
|
283
283
|
let n = e.state.field(this.stateField, !1);
|
|
284
|
-
n && n.tooltip && e.state.facet(
|
|
284
|
+
n && n.tooltip && e.state.facet(M).closeOnBlur && t.relatedTarget != e.contentDOM && e.dispatch({ effects: j.of(null) });
|
|
285
285
|
}), this.showOptions(i, r.id);
|
|
286
286
|
}
|
|
287
287
|
mount() {
|
|
@@ -296,7 +296,7 @@ var pe = class {
|
|
|
296
296
|
let t = e.state.field(this.stateField), n = e.startState.field(this.stateField);
|
|
297
297
|
if (this.updateTooltipClass(e.state), t != n) {
|
|
298
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(
|
|
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
300
|
}
|
|
301
301
|
}
|
|
302
302
|
updateTooltipClass(e) {
|
|
@@ -312,7 +312,7 @@ var pe = class {
|
|
|
312
312
|
}
|
|
313
313
|
updateSel() {
|
|
314
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(
|
|
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
316
|
let n = this.updateSelectedOption(t.selected);
|
|
317
317
|
if (n) {
|
|
318
318
|
this.destroyInfo();
|
|
@@ -322,7 +322,7 @@ var pe = class {
|
|
|
322
322
|
if (!a) return;
|
|
323
323
|
"then" in a ? a.then((t) => {
|
|
324
324
|
t && this.view.state.field(this.stateField, !1) == e && this.addInfoPane(t, r);
|
|
325
|
-
}).catch((e) =>
|
|
325
|
+
}).catch((e) => y(this.view.state, e, "completion info")) : (this.addInfoPane(a, r), n.setAttribute("aria-describedby", this.info.id));
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
addInfoPane(e, t) {
|
|
@@ -353,7 +353,7 @@ var pe = class {
|
|
|
353
353
|
bottom: e.clientHeight
|
|
354
354
|
};
|
|
355
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(
|
|
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
357
|
}
|
|
358
358
|
placeInfo(e) {
|
|
359
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");
|
|
@@ -413,15 +413,15 @@ function ge(e, t) {
|
|
|
413
413
|
let e = typeof t == "string" ? t : t.name;
|
|
414
414
|
r.some((t) => t.name == e) || r.push(typeof t == "string" ? { name: e } : t);
|
|
415
415
|
}
|
|
416
|
-
}, o = t.facet(
|
|
416
|
+
}, o = t.facet(M);
|
|
417
417
|
for (let r of e) if (r.hasResult()) {
|
|
418
418
|
let e = r.result.getMatch;
|
|
419
|
-
if (r.result.filter === !1) for (let t of r.result.options) a(new
|
|
419
|
+
if (r.result.filter === !1) for (let t of r.result.options) a(new ae(t, r.source, e ? e(t) : [], 1e9 - n.length));
|
|
420
420
|
else {
|
|
421
|
-
let n = t.sliceDoc(r.from, r.to), s, c = o.filterStrict ? new
|
|
421
|
+
let n = t.sliceDoc(r.from, r.to), s, c = o.filterStrict ? new ue(n) : new le(n);
|
|
422
422
|
for (let t of r.result.options) if (s = c.match(t.label)) {
|
|
423
423
|
let n = t.displayLabel ? e ? e(t, s.matched) : [] : s.matched, o = s.score + (t.boost || 0);
|
|
424
|
-
if (a(new
|
|
424
|
+
if (a(new ae(t, r.source, n, o)), typeof t.section == "object" && t.section.rank === "dynamic") {
|
|
425
425
|
let { name: e } = t.section;
|
|
426
426
|
i ||= Object.create(null), i[e] = Math.max(o, i[e] || -1e9);
|
|
427
427
|
}
|
|
@@ -454,7 +454,7 @@ var _e = class e {
|
|
|
454
454
|
if (i && !o && t.some((e) => e.isPending)) return i.setDisabled();
|
|
455
455
|
let s = ge(t, n);
|
|
456
456
|
if (!s.length) return i && t.some((e) => e.isPending) ? i.setDisabled() : null;
|
|
457
|
-
let c = n.facet(
|
|
457
|
+
let c = n.facet(M).selectOnOpen ? 0 : -1;
|
|
458
458
|
if (i && i.selected != c && i.selected != -1) {
|
|
459
459
|
let e = i.options[i.selected].completion;
|
|
460
460
|
for (let t = 0; t < s.length; t++) if (s[t].completion == e) {
|
|
@@ -464,7 +464,7 @@ var _e = class e {
|
|
|
464
464
|
}
|
|
465
465
|
return new e(s, L(r, c), {
|
|
466
466
|
pos: t.reduce((e, t) => t.hasResult() ? Math.min(e, t.from) : e, 1e8),
|
|
467
|
-
create:
|
|
467
|
+
create: Ee,
|
|
468
468
|
above: a.aboveCursor
|
|
469
469
|
}, i ? i.timestamp : Date.now(), c, !1);
|
|
470
470
|
}
|
|
@@ -485,10 +485,10 @@ var _e = class e {
|
|
|
485
485
|
return new e(Se, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
|
|
486
486
|
}
|
|
487
487
|
update(t) {
|
|
488
|
-
let { state: n } = t, r = n.facet(
|
|
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
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(
|
|
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
|
|
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
492
|
for (let e of t.effects) e.is(P) && (a &&= a.setSelected(e.value, this.id));
|
|
493
493
|
return i == this.active && a == this.open ? this : new e(i, this.id, a);
|
|
494
494
|
}
|
|
@@ -519,15 +519,15 @@ function L(e, t) {
|
|
|
519
519
|
return t > -1 && (n["aria-activedescendant"] = e + "-" + t), n;
|
|
520
520
|
}
|
|
521
521
|
var Se = [];
|
|
522
|
-
function
|
|
522
|
+
function Ce(e, t) {
|
|
523
523
|
if (e.isUserEvent("input.complete")) {
|
|
524
|
-
let n = e.annotation(
|
|
524
|
+
let n = e.annotation(k);
|
|
525
525
|
if (n && t.activateOnCompletion(n)) return 12;
|
|
526
526
|
}
|
|
527
527
|
let n = e.isUserEvent("input.type");
|
|
528
528
|
return n && t.activateOnTyping ? 5 : n ? 1 : e.isUserEvent("delete.backward") ? 2 : e.selection ? 8 : e.docChanged ? 16 : 0;
|
|
529
529
|
}
|
|
530
|
-
var
|
|
530
|
+
var R = class e {
|
|
531
531
|
constructor(e, t, n = !1) {
|
|
532
532
|
this.source = e, this.state = t, this.explicit = n;
|
|
533
533
|
}
|
|
@@ -538,11 +538,11 @@ var z = class e {
|
|
|
538
538
|
return this.state == 1;
|
|
539
539
|
}
|
|
540
540
|
update(t, n) {
|
|
541
|
-
let r =
|
|
541
|
+
let r = Ce(t, n), i = this;
|
|
542
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(
|
|
544
|
-
else if (n.is(
|
|
545
|
-
else if (n.is(
|
|
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
546
|
return i;
|
|
547
547
|
}
|
|
548
548
|
updateFor(e, t) {
|
|
@@ -552,9 +552,9 @@ var z = class e {
|
|
|
552
552
|
return this;
|
|
553
553
|
}
|
|
554
554
|
touches(e) {
|
|
555
|
-
return e.changes.touchesRange(
|
|
555
|
+
return e.changes.touchesRange(D(e.state));
|
|
556
556
|
}
|
|
557
|
-
},
|
|
557
|
+
}, we = class e extends R {
|
|
558
558
|
constructor(e, t, n, r, i, a) {
|
|
559
559
|
super(e, 3, t), this.limit = n, this.result = r, this.from = i, this.to = a;
|
|
560
560
|
}
|
|
@@ -565,116 +565,116 @@ var z = class e {
|
|
|
565
565
|
if (!(n & 3)) return this.map(t.changes);
|
|
566
566
|
let r = this.result;
|
|
567
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 =
|
|
569
|
-
if (o > a || !r || n & 2 && (
|
|
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
570
|
let s = t.changes.mapPos(this.limit);
|
|
571
|
-
return
|
|
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
572
|
}
|
|
573
573
|
map(t) {
|
|
574
574
|
if (t.empty) return this;
|
|
575
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
|
|
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
577
|
}
|
|
578
578
|
touches(e) {
|
|
579
579
|
return e.changes.touchesRange(this.from, this.to);
|
|
580
580
|
}
|
|
581
581
|
};
|
|
582
|
-
function
|
|
582
|
+
function Te(e, t, n, r) {
|
|
583
583
|
if (!e) return !1;
|
|
584
584
|
let i = t.sliceDoc(n, r);
|
|
585
|
-
return typeof e == "function" ? e(i, n, r, t) :
|
|
585
|
+
return typeof e == "function" ? e(i, n, r, t) : O(e, !0).test(i);
|
|
586
586
|
}
|
|
587
|
-
var
|
|
587
|
+
var z = /*@__PURE__*/ d.define({ map(e, t) {
|
|
588
588
|
return e.map((e) => e.map(t));
|
|
589
|
-
} }),
|
|
589
|
+
} }), B = /*@__PURE__*/ u.define({
|
|
590
590
|
create() {
|
|
591
591
|
return ve.start();
|
|
592
592
|
},
|
|
593
593
|
update(e, t) {
|
|
594
594
|
return e.update(t);
|
|
595
595
|
},
|
|
596
|
-
provide: (e) => [
|
|
596
|
+
provide: (e) => [v.from(e, (e) => e.tooltip), C.contentAttributes.from(e, (e) => e.attrs)]
|
|
597
597
|
});
|
|
598
|
-
function
|
|
599
|
-
let n = t.completion.apply || t.completion.label, r = e.state.field(
|
|
600
|
-
return r instanceof
|
|
601
|
-
...
|
|
602
|
-
annotations:
|
|
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
603
|
}) : n(e, t.completion, r.from, r.to), !0);
|
|
604
604
|
}
|
|
605
|
-
var
|
|
606
|
-
function
|
|
605
|
+
var Ee = /*@__PURE__*/ me(B, V);
|
|
606
|
+
function H(e, t = "option") {
|
|
607
607
|
return (n) => {
|
|
608
|
-
let r = n.state.field(
|
|
609
|
-
if (!r || !r.open || r.open.disabled || Date.now() - r.open.timestamp < n.state.facet(
|
|
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
610
|
let i = 1, a;
|
|
611
|
-
t == "page" && (a =
|
|
611
|
+
t == "page" && (a = S(n, r.open.tooltip)) && (i = Math.max(2, Math.floor(a.dom.offsetHeight / a.dom.querySelector("li").offsetHeight) - 1));
|
|
612
612
|
let { length: o } = r.open.options, s = r.open.selected > -1 ? r.open.selected + i * (e ? 1 : -1) : e ? 0 : o - 1;
|
|
613
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
614
|
};
|
|
615
615
|
}
|
|
616
|
-
var
|
|
617
|
-
let t = e.state.field(
|
|
618
|
-
return e.state.readOnly || !t || !t.open || t.open.selected < 0 || t.open.disabled || Date.now() - t.open.timestamp < e.state.facet(
|
|
619
|
-
},
|
|
620
|
-
let t = e.state.field(
|
|
621
|
-
return !t || !t.active.some((e) => e.state != 0) ? !1 : (e.dispatch({ effects:
|
|
622
|
-
},
|
|
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
623
|
constructor(e, t) {
|
|
624
624
|
this.active = e, this.context = t, this.time = Date.now(), this.updates = [], this.done = void 0;
|
|
625
625
|
}
|
|
626
|
-
},
|
|
626
|
+
}, Ae = 50, je = 1e3, Me = /*@__PURE__*/ b.fromClass(class {
|
|
627
627
|
constructor(e) {
|
|
628
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(
|
|
629
|
+
for (let t of e.state.field(B).active) t.isPending && this.startQuery(t);
|
|
630
630
|
}
|
|
631
631
|
update(e) {
|
|
632
|
-
let t = e.state.field(
|
|
633
|
-
if (!e.selectionSet && !e.docChanged && e.startState.field(
|
|
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
634
|
let r = e.transactions.some((e) => {
|
|
635
|
-
let t =
|
|
635
|
+
let t = Ce(e, n);
|
|
636
636
|
return t & 8 || (e.selection || e.docChanged) && !(t & 3);
|
|
637
637
|
});
|
|
638
638
|
for (let t = 0; t < this.running.length; t++) {
|
|
639
639
|
let n = this.running[t];
|
|
640
|
-
if (r || n.context.abortOnDocChange && e.docChanged || n.updates.length + e.transactions.length >
|
|
640
|
+
if (r || n.context.abortOnDocChange && e.docChanged || n.updates.length + e.transactions.length > Ae && Date.now() - n.time > je) {
|
|
641
641
|
for (let e of n.context.abortListeners) try {
|
|
642
642
|
e();
|
|
643
643
|
} catch (e) {
|
|
644
|
-
|
|
644
|
+
y(this.view.state, e);
|
|
645
645
|
}
|
|
646
646
|
n.context.abortListeners = null, this.running.splice(t--, 1);
|
|
647
647
|
} else n.updates.push(...e.transactions);
|
|
648
648
|
}
|
|
649
|
-
this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), e.transactions.some((e) => e.effects.some((e) => e.is(
|
|
649
|
+
this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), e.transactions.some((e) => e.effects.some((e) => e.is(A))) && (this.pendingStart = !0);
|
|
650
650
|
let i = this.pendingStart ? 50 : n.activateOnTypingDelay;
|
|
651
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
652
|
}
|
|
653
653
|
startUpdate() {
|
|
654
654
|
this.debounceUpdate = -1, this.pendingStart = !1;
|
|
655
|
-
let { state: e } = this.view, t = e.field(
|
|
655
|
+
let { state: e } = this.view, t = e.field(B);
|
|
656
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(
|
|
657
|
+
this.running.length && t.open && t.open.disabled && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(M).updateSyncTime));
|
|
658
658
|
}
|
|
659
659
|
startQuery(e) {
|
|
660
|
-
let { state: t } = this.view, n = new
|
|
660
|
+
let { state: t } = this.view, n = new T(t, D(t), e.explicit, this.view), r = new ke(e, n);
|
|
661
661
|
this.running.push(r), Promise.resolve(e.source(n)).then((e) => {
|
|
662
662
|
r.context.aborted || (r.done = e || null, this.scheduleAccept());
|
|
663
663
|
}, (e) => {
|
|
664
|
-
this.view.dispatch({ effects:
|
|
664
|
+
this.view.dispatch({ effects: j.of(null) }), y(this.view.state, e);
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
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(
|
|
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
669
|
}
|
|
670
670
|
accept() {
|
|
671
671
|
this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1;
|
|
672
|
-
let e = [], t = this.view.state.facet(
|
|
672
|
+
let e = [], t = this.view.state.facet(M), n = this.view.state.field(B);
|
|
673
673
|
for (let r = 0; r < this.running.length; r++) {
|
|
674
674
|
let i = this.running[r];
|
|
675
675
|
if (i.done === void 0) continue;
|
|
676
676
|
if (this.running.splice(r--, 1), i.done) {
|
|
677
|
-
let n =
|
|
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
678
|
for (let e of i.updates) a = a.update(e, t);
|
|
679
679
|
if (a.hasResult()) {
|
|
680
680
|
e.push(a);
|
|
@@ -684,34 +684,34 @@ var Te = (e) => {
|
|
|
684
684
|
let a = n.active.find((e) => e.source == i.active.source);
|
|
685
685
|
if (a && a.isPending) {
|
|
686
686
|
if (i.done == null) {
|
|
687
|
-
let n = new
|
|
687
|
+
let n = new R(i.active.source, 0);
|
|
688
688
|
for (let e of i.updates) n = n.update(e, t);
|
|
689
689
|
n.isPending || e.push(n);
|
|
690
690
|
} else this.startQuery(a);
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
|
-
(e.length || n.open && n.open.disabled) && this.view.dispatch({ effects:
|
|
693
|
+
(e.length || n.open && n.open.disabled) && this.view.dispatch({ effects: z.of(e) });
|
|
694
694
|
}
|
|
695
695
|
}, { eventHandlers: {
|
|
696
696
|
blur(e) {
|
|
697
|
-
let t = this.view.state.field(
|
|
698
|
-
if (t && t.tooltip && this.view.state.facet(
|
|
699
|
-
let n = t.open &&
|
|
700
|
-
(!n || !n.dom.contains(e.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects:
|
|
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 && S(this.view, t.open.tooltip);
|
|
700
|
+
(!n || !n.dom.contains(e.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects: j.of(null) }), 10);
|
|
701
701
|
}
|
|
702
702
|
},
|
|
703
703
|
compositionstart() {
|
|
704
704
|
this.composing = 1;
|
|
705
705
|
},
|
|
706
706
|
compositionend() {
|
|
707
|
-
this.composing == 3 && setTimeout(() => this.view.dispatch({ effects:
|
|
707
|
+
this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: A.of(!1) }), 20), this.composing = 0;
|
|
708
708
|
}
|
|
709
|
-
} }),
|
|
710
|
-
let n = t.state.field(
|
|
711
|
-
if (!n || !n.open || n.open.disabled || n.open.selected < 0 || e.key.length > 1 || e.ctrlKey && !(
|
|
709
|
+
} }), Ne = typeof navigator == "object" && /*@__PURE__*/ /Win/.test(navigator.platform), Pe = /*@__PURE__*/ l.highest(/*@__PURE__*/ C.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
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 &&
|
|
714
|
-
} })),
|
|
713
|
+
return a && a.indexOf(e.key) > -1 && V(t, r), !1;
|
|
714
|
+
} })), W = /*@__PURE__*/ C.baseTheme({
|
|
715
715
|
".cm-tooltip.cm-tooltip-autocomplete": { "& > ul": {
|
|
716
716
|
fontFamily: "monospace",
|
|
717
717
|
whiteSpace: "nowrap",
|
|
@@ -808,68 +808,68 @@ var Te = (e) => {
|
|
|
808
808
|
fontSize: "50%",
|
|
809
809
|
verticalAlign: "middle"
|
|
810
810
|
} }
|
|
811
|
-
}),
|
|
811
|
+
}), Fe = class {
|
|
812
812
|
constructor(e, t, n, r) {
|
|
813
813
|
this.field = e, this.line = t, this.from = n, this.to = r;
|
|
814
814
|
}
|
|
815
|
-
},
|
|
815
|
+
}, Ie = class e {
|
|
816
816
|
constructor(e, t, n) {
|
|
817
817
|
this.field = e, this.from = t, this.to = n;
|
|
818
818
|
}
|
|
819
819
|
map(t) {
|
|
820
|
-
let
|
|
821
|
-
return
|
|
820
|
+
let n = t.mapPos(this.from, -1, i.TrackDel), r = t.mapPos(this.to, 1, i.TrackDel);
|
|
821
|
+
return n == null || r == null ? null : new e(this.field, n, r);
|
|
822
822
|
}
|
|
823
|
-
},
|
|
823
|
+
}, Le = class t {
|
|
824
824
|
constructor(e, t) {
|
|
825
825
|
this.lines = e, this.fieldPositions = t;
|
|
826
826
|
}
|
|
827
|
-
instantiate(
|
|
828
|
-
let
|
|
829
|
-
for (let
|
|
830
|
-
if (
|
|
831
|
-
let
|
|
832
|
-
for (let
|
|
833
|
-
|
|
827
|
+
instantiate(t, n) {
|
|
828
|
+
let r = [], i = [n], a = t.doc.lineAt(n), o = /^\s*/.exec(a.text)[0];
|
|
829
|
+
for (let a of this.lines) {
|
|
830
|
+
if (r.length) {
|
|
831
|
+
let r = o, s = /^\t*/.exec(a)[0].length;
|
|
832
|
+
for (let n = 0; n < s; n++) r += t.facet(e);
|
|
833
|
+
i.push(n + r.length - s), a = r + a.slice(s);
|
|
834
834
|
}
|
|
835
|
-
|
|
835
|
+
r.push(a), n += a.length + 1;
|
|
836
836
|
}
|
|
837
837
|
return {
|
|
838
|
-
text:
|
|
839
|
-
ranges: this.fieldPositions.map((e) => new
|
|
838
|
+
text: r,
|
|
839
|
+
ranges: this.fieldPositions.map((e) => new Ie(e.field, i[e.line] + e.from, i[e.line] + e.to))
|
|
840
840
|
};
|
|
841
841
|
}
|
|
842
|
-
static parse(
|
|
842
|
+
static parse(e) {
|
|
843
843
|
let n = [], r = [], i = [], a;
|
|
844
|
-
for (let
|
|
845
|
-
for (; a = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(
|
|
846
|
-
let
|
|
847
|
-
|
|
844
|
+
for (let t of e.split(/\r\n?|\n/)) {
|
|
845
|
+
for (; a = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(t);) {
|
|
846
|
+
let e = a[1] ? +a[1] : null, o = a[2] || a[3] || "", s = -1;
|
|
847
|
+
e === 0 && (e = 1e9);
|
|
848
848
|
let c = o.replace(/\\[{}]/g, (e) => e[1]);
|
|
849
|
-
for (let
|
|
849
|
+
for (let t = 0; t < n.length; t++) (e == null ? c && n[t].name == c : n[t].seq == e) && (s = t);
|
|
850
850
|
if (s < 0) {
|
|
851
|
-
let
|
|
852
|
-
for (;
|
|
853
|
-
n.splice(
|
|
854
|
-
seq:
|
|
851
|
+
let t = 0;
|
|
852
|
+
for (; t < n.length && (e == null || n[t].seq != null && n[t].seq < e);) t++;
|
|
853
|
+
n.splice(t, 0, {
|
|
854
|
+
seq: e,
|
|
855
855
|
name: c
|
|
856
|
-
}), s =
|
|
856
|
+
}), s = t;
|
|
857
857
|
for (let e of i) e.field >= s && e.field++;
|
|
858
858
|
}
|
|
859
859
|
for (let e of i) if (e.line == r.length && e.from > a.index) {
|
|
860
860
|
let t = a[2] ? 3 + (a[1] || "").length : 2;
|
|
861
861
|
e.from -= t, e.to -= t;
|
|
862
862
|
}
|
|
863
|
-
i.push(new
|
|
863
|
+
i.push(new Fe(s, r.length, a.index, a.index + c.length)), t = t.slice(0, a.index) + o + t.slice(a.index + a[0].length);
|
|
864
864
|
}
|
|
865
|
-
|
|
865
|
+
t = t.replace(/\\([{}])/g, (e, t, n) => {
|
|
866
866
|
for (let e of i) e.line == r.length && e.from > n && (e.from--, e.to--);
|
|
867
867
|
return t;
|
|
868
|
-
}), r.push(
|
|
868
|
+
}), r.push(t);
|
|
869
869
|
}
|
|
870
|
-
return new
|
|
870
|
+
return new t(r, i);
|
|
871
871
|
}
|
|
872
|
-
},
|
|
872
|
+
}, Re = /*@__PURE__*/ w.widget({ widget: /*@__PURE__*/ new class extends te {
|
|
873
873
|
toDOM() {
|
|
874
874
|
let e = document.createElement("span");
|
|
875
875
|
return e.className = "cm-snippetFieldPosition", e;
|
|
@@ -877,9 +877,9 @@ var Te = (e) => {
|
|
|
877
877
|
ignoreEvent() {
|
|
878
878
|
return !1;
|
|
879
879
|
}
|
|
880
|
-
}() }),
|
|
880
|
+
}() }), ze = /*@__PURE__*/ w.mark({ class: "cm-snippetField" }), G = class e {
|
|
881
881
|
constructor(e, t) {
|
|
882
|
-
this.ranges = e, this.active = t, this.deco = w.set(e.map((e) => (e.from == e.to ?
|
|
882
|
+
this.ranges = e, this.active = t, this.deco = w.set(e.map((e) => (e.from == e.to ? Re : ze).range(e.from, e.to)), !0);
|
|
883
883
|
}
|
|
884
884
|
map(t) {
|
|
885
885
|
let n = [];
|
|
@@ -893,89 +893,89 @@ var Te = (e) => {
|
|
|
893
893
|
selectionInsideField(e) {
|
|
894
894
|
return e.ranges.every((e) => this.ranges.some((t) => t.field == this.active && t.from <= e.from && t.to >= e.to));
|
|
895
895
|
}
|
|
896
|
-
},
|
|
896
|
+
}, K = /*@__PURE__*/ d.define({ map(e, t) {
|
|
897
897
|
return e && e.map(t);
|
|
898
|
-
} }),
|
|
898
|
+
} }), Be = /*@__PURE__*/ d.define(), q = /*@__PURE__*/ u.define({
|
|
899
899
|
create() {
|
|
900
900
|
return null;
|
|
901
901
|
},
|
|
902
902
|
update(e, t) {
|
|
903
903
|
for (let n of t.effects) {
|
|
904
|
-
if (n.is(
|
|
905
|
-
if (n.is(
|
|
904
|
+
if (n.is(K)) return n.value;
|
|
905
|
+
if (n.is(Be) && e) return new G(e.ranges, n.value);
|
|
906
906
|
}
|
|
907
907
|
return e && t.docChanged && (e = e.map(t.changes)), e && t.selection && !e.selectionInsideField(t.selection) && (e = null), e;
|
|
908
908
|
},
|
|
909
909
|
provide: (e) => C.decorations.from(e, (e) => e ? e.deco : w.none)
|
|
910
910
|
});
|
|
911
|
-
function
|
|
912
|
-
return
|
|
911
|
+
function J(e, t) {
|
|
912
|
+
return r.create(e.filter((e) => e.field == t).map((e) => r.range(e.from, e.to)));
|
|
913
913
|
}
|
|
914
|
-
function
|
|
915
|
-
let t =
|
|
916
|
-
return (e, n, r,
|
|
917
|
-
let { text:
|
|
914
|
+
function Ve(e) {
|
|
915
|
+
let t = Le.parse(e);
|
|
916
|
+
return (e, n, r, i) => {
|
|
917
|
+
let { text: a, ranges: c } = t.instantiate(e.state, r), { main: l } = e.state.selection, u = {
|
|
918
918
|
changes: {
|
|
919
919
|
from: r,
|
|
920
|
-
to:
|
|
921
|
-
insert:
|
|
920
|
+
to: i == l.from ? l.to : i,
|
|
921
|
+
insert: s.of(a)
|
|
922
922
|
},
|
|
923
923
|
scrollIntoView: !0,
|
|
924
|
-
annotations: n ? [
|
|
924
|
+
annotations: n ? [k.of(n), o.userEvent.of("input.complete")] : void 0
|
|
925
925
|
};
|
|
926
|
-
if (c.length && (
|
|
927
|
-
let t = new
|
|
928
|
-
e.state.field(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
926
|
+
if (c.length && (u.selection = J(c, 0)), c.some((e) => e.field > 0)) {
|
|
927
|
+
let t = new G(c, 0), n = u.effects = [K.of(t)];
|
|
928
|
+
e.state.field(q, !1) === void 0 && n.push(d.appendConfig.of([
|
|
929
|
+
q,
|
|
930
|
+
Ge,
|
|
931
|
+
qe,
|
|
932
|
+
W
|
|
933
933
|
]));
|
|
934
934
|
}
|
|
935
|
-
e.dispatch(e.state.update(
|
|
935
|
+
e.dispatch(e.state.update(u));
|
|
936
936
|
};
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function He(e) {
|
|
939
939
|
return ({ state: t, dispatch: n }) => {
|
|
940
|
-
let r = t.field(
|
|
940
|
+
let r = t.field(q, !1);
|
|
941
941
|
if (!r || e < 0 && r.active == 0) return !1;
|
|
942
942
|
let i = r.active + e, a = e > 0 && !r.ranges.some((t) => t.field == i + e);
|
|
943
943
|
return n(t.update({
|
|
944
|
-
selection:
|
|
945
|
-
effects:
|
|
944
|
+
selection: J(r.ranges, i),
|
|
945
|
+
effects: K.of(a ? null : new G(r.ranges, i)),
|
|
946
946
|
scrollIntoView: !0
|
|
947
947
|
})), !0;
|
|
948
948
|
};
|
|
949
949
|
}
|
|
950
|
-
var
|
|
950
|
+
var Ue = [{
|
|
951
951
|
key: "Tab",
|
|
952
|
-
run: /* @__PURE__ */
|
|
953
|
-
shift: /* @__PURE__ */
|
|
952
|
+
run: /* @__PURE__ */ He(1),
|
|
953
|
+
shift: /* @__PURE__ */ He(-1)
|
|
954
954
|
}, {
|
|
955
955
|
key: "Escape",
|
|
956
|
-
run: ({ state: e, dispatch: t }) => e.field(
|
|
957
|
-
}],
|
|
958
|
-
return e.length ? e[0] :
|
|
959
|
-
} }),
|
|
960
|
-
function
|
|
956
|
+
run: ({ state: e, dispatch: t }) => e.field(q, !1) ? (t(e.update({ effects: K.of(null) })), !0) : !1
|
|
957
|
+
}], We = /*@__PURE__*/ f.define({ combine(e) {
|
|
958
|
+
return e.length ? e[0] : Ue;
|
|
959
|
+
} }), Ge = /*@__PURE__*/ l.highest(/*@__PURE__*/ x.compute([We], (e) => e.facet(We)));
|
|
960
|
+
function Ke(e, t) {
|
|
961
961
|
return {
|
|
962
962
|
...t,
|
|
963
|
-
apply:
|
|
963
|
+
apply: Ve(e)
|
|
964
964
|
};
|
|
965
965
|
}
|
|
966
|
-
var
|
|
967
|
-
let n = t.state.field(
|
|
966
|
+
var qe = /*@__PURE__*/ C.domEventHandlers({ mousedown(e, t) {
|
|
967
|
+
let n = t.state.field(q, !1), r;
|
|
968
968
|
if (!n || (r = t.posAtCoords({
|
|
969
969
|
x: e.clientX,
|
|
970
970
|
y: e.clientY
|
|
971
971
|
})) == null) return !1;
|
|
972
972
|
let i = n.ranges.find((e) => e.from <= r && e.to >= r);
|
|
973
973
|
return !i || i.field == n.active ? !1 : (t.dispatch({
|
|
974
|
-
selection:
|
|
975
|
-
effects:
|
|
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
976
|
scrollIntoView: !0
|
|
977
977
|
}), !0);
|
|
978
|
-
} }),
|
|
978
|
+
} }), Y = {
|
|
979
979
|
brackets: [
|
|
980
980
|
"(",
|
|
981
981
|
"[",
|
|
@@ -985,107 +985,107 @@ var Ke = /*@__PURE__*/ C.domEventHandlers({ mousedown(e, t) {
|
|
|
985
985
|
],
|
|
986
986
|
before: ")]}:;>",
|
|
987
987
|
stringPrefixes: []
|
|
988
|
-
},
|
|
989
|
-
return t.mapPos(e, -1,
|
|
990
|
-
} }),
|
|
991
|
-
|
|
992
|
-
var
|
|
988
|
+
}, X = /*@__PURE__*/ d.define({ map(e, t) {
|
|
989
|
+
return t.mapPos(e, -1, i.TrackAfter) ?? void 0;
|
|
990
|
+
} }), Z = /*@__PURE__*/ new class extends a {}();
|
|
991
|
+
Z.startSide = 1, Z.endSide = -1;
|
|
992
|
+
var Q = /*@__PURE__*/ u.define({
|
|
993
993
|
create() {
|
|
994
|
-
return
|
|
994
|
+
return m.empty;
|
|
995
995
|
},
|
|
996
996
|
update(e, t) {
|
|
997
997
|
if (e = e.map(t.changes), t.selection) {
|
|
998
998
|
let n = t.state.doc.lineAt(t.selection.main.head);
|
|
999
999
|
e = e.update({ filter: (e) => e >= n.from && e <= n.to });
|
|
1000
1000
|
}
|
|
1001
|
-
for (let n of t.effects) n.is(
|
|
1001
|
+
for (let n of t.effects) n.is(X) && (e = e.update({ add: [Z.range(n.value, n.value + 1)] }));
|
|
1002
1002
|
return e;
|
|
1003
1003
|
}
|
|
1004
1004
|
});
|
|
1005
1005
|
function Je() {
|
|
1006
|
-
return [$e,
|
|
1006
|
+
return [$e, Q];
|
|
1007
1007
|
}
|
|
1008
1008
|
var Ye = "()[]{}<>«»»«[]{}";
|
|
1009
1009
|
function Xe(e) {
|
|
1010
1010
|
for (let t = 0; t < 16; t += 2) if (Ye.charCodeAt(t) == e) return Ye.charAt(t + 1);
|
|
1011
|
-
return
|
|
1011
|
+
return g(e < 128 ? e : e + 1);
|
|
1012
1012
|
}
|
|
1013
1013
|
function Ze(e, t) {
|
|
1014
|
-
return e.languageDataAt("closeBrackets", t)[0] ||
|
|
1014
|
+
return e.languageDataAt("closeBrackets", t)[0] || Y;
|
|
1015
1015
|
}
|
|
1016
|
-
var Qe = typeof navigator == "object" && /*@__PURE__*/ /Android\b/.test(navigator.userAgent), $e = /*@__PURE__*/ C.inputHandler.of((
|
|
1017
|
-
if ((Qe ?
|
|
1018
|
-
let a =
|
|
1019
|
-
if (i.length > 2 || i.length == 2 &&
|
|
1020
|
-
let o = tt(
|
|
1021
|
-
return o ? (
|
|
1016
|
+
var Qe = typeof navigator == "object" && /*@__PURE__*/ /Android\b/.test(navigator.userAgent), $e = /*@__PURE__*/ C.inputHandler.of((e, t, r, i) => {
|
|
1017
|
+
if ((Qe ? e.composing : e.compositionStarted) || e.state.readOnly) return !1;
|
|
1018
|
+
let a = e.state.selection.main;
|
|
1019
|
+
if (i.length > 2 || i.length == 2 && h(n(i, 0)) == 1 || t != a.from || r != a.to) return !1;
|
|
1020
|
+
let o = tt(e.state, i);
|
|
1021
|
+
return o ? (e.dispatch(o), !0) : !1;
|
|
1022
1022
|
}), et = [{
|
|
1023
1023
|
key: "Backspace",
|
|
1024
|
-
run: ({ state:
|
|
1025
|
-
if (
|
|
1026
|
-
let i = Ze(
|
|
1027
|
-
if (
|
|
1028
|
-
let a = rt(
|
|
1029
|
-
for (let o of i) if (o == a && $(
|
|
1024
|
+
run: ({ state: e, dispatch: t }) => {
|
|
1025
|
+
if (e.readOnly) return !1;
|
|
1026
|
+
let i = Ze(e, e.selection.main.head).brackets || Y.brackets, a = null, o = e.changeByRange((t) => {
|
|
1027
|
+
if (t.empty) {
|
|
1028
|
+
let a = rt(e.doc, t.head);
|
|
1029
|
+
for (let o of i) if (o == a && $(e.doc, t.head) == Xe(n(o, 0))) return {
|
|
1030
1030
|
changes: {
|
|
1031
|
-
from:
|
|
1032
|
-
to:
|
|
1031
|
+
from: t.head - o.length,
|
|
1032
|
+
to: t.head + o.length
|
|
1033
1033
|
},
|
|
1034
|
-
range:
|
|
1034
|
+
range: r.cursor(t.head - o.length)
|
|
1035
1035
|
};
|
|
1036
1036
|
}
|
|
1037
|
-
return { range: a =
|
|
1037
|
+
return { range: a = t };
|
|
1038
1038
|
});
|
|
1039
|
-
return a ||
|
|
1039
|
+
return a || t(e.update(o, {
|
|
1040
1040
|
scrollIntoView: !0,
|
|
1041
1041
|
userEvent: "delete.backward"
|
|
1042
1042
|
})), !a;
|
|
1043
1043
|
}
|
|
1044
1044
|
}];
|
|
1045
|
-
function tt(
|
|
1046
|
-
let r = Ze(
|
|
1045
|
+
function tt(e, t) {
|
|
1046
|
+
let r = Ze(e, e.selection.main.head), i = r.brackets || Y.brackets;
|
|
1047
1047
|
for (let a of i) {
|
|
1048
|
-
let o = Xe(
|
|
1049
|
-
if (
|
|
1050
|
-
if (
|
|
1048
|
+
let o = Xe(n(a, 0));
|
|
1049
|
+
if (t == a) return o == a ? ot(e, a, i.indexOf(a + a + a) > -1, r) : it(e, a, o, r.before || Y.before);
|
|
1050
|
+
if (t == o && nt(e, e.selection.main.from)) return at(e, a, o);
|
|
1051
1051
|
}
|
|
1052
1052
|
return null;
|
|
1053
1053
|
}
|
|
1054
1054
|
function nt(e, t) {
|
|
1055
1055
|
let n = !1;
|
|
1056
|
-
return e.field(
|
|
1056
|
+
return e.field(Q).between(0, e.doc.length, (e) => {
|
|
1057
1057
|
e == t && (n = !0);
|
|
1058
1058
|
}), n;
|
|
1059
1059
|
}
|
|
1060
|
-
function $(
|
|
1061
|
-
let r =
|
|
1062
|
-
return r.slice(0,
|
|
1060
|
+
function $(e, t) {
|
|
1061
|
+
let r = e.sliceString(t, t + 2);
|
|
1062
|
+
return r.slice(0, h(n(r, 0)));
|
|
1063
1063
|
}
|
|
1064
|
-
function rt(
|
|
1065
|
-
let r =
|
|
1066
|
-
return
|
|
1064
|
+
function rt(e, t) {
|
|
1065
|
+
let r = e.sliceString(t - 2, t);
|
|
1066
|
+
return h(n(r, 0)) == r.length ? r : r.slice(1);
|
|
1067
1067
|
}
|
|
1068
|
-
function it(e,
|
|
1068
|
+
function it(e, t, n, i) {
|
|
1069
1069
|
let a = null, o = e.changeByRange((o) => {
|
|
1070
1070
|
if (!o.empty) return {
|
|
1071
1071
|
changes: [{
|
|
1072
|
-
insert:
|
|
1072
|
+
insert: t,
|
|
1073
1073
|
from: o.from
|
|
1074
1074
|
}, {
|
|
1075
|
-
insert:
|
|
1075
|
+
insert: n,
|
|
1076
1076
|
from: o.to
|
|
1077
1077
|
}],
|
|
1078
|
-
effects:
|
|
1079
|
-
range:
|
|
1078
|
+
effects: X.of(o.to + t.length),
|
|
1079
|
+
range: r.range(o.anchor + t.length, o.head + t.length)
|
|
1080
1080
|
};
|
|
1081
1081
|
let s = $(e.doc, o.head);
|
|
1082
1082
|
return !s || /\s/.test(s) || i.indexOf(s) > -1 ? {
|
|
1083
1083
|
changes: {
|
|
1084
|
-
insert:
|
|
1084
|
+
insert: t + n,
|
|
1085
1085
|
from: o.head
|
|
1086
1086
|
},
|
|
1087
|
-
effects:
|
|
1088
|
-
range:
|
|
1087
|
+
effects: X.of(o.head + t.length),
|
|
1088
|
+
range: r.cursor(o.head + t.length)
|
|
1089
1089
|
} : { range: a = o };
|
|
1090
1090
|
});
|
|
1091
1091
|
return a ? null : e.update(o, {
|
|
@@ -1093,155 +1093,155 @@ function it(e, n, r, i) {
|
|
|
1093
1093
|
userEvent: "input.type"
|
|
1094
1094
|
});
|
|
1095
1095
|
}
|
|
1096
|
-
function at(e,
|
|
1097
|
-
let i = null, a = e.changeByRange((
|
|
1096
|
+
function at(e, t, n) {
|
|
1097
|
+
let i = null, a = e.changeByRange((t) => t.empty && $(e.doc, t.head) == n ? {
|
|
1098
1098
|
changes: {
|
|
1099
|
-
from:
|
|
1100
|
-
to:
|
|
1101
|
-
insert:
|
|
1099
|
+
from: t.head,
|
|
1100
|
+
to: t.head + n.length,
|
|
1101
|
+
insert: n
|
|
1102
1102
|
},
|
|
1103
|
-
range:
|
|
1104
|
-
} : i = { range:
|
|
1103
|
+
range: r.cursor(t.head + n.length)
|
|
1104
|
+
} : i = { range: t });
|
|
1105
1105
|
return i ? null : e.update(a, {
|
|
1106
1106
|
scrollIntoView: !0,
|
|
1107
1107
|
userEvent: "input.type"
|
|
1108
1108
|
});
|
|
1109
1109
|
}
|
|
1110
|
-
function ot(e,
|
|
1111
|
-
let a = i.stringPrefixes ||
|
|
1110
|
+
function ot(e, t, n, i) {
|
|
1111
|
+
let a = i.stringPrefixes || Y.stringPrefixes, o = null, s = e.changeByRange((i) => {
|
|
1112
1112
|
if (!i.empty) return {
|
|
1113
1113
|
changes: [{
|
|
1114
|
-
insert:
|
|
1114
|
+
insert: t,
|
|
1115
1115
|
from: i.from
|
|
1116
1116
|
}, {
|
|
1117
|
-
insert:
|
|
1117
|
+
insert: t,
|
|
1118
1118
|
from: i.to
|
|
1119
1119
|
}],
|
|
1120
|
-
effects:
|
|
1121
|
-
range:
|
|
1120
|
+
effects: X.of(i.to + t.length),
|
|
1121
|
+
range: r.range(i.anchor + t.length, i.head + t.length)
|
|
1122
1122
|
};
|
|
1123
|
-
let
|
|
1124
|
-
if (l ==
|
|
1125
|
-
if (st(e,
|
|
1123
|
+
let s = i.head, l = $(e.doc, s), u;
|
|
1124
|
+
if (l == t) {
|
|
1125
|
+
if (st(e, s)) return {
|
|
1126
1126
|
changes: {
|
|
1127
|
-
insert:
|
|
1128
|
-
from:
|
|
1127
|
+
insert: t + t,
|
|
1128
|
+
from: s
|
|
1129
1129
|
},
|
|
1130
|
-
effects:
|
|
1131
|
-
range:
|
|
1130
|
+
effects: X.of(s + t.length),
|
|
1131
|
+
range: r.cursor(s + t.length)
|
|
1132
1132
|
};
|
|
1133
|
-
if (nt(e,
|
|
1134
|
-
let i =
|
|
1133
|
+
if (nt(e, s)) {
|
|
1134
|
+
let i = n && e.sliceDoc(s, s + t.length * 3) == t + t + t ? t + t + t : t;
|
|
1135
1135
|
return {
|
|
1136
1136
|
changes: {
|
|
1137
|
-
from:
|
|
1138
|
-
to:
|
|
1137
|
+
from: s,
|
|
1138
|
+
to: s + i.length,
|
|
1139
1139
|
insert: i
|
|
1140
1140
|
},
|
|
1141
|
-
range:
|
|
1141
|
+
range: r.cursor(s + i.length)
|
|
1142
1142
|
};
|
|
1143
1143
|
}
|
|
1144
|
-
} else if (
|
|
1144
|
+
} else if (n && e.sliceDoc(s - 2 * t.length, s) == t + t && (u = lt(e, s - 2 * t.length, a)) > -1 && st(e, u)) return {
|
|
1145
1145
|
changes: {
|
|
1146
|
-
insert:
|
|
1147
|
-
from:
|
|
1146
|
+
insert: t + t + t + t,
|
|
1147
|
+
from: s
|
|
1148
1148
|
},
|
|
1149
|
-
effects:
|
|
1150
|
-
range:
|
|
1149
|
+
effects: X.of(s + t.length),
|
|
1150
|
+
range: r.cursor(s + t.length)
|
|
1151
1151
|
};
|
|
1152
|
-
else if (e.charCategorizer(
|
|
1152
|
+
else if (e.charCategorizer(s)(l) != c.Word && lt(e, s, a) > -1 && !ct(e, s, t, a)) return {
|
|
1153
1153
|
changes: {
|
|
1154
|
-
insert:
|
|
1155
|
-
from:
|
|
1154
|
+
insert: t + t,
|
|
1155
|
+
from: s
|
|
1156
1156
|
},
|
|
1157
|
-
effects:
|
|
1158
|
-
range:
|
|
1157
|
+
effects: X.of(s + t.length),
|
|
1158
|
+
range: r.cursor(s + t.length)
|
|
1159
1159
|
};
|
|
1160
|
-
return { range:
|
|
1160
|
+
return { range: o = i };
|
|
1161
1161
|
});
|
|
1162
|
-
return
|
|
1162
|
+
return o ? null : e.update(s, {
|
|
1163
1163
|
scrollIntoView: !0,
|
|
1164
1164
|
userEvent: "input.type"
|
|
1165
1165
|
});
|
|
1166
1166
|
}
|
|
1167
|
-
function st(e,
|
|
1168
|
-
let
|
|
1169
|
-
return
|
|
1167
|
+
function st(e, n) {
|
|
1168
|
+
let r = t(e).resolveInner(n + 1);
|
|
1169
|
+
return r.parent && r.from == n;
|
|
1170
1170
|
}
|
|
1171
|
-
function ct(e,
|
|
1172
|
-
let
|
|
1173
|
-
for (let
|
|
1174
|
-
let
|
|
1175
|
-
if (!s || s > -1 &&
|
|
1176
|
-
let t =
|
|
1177
|
-
for (; t && t.from ==
|
|
1178
|
-
if (e.sliceDoc(t.to -
|
|
1171
|
+
function ct(e, n, r, i) {
|
|
1172
|
+
let a = t(e).resolveInner(n, -1), o = i.reduce((e, t) => Math.max(e, t.length), 0);
|
|
1173
|
+
for (let t = 0; t < 5; t++) {
|
|
1174
|
+
let t = e.sliceDoc(a.from, Math.min(a.to, a.from + r.length + o)), s = t.indexOf(r);
|
|
1175
|
+
if (!s || s > -1 && i.indexOf(t.slice(0, s)) > -1) {
|
|
1176
|
+
let t = a.firstChild;
|
|
1177
|
+
for (; t && t.from == a.from && t.to - t.from > r.length + s;) {
|
|
1178
|
+
if (e.sliceDoc(t.to - r.length, t.to) == r) return !1;
|
|
1179
1179
|
t = t.firstChild;
|
|
1180
1180
|
}
|
|
1181
1181
|
return !0;
|
|
1182
1182
|
}
|
|
1183
|
-
let c =
|
|
1183
|
+
let c = a.to == n && a.parent;
|
|
1184
1184
|
if (!c) break;
|
|
1185
|
-
|
|
1185
|
+
a = c;
|
|
1186
1186
|
}
|
|
1187
1187
|
return !1;
|
|
1188
1188
|
}
|
|
1189
1189
|
function lt(e, t, n) {
|
|
1190
1190
|
let r = e.charCategorizer(t);
|
|
1191
|
-
if (r(e.sliceDoc(t - 1, t)) !=
|
|
1191
|
+
if (r(e.sliceDoc(t - 1, t)) != c.Word) return t;
|
|
1192
1192
|
for (let i of n) {
|
|
1193
1193
|
let n = t - i.length;
|
|
1194
|
-
if (e.sliceDoc(n, t) == i && r(e.sliceDoc(n - 1, n)) !=
|
|
1194
|
+
if (e.sliceDoc(n, t) == i && r(e.sliceDoc(n - 1, n)) != c.Word) return n;
|
|
1195
1195
|
}
|
|
1196
1196
|
return -1;
|
|
1197
1197
|
}
|
|
1198
1198
|
function ut(e = {}) {
|
|
1199
1199
|
return [
|
|
1200
|
+
Pe,
|
|
1201
|
+
B,
|
|
1202
|
+
M.of(e),
|
|
1200
1203
|
Me,
|
|
1201
|
-
H,
|
|
1202
|
-
N.of(e),
|
|
1203
|
-
Ae,
|
|
1204
1204
|
ft,
|
|
1205
|
-
|
|
1205
|
+
W
|
|
1206
1206
|
];
|
|
1207
1207
|
}
|
|
1208
1208
|
var dt = [
|
|
1209
1209
|
{
|
|
1210
1210
|
key: "Ctrl-Space",
|
|
1211
|
-
run:
|
|
1211
|
+
run: U
|
|
1212
1212
|
},
|
|
1213
1213
|
{
|
|
1214
1214
|
mac: "Alt-`",
|
|
1215
|
-
run:
|
|
1215
|
+
run: U
|
|
1216
1216
|
},
|
|
1217
1217
|
{
|
|
1218
1218
|
mac: "Alt-i",
|
|
1219
|
-
run:
|
|
1219
|
+
run: U
|
|
1220
1220
|
},
|
|
1221
1221
|
{
|
|
1222
1222
|
key: "Escape",
|
|
1223
|
-
run:
|
|
1223
|
+
run: Oe
|
|
1224
1224
|
},
|
|
1225
1225
|
{
|
|
1226
1226
|
key: "ArrowDown",
|
|
1227
|
-
run: /*@__PURE__*/
|
|
1227
|
+
run: /*@__PURE__*/ H(!0)
|
|
1228
1228
|
},
|
|
1229
1229
|
{
|
|
1230
1230
|
key: "ArrowUp",
|
|
1231
|
-
run: /*@__PURE__*/
|
|
1231
|
+
run: /*@__PURE__*/ H(!1)
|
|
1232
1232
|
},
|
|
1233
1233
|
{
|
|
1234
1234
|
key: "PageDown",
|
|
1235
|
-
run: /*@__PURE__*/
|
|
1235
|
+
run: /*@__PURE__*/ H(!0, "page")
|
|
1236
1236
|
},
|
|
1237
1237
|
{
|
|
1238
1238
|
key: "PageUp",
|
|
1239
|
-
run: /*@__PURE__*/
|
|
1239
|
+
run: /*@__PURE__*/ H(!1, "page")
|
|
1240
1240
|
},
|
|
1241
1241
|
{
|
|
1242
1242
|
key: "Enter",
|
|
1243
|
-
run:
|
|
1243
|
+
run: De
|
|
1244
1244
|
}
|
|
1245
|
-
], ft = /*@__PURE__*/
|
|
1245
|
+
], ft = /*@__PURE__*/ l.highest(/*@__PURE__*/ x.computeN([M], (e) => e.facet(M).defaultKeymap ? [dt] : []));
|
|
1246
1246
|
//#endregion
|
|
1247
|
-
export { re as a,
|
|
1247
|
+
export { re as a, oe as c, et as i, Ve as l, ut as n, dt as o, Je as r, ie as s, T as t, Ke as u };
|