soonjs 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deps/acorn-MFuat2YCgG-a0f2qluvb.js +2895 -0
- package/dist/deps/angular-Nz7Izt9RB4-8d185udek.js +1448 -0
- package/dist/deps/babel-JaNXSJC73c-pc0g0fmtn.js +6844 -0
- package/dist/deps/estree-lrVsLbm9_D-jydmzr25c.js +4265 -0
- package/dist/deps/flow-MAZ63dnw8p-i739m6sal.js +26221 -0
- package/dist/deps/glimmer-SKEURx3bl3-3a2v55mld.js +2756 -0
- package/dist/deps/graphql--N7MQg-wpp-78cbwdkje.js +1212 -0
- package/dist/deps/html-WW7XljTSl6-28a7aunx8.js +2623 -0
- package/dist/deps/markdown-i-DCK3AslU-5i25bq114.js +3058 -0
- package/dist/deps/meriyah-0-URq6zZ8n-u4z9qyg3b.js +2320 -0
- package/dist/deps/postcss-urUw1vxeu1-ydk70nyqq.js +4664 -0
- package/dist/deps/soon-id-t25L9qRGGZ-288hx3ptk.js +30 -0
- package/dist/deps/typescript-5-LBeuVeDB-9bedulcbd.js +12794 -0
- package/dist/deps/yaml-zChCAOpgM7-1q3vdmq25.js +4088 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/vite-plugin-soon-client.cjs +2 -2
- package/dist/vite-plugin-soon-client.js +14 -14
- package/dist/vite-plugin-soon-server.cjs +1 -1
- package/dist/vite-plugin-soon-server.js +1 -1
- package/package.json +1 -1
- /package/dist/deps/{acorn-GEHm0ZzYiF.js → acorn-MFuat2YCgG-gq1dwj2gm.js} +0 -0
- /package/dist/deps/{angular-AsYEFZGiaL.js → angular-Nz7Izt9RB4-zgpswg7po.js} +0 -0
- /package/dist/deps/{babel-JF5SXjDJMg.js → babel-JaNXSJC73c-yfvkw69js.js} +0 -0
- /package/dist/deps/{estree-mpHydeVRIX.js → estree-lrVsLbm9_D-ucgqa6aod.js} +0 -0
- /package/dist/deps/{flow-Nrt1FQ_Vve.js → flow-MAZ63dnw8p-72uv9wv8r.js} +0 -0
- /package/dist/deps/{glimmer-wulBvI3ec4.js → glimmer-SKEURx3bl3-dqv71plrz.js} +0 -0
- /package/dist/deps/{graphql-RtYSaK2zvJ.js → graphql--N7MQg-wpp-btxnkdcgl.js} +0 -0
- /package/dist/deps/{html-Rhm0swv15v.js → html-WW7XljTSl6-0ef7pzyhx.js} +0 -0
- /package/dist/deps/{markdown-lYixUp5UIZ.js → markdown-i-DCK3AslU-eq4njnyep.js} +0 -0
- /package/dist/deps/{meriyah-sFHGgRXFc5.js → meriyah-0-URq6zZ8n-1eq5crt5w.js} +0 -0
- /package/dist/deps/{postcss-R-fq3Fq8sV.js → postcss-urUw1vxeu1-k2m4q2p09.js} +0 -0
- /package/dist/deps/{soon-id-mHYJjIZNTr.js → soon-id-t25L9qRGGZ-o8la0hfoe.js} +0 -0
- /package/dist/deps/{typescript-VhxF0z88nS.js → typescript-5-LBeuVeDB-5ji5cpzuo.js} +0 -0
- /package/dist/deps/{yaml-bWZoUlV7rd.js → yaml-zChCAOpgM7-6fkmi0o8o.js} +0 -0
|
@@ -0,0 +1,2895 @@
|
|
|
1
|
+
var Ze = Object.create, Ut = Object.defineProperty, ts = Object.getOwnPropertyDescriptor, es = Object.getOwnPropertyNames, ss = Object.getPrototypeOf, is = Object.prototype.hasOwnProperty, ae = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports), rs = (t, e) => {
|
|
2
|
+
for (var s in e) Ut(t, s, { get: e[s], enumerable: !0 });
|
|
3
|
+
}, as = (t, e, s, i) => {
|
|
4
|
+
if (e && typeof e == "object" || typeof e == "function") for (let r of es(e)) !is.call(t, r) && r !== s && Ut(t, r, { get: () => e[r], enumerable: !(i = ts(e, r)) || i.enumerable });
|
|
5
|
+
return t;
|
|
6
|
+
}, ne = (t, e, s) => (s = t != null ? Ze(ss(t)) : {}, as(Ut(s, "default", { value: t, enumerable: !0 }), t)), ns = ae((t, e) => {
|
|
7
|
+
e.exports = {};
|
|
8
|
+
}), oe = ae((t, e) => {
|
|
9
|
+
var s = ns(), i = /^[\da-fA-F]+$/, r = /^\d+$/, n = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
function o(c) {
|
|
11
|
+
c = c.Parser.acorn || c;
|
|
12
|
+
let d = n.get(c);
|
|
13
|
+
if (!d) {
|
|
14
|
+
let E = c.tokTypes, _ = c.TokContext, C = c.TokenType, b = new _("<tag", !1), B = new _("</tag", !1), F = new _("<tag>...</tag>", !0, !0), j = { tc_oTag: b, tc_cTag: B, tc_expr: F }, Z = { jsxName: new C("jsxName"), jsxText: new C("jsxText", { beforeExpr: !0 }), jsxTagStart: new C("jsxTagStart", { startsExpr: !0 }), jsxTagEnd: new C("jsxTagEnd") };
|
|
15
|
+
Z.jsxTagStart.updateContext = function() {
|
|
16
|
+
this.context.push(F), this.context.push(b), this.exprAllowed = !1;
|
|
17
|
+
}, Z.jsxTagEnd.updateContext = function(lt) {
|
|
18
|
+
let dt = this.context.pop();
|
|
19
|
+
dt === b && lt === E.slash || dt === B ? (this.context.pop(), this.exprAllowed = this.curContext() === F) : this.exprAllowed = !0;
|
|
20
|
+
}, d = { tokContexts: j, tokTypes: Z }, n.set(c, d);
|
|
21
|
+
}
|
|
22
|
+
return d;
|
|
23
|
+
}
|
|
24
|
+
function u(c) {
|
|
25
|
+
if (!c) return c;
|
|
26
|
+
if (c.type === "JSXIdentifier") return c.name;
|
|
27
|
+
if (c.type === "JSXNamespacedName") return c.namespace.name + ":" + c.name.name;
|
|
28
|
+
if (c.type === "JSXMemberExpression") return u(c.object) + "." + u(c.property);
|
|
29
|
+
}
|
|
30
|
+
e.exports = function(c) {
|
|
31
|
+
return c = c || {}, function(d) {
|
|
32
|
+
return p({ allowNamespaces: c.allowNamespaces !== !1, allowNamespacedObjects: !!c.allowNamespacedObjects }, d);
|
|
33
|
+
};
|
|
34
|
+
}, Object.defineProperty(e.exports, "tokTypes", { get: function() {
|
|
35
|
+
return o(void 0).tokTypes;
|
|
36
|
+
}, configurable: !0, enumerable: !0 });
|
|
37
|
+
function p(c, d) {
|
|
38
|
+
let E = d.acorn || void 0, _ = o(E), C = E.tokTypes, b = _.tokTypes, B = E.tokContexts, F = _.tokContexts.tc_oTag, j = _.tokContexts.tc_cTag, Z = _.tokContexts.tc_expr, lt = E.isNewLine, dt = E.isIdentifierStart, Ye = E.isIdentifierChar;
|
|
39
|
+
return class extends d {
|
|
40
|
+
static get acornJsx() {
|
|
41
|
+
return _;
|
|
42
|
+
}
|
|
43
|
+
jsx_readToken() {
|
|
44
|
+
let h = "", y = this.pos;
|
|
45
|
+
for (; ; ) {
|
|
46
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated JSX contents");
|
|
47
|
+
let x = this.input.charCodeAt(this.pos);
|
|
48
|
+
switch (x) {
|
|
49
|
+
case 60:
|
|
50
|
+
case 123:
|
|
51
|
+
return this.pos === this.start ? x === 60 && this.exprAllowed ? (++this.pos, this.finishToken(b.jsxTagStart)) : this.getTokenFromCode(x) : (h += this.input.slice(y, this.pos), this.finishToken(b.jsxText, h));
|
|
52
|
+
case 38:
|
|
53
|
+
h += this.input.slice(y, this.pos), h += this.jsx_readEntity(), y = this.pos;
|
|
54
|
+
break;
|
|
55
|
+
case 62:
|
|
56
|
+
case 125:
|
|
57
|
+
this.raise(this.pos, "Unexpected token `" + this.input[this.pos] + "`. Did you mean `" + (x === 62 ? ">" : "}") + '` or `{"' + this.input[this.pos] + '"}`?');
|
|
58
|
+
default:
|
|
59
|
+
lt(x) ? (h += this.input.slice(y, this.pos), h += this.jsx_readNewLine(!0), y = this.pos) : ++this.pos;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
jsx_readNewLine(h) {
|
|
64
|
+
let y = this.input.charCodeAt(this.pos), x;
|
|
65
|
+
return ++this.pos, y === 13 && this.input.charCodeAt(this.pos) === 10 ? (++this.pos, x = h ? `
|
|
66
|
+
` : `\r
|
|
67
|
+
`) : x = String.fromCharCode(y), this.options.locations && (++this.curLine, this.lineStart = this.pos), x;
|
|
68
|
+
}
|
|
69
|
+
jsx_readString(h) {
|
|
70
|
+
let y = "", x = ++this.pos;
|
|
71
|
+
for (; ; ) {
|
|
72
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
73
|
+
let S = this.input.charCodeAt(this.pos);
|
|
74
|
+
if (S === h) break;
|
|
75
|
+
S === 38 ? (y += this.input.slice(x, this.pos), y += this.jsx_readEntity(), x = this.pos) : lt(S) ? (y += this.input.slice(x, this.pos), y += this.jsx_readNewLine(!1), x = this.pos) : ++this.pos;
|
|
76
|
+
}
|
|
77
|
+
return y += this.input.slice(x, this.pos++), this.finishToken(C.string, y);
|
|
78
|
+
}
|
|
79
|
+
jsx_readEntity() {
|
|
80
|
+
let h = "", y = 0, x, S = this.input[this.pos];
|
|
81
|
+
S !== "&" && this.raise(this.pos, "Entity must start with an ampersand");
|
|
82
|
+
let $ = ++this.pos;
|
|
83
|
+
for (; this.pos < this.input.length && y++ < 10; ) {
|
|
84
|
+
if (S = this.input[this.pos++], S === ";") {
|
|
85
|
+
h[0] === "#" ? h[1] === "x" ? (h = h.substr(2), i.test(h) && (x = String.fromCharCode(parseInt(h, 16)))) : (h = h.substr(1), r.test(h) && (x = String.fromCharCode(parseInt(h, 10)))) : x = s[h];
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
h += S;
|
|
89
|
+
}
|
|
90
|
+
return x || (this.pos = $, "&");
|
|
91
|
+
}
|
|
92
|
+
jsx_readWord() {
|
|
93
|
+
let h, y = this.pos;
|
|
94
|
+
do
|
|
95
|
+
h = this.input.charCodeAt(++this.pos);
|
|
96
|
+
while (Ye(h) || h === 45);
|
|
97
|
+
return this.finishToken(b.jsxName, this.input.slice(y, this.pos));
|
|
98
|
+
}
|
|
99
|
+
jsx_parseIdentifier() {
|
|
100
|
+
let h = this.startNode();
|
|
101
|
+
return this.type === b.jsxName ? h.name = this.value : this.type.keyword ? h.name = this.type.keyword : this.unexpected(), this.next(), this.finishNode(h, "JSXIdentifier");
|
|
102
|
+
}
|
|
103
|
+
jsx_parseNamespacedName() {
|
|
104
|
+
let h = this.start, y = this.startLoc, x = this.jsx_parseIdentifier();
|
|
105
|
+
if (!c.allowNamespaces || !this.eat(C.colon)) return x;
|
|
106
|
+
var S = this.startNodeAt(h, y);
|
|
107
|
+
return S.namespace = x, S.name = this.jsx_parseIdentifier(), this.finishNode(S, "JSXNamespacedName");
|
|
108
|
+
}
|
|
109
|
+
jsx_parseElementName() {
|
|
110
|
+
if (this.type === b.jsxTagEnd) return "";
|
|
111
|
+
let h = this.start, y = this.startLoc, x = this.jsx_parseNamespacedName();
|
|
112
|
+
for (this.type === C.dot && x.type === "JSXNamespacedName" && !c.allowNamespacedObjects && this.unexpected(); this.eat(C.dot); ) {
|
|
113
|
+
let S = this.startNodeAt(h, y);
|
|
114
|
+
S.object = x, S.property = this.jsx_parseIdentifier(), x = this.finishNode(S, "JSXMemberExpression");
|
|
115
|
+
}
|
|
116
|
+
return x;
|
|
117
|
+
}
|
|
118
|
+
jsx_parseAttributeValue() {
|
|
119
|
+
switch (this.type) {
|
|
120
|
+
case C.braceL:
|
|
121
|
+
let h = this.jsx_parseExpressionContainer();
|
|
122
|
+
return h.expression.type === "JSXEmptyExpression" && this.raise(h.start, "JSX attributes must only be assigned a non-empty expression"), h;
|
|
123
|
+
case b.jsxTagStart:
|
|
124
|
+
case C.string:
|
|
125
|
+
return this.parseExprAtom();
|
|
126
|
+
default:
|
|
127
|
+
this.raise(this.start, "JSX value should be either an expression or a quoted JSX text");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
jsx_parseEmptyExpression() {
|
|
131
|
+
let h = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
|
|
132
|
+
return this.finishNodeAt(h, "JSXEmptyExpression", this.start, this.startLoc);
|
|
133
|
+
}
|
|
134
|
+
jsx_parseExpressionContainer() {
|
|
135
|
+
let h = this.startNode();
|
|
136
|
+
return this.next(), h.expression = this.type === C.braceR ? this.jsx_parseEmptyExpression() : this.parseExpression(), this.expect(C.braceR), this.finishNode(h, "JSXExpressionContainer");
|
|
137
|
+
}
|
|
138
|
+
jsx_parseAttribute() {
|
|
139
|
+
let h = this.startNode();
|
|
140
|
+
return this.eat(C.braceL) ? (this.expect(C.ellipsis), h.argument = this.parseMaybeAssign(), this.expect(C.braceR), this.finishNode(h, "JSXSpreadAttribute")) : (h.name = this.jsx_parseNamespacedName(), h.value = this.eat(C.eq) ? this.jsx_parseAttributeValue() : null, this.finishNode(h, "JSXAttribute"));
|
|
141
|
+
}
|
|
142
|
+
jsx_parseOpeningElementAt(h, y) {
|
|
143
|
+
let x = this.startNodeAt(h, y);
|
|
144
|
+
x.attributes = [];
|
|
145
|
+
let S = this.jsx_parseElementName();
|
|
146
|
+
for (S && (x.name = S); this.type !== C.slash && this.type !== b.jsxTagEnd; ) x.attributes.push(this.jsx_parseAttribute());
|
|
147
|
+
return x.selfClosing = this.eat(C.slash), this.expect(b.jsxTagEnd), this.finishNode(x, S ? "JSXOpeningElement" : "JSXOpeningFragment");
|
|
148
|
+
}
|
|
149
|
+
jsx_parseClosingElementAt(h, y) {
|
|
150
|
+
let x = this.startNodeAt(h, y), S = this.jsx_parseElementName();
|
|
151
|
+
return S && (x.name = S), this.expect(b.jsxTagEnd), this.finishNode(x, S ? "JSXClosingElement" : "JSXClosingFragment");
|
|
152
|
+
}
|
|
153
|
+
jsx_parseElementAt(h, y) {
|
|
154
|
+
let x = this.startNodeAt(h, y), S = [], $ = this.jsx_parseOpeningElementAt(h, y), mt = null;
|
|
155
|
+
if (!$.selfClosing) {
|
|
156
|
+
t: for (; ; ) switch (this.type) {
|
|
157
|
+
case b.jsxTagStart:
|
|
158
|
+
if (h = this.start, y = this.startLoc, this.next(), this.eat(C.slash)) {
|
|
159
|
+
mt = this.jsx_parseClosingElementAt(h, y);
|
|
160
|
+
break t;
|
|
161
|
+
}
|
|
162
|
+
S.push(this.jsx_parseElementAt(h, y));
|
|
163
|
+
break;
|
|
164
|
+
case b.jsxText:
|
|
165
|
+
S.push(this.parseExprAtom());
|
|
166
|
+
break;
|
|
167
|
+
case C.braceL:
|
|
168
|
+
S.push(this.jsx_parseExpressionContainer());
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
this.unexpected();
|
|
172
|
+
}
|
|
173
|
+
u(mt.name) !== u($.name) && this.raise(mt.start, "Expected corresponding JSX closing tag for <" + u($.name) + ">");
|
|
174
|
+
}
|
|
175
|
+
let Tt = $.name ? "Element" : "Fragment";
|
|
176
|
+
return x["opening" + Tt] = $, x["closing" + Tt] = mt, x.children = S, this.type === C.relational && this.value === "<" && this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag"), this.finishNode(x, "JSX" + Tt);
|
|
177
|
+
}
|
|
178
|
+
jsx_parseText() {
|
|
179
|
+
let h = this.parseLiteral(this.value);
|
|
180
|
+
return h.type = "JSXText", h;
|
|
181
|
+
}
|
|
182
|
+
jsx_parseElement() {
|
|
183
|
+
let h = this.start, y = this.startLoc;
|
|
184
|
+
return this.next(), this.jsx_parseElementAt(h, y);
|
|
185
|
+
}
|
|
186
|
+
parseExprAtom(h) {
|
|
187
|
+
return this.type === b.jsxText ? this.jsx_parseText() : this.type === b.jsxTagStart ? this.jsx_parseElement() : super.parseExprAtom(h);
|
|
188
|
+
}
|
|
189
|
+
readToken(h) {
|
|
190
|
+
let y = this.curContext();
|
|
191
|
+
if (y === Z) return this.jsx_readToken();
|
|
192
|
+
if (y === F || y === j) {
|
|
193
|
+
if (dt(h)) return this.jsx_readWord();
|
|
194
|
+
if (h == 62) return ++this.pos, this.finishToken(b.jsxTagEnd);
|
|
195
|
+
if ((h === 34 || h === 39) && y == F) return this.jsx_readString(h);
|
|
196
|
+
}
|
|
197
|
+
return h === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33 ? (++this.pos, this.finishToken(b.jsxTagStart)) : super.readToken(h);
|
|
198
|
+
}
|
|
199
|
+
updateContext(h) {
|
|
200
|
+
if (this.type == C.braceL) {
|
|
201
|
+
var y = this.curContext();
|
|
202
|
+
y == F ? this.context.push(B.b_expr) : y == Z ? this.context.push(B.b_tmpl) : super.updateContext(h), this.exprAllowed = !0;
|
|
203
|
+
} else if (this.type === C.slash && h === b.jsxTagStart) this.context.length -= 2, this.context.push(j), this.exprAllowed = !1;
|
|
204
|
+
else return super.updateContext(h);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}), ue = {};
|
|
209
|
+
rs(ue, { parsers: () => Xi });
|
|
210
|
+
var os = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239], pe = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191], us = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・", he = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ", _t = { 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", 5: "class enum extends super const export import", 6: "enum", strict: "implements interface let package private protected public static yield", strictBind: "eval arguments" }, wt = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this", ps = { 5: wt, "5module": wt + " export import", 6: wt + " const class extends export import super" }, hs = /^in(stanceof)?$/, cs = new RegExp("[" + he + "]"), ls = new RegExp("[" + he + us + "]");
|
|
211
|
+
function It(t, e) {
|
|
212
|
+
for (var s = 65536, i = 0; i < e.length; i += 2) {
|
|
213
|
+
if (s += e[i], s > t) return !1;
|
|
214
|
+
if (s += e[i + 1], s >= t) return !0;
|
|
215
|
+
}
|
|
216
|
+
return !1;
|
|
217
|
+
}
|
|
218
|
+
function J(t, e) {
|
|
219
|
+
return t < 65 ? t === 36 : t < 91 ? !0 : t < 97 ? t === 95 : t < 123 ? !0 : t <= 65535 ? t >= 170 && cs.test(String.fromCharCode(t)) : e === !1 ? !1 : It(t, pe);
|
|
220
|
+
}
|
|
221
|
+
function tt(t, e) {
|
|
222
|
+
return t < 48 ? t === 36 : t < 58 ? !0 : t < 65 ? !1 : t < 91 ? !0 : t < 97 ? t === 95 : t < 123 ? !0 : t <= 65535 ? t >= 170 && ls.test(String.fromCharCode(t)) : e === !1 ? !1 : It(t, pe) || It(t, os);
|
|
223
|
+
}
|
|
224
|
+
var v = function(t, e) {
|
|
225
|
+
e === void 0 && (e = {}), this.label = t, this.keyword = e.keyword, this.beforeExpr = !!e.beforeExpr, this.startsExpr = !!e.startsExpr, this.isLoop = !!e.isLoop, this.isAssign = !!e.isAssign, this.prefix = !!e.prefix, this.postfix = !!e.postfix, this.binop = e.binop || null, this.updateContext = null;
|
|
226
|
+
};
|
|
227
|
+
function I(t, e) {
|
|
228
|
+
return new v(t, { beforeExpr: !0, binop: e });
|
|
229
|
+
}
|
|
230
|
+
var N = { beforeExpr: !0 }, P = { startsExpr: !0 }, qt = {};
|
|
231
|
+
function A(t, e) {
|
|
232
|
+
return e === void 0 && (e = {}), e.keyword = t, qt[t] = new v(t, e);
|
|
233
|
+
}
|
|
234
|
+
var a = { num: new v("num", P), regexp: new v("regexp", P), string: new v("string", P), name: new v("name", P), privateId: new v("privateId", P), eof: new v("eof"), bracketL: new v("[", { beforeExpr: !0, startsExpr: !0 }), bracketR: new v("]"), braceL: new v("{", { beforeExpr: !0, startsExpr: !0 }), braceR: new v("}"), parenL: new v("(", { beforeExpr: !0, startsExpr: !0 }), parenR: new v(")"), comma: new v(",", N), semi: new v(";", N), colon: new v(":", N), dot: new v("."), question: new v("?", N), questionDot: new v("?."), arrow: new v("=>", N), template: new v("template"), invalidTemplate: new v("invalidTemplate"), ellipsis: new v("...", N), backQuote: new v("`", P), dollarBraceL: new v("${", { beforeExpr: !0, startsExpr: !0 }), eq: new v("=", { beforeExpr: !0, isAssign: !0 }), assign: new v("_=", { beforeExpr: !0, isAssign: !0 }), incDec: new v("++/--", { prefix: !0, postfix: !0, startsExpr: !0 }), prefix: new v("!/~", { beforeExpr: !0, prefix: !0, startsExpr: !0 }), logicalOR: I("||", 1), logicalAND: I("&&", 2), bitwiseOR: I("|", 3), bitwiseXOR: I("^", 4), bitwiseAND: I("&", 5), equality: I("==/!=/===/!==", 6), relational: I("</>/<=/>=", 7), bitShift: I("<</>>/>>>", 8), plusMin: new v("+/-", { beforeExpr: !0, binop: 9, prefix: !0, startsExpr: !0 }), modulo: I("%", 10), star: I("*", 10), slash: I("/", 10), starstar: new v("**", { beforeExpr: !0 }), coalesce: I("??", 1), _break: A("break"), _case: A("case", N), _catch: A("catch"), _continue: A("continue"), _debugger: A("debugger"), _default: A("default", N), _do: A("do", { isLoop: !0, beforeExpr: !0 }), _else: A("else", N), _finally: A("finally"), _for: A("for", { isLoop: !0 }), _function: A("function", P), _if: A("if"), _return: A("return", N), _switch: A("switch"), _throw: A("throw", N), _try: A("try"), _var: A("var"), _const: A("const"), _while: A("while", { isLoop: !0 }), _with: A("with"), _new: A("new", { beforeExpr: !0, startsExpr: !0 }), _this: A("this", P), _super: A("super", P), _class: A("class", P), _extends: A("extends", N), _export: A("export"), _import: A("import", P), _null: A("null", P), _true: A("true", P), _false: A("false", P), _in: A("in", { beforeExpr: !0, binop: 7 }), _instanceof: A("instanceof", { beforeExpr: !0, binop: 7 }), _typeof: A("typeof", { beforeExpr: !0, prefix: !0, startsExpr: !0 }), _void: A("void", { beforeExpr: !0, prefix: !0, startsExpr: !0 }), _delete: A("delete", { beforeExpr: !0, prefix: !0, startsExpr: !0 }) }, R = /\r\n?|\n|\u2028|\u2029/, ds = new RegExp(R.source, "g");
|
|
235
|
+
function et(t) {
|
|
236
|
+
return t === 10 || t === 13 || t === 8232 || t === 8233;
|
|
237
|
+
}
|
|
238
|
+
function ce(t, e, s) {
|
|
239
|
+
s === void 0 && (s = t.length);
|
|
240
|
+
for (var i = e; i < s; i++) {
|
|
241
|
+
var r = t.charCodeAt(i);
|
|
242
|
+
if (et(r)) return i < s - 1 && r === 13 && t.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
|
|
243
|
+
}
|
|
244
|
+
return -1;
|
|
245
|
+
}
|
|
246
|
+
var le = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/, V = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g, de = Object.prototype, ms = de.hasOwnProperty, fs = de.toString, pt = Object.hasOwn || function(t, e) {
|
|
247
|
+
return ms.call(t, e);
|
|
248
|
+
}, Qt = Array.isArray || function(t) {
|
|
249
|
+
return fs.call(t) === "[object Array]";
|
|
250
|
+
}, $t = /* @__PURE__ */ Object.create(null);
|
|
251
|
+
function W(t) {
|
|
252
|
+
return $t[t] || ($t[t] = new RegExp("^(?:" + t.replace(/ /g, "|") + ")$"));
|
|
253
|
+
}
|
|
254
|
+
function z(t) {
|
|
255
|
+
return t <= 65535 ? String.fromCharCode(t) : (t -= 65536, String.fromCharCode((t >> 10) + 55296, (t & 1023) + 56320));
|
|
256
|
+
}
|
|
257
|
+
var ys = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/, ot = function(t, e) {
|
|
258
|
+
this.line = t, this.column = e;
|
|
259
|
+
};
|
|
260
|
+
ot.prototype.offset = function(t) {
|
|
261
|
+
return new ot(this.line, this.column + t);
|
|
262
|
+
};
|
|
263
|
+
var Et = function(t, e, s) {
|
|
264
|
+
this.start = e, this.end = s, t.sourceFile !== null && (this.source = t.sourceFile);
|
|
265
|
+
};
|
|
266
|
+
function me(t, e) {
|
|
267
|
+
for (var s = 1, i = 0; ; ) {
|
|
268
|
+
var r = ce(t, i, e);
|
|
269
|
+
if (r < 0) return new ot(s, e - i);
|
|
270
|
+
++s, i = r;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
var Nt = { ecmaVersion: null, sourceType: "script", onInsertedSemicolon: null, onTrailingComma: null, allowReserved: null, allowReturnOutsideFunction: !1, allowImportExportEverywhere: !1, allowAwaitOutsideFunction: null, allowSuperOutsideMethod: null, allowHashBang: !1, checkPrivateFields: !0, locations: !1, onToken: null, onComment: null, ranges: !1, program: null, sourceFile: null, directSourceFile: null, preserveParens: !1 }, Yt = !1;
|
|
274
|
+
function xs(t) {
|
|
275
|
+
var e = {};
|
|
276
|
+
for (var s in Nt) e[s] = t && pt(t, s) ? t[s] : Nt[s];
|
|
277
|
+
if (e.ecmaVersion === "latest" ? e.ecmaVersion = 1e8 : e.ecmaVersion == null ? (!Yt && typeof console == "object" && console.warn && (Yt = !0, console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
278
|
+
Defaulting to 2020, but this will stop working in the future.`)), e.ecmaVersion = 11) : e.ecmaVersion >= 2015 && (e.ecmaVersion -= 2009), e.allowReserved == null && (e.allowReserved = e.ecmaVersion < 5), (!t || t.allowHashBang == null) && (e.allowHashBang = e.ecmaVersion >= 14), Qt(e.onToken)) {
|
|
279
|
+
var i = e.onToken;
|
|
280
|
+
e.onToken = function(r) {
|
|
281
|
+
return i.push(r);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
return Qt(e.onComment) && (e.onComment = gs(e, e.onComment)), e;
|
|
285
|
+
}
|
|
286
|
+
function gs(t, e) {
|
|
287
|
+
return function(s, i, r, n, o, u) {
|
|
288
|
+
var p = { type: s ? "Block" : "Line", value: i, start: r, end: n };
|
|
289
|
+
t.locations && (p.loc = new Et(this, o, u)), t.ranges && (p.range = [r, n]), e.push(p);
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
var ut = 1, st = 2, Gt = 4, fe = 8, ye = 16, xe = 32, Jt = 64, ge = 128, ht = 256, Xt = ut | st | ht;
|
|
293
|
+
function Kt(t, e) {
|
|
294
|
+
return st | (t ? Gt : 0) | (e ? fe : 0);
|
|
295
|
+
}
|
|
296
|
+
var xt = 0, Ht = 1, K = 2, Ae = 3, ve = 4, Ce = 5, T = function(t, e, s) {
|
|
297
|
+
this.options = t = xs(t), this.sourceFile = t.sourceFile, this.keywords = W(ps[t.ecmaVersion >= 6 ? 6 : t.sourceType === "module" ? "5module" : 5]);
|
|
298
|
+
var i = "";
|
|
299
|
+
t.allowReserved !== !0 && (i = _t[t.ecmaVersion >= 6 ? 6 : t.ecmaVersion === 5 ? 5 : 3], t.sourceType === "module" && (i += " await")), this.reservedWords = W(i);
|
|
300
|
+
var r = (i ? i + " " : "") + _t.strict;
|
|
301
|
+
this.reservedWordsStrict = W(r), this.reservedWordsStrictBind = W(r + " " + _t.strictBind), this.input = String(e), this.containsEsc = !1, s ? (this.pos = s, this.lineStart = this.input.lastIndexOf(`
|
|
302
|
+
`, s - 1) + 1, this.curLine = this.input.slice(0, this.lineStart).split(R).length) : (this.pos = this.lineStart = 0, this.curLine = 1), this.type = a.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = t.sourceType === "module", this.strict = this.inModule || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = /* @__PURE__ */ Object.create(null), this.pos === 0 && t.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(ut), this.regexpState = null, this.privateNameStack = [];
|
|
303
|
+
}, q = { inFunction: { configurable: !0 }, inGenerator: { configurable: !0 }, inAsync: { configurable: !0 }, canAwait: { configurable: !0 }, allowSuper: { configurable: !0 }, allowDirectSuper: { configurable: !0 }, treatFunctionsAsVar: { configurable: !0 }, allowNewDotTarget: { configurable: !0 }, inClassStaticBlock: { configurable: !0 } };
|
|
304
|
+
T.prototype.parse = function() {
|
|
305
|
+
var t = this.options.program || this.startNode();
|
|
306
|
+
return this.nextToken(), this.parseTopLevel(t);
|
|
307
|
+
};
|
|
308
|
+
q.inFunction.get = function() {
|
|
309
|
+
return (this.currentVarScope().flags & st) > 0;
|
|
310
|
+
};
|
|
311
|
+
q.inGenerator.get = function() {
|
|
312
|
+
return (this.currentVarScope().flags & fe) > 0 && !this.currentVarScope().inClassFieldInit;
|
|
313
|
+
};
|
|
314
|
+
q.inAsync.get = function() {
|
|
315
|
+
return (this.currentVarScope().flags & Gt) > 0 && !this.currentVarScope().inClassFieldInit;
|
|
316
|
+
};
|
|
317
|
+
q.canAwait.get = function() {
|
|
318
|
+
for (var t = this.scopeStack.length - 1; t >= 0; t--) {
|
|
319
|
+
var e = this.scopeStack[t];
|
|
320
|
+
if (e.inClassFieldInit || e.flags & ht) return !1;
|
|
321
|
+
if (e.flags & st) return (e.flags & Gt) > 0;
|
|
322
|
+
}
|
|
323
|
+
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
324
|
+
};
|
|
325
|
+
q.allowSuper.get = function() {
|
|
326
|
+
var t = this.currentThisScope(), e = t.flags, s = t.inClassFieldInit;
|
|
327
|
+
return (e & Jt) > 0 || s || this.options.allowSuperOutsideMethod;
|
|
328
|
+
};
|
|
329
|
+
q.allowDirectSuper.get = function() {
|
|
330
|
+
return (this.currentThisScope().flags & ge) > 0;
|
|
331
|
+
};
|
|
332
|
+
q.treatFunctionsAsVar.get = function() {
|
|
333
|
+
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
334
|
+
};
|
|
335
|
+
q.allowNewDotTarget.get = function() {
|
|
336
|
+
var t = this.currentThisScope(), e = t.flags, s = t.inClassFieldInit;
|
|
337
|
+
return (e & (st | ht)) > 0 || s;
|
|
338
|
+
};
|
|
339
|
+
q.inClassStaticBlock.get = function() {
|
|
340
|
+
return (this.currentVarScope().flags & ht) > 0;
|
|
341
|
+
};
|
|
342
|
+
T.extend = function() {
|
|
343
|
+
for (var t = [], e = arguments.length; e--; ) t[e] = arguments[e];
|
|
344
|
+
for (var s = this, i = 0; i < t.length; i++) s = t[i](s);
|
|
345
|
+
return s;
|
|
346
|
+
};
|
|
347
|
+
T.parse = function(t, e) {
|
|
348
|
+
return new this(e, t).parse();
|
|
349
|
+
};
|
|
350
|
+
T.parseExpressionAt = function(t, e, s) {
|
|
351
|
+
var i = new this(s, t, e);
|
|
352
|
+
return i.nextToken(), i.parseExpression();
|
|
353
|
+
};
|
|
354
|
+
T.tokenizer = function(t, e) {
|
|
355
|
+
return new this(e, t);
|
|
356
|
+
};
|
|
357
|
+
Object.defineProperties(T.prototype, q);
|
|
358
|
+
var D = T.prototype, As = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
359
|
+
D.strictDirective = function(t) {
|
|
360
|
+
if (this.options.ecmaVersion < 5) return !1;
|
|
361
|
+
for (; ; ) {
|
|
362
|
+
V.lastIndex = t, t += V.exec(this.input)[0].length;
|
|
363
|
+
var e = As.exec(this.input.slice(t));
|
|
364
|
+
if (!e) return !1;
|
|
365
|
+
if ((e[1] || e[2]) === "use strict") {
|
|
366
|
+
V.lastIndex = t + e[0].length;
|
|
367
|
+
var s = V.exec(this.input), i = s.index + s[0].length, r = this.input.charAt(i);
|
|
368
|
+
return r === ";" || r === "}" || R.test(s[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(r) || r === "!" && this.input.charAt(i + 1) === "=");
|
|
369
|
+
}
|
|
370
|
+
t += e[0].length, V.lastIndex = t, t += V.exec(this.input)[0].length, this.input[t] === ";" && t++;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
D.eat = function(t) {
|
|
374
|
+
return this.type === t ? (this.next(), !0) : !1;
|
|
375
|
+
};
|
|
376
|
+
D.isContextual = function(t) {
|
|
377
|
+
return this.type === a.name && this.value === t && !this.containsEsc;
|
|
378
|
+
};
|
|
379
|
+
D.eatContextual = function(t) {
|
|
380
|
+
return this.isContextual(t) ? (this.next(), !0) : !1;
|
|
381
|
+
};
|
|
382
|
+
D.expectContextual = function(t) {
|
|
383
|
+
this.eatContextual(t) || this.unexpected();
|
|
384
|
+
};
|
|
385
|
+
D.canInsertSemicolon = function() {
|
|
386
|
+
return this.type === a.eof || this.type === a.braceR || R.test(this.input.slice(this.lastTokEnd, this.start));
|
|
387
|
+
};
|
|
388
|
+
D.insertSemicolon = function() {
|
|
389
|
+
if (this.canInsertSemicolon()) return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0;
|
|
390
|
+
};
|
|
391
|
+
D.semicolon = function() {
|
|
392
|
+
!this.eat(a.semi) && !this.insertSemicolon() && this.unexpected();
|
|
393
|
+
};
|
|
394
|
+
D.afterTrailingComma = function(t, e) {
|
|
395
|
+
if (this.type === t) return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), e || this.next(), !0;
|
|
396
|
+
};
|
|
397
|
+
D.expect = function(t) {
|
|
398
|
+
this.eat(t) || this.unexpected();
|
|
399
|
+
};
|
|
400
|
+
D.unexpected = function(t) {
|
|
401
|
+
this.raise(t ?? this.start, "Unexpected token");
|
|
402
|
+
};
|
|
403
|
+
var bt = function() {
|
|
404
|
+
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
405
|
+
};
|
|
406
|
+
D.checkPatternErrors = function(t, e) {
|
|
407
|
+
if (t) {
|
|
408
|
+
t.trailingComma > -1 && this.raiseRecoverable(t.trailingComma, "Comma is not permitted after the rest element");
|
|
409
|
+
var s = e ? t.parenthesizedAssign : t.parenthesizedBind;
|
|
410
|
+
s > -1 && this.raiseRecoverable(s, e ? "Assigning to rvalue" : "Parenthesized pattern");
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
D.checkExpressionErrors = function(t, e) {
|
|
414
|
+
if (!t) return !1;
|
|
415
|
+
var s = t.shorthandAssign, i = t.doubleProto;
|
|
416
|
+
if (!e) return s >= 0 || i >= 0;
|
|
417
|
+
s >= 0 && this.raise(s, "Shorthand property assignments are valid only in destructuring patterns"), i >= 0 && this.raiseRecoverable(i, "Redefinition of __proto__ property");
|
|
418
|
+
};
|
|
419
|
+
D.checkYieldAwaitInDefaultParams = function() {
|
|
420
|
+
this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos) && this.raise(this.yieldPos, "Yield expression cannot be a default value"), this.awaitPos && this.raise(this.awaitPos, "Await expression cannot be a default value");
|
|
421
|
+
};
|
|
422
|
+
D.isSimpleAssignTarget = function(t) {
|
|
423
|
+
return t.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(t.expression) : t.type === "Identifier" || t.type === "MemberExpression";
|
|
424
|
+
};
|
|
425
|
+
var m = T.prototype;
|
|
426
|
+
m.parseTopLevel = function(t) {
|
|
427
|
+
var e = /* @__PURE__ */ Object.create(null);
|
|
428
|
+
for (t.body || (t.body = []); this.type !== a.eof; ) {
|
|
429
|
+
var s = this.parseStatement(null, !0, e);
|
|
430
|
+
t.body.push(s);
|
|
431
|
+
}
|
|
432
|
+
if (this.inModule) for (var i = 0, r = Object.keys(this.undefinedExports); i < r.length; i += 1) {
|
|
433
|
+
var n = r[i];
|
|
434
|
+
this.raiseRecoverable(this.undefinedExports[n].start, "Export '" + n + "' is not defined");
|
|
435
|
+
}
|
|
436
|
+
return this.adaptDirectivePrologue(t.body), this.next(), t.sourceType = this.options.sourceType, this.finishNode(t, "Program");
|
|
437
|
+
};
|
|
438
|
+
var Wt = { kind: "loop" }, vs = { kind: "switch" };
|
|
439
|
+
m.isLet = function(t) {
|
|
440
|
+
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return !1;
|
|
441
|
+
V.lastIndex = this.pos;
|
|
442
|
+
var e = V.exec(this.input), s = this.pos + e[0].length, i = this.input.charCodeAt(s);
|
|
443
|
+
if (i === 91 || i === 92) return !0;
|
|
444
|
+
if (t) return !1;
|
|
445
|
+
if (i === 123 || i > 55295 && i < 56320) return !0;
|
|
446
|
+
if (J(i, !0)) {
|
|
447
|
+
for (var r = s + 1; tt(i = this.input.charCodeAt(r), !0); ) ++r;
|
|
448
|
+
if (i === 92 || i > 55295 && i < 56320) return !0;
|
|
449
|
+
var n = this.input.slice(s, r);
|
|
450
|
+
if (!hs.test(n)) return !0;
|
|
451
|
+
}
|
|
452
|
+
return !1;
|
|
453
|
+
};
|
|
454
|
+
m.isAsyncFunction = function() {
|
|
455
|
+
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return !1;
|
|
456
|
+
V.lastIndex = this.pos;
|
|
457
|
+
var t = V.exec(this.input), e = this.pos + t[0].length, s;
|
|
458
|
+
return !R.test(this.input.slice(this.pos, e)) && this.input.slice(e, e + 8) === "function" && (e + 8 === this.input.length || !(tt(s = this.input.charCodeAt(e + 8)) || s > 55295 && s < 56320));
|
|
459
|
+
};
|
|
460
|
+
m.parseStatement = function(t, e, s) {
|
|
461
|
+
var i = this.type, r = this.startNode(), n;
|
|
462
|
+
switch (this.isLet(t) && (i = a._var, n = "let"), i) {
|
|
463
|
+
case a._break:
|
|
464
|
+
case a._continue:
|
|
465
|
+
return this.parseBreakContinueStatement(r, i.keyword);
|
|
466
|
+
case a._debugger:
|
|
467
|
+
return this.parseDebuggerStatement(r);
|
|
468
|
+
case a._do:
|
|
469
|
+
return this.parseDoStatement(r);
|
|
470
|
+
case a._for:
|
|
471
|
+
return this.parseForStatement(r);
|
|
472
|
+
case a._function:
|
|
473
|
+
return t && (this.strict || t !== "if" && t !== "label") && this.options.ecmaVersion >= 6 && this.unexpected(), this.parseFunctionStatement(r, !1, !t);
|
|
474
|
+
case a._class:
|
|
475
|
+
return t && this.unexpected(), this.parseClass(r, !0);
|
|
476
|
+
case a._if:
|
|
477
|
+
return this.parseIfStatement(r);
|
|
478
|
+
case a._return:
|
|
479
|
+
return this.parseReturnStatement(r);
|
|
480
|
+
case a._switch:
|
|
481
|
+
return this.parseSwitchStatement(r);
|
|
482
|
+
case a._throw:
|
|
483
|
+
return this.parseThrowStatement(r);
|
|
484
|
+
case a._try:
|
|
485
|
+
return this.parseTryStatement(r);
|
|
486
|
+
case a._const:
|
|
487
|
+
case a._var:
|
|
488
|
+
return n = n || this.value, t && n !== "var" && this.unexpected(), this.parseVarStatement(r, n);
|
|
489
|
+
case a._while:
|
|
490
|
+
return this.parseWhileStatement(r);
|
|
491
|
+
case a._with:
|
|
492
|
+
return this.parseWithStatement(r);
|
|
493
|
+
case a.braceL:
|
|
494
|
+
return this.parseBlock(!0, r);
|
|
495
|
+
case a.semi:
|
|
496
|
+
return this.parseEmptyStatement(r);
|
|
497
|
+
case a._export:
|
|
498
|
+
case a._import:
|
|
499
|
+
if (this.options.ecmaVersion > 10 && i === a._import) {
|
|
500
|
+
V.lastIndex = this.pos;
|
|
501
|
+
var o = V.exec(this.input), u = this.pos + o[0].length, p = this.input.charCodeAt(u);
|
|
502
|
+
if (p === 40 || p === 46) return this.parseExpressionStatement(r, this.parseExpression());
|
|
503
|
+
}
|
|
504
|
+
return this.options.allowImportExportEverywhere || (e || this.raise(this.start, "'import' and 'export' may only appear at the top level"), this.inModule || this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")), i === a._import ? this.parseImport(r) : this.parseExport(r, s);
|
|
505
|
+
default:
|
|
506
|
+
if (this.isAsyncFunction()) return t && this.unexpected(), this.next(), this.parseFunctionStatement(r, !0, !t);
|
|
507
|
+
var c = this.value, d = this.parseExpression();
|
|
508
|
+
return i === a.name && d.type === "Identifier" && this.eat(a.colon) ? this.parseLabeledStatement(r, c, d, t) : this.parseExpressionStatement(r, d);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
m.parseBreakContinueStatement = function(t, e) {
|
|
512
|
+
var s = e === "break";
|
|
513
|
+
this.next(), this.eat(a.semi) || this.insertSemicolon() ? t.label = null : this.type !== a.name ? this.unexpected() : (t.label = this.parseIdent(), this.semicolon());
|
|
514
|
+
for (var i = 0; i < this.labels.length; ++i) {
|
|
515
|
+
var r = this.labels[i];
|
|
516
|
+
if ((t.label == null || r.name === t.label.name) && (r.kind != null && (s || r.kind === "loop") || t.label && s)) break;
|
|
517
|
+
}
|
|
518
|
+
return i === this.labels.length && this.raise(t.start, "Unsyntactic " + e), this.finishNode(t, s ? "BreakStatement" : "ContinueStatement");
|
|
519
|
+
};
|
|
520
|
+
m.parseDebuggerStatement = function(t) {
|
|
521
|
+
return this.next(), this.semicolon(), this.finishNode(t, "DebuggerStatement");
|
|
522
|
+
};
|
|
523
|
+
m.parseDoStatement = function(t) {
|
|
524
|
+
return this.next(), this.labels.push(Wt), t.body = this.parseStatement("do"), this.labels.pop(), this.expect(a._while), t.test = this.parseParenExpression(), this.options.ecmaVersion >= 6 ? this.eat(a.semi) : this.semicolon(), this.finishNode(t, "DoWhileStatement");
|
|
525
|
+
};
|
|
526
|
+
m.parseForStatement = function(t) {
|
|
527
|
+
this.next();
|
|
528
|
+
var e = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
|
|
529
|
+
if (this.labels.push(Wt), this.enterScope(0), this.expect(a.parenL), this.type === a.semi) return e > -1 && this.unexpected(e), this.parseFor(t, null);
|
|
530
|
+
var s = this.isLet();
|
|
531
|
+
if (this.type === a._var || this.type === a._const || s) {
|
|
532
|
+
var i = this.startNode(), r = s ? "let" : this.value;
|
|
533
|
+
return this.next(), this.parseVar(i, !0, r), this.finishNode(i, "VariableDeclaration"), (this.type === a._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && i.declarations.length === 1 ? (this.options.ecmaVersion >= 9 && (this.type === a._in ? e > -1 && this.unexpected(e) : t.await = e > -1), this.parseForIn(t, i)) : (e > -1 && this.unexpected(e), this.parseFor(t, i));
|
|
534
|
+
}
|
|
535
|
+
var n = this.isContextual("let"), o = !1, u = this.containsEsc, p = new bt(), c = this.start, d = e > -1 ? this.parseExprSubscripts(p, "await") : this.parseExpression(!0, p);
|
|
536
|
+
return this.type === a._in || (o = this.options.ecmaVersion >= 6 && this.isContextual("of")) ? (e > -1 ? (this.type === a._in && this.unexpected(e), t.await = !0) : o && this.options.ecmaVersion >= 8 && (d.start === c && !u && d.type === "Identifier" && d.name === "async" ? this.unexpected() : this.options.ecmaVersion >= 9 && (t.await = !1)), n && o && this.raise(d.start, "The left-hand side of a for-of loop may not start with 'let'."), this.toAssignable(d, !1, p), this.checkLValPattern(d), this.parseForIn(t, d)) : (this.checkExpressionErrors(p, !0), e > -1 && this.unexpected(e), this.parseFor(t, d));
|
|
537
|
+
};
|
|
538
|
+
m.parseFunctionStatement = function(t, e, s) {
|
|
539
|
+
return this.next(), this.parseFunction(t, at | (s ? 0 : Vt), !1, e);
|
|
540
|
+
};
|
|
541
|
+
m.parseIfStatement = function(t) {
|
|
542
|
+
return this.next(), t.test = this.parseParenExpression(), t.consequent = this.parseStatement("if"), t.alternate = this.eat(a._else) ? this.parseStatement("if") : null, this.finishNode(t, "IfStatement");
|
|
543
|
+
};
|
|
544
|
+
m.parseReturnStatement = function(t) {
|
|
545
|
+
return !this.inFunction && !this.options.allowReturnOutsideFunction && this.raise(this.start, "'return' outside of function"), this.next(), this.eat(a.semi) || this.insertSemicolon() ? t.argument = null : (t.argument = this.parseExpression(), this.semicolon()), this.finishNode(t, "ReturnStatement");
|
|
546
|
+
};
|
|
547
|
+
m.parseSwitchStatement = function(t) {
|
|
548
|
+
this.next(), t.discriminant = this.parseParenExpression(), t.cases = [], this.expect(a.braceL), this.labels.push(vs), this.enterScope(0);
|
|
549
|
+
for (var e, s = !1; this.type !== a.braceR; ) if (this.type === a._case || this.type === a._default) {
|
|
550
|
+
var i = this.type === a._case;
|
|
551
|
+
e && this.finishNode(e, "SwitchCase"), t.cases.push(e = this.startNode()), e.consequent = [], this.next(), i ? e.test = this.parseExpression() : (s && this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"), s = !0, e.test = null), this.expect(a.colon);
|
|
552
|
+
} else e || this.unexpected(), e.consequent.push(this.parseStatement(null));
|
|
553
|
+
return this.exitScope(), e && this.finishNode(e, "SwitchCase"), this.next(), this.labels.pop(), this.finishNode(t, "SwitchStatement");
|
|
554
|
+
};
|
|
555
|
+
m.parseThrowStatement = function(t) {
|
|
556
|
+
return this.next(), R.test(this.input.slice(this.lastTokEnd, this.start)) && this.raise(this.lastTokEnd, "Illegal newline after throw"), t.argument = this.parseExpression(), this.semicolon(), this.finishNode(t, "ThrowStatement");
|
|
557
|
+
};
|
|
558
|
+
var Cs = [];
|
|
559
|
+
m.parseCatchClauseParam = function() {
|
|
560
|
+
var t = this.parseBindingAtom(), e = t.type === "Identifier";
|
|
561
|
+
return this.enterScope(e ? xe : 0), this.checkLValPattern(t, e ? ve : K), this.expect(a.parenR), t;
|
|
562
|
+
};
|
|
563
|
+
m.parseTryStatement = function(t) {
|
|
564
|
+
if (this.next(), t.block = this.parseBlock(), t.handler = null, this.type === a._catch) {
|
|
565
|
+
var e = this.startNode();
|
|
566
|
+
this.next(), this.eat(a.parenL) ? e.param = this.parseCatchClauseParam() : (this.options.ecmaVersion < 10 && this.unexpected(), e.param = null, this.enterScope(0)), e.body = this.parseBlock(!1), this.exitScope(), t.handler = this.finishNode(e, "CatchClause");
|
|
567
|
+
}
|
|
568
|
+
return t.finalizer = this.eat(a._finally) ? this.parseBlock() : null, !t.handler && !t.finalizer && this.raise(t.start, "Missing catch or finally clause"), this.finishNode(t, "TryStatement");
|
|
569
|
+
};
|
|
570
|
+
m.parseVarStatement = function(t, e, s) {
|
|
571
|
+
return this.next(), this.parseVar(t, !1, e, s), this.semicolon(), this.finishNode(t, "VariableDeclaration");
|
|
572
|
+
};
|
|
573
|
+
m.parseWhileStatement = function(t) {
|
|
574
|
+
return this.next(), t.test = this.parseParenExpression(), this.labels.push(Wt), t.body = this.parseStatement("while"), this.labels.pop(), this.finishNode(t, "WhileStatement");
|
|
575
|
+
};
|
|
576
|
+
m.parseWithStatement = function(t) {
|
|
577
|
+
return this.strict && this.raise(this.start, "'with' in strict mode"), this.next(), t.object = this.parseParenExpression(), t.body = this.parseStatement("with"), this.finishNode(t, "WithStatement");
|
|
578
|
+
};
|
|
579
|
+
m.parseEmptyStatement = function(t) {
|
|
580
|
+
return this.next(), this.finishNode(t, "EmptyStatement");
|
|
581
|
+
};
|
|
582
|
+
m.parseLabeledStatement = function(t, e, s, i) {
|
|
583
|
+
for (var r = 0, n = this.labels; r < n.length; r += 1) {
|
|
584
|
+
var o = n[r];
|
|
585
|
+
o.name === e && this.raise(s.start, "Label '" + e + "' is already declared");
|
|
586
|
+
}
|
|
587
|
+
for (var u = this.type.isLoop ? "loop" : this.type === a._switch ? "switch" : null, p = this.labels.length - 1; p >= 0; p--) {
|
|
588
|
+
var c = this.labels[p];
|
|
589
|
+
if (c.statementStart === t.start) c.statementStart = this.start, c.kind = u;
|
|
590
|
+
else break;
|
|
591
|
+
}
|
|
592
|
+
return this.labels.push({ name: e, kind: u, statementStart: this.start }), t.body = this.parseStatement(i ? i.indexOf("label") === -1 ? i + "label" : i : "label"), this.labels.pop(), t.label = s, this.finishNode(t, "LabeledStatement");
|
|
593
|
+
};
|
|
594
|
+
m.parseExpressionStatement = function(t, e) {
|
|
595
|
+
return t.expression = e, this.semicolon(), this.finishNode(t, "ExpressionStatement");
|
|
596
|
+
};
|
|
597
|
+
m.parseBlock = function(t, e, s) {
|
|
598
|
+
for (t === void 0 && (t = !0), e === void 0 && (e = this.startNode()), e.body = [], this.expect(a.braceL), t && this.enterScope(0); this.type !== a.braceR; ) {
|
|
599
|
+
var i = this.parseStatement(null);
|
|
600
|
+
e.body.push(i);
|
|
601
|
+
}
|
|
602
|
+
return s && (this.strict = !1), this.next(), t && this.exitScope(), this.finishNode(e, "BlockStatement");
|
|
603
|
+
};
|
|
604
|
+
m.parseFor = function(t, e) {
|
|
605
|
+
return t.init = e, this.expect(a.semi), t.test = this.type === a.semi ? null : this.parseExpression(), this.expect(a.semi), t.update = this.type === a.parenR ? null : this.parseExpression(), this.expect(a.parenR), t.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(t, "ForStatement");
|
|
606
|
+
};
|
|
607
|
+
m.parseForIn = function(t, e) {
|
|
608
|
+
var s = this.type === a._in;
|
|
609
|
+
return this.next(), e.type === "VariableDeclaration" && e.declarations[0].init != null && (!s || this.options.ecmaVersion < 8 || this.strict || e.kind !== "var" || e.declarations[0].id.type !== "Identifier") && this.raise(e.start, (s ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"), t.left = e, t.right = s ? this.parseExpression() : this.parseMaybeAssign(), this.expect(a.parenR), t.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(t, s ? "ForInStatement" : "ForOfStatement");
|
|
610
|
+
};
|
|
611
|
+
m.parseVar = function(t, e, s, i) {
|
|
612
|
+
for (t.declarations = [], t.kind = s; ; ) {
|
|
613
|
+
var r = this.startNode();
|
|
614
|
+
if (this.parseVarId(r, s), this.eat(a.eq) ? r.init = this.parseMaybeAssign(e) : !i && s === "const" && !(this.type === a._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) ? this.unexpected() : !i && r.id.type !== "Identifier" && !(e && (this.type === a._in || this.isContextual("of"))) ? this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value") : r.init = null, t.declarations.push(this.finishNode(r, "VariableDeclarator")), !this.eat(a.comma)) break;
|
|
615
|
+
}
|
|
616
|
+
return t;
|
|
617
|
+
};
|
|
618
|
+
m.parseVarId = function(t, e) {
|
|
619
|
+
t.id = this.parseBindingAtom(), this.checkLValPattern(t.id, e === "var" ? Ht : K, !1);
|
|
620
|
+
};
|
|
621
|
+
var at = 1, Vt = 2, Ee = 4;
|
|
622
|
+
m.parseFunction = function(t, e, s, i, r) {
|
|
623
|
+
this.initFunction(t), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !i) && (this.type === a.star && e & Vt && this.unexpected(), t.generator = this.eat(a.star)), this.options.ecmaVersion >= 8 && (t.async = !!i), e & at && (t.id = e & Ee && this.type !== a.name ? null : this.parseIdent(), t.id && !(e & Vt) && this.checkLValSimple(t.id, this.strict || t.generator || t.async ? this.treatFunctionsAsVar ? Ht : K : Ae));
|
|
624
|
+
var n = this.yieldPos, o = this.awaitPos, u = this.awaitIdentPos;
|
|
625
|
+
return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Kt(t.async, t.generator)), e & at || (t.id = this.type === a.name ? this.parseIdent() : null), this.parseFunctionParams(t), this.parseFunctionBody(t, s, !1, r), this.yieldPos = n, this.awaitPos = o, this.awaitIdentPos = u, this.finishNode(t, e & at ? "FunctionDeclaration" : "FunctionExpression");
|
|
626
|
+
};
|
|
627
|
+
m.parseFunctionParams = function(t) {
|
|
628
|
+
this.expect(a.parenL), t.params = this.parseBindingList(a.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams();
|
|
629
|
+
};
|
|
630
|
+
m.parseClass = function(t, e) {
|
|
631
|
+
this.next();
|
|
632
|
+
var s = this.strict;
|
|
633
|
+
this.strict = !0, this.parseClassId(t, e), this.parseClassSuper(t);
|
|
634
|
+
var i = this.enterClassBody(), r = this.startNode(), n = !1;
|
|
635
|
+
for (r.body = [], this.expect(a.braceL); this.type !== a.braceR; ) {
|
|
636
|
+
var o = this.parseClassElement(t.superClass !== null);
|
|
637
|
+
o && (r.body.push(o), o.type === "MethodDefinition" && o.kind === "constructor" ? (n && this.raiseRecoverable(o.start, "Duplicate constructor in the same class"), n = !0) : o.key && o.key.type === "PrivateIdentifier" && Es(i, o) && this.raiseRecoverable(o.key.start, "Identifier '#" + o.key.name + "' has already been declared"));
|
|
638
|
+
}
|
|
639
|
+
return this.strict = s, this.next(), t.body = this.finishNode(r, "ClassBody"), this.exitClassBody(), this.finishNode(t, e ? "ClassDeclaration" : "ClassExpression");
|
|
640
|
+
};
|
|
641
|
+
m.parseClassElement = function(t) {
|
|
642
|
+
if (this.eat(a.semi)) return null;
|
|
643
|
+
var e = this.options.ecmaVersion, s = this.startNode(), i = "", r = !1, n = !1, o = "method", u = !1;
|
|
644
|
+
if (this.eatContextual("static")) {
|
|
645
|
+
if (e >= 13 && this.eat(a.braceL)) return this.parseClassStaticBlock(s), s;
|
|
646
|
+
this.isClassElementNameStart() || this.type === a.star ? u = !0 : i = "static";
|
|
647
|
+
}
|
|
648
|
+
if (s.static = u, !i && e >= 8 && this.eatContextual("async") && ((this.isClassElementNameStart() || this.type === a.star) && !this.canInsertSemicolon() ? n = !0 : i = "async"), !i && (e >= 9 || !n) && this.eat(a.star) && (r = !0), !i && !n && !r) {
|
|
649
|
+
var p = this.value;
|
|
650
|
+
(this.eatContextual("get") || this.eatContextual("set")) && (this.isClassElementNameStart() ? o = p : i = p);
|
|
651
|
+
}
|
|
652
|
+
if (i ? (s.computed = !1, s.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc), s.key.name = i, this.finishNode(s.key, "Identifier")) : this.parseClassElementName(s), e < 13 || this.type === a.parenL || o !== "method" || r || n) {
|
|
653
|
+
var c = !s.static && gt(s, "constructor"), d = c && t;
|
|
654
|
+
c && o !== "method" && this.raise(s.key.start, "Constructor can't have get/set modifier"), s.kind = c ? "constructor" : o, this.parseClassMethod(s, r, n, d);
|
|
655
|
+
} else this.parseClassField(s);
|
|
656
|
+
return s;
|
|
657
|
+
};
|
|
658
|
+
m.isClassElementNameStart = function() {
|
|
659
|
+
return this.type === a.name || this.type === a.privateId || this.type === a.num || this.type === a.string || this.type === a.bracketL || this.type.keyword;
|
|
660
|
+
};
|
|
661
|
+
m.parseClassElementName = function(t) {
|
|
662
|
+
this.type === a.privateId ? (this.value === "constructor" && this.raise(this.start, "Classes can't have an element named '#constructor'"), t.computed = !1, t.key = this.parsePrivateIdent()) : this.parsePropertyName(t);
|
|
663
|
+
};
|
|
664
|
+
m.parseClassMethod = function(t, e, s, i) {
|
|
665
|
+
var r = t.key;
|
|
666
|
+
t.kind === "constructor" ? (e && this.raise(r.start, "Constructor can't be a generator"), s && this.raise(r.start, "Constructor can't be an async method")) : t.static && gt(t, "prototype") && this.raise(r.start, "Classes may not have a static property named prototype");
|
|
667
|
+
var n = t.value = this.parseMethod(e, s, i);
|
|
668
|
+
return t.kind === "get" && n.params.length !== 0 && this.raiseRecoverable(n.start, "getter should have no params"), t.kind === "set" && n.params.length !== 1 && this.raiseRecoverable(n.start, "setter should have exactly one param"), t.kind === "set" && n.params[0].type === "RestElement" && this.raiseRecoverable(n.params[0].start, "Setter cannot use rest params"), this.finishNode(t, "MethodDefinition");
|
|
669
|
+
};
|
|
670
|
+
m.parseClassField = function(t) {
|
|
671
|
+
if (gt(t, "constructor") ? this.raise(t.key.start, "Classes can't have a field named 'constructor'") : t.static && gt(t, "prototype") && this.raise(t.key.start, "Classes can't have a static field named 'prototype'"), this.eat(a.eq)) {
|
|
672
|
+
var e = this.currentThisScope(), s = e.inClassFieldInit;
|
|
673
|
+
e.inClassFieldInit = !0, t.value = this.parseMaybeAssign(), e.inClassFieldInit = s;
|
|
674
|
+
} else t.value = null;
|
|
675
|
+
return this.semicolon(), this.finishNode(t, "PropertyDefinition");
|
|
676
|
+
};
|
|
677
|
+
m.parseClassStaticBlock = function(t) {
|
|
678
|
+
t.body = [];
|
|
679
|
+
var e = this.labels;
|
|
680
|
+
for (this.labels = [], this.enterScope(ht | Jt); this.type !== a.braceR; ) {
|
|
681
|
+
var s = this.parseStatement(null);
|
|
682
|
+
t.body.push(s);
|
|
683
|
+
}
|
|
684
|
+
return this.next(), this.exitScope(), this.labels = e, this.finishNode(t, "StaticBlock");
|
|
685
|
+
};
|
|
686
|
+
m.parseClassId = function(t, e) {
|
|
687
|
+
this.type === a.name ? (t.id = this.parseIdent(), e && this.checkLValSimple(t.id, K, !1)) : (e === !0 && this.unexpected(), t.id = null);
|
|
688
|
+
};
|
|
689
|
+
m.parseClassSuper = function(t) {
|
|
690
|
+
t.superClass = this.eat(a._extends) ? this.parseExprSubscripts(null, !1) : null;
|
|
691
|
+
};
|
|
692
|
+
m.enterClassBody = function() {
|
|
693
|
+
var t = { declared: /* @__PURE__ */ Object.create(null), used: [] };
|
|
694
|
+
return this.privateNameStack.push(t), t.declared;
|
|
695
|
+
};
|
|
696
|
+
m.exitClassBody = function() {
|
|
697
|
+
var t = this.privateNameStack.pop(), e = t.declared, s = t.used;
|
|
698
|
+
if (this.options.checkPrivateFields) for (var i = this.privateNameStack.length, r = i === 0 ? null : this.privateNameStack[i - 1], n = 0; n < s.length; ++n) {
|
|
699
|
+
var o = s[n];
|
|
700
|
+
pt(e, o.name) || (r ? r.used.push(o) : this.raiseRecoverable(o.start, "Private field '#" + o.name + "' must be declared in an enclosing class"));
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
function Es(t, e) {
|
|
704
|
+
var s = e.key.name, i = t[s], r = "true";
|
|
705
|
+
return e.type === "MethodDefinition" && (e.kind === "get" || e.kind === "set") && (r = (e.static ? "s" : "i") + e.kind), i === "iget" && r === "iset" || i === "iset" && r === "iget" || i === "sget" && r === "sset" || i === "sset" && r === "sget" ? (t[s] = "true", !1) : i ? !0 : (t[s] = r, !1);
|
|
706
|
+
}
|
|
707
|
+
function gt(t, e) {
|
|
708
|
+
var s = t.computed, i = t.key;
|
|
709
|
+
return !s && (i.type === "Identifier" && i.name === e || i.type === "Literal" && i.value === e);
|
|
710
|
+
}
|
|
711
|
+
m.parseExportAllDeclaration = function(t, e) {
|
|
712
|
+
return this.options.ecmaVersion >= 11 && (this.eatContextual("as") ? (t.exported = this.parseModuleExportName(), this.checkExport(e, t.exported, this.lastTokStart)) : t.exported = null), this.expectContextual("from"), this.type !== a.string && this.unexpected(), t.source = this.parseExprAtom(), this.semicolon(), this.finishNode(t, "ExportAllDeclaration");
|
|
713
|
+
};
|
|
714
|
+
m.parseExport = function(t, e) {
|
|
715
|
+
if (this.next(), this.eat(a.star)) return this.parseExportAllDeclaration(t, e);
|
|
716
|
+
if (this.eat(a._default)) return this.checkExport(e, "default", this.lastTokStart), t.declaration = this.parseExportDefaultDeclaration(), this.finishNode(t, "ExportDefaultDeclaration");
|
|
717
|
+
if (this.shouldParseExportStatement()) t.declaration = this.parseExportDeclaration(t), t.declaration.type === "VariableDeclaration" ? this.checkVariableExport(e, t.declaration.declarations) : this.checkExport(e, t.declaration.id, t.declaration.id.start), t.specifiers = [], t.source = null;
|
|
718
|
+
else {
|
|
719
|
+
if (t.declaration = null, t.specifiers = this.parseExportSpecifiers(e), this.eatContextual("from")) this.type !== a.string && this.unexpected(), t.source = this.parseExprAtom();
|
|
720
|
+
else {
|
|
721
|
+
for (var s = 0, i = t.specifiers; s < i.length; s += 1) {
|
|
722
|
+
var r = i[s];
|
|
723
|
+
this.checkUnreserved(r.local), this.checkLocalExport(r.local), r.local.type === "Literal" && this.raise(r.local.start, "A string literal cannot be used as an exported binding without `from`.");
|
|
724
|
+
}
|
|
725
|
+
t.source = null;
|
|
726
|
+
}
|
|
727
|
+
this.semicolon();
|
|
728
|
+
}
|
|
729
|
+
return this.finishNode(t, "ExportNamedDeclaration");
|
|
730
|
+
};
|
|
731
|
+
m.parseExportDeclaration = function(t) {
|
|
732
|
+
return this.parseStatement(null);
|
|
733
|
+
};
|
|
734
|
+
m.parseExportDefaultDeclaration = function() {
|
|
735
|
+
var t;
|
|
736
|
+
if (this.type === a._function || (t = this.isAsyncFunction())) {
|
|
737
|
+
var e = this.startNode();
|
|
738
|
+
return this.next(), t && this.next(), this.parseFunction(e, at | Ee, !1, t);
|
|
739
|
+
} else if (this.type === a._class) {
|
|
740
|
+
var s = this.startNode();
|
|
741
|
+
return this.parseClass(s, "nullableID");
|
|
742
|
+
} else {
|
|
743
|
+
var i = this.parseMaybeAssign();
|
|
744
|
+
return this.semicolon(), i;
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
m.checkExport = function(t, e, s) {
|
|
748
|
+
t && (typeof e != "string" && (e = e.type === "Identifier" ? e.name : e.value), pt(t, e) && this.raiseRecoverable(s, "Duplicate export '" + e + "'"), t[e] = !0);
|
|
749
|
+
};
|
|
750
|
+
m.checkPatternExport = function(t, e) {
|
|
751
|
+
var s = e.type;
|
|
752
|
+
if (s === "Identifier") this.checkExport(t, e, e.start);
|
|
753
|
+
else if (s === "ObjectPattern") for (var i = 0, r = e.properties; i < r.length; i += 1) {
|
|
754
|
+
var n = r[i];
|
|
755
|
+
this.checkPatternExport(t, n);
|
|
756
|
+
}
|
|
757
|
+
else if (s === "ArrayPattern") for (var o = 0, u = e.elements; o < u.length; o += 1) {
|
|
758
|
+
var p = u[o];
|
|
759
|
+
p && this.checkPatternExport(t, p);
|
|
760
|
+
}
|
|
761
|
+
else s === "Property" ? this.checkPatternExport(t, e.value) : s === "AssignmentPattern" ? this.checkPatternExport(t, e.left) : s === "RestElement" && this.checkPatternExport(t, e.argument);
|
|
762
|
+
};
|
|
763
|
+
m.checkVariableExport = function(t, e) {
|
|
764
|
+
if (t) for (var s = 0, i = e; s < i.length; s += 1) {
|
|
765
|
+
var r = i[s];
|
|
766
|
+
this.checkPatternExport(t, r.id);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
m.shouldParseExportStatement = function() {
|
|
770
|
+
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
771
|
+
};
|
|
772
|
+
m.parseExportSpecifier = function(t) {
|
|
773
|
+
var e = this.startNode();
|
|
774
|
+
return e.local = this.parseModuleExportName(), e.exported = this.eatContextual("as") ? this.parseModuleExportName() : e.local, this.checkExport(t, e.exported, e.exported.start), this.finishNode(e, "ExportSpecifier");
|
|
775
|
+
};
|
|
776
|
+
m.parseExportSpecifiers = function(t) {
|
|
777
|
+
var e = [], s = !0;
|
|
778
|
+
for (this.expect(a.braceL); !this.eat(a.braceR); ) {
|
|
779
|
+
if (s) s = !1;
|
|
780
|
+
else if (this.expect(a.comma), this.afterTrailingComma(a.braceR)) break;
|
|
781
|
+
e.push(this.parseExportSpecifier(t));
|
|
782
|
+
}
|
|
783
|
+
return e;
|
|
784
|
+
};
|
|
785
|
+
m.parseImport = function(t) {
|
|
786
|
+
return this.next(), this.type === a.string ? (t.specifiers = Cs, t.source = this.parseExprAtom()) : (t.specifiers = this.parseImportSpecifiers(), this.expectContextual("from"), t.source = this.type === a.string ? this.parseExprAtom() : this.unexpected()), this.semicolon(), this.finishNode(t, "ImportDeclaration");
|
|
787
|
+
};
|
|
788
|
+
m.parseImportSpecifier = function() {
|
|
789
|
+
var t = this.startNode();
|
|
790
|
+
return t.imported = this.parseModuleExportName(), this.eatContextual("as") ? t.local = this.parseIdent() : (this.checkUnreserved(t.imported), t.local = t.imported), this.checkLValSimple(t.local, K), this.finishNode(t, "ImportSpecifier");
|
|
791
|
+
};
|
|
792
|
+
m.parseImportDefaultSpecifier = function() {
|
|
793
|
+
var t = this.startNode();
|
|
794
|
+
return t.local = this.parseIdent(), this.checkLValSimple(t.local, K), this.finishNode(t, "ImportDefaultSpecifier");
|
|
795
|
+
};
|
|
796
|
+
m.parseImportNamespaceSpecifier = function() {
|
|
797
|
+
var t = this.startNode();
|
|
798
|
+
return this.next(), this.expectContextual("as"), t.local = this.parseIdent(), this.checkLValSimple(t.local, K), this.finishNode(t, "ImportNamespaceSpecifier");
|
|
799
|
+
};
|
|
800
|
+
m.parseImportSpecifiers = function() {
|
|
801
|
+
var t = [], e = !0;
|
|
802
|
+
if (this.type === a.name && (t.push(this.parseImportDefaultSpecifier()), !this.eat(a.comma))) return t;
|
|
803
|
+
if (this.type === a.star) return t.push(this.parseImportNamespaceSpecifier()), t;
|
|
804
|
+
for (this.expect(a.braceL); !this.eat(a.braceR); ) {
|
|
805
|
+
if (e) e = !1;
|
|
806
|
+
else if (this.expect(a.comma), this.afterTrailingComma(a.braceR)) break;
|
|
807
|
+
t.push(this.parseImportSpecifier());
|
|
808
|
+
}
|
|
809
|
+
return t;
|
|
810
|
+
};
|
|
811
|
+
m.parseModuleExportName = function() {
|
|
812
|
+
if (this.options.ecmaVersion >= 13 && this.type === a.string) {
|
|
813
|
+
var t = this.parseLiteral(this.value);
|
|
814
|
+
return ys.test(t.value) && this.raise(t.start, "An export name cannot include a lone surrogate."), t;
|
|
815
|
+
}
|
|
816
|
+
return this.parseIdent(!0);
|
|
817
|
+
};
|
|
818
|
+
m.adaptDirectivePrologue = function(t) {
|
|
819
|
+
for (var e = 0; e < t.length && this.isDirectiveCandidate(t[e]); ++e) t[e].directive = t[e].expression.raw.slice(1, -1);
|
|
820
|
+
};
|
|
821
|
+
m.isDirectiveCandidate = function(t) {
|
|
822
|
+
return this.options.ecmaVersion >= 5 && t.type === "ExpressionStatement" && t.expression.type === "Literal" && typeof t.expression.value == "string" && (this.input[t.start] === '"' || this.input[t.start] === "'");
|
|
823
|
+
};
|
|
824
|
+
var O = T.prototype;
|
|
825
|
+
O.toAssignable = function(t, e, s) {
|
|
826
|
+
if (this.options.ecmaVersion >= 6 && t) switch (t.type) {
|
|
827
|
+
case "Identifier":
|
|
828
|
+
this.inAsync && t.name === "await" && this.raise(t.start, "Cannot use 'await' as identifier inside an async function");
|
|
829
|
+
break;
|
|
830
|
+
case "ObjectPattern":
|
|
831
|
+
case "ArrayPattern":
|
|
832
|
+
case "AssignmentPattern":
|
|
833
|
+
case "RestElement":
|
|
834
|
+
break;
|
|
835
|
+
case "ObjectExpression":
|
|
836
|
+
t.type = "ObjectPattern", s && this.checkPatternErrors(s, !0);
|
|
837
|
+
for (var i = 0, r = t.properties; i < r.length; i += 1) {
|
|
838
|
+
var n = r[i];
|
|
839
|
+
this.toAssignable(n, e), n.type === "RestElement" && (n.argument.type === "ArrayPattern" || n.argument.type === "ObjectPattern") && this.raise(n.argument.start, "Unexpected token");
|
|
840
|
+
}
|
|
841
|
+
break;
|
|
842
|
+
case "Property":
|
|
843
|
+
t.kind !== "init" && this.raise(t.key.start, "Object pattern can't contain getter or setter"), this.toAssignable(t.value, e);
|
|
844
|
+
break;
|
|
845
|
+
case "ArrayExpression":
|
|
846
|
+
t.type = "ArrayPattern", s && this.checkPatternErrors(s, !0), this.toAssignableList(t.elements, e);
|
|
847
|
+
break;
|
|
848
|
+
case "SpreadElement":
|
|
849
|
+
t.type = "RestElement", this.toAssignable(t.argument, e), t.argument.type === "AssignmentPattern" && this.raise(t.argument.start, "Rest elements cannot have a default value");
|
|
850
|
+
break;
|
|
851
|
+
case "AssignmentExpression":
|
|
852
|
+
t.operator !== "=" && this.raise(t.left.end, "Only '=' operator can be used for specifying default value."), t.type = "AssignmentPattern", delete t.operator, this.toAssignable(t.left, e);
|
|
853
|
+
break;
|
|
854
|
+
case "ParenthesizedExpression":
|
|
855
|
+
this.toAssignable(t.expression, e, s);
|
|
856
|
+
break;
|
|
857
|
+
case "ChainExpression":
|
|
858
|
+
this.raiseRecoverable(t.start, "Optional chaining cannot appear in left-hand side");
|
|
859
|
+
break;
|
|
860
|
+
case "MemberExpression":
|
|
861
|
+
if (!e) break;
|
|
862
|
+
default:
|
|
863
|
+
this.raise(t.start, "Assigning to rvalue");
|
|
864
|
+
}
|
|
865
|
+
else s && this.checkPatternErrors(s, !0);
|
|
866
|
+
return t;
|
|
867
|
+
};
|
|
868
|
+
O.toAssignableList = function(t, e) {
|
|
869
|
+
for (var s = t.length, i = 0; i < s; i++) {
|
|
870
|
+
var r = t[i];
|
|
871
|
+
r && this.toAssignable(r, e);
|
|
872
|
+
}
|
|
873
|
+
if (s) {
|
|
874
|
+
var n = t[s - 1];
|
|
875
|
+
this.options.ecmaVersion === 6 && e && n && n.type === "RestElement" && n.argument.type !== "Identifier" && this.unexpected(n.argument.start);
|
|
876
|
+
}
|
|
877
|
+
return t;
|
|
878
|
+
};
|
|
879
|
+
O.parseSpread = function(t) {
|
|
880
|
+
var e = this.startNode();
|
|
881
|
+
return this.next(), e.argument = this.parseMaybeAssign(!1, t), this.finishNode(e, "SpreadElement");
|
|
882
|
+
};
|
|
883
|
+
O.parseRestBinding = function() {
|
|
884
|
+
var t = this.startNode();
|
|
885
|
+
return this.next(), this.options.ecmaVersion === 6 && this.type !== a.name && this.unexpected(), t.argument = this.parseBindingAtom(), this.finishNode(t, "RestElement");
|
|
886
|
+
};
|
|
887
|
+
O.parseBindingAtom = function() {
|
|
888
|
+
if (this.options.ecmaVersion >= 6) switch (this.type) {
|
|
889
|
+
case a.bracketL:
|
|
890
|
+
var t = this.startNode();
|
|
891
|
+
return this.next(), t.elements = this.parseBindingList(a.bracketR, !0, !0), this.finishNode(t, "ArrayPattern");
|
|
892
|
+
case a.braceL:
|
|
893
|
+
return this.parseObj(!0);
|
|
894
|
+
}
|
|
895
|
+
return this.parseIdent();
|
|
896
|
+
};
|
|
897
|
+
O.parseBindingList = function(t, e, s, i) {
|
|
898
|
+
for (var r = [], n = !0; !this.eat(t); ) if (n ? n = !1 : this.expect(a.comma), e && this.type === a.comma) r.push(null);
|
|
899
|
+
else {
|
|
900
|
+
if (s && this.afterTrailingComma(t)) break;
|
|
901
|
+
if (this.type === a.ellipsis) {
|
|
902
|
+
var o = this.parseRestBinding();
|
|
903
|
+
this.parseBindingListItem(o), r.push(o), this.type === a.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.expect(t);
|
|
904
|
+
break;
|
|
905
|
+
} else r.push(this.parseAssignableListItem(i));
|
|
906
|
+
}
|
|
907
|
+
return r;
|
|
908
|
+
};
|
|
909
|
+
O.parseAssignableListItem = function(t) {
|
|
910
|
+
var e = this.parseMaybeDefault(this.start, this.startLoc);
|
|
911
|
+
return this.parseBindingListItem(e), e;
|
|
912
|
+
};
|
|
913
|
+
O.parseBindingListItem = function(t) {
|
|
914
|
+
return t;
|
|
915
|
+
};
|
|
916
|
+
O.parseMaybeDefault = function(t, e, s) {
|
|
917
|
+
if (s = s || this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(a.eq)) return s;
|
|
918
|
+
var i = this.startNodeAt(t, e);
|
|
919
|
+
return i.left = s, i.right = this.parseMaybeAssign(), this.finishNode(i, "AssignmentPattern");
|
|
920
|
+
};
|
|
921
|
+
O.checkLValSimple = function(t, e, s) {
|
|
922
|
+
e === void 0 && (e = xt);
|
|
923
|
+
var i = e !== xt;
|
|
924
|
+
switch (t.type) {
|
|
925
|
+
case "Identifier":
|
|
926
|
+
this.strict && this.reservedWordsStrictBind.test(t.name) && this.raiseRecoverable(t.start, (i ? "Binding " : "Assigning to ") + t.name + " in strict mode"), i && (e === K && t.name === "let" && this.raiseRecoverable(t.start, "let is disallowed as a lexically bound name"), s && (pt(s, t.name) && this.raiseRecoverable(t.start, "Argument name clash"), s[t.name] = !0), e !== Ce && this.declareName(t.name, e, t.start));
|
|
927
|
+
break;
|
|
928
|
+
case "ChainExpression":
|
|
929
|
+
this.raiseRecoverable(t.start, "Optional chaining cannot appear in left-hand side");
|
|
930
|
+
break;
|
|
931
|
+
case "MemberExpression":
|
|
932
|
+
i && this.raiseRecoverable(t.start, "Binding member expression");
|
|
933
|
+
break;
|
|
934
|
+
case "ParenthesizedExpression":
|
|
935
|
+
return i && this.raiseRecoverable(t.start, "Binding parenthesized expression"), this.checkLValSimple(t.expression, e, s);
|
|
936
|
+
default:
|
|
937
|
+
this.raise(t.start, (i ? "Binding" : "Assigning to") + " rvalue");
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
O.checkLValPattern = function(t, e, s) {
|
|
941
|
+
switch (e === void 0 && (e = xt), t.type) {
|
|
942
|
+
case "ObjectPattern":
|
|
943
|
+
for (var i = 0, r = t.properties; i < r.length; i += 1) {
|
|
944
|
+
var n = r[i];
|
|
945
|
+
this.checkLValInnerPattern(n, e, s);
|
|
946
|
+
}
|
|
947
|
+
break;
|
|
948
|
+
case "ArrayPattern":
|
|
949
|
+
for (var o = 0, u = t.elements; o < u.length; o += 1) {
|
|
950
|
+
var p = u[o];
|
|
951
|
+
p && this.checkLValInnerPattern(p, e, s);
|
|
952
|
+
}
|
|
953
|
+
break;
|
|
954
|
+
default:
|
|
955
|
+
this.checkLValSimple(t, e, s);
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
O.checkLValInnerPattern = function(t, e, s) {
|
|
959
|
+
switch (e === void 0 && (e = xt), t.type) {
|
|
960
|
+
case "Property":
|
|
961
|
+
this.checkLValInnerPattern(t.value, e, s);
|
|
962
|
+
break;
|
|
963
|
+
case "AssignmentPattern":
|
|
964
|
+
this.checkLValPattern(t.left, e, s);
|
|
965
|
+
break;
|
|
966
|
+
case "RestElement":
|
|
967
|
+
this.checkLValPattern(t.argument, e, s);
|
|
968
|
+
break;
|
|
969
|
+
default:
|
|
970
|
+
this.checkLValPattern(t, e, s);
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
var M = function(t, e, s, i, r) {
|
|
974
|
+
this.token = t, this.isExpr = !!e, this.preserveSpace = !!s, this.override = i, this.generator = !!r;
|
|
975
|
+
}, k = { b_stat: new M("{", !1), b_expr: new M("{", !0), b_tmpl: new M("${", !1), p_stat: new M("(", !1), p_expr: new M("(", !0), q_tmpl: new M("`", !0, !0, function(t) {
|
|
976
|
+
return t.tryReadTemplateToken();
|
|
977
|
+
}), f_stat: new M("function", !1), f_expr: new M("function", !0), f_expr_gen: new M("function", !0, !1, null, !0), f_gen: new M("function", !1, !1, null, !0) }, it = T.prototype;
|
|
978
|
+
it.initialContext = function() {
|
|
979
|
+
return [k.b_stat];
|
|
980
|
+
};
|
|
981
|
+
it.curContext = function() {
|
|
982
|
+
return this.context[this.context.length - 1];
|
|
983
|
+
};
|
|
984
|
+
it.braceIsBlock = function(t) {
|
|
985
|
+
var e = this.curContext();
|
|
986
|
+
return e === k.f_expr || e === k.f_stat ? !0 : t === a.colon && (e === k.b_stat || e === k.b_expr) ? !e.isExpr : t === a._return || t === a.name && this.exprAllowed ? R.test(this.input.slice(this.lastTokEnd, this.start)) : t === a._else || t === a.semi || t === a.eof || t === a.parenR || t === a.arrow ? !0 : t === a.braceL ? e === k.b_stat : t === a._var || t === a._const || t === a.name ? !1 : !this.exprAllowed;
|
|
987
|
+
};
|
|
988
|
+
it.inGeneratorContext = function() {
|
|
989
|
+
for (var t = this.context.length - 1; t >= 1; t--) {
|
|
990
|
+
var e = this.context[t];
|
|
991
|
+
if (e.token === "function") return e.generator;
|
|
992
|
+
}
|
|
993
|
+
return !1;
|
|
994
|
+
};
|
|
995
|
+
it.updateContext = function(t) {
|
|
996
|
+
var e, s = this.type;
|
|
997
|
+
s.keyword && t === a.dot ? this.exprAllowed = !1 : (e = s.updateContext) ? e.call(this, t) : this.exprAllowed = s.beforeExpr;
|
|
998
|
+
};
|
|
999
|
+
it.overrideContext = function(t) {
|
|
1000
|
+
this.curContext() !== t && (this.context[this.context.length - 1] = t);
|
|
1001
|
+
};
|
|
1002
|
+
a.parenR.updateContext = a.braceR.updateContext = function() {
|
|
1003
|
+
if (this.context.length === 1) {
|
|
1004
|
+
this.exprAllowed = !0;
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
var t = this.context.pop();
|
|
1008
|
+
t === k.b_stat && this.curContext().token === "function" && (t = this.context.pop()), this.exprAllowed = !t.isExpr;
|
|
1009
|
+
};
|
|
1010
|
+
a.braceL.updateContext = function(t) {
|
|
1011
|
+
this.context.push(this.braceIsBlock(t) ? k.b_stat : k.b_expr), this.exprAllowed = !0;
|
|
1012
|
+
};
|
|
1013
|
+
a.dollarBraceL.updateContext = function() {
|
|
1014
|
+
this.context.push(k.b_tmpl), this.exprAllowed = !0;
|
|
1015
|
+
};
|
|
1016
|
+
a.parenL.updateContext = function(t) {
|
|
1017
|
+
var e = t === a._if || t === a._for || t === a._with || t === a._while;
|
|
1018
|
+
this.context.push(e ? k.p_stat : k.p_expr), this.exprAllowed = !0;
|
|
1019
|
+
};
|
|
1020
|
+
a.incDec.updateContext = function() {
|
|
1021
|
+
};
|
|
1022
|
+
a._function.updateContext = a._class.updateContext = function(t) {
|
|
1023
|
+
t.beforeExpr && t !== a._else && !(t === a.semi && this.curContext() !== k.p_stat) && !(t === a._return && R.test(this.input.slice(this.lastTokEnd, this.start))) && !((t === a.colon || t === a.braceL) && this.curContext() === k.b_stat) ? this.context.push(k.f_expr) : this.context.push(k.f_stat), this.exprAllowed = !1;
|
|
1024
|
+
};
|
|
1025
|
+
a.colon.updateContext = function() {
|
|
1026
|
+
this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0;
|
|
1027
|
+
};
|
|
1028
|
+
a.backQuote.updateContext = function() {
|
|
1029
|
+
this.curContext() === k.q_tmpl ? this.context.pop() : this.context.push(k.q_tmpl), this.exprAllowed = !1;
|
|
1030
|
+
};
|
|
1031
|
+
a.star.updateContext = function(t) {
|
|
1032
|
+
if (t === a._function) {
|
|
1033
|
+
var e = this.context.length - 1;
|
|
1034
|
+
this.context[e] === k.f_expr ? this.context[e] = k.f_expr_gen : this.context[e] = k.f_gen;
|
|
1035
|
+
}
|
|
1036
|
+
this.exprAllowed = !0;
|
|
1037
|
+
};
|
|
1038
|
+
a.name.updateContext = function(t) {
|
|
1039
|
+
var e = !1;
|
|
1040
|
+
this.options.ecmaVersion >= 6 && t !== a.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (e = !0), this.exprAllowed = e;
|
|
1041
|
+
};
|
|
1042
|
+
var f = T.prototype;
|
|
1043
|
+
f.checkPropClash = function(t, e, s) {
|
|
1044
|
+
if (!(this.options.ecmaVersion >= 9 && t.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (t.computed || t.method || t.shorthand))) {
|
|
1045
|
+
var i = t.key, r;
|
|
1046
|
+
switch (i.type) {
|
|
1047
|
+
case "Identifier":
|
|
1048
|
+
r = i.name;
|
|
1049
|
+
break;
|
|
1050
|
+
case "Literal":
|
|
1051
|
+
r = String(i.value);
|
|
1052
|
+
break;
|
|
1053
|
+
default:
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
var n = t.kind;
|
|
1057
|
+
if (this.options.ecmaVersion >= 6) {
|
|
1058
|
+
r === "__proto__" && n === "init" && (e.proto && (s ? s.doubleProto < 0 && (s.doubleProto = i.start) : this.raiseRecoverable(i.start, "Redefinition of __proto__ property")), e.proto = !0);
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
r = "$" + r;
|
|
1062
|
+
var o = e[r];
|
|
1063
|
+
if (o) {
|
|
1064
|
+
var u;
|
|
1065
|
+
n === "init" ? u = this.strict && o.init || o.get || o.set : u = o.init || o[n], u && this.raiseRecoverable(i.start, "Redefinition of property");
|
|
1066
|
+
} else o = e[r] = { init: !1, get: !1, set: !1 };
|
|
1067
|
+
o[n] = !0;
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
f.parseExpression = function(t, e) {
|
|
1071
|
+
var s = this.start, i = this.startLoc, r = this.parseMaybeAssign(t, e);
|
|
1072
|
+
if (this.type === a.comma) {
|
|
1073
|
+
var n = this.startNodeAt(s, i);
|
|
1074
|
+
for (n.expressions = [r]; this.eat(a.comma); ) n.expressions.push(this.parseMaybeAssign(t, e));
|
|
1075
|
+
return this.finishNode(n, "SequenceExpression");
|
|
1076
|
+
}
|
|
1077
|
+
return r;
|
|
1078
|
+
};
|
|
1079
|
+
f.parseMaybeAssign = function(t, e, s) {
|
|
1080
|
+
if (this.isContextual("yield")) {
|
|
1081
|
+
if (this.inGenerator) return this.parseYield(t);
|
|
1082
|
+
this.exprAllowed = !1;
|
|
1083
|
+
}
|
|
1084
|
+
var i = !1, r = -1, n = -1, o = -1;
|
|
1085
|
+
e ? (r = e.parenthesizedAssign, n = e.trailingComma, o = e.doubleProto, e.parenthesizedAssign = e.trailingComma = -1) : (e = new bt(), i = !0);
|
|
1086
|
+
var u = this.start, p = this.startLoc;
|
|
1087
|
+
(this.type === a.parenL || this.type === a.name) && (this.potentialArrowAt = this.start, this.potentialArrowInForAwait = t === "await");
|
|
1088
|
+
var c = this.parseMaybeConditional(t, e);
|
|
1089
|
+
if (s && (c = s.call(this, c, u, p)), this.type.isAssign) {
|
|
1090
|
+
var d = this.startNodeAt(u, p);
|
|
1091
|
+
return d.operator = this.value, this.type === a.eq && (c = this.toAssignable(c, !1, e)), i || (e.parenthesizedAssign = e.trailingComma = e.doubleProto = -1), e.shorthandAssign >= c.start && (e.shorthandAssign = -1), this.type === a.eq ? this.checkLValPattern(c) : this.checkLValSimple(c), d.left = c, this.next(), d.right = this.parseMaybeAssign(t), o > -1 && (e.doubleProto = o), this.finishNode(d, "AssignmentExpression");
|
|
1092
|
+
} else i && this.checkExpressionErrors(e, !0);
|
|
1093
|
+
return r > -1 && (e.parenthesizedAssign = r), n > -1 && (e.trailingComma = n), c;
|
|
1094
|
+
};
|
|
1095
|
+
f.parseMaybeConditional = function(t, e) {
|
|
1096
|
+
var s = this.start, i = this.startLoc, r = this.parseExprOps(t, e);
|
|
1097
|
+
if (this.checkExpressionErrors(e)) return r;
|
|
1098
|
+
if (this.eat(a.question)) {
|
|
1099
|
+
var n = this.startNodeAt(s, i);
|
|
1100
|
+
return n.test = r, n.consequent = this.parseMaybeAssign(), this.expect(a.colon), n.alternate = this.parseMaybeAssign(t), this.finishNode(n, "ConditionalExpression");
|
|
1101
|
+
}
|
|
1102
|
+
return r;
|
|
1103
|
+
};
|
|
1104
|
+
f.parseExprOps = function(t, e) {
|
|
1105
|
+
var s = this.start, i = this.startLoc, r = this.parseMaybeUnary(e, !1, !1, t);
|
|
1106
|
+
return this.checkExpressionErrors(e) || r.start === s && r.type === "ArrowFunctionExpression" ? r : this.parseExprOp(r, s, i, -1, t);
|
|
1107
|
+
};
|
|
1108
|
+
f.parseExprOp = function(t, e, s, i, r) {
|
|
1109
|
+
var n = this.type.binop;
|
|
1110
|
+
if (n != null && (!r || this.type !== a._in) && n > i) {
|
|
1111
|
+
var o = this.type === a.logicalOR || this.type === a.logicalAND, u = this.type === a.coalesce;
|
|
1112
|
+
u && (n = a.logicalAND.binop);
|
|
1113
|
+
var p = this.value;
|
|
1114
|
+
this.next();
|
|
1115
|
+
var c = this.start, d = this.startLoc, E = this.parseExprOp(this.parseMaybeUnary(null, !1, !1, r), c, d, n, r), _ = this.buildBinary(e, s, t, E, p, o || u);
|
|
1116
|
+
return (o && this.type === a.coalesce || u && (this.type === a.logicalOR || this.type === a.logicalAND)) && this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"), this.parseExprOp(_, e, s, i, r);
|
|
1117
|
+
}
|
|
1118
|
+
return t;
|
|
1119
|
+
};
|
|
1120
|
+
f.buildBinary = function(t, e, s, i, r, n) {
|
|
1121
|
+
i.type === "PrivateIdentifier" && this.raise(i.start, "Private identifier can only be left side of binary expression");
|
|
1122
|
+
var o = this.startNodeAt(t, e);
|
|
1123
|
+
return o.left = s, o.operator = r, o.right = i, this.finishNode(o, n ? "LogicalExpression" : "BinaryExpression");
|
|
1124
|
+
};
|
|
1125
|
+
f.parseMaybeUnary = function(t, e, s, i) {
|
|
1126
|
+
var r = this.start, n = this.startLoc, o;
|
|
1127
|
+
if (this.isContextual("await") && this.canAwait) o = this.parseAwait(i), e = !0;
|
|
1128
|
+
else if (this.type.prefix) {
|
|
1129
|
+
var u = this.startNode(), p = this.type === a.incDec;
|
|
1130
|
+
u.operator = this.value, u.prefix = !0, this.next(), u.argument = this.parseMaybeUnary(null, !0, p, i), this.checkExpressionErrors(t, !0), p ? this.checkLValSimple(u.argument) : this.strict && u.operator === "delete" && be(u.argument) ? this.raiseRecoverable(u.start, "Deleting local variable in strict mode") : u.operator === "delete" && Lt(u.argument) ? this.raiseRecoverable(u.start, "Private fields can not be deleted") : e = !0, o = this.finishNode(u, p ? "UpdateExpression" : "UnaryExpression");
|
|
1131
|
+
} else if (!e && this.type === a.privateId) (i || this.privateNameStack.length === 0) && this.options.checkPrivateFields && this.unexpected(), o = this.parsePrivateIdent(), this.type !== a._in && this.unexpected();
|
|
1132
|
+
else {
|
|
1133
|
+
if (o = this.parseExprSubscripts(t, i), this.checkExpressionErrors(t)) return o;
|
|
1134
|
+
for (; this.type.postfix && !this.canInsertSemicolon(); ) {
|
|
1135
|
+
var c = this.startNodeAt(r, n);
|
|
1136
|
+
c.operator = this.value, c.prefix = !1, c.argument = o, this.checkLValSimple(o), this.next(), o = this.finishNode(c, "UpdateExpression");
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
if (!s && this.eat(a.starstar)) if (e) this.unexpected(this.lastTokStart);
|
|
1140
|
+
else return this.buildBinary(r, n, o, this.parseMaybeUnary(null, !1, !1, i), "**", !1);
|
|
1141
|
+
else return o;
|
|
1142
|
+
};
|
|
1143
|
+
function be(t) {
|
|
1144
|
+
return t.type === "Identifier" || t.type === "ParenthesizedExpression" && be(t.expression);
|
|
1145
|
+
}
|
|
1146
|
+
function Lt(t) {
|
|
1147
|
+
return t.type === "MemberExpression" && t.property.type === "PrivateIdentifier" || t.type === "ChainExpression" && Lt(t.expression) || t.type === "ParenthesizedExpression" && Lt(t.expression);
|
|
1148
|
+
}
|
|
1149
|
+
f.parseExprSubscripts = function(t, e) {
|
|
1150
|
+
var s = this.start, i = this.startLoc, r = this.parseExprAtom(t, e);
|
|
1151
|
+
if (r.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return r;
|
|
1152
|
+
var n = this.parseSubscripts(r, s, i, !1, e);
|
|
1153
|
+
return t && n.type === "MemberExpression" && (t.parenthesizedAssign >= n.start && (t.parenthesizedAssign = -1), t.parenthesizedBind >= n.start && (t.parenthesizedBind = -1), t.trailingComma >= n.start && (t.trailingComma = -1)), n;
|
|
1154
|
+
};
|
|
1155
|
+
f.parseSubscripts = function(t, e, s, i, r) {
|
|
1156
|
+
for (var n = this.options.ecmaVersion >= 8 && t.type === "Identifier" && t.name === "async" && this.lastTokEnd === t.end && !this.canInsertSemicolon() && t.end - t.start === 5 && this.potentialArrowAt === t.start, o = !1; ; ) {
|
|
1157
|
+
var u = this.parseSubscript(t, e, s, i, n, o, r);
|
|
1158
|
+
if (u.optional && (o = !0), u === t || u.type === "ArrowFunctionExpression") {
|
|
1159
|
+
if (o) {
|
|
1160
|
+
var p = this.startNodeAt(e, s);
|
|
1161
|
+
p.expression = u, u = this.finishNode(p, "ChainExpression");
|
|
1162
|
+
}
|
|
1163
|
+
return u;
|
|
1164
|
+
}
|
|
1165
|
+
t = u;
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
f.shouldParseAsyncArrow = function() {
|
|
1169
|
+
return !this.canInsertSemicolon() && this.eat(a.arrow);
|
|
1170
|
+
};
|
|
1171
|
+
f.parseSubscriptAsyncArrow = function(t, e, s, i) {
|
|
1172
|
+
return this.parseArrowExpression(this.startNodeAt(t, e), s, !0, i);
|
|
1173
|
+
};
|
|
1174
|
+
f.parseSubscript = function(t, e, s, i, r, n, o) {
|
|
1175
|
+
var u = this.options.ecmaVersion >= 11, p = u && this.eat(a.questionDot);
|
|
1176
|
+
i && p && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
1177
|
+
var c = this.eat(a.bracketL);
|
|
1178
|
+
if (c || p && this.type !== a.parenL && this.type !== a.backQuote || this.eat(a.dot)) {
|
|
1179
|
+
var d = this.startNodeAt(e, s);
|
|
1180
|
+
d.object = t, c ? (d.property = this.parseExpression(), this.expect(a.bracketR)) : this.type === a.privateId && t.type !== "Super" ? d.property = this.parsePrivateIdent() : d.property = this.parseIdent(this.options.allowReserved !== "never"), d.computed = !!c, u && (d.optional = p), t = this.finishNode(d, "MemberExpression");
|
|
1181
|
+
} else if (!i && this.eat(a.parenL)) {
|
|
1182
|
+
var E = new bt(), _ = this.yieldPos, C = this.awaitPos, b = this.awaitIdentPos;
|
|
1183
|
+
this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0;
|
|
1184
|
+
var B = this.parseExprList(a.parenR, this.options.ecmaVersion >= 8, !1, E);
|
|
1185
|
+
if (r && !p && this.shouldParseAsyncArrow()) return this.checkPatternErrors(E, !1), this.checkYieldAwaitInDefaultParams(), this.awaitIdentPos > 0 && this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"), this.yieldPos = _, this.awaitPos = C, this.awaitIdentPos = b, this.parseSubscriptAsyncArrow(e, s, B, o);
|
|
1186
|
+
this.checkExpressionErrors(E, !0), this.yieldPos = _ || this.yieldPos, this.awaitPos = C || this.awaitPos, this.awaitIdentPos = b || this.awaitIdentPos;
|
|
1187
|
+
var F = this.startNodeAt(e, s);
|
|
1188
|
+
F.callee = t, F.arguments = B, u && (F.optional = p), t = this.finishNode(F, "CallExpression");
|
|
1189
|
+
} else if (this.type === a.backQuote) {
|
|
1190
|
+
(p || n) && this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
1191
|
+
var j = this.startNodeAt(e, s);
|
|
1192
|
+
j.tag = t, j.quasi = this.parseTemplate({ isTagged: !0 }), t = this.finishNode(j, "TaggedTemplateExpression");
|
|
1193
|
+
}
|
|
1194
|
+
return t;
|
|
1195
|
+
};
|
|
1196
|
+
f.parseExprAtom = function(t, e, s) {
|
|
1197
|
+
this.type === a.slash && this.readRegexp();
|
|
1198
|
+
var i, r = this.potentialArrowAt === this.start;
|
|
1199
|
+
switch (this.type) {
|
|
1200
|
+
case a._super:
|
|
1201
|
+
return this.allowSuper || this.raise(this.start, "'super' keyword outside a method"), i = this.startNode(), this.next(), this.type === a.parenL && !this.allowDirectSuper && this.raise(i.start, "super() call outside constructor of a subclass"), this.type !== a.dot && this.type !== a.bracketL && this.type !== a.parenL && this.unexpected(), this.finishNode(i, "Super");
|
|
1202
|
+
case a._this:
|
|
1203
|
+
return i = this.startNode(), this.next(), this.finishNode(i, "ThisExpression");
|
|
1204
|
+
case a.name:
|
|
1205
|
+
var n = this.start, o = this.startLoc, u = this.containsEsc, p = this.parseIdent(!1);
|
|
1206
|
+
if (this.options.ecmaVersion >= 8 && !u && p.name === "async" && !this.canInsertSemicolon() && this.eat(a._function)) return this.overrideContext(k.f_expr), this.parseFunction(this.startNodeAt(n, o), 0, !1, !0, e);
|
|
1207
|
+
if (r && !this.canInsertSemicolon()) {
|
|
1208
|
+
if (this.eat(a.arrow)) return this.parseArrowExpression(this.startNodeAt(n, o), [p], !1, e);
|
|
1209
|
+
if (this.options.ecmaVersion >= 8 && p.name === "async" && this.type === a.name && !u && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) return p = this.parseIdent(!1), (this.canInsertSemicolon() || !this.eat(a.arrow)) && this.unexpected(), this.parseArrowExpression(this.startNodeAt(n, o), [p], !0, e);
|
|
1210
|
+
}
|
|
1211
|
+
return p;
|
|
1212
|
+
case a.regexp:
|
|
1213
|
+
var c = this.value;
|
|
1214
|
+
return i = this.parseLiteral(c.value), i.regex = { pattern: c.pattern, flags: c.flags }, i;
|
|
1215
|
+
case a.num:
|
|
1216
|
+
case a.string:
|
|
1217
|
+
return this.parseLiteral(this.value);
|
|
1218
|
+
case a._null:
|
|
1219
|
+
case a._true:
|
|
1220
|
+
case a._false:
|
|
1221
|
+
return i = this.startNode(), i.value = this.type === a._null ? null : this.type === a._true, i.raw = this.type.keyword, this.next(), this.finishNode(i, "Literal");
|
|
1222
|
+
case a.parenL:
|
|
1223
|
+
var d = this.start, E = this.parseParenAndDistinguishExpression(r, e);
|
|
1224
|
+
return t && (t.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(E) && (t.parenthesizedAssign = d), t.parenthesizedBind < 0 && (t.parenthesizedBind = d)), E;
|
|
1225
|
+
case a.bracketL:
|
|
1226
|
+
return i = this.startNode(), this.next(), i.elements = this.parseExprList(a.bracketR, !0, !0, t), this.finishNode(i, "ArrayExpression");
|
|
1227
|
+
case a.braceL:
|
|
1228
|
+
return this.overrideContext(k.b_expr), this.parseObj(!1, t);
|
|
1229
|
+
case a._function:
|
|
1230
|
+
return i = this.startNode(), this.next(), this.parseFunction(i, 0);
|
|
1231
|
+
case a._class:
|
|
1232
|
+
return this.parseClass(this.startNode(), !1);
|
|
1233
|
+
case a._new:
|
|
1234
|
+
return this.parseNew();
|
|
1235
|
+
case a.backQuote:
|
|
1236
|
+
return this.parseTemplate();
|
|
1237
|
+
case a._import:
|
|
1238
|
+
return this.options.ecmaVersion >= 11 ? this.parseExprImport(s) : this.unexpected();
|
|
1239
|
+
default:
|
|
1240
|
+
return this.parseExprAtomDefault();
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
f.parseExprAtomDefault = function() {
|
|
1244
|
+
this.unexpected();
|
|
1245
|
+
};
|
|
1246
|
+
f.parseExprImport = function(t) {
|
|
1247
|
+
var e = this.startNode();
|
|
1248
|
+
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === a.parenL && !t) return this.parseDynamicImport(e);
|
|
1249
|
+
if (this.type === a.dot) {
|
|
1250
|
+
var s = this.startNodeAt(e.start, e.loc && e.loc.start);
|
|
1251
|
+
return s.name = "import", e.meta = this.finishNode(s, "Identifier"), this.parseImportMeta(e);
|
|
1252
|
+
} else this.unexpected();
|
|
1253
|
+
};
|
|
1254
|
+
f.parseDynamicImport = function(t) {
|
|
1255
|
+
if (this.next(), t.source = this.parseMaybeAssign(), !this.eat(a.parenR)) {
|
|
1256
|
+
var e = this.start;
|
|
1257
|
+
this.eat(a.comma) && this.eat(a.parenR) ? this.raiseRecoverable(e, "Trailing comma is not allowed in import()") : this.unexpected(e);
|
|
1258
|
+
}
|
|
1259
|
+
return this.finishNode(t, "ImportExpression");
|
|
1260
|
+
};
|
|
1261
|
+
f.parseImportMeta = function(t) {
|
|
1262
|
+
this.next();
|
|
1263
|
+
var e = this.containsEsc;
|
|
1264
|
+
return t.property = this.parseIdent(!0), t.property.name !== "meta" && this.raiseRecoverable(t.property.start, "The only valid meta property for import is 'import.meta'"), e && this.raiseRecoverable(t.start, "'import.meta' must not contain escaped characters"), this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere && this.raiseRecoverable(t.start, "Cannot use 'import.meta' outside a module"), this.finishNode(t, "MetaProperty");
|
|
1265
|
+
};
|
|
1266
|
+
f.parseLiteral = function(t) {
|
|
1267
|
+
var e = this.startNode();
|
|
1268
|
+
return e.value = t, e.raw = this.input.slice(this.start, this.end), e.raw.charCodeAt(e.raw.length - 1) === 110 && (e.bigint = e.raw.slice(0, -1).replace(/_/g, "")), this.next(), this.finishNode(e, "Literal");
|
|
1269
|
+
};
|
|
1270
|
+
f.parseParenExpression = function() {
|
|
1271
|
+
this.expect(a.parenL);
|
|
1272
|
+
var t = this.parseExpression();
|
|
1273
|
+
return this.expect(a.parenR), t;
|
|
1274
|
+
};
|
|
1275
|
+
f.shouldParseArrow = function(t) {
|
|
1276
|
+
return !this.canInsertSemicolon();
|
|
1277
|
+
};
|
|
1278
|
+
f.parseParenAndDistinguishExpression = function(t, e) {
|
|
1279
|
+
var s = this.start, i = this.startLoc, r, n = this.options.ecmaVersion >= 8;
|
|
1280
|
+
if (this.options.ecmaVersion >= 6) {
|
|
1281
|
+
this.next();
|
|
1282
|
+
var o = this.start, u = this.startLoc, p = [], c = !0, d = !1, E = new bt(), _ = this.yieldPos, C = this.awaitPos, b;
|
|
1283
|
+
for (this.yieldPos = 0, this.awaitPos = 0; this.type !== a.parenR; ) if (c ? c = !1 : this.expect(a.comma), n && this.afterTrailingComma(a.parenR, !0)) {
|
|
1284
|
+
d = !0;
|
|
1285
|
+
break;
|
|
1286
|
+
} else if (this.type === a.ellipsis) {
|
|
1287
|
+
b = this.start, p.push(this.parseParenItem(this.parseRestBinding())), this.type === a.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
|
|
1288
|
+
break;
|
|
1289
|
+
} else p.push(this.parseMaybeAssign(!1, E, this.parseParenItem));
|
|
1290
|
+
var B = this.lastTokEnd, F = this.lastTokEndLoc;
|
|
1291
|
+
if (this.expect(a.parenR), t && this.shouldParseArrow(p) && this.eat(a.arrow)) return this.checkPatternErrors(E, !1), this.checkYieldAwaitInDefaultParams(), this.yieldPos = _, this.awaitPos = C, this.parseParenArrowList(s, i, p, e);
|
|
1292
|
+
(!p.length || d) && this.unexpected(this.lastTokStart), b && this.unexpected(b), this.checkExpressionErrors(E, !0), this.yieldPos = _ || this.yieldPos, this.awaitPos = C || this.awaitPos, p.length > 1 ? (r = this.startNodeAt(o, u), r.expressions = p, this.finishNodeAt(r, "SequenceExpression", B, F)) : r = p[0];
|
|
1293
|
+
} else r = this.parseParenExpression();
|
|
1294
|
+
if (this.options.preserveParens) {
|
|
1295
|
+
var j = this.startNodeAt(s, i);
|
|
1296
|
+
return j.expression = r, this.finishNode(j, "ParenthesizedExpression");
|
|
1297
|
+
} else return r;
|
|
1298
|
+
};
|
|
1299
|
+
f.parseParenItem = function(t) {
|
|
1300
|
+
return t;
|
|
1301
|
+
};
|
|
1302
|
+
f.parseParenArrowList = function(t, e, s, i) {
|
|
1303
|
+
return this.parseArrowExpression(this.startNodeAt(t, e), s, !1, i);
|
|
1304
|
+
};
|
|
1305
|
+
var bs = [];
|
|
1306
|
+
f.parseNew = function() {
|
|
1307
|
+
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
1308
|
+
var t = this.startNode();
|
|
1309
|
+
if (this.next(), this.options.ecmaVersion >= 6 && this.type === a.dot) {
|
|
1310
|
+
var e = this.startNodeAt(t.start, t.loc && t.loc.start);
|
|
1311
|
+
e.name = "new", t.meta = this.finishNode(e, "Identifier"), this.next();
|
|
1312
|
+
var s = this.containsEsc;
|
|
1313
|
+
return t.property = this.parseIdent(!0), t.property.name !== "target" && this.raiseRecoverable(t.property.start, "The only valid meta property for new is 'new.target'"), s && this.raiseRecoverable(t.start, "'new.target' must not contain escaped characters"), this.allowNewDotTarget || this.raiseRecoverable(t.start, "'new.target' can only be used in functions and class static block"), this.finishNode(t, "MetaProperty");
|
|
1314
|
+
}
|
|
1315
|
+
var i = this.start, r = this.startLoc;
|
|
1316
|
+
return t.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), i, r, !0, !1), this.eat(a.parenL) ? t.arguments = this.parseExprList(a.parenR, this.options.ecmaVersion >= 8, !1) : t.arguments = bs, this.finishNode(t, "NewExpression");
|
|
1317
|
+
};
|
|
1318
|
+
f.parseTemplateElement = function(t) {
|
|
1319
|
+
var e = t.isTagged, s = this.startNode();
|
|
1320
|
+
return this.type === a.invalidTemplate ? (e || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), s.value = { raw: this.value.replace(/\r\n?/g, `
|
|
1321
|
+
`), cooked: null }) : s.value = { raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, `
|
|
1322
|
+
`), cooked: this.value }, this.next(), s.tail = this.type === a.backQuote, this.finishNode(s, "TemplateElement");
|
|
1323
|
+
};
|
|
1324
|
+
f.parseTemplate = function(t) {
|
|
1325
|
+
t === void 0 && (t = {});
|
|
1326
|
+
var e = t.isTagged;
|
|
1327
|
+
e === void 0 && (e = !1);
|
|
1328
|
+
var s = this.startNode();
|
|
1329
|
+
this.next(), s.expressions = [];
|
|
1330
|
+
var i = this.parseTemplateElement({ isTagged: e });
|
|
1331
|
+
for (s.quasis = [i]; !i.tail; ) this.type === a.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(a.dollarBraceL), s.expressions.push(this.parseExpression()), this.expect(a.braceR), s.quasis.push(i = this.parseTemplateElement({ isTagged: e }));
|
|
1332
|
+
return this.next(), this.finishNode(s, "TemplateLiteral");
|
|
1333
|
+
};
|
|
1334
|
+
f.isAsyncProp = function(t) {
|
|
1335
|
+
return !t.computed && t.key.type === "Identifier" && t.key.name === "async" && (this.type === a.name || this.type === a.num || this.type === a.string || this.type === a.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === a.star) && !R.test(this.input.slice(this.lastTokEnd, this.start));
|
|
1336
|
+
};
|
|
1337
|
+
f.parseObj = function(t, e) {
|
|
1338
|
+
var s = this.startNode(), i = !0, r = {};
|
|
1339
|
+
for (s.properties = [], this.next(); !this.eat(a.braceR); ) {
|
|
1340
|
+
if (i) i = !1;
|
|
1341
|
+
else if (this.expect(a.comma), this.options.ecmaVersion >= 5 && this.afterTrailingComma(a.braceR)) break;
|
|
1342
|
+
var n = this.parseProperty(t, e);
|
|
1343
|
+
t || this.checkPropClash(n, r, e), s.properties.push(n);
|
|
1344
|
+
}
|
|
1345
|
+
return this.finishNode(s, t ? "ObjectPattern" : "ObjectExpression");
|
|
1346
|
+
};
|
|
1347
|
+
f.parseProperty = function(t, e) {
|
|
1348
|
+
var s = this.startNode(), i, r, n, o;
|
|
1349
|
+
if (this.options.ecmaVersion >= 9 && this.eat(a.ellipsis)) return t ? (s.argument = this.parseIdent(!1), this.type === a.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.finishNode(s, "RestElement")) : (s.argument = this.parseMaybeAssign(!1, e), this.type === a.comma && e && e.trailingComma < 0 && (e.trailingComma = this.start), this.finishNode(s, "SpreadElement"));
|
|
1350
|
+
this.options.ecmaVersion >= 6 && (s.method = !1, s.shorthand = !1, (t || e) && (n = this.start, o = this.startLoc), t || (i = this.eat(a.star)));
|
|
1351
|
+
var u = this.containsEsc;
|
|
1352
|
+
return this.parsePropertyName(s), !t && !u && this.options.ecmaVersion >= 8 && !i && this.isAsyncProp(s) ? (r = !0, i = this.options.ecmaVersion >= 9 && this.eat(a.star), this.parsePropertyName(s)) : r = !1, this.parsePropertyValue(s, t, i, r, n, o, e, u), this.finishNode(s, "Property");
|
|
1353
|
+
};
|
|
1354
|
+
f.parseGetterSetter = function(t) {
|
|
1355
|
+
t.kind = t.key.name, this.parsePropertyName(t), t.value = this.parseMethod(!1);
|
|
1356
|
+
var e = t.kind === "get" ? 0 : 1;
|
|
1357
|
+
if (t.value.params.length !== e) {
|
|
1358
|
+
var s = t.value.start;
|
|
1359
|
+
t.kind === "get" ? this.raiseRecoverable(s, "getter should have no params") : this.raiseRecoverable(s, "setter should have exactly one param");
|
|
1360
|
+
} else t.kind === "set" && t.value.params[0].type === "RestElement" && this.raiseRecoverable(t.value.params[0].start, "Setter cannot use rest params");
|
|
1361
|
+
};
|
|
1362
|
+
f.parsePropertyValue = function(t, e, s, i, r, n, o, u) {
|
|
1363
|
+
(s || i) && this.type === a.colon && this.unexpected(), this.eat(a.colon) ? (t.value = e ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(!1, o), t.kind = "init") : this.options.ecmaVersion >= 6 && this.type === a.parenL ? (e && this.unexpected(), t.kind = "init", t.method = !0, t.value = this.parseMethod(s, i)) : !e && !u && this.options.ecmaVersion >= 5 && !t.computed && t.key.type === "Identifier" && (t.key.name === "get" || t.key.name === "set") && this.type !== a.comma && this.type !== a.braceR && this.type !== a.eq ? ((s || i) && this.unexpected(), this.parseGetterSetter(t)) : this.options.ecmaVersion >= 6 && !t.computed && t.key.type === "Identifier" ? ((s || i) && this.unexpected(), this.checkUnreserved(t.key), t.key.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = r), t.kind = "init", e ? t.value = this.parseMaybeDefault(r, n, this.copyNode(t.key)) : this.type === a.eq && o ? (o.shorthandAssign < 0 && (o.shorthandAssign = this.start), t.value = this.parseMaybeDefault(r, n, this.copyNode(t.key))) : t.value = this.copyNode(t.key), t.shorthand = !0) : this.unexpected();
|
|
1364
|
+
};
|
|
1365
|
+
f.parsePropertyName = function(t) {
|
|
1366
|
+
if (this.options.ecmaVersion >= 6) {
|
|
1367
|
+
if (this.eat(a.bracketL)) return t.computed = !0, t.key = this.parseMaybeAssign(), this.expect(a.bracketR), t.key;
|
|
1368
|
+
t.computed = !1;
|
|
1369
|
+
}
|
|
1370
|
+
return t.key = this.type === a.num || this.type === a.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
1371
|
+
};
|
|
1372
|
+
f.initFunction = function(t) {
|
|
1373
|
+
t.id = null, this.options.ecmaVersion >= 6 && (t.generator = t.expression = !1), this.options.ecmaVersion >= 8 && (t.async = !1);
|
|
1374
|
+
};
|
|
1375
|
+
f.parseMethod = function(t, e, s) {
|
|
1376
|
+
var i = this.startNode(), r = this.yieldPos, n = this.awaitPos, o = this.awaitIdentPos;
|
|
1377
|
+
return this.initFunction(i), this.options.ecmaVersion >= 6 && (i.generator = t), this.options.ecmaVersion >= 8 && (i.async = !!e), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Kt(e, i.generator) | Jt | (s ? ge : 0)), this.expect(a.parenL), i.params = this.parseBindingList(a.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(i, !1, !0, !1), this.yieldPos = r, this.awaitPos = n, this.awaitIdentPos = o, this.finishNode(i, "FunctionExpression");
|
|
1378
|
+
};
|
|
1379
|
+
f.parseArrowExpression = function(t, e, s, i) {
|
|
1380
|
+
var r = this.yieldPos, n = this.awaitPos, o = this.awaitIdentPos;
|
|
1381
|
+
return this.enterScope(Kt(s, !1) | ye), this.initFunction(t), this.options.ecmaVersion >= 8 && (t.async = !!s), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, t.params = this.toAssignableList(e, !0), this.parseFunctionBody(t, !0, !1, i), this.yieldPos = r, this.awaitPos = n, this.awaitIdentPos = o, this.finishNode(t, "ArrowFunctionExpression");
|
|
1382
|
+
};
|
|
1383
|
+
f.parseFunctionBody = function(t, e, s, i) {
|
|
1384
|
+
var r = e && this.type !== a.braceL, n = this.strict, o = !1;
|
|
1385
|
+
if (r) t.body = this.parseMaybeAssign(i), t.expression = !0, this.checkParams(t, !1);
|
|
1386
|
+
else {
|
|
1387
|
+
var u = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(t.params);
|
|
1388
|
+
(!n || u) && (o = this.strictDirective(this.end), o && u && this.raiseRecoverable(t.start, "Illegal 'use strict' directive in function with non-simple parameter list"));
|
|
1389
|
+
var p = this.labels;
|
|
1390
|
+
this.labels = [], o && (this.strict = !0), this.checkParams(t, !n && !o && !e && !s && this.isSimpleParamList(t.params)), this.strict && t.id && this.checkLValSimple(t.id, Ce), t.body = this.parseBlock(!1, void 0, o && !n), t.expression = !1, this.adaptDirectivePrologue(t.body.body), this.labels = p;
|
|
1391
|
+
}
|
|
1392
|
+
this.exitScope();
|
|
1393
|
+
};
|
|
1394
|
+
f.isSimpleParamList = function(t) {
|
|
1395
|
+
for (var e = 0, s = t; e < s.length; e += 1) {
|
|
1396
|
+
var i = s[e];
|
|
1397
|
+
if (i.type !== "Identifier") return !1;
|
|
1398
|
+
}
|
|
1399
|
+
return !0;
|
|
1400
|
+
};
|
|
1401
|
+
f.checkParams = function(t, e) {
|
|
1402
|
+
for (var s = /* @__PURE__ */ Object.create(null), i = 0, r = t.params; i < r.length; i += 1) {
|
|
1403
|
+
var n = r[i];
|
|
1404
|
+
this.checkLValInnerPattern(n, Ht, e ? null : s);
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
f.parseExprList = function(t, e, s, i) {
|
|
1408
|
+
for (var r = [], n = !0; !this.eat(t); ) {
|
|
1409
|
+
if (n) n = !1;
|
|
1410
|
+
else if (this.expect(a.comma), e && this.afterTrailingComma(t)) break;
|
|
1411
|
+
var o = void 0;
|
|
1412
|
+
s && this.type === a.comma ? o = null : this.type === a.ellipsis ? (o = this.parseSpread(i), i && this.type === a.comma && i.trailingComma < 0 && (i.trailingComma = this.start)) : o = this.parseMaybeAssign(!1, i), r.push(o);
|
|
1413
|
+
}
|
|
1414
|
+
return r;
|
|
1415
|
+
};
|
|
1416
|
+
f.checkUnreserved = function(t) {
|
|
1417
|
+
var e = t.start, s = t.end, i = t.name;
|
|
1418
|
+
if (this.inGenerator && i === "yield" && this.raiseRecoverable(e, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && i === "await" && this.raiseRecoverable(e, "Cannot use 'await' as identifier inside an async function"), this.currentThisScope().inClassFieldInit && i === "arguments" && this.raiseRecoverable(e, "Cannot use 'arguments' in class field initializer"), this.inClassStaticBlock && (i === "arguments" || i === "await") && this.raise(e, "Cannot use " + i + " in class static initialization block"), this.keywords.test(i) && this.raise(e, "Unexpected keyword '" + i + "'"), !(this.options.ecmaVersion < 6 && this.input.slice(e, s).indexOf("\\") !== -1)) {
|
|
1419
|
+
var r = this.strict ? this.reservedWordsStrict : this.reservedWords;
|
|
1420
|
+
r.test(i) && (!this.inAsync && i === "await" && this.raiseRecoverable(e, "Cannot use keyword 'await' outside an async function"), this.raiseRecoverable(e, "The keyword '" + i + "' is reserved"));
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
f.parseIdent = function(t) {
|
|
1424
|
+
var e = this.parseIdentNode();
|
|
1425
|
+
return this.next(!!t), this.finishNode(e, "Identifier"), t || (this.checkUnreserved(e), e.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = e.start)), e;
|
|
1426
|
+
};
|
|
1427
|
+
f.parseIdentNode = function() {
|
|
1428
|
+
var t = this.startNode();
|
|
1429
|
+
return this.type === a.name ? t.name = this.value : this.type.keyword ? (t.name = this.type.keyword, (t.name === "class" || t.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46) && this.context.pop(), this.type = a.name) : this.unexpected(), t;
|
|
1430
|
+
};
|
|
1431
|
+
f.parsePrivateIdent = function() {
|
|
1432
|
+
var t = this.startNode();
|
|
1433
|
+
return this.type === a.privateId ? t.name = this.value : this.unexpected(), this.next(), this.finishNode(t, "PrivateIdentifier"), this.options.checkPrivateFields && (this.privateNameStack.length === 0 ? this.raise(t.start, "Private field '#" + t.name + "' must be declared in an enclosing class") : this.privateNameStack[this.privateNameStack.length - 1].used.push(t)), t;
|
|
1434
|
+
};
|
|
1435
|
+
f.parseYield = function(t) {
|
|
1436
|
+
this.yieldPos || (this.yieldPos = this.start);
|
|
1437
|
+
var e = this.startNode();
|
|
1438
|
+
return this.next(), this.type === a.semi || this.canInsertSemicolon() || this.type !== a.star && !this.type.startsExpr ? (e.delegate = !1, e.argument = null) : (e.delegate = this.eat(a.star), e.argument = this.parseMaybeAssign(t)), this.finishNode(e, "YieldExpression");
|
|
1439
|
+
};
|
|
1440
|
+
f.parseAwait = function(t) {
|
|
1441
|
+
this.awaitPos || (this.awaitPos = this.start);
|
|
1442
|
+
var e = this.startNode();
|
|
1443
|
+
return this.next(), e.argument = this.parseMaybeUnary(null, !0, !1, t), this.finishNode(e, "AwaitExpression");
|
|
1444
|
+
};
|
|
1445
|
+
var At = T.prototype;
|
|
1446
|
+
At.raise = function(t, e) {
|
|
1447
|
+
var s = me(this.input, t);
|
|
1448
|
+
e += " (" + s.line + ":" + s.column + ")";
|
|
1449
|
+
var i = new SyntaxError(e);
|
|
1450
|
+
throw i.pos = t, i.loc = s, i.raisedAt = this.pos, i;
|
|
1451
|
+
};
|
|
1452
|
+
At.raiseRecoverable = At.raise;
|
|
1453
|
+
At.curPosition = function() {
|
|
1454
|
+
if (this.options.locations) return new ot(this.curLine, this.pos - this.lineStart);
|
|
1455
|
+
};
|
|
1456
|
+
var Q = T.prototype, Ss = function(t) {
|
|
1457
|
+
this.flags = t, this.var = [], this.lexical = [], this.functions = [], this.inClassFieldInit = !1;
|
|
1458
|
+
};
|
|
1459
|
+
Q.enterScope = function(t) {
|
|
1460
|
+
this.scopeStack.push(new Ss(t));
|
|
1461
|
+
};
|
|
1462
|
+
Q.exitScope = function() {
|
|
1463
|
+
this.scopeStack.pop();
|
|
1464
|
+
};
|
|
1465
|
+
Q.treatFunctionsAsVarInScope = function(t) {
|
|
1466
|
+
return t.flags & st || !this.inModule && t.flags & ut;
|
|
1467
|
+
};
|
|
1468
|
+
Q.declareName = function(t, e, s) {
|
|
1469
|
+
var i = !1;
|
|
1470
|
+
if (e === K) {
|
|
1471
|
+
var r = this.currentScope();
|
|
1472
|
+
i = r.lexical.indexOf(t) > -1 || r.functions.indexOf(t) > -1 || r.var.indexOf(t) > -1, r.lexical.push(t), this.inModule && r.flags & ut && delete this.undefinedExports[t];
|
|
1473
|
+
} else if (e === ve) {
|
|
1474
|
+
var n = this.currentScope();
|
|
1475
|
+
n.lexical.push(t);
|
|
1476
|
+
} else if (e === Ae) {
|
|
1477
|
+
var o = this.currentScope();
|
|
1478
|
+
this.treatFunctionsAsVar ? i = o.lexical.indexOf(t) > -1 : i = o.lexical.indexOf(t) > -1 || o.var.indexOf(t) > -1, o.functions.push(t);
|
|
1479
|
+
} else for (var u = this.scopeStack.length - 1; u >= 0; --u) {
|
|
1480
|
+
var p = this.scopeStack[u];
|
|
1481
|
+
if (p.lexical.indexOf(t) > -1 && !(p.flags & xe && p.lexical[0] === t) || !this.treatFunctionsAsVarInScope(p) && p.functions.indexOf(t) > -1) {
|
|
1482
|
+
i = !0;
|
|
1483
|
+
break;
|
|
1484
|
+
}
|
|
1485
|
+
if (p.var.push(t), this.inModule && p.flags & ut && delete this.undefinedExports[t], p.flags & Xt) break;
|
|
1486
|
+
}
|
|
1487
|
+
i && this.raiseRecoverable(s, "Identifier '" + t + "' has already been declared");
|
|
1488
|
+
};
|
|
1489
|
+
Q.checkLocalExport = function(t) {
|
|
1490
|
+
this.scopeStack[0].lexical.indexOf(t.name) === -1 && this.scopeStack[0].var.indexOf(t.name) === -1 && (this.undefinedExports[t.name] = t);
|
|
1491
|
+
};
|
|
1492
|
+
Q.currentScope = function() {
|
|
1493
|
+
return this.scopeStack[this.scopeStack.length - 1];
|
|
1494
|
+
};
|
|
1495
|
+
Q.currentVarScope = function() {
|
|
1496
|
+
for (var t = this.scopeStack.length - 1; ; t--) {
|
|
1497
|
+
var e = this.scopeStack[t];
|
|
1498
|
+
if (e.flags & Xt) return e;
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
Q.currentThisScope = function() {
|
|
1502
|
+
for (var t = this.scopeStack.length - 1; ; t--) {
|
|
1503
|
+
var e = this.scopeStack[t];
|
|
1504
|
+
if (e.flags & Xt && !(e.flags & ye)) return e;
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
var St = function(t, e, s) {
|
|
1508
|
+
this.type = "", this.start = e, this.end = 0, t.options.locations && (this.loc = new Et(t, s)), t.options.directSourceFile && (this.sourceFile = t.options.directSourceFile), t.options.ranges && (this.range = [e, 0]);
|
|
1509
|
+
}, ct = T.prototype;
|
|
1510
|
+
ct.startNode = function() {
|
|
1511
|
+
return new St(this, this.start, this.startLoc);
|
|
1512
|
+
};
|
|
1513
|
+
ct.startNodeAt = function(t, e) {
|
|
1514
|
+
return new St(this, t, e);
|
|
1515
|
+
};
|
|
1516
|
+
function Se(t, e, s, i) {
|
|
1517
|
+
return t.type = e, t.end = s, this.options.locations && (t.loc.end = i), this.options.ranges && (t.range[1] = s), t;
|
|
1518
|
+
}
|
|
1519
|
+
ct.finishNode = function(t, e) {
|
|
1520
|
+
return Se.call(this, t, e, this.lastTokEnd, this.lastTokEndLoc);
|
|
1521
|
+
};
|
|
1522
|
+
ct.finishNodeAt = function(t, e, s, i) {
|
|
1523
|
+
return Se.call(this, t, e, s, i);
|
|
1524
|
+
};
|
|
1525
|
+
ct.copyNode = function(t) {
|
|
1526
|
+
var e = new St(this, t.start, this.startLoc);
|
|
1527
|
+
for (var s in t) e[s] = t[s];
|
|
1528
|
+
return e;
|
|
1529
|
+
};
|
|
1530
|
+
var ke = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", Te = ke + " Extended_Pictographic", _e = Te, we = _e + " EBase EComp EMod EPres ExtPict", De = we, ks = De, Ts = { 9: ke, 10: Te, 11: _e, 12: we, 13: De, 14: ks }, _s = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji", ws = { 9: "", 10: "", 11: "", 12: "", 13: "", 14: _s }, Zt = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu", Fe = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb", Pe = Fe + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", Be = Pe + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", Ie = Be + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", Ne = Ie + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith", Ds = Ne + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz", Fs = { 9: Fe, 10: Pe, 11: Be, 12: Ie, 13: Ne, 14: Ds }, Ve = {};
|
|
1531
|
+
function Ps(t) {
|
|
1532
|
+
var e = Ve[t] = { binary: W(Ts[t] + " " + Zt), binaryOfStrings: W(ws[t]), nonBinary: { General_Category: W(Zt), Script: W(Fs[t]) } };
|
|
1533
|
+
e.nonBinary.Script_Extensions = e.nonBinary.Script, e.nonBinary.gc = e.nonBinary.General_Category, e.nonBinary.sc = e.nonBinary.Script, e.nonBinary.scx = e.nonBinary.Script_Extensions;
|
|
1534
|
+
}
|
|
1535
|
+
for (ft = 0, Dt = [9, 10, 11, 12, 13, 14]; ft < Dt.length; ft += 1) te = Dt[ft], Ps(te);
|
|
1536
|
+
var te, ft, Dt, l = T.prototype, vt = function(t, e) {
|
|
1537
|
+
this.parent = t, this.base = e || this;
|
|
1538
|
+
};
|
|
1539
|
+
vt.prototype.separatedFrom = function(t) {
|
|
1540
|
+
for (var e = this; e; e = e.parent) for (var s = t; s; s = s.parent) if (e.base === s.base && e !== s) return !0;
|
|
1541
|
+
return !1;
|
|
1542
|
+
};
|
|
1543
|
+
vt.prototype.sibling = function() {
|
|
1544
|
+
return new vt(this.parent, this.base);
|
|
1545
|
+
};
|
|
1546
|
+
var G = function(t) {
|
|
1547
|
+
this.parser = t, this.validFlags = "gim" + (t.options.ecmaVersion >= 6 ? "uy" : "") + (t.options.ecmaVersion >= 9 ? "s" : "") + (t.options.ecmaVersion >= 13 ? "d" : "") + (t.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = Ve[t.options.ecmaVersion >= 14 ? 14 : t.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = /* @__PURE__ */ Object.create(null), this.backReferenceNames = [], this.branchID = null;
|
|
1548
|
+
};
|
|
1549
|
+
G.prototype.reset = function(t, e, s) {
|
|
1550
|
+
var i = s.indexOf("v") !== -1, r = s.indexOf("u") !== -1;
|
|
1551
|
+
this.start = t | 0, this.source = e + "", this.flags = s, i && this.parser.options.ecmaVersion >= 15 ? (this.switchU = !0, this.switchV = !0, this.switchN = !0) : (this.switchU = r && this.parser.options.ecmaVersion >= 6, this.switchV = !1, this.switchN = r && this.parser.options.ecmaVersion >= 9);
|
|
1552
|
+
};
|
|
1553
|
+
G.prototype.raise = function(t) {
|
|
1554
|
+
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + t);
|
|
1555
|
+
};
|
|
1556
|
+
G.prototype.at = function(t, e) {
|
|
1557
|
+
e === void 0 && (e = !1);
|
|
1558
|
+
var s = this.source, i = s.length;
|
|
1559
|
+
if (t >= i) return -1;
|
|
1560
|
+
var r = s.charCodeAt(t);
|
|
1561
|
+
if (!(e || this.switchU) || r <= 55295 || r >= 57344 || t + 1 >= i) return r;
|
|
1562
|
+
var n = s.charCodeAt(t + 1);
|
|
1563
|
+
return n >= 56320 && n <= 57343 ? (r << 10) + n - 56613888 : r;
|
|
1564
|
+
};
|
|
1565
|
+
G.prototype.nextIndex = function(t, e) {
|
|
1566
|
+
e === void 0 && (e = !1);
|
|
1567
|
+
var s = this.source, i = s.length;
|
|
1568
|
+
if (t >= i) return i;
|
|
1569
|
+
var r = s.charCodeAt(t), n;
|
|
1570
|
+
return !(e || this.switchU) || r <= 55295 || r >= 57344 || t + 1 >= i || (n = s.charCodeAt(t + 1)) < 56320 || n > 57343 ? t + 1 : t + 2;
|
|
1571
|
+
};
|
|
1572
|
+
G.prototype.current = function(t) {
|
|
1573
|
+
return t === void 0 && (t = !1), this.at(this.pos, t);
|
|
1574
|
+
};
|
|
1575
|
+
G.prototype.lookahead = function(t) {
|
|
1576
|
+
return t === void 0 && (t = !1), this.at(this.nextIndex(this.pos, t), t);
|
|
1577
|
+
};
|
|
1578
|
+
G.prototype.advance = function(t) {
|
|
1579
|
+
t === void 0 && (t = !1), this.pos = this.nextIndex(this.pos, t);
|
|
1580
|
+
};
|
|
1581
|
+
G.prototype.eat = function(t, e) {
|
|
1582
|
+
return e === void 0 && (e = !1), this.current(e) === t ? (this.advance(e), !0) : !1;
|
|
1583
|
+
};
|
|
1584
|
+
G.prototype.eatChars = function(t, e) {
|
|
1585
|
+
e === void 0 && (e = !1);
|
|
1586
|
+
for (var s = this.pos, i = 0, r = t; i < r.length; i += 1) {
|
|
1587
|
+
var n = r[i], o = this.at(s, e);
|
|
1588
|
+
if (o === -1 || o !== n) return !1;
|
|
1589
|
+
s = this.nextIndex(s, e);
|
|
1590
|
+
}
|
|
1591
|
+
return this.pos = s, !0;
|
|
1592
|
+
};
|
|
1593
|
+
l.validateRegExpFlags = function(t) {
|
|
1594
|
+
for (var e = t.validFlags, s = t.flags, i = !1, r = !1, n = 0; n < s.length; n++) {
|
|
1595
|
+
var o = s.charAt(n);
|
|
1596
|
+
e.indexOf(o) === -1 && this.raise(t.start, "Invalid regular expression flag"), s.indexOf(o, n + 1) > -1 && this.raise(t.start, "Duplicate regular expression flag"), o === "u" && (i = !0), o === "v" && (r = !0);
|
|
1597
|
+
}
|
|
1598
|
+
this.options.ecmaVersion >= 15 && i && r && this.raise(t.start, "Invalid regular expression flag");
|
|
1599
|
+
};
|
|
1600
|
+
function Bs(t) {
|
|
1601
|
+
for (var e in t) return !0;
|
|
1602
|
+
return !1;
|
|
1603
|
+
}
|
|
1604
|
+
l.validateRegExpPattern = function(t) {
|
|
1605
|
+
this.regexp_pattern(t), !t.switchN && this.options.ecmaVersion >= 9 && Bs(t.groupNames) && (t.switchN = !0, this.regexp_pattern(t));
|
|
1606
|
+
};
|
|
1607
|
+
l.regexp_pattern = function(t) {
|
|
1608
|
+
t.pos = 0, t.lastIntValue = 0, t.lastStringValue = "", t.lastAssertionIsQuantifiable = !1, t.numCapturingParens = 0, t.maxBackReference = 0, t.groupNames = /* @__PURE__ */ Object.create(null), t.backReferenceNames.length = 0, t.branchID = null, this.regexp_disjunction(t), t.pos !== t.source.length && (t.eat(41) && t.raise("Unmatched ')'"), (t.eat(93) || t.eat(125)) && t.raise("Lone quantifier brackets")), t.maxBackReference > t.numCapturingParens && t.raise("Invalid escape");
|
|
1609
|
+
for (var e = 0, s = t.backReferenceNames; e < s.length; e += 1) {
|
|
1610
|
+
var i = s[e];
|
|
1611
|
+
t.groupNames[i] || t.raise("Invalid named capture referenced");
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
l.regexp_disjunction = function(t) {
|
|
1615
|
+
var e = this.options.ecmaVersion >= 16;
|
|
1616
|
+
for (e && (t.branchID = new vt(t.branchID, null)), this.regexp_alternative(t); t.eat(124); ) e && (t.branchID = t.branchID.sibling()), this.regexp_alternative(t);
|
|
1617
|
+
e && (t.branchID = t.branchID.parent), this.regexp_eatQuantifier(t, !0) && t.raise("Nothing to repeat"), t.eat(123) && t.raise("Lone quantifier brackets");
|
|
1618
|
+
};
|
|
1619
|
+
l.regexp_alternative = function(t) {
|
|
1620
|
+
for (; t.pos < t.source.length && this.regexp_eatTerm(t); ) ;
|
|
1621
|
+
};
|
|
1622
|
+
l.regexp_eatTerm = function(t) {
|
|
1623
|
+
return this.regexp_eatAssertion(t) ? (t.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(t) && t.switchU && t.raise("Invalid quantifier"), !0) : (t.switchU ? this.regexp_eatAtom(t) : this.regexp_eatExtendedAtom(t)) ? (this.regexp_eatQuantifier(t), !0) : !1;
|
|
1624
|
+
};
|
|
1625
|
+
l.regexp_eatAssertion = function(t) {
|
|
1626
|
+
var e = t.pos;
|
|
1627
|
+
if (t.lastAssertionIsQuantifiable = !1, t.eat(94) || t.eat(36)) return !0;
|
|
1628
|
+
if (t.eat(92)) {
|
|
1629
|
+
if (t.eat(66) || t.eat(98)) return !0;
|
|
1630
|
+
t.pos = e;
|
|
1631
|
+
}
|
|
1632
|
+
if (t.eat(40) && t.eat(63)) {
|
|
1633
|
+
var s = !1;
|
|
1634
|
+
if (this.options.ecmaVersion >= 9 && (s = t.eat(60)), t.eat(61) || t.eat(33)) return this.regexp_disjunction(t), t.eat(41) || t.raise("Unterminated group"), t.lastAssertionIsQuantifiable = !s, !0;
|
|
1635
|
+
}
|
|
1636
|
+
return t.pos = e, !1;
|
|
1637
|
+
};
|
|
1638
|
+
l.regexp_eatQuantifier = function(t, e) {
|
|
1639
|
+
return e === void 0 && (e = !1), this.regexp_eatQuantifierPrefix(t, e) ? (t.eat(63), !0) : !1;
|
|
1640
|
+
};
|
|
1641
|
+
l.regexp_eatQuantifierPrefix = function(t, e) {
|
|
1642
|
+
return t.eat(42) || t.eat(43) || t.eat(63) || this.regexp_eatBracedQuantifier(t, e);
|
|
1643
|
+
};
|
|
1644
|
+
l.regexp_eatBracedQuantifier = function(t, e) {
|
|
1645
|
+
var s = t.pos;
|
|
1646
|
+
if (t.eat(123)) {
|
|
1647
|
+
var i = 0, r = -1;
|
|
1648
|
+
if (this.regexp_eatDecimalDigits(t) && (i = t.lastIntValue, t.eat(44) && this.regexp_eatDecimalDigits(t) && (r = t.lastIntValue), t.eat(125))) return r !== -1 && r < i && !e && t.raise("numbers out of order in {} quantifier"), !0;
|
|
1649
|
+
t.switchU && !e && t.raise("Incomplete quantifier"), t.pos = s;
|
|
1650
|
+
}
|
|
1651
|
+
return !1;
|
|
1652
|
+
};
|
|
1653
|
+
l.regexp_eatAtom = function(t) {
|
|
1654
|
+
return this.regexp_eatPatternCharacters(t) || t.eat(46) || this.regexp_eatReverseSolidusAtomEscape(t) || this.regexp_eatCharacterClass(t) || this.regexp_eatUncapturingGroup(t) || this.regexp_eatCapturingGroup(t);
|
|
1655
|
+
};
|
|
1656
|
+
l.regexp_eatReverseSolidusAtomEscape = function(t) {
|
|
1657
|
+
var e = t.pos;
|
|
1658
|
+
if (t.eat(92)) {
|
|
1659
|
+
if (this.regexp_eatAtomEscape(t)) return !0;
|
|
1660
|
+
t.pos = e;
|
|
1661
|
+
}
|
|
1662
|
+
return !1;
|
|
1663
|
+
};
|
|
1664
|
+
l.regexp_eatUncapturingGroup = function(t) {
|
|
1665
|
+
var e = t.pos;
|
|
1666
|
+
if (t.eat(40)) {
|
|
1667
|
+
if (t.eat(63) && t.eat(58)) {
|
|
1668
|
+
if (this.regexp_disjunction(t), t.eat(41)) return !0;
|
|
1669
|
+
t.raise("Unterminated group");
|
|
1670
|
+
}
|
|
1671
|
+
t.pos = e;
|
|
1672
|
+
}
|
|
1673
|
+
return !1;
|
|
1674
|
+
};
|
|
1675
|
+
l.regexp_eatCapturingGroup = function(t) {
|
|
1676
|
+
if (t.eat(40)) {
|
|
1677
|
+
if (this.options.ecmaVersion >= 9 ? this.regexp_groupSpecifier(t) : t.current() === 63 && t.raise("Invalid group"), this.regexp_disjunction(t), t.eat(41)) return t.numCapturingParens += 1, !0;
|
|
1678
|
+
t.raise("Unterminated group");
|
|
1679
|
+
}
|
|
1680
|
+
return !1;
|
|
1681
|
+
};
|
|
1682
|
+
l.regexp_eatExtendedAtom = function(t) {
|
|
1683
|
+
return t.eat(46) || this.regexp_eatReverseSolidusAtomEscape(t) || this.regexp_eatCharacterClass(t) || this.regexp_eatUncapturingGroup(t) || this.regexp_eatCapturingGroup(t) || this.regexp_eatInvalidBracedQuantifier(t) || this.regexp_eatExtendedPatternCharacter(t);
|
|
1684
|
+
};
|
|
1685
|
+
l.regexp_eatInvalidBracedQuantifier = function(t) {
|
|
1686
|
+
return this.regexp_eatBracedQuantifier(t, !0) && t.raise("Nothing to repeat"), !1;
|
|
1687
|
+
};
|
|
1688
|
+
l.regexp_eatSyntaxCharacter = function(t) {
|
|
1689
|
+
var e = t.current();
|
|
1690
|
+
return Le(e) ? (t.lastIntValue = e, t.advance(), !0) : !1;
|
|
1691
|
+
};
|
|
1692
|
+
function Le(t) {
|
|
1693
|
+
return t === 36 || t >= 40 && t <= 43 || t === 46 || t === 63 || t >= 91 && t <= 94 || t >= 123 && t <= 125;
|
|
1694
|
+
}
|
|
1695
|
+
l.regexp_eatPatternCharacters = function(t) {
|
|
1696
|
+
for (var e = t.pos, s = 0; (s = t.current()) !== -1 && !Le(s); ) t.advance();
|
|
1697
|
+
return t.pos !== e;
|
|
1698
|
+
};
|
|
1699
|
+
l.regexp_eatExtendedPatternCharacter = function(t) {
|
|
1700
|
+
var e = t.current();
|
|
1701
|
+
return e !== -1 && e !== 36 && !(e >= 40 && e <= 43) && e !== 46 && e !== 63 && e !== 91 && e !== 94 && e !== 124 ? (t.advance(), !0) : !1;
|
|
1702
|
+
};
|
|
1703
|
+
l.regexp_groupSpecifier = function(t) {
|
|
1704
|
+
if (t.eat(63)) {
|
|
1705
|
+
this.regexp_eatGroupName(t) || t.raise("Invalid group");
|
|
1706
|
+
var e = this.options.ecmaVersion >= 16, s = t.groupNames[t.lastStringValue];
|
|
1707
|
+
if (s) if (e) for (var i = 0, r = s; i < r.length; i += 1) {
|
|
1708
|
+
var n = r[i];
|
|
1709
|
+
n.separatedFrom(t.branchID) || t.raise("Duplicate capture group name");
|
|
1710
|
+
}
|
|
1711
|
+
else t.raise("Duplicate capture group name");
|
|
1712
|
+
e ? (s || (t.groupNames[t.lastStringValue] = [])).push(t.branchID) : t.groupNames[t.lastStringValue] = !0;
|
|
1713
|
+
}
|
|
1714
|
+
};
|
|
1715
|
+
l.regexp_eatGroupName = function(t) {
|
|
1716
|
+
if (t.lastStringValue = "", t.eat(60)) {
|
|
1717
|
+
if (this.regexp_eatRegExpIdentifierName(t) && t.eat(62)) return !0;
|
|
1718
|
+
t.raise("Invalid capture group name");
|
|
1719
|
+
}
|
|
1720
|
+
return !1;
|
|
1721
|
+
};
|
|
1722
|
+
l.regexp_eatRegExpIdentifierName = function(t) {
|
|
1723
|
+
if (t.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(t)) {
|
|
1724
|
+
for (t.lastStringValue += z(t.lastIntValue); this.regexp_eatRegExpIdentifierPart(t); ) t.lastStringValue += z(t.lastIntValue);
|
|
1725
|
+
return !0;
|
|
1726
|
+
}
|
|
1727
|
+
return !1;
|
|
1728
|
+
};
|
|
1729
|
+
l.regexp_eatRegExpIdentifierStart = function(t) {
|
|
1730
|
+
var e = t.pos, s = this.options.ecmaVersion >= 11, i = t.current(s);
|
|
1731
|
+
return t.advance(s), i === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(t, s) && (i = t.lastIntValue), Is(i) ? (t.lastIntValue = i, !0) : (t.pos = e, !1);
|
|
1732
|
+
};
|
|
1733
|
+
function Is(t) {
|
|
1734
|
+
return J(t, !0) || t === 36 || t === 95;
|
|
1735
|
+
}
|
|
1736
|
+
l.regexp_eatRegExpIdentifierPart = function(t) {
|
|
1737
|
+
var e = t.pos, s = this.options.ecmaVersion >= 11, i = t.current(s);
|
|
1738
|
+
return t.advance(s), i === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(t, s) && (i = t.lastIntValue), Ns(i) ? (t.lastIntValue = i, !0) : (t.pos = e, !1);
|
|
1739
|
+
};
|
|
1740
|
+
function Ns(t) {
|
|
1741
|
+
return tt(t, !0) || t === 36 || t === 95 || t === 8204 || t === 8205;
|
|
1742
|
+
}
|
|
1743
|
+
l.regexp_eatAtomEscape = function(t) {
|
|
1744
|
+
return this.regexp_eatBackReference(t) || this.regexp_eatCharacterClassEscape(t) || this.regexp_eatCharacterEscape(t) || t.switchN && this.regexp_eatKGroupName(t) ? !0 : (t.switchU && (t.current() === 99 && t.raise("Invalid unicode escape"), t.raise("Invalid escape")), !1);
|
|
1745
|
+
};
|
|
1746
|
+
l.regexp_eatBackReference = function(t) {
|
|
1747
|
+
var e = t.pos;
|
|
1748
|
+
if (this.regexp_eatDecimalEscape(t)) {
|
|
1749
|
+
var s = t.lastIntValue;
|
|
1750
|
+
if (t.switchU) return s > t.maxBackReference && (t.maxBackReference = s), !0;
|
|
1751
|
+
if (s <= t.numCapturingParens) return !0;
|
|
1752
|
+
t.pos = e;
|
|
1753
|
+
}
|
|
1754
|
+
return !1;
|
|
1755
|
+
};
|
|
1756
|
+
l.regexp_eatKGroupName = function(t) {
|
|
1757
|
+
if (t.eat(107)) {
|
|
1758
|
+
if (this.regexp_eatGroupName(t)) return t.backReferenceNames.push(t.lastStringValue), !0;
|
|
1759
|
+
t.raise("Invalid named reference");
|
|
1760
|
+
}
|
|
1761
|
+
return !1;
|
|
1762
|
+
};
|
|
1763
|
+
l.regexp_eatCharacterEscape = function(t) {
|
|
1764
|
+
return this.regexp_eatControlEscape(t) || this.regexp_eatCControlLetter(t) || this.regexp_eatZero(t) || this.regexp_eatHexEscapeSequence(t) || this.regexp_eatRegExpUnicodeEscapeSequence(t, !1) || !t.switchU && this.regexp_eatLegacyOctalEscapeSequence(t) || this.regexp_eatIdentityEscape(t);
|
|
1765
|
+
};
|
|
1766
|
+
l.regexp_eatCControlLetter = function(t) {
|
|
1767
|
+
var e = t.pos;
|
|
1768
|
+
if (t.eat(99)) {
|
|
1769
|
+
if (this.regexp_eatControlLetter(t)) return !0;
|
|
1770
|
+
t.pos = e;
|
|
1771
|
+
}
|
|
1772
|
+
return !1;
|
|
1773
|
+
};
|
|
1774
|
+
l.regexp_eatZero = function(t) {
|
|
1775
|
+
return t.current() === 48 && !kt(t.lookahead()) ? (t.lastIntValue = 0, t.advance(), !0) : !1;
|
|
1776
|
+
};
|
|
1777
|
+
l.regexp_eatControlEscape = function(t) {
|
|
1778
|
+
var e = t.current();
|
|
1779
|
+
return e === 116 ? (t.lastIntValue = 9, t.advance(), !0) : e === 110 ? (t.lastIntValue = 10, t.advance(), !0) : e === 118 ? (t.lastIntValue = 11, t.advance(), !0) : e === 102 ? (t.lastIntValue = 12, t.advance(), !0) : e === 114 ? (t.lastIntValue = 13, t.advance(), !0) : !1;
|
|
1780
|
+
};
|
|
1781
|
+
l.regexp_eatControlLetter = function(t) {
|
|
1782
|
+
var e = t.current();
|
|
1783
|
+
return Re(e) ? (t.lastIntValue = e % 32, t.advance(), !0) : !1;
|
|
1784
|
+
};
|
|
1785
|
+
function Re(t) {
|
|
1786
|
+
return t >= 65 && t <= 90 || t >= 97 && t <= 122;
|
|
1787
|
+
}
|
|
1788
|
+
l.regexp_eatRegExpUnicodeEscapeSequence = function(t, e) {
|
|
1789
|
+
e === void 0 && (e = !1);
|
|
1790
|
+
var s = t.pos, i = e || t.switchU;
|
|
1791
|
+
if (t.eat(117)) {
|
|
1792
|
+
if (this.regexp_eatFixedHexDigits(t, 4)) {
|
|
1793
|
+
var r = t.lastIntValue;
|
|
1794
|
+
if (i && r >= 55296 && r <= 56319) {
|
|
1795
|
+
var n = t.pos;
|
|
1796
|
+
if (t.eat(92) && t.eat(117) && this.regexp_eatFixedHexDigits(t, 4)) {
|
|
1797
|
+
var o = t.lastIntValue;
|
|
1798
|
+
if (o >= 56320 && o <= 57343) return t.lastIntValue = (r - 55296) * 1024 + (o - 56320) + 65536, !0;
|
|
1799
|
+
}
|
|
1800
|
+
t.pos = n, t.lastIntValue = r;
|
|
1801
|
+
}
|
|
1802
|
+
return !0;
|
|
1803
|
+
}
|
|
1804
|
+
if (i && t.eat(123) && this.regexp_eatHexDigits(t) && t.eat(125) && Vs(t.lastIntValue)) return !0;
|
|
1805
|
+
i && t.raise("Invalid unicode escape"), t.pos = s;
|
|
1806
|
+
}
|
|
1807
|
+
return !1;
|
|
1808
|
+
};
|
|
1809
|
+
function Vs(t) {
|
|
1810
|
+
return t >= 0 && t <= 1114111;
|
|
1811
|
+
}
|
|
1812
|
+
l.regexp_eatIdentityEscape = function(t) {
|
|
1813
|
+
if (t.switchU) return this.regexp_eatSyntaxCharacter(t) ? !0 : t.eat(47) ? (t.lastIntValue = 47, !0) : !1;
|
|
1814
|
+
var e = t.current();
|
|
1815
|
+
return e !== 99 && (!t.switchN || e !== 107) ? (t.lastIntValue = e, t.advance(), !0) : !1;
|
|
1816
|
+
};
|
|
1817
|
+
l.regexp_eatDecimalEscape = function(t) {
|
|
1818
|
+
t.lastIntValue = 0;
|
|
1819
|
+
var e = t.current();
|
|
1820
|
+
if (e >= 49 && e <= 57) {
|
|
1821
|
+
do
|
|
1822
|
+
t.lastIntValue = 10 * t.lastIntValue + (e - 48), t.advance();
|
|
1823
|
+
while ((e = t.current()) >= 48 && e <= 57);
|
|
1824
|
+
return !0;
|
|
1825
|
+
}
|
|
1826
|
+
return !1;
|
|
1827
|
+
};
|
|
1828
|
+
var Oe = 0, X = 1, L = 2;
|
|
1829
|
+
l.regexp_eatCharacterClassEscape = function(t) {
|
|
1830
|
+
var e = t.current();
|
|
1831
|
+
if (Ls(e)) return t.lastIntValue = -1, t.advance(), X;
|
|
1832
|
+
var s = !1;
|
|
1833
|
+
if (t.switchU && this.options.ecmaVersion >= 9 && ((s = e === 80) || e === 112)) {
|
|
1834
|
+
t.lastIntValue = -1, t.advance();
|
|
1835
|
+
var i;
|
|
1836
|
+
if (t.eat(123) && (i = this.regexp_eatUnicodePropertyValueExpression(t)) && t.eat(125)) return s && i === L && t.raise("Invalid property name"), i;
|
|
1837
|
+
t.raise("Invalid property name");
|
|
1838
|
+
}
|
|
1839
|
+
return Oe;
|
|
1840
|
+
};
|
|
1841
|
+
function Ls(t) {
|
|
1842
|
+
return t === 100 || t === 68 || t === 115 || t === 83 || t === 119 || t === 87;
|
|
1843
|
+
}
|
|
1844
|
+
l.regexp_eatUnicodePropertyValueExpression = function(t) {
|
|
1845
|
+
var e = t.pos;
|
|
1846
|
+
if (this.regexp_eatUnicodePropertyName(t) && t.eat(61)) {
|
|
1847
|
+
var s = t.lastStringValue;
|
|
1848
|
+
if (this.regexp_eatUnicodePropertyValue(t)) {
|
|
1849
|
+
var i = t.lastStringValue;
|
|
1850
|
+
return this.regexp_validateUnicodePropertyNameAndValue(t, s, i), X;
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
if (t.pos = e, this.regexp_eatLoneUnicodePropertyNameOrValue(t)) {
|
|
1854
|
+
var r = t.lastStringValue;
|
|
1855
|
+
return this.regexp_validateUnicodePropertyNameOrValue(t, r);
|
|
1856
|
+
}
|
|
1857
|
+
return Oe;
|
|
1858
|
+
};
|
|
1859
|
+
l.regexp_validateUnicodePropertyNameAndValue = function(t, e, s) {
|
|
1860
|
+
pt(t.unicodeProperties.nonBinary, e) || t.raise("Invalid property name"), t.unicodeProperties.nonBinary[e].test(s) || t.raise("Invalid property value");
|
|
1861
|
+
};
|
|
1862
|
+
l.regexp_validateUnicodePropertyNameOrValue = function(t, e) {
|
|
1863
|
+
if (t.unicodeProperties.binary.test(e)) return X;
|
|
1864
|
+
if (t.switchV && t.unicodeProperties.binaryOfStrings.test(e)) return L;
|
|
1865
|
+
t.raise("Invalid property name");
|
|
1866
|
+
};
|
|
1867
|
+
l.regexp_eatUnicodePropertyName = function(t) {
|
|
1868
|
+
var e = 0;
|
|
1869
|
+
for (t.lastStringValue = ""; je(e = t.current()); ) t.lastStringValue += z(e), t.advance();
|
|
1870
|
+
return t.lastStringValue !== "";
|
|
1871
|
+
};
|
|
1872
|
+
function je(t) {
|
|
1873
|
+
return Re(t) || t === 95;
|
|
1874
|
+
}
|
|
1875
|
+
l.regexp_eatUnicodePropertyValue = function(t) {
|
|
1876
|
+
var e = 0;
|
|
1877
|
+
for (t.lastStringValue = ""; Rs(e = t.current()); ) t.lastStringValue += z(e), t.advance();
|
|
1878
|
+
return t.lastStringValue !== "";
|
|
1879
|
+
};
|
|
1880
|
+
function Rs(t) {
|
|
1881
|
+
return je(t) || kt(t);
|
|
1882
|
+
}
|
|
1883
|
+
l.regexp_eatLoneUnicodePropertyNameOrValue = function(t) {
|
|
1884
|
+
return this.regexp_eatUnicodePropertyValue(t);
|
|
1885
|
+
};
|
|
1886
|
+
l.regexp_eatCharacterClass = function(t) {
|
|
1887
|
+
if (t.eat(91)) {
|
|
1888
|
+
var e = t.eat(94), s = this.regexp_classContents(t);
|
|
1889
|
+
return t.eat(93) || t.raise("Unterminated character class"), e && s === L && t.raise("Negated character class may contain strings"), !0;
|
|
1890
|
+
}
|
|
1891
|
+
return !1;
|
|
1892
|
+
};
|
|
1893
|
+
l.regexp_classContents = function(t) {
|
|
1894
|
+
return t.current() === 93 ? X : t.switchV ? this.regexp_classSetExpression(t) : (this.regexp_nonEmptyClassRanges(t), X);
|
|
1895
|
+
};
|
|
1896
|
+
l.regexp_nonEmptyClassRanges = function(t) {
|
|
1897
|
+
for (; this.regexp_eatClassAtom(t); ) {
|
|
1898
|
+
var e = t.lastIntValue;
|
|
1899
|
+
if (t.eat(45) && this.regexp_eatClassAtom(t)) {
|
|
1900
|
+
var s = t.lastIntValue;
|
|
1901
|
+
t.switchU && (e === -1 || s === -1) && t.raise("Invalid character class"), e !== -1 && s !== -1 && e > s && t.raise("Range out of order in character class");
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
l.regexp_eatClassAtom = function(t) {
|
|
1906
|
+
var e = t.pos;
|
|
1907
|
+
if (t.eat(92)) {
|
|
1908
|
+
if (this.regexp_eatClassEscape(t)) return !0;
|
|
1909
|
+
if (t.switchU) {
|
|
1910
|
+
var s = t.current();
|
|
1911
|
+
(s === 99 || qe(s)) && t.raise("Invalid class escape"), t.raise("Invalid escape");
|
|
1912
|
+
}
|
|
1913
|
+
t.pos = e;
|
|
1914
|
+
}
|
|
1915
|
+
var i = t.current();
|
|
1916
|
+
return i !== 93 ? (t.lastIntValue = i, t.advance(), !0) : !1;
|
|
1917
|
+
};
|
|
1918
|
+
l.regexp_eatClassEscape = function(t) {
|
|
1919
|
+
var e = t.pos;
|
|
1920
|
+
if (t.eat(98)) return t.lastIntValue = 8, !0;
|
|
1921
|
+
if (t.switchU && t.eat(45)) return t.lastIntValue = 45, !0;
|
|
1922
|
+
if (!t.switchU && t.eat(99)) {
|
|
1923
|
+
if (this.regexp_eatClassControlLetter(t)) return !0;
|
|
1924
|
+
t.pos = e;
|
|
1925
|
+
}
|
|
1926
|
+
return this.regexp_eatCharacterClassEscape(t) || this.regexp_eatCharacterEscape(t);
|
|
1927
|
+
};
|
|
1928
|
+
l.regexp_classSetExpression = function(t) {
|
|
1929
|
+
var e = X, s;
|
|
1930
|
+
if (!this.regexp_eatClassSetRange(t)) if (s = this.regexp_eatClassSetOperand(t)) {
|
|
1931
|
+
s === L && (e = L);
|
|
1932
|
+
for (var i = t.pos; t.eatChars([38, 38]); ) {
|
|
1933
|
+
if (t.current() !== 38 && (s = this.regexp_eatClassSetOperand(t))) {
|
|
1934
|
+
s !== L && (e = X);
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1937
|
+
t.raise("Invalid character in character class");
|
|
1938
|
+
}
|
|
1939
|
+
if (i !== t.pos) return e;
|
|
1940
|
+
for (; t.eatChars([45, 45]); ) this.regexp_eatClassSetOperand(t) || t.raise("Invalid character in character class");
|
|
1941
|
+
if (i !== t.pos) return e;
|
|
1942
|
+
} else t.raise("Invalid character in character class");
|
|
1943
|
+
for (; ; ) if (!this.regexp_eatClassSetRange(t)) {
|
|
1944
|
+
if (s = this.regexp_eatClassSetOperand(t), !s) return e;
|
|
1945
|
+
s === L && (e = L);
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
l.regexp_eatClassSetRange = function(t) {
|
|
1949
|
+
var e = t.pos;
|
|
1950
|
+
if (this.regexp_eatClassSetCharacter(t)) {
|
|
1951
|
+
var s = t.lastIntValue;
|
|
1952
|
+
if (t.eat(45) && this.regexp_eatClassSetCharacter(t)) {
|
|
1953
|
+
var i = t.lastIntValue;
|
|
1954
|
+
return s !== -1 && i !== -1 && s > i && t.raise("Range out of order in character class"), !0;
|
|
1955
|
+
}
|
|
1956
|
+
t.pos = e;
|
|
1957
|
+
}
|
|
1958
|
+
return !1;
|
|
1959
|
+
};
|
|
1960
|
+
l.regexp_eatClassSetOperand = function(t) {
|
|
1961
|
+
return this.regexp_eatClassSetCharacter(t) ? X : this.regexp_eatClassStringDisjunction(t) || this.regexp_eatNestedClass(t);
|
|
1962
|
+
};
|
|
1963
|
+
l.regexp_eatNestedClass = function(t) {
|
|
1964
|
+
var e = t.pos;
|
|
1965
|
+
if (t.eat(91)) {
|
|
1966
|
+
var s = t.eat(94), i = this.regexp_classContents(t);
|
|
1967
|
+
if (t.eat(93)) return s && i === L && t.raise("Negated character class may contain strings"), i;
|
|
1968
|
+
t.pos = e;
|
|
1969
|
+
}
|
|
1970
|
+
if (t.eat(92)) {
|
|
1971
|
+
var r = this.regexp_eatCharacterClassEscape(t);
|
|
1972
|
+
if (r) return r;
|
|
1973
|
+
t.pos = e;
|
|
1974
|
+
}
|
|
1975
|
+
return null;
|
|
1976
|
+
};
|
|
1977
|
+
l.regexp_eatClassStringDisjunction = function(t) {
|
|
1978
|
+
var e = t.pos;
|
|
1979
|
+
if (t.eatChars([92, 113])) {
|
|
1980
|
+
if (t.eat(123)) {
|
|
1981
|
+
var s = this.regexp_classStringDisjunctionContents(t);
|
|
1982
|
+
if (t.eat(125)) return s;
|
|
1983
|
+
} else t.raise("Invalid escape");
|
|
1984
|
+
t.pos = e;
|
|
1985
|
+
}
|
|
1986
|
+
return null;
|
|
1987
|
+
};
|
|
1988
|
+
l.regexp_classStringDisjunctionContents = function(t) {
|
|
1989
|
+
for (var e = this.regexp_classString(t); t.eat(124); ) this.regexp_classString(t) === L && (e = L);
|
|
1990
|
+
return e;
|
|
1991
|
+
};
|
|
1992
|
+
l.regexp_classString = function(t) {
|
|
1993
|
+
for (var e = 0; this.regexp_eatClassSetCharacter(t); ) e++;
|
|
1994
|
+
return e === 1 ? X : L;
|
|
1995
|
+
};
|
|
1996
|
+
l.regexp_eatClassSetCharacter = function(t) {
|
|
1997
|
+
var e = t.pos;
|
|
1998
|
+
if (t.eat(92)) return this.regexp_eatCharacterEscape(t) || this.regexp_eatClassSetReservedPunctuator(t) ? !0 : t.eat(98) ? (t.lastIntValue = 8, !0) : (t.pos = e, !1);
|
|
1999
|
+
var s = t.current();
|
|
2000
|
+
return s < 0 || s === t.lookahead() && Os(s) || js(s) ? !1 : (t.advance(), t.lastIntValue = s, !0);
|
|
2001
|
+
};
|
|
2002
|
+
function Os(t) {
|
|
2003
|
+
return t === 33 || t >= 35 && t <= 38 || t >= 42 && t <= 44 || t === 46 || t >= 58 && t <= 64 || t === 94 || t === 96 || t === 126;
|
|
2004
|
+
}
|
|
2005
|
+
function js(t) {
|
|
2006
|
+
return t === 40 || t === 41 || t === 45 || t === 47 || t >= 91 && t <= 93 || t >= 123 && t <= 125;
|
|
2007
|
+
}
|
|
2008
|
+
l.regexp_eatClassSetReservedPunctuator = function(t) {
|
|
2009
|
+
var e = t.current();
|
|
2010
|
+
return Ms(e) ? (t.lastIntValue = e, t.advance(), !0) : !1;
|
|
2011
|
+
};
|
|
2012
|
+
function Ms(t) {
|
|
2013
|
+
return t === 33 || t === 35 || t === 37 || t === 38 || t === 44 || t === 45 || t >= 58 && t <= 62 || t === 64 || t === 96 || t === 126;
|
|
2014
|
+
}
|
|
2015
|
+
l.regexp_eatClassControlLetter = function(t) {
|
|
2016
|
+
var e = t.current();
|
|
2017
|
+
return kt(e) || e === 95 ? (t.lastIntValue = e % 32, t.advance(), !0) : !1;
|
|
2018
|
+
};
|
|
2019
|
+
l.regexp_eatHexEscapeSequence = function(t) {
|
|
2020
|
+
var e = t.pos;
|
|
2021
|
+
if (t.eat(120)) {
|
|
2022
|
+
if (this.regexp_eatFixedHexDigits(t, 2)) return !0;
|
|
2023
|
+
t.switchU && t.raise("Invalid escape"), t.pos = e;
|
|
2024
|
+
}
|
|
2025
|
+
return !1;
|
|
2026
|
+
};
|
|
2027
|
+
l.regexp_eatDecimalDigits = function(t) {
|
|
2028
|
+
var e = t.pos, s = 0;
|
|
2029
|
+
for (t.lastIntValue = 0; kt(s = t.current()); ) t.lastIntValue = 10 * t.lastIntValue + (s - 48), t.advance();
|
|
2030
|
+
return t.pos !== e;
|
|
2031
|
+
};
|
|
2032
|
+
function kt(t) {
|
|
2033
|
+
return t >= 48 && t <= 57;
|
|
2034
|
+
}
|
|
2035
|
+
l.regexp_eatHexDigits = function(t) {
|
|
2036
|
+
var e = t.pos, s = 0;
|
|
2037
|
+
for (t.lastIntValue = 0; Me(s = t.current()); ) t.lastIntValue = 16 * t.lastIntValue + Ue(s), t.advance();
|
|
2038
|
+
return t.pos !== e;
|
|
2039
|
+
};
|
|
2040
|
+
function Me(t) {
|
|
2041
|
+
return t >= 48 && t <= 57 || t >= 65 && t <= 70 || t >= 97 && t <= 102;
|
|
2042
|
+
}
|
|
2043
|
+
function Ue(t) {
|
|
2044
|
+
return t >= 65 && t <= 70 ? 10 + (t - 65) : t >= 97 && t <= 102 ? 10 + (t - 97) : t - 48;
|
|
2045
|
+
}
|
|
2046
|
+
l.regexp_eatLegacyOctalEscapeSequence = function(t) {
|
|
2047
|
+
if (this.regexp_eatOctalDigit(t)) {
|
|
2048
|
+
var e = t.lastIntValue;
|
|
2049
|
+
if (this.regexp_eatOctalDigit(t)) {
|
|
2050
|
+
var s = t.lastIntValue;
|
|
2051
|
+
e <= 3 && this.regexp_eatOctalDigit(t) ? t.lastIntValue = e * 64 + s * 8 + t.lastIntValue : t.lastIntValue = e * 8 + s;
|
|
2052
|
+
} else t.lastIntValue = e;
|
|
2053
|
+
return !0;
|
|
2054
|
+
}
|
|
2055
|
+
return !1;
|
|
2056
|
+
};
|
|
2057
|
+
l.regexp_eatOctalDigit = function(t) {
|
|
2058
|
+
var e = t.current();
|
|
2059
|
+
return qe(e) ? (t.lastIntValue = e - 48, t.advance(), !0) : (t.lastIntValue = 0, !1);
|
|
2060
|
+
};
|
|
2061
|
+
function qe(t) {
|
|
2062
|
+
return t >= 48 && t <= 55;
|
|
2063
|
+
}
|
|
2064
|
+
l.regexp_eatFixedHexDigits = function(t, e) {
|
|
2065
|
+
var s = t.pos;
|
|
2066
|
+
t.lastIntValue = 0;
|
|
2067
|
+
for (var i = 0; i < e; ++i) {
|
|
2068
|
+
var r = t.current();
|
|
2069
|
+
if (!Me(r)) return t.pos = s, !1;
|
|
2070
|
+
t.lastIntValue = 16 * t.lastIntValue + Ue(r), t.advance();
|
|
2071
|
+
}
|
|
2072
|
+
return !0;
|
|
2073
|
+
};
|
|
2074
|
+
var zt = function(t) {
|
|
2075
|
+
this.type = t.type, this.value = t.value, this.start = t.start, this.end = t.end, t.options.locations && (this.loc = new Et(t, t.startLoc, t.endLoc)), t.options.ranges && (this.range = [t.start, t.end]);
|
|
2076
|
+
}, g = T.prototype;
|
|
2077
|
+
g.next = function(t) {
|
|
2078
|
+
!t && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new zt(this)), this.lastTokEnd = this.end, this.lastTokStart = this.start, this.lastTokEndLoc = this.endLoc, this.lastTokStartLoc = this.startLoc, this.nextToken();
|
|
2079
|
+
};
|
|
2080
|
+
g.getToken = function() {
|
|
2081
|
+
return this.next(), new zt(this);
|
|
2082
|
+
};
|
|
2083
|
+
typeof Symbol < "u" && (g[Symbol.iterator] = function() {
|
|
2084
|
+
var t = this;
|
|
2085
|
+
return { next: function() {
|
|
2086
|
+
var e = t.getToken();
|
|
2087
|
+
return { done: e.type === a.eof, value: e };
|
|
2088
|
+
} };
|
|
2089
|
+
});
|
|
2090
|
+
g.nextToken = function() {
|
|
2091
|
+
var t = this.curContext();
|
|
2092
|
+
if ((!t || !t.preserveSpace) && this.skipSpace(), this.start = this.pos, this.options.locations && (this.startLoc = this.curPosition()), this.pos >= this.input.length) return this.finishToken(a.eof);
|
|
2093
|
+
if (t.override) return t.override(this);
|
|
2094
|
+
this.readToken(this.fullCharCodeAtPos());
|
|
2095
|
+
};
|
|
2096
|
+
g.readToken = function(t) {
|
|
2097
|
+
return J(t, this.options.ecmaVersion >= 6) || t === 92 ? this.readWord() : this.getTokenFromCode(t);
|
|
2098
|
+
};
|
|
2099
|
+
g.fullCharCodeAtPos = function() {
|
|
2100
|
+
var t = this.input.charCodeAt(this.pos);
|
|
2101
|
+
if (t <= 55295 || t >= 56320) return t;
|
|
2102
|
+
var e = this.input.charCodeAt(this.pos + 1);
|
|
2103
|
+
return e <= 56319 || e >= 57344 ? t : (t << 10) + e - 56613888;
|
|
2104
|
+
};
|
|
2105
|
+
g.skipBlockComment = function() {
|
|
2106
|
+
var t = this.options.onComment && this.curPosition(), e = this.pos, s = this.input.indexOf("*/", this.pos += 2);
|
|
2107
|
+
if (s === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = s + 2, this.options.locations) for (var i = void 0, r = e; (i = ce(this.input, r, this.pos)) > -1; ) ++this.curLine, r = this.lineStart = i;
|
|
2108
|
+
this.options.onComment && this.options.onComment(!0, this.input.slice(e + 2, s), e, this.pos, t, this.curPosition());
|
|
2109
|
+
};
|
|
2110
|
+
g.skipLineComment = function(t) {
|
|
2111
|
+
for (var e = this.pos, s = this.options.onComment && this.curPosition(), i = this.input.charCodeAt(this.pos += t); this.pos < this.input.length && !et(i); ) i = this.input.charCodeAt(++this.pos);
|
|
2112
|
+
this.options.onComment && this.options.onComment(!1, this.input.slice(e + t, this.pos), e, this.pos, s, this.curPosition());
|
|
2113
|
+
};
|
|
2114
|
+
g.skipSpace = function() {
|
|
2115
|
+
t: for (; this.pos < this.input.length; ) {
|
|
2116
|
+
var t = this.input.charCodeAt(this.pos);
|
|
2117
|
+
switch (t) {
|
|
2118
|
+
case 32:
|
|
2119
|
+
case 160:
|
|
2120
|
+
++this.pos;
|
|
2121
|
+
break;
|
|
2122
|
+
case 13:
|
|
2123
|
+
this.input.charCodeAt(this.pos + 1) === 10 && ++this.pos;
|
|
2124
|
+
case 10:
|
|
2125
|
+
case 8232:
|
|
2126
|
+
case 8233:
|
|
2127
|
+
++this.pos, this.options.locations && (++this.curLine, this.lineStart = this.pos);
|
|
2128
|
+
break;
|
|
2129
|
+
case 47:
|
|
2130
|
+
switch (this.input.charCodeAt(this.pos + 1)) {
|
|
2131
|
+
case 42:
|
|
2132
|
+
this.skipBlockComment();
|
|
2133
|
+
break;
|
|
2134
|
+
case 47:
|
|
2135
|
+
this.skipLineComment(2);
|
|
2136
|
+
break;
|
|
2137
|
+
default:
|
|
2138
|
+
break t;
|
|
2139
|
+
}
|
|
2140
|
+
break;
|
|
2141
|
+
default:
|
|
2142
|
+
if (t > 8 && t < 14 || t >= 5760 && le.test(String.fromCharCode(t))) ++this.pos;
|
|
2143
|
+
else break t;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
g.finishToken = function(t, e) {
|
|
2148
|
+
this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition());
|
|
2149
|
+
var s = this.type;
|
|
2150
|
+
this.type = t, this.value = e, this.updateContext(s);
|
|
2151
|
+
};
|
|
2152
|
+
g.readToken_dot = function() {
|
|
2153
|
+
var t = this.input.charCodeAt(this.pos + 1);
|
|
2154
|
+
if (t >= 48 && t <= 57) return this.readNumber(!0);
|
|
2155
|
+
var e = this.input.charCodeAt(this.pos + 2);
|
|
2156
|
+
return this.options.ecmaVersion >= 6 && t === 46 && e === 46 ? (this.pos += 3, this.finishToken(a.ellipsis)) : (++this.pos, this.finishToken(a.dot));
|
|
2157
|
+
};
|
|
2158
|
+
g.readToken_slash = function() {
|
|
2159
|
+
var t = this.input.charCodeAt(this.pos + 1);
|
|
2160
|
+
return this.exprAllowed ? (++this.pos, this.readRegexp()) : t === 61 ? this.finishOp(a.assign, 2) : this.finishOp(a.slash, 1);
|
|
2161
|
+
};
|
|
2162
|
+
g.readToken_mult_modulo_exp = function(t) {
|
|
2163
|
+
var e = this.input.charCodeAt(this.pos + 1), s = 1, i = t === 42 ? a.star : a.modulo;
|
|
2164
|
+
return this.options.ecmaVersion >= 7 && t === 42 && e === 42 && (++s, i = a.starstar, e = this.input.charCodeAt(this.pos + 2)), e === 61 ? this.finishOp(a.assign, s + 1) : this.finishOp(i, s);
|
|
2165
|
+
};
|
|
2166
|
+
g.readToken_pipe_amp = function(t) {
|
|
2167
|
+
var e = this.input.charCodeAt(this.pos + 1);
|
|
2168
|
+
if (e === t) {
|
|
2169
|
+
if (this.options.ecmaVersion >= 12) {
|
|
2170
|
+
var s = this.input.charCodeAt(this.pos + 2);
|
|
2171
|
+
if (s === 61) return this.finishOp(a.assign, 3);
|
|
2172
|
+
}
|
|
2173
|
+
return this.finishOp(t === 124 ? a.logicalOR : a.logicalAND, 2);
|
|
2174
|
+
}
|
|
2175
|
+
return e === 61 ? this.finishOp(a.assign, 2) : this.finishOp(t === 124 ? a.bitwiseOR : a.bitwiseAND, 1);
|
|
2176
|
+
};
|
|
2177
|
+
g.readToken_caret = function() {
|
|
2178
|
+
var t = this.input.charCodeAt(this.pos + 1);
|
|
2179
|
+
return t === 61 ? this.finishOp(a.assign, 2) : this.finishOp(a.bitwiseXOR, 1);
|
|
2180
|
+
};
|
|
2181
|
+
g.readToken_plus_min = function(t) {
|
|
2182
|
+
var e = this.input.charCodeAt(this.pos + 1);
|
|
2183
|
+
return e === t ? e === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || R.test(this.input.slice(this.lastTokEnd, this.pos))) ? (this.skipLineComment(3), this.skipSpace(), this.nextToken()) : this.finishOp(a.incDec, 2) : e === 61 ? this.finishOp(a.assign, 2) : this.finishOp(a.plusMin, 1);
|
|
2184
|
+
};
|
|
2185
|
+
g.readToken_lt_gt = function(t) {
|
|
2186
|
+
var e = this.input.charCodeAt(this.pos + 1), s = 1;
|
|
2187
|
+
return e === t ? (s = t === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2, this.input.charCodeAt(this.pos + s) === 61 ? this.finishOp(a.assign, s + 1) : this.finishOp(a.bitShift, s)) : e === 33 && t === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45 ? (this.skipLineComment(4), this.skipSpace(), this.nextToken()) : (e === 61 && (s = 2), this.finishOp(a.relational, s));
|
|
2188
|
+
};
|
|
2189
|
+
g.readToken_eq_excl = function(t) {
|
|
2190
|
+
var e = this.input.charCodeAt(this.pos + 1);
|
|
2191
|
+
return e === 61 ? this.finishOp(a.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) : t === 61 && e === 62 && this.options.ecmaVersion >= 6 ? (this.pos += 2, this.finishToken(a.arrow)) : this.finishOp(t === 61 ? a.eq : a.prefix, 1);
|
|
2192
|
+
};
|
|
2193
|
+
g.readToken_question = function() {
|
|
2194
|
+
var t = this.options.ecmaVersion;
|
|
2195
|
+
if (t >= 11) {
|
|
2196
|
+
var e = this.input.charCodeAt(this.pos + 1);
|
|
2197
|
+
if (e === 46) {
|
|
2198
|
+
var s = this.input.charCodeAt(this.pos + 2);
|
|
2199
|
+
if (s < 48 || s > 57) return this.finishOp(a.questionDot, 2);
|
|
2200
|
+
}
|
|
2201
|
+
if (e === 63) {
|
|
2202
|
+
if (t >= 12) {
|
|
2203
|
+
var i = this.input.charCodeAt(this.pos + 2);
|
|
2204
|
+
if (i === 61) return this.finishOp(a.assign, 3);
|
|
2205
|
+
}
|
|
2206
|
+
return this.finishOp(a.coalesce, 2);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
return this.finishOp(a.question, 1);
|
|
2210
|
+
};
|
|
2211
|
+
g.readToken_numberSign = function() {
|
|
2212
|
+
var t = this.options.ecmaVersion, e = 35;
|
|
2213
|
+
if (t >= 13 && (++this.pos, e = this.fullCharCodeAtPos(), J(e, !0) || e === 92)) return this.finishToken(a.privateId, this.readWord1());
|
|
2214
|
+
this.raise(this.pos, "Unexpected character '" + z(e) + "'");
|
|
2215
|
+
};
|
|
2216
|
+
g.getTokenFromCode = function(t) {
|
|
2217
|
+
switch (t) {
|
|
2218
|
+
case 46:
|
|
2219
|
+
return this.readToken_dot();
|
|
2220
|
+
case 40:
|
|
2221
|
+
return ++this.pos, this.finishToken(a.parenL);
|
|
2222
|
+
case 41:
|
|
2223
|
+
return ++this.pos, this.finishToken(a.parenR);
|
|
2224
|
+
case 59:
|
|
2225
|
+
return ++this.pos, this.finishToken(a.semi);
|
|
2226
|
+
case 44:
|
|
2227
|
+
return ++this.pos, this.finishToken(a.comma);
|
|
2228
|
+
case 91:
|
|
2229
|
+
return ++this.pos, this.finishToken(a.bracketL);
|
|
2230
|
+
case 93:
|
|
2231
|
+
return ++this.pos, this.finishToken(a.bracketR);
|
|
2232
|
+
case 123:
|
|
2233
|
+
return ++this.pos, this.finishToken(a.braceL);
|
|
2234
|
+
case 125:
|
|
2235
|
+
return ++this.pos, this.finishToken(a.braceR);
|
|
2236
|
+
case 58:
|
|
2237
|
+
return ++this.pos, this.finishToken(a.colon);
|
|
2238
|
+
case 96:
|
|
2239
|
+
if (this.options.ecmaVersion < 6) break;
|
|
2240
|
+
return ++this.pos, this.finishToken(a.backQuote);
|
|
2241
|
+
case 48:
|
|
2242
|
+
var e = this.input.charCodeAt(this.pos + 1);
|
|
2243
|
+
if (e === 120 || e === 88) return this.readRadixNumber(16);
|
|
2244
|
+
if (this.options.ecmaVersion >= 6) {
|
|
2245
|
+
if (e === 111 || e === 79) return this.readRadixNumber(8);
|
|
2246
|
+
if (e === 98 || e === 66) return this.readRadixNumber(2);
|
|
2247
|
+
}
|
|
2248
|
+
case 49:
|
|
2249
|
+
case 50:
|
|
2250
|
+
case 51:
|
|
2251
|
+
case 52:
|
|
2252
|
+
case 53:
|
|
2253
|
+
case 54:
|
|
2254
|
+
case 55:
|
|
2255
|
+
case 56:
|
|
2256
|
+
case 57:
|
|
2257
|
+
return this.readNumber(!1);
|
|
2258
|
+
case 34:
|
|
2259
|
+
case 39:
|
|
2260
|
+
return this.readString(t);
|
|
2261
|
+
case 47:
|
|
2262
|
+
return this.readToken_slash();
|
|
2263
|
+
case 37:
|
|
2264
|
+
case 42:
|
|
2265
|
+
return this.readToken_mult_modulo_exp(t);
|
|
2266
|
+
case 124:
|
|
2267
|
+
case 38:
|
|
2268
|
+
return this.readToken_pipe_amp(t);
|
|
2269
|
+
case 94:
|
|
2270
|
+
return this.readToken_caret();
|
|
2271
|
+
case 43:
|
|
2272
|
+
case 45:
|
|
2273
|
+
return this.readToken_plus_min(t);
|
|
2274
|
+
case 60:
|
|
2275
|
+
case 62:
|
|
2276
|
+
return this.readToken_lt_gt(t);
|
|
2277
|
+
case 61:
|
|
2278
|
+
case 33:
|
|
2279
|
+
return this.readToken_eq_excl(t);
|
|
2280
|
+
case 63:
|
|
2281
|
+
return this.readToken_question();
|
|
2282
|
+
case 126:
|
|
2283
|
+
return this.finishOp(a.prefix, 1);
|
|
2284
|
+
case 35:
|
|
2285
|
+
return this.readToken_numberSign();
|
|
2286
|
+
}
|
|
2287
|
+
this.raise(this.pos, "Unexpected character '" + z(t) + "'");
|
|
2288
|
+
};
|
|
2289
|
+
g.finishOp = function(t, e) {
|
|
2290
|
+
var s = this.input.slice(this.pos, this.pos + e);
|
|
2291
|
+
return this.pos += e, this.finishToken(t, s);
|
|
2292
|
+
};
|
|
2293
|
+
g.readRegexp = function() {
|
|
2294
|
+
for (var t, e, s = this.pos; ; ) {
|
|
2295
|
+
this.pos >= this.input.length && this.raise(s, "Unterminated regular expression");
|
|
2296
|
+
var i = this.input.charAt(this.pos);
|
|
2297
|
+
if (R.test(i) && this.raise(s, "Unterminated regular expression"), t) t = !1;
|
|
2298
|
+
else {
|
|
2299
|
+
if (i === "[") e = !0;
|
|
2300
|
+
else if (i === "]" && e) e = !1;
|
|
2301
|
+
else if (i === "/" && !e) break;
|
|
2302
|
+
t = i === "\\";
|
|
2303
|
+
}
|
|
2304
|
+
++this.pos;
|
|
2305
|
+
}
|
|
2306
|
+
var r = this.input.slice(s, this.pos);
|
|
2307
|
+
++this.pos;
|
|
2308
|
+
var n = this.pos, o = this.readWord1();
|
|
2309
|
+
this.containsEsc && this.unexpected(n);
|
|
2310
|
+
var u = this.regexpState || (this.regexpState = new G(this));
|
|
2311
|
+
u.reset(s, r, o), this.validateRegExpFlags(u), this.validateRegExpPattern(u);
|
|
2312
|
+
var p = null;
|
|
2313
|
+
try {
|
|
2314
|
+
p = new RegExp(r, o);
|
|
2315
|
+
} catch {
|
|
2316
|
+
}
|
|
2317
|
+
return this.finishToken(a.regexp, { pattern: r, flags: o, value: p });
|
|
2318
|
+
};
|
|
2319
|
+
g.readInt = function(t, e, s) {
|
|
2320
|
+
for (var i = this.options.ecmaVersion >= 12 && e === void 0, r = s && this.input.charCodeAt(this.pos) === 48, n = this.pos, o = 0, u = 0, p = 0, c = e ?? 1 / 0; p < c; ++p, ++this.pos) {
|
|
2321
|
+
var d = this.input.charCodeAt(this.pos), E = void 0;
|
|
2322
|
+
if (i && d === 95) {
|
|
2323
|
+
r && this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"), u === 95 && this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"), p === 0 && this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"), u = d;
|
|
2324
|
+
continue;
|
|
2325
|
+
}
|
|
2326
|
+
if (d >= 97 ? E = d - 97 + 10 : d >= 65 ? E = d - 65 + 10 : d >= 48 && d <= 57 ? E = d - 48 : E = 1 / 0, E >= t) break;
|
|
2327
|
+
u = d, o = o * t + E;
|
|
2328
|
+
}
|
|
2329
|
+
return i && u === 95 && this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"), this.pos === n || e != null && this.pos - n !== e ? null : o;
|
|
2330
|
+
};
|
|
2331
|
+
function Us(t, e) {
|
|
2332
|
+
return e ? parseInt(t, 8) : parseFloat(t.replace(/_/g, ""));
|
|
2333
|
+
}
|
|
2334
|
+
function Ge(t) {
|
|
2335
|
+
return typeof BigInt != "function" ? null : BigInt(t.replace(/_/g, ""));
|
|
2336
|
+
}
|
|
2337
|
+
g.readRadixNumber = function(t) {
|
|
2338
|
+
var e = this.pos;
|
|
2339
|
+
this.pos += 2;
|
|
2340
|
+
var s = this.readInt(t);
|
|
2341
|
+
return s == null && this.raise(this.start + 2, "Expected number in radix " + t), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (s = Ge(this.input.slice(e, this.pos)), ++this.pos) : J(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(a.num, s);
|
|
2342
|
+
};
|
|
2343
|
+
g.readNumber = function(t) {
|
|
2344
|
+
var e = this.pos;
|
|
2345
|
+
!t && this.readInt(10, void 0, !0) === null && this.raise(e, "Invalid number");
|
|
2346
|
+
var s = this.pos - e >= 2 && this.input.charCodeAt(e) === 48;
|
|
2347
|
+
s && this.strict && this.raise(e, "Invalid number");
|
|
2348
|
+
var i = this.input.charCodeAt(this.pos);
|
|
2349
|
+
if (!s && !t && this.options.ecmaVersion >= 11 && i === 110) {
|
|
2350
|
+
var r = Ge(this.input.slice(e, this.pos));
|
|
2351
|
+
return ++this.pos, J(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(a.num, r);
|
|
2352
|
+
}
|
|
2353
|
+
s && /[89]/.test(this.input.slice(e, this.pos)) && (s = !1), i === 46 && !s && (++this.pos, this.readInt(10), i = this.input.charCodeAt(this.pos)), (i === 69 || i === 101) && !s && (i = this.input.charCodeAt(++this.pos), (i === 43 || i === 45) && ++this.pos, this.readInt(10) === null && this.raise(e, "Invalid number")), J(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number");
|
|
2354
|
+
var n = Us(this.input.slice(e, this.pos), s);
|
|
2355
|
+
return this.finishToken(a.num, n);
|
|
2356
|
+
};
|
|
2357
|
+
g.readCodePoint = function() {
|
|
2358
|
+
var t = this.input.charCodeAt(this.pos), e;
|
|
2359
|
+
if (t === 123) {
|
|
2360
|
+
this.options.ecmaVersion < 6 && this.unexpected();
|
|
2361
|
+
var s = ++this.pos;
|
|
2362
|
+
e = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos), ++this.pos, e > 1114111 && this.invalidStringToken(s, "Code point out of bounds");
|
|
2363
|
+
} else e = this.readHexChar(4);
|
|
2364
|
+
return e;
|
|
2365
|
+
};
|
|
2366
|
+
g.readString = function(t) {
|
|
2367
|
+
for (var e = "", s = ++this.pos; ; ) {
|
|
2368
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
2369
|
+
var i = this.input.charCodeAt(this.pos);
|
|
2370
|
+
if (i === t) break;
|
|
2371
|
+
i === 92 ? (e += this.input.slice(s, this.pos), e += this.readEscapedChar(!1), s = this.pos) : i === 8232 || i === 8233 ? (this.options.ecmaVersion < 10 && this.raise(this.start, "Unterminated string constant"), ++this.pos, this.options.locations && (this.curLine++, this.lineStart = this.pos)) : (et(i) && this.raise(this.start, "Unterminated string constant"), ++this.pos);
|
|
2372
|
+
}
|
|
2373
|
+
return e += this.input.slice(s, this.pos++), this.finishToken(a.string, e);
|
|
2374
|
+
};
|
|
2375
|
+
var Je = {};
|
|
2376
|
+
g.tryReadTemplateToken = function() {
|
|
2377
|
+
this.inTemplateElement = !0;
|
|
2378
|
+
try {
|
|
2379
|
+
this.readTmplToken();
|
|
2380
|
+
} catch (t) {
|
|
2381
|
+
if (t === Je) this.readInvalidTemplateToken();
|
|
2382
|
+
else throw t;
|
|
2383
|
+
}
|
|
2384
|
+
this.inTemplateElement = !1;
|
|
2385
|
+
};
|
|
2386
|
+
g.invalidStringToken = function(t, e) {
|
|
2387
|
+
if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw Je;
|
|
2388
|
+
this.raise(t, e);
|
|
2389
|
+
};
|
|
2390
|
+
g.readTmplToken = function() {
|
|
2391
|
+
for (var t = "", e = this.pos; ; ) {
|
|
2392
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated template");
|
|
2393
|
+
var s = this.input.charCodeAt(this.pos);
|
|
2394
|
+
if (s === 96 || s === 36 && this.input.charCodeAt(this.pos + 1) === 123) return this.pos === this.start && (this.type === a.template || this.type === a.invalidTemplate) ? s === 36 ? (this.pos += 2, this.finishToken(a.dollarBraceL)) : (++this.pos, this.finishToken(a.backQuote)) : (t += this.input.slice(e, this.pos), this.finishToken(a.template, t));
|
|
2395
|
+
if (s === 92) t += this.input.slice(e, this.pos), t += this.readEscapedChar(!0), e = this.pos;
|
|
2396
|
+
else if (et(s)) {
|
|
2397
|
+
switch (t += this.input.slice(e, this.pos), ++this.pos, s) {
|
|
2398
|
+
case 13:
|
|
2399
|
+
this.input.charCodeAt(this.pos) === 10 && ++this.pos;
|
|
2400
|
+
case 10:
|
|
2401
|
+
t += `
|
|
2402
|
+
`;
|
|
2403
|
+
break;
|
|
2404
|
+
default:
|
|
2405
|
+
t += String.fromCharCode(s);
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2408
|
+
this.options.locations && (++this.curLine, this.lineStart = this.pos), e = this.pos;
|
|
2409
|
+
} else ++this.pos;
|
|
2410
|
+
}
|
|
2411
|
+
};
|
|
2412
|
+
g.readInvalidTemplateToken = function() {
|
|
2413
|
+
for (; this.pos < this.input.length; this.pos++) switch (this.input[this.pos]) {
|
|
2414
|
+
case "\\":
|
|
2415
|
+
++this.pos;
|
|
2416
|
+
break;
|
|
2417
|
+
case "$":
|
|
2418
|
+
if (this.input[this.pos + 1] !== "{") break;
|
|
2419
|
+
case "`":
|
|
2420
|
+
return this.finishToken(a.invalidTemplate, this.input.slice(this.start, this.pos));
|
|
2421
|
+
case "\r":
|
|
2422
|
+
this.input[this.pos + 1] === `
|
|
2423
|
+
` && ++this.pos;
|
|
2424
|
+
case `
|
|
2425
|
+
`:
|
|
2426
|
+
case "\u2028":
|
|
2427
|
+
case "\u2029":
|
|
2428
|
+
++this.curLine, this.lineStart = this.pos + 1;
|
|
2429
|
+
break;
|
|
2430
|
+
}
|
|
2431
|
+
this.raise(this.start, "Unterminated template");
|
|
2432
|
+
};
|
|
2433
|
+
g.readEscapedChar = function(t) {
|
|
2434
|
+
var e = this.input.charCodeAt(++this.pos);
|
|
2435
|
+
switch (++this.pos, e) {
|
|
2436
|
+
case 110:
|
|
2437
|
+
return `
|
|
2438
|
+
`;
|
|
2439
|
+
case 114:
|
|
2440
|
+
return "\r";
|
|
2441
|
+
case 120:
|
|
2442
|
+
return String.fromCharCode(this.readHexChar(2));
|
|
2443
|
+
case 117:
|
|
2444
|
+
return z(this.readCodePoint());
|
|
2445
|
+
case 116:
|
|
2446
|
+
return " ";
|
|
2447
|
+
case 98:
|
|
2448
|
+
return "\b";
|
|
2449
|
+
case 118:
|
|
2450
|
+
return "\v";
|
|
2451
|
+
case 102:
|
|
2452
|
+
return "\f";
|
|
2453
|
+
case 13:
|
|
2454
|
+
this.input.charCodeAt(this.pos) === 10 && ++this.pos;
|
|
2455
|
+
case 10:
|
|
2456
|
+
return this.options.locations && (this.lineStart = this.pos, ++this.curLine), "";
|
|
2457
|
+
case 56:
|
|
2458
|
+
case 57:
|
|
2459
|
+
if (this.strict && this.invalidStringToken(this.pos - 1, "Invalid escape sequence"), t) {
|
|
2460
|
+
var s = this.pos - 1;
|
|
2461
|
+
this.invalidStringToken(s, "Invalid escape sequence in template string");
|
|
2462
|
+
}
|
|
2463
|
+
default:
|
|
2464
|
+
if (e >= 48 && e <= 55) {
|
|
2465
|
+
var i = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0], r = parseInt(i, 8);
|
|
2466
|
+
return r > 255 && (i = i.slice(0, -1), r = parseInt(i, 8)), this.pos += i.length - 1, e = this.input.charCodeAt(this.pos), (i !== "0" || e === 56 || e === 57) && (this.strict || t) && this.invalidStringToken(this.pos - 1 - i.length, t ? "Octal literal in template string" : "Octal literal in strict mode"), String.fromCharCode(r);
|
|
2467
|
+
}
|
|
2468
|
+
return et(e) ? (this.options.locations && (this.lineStart = this.pos, ++this.curLine), "") : String.fromCharCode(e);
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
g.readHexChar = function(t) {
|
|
2472
|
+
var e = this.pos, s = this.readInt(16, t);
|
|
2473
|
+
return s === null && this.invalidStringToken(e, "Bad character escape sequence"), s;
|
|
2474
|
+
};
|
|
2475
|
+
g.readWord1 = function() {
|
|
2476
|
+
this.containsEsc = !1;
|
|
2477
|
+
for (var t = "", e = !0, s = this.pos, i = this.options.ecmaVersion >= 6; this.pos < this.input.length; ) {
|
|
2478
|
+
var r = this.fullCharCodeAtPos();
|
|
2479
|
+
if (tt(r, i)) this.pos += r <= 65535 ? 1 : 2;
|
|
2480
|
+
else if (r === 92) {
|
|
2481
|
+
this.containsEsc = !0, t += this.input.slice(s, this.pos);
|
|
2482
|
+
var n = this.pos;
|
|
2483
|
+
this.input.charCodeAt(++this.pos) !== 117 && this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"), ++this.pos;
|
|
2484
|
+
var o = this.readCodePoint();
|
|
2485
|
+
(e ? J : tt)(o, i) || this.invalidStringToken(n, "Invalid Unicode escape"), t += z(o), s = this.pos;
|
|
2486
|
+
} else break;
|
|
2487
|
+
e = !1;
|
|
2488
|
+
}
|
|
2489
|
+
return t + this.input.slice(s, this.pos);
|
|
2490
|
+
};
|
|
2491
|
+
g.readWord = function() {
|
|
2492
|
+
var t = this.readWord1(), e = a.name;
|
|
2493
|
+
return this.keywords.test(t) && (e = qt[t]), this.finishToken(e, t);
|
|
2494
|
+
};
|
|
2495
|
+
var qs = "8.12.1";
|
|
2496
|
+
T.acorn = { Parser: T, version: qs, defaultOptions: Nt, Position: ot, SourceLocation: Et, getLineInfo: me, Node: St, TokenType: v, tokTypes: a, keywordTypes: qt, TokContext: M, tokContexts: k, isIdentifierChar: tt, isIdentifierStart: J, Token: zt, isNewLine: et, lineBreak: R, lineBreakG: ds, nonASCIIwhitespace: le };
|
|
2497
|
+
var Gs = ne(oe());
|
|
2498
|
+
function Js(t, e) {
|
|
2499
|
+
let s = new SyntaxError(t + " (" + e.loc.start.line + ":" + e.loc.start.column + ")");
|
|
2500
|
+
return Object.assign(s, e);
|
|
2501
|
+
}
|
|
2502
|
+
var Xe = Js;
|
|
2503
|
+
function Xs(t) {
|
|
2504
|
+
let e = [];
|
|
2505
|
+
for (let s of t) try {
|
|
2506
|
+
return s();
|
|
2507
|
+
} catch (i) {
|
|
2508
|
+
e.push(i);
|
|
2509
|
+
}
|
|
2510
|
+
throw Object.assign(new Error("All combinations failed"), { errors: e });
|
|
2511
|
+
}
|
|
2512
|
+
var Ke = Xs, Ks = (t, e, s) => {
|
|
2513
|
+
if (!(t && e == null)) return Array.isArray(e) || typeof e == "string" ? e[s < 0 ? e.length + s : s] : e.at(s);
|
|
2514
|
+
}, Ct = Ks;
|
|
2515
|
+
function Hs(t) {
|
|
2516
|
+
return Array.isArray(t) && t.length > 0;
|
|
2517
|
+
}
|
|
2518
|
+
var Ws = Hs;
|
|
2519
|
+
function U(t) {
|
|
2520
|
+
var e, s, i;
|
|
2521
|
+
let r = ((e = t.range) == null ? void 0 : e[0]) ?? t.start, n = (i = ((s = t.declaration) == null ? void 0 : s.decorators) ?? t.decorators) == null ? void 0 : i[0];
|
|
2522
|
+
return n ? Math.min(U(n), r) : r;
|
|
2523
|
+
}
|
|
2524
|
+
function H(t) {
|
|
2525
|
+
var e;
|
|
2526
|
+
return ((e = t.range) == null ? void 0 : e[1]) ?? t.end;
|
|
2527
|
+
}
|
|
2528
|
+
function zs(t) {
|
|
2529
|
+
let e = new Set(t);
|
|
2530
|
+
return (s) => e.has(s == null ? void 0 : s.type);
|
|
2531
|
+
}
|
|
2532
|
+
var Qs = zs, $s = Qs(["Block", "CommentBlock", "MultiLine"]), Rt = $s;
|
|
2533
|
+
function Ys(t) {
|
|
2534
|
+
let e = `*${t.value}*`.split(`
|
|
2535
|
+
`);
|
|
2536
|
+
return e.length > 1 && e.every((s) => s.trimStart()[0] === "*");
|
|
2537
|
+
}
|
|
2538
|
+
var ee = Ys;
|
|
2539
|
+
function Zs(t) {
|
|
2540
|
+
return Rt(t) && t.value[0] === "*" && /@(?:type|satisfies)\b/u.test(t.value);
|
|
2541
|
+
}
|
|
2542
|
+
var ti = Zs, rt = null;
|
|
2543
|
+
function nt(t) {
|
|
2544
|
+
if (rt !== null && typeof rt.property) {
|
|
2545
|
+
let e = rt;
|
|
2546
|
+
return rt = nt.prototype = null, e;
|
|
2547
|
+
}
|
|
2548
|
+
return rt = nt.prototype = t ?? /* @__PURE__ */ Object.create(null), new nt();
|
|
2549
|
+
}
|
|
2550
|
+
var ei = 10;
|
|
2551
|
+
for (let t = 0; t <= ei; t++) nt();
|
|
2552
|
+
function si(t) {
|
|
2553
|
+
return nt(t);
|
|
2554
|
+
}
|
|
2555
|
+
function ii(t, e = "type") {
|
|
2556
|
+
si(t);
|
|
2557
|
+
function s(i) {
|
|
2558
|
+
let r = i[e], n = t[r];
|
|
2559
|
+
if (!Array.isArray(n)) throw Object.assign(new Error(`Missing visitor keys for '${r}'.`), { node: i });
|
|
2560
|
+
return n;
|
|
2561
|
+
}
|
|
2562
|
+
return s;
|
|
2563
|
+
}
|
|
2564
|
+
var ri = ii, ai = { ArrayExpression: ["elements"], AssignmentExpression: ["left", "right"], BinaryExpression: ["left", "right"], InterpreterDirective: [], Directive: ["value"], DirectiveLiteral: [], BlockStatement: ["directives", "body"], BreakStatement: ["label"], CallExpression: ["callee", "arguments", "typeParameters", "typeArguments"], CatchClause: ["param", "body"], ConditionalExpression: ["test", "consequent", "alternate"], ContinueStatement: ["label"], DebuggerStatement: [], DoWhileStatement: ["test", "body"], EmptyStatement: [], ExpressionStatement: ["expression"], File: ["program"], ForInStatement: ["left", "right", "body"], ForStatement: ["init", "test", "update", "body"], FunctionDeclaration: ["id", "params", "body", "returnType", "typeParameters", "predicate"], FunctionExpression: ["id", "params", "body", "returnType", "typeParameters"], Identifier: ["typeAnnotation", "decorators"], IfStatement: ["test", "consequent", "alternate"], LabeledStatement: ["label", "body"], StringLiteral: [], NumericLiteral: [], NullLiteral: [], BooleanLiteral: [], RegExpLiteral: [], LogicalExpression: ["left", "right"], MemberExpression: ["object", "property"], NewExpression: ["callee", "arguments", "typeParameters", "typeArguments"], Program: ["directives", "body"], ObjectExpression: ["properties"], ObjectMethod: ["key", "params", "body", "decorators", "returnType", "typeParameters"], ObjectProperty: ["key", "value", "decorators"], RestElement: ["argument", "typeAnnotation", "decorators"], ReturnStatement: ["argument"], SequenceExpression: ["expressions"], ParenthesizedExpression: ["expression"], SwitchCase: ["test", "consequent"], SwitchStatement: ["discriminant", "cases"], ThisExpression: [], ThrowStatement: ["argument"], TryStatement: ["block", "handler", "finalizer"], UnaryExpression: ["argument"], UpdateExpression: ["argument"], VariableDeclaration: ["declarations"], VariableDeclarator: ["id", "init"], WhileStatement: ["test", "body"], WithStatement: ["object", "body"], AssignmentPattern: ["left", "right", "decorators", "typeAnnotation"], ArrayPattern: ["elements", "typeAnnotation", "decorators"], ArrowFunctionExpression: ["params", "body", "returnType", "typeParameters", "predicate"], ClassBody: ["body"], ClassExpression: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators", "superTypeArguments"], ClassDeclaration: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators", "superTypeArguments"], ExportAllDeclaration: ["source", "attributes", "exported"], ExportDefaultDeclaration: ["declaration"], ExportNamedDeclaration: ["declaration", "specifiers", "source", "attributes"], ExportSpecifier: ["local", "exported"], ForOfStatement: ["left", "right", "body"], ImportDeclaration: ["specifiers", "source", "attributes"], ImportDefaultSpecifier: ["local"], ImportNamespaceSpecifier: ["local"], ImportSpecifier: ["local", "imported"], ImportExpression: ["source", "options", "attributes"], MetaProperty: ["meta", "property"], ClassMethod: ["key", "params", "body", "decorators", "returnType", "typeParameters"], ObjectPattern: ["properties", "typeAnnotation", "decorators"], SpreadElement: ["argument"], Super: [], TaggedTemplateExpression: ["tag", "quasi", "typeParameters", "typeArguments"], TemplateElement: [], TemplateLiteral: ["quasis", "expressions"], YieldExpression: ["argument"], AwaitExpression: ["argument"], Import: [], BigIntLiteral: [], ExportNamespaceSpecifier: ["exported"], OptionalMemberExpression: ["object", "property"], OptionalCallExpression: ["callee", "arguments", "typeParameters", "typeArguments"], ClassProperty: ["key", "value", "typeAnnotation", "decorators", "variance"], ClassAccessorProperty: ["key", "value", "typeAnnotation", "decorators"], ClassPrivateProperty: ["key", "value", "decorators", "typeAnnotation", "variance"], ClassPrivateMethod: ["key", "params", "body", "decorators", "returnType", "typeParameters"], PrivateName: ["id"], StaticBlock: ["body"], AnyTypeAnnotation: [], ArrayTypeAnnotation: ["elementType"], BooleanTypeAnnotation: [], BooleanLiteralTypeAnnotation: [], NullLiteralTypeAnnotation: [], ClassImplements: ["id", "typeParameters"], DeclareClass: ["id", "typeParameters", "extends", "mixins", "implements", "body"], DeclareFunction: ["id", "predicate"], DeclareInterface: ["id", "typeParameters", "extends", "body"], DeclareModule: ["id", "body"], DeclareModuleExports: ["typeAnnotation"], DeclareTypeAlias: ["id", "typeParameters", "right"], DeclareOpaqueType: ["id", "typeParameters", "supertype"], DeclareVariable: ["id"], DeclareExportDeclaration: ["declaration", "specifiers", "source"], DeclareExportAllDeclaration: ["source"], DeclaredPredicate: ["value"], ExistsTypeAnnotation: [], FunctionTypeAnnotation: ["typeParameters", "params", "rest", "returnType", "this"], FunctionTypeParam: ["name", "typeAnnotation"], GenericTypeAnnotation: ["id", "typeParameters"], InferredPredicate: [], InterfaceExtends: ["id", "typeParameters"], InterfaceDeclaration: ["id", "typeParameters", "extends", "body"], InterfaceTypeAnnotation: ["extends", "body"], IntersectionTypeAnnotation: ["types"], MixedTypeAnnotation: [], EmptyTypeAnnotation: [], NullableTypeAnnotation: ["typeAnnotation"], NumberLiteralTypeAnnotation: [], NumberTypeAnnotation: [], ObjectTypeAnnotation: ["properties", "indexers", "callProperties", "internalSlots"], ObjectTypeInternalSlot: ["id", "value"], ObjectTypeCallProperty: ["value"], ObjectTypeIndexer: ["id", "key", "value", "variance"], ObjectTypeProperty: ["key", "value", "variance"], ObjectTypeSpreadProperty: ["argument"], OpaqueType: ["id", "typeParameters", "supertype", "impltype"], QualifiedTypeIdentifier: ["id", "qualification"], StringLiteralTypeAnnotation: [], StringTypeAnnotation: [], SymbolTypeAnnotation: [], ThisTypeAnnotation: [], TupleTypeAnnotation: ["types", "elementTypes"], TypeofTypeAnnotation: ["argument", "typeArguments"], TypeAlias: ["id", "typeParameters", "right"], TypeAnnotation: ["typeAnnotation"], TypeCastExpression: ["expression", "typeAnnotation"], TypeParameter: ["bound", "default", "variance"], TypeParameterDeclaration: ["params"], TypeParameterInstantiation: ["params"], UnionTypeAnnotation: ["types"], Variance: [], VoidTypeAnnotation: [], EnumDeclaration: ["id", "body"], EnumBooleanBody: ["members"], EnumNumberBody: ["members"], EnumStringBody: ["members"], EnumSymbolBody: ["members"], EnumBooleanMember: ["id", "init"], EnumNumberMember: ["id", "init"], EnumStringMember: ["id", "init"], EnumDefaultedMember: ["id"], IndexedAccessType: ["objectType", "indexType"], OptionalIndexedAccessType: ["objectType", "indexType"], JSXAttribute: ["name", "value"], JSXClosingElement: ["name"], JSXElement: ["openingElement", "children", "closingElement"], JSXEmptyExpression: [], JSXExpressionContainer: ["expression"], JSXSpreadChild: ["expression"], JSXIdentifier: [], JSXMemberExpression: ["object", "property"], JSXNamespacedName: ["namespace", "name"], JSXOpeningElement: ["name", "attributes", "typeArguments", "typeParameters"], JSXSpreadAttribute: ["argument"], JSXText: [], JSXFragment: ["openingFragment", "children", "closingFragment"], JSXOpeningFragment: [], JSXClosingFragment: [], Noop: [], Placeholder: [], V8IntrinsicIdentifier: [], ArgumentPlaceholder: [], BindExpression: ["object", "callee"], ImportAttribute: ["key", "value"], Decorator: ["expression"], DoExpression: ["body"], ExportDefaultSpecifier: ["exported"], RecordExpression: ["properties"], TupleExpression: ["elements"], DecimalLiteral: [], ModuleExpression: ["body"], TopicReference: [], PipelineTopicExpression: ["expression"], PipelineBareFunction: ["callee"], PipelinePrimaryTopicReference: [], TSParameterProperty: ["parameter", "decorators"], TSDeclareFunction: ["id", "typeParameters", "params", "returnType", "body"], TSDeclareMethod: ["decorators", "key", "typeParameters", "params", "returnType"], TSQualifiedName: ["left", "right"], TSCallSignatureDeclaration: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSConstructSignatureDeclaration: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSPropertySignature: ["key", "typeAnnotation"], TSMethodSignature: ["key", "typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSIndexSignature: ["parameters", "typeAnnotation"], TSAnyKeyword: [], TSBooleanKeyword: [], TSBigIntKeyword: [], TSIntrinsicKeyword: [], TSNeverKeyword: [], TSNullKeyword: [], TSNumberKeyword: [], TSObjectKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], TSUndefinedKeyword: [], TSUnknownKeyword: [], TSVoidKeyword: [], TSThisType: [], TSFunctionType: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSConstructorType: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSTypeReference: ["typeName", "typeParameters", "typeArguments"], TSTypePredicate: ["parameterName", "typeAnnotation"], TSTypeQuery: ["exprName", "typeParameters", "typeArguments"], TSTypeLiteral: ["members"], TSArrayType: ["elementType"], TSTupleType: ["elementTypes"], TSOptionalType: ["typeAnnotation"], TSRestType: ["typeAnnotation"], TSNamedTupleMember: ["label", "elementType"], TSUnionType: ["types"], TSIntersectionType: ["types"], TSConditionalType: ["checkType", "extendsType", "trueType", "falseType"], TSInferType: ["typeParameter"], TSParenthesizedType: ["typeAnnotation"], TSTypeOperator: ["typeAnnotation"], TSIndexedAccessType: ["objectType", "indexType"], TSMappedType: ["typeParameter", "typeAnnotation", "nameType"], TSLiteralType: ["literal"], TSExpressionWithTypeArguments: ["expression", "typeParameters"], TSInterfaceDeclaration: ["id", "typeParameters", "extends", "body"], TSInterfaceBody: ["body"], TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSInstantiationExpression: ["expression", "typeParameters", "typeArguments"], TSAsExpression: ["expression", "typeAnnotation"], TSSatisfiesExpression: ["expression", "typeAnnotation"], TSTypeAssertion: ["typeAnnotation", "expression"], TSEnumDeclaration: ["id", "members"], TSEnumMember: ["id", "initializer"], TSModuleDeclaration: ["id", "body"], TSModuleBlock: ["body"], TSImportType: ["argument", "qualifier", "typeParameters", "typeArguments"], TSImportEqualsDeclaration: ["id", "moduleReference"], TSExternalModuleReference: ["expression"], TSNonNullExpression: ["expression"], TSExportAssignment: ["expression"], TSNamespaceExportDeclaration: ["id"], TSTypeAnnotation: ["typeAnnotation"], TSTypeParameterInstantiation: ["params"], TSTypeParameterDeclaration: ["params"], TSTypeParameter: ["constraint", "default", "name"], ChainExpression: ["expression"], ExperimentalRestProperty: ["argument"], ExperimentalSpreadProperty: ["argument"], Literal: [], MethodDefinition: ["decorators", "key", "value"], PrivateIdentifier: [], Property: ["key", "value"], PropertyDefinition: ["decorators", "key", "typeAnnotation", "value", "variance"], AccessorProperty: ["decorators", "key", "typeAnnotation", "value"], TSAbstractAccessorProperty: ["decorators", "key", "typeAnnotation"], TSAbstractKeyword: [], TSAbstractMethodDefinition: ["key", "value"], TSAbstractPropertyDefinition: ["decorators", "key", "typeAnnotation"], TSAsyncKeyword: [], TSClassImplements: ["expression", "typeArguments", "typeParameters"], TSDeclareKeyword: [], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumBody: ["members"], TSExportKeyword: [], TSInterfaceHeritage: ["expression", "typeArguments", "typeParameters"], TSPrivateKeyword: [], TSProtectedKeyword: [], TSPublicKeyword: [], TSReadonlyKeyword: [], TSStaticKeyword: [], TSTemplateLiteralType: ["quasis", "types"], AsConstExpression: ["expression"], AsExpression: ["expression", "typeAnnotation"], BigIntLiteralTypeAnnotation: [], BigIntTypeAnnotation: [], ComponentDeclaration: ["id", "params", "body", "typeParameters", "rendersType"], ComponentParameter: ["name", "local"], ComponentTypeAnnotation: ["params", "rest", "typeParameters", "rendersType"], ComponentTypeParameter: ["name", "typeAnnotation"], ConditionalTypeAnnotation: ["checkType", "extendsType", "trueType", "falseType"], DeclareComponent: ["id", "params", "rest", "typeParameters", "rendersType"], DeclareEnum: ["id", "body"], DeclareHook: ["id"], DeclareNamespace: ["id", "body"], EnumBigIntBody: ["members"], EnumBigIntMember: ["id", "init"], HookDeclaration: ["id", "params", "body", "typeParameters", "returnType"], HookTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], InferTypeAnnotation: ["typeParameter"], KeyofTypeAnnotation: ["argument"], ObjectTypeMappedTypeProperty: ["keyTparam", "propType", "sourceType", "variance"], QualifiedTypeofIdentifier: ["qualification", "id"], TupleTypeLabeledElement: ["label", "elementType", "variance"], TupleTypeSpreadElement: ["label", "typeAnnotation"], TypeOperator: ["typeAnnotation"], TypePredicate: ["parameterName", "typeAnnotation", "asserts"], NGRoot: ["node"], NGPipeExpression: ["left", "right", "arguments"], NGChainedExpression: ["expressions"], NGEmptyExpression: [], NGMicrosyntax: ["body"], NGMicrosyntaxKey: [], NGMicrosyntaxExpression: ["expression", "alias"], NGMicrosyntaxKeyedExpression: ["key", "expression"], NGMicrosyntaxLet: ["key", "value"], NGMicrosyntaxAs: ["key", "alias"], JsExpressionRoot: ["node"], JsonRoot: ["node"], TSJSDocAllType: [], TSJSDocUnknownType: [], TSJSDocNullableType: ["typeAnnotation"], TSJSDocNonNullableType: ["typeAnnotation"], NeverTypeAnnotation: [], UndefinedTypeAnnotation: [], UnknownTypeAnnotation: [], SatisfiesExpression: ["expression", "typeAnnotation"] }, ni = ri(ai), oi = ni;
|
|
2565
|
+
function Ot(t, e) {
|
|
2566
|
+
if (!(t !== null && typeof t == "object")) return t;
|
|
2567
|
+
if (Array.isArray(t)) {
|
|
2568
|
+
for (let i = 0; i < t.length; i++) t[i] = Ot(t[i], e);
|
|
2569
|
+
return t;
|
|
2570
|
+
}
|
|
2571
|
+
let s = oi(t);
|
|
2572
|
+
for (let i = 0; i < s.length; i++) t[s[i]] = Ot(t[s[i]], e);
|
|
2573
|
+
return e(t) || t;
|
|
2574
|
+
}
|
|
2575
|
+
var Ft = Ot;
|
|
2576
|
+
function ui(t, e) {
|
|
2577
|
+
let { parser: s, text: i } = e;
|
|
2578
|
+
if (t.type === "File" && t.program.interpreter) {
|
|
2579
|
+
let { program: { interpreter: r }, comments: n } = t;
|
|
2580
|
+
delete t.program.interpreter, n.unshift(r);
|
|
2581
|
+
}
|
|
2582
|
+
if (s === "babel") {
|
|
2583
|
+
let r = /* @__PURE__ */ new Set();
|
|
2584
|
+
t = Ft(t, (n) => {
|
|
2585
|
+
var o;
|
|
2586
|
+
(o = n.leadingComments) != null && o.some(ti) && r.add(U(n));
|
|
2587
|
+
}), t = Ft(t, (n) => {
|
|
2588
|
+
if (n.type === "ParenthesizedExpression") {
|
|
2589
|
+
let { expression: o } = n;
|
|
2590
|
+
if (o.type === "TypeCastExpression") return o.range = [...n.range], o;
|
|
2591
|
+
let u = U(n);
|
|
2592
|
+
if (!r.has(u)) return o.extra = { ...o.extra, parenthesized: !0 }, o;
|
|
2593
|
+
}
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
if (t = Ft(t, (r) => {
|
|
2597
|
+
var n;
|
|
2598
|
+
switch (r.type) {
|
|
2599
|
+
case "LogicalExpression":
|
|
2600
|
+
if (He(r)) return jt(r);
|
|
2601
|
+
break;
|
|
2602
|
+
case "VariableDeclaration": {
|
|
2603
|
+
let o = Ct(!1, r.declarations, -1);
|
|
2604
|
+
o != null && o.init && i[H(o)] !== ";" && (r.range = [U(r), H(o)]);
|
|
2605
|
+
break;
|
|
2606
|
+
}
|
|
2607
|
+
case "TSParenthesizedType":
|
|
2608
|
+
return r.typeAnnotation;
|
|
2609
|
+
case "TSTypeParameter":
|
|
2610
|
+
if (typeof r.name == "string") {
|
|
2611
|
+
let o = U(r);
|
|
2612
|
+
r.name = { type: "Identifier", name: r.name, range: [o, o + r.name.length] };
|
|
2613
|
+
}
|
|
2614
|
+
break;
|
|
2615
|
+
case "TopicReference":
|
|
2616
|
+
t.extra = { ...t.extra, __isUsingHackPipeline: !0 };
|
|
2617
|
+
break;
|
|
2618
|
+
case "ExportAllDeclaration":
|
|
2619
|
+
if (s === "meriyah" && ((n = r.exported) == null ? void 0 : n.type) === "Identifier") {
|
|
2620
|
+
let { exported: o } = r, u = i.slice(U(o), H(o));
|
|
2621
|
+
(u.startsWith('"') || u.startsWith("'")) && (r.exported = { ...r.exported, type: "Literal", value: r.exported.name, raw: u });
|
|
2622
|
+
}
|
|
2623
|
+
break;
|
|
2624
|
+
case "TSUnionType":
|
|
2625
|
+
case "TSIntersectionType":
|
|
2626
|
+
if (r.types.length === 1) return r.types[0];
|
|
2627
|
+
break;
|
|
2628
|
+
}
|
|
2629
|
+
}), Ws(t.comments)) {
|
|
2630
|
+
let r = Ct(!1, t.comments, -1);
|
|
2631
|
+
for (let n = t.comments.length - 2; n >= 0; n--) {
|
|
2632
|
+
let o = t.comments[n];
|
|
2633
|
+
H(o) === U(r) && Rt(o) && Rt(r) && ee(o) && ee(r) && (t.comments.splice(n + 1, 1), o.value += "*//*" + r.value, o.range = [U(o), H(r)]), r = o;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
return t.type === "Program" && (t.range = [0, i.length]), t;
|
|
2637
|
+
}
|
|
2638
|
+
function He(t) {
|
|
2639
|
+
return t.type === "LogicalExpression" && t.right.type === "LogicalExpression" && t.operator === t.right.operator;
|
|
2640
|
+
}
|
|
2641
|
+
function jt(t) {
|
|
2642
|
+
return He(t) ? jt({ type: "LogicalExpression", operator: t.operator, left: jt({ type: "LogicalExpression", operator: t.operator, left: t.left, right: t.right.left, range: [U(t.left), H(t.right.left)] }), right: t.right.right, range: [U(t), H(t)] }) : t;
|
|
2643
|
+
}
|
|
2644
|
+
var We = ui, pi = (t, e, s, i) => {
|
|
2645
|
+
if (!(t && e == null)) return e.replaceAll ? e.replaceAll(s, i) : s.global ? e.replace(s, i) : e.split(s).join(i);
|
|
2646
|
+
}, yt = pi, hi = /\*\/$/, ci = /^\/\*\*?/, li = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/, di = /(^|\s+)\/\/([^\n\r]*)/g, se = /^(\r?\n)+/, mi = /(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g, ie = /(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g, fi = /(\r?\n|^) *\* ?/g, yi = [];
|
|
2647
|
+
function xi(t) {
|
|
2648
|
+
let e = t.match(li);
|
|
2649
|
+
return e ? e[0].trimStart() : "";
|
|
2650
|
+
}
|
|
2651
|
+
function gi(t) {
|
|
2652
|
+
let e = `
|
|
2653
|
+
`;
|
|
2654
|
+
t = yt(!1, t.replace(ci, "").replace(hi, ""), fi, "$1");
|
|
2655
|
+
let s = "";
|
|
2656
|
+
for (; s !== t; ) s = t, t = yt(!1, t, mi, `${e}$1 $2${e}`);
|
|
2657
|
+
t = t.replace(se, "").trimEnd();
|
|
2658
|
+
let i = /* @__PURE__ */ Object.create(null), r = yt(!1, t, ie, "").replace(se, "").trimEnd(), n;
|
|
2659
|
+
for (; n = ie.exec(t); ) {
|
|
2660
|
+
let o = yt(!1, n[2], di, "");
|
|
2661
|
+
if (typeof i[n[1]] == "string" || Array.isArray(i[n[1]])) {
|
|
2662
|
+
let u = i[n[1]];
|
|
2663
|
+
i[n[1]] = [...yi, ...Array.isArray(u) ? u : [u], o];
|
|
2664
|
+
} else i[n[1]] = o;
|
|
2665
|
+
}
|
|
2666
|
+
return { comments: r, pragmas: i };
|
|
2667
|
+
}
|
|
2668
|
+
function Ai(t) {
|
|
2669
|
+
if (!t.startsWith("#!")) return "";
|
|
2670
|
+
let e = t.indexOf(`
|
|
2671
|
+
`);
|
|
2672
|
+
return e === -1 ? t : t.slice(0, e);
|
|
2673
|
+
}
|
|
2674
|
+
var vi = Ai;
|
|
2675
|
+
function Ci(t) {
|
|
2676
|
+
let e = vi(t);
|
|
2677
|
+
e && (t = t.slice(e.length + 1));
|
|
2678
|
+
let s = xi(t), { pragmas: i, comments: r } = gi(s);
|
|
2679
|
+
return { shebang: e, text: t, pragmas: i, comments: r };
|
|
2680
|
+
}
|
|
2681
|
+
function Ei(t) {
|
|
2682
|
+
let { pragmas: e } = Ci(t);
|
|
2683
|
+
return Object.prototype.hasOwnProperty.call(e, "prettier") || Object.prototype.hasOwnProperty.call(e, "format");
|
|
2684
|
+
}
|
|
2685
|
+
function bi(t) {
|
|
2686
|
+
return t = typeof t == "function" ? { parse: t } : t, { astFormat: "estree", hasPragma: Ei, locStart: U, locEnd: H, ...t };
|
|
2687
|
+
}
|
|
2688
|
+
var ze = bi;
|
|
2689
|
+
function Si(t) {
|
|
2690
|
+
let { filepath: e } = t;
|
|
2691
|
+
if (e) {
|
|
2692
|
+
if (e = e.toLowerCase(), e.endsWith(".cjs")) return "script";
|
|
2693
|
+
if (e.endsWith(".mjs")) return "module";
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
var Qe = Si, ki = { ecmaVersion: "latest", allowReturnOutsideFunction: !0, allowSuperOutsideMethod: !0, locations: !0, ranges: !0 };
|
|
2697
|
+
function Ti(t) {
|
|
2698
|
+
let { message: e, loc: s } = t;
|
|
2699
|
+
if (!s) return t;
|
|
2700
|
+
let { line: i, column: r } = s;
|
|
2701
|
+
return Xe(e.replace(/ \(\d+:\d+\)$/u, ""), { loc: { start: { line: i, column: r + 1 } }, cause: t });
|
|
2702
|
+
}
|
|
2703
|
+
var Pt, _i = () => (Pt ?? (Pt = T.extend((0, Gs.default)())), Pt);
|
|
2704
|
+
function wi(t, e) {
|
|
2705
|
+
let s = _i(), i = [], r = [], n = s.parse(t, { ...ki, sourceType: e, allowImportExportEverywhere: e === "module", onComment: i, onToken: r });
|
|
2706
|
+
return n.comments = i, n.tokens = r, n;
|
|
2707
|
+
}
|
|
2708
|
+
function Di(t, e = {}) {
|
|
2709
|
+
let s = Qe(e), i = (s ? [s] : ["module", "script"]).map((n) => () => wi(t, n)), r;
|
|
2710
|
+
try {
|
|
2711
|
+
r = Ke(i);
|
|
2712
|
+
} catch ({ errors: [n] }) {
|
|
2713
|
+
throw Ti(n);
|
|
2714
|
+
}
|
|
2715
|
+
return We(r, { text: t });
|
|
2716
|
+
}
|
|
2717
|
+
var Fi = ze(Di), Pi = ne(oe()), w = { Boolean: "Boolean", EOF: "<end>", Identifier: "Identifier", PrivateIdentifier: "PrivateIdentifier", Keyword: "Keyword", Null: "Null", Numeric: "Numeric", Punctuator: "Punctuator", String: "String", RegularExpression: "RegularExpression", Template: "Template", JSXIdentifier: "JSXIdentifier", JSXText: "JSXText" };
|
|
2718
|
+
function Bi(t, e) {
|
|
2719
|
+
let s = t[0], i = Ct(!1, t, -1), r = { type: w.Template, value: e.slice(s.start, i.end) };
|
|
2720
|
+
return s.loc && (r.loc = { start: s.loc.start, end: i.loc.end }), s.range && (r.start = s.range[0], r.end = i.range[1], r.range = [r.start, r.end]), r;
|
|
2721
|
+
}
|
|
2722
|
+
function Mt(t, e) {
|
|
2723
|
+
this._acornTokTypes = t, this._tokens = [], this._curlyBrace = null, this._code = e;
|
|
2724
|
+
}
|
|
2725
|
+
Mt.prototype = { constructor: Mt, translate(t, e) {
|
|
2726
|
+
let s = t.type, i = this._acornTokTypes;
|
|
2727
|
+
if (s === i.name) t.type = w.Identifier, t.value === "static" && (t.type = w.Keyword), e.ecmaVersion > 5 && (t.value === "yield" || t.value === "let") && (t.type = w.Keyword);
|
|
2728
|
+
else if (s === i.privateId) t.type = w.PrivateIdentifier;
|
|
2729
|
+
else if (s === i.semi || s === i.comma || s === i.parenL || s === i.parenR || s === i.braceL || s === i.braceR || s === i.dot || s === i.bracketL || s === i.colon || s === i.question || s === i.bracketR || s === i.ellipsis || s === i.arrow || s === i.jsxTagStart || s === i.incDec || s === i.starstar || s === i.jsxTagEnd || s === i.prefix || s === i.questionDot || s.binop && !s.keyword || s.isAssign) t.type = w.Punctuator, t.value = this._code.slice(t.start, t.end);
|
|
2730
|
+
else if (s === i.jsxName) t.type = w.JSXIdentifier;
|
|
2731
|
+
else if (s.label === "jsxText" || s === i.jsxAttrValueToken) t.type = w.JSXText;
|
|
2732
|
+
else if (s.keyword) s.keyword === "true" || s.keyword === "false" ? t.type = w.Boolean : s.keyword === "null" ? t.type = w.Null : t.type = w.Keyword;
|
|
2733
|
+
else if (s === i.num) t.type = w.Numeric, t.value = this._code.slice(t.start, t.end);
|
|
2734
|
+
else if (s === i.string) e.jsxAttrValueToken ? (e.jsxAttrValueToken = !1, t.type = w.JSXText) : t.type = w.String, t.value = this._code.slice(t.start, t.end);
|
|
2735
|
+
else if (s === i.regexp) {
|
|
2736
|
+
t.type = w.RegularExpression;
|
|
2737
|
+
let r = t.value;
|
|
2738
|
+
t.regex = { flags: r.flags, pattern: r.pattern }, t.value = `/${r.pattern}/${r.flags}`;
|
|
2739
|
+
}
|
|
2740
|
+
return t;
|
|
2741
|
+
}, onToken(t, e) {
|
|
2742
|
+
let s = this._acornTokTypes, i = e.tokens, r = this._tokens, n = () => {
|
|
2743
|
+
i.push(Bi(this._tokens, this._code)), this._tokens = [];
|
|
2744
|
+
};
|
|
2745
|
+
if (t.type === s.eof) {
|
|
2746
|
+
this._curlyBrace && i.push(this.translate(this._curlyBrace, e));
|
|
2747
|
+
return;
|
|
2748
|
+
}
|
|
2749
|
+
if (t.type === s.backQuote) {
|
|
2750
|
+
this._curlyBrace && (i.push(this.translate(this._curlyBrace, e)), this._curlyBrace = null), r.push(t), r.length > 1 && n();
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2753
|
+
if (t.type === s.dollarBraceL) {
|
|
2754
|
+
r.push(t), n();
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2757
|
+
if (t.type === s.braceR) {
|
|
2758
|
+
this._curlyBrace && i.push(this.translate(this._curlyBrace, e)), this._curlyBrace = t;
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
if (t.type === s.template || t.type === s.invalidTemplate) {
|
|
2762
|
+
this._curlyBrace && (r.push(this._curlyBrace), this._curlyBrace = null), r.push(t);
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2765
|
+
this._curlyBrace && (i.push(this.translate(this._curlyBrace, e)), this._curlyBrace = null), i.push(this.translate(t, e));
|
|
2766
|
+
} };
|
|
2767
|
+
var Ii = Mt, $e = [3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
|
|
2768
|
+
function Ni() {
|
|
2769
|
+
return Ct(!1, $e, -1);
|
|
2770
|
+
}
|
|
2771
|
+
function Vi(t = 5) {
|
|
2772
|
+
let e = t === "latest" ? Ni() : t;
|
|
2773
|
+
if (typeof e != "number") throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof t} instead.`);
|
|
2774
|
+
if (e >= 2015 && (e -= 2009), !$e.includes(e)) throw new Error("Invalid ecmaVersion.");
|
|
2775
|
+
return e;
|
|
2776
|
+
}
|
|
2777
|
+
function Li(t = "script") {
|
|
2778
|
+
if (t === "script" || t === "module") return t;
|
|
2779
|
+
if (t === "commonjs") return "script";
|
|
2780
|
+
throw new Error("Invalid sourceType.");
|
|
2781
|
+
}
|
|
2782
|
+
function Ri(t) {
|
|
2783
|
+
let e = Vi(t.ecmaVersion), s = Li(t.sourceType), i = t.range === !0, r = t.loc === !0;
|
|
2784
|
+
if (e !== 3 && t.allowReserved) throw new Error("`allowReserved` is only supported when ecmaVersion is 3");
|
|
2785
|
+
if (typeof t.allowReserved < "u" && typeof t.allowReserved != "boolean") throw new Error("`allowReserved`, when present, must be `true` or `false`");
|
|
2786
|
+
let n = e === 3 ? t.allowReserved || "never" : !1, o = t.ecmaFeatures || {}, u = t.sourceType === "commonjs" || !!o.globalReturn;
|
|
2787
|
+
if (s === "module" && e < 6) throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
|
|
2788
|
+
return Object.assign({}, t, { ecmaVersion: e, sourceType: s, ranges: i, locations: r, allowReserved: n, allowReturnOutsideFunction: u });
|
|
2789
|
+
}
|
|
2790
|
+
var Y = Symbol("espree's internal state"), Bt = Symbol("espree's esprimaFinishNode");
|
|
2791
|
+
function Oi(t, e, s, i, r, n, o) {
|
|
2792
|
+
let u;
|
|
2793
|
+
t ? u = "Block" : o.slice(s, s + 2) === "#!" ? u = "Hashbang" : u = "Line";
|
|
2794
|
+
let p = { type: u, value: e };
|
|
2795
|
+
return typeof s == "number" && (p.start = s, p.end = i, p.range = [s, i]), typeof r == "object" && (p.loc = { start: r, end: n }), p;
|
|
2796
|
+
}
|
|
2797
|
+
var re = () => (t) => {
|
|
2798
|
+
let e = Object.assign({}, t.acorn.tokTypes);
|
|
2799
|
+
return t.acornJsx && Object.assign(e, t.acornJsx.tokTypes), class extends t {
|
|
2800
|
+
constructor(s, i) {
|
|
2801
|
+
(typeof s != "object" || s === null) && (s = {}), typeof i != "string" && !(i instanceof String) && (i = String(i));
|
|
2802
|
+
let r = s.sourceType, n = Ri(s), o = n.ecmaFeatures || {}, u = n.tokens === !0 ? new Ii(e, i) : null, p = { originalSourceType: r || n.sourceType, tokens: u ? [] : null, comments: n.comment === !0 ? [] : null, impliedStrict: o.impliedStrict === !0 && n.ecmaVersion >= 5, ecmaVersion: n.ecmaVersion, jsxAttrValueToken: !1, lastToken: null, templateElements: [] };
|
|
2803
|
+
super({ ecmaVersion: n.ecmaVersion, sourceType: n.sourceType, ranges: n.ranges, locations: n.locations, allowReserved: n.allowReserved, allowReturnOutsideFunction: n.allowReturnOutsideFunction, onToken(c) {
|
|
2804
|
+
u && u.onToken(c, p), c.type !== e.eof && (p.lastToken = c);
|
|
2805
|
+
}, onComment(c, d, E, _, C, b) {
|
|
2806
|
+
if (p.comments) {
|
|
2807
|
+
let B = Oi(c, d, E, _, C, b, i);
|
|
2808
|
+
p.comments.push(B);
|
|
2809
|
+
}
|
|
2810
|
+
} }, i), this[Y] = p;
|
|
2811
|
+
}
|
|
2812
|
+
tokenize() {
|
|
2813
|
+
do
|
|
2814
|
+
this.next();
|
|
2815
|
+
while (this.type !== e.eof);
|
|
2816
|
+
this.next();
|
|
2817
|
+
let s = this[Y], i = s.tokens;
|
|
2818
|
+
return s.comments && (i.comments = s.comments), i;
|
|
2819
|
+
}
|
|
2820
|
+
finishNode(...s) {
|
|
2821
|
+
let i = super.finishNode(...s);
|
|
2822
|
+
return this[Bt](i);
|
|
2823
|
+
}
|
|
2824
|
+
finishNodeAt(...s) {
|
|
2825
|
+
let i = super.finishNodeAt(...s);
|
|
2826
|
+
return this[Bt](i);
|
|
2827
|
+
}
|
|
2828
|
+
parse() {
|
|
2829
|
+
let s = this[Y], i = super.parse();
|
|
2830
|
+
if (i.sourceType = s.originalSourceType, s.comments && (i.comments = s.comments), s.tokens && (i.tokens = s.tokens), i.body.length) {
|
|
2831
|
+
let [r] = i.body;
|
|
2832
|
+
i.range && (i.range[0] = r.range[0]), i.loc && (i.loc.start = r.loc.start), i.start = r.start;
|
|
2833
|
+
}
|
|
2834
|
+
return s.lastToken && (i.range && (i.range[1] = s.lastToken.range[1]), i.loc && (i.loc.end = s.lastToken.loc.end), i.end = s.lastToken.end), this[Y].templateElements.forEach((r) => {
|
|
2835
|
+
let n = r.tail ? 1 : 2;
|
|
2836
|
+
r.start += -1, r.end += n, r.range && (r.range[0] += -1, r.range[1] += n), r.loc && (r.loc.start.column += -1, r.loc.end.column += n);
|
|
2837
|
+
}), i;
|
|
2838
|
+
}
|
|
2839
|
+
parseTopLevel(s) {
|
|
2840
|
+
return this[Y].impliedStrict && (this.strict = !0), super.parseTopLevel(s);
|
|
2841
|
+
}
|
|
2842
|
+
raise(s, i) {
|
|
2843
|
+
let r = t.acorn.getLineInfo(this.input, s), n = new SyntaxError(i);
|
|
2844
|
+
throw n.index = s, n.lineNumber = r.line, n.column = r.column + 1, n;
|
|
2845
|
+
}
|
|
2846
|
+
raiseRecoverable(s, i) {
|
|
2847
|
+
this.raise(s, i);
|
|
2848
|
+
}
|
|
2849
|
+
unexpected(s) {
|
|
2850
|
+
let i = "Unexpected token";
|
|
2851
|
+
if (s != null) {
|
|
2852
|
+
if (this.pos = s, this.options.locations) for (; this.pos < this.lineStart; ) this.lineStart = this.input.lastIndexOf(`
|
|
2853
|
+
`, this.lineStart - 2) + 1, --this.curLine;
|
|
2854
|
+
this.nextToken();
|
|
2855
|
+
}
|
|
2856
|
+
this.end > this.start && (i += ` ${this.input.slice(this.start, this.end)}`), this.raise(this.start, i);
|
|
2857
|
+
}
|
|
2858
|
+
jsx_readString(s) {
|
|
2859
|
+
let i = super.jsx_readString(s);
|
|
2860
|
+
return this.type === e.string && (this[Y].jsxAttrValueToken = !0), i;
|
|
2861
|
+
}
|
|
2862
|
+
[Bt](s) {
|
|
2863
|
+
return s.type === "TemplateElement" && this[Y].templateElements.push(s), s.type.includes("Function") && !s.generator && (s.generator = !1), s;
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
}, ji = { _regular: null, _jsx: null, get regular() {
|
|
2867
|
+
return this._regular === null && (this._regular = T.extend(re())), this._regular;
|
|
2868
|
+
}, get jsx() {
|
|
2869
|
+
return this._jsx === null && (this._jsx = T.extend((0, Pi.default)(), re())), this._jsx;
|
|
2870
|
+
}, get(t) {
|
|
2871
|
+
return t && t.ecmaFeatures && t.ecmaFeatures.jsx ? this.jsx : this.regular;
|
|
2872
|
+
} };
|
|
2873
|
+
function Mi(t, e) {
|
|
2874
|
+
let s = ji.get(e);
|
|
2875
|
+
return new s(e, t).parse();
|
|
2876
|
+
}
|
|
2877
|
+
var Ui = { ecmaVersion: "latest", range: !0, loc: !0, comment: !0, tokens: !0, sourceType: "module", ecmaFeatures: { jsx: !0, globalReturn: !0, impliedStrict: !1 } };
|
|
2878
|
+
function qi(t) {
|
|
2879
|
+
let { message: e, lineNumber: s, column: i } = t;
|
|
2880
|
+
return typeof s != "number" ? t : Xe(e, { loc: { start: { line: s, column: i } }, cause: t });
|
|
2881
|
+
}
|
|
2882
|
+
function Gi(t, e = {}) {
|
|
2883
|
+
let s = Qe(e), i = (s ? [s] : ["module", "script"]).map((n) => () => Mi(t, { ...Ui, sourceType: n })), r;
|
|
2884
|
+
try {
|
|
2885
|
+
r = Ke(i);
|
|
2886
|
+
} catch ({ errors: [n] }) {
|
|
2887
|
+
throw qi(n);
|
|
2888
|
+
}
|
|
2889
|
+
return We(r, { text: t });
|
|
2890
|
+
}
|
|
2891
|
+
var Ji = ze(Gi), Xi = { acorn: Fi, espree: Ji }, Ki = ue;
|
|
2892
|
+
export {
|
|
2893
|
+
Ki as default,
|
|
2894
|
+
Xi as parsers
|
|
2895
|
+
};
|