@oomol-lab/open-flow 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +47 -0
  3. package/README.md +18 -0
  4. package/dist/browser/_virtual_open-flow-twemoji-DJwKsM_w.js +5067 -0
  5. package/dist/browser/addNodeOptions-DqoIueCR.js +33746 -0
  6. package/dist/browser/assets/font-00b26ac825e20950.woff2 +0 -0
  7. package/dist/browser/assets/font-036d4e95149b69ff.woff2 +0 -0
  8. package/dist/browser/assets/font-07d8e303ce4fc12b.ttf +0 -0
  9. package/dist/browser/assets/font-08ce98e51b04d589.ttf +0 -0
  10. package/dist/browser/assets/font-0cdd387c9590a1a9.woff2 +0 -0
  11. package/dist/browser/assets/font-0d85ae7cc30f2379.ttf +0 -0
  12. package/dist/browser/assets/font-0f60d1b897938ec9.woff2 +0 -0
  13. package/dist/browser/assets/font-11e4dc8a6471ff6d.woff +0 -0
  14. package/dist/browser/assets/font-138ac28d1663b303.ttf +0 -0
  15. package/dist/browser/assets/font-1ae6bd7475590e97.woff +0 -0
  16. package/dist/browser/assets/font-1c67f068fea8bb09.ttf +0 -0
  17. package/dist/browser/assets/font-1e6f9579e90e2cac.ttf +0 -0
  18. package/dist/browser/assets/font-1ece03f79f95277d.ttf +0 -0
  19. package/dist/browser/assets/font-2014c523c3210bcc.woff +0 -0
  20. package/dist/browser/assets/font-30da91e84c893f87.woff +0 -0
  21. package/dist/browser/assets/font-3398dd02302557a7.woff +0 -0
  22. package/dist/browser/assets/font-3931dd81faed86ba.ttf +0 -0
  23. package/dist/browser/assets/font-500e04d54f0d5166.ttf +0 -0
  24. package/dist/browser/assets/font-51814d270d06ff02.woff2 +0 -0
  25. package/dist/browser/assets/font-5d53e70ad607c235.woff2 +0 -0
  26. package/dist/browser/assets/font-5e28753be717dac9.woff +0 -0
  27. package/dist/browser/assets/font-68534840bcfdd2bf.ttf +0 -0
  28. package/dist/browser/assets/font-68e8c73ef42afd3c.woff2 +0 -0
  29. package/dist/browser/assets/font-6ab6b62e9b62dae2.woff +0 -0
  30. package/dist/browser/assets/font-6b47c40166b6dbe2.woff2 +0 -0
  31. package/dist/browser/assets/font-70ee1f64a20f2048.ttf +0 -0
  32. package/dist/browser/assets/font-71d517d67827787c.woff2 +0 -0
  33. package/dist/browser/assets/font-73d591271b160496.woff2 +0 -0
  34. package/dist/browser/assets/font-74444efd593c005e.woff2 +0 -0
  35. package/dist/browser/assets/font-7af58c5ec8f132a2.woff2 +0 -0
  36. package/dist/browser/assets/font-850c0af5c2238497.woff +0 -0
  37. package/dist/browser/assets/font-8a8d244581371912.woff +0 -0
  38. package/dist/browser/assets/font-9163df9c7122432e.ttf +0 -0
  39. package/dist/browser/assets/font-91ee67500cc0129a.woff +0 -0
  40. package/dist/browser/assets/font-95b6d2f1a50173bf.ttf +0 -0
  41. package/dist/browser/assets/font-97479ca6cce906ab.woff2 +0 -0
  42. package/dist/browser/assets/font-99cd42a3c072d918.woff2 +0 -0
  43. package/dist/browser/assets/font-99f9c6750b489c94.woff +0 -0
  44. package/dist/browser/assets/font-9be7ceb88004ab8a.woff +0 -0
  45. package/dist/browser/assets/font-a4af7d414440a1c1.woff2 +0 -0
  46. package/dist/browser/assets/font-a6b2099fb555c60e.ttf +0 -0
  47. package/dist/browser/assets/font-a6f7ec0d846ac7ad.woff +0 -0
  48. package/dist/browser/assets/font-c2342cd8b869e017.woff2 +0 -0
  49. package/dist/browser/assets/font-c6368d87e8a1a3a5.woff +0 -0
  50. package/dist/browser/assets/font-c647367d1dd4e162.ttf +0 -0
  51. package/dist/browser/assets/font-c76c5d696297d51b.woff +0 -0
  52. package/dist/browser/assets/font-c943cc986384f59e.woff +0 -0
  53. package/dist/browser/assets/font-d0332f52868370fd.ttf +0 -0
  54. package/dist/browser/assets/font-d04c54219f9eaec6.woff2 +0 -0
  55. package/dist/browser/assets/font-d96cdf2b3bdd4d64.woff +0 -0
  56. package/dist/browser/assets/font-dc47344dbb6cb5b6.woff2 +0 -0
  57. package/dist/browser/assets/font-de7701e42cf1f4cf.woff2 +0 -0
  58. package/dist/browser/assets/font-e14fed02b1aba7ce.woff +0 -0
  59. package/dist/browser/assets/font-e99ae51144bf1232.woff2 +0 -0
  60. package/dist/browser/assets/font-ece03cfd83e22c21.woff +0 -0
  61. package/dist/browser/assets/font-ed0b74372feefcbb.ttf +0 -0
  62. package/dist/browser/assets/font-f01f3e87d9c6a61c.ttf +0 -0
  63. package/dist/browser/assets/font-f1d6ef86f3b11a52.woff +0 -0
  64. package/dist/browser/assets/font-f36ea897e19f4a2e.ttf +0 -0
  65. package/dist/browser/assets/font-f9377ab0271cda59.ttf +0 -0
  66. package/dist/browser/carbon-nMY84Amv.js +53 -0
  67. package/dist/browser/composite-7VwgfnXx.js +6088 -0
  68. package/dist/browser/createResourceDialog-ByuJWdSL.js +439 -0
  69. package/dist/browser/dist-7oZK9QXZ.js +50088 -0
  70. package/dist/browser/dist-B9OV3YTx.js +881 -0
  71. package/dist/browser/dist-BLk5M0uK.js +1816 -0
  72. package/dist/browser/dist-BbyiRq3c.js +3285 -0
  73. package/dist/browser/dist-CIq6ue3I.js +6646 -0
  74. package/dist/browser/dist-CLZJNoWB.js +89 -0
  75. package/dist/browser/dist-CvcmLAMW.js +1620 -0
  76. package/dist/browser/dist-DL0SDskM.js +2327 -0
  77. package/dist/browser/dist-Djd02JSy.js +1247 -0
  78. package/dist/browser/dist-aWSZx4q1.js +850 -0
  79. package/dist/browser/dist-n-z5HtaO.js +4 -0
  80. package/dist/browser/dist-o4dBuwiG.js +320 -0
  81. package/dist/browser/dist-zyY--HOV.js +1543 -0
  82. package/dist/browser/esm-DXw7EADW.js +218 -0
  83. package/dist/browser/favicon.svg +7 -0
  84. package/dist/browser/flowWorkspace-DwVMpcar.js +22092 -0
  85. package/dist/browser/lib-S4ccuMeT.js +7857 -0
  86. package/dist/browser/licenses.md +4973 -0
  87. package/dist/browser/markdownContent-ZZFfSRqO.js +44545 -0
  88. package/dist/browser/project-change.d.ts +311 -0
  89. package/dist/browser/project-change.js +259 -0
  90. package/dist/browser/project-notifications.d.ts +12 -0
  91. package/dist/browser/rolldown-runtime-CEFd7nDs.js +30 -0
  92. package/dist/browser/workbench-contract.d.ts +28 -0
  93. package/dist/browser/workbench.css +2 -0
  94. package/dist/browser/workbench.css.d.ts +1 -0
  95. package/dist/browser/workbench.d.ts +14 -0
  96. package/dist/browser/workbench.js +3364 -0
  97. package/dist/common/connector-action.d.ts +20 -0
  98. package/dist/common/connector-action.js +106 -0
  99. package/dist/common/connector-proxy.d.ts +14 -0
  100. package/dist/common/connector-proxy.js +0 -0
  101. package/dist/common/control-api-conformance.d.ts +13 -0
  102. package/dist/common/control-api-conformance.js +518 -0
  103. package/dist/common/control-api-errors.d.ts +121 -0
  104. package/dist/common/control-api.d.ts +349 -0
  105. package/dist/common/control-api.js +884 -0
  106. package/dist/common/cron-trigger.d.ts +21 -0
  107. package/dist/common/cron-trigger.js +834 -0
  108. package/dist/common/engine-contract.d.ts +7 -0
  109. package/dist/common/favicon.svg +7 -0
  110. package/dist/common/integration-trigger.d.ts +111 -0
  111. package/dist/common/integration-trigger.js +290 -0
  112. package/dist/common/licenses.md +27 -0
  113. package/dist/common/poll-trigger.d.ts +69 -0
  114. package/dist/common/poll-trigger.js +155 -0
  115. package/dist/common/project-encoding.d.ts +11 -0
  116. package/dist/common/project-encoding.js +242 -0
  117. package/dist/common/project-notifications.d.ts +12 -0
  118. package/dist/common/project-semantics.d.ts +55 -0
  119. package/dist/common/project-semantics.js +8687 -0
  120. package/dist/common/provider-triggers.d.ts +6 -0
  121. package/dist/common/provider-triggers.js +4614 -0
  122. package/dist/common/run-events.d.ts +9 -0
  123. package/dist/common/run-events.js +192 -0
  124. package/dist/common/run-lifecycle.d.ts +69 -0
  125. package/dist/common/run-lifecycle.js +169 -0
  126. package/dist/common/runtime-contract.d.ts +53 -0
  127. package/dist/common/runtime-contract.js +151 -0
  128. package/dist/common/scheduler.d.ts +99 -0
  129. package/dist/common/scheduler.js +379 -0
  130. package/dist/common/webhook-trigger.d.ts +22 -0
  131. package/dist/common/webhook-trigger.js +270 -0
  132. package/dist/index.d.ts +66 -0
  133. package/package.json +102 -0
