hydra-pitschpatsch
Version:
Creates a mini gui for hydra-synth
1,475 lines (1,468 loc) • 560 kB
JavaScript
/*!
* hydra-pitschpatsch v1.1.1
* Creates a mini gui for hydra-synth
*
* @author Milan Gress
* @license ISC
* @repository https://github.com/milangress/hydra-mini-gui-pitschpatsch
*/
var __create = Object.create;
var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __toESM = (mod, isNodeMode, target) => {
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: () => mod[key],
enumerable: true
});
return to;
};
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
// node_modules/astravel/dist/defaultTraveler.js
var require_defaultTraveler = __commonJS((exports) => {
(function(global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.defaultTraveler = mod.exports;
}
})(exports, function(exports2) {
exports2.__esModule = true;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var ForInStatement = undefined, FunctionDeclaration = undefined, RestElement = undefined, BinaryExpression = undefined, ArrayExpression = undefined;
var ignore = Function.prototype;
var Found = function Found(node, state) {
_classCallCheck(this, Found);
this.node = node;
this.state = state;
};
exports2.default = {
go: function go(node, state) {
this[node.type](node, state);
},
find: function find(predicate, node, state) {
var finder = Object.create(this);
finder.go = function(node2, state2) {
if (predicate(node2, state2)) {
throw new Found(node2, state2);
}
this[node2.type](node2, state2);
};
try {
finder.go(node, state);
} catch (error) {
if (error instanceof Found) {
return error;
} else {
throw error;
}
}
},
makeChild: function makeChild() {
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var traveler = Object.create(this);
traveler.super = this;
for (var key in properties) {
traveler[key] = properties[key];
}
return traveler;
},
Program: function Program(node, state) {
var statements = node.body, length = statements.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(statements[i2], state);
}
},
BlockStatement: function BlockStatement(node, state) {
var statements = node.body;
if (statements != null) {
for (var i2 = 0, length = statements.length;i2 < length; i2++) {
this.go(statements[i2], state);
}
}
},
EmptyStatement: ignore,
ExpressionStatement: function ExpressionStatement(node, state) {
this.go(node.expression, state);
},
IfStatement: function IfStatement(node, state) {
this.go(node.test, state);
this.go(node.consequent, state);
if (node.alternate != null) {
this.go(node.alternate, state);
}
},
LabeledStatement: function LabeledStatement(node, state) {
this.go(node.label, state);
this.go(node.body, state);
},
BreakStatement: function BreakStatement(node, state) {
if (node.label) {
this.go(node.label, state);
}
},
ContinueStatement: function ContinueStatement(node, state) {
if (node.label) {
this.go(node.label, state);
}
},
WithStatement: function WithStatement(node, state) {
this.go(node.object, state);
this.go(node.body, state);
},
SwitchStatement: function SwitchStatement(node, state) {
this.go(node.discriminant, state);
var cases = node.cases, length = cases.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(cases[i2], state);
}
},
SwitchCase: function SwitchCase(node, state) {
if (node.test != null) {
this.go(node.test, state);
}
var statements = node.consequent, length = statements.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(statements[i2], state);
}
},
ReturnStatement: function ReturnStatement(node, state) {
if (node.argument) {
this.go(node.argument, state);
}
},
ThrowStatement: function ThrowStatement(node, state) {
this.go(node.argument, state);
},
TryStatement: function TryStatement(node, state) {
this.go(node.block, state);
if (node.handler != null) {
this.go(node.handler, state);
}
if (node.finalizer != null) {
this.go(node.finalizer, state);
}
},
CatchClause: function CatchClause(node, state) {
if (node.param != null) {
this.go(node.param, state);
}
this.go(node.body, state);
},
WhileStatement: function WhileStatement(node, state) {
this.go(node.test, state);
this.go(node.body, state);
},
DoWhileStatement: function DoWhileStatement(node, state) {
this.go(node.body, state);
this.go(node.test, state);
},
ForStatement: function ForStatement(node, state) {
if (node.init != null) {
this.go(node.init, state);
}
if (node.test != null) {
this.go(node.test, state);
}
if (node.update != null) {
this.go(node.update, state);
}
this.go(node.body, state);
},
ForInStatement: ForInStatement = function ForInStatement(node, state) {
this.go(node.left, state);
this.go(node.right, state);
this.go(node.body, state);
},
DebuggerStatement: ignore,
FunctionDeclaration: FunctionDeclaration = function FunctionDeclaration(node, state) {
if (node.id != null) {
this.go(node.id, state);
}
var params = node.params;
if (params != null) {
for (var i2 = 0, length = params.length;i2 < length; i2++) {
this.go(params[i2], state);
}
}
this.go(node.body, state);
},
VariableDeclaration: function VariableDeclaration(node, state) {
var declarations = node.declarations, length = declarations.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(declarations[i2], state);
}
},
VariableDeclarator: function VariableDeclarator(node, state) {
this.go(node.id, state);
if (node.init != null) {
this.go(node.init, state);
}
},
ArrowFunctionExpression: function ArrowFunctionExpression(node, state) {
var params = node.params;
if (params != null) {
for (var i2 = 0, length = params.length;i2 < length; i2++) {
this.go(params[i2], state);
}
}
this.go(node.body, state);
},
ThisExpression: ignore,
ArrayExpression: ArrayExpression = function ArrayExpression(node, state) {
var elements = node.elements, length = elements.length;
for (var i2 = 0;i2 < length; i2++) {
var element = elements[i2];
if (element != null) {
this.go(elements[i2], state);
}
}
},
ObjectExpression: function ObjectExpression(node, state) {
var properties = node.properties, length = properties.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(properties[i2], state);
}
},
Property: function Property(node, state) {
this.go(node.key, state);
if (!node.shorthand) {
this.go(node.value, state);
}
},
FunctionExpression: FunctionDeclaration,
SequenceExpression: function SequenceExpression(node, state) {
var expressions = node.expressions, length = expressions.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(expressions[i2], state);
}
},
UnaryExpression: function UnaryExpression(node, state) {
this.go(node.argument, state);
},
UpdateExpression: function UpdateExpression(node, state) {
this.go(node.argument, state);
},
AssignmentExpression: function AssignmentExpression(node, state) {
this.go(node.left, state);
this.go(node.right, state);
},
BinaryExpression: BinaryExpression = function BinaryExpression(node, state) {
this.go(node.left, state);
this.go(node.right, state);
},
LogicalExpression: BinaryExpression,
ConditionalExpression: function ConditionalExpression(node, state) {
this.go(node.test, state);
this.go(node.consequent, state);
this.go(node.alternate, state);
},
NewExpression: function NewExpression(node, state) {
this.CallExpression(node, state);
},
CallExpression: function CallExpression(node, state) {
this.go(node.callee, state);
var args = node["arguments"], length = args.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(args[i2], state);
}
},
MemberExpression: function MemberExpression(node, state) {
this.go(node.object, state);
this.go(node.property, state);
},
Identifier: ignore,
Literal: ignore,
ForOfStatement: ForInStatement,
ClassDeclaration: function ClassDeclaration(node, state) {
if (node.id) {
this.go(node.id, state);
}
if (node.superClass) {
this.go(node.superClass, state);
}
this.go(node.body, state);
},
ClassBody: function ClassBody(node, state) {
var body = node.body, length = body.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(body[i2], state);
}
},
ImportDeclaration: function ImportDeclaration(node, state) {
var specifiers = node.specifiers, length = specifiers.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(specifiers[i2], state);
}
this.go(node.source, state);
},
ImportNamespaceSpecifier: function ImportNamespaceSpecifier(node, state) {
this.go(node.local, state);
},
ImportDefaultSpecifier: function ImportDefaultSpecifier(node, state) {
this.go(node.local, state);
},
ImportSpecifier: function ImportSpecifier(node, state) {
this.go(node.imported, state);
this.go(node.local, state);
},
ExportDefaultDeclaration: function ExportDefaultDeclaration(node, state) {
this.go(node.declaration, state);
},
ExportNamedDeclaration: function ExportNamedDeclaration(node, state) {
if (node.declaration) {
this.go(node.declaration, state);
}
var specifiers = node.specifiers, length = specifiers.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(specifiers[i2], state);
}
if (node.source) {
this.go(node.source, state);
}
},
ExportSpecifier: function ExportSpecifier(node, state) {
this.go(node.local, state);
this.go(node.exported, state);
},
ExportAllDeclaration: function ExportAllDeclaration(node, state) {
this.go(node.source, state);
},
MethodDefinition: function MethodDefinition(node, state) {
this.go(node.key, state);
this.go(node.value, state);
},
ClassExpression: function ClassExpression(node, state) {
this.ClassDeclaration(node, state);
},
Super: ignore,
RestElement: RestElement = function RestElement(node, state) {
this.go(node.argument, state);
},
SpreadElement: RestElement,
YieldExpression: function YieldExpression(node, state) {
if (node.argument) {
this.go(node.argument, state);
}
},
TaggedTemplateExpression: function TaggedTemplateExpression(node, state) {
this.go(node.tag, state);
this.go(node.quasi, state);
},
TemplateLiteral: function TemplateLiteral(node, state) {
var { quasis, expressions } = node;
for (var i2 = 0, length = expressions.length;i2 < length; i2++) {
this.go(expressions[i2], state);
}
for (var _i = 0, _length = quasis.length;_i < _length; _i++) {
this.go(quasis[_i], state);
}
},
TemplateElement: ignore,
ObjectPattern: function ObjectPattern(node, state) {
var properties = node.properties, length = properties.length;
for (var i2 = 0;i2 < length; i2++) {
this.go(properties[i2], state);
}
},
ArrayPattern: ArrayExpression,
AssignmentPattern: function AssignmentPattern(node, state) {
this.go(node.left, state);
this.go(node.right, state);
},
MetaProperty: function MetaProperty(node, state) {
this.go(node.meta, state);
this.go(node.property, state);
},
AwaitExpression: function AwaitExpression(node, state) {
this.go(node.argument, state);
}
};
});
});
// node_modules/astravel/dist/attachComments.js
var require_attachComments = __commonJS((exports) => {
(function(global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "./defaultTraveler"], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require_defaultTraveler());
} else {
var mod = {
exports: {}
};
factory(mod.exports, global.defaultTraveler);
global.attachComments = mod.exports;
}
})(exports, function(exports2, _defaultTraveler) {
exports2.__esModule = true;
exports2.default = function(node, comments) {
customTraveler[node.type](node, {
comments,
index: 0
});
return node;
};
var _defaultTraveler2 = _interopRequireDefault(_defaultTraveler);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function attachComments(parent, children, findHeadingComments, state, traveler) {
var { index, comments } = state;
var comment = comments[index];
var boundComments = undefined, trailingComments = undefined;
if (comment != null) {
if (children == null || children.length === 0) {
boundComments = parent.comments != null ? parent.comments : [];
while (comment != null && comment.end < parent.end) {
boundComments.push(comment);
comment = comments[++index];
}
state.index = index;
if (boundComments.length !== 0 && parent.comments == null)
parent.comments = boundComments;
} else {
if (findHeadingComments) {
boundComments = parent.comments != null ? parent.comments : [];
var start = children[0].start;
while (comment != null && comment.type[0] === "B" && comment.end < start) {
boundComments.push(comment);
comment = comments[++index];
}
if (boundComments.length !== 0 && parent.comments == null)
parent.comments = boundComments;
}
for (var i2 = 0, length = children.length;comment != null && i2 < length; i2++) {
var child = children[i2];
boundComments = [];
while (comment != null && comment.end < child.start) {
boundComments.push(comment);
comment = comments[++index];
}
if (comment != null && comment.type[0] === "L") {
if (comment.loc.start.line === child.loc.end.line) {
boundComments.push(comment);
comment = comments[++index];
}
}
if (boundComments.length !== 0)
child.comments = boundComments;
state.index = index;
traveler[child.type](child, state);
index = state.index;
comment = comments[index];
}
trailingComments = [];
while (comment != null && comment.end < parent.end) {
trailingComments.push(comment);
comment = comments[++index];
}
if (trailingComments.length !== 0)
parent.trailingComments = trailingComments;
state.index = index;
}
}
}
var Program = undefined;
var customTraveler = _defaultTraveler2.default.makeChild({
Program: Program = function Program(node, state) {
attachComments(node, node.body, true, state, this);
},
BlockStatement: Program,
ObjectExpression: function ObjectExpression(node, state) {
attachComments(node, node.properties, true, state, this);
},
ArrayExpression: function ArrayExpression(node, state) {
attachComments(node, node.elements, true, state, this);
},
SwitchStatement: function SwitchStatement(node, state) {
attachComments(node, node.cases, false, state, this);
},
SwitchCase: function SwitchCase(node, state) {
attachComments(node, node.consequent, false, state, this);
}
});
});
});
// node_modules/astravel/dist/astravel.js
var require_astravel = __commonJS((exports) => {
(function(global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "./defaultTraveler", "./attachComments"], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require_defaultTraveler(), require_attachComments());
} else {
var mod = {
exports: {}
};
factory(mod.exports, global.defaultTraveler, global.attachComments);
global.astravel = mod.exports;
}
})(exports, function(exports2, _defaultTraveler, _attachComments) {
exports2.__esModule = true;
exports2.makeTraveler = exports2.attachComments = exports2.defaultTraveler = undefined;
var _defaultTraveler2 = _interopRequireDefault(_defaultTraveler);
var _attachComments2 = _interopRequireDefault(_attachComments);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function makeTraveler(properties) {
return _defaultTraveler2.default.makeChild(properties);
}
exports2.defaultTraveler = _defaultTraveler2.default;
exports2.attachComments = _attachComments2.default;
exports2.makeTraveler = makeTraveler;
});
});
// src/utils/logger.ts
class Logger {
static isEnabled = true;
static getCallerInfo() {
const error = new Error;
const stack = error.stack?.split(`
`)[3] || "";
const match = stack.match(/at\s+(?:.*\s+\()?(.+):(\d+):(\d+)/);
if (match) {
const url = document?.currentScript?.src || "http://localhost:3000/hydra-pitschpatsch.js";
const [, , line] = match;
return url + ":" + line;
}
return "[unknown source]";
}
static log(...args) {
if (this.isEnabled) {
const source = this.getCallerInfo();
console.log(source, ...args);
}
}
static error(...args) {
if (this.isEnabled) {
const source = this.getCallerInfo();
console.error(source, ...args);
}
}
static setEnabled(enabled) {
this.isEnabled = enabled;
}
}
// node_modules/@preact/signals-core/dist/signals-core.module.js
var i = Symbol.for("preact-signals");
function t() {
if (!(s > 1)) {
var i2, t2 = false;
while (h !== undefined) {
var r = h;
h = undefined;
f++;
while (r !== undefined) {
var o = r.o;
r.o = undefined;
r.f &= -3;
if (!(8 & r.f) && c(r))
try {
r.c();
} catch (r2) {
if (!t2) {
i2 = r2;
t2 = true;
}
}
r = o;
}
}
f = 0;
s--;
if (t2)
throw i2;
} else
s--;
}
var o = undefined;
var h = undefined;
var s = 0;
var f = 0;
var v = 0;
function e(i2) {
if (o !== undefined) {
var t2 = i2.n;
if (t2 === undefined || t2.t !== o) {
t2 = { i: 0, S: i2, p: o.s, n: undefined, t: o, e: undefined, x: undefined, r: t2 };
if (o.s !== undefined)
o.s.n = t2;
o.s = t2;
i2.n = t2;
if (32 & o.f)
i2.S(t2);
return t2;
} else if (t2.i === -1) {
t2.i = 0;
if (t2.n !== undefined) {
t2.n.p = t2.p;
if (t2.p !== undefined)
t2.p.n = t2.n;
t2.p = o.s;
t2.n = undefined;
o.s.n = t2;
o.s = t2;
}
return t2;
}
}
}
function u(i2) {
this.v = i2;
this.i = 0;
this.n = undefined;
this.t = undefined;
}
u.prototype.brand = i;
u.prototype.h = function() {
return true;
};
u.prototype.S = function(i2) {
if (this.t !== i2 && i2.e === undefined) {
i2.x = this.t;
if (this.t !== undefined)
this.t.e = i2;
this.t = i2;
}
};
u.prototype.U = function(i2) {
if (this.t !== undefined) {
var { e: t2, x: r } = i2;
if (t2 !== undefined) {
t2.x = r;
i2.e = undefined;
}
if (r !== undefined) {
r.e = t2;
i2.x = undefined;
}
if (i2 === this.t)
this.t = r;
}
};
u.prototype.subscribe = function(i2) {
var t2 = this;
return E(function() {
var r = t2.value, n = o;
o = undefined;
try {
i2(r);
} finally {
o = n;
}
});
};
u.prototype.valueOf = function() {
return this.value;
};
u.prototype.toString = function() {
return this.value + "";
};
u.prototype.toJSON = function() {
return this.value;
};
u.prototype.peek = function() {
var i2 = o;
o = undefined;
try {
return this.value;
} finally {
o = i2;
}
};
Object.defineProperty(u.prototype, "value", { get: function() {
var i2 = e(this);
if (i2 !== undefined)
i2.i = this.i;
return this.v;
}, set: function(i2) {
if (i2 !== this.v) {
if (f > 100)
throw new Error("Cycle detected");
this.v = i2;
this.i++;
v++;
s++;
try {
for (var r = this.t;r !== undefined; r = r.x)
r.t.N();
} finally {
t();
}
}
} });
function d(i2) {
return new u(i2);
}
function c(i2) {
for (var t2 = i2.s;t2 !== undefined; t2 = t2.n)
if (t2.S.i !== t2.i || !t2.S.h() || t2.S.i !== t2.i)
return true;
return false;
}
function a(i2) {
for (var t2 = i2.s;t2 !== undefined; t2 = t2.n) {
var r = t2.S.n;
if (r !== undefined)
t2.r = r;
t2.S.n = t2;
t2.i = -1;
if (t2.n === undefined) {
i2.s = t2;
break;
}
}
}
function l(i2) {
var t2 = i2.s, r = undefined;
while (t2 !== undefined) {
var o2 = t2.p;
if (t2.i === -1) {
t2.S.U(t2);
if (o2 !== undefined)
o2.n = t2.n;
if (t2.n !== undefined)
t2.n.p = o2;
} else
r = t2;
t2.S.n = t2.r;
if (t2.r !== undefined)
t2.r = undefined;
t2 = o2;
}
i2.s = r;
}
function y(i2) {
u.call(this, undefined);
this.x = i2;
this.s = undefined;
this.g = v - 1;
this.f = 4;
}
(y.prototype = new u).h = function() {
this.f &= -3;
if (1 & this.f)
return false;
if ((36 & this.f) == 32)
return true;
this.f &= -5;
if (this.g === v)
return true;
this.g = v;
this.f |= 1;
if (this.i > 0 && !c(this)) {
this.f &= -2;
return true;
}
var i2 = o;
try {
a(this);
o = this;
var t2 = this.x();
if (16 & this.f || this.v !== t2 || this.i === 0) {
this.v = t2;
this.f &= -17;
this.i++;
}
} catch (i3) {
this.v = i3;
this.f |= 16;
this.i++;
}
o = i2;
l(this);
this.f &= -2;
return true;
};
y.prototype.S = function(i2) {
if (this.t === undefined) {
this.f |= 36;
for (var t2 = this.s;t2 !== undefined; t2 = t2.n)
t2.S.S(t2);
}
u.prototype.S.call(this, i2);
};
y.prototype.U = function(i2) {
if (this.t !== undefined) {
u.prototype.U.call(this, i2);
if (this.t === undefined) {
this.f &= -33;
for (var t2 = this.s;t2 !== undefined; t2 = t2.n)
t2.S.U(t2);
}
}
};
y.prototype.N = function() {
if (!(2 & this.f)) {
this.f |= 6;
for (var i2 = this.t;i2 !== undefined; i2 = i2.x)
i2.t.N();
}
};
Object.defineProperty(y.prototype, "value", { get: function() {
if (1 & this.f)
throw new Error("Cycle detected");
var i2 = e(this);
this.h();
if (i2 !== undefined)
i2.i = this.i;
if (16 & this.f)
throw this.v;
return this.v;
} });
function w(i2) {
return new y(i2);
}
function _(i2) {
var r = i2.u;
i2.u = undefined;
if (typeof r == "function") {
s++;
var n = o;
o = undefined;
try {
r();
} catch (t2) {
i2.f &= -2;
i2.f |= 8;
g(i2);
throw t2;
} finally {
o = n;
t();
}
}
}
function g(i2) {
for (var t2 = i2.s;t2 !== undefined; t2 = t2.n)
t2.S.U(t2);
i2.x = undefined;
i2.s = undefined;
_(i2);
}
function p(i2) {
if (o !== this)
throw new Error("Out-of-order effect");
l(this);
o = i2;
this.f &= -2;
if (8 & this.f)
g(this);
t();
}
function b(i2) {
this.x = i2;
this.u = undefined;
this.s = undefined;
this.o = undefined;
this.f = 32;
}
b.prototype.c = function() {
var i2 = this.S();
try {
if (8 & this.f)
return;
if (this.x === undefined)
return;
var t2 = this.x();
if (typeof t2 == "function")
this.u = t2;
} finally {
i2();
}
};
b.prototype.S = function() {
if (1 & this.f)
throw new Error("Cycle detected");
this.f |= 1;
this.f &= -9;
_(this);
a(this);
s++;
var i2 = o;
o = this;
return p.bind(this, i2);
};
b.prototype.N = function() {
if (!(2 & this.f)) {
this.f |= 2;
this.o = h;
h = this;
}
};
b.prototype.d = function() {
this.f |= 8;
if (!(1 & this.f))
g(this);
};
function E(i2) {
var t2 = new b(i2);
try {
t2.c();
} catch (i3) {
t2.d();
throw i3;
}
return t2.d.bind(t2);
}
// 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, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 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, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 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, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 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, 229, 29, 3, 0, 496, 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 = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";
var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";
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 i2 = 0;i2 < set.length; i2 += 2) {
pos += set[i2];
if (pos > code) {
return false;
}
pos += set[i2 + 1];
if (pos >= code) {
return true;
}
}
return false;
}
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);
}
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);
}
var TokenType = function TokenType2(label, conf) {
if (conf === undefined)
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;
};
function binop(name, prec) {
return new TokenType(name, { beforeExpr: true, binop: prec });
}
var beforeExpr = { beforeExpr: true };
var startsExpr = { startsExpr: true };
var keywords = {};
function kw(name, options) {
if (options === undefined)
options = {};
options.keyword = name;
return keywords[name] = new TokenType(name, options);
}
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 TokenType("privateId", startsExpr),
eof: new TokenType("eof"),
bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
bracketR: new TokenType("]"),
braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
braceR: new TokenType("}"),
parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
questionDot: new TokenType("?."),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
invalidTemplate: new TokenType("invalidTemplate"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
prefix: new TokenType("!/~", { beforeExpr: true, prefix: true, startsExpr: true }),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=/===/!==", 6),
relational: binop("</>/<=/>=", 7),
bitShift: binop("<</>>/>>>", 8),
plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10),
starstar: new TokenType("**", { beforeExpr: true }),
coalesce: binop("??", 1),
_break: kw("break"),
_case: kw("case", beforeExpr),
_catch: kw("catch"),
_continue: kw("continue"),
_debugger: kw("debugger"),
_default: kw("default", beforeExpr),
_do: kw("do", { isLoop: true, beforeExpr: true }),
_else: kw("else", beforeExpr),
_finally: kw("finally"),
_for: kw("for", { isLoop: true }),
_function: kw("function", startsExpr),
_if: kw("if"),
_return: kw("return", beforeExpr),
_switch: kw("switch"),
_throw: kw("throw", beforeExpr),
_try: kw("try"),
_var: kw("var"),
_const: kw("const"),
_while: kw("while", { isLoop: true }),
_with: kw("with"),
_new: kw("new", { beforeExpr: true, startsExpr: true }),
_this: kw("this", startsExpr),
_super: kw("super", startsExpr),
_class: kw("class", startsExpr),
_extends: kw("extends", beforeExpr),
_export: kw("export"),
_import: kw("import", startsExpr),
_null: kw("null", startsExpr),
_true: kw("true", startsExpr),
_false: kw("false", startsExpr),
_in: kw("in", { beforeExpr: true, binop: 7 }),
_instanceof: kw("instanceof", { beforeExpr: true, binop: 7 }),
_typeof: kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }),
_void: kw("void", { beforeExpr: true, prefix: true, startsExpr: true }),
_delete: kw("delete", { beforeExpr: true, prefix: true, startsExpr: true })
};
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
var lineBreakG = new RegExp(lineBreak.source, "g");
function isNewLine(code) {
return code === 10 || code === 13 || code === 8232 || code === 8233;
}
function nextLineBreak(code, from, end) {
if (end === undefined)
end = code.length;
for (var i2 = from;i2 < end; i2++) {
var next = code.charCodeAt(i2);
if (isNewLine(next)) {
return i2 < end - 1 && next === 13 && code.charCodeAt(i2 + 1) === 10 ? i2 + 2 : i2 + 1;
}
}
return -1;
}
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
var ref = Object.prototype;
var hasOwnProperty = ref.hasOwnProperty;
var toString = ref.toString;
var hasOwn = Object.hasOwn || function(obj, propName) {
return hasOwnProperty.call(obj, propName);
};
var isArray = Array.isArray || function(obj) {
return toString.call(obj) === "[object Array]";
};
var regexpCache = Object.create(null);
function wordsRegexp(words) {
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
}
function codePointToString(code) {
if (code <= 65535) {
return String.fromCharCode(code);
}
code -= 65536;
return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
}
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
var Position = function Position2(line, col) {
this.line = line;
this.column = col;
};
Position.prototype.offset = function offset(n) {
return new Position(this.line, this.column + n);
};
var SourceLocation = function SourceLocation2(p2, start, end) {
this.start = start;
this.end = end;
if (p2.sourceFile !== null) {
this.source = p2.sourceFile;
}
};
function getLineInfo(input, offset2) {
for (var line = 1, cur = 0;; ) {
var nextBreak = nextLineBreak(input, cur, offset2);
if (nextBreak < 0) {
return new Position(line, offset2 - cur);
}
++line;
cur = nextBreak;
}
}
var defaultOptions = {
ecmaVersion: null,
sourceType: "script",
onInsertedSemicolon: null,
onTrailingComma: null,
allowReserved: null,
allowReturnOutsideFunction: false,
allowImportExportEverywhere: false,
allowAwaitOutsideFunction: null,
allowSuperOutsideMethod: null,
allowHashBang: false,
checkPrivateFields: true,
locations: false,
onToken: null,
onComment: null,
ranges: false,
program: null,
sourceFile: null,
directSourceFile: null,
preserveParens: false
};
var warnedAboutEcmaVersion = false;
function getOptions(opts) {
var options = {};
for (var opt in defaultOptions) {
options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt];
}
if (options.ecmaVersion === "latest") {
options.ecmaVersion = 1e8;
} else if (options.ecmaVersion == null) {
if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
warnedAboutEcmaVersion = true;
console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
Defaulting to 2020, but this will stop working in the future.`);
}
options.ecmaVersion = 11;
} else if (options.ecmaVersion >= 2015) {
options.ecmaVersion -= 2009;
}
if (options.allowReserved == null) {
options.allowReserved = options.ecmaVersion < 5;
}
if (!opts || opts.allowHashBang == null) {
options.allowHashBang = options.ecmaVersion >= 14;
}
if (isArray(options.onToken)) {
var tokens = options.onToken;
options.onToken = function(token) {
return tokens.push(token);
};
}
if (isArray(options.onComment)) {
options.onComment = pushComment(options, options.onComment);
}
return options;
}
function pushComment(options, array) {
return function(block, text, start, end, startLoc, endLoc) {
var comment = {
type: block ? "Block" : "Line",
value: text,
start,
end
};
if (options.locations) {
comment.loc = new SourceLocation(this, startLoc, endLoc);
}
if (options.ranges) {
comment.range = [start, end];
}
array.push(comment);
};
}
var SCOPE_TOP = 1;
var SCOPE_FUNCTION = 2;
var SCOPE_ASYNC = 4;
var SCOPE_GENERATOR = 8;
var SCOPE_ARROW = 16;
var SCOPE_SIMPLE_CATCH = 32;
var SCOPE_SUPER = 64;
var SCOPE_DIRECT_SUPER = 128;
var SCOPE_CLASS_STATIC_BLOCK = 256;
var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
function functionFlags(async, generator) {
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
}
var BIND_NONE = 0;
var BIND_VAR = 1;
var BIND_LEXICAL = 2;
var BIND_FUNCTION = 3;
var BIND_SIMPLE_CATCH = 4;
var BIND_OUTSIDE = 5;
var Parser = function Parser2(options, input, startPos) {
this.options = options = getOptions(options);
this.sourceFile = options.sourceFile;
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
var reserved = "";
if (options.allowReserved !== true) {
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
if (options.sourceType === "module") {
reserved += " await";
}
}
this.reservedWords = wordsRegexp(reserved);
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
this.reservedWordsStrict = wordsRegexp(reservedStrict);
this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
this.input = String(input);
this.containsEsc = false;
if (startPos) {
this.pos = startPos;
this.lineStart = this.input.lastIndexOf(`
`, startPos - 1) + 1;
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
} else {
this.pos = this.lineStart = 0;
this.curLine = 1;
}
this.type = types$1.eof;
this.value = null;
this.start = this.end = this.pos;
this.startLoc = this.endLoc = this.curPosition();
this.lastTokEndLoc = this.lastTokStartLoc = null;
this.lastTokStart = this.lastTokEnd = this.pos;
this.context = this.initialContext();
this.exprAllowed = true;
this.inModule = options.sourceType === "module";
this.strict = this.inModule || this.strictDirective(this.pos);
this.potentialArrowAt = -1;
this.potentialArrowInForAwait = false;
this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
this.labels = [];
this.undefinedExports = Object.create(null);
if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") {
this.skipLineComment(2);
}
this.scopeStack = [];
this.enterScope(SCOPE_TOP);
this.regexpState = null;
this.privateNameStack = [];
};
var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } };
Parser.prototype.parse = function parse() {
var node = this.options.program || this.startNode();
this.nextToken();
return this.parseTopLevel(node);
};
prototypeAccessors.inFunction.get = function() {
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
};
prototypeAccessors.inGenerator.get = function() {
return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit;
};
prototypeAccessors.inAsync.get = function() {
return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit;
};
prototypeAccessors.canAwait.get = function() {
for (var i2 = this.scopeStack.length - 1;i2 >= 0; i2--) {
var scope = this.scopeStack[i2];
if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) {
return false;
}
if (scope.flags & SCOPE_FUNCTION) {
return (scope.flags & SCOPE_ASYNC) > 0;
}
}
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
};
prototypeAccessors.allowSuper.get = function() {
var ref2 = this.currentThisScope();
var flags = ref2.flags;
var inClassFieldInit = ref2.inClassFieldInit;
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod;
};
prototypeAccessors.allowDirectSuper.get = function() {
return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0;
};
prototypeAccessors.treatFunctionsAsVar.get = function() {
return this.treatFunctionsAsVarInScope(this.currentScope());
};
prototypeAccessors.allowNewDotTarget.get = function() {
var ref2 = this.currentThisScope();
var flags = ref2.flags;
var inClassFieldInit = ref2.inClassFieldInit;
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit;
};
prototypeAccessors.inClassStaticBlock.get = function() {
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0;
};
Parser.extend = function extend() {
var plugins = [], len = arguments.length;
while (len--)
plugins[len] = arguments[len];
var cls = this;
for (var i2 = 0;i2 < plugins.length; i2++) {
cls = plugins[i2](cls);
}
return cls;
};
Parser.parse = function parse2(input, options) {
return new this(options, input).parse();
};
Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) {
var parser = new this(options, input, pos);
parser.nextToken();
return parser.parseExpression();
};
Parser.tokenizer = function tokenizer(input, options) {
return new this(options, input);
};
Object.defineProperties(Parser.prototype, prototypeAccessors);
var pp$9 = Parser.prototype;
var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
pp$9.strictDirective = function(start) {
if (this.options.ecmaVersion < 5) {
return false;
}
for (;; ) {
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
var match = literal.exec(this.input.slice(start));
if (!match) {
return false;
}
if ((match[1] || match[2]) === "use strict") {
skipWhiteSpace.lastIndex = start + match[0].length;
var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
var next = this.input.charAt(end);
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=");
}
start += match[0].length;
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
if (this.input[start] === ";") {
start++;
}
}
};
pp$9.eat = function(type) {
if (this.type === type) {
this.next();
return true;
} else {
return false;
}
};
pp$9.isContextual = function(name) {
return this.type === types$1.name && this.value === name && !this.containsEsc;
};
pp$9.eatContextual = function(name) {
if (!this.isContextual(name)) {
return false;
}
this.next();
return true;
};
pp$9.expectContextual = function(name) {
if (!this.eatContextual(name)) {
this.unexpected();
}
};
pp$9.canInsertSemicolon = function() {
return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
};
pp$9.insertSemicolon = function() {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon) {
this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
}
return true;
}
};
pp$9.semicolon = function() {
if (!this.eat(types$1.semi) && !this.insertSemicolon()) {
this.unexpected();
}
};
pp$9.afterTrailingComma = function(tokType, notNext) {
if (this.type === tokType) {
if (this.options.onTrailingComma) {
this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
}
if (!notNext) {
this.next();
}
return true;
}
};
pp