@burdenoff/microfe-technospam 2026.1102.1 → 2026.1102.2

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 (83) hide show
  1. package/dist/generated/wspace-types.d.ts +7468 -141
  2. package/dist/generated/wspace-types.d.ts.map +1 -1
  3. package/dist/node_modules/@codemirror/autocomplete/dist/index.js +527 -0
  4. package/dist/node_modules/@codemirror/autocomplete/dist/index.js.map +1 -0
  5. package/dist/node_modules/@codemirror/commands/dist/index.js +1108 -0
  6. package/dist/node_modules/@codemirror/commands/dist/index.js.map +1 -0
  7. package/dist/node_modules/@codemirror/lang-go/dist/index.js +206 -0
  8. package/dist/node_modules/@codemirror/lang-go/dist/index.js.map +1 -0
  9. package/dist/node_modules/@codemirror/lang-javascript/dist/index.js +321 -0
  10. package/dist/node_modules/@codemirror/lang-javascript/dist/index.js.map +1 -0
  11. package/dist/node_modules/@codemirror/lang-python/dist/index.js +265 -0
  12. package/dist/node_modules/@codemirror/lang-python/dist/index.js.map +1 -0
  13. package/dist/node_modules/@codemirror/language/dist/index.js +957 -0
  14. package/dist/node_modules/@codemirror/language/dist/index.js.map +1 -0
  15. package/dist/node_modules/@codemirror/legacy-modes/mode/ruby.js +164 -0
  16. package/dist/node_modules/@codemirror/legacy-modes/mode/ruby.js.map +1 -0
  17. package/dist/node_modules/@codemirror/legacy-modes/mode/shell.js +109 -0
  18. package/dist/node_modules/@codemirror/legacy-modes/mode/shell.js.map +1 -0
  19. package/dist/node_modules/@codemirror/state/dist/index.js +1739 -0
  20. package/dist/node_modules/@codemirror/state/dist/index.js.map +1 -0
  21. package/dist/node_modules/@codemirror/streamparser/dist/index.js +70 -0
  22. package/dist/node_modules/@codemirror/streamparser/dist/index.js.map +1 -0
  23. package/dist/node_modules/@codemirror/view/dist/index.js +5427 -0
  24. package/dist/node_modules/@codemirror/view/dist/index.js.map +1 -0
  25. package/dist/node_modules/@lezer/common/dist/index.js +896 -0
  26. package/dist/node_modules/@lezer/common/dist/index.js.map +1 -0
  27. package/dist/node_modules/@lezer/go/dist/index.js +215 -0
  28. package/dist/node_modules/@lezer/go/dist/index.js.map +1 -0
  29. package/dist/node_modules/@lezer/highlight/dist/index.js +395 -0
  30. package/dist/node_modules/@lezer/highlight/dist/index.js.map +1 -0
  31. package/dist/node_modules/@lezer/javascript/dist/index.js +437 -0
  32. package/dist/node_modules/@lezer/javascript/dist/index.js.map +1 -0
  33. package/dist/node_modules/@lezer/lr/dist/index.js +842 -0
  34. package/dist/node_modules/@lezer/lr/dist/index.js.map +1 -0
  35. package/dist/node_modules/@lezer/python/dist/index.js +352 -0
  36. package/dist/node_modules/@lezer/python/dist/index.js.map +1 -0
  37. package/dist/node_modules/@marijn/find-cluster-break/src/index.js +66 -0
  38. package/dist/node_modules/@marijn/find-cluster-break/src/index.js.map +1 -0
  39. package/dist/node_modules/style-mod/src/style-mod.js +74 -0
  40. package/dist/node_modules/style-mod/src/style-mod.js.map +1 -0
  41. package/dist/node_modules/w3c-keyname/index.js +90 -0
  42. package/dist/node_modules/w3c-keyname/index.js.map +1 -0
  43. package/dist/stories/fixtures/technospamFixtures.d.ts.map +1 -1
  44. package/dist/stories/journeys/Problems.stories.d.ts.map +1 -1
  45. package/dist/technospam/api/technospamApi.d.ts +39 -0
  46. package/dist/technospam/api/technospamApi.d.ts.map +1 -1
  47. package/dist/technospam/api/technospamApi.js +120 -86
  48. package/dist/technospam/api/technospamApi.js.map +1 -1
  49. package/dist/technospam/components/SubmissionViews.d.ts +6 -2
  50. package/dist/technospam/components/SubmissionViews.d.ts.map +1 -1
  51. package/dist/technospam/components/SubmissionViews.js +6 -5
  52. package/dist/technospam/components/SubmissionViews.js.map +1 -1
  53. package/dist/technospam/components/TechnoSpamErrorBoundary.d.ts +6 -0
  54. package/dist/technospam/components/TechnoSpamErrorBoundary.d.ts.map +1 -1
  55. package/dist/technospam/components/TechnoSpamErrorBoundary.js +2 -2
  56. package/dist/technospam/components/TechnoSpamErrorBoundary.js.map +1 -1
  57. package/dist/technospam/components/editor/CodeEditor.d.ts +26 -0
  58. package/dist/technospam/components/editor/CodeEditor.d.ts.map +1 -0
  59. package/dist/technospam/components/editor/CodeEditor.js +102 -0
  60. package/dist/technospam/components/editor/CodeEditor.js.map +1 -0
  61. package/dist/technospam/components/editor/RunOutputPanel.d.ts +14 -0
  62. package/dist/technospam/components/editor/RunOutputPanel.d.ts.map +1 -0
  63. package/dist/technospam/components/editor/RunOutputPanel.js +127 -0
  64. package/dist/technospam/components/editor/RunOutputPanel.js.map +1 -0
  65. package/dist/technospam/components/editor/editorLanguages.d.ts +11 -0
  66. package/dist/technospam/components/editor/editorLanguages.d.ts.map +1 -0
  67. package/dist/technospam/components/editor/editorLanguages.js +30 -0
  68. package/dist/technospam/components/editor/editorLanguages.js.map +1 -0
  69. package/dist/technospam/components/editor/editorTheme.d.ts +11 -0
  70. package/dist/technospam/components/editor/editorTheme.d.ts.map +1 -0
  71. package/dist/technospam/components/editor/editorTheme.js +120 -0
  72. package/dist/technospam/components/editor/editorTheme.js.map +1 -0
  73. package/dist/technospam/hooks/useSolutionRunner.d.ts +35 -0
  74. package/dist/technospam/hooks/useSolutionRunner.d.ts.map +1 -0
  75. package/dist/technospam/hooks/useSolutionRunner.js +66 -0
  76. package/dist/technospam/hooks/useSolutionRunner.js.map +1 -0
  77. package/dist/technospam/hooks/useTechnoSpamAnalytics.d.ts +1 -1
  78. package/dist/technospam/hooks/useTechnoSpamAnalytics.d.ts.map +1 -1
  79. package/dist/technospam/hooks/useTechnoSpamAnalytics.js.map +1 -1
  80. package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.d.ts.map +1 -1
  81. package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.js +416 -263
  82. package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.js.map +1 -1
  83. package/package.json +14 -4