@@ -0,0 +1,850 @@
1
+ import { c as e, d as t, l as n, m as r, p as i, s as a, u as o } from "./dist-zyY--HOV.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) {
82
+ let n = this.p.reused.length - 1;
83
+ (n < 0 || this.p.reused[n] != e) && (this.p.reused.push(e), n++);
84
+ let r = this.pos;
85
+ this.reducePos = this.pos = r + e.length, this.pushState(t, r), this.buffer.push(n, r, this.reducePos, -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)) {
145
+ if (t & 65536) {
146
+ let n = (t >> 19) - i;
147
+ if (n > 1) {
148
+ let r = t & 65535, i = this.stack.length - n * 3;
149
+ if (i >= 0 && e.getGoto(this.stack[i], r, !1) >= 0) return n << 19 | 65536 | r;
150
+ }
151
+ } else {
152
+ let e = n(t, i + 1);
153
+ if (e != null) return e;
154
+ }
155
+ }
156
+ });
157
+ };
158
+ return n(this.state, 0);
159
+ }
160
+ forceAll() {
161
+ for (; !this.p.parser.stateFlag(this.state, 2);) if (!this.forceReduce()) {
162
+ this.storeNode(0, this.pos, this.pos, 4, !0);
163
+ break;
164
+ }
165
+ return this;
166
+ }
167
+ get deadEnd() {
168
+ if (this.stack.length != 3) return !1;
169
+ let { parser: e } = this.p;
170
+ return e.data[e.stateSlot(this.state, 1)] == 65535 && !e.stateSlot(this.state, 4);
171
+ }
172
+ restart() {
173
+ this.storeNode(0, this.pos, this.pos, 4, !0), this.state = this.stack[0], this.stack.length = 0;
174
+ }
175
+ sameState(e) {
176
+ if (this.state != e.state || this.stack.length != e.stack.length) return !1;
177
+ for (let t = 0; t < this.stack.length; t += 3) if (this.stack[t] != e.stack[t]) return !1;
178
+ return !0;
179
+ }
180
+ get parser() {
181
+ return this.p.parser;
182
+ }
183
+ dialectEnabled(e) {
184
+ return this.p.parser.dialect.flags[e];
185
+ }
186
+ shiftContext(e, t) {
187
+ this.curContext && this.updateContext(this.curContext.tracker.shift(this.curContext.context, e, this, this.p.stream.reset(t)));
188
+ }
189
+ reduceContext(e, t) {
190
+ this.curContext && this.updateContext(this.curContext.tracker.reduce(this.curContext.context, e, this, this.p.stream.reset(t)));
191
+ }
192
+ emitContext() {
193
+ let e = this.buffer.length - 1;
194
+ (e < 0 || this.buffer[e] != -3) && this.buffer.push(this.curContext.hash, this.pos, this.pos, -3);
195
+ }
196
+ emitLookAhead() {
197
+ let e = this.buffer.length - 1;
198
+ (e < 0 || this.buffer[e] != -4) && this.buffer.push(this.lookAhead, this.pos, this.pos, -4);
199
+ }
200
+ updateContext(e) {
201
+ if (e != this.curContext.context) {
202
+ let t = new c(this.curContext.tracker, e);
203
+ t.hash != this.curContext.hash && this.emitContext(), this.curContext = t;
204
+ }
205
+ }
206
+ setLookAhead(e) {
207
+ return e <= this.lookAhead ? !1 : (this.emitLookAhead(), this.lookAhead = e, !0);
208
+ }
209
+ close() {
210
+ this.curContext && this.curContext.tracker.strict && this.emitContext(), this.lookAhead > 0 && this.emitLookAhead();
211
+ }
212
+ }, c = class {
213
+ constructor(e, t) {
214
+ this.tracker = e, this.context = t, this.hash = e.strict ? e.hash(t) : 0;
215
+ }
216
+ }, l = class {
217
+ constructor(e) {
218
+ this.start = e, this.state = e.state, this.stack = e.stack, this.base = this.stack.length;
219
+ }
220
+ reduce(e) {
221
+ let t = e & 65535, n = e >> 19;
222
+ 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;
223
+ let r = this.start.p.parser.getGoto(this.stack[this.base - 3], t, !0);
224
+ this.state = r;
225
+ }
226
+ }, u = class e {
227
+ constructor(e, t, n) {
228
+ this.stack = e, this.pos = t, this.index = n, this.buffer = e.buffer, this.index == 0 && this.maybeNext();
229
+ }
230
+ static create(t, n = t.bufferBase + t.buffer.length) {
231
+ return new e(t, n, n - t.bufferBase);
232
+ }
233
+ maybeNext() {
234
+ let e = this.stack.parent;
235
+ e != null && (this.index = this.stack.bufferBase - e.bufferBase, this.stack = e, this.buffer = e.buffer);
236
+ }
237
+ get id() {
238
+ return this.buffer[this.index - 4];
239
+ }
240
+ get start() {
241
+ return this.buffer[this.index - 3];
242
+ }
243
+ get end() {
244
+ return this.buffer[this.index - 2];
245
+ }
246
+ get size() {
247
+ return this.buffer[this.index - 1];
248
+ }
249
+ next() {
250
+ this.index -= 4, this.pos -= 4, this.index == 0 && this.maybeNext();
251
+ }
252
+ fork() {
253
+ return new e(this.stack, this.pos, this.index);
254
+ }
255
+ };
256
+ function d(e, t = Uint16Array) {
257
+ if (typeof e != "string") return e;
258
+ let n = null;
259
+ for (let r = 0, i = 0; r < e.length;) {
260
+ let a = 0;
261
+ for (;;) {
262
+ let t = e.charCodeAt(r++), n = !1;
263
+ if (t == 126) {
264
+ a = 65535;
265
+ break;
266
+ }
267
+ t >= 92 && t--, t >= 34 && t--;
268
+ let i = t - 32;
269
+ if (i >= 46 && (i -= 46, n = !0), a += i, n) break;
270
+ a *= 46;
271
+ }
272
+ n ? n[i++] = a : n = new t(a);
273
+ }
274
+ return n;
275
+ }
276
+ var f = class {
277
+ constructor() {
278
+ this.start = -1, this.value = -1, this.end = -1, this.extended = -1, this.lookAhead = 0, this.mask = 0, this.context = 0;
279
+ }
280
+ }, p = new f(), m = class {
281
+ constructor(e, t) {
282
+ 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();
283
+ }
284
+ resolveOffset(e, t) {
285
+ let n = this.range, r = this.rangeIndex, i = this.pos + e;
286
+ for (; i < n.from;) {
287
+ if (!r) return null;
288
+ let e = this.ranges[--r];
289
+ i -= n.from - e.to, n = e;
290
+ }
291
+ for (; t < 0 ? i > n.to : i >= n.to;) {
292
+ if (r == this.ranges.length - 1) return null;
293
+ let e = this.ranges[++r];
294
+ i += e.from - n.to, n = e;
295
+ }
296
+ return i;
297
+ }
298
+ clipPos(e) {
299
+ if (e >= this.range.from && e < this.range.to) return e;
300
+ for (let t of this.ranges) if (t.to > e) return Math.max(e, t.from);
301
+ return this.end;
302
+ }
303
+ peek(e) {
304
+ let t = this.chunkOff + e, n, r;
305
+ if (t >= 0 && t < this.chunk.length) n = this.pos + e, r = this.chunk.charCodeAt(t);
306
+ else {
307
+ let t = this.resolveOffset(e, 1);
308
+ if (t == null) return -1;
309
+ if (n = t, n >= this.chunk2Pos && n < this.chunk2Pos + this.chunk2.length) r = this.chunk2.charCodeAt(n - this.chunk2Pos);
310
+ else {
311
+ let e = this.rangeIndex, t = this.range;
312
+ for (; t.to <= n;) t = this.ranges[++e];
313
+ 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);
314
+ }
315
+ }
316
+ return n >= this.token.lookAhead && (this.token.lookAhead = n + 1), r;
317
+ }
318
+ acceptToken(e, t = 0) {
319
+ let n = t ? this.resolveOffset(t, -1) : this.pos;
320
+ if (n == null || n < this.token.start) throw RangeError("Token end out of bounds");
321
+ this.token.value = e, this.token.end = n;
322
+ }
323
+ acceptTokenTo(e, t) {
324
+ this.token.value = e, this.token.end = t;
325
+ }
326
+ getChunk() {
327
+ if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) {
328
+ let { chunk: e, chunkPos: t } = this;
329
+ this.chunk = this.chunk2, this.chunkPos = this.chunk2Pos, this.chunk2 = e, this.chunk2Pos = t, this.chunkOff = this.pos - this.chunkPos;
330
+ } else {
331
+ this.chunk2 = this.chunk, this.chunk2Pos = this.chunkPos;
332
+ let e = this.input.chunk(this.pos), t = this.pos + e.length;
333
+ this.chunk = t > this.range.to ? e.slice(0, this.range.to - this.pos) : e, this.chunkPos = this.pos, this.chunkOff = 0;
334
+ }
335
+ }
336
+ readNext() {
337
+ return this.next = this.chunkOff >= this.chunk.length && (this.getChunk(), this.chunkOff == this.chunk.length) ? -1 : this.chunk.charCodeAt(this.chunkOff);
338
+ }
339
+ advance(e = 1) {
340
+ for (this.chunkOff += e; this.pos + e >= this.range.to;) {
341
+ if (this.rangeIndex == this.ranges.length - 1) return this.setDone();
342
+ e -= this.range.to - this.pos, this.range = this.ranges[++this.rangeIndex], this.pos = this.range.from;
343
+ }
344
+ return this.pos += e, this.pos >= this.token.lookAhead && (this.token.lookAhead = this.pos + 1), this.readNext();
345
+ }
346
+ setDone() {
347
+ return this.pos = this.chunkPos = this.end, this.range = this.ranges[this.rangeIndex = this.ranges.length - 1], this.chunk = "", this.next = -1;
348
+ }
349
+ reset(e, t) {
350
+ if (t ? (this.token = t, t.start = e, t.lookAhead = e + 1, t.value = t.extended = -1) : this.token = p, this.pos != e) {
351
+ if (this.pos = e, e == this.end) return this.setDone(), this;
352
+ for (; e < this.range.from;) this.range = this.ranges[--this.rangeIndex];
353
+ for (; e >= this.range.to;) this.range = this.ranges[++this.rangeIndex];
354
+ e >= this.chunkPos && e < this.chunkPos + this.chunk.length ? this.chunkOff = e - this.chunkPos : (this.chunk = "", this.chunkOff = 0), this.readNext();
355
+ }
356
+ return this;
357
+ }
358
+ read(e, t) {
359
+ if (e >= this.chunkPos && t <= this.chunkPos + this.chunk.length) return this.chunk.slice(e - this.chunkPos, t - this.chunkPos);
360
+ if (e >= this.chunk2Pos && t <= this.chunk2Pos + this.chunk2.length) return this.chunk2.slice(e - this.chunk2Pos, t - this.chunk2Pos);
361
+ if (e >= this.range.from && t <= this.range.to) return this.input.read(e, t);
362
+ let n = "";
363
+ for (let r of this.ranges) {
364
+ if (r.from >= t) break;
365
+ r.to > e && (n += this.input.read(Math.max(r.from, e), Math.min(r.to, t)));
366
+ }
367
+ return n;
368
+ }
369
+ }, h = class {
370
+ constructor(e, t) {
371
+ this.data = e, this.id = t;
372
+ }
373
+ token(e, t) {
374
+ let { parser: n } = t.p;
375
+ v(this.data, e, t, this.id, n.data, n.tokenPrecTable);
376
+ }
377
+ };
378
+ h.prototype.contextual = h.prototype.fallback = h.prototype.extend = !1;
379
+ var g = class {
380
+ constructor(e, t, n) {
381
+ this.precTable = t, this.elseToken = n, this.data = typeof e == "string" ? d(e) : e;
382
+ }
383
+ token(e, t) {
384
+ let n = e.pos, r = 0;
385
+ for (;;) {
386
+ let n = e.next < 0, i = e.resolveOffset(1, 1);
387
+ if (v(this.data, e, t, 0, this.data, this.precTable), e.token.value > -1) break;
388
+ if (this.elseToken == null) return;
389
+ if (n || r++, i == null) break;
390
+ e.reset(i, e.token);
391
+ }
392
+ r && (e.reset(n, e.token), e.acceptToken(this.elseToken, r));
393
+ }
394
+ };
395
+ g.prototype.contextual = h.prototype.fallback = h.prototype.extend = !1;
396
+ var _ = class {
397
+ constructor(e, t = {}) {
398
+ this.token = e, this.contextual = !!t.contextual, this.fallback = !!t.fallback, this.extend = !!t.extend;
399
+ }
400
+ };
401
+ function v(e, t, n, r, i, a) {
402
+ let o = 0, s = 1 << r, { dialect: c } = n.p.parser;
403
+ scan: for (; (s & e[o]) != 0;) {
404
+ let n = e[o + 1];
405
+ for (let r = o + 3; r < n; r += 2) if ((e[r + 1] & s) > 0) {
406
+ let n = e[r];
407
+ if (c.allows(n) && (t.token.value == -1 || t.token.value == n || b(n, t.token.value, i, a))) {
408
+ t.acceptToken(n);
409
+ break;
410
+ }
411
+ }
412
+ let r = t.next, l = 0, u = e[o + 2];
413
+ if (t.next < 0 && u > l && e[n + u * 3 - 3] == 65535) {
414
+ o = e[n + u * 3 - 1];
415
+ continue scan;
416
+ }
417
+ for (; l < u;) {
418
+ let i = l + u >> 1, a = n + i + (i << 1), s = e[a], c = e[a + 1] || 65536;
419
+ if (r < s) u = i;
420
+ else if (r >= c) l = i + 1;
421
+ else {
422
+ o = e[a + 2], t.advance();
423
+ continue scan;
424
+ }
425
+ }
426
+ break;
427
+ }
428
+ }
429
+ function y(e, t, n) {
430
+ for (let r = t, i; (i = e[r]) != 65535; r++) if (i == n) return r - t;
431
+ return -1;
432
+ }
433
+ function b(e, t, n, r) {
434
+ let i = y(n, r, t);
435
+ return i < 0 || y(n, r, e) < i;
436
+ }
437
+ var x = typeof process < "u" && /\bparse\b/.test({}.LOG), S = null;
438
+ function C(t, n, r) {
439
+ let i = t.cursor(e.IncludeAnonymous);
440
+ for (i.moveTo(n);;) if (!(r < 0 ? i.childBefore(n) : i.childAfter(n))) for (;;) {
441
+ 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(t.length, Math.max(i.from + 1, n + 25));
442
+ if (r < 0 ? i.prevSibling() : i.nextSibling()) break;
443
+ if (!i.parent()) return r < 0 ? 0 : t.length;
444
+ }
445
+ }
446
+ var w = class {
447
+ constructor(e, t) {
448
+ this.fragments = e, this.nodeSet = t, this.i = 0, this.fragment = null, this.safeFrom = -1, this.safeTo = -1, this.trees = [], this.start = [], this.index = [], this.nextFragment();
449
+ }
450
+ nextFragment() {
451
+ let e = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++];
452
+ if (e) {
453
+ 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();
454
+ this.trees.push(e.tree), this.start.push(-e.offset), this.index.push(0), this.nextStart = this.safeFrom;
455
+ } else this.nextStart = 1e9;
456
+ }
457
+ nodeAt(e) {
458
+ if (e < this.nextStart) return null;
459
+ for (; this.fragment && this.safeTo <= e;) this.nextFragment();
460
+ if (!this.fragment) return null;
461
+ for (;;) {
462
+ let t = this.trees.length - 1;
463
+ if (t < 0) return this.nextFragment(), null;
464
+ let i = this.trees[t], a = this.index[t];
465
+ if (a == i.children.length) {
466
+ this.trees.pop(), this.start.pop(), this.index.pop();
467
+ continue;
468
+ }
469
+ let o = i.children[a], s = this.start[t] + i.positions[a];
470
+ if (s > e) return this.nextStart = s, null;
471
+ if (o instanceof r) {
472
+ if (s == e) {
473
+ if (s < this.safeFrom) return null;
474
+ let e = s + o.length;
475
+ if (e <= this.safeTo) {
476
+ let t = o.prop(n.lookAhead);
477
+ if (!t || e + t < this.fragment.to) return o;
478
+ }
479
+ }
480
+ this.index[t]++, s + o.length >= Math.max(this.safeFrom, e) && (this.trees.push(o), this.start.push(s), this.index.push(0));
481
+ } else this.index[t]++, this.nextStart = s + o.length;
482
+ }
483
+ }
484
+ }, T = class {
485
+ constructor(e, t) {
486
+ this.stream = t, this.tokens = [], this.mainToken = null, this.actions = [], this.tokens = e.tokenizers.map((e) => new f());
487
+ }
488
+ getActions(e) {
489
+ 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;
490
+ for (let r = 0; r < i.length; r++) {
491
+ if (!(1 << r & a)) continue;
492
+ let c = i[r], l = this.tokens[r];
493
+ 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)) {
494
+ let r = t;
495
+ 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;
496
+ }
497
+ }
498
+ for (; this.actions.length > t;) this.actions.pop();
499
+ 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;
500
+ }
501
+ getMainToken(e) {
502
+ if (this.mainToken) return this.mainToken;
503
+ let t = new f(), { pos: n, p: r } = e;
504
+ return t.start = n, t.end = Math.min(n + 1, r.stream.end), t.value = n == r.stream.end ? r.parser.eofTerm : 0, t;
505
+ }
506
+ updateCachedToken(e, t, n) {
507
+ let r = this.stream.clipPos(n.pos);
508
+ if (t.token(this.stream.reset(r, e), n), e.value > -1) {
509
+ let { parser: t } = n.p;
510
+ for (let r = 0; r < t.specialized.length; r++) if (t.specialized[r] == e.value) {
511
+ let i = t.specializers[r](this.stream.read(e.start, e.end), n);
512
+ if (i >= 0 && n.p.parser.dialect.allows(i >> 1)) {
513
+ i & 1 ? e.extended = i >> 1 : e.value = i >> 1;
514
+ break;
515
+ }
516
+ }
517
+ } else e.value = 0, e.end = this.stream.clipPos(r + 1);
518
+ }
519
+ putAction(e, t, n, r) {
520
+ for (let t = 0; t < r; t += 3) if (this.actions[t] == e) return r;
521
+ return this.actions[r++] = e, this.actions[r++] = t, this.actions[r++] = n, r;
522
+ }
523
+ addActions(e, t, n, r) {
524
+ let { state: i } = e, { parser: a } = e.p, { data: o } = a;
525
+ for (let e = 0; e < 2; e++) for (let s = a.stateSlot(i, e ? 2 : 1);; s += 3) {
526
+ if (o[s] == 65535) {
527
+ if (o[s + 1] == 1) s = M(o, s + 2);
528
+ else {
529
+ r == 0 && o[s + 1] == 2 && (r = this.putAction(M(o, s + 2), t, n, r));
530
+ break;
531
+ }
532
+ }
533
+ o[s] == t && (r = this.putAction(M(o, s + 1), t, n, r));
534
+ }
535
+ return r;
536
+ }
537
+ }, E = class {
538
+ constructor(e, t, n, r) {
539
+ 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];
540
+ let { from: i } = r[0];
541
+ this.stacks = [s.start(this, e.top[0], i)], this.fragments = n.length && this.stream.end - i > e.bufferLength * 4 ? new w(n, e.nodeSet) : null;
542
+ }
543
+ get parsedPos() {
544
+ return this.minStackPos;
545
+ }
546
+ advance() {
547
+ let e = this.stacks, t = this.minStackPos, n = this.stacks = [], r, i;
548
+ if (this.bigReductionCount > 300 && e.length == 1) {
549
+ let [t] = e;
550
+ for (; t.forceReduce() && t.stack.length && t.stack[t.stack.length - 2] >= this.lastBigReductionStart;);
551
+ this.bigReductionCount = this.lastBigReductionSize = 0;
552
+ }
553
+ for (let a = 0; a < e.length; a++) {
554
+ let o = e[a];
555
+ for (;;) {
556
+ if (this.tokens.mainToken = null, o.pos > t) n.push(o);
557
+ else if (this.advanceStack(o, n, e)) continue;
558
+ else {
559
+ r || (r = [], i = []), r.push(o);
560
+ let e = this.tokens.getMainToken(o);
561
+ i.push(e.value, e.end);
562
+ }
563
+ break;
564
+ }
565
+ }
566
+ if (!n.length) {
567
+ let e = r && N(r);
568
+ if (e) return x && console.log("Finish with " + this.stackID(e)), this.stackToTree(e);
569
+ 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);
570
+ this.recovering ||= 5;
571
+ }
572
+ if (this.recovering && r) {
573
+ let e = this.stoppedAt != null && r[0].pos > this.stoppedAt ? r[0] : this.runRecovery(r, i, n);
574
+ if (e) return x && console.log("Force-finish " + this.stackID(e)), this.stackToTree(e.forceAll());
575
+ }
576
+ if (this.recovering) {
577
+ let e = this.recovering == 1 ? 1 : this.recovering * 3;
578
+ if (n.length > e) for (n.sort((e, t) => t.score - e.score); n.length > e;) n.pop();
579
+ n.some((e) => e.reducePos > t) && this.recovering--;
580
+ } else if (n.length > 1) {
581
+ outer: for (let e = 0; e < n.length - 1; e++) {
582
+ let t = n[e];
583
+ for (let r = e + 1; r < n.length; r++) {
584
+ let i = n[r];
585
+ if (t.sameState(i) || t.buffer.length > 500 && i.buffer.length > 500) {
586
+ if ((t.score - i.score || t.buffer.length - i.buffer.length) > 0) n.splice(r--, 1);
587
+ else {
588
+ n.splice(e--, 1);
589
+ continue outer;
590
+ }
591
+ }
592
+ }
593
+ }
594
+ n.length > 12 && (n.sort((e, t) => t.score - e.score), n.splice(12, n.length - 12));
595
+ }
596
+ this.minStackPos = n[0].pos;
597
+ for (let e = 1; e < n.length; e++) n[e].pos < this.minStackPos && (this.minStackPos = n[e].pos);
598
+ return null;
599
+ }
600
+ stopAt(e) {
601
+ if (this.stoppedAt != null && this.stoppedAt < e) throw RangeError("Can't move stoppedAt forward");
602
+ this.stoppedAt = e;
603
+ }
604
+ advanceStack(e, t, i) {
605
+ let a = e.pos, { parser: o } = this, s = x ? this.stackID(e) + " -> " : "";
606
+ if (this.stoppedAt != null && a > this.stoppedAt) return e.forceReduce() ? e : null;
607
+ if (this.fragments) {
608
+ let t = e.curContext && e.curContext.tracker.strict, i = t ? e.curContext.hash : 0;
609
+ for (let c = this.fragments.nodeAt(a); c;) {
610
+ let a = this.parser.nodeSet.types[c.type.id] == c.type ? o.getGoto(e.state, c.type.id) : -1;
611
+ if (a > -1 && c.length && (!t || (c.prop(n.contextHash) || 0) == i)) return e.useNode(c, a), x && console.log(s + this.stackID(e) + ` (via reuse of ${o.getName(c.type.id)})`), !0;
612
+ if (!(c instanceof r) || c.children.length == 0 || c.positions[0] > 0) break;
613
+ let l = c.children[0];
614
+ if (l instanceof r && c.positions[0] == 0) c = l;
615
+ else break;
616
+ }
617
+ }
618
+ let c = o.stateSlot(e.state, 4);
619
+ if (c > 0) return e.reduce(c), x && console.log(s + this.stackID(e) + ` (via always-reduce ${o.getName(c & 65535)})`), !0;
620
+ if (e.stack.length >= 8400) for (; e.stack.length > 6e3 && e.forceReduce(););
621
+ let l = this.tokens.getActions(e);
622
+ for (let n = 0; n < l.length;) {
623
+ let r = l[n++], c = l[n++], u = l[n++], d = n == l.length || !i, f = d ? e : e.split(), p = this.tokens.mainToken;
624
+ if (f.apply(r, c, p ? p.start : f.pos, u), x && console.log(s + this.stackID(f) + ` (via ${r & 65536 ? `reduce of ${o.getName(r & 65535)}` : "shift"} for ${o.getName(c)} @ ${a}${f == e ? "" : ", split"})`), d) return !0;
625
+ f.pos > a ? t.push(f) : i.push(f);
626
+ }
627
+ return !1;
628
+ }
629
+ advanceFully(e, t) {
630
+ let n = e.pos;
631
+ for (;;) {
632
+ if (!this.advanceStack(e, null, null)) return !1;
633
+ if (e.pos > n) return D(e, t), !0;
634
+ }
635
+ }
636
+ runRecovery(e, t, n) {
637
+ let r = null, i = !1;
638
+ for (let a = 0; a < e.length; a++) {
639
+ let o = e[a], s = t[a << 1], c = t[(a << 1) + 1], l = x ? this.stackID(o) + " -> " : "";
640
+ if (o.deadEnd && (i || (i = !0, o.restart(), x && console.log(l + this.stackID(o) + " (restarted)"), this.advanceFully(o, n)))) continue;
641
+ let u = o.split(), d = l;
642
+ 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) + " -> ");
643
+ for (let e of o.recoverByInsert(s)) x && console.log(l + this.stackID(e) + " (via recover-insert)"), this.advanceFully(e, n);
644
+ 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);
645
+ }
646
+ return r;
647
+ }
648
+ stackToTree(e) {
649
+ return e.close(), r.build({
650
+ buffer: u.create(e),
651
+ nodeSet: this.parser.nodeSet,
652
+ topID: this.topTerm,
653
+ maxBufferLength: this.parser.bufferLength,
654
+ reused: this.reused,
655
+ start: this.ranges[0].from,
656
+ length: e.pos - this.ranges[0].from,
657
+ minRepeatType: this.parser.minRepeatTerm
658
+ });
659
+ }
660
+ stackID(e) {
661
+ let t = (S ||= /* @__PURE__ */ new WeakMap()).get(e);
662
+ return t || S.set(e, t = String.fromCodePoint(this.nextStackID++)), t + e;
663
+ }
664
+ };
665
+ function D(e, t) {
666
+ for (let n = 0; n < t.length; n++) {
667
+ let r = t[n];
668
+ if (r.pos == e.pos && r.sameState(e)) {
669
+ t[n].score < e.score && (t[n] = e);
670
+ return;
671
+ }
672
+ }
673
+ t.push(e);
674
+ }
675
+ var O = class {
676
+ constructor(e, t, n) {
677
+ this.source = e, this.flags = t, this.disabled = n;
678
+ }
679
+ allows(e) {
680
+ return !this.disabled || this.disabled[e] == 0;
681
+ }
682
+ }, k = (e) => e, A = class {
683
+ constructor(e) {
684
+ 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;
685
+ }
686
+ }, j = class e extends i {
687
+ constructor(e) {
688
+ if (super(), this.wrappers = [], e.version != 14) throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);
689
+ let r = e.nodeNames.split(" ");
690
+ this.minRepeatTerm = r.length;
691
+ for (let t = 0; t < e.repeatNodeCount; t++) r.push("");
692
+ let i = Object.keys(e.topRules).map((t) => e.topRules[t][1]), s = [];
693
+ for (let e = 0; e < r.length; e++) s.push([]);
694
+ function c(e, t, n) {
695
+ s[e].push([t, t.deserialize(String(n))]);
696
+ }
697
+ if (e.nodeProps) for (let t of e.nodeProps) {
698
+ let e = t[0];
699
+ typeof e == "string" && (e = n[e]);
700
+ for (let n = 1; n < t.length;) {
701
+ let r = t[n++];
702
+ if (r >= 0) c(r, e, t[n++]);
703
+ else {
704
+ let i = t[n + -r];
705
+ for (let a = -r; a > 0; a--) c(t[n++], e, i);
706
+ n++;
707
+ }
708
+ }
709
+ }
710
+ this.nodeSet = new o(r.map((n, r) => t.define({
711
+ name: r >= this.minRepeatTerm ? void 0 : n,
712
+ id: r,
713
+ props: s[r],
714
+ top: i.indexOf(r) > -1,
715
+ error: r == 0,
716
+ skipped: e.skippedNodes && e.skippedNodes.indexOf(r) > -1
717
+ }))), e.propSources && (this.nodeSet = this.nodeSet.extend(...e.propSources)), this.strict = !1, this.bufferLength = a;
718
+ let l = d(e.tokenData);
719
+ this.context = e.context, this.specializerSpecs = e.specialized || [], this.specialized = new Uint16Array(this.specializerSpecs.length);
720
+ for (let e = 0; e < this.specializerSpecs.length; e++) this.specialized[e] = this.specializerSpecs[e].term;
721
+ this.specializers = this.specializerSpecs.map(P), this.states = d(e.states, Uint32Array), this.data = d(e.stateData), this.goto = d(e.goto), this.maxTerm = e.maxTerm, this.tokenizers = e.tokenizers.map((e) => typeof e == "number" ? new h(l, e) : e), this.topRules = e.topRules, this.dialects = e.dialects || {}, this.dynamicPrecedences = e.dynamicPrecedences || null, this.tokenPrecTable = e.tokenPrec, this.termNames = e.termNames || null, this.maxNode = this.nodeSet.types.length - 1, this.dialect = this.parseDialect(), this.top = this.topRules[Object.keys(this.topRules)[0]];
722
+ }
723
+ createParse(e, t, n) {
724
+ let r = new E(this, e, t, n);
725
+ for (let i of this.wrappers) r = i(r, e, t, n);
726
+ return r;
727
+ }
728
+ getGoto(e, t, n = !1) {
729
+ let r = this.goto;
730
+ if (t >= r[0]) return -1;
731
+ for (let i = r[t + 1];;) {
732
+ let t = r[i++], a = t & 1, o = r[i++];
733
+ if (a && n) return o;
734
+ for (let n = i + (t >> 1); i < n; i++) if (r[i] == e) return o;
735
+ if (a) return -1;
736
+ }
737
+ }
738
+ hasAction(e, t) {
739
+ let n = this.data;
740
+ for (let r = 0; r < 2; r++) for (let i = this.stateSlot(e, r ? 2 : 1), a;; i += 3) {
741
+ if ((a = n[i]) == 65535) {
742
+ if (n[i + 1] == 1) a = n[i = M(n, i + 2)];
743
+ else if (n[i + 1] == 2) return M(n, i + 2);
744
+ else break;
745
+ }
746
+ if (a == t || a == 0) return M(n, i + 1);
747
+ }
748
+ return 0;
749
+ }
750
+ stateSlot(e, t) {
751
+ return this.states[e * 6 + t];
752
+ }
753
+ stateFlag(e, t) {
754
+ return (this.stateSlot(e, 0) & t) > 0;
755
+ }
756
+ validAction(e, t) {
757
+ return !!this.allActions(e, (e) => e == t || null);
758
+ }
759
+ allActions(e, t) {
760
+ let n = this.stateSlot(e, 4), r = n ? t(n) : void 0;
761
+ for (let n = this.stateSlot(e, 1); r == null; n += 3) {
762
+ if (this.data[n] == 65535) {
763
+ if (this.data[n + 1] == 1) n = M(this.data, n + 2);
764
+ else break;
765
+ }
766
+ r = t(M(this.data, n + 1));
767
+ }
768
+ return r;
769
+ }
770
+ nextStates(e) {
771
+ let t = [];
772
+ for (let n = this.stateSlot(e, 1);; n += 3) {
773
+ if (this.data[n] == 65535) {
774
+ if (this.data[n + 1] == 1) n = M(this.data, n + 2);
775
+ else break;
776
+ }
777
+ if (!(this.data[n + 2] & 1)) {
778
+ let e = this.data[n + 1];
779
+ t.some((t, n) => n & 1 && t == e) || t.push(this.data[n], e);
780
+ }
781
+ }
782
+ return t;
783
+ }
784
+ configure(t) {
785
+ let n = Object.assign(Object.create(e.prototype), this);
786
+ if (t.props && (n.nodeSet = this.nodeSet.extend(...t.props)), t.top) {
787
+ let e = this.topRules[t.top];
788
+ if (!e) throw RangeError(`Invalid top rule name ${t.top}`);
789
+ n.top = e;
790
+ }
791
+ return t.tokenizers && (n.tokenizers = this.tokenizers.map((e) => {
792
+ let n = t.tokenizers.find((t) => t.from == e);
793
+ return n ? n.to : e;
794
+ })), t.specializers && (n.specializers = this.specializers.slice(), n.specializerSpecs = this.specializerSpecs.map((e, r) => {
795
+ let i = t.specializers.find((t) => t.from == e.external);
796
+ if (!i) return e;
797
+ let a = Object.assign(Object.assign({}, e), { external: i.to });
798
+ return n.specializers[r] = P(a), a;
799
+ })), t.contextTracker && (n.context = t.contextTracker), t.dialect && (n.dialect = this.parseDialect(t.dialect)), t.strict != null && (n.strict = t.strict), t.wrap && (n.wrappers = n.wrappers.concat(t.wrap)), t.bufferLength != null && (n.bufferLength = t.bufferLength), n;
800
+ }
801
+ hasWrappers() {
802
+ return this.wrappers.length > 0;
803
+ }
804
+ getName(e) {
805
+ return this.termNames ? this.termNames[e] : String(e <= this.maxNode && this.nodeSet.types[e].name || e);
806
+ }
807
+ get eofTerm() {
808
+ return this.maxNode + 1;
809
+ }
810
+ get topNode() {
811
+ return this.nodeSet.types[this.top[1]];
812
+ }
813
+ dynamicPrecedence(e) {
814
+ let t = this.dynamicPrecedences;
815
+ return t == null ? 0 : t[e] || 0;
816
+ }
817
+ parseDialect(e) {
818
+ let t = Object.keys(this.dialects), n = t.map(() => !1);
819
+ if (e) for (let r of e.split(" ")) {
820
+ let e = t.indexOf(r);
821
+ e >= 0 && (n[e] = !0);
822
+ }
823
+ let r = null;
824
+ 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;
825
+ return new O(e, n, r);
826
+ }
827
+ static deserialize(t) {
828
+ return new e(t);
829
+ }
830
+ };
831
+ function M(e, t) {
832
+ return e[t] | e[t + 1] << 16;
833
+ }
834
+ function N(e) {
835
+ let t = null;
836
+ for (let n of e) {
837
+ let e = n.p.stoppedAt;
838
+ (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);
839
+ }
840
+ return t;
841
+ }
842
+ function P(e) {
843
+ if (e.external) {
844
+ let t = +!!e.extend;
845
+ return (n, r) => e.external(n, r) << 1 | t;
846
+ }
847
+ return e.get;
848
+ }
849
+ //#endregion
850
+ export { g as i, _ as n, j as r, A as t };