import { n as e } from "./chunk-3e0lkp8x.js";
import { parseRegExpLiteral as t } from "@eslint-community/regexpp";
//#region src/abstractions/InternalMarkers.ts
var n = "__PARSED__", r = "_ARROW_EXPR_";
function i(e) {
	return typeof e == "object" && !!e && "__PARSED__" in e && e.__PARSED__ === !0;
}
function a(e) {
	return typeof e == "object" && !!e && "_ARROW_EXPR_" in e && e._ARROW_EXPR_ === !0;
}
//#endregion
//#region src/components-core/script-runner/ScriptingSourceTree.ts
var { T_BLOCK_STATEMENT: o, T_EMPTY_STATEMENT: s, T_EXPRESSION_STATEMENT: c, T_ARROW_EXPRESSION_STATEMENT: l, T_LET_STATEMENT: u, T_CONST_STATEMENT: d, T_VAR_STATEMENT: f, T_IF_STATEMENT: p, T_RETURN_STATEMENT: m, T_BREAK_STATEMENT: ee, T_CONTINUE_STATEMENT: te, T_WHILE_STATEMENT: h, T_DO_WHILE_STATEMENT: g, T_FOR_STATEMENT: ne, T_FOR_IN_STATEMENT: _, T_FOR_OF_STATEMENT: v, T_THROW_STATEMENT: re, T_TRY_STATEMENT: ie, T_SWITCH_STATEMENT: ae, T_FUNCTION_DECLARATION: y, T_ASYNC_FUNCTION_DECLARATION: b, T_IMPORT_DECLARATION: oe, T_UNARY_EXPRESSION: x, T_BINARY_EXPRESSION: S, T_SEQUENCE_EXPRESSION: C, T_CONDITIONAL_EXPRESSION: w, T_FUNCTION_INVOCATION_EXPRESSION: T, T_MEMBER_ACCESS_EXPRESSION: E, T_CALCULATED_MEMBER_ACCESS_EXPRESSION: D, T_IDENTIFIER: O, T_TEMPLATE_LITERAL_EXPRESSION: se, T_LITERAL: k, T_ARRAY_LITERAL: A, T_OBJECT_LITERAL: j, T_SPREAD_EXPRESSION: M, T_ASSIGNMENT_EXPRESSION: N, T_NO_ARG_EXPRESSION: P, T_ARROW_EXPRESSION: F, T_PREFIX_OP_EXPRESSION: ce, T_POSTFIX_OP_EXPRESSION: I, T_REACTIVE_VAR_DECLARATION: L, T_AWAIT_EXPRESSION: R, T_NEW_EXPRESSION: z, T_VAR_DECLARATION: B, T_DESTRUCTURE: V, T_ARRAY_DESTRUCTURE: H, T_OBJECT_DESTRUCTURE: U, T_SWITCH_CASE: le, T_IMPORT_SPECIFIER: ue } = /* @__PURE__ */ e({
	T_ARRAY_DESTRUCTURE: () => 202,
	T_ARRAY_LITERAL: () => 110,
	T_ARROW_EXPRESSION: () => 115,
	T_ARROW_EXPRESSION_STATEMENT: () => 4,
	T_ASSIGNMENT_EXPRESSION: () => 113,
	T_ASYNC_FUNCTION_DECLARATION: () => 21,
	T_AWAIT_EXPRESSION: () => 119,
	T_BINARY_EXPRESSION: () => 101,
	T_BLOCK_STATEMENT: () => 1,
	T_BREAK_STATEMENT: () => 10,
	T_CALCULATED_MEMBER_ACCESS_EXPRESSION: () => 106,
	T_CONDITIONAL_EXPRESSION: () => 103,
	T_CONST_STATEMENT: () => 6,
	T_CONTINUE_STATEMENT: () => 11,
	T_DESTRUCTURE: () => 201,
	T_DO_WHILE_STATEMENT: () => 13,
	T_EMPTY_STATEMENT: () => 2,
	T_EXPRESSION_STATEMENT: () => 3,
	T_FOR_IN_STATEMENT: () => 15,
	T_FOR_OF_STATEMENT: () => 16,
	T_FOR_STATEMENT: () => 14,
	T_FUNCTION_DECLARATION: () => 20,
	T_FUNCTION_INVOCATION_EXPRESSION: () => 104,
	T_IDENTIFIER: () => 107,
	T_IF_STATEMENT: () => 8,
	T_IMPORT_DECLARATION: () => 22,
	T_IMPORT_SPECIFIER: () => 205,
	T_LET_STATEMENT: () => 5,
	T_LITERAL: () => 109,
	T_MEMBER_ACCESS_EXPRESSION: () => 105,
	T_NEW_EXPRESSION: () => 120,
	T_NO_ARG_EXPRESSION: () => 114,
	T_OBJECT_DESTRUCTURE: () => 203,
	T_OBJECT_LITERAL: () => 111,
	T_POSTFIX_OP_EXPRESSION: () => 117,
	T_PREFIX_OP_EXPRESSION: () => 116,
	T_REACTIVE_VAR_DECLARATION: () => 118,
	T_RETURN_STATEMENT: () => 9,
	T_SEQUENCE_EXPRESSION: () => 102,
	T_SPREAD_EXPRESSION: () => 112,
	T_SWITCH_CASE: () => 204,
	T_SWITCH_STATEMENT: () => 19,
	T_TEMPLATE_LITERAL_EXPRESSION: () => 108,
	T_THROW_STATEMENT: () => 17,
	T_TRY_STATEMENT: () => 18,
	T_UNARY_EXPRESSION: () => 100,
	T_VAR_DECLARATION: () => 200,
	T_VAR_STATEMENT: () => 7,
	T_WHILE_STATEMENT: () => 12
}), W = class {
	constructor(e) {
		this.source = e, this._pos = 0, this._line = 1, this._column = 0;
	}
	get position() {
		return this._pos;
	}
	get line() {
		return this._line;
	}
	get column() {
		return this._column;
	}
	peek() {
		return this.ahead(0);
	}
	ahead(e = 1) {
		return this._pos + e > this.source.length - 1 ? null : this.source[this._pos + e];
	}
	get() {
		if (this._pos >= this.source.length) return null;
		let e = this.source[this._pos++];
		return e === "\n" ? (this._line++, this._column = 0) : this._column++, e;
	}
	getTail(e) {
		return this.source?.substring(e) ?? "";
	}
}, G = /* @__PURE__ */ function(e) {
	return e[e.Eof = -1] = "Eof", e[e.Ws = -2] = "Ws", e[e.BlockComment = -3] = "BlockComment", e[e.EolComment = -4] = "EolComment", e[e.Unknown = 0] = "Unknown", e[e.LParent = 1 + e.Unknown] = "LParent", e[e.RParent = 1 + e.LParent] = "RParent", e[e.Identifier = 1 + e.RParent] = "Identifier", e[e.Exponent = 1 + e.Identifier] = "Exponent", e[e.Divide = 1 + e.Exponent] = "Divide", e[e.Multiply = 1 + e.Divide] = "Multiply", e[e.Remainder = 1 + e.Multiply] = "Remainder", e[e.Plus = 1 + e.Remainder] = "Plus", e[e.Minus = 1 + e.Plus] = "Minus", e[e.BitwiseXor = 1 + e.Minus] = "BitwiseXor", e[e.BitwiseOr = 1 + e.BitwiseXor] = "BitwiseOr", e[e.LogicalOr = 1 + e.BitwiseOr] = "LogicalOr", e[e.BitwiseAnd = 1 + e.LogicalOr] = "BitwiseAnd", e[e.LogicalAnd = 1 + e.BitwiseAnd] = "LogicalAnd", e[e.IncOp = 1 + e.LogicalAnd] = "IncOp", e[e.DecOp = 1 + e.IncOp] = "DecOp", e[e.Assignment = 1 + e.DecOp] = "Assignment", e[e.AddAssignment = 1 + e.Assignment] = "AddAssignment", e[e.SubtractAssignment = 1 + e.AddAssignment] = "SubtractAssignment", e[e.ExponentAssignment = 1 + e.SubtractAssignment] = "ExponentAssignment", e[e.MultiplyAssignment = 1 + e.ExponentAssignment] = "MultiplyAssignment", e[e.DivideAssignment = 1 + e.MultiplyAssignment] = "DivideAssignment", e[e.RemainderAssignment = 1 + e.DivideAssignment] = "RemainderAssignment", e[e.ShiftLeftAssignment = 1 + e.RemainderAssignment] = "ShiftLeftAssignment", e[e.ShiftRightAssignment = 1 + e.ShiftLeftAssignment] = "ShiftRightAssignment", e[e.SignedShiftRightAssignment = 1 + e.ShiftRightAssignment] = "SignedShiftRightAssignment", e[e.BitwiseAndAssignment = 1 + e.SignedShiftRightAssignment] = "BitwiseAndAssignment", e[e.BitwiseXorAssignment = 1 + e.BitwiseAndAssignment] = "BitwiseXorAssignment", e[e.BitwiseOrAssignment = 1 + e.BitwiseXorAssignment] = "BitwiseOrAssignment", e[e.LogicalAndAssignment = 1 + e.BitwiseOrAssignment] = "LogicalAndAssignment", e[e.LogicalOrAssignment = 1 + e.LogicalAndAssignment] = "LogicalOrAssignment", e[e.NullCoalesceAssignment = 1 + e.LogicalOrAssignment] = "NullCoalesceAssignment", e[e.Semicolon = 1 + e.NullCoalesceAssignment] = "Semicolon", e[e.Comma = 1 + e.Semicolon] = "Comma", e[e.Colon = 1 + e.Comma] = "Colon", e[e.LSquare = 1 + e.Colon] = "LSquare", e[e.RSquare = 1 + e.LSquare] = "RSquare", e[e.QuestionMark = 1 + e.RSquare] = "QuestionMark", e[e.NullCoalesce = 1 + e.QuestionMark] = "NullCoalesce", e[e.OptionalChaining = 1 + e.NullCoalesce] = "OptionalChaining", e[e.BinaryNot = 1 + e.OptionalChaining] = "BinaryNot", e[e.LBrace = 1 + e.BinaryNot] = "LBrace", e[e.RBrace = 1 + e.LBrace] = "RBrace", e[e.Equal = 1 + e.RBrace] = "Equal", e[e.StrictEqual = 1 + e.Equal] = "StrictEqual", e[e.LogicalNot = 1 + e.StrictEqual] = "LogicalNot", e[e.NotEqual = 1 + e.LogicalNot] = "NotEqual", e[e.StrictNotEqual = 1 + e.NotEqual] = "StrictNotEqual", e[e.LessThan = 1 + e.StrictNotEqual] = "LessThan", e[e.LessThanOrEqual = 1 + e.LessThan] = "LessThanOrEqual", e[e.ShiftLeft = 1 + e.LessThanOrEqual] = "ShiftLeft", e[e.GreaterThan = 1 + e.ShiftLeft] = "GreaterThan", e[e.GreaterThanOrEqual = 1 + e.GreaterThan] = "GreaterThanOrEqual", e[e.ShiftRight = 1 + e.GreaterThanOrEqual] = "ShiftRight", e[e.SignedShiftRight = 1 + e.ShiftRight] = "SignedShiftRight", e[e.Dot = 1 + e.SignedShiftRight] = "Dot", e[e.Spread = 1 + e.Dot] = "Spread", e[e.Backtick = 1 + e.Spread] = "Backtick", e[e.DollarLBrace = 1 + e.Backtick] = "DollarLBrace", e[e.Arrow = 1 + e.DollarLBrace] = "Arrow", e[e.DecimalLiteral = 1 + e.Arrow] = "DecimalLiteral", e[e.HexadecimalLiteral = 1 + e.DecimalLiteral] = "HexadecimalLiteral", e[e.BinaryLiteral = 1 + e.HexadecimalLiteral] = "BinaryLiteral", e[e.RealLiteral = 1 + e.BinaryLiteral] = "RealLiteral", e[e.StringLiteral = 1 + e.RealLiteral] = "StringLiteral", e[e.Infinity = 1 + e.StringLiteral] = "Infinity", e[e.NaN = 1 + e.Infinity] = "NaN", e[e.True = 1 + e.NaN] = "True", e[e.False = 1 + e.True] = "False", e[e.Typeof = 1 + e.False] = "Typeof", e[e.Null = 1 + e.Typeof] = "Null", e[e.Undefined = 1 + e.Null] = "Undefined", e[e.In = 1 + e.Undefined] = "In", e[e.Instanceof = 1 + e.In] = "Instanceof", e[e.Let = 1 + e.Instanceof] = "Let", e[e.Const = 1 + e.Let] = "Const", e[e.Var = 1 + e.Const] = "Var", e[e.If = 1 + e.Var] = "If", e[e.Else = 1 + e.If] = "Else", e[e.Return = 1 + e.Else] = "Return", e[e.Break = 1 + e.Return] = "Break", e[e.Continue = 1 + e.Break] = "Continue", e[e.Do = 1 + e.Continue] = "Do", e[e.While = 1 + e.Do] = "While", e[e.For = 1 + e.While] = "For", e[e.Of = 1 + e.For] = "Of", e[e.Try = 1 + e.Of] = "Try", e[e.Catch = 1 + e.Try] = "Catch", e[e.Finally = 1 + e.Catch] = "Finally", e[e.Throw = 1 + e.Finally] = "Throw", e[e.Switch = 1 + e.Throw] = "Switch", e[e.Case = 1 + e.Switch] = "Case", e[e.Default = 1 + e.Case] = "Default", e[e.Delete = 1 + e.Default] = "Delete", e[e.Function = 1 + e.Delete] = "Function", e[e.New = 1 + e.Function] = "New", e[e.As = 1 + e.New] = "As", e[e.Import = 1 + e.As] = "Import", e[e.From = 1 + e.Import] = "From", e;
}({}), K = /* @__PURE__ */ function(e) {
	return e[e.Start = 0] = "Start", e[e.InWhiteSpace = 1 + e.Start] = "InWhiteSpace", e[e.InlineCommentTrail = 1 + e.InWhiteSpace] = "InlineCommentTrail", e[e.BlockCommentTrail1 = 1 + e.InlineCommentTrail] = "BlockCommentTrail1", e[e.BlockCommentTrail2 = 1 + e.BlockCommentTrail1] = "BlockCommentTrail2", e[e.Slash = 1 + e.BlockCommentTrail2] = "Slash", e[e.Dollar = 1 + e.Slash] = "Dollar", e[e.Or = 1 + e.Dollar] = "Or", e[e.Asterisk = 1 + e.Or] = "Asterisk", e[e.Ampersand = 1 + e.Asterisk] = "Ampersand", e[e.Equal = 1 + e.Ampersand] = "Equal", e[e.DoubleEqual = 1 + e.Equal] = "DoubleEqual", e[e.NotEqual = 1 + e.DoubleEqual] = "NotEqual", e[e.Exclamation = 1 + e.NotEqual] = "Exclamation", e[e.AngleLeft = 1 + e.Exclamation] = "AngleLeft", e[e.AngleRight = 1 + e.AngleLeft] = "AngleRight", e[e.SignedShiftRight = 1 + e.AngleRight] = "SignedShiftRight", e[e.IdTail = 1 + e.SignedShiftRight] = "IdTail", e[e.Dot = 1 + e.IdTail] = "Dot", e[e.DotDot = 1 + e.Dot] = "DotDot", e[e.Zero = 1 + e.DotDot] = "Zero", e[e.QuestionMark = 1 + e.Zero] = "QuestionMark", e[e.HexaFirst = 1 + e.QuestionMark] = "HexaFirst", e[e.HexaTail = 1 + e.HexaFirst] = "HexaTail", e[e.BinaryFirst = 1 + e.HexaTail] = "BinaryFirst", e[e.BinaryTail = 1 + e.BinaryFirst] = "BinaryTail", e[e.DecimalOrReal = 1 + e.BinaryTail] = "DecimalOrReal", e[e.RealFractionalFirst = 1 + e.DecimalOrReal] = "RealFractionalFirst", e[e.RealFractionalTail = 1 + e.RealFractionalFirst] = "RealFractionalTail", e[e.RealExponent = 1 + e.RealFractionalTail] = "RealExponent", e[e.RealExponentSign = 1 + e.RealExponent] = "RealExponentSign", e[e.RealExponentTail = 1 + e.RealExponentSign] = "RealExponentTail", e[e.StringTemplateLiteralBackSlash = 1 + e.RealExponentTail] = "StringTemplateLiteralBackSlash", e[e.StringTemplateLiteral = 1 + e.StringTemplateLiteralBackSlash] = "StringTemplateLiteral", e[e.String = 1 + e.StringTemplateLiteral] = "String", e[e.StringBackSlash = 1 + e.String] = "StringBackSlash", e[e.StringHexa1 = 1 + e.StringBackSlash] = "StringHexa1", e[e.StringHexa2 = 1 + e.StringHexa1] = "StringHexa2", e[e.StringUHexa1 = 1 + e.StringHexa2] = "StringUHexa1", e[e.StringUHexa2 = 1 + e.StringUHexa1] = "StringUHexa2", e[e.StringUHexa3 = 1 + e.StringUHexa2] = "StringUHexa3", e[e.StringUHexa4 = 1 + e.StringUHexa3] = "StringUHexa4", e[e.StringUcp1 = 1 + e.StringUHexa4] = "StringUcp1", e[e.StringUcp2 = 1 + e.StringUcp1] = "StringUcp2", e[e.StringUcp3 = 1 + e.StringUcp2] = "StringUcp3", e[e.StringUcp4 = 1 + e.StringUcp3] = "StringUcp4", e[e.StringUcp5 = 1 + e.StringUcp4] = "StringUcp5", e[e.StringUcp6 = 1 + e.StringUcp5] = "StringUcp6", e[e.StringUcpTail = 1 + e.StringUcp6] = "StringUcpTail", e[e.Exponent = 1 + e.StringUcpTail] = "Exponent", e[e.Plus = 1 + e.Exponent] = "Plus", e[e.Minus = 1 + e.Plus] = "Minus", e[e.Divide = 1 + e.Minus] = "Divide", e[e.Remainder = 1 + e.Divide] = "Remainder", e[e.ShiftLeft = 1 + e.Remainder] = "ShiftLeft", e[e.ShiftRight = 1 + e.ShiftLeft] = "ShiftRight", e[e.LogicalAnd = 1 + e.ShiftRight] = "LogicalAnd", e[e.BitwiseXor = 1 + e.LogicalAnd] = "BitwiseXor", e[e.LogicalOr = 1 + e.BitwiseXor] = "LogicalOr", e[e.NullCoalesce = 1 + e.LogicalOr] = "NullCoalesce", e[e.RegEx = 1 + e.NullCoalesce] = "RegEx", e;
}(K || {}), de = class {
	constructor(e) {
		this.input = e, this._ahead = [], this._prefetched = null, this._prefetchedPos = null, this._prefetchedColumn = null, this._lastFetchPosition = 0, this._phaseExternallySet = null;
	}
	peek(e = !1) {
		return this.ahead(0, e);
	}
	ahead(e = 1, t = !1) {
		if (e > 16) throw Error("Cannot look ahead more than 16 tokens");
		for (; this._ahead.length <= e;) {
			let e = this.fetch();
			if (fe(e)) return e;
			(t || !t && !pe(e)) && this._ahead.push(e);
		}
		return this._ahead[e];
	}
	get(e = !1) {
		if (this._ahead.length > 0) {
			let e = this._ahead.shift();
			if (!e) throw Error("Token expected");
			return e;
		}
		for (;;) {
			let t = this.fetch();
			if (fe(t) || e || !e && !pe(t)) return t;
		}
	}
	getRegEx() {
		return this.fetchRegEx();
	}
	getTail() {
		return this._ahead.length > 0 ? this.input.getTail(this._ahead[0].startPosition) : this.input.getTail(this._lastFetchPosition);
	}
	setStartingPhaseToTemplateLiteral() {
		this._phaseExternallySet = K.StringTemplateLiteral;
	}
	fetchNextChar() {
		return this._prefetched ||= (this._prefetchedPos = this.input.position, this._prefetchedColumn = this.input.column, this.input.get()), this._prefetched;
	}
	fetch() {
		let e = this.input, t = this._prefetchedPos || e.position, n = e.line, r = this._prefetchedColumn || e.column;
		this._lastFetchPosition = this.input.position;
		let i = null, a = "", o = G.Eof, s = e.position, c = e.column, l = null, u = !1, d = () => {
			a += l, this._prefetched = null, this._prefetchedPos = null, this._prefetchedColumn = null, s = e.position, c = e.position;
		}, f = this.getStartingPhaseThenReset();
		for (;;) {
			if (l = this.fetchNextChar(), l === null) return p();
			o === G.Eof && (o = G.Unknown);
			phaseSwitch: switch (f) {
				case K.Start:
					switch (l) {
						case " ":
						case "	":
						case "\n":
						case "\r":
							f = K.InWhiteSpace, o = G.Ws;
							break;
						case "/":
							f = K.Slash, o = G.Divide;
							break;
						case "$":
							f = K.Dollar, o = G.Identifier;
							break;
						case "*":
							f = K.Asterisk, o = G.Multiply;
							break;
						case "%":
							f = K.Remainder, o = G.Remainder;
							break;
						case "+":
							f = K.Plus, o = G.Plus;
							break;
						case "-":
							f = K.Minus, o = G.Minus;
							break;
						case "^":
							f = K.BitwiseXor, o = G.BitwiseXor;
							break;
						case "|":
							f = K.Or, o = G.BitwiseOr;
							break;
						case "&":
							f = K.Ampersand, o = G.BitwiseAnd;
							break;
						case "?":
							f = K.QuestionMark, o = G.QuestionMark;
							break;
						case ";": return m(G.Semicolon);
						case ",": return m(G.Comma);
						case "(": return m(G.LParent);
						case ")": return m(G.RParent);
						case ":": return m(G.Colon);
						case "`": return m(G.Backtick);
						case "[": return m(G.LSquare);
						case "]": return m(G.RSquare);
						case "~": return m(G.BinaryNot);
						case "{": return m(G.LBrace);
						case "}": return m(G.RBrace);
						case "=":
							f = K.Equal, o = G.Assignment;
							break;
						case "!":
							f = K.Exclamation, o = G.LogicalNot;
							break;
						case "<":
							f = K.AngleLeft, o = G.LessThan;
							break;
						case ">":
							f = K.AngleRight, o = G.GreaterThan;
							break;
						case "0":
							f = K.Zero, o = G.DecimalLiteral;
							break;
						case ".":
							f = K.Dot, o = G.Dot;
							break;
						case "\"":
						case "'":
							i = l, f = K.String;
							break;
						default:
							me(l) ? (u = !0, f = K.IdTail, o = G.Identifier) : J(l) ? (f = K.DecimalOrReal, o = G.DecimalLiteral) : m(G.Unknown);
							break;
					}
					break;
				case K.InWhiteSpace:
					if (l !== " " && l !== "	" && l !== "\r" && l !== "\n") return p();
					break;
				case K.BlockCommentTrail1:
					l === "*" && (f = K.BlockCommentTrail2);
					break;
				case K.BlockCommentTrail2:
					if (l === "/") return m(G.BlockComment);
					break;
				case K.InlineCommentTrail:
					if (l === "\n") return m();
					break;
				case K.IdTail:
					if (!he(l)) return p();
					break;
				case K.Slash:
					if (l === "*") f = K.BlockCommentTrail1;
					else if (l === "/") f = K.InlineCommentTrail, o = G.EolComment;
					else if (l === "=") return m(G.DivideAssignment);
					else return p();
					break;
				case K.Plus: return l === "+" ? m(G.IncOp) : l === "=" ? m(G.AddAssignment) : p();
				case K.Minus: return l === "-" ? m(G.DecOp) : l === "=" ? m(G.SubtractAssignment) : p();
				case K.Remainder: return l === "=" ? m(G.RemainderAssignment) : p();
				case K.BitwiseXor: return l === "=" ? m(G.BitwiseXorAssignment) : p();
				case K.Or:
					if (l === "=") return m(G.BitwiseOrAssignment);
					if (l === "|") {
						f = K.LogicalOr, o = G.LogicalOr;
						break;
					}
					return p();
				case K.LogicalOr: return l === "=" ? m(G.LogicalOrAssignment) : p();
				case K.Ampersand:
					if (l === "=") return m(G.BitwiseAndAssignment);
					if (l === "&") {
						f = K.LogicalAnd, o = G.LogicalAnd;
						break;
					}
					return p();
				case K.LogicalAnd: return l === "=" ? m(G.LogicalAndAssignment) : p();
				case K.Asterisk:
					if (l === "*") {
						f = K.Exponent, o = G.Exponent;
						break;
					} else if (l === "=") return m(G.MultiplyAssignment);
					return p();
				case K.Exponent: return l === "=" ? m(G.ExponentAssignment) : p();
				case K.QuestionMark:
					if (l === "?") {
						f = K.NullCoalesce, o = G.NullCoalesce;
						break;
					}
					return l === "." ? m(G.OptionalChaining) : p();
				case K.NullCoalesce: return l === "=" ? m(G.NullCoalesceAssignment) : p();
				case K.Equal:
					if (l === ">") return m(G.Arrow);
					if (l === "=") {
						f = K.DoubleEqual, o = G.Equal;
						break;
					}
					return p();
				case K.DoubleEqual: return l === "=" ? m(G.StrictEqual) : p();
				case K.Exclamation:
					if (l === "=") {
						f = K.NotEqual, o = G.NotEqual;
						break;
					}
					return p();
				case K.NotEqual: return l === "=" ? m(G.StrictNotEqual) : p();
				case K.AngleLeft:
					if (l === "=") return m(G.LessThanOrEqual);
					if (l === "<") {
						f = K.ShiftLeft, o = G.ShiftLeft;
						break;
					}
					return p();
				case K.ShiftLeft: return l === "=" ? m(G.ShiftLeftAssignment) : p();
				case K.AngleRight:
					if (l === "=") return m(G.GreaterThanOrEqual);
					if (l === ">") {
						f = K.SignedShiftRight, o = G.SignedShiftRight;
						break;
					}
					return p();
				case K.SignedShiftRight:
					if (l === ">") {
						f = K.ShiftRight, o = G.ShiftRight;
						break;
					}
					return l === "=" ? m(G.SignedShiftRightAssignment) : p();
				case K.ShiftRight: return l === "=" ? m(G.ShiftRightAssignment) : p();
				case K.Zero:
					if (l === "x") f = K.HexaFirst, o = G.Unknown;
					else if (l === "b") f = K.BinaryFirst, o = G.Unknown;
					else if (J(l) || l === "_") f = K.DecimalOrReal;
					else if (l === ".") f = K.RealFractionalFirst, o = G.Unknown;
					else if (l === "e" || l === "E") f = K.RealExponent, o = G.Unknown;
					else return p();
					break;
				case K.Dot:
					if (l === ".") {
						f = K.DotDot, o = G.Unknown;
						break;
					}
					if (!J(l)) return p();
					f = K.RealFractionalTail, o = G.RealLiteral;
					break;
				case K.DotDot: return l === "." ? m(G.Spread) : p();
				case K.HexaFirst:
					if (l === "_") break;
					if (!Y(l)) return p();
					f = K.HexaTail, o = G.HexadecimalLiteral;
					break;
				case K.HexaTail:
					if (!Y(l) && l !== "_") return p();
					break;
				case K.BinaryFirst:
					if (l === "_") break;
					if (!ge(l)) return p();
					f = K.BinaryTail, o = G.BinaryLiteral;
					break;
				case K.BinaryTail:
					if (!ge(l) && l !== "_") return p();
					o = G.BinaryLiteral;
					break;
				case K.DecimalOrReal:
					if (J(l) || l === "_") break;
					if (l === "." && (this.input.peek() === null || J(this.input.peek()))) f = K.RealFractionalFirst, o = G.Unknown;
					else if (l === "e" || l === "E") f = K.RealExponent, o = G.Unknown;
					else return p();
					break;
				case K.RealFractionalFirst:
					if (J(l)) f = K.RealFractionalTail, o = G.RealLiteral;
					else if (l === "e" || l === "E") f = K.RealExponent;
					else return p();
					break;
				case K.RealFractionalTail:
					if (l === "e" || l === "E") f = K.RealExponent, o = G.Unknown;
					else if (!J(l) && l !== "_") return p();
					break;
				case K.RealExponent:
					if (l === "+" || l === "-") f = K.RealExponentSign;
					else if (J(l)) f = K.RealExponentTail, o = G.RealLiteral;
					else return p();
					break;
				case K.RealExponentSign:
					if (J(l)) f = K.RealExponentTail, o = G.RealLiteral;
					else return p();
					break;
				case K.RealExponentTail:
					if (!J(l)) return p();
					break;
				case K.Dollar:
					if (l === "{") return m(G.DollarLBrace);
					f = K.IdTail, u = !0, o = G.Identifier, he(l) || p();
					break;
				case K.StringTemplateLiteralBackSlash: {
					f = K.StringTemplateLiteral;
					let e = this.input.ahead(0), t = this.input.ahead(1);
					if (e === "`" || e === "$" && t === "{") return m(G.StringLiteral);
					break;
				}
				case K.StringTemplateLiteral:
					switch (l) {
						case "\\":
							f = K.StringTemplateLiteralBackSlash, o = G.Unknown;
							break phaseSwitch;
						case "`": return m(G.Backtick);
						case "$": if (this.input.ahead(0) === "{") return d(), this.fetchNextChar(), m(G.DollarLBrace);
					}
					let e = this.input.ahead(0), t = this.input.ahead(1);
					if (e === "`" || e === "$" && t === "{") return m(G.StringLiteral);
					break;
				case K.String:
					if (l === i) return m(G.StringLiteral);
					if (_e(l)) return m(G.Unknown);
					l === "\\" && (f = K.StringBackSlash, o = G.Unknown);
					break;
				case K.StringBackSlash:
					switch (l) {
						case "b":
						case "f":
						case "n":
						case "r":
						case "t":
						case "v":
						case "S":
						case "0":
						case "'":
						case "\"":
						case "`":
						case "\\":
							f = K.String;
							break;
						case "x":
							f = K.StringHexa1;
							break;
						case "u":
							f = K.StringUHexa1;
							break;
						default:
							f = K.String;
							break;
					}
					break;
				case K.StringHexa1:
					if (Y(l)) f = K.StringHexa2;
					else return m(G.Unknown);
					break;
				case K.StringHexa2:
					if (Y(l)) f = K.String;
					else return m(G.Unknown);
					break;
				case K.StringUHexa1:
					if (l === "{") {
						f = K.StringUcp1;
						break;
					}
					if (Y(l)) f = K.StringUHexa2;
					else return m(G.Unknown);
					break;
				case K.StringUHexa2:
					if (Y(l)) f = K.StringUHexa3;
					else return m(G.Unknown);
					break;
				case K.StringUHexa3:
					if (Y(l)) f = K.StringUHexa4;
					else return m(G.Unknown);
					break;
				case K.StringUHexa4:
					if (Y(l)) f = K.String;
					else return m(G.Unknown);
					break;
				case K.StringUcp1:
					if (Y(l)) f = K.StringUcp2;
					else return m(G.Unknown);
					break;
				case K.StringUcp2:
					if (l === "}") f = K.String;
					else if (Y(l)) f = K.StringUcp3;
					else return m(G.Unknown);
					break;
				case K.StringUcp3:
					if (l === "}") f = K.String;
					else if (Y(l)) f = K.StringUcp4;
					else return m(G.Unknown);
					break;
				case K.StringUcp4:
					if (l === "}") f = K.String;
					else if (Y(l)) f = K.StringUcp5;
					else return m(G.Unknown);
					break;
				case K.StringUcp5:
					if (l === "}") f = K.String;
					else if (Y(l)) f = K.StringUcp6;
					else return m(G.Unknown);
					break;
				case K.StringUcp6:
					if (l === "}") f = K.String;
					else if (Y(l)) f = K.StringUcpTail;
					else return m(G.Unknown);
					break;
				case K.StringUcpTail:
					if (l === "}") f = K.String;
					else return m(G.Unknown);
					break;
				default: return p();
			}
			d();
		}
		function p() {
			return u && (o = q.get(a) ?? (me(a[0]) && a[a.length - 1] !== "'" ? G.Identifier : G.Unknown)), {
				text: a,
				type: o,
				startPosition: t,
				endPosition: s,
				startLine: n,
				endLine: n,
				startColumn: r,
				endColumn: c
			};
		}
		function m(e) {
			return d(), e !== void 0 && (o = e), p();
		}
	}
	getStartingPhaseThenReset() {
		if (this._phaseExternallySet !== null) {
			let e = this._phaseExternallySet;
			return this._phaseExternallySet = null, e;
		}
		return K.Start;
	}
	fetchRegEx() {
		let e = this._ahead.length > 0 ? this._ahead[0].startPosition : this._lastFetchPosition, n = this.input.getTail(e);
		try {
			let e = t(n), r = e.raw;
			for (let e = 1; e < r.length; e++) this.fetchNextChar(), this._prefetched = null, this._prefetchedPos = null, this._prefetchedColumn = null;
			return this._ahead.length = 0, {
				success: !0,
				pattern: e.pattern.raw,
				flags: e.flags.raw,
				length: r.length
			};
		} catch (e) {
			let r = e.index;
			if (e.toString().includes("Invalid flag")) for (; r < n.length && "dgimsuy".includes(n[r]);) r++;
			if (r === void 0) return {
				success: !1,
				pattern: n[0]
			};
			let i = n.substring(0, r);
			try {
				let e = t(i), n = e.raw;
				for (let e = 1; e < n.length; e++) this.fetchNextChar(), this._prefetched = null, this._prefetchedPos = null, this._prefetchedColumn = null;
				return this._ahead.length = 0, {
					success: !0,
					pattern: e.pattern.raw,
					flags: e.flags.raw,
					length: n.length
				};
			} catch {
				return {
					success: !1,
					pattern: i
				};
			}
		}
	}
}, q = /* @__PURE__ */ new Map();
q.set("typeof", G.Typeof), q.set("Infinity", G.Infinity), q.set("NaN", G.NaN), q.set("true", G.True), q.set("false", G.False), q.set("undefined", G.Undefined), q.set("null", G.Null), q.set("in", G.In), q.set("instanceof", G.Instanceof), q.set("let", G.Let), q.set("const", G.Const), q.set("var", G.Var), q.set("if", G.If), q.set("else", G.Else), q.set("return", G.Return), q.set("break", G.Break), q.set("continue", G.Continue), q.set("do", G.Do), q.set("while", G.While), q.set("for", G.For), q.set("of", G.Of), q.set("try", G.Try), q.set("catch", G.Catch), q.set("finally", G.Finally), q.set("throw", G.Throw), q.set("switch", G.Switch), q.set("case", G.Case), q.set("default", G.Default), q.set("delete", G.Delete), q.set("function", G.Function), q.set("new", G.New), q.set("as", G.As), q.set("import", G.Import), q.set("from", G.From);
function fe(e) {
	return e.type === G.Eof;
}
function pe(e) {
	return e.type <= G.Ws;
}
function me(e) {
	return e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e === "_" || e === "$";
}
function he(e) {
	return e >= "a" && e <= "z" || e >= "A" && e <= "Z" || e >= "0" && e <= "9" || e === "_" || e === "$";
}
function ge(e) {
	return e === "0" || e === "1";
}
function J(e) {
	return e >= "0" && e <= "9";
}
function Y(e) {
	return e >= "0" && e <= "9" || e >= "A" && e <= "F" || e >= "a" && e <= "f";
}
function _e(e) {
	return e === "\r" || e === "\n" || e === "" || e === "\u2028" || e === "\u2029";
}
//#endregion
//#region src/parsers/scripting/ParserError.ts
var ve = class e extends Error {
	constructor(t, n) {
		super(t), this.code = n, Object.setPrototypeOf(this, e.prototype);
	}
}, X = {
	expressionExpected: "W001",
	unexpectedToken: "W002",
	identifierExpected: "W003",
	closeBraceExpected: "W004",
	closeBracketExpected: "W005",
	closeParenExpected: "W006",
	invalidPropName: "W007",
	colonExpected: "W008",
	equalExpected: "W009",
	invalidArgList: "W010",
	forLoopVarRequired: "W011",
	openBraceExpected: "W012",
	catchOrFinallyExpected: "W013",
	openParenExpected: "W014",
	caseOrDefaultExpected: "W015",
	defaultCaseOnce: "W016",
	invalidSequence: "W017",
	invalidObjLiteral: "W018",
	alreadyImported: "W019",
	funcAlreadyDefined: "W020",
	alreadyExported: "W021",
	moduleNotFound: "W022",
	exportNotFound: "W023",
	functionExpected: "W024",
	fromExpected: "W025",
	stringLiteralExpected: "W026",
	varInImportedModule: "W027",
	invalidModuleStatement: "W028",
	moduleOnlyExports: "W029",
	nestedExport: "W030",
	dollarIdentifier: "W031",
	openBraceImportExpected: "W032",
	identifierInImportExpected: "W033",
	identifierAfterAsExpected: "W034",
	commaOrCloseBraceExpected: "W035",
	importFromExpected: "W036",
	importPathExpected: "W037",
	importNotAtTop: "W040",
	importedFunctionNotFound: "W039",
	circularImport: "W041",
	circularImportDetailed: "W042",
	reactiveVarInImportedModule: "W043",
	constLetInImportedModule: "W044",
	invalidStatementInImportedModule: "W045",
	debuggerNotAllowed: "W046"
}, ye = {
	[X.expressionExpected]: "An expression expected",
	[X.unexpectedToken]: "Unexpected token: {0}",
	[X.identifierExpected]: "An identifier expected",
	[X.closeBraceExpected]: "'}' expected",
	[X.closeBracketExpected]: "']' expected",
	[X.closeParenExpected]: "')' expected",
	[X.invalidPropName]: "Invalid object property name type",
	[X.colonExpected]: "':' expected",
	[X.equalExpected]: "'=' expected",
	[X.invalidArgList]: "Invalid argument list",
	[X.forLoopVarRequired]: "For loop variable must be initialized",
	[X.openBraceExpected]: "'{' expected",
	[X.catchOrFinallyExpected]: "'catch' or 'finally' expected",
	[X.openParenExpected]: "'(' or expected",
	[X.caseOrDefaultExpected]: "'case' or 'default' expected",
	[X.defaultCaseOnce]: "'default' case can be used only once within a switch statement",
	[X.invalidSequence]: "Invalid sequence expression",
	[X.invalidObjLiteral]: "Invalid object literal",
	[X.alreadyImported]: "Identifier '{0}' is already imported",
	[X.funcAlreadyDefined]: "Function '{0}' is already defined in the module",
	[X.alreadyExported]: "'{0}' is already exported from the module",
	[X.moduleNotFound]: "Cannot find module '{0}'",
	[X.exportNotFound]: "Module '{0}' does not export '{1}'",
	[X.functionExpected]: "'function' expected",
	[X.fromExpected]: "'from' expected",
	[X.stringLiteralExpected]: "A string literal expected",
	[X.varInImportedModule]: "Cannot declare var ('{0}') in an imported module",
	[X.invalidModuleStatement]: "Invalid statement used in a module.",
	[X.moduleOnlyExports]: "An imported module can contain only exported functions",
	[X.nestedExport]: "Nested declarations cannot be exported",
	[X.dollarIdentifier]: "An identifier in a declaration cannot start with '$'",
	[X.openBraceImportExpected]: "'{' expected in import statement",
	[X.identifierInImportExpected]: "Identifier expected in import specifier",
	[X.identifierAfterAsExpected]: "Identifier expected after 'as'",
	[X.commaOrCloseBraceExpected]: "',' or '}' expected in import statement",
	[X.importFromExpected]: "'from' expected in import statement",
	[X.importPathExpected]: "String literal expected for import path",
	[X.importNotAtTop]: "Import statements must appear at the top of the file, before any other statements",
	[X.importedFunctionNotFound]: "Module '{0}' does not export '{1}'",
	[X.circularImport]: "Circular import detected: {0}",
	[X.circularImportDetailed]: "Circular import chain: {0}",
	[X.reactiveVarInImportedModule]: "Reactive variable declarations are not allowed in imported modules. Found: '{0}'",
	[X.constLetInImportedModule]: "const/let variable declarations are not allowed in imported modules. Found: '{0}'",
	[X.invalidStatementInImportedModule]: "Only function declarations are allowed in imported modules. Found: {0}",
	[X.debuggerNotAllowed]: "'debugger' is not allowed in XMLUI expressions"
}, Z = {
	[G.Eof]: {},
	[G.Ws]: {},
	[G.DollarLBrace]: {},
	[G.Backtick]: { expressionStart: !0 },
	[G.BlockComment]: {},
	[G.EolComment]: {},
	[G.Unknown]: {},
	[G.LParent]: { expressionStart: !0 },
	[G.RParent]: {},
	[G.Identifier]: {
		expressionStart: !0,
		keywordLike: !0,
		isPropLiteral: !0
	},
	[G.Exponent]: {},
	[G.Divide]: {},
	[G.Multiply]: {},
	[G.Remainder]: {},
	[G.Plus]: {
		expressionStart: !0,
		canBeUnary: !0
	},
	[G.Minus]: {
		expressionStart: !0,
		canBeUnary: !0
	},
	[G.BitwiseXor]: {},
	[G.BitwiseOr]: {},
	[G.LogicalOr]: {},
	[G.BitwiseAnd]: {},
	[G.LogicalAnd]: {},
	[G.Assignment]: { isAssignment: !0 },
	[G.AddAssignment]: { isAssignment: !0 },
	[G.SubtractAssignment]: { isAssignment: !0 },
	[G.ExponentAssignment]: { isAssignment: !0 },
	[G.MultiplyAssignment]: { isAssignment: !0 },
	[G.DivideAssignment]: { isAssignment: !0 },
	[G.RemainderAssignment]: { isAssignment: !0 },
	[G.ShiftLeftAssignment]: { isAssignment: !0 },
	[G.ShiftRightAssignment]: { isAssignment: !0 },
	[G.SignedShiftRightAssignment]: { isAssignment: !0 },
	[G.BitwiseAndAssignment]: { isAssignment: !0 },
	[G.BitwiseXorAssignment]: { isAssignment: !0 },
	[G.BitwiseOrAssignment]: { isAssignment: !0 },
	[G.LogicalAndAssignment]: { isAssignment: !0 },
	[G.LogicalOrAssignment]: { isAssignment: !0 },
	[G.NullCoalesceAssignment]: { isAssignment: !0 },
	[G.Semicolon]: {},
	[G.Comma]: {},
	[G.Colon]: {},
	[G.LSquare]: { expressionStart: !0 },
	[G.RSquare]: {},
	[G.QuestionMark]: {},
	[G.NullCoalesce]: {},
	[G.OptionalChaining]: {},
	[G.BinaryNot]: {
		expressionStart: !0,
		canBeUnary: !0
	},
	[G.LBrace]: { expressionStart: !0 },
	[G.RBrace]: {},
	[G.Equal]: {},
	[G.StrictEqual]: {},
	[G.LogicalNot]: {
		expressionStart: !0,
		canBeUnary: !0
	},
	[G.NotEqual]: {},
	[G.StrictNotEqual]: {},
	[G.LessThan]: {},
	[G.LessThanOrEqual]: {},
	[G.ShiftLeft]: {},
	[G.GreaterThan]: {},
	[G.GreaterThanOrEqual]: {},
	[G.ShiftRight]: {},
	[G.SignedShiftRight]: {},
	[G.Dot]: {},
	[G.Spread]: {
		expressionStart: !0,
		isPropLiteral: !0
	},
	[G.DecimalLiteral]: {
		expressionStart: !0,
		isPropLiteral: !0
	},
	[G.HexadecimalLiteral]: {
		expressionStart: !0,
		isPropLiteral: !0
	},
	[G.BinaryLiteral]: {
		expressionStart: !0,
		isPropLiteral: !0
	},
	[G.RealLiteral]: {
		expressionStart: !0,
		isPropLiteral: !0
	},
	[G.StringLiteral]: {
		expressionStart: !0,
		isPropLiteral: !0
	},
	[G.IncOp]: { expressionStart: !0 },
	[G.DecOp]: { expressionStart: !0 },
	[G.Infinity]: {
		expressionStart: !0,
		keywordLike: !0
	},
	[G.NaN]: {
		expressionStart: !0,
		keywordLike: !0
	},
	[G.True]: {
		expressionStart: !0,
		keywordLike: !0,
		isPropLiteral: !0
	},
	[G.False]: {
		expressionStart: !0,
		keywordLike: !0,
		isPropLiteral: !0
	},
	[G.Typeof]: {
		expressionStart: !0,
		canBeUnary: !0,
		keywordLike: !0
	},
	[G.Null]: {
		expressionStart: !0,
		keywordLike: !0
	},
	[G.Undefined]: {
		expressionStart: !0,
		keywordLike: !0
	},
	[G.In]: { keywordLike: !0 },
	[G.Instanceof]: { keywordLike: !0 },
	[G.Let]: { keywordLike: !0 },
	[G.Const]: { keywordLike: !0 },
	[G.Var]: { keywordLike: !0 },
	[G.If]: { keywordLike: !0 },
	[G.Else]: { keywordLike: !0 },
	[G.Arrow]: { keywordLike: !0 },
	[G.Return]: { keywordLike: !0 },
	[G.Break]: { keywordLike: !0 },
	[G.Continue]: { keywordLike: !0 },
	[G.Do]: { keywordLike: !0 },
	[G.While]: { keywordLike: !0 },
	[G.For]: { keywordLike: !0 },
	[G.Of]: { keywordLike: !0 },
	[G.Throw]: { keywordLike: !0 },
	[G.Try]: { keywordLike: !0 },
	[G.Catch]: { keywordLike: !0 },
	[G.Finally]: { keywordLike: !0 },
	[G.Switch]: { keywordLike: !0 },
	[G.Case]: { keywordLike: !0 },
	[G.Default]: { keywordLike: !0 },
	[G.Delete]: {
		expressionStart: !0,
		canBeUnary: !0,
		keywordLike: !0
	},
	[G.Function]: {
		keywordLike: !0,
		expressionStart: !0
	},
	[G.New]: {
		keywordLike: !0,
		expressionStart: !0
	},
	[G.As]: { keywordLike: !0 },
	[G.Import]: { keywordLike: !0 },
	[G.From]: { keywordLike: !0 }
}, Q = /* @__PURE__ */ function(e) {
	return e[e.Normal = 0] = "Normal", e[e.Backslash = 1] = "Backslash", e[e.X = 2] = "X", e[e.Xh = 3] = "Xh", e[e.UX1 = 4] = "UX1", e[e.UX2 = 5] = "UX2", e[e.UX3 = 6] = "UX3", e[e.UX4 = 7] = "UX4", e[e.Ucp1 = 8] = "Ucp1", e[e.Ucp2 = 9] = "Ucp2", e[e.Ucp3 = 10] = "Ucp3", e[e.Ucp4 = 11] = "Ucp4", e[e.Ucp5 = 12] = "Ucp5", e[e.Ucp6 = 13] = "Ucp6", e[e.UcpTail = 14] = "UcpTail", e;
}(Q || {}), be = 0;
function $() {
	return ++be;
}
var xe = class {
	constructor(e) {
		this._parseErrors = [], this._statementLevel = 0, this._hasNonImportStatement = !1, this._destrCounter = 0, this._lexer = new de(new W(e ?? ""));
	}
	setSource(e) {
		this._lexer = new de(new W(e)), this._hasNonImportStatement = !1;
	}
	get errors() {
		return this._parseErrors;
	}
	get current() {
		return this._lexer.peek();
	}
	get isEof() {
		return this._lexer.peek().type === G.Eof;
	}
	getTail() {
		return this._lexer.getTail();
	}
	parseStatements() {
		this._statementLevel = 0, this._hasNonImportStatement = !1;
		let e = [];
		for (; !this.isEof;) {
			let t = this.parseStatement();
			if (!t) return null;
			e.push(t), t.type !== s && this.skipToken(G.Semicolon);
		}
		return e;
	}
	parseStatement(e = !0) {
		this._statementLevel++;
		try {
			let t = this._lexer.peek();
			switch (t.type) {
				case G.Import: return this._hasNonImportStatement ? (this.reportError("W040", t), null) : this.parseImportStatement();
				case G.Semicolon: return this.parseEmptyStatement();
				case G.Let: return this._hasNonImportStatement = !0, this.parseLetStatement();
				case G.Const: return this._hasNonImportStatement = !0, this.parseConstStatement();
				case G.Var: return this._hasNonImportStatement = !0, this.parseVarStatement();
				case G.LBrace: return this._hasNonImportStatement = !0, this.parseBlockStatement();
				case G.If: return this._hasNonImportStatement = !0, this.parseIfStatement();
				case G.Do: return this._hasNonImportStatement = !0, this.parseDoWhileStatement();
				case G.While: return this._hasNonImportStatement = !0, this.parseWhileStatement();
				case G.Return: return this._hasNonImportStatement = !0, this.parseReturnStatement();
				case G.Break: return this._hasNonImportStatement = !0, this._lexer.get(), this.createStatementNode(ee, {}, t, t);
				case G.Continue: return this._hasNonImportStatement = !0, this._lexer.get(), this.createStatementNode(te, {}, t, t);
				case G.For: return this._hasNonImportStatement = !0, this.parseForStatement();
				case G.Throw: return this._hasNonImportStatement = !0, this.parseThrowStatement();
				case G.Try: return this._hasNonImportStatement = !0, this.parseTryStatement();
				case G.Switch: return this._hasNonImportStatement = !0, this.parseSwitchStatement();
				case G.Function: return this._hasNonImportStatement = !0, this.parseFunctionDeclaration();
				default:
					if (t.type === G.Identifier && t.text === "debugger") return this._hasNonImportStatement = !0, this._lexer.get(), this.reportError("W046", t), null;
					if (t.type === G.Identifier && t.text === "async") {
						let e = this._lexer.ahead(1);
						if (e && e.type === G.Function) return this._hasNonImportStatement = !0, this.parseFunctionDeclaration(!1, !0);
					}
					return this.isExpressionStart(t) ? (this._hasNonImportStatement = !0, this.parseExpressionStatement(e)) : (this.reportError("W002", t, t.text), null);
			}
		} finally {
			this._statementLevel--;
		}
	}
	parseEmptyStatement() {
		let e = this._lexer.get();
		return this.createStatementNode(s, {}, e, e);
	}
	parseExpressionStatement(e = !0) {
		let t = this._lexer.peek(), n = this.getExpression(e);
		return n ? this.createStatementNode(c, { expr: n }, t, n.endToken) : null;
	}
	parseLetStatement() {
		let e = this._lexer.get(), t = e, n = [];
		for (;;) {
			let e = this._lexer.peek(), r = {};
			if (e.type === G.LBrace) {
				t = this._lexer.ahead(1);
				let e = this.parseObjectDestructure();
				if (e === null) return null;
				r = { oDestr: e }, t = e.length > 0 ? e[e.length - 1].endToken : t;
			} else if (e.type === G.LSquare) {
				t = this._lexer.ahead(1);
				let e = this.parseArrayDestructure();
				if (e === null) return null;
				r = { aDestr: e }, t = e.length > 0 ? e[e.length - 1].endToken : t;
			} else if (e.type === G.Identifier) {
				if (e.text.startsWith("$")) return this.reportError("W031"), null;
				t = this._lexer.get(), r = { id: e.text };
			} else return this.reportError("W003"), null;
			let i = this._lexer.peek(), a = null;
			if (i.type === G.Assignment) {
				if (this._lexer.get(), a = this.getExpression(!1), a === null) return null;
				r.expr = a, t = a.endToken;
			} else if (r.aDestr || r.oDestr) return this.reportError("W009", i), null;
			if (n.push(this.createExpressionNode(B, r, e, t)), this._lexer.peek().type !== G.Comma) break;
			this._lexer.get();
		}
		return this.createStatementNode(u, { decls: n }, e, t);
	}
	parseConstStatement() {
		let e = this._lexer.get(), t = e, n = [];
		for (;;) {
			let e = this._lexer.peek(), r = {};
			if (e.type === G.LBrace) {
				t = this._lexer.ahead(1);
				let e = this.parseObjectDestructure();
				if (e === null) return null;
				r = { oDestr: e }, t = e.length > 0 ? e[e.length - 1].endToken : t;
			} else if (e.type === G.LSquare) {
				t = this._lexer.ahead(1);
				let e = this.parseArrayDestructure();
				if (e === null) return null;
				r = { aDestr: e }, t = e.length > 0 ? e[e.length - 1].endToken : t;
			} else if (e.type === G.Identifier) {
				if (e.text.startsWith("$")) return this.reportError("W031"), null;
				t = this._lexer.get(), r = { id: e.text };
			} else return this.reportError("W003"), null;
			this.expectToken(G.Assignment);
			let i = this.getExpression(!1);
			if (i === null) return null;
			if (r.expr = i, t = i.endToken, n.push(this.createExpressionNode(B, r, e, t)), this._lexer.peek().type !== G.Comma) break;
			this._lexer.get();
		}
		return this.createStatementNode(d, { decls: n }, e, t);
	}
	parseVarStatement() {
		let e = this._lexer.get(), t = e, n = [];
		for (;;) {
			let e = this._lexer.peek(), r = {};
			if (e.type === G.LBrace) {
				t = this._lexer.ahead(1);
				let r = this.parseObjectDestructure();
				if (r === null) return null;
				t = r.length > 0 ? r[r.length - 1].endToken : t, this.expectToken(G.Assignment);
				let i = this.getExpression(!1);
				if (i === null) return null;
				t = i.endToken, this.expandObjectDestructureToReactiveVars(r, i, n, e, t);
			} else if (e.type === G.LSquare) {
				t = this._lexer.ahead(1);
				let r = this.parseArrayDestructure();
				if (r === null) return null;
				t = r.length > 0 ? r[r.length - 1].endToken : t, this.expectToken(G.Assignment);
				let i = this.getExpression(!1);
				if (i === null) return null;
				t = i.endToken, this.expandArrayDestructureToReactiveVars(r, i, n, e, t);
			} else if (e.type === G.Identifier) {
				if (e.text.startsWith("$")) return this.reportError("W031"), null;
				t = this._lexer.get(), r = { id: {
					type: O,
					name: e.text,
					startToken: e,
					endToken: t
				} }, this.expectToken(G.Assignment);
				let i = this.getExpression(!1);
				if (i === null) return null;
				r.expr = i, t = i.endToken, n.push(this.createExpressionNode(L, r, e, t));
			} else return this.reportError("W003"), null;
			if (this._lexer.peek().type !== G.Comma) break;
			this._lexer.get();
		}
		return this.createStatementNode(f, { decls: n }, e, t);
	}
	expandObjectDestructureToReactiveVars(e, t, n, r, i) {
		let a = `__destr_${++this._destrCounter}`, o = this.createExpressionNode(O, { name: a }, r, i);
		n.push(this.createExpressionNode(L, {
			id: o,
			expr: t
		}, r, i));
		for (let t of e) {
			let e = this.createExpressionNode(E, {
				obj: this.createExpressionNode(O, { name: a }, r, i),
				member: t.id
			}, r, i);
			if (t.oDestr) this.expandObjectDestructureToReactiveVars(t.oDestr, e, n, r, i);
			else if (t.aDestr) this.expandArrayDestructureToReactiveVars(t.aDestr, e, n, r, i);
			else {
				let a = t.alias || t.id, o = this.createExpressionNode(O, { name: a }, r, i);
				n.push(this.createExpressionNode(L, {
					id: o,
					expr: e
				}, r, i));
			}
		}
	}
	expandArrayDestructureToReactiveVars(e, t, n, r, i) {
		let a = `__destr_${++this._destrCounter}`, o = this.createExpressionNode(O, { name: a }, r, i);
		n.push(this.createExpressionNode(L, {
			id: o,
			expr: t
		}, r, i));
		for (let t = 0; t < e.length; t++) {
			let o = e[t];
			if (!o.id && !o.oDestr && !o.aDestr) continue;
			let s = this.createExpressionNode(D, {
				obj: this.createExpressionNode(O, { name: a }, r, i),
				member: this.createExpressionNode(k, { value: t }, r, i)
			}, r, i);
			if (o.oDestr) this.expandObjectDestructureToReactiveVars(o.oDestr, s, n, r, i);
			else if (o.aDestr) this.expandArrayDestructureToReactiveVars(o.aDestr, s, n, r, i);
			else {
				let e = this.createExpressionNode(O, { name: o.id }, r, i);
				n.push(this.createExpressionNode(L, {
					id: e,
					expr: s
				}, r, i));
			}
		}
	}
	parseObjectDestructure() {
		let e = [], t = this._lexer.get(), n = t, r = this._lexer.peek();
		for (; r.type === G.Identifier;) {
			let i = r.text;
			if (i.startsWith("$")) return this.reportError("W031"), null;
			let a, o, s;
			if (this._lexer.get(), r = this._lexer.peek(), r.type === G.Colon) {
				if (this._lexer.get(), r = this._lexer.peek(), r.type === G.Identifier) a = r.text, n = r, this._lexer.get();
				else if (r.type === G.LSquare) {
					if (o = this.parseArrayDestructure(), o === null) return null;
					n = o[o.length - 1].endToken;
				} else if (r.type === G.LBrace) {
					if (s = this.parseObjectDestructure(), s === null) return null;
					n = s[s.length - 1].endToken;
				}
			}
			r = this._lexer.peek(), (r.type === G.Comma || r.type === G.RBrace) && (e.push(this.createExpressionNode(U, {
				id: i,
				alias: a,
				aDestr: o,
				oDestr: s
			}, t, n)), r.type === G.Comma && (this._lexer.get(), r = this._lexer.peek()));
		}
		return this.expectToken(G.RBrace, "W004"), e;
	}
	parseArrayDestructure() {
		let e = [], t = this._lexer.get(), n = t;
		do {
			let r = this._lexer.peek(), i, a, o;
			if (r.type === G.Identifier) {
				if (i = r.text, i.startsWith("$")) return this.reportError("W031"), null;
				n = r, r = this._lexer.get();
			} else if (r.type === G.LSquare) {
				if (a = this.parseArrayDestructure(), a === null) return null;
				n = a[a.length - 1].endToken;
			} else if (r.type === G.LBrace) {
				if (o = this.parseObjectDestructure(), o === null) return null;
				n = o[o.length - 1].endToken;
			}
			if (r = this._lexer.peek(), r.type === G.Comma) e.push(this.createExpressionNode(H, {
				id: i,
				aDestr: a,
				oDestr: o
			}, t, n)), this._lexer.get();
			else if (r.type === G.RSquare) {
				(i || a || o) && e.push(this.createExpressionNode(H, {
					id: i,
					aDestr: a,
					oDestr: o
				}, t, n));
				break;
			} else return this.reportError("W002", r), null;
		} while (!0);
		return this.expectToken(G.RSquare, "W005"), e;
	}
	parseBlockStatement() {
		let e = this._lexer.get(), t = [];
		for (; this._lexer.peek().type !== G.RBrace;) {
			let e = this.parseStatement();
			if (!e) return null;
			t.push(e), e.type !== s && this.skipToken(G.Semicolon);
		}
		let n = this._lexer.get();
		return this.createStatementNode(o, { stmts: t }, e, n);
	}
	parseIfStatement() {
		let e = this._lexer.get(), t = e;
		this.expectToken(G.LParent, "W014");
		let n = this.getExpression();
		if (!n) return null;
		this.expectToken(G.RParent, "W006");
		let r = this.parseStatement();
		if (!r) return null;
		t = r.endToken;
		let i = !0;
		r.type !== o && (this._lexer.peek().type === G.Semicolon ? this._lexer.get() : i = !1);
		let a = null;
		if (i && this._lexer.peek().type === G.Else) {
			if (this._lexer.get(), a = this.parseStatement(), !a) return null;
			t = a.endToken;
		}
		return this.createStatementNode(p, {
			cond: n,
			thenB: r,
			elseB: a
		}, e, t);
	}
	parseWhileStatement() {
		let e = this._lexer.get();
		this.expectToken(G.LParent, "W014");
		let t = this.getExpression();
		if (!t) return null;
		this.expectToken(G.RParent, "W006");
		let n = this.parseStatement();
		return n ? this.createStatementNode(h, {
			cond: t,
			body: n
		}, e, n.endToken) : null;
	}
	parseDoWhileStatement() {
		let e = this._lexer.get(), t = this.parseStatement();
		if (!t) return null;
		t.type !== o && t.type !== s && this.expectToken(G.Semicolon), this.expectToken(G.While), this.expectToken(G.LParent, "W014");
		let n = this.getExpression();
		if (!n) return null;
		let r = this._lexer.peek();
		return this.expectToken(G.RParent, "W006"), this.createStatementNode(g, {
			cond: n,
			body: t
		}, e, r);
	}
	parseReturnStatement() {
		let e = this._lexer.peek(), t = this._lexer.get(), n;
		if (Z[this._lexer.peek().type].expressionStart) {
			if (n = this.getExpression(), n === null) return null;
			t = n.endToken;
		}
		return this.createStatementNode(m, { expr: n }, e, t);
	}
	parseForStatement() {
		let e = this._lexer.peek();
		this._lexer.get(), this.expectToken(G.LParent, "W014");
		let t = this._lexer.peek();
		if (t.type === G.Identifier) {
			if (this._lexer.ahead(1).type === G.In) return this.parseForInOfStatement(e, "none", t, _);
			if (this._lexer.ahead(1).type === G.Of) return this.parseForInOfStatement(e, "none", t, v);
		} else if (t.type === G.Let) {
			let t = this._lexer.ahead(1);
			if (t.type === G.Identifier) {
				let n = this._lexer.ahead(2);
				if (n.type === G.In) return this.parseForInOfStatement(e, "let", t, _);
				if (n.type === G.Of) return this.parseForInOfStatement(e, "let", t, v);
			}
		} else if (t.type === G.Const) {
			let t = this._lexer.ahead(1);
			if (t.type === G.Identifier) {
				let n = this._lexer.ahead(2);
				if (n.type === G.In) return this.parseForInOfStatement(e, "const", t, _);
				if (n.type === G.Of) return this.parseForInOfStatement(e, "const", t, v);
			}
		}
		let n;
		if (t = this._lexer.peek(), t.type === G.Semicolon) this._lexer.get();
		else if (t.type === G.Let) {
			let e = this.parseLetStatement();
			if (e === null) return null;
			if (n = e, n.decls.some((e) => !e.expr)) return this.reportError("W011"), null;
			this.expectToken(G.Semicolon);
		} else if (Z[t.type].expressionStart) {
			let e = this.parseExpressionStatement();
			if (e === null) return null;
			n = e, this.expectToken(G.Semicolon);
		}
		let r;
		if (t = this._lexer.peek(), t.type === G.Semicolon) this._lexer.get();
		else {
			if (r = this.getExpression(), r === null) return null;
			this.expectToken(G.Semicolon);
		}
		let i;
		if (t = this._lexer.peek(), t.type !== G.RParent && (i = this.getExpression(), i === null)) return null;
		this.expectToken(G.RParent, "W006");
		let a = this.parseStatement();
		return a ? this.createStatementNode(ne, {
			init: n,
			cond: r,
			upd: i,
			body: a
		}, e, a.endToken) : null;
	}
	parseForInOfStatement(e, t, n, r) {
		if (t !== "none") {
			if (n.text.startsWith("$")) return this.reportError("W031"), null;
			this._lexer.get();
		}
		this._lexer.get(), this._lexer.get();
		let i = this.getExpression(!0);
		this.expectToken(G.RParent, "W006");
		let a = this.parseStatement();
		return a ? r === _ ? this.createStatementNode(_, {
			varB: t,
			id: {
				type: O,
				name: n.text,
				startToken: n,
				endToken: n
			},
			expr: i,
			body: a
		}, e, a.endToken) : this.createStatementNode(v, {
			varB: t,
			id: {
				type: O,
				name: n.text,
				startToken: n,
				endToken: n
			},
			expr: i,
			body: a
		}, e, a.endToken) : null;
	}
	parseThrowStatement() {
		let e = this._lexer.peek();
		this._lexer.get();
		let t;
		return t = this.getExpression(), t === null ? null : this.createStatementNode(re, { expr: t }, e, t.endToken);
	}
	parseTryStatement() {
		let e = () => {
			let e = this._lexer.peek();
			return e.type === G.LBrace ? this.parseBlockStatement() : (this.reportError("W012", e), null);
		}, t = this._lexer.peek(), n = this._lexer.get(), r = e(), i, a, o, s = this._lexer.peek();
		if (s.type === G.Catch) {
			if (this._lexer.get(), s = this._lexer.peek(), s.type === G.LParent) {
				if (this._lexer.get(), s = this._lexer.peek(), s.type !== G.Identifier) return this.reportError("W003", s), null;
				a = {
					type: O,
					nodeId: $(),
					name: s.text,
					startToken: s,
					endToken: s
				}, this._lexer.get(), this.expectToken(G.RParent, "W006");
			}
			i = e(), n = i.endToken, this._lexer.peek().type === G.Finally && (this._lexer.get(), o = e(), n = o.endToken);
		} else if (s.type === G.Finally) this._lexer.get(), o = e(), n = o.endToken;
		else return this.reportError("W013", s), null;
		return this.createStatementNode(ie, {
			tryB: r,
			catchB: i,
			catchV: a,
			finallyB: o
		}, t, n);
	}
	parseSwitchStatement() {
		let e = this._lexer.get();
		this.expectToken(G.LParent, "W014");
		let t = this.getExpression();
		if (!t) return null;
		this.expectToken(G.RParent, "W006"), this.expectToken(G.LBrace, "W012");
		let n = [], r = !1;
		for (;;) {
			let t = this._lexer.peek(), i;
			if (t.type === G.Case) {
				if (this._lexer.get(), i = this.getExpression(), !i) return null;
			} else if (t.type === G.Default) {
				if (r) return this.reportError("W016"), null;
				r = !0, this._lexer.get();
			} else if (t.type === G.RBrace) break;
			else return this.reportError("W015"), null;
			this.expectToken(G.Colon, "W008");
			let a = [], o = !1;
			for (; !o;) switch (this._lexer.peek().type) {
				case G.Case:
				case G.Default:
				case G.RBrace:
					o = !0;
					break;
				default:
					let e = this.parseStatement();
					if (e === null) {
						o = !0;
						break;
					}
					a.push(e), e.type !== s && this.skipToken(G.Semicolon);
			}
			n.push(this.createNode(le, {
				caseE: i,
				stmts: a
			}, e));
		}
		let i = this._lexer.peek();
		return this.expectToken(G.RBrace, "W004"), this.createStatementNode(ae, {
			expr: t,
			cases: n
		}, e, i);
	}
	parseImportStatement() {
		let e = this._lexer.get(), t = this._lexer.peek();
		if (t.type !== G.LBrace) return this.reportError("W032", t), null;
		this._lexer.get();
		let n = [];
		for (;;) {
			let e = this._lexer.peek();
			if (e.type !== G.Identifier) return this.reportError("W033", e), null;
			let t = e.text;
			this._lexer.get();
			let r = {
				type: ue,
				nodeId: $(),
				imported: {
					type: O,
					nodeId: $(),
					name: t,
					startToken: e,
					endToken: e
				},
				startToken: e,
				endToken: e
			};
			if (this._lexer.peek().type === G.As) {
				this._lexer.get();
				let e = this._lexer.peek();
				if (e.type !== G.Identifier) return this.reportError("W034", e), null;
				r.local = {
					type: O,
					nodeId: $(),
					name: e.text,
					startToken: e,
					endToken: e
				}, r.endToken = e, this._lexer.get();
			}
			n.push(r);
			let i = this._lexer.peek();
			if (i.type === G.RBrace) {
				this._lexer.get();
				break;
			}
			if (i.type !== G.Comma) return this.reportError("W035", i), null;
			this._lexer.get();
		}
		let r = this._lexer.peek();
		if (r.type !== G.From) return this.reportError("W036", r), null;
		this._lexer.get();
		let i = this._lexer.peek();
		if (i.type !== G.StringLiteral) return this.reportError("W037", i), null;
		this._lexer.get();
		let a = this.parseStringLiteral(i, !0);
		return this._lexer.peek().type === G.Semicolon && this._lexer.get(), this.createStatementNode(oe, {
			specifiers: n,
			source: a
		}, e, i);
	}
	parseFunctionDeclaration(e = !1, t = !1) {
		let n = this._lexer.peek();
		t && (n = this._lexer.get()), this._lexer.get();
		let r, i = this._lexer.peek();
		if (e) {
			if (i.type !== G.LParent) {
				if (i.type !== G.Identifier) return this.reportError("W003", i), null;
				r = i.text, this._lexer.get();
			}
		} else {
			if (i.type !== G.Identifier) return this.reportError("W003", i), null;
			r = i.text, this._lexer.get();
		}
		let a = this._lexer.peek();
		if (a.type !== G.LParent) return this.reportError("W014", a), null;
		let o = this.getExpression(!0), s, c = [];
		switch (o.type) {
			case P:
				s = !0;
				break;
			case O:
				s = (o.parenthesized ?? 0) <= 1, c.push(o);
				break;
			case C:
				s = o.parenthesized === 1;
				let e = !1;
				if (s) for (let t of o.exprs) {
					if (e) {
						s = !1;
						break;
					}
					switch (t.type) {
						case O:
							s = !t.parenthesized, c.push(t);
							break;
						case j:
							if (s = !t.parenthesized, s) {
								let e = this.convertToObjectDestructure(t);
								e && c.push(e);
							}
							break;
						case A:
							if (s = !t.parenthesized, s) {
								let e = this.convertToArrayDestructure(t);
								e && c.push(e);
							}
							break;
						case M:
							if (e = !0, t.expr.type !== O) {
								s = !1;
								break;
							}
							c.push(t);
							break;
						default:
							s = !1;
							break;
					}
				}
				break;
			case j:
				if (s = o.parenthesized === 1, s) {
					let e = this.convertToObjectDestructure(o);
					e && c.push(e);
				}
				break;
			case A:
				if (s = o.parenthesized === 1, s) {
					let e = this.convertToArrayDestructure(o);
					e && c.push(e);
				}
				break;
			case M:
				if (o.expr.type !== O) {
					s = !1;
					break;
				}
				s = !0, c.push(o);
				break;
			default: s = !1;
		}
		if (!s) return this.reportError("W010", n), null;
		if (this._lexer.peek().type !== G.LBrace) return this.reportError("W012", this._lexer.peek()), null;
		let l = this.parseBlockStatement();
		if (!l) return null;
		let u = {
			id: {
				type: O,
				name: r
			},
			args: c,
			stmt: l
		};
		return t && (u.async = !0), this.createStatementNode(t ? b : y, u, n, l.endToken);
	}
	parseExpr(e = !0) {
		return e ? this.parseSequenceExpression() : this.parseCondOrSpreadOrAsgnOrArrowExpr();
	}
	parseSequenceExpression() {
		let e = this._lexer.peek(), t = e, n = this.parseCondOrSpreadOrAsgnOrArrowExpr();
		if (!n) return null;
		t = n.endToken;
		let r = [], i = !1;
		if (this._lexer.peek().type === G.Comma) for (r.push(n); this.skipToken(G.Comma);) if (this._lexer.peek().type === G.Comma) i = !0, t = this._lexer.peek(), r.push(this.createExpressionNode(P, {}, t, t));
		else {
			let e = this.parseCondOrSpreadOrAsgnOrArrowExpr();
			if (!e) break;
			t = e.endToken, r.push(e);
		}
		return r.length ? (n = this.createExpressionNode(C, {
			exprs: r,
			loose: i
		}, e, t), i && (n = this.convertToArrayDestructure(n)), n) : n;
	}
	parseCondOrSpreadOrAsgnOrArrowExpr() {
		let e = this._lexer.peek();
		if (e.type === G.Spread) {
			this._lexer.get();
			let t = this.parseNullCoalescingExpr();
			return t ? this.createExpressionNode(M, { expr: t }, e, t.endToken) : null;
		}
		if (e.type === G.Function) {
			let t = this.parseFunctionDeclaration(!0);
			if (!t) return null;
			let n = {
				name: t.id.name,
				args: t.args,
				statement: t.stmt
			};
			return t.async && (n.async = !0), this.createExpressionNode(F, n, e, t.endToken);
		}
		if (e.type === G.Identifier && e.text === "async") {
			let t = this._lexer.ahead(1);
			if (t && t.type === G.Function) {
				let t = this.parseFunctionDeclaration(!0, !0);
				if (!t) return null;
				let n = {
					name: t.id.name,
					args: t.args,
					statement: t.stmt
				};
				return t.async && (n.async = !0), this.createExpressionNode(F, n, e, t.endToken);
			}
			if (t && (t.type === G.LParent || t.type === G.Identifier)) if (t.type === G.Identifier) {
				let t = this._lexer.ahead(2);
				if (!(!t || t.type !== G.Arrow)) {
					this._lexer.get();
					let t = this.parseNullCoalescingExpr();
					if (!t) return null;
					if (this._lexer.peek().type === G.Arrow) return this.parseArrowExpression(e, t, !0);
				}
			} else {
				this._lexer.get();
				let t = this.parseNullCoalescingExpr();
				if (!t) return null;
				let n = this._lexer.peek();
				return n.type === G.Arrow ? this.parseArrowExpression(e, t, !0) : (this.reportError("W002", n, n.text), null);
			}
		}
		let t = this.parseNullCoalescingExpr();
		if (!t) return null;
		let n = this._lexer.peek();
		if (n.type === G.Arrow) return this.parseArrowExpression(e, t);
		if (n.type === G.QuestionMark) {
			this._lexer.get();
			let n = this.getExpression(!1);
			this.expectToken(G.Colon);
			let r = this.getExpression(!1);
			return this.createExpressionNode(w, {
				cond: t,
				thenE: n,
				elseE: r
			}, e, r.endToken);
		}
		if (Z[n.type].isAssignment) {
			this._lexer.get();
			let r = this.getExpression();
			return r ? this.createExpressionNode(N, {
				leftValue: t,
				op: n.text,
				expr: r
			}, e, r.endToken) : null;
		}
		return t;
	}
	parseArrowExpression(e, t, n = !1) {
		let r, i = [];
		switch (t.type) {
			case P:
				r = !0;
				break;
			case O:
				r = (t.parenthesized ?? 0) <= 1, i.push(t);
				break;
			case C:
				r = t.parenthesized === 1;
				let e = !1;
				if (r) for (let n of t.exprs) {
					if (e) {
						r = !1;
						break;
					}
					switch (n.type) {
						case O:
							r = !n.parenthesized, i.push(n);
							break;
						case j:
							if (r = !n.parenthesized, r) {
								let e = this.convertToObjectDestructure(n);
								e && i.push(e);
							}
							break;
						case A:
							if (r = !n.parenthesized, r) {
								let e = this.convertToArrayDestructure(n);
								e && i.push(e);
							}
							break;
						case M:
							if (e = !0, n.expr.type !== O) {
								r = !1;
								break;
							}
							i.push(n);
							break;
						default:
							r = !1;
							break;
					}
				}
				break;
			case j:
				if (r = t.parenthesized === 1, r) {
					let e = this.convertToObjectDestructure(t);
					e && i.push(e);
				}
				break;
			case A:
				if (r = t.parenthesized === 1, r) {
					let e = this.convertToArrayDestructure(t);
					e && i.push(e);
				}
				break;
			case M:
				r = t.expr.type === O, r && i.push(t);
				break;
			default: r = !1;
		}
		if (!r) return this.reportError("W010", e), null;
		this._lexer.get();
		let a = this.parseStatement(!1);
		if (!a) return null;
		let o = {
			args: i,
			statement: a
		};
		return n && (o.async = !0), this.createExpressionNode(F, o, e, a.endToken);
	}
	parseNullCoalescingExpr() {
		let e = this._lexer.peek(), t = this.parseLogicalOrExpr();
		if (!t) return null;
		for (; this.skipToken(G.NullCoalesce);) {
			let n = this.parseLogicalOrExpr();
			if (!n) return this.reportError("W001"), null;
			let r = n.endToken;
			t = this.createExpressionNode(S, {
				op: "??",
				left: t,
				right: n
			}, e, r);
		}
		return t;
	}
	parseLogicalOrExpr() {
		let e = this._lexer.peek(), t = this.parseLogicalAndExpr();
		if (!t) return null;
		for (; this.skipToken(G.LogicalOr);) {
			let n = this.parseLogicalAndExpr();
			if (!n) return this.reportError("W001"), null;
			let r = n.endToken;
			t = this.createExpressionNode(S, {
				op: "||",
				left: t,
				right: n
			}, e, r);
		}
		return t;
	}
	parseLogicalAndExpr() {
		let e = this._lexer.peek(), t = this.parseBitwiseOrExpr();
		if (!t) return null;
		for (; this.skipToken(G.LogicalAnd);) {
			let n = this.parseBitwiseOrExpr();
			if (!n) return this.reportError("W001"), null;
			let r = n.endToken;
			t = this.createExpressionNode(S, {
				op: "&&",
				left: t,
				right: n
			}, e, r);
		}
		return t;
	}
	parseBitwiseOrExpr() {
		let e = this._lexer.peek(), t = this.parseBitwiseXorExpr();
		if (!t) return null;
		for (; this.skipToken(G.BitwiseOr);) {
			let n = this.parseBitwiseXorExpr();
			if (!n) return this.reportError("W001"), null;
			let r = n.endToken;
			t = this.createExpressionNode(S, {
				op: "|",
				left: t,
				right: n
			}, e, r);
		}
		return t;
	}
	parseBitwiseXorExpr() {
		let e = this._lexer.peek(), t = this.parseBitwiseAndExpr();
		if (!t) return null;
		for (; this.skipToken(G.BitwiseXor);) {
			let n = this.parseBitwiseAndExpr();
			if (!n) return this.reportError("W001"), null;
			let r = n.endToken;
			t = this.createExpressionNode(S, {
				op: "^",
				left: t,
				right: n
			}, e, r);
		}
		return t;
	}
	parseBitwiseAndExpr() {
		let e = this._lexer.peek(), t = this.parseEquExpr();
		if (!t) return null;
		for (; this.skipToken(G.BitwiseAnd);) {
			let n = this.parseEquExpr();
			if (!n) return this.reportError("W001"), null;
			let r = n.endToken;
			t = this.createExpressionNode(S, {
				op: "&",
				left: t,
				right: n
			}, e, r);
		}
		return t;
	}
	parseEquExpr() {
		let e = this._lexer.peek(), t = this.parseRelOrInExpr();
		if (!t) return null;
		let n;
		for (; n = this.skipTokens(G.Equal, G.StrictEqual, G.NotEqual, G.StrictNotEqual);) {
			let r = this.parseRelOrInExpr();
			if (!r) return this.reportError("W001"), null;
			let i = r.endToken;
			t = this.createExpressionNode(S, {
				op: n.text,
				left: t,
				right: r
			}, e, i);
		}
		return t;
	}
	parseRelOrInExpr() {
		let e = this._lexer.peek(), t = this.parseShiftExpr();
		if (!t) return null;
		let n;
		for (; n = this.skipTokens(G.LessThan, G.LessThanOrEqual, G.GreaterThan, G.GreaterThanOrEqual, G.In, G.Instanceof);) {
			let r = this.parseShiftExpr();
			if (!r) return this.reportError("W001"), null;
			let i = r.endToken;
			t = this.createExpressionNode(S, {
				op: n.text,
				left: t,
				right: r
			}, e, i);
		}
		return t;
	}
	parseShiftExpr() {
		let e = this._lexer.peek(), t = this.parseAddExpr();
		if (!t) return null;
		let n;
		for (; n = this.skipTokens(G.ShiftLeft, G.ShiftRight, G.SignedShiftRight);) {
			let r = this.parseAddExpr();
			if (!r) return this.reportError("W001"), null;
			let i = r.endToken;
			t = this.createExpressionNode(S, {
				op: n.text,
				left: t,
				right: r
			}, e, i);
		}
		return t;
	}
	parseAddExpr() {
		let e = this._lexer.peek(), t = this.parseMultExpr();
		if (!t) return null;
		let n;
		for (; n = this.skipTokens(G.Plus, G.Minus);) {
			let r = this.parseMultExpr();
			if (!r) return this.reportError("W001"), null;
			let i = r.endToken;
			t = this.createExpressionNode(S, {
				op: n.text,
				left: t,
				right: r
			}, e, i);
		}
		return t;
	}
	parseMultExpr() {
		let e = this._lexer.peek(), t = this.parseExponentialExpr();
		if (!t) return null;
		let n;
		for (; n = this.skipTokens(G.Multiply, G.Divide, G.Remainder);) {
			let r = this.parseExponentialExpr();
			if (!r) return this.reportError("W001"), null;
			let i = r.endToken;
			t = this.createExpressionNode(S, {
				op: n.text,
				left: t,
				right: r
			}, e, i);
		}
		return t;
	}
	parseExponentialExpr() {
		let e = this._lexer.peek(), t = this.parseUnaryOrPrefixExpr();
		if (!t) return null;
		let n, r = 0;
		for (; n = this.skipToken(G.Exponent);) {
			let i = this.parseUnaryOrPrefixExpr();
			if (!i) return this.reportError("W001"), null;
			let a = i.endToken;
			if (r === 0) t = this.createExpressionNode(S, {
				op: n.text,
				left: t,
				right: i
			}, e, a);
			else {
				let r = t;
				t = this.createExpressionNode(S, {
					op: n.text,
					left: r.left,
					right: {
						type: S,
						op: n.text,
						left: r.right,
						right: i
					}
				}, e, a);
			}
			r++;
		}
		return t;
	}
	parseUnaryOrPrefixExpr() {
		let e = this._lexer.peek();
		if (e.type === G.New) {
			this._lexer.get();
			let t = this.parsePrimaryExpr();
			if (!t) return null;
			let n = !1;
			do {
				let r = this._lexer.peek();
				switch (r.type) {
					case G.Dot:
					case G.OptionalChaining: {
						this._lexer.get();
						let n = this._lexer.peek();
						if (n.type !== G.Identifier) return this.reportError("W003"), null;
						this._lexer.get(), t = this.createExpressionNode(E, {
							obj: t,
							member: n.text,
							opt: r.type === G.OptionalChaining
						}, e, n);
						break;
					}
					case G.LSquare: {
						this._lexer.get();
						let n = this.parseExpr();
						if (!n) return null;
						let r = this._lexer.peek();
						this.expectToken(G.RSquare, "W005"), t = this.createExpressionNode(D, {
							obj: t,
							member: n
						}, e, r);
						break;
					}
					default:
						n = !0;
						break;
				}
			} while (!n);
			let r = [], i = t.endToken;
			if (this._lexer.peek().type === G.LParent) {
				if (this._lexer.get(), this._lexer.peek().type !== G.RParent) {
					let e = this.parseExpr();
					if (!e) return this.reportError("W001"), null;
					r = e.type === C ? e.exprs : [e];
				}
				i = this._lexer.peek(), this.expectToken(G.RParent, "W006");
			}
			let a = this.createExpressionNode(z, {
				callee: t,
				arguments: r
			}, e, i), o = !1;
			do {
				let t = this._lexer.peek();
				switch (t.type) {
					case G.LParent: {
						this._lexer.get();
						let t = [];
						if (this._lexer.peek().type !== G.RParent) {
							let e = this.parseExpr();
							if (!e) return this.reportError("W001"), null;
							t = e.type === C ? e.exprs : [e];
						}
						let n = this._lexer.peek();
						this.expectToken(G.RParent, "W006"), a = this.createExpressionNode(T, {
							obj: a,
							arguments: t
						}, e, n);
						break;
					}
					case G.Dot:
					case G.OptionalChaining: {
						this._lexer.get();
						let n = this._lexer.get();
						if (!Z[n.type].keywordLike) return this.reportError("W003"), null;
						a = this.createExpressionNode(E, {
							obj: a,
							member: n.text,
							opt: t.type === G.OptionalChaining
						}, e, n);
						break;
					}
					case G.LSquare: {
						this._lexer.get();
						let t = this.getExpression();
						if (!t) return null;
						let n = this._lexer.peek();
						this.expectToken(G.RSquare, "W005"), a = this.createExpressionNode(D, {
							obj: a,
							member: t
						}, e, n);
						break;
					}
					default:
						o = !0;
						break;
				}
			} while (!o);
			return a;
		}
		if (e.type === G.Identifier && e.text === "await") {
			this._lexer.get();
			let t = this.parseUnaryOrPrefixExpr();
			return t ? this.createExpressionNode(R, { expr: t }, e, t.endToken) : null;
		}
		if (Z[e.type].canBeUnary) {
			this._lexer.get();
			let t = this.parseUnaryOrPrefixExpr();
			return t ? this.createExpressionNode(x, {
				op: e.text,
				expr: t
			}, e, t.endToken) : null;
		}
		if (e.type === G.IncOp || e.type === G.DecOp) {
			this._lexer.get();
			let t = this.parseMemberOrInvocationExpr();
			return t ? this.createExpressionNode(ce, {
				op: e.text,
				expr: t
			}, e, t.endToken) : null;
		}
		return this.parseMemberOrInvocationExpr();
	}
	parseMemberOrInvocationExpr() {
		let e = this._lexer.peek(), t = this.parsePrimaryExpr();
		if (!t) return null;
		let n = !1;
		do {
			let r = this._lexer.peek();
			switch (r.type) {
				case G.LParent: {
					this._lexer.get();
					let n = [];
					if (this._lexer.peek().type !== G.RParent) {
						let e = this.parseExpr();
						if (!e) return this.reportError("W001"), null;
						n = e.type === C ? e.exprs : [e];
					}
					let r = this._lexer.peek();
					this.expectToken(G.RParent, "W006"), t = this.createExpressionNode(T, {
						obj: t,
						arguments: n
					}, e, r);
					break;
				}
				case G.Dot:
				case G.OptionalChaining:
					this._lexer.get();
					let i = this._lexer.get();
					if (!Z[i.type].keywordLike) return this.reportError("W003"), null;
					t = this.createExpressionNode(E, {
						obj: t,
						member: i.text,
						opt: r.type === G.OptionalChaining
					}, e, i);
					break;
				case G.LSquare:
					this._lexer.get();
					let a = this.getExpression();
					if (!a) return null;
					let o = this._lexer.peek();
					this.expectToken(G.RSquare, "W005"), t = this.createExpressionNode(D, {
						obj: t,
						member: a
					}, e, o);
					break;
				default:
					n = !0;
					break;
			}
		} while (!n);
		let r = this._lexer.peek();
		return r.type === G.IncOp || r.type === G.DecOp ? (this._lexer.get(), this.createExpressionNode(I, {
			op: r.text,
			expr: t
		}, e, r)) : t;
	}
	parsePrimaryExpr() {
		let e = this._lexer.peek();
		switch (e.type) {
			case G.LParent:
				if (this._lexer.get(), this._lexer.peek().type === G.RParent) {
					let t = this._lexer.get();
					return this.createExpressionNode(P, {}, e, t);
				}
				let t = this.parseExpr();
				if (!t) return null;
				let n = this._lexer.peek();
				return this.expectToken(G.RParent, "W006"), {
					...t,
					parenthesized: (t.parenthesized ?? 0) + 1,
					startToken: e,
					endToken: n
				};
			case G.Identifier: {
				let e = this._lexer.get();
				return this.createExpressionNode(O, { name: e.text }, e, e);
			}
			case G.Backtick: return this.parseTemplateLiteral();
			case G.False:
			case G.True: return this._lexer.get(), this.createExpressionNode(k, { value: e.type === G.True }, e, e);
			case G.BinaryLiteral: return this._lexer.get(), this.parseBinaryLiteral(e);
			case G.DecimalLiteral: return this._lexer.get(), this.parseDecimalLiteral(e);
			case G.HexadecimalLiteral: return this._lexer.get(), this.parseHexadecimalLiteral(e);
			case G.RealLiteral: return this._lexer.get(), this.parseRealLiteral(e);
			case G.StringLiteral: return this._lexer.get(), this.parseStringLiteral(e);
			case G.Infinity: return this._lexer.get(), this.createExpressionNode(k, { value: Infinity }, e, e);
			case G.NaN: return this._lexer.get(), this.createExpressionNode(k, { value: NaN }, e, e);
			case G.Null: return this._lexer.get(), this.createExpressionNode(k, { value: null }, e, e);
			case G.Undefined: return this._lexer.get(), this.createExpressionNode(k, { value: void 0 }, e, e);
			case G.LSquare: return this.parseArrayLiteral();
			case G.LBrace: return this.parseObjectLiteral();
			case G.Divide: return this.parseRegExpLiteral();
		}
		return null;
	}
	parseTemplateLiteral() {
		let e = this._lexer.get();
		this._lexer.setStartingPhaseToTemplateLiteral();
		let t = [];
		loop: for (;;) {
			let e = this._lexer.peek();
			switch (e.type) {
				case G.StringLiteral:
					this._lexer.get();
					let n = this.parseStringLiteral(e, !1);
					t.push(n);
					break;
				case G.DollarLBrace:
					this._lexer.get();
					let r = this.parseExpr();
					t.push(r), this.expectToken(G.RBrace, "W004"), this._lexer.setStartingPhaseToTemplateLiteral();
					break;
				case G.Backtick: break loop;
				default: this.reportError("W004");
			}
		}
		let n = this._lexer.get();
		return this.createExpressionNode(se, { segments: t }, e, n);
	}
	parseArrayLiteral() {
		let e = this._lexer.get(), t = [];
		if (this._lexer.peek().type !== G.RSquare) {
			let e = this.getExpression();
			e && (t = e.type === C ? e.exprs : [e]);
		}
		let n = this._lexer.peek();
		return this.expectToken(G.RSquare), this.createExpressionNode(A, { items: t }, e, n);
	}
	parseObjectLiteral() {
		let e = this._lexer.get(), t = [];
		if (this._lexer.peek().type !== G.RBrace) for (; this._lexer.peek().type !== G.RBrace;) {
			let n = this._lexer.peek(), r = Z[n.type], i;
			if (r.keywordLike) i = {
				type: O,
				nodeId: $(),
				name: n.text,
				startToken: n,
				endToken: n
			}, this._lexer.get();
			else if (r.expressionStart) if (n.type === G.LSquare) {
				if (this._lexer.get(), i = this.getExpression(), !i) return null;
				this.expectToken(G.RSquare, "W005"), i = this.createExpressionNode(C, { exprs: [i] }, e);
			} else if (r.isPropLiteral) {
				if (i = this.getExpression(!1), !i) return null;
				if (i.type !== O && i.type !== k && i.type !== M) return this.reportError("W007"), null;
			} else return this.reportError("W007"), null;
			else return this.reportError("W001"), null;
			let a = i.type;
			if (a === M) t.push(i);
			else {
				if (a === k) {
					let e = i.value;
					if (typeof e != "number" && typeof e != "string") return this.expectToken(G.RBrace, "W007"), null;
				}
				let e = null;
				if (a === O) {
					let t = this._lexer.peek();
					(t.type === G.Comma || t.type === G.RBrace) && (e = { ...i });
				}
				if (!e && (this.expectToken(G.Colon, "W008"), e = this.getExpression(!1), !e)) return null;
				t.push([i, e]);
			}
			let o = this._lexer.peek().type;
			if (o === G.Comma) this._lexer.get();
			else if (o !== G.RBrace) break;
		}
		let n = this._lexer.peek();
		return this.expectToken(G.RBrace, "W004"), this.createExpressionNode(j, { props: t }, e, n);
	}
	parseRegExpLiteral() {
		let e = this._lexer.peek(), t = this._lexer.getRegEx();
		return t.success ? this.createExpressionNode(k, { value: new RegExp(t.pattern, t.flags) }, e, this._lexer.peek()) : (this.reportError("W002", e, t.pattern ?? ""), null);
	}
	getExpression(e = !0) {
		return this.parseExpr(e) || (this.reportError("W001"), null);
	}
	expectToken(e, t, n) {
		let r = this._lexer.peek();
		return r.type === e || n && r.type === G.Eof ? this._lexer.get() : (this.reportError(t ?? "W002", r, r.text), null);
	}
	skipToken(e) {
		let t = this._lexer.peek();
		return t.type === e ? (this._lexer.get(), t) : null;
	}
	skipTokens(...e) {
		let t = this._lexer.peek();
		for (let n of e) if (t.type === n) return this._lexer.get(), t;
		return null;
	}
	reportError(e, t, ...n) {
		let r = ye[e] ?? "Unkonwn error";
		throw n && n.forEach((e, t) => r = i(r, `{${t}}`, n[t].toString())), t ||= this._lexer.peek(), this._parseErrors.push({
			code: e,
			text: r,
			line: t.startLine,
			column: t.startColumn,
			position: t.startPosition,
			end: t.endPosition
		}), new ve(r, e);
		function i(e, t, n) {
			do
				e = e.replace(t, n);
			while (e.includes(t));
			return e;
		}
	}
	createNode(e, t, n, r) {
		return r ||= this._lexer.peek(), Object.assign({}, t, {
			type: e,
			startToken: n,
			endToken: r
		});
	}
	createExpressionNode(e, t = {}, n, r) {
		r ||= this._lexer.peek(), n ||= r;
		let i;
		if (n && r && this._lexer.input.source) {
			let e = n.startPosition, t = r.endPosition;
			e <= t && (i = this._lexer.input.source.substring(e, t));
		}
		return Object.assign({}, t, {
			type: e,
			nodeId: $(),
			startToken: n,
			endToken: r,
			source: i
		});
	}
	createStatementNode(e, t, n, r) {
		return Object.assign({}, t, {
			type: e,
			nodeId: $(),
			startToken: n,
			endToken: r
		});
	}
	parseBinaryLiteral(e) {
		let t, n = BigInt(e.text.replace(/[_']/g, ""));
		return t = n < -(2 ** 53 - 1) || n > 2 ** 53 - 1 ? n : parseInt(e.text.substring(2).replace(/[_']/g, ""), 2), this.createExpressionNode(k, { value: t }, e, e);
	}
	parseDecimalLiteral(e) {
		let t, n = BigInt(e.text.replace(/[_']/g, ""));
		return t = n < -(2 ** 53 - 1) || n > 2 ** 53 - 1 ? n : parseInt(e.text.replace(/[_']/g, ""), 10), this.createExpressionNode(k, { value: t }, e, e);
	}
	parseHexadecimalLiteral(e) {
		let t, n = BigInt(e.text.replace(/[_']/g, ""));
		return t = n < -(2 ** 53 - 1) || n > 2 ** 53 - 1 ? n : parseInt(e.text.substring(2).replace(/[_']/g, ""), 16), this.createExpressionNode(k, { value: t }, e, e);
	}
	parseRealLiteral(e) {
		let t = parseFloat(e.text.replace(/[_']/g, ""));
		return this.createExpressionNode(k, { value: t }, e, e);
	}
	parseStringLiteral(e, t = !0) {
		let n = e.text;
		t && (n = e.text.length < 2 ? "" : n.substring(1, n.length - 1));
		let r = "", i = Q.Normal, a = 0;
		for (let e of n) switch (i) {
			case Q.Normal:
				e === "\\" ? i = Q.Backslash : r += e;
				break;
			case Q.Backslash:
				switch (i = Q.Normal, e) {
					case "b":
						r += "\b";
						break;
					case "f":
						r += "\f";
						break;
					case "n":
						r += "\n";
						break;
					case "r":
						r += "\r";
						break;
					case "t":
						r += "	";
						break;
					case "v":
						r += "\v";
						break;
					case "S":
						r += "\xA0";
						break;
					case "0":
						r += "\0";
						break;
					case "'":
						r += "'";
						break;
					case "\"":
						r += "\"";
						break;
					case "\\":
						r += "\\";
						break;
					case "x":
						i = Q.X;
						break;
					case "u":
						i = Q.UX1;
						break;
					default:
						r += e;
						break;
				}
				break;
			case Q.X:
				o(e) ? (a = parseInt(e, 16), i = Q.Xh) : (r += "x", i = Q.Normal);
				break;
			case Q.Xh:
				o(e) ? (a = a * 16 + parseInt(e, 16), r += String.fromCharCode(a), i = Q.Normal) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.UX1:
				if (e === "{") {
					i = Q.Ucp1;
					break;
				}
				o(e) ? (a = parseInt(e, 16), i = Q.UX2) : (r += "x", i = Q.Normal);
				break;
			case Q.UX2:
				o(e) ? (a = a * 16 + parseInt(e, 16), i = Q.UX3) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.UX3:
				o(e) ? (a = a * 16 + parseInt(e, 16), i = Q.UX4) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.UX4:
				o(e) ? (a = a * 16 + parseInt(e, 16), r += String.fromCharCode(a), i = Q.Normal) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.Ucp1:
				o(e) ? (a = parseInt(e, 16), i = Q.Ucp2) : (r += "x", i = Q.Normal);
				break;
			case Q.Ucp2:
				o(e) ? (a = a * 16 + parseInt(e, 16), i = Q.Ucp3) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.Ucp3:
				o(e) ? (a = a * 16 + parseInt(e, 16), i = Q.Ucp4) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.Ucp4:
				o(e) ? (a = a * 16 + parseInt(e, 16), i = Q.Ucp5) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.Ucp5:
				o(e) ? (a = a * 16 + parseInt(e, 16), i = Q.Ucp6) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.Ucp6:
				o(e) ? (a = a * 16 + parseInt(e, 16), i = Q.UcpTail) : (r += String.fromCharCode(a), r += e, i = Q.Normal);
				break;
			case Q.UcpTail:
				r += String.fromCharCode(a), e !== "}" && (r += e), i = Q.Normal;
				break;
		}
		switch (i) {
			case Q.Backslash:
				r += "\\";
				break;
			case Q.X:
				r += "x";
				break;
			case Q.Xh:
				r += String.fromCharCode(a);
				break;
		}
		return this.createExpressionNode(k, { value: r }, e, e);
		function o(e) {
			return e >= "0" && e <= "9" || e >= "a" && e <= "f" || e >= "A" && e <= "F";
		}
	}
	convertToArrayDestructure(e) {
		let t = e.type === C ? e.exprs : e.items, n = this.createExpressionNode(V, { aDestr: [] }, e.startToken, e.endToken);
		for (let e of t) {
			let t;
			switch (e.type) {
				case P:
					t = this.createExpressionNode(H, {}, e.startToken, e.endToken);
					break;
				case O:
					t = this.createExpressionNode(H, { id: e.name }, e.startToken, e.endToken);
					break;
				case V:
					n.aDestr.push(...e.aDestr);
					break;
				case H:
					t = e;
					break;
				case A: {
					let n = this.convertToArrayDestructure(e);
					n && (t = this.createExpressionNode(H, { aDestr: n.aDestr }, e.startToken, e.endToken));
					break;
				}
				case U:
					t = this.createExpressionNode(H, { oDestr: e }, e.startToken, e.endToken);
					break;
				case j: {
					let n = this.convertToObjectDestructure(e);
					n && (t = this.createExpressionNode(H, { oDestr: n.oDestr }, e.startToken, e.endToken));
					break;
				}
				default: return this.reportError("W017"), null;
			}
			t && n.aDestr?.push(t);
		}
		return n;
	}
	convertToObjectDestructure(e) {
		let t = this.createExpressionNode(V, { oDestr: [] }, e.startToken, e.endToken);
		for (let n of e.props) {
			if (!Array.isArray(n)) return this.reportError("W018"), null;
			let [e, r] = n;
			if (e.type !== O) return this.reportError("W018"), null;
			let i;
			switch (r.type) {
				case O:
					i = r.name === e.name ? this.createExpressionNode(U, { id: e.name }, r.startToken, r.endToken) : this.createExpressionNode(U, {
						id: e.name,
						alias: r.name
					}, r.startToken, r.endToken);
					break;
				case H:
					i = this.createExpressionNode(U, {
						id: e.name,
						aDestr: r
					}, e.startToken, r.endToken);
					break;
				case A: {
					let t = this.convertToArrayDestructure(r);
					t && (i = this.createExpressionNode(U, {
						id: e.name,
						aDestr: t.aDestr
					}, e.startToken, r.endToken));
					break;
				}
				case U:
					i = r;
					break;
				case j: {
					let t = this.convertToObjectDestructure(r);
					t && (i = this.createExpressionNode(U, {
						id: e.name,
						oDestr: t.oDestr
					}, e.startToken, r.endToken));
					break;
				}
				default: return this.reportError("W018"), null;
			}
			i && t.oDestr?.push(i);
		}
		return t;
	}
	isExpressionStart(e) {
		return Z[e.type]?.expressionStart ?? !1;
	}
};
//#endregion
export { i as $, u as A, C as B, _ as C, T as D, y as E, j as F, ie as G, ae as H, I, f as J, x as K, ce as L, E as M, z as N, O, P, a as Q, L as R, c as S, ne as T, se as U, M as V, re as W, r as X, h as Y, n as Z, d as _, G as a, g as b, l as c, R as d, S as f, w as g, D as h, ye as i, k as j, p as k, N as l, ee as m, $ as n, A as o, o as p, B as q, X as r, F as s, xe as t, b as u, te as v, v as w, s as x, V as y, m as z };

//# sourceMappingURL=Parser-UQbHWtve.js.map