@@ -0,0 +1,842 @@
1
+ import { DefaultBufferLength as e, IterMode as t, NodeProp as n, NodeSet as r, NodeType as i, Parser as a, Tree as o } from "../../common/dist/index.js";
2
+ //#region node_modules/@lezer/lr/dist/index.js
3
+ var s = class e {
4
+ constructor(e, t, n, r, i, a, o, s, c, l = 0, u) {
5
+ this.p = e, this.stack = t, this.state = n, this.reducePos = r, this.pos = i, this.score = a, this.buffer = o, this.bufferBase = s, this.curContext = c, this.lookAhead = l, this.parent = u;
6
+ }
7
+ toString() {
8
+ return `[${this.stack.filter((e, t) => t % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`;
9
+ }
10
+ static start(t, n, r = 0) {
11
+ let i = t.parser.context;
12
+ return new e(t, [], n, r, r, 0, [], 0, i ? new c(i, i.start) : null, 0, null);
13
+ }
14
+ get context() {
15
+ return this.curContext ? this.curContext.context : null;
16
+ }
17
+ pushState(e, t) {
18
+ this.stack.push(this.state, t, this.bufferBase + this.buffer.length), this.state = e;
19
+ }
20
+ reduce(e) {
21
+ let t = e >> 19, n = e & 65535, { parser: r } = this.p, i = this.reducePos < this.pos - 25 && this.setLookAhead(this.pos), a = r.dynamicPrecedence(n);
22
+ if (a && (this.score += a), t == 0) {
23
+ n < r.minRepeatTerm && this.reducePos < this.pos && (this.reducePos = this.pos), this.pushState(r.getGoto(this.state, n, !0), this.reducePos), n < r.minRepeatTerm && this.storeNode(n, this.reducePos, this.reducePos, i ? 8 : 4, !0), this.reduceContext(n, this.reducePos);
24
+ return;
25
+ }
26
+ let o = this.stack.length - (t - 1) * 3 - (e & 262144 ? 6 : 0), s = o ? this.stack[o - 2] : this.p.ranges[0].from;
27
+ n < r.minRepeatTerm && s == this.reducePos && this.reducePos < this.pos && (this.reducePos = this.pos);
28
+ let c = this.reducePos - s;
29
+ c >= 2e3 && !this.p.parser.nodeSet.types[n]?.isAnonymous && (s == this.p.lastBigReductionStart ? (this.p.bigReductionCount++, this.p.lastBigReductionSize = c) : this.p.lastBigReductionSize < c && (this.p.bigReductionCount = 1, this.p.lastBigReductionStart = s, this.p.lastBigReductionSize = c));
30
+ let l = o ? this.stack[o - 1] : 0, u = this.bufferBase + this.buffer.length - l;
31
+ if (n < r.minRepeatTerm || e & 131072) {
32
+ let e = r.stateFlag(this.state, 1) ? this.pos : this.reducePos;
33
+ this.storeNode(n, s, e, u + 4, !0);
34
+ }
35
+ if (e & 262144) this.state = this.stack[o];
36
+ else {
37
+ let e = this.stack[o - 3];
38
+ this.state = r.getGoto(e, n, !0);
39
+ }
40
+ for (; this.stack.length > o;) this.stack.pop();
41
+ this.reduceContext(n, s);
42
+ }
43
+ storeNode(e, t, n, r = 4, i = !1) {
44
+ if (e == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
45
+ let e = this.buffer.length;
46
+ if (e > 0 && this.buffer[e - 4] == 0 && this.buffer[e - 1] > -1) {
47
+ if (t == n) return;
48
+ if (this.buffer[e - 2] >= t) {
49
+ this.buffer[e - 2] = n;
50
+ return;
51
+ }
52
+ }
53
+ }
54
+ if (!i || this.pos == n) this.buffer.push(e, t, n, r);
55
+ else {
56
+ let i = this.buffer.length;
57
+ if (i > 0 && (this.buffer[i - 4] != 0 || this.buffer[i - 1] < 0)) {
58
+ let e = !1;
59
+ for (let t = i; t > 0 && this.buffer[t - 2] > n; t -= 4) if (this.buffer[t - 1] >= 0) {
60
+ e = !0;
61
+ break;
62
+ }
63
+ if (e) for (; i > 0 && this.buffer[i - 2] > n;) this.buffer[i] = this.buffer[i - 4], this.buffer[i + 1] = this.buffer[i - 3], this.buffer[i + 2] = this.buffer[i - 2], this.buffer[i + 3] = this.buffer[i - 1], i -= 4, r > 4 && (r -= 4);
64
+ }
65
+ this.buffer[i] = e, this.buffer[i + 1] = t, this.buffer[i + 2] = n, this.buffer[i + 3] = r;
66
+ }
67
+ }
68
+ shift(e, t, n, r) {
69
+ if (e & 131072) this.pushState(e & 65535, this.pos);
70
+ else if (e & 262144) this.pos = r, this.shiftContext(t, n), t <= this.p.parser.maxNode && this.buffer.push(t, n, r, 4);
71
+ else {
72
+ let i = e, { parser: a } = this.p;
73
+ this.pos = r;
74
+ let o = a.stateFlag(i, 1);
75
+ !o && (r > n || t <= a.maxNode) && (this.reducePos = r), this.pushState(i, o ? n : Math.min(n, this.reducePos)), this.shiftContext(t, n), t <= a.maxNode && this.buffer.push(t, n, r, 4);
76
+ }
77
+ }
78
+ apply(e, t, n, r) {
79
+ e & 65536 ? this.reduce(e) : this.shift(e, t, n, r);
80
+ }
81
+ useNode(e, t, n) {
82
+ let r = this.p.reused.length - 1;
83
+ (r < 0 || this.p.reused[r] != e) && (this.p.reused.push(e), r++);
84
+ let i = this.reducePos = this.pos = n + e.length;
85
+ this.pushState(t, n), this.buffer.push(r, n, i, -1), this.curContext && this.updateContext(this.curContext.tracker.reuse(this.curContext.context, e, this, this.p.stream.reset(this.pos - e.length)));
86
+ }
87
+ split() {
88
+ let t = this, n = t.buffer.length;
89
+ for (n && t.buffer[n - 4] == 0 && (n -= 4); n > 0 && t.buffer[n - 2] > t.reducePos;) n -= 4;
90
+ let r = t.buffer.slice(n), i = t.bufferBase + n;
91
+ for (; t && i == t.bufferBase;) t = t.parent;
92
+ return new e(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, r, i, this.curContext, this.lookAhead, t);
93
+ }
94
+ recoverByDelete(e, t) {
95
+ let n = e <= this.p.parser.maxNode;
96
+ n && this.storeNode(e, this.pos, t, 4), this.storeNode(0, this.pos, t, n ? 8 : 4), this.pos = this.reducePos = t, this.score -= 190;
97
+ }
98
+ canShift(e) {
99
+ for (let t = new l(this);;) {
100
+ let n = this.p.parser.stateSlot(t.state, 4) || this.p.parser.hasAction(t.state, e);
101
+ if (n == 0) return !1;
102
+ if (!(n & 65536)) return !0;
103
+ t.reduce(n);
104
+ }
105
+ }
106
+ recoverByInsert(e) {
107
+ if (this.stack.length >= 300) return [];
108
+ let t = this.p.parser.nextStates(this.state);
109
+ if (t.length > 8 || this.stack.length >= 120) {
110
+ let n = [];
111
+ for (let r = 0, i; r < t.length; r += 2) (i = t[r + 1]) != this.state && this.p.parser.hasAction(i, e) && n.push(t[r], i);
112
+ if (this.stack.length < 120) for (let e = 0; n.length < 8 && e < t.length; e += 2) {
113
+ let r = t[e + 1];
114
+ n.some((e, t) => t & 1 && e == r) || n.push(t[e], r);
115
+ }
116
+ t = n;
117
+ }
118
+ let n = [];
119
+ for (let e = 0; e < t.length && n.length < 4; e += 2) {
120
+ let r = t[e + 1];
121
+ if (r == this.state) continue;
122
+ let i = this.split();
123
+ i.pushState(r, this.pos), i.storeNode(0, i.pos, i.pos, 4, !0), i.shiftContext(t[e], this.pos), i.reducePos = this.pos, i.score -= 200, n.push(i);
124
+ }
125
+ return n;
126
+ }
127
+ forceReduce() {
128
+ let { parser: e } = this.p, t = e.stateSlot(this.state, 5);
129
+ if (!(t & 65536)) return !1;
130
+ if (!e.validAction(this.state, t)) {
131
+ let n = t >> 19, r = t & 65535, i = this.stack.length - n * 3;
132
+ if (i < 0 || e.getGoto(this.stack[i], r, !1) < 0) {
133
+ let e = this.findForcedReduction();
134
+ if (e == null) return !1;
135
+ t = e;
136
+ }
137
+ this.storeNode(0, this.pos, this.pos, 4, !0), this.score -= 100;
138
+ }
139
+ return this.reducePos = this.pos, this.reduce(t), !0;
140
+ }
141
+ findForcedReduction() {
142
+ let { parser: e } = this.p, t = [], n = (r, i) => {
143
+ if (!t.includes(r)) return t.push(r), e.allActions(r, (t) => {
144
+ if (!(t & 393216)) if (t & 65536) {
145
+ let n = (t >> 19) - i;
146
+ if (n > 1) {
147
+ let r = t & 65535, i = this.stack.length - n * 3;
148
+ if (i >= 0 && e.getGoto(this.stack[i], r, !1) >= 0) return n << 19 | 65536 | r;
149
+ }
150
+ } else {
151
+ let e = n(t, i + 1);
152
+ if (e != null) return e;
153
+ }
154
+ });
155
+ };
156
+ return n(this.state, 0);
157
+ }
158
+ forceAll() {
159
+ for (; !this.p.parser.stateFlag(this.state, 2);) if (!this.forceReduce()) {
160
+ this.storeNode(0, this.pos, this.pos, 4, !0);
161
+ break;
162
+ }
163
+ return this;
164
+ }
165
+ get deadEnd() {
166
+ if (this.stack.length != 3) return !1;
167
+ let { parser: e } = this.p;
168
+ return e.data[e.stateSlot(this.state, 1)] == 65535 && !e.stateSlot(this.state, 4);
169
+ }
170
+ restart() {
171
+ this.storeNode(0, this.pos, this.pos, 4, !0), this.state = this.stack[0], this.stack.length = 0;
172
+ }
173
+ sameState(e) {
174
+ if (this.state != e.state || this.stack.length != e.stack.length) return !1;
175
+ for (let t = 0; t < this.stack.length; t += 3) if (this.stack[t] != e.stack[t]) return !1;
176
+ return !0;
177
+ }
178
+ get parser() {
179
+ return this.p.parser;
180
+ }
181
+ dialectEnabled(e) {
182
+ return this.p.parser.dialect.flags[e];
183
+ }
184
+ shiftContext(e, t) {
185
+ this.curContext && this.updateContext(this.curContext.tracker.shift(this.curContext.context, e, this, this.p.stream.reset(t)));
186
+ }
187
+ reduceContext(e, t) {
188
+ this.curContext && this.updateContext(this.curContext.tracker.reduce(this.curContext.context, e, this, this.p.stream.reset(t)));
189
+ }
190
+ emitContext() {
191
+ let e = this.buffer.length - 1;
192
+ (e < 0 || this.buffer[e] != -3) && this.storeNode(this.curContext.hash, this.reducePos, this.reducePos, -3, !0);
193
+ }
194
+ emitLookAhead() {
195
+ let e = this.buffer.length - 1;
196
+ (e < 0 || this.buffer[e] != -4) && this.buffer.push(this.lookAhead, this.pos, this.pos, -4);
197
+ }
198
+ updateContext(e) {
199
+ if (e != this.curContext.context) {
200
+ let t = new c(this.curContext.tracker, e);
201
+ t.hash != this.curContext.hash && this.emitContext(), this.curContext = t;
202
+ }
203
+ }
204
+ setLookAhead(e) {
205
+ return e <= this.lookAhead ? !1 : (this.emitLookAhead(), this.lookAhead = e, !0);
206
+ }
207
+ close() {
208
+ this.curContext && this.curContext.tracker.strict && this.emitContext(), this.lookAhead > 0 && this.emitLookAhead();
209
+ }
210
+ }, c = class {
211
+ constructor(e, t) {
212
+ this.tracker = e, this.context = t, this.hash = e.strict ? e.hash(t) : 0;
213
+ }
214
+ }, l = class {
215
+ constructor(e) {
216
+ this.start = e, this.state = e.state, this.stack = e.stack, this.base = this.stack.length;
217
+ }
218
+ reduce(e) {
219
+ let t = e & 65535, n = e >> 19;
220
+ n == 0 ? (this.stack == this.start.stack && (this.stack = this.stack.slice()), this.stack.push(this.state, 0, 0), this.base += 3) : this.base -= (n - 1) * 3, this.state = this.start.p.parser.getGoto(this.stack[this.base - 3], t, !0);
221
+ }
222
+ }, u = class e {
223
+ constructor(e, t, n) {
224
+ this.stack = e, this.pos = t, this.index = n, this.buffer = e.buffer, this.index == 0 && this.maybeNext();
225
+ }
226
+ static create(t, n = t.bufferBase + t.buffer.length) {
227
+ return new e(t, n, n - t.bufferBase);
228
+ }
229
+ maybeNext() {
230
+ let e = this.stack.parent;
231
+ e != null && (this.index = this.stack.bufferBase - e.bufferBase, this.stack = e, this.buffer = e.buffer);
232
+ }
233
+ get id() {
234
+ return this.buffer[this.index - 4];
235
+ }
236
+ get start() {
237
+ return this.buffer[this.index - 3];
238
+ }
239
+ get end() {
240
+ return this.buffer[this.index - 2];
241
+ }
242
+ get size() {
243
+ return this.buffer[this.index - 1];
244
+ }
245
+ next() {
246
+ this.index -= 4, this.pos -= 4, this.index == 0 && this.maybeNext();
247
+ }
248
+ fork() {
249
+ return new e(this.stack, this.pos, this.index);
250
+ }
251
+ };
252
+ function d(e, t = Uint16Array) {
253
+ if (typeof e != "string") return e;
254
+ let n = null;
255
+ for (let r = 0, i = 0; r < e.length;) {
256
+ let a = 0;
257
+ for (;;) {
258
+ let t = e.charCodeAt(r++), n = !1;
259
+ if (t == 126) {
260
+ a = 65535;
261
+ break;
262
+ }
263
+ t >= 92 && t--, t >= 34 && t--;
264
+ let i = t - 32;
265
+ if (i >= 46 && (i -= 46, n = !0), a += i, n) break;
266
+ a *= 46;
267
+ }
268
+ n ? n[i++] = a : n = new t(a);
269
+ }
270
+ return n;
271
+ }
272
+ var f = class {
273
+ constructor() {
274
+ this.start = -1, this.value = -1, this.end = -1, this.extended = -1, this.lookAhead = 0, this.mask = 0, this.context = 0;
275
+ }
276
+ }, p = new f(), m = class {
277
+ constructor(e, t) {
278
+ this.input = e, this.ranges = t, this.chunk = "", this.chunkOff = 0, this.chunk2 = "", this.chunk2Pos = 0, this.next = -1, this.token = p, this.rangeIndex = 0, this.pos = this.chunkPos = t[0].from, this.range = t[0], this.end = t[t.length - 1].to, this.readNext();
279
+ }
280
+ resolveOffset(e, t) {
281
+ let n = this.range, r = this.rangeIndex, i = this.pos + e;
282
+ for (; i < n.from;) {
283
+ if (!r) return null;
284
+ let e = this.ranges[--r];
285
+ i -= n.from - e.to, n = e;
286
+ }
287
+ for (; t < 0 ? i > n.to : i >= n.to;) {
288
+ if (r == this.ranges.length - 1) return null;
289
+ let e = this.ranges[++r];
290
+ i += e.from - n.to, n = e;
291
+ }
292
+ return i;
293
+ }
294
+ clipPos(e) {
295
+ if (e >= this.range.from && e < this.range.to) return e;
296
+ for (let t of this.ranges) if (t.to > e) return Math.max(e, t.from);
297
+ return this.end;
298
+ }
299
+ peek(e) {
300
+ let t = this.chunkOff + e, n, r;
301
+ if (t >= 0 && t < this.chunk.length) n = this.pos + e, r = this.chunk.charCodeAt(t);
302
+ else {
303
+ let t = this.resolveOffset(e, 1);
304
+ if (t == null) return -1;
305
+ if (n = t, n >= this.chunk2Pos && n < this.chunk2Pos + this.chunk2.length) r = this.chunk2.charCodeAt(n - this.chunk2Pos);
306
+ else {
307
+ let e = this.rangeIndex, t = this.range;
308
+ for (; t.to <= n;) t = this.ranges[++e];
309
+ this.chunk2 = this.input.chunk(this.chunk2Pos = n), n + this.chunk2.length > t.to && (this.chunk2 = this.chunk2.slice(0, t.to - n)), r = this.chunk2.charCodeAt(0);
310
+ }
311
+ }
312
+ return n >= this.token.lookAhead && (this.token.lookAhead = n + 1), r;
313
+ }
314
+ acceptToken(e, t = 0) {
315
+ let n = t ? this.resolveOffset(t, -1) : this.pos;
316
+ if (n == null || n < this.token.start) throw RangeError("Token end out of bounds");
317
+ this.token.value = e, this.token.end = n;
318
+ }
319
+ acceptTokenTo(e, t) {
320
+ this.token.value = e, this.token.end = t;
321
+ }
322
+ getChunk() {
323
+ if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) {
324
+ let { chunk: e, chunkPos: t } = this;
325
+ this.chunk = this.chunk2, this.chunkPos = this.chunk2Pos, this.chunk2 = e, this.chunk2Pos = t, this.chunkOff = this.pos - this.chunkPos;
326
+ } else {
327
+ this.chunk2 = this.chunk, this.chunk2Pos = this.chunkPos;
328
+ let e = this.input.chunk(this.pos);
329
+ this.chunk = this.pos + e.length > this.range.to ? e.slice(0, this.range.to - this.pos) : e, this.chunkPos = this.pos, this.chunkOff = 0;
330
+ }
331
+ }
332
+ readNext() {
333
+ return this.chunkOff >= this.chunk.length && (this.getChunk(), this.chunkOff == this.chunk.length) ? this.next = -1 : this.next = this.chunk.charCodeAt(this.chunkOff);
334
+ }
335
+ advance(e = 1) {
336
+ for (this.chunkOff += e; this.pos + e >= this.range.to;) {
337
+ if (this.rangeIndex == this.ranges.length - 1) return this.setDone();
338
+ e -= this.range.to - this.pos, this.range = this.ranges[++this.rangeIndex], this.pos = this.range.from;
339
+ }
340
+ return this.pos += e, this.pos >= this.token.lookAhead && (this.token.lookAhead = this.pos + 1), this.readNext();
341
+ }
342
+ setDone() {
343
+ return this.pos = this.chunkPos = this.end, this.range = this.ranges[this.rangeIndex = this.ranges.length - 1], this.chunk = "", this.next = -1;
344
+ }
345
+ reset(e, t) {
346
+ if (t ? (this.token = t, t.start = e, t.lookAhead = e + 1, t.value = t.extended = -1) : this.token = p, this.pos != e) {
347
+ if (this.pos = e, e == this.end) return this.setDone(), this;
348
+ for (; e < this.range.from;) this.range = this.ranges[--this.rangeIndex];
349
+ for (; e >= this.range.to;) this.range = this.ranges[++this.rangeIndex];
350
+ e >= this.chunkPos && e < this.chunkPos + this.chunk.length ? this.chunkOff = e - this.chunkPos : (this.chunk = "", this.chunkOff = 0), this.readNext();
351
+ }
352
+ return this;
353
+ }
354
+ read(e, t) {
355
+ if (e >= this.chunkPos && t <= this.chunkPos + this.chunk.length) return this.chunk.slice(e - this.chunkPos, t - this.chunkPos);
356
+ if (e >= this.chunk2Pos && t <= this.chunk2Pos + this.chunk2.length) return this.chunk2.slice(e - this.chunk2Pos, t - this.chunk2Pos);
357
+ if (e >= this.range.from && t <= this.range.to) return this.input.read(e, t);
358
+ let n = "";
359
+ for (let r of this.ranges) {
360
+ if (r.from >= t) break;
361
+ r.to > e && (n += this.input.read(Math.max(r.from, e), Math.min(r.to, t)));
362
+ }
363
+ return n;
364
+ }
365
+ }, h = class {
366
+ constructor(e, t) {
367
+ this.data = e, this.id = t;
368
+ }
369
+ token(e, t) {
370
+ let { parser: n } = t.p;
371
+ v(this.data, e, t, this.id, n.data, n.tokenPrecTable);
372
+ }
373
+ };
374
+ h.prototype.contextual = h.prototype.fallback = h.prototype.extend = !1;
375
+ var g = class {
376
+ constructor(e, t, n) {
377
+ this.precTable = t, this.elseToken = n, this.data = typeof e == "string" ? d(e) : e;
378
+ }
379
+ token(e, t) {
380
+ let n = e.pos, r = 0;
381
+ for (;;) {
382
+ let n = e.next < 0, i = e.resolveOffset(1, 1);
383
+ if (v(this.data, e, t, 0, this.data, this.precTable), e.token.value > -1) break;
384
+ if (this.elseToken == null) return;
385
+ if (n || r++, i == null) break;
386
+ e.reset(i, e.token);
387
+ }
388
+ r && (e.reset(n, e.token), e.acceptToken(this.elseToken, r));
389
+ }
390
+ };
391
+ g.prototype.contextual = h.prototype.fallback = h.prototype.extend = !1;
392
+ var _ = class {
393
+ constructor(e, t = {}) {
394
+ this.token = e, this.contextual = !!t.contextual, this.fallback = !!t.fallback, this.extend = !!t.extend;
395
+ }
396
+ };
397
+ function v(e, t, n, r, i, a) {
398
+ let o = 0, s = 1 << r, { dialect: c } = n.p.parser;
399
+ scan: for (; (s & e[o]) != 0;) {
400
+ let n = e[o + 1];
401
+ for (let r = o + 3; r < n; r += 2) if ((e[r + 1] & s) > 0) {
402
+ let n = e[r];
403
+ if (c.allows(n) && (t.token.value == -1 || t.token.value == n || b(n, t.token.value, i, a))) {
404
+ t.acceptToken(n);
405
+ break;
406
+ }
407
+ }
408
+ let r = t.next, l = 0, u = e[o + 2];
409
+ if (t.next < 0 && u > l && e[n + u * 3 - 3] == 65535) {
410
+ o = e[n + u * 3 - 1];
411
+ continue scan;
412
+ }
413
+ for (; l < u;) {
414
+ let i = l + u >> 1, a = n + i + (i << 1), s = e[a], c = e[a + 1] || 65536;
415
+ if (r < s) u = i;
416
+ else if (r >= c) l = i + 1;
417
+ else {
418
+ o = e[a + 2], t.advance();
419
+ continue scan;
420
+ }
421
+ }
422
+ break;
423
+ }
424
+ }
425
+ function y(e, t, n) {
426
+ for (let r = t, i; (i = e[r]) != 65535; r++) if (i == n) return r - t;
427
+ return -1;
428
+ }
429
+ function b(e, t, n, r) {
430
+ let i = y(n, r, t);
431
+ return i < 0 || y(n, r, e) < i;
432
+ }
433
+ var x = typeof process < "u" && process.env && /\bparse\b/.test(process.env.LOG), S = null;
434
+ function C(e, n, r) {
435
+ let i = e.cursor(t.IncludeAnonymous);
436
+ for (i.moveTo(n);;) if (!(r < 0 ? i.childBefore(n) : i.childAfter(n))) for (;;) {
437
+ if ((r < 0 ? i.to < n : i.from > n) && !i.type.isError) return r < 0 ? Math.max(0, Math.min(i.to - 1, n - 25)) : Math.min(e.length, Math.max(i.from + 1, n + 25));
438
+ if (r < 0 ? i.prevSibling() : i.nextSibling()) break;
439
+ if (!i.parent()) return r < 0 ? 0 : e.length;
440
+ }
441
+ }
442
+ var w = class {
443
+ constructor(e, t) {
444
+ this.fragments = e, this.minRepeat = t, this.i = 0, this.fragment = null, this.safeFrom = -1, this.safeTo = -1, this.trees = [], this.start = [], this.index = [], this.lastRepeat = null, this.lastRepeatPos = -1, this.nextFragment();
445
+ }
446
+ nextFragment() {
447
+ let e = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++];
448
+ if (e) {
449
+ for (this.safeFrom = e.openStart ? C(e.tree, e.from + e.offset, 1) - e.offset : e.from, this.safeTo = e.openEnd ? C(e.tree, e.to + e.offset, -1) - e.offset : e.to; this.trees.length;) this.trees.pop(), this.start.pop(), this.index.pop();
450
+ this.trees.push(e.tree), this.start.push(-e.offset), this.index.push(0), this.nextStart = this.safeFrom;
451
+ } else this.nextStart = 1e9;
452
+ }
453
+ nodeAt(e) {
454
+ if (e < this.nextStart) return null;
455
+ for (; this.fragment && this.safeTo <= e;) this.nextFragment();
456
+ if (!this.fragment) return null;
457
+ for (;;) {
458
+ let t = this.trees.length - 1;
459
+ if (t < 0) return this.nextFragment(), null;
460
+ if (e < this.safeFrom) return null;
461
+ let r = this.trees[t], i = this.index[t];
462
+ if (i == r.children.length) {
463
+ this.trees.pop(), this.start.pop(), this.index.pop();
464
+ continue;
465
+ }
466
+ let a = r.children[i], s = this.start[t] + r.positions[i];
467
+ if (s > e) return this.nextStart = s, null;
468
+ if (a instanceof o) {
469
+ let r = s > this.lastRepeatPos && a.type.id >= this.minRepeat;
470
+ if (s == e || r) {
471
+ let t = s + a.length, i;
472
+ if (s >= this.safeFrom && t <= this.safeTo && (!(i = a.prop(n.lookAhead)) || t + i < this.fragment.to) && (r && (this.lastRepeat = a, this.lastRepeatPos = s), s == e)) return a;
473
+ }
474
+ this.index[t]++, s + a.length >= Math.max(this.safeFrom, e) && (this.trees.push(a), this.start.push(s), this.index.push(0));
475
+ } else this.index[t]++, this.nextStart = s + a.length;
476
+ }
477
+ }
478
+ }, T = class {
479
+ constructor(e, t) {
480
+ this.stream = t, this.tokens = [], this.mainToken = null, this.actions = [], this.tokens = e.tokenizers.map((e) => new f());
481
+ }
482
+ getActions(e) {
483
+ let t = 0, n = null, { parser: r } = e.p, { tokenizers: i } = r, a = r.stateSlot(e.state, 3), o = e.curContext ? e.curContext.hash : 0, s = 0;
484
+ for (let r = 0; r < i.length; r++) {
485
+ if (!(1 << r & a)) continue;
486
+ let c = i[r], l = this.tokens[r];
487
+ if (!(n && !c.fallback) && ((c.contextual || l.start != e.pos || l.mask != a || l.context != o) && (this.updateCachedToken(l, c, e), l.mask = a, l.context = o), l.lookAhead > l.end + 25 && (s = Math.max(l.lookAhead, s)), l.value != 0)) {
488
+ let r = t;
489
+ if (l.extended > -1 && (t = this.addActions(e, l.extended, l.end, t)), t = this.addActions(e, l.value, l.end, t), !c.extend && (n = l, t > r)) break;
490
+ }
491
+ }
492
+ for (; this.actions.length > t;) this.actions.pop();
493
+ return s && e.setLookAhead(s), !n && e.pos == this.stream.end && (n = new f(), n.value = e.p.parser.eofTerm, n.start = n.end = e.pos, t = this.addActions(e, n.value, n.end, t)), this.mainToken = n, this.actions;
494
+ }
495
+ getMainToken(e) {
496
+ if (this.mainToken) return this.mainToken;
497
+ let t = new f(), { pos: n, p: r } = e;
498
+ return t.start = n, t.end = Math.min(n + 1, r.stream.end), t.value = n == r.stream.end ? r.parser.eofTerm : 0, t;
499
+ }
500
+ updateCachedToken(e, t, n) {
501
+ let r = this.stream.clipPos(n.pos);
502
+ if (t.token(this.stream.reset(r, e), n), e.value > -1) {
503
+ let { parser: t } = n.p;
504
+ for (let r = 0; r < t.specialized.length; r++) if (t.specialized[r] == e.value) {
505
+ let i = t.specializers[r](this.stream.read(e.start, e.end), n);
506
+ if (i >= 0 && n.p.parser.dialect.allows(i >> 1)) {
507
+ i & 1 ? e.extended = i >> 1 : e.value = i >> 1;
508
+ break;
509
+ }
510
+ }
511
+ } else e.value = 0, e.end = this.stream.clipPos(r + 1);
512
+ }
513
+ putAction(e, t, n, r) {
514
+ for (let t = 0; t < r; t += 3) if (this.actions[t] == e) return r;
515
+ return this.actions[r++] = e, this.actions[r++] = t, this.actions[r++] = n, r;
516
+ }
517
+ addActions(e, t, n, r) {
518
+ let { state: i } = e, { parser: a } = e.p, { data: o } = a;
519
+ for (let e = 0; e < 2; e++) for (let s = a.stateSlot(i, e ? 2 : 1);; s += 3) {
520
+ if (o[s] == 65535) if (o[s + 1] == 1) s = M(o, s + 2);
521
+ else {
522
+ r == 0 && o[s + 1] == 2 && (r = this.putAction(M(o, s + 2), t, n, r));
523
+ break;
524
+ }
525
+ o[s] == t && (r = this.putAction(M(o, s + 1), t, n, r));
526
+ }
527
+ return r;
528
+ }
529
+ }, E = class {
530
+ constructor(e, t, n, r) {
531
+ this.parser = e, this.input = t, this.ranges = r, this.recovering = 0, this.nextStackID = 9812, this.minStackPos = 0, this.reused = [], this.stoppedAt = null, this.lastBigReductionStart = -1, this.lastBigReductionSize = 0, this.bigReductionCount = 0, this.stream = new m(t, r), this.tokens = new T(e, this.stream), this.topTerm = e.top[1];
532
+ let { from: i } = r[0];
533
+ this.stacks = [s.start(this, e.top[0], i)], this.fragments = n.length && this.stream.end - i > e.bufferLength * 4 ? new w(n, e.minRepeatTerm) : null;
534
+ }
535
+ get parsedPos() {
536
+ return this.minStackPos;
537
+ }
538
+ advance() {
539
+ let e = this.stacks, t = this.minStackPos, n = this.stacks = [], r, i;
540
+ if (this.bigReductionCount > 300 && e.length == 1) {
541
+ let [t] = e;
542
+ for (; t.forceReduce() && t.stack.length && t.stack[t.stack.length - 2] >= this.lastBigReductionStart;);
543
+ this.bigReductionCount = this.lastBigReductionSize = 0;
544
+ }
545
+ for (let a = 0; a < e.length; a++) {
546
+ let o = e[a];
547
+ for (;;) {
548
+ if (this.tokens.mainToken = null, o.pos > t) n.push(o);
549
+ else if (this.advanceStack(o, n, e)) continue;
550
+ else {
551
+ r || (r = [], i = []), r.push(o);
552
+ let e = this.tokens.getMainToken(o);
553
+ i.push(e.value, e.end);
554
+ }
555
+ break;
556
+ }
557
+ }
558
+ if (!n.length) {
559
+ let e = r && N(r);
560
+ if (e) return x && console.log("Finish with " + this.stackID(e)), this.stackToTree(e);
561
+ if (this.parser.strict) throw x && r && console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")), SyntaxError("No parse at " + t);
562
+ this.recovering ||= 5;
563
+ }
564
+ if (this.recovering && r) {
565
+ let e = this.stoppedAt != null && r[0].pos > this.stoppedAt ? r[0] : this.runRecovery(r, i, n);
566
+ if (e) return x && console.log("Force-finish " + this.stackID(e)), this.stackToTree(e.forceAll());
567
+ }
568
+ if (this.recovering) {
569
+ let e = this.recovering == 1 ? 1 : this.recovering * 3;
570
+ if (n.length > e) for (n.sort((e, t) => t.score - e.score); n.length > e;) n.pop();
571
+ n.some((e) => e.reducePos > t) && this.recovering--;
572
+ } else if (n.length > 1) {
573
+ outer: for (let e = 0; e < n.length - 1; e++) {
574
+ let t = n[e];
575
+ for (let r = e + 1; r < n.length; r++) {
576
+ let i = n[r];
577
+ if (t.sameState(i) || t.buffer.length > 500 && i.buffer.length > 500) if ((t.score - i.score || t.buffer.length - i.buffer.length) > 0) n.splice(r--, 1);
578
+ else {
579
+ n.splice(e--, 1);
580
+ continue outer;
581
+ }
582
+ }
583
+ }
584
+ n.length > 12 && (n.sort((e, t) => t.score - e.score), n.splice(12, n.length - 12));
585
+ }
586
+ this.minStackPos = n[0].pos;
587
+ for (let e = 1; e < n.length; e++) n[e].pos < this.minStackPos && (this.minStackPos = n[e].pos);
588
+ return null;
589
+ }
590
+ stopAt(e) {
591
+ if (this.stoppedAt != null && this.stoppedAt < e) throw RangeError("Can't move stoppedAt forward");
592
+ this.stoppedAt = e;
593
+ }
594
+ tryReuse(e, t, r, i) {
595
+ if (!r) return null;
596
+ let a = e.curContext && e.curContext.tracker.strict, s = a ? e.curContext.hash : 0;
597
+ for (; r;) {
598
+ let c = this.parser.nodeSet.types[r.type.id] == r.type ? this.parser.getGoto(e.state, r.type.id) : -1;
599
+ if (c > -1 && r.length && (!a || (r.prop(n.contextHash) || 0) == s)) return e.useNode(r, c, t), r;
600
+ if (r.children.length == 0 || r.positions[0] > 0) break;
601
+ let l = r.children[0];
602
+ if (l instanceof o && (!i || l.type.id >= this.parser.minRepeatTerm)) r = l;
603
+ else break;
604
+ }
605
+ return null;
606
+ }
607
+ advanceStack(e, t, n) {
608
+ let r = e.pos, { parser: i } = this, a = x ? this.stackID(e) + " -> " : "";
609
+ if (this.stoppedAt != null && r > this.stoppedAt) return e.forceReduce() ? e : null;
610
+ if (this.fragments) {
611
+ let t = e.reducePos < r && e.buffer.length && e.buffer[e.buffer.length - 2] <= e.reducePos && this.fragments.lastRepeatPos == e.reducePos && this.tryReuse(e, e.reducePos, this.fragments.lastRepeat, !0) || this.tryReuse(e, r, this.fragments.nodeAt(r), !1);
612
+ if (t) return x && console.log(a + this.stackID(e) + ` (via reuse of ${i.getName(t.type.id)})`), !0;
613
+ }
614
+ let o = i.stateSlot(e.state, 4);
615
+ if (o > 0) return e.reduce(o), x && console.log(a + this.stackID(e) + ` (via always-reduce ${i.getName(o & 65535)})`), !0;
616
+ if (e.stack.length >= 8400) for (; e.stack.length > 6e3 && e.forceReduce(););
617
+ let s = this.tokens.getActions(e);
618
+ for (let o = 0; o < s.length;) {
619
+ let c = s[o++], l = s[o++], u = s[o++], d = o == s.length || !n, f = d ? e : e.split(), p = this.tokens.mainToken;
620
+ if (f.apply(c, l, p ? p.start : f.pos, u), x && console.log(a + this.stackID(f) + ` (via ${c & 65536 ? `reduce of ${i.getName(c & 65535)}` : "shift"} for ${i.getName(l)} @ ${r}${f == e ? "" : ", split"})`), d) return !0;
621
+ f.pos > r ? t.push(f) : n.push(f);
622
+ }
623
+ return !1;
624
+ }
625
+ advanceFully(e, t) {
626
+ let n = e.pos;
627
+ for (;;) {
628
+ if (!this.advanceStack(e, null, null)) return !1;
629
+ if (e.pos > n) return D(e, t), !0;
630
+ }
631
+ }
632
+ runRecovery(e, t, n) {
633
+ let r = null, i = !1;
634
+ for (let a = 0; a < e.length; a++) {
635
+ let o = e[a], s = t[a << 1], c = t[(a << 1) + 1], l = x ? this.stackID(o) + " -> " : "";
636
+ if (o.deadEnd && (i || (i = !0, o.restart(), x && console.log(l + this.stackID(o) + " (restarted)"), this.advanceFully(o, n)))) continue;
637
+ let u = o.split(), d = l;
638
+ for (let e = 0; e < 10 && u.forceReduce() && (x && console.log(d + this.stackID(u) + " (via force-reduce)"), !this.advanceFully(u, n)); e++) x && (d = this.stackID(u) + " -> ");
639
+ for (let e of o.recoverByInsert(s)) x && console.log(l + this.stackID(e) + " (via recover-insert)"), this.advanceFully(e, n);
640
+ this.stream.end > o.pos ? (c == o.pos && (c++, s = 0), o.recoverByDelete(s, c), x && console.log(l + this.stackID(o) + ` (via recover-delete ${this.parser.getName(s)})`), D(o, n)) : (!r || r.score < u.score) && (r = u);
641
+ }
642
+ return r;
643
+ }
644
+ stackToTree(e) {
645
+ return e.close(), o.build({
646
+ buffer: u.create(e),
647
+ nodeSet: this.parser.nodeSet,
648
+ topID: this.topTerm,
649
+ maxBufferLength: this.parser.bufferLength,
650
+ reused: this.reused,
651
+ start: this.ranges[0].from,
652
+ length: e.pos - this.ranges[0].from,
653
+ minRepeatType: this.parser.minRepeatTerm
654
+ });
655
+ }
656
+ stackID(e) {
657
+ let t = (S ||= /* @__PURE__ */ new WeakMap()).get(e);
658
+ return t || S.set(e, t = String.fromCodePoint(this.nextStackID++)), t + e;
659
+ }
660
+ };
661
+ function D(e, t) {
662
+ for (let n = 0; n < t.length; n++) {
663
+ let r = t[n];
664
+ if (r.pos == e.pos && r.sameState(e)) {
665
+ t[n].score < e.score && (t[n] = e);
666
+ return;
667
+ }
668
+ }
669
+ t.push(e);
670
+ }
671
+ var O = class {
672
+ constructor(e, t, n) {
673
+ this.source = e, this.flags = t, this.disabled = n;
674
+ }
675
+ allows(e) {
676
+ return !this.disabled || this.disabled[e] == 0;
677
+ }
678
+ }, k = (e) => e, A = class {
679
+ constructor(e) {
680
+ this.start = e.start, this.shift = e.shift || k, this.reduce = e.reduce || k, this.reuse = e.reuse || k, this.hash = e.hash || (() => 0), this.strict = e.strict !== !1;
681
+ }
682
+ }, j = class t extends a {
683
+ constructor(t) {
684
+ if (super(), this.wrappers = [], t.version != 14) throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);
685
+ let a = t.nodeNames.split(" ");
686
+ this.minRepeatTerm = a.length;
687
+ for (let e = 0; e < t.repeatNodeCount; e++) a.push("");
688
+ let o = Object.keys(t.topRules).map((e) => t.topRules[e][1]), s = [];
689
+ for (let e = 0; e < a.length; e++) s.push([]);
690
+ function c(e, t, n) {
691
+ s[e].push([t, t.deserialize(String(n))]);
692
+ }
693
+ if (t.nodeProps) for (let e of t.nodeProps) {
694
+ let t = e[0];
695
+ typeof t == "string" && (t = n[t]);
696
+ for (let n = 1; n < e.length;) {
697
+ let r = e[n++];
698
+ if (r >= 0) c(r, t, e[n++]);
699
+ else {
700
+ let i = e[n + -r];
701
+ for (let a = -r; a > 0; a--) c(e[n++], t, i);
702
+ n++;
703
+ }
704
+ }
705
+ }
706
+ this.nodeSet = new r(a.map((e, n) => i.define({
707
+ name: n >= this.minRepeatTerm ? void 0 : e,
708
+ id: n,
709
+ props: s[n],
710
+ top: o.indexOf(n) > -1,
711
+ error: n == 0,
712
+ skipped: t.skippedNodes && t.skippedNodes.indexOf(n) > -1
713
+ }))), t.propSources && (this.nodeSet = this.nodeSet.extend(...t.propSources)), this.strict = !1, this.bufferLength = e;
714
+ let l = d(t.tokenData);
715
+ this.context = t.context, this.specializerSpecs = t.specialized || [], this.specialized = new Uint16Array(this.specializerSpecs.length);
716
+ for (let e = 0; e < this.specializerSpecs.length; e++) this.specialized[e] = this.specializerSpecs[e].term;
717
+ this.specializers = this.specializerSpecs.map(P), this.states = d(t.states, Uint32Array), this.data = d(t.stateData), this.goto = d(t.goto), this.maxTerm = t.maxTerm, this.tokenizers = t.tokenizers.map((e) => typeof e == "number" ? new h(l, e) : e), this.topRules = t.topRules, this.dialects = t.dialects || {}, this.dynamicPrecedences = t.dynamicPrecedences || null, this.tokenPrecTable = t.tokenPrec, this.termNames = t.termNames || null, this.maxNode = this.nodeSet.types.length - 1, this.dialect = this.parseDialect(), this.top = this.topRules[Object.keys(this.topRules)[0]];
718
+ }
719
+ createParse(e, t, n) {
720
+ let r = new E(this, e, t, n);
721
+ for (let i of this.wrappers) r = i(r, e, t, n);
722
+ return r;
723
+ }
724
+ getGoto(e, t, n = !1) {
725
+ let r = this.goto;
726
+ if (t >= r[0]) return -1;
727
+ for (let i = r[t + 1];;) {
728
+ let t = r[i++], a = t & 1, o = r[i++];
729
+ if (a && n) return o;
730
+ for (let n = i + (t >> 1); i < n; i++) if (r[i] == e) return o;
731
+ if (a) return -1;
732
+ }
733
+ }
734
+ hasAction(e, t) {
735
+ let n = this.data;
736
+ for (let r = 0; r < 2; r++) for (let i = this.stateSlot(e, r ? 2 : 1), a;; i += 3) {
737
+ if ((a = n[i]) == 65535) if (n[i + 1] == 1) a = n[i = M(n, i + 2)];
738
+ else if (n[i + 1] == 2) return M(n, i + 2);
739
+ else break;
740
+ if (a == t || a == 0) return M(n, i + 1);
741
+ }
742
+ return 0;
743
+ }
744
+ stateSlot(e, t) {
745
+ return this.states[e * 6 + t];
746
+ }
747
+ stateFlag(e, t) {
748
+ return (this.stateSlot(e, 0) & t) > 0;
749
+ }
750
+ validAction(e, t) {
751
+ return !!this.allActions(e, (e) => e == t ? !0 : null);
752
+ }
753
+ allActions(e, t) {
754
+ let n = this.stateSlot(e, 4), r = n ? t(n) : void 0;
755
+ for (let n = this.stateSlot(e, 1); r == null; n += 3) {
756
+ if (this.data[n] == 65535) if (this.data[n + 1] == 1) n = M(this.data, n + 2);
757
+ else break;
758
+ r = t(M(this.data, n + 1));
759
+ }
760
+ return r;
761
+ }
762
+ nextStates(e) {
763
+ let t = [];
764
+ for (let n = this.stateSlot(e, 1);; n += 3) {
765
+ if (this.data[n] == 65535) if (this.data[n + 1] == 1) n = M(this.data, n + 2);
766
+ else break;
767
+ if (!(this.data[n + 2] & 1)) {
768
+ let e = this.data[n + 1];
769
+ t.some((t, n) => n & 1 && t == e) || t.push(this.data[n], e);
770
+ }
771
+ }
772
+ return t;
773
+ }
774
+ configure(e) {
775
+ let n = Object.assign(Object.create(t.prototype), this);
776
+ if (e.props && (n.nodeSet = this.nodeSet.extend(...e.props)), e.top) {
777
+ let t = this.topRules[e.top];
778
+ if (!t) throw RangeError(`Invalid top rule name ${e.top}`);
779
+ n.top = t;
780
+ }
781
+ return e.tokenizers && (n.tokenizers = this.tokenizers.map((t) => {
782
+ let n = e.tokenizers.find((e) => e.from == t);
783
+ return n ? n.to : t;
784
+ })), e.specializers && (n.specializers = this.specializers.slice(), n.specializerSpecs = this.specializerSpecs.map((t, r) => {
785
+ let i = e.specializers.find((e) => e.from == t.external);
786
+ if (!i) return t;
787
+ let a = Object.assign(Object.assign({}, t), { external: i.to });
788
+ return n.specializers[r] = P(a), a;
789
+ })), e.contextTracker && (n.context = e.contextTracker), e.dialect && (n.dialect = this.parseDialect(e.dialect)), e.strict != null && (n.strict = e.strict), e.wrap && (n.wrappers = n.wrappers.concat(e.wrap)), e.bufferLength != null && (n.bufferLength = e.bufferLength), n;
790
+ }
791
+ hasWrappers() {
792
+ return this.wrappers.length > 0;
793
+ }
794
+ getName(e) {
795
+ return this.termNames ? this.termNames[e] : String(e <= this.maxNode && this.nodeSet.types[e].name || e);
796
+ }
797
+ get eofTerm() {
798
+ return this.maxNode + 1;
799
+ }
800
+ get topNode() {
801
+ return this.nodeSet.types[this.top[1]];
802
+ }
803
+ dynamicPrecedence(e) {
804
+ let t = this.dynamicPrecedences;
805
+ return t == null ? 0 : t[e] || 0;
806
+ }
807
+ parseDialect(e) {
808
+ let t = Object.keys(this.dialects), n = t.map(() => !1);
809
+ if (e) for (let r of e.split(" ")) {
810
+ let e = t.indexOf(r);
811
+ e >= 0 && (n[e] = !0);
812
+ }
813
+ let r = null;
814
+ for (let e = 0; e < t.length; e++) if (!n[e]) for (let n = this.dialects[t[e]], i; (i = this.data[n++]) != 65535;) (r ||= new Uint8Array(this.maxTerm + 1))[i] = 1;
815
+ return new O(e, n, r);
816
+ }
817
+ static deserialize(e) {
818
+ return new t(e);
819
+ }
820
+ };
821
+ function M(e, t) {
822
+ return e[t] | e[t + 1] << 16;
823
+ }
824
+ function N(e) {
825
+ let t = null;
826
+ for (let n of e) {
827
+ let e = n.p.stoppedAt;
828
+ (n.pos == n.p.stream.end || e != null && n.pos > e) && n.p.parser.stateFlag(n.state, 2) && (!t || t.score < n.score) && (t = n);
829
+ }
830
+ return t;
831
+ }
832
+ function P(e) {
833
+ if (e.external) {
834
+ let t = +!!e.extend;
835
+ return (n, r) => e.external(n, r) << 1 | t;
836
+ }
837
+ return e.get;
838
+ }
839
+ //#endregion
840
+ export { A as ContextTracker, _ as ExternalTokenizer, j as LRParser, g as LocalTokenGroup };
841
+
842
+ //# sourceMappingURL=index.js.map