UNPKG

@imput/youtubei.js

Version:

A JavaScript client for YouTube's private API, known as InnerTube. Fork of youtubei.js

1,161 lines (1,119 loc) 1.26 MB
"use strict"; /* eslint-disable */ var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // dist/src/platform/node.js var node_exports = {}; __export(node_exports, { APIResponseTypes: () => types_exports, Actions: () => Actions_default, AppendContinuationItemsAction: () => AppendContinuationItemsAction_default, ClientType: () => ClientType, Clients: () => clients_exports, Constants: () => Constants_exports, Continuation: () => Continuation, ContinuationCommand: () => ContinuationCommand2, EventEmitter: () => EventEmitterLike_default, FormatUtils: () => FormatUtils_exports, Generator: () => generator_exports, GridContinuation: () => GridContinuation, HTTPClient: () => HTTPClient_default, Helpers: () => helpers_exports, Innertube: () => Innertube_default, ItemSectionContinuation: () => ItemSectionContinuation, LZW: () => LZW_exports, LiveChatContinuation: () => LiveChatContinuation, Log: () => Log_exports, Managers: () => managers_exports, Misc: () => misc_exports, Mixins: () => mixins_exports, MusicPlaylistShelfContinuation: () => MusicPlaylistShelfContinuation, MusicShelfContinuation: () => MusicShelfContinuation, NavigateAction: () => NavigateAction, OAuth2: () => OAuth2_default, Parser: () => parser_exports, Platform: () => Platform, Player: () => Player, PlaylistPanelContinuation: () => PlaylistPanelContinuation, ProtoUtils: () => ProtoUtils_exports, ReloadContinuationItemsCommand: () => ReloadContinuationItemsCommand, SectionListContinuation: () => SectionListContinuation, Session: () => Session_default, ShowMiniplayerCommand: () => ShowMiniplayerCommand, Types: () => types_exports2, UniversalCache: () => Cache_default, Utils: () => Utils_exports, YT: () => youtube_exports, YTKids: () => ytkids_exports, YTMusic: () => ytmusic_exports, YTNodes: () => nodes_exports2, YTShorts: () => ytshorts_exports, default: () => node_default }); module.exports = __toCommonJS(node_exports); var import_tslib70 = require("tslib"); var import_web = require("stream/web"); var import_undici = require("undici"); // dist/src/utils/Utils.js var Utils_exports = {}; __export(Utils_exports, { ChannelError: () => ChannelError, InnertubeError: () => InnertubeError, MissingParamError: () => MissingParamError, OAuth2Error: () => OAuth2Error, ParsingError: () => ParsingError, Platform: () => Platform, PlayerError: () => PlayerError, SessionError: () => SessionError, base64ToU8: () => base64ToU8, concatMemos: () => concatMemos, debugFetch: () => debugFetch, deepCompare: () => deepCompare, escapeStringRegexp: () => escapeStringRegexp, findFunction: () => findFunction, findVariable: () => findVariable, generateRandomString: () => generateRandomString, generateSidAuth: () => generateSidAuth, getCookie: () => getCookie, getRandomUserAgent: () => getRandomUserAgent, getStringBetweenStrings: () => getStringBetweenStrings, hasKeys: () => hasKeys, isTextRun: () => isTextRun, streamToIterable: () => streamToIterable, throwIfMissing: () => throwIfMissing, timeToSeconds: () => timeToSeconds, u8ToBase64: () => u8ToBase64 }); // node_modules/jintr/dist/nodes/index.js var nodes_exports = {}; __export(nodes_exports, { ArrayExpression: () => ArrayExpression, ArrowFunctionExpression: () => ArrowFunctionExpression, AssignmentExpression: () => AssignmentExpression, BinaryExpression: () => BinaryExpression, BlockStatement: () => BlockStatement, BreakStatement: () => BreakStatement, CallExpression: () => CallExpression, ConditionalExpression: () => ConditionalExpression, ContinueStatement: () => ContinueStatement, EmptyStatement: () => EmptyStatement, ExpressionStatement: () => ExpressionStatement, ForOfStatement: () => ForOfStatement, ForStatement: () => ForStatement, FunctionDeclaration: () => FunctionDeclaration, FunctionExpression: () => FunctionExpression, Identifier: () => Identifier, IfStatement: () => IfStatement, Literal: () => Literal, LogicalExpression: () => LogicalExpression, MemberExpression: () => MemberExpression, NewExpression: () => NewExpression, ObjectExpression: () => ObjectExpression, Property: () => Property, ReturnStatement: () => ReturnStatement, SequenceExpression: () => SequenceExpression, SwitchCase: () => SwitchCase, SwitchStatement: () => SwitchStatement, TemplateLiteral: () => TemplateLiteral, ThisExpression: () => ThisExpression, ThrowStatement: () => ThrowStatement, TryStatement: () => TryStatement, UnaryExpression: () => UnaryExpression, UpdateExpression: () => UpdateExpression, VariableDeclaration: () => VariableDeclaration, WhileStatement: () => WhileStatement }); // node_modules/jintr/dist/nodes/BaseJSNode.js var BaseJSNode = class { constructor(node, visitor) { this.node = node; this.visitor = visitor; } run() { } }; __name(BaseJSNode, "BaseJSNode"); // node_modules/jintr/dist/nodes/ArrayExpression.js var ArrayExpression = class extends BaseJSNode { run() { return this.node.elements.map((el) => this.visitor.visitNode(el)); } }; __name(ArrayExpression, "ArrayExpression"); // node_modules/jintr/dist/utils/index.js var namedFunction = /* @__PURE__ */ __name((name, fn) => Object.defineProperty(fn, "name", { value: name }), "namedFunction"); var JinterError = class extends Error { constructor(message, info2) { super(message); if (info2) { this.info = info2; } } }; __name(JinterError, "JinterError"); // node_modules/jintr/dist/nodes/ArrowFunctionExpression.js var ArrowFunctionExpression = class extends BaseJSNode { run() { const { params, body } = this.node; const fn = namedFunction("anonymous function", (args) => { let index = 0; for (const param of params) { this.visitor.visitNode(param); if (param.type === "Identifier") { this.visitor.scope.set(param.name, args[index]); } else { console.warn("Unhandled param type", param.type); } index++; } return this.visitor.visitNode(body); }); return fn; } }; __name(ArrowFunctionExpression, "ArrowFunctionExpression"); // node_modules/jintr/dist/nodes/AssignmentExpression.js var AssignmentExpression = class extends BaseJSNode { handleMemberExpression(leftNode, rightValue, operation) { const obj = this.visitor.visitNode(leftNode.object); const prop = this.visitor.visitNode(leftNode.property); const currentValue = obj[prop]; const newValue = operation(currentValue, rightValue); return obj[prop] = newValue; } handleIdentifier(leftNode, rightValue, operation) { const currentValue = this.visitor.visitNode(leftNode); const newValue = operation(currentValue, rightValue); this.visitor.scope.set(leftNode.name, newValue); return this.visitor.scope.get(leftNode.name); } run() { const { operator, left, right } = this.node; const rightValue = this.visitor.visitNode(right); const operation = AssignmentExpression.operatorMap[operator]; if (!operation) { console.warn("Unhandled operator:", operator); return void 0; } if (left.type === "MemberExpression") { return this.handleMemberExpression(left, rightValue, operation); } else if (left.type === "Identifier") { return this.handleIdentifier(left, rightValue, operation); } console.warn("Unhandled left node type:", left.type); return void 0; } }; __name(AssignmentExpression, "AssignmentExpression"); AssignmentExpression.operatorMap = { "=": (_, right) => right, "+=": (left, right) => left + right, "-=": (left, right) => left - right, "*=": (left, right) => left * right, "/=": (left, right) => left / right, "%=": (left, right) => left % right, "**=": (left, right) => left ** right, "<<=": (left, right) => left << right, ">>=": (left, right) => left >> right, ">>>=": (left, right) => left >>> right, "&=": (left, right) => left & right, "^=": (left, right) => left ^ right, "|=": (left, right) => left | right }; // node_modules/jintr/dist/nodes/BinaryExpression.js var BinaryExpression = class extends BaseJSNode { run() { const { operator, left, right } = this.node; const leftValue = this.visitor.visitNode(left); const rightValue = this.visitor.visitNode(right); const operation = BinaryExpression.operatorMap[operator]; if (!operation) { console.warn("Unhandled binary operator:", operator); return void 0; } return operation(leftValue, rightValue); } }; __name(BinaryExpression, "BinaryExpression"); BinaryExpression.operatorMap = { "!=": (left, right) => left != right, "!==": (left, right) => left !== right, "==": (left, right) => left == right, "===": (left, right) => left === right, "<": (left, right) => left < right, "<=": (left, right) => left <= right, ">": (left, right) => left > right, ">=": (left, right) => left >= right, "+": (left, right) => left + right, "-": (left, right) => left - right, "*": (left, right) => left * right, "/": (left, right) => left / right, "%": (left, right) => left % right, "**": (left, right) => left ** right, "&": (left, right) => left & right, "|": (left, right) => left | right, "^": (left, right) => left ^ right, "<<": (left, right) => left << right, ">>": (left, right) => left >> right, ">>>": (left, right) => left >>> right, "in": (left, right) => left in right, "instanceof": (left, right) => left instanceof right }; // node_modules/jintr/dist/nodes/BlockStatement.js var BlockStatement = class extends BaseJSNode { run() { for (const stmt of this.node.body) { const result = this.visitor.visitNode(stmt); if (stmt.type === "ReturnStatement") return result; if (result === "$jintr_break_" || result === "$jintr_continue_") return result; if ((stmt.type === "WhileStatement" || stmt.type === "IfStatement" || stmt.type === "ForStatement" || stmt.type === "TryStatement") && !!result) { return result; } } } }; __name(BlockStatement, "BlockStatement"); // node_modules/jintr/dist/nodes/BreakStatement.js var BreakStatement = class extends BaseJSNode { run() { return "$jintr_break_"; } }; __name(BreakStatement, "BreakStatement"); // node_modules/jintr/dist/nodes/CallExpression.js var __classPrivateFieldGet = function(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _CallExpression_instances; var _CallExpression_throwError; var _CallExpression_getCalleeString; var builtins = { forEach: (args, target, visitor) => { const arr = target; if (args.length > 1) { visitor.scope.set("_this", args.slice(-1)[0]); } let index = 0; for (const element of arr) { args[0]([element, index++, arr]); } }, toString: (_args, target) => { return target.toString(); } }; var CallExpression = class extends BaseJSNode { constructor() { super(...arguments); _CallExpression_instances.add(this); } run() { let exp_object; let exp_property; if (this.node.callee.type === "MemberExpression") { exp_object = this.visitor.getName(this.node.callee.object); exp_property = this.visitor.getName(this.node.callee.property); } else if (this.node.callee.type === "Identifier") { exp_property = this.node.callee.name; } if (exp_object && this.visitor.listeners[exp_object]) { const cb = this.visitor.listeners[exp_object](this.node, this.visitor); if (cb !== "__continue_exec") { return cb; } } if (exp_property && exp_property !== "toString" && this.visitor.listeners[exp_property]) { const cb = this.visitor.listeners[exp_property](this.node, this.visitor); if (cb !== "__continue_exec") { return cb; } } if (this.node.callee.type === "MemberExpression") { const obj = this.visitor.visitNode(this.node.callee.object); const prop = this.node.callee.computed ? this.visitor.visitNode(this.node.callee.property) : this.visitor.getName(this.node.callee.property); const args2 = this.node.arguments.map((arg) => this.visitor.visitNode(arg)); if (prop in builtins) { return builtins[prop](args2, obj, this.visitor); } if (!obj) __classPrivateFieldGet(this, _CallExpression_instances, "m", _CallExpression_throwError).call(this); if (typeof obj[prop] !== "function") __classPrivateFieldGet(this, _CallExpression_instances, "m", _CallExpression_throwError).call(this); if (obj[prop].toString().includes("[native code]")) return obj[prop](...args2); return obj[prop](args2); } const fn = this.visitor.visitNode(this.node.callee); const args = this.node.arguments.map((arg) => this.visitor.visitNode(arg)); if (typeof fn !== "function") __classPrivateFieldGet(this, _CallExpression_instances, "m", _CallExpression_throwError).call(this); return fn(args); } }; __name(CallExpression, "CallExpression"); _CallExpression_instances = /* @__PURE__ */ new WeakSet(), _CallExpression_throwError = /* @__PURE__ */ __name(function _CallExpression_throwError2() { if (this.node.callee.type === "MemberExpression" || this.node.callee.type === "Identifier") { const callee_string = __classPrivateFieldGet(this, _CallExpression_instances, "m", _CallExpression_getCalleeString).call(this, this.node.callee); throw new JinterError(`${callee_string} is not a function`); } else if (this.node.callee.type === "SequenceExpression") { const call = []; const items = []; call.push("("); this.node.callee.expressions.forEach((expr) => { if (expr.type === "Literal") { items.push(expr.raw || ""); } else if (expr.type === "Identifier") { items.push(expr.name); } else if (expr.type === "MemberExpression") { if (expr.computed) { items.push(`${this.visitor.getName(expr.object)}[${this.visitor.getName(expr.property) || "..."}]`); } else { items.push(`${this.visitor.getName(expr.object)}.${this.visitor.getName(expr.property)}`); } } }); call.push(items.join(", ")); call.push(")"); throw new JinterError(`${call.join("")} is not a function`); } }, "_CallExpression_throwError"), _CallExpression_getCalleeString = /* @__PURE__ */ __name(function _CallExpression_getCalleeString2(node) { if (node.type === "Identifier") { return node.name; } else if (node.type === "MemberExpression") { const object_string = __classPrivateFieldGet(this, _CallExpression_instances, "m", _CallExpression_getCalleeString2).call(this, node.object); const property_string = node.computed ? `[${this.visitor.getName(node.property) || "..."}]` : `.${this.visitor.getName(node.property)}`; return `${object_string}${property_string}`; } return "<unknown>"; }, "_CallExpression_getCalleeString"); // node_modules/jintr/dist/nodes/ConditionalExpression.js var ConditionalExpression = class extends BaseJSNode { run() { const { test, consequent, alternate } = this.node; const check = this.visitor.visitNode(test); if (check) { return this.visitor.visitNode(consequent); } return this.visitor.visitNode(alternate); } }; __name(ConditionalExpression, "ConditionalExpression"); // node_modules/jintr/dist/nodes/ContinueStatement.js var ContinueStatement = class extends BaseJSNode { run() { return "$jintr_continue_"; } }; __name(ContinueStatement, "ContinueStatement"); // node_modules/jintr/dist/nodes/EmptyStatement.js var EmptyStatement = class extends BaseJSNode { run() { return void 0; } }; __name(EmptyStatement, "EmptyStatement"); // node_modules/jintr/dist/nodes/ExpressionStatement.js var ExpressionStatement = class extends BaseJSNode { run() { return this.visitor.visitNode(this.node.expression); } }; __name(ExpressionStatement, "ExpressionStatement"); // node_modules/jintr/dist/nodes/ForOfStatement.js var ForOfStatement = class extends BaseJSNode { run() { this.visitor.visitNode(this.node.left); const right_node = this.visitor.visitNode(this.node.right); for (const el of right_node) { if (this.node.left.type === "VariableDeclaration" && this.node.left.declarations[0].id.type === "Identifier") { this.visitor.scope.set(this.node.left.declarations[0].id.name, el); } else if (this.node.left.type === "VariableDeclaration" && this.node.left.declarations[0].id.type === "ObjectPattern") { for (const propert of this.node.left.declarations[0].id.properties) { if (propert.type === "Property" && (propert.value.type === "Identifier" && propert.key.type === "Identifier")) { this.visitor.scope.set(propert.value.name, el[propert.key.name]); } } } const body = this.visitor.visitNode(this.node.body); if (body === "$jintr_break_") { break; } if (body === "$jintr_continue_") { continue; } if (body && this.node.body.type !== "ExpressionStatement") { return body; } } } }; __name(ForOfStatement, "ForOfStatement"); // node_modules/jintr/dist/nodes/ForStatement.js var ForStatement = class extends BaseJSNode { run() { if (this.node.init) { this.visitor.visitNode(this.node.init); } const test = /* @__PURE__ */ __name(() => { return this.node.test ? this.visitor.visitNode(this.node.test) : true; }, "test"); for (; ; ) { const _test = test(); if (!_test) { break; } const body = this.visitor.visitNode(this.node.body); if (body === "$jintr_continue_") { continue; } if (body === "$jintr_break_") { break; } if (this.node.update) { this.visitor.visitNode(this.node.update); } if (body && this.node.body.type !== "ExpressionStatement") { return body; } } } }; __name(ForStatement, "ForStatement"); // node_modules/jintr/dist/nodes/FunctionDeclaration.js var FunctionDeclaration = class extends BaseJSNode { run() { const { params, body } = this.node; const id = this.visitor.visitNode(this.node.id); const fn = namedFunction(id, (args) => { let index = 0; for (const param of params) { this.visitor.visitNode(param); if (param.type === "Identifier") { this.visitor.scope.set(param.name, args[index]); } else { console.warn("Unhandled param type", param.type); } index++; } return this.visitor.visitNode(body); }); this.visitor.scope.set(id, fn); } }; __name(FunctionDeclaration, "FunctionDeclaration"); // node_modules/jintr/dist/nodes/FunctionExpression.js var FunctionExpression = class extends BaseJSNode { run() { const { params, body } = this.node; const fn = namedFunction("anonymous function", (args) => { let index = 0; for (const param of params) { this.visitor.visitNode(param); if (param.type === "Identifier") { this.visitor.scope.set(param.name, args[index]); } else { console.warn("Unhandled param type", param.type); } index++; } return this.visitor.visitNode(body); }); return fn; } }; __name(FunctionExpression, "FunctionExpression"); // node_modules/jintr/dist/nodes/Identifier.js var Identifier = class extends BaseJSNode { run() { if (this.visitor.listeners[this.node.name]) { const cb = this.visitor.listeners[this.node.name](this.node, this.visitor); if (cb !== "__continue_exec") { return cb; } } if (this.visitor.scope.has(this.node.name)) return this.visitor.scope.get(this.node.name); return this.node.name; } }; __name(Identifier, "Identifier"); // node_modules/jintr/dist/nodes/IfStatement.js var IfStatement = class extends BaseJSNode { run() { const test = this.visitor.visitNode(this.node.test); if (test) { return this.visitor.visitNode(this.node.consequent); } else if (this.node.alternate) { return this.visitor.visitNode(this.node.alternate); } } }; __name(IfStatement, "IfStatement"); // node_modules/jintr/dist/nodes/Literal.js var Literal = class extends BaseJSNode { run() { return this.node.value; } }; __name(Literal, "Literal"); // node_modules/jintr/dist/nodes/LogicalExpression.js var LogicalExpression = class extends BaseJSNode { run() { const { operator, left, right } = this.node; const operation = LogicalExpression.operatorMap[operator]; if (!operation) { console.warn("Unhandled logical operator:", operator); return void 0; } return operation(this.visitor, left, right); } }; __name(LogicalExpression, "LogicalExpression"); LogicalExpression.operatorMap = { "&&": (visitor, leftNode, rightNode) => { const leftValue = visitor.visitNode(leftNode); return leftValue === true ? visitor.visitNode(rightNode) : leftValue; }, "||": (visitor, leftNode, rightNode) => { const leftValue = visitor.visitNode(leftNode); return leftValue || visitor.visitNode(rightNode); }, "??": (visitor, leftNode, rightNode) => { const normalizeUndefined = /* @__PURE__ */ __name((value, isIdentifier) => isIdentifier && value === "undefined" ? void 0 : value, "normalizeUndefined"); const leftValue = normalizeUndefined(visitor.visitNode(leftNode), leftNode.type === "Identifier"); const rightValue = normalizeUndefined(visitor.visitNode(rightNode), rightNode.type === "Identifier"); return leftValue ?? rightValue; } }; // node_modules/jintr/dist/nodes/MemberExpression.js var MemberExpression = class extends BaseJSNode { run() { const { object, property, computed } = this.node; const obj = this.visitor.visitNode(object); const prop = computed ? this.visitor.visitNode(property) : this.visitor.getName(property); if (prop !== void 0 || prop !== null) { if (this.visitor.listeners[prop]) { const cb = this.visitor.listeners[prop](this.node, this.visitor); if (cb !== "__continue_exec") { return cb; } } return obj?.[prop]; } } }; __name(MemberExpression, "MemberExpression"); // node_modules/jintr/dist/nodes/NewExpression.js var NewExpression = class extends BaseJSNode { run() { const callee = this.visitor.visitNode(this.node.callee); const args = this.node.arguments.map((arg) => this.visitor.visitNode(arg)); return args.length ? new callee(args) : new callee(); } }; __name(NewExpression, "NewExpression"); // node_modules/jintr/dist/nodes/ObjectExpression.js var ObjectExpression = class extends BaseJSNode { run() { let result = {}; for (const prop of this.node.properties) { if (prop.type === "Property") { result = { ...result, ...this.visitor.visitNode(prop) }; } else { throw new Error(`Unhandled property type: ${prop.type}`); } } return result; } }; __name(ObjectExpression, "ObjectExpression"); // node_modules/jintr/dist/nodes/Property.js var __classPrivateFieldGet2 = function(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _Property_instances; var _Property_init; var _Property_get; var _Property_set; var Property = class extends BaseJSNode { constructor() { super(...arguments); _Property_instances.add(this); } run() { switch (this.node.kind) { case "init": return __classPrivateFieldGet2(this, _Property_instances, "m", _Property_init).call(this); case "get": return __classPrivateFieldGet2(this, _Property_instances, "m", _Property_get).call(this); case "set": return __classPrivateFieldGet2(this, _Property_instances, "m", _Property_set).call(this); default: throw new Error(`Unhandled property kind: ${this.node.kind}`); } } }; __name(Property, "Property"); _Property_instances = /* @__PURE__ */ new WeakSet(), _Property_init = /* @__PURE__ */ __name(function _Property_init2() { const key = this.node.computed ? this.visitor.visitNode(this.node.key) : this.visitor.getName(this.node.key); const value = this.visitor.visitNode(this.node.value); if (key) { return { [key]: value }; } }, "_Property_init"), _Property_get = /* @__PURE__ */ __name(function _Property_get2() { throw new TypeError("Not implemented: Property.get"); }, "_Property_get"), _Property_set = /* @__PURE__ */ __name(function _Property_set2() { throw new TypeError("Not implemented: Property.set"); }, "_Property_set"); // node_modules/jintr/dist/nodes/ReturnStatement.js var ReturnStatement = class extends BaseJSNode { run() { if (this.node.argument) { return this.visitor.visitNode(this.node.argument); } } }; __name(ReturnStatement, "ReturnStatement"); // node_modules/jintr/dist/nodes/SequenceExpression.js var SequenceExpression = class extends BaseJSNode { run() { let result; for (const expression of this.node.expressions) { result = this.visitor.visitNode(expression); } return result; } }; __name(SequenceExpression, "SequenceExpression"); // node_modules/jintr/dist/nodes/SwitchCase.js var SwitchCase = class extends BaseJSNode { run() { for (const stmt of this.node.consequent) { const result = this.visitor.visitNode(stmt); if (stmt.type === "ContinueStatement" || stmt.type === "BreakStatement") { return result; } } } }; __name(SwitchCase, "SwitchCase"); // node_modules/jintr/dist/nodes/SwitchStatement.js var SwitchStatement = class extends BaseJSNode { run() { const discriminant = this.visitor.visitNode(this.node.discriminant); let matched = false; let default_case = -1; let index = 0; while (true) { const _case = this.node.cases[index]; if (matched) { const result = this.visitor.visitNode(_case); if (result === "$jintr_break_") { break; } if (result === "$jintr_continue_") { return result; } ++index; if (index >= this.node.cases.length) { index = 0; break; } else { continue; } } matched = _case && discriminant === this.visitor.visitNode(_case.test); if (matched === void 0 && index > this.node.cases.length) break; if (_case && !matched && !_case.test) { default_case = index; index += 1; continue; } if (!_case && !matched && default_case !== -1) { matched = true; index = default_case; continue; } if (!matched) { ++index; } } } }; __name(SwitchStatement, "SwitchStatement"); // node_modules/jintr/dist/nodes/TemplateLiteral.js var TemplateLiteral = class extends BaseJSNode { run() { let result = ""; for (let i = 0; i < this.node.quasis.length; ++i) { const quasi = this.node.quasis[i]; if (quasi.type === "TemplateElement") { if (quasi.value.cooked === null) { throw new Error(`Invalid template literal: ${quasi.value.raw}`); } if (quasi.value.cooked !== void 0) { result += quasi.value.cooked; } if (!quasi.tail) { const expr = this.node.expressions[i]; if (expr !== void 0) { result += this.visitor.visitNode(expr); } else { throw new Error(`Expected expression after: ${quasi.value}`); } } } else { throw new Error(`Unhandled quasi type: ${quasi.type}`); } } return result; } }; __name(TemplateLiteral, "TemplateLiteral"); // node_modules/jintr/dist/nodes/ThisExpression.js var ThisExpression = class extends BaseJSNode { run() { return this.visitor.scope.get("_this"); } }; __name(ThisExpression, "ThisExpression"); // node_modules/jintr/dist/nodes/ThrowStatement.js var ThrowStatement = class extends BaseJSNode { run() { const arg = this.visitor.visitNode(this.node.argument); throw arg; } }; __name(ThrowStatement, "ThrowStatement"); // node_modules/jintr/dist/nodes/TryStatement.js var TryStatement = class extends BaseJSNode { run() { try { return this.visitor.visitNode(this.node.block); } catch (e) { if (this.node.handler) { if (this.node.handler.param && this.node.handler.param.type === "Identifier") { this.visitor.scope.set(this.node.handler.param.name, e); } return this.visitor.visitNode(this.node.handler.body); } } finally { this.visitor.visitNode(this.node.finalizer); } } }; __name(TryStatement, "TryStatement"); // node_modules/jintr/dist/nodes/UnaryExpression.js var UnaryExpression = class extends BaseJSNode { static isValidOperator(operator) { return operator in UnaryExpression.operatorMap; } run() { const { operator, argument } = this.node; if (!UnaryExpression.isValidOperator(operator)) { console.warn("Unhandled unary operator:", operator); return void 0; } return UnaryExpression.operatorMap[operator](this.visitor, argument); } }; __name(UnaryExpression, "UnaryExpression"); UnaryExpression.operatorMap = { "-": (visitor, argument) => -visitor.visitNode(argument), "+": (visitor, argument) => +visitor.visitNode(argument), "!": (visitor, argument) => !visitor.visitNode(argument), "~": (visitor, argument) => ~visitor.visitNode(argument), "void": (visitor, argument) => { visitor.visitNode(argument); return void 0; }, "typeof": (visitor, argument) => { const arg = visitor.visitNode(argument); if (argument.type === "Identifier" && arg === "undefined") return "undefined"; return typeof visitor.visitNode(argument); }, "delete": (visitor, argument) => { if (argument.type === "MemberExpression") { const obj = visitor.visitNode(argument.object); const prop = argument.computed ? visitor.visitNode(argument.property) : visitor.getName(argument.property); return delete obj[prop]; } if (argument.type === "Identifier" && visitor.scope.has(argument.name)) { return visitor.scope.delete(argument.name); } return true; } }; // node_modules/jintr/dist/nodes/UpdateExpression.js var UpdateExpression = class extends BaseJSNode { run() { const operator = this.node.operator; switch (operator) { case "++": { if (this.node.argument.type === "MemberExpression") { const target_node = this.visitor.visitNode(this.node.argument.object); return target_node[this.visitor.visitNode(this.node.argument.property)]++; } else if (this.node.argument.type === "Identifier") { let target_node = this.visitor.visitNode(this.node.argument); this.visitor.scope.set(this.node.argument.name, target_node + 1); return this.node.prefix ? ++target_node : target_node; } } break; case "--": { if (this.node.argument.type === "MemberExpression") { const target_node = this.visitor.visitNode(this.node.argument.object); return target_node[this.visitor.visitNode(this.node.argument.property)]--; } else if (this.node.argument.type === "Identifier") { let target_node = this.visitor.visitNode(this.node.argument); this.visitor.scope.set(this.node.argument.name, target_node - 1); return this.node.prefix ? --target_node : target_node; } } break; } } }; __name(UpdateExpression, "UpdateExpression"); // node_modules/jintr/dist/nodes/VariableDeclaration.js var VariableDeclaration = class extends BaseJSNode { run() { this.node.declarations.forEach((declar) => { const { id, init } = declar; const key = this.visitor.getName(id); const value = init ? this.visitor.visitNode(init) : void 0; if (key) this.visitor.scope.set(key, value); if (typeof value === "object" && value !== null) this.visitor.scope.set("_this", value); }); } }; __name(VariableDeclaration, "VariableDeclaration"); // node_modules/jintr/dist/nodes/WhileStatement.js var WhileStatement = class extends BaseJSNode { run() { while (this.visitor.visitNode(this.node.test)) { const body = this.visitor.visitNode(this.node.body); if (body === "$jintr_break_") break; if (body === "$jintr_continue_") continue; if (body) return body; } } }; __name(WhileStatement, "WhileStatement"); // node_modules/jintr/dist/visitor.js var __classPrivateFieldGet3 = function(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _Visitor_instances; var _Visitor_getNode; var Visitor = class { constructor() { _Visitor_instances.add(this); this.scope = /* @__PURE__ */ new Map(); this.listeners = {}; this.ast = []; } setAST(ast) { this.ast = ast; } run() { let result; for (const node of this.ast) { result = this.visitNode(node); } return result; } visitNode(node) { if (!node) return null; const targetNode = __classPrivateFieldGet3(this, _Visitor_instances, "m", _Visitor_getNode).call(this, node.type); if (targetNode) { const instance = new targetNode(node, this); return instance.run(); } return null; } getName(node) { if (node.type === "Identifier") return node.name; else if (node.type === "Literal") return node.value; } on(node_name, listener) { this.listeners[node_name] = listener; } }; __name(Visitor, "Visitor"); _Visitor_instances = /* @__PURE__ */ new WeakSet(), _Visitor_getNode = /* @__PURE__ */ __name(function _Visitor_getNode2(type) { const node = nodes_exports[type]; if (!node) { console.warn("[JINTER]:", `JavaScript node "${type}" not implemented! If this is causing unexpected behavior, please report it at https://github.com/LuanRT/Jinter/issues/new`); } return node; }, "_Visitor_getNode"); // node_modules/acorn/dist/acorn.mjs var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191]; var nonASCIIidentifierChars = "\u200C\u200D\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\u0898-\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-\u1ACE\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"; var nonASCIIidentifierStartChars = "\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-\u088E\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\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\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-\u1C88\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-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\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"; var reservedWords = { 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", 5: "class enum extends super const export import", 6: "enum", strict: "implements interface let package private protected public static yield", strictBind: "eval arguments" }; var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; var keywords$1 = { 5: ecma5AndLessKeywords, "5module": ecma5AndLessKeywords + " export import", 6: ecma5AndLessKeywords + " const class extends export import super" }; var keywordRelationalOperator = /^in(stanceof)?$/; var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); function isInAstralSet(code, set) { var pos = 65536; for (var i = 0; i < set.length; i += 2) { pos += set[i]; if (pos > code) { return false; } pos += set[i + 1]; if (pos >= code) { return true; } } return false; } __name(isInAstralSet, "isInAstralSet"); function isIdentifierStart(code, astral) { if (code < 65) { return code === 36; } if (code < 91) { return true; } if (code < 97) { return code === 95; } if (code < 123) { return true; } if (code <= 65535) { return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code)); } if (astral === false) { return false; } return isInAstralSet(code, astralIdentifierStartCodes); } __name(isIdentifierStart, "isIdentifierStart"); function isIdentifierChar(code, astral) { if (code < 48) { return code === 36; } if (code < 58) { return true; } if (code < 65) { return false; } if (code < 91) { return true; } if (code < 97) { return code === 95; } if (code < 123) { return true; } if (code <= 65535) { return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code)); } if (astral === false) { return false; } return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); } __name(isIdentifierChar, "isIdentifierChar"); var TokenType = /* @__PURE__ */ __name(function TokenType2(label, conf) { if (conf === void 0) conf = {}; this.label = label; this.keyword = conf.keyword; this.beforeExpr = !!conf.beforeExpr; this.startsExpr = !!conf.startsExpr; this.isLoop = !!conf.isLoop; this.isAssign = !!conf.isAssign; this.prefix = !!conf.prefix; this.postfix = !!conf.postfix; this.binop = conf.binop || null; this.updateContext = null; }, "TokenType"); function binop(name, prec) { return new TokenType(name, { beforeExpr: true, binop: prec }); } __name(binop, "binop"); var beforeExpr = { beforeExpr: true }; var startsExpr = { startsExpr: true }; var keywords = {}; function kw(name, options) { if (options === void 0) options = {}; options.keyword = name; return keywords[name] = new TokenType(name, options); } __name(kw, "kw"); var types$1 = { num: new TokenType("num", startsExpr), regexp: new TokenType("regexp", startsExpr), string: new TokenType("string", startsExpr), name: new TokenType("name", startsExpr), privateId: new