From 2dd9c21a965ae2a511b07ba5a80d5fcbf21bf6cd Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Tue, 16 Jul 2024 16:20:28 -0600 Subject: [PATCH 01/14] Add typescript types to bin --- .npmignore | 1 + bin/peggy-cli.js | 313 ++++++++++++++++++++++++++++--------- bin/tsconfig.json | 7 +- bin/watcher.js | 2 +- docs/js/test-bundle.min.js | 2 +- package.json | 4 +- pnpm-lock.yaml | 103 +++++------- test/cli/run.spec.ts | 10 +- web-test/package.json | 2 +- 9 files changed, 298 insertions(+), 146 deletions(-) diff --git a/.npmignore b/.npmignore index 5ce03fd2..ded54418 100644 --- a/.npmignore +++ b/.npmignore @@ -29,3 +29,4 @@ tsconfig*.json web-test/ yarn.lock pnpm-workspace.yaml +bin/tsconfig.json diff --git a/bin/peggy-cli.js b/bin/peggy-cli.js index 78de666f..c2a4e657 100644 --- a/bin/peggy-cli.js +++ b/bin/peggy-cli.js @@ -4,6 +4,7 @@ const { Command, CommanderError, InvalidArgumentError, Option, } = require("commander"); const Module = require("module"); +const assert = require("assert"); const fs = require("fs"); const path = require("path"); const peggy = require("../lib/peg.js"); @@ -13,32 +14,89 @@ exports.CommanderError = CommanderError; exports.InvalidArgumentError = InvalidArgumentError; // Options that aren't for the API directly: -const PROG_OPTIONS = ["ast", "input", "output", "sourceMap", "startRule", "test", "testFile", "verbose"]; +const PROG_OPTIONS = ["ast", "dts", "dtsType", "input", "output", "sourceMap", "startRule", "test", "testFile", "verbose"]; const MODULE_FORMATS = ["amd", "bare", "commonjs", "es", "globals", "umd"]; const MODULE_FORMATS_WITH_DEPS = ["amd", "commonjs", "es", "umd"]; const MODULE_FORMATS_WITH_GLOBAL = ["globals", "umd"]; // Helpers +/** + * + * @param {unknown} er + * @returns {asserts er is Error} + */ +function isER(er) { + // Can't use instanceof Error because of vm stuff. + assert.equal(typeof er, "object"); +} + +/** + * @param {unknown} er + * @returns {er is NodeJS.ErrnoException} + */ +function isErrno(er) { + return (er instanceof Error) + && (Object.prototype.hasOwnProperty.call(er, "code")); +} + +/** + * @param {CliOptions} obj Object to select from + * @param {string[]} sel + * @returns {ProgOptions} + */ function select(obj, sel) { const ret = Object.create(null); for (const s of sel) { if (Object.prototype.hasOwnProperty.call(obj, s)) { + // @ts-ignore ret[s] = obj[s]; + // @ts-ignore delete obj[s]; } } return ret; } +/** + * Add comma-separated values to array. + * + * @param {string} val Comma-separated + * @param {string[]?} prev Previous value + * @returns {string[]} + */ function commaArg(val, prev) { return (prev || []).concat(val.split(",").map(x => x.trim())); } +/** + * @param {string} val + * @param {object} [prev = {}] + * @returns {object} + */ +function moreJSON(val, prev = {}) { + try { + const v = JSON.parse(val); + return Object.assign(prev, v); + } catch (e) { + isER(e); + throw new InvalidArgumentError( + `Error parsing JSON: ${e.message}` + ); + } +} + // Files +/** + * Read a UTF8-encoded binary stream to completion. + * + * @param {Readable} inputStream + * @returns {Promise} + */ function readStream(inputStream) { return new Promise((resolve, reject) => { + /** @type {Buffer[]} */ const input = []; inputStream.on("data", data => { input.push(data); }); inputStream.on("end", () => resolve(Buffer.concat(input).toString())); @@ -46,14 +104,10 @@ function readStream(inputStream) { }); } -function readFile(name) { - try { - return fs.readFileSync(name, "utf8"); - } catch (e) { - throw new InvalidArgumentError(`Can't read from file "${name}".`, e); - } -} - +/** + * @param {string} filename + * @returns {Promise} + */ async function ensureDirectoryExists(filename) { const dir = path.dirname(filename); try { @@ -62,18 +116,31 @@ async function ensureDirectoryExists(filename) { throw new Error(`"${dir}" exists and is not a directory`); } } catch (er) { - if (er.code !== "ENOENT") { + if (isErrno(er) && (er.code !== "ENOENT")) { throw er; } await fs.promises.mkdir(dir, { recursive: true }); } } +/** + * @typedef {object} TTYWritable + * @property {boolean} [isTTY] + */ + +/** + * @typedef {import("node:stream").Writable & TTYWritable} Writable + */ + +/** + * @typedef {import("node:stream").Readable} Readable + */ + /** * @typedef {object} Stdio - * @property {stream.Readable} [in] StdIn. - * @property {stream.Writable} [out] StdOut. - * @property {stream.Writable} [err] StdErr. + * @property {Readable} in StdIn. + * @property {Writable} out StdOut. + * @property {Writable} err StdErr. */ /** @@ -86,6 +153,37 @@ async function ensureDirectoryExists(filename) { * @property {string} [message] Error message, only used internally. */ +/** + * @typedef {object} CliOnlyOptions + * @property {boolean} [library] + * @property {string} [startRule] + * @property {string[]} [allowedStartRules] + * @property {string[]} [plugin] + * @property {string[]} [dependency] + * @property {Record} [dependencies] + * @property {string} [exportVar] + * @property {import("@peggyjs/from-mem").SourceFormat} format + * @property {boolean} [watch] + */ + +/** + * @typedef {object} ProgOptions + * @property {boolean} [ast] + * @property {string|boolean} [dts] + * @property {string} [dtsType] + * @property {string} [input] + * @property {string} [output] + * @property {boolean|string} [sourceMap] + * @property {string} [startRule] + * @property {string} [test] + * @property {string} [testFile] + * @property {boolean} [verbose] + */ + +/** + * @typedef {peggy.BuildOptionsBase & CliOnlyOptions & ProgOptions} CliOptions + */ + // Command line processing class PeggyCLI extends Command { /** @@ -104,13 +202,13 @@ class PeggyCLI extends Command { ...stdio, }; - /** @type {peggy.BuildOptionsBase} */ + /** @type {CliOptions} */ this.argv = Object.create(null); /** @type {string[]} */ this.inputFiles = []; - /** @type {string?} */ - this.outputFile = null; - /** @type {object} */ + /** @type {string|undefined} */ + this.outputFile = undefined; + /** @type {ProgOptions} */ this.progOptions = Object.create(null); /** @type {string?} */ this.testFile = null; @@ -118,12 +216,14 @@ class PeggyCLI extends Command { this.testGrammarSource = null; /** @type {string?} */ this.testText = null; - /** @type {string?} */ - this.outputJS = null; + /** @type {string|undefined} */ + this.outputJS = undefined; /** @type {string?} */ this.lastError = null; /** @type {import('./watcher.js')?} */ this.watcher = null; + /** @type {string?} */ + this.dtsFile = null; this .version(peggy.VERSION, "-v, --version") @@ -143,7 +243,7 @@ class PeggyCLI extends Command { "Output a grammar AST instead of a parser code" ) .default(false) - .conflicts(["test", "testFile", "sourceMap"]) + .conflicts(["dts", "test", "testFile", "sourceMap"]) ) .option( "--cache", @@ -158,14 +258,16 @@ class PeggyCLI extends Command { .option( "-D, --dependencies ", "Dependencies, in JSON object format with variable:module pairs. (Can be specified multiple times).", - (val, prev = {}) => { - try { - const v = JSON.parse(val); - return Object.assign(prev, v); - } catch (e) { - throw new InvalidArgumentError(`Error parsing JSON: ${e.message}`); - } - } + moreJSON + ) + .option( + "--dts [filename]", + "Create a .d.ts to describe the generated parser." + ) + .option( + "--dtsType ", + "Types returned for rules, as JSON object of the form {\"rule\": \"type\"}", + moreJSON ) .option( "-e, --export-var ", @@ -179,8 +281,8 @@ class PeggyCLI extends Command { .option( "-c, --extra-options-file ", "File with additional options (in JSON as an object or commonjs module format) to pass to peggy.generate", - (val, prev) => prev.concat(val), - [] + (val, /** @type {string[]} */prev) => prev.concat(val), + /** @type {string[]} */[] ) .addOption( new Option( @@ -190,7 +292,10 @@ class PeggyCLI extends Command { .choices(MODULE_FORMATS) .default("commonjs") ) - .addOption(new Option("--library").hideHelp(), "Run tests in library mode. Maintainers only, for now.") + .addOption(new Option( + "--library", + "Run tests in library mode. Maintainers only, for now." + ).hideHelp()) .option("-o, --output ", "Output file for generated parser. Use '-' for stdout (the default is a file next to the input file with the extension change to '.js', unless a test is specified, in which case no parser is output without this option)") .option( "--plugin ", @@ -228,11 +333,18 @@ class PeggyCLI extends Command { try { const eOpts = await import(path.resolve(val)); this.addExtraOptions(eOpts.default, "extra-options-file"); - } catch (e) { - this.error(`Error importing config "${val}": ${e.message}`); + } catch (error) { + isER(error); + this.error(`Error importing config "${val}"`, { error }); } } else { - this.addExtraOptionsJSON(readFile(val), "extra-options-file"); + try { + const json = await fs.promises.readFile(val, "utf8"); + this.addExtraOptionsJSON(json, "extra-options-file"); + } catch (error) { + isER(error); + this.error(`Error reading "${val}"`, { error }); + } } } delete opts.extraOptionsFile; @@ -246,11 +358,13 @@ class PeggyCLI extends Command { } if ((typeof this.argv.startRule === "string") + && this.argv.allowedStartRules && !this.argv.allowedStartRules.includes(this.argv.startRule)) { this.argv.allowedStartRules.push(this.argv.startRule); } - if (this.argv.allowedStartRules.length === 0) { + if (this.argv.allowedStartRules + && (this.argv.allowedStartRules.length === 0)) { // [] is an invalid input, as is null // undefined doesn't work as a default in commander delete this.argv.allowedStartRules; @@ -279,12 +393,14 @@ class PeggyCLI extends Command { if (typeof mod.use !== "function") { this.error(`Invalid plugin "${id}", no \`use()\` function`); } - } catch (e) { - if ((e.code === "ERR_MODULE_NOT_FOUND") - || (e.code === "MODULE_NOT_FOUND")) { - this.error(`importing: ${e.message}`); + } catch (error) { + if (isErrno(error) + && ((error.code === "ERR_MODULE_NOT_FOUND") + || (error.code === "MODULE_NOT_FOUND"))) { + this.error(`importing "${id}"`, { error }); } else { - this.error(`importing "${id}":\n${e.stack}`); + isER(error); + this.error(`importing "${id}":\n${error.stack}`); } } return mod; @@ -315,7 +431,7 @@ class PeggyCLI extends Command { } this.progOptions = select(this.argv, PROG_OPTIONS); - this.argv.output = "source"; + this.argv.output = "ast"; if ((this.args.length === 0) && this.progOptions.input) { // Allow command line to override config file. this.inputFiles = Array.isArray(this.progOptions.input) @@ -355,6 +471,22 @@ class PeggyCLI extends Command { this.outputJS = path.join(process.cwd(), "stdout.js"); } } + + if (this.progOptions.dts) { + if (typeof this.progOptions.dts === "string") { + this.dtsFile = this.progOptions.dts; + } else { + if (this.outputFile === "-") { + this.error("Must supply output file with --dts"); + } + this.dtsFile = this.outputFile.slice( + 0, + this.outputFile.length + - path.extname(this.outputFile).length + ) + ".d.ts"; + } + } + // If CLI parameter was defined, enable source map generation if (this.progOptions.sourceMap !== undefined) { if (!this.progOptions.output @@ -362,8 +494,6 @@ class PeggyCLI extends Command { this.error("Generation of the source map is not useful if you don't output a parser file, perhaps you forgot to add an `-o/--output` option?"); } - this.argv.output = "source-and-map"; - // If source map name is not specified, calculate it if (this.progOptions.sourceMap === true) { this.progOptions.sourceMap = this.outputFile === "-" ? "source.map" : this.outputFile + ".map"; @@ -374,10 +504,6 @@ class PeggyCLI extends Command { } } - if (this.progOptions.ast) { - this.argv.output = "ast"; - } - // Empty string is a valid test input. Don't just test for falsy. if (typeof this.progOptions.test === "string") { this.testText = this.progOptions.test; @@ -407,22 +533,25 @@ class PeggyCLI extends Command { * @param {string} message The message to print. * @param {ErrorOptions} [opts] Options */ + // @ts-expect-error Commander has this returning `never`, which isn't quite right error(message, opts = {}) { opts = { code: "peggy.invalidArgument", exitCode: 1, - error: null, + error: undefined, sources: [], ...opts, }; if (opts.error) { - if (typeof opts.error.format === "function") { - message = `${message}\n${opts.error.format(opts.sources)}`; + const er = /** @type {peggy.parser.SyntaxError} */(opts.error); + if (typeof er.format === "function") { + const fmt = er.format(/** @type {peggy.SourceText[]} */(opts.sources)); + message = `${message}\n${fmt}`; } else { - message = (this.progOptions.verbose || !opts.error.message) - ? `${message}\n${opts.error.stack}` - : `${message}\n${opts.error.message}`; + message = (this.progOptions.verbose || !er.message) + ? `${message}\n${er.stack}` + : `${message}\n${er.message}`; } } if (!/^error/i.test(message)) { @@ -439,7 +568,7 @@ class PeggyCLI extends Command { /** * Print text and a newline to stdout, using util.format. * - * @param {NodeJS.WriteStream} stream Stream to write to. + * @param {Writable} stream Stream to write to. * @param {...any} args Format arguments. */ static print(stream, ...args) { @@ -471,13 +600,14 @@ class PeggyCLI extends Command { * * @param {string} json JSON as text * @param {string} source Name of option that was the source of the JSON. - * @returns {peggy.BuildOptionsBase} + * @returns {null} */ addExtraOptionsJSON(json, source) { try { const extraOptions = JSON.parse(json); return this.addExtraOptions(extraOptions, source); } catch (e) { + isER(e); throw new InvalidArgumentError(`Error parsing JSON: ${e.message}`); } } @@ -489,7 +619,7 @@ class PeggyCLI extends Command { * * @param {peggy.BuildOptionsBase|peggy.BuildOptionsBase[]|null} extraOptions * @param {string} source - * @returns {peggy.BuildOptionsBase} + * @returns {null} */ addExtraOptions(extraOptions, source) { if ((extraOptions === null) @@ -513,6 +643,10 @@ class PeggyCLI extends Command { return null; } + /** + * + * @returns {Promise} + */ async openOutputStream() { if (this.outputFile === "-") { // Note: empty string is a valid input for testText. @@ -520,8 +654,10 @@ class PeggyCLI extends Command { const hasTest = !this.testFile && (typeof this.testText !== "string"); return hasTest ? this.std.out : null; } + assert(this.outputFile); await ensureDirectoryExists(this.outputFile); return new Promise((resolve, reject) => { + assert(this.outputFile); const outputStream = fs.createWriteStream(this.outputFile); outputStream.on("error", reject); outputStream.on("open", () => resolve(outputStream)); @@ -533,19 +669,23 @@ class PeggyCLI extends Command { * * @param {import("source-map-generator").SourceNode} source The SourceNode * to serialize. - * @returns {Promise} The plain text output. + * @returns {Promise} The + * plain text output. */ async writeSourceMap(source) { if (!this.progOptions.sourceMap) { - return source; + return source.toString(); } let hidden = false; + assert(typeof this.progOptions.sourceMap === "string"); if (this.progOptions.sourceMap.startsWith("hidden:")) { hidden = true; - this.progOptions.sourceMap = this.progOptions.sourceMap.slice(7); + this.progOptions.sourceMap + = this.progOptions.sourceMap.slice(7); } const inline = this.progOptions.sourceMap === "inline"; + assert(this.outputJS); const mapDir = inline ? path.dirname(this.outputJS) : path.dirname(this.progOptions.sourceMap); @@ -557,9 +697,10 @@ class PeggyCLI extends Command { // relative to the map file. Compiler cannot generate right paths, because // it is unaware of the source map location const json = sourceMap.map.toJSON(); - json.sources = json.sources.map( - src => ((src === null) ? null : path.relative(mapDir, src)) - ); + json.sources = json + .sources + .filter(x => x) + .map(src => path.relative(mapDir, src)); if (inline) { // Note: hidden + inline makes no sense. @@ -585,6 +726,12 @@ class PeggyCLI extends Command { `; } + /** + * + * @param {Writable|null} outputStream + * @param {string} source + * @returns {Promise} + */ writeOutput(outputStream, source) { return new Promise((resolve, reject) => { if (!outputStream) { @@ -601,7 +748,7 @@ class PeggyCLI extends Command { } }); } else { - outputStream.end(source, err => { + outputStream.end(source, (/** @type {unknown} */ err) => { if (!err) { resolve(); } @@ -610,6 +757,10 @@ class PeggyCLI extends Command { }); } + /** + * @param {string} source + * @returns {Promise} + */ async test(source) { if (this.testFile) { if (this.testFile === "-") { @@ -629,12 +780,15 @@ class PeggyCLI extends Command { : path.join(process.cwd(), "stdout.js"); // Synthetic const fromMem = require("@peggyjs/from-mem"); - const exec = await fromMem(source, { - filename, - format: this.argv.format, - globalExport: this.argv.exportVar, - }); + const exec = /** @type {import("../lib/peg.js").Parser} */( + await fromMem(source, { + filename, + format: this.argv.format, + }) + ); + + /** @type {import("../lib/peg.js").ParserOptions} */ const opts = { grammarSource: this.testGrammarSource, peg$library: this.peg$library, @@ -653,6 +807,7 @@ class PeggyCLI extends Command { * @returns {Promise} */ async run() { + /** @type {import("../lib/peg.js").SourceText[]} */ const sources = []; let exitCode = 1; @@ -660,7 +815,7 @@ class PeggyCLI extends Command { let prevSource = process.cwd() + "/"; try { for (const source of this.inputFiles) { - const input = { source, text: null }; + const input = { source, text: "" }; errorText = `reading input "${source}"`; this.verbose("CLI", errorText); if (source === "-") { @@ -684,7 +839,12 @@ class PeggyCLI extends Command { errorText = "parsing grammar"; this.verbose("CLI", errorText); - const source = peggy.generate(sources, this.argv); // All of the real work. + + const source = peggy.generate( + sources, + /** @type {import("../lib/peg.js").SourceOptionsBase<"ast">} */ + (this.argv) + ); // All of the real work. errorText = "opening output stream"; this.verbose("CLI", errorText); @@ -695,9 +855,10 @@ class PeggyCLI extends Command { this.verbose("CLI", errorText = "writing AST"); await this.writeOutput(outputStream, JSON.stringify(source, null, 2)); } else { + assert(source.code); errorText = "writing sourceMap"; this.verbose("CLI", errorText); - const mappedSource = await this.writeSourceMap(source); + const mappedSource = await this.writeSourceMap(source.code); errorText = "writing parser"; this.verbose("CLI", errorText); @@ -709,10 +870,11 @@ class PeggyCLI extends Command { await this.test(mappedSource); } } catch (error) { + isER(error); if (this.testGrammarSource) { sources.push({ source: this.testGrammarSource, - text: this.testText, + text: this.testText || "", }); } // Will either exit or throw. @@ -739,7 +901,8 @@ class PeggyCLI extends Command { /** * @deprecated Use parseAsync instead - * @param {string[]} args Arguments + * @param {string[]} [args] Arguments + * @returns {never} */ // eslint-disable-next-line class-methods-use-this parse(args) { @@ -777,10 +940,10 @@ class PeggyCLI extends Command { }); return new Promise((resolve, reject) => { - this.watcher.on("error", er => { + this.watcher?.on("error", er => { reject(er); }); - this.watcher.on("close", () => resolve(0)); + this.watcher?.on("close", () => resolve(0)); }); } else { return this.run(); diff --git a/bin/tsconfig.json b/bin/tsconfig.json index d7d306bd..fa70ddf1 100644 --- a/bin/tsconfig.json +++ b/bin/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../tsconfig-base.json", - "include": ["**/*.js"], + "include": ["**/*.ts", "**/*.js"], "compilerOptions": { - "outDir": "../build/ts-cli" - }, + "checkJs": true, + "target": "ES2021" + } } diff --git a/bin/watcher.js b/bin/watcher.js index ec123b50..be3b624a 100644 --- a/bin/watcher.js +++ b/bin/watcher.js @@ -37,7 +37,7 @@ class Watcher extends EventEmitter { this.watchers = []; for (const dir of dirs) { - const changed = (_typ, fn) => { + const changed = (/** @type {string} */_typ, /** @type {string} */fn) => { if (typeof this.timeout === "symbol") { return; } diff --git a/docs/js/test-bundle.min.js b/docs/js/test-bundle.min.js index 1d1731a7..c18eefa6 100644 --- a/docs/js/test-bundle.min.js +++ b/docs/js/test-bundle.min.js @@ -5,4 +5,4 @@ // Copyright (c) 2024- the Peggy authors // Licensed under the MIT License. -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chai"),require("whatwg-url")):"function"==typeof define&&define.amd?define(["chai","whatwg-url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).chai,e.whatwgURL)}(this,(function(require$$0,require$$0$1){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},GrammarLocation$5=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$5,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$4=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$5=function(e){function t(r,a,n){var o=e.call(this,r)||this;return setProtoOf(o,t.prototype),o.name="GrammarError",o.location=a,void 0===n&&(n=[]),o.diagnostics=n,o.stage=null,o.problems=[["error",r,a,n]],o}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,a=this.diagnostics;r1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,overrides:overrides,pnpm:pnpm,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,overrides:overrides,pnpm:pnpm,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n=18'} - '@peggyjs/from-mem@1.3.0': - resolution: {integrity: sha512-kzGoIRJjkg3KuGI4bopz9UvF3KguzfxalHRDEIdqEZUe45xezsQ6cx30e0RKuxPUexojQRBfu89Okn7f4/QXsw==} + '@peggyjs/from-mem@1.3.3': + resolution: {integrity: sha512-qpwWHRMrF1+39R5jTTx1h6b1B8jBBz2hRpeWS9WF+JkDaAA7A3LB7YLcUZFZTrZ6Grx/EQAVXn+trrPl6HMR3Q==} engines: {node: '>=18'} '@pkgjs/parseargs@0.11.0': @@ -718,8 +718,8 @@ packages: '@types/minimatch@3.0.5': resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} - '@types/node@20.14.10': - resolution: {integrity: sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==} + '@types/node@20.14.11': + resolution: {integrity: sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -1976,10 +1976,6 @@ packages: lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - lru-cache@6.0.0: - resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} - engines: {node: '>=10'} - luxon@3.4.4: resolution: {integrity: sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA==} engines: {node: '>=12'} @@ -2474,11 +2470,6 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true - semver@7.6.0: - resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} - engines: {node: '>=10'} - hasBin: true - semver@7.6.2: resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==} engines: {node: '>=10'} @@ -3206,7 +3197,7 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -3219,14 +3210,14 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.14.10) + jest-config: 29.7.0(@types/node@20.14.11) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -3251,7 +3242,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -3269,7 +3260,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.14.10 + '@types/node': 20.14.11 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -3291,7 +3282,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 20.14.10 + '@types/node': 20.14.11 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -3361,7 +3352,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.14.10 + '@types/node': 20.14.11 '@types/yargs': 17.0.32 chalk: 4.1.2 @@ -3410,9 +3401,9 @@ snapshots: - supports-color - typescript - '@peggyjs/from-mem@1.3.0': + '@peggyjs/from-mem@1.3.3': dependencies: - semver: 7.6.0 + semver: 7.6.2 '@pkgjs/parseargs@0.11.0': optional: true @@ -3624,7 +3615,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 20.14.10 + '@types/node': 20.14.11 '@types/istanbul-lib-coverage@2.0.6': {} @@ -3645,7 +3636,7 @@ snapshots: '@types/minimatch@3.0.5': {} - '@types/node@20.14.10': + '@types/node@20.14.11': dependencies: undici-types: 5.26.5 @@ -4085,13 +4076,13 @@ snapshots: core-util-is@1.0.3: {} - create-jest@29.7.0(@types/node@20.14.10): + create-jest@29.7.0(@types/node@20.14.11): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@20.14.10) + jest-config: 29.7.0(@types/node@20.14.11) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -4761,7 +4752,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.3 @@ -4781,16 +4772,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@20.14.10): + jest-cli@29.7.0(@types/node@20.14.11): dependencies: '@jest/core': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.14.10) + create-jest: 29.7.0(@types/node@20.14.11) exit: 0.1.2 import-local: 3.1.0 - jest-config: 29.7.0(@types/node@20.14.10) + jest-config: 29.7.0(@types/node@20.14.11) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -4800,7 +4791,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@20.14.10): + jest-config@29.7.0(@types/node@20.14.11): dependencies: '@babel/core': 7.24.9 '@jest/test-sequencer': 29.7.0 @@ -4825,7 +4816,7 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 20.14.10 + '@types/node': 20.14.11 transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -4854,7 +4845,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -4864,7 +4855,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 20.14.10 + '@types/node': 20.14.11 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -4903,7 +4894,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -4938,7 +4929,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -4966,7 +4957,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 chalk: 4.1.2 cjs-module-lexer: 1.3.1 collect-v8-coverage: 1.0.2 @@ -5012,7 +5003,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -5031,7 +5022,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.10 + '@types/node': 20.14.11 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -5040,17 +5031,17 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 20.14.10 + '@types/node': 20.14.11 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@20.14.10): + jest@29.7.0(@types/node@20.14.11): dependencies: '@jest/core': 29.7.0 '@jest/types': 29.6.3 import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@20.14.10) + jest-cli: 29.7.0(@types/node@20.14.11) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -5146,10 +5137,6 @@ snapshots: dependencies: yallist: 3.1.1 - lru-cache@6.0.0: - dependencies: - yallist: 4.0.0 - luxon@3.4.4: {} magic-string@0.30.10: @@ -5651,10 +5638,6 @@ snapshots: semver@6.3.1: {} - semver@7.6.0: - dependencies: - lru-cache: 6.0.0 - semver@7.6.2: {} send@0.18.0: @@ -5843,12 +5826,12 @@ snapshots: dependencies: typescript: 5.5.3 - ts-jest@29.2.2(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.10))(typescript@5.5.3): + ts-jest@29.2.2(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.11))(typescript@5.5.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@20.14.10) + jest: 29.7.0(@types/node@20.14.11) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 diff --git a/test/cli/run.spec.ts b/test/cli/run.spec.ts index 5202c064..919016c8 100644 --- a/test/cli/run.spec.ts +++ b/test/cli/run.spec.ts @@ -369,6 +369,10 @@ Options: -D, --dependencies Dependencies, in JSON object format with variable:module pairs. (Can be specified multiple times). + --dts [filename] Create a .d.ts to describe the generated + parser. + --dtsType Types returned for rules, as JSON object of + the form {"rule": "type"} -e, --export-var Name of a global variable into which the parser object is assigned to when no module loader is detected. @@ -694,9 +698,9 @@ Options: await exec({ args: ["--extra-options-file", "____ERROR____FILE_DOES_NOT_EXIST"], stdin: 'foo = "1"', - errorCode: "commander.invalidArgument", + error: CommanderError, exitCode: 1, - error: "Can't read from file", + expected: /Error reading/, }); await exec({ @@ -913,7 +917,7 @@ Options: stdin: "foo = '1'", errorCode: "peggy.invalidArgument", exitCode: 1, - error: "Error importing: Cannot find module", + error: /Error importing/, }); await exec({ diff --git a/web-test/package.json b/web-test/package.json index 1eb22e25..47a32db1 100644 --- a/web-test/package.json +++ b/web-test/package.json @@ -13,7 +13,7 @@ "license": "MIT", "devDependencies": { "@playwright/test": "1.45.2", - "@types/node": "20.14.10" + "@types/node": "20.14.11" }, "engines": { "node": ">=18" From c10542ea1edbc65210b01334baf8e1e60595fe64 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Thu, 18 Jul 2024 14:54:01 -0600 Subject: [PATCH 02/14] Generate .d.ts files from CLI on demand. Fixes #477. --- bin/generated_template.d.ts | 83 ++++++++++++++++++++++++++++++ bin/peggy-cli.js | 95 +++++++++++++++++++++++++---------- test/cli/fixtures/options.mjs | 3 ++ test/cli/run.spec.ts | 59 ++++++++++++++++++++-- 4 files changed, 210 insertions(+), 30 deletions(-) create mode 100644 bin/generated_template.d.ts diff --git a/bin/generated_template.d.ts b/bin/generated_template.d.ts new file mode 100644 index 00000000..f043aeb6 --- /dev/null +++ b/bin/generated_template.d.ts @@ -0,0 +1,83 @@ +export interface FilePosition { + offset: number; + line: number; + column: number; +} +export interface FileRange { + start: FilePosition; + end: FilePosition; + source: string; +} +export interface LiteralExpectation { + type: "literal"; + text: string; + ignoreCase: boolean; +} +export interface ClassParts extends Array { +} +export interface ClassExpectation { + type: "class"; + parts: ClassParts; + inverted: boolean; + ignoreCase: boolean; +} +export interface AnyExpectation { + type: "any"; +} +export interface EndExpectation { + type: "end"; +} +export interface OtherExpectation { + type: "other"; + description: string; +} +export type Expectation = + | AnyExpectation + | ClassExpectation + | EndExpectation + | LiteralExpectation + | OtherExpectation; + +declare class _PeggySyntaxError extends Error { + static buildMessage(expected: Expectation[], found: string | null): string; + message: string; + expected: Expectation[]; + found: string | null; + location: FileRange; + name: string; + constructor( + message: string, + expected: Expectation[], + found: string | null, + location: FileRange, + ); + format(sources: { + source?: any; + text: string; + }[]): string; +} +export interface TraceEvent { + type: string; + rule: string; + result?: any; + location: FileRange; +} +export interface ParserTracer { + trace(event: TraceEvent): void; +} + +export type StartRules = $$$StartRules$$$; +export interface ParseOptions { + grammarSource?: any; + startRule?: T; + tracer?: ParserTracer; + peg$library?: boolean; + peg$currPos?: number; + peg$silentFails?: number; + peg$maxFailExpected?: Expectation[]; + [key: string]: any; +} + +export declare const parse: typeof ParseFunction; +export declare const SyntaxError: typeof _PeggySyntaxError; +export type SyntaxError = _PeggySyntaxError; diff --git a/bin/peggy-cli.js b/bin/peggy-cli.js index c2a4e657..e256e00f 100644 --- a/bin/peggy-cli.js +++ b/bin/peggy-cli.js @@ -14,7 +14,7 @@ exports.CommanderError = CommanderError; exports.InvalidArgumentError = InvalidArgumentError; // Options that aren't for the API directly: -const PROG_OPTIONS = ["ast", "dts", "dtsType", "input", "output", "sourceMap", "startRule", "test", "testFile", "verbose"]; +const PROG_OPTIONS = ["ast", "dts", "returnTypes", "input", "output", "sourceMap", "startRule", "test", "testFile", "verbose"]; const MODULE_FORMATS = ["amd", "bare", "commonjs", "es", "globals", "umd"]; const MODULE_FORMATS_WITH_DEPS = ["amd", "commonjs", "es", "umd"]; const MODULE_FORMATS_WITH_GLOBAL = ["globals", "umd"]; @@ -36,7 +36,7 @@ function isER(er) { * @returns {er is NodeJS.ErrnoException} */ function isErrno(er) { - return (er instanceof Error) + return (typeof er === "object") && (Object.prototype.hasOwnProperty.call(er, "code")); } @@ -169,8 +169,8 @@ async function ensureDirectoryExists(filename) { /** * @typedef {object} ProgOptions * @property {boolean} [ast] - * @property {string|boolean} [dts] - * @property {string} [dtsType] + * @property {string} [dts] + * @property {string} [returnTypes] * @property {string} [input] * @property {string} [output] * @property {boolean|string} [sourceMap] @@ -222,8 +222,6 @@ class PeggyCLI extends Command { this.lastError = null; /** @type {import('./watcher.js')?} */ this.watcher = null; - /** @type {string?} */ - this.dtsFile = null; this .version(peggy.VERSION, "-v, --version") @@ -261,14 +259,9 @@ class PeggyCLI extends Command { moreJSON ) .option( - "--dts [filename]", + "--dts", "Create a .d.ts to describe the generated parser." ) - .option( - "--dtsType ", - "Types returned for rules, as JSON object of the form {\"rule\": \"type\"}", - moreJSON - ) .option( "-e, --export-var ", "Name of a global variable into which the parser object is assigned to when no module loader is detected." @@ -306,6 +299,11 @@ class PeggyCLI extends Command { "-m, --source-map [mapfile]", "Generate a source map. If name is not specified, the source map will be named \".map\" if input is a file and \"source.map\" if input is a standard input. If the special filename `inline` is given, the sourcemap will be embedded in the output file as a data URI. If the filename is prefixed with `hidden:`, no mapping URL will be included so that the mapping can be specified with an HTTP SourceMap: header. This option conflicts with the `-t/--test` and `-T/--test-file` options unless `-o/--output` is also specified" ) + .option( + "--returnTypes ", + "Types returned for rules, as JSON object of the form {\"ruleName\": \"type\"}", + moreJSON + ) .option( "-S, --start-rule ", "When testing, use the given rule as the start rule. If this rule is not in the allowed start rules, it will be added." @@ -434,9 +432,8 @@ class PeggyCLI extends Command { this.argv.output = "ast"; if ((this.args.length === 0) && this.progOptions.input) { // Allow command line to override config file. - this.inputFiles = Array.isArray(this.progOptions.input) - ? this.progOptions.input - : [this.progOptions.input]; + // It can either be a single string or an array of strings. + this.inputFiles = [this.progOptions.input].flat(); } this.outputFile = this.progOptions.output; this.outputJS = this.progOptions.output; @@ -473,18 +470,14 @@ class PeggyCLI extends Command { } if (this.progOptions.dts) { - if (typeof this.progOptions.dts === "string") { - this.dtsFile = this.progOptions.dts; - } else { - if (this.outputFile === "-") { - this.error("Must supply output file with --dts"); - } - this.dtsFile = this.outputFile.slice( - 0, - this.outputFile.length - - path.extname(this.outputFile).length - ) + ".d.ts"; + if (this.outputFile === "-") { + this.error("Must supply output file with --dts"); } + this.dtsFile = this.outputFile.slice( + 0, + this.outputFile.length + - path.extname(this.outputFile).length + ) + ".d.ts"; } // If CLI parameter was defined, enable source map generation @@ -757,6 +750,52 @@ class PeggyCLI extends Command { }); } + /** + * @param {import("../lib/peg.js").ast.Grammar} ast + * @returns {Promise} + */ + async writeDTS(ast) { + if (!this.dtsFile) { + return; + } + let template = await fs.promises.readFile( + path.join(__dirname, "generated_template.d.ts"), "utf8" + ); + let startRules = (this.argv.allowedStartRules || [ast.rules[0].name]); + if (startRules.includes("*")) { + startRules = ast.rules.map(r => r.name); + } + const qsr = startRules.map(r => `"${r}"`); + + template = template.replace("$$$StartRules$$$", qsr.join(" | ")); + template = template.replace("$$$DefaultStartRule$$$", qsr[0]); + + const out = fs.createWriteStream(this.dtsFile); + out.write(template); + + const types = /** @type {Record|undefined} */( + this.progOptions.returnTypes + ) || {}; + for (const sr of startRules) { + out.write(` +export function ParseFunction>( + input: string, + options?: Options, +): ${types[sr] || "any"}; +`); + } + + await /** @type {Promise} */(new Promise((resolve, reject) => { + out.close(er => { + if (er) { + reject(er); + } else { + resolve(); + } + }); + })); + } + /** * @param {string} source * @returns {Promise} @@ -864,6 +903,10 @@ class PeggyCLI extends Command { this.verbose("CLI", errorText); await this.writeOutput(outputStream, mappedSource); + errorText = "writing .d.ts file"; + this.verbose("CLI", errorText); + await this.writeDTS(source); + exitCode = 2; errorText = "running test"; this.verbose("CLI", errorText); diff --git a/test/cli/fixtures/options.mjs b/test/cli/fixtures/options.mjs index a4df805c..60e7f074 100644 --- a/test/cli/fixtures/options.mjs +++ b/test/cli/fixtures/options.mjs @@ -9,4 +9,7 @@ export default { j: "jest", commander: "commander", }, + returnTypes: { + foo: "string", + }, }; diff --git a/test/cli/run.spec.ts b/test/cli/run.spec.ts index 919016c8..3bf9704d 100644 --- a/test/cli/run.spec.ts +++ b/test/cli/run.spec.ts @@ -369,10 +369,8 @@ Options: -D, --dependencies Dependencies, in JSON object format with variable:module pairs. (Can be specified multiple times). - --dts [filename] Create a .d.ts to describe the generated + --dts Create a .d.ts to describe the generated parser. - --dtsType Types returned for rules, as JSON object of - the form {"rule": "type"} -e, --export-var Name of a global variable into which the parser object is assigned to when no module loader is detected. @@ -405,6 +403,8 @@ Options: This option conflicts with the \`-t/--test\` and \`-T/--test-file\` options unless \`-o/--output\` is also specified + --returnTypes Types returned for rules, as JSON object of + the form {"ruleName": "type"} -S, --start-rule When testing, use the given rule as the start rule. If this rule is not in the allowed start rules, it will be added. @@ -1479,5 +1479,56 @@ error: Rule "unknownRule" is not defined const cli = new PeggyCLI(); expect(() => cli.parse([])).toThrow(); }); -}); + describe(".d.ts", () => { + const opts = path.join(__dirname, "fixtures", "options.mjs"); + const grammar = path.join(__dirname, "fixtures", "simple.peggy"); + const grammarJS = path.join(__dirname, "fixtures", "simple.js"); + const grammarDTS = path.join(__dirname, "fixtures", "simple.d.ts"); + + it("creates .d.ts files", async() => { + await exec({ + args: ["--dts", grammar], + exitCode: 0, + }); + const dts = await fs.promises.readFile(grammarDTS, "utf8"); + expect(dts).toMatch(/: any;\n$/); + }); + + it("uses returnTypes", async() => { + await exec({ + args: ["--dts", "-c", opts, grammar], + exitCode: 0, + }); + const dts = await fs.promises.readFile(grammarDTS, "utf8"); + expect(dts).toMatch(/: string;\n$/); + }); + + it("generates overloads for allowed-start-rules='*'", async() => { + await exec({ + args: ["--dts", "-c", opts, "--allowed-start-rules", "*", grammar], + exitCode: 0, + }); + const dts = await fs.promises.readFile(grammarDTS, "utf8"); + expect(dts).toMatch(/: string;\n$/); + }); + + it("errors with dts for stdin", async() => { + await exec({ + args: ["--dts"], + stdin: "foo = '1'", + exitCode: 1, + error: /Must supply output file with --dts/, + }); + }); + + afterAll(() => { + fs.unlink(grammarJS, () => { + // Ignored + }); + fs.unlink(grammarDTS, () => { + // Ignored + }); + }); + }); +}); From 97d47d2a72b5551b23922eeb776fb82bb24a6599 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Thu, 18 Jul 2024 14:56:08 -0600 Subject: [PATCH 03/14] Update dependencies --- .ncurc.cjs | 1 + docs/js/test-bundle.min.js | 2 +- package.json | 4 ++-- pnpm-lock.yaml | 10 +++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.ncurc.cjs b/.ncurc.cjs index ea838b00..61198a9d 100644 --- a/.ncurc.cjs +++ b/.ncurc.cjs @@ -1,6 +1,7 @@ "use strict"; module.exports = { + "dep": ["prod", "dev", "packageManager"], "reject": [ "chai", // Moved to es6 "@types/chai", // Should match chai diff --git a/docs/js/test-bundle.min.js b/docs/js/test-bundle.min.js index c18eefa6..a1c1bbb7 100644 --- a/docs/js/test-bundle.min.js +++ b/docs/js/test-bundle.min.js @@ -5,4 +5,4 @@ // Copyright (c) 2024- the Peggy authors // Licensed under the MIT License. -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chai"),require("whatwg-url")):"function"==typeof define&&define.amd?define(["chai","whatwg-url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).chai,e.whatwgURL)}(this,(function(require$$0,require$$0$1){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},GrammarLocation$5=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$5,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$4=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$5=function(e){function t(r,a,n){var o=e.call(this,r)||this;return setProtoOf(o,t.prototype),o.name="GrammarError",o.location=a,void 0===n&&(n=[]),o.diagnostics=n,o.stage=null,o.problems=[["error",r,a,n]],o}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,a=this.diagnostics;r1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,overrides:overrides,pnpm:pnpm,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,overrides:overrides,pnpm:pnpm,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n=18" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fc4d379e..c3dfc999 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -92,8 +92,8 @@ importers: specifier: ^5.31.3 version: 5.31.3 ts-jest: - specifier: ^29.2.2 - version: 29.2.2(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.11))(typescript@5.5.3) + specifier: ^29.2.3 + version: 29.2.3(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.11))(typescript@5.5.3) tslib: specifier: ^2.6.3 version: 2.6.3 @@ -2657,8 +2657,8 @@ packages: peerDependencies: typescript: '>=4.2.0' - ts-jest@29.2.2: - resolution: {integrity: sha512-sSW7OooaKT34AAngP6k1VS669a0HdLxkQZnlC7T76sckGCokXFnvJ3yRlQZGRTAoV5K19HfSgCiSwWOSIfcYlg==} + ts-jest@29.2.3: + resolution: {integrity: sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==} engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -5826,7 +5826,7 @@ snapshots: dependencies: typescript: 5.5.3 - ts-jest@29.2.2(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.11))(typescript@5.5.3): + ts-jest@29.2.3(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.11))(typescript@5.5.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 From 1a2a771fce21d0f438a2d07d033d8246637d8b3c Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Sat, 20 Jul 2024 09:44:08 -0600 Subject: [PATCH 04/14] Add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51021397..56b632e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ Released: TBD ### New features +- [#477](https://github.com/peggyjs/peggy/issues/477) Option to output .d.ts + files next to .js from CLI. - [#530](https://github.com/peggyjs/peggy/issues/531) Allow es6 plugins from CLI - [#532](https://github.com/peggyjs/peggy/issues/532) Allow es6 options files from the CLI From 04e522cb2e7b5fef9e4683184c5650012f026279 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Sat, 20 Jul 2024 09:44:39 -0600 Subject: [PATCH 05/14] change ts-ignore to ts-expect-error --- bin/peggy-cli.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/peggy-cli.js b/bin/peggy-cli.js index e256e00f..2b5984ab 100644 --- a/bin/peggy-cli.js +++ b/bin/peggy-cli.js @@ -49,9 +49,9 @@ function select(obj, sel) { const ret = Object.create(null); for (const s of sel) { if (Object.prototype.hasOwnProperty.call(obj, s)) { - // @ts-ignore + // @ts-expect-error treating objects like maps ret[s] = obj[s]; - // @ts-ignore + // @ts-expect-error treating objects like maps delete obj[s]; } } From e204162cd99d0a051de6c38b3feeb44c8bd622f6 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Sat, 20 Jul 2024 09:45:15 -0600 Subject: [PATCH 06/14] Make generated types match core peggy types a little better --- bin/generated_template.d.ts | 60 +++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/bin/generated_template.d.ts b/bin/generated_template.d.ts index f043aeb6..b72fd1e5 100644 --- a/bin/generated_template.d.ts +++ b/bin/generated_template.d.ts @@ -1,13 +1,23 @@ -export interface FilePosition { - offset: number; +/** Provides information pointing to a location within a source. */ +export interface Location { + /** Line in the parsed source (1-based). */ line: number; + /** Column in the parsed source (1-based). */ column: number; + /** Offset in the parsed source (0-based). */ + offset: number; } -export interface FileRange { - start: FilePosition; - end: FilePosition; - source: string; + +/** The `start` and `end` position's of an object within the source. */ +export interface LocationRange { + /** Any object that was supplied to the `parse()` call as the `grammarSource` option. */ + source: any; + /** Position at the beginning of the expression. */ + start: Location; + /** Position after the end of the expression. */ + end: Location; } + export interface LiteralExpectation { type: "literal"; text: string; @@ -39,45 +49,65 @@ export type Expectation = | OtherExpectation; declare class _PeggySyntaxError extends Error { + /** + * Constructs the human-readable message from the machine representation. + * + * @param expected Array of expected items, generated by the parser + * @param found Any text that will appear as found in the input instead of + * expected + */ static buildMessage(expected: Expectation[], found: string | null): string; message: string; expected: Expectation[]; found: string | null; - location: FileRange; + location: LocationRange; name: string; constructor( message: string, expected: Expectation[], found: string | null, - location: FileRange, + location: LocationRange, ); format(sources: { source?: any; text: string; }[]): string; } -export interface TraceEvent { - type: string; - rule: string; - result?: any; - location: FileRange; -} + export interface ParserTracer { - trace(event: TraceEvent): void; + trace(event: ParserTracerEvent): void; } +export type ParserTracerEvent + = { type: "rule.enter"; rule: string; location: LocationRange } + | { type: "rule.fail"; rule: string; location: LocationRange } + | { type: "rule.match"; rule: string; result: any; location: LocationRange }; + export type StartRules = $$$StartRules$$$; export interface ParseOptions { + /** + * Object that will be attached to the each `LocationRange` object created by + * the parser. For example, this can be path to the parsed file or even the + * File object. + */ grammarSource?: any; startRule?: T; tracer?: ParserTracer; + + // Internal use only: peg$library?: boolean; + // Internal use only: peg$currPos?: number; + // Internal use only: peg$silentFails?: number; + // Internal use only: peg$maxFailExpected?: Expectation[]; + // Extra application-specific properties [key: string]: any; } export declare const parse: typeof ParseFunction; export declare const SyntaxError: typeof _PeggySyntaxError; export type SyntaxError = _PeggySyntaxError; + +// Overload of ParseFunction for each allowedStartRule From 576c980654c4de98b5164210f11af0a38093114e Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Wed, 24 Jul 2024 14:57:11 -0600 Subject: [PATCH 07/14] Refactor CLI, separate out utilities and option refinement to make main logic easier to see. --- bin/opts.js | 355 +++++++++++++++++++++++ bin/peggy-cli.js | 510 +++++---------------------------- bin/utils.js | 159 ++++++++++ lib/peg.d.ts | 35 ++- test/cli/fixtures/simple.peggy | 2 +- test/cli/fixtures/simple.txt | 1 + test/cli/run.spec.ts | 213 ++++++++------ test/cli/utils.spec.ts | 10 + 8 files changed, 743 insertions(+), 542 deletions(-) create mode 100644 bin/opts.js create mode 100644 bin/utils.js create mode 100644 test/cli/fixtures/simple.txt create mode 100644 test/cli/utils.spec.ts diff --git a/bin/opts.js b/bin/opts.js new file mode 100644 index 00000000..99345985 --- /dev/null +++ b/bin/opts.js @@ -0,0 +1,355 @@ +"use strict"; + +/** + * @fileoverview Functions for extended processing of command line options, + * converting them to the correct types for the Peggy API, etc. + */ + +const assert = require("assert"); +const fs = require("fs"); +const path = require("path"); +const { InvalidArgumentError } = require("commander"); +const { isErrno, isER, replaceExt, select } = require("./utils.js"); + +const MODULE_FORMATS_WITH_DEPS = ["amd", "commonjs", "es", "umd"]; +const MODULE_FORMATS_WITH_GLOBAL = ["globals", "umd"]; + +// Options that aren't for the API directly: +const PROG_OPTIONS = [ + "ast", + "dependency", + "dts", + "extraOptionsFile", + "input", + "library", + "output", + "plugin", + "returnTypes", + "sourceMap", + "test", + "testFile", + "verbose", + "watch", +]; + +/** + * @typedef {object} ProgOptions + * @property {boolean} [ast] + * @property {string[]} [dependency] + * @property {string} [dts] + * @property {string} [dtsFile] + * @property {string[]} [extraOptionsFile] + * @property {string|string[]} [input] + * @property {string[]} inputFiles + * @property {boolean} [library] + * @property {string} [output] + * @property {string[]} [plugin] + * @property {string} [returnTypes] + * @property {boolean|string} [sourceMap] + * @property {string} [test] + * @property {string} [testFile] + * @property {string} [testGrammarSource] + * @property {string} [testText] + * @property {string} [outputFile] + * @property {string} [outputJS] + * @property {boolean} [verbose] + * @property {boolean} [watch] + */ + +/* +Leave these in for the API without change: +allowedStartRules +exportVar +format +startRule +trace +(anything for plugins) +*/ + +/** + * @typedef {import("../lib/peg.js").SourceOptionsBase<"ast">} AstOptions + */ + +/** + * @typedef {AstOptions & ProgOptions} CliOptions + */ + +/** + * @typedef {import('./peggy-cli.js').PeggyCLI} Command + */ + +/** + * Add extra options from a config file, if they haven't already been + * set on the command line. Exception: multi-value options like plugins + * are additive. + * + * @param {Command} cmd + * @param {CliOptions} extraOptions + * @param {string} source + * @returns {null} + */ +function addExtraOptions(cmd, extraOptions, source) { + if ((extraOptions === null) + || (typeof extraOptions !== "object") + || Array.isArray(extraOptions)) { + throw new InvalidArgumentError( + "The JSON with extra options has to represent an object." + ); + } + for (const [k, v] of Object.entries(extraOptions)) { + const prev = cmd.getOptionValue(k); + const src = cmd.getOptionValueSource(k); + if (!src || (src === "default")) { + // Overwrite + cmd.setOptionValueWithSource(k, v, source); + } else if (Array.isArray(prev)) { + // Combine with previous + prev.push(...v); + } else if (typeof prev === "object") { + Object.assign(prev, v); + } + } + return null; +} + +/** + * Get options from a JSON string. + * + * @param {Command} cmd + * @param {string} json JSON as text + * @param {string} source Name of option that was the source of the JSON. + * @returns {null} + */ +function addExtraOptionsJSON(cmd, json, source) { + try { + const extraOptions = JSON.parse(json); + return addExtraOptions(cmd, extraOptions, source); + } catch (e) { + isER(e); + throw new InvalidArgumentError(`Error parsing JSON: ${e.message}`); + } +} + +/** + * Load a config file. + * + * @param {Command} cmd + * @param {string} val + * @return {Promise} + */ +async function loadConfig(cmd, val) { + if (/\.[cm]?js$/.test(val)) { + try { + const eOpts = await import(path.resolve(val)); + addExtraOptions(cmd, eOpts.default, "extra-options-file"); + } catch (error) { + isER(error); + cmd.error(`Error importing config "${val}"`, { error }); + } + } else { + try { + const json = await fs.promises.readFile(val, "utf8"); + addExtraOptionsJSON(cmd, json, "extra-options-file"); + } catch (error) { + isER(error); + cmd.error(`Error reading "${val}"`, { error }); + } + } +} + +/** + * Load a plugin module, if needed. + * + * @param {Command} cmd + * @param {string | PEG.Plugin} val + * @returns {Promise} + */ +async function loadPlugin(cmd, val) { + if (typeof val !== "string") { + return val; + } + + // If this is an absolute or relative path (not a module name) + const id = (path.isAbsolute(val) || /^\.\.?[/\\]/.test(val)) + ? path.resolve(val) + : val; // Otherwise, it's an NPM module + + /** @type {PEG.Plugin=} */ + let plugin = undefined; + try { + const mod = await import(id); + plugin = (typeof mod.use === "function") ? mod : mod.default; + if (typeof plugin?.use !== "function") { + cmd.error(`Invalid plugin "${id}", no \`use()\` function`); + } + } catch (error) { + if (isErrno(error) + && ((error.code === "ERR_MODULE_NOT_FOUND") + || (error.code === "MODULE_NOT_FOUND"))) { + cmd.error(`importing "${id}"`, { error }); + } else { + isER(error); + cmd.error(`importing "${id}":\n${error.stack}`); + } + } + assert(plugin); + return plugin; +} + +/** + * Refine the options given in the CLI into options for `generate` and other + * options that are used for processing outside of grammar generation. + * + * @param {Command} cmd + * @param {string[]} inputFiles + * @param {CliOptions} cliOptions + * @returns {Promise<{parserOptions: AstOptions, progOptions: ProgOptions}>} + */ +async function refineOptions(cmd, inputFiles, cliOptions) { + if (cliOptions.extraOptionsFile) { + // Can't load options from node_modules + for (const val of cliOptions.extraOptionsFile) { + await loadConfig(cmd, val); + } + } + + /** @type {ProgOptions} */ + const progOptions = { + inputFiles, + ...select(cliOptions, PROG_OPTIONS), + }; + + // If files are specified on the command line, they take preference over + // addedOptions with name input. + if (progOptions.input && ( + (inputFiles.length === 0) || ((inputFiles.length) === 1 && (inputFiles[0] === "-")) + )) { + progOptions.inputFiles + = /** @type {string[]} */([]).concat(progOptions.input); + delete progOptions.input; // Don't leave it around to be confusing + } + + if ((typeof cliOptions.startRule === "string") + && cliOptions.allowedStartRules + && !cliOptions.allowedStartRules.includes(cliOptions.startRule)) { + cliOptions.allowedStartRules.push(cliOptions.startRule); + } + + if (cliOptions.allowedStartRules + && (cliOptions.allowedStartRules.length === 0)) { + // [] is an invalid input, as is null + // undefined doesn't work as a default in commander + delete cliOptions.allowedStartRules; + } + + /** @type {AstOptions} */ + const parserOptions = { + format: "commonjs", + ...cliOptions, + output: "ast", + }; + assert(parserOptions.format); + + // Combine plugin/plugins + parserOptions.plugins = await Promise.all([ + ...(parserOptions.plugins || []), // Only from extraOptions file + ...(progOptions.plugin || []), // Mostly from command line + ].map(val => loadPlugin(cmd, val))); + + // Combine dependency/dependencies + parserOptions.dependencies + = /** @type {import("../lib/peg.js").Dependencies} */( + parserOptions.dependencies || Object.create(null) + ); + if (progOptions.dependency) { + for (const dep of progOptions.dependency) { + const [name, val] = dep.split(":"); + parserOptions.dependencies[name] = val ? val : name; + } + } + + if ((Object.keys(parserOptions.dependencies).length > 0) + && !MODULE_FORMATS_WITH_DEPS.includes(parserOptions.format)) { + cmd.error(`Can't use the -d/--dependency or -D/--dependencies options with the "${parserOptions.format}" module format.`); + } + + if (parserOptions.exportVar + && !MODULE_FORMATS_WITH_GLOBAL.includes(parserOptions.format)) { + cmd.error(`Can't use the -e/--export-var option with the "${parserOptions.format}" module format.`); + } + + progOptions.outputFile = progOptions.output; + progOptions.outputJS = progOptions.output; + + if (progOptions.inputFiles.includes("-") && progOptions.watch) { + cmd.error("Can't watch stdin"); + } + + if (!progOptions.outputFile) { + if (!progOptions.inputFiles.includes("-")) { + let inFile = progOptions.inputFiles[0]; + // You might just want to run a fragment grammar as-is, + // particularly with a specified start rule. + const m = inFile.match(/^npm:.*\/([^/]+)$/); + if (m) { + inFile = m[1]; + } + progOptions.outputJS = replaceExt(inFile, ".js"); + progOptions.outputFile = ((typeof progOptions.test !== "string") + && !progOptions.testFile) + ? progOptions.outputJS + : "-"; + } else { + progOptions.outputFile = "-"; + // Synthetic + progOptions.outputJS = path.join(process.cwd(), "stdout.js"); + } + } + + if (progOptions.dts) { + if (progOptions.outputFile === "-") { + cmd.error("Must supply output file with --dts"); + } + progOptions.dtsFile = replaceExt(progOptions.outputFile, ".d.ts"); + } + + // If CLI parameter was defined, enable source map generation + if (progOptions.sourceMap !== undefined) { + if (!progOptions.output + && (progOptions.test || progOptions.testFile)) { + cmd.error("Generation of the source map is not useful if you don't output a parser file, perhaps you forgot to add an `-o/--output` option?"); + } + + // If source map name is not specified, calculate it + if (progOptions.sourceMap === true) { + progOptions.sourceMap = (progOptions.outputFile === "-") + ? "source.map" + : progOptions.outputFile + ".map"; + } + + if (progOptions.sourceMap === "hidden:inline") { + cmd.error("hidden + inline sourceMap makes no sense."); + } + } + + // Empty string is a valid test input. Don't just test for falsy. + if (typeof progOptions.test === "string") { + progOptions.testText = progOptions.test; + progOptions.testGrammarSource = "command line"; + } + if (progOptions.testFile) { + progOptions.testGrammarSource = progOptions.testFile; + } + + return { + parserOptions, + progOptions, + }; +} + +module.exports = { + addExtraOptions, + addExtraOptionsJSON, + refineOptions, +}; + diff --git a/bin/peggy-cli.js b/bin/peggy-cli.js index 2b5984ab..6048d2f3 100644 --- a/bin/peggy-cli.js +++ b/bin/peggy-cli.js @@ -3,6 +3,12 @@ const { Command, CommanderError, InvalidArgumentError, Option, } = require("commander"); +const { + addExtraOptionsJSON, refineOptions, +} = require("./opts.js"); +const { + isER, commaArg, moreJSON, readStream, mkFileDir, +} = require("./utils.js"); const Module = require("module"); const assert = require("assert"); const fs = require("fs"); @@ -13,115 +19,7 @@ const util = require("util"); exports.CommanderError = CommanderError; exports.InvalidArgumentError = InvalidArgumentError; -// Options that aren't for the API directly: -const PROG_OPTIONS = ["ast", "dts", "returnTypes", "input", "output", "sourceMap", "startRule", "test", "testFile", "verbose"]; const MODULE_FORMATS = ["amd", "bare", "commonjs", "es", "globals", "umd"]; -const MODULE_FORMATS_WITH_DEPS = ["amd", "commonjs", "es", "umd"]; -const MODULE_FORMATS_WITH_GLOBAL = ["globals", "umd"]; - -// Helpers - -/** - * - * @param {unknown} er - * @returns {asserts er is Error} - */ -function isER(er) { - // Can't use instanceof Error because of vm stuff. - assert.equal(typeof er, "object"); -} - -/** - * @param {unknown} er - * @returns {er is NodeJS.ErrnoException} - */ -function isErrno(er) { - return (typeof er === "object") - && (Object.prototype.hasOwnProperty.call(er, "code")); -} - -/** - * @param {CliOptions} obj Object to select from - * @param {string[]} sel - * @returns {ProgOptions} - */ -function select(obj, sel) { - const ret = Object.create(null); - for (const s of sel) { - if (Object.prototype.hasOwnProperty.call(obj, s)) { - // @ts-expect-error treating objects like maps - ret[s] = obj[s]; - // @ts-expect-error treating objects like maps - delete obj[s]; - } - } - return ret; -} - -/** - * Add comma-separated values to array. - * - * @param {string} val Comma-separated - * @param {string[]?} prev Previous value - * @returns {string[]} - */ -function commaArg(val, prev) { - return (prev || []).concat(val.split(",").map(x => x.trim())); -} - -/** - * @param {string} val - * @param {object} [prev = {}] - * @returns {object} - */ -function moreJSON(val, prev = {}) { - try { - const v = JSON.parse(val); - return Object.assign(prev, v); - } catch (e) { - isER(e); - throw new InvalidArgumentError( - `Error parsing JSON: ${e.message}` - ); - } -} - -// Files - -/** - * Read a UTF8-encoded binary stream to completion. - * - * @param {Readable} inputStream - * @returns {Promise} - */ -function readStream(inputStream) { - return new Promise((resolve, reject) => { - /** @type {Buffer[]} */ - const input = []; - inputStream.on("data", data => { input.push(data); }); - inputStream.on("end", () => resolve(Buffer.concat(input).toString())); - inputStream.on("error", reject); - }); -} - -/** - * @param {string} filename - * @returns {Promise} - */ -async function ensureDirectoryExists(filename) { - const dir = path.dirname(filename); - try { - const stats = await fs.promises.stat(dir); - if (!stats.isDirectory()) { - throw new Error(`"${dir}" exists and is not a directory`); - } - } catch (er) { - if (isErrno(er) && (er.code !== "ENOENT")) { - throw er; - } - await fs.promises.mkdir(dir, { recursive: true }); - } -} /** * @typedef {object} TTYWritable @@ -132,56 +30,22 @@ async function ensureDirectoryExists(filename) { * @typedef {import("node:stream").Writable & TTYWritable} Writable */ -/** - * @typedef {import("node:stream").Readable} Readable - */ - /** * @typedef {object} Stdio - * @property {Readable} in StdIn. + * @property {import("./utils.js").Readable} in StdIn. * @property {Writable} out StdOut. * @property {Writable} err StdErr. */ /** - * @typedef {object} ErrorOptions - * @property {string} [code="peggy.invalidArgument"] Code for exception if - * throwing. - * @property {number} [exitCode=1] Exit code if exiting. + * @typedef {object} PeggyErrorOptions * @property {peggy.SourceText[]} [sources=[]] Source text for formatting compile errors. * @property {Error} [error] Error to extract message from. * @property {string} [message] Error message, only used internally. */ /** - * @typedef {object} CliOnlyOptions - * @property {boolean} [library] - * @property {string} [startRule] - * @property {string[]} [allowedStartRules] - * @property {string[]} [plugin] - * @property {string[]} [dependency] - * @property {Record} [dependencies] - * @property {string} [exportVar] - * @property {import("@peggyjs/from-mem").SourceFormat} format - * @property {boolean} [watch] - */ - -/** - * @typedef {object} ProgOptions - * @property {boolean} [ast] - * @property {string} [dts] - * @property {string} [returnTypes] - * @property {string} [input] - * @property {string} [output] - * @property {boolean|string} [sourceMap] - * @property {string} [startRule] - * @property {string} [test] - * @property {string} [testFile] - * @property {boolean} [verbose] - */ - -/** - * @typedef {peggy.BuildOptionsBase & CliOnlyOptions & ProgOptions} CliOptions + * @typedef {import("commander").ErrorOptions & PeggyErrorOptions} ErrorOptions */ // Command line processing @@ -202,24 +66,12 @@ class PeggyCLI extends Command { ...stdio, }; - /** @type {CliOptions} */ - this.argv = Object.create(null); - /** @type {string[]} */ - this.inputFiles = []; - /** @type {string|undefined} */ - this.outputFile = undefined; - /** @type {ProgOptions} */ + /** @type {import("../lib/peg.js").SourceOptionsBase<"ast">} */ + this.parserOptions = Object.create(null); + /** @type {import("./opts.js").ProgOptions} */ this.progOptions = Object.create(null); - /** @type {string?} */ - this.testFile = null; - /** @type {string?} */ - this.testGrammarSource = null; - /** @type {string?} */ - this.testText = null; - /** @type {string|undefined} */ - this.outputJS = undefined; - /** @type {string?} */ - this.lastError = null; + /** @type {string=} */ + this.lastError = undefined; /** @type {import('./watcher.js')?} */ this.watcher = null; @@ -269,13 +121,12 @@ class PeggyCLI extends Command { .option( "--extra-options ", "Additional options (in JSON format as an object) to pass to peggy.generate", - val => this.addExtraOptionsJSON(val, "extra-options") + val => addExtraOptionsJSON(this, val, "extra-options") ) .option( "-c, --extra-options-file ", "File with additional options (in JSON as an object or commonjs module format) to pass to peggy.generate", - (val, /** @type {string[]} */prev) => prev.concat(val), - /** @type {string[]} */[] + (val, /** @type {string[]} */prev) => (prev || []).concat(val) ) .addOption( new Option( @@ -325,195 +176,18 @@ class PeggyCLI extends Command { .default(false) ) .action(async(inputFiles, opts) => { // On parse() - // Can't load options from node_modules - for (const val of opts.extraOptionsFile) { - if (/\.[cm]?js$/.test(val)) { - try { - const eOpts = await import(path.resolve(val)); - this.addExtraOptions(eOpts.default, "extra-options-file"); - } catch (error) { - isER(error); - this.error(`Error importing config "${val}"`, { error }); - } - } else { - try { - const json = await fs.promises.readFile(val, "utf8"); - this.addExtraOptionsJSON(json, "extra-options-file"); - } catch (error) { - isER(error); - this.error(`Error reading "${val}"`, { error }); - } - } - } - delete opts.extraOptionsFile; - - this.inputFiles = inputFiles; - this.argv = opts; - - if (this.argv.library) { - this.peg$library = true; - delete this.argv.library; + const { + parserOptions, + progOptions, + } = await refineOptions(this, inputFiles, opts); + if (progOptions.verbose) { + parserOptions.info = (pass, msg) => PeggyCLI.print(this.std.err, `INFO(${pass}): ${msg}`); } - - if ((typeof this.argv.startRule === "string") - && this.argv.allowedStartRules - && !this.argv.allowedStartRules.includes(this.argv.startRule)) { - this.argv.allowedStartRules.push(this.argv.startRule); - } - - if (this.argv.allowedStartRules - && (this.argv.allowedStartRules.length === 0)) { - // [] is an invalid input, as is null - // undefined doesn't work as a default in commander - delete this.argv.allowedStartRules; - } - - // Combine plugin/plugins - if ((this.argv.plugin && (this.argv.plugin.length > 0)) - || (this.argv.plugins && (this.argv.plugins.length > 0))) { - this.argv.plugins = await Promise.all([ - ...(this.argv.plugins || []), - ...(this.argv.plugin || []), - ].map(async val => { - if (typeof val !== "string") { - return val; - } - // If this is an absolute or relative path (not a module name) - const id = (path.isAbsolute(val) || /^\.\.?[/\\]/.test(val)) - ? path.resolve(val) - : val; - let mod = null; - try { - mod = await import(id); - if (typeof mod.use !== "function") { - mod = mod.default; - } - if (typeof mod.use !== "function") { - this.error(`Invalid plugin "${id}", no \`use()\` function`); - } - } catch (error) { - if (isErrno(error) - && ((error.code === "ERR_MODULE_NOT_FOUND") - || (error.code === "MODULE_NOT_FOUND"))) { - this.error(`importing "${id}"`, { error }); - } else { - isER(error); - this.error(`importing "${id}":\n${error.stack}`); - } - } - return mod; - })); - } - delete this.argv.plugin; - - // Combine dependency/dependencies - this.argv.dependencies = this.argv.dependencies || {}; - if (this.argv.dependency) { - if (this.argv.dependency.length > 0) { - for (const dep of this.argv.dependency) { - const [name, val] = dep.split(":"); - this.argv.dependencies[name] = val ? val : name; - } - } - delete this.argv.dependency; - } - - if ((Object.keys(this.argv.dependencies).length > 0) - && !MODULE_FORMATS_WITH_DEPS.includes(this.argv.format)) { - this.error(`Can't use the -d/--dependency or -D/--dependencies options with the "${this.argv.format}" module format.`); - } - - if ((this.argv.exportVar !== undefined) - && !MODULE_FORMATS_WITH_GLOBAL.includes(this.argv.format)) { - this.error(`Can't use the -e/--export-var option with the "${this.argv.format}" module format.`); - } - - this.progOptions = select(this.argv, PROG_OPTIONS); - this.argv.output = "ast"; - if ((this.args.length === 0) && this.progOptions.input) { - // Allow command line to override config file. - // It can either be a single string or an array of strings. - this.inputFiles = [this.progOptions.input].flat(); - } - this.outputFile = this.progOptions.output; - this.outputJS = this.progOptions.output; - - if ((this.inputFiles.includes("-")) && this.argv.watch) { - this.argv.watch = false; // Make error throw. - this.error("Can't watch stdin"); - } - - if (!this.outputFile) { - if (!this.inputFiles.includes("-")) { - let inFile = this.inputFiles[0]; - // You might just want to run a fragment grammar as-is, - // particularly with a specified start rule. - const m = inFile.match(/^npm:.*\/([^/]+)$/); - if (m) { - inFile = m[1]; - } - this.outputJS = inFile.slice( - 0, - inFile.length - - path.extname(inFile).length - ) + ".js"; - - this.outputFile = ((typeof this.progOptions.test !== "string") - && !this.progOptions.testFile) - ? this.outputJS - : "-"; - } else { - this.outputFile = "-"; - // Synthetic - this.outputJS = path.join(process.cwd(), "stdout.js"); - } - } - - if (this.progOptions.dts) { - if (this.outputFile === "-") { - this.error("Must supply output file with --dts"); - } - this.dtsFile = this.outputFile.slice( - 0, - this.outputFile.length - - path.extname(this.outputFile).length - ) + ".d.ts"; - } - - // If CLI parameter was defined, enable source map generation - if (this.progOptions.sourceMap !== undefined) { - if (!this.progOptions.output - && (this.progOptions.test || this.progOptions.testFile)) { - this.error("Generation of the source map is not useful if you don't output a parser file, perhaps you forgot to add an `-o/--output` option?"); - } - - // If source map name is not specified, calculate it - if (this.progOptions.sourceMap === true) { - this.progOptions.sourceMap = this.outputFile === "-" ? "source.map" : this.outputFile + ".map"; - } - - if (this.progOptions.sourceMap === "hidden:inline") { - this.error("hidden + inline sourceMap makes no sense."); - } - } - - // Empty string is a valid test input. Don't just test for falsy. - if (typeof this.progOptions.test === "string") { - this.testText = this.progOptions.test; - this.testGrammarSource = "command line"; - } - if (this.progOptions.testFile) { - this.testFile = this.progOptions.testFile; - this.testGrammarSource = this.progOptions.testFile; - } - this.verbose("PARSER OPTIONS:", this.argv); - this.verbose("PROGRAM OPTIONS:", this.progOptions); - this.verbose('INPUT: "%s"', this.inputFiles); - this.verbose('OUTPUT: "%s"', this.outputFile); - if (this.progOptions.verbose) { - this.argv.info = (pass, msg) => PeggyCLI.print(this.std.err, `INFO(${pass}): ${msg}`); - } - this.argv.warning = (pass, msg) => PeggyCLI.print(this.std.err, `WARN(${pass}): ${msg}`); + parserOptions.warning = (pass, msg) => PeggyCLI.print(this.std.err, `WARN(${pass}): ${msg}`); + this.parserOptions = parserOptions; + this.progOptions = progOptions; + this.verbose("PARSER OPTIONS:", parserOptions); + this.verbose("PROGRAM OPTIONS:", progOptions); }); } @@ -551,7 +225,7 @@ class PeggyCLI extends Command { message = `Error ${message}`; } - if (this.argv.watch) { + if (this.progOptions.watch) { this.lastError = message; } else { super.error(message, opts); @@ -588,70 +262,22 @@ class PeggyCLI extends Command { return true; } - /** - * Get options from a JSON string. - * - * @param {string} json JSON as text - * @param {string} source Name of option that was the source of the JSON. - * @returns {null} - */ - addExtraOptionsJSON(json, source) { - try { - const extraOptions = JSON.parse(json); - return this.addExtraOptions(extraOptions, source); - } catch (e) { - isER(e); - throw new InvalidArgumentError(`Error parsing JSON: ${e.message}`); - } - } - - /** - * Add extra options from a config file, if they haven't already been - * set on the command line. Exception: multi-value options like plugins - * are additive. - * - * @param {peggy.BuildOptionsBase|peggy.BuildOptionsBase[]|null} extraOptions - * @param {string} source - * @returns {null} - */ - addExtraOptions(extraOptions, source) { - if ((extraOptions === null) - || (typeof extraOptions !== "object") - || Array.isArray(extraOptions)) { - throw new InvalidArgumentError("The JSON with extra options has to represent an object."); - } - for (const [k, v] of Object.entries(extraOptions)) { - const prev = this.getOptionValue(k); - const src = this.getOptionValueSource(k); - if (!src || (src === "default")) { - // Overwrite - this.setOptionValueWithSource(k, v, source); - } else if (Array.isArray(prev)) { - // Combine with previous - prev.push(...v); - } else if (typeof prev === "object") { - Object.assign(prev, v); - } - } - return null; - } - /** * * @returns {Promise} */ async openOutputStream() { - if (this.outputFile === "-") { + if (this.progOptions.outputFile === "-") { // Note: empty string is a valid input for testText. // Don't just test for falsy. - const hasTest = !this.testFile && (typeof this.testText !== "string"); + const hasTest = !this.progOptions.testFile && (typeof this.progOptions.testText !== "string"); return hasTest ? this.std.out : null; } - assert(this.outputFile); - await ensureDirectoryExists(this.outputFile); + assert(this.progOptions.outputFile); + await mkFileDir(this.progOptions.outputFile); return new Promise((resolve, reject) => { - assert(this.outputFile); - const outputStream = fs.createWriteStream(this.outputFile); + assert(this.progOptions.outputFile); + const outputStream = fs.createWriteStream(this.progOptions.outputFile); outputStream.on("error", reject); outputStream.on("open", () => resolve(outputStream)); }); @@ -678,12 +304,12 @@ class PeggyCLI extends Command { = this.progOptions.sourceMap.slice(7); } const inline = this.progOptions.sourceMap === "inline"; - assert(this.outputJS); + assert(this.progOptions.outputJS); const mapDir = inline - ? path.dirname(this.outputJS) + ? path.dirname(this.progOptions.outputJS) : path.dirname(this.progOptions.sourceMap); - const file = path.relative(mapDir, this.outputJS); + const file = path.relative(mapDir, this.progOptions.outputJS); const sourceMap = source.toStringWithSourceMap({ file }); // According to specifications, paths in the "sources" array should be @@ -704,7 +330,7 @@ class PeggyCLI extends Command { //\x23 sourceMappingURL=data:application/json;charset=utf-8;base64,${buf.toString("base64")} `; } - await ensureDirectoryExists(this.progOptions.sourceMap); + await mkFileDir(this.progOptions.sourceMap); await fs.promises.writeFile( this.progOptions.sourceMap, JSON.stringify(json), @@ -715,7 +341,7 @@ class PeggyCLI extends Command { } // Opposite direction from mapDir return sourceMap.code + `\ -//# sourceMappingURL=${path.relative(path.dirname(this.outputJS), this.progOptions.sourceMap)} +//\x23 sourceMappingURL=${path.relative(path.dirname(this.progOptions.outputJS), this.progOptions.sourceMap)} `; } @@ -755,13 +381,14 @@ class PeggyCLI extends Command { * @returns {Promise} */ async writeDTS(ast) { - if (!this.dtsFile) { + if (!this.progOptions.dtsFile) { return; } let template = await fs.promises.readFile( path.join(__dirname, "generated_template.d.ts"), "utf8" ); - let startRules = (this.argv.allowedStartRules || [ast.rules[0].name]); + let startRules = this.parserOptions.allowedStartRules + || [ast.rules[0].name]; if (startRules.includes("*")) { startRules = ast.rules.map(r => r.name); } @@ -770,7 +397,7 @@ class PeggyCLI extends Command { template = template.replace("$$$StartRules$$$", qsr.join(" | ")); template = template.replace("$$$DefaultStartRule$$$", qsr[0]); - const out = fs.createWriteStream(this.dtsFile); + const out = fs.createWriteStream(this.progOptions.dtsFile); out.write(template); const types = /** @type {Record|undefined} */( @@ -801,41 +428,35 @@ export function ParseFunction>( * @returns {Promise} */ async test(source) { - if (this.testFile) { - if (this.testFile === "-") { - this.testText = await readStream(this.std.in); + if (this.progOptions.testFile) { + if (this.progOptions.testFile === "-") { + this.progOptions.testText = await readStream(this.std.in); } else { - this.testText = await fs.promises.readFile(this.testFile, "utf8"); + this.progOptions.testText = await fs.promises.readFile(this.progOptions.testFile, "utf8"); } } - if (typeof this.testText === "string") { - this.verbose("TEST TEXT:", this.testText); + if (typeof this.progOptions.testText === "string") { + this.verbose("TEST TEXT:", this.progOptions.testText); // Create a module that exports the parser, then load it from the // correct directory, so that any modules that the parser requires will // be loaded from the correct place. - const filename = this.outputJS - ? path.resolve(this.outputJS) - : path.join(process.cwd(), "stdout.js"); // Synthetic - const fromMem = require("@peggyjs/from-mem"); + assert(this.progOptions.outputJS); const exec = /** @type {import("../lib/peg.js").Parser} */( await fromMem(source, { - filename, - format: this.argv.format, + filename: this.progOptions.outputJS, + format: this.parserOptions.format, }) ); /** @type {import("../lib/peg.js").ParserOptions} */ const opts = { - grammarSource: this.testGrammarSource, - peg$library: this.peg$library, + grammarSource: this.progOptions.testGrammarSource, + peg$library: this.progOptions.library, }; - if (typeof this.progOptions.startRule === "string") { - opts.startRule = this.progOptions.startRule; - } - const results = exec.parse(this.testText, opts); + const results = exec.parse(this.progOptions.testText, opts); PeggyCLI.print(this.std.out, "%O", results); } } @@ -853,7 +474,7 @@ export function ParseFunction>( let errorText = ""; let prevSource = process.cwd() + "/"; try { - for (const source of this.inputFiles) { + for (const source of this.progOptions.inputFiles) { const input = { source, text: "" }; errorText = `reading input "${source}"`; this.verbose("CLI", errorText); @@ -874,15 +495,14 @@ export function ParseFunction>( } // This is wrong. It's a hack in place until source generation is fixed. - this.argv.grammarSource = sources[0].source; + this.parserOptions.grammarSource = sources[0].source; errorText = "parsing grammar"; this.verbose("CLI", errorText); const source = peggy.generate( sources, - /** @type {import("../lib/peg.js").SourceOptionsBase<"ast">} */ - (this.argv) + this.parserOptions ); // All of the real work. errorText = "opening output stream"; @@ -914,10 +534,10 @@ export function ParseFunction>( } } catch (error) { isER(error); - if (this.testGrammarSource) { + if (this.progOptions.testGrammarSource) { sources.push({ - source: this.testGrammarSource, - text: this.testText || "", + source: this.progOptions.testGrammarSource, + text: this.progOptions.testText || "", }); } // Will either exit or throw. @@ -961,10 +581,10 @@ export function ParseFunction>( * @returns {Promise} */ main() { - if (this.argv.watch) { + if (this.progOptions.watch) { const Watcher = require("./watcher.js"); // Lazy: usually not needed. const hasTest = this.progOptions.test || this.progOptions.testFile; - const watchFiles = [...this.inputFiles]; + const watchFiles = [...this.progOptions.inputFiles]; if (this.progOptions.testFile) { watchFiles.push(this.progOptions.testFile); } @@ -972,13 +592,13 @@ export function ParseFunction>( this.watcher.on("change", async fn => { PeggyCLI.print(this.std.err, `"${fn}" changed...`); - this.lastError = null; + this.lastError = undefined; await this.run(); if (this.lastError) { PeggyCLI.print(this.std.err, this.lastError); } else if (!hasTest) { - PeggyCLI.print(this.std.err, `Wrote: "${this.outputFile}"`); + PeggyCLI.print(this.std.err, `Wrote: "${this.progOptions.outputFile}"`); } }); diff --git a/bin/utils.js b/bin/utils.js new file mode 100644 index 00000000..79cc5ecc --- /dev/null +++ b/bin/utils.js @@ -0,0 +1,159 @@ +"use strict"; + +/** + * @fileoverview Utility functions for CLI + */ + +const { InvalidArgumentError } = require("commander"); +const assert = require("assert"); +const fs = require("fs"); +const path = require("path"); + +/** + * @typedef {import("node:stream").Readable} Readable + */ + +/** + * Realistically, in a catch block, the caught thing is an instance of Error. + * When errors are thrown from inside a node vm however, `instanceof` doesn't + * work like we would prefer. Is "er" sufficiently Error-like? If not, + * throw. + * + * @param {unknown} er + * @returns {asserts er is Error} + */ +function isER(er) { + assert(er); + assert.equal(typeof er, "object"); + assert(Object.prototype.hasOwnProperty.call(er, "message")); +} + +/** + * Is this error a node ErrnoException? + * + * @param {unknown} er + * @returns {er is NodeJS.ErrnoException} + */ +function isErrno(er) { + return (Boolean(er) + && (typeof er === "object") + && (Object.prototype.hasOwnProperty.call(er, "code"))); +} + +/** + * Select certain properties from an object, deleting those properties from + * the original object as we go. + * + * @template {object} T + * @param {T} obj Object to select from + * @param {string[]} sel + * @returns {Pick} + */ +function select(obj, sel) { + const ret = Object.create(null); + for (const s of sel) { + if (Object.prototype.hasOwnProperty.call(obj, s)) { + // @ts-expect-error Object is not a map + ret[s] = obj[s]; + // @ts-expect-error Object is not a map + delete obj[s]; + } + } + return ret; +} + +/** + * Add comma-separated values to array. + * + * @param {string} val Comma-separated + * @param {string[]?} prev Previous value + * @returns {string[]} + */ +function commaArg(val, prev) { + return (prev || []).concat(val.split(",").map(x => x.trim())); +} + +/** + * Take a blob of JSON-formatted text, parse it, and add it to an existing + * object. + * + * @param {string} val + * @param {object} [prev = {}] + * @returns {object} + */ +function moreJSON(val, prev = {}) { + try { + const v = JSON.parse(val); + return Object.assign(prev, v); + } catch (e) { + isER(e); + throw new InvalidArgumentError( + `Error parsing JSON: ${e.message}` + ); + } +} + +// Files + +/** + * Read a UTF8-encoded binary stream to completion. + * + * @param {Readable} inputStream + * @returns {Promise} + */ +function readStream(inputStream) { + return new Promise((resolve, reject) => { + /** @type {Buffer[]} */ + const input = []; + inputStream.on("data", data => { input.push(data); }); + inputStream.on("end", () => resolve(Buffer.concat(input).toString())); + inputStream.on("error", reject); + }); +} + +/** + * Ensure that a directory exists that will eventually contain a file of a + * given name. + * + * @param {string} filename + * @returns {Promise} + */ +async function mkFileDir(filename) { + const dir = path.dirname(filename); + try { + const stats = await fs.promises.stat(dir); + if (!stats.isDirectory()) { + throw new Error(`"${dir}" exists and is not a directory`); + } + } catch (er) { + if (!isErrno(er) || (er.code !== "ENOENT")) { + throw er; + } + await fs.promises.mkdir(dir, { recursive: true }); + } +} + +/** + * Replace the file extension on a file with the given one. + * + * @param {string} filename + * @param {string} ext + * @returns {string} + */ +function replaceExt(filename, ext) { + return filename.slice( + 0, + filename.length - path.extname(filename).length + ) + ext; +} + +module.exports = { + commaArg, + mkFileDir, + isER, + isErrno, + moreJSON, + readStream, + replaceExt, + select, +}; diff --git a/lib/peg.d.ts b/lib/peg.d.ts index 6b131849..c42f9a1a 100644 --- a/lib/peg.d.ts +++ b/lib/peg.d.ts @@ -1308,6 +1308,15 @@ export interface BuildOptionsBase { warning?: DiagnosticCallback; /** Called when an informational message during build was registered. */ info?: DiagnosticCallback; + + /** + * Override parser's reserved words. Defaults to RESERVED_WORDS. + */ + reservedWords?: string[]; + /** + * Plugins and Peggy compiler rules can take any config items they want. + */ + [pluginConfig: string]: any; } export interface ParserBuildOptions extends BuildOptionsBase { @@ -1324,6 +1333,8 @@ export interface ParserBuildOptions extends BuildOptionsBase { * which can give a parser source code as a string and a source map; * if set to `"source-with-inline-map"`, it will return the parser source * along with an embedded source map as a `data:` URI; + * if set to `"ast"`, it will return an ast.Grammar with the source + * property filled in. * (default: `"parser"`) */ output?: "parser"; @@ -1334,7 +1345,8 @@ export type SourceOutputs = "parser" | "source-and-map" | "source-with-inline-map" - | "source"; + | "source" + | "ast"; /** Base options for all source-generating formats. */ interface SourceOptionsBase @@ -1346,14 +1358,20 @@ interface SourceOptionsBase * which can give a parser source code as a string and a source map; * if set to `"source-with-inline-map"`, it will return the parser source * along with an embedded source map as a `data:` URI; + * if set to `"ast"`, it will return the ast.Grammar, which includes + * the source property. * (default: `"parser"`) */ output: Output; + /** + * Format of the generated parser, valid only when `output` is not set to + * `"parser"` (default: `"bare"`) + */ + format?: "amd" | "bare" | "commonjs" | "es" | "globals" | "umd"; } export interface OutputFormatAmdCommonjsEs extends SourceOptionsBase { - /** Format of the generated parser (`"amd"`, `"bare"`, `"commonjs"`, `"es"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ format: "amd" | "commonjs" | "es"; /** * Parser dependencies, the value is an object which maps variables used to @@ -1366,7 +1384,6 @@ export interface OutputFormatAmdCommonjsEs extends SourceOptionsBase { - /** Format of the generated parser (`"amd"`, `"bare"`, `"commonjs"`, `"es"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ format: "umd"; /** * Parser dependencies, the value is an object which maps variables used to @@ -1385,7 +1402,6 @@ export interface OutputFormatUmd export interface OutputFormatGlobals extends SourceOptionsBase { - /** Format of the generated parser (`"amd"`, `"bare"`, `"commonjs"`, `"es"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ format: "globals"; /** * Name of a global variable into which the parser object is assigned to when @@ -1397,7 +1413,6 @@ export interface OutputFormatGlobals export interface OutputFormatBare extends SourceOptionsBase { - /** Format of the generated parser (`"amd"`, `"bare"`, `"commonjs"`, `"es"`, `"globals"`, or `"umd"`); valid only when `output` is set to `"source"` (default: `"bare"`) */ format?: "bare"; } @@ -1504,11 +1519,6 @@ export function generate( options: SourceBuildOptions<"source-and-map"> ): SourceNode; -export function generate( - grammar: GrammarInput, - options: SourceBuildOptions -): SourceNode | string; - /** * Returns the generated AST for the grammar. Unlike result of the * `peggy.compiler.compile(...)` an AST returned by this method is augmented @@ -1530,5 +1540,10 @@ export function generate( options: SourceOptionsBase<"ast"> ): ast.Grammar; +export function generate( + grammar: GrammarInput, + options: SourceBuildOptions +): SourceNode | string; + // Export all exported stuff under a global variable PEG in non-module environments export as namespace PEG; diff --git a/test/cli/fixtures/simple.peggy b/test/cli/fixtures/simple.peggy index eafbb062..451f4495 100644 --- a/test/cli/fixtures/simple.peggy +++ b/test/cli/fixtures/simple.peggy @@ -1 +1 @@ -foo = "1" +foo = @"1" "\r"? "\n"? diff --git a/test/cli/fixtures/simple.txt b/test/cli/fixtures/simple.txt new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/test/cli/fixtures/simple.txt @@ -0,0 +1 @@ +1 diff --git a/test/cli/run.spec.ts b/test/cli/run.spec.ts index 3bf9704d..6ac97518 100644 --- a/test/cli/run.spec.ts +++ b/test/cli/run.spec.ts @@ -9,9 +9,11 @@ import * as peggy from "../../lib/peg.js"; import { CommanderError, PeggyCLI } from "../../bin/peggy.js"; import { Transform, TransformCallback, TransformOptions } from "stream"; import { SourceMapConsumer } from "source-map"; +import { isER } from "../../bin/utils.js"; import { promisify } from "util"; import { spawn } from "child_process"; +const peggyPath = path.resolve(__dirname, "..", "..", "bin", "peggy.js"); const foobarbaz = `\ foo = '1' bar = '2' @@ -135,103 +137,113 @@ async function exec(opts: Options = {}): Promise { ...opts, }; - const stdin = (opts.stdin instanceof MockStream) - ? opts.stdin - : MockStream.create(opts.stdin, { name: "stdin" }); - const out = opts.stdout || new MockStream({ - name: "stdout", - encoding: opts.encoding, - }); - const err = opts.stderr || out; - const outputBuffers: (Buffer | string)[] = []; - out.on("data", buf => outputBuffers.push(buf)); - - // All of the errors we want to capture go into this promise. - const p = (async(): Promise => { - const cli = new PeggyCLI({ in: stdin, out, err }) - .exitOverride() - .configureOutput({ - writeOut: (c: string) => out.write(c), - writeErr: (c: string) => err.write(c), - }) - .configureHelp({ helpWidth: 80 }); - if (opts.onstdout) { - const oso = opts.onstdout; // Snapshot - out.on("data", buf => oso(buf, cli)); - } + try { + const stdin = (opts.stdin instanceof MockStream) + ? opts.stdin + : MockStream.create(opts.stdin, { name: "stdin" }); + const out = opts.stdout || new MockStream({ + name: "stdout", + encoding: opts.encoding, + }); + const err = opts.stderr || out; + const outputBuffers: (Buffer | string)[] = []; + out.on("data", buf => outputBuffers.push(buf)); + + // All of the errors we want to capture go into this promise. + const p = (async(): Promise => { + const cli = new PeggyCLI({ in: stdin, out, err }) + .exitOverride() + .configureOutput({ + writeOut: (c: string) => out.write(c), + writeErr: (c: string) => err.write(c), + }) + .configureHelp({ helpWidth: 80 }); + if (opts.onstdout) { + const oso = opts.onstdout; // Snapshot + out.on("data", buf => oso(buf, cli)); + } - if (opts.onstderr) { - const ose = opts.onstderr; // Snapshot - err.on("data", buf => ose(buf, cli)); + if (opts.onstderr) { + const ose = opts.onstderr; // Snapshot + err.on("data", buf => ose(buf, cli)); + } + await cli.parseAsync([ + process.execPath, + "peggy", + ...(opts.args || []), + ]); + return cli.main(); + })(); + + let waited = false; + if (opts.error !== undefined) { + waited = true; + await expect(p).rejects.toThrow(opts.error); } - await cli.parseAsync([ - process.execPath, - "peggy", - ...(opts.args || []), - ]); - return cli.main(); - })(); - - let waited = false; - if (opts.error !== undefined) { - waited = true; - await expect(p).rejects.toThrow(opts.error); - } - if (opts.errorCode !== undefined) { - waited = true; - try { - await expect(p).rejects.toThrow( - expect.objectContaining({ code: opts.errorCode }) - ); - } catch (e) { - // It's hard to figure these out sometimes. Give ourselves a little help. + if (opts.errorCode !== undefined) { + waited = true; try { - await p; - } catch (realErr) { - console.log("RECEIVED ERROR CODE:", (realErr as CodeObject).code); + await expect(p).rejects.toThrow( + expect.objectContaining({ code: opts.errorCode }) + ); + } catch (e) { + // It's hard to figure these out sometimes. Give ourselves a little help. + try { + await p; + } catch (realErr) { + console.log("RECEIVED ERROR CODE:", (realErr as CodeObject).code); + } + throw e; } - throw e; } - } - if (opts.exitCode) { - waited = true; - try { - await expect(p).rejects.toThrow( - expect.objectContaining({ exitCode: opts.exitCode }) - ); - } catch (e) { - // It's hard to figure these out sometimes. Give ourselves a little help. + if (opts.exitCode) { + waited = true; try { - await p; - } catch (realErr) { - console.log("RECEIVED EXIT CODE:", (realErr as CodeObject).exitCode); + await expect(p).rejects.toThrow( + expect.objectContaining({ exitCode: opts.exitCode }) + ); + } catch (e) { + // It's hard to figure these out sometimes. Give ourselves a little help. + try { + await p; + } catch (realErr) { + console.log("RECEIVED EXIT CODE:", (realErr as CodeObject).exitCode); + } + throw e; } - throw e; } - } - if (!waited) { - // Make sure to include opts.error or opts.errorCode if you're expecting - // an exception. - const exitCode = await p; - expect(exitCode).toBe(0); - } + if (!waited) { + // Make sure to include opts.error or opts.errorCode if you're expecting + // an exception. + const exitCode = await p; + expect(exitCode).toBe(0); + } - let outputString = ""; - if (outputBuffers.length > 0) { - if (typeof outputBuffers[0] === "string") { - outputString = outputBuffers.join(""); - } else { - outputString = Buffer.concat(outputBuffers as Buffer[]) - .toString(opts.encoding); + let outputString = ""; + if (outputBuffers.length > 0) { + if (typeof outputBuffers[0] === "string") { + outputString = outputBuffers.join(""); + } else { + outputString = Buffer.concat(outputBuffers as Buffer[]) + .toString(opts.encoding); + } } + if (opts.expected instanceof RegExp) { + expect(outputString).toMatch(opts.expected); + } else if (typeof opts.expected === "string") { + expect(outputString).toBe(opts.expected); + } + return outputString; + } catch (er) { + isER(er); + er.message = `${peggyPath} ${opts.args ? opts.args.map(a => JSON.stringify(a)).join(" ") : "with no args"}\n${er.message}`; + if (opts.stdin) { + er.message = `printf ${JSON.stringify(opts.stdin)} | ${er.message}`; + } + + throw er; } - if (opts.expected instanceof RegExp) { - expect(outputString).toMatch(opts.expected); - } else if (typeof opts.expected === "string") { - expect(outputString).toBe(opts.expected); - } - return outputString; } function forkExec(opts: Options = {}): Promise { @@ -378,7 +390,7 @@ Options: object) to pass to peggy.generate -c, --extra-options-file File with additional options (in JSON as an object or commonjs module format) to pass to - peggy.generate (default: []) + peggy.generate --format Format of the generated parser (choices: "amd", "bare", "commonjs", "es", "globals", "umd", default: "commonjs") @@ -963,7 +975,12 @@ Options: args: [input1, input2], exitCode: 0, })).resolves.toBe(""); + fs.unlinkSync(out); + await expect(exec({ + args: ["--extra-options", `{"input": ["${input1}", "${input2}"]}`], + exitCode: 0, + })).resolves.toBe(""); fs.unlinkSync(out); }); @@ -1455,6 +1472,21 @@ error: Rule "unknownRule" is not defined }); }); + it("watches with test file", async() => { + const grammar = path.join(__dirname, "fixtures", "simple.peggy"); + const testFile = path.join(__dirname, "fixtures", "simple.txt"); + let count = 0; + await exec({ + args: ["-w", "-T", testFile, grammar], + exitCode: 0, + onstdout(_s, cli) { + if (++count === 2) { + cli.stopWatching(); + } + }, + }); + }); + it("handles watcher errors", async() => { const grammar = path.join(__dirname, "fixtures", "simple.peggy"); let count = 0; @@ -1486,6 +1518,15 @@ error: Rule "unknownRule" is not defined const grammarJS = path.join(__dirname, "fixtures", "simple.js"); const grammarDTS = path.join(__dirname, "fixtures", "simple.d.ts"); + beforeAll(() => { + fs.unlink(grammarJS, () => { + // Ignored + }); + fs.unlink(grammarDTS, () => { + // Ignored + }); + }); + it("creates .d.ts files", async() => { await exec({ args: ["--dts", grammar], diff --git a/test/cli/utils.spec.ts b/test/cli/utils.spec.ts new file mode 100644 index 00000000..db2f9017 --- /dev/null +++ b/test/cli/utils.spec.ts @@ -0,0 +1,10 @@ +import * as path from "node:path"; +import { mkFileDir } from "../../bin/utils.js"; + +describe("cli utilities", () => { + it("ensureDirectoryExists", async() => { + await expect(() => mkFileDir( + path.join(__filename, "BAD_FILE") + )).rejects.toThrow(/exists and is not a directory/); + }); +}); From 36a2f60278950bf52e3c2e47131b03c275e85b2f Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Fri, 26 Jul 2024 06:52:01 -0500 Subject: [PATCH 08/14] Attempt to escape paths for windows correctly --- test/cli/run.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cli/run.spec.ts b/test/cli/run.spec.ts index 6ac97518..b7ddcd3c 100644 --- a/test/cli/run.spec.ts +++ b/test/cli/run.spec.ts @@ -978,7 +978,7 @@ Options: fs.unlinkSync(out); await expect(exec({ - args: ["--extra-options", `{"input": ["${input1}", "${input2}"]}`], + args: ["--extra-options", `{"input": [${JSON.stringify(input1)}, ${JSON.stringify(input2)}]}`], exitCode: 0, })).resolves.toBe(""); fs.unlinkSync(out); From caecbb7e0de8399b039461c4fdcd1095f632ec7f Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Sat, 27 Jul 2024 14:17:54 -0400 Subject: [PATCH 09/14] Fix .d.ts error --- lib/peg.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/peg.d.ts b/lib/peg.d.ts index c42f9a1a..ff7afad8 100644 --- a/lib/peg.d.ts +++ b/lib/peg.d.ts @@ -1084,8 +1084,8 @@ export interface LibraryResults { peg$result: any; peg$currPos: number; peg$FAILED: object; - peg$maxFailExpected: number; - peg$maxFailPo: number; + peg$maxFailExpected: parser.Expectation[]; + peg$maxFailPos: number; } export interface Parser { From f895d44d5004cba1123801cc0909bf59ddeebde6 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Sun, 28 Jul 2024 13:19:28 -0400 Subject: [PATCH 10/14] Change to 'declare function' --- bin/peggy-cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/peggy-cli.js b/bin/peggy-cli.js index 6048d2f3..926a5b1b 100644 --- a/bin/peggy-cli.js +++ b/bin/peggy-cli.js @@ -405,7 +405,7 @@ class PeggyCLI extends Command { ) || {}; for (const sr of startRules) { out.write(` -export function ParseFunction>( +declare function ParseFunction>( input: string, options?: Options, ): ${types[sr] || "any"}; From 792c1a3457bdf254c201475d418bdced4eaa09ba Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Tue, 30 Jul 2024 16:06:50 -0500 Subject: [PATCH 11/14] Fix issues found by @LukeAbby --- bin/generated_template.d.ts | 115 ++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 44 deletions(-) diff --git a/bin/generated_template.d.ts b/bin/generated_template.d.ts index b72fd1e5..c85dfe44 100644 --- a/bin/generated_template.d.ts +++ b/bin/generated_template.d.ts @@ -1,45 +1,61 @@ /** Provides information pointing to a location within a source. */ export interface Location { /** Line in the parsed source (1-based). */ - line: number; + readonly line: number; /** Column in the parsed source (1-based). */ - column: number; + readonly column: number; /** Offset in the parsed source (0-based). */ - offset: number; + readonly offset: number; } +export interface GrammarSourceObject { + readonly source?: undefined | string | unknown; + readonly offset?: undefined | ((loc: Location) => Location); + readonly toString: () => string; +} + +export type GrammarSource = string | GrammarSourceObject | unknown; + /** The `start` and `end` position's of an object within the source. */ export interface LocationRange { - /** Any object that was supplied to the `parse()` call as the `grammarSource` option. */ - source: any; + /** + * A string or object that was supplied to the `parse()` call as the + * `grammarSource` option. + */ + readonly source: GrammarSource; /** Position at the beginning of the expression. */ - start: Location; + readonly start: Location; /** Position after the end of the expression. */ - end: Location; + readonly end: Location; } export interface LiteralExpectation { - type: "literal"; - text: string; - ignoreCase: boolean; + readonly type: "literal"; + readonly text: string; + readonly ignoreCase: boolean; } -export interface ClassParts extends Array { + +export type ClassRange = [ + start: string, + end: string, +] +export interface ClassParts extends Array { } export interface ClassExpectation { - type: "class"; - parts: ClassParts; - inverted: boolean; - ignoreCase: boolean; + readonly type: "class"; + readonly parts: ClassParts; + readonly inverted: boolean; + readonly ignoreCase: boolean; } export interface AnyExpectation { - type: "any"; + readonly type: "any"; } export interface EndExpectation { - type: "end"; + readonly type: "end"; } export interface OtherExpectation { - type: "other"; - description: string; + readonly type: "other"; + readonly description: string; } export type Expectation = | AnyExpectation @@ -48,7 +64,16 @@ export type Expectation = | LiteralExpectation | OtherExpectation; -declare class _PeggySyntaxError extends Error { +export interface SourceText { + /** + * Identifier of an input that was used as a grammarSource in parse(). + */ + readonly source: GrammarSource; + /** Source text of the input. */ + readonly text: string; +} + +export declare class SyntaxError extends Error { /** * Constructs the human-readable message from the machine representation. * @@ -56,46 +81,49 @@ declare class _PeggySyntaxError extends Error { * @param found Any text that will appear as found in the input instead of * expected */ - static buildMessage(expected: Expectation[], found: string | null): string; - message: string; - expected: Expectation[]; - found: string | null; - location: LocationRange; - name: string; + static buildMessage(expected: Expectation[], found?: string | null | undefined): string; + readonly message: string; + readonly expected: Expectation[]; + readonly found: string | null | undefined; + readonly location: LocationRange; + readonly name: string; constructor( message: string, expected: Expectation[], found: string | null, location: LocationRange, ); - format(sources: { - source?: any; - text: string; - }[]): string; + format(sources: SourceText[]): string; } export interface ParserTracer { - trace(event: ParserTracerEvent): void; + trace: (event: ParserTracerEvent) => void; } export type ParserTracerEvent - = { type: "rule.enter"; rule: string; location: LocationRange } - | { type: "rule.fail"; rule: string; location: LocationRange } - | { type: "rule.match"; rule: string; result: any; location: LocationRange }; + = { readonly type: "rule.enter"; readonly rule: string; readonly location: LocationRange } + | { readonly type: "rule.fail"; readonly rule: string; readonly location: LocationRange } + | { + readonly type: "rule.match"; + readonly rule: string; + readonly location: LocationRange + /** Return value from the rule. */ + readonly result: unknown; + }; export type StartRules = $$$StartRules$$$; -export interface ParseOptions { +export interface ParseOptions { /** - * Object that will be attached to the each `LocationRange` object created by - * the parser. For example, this can be path to the parsed file or even the - * File object. + * String or object that will be attached to the each `LocationRange` object + * created by the parser. For example, this can be path to the parsed file + * or even the File object. */ - grammarSource?: any; - startRule?: T; - tracer?: ParserTracer; + readonly grammarSource?: GrammarSource; + readonly startRule?: T; + readonly tracer?: ParserTracer; // Internal use only: - peg$library?: boolean; + readonly peg$library?: boolean; // Internal use only: peg$currPos?: number; // Internal use only: @@ -103,11 +131,10 @@ export interface ParseOptions { // Internal use only: peg$maxFailExpected?: Expectation[]; // Extra application-specific properties - [key: string]: any; + [key: string]: unknown; } export declare const parse: typeof ParseFunction; export declare const SyntaxError: typeof _PeggySyntaxError; -export type SyntaxError = _PeggySyntaxError; // Overload of ParseFunction for each allowedStartRule From 620fdcf96b0d24d175179b2453945515a9ab59bd Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Wed, 31 Jul 2024 17:39:10 -0500 Subject: [PATCH 12/14] Update dependencies --- docs/js/test-bundle.min.js | 2 +- package.json | 28 +- pnpm-lock.yaml | 603 +++++++++++++++++++------------------ web-test/package.json | 4 +- 4 files changed, 315 insertions(+), 322 deletions(-) diff --git a/docs/js/test-bundle.min.js b/docs/js/test-bundle.min.js index a1c1bbb7..21bebfe1 100644 --- a/docs/js/test-bundle.min.js +++ b/docs/js/test-bundle.min.js @@ -5,4 +5,4 @@ // Copyright (c) 2024- the Peggy authors // Licensed under the MIT License. -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chai"),require("whatwg-url")):"function"==typeof define&&define.amd?define(["chai","whatwg-url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).chai,e.whatwgURL)}(this,(function(require$$0,require$$0$1){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},GrammarLocation$5=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$5,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$4=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$5=function(e){function t(r,a,n){var o=e.call(this,r)||this;return setProtoOf(o,t.prototype),o.name="GrammarError",o.location=a,void 0===n&&(n=[]),o.diagnostics=n,o.stage=null,o.problems=[["error",r,a,n]],o}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,a=this.diagnostics;r1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,overrides:overrides,pnpm:pnpm,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n=18" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c3dfc999..5fc91a20 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,17 +4,13 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -overrides: - '@typescript-eslint/utils': 8.0.0-alpha.44 - '@typescript-eslint/parser': 8.0.0-alpha.44 - importers: .: dependencies: '@peggyjs/from-mem': - specifier: 1.3.3 - version: 1.3.3 + specifier: 1.3.4 + version: 1.3.4 commander: specifier: ^12.1.0 version: 12.1.0 @@ -23,23 +19,23 @@ importers: version: 0.8.0 devDependencies: '@peggyjs/eslint-config': - specifier: ^4.0.1 - version: 4.0.1(eslint@9.7.0)(typescript@5.5.3) + specifier: ^4.0.3 + version: 4.0.3(eslint@9.8.0)(typescript@5.5.4) '@rollup/plugin-commonjs': specifier: ^26.0.1 - version: 26.0.1(rollup@4.18.1) + version: 26.0.1(rollup@4.19.1) '@rollup/plugin-json': specifier: ^6.1.0 - version: 6.1.0(rollup@4.18.1) + version: 6.1.0(rollup@4.19.1) '@rollup/plugin-multi-entry': specifier: ^6.0.1 - version: 6.0.1(rollup@4.18.1) + version: 6.0.1(rollup@4.19.1) '@rollup/plugin-node-resolve': specifier: ^15.2.3 - version: 15.2.3(rollup@4.18.1) + version: 15.2.3(rollup@4.19.1) '@rollup/plugin-typescript': specifier: ^11.1.6 - version: 11.1.6(rollup@4.18.1)(tslib@2.6.3)(typescript@5.5.3) + version: 11.1.6(rollup@4.19.1)(tslib@2.6.3)(typescript@5.5.4) '@types/chai': specifier: ^4.3.11 version: 4.3.16 @@ -47,8 +43,8 @@ importers: specifier: ^29.5.12 version: 29.5.12 '@types/node': - specifier: ^20.14.11 - version: 20.14.11 + specifier: ^22.0.2 + version: 22.0.2 chai: specifier: ^4.3.11 version: 4.4.1 @@ -59,14 +55,14 @@ importers: specifier: ^2.4.1 version: 2.4.1 eslint: - specifier: ^9.7.0 - version: 9.7.0 + specifier: ^9.8.0 + version: 9.8.0 eslint-plugin-compat: specifier: 6.0.0 - version: 6.0.0(eslint@9.7.0) + version: 6.0.0(eslint@9.8.0) eslint-plugin-mocha: - specifier: 10.4.3 - version: 10.4.3(eslint@9.7.0) + specifier: 10.5.0 + version: 10.5.0(eslint@9.8.0) express: specifier: 4.19.2 version: 4.19.2 @@ -75,13 +71,13 @@ importers: version: 11.0.0 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@20.14.11) + version: 29.7.0(@types/node@22.0.2) rimraf: specifier: ^6.0.1 version: 6.0.1 rollup: - specifier: ^4.18.1 - version: 4.18.1 + specifier: ^4.19.1 + version: 4.19.1 rollup-plugin-ignore: specifier: 1.0.10 version: 1.0.10 @@ -93,16 +89,16 @@ importers: version: 5.31.3 ts-jest: specifier: ^29.2.3 - version: 29.2.3(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.11))(typescript@5.5.3) + version: 29.2.3(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@22.0.2))(typescript@5.5.4) tslib: specifier: ^2.6.3 version: 2.6.3 typescript: - specifier: ^5.5.3 - version: 5.5.3 + specifier: ^5.5.4 + version: 5.5.4 typescript-eslint: - specifier: 8.0.0-alpha.44 - version: 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) + specifier: 8.0.0 + version: 8.0.0(eslint@9.8.0)(typescript@5.5.4) docs: devDependencies: @@ -115,11 +111,11 @@ importers: web-test: devDependencies: '@playwright/test': - specifier: 1.45.2 - version: 1.45.2 + specifier: 1.45.3 + version: 1.45.3 '@types/node': - specifier: 20.14.11 - version: 20.14.11 + specifier: 22.0.2 + version: 22.0.2 packages: @@ -325,16 +321,16 @@ packages: resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint/config-array@0.17.0': - resolution: {integrity: sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==} + '@eslint/config-array@0.17.1': + resolution: {integrity: sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/eslintrc@3.1.0': resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.7.0': - resolution: {integrity: sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==} + '@eslint/js@9.8.0': + resolution: {integrity: sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.4': @@ -466,20 +462,20 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@peggyjs/eslint-config@4.0.1': - resolution: {integrity: sha512-IJr4Kpn1nDVvFTQREyHGWbyGq1MvhQSFUDkV/WQKaUXDkdP3kC2ph8QBTQcBL3N+XK94XEPI3YKz21eayRS+VA==} + '@peggyjs/eslint-config@4.0.3': + resolution: {integrity: sha512-6cjxn4+9c2o5CzWB/rAvGSB8nFxWDQeyqIcjDGoAq6G+c2cC60+tvtoUVwXJvlt8IATl23gAR+x8ZjtCZ9jZJQ==} engines: {node: '>=18'} - '@peggyjs/from-mem@1.3.3': - resolution: {integrity: sha512-qpwWHRMrF1+39R5jTTx1h6b1B8jBBz2hRpeWS9WF+JkDaAA7A3LB7YLcUZFZTrZ6Grx/EQAVXn+trrPl6HMR3Q==} + '@peggyjs/from-mem@1.3.4': + resolution: {integrity: sha512-6DqaCO73ihyM2AJ2Vl4QQGmmU3MoD4hFh0RFRzxPdLkSLfE0QMEyDfaojE/R3KbsL1UP4VQyJA2clwX4agSTBw==} engines: {node: '>=18'} '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@playwright/test@1.45.2': - resolution: {integrity: sha512-JxG9eq92ET75EbVi3s+4sYbcG7q72ECeZNbdBlaMkGcNbiDQ4cAi8U2QP5oKkOx+1gpaiL1LDStmzCaEM1Z6fQ==} + '@playwright/test@1.45.3': + resolution: {integrity: sha512-UKF4XsBfy+u3MFWEH44hva1Q8Da28G6RFtR2+5saw+jgAFQV5yYnB1fu68Mz7fO+5GJF3wgwAIs0UelU8TxFrA==} engines: {node: '>=18'} hasBin: true @@ -550,83 +546,83 @@ packages: rollup: optional: true - '@rollup/rollup-android-arm-eabi@4.18.1': - resolution: {integrity: sha512-lncuC4aHicncmbORnx+dUaAgzee9cm/PbIqgWz1PpXuwc+sa1Ct83tnqUDy/GFKleLiN7ZIeytM6KJ4cAn1SxA==} + '@rollup/rollup-android-arm-eabi@4.19.1': + resolution: {integrity: sha512-XzqSg714++M+FXhHfXpS1tDnNZNpgxxuGZWlRG/jSj+VEPmZ0yg6jV4E0AL3uyBKxO8mO3xtOsP5mQ+XLfrlww==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.18.1': - resolution: {integrity: sha512-F/tkdw0WSs4ojqz5Ovrw5r9odqzFjb5LIgHdHZG65dFI1lWTWRVy32KDJLKRISHgJvqUeUhdIvy43fX41znyDg==} + '@rollup/rollup-android-arm64@4.19.1': + resolution: {integrity: sha512-thFUbkHteM20BGShD6P08aungq4irbIZKUNbG70LN8RkO7YztcGPiKTTGZS7Kw+x5h8hOXs0i4OaHwFxlpQN6A==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.18.1': - resolution: {integrity: sha512-vk+ma8iC1ebje/ahpxpnrfVQJibTMyHdWpOGZ3JpQ7Mgn/3QNHmPq7YwjZbIE7km73dH5M1e6MRRsnEBW7v5CQ==} + '@rollup/rollup-darwin-arm64@4.19.1': + resolution: {integrity: sha512-8o6eqeFZzVLia2hKPUZk4jdE3zW7LCcZr+MD18tXkgBBid3lssGVAYuox8x6YHoEPDdDa9ixTaStcmx88lio5Q==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.18.1': - resolution: {integrity: sha512-IgpzXKauRe1Tafcej9STjSSuG0Ghu/xGYH+qG6JwsAUxXrnkvNHcq/NL6nz1+jzvWAnQkuAJ4uIwGB48K9OCGA==} + '@rollup/rollup-darwin-x64@4.19.1': + resolution: {integrity: sha512-4T42heKsnbjkn7ovYiAdDVRRWZLU9Kmhdt6HafZxFcUdpjlBlxj4wDrt1yFWLk7G4+E+8p2C9tcmSu0KA6auGA==} cpu: [x64] os: [darwin] - '@rollup/rollup-linux-arm-gnueabihf@4.18.1': - resolution: {integrity: sha512-P9bSiAUnSSM7EmyRK+e5wgpqai86QOSv8BwvkGjLwYuOpaeomiZWifEos517CwbG+aZl1T4clSE1YqqH2JRs+g==} + '@rollup/rollup-linux-arm-gnueabihf@4.19.1': + resolution: {integrity: sha512-MXg1xp+e5GhZ3Vit1gGEyoC+dyQUBy2JgVQ+3hUrD9wZMkUw/ywgkpK7oZgnB6kPpGrxJ41clkPPnsknuD6M2Q==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.18.1': - resolution: {integrity: sha512-5RnjpACoxtS+aWOI1dURKno11d7krfpGDEn19jI8BuWmSBbUC4ytIADfROM1FZrFhQPSoP+KEa3NlEScznBTyQ==} + '@rollup/rollup-linux-arm-musleabihf@4.19.1': + resolution: {integrity: sha512-DZNLwIY4ftPSRVkJEaxYkq7u2zel7aah57HESuNkUnz+3bZHxwkCUkrfS2IWC1sxK6F2QNIR0Qr/YXw7nkF3Pw==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.18.1': - resolution: {integrity: sha512-8mwmGD668m8WaGbthrEYZ9CBmPug2QPGWxhJxh/vCgBjro5o96gL04WLlg5BA233OCWLqERy4YUzX3bJGXaJgQ==} + '@rollup/rollup-linux-arm64-gnu@4.19.1': + resolution: {integrity: sha512-C7evongnjyxdngSDRRSQv5GvyfISizgtk9RM+z2biV5kY6S/NF/wta7K+DanmktC5DkuaJQgoKGf7KUDmA7RUw==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.18.1': - resolution: {integrity: sha512-dJX9u4r4bqInMGOAQoGYdwDP8lQiisWb9et+T84l2WXk41yEej8v2iGKodmdKimT8cTAYt0jFb+UEBxnPkbXEQ==} + '@rollup/rollup-linux-arm64-musl@4.19.1': + resolution: {integrity: sha512-89tFWqxfxLLHkAthAcrTs9etAoBFRduNfWdl2xUs/yLV+7XDrJ5yuXMHptNqf1Zw0UCA3cAutkAiAokYCkaPtw==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.18.1': - resolution: {integrity: sha512-V72cXdTl4EI0x6FNmho4D502sy7ed+LuVW6Ym8aI6DRQ9hQZdp5sj0a2usYOlqvFBNKQnLQGwmYnujo2HvjCxQ==} + '@rollup/rollup-linux-powerpc64le-gnu@4.19.1': + resolution: {integrity: sha512-PromGeV50sq+YfaisG8W3fd+Cl6mnOOiNv2qKKqKCpiiEke2KiKVyDqG/Mb9GWKbYMHj5a01fq/qlUR28PFhCQ==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.18.1': - resolution: {integrity: sha512-f+pJih7sxoKmbjghrM2RkWo2WHUW8UbfxIQiWo5yeCaCM0TveMEuAzKJte4QskBp1TIinpnRcxkquY+4WuY/tg==} + '@rollup/rollup-linux-riscv64-gnu@4.19.1': + resolution: {integrity: sha512-/1BmHYh+iz0cNCP0oHCuF8CSiNj0JOGf0jRlSo3L/FAyZyG2rGBuKpkZVH9YF+x58r1jgWxvm1aRg3DHrLDt6A==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.18.1': - resolution: {integrity: sha512-qb1hMMT3Fr/Qz1OKovCuUM11MUNLUuHeBC2DPPAWUYYUAOFWaxInaTwTQmc7Fl5La7DShTEpmYwgdt2hG+4TEg==} + '@rollup/rollup-linux-s390x-gnu@4.19.1': + resolution: {integrity: sha512-0cYP5rGkQWRZKy9/HtsWVStLXzCF3cCBTRI+qRL8Z+wkYlqN7zrSYm6FuY5Kd5ysS5aH0q5lVgb/WbG4jqXN1Q==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.18.1': - resolution: {integrity: sha512-7O5u/p6oKUFYjRbZkL2FLbwsyoJAjyeXHCU3O4ndvzg2OFO2GinFPSJFGbiwFDaCFc+k7gs9CF243PwdPQFh5g==} + '@rollup/rollup-linux-x64-gnu@4.19.1': + resolution: {integrity: sha512-XUXeI9eM8rMP8aGvii/aOOiMvTs7xlCosq9xCjcqI9+5hBxtjDpD+7Abm1ZhVIFE1J2h2VIg0t2DX/gjespC2Q==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.18.1': - resolution: {integrity: sha512-pDLkYITdYrH/9Cv/Vlj8HppDuLMDUBmgsM0+N+xLtFd18aXgM9Nyqupb/Uw+HeidhfYg2lD6CXvz6CjoVOaKjQ==} + '@rollup/rollup-linux-x64-musl@4.19.1': + resolution: {integrity: sha512-V7cBw/cKXMfEVhpSvVZhC+iGifD6U1zJ4tbibjjN+Xi3blSXaj/rJynAkCFFQfoG6VZrAiP7uGVzL440Q6Me2Q==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.18.1': - resolution: {integrity: sha512-W2ZNI323O/8pJdBGil1oCauuCzmVd9lDmWBBqxYZcOqWD6aWqJtVBQ1dFrF4dYpZPks6F+xCZHfzG5hYlSHZ6g==} + '@rollup/rollup-win32-arm64-msvc@4.19.1': + resolution: {integrity: sha512-88brja2vldW/76jWATlBqHEoGjJLRnP0WOEKAUbMcXaAZnemNhlAHSyj4jIwMoP2T750LE9lblvD4e2jXleZsA==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.18.1': - resolution: {integrity: sha512-ELfEX1/+eGZYMaCIbK4jqLxO1gyTSOIlZr6pbC4SRYFaSIDVKOnZNMdoZ+ON0mrFDp4+H5MhwNC1H/AhE3zQLg==} + '@rollup/rollup-win32-ia32-msvc@4.19.1': + resolution: {integrity: sha512-LdxxcqRVSXi6k6JUrTah1rHuaupoeuiv38du8Mt4r4IPer3kwlTo+RuvfE8KzZ/tL6BhaPlzJ3835i6CxrFIRQ==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.18.1': - resolution: {integrity: sha512-yjk2MAkQmoaPYCSu35RLJ62+dz358nE83VfTePJRp8CG7aMg25mEJYpXFiD+NcevhX8LxD5OP5tktPXnXN7GDw==} + '@rollup/rollup-win32-x64-msvc@4.19.1': + resolution: {integrity: sha512-2bIrL28PcK3YCqD9anGxDxamxdiJAxA+l7fWIwM5o8UqNy1t3d1NdAweO2XhA0KTDJ5aH1FsuiT5+7VhtHliXg==} cpu: [x64] os: [win32] @@ -647,31 +643,31 @@ packages: '@sinonjs/fake-timers@10.3.0': resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} - '@stylistic/eslint-plugin-js@2.3.0': - resolution: {integrity: sha512-lQwoiYb0Fs6Yc5QS3uT8+T9CPKK2Eoxc3H8EnYJgM26v/DgtW+1lvy2WNgyBflU+ThShZaHm3a6CdD9QeKx23w==} + '@stylistic/eslint-plugin-js@2.6.0': + resolution: {integrity: sha512-6oN0Djdy8gTRhx2qS1m4P+CeDKqmZZwc4ibgzzJS+8iBW3Ts1c2mAvi+OH6TN4bt0AHm0FnDv2+KtTqqueMATw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' - '@stylistic/eslint-plugin-jsx@2.3.0': - resolution: {integrity: sha512-tsQ0IEKB195H6X9A4iUSgLLLKBc8gUBWkBIU8tp1/3g2l8stu+PtMQVV/VmK1+3bem5FJCyvfcZIQ/WF1fsizA==} + '@stylistic/eslint-plugin-jsx@2.6.0': + resolution: {integrity: sha512-Hm7YODwBwAsYtacY9hR5ONiBS7K9og4YZFjBr8mfqsmlCYVFje1HsOKG+tylePkwcu0Qhi+lY86cP3rlV4PhAA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' - '@stylistic/eslint-plugin-plus@2.3.0': - resolution: {integrity: sha512-xboPWGUU5yaPlR+WR57GwXEuY4PSlPqA0C3IdNA/+1o2MuBi95XgDJcZiJ9N+aXsqBXAPIpFFb+WQ7QEHo4f7g==} + '@stylistic/eslint-plugin-plus@2.6.0': + resolution: {integrity: sha512-9GfLF08zx/pNFpQQlNMz6f4IixoS8zdSBFdJLWLTorMilNUjd4dDuA5ej4Z32+mTZf4u6lduzQcUrAYiGKTLTg==} peerDependencies: eslint: '*' - '@stylistic/eslint-plugin-ts@2.3.0': - resolution: {integrity: sha512-wqOR38/uz/0XPnHX68ftp8sNMSAqnYGjovOTN7w00xnjS6Lxr3Sk7q6AaxWWqbMvOj7V2fQiMC5HWAbTruJsCg==} + '@stylistic/eslint-plugin-ts@2.6.0': + resolution: {integrity: sha512-9ooVm+BRNqdyI/p10eKGAdbdLKU5lllc7mX4Xqp76hKDsh5cCxmZM6zMgK3CLKkYrW0RUunFORkg8dAnmc1qIA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' - '@stylistic/eslint-plugin@2.3.0': - resolution: {integrity: sha512-rtiz6u5gRyyEZp36FcF1/gHJbsbT3qAgXZ1qkad6Nr/xJ9wrSJkiSFFQhpYVTIZ7FJNRJurEcumZDCwN9dEI4g==} + '@stylistic/eslint-plugin@2.6.0': + resolution: {integrity: sha512-BYzdgwz/4WgDTGmkPMKXFLRBKnYNVnmgD4NDsDCGJulqLFLF6sW1gr6gAJSFnkxwsdhEg+GApF4m5e3OMDpd6g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=8.40.0' @@ -691,8 +687,8 @@ packages: '@types/chai@4.3.16': resolution: {integrity: sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ==} - '@types/eslint@8.56.10': - resolution: {integrity: sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==} + '@types/eslint@9.6.0': + resolution: {integrity: sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==} '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} @@ -718,8 +714,8 @@ packages: '@types/minimatch@3.0.5': resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} - '@types/node@20.14.11': - resolution: {integrity: sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==} + '@types/node@22.0.2': + resolution: {integrity: sha512-yPL6DyFwY5PiMVEwymNeqUTKsDczQBJ/5T7W/46RwLU/VH+AA8aT5TZkvBviLKLbbm0hlfftEkGrNzfRk/fofQ==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -733,19 +729,19 @@ packages: '@types/yargs@17.0.32': resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==} - '@typescript-eslint/eslint-plugin@8.0.0-alpha.44': - resolution: {integrity: sha512-3hqJa/Ak3ahypkcNoNmkkmUg54zV3AWSaalSWAKTQKF5UtXMvRjM5w3nKqS2AQP0dQAkM1u9cXCnOuLeUZr7rw==} + '@typescript-eslint/eslint-plugin@8.0.0': + resolution: {integrity: sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': 8.0.0-alpha.44 + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 eslint: ^8.57.0 || ^9.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true - '@typescript-eslint/parser@8.0.0-alpha.44': - resolution: {integrity: sha512-ho5CiKhp3hDCvkFVpLqiHlMUbgvGELmdVfvpIiKQ1TFGyDcEVpSJUZCDO+gyymgZreJyTfUDHH6eKhF3pgkb0Q==} + '@typescript-eslint/parser@8.0.0': + resolution: {integrity: sha512-pS1hdZ+vnrpDIxuFXYQpLTILglTjSYJ9MbetZctrUawogUsPdz31DIIRZ9+rab0LhYNTsk88w4fIzVheiTbWOQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -754,12 +750,12 @@ packages: typescript: optional: true - '@typescript-eslint/scope-manager@8.0.0-alpha.44': - resolution: {integrity: sha512-0w0pDILwfwRXSz9lQBXnJmeGaIbSBgl4vAw/lB2kCnOKYl2SXCVbdNOHPwxWigvQ08QVpuaKy+wEjbFKr9Xwfg==} + '@typescript-eslint/scope-manager@8.0.0': + resolution: {integrity: sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.0.0-alpha.44': - resolution: {integrity: sha512-52V6rQxNiebKYLxjcRTzIuTMw/wgrCcLncV27u2O142WyD07gLbICGcxtrxurDIQLMwQ/BuStV2x0cypKSwwdw==} + '@typescript-eslint/type-utils@8.0.0': + resolution: {integrity: sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -767,12 +763,12 @@ packages: typescript: optional: true - '@typescript-eslint/types@8.0.0-alpha.44': - resolution: {integrity: sha512-FNBBUTJBNbIaTJhhBbSNxKv+qS8lrwwnpBg36APp5fhDRu8K/YFQZP/VEa19nKBz+8+QUK7R6wV9DHYjj56S7w==} + '@typescript-eslint/types@8.0.0': + resolution: {integrity: sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.0.0-alpha.44': - resolution: {integrity: sha512-IyLELYPMFaleWpEVrcYhSfgFXFx4/505P4/vi9Dfp6s6T2xapyAdti6WL9iZbnXk72SL5M0wMp3V73nHn8ce1A==} + '@typescript-eslint/typescript-estree@8.0.0': + resolution: {integrity: sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -780,14 +776,14 @@ packages: typescript: optional: true - '@typescript-eslint/utils@8.0.0-alpha.44': - resolution: {integrity: sha512-gOSA4Yo1jufcOuV68yX3hzpwzufd/Ru6KYL04od1T1c5tt6cvN3i5D5Tc3BBJ3xYFE7ge821mJbUJMTc+BMaWg==} + '@typescript-eslint/utils@8.0.0': + resolution: {integrity: sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 - '@typescript-eslint/visitor-keys@8.0.0-alpha.44': - resolution: {integrity: sha512-geWzLM8S6vYGdhA01mWJyGh2V/7VRzAmsD6ZKuc/rLkeJhYjvkMY0g0uMDw/7wmNLeRrpjHnL8HJklrpAlrb9g==} + '@typescript-eslint/visitor-keys@8.0.0': + resolution: {integrity: sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} a-sync-waterfall@1.0.1: @@ -1286,8 +1282,8 @@ packages: peerDependencies: eslint: ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 - eslint-plugin-mocha@10.4.3: - resolution: {integrity: sha512-emc4TVjq5Ht0/upR+psftuz6IBG5q279p+1dSRDeHf+NS9aaerBi3lXKo1SEzwC29hFIW21gO89CEWSvRsi8IQ==} + eslint-plugin-mocha@10.5.0: + resolution: {integrity: sha512-F2ALmQVPT1GoP27O1JTZGrV9Pqg8k79OeIuvw63UxMtQKREZtmkK1NFgkZQ2TW7L2JSSFKHFPTtHu5z8R9QNRw==} engines: {node: '>=14.0.0'} peerDependencies: eslint: '>=7.0.0' @@ -1314,8 +1310,8 @@ packages: resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.7.0: - resolution: {integrity: sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw==} + eslint@9.8.0: + resolution: {integrity: sha512-K8qnZ/QJzT2dLKdZJVX6W4XOwBzutMYmt0lqUS+JdXgd+HTYFlonFgkJ8s44d/zMPPCnOOk0kMWCApCPhiOy9A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true @@ -2267,13 +2263,13 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} - playwright-core@1.45.2: - resolution: {integrity: sha512-ha175tAWb0dTK0X4orvBIqi3jGEt701SMxMhyujxNrgd8K0Uy5wMSwwcQHtyB4om7INUkfndx02XnQ2p6dvLDw==} + playwright-core@1.45.3: + resolution: {integrity: sha512-+ym0jNbcjikaOwwSZycFbwkWgfruWvYlJfThKYAlImbxUgdWFO2oW70ojPm4OpE4t6TAo2FY/smM+hpVTtkhDA==} engines: {node: '>=18'} hasBin: true - playwright@1.45.2: - resolution: {integrity: sha512-ReywF2t/0teRvNBpfIgh5e4wnrI/8Su8ssdo5XsQKpjxJj+jspm00jSoz9BTg91TT0c9HRjXO7LBNVrgYj9X0g==} + playwright@1.45.3: + resolution: {integrity: sha512-QhVaS+lpluxCaioejDZ95l4Y4jSFCsBvl2UZkpeXlzxmqS+aABr5c82YmfMHrL6x27nvrvykJAFpkzT2eWdJww==} engines: {node: '>=18'} hasBin: true @@ -2442,8 +2438,8 @@ packages: rollup-plugin-ignore@1.0.10: resolution: {integrity: sha512-VsbnfwwaTv2Dxl2onubetX/3RnSnplNnjdix0hvF8y2YpqdzlZrjIq6zkcuVJ08XysS8zqW3gt3ORBndFDgsrg==} - rollup@4.18.1: - resolution: {integrity: sha512-Elx2UT8lzxxOXMpy5HWQGZqkrQOtrVDDa/bm9l10+U4rQnVzbL/LgZ4NOM1MPIDyHk69W4InuYDF5dzRh4Kw1A==} + rollup@4.19.1: + resolution: {integrity: sha512-K5vziVlg7hTpYfFBI+91zHBEMo6jafYXpkMlqZjg7/zhIG9iHqazBf4xz9AVdjS9BruRn280ROqLI7G3OFRIlw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -2475,6 +2471,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.6.3: + resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} + engines: {node: '>=10'} + hasBin: true + send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -2704,8 +2705,8 @@ packages: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} - typescript-eslint@8.0.0-alpha.44: - resolution: {integrity: sha512-4oRisGPvIJFnLqpfrpdcFjkFZg4/mhbE+0faGiomEFv9r5ziXETxuGY6VmwACPXHEakp2nDEqnp3ZdU0bsuiHQ==} + typescript-eslint@8.0.0: + resolution: {integrity: sha512-yQWBJutWL1PmpmDddIOl9/Mi6vZjqNCjqSGBMQ4vsc2Aiodk0SnbQQWPXbSy0HNuKCuGkw1+u4aQ2mO40TdhDQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -2713,8 +2714,8 @@ packages: typescript: optional: true - typescript@5.5.3: - resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==} + typescript@5.5.4: + resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==} engines: {node: '>=14.17'} hasBin: true @@ -2726,8 +2727,8 @@ packages: engines: {node: '>=0.8.0'} hasBin: true - undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici-types@6.11.1: + resolution: {integrity: sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==} unpipe@1.0.0: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} @@ -3136,14 +3137,14 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} - '@eslint-community/eslint-utils@4.4.0(eslint@9.7.0)': + '@eslint-community/eslint-utils@4.4.0(eslint@9.8.0)': dependencies: - eslint: 9.7.0 + eslint: 9.8.0 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.0': {} - '@eslint/config-array@0.17.0': + '@eslint/config-array@0.17.1': dependencies: '@eslint/object-schema': 2.1.4 debug: 4.3.5 @@ -3165,7 +3166,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.7.0': {} + '@eslint/js@9.8.0': {} '@eslint/object-schema@2.1.4': {} @@ -3197,7 +3198,7 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -3210,14 +3211,14 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.14.11) + jest-config: 29.7.0(@types/node@22.0.2) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -3242,7 +3243,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -3260,7 +3261,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.14.11 + '@types/node': 22.0.2 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -3282,7 +3283,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 20.14.11 + '@types/node': 22.0.2 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -3352,7 +3353,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.14.11 + '@types/node': 22.0.2 '@types/yargs': 17.0.32 chalk: 4.1.2 @@ -3392,128 +3393,128 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@peggyjs/eslint-config@4.0.1(eslint@9.7.0)(typescript@5.5.3)': + '@peggyjs/eslint-config@4.0.3(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin': 2.3.0(eslint@9.7.0)(typescript@5.5.3) + '@stylistic/eslint-plugin': 2.6.0(eslint@9.8.0)(typescript@5.5.4) globals: 15.8.0 transitivePeerDependencies: - eslint - supports-color - typescript - '@peggyjs/from-mem@1.3.3': + '@peggyjs/from-mem@1.3.4': dependencies: - semver: 7.6.2 + semver: 7.6.3 '@pkgjs/parseargs@0.11.0': optional: true - '@playwright/test@1.45.2': + '@playwright/test@1.45.3': dependencies: - playwright: 1.45.2 + playwright: 1.45.3 - '@rollup/plugin-commonjs@26.0.1(rollup@4.18.1)': + '@rollup/plugin-commonjs@26.0.1(rollup@4.19.1)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + '@rollup/pluginutils': 5.1.0(rollup@4.19.1) commondir: 1.0.1 estree-walker: 2.0.2 glob: 10.4.5 is-reference: 1.2.1 magic-string: 0.30.10 optionalDependencies: - rollup: 4.18.1 + rollup: 4.19.1 - '@rollup/plugin-json@6.1.0(rollup@4.18.1)': + '@rollup/plugin-json@6.1.0(rollup@4.19.1)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + '@rollup/pluginutils': 5.1.0(rollup@4.19.1) optionalDependencies: - rollup: 4.18.1 + rollup: 4.19.1 - '@rollup/plugin-multi-entry@6.0.1(rollup@4.18.1)': + '@rollup/plugin-multi-entry@6.0.1(rollup@4.19.1)': dependencies: - '@rollup/plugin-virtual': 3.0.2(rollup@4.18.1) + '@rollup/plugin-virtual': 3.0.2(rollup@4.19.1) matched: 5.0.1 optionalDependencies: - rollup: 4.18.1 + rollup: 4.19.1 - '@rollup/plugin-node-resolve@15.2.3(rollup@4.18.1)': + '@rollup/plugin-node-resolve@15.2.3(rollup@4.19.1)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + '@rollup/pluginutils': 5.1.0(rollup@4.19.1) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.8 optionalDependencies: - rollup: 4.18.1 + rollup: 4.19.1 - '@rollup/plugin-typescript@11.1.6(rollup@4.18.1)(tslib@2.6.3)(typescript@5.5.3)': + '@rollup/plugin-typescript@11.1.6(rollup@4.19.1)(tslib@2.6.3)(typescript@5.5.4)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + '@rollup/pluginutils': 5.1.0(rollup@4.19.1) resolve: 1.22.8 - typescript: 5.5.3 + typescript: 5.5.4 optionalDependencies: - rollup: 4.18.1 + rollup: 4.19.1 tslib: 2.6.3 - '@rollup/plugin-virtual@3.0.2(rollup@4.18.1)': + '@rollup/plugin-virtual@3.0.2(rollup@4.19.1)': optionalDependencies: - rollup: 4.18.1 + rollup: 4.19.1 - '@rollup/pluginutils@5.1.0(rollup@4.18.1)': + '@rollup/pluginutils@5.1.0(rollup@4.19.1)': dependencies: '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 optionalDependencies: - rollup: 4.18.1 + rollup: 4.19.1 - '@rollup/rollup-android-arm-eabi@4.18.1': + '@rollup/rollup-android-arm-eabi@4.19.1': optional: true - '@rollup/rollup-android-arm64@4.18.1': + '@rollup/rollup-android-arm64@4.19.1': optional: true - '@rollup/rollup-darwin-arm64@4.18.1': + '@rollup/rollup-darwin-arm64@4.19.1': optional: true - '@rollup/rollup-darwin-x64@4.18.1': + '@rollup/rollup-darwin-x64@4.19.1': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.18.1': + '@rollup/rollup-linux-arm-gnueabihf@4.19.1': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.18.1': + '@rollup/rollup-linux-arm-musleabihf@4.19.1': optional: true - '@rollup/rollup-linux-arm64-gnu@4.18.1': + '@rollup/rollup-linux-arm64-gnu@4.19.1': optional: true - '@rollup/rollup-linux-arm64-musl@4.18.1': + '@rollup/rollup-linux-arm64-musl@4.19.1': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.18.1': + '@rollup/rollup-linux-powerpc64le-gnu@4.19.1': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.18.1': + '@rollup/rollup-linux-riscv64-gnu@4.19.1': optional: true - '@rollup/rollup-linux-s390x-gnu@4.18.1': + '@rollup/rollup-linux-s390x-gnu@4.19.1': optional: true - '@rollup/rollup-linux-x64-gnu@4.18.1': + '@rollup/rollup-linux-x64-gnu@4.19.1': optional: true - '@rollup/rollup-linux-x64-musl@4.18.1': + '@rollup/rollup-linux-x64-musl@4.19.1': optional: true - '@rollup/rollup-win32-arm64-msvc@4.18.1': + '@rollup/rollup-win32-arm64-msvc@4.19.1': optional: true - '@rollup/rollup-win32-ia32-msvc@4.18.1': + '@rollup/rollup-win32-ia32-msvc@4.19.1': optional: true - '@rollup/rollup-win32-x64-msvc@4.18.1': + '@rollup/rollup-win32-x64-msvc@4.19.1': optional: true '@sinclair/typebox@0.27.8': {} @@ -3536,49 +3537,49 @@ snapshots: dependencies: '@sinonjs/commons': 3.0.1 - '@stylistic/eslint-plugin-js@2.3.0(eslint@9.7.0)': + '@stylistic/eslint-plugin-js@2.6.0(eslint@9.8.0)': dependencies: - '@types/eslint': 8.56.10 + '@types/eslint': 9.6.0 acorn: 8.12.1 - eslint: 9.7.0 + eslint: 9.8.0 eslint-visitor-keys: 4.0.0 espree: 10.1.0 - '@stylistic/eslint-plugin-jsx@2.3.0(eslint@9.7.0)': + '@stylistic/eslint-plugin-jsx@2.6.0(eslint@9.8.0)': dependencies: - '@stylistic/eslint-plugin-js': 2.3.0(eslint@9.7.0) - '@types/eslint': 8.56.10 - eslint: 9.7.0 + '@stylistic/eslint-plugin-js': 2.6.0(eslint@9.8.0) + '@types/eslint': 9.6.0 + eslint: 9.8.0 estraverse: 5.3.0 picomatch: 4.0.2 - '@stylistic/eslint-plugin-plus@2.3.0(eslint@9.7.0)(typescript@5.5.3)': + '@stylistic/eslint-plugin-plus@2.6.0(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@types/eslint': 8.56.10 - '@typescript-eslint/utils': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) - eslint: 9.7.0 + '@types/eslint': 9.6.0 + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + eslint: 9.8.0 transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin-ts@2.3.0(eslint@9.7.0)(typescript@5.5.3)': + '@stylistic/eslint-plugin-ts@2.6.0(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.3.0(eslint@9.7.0) - '@types/eslint': 8.56.10 - '@typescript-eslint/utils': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) - eslint: 9.7.0 + '@stylistic/eslint-plugin-js': 2.6.0(eslint@9.8.0) + '@types/eslint': 9.6.0 + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + eslint: 9.8.0 transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin@2.3.0(eslint@9.7.0)(typescript@5.5.3)': + '@stylistic/eslint-plugin@2.6.0(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@stylistic/eslint-plugin-js': 2.3.0(eslint@9.7.0) - '@stylistic/eslint-plugin-jsx': 2.3.0(eslint@9.7.0) - '@stylistic/eslint-plugin-plus': 2.3.0(eslint@9.7.0)(typescript@5.5.3) - '@stylistic/eslint-plugin-ts': 2.3.0(eslint@9.7.0)(typescript@5.5.3) - '@types/eslint': 8.56.10 - eslint: 9.7.0 + '@stylistic/eslint-plugin-js': 2.6.0(eslint@9.8.0) + '@stylistic/eslint-plugin-jsx': 2.6.0(eslint@9.8.0) + '@stylistic/eslint-plugin-plus': 2.6.0(eslint@9.8.0)(typescript@5.5.4) + '@stylistic/eslint-plugin-ts': 2.6.0(eslint@9.8.0)(typescript@5.5.4) + '@types/eslint': 9.6.0 + eslint: 9.8.0 transitivePeerDependencies: - supports-color - typescript @@ -3606,7 +3607,7 @@ snapshots: '@types/chai@4.3.16': {} - '@types/eslint@8.56.10': + '@types/eslint@9.6.0': dependencies: '@types/estree': 1.0.5 '@types/json-schema': 7.0.15 @@ -3615,7 +3616,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 20.14.11 + '@types/node': 22.0.2 '@types/istanbul-lib-coverage@2.0.6': {} @@ -3636,9 +3637,9 @@ snapshots: '@types/minimatch@3.0.5': {} - '@types/node@20.14.11': + '@types/node@22.0.2': dependencies: - undici-types: 5.26.5 + undici-types: 6.11.1 '@types/resolve@1.20.2': {} @@ -3650,85 +3651,85 @@ snapshots: dependencies: '@types/yargs-parser': 21.0.3 - '@typescript-eslint/eslint-plugin@8.0.0-alpha.44(@typescript-eslint/parser@8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3))(eslint@9.7.0)(typescript@5.5.3)': + '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) - '@typescript-eslint/scope-manager': 8.0.0-alpha.44 - '@typescript-eslint/type-utils': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) - '@typescript-eslint/utils': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) - '@typescript-eslint/visitor-keys': 8.0.0-alpha.44 - eslint: 9.7.0 + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/type-utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.0 + eslint: 9.8.0 graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 - ts-api-utils: 1.3.0(typescript@5.5.3) + ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: - typescript: 5.5.3 + typescript: 5.5.4 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3)': + '@typescript-eslint/parser@8.0.0(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@typescript-eslint/scope-manager': 8.0.0-alpha.44 - '@typescript-eslint/types': 8.0.0-alpha.44 - '@typescript-eslint/typescript-estree': 8.0.0-alpha.44(typescript@5.5.3) - '@typescript-eslint/visitor-keys': 8.0.0-alpha.44 + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.5 - eslint: 9.7.0 + eslint: 9.8.0 optionalDependencies: - typescript: 5.5.3 + typescript: 5.5.4 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.0.0-alpha.44': + '@typescript-eslint/scope-manager@8.0.0': dependencies: - '@typescript-eslint/types': 8.0.0-alpha.44 - '@typescript-eslint/visitor-keys': 8.0.0-alpha.44 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/visitor-keys': 8.0.0 - '@typescript-eslint/type-utils@8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3)': + '@typescript-eslint/type-utils@8.0.0(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@typescript-eslint/typescript-estree': 8.0.0-alpha.44(typescript@5.5.3) - '@typescript-eslint/utils': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) debug: 4.3.5 - ts-api-utils: 1.3.0(typescript@5.5.3) + ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: - typescript: 5.5.3 + typescript: 5.5.4 transitivePeerDependencies: - eslint - supports-color - '@typescript-eslint/types@8.0.0-alpha.44': {} + '@typescript-eslint/types@8.0.0': {} - '@typescript-eslint/typescript-estree@8.0.0-alpha.44(typescript@5.5.3)': + '@typescript-eslint/typescript-estree@8.0.0(typescript@5.5.4)': dependencies: - '@typescript-eslint/types': 8.0.0-alpha.44 - '@typescript-eslint/visitor-keys': 8.0.0-alpha.44 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.5 globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.6.2 - ts-api-utils: 1.3.0(typescript@5.5.3) + ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: - typescript: 5.5.3 + typescript: 5.5.4 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3)': + '@typescript-eslint/utils@8.0.0(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.7.0) - '@typescript-eslint/scope-manager': 8.0.0-alpha.44 - '@typescript-eslint/types': 8.0.0-alpha.44 - '@typescript-eslint/typescript-estree': 8.0.0-alpha.44(typescript@5.5.3) - eslint: 9.7.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0) + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + eslint: 9.8.0 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/visitor-keys@8.0.0-alpha.44': + '@typescript-eslint/visitor-keys@8.0.0': dependencies: - '@typescript-eslint/types': 8.0.0-alpha.44 + '@typescript-eslint/types': 8.0.0 eslint-visitor-keys: 3.4.3 a-sync-waterfall@1.0.1: {} @@ -4076,13 +4077,13 @@ snapshots: core-util-is@1.0.3: {} - create-jest@29.7.0(@types/node@20.14.11): + create-jest@29.7.0(@types/node@22.0.2): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@20.14.11) + jest-config: 29.7.0(@types/node@22.0.2) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -4203,22 +4204,22 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-plugin-compat@6.0.0(eslint@9.7.0): + eslint-plugin-compat@6.0.0(eslint@9.8.0): dependencies: '@mdn/browser-compat-data': 5.5.39 ast-metadata-inferer: 0.8.0 browserslist: 4.23.2 caniuse-lite: 1.0.30001642 - eslint: 9.7.0 + eslint: 9.8.0 find-up: 5.0.0 globals: 15.8.0 lodash.memoize: 4.1.2 semver: 7.6.2 - eslint-plugin-mocha@10.4.3(eslint@9.7.0): + eslint-plugin-mocha@10.5.0(eslint@9.8.0): dependencies: - eslint: 9.7.0 - eslint-utils: 3.0.0(eslint@9.7.0) + eslint: 9.8.0 + eslint-utils: 3.0.0(eslint@9.8.0) globals: 13.24.0 rambda: 7.5.0 @@ -4227,9 +4228,9 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 - eslint-utils@3.0.0(eslint@9.7.0): + eslint-utils@3.0.0(eslint@9.8.0): dependencies: - eslint: 9.7.0 + eslint: 9.8.0 eslint-visitor-keys: 2.1.0 eslint-visitor-keys@2.1.0: {} @@ -4238,13 +4239,13 @@ snapshots: eslint-visitor-keys@4.0.0: {} - eslint@9.7.0: + eslint@9.8.0: dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.7.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0) '@eslint-community/regexpp': 4.11.0 - '@eslint/config-array': 0.17.0 + '@eslint/config-array': 0.17.1 '@eslint/eslintrc': 3.1.0 - '@eslint/js': 9.7.0 + '@eslint/js': 9.8.0 '@humanwhocodes/module-importer': 1.0.1 '@humanwhocodes/retry': 0.3.0 '@nodelib/fs.walk': 1.2.8 @@ -4752,7 +4753,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.3 @@ -4772,16 +4773,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@20.14.11): + jest-cli@29.7.0(@types/node@22.0.2): dependencies: '@jest/core': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.14.11) + create-jest: 29.7.0(@types/node@22.0.2) exit: 0.1.2 import-local: 3.1.0 - jest-config: 29.7.0(@types/node@20.14.11) + jest-config: 29.7.0(@types/node@22.0.2) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -4791,7 +4792,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@20.14.11): + jest-config@29.7.0(@types/node@22.0.2): dependencies: '@babel/core': 7.24.9 '@jest/test-sequencer': 29.7.0 @@ -4816,7 +4817,7 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 20.14.11 + '@types/node': 22.0.2 transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -4845,7 +4846,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -4855,7 +4856,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 20.14.11 + '@types/node': 22.0.2 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -4894,7 +4895,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -4929,7 +4930,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -4957,7 +4958,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 chalk: 4.1.2 cjs-module-lexer: 1.3.1 collect-v8-coverage: 1.0.2 @@ -5003,7 +5004,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -5022,7 +5023,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.11 + '@types/node': 22.0.2 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -5031,17 +5032,17 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 20.14.11 + '@types/node': 22.0.2 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@20.14.11): + jest@29.7.0(@types/node@22.0.2): dependencies: '@jest/core': 29.7.0 '@jest/types': 29.6.3 import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@20.14.11) + jest-cli: 29.7.0(@types/node@22.0.2) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -5381,11 +5382,11 @@ snapshots: dependencies: find-up: 4.1.0 - playwright-core@1.45.2: {} + playwright-core@1.45.3: {} - playwright@1.45.2: + playwright@1.45.3: dependencies: - playwright-core: 1.45.2 + playwright-core: 1.45.3 optionalDependencies: fsevents: 2.3.2 @@ -5597,26 +5598,26 @@ snapshots: rollup-plugin-ignore@1.0.10: {} - rollup@4.18.1: + rollup@4.19.1: dependencies: '@types/estree': 1.0.5 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.18.1 - '@rollup/rollup-android-arm64': 4.18.1 - '@rollup/rollup-darwin-arm64': 4.18.1 - '@rollup/rollup-darwin-x64': 4.18.1 - '@rollup/rollup-linux-arm-gnueabihf': 4.18.1 - '@rollup/rollup-linux-arm-musleabihf': 4.18.1 - '@rollup/rollup-linux-arm64-gnu': 4.18.1 - '@rollup/rollup-linux-arm64-musl': 4.18.1 - '@rollup/rollup-linux-powerpc64le-gnu': 4.18.1 - '@rollup/rollup-linux-riscv64-gnu': 4.18.1 - '@rollup/rollup-linux-s390x-gnu': 4.18.1 - '@rollup/rollup-linux-x64-gnu': 4.18.1 - '@rollup/rollup-linux-x64-musl': 4.18.1 - '@rollup/rollup-win32-arm64-msvc': 4.18.1 - '@rollup/rollup-win32-ia32-msvc': 4.18.1 - '@rollup/rollup-win32-x64-msvc': 4.18.1 + '@rollup/rollup-android-arm-eabi': 4.19.1 + '@rollup/rollup-android-arm64': 4.19.1 + '@rollup/rollup-darwin-arm64': 4.19.1 + '@rollup/rollup-darwin-x64': 4.19.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.19.1 + '@rollup/rollup-linux-arm-musleabihf': 4.19.1 + '@rollup/rollup-linux-arm64-gnu': 4.19.1 + '@rollup/rollup-linux-arm64-musl': 4.19.1 + '@rollup/rollup-linux-powerpc64le-gnu': 4.19.1 + '@rollup/rollup-linux-riscv64-gnu': 4.19.1 + '@rollup/rollup-linux-s390x-gnu': 4.19.1 + '@rollup/rollup-linux-x64-gnu': 4.19.1 + '@rollup/rollup-linux-x64-musl': 4.19.1 + '@rollup/rollup-win32-arm64-msvc': 4.19.1 + '@rollup/rollup-win32-ia32-msvc': 4.19.1 + '@rollup/rollup-win32-x64-msvc': 4.19.1 fsevents: 2.3.3 run-parallel@1.2.0: @@ -5640,6 +5641,8 @@ snapshots: semver@7.6.2: {} + semver@7.6.3: {} + send@0.18.0: dependencies: debug: 2.6.9 @@ -5822,22 +5825,22 @@ snapshots: dependencies: punycode: 2.3.1 - ts-api-utils@1.3.0(typescript@5.5.3): + ts-api-utils@1.3.0(typescript@5.5.4): dependencies: - typescript: 5.5.3 + typescript: 5.5.4 - ts-jest@29.2.3(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@20.14.11))(typescript@5.5.3): + ts-jest@29.2.3(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@22.0.2))(typescript@5.5.4): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@20.14.11) + jest: 29.7.0(@types/node@22.0.2) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 make-error: 1.3.6 semver: 7.6.2 - typescript: 5.5.3 + typescript: 5.5.4 yargs-parser: 21.1.1 optionalDependencies: '@babel/core': 7.24.9 @@ -5862,25 +5865,25 @@ snapshots: media-typer: 0.3.0 mime-types: 2.1.35 - typescript-eslint@8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3): + typescript-eslint@8.0.0(eslint@9.8.0)(typescript@5.5.4): dependencies: - '@typescript-eslint/eslint-plugin': 8.0.0-alpha.44(@typescript-eslint/parser@8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3))(eslint@9.7.0)(typescript@5.5.3) - '@typescript-eslint/parser': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) - '@typescript-eslint/utils': 8.0.0-alpha.44(eslint@9.7.0)(typescript@5.5.3) + '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) optionalDependencies: - typescript: 5.5.3 + typescript: 5.5.4 transitivePeerDependencies: - eslint - supports-color - typescript@5.5.3: {} + typescript@5.5.4: {} uc.micro@1.0.6: {} uglify-js@3.18.0: optional: true - undici-types@5.26.5: {} + undici-types@6.11.1: {} unpipe@1.0.0: {} diff --git a/web-test/package.json b/web-test/package.json index 47a32db1..87e90ea8 100644 --- a/web-test/package.json +++ b/web-test/package.json @@ -12,8 +12,8 @@ "author": "Joe Hildebrand ", "license": "MIT", "devDependencies": { - "@playwright/test": "1.45.2", - "@types/node": "20.14.11" + "@playwright/test": "1.45.3", + "@types/node": "22.0.2" }, "engines": { "node": ">=18" From 41575521f434a6a34f01c130b00d06e8eef99343 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Thu, 1 Aug 2024 13:31:53 -0500 Subject: [PATCH 13/14] Clean up unknowns --- bin/generated_template.d.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/generated_template.d.ts b/bin/generated_template.d.ts index c85dfe44..17fe5223 100644 --- a/bin/generated_template.d.ts +++ b/bin/generated_template.d.ts @@ -8,13 +8,16 @@ export interface Location { readonly offset: number; } -export interface GrammarSourceObject { - readonly source?: undefined | string | unknown; - readonly offset?: undefined | ((loc: Location) => Location); +export interface Stringable { readonly toString: () => string; } -export type GrammarSource = string | GrammarSourceObject | unknown; +export interface GrammarSourceObject extends Stringable { + readonly source?: undefined | string | Stringable; + readonly offset?: undefined | ((loc: Location) => Location); +} + +export type GrammarSource = string | GrammarSourceObject; /** The `start` and `end` position's of an object within the source. */ export interface LocationRange { From 349eb8008748546a474d1c9caf07ba172a7ce919 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Tue, 6 Aug 2024 13:23:46 -0600 Subject: [PATCH 14/14] Command line for --returnTypes changed to --returnTypes. Docs added. Small updates to generated_template.d.ts - mostly docs, but I think GrammarSource is better now, as is StartRules. Switched to opts file for building parser. Updated deps. --- bin/generated_template.d.ts | 75 ++++++- bin/peggy-cli.js | 2 +- docs/documentation.html | 41 +++- docs/js/test-bundle.min.js | 2 +- eslint.config.js | 2 +- package.json | 12 +- pnpm-lock.yaml | 435 +++++++++++++++++++++--------------- src/opts.mjs | 13 ++ test/cli/run.spec.ts | 2 +- web-test/package.json | 4 +- 10 files changed, 381 insertions(+), 207 deletions(-) create mode 100644 src/opts.mjs diff --git a/bin/generated_template.d.ts b/bin/generated_template.d.ts index 17fe5223..93af149e 100644 --- a/bin/generated_template.d.ts +++ b/bin/generated_template.d.ts @@ -8,15 +8,25 @@ export interface Location { readonly offset: number; } -export interface Stringable { +/** + * Anything that can successfully be converted to a string with `String()` + * so that it can be used in error messages. + * + * The GrammarLocation class in Peggy is a good example. + */ +export interface GrammarSourceObject extends Stringable { readonly toString: () => string; -} -export interface GrammarSourceObject extends Stringable { - readonly source?: undefined | string | Stringable; + /** + * If specified, allows the grammar source to be embedded in a larger file + * at some offset. + */ readonly offset?: undefined | ((loc: Location) => Location); } +/** + * Most often, you just use a string with the file name. + */ export type GrammarSource = string | GrammarSourceObject; /** The `start` and `end` position's of an object within the source. */ @@ -32,34 +42,60 @@ export interface LocationRange { readonly end: Location; } +/** + * Expected a literal string, like `"foo"i`. + */ export interface LiteralExpectation { readonly type: "literal"; readonly text: string; readonly ignoreCase: boolean; } +/** + * Range of characters, like `a-z` + */ export type ClassRange = [ start: string, end: string, ] + export interface ClassParts extends Array { } + +/** + * Expected a class, such as `[^acd-gz]i` + */ export interface ClassExpectation { readonly type: "class"; readonly parts: ClassParts; readonly inverted: boolean; readonly ignoreCase: boolean; } + +/** + * Expected any character, with `.` + */ export interface AnyExpectation { readonly type: "any"; } + +/** + * Expected the end of input. + */ export interface EndExpectation { readonly type: "end"; } + +/** + * Expected some other input. These are specified with a rule's + * "human-readable name", or with the `expected(message, location)` + * function. + */ export interface OtherExpectation { readonly type: "other"; readonly description: string; } + export type Expectation = | AnyExpectation | ClassExpectation @@ -67,6 +103,9 @@ export type Expectation = | LiteralExpectation | OtherExpectation; +/** + * Pass an array of these into `SyntaxError.prototype.format()` + */ export interface SourceText { /** * Identifier of an input that was used as a grammarSource in parse(). @@ -96,16 +135,33 @@ export declare class SyntaxError extends Error { found: string | null, location: LocationRange, ); + + /** + * With good sources, generates a feature-rich error message pointing to the + * error in the input. + * @param sources List of {source, text} objects that map to the input. + */ format(sources: SourceText[]): string; } +/** + * Trace execution of the parser. + */ export interface ParserTracer { trace: (event: ParserTracerEvent) => void; } export type ParserTracerEvent - = { readonly type: "rule.enter"; readonly rule: string; readonly location: LocationRange } - | { readonly type: "rule.fail"; readonly rule: string; readonly location: LocationRange } + = { + readonly type: "rule.enter"; + readonly rule: string; + readonly location: LocationRange + } + | { + readonly type: "rule.fail"; + readonly rule: string; + readonly location: LocationRange + } | { readonly type: "rule.match"; readonly rule: string; @@ -114,8 +170,8 @@ export type ParserTracerEvent readonly result: unknown; }; -export type StartRules = $$$StartRules$$$; -export interface ParseOptions { +export type StartRuleNames = $$$StartRules$$$; +export interface ParseOptions { /** * String or object that will be attached to the each `LocationRange` object * created by the parser. For example, this can be path to the parsed file @@ -137,7 +193,8 @@ export interface ParseOptions { [key: string]: unknown; } -export declare const parse: typeof ParseFunction; +export declare const StartRules: StartRuleNames[]; export declare const SyntaxError: typeof _PeggySyntaxError; +export declare const parse: typeof ParseFunction; // Overload of ParseFunction for each allowedStartRule diff --git a/bin/peggy-cli.js b/bin/peggy-cli.js index 926a5b1b..b669dd54 100644 --- a/bin/peggy-cli.js +++ b/bin/peggy-cli.js @@ -151,7 +151,7 @@ class PeggyCLI extends Command { "Generate a source map. If name is not specified, the source map will be named \".map\" if input is a file and \"source.map\" if input is a standard input. If the special filename `inline` is given, the sourcemap will be embedded in the output file as a data URI. If the filename is prefixed with `hidden:`, no mapping URL will be included so that the mapping can be specified with an HTTP SourceMap: header. This option conflicts with the `-t/--test` and `-T/--test-file` options unless `-o/--output` is also specified" ) .option( - "--returnTypes ", + "--return-types ", "Types returned for rules, as JSON object of the form {\"ruleName\": \"type\"}", moreJSON ) diff --git a/docs/documentation.html b/docs/documentation.html index c27e0ff2..3a330d88 100644 --- a/docs/documentation.html +++ b/docs/documentation.html @@ -32,6 +32,9 @@

