@oomol-lab/open-flow 0.1.0-beta.2 → 0.1.0-beta.20

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.
Files changed (93) hide show
  1. package/dist/browser/{_virtual_open-flow-twemoji-DJwKsM_w.js → _virtual_open-flow-twemoji-CpHJOEsk.js} +4028 -2
  2. package/dist/browser/carbon-Cn-DTyjG.js +54 -0
  3. package/dist/browser/createResourceDialog-DlrAMxmo.js +110 -0
  4. package/dist/browser/dist-B_T-OpQp.js +4 -0
  5. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  6. package/dist/browser/{dist-CPuF50D9.js → dist-D1VYgicl.js} +426 -305
  7. package/dist/browser/dist-DSe6KRsr.js +1224 -0
  8. package/dist/browser/dist-DYjIVIZC.js +795 -0
  9. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  10. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  11. package/dist/browser/{dist-CJpzJrLM.js → dist-DwvhuMxw.js} +894 -895
  12. package/dist/browser/dist-DxahK_I8.js +2688 -0
  13. package/dist/browser/{dist-C46JByB-.js → dist-Dz6Nglsd.js} +61 -61
  14. package/dist/browser/{dist-DUzA0Ukh.js → dist-TJfrvoIQ.js} +141 -142
  15. package/dist/browser/{esm-B_PbUobB.js → esm-B7A42FzW.js} +68 -59
  16. package/dist/browser/flow-authoring-module.d.ts +2 -2
  17. package/dist/browser/flow-authoring-node.d.ts +20 -6
  18. package/dist/browser/flow-authoring.d.ts +1 -1
  19. package/dist/browser/flow-authoring.js +5405 -286
  20. package/dist/browser/flow-change-schema.d.ts +6 -0
  21. package/dist/browser/flow-change.d.ts +173 -14
  22. package/dist/browser/flow-change.js +5271 -114
  23. package/dist/browser/flow-notifications.d.ts +5 -0
  24. package/dist/browser/flowChanges-jX3KYcb0.js +11020 -0
  25. package/dist/browser/{flowRunInputEditorStore-BeyUSWpO.js → flowRunInputEditorStore-BBqQIOCR.js} +1020 -4104
  26. package/dist/browser/flowWorkspace-BIYwslVl.js +148497 -0
  27. package/dist/browser/host-conformance.d.ts +7 -0
  28. package/dist/browser/host-conformance.js +33 -0
  29. package/dist/browser/{diagnostics-giPSzyMo.js → i18n-CVBh0Ni1.js} +3390 -5715
  30. package/dist/browser/inputValues-BWfRHJWC.js +43 -0
  31. package/dist/browser/{languages-DgJehE1g.js → languages-C0zQ4GSo.js} +5 -25
  32. package/dist/browser/licenses.md +149 -700
  33. package/dist/browser/main-BDnNHhkU.js +50 -0
  34. package/dist/browser/{markdownContent-DdlIRN3_.js → markdownContent-BBgH9ZIV.js} +41 -41
  35. package/dist/browser/theme.css +461 -34
  36. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-DnAmJCzu.js} +70 -71
  37. package/dist/browser/ui-input.d.ts +3 -0
  38. package/dist/browser/ui-label.d.ts +3 -0
  39. package/dist/browser/ui-textarea.d.ts +3 -0
  40. package/dist/browser/ui.css +2 -0
  41. package/dist/browser/ui.css.d.ts +1 -0
  42. package/dist/browser/ui.d.ts +12 -0
  43. package/dist/browser/ui.js +2598 -0
  44. package/dist/browser/useValueChanged-BY05Usw-.js +2944 -0
  45. package/dist/browser/workbench-contract.d.ts +8 -2
  46. package/dist/browser/workbench.css +1 -1
  47. package/dist/browser/workbench.d.ts +1 -0
  48. package/dist/browser/workbench.js +2043 -1327
  49. package/dist/browser/workbenchSelect-CwP6rphY.js +11666 -0
  50. package/dist/common/control-api-conformance.d.ts +7 -0
  51. package/dist/common/control-api-conformance.js +5568 -166
  52. package/dist/common/control-api-errors.d.ts +9 -0
  53. package/dist/common/control-api.d.ts +309 -38
  54. package/dist/common/control-api.js +5817 -576
  55. package/dist/common/control-requests.d.ts +68 -0
  56. package/dist/common/control-requests.js +4950 -0
  57. package/dist/common/engine-contract.d.ts +3 -1
  58. package/dist/common/flow-agent.d.ts +10 -0
  59. package/dist/common/flow-encoding.d.ts +5 -2
  60. package/dist/common/flow-encoding.js +4820 -66
  61. package/dist/common/flow-graph.d.ts +6 -0
  62. package/dist/common/flow-json.d.ts +2 -0
  63. package/dist/common/flow-modules.d.ts +20 -0
  64. package/dist/common/flow-notifications.d.ts +5 -0
  65. package/dist/common/flow-schema.d.ts +8 -0
  66. package/dist/common/flow-semantics.d.ts +10 -6
  67. package/dist/common/flow-semantics.js +9982 -1701
  68. package/dist/common/integration-trigger.d.ts +24 -1
  69. package/dist/common/integration-trigger.js +188 -52
  70. package/dist/common/mcp-conformance.d.ts +2 -0
  71. package/dist/common/mcp.d.ts +765 -0
  72. package/dist/common/mcp.js +6477 -0
  73. package/dist/common/provider-triggers.js +5996 -993
  74. package/dist/common/run-events.d.ts +2 -2
  75. package/dist/common/run-events.js +12 -17
  76. package/dist/common/run-lifecycle.d.ts +21 -2
  77. package/dist/common/run-lifecycle.js +83 -2
  78. package/dist/common/run-results.d.ts +57 -0
  79. package/dist/common/runtime-contract.d.ts +36 -3
  80. package/dist/common/runtime-contract.js +227 -19
  81. package/dist/common/scheduler.d.ts +77 -18
  82. package/dist/common/scheduler.js +8259 -248
  83. package/dist/index.d.ts +6 -5
  84. package/package.json +21 -1
  85. package/dist/browser/carbon-DMCVsjHo.js +0 -53
  86. package/dist/browser/createResourceDialog-BkZns-oZ.js +0 -504
  87. package/dist/browser/dist-BMqL-qR5.js +0 -1894
  88. package/dist/browser/dist-BpopSHwP.js +0 -1543
  89. package/dist/browser/dist-CUSrALSX.js +0 -1620
  90. package/dist/browser/flowWorkspace-DAMLVMcF.js +0 -47584
  91. package/dist/browser/getPseudoElementBounds-ESJExRFX.js +0 -7642
  92. package/dist/browser/main-DmjVyuWr.js +0 -76
  93. package/dist/browser/workbenchSelect-B2s1HV-Y.js +0 -1374
