@tanstack/ai-mcp
Version:
Host-side Model Context Protocol client for TanStack AI: discover and run MCP server tools, resources, and prompts in any adapter's chat() loop, with generated end-to-end types.
7,318 lines • 416 kB
JavaScript
#!/usr/bin/env node
import {
__esm,
init_esm_shims
} from "./chunk-A4N5BRUW.js";
// ../../node_modules/.pnpm/prettier@3.9.9/node_modules/prettier/plugins/babel.mjs
function O(a2, e) {
let { line: t, column: s, index: i } = a2;
return new L(t, s + e, i + e);
}
function Re(a2, e, t) {
Object.defineProperty(a2, e, { enumerable: false, configurable: true, value: t });
}
function fi({ toMessage: a2, code: e, reasonCode: t, syntaxPlugin: s }) {
let i = t === "MissingPlugin" || t === "MissingOneOfPlugins";
return function r(n, o, h) {
let c = new SyntaxError();
return c.code = e, c.reasonCode = t, c.loc = n, c.pos = o, c.syntaxPlugin = s, i && (c.missingPlugin = h.missingPlugin), Re(c, "clone", function(f = {}) {
let { line: d, column: x, index: T = o } = f.loc ?? n;
return r(new L(d, x), T, { ...h, ...f.details });
}), Re(c, "details", h), Object.defineProperty(c, "message", { configurable: true, get() {
let p = `${a2(h)} (${n.line}:${n.column})`;
return this.message = p, p;
}, set(p) {
Object.defineProperty(this, "message", { value: p, writable: true });
} }), c;
};
}
function F(a2, e) {
if (Array.isArray(a2)) return (s) => F(s, a2[0]);
let t = {};
for (let s of Object.keys(a2)) {
let i = a2[s], { message: r, ...n } = typeof i == "string" ? { message: () => i } : typeof i == "function" ? { message: i } : i, o = typeof r == "string" ? () => r : r;
t[s] = fi({ code: "BABEL_PARSER_SYNTAX_ERROR", reasonCode: s, toMessage: o, ...e ? { syntaxPlugin: e } : {}, ...n });
}
return t;
}
function di() {
return { sourceType: "script", sourceFilename: void 0, startIndex: 0, startColumn: 0, startLine: 1, allowAwaitOutsideFunction: false, allowReturnOutsideFunction: false, allowNewTargetOutsideFunction: false, allowImportExportEverywhere: false, allowSuperOutsideMethod: false, allowUndeclaredExports: false, allowYieldOutsideFunction: false, plugins: [], strictMode: void 0, ranges: false, locations: true, tokens: false, createImportExpressions: true, createParenthesizedExpressions: false, errorRecovery: false, attachComment: true, annexB: true };
}
function mi(a2) {
let e = di();
if (a2 == null) return e;
if (a2.annexB != null && a2.annexB !== false) throw new Error("The `annexB` option can only be set to `false`.");
for (let t of Object.keys(e)) a2[t] != null && (e[t] = a2[t]);
if (e.startLine === 1) a2.startIndex == null && e.startColumn > 0 ? e.startIndex = e.startColumn : a2.startColumn == null && e.startIndex > 0 && (e.startColumn = e.startIndex);
else if (a2.startColumn == null || a2.startIndex == null) throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
if (e.sourceType === "commonjs") {
if (a2.allowAwaitOutsideFunction != null) throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");
if (a2.allowReturnOutsideFunction != null) throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");
if (a2.allowNewTargetOutsideFunction != null) throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.");
}
return e;
}
function Y(a2) {
let { start: e, end: t } = a2.loc;
return a2.loc.start = new L(e.line, e.column), a2.loc.end = new L(t.line, t.column), a2;
}
function S(a2, e = {}) {
e.keyword = a2;
let t = g(a2, e);
return Pe.set(a2, t), t;
}
function M(a2, e) {
return g(a2, { beforeExpr: A, binop: e });
}
function g(a2, e = {}) {
return ++mt, Te.push(a2), be.push(e.binop ?? -1), Ae.push(e.beforeExpr ?? false), Se.push(e.startsExpr ?? false), Ce.push(e.prefix ?? false), ge.push(new kt(a2, e)), mt;
}
function b(a2, e = {}) {
return ++mt, Pe.set(a2, mt), Te.push(a2), be.push(e.binop ?? -1), Ae.push(e.beforeExpr ?? false), Se.push(e.startsExpr ?? false), Ce.push(e.prefix ?? false), ge.push(new kt("name", e)), mt;
}
function C(a2) {
return a2 >= 89 && a2 <= 129;
}
function gi(a2) {
return a2 <= 88;
}
function B(a2) {
return a2 >= 54 && a2 <= 129;
}
function Ye(a2) {
return a2 >= 54 && a2 <= 132;
}
function Ti(a2) {
return Ae[a2];
}
function ft(a2) {
return Se[a2];
}
function bi(a2) {
return a2 >= 25 && a2 <= 29;
}
function Ue(a2) {
return a2 >= 125 && a2 <= 127;
}
function Ai(a2) {
return a2 >= 86 && a2 <= 88;
}
function Ee(a2) {
return a2 >= 54 && a2 <= 88;
}
function _e(a2) {
return a2 >= 35 && a2 <= 55;
}
function Si(a2) {
return a2 === 30;
}
function Ci(a2) {
return Ce[a2];
}
function Ei(a2) {
return a2 >= 117 && a2 <= 119;
}
function wi(a2) {
return a2 >= 120 && a2 <= 126;
}
function z(a2) {
return Te[a2];
}
function It(a2) {
return be[a2];
}
function Ii(a2) {
return a2 === 53;
}
function Gt(a2) {
return a2 >= 20 && a2 <= 21;
}
function Qe(a2) {
return ge[a2];
}
function Xt(a2, e) {
let t = 65536;
for (let s = 0, i = e.length; s < i; s += 2) {
if (t += e[s], t > a2) return false;
if (t += e[s + 1], t >= a2) return true;
}
return false;
}
function R(a2) {
return a2 < 65 ? a2 === 36 : a2 <= 90 ? true : a2 < 97 ? a2 === 95 : a2 <= 122 ? true : a2 <= 65535 ? a2 >= 170 && vi.test(String.fromCharCode(a2)) : Xt(a2, ts);
}
function W(a2) {
return a2 < 48 ? a2 === 36 : a2 < 58 ? true : a2 < 65 ? false : a2 <= 90 ? true : a2 < 97 ? a2 === 95 : a2 <= 122 ? true : a2 <= 65535 ? a2 >= 170 && Li.test(String.fromCharCode(a2)) : Xt(a2, ts) || Xt(a2, ki);
}
function es(a2, e) {
return e && a2 === "await" || a2 === "enum";
}
function ss(a2, e) {
return es(a2, e) || Mi.has(a2);
}
function is(a2) {
return Oi.has(a2);
}
function rs(a2, e) {
return ss(a2, e) || is(a2);
}
function Fi(a2) {
return Di.has(a2);
}
function Bi(a2, e, t) {
return a2 === 64 && e === 64 && R(t);
}
function Ui(a2) {
return Ri.has(a2);
}
function Vi(a2) {
return a2.type === "DeclareExportAllDeclaration" || a2.type === "DeclareExportDeclaration" && (!a2.declaration || a2.declaration.type !== "TypeAlias" && a2.declaration.type !== "InterfaceDeclaration");
}
function je(a2) {
return a2.importKind === "type" || a2.importKind === "typeof";
}
function $i(a2, e) {
let t = [], s = [];
for (let i = 0; i < a2.length; i++) (e(a2[i], i, a2) ? t : s).push(a2[i]);
return [t, s];
}
function tt(a2) {
switch (a2) {
case 10:
case 13:
case 8232:
case 8233:
return true;
default:
return false;
}
}
function Ve(a2, e, t) {
for (let s = e; s < t; s++) if (tt(a2.charCodeAt(s))) return true;
return false;
}
function Wi(a2) {
switch (a2) {
case 9:
case 11:
case 12:
case 32:
case 160:
case 5760:
case 8192:
case 8193:
case 8194:
case 8195:
case 8196:
case 8197:
case 8198:
case 8199:
case 8200:
case 8201:
case 8202:
case 8239:
case 8287:
case 12288:
case 65279:
return true;
default:
return false;
}
}
function q(a2) {
return a2 ? a2.type === "JSXOpeningFragment" || a2.type === "JSXClosingFragment" : false;
}
function Z(a2) {
if (a2.type === "JSXIdentifier") return a2.name;
if (a2.type === "JSXNamespacedName") return a2.namespace.name + ":" + a2.name.name;
if (a2.type === "JSXMemberExpression") return Z(a2.object) + "." + Z(a2.property);
throw new Error("Node had unexpected type: " + a2.type);
}
function as(a2, e) {
a2.trailingComments === void 0 ? a2.trailingComments = e : a2.trailingComments.unshift(...e);
}
function Xi(a2, e) {
a2.leadingComments === void 0 ? a2.leadingComments = e : a2.leadingComments.unshift(...e);
}
function Pt(a2, e) {
a2.innerComments === void 0 ? a2.innerComments = e : a2.innerComments.unshift(...e);
}
function $(a2, e, t) {
let s = null, i = e.length;
for (; s === null && i > 0; ) s = e[--i];
s === null || s.start > t.start ? Pt(a2, t.comments) : as(s, t.comments);
}
function $e(a2, e, t, s, i, r) {
let n = t, o = s, h = i, c = "", p = null, f = t, { length: d } = e;
for (; ; ) {
if (t >= d) {
r.unterminated(n, o, h), c += e.slice(f, t);
break;
}
let x = e.charCodeAt(t);
if (Qi(a2, x, e, t)) {
c += e.slice(f, t);
break;
}
if (x === 92) {
c += e.slice(f, t);
let T = Zi(e, t, s, i, a2 === "template", r);
T.ch === null && !p ? p = { pos: t, lineStart: s, curLine: i } : c += T.ch, { pos: t, lineStart: s, curLine: i } = T, f = t;
} else x === 8232 || x === 8233 ? (++t, ++i, s = t) : x === 10 || x === 13 ? a2 === "template" ? (c += e.slice(f, t) + `
`, ++t, x === 13 && e.charCodeAt(t) === 10 && ++t, ++i, f = s = t) : r.unterminated(n, o, h) : ++t;
}
return { pos: t, str: c, firstInvalidLoc: p, lineStart: s, curLine: i };
}
function Qi(a2, e, t, s) {
return a2 === "template" ? e === 96 || e === 36 && t.charCodeAt(s + 1) === 123 : e === (a2 === "double" ? 34 : 39);
}
function Zi(a2, e, t, s, i, r) {
let n = !i;
e++;
let o = (c) => ({ pos: e, ch: c, lineStart: t, curLine: s }), h = a2.charCodeAt(e++);
switch (h) {
case 110:
return o(`
`);
case 114:
return o("\r");
case 120: {
let c;
return { code: c, pos: e } = re(a2, e, t, s, 2, false, n, r), o(c === null ? null : String.fromCharCode(c));
}
case 117: {
let c;
return { code: c, pos: e } = os(a2, e, t, s, n, r), o(c === null ? null : String.fromCodePoint(c));
}
case 116:
return o(" ");
case 98:
return o("\b");
case 118:
return o("\v");
case 102:
return o("\f");
case 13:
a2.charCodeAt(e) === 10 && ++e;
case 10:
t = e, ++s;
case 8232:
case 8233:
return o("");
case 56:
case 57:
if (i) return o(null);
r.strictNumericEscape(e - 1, t, s);
default:
if (h >= 48 && h <= 55) {
let c = e - 1, f = /^[0-7]+/.exec(a2.slice(c, e + 2))[0], d = parseInt(f, 8);
d > 255 && (f = f.slice(0, -1), d = parseInt(f, 8)), e += f.length - 1;
let x = a2.charCodeAt(e);
if (f !== "0" || x === 56 || x === 57) {
if (i) return o(null);
r.strictNumericEscape(c, t, s);
}
return o(String.fromCharCode(d));
}
return o(String.fromCharCode(h));
}
}
function re(a2, e, t, s, i, r, n, o) {
let h = e, c;
return { n: c, pos: e } = ns(a2, e, t, s, 16, i, r, false, o, !n), c === null && (n ? o.invalidEscapeSequence(h, t, s) : e = h - 1), { code: c, pos: e };
}
function ns(a2, e, t, s, i, r, n, o, h, c) {
let p = e, f = i === 16 ? qe.hex : qe.decBinOct, d = i === 16 ? Ct.hex : i === 10 ? Ct.dec : i === 8 ? Ct.oct : Ct.bin, x = false, T = 0;
for (let D = 0, v = r ?? 1 / 0; D < v; ++D) {
let E = a2.charCodeAt(e), I;
if (E === 95 && o !== "bail") {
let At = a2.charCodeAt(e - 1), ct = a2.charCodeAt(e + 1);
if (o) {
if (Number.isNaN(ct) || !d(ct) || f.has(At) || f.has(ct)) {
if (c) return { n: null, pos: e };
h.unexpectedNumericSeparator(e, t, s);
}
} else {
if (c) return { n: null, pos: e };
h.numericSeparatorInEscapeSequence(e, t, s);
}
++e;
continue;
}
if (E >= 97 ? I = E - 97 + 10 : E >= 65 ? I = E - 65 + 10 : Yi(E) ? I = E - 48 : I = 1 / 0, I >= i) {
if (I <= 9 && c) return { n: null, pos: e };
if (I <= 9 && h.invalidDigit(e, t, s, i)) I = 0;
else if (n) I = 0, x = true;
else break;
}
++e, T = T * i + I;
}
return e === p || r != null && e - p !== r || x ? { n: null, pos: e } : { n: T, pos: e };
}
function os(a2, e, t, s, i, r) {
let n = a2.charCodeAt(e), o;
if (n === 123) {
if (++e, { code: o, pos: e } = re(a2, e, t, s, a2.indexOf("}", e) - e, true, i, r), ++e, o !== null && o > 1114111) if (i) r.invalidCodePoint(e, t, s);
else return { code: null, pos: e };
} else ({ code: o, pos: e } = re(a2, e, t, s, 4, false, i, r));
return { code: o, pos: e };
}
function ut(a2, e, t) {
return new L(t, a2 - e, a2);
}
function er() {
return new it(3);
}
function sr() {
return new vt(1);
}
function ir() {
return new vt(2);
}
function hs() {
return new it();
}
function Nt(a2, e) {
return (a2 ? 2 : 0) | (e ? 1 : 0);
}
function cs(a2) {
for (let e = 0; e < a2.length; e++) {
let t = a2[e], { type: s } = t;
typeof s == "number" && (t.type = Qe(s));
}
return a2;
}
function nr(a2) {
if (a2 == null) throw new Error(`Unexpected ${a2} value.`);
return a2;
}
function He(a2) {
if (!a2) throw new Error("Assert fail");
}
function hr(a2) {
switch (a2) {
case "any":
return "TSAnyKeyword";
case "boolean":
return "TSBooleanKeyword";
case "bigint":
return "TSBigIntKeyword";
case "never":
return "TSNeverKeyword";
case "number":
return "TSNumberKeyword";
case "object":
return "TSObjectKeyword";
case "string":
return "TSStringKeyword";
case "symbol":
return "TSSymbolKeyword";
case "undefined":
return "TSUndefinedKeyword";
case "unknown":
return "TSUnknownKeyword";
default:
return;
}
}
function Ke(a2) {
return a2 === "private" || a2 === "public" || a2 === "protected";
}
function cr(a2) {
return a2 === "in" || a2 === "out";
}
function xe(a2) {
if (a2.extra?.parenthesized) return false;
switch (a2.type) {
case "Identifier":
return true;
case "MemberExpression":
return !a2.computed && xe(a2.object);
case "TSInstantiationExpression":
return xe(a2.expression);
default:
return false;
}
}
function pr(a2) {
if (a2.type !== "MemberExpression") return false;
let { computed: e, property: t } = a2;
return e && t.type !== "StringLiteral" && (t.type !== "TemplateLiteral" || t.expressions.length > 0) ? false : ps(a2.object);
}
function ur(a2, e) {
let { type: t } = a2;
if (a2.extra?.parenthesized) return false;
if (e) {
if (t === "Literal") {
let { value: s } = a2;
if (typeof s == "string" || typeof s == "boolean") return true;
}
} else if (t === "StringLiteral" || t === "BooleanLiteral") return true;
return !!(ls(a2, e) || fr(a2, e) || t === "TemplateLiteral" && a2.expressions.length === 0 || pr(a2));
}
function ls(a2, e) {
return e ? a2.type === "Literal" && (typeof a2.value == "number" || "bigint" in a2) : a2.type === "NumericLiteral" || a2.type === "BigIntLiteral";
}
function fr(a2, e) {
if (a2.type === "UnaryExpression") {
let { operator: t, argument: s } = a2;
if (t === "-" && ls(s, e)) return true;
}
return false;
}
function ps(a2) {
return a2.type === "Identifier" ? true : a2.type !== "MemberExpression" || a2.computed ? false : ps(a2.object);
}
function xr(a2) {
if (a2.has("decorators") && a2.has("decorators-legacy")) throw new Error("Cannot use the decorators and decorators-legacy plugin together");
if (a2.has("flow") && a2.has("typescript")) throw new Error("Cannot combine flow and typescript plugins.");
if (a2.has("placeholders") && a2.has("v8intrinsic")) throw new Error("Cannot combine placeholders and v8intrinsic plugins.");
if (a2.has("pipelineOperator")) {
let e = a2.get("pipelineOperator").proposal;
if (!Je.includes(e)) {
let t = Je.map((s) => `"${s}"`).join(", ");
throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${t}.`);
}
if (e === "hack") {
if (a2.has("placeholders")) throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
if (a2.has("v8intrinsic")) throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");
let t = a2.get("pipelineOperator").topicToken;
if (!Ge.includes(t)) {
let s = Ge.map((i) => `"${i}"`).join(", ");
throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${s}.`);
}
}
}
if (a2.has("moduleAttributes")) throw new Error("`moduleAttributes` has been removed in Babel 8, please migrate to import attributes instead.");
if (a2.has("importAssertions")) throw new Error("`importAssertions` has been removed in Babel 8, please use import attributes instead.");
if (a2.has("deprecatedImportAssert") ? console.warn("`deprecatedImportAssert` has been removed in Babel 8, please use import attributes instead.") : a2.has("importAttributes") && a2.get("importAttributes").deprecatedAssertSyntax && console.warn("The 'importAttributes' plugin has been removed in Babel 8. Please migrate any usage of `assert`-style attributes to `with`."), a2.has("recordAndTuple")) throw new Error("The 'recordAndTuple' plugin has been removed in Babel 8. Please remove it from your configuration.");
if (a2.has("asyncDoExpressions") && !a2.has("doExpressions")) {
let e = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
throw e.missingPlugins = "doExpressions", e;
}
if (a2.has("optionalChainingAssign") && a2.get("optionalChainingAssign").version !== "2023-07") throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");
if (a2.has("discardBinding") && a2.get("discardBinding").syntaxType !== "void") throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");
if (a2.has("decimal")) throw new Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");
if (a2.has("importReflection")) throw new Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.");
}
function Dt(a2, e) {
if (e?.sourceType === "unambiguous") {
e = { ...e };
try {
e.sourceType = "module";
let t = dt(e, a2), s = t.parse();
if (t.sawUnambiguousESM) return s;
if (t.ambiguousScriptDifferentAst) try {
return e.sourceType = "script", dt(e, a2).parse();
} catch {
}
else s.program.sourceType = "script";
return s;
} catch (t) {
try {
return e.sourceType = "script", dt(e, a2).parse();
} catch {
}
throw t;
}
} else return dt(e, a2).parse();
}
function Mt(a2, e) {
let t = dt(e, a2);
return t.options.strictMode && (t.state.strict = true), t.getExpression();
}
function gr(a2) {
let e = {};
for (let t of Object.keys(a2)) e[t] = Qe(a2[t]);
return e;
}
function dt(a2, e) {
let t = Lt, s = /* @__PURE__ */ new Map();
if (a2?.plugins) {
for (let i of a2.plugins) {
let r, n;
typeof i == "string" ? r = i : [r, n] = i, s.has(r) || s.set(r, n || {});
}
xr(s), t = Tr(s);
}
return new t(a2, e, s);
}
function Tr(a2) {
let e = [];
for (let i of Pr) a2.has(i) && e.push(i);
let t = e.join("|"), s = Xe.get(t);
if (!s) {
s = Lt;
for (let i of e) s = us[i](s);
Xe.set(t, s);
}
return s;
}
function Ot(a2) {
return (e, t, s) => {
if (t === false) return false;
let i = !!s?.backwards, { length: r } = e, n = t;
for (; n >= 0 && n < r; ) {
let o = e.charAt(n);
if (a2 instanceof RegExp) {
if (!a2.test(o)) return n;
} else if (!a2.includes(o)) return n;
i ? n-- : n++;
}
return n === -1 || n === r ? n : false;
};
}
function br(a2, e) {
if (e === false) return false;
if (a2.charAt(e) === "/" && a2.charAt(e + 1) === "*") {
for (let t = e + 2; t < a2.length; ++t) if (a2.charAt(t) === "*" && a2.charAt(t + 1) === "/") return t + 2;
}
return e;
}
function Ar(a2, e, t) {
if (e === false) return false;
let s = !!t?.backwards, i = a2.charAt(e);
if (s) {
if (a2.charAt(e - 1) === "\r" && i === `
`) return e - 2;
if (ys(i)) return e - 1;
} else {
if (i === "\r" && a2.charAt(e + 1) === `
`) return e + 2;
if (ys(i)) return e + 1;
}
return e;
}
function Sr(a2, e) {
return e === false ? false : a2.charAt(e) === "/" && a2.charAt(e + 1) === "/" ? ds(a2, e) : e;
}
function Cr(a2, e) {
let t = null, s = e;
for (; s !== t; ) t = s, s = fs(a2, s), s = ms(a2, s), s = Ps(a2, s), s = xs(a2, s);
return s;
}
function Ts(a2) {
let e = [];
for (let t of a2) try {
return t();
} catch (s) {
e.push(s);
}
throw Object.assign(new Error("All combinations failed"), { errors: e });
}
function Er(a2) {
if (!a2.startsWith("#!")) return "";
let e = a2.indexOf(`
`);
return e === -1 ? a2 : a2.slice(0, e);
}
function Nr(a2) {
return this[a2 < 0 ? this.length + a2 : a2];
}
function J(a2) {
let e = new Set(a2);
return (t) => e.has(t?.type);
}
function rt(a2) {
return a2.range?.[1] ?? a2.end;
}
function N(a2) {
let e = a2.range?.[0] ?? a2.start, t = (a2.declaration?.decorators ?? a2.decorators)?.[0];
return t ? Math.min(N(t), e) : e;
}
function k(a2) {
let { type: e } = a2;
return e === "IfStatement" ? k(a2.alternate ?? a2.consequent) : e === "ForInStatement" || e === "ForOfStatement" || e === "ForStatement" || e === "LabeledStatement" || e === "WithStatement" || e === "WhileStatement" ? k(a2.body) : Or.get(e)?.(a2) ?? rt(a2);
}
function nt(a2, e, t) {
if (!a2.has(e)) {
let s = t(e);
a2.set(e, s);
}
return a2.get(e);
}
function ws(a2) {
return nt(Fr, a2, (e) => at(e) && e.value[0] === "*" && /@(?:type|satisfies)\b/.test(e.value));
}
function Br(a2) {
return U(0, a2, /[^\n]/g, " ");
}
function Rr(a2, e) {
for (let t of e) {
let s = N(t), i = k(t);
a2 = a2.slice(0, s) + Is(a2.slice(s, i)) + a2.slice(i);
}
return a2;
}
function Ns(a2) {
let e = a2[Bt];
return nt(Ur, e, (t) => Rr(a2.originalText, t));
}
function _r(a2) {
if (!at(a2)) return [];
if (!a2.value.includes(`
`)) return [];
let e = [];
for (let t of `*${a2.value}*`.split(`
`)) {
if (t = t.trimStart(), !t.startsWith("*")) return [];
e.push(t);
}
return e;
}
function jr(a2) {
return nt(ks, a2, _r);
}
function vs(a2) {
ks.delete(a2);
}
function Ne(a2) {
return jr(a2).length > 0;
}
function Ls(a2) {
if (a2.length < 2) return;
let e;
for (let t = a2.length - 1; t >= 0; t--) {
let s = a2[t];
if (e && k(s) === N(e) && Ne(s) && Ne(e) && (a2.splice(t + 1, 1), s.value += "*//*" + e.value, s.range = [N(s), k(e)], vs(s)), !Es(s) && !at(s)) throw new TypeError(`Unknown comment type: "${s.type}".`);
e = s;
}
}
function Vr(a2) {
return a2 !== null && typeof a2 == "object";
}
function Tt(a2) {
if (gt !== null && typeof gt.property) {
let e = gt;
return gt = Tt.prototype = null, e;
}
return gt = Tt.prototype = a2 ?? /* @__PURE__ */ Object.create(null), new Tt();
}
function ke(a2) {
return Tt(a2);
}
function $r(a2, e = "type") {
ke(a2);
function t(s) {
let i = s[e], r = a2[i];
if (!Array.isArray(r)) throw Object.assign(new Error(`Missing visitor keys for '${i}'.`), { node: s });
return r;
}
return t;
}
function Rt(a2, e) {
if (!Ds(a2)) return a2;
if (Array.isArray(a2)) {
for (let s = 0; s < a2.length; s++) a2[s] = Rt(a2[s], e);
return a2;
}
if (e.onEnter) {
let s = e.onEnter(a2) ?? a2;
if (s !== a2) return Rt(s, e);
a2 = s;
}
let t = Fs(a2);
for (let s = 0; s < t.length; s++) a2[t[s]] = Rt(a2[t[s]], e);
return e.onLeave && (a2 = e.onLeave(a2) || a2), a2;
}
function Hr(a2, e) {
let { text: t, astType: s } = e, { comments: i } = a2;
Ls(i);
let r = a2.type === "File" ? a2.program : a2;
r.interpreter && (i.unshift(r.interpreter), delete r.interpreter), a2.hashbang && ((s === "oxc-ts" || s === "yuku-js" || s === "yuku-ts") && i.unshift(a2.hashbang), delete a2.hashbang), a2.type === "Program" && (a2.range = [0, t.length]);
let n;
return a2 = Bs(a2, { onEnter(o) {
switch (Kr(o, i, t), o.type) {
case "ParenthesizedExpression": {
let { expression: h } = o, c = N(o);
if (h.type === "TypeCastExpression") return h.range = [c, k(o)], h;
let p = false;
if (s !== "oxc-ts") {
if (!n) {
n = [];
for (let d of i) ws(d) && n.push(k(d));
}
let f = bs(0, n, (d) => d <= c);
p = f && t.slice(f, c).trim().length === 0;
}
return p ? void 0 : (h.extra = { ...h.extra, parenthesized: true }, h);
}
case "TemplateLiteral":
if (o.expressions.length !== o.quasis.length - 1) throw new Error("Malformed template literal.");
break;
case "TemplateElement":
if (s === "flow" || s === "hermes" || s === "espree" || s === "typescript" || s === "oxc-ts" || s === "yuku-ts") {
let h = N(o) + 1, c = k(o) - (o.tail ? 1 : 2);
o.range = [h, c];
}
break;
case "TSParenthesizedType":
return o.typeAnnotation;
case "TopicReference":
a2.extra = { ...a2.extra, __isUsingHackPipeline: true };
break;
case "TSUnionType":
case "TSIntersectionType":
if (o.types.length === 1) return o.types[0];
break;
case "TupleTypeAnnotation":
o.types && !o.elementTypes && (o.elementTypes = o.types);
break;
case "ImportDeclaration":
s === "hermes" && o.assertions && !o.attributes && (o.attributes = o.assertions, delete o.assertions);
break;
}
}, onLeave(o) {
switch (o.type) {
case "LogicalExpression":
if (Rs(o)) return ve(o);
break;
}
} }), a2;
}
function Rs(a2) {
return a2.type === "LogicalExpression" && a2.right.type === "LogicalExpression" && a2.operator === a2.right.operator;
}
function ve(a2) {
return Rs(a2) ? ve({ type: "LogicalExpression", operator: a2.operator, left: ve({ type: "LogicalExpression", operator: a2.operator, left: a2.left, right: a2.right.left, range: [N(a2.left), k(a2.right.left)] }), right: a2.right.right, range: [N(a2), k(a2)] }) : a2;
}
function Kr(a2, e, t) {
if (!Ie(a2)) return;
let s = rt(a2);
if (t[s - 1] !== ";") return;
let i = Ns({ [Bt]: e, originalText: t });
s -= 1;
let r = i.slice(N(a2), s), n = r.trimEnd();
a2.__contentEnd = s - (r.length - n.length);
}
function Wr(a2, e) {
let t = new SyntaxError(a2 + " (" + e.loc.start.line + ":" + e.loc.start.column + ")");
return Object.assign(t, e);
}
function Jr(a2) {
let { message: e, loc: t, reasonCode: s } = a2;
if (!t) return a2;
let { line: i, column: r } = t, n = a2;
(s === "MissingPlugin" || s === "MissingOneOfPlugins") && (e = "Unexpected token.", n = void 0);
let o = ` (${i}:${r})`;
return e.endsWith(o) && (e = e.slice(0, -o.length)), e.startsWith(_s) && (e = e.slice(_s.length)), Ut(e, { loc: { start: { line: i, column: r + 1 } }, cause: n });
}
function qs(a2) {
let e = a2.match(Yr);
return e ? e[0].trimStart() : "";
}
function $s(a2) {
a2 = U(0, a2.replace(Xr, "").replace(Gr, ""), ta, "$1");
let t = "";
for (; t !== a2; ) t = a2, a2 = U(0, a2, Zr, `
$1 $2
`);
a2 = a2.replace(js, "").trimEnd();
let s = /* @__PURE__ */ Object.create(null), i = U(0, a2, Vs, "").replace(js, "").trimEnd(), r;
for (; r = Vs.exec(a2); ) {
let n = U(0, r[2], Qr, "");
if (typeof s[r[1]] == "string" || Array.isArray(s[r[1]])) {
let o = s[r[1]];
s[r[1]] = [...ea, ...Array.isArray(o) ? o : [o], n];
} else s[r[1]] = n;
}
return { comments: i, pragmas: s };
}
function Ks(a2) {
let e = Ft(a2);
e && (a2 = a2.slice(e.length + 1));
let t = qs(a2), { pragmas: s, comments: i } = $s(t);
return { shebang: e, text: a2, pragmas: s, comments: i };
}
function Ws(a2) {
let { pragmas: e } = Ks(a2);
return Hs.some((t) => lt(e, t));
}
function Js(a2) {
let { pragmas: e } = Ks(a2);
return zs.some((t) => lt(e, t));
}
function sa(a2) {
return a2 = typeof a2 == "function" ? { parse: a2 } : a2, { astFormat: "estree", hasPragma: Ws, hasIgnorePragma: Js, locStart: N, locEnd: k, ...a2 };
}
function Gs(a2) {
if (typeof a2 == "string") {
if (a2 = a2.toLowerCase(), /\.(?:mjs|mts)$/i.test(a2)) return jt;
if (/\.(?:cjs|cts)$/i.test(a2)) return Le;
}
}
function ia(a2) {
let { type: e = "JsExpressionRoot", expression: t, comments: s = t?.comments ?? [], text: i, rootMarker: r } = a2, n = { type: e, comments: s, range: [0, i.length], rootMarker: r };
return t && (delete t.comments, n.node = t), n;
}
function na(a2, e) {
if (e?.endsWith(".js.flow")) return true;
let t = Ft(a2);
t && (a2 = a2.slice(t.length));
let s = gs(a2, 0);
return s !== false && (a2 = a2.slice(0, s)), aa.test(a2);
}
function oa(a2, e, t) {
let s = a2(e, t), i = s.errors.find((r) => !la.has(r.reasonCode));
if (i) throw i;
return s;
}
function ha({ isExpression: a2 = false, optionsCombinations: e }) {
return (t, s = {}) => {
let { filepath: i } = s;
if (typeof i != "string" && (i = void 0), (s.parser === "babel" || s.parser === "__babel_estree") && na(t, i)) return s.parser = "babel-flow", Zs.parse(t, s);
let r = e, n = s.__babelSourceType ?? Gs(i);
n && n !== jt && (r = r.map((p) => ({ ...p, sourceType: n, ...n === Le ? { allowReturnOutsideFunction: void 0, allowNewTargetOutsideFunction: void 0 } : void 0 })));
let o = /%[A-Z]/.test(t);
t.includes("|>") ? r = (o ? [...Ys, Xs] : Ys).flatMap((f) => r.map((d) => j([f], d))) : o && (r = r.map((p) => j([Xs], p)));
let h = a2 ? Mt : Dt, c;
try {
c = Ts(r.map((p) => () => oa(h, t, p)));
} catch ({ errors: [p] }) {
throw _t(p);
}
return a2 && (c = Vt({ expression: c, text: t, rootMarker: s.rootMarker })), Us(c, { text: t });
};
}
function ya(a2) {
return Array.isArray(a2) && a2.length > 0;
}
function xa(a2) {
let e = Dt(a2, ti), { program: t } = e;
if (t.body.length === 0 && t.directives.length === 0 && !t.interpreter) return { comments: e.comments };
}
function bt(a2, e = {}) {
let { allowComments: t = true, allowEmpty: s = false } = e, i, r;
try {
i = Mt(a2, ti), r = i.comments;
} catch (n) {
if (s && n.code === "BABEL_PARSER_SYNTAX_ERROR" && n.reasonCode === "ParseExpressionEmptyInput") try {
({ comments: r } = xa(a2));
} catch {
}
if (!r) throw _t(n);
}
if (!t && Me(r)) throw H(r[0], "Comment");
return (!s || i) && ht(i), i = Vt({ type: "JsonRoot", expression: i, comments: r, text: a2 }), i;
}
function H(a2, e) {
let [t, s] = [a2.loc.start, a2.loc.end].map(({ line: i, column: r }) => ({ line: i, column: r + 1 }));
return Ut(`${e} is not allowed in JSON.`, { loc: { start: t, end: s } });
}
function ht(a2) {
switch (a2.type) {
case "ArrayExpression":
for (let e of a2.elements) e !== null && ht(e);
return;
case "ObjectExpression":
for (let e of a2.properties) ht(e);
return;
case "ObjectProperty":
if (a2.computed) throw H(a2.key, "Computed key");
if (a2.shorthand) throw H(a2.key, "Shorthand property");
a2.key.type !== "Identifier" && ht(a2.key), ht(a2.value);
return;
case "UnaryExpression": {
let { operator: e, argument: t } = a2;
if (e !== "+" && e !== "-") throw H(a2, `Operator '${a2.operator}'`);
if (t.type === "NumericLiteral" || t.type === "Identifier" && (t.name === "Infinity" || t.name === "NaN")) return;
throw H(t, `Operator '${e}' before '${t.type}'`);
}
case "Identifier":
if (a2.name !== "Infinity" && a2.name !== "NaN" && a2.name !== "undefined") throw H(a2, `Identifier '${a2.name}'`);
return;
case "TemplateLiteral":
if (Me(a2.expressions)) throw H(a2.expressions[0], "'TemplateLiteral' with expression");
for (let e of a2.quasis) ht(e);
return;
case "NullLiteral":
case "BooleanLiteral":
case "NumericLiteral":
case "StringLiteral":
case "TemplateElement":
return;
default:
throw H(a2, `'${a2.type}'`);
}
}
var si, qt, ei, De, X, ii, ri, U, ai, lt, L, st, Fe, ni, Be, wt, oi, hi, ci, li, pi, ui, l, yi, A, y, $t, pt, V, xi, kt, Pe, mt, ge, Te, be, Ae, Se, Ce, Pi, Q, w, Ze, Ni, ts, ki, vi, Li, we, Di, Mi, Oi, Ri, yt, xt, Yt, Qt, _i, ji, P, qi, zi, Hi, Ki, St, zt, Ht, Ji, _, Gi, Zt, te, ee, se, ie, Yi, qe, Ct, tr, ae, Et, ne, oe, he, it, vt, ce, le, pe, et, K, ze, ue, fe, de, me, Kt, rr, ar, Wt, ye, Jt, or, m, lr, dr, We, mr, yr, Je, Ge, us, Pr, Lt, Ba, Xe, Ua, fs, _a, ds, ms, ys, xs, Ps, gs, Ft, wr, Ir, bs, Bt, kr, As, vr, Lr, Dr, Ss, Mr, Cs, Or, Ie, at, Es, Fr, Is, Ur, ks, Ds, gt, qr, Ms, u, Os, zr, Fs, Bs, so, Us, Ut, _s, _t, Gr, Xr, Yr, Qr, js, Zr, Vs, ta, ea, zs, Hs, G, jt, Le, Vt, ot, ra, Xs, Ys, j, aa, ca, la, Qs, pa, ua, fa, da, Zs, ma, Oe, Me, ti, Pa, ga, Ta, ba, Aa;
var init_babel = __esm({
"../../node_modules/.pnpm/prettier@3.9.9/node_modules/prettier/plugins/babel.mjs"() {
init_esm_shims();
si = Object.defineProperty;
qt = (a2, e) => {
for (var t in e) si(a2, t, { get: e[t], enumerable: true });
};
ei = {};
qt(ei, { parsers: () => Aa });
De = {};
qt(De, { __babel_estree: () => ma, __js_expression: () => fa, __ts_expression: () => da, __vue_event_binding: () => pa, __vue_expression: () => fa, __vue_ts_event_binding: () => ua, __vue_ts_expression: () => da, babel: () => pa, "babel-flow": () => Zs, "babel-ts": () => ua });
X = (a2, e) => (t, s, ...i) => t | 1 && s == null ? void 0 : (e.call(s) ?? s[a2]).apply(s, i);
ii = String.prototype.replaceAll ?? function(a2, e) {
return a2.global ? this.replace(a2, e) : this.split(a2).join(e);
};
ri = X("replaceAll", function() {
if (typeof this == "string") return ii;
});
U = ri;
ai = Object.hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty);
lt = ai;
L = class {
constructor(e, t, s) {
this.line = void 0, this.column = void 0, s !== void 0 && (this.index = void 0), this.line = e, this.column = t, s !== void 0 && (this.index = s);
}
};
st = class {
start;
end;
filename;
identifierName;
constructor(e, t) {
this.start = e, this.end = t;
}
};
Fe = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
ni = { ImportMetaOutsideModule: { message: `import.meta may appear only with 'sourceType: "module"'`, code: Fe }, ImportOutsideModule: { message: `'import' and 'export' may appear only with 'sourceType: "module"'`, code: Fe } };
Be = { ArrayPattern: "array destructuring pattern", AssignmentExpression: "assignment expression", AssignmentPattern: "assignment expression", ArrowFunctionExpression: "arrow function expression", ConditionalExpression: "conditional expression", CatchClause: "catch clause", ForOfStatement: "for-of statement", ForInStatement: "for-in statement", ForStatement: "for-loop", FormalParameters: "function parameter list", Identifier: "identifier", ImportSpecifier: "import specifier", ImportDefaultSpecifier: "import default specifier", ImportNamespaceSpecifier: "import namespace specifier", ObjectPattern: "object destructuring pattern", ParenthesizedExpression: "parenthesized expression", RestElement: "rest element", UpdateExpression: { true: "prefix operation", false: "postfix operation" }, VariableDeclarator: "variable declaration", YieldExpression: "yield expression" };
wt = (a2) => a2.type === "UpdateExpression" ? Be.UpdateExpression[`${a2.prefix}`] : Be[a2.type];
oi = { AccessorIsGenerator: ({ kind: a2 }) => `A ${a2}ter cannot be a generator.`, ArgumentsInClass: "'arguments' is only allowed in functions and class methods.", AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.", AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.", AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.", AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.", AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.", AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.", BadGetterArity: "A 'get' accessor must not have any formal parameters.", BadSetterArity: "A 'set' accessor must have exactly one formal parameter.", BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.", ConstructorClassField: "Classes may not have a field named 'constructor'.", ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.", ConstructorIsAccessor: "Class constructor may not be an accessor.", ConstructorIsAsync: "Constructor can't be an async function.", ConstructorIsGenerator: "Constructor can't be a generator.", DeclarationMissingInitializer: ({ kind: a2 }) => `Missing initializer in ${a2} declaration.`, DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.", DecoratorsBeforeAfterExport: "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.", DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?", DecoratorSemicolon: "Decorators must not be followed by a semicolon.", DecoratorStaticBlock: "Decorators can't be used with a static block.", DeferImportRequiresNamespace: 'Only `import defer * as x from "./module"` is valid.', DeletePrivateField: "Deleting a private field is not allowed.", DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.", DuplicateConstructor: "Duplicate constructor in the same class.", DuplicateDefaultExport: "Only one default export allowed per module.", DuplicateExport: ({ exportName: a2 }) => `\`${a2}\` has already been exported. Exported identifiers must be unique.`, DuplicateProto: "Redefinition of __proto__ property.", DuplicateRegExpFlags: "Duplicate regular expression flag.", ElementAfterRest: "Rest element must be last element.", EscapedCharNotAnIdentifier: "Invalid Unicode escape.", ExportBindingIsString: ({ localName: a2, exportName: e }) => `A string literal cannot be used as an exported binding without \`from\`.
- Did you mean \`export { '${a2}' as '${e}' } from 'some-module'\`?`, ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.", ForInOfLoopInitializer: ({ type: a2 }) => `'${a2 === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`, ForInUsing: "For-in loop may not start with 'using' declaration.", ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.", ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.", GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.", IllegalBreakContinue: ({ type: a2 }) => `Unsyntactic ${a2 === "BreakStatement" ? "break" : "continue"}.`, IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.", IllegalReturn: "'return' outside of function.", ImportBindingIsString: ({ importName: a2 }) => `A string literal cannot be used as an imported binding.
- Did you mean \`import { "${a2}" as foo }\`?`, ImportCallArity: ({ phase: a2 }) => `\`import${a2 ? `.${a2}` : ""}()\` requires exactly one or two arguments.`, ImportCallNotNewExpression: ({ phase: a2 }) => `Cannot use new with import${a2 ? `.${a2}` : ""}().`, ImportCallSpreadArgument: ({ phase: a2 }) => `\`...\` is not allowed in \`import${a2 ? `.${a2}` : ""}()\`.`, IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.", InvalidBigIntLiteral: "Invalid BigIntLiteral.", InvalidCodePoint: "Code point out of bounds.", InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.", InvalidCoverInitializedName: "Invalid shorthand property initializer.", InvalidDigit: ({ radix: a2 }) => `Expected number in radix ${a2}.`, InvalidEscapeSequence: "Bad character escape sequence.", InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.", InvalidEscapedReservedWord: ({ reservedWord: a2 }) => `Escape sequence in keyword ${a2}.`, InvalidIdentifier: ({ identifierName: a2 }) => `Invalid identifier ${a2}.`, InvalidLhs: ({ ancestor: a2 }) => `Invalid left-hand side in ${wt(a2)}.`, InvalidLhsBinding: ({ ancestor: a2 }) => `Binding invalid left-hand side in ${wt(a2)}.`, InvalidLhsOptionalChaining: ({ ancestor: a2 }) => `Invalid optional chaining in the left-hand side of ${wt(a2)}.`, InvalidNumber: "Invalid number.", InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.", InvalidOrUnexpectedToken: ({ unexpected: a2 }) => `Unexpected character '${a2}'.`, InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.", InvalidPrivateFieldResolution: ({ identifierName: a2 }) => `Private name #${a2} is not defined.`, InvalidPropertyBindingPattern: "Binding member expression.", InvalidRestAssignmentPattern: "Invalid rest operator's argument.", LabelRedeclaration: ({ labelName: a2 }) => `Label '${a2}' is already declared.`, LetInLexicalBinding: "'let' is disallowed as a lexically bound name.", LineTerminatorBeforeArrow: "No line break is allowed before '=>'.", MalformedRegExpFlags: "Invalid regular expression flag.", MissingClassName: "A class name is required.", MissingEqInAssignment: "Only '=' operator can be used for specifying default value.", MissingSemicolon: "Missing semicolon.", MissingPlugin: ({ missingPlugin: a2 }) => `This experimental syntax requires enabling the parser plugin: ${a2.map((e) => JSON.stringify(e)).join(", ")}.`, MissingOneOfPlugins: ({ missingPlugin: a2 }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${a2.map((e) => JSON.stringify(e)).join(", ")}.`, MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.", MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.", ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.", ModuleAttributesWithDuplicateKeys: ({ key: a2 }) => `Duplicate key "${a2}" is not allowed in module attributes.`, ModuleExportNameHasLoneSurrogate: ({ surrogateCharCode: a2 }) => `An export name cannot include a lone surrogate, found '\\u${a2.toString(16)}'.`, ModuleExportUndefined: ({ localName: a2 }) => `Export '${a2}' is not defined.`, MultipleDefaultsInSwitch: "Multiple default clauses.", NewlineAfterThrow: "Illegal newline after throw.", NoCatchOrFinally: "Missing catch or finally clause.", NumberIdentifier: "Identifier directly after number.", NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.", ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.", OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.", OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.", OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.", ParamDupe: "Argument name clash.", PatternHasAccessor: "Object pattern can't contain getter or setter.", PatternHasMethod: "Object pattern can't contain methods.", PrivateInExpectedIn: ({ identifierName: a2 }) => `Private names are only allowed in property accesses (\`obj.#${a2}\`) or in \`in\` expressions (\`#${a2} in obj\`).`, PrivateNameRedeclaration: ({ identifierName: a2 }) => `Duplicate private name #${a2}.`, RestTrailingComma: "Unexpected trailing comma after rest element.", SloppyFunction: "In non-strict mode code, functions can only be declared at top level or inside a block.", SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.", SourcePhaseImportRequiresDefault: 'Only `import source x from "./module"` is valid.', StaticPrototype: "Classes may not have static property named prototype.", SuperCallNotNewExpression: "Cannot use new with super(...).", SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?", SuperPrivateField: "Private fields can't be accessed on super.", TrailingDecorator: "Decorators must be attached to a class element.", UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.", UnexpectedDigitAfterHash: "Unexpected digit after hash token.", UnexpectedImportExport: "'import' and 'export' may only appear at the top level.", UnexpectedKeyword: ({ keyword: a2 }) => `Unexpected keyword '${a2}'.`, UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.", UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.", UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.", UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.", UnexpectedPrivateField: "Unexpected private name.", UnexpectedReservedWord: ({ reservedWord: a2 }) => `Unexpected reserved word '${a2}'.`, UnexpectedSuper: "'super' is only allowed in object methods and classes.", UnexpectedToken: ({ expected: a2, unexpected: e }) => `Unexpected token${e ? ` '${e}'.` : ""}${a2 ? `, expected "${a2}"` : ""}`, UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.", UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.", UnexpectedVoidPattern: "Unexpected void binding.", UnsupportedDecoratorExport: "A decorated export must export a class declaration.", UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.", UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.", UnsupportedMetaProperty: ({ target: a2, onlyValidPropertyName: e }) => `The only valid meta property for ${a2} is ${a2}.${e}.`, UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.", UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.", UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).", UnterminatedComment: "Unterminated comment.", UnterminatedRegExp: "Unterminated regular expression.", UnterminatedString: "Unterminated string constant.", UnterminatedTemplate: "Unterminated template.", UsingDeclarationExport: "Using declaration cannot be exported.", UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.", VarRedeclaration: ({ identifierName: a2 }) => `Identifier '${a2}' has already been declared.`, VoidPatternCatchClauseParam: "A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.", VoidPatternInitializer: "A void binding may not have an initializer.", YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.", YieldInParameter: "Yield expression is not allowed in formal parameters.", YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.", ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0." };
hi = { StrictDelete: "Deleting local variable in strict mode.", StrictEvalArguments: ({ referenceName: a2 }) => `Assigning to '${a2}' in strict mode.`, StrictEvalArgumentsBinding: ({ bindingName: a2 }) => `Binding '${a2}' in strict mode.`, StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.", StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.", StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.", StrictWith: "'with' in strict mode." };
ci = { ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.", ParseExpressionExpectsEOF: ({ unexpected: a2 }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(a2)}\`.` };
li = /* @__PURE__ */ new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
pi = { PipeTopicRequiresHackPipes: 'Topic references are only supported when using the `"proposal": "hack"` version of the pipeline proposal.', PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.", PipeTopicUnconfiguredToken: ({ token: a2 }) => `Invalid topic token ${a2}. In order to use ${a2} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${a2}" }.`, PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.", PipeUnparenthesizedBody: ({ type: a2 }) => `Hack-style pipe body cannot be an unparenthesized ${wt({ type: a2 })}; please wrap it in parentheses.`, PipelineUnparenthesized: "Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses." };
ui = { UnsupportedBind: "Binding should be performed on object property.", UnsupportedBindRHS: "The right-hand side of binding can not be super or import." };
l = { ...F(ni), ...F(oi), ...F(hi), ...F(ci), ...F`pipelineOperator`(pi), ...F`functionBind`(ui) };
yi = (a2) => class extends a2 {
createPosition(t) {
return new L(t.line, t.column);
}
parse() {
let t = super.parse();
return this.optionFlags & 512 && (t.tokens = t.tokens.map(Y)), Y(t);
}
parseRegExpLiteral({ pattern: t, flags: s }) {
let i = null;
try {
i = new RegExp(t, s);
} catch {
}
let r = this.estreeParseLiteral(i);
return r.regex = { pattern: t, flags: s }, r;
}
parseBigIntLiteral(t) {
let s;
try {
s = BigInt(t);
} catch {
s = null;
}
let i = this.estreeParseLiteral(s);
return i.bigint = String(i.value || t), i;
}
estreeParseLiteral(t) {
return this.parseLiteral(t, "Literal");
}
parseStringLiteral(t) {
return this.estreeParseLiteral(t);
}
parseNumericLiteral(t) {
return this.estreeParseLiteral(t);
}
parseNullLiteral() {
return this.estreeParseLiteral(null);
}
parseBooleanLiteral(t) {
return this.estreeParseLiteral(t);
}
estreeParseChainExpression(t, s) {
let i = this.startNodeAtNode(t);
return i.expression = t, this.finishNodeAtNode(i, "ChainExpression", s);
}
directiveToStmt(t) {
let s = t.value;
delete t.value, this.castNodeTo(s, "Literal"), s.raw = s.extra.raw, s.value = s.extra.expressionValue;
let i = this.castNodeTo(t, "ExpressionStatement");
return i.expression = s, i.directive = s.extra.rawValue, delete s.extra, i;
}
fillOptionalPropertiesForTSESLint(t) {
}
cloneEstreeStringLiteral(t) {
let { start: s, end: i, loc: r, range: n, raw: o, value: h } = t, c = Object.create(t.constructor.prototype);
return c.type = "Literal", c.start = s, c.end = i, c.loc = r, c.range = n, c.raw = o, c.value = h, c;
}
initFunction(t, s) {
super.initFunction(t, s), t.expression = false;
}
checkDeclaration(t) {
t != null && this.isObjectProperty(t) ? this.checkDeclaration(t.value) : super.checkDeclaration(t);
}
getObjectOrClassMethodParams(t) {
return t.value.params;
}
isValidDirective(t) {
return t.type === "ExpressionStatement" && t.expression.type === "Literal" && typeof t.expression.value == "string" && !t.expression.extra?.parenthesized;
}
parseBlockBody(t, s, i, r, n) {
super.parseBlockBody(t, s, i, r, n);
let o = t.directives.map((h) => this.directiveToStmt(h));
t.body = o.concat(t.body), delete t.directives;
}
parsePrivateName() {
let t = super.parsePrivateName();
return this.convertPrivateNameToPrivateIdentifier(t);
}
convertPrivateNameToPrivateIdentifier(t) {
let s = super.getPrivateNameSV(t);
return delete t.id, t.name = s, this.castNodeTo(t, "PrivateIdentifier");
}
isPrivateName(t) {
return t.type === "PrivateIdentifier";
}
getPrivateNameSV(t) {
return t.name;
}
parseLiteral(t, s) {
let i = super.parseLiteral(t, s);
return i.raw = i.extra.raw, delete i.extra, i;
}
parseFunctionBody(t, s, i = false) {
super.parseFunctionBody(t, s, i), t.expression = t.body.type !== "BlockStatement";
}
parseMethod(t, s, i, r, n, o, h = false) {
let c = this.startNode();
c.kind = t.kind, c = super.parseMethod(c, s, i, r, n, o, h), delete c.kind;
let { typeParameters: p } = t;
p && (delete t.typeParameters, c.typeParameters = p, this.resetStartLocationFromNode(c, p));
let f = this.castNodeTo(c, this.hasPlugin("typescript") && !c.body ? "TSEmptyBodyFunctionExpression" : "FunctionExpression");
return t.value = f, o === "ClassPrivateMethod" && (t.computed = false), this.hasPlugin("typescript") && t.abstract ? (delete t.abstract, this.finishNode(t, "TSAbstractMethodDefinition")) : o === "ObjectMethod" ? (t.kind === "method" && (t.kind = "init"), t.shorthand = false, this.finishNode(t, "Property")) : this.finishNode(t, "MethodDefinition");
}
nameIsConstructor(t) {
return t.type === "Literal" ? t.value === "constructor" : super.nameIsConstructor(t);
}
parseClassProperty(...t) {
let s = super.parseClassProperty(...t);
return s.abstract && this.hasPlugin("typescript") ? (delete s.abstract, this.castNodeTo(s, "TSAbstractPropertyDefinition")) : this.castNodeTo(s, "PropertyDefinition"), s;
}
parseClassPrivateProperty(...t) {
let s = super.parseClassPrivateProperty(...t);
return s.abstract && this.hasPlugin("typescript") ? this.castNodeTo(s, "TSAbstractPropertyDefinition") : this.castNodeTo(s, "PropertyDefinition"), s.computed = false, s;
}
parseClassAccessorProperty(t) {
let s = super.parseClassAccessorProperty(t);
return s.abstract && this.hasPlugin("typescript") ? (delete s.abstract, this.castNodeTo(s, "TSAbstractAccessorProperty")) : this.castNodeTo(s, "AccessorProperty"), s;
}
parseObjectProperty(t, s, i, r) {
let n = super.parseObjectProperty(t, s, i, r);
return n && (n.kind = "init", this.castNodeTo(n, "Property")), n;
}
finishObjectProperty(t) {
return t.kind = "init", this.finishNode(t, "Property");
}
isValidLVal(t, s, i, r) {
return t === "Property" ? "value" : super.isValidLVal(t, s, i, r);
}
isAssignable(t, s) {
return t != null && this.isObjectProperty(t) ? this.isAssignable(t.value, s) : super.isAssignable(t, s);
}
toAssignable(t, s = false) {
if (t != null && this.isObjectProperty(t)) {
let { key: i, value: r } = t;
this.isPrivateName(i) && this.classScope.usePrivateName(this.getPrivateNameSV(i), i.start), this.toAssignable(r, s);
} else super.toAssignable(t, s);
}
toAssignableObjectExpressionProp(t, s, i) {
t.type === "Property" && (t.kind === "get" || t.kind === "set") ? this.raise(l.PatternHasAccessor, t.key) : t.type === "Property" && t.method ? this.raise(l.PatternHasMethod, t.key) : super.toAssignableObjectExpressionProp(t, s, i);
}
finishCallExpression(t, s) {
let i = super.finishCallExpression(t, s);
return i.callee.type === "Import" ? (this.castNodeTo(i, "ImportExpression"), i.source = i.arguments[0], i.options = i.arguments[1] ?? null, delete i.arguments, delete i.callee) : i.type === "OptionalCallExpression" ? this.castNodeTo(i, "CallExpression") : i.optional = false, i;
}
parseExport(t, s) {
let i = this.state.lastTokStartLoc, r = super.parseExport(t, s);
switch (r.type) {
case "ExportAllDeclaration":
r.exported = null;
break;
case "ExportNamedDeclaration":
r.specifiers.length === 1 && r.specifiers[0].type === "ExportNamespaceSpecifier" && (this.castNodeTo(r, "ExportAllDeclaration"), r.exported = r.specifiers[0].exported, delete r.specifiers);
case "ExportDefaultDeclaration":
{
let { declaration: n } = r;
n?.type === "ClassDeclaration" && n.decorators?.length > 0 && n.start === r.start && this.resetStartLocation(r, i);
}
break;
}
return r;
}
stopParseSubscript(t, s) {
let i = super.stopParseSubscript(t, s);
return s.optionalChainMember ? this.estreeParseChainExpression(i, t) : i;
}
parseMember(t, s, i, r, n) {
let o = super.parseMember(t, s, i, r, n);
return o.type === "OptionalMemberExpression" ? this.castNodeTo(o, "MemberExpression") : o.optional = false, o;
}
isOptionalMemberExpression(t) {
return t.type === "ChainExpression" ? t.expression.type === "MemberExpression" : super.isOptionalMemberExpression(t);
}
hasPropertyAsPrivateName(t) {
return t.type === "ChainExpression" && (t = t.expression), super.hasPropertyAsPrivateName(t);
}
isObjectProperty(t) {
return t.type === "Property" && t.kind === "init" && !t.method;
}
isObjectMethod(t) {
return t.type === "Property" && (t.method || t.kind === "get" || t.kind === "set");
}
castNodeTo(t, s) {
let i = super.castNodeTo(t, s);
return this.fillOptionalPropertiesForTSESLint(i), i;
}
cloneIdentifier(t) {
let s = super.cloneIdentifier(t);
return this.fillOptionalPropertiesForTSESLint(s), s;
}
cloneStringLiteral(t) {
return t.type === "Literal" ? this.cloneEstreeStringLiteral(t) : super.cloneStringLiteral(t);
}
finishNodeAt(t, s, i) {
return Y(super.finishNodeAt(t, s, i));
}
finishNodeAtNode(t, s, i) {
return Y(super.finishNodeAtNode(t, s, i));
}
finishNode(t, s) {
let i = super.finishNode(t, s);
return this.fillOptionalPropertiesForTSESLint(i), i;
}
resetStartLocation(t, s) {
super.resetStartLocation(t, s), Y(t);
}
resetEndLocation(t, s = this.state.lastTokEndLoc) {
super.resetEndLocation(t, s), Y(t);
}
};
A = true;
y = true;
$t = true;
pt = true;
V = true;
xi = true;
kt = class {
label;
keyword;
beforeExpr;
startsExpr;
rightAssociative;
isLoop;
isAssign;
prefix;
postfix;
binop;
constructor(e, t = {}) {
this.label = e, this.keyword = t.keyword, this.beforeExpr = !!t.beforeExpr, this.startsExpr = !!t.startsExpr, this.rightAssociative = !!t.rightAssociative, this.isLoop = !!t.isLoop, this.isAssign = !!t.isAssign, this.prefix = !!t.prefix, this.postfix = !!t.postfix, this.binop = t.binop != null ? t.binop : null;
}
};
Pe = /* @__PURE__ */ new Map();
mt = -1;
ge = [];
Te = [];
be = [];
Ae = [];
Se = [];
Ce = [];
Pi = { bracketL: g("[", { beforeExpr: A, startsExpr: y }), bracketR: g("]"), braceL: g("{", { beforeExpr: A, startsExpr: y }), braceBarL: g("{|", { beforeExpr: A, startsExpr: y }), braceR: g("}"), braceBarR: g("|}"), parenL: g("(", { beforeExpr: A, startsExpr: y }), parenR: g(")"), comma: g(",", { beforeExpr: A }), semi: g(";", { beforeExpr: A }), colon: g(":", { beforeExpr: A }), doubleColon: g("::", { beforeExpr: A }), dot: g("."), question: g("?", { beforeExpr: A }), questionDot: g("?."), arrow: g("=>", { beforeExpr: A }), template: g("template"), ellipsis: g("...", { beforeExpr: A }), backQuote: g("`", { startsExpr: y }), dollarBraceL: g("${", { beforeExpr: A, startsExpr: y }), templateTail: g("...`", { startsExpr: y }), templateNonTail: g("...${", { beforeExpr: A, startsExpr: y }), at: g("@"), hash: g("#", { startsExpr: y }), interpreterDirective: g("#!..."), eq: g("=", { beforeExpr: A, isAssign: pt }), assign: g("_=", { beforeExpr: A, isAssign: pt }), slashAssign: g("_=", { beforeExpr: A, isAssign: pt }), xorAssign: g("_=", { beforeExpr: A, isAssign: pt }), moduloAssign: g("_=", { beforeExpr: A, isAssign: pt }), incDec: g("++/--", { prefix: V, postfix: xi, startsExpr: y }), bang: g("!", { beforeExpr: A, prefix: V, startsExpr: y }), tilde: g("~", { beforeExpr: A, prefix: V, startsExpr: y }), doubleCaret: g("^^", { startsExpr: y }), doubleAt: g("@@", { startsExpr: y }), pipeline: M("|>", 0), nullishCoalescing: M("??", 1), logicalOR: M("||", 1), logicalAND: M("&&", 2), bitwiseOR: M("|", 3), bitwiseXOR: M("^", 4), bitwiseAND: M("&", 5), equality: M("==/!=/===/!==", 6), lt: M("</>/<=/>=", 7), gt: M("</>/<=/>=", 7), relational: M("</>/<=/>=", 7), bitShift: M("<</>>/>>>", 8), bitShiftL: M("<</>>/>>>", 8), bitShiftR: M("<</>>/>>>", 8), plusMin: g("+/-", { beforeExpr: A, binop: 9, prefix: V, startsExpr: y }), modulo: g("%", { binop: 10, startsExpr: y }), star: g("*", { binop: 10 }), slash: M("/", 10), exponent: g("**", { beforeExpr: A, binop: 11, rightAssociative: true }), _in: S("in", { beforeExpr: A, binop: 7 }), _instanceof: S("instanceof", { beforeExpr: A, binop: 7 }), _break: S("break"), _case: S("case", { beforeExpr: A }), _catch: S("catch"), _continue: S("continue"), _debugger: S("debugger"), _default: S("default", { beforeExpr: A }), _else: S("else", { beforeExpr: A }), _finally: S("finally"), _function: S("function", { startsExpr: y }), _if: S("if"), _return: S("return", { beforeExpr: A }), _switch: S("switch"), _throw: S("throw", { beforeExpr: A, prefix: V, startsExpr: y }), _try: S("try"), _var: S("var"), _const: S("const"), _with: S("with"), _new: S("new", { beforeExpr: A, startsExpr: y }), _this: S("this", { startsExpr: y }), _super: S("super", { startsExpr: y }), _class: S("class", { startsExpr: y }), _extends: S("extends", { beforeExpr: A }), _export: S("export"), _import: S("import", { startsExpr: y }), _null: S("null", { startsExpr: y }), _true: S("true", { startsExpr: y }), _false: S("false", { startsExpr: y }), _typeof: S("typeof", { beforeExpr: A, prefix: V, startsExpr: y }), _void: S("void", { beforeExpr: A, prefix: V, startsExpr: y }), _delete: S("delete", { beforeExpr: A, prefix: V, startsExpr: y }), _do: S("do", { isLoop: $t, beforeExpr: A }), _for: S("for", { isLoop: $t }), _while: S("while", { isLoop: $t }), _as: b("as", { startsExpr: y }), _assert: b("assert", { startsExpr: y }), _async: b("async", { startsExpr: y }), _await: b("await", { startsExpr: y }), _defer: b("defer", { startsExpr: y }), _from: b("from", { startsExpr: y }), _get: b("get", { startsExpr: y }), _let: b("let", { startsExpr: y }), _meta: b("meta", { startsExpr: y }), _of: b("of", { startsExpr: y }), _sent: b("sent", { startsExpr: y }), _set: b("set", { startsExpr: y }), _source: b("source", { startsExpr: y }), _static: b("static", { startsExpr: y }), _using: b("using", { startsExpr: y }), _yield: b("yield", { startsExpr: y }), _asserts: b("asserts", { startsExpr: y }), _checks: b("checks", { startsExpr: y }), _exports: b("exports", { startsExpr: y }), _global: b("global", { startsExpr: y }), _implements: b("implements", { startsExpr: y }), _intrinsic: b("intrinsic", { startsExpr: y }), _infer: b("infer", { startsExpr: y }), _is: b("is", { startsExpr: y }), _mixins: b("mixins", { startsExpr: y }), _proto: b("proto", { startsExpr: y }), _require: b("require", { startsExpr: y }), _satisfies: b("satisfies", { startsExpr: y }), _keyof: b("keyof", { startsExpr: y }), _readonly: b("readonly", { startsExpr: y }), _unique: b("unique", { startsExpr: y }), _abstract: b("abstract", { startsExpr: y }), _declare: b("declare", { startsExpr: y }), _enum: b("enum", { startsExpr: y }), _module: b("module", { startsExpr: y }), _namespace: b("namespace", { startsExpr: y }), _interface: b("interface", { startsExpr: y }), _type: b("type", { startsExpr: y }), _opaque: b("opaque", { startsExpr: y }), name: g("name", { startsExpr: y }), placeholder: g("%%", { startsExpr: y }), string: g("string", { startsExpr: y }), num: g("num", { startsExpr: y }), bigint: g("bigint", { startsExpr: y }), regexp: g("regexp", { startsExpr: y }), privateName: g("#name", { startsExpr: y }), eof: g("eof"), jsxName: g("jsxName"), jsxText: g("jsxText", { beforeExpr: A }), jsxTagStart: g("jsxTagStart", { startsExpr: y }), jsxTagEnd: g("jsxTagEnd") };
Q = class {
constructor(e, t) {
this.token = e, this.preserveSpace = !!t;
}
token;
preserveSpace;
};
w = { brace: new Q("{"), j_oTag: new Q("<tag"), j_cTag: new Q("</tag"), j_expr: new Q("<tag>...</tag>", true) };
Ze = "\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05d0-\\u05ea\\u05ef-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086a\\u0870-\\u0887\\u0889-\\u088f\\u08a0-\\u08c9\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u09fc\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c5c\\u0c5d\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cdc-\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d04-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e86-\\u0e8a\\u0e8c-\\u0ea3\\u0ea5\\u0ea7-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u1711\\u171f-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1878\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4c\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c8a\\u1c90-\\u1cba\\u1cbd-\\u1cbf\\u1ce9-\\u1cec\\u1cee-\\u1cf3\\u1cf5\\u1cf6\\u1cfa\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u31a0-\\u31bf\\u31f0-\\u31ff\\u3400-\\u4dbf\\u4e00-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7dc\\ua7f1-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua8fe\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab69\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc";
Ni = "\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u07fd\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u0897-\\u089f\\u08ca-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u09fe\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0afa-\\u0aff\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b55-\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c04\\u0c3c\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0cf3\\u0d00-\\u0d03\\u0d3b\\u0d3c\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d81-\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0ebc\\u0ec8-\\u0ece\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u180f-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1abf-\\u1add\\u1ae0-\\u1aeb\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf4\\u1cf7-\\u1cf9\\u1dc0-\\u1dff\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\u30fb\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua82c\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua8ff-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\\uff65";
ts = [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, 4, 51, 13, 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, 7, 25, 39, 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, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 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, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 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, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 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, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 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, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
ki = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 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, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 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, 199, 7, 137, 9, 54, 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, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 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, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
vi = new RegExp("[" + Ze + "]");
Li = new RegExp("[" + Ze + Ni + "]");
we = { keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], strictBind: ["eval", "arguments"] };
Di = new Set(we.keyword);
Mi = new Set(we.strict);
Oi = new Set(we.strictBind);
Ri = /* @__PURE__ */ new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
yt = class {
flags = 0;
names = /* @__PURE__ */ new Map();
firstLexicalName = "";
constructor(e) {
this.flags = e;
}
};
xt = class {
parser;
scopeStack = [];
inModule;
undefinedExports = /* @__PURE__ */ new Map();
constructor(e, t) {
this.parser = e, this.inModule = t;
}
get inTopLevel() {
return (this.currentScope().flags & 1) > 0;
}
get inFunction() {
return (this.currentVarScopeFlags() & 2) > 0;
}
get allowSuper() {
return (this.currentThisScopeFlags() & 16) > 0;
}
get allowDirectSuper() {
return (this.currentThisScopeFlags() & 32) > 0;
}
get allowNewTarget() {
return (this.currentThisScopeFlags() & 512) > 0;
}
get inClass() {
return (this.currentThisScopeFlags() & 64) > 0;
}
get inClassAndNotInNonArrowFunction() {
let e = this.currentThisScopeFlags();
return (e & 64) > 0 && (e & 2) === 0;
}
get inStaticBlock() {
for (let e = this.scopeStack.length - 1; ; e--) {
let { flags: t } = this.scopeStack[e];
if (t & 128) return true;
if (t & 3779) return false;
}
}
get inNonArrowFunction() {
return (this.currentThisScopeFlags() & 2) > 0;
}
get inBareCaseStatement() {
return (this.currentScope().flags & 256) > 0;
}
get treatFunctionsAsVar() {
return this.treatFunctionsAsVarInScope(this.currentScope());
}
createScope(e) {
return new yt(e);
}
enter(e) {
this.scopeStack.push(this.createScope(e));
}
exit() {
return this.scopeStack.pop().flags;
}
treatFunctionsAsVarInScope(e) {
return !!(e.flags & 130 || !this.parser.inModule && e.flags & 1);
}
declareName(e, t, s) {
let i = this.currentScope();
if (t & 8 || t & 16) {
this.checkRedeclarationInScope(i, e, t, s);
let r = i.names.get(e) || 0;
t & 16 ? r = r | 4 : (i.firstLexicalName || (i.firstLexicalName = e), r = r | 2), i.names.set(e, r), t & 8 && this.maybeExportDefined(i, e);
} else if (t & 4) for (let r = this.scopeStack.length - 1; r >= 0 && (i = this.scopeStack[r], this.checkRedeclarationInScope(i, e, t, s), i.names.set(e, (i.names.get(e) || 0) | 1), this.maybeExportDefined(i, e), !(i.flags & 3715)); --r) ;
this.parser.inModule && i.flags & 1 && this.undefinedExports.delete(e);
}
maybeExportDefined(e, t) {
this.parser.inModule && e.flags & 1 && this.undefinedExports.delete(t);
}
checkRedeclarationInScope(e, t, s, i) {
this.isRedeclaredInScope(e, t, s) && this.parser.raise(l.VarRedeclaration, i, { identifierName: t });
}
isRedeclaredInScope(e, t, s) {
if (!(s & 1)) return false;
if (s & 8) return e.names.has(t);
let i = e.names.get(t) || 0;
return s & 16 ? (i & 2) > 0 || !this.treatFunctionsAsVarInScope(e) && (i & 1) > 0 : (i & 2) > 0 && !(e.flags & 8 && e.firstLexicalName === t) || !this.treatFunctionsAsVarInScope(e) && (i & 4) > 0;
}
checkLocalExport(e) {
let { name: t } = e;
this.scopeStack[0].names.has(t) || this.undefinedExports.set(t, e.start);
}
currentScope() {
return this.scopeStack[this.scopeStack.length - 1];
}
currentVarScopeFlags() {
for (let e = this.scopeStack.length - 1; ; e--) {
let { flags: t } = this.scopeStack[e];
if (t & 3715) return t;
}
}
currentThisScopeFlags() {
for (let e = this.scopeStack.length - 1; ; e--) {
let { flags: t } = this.scopeStack[e];
if (t & 3779 && !(t & 4)) return t;
}
}
};
Yt = class extends yt {
declareFunctions = /* @__PURE__ */ new Set();
};
Qt = class extends xt {
createScope(e) {
return new Yt(e);
}
declareName(e, t, s) {
let i = this.currentScope();
if (t & 2048) {
this.checkRedeclarationInScope(i, e, t, s), this.maybeExportDefined(i, e), i.declareFunctions.add(e);
return;
}
super.declareName(e, t, s);
}
isRedeclaredInScope(e, t, s) {
if (super.isRedeclaredInScope(e, t, s)) return true;
if (s & 2048 && !e.declareFunctions.has(t)) {
let i = e.names.get(t);
return (i & 4) > 0 || (i & 2) > 0;
}
return false;
}
checkLocalExport(e) {
this.scopeStack[0].declareFunctions.has(e.name) || super.checkLocalExport(e);
}
};
_i = /* @__PURE__ */ new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
ji = { AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.", AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.", AssignReservedType: ({ reservedType: a2 }) => `Cannot overwrite reserved type ${a2}.`, DeclareClassElement: "The `declare` modifier can only appear on class fields.", DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.", DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.", EnumBooleanMemberNotInitialized: ({ memberName: a2, enumName: e }) => `Boolean enum members need to be initialized. Use either \`${a2} = true,\` or \`${a2} = false,\` in enum \`${e}\`.`, EnumDuplicateMemberName: ({ memberName: a2, enumName: e }) => `Enum member names need to be unique, but the name \`${a2}\` has already been used before in enum \`${e}\`.`, EnumInconsistentMemberValues: ({ enumName: a2 }) => `Enum \`${a2}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`, EnumInvalidExplicitType: ({ invalidEnumType: a2, enumName: e }) => `Enum type \`${a2}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`, EnumInvalidExplicitTypeUnknownSupplied: ({ enumName: a2 }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${a2}\`.`, EnumInvalidMemberInitializerPrimaryType: ({ enumName: a2, memberName: e, explicitType: t }) => `Enum \`${a2}\` has type \`${t}\`, so the initializer of \`${e}\` needs to be a ${t} literal.`, EnumInvalidMemberInitializerSymbolType: ({ enumName: a2, memberName: e }) => `Symbol enum members cannot be initialized. Use \`${e},\` in enum \`${a2}\`.`, EnumInvalidMemberInitializerUnknownType: ({ enumName: a2, memberName: e }) => `The enum member initializer for \`${e}\` needs to be a literal (either a boolean, number, or string) in enum \`${a2}\`.`, EnumInvalidMemberName: ({ enumName: a2, memberName: e, suggestion: t }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${e}\`, consider using \`${t}\`, in enum \`${a2}\`.`, EnumNumberMemberNotInitialized: ({ enumName: a2, memberName: e }) => `Number enum members need to be initialized, e.g. \`${e} = 1\` in enum \`${a2}\`.`, EnumStringMemberInconsistentlyInitialized: ({ enumName: a2 }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${a2}\`.`, GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.", ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.", InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.", InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.", InexactVariance: "Explicit inexact syntax cannot have variance.", InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.", MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.", NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.", NestedFlowComment: "Cannot have a flow comment inside another flow comment.", PatternIsOptional: { message: "A binding pattern parameter cannot be optional in an implementation signature." }, SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.", SpreadVariance: "Spread properties cannot have variance.", ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.", ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.", ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.", ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.", ThisParamNoDefault: "The `this` parameter may not have a default value.", TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.", TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.", UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.", UnexpectedReservedType: ({ reservedType: a2 }) => `Unexpected reserved type ${a2}.`, UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.", UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.", UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.", UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint".', UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.", UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.", UnsupportedDeclareExportKind: ({ unsupportedExportKind: a2, suggestion: e }) => `\`declare export ${a2}\` is not supported. Use \`${e}\` instead.`, UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.", UnterminatedFlowComment: "Unterminated flow-comment." };
P = F`flow`(ji);
qi = { const: "declare export var", let: "declare export var", type: "export type", interface: "export interface" };
zi = /\*?\s*@((?:no)?flow)\b/;
Hi = (a2) => class extends a2 {
flowPragma = void 0;
getScopeHandler() {
return Qt;
}
shouldParseTypes() {
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
}
finishToken(t, s) {
t !== 130 && t !== 9 && t !== 24 && this.flowPragma === void 0 && (this.flowPragma = null), super.finishToken(t, s);
}
addComment(t) {
if (this.flowPragma === void 0) {
let s = zi.exec(t.value);
if (s) if (s[1] === "flow") this.flowPragma = "flow";
else if (s[1] === "noflow") this.flowPragma = "noflow";
else throw new Error("Unexpected flow pragma");
}
super.addComment(t);
}
flowParseTypeInitialiser(t) {
let s = this.state.inType;
this.state.inType = true, this.expect(t || 10);
let i = this.flowParseType();
return this.state.inType = s, i;
}
flowParsePredicate() {
let t = this.startNode(), s = this.state.startLoc;
return this.next(), this.expectContextual(106), this.state.lastTokStartLoc.index > s.index + 1 && this.raise(P.UnexpectedSpaceBetweenModuloChecks, s), this.eat(6) ? (t.value = super.parseExpression(), this.expect(7), this.finishNode(t, "DeclaredPredicate")) : this.finishNode(t, "InferredPredicate");
}
flowParseTypeAndPredicateInitialiser(t) {
let s = this.state.inType;
this.state.inType = true, this.expect(10);
let i = null, r = null;
return t && this.match(50) ? (this.state.inType = s, r = this.flowParsePredicate()) : (i = this.flowParseType(), this.state.inType = s, this.match(50) && (r = this.flowParsePredicate())), [i, r];
}
flowParseDeclareClass(t) {
return this.next(), this.flowParseInterfaceish(t, true), this.finishNode(t, "DeclareClass");
}
flowParseDeclareFunction(t) {
this.next();
let s = t.id = this.parseIdentifier(), i = this.startNode(), r = this.startNode();
this.match(43) ? i.typeParameters = this.flowParseTypeParameterDeclaration() : i.typeParameters = null, this.expect(6);
let n = this.flowParseFunctionTypeParams();
return i.params = n.params, i.rest = n.rest, i.this = n._this, this.expect(7), [i.returnType, t.predicate] = this.flowParseTypeAndPredicateInitialiser(false), r.typeAnnotation = this.finishNode(i, "FunctionTypeAnnotation"), s.typeAnnotation = this.finishNode(r, "TypeAnnotation"), this.resetEndLocation(s), this.semicolon(), this.scope.declareName(t.id.name, 2048, t.id.start), this.finishNode(t, "DeclareFunction");
}
flowParseDeclare(t, s) {
if (this.match(76)) return this.flowParseDeclareClass(t);
if (this.match(64)) return this.flowParseDeclareFunction(t);
if (this.match(70)) return this.flowParseDeclareVariable(t);
if (this.eatContextual(123)) return this.match(12) ? this.flowParseDeclareModuleExports(t) : (s && this.raise(P.NestedDeclareModule, this.state.lastTokStartLoc), this.flowParseDeclareModule(t));
if (this.isContextual(126)) return this.flowParseDeclareTypeAlias(t);
if (this.isContextual(127)) return this.flowParseDeclareOpaqueType(t);
if (this.isContextual(125)) return this.flowParseDeclareInterface(t);
if (this.match(78)) return this.flowParseDeclareExportDeclaration(t, s);
throw this.unexpected();
}
flowParseDeclareVariable(t) {
return this.next(), t.id = this.flowParseTypeAnnotatableIdentifier(), this.scope.declareName(t.id.name, 5, t.id.start), this.semicolon(), this.finishNode(t, "DeclareVariable");
}
flowParseDeclareModule(t) {
this.scope.enter(0), this.match(130) ? t.id = super.parseExprAtom() : t.id = this.parseIdentifier();
let s = this.startNode(), i = s.body = [];
for (this.expect(2); !this.match(4); ) {
let o = this.startNode();
this.match(79) ? (this.next(), !this.isContextual(126) && !this.match(83) && this.raise(P.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc), i.push(super.parseImport(o))) : (this.expectContextual(121, P.UnsupportedStatementInDeclareModule), i.push(this.flowParseDeclare(o, true)));
}
this.scope.exit(), this.expect(4), t.body = this.finishNode(s, "BlockStatement");
let r = null, n = false;
return i.forEach((o) => {
Vi(o) ? (r === "CommonJS" && this.raise(P.AmbiguousDeclareModuleKind, o), r = "ES") : o.type === "DeclareModuleExports" && (n && this.raise(P.DuplicateDeclareModuleExports, o), r === "ES" && this.raise(P.AmbiguousDeclareModuleKind, o), r = "CommonJS", n = true);
}), t.kind = r || "CommonJS", this.finishNode(t, "DeclareModule");
}
flowParseDeclareExportDeclaration(t, s) {
if (this.expect(78), this.eat(61)) return this.match(64) || this.match(76) ? t.declaration = this.flowParseDeclare(this.startNode()) : (t.declaration = this.flowParseType(), this.semicolon()), t.default = true, this.finishNode(t, "DeclareExportDeclaration");
if (this.match(71) || this.isLet() || (this.isContextual(126) || this.isContextual(125)) && !s) {
let i = this.state.value;
throw this.raise(P.UnsupportedDeclareExportKind, this.state.startLoc, { unsupportedExportKind: i, suggestion: qi[i] });
}
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(127)) return t.declaration = this.flowParseDeclare(this.startNode()), t.default = false, this.finishNode(t, "DeclareExportDeclaration");
if (this.match(51) || this.match(2) || this.isContextual(125) || this.isContextual(126) || this.isContextual(127)) {
let i = this.parseExport(t, null);
return i.type === "ExportNamedDeclaration" ? (i.default = false, delete i.exportKind, this.castNodeTo(i, "DeclareExportDeclaration")) : this.castNodeTo(i, "DeclareExportAllDeclaration");
}
throw this.unexpected();
}
flowParseDeclareModuleExports(t) {
return this.next(), this.expectContextual(107), t.typeAnnotation = this.flowParseTypeAnnotation(), this.semicolon(), this.finishNode(t, "DeclareModuleExports");
}
flowParseDeclareTypeAlias(t) {
this.next();
let s = this.flowParseTypeAlias(t);
return this.castNodeTo(s, "DeclareTypeAlias"), s;
}
flowParseDeclareOpaqueType(t) {
return this.next(), this.flowParseOpaqueType(t, true);
}
flowParseDeclareInterface(t) {
return this.next(), this.flowParseInterfaceish(t, false), this.finishNode(t, "DeclareInterface");
}
flowParseInterfaceish(t, s) {
if (t.id = this.flowParseRestrictedIdentifier(!s, true), this.scope.declareName(t.id.name, s ? 17 : 8201, t.id.start), this.match(43) ? t.typeParameters = this.flowParseTypeParameterDeclaration() : t.typeParameters = null, t.extends = [], this.eat(77)) do
t.extends.push(this.flowParseInterfaceExtends());
while (!s && this.eat(8));
if (s) {
let i = [], r = [];
if (this.eatContextual(113)) do
r.push(this.flowParseInterfaceExtends());
while (this.eat(8));
if (this.eatContextual(109)) do
i.push(this.flowParseClassImplements());
while (this.eat(8));
t.implements = i, t.mixins = r;
}
t.body = this.flowParseObjectType({ allowStatic: s, allowExact: false, allowSpread: false, allowProto: s, allowInexact: false });
}
flowParseInterfaceExtends() {
let t = this.startNode();
return t.id = this.flowParseQualifiedTypeIdentifier(), this.match(43) ? t.typeParameters = this.flowParseTypeParameterInstantiation() : t.typeParameters = null, this.finishNode(t, "InterfaceExtends");
}
flowParseInterface(t) {
return this.flowParseInterfaceish(t, false), this.finishNode(t, "InterfaceDeclaration");
}
checkNotUnderscore(t) {
t === "_" && this.raise(P.UnexpectedReservedUnderscore, this.state.startLoc);
}
checkReservedType(t, s, i) {
_i.has(t) && this.raise(i ? P.AssignReservedType : P.UnexpectedReservedType, s, { reservedType: t });
}
flowParseRestrictedIdentifierName(t, s) {
return this.checkReservedType(this.state.value, this.state.startLoc, s), this.parseIdentifierName(t);
}
flowParseRestrictedIdentifier(t, s) {
let i = this.startNode(), r = this.flowParseRestrictedIdentifierName(t, s);
return this.createIdentifier(i, r);
}
flowParseTypeAlias(t) {
return t.id = this.flowParseRestrictedIdentifier(false, true), this.scope.declareName(t.id.name, 8201, t.id.start), this.match(43) ? t.typeParameters = this.flowParseTypeParameterDeclaration() : t.typeParameters = null, t.right = this.flowParseTypeInitialiser(25), this.semicolon(), this.finishNode(t, "TypeAlias");
}
flowParseOpaqueType(t, s) {
return this.expectContextual(126), t.id = this.flowParseRestrictedIdentifier(true, true), this.scope.declareName(t.id.name, 8201, t.id.start), this.match(43) ? t.typeParameters = this.flowParseTypeParameterDeclaration() : t.typeParameters = null, t.supertype = null, this.match(10) && (t.supertype = this.flowParseTypeInitialiser(10)), t.impltype = null, s || (t.impltype = this.flowParseTypeInitialiser(25)), this.semicolon(), this.finishNode(t, s ? "DeclareOpaqueType" : "OpaqueType");
}
flowParseTypeParameterBound() {
if (this.match(10) || this.isContextual(77)) {
let t = this.startNode();
return this.next(), t.typeAnnotation = this.flowParseType(), this.finishNode(t, "TypeAnnotation");
}
}
flowParseTypeParameter(t = false) {
let s = this.state.startLoc, i = this.startNode(), r = this.flowParseVariance();
return i.name = this.flowParseRestrictedIdentifierName(), i.variance = r, i.bound = this.flowParseTypeParameterBound(), this.match(25) ? (this.eat(25), i.default = this.flowParseType()) : t && this.raise(P.MissingTypeParamDefault, s), this.finishNode(i, "TypeParameter");
}
flowParseTypeParameterDeclaration() {
let t = this.state.inType, s = this.startNode();
s.params = [], this.state.inType = true, this.match(43) || this.match(138) ? this.next() : this.unexpected();
let i = false;
do {
let r = this.flowParseTypeParameter(i);
s.params.push(r), r.default && (i = true), this.match(44) || this.expect(8);
} while (!this.match(44));
return this.expect(44), this.state.inType = t, this.finishNode(s, "TypeParameterDeclaration");
}
flowInTopLevelContext(t) {
if (this.curContext() !== w.brace) {
let s = this.state.context;
this.state.context = [s[0]];
try {
return t();
} finally {
this.state.context = s;
}
} else return t();
}
flowParseTypeParameterInstantiationInExpression() {
if (this.reScan_lt() === 43) return this.flowParseTypeParameterInstantiation();
}
flowParseTypeParameterInstantiation() {
let t = this.startNode(), s = this.state.inType;
return this.state.inType = true, t.params = [], this.flowInTopLevelContext(() => {
this.expect(43);
let i = this.state.noAnonFunctionType;
for (this.state.noAnonFunctionType = false; !this.match(44); ) t.params.push(this.flowParseType()), this.match(44) || this.expect(8);
this.state.noAnonFunctionType = i;
}), this.state.inType = s, !this.state.inType && this.curContext() === w.brace && this.reScan_lt_gt(), this.expect(44), this.finishNode(t, "TypeParameterInstantiation");
}
flowParseTypeParameterInstantiationCallOrNew() {
if (this.reScan_lt() !== 43) return null;
let t = this.startNode(), s = this.state.inType;
for (t.params = [], this.state.inType = true, this.expect(43); !this.match(44); ) t.params.push(this.flowParseTypeOrImplicitInstantiation()), this.match(44) || this.expect(8);
return this.expect(44), this.state.inType = s, this.finishNode(t, "TypeParameterInstantiation");
}
flowParseInterfaceType() {
let t = this.startNode();
if (this.expectContextual(125), t.extends = [], this.eat(77)) do
t.extends.push(this.flowParseInterfaceExtends());
while (this.eat(8));
return t.body = this.flowParseObjectType({ allowStatic: false, allowExact: false, allowSpread: false, allowProto: false, allowInexact: false }), this.finishNode(t, "InterfaceTypeAnnotation");
}
flowParseObjectPropertyKey() {
return this.match(131) || this.match(130) ? super.parseExprAtom() : this.parseIdentifier(true);
}
flowParseObjectTypeIndexer(t, s, i) {
return t.static = s, this.lookahead().type === 10 ? (t.id = this.parseIdentifier(true), t.key = this.flowParseTypeInitialiser()) : (t.id = null, t.key = this.flowParseType()), this.expect(1), t.value = this.flowParseTypeInitialiser(), t.variance = i, this.finishNode(t, "ObjectTypeIndexer");
}
flowParseObjectTypeInternalSlot(t, s) {
return t.static = s, t.id = this.parseIdentifier(true), this.expect(1), this.expect(1), this.match(43) || this.match(6) ? (t.method = true, t.optional = false, t.value = this.flowParseObjectTypeMethodish(this.startNodeAtNode(t))) : (t.method = false, this.eat(13) && (t.optional = true), t.value = this.flowParseTypeInitialiser()), this.finishNode(t, "ObjectTypeInternalSlot");
}
flowParseObjectTypeMethodish(t) {
for (t.params = [], t.rest = null, t.typeParameters = null, t.this = null, this.match(43) && (t.typeParameters = this.flowParseTypeParameterDeclaration()), this.expect(6), this.match(74) && (t.this = this.flowParseFunctionTypeParam(true), t.this.name = null, this.match(7) || this.expect(8)); !this.match(7) && !this.match(17); ) t.params.push(this.flowParseFunctionTypeParam(false)), this.match(7) || this.expect(8);
return this.eat(17) && (t.rest = this.flowParseFunctionTypeParam(false)), this.expect(7), t.returnType = this.flowParseTypeInitialiser(), this.finishNode(t, "FunctionTypeAnnotation");
}
flowParseObjectTypeCallProperty(t, s) {
let i = this.startNode();
return t.static = s, t.value = this.flowParseObjectTypeMethodish(i), this.finishNode(t, "ObjectTypeCallProperty");
}
flowParseObjectType({ allowStatic: t, allowExact: s, allowSpread: i, allowProto: r, allowInexact: n }) {
let o = this.state.inType;
this.state.inType = true;
let h = this.startNode();
h.callProperties = [], h.properties = [], h.indexers = [], h.internalSlots = [];
let c, p, f = false;
for (s && this.match(3) ? (this.expect(3), c = 5, p = true) : (this.expect(2), c = 4, p = false), h.exact = p; !this.match(c); ) {
let x = false, T = null, D = null, v = this.startNode();
if (r && this.isContextual(114)) {
let I = this.lookahead();
I.type !== 10 && I.type !== 13 && (this.next(), T = this.state.startLoc, t = false);
}
if (t && this.isContextual(102)) {
let I = this.lookahead();
I.type !== 10 && I.type !== 13 && (this.next(), x = true);
}
let E = this.flowParseVariance();
if (this.eat(0)) T != null && this.unexpected(T), this.eat(0) ? (E && this.unexpected(E.start), h.internalSlots.push(this.flowParseObjectTypeInternalSlot(v, x))) : h.indexers.push(this.flowParseObjectTypeIndexer(v, x, E));
else if (this.match(6) || this.match(43)) T != null && this.unexpected(T), E && this.unexpected(E.start), h.callProperties.push(this.flowParseObjectTypeCallProperty(v, x));
else {
let I = "init";
if (this.isContextual(95) || this.isContextual(100)) {
let ct = this.lookahead();
Ye(ct.type) && (I = this.state.value, this.next());
}
let At = this.flowParseObjectTypeProperty(v, x, T, E, I, i, n ?? !p);
At === null ? (f = true, D = this.state.lastTokStartLoc) : h.properties.push(At);
}
this.flowObjectTypeSemicolon(), D && !this.match(4) && !this.match(5) && this.raise(P.UnexpectedExplicitInexactInObject, D);
}
this.expect(c), i && (h.inexact = f);
let d = this.finishNode(h, "ObjectTypeAnnotation");
return this.state.inType = o, d;
}
flowParseObjectTypeProperty(t, s, i, r, n, o, h) {
if (this.eat(17)) return this.match(8) || this.match(9) || this.match(4) || this.match(5) ? (o ? h || this.raise(P.InexactInsideExact, this.state.lastTokStartLoc) : this.raise(P.InexactInsideNonObject, this.state.lastTokStartLoc), r && this.raise(P.InexactVariance, r), null) : (o || this.raise(P.UnexpectedSpreadType, this.state.lastTokStartLoc), i != null && this.unexpected(i), r && this.raise(P.SpreadVariance, r), t.argument = this.flowParseType(), this.finishNode(t, "ObjectTypeSpreadProperty"));
{
t.key = this.flowParseObjectPropertyKey(), t.static = s, t.proto = i != null, t.kind = n;
let c = false;
return this.match(43) || this.match(6) ? (t.method = true, i != null && this.unexpected(i), r && this.unexpected(r.start), t.value = this.flowParseObjectTypeMethodish(this.startNodeAtNode(t)), n === "get" || n === "set" ? this.flowCheckGetterSetterParams(t) : !s && !o && t.key.name === "constructor" && t.value.this && this.raise(P.ThisParamBannedInConstructor, t.value.this)) : (n !== "init" && this.unexpected(), t.method = false, this.eat(13) && (c = true), t.value = this.flowParseTypeInitialiser(), t.variance = r), t.optional = c, this.finishNode(t, "ObjectTypeProperty");
}
}
flowCheckGetterSetterParams(t) {
let s = t.kind === "get" ? 0 : 1, i = t.value, r = i.params.length + (i.rest ? 1 : 0);
i.this && this.raise(t.kind === "get" ? P.GetterMayNotHaveThisParam : P.SetterMayNotHaveThisParam, i.this), r !== s && this.raise(t.kind === "get" ? l.BadGetterArity : l.BadSetterArity, t), t.kind === "set" && i.rest && this.raise(l.BadSetterRestParameter, t);
}
flowObjectTypeSemicolon() {
!this.eat(9) && !this.eat(8) && !this.match(4) && !this.match(5) && this.unexpected();
}
flowParseQualifiedTypeIdentifier(t, s) {
t ?? (t = this.state.startLoc);
let i = s || this.flowParseRestrictedIdentifier(true);
for (; this.eat(12); ) {
let r = this.startNodeAt(t);
r.qualification = i, r.id = this.flowParseRestrictedIdentifier(true), i = this.finishNode(r, "QualifiedTypeIdentifier");
}
return i;
}
flowParseGenericType(t, s) {
let i = this.startNodeAt(t);
return i.typeParameters = null, i.id = this.flowParseQualifiedTypeIdentifier(t, s), this.match(43) && (i.typeParameters = this.flowParseTypeParameterInstantiation()), this.finishNode(i, "GenericTypeAnnotation");
}
flowParseTypeofType() {
let t = this.startNode();
return this.expect(83), t.argument = this.flowParsePrimaryType(), this.finishNode(t, "TypeofTypeAnnotation");
}
flowParseTupleType() {
let t = this.startNode();
for (t.types = [], this.expect(0); this.state.pos < this.length && !this.match(1) && (t.types.push(this.flowParseType()), !this.match(1)); ) this.expect(8);
return this.expect(1), this.finishNode(t, "TupleTypeAnnotation");
}
flowParseFunctionTypeParam(t) {
let s = null, i = false, r, n = this.startNode(), o = this.lookahead(), h = this.state.type === 74;
return o.type === 10 || o.type === 13 ? (h && !t && this.raise(P.ThisParamMustBeFirst, n), s = this.parseIdentifier(h), this.eat(13) && (i = true, h && this.raise(P.ThisParamMayNotBeOptional, n)), r = this.flowParseTypeInitialiser()) : r = this.flowParseType(), n.name = s, n.optional = i, n.typeAnnotation = r, this.finishNode(n, "FunctionTypeParam");
}
reinterpretTypeAsFunctionTypeParam(t) {
let s = this.startNodeAtNode(t);
return s.name = null, s.optional = false, s.typeAnnotation = t, this.finishNode(s, "FunctionTypeParam");
}
flowParseFunctionTypeParams(t = []) {
let s = null, i = null;
for (this.match(74) && (i = this.flowParseFunctionTypeParam(true), i.name = null, this.match(7) || this.expect(8)); !this.match(7) && !this.match(17); ) t.push(this.flowParseFunctionTypeParam(false)), this.match(7) || this.expect(8);
return this.eat(17) && (s = this.flowParseFunctionTypeParam(false)), { params: t, rest: s, _this: i };
}
flowIdentToTypeAnnotation(t, s, i) {
switch (i.name) {
case "any":
return this.finishNode(s, "AnyTypeAnnotation");
case "bool":
case "boolean":
return this.finishNode(s, "BooleanTypeAnnotation");
case "mixed":
return this.finishNode(s, "MixedTypeAnnotation");
case "empty":
return this.finishNode(s, "EmptyTypeAnnotation");
case "number":
return this.finishNode(s, "NumberTypeAnnotation");
case "string":
return this.finishNode(s, "StringTypeAnnotation");
case "symbol":
return this.finishNode(s, "SymbolTypeAnnotation");
default:
return this.checkNotUnderscore(i.name), this.flowParseGenericType(t, i);
}
}
flowParsePrimaryType() {
let t = this.state.startLoc, s = this.startNode(), i, r, n = false, o = this.state.noAnonFunctionType;
switch (this.state.type) {
case 2:
return this.flowParseObjectType({ allowStatic: false, allowExact: false, allowSpread: true, allowProto: false, allowInexact: true });
case 3:
return this.flowParseObjectType({ allowStatic: false, allowExact: true, allowSpread: true, allowProto: false, allowInexact: false });
case 0:
return this.state.noAnonFunctionType = false, r = this.flowParseTupleType(), this.state.noAnonFunctionType = o, r;
case 43: {
let h = this.startNode();
return h.typeParameters = this.flowParseTypeParameterDeclaration(), this.expect(6), i = this.flowParseFunctionTypeParams(), h.params = i.params, h.rest = i.rest, h.this = i._this, this.expect(7), this.expect(15), h.returnType = this.flowParseType(), this.finishNode(h, "FunctionTypeAnnotation");
}
case 6: {
let h = this.startNode();
if (this.next(), !this.match(7) && !this.match(17)) if (C(this.state.type) || this.match(74)) {
let c = this.lookahead().type;
n = c !== 13 && c !== 10;
} else n = true;
if (n) {
if (this.state.noAnonFunctionType = false, r = this.flowParseType(), this.state.noAnonFunctionType = o, this.state.noAnonFunctionType || !(this.match(8) || this.match(7) && this.lookahead().type === 15)) return this.expect(7), r;
this.eat(8);
}
return r ? i = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)]) : i = this.flowParseFunctionTypeParams(), h.params = i.params, h.rest = i.rest, h.this = i._this, this.expect(7), this.expect(15), h.returnType = this.flowParseType(), h.typeParameters = null, this.finishNode(h, "FunctionTypeAnnotation");
}
case 130:
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
case 81:
case 82:
return s.value = this.match(81), this.next(), this.finishNode(s, "BooleanLiteralTypeAnnotation");
case 49:
if (this.state.value === "-") {
if (this.next(), this.match(131)) return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", s);
if (this.match(132)) return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", s);
throw this.raise(P.UnexpectedSubtractionOperand, this.state.startLoc);
}
throw this.unexpected();
case 131:
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
case 132:
return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
case 84:
return this.next(), this.finishNode(s, "VoidTypeAnnotation");
case 80:
return this.next(), this.finishNode(s, "NullLiteralTypeAnnotation");
case 74:
return this.next(), this.finishNode(s, "ThisTypeAnnotation");
case 51:
return this.next(), this.finishNode(s, "ExistsTypeAnnotation");
case 83:
return this.flowParseTypeofType();
default:
if (Ee(this.state.type)) {
let h = z(this.state.type);
return this.next(), super.createIdentifier(s, h);
} else if (C(this.state.type)) return this.isContextual(125) ? this.flowParseInterfaceType() : this.flowIdentToTypeAnnotation(t, s, this.parseIdentifier());
}
throw this.unexpected();
}
flowParsePostfixType() {
let t = this.state.startLoc, s = this.flowParsePrimaryType(), i = false;
for (; (this.match(0) || this.match(14)) && !this.canInsertSemicolon(); ) {
let r = this.startNodeAt(t), n = this.eat(14);
i = i || n, this.expect(0), !n && this.match(1) ? (r.elementType = s, this.next(), s = this.finishNode(r, "ArrayTypeAnnotation")) : (r.objectType = s, r.indexType = this.flowParseType(), this.expect(1), i ? (r.optional = n, s = this.finishNode(r, "OptionalIndexedAccessType")) : s = this.finishNode(r, "IndexedAccessType"));
}
return s;
}
flowParsePrefixType() {
let t = this.startNode();
return this.eat(13) ? (t.typeAnnotation = this.flowParsePrefixType(), this.finishNode(t, "NullableTypeAnnotation")) : this.flowParsePostfixType();
}
flowParseAnonFunctionWithoutParens() {
let t = this.flowParsePrefixType();
if (!this.state.noAnonFunctionType && this.eat(15)) {
let s = this.startNodeAtNode(t);
return s.params = [this.reinterpretTypeAsFunctionTypeParam(t)], s.rest = null, s.this = null, s.returnType = this.flowParseType(), s.typeParameters = null, this.finishNode(s, "FunctionTypeAnnotation");
}
return t;
}
flowParseIntersectionType() {
let t = this.startNode();
this.eat(41);
let s = this.flowParseAnonFunctionWithoutParens();
for (t.types = [s]; this.eat(41); ) t.types.push(this.flowParseAnonFunctionWithoutParens());
return t.types.length === 1 ? s : this.finishNode(t, "IntersectionTypeAnnotation");
}
flowParseUnionType() {
let t = this.startNode();
this.eat(39);
let s = this.flowParseIntersectionType();
for (t.types = [s]; this.eat(39); ) t.types.push(this.flowParseIntersectionType());
return t.types.length === 1 ? s : this.finishNode(t, "UnionTypeAnnotation");
}
flowParseType() {
let t = this.state.inType;
this.state.inType = true;
let s = this.flowParseUnionType();
return this.state.inType = t, s;
}
flowParseTypeOrImplicitInstantiation() {
if (this.state.type === 128 && this.state.value === "_") {
let t = this.state.startLoc, s = this.parseIdentifier();
return this.flowParseGenericType(t, s);
} else return this.flowParseType();
}
flowParseTypeAnnotation() {
let t = this.startNode();
return t.typeAnnotation = this.flowParseTypeInitialiser(), this.finishNode(t, "TypeAnnotation");
}
flowParseTypeAnnotatableIdentifier() {
let t = this.startNode(), s = this.parseIdentifierName();
return this.match(10) && (t.typeAnnotation = this.flowParseTypeAnnotation()), this.createIdentifier(t, s);
}
typeCastToParameter(t) {
return t.expression.typeAnnotation = t.typeAnnotation, this.resetEndLocationFromNode(t.expression, t.typeAnnotation), t.expression;
}
flowParseVariance() {
let t = null;
return this.match(49) ? (t = this.startNode(), this.state.value === "+" ? t.kind = "plus" : t.kind = "minus", this.next(), this.finishNode(t, "Variance")) : t;
}
parseFunctionBody(t, s, i = false) {
if (s) {
this.forwardNoArrowParamsConversionAt(t, () => super.parseFunctionBody(t, true, i));
return;
}
super.parseFunctionBody(t, false, i);
}
parseFunctionBodyAndFinish(t, s, i = false) {
if (this.match(10)) {
let r = this.startNode();
s === "FunctionDeclaration" || s === "FunctionExpression" || s === "ArrowFunctionExpression" ? [r.typeAnnotation, t.predicate] = this.flowParseTypeAndPredicateInitialiser(true) : r.typeAnnotation = this.flowParseTypeInitialiser(), t.returnType = r.typeAnnotation ? this.finishNode(r, "TypeAnnotation") : null;
}
return super.parseFunctionBodyAndFinish(t, s, i);
}
parseStatementLike(t) {
if (this.state.strict && this.isContextual(125)) {
let i = this.lookahead();
if (B(i.type)) {
let r = this.startNode();
return this.next(), this.flowParseInterface(r);
}
} else if (this.isContextual(122)) {
let i = this.startNode();
return this.next(), this.flowParseEnumDeclaration(i);
}
let s = super.parseStatementLike(t);
return this.flowPragma === void 0 && !this.isValidDirective(s) && (this.flowPragma = null), s;
}
parseExpressionStatement(t, s, i) {
if (s.type === "Identifier") {
if (s.name === "declare") {
if (this.match(76) || C(this.state.type) || this.match(64) || this.match(70) || this.match(78)) return this.flowParseDeclare(t);
} else if (C(this.state.type)) {
if (s.name === "interface") return this.flowParseInterface(t);
if (s.name === "type") return this.flowParseTypeAlias(t);
if (s.name === "opaque") return this.flowParseOpaqueType(t, false);
}
}
return super.parseExpressionStatement(t, s, i);
}
shouldParseExportDeclaration() {
let { type: t } = this.state;
return t === 122 || Ue(t) ? !this.state.containsEsc : super.shouldParseExportDeclaration();
}
isExportDefaultSpecifier() {
let { type: t } = this.state;
return t === 122 || Ue(t) ? this.state.containsEsc : super.isExportDefaultSpecifier();
}
parseExportDefaultExpression() {
if (this.isContextual(122)) {
let t = this.startNode();
return this.next(), this.flowParseEnumDeclaration(t);
}
return super.parseExportDefaultExpression();
}
parseConditional(t, s, i) {
if (!this.match(13)) return t;
if (i != null) {
let x = this.lookaheadCharCode();
if (x === 44 || x === 61 || x === 58 || x === 41) return this.setOptionalParametersError(i), t;
}
this.expect(13);
let r = this.state.clone(), n = this.state.noArrowAt, o = this.startNodeAt(s), { consequent: h, failed: c } = this.tryParseConditionalConsequent(), p = this.getArrowLikeExpressions(h), f = p[0], d = p[1];
if (c || d.length > 0) {
let x = [...n];
if (d.length > 0) {
this.state = r, this.state.noArrowAt = x;
for (let T = 0; T < d.length; T++) x.push(d[T].start);
({ consequent: h, failed: c } = this.tryParseConditionalConsequent()), [f] = this.getArrowLikeExpressions(h);
}
c && f.length > 1 && this.raise(P.AmbiguousConditionalArrow, r.startLoc), c && f.length === 1 && (this.state = r, x.push(f[0].start), this.state.noArrowAt = x, { consequent: h } = this.tryParseConditionalConsequent());
}
return this.getArrowLikeExpressions(h, true), this.state.noArrowAt = n, this.expect(10), o.test = t, o.consequent = h, o.alternate = this.forwardNoArrowParamsConversionAt(o, () => this.parseMaybeAssign(void 0, void 0)), this.finishNode(o, "ConditionalExpression");
}
tryParseConditionalConsequent() {
this.state.noArrowParamsConversionAt.push(this.state.start);
let t = this.parseMaybeAssignAllowIn(), s = !this.match(10);
return this.state.noArrowParamsConversionAt.pop(), { consequent: t, failed: s };
}
getArrowLikeExpressions(t, s) {
let i = [t], r = [];
for (; i.length !== 0; ) {
let n = i.pop();
n.type === "ArrowFunctionExpression" && n.body.type !== "BlockStatement" ? (n.typeParameters || !n.returnType ? this.finishArrowValidation(n) : r.push(n), i.push(n.body)) : n.type === "ConditionalExpression" && (i.push(n.consequent), i.push(n.alternate));
}
return s ? (r.forEach((n) => this.finishArrowValidation(n)), [r, []]) : $i(r, (n) => n.params.every((o) => this.isAssignable(o, true)));
}
finishArrowValidation(t) {
this.toAssignableList(t.params, t.extra?.trailingCommaLoc, false), this.scope.enter(518), super.checkParams(t, false, true), this.scope.exit();
}
forwardNoArrowParamsConversionAt(t, s) {
let i;
return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)) ? (this.state.noArrowParamsConversionAt.push(this.state.start), i = s(), this.state.noArrowParamsConversionAt.pop()) : i = s(), i;
}
parseParenItem(t, s) {
let i = super.parseParenItem(t, s);
if (this.eat(13) && (i.optional = true, this.resetEndLocation(t)), this.match(10)) {
let r = this.startNodeAt(s);
return r.expression = i, r.typeAnnotation = this.flowParseTypeAnnotation(), this.finishNode(r, "TypeCastExpression");
}
return i;
}
assertModuleNodeAllowed(t) {
t.type === "ImportDeclaration" && (t.importKind === "type" || t.importKind === "typeof") || t.type === "ExportNamedDeclaration" && t.exportKind === "type" || t.type === "ExportAllDeclaration" && t.exportKind === "type" || super.assertModuleNodeAllowed(t);
}
parseExportDeclaration(t) {
if (this.isContextual(126)) {
t.exportKind = "type";
let s = this.startNode();
return this.next(), this.match(2) ? (t.specifiers = this.parseExportSpecifiers(true), super.parseExportFrom(t), null) : this.flowParseTypeAlias(s);
} else if (this.isContextual(127)) {
t.exportKind = "type";
let s = this.startNode();
return this.next(), this.flowParseOpaqueType(s, false);
} else if (this.isContextual(125)) {
t.exportKind = "type";
let s = this.startNode();
return this.next(), this.flowParseInterface(s);
} else if (this.isContextual(122)) {
t.exportKind = "value";
let s = this.startNode();
return this.next(), this.flowParseEnumDeclaration(s);
} else return super.parseExportDeclaration(t);
}
eatExportStar(t) {
return super.eatExportStar(t) ? true : this.isContextual(126) && this.lookahead().type === 51 ? (t.exportKind = "type", this.next(), this.next(), true) : false;
}
maybeParseExportNamespaceSpecifier(t) {
let { startLoc: s } = this.state, i = super.maybeParseExportNamespaceSpecifier(t);
return i && t.exportKind === "type" && this.unexpected(s), i;
}
parseClassId(t, s, i) {
if ((!s || i) && this.isContextual(109)) {
t.id = null;
return;
}
super.parseClassId(t, s, i), this.match(43) && (t.typeParameters = this.flowParseTypeParameterDeclaration());
}
parseClassMember(t, s, i) {
let { startLoc: r } = this.state;
if (this.isContextual(121)) {
if (super.parseClassMemberFromModifier(t, s)) return;
s.declare = true;
}
super.parseClassMember(t, s, i), s.declare && (s.type !== "ClassProperty" && s.type !== "ClassPrivateProperty" && s.type !== "PropertyDefinition" ? this.raise(P.DeclareClassElement, r) : s.value && this.raise(P.DeclareClassFieldInitializer, s.value));
}
isIterator(t) {
return t === "iterator" || t === "asyncIterator";
}
readIterator() {
let t = super.readWord1(), s = "@@" + t;
(!this.isIterator(t) || !this.state.inType) && this.raise(l.InvalidIdentifier, this.state.curPosition(), { identifierName: s }), this.finishToken(128, s);
}
getTokenFromCode(t) {
let s = this.input.charCodeAt(this.state.pos + 1);
t === 123 && s === 124 ? this.finishOp(3, 2) : this.state.inType && (t === 62 || t === 60) ? this.finishOp(t === 62 ? 44 : 43, 1) : this.state.inType && t === 63 ? s === 46 ? this.finishOp(14, 2) : this.finishOp(13, 1) : Bi(t, s, this.input.charCodeAt(this.state.pos + 2)) ? (this.state.pos += 2, this.readIterator()) : super.getTokenFromCode(t);
}
isAssignable(t, s) {
return t.type === "TypeCastExpression" ? this.isAssignable(t.expression, s) : super.isAssignable(t, s);
}
toAssignable(t, s = false) {
!s && t.type === "AssignmentExpression" && t.left.type === "TypeCastExpression" && (t.left = this.typeCastToParameter(t.left)), super.toAssignable(t, s);
}
toAssignableListItem(t, s, i) {
let r = t[s];
r.type === "TypeCastExpression" && (t[s] = this.typeCastToParameter(r)), super.toAssignableListItem(t, s, i);
}
toReferencedList(t, s) {
for (let i = 0; i < t.length; i++) {
let r = t[i];
r?.type === "TypeCastExpression" && !r.extra?.parenthesized && (t.length > 1 || !s) && this.raise(P.TypeCastInPattern, r.typeAnnotation);
}
return t;
}
parseArrayLike(t, s) {
let i = super.parseArrayLike(t, s);
return i.type === "ArrayExpression" && this.toReferencedList(i.elements), i;
}
isValidLVal(t, s, i, r) {
return t === "TypeCastExpression" || super.isValidLVal(t, s, i, r);
}
parseClassProperty(t) {
return this.match(10) && (t.typeAnnotation = this.flowParseTypeAnnotation()), super.parseClassProperty(t);
}
parseClassPrivateProperty(t) {
return this.match(10) && (t.typeAnnotation = this.flowParseTypeAnnotation()), super.parseClassPrivateProperty(t);
}
isClassMethod() {
return this.match(43) || super.isClassMethod();
}
isClassProperty() {
return this.match(10) || super.isClassProperty();
}
isNonstaticConstructor(t) {
return !this.match(10) && super.isNonstaticConstructor(t);
}
pushClassMethod(t, s, i, r, n, o) {
if (s.variance && this.unexpected(s.variance.start), delete s.variance, this.match(43) && (s.typeParameters = this.flowParseTypeParameterDeclaration()), super.pushClassMethod(t, s, i, r, n, o), s.params && n) {
let h = s.params;
h.length > 0 && this.isThisParam(h[0]) && this.raise(P.ThisParamBannedInConstructor, s);
} else if (s.type === "MethodDefinition" && n && s.value.params) {
let h = s.value.params;
h.length > 0 && this.isThisParam(h[0]) && this.raise(P.ThisParamBannedInConstructor, s);
}
}
pushClassPrivateMethod(t, s, i, r) {
s.variance && this.unexpected(s.variance.start), delete s.variance, this.match(43) && (s.typeParameters = this.flowParseTypeParameterDeclaration()), super.pushClassPrivateMethod(t, s, i, r);
}
flowParseClassImplements() {
let t = this.startNode();
return t.id = this.flowParseRestrictedIdentifier(true), this.match(43) ? t.typeParameters = this.flowParseTypeParameterInstantiation() : t.typeParameters = null, this.finishNode(t, "ClassImplements");
}
parseClassSuper(t) {
if (super.parseClassSuper(t), t.superClass && (this.match(43) || this.match(47)) && (t.superTypeArguments = this.flowParseTypeParameterInstantiationInExpression()), this.eatContextual(109)) {
let s = t.implements = [];
do
s.push(this.flowParseClassImplements());
while (this.eat(8));
}
}
checkGetterSetterParams(t) {
super.checkGetterSetterParams(t);
let s = this.getObjectOrClassMethodParams(t);
if (s.length > 0) {
let i = s[0];
this.isThisParam(i) && t.kind === "get" ? this.raise(P.GetterMayNotHaveThisParam, i) : this.isThisParam(i) && this.raise(P.SetterMayNotHaveThisParam, i);
}
}
parsePropertyNamePrefixOperator(t) {
t.variance = this.flowParseVariance();
}
parseObjPropValue(t, s, i, r, n, o, h) {
t.variance && this.unexpected(t.variance.start), delete t.variance;
let c;
this.match(43) && !o && (c = this.flowParseTypeParameterDeclaration(), this.match(6) || this.unexpected());
let p = super.parseObjPropValue(t, s, i, r, n, o, h);
return c && ((p.value || p).typeParameters = c), p;
}
parseFunctionParamType(t) {
return this.eat(13) && (t.type !== "Identifier" && this.raise(P.PatternIsOptional, t), this.isThisParam(t) && this.raise(P.ThisParamMayNotBeOptional, t), t.optional = true), this.match(10) ? t.typeAnnotation = this.flowParseTypeAnnotation() : this.isThisParam(t) && this.raise(P.ThisParamAnnotationRequired, t), this.match(25) && this.isThisParam(t) && this.raise(P.ThisParamNoDefault, t), this.resetEndLocation(t), t;
}
parseMaybeDefault(t, s) {
let i = super.parseMaybeDefault(t, s);
return i.type === "AssignmentPattern" && i.typeAnnotation && i.right.start < i.typeAnnotation.start && this.raise(P.TypeBeforeInitializer, i.typeAnnotation), i;
}
parseImportSpecifierLocal(t, s, i) {
s.local = je(t) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier(), t.specifiers.push(this.finishImportSpecifier(s, i));
}
isPotentialImportPhase(t) {
if (super.isPotentialImportPhase(t)) return true;
if (this.isContextual(126)) {
if (!t) return true;
let s = this.lookaheadCharCode();
return s === 123 || s === 42;
}
return !t && this.isContextual(83);
}
applyImportPhase(t, s, i, r) {
if (super.applyImportPhase(t, s, i, r), s) {
if (!i && this.match(61)) return;
t.exportKind = i === "type" ? i : "value";
} else i === "type" && this.match(51) && this.unexpected(), t.importKind = i === "type" || i === "typeof" ? i : "value";
}
parseImportSpecifier(t, s, i, r, n) {
let o = t.imported, h = null;
o.type === "Identifier" && (o.name === "type" ? h = "type" : o.name === "typeof" && (h = "typeof"));
let c = false;
if (this.isContextual(89) && !this.isLookaheadContextual("as")) {
let f = this.parseIdentifier(true);
h !== null && !B(this.state.type) ? (t.imported = f, t.importKind = h, t.local = this.cloneIdentifier(f)) : (t.imported = o, t.importKind = null, t.local = this.parseIdentifier());
} else {
if (h !== null && B(this.state.type)) t.imported = this.parseIdentifier(true), t.importKind = h;
else {
if (s) throw this.raise(l.ImportBindingIsString, t, { importName: o.value });
t.imported = o, t.importKind = null;
}
this.eatContextual(89) ? t.local = this.parseIdentifier() : (c = true, t.local = this.cloneIdentifier(t.imported));
}
let p = je(t);
return i && p && this.raise(P.ImportTypeShorthandOnlyInPureImport, t), (i || p) && this.checkReservedType(t.local.name, t.local.start, true), c && !i && !p && this.checkReservedWord(t.local.name, t.start, true, true), this.finishImportSpecifier(t, "ImportSpecifier");
}
parseBindingAtom() {
return this.state.type === 74 ? this.parseIdentifier(true) : super.parseBindingAtom();
}
parseFunctionParams(t, s) {
let i = t.kind;
i !== "get" && i !== "set" && this.match(43) && (t.typeParameters = this.flowParseTypeParameterDeclaration()), super.parseFunctionParams(t, s);
}
parseVarId(t, s) {
super.parseVarId(t, s), this.match(10) && (t.id.typeAnnotation = this.flowParseTypeAnnotation(), this.resetEndLocation(t.id));
}
parseAsyncArrowFromCallExpression(t, s) {
if (this.match(10)) {
let i = this.state.noAnonFunctionType;
this.state.noAnonFunctionType = true, t.returnType = this.flowParseTypeAnnotation(), this.state.noAnonFunctionType = i;
}
return super.parseAsyncArrowFromCallExpression(t, s);
}
shouldParseAsyncArrow() {
return this.match(10) || super.shouldParseAsyncArrow();
}
parseMaybeAssign(t, s) {
let i = null, r;
if (this.hasPlugin("jsx") && (this.match(138) || this.match(43))) {
if (i = this.state.clone(), r = this.tryParse(() => super.parseMaybeAssign(t, s), i), !r.error) return r.node;
let { context: n } = this.state, o = n[n.length - 1];
(o === w.j_oTag || o === w.j_expr) && n.pop();
}
if (r?.error || this.match(43)) {
i = i || this.state.clone();
let n, o = this.tryParse((c) => {
n = this.flowParseTypeParameterDeclaration();
let p = this.forwardNoArrowParamsConversionAt(n, () => {
let d = super.parseMaybeAssign(t, s);
return this.resetStartLocationFromNode(d, n), d;
});
p.extra?.parenthesized && c();
let f = this.maybeUnwrapTypeCastExpression(p);
return f.type !== "ArrowFunctionExpression" && c(), f.typeParameters = n, this.resetStartLocationFromNode(f, n), p;
}, i), h = null;
if (o.node && this.maybeUnwrapTypeCastExpression(o.node).type === "ArrowFunctionExpression") {
if (!o.error && !o.aborted) return o.node.async && this.raise(P.UnexpectedTypeParameterBeforeAsyncArrowFunction, n), o.node;
h = o.node;
}
if (r?.node) return this.state = r.failState, r.node;
if (h) return this.state = o.failState, h;
throw r?.thrown ? r.error : o.thrown ? o.error : this.raise(P.UnexpectedTokenAfterTypeParameter, n);
}
return super.parseMaybeAssign(t, s);
}
parseArrow(t) {
if (this.match(10)) {
let s = this.tryParse(() => {
let i = this.state.noAnonFunctionType;
this.state.noAnonFunctionType = true;
let r = this.startNode();
return [r.typeAnnotation, t.predicate] = this.flowParseTypeAndPredicateInitialiser(true), this.state.noAnonFunctionType = i, this.canInsertSemicolon() && this.unexpected(), this.match(15) || this.unexpected(), r;
});
if (s.thrown) return null;
s.error && (this.state = s.failState), t.returnType = s.node.typeAnnotation ? this.finishNode(s.node, "TypeAnnotation") : null;
}
return super.parseArrow(t);
}
shouldParseArrow(t) {
return this.match(10) || super.shouldParseArrow(t);
}
setArrowFunctionParameters(t, s) {
this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)) ? t.params = s : super.setArrowFunctionParameters(t, s);
}
checkParams(t, s, i, r = true) {
if (!(i && this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))) {
for (let n = 0; n < t.params.length; n++) this.isThisParam(t.params[n]) && n > 0 && this.raise(P.ThisParamMustBeFirst, t.params[n]);
super.checkParams(t, s, i, r);
}
}
parseParenAndDistinguishExpression(t) {
return super.parseParenAndDistinguishExpression(t && !this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)));
}
parseSubscripts(t, s, i) {
if (t.type === "Identifier" && t.name === "async" && this.state.noArrowAt.includes(s.index)) {
this.next();
let r = this.startNodeAt(s);
r.callee = t, r.arguments = super.parseCallExpressionArguments(), t = this.finishNode(r, "CallExpression");
} else if (t.type === "Identifier" && t.name === "async" && this.match(43)) {
let r = this.state.clone(), n = this.tryParse((h) => this.parseAsyncArrowWithTypeParameters(s) || h(), r);
if (!n.error && !n.aborted) return n.node;
let o = this.tryParse(() => super.parseSubscripts(t, s, i), r);
if (o.node && !o.error) return o.node;
if (n.node) return this.state = n.failState, n.node;
if (o.node) return this.state = o.failState, o.node;
throw n.error || o.error;
}
return super.parseSubscripts(t, s, i);
}
parseSubscript(t, s, i, r) {
if (this.match(14) && this.isLookaheadToken_lt()) {
if (r.optionalChainMember = true, i) return r.stop = true, t;
this.next();
let n = this.startNodeAt(s);
return n.callee = t, n.typeArguments = this.flowParseTypeParameterInstantiationInExpression(), this.expect(6), n.arguments = this.parseCallExpressionArguments(), n.optional = true, this.finishCallExpression(n, true);
} else if (!i && this.shouldParseTypes() && (this.match(43) || this.match(47))) {
let n = this.startNodeAt(s);
n.callee = t;
let o = this.tryParse(() => (n.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(), this.expect(6), n.arguments = super.parseCallExpressionArguments(), r.optionalChainMember && (n.optional = false), this.finishCallExpression(n, r.optionalChainMember)));
if (o.node) return o.error && (this.state = o.failState), o.node;
}
return super.parseSubscript(t, s, i, r);
}
parseNewCallee(t) {
super.parseNewCallee(t);
let s = null;
this.shouldParseTypes() && this.match(43) && (s = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node), t.typeArguments = s;
}
parseAsyncArrowWithTypeParameters(t) {
let s = this.startNodeAt(t);
if (this.parseFunctionParams(s, false), !!this.parseArrow(s)) return super.parseArrowExpression(s, void 0, true);
}
readToken_mult_modulo(t) {
let s = this.input.charCodeAt(this.state.pos + 1);
if (t === 42 && s === 47 && this.state.hasFlowComment) {
this.state.hasFlowComment = false, this.state.pos += 2, this.nextToken();
return;
}
super.readToken_mult_modulo(t);
}
readToken_pipe_amp(t) {
let s = this.input.charCodeAt(this.state.pos + 1);
if (t === 124 && s === 125) {
this.finishOp(5, 2);
return;
}
super.readToken_pipe_amp(t);
}
parseTopLevel(t, s) {
let i = super.parseTopLevel(t, s);
return this.state.hasFlowComment && this.raise(P.UnterminatedFlowComment, this.state.curPosition()), i;
}
skipBlockComment() {
if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
if (this.state.hasFlowComment) throw this.raise(P.NestedFlowComment, this.state.startLoc);
this.hasFlowCommentCompletion();
let t = this.skipFlowComment();
t && (this.state.pos += t, this.state.hasFlowComment = true);
return;
}
return super.skipBlockComment(this.state.hasFlowComment ? "*-/" : "*/");
}
skipFlowComment() {
let { pos: t } = this.state, s = 2;
for (; [32, 9].includes(this.input.charCodeAt(t + s)); ) s++;
let i = this.input.charCodeAt(s + t), r = this.input.charCodeAt(s + t + 1);
return i === 58 && r === 58 ? s + 2 : this.input.slice(s + t, s + t + 12) === "flow-include" ? s + 12 : i === 58 && r !== 58 ? s : false;
}
hasFlowCommentCompletion() {
if (this.input.indexOf("*/", this.state.pos) === -1) throw this.raise(l.UnterminatedComment, this.state.curPosition());
}
flowEnumErrorBooleanMemberNotInitialized(t, s) {
this.raise(P.EnumBooleanMemberNotInitialized, t, s);
}
flowEnumErrorInvalidMemberInitializer(t, s) {
return this.raise(s.explicitType ? s.explicitType === "symbol" ? P.EnumInvalidMemberInitializerSymbolType : P.EnumInvalidMemberInitializerPrimaryType : P.EnumInvalidMemberInitializerUnknownType, t, s);
}
flowEnumErrorNumberMemberNotInitialized(t, s) {
this.raise(P.EnumNumberMemberNotInitialized, t, s);
}
flowEnumErrorStringMemberInconsistentlyInitialized(t, s) {
this.raise(P.EnumStringMemberInconsistentlyInitialized, t, s);
}
flowEnumMemberInit() {
let t = this.state.startLoc, s = () => this.match(8) || this.match(4);
switch (this.state.type) {
case 131: {
let i = this.parseNumericLiteral(this.state.value);
if (s()) return { type: "number", loc: i.start, value: i };
break;
}
case 130: {
let i = this.parseStringLiteral(this.state.value);
if (s()) return { type: "string", loc: i.start, value: i };
break;
}
case 81:
case 82: {
let i = this.parseBooleanLiteral(this.match(81));
if (s()) return { type: "boolean", loc: i.start, value: i };
}
}
return { type: "invalid", loc: t };
}
flowEnumMemberRaw() {
let t = this.state.startLoc, s = this.parseIdentifier(true), i = this.eat(25) ? this.flowEnumMemberInit() : { type: "none", loc: t };
return { id: s, init: i };
}
flowEnumCheckExplicitTypeMismatch(t, s, i) {
let { explicitType: r } = s;
r !== null && r !== i && this.flowEnumErrorInvalidMemberInitializer(t, s);
}
flowEnumMembers({ enumName: t, explicitType: s }) {
let i = /* @__PURE__ */ new Set(), r = { booleanMembers: [], numberMembers: [], stringMembers: [], defaultedMembers: [] }, n = false;
for (; !this.match(4); ) {
if (this.eat(17)) {
n = true;
break;
}
let o = this.startNode(), { id: h, init: c } = this.flowEnumMemberRaw(), p = h.name;
if (p === "") continue;
/^[a-z]/.test(p) && this.raise(P.EnumInvalidMemberName, h, { memberName: p, suggestion: p[0].toUpperCase() + p.slice(1), enumName: t }), i.has(p) && this.raise(P.EnumDuplicateMemberName, h, { memberName: p, enumName: t }), i.add(p);
let f = { enumName: t, explicitType: s, memberName: p };
switch (o.id = h, c.type) {
case "boolean": {
this.flowEnumCheckExplicitTypeMismatch(c.loc, f, "boolean"), o.init = c.value, r.booleanMembers.push(this.finishNode(o, "EnumBooleanMember"));
break;
}
case "number": {
this.flowEnumCheckExplicitTypeMismatch(c.loc, f, "number"), o.init = c.value, r.numberMembers.push(this.finishNode(o, "EnumNumberMember"));
break;
}
case "string": {
this.flowEnumCheckExplicitTypeMismatch(c.loc, f, "string"), o.init = c.value, r.stringMembers.push(this.finishNode(o, "EnumStringMember"));
break;
}
case "invalid":
throw this.flowEnumErrorInvalidMemberInitializer(c.loc, f);
case "none":
switch (s) {
case "boolean":
this.flowEnumErrorBooleanMemberNotInitialized(c.loc, f);
break;
case "number":
this.flowEnumErrorNumberMemberNotInitialized(c.loc, f);
break;
default:
r.defaultedMembers.push(this.finishNode(o, "EnumDefaultedMember"));
}
}
this.match(4) || this.expect(8);
}
return { members: r, hasUnknownMembers: n };
}
flowEnumStringMembers(t, s, { enumName: i }) {
if (t.length === 0) return s;
if (s.length === 0) return t;
if (s.length > t.length) {
for (let r of t) this.flowEnumErrorStringMemberInconsistentlyInitialized(r, { enumName: i });
return s;
} else {
for (let r of s) this.flowEnumErrorStringMemberInconsistentlyInitialized(r, { enumName: i });
return t;
}
}
flowEnumParseExplicitType({ enumName: t }) {
if (!this.eatContextual(98)) return null;
if (!C(this.state.type)) throw this.raise(P.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, { enumName: t });
let { value: s } = this.state;
return this.next(), s !== "boolean" && s !== "number" && s !== "string" && s !== "symbol" && this.raise(P.EnumInvalidExplicitType, this.state.startLoc, { enumName: t, invalidEnumType: s }), s;
}
flowEnumBody(t, s) {
let i = s.name, r = s.start, n = this.flowEnumParseExplicitType({ enumName: i });
this.expect(2);
let { members: o, hasUnknownMembers: h } = this.flowEnumMembers({ enumName: i, explicitType: n });
switch (t.hasUnknownMembers = h, n) {
case "boolean":
return t.explicitType = true, t.members = o.booleanMembers, this.expect(4), this.finishNode(t, "EnumBooleanBody");
case "number":
return t.explicitType = true, t.members = o.numberMembers, this.expect(4), this.finishNode(t, "EnumNumberBody");
case "string":
return t.explicitType = true, t.members = this.flowEnumStringMembers(o.stringMembers, o.defaultedMembers, { enumName: i }), this.expect(4), this.finishNode(t, "EnumStringBody");
case "symbol":
return t.members = o.defaultedMembers, this.expect(4), this.finishNode(t, "EnumSymbolBody");
default: {
let c = () => (t.members = [], this.expect(4), this.finishNode(t, "EnumStringBody"));
t.explicitType = false;
let p = o.booleanMembers.length, f = o.numberMembers.length, d = o.stringMembers.length, x = o.defaultedMembers.length;
if (!p && !f && !d && !x) return c();
if (!p && !f) return t.members = this.flowEnumStringMembers(o.stringMembers, o.defaultedMembers, { enumName: i }), this.expect(4), this.finishNode(t, "EnumStringBody");
if (!f && !d && p >= x) {
for (let T of o.defaultedMembers) this.flowEnumErrorBooleanMemberNotInitialized(T.start, { enumName: i, memberName: T.id.name });
return t.members = o.booleanMembers, this.expect(4), this.finishNode(t, "EnumBooleanBody");
} else if (!p && !d && f >= x) {
for (let T of o.defaultedMembers) this.flowEnumErrorNumberMemberNotInitialized(T.start, { enumName: i, memberName: T.id.name });
return t.members = o.numberMembers, this.expect(4), this.finishNode(t, "EnumNumberBody");
} else return this.raise(P.EnumInconsistentMemberValues, r, { enumName: i }), c();
}
}
}
flowParseEnumDeclaration(t) {
let s = this.parseIdentifier();
return t.id = s, t.body = this.flowEnumBody(this.startNode(), s), this.finishNode(t, "EnumDeclaration");
}
jsxParseOpeningElementAfterName(t) {
return this.shouldParseTypes() && (this.match(43) || this.match(47)) && (t.typeArguments = this.flowParseTypeParameterInstantiationInExpression()), super.jsxParseOpeningElementAfterName(t);
}
isLookaheadToken_lt() {
let t = this.nextTokenStart();
if (this.input.charCodeAt(t) === 60) {
let s = this.input.charCodeAt(t + 1);
return s !== 60 && s !== 61;
}
return false;
}
reScan_lt_gt() {
let { type: t } = this.state;
t === 43 ? (this.state.pos -= 1, this.readToken_lt()) : t === 44 && (this.state.pos -= 1, this.readToken_gt());
}
reScan_lt() {
let { type: t } = this.state;
return t === 47 ? (this.state.pos -= 2, this.finishOp(43, 1), 43) : t;
}
maybeUnwrapTypeCastExpression(t) {
return t.type === "TypeCastExpression" ? t.expression : t;
}
};
Ki = /\r\n|[\r\n\u2028\u2029]/;
St = new RegExp(Ki.source, "g");
zt = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
Ht = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
Ji = { AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.", MissingClosingTagElement: ({ openingTagName: a2 }) => `Expected corresponding JSX closing tag for <${a2}>.`, MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.", UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?", UnexpectedToken: ({ unexpected: a2, HTMLEntity: e }) => `Unexpected token \`${a2}\`. Did you mean \`${e}\` or \`{'${a2}'}\`?`, UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.", UnterminatedJsxContent: "Unterminated JSX contents.", UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?" };
_ = F`jsx`(Ji);
Gi = (a2) => class extends a2 {
jsxReadToken() {
let t = "", s = this.state.pos;
for (; ; ) {
if (this.state.pos >= this.length) throw this.raise(_.UnterminatedJsxContent, this.state.startLoc);
let i = this.input.charCodeAt(this.state.pos);
switch (i) {
case 60:
case 123:
if (this.state.pos === this.state.start) {
i === 60 && this.state.canStartJSXElement ? (++this.state.pos, this.finishToken(138)) : super.getTokenFromCode(i);
return;
}
t += this.input.slice(s, this.state.pos), this.finishToken(137, t);
return;
case 38:
t += this.input.slice(s, this.state.pos), t += this.jsxReadEntity(), s = this.state.pos;
break;
case 62:
case 125:
this.raise(_.UnexpectedToken, this.state.curPosition(), { unexpected: this.input[this.state.pos], HTMLEntity: i === 125 ? "}" : ">" });
default:
tt(i) ? (t += this.input.slice(s, this.state.pos), t += this.jsxReadNewLine(true), s = this.state.pos) : ++this.state.pos;
}
}
}
jsxReadNewLine(t) {
let s = this.input.charCodeAt(this.state.pos), i;
return ++this.state.pos, s === 13 && this.input.charCodeAt(this.state.pos) === 10 ? (++this.state.pos, i = t ? `
` : `\r
`) : i = String.fromCharCode(s), ++this.state.curLine, this.state.lineStart = this.state.pos, i;
}
jsxReadString(t) {
let s = "", i = ++this.state.pos;
for (; ; ) {
if (this.state.pos >= this.length) throw this.raise(l.UnterminatedString, this.state.startLoc);
let r = this.input.charCodeAt(this.state.pos);
if (r === t) break;
r === 38 ? (s += this.input.slice(i, this.state.pos), s += this.jsxReadEntity(), i = this.state.pos) : tt(r) ? (s += this.input.slice(i, this.state.pos), s += this.jsxReadNewLine(false), i = this.state.pos) : ++this.state.pos;
}
s += this.input.slice(i, this.state.pos++), this.finishToken(130, s);
}
jsxReadEntity() {
let t = ++this.state.pos;
if (this.codePointAtPos(this.state.pos) === 35) {
++this.state.pos;
let s = 10;
this.codePointAtPos(this.state.pos) === 120 && (s = 16, ++this.state.pos);
let i = this.readInt(s, void 0, false, "bail");
if (i !== null && this.codePointAtPos(this.state.pos) === 59) return ++this.state.pos, String.fromCodePoint(i);
} else {
let s = 0, i = false;
for (; s++ < 10 && this.state.pos < this.length && !(i = this.codePointAtPos(this.state.pos) === 59); ) ++this.state.pos;
if (i) {
let r = this.input.slice(t, this.state.pos), n = void 0;
if (++this.state.pos, n) return n;
}
}
return this.state.pos = t, "&";
}
jsxReadWord() {
let t, s = this.state.pos;
do
t = this.input.charCodeAt(++this.state.pos);
while (W(t) || t === 45);
this.finishToken(136, this.input.slice(s, this.state.pos));
}
jsxParseIdentifier() {
let t = this.startNode();
return this.match(136) ? t.name = this.state.value : Ee(this.state.type) ? t.name = z(this.state.type) : this.unexpected(), this.next(), this.finishNode(t, "JSXIdentifier");
}
jsxParseNamespacedName() {
let t = this.state.startLoc, s = this.jsxParseIdentifier();
if (!this.eat(10)) return s;
let i = this.startNodeAt(t);
return i.namespace = s, i.name = this.jsxParseIdentifier(), this.finishNode(i, "JSXNamespacedName");
}
jsxParseElementName() {
let t = this.state.startLoc, s = this.jsxParseNamespacedName();
if (s.type === "JSXNamespacedName") return s;
for (; this.eat(12); ) {
let i = this.startNodeAt(t);
i.object = s, i.property = this.jsxParseIdentifier(), s = this.finishNode(i, "JSXMemberExpression");
}
return s;
}
jsxParseAttributeValue() {
let t;
switch (this.state.type) {
case 2:
return t = this.startNode(), this.setContext(w.brace), this.next(), t = this.jsxParseExpressionContainer(t, w.j_oTag), t.expression.type === "JSXEmptyExpression" && this.raise(_.AttributeIsEmpty, t), t;
case 138:
case 130:
return this.parseExprAtom();
default:
throw this.raise(_.UnsupportedJsxValue, this.state.startLoc);
}
}
jsxParseEmptyExpression() {
let t = this.startNodeAt(this.state.lastTokEndLoc);
return this.finishNodeAt(t, "JSXEmptyExpression", this.state.startLoc);
}
jsxParseSpreadChild(t) {
return this.next(), t.expression = this.parseExpression(), this.setContext(w.j_expr), this.state.canStartJSXElement = true, this.expect(4), this.finishNode(t, "JSXSpreadChild");
}
jsxParseExpressionContainer(t, s) {
if (this.match(4)) t.expression = this.jsxParseEmptyExpression();
else {
let i = this.parseExpression();
i.type === "SequenceExpression" && !i.extra?.parenthesized && this.raise(_.UnexpectedSequenceExpression, i.expressions[1]), t.expression = i;
}
return this.setContext(s), this.state.canStartJSXElement = true, this.expect(4), this.finishNode(t, "JSXExpressionContainer");
}
jsxParseAttribute() {
if (this.match(2)) {
let s = this.startNode();
return this.setContext(w.brace), this.next(), this.expect(17), s.argument = this.parseMaybeAssignAllowIn(), this.setContext(w.j_oTag), this.state.canStartJSXElement = true, this.expect(4), this.finishNode(s, "JSXSpreadAttribute");
}
let t = this.startNode();
return t.name = this.jsxParseNamespacedName(), t.value = this.eat(25) ? this.jsxParseAttributeValue() : null, this.finishNode(t, "JSXAttribute");
}
jsxParseOpeningElementAt(t) {
if (this.eat(139)) {
let i = this.startNodeAt(t);
return this.finishNode(i, "JSXOpeningFragment");
}
let s = this.startNodeAt(t);
return s.name = this.jsxParseElementName(), this.jsxParseOpeningElementAfterName(s);
}
jsxParseOpeningElementAfterName(t) {
let s = [];
for (; !this.match(52) && !this.match(139); ) s.push(this.jsxParseAttribute());
return t.attributes = s, t.selfClosing = this.eat(52), this.expect(139), this.finishNode(t, "JSXOpeningElement");
}
jsxParseClosingElementAt(t) {
if (this.eat(139)) {
let i = this.startNodeAt(t);
return this.finishNode(i, "JSXClosingFragment");
}
let s = this.startNodeAt(t);
return s.name = this.jsxParseElementName(), this.expect(139), this.finishNode(s, "JSXClosingElement");
}
jsxParseElementAt(t) {
let s = this.startNodeAt(t), i = [], r = this.jsxParseOpeningElementAt(t), n = null;
if (!r.selfClosing) {
t: for (; ; ) switch (this.state.type) {
case 138:
if (t = this.state.startLoc, this.next(), this.eat(52)) {
this.setLoc(t), n = this.jsxParseClosingElementAt(t);
break t;
}
i.push(this.jsxParseElementAt(t));
break;
case 137:
i.push(this.parseLiteral(this.state.value, "JSXText"));
break;
case 2: {
let o = this.startNode();
this.setContext(w.brace), this.next(), this.match(17) ? i.push(this.jsxParseSpreadChild(o)) : i.push(this.jsxParseExpressionContainer(o, w.j_expr));
break;
}
default:
this.unexpected();
}
q(r) && !q(n) && n !== null ? this.raise(_.MissingClosingTagFragment, n) : !q(r) && q(n) ? this.raise(_.MissingClosingTagElement, n, { openingTagName: Z(r.name) }) : !q(r) && !q(n) && Z(n.name) !== Z(r.name) && this.raise(_.MissingClosingTagElement, n, { openingTagName: Z(r.name) });
}
if (q(r) ? (s.openingFragment = r, s.closingFragment = n) : (s.openingElement = r, s.closingElement = n), s.children = i, this.match(43)) throw this.raise(_.UnwrappedAdjacentJSXElements, this.state.startLoc);
return q(r) ? this.finishNode(s, "JSXFragment") : this.finishNode(s, "JSXElement");
}
jsxParseElement() {
let t = this.state.startLoc;
return this.next(), this.jsxParseElementAt(t);
}
setContext(t) {
let { context: s } = this.state;
s[s.length - 1] = t;
}
parseExprAtom(t) {
return this.match(138) ? this.jsxParseElement() : this.match(43) && this.input.charCodeAt(this.state.pos) !== 33 ? (this.replaceToken(138), this.jsxParseElement()) : super.parseExprAtom(t);
}
skipSpace() {
this.curContext().preserveSpace || super.skipSpace();
}
getTokenFromCode(t) {
let s = this.curContext();
if (s === w.j_expr) {
this.jsxReadToken();
return;
}
if (s === w.j_oTag || s === w.j_cTag) {
if (R(t)) {
this.jsxReadWord();
return;
}
if (t === 62) {
++this.state.pos, this.finishToken(139);
return;
}
if ((t === 34 || t === 39) && s === w.j_oTag) {
this.jsxReadString(t);
return;
}
}
if (t === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
++this.state.pos, this.finishToken(138);
return;
}
super.getTokenFromCode(t);
}
updateContext(t) {
let { context: s, type: i } = this.state;
if (i === 52 && t === 138) s.splice(-2, 2, w.j_cTag), this.state.canStartJSXElement = false;
else if (i === 138) s.push(w.j_oTag);
else if (i === 139) {
let r = s[s.length - 1];
r === w.j_oTag && t === 52 || r === w.j_cTag ? (s.pop(), this.state.canStartJSXElement = s[s.length - 1] === w.j_expr) : (this.setContext(w.j_expr), this.state.canStartJSXElement = true);
} else this.state.canStartJSXElement = Ti(i);
}
};
Zt = class extends yt {
tsNames = /* @__PURE__ */ new Map();
};
te = class extends xt {
get inTSNamespace() {
let e = this.scopeStack;
return e.length >= 2 && e[e.length - 1].flags === 0 && (e[e.length - 2].flags & 2048) > 0;
}
importsStack = [];
createScope(e) {
return this.importsStack.push(/* @__PURE__ */ new Set()), new Zt(e);
}
enter(e) {
e & 3072 && this.importsStack.push(/* @__PURE__ */ new Set()), super.enter(e);
}
exit() {
let e = super.exit();
return e & 3072 && this.importsStack.pop(), e;
}
hasImport(e, t) {
let s = this.importsStack.length;
if (this.importsStack[s - 1].has(e)) return true;
if (!t && s > 1) {
for (let i = 0; i < s - 1; i++) if (this.importsStack[i].has(e)) return true;
}
return false;
}
declareName(e, t, s) {
if (t & 4096) {
this.hasImport(e, true) && this.parser.raise(l.VarRedeclaration, s, { identifierName: e }), this.importsStack[this.importsStack.length - 1].add(e);
return;
}
let i = this.currentScope(), r = i.tsNames.get(e) || 0;
if (t & 1024) {
this.maybeExportDefined(i, e), i.tsNames.set(e, r | 16);
return;
}
super.declareName(e, t, s), t & 2 && (t & 1 || (this.checkRedeclarationInScope(i, e, t, s), this.maybeExportDefined(i, e)), r = r | 1), t & 256 && (r = r | 2), t & 512 && (r = r | 4), t & 128 && (r = r | 8), r && i.tsNames.set(e, r);
}
isRedeclaredInScope(e, t, s) {
let i = e.tsNames.get(t);
if ((i & 2) > 0) {
if (s & 256) {
let r = (s & 512) > 0, n = (i & 4) > 0;
return r !== n;
}
return true;
}
return s & 128 && (i & 8) > 0 ? e.names.get(t) & 2 ? !!(s & 1) : false : s & 2 && (i & 1) > 0 ? true : super.isRedeclaredInScope(e, t, s);
}
checkLocalExport(e) {
let { name: t } = e;
if (this.hasImport(t)) return;
let s = this.scopeStack.length;
for (let i = s - 1; i >= 0; i--) {
let n = this.scopeStack[i].tsNames.get(t);
if ((n & 1) > 0 || (n & 16) > 0) return;
}
super.checkLocalExport(e);
}
};
ee = class {
sawUnambiguousESM = false;
ambiguousScriptDifferentAst = false;
sourceToOffsetPos(e) {
return e + this.startIndex;
}
offsetToSourcePos(e) {
return e - this.startIndex;
}
hasPlugin(e) {
if (typeof e == "string") return this.plugins.has(e);
{
let [t, s] = e;
if (!this.hasPlugin(t)) return false;
let i = this.plugins.get(t);
for (let r of Object.keys(s)) if (i?.[r] !== s[r]) return false;
return true;
}
}
getPluginOption(e, t) {
return this.plugins.get(e)?.[t];
}
};
se = class extends ee {
addComment(e) {
this.filename && (e.loc.filename = this.filename);
let { commentsLen: t } = this.state;
this.comments.length !== t && (this.comments.length = t), this.comments.push(e), this.state.commentsLen++;
}
processComment(e) {
let { commentStack: t } = this.state, s = t.length;
if (s === 0) return;
let i = s - 1, r = t[i];
r.start === e.end && (r.leadingNode = e, i--);
let n = e.start;
for (; i >= 0; i--) {
let o = t[i], h = o.end;
if (h > n) o.containingNode = e, this.finalizeComment(o), t.splice(i, 1);
else {
h === n && (o.trailingNode = e);
break;
}
}
}
finalizeComment(e) {
let { comments: t } = e;
if (e.leadingNode !== null || e.trailingNode !== null) e.leadingNode !== null && as(e.leadingNode, t), e.trailingNode !== null && Xi(e.trailingNode, t);
else {
let s = e.containingNode, i = e.start;
if (this.input.charCodeAt(this.offsetToSourcePos(i) - 1) === 44) switch (s.type) {
case "ObjectExpression":
case "ObjectPattern":
$(s, s.properties, e);
break;
case "CallExpression":
case "NewExpression":
case "OptionalCallExpression":
$(s, s.arguments, e);
break;
case "ImportExpression":
$(s, [s.source, s.options ?? null], e);
break;
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
case "ObjectMethod":
case "ClassMethod":
case "ClassPrivateMethod":
case "TSTypeParameterDeclaration":
$(s, s.params, e);
break;
case "ArrayExpression":
case "ArrayPattern":
$(s, s.elements, e);
break;
case "ExportNamedDeclaration":
case "ImportDeclaration":
$(s, s.specifiers, e);
break;
case "TSEnumBody":
$(s, s.members, e);
break;
case "TSInterfaceBody":
$(s, s.body, e);
break;
default:
Pt(s, t);
}
else Pt(s, t);
}
}
finalizeRemainingComments() {
let { commentStack: e } = this.state;
for (let t = e.length - 1; t >= 0; t--) this.finalizeComment(e[t]);
this.state.commentStack = [];
}
resetPreviousNodeTrailingComments(e) {
let { commentStack: t } = this.state, { length: s } = t;
if (s === 0) return;
let i = t[s - 1];
i.leadingNode === e && (i.leadingNode = null);
}
takeSurroundingComments(e, t, s) {
let { commentStack: i } = this.state, r = i.length;
if (r === 0) return;
let n = r - 1;
for (; n >= 0; n--) {
let o = i[n], h = o.end;
if (o.start === s) o.leadingNode = e;
else if (h === t) o.trailingNode = e;
else if (h < t) break;
}
}
};
ie = class a {
flags = 2048;
get strict() {
return (this.flags & 1) > 0;
}
set strict(e) {
e ? this.flags |= 1 : this.flags &= -2;
}
startIndex;
curLine;
lineStart;
startLoc;
endLoc;
init({ strictMode: e, sourceType: t, startIndex: s, startLine: i, startColumn: r }) {
this.strict = e === false ? false : e === true ? true : t === "module", this.startIndex = s, this.curLine = i, this.lineStart = -r, this.startLoc = this.endLoc = new L(i, r, s);
}
errors = [];
noArrowAt = [];
noArrowParamsConversionAt = [];
get canStartArrow() {
return (this.flags & 2) > 0;
}
set canStartArrow(e) {
e ? this.flags |= 2 : this.flags &= -3;
}
get inType() {
return (this.flags & 4) > 0;
}
set inType(e) {
e ? this.flags |= 4 : this.flags &= -5;
}
get noAnonFunctionType() {
return (this.flags & 8) > 0;
}
set noAnonFunctionType(e) {
e ? this.flags |= 8 : this.flags &= -9;
}
get hasFlowComment() {
return (this.flags & 16) > 0;
}
set hasFlowComment(e) {
e ? this.flags |= 16 : this.flags &= -17;
}
get isAmbientContext() {
return (this.flags & 32) > 0;
}
set isAmbientContext(e) {
e ? this.flags |= 32 : this.flags &= -33;
}
get inAbstractClass() {
return (this.flags & 64) > 0;
}
set inAbstractClass(e) {
e ? this.flags |= 64 : this.flags &= -65;
}
get inDisallowConditionalTypesContext() {
return (this.flags & 128) > 0;
}
set inDisallowConditionalTypesContext(e) {
e ? this.flags |= 128 : this.flags &= -129;
}
get inConditionalConsequent() {
return (this.flags & 256) > 0;
}
set inConditionalConsequent(e) {
e ? this.flags |= 256 : this.flags &= -257;
}
get inHackPipelineBody() {
return (this.flags & 512) > 0;
}
set inHackPipelineBody(e) {
e ? this.flags |= 512 : this.flags &= -513;
}
get seenTopicReference() {
return (this.flags & 1024) > 0;
}
set seenTopicReference(e) {
e ? this.flags |= 1024 : this.flags &= -1025;
}
labels = [];
commentsLen = 0;
commentStack = [];
pos = 0;
type = 135;
value = null;
start = 0;
end = 0;
lastTokEndLoc = null;
lastTokStartLoc = null;
context = [w.brace];
get canStartJSXElement() {
return (this.flags & 2048) > 0;
}
set canStartJSXElement(e) {
e ? this.flags |= 2048 : this.flags &= -2049;
}
get containsEsc() {
return (this.flags & 4096) > 0;
}
set containsEsc(e) {
e ? this.flags |= 4096 : this.flags &= -4097;
}
firstInvalidTemplateEscapePos = null;
get hasTopLevelAwait() {
return (this.flags & 8192) > 0;
}
set hasTopLevelAwait(e) {
e ? this.flags |= 8192 : this.flags &= -8193;
}
strictErrors = /* @__PURE__ */ new Map();
tokensLength = 0;
curPosition() {
return new L(this.curLine, this.pos - this.lineStart, this.pos + this.startIndex);
}
clone() {
let e = new a();
return e.flags = this.flags, e.startIndex = this.startIndex, e.curLine = this.curLine, e.lineStart = this.lineStart, e.startLoc = this.startLoc, e.endLoc = this.endLoc, e.errors = this.errors.slice(), e.noArrowAt = this.noArrowAt.slice(), e.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice(), e.labels = this.labels.slice(), e.commentsLen = this.commentsLen, e.commentStack = this.commentStack.slice(), e.pos = this.pos, e.type = this.type, e.value = this.value, e.start = this.start, e.end = this.end, e.lastTokEndLoc = this.lastTokEndLoc, e.lastTokStartLoc = this.lastTokStartLoc, e.context = this.context.slice(), e.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos, e.strictErrors = this.strictErrors, e.tokensLength = this.tokensLength, e;
}
};
Yi = function(e) {
return e >= 48 && e <= 57;
};
qe = { decBinOct: /* @__PURE__ */ new Set([46, 66, 69, 79, 95, 98, 101, 111]), hex: /* @__PURE__ */ new Set([46, 88, 95, 120]) };
Ct = { bin: (a2) => a2 === 48 || a2 === 49, oct: (a2) => a2 >= 48 && a2 <= 55, dec: (a2) => a2 >= 48 && a2 <= 57, hex: (a2) => a2 >= 48 && a2 <= 57 || a2 >= 65 && a2 <= 70 || a2 >= 97 && a2 <= 102 };
tr = /* @__PURE__ */ new Set([103, 109, 115, 105, 121, 117, 100, 118]);
ae = class {
constructor(e) {
let t = e.startIndex || 0;
this.type = e.type, this.value = e.value, this.start = t + e.start, this.end = t + e.end, this.loc = new st(e.startLoc, e.endLoc);
}
};
ne = class extends se {
isLookahead;
tokens = [];
constructor(e, t) {
super(), this.state = new ie(), this.state.init(e), this.input = t, this.length = t.length, this.comments = [], this.isLookahead = false, (!Et || Et.length < (this.length + 1) * 2) && (Et = new Uint32Array((this.length + 1) * 2)), this.locData = Et;
}
setLoc(e) {
let t = this.offsetToSourcePos(e.index);
this.locData[t * 2] = e.line, this.locData[t * 2 + 1] = e.column;
}
getLoc(e) {
let t = this.offsetToSourcePos(e);
return new L(this.locData[t * 2], this.locData[t * 2 + 1], e);
}
pushToken(e) {
this.tokens.length = this.state.tokensLength, this.tokens.push(e), ++this.state.tokensLength;
}
next() {
this.checkKeywordEscapes(), this.optionFlags & 512 && this.pushToken(new ae(this.state)), this.state.lastTokEndLoc = this.state.endLoc, this.state.lastTokStartLoc = this.state.startLoc, this.nextToken();
}
eat(e) {
return this.match(e) ? (this.next(), true) : false;
}
match(e) {
return this.state.type === e;
}
createLookaheadState(e) {
return { pos: e.pos, value: null, type: e.type, start: e.start, end: e.end, context: [this.curContext()], inType: e.inType, startLoc: e.startLoc, lastTokEndLoc: e.lastTokEndLoc, curLine: e.curLine, lineStart: e.lineStart, curPosition: e.curPosition };
}
lookahead() {
let e = this.state;
this.state = this.createLookaheadState(e), this.isLookahead = true, this.nextToken(), this.isLookahead = false;
let t = this.state;
return this.state = e, t;
}
nextTokenStart() {
return this.nextTokenStartSince(this.state.pos);
}
nextTokenStartSince(e) {
return zt.lastIndex = e, zt.test(this.input) ? zt.lastIndex : e;
}
lookaheadCharCode() {
return this.lookaheadCharCodeSince(this.state.pos);
}
lookaheadCharCodeSince(e) {
return this.input.charCodeAt(this.nextTokenStartSince(e));
}
nextTokenInLineStart() {
return this.nextTokenInLineStartSince(this.state.pos);
}
nextTokenInLineStartSince(e) {
return Ht.lastIndex = e, Ht.test(this.input) ? Ht.lastIndex : e;
}
lookaheadInLineCharCode() {
return this.input.charCodeAt(this.nextTokenInLineStart());
}
codePointAtPos(e) {
let t = this.input.charCodeAt(e);
if ((t & 64512) === 55296 && ++e < this.input.length) {
let s = this.input.charCodeAt(e);
(s & 64512) === 56320 && (t = 65536 + ((t & 1023) << 10) + (s & 1023));
}
return t;
}
setStrict(e) {
this.state.strict = e, e && (this.state.strictErrors.forEach(([t, s]) => this.raise(t, s)), this.state.strictErrors.clear());
}
curContext() {
return this.state.context[this.state.context.length - 1];
}
nextToken() {
if (this.skipSpace(), this.state.start = this.state.pos, this.isLookahead || (this.state.startLoc = this.state.curPosition()), this.state.pos >= this.length) {
this.finishToken(135);
return;
}
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
}
skipBlockComment(e) {
let t;
this.isLookahead || (t = this.state.curPosition());
let s = this.state.pos, i = this.input.indexOf(e, s + 2);
if (i === -1) throw this.raise(l.UnterminatedComment, this.state.curPosition());
for (this.state.pos = i + e.length, St.lastIndex = s + 2; St.test(this.input) && St.lastIndex <= i; ) ++this.state.curLine, this.state.lineStart = St.lastIndex;
if (this.isLookahead) return;
let r = { type: "CommentBlock", value: this.input.slice(s + 2, i), start: this.sourceToOffsetPos(s), end: this.sourceToOffsetPos(i + e.length), loc: new st(t, this.state.curPosition()) };
return this.optionFlags & 512 && this.pushToken(r), r;
}
skipLineComment(e) {
let t = this.state.pos, s;
this.isLookahead || (s = this.state.curPosition());
let i = this.input.charCodeAt(this.state.pos += e);
if (this.state.pos < this.length) for (; !tt(i) && ++this.state.pos < this.length; ) i = this.input.charCodeAt(this.state.pos);
if (this.isLookahead) return;
let r = this.state.pos, o = { type: "CommentLine", value: this.input.slice(t + e, r), start: this.sourceToOffsetPos(t), end: this.sourceToOffsetPos(r), loc: new st(s, this.state.curPosition()) };
return this.optionFlags & 512 && this.pushToken(o), o;
}
skipSpace() {
let e = this.state.pos, t = this.optionFlags & 8192 ? [] : null;
t: for (; this.state.pos < this.length; ) {
let s = this.input.charCodeAt(this.state.pos);
switch (s) {
case 32:
case 160:
case 9:
++this.state.pos;
break;
case 13:
this.input.charCodeAt(this.state.pos + 1) === 10 && ++this.state.pos;
case 10:
case 8232:
case 8233:
++this.state.pos, ++this.state.curLine, this.state.lineStart = this.state.pos;
break;
case 47:
switch (this.input.charCodeAt(this.state.pos + 1)) {
case 42: {
let i = this.skipBlockComment("*/");
i !== void 0 && (this.addComment(i), t?.push(i));
break;
}
case 47: {
let i = this.skipLineComment(2);
i !== void 0 && (this.addComment(i), t?.push(i));
break;
}
default:
break t;
}
break;
default:
if (Wi(s)) ++this.state.pos;
else if (s === 45 && !this.inModule && this.optionFlags & 16384) {
let i = this.state.pos;
if (this.input.charCodeAt(i + 1) === 45 && this.input.charCodeAt(i + 2) === 62 && (e === 0 || this.state.lineStart > e)) {
let r = this.skipLineComment(3);
r !== void 0 && (this.addComment(r), t?.push(r));
} else break t;
} else if (s === 60 && !this.inModule && this.optionFlags & 16384) {
let i = this.state.pos;
if (this.input.charCodeAt(i + 1) === 33 && this.input.charCodeAt(i + 2) === 45 && this.input.charCodeAt(i + 3) === 45) {
let r = this.skipLineComment(4);
r !== void 0 && (this.addComment(r), t?.push(r));
} else break t;
} else break t;
}
}
if (t?.length > 0) {
let s = this.state.pos, i = { start: this.sourceToOffsetPos(e), end: this.sourceToOffsetPos(s), comments: t, leadingNode: null, trailingNode: null, containingNode: null };
this.state.commentStack.push(i);
}
}
finishToken(e, t) {
this.state.end = this.state.pos, this.state.endLoc = this.state.curPosition();
let s = this.state.type;
this.state.type = e, this.state.value = t, this.isLookahead || this.updateContext(s);
}
replaceToken(e) {
this.state.type = e, this.updateContext();
}
readToken_numberSign() {
if (this.state.pos === 0 && this.readToken_interpreter()) return;
let e = this.state.pos + 1, t = this.codePointAtPos(e);
if (t >= 48 && t <= 57) throw this.raise(l.UnexpectedDigitAfterHash, this.state.curPosition());
R(t) ? (++this.state.pos, this.finishToken(134, this.readWord1(t))) : t === 92 ? (++this.state.pos, this.finishToken(134, this.readWord1())) : this.finishOp(23, 1);
}
readToken_dot() {
let e = this.input.charCodeAt(this.state.pos + 1);
if (e >= 48 && e <= 57) {
this.readNumber(true);
return;
}
e === 46 && this.input.charCodeAt(this.state.pos + 2) === 46 ? (this.state.pos += 3, this.finishToken(17)) : (++this.state.pos, this.finishToken(12));
}
readToken_slash() {
this.input.charCodeAt(this.state.pos + 1) === 61 ? this.finishOp(27, 2) : this.finishOp(52, 1);
}
readToken_interpreter() {
if (this.state.pos !== 0 || this.length < 2) return false;
let e = this.input.charCodeAt(this.state.pos + 1);
if (e !== 33) return false;
let t = this.state.pos;
for (this.state.pos += 1; !tt(e) && ++this.state.pos < this.length; ) e = this.input.charCodeAt(this.state.pos);
let s = this.input.slice(t + 2, this.state.pos);
return this.finishToken(24, s), true;
}
readToken_mult_modulo(e) {
let t = e === 42 ? 51 : 50, s = 1, i = this.input.charCodeAt(this.state.pos + 1);
e === 42 && i === 42 && (s++, i = this.input.charCodeAt(this.state.pos + 2), t = 53), i === 61 && !this.state.inType && (s++, t = e === 37 ? 29 : 26), this.finishOp(t, s);
}
readToken_pipe_amp(e) {
let t = this.input.charCodeAt(this.state.pos + 1);
if (t === e) {
this.input.charCodeAt(this.state.pos + 2) === 61 ? this.finishOp(26, 3) : this.finishOp(e === 124 ? 37 : 38, 2);
return;
}
if (e === 124 && t === 62) {
this.finishOp(35, 2);
return;
}
if (t === 61) {
this.finishOp(26, 2);
return;
}
this.finishOp(e === 124 ? 39 : 41, 1);
}
readToken_caret() {
let e = this.input.charCodeAt(this.state.pos + 1);
e === 61 && !this.state.inType ? this.finishOp(28, 2) : e === 94 && this.hasPlugin(["pipelineOperator", { proposal: "hack", topicToken: "^^" }]) ? (this.finishOp(33, 2), this.input.codePointAt(this.state.pos) === 94 && this.unexpected()) : this.finishOp(40, 1);
}
readToken_atSign() {
this.input.charCodeAt(this.state.pos + 1) === 64 && this.hasPlugin(["pipelineOperator", { proposal: "hack", topicToken: "@@" }]) ? this.finishOp(34, 2) : this.finishOp(22, 1);
}
readToken_plus_min(e) {
let t = this.input.charCodeAt(this.state.pos + 1);
if (t === e) {
this.finishOp(30, 2);
return;
}
t === 61 ? this.finishOp(26, 2) : this.finishOp(49, 1);
}
readToken_lt() {
let { pos: e } = this.state, t = this.input.charCodeAt(e + 1);
if (t === 60) {
if (this.input.charCodeAt(e + 2) === 61) {
this.finishOp(26, 3);
return;
}
this.finishOp(47, 2);
return;
}
if (t === 61) {
this.finishOp(45, 2);
return;
}
this.finishOp(43, 1);
}
readToken_gt() {
let { pos: e } = this.state, t = this.input.charCodeAt(e + 1);
if (t === 62) {
let s = this.input.charCodeAt(e + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(e + s) === 61) {
this.finishOp(26, s + 1);
return;
}
this.finishOp(48, s);
return;
}
if (t === 61) {
this.finishOp(45, 2);
return;
}
this.finishOp(44, 1);
}
readToken_eq_excl(e) {
let t = this.input.charCodeAt(this.state.pos + 1);
if (t === 61) {
this.finishOp(42, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
return;
}
if (e === 61 && t === 62) {
this.state.pos += 2, this.finishToken(15);
return;
}
this.finishOp(e === 61 ? 25 : 31, 1);
}
readToken_question() {
let e = this.input.charCodeAt(this.state.pos + 1), t = this.input.charCodeAt(this.state.pos + 2);
e === 63 ? t === 61 ? this.finishOp(26, 3) : this.finishOp(36, 2) : e === 46 && !(t >= 48 && t <= 57) ? (this.state.pos += 2, this.finishToken(14)) : (++this.state.pos, this.finishToken(13));
}
getTokenFromCode(e) {
switch (e) {
case 46:
this.readToken_dot();
return;
case 40:
++this.state.pos, this.finishToken(6);
return;
case 41:
++this.state.pos, this.finishToken(7);
return;
case 59:
++this.state.pos, this.finishToken(9);
return;
case 44:
++this.state.pos, this.finishToken(8);
return;
case 91:
++this.state.pos, this.finishToken(0);
return;
case 93:
++this.state.pos, this.finishToken(1);
return;
case 123:
++this.state.pos, this.finishToken(2);
return;
case 125:
++this.state.pos, this.finishToken(4);
return;
case 58:
this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58 ? this.finishOp(11, 2) : (++this.state.pos, this.finishToken(10));
return;
case 63:
this.readToken_question();
return;
case 96:
this.readTemplateToken();
return;
case 48: {
let t = this.input.charCodeAt(this.state.pos + 1);
if (t === 120 || t === 88) {
this.readRadixNumber(16);
return;
}
if (t === 111 || t === 79) {
this.readRadixNumber(8);
return;
}
if (t === 98 || t === 66) {
this.readRadixNumber(2);
return;
}
}
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
this.readNumber(false);
return;
case 34:
case 39:
this.readString(e);
return;
case 47:
this.readToken_slash();
return;
case 37:
case 42:
this.readToken_mult_modulo(e);
return;
case 124:
case 38:
this.readToken_pipe_amp(e);
return;
case 94:
this.readToken_caret();
return;
case 43:
case 45:
this.readToken_plus_min(e);
return;
case 60:
this.readToken_lt();
return;
case 62:
this.readToken_gt();
return;
case 61:
case 33:
this.readToken_eq_excl(e);
return;
case 126:
this.finishOp(32, 1);
return;
case 64:
this.readToken_atSign();
return;
case 35:
this.readToken_numberSign();
return;
case 92:
this.readWord();
return;
default:
if (R(e)) {
this.readWord(e);
return;
}
}
throw this.raise(l.InvalidOrUnexpectedToken, this.state.curPosition(), { unexpected: String.fromCodePoint(e) });
}
finishOp(e, t) {
let s = this.input.slice(this.state.pos, this.state.pos + t);
this.state.pos += t, this.finishToken(e, s);
}
readRegexp() {
let e = this.state.startLoc, t = this.state.start + 1, s, i, { pos: r } = this.state;
for (; ; ++r) {
if (r >= this.length) throw this.raise(l.UnterminatedRegExp, O(e, 1));
let c = this.input.charCodeAt(r);
if (tt(c)) throw this.raise(l.UnterminatedRegExp, O(e, 1));
if (s) s = false;
else {
if (c === 91) i = true;
else if (c === 93 && i) i = false;
else if (c === 47 && !i) break;
s = c === 92;
}
}
let n = this.input.slice(t, r);
++r;
let o = "", h = () => O(e, r + 2 - t);
for (; r < this.length; ) {
let c = this.codePointAtPos(r), p = String.fromCharCode(c);
if (tr.has(c)) c === 118 ? o.includes("u") && this.raise(l.IncompatibleRegExpUVFlags, h()) : c === 117 && o.includes("v") && this.raise(l.IncompatibleRegExpUVFlags, h()), o.includes(p) && this.raise(l.DuplicateRegExpFlags, h());
else if (W(c) || c === 92) this.raise(l.MalformedRegExpFlags, h());
else break;
++r, o += p;
}
this.state.pos = r, this.finishToken(133, { pattern: n, flags: o });
}
readInt(e, t, s = false, i = true) {
let { n: r, pos: n } = ns(this.input, this.state.pos, this.state.lineStart, this.state.curLine, e, t, s, i, this.errorHandlers_readInt, false);
return this.state.pos = n, r;
}
readRadixNumber(e) {
let t = this.state.pos, s = this.state.curPosition(), i = false;
this.state.pos += 2;
let r = this.readInt(e);
if (r == null && this.raise(l.InvalidDigit, O(s, 2), { radix: e }), this.input.charCodeAt(this.state.pos) === 110 && (++this.state.pos, i = true), R(this.codePointAtPos(this.state.pos))) throw this.raise(l.NumberIdentifier, this.state.curPosition());
if (i) {
let o = this.input.slice(t, this.state.pos).replace(/[_n]/g, "");
this.finishToken(132, o);
return;
}
this.finishToken(131, r);
}
readNumber(e) {
let t = this.state.pos, s = this.state.curPosition(), i = false, r = false, n = false;
!e && this.readInt(10) === null && this.raise(l.InvalidNumber, this.state.curPosition());
let o = this.state.pos - t >= 2 && this.input.charCodeAt(t) === 48;
if (o) {
let f = this.input.slice(t, this.state.pos);
if (this.recordStrictModeErrors(l.StrictOctalLiteral, s), !this.state.strict) {
let d = f.indexOf("_");
d > 0 && this.raise(l.ZeroDigitNumericSeparator, O(s, d));
}
n = o && !/[89]/.test(f);
}
let h = this.input.charCodeAt(this.state.pos);
h === 46 && !n && (++this.state.pos, this.readInt(10), i = true, h = this.input.charCodeAt(this.state.pos)), (h === 69 || h === 101) && !n && (h = this.input.charCodeAt(++this.state.pos), (h === 43 || h === 45) && ++this.state.pos, this.readInt(10) === null && this.raise(l.InvalidOrMissingExponent, s), i = true, h = this.input.charCodeAt(this.state.pos));
let c = U(0, this.input.slice(t, this.state.pos), "_", "");
if (h === 110 && ((i || o) && this.raise(l.InvalidBigIntLiteral, s), ++this.state.pos, r = true), R(this.codePointAtPos(this.state.pos))) throw this.raise(l.NumberIdentifier, this.state.curPosition());
if (r) {
this.finishToken(132, c);
return;
}
let p = n ? parseInt(c, 8) : parseFloat(c);
this.finishToken(131, p);
}
readCodePoint(e) {
let { code: t, pos: s } = os(this.input, this.state.pos, this.state.lineStart, this.state.curLine, e, this.errorHandlers_readCodePoint);
return this.state.pos = s, t;
}
readString(e) {
let { str: t, pos: s, curLine: i, lineStart: r } = $e(e === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
this.state.pos = s + 1, this.state.lineStart = r, this.state.curLine = i, this.finishToken(130, t);
}
readTemplateContinuation() {
this.match(4) || this.unexpected(null, 4), this.state.pos--, this.readTemplateToken();
}
readTemplateToken() {
let e = this.input[this.state.pos], { str: t, firstInvalidLoc: s, pos: i, curLine: r, lineStart: n } = $e("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
this.state.pos = i + 1, this.state.lineStart = n, this.state.curLine = r, s && (this.state.firstInvalidTemplateEscapePos = new L(s.curLine, s.pos - s.lineStart, this.sourceToOffsetPos(s.pos))), this.input.codePointAt(i) === 96 ? this.finishToken(20, s ? null : e + t + "`") : (this.state.pos++, this.finishToken(21, s ? null : e + t + "${"));
}
recordStrictModeErrors(e, t) {
let s = t.index;
this.state.strict && !this.state.strictErrors.has(s) ? this.raise(e, t) : this.state.strictErrors.set(s, [e, t]);
}
readWord1(e) {
this.state.containsEsc = false;
let t = "", s = this.state.pos, i = this.state.pos;
for (e !== void 0 && (this.state.pos += e <= 65535 ? 1 : 2); this.state.pos < this.length; ) {
let r = this.codePointAtPos(this.state.pos);
if (W(r)) this.state.pos += r <= 65535 ? 1 : 2;
else if (r === 92) {
this.state.containsEsc = true, t += this.input.slice(i, this.state.pos);
let n = this.state.curPosition(), o = this.state.pos === s ? R : W;
if (this.input.charCodeAt(++this.state.pos) !== 117) {
this.raise(l.MissingUnicodeEscape, this.state.curPosition()), i = this.state.pos - 1;
continue;
}
++this.state.pos;
let h = this.readCodePoint(true);
h !== null && (o(h) || this.raise(l.EscapedCharNotAnIdentifier, n), t += String.fromCodePoint(h)), i = this.state.pos;
} else break;
}
return t + this.input.slice(i, this.state.pos);
}
readWord(e) {
let t = this.readWord1(e), s = Pe.get(t);
s !== void 0 ? this.finishToken(s, z(s)) : this.finishToken(128, t);
}
checkKeywordEscapes() {
let { type: e } = this.state;
Ee(e) && this.state.containsEsc && this.raise(l.InvalidEscapedReservedWord, this.state.startLoc, { reservedWord: z(e) });
}
raise(e, t, s = {}) {
let i = t instanceof L ? t : typeof t == "number" ? this.getLoc(t) : this.optionFlags & 256 ? t.loc.start : this.getLoc(t.start), r = t instanceof L ? i.index : typeof t == "number" ? t : t.start, n = e(i, r, s);
if (!(this.optionFlags & 4096)) throw n;
return this.isLookahead || this.state.errors.push(n), n;
}
raiseOverwrite(e, t, s = {}) {
let i = t instanceof L ? t : this.optionFlags & 256 ? t.loc.start : this.getLoc(t.start), r = t instanceof L ? i.index : t.start, n = this.state.errors;
for (let o = n.length - 1; o >= 0; o--) {
let h = n[o];
if (h.pos === r) return n[o] = e(i, r, s);
if (h.pos < r) break;
}
return this.raise(e, i, s);
}
updateContext(e) {
}
unexpected(e, t) {
throw this.raise(l.UnexpectedToken, e ?? this.state.startLoc, { expected: t ? z(t) : null });
}
expectPlugin(e, t) {
if (this.hasPlugin(e)) return true;
throw this.raise(l.MissingPlugin, t ?? this.state.startLoc, { missingPlugin: [e] });
}
expectOnePlugin(e) {
if (!e.some((t) => this.hasPlugin(t))) throw this.raise(l.MissingOneOfPlugins, this.state.startLoc, { missingPlugin: e });
}
errorBuilder(e) {
return (t, s, i) => {
this.raise(e, ut(t, s, i));
};
}
errorHandlers_readInt = { invalidDigit: (e, t, s, i) => this.optionFlags & 4096 ? (this.raise(l.InvalidDigit, ut(e, t, s), { radix: i }), true) : false, numericSeparatorInEscapeSequence: this.errorBuilder(l.NumericSeparatorInEscapeSequence), unexpectedNumericSeparator: this.errorBuilder(l.UnexpectedNumericSeparator) };
errorHandlers_readCodePoint = { ...this.errorHandlers_readInt, invalidEscapeSequence: this.errorBuilder(l.InvalidEscapeSequence), invalidCodePoint: this.errorBuilder(l.InvalidCodePoint) };
errorHandlers_readStringContents_string = { ...this.errorHandlers_readCodePoint, strictNumericEscape: (e, t, s) => {
this.recordStrictModeErrors(l.StrictNumericEscape, ut(e, t, s));
}, unterminated: (e, t, s) => {
throw this.raise(l.UnterminatedString, ut(e - 1, t, s));
} };
errorHandlers_readStringContents_template = { ...this.errorHandlers_readCodePoint, strictNumericEscape: this.errorBuilder(l.StrictNumericEscape), unterminated: (e, t, s) => {
throw this.raise(l.UnterminatedTemplate, ut(e, t, s));
} };
};
oe = class {
privateNames = /* @__PURE__ */ new Set();
loneAccessors = /* @__PURE__ */ new Map();
undefinedPrivateNames = /* @__PURE__ */ new Map();
};
he = class {
parser;
stack = [];
constructor(e) {
this.parser = e;
}
current() {
return this.stack[this.stack.length - 1];
}
enter() {
this.stack.push(new oe());
}
exit() {
let e = this.stack.pop(), t = this.current();
for (let [s, i] of Array.from(e.undefinedPrivateNames)) t ? t.undefinedPrivateNames.has(s) || t.undefinedPrivateNames.set(s, i) : this.parser.raise(l.InvalidPrivateFieldResolution, i, { identifierName: s });
}
declarePrivateName(e, t, s) {
let { privateNames: i, loneAccessors: r, undefinedPrivateNames: n } = this.current(), o = i.has(e);
if (t & 3) {
let h = o && r.get(e);
if (h) {
let c = h & 4, p = t & 4, f = h & 3, d = t & 3;
o = f === d || c !== p, o || r.delete(e);
} else o || r.set(e, t);
}
o && this.parser.raise(l.PrivateNameRedeclaration, s, { identifierName: e }), i.add(e), n.delete(e);
}
usePrivateName(e, t) {
let s;
for (s of this.stack) if (s.privateNames.has(e)) return;
s ? s.undefinedPrivateNames.set(e, t) : this.parser.raise(l.InvalidPrivateFieldResolution, t, { identifierName: e });
}
};
it = class {
constructor(e = 0) {
this.type = e;
}
canBeArrowParameterDeclaration() {
return this.type === 2 || this.type === 1;
}
isCertainlyParameterDeclaration() {
return this.type === 3;
}
};
vt = class extends it {
declarationErrors = /* @__PURE__ */ new Map();
constructor(e) {
super(e);
}
recordDeclarationError(e, t) {
this.declarationErrors.set(t, e);
}
clearDeclarationError(e) {
this.declarationErrors.delete(e);
}
iterateErrors(e) {
this.declarationErrors.forEach(e);
}
};
ce = class {
parser;
stack = [new it()];
constructor(e) {
this.parser = e;
}
enter(e) {
this.stack.push(e);
}
exit() {
this.stack.pop();
}
recordParameterInitializerError(e, t) {
let { stack: s } = this, i = s.length - 1, r = s[i];
for (; !r.isCertainlyParameterDeclaration(); ) {
if (r.canBeArrowParameterDeclaration()) r.recordDeclarationError(e, t);
else return;
r = s[--i];
}
this.parser.raise(e, t);
}
recordArrowParameterBindingError(e, t) {
let { stack: s } = this, i = s[s.length - 1], r = t.start;
if (i.isCertainlyParameterDeclaration()) this.parser.raise(e, r);
else if (i.canBeArrowParameterDeclaration()) i.recordDeclarationError(e, r);
else return;
}
recordAsyncArrowParametersError(e) {
let { stack: t } = this, s = t.length - 1, i = t[s];
for (; i.canBeArrowParameterDeclaration(); ) i.type === 2 && i.recordDeclarationError(l.AwaitBindingIdentifier, e), i = t[--s];
}
validateAsPattern() {
let { stack: e } = this, t = e[e.length - 1];
t.canBeArrowParameterDeclaration() && t.iterateErrors((s, i) => {
this.parser.raise(s, i);
let r = e.length - 2, n = e[r];
for (; n.canBeArrowParameterDeclaration(); ) n.clearDeclarationError(i), n = e[--r];
});
}
};
le = class {
stacks = [];
enter(e) {
this.stacks.push(e);
}
exit() {
this.stacks.pop();
}
currentFlags() {
return this.stacks[this.stacks.length - 1];
}
get hasAwait() {
return (this.currentFlags() & 2) > 0;
}
get hasYield() {
return (this.currentFlags() & 1) > 0;
}
get hasReturn() {
return (this.currentFlags() & 4) > 0;
}
get hasIn() {
return (this.currentFlags() & 8) > 0;
}
get inFSharpPipelineDirectBody() {
return (this.currentFlags() & 16) === 0;
}
};
pe = class extends ne {
addExtra(e, t, s, i = true) {
if (!e) return;
let { extra: r } = e;
r == null && (r = {}, e.extra = r), i ? r[t] = s : Object.defineProperty(r, t, { enumerable: i, value: s });
}
isContextual(e) {
return this.state.type === e && !this.state.containsEsc;
}
isUnparsedContextual(e, t) {
if (this.input.startsWith(t, e)) {
let s = this.input.charCodeAt(e + t.length);
return !(W(s) || (s & 64512) === 55296);
}
return false;
}
isLookaheadContextual(e) {
let t = this.nextTokenStart();
return this.isUnparsedContextual(t, e);
}
eatContextual(e) {
return this.isContextual(e) ? (this.next(), true) : false;
}
expectContextual(e, t) {
if (!this.eatContextual(e)) {
if (t != null) throw this.raise(t, this.state.startLoc);
this.unexpected(null, e);
}
}
canInsertSemicolon() {
return this.match(135) || this.match(4) || this.hasPrecedingLineBreak();
}
hasPrecedingLineBreak() {
return Ve(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
}
hasFollowingLineBreak() {
return Ve(this.input, this.state.end, this.nextTokenStart());
}
isLineTerminator() {
return this.eat(9) || this.canInsertSemicolon();
}
semicolon(e = true) {
(e ? this.isLineTerminator() : this.eat(9)) || this.raise(l.MissingSemicolon, this.state.lastTokEndLoc);
}
expect(e, t) {
this.eat(e) || this.unexpected(t, e);
}
tryParse(e, t = this.state.clone()) {
let s = { node: null };
try {
let i = e((r = null) => {
throw s.node = r, s;
});
if (this.state.errors.length > t.errors.length) {
let r = this.state;
return this.state = t, this.state.tokensLength = r.tokensLength, { node: i, error: r.errors[t.errors.length], thrown: false, aborted: false, failState: r };
}
return { node: i, error: null, thrown: false, aborted: false, failState: null };
} catch (i) {
let r = this.state;
if (this.state = t, i instanceof SyntaxError) return { node: null, error: i, thrown: true, aborted: false, failState: r };
if (i === s) return { node: s.node, error: null, thrown: false, aborted: true, failState: r };
throw i;
}
}
checkExpressionErrors(e, t) {
if (!e) return false;
let { shorthandAssignLoc: s, doubleProtoLoc: i, privateKeyLoc: r, optionalParametersLoc: n, voidPatternLoc: o } = e, h = !!s || !!i || !!n || !!r || !!o;
if (!t) return h;
s != null && this.raise(l.InvalidCoverInitializedName, s), i != null && this.raise(l.DuplicateProto, i), r != null && this.raise(l.UnexpectedPrivateField, r), n != null && this.unexpected(n), o != null && this.raise(l.InvalidCoverDiscardElement, o);
}
isLiteralPropertyName() {
return Ye(this.state.type);
}
isPrivateName(e) {
return e.type === "PrivateName";
}
getPrivateNameSV(e) {
return e.id.name;
}
hasPropertyAsPrivateName(e) {
return (e.type === "MemberExpression" || e.type === "OptionalMemberExpression") && this.isPrivateName(e.property);
}
isObjectProperty(e) {
return e.type === "ObjectProperty";
}
isObjectMethod(e) {
return e.type === "ObjectMethod";
}
initializeScopes(e = this.options.sourceType === "module") {
let t = this.state.labels;
this.state.labels = [];
let s = this.exportedIdentifiers;
this.exportedIdentifiers = /* @__PURE__ */ new Set();
let i = this.inModule;
this.inModule = e;
let r = this.scope, n = this.getScopeHandler();
this.scope = new n(this, e);
let o = this.prodParam;
this.prodParam = new le();
let h = this.classScope;
this.classScope = new he(this);
let c = this.expressionScope;
return this.expressionScope = new ce(this), () => {
this.state.labels = t, this.exportedIdentifiers = s, this.inModule = i, this.scope = r, this.prodParam = o, this.classScope = h, this.expressionScope = c;
};
}
enterInitialScopes() {
let e = 0;
(this.inModule || this.optionFlags & 1) && (e |= 2), this.optionFlags & 32 && (e |= 1);
let t = !this.inModule && this.options.sourceType === "commonjs";
(t || this.optionFlags & 2) && (e |= 4), this.prodParam.enter(e);
let s = t ? 514 : 1;
this.optionFlags & 4 && (s |= 512), this.optionFlags & 16 && (s |= 48), this.scope.enter(s);
}
checkDestructuringPrivate(e) {
let { privateKeyLoc: t } = e;
t !== null && this.expectPlugin("destructuringPrivate", t);
}
};
et = class {
shorthandAssignLoc = null;
doubleProtoLoc = null;
privateKeyLoc = null;
optionalParametersLoc = null;
voidPatternLoc = null;
};
K = class {
constructor(e, t, s, i) {
this.start = s, this.end = 0, i !== void 0 && (this.loc = new st(i)), e & 128 && (this.range = [s, 0]), i !== void 0 && t && (this.loc.filename = t);
}
type = "";
};
ze = K.prototype;
ue = class extends pe {
createPosition(e) {
return e;
}
startNode() {
let { startLoc: e } = this.state;
return this.setLoc(e), this.startNodeAt(e);
}
startNodeAt(e) {
let { optionFlags: t, filename: s } = this;
return t & 256 ? new K(t, s, e.index, this.createPosition(e)) : new K(t, s, e.index);
}
startNodeAtNode(e) {
let { optionFlags: t, filename: s } = this;
return t & 256 ? new K(t, s, e.start, e.loc.start) : new K(t, s, e.start);
}
finishNode(e, t) {
return this.finishNodeAt(e, t, this.state.lastTokEndLoc);
}
finishNodeAt(e, t, s) {
e.type = t, e.end = s.index;
let { optionFlags: i } = this;
return i & 256 && (e.loc.end = this.createPosition(s)), i & 128 && (e.range[1] = s.index), i & 8192 && this.processComment(e), e;
}
finishNodeAtNode(e, t, s) {
e.type = t, e.end = s.end;
let { optionFlags: i } = this;
return i & 256 && (e.loc.end = s.loc.end), i & 128 && (e.range[1] = e.end), i & 8192 && this.processComment(e), e;
}
resetStartLocation(e, t) {
e.start = t.index;
let { optionFlags: s } = this;
s & 256 && (e.loc.start = this.createPosition(t)), s & 128 && (e.range[0] = t.index);
}
resetEndLocation(e, t = this.state.lastTokEndLoc) {
e.end = t.index;
let { optionFlags: s } = this;
s & 256 && (e.loc.end = this.createPosition(t)), s & 128 && (e.range[1] = t.index);
}
resetStartLocationFromNode(e, t) {
e.start = t.start;
let { optionFlags: s } = this;
s & 256 && (e.loc.start = t.loc.start), s & 128 && (e.range[0] = t.start);
}
resetEndLocationFromNode(e, t) {
e.end = t.end;
let { optionFlags: s } = this;
s & 256 && (e.loc.end = t.loc.end), s & 128 && (e.range[1] = t.end);
}
castNodeTo(e, t) {
return e.type = t, e;
}
cloneIdentifier(e) {
let { type: t, start: s, end: i, loc: r, range: n, name: o } = e, h = Object.create(ze);
return h.type = t, h.start = s, h.end = i, h.loc = r, h.range = n, h.name = o, e.extra && (h.extra = e.extra), h;
}
cloneStringLiteral(e) {
let { type: t, start: s, end: i, loc: r, range: n, extra: o } = e, h = Object.create(ze);
return h.type = t, h.start = s, h.end = i, h.loc = r, h.range = n, h.extra = o, h.value = e.value, h;
}
};
fe = (a2) => a2.type === "ParenthesizedExpression" ? fe(a2.expression) : a2;
de = class extends ue {
toAssignable(e, t = false) {
let s;
switch ((e.type === "ParenthesizedExpression" || e.extra?.parenthesized) && (s = fe(e), t ? s.type === "Identifier" ? this.expressionScope.recordArrowParameterBindingError(l.InvalidParenthesizedAssignment, e) : s.type !== "CallExpression" && s.type !== "MemberExpression" && !this.isOptionalMemberExpression(s) && this.raise(l.InvalidParenthesizedAssignment, e) : this.raise(l.InvalidParenthesizedAssignment, e)), e.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":
case "VoidPattern":
break;
case "ObjectExpression":
this.castNodeTo(e, "ObjectPattern");
for (let i = 0, r = e.properties.length, n = r - 1; i < r; i++) {
let o = e.properties[i], h = i === n;
this.toAssignableObjectExpressionProp(o, h, t), h && o.type === "RestElement" && e.extra?.trailingCommaLoc && this.raise(l.RestTrailingComma, e.extra.trailingCommaLoc);
}
break;
case "ObjectProperty": {
let { key: i, value: r } = e;
this.isPrivateName(i) && this.classScope.usePrivateName(this.getPrivateNameSV(i), i.start), this.toAssignable(r, t);
break;
}
case "SpreadElement":
throw new Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");
case "ArrayExpression":
this.castNodeTo(e, "ArrayPattern"), this.toAssignableList(e.elements, e.extra?.trailingCommaLoc, t);
break;
case "AssignmentExpression":
e.operator !== "=" && this.raise(l.MissingEqInAssignment, this.optionFlags & 256 ? e.left.loc.end : e.left), this.castNodeTo(e, "AssignmentPattern"), delete e.operator, e.left.type === "VoidPattern" && this.raise(l.VoidPatternInitializer, e.left), this.toAssignable(e.left, t);
break;
case "ParenthesizedExpression":
this.toAssignable(s, t);
break;
}
}
toAssignableObjectExpressionProp(e, t, s) {
if (e.type === "ObjectMethod") this.raise(e.kind === "get" || e.kind === "set" ? l.PatternHasAccessor : l.PatternHasMethod, e.key);
else if (e.type === "SpreadElement") {
this.castNodeTo(e, "RestElement");
let i = e.argument;
this.checkToRestConversion(i, false), this.toAssignable(i, s), t || this.raise(l.RestTrailingComma, e);
} else this.toAssignable(e, s);
}
toAssignableList(e, t, s) {
let i = e.length - 1;
for (let r = 0; r <= i; r++) {
let n = e[r];
n && (this.toAssignableListItem(e, r, s), n.type === "RestElement" && (r < i ? this.raise(l.RestTrailingComma, n) : t && this.raise(l.RestTrailingComma, t)));
}
}
toAssignableListItem(e, t, s) {
let i = e[t];
if (i.type === "SpreadElement") {
this.castNodeTo(i, "RestElement");
let r = i.argument;
this.checkToRestConversion(r, true), this.toAssignable(r, s);
} else this.toAssignable(i, s);
}
isAssignable(e, t) {
switch (e.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":
case "VoidPattern":
return true;
case "ObjectExpression": {
let s = e.properties.length - 1;
return e.properties.every((i, r) => i.type !== "ObjectMethod" && (r === s || i.type !== "SpreadElement") && this.isAssignable(i));
}
case "ObjectProperty":
return this.isAssignable(e.value);
case "SpreadElement":
return this.isAssignable(e.argument);
case "ArrayExpression":
return e.elements.every((s) => s === null || this.isAssignable(s));
case "AssignmentExpression":
return e.operator === "=";
case "ParenthesizedExpression":
return this.isAssignable(e.expression);
case "MemberExpression":
case "OptionalMemberExpression":
return !t;
default:
return false;
}
}
toReferencedList(e, t) {
return e;
}
parseSpread(e) {
let t = this.startNode();
return this.next(), t.argument = this.parseMaybeAssignAllowIn(e, void 0), this.finishNode(t, "SpreadElement");
}
parseRestBinding() {
let e = this.startNode();
this.next();
let t = this.parseBindingAtom();
return t.type === "VoidPattern" && this.raise(l.UnexpectedVoidPattern, t), e.argument = t, this.finishNode(e, "RestElement");
}
parseBindingAtom() {
switch (this.state.type) {
case 0: {
let e = this.startNode();
return this.next(), e.elements = this.parseBindingList(1, 93, 1), this.finishNode(e, "ArrayPattern");
}
case 2:
return this.parseObjectLike(4, true);
case 84:
return this.parseVoidPattern(null);
}
return this.parseIdentifier();
}
parseBindingList(e, t, s) {
let i = s & 1, r = [], n = true;
for (; !this.eat(e); ) if (n ? n = false : this.expect(8), i && this.match(8)) r.push(null);
else {
if (this.eat(e)) break;
if (this.match(17)) {
let o = this.parseRestBinding();
if (s & 2 && (o = this.parseFunctionParamType(o)), r.push(o), !this.checkCommaAfterRest(t)) {
this.expect(e);
break;
}
} else {
let o = [];
if (s & 2) for (this.match(22) && this.hasPlugin("decorators") && this.raise(l.UnsupportedParameterDecorator, this.state.startLoc); this.match(22); ) o.push(this.parseDecorator());
r.push(this.parseBindingElement(s, o));
}
}
return r;
}
parseBindingRestProperty(e) {
return this.next(), this.hasPlugin("discardBinding") && this.match(84) ? (e.argument = this.parseVoidPattern(null), this.raise(l.UnexpectedVoidPattern, e.argument)) : e.argument = this.parseIdentifier(), this.checkCommaAfterRest(125), this.finishNode(e, "RestElement");
}
parseBindingProperty() {
let { type: e, startLoc: t } = this.state;
if (e === 17) return this.parseBindingRestProperty(this.startNode());
let s = this.startNode();
return e === 134 ? (this.expectPlugin("destructuringPrivate", t), this.classScope.usePrivateName(this.state.value, t), s.key = this.parsePrivateName()) : this.parsePropertyName(s), s.method = false, this.parseObjPropValue(s, t, false, false, true, false);
}
parseBindingElement(e, t) {
let { startLoc: s } = this.state, i = this.parseMaybeDefault();
return e & 2 && this.parseFunctionParamType(i), t.length && (i.decorators = t, this.resetStartLocationFromNode(i, t[0])), this.parseMaybeDefault(s, i);
}
parseFunctionParamType(e) {
return e;
}
parseMaybeDefault(e, t) {
if (e ?? (e = this.state.startLoc), t = t ?? this.parseBindingAtom(), !this.eat(25)) return t;
let s = this.startNodeAt(e);
return t.type === "VoidPattern" && this.raise(l.VoidPatternInitializer, t), s.left = t, s.right = this.parseMaybeAssignAllowIn(), this.finishNode(s, "AssignmentPattern");
}
isValidLVal(e, t, s, i) {
switch (e) {
case "AssignmentPattern":
return "left";
case "RestElement":
return "argument";
case "ObjectProperty":
return "value";
case "ParenthesizedExpression":
return "expression";
case "ArrayPattern":
return "elements";
case "ObjectPattern":
return "properties";
case "VoidPattern":
return true;
case "CallExpression":
if (!t && !this.state.strict && this.optionFlags & 16384) return true;
}
return false;
}
isOptionalMemberExpression(e) {
return e.type === "OptionalMemberExpression";
}
checkLVal(e, t, s = 64, i = false, r = false, n = false, o = false) {
let h = e.type;
if (this.isObjectMethod(e)) return;
let c = this.isOptionalMemberExpression(e);
if (c || h === "MemberExpression") {
c && (this.expectPlugin("optionalChainingAssign", e.start), t.type !== "AssignmentExpression" && this.raise(l.InvalidLhsOptionalChaining, e, { ancestor: t })), s !== 64 && this.raise(l.InvalidPropertyBindingPattern, e);
return;
}
if (h === "Identifier") {
this.checkIdentifier(e, s, r);
let { name: v } = e;
i && (i.has(v) ? this.raise(l.ParamDupe, e) : i.add(v));
return;
} else h === "VoidPattern" && t.type === "CatchClause" && this.raise(l.VoidPatternCatchClauseParam, e);
let p = fe(e);
o || (o = p.type === "CallExpression" && (p.callee.type === "Import" || p.callee.type === "Super"));
let f = this.isValidLVal(h, o, !(n || e.extra?.parenthesized) && t.type === "AssignmentExpression", s);
if (f === true) return;
if (f === false) {
let v = s === 64 ? l.InvalidLhs : l.InvalidLhsBinding;
this.raise(v, e, { ancestor: t });
return;
}
let d, x;
typeof f == "string" ? (d = f, x = h === "ParenthesizedExpression") : [d, x] = f;
let T = h === "ArrayPattern" || h === "ObjectPattern" ? { type: h } : t, D = e[d];
if (Array.isArray(D)) for (let v of D) v && this.checkLVal(v, T, s, i, r, x, true);
else D && this.checkLVal(D, T, s, i, r, x, o);
}
checkIdentifier(e, t, s = false) {
this.state.strict && (s ? rs(e.name, this.inModule) : is(e.name)) && (t === 64 ? this.raise(l.StrictEvalArguments, e, { referenceName: e.name }) : this.raise(l.StrictEvalArgumentsBinding, e, { bindingName: e.name })), t & 8192 && e.name === "let" && this.raise(l.LetInLexicalBinding, e), t & 64 || this.declareNameFromIdentifier(e, t);
}
declareNameFromIdentifier(e, t) {
this.scope.declareName(e.name, t, e.start);
}
checkToRestConversion(e, t) {
switch (e.type) {
case "ParenthesizedExpression":
this.checkToRestConversion(e.expression, t);
break;
case "Identifier":
case "MemberExpression":
break;
case "ArrayExpression":
case "ObjectExpression":
if (t) break;
default:
this.raise(l.InvalidRestAssignmentPattern, e);
}
}
checkCommaAfterRest(e) {
return this.match(8) ? (this.raise(this.lookaheadCharCode() === e ? l.RestTrailingComma : l.ElementAfterRest, this.state.startLoc), true) : false;
}
};
me = class extends de {
checkProto(e, t, s) {
if (e.type === "SpreadElement" || this.isObjectMethod(e) || e.computed || e.shorthand) return t;
let i = e.key;
return (i.type === "Identifier" ? i.name : i.value) === "__proto__" ? (t && (s ? s.doubleProtoLoc === null && (s.doubleProtoLoc = this.getLoc(i.start)) : this.raise(l.DuplicateProto, i)), true) : t;
}
shouldExitDescending(e) {
return e.type === "ArrowFunctionExpression" && !e.extra?.parenthesized;
}
getExpression() {
if (this.enterInitialScopes(), this.nextToken(), this.match(135)) throw this.raise(l.ParseExpressionEmptyInput, this.state.startLoc);
let e = this.parseExpression();
if (!this.match(135)) throw this.raise(l.ParseExpressionExpectsEOF, this.state.startLoc, { unexpected: this.input.codePointAt(this.state.start) });
return this.finalizeRemainingComments(), e.comments = this.comments, e.errors = this.state.errors, this.optionFlags & 512 && (e.tokens = cs(this.tokens)), e;
}
parseExpression(e, t) {
return e ? this.disallowInAnd(() => this.parseExpressionBase(t)) : this.allowInAnd(() => this.parseExpressionBase(t));
}
parseExpressionBase(e) {
let t = this.state.startLoc, s = this.parseMaybeAssign(e);
if (this.match(8)) {
let i = this.startNodeAt(t);
for (i.expressions = [s]; this.eat(8); ) i.expressions.push(this.parseMaybeAssign(e));
return this.toReferencedList(i.expressions), this.finishNode(i, "SequenceExpression");
}
return s;
}
parseMaybeAssignDisallowIn(e, t) {
return this.disallowInAnd(() => this.parseMaybeAssign(e, t));
}
parseMaybeAssignAllowIn(e, t) {
return this.allowInAnd(() => this.parseMaybeAssign(e, t));
}
setOptionalParametersError(e) {
e.optionalParametersLoc = this.state.startLoc;
}
parseMaybeAssign(e, t) {
let s = this.state.startLoc, i = this.isContextual(104);
if (i && this.prodParam.hasYield) {
this.next();
let o = this.parseYield(s);
return t && (o = t.call(this, o, s)), o;
}
let r;
e ? r = false : (e = new et(), r = true), this.state.canStartArrow = true;
let n = this.parseMaybeConditional(e);
if (t && (n = t.call(this, n, s)), bi(this.state.type)) {
let o = this.startNodeAt(s), h = this.state.value;
if (o.operator = h, this.match(25)) {
this.toAssignable(n, true), o.left = n;
let c = s.index;
e.doubleProtoLoc != null && e.doubleProtoLoc.index >= c && (e.doubleProtoLoc = null), e.shorthandAssignLoc != null && e.shorthandAssignLoc.index >= c && (e.shorthandAssignLoc = null), e.privateKeyLoc != null && e.privateKeyLoc.index >= c && (this.checkDestructuringPrivate(e), e.privateKeyLoc = null), e.voidPatternLoc != null && e.voidPatternLoc.index >= c && (e.voidPatternLoc = null);
} else o.left = n;
return this.next(), o.right = this.parseMaybeAssign(), this.checkLVal(n, this.finishNode(o, "AssignmentExpression"), void 0, void 0, void 0, void 0, h === "||=" || h === "&&=" || h === "??="), o;
} else r && this.checkExpressionErrors(e, true);
if (i) {
let { type: o } = this.state;
if ((this.hasPlugin("v8intrinsic") ? ft(o) : ft(o) && !this.match(50)) && !this.isAmbiguousPrefixOrIdentifier()) return this.raiseOverwrite(l.YieldNotInGeneratorFunction, s), this.parseYield(s);
}
return n;
}
parseMaybeConditional(e) {
let t = this.state.startLoc, s = this.parseExprOps(e);
return this.shouldExitDescending(s) ? s : this.parseConditional(s, t, e);
}
parseConditional(e, t, s) {
if (this.eat(13)) {
let i = this.startNodeAt(t);
return i.test = e, i.consequent = this.parseMaybeAssignAllowIn(), this.expect(10), i.alternate = this.parseMaybeAssign(), this.finishNode(i, "ConditionalExpression");
}
return e;
}
parseMaybeUnaryOrPrivate(e) {
return this.match(134) ? this.parsePrivateName() : this.parseMaybeUnary(e);
}
parseExprOps(e) {
let t = this.state.startLoc, s = this.parseMaybeUnaryOrPrivate(e);
return this.shouldExitDescending(s) ? s : (this.state.canStartArrow = false, this.parseExprOp(s, t, -1));
}
parseExprOp(e, t, s) {
if (this.isPrivateName(e)) {
let r = this.getPrivateNameSV(e);
(s >= It(54) || !this.prodParam.hasIn || !this.match(54)) && this.raise(l.PrivateInExpectedIn, t, { identifierName: r }), this.classScope.usePrivateName(r, t);
}
let i = this.state.type;
if (_e(i) && (this.prodParam.hasIn || !this.match(54))) {
let r = It(i);
if (r > s) {
if (i === 35 && (this.expectPlugin("pipelineOperator"), this.prodParam.inFSharpPipelineDirectBody)) return e;
let n = this.startNodeAt(t);
n.left = e, n.operator = this.state.value;
let o = i === 37 || i === 38, h = i === 36;
h && (r = It(38)), this.next(), n.right = this.parseExprOpRightExpr(i, r);
let c = this.finishNode(n, o || h ? "LogicalExpression" : "BinaryExpression"), p = this.state.type;
if (h && (p === 37 || p === 38) || o && p === 36) throw this.raise(l.MixingCoalesceWithLogical, this.state.startLoc);
return this.parseExprOp(c, t, s);
}
}
return e;
}
parseExprOpRightExpr(e, t) {
switch (e) {
case 35:
switch (this.getPluginOption("pipelineOperator", "proposal")) {
case "hack":
return this.withTopicBindingContext(() => this.parseHackPipeBody());
case "fsharp":
return this.parseFSharpPipelineBody(t);
}
default:
return this.parseExprOpBaseRightExpr(e, t);
}
}
parseExprOpBaseRightExpr(e, t) {
let s = this.state.startLoc;
return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), s, Ii(e) ? t - 1 : t);
}
parseHackPipeBody() {
let { startLoc: e } = this.state, t = this.parseMaybeAssign();
return li.has(t.type) && !t.extra?.parenthesized && this.raise(l.PipeUnparenthesizedBody, e, { type: t.type }), this.topicReferenceWasUsedInCurrentContext() || this.raise(l.PipeTopicUnused, e), t;
}
checkExponentialAfterUnary(e) {
this.match(53) && this.raise(l.UnexpectedTokenUnaryExponentiation, e.argument);
}
parseMaybeUnary(e, t) {
let s = this.state.startLoc, i = this.isContextual(92);
if (i && this.recordAwaitIfAllowed()) {
this.next();
let h = this.parseAwait(s);
return t || this.checkExponentialAfterUnary(h), h;
}
let r = this.match(30), n = this.startNode();
if (Ci(this.state.type)) {
n.operator = this.state.value, n.prefix = true, this.state.canStartArrow = false, this.match(68) && this.expectPlugin("throwExpressions");
let h = this.match(85);
if (this.next(), n.argument = this.parseMaybeUnary(null, true), this.checkExpressionErrors(e, true), this.state.strict && h) {
let c = n.argument;
c.type === "Identifier" ? this.raise(l.StrictDelete, n) : this.hasPropertyAsPrivateName(c) && this.raise(l.DeletePrivateField, n);
}
if (!r) return t || this.checkExponentialAfterUnary(n), this.finishNode(n, "UnaryExpression");
}
let o = this.parseUpdate(n, r, e);
if (i) {
let { type: h } = this.state;
if ((this.hasPlugin("v8intrinsic") ? ft(h) : ft(h) && !this.match(50)) && !this.isAmbiguousPrefixOrIdentifier()) return this.raiseOverwrite(l.AwaitNotInAsyncContext, s), this.parseAwait(s);
}
return o;
}
parseUpdate(e, t, s) {
if (t) {
let n = this.finishNode(e, "UpdateExpression");
return this.checkLVal(n.argument, n), n;
}
let i = this.state.startLoc, r = this.parseExprSubscripts(s);
if (this.checkExpressionErrors(s, false)) return r;
for (; Si(this.state.type) && !this.canInsertSemicolon(); ) {
let n = this.startNodeAt(i);
n.operator = this.state.value, n.prefix = false, n.argument = r, this.next(), this.checkLVal(r, r = this.finishNode(n, "UpdateExpression"));
}
return r;
}
parseExprSubscripts(e) {
let t = this.state.startLoc;
this.setLoc(t);
let s = this.parseExprAtom(e);
return this.shouldExitDescending(s) ? s : this.parseSubscripts(s, t);
}
parseSubscripts(e, t, s) {
let i = { optionalChainMember: false, maybeAsyncArrow: this.atPossibleAsyncArrow(e), stop: false };
do
e = this.parseSubscript(e, t, s, i), i.maybeAsyncArrow = false;
while (!i.stop);
return e;
}
parseSubscript(e, t, s, i) {
let { type: r } = this.state;
if (!s && r === 11) return this.parseBind(e, t, i);
if (Gt(r)) return this.parseTaggedTemplateExpression(e, t, i);
let n = false;
if (r === 14) {
if (s && (this.raise(l.OptionalChainingNoNew, this.state.startLoc), this.lookaheadCharCode() === 40)) return this.stopParseSubscript(e, i);
i.optionalChainMember = n = true, this.next();
}
if (!s && this.match(6)) return this.parseCoverCallAndAsyncArrowHead(e, t, i, n);
{
let o = this.eat(0);
return o || n || this.eat(12) ? this.parseMember(e, t, i, o, n) : this.stopParseSubscript(e, i);
}
}
stopParseSubscript(e, t) {
return t.stop = true, e;
}
parseMember(e, t, s, i, r) {
let n = this.startNodeAt(t);
return n.object = e, n.computed = i, i ? (n.property = this.parseExpression(), this.expect(1)) : this.match(134) ? (e.type === "Super" && this.raise(l.SuperPrivateField, t), this.classScope.usePrivateName(this.state.value, this.state.startLoc), n.property = this.parsePrivateName()) : n.property = this.parseIdentifier(true), s.optionalChainMember ? (n.optional = r, this.finishNode(n, "OptionalMemberExpression")) : this.finishNode(n, "MemberExpression");
}
parseBind(e, t, s) {
let i = this.startNodeAt(t);
i.object = e, this.next();
let r = this.match(79), n = this.parseNoCallExpr();
if (n.type === "Super" || r && n.type === "ImportExpression" || n.type === "Import") throw this.raise(l.UnsupportedBindRHS, n);
return i.callee = n, s.stop = true, this.parseSubscripts(this.finishNode(i, "BindExpression"), t, false);
}
parseCoverCallAndAsyncArrowHead(e, t, s, i) {
let r = null;
this.next();
let n = this.startNodeAt(t);
n.callee = e;
let { maybeAsyncArrow: o, optionalChainMember: h } = s;
o && (this.expressionScope.enter(ir()), r = new et()), h && (n.optional = i), i ? n.arguments = this.parseCallExpressionArguments() : n.arguments = this.parseCallExpressionArguments(e.type !== "Super", n, r);
let c = this.finishCallExpression(n, h);
return o && this.shouldParseAsyncArrow() && !i ? (s.stop = true, this.checkDestructuringPrivate(r), this.expressionScope.validateAsPattern(), this.expressionScope.exit(), c = this.parseAsyncArrowFromCallExpression(this.startNodeAt(t), c)) : (o && (this.checkExpressionErrors(r, true), this.expressionScope.exit()), this.toReferencedList(n.arguments)), c;
}
parseTaggedTemplateExpression(e, t, s) {
let i = this.startNodeAt(t);
return i.tag = e, i.quasi = this.parseTemplate(true), s.optionalChainMember && this.raise(l.OptionalChainingNoTemplate, t), this.finishNode(i, "TaggedTemplateExpression");
}
atPossibleAsyncArrow(e) {
return e.type === "Identifier" && e.name === "async" && this.state.lastTokEndLoc.index === e.end && !this.canInsertSemicolon() && e.end - e.start === 5 && this.state.canStartArrow;
}
finishCallExpression(e, t) {
if (e.callee.type === "Import") if (e.arguments.length === 0 || e.arguments.length > 2) this.raise(l.ImportCallArity, e);
else for (let s of e.arguments) s.type === "SpreadElement" && this.raise(l.ImportCallSpreadArgument, s);
return this.finishNode(e, t ? "OptionalCallExpression" : "CallExpression");
}
parseCallExpressionArguments(e, t, s) {
let i = [], r = true;
for (; !this.eat(7); ) {
if (r) r = false;
else if (this.expect(8), this.match(7)) {
t && this.addTrailingCommaExtraToNode(t), this.next();
break;
}
i.push(this.parseExprListItem(7, false, s, e));
}
return i;
}
shouldParseAsyncArrow() {
return this.match(15) && !this.canInsertSemicolon();
}
parseAsyncArrowFromCallExpression(e, t) {
return this.resetPreviousNodeTrailingComments(t), this.expect(15), this.parseArrowExpression(e, t.arguments, true, t.extra?.trailingCommaLoc), t.innerComments && Pt(e, t.innerComments), t.callee.trailingComments && Pt(e, t.callee.trailingComments), e;
}
parseNoCallExpr() {
let e = this.state.startLoc;
return this.parseSubscripts(this.parseExprAtom(), e, true);
}
parseExprAtom(e) {
let t, s = null, { type: i } = this.state;
switch (i) {
case 75:
return this.parseSuper();
case 79:
return t = this.startNode(), this.next(), this.match(12) ? this.parseImportMetaPropertyOrPhaseCall(t) : this.match(6) ? this.optionFlags & 1024 ? this.parseImportCall(t) : this.finishNode(t, "Import") : (this.raise(l.UnsupportedImport, this.state.lastTokStartLoc), this.finishNode(t, "Import"));
case 74:
return t = this.startNode(), this.next(), this.finishNode(t, "ThisExpression");
case 86:
return this.parseDo(this.startNode(), false);
case 52:
case 27:
return this.readRegexp(), this.parseRegExpLiteral(this.state.value);
case 131:
return this.parseNumericLiteral(this.state.value);
case 132:
return this.parseBigIntLiteral(this.state.value);
case 130:
return this.parseStringLiteral(this.state.value);
case 80:
return this.parseNullLiteral();
case 81:
return this.parseBooleanLiteral(true);
case 82:
return this.parseBooleanLiteral(false);
case 6:
return this.parseParenAndDistinguishExpression(this.state.canStartArrow);
case 0:
return this.parseArrayLike(1, e);
case 2:
return this.parseObjectLike(4, false, e);
case 64:
return this.parseFunctionOrFunctionSent();
case 22:
s = this.parseDecorators();
case 76:
return this.parseClass(this.maybeTakeDecorators(s, this.startNode()), false);
case 73:
return this.parseNewOrNewTarget();
case 21:
case 20:
return this.parseTemplate(false);
case 11: {
t = this.startNode(), this.next(), t.object = null;
let r = t.callee = this.parseNoCallExpr();
if (r.type === "MemberExpression") return this.finishNode(t, "BindExpression");
throw this.raise(l.UnsupportedBind, r);
}
case 134:
return this.raise(l.PrivateInExpectedIn, this.state.startLoc, { identifierName: this.state.value }), this.parsePrivateName();
case 29:
return this.parseTopicReferenceThenEqualsSign(50, "%");
case 28:
return this.parseTopicReferenceThenEqualsSign(40, "^");
case 33:
case 34:
return this.parseTopicReference("hack");
case 40:
case 50:
case 23: {
let r = this.getPluginOption("pipelineOperator", "proposal");
if (r) return this.parseTopicReference(r);
throw this.unexpected();
}
case 43: {
let r = this.input.codePointAt(this.nextTokenStart());
throw R(r) || r === 62 ? this.expectOnePlugin(["jsx", "flow", "typescript"]) : this.unexpected();
}
default:
if (C(i)) {
if (this.isContextual(123) && this.lookaheadInLineCharCode() === 123) return this.parseModuleExpression();
let { canStartArrow: r, containsEsc: n } = this.state, o = this.parseIdentifier();
if (!n && o.name === "async" && !this.canInsertSemicolon()) {
let { type: h } = this.state;
if (h === 64) return this.resetPreviousNodeTrailingComments(o), this.next(), this.parseAsyncFunctionExpression(this.startNodeAtNode(o));
if (C(h)) return r && this.lookaheadCharCode() === 61 ? this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(o)) : o;
if (h === 86) return this.resetPreviousNodeTrailingComments(o), this.parseDo(this.startNodeAtNode(o), true);
}
return r && this.match(15) && !this.canInsertSemicolon() ? (this.next(), this.parseArrowExpression(this.startNodeAtNode(o), [o], false)) : o;
} else throw this.unexpected();
}
}
parseTopicReferenceThenEqualsSign(e, t) {
let s = this.getPluginOption("pipelineOperator", "proposal");
if (s) return this.state.type = e, this.state.value = t, this.state.pos--, this.state.end--, this.state.endLoc = O(this.state.endLoc, -1), this.parseTopicReference(s);
throw this.unexpected();
}
parseTopicReference(e) {
let t = this.startNode(), s = this.state.startLoc, i = this.state.type;
return this.next(), this.finishTopicReference(t, s, e, i);
}
finishTopicReference(e, t, s, i) {
if (this.testTopicReferenceConfiguration(s, t, i)) return this.topicReferenceIsAllowedInCurrentContext() || this.raise(l.PipeTopicUnbound, t), this.registerTopicReference(), this.finishNode(e, "TopicReference");
throw this.raise(l.PipeTopicUnconfiguredToken, t, { token: z(i) });
}
testTopicReferenceConfiguration(e, t, s) {
if (e === "hack") return this.hasPlugin(["pipelineOperator", { topicToken: z(s) }]);
throw this.raise(l.PipeTopicRequiresHackPipes, t);
}
parseAsyncArrowUnaryFunction(e) {
this.prodParam.enter(Nt(true, this.prodParam.hasYield));
let t = [this.parseIdentifier()];
return this.prodParam.exit(), this.hasPrecedingLineBreak() && this.raise(l.LineTerminatorBeforeArrow, this.state.curPosition()), this.expect(15), this.parseArrowExpression(e, t, true);
}
parseDo(e, t) {
this.expectPlugin("doExpressions"), t && this.expectPlugin("asyncDoExpressions"), e.async = t, this.next();
let s = this.state.labels;
return this.state.labels = [], t ? (this.prodParam.enter(2), e.body = this.parseBlock(), this.prodParam.exit()) : e.body = this.parseBlock(), this.state.labels = s, this.finishNode(e, "DoExpression");
}
parseSuper() {
let e = this.startNode();
return this.next(), this.match(6) && !this.scope.allowDirectSuper ? this.raise(l.SuperNotAllowed, e) : this.scope.allowSuper || this.raise(l.UnexpectedSuper, e), !this.match(6) && !this.match(0) && !this.match(12) && this.raise(l.UnsupportedSuper, e), this.finishNode(e, "Super");
}
parsePrivateName() {
let e = this.startNode(), t = this.startNodeAt(O(this.state.startLoc, 1)), s = this.state.value;
return this.next(), e.id = this.createIdentifier(t, s), this.finishNode(e, "PrivateName");
}
parseFunctionOrFunctionSent() {
let e = this.startNode();
if (this.next(), this.prodParam.hasYield && this.match(12)) {
let t = this.createIdentifier(this.startNodeAtNode(e), "function");
return this.next(), this.match(99) ? this.expectPlugin("functionSent") : this.hasPlugin("functionSent") || this.unexpected(), this.parseMetaProperty(e, t, "sent");
}
return this.parseFunction(e);
}
parseMetaProperty(e, t, s) {
e.meta = t;
let i = this.state.containsEsc;
return e.property = this.parseIdentifier(true), (e.property.name !== s || i) && this.raise(l.UnsupportedMetaProperty, e.property, { target: t.name, onlyValidPropertyName: s }), this.finishNode(e, "MetaProperty");
}
parseImportMetaPropertyOrPhaseCall(e) {
if (this.next(), this.isContextual(101) || this.isContextual(93)) {
let t = this.isContextual(101);
return this.expectPlugin(t ? "sourcePhaseImports" : "deferredImportEvaluation"), this.next(), e.phase = t ? "source" : "defer", this.parseImportCall(e);
} else {
let t = this.createIdentifierAt(this.startNodeAtNode(e), "import", this.state.lastTokStartLoc);
return this.isContextual(97) && (this.inModule || this.raise(l.ImportMetaOutsideModule, t), this.sawUnambiguousESM = true), this.parseMetaProperty(e, t, "meta");
}
}
parseLiteralAtNode(e, t, s) {
return this.addExtra(s, "rawValue", e), this.addExtra(s, "raw", this.input.slice(this.offsetToSourcePos(s.start), this.state.end)), s.value = e, this.next(), this.finishNode(s, t);
}
parseLiteral(e, t) {
let s = this.startNode();
return this.parseLiteralAtNode(e, t, s);
}
parseStringLiteral(e) {
return this.parseLiteral(e, "StringLiteral");
}
parseNumericLiteral(e) {
return this.parseLiteral(e, "NumericLiteral");
}
parseBigIntLiteral(e) {
let t;
try {
t = BigInt(e);
} catch {
t = null;
}
return this.parseLiteral(t, "BigIntLiteral");
}
parseRegExpLiteral(e) {
let t = this.startNode();
return this.addExtra(t, "raw", this.input.slice(this.offsetToSourcePos(t.start), this.state.end)), t.pattern = e.pattern, t.flags = e.flags, this.next(), this.finishNode(t, "RegExpLiteral");
}
parseBooleanLiteral(e) {
let t = this.startNode();
return t.value = e, this.next(), this.finishNode(t, "BooleanLiteral");
}
parseNullLiteral() {
let e = this.startNode();
return this.next(), this.finishNode(e, "NullLiteral");
}
parseParenAndDistinguishExpression(e) {
let t = this.state.startLoc, s;
this.next(), this.expressionScope.enter(sr());
let i = this.state.startLoc, r = [], n = new et(), o = true, h, c;
for (; !this.match(7); ) {
if (o) o = false;
else if (this.expect(8, n.optionalParametersLoc === null ? null : n.optionalParametersLoc), this.match(7)) {
c = this.state.startLoc;
break;
}
if (this.match(17)) {
let d = this.state.startLoc;
if (h = this.state.startLoc, r.push(this.parseParenItem(this.parseRestBinding(), d)), !this.checkCommaAfterRest(41)) break;
} else r.push(this.parseMaybeAssignAllowInOrVoidPattern(7, n, this.parseParenItem));
}
let p = this.state.lastTokEndLoc;
this.expect(7);
let f = this.startNodeAt(t);
return e && this.shouldParseArrow(r) && (f = this.parseArrow(f)) ? (this.checkDestructuringPrivate(n), this.expressionScope.validateAsPattern(), this.expressionScope.exit(), this.parseArrowExpression(f, r, false), f) : (this.expressionScope.exit(), r.length || this.unexpected(this.state.lastTokStartLoc), c && this.unexpected(c), h && this.unexpected(h), this.checkExpressionErrors(n, true), this.toReferencedList(r, true), r.length > 1 ? (s = this.startNodeAt(i), s.expressions = r, this.finishNode(s, "SequenceExpression"), this.resetEndLocation(s, p)) : s = r[0], this.wrapParenthesis(t, s));
}
wrapParenthesis(e, t) {
if (!(this.optionFlags & 2048)) return this.addExtra(t, "parenthesized", true), this.addExtra(t, "parenStart", e.index), this.takeSurroundingComments(t, e.index, this.state.lastTokEndLoc.index), t;
let s = this.startNodeAt(e);
return s.expression = t, this.finishNode(s, "ParenthesizedExpression");
}
shouldParseArrow(e) {
return !this.canInsertSemicolon();
}
parseArrow(e) {
if (this.eat(15)) return e;
}
parseParenItem(e, t) {
return e;
}
parseNewOrNewTarget() {
let e = this.startNode();
if (this.next(), this.match(12)) {
let t = this.createIdentifier(this.startNodeAtNode(e), "new");
this.next();
let s = this.parseMetaProperty(e, t, "target");
return this.scope.allowNewTarget || this.raise(l.UnexpectedNewTarget, s), s;
}
return this.parseNew(e);
}
parseNew(e) {
if (this.parseNewCallee(e), this.eat(6)) {
let t = this.parseExprList(7);
this.toReferencedList(t), e.arguments = t;
} else e.arguments = [];
return this.finishNode(e, "NewExpression");
}
parseNewCallee(e) {
let t = this.match(79), s = this.parseNoCallExpr();
e.callee = s, t && s.type === "ImportExpression" && this.raise(l.ImportCallNotNewExpression, s, s), s.type === "Import" && this.raise(l.ImportCallNotNewExpression, s), s.type === "Super" && this.raise(l.SuperCallNotNewExpression, s);
}
parseTemplateElement(e) {
let { start: t, startLoc: s, end: i, value: r } = this.state, n = t + 1, o = this.startNodeAt(O(s, 1));
r === null && (e || this.raise(l.InvalidEscapeSequenceTemplate, O(this.state.firstInvalidTemplateEscapePos, 1)));
let h = this.match(20), c = h ? -1 : -2, p = i + c;
o.value = { raw: this.input.slice(n, p).replace(/\r\n?/g, `
`), cooked: r === null ? null : r.slice(1, c) }, o.tail = h, this.next();
let f = this.finishNode(o, "TemplateElement");
return this.resetEndLocation(f, O(this.state.lastTokEndLoc, c)), f;
}
parseTemplate(e) {
let t = this.startNode(), s = this.parseTemplateElement(e), i = [s], r = [];
for (; !s.tail; ) r.push(this.parseTemplateSubstitution()), this.readTemplateContinuation(), i.push(s = this.parseTemplateElement(e));
return t.expressions = r, t.quasis = i, this.finishNode(t, "TemplateLiteral");
}
parseTemplateSubstitution() {
return this.parseExpression();
}
parseObjectLike(e, t, s) {
let i = false, r = true, n = this.startNode();
for (n.properties = [], this.next(); !this.match(e); ) {
if (r) r = false;
else if (this.expect(8), this.match(e)) {
this.addTrailingCommaExtraToNode(n);
break;
}
let h;
t ? h = this.parseBindingProperty() : (h = this.parsePropertyDefinition(s), i = this.checkProto(h, i, s)), n.properties.push(h);
}
this.next();
let o = t ? "ObjectPattern" : "ObjectExpression";
return this.finishNode(n, o);
}
addTrailingCommaExtraToNode(e) {
this.addExtra(e, "trailingComma", this.state.lastTokStartLoc.index), this.addExtra(e, "trailingCommaLoc", this.state.lastTokStartLoc, false);
}
maybeAsyncOrAccessorProp(e) {
return !e.computed && e.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(51));
}
parsePropertyDefinition(e) {
let t = [];
if (this.match(22)) for (this.hasPlugin("decorators") && this.raise(l.UnsupportedPropertyDecorator, this.state.startLoc); this.match(22); ) t.push(this.parseDecorator());
let s = this.startNode(), i = false, r = false, n;
if (this.match(17)) return t.length && this.unexpected(), this.parseSpread();
t.length && (s.decorators = t), s.method = false, e && (n = this.state.startLoc);
let o = this.eat(51);
this.parsePropertyNamePrefixOperator(s);
let h = this.state.containsEsc;
if (this.parsePropertyName(s, e), !o && !h && this.maybeAsyncOrAccessorProp(s)) {
let { key: c } = s, p = c.name;
p === "async" && !this.hasPrecedingLineBreak() && (i = true, this.resetPreviousNodeTrailingComments(c), o = this.eat(51), this.parsePropertyName(s)), (p === "get" || p === "set") && (r = true, this.resetPreviousNodeTrailingComments(c), s.kind = p, this.match(51) && (o = true, this.raise(l.AccessorIsGenerator, this.state.curPosition(), { kind: p }), this.next()), this.parsePropertyName(s));
}
return this.parseObjPropValue(s, n, o, i, false, r, e);
}
getGetterSetterExpectedParamCount(e) {
return e.kind === "get" ? 0 : 1;
}
getObjectOrClassMethodParams(e) {
return e.params;
}
checkGetterSetterParams(e) {
let t = this.getGetterSetterExpectedParamCount(e), s = this.getObjectOrClassMethodParams(e);
s.length !== t && this.raise(e.kind === "get" ? l.BadGetterArity : l.BadSetterArity, e), e.kind === "set" && s[s.length - 1]?.type === "RestElement" && this.raise(l.BadSetterRestParameter, e);
}
parseObjectMethod(e, t, s, i, r) {
if (r) {
let n = this.parseMethod(e, t, false, false, false, "ObjectMethod");
return this.checkGetterSetterParams(n), n;
}
if (s || t || this.match(6)) return i && this.unexpected(), e.kind = "method", e.method = true, this.parseMethod(e, t, s, false, false, "ObjectMethod");
}
parseObjectProperty(e, t, s, i) {
if (e.shorthand = false, this.eat(10)) return e.value = s ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowInOrVoidPattern(4, i), this.finishObjectProperty(e);
if (!e.computed && e.key.type === "Identifier") {
if (this.checkReservedWord(e.key.name, e.key.start, true, false), s) e.value = this.parseMaybeDefault(t, this.cloneIdentifier(e.key));
else if (this.match(25)) {
let r = this.state.startLoc;
i != null ? i.shorthandAssignLoc === null && (i.shorthandAssignLoc = r) : this.raise(l.InvalidCoverInitializedName, r), e.value = this.parseMaybeDefault(t, this.cloneIdentifier(e.key));
} else e.value = this.cloneIdentifier(e.key);
return e.shorthand = true, this.finishObjectProperty(e);
}
}
finishObjectProperty(e) {
return this.finishNode(e, "ObjectProperty");
}
parseObjPropValue(e, t, s, i, r, n, o) {
let h = this.parseObjectMethod(e, s, i, r, n) || this.parseObjectProperty(e, t, r, o);
return h || this.unexpected(), h;
}
parsePropertyName(e, t) {
if (this.eat(0)) e.computed = true, e.key = this.parseMaybeAssignAllowIn(), this.expect(1);
else {
let { type: s, value: i } = this.state, r;
if (B(s)) r = this.parseIdentifier(true);
else switch (s) {
case 131:
r = this.parseNumericLiteral(i);
break;
case 130:
r = this.parseStringLiteral(i);
break;
case 132:
r = this.parseBigIntLiteral(i);
break;
case 134: {
let n = this.state.startLoc;
t != null ? t.privateKeyLoc === null && (t.privateKeyLoc = n) : this.raise(l.UnexpectedPrivateField, n), r = this.parsePrivateName();
break;
}
default:
this.unexpected();
}
e.key = r, s !== 134 && (e.computed = false);
}
}
initFunction(e, t) {
e.id = null, e.generator = false, e.async = t;
}
parseMethod(e, t, s, i, r, n, o = false) {
this.initFunction(e, s), e.generator = t, this.scope.enter(530 | (o ? 576 : 0) | (r ? 32 : 0)), this.prodParam.enter(Nt(s, e.generator)), this.parseFunctionParams(e, i);
let h = this.parseFunctionBodyAndFinish(e, n, true);
return this.prodParam.exit(), this.scope.exit(), h;
}
parseArrayLike(e, t) {
let s = this.startNode();
return this.next(), s.elements = this.parseExprList(e, true, t, s), this.finishNode(s, "ArrayExpression");
}
parseArrowExpression(e, t, s, i) {
this.scope.enter(518);
let r = Nt(s, false);
return this.match(2) || (r |= this.prodParam.currentFlags() & 24), this.prodParam.enter(r), this.initFunction(e, s), t && this.setArrowFunctionParameters(e, t, i), this.parseFunctionBody(e, true), this.prodParam.exit(), this.scope.exit(), this.finishNode(e, "ArrowFunctionExpression");
}
setArrowFunctionParameters(e, t, s) {
this.toAssignableList(t, s, false), e.params = t;
}
parseFunctionBodyAndFinish(e, t, s = false) {
return this.parseFunctionBody(e, false, s), this.finishNode(e, t);
}
parseFunctionBody(e, t, s = false) {
let i = t && !this.match(2);
if (this.expressionScope.enter(hs()), i) e.body = this.parseMaybeAssign(), this.checkParams(e, false, t, false);
else {
let r = this.state.strict, n = this.state.labels;
this.state.labels = [], this.prodParam.enter(this.prodParam.currentFlags() | 4), e.body = this.parseBlock(true, false, (o) => {
let h = !this.isSimpleParamList(e.params);
o && h && this.raise(l.IllegalLanguageModeDirective, (e.kind === "method" || e.kind === "constructor") && e.key ? this.optionFlags & 256 ? e.key.loc.end : e.key : e);
let c = !r && this.state.strict;
this.checkParams(e, !this.state.strict && !t && !s && !h, t, c), this.state.strict && e.id && this.checkIdentifier(e.id, 65, c);
}), this.prodParam.exit(), this.state.labels = n;
}
this.expressionScope.exit();
}
isSimpleParameter(e) {
return e.type === "Identifier";
}
isSimpleParamList(e) {
for (let t = 0, s = e.length; t < s; t++) if (!this.isSimpleParameter(e[t])) return false;
return true;
}
checkParams(e, t, s, i = true) {
let r = !t && /* @__PURE__ */ new Set(), n = { type: "FormalParameters" };
for (let o of e.params) this.checkLVal(o, n, 5, r, i);
}
parseExprList(e, t, s, i) {
let r = [], n = true;
for (; !this.eat(e); ) {
if (n) n = false;
else if (this.expect(8), this.match(e)) {
i && this.addTrailingCommaExtraToNode(i), this.next();
break;
}
r.push(this.parseExprListItem(e, t, s));
}
return r;
}
parseExprListItem(e, t, s, i) {
let r;
if (this.match(8)) t || this.raise(l.UnexpectedToken, this.state.curPosition(), { unexpected: "," }), r = null;
else if (this.match(17)) {
let n = this.state.startLoc;
r = this.parseParenItem(this.parseSpread(s), n);
} else if (this.match(13)) {
this.expectPlugin("partialApplication"), i || this.raise(l.UnexpectedArgumentPlaceholder, this.state.startLoc);
let n = this.startNode();
this.next(), r = this.finishNode(n, "ArgumentPlaceholder");
} else r = this.parseMaybeAssignAllowInOrVoidPattern(e, s, this.parseParenItem);
return r;
}
parseIdentifier(e) {
let t = this.startNode(), s = this.parseIdentifierName(e);
return this.createIdentifier(t, s);
}
createIdentifier(e, t) {
return e.name = t, this.optionFlags & 256 && (e.loc.identifierName = t), this.finishNode(e, "Identifier");
}
createIdentifierAt(e, t, s) {
return e.name = t, this.optionFlags & 256 && (e.loc.identifierName = t), this.finishNodeAt(e, "Identifier", s);
}
parseIdentifierName(e) {
let t, { start: s, type: i } = this.state;
B(i) ? t = this.state.value : this.unexpected();
let r = gi(i);
return e ? r && this.replaceToken(128) : this.checkReservedWord(t, this.sourceToOffsetPos(s), r, false), this.next(), t;
}
checkReservedWord(e, t, s, i) {
if (e.length > 10 || !Ui(e)) return;
if (s && Fi(e)) {
this.raise(l.UnexpectedKeyword, t, { keyword: e });
return;
}
if ((this.state.strict ? i ? rs : ss : es)(e, this.inModule)) {
this.raise(l.UnexpectedReservedWord, t, { reservedWord: e });
return;
} else if (e === "yield") {
if (this.prodParam.hasYield) {
this.raise(l.YieldBindingIdentifier, t);
return;
}
} else if (e === "await") {
if (this.prodParam.hasAwait) {
this.raise(l.AwaitBindingIdentifier, t);
return;
}
if (this.scope.inStaticBlock) {
this.raise(l.AwaitBindingIdentifierInStaticBlock, t);
return;
}
this.expressionScope.recordAsyncArrowParametersError(t);
} else if (e === "arguments" && this.scope.inClassAndNotInNonArrowFunction) {
this.raise(l.ArgumentsInClass, t);
return;
}
}
recordAwaitIfAllowed() {
let e = this.prodParam.hasAwait;
return e && !this.scope.inFunction && (this.state.hasTopLevelAwait = true), e;
}
parseAwait(e, t) {
let s = e.index;
this.setLoc(e);
let i = this.startNodeAt(e);
return this.expressionScope.recordParameterInitializerError(l.AwaitExpressionFormalParameter, s), this.eat(51) && this.raise(l.ObsoleteAwaitStar, e), !this.scope.inFunction && !(this.optionFlags & 1) && (this.isAmbiguousPrefixOrIdentifier() ? this.ambiguousScriptDifferentAst = true : this.sawUnambiguousESM = true), t || (i.argument = this.parseMaybeUnary(null, true)), this.finishNode(i, "AwaitExpression");
}
isAmbiguousPrefixOrIdentifier() {
if (this.hasPrecedingLineBreak()) return true;
let { type: e } = this.state;
return e === 49 || e === 6 || e === 0 || Gt(e) || e === 98 && !this.state.containsEsc || e === 133 || e === 52 || this.hasPlugin("v8intrinsic") && e === 50;
}
parseYield(e) {
this.setLoc(e);
let t = this.startNodeAt(e);
this.expressionScope.recordParameterInitializerError(l.YieldInParameter, e.index);
let s = false, i = null;
if (!this.hasPrecedingLineBreak()) switch (s = this.eat(51), this.state.type) {
case 9:
case 135:
case 4:
case 7:
case 1:
case 5:
case 10:
case 8:
if (!s) break;
default:
i = this.parseMaybeAssign();
}
return t.delegate = s, t.argument = i, this.finishNode(t, "YieldExpression");
}
parseImportCall(e) {
this.next();
let t = this.parseCallExpressionArguments();
if (t.length === 0 || t.length > 2) this.raise(l.ImportCallArity, e, e);
else for (let s of t) s.type === "SpreadElement" && this.raise(l.ImportCallSpreadArgument, s, e);
return e.source = t[0], e.options = t[1] ?? null, this.finishNode(e, "ImportExpression");
}
withTopicBindingContext(e) {
let t = this.state.inHackPipelineBody;
this.state.inHackPipelineBody = true;
let s = this.state.seenTopicReference;
this.state.seenTopicReference = false;
try {
return e();
} finally {
this.state.inHackPipelineBody = t, this.state.seenTopicReference = s;
}
}
allowInAnd(e) {
let t = this.prodParam.currentFlags();
if (24 & ~t) {
this.prodParam.enter(t | 8 | 16);
try {
return e();
} finally {
this.prodParam.exit();
}
}
return e();
}
disallowInAnd(e) {
let t = this.prodParam.currentFlags(), s = 8 & t, i = 16 & ~t;
if (s || i) {
this.prodParam.enter(t & -9 | 16);
try {
return e();
} finally {
this.prodParam.exit();
}
}
return e();
}
registerTopicReference() {
this.state.seenTopicReference = true;
}
topicReferenceIsAllowedInCurrentContext() {
return this.state.inHackPipelineBody;
}
topicReferenceWasUsedInCurrentContext() {
return this.state.seenTopicReference;
}
parseFSharpPipelineBody(e) {
let t = this.state.startLoc;
this.prodParam.enter(this.prodParam.currentFlags() & -17);
let s;
if (this.isContextual(92) && this.recordAwaitIfAllowed()) {
this.next(), s = this.parseAwait(t, true);
let i = this.state.type;
_e(i) && i !== 35 && (this.prodParam.hasIn || i !== 54) && this.raise(l.PipelineUnparenthesized, t);
} else this.state.canStartArrow = true, s = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), t, e);
return this.prodParam.exit(), s;
}
parseModuleExpression() {
this.expectPlugin("moduleBlocks");
let e = this.startNode();
this.next(), this.match(2) || this.unexpected(null, 2);
let t = this.startNodeAt(this.state.endLoc);
this.next();
let s = this.initializeScopes(true);
this.enterInitialScopes();
try {
e.body = this.parseProgram(t, 4, "module");
} finally {
s();
}
return this.finishNode(e, "ModuleExpression");
}
parseVoidPattern(e) {
this.expectPlugin("discardBinding");
let t = this.startNode();
return e != null && (e.voidPatternLoc = this.state.startLoc), this.next(), this.finishNode(t, "VoidPattern");
}
parseMaybeAssignAllowInOrVoidPattern(e, t, s) {
if (t != null && this.match(84)) {
let i = this.lookaheadCharCode();
if (i === 44 || i === (e === 1 ? 93 : e === 4 ? 125 : 41) || i === 61) return this.parseMaybeDefault(this.state.startLoc, this.parseVoidPattern(t));
}
return this.parseMaybeAssignAllowIn(t, s);
}
parsePropertyNamePrefixOperator(e) {
}
};
Kt = { kind: 1 };
rr = { kind: 2 };
ar = /[\uD800-\uDFFF]/u;
Wt = /in(?:stanceof)?/y;
ye = class extends me {
parseTopLevel(e, t) {
return e.program = this.parseProgram(t, 135, this.options.sourceType === "module" ? "module" : "script"), e.comments = this.comments, this.optionFlags & 512 && (e.tokens = cs(this.tokens)), this.finishNode(e, "File");
}
parseProgram(e, t, s) {
if (e.sourceType = s, e.interpreter = this.parseInterpreterDirective(), this.parseBlockBody(e, true, true, t), this.inModule) {
if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0) for (let [r, n] of Array.from(this.scope.undefinedExports)) this.raise(l.ModuleExportUndefined, n, { localName: r });
this.addExtra(e, "topLevelAwait", this.state.hasTopLevelAwait);
}
let i;
return t === 135 ? i = this.finishNode(e, "Program") : i = this.finishNodeAt(e, "Program", O(this.state.startLoc, -1)), i;
}
stmtToDirective(e) {
let t = this.castNodeTo(e, "Directive"), s = this.castNodeTo(e.expression, "DirectiveLiteral"), i = s.value, r = this.input.slice(this.offsetToSourcePos(s.start), this.offsetToSourcePos(s.end)), n = s.value = r.slice(1, -1);
return this.addExtra(s, "raw", r), this.addExtra(s, "rawValue", n), this.addExtra(s, "expressionValue", i), t.value = s, delete e.expression, t;
}
parseInterpreterDirective() {
if (!this.match(24)) return null;
let e = this.startNode();
return e.value = this.state.value, this.next(), this.finishNode(e, "InterpreterDirective");
}
isLet() {
return this.isContextual(96) ? this.hasFollowingBindingAtom() : false;
}
isUsing() {
return this.isContextual(103) ? this.nextTokenIsIdentifierOnSameLine() : false;
}
isForUsing() {
if (!this.isContextual(103)) return false;
let e = this.nextTokenInLineStart(), t = this.codePointAtPos(e);
if (this.isUnparsedContextual(e, "of")) {
let s = this.lookaheadCharCodeSince(e + 2);
if (s !== 61 && s !== 58 && s !== 59) return false;
}
return !!(this.chStartsBindingIdentifier(t, e) || this.isUnparsedContextual(e, "void"));
}
nextTokenIsIdentifierOnSameLine() {
let e = this.nextTokenInLineStart(), t = this.codePointAtPos(e);
return this.chStartsBindingIdentifier(t, e);
}
isAwaitUsing() {
if (!this.isContextual(92)) return false;
let e = this.nextTokenInLineStart();
if (this.isUnparsedContextual(e, "using")) {
e = this.nextTokenInLineStartSince(e + 5);
let t = this.codePointAtPos(e);
if (this.chStartsBindingIdentifier(t, e)) return true;
}
return false;
}
chStartsBindingIdentifier(e, t) {
if (R(e)) {
if (Wt.lastIndex = t, Wt.test(this.input)) {
let s = this.codePointAtPos(Wt.lastIndex);
if (!W(s) && s !== 92) return false;
}
return true;
} else return e === 92;
}
chStartsBindingPattern(e) {
return e === 91 || e === 123;
}
hasFollowingBindingAtom() {
let e = this.nextTokenStart(), t = this.codePointAtPos(e);
return this.chStartsBindingPattern(t) || this.chStartsBindingIdentifier(t, e);
}
hasInLineFollowingBindingIdentifierOrBrace() {
let e = this.nextTokenInLineStart(), t = this.codePointAtPos(e);
return t === 123 || this.chStartsBindingIdentifier(t, e);
}
allowsUsing() {
return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
}
parseModuleItem() {
return this.parseStatementLike(15);
}
parseStatementListItem() {
return this.parseStatementLike(6 | (!this.options.annexB || this.state.strict ? 0 : 8));
}
parseStatementOrSloppyAnnexBFunctionDeclaration(e = false) {
let t = 0;
return this.options.annexB && !this.state.strict && (t |= 4, e && (t |= 8)), this.parseStatementLike(t);
}
parseStatement() {
return this.parseStatementLike(0);
}
parseStatementLike(e) {
let t = null;
return this.match(22) && (t = this.parseDecorators(true)), this.parseStatementContent(e, t);
}
parseStatementContent(e, t) {
let s = this.state.type, i = this.startNode(), r = !!(e & 2), n = !!(e & 4), o = e & 1;
switch (s) {
case 56:
return this.parseBreakContinueStatement(i, true);
case 59:
return this.parseBreakContinueStatement(i, false);
case 60:
return this.parseDebuggerStatement(i);
case 86:
return this.parseDoWhileStatement(i);
case 87:
return this.parseForStatement(i);
case 64:
if (this.lookaheadCharCode() === 46) break;
return n || this.raise(this.state.strict ? l.StrictFunction : this.options.annexB ? l.SloppyFunctionAnnexB : l.SloppyFunction, this.state.startLoc), this.parseFunctionStatement(i, false, !r && n);
case 76:
return r || this.unexpected(), this.parseClass(this.maybeTakeDecorators(t, i), true);
case 65:
return this.parseIfStatement(i);
case 66:
return this.parseReturnStatement(i);
case 67:
return this.parseSwitchStatement(i);
case 68:
return this.parseThrowStatement(i);
case 69:
return this.parseTryStatement(i);
case 92:
if (this.isAwaitUsing()) return this.allowsUsing() ? r ? this.recordAwaitIfAllowed() || this.raise(l.AwaitUsingNotInAsyncContext, i) : this.raise(l.UnexpectedLexicalDeclaration, i) : this.raise(l.UnexpectedUsingDeclaration, i), this.next(), this.parseVarStatement(i, "await using");
break;
case 103:
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) break;
return this.allowsUsing() ? r || this.raise(l.UnexpectedLexicalDeclaration, this.state.startLoc) : this.raise(l.UnexpectedUsingDeclaration, this.state.startLoc), this.parseVarStatement(i, "using");
case 96: {
if (this.state.containsEsc) break;
let p = this.nextTokenStart(), f = this.codePointAtPos(p);
if (f !== 91 && (!r && this.hasFollowingLineBreak() || !this.chStartsBindingIdentifier(f, p) && f !== 123)) break;
}
case 71:
r || this.raise(l.UnexpectedLexicalDeclaration, this.state.startLoc);
case 70: {
let p = this.state.value;
return this.parseVarStatement(i, p);
}
case 88:
return this.parseWhileStatement(i);
case 72:
return this.parseWithStatement(i);
case 2:
return this.parseBlock();
case 9:
return this.parseEmptyStatement(i);
case 79: {
let p = this.lookaheadCharCode();
if (p === 40 || p === 46) break;
}
case 78: {
!(this.optionFlags & 8) && !o && this.raise(l.UnexpectedImportExport, this.state.startLoc), this.next();
let p;
return s === 79 ? p = this.parseImport(i) : p = this.parseExport(i, t), this.assertModuleNodeAllowed(p), p;
}
default:
if (this.isAsyncFunction()) return r || this.raise(l.AsyncFunctionInSingleStatementContext, this.state.startLoc), this.next(), this.parseFunctionStatement(i, true, !r && n);
}
let h = this.state.value, c = this.parseExpression();
return C(s) && c.type === "Identifier" && this.eat(10) ? this.parseLabeledStatement(i, h, c, e) : this.parseExpressionStatement(i, c, t);
}
assertModuleNodeAllowed(e) {
!(this.optionFlags & 8) && !this.inModule && this.raise(l.ImportOutsideModule, e);
}
maybeTakeDecorators(e, t, s) {
return e && (t.decorators?.length ? (this.raise(l.DecoratorsBeforeAfterExport, t.decorators[0]), t.decorators.unshift(...e)) : t.decorators = e, this.resetStartLocationFromNode(t, e[0]), s && this.resetStartLocationFromNode(s, t)), t;
}
canHaveLeadingDecorator() {
return this.match(76);
}
parseDecorators(e) {
let t = [];
do
t.push(this.parseDecorator());
while (this.match(22));
if (this.match(78)) e || this.unexpected();
else if (!this.canHaveLeadingDecorator()) throw this.raise(l.UnexpectedLeadingDecorator, this.state.startLoc);
return t;
}
parseDecorator() {
this.expectOnePlugin(["decorators", "decorators-legacy"]);
let e = this.startNode();
if (this.next(), this.hasPlugin("decorators")) {
let t = this.state.startLoc, s;
if (this.match(6)) {
let i = this.state.startLoc;
this.next(), s = this.parseExpression(), this.expect(7), s = this.wrapParenthesis(i, s);
let r = this.state.startLoc;
e.expression = this.parseMaybeDecoratorArguments(s, i), e.expression !== s && this.raise(l.DecoratorArgumentsOutsideParentheses, r);
} else {
for (s = this.parseIdentifier(false); this.eat(12); ) {
let i = this.startNodeAt(t);
i.object = s, this.match(134) ? (this.classScope.usePrivateName(this.state.value, this.state.startLoc), i.property = this.parsePrivateName()) : i.property = this.parseIdentifier(true), i.computed = false, s = this.finishNode(i, "MemberExpression");
}
e.expression = this.parseMaybeDecoratorArguments(s, t);
}
} else this.state.canStartArrow = false, e.expression = this.parseExprSubscripts();
return this.finishNode(e, "Decorator");
}
parseMaybeDecoratorArguments(e, t) {
if (this.eat(6)) {
let s = this.startNodeAt(t);
return s.callee = e, s.arguments = this.parseCallExpressionArguments(), this.toReferencedList(s.arguments), this.finishNode(s, "CallExpression");
}
return e;
}
parseBreakContinueStatement(e, t) {
return this.next(), this.isLineTerminator() ? e.label = null : (e.label = this.parseIdentifier(), this.semicolon()), this.verifyBreakContinue(e, t), this.finishNode(e, t ? "BreakStatement" : "ContinueStatement");
}
verifyBreakContinue(e, t) {
let s;
for (s = 0; s < this.state.labels.length; ++s) {
let i = this.state.labels[s];
if ((e.label == null || i.name === e.label.name) && (i.kind != null && (t || i.kind === 1) || e.label && t)) break;
}
if (s === this.state.labels.length) {
let i = t ? "BreakStatement" : "ContinueStatement";
this.raise(l.IllegalBreakContinue, e, { type: i });
}
}
parseDebuggerStatement(e) {
return this.next(), this.semicolon(), this.finishNode(e, "DebuggerStatement");
}
parseHeaderExpression() {
this.expect(6);
let e = this.parseExpression();
return this.expect(7), e;
}
parseDoWhileStatement(e) {
return this.next(), this.state.labels.push(Kt), e.body = this.parseStatement(), this.state.labels.pop(), this.expect(88), e.test = this.parseHeaderExpression(), this.eat(9), this.finishNode(e, "DoWhileStatement");
}
parseForStatement(e) {
this.next(), this.state.labels.push(Kt);
let t = null;
if (this.isContextual(92) && this.recordAwaitIfAllowed() && (t = this.state.startLoc, this.next()), this.scope.enter(0), this.expect(6), this.match(9)) return t !== null && this.unexpected(t), this.parseFor(e, null);
let s = this.isContextual(96);
{
let h = this.isAwaitUsing(), c = h || this.isForUsing(), p = s && this.hasFollowingBindingAtom() || c;
if (this.match(70) || this.match(71) || p) {
let f = this.startNode(), d;
h ? (d = "await using", this.recordAwaitIfAllowed() || this.raise(l.AwaitUsingNotInAsyncContext, this.state.startLoc), this.next()) : d = this.state.value, this.next(), this.parseVar(f, true, d);
let x = this.finishNode(f, "VariableDeclaration"), T = this.match(54);
return T && c && this.raise(l.ForInUsing, x), (T || this.isContextual(98)) && x.declarations.length === 1 ? this.parseForIn(e, x, t) : (t !== null && this.unexpected(t), this.parseFor(e, x));
}
}
let i = this.isContextual(91), r = new et(), n = this.parseExpression(true, r), o = this.isContextual(98);
if (o && (s && this.raise(l.ForOfLet, n), t === null && i && n.type === "Identifier" && this.raise(l.ForOfAsync, n)), o || this.match(54)) {
this.checkDestructuringPrivate(r), this.toAssignable(n, true);
let h = o ? "ForOfStatement" : "ForInStatement";
return this.checkLVal(n, { type: h }), this.parseForIn(e, n, t);
} else this.checkExpressionErrors(r, true);
return t !== null && this.unexpected(t), this.parseFor(e, n);
}
parseFunctionStatement(e, t, s) {
return this.next(), this.parseFunction(e, 1 | (s ? 2 : 0) | (t ? 8 : 0));
}
parseIfStatement(e) {
return this.next(), e.test = this.parseHeaderExpression(), e.consequent = this.parseStatementOrSloppyAnnexBFunctionDeclaration(), e.alternate = this.eat(62) ? this.parseStatementOrSloppyAnnexBFunctionDeclaration() : null, this.finishNode(e, "IfStatement");
}
parseReturnStatement(e) {
return this.prodParam.hasReturn || this.raise(l.IllegalReturn, this.state.startLoc), this.next(), this.isLineTerminator() ? e.argument = null : (e.argument = this.parseExpression(), this.semicolon()), this.finishNode(e, "ReturnStatement");
}
parseSwitchStatement(e) {
this.next(), e.discriminant = this.parseHeaderExpression();
let t = e.cases = [];
this.expect(2), this.state.labels.push(rr), this.scope.enter(256);
let s;
for (let i; !this.match(4); ) if (this.match(57) || this.match(61)) {
let r = this.match(57);
s && this.finishNode(s, "SwitchCase"), t.push(s = this.startNode()), s.consequent = [], this.next(), r ? s.test = this.parseExpression() : (i && this.raise(l.MultipleDefaultsInSwitch, this.state.lastTokStartLoc), i = true, s.test = null), this.expect(10);
} else s ? s.consequent.push(this.parseStatementListItem()) : this.unexpected();
return this.scope.exit(), s && this.finishNode(s, "SwitchCase"), this.next(), this.state.labels.pop(), this.finishNode(e, "SwitchStatement");
}
parseThrowStatement(e) {
return this.next(), this.hasPrecedingLineBreak() && this.raise(l.NewlineAfterThrow, this.state.lastTokEndLoc), e.argument = this.parseExpression(), this.semicolon(), this.finishNode(e, "ThrowStatement");
}
parseCatchClauseParam() {
let e = this.parseBindingAtom();
return this.scope.enter(this.options.annexB && e.type === "Identifier" ? 8 : 0), this.checkLVal(e, { type: "CatchClause" }, 9), e;
}
parseTryStatement(e) {
if (this.next(), e.block = this.parseBlock(), e.handler = null, this.match(58)) {
let t = this.startNode();
this.next(), this.match(6) ? (this.expect(6), t.param = this.parseCatchClauseParam(), this.expect(7)) : (t.param = null, this.scope.enter(0)), t.body = this.parseBlock(false, false), this.scope.exit(), e.handler = this.finishNode(t, "CatchClause");
}
return e.finalizer = this.eat(63) ? this.parseBlock() : null, !e.handler && !e.finalizer && this.raise(l.NoCatchOrFinally, e), this.finishNode(e, "TryStatement");
}
parseVarStatement(e, t, s = false) {
return this.next(), this.parseVar(e, false, t, s), this.semicolon(), this.finishNode(e, "VariableDeclaration");
}
parseWhileStatement(e) {
return this.next(), e.test = this.parseHeaderExpression(), this.state.labels.push(Kt), e.body = this.parseStatement(), this.state.labels.pop(), this.finishNode(e, "WhileStatement");
}
parseWithStatement(e) {
return this.state.strict && this.raise(l.StrictWith, this.state.startLoc), this.next(), e.object = this.parseHeaderExpression(), e.body = this.parseStatement(), this.finishNode(e, "WithStatement");
}
parseEmptyStatement(e) {
return this.next(), this.finishNode(e, "EmptyStatement");
}
parseLabeledStatement(e, t, s, i) {
for (let n of this.state.labels) n.name === t && this.raise(l.LabelRedeclaration, s, { labelName: t });
let r = Ai(this.state.type) ? 1 : this.match(67) ? 2 : null;
for (let n = this.state.labels.length - 1; n >= 0; n--) {
let o = this.state.labels[n];
if (o.statementStart === e.start) o.statementStart = this.sourceToOffsetPos(this.state.start), o.kind = r;
else break;
}
return this.state.labels.push({ name: t, kind: r, statementStart: this.sourceToOffsetPos(this.state.start) }), e.body = i & 8 ? this.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : this.parseStatement(), this.state.labels.pop(), e.label = s, this.finishNode(e, "LabeledStatement");
}
parseExpressionStatement(e, t, s) {
return e.expression = t, this.semicolon(), this.finishNode(e, "ExpressionStatement");
}
parseBlock(e = false, t = true, s) {
let i = this.startNode();
return e && this.state.strictErrors.clear(), this.expect(2), t && this.scope.enter(0), this.parseBlockBody(i, e, false, 4, s), t && this.scope.exit(), this.finishNode(i, "BlockStatement");
}
isValidDirective(e) {
return e.type === "ExpressionStatement" && e.expression.type === "StringLiteral" && !e.expression.extra.parenthesized;
}
parseBlockBody(e, t, s, i, r) {
let n = e.body = [], o = e.directives = [];
this.parseBlockOrModuleBlockBody(n, t ? o : void 0, s, i, r);
}
parseBlockOrModuleBlockBody(e, t, s, i, r) {
let n = this.state.strict, o = false, h = false;
for (; !this.match(i); ) {
let c = s ? this.parseModuleItem() : this.parseStatementListItem();
if (t && !h) {
if (this.isValidDirective(c)) {
let p = this.stmtToDirective(c);
t.push(p), !o && p.value.value === "use strict" && (o = true, this.setStrict(true));
continue;
}
h = true, this.state.strictErrors.clear();
}
e.push(c);
}
r?.call(this, o), n || this.setStrict(false), this.next();
}
parseFor(e, t) {
return e.init = t, this.semicolon(false), e.test = this.match(9) ? null : this.parseExpression(), this.semicolon(false), e.update = this.match(7) ? null : this.parseExpression(), this.expect(7), e.body = this.parseStatement(), this.scope.exit(), this.state.labels.pop(), this.finishNode(e, "ForStatement");
}
parseForIn(e, t, s) {
let i = this.match(54);
return this.next(), i ? s !== null && this.unexpected(s) : e.await = s !== null, t.type === "VariableDeclaration" && t.declarations[0].init != null && (!i || !this.options.annexB || this.state.strict || t.kind !== "var" || t.declarations[0].id.type !== "Identifier") && this.raise(l.ForInOfLoopInitializer, t, { type: i ? "ForInStatement" : "ForOfStatement" }), t.type === "AssignmentPattern" && this.raise(l.InvalidLhs, t, { ancestor: { type: "ForStatement" } }), e.left = t, e.right = i ? this.parseExpression() : this.parseMaybeAssignAllowIn(), this.expect(7), e.body = this.parseStatement(), this.scope.exit(), this.state.labels.pop(), this.finishNode(e, i ? "ForInStatement" : "ForOfStatement");
}
parseVar(e, t, s, i = false) {
let r = e.declarations = [];
for (e.kind = s; ; ) {
let n = this.startNode();
if (this.parseVarId(n, s), n.init = this.eat(25) ? t ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn() : null, n.init === null && !i && (n.id.type !== "Identifier" && !(t && (this.match(54) || this.isContextual(98))) ? this.raise(l.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind: "destructuring" }) : (s === "const" || s === "using" || s === "await using") && !(this.match(54) || this.isContextual(98)) && this.raise(l.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind: s })), r.push(this.finishNode(n, "VariableDeclarator")), !this.eat(8)) break;
}
return e;
}
parseVarId(e, t) {
let s = this.parseBindingAtom();
t === "using" || t === "await using" ? (s.type === "ArrayPattern" || s.type === "ObjectPattern") && this.raise(l.UsingDeclarationHasBindingPattern, s) : s.type === "VoidPattern" && this.raise(l.UnexpectedVoidPattern, s), this.checkLVal(s, { type: "VariableDeclarator" }, t === "var" ? 5 : 8201), e.id = s;
}
parseAsyncFunctionExpression(e) {
return this.parseFunction(e, 8);
}
parseFunction(e, t = 0) {
let s = t & 2, i = !!(t & 1), r = i && !(t & 4), n = !!(t & 8);
return this.initFunction(e, n), this.match(51) && (s && this.raise(l.GeneratorInSingleStatementContext, this.state.startLoc), this.next(), e.generator = true), i && (e.id = this.parseFunctionId(r)), this.scope.enter(514), this.prodParam.enter(Nt(n, e.generator)), i || (e.id = this.parseFunctionId()), this.parseFunctionParams(e, false), this.parseFunctionBodyAndFinish(e, i ? "FunctionDeclaration" : "FunctionExpression"), this.prodParam.exit(), this.scope.exit(), i && !s && this.registerFunctionStatementId(e), e;
}
parseFunctionId(e) {
return e || C(this.state.type) ? this.parseIdentifier() : null;
}
parseFunctionParams(e, t) {
this.expect(6), this.expressionScope.enter(er()), e.params = this.parseBindingList(7, 41, 2 | (t ? 4 : 0)), this.expressionScope.exit();
}
registerFunctionStatementId(e) {
e.id && this.scope.declareName(e.id.name, !this.options.annexB || this.state.strict || e.generator || e.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, e.id.start);
}
parseClass(e, t, s) {
this.next();
let i = this.state.strict;
return this.state.strict = true, this.parseClassId(e, t, s), this.parseClassSuper(e), e.body = this.parseClassBody(!!e.superClass, i), this.finishNode(e, t ? "ClassDeclaration" : "ClassExpression");
}
isClassProperty() {
return this.match(25) || this.match(9) || this.match(4);
}
isClassMethod() {
return this.match(6);
}
nameIsConstructor(e) {
return e.type === "Identifier" && e.name === "constructor" || e.type === "StringLiteral" && e.value === "constructor";
}
isNonstaticConstructor(e) {
return !e.computed && !e.static && this.nameIsConstructor(e.key);
}
parseClassBody(e, t) {
this.classScope.enter();
let s = { hadConstructor: false, hadSuperClass: e }, i = [], r = this.startNode();
for (r.body = [], this.expect(2); !this.match(4); ) {
if (this.eat(9)) {
if (i.length > 0) throw this.raise(l.DecoratorSemicolon, this.state.lastTokEndLoc);
continue;
}
if (this.match(22)) {
i.push(this.parseDecorator());
continue;
}
let n = this.startNode();
i.length && (n.decorators = i, this.resetStartLocationFromNode(n, i[0]), i = []), this.parseClassMember(r, n, s);
}
if (this.state.strict = t, this.next(), i.length) throw this.raise(l.TrailingDecorator, this.state.startLoc);
return this.classScope.exit(), this.finishNode(r, "ClassBody");
}
parseClassMemberFromModifier(e, t) {
let s = this.parseIdentifier(true);
if (this.isClassMethod()) {
let i = t;
return i.kind = "method", i.computed = false, i.key = s, i.static = false, this.pushClassMethod(e, i, false, false, false, false), true;
} else if (this.isClassProperty()) {
let i = t;
return i.computed = false, i.key = s, i.static = false, e.body.push(this.parseClassProperty(i)), true;
}
return this.resetPreviousNodeTrailingComments(s), false;
}
parseClassMember(e, t, s) {
let i = this.isContextual(102);
if (i) {
if (this.parseClassMemberFromModifier(e, t)) return;
if (this.eat(2)) {
this.parseClassStaticBlock(e, t);
return;
}
}
this.parseClassMemberWithIsStatic(e, t, s, i);
}
parseClassMemberWithIsStatic(e, t, s, i) {
let r = t, n = t, o = t, h = t, c = t, p = r, f = r;
if (t.static = i, this.parsePropertyNamePrefixOperator(t), this.eat(51)) {
p.kind = "method";
let E = this.match(134);
if (this.parseClassElementName(p), this.parsePostMemberNameModifiers(p), E) {
this.pushClassPrivateMethod(e, n, true, false);
return;
}
this.isNonstaticConstructor(r) && this.raise(l.ConstructorIsGenerator, r.key), this.pushClassMethod(e, r, true, false, false, false);
return;
}
let d = !this.state.containsEsc && C(this.state.type), x = this.parseClassElementName(t), T = d ? x.name : null, D = this.isPrivateName(x), v = this.state.startLoc;
if (this.parsePostMemberNameModifiers(f), this.isClassMethod()) {
if (p.kind = "method", D) {
this.pushClassPrivateMethod(e, n, false, false);
return;
}
let E = this.isNonstaticConstructor(r), I = false;
E && (r.kind = "constructor", r.decorators && r.decorators.length > 0 && this.raise(l.DecoratorConstructor, t), s.hadConstructor && !this.hasPlugin("typescript") && this.raise(l.DuplicateConstructor, x), E && this.hasPlugin("typescript") && t.override && this.raise(l.OverrideOnConstructor, x), s.hadConstructor = true, I = s.hadSuperClass), this.pushClassMethod(e, r, false, false, E, I);
} else if (this.isClassProperty()) D ? this.pushClassPrivateProperty(e, h) : this.pushClassProperty(e, o);
else if (T === "async" && !this.isLineTerminator()) {
this.resetPreviousNodeTrailingComments(x);
let E = this.eat(51);
f.optional && this.unexpected(v), p.kind = "method";
let I = this.match(134);
this.parseClassElementName(p), this.parsePostMemberNameModifiers(f), I ? this.pushClassPrivateMethod(e, n, E, true) : (this.isNonstaticConstructor(r) && this.raise(l.ConstructorIsAsync, r.key), this.pushClassMethod(e, r, E, true, false, false));
} else if ((T === "get" || T === "set") && !(this.match(51) && this.isLineTerminator())) {
this.resetPreviousNodeTrailingComments(x), p.kind = T;
let E = this.match(134);
this.parseClassElementName(r), E ? this.pushClassPrivateMethod(e, n, false, false) : (this.isNonstaticConstructor(r) && this.raise(l.ConstructorIsAccessor, r.key), this.pushClassMethod(e, r, false, false, false, false)), this.checkGetterSetterParams(r);
} else if (T === "accessor" && !this.isLineTerminator()) {
this.expectPlugin("decoratorAutoAccessors"), this.resetPreviousNodeTrailingComments(x);
let E = this.match(134);
this.parseClassElementName(o), this.pushClassAccessorProperty(e, c, E);
} else this.isLineTerminator() ? D ? this.pushClassPrivateProperty(e, h) : this.pushClassProperty(e, o) : this.unexpected();
}
parseClassElementName(e) {
let { type: t, value: s } = this.state;
if ((t === 128 || t === 130) && e.static && s === "prototype" && this.raise(l.StaticPrototype, this.state.startLoc), t === 134) {
s === "constructor" && this.raise(l.ConstructorClassPrivateField, this.state.startLoc);
let i = this.parsePrivateName();
return e.key = i, i;
}
return this.parsePropertyName(e), e.key;
}
parseClassStaticBlock(e, t) {
this.scope.enter(720);
let s = this.state.labels;
this.state.labels = [], this.prodParam.enter(0);
let i = t.body = [];
this.parseBlockOrModuleBlockBody(i, void 0, false, 4), this.prodParam.exit(), this.scope.exit(), this.state.labels = s, e.body.push(this.finishNode(t, "StaticBlock")), t.decorators?.length && this.raise(l.DecoratorStaticBlock, t);
}
pushClassProperty(e, t) {
!t.computed && this.nameIsConstructor(t.key) && this.raise(l.ConstructorClassField, t.key), e.body.push(this.parseClassProperty(t));
}
pushClassPrivateProperty(e, t) {
let s = this.parseClassPrivateProperty(t);
e.body.push(s), this.classScope.declarePrivateName(this.getPrivateNameSV(s.key), 0, s.key.start);
}
pushClassAccessorProperty(e, t, s) {
!s && !t.computed && this.nameIsConstructor(t.key) && this.raise(l.ConstructorClassField, t.key);
let i = this.parseClassAccessorProperty(t);
e.body.push(i), s && this.classScope.declarePrivateName(this.getPrivateNameSV(i.key), 0, i.key.start);
}
pushClassMethod(e, t, s, i, r, n) {
e.body.push(this.parseMethod(t, s, i, r, n, "ClassMethod", true));
}
pushClassPrivateMethod(e, t, s, i) {
let r = this.parseMethod(t, s, i, false, false, "ClassPrivateMethod", true);
e.body.push(r);
let n = r.kind === "get" ? r.static ? 6 : 2 : r.kind === "set" ? r.static ? 5 : 1 : 0;
this.declareClassPrivateMethodInScope(r, n);
}
declareClassPrivateMethodInScope(e, t) {
this.classScope.declarePrivateName(this.getPrivateNameSV(e.key), t, e.key.start);
}
parsePostMemberNameModifiers(e) {
}
parseClassPrivateProperty(e) {
return this.parseInitializer(e), this.semicolon(), this.finishNode(e, "ClassPrivateProperty");
}
parseClassProperty(e) {
return this.parseInitializer(e), this.semicolon(), this.finishNode(e, "ClassProperty");
}
parseClassAccessorProperty(e) {
return this.parseInitializer(e), this.semicolon(), this.finishNode(e, "ClassAccessorProperty");
}
parseInitializer(e) {
this.scope.enter(592), this.expressionScope.enter(hs()), this.prodParam.enter(0), e.value = this.eat(25) ? this.parseMaybeAssignAllowIn() : null, this.expressionScope.exit(), this.prodParam.exit(), this.scope.exit();
}
parseClassId(e, t, s, i = 8331) {
if (C(this.state.type)) e.id = this.parseIdentifier(), t && this.declareNameFromIdentifier(e.id, i);
else if (s || !t) e.id = null;
else throw this.raise(l.MissingClassName, this.state.startLoc);
}
parseClassSuper(e) {
this.eat(77) ? (this.state.canStartArrow = false, e.superClass = this.parseExprSubscripts()) : e.superClass = null;
}
parseExport(e, t) {
let s = this.parseMaybeImportPhase(e, true), i = this.maybeParseExportDefaultSpecifier(e, s), r = !i || this.eat(8), n = r && this.eatExportStar(e), o = n && this.maybeParseExportNamespaceSpecifier(e), h = r && (!o || this.eat(8)), c = i || n;
if (n && !o) {
if (i && this.unexpected(), t) throw this.raise(l.UnsupportedDecoratorExport, e);
return this.parseExportFrom(e, true), this.sawUnambiguousESM = true, this.finishNode(e, "ExportAllDeclaration");
}
let p = this.maybeParseExportNamedSpecifiers(e);
i && r && !n && !p && this.unexpected(null, 2), o && h && this.unexpected(null, 94);
let f;
if (c || p) {
if (f = false, t) throw this.raise(l.UnsupportedDecoratorExport, e);
this.parseExportFrom(e, c);
} else f = this.maybeParseExportDeclaration(e);
if (c || p || f) {
let d = e;
if (this.checkExport(d, true, false, !!d.source), d.declaration?.type === "ClassDeclaration") this.maybeTakeDecorators(t, d.declaration, d);
else if (t) throw this.raise(l.UnsupportedDecoratorExport, e);
return this.sawUnambiguousESM = true, this.finishNode(d, "ExportNamedDeclaration");
}
if (this.eat(61)) {
let d = e, x = this.parseExportDefaultExpression();
if (d.declaration = x, x.type === "ClassDeclaration") this.maybeTakeDecorators(t, x, d);
else if (t) throw this.raise(l.UnsupportedDecoratorExport, e);
return this.checkExport(d, true, true), this.sawUnambiguousESM = true, this.finishNode(d, "ExportDefaultDeclaration");
}
throw this.unexpected(null, 2);
}
eatExportStar(e) {
return this.eat(51);
}
maybeParseExportDefaultSpecifier(e, t) {
if (t || this.isExportDefaultSpecifier()) {
this.expectPlugin("exportDefaultFrom", t?.start);
let s = t || this.parseIdentifier(true), i = this.startNodeAtNode(s);
return i.exported = s, e.specifiers = [this.finishNode(i, "ExportDefaultSpecifier")], true;
}
return false;
}
maybeParseExportNamespaceSpecifier(e) {
if (this.isContextual(89)) {
e.specifiers ?? (e.specifiers = []);
let t = this.startNodeAt(this.state.lastTokStartLoc);
return this.next(), t.exported = this.parseModuleExportName(), e.specifiers.push(this.finishNode(t, "ExportNamespaceSpecifier")), true;
}
return false;
}
maybeParseExportNamedSpecifiers(e) {
if (this.match(2)) {
let t = e;
t.specifiers || (t.specifiers = []);
let s = t.exportKind === "type";
return t.specifiers.push(...this.parseExportSpecifiers(s)), t.source = null, t.attributes = [], t.declaration = null, true;
}
return false;
}
maybeParseExportDeclaration(e) {
return this.shouldParseExportDeclaration() ? (e.specifiers = [], e.source = null, e.attributes = [], e.declaration = this.parseExportDeclaration(e), true) : false;
}
isAsyncFunction() {
if (!this.isContextual(91)) return false;
let e = this.nextTokenInLineStart();
return this.isUnparsedContextual(e, "function");
}
parseExportDefaultExpression() {
let e = this.startNode();
if (this.match(64)) return this.next(), this.parseFunction(e, 5);
if (this.isAsyncFunction()) return this.next(), this.next(), this.parseFunction(e, 13);
if (this.match(76)) return this.parseClass(e, true, true);
if (this.match(22)) return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
if (this.match(71) || this.match(70) || this.isLet() || this.isUsing() || this.isAwaitUsing()) throw this.raise(l.UnsupportedDefaultExport, this.state.startLoc);
let t = this.parseMaybeAssignAllowIn();
return this.semicolon(), t;
}
parseExportDeclaration(e) {
return this.match(76) ? this.parseClass(this.startNode(), true, false) : this.parseStatementListItem();
}
isExportDefaultSpecifier() {
let { type: e } = this.state;
if (C(e)) {
if (e === 91 && !this.state.containsEsc || e === 96) return false;
if ((e === 126 || e === 125) && !this.state.containsEsc) {
let i = this.nextTokenStart(), r = this.input.charCodeAt(i);
if (r === 123 || this.chStartsBindingIdentifier(r, i) && !this.input.startsWith("from", i)) return this.expectOnePlugin(["flow", "typescript"]), false;
}
} else if (!this.match(61)) return false;
let t = this.nextTokenStart(), s = this.isUnparsedContextual(t, "from");
if (this.input.charCodeAt(t) === 44 || C(this.state.type) && s) return true;
if (this.match(61) && s) {
let i = this.input.charCodeAt(this.nextTokenStartSince(t + 4));
return i === 34 || i === 39;
}
return false;
}
parseExportFrom(e, t) {
this.eatContextual(94) ? (e.source = this.parseImportSource(), this.checkExport(e), this.maybeParseImportAttributes(e)) : t && this.unexpected(), this.semicolon();
}
shouldParseExportDeclaration() {
let { type: e } = this.state;
return e === 22 && (this.expectOnePlugin(["decorators", "decorators-legacy"]), this.hasPlugin("decorators")) ? true : this.isUsing() ? (this.raise(l.UsingDeclarationExport, this.state.startLoc), true) : this.isAwaitUsing() ? (this.raise(l.UsingDeclarationExport, this.state.startLoc), true) : e === 70 || e === 71 || e === 64 || e === 76 || this.isLet() || this.isAsyncFunction();
}
checkExport(e, t, s, i) {
if (t) {
if (s) {
if (this.checkDuplicateExports(e, "default"), this.hasPlugin("exportDefaultFrom")) {
let r = e.declaration;
r.type === "Identifier" && r.name === "from" && r.end - r.start === 4 && !r.extra?.parenthesized && this.raise(l.ExportDefaultFromAsIdentifier, r);
}
} else if (e.specifiers?.length) for (let r of e.specifiers) {
let { exported: n } = r, o = n.type === "Identifier" ? n.name : n.value;
if (this.checkDuplicateExports(r, o), !i && r.local) {
let { local: h } = r;
h.type !== "Identifier" ? this.raise(l.ExportBindingIsString, r, { localName: h.value, exportName: o }) : (this.checkReservedWord(h.name, h.start, true, false), this.scope.checkLocalExport(h));
}
}
else if (e.declaration) {
let r = e.declaration;
if (r.type === "FunctionDeclaration" || r.type === "ClassDeclaration") {
let { id: n } = r;
if (!n) throw new Error("Assertion failure");
this.checkDuplicateExports(e, n.name);
} else if (r.type === "VariableDeclaration") for (let n of r.declarations) this.checkDeclaration(n.id);
}
}
}
checkDeclaration(e) {
if (e.type === "Identifier") this.checkDuplicateExports(e, e.name);
else if (e.type === "ObjectPattern") for (let t of e.properties) this.checkDeclaration(t);
else if (e.type === "ArrayPattern") for (let t of e.elements) t && this.checkDeclaration(t);
else e.type === "ObjectProperty" ? this.checkDeclaration(e.value) : e.type === "RestElement" ? this.checkDeclaration(e.argument) : e.type === "AssignmentPattern" && this.checkDeclaration(e.left);
}
checkDuplicateExports(e, t) {
this.exportedIdentifiers.has(t) && (t === "default" ? this.raise(l.DuplicateDefaultExport, e) : this.raise(l.DuplicateExport, e, { exportName: t })), this.exportedIdentifiers.add(t);
}
parseExportSpecifiers(e) {
let t = [], s = true;
for (this.expect(2); !this.eat(4); ) {
if (s) s = false;
else if (this.expect(8), this.eat(4)) break;
let i = this.isContextual(126), r = this.match(130), n = this.startNode();
n.local = this.parseModuleExportName(), t.push(this.parseExportSpecifier(n, r, e, i));
}
return t;
}
parseExportSpecifier(e, t, s, i) {
return this.eatContextual(89) ? e.exported = this.parseModuleExportName() : t ? e.exported = this.cloneStringLiteral(e.local) : e.exported || (e.exported = this.cloneIdentifier(e.local)), this.finishNode(e, "ExportSpecifier");
}
parseModuleExportName() {
if (this.match(130)) {
let e = this.parseStringLiteral(this.state.value), t = ar.exec(e.value);
return t && this.raise(l.ModuleExportNameHasLoneSurrogate, e, { surrogateCharCode: t[0].charCodeAt(0) }), e;
}
return this.parseIdentifier(true);
}
checkImportPhase(e) {
let { specifiers: t } = e, s = t.length === 1 ? t[0].type : null;
e.phase === "source" ? s !== "ImportDefaultSpecifier" && this.raise(l.SourcePhaseImportRequiresDefault, t[0]) : e.phase === "defer" && s !== "ImportNamespaceSpecifier" && this.raise(l.DeferImportRequiresNamespace, t[0]);
}
isPotentialImportPhase(e) {
return e ? false : this.isContextual(101) || this.isContextual(93);
}
applyImportPhase(e, t, s, i) {
t || (s === "source" ? (this.expectPlugin("sourcePhaseImports", i), e.phase = "source") : s === "defer" ? (this.expectPlugin("deferredImportEvaluation", i), e.phase = "defer") : this.hasPlugin("sourcePhaseImports") && (e.phase = null));
}
parseMaybeImportPhase(e, t) {
if (!this.isPotentialImportPhase(t)) return this.applyImportPhase(e, t, null), null;
let s = this.startNode(), i = this.parseIdentifierName(true), { type: r } = this.state;
return (B(r) ? r !== 94 || this.lookaheadCharCode() === 102 : r !== 8) ? (this.applyImportPhase(e, t, i, s.start), null) : (this.applyImportPhase(e, t, null), this.createIdentifier(s, i));
}
isPrecedingIdImportPhase(e) {
let { type: t } = this.state;
return C(t) ? t !== 94 || this.lookaheadCharCode() === 102 : t !== 8;
}
parseImport(e) {
return this.match(130) ? this.parseImportSourceAndAttributes(e) : this.parseImportSpecifiersAndAfter(e, this.parseMaybeImportPhase(e, false));
}
parseImportSpecifiersAndAfter(e, t) {
e.specifiers = [];
let i = !this.maybeParseDefaultImportSpecifier(e, t) || this.eat(8), r = i && this.maybeParseStarImportSpecifier(e);
return i && !r && this.parseNamedImportSpecifiers(e), this.expectContextual(94), this.parseImportSourceAndAttributes(e);
}
parseImportSourceAndAttributes(e) {
return e.specifiers ?? (e.specifiers = []), e.source = this.parseImportSource(), this.maybeParseImportAttributes(e), this.checkImportPhase(e), this.semicolon(), this.sawUnambiguousESM = true, this.finishNode(e, "ImportDeclaration");
}
parseImportSource() {
return this.match(130) || this.unexpected(), this.parseExprAtom();
}
parseImportSpecifierLocal(e, t, s) {
t.local = this.parseIdentifier(), e.specifiers.push(this.finishImportSpecifier(t, s));
}
finishImportSpecifier(e, t, s = 8201) {
return this.checkLVal(e.local, { type: t }, s), this.finishNode(e, t);
}
parseImportAttributes() {
this.expect(2);
let e = [], t = /* @__PURE__ */ new Set();
do {
if (this.match(4)) break;
let s = this.startNode(), i = this.state.value;
if (t.has(i) && this.raise(l.ModuleAttributesWithDuplicateKeys, this.state.startLoc, { key: i }), t.add(i), this.match(130) ? s.key = this.parseStringLiteral(i) : s.key = this.parseIdentifier(true), this.expect(10), !this.match(130)) throw this.raise(l.ModuleAttributeInvalidValue, this.state.startLoc);
s.value = this.parseStringLiteral(this.state.value), e.push(this.finishNode(s, "ImportAttribute"));
} while (this.eat(8));
return this.expect(4), e;
}
maybeParseImportAttributes(e) {
let t;
if (this.match(72)) {
if (this.hasPrecedingLineBreak() && this.lookaheadCharCode() === 40) return;
this.next(), t = this.parseImportAttributes();
} else t = [];
e.attributes = t;
}
maybeParseDefaultImportSpecifier(e, t) {
if (t) {
let s = this.startNodeAtNode(t);
return s.local = t, e.specifiers.push(this.finishImportSpecifier(s, "ImportDefaultSpecifier")), true;
} else if (B(this.state.type)) return this.parseImportSpecifierLocal(e, this.startNode(), "ImportDefaultSpecifier"), true;
return false;
}
maybeParseStarImportSpecifier(e) {
if (this.match(51)) {
let t = this.startNode();
return this.next(), this.expectContextual(89), this.parseImportSpecifierLocal(e, t, "ImportNamespaceSpecifier"), true;
}
return false;
}
parseNamedImportSpecifiers(e) {
let t = true;
for (this.expect(2); !this.eat(4); ) {
if (t) t = false;
else {
if (this.eat(10)) throw this.raise(l.DestructureNamedImport, this.state.startLoc);
if (this.expect(8), this.eat(4)) break;
}
let s = this.startNode(), i = this.match(130), r = this.isContextual(126);
s.imported = this.parseModuleExportName();
let n = this.parseImportSpecifier(s, i, e.importKind === "type" || e.importKind === "typeof", r, void 0);
e.specifiers.push(n);
}
}
parseImportSpecifier(e, t, s, i, r) {
if (this.eatContextual(89)) e.local = this.parseIdentifier();
else {
let { imported: n } = e;
if (t) throw this.raise(l.ImportBindingIsString, e, { importName: n.value });
this.checkReservedWord(n.name, e.start, true, true), e.local || (e.local = this.cloneIdentifier(n));
}
return this.finishImportSpecifier(e, "ImportSpecifier", r);
}
isThisParam(e) {
return e.type === "Identifier" && e.name === "this";
}
};
Jt = /in(?:stanceof)?|as|satisfies/y;
or = { AbstractMethodHasImplementation: ({ methodName: a2 }) => `Method '${a2}' cannot have an implementation because it is marked abstract.`, AbstractPropertyHasInitializer: ({ propertyName: a2 }) => `Property '${a2}' cannot have an initializer because it is marked abstract.`, AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.", AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.", AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.", ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.", ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.", ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.", ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.", DeclareAccessor: ({ kind: a2 }) => `'declare' is not allowed in ${a2}ters.`, DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.", DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.", DecoratorAbstractMethod: ({ kind: a2 }) => `Decorators can't be used with ${a2.startsWith("a") ? "an" : "a"} ${a2}.`, DuplicateAccessibilityModifier: ({ modifier: a2 }) => `Accessibility modifier already seen: '${a2}'.`, DuplicateModifier: ({ modifier: a2 }) => `Duplicate modifier: '${a2}'.`, EmptyHeritageClauseType: ({ token: a2 }) => `'${a2}' list cannot be empty.`, EmptyTypeArguments: "Type argument list cannot be empty.", EmptyTypeParameters: "Type parameter list cannot be empty.", ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.", ExportAssignmentInTSNamespace: "An export assignment cannot be used in a namespace.", ExportInTSNamespace: "Export declarations are not permitted in a namespace.", ImportAliasHasImportType: "An import alias can not use 'import type'.", ImportInTSNamespace: "Import declarations in a namespace cannot reference a module.", IncompatibleModifiers: ({ modifiers: a2 }) => `'${a2[0]}' modifier cannot be used with '${a2[1]}' modifier.`, IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.", IndexSignatureHasAccessibility: ({ modifier: a2 }) => `Index signatures cannot have an accessibility modifier ('${a2}').`, IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.", IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.", IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.", InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.", InlineModuleDeclarationMustUseString: "`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.", InvalidHeritageClauseType: ({ token: a2 }) => `'${a2}' list can only include identifiers or qualified-names with optional type arguments.`, InvalidModifierOnAwaitUsingDeclaration: (a2) => `'${a2}' modifier cannot appear on an await using declaration.`, InvalidModifierOnTypeMember: ({ modifier: a2 }) => `'${a2}' modifier cannot appear on a type member.`, InvalidModifierOnTypeParameter: ({ modifier: a2 }) => `'${a2}' modifier cannot appear on a type parameter.`, InvalidModifierOnTypeParameterPositions: ({ modifier: a2 }) => `'${a2}' modifier can only appear on a type parameter of a class, interface or type alias.`, InvalidModifierOnUsingDeclaration: (a2) => `'${a2}' modifier cannot appear on a using declaration.`, InvalidModifiersOrder: ({ orderedModifiers: a2 }) => `'${a2[0]}' modifier must precede '${a2[1]}' modifier.`, InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.", InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.", MissingInterfaceName: "'interface' declarations must be followed by an identifier.", NamespaceExportInTSNamespace: "Global module exports may only appear at top level.", NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.", NonClassMethodPropertyHasAbstractModifier: "'abstract' modifier can only appear on a class, method, or property declaration.", OptionalTypeBeforeRequired: "A required element cannot follow an optional element.", OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.", PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.", PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.", PrivateElementHasAccessibility: ({ modifier: a2 }) => `Private elements cannot have an accessibility modifier ('${a2}').`, ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.", ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.", ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.", SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.", SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.", SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.", SingleTypeParameterWithoutTrailingComma: ({ typeParameterName: a2 }) => `Single type parameter ${a2} should have a trailing comma. Example usage: <${a2},>.`, StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.", TupleOptionalAfterType: "A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).", TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.", TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.", TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.", TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.", UnexpectedParameterInitializer: "A parameter initializer is only allowed in a function or constructor implementation.", UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.", UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.", UnexpectedTypeAnnotation: "Did not expect a type annotation here.", UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.", UnexpectedTypeDeclaration: (a2) => `'${a2}' declarations can only be declared inside a block.`, UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.", UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.", UnsupportedSignatureParameterKind: ({ type: a2 }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${a2}.`, UsingDeclarationInAmbientContext: (a2) => `'${a2}' declarations are not allowed in ambient contexts.` };
m = F`typescript`(or);
lr = (a2) => class extends a2 {
getScopeHandler() {
return te;
}
tsIsIdentifier() {
return C(this.state.type);
}
tsTokenCanFollowModifier() {
return this.match(0) || this.match(2) || this.match(51) || this.match(17) || this.match(134) || this.isLiteralPropertyName();
}
tsNextTokenOnSameLineAndCanFollowModifier() {
return this.next(), this.hasPrecedingLineBreak() ? false : this.tsTokenCanFollowModifier();
}
tsNextTokenCanFollowModifier() {
return this.match(102) ? (this.next(), this.tsTokenCanFollowModifier()) : this.tsNextTokenOnSameLineAndCanFollowModifier();
}
tsParseModifier(t, s, i) {
if (!C(this.state.type) && this.state.type !== 54 && this.state.type !== 71) return;
let r = this.state.value;
if (t.includes(r)) {
if (i && this.match(102) || s && this.tsIsStartOfStaticBlocks()) return;
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) return r;
}
}
tsParseModifiers({ allowedModifiers: t, disallowedModifiers: s, stopOnStartOfClassStaticBlock: i, errorTemplate: r = m.InvalidModifierOnTypeMember }, n) {
let o = (c, p, f, d) => {
p === f && n[d] && this.raise(m.InvalidModifiersOrder, c, { orderedModifiers: [f, d] });
}, h = (c, p, f, d) => {
(n[f] && p === d || n[d] && p === f) && this.raise(m.IncompatibleModifiers, c, { modifiers: [f, d] });
};
for (; ; ) {
let { startLoc: c } = this.state, p = this.tsParseModifier(t.concat(s ?? []), i, n.static);
if (!p) break;
Ke(p) ? n.accessibility ? this.raise(m.DuplicateAccessibilityModifier, c, { modifier: p }) : (o(c, p, p, "override"), o(c, p, p, "static"), o(c, p, p, "readonly"), n.accessibility = p) : cr(p) ? (n[p] && this.raise(m.DuplicateModifier, c, { modifier: p }), n[p] = true, o(c, p, "in", "out")) : (lt(n, p) ? this.raise(m.DuplicateModifier, c, { modifier: p }) : (o(c, p, "static", "readonly"), o(c, p, "static", "override"), o(c, p, "override", "readonly"), o(c, p, "abstract", "override"), h(c, p, "declare", "override"), h(c, p, "static", "abstract")), n[p] = true), s?.includes(p) && this.raise(r, c, { modifier: p });
}
}
tsIsListTerminator(t) {
switch (t) {
case "EnumMembers":
case "TypeMembers":
return this.match(4);
case "HeritageClauseElement":
return this.match(2);
case "TupleElementTypes":
return this.match(1);
case "TypeParametersOrArguments":
return this.match(44);
}
}
tsParseList(t, s) {
let i = [];
for (; !this.tsIsListTerminator(t); ) i.push(s());
return i;
}
tsParseDelimitedList(t, s, i) {
return nr(this.tsParseDelimitedListWorker(t, s, true, i));
}
tsParseDelimitedListWorker(t, s, i, r) {
let n = [], o = -1;
for (; !this.tsIsListTerminator(t); ) {
o = -1;
let h = s();
if (h == null) return;
if (n.push(h), this.eat(8)) {
o = this.state.lastTokStartLoc.index;
continue;
}
if (this.tsIsListTerminator(t)) break;
i && this.expect(8);
return;
}
return r && (r.value = o), n;
}
tsParseBracketedList(t, s, i, r, n) {
r || (i ? this.expect(0) : this.expect(43));
let o = this.tsParseDelimitedList(t, s, n);
return i ? this.expect(1) : this.expect(44), o;
}
tsParseImportType() {
let t = this.startNode();
return this.expect(79), this.expect(6), this.match(130) ? t.source = this.parseStringLiteral(this.state.value) : (this.raise(m.UnsupportedImportTypeArgument, this.state.startLoc), t.source = this.tsParseNonConditionalType()), this.eat(8) ? t.options = this.tsParseImportTypeOptions() : t.options = null, this.expect(7), this.eat(12) && (t.qualifier = this.tsParseEntityName(3)), this.match(43) && (t.typeArguments = this.tsParseTypeArguments()), this.finishNode(t, "TSImportType");
}
tsParseImportTypeOptions() {
let t = this.startNode();
this.expect(2);
let s = this.startNode();
return this.isContextual(72) ? (s.method = false, s.key = this.parseIdentifier(true), s.computed = false, s.shorthand = false) : this.unexpected(null, 72), this.expect(10), s.value = this.tsParseImportTypeWithPropertyValue(), t.properties = [this.finishObjectProperty(s)], this.eat(8), this.expect(4), this.finishNode(t, "ObjectExpression");
}
tsParseImportTypeWithPropertyValue() {
let t = this.startNode(), s = [];
for (this.expect(2); !this.match(4); ) {
let i = this.state.type;
C(i) || i === 130 ? s.push(super.parsePropertyDefinition(null)) : this.unexpected(), this.eat(8);
}
return t.properties = s, this.next(), this.finishNode(t, "ObjectExpression");
}
tsParseEntityName(t) {
let s;
if (t & 1 && this.match(74)) if (t & 2) s = this.parseIdentifier(true);
else {
let i = this.startNode();
this.next(), s = this.finishNode(i, "ThisExpression");
}
else s = this.parseIdentifier(!!(t & 1));
for (; this.eat(12); ) {
let i = this.startNodeAtNode(s);
i.left = s, i.right = this.parseIdentifier(!!(t & 1)), s = this.finishNode(i, "TSQualifiedName");
}
return s;
}
tsParseTypeReference() {
let t = this.startNode();
return t.typeName = this.tsParseEntityName(1), !this.hasPrecedingLineBreak() && this.match(43) && (t.typeArguments = this.tsParseTypeArguments()), this.finishNode(t, "TSTypeReference");
}
tsParseThisTypePredicate(t) {
this.next();
let s = this.startNodeAtNode(t);
return s.parameterName = t, s.typeAnnotation = this.tsParseTypeAnnotation(false), s.asserts = false, this.finishNode(s, "TSTypePredicate");
}
tsParseThisTypeNode() {
let t = this.startNode();
return this.next(), this.finishNode(t, "TSThisType");
}
tsParseTypeQuery() {
let t = this.startNode();
return this.expect(83), this.match(79) ? t.exprName = this.tsParseImportType() : t.exprName = this.tsParseEntityName(1), !this.hasPrecedingLineBreak() && this.match(43) && (t.typeArguments = this.tsParseTypeArguments()), this.finishNode(t, "TSTypeQuery");
}
tsParseInOutModifiers = this.tsParseModifiers.bind(this, { allowedModifiers: ["in", "out"], disallowedModifiers: ["const", "public", "private", "protected", "readonly", "declare", "abstract", "override"], errorTemplate: m.InvalidModifierOnTypeParameter });
tsParseConstModifier = this.tsParseModifiers.bind(this, { allowedModifiers: ["const"], disallowedModifiers: ["in", "out"], errorTemplate: m.InvalidModifierOnTypeParameterPositions });
tsParseInOutConstModifiers = this.tsParseModifiers.bind(this, { allowedModifiers: ["in", "out", "const"], disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"], errorTemplate: m.InvalidModifierOnTypeParameter });
tsParseTypeParameter(t) {
let s = this.startNode();
return t(s), s.name = this.tsParseTypeParameterName(), s.constraint = this.tsEatThenParseType(77), s.default = this.tsEatThenParseType(25), this.finishNode(s, "TSTypeParameter");
}
tsTryParseTypeParameters(t) {
if (this.match(43)) return this.tsParseTypeParameters(t);
}
tsParseTypeParameters(t) {
let s = this.startNode();
this.match(43) || this.match(138) ? this.next() : this.unexpected();
let i = { value: -1 };
return s.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, t), false, true, i), s.params.length === 0 && this.raise(m.EmptyTypeParameters, s), i.value !== -1 && this.addExtra(s, "trailingComma", i.value), this.finishNode(s, "TSTypeParameterDeclaration");
}
tsFillSignature(t, s) {
let i = t === 15, r = "params", n = "returnType";
s.typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier), this.expect(6), s[r] = this.tsParseBindingListForSignature(), i ? s[n] = this.tsParseTypeOrTypePredicateAnnotation(t) : this.match(t) && (s[n] = this.tsParseTypeOrTypePredicateAnnotation(t));
}
tsParseBindingListForSignature() {
let t = super.parseBindingList(7, 41, 2);
for (let s of t) {
let { type: i } = s;
(i === "AssignmentPattern" || i === "TSParameterProperty") && this.raise(m.UnsupportedSignatureParameterKind, s, { type: i });
}
return t;
}
tsParseTypeMemberSemicolon() {
!this.eat(8) && !this.isLineTerminator() && this.expect(9);
}
tsParseSignatureMember(t, s) {
return this.tsFillSignature(10, s), this.tsParseTypeMemberSemicolon(), this.finishNode(s, t);
}
tsIsUnambiguouslyIndexSignature() {
return this.next(), C(this.state.type) ? (this.next(), this.match(10)) : false;
}
tsTryParseIndexSignature(t) {
if (!(this.match(0) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) return;
this.expect(0);
let s = this.parseIdentifier();
s.typeAnnotation = this.tsParseTypeAnnotation(), this.resetEndLocation(s), this.expect(1), t.parameters = [s];
let i = this.tsTryParseTypeAnnotation();
return i && (t.typeAnnotation = i), this.tsParseTypeMemberSemicolon(), this.finishNode(t, "TSIndexSignature");
}
tsParsePropertyOrMethodSignature(t, s) {
if (this.eat(13) && (t.optional = true), this.match(6) || this.match(43)) {
s && this.raise(m.ReadonlyForMethodSignature, t);
let i = t;
if (i.kind && this.match(43) && this.raise(m.AccessorCannotHaveTypeParameters, this.state.curPosition()), this.tsFillSignature(10, i), this.tsParseTypeMemberSemicolon(), i.kind === "get") i.params.length > 0 && (this.raise(l.BadGetterArity, this.state.curPosition()), this.isThisParam(i.params[0]) && this.raise(m.AccessorCannotDeclareThisParameter, this.state.curPosition()));
else if (i.kind === "set") {
if (i.params.length !== 1) this.raise(l.BadSetterArity, this.state.curPosition());
else {
let r = i.params[0];
this.isThisParam(r) && this.raise(m.AccessorCannotDeclareThisParameter, this.state.curPosition()), r.type === "Identifier" && r.optional && this.raise(m.SetAccessorCannotHaveOptionalParameter, this.state.curPosition()), r.type === "RestElement" && this.raise(m.SetAccessorCannotHaveRestParameter, this.state.curPosition());
}
i.returnType && this.raise(m.SetAccessorCannotHaveReturnType, i.returnType);
} else i.kind = "method";
return this.finishNode(i, "TSMethodSignature");
} else {
let i = t;
s && (i.readonly = true);
let r = this.tsTryParseTypeAnnotation();
return r && (i.typeAnnotation = r), this.tsParseTypeMemberSemicolon(), this.finishNode(i, "TSPropertySignature");
}
}
tsParseTypeMember() {
let t = this.startNode();
if (this.match(6) || this.match(43)) return this.tsParseSignatureMember("TSCallSignatureDeclaration", t);
if (this.match(73)) {
let i = this.startNode();
return this.next(), this.match(6) || this.match(43) ? this.tsParseSignatureMember("TSConstructSignatureDeclaration", t) : (t.key = this.createIdentifier(i, "new"), this.tsParsePropertyOrMethodSignature(t, false));
}
this.tsParseModifiers({ allowedModifiers: ["readonly"], disallowedModifiers: ["declare", "abstract", "private", "protected", "public", "static", "override"] }, t);
let s = this.tsTryParseIndexSignature(t);
return s || (super.parsePropertyName(t), !t.computed && t.key.type === "Identifier" && (t.key.name === "get" || t.key.name === "set") && this.tsTokenCanFollowModifier() && (t.kind = t.key.name, super.parsePropertyName(t), !this.match(6) && !this.match(43) && this.unexpected(null, 6)), this.tsParsePropertyOrMethodSignature(t, !!t.readonly));
}
tsParseTypeLiteral() {
let t = this.startNode();
return t.members = this.tsParseObjectTypeMembers(), this.finishNode(t, "TSTypeLiteral");
}
tsParseObjectTypeMembers() {
this.expect(2);
let t = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
return this.expect(4), t;
}
tsIsStartOfMappedType() {
return this.next(), this.eat(49) ? this.isContextual(118) : (this.isContextual(118) && this.next(), !this.match(0) || (this.next(), !this.tsIsIdentifier()) ? false : (this.next(), this.match(54)));
}
tsParseMappedType() {
let t = this.startNode();
return this.expect(2), this.match(49) ? (t.readonly = this.state.value, this.next(), this.expectContextual(118)) : this.eatContextual(118) && (t.readonly = true), this.expect(0), t.key = this.tsParseTypeParameterName(), t.constraint = this.tsExpectThenParseType(54), t.nameType = this.eatContextual(89) ? this.tsParseType() : null, this.expect(1), this.match(49) ? (t.optional = this.state.value, this.next(), this.expect(13)) : this.eat(13) && (t.optional = true), t.typeAnnotation = this.tsTryParseType(), this.semicolon(), this.expect(4), this.finishNode(t, "TSMappedType");
}
tsParseTupleType() {
let t = this.startNode();
t.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
let s = false;
return t.elementTypes.forEach((i) => {
let { type: r } = i;
s && r !== "TSRestType" && r !== "TSOptionalType" && !(r === "TSNamedTupleMember" && i.optional) && this.raise(m.OptionalTypeBeforeRequired, i), s || (s = r === "TSNamedTupleMember" && i.optional || r === "TSOptionalType");
}), this.finishNode(t, "TSTupleType");
}
tsParseTupleElementType() {
let t = this.state.startLoc, s = this.eat(17), { startLoc: i } = this.state, r, n, o, h, p = B(this.state.type) ? this.lookaheadCharCode() : null;
if (p === 58) r = true, o = false, n = this.parseIdentifier(true), this.expect(10), h = this.tsParseType();
else if (p === 63) {
o = true;
let f = this.state.value, d = this.tsParseNonArrayType();
this.lookaheadCharCode() === 58 ? (r = true, n = this.createIdentifier(this.startNodeAt(i), f), this.expect(13), this.expect(10), h = this.tsParseType()) : (r = false, h = d, this.expect(13));
} else h = this.tsParseType(), o = this.eat(13), r = this.eat(10);
if (r) {
let f;
n ? (f = this.startNodeAt(i), f.optional = o, f.label = n, f.elementType = h, this.eat(13) && (f.optional = true, this.raise(m.TupleOptionalAfterType, this.state.lastTokStartLoc))) : (f = this.startNodeAt(i), f.optional = o, this.raise(m.InvalidTupleMemberLabel, h), f.label = h, f.elementType = this.tsParseType()), h = this.finishNode(f, "TSNamedTupleMember");
} else if (o) {
let f = this.startNodeAt(i);
f.typeAnnotation = h, h = this.finishNode(f, "TSOptionalType");
}
if (s) {
let f = this.startNodeAt(t);
f.typeAnnotation = h, h = this.finishNode(f, "TSRestType");
}
return h;
}
tsParseParenthesizedType() {
let t = this.startNode();
return this.expect(6), t.typeAnnotation = this.tsParseType(), this.expect(7), this.finishNode(t, "TSParenthesizedType");
}
tsParseFunctionOrConstructorType(t, s) {
let i = this.startNode();
return t === "TSConstructorType" && (i.abstract = !!s, s && this.next(), this.next()), this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(15, i)), this.finishNode(i, t);
}
tsParseLiteralTypeNode() {
let t = this.startNode();
switch (this.state.type) {
case 131:
case 132:
case 130:
case 81:
case 82:
t.literal = super.parseExprAtom();
break;
default:
this.unexpected();
}
return this.finishNode(t, "TSLiteralType");
}
tsParseTemplateLiteralType() {
let t = this.state.startLoc, s = this.parseTemplateElement(false), i = [s];
if (s.tail) {
let r = this.startNodeAt(t), n = this.startNodeAt(t);
return n.expressions = [], n.quasis = i, r.literal = this.finishNode(n, "TemplateLiteral"), this.finishNode(r, "TSLiteralType");
} else {
let r = [];
for (; !s.tail; ) r.push(this.tsParseType()), this.readTemplateContinuation(), i.push(s = this.parseTemplateElement(false));
let n = this.startNodeAt(t);
return n.types = r, n.quasis = i, this.finishNode(n, "TSTemplateLiteralType");
}
}
parseTemplateSubstitution() {
return this.state.inType ? this.tsParseType() : super.parseTemplateSubstitution();
}
tsParseThisTypeOrThisTypePredicate() {
let t = this.tsParseThisTypeNode();
return this.isContextual(112) && !this.hasPrecedingLineBreak() ? this.tsParseThisTypePredicate(t) : t;
}
tsParseNonArrayType() {
switch (this.state.type) {
case 130:
case 131:
case 132:
case 81:
case 82:
return this.tsParseLiteralTypeNode();
case 49:
if (this.state.value === "-") {
let t = this.startNode(), s = this.lookahead();
return s.type !== 131 && s.type !== 132 && this.unexpected(), t.literal = this.parseMaybeUnary(), this.finishNode(t, "TSLiteralType");
}
break;
case 74:
return this.tsParseThisTypeOrThisTypePredicate();
case 83:
return this.tsParseTypeQuery();
case 79:
return this.tsParseImportType();
case 2:
return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();
case 0:
return this.tsParseTupleType();
case 6:
if (!(this.optionFlags & 2048)) {
let t = this.state.startLoc;
this.next();
let s = this.tsParseType();
return this.expect(7), this.addExtra(s, "parenthesized", true), this.addExtra(s, "parenStart", t.index), s;
}
return this.tsParseParenthesizedType();
case 21:
case 20:
return this.tsParseTemplateLiteralType();
default: {
let { type: t } = this.state;
if (C(t) || t === 84 || t === 80) {
let s = t === 84 ? "TSVoidKeyword" : t === 80 ? "TSNullKeyword" : hr(this.state.value);
if (s !== void 0 && this.lookaheadCharCode() !== 46) {
let i = this.startNode();
return this.next(), this.finishNode(i, s);
}
return this.tsParseTypeReference();
}
}
}
throw this.unexpected();
}
tsParseArrayTypeOrHigher() {
let { startLoc: t } = this.state, s = this.tsParseNonArrayType();
for (; !this.hasPrecedingLineBreak() && this.eat(0); ) if (this.match(1)) {
let i = this.startNodeAt(t);
i.elementType = s, this.expect(1), s = this.finishNode(i, "TSArrayType");
} else {
let i = this.startNodeAt(t);
i.objectType = s, i.indexType = this.tsParseType(), this.expect(1), s = this.finishNode(i, "TSIndexedAccessType");
}
return s;
}
tsParseTypeOperator() {
let t = this.startNode(), s = this.state.value;
return this.next(), t.operator = s, t.typeAnnotation = this.tsParseTypeOperatorOrHigher(), s === "readonly" && this.tsCheckTypeAnnotationForReadOnly(t), this.finishNode(t, "TSTypeOperator");
}
tsCheckTypeAnnotationForReadOnly(t) {
switch (t.typeAnnotation.type) {
case "TSTupleType":
case "TSArrayType":
return;
default:
this.raise(m.UnexpectedReadonly, t);
}
}
tsParseInferType() {
let t = this.startNode();
this.expectContextual(111);
let s = this.startNode();
return s.name = this.tsParseTypeParameterName(), s.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType()), t.typeParameter = this.finishNode(s, "TSTypeParameter"), this.finishNode(t, "TSInferType");
}
tsParseConstraintForInferType() {
if (this.eat(77)) {
let t = this.tsInDisallowConditionalTypesContext(() => this.tsParseType());
if (this.state.inDisallowConditionalTypesContext || !this.match(13)) return t;
}
}
tsParseTypeOperatorOrHigher() {
return Ei(this.state.type) && !this.state.containsEsc ? this.tsParseTypeOperator() : this.isContextual(111) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
}
tsParseUnionOrIntersectionType(t, s, i) {
let r = this.startNode(), n = this.eat(i), o = [];
do
o.push(s());
while (this.eat(i));
return o.length === 1 && !n ? o[0] : (r.types = o, this.finishNode(r, t));
}
tsParseIntersectionTypeOrHigher() {
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 41);
}
tsParseUnionTypeOrHigher() {
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 39);
}
tsIsStartOfFunctionType() {
return this.match(43) ? true : this.match(6) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
}
tsSkipParameterStart() {
if (C(this.state.type) || this.match(74)) return this.next(), true;
if (this.match(2)) {
let { errors: t } = this.state, s = t.length;
try {
return this.parseObjectLike(4, true), t.length === s;
} catch {
return false;
}
}
if (this.match(0)) {
this.next();
let { errors: t } = this.state, s = t.length;
try {
return super.parseBindingList(1, 93, 1), t.length === s;
} catch {
return false;
}
}
return false;
}
tsIsUnambiguouslyStartOfFunctionType() {
return this.next(), !!(this.match(7) || this.match(17) || this.tsSkipParameterStart() && (this.match(10) || this.match(8) || this.match(13) || this.match(25) || this.match(7) && (this.next(), this.match(15))));
}
tsParseTypeOrTypePredicateAnnotation(t) {
return this.tsInType(() => {
let s = this.startNode();
this.expect(t);
let i = this.startNode(), r = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
if (r && this.match(74)) {
let h = this.tsParseThisTypeOrThisTypePredicate();
return h.type === "TSThisType" ? (i.parameterName = h, i.asserts = true, i.typeAnnotation = null, h = this.finishNode(i, "TSTypePredicate")) : (this.resetStartLocationFromNode(h, i), h.asserts = true), s.typeAnnotation = h, this.finishNode(s, "TSTypeAnnotation");
}
let n = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));
if (!n) return r ? (i.parameterName = this.parseIdentifier(), i.asserts = r, i.typeAnnotation = null, s.typeAnnotation = this.finishNode(i, "TSTypePredicate"), this.finishNode(s, "TSTypeAnnotation")) : this.tsParseTypeAnnotation(false, s);
let o = this.tsParseTypeAnnotation(false);
return i.parameterName = n, i.typeAnnotation = o, i.asserts = r, s.typeAnnotation = this.finishNode(i, "TSTypePredicate"), this.finishNode(s, "TSTypeAnnotation");
});
}
tsTryParseTypeOrTypePredicateAnnotation() {
if (this.match(10)) return this.tsParseTypeOrTypePredicateAnnotation(10);
}
tsTryParseTypeAnnotation() {
if (this.match(10)) return this.tsParseTypeAnnotation();
}
tsTryParseType() {
return this.tsEatThenParseType(10);
}
tsParseTypePredicatePrefix() {
let t = this.parseIdentifier();
if (this.isContextual(112) && !this.hasPrecedingLineBreak()) return this.next(), t;
}
tsParseTypePredicateAsserts() {
if (this.state.type !== 105) return false;
let t = this.state.containsEsc;
return this.next(), !C(this.state.type) && !this.match(74) ? false : (t && this.raise(l.InvalidEscapedReservedWord, this.state.lastTokStartLoc, { reservedWord: "asserts" }), true);
}
tsParseTypeAnnotation(t = true, s = this.startNode()) {
return this.tsInType(() => {
t && this.expect(10), s.typeAnnotation = this.tsParseType();
}), this.finishNode(s, "TSTypeAnnotation");
}
tsParseType() {
He(this.state.inType);
let t = this.tsParseNonConditionalType();
if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(77)) return t;
let s = this.startNodeAtNode(t);
return s.checkType = t, s.extendsType = this.tsInDisallowConditionalTypesContext(() => this.tsParseNonConditionalType()), this.expect(13), s.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()), this.expect(10), s.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()), this.finishNode(s, "TSConditionalType");
}
isAbstractConstructorSignature() {
return this.isContextual(120) && this.isLookaheadContextual("new");
}
tsParseNonConditionalType() {
return this.tsIsStartOfFunctionType() ? this.tsParseFunctionOrConstructorType("TSFunctionType") : this.match(73) ? this.tsParseFunctionOrConstructorType("TSConstructorType") : this.isAbstractConstructorSignature() ? this.tsParseFunctionOrConstructorType("TSConstructorType", true) : this.tsParseUnionTypeOrHigher();
}
tsParseTypeAssertion() {
this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(m.ReservedTypeAssertion, this.state.startLoc);
let t = this.startNode();
return t.typeAnnotation = this.tsInType(() => (this.next(), this.match(71) ? this.tsParseTypeReference() : this.tsParseType())), this.expect(44), t.expression = this.parseMaybeUnary(), this.finishNode(t, "TSTypeAssertion");
}
tsParseHeritageClause(t) {
let s = this.state.startLoc, i = this.tsParseDelimitedList("HeritageClauseElement", () => {
let r = (this.state.canStartArrow = false, super.parseExprSubscripts());
xe(r) || this.raise(m.InvalidHeritageClauseType, r.start, { token: t });
let n = t === "extends" ? "TSInterfaceHeritage" : "TSClassImplements";
if (r.type === "TSInstantiationExpression") return r.type = n, r;
let o = this.startNodeAtNode(r);
return o.expression = r, (this.match(43) || this.match(47)) && (o.typeArguments = this.tsParseTypeArgumentsInExpression()), this.finishNode(o, n);
});
return i.length || this.raise(m.EmptyHeritageClauseType, s, { token: t }), i;
}
tsParseInterfaceDeclaration(t, s = {}) {
if (this.hasFollowingLineBreak()) return null;
this.expectContextual(125), s.declare && (t.declare = true), C(this.state.type) ? (t.id = this.parseIdentifier(), this.checkIdentifier(t.id, 130)) : (t.id = null, this.raise(m.MissingInterfaceName, this.state.startLoc)), t.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers), this.eat(77) && (t.extends = this.tsParseHeritageClause("extends"));
let i = this.startNode();
return i.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this)), t.body = this.finishNode(i, "TSInterfaceBody"), this.finishNode(t, "TSInterfaceDeclaration");
}
tsParseTypeAliasDeclaration(t) {
return t.id = this.parseIdentifier(), this.checkIdentifier(t.id, 2), t.typeAnnotation = this.tsInType(() => {
if (t.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers), this.expect(25), this.isContextual(110) && this.lookaheadCharCode() !== 46) {
let s = this.startNode();
return this.next(), this.finishNode(s, "TSIntrinsicKeyword");
}
return this.tsParseType();
}), this.semicolon(), this.finishNode(t, "TSTypeAliasDeclaration");
}
tsInTopLevelContext(t) {
if (this.curContext() !== w.brace) {
let s = this.state.context;
this.state.context = [s[0]];
try {
return t();
} finally {
this.state.context = s;
}
} else return t();
}
tsInType(t) {
let s = this.state.inType;
this.state.inType = true;
try {
return t();
} finally {
this.state.inType = s;
}
}
tsInDisallowConditionalTypesContext(t) {
let s = this.state.inDisallowConditionalTypesContext;
this.state.inDisallowConditionalTypesContext = true;
try {
return t();
} finally {
this.state.inDisallowConditionalTypesContext = s;
}
}
tsInAllowConditionalTypesContext(t) {
let s = this.state.inDisallowConditionalTypesContext;
this.state.inDisallowConditionalTypesContext = false;
try {
return t();
} finally {
this.state.inDisallowConditionalTypesContext = s;
}
}
tsEatThenParseType(t) {
if (this.match(t)) return this.tsNextThenParseType();
}
tsExpectThenParseType(t) {
return this.tsInType(() => (this.expect(t), this.tsParseType()));
}
tsNextThenParseType() {
return this.tsInType(() => (this.next(), this.tsParseType()));
}
tsParseEnumMember() {
let t = this.startNode();
return t.id = this.match(130) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true), this.eat(25) && (t.initializer = super.parseMaybeAssignAllowIn()), this.finishNode(t, "TSEnumMember");
}
tsParseEnumDeclaration(t, s = {}) {
return s.const && (t.const = true), s.declare && (t.declare = true), this.expectContextual(122), t.id = this.parseIdentifier(), this.checkIdentifier(t.id, t.const ? 8971 : 8459), t.body = this.tsParseEnumBody(), this.finishNode(t, "TSEnumDeclaration");
}
tsParseEnumBody() {
let t = this.startNode();
return this.expect(2), t.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this)), this.expect(4), this.finishNode(t, "TSEnumBody");
}
tsParseModuleBlock(t) {
let s = this.startNode();
return t || this.scope.enter(0), this.expect(2), super.parseBlockOrModuleBlockBody(s.body = [], void 0, true, 4), t || this.scope.exit(), this.finishNode(s, "TSModuleBlock");
}
tsParseNamespaceDeclaration(t) {
return t.id = this.tsParseEntityName(0), t.id.type === "Identifier" && this.checkIdentifier(t.id, 1024), this.scope.enter(2048), this.prodParam.enter(0), t.body = this.tsParseModuleBlock(false), this.prodParam.exit(), this.scope.exit(), this.finishNode(t, "TSModuleDeclaration");
}
tsParseAmbientExternalModuleDeclaration(t) {
let s = this.isContextual(108);
return s ? (t.kind = "global", t.id = this.parseIdentifier()) : (t.kind = "module", t.id = super.parseStringLiteral(this.state.value)), this.match(2) ? (s || this.scope.enter(1024), this.prodParam.enter(0), t.body = this.tsParseModuleBlock(s), this.prodParam.exit(), s || this.scope.exit()) : this.semicolon(), this.finishNode(t, "TSModuleDeclaration");
}
tsParseImportEqualsDeclaration(t, s) {
t.id = s || this.parseIdentifier(), this.checkIdentifier(t.id, 4096), this.expect(25);
let i = this.tsParseModuleReference();
return t.importKind === "type" && i.type !== "TSExternalModuleReference" && this.raise(m.ImportAliasHasImportType, i), t.moduleReference = i, this.semicolon(), this.finishNode(t, "TSImportEqualsDeclaration");
}
tsIsExternalModuleReference() {
return this.isContextual(115) && this.lookaheadCharCode() === 40;
}
tsParseModuleReference() {
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
}
tsParseExternalModuleReference() {
let t = this.startNode();
return this.expectContextual(115), this.expect(6), this.match(130) || this.unexpected(), t.expression = super.parseExprAtom(), this.expect(7), this.sawUnambiguousESM = true, this.finishNode(t, "TSExternalModuleReference");
}
tsLookAhead(t) {
let s = this.state.clone(), i = t();
return this.state = s, i;
}
tsTryParseAndCatch(t) {
let s = this.tryParse((i) => t() || i());
if (!(s.aborted || !s.node)) return s.error && (this.state = s.failState), s.node;
}
tsTryParse(t) {
let s = this.state.clone(), i = t();
if (i !== void 0 && i !== false) return i;
this.state = s;
}
tsTryParseDeclare(t) {
if (this.isLineTerminator()) return;
let s = this.state.type;
return this.tsInAmbientContext(() => {
switch (s) {
case 64:
return t.declare = true, super.parseFunctionStatement(t, false, false);
case 76:
return t.declare = true, this.parseClass(t, true, false);
case 122:
return this.tsParseEnumDeclaration(t, { declare: true });
case 108:
return this.tsParseAmbientExternalModuleDeclaration(t);
case 96:
if (this.state.containsEsc) return;
case 71:
case 70:
return !this.match(71) || !this.isLookaheadContextual("enum") ? (t.declare = true, this.parseVarStatement(t, this.state.value, true)) : (this.expect(71), this.tsParseEnumDeclaration(t, { const: true, declare: true }));
case 103:
if (this.isUsing()) return this.raise(m.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare"), t.declare = true, this.parseVarStatement(t, "using", true);
break;
case 92:
if (this.isAwaitUsing()) return this.raise(m.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare"), t.declare = true, this.next(), this.parseVarStatement(t, "await using", true);
break;
case 125: {
let i = this.tsParseInterfaceDeclaration(t, { declare: true });
if (i) return i;
}
default:
if (C(s)) return this.tsParseDeclaration(t, this.state.type, true, null);
}
});
}
tsTryParseExportDeclaration() {
return this.tsParseDeclaration(this.startNode(), this.state.type, true, null);
}
tsParseDeclaration(t, s, i, r) {
switch (s) {
case 120:
if (this.tsCheckLineTerminator(i) && (this.match(76) || C(this.state.type))) return this.tsParseAbstractDeclaration(t, r);
break;
case 123:
if (this.tsCheckLineTerminator(i)) return this.tsParseAmbientExternalModuleDeclaration(t);
break;
case 124:
if (this.tsCheckLineTerminator(i) && C(this.state.type)) return t.kind = "namespace", this.tsParseNamespaceDeclaration(t);
break;
case 126:
if (this.tsCheckLineTerminator(i) && C(this.state.type)) return this.tsParseTypeAliasDeclaration(t);
break;
}
}
tsCheckLineTerminator(t) {
return t ? this.hasFollowingLineBreak() ? false : (this.next(), true) : !this.isLineTerminator();
}
tsTryParseGenericAsyncArrowFunction(t) {
if (!this.match(43)) return;
let s = this.tsTryParseAndCatch(() => {
let i = this.startNodeAt(t);
return i.typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier), super.parseFunctionParams(i), i.returnType = this.tsTryParseTypeOrTypePredicateAnnotation(), this.expect(15), i;
});
if (s) return super.parseArrowExpression(s, null, true);
}
tsParseTypeArgumentsInExpression() {
if (this.reScan_lt() === 43) return this.tsParseTypeArguments();
}
tsParseTypeArguments() {
let t = this.startNode();
return t.params = this.tsInType(() => this.tsInTopLevelContext(() => (this.expect(43), this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this))))), t.params.length === 0 ? this.raise(m.EmptyTypeArguments, t) : !this.state.inType && this.curContext() === w.brace && this.reScan_lt_gt(), this.expect(44), this.finishNode(t, "TSTypeParameterInstantiation");
}
tsIsDeclarationStart() {
return wi(this.state.type);
}
isExportDefaultSpecifier() {
return this.tsIsDeclarationStart() ? false : super.isExportDefaultSpecifier();
}
parseBindingElement(t, s) {
let i = s.length ? null : this.state.startLoc, r = {};
this.tsParseModifiers({ allowedModifiers: ["public", "private", "protected", "override", "readonly"] }, r);
let n = r.accessibility, o = r.override, h = r.readonly;
!(t & 4) && (n || h || o) && this.raise(m.UnexpectedParameterModifier, i || s[0]);
let c = this.state.startLoc, p = this.parseMaybeDefault(c);
t & 2 && this.parseFunctionParamType(p);
let f = this.parseMaybeDefault(c, p);
if (n || h || o) {
let d = i ? this.startNodeAt(i) : this.startNodeAtNode(s[0]);
return s.length ? d.decorators = s : this.setLoc(i), n && (d.accessibility = n), h && (d.readonly = h), o && (d.override = o), f.type !== "Identifier" && f.type !== "AssignmentPattern" && this.raise(m.UnsupportedParameterPropertyKind, i || s[0]), d.parameter = f, this.finishNode(d, "TSParameterProperty");
}
return s.length && (p.decorators = s), f;
}
isSimpleParameter(t) {
return t.type === "TSParameterProperty" && super.isSimpleParameter(t.parameter) || super.isSimpleParameter(t);
}
tsDisallowOptionalPattern(t) {
for (let s of t.params) s.type !== "Identifier" && s.optional && !this.state.isAmbientContext && this.raise(m.PatternIsOptional, s);
}
setArrowFunctionParameters(t, s, i) {
super.setArrowFunctionParameters(t, s, i), this.tsDisallowOptionalPattern(t);
}
parseFunctionBodyAndFinish(t, s, i = false) {
this.match(10) && (t.returnType = this.tsParseTypeOrTypePredicateAnnotation(10));
let r = s === "FunctionDeclaration" ? "TSDeclareFunction" : s === "ClassMethod" || s === "ClassPrivateMethod" ? "TSDeclareMethod" : void 0;
if (r && !this.match(2) && this.isLineTerminator()) {
if (r === "TSDeclareMethod" && t.kind === "constructor") for (let n of t.params) n.type === "TSParameterProperty" ? this.raise(m.UnexpectedParameterModifier, n) : n.type === "AssignmentPattern" && this.raise(m.UnexpectedParameterInitializer, n);
else for (let n of t.params) n.type === "AssignmentPattern" && this.raise(m.UnexpectedParameterInitializer, n);
return this.finishNode(t, r);
}
return r && this.state.isAmbientContext && (this.raise(m.DeclareFunctionHasImplementation, this.state.startLoc), r === "TSDeclareFunction" && t.declare) ? super.parseFunctionBodyAndFinish(t, r, i) : (this.tsDisallowOptionalPattern(t), super.parseFunctionBodyAndFinish(t, s, i));
}
registerFunctionStatementId(t) {
!t.body && t.id ? this.checkIdentifier(t.id, 1024) : super.registerFunctionStatementId(t);
}
tsCheckForInvalidTypeCasts(t) {
t.forEach((s) => {
s?.type === "TSTypeCastExpression" && this.raise(m.UnexpectedTypeAnnotation, s.typeAnnotation);
});
}
toReferencedList(t, s) {
return this.tsCheckForInvalidTypeCasts(t), t;
}
parseArrayLike(t, s) {
let i = super.parseArrayLike(t, s);
return i.type === "ArrayExpression" && this.tsCheckForInvalidTypeCasts(i.elements), i;
}
parseSubscript(t, s, i, r) {
if (!this.hasPrecedingLineBreak() && this.match(31)) {
this.state.canStartJSXElement = false, this.next();
let o = this.startNodeAt(s);
return o.expression = t, this.finishNode(o, "TSNonNullExpression");
}
let n = false;
if (this.match(14) && this.lookaheadCharCode() === 60) {
if (i) return r.stop = true, t;
r.optionalChainMember = n = true, this.next();
}
if (this.match(43) || this.match(47)) {
let o, h = this.tsTryParseAndCatch(() => {
if (!i && this.atPossibleAsyncArrow(t)) {
let d = this.tsTryParseGenericAsyncArrowFunction(s);
if (d) return r.stop = true, d;
}
let c = this.tsParseTypeArgumentsInExpression();
if (!c) return;
if (n && !this.match(6)) {
o = this.state.curPosition();
return;
}
if (Gt(this.state.type)) {
let d = super.parseTaggedTemplateExpression(t, s, r);
return d.typeArguments = c, d;
}
if (!i && this.eat(6)) {
let d = this.startNodeAt(s);
return d.callee = t, d.arguments = this.parseCallExpressionArguments(), this.tsCheckForInvalidTypeCasts(d.arguments), d.typeArguments = c, r.optionalChainMember && (d.optional = n), this.finishCallExpression(d, r.optionalChainMember);
}
let p = this.state.type;
if (p === 44 || p === 48 || p !== 6 && p !== 89 && p !== 116 && ft(p) && !this.hasPrecedingLineBreak()) return;
let f = this.startNodeAt(s);
return f.expression = t, f.typeArguments = c, this.finishNode(f, "TSInstantiationExpression");
});
if (o && this.unexpected(o, 6), h) return h.type === "TSInstantiationExpression" && ((this.match(12) || this.match(14) && this.lookaheadCharCode() !== 40) && this.raise(m.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc), !this.match(12) && !this.match(14) && (h.expression = super.stopParseSubscript(t, r))), h;
}
return super.parseSubscript(t, s, i, r);
}
parseNewCallee(t) {
super.parseNewCallee(t);
let { callee: s } = t;
s.type === "TSInstantiationExpression" && !s.extra?.parenthesized && (t.typeArguments = s.typeArguments, t.callee = s.expression);
}
parseExprOp(t, s, i) {
let r;
if (It(54) > i && !this.hasPrecedingLineBreak() && (this.isContextual(89) || (r = this.isContextual(116)))) {
let n = this.startNodeAt(s);
n.expression = t, n.typeAnnotation = this.tsInType(() => (this.next(), this.match(71) ? (r && this.raise(l.UnexpectedKeyword, this.state.startLoc, { keyword: "const" }), this.tsParseTypeReference()) : this.tsParseType()));
let o = this.finishNode(n, r ? "TSSatisfiesExpression" : "TSAsExpression");
return this.reScan_lt_gt(), this.parseExprOp(o, s, i);
}
return super.parseExprOp(t, s, i);
}
checkReservedWord(t, s, i, r) {
this.state.isAmbientContext || super.checkReservedWord(t, s, i, r);
}
checkDuplicateExports() {
}
isPotentialImportPhase(t) {
if (super.isPotentialImportPhase(t)) return true;
if (this.isContextual(126)) {
let s = this.lookaheadCharCode();
return t ? s === 123 || s === 42 : s !== 61;
}
return !t && this.isContextual(83);
}
applyImportPhase(t, s, i, r) {
super.applyImportPhase(t, s, i, r), s ? t.exportKind = i === "type" ? "type" : "value" : t.importKind = i === "type" || i === "typeof" ? i : "value";
}
parseImport(t) {
if (this.match(130)) return t.importKind = "value", this.scope.inTSNamespace && this.raise(m.ImportInTSNamespace, t), super.parseImport(t);
let s;
if (C(this.state.type) && this.lookaheadCharCode() === 61) {
t.importKind = "value";
let i = this.tsParseImportEqualsDeclaration(t);
return this.scope.inTSNamespace && i.moduleReference.type === "TSExternalModuleReference" && this.raise(m.ImportInTSNamespace, t), i;
} else if (this.isContextual(126)) {
let i = this.parseMaybeImportPhase(t, false);
if (this.lookaheadCharCode() === 61) return this.scope.inTSNamespace && this.raise(m.ImportInTSNamespace, t), this.tsParseImportEqualsDeclaration(t, i);
s = super.parseImportSpecifiersAndAfter(t, i);
} else s = super.parseImport(t);
return s.importKind === "type" && s.specifiers.length > 1 && s.specifiers[0].type === "ImportDefaultSpecifier" ? this.raise(m.TypeImportCannotSpecifyDefaultAndNamed, s) : this.scope.inTSNamespace && this.raise(m.ImportInTSNamespace, s), s;
}
parseExport(t, s) {
if (this.match(79)) {
let i = this.startNode();
this.next();
let r = null;
this.isContextual(126) && this.isPotentialImportPhase(false) ? r = this.parseMaybeImportPhase(i, false) : i.importKind = "value";
let n = this.tsParseImportEqualsDeclaration(i, r);
return t.attributes = [], t.declaration = n, t.exportKind = "value", t.source = null, t.specifiers = [], this.finishNode(t, "ExportNamedDeclaration");
} else if (this.eat(25)) {
let i = t;
return i.expression = super.parseExpression(), this.semicolon(), this.sawUnambiguousESM = true, this.scope.inTSNamespace && this.raise(m.ExportAssignmentInTSNamespace, i), this.finishNode(i, "TSExportAssignment");
} else if (this.eatContextual(89)) {
let i = t;
return this.expectContextual(124), i.id = this.parseIdentifier(), this.checkIdentifier(i.id, 8201), this.semicolon(), this.scope.inTSNamespace && this.raise(m.NamespaceExportInTSNamespace, i), this.finishNode(i, "TSNamespaceExportDeclaration");
} else {
let i = super.parseExport(t, s);
return this.scope.inTSNamespace && (i.type !== "ExportNamedDeclaration" || i.source || !i.declaration && !this.state.isAmbientContext) && this.raise(m.ExportInTSNamespace, i), i;
}
}
isAbstractClass() {
return this.isContextual(120) && this.isLookaheadContextual("class");
}
parseExportDefaultExpression() {
if (this.isAbstractClass()) {
let t = this.startNode();
return this.next(), t.abstract = true, this.parseClass(t, true, true);
}
if (this.match(125)) {
let t = this.tsParseInterfaceDeclaration(this.startNode());
if (t) return t;
}
return super.parseExportDefaultExpression();
}
parseVarStatement(t, s, i = false) {
let { isAmbientContext: r } = this.state, n = super.parseVarStatement(t, s, i || r);
if (!r) return n;
if (!t.declare && (s === "using" || s === "await using")) return this.raiseOverwrite(m.UsingDeclarationInAmbientContext, t, s), n;
for (let { id: o, init: h } of n.declarations) h && (s === "var" || s === "let" || o.typeAnnotation ? this.raise(m.InitializerNotAllowedInAmbientContext, h) : ur(h, this.hasPlugin("estree")) || this.raise(m.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, h));
return n;
}
parseStatementContent(t, s) {
let i = !!(t & 2);
if (!this.state.containsEsc) switch (this.state.type) {
case 71: {
if (this.isLookaheadContextual("enum")) {
let r = this.startNode();
return this.next(), this.tsParseEnumDeclaration(r, { const: true });
}
break;
}
case 120:
case 121: {
if (this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()) {
let r = this.state.type, n = this.startNode();
this.next();
let o = r === 121 ? this.tsTryParseDeclare(n) : this.tsParseAbstractDeclaration(n, s);
return o ? (r === 121 && (o.declare = true), o) : (n.expression = this.createIdentifier(this.startNodeAtNode(n), r === 121 ? "declare" : "abstract"), this.semicolon(false), this.finishNode(n, "ExpressionStatement"));
}
break;
}
case 122:
return this.tsParseEnumDeclaration(this.startNode());
case 108: {
if (this.lookaheadCharCode() === 123) {
let n = this.startNode();
return this.tsParseAmbientExternalModuleDeclaration(n);
}
break;
}
case 125: {
let r = this.tsParseInterfaceDeclaration(this.startNode());
if (r) return i || this.raise(m.UnexpectedTypeDeclaration, r, "interface"), r;
break;
}
case 123: {
if (this.nextTokenIsStringLiteralOnSameLine()) {
let r = this.startNode();
return this.next(), this.tsParseDeclaration(r, 123, false, s);
} else if (this.nextTokenIsIdentifierOnSameLine()) {
this.raise(m.InlineModuleDeclarationMustUseString, this.state.startLoc);
let r = this.startNode();
return this.next(), this.tsParseDeclaration(r, 124, false, s);
}
break;
}
case 124: {
if (this.nextTokenIsIdentifierOnSameLine()) {
let r = this.startNode();
return this.next(), this.tsParseDeclaration(r, 124, false, s);
}
break;
}
case 126: {
if (this.nextTokenIsIdentifierOnSameLine()) {
let r = this.startNode();
return i || this.raise(m.UnexpectedTypeDeclaration, r, "type"), this.next(), this.tsParseTypeAliasDeclaration(r);
}
break;
}
}
return super.parseStatementContent(t, s);
}
parseAccessModifier() {
return this.tsParseModifier(["public", "protected", "private"]);
}
tsHasSomeModifiers(t, s) {
return s.some((i) => Ke(i) ? t.accessibility === i : !!t[i]);
}
tsIsStartOfStaticBlocks() {
return this.isContextual(102) && this.lookaheadCharCode() === 123;
}
parseClassMember(t, s, i) {
let r = ["declare", "private", "public", "protected", "override", "abstract", "readonly", "static"];
this.tsParseModifiers({ allowedModifiers: r, disallowedModifiers: ["in", "out"], stopOnStartOfClassStaticBlock: true, errorTemplate: m.InvalidModifierOnTypeParameterPositions }, s);
let n = () => {
this.tsIsStartOfStaticBlocks() ? (this.next(), this.next(), this.tsHasSomeModifiers(s, r) && this.raise(m.StaticBlockCannotHaveModifier, this.state.curPosition()), super.parseClassStaticBlock(t, s)) : this.parseClassMemberWithIsStatic(t, s, i, !!s.static);
};
s.declare ? this.tsInAmbientContext(n) : n(), s.decorators && s.decorators.length > 0 && !this.hasPlugin("decorators-legacy") && (s.type === "TSAbstractMethodDefinition" || s.type === "TSDeclareMethod" ? this.raise(m.DecoratorAbstractMethod, s, { kind: "abstract method" }) : (s.type === "ClassProperty" && s.abstract || s.type === "ClassProperty" && s.declare || s.type === "TSAbstractPropertyDefinition" || s.type === "PropertyDefinition" && s.declare) && this.raise(m.DecoratorAbstractMethod, s, { kind: s.declare ? "declare field" : "abstract field" }));
}
parseClassMemberWithIsStatic(t, s, i, r) {
let n = this.tsTryParseIndexSignature(s);
if (n) {
t.body.push(n), s.abstract && this.raise(m.IndexSignatureHasAbstract, s), s.accessibility && this.raise(m.IndexSignatureHasAccessibility, s, { modifier: s.accessibility }), s.declare && this.raise(m.IndexSignatureHasDeclare, s), s.override && this.raise(m.IndexSignatureHasOverride, s);
return;
}
!this.state.inAbstractClass && s.abstract && this.raise(m.NonAbstractClassHasAbstractMethod, s), s.override && (i.hadSuperClass || this.raise(m.OverrideNotInSubClass, s)), super.parseClassMemberWithIsStatic(t, s, i, r);
}
parsePostMemberNameModifiers(t) {
this.eat(13) && (t.optional = true), t.readonly && this.match(6) && this.raise(m.ClassMethodHasReadonly, t), t.declare && this.match(6) && this.raise(m.ClassMethodHasDeclare, t);
}
shouldParseExportDeclaration() {
return this.tsIsDeclarationStart() ? true : super.shouldParseExportDeclaration();
}
parseConditional(t, s, i) {
if (!this.match(13)) return t;
if (i != null) {
let o = this.lookaheadCharCode();
if (o === 44 || o === 61 || o === 58 || o === 41) return this.setOptionalParametersError(i), t;
}
this.next();
let r = this.startNodeAt(s);
r.test = t;
let n = this.state.inConditionalConsequent;
return this.state.inConditionalConsequent = true, r.consequent = this.parseMaybeAssignAllowIn(), this.state.inConditionalConsequent = n, this.expect(10), r.alternate = this.parseMaybeAssign(), this.finishNode(r, "ConditionalExpression");
}
parseParenItem(t, s) {
let i = super.parseParenItem(t, s);
if (this.eat(13) && (i.optional = true, this.resetEndLocation(t)), this.match(10)) {
let r = this.startNodeAt(s);
return r.expression = t, r.typeAnnotation = this.tsParseTypeAnnotation(), this.finishNode(r, "TSTypeCastExpression");
}
return t;
}
parseExportDeclaration(t) {
if (!this.state.isAmbientContext && this.isContextual(121)) return this.tsInAmbientContext(() => this.parseExportDeclaration(t));
let s = this.state.startLoc, i = this.eatContextual(121);
if (i && (this.isContextual(121) || !this.shouldParseExportDeclaration())) throw this.raise(m.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
let n = C(this.state.type) && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(t);
return n ? ((n.type === "TSInterfaceDeclaration" || n.type === "TSTypeAliasDeclaration" || i) && (t.exportKind = "type"), i && n.type !== "TSImportEqualsDeclaration" && (this.resetStartLocation(n, s), n.declare = true), n) : null;
}
parseClassId(t, s, i, r) {
if ((!s || i) && this.isContextual(109)) {
t.id = null;
return;
}
super.parseClassId(t, s, i, t.declare ? 1024 : 8331);
let n = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
n && (t.typeParameters = n);
}
parseClassPropertyAnnotation(t) {
t.optional || (this.eat(31) ? t.definite = true : this.eat(13) && (t.optional = true));
let s = this.tsTryParseTypeAnnotation();
s && (t.typeAnnotation = s);
}
parseClassProperty(t) {
if (this.parseClassPropertyAnnotation(t), this.state.isAmbientContext && !(t.readonly && !t.typeAnnotation) && this.match(25) && this.raise(m.DeclareClassFieldHasInitializer, this.state.startLoc), t.abstract && this.match(25)) {
let { key: s } = t;
this.raise(m.AbstractPropertyHasInitializer, this.state.startLoc, { propertyName: s.type === "Identifier" && !t.computed ? s.name : `[${this.input.slice(this.offsetToSourcePos(s.start), this.offsetToSourcePos(s.end))}]` });
}
return super.parseClassProperty(t);
}
parseClassPrivateProperty(t) {
return t.abstract && this.raise(m.PrivateElementHasAbstract, t), t.accessibility && this.raise(m.PrivateElementHasAccessibility, t, { modifier: t.accessibility }), this.parseClassPropertyAnnotation(t), super.parseClassPrivateProperty(t);
}
parseClassAccessorProperty(t) {
return this.parseClassPropertyAnnotation(t), t.optional && this.raise(m.AccessorCannotBeOptional, t), super.parseClassAccessorProperty(t);
}
pushClassMethod(t, s, i, r, n, o) {
let h = this.tsTryParseTypeParameters(this.tsParseConstModifier);
h && n && this.raise(m.ConstructorHasTypeParameters, h);
let { declare: c = false, kind: p } = s;
c && (p === "get" || p === "set") && this.raise(m.DeclareAccessor, s, { kind: p }), h && (s.typeParameters = h), super.pushClassMethod(t, s, i, r, n, o);
}
pushClassPrivateMethod(t, s, i, r) {
let n = this.tsTryParseTypeParameters(this.tsParseConstModifier);
n && (s.typeParameters = n), super.pushClassPrivateMethod(t, s, i, r);
}
declareClassPrivateMethodInScope(t, s) {
t.type !== "TSDeclareMethod" && (t.type === "MethodDefinition" && t.value.body == null || super.declareClassPrivateMethodInScope(t, s));
}
parseClassSuper(t) {
if (super.parseClassSuper(t), t.superClass) if (t.superClass.type === "TSInstantiationExpression") {
let s = t.superClass, i = s.expression;
this.takeSurroundingComments(i, i.start, i.end);
let r = s.typeArguments;
this.takeSurroundingComments(r, r.start, r.end), t.superClass = i, t.superTypeArguments = r;
} else (this.match(43) || this.match(47)) && (t.superTypeArguments = this.tsParseTypeArgumentsInExpression());
this.eatContextual(109) && (t.implements = this.tsParseHeritageClause("implements"));
}
parseObjPropValue(t, s, i, r, n, o, h) {
let c = this.tsTryParseTypeParameters(this.tsParseConstModifier);
return c && (t.typeParameters = c), super.parseObjPropValue(t, s, i, r, n, o, h);
}
parseFunctionParams(t, s) {
let i = this.tsTryParseTypeParameters(this.tsParseConstModifier);
i && (t.typeParameters = i), super.parseFunctionParams(t, s);
}
parseVarId(t, s) {
super.parseVarId(t, s), t.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.eat(31) && (t.definite = true);
let i = this.tsTryParseTypeAnnotation();
i && (t.id.typeAnnotation = i, this.resetEndLocation(t.id));
}
parseAsyncArrowFromCallExpression(t, s) {
return this.match(10) && (t.returnType = this.tsParseTypeAnnotation()), super.parseAsyncArrowFromCallExpression(t, s);
}
parseMaybeAssign(t, s) {
let i, r, n;
if (this.hasPlugin("jsx") && (this.match(138) || this.match(43))) {
if (i = this.state.clone(), r = this.tryParse(() => super.parseMaybeAssign(t, s), i), !r.error) return r.node;
let { context: c } = this.state, p = c[c.length - 1];
(p === w.j_oTag || p === w.j_expr) && c.pop();
}
if (!r?.error && !this.match(43)) return super.parseMaybeAssign(t, s);
(!i || i === this.state) && (i = this.state.clone());
let o, h = this.tryParse((c) => {
o = this.tsParseTypeParameters(this.tsParseConstModifier);
let p = super.parseMaybeAssign(t, s);
if ((p.type !== "ArrowFunctionExpression" || p.extra?.parenthesized) && c(), o?.params.length !== 0 && this.resetStartLocationFromNode(p, o), p.typeParameters = o, this.hasPlugin("jsx") && p.typeParameters.params.length === 1 && !p.typeParameters.extra?.trailingComma) {
let f = p.typeParameters.params[0];
f.constraint || this.raise(m.SingleTypeParameterWithoutTrailingComma, this.optionFlags & 256 ? O(f.loc.end, 1) : f, { typeParameterName: f.name.name });
}
return p;
}, i);
if (!h.error && !h.aborted) return o && this.reportReservedArrowTypeParam(o), h.node;
if (!r && (He(!this.hasPlugin("jsx")), n = this.tryParse(() => super.parseMaybeAssign(t, s), i), !n.error)) return n.node;
if (r?.node) return this.state = r.failState, r.node;
if (h.node) return this.state = h.failState, o && this.reportReservedArrowTypeParam(o), h.node;
if (n?.node) return this.state = n.failState, n.node;
throw r?.error || h.error || n?.error;
}
reportReservedArrowTypeParam(t) {
t.params.length === 1 && !t.params[0].constraint && !t.extra?.trailingComma && this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(m.ReservedArrowTypeParam, t);
}
parseMaybeUnary(t, s) {
return !this.hasPlugin("jsx") && this.match(43) ? this.tsParseTypeAssertion() : super.parseMaybeUnary(t, s);
}
parseArrow(t) {
if (this.match(10)) {
let s = this.tryParse((i) => {
let r = this.tsParseTypeOrTypePredicateAnnotation(10);
return (this.canInsertSemicolon() || !this.match(15)) && i(), r;
});
if (s.aborted) return;
s.thrown || (s.error && (this.state = s.failState), t.returnType = s.node);
}
return super.parseArrow(t);
}
parseFunctionParamType(t) {
this.eat(13) && (t.optional = true);
let s = this.tsTryParseTypeAnnotation();
return s && (t.typeAnnotation = s), this.resetEndLocation(t), t;
}
isAssignable(t, s) {
switch (t.type) {
case "TSTypeCastExpression":
return this.isAssignable(t.expression, s);
case "TSParameterProperty":
return true;
default:
return super.isAssignable(t, s);
}
}
toAssignable(t, s = false) {
switch (t.type) {
case "ParenthesizedExpression":
this.toAssignableParenthesizedExpression(t, s);
break;
case "TSAsExpression":
case "TSSatisfiesExpression":
case "TSNonNullExpression":
case "TSTypeAssertion":
s ? this.expressionScope.recordArrowParameterBindingError(m.UnexpectedTypeCastInParameter, t) : this.raise(m.UnexpectedTypeCastInParameter, t), this.toAssignable(t.expression, s);
break;
case "AssignmentExpression":
!s && t.left.type === "TSTypeCastExpression" && (t.left = this.typeCastToParameter(t.left));
default:
super.toAssignable(t, s);
}
}
toAssignableParenthesizedExpression(t, s) {
switch (t.expression.type) {
case "TSAsExpression":
case "TSSatisfiesExpression":
case "TSNonNullExpression":
case "TSTypeAssertion":
case "ParenthesizedExpression":
this.toAssignable(t.expression, s);
break;
default:
super.toAssignable(t, s);
}
}
checkToRestConversion(t, s) {
switch (t.type) {
case "TSAsExpression":
case "TSSatisfiesExpression":
case "TSTypeAssertion":
case "TSNonNullExpression":
this.checkToRestConversion(t.expression, false);
break;
default:
super.checkToRestConversion(t, s);
}
}
isValidLVal(t, s, i, r) {
switch (t) {
case "TSTypeCastExpression":
return true;
case "TSParameterProperty":
return "parameter";
case "TSNonNullExpression":
return "expression";
case "TSAsExpression":
case "TSSatisfiesExpression":
case "TSTypeAssertion":
return (r !== 64 || !i) && ["expression", true];
default:
return super.isValidLVal(t, s, i, r);
}
}
parseBindingAtom() {
return this.state.type === 74 ? this.parseIdentifier(true) : super.parseBindingAtom();
}
parseMaybeDecoratorArguments(t, s) {
if (this.match(43) || this.match(47)) {
let i = this.tsParseTypeArgumentsInExpression();
if (this.match(6)) {
let r = super.parseMaybeDecoratorArguments(t, s);
return r.typeArguments = i, r;
}
this.unexpected(null, 6);
}
return super.parseMaybeDecoratorArguments(t, s);
}
checkCommaAfterRest(t) {
return this.state.isAmbientContext && this.match(8) && this.lookaheadCharCode() === t ? (this.next(), false) : super.checkCommaAfterRest(t);
}
isClassMethod() {
return this.match(43) || super.isClassMethod();
}
isClassProperty() {
return this.match(31) || this.match(10) || super.isClassProperty();
}
parseMaybeDefault(t, s) {
let i = super.parseMaybeDefault(t, s);
return i.type === "AssignmentPattern" && i.typeAnnotation && i.right.start < i.typeAnnotation.start && this.raise(m.TypeAnnotationAfterAssign, i.typeAnnotation), i;
}
getTokenFromCode(t) {
if (this.state.inType) {
if (t === 62) {
this.finishOp(44, 1);
return;
}
if (t === 60) {
this.finishOp(43, 1);
return;
}
}
super.getTokenFromCode(t);
}
reScan_lt_gt() {
let { type: t } = this.state;
t === 43 ? (this.state.pos -= 1, this.readToken_lt()) : t === 44 && (this.state.pos -= 1, this.readToken_gt());
}
reScan_lt() {
let { type: t } = this.state;
return t === 47 ? (this.state.pos -= 2, this.finishOp(43, 1), 43) : t;
}
toAssignableListItem(t, s, i) {
let r = t[s];
r.type === "TSTypeCastExpression" && (t[s] = this.typeCastToParameter(r)), super.toAssignableListItem(t, s, i);
}
typeCastToParameter(t) {
return t.expression.typeAnnotation = t.typeAnnotation, this.resetEndLocationFromNode(t.expression, t.typeAnnotation), t.expression;
}
shouldParseArrow(t) {
return this.match(10) ? t.every((s) => this.isAssignable(s, true)) : super.shouldParseArrow(t);
}
shouldParseAsyncArrow() {
return this.match(10) ? !this.state.inConditionalConsequent : super.shouldParseAsyncArrow();
}
parseParenAndDistinguishExpression(t) {
let s = this.state.inConditionalConsequent;
this.state.inConditionalConsequent = false;
let i = super.parseParenAndDistinguishExpression(t);
return this.state.inConditionalConsequent = s, i;
}
canHaveLeadingDecorator() {
return super.canHaveLeadingDecorator() || this.isAbstractClass();
}
jsxParseOpeningElementAfterName(t) {
if (this.match(43) || this.match(47)) {
let s = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
s && (t.typeArguments = s);
}
return super.jsxParseOpeningElementAfterName(t);
}
getGetterSetterExpectedParamCount(t) {
let s = super.getGetterSetterExpectedParamCount(t), r = this.getObjectOrClassMethodParams(t)[0];
return r && this.isThisParam(r) ? s + 1 : s;
}
parseCatchClauseParam() {
let t = super.parseCatchClauseParam(), s = this.tsTryParseTypeAnnotation();
return s && (t.typeAnnotation = s, this.resetEndLocation(t)), t;
}
tsInAmbientContext(t) {
let { isAmbientContext: s, strict: i } = this.state;
this.state.isAmbientContext = true, this.state.strict = false;
try {
return t();
} finally {
this.state.isAmbientContext = s, this.state.strict = i;
}
}
parseClass(t, s, i) {
let r = this.state.inAbstractClass;
this.state.inAbstractClass = !!t.abstract;
try {
return super.parseClass(t, s, i);
} finally {
this.state.inAbstractClass = r;
}
}
tsParseAbstractDeclaration(t, s) {
if (this.match(76)) return t.abstract = true, this.maybeTakeDecorators(s, this.parseClass(t, true, false));
if (this.isContextual(125)) return this.hasFollowingLineBreak() ? null : (t.abstract = true, this.raise(m.NonClassMethodPropertyHasAbstractModifier, t), this.tsParseInterfaceDeclaration(t));
throw this.unexpected(null, 76);
}
parseMethod(t, s, i, r, n, o, h) {
let c = super.parseMethod(t, s, i, r, n, o, h);
if ((c.abstract || c.type === "TSAbstractMethodDefinition") && (this.hasPlugin("estree") ? c.value : c).body) {
let { key: d } = c;
this.raise(m.AbstractMethodHasImplementation, c, { methodName: d.type === "Identifier" && !c.computed ? d.name : `[${this.input.slice(this.offsetToSourcePos(d.start), this.offsetToSourcePos(d.end))}]` });
}
return c;
}
tsParseTypeParameterName() {
return this.parseIdentifier();
}
shouldParseAsAmbientContext() {
return !!this.getPluginOption("typescript", "dts");
}
parse() {
return this.shouldParseAsAmbientContext() && (this.state.isAmbientContext = true), super.parse();
}
getExpression() {
return this.shouldParseAsAmbientContext() && (this.state.isAmbientContext = true), super.getExpression();
}
parseExportSpecifier(t, s, i, r) {
return !s && r ? (this.parseTypeOnlyImportExportSpecifier(t, false, i), this.finishNode(t, "ExportSpecifier")) : (t.exportKind = "value", super.parseExportSpecifier(t, s, i, r));
}
parseImportSpecifier(t, s, i, r, n) {
return !s && r ? (this.parseTypeOnlyImportExportSpecifier(t, true, i), this.finishNode(t, "ImportSpecifier")) : (t.importKind = "value", super.parseImportSpecifier(t, s, i, r, i ? 4098 : 4096));
}
parseTypeOnlyImportExportSpecifier(t, s, i) {
let r = s ? "imported" : "local", n = s ? "local" : "exported", o = t[r], h, c = false, p = true, f = o.start;
if (this.isContextual(89)) {
let x = this.parseIdentifier();
if (this.isContextual(89)) {
let T = this.parseIdentifier();
B(this.state.type) ? (c = true, o = x, h = s ? this.parseIdentifier() : this.parseModuleExportName(), p = false) : (h = T, p = false);
} else B(this.state.type) ? (p = false, h = s ? this.parseIdentifier() : this.parseModuleExportName()) : (c = true, o = x);
} else B(this.state.type) && (c = true, s ? (o = this.parseIdentifier(true), this.isContextual(89) || this.checkReservedWord(o.name, o.start, true, true)) : o = this.parseModuleExportName());
c && i && this.raise(s ? m.TypeModifierIsUsedInTypeImports : m.TypeModifierIsUsedInTypeExports, f), t[r] = o, t[n] = h;
let d = s ? "importKind" : "exportKind";
t[d] = c ? "type" : "value", p && this.eatContextual(89) && (t[n] = s ? this.parseIdentifier() : this.parseModuleExportName()), t[n] || (t[n] = this.cloneIdentifier(t[r])), s && this.checkIdentifier(t[n], c ? 4098 : 4096);
}
fillOptionalPropertiesForTSESLint(t) {
switch (t.type) {
case "ExpressionStatement":
t.directive ?? (t.directive = void 0);
return;
case "RestElement":
t.value = void 0;
case "Identifier":
case "ArrayPattern":
case "AssignmentPattern":
case "ObjectPattern":
t.decorators ?? (t.decorators = []), t.optional ?? (t.optional = false), t.typeAnnotation ?? (t.typeAnnotation = void 0);
return;
case "TSParameterProperty":
t.accessibility ?? (t.accessibility = void 0), t.decorators ?? (t.decorators = []), t.override ?? (t.override = false), t.readonly ?? (t.readonly = false), t.static ?? (t.static = false);
return;
case "TSEmptyBodyFunctionExpression":
t.body = null;
case "TSDeclareFunction":
case "FunctionDeclaration":
case "FunctionExpression":
case "ClassMethod":
case "ClassPrivateMethod":
t.declare ?? (t.declare = false), t.returnType ?? (t.returnType = void 0), t.typeParameters ?? (t.typeParameters = void 0);
return;
case "Property":
t.optional ?? (t.optional = false);
return;
case "TSMethodSignature":
case "TSPropertySignature":
t.optional ?? (t.optional = false);
case "TSIndexSignature":
t.accessibility ?? (t.accessibility = void 0), t.readonly ?? (t.readonly = false), t.static ?? (t.static = false);
return;
case "TSAbstractPropertyDefinition":
case "PropertyDefinition":
case "TSAbstractAccessorProperty":
case "AccessorProperty":
t.declare ?? (t.declare = false), t.definite ?? (t.definite = false), t.readonly ?? (t.readonly = false), t.typeAnnotation ?? (t.typeAnnotation = void 0);
case "TSAbstractMethodDefinition":
case "MethodDefinition":
t.accessibility ?? (t.accessibility = void 0), t.decorators ?? (t.decorators = []), t.override ?? (t.override = false), t.optional ?? (t.optional = false);
return;
case "ClassExpression":
t.id ?? (t.id = null);
case "ClassDeclaration":
t.abstract ?? (t.abstract = false), t.declare ?? (t.declare = false), t.decorators ?? (t.decorators = []), t.implements ?? (t.implements = []), t.superTypeArguments ?? (t.superTypeArguments = void 0), t.typeParameters ?? (t.typeParameters = void 0);
return;
case "TSTypeAliasDeclaration":
case "VariableDeclaration":
t.declare ?? (t.declare = false);
return;
case "VariableDeclarator":
t.definite ?? (t.definite = false);
return;
case "TSEnumDeclaration":
t.const ?? (t.const = false), t.declare ?? (t.declare = false);
return;
case "TSEnumMember":
t.computed ?? (t.computed = false);
return;
case "TSImportType":
t.qualifier ?? (t.qualifier = null), t.options ?? (t.options = null), t.typeArguments ?? (t.typeArguments = null);
return;
case "TSInterfaceDeclaration":
t.declare ?? (t.declare = false), t.extends ?? (t.extends = []);
return;
case "TSMappedType":
t.optional ?? (t.optional = false), t.readonly ?? (t.readonly = void 0);
return;
case "TSModuleDeclaration":
t.declare ?? (t.declare = false), t.global ?? (t.global = t.kind === "global");
return;
case "TSTypeParameter":
t.const ?? (t.const = false), t.in ?? (t.in = false), t.out ?? (t.out = false);
return;
}
}
chStartsBindingIdentifierAndNotRelationalOperator(t, s) {
if (R(t)) {
if (Jt.lastIndex = s, Jt.test(this.input)) {
let i = this.codePointAtPos(Jt.lastIndex);
if (!W(i) && i !== 92) return false;
}
return true;
} else return t === 92;
}
nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine() {
let t = this.nextTokenInLineStart(), s = this.codePointAtPos(t);
return this.chStartsBindingIdentifierAndNotRelationalOperator(s, t);
}
nextTokenIsStringLiteralOnSameLine() {
let t = this.nextTokenInLineStart(), s = this.codePointAtPos(t);
return s === 34 || s === 39;
}
};
dr = { ClassNameIsRequired: "A class name is required.", UnexpectedSpace: "Unexpected space in placeholder." };
We = F`placeholders`(dr);
mr = (a2) => class extends a2 {
parsePlaceholder(t) {
if (this.match(129)) {
let s = this.startNode();
return this.next(), this.assertNoSpace(), s.name = super.parseIdentifier(true), this.assertNoSpace(), this.expect(129), this.finishPlaceholder(s, t);
}
}
finishPlaceholder(t, s) {
let i = t;
return (!i.expectedNode || !i.type) && (i = this.finishNode(i, "Placeholder")), i.expectedNode = s, i;
}
getTokenFromCode(t) {
t === 37 && this.input.charCodeAt(this.state.pos + 1) === 37 ? this.finishOp(129, 2) : super.getTokenFromCode(t);
}
parseExprAtom(t) {
return this.parsePlaceholder("Expression") || super.parseExprAtom(t);
}
parseIdentifier(t) {
return this.parsePlaceholder("Identifier") || super.parseIdentifier(t);
}
checkReservedWord(t, s, i, r) {
t !== void 0 && super.checkReservedWord(t, s, i, r);
}
cloneIdentifier(t) {
let s = super.cloneIdentifier(t);
return s.type === "Placeholder" && (s.expectedNode = t.expectedNode), s;
}
cloneStringLiteral(t) {
return t.type === "Placeholder" ? this.cloneIdentifier(t) : super.cloneStringLiteral(t);
}
parseBindingAtom() {
return this.parsePlaceholder("Pattern") || super.parseBindingAtom();
}
isValidLVal(t, s, i, r) {
return t === "Placeholder" || super.isValidLVal(t, s, i, r);
}
toAssignable(t, s) {
t && t.type === "Placeholder" && t.expectedNode === "Expression" ? t.expectedNode = "Pattern" : super.toAssignable(t, s);
}
chStartsBindingIdentifier(t, s) {
if (super.chStartsBindingIdentifier(t, s)) return true;
let i = this.nextTokenStart();
return this.input.charCodeAt(i) === 37 && this.input.charCodeAt(i + 1) === 37;
}
verifyBreakContinue(t, s) {
t.label?.type !== "Placeholder" && super.verifyBreakContinue(t, s);
}
parseExpressionStatement(t, s) {
if (s.type !== "Placeholder" || s.extra?.parenthesized) return super.parseExpressionStatement(t, s);
if (this.match(10)) {
let r = t;
return r.label = this.finishPlaceholder(s, "Identifier"), this.next(), r.body = super.parseStatementOrSloppyAnnexBFunctionDeclaration(), this.finishNode(r, "LabeledStatement");
}
this.semicolon();
let i = t;
return i.name = s.name, this.finishPlaceholder(i, "Statement");
}
parseBlock(t, s, i) {
return this.parsePlaceholder("BlockStatement") || super.parseBlock(t, s, i);
}
parseFunctionId(t) {
return this.parsePlaceholder("Identifier") || super.parseFunctionId(t);
}
parseClass(t, s, i) {
let r = s ? "ClassDeclaration" : "ClassExpression";
this.next();
let n = this.state.strict, o = this.parsePlaceholder("Identifier");
if (o) if (this.match(77) || this.match(129) || this.match(2)) t.id = o;
else {
if (i || !s) return t.id = null, t.body = this.finishPlaceholder(o, "ClassBody"), this.finishNode(t, r);
throw this.raise(We.ClassNameIsRequired, this.state.startLoc);
}
else this.parseClassId(t, s, i);
return super.parseClassSuper(t), t.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!t.superClass, n), this.finishNode(t, r);
}
parseExport(t, s) {
let i = this.parsePlaceholder("Identifier");
if (!i) return super.parseExport(t, s);
let r = t;
if (!this.isContextual(94) && !this.match(8)) return r.specifiers = [], r.source = null, r.declaration = this.finishPlaceholder(i, "Declaration"), this.finishNode(r, "ExportNamedDeclaration");
this.expectPlugin("exportDefaultFrom");
let n = this.startNode();
return n.exported = i, r.specifiers = [this.finishNode(n, "ExportDefaultSpecifier")], super.parseExport(r, s);
}
isExportDefaultSpecifier() {
if (this.match(61)) {
let t = this.nextTokenStart();
if (this.isUnparsedContextual(t, "from") && this.input.startsWith(z(129), this.nextTokenStartSince(t + 4))) return true;
}
return super.isExportDefaultSpecifier();
}
maybeParseExportDefaultSpecifier(t, s) {
return t.specifiers?.length ? true : super.maybeParseExportDefaultSpecifier(t, s);
}
checkExport(t) {
let { specifiers: s } = t;
s?.length && (t.specifiers = s.filter((i) => i.exported.type === "Placeholder")), super.checkExport(t), t.specifiers = s;
}
parseImport(t) {
let s = this.parsePlaceholder("Identifier");
if (!s) return super.parseImport(t);
if (t.specifiers = [], !this.isContextual(94) && !this.match(8)) return t.source = this.finishPlaceholder(s, "StringLiteral"), this.semicolon(), this.finishNode(t, "ImportDeclaration");
let i = this.startNodeAtNode(s);
return i.local = s, t.specifiers.push(this.finishNode(i, "ImportDefaultSpecifier")), this.eat(8) && (this.maybeParseStarImportSpecifier(t) || this.parseNamedImportSpecifiers(t)), this.expectContextual(94), t.source = this.parseImportSource(), this.semicolon(), this.finishNode(t, "ImportDeclaration");
}
parseImportSource() {
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
}
assertNoSpace() {
this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index) && this.raise(We.UnexpectedSpace, this.state.lastTokEndLoc);
}
};
yr = (a2) => class extends a2 {
parseV8Intrinsic() {
if (this.match(50)) {
let t = this.state.startLoc, s = this.startNode();
if (this.next(), C(this.state.type)) {
let i = this.parseIdentifierName(), r = this.createIdentifier(s, i);
if (this.castNodeTo(r, "V8IntrinsicIdentifier"), this.match(6)) return r;
}
this.unexpected(t);
}
}
parseExprAtom(t) {
return this.parseV8Intrinsic() || super.parseExprAtom(t);
}
};
Je = ["fsharp", "hack"];
Ge = ["^^", "@@", "^", "%", "#"];
us = { estree: yi, jsx: Gi, flow: Hi, typescript: lr, v8intrinsic: yr, placeholders: mr };
Pr = Object.keys(us);
Lt = class extends ye {
constructor(e, t, s) {
let i = mi(e);
super(i, t), this.options = i, this.initializeScopes(), this.plugins = s, this.filename = i.sourceFilename, this.startIndex = i.startIndex;
let r = 0;
i.allowAwaitOutsideFunction && (r |= 1), i.allowReturnOutsideFunction && (r |= 2), i.allowImportExportEverywhere && (r |= 8), i.allowSuperOutsideMethod && (r |= 16), i.allowUndeclaredExports && (r |= 64), i.allowNewTargetOutsideFunction && (r |= 4), i.allowYieldOutsideFunction && (r |= 32), i.ranges && (r |= 128), i.locations === true && (r |= 256), i.tokens && (r |= 512), i.createImportExpressions && (r |= 1024), i.createParenthesizedExpressions && (r |= 2048), i.errorRecovery && (r |= 4096), i.attachComment && (r |= 8192), i.annexB && (r |= 16384), this.optionFlags = r;
}
getScopeHandler() {
return xt;
}
parse() {
this.enterInitialScopes();
let e = this.startNode(), t = this.startNode();
this.nextToken(), e.errors = [];
let s = this.parseTopLevel(e, t);
return s.errors = this.state.errors, s.comments.length = this.state.commentsLen, s;
}
};
Ba = gr(Pi);
Xe = /* @__PURE__ */ new Map();
Ua = Ot(/\s/);
fs = Ot(" ");
_a = Ot(",; ");
ds = Ot(/[^\n\r]/);
ms = br;
ys = (a2) => a2 === `
` || a2 === "\r" || a2 === "\u2028" || a2 === "\u2029";
xs = Ar;
Ps = Sr;
gs = Cr;
Ft = Er;
wr = Array.prototype.findLast ?? function(a2) {
for (let e = this.length - 1; e >= 0; e--) {
let t = this[e];
if (a2(t, e, this)) return t;
}
};
Ir = X("findLast", function() {
if (Array.isArray(this)) return wr;
});
bs = Ir;
Bt = /* @__PURE__ */ Symbol.for("comments");
kr = X("at", function() {
if (Array.isArray(this) || typeof this == "string") return Nr;
});
As = kr;
vr = 5;
Lr = 8;
Dr = 8;
Ss = (a2) => (e) => e.label ? k(e.label) : N(e) + a2;
Mr = (a2) => a2.__contentEnd ?? rt(a2);
Cs = ["ExpressionStatement", "Directive", "ImportDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "ReturnStatement", "ThrowStatement", "DoWhileStatement"];
Or = new Map([["BreakStatement", Ss(vr)], ["ContinueStatement", Ss(Lr)], ["DebuggerStatement", (a2) => N(a2) + Dr], ["VariableDeclaration", (a2) => k(As(0, a2.declarations, -1))], ...Cs.map((a2) => [a2, Mr])]);
Ie = J(Cs);
at = J(["Block", "CommentBlock", "MultiLine"]);
Es = J(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose", "Hashbang", "InterpreterDirective"]);
Fr = /* @__PURE__ */ new WeakMap();
Is = Br;
Ur = /* @__PURE__ */ new WeakMap();
ks = /* @__PURE__ */ new WeakMap();
Ds = Vr;
gt = null;
qr = 10;
for (let a2 = 0; a2 <= qr; a2++) Tt();
Ms = $r;
u = [["elements"], ["left", "right"], ["value"], ["directives", "body"], ["label"], ["callee", "typeArguments", "arguments"], ["test", "consequent", "alternate"], ["body", "test"], ["expression"], ["left", "right", "body"], ["id", "typeParameters", "params", "predicate", "returnType", "body"], ["object", "property"], ["properties"], ["decorators", "key", "typeParameters", "params", "returnType", "body"], ["decorators", "key", "value"], ["argument"], ["expressions"], ["id", "init"], ["body"], ["decorators", "id", "typeParameters", "superClass", "superTypeArguments", "mixins", "implements", "body"], ["declaration", "specifiers", "source", "attributes"], ["local"], ["exported"], ["decorators", "variance", "key", "typeAnnotation", "value"], ["id"], ["key", "value"], ["elementType"], ["id", "typeParameters"], ["id", "typeParameters", "extends", "body"], ["id", "body"], ["typeAnnotation"], ["id", "typeParameters", "right"], ["name", "typeAnnotation"], ["types"], ["qualification", "id"], ["elementTypes"], ["expression", "typeAnnotation"], ["params"], ["members"], ["objectType", "indexType"], ["decorators", "key", "typeAnnotation", "value"], ["id", "typeParameters", "params", "returnType", "body"], ["key", "typeParameters", "params", "returnType"], ["typeParameters", "params", "returnType"], ["parameterName", "typeAnnotation"], ["checkType", "extendsType", "trueType", "falseType"], ["typeParameter"], ["literal"], ["expression", "typeArguments"], ["decorators", "key", "typeAnnotation"], ["argument", "cases"], ["pattern", "body", "guard"], ["properties", "rest"], ["node"]];
Os = { ArrayExpression: u[0], AssignmentExpression: u[1], BinaryExpression: u[1], InterpreterDirective: [], Directive: u[2], DirectiveLiteral: [], BlockStatement: u[3], BreakStatement: u[4], CallExpression: u[5], CatchClause: ["param", "body"], ConditionalExpression: u[6], ContinueStatement: u[4], DebuggerStatement: [], DoWhileStatement: u[7], EmptyStatement: [], ExpressionStatement: u[8], File: ["program"], ForInStatement: u[9], ForStatement: ["init", "test", "update", "body"], FunctionDeclaration: u[10], FunctionExpression: u[10], Identifier: ["typeAnnotation", "decorators"], IfStatement: u[6], LabeledStatement: ["label", "body"], StringLiteral: [], NumericLiteral: [], NullLiteral: [], BooleanLiteral: [], RegExpLiteral: [], LogicalExpression: u[1], MemberExpression: u[11], NewExpression: u[5], Program: u[3], ObjectExpression: u[12], ObjectMethod: u[13], ObjectProperty: u[14], RestElement: ["argument", "typeAnnotation", "decorators"], ReturnStatement: u[15], SequenceExpression: u[16], ParenthesizedExpression: u[8], SwitchCase: ["test", "consequent"], SwitchStatement: ["discriminant", "cases"], ThisExpression: [], ThrowStatement: u[15], TryStatement: ["block", "handler", "finalizer"], UnaryExpression: u[15], UpdateExpression: u[15], VariableDeclaration: ["declarations"], VariableDeclarator: u[17], WhileStatement: u[7], WithStatement: ["object", "body"], AssignmentPattern: ["left", "right", "decorators", "typeAnnotation"], ArrayPattern: ["elements", "typeAnnotation", "decorators"], ArrowFunctionExpression: ["typeParameters", "params", "predicate", "returnType", "body"], ClassBody: u[18], ClassExpression: u[19], ClassDeclaration: u[19], ExportAllDeclaration: ["source", "attributes", "exported"], ExportDefaultDeclaration: ["declaration"], ExportNamedDeclaration: u[20], ExportSpecifier: ["local", "exported"], ForOfStatement: u[9], ImportDeclaration: ["specifiers", "source", "attributes"], ImportDefaultSpecifier: u[21], ImportNamespaceSpecifier: u[21], ImportSpecifier: ["imported", "local"], MetaProperty: ["meta", "property"], ClassMethod: u[13], ObjectPattern: ["decorators", "properties", "typeAnnotation"], SpreadElement: u[15], Super: [], TaggedTemplateExpression: ["tag", "typeArguments", "quasi"], TemplateElement: [], TemplateLiteral: ["quasis", "expressions"], YieldExpression: u[15], AwaitExpression: u[15], ImportExpression: ["source", "options"], BigIntLiteral: [], ExportNamespaceSpecifier: u[22], OptionalMemberExpression: u[11], OptionalCallExpression: u[5], ClassProperty: u[23], ClassPrivateProperty: u[23], ClassPrivateMethod: u[13], PrivateName: u[24], StaticBlock: u[18], ImportAttribute: u[25], AnyTypeAnnotation: [], ArrayTypeAnnotation: u[26], BooleanTypeAnnotation: [], BooleanLiteralTypeAnnotation: [], NullLiteralTypeAnnotation: [], ClassImplements: u[27], DeclareClass: ["id", "typeParameters", "extends", "mixins", "implements", "body"], DeclareFunction: ["id", "predicate"], DeclareInterface: u[28], DeclareModule: u[29], DeclareModuleExports: u[30], DeclareTypeAlias: u[31], DeclareOpaqueType: ["id", "typeParameters", "supertype", "lowerBound", "upperBound"], DeclareVariable: ["id", "declarations"], DeclareExportDeclaration: u[20], DeclareExportAllDeclaration: ["source", "attributes"], DeclaredPredicate: u[2], ExistsTypeAnnotation: [], FunctionTypeAnnotation: ["typeParameters", "this", "params", "rest", "returnType"], FunctionTypeParam: u[32], GenericTypeAnnotation: u[27], InferredPredicate: [], InterfaceExtends: u[27], InterfaceDeclaration: u[28], InterfaceTypeAnnotation: ["extends", "body"], IntersectionTypeAnnotation: u[33], MixedTypeAnnotation: [], EmptyTypeAnnotation: [], NullableTypeAnnotation: u[30], NumberLiteralTypeAnnotation: [], BigIntLiteralTypeAnnotation: [], NumberTypeAnnotation: [], ObjectTypeAnnotation: ["properties", "indexers", "callProperties", "internalSlots"], ObjectTypeInternalSlot: ["id", "value"], ObjectTypeCallProperty: u[2], ObjectTypeIndexer: ["variance", "id", "key", "value"], ObjectTypeProperty: ["key", "value", "variance"], ObjectTypeSpreadProperty: u[15], OpaqueType: ["id", "typeParameters", "supertype", "impltype", "lowerBound", "upperBound"], QualifiedTypeIdentifier: u[34], StringLiteralTypeAnnotation: [], StringTypeAnnotation: [], SymbolTypeAnnotation: [], ThisTypeAnnotation: [], TupleTypeAnnotation: u[35], TypeofTypeAnnotation: ["argument", "typeArguments"], TypeAlias: u[31], TypeAnnotation: u[30], TypeCastExpression: u[36], TypeParameter: ["bound", "default", "variance"], TypeParameterDeclaration: u[37], TypeParameterInstantiation: u[37], UnionTypeAnnotation: u[33], Variance: [], VoidTypeAnnotation: [], EnumDeclaration: u[29], EnumBooleanBody: u[38], EnumNumberBody: u[38], EnumStringBody: u[38], EnumSymbolBody: u[38], EnumBooleanMember: u[17], EnumNumberMember: u[17], EnumStringMember: u[17], EnumDefaultedMember: u[24], IndexedAccessType: u[39], OptionalIndexedAccessType: u[39], JSXAttribute: ["name", "value"], JSXClosingElement: ["name"], JSXElement: ["openingElement", "children", "closingElement"], JSXEmptyExpression: [], JSXExpressionContainer: u[8], JSXSpreadChild: u[8], JSXIdentifier: [], JSXMemberExpression: u[11], JSXNamespacedName: ["namespace", "name"], JSXOpeningElement: ["name", "typeArguments", "attributes"], JSXSpreadAttribute: u[15], JSXText: [], JSXFragment: ["openingFragment", "children", "closingFragment"], JSXOpeningFragment: [], JSXClosingFragment: [], Placeholder: [], V8IntrinsicIdentifier: [], ArgumentPlaceholder: [], BindExpression: ["object", "callee"], ClassAccessorProperty: u[40], Decorator: u[8], DoExpression: u[18], ExportDefaultSpecifier: u[22], ModuleExpression: u[18], TopicReference: [], VoidPattern: [], TSParameterProperty: ["parameter", "decorators"], TSDeclareFunction: u[41], TSDeclareMethod: u[42], TSQualifiedName: u[1], TSCallSignatureDeclaration: u[43], TSConstructSignatureDeclaration: u[43], TSPropertySignature: ["key", "typeAnnotation"], TSMethodSignature: u[42], TSIndexSignature: ["parameters", "typeAnnotation"], TSAnyKeyword: [], TSBooleanKeyword: [], TSBigIntKeyword: [], TSIntrinsicKeyword: [], TSNeverKeyword: [], TSNullKeyword: [], TSNumberKeyword: [], TSObjectKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], TSUndefinedKeyword: [], TSUnknownKeyword: [], TSVoidKeyword: [], TSThisType: [], TSFunctionType: u[43], TSConstructorType: u[43], TSTypeReference: ["typeName", "typeArguments"], TSTypePredicate: u[44], TSTypeQuery: ["exprName", "typeArguments"], TSTypeLiteral: u[38], TSArrayType: u[26], TSTupleType: u[35], TSOptionalType: u[30], TSRestType: u[30], TSNamedTupleMember: ["label", "elementType"], TSUnionType: u[33], TSIntersectionType: u[33], TSConditionalType: u[45], TSInferType: u[46], TSParenthesizedType: u[30], TSTypeOperator: u[30], TSIndexedAccessType: u[39], TSMappedType: ["key", "constraint", "nameType", "typeAnnotation"], TSTemplateLiteralType: ["quasis", "types"], TSLiteralType: u[47], TSClassImplements: u[48], TSInterfaceHeritage: u[48], TSInterfaceDeclaration: u[28], TSInterfaceBody: u[18], TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSInstantiationExpression: u[48], TSAsExpression: u[36], TSSatisfiesExpression: u[36], TSTypeAssertion: u[36], TSEnumBody: u[38], TSEnumDeclaration: u[29], TSEnumMember: ["id", "initializer"], TSModuleDeclaration: u[29], TSModuleBlock: u[18], TSImportType: ["source", "options", "qualifier", "typeArguments"], TSImportEqualsDeclaration: ["id", "moduleReference"], TSExternalModuleReference: u[8], TSNonNullExpression: u[8], TSExportAssignment: u[8], TSNamespaceExportDeclaration: u[24], TSTypeAnnotation: u[30], TSTypeParameterInstantiation: u[37], TSTypeParameterDeclaration: u[37], TSTypeParameter: ["name", "constraint", "default"], ChainExpression: u[8], Literal: [], MethodDefinition: u[14], PrivateIdentifier: [], Property: u[25], PropertyDefinition: u[23], AccessorProperty: u[40], TSAbstractAccessorProperty: u[49], TSAbstractKeyword: [], TSAbstractMethodDefinition: u[25], TSAbstractPropertyDefinition: u[49], TSAsyncKeyword: [], TSDeclareKeyword: [], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSExportKeyword: [], TSPrivateKeyword: [], TSProtectedKeyword: [], TSPublicKeyword: [], TSReadonlyKeyword: [], TSStaticKeyword: [], AsConstExpression: u[8], AsExpression: u[36], BigIntTypeAnnotation: [], ComponentDeclaration: ["id", "params", "body", "typeParameters", "rendersType"], ComponentParameter: ["name", "local"], ComponentTypeAnnotation: ["params", "rest", "typeParameters", "rendersType"], ComponentTypeParameter: u[32], ConditionalTypeAnnotation: u[45], DeclareComponent: ["id", "params", "rest", "typeParameters", "rendersType"], DeclareEnum: u[29], DeclareHook: u[24], DeclareNamespace: u[29], EnumBigIntBody: u[38], EnumBigIntMember: u[17], EnumBody: u[38], HookDeclaration: u[41], HookTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], InferTypeAnnotation: u[46], KeyofTypeAnnotation: u[15], MatchArrayPattern: ["elements", "rest"], MatchAsPattern: ["pattern", "target"], MatchBindingPattern: u[24], MatchExpression: u[50], MatchExpressionCase: u[51], MatchIdentifierPattern: u[24], MatchInstanceObjectPattern: u[52], MatchInstancePattern: ["targetConstructor", "properties"], MatchLiteralPattern: u[47], MatchMemberPattern: ["base", "property"], MatchObjectPattern: u[52], MatchObjectPatternProperty: ["key", "pattern"], MatchOrPattern: ["patterns"], MatchRestPattern: u[15], MatchStatement: u[50], MatchStatementCase: u[51], MatchUnaryPattern: u[15], MatchWildcardPattern: [], NeverTypeAnnotation: [], ObjectTypeMappedTypeProperty: ["keyTparam", "propType", "sourceType", "variance"], QualifiedTypeofIdentifier: u[34], RecordDeclaration: ["id", "typeParameters", "implements", "body"], RecordDeclarationBody: u[0], RecordDeclarationImplements: ["id", "typeArguments"], RecordDeclarationProperty: ["key", "typeAnnotation", "defaultValue"], RecordDeclarationStaticProperty: ["key", "typeAnnotation", "value"], RecordExpression: ["recordConstructor", "typeArguments", "properties"], RecordExpressionProperties: u[12], SatisfiesExpression: u[36], TupleTypeLabeledElement: ["label", "elementType", "variance"], TupleTypeSpreadElement: ["label", "typeAnnotation"], TypeOperator: u[30], TypePredicate: u[44], UndefinedTypeAnnotation: [], UnknownTypeAnnotation: [], NGChainedExpression: u[16], NGEmptyExpression: [], NGPipeExpression: ["left", "right", "arguments"], NGMicrosyntax: u[18], NGMicrosyntaxAs: ["key", "alias"], NGMicrosyntaxExpression: ["expression", "alias"], NGMicrosyntaxKey: [], NGMicrosyntaxKeyedExpression: ["key", "expression"], NGMicrosyntaxLet: u[25], NGRoot: u[53], JsExpressionRoot: u[53], JsonRoot: u[53], TSJSDocAllType: [], TSJSDocUnknownType: [], TSJSDocNullableType: u[30], TSJSDocNonNullableType: u[30] };
zr = Ms(Os);
Fs = zr;
Bs = Rt;
so = J(["RegExpLiteral", "BigIntLiteral", "NumericLiteral", "StringLiteral", "DirectiveLiteral", "Literal", "JSXText", "TemplateElement", "StringLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation"]);
Us = Hr;
Ut = Wr;
_s = "Unexpected parseExpression() input: ";
_t = Jr;
Gr = /\*\/$/;
Xr = /^\/\*\*?/;
Yr = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
Qr = /(^|\s+)\/\/([^\n\r]*)/g;
js = /^(\r?\n)+/;
Zr = /(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g;
Vs = /(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g;
ta = /(\r?\n|^) *\* ?/g;
ea = [];
zs = ["noformat", "noprettier"];
Hs = ["format", "prettier"];
G = sa;
jt = "module";
Le = "commonjs";
Vt = ia;
ot = (a2) => G(ha(a2));
ra = { sourceType: jt, allowImportExportEverywhere: true, allowReturnOutsideFunction: true, allowNewTargetOutsideFunction: true, allowSuperOutsideMethod: true, allowUndeclaredExports: true, errorRecovery: true, createParenthesizedExpressions: true, attachComment: false, plugins: ["doExpressions", "exportDefaultFrom", "functionBind", "functionSent", "throwExpressions", ["partialApplication", { version: "2018-07" }], "decorators", "moduleBlocks", "asyncDoExpressions", "destructuringPrivate", "decoratorAutoAccessors", "sourcePhaseImports", "deferredImportEvaluation", ["optionalChainingAssign", { version: "2023-07" }], ["discardBinding", { syntaxType: "void" }]], tokens: false, ranges: false };
Xs = "v8intrinsic";
Ys = [["pipelineOperator", { proposal: "hack", topicToken: "%" }], ["pipelineOperator", { proposal: "fsharp" }]];
j = (a2, e = ra) => ({ ...e, plugins: [...e.plugins, ...a2] });
aa = /@(?:no)?flow\b/;
ca = ["StrictNumericEscape", "StrictWith", "StrictOctalLiteral", "StrictDelete", "StrictEvalArguments", "StrictEvalArgumentsBinding", "StrictFunction", "ForInOfLoopInitializer", "ParamDupe", "RestTrailingComma", "UnsupportedParameterDecorator", "UnterminatedJsxContent", "UnexpectedReservedWord", "ModuleAttributesWithDuplicateKeys", "InvalidEscapeSequenceTemplate", "NonAbstractClassHasAbstractMethod", "PatternIsOptional", "VarRedeclaration", "InvalidPrivateFieldResolution", "DuplicateExport", "DeclarationMissingInitializer", "DecoratorAbstractMethod"];
la = new Set(ca);
Qs = [j(["jsx"])];
pa = ot({ optionsCombinations: Qs });
ua = ot({ optionsCombinations: [j(["jsx", "typescript"]), j(["typescript"])] });
fa = ot({ isExpression: true, optionsCombinations: [j(["jsx"])] });
da = ot({ isExpression: true, optionsCombinations: [j(["typescript"])] });
Zs = ot({ optionsCombinations: [j(["jsx", ["flow", { all: true }], "flowComments"])] });
ma = ot({ optionsCombinations: Qs.map((a2) => j(["estree"], a2)) });
Oe = {};
qt(Oe, { json: () => Pa, "json-stringify": () => ba, json5: () => ga, jsonc: () => Ta });
Me = ya;
ti = { tokens: false, ranges: false, attachComment: false, createParenthesizedExpressions: true };
Pa = G({ parse: (a2) => bt(a2), hasPragma: () => true, hasIgnorePragma: () => false });
ga = G((a2) => bt(a2));
Ta = G((a2) => bt(a2, { allowEmpty: true }));
ba = G({ parse: (a2) => bt(a2, { allowComments: false }), astFormat: "estree-json" });
Aa = { ...De, ...Oe };
}
});
init_babel();
export {
ei as default,
Aa as parsers
};