Table of Contents

  • Error Reporting
  • +
  • + Generating TypeScript Types +
  • Using the Parser
  • @@ -184,6 +187,12 @@

    Command Line

    Dependencies, in JSON object format with variable:module pairs. (Can be specified multiple times).
    +
    --dts
    +
    Generate a .d.ts file next to the output .js file containing TypeScript + types for the generated parser. See Generating + TypeScript Types for more information. +
    +
    -e, --export-var <variable>
    Name of a global variable into which the parser object is assigned to when no module loader is detected.
    @@ -223,6 +232,15 @@

    Command Line

    specified +
    --return-types <JSON object>
    +
    If --dts is specified, the typeInfo provided + will be used to specify the return type of the given rules. + typeInfo should be specified as a JSON object whose keys are + rule names and whose values are strings containing the return type for that + rule. See Generating TypeScript Types for + more information. +
    +
    -S, --start-rule <rule>
    When testing, use this rule as the start rule. Automatically added to the allowedStartRules.
    @@ -339,7 +357,7 @@

    Importing

    import peggy from "peggy";
    -

    With some configurations of Typescript or other tools, you might need:

    +

    With some configurations of TypeScript or other tools, you might need:

    import * as peggy from "peggy";
    @@ -514,6 +532,27 @@

    Error Reporting

  • generate
  • +

    Generating TypeScript Types

    +

    If you are consuming the generated parser from TypeScript, it is useful for + there to be a .d.ts file next to the generated .js file that describes the + types used in the parser. To enable this, use a configuration file such as:

    + +
    // MJS
    +export default {
    +  input: "foo.peggy",
    +  output: "foo.js",
    +  dts: true,
    +  returnTypes: {
    +    foo: "string",
    +  },
    +};
    + +

    If a rule name is in the allowedStartRules, but not in returnTypes, + any will be used as the return type for that rule.

    +

    Note that --return-types <JSON object> can be specified + on the command line; the use of a config file just makes quoting easier to get + correct.

    +

    Using the Parser

    To use the generated parser, import it using your selected module approach diff --git a/docs/js/test-bundle.min.js b/docs/js/test-bundle.min.js index 21bebfe1..da638606 100644 --- a/docs/js/test-bundle.min.js +++ b/docs/js/test-bundle.min.js @@ -5,4 +5,4 @@ // Copyright (c) 2024- the Peggy authors // Licensed under the MIT License. -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("chai"),require("whatwg-url")):"function"==typeof define&&define.amd?define(["chai","whatwg-url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).chai,e.whatwgURL)}(this,(function(require$$0,require$$0$1){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},GrammarLocation$5=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$5,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$4=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$5=function(e){function t(r,a,n){var o=e.call(this,r)||this;return setProtoOf(o,t.prototype),o.name="GrammarError",o.location=a,void 0===n&&(n=[]),o.diagnostics=n,o.stage=null,o.problems=[["error",r,a,n]],o}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,a=this.diagnostics;r1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$8.findRule(e,t.name);return r?n(r):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:r,any:r});return n(t)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=combinePossibleArrays(e.topLevelInitializer,t.topLevelInitializer),e.initializer=combinePossibleArrays(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}},asts_1=asts$8;function addImportedRules$1(e){for(var t=0,r=0,a=e.imports;r0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?t.match=o(r):SOMETIMES_MATCH$1},library_ref:function(){return 0},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n1?f(SOMETIMES_MATCH,[op$2.IF_ERROR],l([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=u(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=v(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?i(!1,Object.keys(r),e):-1;return a?l([op$2.PUSH_CURR_POS],n,f(o,[op$2.IF_NOT_ERROR],l([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return l([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return l(v(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),f(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),l(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck&&a.pluck.length>0)return l([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=i(!1,Object.keys(a.env),a.action);return l([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return l([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,a){var n=a.env,o=e.label,s=a.sp+1;o&&(n=u(a.env),a.env[o]=s),e.pick&&a.pluck.push(s);var c=v(e.expression,{sp:a.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?l([op$2.SOURCE_MAP_LABEL_PUSH,s,r.add(o),p(e.labelLocation)],c,[op$2.SOURCE_MAP_LABEL_POP,s]):c},text:function(e,t){return l([op$2.PUSH_CURR_POS],v(e.expression,{sp:t.sp+1,env:u(t.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return l(v(e.expression,{sp:t.sp,env:u(t.env),action:null}),f(-(e.expression.match||0),[op$2.IF_ERROR],l([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,$(r),[op$2.POP])},one_or_more:function(e,t){var r=v(e.expression,{sp:t.sp+1,env:u(t.env),action:null});return l([op$2.PUSH_EMPTY_ARRAY],r,f(e.expression.match||0,[op$2.IF_NOT_ERROR],l($(r),[op$2.POP]),l([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?h(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=h(e.max,t.env,s.sp,o),i=v(e.expression,{sp:c.sp+o,env:u(t.env),action:null}),p=null!==e.delimiter?v(e.expression,{sp:c.sp+o+1,env:u(t.env),action:null}):i,d=function(e,t,r,a,n){return e?l([op$2.PUSH_CURR_POS],v(e,{sp:a.sp+n+1,env:u(a.env),action:null}),f(e.match||0,[op$2.IF_NOT_ERROR],l([op$2.POP],r,f(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,p,t,o),m=x(d,e.max),g=n?x(i,e.max):i,b=l(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],g,$(m),[op$2.POP]);return l(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp||0];return l(e,f(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}(b,r):b,c.post,s.post)},group:function(e,t){return v(e.expression,{sp:t.sp,env:u(t.env),action:null})},semantic_and:function(e,t){return g(e,!1,t)},semantic_not:function(e,t){return g(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$6.indexOfRule(e,t.name)]},library_ref:function(e){return[op$2.LIBRARY_RULE,e.libraryNumber,o.add(e.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,a=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?r.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,o=t!==ALWAYS_MATCH?n.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return f(t,e.ignoreCase?[op$2.MATCH_STRING_IC,a]:[op$2.MATCH_STRING,a],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,a],[op$2.FAIL,o])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?a.add(e):-1,o=t!==ALWAYS_MATCH?n.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return f(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?n.add({type:"any"}):-1;return f(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(b).forEach((function(e){var t=b[e];b[e]=function(e){for(var r=[],a=1;a>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-p),p=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offsett.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:Br,ImportsAndSource:function(){var t,r,n;return t=Ar,r=function(){var t,r;return t=Ar,r=Ar,Mr(),r=e.substring(r,Ar),yr=t,At(r)}(),n=function(){var t,r,n,o;for(t=Ar,r=Ar,n=[],e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));o!==a;)n.push(o),e.length>Ar?(o=e.charAt(Ar),Ar++):(o=a,0===kr&&Or(ie));return r=e.substring(r,Ar),yr=t,vt(r)}(),yr=t,bt(r,n)}},s=Br,c="import",i=";",p=",",u="*",l="as",f="{",d="}",m="from",g="=",$="/",h="@",x=":",b="|",v="..",A="(",y=")",S=".",_="\n",E="\r\n",k="/*",T="*/",C="//",w="\\",P="i",R='"',L="'",F="[",O="^",B="]",M="-",D="0",I="b",j="f",N="n",U="r",q="t",G="v",H="x",z="u",W=/^[!$&]/,V=/^[*-+?]/,Y=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,J=/^[\n\r\u2028\u2029]/,X=/^[\r\u2028-\u2029]/,K=/^[A-Z_a-z\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\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0-\u08B4\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\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\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\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-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\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]/,Z=/^[$0-9_\u0300-\u036F\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\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\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\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\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\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\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\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\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\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\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\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]/,ee=/^[\n\r"\\\u2028-\u2029]/,te=/^[\n\r'\\\u2028-\u2029]/,re=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,ne=/^[0-9ux]/,oe=/^[0-9]/,se=/^[0-9a-f]/i,ce=/^[{}]/,ie={type:"any"},pe=wr("import",!1),ue=wr(";",!1),le=wr(",",!1),fe=wr("*",!1),de=wr("as",!1),me=wr("{",!1),ge=wr("}",!1),$e=wr("from",!1),he=wr("=",!1),xe=wr("/",!1),be=wr("@",!1),ve=wr(":",!1),Ae=Pr(["!","$","&"],!1,!1),ye=Pr([["*","+"],"?"],!1,!1),Se=wr("|",!1),_e=wr("..",!1),Ee=wr("(",!1),ke=wr(")",!1),Te=wr(".",!1),Ce=Pr(["!","&"],!1,!1),we=Rr("whitespace"),Pe=Pr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Re=Pr(["\n","\r","\u2028","\u2029"],!1,!1),Le=Rr("end of line"),Fe=wr("\n",!1),Oe=wr("\r\n",!1),Be=Pr(["\r",["\u2028","\u2029"]],!1,!1),Me=Rr("comment"),De=wr("/*",!1),Ie=wr("*/",!1),je=wr("//",!1),Ne=Rr("identifier"),Ue=Pr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),qe=wr("\\",!1),Ge=Pr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["‌","‍"],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),He=Rr("literal"),ze=wr("i",!1),We=Rr("string"),Ve=wr('"',!1),Ye=wr("'",!1),Qe=Pr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Je=Pr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Xe=Rr("character class"),Ke=wr("[",!1),Ze=wr("^",!1),et=wr("]",!1),tt=wr("-",!1),rt=Pr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),at=wr("0",!1),nt=Pr(['"',"'","\\"],!1,!1),ot=wr("b",!1),st=wr("f",!1),ct=wr("n",!1),it=wr("r",!1),pt=wr("t",!1),ut=wr("v",!1),lt=Pr([["0","9"],"u","x"],!1,!1),ft=wr("x",!1),dt=wr("u",!1),mt=Pr([["0","9"]],!1,!1),gt=Pr([["0","9"],["a","f"]],!1,!0),$t=Rr("code block"),ht=Pr(["{","}"],!1,!1),xt=function(e,t,r,a){return{type:"grammar",imports:e,topLevelInitializer:t,initializer:r,rules:a,location:Tr()}},bt=function(e,t){return[e,t]},vt=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},At=function(e){return{type:"top_level_initializer",code:e,codeLocation:Tr()}},yt=function(e,t){return{type:"grammar_import",what:e,from:t,location:Tr()}},St=function(e){return{type:"grammar_import",what:[],from:e,location:Tr()}},_t=function(e,t){return t?Array.isArray(t)?(t.unshift(e),t):[e,t]:[e]},Et=function(e){return{type:"import_binding_default",binding:e[0],location:e[1]}},kt=function(e){return[{type:"import_binding_all",binding:e[0],location:e[1]}]},Tt=function(){return[]},Ct=function(e,t){return{type:"import_binding_rename",rename:e[0],renameLocation:e[1],binding:t[0],location:t[1]}},wt=function(e){return{type:"import_binding",binding:e[0],location:e[1]}},Pt=function(e){return{type:"import_module_specifier",module:e,location:Tr()}},Rt=function(e){return[e,Tr()]},Lt=function(e){return[e,Tr()]},Ft=function(e){return Sa.indexOf(e[0])>=0&&Cr("Binding identifier can't be a reserved word \"".concat(e[0],'"'),e[1]),e[0]},Ot=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:Tr()}},Bt=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:Tr()}},Mt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:Tr()}:r,location:Tr()}},Dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:Tr()}:e},It=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:Tr()}:e},jt=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:Tr()}:e},Nt=function(e,t,r){return r.type.startsWith("semantic_")&&Cr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:Tr()}},Ut=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:Tr()}},qt=function(){return Tr()},Gt=function(e){return Sa.indexOf(e[0])>=0&&Cr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ht=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:Tr()}},zt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:Tr()}},Wt=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&Cr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:Tr()}},Vt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Yt=function(e){return[null,e]},Qt=function(e){return{type:"constant",value:e,location:Tr()}},Jt=function(e){return{type:"variable",value:e[0],location:Tr()}},Xt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:Tr()}},Kt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:Tr()}:e},Zt=function(e,t){return{type:"library_ref",name:t[0],library:e[0],libraryNumber:-1,location:Tr()}},er=function(e){return{type:"rule_ref",name:e[0],location:Tr()}},tr=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:Tr()}},rr=function(e,t){return[e+t.join(""),Tr()]},ar=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:Tr()}},nr=function(e){return e.join("")},or=function(e){return e.join("")},sr=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:Tr()}},cr=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&Cr("Invalid character range: "+e.substring(yr,Ar)+"."),[t,r]},ir=function(){return""},pr=function(){return"\0"},ur=function(){return"\b"},lr=function(){return"\f"},fr=function(){return"\n"},dr=function(){return"\r"},mr=function(){return"\t"},gr=function(){return"\v"},$r=function(e){return String.fromCharCode(parseInt(e,16))},hr=function(e){return String.fromCharCode(parseInt(e,16))},xr=function(){return{type:"any",location:Tr()}},br=function(e){return[e,Tr()]},vr=function(e){return parseInt(e,10)},Ar=0|t.peg$currPos,yr=Ar,Sr=[{line:1,column:1}],_r=Ar,Er=t.peg$maxFailExpected||[],kr=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function Tr(){return Fr(yr,Ar)}function Cr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:Fr(yr,Ar))}function wr(e,t){return{type:"literal",text:e,ignoreCase:t}}function Pr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Rr(e){return{type:"other",description:e}}function Lr(t){var r,a=Sr[t];if(a)return a;if(t>=Sr.length)r=Sr.length-1;else for(r=t;!Sr[--r];);for(a={line:(a=Sr[r]).line,column:a.column};r_r&&(_r=Ar,Er=[]),Er.push(e))}function Br(){var t,r,n,o,s,c,i,p;if(t=Ar,r=Mr(),n=Ar,o=Aa(),s=function(){var t,r,n,o;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a&&(n=ba())!==a?(125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a&&ya()!==a?(yr=t,t=Ot(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?n=s:(Ar=n,n=a),n===a&&(n=null),o=Ar,s=Aa(),c=function(){var e,t;return e=Ar,(t=ba())!==a&&ya()!==a?(yr=e,e=Bt(t)):(Ar=e,e=a),e}(),c!==a?o=c:(Ar=o,o=a),o===a&&(o=null),s=Aa(),c=[],i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a),i!==a)for(;i!==a;)c.push(i),i=Ar,(p=Gr())!==a?(Aa(),i=p):(Ar=i,i=a);else c=a;return c!==a?(yr=t,t=xt(r,n,o,c)):(Ar=t,t=a),t}function Mr(){var e,t;for(e=[],t=Dr();t!==a;)e.push(t),t=Dr();return e}function Dr(){var t,r,n,o,s,u,l,f;return t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),n=function(){var t,r,n,o,s;return(t=Ir())===a&&(t=jr())===a&&(t=Ar,r=function(){var e,t;return e=Ar,(t=qr())!==a&&(yr=e,t=Et(t)),e=t}(),r!==a?(n=Ar,Aa(),44===e.charCodeAt(Ar)?(o=p,Ar++):(o=a,0===kr&&Or(le)),o!==a?(Aa(),(s=Ir())===a&&(s=jr()),s!==a?n=s:(Ar=n,n=a)):(Ar=n,n=a),n===a&&(n=null),yr=t,t=_t(r,n)):(Ar=t,t=a)),t}(),n!==a?(o=Aa(),s=function(){var t,r,n;return t=Ar,e.substr(Ar,4)===m?(r=m,Ar+=4):(r=a,0===kr&&Or($e)),r!==a?(Aa(),(n=Ur())!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),t}(),s!==a?(u=Ar,l=Aa(),59===e.charCodeAt(Ar)?(f=i,Ar++):(f=a,0===kr&&Or(ue)),f!==a?u=l=[l,f]:(Ar=u,u=a),u===a&&(u=null),yr=t,t=yt(n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,Aa(),e.substr(Ar,6)===c?(r=c,Ar+=6):(r=a,0===kr&&Or(pe)),r!==a?(Aa(),(n=Ur())!==a?(o=Ar,s=Aa(),59===e.charCodeAt(Ar)?(u=i,Ar++):(u=a,0===kr&&Or(ue)),u!==a?o=s=[s,u]:(Ar=o,o=a),o===a&&(o=null),yr=t,t=St(n)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Ir(){var t,r,n,o;return t=Ar,42===e.charCodeAt(Ar)?(r=u,Ar++):(r=a,0===kr&&Or(fe)),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=kt(o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function jr(){var t,r,n,o,s;return t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),125===e.charCodeAt(Ar)?(n=d,Ar++):(n=a,0===kr&&Or(ge)),n!==a?(yr=t,t=Tt()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(Aa(),n=function(){var t,r,n,o,s,c;for(t=Ar,r=[],n=Nr();n!==a;)r.push(n),n=Ar,o=Ar,s=Aa(),44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?o=s=[s,c,Aa()]:(Ar=o,o=a),o!==a&&(o=Nr())===a?(Ar=n,n=a):n=o;return r.length<1?(Ar=t,t=a):t=r,t}(),n!==a?(Aa(),o=Ar,44===e.charCodeAt(Ar)?(s=p,Ar++):(s=a,0===kr&&Or(le)),s!==a?o=s=[s,Aa()]:(Ar=o,o=a),o===a&&(o=null),125===e.charCodeAt(Ar)?(s=d,Ar++):(s=a,0===kr&&Or(ge)),s!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)),t}function Nr(){var t,r,n,o;return t=Ar,r=function(){var e,t;return(e=oa())===a&&(e=Ar,(t=ia())!==a&&(yr=e,t=Lt(t)),e=t),e}(),r!==a?(Aa(),e.substr(Ar,2)===l?(n=l,Ar+=2):(n=a,0===kr&&Or(de)),n!==a?(Aa(),(o=qr())!==a?(yr=t,t=Ct(r,o)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=qr())!==a&&(yr=t,r=wt(r)),t=r),t}function Ur(){var e,t;return e=Ar,(t=ia())!==a&&(yr=e,t=Pt(t)),t}function qr(){var e,t;return e=Ar,t=function(){var e,t;return e=Ar,(t=oa())!==a&&(yr=e,t=Ft(t)),e=t}(),t!==a&&(yr=e,t=Rt(t)),t}function Gr(){var t,r,n,o,s;return t=Ar,(r=oa())!==a?(Aa(),n=Ar,(o=ia())!==a?(Aa(),n=o):(Ar=n,n=a),n===a&&(n=null),61===e.charCodeAt(Ar)?(o=g,Ar++):(o=a,0===kr&&Or(he)),o!==a?(Aa(),(s=Hr())!==a&&ya()!==a?(yr=t,t=Mt(r,n,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}function Hr(){var t,r,n,o,s,c;if(t=Ar,(r=zr())!==a){for(n=[],o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);o!==a;)n.push(o),o=Ar,Aa(),47===e.charCodeAt(Ar)?(s=$,Ar++):(s=a,0===kr&&Or(xe)),s!==a?(Aa(),(c=zr())!==a?o=c:(Ar=o,o=a)):(Ar=o,o=a);yr=t,t=Dt(r,n)}else Ar=t,t=a;return t}function zr(){var e,t,r,n;return e=Ar,t=function(){var e,t,r,n,o;if(e=Ar,(t=Wr())!==a){for(r=[],n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);n!==a;)r.push(n),n=Ar,Aa(),(o=Wr())!==a?n=o:(Ar=n,n=a);yr=e,e=jt(t,r)}else Ar=e,e=a;return e}(),t!==a?(r=Ar,Aa(),(n=ba())!==a?r=n:(Ar=r,r=a),r===a&&(r=null),yr=e,e=It(t,r)):(Ar=e,e=a),e}function Wr(){var t,r,n,o;return t=Ar,r=function(){var t,r;return t=Ar,64===e.charCodeAt(Ar)?(r=h,Ar++):(r=a,0===kr&&Or(be)),r!==a&&(yr=t,r=qt()),t=r}(),r!==a?((n=Vr())===a&&(n=null),(o=Yr())!==a?(yr=t,t=Nt(r,n,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=Vr())!==a&&(n=Yr())!==a?(yr=t,t=Ut(r,n)):(Ar=t,t=a),t===a&&(t=Yr())),t}function Vr(){var t,r,n;return t=Ar,(r=oa())!==a?(Aa(),58===e.charCodeAt(Ar)?(n=x,Ar++):(n=a,0===kr&&Or(ve)),n!==a?(Aa(),yr=t,t=Gt(r)):(Ar=t,t=a)):(Ar=t,t=a),t}function Yr(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),W.test(t)?Ar++:(t=a,0===kr&&Or(Ae)),t}(),r!==a?(Aa(),(n=Qr())!==a?(yr=t,t=Ht(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Qr()),t}function Qr(){var t,r,n;return t=Ar,(r=Xr())!==a?(Aa(),n=function(){var t;return t=e.charAt(Ar),V.test(t)?Ar++:(t=a,0===kr&&Or(ye)),t}(),n!==a?(yr=t,t=zt(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=Xr())!==a?(Aa(),124===e.charCodeAt(Ar)?(n=b,Ar++):(n=a,0===kr&&Or(Se)),n!==a?(Aa(),o=function(){var t,r,n,o;return t=Ar,(r=Jr())===a&&(r=null),Aa(),e.substr(Ar,2)===v?(n=v,Ar+=2):(n=a,0===kr&&Or(_e)),n!==a?(Aa(),(o=Jr())===a&&(o=null),yr=t,t=Vt(r,o)):(Ar=t,t=a),t===a&&(t=Ar,(r=Jr())!==a&&(yr=t,r=Yt(r)),t=r),t}(),o!==a?(Aa(),s=Ar,44===e.charCodeAt(Ar)?(c=p,Ar++):(c=a,0===kr&&Or(le)),c!==a?(Aa(),(i=Hr())!==a?(Aa(),s=i):(Ar=s,s=a)):(Ar=s,s=a),s===a&&(s=null),124===e.charCodeAt(Ar)?(c=b,Ar++):(c=a,0===kr&&Or(Se)),c!==a?(yr=t,t=Wt(r,o,s)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Xr())),t}function Jr(){var t,r;return t=Ar,r=function(){var t,r,n,o;if(t=Ar,r=Ar,n=[],(o=ha())!==a)for(;o!==a;)n.push(o),o=ha();else n=a;return(r=n!==a?e.substring(r,Ar):n)!==a&&(yr=t,r=vr(r)),t=r}(),r!==a&&(yr=t,r=Qt(r)),(t=r)===a&&(t=Ar,(r=oa())!==a&&(yr=t,r=Jt(r)),(t=r)===a&&(t=Ar,(r=ba())!==a&&(yr=t,r=Xt(r)),t=r)),t}function Xr(){var t,r,n,o;return t=function(){var t,r,n;return kr++,t=Ar,(r=ia())!==a?(105===e.charCodeAt(Ar)?(n=P,Ar++):(n=a,0===kr&&Or(ze)),n===a&&(n=null),yr=t,t=ar(r,n)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or(He)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(kr++,t=Ar,91===e.charCodeAt(Ar)?(r=F,Ar++):(r=a,0===kr&&Or(Ke)),r!==a){for(94===e.charCodeAt(Ar)?(n=O,Ar++):(n=a,0===kr&&Or(Ze)),n===a&&(n=null),o=[],(s=la())===a&&(s=fa());s!==a;)o.push(s),(s=la())===a&&(s=fa());93===e.charCodeAt(Ar)?(s=B,Ar++):(s=a,0===kr&&Or(et)),s!==a?(105===e.charCodeAt(Ar)?(c=P,Ar++):(c=a,0===kr&&Or(ze)),c===a&&(c=null),yr=t,t=sr(n,o,c)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(Xe)),t}(),t===a&&(t=function(){var t,r;return t=Ar,46===e.charCodeAt(Ar)?(r=S,Ar++):(r=a,0===kr&&Or(Te)),r!==a&&(yr=t,r=xr()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Ar,(r=oa())!==a?(46===e.charCodeAt(Ar)?(n=S,Ar++):(n=a,0===kr&&Or(Te)),n!==a&&(o=oa())!==a?(yr=t,t=Zt(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=Ar,(r=oa())!==a?(n=Ar,kr++,o=Ar,s=Aa(),c=Ar,(i=ia())!==a?c=i=[i,Aa()]:(Ar=c,c=a),c===a&&(c=null),61===e.charCodeAt(Ar)?(i=g,Ar++):(i=a,0===kr&&Or(he)),i!==a?o=s=[s,c,i]:(Ar=o,o=a),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=er(r)):(Ar=t,t=a)):(Ar=t,t=a)),t}(),t===a&&(t=function(){var t,r,n;return t=Ar,r=function(){var t;return t=e.charAt(Ar),Y.test(t)?Ar++:(t=a,0===kr&&Or(Ce)),t}(),r!==a?(Aa(),(n=ba())!==a?(yr=t,t=tr(r,n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=Ar,40===e.charCodeAt(Ar)?(r=A,Ar++):(r=a,0===kr&&Or(Ee)),r!==a?(Aa(),(n=Hr())!==a?(Aa(),41===e.charCodeAt(Ar)?(o=y,Ar++):(o=a,0===kr&&Or(ke)),o!==a?(yr=t,t=Kt(n)):(Ar=t,t=a)):(Ar=t,t=a)):(Ar=t,t=a)))))),t}function Kr(){var t;return e.length>Ar?(t=e.charAt(Ar),Ar++):(t=a,0===kr&&Or(ie)),t}function Zr(){var t;return kr++,t=e.charAt(Ar),Q.test(t)?Ar++:(t=a,0===kr&&Or(Pe)),kr--,t===a&&0===kr&&Or(we),t}function ea(){var t;return t=e.charAt(Ar),J.test(t)?Ar++:(t=a,0===kr&&Or(Re)),t}function ta(){var t;return kr++,10===e.charCodeAt(Ar)?(t=_,Ar++):(t=a,0===kr&&Or(Fe)),t===a&&(e.substr(Ar,2)===E?(t=E,Ar+=2):(t=a,0===kr&&Or(Oe)),t===a&&(t=e.charAt(Ar),X.test(t)?Ar++:(t=a,0===kr&&Or(Be)))),kr--,t===a&&0===kr&&Or(Le),t}function ra(){var t;return kr++,(t=function(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}())===a&&(t=na()),kr--,t===a&&0===kr&&Or(Me),t}function aa(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===k?(r=k,Ar+=2):(r=a,0===kr&&Or(De)),r!==a){for(n=[],o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,e.substr(Ar,2)===T?(c=T,Ar+=2):(c=a,0===kr&&Or(Ie)),c===a&&(c=ea()),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);e.substr(Ar,2)===T?(o=T,Ar+=2):(o=a,0===kr&&Or(Ie)),o!==a?t=r=[r,n,o]:(Ar=t,t=a)}else Ar=t,t=a;return t}function na(){var t,r,n,o,s,c;if(t=Ar,e.substr(Ar,2)===C?(r=C,Ar+=2):(r=a,0===kr&&Or(je)),r!==a){for(n=[],o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=ea(),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);t=r=[r,n]}else Ar=t,t=a;return t}function oa(){var e,t,r,n;if(kr++,e=Ar,(t=sa())!==a){for(r=[],n=ca();n!==a;)r.push(n),n=ca();yr=e,e=rr(t,r)}else Ar=e,e=a;return kr--,e===a&&(t=a,0===kr&&Or(Ne)),e}function sa(){var t,r,n;return t=e.charAt(Ar),K.test(t)?Ar++:(t=a,0===kr&&Or(Ue)),t===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=$a())!==a?t=n:(Ar=t,t=a)),t}function ca(){var t;return(t=sa())===a&&(t=e.charAt(Ar),Z.test(t)?Ar++:(t=a,0===kr&&Or(Ge))),t}function ia(){var t,r,n,o;if(kr++,t=Ar,34===e.charCodeAt(Ar)?(r=R,Ar++):(r=a,0===kr&&Or(Ve)),r!==a){for(n=[],o=pa();o!==a;)n.push(o),o=pa();34===e.charCodeAt(Ar)?(o=R,Ar++):(o=a,0===kr&&Or(Ve)),o!==a?(yr=t,t=nr(n)):(Ar=t,t=a)}else Ar=t,t=a;if(t===a)if(t=Ar,39===e.charCodeAt(Ar)?(r=L,Ar++):(r=a,0===kr&&Or(Ye)),r!==a){for(n=[],o=ua();o!==a;)n.push(o),o=ua();39===e.charCodeAt(Ar)?(o=L,Ar++):(o=a,0===kr&&Or(Ye)),o!==a?(yr=t,t=or(n)):(Ar=t,t=a)}else Ar=t,t=a;return kr--,t===a&&(r=a,0===kr&&Or(We)),t}function pa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),ee.test(o)?Ar++:(o=a,0===kr&&Or(Qe)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function ua(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),te.test(o)?Ar++:(o=a,0===kr&&Or(Je)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function la(){var t,r,n,o;return t=Ar,(r=fa())!==a?(45===e.charCodeAt(Ar)?(n=M,Ar++):(n=a,0===kr&&Or(tt)),n!==a&&(o=fa())!==a?(yr=t,t=cr(r,o)):(Ar=t,t=a)):(Ar=t,t=a),t}function fa(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=e.charAt(Ar),re.test(o)?Ar++:(o=a,0===kr&&Or(rt)),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),(t=r!==a?e.substring(t,Ar):r)===a&&(t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&(n=ma())!==a?t=n:(Ar=t,t=a),t===a&&(t=da())),t}function da(){var t,r;return t=Ar,92===e.charCodeAt(Ar)?(r=w,Ar++):(r=a,0===kr&&Or(qe)),r!==a&&ta()!==a?(yr=t,t=ir()):(Ar=t,t=a),t}function ma(){var t,r,n,o;return t=function(){var t;return(t=ga())===a&&(t=function(){var t,r,n,o;return t=Ar,r=Ar,n=Ar,kr++,o=function(){var t;return(t=ga())===a&&(t=e.charAt(Ar),ne.test(t)?Ar++:(t=a,0===kr&&Or(lt))),t}(),o===a&&(o=ea()),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a&&(o=Kr())!==a?r=n=[n,o]:(Ar=r,r=a),t=r!==a?e.substring(t,Ar):r}()),t}(),t===a&&(t=Ar,48===e.charCodeAt(Ar)?(r=D,Ar++):(r=a,0===kr&&Or(at)),r!==a?(n=Ar,kr++,o=ha(),kr--,o===a?n=void 0:(Ar=n,n=a),n!==a?(yr=t,t=pr()):(Ar=t,t=a)):(Ar=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Ar,120===e.charCodeAt(Ar)?(r=H,Ar++):(r=a,0===kr&&Or(ft)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a?o=s=[s,c]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=$r(n)):(Ar=t,t=a)):(Ar=t,t=a),t}(),t===a&&(t=$a()))),t}function ga(){var t,r;return t=e.charAt(Ar),ae.test(t)?Ar++:(t=a,0===kr&&Or(nt)),t===a&&(t=Ar,98===e.charCodeAt(Ar)?(r=I,Ar++):(r=a,0===kr&&Or(ot)),r!==a&&(yr=t,r=ur()),(t=r)===a&&(t=Ar,102===e.charCodeAt(Ar)?(r=j,Ar++):(r=a,0===kr&&Or(st)),r!==a&&(yr=t,r=lr()),(t=r)===a&&(t=Ar,110===e.charCodeAt(Ar)?(r=N,Ar++):(r=a,0===kr&&Or(ct)),r!==a&&(yr=t,r=fr()),(t=r)===a&&(t=Ar,114===e.charCodeAt(Ar)?(r=U,Ar++):(r=a,0===kr&&Or(it)),r!==a&&(yr=t,r=dr()),(t=r)===a&&(t=Ar,116===e.charCodeAt(Ar)?(r=q,Ar++):(r=a,0===kr&&Or(pt)),r!==a&&(yr=t,r=mr()),(t=r)===a&&(t=Ar,118===e.charCodeAt(Ar)?(r=G,Ar++):(r=a,0===kr&&Or(ut)),r!==a&&(yr=t,r=gr()),t=r)))))),t}function $a(){var t,r,n,o,s,c,i,p;return t=Ar,117===e.charCodeAt(Ar)?(r=z,Ar++):(r=a,0===kr&&Or(dt)),r!==a?(n=Ar,o=Ar,(s=xa())!==a&&(c=xa())!==a&&(i=xa())!==a&&(p=xa())!==a?o=s=[s,c,i,p]:(Ar=o,o=a),(n=o!==a?e.substring(n,Ar):o)!==a?(yr=t,t=hr(n)):(Ar=t,t=a)):(Ar=t,t=a),t}function ha(){var t;return t=e.charAt(Ar),oe.test(t)?Ar++:(t=a,0===kr&&Or(mt)),t}function xa(){var t;return t=e.charAt(Ar),se.test(t)?Ar++:(t=a,0===kr&&Or(gt)),t}function ba(){var t,r,n,o;return kr++,t=Ar,123===e.charCodeAt(Ar)?(r=f,Ar++):(r=a,0===kr&&Or(me)),r!==a?(n=function(){var e,t;return e=Ar,t=va(),yr=e,e=t=br(t)}(),125===e.charCodeAt(Ar)?(o=d,Ar++):(o=a,0===kr&&Or(ge)),o!==a?t=n:(Ar=t,t=a)):(Ar=t,t=a),kr--,t===a&&(r=a,0===kr&&Or($t)),t}function va(){var t,r,n,o,s,c;if(t=Ar,r=[],n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;for(n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a));n!==a;){if(r.push(n),n=[],o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Ar,s=Ar,kr++,c=e.charAt(Ar),ce.test(c)?Ar++:(c=a,0===kr&&Or(ht)),kr--,c===a?s=void 0:(Ar=s,s=a),s!==a&&(c=Kr())!==a?o=s=[s,c]:(Ar=o,o=a);else n=a;n===a&&(n=Ar,123===e.charCodeAt(Ar)?(o=f,Ar++):(o=a,0===kr&&Or(me)),o!==a?(s=va(),125===e.charCodeAt(Ar)?(c=d,Ar++):(c=a,0===kr&&Or(ge)),c!==a?n=o=[o,s,c]:(Ar=n,n=a)):(Ar=n,n=a))}return e.substring(t,Ar)}function Aa(){var e,t;for(e=[],(t=Zr())===a&&(t=ta())===a&&(t=ra());t!==a;)e.push(t),(t=Zr())===a&&(t=ta())===a&&(t=ra());return e}function ya(){var t,r,n,o;if(t=[],r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Ar,n=Aa(),59===e.charCodeAt(Ar)?(o=i,Ar++):(o=a,0===kr&&Or(ue)),o!==a?r=n=[n,o]:(Ar=r,r=a);else t=a;return t===a&&(t=Ar,r=function(){var e,t;for(e=[],(t=Zr())===a&&(t=aa());t!==a;)e.push(t),(t=Zr())===a&&(t=aa());return e}(),(n=na())===a&&(n=null),(o=ta())!==a?t=r=[r,n,o]:(Ar=t,t=a),t===a&&(t=Ar,r=Aa(),n=function(){var t,r;return t=Ar,kr++,e.length>Ar?(r=e.charAt(Ar),Ar++):(r=a,0===kr&&Or(ie)),kr--,r===a?t=void 0:(Ar=t,t=a),t}(),n!==a?t=r=[r,n]:(Ar=t,t=a))),t}var Sa=t.reservedWords||[];if(r=s(),t.peg$library)return{peg$result:r,peg$currPos:Ar,peg$FAILED:a,peg$maxFailExpected:Er,peg$maxFailPos:_r};if(r!==a&&Ar===e.length)return r;throw r!==a&&Ar0){for(t=1,r=1;t0||e.imports.length>0)throw new Error("Dependencies not supported in format 'bare'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function() {",' "use strict";',"",r,"",u("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(p),o=a();o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape$1(p[e])+'");')})),o.push(""));for(var s=e.imports.length,c=0;c0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape$1(p[e])+'";')})),o.push(""));for(var s=0;s0)throw new Error("Imports are not supported in format 'amd'.");var t=Object.keys(p),o="["+t.map((function(e){return p[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",s=t.join(", ");return __spreadArray$4(__spreadArray$4([],a(),!0),["define("+o+", function("+s+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"],!1)},globals:function(){if(Object.keys(p).length>0||e.imports.length>0)throw new Error("Dependencies not supported in format 'globals'.");if(!t.exportVar)throw new Error("No export variable defined for format 'globals'.");return __spreadArray$4(__spreadArray$4([],a(),!0),["(function(root) {",' "use strict";',"",r,"",u("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){if(e.imports.length>0)throw new Error("Imports are not supported in format 'umd'.");var o=Object.keys(p),s=o.map((function(e){return p[e]})),c="["+s.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",i=s.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),l=o.join(", "),f=a();return f.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+c+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),t.exportVar&&f.push(" } else {"," root."+t.exportVar+" = factory();"),f.push(" }","})(this, function("+l+") {",' "use strict";',"",r,"",u("return "+n()+";"),"});"),f}},s=o[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var p=[],x=e.topLevelInitializer;if(x)if(Array.isArray(x)){if("es"===t.format){for(var b=[],v=[],A=0,y=x;A targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&p.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var w="{ "+i.map((function(e){return e+": "+$(e)})).join(", ")+" }",P=$(i[0]);if(p.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+w+";"," var peg$startRuleFunction = "+P+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+f(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+d(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(m(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = options.peg$currPos | 0;"," var peg$savedPos = peg$currPos;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = peg$currPos;"," var peg$maxFailExpected = options.peg$maxFailExpected || [];"," var peg$silentFails = options.peg$silentFails | 0;",""),t.cache&&p.push(" var peg$resultsCache = {};",""),t.trace&&p.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),p.push(" var peg$result;",""," if (options.startRule) {"," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.imports.length>0&&p.push(" var peg$assign = Object.assign || function(t) {"," var i, s;"," for (i = 1; i < arguments.length; i++) {"," s = arguments[i];"," for (var p in s) {"," if (Object.prototype.hasOwnProperty.call(s, p)) {"," t[p] = s[p];"," }"," }"," }"," return t;"," };",""," function peg$callLibrary(lib, startRule) {"," const opts = peg$assign({}, options, {"," startRule: startRule,"," peg$currPos: peg$currPos,"," peg$silentFails: peg$silentFails,"," peg$library: true,"," peg$maxFailExpected: peg$maxFailExpected"," });"," const res = lib.parse(input, opts);"," peg$currPos = res.peg$currPos;"," peg$maxFailPos = res.peg$maxFailPos;"," peg$maxFailExpected = res.peg$maxFailExpected;"," return (res.peg$result === res.peg$FAILED) ? peg$FAILED : res.peg$result;"," }",""),e.rules.forEach((function(n){p.push.apply(p,u(function(n){var o=[],s=n.bytecode,i=new Stack$1(n.name,"s","var",s),p=function t(n){var o=0,s=n.length,p=[],h=void 0;function x(e,r,a){var s=r+3,c=n[o+s-2],l=n[o+s-1],f=i.checkedIf(o,(function(){return o+=s+c,(a||t)(n.slice(o-c,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),d=f[0],m=f[1];p.push("if ("+e+") {"),p.push.apply(p,u(d)),l>0&&(p.push("} else {"),p.push.apply(p,u(m))),p.push("}")}function b(e,r,a){var s=r+3,c=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",u=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(p.push(i.push(c)),c=i.pop(),u=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),x(e(c,null!==u),r,u)}for(var v=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:p.push(i.push("''")),o++;break;case op$1.PUSH_CURR_POS:p.push(i.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:p.push(i.push("undefined")),o++;break;case op$1.PUSH_NULL:p.push(i.push("null")),o++;break;case op$1.PUSH_FAILED:p.push(i.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:p.push(i.push("[]")),o++;break;case op$1.POP:i.pop(),o++;break;case op$1.POP_CURR_POS:p.push("peg$currPos = "+i.pop()+";"),o++;break;case op$1.POP_N:i.pop(n[o+1]),o+=2;break;case op$1.NIP:h=i.pop(),i.pop(),p.push(i.push(h)),o++;break;case op$1.APPEND:h=i.pop(),p.push(i.top()+".push("+h+");"),o++;break;case op$1.WRAP:p.push(i.push("["+i.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:p.push(i.push("input.substring("+i.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],v=3+s;h=n.slice(o+3,o+v),h=1===s?i.index(h[0]):"[ ".concat(h.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(n[o+1]),p.push(i.push(h)),o+=v;break;case op$1.IF:x(i.top(),0);break;case op$1.IF_ERROR:x(i.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:x(i.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:x(i.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:x(i.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:x(i.top()+".length < ("+i.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:x(i.top()+".length >= ("+i.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:T=i.top()+" !== peg$FAILED",C=n[o+2-1],w=i.checkedLoop(o,(function(){return o+=2+C,t(n.slice(o-C,o))})),p.push("while ("+T+") {"),p.push.apply(p,u(w)),p.push("}");break;case op$1.MATCH_ANY:x("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var A=n[o+1],y=r[A];b((function(e,t){return y.length>1?"".concat(e," === ").concat(l(A)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(y.charCodeAt(0)))}),1,y.length);break;case op$1.MATCH_STRING_IC:var S=n[o+1];b((function(e){return"".concat(e,".toLowerCase() === ").concat(l(S))}),1,r[S].length);break;case op$1.MATCH_CHAR_CLASS:var _=n[o+1];b((function(e){return"".concat(f(_),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:p.push(i.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),p.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:p.push(i.push(l(n[o+1]))),p.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:p.push(i.push("peg$FAILED")),p.push("if (peg$silentFails === 0) { peg$fail("+d(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:p.push("peg$savedPos = "+i.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:p.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:h=function(){var e=n[o+4-1];return m(n[o+1])+"("+n.slice(o+4,o+4+e).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(n[o+2]),p.push(i.push(h)),o+=4+n[o+3];break;case op$1.RULE:p.push(i.push($(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.LIBRARY_RULE:var E=n[o+2],k=-1===E?"":', "'+c[E]+'"';p.push(i.push("peg$callLibrary("+g(n[o+1])+k+")")),o+=3;break;case op$1.SILENT_FAILS_ON:p.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:p.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:i.sourceMapPush(p,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:i.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:i.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete i.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var T,C,w};oc?-1:1:0}));for(var t="",r="",a=0;a=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1;function reportDuplicateImports$1(e,t,r){for(var a={},n=0,o=e.imports;n0||(a.push(e.name),o(e.expression),a.pop())},sequence:function(t){r.errors>0||t.elements.every((function(t){return o(t),!(r.errors>0||asts$3.alwaysConsumesOnSuccess(e,t))}))},repeated:function(t){r.errors>0||(o(t.expression),t.delimiter&&!asts$3.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter))},rule_ref:function(t){if(!(r.errors>0)){n.push(t);var s=asts$3.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$2=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$2.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$2.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$2.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts$1=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts$1.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{prepare:[addImportedRules,reportInfiniteRecursion],check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRepetition,reportIncorrectPlucking,reportDuplicateImports],transform:[fixLibraryNumbers,removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){options=void 0!==options?options:{};var defaultStartRules=[ast.rules[0].name];if(options=processOptions(options,{allowedStartRules:defaultStartRules,cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),null!==options.allowedStartRules&&void 0!==options.allowedStartRules||(options.allowedStartRules=defaultStartRules),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");0===options.allowedStartRules.length&&(options.allowedStartRules=defaultStartRules);var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,asts=asts_1,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};n.forEach((function(e){e.use(o,t)})),Array.isArray(e)||(e=[{source:t.grammarSource,text:e}]);var s=asts.combine(e.map((function(e){var t=e.source,r=e.text;return o.parser.parse(r,{grammarSource:t,reservedWords:o.reservedWords})})));return peg$4.compiler.compile(s,o.passes,t)}},peg_1=peg$4,utils={},chai$o=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t=18"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,browserslist:browserslist,packageManager:packageManager,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&er||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,p=0,u="";const l=this._mappings.toArray();for(let f=0,d=l.length;f0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-p),p=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),u+=e}return u}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,p=s(n,o[i],!0);return 0===p?i:p>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,p,u){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,p&&(l.name=u)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),p=util$1.getArg(a,"mappings"),u=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=p,r._sourceMapURL=t,r.file=u,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t=0?this._sections[t]:null,a=t>=0&&t+1=0?this._sections[t]:null,a=t>=0&&t+1{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r0){for(t=[],r=0;r start)"])}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate('\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = "nothing"\n ')}catch(t){expect$k(t).with.property("stage","check"),expect$k(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$k(e).to.be.an("array").lengthOf.gte(2),expect$k(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$k(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined'])}}))}))}));var chai$j=require$$0,parser$2=parser$4,compiler=compiler_1,expect$j=chai$j.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:null})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:void 0})).to.be.an("object"),expect$j(compiler.compile(e,compiler.passes,{allowedStartRules:[]})).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:{}})})).to.throw("allowedStartRules must be an array"),expect$j((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$j(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$j(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$j(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$j(e).to.be.an("object"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$j((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var chai$i=require$$0,Intern=intern,expect$i=chai$i.expect;describe("utility class Intern",(function(){it("handles strings",(function(){var e=new Intern;expect$i(e.add("one")).to.equal(0),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add("one")).to.equal(0),expect$i(e.add("two")).to.equal(1),expect$i(e.add(void 0)).to.equal(-1),expect$i(e.add(null)).to.equal(-1),expect$i(e.items.length).to.equal(2),expect$i(e.items).to.deep.equal(["one","two"]),expect$i(e.get(0)).to.equal("one"),expect$i(e.get(1)).to.equal("two"),expect$i(e.get(-1)).to.equal(void 0),expect$i(e.get(10)).to.equal(void 0);var t=e.map((function(e,t){return[e,t]}));expect$i(t).to.deep.equal([["one",0],["two",1]])})),it("does conversions",(function(){var e=new Intern({convert:function(e){return Array.from(e).map((function(e){return e.codePointAt(0)}))}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abc")).to.equal(0),expect$i(e.add("abd")).to.equal(1),expect$i(e.get(0)).to.deep.equal([97,98,99]),expect$i(e.get(1)).to.deep.equal([97,98,100])})),it("stringifies",(function(){var e=new Intern({stringify:function(){return"same"}});expect$i(e.add("abc")).to.equal(0),expect$i(e.add("def")).to.equal(0)}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")})),it("does not inifinite loop",(function(){expect$6(pass$2).to.reportError('\n start = expr*\n\n expr\n = expr "++"\n ',{message:"Possible infinite loop when parsing (left recursion: start -> expr -> expr)"})}))}))}));var chai$5=require$$0,helpers$1=helpers$d,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$d,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā࿿")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က￿")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n= 8'} - '@peggyjs/eslint-config@4.0.3': - resolution: {integrity: sha512-6cjxn4+9c2o5CzWB/rAvGSB8nFxWDQeyqIcjDGoAq6G+c2cC60+tvtoUVwXJvlt8IATl23gAR+x8ZjtCZ9jZJQ==} + '@peggyjs/eslint-config@4.0.4': + resolution: {integrity: sha512-RSPKxha440+85R6MXgV8aPK0jtl1N7J6XM3kPcP3lICnUrhp6L5c3+rTM7oi/5vvFpp91h8KtlEeLA3UZGcyzg==} engines: {node: '>=18'} '@peggyjs/from-mem@1.3.4': @@ -474,8 +474,8 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@playwright/test@1.45.3': - resolution: {integrity: sha512-UKF4XsBfy+u3MFWEH44hva1Q8Da28G6RFtR2+5saw+jgAFQV5yYnB1fu68Mz7fO+5GJF3wgwAIs0UelU8TxFrA==} + '@playwright/test@1.46.0': + resolution: {integrity: sha512-/QYft5VArOrGRP5pgkrfKksqsKA6CEFyGQ/gjNe6q0y4tZ1aaPfq4gIjudr1s3D+pXyrPRdsy4opKDrjBabE5w==} engines: {node: '>=18'} hasBin: true @@ -546,83 +546,83 @@ packages: rollup: optional: true - '@rollup/rollup-android-arm-eabi@4.19.1': - resolution: {integrity: sha512-XzqSg714++M+FXhHfXpS1tDnNZNpgxxuGZWlRG/jSj+VEPmZ0yg6jV4E0AL3uyBKxO8mO3xtOsP5mQ+XLfrlww==} + '@rollup/rollup-android-arm-eabi@4.20.0': + resolution: {integrity: sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.19.1': - resolution: {integrity: sha512-thFUbkHteM20BGShD6P08aungq4irbIZKUNbG70LN8RkO7YztcGPiKTTGZS7Kw+x5h8hOXs0i4OaHwFxlpQN6A==} + '@rollup/rollup-android-arm64@4.20.0': + resolution: {integrity: sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.19.1': - resolution: {integrity: sha512-8o6eqeFZzVLia2hKPUZk4jdE3zW7LCcZr+MD18tXkgBBid3lssGVAYuox8x6YHoEPDdDa9ixTaStcmx88lio5Q==} + '@rollup/rollup-darwin-arm64@4.20.0': + resolution: {integrity: sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.19.1': - resolution: {integrity: sha512-4T42heKsnbjkn7ovYiAdDVRRWZLU9Kmhdt6HafZxFcUdpjlBlxj4wDrt1yFWLk7G4+E+8p2C9tcmSu0KA6auGA==} + '@rollup/rollup-darwin-x64@4.20.0': + resolution: {integrity: sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ==} cpu: [x64] os: [darwin] - '@rollup/rollup-linux-arm-gnueabihf@4.19.1': - resolution: {integrity: sha512-MXg1xp+e5GhZ3Vit1gGEyoC+dyQUBy2JgVQ+3hUrD9wZMkUw/ywgkpK7oZgnB6kPpGrxJ41clkPPnsknuD6M2Q==} + '@rollup/rollup-linux-arm-gnueabihf@4.20.0': + resolution: {integrity: sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.19.1': - resolution: {integrity: sha512-DZNLwIY4ftPSRVkJEaxYkq7u2zel7aah57HESuNkUnz+3bZHxwkCUkrfS2IWC1sxK6F2QNIR0Qr/YXw7nkF3Pw==} + '@rollup/rollup-linux-arm-musleabihf@4.20.0': + resolution: {integrity: sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.19.1': - resolution: {integrity: sha512-C7evongnjyxdngSDRRSQv5GvyfISizgtk9RM+z2biV5kY6S/NF/wta7K+DanmktC5DkuaJQgoKGf7KUDmA7RUw==} + '@rollup/rollup-linux-arm64-gnu@4.20.0': + resolution: {integrity: sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.19.1': - resolution: {integrity: sha512-89tFWqxfxLLHkAthAcrTs9etAoBFRduNfWdl2xUs/yLV+7XDrJ5yuXMHptNqf1Zw0UCA3cAutkAiAokYCkaPtw==} + '@rollup/rollup-linux-arm64-musl@4.20.0': + resolution: {integrity: sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.19.1': - resolution: {integrity: sha512-PromGeV50sq+YfaisG8W3fd+Cl6mnOOiNv2qKKqKCpiiEke2KiKVyDqG/Mb9GWKbYMHj5a01fq/qlUR28PFhCQ==} + '@rollup/rollup-linux-powerpc64le-gnu@4.20.0': + resolution: {integrity: sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.19.1': - resolution: {integrity: sha512-/1BmHYh+iz0cNCP0oHCuF8CSiNj0JOGf0jRlSo3L/FAyZyG2rGBuKpkZVH9YF+x58r1jgWxvm1aRg3DHrLDt6A==} + '@rollup/rollup-linux-riscv64-gnu@4.20.0': + resolution: {integrity: sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.19.1': - resolution: {integrity: sha512-0cYP5rGkQWRZKy9/HtsWVStLXzCF3cCBTRI+qRL8Z+wkYlqN7zrSYm6FuY5Kd5ysS5aH0q5lVgb/WbG4jqXN1Q==} + '@rollup/rollup-linux-s390x-gnu@4.20.0': + resolution: {integrity: sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.19.1': - resolution: {integrity: sha512-XUXeI9eM8rMP8aGvii/aOOiMvTs7xlCosq9xCjcqI9+5hBxtjDpD+7Abm1ZhVIFE1J2h2VIg0t2DX/gjespC2Q==} + '@rollup/rollup-linux-x64-gnu@4.20.0': + resolution: {integrity: sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.19.1': - resolution: {integrity: sha512-V7cBw/cKXMfEVhpSvVZhC+iGifD6U1zJ4tbibjjN+Xi3blSXaj/rJynAkCFFQfoG6VZrAiP7uGVzL440Q6Me2Q==} + '@rollup/rollup-linux-x64-musl@4.20.0': + resolution: {integrity: sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.19.1': - resolution: {integrity: sha512-88brja2vldW/76jWATlBqHEoGjJLRnP0WOEKAUbMcXaAZnemNhlAHSyj4jIwMoP2T750LE9lblvD4e2jXleZsA==} + '@rollup/rollup-win32-arm64-msvc@4.20.0': + resolution: {integrity: sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.19.1': - resolution: {integrity: sha512-LdxxcqRVSXi6k6JUrTah1rHuaupoeuiv38du8Mt4r4IPer3kwlTo+RuvfE8KzZ/tL6BhaPlzJ3835i6CxrFIRQ==} + '@rollup/rollup-win32-ia32-msvc@4.20.0': + resolution: {integrity: sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.19.1': - resolution: {integrity: sha512-2bIrL28PcK3YCqD9anGxDxamxdiJAxA+l7fWIwM5o8UqNy1t3d1NdAweO2XhA0KTDJ5aH1FsuiT5+7VhtHliXg==} + '@rollup/rollup-win32-x64-msvc@4.20.0': + resolution: {integrity: sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg==} cpu: [x64] os: [win32] @@ -714,8 +714,8 @@ packages: '@types/minimatch@3.0.5': resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} - '@types/node@22.0.2': - resolution: {integrity: sha512-yPL6DyFwY5PiMVEwymNeqUTKsDczQBJ/5T7W/46RwLU/VH+AA8aT5TZkvBviLKLbbm0hlfftEkGrNzfRk/fofQ==} + '@types/node@22.1.0': + resolution: {integrity: sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -729,8 +729,8 @@ packages: '@types/yargs@17.0.32': resolution: {integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==} - '@typescript-eslint/eslint-plugin@8.0.0': - resolution: {integrity: sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==} + '@typescript-eslint/eslint-plugin@8.0.1': + resolution: {integrity: sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 @@ -740,8 +740,8 @@ packages: typescript: optional: true - '@typescript-eslint/parser@8.0.0': - resolution: {integrity: sha512-pS1hdZ+vnrpDIxuFXYQpLTILglTjSYJ9MbetZctrUawogUsPdz31DIIRZ9+rab0LhYNTsk88w4fIzVheiTbWOQ==} + '@typescript-eslint/parser@8.0.1': + resolution: {integrity: sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -754,8 +754,12 @@ packages: resolution: {integrity: sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.0.0': - resolution: {integrity: sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==} + '@typescript-eslint/scope-manager@8.0.1': + resolution: {integrity: sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/type-utils@8.0.1': + resolution: {integrity: sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -767,6 +771,10 @@ packages: resolution: {integrity: sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/types@8.0.1': + resolution: {integrity: sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/typescript-estree@8.0.0': resolution: {integrity: sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -776,16 +784,35 @@ packages: typescript: optional: true + '@typescript-eslint/typescript-estree@8.0.1': + resolution: {integrity: sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@typescript-eslint/utils@8.0.0': resolution: {integrity: sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 + '@typescript-eslint/utils@8.0.1': + resolution: {integrity: sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + '@typescript-eslint/visitor-keys@8.0.0': resolution: {integrity: sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/visitor-keys@8.0.1': + resolution: {integrity: sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + a-sync-waterfall@1.0.1: resolution: {integrity: sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==} @@ -2263,13 +2290,13 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} - playwright-core@1.45.3: - resolution: {integrity: sha512-+ym0jNbcjikaOwwSZycFbwkWgfruWvYlJfThKYAlImbxUgdWFO2oW70ojPm4OpE4t6TAo2FY/smM+hpVTtkhDA==} + playwright-core@1.46.0: + resolution: {integrity: sha512-9Y/d5UIwuJk8t3+lhmMSAJyNP1BUC/DqP3cQJDQQL/oWqAiuPTLgy7Q5dzglmTLwcBRdetzgNM/gni7ckfTr6A==} engines: {node: '>=18'} hasBin: true - playwright@1.45.3: - resolution: {integrity: sha512-QhVaS+lpluxCaioejDZ95l4Y4jSFCsBvl2UZkpeXlzxmqS+aABr5c82YmfMHrL6x27nvrvykJAFpkzT2eWdJww==} + playwright@1.46.0: + resolution: {integrity: sha512-XYJ5WvfefWONh1uPAUAi0H2xXV5S3vrtcnXe6uAOgdGi3aSpqOSXX08IAjXW34xitfuOJsvXU5anXZxPSEQiJw==} engines: {node: '>=18'} hasBin: true @@ -2438,8 +2465,8 @@ packages: rollup-plugin-ignore@1.0.10: resolution: {integrity: sha512-VsbnfwwaTv2Dxl2onubetX/3RnSnplNnjdix0hvF8y2YpqdzlZrjIq6zkcuVJ08XysS8zqW3gt3ORBndFDgsrg==} - rollup@4.19.1: - resolution: {integrity: sha512-K5vziVlg7hTpYfFBI+91zHBEMo6jafYXpkMlqZjg7/zhIG9iHqazBf4xz9AVdjS9BruRn280ROqLI7G3OFRIlw==} + rollup@4.20.0: + resolution: {integrity: sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -2658,8 +2685,8 @@ packages: peerDependencies: typescript: '>=4.2.0' - ts-jest@29.2.3: - resolution: {integrity: sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==} + ts-jest@29.2.4: + resolution: {integrity: sha512-3d6tgDyhCI29HlpwIq87sNuI+3Q6GLTTCeYRHCs7vDz+/3GCMwEtV9jezLyl4ZtnBgx00I7hm8PCP8cTksMGrw==} engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -2705,8 +2732,8 @@ packages: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} - typescript-eslint@8.0.0: - resolution: {integrity: sha512-yQWBJutWL1PmpmDddIOl9/Mi6vZjqNCjqSGBMQ4vsc2Aiodk0SnbQQWPXbSy0HNuKCuGkw1+u4aQ2mO40TdhDQ==} + typescript-eslint@8.0.1: + resolution: {integrity: sha512-V3Y+MdfhawxEjE16dWpb7/IOgeXnLwAEEkS7v8oDqNcR1oYlqWhGH/iHqHdKVdpWme1VPZ0SoywXAkCqawj2eQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -2727,8 +2754,8 @@ packages: engines: {node: '>=0.8.0'} hasBin: true - undici-types@6.11.1: - resolution: {integrity: sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==} + undici-types@6.13.0: + resolution: {integrity: sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==} unpipe@1.0.0: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} @@ -3198,7 +3225,7 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -3211,14 +3238,14 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@22.0.2) + jest-config: 29.7.0(@types/node@22.1.0) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -3243,7 +3270,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -3261,7 +3288,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 22.0.2 + '@types/node': 22.1.0 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -3283,7 +3310,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 22.0.2 + '@types/node': 22.1.0 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -3353,7 +3380,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 22.0.2 + '@types/node': 22.1.0 '@types/yargs': 17.0.32 chalk: 4.1.2 @@ -3393,7 +3420,7 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@peggyjs/eslint-config@4.0.3(eslint@9.8.0)(typescript@5.5.4)': + '@peggyjs/eslint-config@4.0.4(eslint@9.8.0)(typescript@5.5.4)': dependencies: '@stylistic/eslint-plugin': 2.6.0(eslint@9.8.0)(typescript@5.5.4) globals: 15.8.0 @@ -3409,112 +3436,112 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@playwright/test@1.45.3': + '@playwright/test@1.46.0': dependencies: - playwright: 1.45.3 + playwright: 1.46.0 - '@rollup/plugin-commonjs@26.0.1(rollup@4.19.1)': + '@rollup/plugin-commonjs@26.0.1(rollup@4.20.0)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.19.1) + '@rollup/pluginutils': 5.1.0(rollup@4.20.0) commondir: 1.0.1 estree-walker: 2.0.2 glob: 10.4.5 is-reference: 1.2.1 magic-string: 0.30.10 optionalDependencies: - rollup: 4.19.1 + rollup: 4.20.0 - '@rollup/plugin-json@6.1.0(rollup@4.19.1)': + '@rollup/plugin-json@6.1.0(rollup@4.20.0)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.19.1) + '@rollup/pluginutils': 5.1.0(rollup@4.20.0) optionalDependencies: - rollup: 4.19.1 + rollup: 4.20.0 - '@rollup/plugin-multi-entry@6.0.1(rollup@4.19.1)': + '@rollup/plugin-multi-entry@6.0.1(rollup@4.20.0)': dependencies: - '@rollup/plugin-virtual': 3.0.2(rollup@4.19.1) + '@rollup/plugin-virtual': 3.0.2(rollup@4.20.0) matched: 5.0.1 optionalDependencies: - rollup: 4.19.1 + rollup: 4.20.0 - '@rollup/plugin-node-resolve@15.2.3(rollup@4.19.1)': + '@rollup/plugin-node-resolve@15.2.3(rollup@4.20.0)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.19.1) + '@rollup/pluginutils': 5.1.0(rollup@4.20.0) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.8 optionalDependencies: - rollup: 4.19.1 + rollup: 4.20.0 - '@rollup/plugin-typescript@11.1.6(rollup@4.19.1)(tslib@2.6.3)(typescript@5.5.4)': + '@rollup/plugin-typescript@11.1.6(rollup@4.20.0)(tslib@2.6.3)(typescript@5.5.4)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.19.1) + '@rollup/pluginutils': 5.1.0(rollup@4.20.0) resolve: 1.22.8 typescript: 5.5.4 optionalDependencies: - rollup: 4.19.1 + rollup: 4.20.0 tslib: 2.6.3 - '@rollup/plugin-virtual@3.0.2(rollup@4.19.1)': + '@rollup/plugin-virtual@3.0.2(rollup@4.20.0)': optionalDependencies: - rollup: 4.19.1 + rollup: 4.20.0 - '@rollup/pluginutils@5.1.0(rollup@4.19.1)': + '@rollup/pluginutils@5.1.0(rollup@4.20.0)': dependencies: '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 optionalDependencies: - rollup: 4.19.1 + rollup: 4.20.0 - '@rollup/rollup-android-arm-eabi@4.19.1': + '@rollup/rollup-android-arm-eabi@4.20.0': optional: true - '@rollup/rollup-android-arm64@4.19.1': + '@rollup/rollup-android-arm64@4.20.0': optional: true - '@rollup/rollup-darwin-arm64@4.19.1': + '@rollup/rollup-darwin-arm64@4.20.0': optional: true - '@rollup/rollup-darwin-x64@4.19.1': + '@rollup/rollup-darwin-x64@4.20.0': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.19.1': + '@rollup/rollup-linux-arm-gnueabihf@4.20.0': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.19.1': + '@rollup/rollup-linux-arm-musleabihf@4.20.0': optional: true - '@rollup/rollup-linux-arm64-gnu@4.19.1': + '@rollup/rollup-linux-arm64-gnu@4.20.0': optional: true - '@rollup/rollup-linux-arm64-musl@4.19.1': + '@rollup/rollup-linux-arm64-musl@4.20.0': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.19.1': + '@rollup/rollup-linux-powerpc64le-gnu@4.20.0': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.19.1': + '@rollup/rollup-linux-riscv64-gnu@4.20.0': optional: true - '@rollup/rollup-linux-s390x-gnu@4.19.1': + '@rollup/rollup-linux-s390x-gnu@4.20.0': optional: true - '@rollup/rollup-linux-x64-gnu@4.19.1': + '@rollup/rollup-linux-x64-gnu@4.20.0': optional: true - '@rollup/rollup-linux-x64-musl@4.19.1': + '@rollup/rollup-linux-x64-musl@4.20.0': optional: true - '@rollup/rollup-win32-arm64-msvc@4.19.1': + '@rollup/rollup-win32-arm64-msvc@4.20.0': optional: true - '@rollup/rollup-win32-ia32-msvc@4.19.1': + '@rollup/rollup-win32-ia32-msvc@4.20.0': optional: true - '@rollup/rollup-win32-x64-msvc@4.19.1': + '@rollup/rollup-win32-x64-msvc@4.20.0': optional: true '@sinclair/typebox@0.27.8': {} @@ -3616,7 +3643,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 22.0.2 + '@types/node': 22.1.0 '@types/istanbul-lib-coverage@2.0.6': {} @@ -3637,9 +3664,9 @@ snapshots: '@types/minimatch@3.0.5': {} - '@types/node@22.0.2': + '@types/node@22.1.0': dependencies: - undici-types: 6.11.1 + undici-types: 6.13.0 '@types/resolve@1.20.2': {} @@ -3651,14 +3678,14 @@ snapshots: dependencies: '@types/yargs-parser': 21.0.3 - '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0)(typescript@5.5.4) - '@typescript-eslint/scope-manager': 8.0.0 - '@typescript-eslint/type-utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.0.0 + '@typescript-eslint/parser': 8.0.1(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.0.1 + '@typescript-eslint/type-utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.1 eslint: 9.8.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -3669,12 +3696,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.0.0(eslint@9.8.0)(typescript@5.5.4)': + '@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.5.4)': dependencies: - '@typescript-eslint/scope-manager': 8.0.0 - '@typescript-eslint/types': 8.0.0 - '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.0.0 + '@typescript-eslint/scope-manager': 8.0.1 + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.1 debug: 4.3.5 eslint: 9.8.0 optionalDependencies: @@ -3687,10 +3714,15 @@ snapshots: '@typescript-eslint/types': 8.0.0 '@typescript-eslint/visitor-keys': 8.0.0 - '@typescript-eslint/type-utils@8.0.0(eslint@9.8.0)(typescript@5.5.4)': + '@typescript-eslint/scope-manager@8.0.1': dependencies: - '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/visitor-keys': 8.0.1 + + '@typescript-eslint/type-utils@8.0.1(eslint@9.8.0)(typescript@5.5.4)': + dependencies: + '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4) debug: 4.3.5 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -3701,6 +3733,8 @@ snapshots: '@typescript-eslint/types@8.0.0': {} + '@typescript-eslint/types@8.0.1': {} + '@typescript-eslint/typescript-estree@8.0.0(typescript@5.5.4)': dependencies: '@typescript-eslint/types': 8.0.0 @@ -3709,7 +3743,22 @@ snapshots: globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.5 - semver: 7.6.2 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.5.4) + optionalDependencies: + typescript: 5.5.4 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/typescript-estree@8.0.1(typescript@5.5.4)': + dependencies: + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/visitor-keys': 8.0.1 + debug: 4.3.5 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: typescript: 5.5.4 @@ -3727,11 +3776,27 @@ snapshots: - supports-color - typescript + '@typescript-eslint/utils@8.0.1(eslint@9.8.0)(typescript@5.5.4)': + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0) + '@typescript-eslint/scope-manager': 8.0.1 + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) + eslint: 9.8.0 + transitivePeerDependencies: + - supports-color + - typescript + '@typescript-eslint/visitor-keys@8.0.0': dependencies: '@typescript-eslint/types': 8.0.0 eslint-visitor-keys: 3.4.3 + '@typescript-eslint/visitor-keys@8.0.1': + dependencies: + '@typescript-eslint/types': 8.0.1 + eslint-visitor-keys: 3.4.3 + a-sync-waterfall@1.0.1: {} accepts@1.3.8: @@ -4077,13 +4142,13 @@ snapshots: core-util-is@1.0.3: {} - create-jest@29.7.0(@types/node@22.0.2): + create-jest@29.7.0(@types/node@22.1.0): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@22.0.2) + jest-config: 29.7.0(@types/node@22.1.0) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -4753,7 +4818,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.3 @@ -4773,16 +4838,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@22.0.2): + jest-cli@29.7.0(@types/node@22.1.0): dependencies: '@jest/core': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@22.0.2) + create-jest: 29.7.0(@types/node@22.1.0) exit: 0.1.2 import-local: 3.1.0 - jest-config: 29.7.0(@types/node@22.0.2) + jest-config: 29.7.0(@types/node@22.1.0) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -4792,7 +4857,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@22.0.2): + jest-config@29.7.0(@types/node@22.1.0): dependencies: '@babel/core': 7.24.9 '@jest/test-sequencer': 29.7.0 @@ -4817,7 +4882,7 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 22.0.2 + '@types/node': 22.1.0 transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -4846,7 +4911,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -4856,7 +4921,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 22.0.2 + '@types/node': 22.1.0 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -4895,7 +4960,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -4930,7 +4995,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -4958,7 +5023,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 chalk: 4.1.2 cjs-module-lexer: 1.3.1 collect-v8-coverage: 1.0.2 @@ -5004,7 +5069,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -5023,7 +5088,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 22.0.2 + '@types/node': 22.1.0 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -5032,17 +5097,17 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 22.0.2 + '@types/node': 22.1.0 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@22.0.2): + jest@29.7.0(@types/node@22.1.0): dependencies: '@jest/core': 29.7.0 '@jest/types': 29.6.3 import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@22.0.2) + jest-cli: 29.7.0(@types/node@22.1.0) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -5382,11 +5447,11 @@ snapshots: dependencies: find-up: 4.1.0 - playwright-core@1.45.3: {} + playwright-core@1.46.0: {} - playwright@1.45.3: + playwright@1.46.0: dependencies: - playwright-core: 1.45.3 + playwright-core: 1.46.0 optionalDependencies: fsevents: 2.3.2 @@ -5598,26 +5663,26 @@ snapshots: rollup-plugin-ignore@1.0.10: {} - rollup@4.19.1: + rollup@4.20.0: dependencies: '@types/estree': 1.0.5 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.19.1 - '@rollup/rollup-android-arm64': 4.19.1 - '@rollup/rollup-darwin-arm64': 4.19.1 - '@rollup/rollup-darwin-x64': 4.19.1 - '@rollup/rollup-linux-arm-gnueabihf': 4.19.1 - '@rollup/rollup-linux-arm-musleabihf': 4.19.1 - '@rollup/rollup-linux-arm64-gnu': 4.19.1 - '@rollup/rollup-linux-arm64-musl': 4.19.1 - '@rollup/rollup-linux-powerpc64le-gnu': 4.19.1 - '@rollup/rollup-linux-riscv64-gnu': 4.19.1 - '@rollup/rollup-linux-s390x-gnu': 4.19.1 - '@rollup/rollup-linux-x64-gnu': 4.19.1 - '@rollup/rollup-linux-x64-musl': 4.19.1 - '@rollup/rollup-win32-arm64-msvc': 4.19.1 - '@rollup/rollup-win32-ia32-msvc': 4.19.1 - '@rollup/rollup-win32-x64-msvc': 4.19.1 + '@rollup/rollup-android-arm-eabi': 4.20.0 + '@rollup/rollup-android-arm64': 4.20.0 + '@rollup/rollup-darwin-arm64': 4.20.0 + '@rollup/rollup-darwin-x64': 4.20.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.20.0 + '@rollup/rollup-linux-arm-musleabihf': 4.20.0 + '@rollup/rollup-linux-arm64-gnu': 4.20.0 + '@rollup/rollup-linux-arm64-musl': 4.20.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.20.0 + '@rollup/rollup-linux-riscv64-gnu': 4.20.0 + '@rollup/rollup-linux-s390x-gnu': 4.20.0 + '@rollup/rollup-linux-x64-gnu': 4.20.0 + '@rollup/rollup-linux-x64-musl': 4.20.0 + '@rollup/rollup-win32-arm64-msvc': 4.20.0 + '@rollup/rollup-win32-ia32-msvc': 4.20.0 + '@rollup/rollup-win32-x64-msvc': 4.20.0 fsevents: 2.3.3 run-parallel@1.2.0: @@ -5829,17 +5894,17 @@ snapshots: dependencies: typescript: 5.5.4 - ts-jest@29.2.3(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@22.0.2))(typescript@5.5.4): + ts-jest@29.2.4(@babel/core@7.24.9)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.9))(jest@29.7.0(@types/node@22.1.0))(typescript@5.5.4): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@22.0.2) + jest: 29.7.0(@types/node@22.1.0) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 make-error: 1.3.6 - semver: 7.6.2 + semver: 7.6.3 typescript: 5.5.4 yargs-parser: 21.1.1 optionalDependencies: @@ -5865,11 +5930,11 @@ snapshots: media-typer: 0.3.0 mime-types: 2.1.35 - typescript-eslint@8.0.0(eslint@9.8.0)(typescript@5.5.4): + typescript-eslint@8.0.1(eslint@9.8.0)(typescript@5.5.4): dependencies: - '@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4) - '@typescript-eslint/parser': 8.0.0(eslint@9.8.0)(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.0(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.1(eslint@9.8.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: @@ -5883,7 +5948,7 @@ snapshots: uglify-js@3.18.0: optional: true - undici-types@6.11.1: {} + undici-types@6.13.0: {} unpipe@1.0.0: {} diff --git a/src/opts.mjs b/src/opts.mjs new file mode 100644 index 00000000..1bc7ed67 --- /dev/null +++ b/src/opts.mjs @@ -0,0 +1,13 @@ +import { fileURLToPath } from "node:url"; + +export default { + dts: false, // Breaks tsc because it tries to then check parser.js + output: fileURLToPath(new URL("../lib/parser.js", import.meta.url)), + format: "commonjs", + allowedStartRules: ["Grammar", "ImportsAndSource"], + input: fileURLToPath(new URL("parser.pegjs", import.meta.url)), + returnTypes: { + Grammar: "import('./peg.d.ts').ast.Grammar", + ImportsAndSource: "import('./peg.d.ts').ast.TopLevelInitializer[]", + }, +}; diff --git a/test/cli/run.spec.ts b/test/cli/run.spec.ts index b7ddcd3c..d98601db 100644 --- a/test/cli/run.spec.ts +++ b/test/cli/run.spec.ts @@ -415,7 +415,7 @@ Options: This option conflicts with the \`-t/--test\` and \`-T/--test-file\` options unless \`-o/--output\` is also specified - --returnTypes Types returned for rules, as JSON object of + --return-types Types returned for rules, as JSON object of the form {"ruleName": "type"} -S, --start-rule When testing, use the given rule as the start rule. If this rule is not in the diff --git a/web-test/package.json b/web-test/package.json index 87e90ea8..8cd82a09 100644 --- a/web-test/package.json +++ b/web-test/package.json @@ -12,8 +12,8 @@ "author": "Joe Hildebrand ", "license": "MIT", "devDependencies": { - "@playwright/test": "1.45.3", - "@types/node": "22.0.2" + "@playwright/test": "1.46.0", + "@types/node": "22.1.0" }, "engines": { "node": ">=18"