@@ -0,0 +1,1224 @@
1
+ import { S as e, a as t, b as n, g as r, h as i, i as a, m as o, n as s, p as c, r as l, s as u, t as d, y as f } from "./dist-Mecbzdl2.js";
2
+ import { n as p, r as m } from "./dist-BKuSVKCC.js";
3
+ import { E as ee, M as te, T as h, b as g, k as _, n as ne, x as re, z as v } from "./dist-DxahK_I8.js";
4
+ //#region ../../node_modules/.bun/@codemirror+commands@6.11.0/node_modules/@codemirror/commands/dist/index.js
5
+ var ie = (e) => {
6
+ let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r = fe(e.state, n.from);
7
+ return r.line ? ae(e) : r.block ? de(e) : !1;
8
+ };
9
+ function y(e, t) {
10
+ return ({ state: n, dispatch: r }) => {
11
+ if (n.readOnly) return !1;
12
+ let i = e(t, n);
13
+ return i ? (r(n.update(i)), !0) : !1;
14
+ };
15
+ }
16
+ var ae = /*@__PURE__*/ y(he, 0), oe = /*@__PURE__*/ y(he, 1), se = /*@__PURE__*/ y(he, 2), ce = /*@__PURE__*/ y(x, 0), le = /*@__PURE__*/ y(x, 1), ue = /*@__PURE__*/ y(x, 2), de = /*@__PURE__*/ y((e, t) => x(e, t, me(t)), 0);
17
+ function fe(e, t) {
18
+ let n = e.languageDataAt("commentTokens", t, 1);
19
+ return n.length ? n[0] : {};
20
+ }
21
+ var b = 50;
22
+ function pe(e, { open: t, close: n }, r, i) {
23
+ let a = e.sliceDoc(r - b, r), o = e.sliceDoc(i, i + b), s = /\s*$/.exec(a)[0].length, c = /^\s*/.exec(o)[0].length, l = a.length - s;
24
+ if (a.slice(l - t.length, l) == t && o.slice(c, c + n.length) == n) return {
25
+ open: {
26
+ pos: r - s,
27
+ margin: s && 1
28
+ },
29
+ close: {
30
+ pos: i + c,
31
+ margin: c && 1
32
+ }
33
+ };
34
+ let u, d;
35
+ i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r + b), d = e.sliceDoc(i - b, i));
36
+ let f = /^\s*/.exec(u)[0].length, p = /\s*$/.exec(d)[0].length, m = d.length - p - n.length;
37
+ return u.slice(f, f + t.length) == t && d.slice(m, m + n.length) == n ? {
38
+ open: {
39
+ pos: r + f + t.length,
40
+ margin: +!!/\s/.test(u.charAt(f + t.length))
41
+ },
42
+ close: {
43
+ pos: i - p - n.length,
44
+ margin: +!!/\s/.test(d.charAt(m - 1))
45
+ }
46
+ } : null;
47
+ }
48
+ function me(e) {
49
+ let t = [];
50
+ for (let n of e.selection.ranges) {
51
+ let r = e.doc.lineAt(n.from), i = n.to <= r.to ? r : e.doc.lineAt(n.to);
52
+ i.from > r.from && i.from == n.to && (i = n.to == r.to + 1 ? r : e.doc.lineAt(n.to - 1));
53
+ let a = t.length - 1;
54
+ a >= 0 && t[a].to > r.from ? t[a].to = i.to : t.push({
55
+ from: r.from + /^\s*/.exec(r.text)[0].length,
56
+ to: i.to
57
+ });
58
+ }
59
+ return t;
60
+ }
61
+ function x(e, t, n = t.selection.ranges) {
62
+ let r = n.map((e) => fe(t, e.from).block);
63
+ if (!r.every((e) => e)) return null;
64
+ let i = n.map((e, n) => pe(t, r[n], e.from, e.to));
65
+ if (e != 2 && !i.every((e) => e)) return { changes: t.changes(n.map((e, t) => i[t] ? [] : [{
66
+ from: e.from,
67
+ insert: r[t].open + " "
68
+ }, {
69
+ from: e.to,
70
+ insert: " " + r[t].close
71
+ }])) };
72
+ if (e != 1 && i.some((e) => e)) {
73
+ let e = [];
74
+ for (let t = 0, n; t < i.length; t++) if (n = i[t]) {
75
+ let i = r[t], { open: a, close: o } = n;
76
+ e.push({
77
+ from: a.pos - i.open.length,
78
+ to: a.pos + a.margin
79
+ }, {
80
+ from: o.pos - o.margin,
81
+ to: o.pos + i.close.length
82
+ });
83
+ }
84
+ return { changes: e };
85
+ }
86
+ return null;
87
+ }
88
+ function he(e, t, n = t.selection.ranges) {
89
+ let r = [], i = -1;
90
+ ranges: for (let { from: e, to: a } of n) {
91
+ let n = r.length, o = 1e9, s;
92
+ for (let n = e; n <= a;) {
93
+ let c = t.doc.lineAt(n);
94
+ if (s == null && (s = fe(t, c.from).line, !s)) continue ranges;
95
+ if (c.from > i && (e == a || a > c.from)) {
96
+ i = c.from;
97
+ let e = /^\s*/.exec(c.text)[0].length, t = e == c.length, n = c.text.slice(e, e + s.length) == s ? e : -1;
98
+ e < c.text.length && e < o && (o = e), r.push({
99
+ line: c,
100
+ comment: n,
101
+ token: s,
102
+ indent: e,
103
+ empty: t,
104
+ single: !1
105
+ });
106
+ }
107
+ n = c.to + 1;
108
+ }
109
+ if (o < 1e9) for (let e = n; e < r.length; e++) r[e].indent < r[e].line.text.length && (r[e].indent = o);
110
+ r.length == n + 1 && (r[n].single = !0);
111
+ }
112
+ if (e != 2 && r.some((e) => e.comment < 0 && (!e.empty || e.single))) {
113
+ let e = [];
114
+ for (let { line: t, token: n, indent: i, empty: a, single: o } of r) (o || !a) && e.push({
115
+ from: t.from + i,
116
+ insert: n + " "
117
+ });
118
+ let n = t.changes(e);
119
+ return {
120
+ changes: n,
121
+ selection: t.selection.map(n, 1)
122
+ };
123
+ }
124
+ if (e != 1 && r.some((e) => e.comment >= 0)) {
125
+ let e = [];
126
+ for (let { line: t, comment: n, token: i } of r) if (n >= 0) {
127
+ let r = t.from + n, a = r + i.length;
128
+ t.text[a - t.from] == " " && a++, e.push({
129
+ from: r,
130
+ to: a
131
+ });
132
+ }
133
+ return { changes: e };
134
+ }
135
+ return null;
136
+ }
137
+ var S = /*@__PURE__*/ d.define(), ge = /*@__PURE__*/ d.define(), _e = /*@__PURE__*/ u.define(), ve = /*@__PURE__*/ u.define({ combine(e) {
138
+ return f(e, {
139
+ minDepth: 100,
140
+ newGroupDelay: 500,
141
+ joinToEvent: (e, t) => t
142
+ }, {
143
+ minDepth: Math.max,
144
+ newGroupDelay: Math.min,
145
+ joinToEvent: (e, t) => (n, r) => e(n, r) || t(n, r)
146
+ });
147
+ } }), C = /*@__PURE__*/ o.define({
148
+ create() {
149
+ return A.empty;
150
+ },
151
+ update(e, t) {
152
+ let n = t.state.facet(ve), i = t.annotation(S);
153
+ if (i) {
154
+ let r = E.fromTransaction(t, i.selection), a = i.side, o = a == 0 ? e.undone : e.done;
155
+ return o = r ? D(o, o.length, n.minDepth, r) : Pe(o, t.startState.selection), new A(a == 0 ? i.rest : o, a == 0 ? o : i.rest);
156
+ }
157
+ let a = t.annotation(ge);
158
+ if ((a == "full" || a == "before") && (e = e.isolate()), t.annotation(r.addToHistory) === !1) return t.changes.empty ? e : e.addMapping(t.changes.desc);
159
+ let o = E.fromTransaction(t), s = t.annotation(r.time), c = t.annotation(r.userEvent);
160
+ return o ? e = e.addChanges(o, s, c, n, t) : t.selection && (e = e.addSelection(t.startState.selection, s, c, n.newGroupDelay)), (a == "full" || a == "after") && (e = e.isolate()), e;
161
+ },
162
+ toJSON(e) {
163
+ return {
164
+ done: e.done.map((e) => e.toJSON()),
165
+ undone: e.undone.map((e) => e.toJSON())
166
+ };
167
+ },
168
+ fromJSON(e) {
169
+ return new A(e.done.map(E.fromJSON), e.undone.map(E.fromJSON));
170
+ }
171
+ });
172
+ function ye(e = {}) {
173
+ return [
174
+ C,
175
+ ve.of(e),
176
+ m.domEventHandlers({ beforeinput(e, t) {
177
+ let n = e.inputType == "historyUndo" ? xe : e.inputType == "historyRedo" ? T : null;
178
+ return n ? (e.preventDefault(), n(t)) : !1;
179
+ } })
180
+ ];
181
+ }
182
+ var be = C;
183
+ function w(e, t) {
184
+ return function({ state: n, dispatch: r }) {
185
+ if (!t && n.readOnly) return !1;
186
+ let i = n.field(C, !1);
187
+ if (!i) return !1;
188
+ let a = i.pop(e, n, t);
189
+ return a ? (r(a), !0) : !1;
190
+ };
191
+ }
192
+ var xe = /*@__PURE__*/ w(0, !1), T = /*@__PURE__*/ w(1, !1), Se = /*@__PURE__*/ w(0, !0), Ce = /*@__PURE__*/ w(1, !0);
193
+ function we(e) {
194
+ return function(t) {
195
+ let n = t.field(C, !1);
196
+ if (!n) return 0;
197
+ let r = e == 0 ? n.done : n.undone;
198
+ return r.length - (r.length && !r[0].changes ? 1 : 0);
199
+ };
200
+ }
201
+ var Te = /*@__PURE__*/ we(0), Ee = /*@__PURE__*/ we(1);
202
+ function De(e) {
203
+ return function(t) {
204
+ let n = t.field(C, !1);
205
+ if (!n) return !1;
206
+ let r = e == 0 ? n.done : n.undone;
207
+ return r.length > 0 && r[0].selectionsAfter.length > 0;
208
+ };
209
+ }
210
+ var Oe = /*@__PURE__*/ De(0), ke = /*@__PURE__*/ De(0), E = class e {
211
+ constructor(e, t, n, r, i) {
212
+ this.changes = e, this.effects = t, this.mapped = n, this.startSelection = r, this.selectionsAfter = i;
213
+ }
214
+ setSelAfter(t) {
215
+ return new e(this.changes, this.effects, this.mapped, this.startSelection, t);
216
+ }
217
+ toJSON() {
218
+ return {
219
+ changes: this.changes?.toJSON(),
220
+ mapped: this.mapped?.toJSON(),
221
+ startSelection: this.startSelection?.toJSON(),
222
+ selectionsAfter: this.selectionsAfter.map((e) => e.toJSON())
223
+ };
224
+ }
225
+ static fromJSON(n) {
226
+ return new e(n.changes && l.fromJSON(n.changes), [], n.mapped && s.fromJSON(n.mapped), n.startSelection && t.fromJSON(n.startSelection), n.selectionsAfter.map(t.fromJSON));
227
+ }
228
+ static fromTransaction(t, n) {
229
+ let r = O;
230
+ for (let e of t.startState.facet(_e)) {
231
+ let n = e(t);
232
+ n.length && (r = r.concat(n));
233
+ }
234
+ return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, O);
235
+ }
236
+ static selection(t) {
237
+ return new e(void 0, O, void 0, void 0, t);
238
+ }
239
+ };
240
+ function D(e, t, n, r) {
241
+ let i = t + 1 > n + 20 ? t - n - 1 : 0, a = e.slice(i, t);
242
+ return a.push(r), a;
243
+ }
244
+ function Ae(e, t) {
245
+ let n = [], r = !1;
246
+ return e.iterChangedRanges((e, t) => n.push(e, t)), t.iterChangedRanges((e, t, i, a) => {
247
+ for (let e = 0; e < n.length;) {
248
+ let t = n[e++], o = n[e++];
249
+ a >= t && i <= o && (r = !0);
250
+ }
251
+ }), r;
252
+ }
253
+ function je(e, t) {
254
+ return e.ranges.length == t.ranges.length && e.ranges.filter((e, n) => e.empty != t.ranges[n].empty).length === 0;
255
+ }
256
+ function Me(e, t) {
257
+ return e.length ? t.length ? e.concat(t) : e : t;
258
+ }
259
+ var O = [], Ne = 200;
260
+ function Pe(e, t) {
261
+ if (e.length) {
262
+ let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length - Ne));
263
+ return r.length && r[r.length - 1].eq(t) ? e : (r.push(t), D(e, e.length - 1, 1e9, n.setSelAfter(r)));
264
+ }
265
+ return [E.selection([t])];
266
+ }
267
+ function Fe(e) {
268
+ let t = e[e.length - 1], n = e.slice();
269
+ return n[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), n;
270
+ }
271
+ function k(e, t) {
272
+ if (!e.length) return e;
273
+ let n = e.length, r = O;
274
+ for (; n;) {
275
+ let i = Ie(e[n - 1], t, r);
276
+ if (i.changes && !i.changes.empty || i.effects.length) {
277
+ let t = e.slice(0, n);
278
+ return t[n - 1] = i, t;
279
+ }
280
+ t = i.mapped, n--, r = i.selectionsAfter;
281
+ }
282
+ return r.length ? [E.selection(r)] : O;
283
+ }
284
+ function Ie(e, t, n) {
285
+ let r = Me(e.selectionsAfter.length ? e.selectionsAfter.map((e) => e.map(t)) : O, n);
286
+ if (!e.changes) return E.selection(r);
287
+ let i = e.changes.map(t), a = t.mapDesc(e.changes, !0), o = e.mapped ? e.mapped.composeDesc(a) : a;
288
+ return new E(i, c.mapEffects(e.effects, t), o, e.startSelection.map(a), r);
289
+ }
290
+ var Le = /^(input\.type|delete)($|\.)/, A = class e {
291
+ constructor(e, t, n = 0, r = void 0) {
292
+ this.done = e, this.undone = t, this.prevTime = n, this.prevUserEvent = r;
293
+ }
294
+ isolate() {
295
+ return this.prevTime ? new e(this.done, this.undone) : this;
296
+ }
297
+ addChanges(t, n, r, i, a) {
298
+ let o = this.done, s = o[o.length - 1];
299
+ return o = s && s.changes && !s.changes.empty && t.changes && (!r || Le.test(r)) && (!s.selectionsAfter.length && n - this.prevTime < i.newGroupDelay && i.joinToEvent(a, Ae(s.changes, t.changes)) || r == "input.type.compose") ? D(o, o.length - 1, i.minDepth, new E(t.changes.compose(s.changes), Me(c.mapEffects(t.effects, s.changes), s.effects), s.mapped, s.startSelection, O)) : D(o, o.length, i.minDepth, t), new e(o, O, n, r);
300
+ }
301
+ addSelection(t, n, r, i) {
302
+ let a = this.done.length ? this.done[this.done.length - 1].selectionsAfter : O;
303
+ return a.length > 0 && n - this.prevTime < i && r == this.prevUserEvent && r && /^select($|\.)/.test(r) && je(a[a.length - 1], t) ? this : new e(Pe(this.done, t), this.undone, n, r);
304
+ }
305
+ addMapping(t) {
306
+ return new e(k(this.done, t), k(this.undone, t), this.prevTime, this.prevUserEvent);
307
+ }
308
+ pop(e, t, n) {
309
+ let r = e == 0 ? this.done : this.undone;
310
+ if (r.length == 0) return null;
311
+ let i = r[r.length - 1], a = i.selectionsAfter[0] || (i.startSelection ? i.startSelection.map(i.changes.invertedDesc, 1) : t.selection);
312
+ if (n && i.selectionsAfter.length) return t.update({
313
+ selection: i.selectionsAfter[i.selectionsAfter.length - 1],
314
+ annotations: S.of({
315
+ side: e,
316
+ rest: Fe(r),
317
+ selection: a
318
+ }),
319
+ userEvent: e == 0 ? "select.undo" : "select.redo",
320
+ scrollIntoView: !0
321
+ });
322
+ if (i.changes) {
323
+ let n = r.length == 1 ? O : r.slice(0, r.length - 1);
324
+ return i.mapped && (n = k(n, i.mapped)), t.update({
325
+ changes: i.changes,
326
+ selection: i.startSelection,
327
+ effects: i.effects,
328
+ annotations: S.of({
329
+ side: e,
330
+ rest: n,
331
+ selection: a
332
+ }),
333
+ filter: !1,
334
+ userEvent: e == 0 ? "undo" : "redo",
335
+ scrollIntoView: !0
336
+ });
337
+ }
338
+ return null;
339
+ }
340
+ };
341
+ A.empty = /*@__PURE__*/ new A(O, O);
342
+ var Re = [
343
+ {
344
+ key: "Mod-z",
345
+ run: xe,
346
+ preventDefault: !0
347
+ },
348
+ {
349
+ key: "Mod-y",
350
+ mac: "Mod-Shift-z",
351
+ run: T,
352
+ preventDefault: !0
353
+ },
354
+ {
355
+ linux: "Ctrl-Shift-z",
356
+ run: T,
357
+ preventDefault: !0
358
+ },
359
+ {
360
+ key: "Mod-u",
361
+ run: Se,
362
+ preventDefault: !0
363
+ },
364
+ {
365
+ key: "Alt-u",
366
+ mac: "Mod-Shift-u",
367
+ run: Ce,
368
+ preventDefault: !0
369
+ }
370
+ ];
371
+ function j(e, n) {
372
+ return t.create(e.ranges.map(n), e.mainIndex);
373
+ }
374
+ function M(e, t) {
375
+ return e.update({
376
+ selection: t,
377
+ scrollIntoView: !0,
378
+ userEvent: "select"
379
+ });
380
+ }
381
+ function N({ state: e, dispatch: t }, n) {
382
+ let r = j(e.selection, n);
383
+ return !r.eq(e.selection, !0) && (t(M(e, r)), !0);
384
+ }
385
+ function P(e, n) {
386
+ return t.cursor(n ? e.to : e.from);
387
+ }
388
+ function F(e, t) {
389
+ return N(e, (n) => n.empty ? e.moveByChar(n, t) : P(n, t));
390
+ }
391
+ function I(e) {
392
+ return e.textDirectionAt(e.state.selection.main.head) == p.LTR;
393
+ }
394
+ var L = (e) => F(e, !I(e)), ze = (e) => F(e, I(e)), Be = (e) => F(e, !0), Ve = (e) => F(e, !1);
395
+ function He(n, r, i) {
396
+ let a = r.head, o = n.doc.lineAt(a);
397
+ return a = a == (i ? o.to : o.from) ? i ? Math.min(n.doc.length, o.to + 1) : Math.max(0, o.from - 1) : o.from + e(o.text, a - o.from, i), t.cursor(a, i ? -1 : 1);
398
+ }
399
+ function Ue(e, t) {
400
+ return N(e, (n) => n.empty ? He(e.state, n, t) : P(n, t));
401
+ }
402
+ var We = (e) => Ue(e, !0), Ge = (e) => Ue(e, !1);
403
+ function R(e, t) {
404
+ return N(e, (n) => n.empty ? e.moveByGroup(n, t) : P(n, t));
405
+ }
406
+ var Ke = (e) => R(e, !I(e)), qe = (e) => R(e, I(e)), Je = (e) => R(e, !0), Ye = (e) => R(e, !1);
407
+ function Xe(e, t, n) {
408
+ let r = e.state.charCategorizer(t), i = r(n), o = i != a.Space;
409
+ return (e) => {
410
+ let t = r(e);
411
+ return t == a.Space ? (o = !1, !0) : o && t == i;
412
+ };
413
+ }
414
+ var Ze = (e) => N(e, (t) => t.empty ? e.moveByChar(t, !0, (n) => Xe(e, t.head, n)) : P(t, !0)), Qe = typeof Intl < "u" && Intl.Segmenter ? /*@__PURE__*/ new Intl.Segmenter(void 0, { granularity: "word" }) : null;
415
+ function $e(e, n, r) {
416
+ let i = e.state.charCategorizer(n.from), o = a.Space, s = n.from, c = 0, l = !1, u = !1, d = !1, f = (t) => {
417
+ if (l) return !1;
418
+ s += r ? t.length : -t.length;
419
+ let n = i(t), f;
420
+ if (n == a.Word && t.charCodeAt(0) < 128 && /[\W_]/.test(t) && (n = -1), o == a.Space && (o = n), o != n) return !1;
421
+ if (o == a.Word) {
422
+ if (t.toLowerCase() == t) {
423
+ if (!r && u) return !1;
424
+ d = !0;
425
+ } else if (d) {
426
+ if (r) return !1;
427
+ l = !0;
428
+ } else {
429
+ if (u && r && i(f = e.state.sliceDoc(s, s + 1)) == a.Word && f.toLowerCase() == f) return !1;
430
+ u = !0;
431
+ }
432
+ }
433
+ return c++, !0;
434
+ }, p = e.moveByChar(n, r, (e) => (f(e), f));
435
+ if (Qe && o == a.Word && p.from == n.from + c * (r ? 1 : -1)) {
436
+ let i = Math.min(n.head, p.head), a = Math.max(n.head, p.head), o = e.state.sliceDoc(i, a);
437
+ if (o.length > 1 && /[\u4E00-\uffff]/.test(o)) {
438
+ let e = Array.from(Qe.segment(o));
439
+ if (e.length > 1) return r ? t.cursor(n.head + e[1].index, -1) : t.cursor(p.head + e[e.length - 1].index, 1);
440
+ }
441
+ }
442
+ return p;
443
+ }
444
+ function et(e, t) {
445
+ return N(e, (n) => n.empty ? $e(e, n, t) : P(n, t));
446
+ }
447
+ var tt = (e) => et(e, !0), nt = (e) => et(e, !1);
448
+ function rt(e, t, n) {
449
+ if (t.type.prop(n)) return !0;
450
+ let r = t.to - t.from;
451
+ return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
452
+ }
453
+ function z(e, n, r) {
454
+ let i = te(e).resolveInner(n.head), a = r ? v.closedBy : v.openedBy;
455
+ for (let t = n.head;;) {
456
+ let n = r ? i.childAfter(t) : i.childBefore(t);
457
+ if (!n) break;
458
+ rt(e, n, a) ? i = n : t = r ? n.to : n.from;
459
+ }
460
+ let o = i.type.prop(a), s, c;
461
+ return c = o && (s = r ? _(e, i.from, 1) : _(e, i.to, -1)) && s.matched ? r ? s.end.to : s.end.from : r ? i.to : i.from, t.cursor(c, r ? -1 : 1);
462
+ }
463
+ var it = (e) => N(e, (t) => z(e.state, t, !I(e))), at = (e) => N(e, (t) => z(e.state, t, I(e)));
464
+ function ot(e, t) {
465
+ return N(e, (n) => {
466
+ if (!n.empty) return P(n, t);
467
+ let r = e.moveVertically(n, t);
468
+ return r.head == n.head ? e.moveToLineBoundary(n, t) : r;
469
+ });
470
+ }
471
+ var B = (e) => ot(e, !1), V = (e) => ot(e, !0);
472
+ function st(e) {
473
+ let t = e.scrollDOM.clientHeight < e.scrollDOM.scrollHeight - 2, n = 0, r = 0, i;
474
+ if (t) {
475
+ for (let t of e.state.facet(m.scrollMargins)) {
476
+ let i = t(e);
477
+ i?.top && (n = Math.max(i?.top, n)), i?.bottom && (r = Math.max(i?.bottom, r));
478
+ }
479
+ i = e.scrollDOM.clientHeight - n - r;
480
+ } else i = (e.dom.ownerDocument.defaultView || window).innerHeight;
481
+ return {
482
+ marginTop: n,
483
+ marginBottom: r,
484
+ selfScroll: t,
485
+ height: Math.max(e.defaultLineHeight, i - 5)
486
+ };
487
+ }
488
+ function ct(e, t) {
489
+ let n = st(e), { state: r } = e, i = j(r.selection, (r) => r.empty ? e.moveVertically(r, t, n.height) : P(r, t));
490
+ if (i.eq(r.selection)) return !1;
491
+ let a;
492
+ if (n.selfScroll) {
493
+ let t = e.coordsAtPos(r.selection.main.head), o = e.scrollDOM.getBoundingClientRect(), s = o.top + n.marginTop, c = o.bottom - n.marginBottom;
494
+ t && t.top > s && t.bottom < c && (a = m.scrollIntoView(i.main.head, {
495
+ y: "start",
496
+ yMargin: t.top - s
497
+ }));
498
+ }
499
+ return e.dispatch(M(r, i), { effects: a }), !0;
500
+ }
501
+ var H = (e) => ct(e, !1), U = (e) => ct(e, !0);
502
+ function W(e, n, r) {
503
+ let i = e.lineBlockAt(n.head), a = e.moveToLineBoundary(n, r);
504
+ if (a.head == n.head && a.head != (r ? i.to : i.from) && (a = e.moveToLineBoundary(n, r, !1)), !r && a.head == i.from && i.length) {
505
+ let r = /^\s*/.exec(e.state.sliceDoc(i.from, Math.min(i.from + 100, i.to)))[0].length;
506
+ r && n.head != i.from + r && (a = t.cursor(i.from + r));
507
+ }
508
+ return a;
509
+ }
510
+ var lt = (e) => N(e, (t) => W(e, t, !0)), ut = (e) => N(e, (t) => W(e, t, !1)), dt = (e) => N(e, (t) => W(e, t, !I(e))), ft = (e) => N(e, (t) => W(e, t, I(e))), pt = (e) => N(e, (n) => t.cursor(e.lineBlockAt(n.head).from, 1)), mt = (e) => N(e, (n) => t.cursor(e.lineBlockAt(n.head).to, -1));
511
+ function ht(e, n, r) {
512
+ let i = !1, a = j(e.selection, (n) => {
513
+ let a = _(e, n.head, -1) || _(e, n.head, 1) || n.head > 0 && _(e, n.head - 1, 1) || n.head < e.doc.length && _(e, n.head + 1, -1);
514
+ if (!a || !a.end) return n;
515
+ i = !0;
516
+ let o = a.start.from == n.head ? a.end.to : a.end.from;
517
+ return r ? t.range(n.anchor, o) : t.cursor(o);
518
+ });
519
+ return i ? (n(M(e, a)), !0) : !1;
520
+ }
521
+ var gt = ({ state: e, dispatch: t }) => ht(e, t, !1), _t = ({ state: e, dispatch: t }) => ht(e, t, !0);
522
+ function G(e, n, r) {
523
+ let i = j(e.state.selection, (e) => {
524
+ e.undirectional && e.head >= e.anchor != n && (e = t.range(e.head, e.anchor));
525
+ let i = r(e);
526
+ return t.range(e.anchor, i.head, i.goalColumn, i.bidiLevel || void 0, i.assoc);
527
+ });
528
+ return !i.eq(e.state.selection) && (e.dispatch(M(e.state, i)), !0);
529
+ }
530
+ function K(e, t) {
531
+ return G(e, t, (n) => e.moveByChar(n, t));
532
+ }
533
+ var q = (e) => K(e, !I(e)), vt = (e) => K(e, I(e)), yt = (e) => K(e, !0), bt = (e) => K(e, !1), xt = (e) => G(e, !0, (t) => He(e.state, t, !0)), St = (e) => G(e, !1, (t) => He(e.state, t, !1));
534
+ function J(e, t) {
535
+ return G(e, t, (n) => e.moveByGroup(n, t));
536
+ }
537
+ var Ct = (e) => J(e, !I(e)), wt = (e) => J(e, I(e)), Tt = (e) => J(e, !0), Et = (e) => J(e, !1), Dt = (e) => G(e, !0, (t) => e.moveByChar(t, !0, (n) => Xe(e, t.head, n)));
538
+ function Ot(e, t) {
539
+ return G(e, t, (n) => $e(e, n, t));
540
+ }
541
+ var kt = (e) => Ot(e, !0), At = (e) => Ot(e, !1), jt = (e) => {
542
+ let t = !I(e);
543
+ return G(e, t, (n) => z(e.state, n, t));
544
+ }, Mt = (e) => {
545
+ let t = I(e);
546
+ return G(e, t, (n) => z(e.state, n, t));
547
+ };
548
+ function Nt(e, t) {
549
+ return G(e, t, (n) => e.moveVertically(n, t));
550
+ }
551
+ var Pt = (e) => Nt(e, !1), Ft = (e) => Nt(e, !0);
552
+ function It(e, t) {
553
+ return G(e, t, (n) => e.moveVertically(n, t, st(e).height));
554
+ }
555
+ var Lt = (e) => It(e, !1), Rt = (e) => It(e, !0), zt = (e) => G(e, !0, (t) => W(e, t, !0)), Bt = (e) => G(e, !1, (t) => W(e, t, !1)), Vt = (e) => {
556
+ let t = !I(e);
557
+ return G(e, t, (n) => W(e, n, t));
558
+ }, Ht = (e) => {
559
+ let t = I(e);
560
+ return G(e, t, (n) => W(e, n, t));
561
+ }, Ut = (e) => G(e, !1, (n) => t.cursor(e.lineBlockAt(n.head).from)), Wt = (e) => G(e, !0, (n) => t.cursor(e.lineBlockAt(n.head).to)), Gt = ({ state: e, dispatch: t }) => (t(M(e, { anchor: 0 })), !0), Kt = ({ state: e, dispatch: t }) => (t(M(e, { anchor: e.doc.length })), !0), qt = ({ state: e, dispatch: t }) => (t(M(e, {
562
+ anchor: e.selection.main.anchor,
563
+ head: 0
564
+ })), !0), Jt = ({ state: e, dispatch: t }) => (t(M(e, {
565
+ anchor: e.selection.main.anchor,
566
+ head: e.doc.length
567
+ })), !0), Yt = ({ state: e, dispatch: t }) => (t(e.update({
568
+ selection: {
569
+ anchor: 0,
570
+ head: e.doc.length
571
+ },
572
+ userEvent: "select"
573
+ })), !0), Xt = ({ state: e, dispatch: n }) => {
574
+ let r = Q(e).map(({ from: n, to: r }) => t.undirectionalRange(n, Math.min(r + 1, e.doc.length)));
575
+ return n(e.update({
576
+ selection: t.create(r),
577
+ userEvent: "select"
578
+ })), !0;
579
+ }, Zt = ({ state: e, dispatch: n }) => {
580
+ let r = j(e.selection, (n) => {
581
+ let r = te(e), i = r.resolveStack(n.from, 1);
582
+ if (n.empty) {
583
+ let e = r.resolveStack(n.from, -1);
584
+ e.node.from >= i.node.from && e.node.to <= i.node.to && (i = e);
585
+ }
586
+ for (let e = i; e; e = e.next) {
587
+ let { node: r } = e;
588
+ if ((r.from < n.from && r.to >= n.to || r.to > n.to && r.from <= n.from) && e.next) return t.undirectionalRange(r.from, r.to);
589
+ }
590
+ return n;
591
+ });
592
+ return !r.eq(e.selection) && (n(M(e, r)), !0);
593
+ };
594
+ function Qt(e, n) {
595
+ let { state: r } = e, i = r.selection, a = r.selection.ranges.slice();
596
+ for (let t of r.selection.ranges) {
597
+ let i = r.doc.lineAt(t.head);
598
+ if (n ? i.to < e.state.doc.length : i.from > 0) for (let r = t;;) {
599
+ let t = e.moveVertically(r, n);
600
+ if (t.head < i.from || t.head > i.to) {
601
+ a.some((e) => e.head == t.head) || a.push(t);
602
+ break;
603
+ }
604
+ if (t.head == r.head) break;
605
+ r = t;
606
+ }
607
+ }
608
+ return a.length != i.ranges.length && (e.dispatch(M(r, t.create(a, a.length - 1))), !0);
609
+ }
610
+ var $t = (e) => Qt(e, !1), en = (e) => Qt(e, !0), tn = ({ state: e, dispatch: n }) => {
611
+ let r = e.selection, i = null;
612
+ return r.ranges.length > 1 ? i = t.create([r.main]) : r.main.empty || (i = t.create([t.cursor(r.main.head)])), i ? (n(M(e, i)), !0) : !1;
613
+ };
614
+ function Y(e, n) {
615
+ if (e.state.readOnly) return !1;
616
+ let r = "delete.selection", { state: i } = e, a = i.changeByRange((i) => {
617
+ let { from: a, to: o } = i;
618
+ if (a == o) {
619
+ let t = n(i);
620
+ t < a ? (r = "delete.backward", t = X(e, t, !1)) : t > a && (r = "delete.forward", t = X(e, t, !0)), a = Math.min(a, t), o = Math.max(o, t);
621
+ } else a = X(e, a, !1), o = X(e, o, !0);
622
+ return a == o ? { range: i } : {
623
+ changes: {
624
+ from: a,
625
+ to: o
626
+ },
627
+ range: t.cursor(a, a < i.head ? -1 : 1)
628
+ };
629
+ });
630
+ return !a.changes.empty && (e.dispatch(i.update(a, {
631
+ scrollIntoView: !0,
632
+ userEvent: r,
633
+ effects: r == "delete.selection" ? m.announce.of(i.phrase("Selection deleted")) : void 0
634
+ })), !0);
635
+ }
636
+ function X(e, t, n) {
637
+ if (e instanceof m) for (let r of e.state.facet(m.atomicRanges).map((t) => t(e))) r.between(t, t, (e, r) => {
638
+ e < t && r > t && (t = n ? r : e);
639
+ });
640
+ return t;
641
+ }
642
+ var nn = (t, r, i) => Y(t, (a) => {
643
+ let o = a.from, { state: s } = t, c = s.doc.lineAt(o), l, u;
644
+ if (i && !r && o > c.from && o < c.from + 200 && !/[^ \t]/.test(l = c.text.slice(0, o - c.from))) {
645
+ if (l[l.length - 1] == " ") return o - 1;
646
+ let e = n(l, s.tabSize) % g(s) || g(s);
647
+ for (let t = 0; t < e && l[l.length - 1 - t] == " "; t++) o--;
648
+ u = o;
649
+ } else u = e(c.text, o - c.from, r, r) + c.from, u == o && c.number != (r ? s.doc.lines : 1) ? u += r ? 1 : -1 : !r && /[\ufe00-\ufe0f]/.test(c.text.slice(u - c.from, o - c.from)) && (u = e(c.text, u - c.from, !1, !1) + c.from);
650
+ return u;
651
+ }), Z = (e) => nn(e, !1, !0), rn = (e) => nn(e, !1, !1), an = (e) => nn(e, !0, !1), on = (t, n) => Y(t, (r) => {
652
+ let i = r.head, { state: a } = t, o = a.doc.lineAt(i), s = a.charCategorizer(i);
653
+ for (let t = null;;) {
654
+ if (i == (n ? o.to : o.from)) {
655
+ i == r.head && o.number != (n ? a.doc.lines : 1) && (i += n ? 1 : -1);
656
+ break;
657
+ }
658
+ let c = e(o.text, i - o.from, n) + o.from, l = o.text.slice(Math.min(i, c) - o.from, Math.max(i, c) - o.from), u = s(l);
659
+ if (t != null && u != t) break;
660
+ (l != " " || i != r.head) && (t = u), i = c;
661
+ }
662
+ return i;
663
+ }), sn = (e) => on(e, !1), cn = (e) => on(e, !0), ln = (e) => Y(e, (t) => e.moveByChar(t, !0, (n) => Xe(e, t.head, n)).head), un = (e) => Y(e, (t) => {
664
+ let n = e.lineBlockAt(t.head).to;
665
+ return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
666
+ }), dn = (e) => Y(e, (t) => {
667
+ let n = e.lineBlockAt(t.head).from;
668
+ return t.head > n ? n : Math.max(0, t.head - 1);
669
+ }), fn = (e) => Y(e, (t) => {
670
+ let n = e.moveToLineBoundary(t, !1).head;
671
+ return t.head > n ? n : Math.max(0, t.head - 1);
672
+ }), pn = (e) => Y(e, (t) => {
673
+ let n = e.moveToLineBoundary(t, !0).head;
674
+ return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
675
+ }), mn = ({ state: e, dispatch: t }) => {
676
+ if (e.readOnly) return !1;
677
+ let n = [];
678
+ for (let t = 0, r = "", i = e.doc.iter();;) {
679
+ if (i.next(), i.lineBreak || i.done) {
680
+ let e = r.search(/\s+$/);
681
+ if (e > -1 && n.push({
682
+ from: t - (r.length - e),
683
+ to: t
684
+ }), i.done) break;
685
+ r = "";
686
+ } else r = i.value;
687
+ t += i.value.length;
688
+ }
689
+ return n.length ? (t(e.update({
690
+ changes: n,
691
+ userEvent: "delete"
692
+ })), !0) : !1;
693
+ }, hn = ({ state: e, dispatch: n }) => {
694
+ if (e.readOnly) return !1;
695
+ let r = e.changeByRange((e) => ({
696
+ changes: {
697
+ from: e.from,
698
+ to: e.to,
699
+ insert: i.of(["", ""])
700
+ },
701
+ range: t.cursor(e.from)
702
+ }));
703
+ return n(e.update(r, {
704
+ scrollIntoView: !0,
705
+ userEvent: "input"
706
+ })), !0;
707
+ }, gn = ({ state: n, dispatch: r }) => {
708
+ if (n.readOnly) return !1;
709
+ let i = n.changeByRange((r) => {
710
+ if (!r.empty || r.from == 0 || r.from == n.doc.length) return { range: r };
711
+ let i = r.from, a = n.doc.lineAt(i), o = i == a.from ? i - 1 : e(a.text, i - a.from, !1) + a.from, s = i == a.to ? i + 1 : e(a.text, i - a.from, !0) + a.from;
712
+ return {
713
+ changes: {
714
+ from: o,
715
+ to: s,
716
+ insert: n.doc.slice(i, s).append(n.doc.slice(o, i))
717
+ },
718
+ range: t.cursor(s)
719
+ };
720
+ });
721
+ return !i.changes.empty && (r(n.update(i, {
722
+ scrollIntoView: !0,
723
+ userEvent: "move.character"
724
+ })), !0);
725
+ };
726
+ function Q(e) {
727
+ let t = [], n = -1;
728
+ for (let r of e.selection.ranges) {
729
+ let i = e.doc.lineAt(r.from), a = e.doc.lineAt(r.to);
730
+ if (!r.empty && r.to == a.from && (a = e.doc.lineAt(r.to - 1)), n >= i.number) {
731
+ let e = t[t.length - 1];
732
+ e.to = a.to, e.ranges.push(r);
733
+ } else t.push({
734
+ from: i.from,
735
+ to: a.to,
736
+ ranges: [r]
737
+ });
738
+ n = a.number + 1;
739
+ }
740
+ return t;
741
+ }
742
+ function _n(e, n, r) {
743
+ if (e.readOnly) return !1;
744
+ let i = [], a = [];
745
+ for (let n of Q(e)) {
746
+ if (r ? n.to == e.doc.length : n.from == 0) continue;
747
+ let o = e.doc.lineAt(r ? n.to + 1 : n.from - 1), s = o.length + 1;
748
+ if (r) {
749
+ i.push({
750
+ from: n.to,
751
+ to: o.to
752
+ }, {
753
+ from: n.from,
754
+ insert: o.text + e.lineBreak
755
+ });
756
+ for (let r of n.ranges) a.push(t.range(Math.min(e.doc.length, r.anchor + s), Math.min(e.doc.length, r.head + s)));
757
+ } else {
758
+ i.push({
759
+ from: o.from,
760
+ to: n.from
761
+ }, {
762
+ from: n.to,
763
+ insert: e.lineBreak + o.text
764
+ });
765
+ for (let e of n.ranges) a.push(t.range(e.anchor - s, e.head - s));
766
+ }
767
+ }
768
+ return i.length ? (n(e.update({
769
+ changes: i,
770
+ scrollIntoView: !0,
771
+ selection: t.create(a, e.selection.mainIndex),
772
+ userEvent: "move.line"
773
+ })), !0) : !1;
774
+ }
775
+ var vn = ({ state: e, dispatch: t }) => _n(e, t, !1), yn = ({ state: e, dispatch: t }) => _n(e, t, !0);
776
+ function bn(e, t, n) {
777
+ if (e.readOnly) return !1;
778
+ let r = [];
779
+ for (let t of Q(e)) n ? r.push({
780
+ from: t.from,
781
+ insert: e.doc.slice(t.from, t.to) + e.lineBreak
782
+ }) : r.push({
783
+ from: t.to,
784
+ insert: e.lineBreak + e.doc.slice(t.from, t.to)
785
+ });
786
+ let i = e.changes(r);
787
+ return t(e.update({
788
+ changes: i,
789
+ selection: e.selection.map(i, n ? 1 : -1),
790
+ scrollIntoView: !0,
791
+ userEvent: "input.copyline"
792
+ })), !0;
793
+ }
794
+ var xn = ({ state: e, dispatch: t }) => bn(e, t, !1), Sn = ({ state: e, dispatch: t }) => bn(e, t, !0), Cn = (e) => {
795
+ if (e.state.readOnly) return !1;
796
+ let { state: t } = e, n = t.changes(Q(t).map(({ from: e, to: n }) => (e > 0 ? e-- : n < t.doc.length && n++, {
797
+ from: e,
798
+ to: n
799
+ }))), r = j(t.selection, (t) => {
800
+ let n;
801
+ if (e.lineWrapping) {
802
+ let r = e.lineBlockAt(t.head), i = e.coordsAtPos(t.head, t.assoc || 1);
803
+ i && (n = r.bottom + e.documentTop - i.bottom + e.defaultLineHeight / 2);
804
+ }
805
+ return e.moveVertically(t, !0, n);
806
+ }).map(n);
807
+ return e.dispatch({
808
+ changes: n,
809
+ selection: r,
810
+ scrollIntoView: !0,
811
+ userEvent: "delete.line"
812
+ }), !0;
813
+ }, wn = ({ state: e, dispatch: t }) => (t(e.update(e.replaceSelection(e.lineBreak), {
814
+ scrollIntoView: !0,
815
+ userEvent: "input"
816
+ })), !0), Tn = ({ state: e, dispatch: n }) => (n(e.update(e.changeByRange((n) => {
817
+ let r = /^\s*/.exec(e.doc.lineAt(n.from).text)[0];
818
+ return {
819
+ changes: {
820
+ from: n.from,
821
+ to: n.to,
822
+ insert: e.lineBreak + r
823
+ },
824
+ range: t.cursor(n.from + r.length + 1)
825
+ };
826
+ }), {
827
+ scrollIntoView: !0,
828
+ userEvent: "input"
829
+ })), !0);
830
+ function En(e, t) {
831
+ if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1))) return {
832
+ from: t,
833
+ to: t
834
+ };
835
+ let n = te(e).resolveInner(t), r = n.childBefore(t), i = n.childAfter(t), a;
836
+ return r && i && r.to <= t && i.from >= t && (a = r.type.prop(v.closedBy)) && a.indexOf(i.name) > -1 && e.doc.lineAt(r.to).from == e.doc.lineAt(i.from).from && !/\S/.test(e.sliceDoc(r.to, i.from)) ? {
837
+ from: r.to,
838
+ to: i.from
839
+ } : null;
840
+ }
841
+ var Dn = /*@__PURE__*/ kn(!1), On = /*@__PURE__*/ kn(!0);
842
+ function kn(e) {
843
+ return ({ state: r, dispatch: a }) => {
844
+ if (r.readOnly) return !1;
845
+ let o = r.changeByRange((a) => {
846
+ let { from: o, to: s } = a, c = r.doc.lineAt(o), l = !e && o == s && En(r, o);
847
+ e && (o = s = (s <= c.to ? c : r.doc.lineAt(s)).to);
848
+ let u = new ne(r, {
849
+ simulateBreak: o,
850
+ simulateDoubleBreak: !!l
851
+ }), d = re(u, o);
852
+ for (d ??= n(/^\s*/.exec(r.doc.lineAt(o).text)[0], r.tabSize); s < c.to && /\s/.test(c.text[s - c.from]);) s++;
853
+ l ? {from: o, to: s} = l : o > c.from && o < c.from + 100 && !/\S/.test(c.text.slice(0, o)) && (o = c.from);
854
+ let f = ["", h(r, d)];
855
+ return l && f.push(h(r, u.lineIndent(c.from, -1))), {
856
+ changes: {
857
+ from: o,
858
+ to: s,
859
+ insert: i.of(f)
860
+ },
861
+ range: t.cursor(o + 1 + f[1].length)
862
+ };
863
+ });
864
+ return a(r.update(o, {
865
+ scrollIntoView: !0,
866
+ userEvent: "input"
867
+ })), !0;
868
+ };
869
+ }
870
+ function An(e, n) {
871
+ let r = -1;
872
+ return e.changeByRange((i) => {
873
+ let a = [];
874
+ for (let t = i.from; t <= i.to;) {
875
+ let o = e.doc.lineAt(t);
876
+ o.number > r && (i.empty || i.to > o.from) && (n(o, a, i), r = o.number), t = o.to + 1;
877
+ }
878
+ let o = e.changes(a);
879
+ return {
880
+ changes: a,
881
+ range: t.range(o.mapPos(i.anchor, 1), o.mapPos(i.head, 1))
882
+ };
883
+ });
884
+ }
885
+ var jn = ({ state: e, dispatch: t }) => {
886
+ if (e.readOnly) return !1;
887
+ let n = Object.create(null), r = new ne(e, { overrideIndentation: (e) => n[e] ?? -1 }), i = An(e, (t, i, a) => {
888
+ let o = re(r, t.from);
889
+ if (o == null) return;
890
+ /\S/.test(t.text) || (o = 0);
891
+ let s = /^\s*/.exec(t.text)[0], c = h(e, o);
892
+ (s != c || a.from < t.from + s.length) && (n[t.from] = o, i.push({
893
+ from: t.from,
894
+ to: t.from + s.length,
895
+ insert: c
896
+ }));
897
+ });
898
+ return i.changes.empty || t(e.update(i, { userEvent: "indent" })), !0;
899
+ }, $ = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(An(e, (t, n) => {
900
+ n.push({
901
+ from: t.from,
902
+ insert: e.facet(ee)
903
+ });
904
+ }), { userEvent: "input.indent" })), !0), Mn = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(An(e, (t, r) => {
905
+ let i = /^\s*/.exec(t.text)[0];
906
+ if (!i) return;
907
+ let a = n(i, e.tabSize), o = 0, s = h(e, Math.max(0, a - g(e)));
908
+ for (; o < i.length && o < s.length && i.charCodeAt(o) == s.charCodeAt(o);) o++;
909
+ r.push({
910
+ from: t.from + o,
911
+ to: t.from + i.length,
912
+ insert: s.slice(o)
913
+ });
914
+ }), { userEvent: "delete.dedent" })), !0), Nn = (e) => (e.setTabFocusMode(), !0), Pn = (e) => (e.setTabFocusMode(2e3), !0), Fn = ({ state: e, dispatch: t }) => e.selection.ranges.some((e) => !e.empty) ? $({
915
+ state: e,
916
+ dispatch: t
917
+ }) : (t(e.update(e.replaceSelection(" "), {
918
+ scrollIntoView: !0,
919
+ userEvent: "input"
920
+ })), !0), In = [
921
+ {
922
+ key: "Ctrl-b",
923
+ run: L,
924
+ shift: q,
925
+ preventDefault: !0
926
+ },
927
+ {
928
+ key: "Ctrl-f",
929
+ run: ze,
930
+ shift: vt
931
+ },
932
+ {
933
+ key: "Ctrl-p",
934
+ run: B,
935
+ shift: Pt
936
+ },
937
+ {
938
+ key: "Ctrl-n",
939
+ run: V,
940
+ shift: Ft
941
+ },
942
+ {
943
+ key: "Ctrl-a",
944
+ run: pt,
945
+ shift: Ut
946
+ },
947
+ {
948
+ key: "Ctrl-e",
949
+ run: mt,
950
+ shift: Wt
951
+ },
952
+ {
953
+ key: "Ctrl-d",
954
+ run: an
955
+ },
956
+ {
957
+ key: "Ctrl-h",
958
+ run: Z
959
+ },
960
+ {
961
+ key: "Ctrl-k",
962
+ run: un
963
+ },
964
+ {
965
+ key: "Ctrl-Alt-h",
966
+ run: sn
967
+ },
968
+ {
969
+ key: "Ctrl-o",
970
+ run: hn
971
+ },
972
+ {
973
+ key: "Ctrl-t",
974
+ run: gn
975
+ },
976
+ {
977
+ key: "Ctrl-v",
978
+ run: U
979
+ }
980
+ ], Ln = /*@__PURE__*/ [
981
+ {
982
+ key: "ArrowLeft",
983
+ run: L,
984
+ shift: q,
985
+ preventDefault: !0
986
+ },
987
+ {
988
+ key: "Mod-ArrowLeft",
989
+ mac: "Alt-ArrowLeft",
990
+ run: Ke,
991
+ shift: Ct,
992
+ preventDefault: !0
993
+ },
994
+ {
995
+ mac: "Cmd-ArrowLeft",
996
+ run: dt,
997
+ shift: Vt,
998
+ preventDefault: !0
999
+ },
1000
+ {
1001
+ key: "ArrowRight",
1002
+ run: ze,
1003
+ shift: vt,
1004
+ preventDefault: !0
1005
+ },
1006
+ {
1007
+ key: "Mod-ArrowRight",
1008
+ mac: "Alt-ArrowRight",
1009
+ run: qe,
1010
+ shift: wt,
1011
+ preventDefault: !0
1012
+ },
1013
+ {
1014
+ mac: "Cmd-ArrowRight",
1015
+ run: ft,
1016
+ shift: Ht,
1017
+ preventDefault: !0
1018
+ },
1019
+ {
1020
+ key: "ArrowUp",
1021
+ run: B,
1022
+ shift: Pt,
1023
+ preventDefault: !0
1024
+ },
1025
+ {
1026
+ mac: "Cmd-ArrowUp",
1027
+ run: Gt,
1028
+ shift: qt
1029
+ },
1030
+ {
1031
+ mac: "Ctrl-ArrowUp",
1032
+ run: H,
1033
+ shift: Lt
1034
+ },
1035
+ {
1036
+ key: "ArrowDown",
1037
+ run: V,
1038
+ shift: Ft,
1039
+ preventDefault: !0
1040
+ },
1041
+ {
1042
+ mac: "Cmd-ArrowDown",
1043
+ run: Kt,
1044
+ shift: Jt
1045
+ },
1046
+ {
1047
+ mac: "Ctrl-ArrowDown",
1048
+ run: U,
1049
+ shift: Rt
1050
+ },
1051
+ {
1052
+ key: "PageUp",
1053
+ run: H,
1054
+ shift: Lt
1055
+ },
1056
+ {
1057
+ key: "PageDown",
1058
+ run: U,
1059
+ shift: Rt
1060
+ },
1061
+ {
1062
+ key: "Home",
1063
+ run: ut,
1064
+ shift: Bt,
1065
+ preventDefault: !0
1066
+ },
1067
+ {
1068
+ key: "Mod-Home",
1069
+ run: Gt,
1070
+ shift: qt
1071
+ },
1072
+ {
1073
+ key: "End",
1074
+ run: lt,
1075
+ shift: zt,
1076
+ preventDefault: !0
1077
+ },
1078
+ {
1079
+ key: "Mod-End",
1080
+ run: Kt,
1081
+ shift: Jt
1082
+ },
1083
+ {
1084
+ key: "Enter",
1085
+ run: Dn,
1086
+ shift: Dn
1087
+ },
1088
+ {
1089
+ key: "Mod-a",
1090
+ run: Yt
1091
+ },
1092
+ {
1093
+ key: "Backspace",
1094
+ run: Z,
1095
+ shift: Z,
1096
+ preventDefault: !0
1097
+ },
1098
+ {
1099
+ key: "Delete",
1100
+ run: an,
1101
+ preventDefault: !0
1102
+ },
1103
+ {
1104
+ key: "Mod-Backspace",
1105
+ mac: "Alt-Backspace",
1106
+ run: sn,
1107
+ preventDefault: !0
1108
+ },
1109
+ {
1110
+ key: "Mod-Delete",
1111
+ mac: "Alt-Delete",
1112
+ run: cn,
1113
+ preventDefault: !0
1114
+ },
1115
+ {
1116
+ mac: "Mod-Backspace",
1117
+ run: fn,
1118
+ preventDefault: !0
1119
+ },
1120
+ {
1121
+ mac: "Mod-Delete",
1122
+ run: pn,
1123
+ preventDefault: !0
1124
+ }
1125
+ ].concat(/*@__PURE__*/ In.map((e) => ({
1126
+ mac: e.key,
1127
+ run: e.run,
1128
+ shift: e.shift
1129
+ }))), Rn = /*@__PURE__*/ [
1130
+ {
1131
+ key: "Alt-ArrowLeft",
1132
+ mac: "Ctrl-ArrowLeft",
1133
+ run: it,
1134
+ shift: jt
1135
+ },
1136
+ {
1137
+ key: "Alt-ArrowRight",
1138
+ mac: "Ctrl-ArrowRight",
1139
+ run: at,
1140
+ shift: Mt
1141
+ },
1142
+ {
1143
+ key: "Alt-ArrowUp",
1144
+ run: vn
1145
+ },
1146
+ {
1147
+ key: "Shift-Alt-ArrowUp",
1148
+ run: xn
1149
+ },
1150
+ {
1151
+ key: "Alt-ArrowDown",
1152
+ run: yn
1153
+ },
1154
+ {
1155
+ key: "Shift-Alt-ArrowDown",
1156
+ run: Sn
1157
+ },
1158
+ {
1159
+ key: "Mod-Alt-ArrowUp",
1160
+ run: $t
1161
+ },
1162
+ {
1163
+ key: "Mod-Alt-ArrowDown",
1164
+ run: en
1165
+ },
1166
+ {
1167
+ key: "Escape",
1168
+ run: tn
1169
+ },
1170
+ {
1171
+ key: "Mod-Enter",
1172
+ run: On
1173
+ },
1174
+ {
1175
+ key: "Alt-l",
1176
+ mac: "Ctrl-l",
1177
+ run: Xt
1178
+ },
1179
+ {
1180
+ key: "Mod-i",
1181
+ run: Zt,
1182
+ preventDefault: !0
1183
+ },
1184
+ {
1185
+ key: "Mod-[",
1186
+ run: Mn
1187
+ },
1188
+ {
1189
+ key: "Mod-]",
1190
+ run: $
1191
+ },
1192
+ {
1193
+ key: "Mod-Alt-\\",
1194
+ run: jn
1195
+ },
1196
+ {
1197
+ key: "Shift-Mod-k",
1198
+ run: Cn
1199
+ },
1200
+ {
1201
+ key: "Shift-Mod-\\",
1202
+ run: gt
1203
+ },
1204
+ {
1205
+ key: "Mod-/",
1206
+ run: ie
1207
+ },
1208
+ {
1209
+ key: "Alt-A",
1210
+ mac: "Ctrl-A",
1211
+ run: ce
1212
+ },
1213
+ {
1214
+ key: "Ctrl-m",
1215
+ mac: "Shift-Alt-m",
1216
+ run: Nn
1217
+ }
1218
+ ].concat(Ln), zn = {
1219
+ key: "Tab",
1220
+ run: $,
1221
+ shift: Mn
1222
+ };
1223
+ //#endregion
1224
+ export { $t as addCursorAbove, en as addCursorBelow, le as blockComment, ue as blockUncomment, ke as canRedoSelection, Oe as canUndoSelection, Sn as copyLineDown, xn as copyLineUp, Ve as cursorCharBackward, Ge as cursorCharBackwardLogical, Be as cursorCharForward, We as cursorCharForwardLogical, L as cursorCharLeft, ze as cursorCharRight, Kt as cursorDocEnd, Gt as cursorDocStart, Ye as cursorGroupBackward, Je as cursorGroupForward, Ze as cursorGroupForwardWin, Ke as cursorGroupLeft, qe as cursorGroupRight, ut as cursorLineBoundaryBackward, lt as cursorLineBoundaryForward, dt as cursorLineBoundaryLeft, ft as cursorLineBoundaryRight, V as cursorLineDown, mt as cursorLineEnd, pt as cursorLineStart, B as cursorLineUp, gt as cursorMatchingBracket, U as cursorPageDown, H as cursorPageUp, nt as cursorSubwordBackward, tt as cursorSubwordForward, it as cursorSyntaxLeft, at as cursorSyntaxRight, Rn as defaultKeymap, Z as deleteCharBackward, rn as deleteCharBackwardStrict, an as deleteCharForward, sn as deleteGroupBackward, cn as deleteGroupForward, ln as deleteGroupForwardWin, Cn as deleteLine, fn as deleteLineBoundaryBackward, pn as deleteLineBoundaryForward, un as deleteToLineEnd, dn as deleteToLineStart, mn as deleteTrailingWhitespace, In as emacsStyleKeymap, ye as history, be as historyField, Re as historyKeymap, Mn as indentLess, $ as indentMore, jn as indentSelection, zn as indentWithTab, On as insertBlankLine, wn as insertNewline, Dn as insertNewlineAndIndent, Tn as insertNewlineKeepIndent, Fn as insertTab, _e as invertedEffects, ge as isolateHistory, oe as lineComment, se as lineUncomment, yn as moveLineDown, vn as moveLineUp, T as redo, Ee as redoDepth, Ce as redoSelection, Yt as selectAll, bt as selectCharBackward, St as selectCharBackwardLogical, yt as selectCharForward, xt as selectCharForwardLogical, q as selectCharLeft, vt as selectCharRight, Jt as selectDocEnd, qt as selectDocStart, Et as selectGroupBackward, Tt as selectGroupForward, Dt as selectGroupForwardWin, Ct as selectGroupLeft, wt as selectGroupRight, Xt as selectLine, Bt as selectLineBoundaryBackward, zt as selectLineBoundaryForward, Vt as selectLineBoundaryLeft, Ht as selectLineBoundaryRight, Ft as selectLineDown, Wt as selectLineEnd, Ut as selectLineStart, Pt as selectLineUp, _t as selectMatchingBracket, Rt as selectPageDown, Lt as selectPageUp, Zt as selectParentSyntax, At as selectSubwordBackward, kt as selectSubwordForward, jt as selectSyntaxLeft, Mt as selectSyntaxRight, tn as simplifySelection, hn as splitLine, Ln as standardKeymap, Pn as temporarilySetTabFocusMode, ce as toggleBlockComment, de as toggleBlockCommentByLine, ie as toggleComment, ae as toggleLineComment, Nn as toggleTabFocusMode, gn as transposeChars, xe as undo, Te as undoDepth, Se as undoSelection };