diff --git a/package-lock.json b/package-lock.json index 8d396eab..d1a8c11e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2133,6 +2133,10 @@ "resolved": "packages/tone", "link": true }, + "node_modules/@strudel.cycles/transpiler": { + "resolved": "packages/transpiler", + "link": true + }, "node_modules/@strudel.cycles/webaudio": { "resolved": "packages/webaudio", "link": true @@ -4207,10 +4211,7 @@ "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "optional": true, - "peer": true + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "node_modules/defaults": { "version": "1.0.4", @@ -4948,9 +4949,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, - "optional": true, - "peer": true, "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -4972,9 +4970,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "optional": true, - "peer": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -4991,6 +4986,11 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.1.tgz", + "integrity": "sha512-woY0RUD87WzMBUiZLx8NsYr23N5BKsOMZHhu2hoNRVh6NXGfoiT1KOL8G3UHlJAnEDGmfa5ubNA/AacfG+Kb0g==" + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -5109,10 +5109,7 @@ "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "optional": true, - "peer": true + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" }, "node_modules/fastq": { "version": "1.13.0", @@ -7221,9 +7218,6 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "optional": true, - "peer": true, "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -8782,9 +8776,6 @@ "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "optional": true, - "peer": true, "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", @@ -9525,9 +9516,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">= 0.8.0" } @@ -10764,7 +10752,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.10.0" } @@ -11576,9 +11564,6 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "optional": true, - "peer": true, "dependencies": { "prelude-ls": "~1.1.2" }, @@ -12151,9 +12136,6 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=0.10.0" } @@ -12486,7 +12468,7 @@ }, "packages/eval": { "name": "@strudel.cycles/eval", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1", @@ -12513,10 +12495,10 @@ }, "packages/midi": { "name": "@strudel.cycles/midi", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { - "@strudel.cycles/tone": "^0.3.0", + "@strudel.cycles/tone": "^0.3.1", "tone": "^14.7.77", "webmidi": "^3.0.21" } @@ -12537,12 +12519,12 @@ }, "packages/mini": { "name": "@strudel.cycles/mini", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1", - "@strudel.cycles/eval": "^0.3.0", - "@strudel.cycles/tone": "^0.3.0" + "@strudel.cycles/eval": "^0.3.1", + "@strudel.cycles/tone": "^0.3.1" }, "devDependencies": { "peggy": "^2.0.1" @@ -12558,13 +12540,13 @@ }, "packages/react": { "name": "@strudel.cycles/react", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@codemirror/lang-javascript": "^6.1.1", "@strudel.cycles/core": "^0.3.1", - "@strudel.cycles/eval": "^0.3.0", - "@strudel.cycles/tone": "^0.3.0", + "@strudel.cycles/eval": "^0.3.1", + "@strudel.cycles/tone": "^0.3.1", "@uiw/codemirror-themes": "^4.12.4", "@uiw/react-codemirror": "^4.12.4", "react-hook-inview": "^4.5.0" @@ -12639,11 +12621,11 @@ }, "packages/soundfonts": { "name": "@strudel.cycles/soundfonts", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1", - "@strudel.cycles/webaudio": "^0.3.0", + "@strudel.cycles/webaudio": "^0.3.1", "sfumato": "^0.1.2", "soundfont2": "^0.4.0" }, @@ -12671,7 +12653,7 @@ }, "packages/tonal": { "name": "@strudel.cycles/tonal", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1", @@ -12695,7 +12677,7 @@ }, "packages/tone": { "name": "@strudel.cycles/tone", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1", @@ -12703,9 +12685,31 @@ "tone": "^14.7.77" } }, + "packages/transpiler": { + "name": "@strudel.cycles/transpiler", + "version": "0.3.1", + "license": "AGPL-3.0-or-later", + "dependencies": { + "@strudel.cycles/core": "^0.3.1", + "acorn": "^8.8.1", + "escodegen": "^2.0.0", + "estree-walker": "^3.0.1" + } + }, + "packages/transpiler/node_modules/acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "packages/webaudio": { "name": "@strudel.cycles/webaudio", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1" @@ -12713,7 +12717,7 @@ }, "packages/webdirt": { "name": "@strudel.cycles/webdirt", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1", @@ -12722,7 +12726,7 @@ }, "packages/xen": { "name": "@strudel.cycles/xen", - "version": "0.3.0", + "version": "0.3.1", "license": "AGPL-3.0-or-later", "dependencies": { "@strudel.cycles/core": "^0.3.1" @@ -14423,7 +14427,7 @@ "@strudel.cycles/midi": { "version": "file:packages/midi", "requires": { - "@strudel.cycles/tone": "^0.3.0", + "@strudel.cycles/tone": "^0.3.1", "tone": "^14.7.77", "webmidi": "^3.0.21" }, @@ -14443,8 +14447,8 @@ "version": "file:packages/mini", "requires": { "@strudel.cycles/core": "^0.3.1", - "@strudel.cycles/eval": "^0.3.0", - "@strudel.cycles/tone": "^0.3.0", + "@strudel.cycles/eval": "^0.3.1", + "@strudel.cycles/tone": "^0.3.1", "peggy": "^2.0.1" } }, @@ -14459,8 +14463,8 @@ "requires": { "@codemirror/lang-javascript": "^6.1.1", "@strudel.cycles/core": "^0.3.1", - "@strudel.cycles/eval": "^0.3.0", - "@strudel.cycles/tone": "^0.3.0", + "@strudel.cycles/eval": "^0.3.1", + "@strudel.cycles/tone": "^0.3.1", "@types/react": "^17.0.2", "@types/react-dom": "^17.0.2", "@uiw/codemirror-themes": "^4.12.4", @@ -14516,7 +14520,7 @@ "version": "file:packages/soundfonts", "requires": { "@strudel.cycles/core": "^0.3.1", - "@strudel.cycles/webaudio": "^0.3.0", + "@strudel.cycles/webaudio": "^0.3.1", "node-fetch": "^3.2.6", "sfumato": "^0.1.2", "soundfont2": "^0.4.0" @@ -14562,6 +14566,22 @@ "tone": "^14.7.77" } }, + "@strudel.cycles/transpiler": { + "version": "file:packages/transpiler", + "requires": { + "@strudel.cycles/core": "^0.3.1", + "acorn": "^8.8.1", + "escodegen": "^2.0.0", + "estree-walker": "^3.0.1" + }, + "dependencies": { + "acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==" + } + } + }, "@strudel.cycles/webaudio": { "version": "file:packages/webaudio", "requires": { @@ -16271,10 +16291,7 @@ "deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "optional": true, - "peer": true + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "defaults": { "version": "1.0.4", @@ -16749,9 +16766,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, - "optional": true, - "peer": true, "requires": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -16763,16 +16777,18 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "optional": true, - "peer": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" }, + "estree-walker": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.1.tgz", + "integrity": "sha512-woY0RUD87WzMBUiZLx8NsYr23N5BKsOMZHhu2hoNRVh6NXGfoiT1KOL8G3UHlJAnEDGmfa5ubNA/AacfG+Kb0g==" + }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -16869,10 +16885,7 @@ "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "optional": true, - "peer": true + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" }, "fastq": { "version": "1.13.0", @@ -18473,9 +18486,6 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "optional": true, - "peer": true, "requires": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -19696,9 +19706,6 @@ "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "optional": true, - "peer": true, "requires": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", @@ -20227,10 +20234,7 @@ "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "optional": true, - "peer": true + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==" }, "process-nextick-args": { "version": "2.0.1", @@ -20339,8 +20343,8 @@ "requires": { "@codemirror/lang-javascript": "^6.1.1", "@strudel.cycles/core": "^0.3.1", - "@strudel.cycles/eval": "^0.3.0", - "@strudel.cycles/tone": "^0.3.0", + "@strudel.cycles/eval": "^0.3.1", + "@strudel.cycles/tone": "^0.3.1", "@types/react": "^17.0.2", "@types/react-dom": "^17.0.2", "@uiw/codemirror-themes": "^4.12.4", @@ -21237,7 +21241,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "devOptional": true }, "source-map-generator": { "version": "0.8.0", @@ -21893,9 +21897,6 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "optional": true, - "peer": true, "requires": { "prelude-ls": "~1.1.2" } @@ -22294,10 +22295,7 @@ "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "optional": true, - "peer": true + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" }, "wordwrap": { "version": "1.0.0", diff --git a/packages/core/evaluate.mjs b/packages/core/evaluate.mjs index 7e7fe1d1..eea5a90b 100644 --- a/packages/core/evaluate.mjs +++ b/packages/core/evaluate.mjs @@ -24,8 +24,16 @@ export const evalScope = async (...args) => { Object.assign(globalThis, ...modules, Pattern.prototype.bootstrap()); }; -function safeEval(str) { - return Function('"use strict";return (' + str + ')')(); +function safeEval(str, options = {}) { + const { wrapExpression = true, wrapAsync = true } = options; + if (wrapExpression) { + str = `{${str}}`; + } + if (wrapAsync) { + str = `(async ()=>${str})()`; + } + const body = `"use strict";return (${str})`; + return Function(body)(); } export const evaluate = async (code, transpiler) => { @@ -35,7 +43,9 @@ export const evaluate = async (code, transpiler) => { if (transpiler) { code = transpiler(code); // transform syntactically correct js code to semantically usable code } - let evaluated = await safeEval(code); + // if no transpiler is given, we expect a single instruction (!wrapExpression) + const options = { wrapExpression: !!transpiler }; + let evaluated = await safeEval(code, options); if (!isPattern(evaluated)) { console.log('evaluated', evaluated); const message = `got "${typeof evaluated}" instead of pattern`; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.211bbc68.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.211bbc68.js new file mode 100644 index 00000000..c71a2c36 --- /dev/null +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.211bbc68.js @@ -0,0 +1 @@ +import{b as s,h as i,m,a as n,c as p,p as t}from"./index.4cbc0a10.js";export{s as SyntaxError,i as h,m as mini,n as minify,p as parse,t as patternifyAST}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.4cbc0a10.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.4cbc0a10.js new file mode 100644 index 00000000..d34a6d2d --- /dev/null +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.4cbc0a10.js @@ -0,0 +1,24 @@ +var tn=Object.defineProperty;var rn=(r,t,e)=>t in r?tn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var K=(r,t,e)=>(rn(r,typeof t!="symbol"?t+"":t,e),e);const strudel=Object.freeze(Object.defineProperty({__proto__:null,get Fraction(){return fraction},get controls(){return controls},get drawLine(){return drawLine},get gist(){return gist},get Hap(){return Hap},get setStringParser(){return setStringParser},get Pattern(){return Pattern$3},get polyrhythm(){return polyrhythm},get pr(){return pr},get silence(){return silence$1},get pure(){return pure$1},get isPattern(){return isPattern$1},get reify(){return reify$2},get stack(){return stack$1},get slowcat(){return slowcat$1},get slowcatPrime(){return slowcatPrime},get fastcat(){return fastcat},get cat(){return cat},get timeCat(){return timeCat$1},get sequence(){return sequence$1},get seq(){return seq},get polymeterSteps(){return polymeterSteps},get polymeter(){return polymeter},get pm(){return pm},get add(){return add},get chop(){return chop},get chunk(){return chunk},get chunkBack(){return chunkBack},get div(){return div},get early(){return early},get echo(){return echo},get every(){return every},get fast(){return fast},get inv(){return inv},get invert(){return invert},get iter(){return iter},get iterBack(){return iterBack},get jux(){return jux},get juxBy(){return juxBy},get late(){return late},get linger(){return linger},get mask(){return mask},get mul(){return mul},get off(){return off},get ply(){return ply},get range(){return range},get rangex(){return rangex},get range2(){return range2},get rev(){return rev},get slow(){return slow},get struct(){return struct},get sub(){return sub},get superimpose(){return superimpose},get set(){return set},get when(){return when},get makeComposable(){return makeComposable},get patternify2(){return patternify2},get patternify3(){return patternify3},get patternify4(){return patternify4},get steady(){return steady},get signal(){return signal},get isaw(){return isaw},get isaw2(){return isaw2},get saw(){return saw},get saw2(){return saw2},get sine2(){return sine2},get sine(){return sine},get cosine(){return cosine},get cosine2(){return cosine2},get square(){return square},get square2(){return square2},get tri(){return tri},get tri2(){return tri2},get time(){return time},get rand(){return rand},get rand2(){return rand2},get _brandBy(){return _brandBy},get brandBy(){return brandBy},get brand(){return brand},get _irand(){return _irand},get irand(){return irand},get __chooseWith(){return __chooseWith},get chooseWith(){return chooseWith},get chooseInWith(){return chooseInWith},get choose(){return choose},get chooseCycles(){return chooseCycles},get randcat(){return randcat},get wchoose(){return wchoose},get wchooseCycles(){return wchooseCycles},get perlinWith(){return perlinWith},get perlin(){return perlin},get State(){return State},get TimeSpan(){return TimeSpan},get isNote(){return isNote},get tokenizeNote(){return tokenizeNote},get toMidi(){return toMidi},get fromMidi(){return fromMidi},get getFreq(){return getFreq},get midi2note(){return midi2note},get mod(){return mod},get getPlayableNoteValue(){return getPlayableNoteValue},get getFrequency(){return getFrequency},get rotate(){return rotate},get pipe(){return pipe},get compose(){return compose},get removeUndefineds(){return removeUndefineds},get flatten(){return flatten},get id(){return id},get constant(){return constant},get listRange(){return listRange},get curry(){return curry},get parseNumeral(){return parseNumeral},get mapArgs(){return mapArgs},get numeralArgs(){return numeralArgs},get parseFractional(){return parseFractional},get fractionalArgs(){return fractionalArgs},get evalScope(){return evalScope},get evaluate(){return evaluate$1},get repl(){return repl}},Symbol.toStringTag,{value:"Module"}));(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const f of i.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function e(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerpolicy&&(i.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?i.credentials="include":s.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(s){if(s.ep)return;s.ep=!0;const i=e(s);fetch(s.href,i)}})();const scriptRel="modulepreload",assetsURL=function(r){return"/tidalcycles/strudel/use-acorn/packages/core/examples/vite-vanilla-repl/dist/"+r},seen={},__vitePreload=function(t,e,o){if(!e||e.length===0)return t();const s=document.getElementsByTagName("link");return Promise.all(e.map(i=>{if(i=assetsURL(i),i in seen)return;seen[i]=!0;const f=i.endsWith(".css"),l=f?'[rel="stylesheet"]':"";if(!!o)for(let y=s.length-1;y>=0;y--){const $=s[y];if($.href===i&&(!f||$.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const w=document.createElement("link");if(w.rel=f?"stylesheet":scriptRel,f||(w.as="script",w.crossOrigin=""),w.href=i,document.head.appendChild(w),f)return new Promise((y,$)=>{w.addEventListener("load",y),w.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function getAugmentedNamespace(r){var t=r.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(o){var s=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:function(){return r[o]}})}),e}var fraction$1={exports:{}};/** + * @license Fraction.js v4.2.0 05/03/2022 + * https://www.xarg.org/2014/03/rational-numbers-in-javascript/ + * + * Copyright (c) 2021, Robert Eisele (robert@xarg.org) + * Dual licensed under the MIT or GPL Version 2 licenses. + **/(function(r,t){(function(e){var o=2e3,s={s:1,n:0,d:1};function i(p,d){if(isNaN(p=parseInt(p,10)))throw C.InvalidParameter;return p*d}function f(p,d){if(d===0)throw C.DivisionByZero;var m=Object.create(C.prototype);m.s=p<0?-1:1,p=p<0?-p:p;var b=S(p,d);return m.n=p/b,m.d=d/b,m}function l(p){for(var d={},m=p,b=2,I=4;I<=m;){for(;m%b===0;)m/=b,d[b]=(d[b]||0)+1;I+=1+2*b++}return m!==p?m>1&&(d[m]=(d[m]||0)+1):d[p]=(d[p]||0)+1,d}var g=function(p,d){var m=0,b=1,I=1,T=0,G=0,Y=0,D=1,W=1,P=0,B=1,z=1,O=1,Z=1e7,L;if(p!=null)if(d!==void 0){if(m=p,b=d,I=m*b,m%1!==0||b%1!==0)throw C.NonIntegerParameter}else switch(typeof p){case"object":{if("d"in p&&"n"in p)m=p.n,b=p.d,"s"in p&&(m*=p.s);else if(0 in p)m=p[0],1 in p&&(b=p[1]);else throw C.InvalidParameter;I=m*b;break}case"number":{if(p<0&&(I=p,p=-p),p%1===0)m=p;else if(p>0){for(p>=1&&(W=Math.pow(10,Math.floor(1+Math.log(p)/Math.LN10)),p/=W);B<=Z&&O<=Z;)if(L=(P+z)/(B+O),p===L){B+O<=Z?(m=P+z,b=B+O):O>B?(m=z,b=O):(m=P,b=B);break}else p>L?(P+=z,B+=O):(z+=P,O+=B),B>Z?(m=z,b=O):(m=P,b=B);m*=W}else(isNaN(p)||isNaN(d))&&(b=m=NaN);break}case"string":{if(B=p.match(/\d+|./g),B===null)throw C.InvalidParameter;if(B[P]==="-"?(I=-1,P++):B[P]==="+"&&P++,B.length===P+1?G=i(B[P++],I):B[P+1]==="."||B[P]==="."?(B[P]!=="."&&(T=i(B[P++],I)),P++,(P+1===B.length||B[P+1]==="("&&B[P+3]===")"||B[P+1]==="'"&&B[P+3]==="'")&&(G=i(B[P],I),D=Math.pow(10,B[P].length),P++),(B[P]==="("&&B[P+2]===")"||B[P]==="'"&&B[P+2]==="'")&&(Y=i(B[P+1],I),W=Math.pow(10,B[P+1].length)-1,P+=3)):B[P+1]==="/"||B[P+1]===":"?(G=i(B[P],I),D=i(B[P+2],1),P+=3):B[P+3]==="/"&&B[P+1]===" "&&(T=i(B[P],I),G=i(B[P+2],I),D=i(B[P+4],1),P+=5),B.length<=P){b=D*W,I=m=Y+b*T+W*G;break}}default:throw C.InvalidParameter}if(b===0)throw C.DivisionByZero;s.s=I<0?-1:1,s.n=Math.abs(m),s.d=Math.abs(b)};function w(p,d,m){for(var b=1;d>0;p=p*p%m,d>>=1)d&1&&(b=b*p%m);return b}function y(p,d){for(;d%2===0;d/=2);for(;d%5===0;d/=5);if(d===1)return 0;for(var m=10%d,b=1;m!==1;b++)if(m=m*10%d,b>o)return 0;return b}function $(p,d,m){for(var b=1,I=w(10,m,d),T=0;T<300;T++){if(b===I)return T;b=b*10%d,I=I*10%d}return 0}function S(p,d){if(!p)return d;if(!d)return p;for(;;){if(p%=d,!p)return d;if(d%=p,!d)return p}}function C(p,d){if(g(p,d),this instanceof C)p=S(s.d,s.n),this.s=s.s,this.n=s.n/p,this.d=s.d/p;else return f(s.s*s.n,s.d)}C.DivisionByZero=new Error("Division by Zero"),C.InvalidParameter=new Error("Invalid argument"),C.NonIntegerParameter=new Error("Parameters must be integer"),C.prototype={s:1,n:0,d:1,abs:function(){return f(this.n,this.d)},neg:function(){return f(-this.s*this.n,this.d)},add:function(p,d){return g(p,d),f(this.s*this.n*s.d+s.s*this.d*s.n,this.d*s.d)},sub:function(p,d){return g(p,d),f(this.s*this.n*s.d-s.s*this.d*s.n,this.d*s.d)},mul:function(p,d){return g(p,d),f(this.s*s.s*this.n*s.n,this.d*s.d)},div:function(p,d){return g(p,d),f(this.s*s.s*this.n*s.d,this.d*s.n)},clone:function(){return f(this.s*this.n,this.d)},mod:function(p,d){if(isNaN(this.n)||isNaN(this.d))return new C(NaN);if(p===void 0)return f(this.s*this.n%this.d,1);if(g(p,d),s.n===0&&this.d===0)throw C.DivisionByZero;return f(this.s*(s.d*this.n)%(s.n*this.d),s.d*this.d)},gcd:function(p,d){return g(p,d),f(S(s.n,this.n)*S(s.d,this.d),s.d*this.d)},lcm:function(p,d){return g(p,d),s.n===0&&this.n===0?f(0,1):f(s.n*this.n,S(s.n,this.n)*S(s.d,this.d))},ceil:function(p){return p=Math.pow(10,p||0),isNaN(this.n)||isNaN(this.d)?new C(NaN):f(Math.ceil(p*this.s*this.n/this.d),p)},floor:function(p){return p=Math.pow(10,p||0),isNaN(this.n)||isNaN(this.d)?new C(NaN):f(Math.floor(p*this.s*this.n/this.d),p)},round:function(p){return p=Math.pow(10,p||0),isNaN(this.n)||isNaN(this.d)?new C(NaN):f(Math.round(p*this.s*this.n/this.d),p)},inverse:function(){return f(this.s*this.d,this.n)},pow:function(p,d){if(g(p,d),s.d===1)return s.s<0?f(Math.pow(this.s*this.d,s.n),Math.pow(this.n,s.n)):f(Math.pow(this.s*this.n,s.n),Math.pow(this.d,s.n));if(this.s<0)return null;var m=l(this.n),b=l(this.d),I=1,T=1;for(var G in m)if(G!=="1"){if(G==="0"){I=0;break}if(m[G]*=s.n,m[G]%s.d===0)m[G]/=s.d;else return null;I*=Math.pow(G,m[G])}for(var G in b)if(G!=="1"){if(b[G]*=s.n,b[G]%s.d===0)b[G]/=s.d;else return null;T*=Math.pow(G,b[G])}return s.s<0?f(T,I):f(I,T)},equals:function(p,d){return g(p,d),this.s*this.n*s.d===s.s*s.n*this.d},compare:function(p,d){g(p,d);var m=this.s*this.n*s.d-s.s*s.n*this.d;return(0=0;T--)I=I.inverse().add(m[T]);if(I.sub(d).abs().valueOf()0&&(m+=d,m+=" ",b%=I),m+=b,m+="/",m+=I),m},toLatex:function(p){var d,m="",b=this.n,I=this.d;return this.s<0&&(m+="-"),I===1?m+=b:(p&&(d=Math.floor(b/I))>0&&(m+=d,b%=I),m+="\\frac{",m+=b,m+="}{",m+=I,m+="}"),m},toContinued:function(){var p,d=this.n,m=this.d,b=[];if(isNaN(d)||isNaN(m))return b;do b.push(Math.floor(d/m)),p=d%m,d=m,m=p;while(d!==1);return b},toString:function(p){var d=this.n,m=this.d;if(isNaN(d)||isNaN(m))return"NaN";p=p||15;var b=y(d,m),I=$(d,m,b),T=this.s<0?"-":"";if(T+=d/m|0,d%=m,d*=10,d&&(T+="."),b){for(var G=I;G--;)T+=d/m|0,d%=m,d*=10;T+="(";for(var G=b;G--;)T+=d/m|0,d%=m,d*=10;T+=")"}else for(var G=p;d&&G--;)T+=d/m|0,d%=m,d*=10;return T}},Object.defineProperty(C,"__esModule",{value:!0}),C.default=C,C.Fraction=C,r.exports=C})()})(fraction$1);const Fraction$1=getDefaultExportFromCjs(fraction$1.exports);Fraction$1.prototype.sam=function(){return this.floor()};Fraction$1.prototype.nextSam=function(){return this.sam().add(1)};Fraction$1.prototype.wholeCycle=function(){return new TimeSpan(this.sam(),this.nextSam())};Fraction$1.prototype.cyclePos=function(){return this.sub(this.sam())};Fraction$1.prototype.lt=function(r){return this.compare(r)<0};Fraction$1.prototype.gt=function(r){return this.compare(r)>0};Fraction$1.prototype.lte=function(r){return this.compare(r)<=0};Fraction$1.prototype.gte=function(r){return this.compare(r)>=0};Fraction$1.prototype.eq=function(r){return this.compare(r)==0};Fraction$1.prototype.max=function(r){return this.gt(r)?this:r};Fraction$1.prototype.min=function(r){return this.lt(r)?this:r};Fraction$1.prototype.show=function(){return this.s*this.n+"/"+this.d};Fraction$1.prototype.or=function(r){return this.eq(0)?r:this};const fraction=r=>(typeof r=="number"&&(r=String(r)),Fraction$1(r)),gcd=(...r)=>r.reduce((t,e)=>t.gcd(e),fraction(1));fraction._original=Fraction$1;class TimeSpan{constructor(t,e){this.begin=fraction(t),this.end=fraction(e)}get spanCycles(){const t=[];var e=this.begin;const o=this.end,s=o.sam();if(e.equals(o))return[new TimeSpan(e,o)];for(;o.gt(e);){if(e.sam().equals(s)){t.push(new TimeSpan(e,this.end));break}const i=e.nextSam();t.push(new TimeSpan(e,i)),e=i}return t}get duration(){return this.end.sub(this.begin)}cycleArc(){const t=this.begin.cyclePos(),e=t.add(this.duration);return new TimeSpan(t,e)}withTime(t){return new TimeSpan(t(this.begin),t(this.end))}withEnd(t){return new TimeSpan(this.begin,t(this.end))}withCycle(t){const e=this.begin.sam(),o=e.add(t(this.begin.sub(e))),s=e.add(t(this.end.sub(e)));return new TimeSpan(o,s)}intersection(t){const e=this.begin.max(t.begin),o=this.end.min(t.end);if(!e.gt(o)&&!(e.equals(o)&&(e.equals(this.end)&&this.begin.lt(this.end)||e.equals(t.end)&&t.begin.lt(t.end))))return new TimeSpan(e,o)}intersection_e(t){const e=this.intersection(t);if(e==null)throw"TimeSpans do not intersect";return e}midpoint(){return this.begin.add(this.duration.div(fraction(2)))}equals(t){return this.begin.equals(t.begin)&&this.end.equals(t.end)}show(){return this.begin.show()+" -> "+this.end.show()}}class Hap{constructor(t,e,o,s={},i=!1){this.whole=t,this.part=e,this.value=o,this.context=s,this.stateful=i,i&&console.assert(typeof this.value=="function","Stateful values must be functions")}get duration(){return this.whole.end.sub(this.whole.begin)}wholeOrPart(){return this.whole?this.whole:this.part}withSpan(t){const e=this.whole?t(this.whole):void 0;return new Hap(e,t(this.part),this.value,this.context)}withValue(t){return new Hap(this.whole,this.part,t(this.value),this.context)}hasOnset(){return this.whole!=null&&this.whole.begin.equals(this.part.begin)}resolveState(t){if(this.stateful&&this.hasOnset()){console.log("stateful");const e=this.value,[o,s]=e(t);return[o,new Hap(this.whole,this.part,s,this.context,!1)]}return[t,this]}spanEquals(t){return this.whole==null&&t.whole==null||this.whole.equals(t.whole)}equals(t){return this.spanEquals(t)&&this.part.equals(t.part)&&this.value===t.value}show(){return"("+(this.whole==null?"~":this.whole.show())+", "+this.part.show()+", "+this.value+")"}showWhole(){return`${this.whole==null?"~":this.whole.show()}: ${typeof this.value=="object"?JSON.stringify(this.value):this.value}`}combineContext(t){const e=this;return{...e.context,...t.context,locations:(e.context.locations||[]).concat(t.context.locations||[])}}setContext(t){return new Hap(this.whole,this.part,this.value,t)}}class State{constructor(t,e={}){this.span=t,this.controls=e}setSpan(t){return new State(t,this.controls)}withSpan(t){return this.setSpan(t(this.span))}setControls(t){return new State(this.span,t)}}const isNote=r=>/^[a-gA-G][#b]*[0-9]$/.test(r),tokenizeNote=r=>{var s;if(typeof r!="string")return[];const[t,e="",o]=((s=r.match(/^([a-gA-G])([#bs]*)([0-9])?$/))==null?void 0:s.slice(1))||[];return t?[t,e,o?Number(o):void 0]:[]},toMidi=r=>{const[t,e,o]=tokenizeNote(r);if(!t)throw new Error('not a note: "'+r+'"');const s={c:0,d:2,e:4,f:5,g:7,a:9,b:11}[t.toLowerCase()],i=(e==null?void 0:e.split("").reduce((f,l)=>f+{"#":1,b:-1,s:1}[l],0))||0;return(Number(o)+1)*12+s+i},fromMidi=r=>Math.pow(2,(r-69)/12)*440,getFreq=r=>fromMidi(typeof r=="number"?r:toMidi(r)),midi2note=r=>{const t=Math.floor(r/12)-1;return["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"][r%12]+t},mod=(r,t)=>(r%t+t)%t,getPlayableNoteValue=r=>{let{value:t,context:e}=r;if(typeof t=="object"&&!Array.isArray(t)&&(t=t.note||t.n||t.value),typeof t=="number"&&e.type!=="frequency")t=fromMidi(r.value);else if(typeof t=="number"&&e.type==="frequency")t=r.value;else if(typeof t!="string"||!isNote(t))throw new Error("not a note: "+JSON.stringify(t));return t},getFrequency=r=>{let{value:t,context:e}=r;if(typeof t=="object")return t.freq?t.freq:getFreq(t.note||t.n||t.value);if(typeof t=="number"&&e.type!=="frequency")t=fromMidi(r.value);else if(typeof t=="string"&&isNote(t))t=fromMidi(toMidi(r.value));else if(typeof t!="number")throw new Error("not a note or frequency: "+t);return t},rotate=(r,t)=>r.slice(t).concat(r.slice(0,t)),pipe=(...r)=>r.reduce((t,e)=>(...o)=>t(e(...o)),t=>t),compose=(...r)=>pipe(...r.reverse()),removeUndefineds=r=>r.filter(t=>t!=null),flatten=r=>[].concat(...r),id=r=>r,constant=(r,t)=>r,listRange=(r,t)=>Array.from({length:t-r+1},(e,o)=>o+r);function curry(r,t){const e=function o(...s){if(s.length>=r.length)return r.apply(this,s);{const i=function(...f){return o.apply(this,s.concat(f))};return t&&t(i,s),i}};return t&&t(e,[]),e}function parseNumeral(r){const t=Number(r);if(!isNaN(t))return t;if(isNote(r))return toMidi(r);throw new Error(`cannot parse as numeral: "${r}"`)}function mapArgs(r,t){return(...e)=>r(...e.map(t))}function numeralArgs(r){return mapArgs(r,parseNumeral)}function parseFractional(r){const t=Number(r);if(!isNaN(t))return t;const e={pi:Math.PI,w:1,h:.5,q:.25,e:.125,s:.0625,t:1/3,f:.2,x:1/6}[r];if(typeof e<"u")return e;throw new Error(`cannot parse as fractional: "${r}"`)}const fractionalArgs=r=>mapArgs(r,parseFractional);function unionWithObj(r,t,e){const o=Object.keys(r).filter(s=>Object.keys(t).includes(s));return Object.assign({},r,t,Object.fromEntries(o.map(s=>[s,e(r[s],t[s])])))}curry((r,t)=>r*t);curry((r,t)=>t.map(r));function drawLine(r,t=60){let e=0,o=fraction(0),s=[""],i="";for(;s[0].lengthy.hasOnset()).map(y=>y.duration),g=gcd(...l),w=g.inverse();s=s.map(y=>y+"|"),i+="|";for(let y=0;yd.whole.begin.lte($)&&d.whole.end.gte(S)),p=C.length-s.length;p>0&&(s=s.concat(Array(p).fill(i))),s=s.map((d,m)=>{const b=C[m];if(b){const T=b.whole.begin.eq($)?""+b.value:"-";return d+T}return d+"."}),i+=".",o=o.add(g)}e++}return s.join(` +`)}let stringParser;const setStringParser=r=>stringParser=r;class Pattern$3{constructor(t){K(this,"_Pattern",!0);this.query=t}queryArc(t,e){return this.query(new State(new TimeSpan(t,e)))}_splitQueries(){const t=this,e=o=>flatten(o.span.spanCycles.map(s=>t.query(o.setSpan(s))));return new Pattern$3(e)}withQuerySpan(t){return new Pattern$3(e=>this.query(e.withSpan(t)))}withQuerySpanMaybe(t){const e=this;return new Pattern$3(o=>{const s=o.withSpan(t);return s.span?e.query(s):[]})}withQueryTime(t){return new Pattern$3(e=>this.query(e.withSpan(o=>o.withTime(t))))}withHapSpan(t){return new Pattern$3(e=>this.query(e).map(o=>o.withSpan(t)))}withHapTime(t){return this.withHapSpan(e=>e.withTime(t))}_withHaps(t){return new Pattern$3(e=>t(this.query(e)))}_withHap(t){return this._withHaps(e=>e.map(t))}_setContext(t){return this._withHap(e=>e.setContext(t))}_withContext(t){return this._withHap(e=>e.setContext(t(e.context)))}_stripContext(){return this._withHap(t=>t.setContext({}))}withLocation(t,e){const o={start:{line:t[0],column:t[1],offset:t[2]},end:{line:e[0],column:e[1],offset:e[2]}};return this._withContext(s=>{const i=(s.locations||[]).concat([o]);return{...s,locations:i}})}withMiniLocation(t,e){const o={start:{line:t[0],column:t[1],offset:t[2]},end:{line:e[0],column:e[1],offset:e[2]}};return this._withContext(s=>{let i=s.locations||[];return i=i.map(({start:f,end:l})=>{const g=f.line===1?o.start.column:0;return{start:{...f,line:f.line-1+(o.start.line-1)+1,column:f.column-1+g},end:{...l,line:l.line-1+(o.start.line-1)+1,column:l.column-1+g}}}),{...s,locations:i}})}withValue(t){return new Pattern$3(e=>this.query(e).map(o=>o.withValue(t)))}fmap(t){return this.withValue(t)}_filterHaps(t){return new Pattern$3(e=>this.query(e).filter(t))}_filterValues(t){return new Pattern$3(e=>this.query(e).filter(o=>t(o.value)))}_removeUndefineds(){return this._filterValues(t=>t!=null)}onsetsOnly(){return this._filterHaps(t=>t.hasOnset())}discreteOnly(){return this._filterHaps(t=>t.whole)}_appWhole(t,e){const o=this,s=function(i){const f=o.query(i),l=e.query(i),g=function(w,y){const $=w.part.intersection(y.part);if($!=null)return new Hap(t(w.whole,y.whole),$,w.value(y.value),y.combineContext(w))};return flatten(f.map(w=>removeUndefineds(l.map(y=>g(w,y)))))};return new Pattern$3(s)}appBoth(t){const e=function(o,s){if(!(o==null||s==null))return o.intersection_e(s)};return this._appWhole(e,t)}appLeft(t){const e=this,o=function(s){const i=[];for(const f of e.query(s)){const l=t.query(s.setSpan(f.wholeOrPart()));for(const g of l){const w=f.whole,y=f.part.intersection(g.part);if(y){const $=f.value(g.value),S=g.combineContext(f),C=new Hap(w,y,$,S);i.push(C)}}}return i};return new Pattern$3(o)}appRight(t){const e=this,o=function(s){const i=[];for(const f of t.query(s)){const l=e.query(s.setSpan(f.wholeOrPart()));for(const g of l){const w=f.whole,y=g.part.intersection(f.part);if(y){const $=g.value(f.value),S=f.combineContext(g),C=new Hap(w,y,$,S);i.push(C)}}}return i};return new Pattern$3(o)}firstCycle(t=!1){var e=this;return t||(e=e._stripContext()),e.query(new State(new TimeSpan(fraction(0),fraction(1))))}get _firstCycleValues(){return this.firstCycle().map(t=>t.value)}get _showFirstCycle(){return this.firstCycle().map(t=>`${t.value}: ${t.whole.begin.toFraction()} - ${t.whole.end.toFraction()}`)}_sortHapsByPart(){return this._withHaps(t=>t.sort((e,o)=>e.part.begin.sub(o.part.begin).or(e.part.end.sub(o.part.end)).or(e.whole.begin.sub(o.whole.begin).or(e.whole.end.sub(o.whole.end)))))}_opIn(t,e){return this.fmap(e).appLeft(reify$2(t))}_opOut(t,e){return this.fmap(e).appRight(reify$2(t))}_opMix(t,e){return this.fmap(e).appBoth(reify$2(t))}_opSqueeze(t,e){const o=reify$2(t);return this.fmap(s=>o.fmap(i=>e(s)(i)))._squeezeJoin()}_opSqueezeOut(t,e){const o=this;return reify$2(t).fmap(i=>o.fmap(f=>e(f)(i)))._squeezeJoin()}_opTrig(t,e){return reify$2(t).fmap(s=>this.fmap(i=>e(i)(s)))._trigJoin()}_opTrigzero(t,e){return reify$2(t).fmap(s=>this.fmap(i=>e(i)(s)))._TrigzeroJoin()}_asNumber(){return this.fmap(parseNumeral)}round(){return this._asNumber().fmap(t=>Math.round(t))}floor(){return this._asNumber().fmap(t=>Math.floor(t))}ceil(){return this._asNumber().fmap(t=>Math.ceil(t))}_toBipolar(){return this.fmap(t=>t*2-1)}_fromBipolar(){return this.fmap(t=>(t+1)/2)}_range(t,e){return this.mul(e-t).add(t)}_rangex(t,e){return this._range(Math.log(t),Math.log(e)).fmap(Math.exp)}_range2(t,e){return this._fromBipolar()._range(t,e)}_bindWhole(t,e){const o=this,s=function(i){const f=function(g,w){return new Hap(t(g.whole,w.whole),w.part,w.value,Object.assign({},g.context,w.context,{locations:(g.context.locations||[]).concat(w.context.locations||[])}))},l=function(g){return e(g.value).query(i.setSpan(g.part)).map(w=>f(g,w))};return flatten(o.query(i).map(g=>l(g)))};return new Pattern$3(s)}bind(t){const e=function(o,s){if(!(o==null||s==null))return o.intersection_e(s)};return this._bindWhole(e,t)}join(){return this.bind(id)}outerBind(t){return this._bindWhole((e,o)=>e,t)}outerJoin(){return this.outerBind(id)}innerBind(t){return this._bindWhole((e,o)=>o,t)}innerJoin(){return this.innerBind(id)}_trigJoin(t=!1){const e=this;return new Pattern$3(o=>e.discreteOnly().query(o).map(s=>s.value.late(t?s.whole.begin:s.whole.begin.cyclePos()).query(o).map(i=>new Hap(i.whole?i.whole.intersection(s.whole):void 0,i.part.intersection(s.part),i.value).setContext(s.combineContext(i))).filter(i=>i.part)).flat())}_TrigzeroJoin(){return this._trigJoin(!0)}_squeezeJoin(){const t=this;function e(o){const s=t.discreteOnly().query(o);function i(l){const w=l.value._focusSpan(l.wholeOrPart()).query(o.setSpan(l.part));function y($,S){let C;if(S.whole&&$.whole&&(C=S.whole.intersection($.whole),!C))return;const p=S.part.intersection($.part);if(!p)return;const d=S.combineContext($);return new Hap(C,p,S.value,d)}return w.map($=>y(l,$))}return flatten(s.map(i)).filter(l=>l)}return new Pattern$3(e)}_squeezeBind(t){return this.fmap(t)._squeezeJoin()}_apply(t){return t(this)}layer(...t){return stack$1(...t.map(e=>e(this)))}_patternify(t){const e=this;return function(...s){return s=s.map(f=>isPattern$1(f)?f.fmap(l=>l.value||l):f),sequence$1(...s).fmap(f=>t.call(e,f)).innerJoin()}}_fastGap(t){const e=function(s){const i=s.begin.sam(),f=s.begin.sub(i).mul(t).min(1),l=s.end.sub(i).mul(t).min(1);if(!(f>=1))return new TimeSpan(i.add(f),i.add(l))},o=function(s){const i=s.part.begin,f=s.part.end,l=i.sam(),g=i.sub(l).div(t).min(1),w=f.sub(l).div(t).min(1),y=new TimeSpan(l.add(g),l.add(w)),$=s.whole?new TimeSpan(y.begin.sub(i.sub(s.whole.begin).div(t)),y.end.add(s.whole.end.sub(f).div(t))):void 0;return new Hap($,y,s.value,s.context)};return this.withQuerySpanMaybe(e)._withHap(o)._splitQueries()}_compress(t,e){return t.gt(e)||t.gt(1)||e.gt(1)||t.lt(0)||e.lt(0)?silence$1:this._fastGap(fraction(1).div(e.sub(t)))._late(t)}_compressSpan(t){return this._compress(t.begin,t.end)}_focus(t,e){return this._fast(fraction(1).div(e.sub(t))).late(t.cyclePos())}_focusSpan(t){return this._focus(t.begin,t.end)}_fast(t){return this.withQueryTime(o=>o.mul(t)).withHapTime(o=>o.div(t))}_slow(t){return this._fast(fraction(1).div(t))}_inside(t,e){return e(this._slow(t))._fast(t)}_outside(t,e){return e(this._fast(t))._slow(t)}_ply(t){return this.fmap(e=>pure$1(e)._fast(t))._squeezeJoin()}_chop(t){const o=Array.from({length:t},(i,f)=>f).map(i=>({begin:i/t,end:(i+1)/t})),s=function(i){return sequence$1(o.map(f=>Object.assign({},i,f)))};return this._squeezeBind(s)}_striate(t){const o=Array.from({length:t},(i,f)=>f).map(i=>({begin:i/t,end:(i+1)/t})),s=slowcat$1(...o);return this.set(s)._fast(t)}_cpm(t){return this._fast(t/60)}_early(t){return t=fraction(t),this.withQueryTime(e=>e.add(t)).withHapTime(e=>e.sub(t))}_late(t){return t=fraction(t),this._early(fraction(0).sub(t))}_zoom(t,e){e=fraction(e),t=fraction(t);const o=e.sub(t);return this.withQuerySpan(s=>s.withCycle(i=>i.mul(o).add(t))).withHapSpan(s=>s.withCycle(i=>i.sub(t).div(o)))._splitQueries()}_zoomArc(t){return this.zoom(t.begin,t.end)}_linger(t){return t==0?silence$1:t<0?this._zoom(t.add(1),1)._slow(t):this._zoom(0,t)._slow(t)}_color(t){return this._withContext(e=>({...e,color:t}))}log(){return this._withHap(t=>{var e;return t.setContext({...t.context,logs:(((e=t.context)==null?void 0:e.logs)||[]).concat([t.show()])})})}drawLine(){return console.log(drawLine(this)),this}_segment(t){return this.struct(pure$1(!0)._fast(t))}invert(){return this.fmap(t=>!t)}inv(){return this.invert()}when(t,e){const o=t._filterValues(id),s=t._filterValues(l=>!l),i=o.fmap(l=>g=>g).appRight(e(this)),f=s.fmap(l=>g=>g).appRight(this);return stack$1(i,f)}off(t,e){return stack$1(this,e(this.late(t)))}every(t,e){const o=this,s=Array(t-1).fill(o);return s.push(e(o)),slowcatPrime(...s)}every(t,e){const o=this,s=Array(t-1).fill(o);return s.unshift(e(o)),slowcatPrime(...s)}each(t,e){const o=this,s=Array(t-1).fill(o);return s.push(e(o)),slowcatPrime(...s)}brak(){return this.when(slowcat$1(!1,!0),t=>fastcat(t,silence$1)._late(.25))}rev(){const t=this,e=function(o){const s=o.span,i=s.begin.sam(),f=s.begin.nextSam(),l=function(w){const y=w.withTime(S=>i.add(f.sub(S))),$=y.begin;return y.begin=y.end,y.end=$,y};return t.query(o.setSpan(l(s))).map(w=>w.withSpan(l))};return new Pattern$3(e)._splitQueries()}palindrome(){return this.every(2,rev)}juxBy(t,e){t/=2;const o=function(f,l,g){return l in f?f[l]:g},s=this.withValue(f=>Object.assign({},f,{pan:o(f,"pan",.5)-t})),i=this.withValue(f=>Object.assign({},f,{pan:o(f,"pan",.5)+t}));return stack$1(s,e(i))}_jux(t){return this.juxBy(1,t)}stack(...t){return stack$1(this,...t)}sequence(...t){return sequence$1(this,...t)}seq(...t){return sequence$1(this,...t)}cat(...t){return cat(this,...t)}fastcat(...t){return fastcat(this,...t)}slowcat(...t){return slowcat$1(this,...t)}superimpose(...t){return this.stack(...t.map(e=>e(this)))}stutWith(t,e,o){return stack$1(...listRange(0,t-1).map(s=>o(this.late(fraction(e).mul(s)),s)))}stut(t,e,o){return this.stutWith(t,o,(s,i)=>s.velocity(Math.pow(e,i)))}_echoWith(t,e,o){return stack$1(...listRange(0,t-1).map(s=>o(this.late(fraction(e).mul(s)),s)))}_echo(t,e,o){return this._echoWith(t,e,(s,i)=>s.velocity(Math.pow(o,i)))}iter(t,e=!1){return slowcat$1(...listRange(0,t-1).map(o=>e?this.late(o/t):this.early(o/t)))}iterBack(t){return this.iter(t,!0)}_chunk(t,e,o=!1){const s=Array(t-1).fill(!1);s.unshift(!0);const i=sequence$1(...s).iter(t,o);return this.when(i,e)}_chunkBack(t,e){return this._chunk(t,e,!0)}_bypass(t){return t=Boolean(parseInt(t)),t?silence$1:this}hush(){return silence$1}_duration(t){return this.withHapSpan(e=>new TimeSpan(e.begin,e.begin.add(t)))}_legato(t){return this.withHapSpan(e=>new TimeSpan(e.begin,e.begin.add(e.end.sub(e.begin).mul(t))))}_velocity(t){return this._withContext(e=>({...e,velocity:(e.velocity||1)*t}))}_loopAt(t,e=1){return this.speed(1/t*e).unit("c").slow(t)}onTrigger(t){return this._withHap(e=>e.setContext({...e.context,onTrigger:t}))}log(t=id){return this._withHap(e=>e.setContext({...e.context,onTrigger:(...o)=>{e.context.onTrigger&&e.context.onTrigger(...o),console.log(t(...o))}}))}logValues(t=id){return this.log((e,o)=>t(o.value))}}function _composeOp(r,t,e){function o(s){return s instanceof Object&&!(s instanceof Function)}return o(r)||o(t)?(o(r)||(r={value:r}),o(t)||(t={value:t}),unionWithObj(r,t,e)):e(r,t)}(function(){const r={set:[(t,e)=>e],keep:[(t,e)=>t],keepif:[(t,e)=>e?t:void 0],add:[numeralArgs((t,e)=>t+e)],sub:[numeralArgs((t,e)=>t-e)],mul:[numeralArgs((t,e)=>t*e)],div:[numeralArgs((t,e)=>t/e)],mod:[numeralArgs(mod)],pow:[numeralArgs(Math.pow)],_and:[numeralArgs((t,e)=>t&e)],_or:[numeralArgs((t,e)=>t|e)],_xor:[numeralArgs((t,e)=>t^e)],_lshift:[numeralArgs((t,e)=>t<t>>e)],lt:[(t,e)=>tt>e],lte:[(t,e)=>t<=e],gte:[(t,e)=>t>=e],eq:[(t,e)=>t==e],eqt:[(t,e)=>t===e],ne:[(t,e)=>t!=e],net:[(t,e)=>t!==e],and:[(t,e)=>t&&e],or:[(t,e)=>t||e],func:[(t,e)=>e(t)]};for(const[t,[e,o]]of Object.entries(r))for(const s of["In","Out","Mix","Squeeze","SqueezeOut","Trig","Trigzero"])Pattern$3.prototype[t+s]=function(...i){var f=this;i=sequence$1(i),o&&(f=o(f),i=o(i));var l;return t==="keepif"?(l=f["_op"+s](i,g=>w=>e(g,w)),l=l._removeUndefineds()):l=f["_op"+s](i,g=>w=>_composeOp(g,w,e)),l},s==="Squeeze"&&(Pattern$3.prototype[t+"SqueezeIn"]=Pattern$3.prototype[t+s]),s==="In"?Pattern$3.prototype[t]=Pattern$3.prototype[t+s]:t==="set"&&(Pattern$3.prototype[s.toLowerCase()]=Pattern$3.prototype[t+s]);Pattern$3.prototype.struct=Pattern$3.prototype.keepifOut,Pattern$3.prototype.structAll=Pattern$3.prototype.keepOut,Pattern$3.prototype.mask=Pattern$3.prototype.keepifIn,Pattern$3.prototype.maskAll=Pattern$3.prototype.keepIn,Pattern$3.prototype.reset=Pattern$3.prototype.keepifTrig,Pattern$3.prototype.resetAll=Pattern$3.prototype.keepTrig,Pattern$3.prototype.restart=Pattern$3.prototype.keepifTrigzero,Pattern$3.prototype.restartAll=Pattern$3.prototype.keepTrigzero})();Pattern$3.prototype.patternified=["apply","chop","color","cpm","duration","early","fast","jux","late","legato","linger","ply","segment","striate","slow","velocity"];const polyrhythm=stack$1,pr=stack$1;Pattern$3.prototype.factories={pure:pure$1,stack:stack$1,slowcat:slowcat$1,fastcat,cat,timeCat:timeCat$1,sequence:sequence$1,seq,polymeter,pm,polyrhythm,pr};const silence$1=new Pattern$3(r=>[]);function pure$1(r){function t(e){return e.span.spanCycles.map(o=>new Hap(fraction(o.begin).wholeCycle(),o,r))}return new Pattern$3(t)}function isPattern$1(r){const t=r instanceof Pattern$3||(r==null?void 0:r._Pattern);return!r instanceof Pattern$3&&console.warn(`Found Pattern that fails "instanceof Pattern" check. + This may happen if you are using multiple versions of @strudel.cycles/core. + Please check by running "npm ls @strudel.cycles/core".`),t}function reify$2(r){return isPattern$1(r)?r:stringParser&&typeof r=="string"?stringParser(r):pure$1(r)}function stack$1(...r){r=r.map(e=>Array.isArray(e)?sequence$1(...e):reify$2(e));const t=e=>flatten(r.map(o=>o.query(e)));return new Pattern$3(t)}function slowcat$1(...r){r=r.map(e=>Array.isArray(e)?sequence$1(...e):reify$2(e));const t=function(e){const o=e.span,s=mod(o.begin.sam(),r.length),i=r[s];if(!i)return[];const f=o.begin.floor().sub(o.begin.div(r.length).floor());return i.withHapTime(l=>l.add(f)).query(e.setSpan(o.withTime(l=>l.sub(f))))};return new Pattern$3(t)._splitQueries()}function slowcatPrime(...r){r=r.map(reify$2);const t=function(e){const o=Math.floor(e.span.begin)%r.length,s=r[o];return(s==null?void 0:s.query(e))||[]};return new Pattern$3(t)._splitQueries()}function fastcat(...r){return slowcat$1(...r)._fast(r.length)}function cat(...r){return slowcat$1(...r)}function timeCat$1(...r){const t=r.map(s=>s[0]).reduce((s,i)=>s.add(i),fraction(0));let e=fraction(0);const o=[];for(const[s,i]of r){const f=e.add(s);o.push(reify$2(i)._compress(e.div(t),f.div(t))),e=f}return stack$1(...o)}function sequence$1(...r){return fastcat(...r)}function seq(...r){return fastcat(...r)}function _sequenceCount(r){return Array.isArray(r)?r.length==0?[silence$1,0]:r.length==1?_sequenceCount(r[0]):[fastcat(...r.map(t=>_sequenceCount(t)[0])),r.length]:[reify$2(r),1]}function polymeterSteps(r,...t){const e=t.map(s=>_sequenceCount(s));if(e.length==0)return silence$1;r==0&&(r=e[0][1]);const o=[];for(const s of e)s[1]==0&&next,r==s[1]?o.push(s[0]):o.push(s[0]._fast(fraction(r).div(fraction(s[1]))));return stack$1(...o)}function polymeter(...r){return polymeterSteps(0,...r)}function pm(...r){polymeter(...r)}const add=curry((r,t)=>t.add(r)),chop=curry((r,t)=>t.chop(r)),chunk=curry((r,t)=>t.chunk(r)),chunkBack=curry((r,t)=>t.chunkBack(r)),div=curry((r,t)=>t.div(r)),early=curry((r,t)=>t.early(r)),echo=curry((r,t,e,o)=>o.echo(r,t,e)),every=curry((r,t,e)=>e.every(r,t)),fast=curry((r,t)=>t.fast(r)),inv=r=>r.inv(),invert=r=>r.invert(),iter=curry((r,t)=>t.iter(r)),iterBack=curry((r,t)=>t.iter(r)),jux=curry((r,t)=>t.jux(r)),juxBy=curry((r,t,e)=>e.juxBy(r,t)),late=curry((r,t)=>t.late(r)),linger=curry((r,t)=>t.linger(r)),mask=curry((r,t)=>t.mask(r)),mul=curry((r,t)=>t.mul(r)),off=curry((r,t,e)=>e.off(r,t)),ply=curry((r,t)=>t.ply(r)),range=curry((r,t,e)=>e.range(r,t)),rangex=curry((r,t,e)=>e.rangex(r,t)),range2=curry((r,t,e)=>e.range2(r,t)),rev=r=>r.rev(),slow=curry((r,t)=>t.slow(r)),struct=curry((r,t)=>t.struct(r)),sub=curry((r,t)=>t.sub(r)),superimpose=curry((r,t)=>t.superimpose(...r)),set=curry((r,t)=>t.set(r)),when=curry((r,t,e)=>e.when(r,t));Pattern$3.prototype.composable={fast,slow,early,late,superimpose};function makeComposable(r){return Object.entries(Pattern$3.prototype.composable).forEach(([t,e])=>{r[t]=(...o)=>{const s=compose(r,e(...o));return makeComposable(s)}}),r}const patternify2=r=>(t,e,o)=>t.fmap(s=>i=>r.call(o,s,i)).appLeft(e).innerJoin(),patternify3=r=>(t,e,o,s)=>t.fmap(i=>f=>l=>r.call(s,i,f,l)).appLeft(e).appLeft(o).innerJoin(),patternify4=r=>(t,e,o,s,i)=>t.fmap(f=>l=>g=>w=>r.call(i,f,l,g,w)).appLeft(e).appLeft(o).appLeft(s).innerJoin();Pattern$3.prototype.echo=function(...r){return r=r.map(reify$2),patternify3(Pattern$3.prototype._echo)(...r,this)};Pattern$3.prototype.echoWith=function(...r){return r=r.map(reify$2),patternify3(Pattern$3.prototype._echoWith)(...r,this)};Pattern$3.prototype.chunk=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._chunk)(...r,this)};Pattern$3.prototype.chunkBack=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._chunkBack)(...r,this)};Pattern$3.prototype.loopAt=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._loopAt)(...r,this)};Pattern$3.prototype.zoom=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._zoom)(...r,this)};Pattern$3.prototype.compress=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._compress)(...r,this)};Pattern$3.prototype.outside=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._outside)(...r,this)};Pattern$3.prototype.inside=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._inside)(...r,this)};Pattern$3.prototype.range=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._range)(...r,this)};Pattern$3.prototype.rangex=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._rangex)(...r,this)};Pattern$3.prototype.range2=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._range2)(...r,this)};Pattern$3.prototype.bootstrap=function(){const r=Object.fromEntries(Object.entries(Pattern$3.prototype.composable).map(([t,e])=>(Pattern$3.prototype[t]&&(Pattern$3.prototype[t]=makeComposable(Pattern$3.prototype[t])),[t,curry(e,makeComposable)])));return this.patternified.forEach(t=>{Pattern$3.prototype[t]=function(...e){return this._patternify(Pattern$3.prototype["_"+t])(...e)}}),r};Pattern$3.prototype.define=(r,t,e={})=>{e.composable&&(Pattern$3.prototype.composable[r]=t),e.patternified&&(Pattern$3.prototype.patternified=Pattern$3.prototype.patternified.concat([r])),Pattern$3.prototype.bootstrap()};Pattern$3.prototype.define("hush",r=>r.hush(),{patternified:!1,composable:!0});Pattern$3.prototype.define("bypass",r=>r.bypass(on),{patternified:!0,composable:!0});const controls={},generic_params=[["s","s","sound"],["f","n","The note or sample number to choose for a synth or sampleset"],["f","note","The note or pitch to play a sound or synth with"],["f","accelerate","a pattern of numbers that speed up (or slow down) samples while they play."],["f","gain","a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder. For the linear equivalent, see @amp@."],["f","amp","like @gain@, but linear."],["f","attack","a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample."],["f","bank","selects sound bank to use"],["f","decay",""],["f","sustain",""],["f","release","a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample."],["f","hold","a pattern of numbers to specify the hold time (in seconds) of an envelope applied to each sample. Only takes effect if `attack` and `release` are also specified."],["f","bandf","A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter."],["f","bandq","a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter."],["f","begin","a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample."],["f","end","the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample."],["f","loop","loops the sample (from `begin` to `end`) the specified number of times."],["f","legato","controls the amount of overlap between two adjacent sounds"],["f","crush","bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction)."],["f","coarse","fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on."],["i","channel","choose the channel the pattern is sent to in superdirt"],["i","cut","In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open."],["f","cutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter."],["f","hcutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@"],["f","hresonance","a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@"],["f","resonance","a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter."],["f","djf","DJ filter, below 0.5 is low pass filter, above is high pass filter."],["f","delay","a pattern of numbers from 0 to 1. Sets the level of the delay signal."],["f","delayfeedback","a pattern of numbers from 0 to 1. Sets the amount of delay feedback."],["f","delaytime","a pattern of numbers from 0 to 1. Sets the length of the delay."],["f","lock","A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle."],["f","detune",""],["f","dry","when set to `1` will disable all reverb for this pattern. See `room` and `size` for more information about reverb."],["f","fadeTime","Used when using begin/end or chop/striate and friends, to change the fade out time of the 'grain' envelope."],["f","fadeInTime","As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample."],["f","freq",""],["f","gate",""],["f","leslie",""],["f","lrate",""],["f","lsize",""],["f","degree",""],["f","mtranspose",""],["f","ctranspose",""],["f","harmonic",""],["f","stepsPerOctave",""],["f","octaveR",""],["f","nudge","Nudges events into the future by the specified number of seconds. Negative numbers work up to a point as well (due to internal latency)"],["i","octave",""],["f","offset",""],["i","orbit","a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around."],["f","overgain",""],["f","overshape",""],["f","pan","a pattern of numbers between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)"],["f","panspan","a pattern of numbers between -inf and inf, which controls how much multichannel output is fanned out (negative is backwards ordering)"],["f","pansplay","a pattern of numbers between 0.0 and 1.0, which controls the multichannel spread range (multichannel only)"],["f","panwidth","a pattern of numbers between 0.0 and inf, which controls how much each channel is distributed over neighbours (multichannel only)"],["f","panorient","a pattern of numbers between -1.0 and 1.0, which controls the relative position of the centre pan in a pair of adjacent speakers (multichannel only)"],["f","rate","used in SuperDirt softsynths as a control rate or 'speed'"],["f","slide",""],["f","semitone",""],["f","velocity",""],["f","voice",""],["f","room","a pattern of numbers from 0 to 1. Sets the level of reverb."],["f","size","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","roomsize","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","shape","wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion."],["f","speed","a pattern of numbers which changes the speed of sample playback, i.e. a cheap way of changing pitch. Negative values will play the sample backwards!"],["s","unit",'used in conjunction with `speed`, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.'],["f","squiz",""],["f","stutterdepth",""],["f","stuttertime",""],["f","timescale",""],["f","timescalewin",""],["s","vowel","formant filter to make things sound like vowels, a pattern of either `a`, `e`, `i`, `o` or `u`. Use a rest (`~`) for no effect."],["f","waveloss",""],["f","dur",""],["f","expression",""],["f","sustainpedal",""],["f","tremolodepth","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","tremolorate","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","phaserdepth","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","phaserrate","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","fshift","frequency shifter"],["f","fshiftnote","frequency shifter"],["f","fshiftphase","frequency shifter"],["f","triode","tube distortion"],["f","krush","shape/bass enhancer"],["f","kcutoff",""],["f","octer","octaver effect"],["f","octersub","octaver effect"],["f","octersubsub","octaver effect"],["f","ring","ring modulation"],["f","ringf","ring modulation"],["f","ringdf","ring modulation"],["f","distort","noisy fuzzy distortion"],["f","freeze","Spectral freeze"],["f","xsdelay",""],["f","tsdelay",""],["f","real","Spectral conform"],["f","imag",""],["f","enhance","Spectral enhance"],["f","partials",""],["f","comb","Spectral comb"],["f","smear","Spectral smear"],["f","scram","Spectral scramble"],["f","binshift","Spectral binshift"],["f","hbrick","High pass sort of spectral filter"],["f","lbrick","Low pass sort of spectral filter"],["f","midichan",""],["f","control",""],["f","ccn",""],["f","ccv",""],["f","polyTouch",""],["f","midibend",""],["f","miditouch",""],["f","ctlNum",""],["f","frameRate",""],["f","frames",""],["f","hours",""],["s","midicmd",""],["f","minutes",""],["f","progNum",""],["f","seconds",""],["f","songPtr",""],["f","uid",""],["f","val",""],["f","cps",""],["f","clip",""]],_name=(r,...t)=>sequence$1(...t).withValue(e=>({[r]:e})),_setter=(r,t)=>function(...e){return e.length?this.set(r(...e)):this.fmap(o=>({[t]:o}))};generic_params.forEach(([r,t,e])=>{controls[t]=(...o)=>_name(t,...o),Pattern$3.prototype[t]=_setter(controls[t],t)});controls.createParam=r=>{const t=(...e)=>_name(r,...e);return Pattern$3.prototype[r]=_setter(t,r),(...e)=>_name(r,...e)};controls.createParams=(...r)=>r.reduce((t,e)=>Object.assign(t,{[e]:createParam(e)}),{});function bjorklund(r,t){for(var e=[],o=[],s=[t],i=r-t,f=0,l=function(g){if(g==-1)e.push(0);else if(g==-2)e.push(1);else{for(var w=0;w1;)o.push(Math.floor(i/s[f])),s.push(i%s[f]),i=s[f],f++;return o.push(i),l(f),e.reverse()}var bjork=function(r,t){return r>t?bjorklund(r,t):bjorklund(t,r)};const euclid=(r,t,e=0)=>{const o=bjork(t,r);return e?rotate(o,-e):o};Pattern$3.prototype.euclid=function(r,t,e=0){return this.struct(euclid(r,t,e))};Pattern$3.prototype.euclidLegato=function(r,t,e=0){const o=euclid(r,t,e),s=o.indexOf(1),i=rotate(o,s).join("").split("1").slice(1).map(f=>[f.length+1,!0]);return this.struct(timeCat$1(...i)).late(fraction(s).div(t))};function steady(r){return new Pattern$3(t=>[new Hap(void 0,t.span,r)])}const signal=r=>{const t=e=>[new Hap(void 0,e.span,r(e.span.midpoint()))];return new Pattern$3(t)},isaw=signal(r=>1-r%1),isaw2=isaw._toBipolar(),saw=signal(r=>r%1),saw2=saw._toBipolar(),sine2=signal(r=>Math.sin(Math.PI*2*r)),sine=sine2._fromBipolar(),cosine=sine._early(fraction(1).div(4)),cosine2=sine2._early(fraction(1).div(4)),square=signal(r=>Math.floor(r*2%2)),square2=square._toBipolar(),tri=fastcat(isaw,saw),tri2=fastcat(isaw2,saw2),time=signal(id),xorwise=r=>{const t=r<<13^r,e=t>>17^t;return e<<5^e},_frac=r=>r-Math.trunc(r),timeToIntSeed=r=>xorwise(Math.trunc(_frac(r/300)*536870912)),intSeedToRand=r=>r%536870912/536870912,timeToRand=r=>Math.abs(intSeedToRand(timeToIntSeed(r))),rand=signal(timeToRand),rand2=rand._toBipolar(),_brandBy=r=>rand.fmap(t=>treify$2(r).fmap(_brandBy).innerJoin(),brand=_brandBy(.5),_irand=r=>rand.fmap(t=>Math.trunc(t*r)),irand=r=>reify$2(r).fmap(_irand).innerJoin(),__chooseWith=(r,t)=>(t=t.map(reify$2),t.length==0?silence$1:r.range(0,t.length).fmap(e=>t[Math.floor(e)])),chooseWith=(r,t)=>__chooseWith(r,t).outerJoin(),chooseInWith=(r,t)=>__chooseWith(r,t).innerJoin(),choose=(...r)=>chooseWith(rand,r);Pattern$3.prototype.choose=function(...r){return chooseWith(this,r)};Pattern$3.prototype.choose2=function(...r){return chooseWith(this._fromBipolar(),r)};const chooseCycles=(...r)=>chooseInWith(rand.segment(1),r),randcat=chooseCycles,_wchooseWith=function(r,...t){const e=t.map(l=>reify$2(l[0])),o=[];let s=0;for(const l of t)s+=l[1],o.push(s);const i=s,f=function(l){const g=l*i;return e[o.findIndex(w=>w>g,o)]};return r.fmap(f)},wchooseWith=(...r)=>_wchooseWith(...r).outerJoin(),wchoose=(...r)=>wchooseWith(rand,...r),wchooseCycles=(...r)=>_wchooseWith(rand,...r).innerJoin(),perlinWith=r=>{const t=r.fmap(Math.floor),e=r.fmap(i=>Math.floor(i)+1),o=i=>6*i**5-15*i**4+10*i**3,s=i=>f=>l=>f+o(i)*(l-f);return r.sub(t).fmap(s).appBoth(t.fmap(timeToRand)).appBoth(e.fmap(timeToRand))},perlin=perlinWith(time.fmap(r=>Number(r)));Pattern$3.prototype._degradeByWith=function(r,t){return this.fmap(e=>o=>e).appLeft(r._filterValues(e=>e>t))};Pattern$3.prototype._degradeBy=function(r){return this._degradeByWith(rand,r)};Pattern$3.prototype.degrade=function(){return this._degradeBy(.5)};Pattern$3.prototype._undegradeBy=function(r){return this._degradeByWith(rand.fmap(t=>1-t),r)};Pattern$3.prototype.undegrade=function(){return this._undegradeBy(.5)};Pattern$3.prototype._sometimesBy=function(r,t){return stack$1(this._degradeBy(r),t(this._undegradeBy(1-r)))};Pattern$3.prototype.sometimesBy=function(r,t){const e=this;return reify$2(r).fmap(o=>e._sometimesBy(o,t)).innerJoin()};Pattern$3.prototype._sometimesByPre=function(r,t){return stack$1(this._degradeBy(r),t(this).undegradeBy(1-r))};Pattern$3.prototype.sometimesByPre=function(r,t){const e=this;return reify$2(r).fmap(o=>e._sometimesByPre(o,t)).innerJoin()};Pattern$3.prototype.sometimes=function(r){return this._sometimesBy(.5,r)};Pattern$3.prototype.sometimesPre=function(r){return this._sometimesByPre(.5,r)};Pattern$3.prototype._someCyclesBy=function(r,t){return stack$1(this._degradeByWith(rand._segment(1),r),t(this._degradeByWith(rand.fmap(e=>1-e)._segment(1),1-r)))};Pattern$3.prototype.someCyclesBy=function(r,t){const e=this;return reify$2(r).fmap(o=>e._someCyclesBy(o,t)).innerJoin()};Pattern$3.prototype.someCycles=function(r){return this._someCyclesBy(.5,r)};Pattern$3.prototype.often=function(r){return this.sometimesBy(.75,r)};Pattern$3.prototype.rarely=function(r){return this.sometimesBy(.25,r)};Pattern$3.prototype.almostNever=function(r){return this.sometimesBy(.1,r)};Pattern$3.prototype.almostAlways=function(r){return this.sometimesBy(.9,r)};Pattern$3.prototype.never=function(r){return this};Pattern$3.prototype.always=function(r){return r(this)};Pattern$3.prototype.patternified.push("degradeBy","undegradeBy");let synth;try{synth=window==null?void 0:window.speechSynthesis}catch{console.warn("cannot use window: not in browser?")}let allVoices=synth==null?void 0:synth.getVoices();function speak(r,t,e){synth.cancel();const o=new SpeechSynthesisUtterance(r);o.lang=t,allVoices=synth.getVoices();const s=allVoices.filter(i=>i.lang.includes(t));typeof e=="number"?o.voice=s[e%s.length]:typeof e=="string"&&(o.voice=s.find(i=>i.name===i)),speechSynthesis.speak(o)}Pattern$3.prototype._speak=function(r,t){return this._withHap(e=>{const o=(s,i)=>{speak(i.value,r,t)};return e.setContext({...e.context,onTrigger:o})})};Pattern$3.prototype.speak=function(r,t){return patternify2(Pattern$3.prototype._speak)(reify(r),reify(t),this)};const{isPattern,Pattern:Pattern$2}=strudel;let scoped=!1;const evalScope=async(...r)=>{scoped&&console.warn("evalScope was called more than once."),scoped=!0;const t=await Promise.allSettled(r),e=t.filter(o=>o.status==="fulfilled").map(o=>o.value);t.forEach((o,s)=>{o.status==="rejected"&&console.warn(`evalScope: module with index ${s} could not be loaded:`,o.reason)}),Object.assign(globalThis,...e,Pattern$2.prototype.bootstrap())};function safeEval(r,t={}){const{wrapExpression:e=!0,wrapAsync:o=!0}=t;e&&(r=`{${r}}`),o&&(r=`(async ()=>${r})()`);const s=`"use strict";return (${r})`;return Function(s)()}const evaluate$1=async(r,t)=>{scoped||await evalScope(),t&&(r=t(r));let o=await safeEval(r,{wrapExpression:!!t});if(!isPattern(o)){console.log("evaluated",o);const s=`got "${typeof o}" instead of pattern`;throw new Error(s+(typeof o=="function"?", did you forget to call a function?":"."))}return{mode:"javascript",pattern:o}};function createClock(r,t,e=.05,o=.1,s=.1){let i=0,f=0,l=10**4,g=.01;const w=b=>e=b(e);s=s||o/2;const y=()=>{const b=r(),I=b+o+s;for(f===0&&(f=b+g);f=b&&t(f,e,i),f{y(),$=setInterval(y,o*1e3)},C=()=>clearInterval($);return{setDuration:w,start:S,stop:()=>{i=0,f=0,C()},pause:()=>C(),duration:e,getPhase:()=>f}}class Cyclist{constructor({interval:t,onTrigger:e,onError:o,getTime:s,latency:i=.1}){K(this,"worker");K(this,"pattern");K(this,"started",!1);K(this,"cps",1);K(this,"getTime");K(this,"phase",0);this.getTime=s;const f=l=>Math.round(l*1e3)/1e3;this.clock=createClock(s,(l,g,w)=>{w===0&&(this.origin=l);const y=f(l-this.origin);this.phase=y-i;const $=f(y+g),S=s();try{this.pattern.queryArc(y,$).forEach(p=>{if(p.part.begin.equals(p.whole.begin)){const d=p.whole.begin+this.origin-S+i,m=p.duration*1;e==null||e(p,d,m)}})}catch(C){console.warn("scheduler error",C),o==null||o(C)}},t)}getPhase(){return this.phase}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.clock.start(),this.started=!0}pause(){this.clock.stop(),delete this.origin,this.started=!1}stop(){delete this.origin,this.clock.stop(),this.started=!1}setPattern(t,e=!1){this.pattern=t,e&&!this.started&&this.start()}setCps(t=1){this.cps=t}log(t,e,o){const s=o.filter(i=>i.hasOnset());console.log(`${t.toFixed(4)} - ${e.toFixed(4)} ${Array(s.length).fill("I").join("")}`)}}function repl({interval:r,defaultOutput:t,onSchedulerError:e,onEvalError:o,onEval:s,getTime:i,transpiler:f}){const l=new Cyclist({interval:r,onTrigger:t,onError:e,getTime:i});return{scheduler:l,evaluate:async w=>{if(!w)throw new Error("no code to evaluate");try{const{pattern:y}=await evaluate$1(w,f);l.setPattern(y,!0),s==null||s({pattern:y,code:w})}catch(y){console.warn(`eval error: ${y.message}`),o==null||o(y)}}}}const gist=(route,cache=!0)=>fetch(`https://gist.githubusercontent.com/${route}?cachebust=${cache?"":Date.now()}`).then(r=>r.text()).then(code=>eval(code));console.log("%c // \u{1F300} @strudel.cycles/core loaded \u{1F300}","background-color: black;color:white;padding:4px;border-radius:15px");globalThis._strudelLoaded&&console.warn(`@strudel.cycles/core was loaded more than once... +This might happen when you have multiple versions of strudel installed. +Please check with "npm ls @strudel.cycles/core".`);globalThis._strudelLoaded=!0;function peg$subclass(r,t){function e(){this.constructor=r}e.prototype=t.prototype,r.prototype=new e}function peg$SyntaxError(r,t,e,o){var s=Error.call(this,r);return Object.setPrototypeOf&&Object.setPrototypeOf(s,peg$SyntaxError.prototype),s.expected=t,s.found=e,s.location=o,s.name="SyntaxError",s}peg$subclass(peg$SyntaxError,Error);function peg$padEnd(r,t,e){return e=e||" ",r.length>t?r:(t-=r.length,e+=e.repeat(t),r+e.slice(0,t))}peg$SyntaxError.prototype.format=function(r){var t="Error: "+this.message;if(this.location){var e=null,o;for(o=0;o `+i+` +`+l+` | +`+s.line+" | "+g+` +`+l+" | "+peg$padEnd("",s.column-1," ")+peg$padEnd("",y,"^")}else t+=` + at `+i}return t};peg$SyntaxError.buildMessage=function(r,t){var e={literal:function(w){return'"'+s(w.text)+'"'},class:function(w){var y=w.parts.map(function($){return Array.isArray($)?i($[0])+"-"+i($[1]):i($)});return"["+(w.inverted?"^":"")+y.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(w){return w.description}};function o(w){return w.charCodeAt(0).toString(16).toUpperCase()}function s(w){return w.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(y){return"\\x0"+o(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+o(y)})}function i(w){return w.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(y){return"\\x0"+o(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+o(y)})}function f(w){return e[w.type](w)}function l(w){var y=w.map(f),$,S;if(y.sort(),y.length>0){for($=1,S=1;$",D="@",W="!",P="(",B=")",z="/",O="*",Z="%",L="?",fe="struct",we="target",be="euclid",te="slow",le="rotL",pe="rotR",he="fast",ve="scale",de="//",$e="cat",F="$",Q="setcps",ge="setbpm",me="hush",M=/^[1-9]/,U=/^[eE]/,ye=/^[0-9]/,J=/^[ \n\r\t]/,ee=/^[0-9a-zA-Z~]/,R=/^[^\n]/,X=He("number"),re=x(".",!1),Pe=ne([["1","9"]],!1,!1),Be=ne(["e","E"],!1,!1),Te=x("-",!1),Ze=x("+",!1),Le=x("0",!1),Je=ne([["0","9"]],!1,!1),Ke=He("whitespace"),Ge=ne([" ",` +`,"\r"," "],!1,!1),Ye=x(",",!1),Qe=x("|",!1),Ue=x('"',!1),et=x("'",!1),tt=ne([["0","9"],["a","z"],["A","Z"],"~"],!1,!1),rt=x("#",!1),nt=x("^",!1),st=x("_",!1),ot=x(":",!1),Re=x("[",!1),je=x("]",!1),it=x("<",!1),at=x(">",!1),ct=x("@",!1),ut=x("!",!1),ft=x("(",!1),lt=x(")",!1),pt=x("/",!1),ht=x("*",!1),dt=x("%",!1),gt=x("?",!1),mt=x("struct",!1),yt=x("target",!1),wt=x("euclid",!1),bt=x("slow",!1),vt=x("rotL",!1),$t=x("rotR",!1),_t=x("fast",!1),Ct=x("scale",!1),At=x("//",!1),Fe=ne([` +`],!0,!1),It=x("cat",!1),Pt=x("$",!1),Bt=x("setcps",!1),St=x("setbpm",!1),kt=x("hush",!1),Nt=function(){return parseFloat(ur())},xt=function(n){return n.join("")},qt=function(n){return n},Tt=function(n){return n.arguments_.alignment="t",n},Gt=function(n){return{weight:n}},Rt=function(n){return{replicate:n}},jt=function(n,c,u){return{operator:{type_:"bjorklund",arguments_:{pulse:n,step:c,rotation:u||0}}}},Ft=function(n){return{operator:{type_:"stretch",arguments_:{amount:n}}}},Mt=function(n){return{operator:{type_:"stretch",arguments_:{amount:"1/"+n}}}},Ht=function(n){return{operator:{type_:"fixed-step",arguments_:{amount:n}}}},Ot=function(n){return{operator:{type_:"degradeBy",arguments_:{amount:n||.5}}}},Wt=function(n,c){return new en(n,c)},Vt=function(n){return new xe(n,"h")},zt=function(n){return{alignment:"v",list:n}},Xt=function(n){return{alignment:"r",list:n}},Et=function(n,c){return c&&c.list.length>0?new xe([n,...c.list],c.alignment):n},Dt=function(n){return n},Zt=function(n){return{name:"struct",args:{sequence:n}}},Lt=function(n){return{name:"target",args:{name:n}}},Jt=function(n,c,u){return{name:"bjorklund",args:{pulse:parseInt(n),step:parseInt(c)}}},Kt=function(n){return{name:"stretch",args:{amount:n}}},Yt=function(n){return{name:"shift",args:{amount:"-"+n}}},Qt=function(n){return{name:"shift",args:{amount:n}}},Ut=function(n){return{name:"stretch",args:{amount:"1/"+n}}},er=function(n){return{name:"scale",args:{scale:n.join("")}}},Me=function(n,c){return c},tr=function(n,c){return c.unshift(n),new xe(c,"t")},rr=function(n){return n},nr=function(n,c){return new Ur(n.name,n.args,c)},sr=function(n){return n},or=function(n){return n},ir=function(n){return new qe("setcps",{value:n})},ar=function(n){return new qe("setcps",{value:n/120/2})},cr=function(){return new qe("hush")},a=0,q=0,_e=[{line:1,column:1}],E=0,Se=[],_=0,Ce;if("startRule"in t){if(!(t.startRule in s))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');i=s[t.startRule]}function ur(){return r.substring(q,a)}function fr(){return ke(q,a)}function x(n,c){return{type:"literal",text:n,ignoreCase:c}}function ne(n,c,u){return{type:"class",parts:n,inverted:c,ignoreCase:u}}function lr(){return{type:"end"}}function He(n){return{type:"other",description:n}}function Oe(n){var c=_e[n],u;if(c)return c;for(u=n-1;!_e[u];)u--;for(c=_e[u],c={line:c.line,column:c.column};uE&&(E=a,Se=[]),Se.push(n))}function hr(n,c,u){return new peg$SyntaxError(peg$SyntaxError.buildMessage(n,c),n,c,u)}function We(){var n;return n=Qr(),n}function H(){var n,c;return _++,n=a,Ve(),c=Ae(),c!==e?(wr(),yr(),q=n,n=Nt()):(a=n,n=e),_--,n===e&&_===0&&A(X),n}function dr(){var n;return r.charCodeAt(a)===46?(n=f,a++):(n=e,_===0&&A(re)),n}function gr(){var n;return M.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(Pe)),n}function mr(){var n;return U.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(Be)),n}function yr(){var n,c,u,v,k;if(n=a,c=mr(),c!==e){if(u=Ve(),u===e&&(u=br()),u===e&&(u=null),v=[],k=se(),k!==e)for(;k!==e;)v.push(k),k=se();else v=e;v!==e?(c=[c,u,v],n=c):(a=n,n=e)}else a=n,n=e;return n}function wr(){var n,c,u,v;if(n=a,c=dr(),c!==e){if(u=[],v=se(),v!==e)for(;v!==e;)u.push(v),v=se();else u=e;u!==e?(c=[c,u],n=c):(a=n,n=e)}else a=n,n=e;return n}function Ae(){var n,c,u,v;if(n=vr(),n===e)if(n=a,c=gr(),c!==e){for(u=[],v=se();v!==e;)u.push(v),v=se();c=[c,u],n=c}else a=n,n=e;return n}function Ve(){var n;return r.charCodeAt(a)===45?(n=l,a++):(n=e,_===0&&A(Te)),n}function br(){var n;return r.charCodeAt(a)===43?(n=g,a++):(n=e,_===0&&A(Ze)),n}function vr(){var n;return r.charCodeAt(a)===48?(n=w,a++):(n=e,_===0&&A(Le)),n}function se(){var n;return ye.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(Je)),n}function N(){var n,c;for(_++,n=[],J.test(r.charAt(a))?(c=r.charAt(a),a++):(c=e,_===0&&A(Ge));c!==e;)n.push(c),J.test(r.charAt(a))?(c=r.charAt(a),a++):(c=e,_===0&&A(Ge));return _--,c=e,_===0&&A(Ke),n}function oe(){var n,c,u,v;return n=a,c=N(),r.charCodeAt(a)===44?(u=y,a++):(u=e,_===0&&A(Ye)),u!==e?(v=N(),c=[c,u,v],n=c):(a=n,n=e),n}function ze(){var n,c,u,v;return n=a,c=N(),r.charCodeAt(a)===124?(u=$,a++):(u=e,_===0&&A(Qe)),u!==e?(v=N(),c=[c,u,v],n=c):(a=n,n=e),n}function ie(){var n;return r.charCodeAt(a)===34?(n=S,a++):(n=e,_===0&&A(Ue)),n===e&&(r.charCodeAt(a)===39?(n=C,a++):(n=e,_===0&&A(et))),n}function Ie(){var n;return ee.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(tt)),n===e&&(r.charCodeAt(a)===45?(n=l,a++):(n=e,_===0&&A(Te)),n===e&&(r.charCodeAt(a)===35?(n=p,a++):(n=e,_===0&&A(rt)),n===e&&(r.charCodeAt(a)===46?(n=f,a++):(n=e,_===0&&A(re)),n===e&&(r.charCodeAt(a)===94?(n=d,a++):(n=e,_===0&&A(nt)),n===e&&(r.charCodeAt(a)===95?(n=m,a++):(n=e,_===0&&A(st)),n===e&&(r.charCodeAt(a)===58?(n=b,a++):(n=e,_===0&&A(ot)))))))),n}function Xe(){var n,c,u;if(n=a,N(),c=[],u=Ie(),u!==e)for(;u!==e;)c.push(u),u=Ie();else c=e;return c!==e?(u=N(),q=n,n=xt(c)):(a=n,n=e),n}function $r(){var n,c,u,v;return n=a,N(),r.charCodeAt(a)===91?(c=I,a++):(c=e,_===0&&A(Re)),c!==e?(N(),u=De(),u!==e?(N(),r.charCodeAt(a)===93?(v=T,a++):(v=e,_===0&&A(je)),v!==e?(N(),q=n,n=qt(u)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function _r(){var n,c,u,v;return n=a,N(),r.charCodeAt(a)===60?(c=G,a++):(c=e,_===0&&A(it)),c!==e?(N(),u=ae(),u!==e?(N(),r.charCodeAt(a)===62?(v=Y,a++):(v=e,_===0&&A(at)),v!==e?(N(),q=n,n=Tt(u)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Cr(){var n;return n=Xe(),n===e&&(n=$r(),n===e&&(n=_r())),n}function Ar(){var n;return n=Ir(),n===e&&(n=Br(),n===e&&(n=Sr(),n===e&&(n=kr(),n===e&&(n=Nr(),n===e&&(n=Pr(),n===e&&(n=xr())))))),n}function Ir(){var n,c,u;return n=a,r.charCodeAt(a)===64?(c=D,a++):(c=e,_===0&&A(ct)),c!==e?(u=H(),u!==e?(q=n,n=Gt(u)):(a=n,n=e)):(a=n,n=e),n}function Pr(){var n,c,u;return n=a,r.charCodeAt(a)===33?(c=W,a++):(c=e,_===0&&A(ut)),c!==e?(u=H(),u!==e?(q=n,n=Rt(u)):(a=n,n=e)):(a=n,n=e),n}function Br(){var n,c,u,v,k,j,V;return n=a,r.charCodeAt(a)===40?(c=P,a++):(c=e,_===0&&A(ft)),c!==e?(N(),u=H(),u!==e?(N(),v=oe(),v!==e?(N(),k=H(),k!==e?(N(),oe(),N(),j=H(),j===e&&(j=null),N(),r.charCodeAt(a)===41?(V=B,a++):(V=e,_===0&&A(lt)),V!==e?(q=n,n=jt(u,k,j)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Sr(){var n,c,u;return n=a,r.charCodeAt(a)===47?(c=z,a++):(c=e,_===0&&A(pt)),c!==e?(u=H(),u!==e?(q=n,n=Ft(u)):(a=n,n=e)):(a=n,n=e),n}function kr(){var n,c,u;return n=a,r.charCodeAt(a)===42?(c=O,a++):(c=e,_===0&&A(ht)),c!==e?(u=H(),u!==e?(q=n,n=Mt(u)):(a=n,n=e)):(a=n,n=e),n}function Nr(){var n,c,u;return n=a,r.charCodeAt(a)===37?(c=Z,a++):(c=e,_===0&&A(dt)),c!==e?(u=H(),u!==e?(q=n,n=Ht(u)):(a=n,n=e)):(a=n,n=e),n}function xr(){var n,c,u;return n=a,r.charCodeAt(a)===63?(c=L,a++):(c=e,_===0&&A(gt)),c!==e?(u=H(),u===e&&(u=null),q=n,n=Ot(u)):(a=n,n=e),n}function Ee(){var n,c,u;return n=a,c=Cr(),c!==e?(u=Ar(),u===e&&(u=null),q=n,n=Wt(c,u)):(a=n,n=e),n}function ae(){var n,c,u;if(n=a,c=[],u=Ee(),u!==e)for(;u!==e;)c.push(u),u=Ee();else c=e;return c!==e&&(q=n,c=Vt(c)),n=c,n}function qr(){var n,c,u,v,k;if(n=a,c=[],u=a,v=oe(),v!==e?(k=ae(),k!==e?u=k:(a=u,u=e)):(a=u,u=e),u!==e)for(;u!==e;)c.push(u),u=a,v=oe(),v!==e?(k=ae(),k!==e?u=k:(a=u,u=e)):(a=u,u=e);else c=e;return c!==e&&(q=n,c=zt(c)),n=c,n}function Tr(){var n,c,u,v,k;if(n=a,c=[],u=a,v=ze(),v!==e?(k=ae(),k!==e?u=k:(a=u,u=e)):(a=u,u=e),u!==e)for(;u!==e;)c.push(u),u=a,v=ze(),v!==e?(k=ae(),k!==e?u=k:(a=u,u=e)):(a=u,u=e);else c=e;return c!==e&&(q=n,c=Xt(c)),n=c,n}function De(){var n,c,u;return n=a,c=ae(),c!==e?(u=qr(),u===e&&(u=Tr()),u===e&&(u=null),q=n,n=Et(c,u)):(a=n,n=e),n}function Gr(){var n,c,u,v;return n=a,N(),c=ie(),c!==e?(u=De(),u!==e?(v=ie(),v!==e?(q=n,n=Dt(u)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Rr(){var n;return n=zr(),n===e&&(n=Hr(),n===e&&(n=Vr(),n===e&&(n=Fr(),n===e&&(n=Mr(),n===e&&(n=jr(),n===e&&(n=Wr(),n===e&&(n=Or()))))))),n}function jr(){var n,c,u;return n=a,r.substr(a,6)===fe?(c=fe,a+=6):(c=e,_===0&&A(mt)),c!==e?(N(),u=ce(),u!==e?(q=n,n=Zt(u)):(a=n,n=e)):(a=n,n=e),n}function Fr(){var n,c,u,v,k;return n=a,r.substr(a,6)===we?(c=we,a+=6):(c=e,_===0&&A(yt)),c!==e?(N(),u=ie(),u!==e?(v=Xe(),v!==e?(k=ie(),k!==e?(q=n,n=Lt(v)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Mr(){var n,c,u,v;return n=a,r.substr(a,6)===be?(c=be,a+=6):(c=e,_===0&&A(wt)),c!==e?(N(),u=Ae(),u!==e?(N(),v=Ae(),v!==e?(N(),Ae(),q=n,n=Jt(u,v)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Hr(){var n,c,u;return n=a,r.substr(a,4)===te?(c=te,a+=4):(c=e,_===0&&A(bt)),c!==e?(N(),u=H(),u!==e?(q=n,n=Kt(u)):(a=n,n=e)):(a=n,n=e),n}function Or(){var n,c,u;return n=a,r.substr(a,4)===le?(c=le,a+=4):(c=e,_===0&&A(vt)),c!==e?(N(),u=H(),u!==e?(q=n,n=Yt(u)):(a=n,n=e)):(a=n,n=e),n}function Wr(){var n,c,u;return n=a,r.substr(a,4)===pe?(c=pe,a+=4):(c=e,_===0&&A($t)),c!==e?(N(),u=H(),u!==e?(q=n,n=Qt(u)):(a=n,n=e)):(a=n,n=e),n}function Vr(){var n,c,u;return n=a,r.substr(a,4)===he?(c=he,a+=4):(c=e,_===0&&A(_t)),c!==e?(N(),u=H(),u!==e?(q=n,n=Ut(u)):(a=n,n=e)):(a=n,n=e),n}function zr(){var n,c,u,v,k;if(n=a,r.substr(a,5)===ve?(c=ve,a+=5):(c=e,_===0&&A(Ct)),c!==e)if(N(),u=ie(),u!==e){if(v=[],k=Ie(),k!==e)for(;k!==e;)v.push(k),k=Ie();else v=e;v!==e?(k=ie(),k!==e?(q=n,n=er(v)):(a=n,n=e)):(a=n,n=e)}else a=n,n=e;else a=n,n=e;return n}function Ne(){var n,c,u,v;if(n=a,r.substr(a,2)===de?(c=de,a+=2):(c=e,_===0&&A(At)),c!==e){for(u=[],R.test(r.charAt(a))?(v=r.charAt(a),a++):(v=e,_===0&&A(Fe));v!==e;)u.push(v),R.test(r.charAt(a))?(v=r.charAt(a),a++):(v=e,_===0&&A(Fe));c=[c,u],n=c}else a=n,n=e;return n}function Xr(){var n,c,u,v,k,j,V,ue;if(n=a,r.substr(a,3)===$e?(c=$e,a+=3):(c=e,_===0&&A(It)),c!==e)if(N(),r.charCodeAt(a)===91?(u=I,a++):(u=e,_===0&&A(Re)),u!==e)if(N(),v=ce(),v!==e){for(k=[],j=a,V=oe(),V!==e?(ue=ce(),ue!==e?(q=j,j=Me(v,ue)):(a=j,j=e)):(a=j,j=e);j!==e;)k.push(j),j=a,V=oe(),V!==e?(ue=ce(),ue!==e?(q=j,j=Me(v,ue)):(a=j,j=e)):(a=j,j=e);j=N(),r.charCodeAt(a)===93?(V=T,a++):(V=e,_===0&&A(je)),V!==e?(q=n,n=tr(v,k)):(a=n,n=e)}else a=n,n=e;else a=n,n=e;else a=n,n=e;return n}function Er(){var n;return n=Xr(),n===e&&(n=Gr()),n}function ce(){var n,c,u,v,k;if(n=a,c=Er(),c!==e){for(N(),u=[],v=Ne();v!==e;)u.push(v),v=Ne();q=n,n=rr(c)}else a=n,n=e;return n===e&&(n=a,c=Rr(),c!==e?(N(),r.charCodeAt(a)===36?(u=F,a++):(u=e,_===0&&A(Pt)),u!==e?(v=N(),k=ce(),k!==e?(q=n,n=nr(c,k)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)),n}function Dr(){var n,c;return n=a,c=ce(),c!==e&&(q=n,c=sr(c)),n=c,n===e&&(n=Ne()),n}function Zr(){var n;return n=Dr(),n}function Lr(){var n,c;return n=a,N(),c=Jr(),c===e&&(c=Kr(),c===e&&(c=Yr())),c!==e?(N(),q=n,n=or(c)):(a=n,n=e),n}function Jr(){var n,c,u;return n=a,r.substr(a,6)===Q?(c=Q,a+=6):(c=e,_===0&&A(Bt)),c!==e?(N(),u=H(),u!==e?(q=n,n=ir(u)):(a=n,n=e)):(a=n,n=e),n}function Kr(){var n,c,u;return n=a,r.substr(a,6)===ge?(c=ge,a+=6):(c=e,_===0&&A(St)),c!==e?(N(),u=H(),u!==e?(q=n,n=ar(u)):(a=n,n=e)):(a=n,n=e),n}function Yr(){var n,c;return n=a,r.substr(a,4)===me?(c=me,a+=4):(c=e,_===0&&A(kt)),c!==e&&(q=n,c=cr()),n=c,n}function Qr(){var n;return n=Zr(),n===e&&(n=Lr()),n}var xe=function(n,c){this.type_="pattern",this.arguments_={alignment:c},this.source_=n},Ur=function(n,c,u){this.type_=n,this.arguments_=c,this.source_=u},en=function(n,c){this.type_="element",this.source_=n,this.options_=c,this.location_=fr()},qe=function(n,c){this.type_="command",this.name_=n,this.options_=c};if(Ce=i(),Ce!==e&&a===r.length)return Ce;throw Ce!==e&&a(t,e)=>{const s=r.source_[e].options_,i=s==null?void 0:s.operator;if(i){switch(i.type_){case"stretch":const l=Fraction(i.arguments_.amount).inverse();return reify$1(t).fast(l);case"bjorklund":return t.euclid(i.arguments_.pulse,i.arguments_.step,i.arguments_.rotation);case"degradeBy":return reify$1(t)._degradeByWith(rand.early(randOffset*_nextSeed()).segment(1),i.arguments_.amount)}console.warn(`operator "${i.type_}" not implemented`)}if(s!=null&&s.weight)return t;const f=Object.keys(s||{}).filter(l=>l!=="operator");return f.length&&console.warn(`option${f.length>1?"s":""} ${f.map(l=>`"${l}"`).join(", ")} not implemented`),t};function resolveReplications(r){r.source_=r.source_.map(t=>{const{replicate:e,...o}=t.options_||{};return e?{...t,options_:{...o,weight:e},source_:{type_:"pattern",arguments_:{alignment:"h"},source_:[{type_:"element",source_:t.source_,location_:t.location_,options_:{operator:{type_:"stretch",arguments_:{amount:Fraction(e).inverse().toString()}}}}]}}:t})}function patternifyAST(r){switch(r.type_){case"pattern":resolveReplications(r);const t=r.source_.map(patternifyAST).map(applyOptions(r)),e=r.arguments_.alignment;if(e==="v")return stack(...t);if(e==="r")return chooseInWith(rand.early(randOffset*_nextSeed()).segment(1),t);const o=r.source_.some(s=>{var i;return!!((i=s.options_)!=null&&i.weight)});if(!o&&e==="t")return slowcat(...t);if(o){const s=timeCat(...r.source_.map((i,f)=>{var l;return[((l=i.options_)==null?void 0:l.weight)||1,t[f]]}));if(e==="t"){const i=r.source_.reduce((f,l)=>{var g;return f+(((g=l.options_)==null?void 0:g.weight)||1)},0);return s._slow(i)}return s}return sequence(...t);case"element":if(r.source_==="~")return silence;if(typeof r.source_!="object"){if(!r.location_)return console.warn("no location for",r),r.source_;const{start:s,end:i}=r.location_,f=isNaN(Number(r.source_))?r.source_:Number(r.source_);return pure(f).withLocation([s.line,s.column,s.offset],[i.line,i.column,i.offset])}return patternifyAST(r.source_);case"stretch":return patternifyAST(r.source_).slow(r.arguments_.amount);default:return console.warn(`node type "${r.type_}" not implemented -> returning silence`),silence}}const mini=(...r)=>{const t=r.map(e=>{const o=peg$parse(`"${e}"`);return patternifyAST(o)});return sequence(...t)},h=r=>{const t=peg$parse(r);return patternifyAST(t)};Pattern$1.prototype.define("mini",mini,{composable:!0});Pattern$1.prototype.define("m",mini,{composable:!0});Pattern$1.prototype.define("h",h,{composable:!0});function minify(r){return typeof r=="string"?mini(r):reify$1(r)}if(typeof DelayNode<"u"){class r extends DelayNode{constructor(e,o,s,i){super(e),o=Math.abs(o),this.delayTime.value=s;const f=e.createGain();f.gain.value=Math.min(Math.abs(i),.995),this.feedback=f.gain;const l=e.createGain();return l.gain.value=o,this.delayGain=l,this.connect(f),this.connect(l),f.connect(this),this.connect=g=>l.connect(g),this}start(e){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,e+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(t,e,o){return new r(this,t,e,o)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(r,t=1){const e=this.sampleRate*r,o=this.createBuffer(t,e,this.sampleRate),s=o.getChannelData(0);for(let i=0;i(t.buffer=this.impulseResponse(e),t.duration=r,t),t.setDuration(r),t});const bufferCache={},loadCache={},getCachedBuffer=r=>bufferCache[r],loadBuffer=(r,t)=>(loadCache[r]||(loadCache[r]=fetch(r).then(e=>e.arrayBuffer()).then(async e=>{const o=await t.decodeAudioData(e);return bufferCache[r]=o,o})),loadCache[r]);function reverseBuffer(r){const t=getAudioContext(),e=t.createBuffer(r.numberOfChannels,r.length,t.sampleRate);for(let o=0;obufferCache[r],githubCache={};let sampleCache={current:void 0};const loadGithubSamples=async(r,t)=>{const e="loadGithubSamples "+r,o=localStorage.getItem(e);if(o&&(console.log("[sampler]: loaded sample list from localstorage",r),githubCache[r]=JSON.parse(o)),githubCache[r])return sampleCache.current=githubCache[r],githubCache[r];console.log("[sampler]: fetching sample list from github",r);try{const[s,i,...f]=r.split("/"),l=`https://api.github.com/repos/${s}/${i}/contents`,g=await fetch(`${l}/${f.join("/")}`).then(w=>w.json());githubCache[r]=(await Promise.all(g.map(async({name:w,path:y})=>({name:w,content:await fetch(`${l}/${y}`).then($=>$.json()).catch($=>{console.error("could not load path",$)})})))).filter(({content:w})=>!!w).reduce((w,{name:y,content:$})=>({...w,[(t==null?void 0:t(y))||y]:$.map(({download_url:S})=>S)}),{})}catch(s){console.error("[sampler]: failed to fetch sample list from github",s);return}return sampleCache.current=githubCache[r],localStorage.setItem(e,JSON.stringify(sampleCache.current)),console.log("[sampler]: loaded samples:",sampleCache.current),githubCache[r]},samples=async(r,t=r._base||"")=>{if(typeof r=="string"){if(r.startsWith("github:")){const[o,s]=r.split("github:");r=`https://raw.githubusercontent.com/${s}/strudel.json`}if(typeof fetch!="function")return;const e=r.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(r).then(o=>o.json()).then(o=>samples(o,t||o._base||e)).catch(o=>{throw console.error(o),new Error(`error loading "${r}"`)})}sampleCache.current={...sampleCache.current,...Object.fromEntries(Object.entries(r).map(([e,o])=>{if(typeof o=="string"&&(o=[o]),typeof o!="object")throw new Error("wrong sample map format for "+e);t=o._base||t;const s=i=>(t+i).replace("github:","https://raw.githubusercontent.com/");return Array.isArray(o)?[e,o.map(s)]:[e,Object.fromEntries(Object.entries(o).map(([i,f])=>[i,(typeof f=="string"?[f]:f).map(s)]))]}))}},resetLoadedSamples=()=>{sampleCache.current=void 0},getLoadedSamples$1=()=>sampleCache.current;var vowelFormant={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class r extends GainNode{constructor(e,o){if(super(e),!vowelFormant[o])throw new Error("vowel: unknown vowel "+o);const{gains:s,qs:i,freqs:f}=vowelFormant[o],l=e.createGain();for(let g=0;g<5;g++){const w=e.createGain();w.gain.value=s[g];const y=e.createBiquadFilter();y.type="bandpass",y.Q.value=i[g],y.frequency.value=f[g],this.connect(y),y.connect(w),w.connect(l)}return l.gain.value=8,this.connect=g=>l.connect(g),this}}AudioContext.prototype.createVowelFilter=function(t){return new r(this,t)}}const workletsUrl="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK",{Pattern}=strudel;let audioContext;const getAudioContext$1=()=>(audioContext||(audioContext=new AudioContext),audioContext);let destination;const getDestination=()=>{const r=getAudioContext$1();return destination||(destination=r.createGain(),destination.connect(r.destination)),destination},panic=()=>{getDestination().gain.linearRampToValueAtTime(0,getAudioContext$1().currentTime+.01),destination=null},getFilter=(r,t,e)=>{const o=getAudioContext$1().createBiquadFilter();return o.type=r,o.frequency.value=t,o.Q.value=e,o},getADSR=(r,t,e,o,s,i,f)=>{const l=getAudioContext$1().createGain();return l.gain.setValueAtTime(0,i),l.gain.linearRampToValueAtTime(s,i+r),l.gain.linearRampToValueAtTime(e*s,i+r+t),l.gain.setValueAtTime(e*s,f),l.gain.linearRampToValueAtTime(0,f+o),l},getOscillator=({s:r,freq:t,t:e,duration:o,release:s})=>{const i=getAudioContext$1().createOscillator();return i.type=r||"triangle",i.frequency.value=Number(t),i.start(e),i.stop(e+o+s),i},getSoundfontKey=r=>{var o,s,i,f;if(!globalThis.soundfontList)return!1;if((s=(o=globalThis.soundfontList)==null?void 0:o.instruments)!=null&&s.includes(r))return r;const t=(f=(i=globalThis.soundfontList)==null?void 0:i.instrumentNames)==null?void 0:f.indexOf(r),e=t<10?`00${t}`:t<100?`0${t}`:t;if(t!==-1)return globalThis.soundfontList.instruments.find(l=>l.startsWith(e))},getSampleBufferSource=async(r,t,e,o)=>{let s=0,i=typeof e=="string"?toMidi(e):e||36;s=i-36;const f=getAudioContext$1(),l=getLoadedSamples();if(!l)throw new Error("no samples loaded");const g=l==null?void 0:l[r];if(!g)throw new Error(`sample not found: "${r}", try one of ${Object.keys(l).map(C=>`"${C}"`).join(", ")}.`);if(typeof g!="object")throw new Error("wrong format for sample bank:",r);let w;if(Array.isArray(g))w=g[t%g.length];else{const C=d=>toMidi(d)-i,p=Object.keys(g).filter(d=>!d.startsWith("_")).reduce((d,m,b)=>!d||Math.abs(C(m)){if(!r.includes(":"))return[r,t];let[e,o]=r.split(":");return isNaN(Number(o))?[r,t]:[e,o]};let workletsLoading;function loadWorklets(){return workletsLoading||(workletsLoading=getAudioContext$1().audioWorklet.addModule(workletsUrl),workletsLoading)}function getWorklet(r,t,e){const o=new AudioWorkletNode(r,t);return Object.entries(e).forEach(([s,i])=>{o.parameters.get(s).value=i}),o}if(typeof window<"u")try{loadWorklets()}catch(r){console.warn("could not load AudioWorklet effects coarse, crush and shape",r)}function gainNode(r){const t=getAudioContext$1().createGain();return t.gain.value=r,t}const cutGroups=[];let delays={};function getDelay(r,t,e,o){if(!delays[r]){const i=getAudioContext$1().createFeedbackDelay(1,t,e);i.start(o),i.connect(getDestination()),delays[r]=i}return delays[r].delayTime.value!==t&&delays[r].delayTime.setValueAtTime(t,o),delays[r].feedback.value!==e&&delays[r].feedback.setValueAtTime(e,o),delays[r]}let reverbs={};function getReverb(r,t=2){if(!reverbs[r]){const o=getAudioContext$1().createReverb(t);o.connect(getDestination()),reverbs[r]=o}return reverbs[r].duration!==t&&(reverbs[r]=reverbs[r].setDuration(t),reverbs[r].duration=t),reverbs[r]}function effectSend(r,t,e){const o=gainNode(e);return r.connect(o),o.connect(t),o}const webaudioOutput=async(r,t,e)=>{var o;try{const s=getAudioContext$1();if(typeof r.value!="object")throw new Error(`hap.value ${r.value} is not supported by webaudio output. Hint: append .note() or .s() to the end`);let i=s.currentTime+t,{freq:f,s:l,bank:g,sf:w,clip:y=0,n:$=0,note:S,gain:C=.8,cutoff:p,resonance:d=1,hcutoff:m,hresonance:b=1,bandf:I,bandq:T=1,coarse:G,crush:Y,shape:D,pan:W,speed:P=1,begin:B=0,end:z=1,vowel:O,delay:Z=0,delayfeedback:L=.5,delaytime:fe=.25,unit:we,nudge:be=0,cut:te,loop:le,orbit:pe=1,room:he,size:ve=2,roomsize:de=ve}=r.value;const{velocity:$e=1}=r.context;C*=$e;const F=[];if(g&&l&&(l=`${g}_${l}`),typeof l=="string"&&([l,$]=splitSN(l,$)),typeof S=="string"&&([S,$]=splitSN(S,$)),!l||["sine","square","triangle","sawtooth"].includes(l)){const{attack:M=.001,decay:U=.05,sustain:ye=.6,release:J=.01}=r.value;$=S||$||36,typeof $=="string"&&($=toMidi($)),!f&&typeof $=="number"&&(f=fromMidi($));const ee=getOscillator({t:i,s:l,freq:f,duration:e,release:J});F.push(ee),F.push(gainNode(.3));const R=getADSR(M,U,ye,J,1,i,i+e);F.push(R)}else{const{attack:M=.001,decay:U=.001,sustain:ye=1,release:J=.001}=r.value;if(P===0)return;if(!l){console.warn("no sample specified");return}const ee=getSoundfontKey(l);let R;try{ee?R=await globalThis.getFontBufferSource(ee,S||$,s):R=await getSampleBufferSource(l,$,S,P)}catch(Be){console.warn(Be);return}if(s.currentTime>i){console.warn("sample still loading:",l,$);return}if(!R){console.warn("no buffer source");return}R.playbackRate.value=Math.abs(P)*R.playbackRate.value,we==="c"&&(R.playbackRate.value=R.playbackRate.value*R.buffer.duration);let X=ee||y?e:R.buffer.duration/R.playbackRate.value;const re=B*X*R.playbackRate.value;X=(z-B)*X,le&&(R.loop=!0,R.loopStart=re,R.loopEnd=re+X,X=le*X),i+=be,R.start(i,re),te!==void 0&&((o=cutGroups[te])==null||o.stop(i),cutGroups[te]=R),F.push(R),R.stop(i+X+J);const Pe=getADSR(M,U,ye,J,1,i,i+X);F.push(Pe)}if(F.push(gainNode(C)),p!==void 0&&F.push(getFilter("lowpass",p,d)),m!==void 0&&F.push(getFilter("highpass",m,b)),I!==void 0&&F.push(getFilter("bandpass",I,T)),O!==void 0&&F.push(s.createVowelFilter(O)),G!==void 0&&F.push(getWorklet(s,"coarse-processor",{coarse:G})),Y!==void 0&&F.push(getWorklet(s,"crush-processor",{crush:Y})),D!==void 0&&F.push(getWorklet(s,"shape-processor",{shape:D})),W!==void 0){const M=s.createStereoPanner();M.pan.value=2*W-1,F.push(M)}const Q=gainNode(1);F.push(Q),Q.connect(getDestination());let ge;if(Z>0&&fe>0&&L>0){const M=getDelay(pe,fe,L,i);ge=effectSend(Q,M,Z)}let me;if(he>0&&de>0){const M=getReverb(pe,de);me=effectSend(Q,M,he)}F.slice(1).reduce((M,U)=>M.connect(U),F[0]),F[0].onended=()=>F.concat([ge,me]).forEach(M=>M==null?void 0:M.disconnect())}catch(s){console.warn(".out error:",s)}},webaudioOutputTrigger=(r,t,e,o)=>webaudioOutput(t,r-e,t.duration/o);Pattern.prototype.out=function(){return this.onTrigger(webaudioOutputTrigger)};const tune=`stack( + n("c3 [eb3,g3]") + .delay("<0 .5>") + .delaytime(".16 | .33") + .delayfeedback(".6 | .8") +).sometimes(x=>x.speed("-1"))`,ctx=getAudioContext$1(),input=document.getElementById("text");input.innerHTML=tune;evalScope(controls,__vitePreload(()=>Promise.resolve().then(()=>strudel),void 0),__vitePreload(()=>import("./index.211bbc68.js"),[]),__vitePreload(()=>import("./index.ecddf978.js"),[]),__vitePreload(()=>import("./index.63aa02b5.js"),[]));setStringParser(mini);const{evaluate}=repl({defaultOutput:webaudioOutput,getTime:()=>ctx.currentTime});document.getElementById("start").addEventListener("click",()=>{ctx.resume(),evaluate(input.value)});export{Hap as H,Pattern$3 as P,minify as a,peg$SyntaxError as b,peg$parse as c,panic as d,webaudioOutputTrigger as e,getCachedBuffer as f,getAudioContext$1 as g,h,getLoadedBuffer as i,loadGithubSamples as j,resetLoadedSamples as k,loadBuffer as l,mini as m,getLoadedSamples$1 as n,mod as o,patternifyAST as p,getAugmentedNamespace as q,reverseBuffer as r,samples as s,commonjsGlobal as t,getDefaultExportFromCjs as u,reify$2 as v,webaudioOutput as w,stack$1 as x}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.66252a18.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.63aa02b5.js similarity index 94% rename from packages/core/examples/vite-vanilla-repl/dist/assets/index.66252a18.js rename to packages/core/examples/vite-vanilla-repl/dist/assets/index.63aa02b5.js index ddb8aac4..dfde3ae1 100644 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.66252a18.js +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.63aa02b5.js @@ -1 +1 @@ -import{P as _,m as Lt,k as Ut,n as Y,o as Xt,q as Kt,H as Qt,t as Yt}from"./index.f88145a1.js";const C=(n,t)=>Array(Math.abs(t)+1).join(n);function g(n,t,e){return function(...o){return console.warn(`${n} is deprecated. Use ${t}.`),e.apply(this,o)}}function z(n){return n!==null&&typeof n=="object"&&typeof n.name=="string"}function q(n){return n!==null&&typeof n=="object"&&typeof n.step=="number"&&typeof n.alt=="number"}const Qn=[0,2,4,-1,1,3,5],Yn=Qn.map(n=>Math.floor(n*7/12));function en(n){const{step:t,alt:e,oct:o,dir:r=1}=n,i=Qn[t]+7*e;if(o===void 0)return[r*i];const a=o-Yn[t]-4*e;return[r*i,r*a]}const Zt=[3,0,4,1,5,2,6];function on(n){const[t,e,o]=n,r=Zt[Jt(t)],i=Math.floor((t+1)/7);if(e===void 0)return{step:r,alt:i,dir:o};const a=e+4*i+Yn[r];return{step:r,alt:i,oct:a,dir:o}}function Jt(n){const t=(n+1)%7;return t<0?7+t:t}const Zn={empty:!0,name:"",pc:"",acc:""},Dn=new Map,vn=n=>"CDEFGAB".charAt(n),E=n=>n<0?C("b",-n):C("#",n),G=n=>n[0]==="b"?-n.length:n.length;function m(n){const t=Dn.get(n);if(t)return t;const e=typeof n=="string"?te(n):q(n)?m(ee(n)):z(n)?m(n.name):Zn;return Dn.set(n,e),e}const Wt=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function rn(n){const t=Wt.exec(n);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}function F(n){return m(on(n))}const ne=(n,t)=>(n%t+t)%t,pn=[0,2,4,5,7,9,11];function te(n){const t=rn(n);if(t[0]===""||t[3]!=="")return Zn;const e=t[0],o=t[1],r=t[2],i=(e.charCodeAt(0)+3)%7,a=G(o),s=r.length?+r:void 0,c=en({step:i,alt:a,oct:s}),l=e+o+r,u=e+o,d=(pn[i]+a+120)%12,M=s===void 0?ne(pn[i]+a,12)-12*99:pn[i]+a+12*(s+1),h=M>=0&&M<=127?M:null,A=s===void 0?null:Math.pow(2,(M-69)/12)*440;return{empty:!1,acc:o,alt:a,chroma:d,coord:c,freq:A,height:M,letter:e,midi:h,name:l,oct:s,pc:u,step:i}}function ee(n){const{step:t,alt:e,oct:o}=n,r=vn(t);if(!r)return"";const i=r+E(e);return o||o===0?i+o:i}const yn={empty:!0,name:"",acc:""},oe="([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})",re="(AA|A|P|M|m|d|dd)([-+]?\\d+)",ie=new RegExp("^"+oe+"|"+re+"$");function $n(n){const t=ie.exec(`${n}`);return t===null?["",""]:t[1]?[t[1],t[2]]:[t[4],t[3]]}const kn={};function f(n){return typeof n=="string"?kn[n]||(kn[n]=ae(n)):q(n)?f(ce(n)):z(n)?f(n.name):yn}const Rn=[0,2,4,5,7,9,11],Jn="PMMPPMM";function ae(n){const t=$n(n);if(t[0]==="")return yn;const e=+t[0],o=t[1],r=(Math.abs(e)-1)%7,i=Jn[r];if(i==="M"&&o==="P")return yn;const a=i==="M"?"majorable":"perfectable",s=""+e+o,c=e<0?-1:1,l=e===8||e===-8?e:c*(r+1),u=se(a,o),d=Math.floor((Math.abs(e)-1)/7),M=c*(Rn[r]+u+12*d),h=(c*(Rn[r]+u)%12+12)%12,A=en({step:r,alt:u,oct:d,dir:c});return{empty:!1,name:s,num:e,q:o,step:r,alt:u,dir:c,type:a,simple:l,semitones:M,chroma:h,coord:A,oct:d}}function B(n,t){const[e,o=0]=n,r=e*7+o*12<0,i=t||r?[-e,-o,-1]:[e,o,1];return f(on(i))}function se(n,t){return t==="M"&&n==="majorable"||t==="P"&&n==="perfectable"?0:t==="m"&&n==="majorable"?-1:/^A+$/.test(t)?t.length:/^d+$/.test(t)?-1*(n==="perfectable"?t.length:t.length+1):0}function ce(n){const{step:t,alt:e,oct:o=0,dir:r}=n;if(!r)return"";const i=t+1+7*o,a=i===0?t+1:i,s=r<0?"-":"",c=Jn[t]==="M"?"majorable":"perfectable";return s+a+me(c,e)}function me(n,t){return t===0?n==="majorable"?"M":"P":t===-1&&n==="majorable"?"m":t>0?C("A",t):C("d",n==="perfectable"?t:t+1)}function P(n,t){const e=m(n),o=f(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=r.length===1?[r[0]+i[0]]:[r[0]+i[0],r[1]+i[1]];return F(a).name}function D(n,t){const e=m(n),o=m(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=i[0]-r[0],s=r.length===2&&i.length===2?i[1]-r[1]:-Math.floor(a*7/12),c=o.height===e.height&&o.midi!==null&&e.midi!==null&&e.step>o.step;return B([a,s],c).name}const Wn=Object.freeze(Object.defineProperty({__proto__:null,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"})),On=(n,t)=>Array(t+1).join(n),ue=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function nt(n){const t=ue.exec(n);return t?[t[1],t[2],t[3]]:["","",""]}function W(n){const[t,e,o]=nt(n);if(e==="")return"";let r=4;for(let a=0;a96?e.toUpperCase()+i+(r+1):e+i+r}function tt(n){const t=m(n);if(t.empty||!t.oct&&t.oct!==0)return"";const{letter:e,acc:o,oct:r}=t,i=o[0]==="b"?o.replace(/b/g,"_"):o.replace(/#/g,"^"),a=r>4?e.toLowerCase():e,s=r===5?"":r>4?On("'",r-5):On(",",4-r);return i+a+s}function le(n,t){return tt(P(W(n),t))}function de(n,t){return D(W(n),W(t))}var Me={abcToScientificNotation:W,scientificToAbcNotation:tt,tokenize:nt,transpose:le,distance:de};function fe(n,t){const e=[];for(;t--;e[t]=t+n);return e}function Pe(n,t){const e=[];for(;t--;e[t]=n-t);return e}function pe(n,t){return nt===0||t)}function et(n){return n.map(e=>m(e)).filter(e=>!e.empty).sort((e,o)=>e.height-o.height).map(e=>e.name)}function ge(n){return et(n).filter((t,e,o)=>e===0||t!==o[e-1])}function be(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function ot(n){return n.length===0?[[]]:ot(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}const Ae=Object.freeze(Object.defineProperty({__proto__:null,compact:ye,permutations:ot,range:pe,rotate:he,shuffle:be,sortedNoteNames:et,sortedUniqNoteNames:ge},Symbol.toStringTag,{value:"Module"}));function ve(n,t){const e=[];for(;t--;e[t]=t+n);return e}function $e(n,t){const e=[];for(;t--;e[t]=n-t);return e}function an(n,t){return nt===0||t)}function Ne(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function rt(n){return n.length===0?[[]]:rt(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}var Ie={compact:Nn,permutations:rt,range:an,rotate:H,shuffle:Ne};const T={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},In=n=>Number(n).toString(2),Fn=n=>parseInt(n,2),je=/^[01]{12}$/;function it(n){return je.test(n)}const Se=n=>typeof n=="number"&&n>=0&&n<=4095,Te=n=>n&&it(n.chroma),zn={[T.chroma]:T};function p(n){const t=it(n)?n:Se(n)?In(n):Array.isArray(n)?ze(n):Te(n)?n.chroma:T.chroma;return zn[t]=zn[t]||Fe(t)}const Ve=g("Pcset.pcset","Pcset.get",p),_e=n=>p(n).chroma,Ce=n=>p(n).intervals,we=n=>p(n).setNum,xe=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function Ee(n){const t=[];for(let e=0;e<12;e++)n.charAt(e)==="1"&&t.push(xe[e]);return t}function De(){return an(2048,4095).map(In)}function jn(n,t=!0){const o=p(n).chroma.split("");return Nn(o.map((r,i)=>{const a=H(i,o);return t&&a[0]==="0"?null:a.join("")}))}function ke(n,t){return p(n).setNum===p(t).setNum}function sn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o&t)===o}}function cn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o|t)===o}}function at(n){const t=p(n);return e=>{const o=m(e);return t&&!o.empty&&t.chroma.charAt(o.chroma)==="1"}}function Re(n){const t=at(n);return e=>e.filter(t)}var st={get:p,chroma:_e,num:we,intervals:Ce,chromas:De,isSupersetOf:cn,isSubsetOf:sn,isNoteIncludedIn:at,isEqual:ke,filter:Re,modes:jn,pcset:Ve};function Oe(n){const t=n.split("");return t.map((e,o)=>H(o,t).join(""))}function Fe(n){const t=Fn(n),e=Oe(n).map(Fn).filter(i=>i>=2048).sort()[0],o=In(e),r=Ee(n);return{empty:!1,name:"",setNum:t,chroma:n,normalized:o,intervals:r}}function ze(n){if(n.length===0)return T.chroma;let t;const e=[0,0,0,0,0,0,0,0,0,0,0,0];for(let o=0;on.name).filter(n=>n)}function Le(){return k.map(n=>n.aliases[0]).filter(n=>n)}function Ue(){return Object.keys(j)}function R(){return k.slice()}const Xe=g("ChordType.entries","ChordType.all",R);function Ke(){k=[],j={}}function ct(n,t,e){const o=Ye(n),r={...p(n),name:e||"",quality:o,intervals:n,aliases:t};k.push(r),r.name&&(j[r.name]=r),j[r.setNum]=r,j[r.chroma]=r,r.aliases.forEach(i=>Qe(r,i))}function Qe(n,t){j[t]=n}function Ye(n){const t=e=>n.indexOf(e)!==-1;return t("5A")?"Augmented":t("3M")?"Major":t("5d")?"Diminished":t("3m")?"Minor":"Unknown"}qe.forEach(([n,t,e])=>ct(n.split(" "),e.split(" "),t));k.sort((n,t)=>n.setNum-t.setNum);var mt={names:He,symbols:Le,get:Sn,all:R,add:ct,removeAll:Ke,keys:Ue,entries:Xe,chordType:Be};const Ze=n=>{const t=n.reduce((e,o)=>{const r=m(o).chroma;return r!==void 0&&(e[r]=e[r]||m(o).name),e},{});return e=>t[e]};function Je(n){const t=n.map(o=>m(o).pc).filter(o=>o);return m.length===0?[]:We(t,1).filter(o=>o.weight).sort((o,r)=>r.weight-o.weight).map(o=>o.name)}function We(n,t){const e=n[0],o=m(e).chroma,r=Ze(n),i=jn(n,!1),a=[];return i.forEach((s,c)=>{R().filter(u=>u.chroma===s).forEach(u=>{const d=u.aliases[0],M=r(c);c!==o?a.push({weight:.5*t,name:`${M}${d}/${e}`}):a.push({weight:1*t,name:`${M}${d}`})})}),a}const no=[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 2A 3M 4A 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 4A 5P 6M 7m","dorian #4","ukrainian dorian","romanian minor","altered dorian"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]],to={...T,intervals:[],aliases:[]};let mn=[],S={};function ut(){return mn.map(n=>n.name)}function un(n){return S[n]||to}const eo=g("ScaleDictionary.scaleType","ScaleType.get",un);function L(){return mn.slice()}const oo=g("ScaleDictionary.entries","ScaleType.all",L);function ro(){return Object.keys(S)}function io(){mn=[],S={}}function lt(n,t,e=[]){const o={...p(n),name:t,intervals:n,aliases:e};return mn.push(o),S[o.name]=o,S[o.setNum]=o,S[o.chroma]=o,o.aliases.forEach(r=>ao(o,r)),o}function ao(n,t){S[t]=n}no.forEach(([n,t,...e])=>lt(n.split(" "),t,e));var dt={names:ut,get:un,all:L,add:lt,removeAll:io,keys:ro,entries:oo,scaleType:eo};const gn={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},so=/^(6|64|7|9|11|13)$/;function ln(n){const[t,e,o,r]=rn(n);return t===""?["",n]:t==="A"&&r==="ug"?["","aug"]:!r&&(o==="4"||o==="5")?[t+e,o]:so.test(o)?[t+e,o+r]:[t+e+o,r]}function U(n){if(n==="")return gn;if(Array.isArray(n)&&n.length===2)return Z(n[1],n[0]);{const[t,e]=ln(n),o=Z(e,t);return o.empty?Z(n):o}}function Z(n,t,e){const o=Sn(n),r=m(t||""),i=m(e||"");if(o.empty||t&&r.empty||e&&i.empty)return gn;const a=D(r.pc,i.pc),s=o.intervals.indexOf(a)+1;if(!i.empty&&!s)return gn;const c=Array.from(o.intervals);for(let M=1;MP(r,M));n=o.aliases.indexOf(n)!==-1?n:o.aliases[0];const u=`${r.empty?"":r.pc}${n}${i.empty||s<=1?"":"/"+i.pc}`,d=`${t?r.pc+" ":""}${o.name}${s>1&&e?" over "+i.pc:""}`;return{...o,name:d,symbol:u,type:o.name,root:i.name,intervals:c,rootDegree:s,tonic:r.name,notes:l}}const co=g("Chord.chord","Chord.get",U);function mo(n,t){const[e,o]=ln(n);return e?P(e,t)+o:n}function uo(n){const t=U(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function lo(n){const t=U(n),e=cn(t.chroma);return R().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}function Mo(n){const t=U(n),e=sn(t.chroma);return R().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}var fo={getChord:Z,get:U,detect:Je,chordScales:uo,extended:lo,reduced:Mo,tokenize:ln,transpose:mo,chord:co};const Po=[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]],dn=[];Po.forEach(([n,t,e])=>$o(n,t,e));const po={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};function ho(){return dn.reduce((n,t)=>(t.names.forEach(e=>n.push(e)),n),[])}function yo(){return dn.map(n=>n.shorthand)}const go=/^([^.]+)(\.*)$/;function Tn(n){const[t,e,o]=go.exec(n)||[],r=dn.find(s=>s.shorthand===e||s.names.includes(e));if(!r)return po;const i=No(r.fraction,o.length),a=i[0]/i[1];return{...r,name:n,dots:o,value:a,fraction:i}}const bo=n=>Tn(n).value,Ao=n=>Tn(n).fraction;var vo={names:ho,shorthands:yo,get:Tn,value:bo,fraction:Ao};function $o(n,t,e){dn.push({empty:!1,dots:"",name:"",value:1/n,fraction:n<1?[1/n,1]:[1,n],shorthand:t,names:e})}function No(n,t){const e=Math.pow(2,t);let o=n[0]*e,r=n[1]*e;const i=o;for(let a=0;af(n).name,So=n=>f(n).semitones,To=n=>f(n).q,Vo=n=>f(n).num;function ft(n){const t=f(n);return t.empty?"":t.simple+t.q}function _o(n){const t=f(n);if(t.empty)return"";const e=(7-t.step)%7,o=t.type==="perfectable"?-t.alt:-(t.alt+1);return f({step:e,alt:o,oct:t.oct,dir:t.dir}).name}const Co=[1,2,2,3,3,4,5,5,6,6,7,7],wo="P m M m M P d P m M m M".split(" ");function xo(n){const t=n<0?-1:1,e=Math.abs(n),o=e%12,r=Math.floor(e/12);return t*(Co[o]+7*r)+wo[o]}const Eo=D,Pt=ht((n,t)=>[n[0]+t[0],n[1]+t[1]]),Do=n=>t=>Pt(n,t),ko=ht((n,t)=>[n[0]-t[0],n[1]-t[1]]);function pt(n,t){const e=Mt(n);if(e.empty)return"";const[o,r,i]=e.coord;return B([o+t,r,i]).name}var bn={names:Io,get:Mt,name:jo,num:Vo,semitones:So,quality:To,fromSemitones:xo,distance:Eo,invert:_o,simplify:ft,add:Pt,addTo:Do,substract:ko,transposeFifths:pt};function ht(n){return(t,e)=>{const o=f(t).coord,r=f(e).coord;if(o&&r){const i=n(o,r);return B(i).name}}}function yt(n){return+n>=0&&+n<=127}function gt(n){if(yt(n))return+n;const t=m(n);return t.empty?null:t.midi}function Ro(n,t=440){return Math.pow(2,(n-69)/12)*t}const Oo=Math.log(2),Fo=Math.log(440);function Vn(n){const t=12*(Math.log(n)-Fo)/Oo+69;return Math.round(t*100)/100}const zo="C C# D D# E F F# G G# A A# B".split(" "),qo="C Db D Eb E F Gb G Ab A Bb B".split(" ");function I(n,t={}){if(isNaN(n)||n===-1/0||n===1/0)return"";n=Math.round(n);const o=(t.sharps===!0?zo:qo)[n%12];if(t.pitchClass)return o;const r=Math.floor(n/12)-1;return o+r}var Go={isMidi:yt,toMidi:gt,midiToFreq:Ro,midiToNoteName:I,freqToMidi:Vn};const Bo=["C","D","E","F","G","A","B"],bt=n=>n.name,At=n=>n.map(m).filter(t=>!t.empty);function Ho(n){return n===void 0?Bo.slice():Array.isArray(n)?At(n).map(bt):[]}const y=m,Lo=n=>y(n).name,Uo=n=>y(n).pc,Xo=n=>y(n).acc,Ko=n=>y(n).oct,Qo=n=>y(n).midi,Yo=n=>y(n).freq,Zo=n=>y(n).chroma;function vt(n){return I(n)}function Jo(n){return I(Vn(n))}function Wo(n){return I(Vn(n),{sharps:!0})}function nr(n){return I(n,{sharps:!0})}const _n=P,tr=P,$t=n=>t=>_n(t,n),er=$t,Nt=n=>t=>_n(n,t),or=Nt;function nn(n,t){const e=y(n);if(e.empty)return"";const[o,r]=e.coord;return F(r===void 0?[o+t]:[o+t,r]).name}const rr=nn,Cn=(n,t)=>n.height-t.height,ir=(n,t)=>t.height-n.height;function It(n,t){return t=t||Cn,At(n).sort(t).map(bt)}function jt(n){return It(n,Cn).filter((t,e,o)=>e===0||t!==o[e-1])}const ar=n=>{const t=y(n);return t.empty?"":I(t.midi||t.chroma,{sharps:t.alt>0,pitchClass:t.midi===null})};function St(n,t){const e=y(n);if(e.empty)return"";const o=y(t||I(e.midi||e.chroma,{sharps:e.alt<0,pitchClass:!0}));if(o.empty||o.chroma!==e.chroma)return"";if(e.oct===void 0)return o.pc;const r=e.chroma-e.alt,i=o.chroma-o.alt,a=r>11||i<0?-1:r<0||i>11?1:0,s=e.oct+a;return o.pc+s}var w={names:Ho,get:y,name:Lo,pitchClass:Uo,accidentals:Xo,octave:Ko,midi:Qo,ascending:Cn,descending:ir,sortedNames:It,sortedUniqNames:jt,fromMidi:vt,fromMidiSharps:nr,freq:Yo,fromFreq:Jo,fromFreqSharps:Wo,chroma:Zo,transpose:_n,tr,transposeBy:$t,trBy:er,transposeFrom:Nt,trFrom:or,transposeFifths:nn,trFifths:rr,simplify:ar,enharmonic:St};const Tt={empty:!0,name:"",chordType:""},qn={};function $(n){return typeof n=="string"?qn[n]||(qn[n]=Mr(n)):typeof n=="number"?$(Mn[n]||""):q(n)?mr(n):z(n)?$(n.name):Tt}const sr=g("RomanNumeral.romanNumeral","RomanNumeral.get",$);function cr(n=!0){return(n?Mn:dr).slice()}function mr(n){return $(E(n.alt)+Mn[n.step])}const ur=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;function lr(n){return ur.exec(n)||["","","",""]}const Vt="I II III IV V VI VII",Mn=Vt.split(" "),dr=Vt.toLowerCase().split(" ");function Mr(n){const[t,e,o,r]=lr(n);if(!o)return Tt;const i=o.toUpperCase(),a=Mn.indexOf(i),s=G(e),c=1;return{empty:!1,name:t,roman:o,interval:f({step:a,alt:s,dir:c}).name,acc:e,chordType:r,alt:s,step:a,major:o===i,oct:0,dir:c}}var fr={names:cr,get:$,romanNumeral:sr};const b=Object.freeze([]),_t={type:"major",tonic:"",alteration:0,keySignature:""},J={tonic:"",grades:b,intervals:b,scale:b,chords:b,chordsHarmonicFunction:b,chordScales:b},Pr={..._t,...J,type:"major",minorRelative:"",scale:b,secondaryDominants:b,secondaryDominantsMinorRelative:b,substituteDominants:b,substituteDominantsMinorRelative:b},pr={..._t,type:"minor",relativeMajor:"",natural:J,harmonic:J,melodic:J},Gn=(n,t,e="")=>t.map((o,r)=>`${n[r]}${e}${o}`);function fn(n,t,e,o){return r=>{const i=n.map(s=>$(s).interval||""),a=i.map(s=>P(r,s));return{tonic:r,grades:n,intervals:i,scale:a,chords:Gn(a,t),chordsHarmonicFunction:e.slice(),chordScales:Gn(a,o," ")}}}const Ct=(n,t)=>{const e=m(n),o=m(t);return e.empty||o.empty?0:o.coord[0]-e.coord[0]},hr=fn("I II III IV V VI VII".split(" "),"maj7 m7 m7 maj7 7 m7 m7b5".split(" "),"T SD T SD D T D".split(" "),"major,dorian,phrygian,lydian,mixolydian,minor,locrian".split(",")),yr=fn("I II bIII IV V bVI bVII".split(" "),"m7 m7b5 maj7 m7 m7 maj7 7".split(" "),"T SD T SD D SD SD".split(" "),"minor,locrian,major,dorian,phrygian,lydian,mixolydian".split(",")),gr=fn("I II bIII IV V bVI VII".split(" "),"mMaj7 m7b5 +maj7 m7 7 maj7 o7".split(" "),"T SD T SD D SD D".split(" "),"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian".split(",")),br=fn("I II bIII IV V VI VII".split(" "),"m6 m7 +maj7 7 7 m7b5 m7b5".split(" "),"T SD T SD D ".split(" "),"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered".split(","));function Ar(n){const t=m(n).pc;if(!t)return Pr;const e=hr(t),o=Ct("C",t),r=i=>{const a=$(i);return a.empty?"":P(n,a.interval)+a.chordType};return{...e,type:"major",minorRelative:P(t,"-3m"),alteration:o,keySignature:E(o),secondaryDominants:"- VI7 VII7 I7 II7 III7 -".split(" ").map(r),secondaryDominantsMinorRelative:"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -".split(" ").map(r),substituteDominants:"- bIII7 IV7 bV7 bVI7 bVII7 -".split(" ").map(r),substituteDominantsMinorRelative:"- IIIm7 Im7 IIbm7 VIm7 IVm7 -".split(" ").map(r)}}function vr(n){const t=m(n).pc;if(!t)return pr;const e=Ct("C",t)-3;return{type:"minor",tonic:t,relativeMajor:P(t,"3m"),alteration:e,keySignature:E(e),natural:yr(t),harmonic:gr(t),melodic:br(t)}}function $r(n){return typeof n=="number"?nn("C",n):typeof n=="string"&&/^b+|#+$/.test(n)?nn("C",G(n)):null}var Nr={majorKey:Ar,majorTonicFromKeySignature:$r,minorKey:vr};const wn=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]],Bn={...T,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},xn=wn.map(Tr),An={};xn.forEach(n=>{An[n.name]=n,n.aliases.forEach(t=>{An[t]=n})});function V(n){return typeof n=="string"?An[n.toLowerCase()]||Bn:n&&n.name?V(n.name):Bn}const Ir=g("Mode.mode","Mode.get",V);function wt(){return xn.slice()}const jr=g("Mode.mode","Mode.all",wt);function Sr(){return xn.map(n=>n.name)}function Tr(n){const[t,e,o,r,i,a,s]=n,c=s?[s]:[],l=Number(e).toString(2);return{empty:!1,intervals:un(r).intervals,modeNum:t,chroma:l,normalized:l,name:r,setNum:e,alt:o,triad:i,seventh:a,aliases:c}}function Vr(n,t){return V(n).intervals.map(e=>P(t,e))}function xt(n){return(t,e)=>{const o=V(t);if(o.empty)return[];const r=H(o.modeNum,n),i=o.intervals.map(a=>P(e,a));return r.map((a,s)=>i[s]+a)}}const _r=xt(wn.map(n=>n[4])),Cr=xt(wn.map(n=>n[5]));function Et(n,t){const e=V(t),o=V(n);return e.empty||o.empty?"":ft(pt("1P",o.alt-e.alt))}function wr(n,t,e){return P(e,Et(n,t))}var xr={get:V,names:Sr,all:wt,distance:Et,relativeTonic:wr,notes:Vr,triads:_r,seventhChords:Cr,entries:jr,mode:Ir};function Er(n,t){return t.map($).map(o=>P(n,f(o))+o.chordType)}function Dr(n,t){return t.map(e=>{const[o,r]=ln(e),i=D(n,o);return $(f(i)).name+r})}var kr={fromRomanNumerals:Er,toRomanNumerals:Dr};function Dt(n){const t=Nn(n.map(gt));return!n.length||t.length!==n.length?[]:t.reduce((e,o)=>{const r=e[e.length-1];return e.concat(an(r,o).slice(1))},[t[0]])}function Rr(n,t){return Dt(n).map(e=>I(e,t))}var Or={numeric:Dt,chromatic:Rr};const Fr={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function kt(n){if(typeof n!="string")return["",""];const t=n.indexOf(" "),e=m(n.substring(0,t));if(e.empty){const r=m(n);return r.empty?["",n]:[r.name,""]}const o=n.substring(e.name.length+1);return[e.name,o.length?o:""]}const zr=ut;function N(n){const t=Array.isArray(n)?n:kt(n),e=m(t[0]).name,o=un(t[1]);if(o.empty)return Fr;const r=o.name,i=e?o.intervals.map(s=>P(e,s)):[],a=e?e+" "+r:r;return{...o,name:a,type:r,tonic:e,notes:i}}const qr=g("Scale.scale","Scale.get",N);function Gr(n){const t=N(n),e=sn(t.chroma);return R().filter(o=>e(o.chroma)).map(o=>o.aliases[0])}function Br(n){const t=N(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function Hr(n){const t=sn(N(n).chroma);return L().filter(e=>t(e.chroma)).map(e=>e.name)}function Rt(n){const t=n.map(r=>m(r).pc).filter(r=>r),e=t[0],o=jt(t);return H(o.indexOf(e),o)}function Lr(n){const t=N(n);if(t.empty)return[];const e=t.tonic?t.notes:t.intervals;return jn(t.chroma).map((o,r)=>{const i=N(o).name;return i?[e[r],i]:["",""]}).filter(o=>o[0])}function Ur(n){const t=Array.isArray(n)?Rt(n):N(n).notes,e=t.map(o=>m(o).chroma);return o=>{const r=m(typeof o=="number"?vt(o):o),i=r.height;if(i===void 0)return;const a=i%12,s=e.indexOf(a);if(s!==-1)return St(r.name,t[s])}}function Xr(n){const t=Ur(n);return(e,o)=>{const r=m(e).height,i=m(o).height;return r===void 0||i===void 0?[]:an(r,i).map(t).filter(a=>a)}}var tn={get:N,names:zr,extended:Br,modeNames:Lr,reduced:Hr,scaleChords:Gr,scaleNotes:Rt,tokenize:kt,rangeOf:Xr,scale:qr};const Kr={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},Qr=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];function Yr(){return Qr.slice()}const Zr=/^(\d?\d(?:\+\d)*)\/(\d)$/,Hn=new Map;function Jr(n){const t=Hn.get(n);if(t)return t;const e=ni(En(n));return Hn.set(n,e),e}function En(n){if(typeof n=="string"){const[i,a,s]=Zr.exec(n)||[];return En([a,s])}const[t,e]=n,o=+e;if(typeof t=="number")return[t,o];const r=t.split("+").map(i=>+i);return r.length===1?[r[0],o]:[r,o]}var Wr={names:Yr,parse:En,get:Jr};function ni([n,t]){const e=Array.isArray(n)?n.reduce((s,c)=>s+c,0):n,o=t;if(e===0||o===0)return Kr;const r=Array.isArray(n)?`${n.join("+")}/${t}`:`${n}/${t}`,i=Array.isArray(n)?n:[],a=o===4||o===2?"simple":o===8&&e%3===0?"compound":"irregular";return{empty:!1,name:r,type:a,upper:e,lower:o,additive:i}}const ti=Wn,ei=st,oi=mt,ri=dt,ii=Object.freeze(Object.defineProperty({__proto__:null,Array:Ae,Core:Wn,ChordDictionary:oi,PcSet:ei,ScaleDictionary:ri,Tonal:ti,AbcNotation:Me,Chord:fo,ChordType:mt,Collection:Ie,DurationValue:vo,Interval:bn,Key:Nr,Midi:Go,Mode:xr,Note:w,Pcset:st,Progression:kr,Range:Or,RomanNumeral:fr,Scale:tn,ScaleType:dt,TimeSignature:Wr,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"}));function Ot(n,t,e){let[o,r]=tn.tokenize(n),{notes:i}=tn.get(`${o} ${r}`);if(i=i.map(h=>w.get(h).pc),t=Number(t),isNaN(t))throw new Error(`scale offset "${t}" not a number`);const{pc:a,oct:s=3}=w.get(e),c=i.indexOf(a);if(c===-1)throw new Error(`note "${e}" is not in scale "${n}"`);let l=c,u=s,d=a;const M=Math.sign(t);for(;Math.abs(l-c)0&&d[0]==="C"&&(u+=M)}return d+u}_.prototype._transpose=function(n){return this._withHap(t=>{const e=isNaN(Number(n))?String(n):bn.fromSemitones(n);if(typeof t.value=="number"){const o=typeof e=="string"?bn.semitones(e)||0:e;return t.withValue(()=>t.value+o)}return t.withValue(()=>w.simplify(w.transpose(t.value,e)))})};_.prototype._scaleTranspose=function(n){return this._withHap(t=>{if(!t.context.scale)throw new Error("can only use scaleTranspose after .scale");if(typeof t.value!="string")throw new Error("can only use scaleTranspose with notes");return t.withValue(()=>Ot(t.context.scale,Number(n),t.value))})};_.prototype._scale=function(n){return this._withHap(t=>{let e=t.value;const o=Number(e);if(!isNaN(o)){let[r,i]=tn.tokenize(n);const{pc:a,oct:s=3}=w.get(r);e=Ot(a+" "+i,o,a+s)}return t.withValue(()=>e).setContext({...t.context,scale:n})})};_.prototype.define("transpose",(n,t)=>t.transpose(n),{composable:!0,patternified:!0});_.prototype.define("scale",(n,t)=>t.scale(n),{composable:!0,patternified:!0});_.prototype.define("scaleTranspose",(n,t)=>t.scaleTranspose(n),{composable:!0,patternified:!0});var Ft={},hn={},X={};X.__esModule=!0;X.getBestVoicing=void 0;function ai(n){var t=n.chord,e=n.range,o=n.finder,r=n.picker,i=n.lastVoicing,a=o(t,e);return a.length?r(a,i):[]}X.getBestVoicing=ai;var O={};const zt=Ut(ii);var K={};K.__esModule=!0;K.tokenizeChord=void 0;function si(n){var t=(n||"").match(/^([A-G][b#]*)([^\/]*)[\/]?([A-G][b#]*)?$/);return t?t.slice(1):[]}K.tokenizeChord=si;var Ln;function ci(){if(Ln)return O;Ln=1,O.__esModule=!0,O.voicingsInRange=void 0;var n=zt,t=qt(),e=K;function o(r,i,a){i===void 0&&(i=t.lefthand),a===void 0&&(a=["D3","A4"]);var s=(0,e.tokenizeChord)(r),c=s[0],l=s[1];if(!i[l])return[];var u=i[l].map(function(M){return M.split(" ")}),d=n.Range.chromatic(a);return u.reduce(function(M,h){var A=h.map(function(v){return n.Interval.substract(v,h[0])}),Q=n.Note.transpose(c,h[0]),Gt=d.filter(function(v){return n.Note.chroma(v)===n.Note.chroma(Q)}).filter(function(v){return n.Note.midi(n.Note.transpose(v,A[A.length-1]))<=n.Note.midi(a[1])}).map(function(v){return n.Note.enharmonic(v,Q)}),Bt=Gt.map(function(v){return A.map(function(Ht){return n.Note.transpose(v,Ht)})});return M.concat(Bt)},[])}return O.voicingsInRange=o,O}var Un;function qt(){return Un||(Un=1,function(n){var t=Y&&Y.__assign||function(){return t=Object.assign||function(s){for(var c,l=1,u=arguments.length;lui({chord:n,dictionary:di,range:e,picker:li,lastVoicing:t}),x=_;x.prototype.fmapNested=function(n){return new x(t=>this.query(t).map(e=>Kt(n(e)).query(t).map(o=>new Qt(e.whole,e.part,o.value,o.context))).flat())};x.prototype.voicings=function(n){let t;return n!=null&&n.length||(n=["F3","A4"]),this.fmapNested(e=>(t=Mi(e.value,t,n),Yt(...t)._withContext(()=>({locations:e.context.locations||[]}))))};x.prototype._rootNotes=function(n=2){return this.fmap(t=>{const[e,o]=t.match(/^([a-gA-G][b#]?).*$/);return o+n})};x.prototype.define("voicings",(n,t)=>t.voicings(n),{composable:!0});x.prototype.define("rootNotes",(n,t)=>t.rootNotes(n),{composable:!0,patternified:!0}); +import{P as _,o as Lt,q as Ut,t as Y,u as Xt,v as Kt,H as Qt,x as Yt}from"./index.4cbc0a10.js";const C=(n,t)=>Array(Math.abs(t)+1).join(n);function g(n,t,e){return function(...o){return console.warn(`${n} is deprecated. Use ${t}.`),e.apply(this,o)}}function z(n){return n!==null&&typeof n=="object"&&typeof n.name=="string"}function q(n){return n!==null&&typeof n=="object"&&typeof n.step=="number"&&typeof n.alt=="number"}const Qn=[0,2,4,-1,1,3,5],Yn=Qn.map(n=>Math.floor(n*7/12));function en(n){const{step:t,alt:e,oct:o,dir:r=1}=n,i=Qn[t]+7*e;if(o===void 0)return[r*i];const a=o-Yn[t]-4*e;return[r*i,r*a]}const Zt=[3,0,4,1,5,2,6];function on(n){const[t,e,o]=n,r=Zt[Jt(t)],i=Math.floor((t+1)/7);if(e===void 0)return{step:r,alt:i,dir:o};const a=e+4*i+Yn[r];return{step:r,alt:i,oct:a,dir:o}}function Jt(n){const t=(n+1)%7;return t<0?7+t:t}const Zn={empty:!0,name:"",pc:"",acc:""},Dn=new Map,vn=n=>"CDEFGAB".charAt(n),E=n=>n<0?C("b",-n):C("#",n),G=n=>n[0]==="b"?-n.length:n.length;function m(n){const t=Dn.get(n);if(t)return t;const e=typeof n=="string"?te(n):q(n)?m(ee(n)):z(n)?m(n.name):Zn;return Dn.set(n,e),e}const Wt=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function rn(n){const t=Wt.exec(n);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}function F(n){return m(on(n))}const ne=(n,t)=>(n%t+t)%t,pn=[0,2,4,5,7,9,11];function te(n){const t=rn(n);if(t[0]===""||t[3]!=="")return Zn;const e=t[0],o=t[1],r=t[2],i=(e.charCodeAt(0)+3)%7,a=G(o),s=r.length?+r:void 0,c=en({step:i,alt:a,oct:s}),l=e+o+r,u=e+o,d=(pn[i]+a+120)%12,M=s===void 0?ne(pn[i]+a,12)-12*99:pn[i]+a+12*(s+1),h=M>=0&&M<=127?M:null,A=s===void 0?null:Math.pow(2,(M-69)/12)*440;return{empty:!1,acc:o,alt:a,chroma:d,coord:c,freq:A,height:M,letter:e,midi:h,name:l,oct:s,pc:u,step:i}}function ee(n){const{step:t,alt:e,oct:o}=n,r=vn(t);if(!r)return"";const i=r+E(e);return o||o===0?i+o:i}const yn={empty:!0,name:"",acc:""},oe="([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})",re="(AA|A|P|M|m|d|dd)([-+]?\\d+)",ie=new RegExp("^"+oe+"|"+re+"$");function $n(n){const t=ie.exec(`${n}`);return t===null?["",""]:t[1]?[t[1],t[2]]:[t[4],t[3]]}const Rn={};function f(n){return typeof n=="string"?Rn[n]||(Rn[n]=ae(n)):q(n)?f(ce(n)):z(n)?f(n.name):yn}const kn=[0,2,4,5,7,9,11],Jn="PMMPPMM";function ae(n){const t=$n(n);if(t[0]==="")return yn;const e=+t[0],o=t[1],r=(Math.abs(e)-1)%7,i=Jn[r];if(i==="M"&&o==="P")return yn;const a=i==="M"?"majorable":"perfectable",s=""+e+o,c=e<0?-1:1,l=e===8||e===-8?e:c*(r+1),u=se(a,o),d=Math.floor((Math.abs(e)-1)/7),M=c*(kn[r]+u+12*d),h=(c*(kn[r]+u)%12+12)%12,A=en({step:r,alt:u,oct:d,dir:c});return{empty:!1,name:s,num:e,q:o,step:r,alt:u,dir:c,type:a,simple:l,semitones:M,chroma:h,coord:A,oct:d}}function B(n,t){const[e,o=0]=n,r=e*7+o*12<0,i=t||r?[-e,-o,-1]:[e,o,1];return f(on(i))}function se(n,t){return t==="M"&&n==="majorable"||t==="P"&&n==="perfectable"?0:t==="m"&&n==="majorable"?-1:/^A+$/.test(t)?t.length:/^d+$/.test(t)?-1*(n==="perfectable"?t.length:t.length+1):0}function ce(n){const{step:t,alt:e,oct:o=0,dir:r}=n;if(!r)return"";const i=t+1+7*o,a=i===0?t+1:i,s=r<0?"-":"",c=Jn[t]==="M"?"majorable":"perfectable";return s+a+me(c,e)}function me(n,t){return t===0?n==="majorable"?"M":"P":t===-1&&n==="majorable"?"m":t>0?C("A",t):C("d",n==="perfectable"?t:t+1)}function P(n,t){const e=m(n),o=f(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=r.length===1?[r[0]+i[0]]:[r[0]+i[0],r[1]+i[1]];return F(a).name}function D(n,t){const e=m(n),o=m(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=i[0]-r[0],s=r.length===2&&i.length===2?i[1]-r[1]:-Math.floor(a*7/12),c=o.height===e.height&&o.midi!==null&&e.midi!==null&&e.step>o.step;return B([a,s],c).name}const Wn=Object.freeze(Object.defineProperty({__proto__:null,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"})),On=(n,t)=>Array(t+1).join(n),ue=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function nt(n){const t=ue.exec(n);return t?[t[1],t[2],t[3]]:["","",""]}function W(n){const[t,e,o]=nt(n);if(e==="")return"";let r=4;for(let a=0;a96?e.toUpperCase()+i+(r+1):e+i+r}function tt(n){const t=m(n);if(t.empty||!t.oct&&t.oct!==0)return"";const{letter:e,acc:o,oct:r}=t,i=o[0]==="b"?o.replace(/b/g,"_"):o.replace(/#/g,"^"),a=r>4?e.toLowerCase():e,s=r===5?"":r>4?On("'",r-5):On(",",4-r);return i+a+s}function le(n,t){return tt(P(W(n),t))}function de(n,t){return D(W(n),W(t))}var Me={abcToScientificNotation:W,scientificToAbcNotation:tt,tokenize:nt,transpose:le,distance:de};function fe(n,t){const e=[];for(;t--;e[t]=t+n);return e}function Pe(n,t){const e=[];for(;t--;e[t]=n-t);return e}function pe(n,t){return nt===0||t)}function et(n){return n.map(e=>m(e)).filter(e=>!e.empty).sort((e,o)=>e.height-o.height).map(e=>e.name)}function ge(n){return et(n).filter((t,e,o)=>e===0||t!==o[e-1])}function be(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function ot(n){return n.length===0?[[]]:ot(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}const Ae=Object.freeze(Object.defineProperty({__proto__:null,compact:ye,permutations:ot,range:pe,rotate:he,shuffle:be,sortedNoteNames:et,sortedUniqNoteNames:ge},Symbol.toStringTag,{value:"Module"}));function ve(n,t){const e=[];for(;t--;e[t]=t+n);return e}function $e(n,t){const e=[];for(;t--;e[t]=n-t);return e}function an(n,t){return nt===0||t)}function Ne(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function rt(n){return n.length===0?[[]]:rt(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}var Ie={compact:Nn,permutations:rt,range:an,rotate:H,shuffle:Ne};const T={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},In=n=>Number(n).toString(2),Fn=n=>parseInt(n,2),je=/^[01]{12}$/;function it(n){return je.test(n)}const Se=n=>typeof n=="number"&&n>=0&&n<=4095,Te=n=>n&&it(n.chroma),zn={[T.chroma]:T};function p(n){const t=it(n)?n:Se(n)?In(n):Array.isArray(n)?ze(n):Te(n)?n.chroma:T.chroma;return zn[t]=zn[t]||Fe(t)}const Ve=g("Pcset.pcset","Pcset.get",p),_e=n=>p(n).chroma,Ce=n=>p(n).intervals,we=n=>p(n).setNum,xe=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function Ee(n){const t=[];for(let e=0;e<12;e++)n.charAt(e)==="1"&&t.push(xe[e]);return t}function De(){return an(2048,4095).map(In)}function jn(n,t=!0){const o=p(n).chroma.split("");return Nn(o.map((r,i)=>{const a=H(i,o);return t&&a[0]==="0"?null:a.join("")}))}function Re(n,t){return p(n).setNum===p(t).setNum}function sn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o&t)===o}}function cn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o|t)===o}}function at(n){const t=p(n);return e=>{const o=m(e);return t&&!o.empty&&t.chroma.charAt(o.chroma)==="1"}}function ke(n){const t=at(n);return e=>e.filter(t)}var st={get:p,chroma:_e,num:we,intervals:Ce,chromas:De,isSupersetOf:cn,isSubsetOf:sn,isNoteIncludedIn:at,isEqual:Re,filter:ke,modes:jn,pcset:Ve};function Oe(n){const t=n.split("");return t.map((e,o)=>H(o,t).join(""))}function Fe(n){const t=Fn(n),e=Oe(n).map(Fn).filter(i=>i>=2048).sort()[0],o=In(e),r=Ee(n);return{empty:!1,name:"",setNum:t,chroma:n,normalized:o,intervals:r}}function ze(n){if(n.length===0)return T.chroma;let t;const e=[0,0,0,0,0,0,0,0,0,0,0,0];for(let o=0;on.name).filter(n=>n)}function Le(){return R.map(n=>n.aliases[0]).filter(n=>n)}function Ue(){return Object.keys(j)}function k(){return R.slice()}const Xe=g("ChordType.entries","ChordType.all",k);function Ke(){R=[],j={}}function ct(n,t,e){const o=Ye(n),r={...p(n),name:e||"",quality:o,intervals:n,aliases:t};R.push(r),r.name&&(j[r.name]=r),j[r.setNum]=r,j[r.chroma]=r,r.aliases.forEach(i=>Qe(r,i))}function Qe(n,t){j[t]=n}function Ye(n){const t=e=>n.indexOf(e)!==-1;return t("5A")?"Augmented":t("3M")?"Major":t("5d")?"Diminished":t("3m")?"Minor":"Unknown"}qe.forEach(([n,t,e])=>ct(n.split(" "),e.split(" "),t));R.sort((n,t)=>n.setNum-t.setNum);var mt={names:He,symbols:Le,get:Sn,all:k,add:ct,removeAll:Ke,keys:Ue,entries:Xe,chordType:Be};const Ze=n=>{const t=n.reduce((e,o)=>{const r=m(o).chroma;return r!==void 0&&(e[r]=e[r]||m(o).name),e},{});return e=>t[e]};function Je(n){const t=n.map(o=>m(o).pc).filter(o=>o);return m.length===0?[]:We(t,1).filter(o=>o.weight).sort((o,r)=>r.weight-o.weight).map(o=>o.name)}function We(n,t){const e=n[0],o=m(e).chroma,r=Ze(n),i=jn(n,!1),a=[];return i.forEach((s,c)=>{k().filter(u=>u.chroma===s).forEach(u=>{const d=u.aliases[0],M=r(c);c!==o?a.push({weight:.5*t,name:`${M}${d}/${e}`}):a.push({weight:1*t,name:`${M}${d}`})})}),a}const no=[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 2A 3M 4A 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 4A 5P 6M 7m","dorian #4","ukrainian dorian","romanian minor","altered dorian"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]],to={...T,intervals:[],aliases:[]};let mn=[],S={};function ut(){return mn.map(n=>n.name)}function un(n){return S[n]||to}const eo=g("ScaleDictionary.scaleType","ScaleType.get",un);function L(){return mn.slice()}const oo=g("ScaleDictionary.entries","ScaleType.all",L);function ro(){return Object.keys(S)}function io(){mn=[],S={}}function lt(n,t,e=[]){const o={...p(n),name:t,intervals:n,aliases:e};return mn.push(o),S[o.name]=o,S[o.setNum]=o,S[o.chroma]=o,o.aliases.forEach(r=>ao(o,r)),o}function ao(n,t){S[t]=n}no.forEach(([n,t,...e])=>lt(n.split(" "),t,e));var dt={names:ut,get:un,all:L,add:lt,removeAll:io,keys:ro,entries:oo,scaleType:eo};const gn={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},so=/^(6|64|7|9|11|13)$/;function ln(n){const[t,e,o,r]=rn(n);return t===""?["",n]:t==="A"&&r==="ug"?["","aug"]:!r&&(o==="4"||o==="5")?[t+e,o]:so.test(o)?[t+e,o+r]:[t+e+o,r]}function U(n){if(n==="")return gn;if(Array.isArray(n)&&n.length===2)return Z(n[1],n[0]);{const[t,e]=ln(n),o=Z(e,t);return o.empty?Z(n):o}}function Z(n,t,e){const o=Sn(n),r=m(t||""),i=m(e||"");if(o.empty||t&&r.empty||e&&i.empty)return gn;const a=D(r.pc,i.pc),s=o.intervals.indexOf(a)+1;if(!i.empty&&!s)return gn;const c=Array.from(o.intervals);for(let M=1;MP(r,M));n=o.aliases.indexOf(n)!==-1?n:o.aliases[0];const u=`${r.empty?"":r.pc}${n}${i.empty||s<=1?"":"/"+i.pc}`,d=`${t?r.pc+" ":""}${o.name}${s>1&&e?" over "+i.pc:""}`;return{...o,name:d,symbol:u,type:o.name,root:i.name,intervals:c,rootDegree:s,tonic:r.name,notes:l}}const co=g("Chord.chord","Chord.get",U);function mo(n,t){const[e,o]=ln(n);return e?P(e,t)+o:n}function uo(n){const t=U(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function lo(n){const t=U(n),e=cn(t.chroma);return k().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}function Mo(n){const t=U(n),e=sn(t.chroma);return k().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}var fo={getChord:Z,get:U,detect:Je,chordScales:uo,extended:lo,reduced:Mo,tokenize:ln,transpose:mo,chord:co};const Po=[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]],dn=[];Po.forEach(([n,t,e])=>$o(n,t,e));const po={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};function ho(){return dn.reduce((n,t)=>(t.names.forEach(e=>n.push(e)),n),[])}function yo(){return dn.map(n=>n.shorthand)}const go=/^([^.]+)(\.*)$/;function Tn(n){const[t,e,o]=go.exec(n)||[],r=dn.find(s=>s.shorthand===e||s.names.includes(e));if(!r)return po;const i=No(r.fraction,o.length),a=i[0]/i[1];return{...r,name:n,dots:o,value:a,fraction:i}}const bo=n=>Tn(n).value,Ao=n=>Tn(n).fraction;var vo={names:ho,shorthands:yo,get:Tn,value:bo,fraction:Ao};function $o(n,t,e){dn.push({empty:!1,dots:"",name:"",value:1/n,fraction:n<1?[1/n,1]:[1,n],shorthand:t,names:e})}function No(n,t){const e=Math.pow(2,t);let o=n[0]*e,r=n[1]*e;const i=o;for(let a=0;af(n).name,So=n=>f(n).semitones,To=n=>f(n).q,Vo=n=>f(n).num;function ft(n){const t=f(n);return t.empty?"":t.simple+t.q}function _o(n){const t=f(n);if(t.empty)return"";const e=(7-t.step)%7,o=t.type==="perfectable"?-t.alt:-(t.alt+1);return f({step:e,alt:o,oct:t.oct,dir:t.dir}).name}const Co=[1,2,2,3,3,4,5,5,6,6,7,7],wo="P m M m M P d P m M m M".split(" ");function xo(n){const t=n<0?-1:1,e=Math.abs(n),o=e%12,r=Math.floor(e/12);return t*(Co[o]+7*r)+wo[o]}const Eo=D,Pt=ht((n,t)=>[n[0]+t[0],n[1]+t[1]]),Do=n=>t=>Pt(n,t),Ro=ht((n,t)=>[n[0]-t[0],n[1]-t[1]]);function pt(n,t){const e=Mt(n);if(e.empty)return"";const[o,r,i]=e.coord;return B([o+t,r,i]).name}var bn={names:Io,get:Mt,name:jo,num:Vo,semitones:So,quality:To,fromSemitones:xo,distance:Eo,invert:_o,simplify:ft,add:Pt,addTo:Do,substract:Ro,transposeFifths:pt};function ht(n){return(t,e)=>{const o=f(t).coord,r=f(e).coord;if(o&&r){const i=n(o,r);return B(i).name}}}function yt(n){return+n>=0&&+n<=127}function gt(n){if(yt(n))return+n;const t=m(n);return t.empty?null:t.midi}function ko(n,t=440){return Math.pow(2,(n-69)/12)*t}const Oo=Math.log(2),Fo=Math.log(440);function Vn(n){const t=12*(Math.log(n)-Fo)/Oo+69;return Math.round(t*100)/100}const zo="C C# D D# E F F# G G# A A# B".split(" "),qo="C Db D Eb E F Gb G Ab A Bb B".split(" ");function I(n,t={}){if(isNaN(n)||n===-1/0||n===1/0)return"";n=Math.round(n);const o=(t.sharps===!0?zo:qo)[n%12];if(t.pitchClass)return o;const r=Math.floor(n/12)-1;return o+r}var Go={isMidi:yt,toMidi:gt,midiToFreq:ko,midiToNoteName:I,freqToMidi:Vn};const Bo=["C","D","E","F","G","A","B"],bt=n=>n.name,At=n=>n.map(m).filter(t=>!t.empty);function Ho(n){return n===void 0?Bo.slice():Array.isArray(n)?At(n).map(bt):[]}const y=m,Lo=n=>y(n).name,Uo=n=>y(n).pc,Xo=n=>y(n).acc,Ko=n=>y(n).oct,Qo=n=>y(n).midi,Yo=n=>y(n).freq,Zo=n=>y(n).chroma;function vt(n){return I(n)}function Jo(n){return I(Vn(n))}function Wo(n){return I(Vn(n),{sharps:!0})}function nr(n){return I(n,{sharps:!0})}const _n=P,tr=P,$t=n=>t=>_n(t,n),er=$t,Nt=n=>t=>_n(n,t),or=Nt;function nn(n,t){const e=y(n);if(e.empty)return"";const[o,r]=e.coord;return F(r===void 0?[o+t]:[o+t,r]).name}const rr=nn,Cn=(n,t)=>n.height-t.height,ir=(n,t)=>t.height-n.height;function It(n,t){return t=t||Cn,At(n).sort(t).map(bt)}function jt(n){return It(n,Cn).filter((t,e,o)=>e===0||t!==o[e-1])}const ar=n=>{const t=y(n);return t.empty?"":I(t.midi||t.chroma,{sharps:t.alt>0,pitchClass:t.midi===null})};function St(n,t){const e=y(n);if(e.empty)return"";const o=y(t||I(e.midi||e.chroma,{sharps:e.alt<0,pitchClass:!0}));if(o.empty||o.chroma!==e.chroma)return"";if(e.oct===void 0)return o.pc;const r=e.chroma-e.alt,i=o.chroma-o.alt,a=r>11||i<0?-1:r<0||i>11?1:0,s=e.oct+a;return o.pc+s}var w={names:Ho,get:y,name:Lo,pitchClass:Uo,accidentals:Xo,octave:Ko,midi:Qo,ascending:Cn,descending:ir,sortedNames:It,sortedUniqNames:jt,fromMidi:vt,fromMidiSharps:nr,freq:Yo,fromFreq:Jo,fromFreqSharps:Wo,chroma:Zo,transpose:_n,tr,transposeBy:$t,trBy:er,transposeFrom:Nt,trFrom:or,transposeFifths:nn,trFifths:rr,simplify:ar,enharmonic:St};const Tt={empty:!0,name:"",chordType:""},qn={};function $(n){return typeof n=="string"?qn[n]||(qn[n]=Mr(n)):typeof n=="number"?$(Mn[n]||""):q(n)?mr(n):z(n)?$(n.name):Tt}const sr=g("RomanNumeral.romanNumeral","RomanNumeral.get",$);function cr(n=!0){return(n?Mn:dr).slice()}function mr(n){return $(E(n.alt)+Mn[n.step])}const ur=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;function lr(n){return ur.exec(n)||["","","",""]}const Vt="I II III IV V VI VII",Mn=Vt.split(" "),dr=Vt.toLowerCase().split(" ");function Mr(n){const[t,e,o,r]=lr(n);if(!o)return Tt;const i=o.toUpperCase(),a=Mn.indexOf(i),s=G(e),c=1;return{empty:!1,name:t,roman:o,interval:f({step:a,alt:s,dir:c}).name,acc:e,chordType:r,alt:s,step:a,major:o===i,oct:0,dir:c}}var fr={names:cr,get:$,romanNumeral:sr};const b=Object.freeze([]),_t={type:"major",tonic:"",alteration:0,keySignature:""},J={tonic:"",grades:b,intervals:b,scale:b,chords:b,chordsHarmonicFunction:b,chordScales:b},Pr={..._t,...J,type:"major",minorRelative:"",scale:b,secondaryDominants:b,secondaryDominantsMinorRelative:b,substituteDominants:b,substituteDominantsMinorRelative:b},pr={..._t,type:"minor",relativeMajor:"",natural:J,harmonic:J,melodic:J},Gn=(n,t,e="")=>t.map((o,r)=>`${n[r]}${e}${o}`);function fn(n,t,e,o){return r=>{const i=n.map(s=>$(s).interval||""),a=i.map(s=>P(r,s));return{tonic:r,grades:n,intervals:i,scale:a,chords:Gn(a,t),chordsHarmonicFunction:e.slice(),chordScales:Gn(a,o," ")}}}const Ct=(n,t)=>{const e=m(n),o=m(t);return e.empty||o.empty?0:o.coord[0]-e.coord[0]},hr=fn("I II III IV V VI VII".split(" "),"maj7 m7 m7 maj7 7 m7 m7b5".split(" "),"T SD T SD D T D".split(" "),"major,dorian,phrygian,lydian,mixolydian,minor,locrian".split(",")),yr=fn("I II bIII IV V bVI bVII".split(" "),"m7 m7b5 maj7 m7 m7 maj7 7".split(" "),"T SD T SD D SD SD".split(" "),"minor,locrian,major,dorian,phrygian,lydian,mixolydian".split(",")),gr=fn("I II bIII IV V bVI VII".split(" "),"mMaj7 m7b5 +maj7 m7 7 maj7 o7".split(" "),"T SD T SD D SD D".split(" "),"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian".split(",")),br=fn("I II bIII IV V VI VII".split(" "),"m6 m7 +maj7 7 7 m7b5 m7b5".split(" "),"T SD T SD D ".split(" "),"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered".split(","));function Ar(n){const t=m(n).pc;if(!t)return Pr;const e=hr(t),o=Ct("C",t),r=i=>{const a=$(i);return a.empty?"":P(n,a.interval)+a.chordType};return{...e,type:"major",minorRelative:P(t,"-3m"),alteration:o,keySignature:E(o),secondaryDominants:"- VI7 VII7 I7 II7 III7 -".split(" ").map(r),secondaryDominantsMinorRelative:"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -".split(" ").map(r),substituteDominants:"- bIII7 IV7 bV7 bVI7 bVII7 -".split(" ").map(r),substituteDominantsMinorRelative:"- IIIm7 Im7 IIbm7 VIm7 IVm7 -".split(" ").map(r)}}function vr(n){const t=m(n).pc;if(!t)return pr;const e=Ct("C",t)-3;return{type:"minor",tonic:t,relativeMajor:P(t,"3m"),alteration:e,keySignature:E(e),natural:yr(t),harmonic:gr(t),melodic:br(t)}}function $r(n){return typeof n=="number"?nn("C",n):typeof n=="string"&&/^b+|#+$/.test(n)?nn("C",G(n)):null}var Nr={majorKey:Ar,majorTonicFromKeySignature:$r,minorKey:vr};const wn=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]],Bn={...T,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},xn=wn.map(Tr),An={};xn.forEach(n=>{An[n.name]=n,n.aliases.forEach(t=>{An[t]=n})});function V(n){return typeof n=="string"?An[n.toLowerCase()]||Bn:n&&n.name?V(n.name):Bn}const Ir=g("Mode.mode","Mode.get",V);function wt(){return xn.slice()}const jr=g("Mode.mode","Mode.all",wt);function Sr(){return xn.map(n=>n.name)}function Tr(n){const[t,e,o,r,i,a,s]=n,c=s?[s]:[],l=Number(e).toString(2);return{empty:!1,intervals:un(r).intervals,modeNum:t,chroma:l,normalized:l,name:r,setNum:e,alt:o,triad:i,seventh:a,aliases:c}}function Vr(n,t){return V(n).intervals.map(e=>P(t,e))}function xt(n){return(t,e)=>{const o=V(t);if(o.empty)return[];const r=H(o.modeNum,n),i=o.intervals.map(a=>P(e,a));return r.map((a,s)=>i[s]+a)}}const _r=xt(wn.map(n=>n[4])),Cr=xt(wn.map(n=>n[5]));function Et(n,t){const e=V(t),o=V(n);return e.empty||o.empty?"":ft(pt("1P",o.alt-e.alt))}function wr(n,t,e){return P(e,Et(n,t))}var xr={get:V,names:Sr,all:wt,distance:Et,relativeTonic:wr,notes:Vr,triads:_r,seventhChords:Cr,entries:jr,mode:Ir};function Er(n,t){return t.map($).map(o=>P(n,f(o))+o.chordType)}function Dr(n,t){return t.map(e=>{const[o,r]=ln(e),i=D(n,o);return $(f(i)).name+r})}var Rr={fromRomanNumerals:Er,toRomanNumerals:Dr};function Dt(n){const t=Nn(n.map(gt));return!n.length||t.length!==n.length?[]:t.reduce((e,o)=>{const r=e[e.length-1];return e.concat(an(r,o).slice(1))},[t[0]])}function kr(n,t){return Dt(n).map(e=>I(e,t))}var Or={numeric:Dt,chromatic:kr};const Fr={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function Rt(n){if(typeof n!="string")return["",""];const t=n.indexOf(" "),e=m(n.substring(0,t));if(e.empty){const r=m(n);return r.empty?["",n]:[r.name,""]}const o=n.substring(e.name.length+1);return[e.name,o.length?o:""]}const zr=ut;function N(n){const t=Array.isArray(n)?n:Rt(n),e=m(t[0]).name,o=un(t[1]);if(o.empty)return Fr;const r=o.name,i=e?o.intervals.map(s=>P(e,s)):[],a=e?e+" "+r:r;return{...o,name:a,type:r,tonic:e,notes:i}}const qr=g("Scale.scale","Scale.get",N);function Gr(n){const t=N(n),e=sn(t.chroma);return k().filter(o=>e(o.chroma)).map(o=>o.aliases[0])}function Br(n){const t=N(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function Hr(n){const t=sn(N(n).chroma);return L().filter(e=>t(e.chroma)).map(e=>e.name)}function kt(n){const t=n.map(r=>m(r).pc).filter(r=>r),e=t[0],o=jt(t);return H(o.indexOf(e),o)}function Lr(n){const t=N(n);if(t.empty)return[];const e=t.tonic?t.notes:t.intervals;return jn(t.chroma).map((o,r)=>{const i=N(o).name;return i?[e[r],i]:["",""]}).filter(o=>o[0])}function Ur(n){const t=Array.isArray(n)?kt(n):N(n).notes,e=t.map(o=>m(o).chroma);return o=>{const r=m(typeof o=="number"?vt(o):o),i=r.height;if(i===void 0)return;const a=i%12,s=e.indexOf(a);if(s!==-1)return St(r.name,t[s])}}function Xr(n){const t=Ur(n);return(e,o)=>{const r=m(e).height,i=m(o).height;return r===void 0||i===void 0?[]:an(r,i).map(t).filter(a=>a)}}var tn={get:N,names:zr,extended:Br,modeNames:Lr,reduced:Hr,scaleChords:Gr,scaleNotes:kt,tokenize:Rt,rangeOf:Xr,scale:qr};const Kr={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},Qr=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];function Yr(){return Qr.slice()}const Zr=/^(\d?\d(?:\+\d)*)\/(\d)$/,Hn=new Map;function Jr(n){const t=Hn.get(n);if(t)return t;const e=ni(En(n));return Hn.set(n,e),e}function En(n){if(typeof n=="string"){const[i,a,s]=Zr.exec(n)||[];return En([a,s])}const[t,e]=n,o=+e;if(typeof t=="number")return[t,o];const r=t.split("+").map(i=>+i);return r.length===1?[r[0],o]:[r,o]}var Wr={names:Yr,parse:En,get:Jr};function ni([n,t]){const e=Array.isArray(n)?n.reduce((s,c)=>s+c,0):n,o=t;if(e===0||o===0)return Kr;const r=Array.isArray(n)?`${n.join("+")}/${t}`:`${n}/${t}`,i=Array.isArray(n)?n:[],a=o===4||o===2?"simple":o===8&&e%3===0?"compound":"irregular";return{empty:!1,name:r,type:a,upper:e,lower:o,additive:i}}const ti=Wn,ei=st,oi=mt,ri=dt,ii=Object.freeze(Object.defineProperty({__proto__:null,Array:Ae,Core:Wn,ChordDictionary:oi,PcSet:ei,ScaleDictionary:ri,Tonal:ti,AbcNotation:Me,Chord:fo,ChordType:mt,Collection:Ie,DurationValue:vo,Interval:bn,Key:Nr,Midi:Go,Mode:xr,Note:w,Pcset:st,Progression:Rr,Range:Or,RomanNumeral:fr,Scale:tn,ScaleType:dt,TimeSignature:Wr,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"}));function Ot(n,t,e){let[o,r]=tn.tokenize(n),{notes:i}=tn.get(`${o} ${r}`);if(i=i.map(h=>w.get(h).pc),t=Number(t),isNaN(t))throw new Error(`scale offset "${t}" not a number`);const{pc:a,oct:s=3}=w.get(e),c=i.indexOf(a);if(c===-1)throw new Error(`note "${e}" is not in scale "${n}"`);let l=c,u=s,d=a;const M=Math.sign(t);for(;Math.abs(l-c)0&&d[0]==="C"&&(u+=M)}return d+u}_.prototype._transpose=function(n){return this._withHap(t=>{const e=isNaN(Number(n))?String(n):bn.fromSemitones(n);if(typeof t.value=="number"){const o=typeof e=="string"?bn.semitones(e)||0:e;return t.withValue(()=>t.value+o)}return t.withValue(()=>w.simplify(w.transpose(t.value,e)))})};_.prototype._scaleTranspose=function(n){return this._withHap(t=>{if(!t.context.scale)throw new Error("can only use scaleTranspose after .scale");if(typeof t.value!="string")throw new Error("can only use scaleTranspose with notes");return t.withValue(()=>Ot(t.context.scale,Number(n),t.value))})};_.prototype._scale=function(n){return this._withHap(t=>{let e=t.value;const o=Number(e);if(!isNaN(o)){let[r,i]=tn.tokenize(n);const{pc:a,oct:s=3}=w.get(r);e=Ot(a+" "+i,o,a+s)}return t.withValue(()=>e).setContext({...t.context,scale:n})})};_.prototype.define("transpose",(n,t)=>t.transpose(n),{composable:!0,patternified:!0});_.prototype.define("scale",(n,t)=>t.scale(n),{composable:!0,patternified:!0});_.prototype.define("scaleTranspose",(n,t)=>t.scaleTranspose(n),{composable:!0,patternified:!0});var Ft={},hn={},X={};X.__esModule=!0;X.getBestVoicing=void 0;function ai(n){var t=n.chord,e=n.range,o=n.finder,r=n.picker,i=n.lastVoicing,a=o(t,e);return a.length?r(a,i):[]}X.getBestVoicing=ai;var O={};const zt=Ut(ii);var K={};K.__esModule=!0;K.tokenizeChord=void 0;function si(n){var t=(n||"").match(/^([A-G][b#]*)([^\/]*)[\/]?([A-G][b#]*)?$/);return t?t.slice(1):[]}K.tokenizeChord=si;var Ln;function ci(){if(Ln)return O;Ln=1,O.__esModule=!0,O.voicingsInRange=void 0;var n=zt,t=qt(),e=K;function o(r,i,a){i===void 0&&(i=t.lefthand),a===void 0&&(a=["D3","A4"]);var s=(0,e.tokenizeChord)(r),c=s[0],l=s[1];if(!i[l])return[];var u=i[l].map(function(M){return M.split(" ")}),d=n.Range.chromatic(a);return u.reduce(function(M,h){var A=h.map(function(v){return n.Interval.substract(v,h[0])}),Q=n.Note.transpose(c,h[0]),Gt=d.filter(function(v){return n.Note.chroma(v)===n.Note.chroma(Q)}).filter(function(v){return n.Note.midi(n.Note.transpose(v,A[A.length-1]))<=n.Note.midi(a[1])}).map(function(v){return n.Note.enharmonic(v,Q)}),Bt=Gt.map(function(v){return A.map(function(Ht){return n.Note.transpose(v,Ht)})});return M.concat(Bt)},[])}return O.voicingsInRange=o,O}var Un;function qt(){return Un||(Un=1,function(n){var t=Y&&Y.__assign||function(){return t=Object.assign||function(s){for(var c,l=1,u=arguments.length;lui({chord:n,dictionary:di,range:e,picker:li,lastVoicing:t}),x=_;x.prototype.fmapNested=function(n){return new x(t=>this.query(t).map(e=>Kt(n(e)).query(t).map(o=>new Qt(e.whole,e.part,o.value,o.context))).flat())};x.prototype.voicings=function(n){let t;return n!=null&&n.length||(n=["F3","A4"]),this.fmapNested(e=>(t=Mi(e.value,t,n),Yt(...t)._withContext(()=>({locations:e.context.locations||[]}))))};x.prototype._rootNotes=function(n=2){return this.fmap(t=>{const[e,o]=t.match(/^([a-gA-G][b#]?).*$/);return o+n})};x.prototype.define("voicings",(n,t)=>t.voicings(n),{composable:!0});x.prototype.define("rootNotes",(n,t)=>t.rootNotes(n),{composable:!0,patternified:!0}); diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.b66fb637.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.b66fb637.js deleted file mode 100644 index 3e89ede1..00000000 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.b66fb637.js +++ /dev/null @@ -1 +0,0 @@ -import{g as s,b as d,e as t,j as u,l as o,f as r,p as f,i as p,d as g,h as i,w as l,a as m}from"./index.f88145a1.js";export{s as getAudioContext,d as getCachedBuffer,t as getLoadedBuffer,u as getLoadedSamples,o as loadBuffer,r as loadGithubSamples,f as panic,p as resetLoadedSamples,g as reverseBuffer,i as samples,l as webaudioOutput,m as webaudioOutputTrigger}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.d9f8bbbd.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.d9f8bbbd.js deleted file mode 100644 index 5a3aae28..00000000 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.d9f8bbbd.js +++ /dev/null @@ -1,8 +0,0 @@ -import{c as ut,r as Se,s as pt}from"./index.f88145a1.js";function gt(a,c){function r(){this.constructor=a}r.prototype=c.prototype,a.prototype=new r}function D(a,c,r,_){var p=Error.call(this,a);return Object.setPrototypeOf&&Object.setPrototypeOf(p,D.prototype),p.expected=c,p.found=r,p.location=_,p.name="SyntaxError",p}gt(D,Error);function U(a,c,r){return r=r||" ",a.length>c?a:(c-=a.length,r+=r.repeat(c),a+r.slice(0,c))}D.prototype.format=function(a){var c="Error: "+this.message;if(this.location){var r=null,_;for(_=0;_ `+$+` -`+A+` | -`+p.line+" | "+E+` -`+A+" | "+U("",p.column-1," ")+U("",h,"^")}else c+=` - at `+$}return c};D.buildMessage=function(a,c){var r={literal:function(m){return'"'+p(m.text)+'"'},class:function(m){var h=m.parts.map(function(b){return Array.isArray(b)?$(b[0])+"-"+$(b[1]):$(b)});return"["+(m.inverted?"^":"")+h.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(m){return m.description}};function _(m){return m.charCodeAt(0).toString(16).toUpperCase()}function p(m){return m.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(h){return"\\x0"+_(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+_(h)})}function $(m){return m.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(h){return"\\x0"+_(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+_(h)})}function w(m){return r[m.type](m)}function A(m){var h=m.map(w),b,F;if(h.sort(),h.length>0){for(b=1,F=1;b",Me="@",We="!",Ze="(",Ge=")",Ue="/",Xe="*",He="%",Je="?",V="struct",Y="target",ee="euclid",re="slow",se="rotL",te="rotR",ne="fast",ae="scale",ie="//",fe="cat",Ke="$",oe="setcps",ce="setbpm",le="hush",Qe=/^[1-9]/,Ve=/^[eE]/,Ye=/^[0-9]/,ue=/^[ \n\r\t]/,er=/^[0-9a-zA-Z~]/,pe=/^[^\n]/,rr=Ae("number"),ge=g(".",!1),sr=j([["1","9"]],!1,!1),tr=j(["e","E"],!1,!1),ve=g("-",!1),nr=g("+",!1),ar=g("0",!1),ir=j([["0","9"]],!1,!1),fr=Ae("whitespace"),$e=j([" ",` -`,"\r"," "],!1,!1),or=g(",",!1),cr=g("|",!1),lr=g('"',!1),ur=g("'",!1),pr=j([["0","9"],["a","z"],["A","Z"],"~"],!1,!1),gr=g("#",!1),vr=g("^",!1),$r=g("_",!1),hr=g(":",!1),he=g("[",!1),me=g("]",!1),mr=g("<",!1),_r=g(">",!1),dr=g("@",!1),Ar=g("!",!1),wr=g("(",!1),yr=g(")",!1),br=g("/",!1),Cr=g("*",!1),xr=g("%",!1),Er=g("?",!1),Fr=g("struct",!1),jr=g("target",!1),Sr=g("euclid",!1),Rr=g("slow",!1),Pr=g("rotL",!1),Or=g("rotR",!1),qr=g("fast",!1),Ir=g("scale",!1),Dr=g("//",!1),_e=j([` -`],!0,!1),kr=g("cat",!1),Nr=g("$",!1),Br=g("setcps",!1),Tr=g("setbpm",!1),zr=g("hush",!1),Lr=function(){return parseFloat(As())},Mr=function(e){return e.join("")},Wr=function(e){return e},Zr=function(e){return e.arguments_.alignment="t",e},Gr=function(e){return{weight:e}},Ur=function(e){return{replicate:e}},Xr=function(e,t,n){return{operator:{type_:"bjorklund",arguments_:{pulse:e,step:t,rotation:n||0}}}},Hr=function(e){return{operator:{type_:"stretch",arguments_:{amount:e}}}},Jr=function(e){return{operator:{type_:"stretch",arguments_:{amount:"1/"+e}}}},Kr=function(e){return{operator:{type_:"fixed-step",arguments_:{amount:e}}}},Qr=function(e){return{operator:{type_:"degradeBy",arguments_:{amount:e||.5}}}},Vr=function(e,t){return new lt(e,t)},Yr=function(e){return new Z(e,"h")},es=function(e){return{alignment:"v",list:e}},rs=function(e){return{alignment:"r",list:e}},ss=function(e,t){return t&&t.list.length>0?new Z([e,...t.list],t.alignment):e},ts=function(e){return e},ns=function(e){return{name:"struct",args:{sequence:e}}},as=function(e){return{name:"target",args:{name:e}}},is=function(e,t,n){return{name:"bjorklund",args:{pulse:parseInt(e),step:parseInt(t)}}},fs=function(e){return{name:"stretch",args:{amount:e}}},os=function(e){return{name:"shift",args:{amount:"-"+e}}},cs=function(e){return{name:"shift",args:{amount:e}}},ls=function(e){return{name:"stretch",args:{amount:"1/"+e}}},us=function(e){return{name:"scale",args:{scale:e.join("")}}},de=function(e,t){return t},ps=function(e,t){return t.unshift(e),new Z(t,"t")},gs=function(e){return e},vs=function(e,t){return new ct(e.name,e.args,t)},$s=function(e){return e},hs=function(e){return e},ms=function(e){return new G("setcps",{value:e})},_s=function(e){return new G("setcps",{value:e/120/2})},ds=function(){return new G("hush")},s=0,v=0,N=[{line:1,column:1}],x=0,L=[],f=0,B;if("startRule"in c){if(!(c.startRule in p))throw new Error(`Can't start parsing from rule "`+c.startRule+'".');$=p[c.startRule]}function As(){return a.substring(v,s)}function ws(){return M(v,s)}function g(e,t){return{type:"literal",text:e,ignoreCase:t}}function j(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function ys(){return{type:"end"}}function Ae(e){return{type:"other",description:e}}function we(e){var t=N[e],n;if(t)return t;for(n=e-1;!N[n];)n--;for(t=N[n],t={line:t.line,column:t.column};nx&&(x=s,L=[]),L.push(e))}function bs(e,t,n){return new D(D.buildMessage(e,t),e,t,n)}function ye(){var e;return e=ot(),e}function y(){var e,t;return f++,e=s,be(),t=T(),t!==r?(js(),Fs(),v=e,e=Lr()):(s=e,e=r),f--,e===r&&f===0&&o(rr),e}function Cs(){var e;return a.charCodeAt(s)===46?(e=w,s++):(e=r,f===0&&o(ge)),e}function xs(){var e;return Qe.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(sr)),e}function Es(){var e;return Ve.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(tr)),e}function Fs(){var e,t,n,i,l;if(e=s,t=Es(),t!==r){if(n=be(),n===r&&(n=Ss()),n===r&&(n=null),i=[],l=S(),l!==r)for(;l!==r;)i.push(l),l=S();else i=r;i!==r?(t=[t,n,i],e=t):(s=e,e=r)}else s=e,e=r;return e}function js(){var e,t,n,i;if(e=s,t=Cs(),t!==r){if(n=[],i=S(),i!==r)for(;i!==r;)n.push(i),i=S();else n=r;n!==r?(t=[t,n],e=t):(s=e,e=r)}else s=e,e=r;return e}function T(){var e,t,n,i;if(e=Rs(),e===r)if(e=s,t=xs(),t!==r){for(n=[],i=S();i!==r;)n.push(i),i=S();t=[t,n],e=t}else s=e,e=r;return e}function be(){var e;return a.charCodeAt(s)===45?(e=A,s++):(e=r,f===0&&o(ve)),e}function Ss(){var e;return a.charCodeAt(s)===43?(e=E,s++):(e=r,f===0&&o(nr)),e}function Rs(){var e;return a.charCodeAt(s)===48?(e=m,s++):(e=r,f===0&&o(ar)),e}function S(){var e;return Ye.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(ir)),e}function u(){var e,t;for(f++,e=[],ue.test(a.charAt(s))?(t=a.charAt(s),s++):(t=r,f===0&&o($e));t!==r;)e.push(t),ue.test(a.charAt(s))?(t=a.charAt(s),s++):(t=r,f===0&&o($e));return f--,t=r,f===0&&o(fr),e}function R(){var e,t,n,i;return e=s,t=u(),a.charCodeAt(s)===44?(n=h,s++):(n=r,f===0&&o(or)),n!==r?(i=u(),t=[t,n,i],e=t):(s=e,e=r),e}function Ce(){var e,t,n,i;return e=s,t=u(),a.charCodeAt(s)===124?(n=b,s++):(n=r,f===0&&o(cr)),n!==r?(i=u(),t=[t,n,i],e=t):(s=e,e=r),e}function P(){var e;return a.charCodeAt(s)===34?(e=F,s++):(e=r,f===0&&o(lr)),e===r&&(a.charCodeAt(s)===39?(e=De,s++):(e=r,f===0&&o(ur))),e}function z(){var e;return er.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(pr)),e===r&&(a.charCodeAt(s)===45?(e=A,s++):(e=r,f===0&&o(ve)),e===r&&(a.charCodeAt(s)===35?(e=ke,s++):(e=r,f===0&&o(gr)),e===r&&(a.charCodeAt(s)===46?(e=w,s++):(e=r,f===0&&o(ge)),e===r&&(a.charCodeAt(s)===94?(e=Ne,s++):(e=r,f===0&&o(vr)),e===r&&(a.charCodeAt(s)===95?(e=Be,s++):(e=r,f===0&&o($r)),e===r&&(a.charCodeAt(s)===58?(e=Te,s++):(e=r,f===0&&o(hr)))))))),e}function xe(){var e,t,n;if(e=s,u(),t=[],n=z(),n!==r)for(;n!==r;)t.push(n),n=z();else t=r;return t!==r?(n=u(),v=e,e=Mr(t)):(s=e,e=r),e}function Ps(){var e,t,n,i;return e=s,u(),a.charCodeAt(s)===91?(t=K,s++):(t=r,f===0&&o(he)),t!==r?(u(),n=Fe(),n!==r?(u(),a.charCodeAt(s)===93?(i=Q,s++):(i=r,f===0&&o(me)),i!==r?(u(),v=e,e=Wr(n)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Os(){var e,t,n,i;return e=s,u(),a.charCodeAt(s)===60?(t=ze,s++):(t=r,f===0&&o(mr)),t!==r?(u(),n=O(),n!==r?(u(),a.charCodeAt(s)===62?(i=Le,s++):(i=r,f===0&&o(_r)),i!==r?(u(),v=e,e=Zr(n)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function qs(){var e;return e=xe(),e===r&&(e=Ps(),e===r&&(e=Os())),e}function Is(){var e;return e=Ds(),e===r&&(e=Ns(),e===r&&(e=Bs(),e===r&&(e=Ts(),e===r&&(e=zs(),e===r&&(e=ks(),e===r&&(e=Ls())))))),e}function Ds(){var e,t,n;return e=s,a.charCodeAt(s)===64?(t=Me,s++):(t=r,f===0&&o(dr)),t!==r?(n=y(),n!==r?(v=e,e=Gr(n)):(s=e,e=r)):(s=e,e=r),e}function ks(){var e,t,n;return e=s,a.charCodeAt(s)===33?(t=We,s++):(t=r,f===0&&o(Ar)),t!==r?(n=y(),n!==r?(v=e,e=Ur(n)):(s=e,e=r)):(s=e,e=r),e}function Ns(){var e,t,n,i,l,d,C;return e=s,a.charCodeAt(s)===40?(t=Ze,s++):(t=r,f===0&&o(wr)),t!==r?(u(),n=y(),n!==r?(u(),i=R(),i!==r?(u(),l=y(),l!==r?(u(),R(),u(),d=y(),d===r&&(d=null),u(),a.charCodeAt(s)===41?(C=Ge,s++):(C=r,f===0&&o(yr)),C!==r?(v=e,e=Xr(n,l,d)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Bs(){var e,t,n;return e=s,a.charCodeAt(s)===47?(t=Ue,s++):(t=r,f===0&&o(br)),t!==r?(n=y(),n!==r?(v=e,e=Hr(n)):(s=e,e=r)):(s=e,e=r),e}function Ts(){var e,t,n;return e=s,a.charCodeAt(s)===42?(t=Xe,s++):(t=r,f===0&&o(Cr)),t!==r?(n=y(),n!==r?(v=e,e=Jr(n)):(s=e,e=r)):(s=e,e=r),e}function zs(){var e,t,n;return e=s,a.charCodeAt(s)===37?(t=He,s++):(t=r,f===0&&o(xr)),t!==r?(n=y(),n!==r?(v=e,e=Kr(n)):(s=e,e=r)):(s=e,e=r),e}function Ls(){var e,t,n;return e=s,a.charCodeAt(s)===63?(t=Je,s++):(t=r,f===0&&o(Er)),t!==r?(n=y(),n===r&&(n=null),v=e,e=Qr(n)):(s=e,e=r),e}function Ee(){var e,t,n;return e=s,t=qs(),t!==r?(n=Is(),n===r&&(n=null),v=e,e=Vr(t,n)):(s=e,e=r),e}function O(){var e,t,n;if(e=s,t=[],n=Ee(),n!==r)for(;n!==r;)t.push(n),n=Ee();else t=r;return t!==r&&(v=e,t=Yr(t)),e=t,e}function Ms(){var e,t,n,i,l;if(e=s,t=[],n=s,i=R(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r),n!==r)for(;n!==r;)t.push(n),n=s,i=R(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r);else t=r;return t!==r&&(v=e,t=es(t)),e=t,e}function Ws(){var e,t,n,i,l;if(e=s,t=[],n=s,i=Ce(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r),n!==r)for(;n!==r;)t.push(n),n=s,i=Ce(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r);else t=r;return t!==r&&(v=e,t=rs(t)),e=t,e}function Fe(){var e,t,n;return e=s,t=O(),t!==r?(n=Ms(),n===r&&(n=Ws()),n===r&&(n=null),v=e,e=ss(t,n)):(s=e,e=r),e}function Zs(){var e,t,n,i;return e=s,u(),t=P(),t!==r?(n=Fe(),n!==r?(i=P(),i!==r?(v=e,e=ts(n)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Gs(){var e;return e=Ys(),e===r&&(e=Js(),e===r&&(e=Vs(),e===r&&(e=Xs(),e===r&&(e=Hs(),e===r&&(e=Us(),e===r&&(e=Qs(),e===r&&(e=Ks()))))))),e}function Us(){var e,t,n;return e=s,a.substr(s,6)===V?(t=V,s+=6):(t=r,f===0&&o(Fr)),t!==r?(u(),n=q(),n!==r?(v=e,e=ns(n)):(s=e,e=r)):(s=e,e=r),e}function Xs(){var e,t,n,i,l;return e=s,a.substr(s,6)===Y?(t=Y,s+=6):(t=r,f===0&&o(jr)),t!==r?(u(),n=P(),n!==r?(i=xe(),i!==r?(l=P(),l!==r?(v=e,e=as(i)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Hs(){var e,t,n,i;return e=s,a.substr(s,6)===ee?(t=ee,s+=6):(t=r,f===0&&o(Sr)),t!==r?(u(),n=T(),n!==r?(u(),i=T(),i!==r?(u(),T(),v=e,e=is(n,i)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Js(){var e,t,n;return e=s,a.substr(s,4)===re?(t=re,s+=4):(t=r,f===0&&o(Rr)),t!==r?(u(),n=y(),n!==r?(v=e,e=fs(n)):(s=e,e=r)):(s=e,e=r),e}function Ks(){var e,t,n;return e=s,a.substr(s,4)===se?(t=se,s+=4):(t=r,f===0&&o(Pr)),t!==r?(u(),n=y(),n!==r?(v=e,e=os(n)):(s=e,e=r)):(s=e,e=r),e}function Qs(){var e,t,n;return e=s,a.substr(s,4)===te?(t=te,s+=4):(t=r,f===0&&o(Or)),t!==r?(u(),n=y(),n!==r?(v=e,e=cs(n)):(s=e,e=r)):(s=e,e=r),e}function Vs(){var e,t,n;return e=s,a.substr(s,4)===ne?(t=ne,s+=4):(t=r,f===0&&o(qr)),t!==r?(u(),n=y(),n!==r?(v=e,e=ls(n)):(s=e,e=r)):(s=e,e=r),e}function Ys(){var e,t,n,i,l;if(e=s,a.substr(s,5)===ae?(t=ae,s+=5):(t=r,f===0&&o(Ir)),t!==r)if(u(),n=P(),n!==r){if(i=[],l=z(),l!==r)for(;l!==r;)i.push(l),l=z();else i=r;i!==r?(l=P(),l!==r?(v=e,e=us(i)):(s=e,e=r)):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function W(){var e,t,n,i;if(e=s,a.substr(s,2)===ie?(t=ie,s+=2):(t=r,f===0&&o(Dr)),t!==r){for(n=[],pe.test(a.charAt(s))?(i=a.charAt(s),s++):(i=r,f===0&&o(_e));i!==r;)n.push(i),pe.test(a.charAt(s))?(i=a.charAt(s),s++):(i=r,f===0&&o(_e));t=[t,n],e=t}else s=e,e=r;return e}function et(){var e,t,n,i,l,d,C,I;if(e=s,a.substr(s,3)===fe?(t=fe,s+=3):(t=r,f===0&&o(kr)),t!==r)if(u(),a.charCodeAt(s)===91?(n=K,s++):(n=r,f===0&&o(he)),n!==r)if(u(),i=q(),i!==r){for(l=[],d=s,C=R(),C!==r?(I=q(),I!==r?(v=d,d=de(i,I)):(s=d,d=r)):(s=d,d=r);d!==r;)l.push(d),d=s,C=R(),C!==r?(I=q(),I!==r?(v=d,d=de(i,I)):(s=d,d=r)):(s=d,d=r);d=u(),a.charCodeAt(s)===93?(C=Q,s++):(C=r,f===0&&o(me)),C!==r?(v=e,e=ps(i,l)):(s=e,e=r)}else s=e,e=r;else s=e,e=r;else s=e,e=r;return e}function rt(){var e;return e=et(),e===r&&(e=Zs()),e}function q(){var e,t,n,i,l;if(e=s,t=rt(),t!==r){for(u(),n=[],i=W();i!==r;)n.push(i),i=W();v=e,e=gs(t)}else s=e,e=r;return e===r&&(e=s,t=Gs(),t!==r?(u(),a.charCodeAt(s)===36?(n=Ke,s++):(n=r,f===0&&o(Nr)),n!==r?(i=u(),l=q(),l!==r?(v=e,e=vs(t,l)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)),e}function st(){var e,t;return e=s,t=q(),t!==r&&(v=e,t=$s(t)),e=t,e===r&&(e=W()),e}function tt(){var e;return e=st(),e}function nt(){var e,t;return e=s,u(),t=at(),t===r&&(t=it(),t===r&&(t=ft())),t!==r?(u(),v=e,e=hs(t)):(s=e,e=r),e}function at(){var e,t,n;return e=s,a.substr(s,6)===oe?(t=oe,s+=6):(t=r,f===0&&o(Br)),t!==r?(u(),n=y(),n!==r?(v=e,e=ms(n)):(s=e,e=r)):(s=e,e=r),e}function it(){var e,t,n;return e=s,a.substr(s,6)===ce?(t=ce,s+=6):(t=r,f===0&&o(Tr)),t!==r?(u(),n=y(),n!==r?(v=e,e=_s(n)):(s=e,e=r)):(s=e,e=r),e}function ft(){var e,t;return e=s,a.substr(s,4)===le?(t=le,s+=4):(t=r,f===0&&o(zr)),t!==r&&(v=e,t=ds()),e=t,e}function ot(){var e;return e=tt(),e===r&&(e=nt()),e}var Z=function(e,t){this.type_="pattern",this.arguments_={alignment:t},this.source_=e},ct=function(e,t,n){this.type_=e,this.arguments_=t,this.source_=n},lt=function(e,t){this.type_="element",this.source_=e,this.options_=t,this.location_=ws()},G=function(e,t){this.type_="command",this.name_=e,this.options_=t};if(B=$(),B!==r&&s===a.length)return B;throw B!==r&&s(c,r)=>{const p=a.source_[r].options_,$=p==null?void 0:p.operator;if($){switch($.type_){case"stretch":const A=Pe($.arguments_.amount).inverse();return X(c).fast(A);case"bjorklund":return c.euclid($.arguments_.pulse,$.arguments_.step,$.arguments_.rotation);case"degradeBy":return X(c)._degradeByWith(Se.early(qe*Ie()).segment(1),$.arguments_.amount)}console.warn(`operator "${$.type_}" not implemented`)}if(p!=null&&p.weight)return c;const w=Object.keys(p||{}).filter(A=>A!=="operator");return w.length&&console.warn(`option${w.length>1?"s":""} ${w.map(A=>`"${A}"`).join(", ")} not implemented`),c};function At(a){a.source_=a.source_.map(c=>{const{replicate:r,..._}=c.options_||{};return r?{...c,options_:{..._,weight:r},source_:{type_:"pattern",arguments_:{alignment:"h"},source_:[{type_:"element",source_:c.source_,location_:c.location_,options_:{operator:{type_:"stretch",arguments_:{amount:Pe(r).inverse().toString()}}}}]}}:c})}function k(a){switch(a.type_){case"pattern":At(a);const c=a.source_.map(k).map(dt(a)),r=a.arguments_.alignment;if(r==="v")return $t(...c);if(r==="r")return ut(Se.early(qe*Ie()).segment(1),c);const _=a.source_.some(p=>{var $;return!!(($=p.options_)!=null&&$.weight)});if(!_&&r==="t")return ht(...c);if(_){const p=mt(...a.source_.map(($,w)=>{var A;return[((A=$.options_)==null?void 0:A.weight)||1,c[w]]}));if(r==="t"){const $=a.source_.reduce((w,A)=>{var E;return w+(((E=A.options_)==null?void 0:E.weight)||1)},0);return p._slow($)}return p}return Oe(...c);case"element":if(a.source_==="~")return je;if(typeof a.source_!="object"){if(!a.location_)return console.warn("no location for",a),a.source_;const{start:p,end:$}=a.location_,w=isNaN(Number(a.source_))?a.source_:Number(a.source_);return vt(w).withLocation([p.line,p.column,p.offset],[$.line,$.column,$.offset])}return k(a.source_);case"stretch":return k(a.source_).slow(a.arguments_.amount);default:return console.warn(`node type "${a.type_}" not implemented -> returning silence`),je}}const J=(...a)=>{const c=a.map(r=>{const _=Re(`"${r}"`);return k(_)});return Oe(...c)},wt=a=>{const c=Re(a);return k(c)};H.prototype.define("mini",J,{composable:!0});H.prototype.define("m",J,{composable:!0});H.prototype.define("h",wt,{composable:!0});function bt(a){return typeof a=="string"?J(a):X(a)}export{D as SyntaxError,wt as h,J as mini,bt as minify,Re as parse,k as patternifyAST}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.ecddf978.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.ecddf978.js new file mode 100644 index 00000000..7e53038e --- /dev/null +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.ecddf978.js @@ -0,0 +1 @@ +import{g as s,f as d,i as t,n as r,l as u,j as o,d as f,k as p,r as g,s as i,w as l,e as m}from"./index.4cbc0a10.js";export{s as getAudioContext,d as getCachedBuffer,t as getLoadedBuffer,r as getLoadedSamples,u as loadBuffer,o as loadGithubSamples,f as panic,p as resetLoadedSamples,g as reverseBuffer,i as samples,l as webaudioOutput,m as webaudioOutputTrigger}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.f88145a1.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.f88145a1.js deleted file mode 100644 index 55c08661..00000000 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.f88145a1.js +++ /dev/null @@ -1,56 +0,0 @@ -var _t=Object.defineProperty;var It=(s,e,r)=>e in s?_t(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var V=(s,e,r)=>(It(s,typeof e!="symbol"?e+"":e,r),r);const strudel=Object.freeze(Object.defineProperty({__proto__:null,get Fraction(){return fraction},get controls(){return controls},get drawLine(){return drawLine},get gist(){return gist},get Hap(){return Hap},get Pattern(){return Pattern$3},get polyrhythm(){return polyrhythm},get pr(){return pr},get silence(){return silence},get pure(){return pure},get isPattern(){return isPattern$1},get reify(){return reify$1},get stack(){return stack},get slowcat(){return slowcat},get slowcatPrime(){return slowcatPrime},get fastcat(){return fastcat},get cat(){return cat},get timeCat(){return timeCat},get sequence(){return sequence},get seq(){return seq$2},get polymeterSteps(){return polymeterSteps},get polymeter(){return polymeter},get pm(){return pm},get add(){return add},get chop(){return chop},get chunk(){return chunk},get chunkBack(){return chunkBack},get div(){return div},get early(){return early},get echo(){return echo},get every(){return every},get fast(){return fast},get inv(){return inv},get invert(){return invert},get iter(){return iter},get iterBack(){return iterBack},get jux(){return jux},get juxBy(){return juxBy},get late(){return late},get linger(){return linger},get mask(){return mask},get mul(){return mul},get off(){return off},get ply(){return ply},get range(){return range},get rangex(){return rangex},get range2(){return range2},get rev(){return rev},get slow(){return slow},get struct(){return struct},get sub(){return sub},get superimpose(){return superimpose},get set(){return set},get when(){return when},get makeComposable(){return makeComposable},get patternify2(){return patternify2},get patternify3(){return patternify3},get patternify4(){return patternify4},get steady(){return steady},get signal(){return signal},get isaw(){return isaw},get isaw2(){return isaw2},get saw(){return saw},get saw2(){return saw2},get sine2(){return sine2},get sine(){return sine},get cosine(){return cosine},get cosine2(){return cosine2},get square(){return square},get square2(){return square2},get tri(){return tri},get tri2(){return tri2},get time(){return time},get rand(){return rand},get rand2(){return rand2},get _brandBy(){return _brandBy},get brandBy(){return brandBy},get brand(){return brand},get _irand(){return _irand},get irand(){return irand},get __chooseWith(){return __chooseWith},get chooseWith(){return chooseWith},get chooseInWith(){return chooseInWith},get choose(){return choose},get chooseCycles(){return chooseCycles},get randcat(){return randcat},get wchoose(){return wchoose},get wchooseCycles(){return wchooseCycles},get perlinWith(){return perlinWith},get perlin(){return perlin},get State(){return State},get TimeSpan(){return TimeSpan},get isNote(){return isNote$1},get tokenizeNote(){return tokenizeNote},get toMidi(){return toMidi},get fromMidi(){return fromMidi},get getFreq(){return getFreq},get midi2note(){return midi2note},get mod(){return mod},get getPlayableNoteValue(){return getPlayableNoteValue},get getFrequency(){return getFrequency},get rotate(){return rotate},get pipe(){return pipe},get compose(){return compose},get removeUndefineds(){return removeUndefineds},get flatten(){return flatten},get id(){return id},get constant(){return constant},get listRange(){return listRange},get curry(){return curry},get parseNumeral(){return parseNumeral},get mapArgs(){return mapArgs},get numeralArgs(){return numeralArgs},get parseFractional(){return parseFractional},get fractionalArgs(){return fractionalArgs},get ClockWorker(){return ClockWorker},get Scheduler(){return Scheduler},get evalScope(){return evalScope},get evaluate(){return evaluate$1},get repl(){return repl}},Symbol.toStringTag,{value:"Module"}));(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))u(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&u(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerpolicy&&(n.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?n.credentials="include":i.crossorigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function u(i){if(i.ep)return;i.ep=!0;const n=r(i);fetch(i.href,n)}})();const scriptRel="modulepreload",assetsURL=function(s){return"/tidalcycles/strudel/general-purpose-scheduler/packages/core/examples/vite-vanilla-repl/dist/"+s},seen={},__vitePreload=function(e,r,u){if(!r||r.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(r.map(n=>{if(n=assetsURL(n),n in seen)return;seen[n]=!0;const a=n.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!u)for(let A=i.length-1;A>=0;A--){const d=i[A];if(d.href===n&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${l}`))return;const c=document.createElement("link");if(c.rel=a?"stylesheet":scriptRel,a||(c.as="script",c.crossOrigin=""),c.href=n,document.head.appendChild(c),a)return new Promise((A,d)=>{c.addEventListener("load",A),c.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>e())};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function getAugmentedNamespace(s){var e=s.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(s).forEach(function(u){var i=Object.getOwnPropertyDescriptor(s,u);Object.defineProperty(r,u,i.get?i:{enumerable:!0,get:function(){return s[u]}})}),r}var fraction$1={exports:{}};/** - * @license Fraction.js v4.2.0 05/03/2022 - * https://www.xarg.org/2014/03/rational-numbers-in-javascript/ - * - * Copyright (c) 2021, Robert Eisele (robert@xarg.org) - * Dual licensed under the MIT or GPL Version 2 licenses. - **/(function(s,e){(function(r){var u=2e3,i={s:1,n:0,d:1};function n(E,D){if(isNaN(E=parseInt(E,10)))throw f.InvalidParameter;return E*D}function a(E,D){if(D===0)throw f.DivisionByZero;var h=Object.create(f.prototype);h.s=E<0?-1:1,E=E<0?-E:E;var y=m(E,D);return h.n=E/y,h.d=D/y,h}function l(E){for(var D={},h=E,y=2,_=4;_<=h;){for(;h%y===0;)h/=y,D[y]=(D[y]||0)+1;_+=1+2*y++}return h!==E?h>1&&(D[h]=(D[h]||0)+1):D[E]=(D[E]||0)+1,D}var o=function(E,D){var h=0,y=1,_=1,b=0,P=0,B=0,g=1,x=1,C=0,S=1,L=1,$=1,N=1e7,R;if(E!=null)if(D!==void 0){if(h=E,y=D,_=h*y,h%1!==0||y%1!==0)throw f.NonIntegerParameter}else switch(typeof E){case"object":{if("d"in E&&"n"in E)h=E.n,y=E.d,"s"in E&&(h*=E.s);else if(0 in E)h=E[0],1 in E&&(y=E[1]);else throw f.InvalidParameter;_=h*y;break}case"number":{if(E<0&&(_=E,E=-E),E%1===0)h=E;else if(E>0){for(E>=1&&(x=Math.pow(10,Math.floor(1+Math.log(E)/Math.LN10)),E/=x);S<=N&&$<=N;)if(R=(C+L)/(S+$),E===R){S+$<=N?(h=C+L,y=S+$):$>S?(h=L,y=$):(h=C,y=S);break}else E>R?(C+=L,S+=$):(L+=C,$+=S),S>N?(h=L,y=$):(h=C,y=S);h*=x}else(isNaN(E)||isNaN(D))&&(y=h=NaN);break}case"string":{if(S=E.match(/\d+|./g),S===null)throw f.InvalidParameter;if(S[C]==="-"?(_=-1,C++):S[C]==="+"&&C++,S.length===C+1?P=n(S[C++],_):S[C+1]==="."||S[C]==="."?(S[C]!=="."&&(b=n(S[C++],_)),C++,(C+1===S.length||S[C+1]==="("&&S[C+3]===")"||S[C+1]==="'"&&S[C+3]==="'")&&(P=n(S[C],_),g=Math.pow(10,S[C].length),C++),(S[C]==="("&&S[C+2]===")"||S[C]==="'"&&S[C+2]==="'")&&(B=n(S[C+1],_),x=Math.pow(10,S[C+1].length)-1,C+=3)):S[C+1]==="/"||S[C+1]===":"?(P=n(S[C],_),g=n(S[C+2],1),C+=3):S[C+3]==="/"&&S[C+1]===" "&&(b=n(S[C],_),P=n(S[C+2],_),g=n(S[C+4],1),C+=5),S.length<=C){y=g*x,_=h=B+y*b+x*P;break}}default:throw f.InvalidParameter}if(y===0)throw f.DivisionByZero;i.s=_<0?-1:1,i.n=Math.abs(h),i.d=Math.abs(y)};function c(E,D,h){for(var y=1;D>0;E=E*E%h,D>>=1)D&1&&(y=y*E%h);return y}function A(E,D){for(;D%2===0;D/=2);for(;D%5===0;D/=5);if(D===1)return 0;for(var h=10%D,y=1;h!==1;y++)if(h=h*10%D,y>u)return 0;return y}function d(E,D,h){for(var y=1,_=c(10,h,D),b=0;b<300;b++){if(y===_)return b;y=y*10%D,_=_*10%D}return 0}function m(E,D){if(!E)return D;if(!D)return E;for(;;){if(E%=D,!E)return D;if(D%=E,!D)return E}}function f(E,D){if(o(E,D),this instanceof f)E=m(i.d,i.n),this.s=i.s,this.n=i.n/E,this.d=i.d/E;else return a(i.s*i.n,i.d)}f.DivisionByZero=new Error("Division by Zero"),f.InvalidParameter=new Error("Invalid argument"),f.NonIntegerParameter=new Error("Parameters must be integer"),f.prototype={s:1,n:0,d:1,abs:function(){return a(this.n,this.d)},neg:function(){return a(-this.s*this.n,this.d)},add:function(E,D){return o(E,D),a(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(E,D){return o(E,D),a(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(E,D){return o(E,D),a(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(E,D){return o(E,D),a(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return a(this.s*this.n,this.d)},mod:function(E,D){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(E===void 0)return a(this.s*this.n%this.d,1);if(o(E,D),i.n===0&&this.d===0)throw f.DivisionByZero;return a(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(E,D){return o(E,D),a(m(i.n,this.n)*m(i.d,this.d),i.d*this.d)},lcm:function(E,D){return o(E,D),i.n===0&&this.n===0?a(0,1):a(i.n*this.n,m(i.n,this.n)*m(i.d,this.d))},ceil:function(E){return E=Math.pow(10,E||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):a(Math.ceil(E*this.s*this.n/this.d),E)},floor:function(E){return E=Math.pow(10,E||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):a(Math.floor(E*this.s*this.n/this.d),E)},round:function(E){return E=Math.pow(10,E||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):a(Math.round(E*this.s*this.n/this.d),E)},inverse:function(){return a(this.s*this.d,this.n)},pow:function(E,D){if(o(E,D),i.d===1)return i.s<0?a(Math.pow(this.s*this.d,i.n),Math.pow(this.n,i.n)):a(Math.pow(this.s*this.n,i.n),Math.pow(this.d,i.n));if(this.s<0)return null;var h=l(this.n),y=l(this.d),_=1,b=1;for(var P in h)if(P!=="1"){if(P==="0"){_=0;break}if(h[P]*=i.n,h[P]%i.d===0)h[P]/=i.d;else return null;_*=Math.pow(P,h[P])}for(var P in y)if(P!=="1"){if(y[P]*=i.n,y[P]%i.d===0)y[P]/=i.d;else return null;b*=Math.pow(P,y[P])}return i.s<0?a(b,_):a(_,b)},equals:function(E,D){return o(E,D),this.s*this.n*i.d===i.s*i.n*this.d},compare:function(E,D){o(E,D);var h=this.s*this.n*i.d-i.s*i.n*this.d;return(0=0;b--)_=_.inverse().add(h[b]);if(_.sub(D).abs().valueOf()0&&(h+=D,h+=" ",y%=_),h+=y,h+="/",h+=_),h},toLatex:function(E){var D,h="",y=this.n,_=this.d;return this.s<0&&(h+="-"),_===1?h+=y:(E&&(D=Math.floor(y/_))>0&&(h+=D,y%=_),h+="\\frac{",h+=y,h+="}{",h+=_,h+="}"),h},toContinued:function(){var E,D=this.n,h=this.d,y=[];if(isNaN(D)||isNaN(h))return y;do y.push(Math.floor(D/h)),E=D%h,D=h,h=E;while(D!==1);return y},toString:function(E){var D=this.n,h=this.d;if(isNaN(D)||isNaN(h))return"NaN";E=E||15;var y=A(D,h),_=d(D,h,y),b=this.s<0?"-":"";if(b+=D/h|0,D%=h,D*=10,D&&(b+="."),y){for(var P=_;P--;)b+=D/h|0,D%=h,D*=10;b+="(";for(var P=y;P--;)b+=D/h|0,D%=h,D*=10;b+=")"}else for(var P=E;D&&P--;)b+=D/h|0,D%=h,D*=10;return b}},Object.defineProperty(f,"__esModule",{value:!0}),f.default=f,f.Fraction=f,s.exports=f})()})(fraction$1);const Fraction=getDefaultExportFromCjs(fraction$1.exports);Fraction.prototype.sam=function(){return this.floor()};Fraction.prototype.nextSam=function(){return this.sam().add(1)};Fraction.prototype.wholeCycle=function(){return new TimeSpan(this.sam(),this.nextSam())};Fraction.prototype.cyclePos=function(){return this.sub(this.sam())};Fraction.prototype.lt=function(s){return this.compare(s)<0};Fraction.prototype.gt=function(s){return this.compare(s)>0};Fraction.prototype.lte=function(s){return this.compare(s)<=0};Fraction.prototype.gte=function(s){return this.compare(s)>=0};Fraction.prototype.eq=function(s){return this.compare(s)==0};Fraction.prototype.max=function(s){return this.gt(s)?this:s};Fraction.prototype.min=function(s){return this.lt(s)?this:s};Fraction.prototype.show=function(){return this.s*this.n+"/"+this.d};Fraction.prototype.or=function(s){return this.eq(0)?s:this};const fraction=s=>(typeof s=="number"&&(s=String(s)),Fraction(s)),gcd=(...s)=>s.reduce((e,r)=>e.gcd(r),fraction(1));fraction._original=Fraction;class TimeSpan{constructor(e,r){this.begin=fraction(e),this.end=fraction(r)}get spanCycles(){const e=[];var r=this.begin;const u=this.end,i=u.sam();if(r.equals(u))return[new TimeSpan(r,u)];for(;u.gt(r);){if(r.sam().equals(i)){e.push(new TimeSpan(r,this.end));break}const n=r.nextSam();e.push(new TimeSpan(r,n)),r=n}return e}get duration(){return this.end.sub(this.begin)}cycleArc(){const e=this.begin.cyclePos(),r=e.add(this.duration);return new TimeSpan(e,r)}withTime(e){return new TimeSpan(e(this.begin),e(this.end))}withEnd(e){return new TimeSpan(this.begin,e(this.end))}withCycle(e){const r=this.begin.sam(),u=r.add(e(this.begin.sub(r))),i=r.add(e(this.end.sub(r)));return new TimeSpan(u,i)}intersection(e){const r=this.begin.max(e.begin),u=this.end.min(e.end);if(!r.gt(u)&&!(r.equals(u)&&(r.equals(this.end)&&this.begin.lt(this.end)||r.equals(e.end)&&e.begin.lt(e.end))))return new TimeSpan(r,u)}intersection_e(e){const r=this.intersection(e);if(r==null)throw"TimeSpans do not intersect";return r}midpoint(){return this.begin.add(this.duration.div(fraction(2)))}equals(e){return this.begin.equals(e.begin)&&this.end.equals(e.end)}show(){return this.begin.show()+" -> "+this.end.show()}}class Hap{constructor(e,r,u,i={},n=!1){this.whole=e,this.part=r,this.value=u,this.context=i,this.stateful=n,n&&console.assert(typeof this.value=="function","Stateful values must be functions")}get duration(){return this.whole.end.sub(this.whole.begin)}wholeOrPart(){return this.whole?this.whole:this.part}withSpan(e){const r=this.whole?e(this.whole):void 0;return new Hap(r,e(this.part),this.value,this.context)}withValue(e){return new Hap(this.whole,this.part,e(this.value),this.context)}hasOnset(){return this.whole!=null&&this.whole.begin.equals(this.part.begin)}resolveState(e){if(this.stateful&&this.hasOnset()){console.log("stateful");const r=this.value,[u,i]=r(e);return[u,new Hap(this.whole,this.part,i,this.context,!1)]}return[e,this]}spanEquals(e){return this.whole==null&&e.whole==null||this.whole.equals(e.whole)}equals(e){return this.spanEquals(e)&&this.part.equals(e.part)&&this.value===e.value}show(){return"("+(this.whole==null?"~":this.whole.show())+", "+this.part.show()+", "+this.value+")"}showWhole(){return`${this.whole==null?"~":this.whole.show()}: ${typeof this.value=="object"?JSON.stringify(this.value):this.value}`}combineContext(e){const r=this;return{...r.context,...e.context,locations:(r.context.locations||[]).concat(e.context.locations||[])}}setContext(e){return new Hap(this.whole,this.part,this.value,e)}}class State{constructor(e,r={}){this.span=e,this.controls=r}setSpan(e){return new State(e,this.controls)}withSpan(e){return this.setSpan(e(this.span))}setControls(e){return new State(this.span,e)}}const isNote$1=s=>/^[a-gA-G][#b]*[0-9]$/.test(s),tokenizeNote=s=>{var i;if(typeof s!="string")return[];const[e,r="",u]=((i=s.match(/^([a-gA-G])([#bs]*)([0-9])?$/))==null?void 0:i.slice(1))||[];return e?[e,r,u?Number(u):void 0]:[]},toMidi=s=>{const[e,r,u]=tokenizeNote(s);if(!e)throw new Error('not a note: "'+s+'"');const i={c:0,d:2,e:4,f:5,g:7,a:9,b:11}[e.toLowerCase()],n=(r==null?void 0:r.split("").reduce((a,l)=>a+{"#":1,b:-1,s:1}[l],0))||0;return(Number(u)+1)*12+i+n},fromMidi=s=>Math.pow(2,(s-69)/12)*440,getFreq=s=>fromMidi(typeof s=="number"?s:toMidi(s)),midi2note=s=>{const e=Math.floor(s/12)-1;return["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"][s%12]+e},mod=(s,e)=>(s%e+e)%e,getPlayableNoteValue=s=>{let{value:e,context:r}=s;if(typeof e=="object"&&!Array.isArray(e)&&(e=e.note||e.n||e.value),typeof e=="number"&&r.type!=="frequency")e=fromMidi(s.value);else if(typeof e=="number"&&r.type==="frequency")e=s.value;else if(typeof e!="string"||!isNote$1(e))throw new Error("not a note: "+JSON.stringify(e));return e},getFrequency=s=>{let{value:e,context:r}=s;if(typeof e=="object")return e.freq?e.freq:getFreq(e.note||e.n||e.value);if(typeof e=="number"&&r.type!=="frequency")e=fromMidi(s.value);else if(typeof e=="string"&&isNote$1(e))e=fromMidi(toMidi(s.value));else if(typeof e!="number")throw new Error("not a note or frequency: "+e);return e},rotate=(s,e)=>s.slice(e).concat(s.slice(0,e)),pipe=(...s)=>s.reduce((e,r)=>(...u)=>e(r(...u)),e=>e),compose=(...s)=>pipe(...s.reverse()),removeUndefineds=s=>s.filter(e=>e!=null),flatten=s=>[].concat(...s),id=s=>s,constant=(s,e)=>s,listRange=(s,e)=>Array.from({length:e-s+1},(r,u)=>u+s);function curry(s,e){const r=function u(...i){if(i.length>=s.length)return s.apply(this,i);{const n=function(...a){return u.apply(this,i.concat(a))};return e&&e(n,i),n}};return e&&e(r,[]),r}function parseNumeral(s){const e=Number(s);if(!isNaN(e))return e;if(isNote$1(s))return toMidi(s);throw new Error(`cannot parse as numeral: "${s}"`)}function mapArgs(s,e){return(...r)=>s(...r.map(e))}function numeralArgs(s){return mapArgs(s,parseNumeral)}function parseFractional(s){const e=Number(s);if(!isNaN(e))return e;const r={pi:Math.PI,w:1,h:.5,q:.25,e:.125,s:.0625,t:1/3,f:.2,x:1/6}[s];if(typeof r<"u")return r;throw new Error(`cannot parse as fractional: "${s}"`)}const fractionalArgs=s=>mapArgs(s,parseFractional);function unionWithObj(s,e,r){const u=Object.keys(s).filter(i=>Object.keys(e).includes(i));return Object.assign({},s,e,Object.fromEntries(u.map(i=>[i,r(s[i],e[i])])))}curry((s,e)=>s*e);curry((s,e)=>e.map(s));function drawLine(s,e=60){let r=0,u=fraction(0),i=[""],n="";for(;i[0].lengthA.hasOnset()).map(A=>A.duration),o=gcd(...l),c=o.inverse();i=i.map(A=>A+"|"),n+="|";for(let A=0;AD.whole.begin.lte(d)&&D.whole.end.gte(m)),E=f.length-i.length;E>0&&(i=i.concat(Array(E).fill(n))),i=i.map((D,h)=>{const y=f[h];if(y){const b=y.whole.begin.eq(d)?""+y.value:"-";return D+b}return D+"."}),n+=".",u=u.add(o)}r++}return i.join(` -`)}class Pattern$3{constructor(e){V(this,"_Pattern",!0);this.query=e}queryArc(e,r){return this.query(new State(new TimeSpan(e,r)))}_splitQueries(){const e=this,r=u=>flatten(u.span.spanCycles.map(i=>e.query(u.setSpan(i))));return new Pattern$3(r)}withQuerySpan(e){return new Pattern$3(r=>this.query(r.withSpan(e)))}withQuerySpanMaybe(e){const r=this;return new Pattern$3(u=>{const i=u.withSpan(e);return i.span?r.query(i):[]})}withQueryTime(e){return new Pattern$3(r=>this.query(r.withSpan(u=>u.withTime(e))))}withHapSpan(e){return new Pattern$3(r=>this.query(r).map(u=>u.withSpan(e)))}withHapTime(e){return this.withHapSpan(r=>r.withTime(e))}_withHaps(e){return new Pattern$3(r=>e(this.query(r)))}_withHap(e){return this._withHaps(r=>r.map(e))}_setContext(e){return this._withHap(r=>r.setContext(e))}_withContext(e){return this._withHap(r=>r.setContext(e(r.context)))}_stripContext(){return this._withHap(e=>e.setContext({}))}withLocation(e,r){const u={start:{line:e[0],column:e[1],offset:e[2]},end:{line:r[0],column:r[1],offset:r[2]}};return this._withContext(i=>{const n=(i.locations||[]).concat([u]);return{...i,locations:n}})}withMiniLocation(e,r){const u={start:{line:e[0],column:e[1],offset:e[2]},end:{line:r[0],column:r[1],offset:r[2]}};return this._withContext(i=>{let n=i.locations||[];return n=n.map(({start:a,end:l})=>{const o=a.line===1?u.start.column:0;return{start:{...a,line:a.line-1+(u.start.line-1)+1,column:a.column-1+o},end:{...l,line:l.line-1+(u.start.line-1)+1,column:l.column-1+o}}}),{...i,locations:n}})}withValue(e){return new Pattern$3(r=>this.query(r).map(u=>u.withValue(e)))}fmap(e){return this.withValue(e)}_filterHaps(e){return new Pattern$3(r=>this.query(r).filter(e))}_filterValues(e){return new Pattern$3(r=>this.query(r).filter(u=>e(u.value)))}_removeUndefineds(){return this._filterValues(e=>e!=null)}onsetsOnly(){return this._filterHaps(e=>e.hasOnset())}discreteOnly(){return this._filterHaps(e=>e.whole)}_appWhole(e,r){const u=this,i=function(n){const a=u.query(n),l=r.query(n),o=function(c,A){const d=c.part.intersection(A.part);if(d!=null)return new Hap(e(c.whole,A.whole),d,c.value(A.value),A.combineContext(c))};return flatten(a.map(c=>removeUndefineds(l.map(A=>o(c,A)))))};return new Pattern$3(i)}appBoth(e){const r=function(u,i){if(!(u==null||i==null))return u.intersection_e(i)};return this._appWhole(r,e)}appLeft(e){const r=this,u=function(i){const n=[];for(const a of r.query(i)){const l=e.query(i.setSpan(a.wholeOrPart()));for(const o of l){const c=a.whole,A=a.part.intersection(o.part);if(A){const d=a.value(o.value),m=o.combineContext(a),f=new Hap(c,A,d,m);n.push(f)}}}return n};return new Pattern$3(u)}appRight(e){const r=this,u=function(i){const n=[];for(const a of e.query(i)){const l=r.query(i.setSpan(a.wholeOrPart()));for(const o of l){const c=a.whole,A=o.part.intersection(a.part);if(A){const d=o.value(a.value),m=a.combineContext(o),f=new Hap(c,A,d,m);n.push(f)}}}return n};return new Pattern$3(u)}firstCycle(e=!1){var r=this;return e||(r=r._stripContext()),r.query(new State(new TimeSpan(fraction(0),fraction(1))))}get _firstCycleValues(){return this.firstCycle().map(e=>e.value)}get _showFirstCycle(){return this.firstCycle().map(e=>`${e.value}: ${e.whole.begin.toFraction()} - ${e.whole.end.toFraction()}`)}_sortHapsByPart(){return this._withHaps(e=>e.sort((r,u)=>r.part.begin.sub(u.part.begin).or(r.part.end.sub(u.part.end)).or(r.whole.begin.sub(u.whole.begin).or(r.whole.end.sub(u.whole.end)))))}_opIn(e,r){return this.fmap(r).appLeft(reify$1(e))}_opOut(e,r){return this.fmap(r).appRight(reify$1(e))}_opMix(e,r){return this.fmap(r).appBoth(reify$1(e))}_opSqueeze(e,r){const u=reify$1(e);return this.fmap(i=>u.fmap(n=>r(i)(n)))._squeezeJoin()}_opSqueezeOut(e,r){const u=this;return reify$1(e).fmap(n=>u.fmap(a=>r(a)(n)))._squeezeJoin()}_opTrig(e,r){return reify$1(e).fmap(i=>this.fmap(n=>r(n)(i)))._trigJoin()}_opTrigzero(e,r){return reify$1(e).fmap(i=>this.fmap(n=>r(n)(i)))._TrigzeroJoin()}_asNumber(){return this.fmap(parseNumeral)}round(){return this._asNumber().fmap(e=>Math.round(e))}floor(){return this._asNumber().fmap(e=>Math.floor(e))}ceil(){return this._asNumber().fmap(e=>Math.ceil(e))}_toBipolar(){return this.fmap(e=>e*2-1)}_fromBipolar(){return this.fmap(e=>(e+1)/2)}_range(e,r){return this.mul(r-e).add(e)}_rangex(e,r){return this._range(Math.log(e),Math.log(r)).fmap(Math.exp)}_range2(e,r){return this._fromBipolar()._range(e,r)}_bindWhole(e,r){const u=this,i=function(n){const a=function(o,c){return new Hap(e(o.whole,c.whole),c.part,c.value,Object.assign({},o.context,c.context,{locations:(o.context.locations||[]).concat(c.context.locations||[])}))},l=function(o){return r(o.value).query(n.setSpan(o.part)).map(c=>a(o,c))};return flatten(u.query(n).map(o=>l(o)))};return new Pattern$3(i)}bind(e){const r=function(u,i){if(!(u==null||i==null))return u.intersection_e(i)};return this._bindWhole(r,e)}join(){return this.bind(id)}outerBind(e){return this._bindWhole((r,u)=>r,e)}outerJoin(){return this.outerBind(id)}innerBind(e){return this._bindWhole((r,u)=>u,e)}innerJoin(){return this.innerBind(id)}_trigJoin(e=!1){const r=this;return new Pattern$3(u=>r.discreteOnly().query(u).map(i=>i.value.late(e?i.whole.begin:i.whole.begin.cyclePos()).query(u).map(n=>new Hap(n.whole?n.whole.intersection(i.whole):void 0,n.part.intersection(i.part),n.value).setContext(i.combineContext(n))).filter(n=>n.part)).flat())}_TrigzeroJoin(){return this._trigJoin(!0)}_squeezeJoin(){const e=this;function r(u){const i=e.discreteOnly().query(u);function n(l){const c=l.value._focusSpan(l.wholeOrPart()).query(u.setSpan(l.part));function A(d,m){let f;if(m.whole&&d.whole&&(f=m.whole.intersection(d.whole),!f))return;const E=m.part.intersection(d.part);if(!E)return;const D=m.combineContext(d);return new Hap(f,E,m.value,D)}return c.map(d=>A(l,d))}return flatten(i.map(n)).filter(l=>l)}return new Pattern$3(r)}_squeezeBind(e){return this.fmap(e)._squeezeJoin()}_apply(e){return e(this)}layer(...e){return stack(...e.map(r=>r(this)))}_patternify(e){const r=this;return function(...i){return i=i.map(a=>isPattern$1(a)?a.fmap(l=>l.value||l):a),sequence(...i).fmap(a=>e.call(r,a)).innerJoin()}}_fastGap(e){const r=function(i){const n=i.begin.sam(),a=i.begin.sub(n).mul(e).min(1),l=i.end.sub(n).mul(e).min(1);if(!(a>=1))return new TimeSpan(n.add(a),n.add(l))},u=function(i){const n=i.part.begin,a=i.part.end,l=n.sam(),o=n.sub(l).div(e).min(1),c=a.sub(l).div(e).min(1),A=new TimeSpan(l.add(o),l.add(c)),d=i.whole?new TimeSpan(A.begin.sub(n.sub(i.whole.begin).div(e)),A.end.add(i.whole.end.sub(a).div(e))):void 0;return new Hap(d,A,i.value,i.context)};return this.withQuerySpanMaybe(r)._withHap(u)._splitQueries()}_compress(e,r){return e.gt(r)||e.gt(1)||r.gt(1)||e.lt(0)||r.lt(0)?silence:this._fastGap(fraction(1).div(r.sub(e)))._late(e)}_compressSpan(e){return this._compress(e.begin,e.end)}_focus(e,r){return this._fast(fraction(1).div(r.sub(e))).late(e.cyclePos())}_focusSpan(e){return this._focus(e.begin,e.end)}_fast(e){return this.withQueryTime(u=>u.mul(e)).withHapTime(u=>u.div(e))}_slow(e){return this._fast(fraction(1).div(e))}_inside(e,r){return r(this._slow(e))._fast(e)}_outside(e,r){return r(this._fast(e))._slow(e)}_ply(e){return this.fmap(r=>pure(r)._fast(e))._squeezeJoin()}_chop(e){const u=Array.from({length:e},(n,a)=>a).map(n=>({begin:n/e,end:(n+1)/e})),i=function(n){return sequence(u.map(a=>Object.assign({},n,a)))};return this._squeezeBind(i)}_striate(e){const u=Array.from({length:e},(n,a)=>a).map(n=>({begin:n/e,end:(n+1)/e})),i=slowcat(...u);return this.set(i)._fast(e)}_cpm(e){return this._fast(e/60)}_early(e){return e=fraction(e),this.withQueryTime(r=>r.add(e)).withHapTime(r=>r.sub(e))}_late(e){return e=fraction(e),this._early(fraction(0).sub(e))}_zoom(e,r){r=fraction(r),e=fraction(e);const u=r.sub(e);return this.withQuerySpan(i=>i.withCycle(n=>n.mul(u).add(e))).withHapSpan(i=>i.withCycle(n=>n.sub(e).div(u)))._splitQueries()}_zoomArc(e){return this.zoom(e.begin,e.end)}_linger(e){return e==0?silence:e<0?this._zoom(e.add(1),1)._slow(e):this._zoom(0,e)._slow(e)}_color(e){return this._withContext(r=>({...r,color:e}))}log(){return this._withHap(e=>{var r;return e.setContext({...e.context,logs:(((r=e.context)==null?void 0:r.logs)||[]).concat([e.show()])})})}drawLine(){return console.log(drawLine(this)),this}_segment(e){return this.struct(pure(!0)._fast(e))}invert(){return this.fmap(e=>!e)}inv(){return this.invert()}when(e,r){const u=e._filterValues(id),i=e._filterValues(l=>!l),n=u.fmap(l=>o=>o).appRight(r(this)),a=i.fmap(l=>o=>o).appRight(this);return stack(n,a)}off(e,r){return stack(this,r(this.late(e)))}every(e,r){const u=this,i=Array(e-1).fill(u);return i.push(r(u)),slowcatPrime(...i)}every(e,r){const u=this,i=Array(e-1).fill(u);return i.unshift(r(u)),slowcatPrime(...i)}each(e,r){const u=this,i=Array(e-1).fill(u);return i.push(r(u)),slowcatPrime(...i)}brak(){return this.when(slowcat(!1,!0),e=>fastcat(e,silence)._late(.25))}rev(){const e=this,r=function(u){const i=u.span,n=i.begin.sam(),a=i.begin.nextSam(),l=function(c){const A=c.withTime(m=>n.add(a.sub(m))),d=A.begin;return A.begin=A.end,A.end=d,A};return e.query(u.setSpan(l(i))).map(c=>c.withSpan(l))};return new Pattern$3(r)._splitQueries()}palindrome(){return this.every(2,rev)}juxBy(e,r){e/=2;const u=function(a,l,o){return l in a?a[l]:o},i=this.withValue(a=>Object.assign({},a,{pan:u(a,"pan",.5)-e})),n=this.withValue(a=>Object.assign({},a,{pan:u(a,"pan",.5)+e}));return stack(i,r(n))}_jux(e){return this.juxBy(1,e)}stack(...e){return stack(this,...e)}sequence(...e){return sequence(this,...e)}seq(...e){return sequence(this,...e)}cat(...e){return cat(this,...e)}fastcat(...e){return fastcat(this,...e)}slowcat(...e){return slowcat(this,...e)}superimpose(...e){return this.stack(...e.map(r=>r(this)))}stutWith(e,r,u){return stack(...listRange(0,e-1).map(i=>u(this.late(fraction(r).mul(i)),i)))}stut(e,r,u){return this.stutWith(e,u,(i,n)=>i.velocity(Math.pow(r,n)))}_echoWith(e,r,u){return stack(...listRange(0,e-1).map(i=>u(this.late(fraction(r).mul(i)),i)))}_echo(e,r,u){return this._echoWith(e,r,(i,n)=>i.velocity(Math.pow(u,n)))}iter(e,r=!1){return slowcat(...listRange(0,e-1).map(u=>r?this.late(u/e):this.early(u/e)))}iterBack(e){return this.iter(e,!0)}_chunk(e,r,u=!1){const i=Array(e-1).fill(!1);i.unshift(!0);const n=sequence(...i).iter(e,u);return this.when(n,r)}_chunkBack(e,r){return this._chunk(e,r,!0)}_bypass(e){return e=Boolean(parseInt(e)),e?silence:this}hush(){return silence}_duration(e){return this.withHapSpan(r=>new TimeSpan(r.begin,r.begin.add(e)))}_legato(e){return this.withHapSpan(r=>new TimeSpan(r.begin,r.begin.add(r.end.sub(r.begin).mul(e))))}_velocity(e){return this._withContext(r=>({...r,velocity:(r.velocity||1)*e}))}_loopAt(e,r=1){return this.speed(1/e*r).unit("c").slow(e)}onTrigger(e){return this._withHap(r=>r.setContext({...r.context,onTrigger:e}))}log(e=id){return this._withHap(r=>r.setContext({...r.context,onTrigger:(...u)=>{r.context.onTrigger&&r.context.onTrigger(...u),console.log(e(...u))}}))}logValues(e=id){return this.log((r,u)=>e(u.value))}}function _composeOp(s,e,r){function u(i){return i instanceof Object&&!(i instanceof Function)}return u(s)||u(e)?(u(s)||(s={value:s}),u(e)||(e={value:e}),unionWithObj(s,e,r)):r(s,e)}(function(){const s={set:[(e,r)=>r],keep:[(e,r)=>e],keepif:[(e,r)=>r?e:void 0],add:[numeralArgs((e,r)=>e+r)],sub:[numeralArgs((e,r)=>e-r)],mul:[numeralArgs((e,r)=>e*r)],div:[numeralArgs((e,r)=>e/r)],mod:[numeralArgs(mod)],pow:[numeralArgs(Math.pow)],_and:[numeralArgs((e,r)=>e&r)],_or:[numeralArgs((e,r)=>e|r)],_xor:[numeralArgs((e,r)=>e^r)],_lshift:[numeralArgs((e,r)=>e<e>>r)],lt:[(e,r)=>ee>r],lte:[(e,r)=>e<=r],gte:[(e,r)=>e>=r],eq:[(e,r)=>e==r],eqt:[(e,r)=>e===r],ne:[(e,r)=>e!=r],net:[(e,r)=>e!==r],and:[(e,r)=>e&&r],or:[(e,r)=>e||r],func:[(e,r)=>r(e)]};for(const[e,[r,u]]of Object.entries(s))for(const i of["In","Out","Mix","Squeeze","SqueezeOut","Trig","Trigzero"])Pattern$3.prototype[e+i]=function(...n){var a=this;n=sequence(n),u&&(a=u(a),n=u(n));var l;return e==="keepif"?(l=a["_op"+i](n,o=>c=>r(o,c)),l=l._removeUndefineds()):l=a["_op"+i](n,o=>c=>_composeOp(o,c,r)),l},i==="Squeeze"&&(Pattern$3.prototype[e+"SqueezeIn"]=Pattern$3.prototype[e+i]),i==="In"?Pattern$3.prototype[e]=Pattern$3.prototype[e+i]:e==="set"&&(Pattern$3.prototype[i.toLowerCase()]=Pattern$3.prototype[e+i]);Pattern$3.prototype.struct=Pattern$3.prototype.keepifOut,Pattern$3.prototype.structAll=Pattern$3.prototype.keepOut,Pattern$3.prototype.mask=Pattern$3.prototype.keepifIn,Pattern$3.prototype.maskAll=Pattern$3.prototype.keepIn,Pattern$3.prototype.reset=Pattern$3.prototype.keepifTrig,Pattern$3.prototype.resetAll=Pattern$3.prototype.keepTrig,Pattern$3.prototype.restart=Pattern$3.prototype.keepifTrigzero,Pattern$3.prototype.restartAll=Pattern$3.prototype.keepTrigzero})();Pattern$3.prototype.patternified=["apply","chop","color","cpm","duration","early","fast","jux","late","legato","linger","ply","segment","striate","slow","velocity"];const polyrhythm=stack,pr=stack;Pattern$3.prototype.factories={pure,stack,slowcat,fastcat,cat,timeCat,sequence,seq:seq$2,polymeter,pm,polyrhythm,pr};const silence=new Pattern$3(s=>[]);function pure(s){function e(r){return r.span.spanCycles.map(u=>new Hap(fraction(u.begin).wholeCycle(),u,s))}return new Pattern$3(e)}function isPattern$1(s){const e=s instanceof Pattern$3||(s==null?void 0:s._Pattern);return!s instanceof Pattern$3&&console.warn(`Found Pattern that fails "instanceof Pattern" check. - This may happen if you are using multiple versions of @strudel.cycles/core. - Please check by running "npm ls @strudel.cycles/core".`),e}function reify$1(s){return isPattern$1(s)?s:pure(s)}function stack(...s){s=s.map(r=>Array.isArray(r)?sequence(...r):reify$1(r));const e=r=>flatten(s.map(u=>u.query(r)));return new Pattern$3(e)}function slowcat(...s){s=s.map(r=>Array.isArray(r)?sequence(...r):reify$1(r));const e=function(r){const u=r.span,i=mod(u.begin.sam(),s.length),n=s[i];if(!n)return[];const a=u.begin.floor().sub(u.begin.div(s.length).floor());return n.withHapTime(l=>l.add(a)).query(r.setSpan(u.withTime(l=>l.sub(a))))};return new Pattern$3(e)._splitQueries()}function slowcatPrime(...s){s=s.map(reify$1);const e=function(r){const u=Math.floor(r.span.begin)%s.length,i=s[u];return(i==null?void 0:i.query(r))||[]};return new Pattern$3(e)._splitQueries()}function fastcat(...s){return slowcat(...s)._fast(s.length)}function cat(...s){return slowcat(...s)}function timeCat(...s){const e=s.map(i=>i[0]).reduce((i,n)=>i.add(n),fraction(0));let r=fraction(0);const u=[];for(const[i,n]of s){const a=r.add(i);u.push(reify$1(n)._compress(r.div(e),a.div(e))),r=a}return stack(...u)}function sequence(...s){return fastcat(...s)}function seq$2(...s){return fastcat(...s)}function _sequenceCount(s){return Array.isArray(s)?s.length==0?[silence,0]:s.length==1?_sequenceCount(s[0]):[fastcat(...s.map(e=>_sequenceCount(e)[0])),s.length]:[reify$1(s),1]}function polymeterSteps(s,...e){const r=e.map(i=>_sequenceCount(i));if(r.length==0)return silence;s==0&&(s=r[0][1]);const u=[];for(const i of r)i[1]==0&&next,s==i[1]?u.push(i[0]):u.push(i[0]._fast(fraction(s).div(fraction(i[1]))));return stack(...u)}function polymeter(...s){return polymeterSteps(0,...s)}function pm(...s){polymeter(...s)}const add=curry((s,e)=>e.add(s)),chop=curry((s,e)=>e.chop(s)),chunk=curry((s,e)=>e.chunk(s)),chunkBack=curry((s,e)=>e.chunkBack(s)),div=curry((s,e)=>e.div(s)),early=curry((s,e)=>e.early(s)),echo=curry((s,e,r,u)=>u.echo(s,e,r)),every=curry((s,e,r)=>r.every(s,e)),fast=curry((s,e)=>e.fast(s)),inv=s=>s.inv(),invert=s=>s.invert(),iter=curry((s,e)=>e.iter(s)),iterBack=curry((s,e)=>e.iter(s)),jux=curry((s,e)=>e.jux(s)),juxBy=curry((s,e,r)=>r.juxBy(s,e)),late=curry((s,e)=>e.late(s)),linger=curry((s,e)=>e.linger(s)),mask=curry((s,e)=>e.mask(s)),mul=curry((s,e)=>e.mul(s)),off=curry((s,e,r)=>r.off(s,e)),ply=curry((s,e)=>e.ply(s)),range=curry((s,e,r)=>r.range(s,e)),rangex=curry((s,e,r)=>r.rangex(s,e)),range2=curry((s,e,r)=>r.range2(s,e)),rev=s=>s.rev(),slow=curry((s,e)=>e.slow(s)),struct=curry((s,e)=>e.struct(s)),sub=curry((s,e)=>e.sub(s)),superimpose=curry((s,e)=>e.superimpose(...s)),set=curry((s,e)=>e.set(s)),when=curry((s,e,r)=>r.when(s,e));Pattern$3.prototype.composable={fast,slow,early,late,superimpose};function makeComposable(s){return Object.entries(Pattern$3.prototype.composable).forEach(([e,r])=>{s[e]=(...u)=>{const i=compose(s,r(...u));return makeComposable(i)}}),s}const patternify2=s=>(e,r,u)=>e.fmap(i=>n=>s.call(u,i,n)).appLeft(r).innerJoin(),patternify3=s=>(e,r,u,i)=>e.fmap(n=>a=>l=>s.call(i,n,a,l)).appLeft(r).appLeft(u).innerJoin(),patternify4=s=>(e,r,u,i,n)=>e.fmap(a=>l=>o=>c=>s.call(n,a,l,o,c)).appLeft(r).appLeft(u).appLeft(i).innerJoin();Pattern$3.prototype.echo=function(...s){return s=s.map(reify$1),patternify3(Pattern$3.prototype._echo)(...s,this)};Pattern$3.prototype.echoWith=function(...s){return s=s.map(reify$1),patternify3(Pattern$3.prototype._echoWith)(...s,this)};Pattern$3.prototype.chunk=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._chunk)(...s,this)};Pattern$3.prototype.chunkBack=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._chunkBack)(...s,this)};Pattern$3.prototype.loopAt=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._loopAt)(...s,this)};Pattern$3.prototype.zoom=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._zoom)(...s,this)};Pattern$3.prototype.compress=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._compress)(...s,this)};Pattern$3.prototype.outside=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._outside)(...s,this)};Pattern$3.prototype.inside=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._inside)(...s,this)};Pattern$3.prototype.range=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._range)(...s,this)};Pattern$3.prototype.rangex=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._rangex)(...s,this)};Pattern$3.prototype.range2=function(...s){return s=s.map(reify$1),patternify2(Pattern$3.prototype._range2)(...s,this)};Pattern$3.prototype.bootstrap=function(){const s=Object.fromEntries(Object.entries(Pattern$3.prototype.composable).map(([e,r])=>(Pattern$3.prototype[e]&&(Pattern$3.prototype[e]=makeComposable(Pattern$3.prototype[e])),[e,curry(r,makeComposable)])));return this.patternified.forEach(e=>{Pattern$3.prototype[e]=function(...r){return this._patternify(Pattern$3.prototype["_"+e])(...r)}}),s};Pattern$3.prototype.define=(s,e,r={})=>{r.composable&&(Pattern$3.prototype.composable[s]=e),r.patternified&&(Pattern$3.prototype.patternified=Pattern$3.prototype.patternified.concat([s])),Pattern$3.prototype.bootstrap()};Pattern$3.prototype.define("hush",s=>s.hush(),{patternified:!1,composable:!0});Pattern$3.prototype.define("bypass",s=>s.bypass(on),{patternified:!0,composable:!0});const controls={},generic_params=[["s","s","sound"],["f","n","The note or sample number to choose for a synth or sampleset"],["f","note","The note or pitch to play a sound or synth with"],["f","accelerate","a pattern of numbers that speed up (or slow down) samples while they play."],["f","gain","a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder. For the linear equivalent, see @amp@."],["f","amp","like @gain@, but linear."],["f","attack","a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample."],["f","bank","selects sound bank to use"],["f","decay",""],["f","sustain",""],["f","release","a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample."],["f","hold","a pattern of numbers to specify the hold time (in seconds) of an envelope applied to each sample. Only takes effect if `attack` and `release` are also specified."],["f","bandf","A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter."],["f","bandq","a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter."],["f","begin","a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample."],["f","end","the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample."],["f","loop","loops the sample (from `begin` to `end`) the specified number of times."],["f","legato","controls the amount of overlap between two adjacent sounds"],["f","crush","bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction)."],["f","coarse","fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on."],["i","channel","choose the channel the pattern is sent to in superdirt"],["i","cut","In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open."],["f","cutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter."],["f","hcutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@"],["f","hresonance","a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@"],["f","resonance","a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter."],["f","djf","DJ filter, below 0.5 is low pass filter, above is high pass filter."],["f","delay","a pattern of numbers from 0 to 1. Sets the level of the delay signal."],["f","delayfeedback","a pattern of numbers from 0 to 1. Sets the amount of delay feedback."],["f","delaytime","a pattern of numbers from 0 to 1. Sets the length of the delay."],["f","lock","A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle."],["f","detune",""],["f","dry","when set to `1` will disable all reverb for this pattern. See `room` and `size` for more information about reverb."],["f","fadeTime","Used when using begin/end or chop/striate and friends, to change the fade out time of the 'grain' envelope."],["f","fadeInTime","As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample."],["f","freq",""],["f","gate",""],["f","leslie",""],["f","lrate",""],["f","lsize",""],["f","degree",""],["f","mtranspose",""],["f","ctranspose",""],["f","harmonic",""],["f","stepsPerOctave",""],["f","octaveR",""],["f","nudge","Nudges events into the future by the specified number of seconds. Negative numbers work up to a point as well (due to internal latency)"],["i","octave",""],["f","offset",""],["i","orbit","a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around."],["f","overgain",""],["f","overshape",""],["f","pan","a pattern of numbers between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)"],["f","panspan","a pattern of numbers between -inf and inf, which controls how much multichannel output is fanned out (negative is backwards ordering)"],["f","pansplay","a pattern of numbers between 0.0 and 1.0, which controls the multichannel spread range (multichannel only)"],["f","panwidth","a pattern of numbers between 0.0 and inf, which controls how much each channel is distributed over neighbours (multichannel only)"],["f","panorient","a pattern of numbers between -1.0 and 1.0, which controls the relative position of the centre pan in a pair of adjacent speakers (multichannel only)"],["f","rate","used in SuperDirt softsynths as a control rate or 'speed'"],["f","slide",""],["f","semitone",""],["f","velocity",""],["f","voice",""],["f","room","a pattern of numbers from 0 to 1. Sets the level of reverb."],["f","size","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","roomsize","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","shape","wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion."],["f","speed","a pattern of numbers which changes the speed of sample playback, i.e. a cheap way of changing pitch. Negative values will play the sample backwards!"],["s","unit",'used in conjunction with `speed`, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.'],["f","squiz",""],["f","stutterdepth",""],["f","stuttertime",""],["f","timescale",""],["f","timescalewin",""],["s","vowel","formant filter to make things sound like vowels, a pattern of either `a`, `e`, `i`, `o` or `u`. Use a rest (`~`) for no effect."],["f","waveloss",""],["f","dur",""],["f","expression",""],["f","sustainpedal",""],["f","tremolodepth","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","tremolorate","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","phaserdepth","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","phaserrate","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","fshift","frequency shifter"],["f","fshiftnote","frequency shifter"],["f","fshiftphase","frequency shifter"],["f","triode","tube distortion"],["f","krush","shape/bass enhancer"],["f","kcutoff",""],["f","octer","octaver effect"],["f","octersub","octaver effect"],["f","octersubsub","octaver effect"],["f","ring","ring modulation"],["f","ringf","ring modulation"],["f","ringdf","ring modulation"],["f","distort","noisy fuzzy distortion"],["f","freeze","Spectral freeze"],["f","xsdelay",""],["f","tsdelay",""],["f","real","Spectral conform"],["f","imag",""],["f","enhance","Spectral enhance"],["f","partials",""],["f","comb","Spectral comb"],["f","smear","Spectral smear"],["f","scram","Spectral scramble"],["f","binshift","Spectral binshift"],["f","hbrick","High pass sort of spectral filter"],["f","lbrick","Low pass sort of spectral filter"],["f","midichan",""],["f","control",""],["f","ccn",""],["f","ccv",""],["f","polyTouch",""],["f","midibend",""],["f","miditouch",""],["f","ctlNum",""],["f","frameRate",""],["f","frames",""],["f","hours",""],["s","midicmd",""],["f","minutes",""],["f","progNum",""],["f","seconds",""],["f","songPtr",""],["f","uid",""],["f","val",""],["f","cps",""],["f","clip",""]],_name=(s,...e)=>sequence(...e).withValue(r=>({[s]:r})),_setter=(s,e)=>function(...r){return r.length?this.set(s(...r)):this.fmap(u=>({[e]:u}))};generic_params.forEach(([s,e,r])=>{controls[e]=(...u)=>_name(e,...u),Pattern$3.prototype[e]=_setter(controls[e],e)});controls.createParam=s=>{const e=(...r)=>_name(s,...r);return Pattern$3.prototype[s]=_setter(e,s),(...r)=>_name(s,...r)};controls.createParams=(...s)=>s.reduce((e,r)=>Object.assign(e,{[r]:createParam(r)}),{});function bjorklund(s,e){for(var r=[],u=[],i=[e],n=s-e,a=0,l=function(o){if(o==-1)r.push(0);else if(o==-2)r.push(1);else{for(var c=0;c1;)u.push(Math.floor(n/i[a])),i.push(n%i[a]),n=i[a],a++;return u.push(n),l(a),r.reverse()}var bjork=function(s,e){return s>e?bjorklund(s,e):bjorklund(e,s)};const euclid=(s,e,r=0)=>{const u=bjork(e,s);return r?rotate(u,-r):u};Pattern$3.prototype.euclid=function(s,e,r=0){return this.struct(euclid(s,e,r))};Pattern$3.prototype.euclidLegato=function(s,e,r=0){const u=euclid(s,e,r),i=u.indexOf(1),n=rotate(u,i).join("").split("1").slice(1).map(a=>[a.length+1,!0]);return this.struct(timeCat(...n)).late(fraction(i).div(e))};function steady(s){return new Pattern$3(e=>[new Hap(void 0,e.span,s)])}const signal=s=>{const e=r=>[new Hap(void 0,r.span,s(r.span.midpoint()))];return new Pattern$3(e)},isaw=signal(s=>1-s%1),isaw2=isaw._toBipolar(),saw=signal(s=>s%1),saw2=saw._toBipolar(),sine2=signal(s=>Math.sin(Math.PI*2*s)),sine=sine2._fromBipolar(),cosine=sine._early(fraction(1).div(4)),cosine2=sine2._early(fraction(1).div(4)),square=signal(s=>Math.floor(s*2%2)),square2=square._toBipolar(),tri=fastcat(isaw,saw),tri2=fastcat(isaw2,saw2),time=signal(id),xorwise=s=>{const e=s<<13^s,r=e>>17^e;return r<<5^r},_frac=s=>s-Math.trunc(s),timeToIntSeed=s=>xorwise(Math.trunc(_frac(s/300)*536870912)),intSeedToRand=s=>s%536870912/536870912,timeToRand=s=>Math.abs(intSeedToRand(timeToIntSeed(s))),rand=signal(timeToRand),rand2=rand._toBipolar(),_brandBy=s=>rand.fmap(e=>ereify$1(s).fmap(_brandBy).innerJoin(),brand=_brandBy(.5),_irand=s=>rand.fmap(e=>Math.trunc(e*s)),irand=s=>reify$1(s).fmap(_irand).innerJoin(),__chooseWith=(s,e)=>(e=e.map(reify$1),e.length==0?silence:s.range(0,e.length).fmap(r=>e[Math.floor(r)])),chooseWith=(s,e)=>__chooseWith(s,e).outerJoin(),chooseInWith=(s,e)=>__chooseWith(s,e).innerJoin(),choose=(...s)=>chooseWith(rand,s);Pattern$3.prototype.choose=function(...s){return chooseWith(this,s)};Pattern$3.prototype.choose2=function(...s){return chooseWith(this._fromBipolar(),s)};const chooseCycles=(...s)=>chooseInWith(rand.segment(1),s),randcat=chooseCycles,_wchooseWith=function(s,...e){const r=e.map(l=>reify$1(l[0])),u=[];let i=0;for(const l of e)i+=l[1],u.push(i);const n=i,a=function(l){const o=l*n;return r[u.findIndex(c=>c>o,u)]};return s.fmap(a)},wchooseWith=(...s)=>_wchooseWith(...s).outerJoin(),wchoose=(...s)=>wchooseWith(rand,...s),wchooseCycles=(...s)=>_wchooseWith(rand,...s).innerJoin(),perlinWith=s=>{const e=s.fmap(Math.floor),r=s.fmap(n=>Math.floor(n)+1),u=n=>6*n**5-15*n**4+10*n**3,i=n=>a=>l=>a+u(n)*(l-a);return s.sub(e).fmap(i).appBoth(e.fmap(timeToRand)).appBoth(r.fmap(timeToRand))},perlin=perlinWith(time.fmap(s=>Number(s)));Pattern$3.prototype._degradeByWith=function(s,e){return this.fmap(r=>u=>r).appLeft(s._filterValues(r=>r>e))};Pattern$3.prototype._degradeBy=function(s){return this._degradeByWith(rand,s)};Pattern$3.prototype.degrade=function(){return this._degradeBy(.5)};Pattern$3.prototype._undegradeBy=function(s){return this._degradeByWith(rand.fmap(e=>1-e),s)};Pattern$3.prototype.undegrade=function(){return this._undegradeBy(.5)};Pattern$3.prototype._sometimesBy=function(s,e){return stack(this._degradeBy(s),e(this._undegradeBy(1-s)))};Pattern$3.prototype.sometimesBy=function(s,e){const r=this;return reify$1(s).fmap(u=>r._sometimesBy(u,e)).innerJoin()};Pattern$3.prototype._sometimesByPre=function(s,e){return stack(this._degradeBy(s),e(this).undegradeBy(1-s))};Pattern$3.prototype.sometimesByPre=function(s,e){const r=this;return reify$1(s).fmap(u=>r._sometimesByPre(u,e)).innerJoin()};Pattern$3.prototype.sometimes=function(s){return this._sometimesBy(.5,s)};Pattern$3.prototype.sometimesPre=function(s){return this._sometimesByPre(.5,s)};Pattern$3.prototype._someCyclesBy=function(s,e){return stack(this._degradeByWith(rand._segment(1),s),e(this._degradeByWith(rand.fmap(r=>1-r)._segment(1),1-s)))};Pattern$3.prototype.someCyclesBy=function(s,e){const r=this;return reify$1(s).fmap(u=>r._someCyclesBy(u,e)).innerJoin()};Pattern$3.prototype.someCycles=function(s){return this._someCyclesBy(.5,s)};Pattern$3.prototype.often=function(s){return this.sometimesBy(.75,s)};Pattern$3.prototype.rarely=function(s){return this.sometimesBy(.25,s)};Pattern$3.prototype.almostNever=function(s){return this.sometimesBy(.1,s)};Pattern$3.prototype.almostAlways=function(s){return this.sometimesBy(.9,s)};Pattern$3.prototype.never=function(s){return this};Pattern$3.prototype.always=function(s){return s(this)};Pattern$3.prototype.patternified.push("degradeBy","undegradeBy");let synth;try{synth=window==null?void 0:window.speechSynthesis}catch{console.warn("cannot use window: not in browser?")}let allVoices=synth==null?void 0:synth.getVoices();function speak(s,e,r){synth.cancel();const u=new SpeechSynthesisUtterance(s);u.lang=e,allVoices=synth.getVoices();const i=allVoices.filter(n=>n.lang.includes(e));typeof r=="number"?u.voice=i[r%i.length]:typeof r=="string"&&(u.voice=i.find(n=>n.name===n)),speechSynthesis.speak(u)}Pattern$3.prototype._speak=function(s,e){return this._withHap(r=>{const u=(i,n)=>{speak(n.value,s,e)};return r.setContext({...r.context,onTrigger:u})})};Pattern$3.prototype.speak=function(s,e){return patternify2(Pattern$3.prototype._speak)(reify(s),reify(e),this)};const stringifyFunction=s=>"("+s+")();",urlifyFunction=s=>URL.createObjectURL(new Blob([stringifyFunction(s)],{type:"text/javascript"})),createWorker=s=>new Worker(urlifyFunction(s));class ClockWorker{constructor(e,r){V(this,"worker");V(this,"interval",1/20);V(this,"tick",0);this.interval=r||this.interval,this.worker=createWorker(()=>{let u,i=null;const n=()=>{i&&(clearInterval(i),i=null)},a=()=>{if(n(),!u)throw new Error("no interval set! call worker.postMessage({interval}) before starting.");postMessage("tick"),i=setInterval(()=>postMessage("tick"),u*1e3)};self.onmessage=function(l){l.data=="start"?a():l.data.interval?(u=l.data.interval,i&&a()):l.data=="stop"&&n()}}),this.setInterval(this.interval),this.worker.onmessage=u=>{u.data==="tick"&&e(this.tick++,this.interval)}}start(){this.worker.postMessage("start")}stop(){this.worker.postMessage("stop"),this.tick=0}setInterval(e){this.worker.postMessage({interval:e})}}class Scheduler{constructor({interval:e,onTrigger:r,onError:u,latency:i=.2,getTime:n}){V(this,"worker");V(this,"pattern");V(this,"started",!1);V(this,"phase",0);V(this,"cps",1);V(this,"getTime");V(this,"lastTime");this.worker=new ClockWorker((a,l)=>{try{const o=n();if(!this.lastTime){this.lastTime=o;return}const c=o-this.lastTime;this.lastTime=o;const A=this.phase,d=this.phase+c*this.cps;this.phase=d,this.pattern.queryArc(A,d).forEach(f=>{var _,b;if(typeof((_=f.value)==null?void 0:_.cps)=="number"&&this.setCps((b=f.value)==null?void 0:b.cps),!f.part.begin.equals(f.whole.begin))return;const E=o+(f.whole.begin-A)/this.cps-c+l+i,D=f.duration/this.cps,h=n(),y=E-h;if(En.hasOnset());console.log(`${e.toFixed(4)} - ${r.toFixed(4)} ${Array(i.length).fill("I").join("")}`)}}const{isPattern,Pattern:Pattern$2}=strudel;let scoped=!1;const evalScope=async(...s)=>{scoped&&console.warn("evalScope was called more than once."),scoped=!0;const e=await Promise.allSettled(s),r=e.filter(u=>u.status==="fulfilled").map(u=>u.value);e.forEach((u,i)=>{u.status==="rejected"&&console.warn(`evalScope: module with index ${i} could not be loaded:`,u.reason)}),Object.assign(globalThis,...r,Pattern$2.prototype.bootstrap())};function safeEval(s){return Function('"use strict";return ('+s+")")()}const evaluate$1=async(s,e)=>{scoped||await evalScope(),e&&(s=e(s));let r=await safeEval(s);if(!isPattern(r)){console.log("evaluated",r);const u=`got "${typeof r}" instead of pattern`;throw new Error(u+(typeof r=="function"?", did you forget to call a function?":"."))}return{mode:"javascript",pattern:r}};function createClock(s,e,r=.05,u=.1,i=.1){let n=0,a=0,l=10**4,o=.01;const c=y=>r=y(r);i=i||u/2;const A=()=>{const y=s(),_=y+u+i;for(a===0&&(a=y+o);a<_;)a=Math.round(a*l)/l,a>=y&&e(a,r,n),a{A(),d=setInterval(A,u*1e3)},f=()=>clearInterval(d);return{setDuration:c,start:m,stop:()=>{n=0,a=0,f()},pause:()=>f(),duration:r,getPhase:()=>a}}class Cyclist{constructor({interval:e,onTrigger:r,onError:u,getTime:i,latency:n=.1}){V(this,"worker");V(this,"pattern");V(this,"started",!1);V(this,"cps",1);V(this,"getTime");V(this,"phase",0);this.getTime=i;const a=l=>Math.round(l*1e3)/1e3;this.clock=createClock(i,(l,o,c)=>{c===0&&(this.origin=l);const A=a(l-this.origin);this.phase=A-n;const d=a(A+o),m=i();try{this.pattern.queryArc(A,d).forEach(E=>{if(E.part.begin.equals(E.whole.begin)){const D=E.whole.begin+this.origin-m+n,h=E.duration*1;r==null||r(E,D,h)}})}catch(f){console.warn("scheduler error",f),u==null||u(f)}},e)}getPhase(){return this.phase}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.clock.start(),this.started=!0}pause(){this.clock.stop(),delete this.origin,this.started=!1}stop(){delete this.origin,this.clock.stop(),this.started=!1}setPattern(e,r=!1){this.pattern=e,r&&!this.started&&this.start()}setCps(e=1){this.cps=e}log(e,r,u){const i=u.filter(n=>n.hasOnset());console.log(`${e.toFixed(4)} - ${r.toFixed(4)} ${Array(i.length).fill("I").join("")}`)}}function repl({interval:s,defaultOutput:e,onSchedulerError:r,onEvalError:u,onEval:i,getTime:n,transpiler:a}){const l=new Cyclist({interval:s,onTrigger:e,onError:r,getTime:n});return{scheduler:l,evaluate:async c=>{if(!c)throw new Error("no code to evaluate");try{const{pattern:A}=await evaluate$1(c,a);l.setPattern(A,!0),i==null||i({pattern:A,code:c})}catch(A){console.warn(`eval error: ${A.message}`),u==null||u(A)}}}}const gist=(route,cache=!0)=>fetch(`https://gist.githubusercontent.com/${route}?cachebust=${cache?"":Date.now()}`).then(s=>s.text()).then(code=>eval(code));console.log("%c // \u{1F300} @strudel.cycles/core loaded \u{1F300}","background-color: black;color:white;padding:4px;border-radius:15px");globalThis._strudelLoaded&&console.warn(`@strudel.cycles/core was loaded more than once... -This might happen when you have multiple versions of strudel installed. -Please check with "npm ls @strudel.cycles/core".`);globalThis._strudelLoaded=!0;if(typeof DelayNode<"u"){class s extends DelayNode{constructor(r,u,i,n){super(r),u=Math.abs(u),this.delayTime.value=i;const a=r.createGain();a.gain.value=Math.min(Math.abs(n),.995),this.feedback=a.gain;const l=r.createGain();return l.gain.value=u,this.delayGain=l,this.connect(a),this.connect(l),a.connect(this),this.connect=o=>l.connect(o),this}start(r){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,r+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,r,u){return new s(this,e,r,u)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(s,e=1){const r=this.sampleRate*s,u=this.createBuffer(e,r,this.sampleRate),i=u.getChannelData(0);for(let n=0;n(e.buffer=this.impulseResponse(r),e.duration=s,e),e.setDuration(s),e});const bufferCache={},loadCache={},getCachedBuffer=s=>bufferCache[s],loadBuffer=(s,e)=>(loadCache[s]||(loadCache[s]=fetch(s).then(r=>r.arrayBuffer()).then(async r=>{const u=await e.decodeAudioData(r);return bufferCache[s]=u,u})),loadCache[s]);function reverseBuffer(s){const e=getAudioContext(),r=e.createBuffer(s.numberOfChannels,s.length,e.sampleRate);for(let u=0;ubufferCache[s],githubCache={};let sampleCache={current:void 0};const loadGithubSamples=async(s,e)=>{const r="loadGithubSamples "+s,u=localStorage.getItem(r);if(u&&(console.log("[sampler]: loaded sample list from localstorage",s),githubCache[s]=JSON.parse(u)),githubCache[s])return sampleCache.current=githubCache[s],githubCache[s];console.log("[sampler]: fetching sample list from github",s);try{const[i,n,...a]=s.split("/"),l=`https://api.github.com/repos/${i}/${n}/contents`,o=await fetch(`${l}/${a.join("/")}`).then(c=>c.json());githubCache[s]=(await Promise.all(o.map(async({name:c,path:A})=>({name:c,content:await fetch(`${l}/${A}`).then(d=>d.json()).catch(d=>{console.error("could not load path",d)})})))).filter(({content:c})=>!!c).reduce((c,{name:A,content:d})=>({...c,[(e==null?void 0:e(A))||A]:d.map(({download_url:m})=>m)}),{})}catch(i){console.error("[sampler]: failed to fetch sample list from github",i);return}return sampleCache.current=githubCache[s],localStorage.setItem(r,JSON.stringify(sampleCache.current)),console.log("[sampler]: loaded samples:",sampleCache.current),githubCache[s]},samples=async(s,e=s._base||"")=>{if(typeof s=="string"){if(s.startsWith("github:")){const[u,i]=s.split("github:");s=`https://raw.githubusercontent.com/${i}/strudel.json`}if(typeof fetch!="function")return;const r=s.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(s).then(u=>u.json()).then(u=>samples(u,e||u._base||r)).catch(u=>{throw console.error(u),new Error(`error loading "${s}"`)})}sampleCache.current={...sampleCache.current,...Object.fromEntries(Object.entries(s).map(([r,u])=>{if(typeof u=="string"&&(u=[u]),typeof u!="object")throw new Error("wrong sample map format for "+r);e=u._base||e;const i=n=>(e+n).replace("github:","https://raw.githubusercontent.com/");return Array.isArray(u)?[r,u.map(i)]:[r,Object.fromEntries(Object.entries(u).map(([n,a])=>[n,(typeof a=="string"?[a]:a).map(i)]))]}))}},resetLoadedSamples=()=>{sampleCache.current=void 0},getLoadedSamples$1=()=>sampleCache.current;var vowelFormant={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class s extends GainNode{constructor(r,u){if(super(r),!vowelFormant[u])throw new Error("vowel: unknown vowel "+u);const{gains:i,qs:n,freqs:a}=vowelFormant[u],l=r.createGain();for(let o=0;o<5;o++){const c=r.createGain();c.gain.value=i[o];const A=r.createBiquadFilter();A.type="bandpass",A.Q.value=n[o],A.frequency.value=a[o],this.connect(A),A.connect(c),c.connect(l)}return l.gain.value=8,this.connect=o=>l.connect(o),this}}AudioContext.prototype.createVowelFilter=function(e){return new s(this,e)}}const workletsUrl="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK",{Pattern:Pattern$1}=strudel;let audioContext;const getAudioContext$1=()=>(audioContext||(audioContext=new AudioContext),audioContext);let destination;const getDestination=()=>{const s=getAudioContext$1();return destination||(destination=s.createGain(),destination.connect(s.destination)),destination},panic=()=>{getDestination().gain.linearRampToValueAtTime(0,getAudioContext$1().currentTime+.01),destination=null},getFilter=(s,e,r)=>{const u=getAudioContext$1().createBiquadFilter();return u.type=s,u.frequency.value=e,u.Q.value=r,u},getADSR=(s,e,r,u,i,n,a)=>{const l=getAudioContext$1().createGain();return l.gain.setValueAtTime(0,n),l.gain.linearRampToValueAtTime(i,n+s),l.gain.linearRampToValueAtTime(r*i,n+s+e),l.gain.setValueAtTime(r*i,a),l.gain.linearRampToValueAtTime(0,a+u),l},getOscillator=({s,freq:e,t:r,duration:u,release:i})=>{const n=getAudioContext$1().createOscillator();return n.type=s||"triangle",n.frequency.value=Number(e),n.start(r),n.stop(r+u+i),n},getSoundfontKey=s=>{var u,i,n,a;if(!globalThis.soundfontList)return!1;if((i=(u=globalThis.soundfontList)==null?void 0:u.instruments)!=null&&i.includes(s))return s;const e=(a=(n=globalThis.soundfontList)==null?void 0:n.instrumentNames)==null?void 0:a.indexOf(s),r=e<10?`00${e}`:e<100?`0${e}`:e;if(e!==-1)return globalThis.soundfontList.instruments.find(l=>l.startsWith(r))},getSampleBufferSource=async(s,e,r,u)=>{let i=0,n=typeof r=="string"?toMidi(r):r||36;i=n-36;const a=getAudioContext$1(),l=getLoadedSamples();if(!l)throw new Error("no samples loaded");const o=l==null?void 0:l[s];if(!o)throw new Error(`sample not found: "${s}", try one of ${Object.keys(l).map(f=>`"${f}"`).join(", ")}.`);if(typeof o!="object")throw new Error("wrong format for sample bank:",s);let c;if(Array.isArray(o))c=o[e%o.length];else{const f=D=>toMidi(D)-n,E=Object.keys(o).filter(D=>!D.startsWith("_")).reduce((D,h,y)=>!D||Math.abs(f(h)){if(!s.includes(":"))return[s,e];let[r,u]=s.split(":");return isNaN(Number(u))?[s,e]:[r,u]};let workletsLoading;function loadWorklets(){return workletsLoading||(workletsLoading=getAudioContext$1().audioWorklet.addModule(workletsUrl),workletsLoading)}function getWorklet(s,e,r){const u=new AudioWorkletNode(s,e);return Object.entries(r).forEach(([i,n])=>{u.parameters.get(i).value=n}),u}if(typeof window<"u")try{loadWorklets()}catch(s){console.warn("could not load AudioWorklet effects coarse, crush and shape",s)}function gainNode(s){const e=getAudioContext$1().createGain();return e.gain.value=s,e}const cutGroups=[];let delays={};function getDelay(s,e,r,u){if(!delays[s]){const n=getAudioContext$1().createFeedbackDelay(1,e,r);n.start(u),n.connect(getDestination()),delays[s]=n}return delays[s].delayTime.value!==e&&delays[s].delayTime.setValueAtTime(e,u),delays[s].feedback.value!==r&&delays[s].feedback.setValueAtTime(r,u),delays[s]}let reverbs={};function getReverb(s,e=2){if(!reverbs[s]){const u=getAudioContext$1().createReverb(e);u.connect(getDestination()),reverbs[s]=u}return reverbs[s].duration!==e&&(reverbs[s]=reverbs[s].setDuration(e),reverbs[s].duration=e),reverbs[s]}function effectSend(s,e,r){const u=gainNode(r);return s.connect(u),u.connect(e),u}const webaudioOutput=async(s,e,r)=>{var u;try{const i=getAudioContext$1();if(typeof s.value!="object")throw new Error(`hap.value ${s.value} is not supported by webaudio output. Hint: append .note() or .s() to the end`);let n=i.currentTime+e,{freq:a,s:l,bank:o,sf:c,clip:A=0,n:d=0,note:m,gain:f=.8,cutoff:E,resonance:D=1,hcutoff:h,hresonance:y=1,bandf:_,bandq:b=1,coarse:P,crush:B,shape:g,pan:x,speed:C=1,begin:S=0,end:L=1,vowel:$,delay:N=0,delayfeedback:R=.5,delaytime:O=.25,unit:U,nudge:G=0,cut:k,loop:M,orbit:H=1,room:Y,size:ae=2,roomsize:ee=ae}=s.value;const{velocity:te=1}=s.context;f*=te;const v=[];if(o&&l&&(l=`${o}_${l}`),typeof l=="string"&&([l,d]=splitSN(l,d)),typeof m=="string"&&([m,d]=splitSN(m,d)),!l||["sine","square","triangle","sawtooth"].includes(l)){const{attack:q=.001,decay:K=.05,sustain:le=.6,release:ue=.01}=s.value;d=m||d||36,typeof d=="string"&&(d=toMidi(d)),!a&&typeof d=="number"&&(a=fromMidi(d));const se=getOscillator({t:n,s:l,freq:a,duration:r,release:ue});v.push(se),v.push(gainNode(.3));const W=getADSR(q,K,le,ue,1,n,n+r);v.push(W)}else{const{attack:q=.001,decay:K=.001,sustain:le=1,release:ue=.001}=s.value;if(C===0)return;if(!l){console.warn("no sample specified");return}const se=getSoundfontKey(l);let W;try{se?W=await globalThis.getFontBufferSource(se,m||d,i):W=await getSampleBufferSource(l,d,m,C)}catch(Ae){console.warn(Ae);return}if(i.currentTime>n){console.warn("sample still loading:",l,d);return}if(!W){console.warn("no buffer source");return}W.playbackRate.value=Math.abs(C)*W.playbackRate.value,U==="c"&&(W.playbackRate.value=W.playbackRate.value*W.buffer.duration);let z=se||A?r:W.buffer.duration/W.playbackRate.value;const ce=S*z*W.playbackRate.value;z=(L-S)*z,M&&(W.loop=!0,W.loopStart=ce,W.loopEnd=ce+z,z=M*z),n+=G,W.start(n,ce),k!==void 0&&((u=cutGroups[k])==null||u.stop(n),cutGroups[k]=W),v.push(W),W.stop(n+z+ue);const De=getADSR(q,K,le,ue,1,n,n+z);v.push(De)}if(v.push(gainNode(f)),E!==void 0&&v.push(getFilter("lowpass",E,D)),h!==void 0&&v.push(getFilter("highpass",h,y)),_!==void 0&&v.push(getFilter("bandpass",_,b)),$!==void 0&&v.push(i.createVowelFilter($)),P!==void 0&&v.push(getWorklet(i,"coarse-processor",{coarse:P})),B!==void 0&&v.push(getWorklet(i,"crush-processor",{crush:B})),g!==void 0&&v.push(getWorklet(i,"shape-processor",{shape:g})),x!==void 0){const q=i.createStereoPanner();q.pan.value=2*x-1,v.push(q)}const X=gainNode(1);v.push(X),X.connect(getDestination());let re;if(N>0&&O>0&&R>0){const q=getDelay(H,O,R,n);re=effectSend(X,q,N)}let Ee;if(Y>0&&ee>0){const q=getReverb(H,ee);Ee=effectSend(X,q,Y)}v.slice(1).reduce((q,K)=>q.connect(K),v[0]),v[0].onended=()=>v.concat([re,Ee]).forEach(q=>q==null?void 0:q.disconnect())}catch(i){console.warn(".out error:",i)}},webaudioOutputTrigger=(s,e,r,u)=>webaudioOutput(e,s-r,e.duration/u);Pattern$1.prototype.out=function(){return this.onTrigger(webaudioOutputTrigger)};var errors={ErrorMessages:{UNEXPECTED_TOKEN(s){return`Unexpected token ${JSON.stringify(s)}`},UNEXPECTED_ILLEGAL_TOKEN(s){return`Unexpected ${JSON.stringify(s)}`},UNEXPECTED_ESCAPED_KEYWORD:"Unexpected escaped keyword",UNEXPECTED_NUMBER:"Unexpected number",UNEXPECTED_STRING:"Unexpected string",UNEXPECTED_IDENTIFIER:"Unexpected identifier",UNEXPECTED_RESERVED_WORD:"Unexpected reserved word",UNEXPECTED_TEMPLATE:"Unexpected template",UNEXPECTED_EOS:"Unexpected end of input",UNEXPECTED_LINE_TERMINATOR:"Unexpected line terminator",UNEXPECTED_COMMA_AFTER_REST:"Unexpected comma after rest",UNEXPECTED_REST_PARAMETERS_INITIALIZATION:"Rest parameter may not have a default initializer",NEWLINE_AFTER_THROW:"Illegal newline after throw",UNTERMINATED_REGEXP:"Invalid regular expression: missing /",INVALID_LAST_REST_PARAMETER:"Rest parameter must be last formal parameter",INVALID_REST_PARAMETERS_INITIALIZATION:"Rest parameter may not have a default initializer",INVALID_REGEXP_FLAGS:"Invalid regular expression flags",INVALID_REGEX:"Invalid regular expression",INVALID_LHS_IN_ASSIGNMENT:"Invalid left-hand side in assignment",INVALID_LHS_IN_BINDING:"Invalid left-hand side in binding",INVALID_LHS_IN_FOR_IN:"Invalid left-hand side in for-in",INVALID_LHS_IN_FOR_OF:"Invalid left-hand side in for-of",INVALID_LHS_IN_FOR_AWAIT:"Invalid left-hand side in for-await",INVALID_UPDATE_OPERAND:"Increment/decrement target must be an identifier or member expression",INVALID_EXPONENTIATION_LHS:"Unary expressions as the left operand of an exponentation expression must be disambiguated with parentheses",MULTIPLE_DEFAULTS_IN_SWITCH:"More than one default clause in switch statement",NO_CATCH_OR_FINALLY:"Missing catch or finally after try",ILLEGAL_RETURN:"Illegal return statement",ILLEGAL_ARROW_FUNCTION_PARAMS:"Illegal arrow function parameter list",INVALID_ASYNC_PARAMS:"Async function parameters must not contain await expressions",INVALID_VAR_INIT_FOR_IN:"Invalid variable declaration in for-in statement",INVALID_VAR_INIT_FOR_OF:"Invalid variable declaration in for-of statement",INVALID_VAR_INIT_FOR_AWAIT:"Invalid variable declaration in for-await statement",UNINITIALIZED_BINDINGPATTERN_IN_FOR_INIT:"Binding pattern appears without initializer in for statement init",ILLEGAL_PROPERTY:"Illegal property initializer",INVALID_ID_BINDING_STRICT_MODE(s){return`The identifier ${JSON.stringify(s)} must not be in binding position in strict mode`},INVALID_ID_IN_LABEL_STRICT_MODE(s){return`The identifier ${JSON.stringify(s)} must not be in label position in strict mode`},INVALID_ID_IN_EXPRESSION_STRICT_MODE(s){return`The identifier ${JSON.stringify(s)} must not be in expression position in strict mode`},INVALID_CALL_TO_SUPER:'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass',INVALID_DELETE_STRICT_MODE:"Identifier expressions must not be deleted in strict mode",DUPLICATE_BINDING(s){return`Duplicate binding ${JSON.stringify(s)}`},ILLEGAL_ID_IN_LEXICAL_DECLARATION(s){return`Lexical declarations must not have a binding named ${JSON.stringify(s)}`},UNITIALIZED_CONST:"Constant lexical declarations must have an initialiser",ILLEGAL_LABEL_IN_BODY(s){return`The body of a ${s} statement must not be a labeled function declaration`},ILLEGEAL_LABEL_IN_IF:"The consequent of an if statement must not be a labeled function declaration",ILLEGAL_LABEL_IN_ELSE:"The alternate of an if statement must not be a labeled function declaration",ILLEGAL_CONTINUE_WITHOUT_ITERATION_WITH_ID(s){return`Continue statement must be nested within an iteration statement with label ${JSON.stringify(s)}`},ILLEGAL_CONTINUE_WITHOUT_ITERATION:"Continue statement must be nested within an iteration statement",ILLEGAL_BREAK_WITHOUT_ITERATION_OR_SWITCH:"Break statement must be nested within an iteration statement or a switch statement",ILLEGAL_WITH_STRICT_MODE:"Strict mode code must not include a with statement",ILLEGAL_ACCESS_SUPER_MEMBER:"Member access on super must be in a method",ILLEGAL_SUPER_CALL:'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass',DUPLICATE_LABEL_DECLARATION(s){return`Label ${JSON.stringify(s)} has already been declared`},ILLEGAL_BREAK_WITHIN_LABEL(s){return`Break statement must be nested within a statement with label ${JSON.stringify(s)}`},ILLEGAL_YIELD_EXPRESSIONS(s){return`${s} parameters must not contain yield expressions`},ILLEGAL_YIELD_IDENTIFIER:'"yield" may not be used as an identifier in this context',ILLEGAL_AWAIT_IDENTIFIER:'"await" may not be used as an identifier in this context',DUPLICATE_CONSTRUCTOR:"Duplicate constructor method in class",ILLEGAL_CONSTRUCTORS:"Constructors cannot be async, generators, getters or setters",ILLEGAL_STATIC_CLASS_NAME:'Static class methods cannot be named "prototype"',NEW_TARGET_ERROR:"new.target must be within function (but not arrow expression) code",DUPLICATE_EXPORT(s){return`Duplicate export ${JSON.stringify(s)}`},UNDECLARED_BINDING(s){return`Exported binding ${JSON.stringify(s)} is not declared`},DUPLICATE_PROPTO_PROP:"Duplicate __proto__ property in object literal not allowed",ILLEGAL_LABEL_FUNC_DECLARATION:"Labeled FunctionDeclarations are disallowed in strict mode",ILLEGAL_FUNC_DECL_IF:"FunctionDeclarations in IfStatements are disallowed in strict mode",ILLEGAL_USE_STRICT:'Functions with non-simple parameter lists may not contain a "use strict" directive',ILLEGAL_EXPORTED_NAME:"Names of variables used in an export specifier from the current module must be identifiers",NO_OCTALS_IN_TEMPLATES:"Template literals may not contain octal escape sequences",NO_AWAIT_IN_ASYNC_PARAMS:'Async arrow parameters may not contain "await"'}},mappings=new Map([["General_Category",new Map([["C","Other"],["Cc","Control"],["cntrl","Control"],["Cf","Format"],["Cn","Unassigned"],["Co","Private_Use"],["Cs","Surrogate"],["L","Letter"],["LC","Cased_Letter"],["Ll","Lowercase_Letter"],["Lm","Modifier_Letter"],["Lo","Other_Letter"],["Lt","Titlecase_Letter"],["Lu","Uppercase_Letter"],["M","Mark"],["Combining_Mark","Mark"],["Mc","Spacing_Mark"],["Me","Enclosing_Mark"],["Mn","Nonspacing_Mark"],["N","Number"],["Nd","Decimal_Number"],["digit","Decimal_Number"],["Nl","Letter_Number"],["No","Other_Number"],["P","Punctuation"],["punct","Punctuation"],["Pc","Connector_Punctuation"],["Pd","Dash_Punctuation"],["Pe","Close_Punctuation"],["Pf","Final_Punctuation"],["Pi","Initial_Punctuation"],["Po","Other_Punctuation"],["Ps","Open_Punctuation"],["S","Symbol"],["Sc","Currency_Symbol"],["Sk","Modifier_Symbol"],["Sm","Math_Symbol"],["So","Other_Symbol"],["Z","Separator"],["Zl","Line_Separator"],["Zp","Paragraph_Separator"],["Zs","Space_Separator"],["Other","Other"],["Control","Control"],["Format","Format"],["Unassigned","Unassigned"],["Private_Use","Private_Use"],["Surrogate","Surrogate"],["Letter","Letter"],["Cased_Letter","Cased_Letter"],["Lowercase_Letter","Lowercase_Letter"],["Modifier_Letter","Modifier_Letter"],["Other_Letter","Other_Letter"],["Titlecase_Letter","Titlecase_Letter"],["Uppercase_Letter","Uppercase_Letter"],["Mark","Mark"],["Spacing_Mark","Spacing_Mark"],["Enclosing_Mark","Enclosing_Mark"],["Nonspacing_Mark","Nonspacing_Mark"],["Number","Number"],["Decimal_Number","Decimal_Number"],["Letter_Number","Letter_Number"],["Other_Number","Other_Number"],["Punctuation","Punctuation"],["Connector_Punctuation","Connector_Punctuation"],["Dash_Punctuation","Dash_Punctuation"],["Close_Punctuation","Close_Punctuation"],["Final_Punctuation","Final_Punctuation"],["Initial_Punctuation","Initial_Punctuation"],["Other_Punctuation","Other_Punctuation"],["Open_Punctuation","Open_Punctuation"],["Symbol","Symbol"],["Currency_Symbol","Currency_Symbol"],["Modifier_Symbol","Modifier_Symbol"],["Math_Symbol","Math_Symbol"],["Other_Symbol","Other_Symbol"],["Separator","Separator"],["Line_Separator","Line_Separator"],["Paragraph_Separator","Paragraph_Separator"],["Space_Separator","Space_Separator"]])],["Script",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])],["Script_Extensions",new Map([["Adlm","Adlam"],["Aghb","Caucasian_Albanian"],["Ahom","Ahom"],["Arab","Arabic"],["Armi","Imperial_Aramaic"],["Armn","Armenian"],["Avst","Avestan"],["Bali","Balinese"],["Bamu","Bamum"],["Bass","Bassa_Vah"],["Batk","Batak"],["Beng","Bengali"],["Bhks","Bhaiksuki"],["Bopo","Bopomofo"],["Brah","Brahmi"],["Brai","Braille"],["Bugi","Buginese"],["Buhd","Buhid"],["Cakm","Chakma"],["Cans","Canadian_Aboriginal"],["Cari","Carian"],["Cham","Cham"],["Cher","Cherokee"],["Copt","Coptic"],["Qaac","Coptic"],["Cprt","Cypriot"],["Cyrl","Cyrillic"],["Deva","Devanagari"],["Dogr","Dogra"],["Dsrt","Deseret"],["Dupl","Duployan"],["Egyp","Egyptian_Hieroglyphs"],["Elba","Elbasan"],["Ethi","Ethiopic"],["Geor","Georgian"],["Glag","Glagolitic"],["Gong","Gunjala_Gondi"],["Gonm","Masaram_Gondi"],["Goth","Gothic"],["Gran","Grantha"],["Grek","Greek"],["Gujr","Gujarati"],["Guru","Gurmukhi"],["Hang","Hangul"],["Hani","Han"],["Hano","Hanunoo"],["Hatr","Hatran"],["Hebr","Hebrew"],["Hira","Hiragana"],["Hluw","Anatolian_Hieroglyphs"],["Hmng","Pahawh_Hmong"],["Hrkt","Katakana_Or_Hiragana"],["Hung","Old_Hungarian"],["Ital","Old_Italic"],["Java","Javanese"],["Kali","Kayah_Li"],["Kana","Katakana"],["Khar","Kharoshthi"],["Khmr","Khmer"],["Khoj","Khojki"],["Knda","Kannada"],["Kthi","Kaithi"],["Lana","Tai_Tham"],["Laoo","Lao"],["Latn","Latin"],["Lepc","Lepcha"],["Limb","Limbu"],["Lina","Linear_A"],["Linb","Linear_B"],["Lisu","Lisu"],["Lyci","Lycian"],["Lydi","Lydian"],["Mahj","Mahajani"],["Maka","Makasar"],["Mand","Mandaic"],["Mani","Manichaean"],["Marc","Marchen"],["Medf","Medefaidrin"],["Mend","Mende_Kikakui"],["Merc","Meroitic_Cursive"],["Mero","Meroitic_Hieroglyphs"],["Mlym","Malayalam"],["Modi","Modi"],["Mong","Mongolian"],["Mroo","Mro"],["Mtei","Meetei_Mayek"],["Mult","Multani"],["Mymr","Myanmar"],["Narb","Old_North_Arabian"],["Nbat","Nabataean"],["Newa","Newa"],["Nkoo","Nko"],["Nshu","Nushu"],["Ogam","Ogham"],["Olck","Ol_Chiki"],["Orkh","Old_Turkic"],["Orya","Oriya"],["Osge","Osage"],["Osma","Osmanya"],["Palm","Palmyrene"],["Pauc","Pau_Cin_Hau"],["Perm","Old_Permic"],["Phag","Phags_Pa"],["Phli","Inscriptional_Pahlavi"],["Phlp","Psalter_Pahlavi"],["Phnx","Phoenician"],["Plrd","Miao"],["Prti","Inscriptional_Parthian"],["Rjng","Rejang"],["Rohg","Hanifi_Rohingya"],["Runr","Runic"],["Samr","Samaritan"],["Sarb","Old_South_Arabian"],["Saur","Saurashtra"],["Sgnw","SignWriting"],["Shaw","Shavian"],["Shrd","Sharada"],["Sidd","Siddham"],["Sind","Khudawadi"],["Sinh","Sinhala"],["Sogd","Sogdian"],["Sogo","Old_Sogdian"],["Sora","Sora_Sompeng"],["Soyo","Soyombo"],["Sund","Sundanese"],["Sylo","Syloti_Nagri"],["Syrc","Syriac"],["Tagb","Tagbanwa"],["Takr","Takri"],["Tale","Tai_Le"],["Talu","New_Tai_Lue"],["Taml","Tamil"],["Tang","Tangut"],["Tavt","Tai_Viet"],["Telu","Telugu"],["Tfng","Tifinagh"],["Tglg","Tagalog"],["Thaa","Thaana"],["Thai","Thai"],["Tibt","Tibetan"],["Tirh","Tirhuta"],["Ugar","Ugaritic"],["Vaii","Vai"],["Wara","Warang_Citi"],["Xpeo","Old_Persian"],["Xsux","Cuneiform"],["Yiii","Yi"],["Zanb","Zanabazar_Square"],["Zinh","Inherited"],["Qaai","Inherited"],["Zyyy","Common"],["Zzzz","Unknown"],["Adlam","Adlam"],["Caucasian_Albanian","Caucasian_Albanian"],["Arabic","Arabic"],["Imperial_Aramaic","Imperial_Aramaic"],["Armenian","Armenian"],["Avestan","Avestan"],["Balinese","Balinese"],["Bamum","Bamum"],["Bassa_Vah","Bassa_Vah"],["Batak","Batak"],["Bengali","Bengali"],["Bhaiksuki","Bhaiksuki"],["Bopomofo","Bopomofo"],["Brahmi","Brahmi"],["Braille","Braille"],["Buginese","Buginese"],["Buhid","Buhid"],["Chakma","Chakma"],["Canadian_Aboriginal","Canadian_Aboriginal"],["Carian","Carian"],["Cherokee","Cherokee"],["Coptic","Coptic"],["Cypriot","Cypriot"],["Cyrillic","Cyrillic"],["Devanagari","Devanagari"],["Dogra","Dogra"],["Deseret","Deseret"],["Duployan","Duployan"],["Egyptian_Hieroglyphs","Egyptian_Hieroglyphs"],["Elbasan","Elbasan"],["Ethiopic","Ethiopic"],["Georgian","Georgian"],["Glagolitic","Glagolitic"],["Gunjala_Gondi","Gunjala_Gondi"],["Masaram_Gondi","Masaram_Gondi"],["Gothic","Gothic"],["Grantha","Grantha"],["Greek","Greek"],["Gujarati","Gujarati"],["Gurmukhi","Gurmukhi"],["Hangul","Hangul"],["Han","Han"],["Hanunoo","Hanunoo"],["Hatran","Hatran"],["Hebrew","Hebrew"],["Hiragana","Hiragana"],["Anatolian_Hieroglyphs","Anatolian_Hieroglyphs"],["Pahawh_Hmong","Pahawh_Hmong"],["Katakana_Or_Hiragana","Katakana_Or_Hiragana"],["Old_Hungarian","Old_Hungarian"],["Old_Italic","Old_Italic"],["Javanese","Javanese"],["Kayah_Li","Kayah_Li"],["Katakana","Katakana"],["Kharoshthi","Kharoshthi"],["Khmer","Khmer"],["Khojki","Khojki"],["Kannada","Kannada"],["Kaithi","Kaithi"],["Tai_Tham","Tai_Tham"],["Lao","Lao"],["Latin","Latin"],["Lepcha","Lepcha"],["Limbu","Limbu"],["Linear_A","Linear_A"],["Linear_B","Linear_B"],["Lycian","Lycian"],["Lydian","Lydian"],["Mahajani","Mahajani"],["Makasar","Makasar"],["Mandaic","Mandaic"],["Manichaean","Manichaean"],["Marchen","Marchen"],["Medefaidrin","Medefaidrin"],["Mende_Kikakui","Mende_Kikakui"],["Meroitic_Cursive","Meroitic_Cursive"],["Meroitic_Hieroglyphs","Meroitic_Hieroglyphs"],["Malayalam","Malayalam"],["Mongolian","Mongolian"],["Mro","Mro"],["Meetei_Mayek","Meetei_Mayek"],["Multani","Multani"],["Myanmar","Myanmar"],["Old_North_Arabian","Old_North_Arabian"],["Nabataean","Nabataean"],["Nko","Nko"],["Nushu","Nushu"],["Ogham","Ogham"],["Ol_Chiki","Ol_Chiki"],["Old_Turkic","Old_Turkic"],["Oriya","Oriya"],["Osage","Osage"],["Osmanya","Osmanya"],["Palmyrene","Palmyrene"],["Pau_Cin_Hau","Pau_Cin_Hau"],["Old_Permic","Old_Permic"],["Phags_Pa","Phags_Pa"],["Inscriptional_Pahlavi","Inscriptional_Pahlavi"],["Psalter_Pahlavi","Psalter_Pahlavi"],["Phoenician","Phoenician"],["Miao","Miao"],["Inscriptional_Parthian","Inscriptional_Parthian"],["Rejang","Rejang"],["Hanifi_Rohingya","Hanifi_Rohingya"],["Runic","Runic"],["Samaritan","Samaritan"],["Old_South_Arabian","Old_South_Arabian"],["Saurashtra","Saurashtra"],["SignWriting","SignWriting"],["Shavian","Shavian"],["Sharada","Sharada"],["Siddham","Siddham"],["Khudawadi","Khudawadi"],["Sinhala","Sinhala"],["Sogdian","Sogdian"],["Old_Sogdian","Old_Sogdian"],["Sora_Sompeng","Sora_Sompeng"],["Soyombo","Soyombo"],["Sundanese","Sundanese"],["Syloti_Nagri","Syloti_Nagri"],["Syriac","Syriac"],["Tagbanwa","Tagbanwa"],["Takri","Takri"],["Tai_Le","Tai_Le"],["New_Tai_Lue","New_Tai_Lue"],["Tamil","Tamil"],["Tangut","Tangut"],["Tai_Viet","Tai_Viet"],["Telugu","Telugu"],["Tifinagh","Tifinagh"],["Tagalog","Tagalog"],["Thaana","Thaana"],["Tibetan","Tibetan"],["Tirhuta","Tirhuta"],["Ugaritic","Ugaritic"],["Vai","Vai"],["Warang_Citi","Warang_Citi"],["Old_Persian","Old_Persian"],["Cuneiform","Cuneiform"],["Yi","Yi"],["Zanabazar_Square","Zanabazar_Square"],["Inherited","Inherited"],["Common","Common"],["Unknown","Unknown"]])]]);const propertyToValueAliases=mappings,matchPropertyValue$1=function(s,e){const r=propertyToValueAliases.get(s);if(!r)throw new Error(`Unknown property \`${s}\`.`);const u=r.get(e);if(u)return u;throw new Error(`Unknown value \`${e}\` for property \`${s}\`.`)};var unicodeMatchPropertyValueEcmascript=matchPropertyValue$1,unicodeCanonicalPropertyNamesEcmascript=new Set(["General_Category","Script","Script_Extensions","Alphabetic","Any","ASCII","ASCII_Hex_Digit","Assigned","Bidi_Control","Bidi_Mirrored","Case_Ignorable","Cased","Changes_When_Casefolded","Changes_When_Casemapped","Changes_When_Lowercased","Changes_When_NFKC_Casefolded","Changes_When_Titlecased","Changes_When_Uppercased","Dash","Default_Ignorable_Code_Point","Deprecated","Diacritic","Emoji","Emoji_Component","Emoji_Modifier","Emoji_Modifier_Base","Emoji_Presentation","Extended_Pictographic","Extender","Grapheme_Base","Grapheme_Extend","Hex_Digit","ID_Continue","ID_Start","Ideographic","IDS_Binary_Operator","IDS_Trinary_Operator","Join_Control","Logical_Order_Exception","Lowercase","Math","Noncharacter_Code_Point","Pattern_Syntax","Pattern_White_Space","Quotation_Mark","Radical","Regional_Indicator","Sentence_Terminal","Soft_Dotted","Terminal_Punctuation","Unified_Ideograph","Uppercase","Variation_Selector","White_Space","XID_Continue","XID_Start"]),unicodePropertyAliasesEcmascript=new Map([["scx","Script_Extensions"],["sc","Script"],["gc","General_Category"],["AHex","ASCII_Hex_Digit"],["Alpha","Alphabetic"],["Bidi_C","Bidi_Control"],["Bidi_M","Bidi_Mirrored"],["Cased","Cased"],["CI","Case_Ignorable"],["CWCF","Changes_When_Casefolded"],["CWCM","Changes_When_Casemapped"],["CWKCF","Changes_When_NFKC_Casefolded"],["CWL","Changes_When_Lowercased"],["CWT","Changes_When_Titlecased"],["CWU","Changes_When_Uppercased"],["Dash","Dash"],["Dep","Deprecated"],["DI","Default_Ignorable_Code_Point"],["Dia","Diacritic"],["Ext","Extender"],["Gr_Base","Grapheme_Base"],["Gr_Ext","Grapheme_Extend"],["Hex","Hex_Digit"],["IDC","ID_Continue"],["Ideo","Ideographic"],["IDS","ID_Start"],["IDSB","IDS_Binary_Operator"],["IDST","IDS_Trinary_Operator"],["Join_C","Join_Control"],["LOE","Logical_Order_Exception"],["Lower","Lowercase"],["Math","Math"],["NChar","Noncharacter_Code_Point"],["Pat_Syn","Pattern_Syntax"],["Pat_WS","Pattern_White_Space"],["QMark","Quotation_Mark"],["Radical","Radical"],["RI","Regional_Indicator"],["SD","Soft_Dotted"],["STerm","Sentence_Terminal"],["Term","Terminal_Punctuation"],["UIdeo","Unified_Ideograph"],["Upper","Uppercase"],["VS","Variation_Selector"],["WSpace","White_Space"],["space","White_Space"],["XIDC","XID_Continue"],["XIDS","XID_Start"]]);const canonicalProperties=unicodeCanonicalPropertyNamesEcmascript,propertyAliases$1=unicodePropertyAliasesEcmascript,matchProperty$1=function(s){if(canonicalProperties.has(s))return s;if(propertyAliases$1.has(s))return propertyAliases$1.get(s);throw new Error(`Unknown property: ${s}`)};var unicodeMatchPropertyEcmascript=matchProperty$1,unicode$2={};unicode$2.whitespaceArray=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];unicode$2.whitespaceBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!0,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1];unicode$2.idStartLargeRegex=/^[\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\u2118-\u211D\u2124\u2126\u2128\u212A-\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\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]$/;unicode$2.idStartBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!0,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1];unicode$2.idContinueLargeRegex=/^[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]$/;unicode$2.idContinueBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!0,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1];const matchPropertyValue=unicodeMatchPropertyValueEcmascript,matchPropertyValueMappings=mappings,matchProperty=unicodeMatchPropertyEcmascript,propertyAliases=unicodePropertyAliasesEcmascript,{idContinueBool:idContinueBool$3,idContinueLargeRegex:idContinueLargeRegex$3,idStartBool:idStartBool$2,idStartLargeRegex:idStartLargeRegex$2}=unicode$2,catchIsFalse=s=>{try{return!!s()}catch{return!1}},syntaxCharacters="^$\\.*+?()[]{}|".split(""),extendedSyntaxCharacters="^$\\.*+?()[|".split(""),controlEscapeCharacters="fnrtv".split(""),controlEscapeCharacterValues={f:"\f".charCodeAt(0),n:` -`.charCodeAt(0),r:"\r".charCodeAt(0),t:" ".charCodeAt(0),v:"\v".charCodeAt(0)},controlCharacters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),hexDigits="0123456789abcdefABCDEF".split(""),decimalDigits="0123456789".split(""),octalDigits="01234567".split(""),INVALID_NAMED_BACKREFERENCE_SENTINEL={};function isIdentifierStart$1(s){return s<128?idStartBool$2[s]:idStartLargeRegex$2.test(String.fromCodePoint(s))}function isIdentifierPart$1(s){return s<128?idContinueBool$3[s]:idContinueLargeRegex$3.test(String.fromCodePoint(s))}class PatternAcceptorState{constructor(e,r){this.pattern=e,this.unicode=r,this.index=0,this.largestBackreference=0,this.backreferenceNames=[],this.groupingNames=[],this.capturingGroups=0}empty(){return this.index>=this.pattern.length}backreference(e){e>this.largestBackreference&&(this.largestBackreference=e)}nextCodePoint(){return this.empty()?null:this.unicode?String.fromCodePoint(this.pattern.codePointAt(this.index)):this.pattern.charAt(this.index)}skipCodePoint(){this.index+=this.nextCodePoint().length}eat(e){return this.index+e.length>this.pattern.length||this.pattern.slice(this.index,this.index+e.length)!==e?!1:(this.index+=e.length,!0)}eatIdentifierCodePoint(){let e,r=this.index,u;if(this.match("\\u")){if(this.skipCodePoint(),e=acceptUnicodeEscape(this),!e.matched)return this.index=r,null;e=e.value,u=String.fromCodePoint(e)}else{if(u=this.nextCodePoint(),u==null)return this.index=r,null;this.index+=u.length,e=u.codePointAt(0)}return{character:u,characterValue:e}}eatIdentifierStart(){let e=this.index,r=this.eatIdentifierCodePoint();return r===null?(this.index=e,null):r.character==="_"||r.character==="$"||isIdentifierStart$1(r.characterValue)?r.character:(this.index=e,null)}eatIdentifierPart(){let e=this.index,r=this.eatIdentifierCodePoint();return r===null?(this.index=e,null):r.character==="\u200C"||r.character==="\u200D"||r.character==="$"||isIdentifierPart$1(r.characterValue)?r.character:(this.index=e,null)}eatAny(...e){for(let r of e)if(this.eat(r))return r;return null}match(e){return this.index+e.length<=this.pattern.length&&this.pattern.slice(this.index,this.index+e.length)===e}matchAny(...e){for(let r of e)if(this.match(r))return!0;return!1}eatNaturalNumber(){let e=[],r=()=>{for(let u of decimalDigits)if(this.eat(u))return e.push(u),!0;return!1};for(;r(););return e.length===0?null:e.join("")}}var src$3=(s,{unicode:e=!1}={})=>{let r=new PatternAcceptorState(s,e),u=acceptDisjunction(r);if(u.matched){if(r.unicode&&r.largestBackreference>r.capturingGroups)return!1;if(r.groupingNames.length>0||r.unicode){for(let i of r.backreferenceNames)if(r.groupingNames.indexOf(i)===-1)return!1}}return u.matched};const backtrackOnFailure=s=>e=>{let r=e.index,u=e.largestBackreference,i=e.capturingGroups,n=s(e);return n.matched||(e.index=r,e.largestBackreference=u,e.capturingGroups=i),n},acceptUnicodeEscape=backtrackOnFailure(s=>{if(!s.eat("u"))return{matched:!1};if(s.unicode&&s.eat("{")){let u=[];for(;!s.eat("}");){let n=s.eatAny(...hexDigits);if(n===null)return{matched:!1};u.push(n)}let i=parseInt(u.join(""),16);return i>1114111?{matched:!1}:{matched:!0,value:i}}let e=[0,0,0,0].map(()=>s.eatAny(...hexDigits));if(e.some(u=>u===null))return{matched:!1};let r=parseInt(e.join(""),16);if(s.unicode&&r>=55296&&r<=56319){let u=backtrackOnFailure(i=>{if(!i.eat("\\u"))return{matched:!1};let n=[0,0,0,0].map(()=>i.eatAny(...hexDigits));if(n.some(l=>l===null))return{matched:!1};let a=parseInt(n.join(""),16);return a<56320||a>=57344?{matched:!1}:{matched:!0,value:65536+((r&1023)<<10)+(a&1023)}})(s);if(u.matched)return u}return{matched:!0,value:r}}),acceptDisjunction=(s,e)=>{do{if(e!==void 0&&s.eat(e))return{matched:!0};if(s.match("|"))continue;if(!acceptAlternative(s,e).matched)return{matched:!1}}while(s.eat("|"));return{matched:e===void 0||!!s.eat(e)}},acceptAlternative=(s,e)=>{for(;!s.match("|")&&!s.empty()&&(e===void 0||!s.match(e));)if(!acceptTerm(s).matched)return{matched:!1};return{matched:!0}},anyOf=(...s)=>e=>{for(let r of s){let u=r(e);if(u.matched)return u}return{matched:!1}},acceptTerm=s=>s.unicode?anyOf(acceptAssertion,acceptQuantified(acceptAtom))(s):anyOf(acceptQuantified(acceptQuantifiableAssertion),acceptAssertion,acceptQuantified(acceptAtom))(s),acceptLabeledGroup=s=>backtrackOnFailure(e=>e.eat("(")?s(e)?acceptDisjunction(e,")"):{matched:!1}:{matched:!1}),acceptQuantifiableAssertion=acceptLabeledGroup(s=>!!s.eatAny("?=","?!")),acceptAssertion=s=>s.eatAny("^","$","\\b","\\B")?{matched:!0}:acceptLabeledGroup(e=>e.unicode?!!e.eatAny("?=","?!","?<=","?({matched:s.eatNaturalNumber()!==null}),acceptQuantified=s=>backtrackOnFailure(e=>{if(!s(e).matched)return{matched:!1};if(e.match("{")){let r=backtrackOnFailure(u=>{u.eat("{");let i=u.eatNaturalNumber();if(i===null)return{matched:!1};if(u.eat(",")&&u.matchAny(...decimalDigits)){let n=u.eatNaturalNumber();if(n===null||parseInt(i)>parseInt(n))return{matched:!1}}return u.eat("}")?(u.eat("?"),{matched:!0}):{matched:!1}})(e);return r.matched?r:{matched:!e.unicode}}else e.eatAny("*","+","?")&&e.eat("?");return{matched:!0}}),acceptCharacterExcept=s=>e=>{let r=e.nextCodePoint();return r===null||s.indexOf(r)!==-1?{matched:!1}:(e.skipCodePoint(),{matched:!0})},acceptPatternCharacter=acceptCharacterExcept(syntaxCharacters),acceptExtendedPatternCharacter=acceptCharacterExcept(extendedSyntaxCharacters),acceptInvalidBracedQuantifier=s=>backtrackOnFailure(e=>({matched:!!(e.eat("{")&&acceptDecimal(e).matched&&(!e.eat(",")||e.match("}")||acceptDecimal(e).matched)&&e.eat("}"))}))(s),acceptAtom=s=>{if(s.unicode)return anyOf(acceptPatternCharacter,r=>({matched:!!r.eat(".")}),backtrackOnFailure(r=>r.eat("\\")?acceptAtomEscape(r):{matched:!1}),acceptCharacterClass,acceptLabeledGroup(r=>r.eat("?:")),acceptGrouping)(s);let e=anyOf(r=>({matched:!!r.eat(".")}),backtrackOnFailure(r=>r.eat("\\")?acceptAtomEscape(r):{matched:!1}),backtrackOnFailure(r=>({matched:r.eat("\\")&&r.match("c")})),acceptCharacterClass,acceptLabeledGroup(r=>r.eat("?:")),acceptGrouping)(s);return!e.matched&&acceptInvalidBracedQuantifier(s).matched?{matched:!1}:e.matched?e:acceptExtendedPatternCharacter(s)},acceptGrouping=backtrackOnFailure(s=>{if(!s.eat("("))return{matched:!1};let e=backtrackOnFailure(r=>s.eat("?")?acceptGroupName(r):{matched:!1})(s);if(!acceptDisjunction(s,")").matched)return{matched:!1};if(e.matched){if(s.groupingNames.indexOf(e.data)!==-1)return{matched:!1};s.groupingNames.push(e.data)}return s.capturingGroups++,{matched:!0}}),acceptDecimalEscape=backtrackOnFailure(s=>{let e=s.eatAny(...decimalDigits);return e===null?{matched:!1}:e==="0"?{matched:!0}:(s.backreference(parseInt(e+(s.eatNaturalNumber()||""))),{matched:!0})}),acceptCharacterClassEscape=s=>s.eatAny("d","D","s","S","w","W")?{matched:!0}:s.unicode?backtrackOnFailure(e=>!e.eat("p{")&&!e.eat("P{")?{matched:!1}:acceptUnicodePropertyValueExpression(e).matched?{matched:!!e.eat("}")}:{matched:!1})(s):{matched:!1},acceptUnicodePropertyName=s=>{let e=[],r;for(;r=s.eatAny(...controlCharacters,"_");)e.push(r);return{matched:e.length>0,data:e.join("")}},acceptUnicodePropertyValue=s=>{let e=[],r;for(;r=s.eatAny(...controlCharacters,...decimalDigits,"_");)e.push(r);return{matched:e.length>0,data:e.join("")}},illegalLoneUnicodePropertyNames=["General_Category","Script","Script_Extensions","scx","sc","gc"],generalCategoryValues=matchPropertyValueMappings.get("General_Category"),acceptLoneUnicodePropertyNameOrValue=s=>{let e=acceptUnicodePropertyValue(s);return!e.matched||illegalLoneUnicodePropertyNames.includes(e.data)?{matched:!1}:{matched:catchIsFalse(()=>matchProperty(e.data))||generalCategoryValues.get(e.data)!=null}},acceptUnicodePropertyValueExpression=s=>anyOf(backtrackOnFailure(e=>{let r=acceptUnicodePropertyName(e);if(!r.matched||!e.eat("="))return{matched:!1};let u=acceptUnicodePropertyValue(e);return u.matched?{matched:catchIsFalse(()=>matchPropertyValue(propertyAliases.get(r.data)||r.data,u.data))}:{matched:!1}}),backtrackOnFailure(acceptLoneUnicodePropertyNameOrValue))(s),acceptCharacterEscape=anyOf(s=>{let e=s.eatAny(...controlEscapeCharacters);return e===null?{matched:!1}:{matched:!0,value:controlEscapeCharacterValues[e]}},backtrackOnFailure(s=>{if(!s.eat("c"))return{matched:!1};let e=s.eatAny(...controlCharacters);return e===null?{matched:!1}:{matched:!0,value:e.charCodeAt(0)%32}}),backtrackOnFailure(s=>!s.eat("0")||s.eatAny(...decimalDigits)?{matched:!1}:{matched:!0,value:0}),backtrackOnFailure(s=>{if(!s.eat("x"))return{matched:!1};let e=[0,0].map(()=>s.eatAny(...hexDigits));return e.some(r=>r===null)?{matched:!1}:{matched:!0,value:parseInt(e.join(""),16)}}),acceptUnicodeEscape,backtrackOnFailure(s=>{if(s.unicode)return{matched:!1};let e=s.eatAny(...octalDigits);if(e===null)return{matched:!1};let r=parseInt(e,8);if(octalDigits.indexOf(s.nextCodePoint())===-1)return{matched:!0,value:r};let u=s.eatAny(...octalDigits),i=parseInt(u,8);if(r<4){if(octalDigits.indexOf(s.nextCodePoint())===-1)return{matched:!0,value:r<<3|i};let n=s.eatAny(...octalDigits),a=parseInt(n,8);return{matched:!0,value:r<<6|i<<3|a}}return{matched:!0,value:r<<3|i}}),backtrackOnFailure(s=>{if(!s.unicode)return{matched:!1};let e=s.eatAny(...syntaxCharacters);return e===null?{matched:!1}:{matched:!0,value:e.charCodeAt(0)}}),s=>!s.unicode||!s.eat("/")?{matched:!1}:{matched:!0,value:"/".charCodeAt(0)},backtrackOnFailure(s=>{if(s.unicode)return{matched:!1};let e=s.nextCodePoint();return e!==null&&e!=="c"&&e!=="k"?(s.skipCodePoint(),{matched:!0,value:e.codePointAt(0)}):{matched:!1}})),acceptGroupNameBackreference=backtrackOnFailure(s=>{if(!s.eat("k"))return{matched:!1};let e=acceptGroupName(s);return e.matched?(s.backreferenceNames.push(e.data),{matched:!0}):(s.backreferenceNames.push(INVALID_NAMED_BACKREFERENCE_SENTINEL),{matched:!0})}),acceptGroupName=backtrackOnFailure(s=>{if(!s.eat("<"))return{matched:!1};let e=[],r=s.eatIdentifierStart();if(!r)return{matched:!1};e.push(r);let u;for(;u=s.eatIdentifierPart();)e.push(u);return s.eat(">")?{matched:e.length>0,data:e.join("")}:{matched:!1}}),acceptAtomEscape=anyOf(acceptDecimalEscape,acceptCharacterClassEscape,acceptCharacterEscape,acceptGroupNameBackreference),acceptCharacterClass=backtrackOnFailure(s=>{if(!s.eat("["))return{matched:!1};s.eat("^");const e=anyOf(o=>({matched:!!o.eat("b"),value:8}),o=>({matched:o.unicode&&!!o.eat("-"),value:"-".charCodeAt(0)}),backtrackOnFailure(o=>{if(o.unicode||!o.eat("c"))return{matched:!1};let c=o.eatAny(...decimalDigits,"_");return c===null?{matched:!1}:{matched:!0,value:c.charCodeAt(0)%32}}),acceptCharacterClassEscape,acceptCharacterEscape,o=>({matched:!o.unicode&&!!o.eat("k"),value:107})),r=o=>{let c=o.nextCodePoint();if(c==="]"||c==="-"||c===null)return{matched:!1};if(c!=="\\")return o.skipCodePoint(),{matched:!0,value:c.codePointAt(0)};o.eat("\\");let A=e(o);return!A.matched&&o.nextCodePoint()==="c"&&!o.unicode?{matched:!0,value:"\\".charCodeAt(0)}:A},u=o=>o.eat("-")?{matched:!0,value:"-".charCodeAt(0)}:r(o),i=(o,c)=>{const A=d=>d.value===void 0&&d.matched;if(o.eat("-")){if(o.match("]"))return{matched:!0};let d=u(o);return d.matched?o.unicode&&(A(c)||A(d))?{matched:!1}:!(!o.unicode&&(A(c)||A(d)))&&c.value>d.value?{matched:!1}:o.match("]")?{matched:!0}:n(o):{matched:!1}}return o.match("]")?{matched:!0}:a(o)},n=o=>{let c=u(o);return c.matched?i(o,c):{matched:!1}},a=o=>{let c=r(o);return c.matched?i(o,c):{matched:!1}};if(s.eat("]"))return{matched:!0};let l=n(s);return l.matched&&s.eat("]"),l});var utils$1={},unicode$1={};unicode$1.whitespaceArray=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];unicode$1.whitespaceBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!0,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1];unicode$1.idStartLargeRegex=/^[\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\u2118-\u211D\u2124\u2126\u2128\u212A-\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\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]$/;unicode$1.idStartBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!0,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1];unicode$1.idContinueLargeRegex=/^[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]$/;unicode$1.idContinueBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!0,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1];const{whitespaceArray:whitespaceArray$1,whitespaceBool:whitespaceBool$1,idStartLargeRegex:idStartLargeRegex$1,idStartBool:idStartBool$1,idContinueLargeRegex:idContinueLargeRegex$2,idContinueBool:idContinueBool$2}=unicode$1,strictReservedWords=["null","true","false","implements","interface","package","private","protected","public","static","let","if","in","do","var","for","new","try","this","else","case","void","with","enum","while","break","catch","throw","const","yield","class","super","return","typeof","delete","switch","export","import","default","finally","extends","function","continue","debugger","instanceof"];utils$1.isStrictModeReservedWord=s=>strictReservedWords.indexOf(s)!==-1;utils$1.isWhiteSpace=s=>s<128?whitespaceBool$1[s]:s===160||s>5759&&whitespaceArray$1.indexOf(s)!==-1;utils$1.isLineTerminator=s=>s===10||s===13||s===8232||s===8233;utils$1.isIdentifierStart=s=>s<128?idStartBool$1[s]:idStartLargeRegex$1.test(String.fromCodePoint(s));utils$1.isIdentifierPart=s=>s<128?idContinueBool$2[s]:idContinueLargeRegex$2.test(String.fromCodePoint(s));utils$1.isDecimalDigit=s=>s>=48&&s<=57;utils$1.getHexValue=s=>s>="0"&&s<="9"?s.charCodeAt(0)-48:s>="a"&&s<="f"?s.charCodeAt(0)-87:s>="A"&&s<="F"?s.charCodeAt(0)-55:-1;const{getHexValue,isLineTerminator:isLineTerminator$1,isWhiteSpace,isIdentifierStart,isIdentifierPart,isDecimalDigit}=utils$1,{ErrorMessages:ErrorMessages$2}=errors,TokenClass$2={Eof:{name:""},Ident:{name:"Identifier",isIdentifierName:!0},Keyword:{name:"Keyword",isIdentifierName:!0},NumericLiteral:{name:"Numeric"},TemplateElement:{name:"Template"},Punctuator:{name:"Punctuator"},StringLiteral:{name:"String"},RegularExpression:{name:"RegularExpression"},Illegal:{name:"Illegal"}},TokenType$2={EOS:{klass:TokenClass$2.Eof,name:"EOS"},LPAREN:{klass:TokenClass$2.Punctuator,name:"("},RPAREN:{klass:TokenClass$2.Punctuator,name:")"},LBRACK:{klass:TokenClass$2.Punctuator,name:"["},RBRACK:{klass:TokenClass$2.Punctuator,name:"]"},LBRACE:{klass:TokenClass$2.Punctuator,name:"{"},RBRACE:{klass:TokenClass$2.Punctuator,name:"}"},COLON:{klass:TokenClass$2.Punctuator,name:":"},SEMICOLON:{klass:TokenClass$2.Punctuator,name:";"},PERIOD:{klass:TokenClass$2.Punctuator,name:"."},ELLIPSIS:{klass:TokenClass$2.Punctuator,name:"..."},ARROW:{klass:TokenClass$2.Punctuator,name:"=>"},CONDITIONAL:{klass:TokenClass$2.Punctuator,name:"?"},INC:{klass:TokenClass$2.Punctuator,name:"++"},DEC:{klass:TokenClass$2.Punctuator,name:"--"},ASSIGN:{klass:TokenClass$2.Punctuator,name:"="},ASSIGN_BIT_OR:{klass:TokenClass$2.Punctuator,name:"|="},ASSIGN_BIT_XOR:{klass:TokenClass$2.Punctuator,name:"^="},ASSIGN_BIT_AND:{klass:TokenClass$2.Punctuator,name:"&="},ASSIGN_SHL:{klass:TokenClass$2.Punctuator,name:"<<="},ASSIGN_SHR:{klass:TokenClass$2.Punctuator,name:">>="},ASSIGN_SHR_UNSIGNED:{klass:TokenClass$2.Punctuator,name:">>>="},ASSIGN_ADD:{klass:TokenClass$2.Punctuator,name:"+="},ASSIGN_SUB:{klass:TokenClass$2.Punctuator,name:"-="},ASSIGN_MUL:{klass:TokenClass$2.Punctuator,name:"*="},ASSIGN_DIV:{klass:TokenClass$2.Punctuator,name:"/="},ASSIGN_MOD:{klass:TokenClass$2.Punctuator,name:"%="},ASSIGN_EXP:{klass:TokenClass$2.Punctuator,name:"**="},COMMA:{klass:TokenClass$2.Punctuator,name:","},OR:{klass:TokenClass$2.Punctuator,name:"||"},AND:{klass:TokenClass$2.Punctuator,name:"&&"},BIT_OR:{klass:TokenClass$2.Punctuator,name:"|"},BIT_XOR:{klass:TokenClass$2.Punctuator,name:"^"},BIT_AND:{klass:TokenClass$2.Punctuator,name:"&"},SHL:{klass:TokenClass$2.Punctuator,name:"<<"},SHR:{klass:TokenClass$2.Punctuator,name:">>"},SHR_UNSIGNED:{klass:TokenClass$2.Punctuator,name:">>>"},ADD:{klass:TokenClass$2.Punctuator,name:"+"},SUB:{klass:TokenClass$2.Punctuator,name:"-"},MUL:{klass:TokenClass$2.Punctuator,name:"*"},DIV:{klass:TokenClass$2.Punctuator,name:"/"},MOD:{klass:TokenClass$2.Punctuator,name:"%"},EXP:{klass:TokenClass$2.Punctuator,name:"**"},EQ:{klass:TokenClass$2.Punctuator,name:"=="},NE:{klass:TokenClass$2.Punctuator,name:"!="},EQ_STRICT:{klass:TokenClass$2.Punctuator,name:"==="},NE_STRICT:{klass:TokenClass$2.Punctuator,name:"!=="},LT:{klass:TokenClass$2.Punctuator,name:"<"},GT:{klass:TokenClass$2.Punctuator,name:">"},LTE:{klass:TokenClass$2.Punctuator,name:"<="},GTE:{klass:TokenClass$2.Punctuator,name:">="},INSTANCEOF:{klass:TokenClass$2.Keyword,name:"instanceof"},IN:{klass:TokenClass$2.Keyword,name:"in"},NOT:{klass:TokenClass$2.Punctuator,name:"!"},BIT_NOT:{klass:TokenClass$2.Punctuator,name:"~"},ASYNC:{klass:TokenClass$2.Keyword,name:"async"},AWAIT:{klass:TokenClass$2.Keyword,name:"await"},ENUM:{klass:TokenClass$2.Keyword,name:"enum"},DELETE:{klass:TokenClass$2.Keyword,name:"delete"},TYPEOF:{klass:TokenClass$2.Keyword,name:"typeof"},VOID:{klass:TokenClass$2.Keyword,name:"void"},BREAK:{klass:TokenClass$2.Keyword,name:"break"},CASE:{klass:TokenClass$2.Keyword,name:"case"},CATCH:{klass:TokenClass$2.Keyword,name:"catch"},CLASS:{klass:TokenClass$2.Keyword,name:"class"},CONTINUE:{klass:TokenClass$2.Keyword,name:"continue"},DEBUGGER:{klass:TokenClass$2.Keyword,name:"debugger"},DEFAULT:{klass:TokenClass$2.Keyword,name:"default"},DO:{klass:TokenClass$2.Keyword,name:"do"},ELSE:{klass:TokenClass$2.Keyword,name:"else"},EXPORT:{klass:TokenClass$2.Keyword,name:"export"},EXTENDS:{klass:TokenClass$2.Keyword,name:"extends"},FINALLY:{klass:TokenClass$2.Keyword,name:"finally"},FOR:{klass:TokenClass$2.Keyword,name:"for"},FUNCTION:{klass:TokenClass$2.Keyword,name:"function"},IF:{klass:TokenClass$2.Keyword,name:"if"},IMPORT:{klass:TokenClass$2.Keyword,name:"import"},LET:{klass:TokenClass$2.Keyword,name:"let"},NEW:{klass:TokenClass$2.Keyword,name:"new"},RETURN:{klass:TokenClass$2.Keyword,name:"return"},SUPER:{klass:TokenClass$2.Keyword,name:"super"},SWITCH:{klass:TokenClass$2.Keyword,name:"switch"},THIS:{klass:TokenClass$2.Keyword,name:"this"},THROW:{klass:TokenClass$2.Keyword,name:"throw"},TRY:{klass:TokenClass$2.Keyword,name:"try"},VAR:{klass:TokenClass$2.Keyword,name:"var"},WHILE:{klass:TokenClass$2.Keyword,name:"while"},WITH:{klass:TokenClass$2.Keyword,name:"with"},NULL:{klass:TokenClass$2.Keyword,name:"null"},TRUE:{klass:TokenClass$2.Keyword,name:"true"},FALSE:{klass:TokenClass$2.Keyword,name:"false"},YIELD:{klass:TokenClass$2.Keyword,name:"yield"},NUMBER:{klass:TokenClass$2.NumericLiteral,name:""},STRING:{klass:TokenClass$2.StringLiteral,name:""},REGEXP:{klass:TokenClass$2.RegularExpression,name:""},IDENTIFIER:{klass:TokenClass$2.Ident,name:""},CONST:{klass:TokenClass$2.Keyword,name:"const"},TEMPLATE:{klass:TokenClass$2.TemplateElement,name:""},ESCAPED_KEYWORD:{klass:TokenClass$2.Keyword,name:""},ILLEGAL:{klass:TokenClass$2.Illegal,name:""}},TT=TokenType$2,I=TT.ILLEGAL,F=!1,T=!0,ONE_CHAR_PUNCTUATOR=[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,TT.NOT,I,I,I,TT.MOD,TT.BIT_AND,I,TT.LPAREN,TT.RPAREN,TT.MUL,TT.ADD,TT.COMMA,TT.SUB,TT.PERIOD,TT.DIV,I,I,I,I,I,I,I,I,I,I,TT.COLON,TT.SEMICOLON,TT.LT,TT.ASSIGN,TT.GT,TT.CONDITIONAL,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,TT.LBRACK,I,TT.RBRACK,TT.BIT_XOR,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,TT.LBRACE,TT.BIT_OR,TT.RBRACE,TT.BIT_NOT],PUNCTUATOR_START=[F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,T,F,F,F,T,T,F,T,T,T,T,T,T,F,T,F,F,F,F,F,F,F,F,F,F,T,T,T,T,T,T,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,T,F,T,T,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,T,T,T,T,F];class JsError$1 extends Error{constructor(e,r,u,i){super(i),this.index=e;try{this.line=r,this.column=u}catch{}this.parseErrorLine=r,this.parseErrorColumn=u,this.description=i,this.message=`[${r}:${u}]: ${i}`}}function fromCodePoint(s){if(s<=65535)return String.fromCharCode(s);let e=String.fromCharCode(Math.floor((s-65536)/1024)+55296),r=String.fromCharCode((s-65536)%1024+56320);return e+r}function decodeUtf16(s,e){return(s-55296)*1024+(e-56320)+65536}class Tokenizer$2{constructor(e){this.source=e,this.index=0,this.line=0,this.lineStart=0,this.startIndex=0,this.startLine=0,this.startLineStart=0,this.lastIndex=0,this.lastLine=0,this.lastLineStart=0,this.hasLineTerminatorBeforeNext=!1,this.tokenIndex=0}saveLexerState(){return{source:this.source,index:this.index,line:this.line,lineStart:this.lineStart,startIndex:this.startIndex,startLine:this.startLine,startLineStart:this.startLineStart,lastIndex:this.lastIndex,lastLine:this.lastLine,lastLineStart:this.lastLineStart,lookahead:this.lookahead,hasLineTerminatorBeforeNext:this.hasLineTerminatorBeforeNext,tokenIndex:this.tokenIndex}}restoreLexerState(e){this.source=e.source,this.index=e.index,this.line=e.line,this.lineStart=e.lineStart,this.startIndex=e.startIndex,this.startLine=e.startLine,this.startLineStart=e.startLineStart,this.lastIndex=e.lastIndex,this.lastLine=e.lastLine,this.lastLineStart=e.lastLineStart,this.lookahead=e.lookahead,this.hasLineTerminatorBeforeNext=e.hasLineTerminatorBeforeNext,this.tokenIndex=e.tokenIndex}createILLEGAL(){return this.startIndex=this.index,this.startLine=this.line,this.startLineStart=this.lineStart,this.indexJSON.stringify(arguments[+n+2]));return e.slice&&e.slice.startLocation&&(e=e.slice.startLocation),new JsError$1(e.offset,e.line,e.column+1,u)}static cse2(e,r,u){return e.charAt(1)===r&&e.charAt(2)===u}static cse3(e,r,u,i){return e.charAt(1)===r&&e.charAt(2)===u&&e.charAt(3)===i}static cse4(e,r,u,i,n){return e.charAt(1)===r&&e.charAt(2)===u&&e.charAt(3)===i&&e.charAt(4)===n}static cse5(e,r,u,i,n,a){return e.charAt(1)===r&&e.charAt(2)===u&&e.charAt(3)===i&&e.charAt(4)===n&&e.charAt(5)===a}static cse6(e,r,u,i,n,a,l){return e.charAt(1)===r&&e.charAt(2)===u&&e.charAt(3)===i&&e.charAt(4)===n&&e.charAt(5)===a&&e.charAt(6)===l}static cse7(e,r,u,i,n,a,l,o){return e.charAt(1)===r&&e.charAt(2)===u&&e.charAt(3)===i&&e.charAt(4)===n&&e.charAt(5)===a&&e.charAt(6)===l&&e.charAt(7)===o}getKeyword(e){if(e.length===1||e.length>10)return TokenType$2.IDENTIFIER;switch(e.length){case 2:switch(e.charAt(0)){case"i":switch(e.charAt(1)){case"f":return TokenType$2.IF;case"n":return TokenType$2.IN}break;case"d":if(e.charAt(1)==="o")return TokenType$2.DO;break}break;case 3:switch(e.charAt(0)){case"v":if(Tokenizer$2.cse2(e,"a","r"))return TokenType$2.VAR;break;case"f":if(Tokenizer$2.cse2(e,"o","r"))return TokenType$2.FOR;break;case"n":if(Tokenizer$2.cse2(e,"e","w"))return TokenType$2.NEW;break;case"t":if(Tokenizer$2.cse2(e,"r","y"))return TokenType$2.TRY;break;case"l":if(Tokenizer$2.cse2(e,"e","t"))return TokenType$2.LET;break}break;case 4:switch(e.charAt(0)){case"t":if(Tokenizer$2.cse3(e,"h","i","s"))return TokenType$2.THIS;if(Tokenizer$2.cse3(e,"r","u","e"))return TokenType$2.TRUE;break;case"n":if(Tokenizer$2.cse3(e,"u","l","l"))return TokenType$2.NULL;break;case"e":if(Tokenizer$2.cse3(e,"l","s","e"))return TokenType$2.ELSE;if(Tokenizer$2.cse3(e,"n","u","m"))return TokenType$2.ENUM;break;case"c":if(Tokenizer$2.cse3(e,"a","s","e"))return TokenType$2.CASE;break;case"v":if(Tokenizer$2.cse3(e,"o","i","d"))return TokenType$2.VOID;break;case"w":if(Tokenizer$2.cse3(e,"i","t","h"))return TokenType$2.WITH;break}break;case 5:switch(e.charAt(0)){case"a":if(Tokenizer$2.cse4(e,"s","y","n","c"))return TokenType$2.ASYNC;if(Tokenizer$2.cse4(e,"w","a","i","t"))return TokenType$2.AWAIT;break;case"w":if(Tokenizer$2.cse4(e,"h","i","l","e"))return TokenType$2.WHILE;break;case"b":if(Tokenizer$2.cse4(e,"r","e","a","k"))return TokenType$2.BREAK;break;case"f":if(Tokenizer$2.cse4(e,"a","l","s","e"))return TokenType$2.FALSE;break;case"c":if(Tokenizer$2.cse4(e,"a","t","c","h"))return TokenType$2.CATCH;if(Tokenizer$2.cse4(e,"o","n","s","t"))return TokenType$2.CONST;if(Tokenizer$2.cse4(e,"l","a","s","s"))return TokenType$2.CLASS;break;case"t":if(Tokenizer$2.cse4(e,"h","r","o","w"))return TokenType$2.THROW;break;case"y":if(Tokenizer$2.cse4(e,"i","e","l","d"))return TokenType$2.YIELD;break;case"s":if(Tokenizer$2.cse4(e,"u","p","e","r"))return TokenType$2.SUPER;break}break;case 6:switch(e.charAt(0)){case"r":if(Tokenizer$2.cse5(e,"e","t","u","r","n"))return TokenType$2.RETURN;break;case"t":if(Tokenizer$2.cse5(e,"y","p","e","o","f"))return TokenType$2.TYPEOF;break;case"d":if(Tokenizer$2.cse5(e,"e","l","e","t","e"))return TokenType$2.DELETE;break;case"s":if(Tokenizer$2.cse5(e,"w","i","t","c","h"))return TokenType$2.SWITCH;break;case"e":if(Tokenizer$2.cse5(e,"x","p","o","r","t"))return TokenType$2.EXPORT;break;case"i":if(Tokenizer$2.cse5(e,"m","p","o","r","t"))return TokenType$2.IMPORT;break}break;case 7:switch(e.charAt(0)){case"d":if(Tokenizer$2.cse6(e,"e","f","a","u","l","t"))return TokenType$2.DEFAULT;break;case"f":if(Tokenizer$2.cse6(e,"i","n","a","l","l","y"))return TokenType$2.FINALLY;break;case"e":if(Tokenizer$2.cse6(e,"x","t","e","n","d","s"))return TokenType$2.EXTENDS;break}break;case 8:switch(e.charAt(0)){case"f":if(Tokenizer$2.cse7(e,"u","n","c","t","i","o","n"))return TokenType$2.FUNCTION;break;case"c":if(Tokenizer$2.cse7(e,"o","n","t","i","n","u","e"))return TokenType$2.CONTINUE;break;case"d":if(Tokenizer$2.cse7(e,"e","b","u","g","g","e","r"))return TokenType$2.DEBUGGER;break}break;case 10:if(e==="instanceof")return TokenType$2.INSTANCEOF;break}return TokenType$2.IDENTIFIER}skipSingleLineComment(e){for(this.index+=e;this.index=r)break;if(u=this.source.charCodeAt(this.index+1),u===47)this.skipSingleLineComment(2),e=!0;else if(u===42)e=this.skipMultiLineComment()||e;else break}else if(!this.moduleIsTheGoalSymbol&&e&&u===45){if(this.index+2>=r)break;if(this.source.charAt(this.index+1)==="-"&&this.source.charAt(this.index+2)===">")this.skipSingleLineComment(3);else break}else if(!this.moduleIsTheGoalSymbol&&u===60)if(this.source.slice(this.index+1,this.index+4)==="!--")this.skipSingleLineComment(4),e=!0;else break;else break}}scanHexEscape2(){if(this.index+2>this.source.length)return-1;let e=getHexValue(this.source.charAt(this.index));if(e===-1)return-1;let r=getHexValue(this.source.charAt(this.index+1));return r===-1?-1:(this.index+=2,e<<4|r)}scanUnicode(){if(this.source.charAt(this.index)==="{"){let n=this.index+1,a=0,l;for(;n1114111)throw this.createILLEGAL();n++}if(l!=="}")throw this.createILLEGAL();if(n===this.index+1)throw++this.index,this.createILLEGAL();return this.index=n+1,a}if(this.index+4>this.source.length)return-1;let e=getHexValue(this.source.charAt(this.index));if(e===-1)return-1;let r=getHexValue(this.source.charAt(this.index+1));if(r===-1)return-1;let u=getHexValue(this.source.charAt(this.index+2));if(u===-1)return-1;let i=getHexValue(this.source.charAt(this.index+3));return i===-1?-1:(this.index+=4,e<<12|r<<8|u<<4|i)}getEscapedIdentifier(){let e="",r=isIdentifierStart;for(;this.index=this.source.length)throw this.createILLEGAL();if(this.source.charAt(this.index)!=="u")throw this.createILLEGAL();if(++this.index,i=this.scanUnicode(),i<0)throw this.createILLEGAL();u=fromCodePoint(i)}else if(i>=55296&&i<=56319){if(this.index>=this.source.length)throw this.createILLEGAL();let a=this.source.charCodeAt(this.index);if(++this.index,!(a>=56320&&a<=57343))throw this.createILLEGAL();i=decodeUtf16(i,a),u=fromCodePoint(i)}if(!r(i)){if(e.length<1)throw this.createILLEGAL();return this.index=n,e}r=isIdentifierPart,e+=u}return e}getIdentifier(){let e=this.index,r=this.source.length,u=this.index,i=isIdentifierStart;for(;u=55296&&a<=56319)return this.index=e,this.getEscapedIdentifier();if(!i(a))return this.index=u,this.source.slice(e,u);++u,i=isIdentifierPart}return this.index=u,this.source.slice(e,u)}scanIdentifier(){let e=this.getLocation(),r=this.index,u=this.source.charAt(this.index)==="\\"?this.getEscapedIdentifier():this.getIdentifier(),i=this.getSlice(r,e);i.text=u;let n=this.index-r!==u.length,a=this.getKeyword(u);return n&&a!==TokenType$2.IDENTIFIER&&(a=TokenType$2.ESCAPED_KEYWORD),{type:a,value:u,slice:i,escaped:n}}getLocation(){return{line:this.startLine+1,column:this.startIndex-this.startLineStart,offset:this.startIndex}}getLastTokenEndLocation(){return{line:this.lastLine+1,column:this.lastIndex-this.lastLineStart,offset:this.lastIndex}}getSlice(e,r){return{text:this.source.slice(e,this.index),start:e,startLocation:r,end:this.index}}scanPunctuatorHelper(){let e=this.source.charAt(this.index);switch(e){case".":return this.source.charAt(this.index+1)!=="."||this.source.charAt(this.index+2)!=="."?TokenType$2.PERIOD:TokenType$2.ELLIPSIS;case"(":return TokenType$2.LPAREN;case")":case";":case",":return ONE_CHAR_PUNCTUATOR[e.charCodeAt(0)];case"{":return TokenType$2.LBRACE;case"}":case"[":case"]":case":":case"?":case"~":return ONE_CHAR_PUNCTUATOR[e.charCodeAt(0)];default:if(this.index+1":return TokenType$2.GTE;case"/":return TokenType$2.ASSIGN_DIV;case"%":return TokenType$2.ASSIGN_MOD;case"^":return TokenType$2.ASSIGN_BIT_XOR;case"&":return TokenType$2.ASSIGN_BIT_AND}}if(this.index+1"&&u===">")return this.index+3"&&u==="=")return TokenType$2.ASSIGN_SHR;if(e==="*"&&u==="=")return TokenType$2.ASSIGN_EXP}switch(e){case"*":return TokenType$2.EXP;case"+":return TokenType$2.INC;case"-":return TokenType$2.DEC;case"<":return TokenType$2.SHL;case">":return TokenType$2.SHR;case"&":return TokenType$2.AND;case"|":return TokenType$2.OR}}else if(e==="="&&r===">")return TokenType$2.ARROW}return ONE_CHAR_PUNCTUATOR[e.charCodeAt(0)]}scanPunctuator(){let e=this.getLocation(),r=this.index,u=this.scanPunctuatorHelper();return this.index+=u.name.length,{type:u,value:u.name,slice:this.getSlice(r,e)}}scanHexLiteral(e,r){let u=this.index;for(;u="0"&&u<="7")this.index++;else{if(isIdentifierPart(u.charCodeAt(0)))throw this.createILLEGAL();break}}if(this.index-e===2)throw this.createILLEGAL();return{type:TokenType$2.NUMBER,value:parseInt(this.getSlice(e,r).text.substr(2),8),slice:this.getSlice(e,r),octal:!1,noctal:!1}}scanLegacyOctalLiteral(e,r){let u=!0;for(;this.index="0"&&n<="7")this.index++;else if(n==="8"||n==="9")u=!1,this.index++;else{if(isIdentifierPart(n.charCodeAt(0)))throw this.createILLEGAL();break}}let i=this.getSlice(e,r);return u?{type:TokenType$2.NUMBER,slice:i,value:parseInt(i.text.substr(1),8),octal:!0,noctal:!u}:(this.eatDecimalLiteralSuffix(),{type:TokenType$2.NUMBER,slice:i,value:+i.text,octal:!0,noctal:!u})}scanNumericLiteral(){let e=this.source.charAt(this.index),r=this.getLocation(),u=this.index;if(e==="0")if(this.index++,this.index="0"&&e<="9")return this.scanLegacyOctalLiteral(u,r)}else{let n=this.getSlice(u,r);return{type:TokenType$2.NUMBER,value:+n.text,slice:n,octal:!1,noctal:!1}}else if(e!==".")for(e=this.source.charAt(this.index);e>="0"&&e<="9";){if(this.index++,this.index===this.source.length){let n=this.getSlice(u,r);return{type:TokenType$2.NUMBER,value:+n.text,slice:n,octal:!1,noctal:!1}}e=this.source.charAt(this.index)}if(this.eatDecimalLiteralSuffix(),this.index!==this.source.length&&isIdentifierStart(this.source.charCodeAt(this.index)))throw this.createILLEGAL();let i=this.getSlice(u,r);return{type:TokenType$2.NUMBER,value:+i.text,slice:i,octal:!1,noctal:!1}}eatDecimalLiteralSuffix(){let e=this.source.charAt(this.index);if(e==="."){if(this.index++,this.index===this.source.length)return;for(e=this.source.charAt(this.index);e>="0"&&e<="9";){if(this.index++,this.index===this.source.length)return;e=this.source.charAt(this.index)}}if(e==="e"||e==="E"){if(this.index++,this.index===this.source.length)throw this.createILLEGAL();if(e=this.source.charAt(this.index),e==="+"||e==="-"){if(this.index++,this.index===this.source.length)throw this.createILLEGAL();e=this.source.charAt(this.index)}if(e>="0"&&e<="9")for(;e>="0"&&e<="9"&&(this.index++,this.index!==this.source.length);)e=this.source.charAt(this.index);else throw this.createILLEGAL()}}scanStringEscape(e,r){if(this.index++,this.index===this.source.length)throw this.createILLEGAL();let u=this.source.charAt(this.index);if(isLineTerminator$1(u.charCodeAt(0)))this.index++,u==="\r"&&this.source.charAt(this.index)===` -`&&this.index++,this.lineStart=this.index,this.line++;else switch(u){case"n":e+=` -`,this.index++;break;case"r":e+="\r",this.index++;break;case"t":e+=" ",this.index++;break;case"u":case"x":{let i;if(this.index++,this.index>=this.source.length)throw this.createILLEGAL();if(i=u==="u"?this.scanUnicode():this.scanHexEscape2(),i<0)throw this.createILLEGAL();e+=fromCodePoint(i);break}case"b":e+="\b",this.index++;break;case"f":e+="\f",this.index++;break;case"v":e+="\v",this.index++;break;default:if(u>="0"&&u<="7"){let i=this.index,n=1;u>="0"&&u<="3"&&(n=0);let a=0;for(;n<3&&u>="0"&&u<="7";){if(this.index++,(n>0||u!=="0")&&(r=this.source.slice(i,this.index)),a*=8,a+=u-"0",n++,this.index===this.source.length)throw this.createILLEGAL();u=this.source.charAt(this.index)}a===0&&n===1&&(u==="8"||u==="9")&&(r=this.source.slice(i,this.index+1)),e+=String.fromCharCode(a)}else{if(u==="8"||u==="9")throw this.createILLEGAL();e+=u,this.index++}}return[e,r]}scanStringLiteral(){let e="",r=this.source.charAt(this.index),u=this.getLocation(),i=this.index;this.index++;let n=null;for(;this.index=this.source.length)return{type:TokenType$2.EOS,slice:this.getSlice(this.index,e)};let r=this.source.charCodeAt(this.index);if(r<128){if(PUNCTUATOR_START[r])return this.scanPunctuator();if(isIdentifierStart(r)||r===92)return this.scanIdentifier();if(r===46)return this.index+1=48&&r<=57)return this.scanNumericLiteral();throw this.createILLEGAL()}else{if(isIdentifierStart(r)||r>=55296&&r<=56319)return this.scanIdentifier();throw this.createILLEGAL()}}eof(){return this.lookahead.type===TokenType$2.EOS}lex(){let e=this.lookahead;return this.lookahead=this.advance(),this.tokenIndex++,e}}var tokenizer={default:Tokenizer$2,Tokenizer:Tokenizer$2,TokenClass:TokenClass$2,TokenType:TokenType$2,JsError:JsError$1},gen={};gen.ArrayAssignmentTarget=class{constructor({elements:s,rest:e}){this.type="ArrayAssignmentTarget",this.elements=s,this.rest=e}};gen.ArrayBinding=class{constructor({elements:s,rest:e}){this.type="ArrayBinding",this.elements=s,this.rest=e}};var ArrayExpression=gen.ArrayExpression=class{constructor({elements:s}){this.type="ArrayExpression",this.elements=s}};gen.ArrowExpression=class{constructor({isAsync:s,params:e,body:r}){this.type="ArrowExpression",this.isAsync=s,this.params=e,this.body=r}};gen.AssignmentExpression=class{constructor({binding:s,expression:e}){this.type="AssignmentExpression",this.binding=s,this.expression=e}};gen.AssignmentTargetIdentifier=class{constructor({name:s}){this.type="AssignmentTargetIdentifier",this.name=s}};gen.AssignmentTargetPropertyIdentifier=class{constructor({binding:s,init:e}){this.type="AssignmentTargetPropertyIdentifier",this.binding=s,this.init=e}};gen.AssignmentTargetPropertyProperty=class{constructor({name:s,binding:e}){this.type="AssignmentTargetPropertyProperty",this.name=s,this.binding=e}};gen.AssignmentTargetWithDefault=class{constructor({binding:s,init:e}){this.type="AssignmentTargetWithDefault",this.binding=s,this.init=e}};gen.AwaitExpression=class{constructor({expression:s}){this.type="AwaitExpression",this.expression=s}};gen.BinaryExpression=class{constructor({left:s,operator:e,right:r}){this.type="BinaryExpression",this.left=s,this.operator=e,this.right=r}};gen.BindingIdentifier=class{constructor({name:s}){this.type="BindingIdentifier",this.name=s}};gen.BindingPropertyIdentifier=class{constructor({binding:s,init:e}){this.type="BindingPropertyIdentifier",this.binding=s,this.init=e}};gen.BindingPropertyProperty=class{constructor({name:s,binding:e}){this.type="BindingPropertyProperty",this.name=s,this.binding=e}};gen.BindingWithDefault=class{constructor({binding:s,init:e}){this.type="BindingWithDefault",this.binding=s,this.init=e}};gen.Block=class{constructor({statements:s}){this.type="Block",this.statements=s}};gen.BlockStatement=class{constructor({block:s}){this.type="BlockStatement",this.block=s}};gen.BreakStatement=class{constructor({label:s}){this.type="BreakStatement",this.label=s}};var CallExpression=gen.CallExpression=class{constructor({callee:s,arguments:e}){this.type="CallExpression",this.callee=s,this.arguments=e}};gen.CatchClause=class{constructor({binding:s,body:e}){this.type="CatchClause",this.binding=s,this.body=e}};gen.ClassDeclaration=class{constructor({name:s,super:e,elements:r}){this.type="ClassDeclaration",this.name=s,this.super=e,this.elements=r}};gen.ClassElement=class{constructor({isStatic:s,method:e}){this.type="ClassElement",this.isStatic=s,this.method=e}};gen.ClassExpression=class{constructor({name:s,super:e,elements:r}){this.type="ClassExpression",this.name=s,this.super=e,this.elements=r}};gen.CompoundAssignmentExpression=class{constructor({binding:s,operator:e,expression:r}){this.type="CompoundAssignmentExpression",this.binding=s,this.operator=e,this.expression=r}};gen.ComputedMemberAssignmentTarget=class{constructor({object:s,expression:e}){this.type="ComputedMemberAssignmentTarget",this.object=s,this.expression=e}};gen.ComputedMemberExpression=class{constructor({object:s,expression:e}){this.type="ComputedMemberExpression",this.object=s,this.expression=e}};gen.ComputedPropertyName=class{constructor({expression:s}){this.type="ComputedPropertyName",this.expression=s}};gen.ConditionalExpression=class{constructor({test:s,consequent:e,alternate:r}){this.type="ConditionalExpression",this.test=s,this.consequent=e,this.alternate=r}};gen.ContinueStatement=class{constructor({label:s}){this.type="ContinueStatement",this.label=s}};gen.DataProperty=class{constructor({name:s,expression:e}){this.type="DataProperty",this.name=s,this.expression=e}};gen.DebuggerStatement=class{constructor(){this.type="DebuggerStatement"}};gen.Directive=class{constructor({rawValue:s}){this.type="Directive",this.rawValue=s}};gen.DoWhileStatement=class{constructor({body:s,test:e}){this.type="DoWhileStatement",this.body=s,this.test=e}};gen.EmptyStatement=class{constructor(){this.type="EmptyStatement"}};gen.Export=class{constructor({declaration:s}){this.type="Export",this.declaration=s}};gen.ExportAllFrom=class{constructor({moduleSpecifier:s}){this.type="ExportAllFrom",this.moduleSpecifier=s}};gen.ExportDefault=class{constructor({body:s}){this.type="ExportDefault",this.body=s}};gen.ExportFrom=class{constructor({namedExports:s,moduleSpecifier:e}){this.type="ExportFrom",this.namedExports=s,this.moduleSpecifier=e}};gen.ExportFromSpecifier=class{constructor({name:s,exportedName:e}){this.type="ExportFromSpecifier",this.name=s,this.exportedName=e}};gen.ExportLocalSpecifier=class{constructor({name:s,exportedName:e}){this.type="ExportLocalSpecifier",this.name=s,this.exportedName=e}};gen.ExportLocals=class{constructor({namedExports:s}){this.type="ExportLocals",this.namedExports=s}};gen.ExpressionStatement=class{constructor({expression:s}){this.type="ExpressionStatement",this.expression=s}};gen.ForAwaitStatement=class{constructor({left:s,right:e,body:r}){this.type="ForAwaitStatement",this.left=s,this.right=e,this.body=r}};gen.ForInStatement=class{constructor({left:s,right:e,body:r}){this.type="ForInStatement",this.left=s,this.right=e,this.body=r}};gen.ForOfStatement=class{constructor({left:s,right:e,body:r}){this.type="ForOfStatement",this.left=s,this.right=e,this.body=r}};gen.ForStatement=class{constructor({init:s,test:e,update:r,body:u}){this.type="ForStatement",this.init=s,this.test=e,this.update=r,this.body=u}};gen.FormalParameters=class{constructor({items:s,rest:e}){this.type="FormalParameters",this.items=s,this.rest=e}};gen.FunctionBody=class{constructor({directives:s,statements:e}){this.type="FunctionBody",this.directives=s,this.statements=e}};gen.FunctionDeclaration=class{constructor({isAsync:s,isGenerator:e,name:r,params:u,body:i}){this.type="FunctionDeclaration",this.isAsync=s,this.isGenerator=e,this.name=r,this.params=u,this.body=i}};gen.FunctionExpression=class{constructor({isAsync:s,isGenerator:e,name:r,params:u,body:i}){this.type="FunctionExpression",this.isAsync=s,this.isGenerator=e,this.name=r,this.params=u,this.body=i}};gen.Getter=class{constructor({name:s,body:e}){this.type="Getter",this.name=s,this.body=e}};var IdentifierExpression=gen.IdentifierExpression=class{constructor({name:s}){this.type="IdentifierExpression",this.name=s}};gen.IfStatement=class{constructor({test:s,consequent:e,alternate:r}){this.type="IfStatement",this.test=s,this.consequent=e,this.alternate=r}};gen.Import=class{constructor({defaultBinding:s,namedImports:e,moduleSpecifier:r}){this.type="Import",this.defaultBinding=s,this.namedImports=e,this.moduleSpecifier=r}};gen.ImportNamespace=class{constructor({defaultBinding:s,namespaceBinding:e,moduleSpecifier:r}){this.type="ImportNamespace",this.defaultBinding=s,this.namespaceBinding=e,this.moduleSpecifier=r}};gen.ImportSpecifier=class{constructor({name:s,binding:e}){this.type="ImportSpecifier",this.name=s,this.binding=e}};gen.LabeledStatement=class{constructor({label:s,body:e}){this.type="LabeledStatement",this.label=s,this.body=e}};gen.LiteralBooleanExpression=class{constructor({value:s}){this.type="LiteralBooleanExpression",this.value=s}};gen.LiteralInfinityExpression=class{constructor(){this.type="LiteralInfinityExpression"}};gen.LiteralNullExpression=class{constructor(){this.type="LiteralNullExpression"}};var LiteralNumericExpression=gen.LiteralNumericExpression=class{constructor({value:s}){this.type="LiteralNumericExpression",this.value=s}};gen.LiteralRegExpExpression=class{constructor({pattern:s,global:e,ignoreCase:r,multiLine:u,dotAll:i,unicode:n,sticky:a}){this.type="LiteralRegExpExpression",this.pattern=s,this.global=e,this.ignoreCase=r,this.multiLine=u,this.dotAll=i,this.unicode=n,this.sticky=a}};var LiteralStringExpression=gen.LiteralStringExpression=class{constructor({value:s}){this.type="LiteralStringExpression",this.value=s}};gen.Method=class{constructor({isAsync:s,isGenerator:e,name:r,params:u,body:i}){this.type="Method",this.isAsync=s,this.isGenerator=e,this.name=r,this.params=u,this.body=i}};gen.Module=class{constructor({directives:s,items:e}){this.type="Module",this.directives=s,this.items=e}};gen.NewExpression=class{constructor({callee:s,arguments:e}){this.type="NewExpression",this.callee=s,this.arguments=e}};gen.NewTargetExpression=class{constructor(){this.type="NewTargetExpression"}};gen.ObjectAssignmentTarget=class{constructor({properties:s,rest:e}){this.type="ObjectAssignmentTarget",this.properties=s,this.rest=e}};gen.ObjectBinding=class{constructor({properties:s,rest:e}){this.type="ObjectBinding",this.properties=s,this.rest=e}};gen.ObjectExpression=class{constructor({properties:s}){this.type="ObjectExpression",this.properties=s}};var ReturnStatement=gen.ReturnStatement=class{constructor({expression:s}){this.type="ReturnStatement",this.expression=s}};gen.Script=class{constructor({directives:s,statements:e}){this.type="Script",this.directives=s,this.statements=e}};gen.Setter=class{constructor({name:s,param:e,body:r}){this.type="Setter",this.name=s,this.param=e,this.body=r}};gen.ShorthandProperty=class{constructor({name:s}){this.type="ShorthandProperty",this.name=s}};gen.SpreadElement=class{constructor({expression:s}){this.type="SpreadElement",this.expression=s}};gen.SpreadProperty=class{constructor({expression:s}){this.type="SpreadProperty",this.expression=s}};gen.StaticMemberAssignmentTarget=class{constructor({object:s,property:e}){this.type="StaticMemberAssignmentTarget",this.object=s,this.property=e}};var StaticMemberExpression=gen.StaticMemberExpression=class{constructor({object:s,property:e}){this.type="StaticMemberExpression",this.object=s,this.property=e}};gen.StaticPropertyName=class{constructor({value:s}){this.type="StaticPropertyName",this.value=s}};gen.Super=class{constructor(){this.type="Super"}};gen.SwitchCase=class{constructor({test:s,consequent:e}){this.type="SwitchCase",this.test=s,this.consequent=e}};gen.SwitchDefault=class{constructor({consequent:s}){this.type="SwitchDefault",this.consequent=s}};gen.SwitchStatement=class{constructor({discriminant:s,cases:e}){this.type="SwitchStatement",this.discriminant=s,this.cases=e}};gen.SwitchStatementWithDefault=class{constructor({discriminant:s,preDefaultCases:e,defaultCase:r,postDefaultCases:u}){this.type="SwitchStatementWithDefault",this.discriminant=s,this.preDefaultCases=e,this.defaultCase=r,this.postDefaultCases=u}};gen.TemplateElement=class{constructor({rawValue:s}){this.type="TemplateElement",this.rawValue=s}};gen.TemplateExpression=class{constructor({tag:s,elements:e}){this.type="TemplateExpression",this.tag=s,this.elements=e}};gen.ThisExpression=class{constructor(){this.type="ThisExpression"}};gen.ThrowStatement=class{constructor({expression:s}){this.type="ThrowStatement",this.expression=s}};gen.TryCatchStatement=class{constructor({body:s,catchClause:e}){this.type="TryCatchStatement",this.body=s,this.catchClause=e}};gen.TryFinallyStatement=class{constructor({body:s,catchClause:e,finalizer:r}){this.type="TryFinallyStatement",this.body=s,this.catchClause=e,this.finalizer=r}};gen.UnaryExpression=class{constructor({operator:s,operand:e}){this.type="UnaryExpression",this.operator=s,this.operand=e}};gen.UpdateExpression=class{constructor({isPrefix:s,operator:e,operand:r}){this.type="UpdateExpression",this.isPrefix=s,this.operator=e,this.operand=r}};gen.VariableDeclaration=class{constructor({kind:s,declarators:e}){this.type="VariableDeclaration",this.kind=s,this.declarators=e}};gen.VariableDeclarationStatement=class{constructor({declaration:s}){this.type="VariableDeclarationStatement",this.declaration=s}};gen.VariableDeclarator=class{constructor({binding:s,init:e}){this.type="VariableDeclarator",this.binding=s,this.init=e}};gen.WhileStatement=class{constructor({test:s,body:e}){this.type="WhileStatement",this.test=s,this.body=e}};gen.WithStatement=class{constructor({object:s,body:e}){this.type="WithStatement",this.object=s,this.body=e}};gen.YieldExpression=class{constructor({expression:s}){this.type="YieldExpression",this.expression=s}};gen.YieldGeneratorExpression=class{constructor({expression:s}){this.type="YieldGeneratorExpression",this.expression=s}};const{ErrorMessages:ErrorMessages$1}=errors,acceptRegex=src$3,{Tokenizer:Tokenizer$1,TokenClass:TokenClass$1,TokenType:TokenType$1}=tokenizer,AST=gen,ARROW_EXPRESSION_PARAMS="CoverParenthesizedExpressionAndArrowParameterList",EXPORT_UNKNOWN_SPECIFIER="ExportNameOfUnknownType",Precedence$4={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,LogicalOR:3,LogicalAND:4,BitwiseOR:5,BitwiseXOR:6,BitwiseAND:7,Equality:8,Relational:9,BitwiseSHIFT:10,Additive:11,Multiplicative:12,Unary:13,Postfix:14,Call:15,New:16,TaggedTemplate:17,Member:18,Primary:19},BinaryPrecedence$1={"||":Precedence$4.LogicalOR,"&&":Precedence$4.LogicalAND,"|":Precedence$4.BitwiseOR,"^":Precedence$4.BitwiseXOR,"&":Precedence$4.BitwiseAND,"==":Precedence$4.Equality,"!=":Precedence$4.Equality,"===":Precedence$4.Equality,"!==":Precedence$4.Equality,"<":Precedence$4.Relational,">":Precedence$4.Relational,"<=":Precedence$4.Relational,">=":Precedence$4.Relational,in:Precedence$4.Relational,instanceof:Precedence$4.Relational,"<<":Precedence$4.BitwiseSHIFT,">>":Precedence$4.BitwiseSHIFT,">>>":Precedence$4.BitwiseSHIFT,"+":Precedence$4.Additive,"-":Precedence$4.Additive,"*":Precedence$4.Multiplicative,"%":Precedence$4.Multiplicative,"/":Precedence$4.Multiplicative};function isValidSimpleAssignmentTarget(s){if(s==null)return!1;switch(s.type){case"IdentifierExpression":case"ComputedMemberExpression":case"StaticMemberExpression":return!0}return!1}function isPrefixOperator(s){switch(s.type){case TokenType$1.INC:case TokenType$1.DEC:case TokenType$1.ADD:case TokenType$1.SUB:case TokenType$1.BIT_NOT:case TokenType$1.NOT:case TokenType$1.DELETE:case TokenType$1.VOID:case TokenType$1.TYPEOF:return!0}return!1}function isUpdateOperator(s){return s.type===TokenType$1.INC||s.type===TokenType$1.DEC}class GenericParser$1 extends Tokenizer$1{constructor(e){super(e),this.allowIn=!0,this.inFunctionBody=!1,this.inParameter=!1,this.allowYieldExpression=!1,this.allowAwaitExpression=!1,this.firstAwaitLocation=null,this.module=!1,this.moduleIsTheGoalSymbol=!1,this.strict=!1,this.isBindingElement=!0,this.isAssignmentTarget=!0,this.firstExprError=null}match(e){return this.lookahead.type===e}matchIdentifier(){switch(this.lookahead.type){case TokenType$1.IDENTIFIER:case TokenType$1.LET:case TokenType$1.YIELD:case TokenType$1.ASYNC:return!0;case TokenType$1.AWAIT:return this.moduleIsTheGoalSymbol?!1:(this.firstAwaitLocation===null&&(this.firstAwaitLocation=this.getLocation()),!0);case TokenType$1.ESCAPED_KEYWORD:return this.lookahead.value==="await"&&!this.moduleIsTheGoalSymbol?(this.firstAwaitLocation===null&&(this.firstAwaitLocation=this.getLocation()),!0):this.lookahead.value==="let"||this.lookahead.value==="yield"||this.lookahead.value==="async"}return!1}eat(e){return this.lookahead.type===e?this.lex():null}expect(e){if(this.lookahead.type===e)return this.lex();throw this.createUnexpected(this.lookahead)}matchContextualKeyword(e){return this.lookahead.type===TokenType$1.IDENTIFIER&&!this.lookahead.escaped&&this.lookahead.value===e}expectContextualKeyword(e){if(this.lookahead.type===TokenType$1.IDENTIFIER&&!this.lookahead.escaped&&this.lookahead.value===e)return this.lex();throw this.createUnexpected(this.lookahead)}eatContextualKeyword(e){return this.lookahead.type===TokenType$1.IDENTIFIER&&!this.lookahead.escaped&&this.lookahead.value===e?this.lex():null}consumeSemicolon(){if(!this.eat(TokenType$1.SEMICOLON)&&!this.hasLineTerminatorBeforeNext&&!this.eof()&&!this.match(TokenType$1.RBRACE))throw this.createUnexpected(this.lookahead)}startNode(e){return e}copyNode(e,r){return r}finishNode(e){return e}parseModule(){this.moduleIsTheGoalSymbol=this.module=this.strict=!0,this.lookahead=this.advance();let e=this.startNode(),{directives:r,statements:u}=this.parseBody();if(!this.match(TokenType$1.EOS))throw this.createUnexpected(this.lookahead);return this.finishNode(new AST.Module({directives:r,items:u}),e)}parseScript(){this.lookahead=this.advance();let e=this.startNode(),{directives:r,statements:u}=this.parseBody();if(!this.match(TokenType$1.EOS))throw this.createUnexpected(this.lookahead);return this.finishNode(new AST.Script({directives:r,statements:u}),e)}parseFunctionBody(){let e=this.inFunctionBody,r=this.module,u=this.strict;this.inFunctionBody=!0,this.module=!1;let i=this.startNode();this.expect(TokenType$1.LBRACE);let n=new AST.FunctionBody(this.parseBody());return this.expect(TokenType$1.RBRACE),n=this.finishNode(n,i),this.inFunctionBody=e,this.module=r,this.strict=u,n}parseBody(){let e=[],r=[],u=!0,i=null;for(;!(this.eof()||this.match(TokenType$1.RBRACE));){let n=this.lookahead,a=n.slice.text,l=n.type===TokenType$1.STRING,o=this.module,c=this.getLocation(),A=this.startNode(),d=o?this.parseModuleItem():this.parseStatementListItem();if(u)if(l&&d.type==="ExpressionStatement"&&d.expression.type==="LiteralStringExpression"){!i&&n.octal&&(i=this.createErrorWithLocation(c,"Unexpected legacy octal escape sequence: \\"+n.octal));let m=a.slice(1,-1);m==="use strict"&&(this.strict=!0),e.push(this.finishNode(new AST.Directive({rawValue:m}),A))}else{if(u=!1,i&&this.strict)throw i;r.push(d)}else r.push(d)}if(i&&this.strict)throw i;return{directives:e,statements:r}}parseImportSpecifier(){let e=this.startNode(),r;if(this.matchIdentifier()){if(r=this.parseIdentifier(),!this.eatContextualKeyword("as"))return this.finishNode(new AST.ImportSpecifier({name:null,binding:this.finishNode(new AST.BindingIdentifier({name:r}),e)}),e)}else this.lookahead.type.klass.isIdentifierName&&(r=this.parseIdentifierName(),this.expectContextualKeyword("as"));return this.finishNode(new AST.ImportSpecifier({name:r,binding:this.parseBindingIdentifier()}),e)}parseNameSpaceBinding(){return this.expect(TokenType$1.MUL),this.expectContextualKeyword("as"),this.parseBindingIdentifier()}parseNamedImports(){let e=[];for(this.expect(TokenType$1.LBRACE);!this.eat(TokenType$1.RBRACE);)if(e.push(this.parseImportSpecifier()),!this.eat(TokenType$1.COMMA)){this.expect(TokenType$1.RBRACE);break}return e}parseFromClause(){return this.expectContextualKeyword("from"),this.expect(TokenType$1.STRING).str}parseImportDeclaration(){let e=this.startNode(),r=null,u;if(this.expect(TokenType$1.IMPORT),this.match(TokenType$1.STRING))return u=this.lex().str,this.consumeSemicolon(),this.finishNode(new AST.Import({defaultBinding:null,namedImports:[],moduleSpecifier:u}),e);if(this.matchIdentifier()&&(r=this.parseBindingIdentifier(),!this.eat(TokenType$1.COMMA))){let i=new AST.Import({defaultBinding:r,namedImports:[],moduleSpecifier:this.parseFromClause()});return this.consumeSemicolon(),this.finishNode(i,e)}if(this.match(TokenType$1.MUL)){let i=new AST.ImportNamespace({defaultBinding:r,namespaceBinding:this.parseNameSpaceBinding(),moduleSpecifier:this.parseFromClause()});return this.consumeSemicolon(),this.finishNode(i,e)}else if(this.match(TokenType$1.LBRACE)){let i=new AST.Import({defaultBinding:r,namedImports:this.parseNamedImports(),moduleSpecifier:this.parseFromClause()});return this.consumeSemicolon(),this.finishNode(i,e)}throw this.createUnexpected(this.lookahead)}parseExportSpecifier(){let e=this.startNode(),r=this.finishNode({type:EXPORT_UNKNOWN_SPECIFIER,isIdentifier:this.matchIdentifier(),value:this.parseIdentifierName()},e);if(this.eatContextualKeyword("as")){let u=this.parseIdentifierName();return this.finishNode({name:r,exportedName:u},e)}return this.finishNode({name:r,exportedName:null},e)}parseExportClause(){this.expect(TokenType$1.LBRACE);let e=[];for(;!this.eat(TokenType$1.RBRACE);)if(e.push(this.parseExportSpecifier()),!this.eat(TokenType$1.COMMA)){this.expect(TokenType$1.RBRACE);break}return e}parseExportDeclaration(){let e=this.startNode(),r;switch(this.expect(TokenType$1.EXPORT),this.lookahead.type){case TokenType$1.MUL:this.lex(),r=new AST.ExportAllFrom({moduleSpecifier:this.parseFromClause()}),this.consumeSemicolon();break;case TokenType$1.LBRACE:{let u=this.parseExportClause(),i=null;this.matchContextualKeyword("from")?(i=this.parseFromClause(),r=new AST.ExportFrom({namedExports:u.map(n=>this.copyNode(n,new AST.ExportFromSpecifier({name:n.name.value,exportedName:n.exportedName}))),moduleSpecifier:i})):(u.forEach(({name:n})=>{if(!n.isIdentifier)throw this.createError(ErrorMessages$1.ILLEGAL_EXPORTED_NAME)}),r=new AST.ExportLocals({namedExports:u.map(n=>this.copyNode(n,new AST.ExportLocalSpecifier({name:this.copyNode(n.name,new AST.IdentifierExpression({name:n.name.value})),exportedName:n.exportedName})))})),this.consumeSemicolon();break}case TokenType$1.CLASS:r=new AST.Export({declaration:this.parseClass({isExpr:!1,inDefault:!1})});break;case TokenType$1.FUNCTION:r=new AST.Export({declaration:this.parseFunction({isExpr:!1,inDefault:!1,allowGenerator:!0,isAsync:!1})});break;case TokenType$1.ASYNC:{let u=this.startNode();this.lex(),r=new AST.Export({declaration:this.parseFunction({isExpr:!1,inDefault:!1,allowGenerator:!0,isAsync:!0,startState:u})});break}case TokenType$1.DEFAULT:switch(this.lex(),this.lookahead.type){case TokenType$1.FUNCTION:r=new AST.ExportDefault({body:this.parseFunction({isExpr:!1,inDefault:!0,allowGenerator:!0,isAsync:!1})});break;case TokenType$1.CLASS:r=new AST.ExportDefault({body:this.parseClass({isExpr:!1,inDefault:!0})});break;case TokenType$1.ASYNC:{let u=this.startNode(),i=this.saveLexerState();if(this.lex(),!this.hasLineTerminatorBeforeNext&&this.match(TokenType$1.FUNCTION)){r=new AST.ExportDefault({body:this.parseFunction({isExpr:!1,inDefault:!0,allowGenerator:!1,isAsync:!0,startState:u})});break}this.restoreLexerState(i)}default:r=new AST.ExportDefault({body:this.parseAssignmentExpression()}),this.consumeSemicolon();break}break;case TokenType$1.VAR:case TokenType$1.LET:case TokenType$1.CONST:r=new AST.Export({declaration:this.parseVariableDeclaration(!0)}),this.consumeSemicolon();break;default:throw this.createUnexpected(this.lookahead)}return this.finishNode(r,e)}parseModuleItem(){switch(this.lookahead.type){case TokenType$1.IMPORT:return this.parseImportDeclaration();case TokenType$1.EXPORT:return this.parseExportDeclaration();default:return this.parseStatementListItem()}}lookaheadLexicalDeclaration(){if(this.match(TokenType$1.LET)||this.match(TokenType$1.CONST)){let e=this.saveLexerState();if(this.lex(),this.matchIdentifier()||this.match(TokenType$1.LBRACE)||this.match(TokenType$1.LBRACK))return this.restoreLexerState(e),!0;this.restoreLexerState(e)}return!1}parseStatementListItem(){if(this.eof())throw this.createUnexpected(this.lookahead);switch(this.lookahead.type){case TokenType$1.FUNCTION:return this.parseFunction({isExpr:!1,inDefault:!1,allowGenerator:!0,isAsync:!1});case TokenType$1.CLASS:return this.parseClass({isExpr:!1,inDefault:!1});case TokenType$1.ASYNC:{let e=this.getLocation(),r=this.saveLexerState();return this.lex(),!this.hasLineTerminatorBeforeNext&&this.match(TokenType$1.FUNCTION)?this.parseFunction({isExpr:!1,inDefault:!1,allowGenerator:!0,isAsync:!0,startState:e}):(this.restoreLexerState(r),this.parseStatement())}default:if(this.lookaheadLexicalDeclaration()){let e=this.startNode();return this.finishNode(this.parseVariableDeclarationStatement(),e)}return this.parseStatement()}}parseStatement(){let e=this.startNode(),r=this.isolateCoverGrammar(this.parseStatementHelper);return this.finishNode(r,e)}parseStatementHelper(){if(this.eof())throw this.createUnexpected(this.lookahead);switch(this.lookahead.type){case TokenType$1.SEMICOLON:return this.parseEmptyStatement();case TokenType$1.LBRACE:return this.parseBlockStatement();case TokenType$1.LPAREN:return this.parseExpressionStatement();case TokenType$1.BREAK:return this.parseBreakStatement();case TokenType$1.CONTINUE:return this.parseContinueStatement();case TokenType$1.DEBUGGER:return this.parseDebuggerStatement();case TokenType$1.DO:return this.parseDoWhileStatement();case TokenType$1.FOR:return this.parseForStatement();case TokenType$1.IF:return this.parseIfStatement();case TokenType$1.RETURN:return this.parseReturnStatement();case TokenType$1.SWITCH:return this.parseSwitchStatement();case TokenType$1.THROW:return this.parseThrowStatement();case TokenType$1.TRY:return this.parseTryStatement();case TokenType$1.VAR:return this.parseVariableDeclarationStatement();case TokenType$1.WHILE:return this.parseWhileStatement();case TokenType$1.WITH:return this.parseWithStatement();case TokenType$1.FUNCTION:case TokenType$1.CLASS:throw this.createUnexpected(this.lookahead);default:{let e=this.saveLexerState();if(this.eat(TokenType$1.LET)){if(this.match(TokenType$1.LBRACK))throw this.restoreLexerState(e),this.createUnexpected(this.lookahead);this.restoreLexerState(e)}else if(this.eat(TokenType$1.ASYNC)){if(!this.hasLineTerminatorBeforeNext&&this.match(TokenType$1.FUNCTION))throw this.createUnexpected(this.lookahead);this.restoreLexerState(e)}let r=this.parseExpression();if(r.type==="IdentifierExpression"&&this.eat(TokenType$1.COLON)){let u=this.match(TokenType$1.FUNCTION)?this.parseFunction({isExpr:!1,inDefault:!1,allowGenerator:!1,isAsync:!1}):this.parseStatement();return new AST.LabeledStatement({label:r.name,body:u})}return this.consumeSemicolon(),new AST.ExpressionStatement({expression:r})}}}parseEmptyStatement(){return this.lex(),new AST.EmptyStatement}parseBlockStatement(){return new AST.BlockStatement({block:this.parseBlock()})}parseExpressionStatement(){let e=this.parseExpression();return this.consumeSemicolon(),new AST.ExpressionStatement({expression:e})}parseBreakStatement(){if(this.lex(),this.eat(TokenType$1.SEMICOLON)||this.hasLineTerminatorBeforeNext)return new AST.BreakStatement({label:null});let e=null;return this.matchIdentifier()&&(e=this.parseIdentifier()),this.consumeSemicolon(),new AST.BreakStatement({label:e})}parseContinueStatement(){if(this.lex(),this.eat(TokenType$1.SEMICOLON)||this.hasLineTerminatorBeforeNext)return new AST.ContinueStatement({label:null});let e=null;return this.matchIdentifier()&&(e=this.parseIdentifier()),this.consumeSemicolon(),new AST.ContinueStatement({label:e})}parseDebuggerStatement(){return this.lex(),this.consumeSemicolon(),new AST.DebuggerStatement}parseDoWhileStatement(){this.lex();let e=this.parseStatement();this.expect(TokenType$1.WHILE),this.expect(TokenType$1.LPAREN);let r=this.parseExpression();return this.expect(TokenType$1.RPAREN),this.eat(TokenType$1.SEMICOLON),new AST.DoWhileStatement({body:e,test:r})}parseForStatement(){this.lex();let e=this.allowAwaitExpression&&this.eat(TokenType$1.AWAIT);this.expect(TokenType$1.LPAREN);let r=null,u=null;if(e&&this.match(TokenType$1.SEMICOLON))throw this.createUnexpected(this.lookahead);if(this.eat(TokenType$1.SEMICOLON))return this.match(TokenType$1.SEMICOLON)||(r=this.parseExpression()),this.expect(TokenType$1.SEMICOLON),this.match(TokenType$1.RPAREN)||(u=this.parseExpression()),new AST.ForStatement({init:null,test:r,update:u,body:this.getIteratorStatementEpilogue()});let i=this.match(TokenType$1.LET),n=this.lookaheadLexicalDeclaration(),a=this.startNode();if(this.match(TokenType$1.VAR)||n){let c=this.allowIn;this.allowIn=!1;let A=this.parseVariableDeclaration(!1);if(this.allowIn=c,A.declarators.length===1&&(this.match(TokenType$1.IN)||this.matchContextualKeyword("of"))){let d,m=A.declarators[0];if(this.match(TokenType$1.IN)){if(e)throw this.createUnexpected(this.lookahead);if(m.init!==null&&(this.strict||A.kind!=="var"||m.binding.type!=="BindingIdentifier"))throw this.createError(ErrorMessages$1.INVALID_VAR_INIT_FOR_IN);d=AST.ForInStatement,this.lex(),u=this.parseExpression()}else{if(m.init!==null)throw this.createError(e?ErrorMessages$1.INVALID_VAR_INIT_FOR_AWAIT:ErrorMessages$1.INVALID_VAR_INIT_FOR_OF);e?d=AST.ForAwaitStatement:d=AST.ForOfStatement,this.lex(),u=this.parseAssignmentExpression()}let f=this.getIteratorStatementEpilogue();return new d({left:A,right:u,body:f})}else if(e)throw this.createUnexpected(this.lookahead);if(this.expect(TokenType$1.SEMICOLON),A.declarators.some(d=>d.binding.type!=="BindingIdentifier"&&d.init===null))throw this.createError(ErrorMessages$1.UNINITIALIZED_BINDINGPATTERN_IN_FOR_INIT);return this.match(TokenType$1.SEMICOLON)||(r=this.parseExpression()),this.expect(TokenType$1.SEMICOLON),this.match(TokenType$1.RPAREN)||(u=this.parseExpression()),new AST.ForStatement({init:A,test:r,update:u,body:this.getIteratorStatementEpilogue()})}let l=this.allowIn;this.allowIn=!1;let o=this.inheritCoverGrammar(this.parseAssignmentExpressionOrTarget);if(this.allowIn=l,this.isAssignmentTarget&&o.type!=="AssignmentExpression"&&(this.match(TokenType$1.IN)||this.matchContextualKeyword("of"))){if((o.type==="ObjectAssignmentTarget"||o.type==="ArrayAssignmentTarget")&&(this.firstExprError=null),i&&this.matchContextualKeyword("of"))throw this.createError(e?ErrorMessages$1.INVALID_LHS_IN_FOR_AWAIT:ErrorMessages$1.INVALID_LHS_IN_FOR_OF);let c;if(this.match(TokenType$1.IN)){if(e)throw this.createUnexpected(this.lookahead);c=AST.ForInStatement,this.lex(),u=this.parseExpression()}else e?c=AST.ForAwaitStatement:c=AST.ForOfStatement,this.lex(),u=this.parseAssignmentExpression();return new c({left:this.transformDestructuring(o),right:u,body:this.getIteratorStatementEpilogue()})}else if(e)throw this.createError(ErrorMessages$1.INVALID_LHS_IN_FOR_AWAIT);if(this.firstExprError)throw this.firstExprError;for(;this.eat(TokenType$1.COMMA);){let c=this.parseAssignmentExpression();o=this.finishNode(new AST.BinaryExpression({left:o,operator:",",right:c}),a)}if(this.match(TokenType$1.IN))throw this.createError(ErrorMessages$1.INVALID_LHS_IN_FOR_IN);if(this.matchContextualKeyword("of"))throw this.createError(ErrorMessages$1.INVALID_LHS_IN_FOR_OF);return this.expect(TokenType$1.SEMICOLON),this.match(TokenType$1.SEMICOLON)||(r=this.parseExpression()),this.expect(TokenType$1.SEMICOLON),this.match(TokenType$1.RPAREN)||(u=this.parseExpression()),new AST.ForStatement({init:o,test:r,update:u,body:this.getIteratorStatementEpilogue()})}getIteratorStatementEpilogue(){return this.expect(TokenType$1.RPAREN),this.parseStatement()}parseIfStatementChild(){return this.match(TokenType$1.FUNCTION)?this.parseFunction({isExpr:!1,inDefault:!1,allowGenerator:!1,isAsync:!1}):this.parseStatement()}parseIfStatement(){this.lex(),this.expect(TokenType$1.LPAREN);let e=this.parseExpression();this.expect(TokenType$1.RPAREN);let r=this.parseIfStatementChild(),u=null;return this.eat(TokenType$1.ELSE)&&(u=this.parseIfStatementChild()),new AST.IfStatement({test:e,consequent:r,alternate:u})}parseReturnStatement(){if(!this.inFunctionBody)throw this.createError(ErrorMessages$1.ILLEGAL_RETURN);if(this.lex(),this.eat(TokenType$1.SEMICOLON)||this.hasLineTerminatorBeforeNext)return new AST.ReturnStatement({expression:null});let e=null;return!this.match(TokenType$1.RBRACE)&&!this.eof()&&(e=this.parseExpression()),this.consumeSemicolon(),new AST.ReturnStatement({expression:e})}parseSwitchStatement(){this.lex(),this.expect(TokenType$1.LPAREN);let e=this.parseExpression();if(this.expect(TokenType$1.RPAREN),this.expect(TokenType$1.LBRACE),this.eat(TokenType$1.RBRACE))return new AST.SwitchStatement({discriminant:e,cases:[]});let r=this.parseSwitchCases();if(this.match(TokenType$1.DEFAULT)){let u=this.parseSwitchDefault(),i=this.parseSwitchCases();if(this.match(TokenType$1.DEFAULT))throw this.createError(ErrorMessages$1.MULTIPLE_DEFAULTS_IN_SWITCH);return this.expect(TokenType$1.RBRACE),new AST.SwitchStatementWithDefault({discriminant:e,preDefaultCases:r,defaultCase:u,postDefaultCases:i})}return this.expect(TokenType$1.RBRACE),new AST.SwitchStatement({discriminant:e,cases:r})}parseSwitchCases(){let e=[];for(;!(this.eof()||this.match(TokenType$1.RBRACE)||this.match(TokenType$1.DEFAULT));)e.push(this.parseSwitchCase());return e}parseSwitchCase(){let e=this.startNode();return this.expect(TokenType$1.CASE),this.finishNode(new AST.SwitchCase({test:this.parseExpression(),consequent:this.parseSwitchCaseBody()}),e)}parseSwitchDefault(){let e=this.startNode();return this.expect(TokenType$1.DEFAULT),this.finishNode(new AST.SwitchDefault({consequent:this.parseSwitchCaseBody()}),e)}parseSwitchCaseBody(){return this.expect(TokenType$1.COLON),this.parseStatementListInSwitchCaseBody()}parseStatementListInSwitchCaseBody(){let e=[];for(;!(this.eof()||this.match(TokenType$1.RBRACE)||this.match(TokenType$1.DEFAULT)||this.match(TokenType$1.CASE));)e.push(this.parseStatementListItem());return e}parseThrowStatement(){let e=this.lex();if(this.hasLineTerminatorBeforeNext)throw this.createErrorWithLocation(e,ErrorMessages$1.NEWLINE_AFTER_THROW);let r=this.parseExpression();return this.consumeSemicolon(),new AST.ThrowStatement({expression:r})}parseTryStatement(){this.lex();let e=this.parseBlock();if(this.match(TokenType$1.CATCH)){let r=this.parseCatchClause();if(this.eat(TokenType$1.FINALLY)){let u=this.parseBlock();return new AST.TryFinallyStatement({body:e,catchClause:r,finalizer:u})}return new AST.TryCatchStatement({body:e,catchClause:r})}if(this.eat(TokenType$1.FINALLY)){let r=this.parseBlock();return new AST.TryFinallyStatement({body:e,catchClause:null,finalizer:r})}throw this.createError(ErrorMessages$1.NO_CATCH_OR_FINALLY)}parseVariableDeclarationStatement(){let e=this.parseVariableDeclaration(!0);return this.consumeSemicolon(),new AST.VariableDeclarationStatement({declaration:e})}parseWhileStatement(){this.lex(),this.expect(TokenType$1.LPAREN);let e=this.parseExpression(),r=this.getIteratorStatementEpilogue();return new AST.WhileStatement({test:e,body:r})}parseWithStatement(){this.lex(),this.expect(TokenType$1.LPAREN);let e=this.parseExpression();this.expect(TokenType$1.RPAREN);let r=this.parseStatement();return new AST.WithStatement({object:e,body:r})}parseCatchClause(){let e=this.startNode();this.lex();let r=null;if(this.match(TokenType$1.LPAREN)){if(this.lex(),this.match(TokenType$1.RPAREN)||this.match(TokenType$1.LPAREN))throw this.createUnexpected(this.lookahead);r=this.parseBindingTarget(),this.expect(TokenType$1.RPAREN)}let u=this.parseBlock();return this.finishNode(new AST.CatchClause({binding:r,body:u}),e)}parseBlock(){let e=this.startNode();this.expect(TokenType$1.LBRACE);let r=[];for(;!this.match(TokenType$1.RBRACE);)r.push(this.parseStatementListItem());return this.expect(TokenType$1.RBRACE),this.finishNode(new AST.Block({statements:r}),e)}parseVariableDeclaration(e){let r=this.startNode(),u=this.lex(),i=u.type===TokenType$1.VAR?"var":u.type===TokenType$1.CONST?"const":"let",n=this.parseVariableDeclaratorList(e);return this.finishNode(new AST.VariableDeclaration({kind:i,declarators:n}),r)}parseVariableDeclaratorList(e){let r=[];do r.push(this.parseVariableDeclarator(e));while(this.eat(TokenType$1.COMMA));return r}parseVariableDeclarator(e){let r=this.startNode();if(this.match(TokenType$1.LPAREN))throw this.createUnexpected(this.lookahead);let u=this.allowIn;this.allowIn=!0;let i=this.parseBindingTarget();this.allowIn=u,e&&i.type!=="BindingIdentifier"&&!this.match(TokenType$1.ASSIGN)&&this.expect(TokenType$1.ASSIGN);let n=null;return this.eat(TokenType$1.ASSIGN)&&(n=this.parseAssignmentExpression()),this.finishNode(new AST.VariableDeclarator({binding:i,init:n}),r)}isolateCoverGrammar(e){let r=this.isBindingElement,u=this.isAssignmentTarget,i=this.firstExprError,n;if(this.isBindingElement=this.isAssignmentTarget=!0,this.firstExprError=null,n=e.call(this),this.firstExprError!==null)throw this.firstExprError;return this.isBindingElement=r,this.isAssignmentTarget=u,this.firstExprError=i,n}inheritCoverGrammar(e){let r=this.isBindingElement,u=this.isAssignmentTarget,i=this.firstExprError,n;return this.isBindingElement=this.isAssignmentTarget=!0,this.firstExprError=null,n=e.call(this),this.isBindingElement=this.isBindingElement&&r,this.isAssignmentTarget=this.isAssignmentTarget&&u,this.firstExprError=i||this.firstExprError,n}parseExpression(){let e=this.startNode(),r=this.parseAssignmentExpression();if(this.match(TokenType$1.COMMA))for(;!this.eof()&&this.match(TokenType$1.COMMA);){this.lex();let u=this.parseAssignmentExpression();r=this.finishNode(new AST.BinaryExpression({left:r,operator:",",right:u}),e)}return r}finishArrowParams(e){let{params:r=null,rest:u=null}=e;if(e.type!==ARROW_EXPRESSION_PARAMS)if(e.type==="IdentifierExpression")r=[this.targetToBinding(this.transformDestructuring(e))];else throw this.createUnexpected(this.lookahead);return this.copyNode(e,new AST.FormalParameters({items:r,rest:u}))}parseArrowExpressionTail(e,r,u){this.expect(TokenType$1.ARROW);let i=this.allowYieldExpression,n=this.allowAwaitExpression,a=this.firstAwaitLocation;this.allowYieldExpression=!1,this.allowAwaitExpression=r,this.firstAwaitLocation=null;let l;if(this.match(TokenType$1.LBRACE)){let o=this.allowIn;this.allowIn=!0,l=this.parseFunctionBody(),this.allowIn=o}else l=this.parseAssignmentExpression();return this.allowYieldExpression=i,this.allowAwaitExpression=n,this.firstAwaitLocation=a,this.finishNode(new AST.ArrowExpression({isAsync:r,params:e,body:l}),u)}parseAssignmentExpression(){return this.isolateCoverGrammar(this.parseAssignmentExpressionOrTarget)}parseAssignmentExpressionOrTarget(){let e=this.startNode();if(this.allowYieldExpression&&this.match(TokenType$1.YIELD))return this.isBindingElement=this.isAssignmentTarget=!1,this.parseYieldExpression();let r=this.parseConditionalExpression();if(!this.hasLineTerminatorBeforeNext&&this.match(TokenType$1.ARROW)){this.isBindingElement=this.isAssignmentTarget=!1,this.firstExprError=null;let l=r.type===ARROW_EXPRESSION_PARAMS&&r.isAsync;return this.parseArrowExpressionTail(this.finishArrowParams(r),l,e)}let u=!1,i=this.lookahead;switch(i.type){case TokenType$1.ASSIGN_BIT_OR:case TokenType$1.ASSIGN_BIT_XOR:case TokenType$1.ASSIGN_BIT_AND:case TokenType$1.ASSIGN_SHL:case TokenType$1.ASSIGN_SHR:case TokenType$1.ASSIGN_SHR_UNSIGNED:case TokenType$1.ASSIGN_ADD:case TokenType$1.ASSIGN_SUB:case TokenType$1.ASSIGN_MUL:case TokenType$1.ASSIGN_DIV:case TokenType$1.ASSIGN_MOD:case TokenType$1.ASSIGN_EXP:u=!0;break}if(u){if(!this.isAssignmentTarget||!isValidSimpleAssignmentTarget(r))throw this.createError(ErrorMessages$1.INVALID_LHS_IN_ASSIGNMENT);r=this.transformDestructuring(r)}else if(i.type===TokenType$1.ASSIGN){if(!this.isAssignmentTarget)throw this.createError(ErrorMessages$1.INVALID_LHS_IN_ASSIGNMENT);r=this.transformDestructuring(r)}else return r;this.lex();let n=this.parseAssignmentExpression();this.firstExprError=null;let a;return i.type===TokenType$1.ASSIGN?a=new AST.AssignmentExpression({binding:r,expression:n}):(a=new AST.CompoundAssignmentExpression({binding:r,operator:i.type.name,expression:n}),this.isBindingElement=this.isAssignmentTarget=!1),this.finishNode(a,e)}targetToBinding(e){if(e===null)return null;switch(e.type){case"AssignmentTargetIdentifier":return this.copyNode(e,new AST.BindingIdentifier({name:e.name}));case"ArrayAssignmentTarget":return this.copyNode(e,new AST.ArrayBinding({elements:e.elements.map(r=>this.targetToBinding(r)),rest:this.targetToBinding(e.rest)}));case"ObjectAssignmentTarget":return this.copyNode(e,new AST.ObjectBinding({properties:e.properties.map(r=>this.targetToBinding(r)),rest:this.targetToBinding(e.rest)}));case"AssignmentTargetPropertyIdentifier":return this.copyNode(e,new AST.BindingPropertyIdentifier({binding:this.targetToBinding(e.binding),init:e.init}));case"AssignmentTargetPropertyProperty":return this.copyNode(e,new AST.BindingPropertyProperty({name:e.name,binding:this.targetToBinding(e.binding)}));case"AssignmentTargetWithDefault":return this.copyNode(e,new AST.BindingWithDefault({binding:this.targetToBinding(e.binding),init:e.init}))}throw new Error("Not reached")}transformDestructuring(e){switch(e.type){case"DataProperty":return this.copyNode(e,new AST.AssignmentTargetPropertyProperty({name:e.name,binding:this.transformDestructuringWithDefault(e.expression)}));case"ShorthandProperty":return this.copyNode(e,new AST.AssignmentTargetPropertyIdentifier({binding:this.copyNode(e,new AST.AssignmentTargetIdentifier({name:e.name.name})),init:null}));case"ObjectExpression":{let r=e.properties.length>0?e.properties[e.properties.length-1]:void 0;return r!=null&&r.type==="SpreadProperty"?this.copyNode(e,new AST.ObjectAssignmentTarget({properties:e.properties.slice(0,-1).map(u=>u&&this.transformDestructuringWithDefault(u)),rest:this.transformDestructuring(r.expression)})):this.copyNode(e,new AST.ObjectAssignmentTarget({properties:e.properties.map(u=>u&&this.transformDestructuringWithDefault(u)),rest:null}))}case"ArrayExpression":{let r=e.elements[e.elements.length-1];return r!=null&&r.type==="SpreadElement"?this.copyNode(e,new AST.ArrayAssignmentTarget({elements:e.elements.slice(0,-1).map(u=>u&&this.transformDestructuringWithDefault(u)),rest:this.copyNode(r.expression,this.transformDestructuring(r.expression))})):this.copyNode(e,new AST.ArrayAssignmentTarget({elements:e.elements.map(u=>u&&this.transformDestructuringWithDefault(u)),rest:null}))}case"IdentifierExpression":return this.copyNode(e,new AST.AssignmentTargetIdentifier({name:e.name}));case"StaticPropertyName":return this.copyNode(e,new AST.AssignmentTargetIdentifier({name:e.value}));case"ComputedMemberExpression":return this.copyNode(e,new AST.ComputedMemberAssignmentTarget({object:e.object,expression:e.expression}));case"StaticMemberExpression":return this.copyNode(e,new AST.StaticMemberAssignmentTarget({object:e.object,property:e.property}));case"ArrayAssignmentTarget":case"ObjectAssignmentTarget":case"ComputedMemberAssignmentTarget":case"StaticMemberAssignmentTarget":case"AssignmentTargetIdentifier":case"AssignmentTargetPropertyIdentifier":case"AssignmentTargetPropertyProperty":case"AssignmentTargetWithDefault":return e}throw new Error("Not reached")}transformDestructuringWithDefault(e){switch(e.type){case"AssignmentExpression":return this.copyNode(e,new AST.AssignmentTargetWithDefault({binding:this.transformDestructuring(e.binding),init:e.expression}))}return this.transformDestructuring(e)}lookaheadAssignmentExpression(){if(this.matchIdentifier())return!0;switch(this.lookahead.type){case TokenType$1.ADD:case TokenType$1.ASSIGN_DIV:case TokenType$1.BIT_NOT:case TokenType$1.CLASS:case TokenType$1.DEC:case TokenType$1.DELETE:case TokenType$1.DIV:case TokenType$1.FALSE:case TokenType$1.FUNCTION:case TokenType$1.INC:case TokenType$1.LBRACE:case TokenType$1.LBRACK:case TokenType$1.LPAREN:case TokenType$1.NEW:case TokenType$1.NOT:case TokenType$1.NULL:case TokenType$1.NUMBER:case TokenType$1.STRING:case TokenType$1.SUB:case TokenType$1.SUPER:case TokenType$1.THIS:case TokenType$1.TRUE:case TokenType$1.TYPEOF:case TokenType$1.VOID:case TokenType$1.TEMPLATE:return!0}return!1}parseYieldExpression(){let e=this.startNode();if(this.lex(),this.hasLineTerminatorBeforeNext)return this.finishNode(new AST.YieldExpression({expression:null}),e);let r=!!this.eat(TokenType$1.MUL),u=null;(r||this.lookaheadAssignmentExpression())&&(u=this.parseAssignmentExpression());let i=r?AST.YieldGeneratorExpression:AST.YieldExpression;return this.finishNode(new i({expression:u}),e)}parseConditionalExpression(){let e=this.startNode(),r=this.parseBinaryExpression();if(this.firstExprError)return r;if(this.eat(TokenType$1.CONDITIONAL)){this.isBindingElement=this.isAssignmentTarget=!1;let u=this.allowIn;this.allowIn=!0;let i=this.isolateCoverGrammar(this.parseAssignmentExpression);this.allowIn=u,this.expect(TokenType$1.COLON);let n=this.isolateCoverGrammar(this.parseAssignmentExpression);return this.finishNode(new AST.ConditionalExpression({test:r,consequent:i,alternate:n}),e)}return r}isBinaryOperator(e){switch(e){case TokenType$1.OR:case TokenType$1.AND:case TokenType$1.BIT_OR:case TokenType$1.BIT_XOR:case TokenType$1.BIT_AND:case TokenType$1.EQ:case TokenType$1.NE:case TokenType$1.EQ_STRICT:case TokenType$1.NE_STRICT:case TokenType$1.LT:case TokenType$1.GT:case TokenType$1.LTE:case TokenType$1.GTE:case TokenType$1.INSTANCEOF:case TokenType$1.SHL:case TokenType$1.SHR:case TokenType$1.SHR_UNSIGNED:case TokenType$1.ADD:case TokenType$1.SUB:case TokenType$1.MUL:case TokenType$1.DIV:case TokenType$1.MOD:return!0;case TokenType$1.IN:return this.allowIn;default:return!1}}parseBinaryExpression(){let e=this.startNode(),r=this.parseExponentiationExpression();if(this.firstExprError)return r;let u=this.lookahead.type;if(!this.isBinaryOperator(u))return r;this.isBindingElement=this.isAssignmentTarget=!1,this.lex();let i=[];i.push({startState:e,left:r,operator:u,precedence:BinaryPrecedence$1[u.name]}),e=this.startNode();let n=this.isolateCoverGrammar(this.parseExponentiationExpression);for(u=this.lookahead.type;this.isBinaryOperator(u);){let a=BinaryPrecedence$1[u.name];for(;i.length&&a<=i[i.length-1].precedence;){let l=i[i.length-1],o=l.operator;r=l.left,i.pop(),e=l.startState,n=this.finishNode(new AST.BinaryExpression({left:r,operator:o.name,right:n}),e)}this.lex(),i.push({startState:e,left:n,operator:u,precedence:a}),e=this.startNode(),n=this.isolateCoverGrammar(this.parseExponentiationExpression),u=this.lookahead.type}return i.reduceRight((a,l)=>this.finishNode(new AST.BinaryExpression({left:l.left,operator:l.operator.name,right:a}),l.startState),n)}parseExponentiationExpression(){let e=this.startNode(),r=this.lookahead.type===TokenType$1.LPAREN,u=this.parseUnaryExpression();if(this.lookahead.type!==TokenType$1.EXP)return u;if(u.type==="UnaryExpression"&&!r)throw this.createError(ErrorMessages$1.INVALID_EXPONENTIATION_LHS);this.lex(),this.isBindingElement=this.isAssignmentTarget=!1;let i=this.isolateCoverGrammar(this.parseExponentiationExpression);return this.finishNode(new AST.BinaryExpression({left:u,operator:"**",right:i}),e)}parseUnaryExpression(){if(this.lookahead.type.klass!==TokenClass$1.Punctuator&&this.lookahead.type.klass!==TokenClass$1.Keyword)return this.parseUpdateExpression();let e=this.startNode();if(this.allowAwaitExpression&&this.eat(TokenType$1.AWAIT)){this.isBindingElement=this.isAssignmentTarget=!1;let i=this.isolateCoverGrammar(this.parseUnaryExpression);return this.finishNode(new AST.AwaitExpression({expression:i}),e)}let r=this.lookahead;if(!isPrefixOperator(r))return this.parseUpdateExpression();this.lex(),this.isBindingElement=this.isAssignmentTarget=!1;let u;if(isUpdateOperator(r)){let i=this.getLocation(),n=this.isolateCoverGrammar(this.parseUnaryExpression);if(!isValidSimpleAssignmentTarget(n))throw this.createErrorWithLocation(i,ErrorMessages$1.INVALID_UPDATE_OPERAND);n=this.transformDestructuring(n),u=new AST.UpdateExpression({isPrefix:!0,operator:r.value,operand:n})}else{let i=this.isolateCoverGrammar(this.parseUnaryExpression);u=new AST.UnaryExpression({operator:r.value,operand:i})}return this.finishNode(u,e)}parseUpdateExpression(){let e=this.getLocation(),r=this.startNode(),u=this.parseLeftHandSideExpression({allowCall:!0});if(this.firstExprError||this.hasLineTerminatorBeforeNext)return u;let i=this.lookahead;if(!isUpdateOperator(i))return u;if(this.lex(),this.isBindingElement=this.isAssignmentTarget=!1,!isValidSimpleAssignmentTarget(u))throw this.createErrorWithLocation(e,ErrorMessages$1.INVALID_UPDATE_OPERAND);return u=this.transformDestructuring(u),this.finishNode(new AST.UpdateExpression({isPrefix:!1,operator:i.value,operand:u}),r)}parseLeftHandSideExpression({allowCall:e}){let r=this.startNode(),u=this.allowIn;this.allowIn=!0;let i,n=this.lookahead;if(this.eat(TokenType$1.SUPER))if(this.isBindingElement=!1,this.isAssignmentTarget=!1,i=this.finishNode(new AST.Super,r),this.match(TokenType$1.LPAREN))if(e)i=this.finishNode(new AST.CallExpression({callee:i,arguments:this.parseArgumentList().args}),r);else throw this.createUnexpected(n);else if(this.match(TokenType$1.LBRACK))i=this.finishNode(new AST.ComputedMemberExpression({object:i,expression:this.parseComputedMember()}),r),this.isAssignmentTarget=!0;else if(this.match(TokenType$1.PERIOD))i=this.finishNode(new AST.StaticMemberExpression({object:i,property:this.parseStaticMember()}),r),this.isAssignmentTarget=!0;else throw this.createUnexpected(n);else if(this.match(TokenType$1.NEW))this.isBindingElement=this.isAssignmentTarget=!1,i=this.parseNewExpression();else if(this.match(TokenType$1.ASYNC)){if(i=this.parsePrimaryExpression(),i.type==="IdentifierExpression"&&e&&!this.hasLineTerminatorBeforeNext){if(this.matchIdentifier()){let a=this.startNode(),l=this.allowAwaitExpression;this.allowAwaitExpression=!0;let o=this.parseBindingIdentifier();return this.allowAwaitExpression=l,this.ensureArrow(),this.finishNode({type:ARROW_EXPRESSION_PARAMS,params:[o],rest:null,isAsync:!0},a)}if(this.match(TokenType$1.LPAREN)){let a=this.startNode(),l=this.firstAwaitLocation;this.firstAwaitLocation=null;let{args:o,locationFollowingFirstSpread:c}=this.parseArgumentList();if(this.isBindingElement&&!this.hasLineTerminatorBeforeNext&&this.match(TokenType$1.ARROW)){if(c!==null)throw this.createErrorWithLocation(c,ErrorMessages$1.UNEXPECTED_TOKEN(","));if(this.firstAwaitLocation!==null)throw this.createErrorWithLocation(this.firstAwaitLocation,ErrorMessages$1.NO_AWAIT_IN_ASYNC_PARAMS);let A=null;if(o.length>0&&o[o.length-1].type==="SpreadElement"){if(A=this.targetToBinding(this.transformDestructuringWithDefault(o[o.length-1].expression)),A.init!=null)throw this.createError(ErrorMessages$1.UNEXPECTED_REST_PARAMETERS_INITIALIZATION);o=o.slice(0,-1)}let d=o.map(m=>this.targetToBinding(this.transformDestructuringWithDefault(m)));return this.finishNode({type:ARROW_EXPRESSION_PARAMS,params:d,rest:A,isAsync:!0},a)}this.firstAwaitLocation=l||this.firstAwaitLocation,this.isBindingElement=this.isAssignmentTarget=!1,i=this.finishNode(new AST.CallExpression({callee:i,arguments:o}),r)}}}else if(i=this.parsePrimaryExpression(),this.firstExprError)return i;for(;;)if(e&&this.match(TokenType$1.LPAREN))this.isBindingElement=this.isAssignmentTarget=!1,i=this.finishNode(new AST.CallExpression({callee:i,arguments:this.parseArgumentList().args}),r);else if(this.match(TokenType$1.LBRACK))this.isBindingElement=!1,this.isAssignmentTarget=!0,i=this.finishNode(new AST.ComputedMemberExpression({object:i,expression:this.parseComputedMember()}),r);else if(this.match(TokenType$1.PERIOD))this.isBindingElement=!1,this.isAssignmentTarget=!0,i=this.finishNode(new AST.StaticMemberExpression({object:i,property:this.parseStaticMember()}),r);else if(this.match(TokenType$1.TEMPLATE))this.isBindingElement=this.isAssignmentTarget=!1,i=this.finishNode(new AST.TemplateExpression({tag:i,elements:this.parseTemplateElements()}),r);else break;return this.allowIn=u,i}parseTemplateElements(){let e=this.startNode(),r=this.lookahead;if(r.tail)return this.lex(),[this.finishNode(new AST.TemplateElement({rawValue:r.slice.text.slice(1,-1)}),e)];let u=[this.finishNode(new AST.TemplateElement({rawValue:this.lex().slice.text.slice(1,-2)}),e)];for(;;){if(u.push(this.parseExpression()),!this.match(TokenType$1.RBRACE))throw this.createILLEGAL();if(this.index=this.startIndex,this.line=this.startLine,this.lineStart=this.startLineStart,this.lookahead=this.scanTemplateElement(),e=this.startNode(),r=this.lex(),r.tail)return u.push(this.finishNode(new AST.TemplateElement({rawValue:r.slice.text.slice(1,-1)}),e)),u;u.push(this.finishNode(new AST.TemplateElement({rawValue:r.slice.text.slice(1,-2)}),e))}}parseStaticMember(){if(this.lex(),this.lookahead.type.klass.isIdentifierName)return this.lex().value;throw this.createUnexpected(this.lookahead)}parseComputedMember(){this.lex();let e=this.parseExpression();return this.expect(TokenType$1.RBRACK),e}parseNewExpression(){let e=this.startNode();if(this.lex(),this.eat(TokenType$1.PERIOD))return this.expectContextualKeyword("target"),this.finishNode(new AST.NewTargetExpression,e);let r=this.isolateCoverGrammar(()=>this.parseLeftHandSideExpression({allowCall:!1}));return this.finishNode(new AST.NewExpression({callee:r,arguments:this.match(TokenType$1.LPAREN)?this.parseArgumentList().args:[]}),e)}parseRegexFlags(e){let r=!1,u=!1,i=!1,n=!1,a=!1,l=!1;for(let o=0;on&&this.transformDestructuringWithDefault(n)),rest:i}),r);if(this.firstExprError){let n=u[u.length-1];return n!=null&&n.type==="SpreadElement"?this.finishNode(new AST.ArrayAssignmentTarget({elements:u.slice(0,-1).map(a=>a&&this.transformDestructuringWithDefault(a)),rest:this.transformDestructuring(n.expression)}),r):this.finishNode(new AST.ArrayAssignmentTarget({elements:u.map(a=>a&&this.transformDestructuringWithDefault(a)),rest:null}),r)}return this.finishNode(new AST.ArrayExpression({elements:u}),r)}parseObjectExpression(){let e=this.startNode();this.lex();let r=[];for(;!this.match(TokenType$1.RBRACE);){let u=!1;if(this.match(TokenType$1.ELLIPSIS)){u=!0;let i=this.parseSpreadPropertyDefinition();r.push(i)}else{let i=this.inheritCoverGrammar(this.parsePropertyDefinition);r.push(i)}this.match(TokenType$1.RBRACE)||(this.expect(TokenType$1.COMMA),u&&(this.isBindingElement=this.isAssignmentTarget=!1))}if(this.expect(TokenType$1.RBRACE),this.firstExprError){if(!this.isAssignmentTarget)throw this.createError(ErrorMessages$1.INVALID_LHS_IN_BINDING);let u=r[r.length-1];return u!=null&&u.type==="SpreadProperty"?this.finishNode(new AST.ObjectAssignmentTarget({properties:r.slice(0,-1).map(i=>this.transformDestructuringWithDefault(i)),rest:this.transformDestructuring(u.expression)}),e):this.finishNode(new AST.ObjectAssignmentTarget({properties:r.map(i=>this.transformDestructuringWithDefault(i)),rest:null}),e)}return this.finishNode(new AST.ObjectExpression({properties:r}),e)}parseSpreadPropertyDefinition(){let e=this.startNode();this.expect(TokenType$1.ELLIPSIS);let r=this.parseAssignmentExpression();return isValidSimpleAssignmentTarget(r)?r.type!=="IdentifierExpression"&&(this.isBindingElement=!1):this.isBindingElement=this.isAssignmentTarget=!1,this.finishNode(new AST.SpreadProperty({expression:r}),e)}parsePropertyDefinition(){let e=this.getLocation(),r=this.startNode(),u=this.lookahead,{methodOrKey:i,kind:n}=this.parseMethodDefinition();switch(n){case"method":return this.isBindingElement=this.isAssignmentTarget=!1,i;case"identifier":if(u.value==="await"&&this.firstAwaitLocation==null&&(this.firstAwaitLocation=this.getLocation()),this.eat(TokenType$1.ASSIGN)){if(this.allowYieldExpression&&u.value==="yield")throw this.createError(ErrorMessages$1.ILLEGAL_YIELD_IDENTIFIER);if(this.allowAwaitExpression&&u.value==="await")throw this.createError(ErrorMessages$1.ILLEGAL_AWAIT_IDENTIFIER);let l=this.isolateCoverGrammar(this.parseAssignmentExpression);return this.firstExprError=this.createErrorWithLocation(e,ErrorMessages$1.ILLEGAL_PROPERTY),this.finishNode(new AST.AssignmentTargetPropertyIdentifier({binding:this.transformDestructuring(i),init:l}),r)}else if(!this.match(TokenType$1.COLON)){if(this.allowYieldExpression&&u.value==="yield")throw this.createError(ErrorMessages$1.ILLEGAL_YIELD_IDENTIFIER);if(this.allowAwaitExpression&&u.value==="await")throw this.createError(ErrorMessages$1.ILLEGAL_AWAIT_IDENTIFIER);if(u.type===TokenType$1.IDENTIFIER||u.value==="let"||u.value==="yield"||u.value==="async"||u.value==="await")return this.finishNode(new AST.ShorthandProperty({name:this.finishNode(new AST.IdentifierExpression({name:i.value}),r)}),r);throw this.createUnexpected(u)}}this.expect(TokenType$1.COLON);let a=this.inheritCoverGrammar(this.parseAssignmentExpressionOrTarget);return this.firstExprError?this.finishNode(new AST.AssignmentTargetPropertyProperty({name:i,binding:a}),r):this.finishNode(new AST.DataProperty({name:i,expression:a}),r)}parsePropertyName(){let e=this.lookahead,r=this.startNode();if(this.eof())throw this.createUnexpected(e);switch(e.type){case TokenType$1.STRING:return{name:this.finishNode(new AST.StaticPropertyName({value:this.parseStringLiteral().value}),r),binding:null};case TokenType$1.NUMBER:{let i=this.parseNumericLiteral();return{name:this.finishNode(new AST.StaticPropertyName({value:`${i.type==="LiteralInfinityExpression"?1/0:i.value}`}),r),binding:null}}case TokenType$1.LBRACK:{this.lex();let i=this.parseAssignmentExpression();return this.expect(TokenType$1.RBRACK),{name:this.finishNode(new AST.ComputedPropertyName({expression:i}),r),binding:null}}}let u=this.parseIdentifierName();return{name:this.finishNode(new AST.StaticPropertyName({value:u}),r),binding:this.finishNode(new AST.BindingIdentifier({name:u}),r)}}lookaheadPropertyName(){switch(this.lookahead.type){case TokenType$1.NUMBER:case TokenType$1.STRING:case TokenType$1.LBRACK:return!0;default:return this.lookahead.type.klass.isIdentifierName}}parseMethodDefinition(){let e=this.lookahead,r=this.startNode(),u=this.saveLexerState(),i=!!this.eat(TokenType$1.ASYNC);i&&this.hasLineTerminatorBeforeNext&&(i=!1,this.restoreLexerState(u));let n=!!this.eat(TokenType$1.MUL);i&&!this.lookaheadPropertyName()&&(i=!1,n=!1,this.restoreLexerState(u));let{name:a}=this.parsePropertyName();if(!n&&!i&&e.type===TokenType$1.IDENTIFIER&&e.value.length===3){if(e.value==="get"&&this.lookaheadPropertyName()&&!e.escaped){({name:a}=this.parsePropertyName()),this.expect(TokenType$1.LPAREN),this.expect(TokenType$1.RPAREN);let l=this.allowYieldExpression,o=this.allowAwaitExpression,c=this.firstAwaitLocation;this.allowYieldExpression=!1,this.allowAwaitExpression=!1,this.firstAwaitLocation=null;let A=this.parseFunctionBody();return this.allowYieldExpression=l,this.allowAwaitExpression=o,this.firstAwaitLocation=c,{methodOrKey:this.finishNode(new AST.Getter({name:a,body:A}),r),kind:"method"}}else if(e.value==="set"&&this.lookaheadPropertyName()&&!e.escaped){({name:a}=this.parsePropertyName()),this.expect(TokenType$1.LPAREN);let l=this.allowYieldExpression,o=this.allowAwaitExpression,c=this.firstAwaitLocation;this.allowYieldExpression=!1,this.allowAwaitExpression=!1,this.firstAwaitLocation=null;let A=this.parseBindingElement();this.expect(TokenType$1.RPAREN);let d=this.parseFunctionBody();return this.allowYieldExpression=l,this.allowAwaitExpression=o,this.firstAwaitLocation=c,{methodOrKey:this.finishNode(new AST.Setter({name:a,param:A,body:d}),r),kind:"method"}}}if(i){let l=this.allowYieldExpression,o=this.allowAwaitExpression;this.allowYieldExpression=n,this.allowAwaitExpression=!0;let c=this.parseParams();this.allowYieldExpression=n,this.allowAwaitExpression=!0;let A=this.parseFunctionBody();return this.allowYieldExpression=l,this.allowAwaitExpression=o,{methodOrKey:this.finishNode(new AST.Method({isAsync:i,isGenerator:n,name:a,params:c,body:A}),r),kind:"method"}}if(this.match(TokenType$1.LPAREN)){let l=this.allowYieldExpression,o=this.allowAwaitExpression,c=this.firstAwaitLocation;this.allowYieldExpression=n,this.allowAwaitExpression=!1,this.firstAwaitLocation=null;let A=this.parseParams(),d=this.parseFunctionBody();return this.allowYieldExpression=l,this.allowAwaitExpression=o,this.firstAwaitLocation=c,{methodOrKey:this.finishNode(new AST.Method({isAsync:i,isGenerator:n,name:a,params:A,body:d}),r),kind:"method"}}if(n&&this.match(TokenType$1.COLON))throw this.createUnexpected(this.lookahead);return{methodOrKey:a,kind:e.type.klass.isIdentifierName?"identifier":"property",escaped:e.escaped}}parseClass({isExpr:e,inDefault:r}){let u=this.startNode();this.lex();let i=null,n=null;if(this.matchIdentifier())i=this.parseBindingIdentifier();else if(!e)if(r)i=new AST.BindingIdentifier({name:"*default*"});else throw this.createUnexpected(this.lookahead);this.eat(TokenType$1.EXTENDS)&&(n=this.isolateCoverGrammar(()=>this.parseLeftHandSideExpression({allowCall:!0}))),this.expect(TokenType$1.LBRACE);let a=[];for(;!this.eat(TokenType$1.RBRACE);){if(this.eat(TokenType$1.SEMICOLON))continue;let l=!1,o=this.startNode(),{methodOrKey:c,kind:A,escaped:d}=this.parseMethodDefinition();if(A==="identifier"&&c.value==="static"&&!d&&(l=!0,{methodOrKey:c,kind:A}=this.parseMethodDefinition()),A==="method")a.push(this.finishNode(new AST.ClassElement({isStatic:l,method:c}),o));else throw this.createError("Only methods are allowed in classes")}return this.finishNode(new(e?AST.ClassExpression:AST.ClassDeclaration)({name:i,super:n,elements:a}),u)}parseFunction({isExpr:e,inDefault:r,allowGenerator:u,isAsync:i,startState:n=this.startNode()}){this.lex();let a=null,l=u&&!!this.eat(TokenType$1.MUL),o=this.allowYieldExpression,c=this.allowAwaitExpression,A=this.firstAwaitLocation;if(e&&(this.allowYieldExpression=l,this.allowAwaitExpression=i),!this.match(TokenType$1.LPAREN))a=this.parseBindingIdentifier();else if(!e)if(r)a=new AST.BindingIdentifier({name:"*default*"});else throw this.createUnexpected(this.lookahead);this.allowYieldExpression=l,this.allowAwaitExpression=i,this.firstAwaitLocation=null;let d=this.parseParams(),m=this.parseFunctionBody();return this.allowYieldExpression=o,this.allowAwaitExpression=c,this.firstAwaitLocation=A,this.finishNode(new(e?AST.FunctionExpression:AST.FunctionDeclaration)({isAsync:i,isGenerator:l,name:a,params:d,body:m}),n)}parseArrayBinding(){let e=this.startNode();this.expect(TokenType$1.LBRACK);let r=[],u=null;for(;!this.match(TokenType$1.RBRACK);){let i;if(this.eat(TokenType$1.COMMA))i=null;else{if(this.eat(TokenType$1.ELLIPSIS)){u=this.parseBindingTarget();break}else i=this.parseBindingElement();this.match(TokenType$1.RBRACK)||this.expect(TokenType$1.COMMA)}r.push(i)}return this.expect(TokenType$1.RBRACK),this.finishNode(new AST.ArrayBinding({elements:r,rest:u}),e)}parseBindingProperty(){let e=this.startNode(),r=this.matchIdentifier(),u=this.lookahead,{name:i,binding:n}=this.parsePropertyName();if(r&&i.type==="StaticPropertyName"&&!this.match(TokenType$1.COLON)){if(this.allowYieldExpression&&u.value==="yield")throw this.createError(ErrorMessages$1.ILLEGAL_YIELD_IDENTIFIER);if(this.allowAwaitExpression&&u.value==="await")throw this.createError(ErrorMessages$1.ILLEGAL_AWAIT_IDENTIFIER);let a=null;return this.eat(TokenType$1.ASSIGN)&&(a=this.parseAssignmentExpression()),this.finishNode(new AST.BindingPropertyIdentifier({binding:n,init:a}),e)}return this.expect(TokenType$1.COLON),n=this.parseBindingElement(),this.finishNode(new AST.BindingPropertyProperty({name:i,binding:n}),e)}parseObjectBinding(){let e=this.startNode();this.expect(TokenType$1.LBRACE);let r=[],u=null;for(;!this.match(TokenType$1.RBRACE);){if(this.eat(TokenType$1.ELLIPSIS)){u=this.parseBindingIdentifier();break}r.push(this.parseBindingProperty()),this.match(TokenType$1.RBRACE)||this.expect(TokenType$1.COMMA)}return this.expect(TokenType$1.RBRACE),this.finishNode(new AST.ObjectBinding({properties:r,rest:u}),e)}parseBindingTarget(){if(this.matchIdentifier())return this.parseBindingIdentifier();switch(this.lookahead.type){case TokenType$1.LBRACK:return this.parseArrayBinding();case TokenType$1.LBRACE:return this.parseObjectBinding()}throw this.createUnexpected(this.lookahead)}parseBindingElement(){let e=this.startNode(),r=this.parseBindingTarget();if(this.eat(TokenType$1.ASSIGN)){let u=this.parseAssignmentExpression();r=this.finishNode(new AST.BindingWithDefault({binding:r,init:u}),e)}return r}parseParam(){let e=this.inParameter;this.inParameter=!0;let r=this.parseBindingElement();return this.inParameter=e,r}parseParams(){let e=this.startNode();this.expect(TokenType$1.LPAREN);let r=[],u=null;for(;!this.match(TokenType$1.RPAREN);){if(this.eat(TokenType$1.ELLIPSIS)){if(u=this.parseBindingTarget(),this.lookahead.type===TokenType$1.ASSIGN)throw this.createError(ErrorMessages$1.UNEXPECTED_REST_PARAMETERS_INITIALIZATION);if(this.match(TokenType$1.COMMA))throw this.createError(ErrorMessages$1.UNEXPECTED_COMMA_AFTER_REST);break}if(r.push(this.parseParam()),this.match(TokenType$1.RPAREN))break;this.expect(TokenType$1.COMMA)}return this.expect(TokenType$1.RPAREN),this.finishNode(new AST.FormalParameters({items:r,rest:u}),e)}}var parser={GenericParser:GenericParser$1};const director$1={ArrayAssignmentTarget(s,e){return s.reduceArrayAssignmentTarget(e,{elements:e.elements.map(r=>r&&this[r.type](s,r)),rest:e.rest&&this[e.rest.type](s,e.rest)})},ArrayBinding(s,e){return s.reduceArrayBinding(e,{elements:e.elements.map(r=>r&&this[r.type](s,r)),rest:e.rest&&this[e.rest.type](s,e.rest)})},ArrayExpression(s,e){return s.reduceArrayExpression(e,{elements:e.elements.map(r=>r&&this[r.type](s,r))})},ArrowExpression(s,e){return s.reduceArrowExpression(e,{params:this.FormalParameters(s,e.params),body:this[e.body.type](s,e.body)})},AssignmentExpression(s,e){return s.reduceAssignmentExpression(e,{binding:this[e.binding.type](s,e.binding),expression:this[e.expression.type](s,e.expression)})},AssignmentTargetIdentifier(s,e){return s.reduceAssignmentTargetIdentifier(e)},AssignmentTargetPropertyIdentifier(s,e){return s.reduceAssignmentTargetPropertyIdentifier(e,{binding:this.AssignmentTargetIdentifier(s,e.binding),init:e.init&&this[e.init.type](s,e.init)})},AssignmentTargetPropertyProperty(s,e){return s.reduceAssignmentTargetPropertyProperty(e,{name:this[e.name.type](s,e.name),binding:this[e.binding.type](s,e.binding)})},AssignmentTargetWithDefault(s,e){return s.reduceAssignmentTargetWithDefault(e,{binding:this[e.binding.type](s,e.binding),init:this[e.init.type](s,e.init)})},AwaitExpression(s,e){return s.reduceAwaitExpression(e,{expression:this[e.expression.type](s,e.expression)})},BinaryExpression(s,e){return s.reduceBinaryExpression(e,{left:this[e.left.type](s,e.left),right:this[e.right.type](s,e.right)})},BindingIdentifier(s,e){return s.reduceBindingIdentifier(e)},BindingPropertyIdentifier(s,e){return s.reduceBindingPropertyIdentifier(e,{binding:this.BindingIdentifier(s,e.binding),init:e.init&&this[e.init.type](s,e.init)})},BindingPropertyProperty(s,e){return s.reduceBindingPropertyProperty(e,{name:this[e.name.type](s,e.name),binding:this[e.binding.type](s,e.binding)})},BindingWithDefault(s,e){return s.reduceBindingWithDefault(e,{binding:this[e.binding.type](s,e.binding),init:this[e.init.type](s,e.init)})},Block(s,e){return s.reduceBlock(e,{statements:e.statements.map(r=>this[r.type](s,r))})},BlockStatement(s,e){return s.reduceBlockStatement(e,{block:this.Block(s,e.block)})},BreakStatement(s,e){return s.reduceBreakStatement(e)},CallExpression(s,e){return s.reduceCallExpression(e,{callee:this[e.callee.type](s,e.callee),arguments:e.arguments.map(r=>this[r.type](s,r))})},CatchClause(s,e){return s.reduceCatchClause(e,{binding:e.binding&&this[e.binding.type](s,e.binding),body:this.Block(s,e.body)})},ClassDeclaration(s,e){return s.reduceClassDeclaration(e,{name:this.BindingIdentifier(s,e.name),super:e.super&&this[e.super.type](s,e.super),elements:e.elements.map(r=>this.ClassElement(s,r))})},ClassElement(s,e){return s.reduceClassElement(e,{method:this[e.method.type](s,e.method)})},ClassExpression(s,e){return s.reduceClassExpression(e,{name:e.name&&this.BindingIdentifier(s,e.name),super:e.super&&this[e.super.type](s,e.super),elements:e.elements.map(r=>this.ClassElement(s,r))})},CompoundAssignmentExpression(s,e){return s.reduceCompoundAssignmentExpression(e,{binding:this[e.binding.type](s,e.binding),expression:this[e.expression.type](s,e.expression)})},ComputedMemberAssignmentTarget(s,e){return s.reduceComputedMemberAssignmentTarget(e,{object:this[e.object.type](s,e.object),expression:this[e.expression.type](s,e.expression)})},ComputedMemberExpression(s,e){return s.reduceComputedMemberExpression(e,{object:this[e.object.type](s,e.object),expression:this[e.expression.type](s,e.expression)})},ComputedPropertyName(s,e){return s.reduceComputedPropertyName(e,{expression:this[e.expression.type](s,e.expression)})},ConditionalExpression(s,e){return s.reduceConditionalExpression(e,{test:this[e.test.type](s,e.test),consequent:this[e.consequent.type](s,e.consequent),alternate:this[e.alternate.type](s,e.alternate)})},ContinueStatement(s,e){return s.reduceContinueStatement(e)},DataProperty(s,e){return s.reduceDataProperty(e,{name:this[e.name.type](s,e.name),expression:this[e.expression.type](s,e.expression)})},DebuggerStatement(s,e){return s.reduceDebuggerStatement(e)},Directive(s,e){return s.reduceDirective(e)},DoWhileStatement(s,e){return s.reduceDoWhileStatement(e,{body:this[e.body.type](s,e.body),test:this[e.test.type](s,e.test)})},EmptyStatement(s,e){return s.reduceEmptyStatement(e)},Export(s,e){return s.reduceExport(e,{declaration:this[e.declaration.type](s,e.declaration)})},ExportAllFrom(s,e){return s.reduceExportAllFrom(e)},ExportDefault(s,e){return s.reduceExportDefault(e,{body:this[e.body.type](s,e.body)})},ExportFrom(s,e){return s.reduceExportFrom(e,{namedExports:e.namedExports.map(r=>this.ExportFromSpecifier(s,r))})},ExportFromSpecifier(s,e){return s.reduceExportFromSpecifier(e)},ExportLocalSpecifier(s,e){return s.reduceExportLocalSpecifier(e,{name:this.IdentifierExpression(s,e.name)})},ExportLocals(s,e){return s.reduceExportLocals(e,{namedExports:e.namedExports.map(r=>this.ExportLocalSpecifier(s,r))})},ExpressionStatement(s,e){return s.reduceExpressionStatement(e,{expression:this[e.expression.type](s,e.expression)})},ForAwaitStatement(s,e){return s.reduceForAwaitStatement(e,{left:this[e.left.type](s,e.left),right:this[e.right.type](s,e.right),body:this[e.body.type](s,e.body)})},ForInStatement(s,e){return s.reduceForInStatement(e,{left:this[e.left.type](s,e.left),right:this[e.right.type](s,e.right),body:this[e.body.type](s,e.body)})},ForOfStatement(s,e){return s.reduceForOfStatement(e,{left:this[e.left.type](s,e.left),right:this[e.right.type](s,e.right),body:this[e.body.type](s,e.body)})},ForStatement(s,e){return s.reduceForStatement(e,{init:e.init&&this[e.init.type](s,e.init),test:e.test&&this[e.test.type](s,e.test),update:e.update&&this[e.update.type](s,e.update),body:this[e.body.type](s,e.body)})},FormalParameters(s,e){return s.reduceFormalParameters(e,{items:e.items.map(r=>this[r.type](s,r)),rest:e.rest&&this[e.rest.type](s,e.rest)})},FunctionBody(s,e){return s.reduceFunctionBody(e,{directives:e.directives.map(r=>this.Directive(s,r)),statements:e.statements.map(r=>this[r.type](s,r))})},FunctionDeclaration(s,e){return s.reduceFunctionDeclaration(e,{name:this.BindingIdentifier(s,e.name),params:this.FormalParameters(s,e.params),body:this.FunctionBody(s,e.body)})},FunctionExpression(s,e){return s.reduceFunctionExpression(e,{name:e.name&&this.BindingIdentifier(s,e.name),params:this.FormalParameters(s,e.params),body:this.FunctionBody(s,e.body)})},Getter(s,e){return s.reduceGetter(e,{name:this[e.name.type](s,e.name),body:this.FunctionBody(s,e.body)})},IdentifierExpression(s,e){return s.reduceIdentifierExpression(e)},IfStatement(s,e){return s.reduceIfStatement(e,{test:this[e.test.type](s,e.test),consequent:this[e.consequent.type](s,e.consequent),alternate:e.alternate&&this[e.alternate.type](s,e.alternate)})},Import(s,e){return s.reduceImport(e,{defaultBinding:e.defaultBinding&&this.BindingIdentifier(s,e.defaultBinding),namedImports:e.namedImports.map(r=>this.ImportSpecifier(s,r))})},ImportNamespace(s,e){return s.reduceImportNamespace(e,{defaultBinding:e.defaultBinding&&this.BindingIdentifier(s,e.defaultBinding),namespaceBinding:this.BindingIdentifier(s,e.namespaceBinding)})},ImportSpecifier(s,e){return s.reduceImportSpecifier(e,{binding:this.BindingIdentifier(s,e.binding)})},LabeledStatement(s,e){return s.reduceLabeledStatement(e,{body:this[e.body.type](s,e.body)})},LiteralBooleanExpression(s,e){return s.reduceLiteralBooleanExpression(e)},LiteralInfinityExpression(s,e){return s.reduceLiteralInfinityExpression(e)},LiteralNullExpression(s,e){return s.reduceLiteralNullExpression(e)},LiteralNumericExpression(s,e){return s.reduceLiteralNumericExpression(e)},LiteralRegExpExpression(s,e){return s.reduceLiteralRegExpExpression(e)},LiteralStringExpression(s,e){return s.reduceLiteralStringExpression(e)},Method(s,e){return s.reduceMethod(e,{name:this[e.name.type](s,e.name),params:this.FormalParameters(s,e.params),body:this.FunctionBody(s,e.body)})},Module(s,e){return s.reduceModule(e,{directives:e.directives.map(r=>this.Directive(s,r)),items:e.items.map(r=>this[r.type](s,r))})},NewExpression(s,e){return s.reduceNewExpression(e,{callee:this[e.callee.type](s,e.callee),arguments:e.arguments.map(r=>this[r.type](s,r))})},NewTargetExpression(s,e){return s.reduceNewTargetExpression(e)},ObjectAssignmentTarget(s,e){return s.reduceObjectAssignmentTarget(e,{properties:e.properties.map(r=>this[r.type](s,r)),rest:e.rest&&this[e.rest.type](s,e.rest)})},ObjectBinding(s,e){return s.reduceObjectBinding(e,{properties:e.properties.map(r=>this[r.type](s,r)),rest:e.rest&&this.BindingIdentifier(s,e.rest)})},ObjectExpression(s,e){return s.reduceObjectExpression(e,{properties:e.properties.map(r=>this[r.type](s,r))})},ReturnStatement(s,e){return s.reduceReturnStatement(e,{expression:e.expression&&this[e.expression.type](s,e.expression)})},Script(s,e){return s.reduceScript(e,{directives:e.directives.map(r=>this.Directive(s,r)),statements:e.statements.map(r=>this[r.type](s,r))})},Setter(s,e){return s.reduceSetter(e,{name:this[e.name.type](s,e.name),param:this[e.param.type](s,e.param),body:this.FunctionBody(s,e.body)})},ShorthandProperty(s,e){return s.reduceShorthandProperty(e,{name:this.IdentifierExpression(s,e.name)})},SpreadElement(s,e){return s.reduceSpreadElement(e,{expression:this[e.expression.type](s,e.expression)})},SpreadProperty(s,e){return s.reduceSpreadProperty(e,{expression:this[e.expression.type](s,e.expression)})},StaticMemberAssignmentTarget(s,e){return s.reduceStaticMemberAssignmentTarget(e,{object:this[e.object.type](s,e.object)})},StaticMemberExpression(s,e){return s.reduceStaticMemberExpression(e,{object:this[e.object.type](s,e.object)})},StaticPropertyName(s,e){return s.reduceStaticPropertyName(e)},Super(s,e){return s.reduceSuper(e)},SwitchCase(s,e){return s.reduceSwitchCase(e,{test:this[e.test.type](s,e.test),consequent:e.consequent.map(r=>this[r.type](s,r))})},SwitchDefault(s,e){return s.reduceSwitchDefault(e,{consequent:e.consequent.map(r=>this[r.type](s,r))})},SwitchStatement(s,e){return s.reduceSwitchStatement(e,{discriminant:this[e.discriminant.type](s,e.discriminant),cases:e.cases.map(r=>this.SwitchCase(s,r))})},SwitchStatementWithDefault(s,e){return s.reduceSwitchStatementWithDefault(e,{discriminant:this[e.discriminant.type](s,e.discriminant),preDefaultCases:e.preDefaultCases.map(r=>this.SwitchCase(s,r)),defaultCase:this.SwitchDefault(s,e.defaultCase),postDefaultCases:e.postDefaultCases.map(r=>this.SwitchCase(s,r))})},TemplateElement(s,e){return s.reduceTemplateElement(e)},TemplateExpression(s,e){return s.reduceTemplateExpression(e,{tag:e.tag&&this[e.tag.type](s,e.tag),elements:e.elements.map(r=>this[r.type](s,r))})},ThisExpression(s,e){return s.reduceThisExpression(e)},ThrowStatement(s,e){return s.reduceThrowStatement(e,{expression:this[e.expression.type](s,e.expression)})},TryCatchStatement(s,e){return s.reduceTryCatchStatement(e,{body:this.Block(s,e.body),catchClause:this.CatchClause(s,e.catchClause)})},TryFinallyStatement(s,e){return s.reduceTryFinallyStatement(e,{body:this.Block(s,e.body),catchClause:e.catchClause&&this.CatchClause(s,e.catchClause),finalizer:this.Block(s,e.finalizer)})},UnaryExpression(s,e){return s.reduceUnaryExpression(e,{operand:this[e.operand.type](s,e.operand)})},UpdateExpression(s,e){return s.reduceUpdateExpression(e,{operand:this[e.operand.type](s,e.operand)})},VariableDeclaration(s,e){return s.reduceVariableDeclaration(e,{declarators:e.declarators.map(r=>this.VariableDeclarator(s,r))})},VariableDeclarationStatement(s,e){return s.reduceVariableDeclarationStatement(e,{declaration:this.VariableDeclaration(s,e.declaration)})},VariableDeclarator(s,e){return s.reduceVariableDeclarator(e,{binding:this[e.binding.type](s,e.binding),init:e.init&&this[e.init.type](s,e.init)})},WhileStatement(s,e){return s.reduceWhileStatement(e,{test:this[e.test.type](s,e.test),body:this[e.body.type](s,e.body)})},WithStatement(s,e){return s.reduceWithStatement(e,{object:this[e.object.type](s,e.object),body:this[e.body.type](s,e.body)})},YieldExpression(s,e){return s.reduceYieldExpression(e,{expression:e.expression&&this[e.expression.type](s,e.expression)})},YieldGeneratorExpression(s,e){return s.reduceYieldGeneratorExpression(e,{expression:this[e.expression.type](s,e.expression)})}};var director_1=function s(e,r){return director$1[r.type](e,r)};const director={ArrayAssignmentTarget(s,e){return s.reduceArrayAssignmentTarget(e,{elements:e.elements.map(r=>r&&(()=>this[r.type](s,r))),rest:e.rest&&(()=>this[e.rest.type](s,e.rest))})},ArrayBinding(s,e){return s.reduceArrayBinding(e,{elements:e.elements.map(r=>r&&(()=>this[r.type](s,r))),rest:e.rest&&(()=>this[e.rest.type](s,e.rest))})},ArrayExpression(s,e){return s.reduceArrayExpression(e,{elements:e.elements.map(r=>r&&(()=>this[r.type](s,r)))})},ArrowExpression(s,e){return s.reduceArrowExpression(e,{params:()=>this.FormalParameters(s,e.params),body:()=>this[e.body.type](s,e.body)})},AssignmentExpression(s,e){return s.reduceAssignmentExpression(e,{binding:()=>this[e.binding.type](s,e.binding),expression:()=>this[e.expression.type](s,e.expression)})},AssignmentTargetIdentifier(s,e){return s.reduceAssignmentTargetIdentifier(e)},AssignmentTargetPropertyIdentifier(s,e){return s.reduceAssignmentTargetPropertyIdentifier(e,{binding:()=>this.AssignmentTargetIdentifier(s,e.binding),init:e.init&&(()=>this[e.init.type](s,e.init))})},AssignmentTargetPropertyProperty(s,e){return s.reduceAssignmentTargetPropertyProperty(e,{name:()=>this[e.name.type](s,e.name),binding:()=>this[e.binding.type](s,e.binding)})},AssignmentTargetWithDefault(s,e){return s.reduceAssignmentTargetWithDefault(e,{binding:()=>this[e.binding.type](s,e.binding),init:()=>this[e.init.type](s,e.init)})},AwaitExpression(s,e){return s.reduceAwaitExpression(e,{expression:()=>this[e.expression.type](s,e.expression)})},BinaryExpression(s,e){return s.reduceBinaryExpression(e,{left:()=>this[e.left.type](s,e.left),right:()=>this[e.right.type](s,e.right)})},BindingIdentifier(s,e){return s.reduceBindingIdentifier(e)},BindingPropertyIdentifier(s,e){return s.reduceBindingPropertyIdentifier(e,{binding:()=>this.BindingIdentifier(s,e.binding),init:e.init&&(()=>this[e.init.type](s,e.init))})},BindingPropertyProperty(s,e){return s.reduceBindingPropertyProperty(e,{name:()=>this[e.name.type](s,e.name),binding:()=>this[e.binding.type](s,e.binding)})},BindingWithDefault(s,e){return s.reduceBindingWithDefault(e,{binding:()=>this[e.binding.type](s,e.binding),init:()=>this[e.init.type](s,e.init)})},Block(s,e){return s.reduceBlock(e,{statements:e.statements.map(r=>()=>this[r.type](s,r))})},BlockStatement(s,e){return s.reduceBlockStatement(e,{block:()=>this.Block(s,e.block)})},BreakStatement(s,e){return s.reduceBreakStatement(e)},CallExpression(s,e){return s.reduceCallExpression(e,{callee:()=>this[e.callee.type](s,e.callee),arguments:e.arguments.map(r=>()=>this[r.type](s,r))})},CatchClause(s,e){return s.reduceCatchClause(e,{binding:e.binding&&(()=>this[e.binding.type](s,e.binding)),body:()=>this.Block(s,e.body)})},ClassDeclaration(s,e){return s.reduceClassDeclaration(e,{name:()=>this.BindingIdentifier(s,e.name),super:e.super&&(()=>this[e.super.type](s,e.super)),elements:e.elements.map(r=>()=>this.ClassElement(s,r))})},ClassElement(s,e){return s.reduceClassElement(e,{method:()=>this[e.method.type](s,e.method)})},ClassExpression(s,e){return s.reduceClassExpression(e,{name:e.name&&(()=>this.BindingIdentifier(s,e.name)),super:e.super&&(()=>this[e.super.type](s,e.super)),elements:e.elements.map(r=>()=>this.ClassElement(s,r))})},CompoundAssignmentExpression(s,e){return s.reduceCompoundAssignmentExpression(e,{binding:()=>this[e.binding.type](s,e.binding),expression:()=>this[e.expression.type](s,e.expression)})},ComputedMemberAssignmentTarget(s,e){return s.reduceComputedMemberAssignmentTarget(e,{object:()=>this[e.object.type](s,e.object),expression:()=>this[e.expression.type](s,e.expression)})},ComputedMemberExpression(s,e){return s.reduceComputedMemberExpression(e,{object:()=>this[e.object.type](s,e.object),expression:()=>this[e.expression.type](s,e.expression)})},ComputedPropertyName(s,e){return s.reduceComputedPropertyName(e,{expression:()=>this[e.expression.type](s,e.expression)})},ConditionalExpression(s,e){return s.reduceConditionalExpression(e,{test:()=>this[e.test.type](s,e.test),consequent:()=>this[e.consequent.type](s,e.consequent),alternate:()=>this[e.alternate.type](s,e.alternate)})},ContinueStatement(s,e){return s.reduceContinueStatement(e)},DataProperty(s,e){return s.reduceDataProperty(e,{name:()=>this[e.name.type](s,e.name),expression:()=>this[e.expression.type](s,e.expression)})},DebuggerStatement(s,e){return s.reduceDebuggerStatement(e)},Directive(s,e){return s.reduceDirective(e)},DoWhileStatement(s,e){return s.reduceDoWhileStatement(e,{body:()=>this[e.body.type](s,e.body),test:()=>this[e.test.type](s,e.test)})},EmptyStatement(s,e){return s.reduceEmptyStatement(e)},Export(s,e){return s.reduceExport(e,{declaration:()=>this[e.declaration.type](s,e.declaration)})},ExportAllFrom(s,e){return s.reduceExportAllFrom(e)},ExportDefault(s,e){return s.reduceExportDefault(e,{body:()=>this[e.body.type](s,e.body)})},ExportFrom(s,e){return s.reduceExportFrom(e,{namedExports:e.namedExports.map(r=>()=>this.ExportFromSpecifier(s,r))})},ExportFromSpecifier(s,e){return s.reduceExportFromSpecifier(e)},ExportLocalSpecifier(s,e){return s.reduceExportLocalSpecifier(e,{name:()=>this.IdentifierExpression(s,e.name)})},ExportLocals(s,e){return s.reduceExportLocals(e,{namedExports:e.namedExports.map(r=>()=>this.ExportLocalSpecifier(s,r))})},ExpressionStatement(s,e){return s.reduceExpressionStatement(e,{expression:()=>this[e.expression.type](s,e.expression)})},ForAwaitStatement(s,e){return s.reduceForAwaitStatement(e,{left:()=>this[e.left.type](s,e.left),right:()=>this[e.right.type](s,e.right),body:()=>this[e.body.type](s,e.body)})},ForInStatement(s,e){return s.reduceForInStatement(e,{left:()=>this[e.left.type](s,e.left),right:()=>this[e.right.type](s,e.right),body:()=>this[e.body.type](s,e.body)})},ForOfStatement(s,e){return s.reduceForOfStatement(e,{left:()=>this[e.left.type](s,e.left),right:()=>this[e.right.type](s,e.right),body:()=>this[e.body.type](s,e.body)})},ForStatement(s,e){return s.reduceForStatement(e,{init:e.init&&(()=>this[e.init.type](s,e.init)),test:e.test&&(()=>this[e.test.type](s,e.test)),update:e.update&&(()=>this[e.update.type](s,e.update)),body:()=>this[e.body.type](s,e.body)})},FormalParameters(s,e){return s.reduceFormalParameters(e,{items:e.items.map(r=>()=>this[r.type](s,r)),rest:e.rest&&(()=>this[e.rest.type](s,e.rest))})},FunctionBody(s,e){return s.reduceFunctionBody(e,{directives:e.directives.map(r=>()=>this.Directive(s,r)),statements:e.statements.map(r=>()=>this[r.type](s,r))})},FunctionDeclaration(s,e){return s.reduceFunctionDeclaration(e,{name:()=>this.BindingIdentifier(s,e.name),params:()=>this.FormalParameters(s,e.params),body:()=>this.FunctionBody(s,e.body)})},FunctionExpression(s,e){return s.reduceFunctionExpression(e,{name:e.name&&(()=>this.BindingIdentifier(s,e.name)),params:()=>this.FormalParameters(s,e.params),body:()=>this.FunctionBody(s,e.body)})},Getter(s,e){return s.reduceGetter(e,{name:()=>this[e.name.type](s,e.name),body:()=>this.FunctionBody(s,e.body)})},IdentifierExpression(s,e){return s.reduceIdentifierExpression(e)},IfStatement(s,e){return s.reduceIfStatement(e,{test:()=>this[e.test.type](s,e.test),consequent:()=>this[e.consequent.type](s,e.consequent),alternate:e.alternate&&(()=>this[e.alternate.type](s,e.alternate))})},Import(s,e){return s.reduceImport(e,{defaultBinding:e.defaultBinding&&(()=>this.BindingIdentifier(s,e.defaultBinding)),namedImports:e.namedImports.map(r=>()=>this.ImportSpecifier(s,r))})},ImportNamespace(s,e){return s.reduceImportNamespace(e,{defaultBinding:e.defaultBinding&&(()=>this.BindingIdentifier(s,e.defaultBinding)),namespaceBinding:()=>this.BindingIdentifier(s,e.namespaceBinding)})},ImportSpecifier(s,e){return s.reduceImportSpecifier(e,{binding:()=>this.BindingIdentifier(s,e.binding)})},LabeledStatement(s,e){return s.reduceLabeledStatement(e,{body:()=>this[e.body.type](s,e.body)})},LiteralBooleanExpression(s,e){return s.reduceLiteralBooleanExpression(e)},LiteralInfinityExpression(s,e){return s.reduceLiteralInfinityExpression(e)},LiteralNullExpression(s,e){return s.reduceLiteralNullExpression(e)},LiteralNumericExpression(s,e){return s.reduceLiteralNumericExpression(e)},LiteralRegExpExpression(s,e){return s.reduceLiteralRegExpExpression(e)},LiteralStringExpression(s,e){return s.reduceLiteralStringExpression(e)},Method(s,e){return s.reduceMethod(e,{name:()=>this[e.name.type](s,e.name),params:()=>this.FormalParameters(s,e.params),body:()=>this.FunctionBody(s,e.body)})},Module(s,e){return s.reduceModule(e,{directives:e.directives.map(r=>()=>this.Directive(s,r)),items:e.items.map(r=>()=>this[r.type](s,r))})},NewExpression(s,e){return s.reduceNewExpression(e,{callee:()=>this[e.callee.type](s,e.callee),arguments:e.arguments.map(r=>()=>this[r.type](s,r))})},NewTargetExpression(s,e){return s.reduceNewTargetExpression(e)},ObjectAssignmentTarget(s,e){return s.reduceObjectAssignmentTarget(e,{properties:e.properties.map(r=>()=>this[r.type](s,r)),rest:e.rest&&(()=>this[e.rest.type](s,e.rest))})},ObjectBinding(s,e){return s.reduceObjectBinding(e,{properties:e.properties.map(r=>()=>this[r.type](s,r)),rest:e.rest&&(()=>this.BindingIdentifier(s,e.rest))})},ObjectExpression(s,e){return s.reduceObjectExpression(e,{properties:e.properties.map(r=>()=>this[r.type](s,r))})},ReturnStatement(s,e){return s.reduceReturnStatement(e,{expression:e.expression&&(()=>this[e.expression.type](s,e.expression))})},Script(s,e){return s.reduceScript(e,{directives:e.directives.map(r=>()=>this.Directive(s,r)),statements:e.statements.map(r=>()=>this[r.type](s,r))})},Setter(s,e){return s.reduceSetter(e,{name:()=>this[e.name.type](s,e.name),param:()=>this[e.param.type](s,e.param),body:()=>this.FunctionBody(s,e.body)})},ShorthandProperty(s,e){return s.reduceShorthandProperty(e,{name:()=>this.IdentifierExpression(s,e.name)})},SpreadElement(s,e){return s.reduceSpreadElement(e,{expression:()=>this[e.expression.type](s,e.expression)})},SpreadProperty(s,e){return s.reduceSpreadProperty(e,{expression:()=>this[e.expression.type](s,e.expression)})},StaticMemberAssignmentTarget(s,e){return s.reduceStaticMemberAssignmentTarget(e,{object:()=>this[e.object.type](s,e.object)})},StaticMemberExpression(s,e){return s.reduceStaticMemberExpression(e,{object:()=>this[e.object.type](s,e.object)})},StaticPropertyName(s,e){return s.reduceStaticPropertyName(e)},Super(s,e){return s.reduceSuper(e)},SwitchCase(s,e){return s.reduceSwitchCase(e,{test:()=>this[e.test.type](s,e.test),consequent:e.consequent.map(r=>()=>this[r.type](s,r))})},SwitchDefault(s,e){return s.reduceSwitchDefault(e,{consequent:e.consequent.map(r=>()=>this[r.type](s,r))})},SwitchStatement(s,e){return s.reduceSwitchStatement(e,{discriminant:()=>this[e.discriminant.type](s,e.discriminant),cases:e.cases.map(r=>()=>this.SwitchCase(s,r))})},SwitchStatementWithDefault(s,e){return s.reduceSwitchStatementWithDefault(e,{discriminant:()=>this[e.discriminant.type](s,e.discriminant),preDefaultCases:e.preDefaultCases.map(r=>()=>this.SwitchCase(s,r)),defaultCase:()=>this.SwitchDefault(s,e.defaultCase),postDefaultCases:e.postDefaultCases.map(r=>()=>this.SwitchCase(s,r))})},TemplateElement(s,e){return s.reduceTemplateElement(e)},TemplateExpression(s,e){return s.reduceTemplateExpression(e,{tag:e.tag&&(()=>this[e.tag.type](s,e.tag)),elements:e.elements.map(r=>()=>this[r.type](s,r))})},ThisExpression(s,e){return s.reduceThisExpression(e)},ThrowStatement(s,e){return s.reduceThrowStatement(e,{expression:()=>this[e.expression.type](s,e.expression)})},TryCatchStatement(s,e){return s.reduceTryCatchStatement(e,{body:()=>this.Block(s,e.body),catchClause:()=>this.CatchClause(s,e.catchClause)})},TryFinallyStatement(s,e){return s.reduceTryFinallyStatement(e,{body:()=>this.Block(s,e.body),catchClause:e.catchClause&&(()=>this.CatchClause(s,e.catchClause)),finalizer:()=>this.Block(s,e.finalizer)})},UnaryExpression(s,e){return s.reduceUnaryExpression(e,{operand:()=>this[e.operand.type](s,e.operand)})},UpdateExpression(s,e){return s.reduceUpdateExpression(e,{operand:()=>this[e.operand.type](s,e.operand)})},VariableDeclaration(s,e){return s.reduceVariableDeclaration(e,{declarators:e.declarators.map(r=>()=>this.VariableDeclarator(s,r))})},VariableDeclarationStatement(s,e){return s.reduceVariableDeclarationStatement(e,{declaration:()=>this.VariableDeclaration(s,e.declaration)})},VariableDeclarator(s,e){return s.reduceVariableDeclarator(e,{binding:()=>this[e.binding.type](s,e.binding),init:e.init&&(()=>this[e.init.type](s,e.init))})},WhileStatement(s,e){return s.reduceWhileStatement(e,{test:()=>this[e.test.type](s,e.test),body:()=>this[e.body.type](s,e.body)})},WithStatement(s,e){return s.reduceWithStatement(e,{object:()=>this[e.object.type](s,e.object),body:()=>this[e.body.type](s,e.body)})},YieldExpression(s,e){return s.reduceYieldExpression(e,{expression:e.expression&&(()=>this[e.expression.type](s,e.expression))})},YieldGeneratorExpression(s,e){return s.reduceYieldGeneratorExpression(e,{expression:()=>this[e.expression.type](s,e.expression)})}};var thunkedDirector=function s(e,r){return director[r.type](e,r)},thunkify$1=function s(e){return{reduceArrayAssignmentTarget(r,{elements:u,rest:i}){return e.reduceArrayAssignmentTarget(r,{elements:u.map(n=>n==null?null:n()),rest:i==null?null:i()})},reduceArrayBinding(r,{elements:u,rest:i}){return e.reduceArrayBinding(r,{elements:u.map(n=>n==null?null:n()),rest:i==null?null:i()})},reduceArrayExpression(r,{elements:u}){return e.reduceArrayExpression(r,{elements:u.map(i=>i==null?null:i())})},reduceArrowExpression(r,{params:u,body:i}){return e.reduceArrowExpression(r,{params:u(),body:i()})},reduceAssignmentExpression(r,{binding:u,expression:i}){return e.reduceAssignmentExpression(r,{binding:u(),expression:i()})},reduceAssignmentTargetIdentifier(r){return e.reduceAssignmentTargetIdentifier(r)},reduceAssignmentTargetPropertyIdentifier(r,{binding:u,init:i}){return e.reduceAssignmentTargetPropertyIdentifier(r,{binding:u(),init:i==null?null:i()})},reduceAssignmentTargetPropertyProperty(r,{name:u,binding:i}){return e.reduceAssignmentTargetPropertyProperty(r,{name:u(),binding:i()})},reduceAssignmentTargetWithDefault(r,{binding:u,init:i}){return e.reduceAssignmentTargetWithDefault(r,{binding:u(),init:i()})},reduceAwaitExpression(r,{expression:u}){return e.reduceAwaitExpression(r,{expression:u()})},reduceBinaryExpression(r,{left:u,right:i}){return e.reduceBinaryExpression(r,{left:u(),right:i()})},reduceBindingIdentifier(r){return e.reduceBindingIdentifier(r)},reduceBindingPropertyIdentifier(r,{binding:u,init:i}){return e.reduceBindingPropertyIdentifier(r,{binding:u(),init:i==null?null:i()})},reduceBindingPropertyProperty(r,{name:u,binding:i}){return e.reduceBindingPropertyProperty(r,{name:u(),binding:i()})},reduceBindingWithDefault(r,{binding:u,init:i}){return e.reduceBindingWithDefault(r,{binding:u(),init:i()})},reduceBlock(r,{statements:u}){return e.reduceBlock(r,{statements:u.map(i=>i())})},reduceBlockStatement(r,{block:u}){return e.reduceBlockStatement(r,{block:u()})},reduceBreakStatement(r){return e.reduceBreakStatement(r)},reduceCallExpression(r,{callee:u,arguments:i}){return e.reduceCallExpression(r,{callee:u(),arguments:i.map(n=>n())})},reduceCatchClause(r,{binding:u,body:i}){return e.reduceCatchClause(r,{binding:u==null?null:u(),body:i()})},reduceClassDeclaration(r,{name:u,super:i,elements:n}){return e.reduceClassDeclaration(r,{name:u(),super:i==null?null:i(),elements:n.map(a=>a())})},reduceClassElement(r,{method:u}){return e.reduceClassElement(r,{method:u()})},reduceClassExpression(r,{name:u,super:i,elements:n}){return e.reduceClassExpression(r,{name:u==null?null:u(),super:i==null?null:i(),elements:n.map(a=>a())})},reduceCompoundAssignmentExpression(r,{binding:u,expression:i}){return e.reduceCompoundAssignmentExpression(r,{binding:u(),expression:i()})},reduceComputedMemberAssignmentTarget(r,{object:u,expression:i}){return e.reduceComputedMemberAssignmentTarget(r,{object:u(),expression:i()})},reduceComputedMemberExpression(r,{object:u,expression:i}){return e.reduceComputedMemberExpression(r,{object:u(),expression:i()})},reduceComputedPropertyName(r,{expression:u}){return e.reduceComputedPropertyName(r,{expression:u()})},reduceConditionalExpression(r,{test:u,consequent:i,alternate:n}){return e.reduceConditionalExpression(r,{test:u(),consequent:i(),alternate:n()})},reduceContinueStatement(r){return e.reduceContinueStatement(r)},reduceDataProperty(r,{name:u,expression:i}){return e.reduceDataProperty(r,{name:u(),expression:i()})},reduceDebuggerStatement(r){return e.reduceDebuggerStatement(r)},reduceDirective(r){return e.reduceDirective(r)},reduceDoWhileStatement(r,{body:u,test:i}){return e.reduceDoWhileStatement(r,{body:u(),test:i()})},reduceEmptyStatement(r){return e.reduceEmptyStatement(r)},reduceExport(r,{declaration:u}){return e.reduceExport(r,{declaration:u()})},reduceExportAllFrom(r){return e.reduceExportAllFrom(r)},reduceExportDefault(r,{body:u}){return e.reduceExportDefault(r,{body:u()})},reduceExportFrom(r,{namedExports:u}){return e.reduceExportFrom(r,{namedExports:u.map(i=>i())})},reduceExportFromSpecifier(r){return e.reduceExportFromSpecifier(r)},reduceExportLocalSpecifier(r,{name:u}){return e.reduceExportLocalSpecifier(r,{name:u()})},reduceExportLocals(r,{namedExports:u}){return e.reduceExportLocals(r,{namedExports:u.map(i=>i())})},reduceExpressionStatement(r,{expression:u}){return e.reduceExpressionStatement(r,{expression:u()})},reduceForAwaitStatement(r,{left:u,right:i,body:n}){return e.reduceForAwaitStatement(r,{left:u(),right:i(),body:n()})},reduceForInStatement(r,{left:u,right:i,body:n}){return e.reduceForInStatement(r,{left:u(),right:i(),body:n()})},reduceForOfStatement(r,{left:u,right:i,body:n}){return e.reduceForOfStatement(r,{left:u(),right:i(),body:n()})},reduceForStatement(r,{init:u,test:i,update:n,body:a}){return e.reduceForStatement(r,{init:u==null?null:u(),test:i==null?null:i(),update:n==null?null:n(),body:a()})},reduceFormalParameters(r,{items:u,rest:i}){return e.reduceFormalParameters(r,{items:u.map(n=>n()),rest:i==null?null:i()})},reduceFunctionBody(r,{directives:u,statements:i}){return e.reduceFunctionBody(r,{directives:u.map(n=>n()),statements:i.map(n=>n())})},reduceFunctionDeclaration(r,{name:u,params:i,body:n}){return e.reduceFunctionDeclaration(r,{name:u(),params:i(),body:n()})},reduceFunctionExpression(r,{name:u,params:i,body:n}){return e.reduceFunctionExpression(r,{name:u==null?null:u(),params:i(),body:n()})},reduceGetter(r,{name:u,body:i}){return e.reduceGetter(r,{name:u(),body:i()})},reduceIdentifierExpression(r){return e.reduceIdentifierExpression(r)},reduceIfStatement(r,{test:u,consequent:i,alternate:n}){return e.reduceIfStatement(r,{test:u(),consequent:i(),alternate:n==null?null:n()})},reduceImport(r,{defaultBinding:u,namedImports:i}){return e.reduceImport(r,{defaultBinding:u==null?null:u(),namedImports:i.map(n=>n())})},reduceImportNamespace(r,{defaultBinding:u,namespaceBinding:i}){return e.reduceImportNamespace(r,{defaultBinding:u==null?null:u(),namespaceBinding:i()})},reduceImportSpecifier(r,{binding:u}){return e.reduceImportSpecifier(r,{binding:u()})},reduceLabeledStatement(r,{body:u}){return e.reduceLabeledStatement(r,{body:u()})},reduceLiteralBooleanExpression(r){return e.reduceLiteralBooleanExpression(r)},reduceLiteralInfinityExpression(r){return e.reduceLiteralInfinityExpression(r)},reduceLiteralNullExpression(r){return e.reduceLiteralNullExpression(r)},reduceLiteralNumericExpression(r){return e.reduceLiteralNumericExpression(r)},reduceLiteralRegExpExpression(r){return e.reduceLiteralRegExpExpression(r)},reduceLiteralStringExpression(r){return e.reduceLiteralStringExpression(r)},reduceMethod(r,{name:u,params:i,body:n}){return e.reduceMethod(r,{name:u(),params:i(),body:n()})},reduceModule(r,{directives:u,items:i}){return e.reduceModule(r,{directives:u.map(n=>n()),items:i.map(n=>n())})},reduceNewExpression(r,{callee:u,arguments:i}){return e.reduceNewExpression(r,{callee:u(),arguments:i.map(n=>n())})},reduceNewTargetExpression(r){return e.reduceNewTargetExpression(r)},reduceObjectAssignmentTarget(r,{properties:u,rest:i}){return e.reduceObjectAssignmentTarget(r,{properties:u.map(n=>n()),rest:i==null?null:i()})},reduceObjectBinding(r,{properties:u,rest:i}){return e.reduceObjectBinding(r,{properties:u.map(n=>n()),rest:i==null?null:i()})},reduceObjectExpression(r,{properties:u}){return e.reduceObjectExpression(r,{properties:u.map(i=>i())})},reduceReturnStatement(r,{expression:u}){return e.reduceReturnStatement(r,{expression:u==null?null:u()})},reduceScript(r,{directives:u,statements:i}){return e.reduceScript(r,{directives:u.map(n=>n()),statements:i.map(n=>n())})},reduceSetter(r,{name:u,param:i,body:n}){return e.reduceSetter(r,{name:u(),param:i(),body:n()})},reduceShorthandProperty(r,{name:u}){return e.reduceShorthandProperty(r,{name:u()})},reduceSpreadElement(r,{expression:u}){return e.reduceSpreadElement(r,{expression:u()})},reduceSpreadProperty(r,{expression:u}){return e.reduceSpreadProperty(r,{expression:u()})},reduceStaticMemberAssignmentTarget(r,{object:u}){return e.reduceStaticMemberAssignmentTarget(r,{object:u()})},reduceStaticMemberExpression(r,{object:u}){return e.reduceStaticMemberExpression(r,{object:u()})},reduceStaticPropertyName(r){return e.reduceStaticPropertyName(r)},reduceSuper(r){return e.reduceSuper(r)},reduceSwitchCase(r,{test:u,consequent:i}){return e.reduceSwitchCase(r,{test:u(),consequent:i.map(n=>n())})},reduceSwitchDefault(r,{consequent:u}){return e.reduceSwitchDefault(r,{consequent:u.map(i=>i())})},reduceSwitchStatement(r,{discriminant:u,cases:i}){return e.reduceSwitchStatement(r,{discriminant:u(),cases:i.map(n=>n())})},reduceSwitchStatementWithDefault(r,{discriminant:u,preDefaultCases:i,defaultCase:n,postDefaultCases:a}){return e.reduceSwitchStatementWithDefault(r,{discriminant:u(),preDefaultCases:i.map(l=>l()),defaultCase:n(),postDefaultCases:a.map(l=>l())})},reduceTemplateElement(r){return e.reduceTemplateElement(r)},reduceTemplateExpression(r,{tag:u,elements:i}){return e.reduceTemplateExpression(r,{tag:u==null?null:u(),elements:i.map(n=>n())})},reduceThisExpression(r){return e.reduceThisExpression(r)},reduceThrowStatement(r,{expression:u}){return e.reduceThrowStatement(r,{expression:u()})},reduceTryCatchStatement(r,{body:u,catchClause:i}){return e.reduceTryCatchStatement(r,{body:u(),catchClause:i()})},reduceTryFinallyStatement(r,{body:u,catchClause:i,finalizer:n}){return e.reduceTryFinallyStatement(r,{body:u(),catchClause:i==null?null:i(),finalizer:n()})},reduceUnaryExpression(r,{operand:u}){return e.reduceUnaryExpression(r,{operand:u()})},reduceUpdateExpression(r,{operand:u}){return e.reduceUpdateExpression(r,{operand:u()})},reduceVariableDeclaration(r,{declarators:u}){return e.reduceVariableDeclaration(r,{declarators:u.map(i=>i())})},reduceVariableDeclarationStatement(r,{declaration:u}){return e.reduceVariableDeclarationStatement(r,{declaration:u()})},reduceVariableDeclarator(r,{binding:u,init:i}){return e.reduceVariableDeclarator(r,{binding:u(),init:i==null?null:i()})},reduceWhileStatement(r,{test:u,body:i}){return e.reduceWhileStatement(r,{test:u(),body:i()})},reduceWithStatement(r,{object:u,body:i}){return e.reduceWithStatement(r,{object:u(),body:i()})},reduceYieldExpression(r,{expression:u}){return e.reduceYieldExpression(r,{expression:u==null?null:u()})},reduceYieldGeneratorExpression(r,{expression:u}){return e.reduceYieldGeneratorExpression(r,{expression:u()})}}},thunkifyClass$1=function s(e){return class extends e{reduceArrayAssignmentTarget(r,{elements:u,rest:i}){return super.reduceArrayAssignmentTarget(r,{elements:u.map(n=>n==null?null:n()),rest:i==null?null:i()})}reduceArrayBinding(r,{elements:u,rest:i}){return super.reduceArrayBinding(r,{elements:u.map(n=>n==null?null:n()),rest:i==null?null:i()})}reduceArrayExpression(r,{elements:u}){return super.reduceArrayExpression(r,{elements:u.map(i=>i==null?null:i())})}reduceArrowExpression(r,{params:u,body:i}){return super.reduceArrowExpression(r,{params:u(),body:i()})}reduceAssignmentExpression(r,{binding:u,expression:i}){return super.reduceAssignmentExpression(r,{binding:u(),expression:i()})}reduceAssignmentTargetIdentifier(r){return super.reduceAssignmentTargetIdentifier(r)}reduceAssignmentTargetPropertyIdentifier(r,{binding:u,init:i}){return super.reduceAssignmentTargetPropertyIdentifier(r,{binding:u(),init:i==null?null:i()})}reduceAssignmentTargetPropertyProperty(r,{name:u,binding:i}){return super.reduceAssignmentTargetPropertyProperty(r,{name:u(),binding:i()})}reduceAssignmentTargetWithDefault(r,{binding:u,init:i}){return super.reduceAssignmentTargetWithDefault(r,{binding:u(),init:i()})}reduceAwaitExpression(r,{expression:u}){return super.reduceAwaitExpression(r,{expression:u()})}reduceBinaryExpression(r,{left:u,right:i}){return super.reduceBinaryExpression(r,{left:u(),right:i()})}reduceBindingIdentifier(r){return super.reduceBindingIdentifier(r)}reduceBindingPropertyIdentifier(r,{binding:u,init:i}){return super.reduceBindingPropertyIdentifier(r,{binding:u(),init:i==null?null:i()})}reduceBindingPropertyProperty(r,{name:u,binding:i}){return super.reduceBindingPropertyProperty(r,{name:u(),binding:i()})}reduceBindingWithDefault(r,{binding:u,init:i}){return super.reduceBindingWithDefault(r,{binding:u(),init:i()})}reduceBlock(r,{statements:u}){return super.reduceBlock(r,{statements:u.map(i=>i())})}reduceBlockStatement(r,{block:u}){return super.reduceBlockStatement(r,{block:u()})}reduceBreakStatement(r){return super.reduceBreakStatement(r)}reduceCallExpression(r,{callee:u,arguments:i}){return super.reduceCallExpression(r,{callee:u(),arguments:i.map(n=>n())})}reduceCatchClause(r,{binding:u,body:i}){return super.reduceCatchClause(r,{binding:u==null?null:u(),body:i()})}reduceClassDeclaration(r,{name:u,super:i,elements:n}){return super.reduceClassDeclaration(r,{name:u(),super:i==null?null:i(),elements:n.map(a=>a())})}reduceClassElement(r,{method:u}){return super.reduceClassElement(r,{method:u()})}reduceClassExpression(r,{name:u,super:i,elements:n}){return super.reduceClassExpression(r,{name:u==null?null:u(),super:i==null?null:i(),elements:n.map(a=>a())})}reduceCompoundAssignmentExpression(r,{binding:u,expression:i}){return super.reduceCompoundAssignmentExpression(r,{binding:u(),expression:i()})}reduceComputedMemberAssignmentTarget(r,{object:u,expression:i}){return super.reduceComputedMemberAssignmentTarget(r,{object:u(),expression:i()})}reduceComputedMemberExpression(r,{object:u,expression:i}){return super.reduceComputedMemberExpression(r,{object:u(),expression:i()})}reduceComputedPropertyName(r,{expression:u}){return super.reduceComputedPropertyName(r,{expression:u()})}reduceConditionalExpression(r,{test:u,consequent:i,alternate:n}){return super.reduceConditionalExpression(r,{test:u(),consequent:i(),alternate:n()})}reduceContinueStatement(r){return super.reduceContinueStatement(r)}reduceDataProperty(r,{name:u,expression:i}){return super.reduceDataProperty(r,{name:u(),expression:i()})}reduceDebuggerStatement(r){return super.reduceDebuggerStatement(r)}reduceDirective(r){return super.reduceDirective(r)}reduceDoWhileStatement(r,{body:u,test:i}){return super.reduceDoWhileStatement(r,{body:u(),test:i()})}reduceEmptyStatement(r){return super.reduceEmptyStatement(r)}reduceExport(r,{declaration:u}){return super.reduceExport(r,{declaration:u()})}reduceExportAllFrom(r){return super.reduceExportAllFrom(r)}reduceExportDefault(r,{body:u}){return super.reduceExportDefault(r,{body:u()})}reduceExportFrom(r,{namedExports:u}){return super.reduceExportFrom(r,{namedExports:u.map(i=>i())})}reduceExportFromSpecifier(r){return super.reduceExportFromSpecifier(r)}reduceExportLocalSpecifier(r,{name:u}){return super.reduceExportLocalSpecifier(r,{name:u()})}reduceExportLocals(r,{namedExports:u}){return super.reduceExportLocals(r,{namedExports:u.map(i=>i())})}reduceExpressionStatement(r,{expression:u}){return super.reduceExpressionStatement(r,{expression:u()})}reduceForAwaitStatement(r,{left:u,right:i,body:n}){return super.reduceForAwaitStatement(r,{left:u(),right:i(),body:n()})}reduceForInStatement(r,{left:u,right:i,body:n}){return super.reduceForInStatement(r,{left:u(),right:i(),body:n()})}reduceForOfStatement(r,{left:u,right:i,body:n}){return super.reduceForOfStatement(r,{left:u(),right:i(),body:n()})}reduceForStatement(r,{init:u,test:i,update:n,body:a}){return super.reduceForStatement(r,{init:u==null?null:u(),test:i==null?null:i(),update:n==null?null:n(),body:a()})}reduceFormalParameters(r,{items:u,rest:i}){return super.reduceFormalParameters(r,{items:u.map(n=>n()),rest:i==null?null:i()})}reduceFunctionBody(r,{directives:u,statements:i}){return super.reduceFunctionBody(r,{directives:u.map(n=>n()),statements:i.map(n=>n())})}reduceFunctionDeclaration(r,{name:u,params:i,body:n}){return super.reduceFunctionDeclaration(r,{name:u(),params:i(),body:n()})}reduceFunctionExpression(r,{name:u,params:i,body:n}){return super.reduceFunctionExpression(r,{name:u==null?null:u(),params:i(),body:n()})}reduceGetter(r,{name:u,body:i}){return super.reduceGetter(r,{name:u(),body:i()})}reduceIdentifierExpression(r){return super.reduceIdentifierExpression(r)}reduceIfStatement(r,{test:u,consequent:i,alternate:n}){return super.reduceIfStatement(r,{test:u(),consequent:i(),alternate:n==null?null:n()})}reduceImport(r,{defaultBinding:u,namedImports:i}){return super.reduceImport(r,{defaultBinding:u==null?null:u(),namedImports:i.map(n=>n())})}reduceImportNamespace(r,{defaultBinding:u,namespaceBinding:i}){return super.reduceImportNamespace(r,{defaultBinding:u==null?null:u(),namespaceBinding:i()})}reduceImportSpecifier(r,{binding:u}){return super.reduceImportSpecifier(r,{binding:u()})}reduceLabeledStatement(r,{body:u}){return super.reduceLabeledStatement(r,{body:u()})}reduceLiteralBooleanExpression(r){return super.reduceLiteralBooleanExpression(r)}reduceLiteralInfinityExpression(r){return super.reduceLiteralInfinityExpression(r)}reduceLiteralNullExpression(r){return super.reduceLiteralNullExpression(r)}reduceLiteralNumericExpression(r){return super.reduceLiteralNumericExpression(r)}reduceLiteralRegExpExpression(r){return super.reduceLiteralRegExpExpression(r)}reduceLiteralStringExpression(r){return super.reduceLiteralStringExpression(r)}reduceMethod(r,{name:u,params:i,body:n}){return super.reduceMethod(r,{name:u(),params:i(),body:n()})}reduceModule(r,{directives:u,items:i}){return super.reduceModule(r,{directives:u.map(n=>n()),items:i.map(n=>n())})}reduceNewExpression(r,{callee:u,arguments:i}){return super.reduceNewExpression(r,{callee:u(),arguments:i.map(n=>n())})}reduceNewTargetExpression(r){return super.reduceNewTargetExpression(r)}reduceObjectAssignmentTarget(r,{properties:u,rest:i}){return super.reduceObjectAssignmentTarget(r,{properties:u.map(n=>n()),rest:i==null?null:i()})}reduceObjectBinding(r,{properties:u,rest:i}){return super.reduceObjectBinding(r,{properties:u.map(n=>n()),rest:i==null?null:i()})}reduceObjectExpression(r,{properties:u}){return super.reduceObjectExpression(r,{properties:u.map(i=>i())})}reduceReturnStatement(r,{expression:u}){return super.reduceReturnStatement(r,{expression:u==null?null:u()})}reduceScript(r,{directives:u,statements:i}){return super.reduceScript(r,{directives:u.map(n=>n()),statements:i.map(n=>n())})}reduceSetter(r,{name:u,param:i,body:n}){return super.reduceSetter(r,{name:u(),param:i(),body:n()})}reduceShorthandProperty(r,{name:u}){return super.reduceShorthandProperty(r,{name:u()})}reduceSpreadElement(r,{expression:u}){return super.reduceSpreadElement(r,{expression:u()})}reduceSpreadProperty(r,{expression:u}){return super.reduceSpreadProperty(r,{expression:u()})}reduceStaticMemberAssignmentTarget(r,{object:u}){return super.reduceStaticMemberAssignmentTarget(r,{object:u()})}reduceStaticMemberExpression(r,{object:u}){return super.reduceStaticMemberExpression(r,{object:u()})}reduceStaticPropertyName(r){return super.reduceStaticPropertyName(r)}reduceSuper(r){return super.reduceSuper(r)}reduceSwitchCase(r,{test:u,consequent:i}){return super.reduceSwitchCase(r,{test:u(),consequent:i.map(n=>n())})}reduceSwitchDefault(r,{consequent:u}){return super.reduceSwitchDefault(r,{consequent:u.map(i=>i())})}reduceSwitchStatement(r,{discriminant:u,cases:i}){return super.reduceSwitchStatement(r,{discriminant:u(),cases:i.map(n=>n())})}reduceSwitchStatementWithDefault(r,{discriminant:u,preDefaultCases:i,defaultCase:n,postDefaultCases:a}){return super.reduceSwitchStatementWithDefault(r,{discriminant:u(),preDefaultCases:i.map(l=>l()),defaultCase:n(),postDefaultCases:a.map(l=>l())})}reduceTemplateElement(r){return super.reduceTemplateElement(r)}reduceTemplateExpression(r,{tag:u,elements:i}){return super.reduceTemplateExpression(r,{tag:u==null?null:u(),elements:i.map(n=>n())})}reduceThisExpression(r){return super.reduceThisExpression(r)}reduceThrowStatement(r,{expression:u}){return super.reduceThrowStatement(r,{expression:u()})}reduceTryCatchStatement(r,{body:u,catchClause:i}){return super.reduceTryCatchStatement(r,{body:u(),catchClause:i()})}reduceTryFinallyStatement(r,{body:u,catchClause:i,finalizer:n}){return super.reduceTryFinallyStatement(r,{body:u(),catchClause:i==null?null:i(),finalizer:n()})}reduceUnaryExpression(r,{operand:u}){return super.reduceUnaryExpression(r,{operand:u()})}reduceUpdateExpression(r,{operand:u}){return super.reduceUpdateExpression(r,{operand:u()})}reduceVariableDeclaration(r,{declarators:u}){return super.reduceVariableDeclaration(r,{declarators:u.map(i=>i())})}reduceVariableDeclarationStatement(r,{declaration:u}){return super.reduceVariableDeclarationStatement(r,{declaration:u()})}reduceVariableDeclarator(r,{binding:u,init:i}){return super.reduceVariableDeclarator(r,{binding:u(),init:i==null?null:i()})}reduceWhileStatement(r,{test:u,body:i}){return super.reduceWhileStatement(r,{test:u(),body:i()})}reduceWithStatement(r,{object:u,body:i}){return super.reduceWithStatement(r,{object:u(),body:i()})}reduceYieldExpression(r,{expression:u}){return super.reduceYieldExpression(r,{expression:u==null?null:u()})}reduceYieldGeneratorExpression(r,{expression:u}){return super.reduceYieldGeneratorExpression(r,{expression:u()})}}},memoize$1=function s(e){const r=new WeakMap;return{reduceArrayAssignmentTarget(u,i){if(r.has(u))return r.get(u);const n=e.reduceArrayAssignmentTarget(u,i);return r.set(u,n),n},reduceArrayBinding(u,i){if(r.has(u))return r.get(u);const n=e.reduceArrayBinding(u,i);return r.set(u,n),n},reduceArrayExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceArrayExpression(u,i);return r.set(u,n),n},reduceArrowExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceArrowExpression(u,i);return r.set(u,n),n},reduceAssignmentExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceAssignmentExpression(u,i);return r.set(u,n),n},reduceAssignmentTargetIdentifier(u){if(r.has(u))return r.get(u);const i=e.reduceAssignmentTargetIdentifier(u);return r.set(u,i),i},reduceAssignmentTargetPropertyIdentifier(u,i){if(r.has(u))return r.get(u);const n=e.reduceAssignmentTargetPropertyIdentifier(u,i);return r.set(u,n),n},reduceAssignmentTargetPropertyProperty(u,i){if(r.has(u))return r.get(u);const n=e.reduceAssignmentTargetPropertyProperty(u,i);return r.set(u,n),n},reduceAssignmentTargetWithDefault(u,i){if(r.has(u))return r.get(u);const n=e.reduceAssignmentTargetWithDefault(u,i);return r.set(u,n),n},reduceAwaitExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceAwaitExpression(u,i);return r.set(u,n),n},reduceBinaryExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceBinaryExpression(u,i);return r.set(u,n),n},reduceBindingIdentifier(u){if(r.has(u))return r.get(u);const i=e.reduceBindingIdentifier(u);return r.set(u,i),i},reduceBindingPropertyIdentifier(u,i){if(r.has(u))return r.get(u);const n=e.reduceBindingPropertyIdentifier(u,i);return r.set(u,n),n},reduceBindingPropertyProperty(u,i){if(r.has(u))return r.get(u);const n=e.reduceBindingPropertyProperty(u,i);return r.set(u,n),n},reduceBindingWithDefault(u,i){if(r.has(u))return r.get(u);const n=e.reduceBindingWithDefault(u,i);return r.set(u,n),n},reduceBlock(u,i){if(r.has(u))return r.get(u);const n=e.reduceBlock(u,i);return r.set(u,n),n},reduceBlockStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceBlockStatement(u,i);return r.set(u,n),n},reduceBreakStatement(u){if(r.has(u))return r.get(u);const i=e.reduceBreakStatement(u);return r.set(u,i),i},reduceCallExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceCallExpression(u,i);return r.set(u,n),n},reduceCatchClause(u,i){if(r.has(u))return r.get(u);const n=e.reduceCatchClause(u,i);return r.set(u,n),n},reduceClassDeclaration(u,i){if(r.has(u))return r.get(u);const n=e.reduceClassDeclaration(u,i);return r.set(u,n),n},reduceClassElement(u,i){if(r.has(u))return r.get(u);const n=e.reduceClassElement(u,i);return r.set(u,n),n},reduceClassExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceClassExpression(u,i);return r.set(u,n),n},reduceCompoundAssignmentExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceCompoundAssignmentExpression(u,i);return r.set(u,n),n},reduceComputedMemberAssignmentTarget(u,i){if(r.has(u))return r.get(u);const n=e.reduceComputedMemberAssignmentTarget(u,i);return r.set(u,n),n},reduceComputedMemberExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceComputedMemberExpression(u,i);return r.set(u,n),n},reduceComputedPropertyName(u,i){if(r.has(u))return r.get(u);const n=e.reduceComputedPropertyName(u,i);return r.set(u,n),n},reduceConditionalExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceConditionalExpression(u,i);return r.set(u,n),n},reduceContinueStatement(u){if(r.has(u))return r.get(u);const i=e.reduceContinueStatement(u);return r.set(u,i),i},reduceDataProperty(u,i){if(r.has(u))return r.get(u);const n=e.reduceDataProperty(u,i);return r.set(u,n),n},reduceDebuggerStatement(u){if(r.has(u))return r.get(u);const i=e.reduceDebuggerStatement(u);return r.set(u,i),i},reduceDirective(u){if(r.has(u))return r.get(u);const i=e.reduceDirective(u);return r.set(u,i),i},reduceDoWhileStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceDoWhileStatement(u,i);return r.set(u,n),n},reduceEmptyStatement(u){if(r.has(u))return r.get(u);const i=e.reduceEmptyStatement(u);return r.set(u,i),i},reduceExport(u,i){if(r.has(u))return r.get(u);const n=e.reduceExport(u,i);return r.set(u,n),n},reduceExportAllFrom(u){if(r.has(u))return r.get(u);const i=e.reduceExportAllFrom(u);return r.set(u,i),i},reduceExportDefault(u,i){if(r.has(u))return r.get(u);const n=e.reduceExportDefault(u,i);return r.set(u,n),n},reduceExportFrom(u,i){if(r.has(u))return r.get(u);const n=e.reduceExportFrom(u,i);return r.set(u,n),n},reduceExportFromSpecifier(u){if(r.has(u))return r.get(u);const i=e.reduceExportFromSpecifier(u);return r.set(u,i),i},reduceExportLocalSpecifier(u,i){if(r.has(u))return r.get(u);const n=e.reduceExportLocalSpecifier(u,i);return r.set(u,n),n},reduceExportLocals(u,i){if(r.has(u))return r.get(u);const n=e.reduceExportLocals(u,i);return r.set(u,n),n},reduceExpressionStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceExpressionStatement(u,i);return r.set(u,n),n},reduceForAwaitStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceForAwaitStatement(u,i);return r.set(u,n),n},reduceForInStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceForInStatement(u,i);return r.set(u,n),n},reduceForOfStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceForOfStatement(u,i);return r.set(u,n),n},reduceForStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceForStatement(u,i);return r.set(u,n),n},reduceFormalParameters(u,i){if(r.has(u))return r.get(u);const n=e.reduceFormalParameters(u,i);return r.set(u,n),n},reduceFunctionBody(u,i){if(r.has(u))return r.get(u);const n=e.reduceFunctionBody(u,i);return r.set(u,n),n},reduceFunctionDeclaration(u,i){if(r.has(u))return r.get(u);const n=e.reduceFunctionDeclaration(u,i);return r.set(u,n),n},reduceFunctionExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceFunctionExpression(u,i);return r.set(u,n),n},reduceGetter(u,i){if(r.has(u))return r.get(u);const n=e.reduceGetter(u,i);return r.set(u,n),n},reduceIdentifierExpression(u){if(r.has(u))return r.get(u);const i=e.reduceIdentifierExpression(u);return r.set(u,i),i},reduceIfStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceIfStatement(u,i);return r.set(u,n),n},reduceImport(u,i){if(r.has(u))return r.get(u);const n=e.reduceImport(u,i);return r.set(u,n),n},reduceImportNamespace(u,i){if(r.has(u))return r.get(u);const n=e.reduceImportNamespace(u,i);return r.set(u,n),n},reduceImportSpecifier(u,i){if(r.has(u))return r.get(u);const n=e.reduceImportSpecifier(u,i);return r.set(u,n),n},reduceLabeledStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceLabeledStatement(u,i);return r.set(u,n),n},reduceLiteralBooleanExpression(u){if(r.has(u))return r.get(u);const i=e.reduceLiteralBooleanExpression(u);return r.set(u,i),i},reduceLiteralInfinityExpression(u){if(r.has(u))return r.get(u);const i=e.reduceLiteralInfinityExpression(u);return r.set(u,i),i},reduceLiteralNullExpression(u){if(r.has(u))return r.get(u);const i=e.reduceLiteralNullExpression(u);return r.set(u,i),i},reduceLiteralNumericExpression(u){if(r.has(u))return r.get(u);const i=e.reduceLiteralNumericExpression(u);return r.set(u,i),i},reduceLiteralRegExpExpression(u){if(r.has(u))return r.get(u);const i=e.reduceLiteralRegExpExpression(u);return r.set(u,i),i},reduceLiteralStringExpression(u){if(r.has(u))return r.get(u);const i=e.reduceLiteralStringExpression(u);return r.set(u,i),i},reduceMethod(u,i){if(r.has(u))return r.get(u);const n=e.reduceMethod(u,i);return r.set(u,n),n},reduceModule(u,i){if(r.has(u))return r.get(u);const n=e.reduceModule(u,i);return r.set(u,n),n},reduceNewExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceNewExpression(u,i);return r.set(u,n),n},reduceNewTargetExpression(u){if(r.has(u))return r.get(u);const i=e.reduceNewTargetExpression(u);return r.set(u,i),i},reduceObjectAssignmentTarget(u,i){if(r.has(u))return r.get(u);const n=e.reduceObjectAssignmentTarget(u,i);return r.set(u,n),n},reduceObjectBinding(u,i){if(r.has(u))return r.get(u);const n=e.reduceObjectBinding(u,i);return r.set(u,n),n},reduceObjectExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceObjectExpression(u,i);return r.set(u,n),n},reduceReturnStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceReturnStatement(u,i);return r.set(u,n),n},reduceScript(u,i){if(r.has(u))return r.get(u);const n=e.reduceScript(u,i);return r.set(u,n),n},reduceSetter(u,i){if(r.has(u))return r.get(u);const n=e.reduceSetter(u,i);return r.set(u,n),n},reduceShorthandProperty(u,i){if(r.has(u))return r.get(u);const n=e.reduceShorthandProperty(u,i);return r.set(u,n),n},reduceSpreadElement(u,i){if(r.has(u))return r.get(u);const n=e.reduceSpreadElement(u,i);return r.set(u,n),n},reduceSpreadProperty(u,i){if(r.has(u))return r.get(u);const n=e.reduceSpreadProperty(u,i);return r.set(u,n),n},reduceStaticMemberAssignmentTarget(u,i){if(r.has(u))return r.get(u);const n=e.reduceStaticMemberAssignmentTarget(u,i);return r.set(u,n),n},reduceStaticMemberExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceStaticMemberExpression(u,i);return r.set(u,n),n},reduceStaticPropertyName(u){if(r.has(u))return r.get(u);const i=e.reduceStaticPropertyName(u);return r.set(u,i),i},reduceSuper(u){if(r.has(u))return r.get(u);const i=e.reduceSuper(u);return r.set(u,i),i},reduceSwitchCase(u,i){if(r.has(u))return r.get(u);const n=e.reduceSwitchCase(u,i);return r.set(u,n),n},reduceSwitchDefault(u,i){if(r.has(u))return r.get(u);const n=e.reduceSwitchDefault(u,i);return r.set(u,n),n},reduceSwitchStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceSwitchStatement(u,i);return r.set(u,n),n},reduceSwitchStatementWithDefault(u,i){if(r.has(u))return r.get(u);const n=e.reduceSwitchStatementWithDefault(u,i);return r.set(u,n),n},reduceTemplateElement(u){if(r.has(u))return r.get(u);const i=e.reduceTemplateElement(u);return r.set(u,i),i},reduceTemplateExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceTemplateExpression(u,i);return r.set(u,n),n},reduceThisExpression(u){if(r.has(u))return r.get(u);const i=e.reduceThisExpression(u);return r.set(u,i),i},reduceThrowStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceThrowStatement(u,i);return r.set(u,n),n},reduceTryCatchStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceTryCatchStatement(u,i);return r.set(u,n),n},reduceTryFinallyStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceTryFinallyStatement(u,i);return r.set(u,n),n},reduceUnaryExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceUnaryExpression(u,i);return r.set(u,n),n},reduceUpdateExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceUpdateExpression(u,i);return r.set(u,n),n},reduceVariableDeclaration(u,i){if(r.has(u))return r.get(u);const n=e.reduceVariableDeclaration(u,i);return r.set(u,n),n},reduceVariableDeclarationStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceVariableDeclarationStatement(u,i);return r.set(u,n),n},reduceVariableDeclarator(u,i){if(r.has(u))return r.get(u);const n=e.reduceVariableDeclarator(u,i);return r.set(u,n),n},reduceWhileStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceWhileStatement(u,i);return r.set(u,n),n},reduceWithStatement(u,i){if(r.has(u))return r.get(u);const n=e.reduceWithStatement(u,i);return r.set(u,n),n},reduceYieldExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceYieldExpression(u,i);return r.set(u,n),n},reduceYieldGeneratorExpression(u,i){if(r.has(u))return r.get(u);const n=e.reduceYieldGeneratorExpression(u,i);return r.set(u,n),n}}};const Shift$1=gen;var cloneReducer=class{reduceArrayAssignmentTarget(e,{elements:r,rest:u}){return new Shift$1.ArrayAssignmentTarget({elements:r,rest:u})}reduceArrayBinding(e,{elements:r,rest:u}){return new Shift$1.ArrayBinding({elements:r,rest:u})}reduceArrayExpression(e,{elements:r}){return new Shift$1.ArrayExpression({elements:r})}reduceArrowExpression(e,{params:r,body:u}){return new Shift$1.ArrowExpression({isAsync:e.isAsync,params:r,body:u})}reduceAssignmentExpression(e,{binding:r,expression:u}){return new Shift$1.AssignmentExpression({binding:r,expression:u})}reduceAssignmentTargetIdentifier(e){return new Shift$1.AssignmentTargetIdentifier({name:e.name})}reduceAssignmentTargetPropertyIdentifier(e,{binding:r,init:u}){return new Shift$1.AssignmentTargetPropertyIdentifier({binding:r,init:u})}reduceAssignmentTargetPropertyProperty(e,{name:r,binding:u}){return new Shift$1.AssignmentTargetPropertyProperty({name:r,binding:u})}reduceAssignmentTargetWithDefault(e,{binding:r,init:u}){return new Shift$1.AssignmentTargetWithDefault({binding:r,init:u})}reduceAwaitExpression(e,{expression:r}){return new Shift$1.AwaitExpression({expression:r})}reduceBinaryExpression(e,{left:r,right:u}){return new Shift$1.BinaryExpression({left:r,operator:e.operator,right:u})}reduceBindingIdentifier(e){return new Shift$1.BindingIdentifier({name:e.name})}reduceBindingPropertyIdentifier(e,{binding:r,init:u}){return new Shift$1.BindingPropertyIdentifier({binding:r,init:u})}reduceBindingPropertyProperty(e,{name:r,binding:u}){return new Shift$1.BindingPropertyProperty({name:r,binding:u})}reduceBindingWithDefault(e,{binding:r,init:u}){return new Shift$1.BindingWithDefault({binding:r,init:u})}reduceBlock(e,{statements:r}){return new Shift$1.Block({statements:r})}reduceBlockStatement(e,{block:r}){return new Shift$1.BlockStatement({block:r})}reduceBreakStatement(e){return new Shift$1.BreakStatement({label:e.label})}reduceCallExpression(e,{callee:r,arguments:u}){return new Shift$1.CallExpression({callee:r,arguments:u})}reduceCatchClause(e,{binding:r,body:u}){return new Shift$1.CatchClause({binding:r,body:u})}reduceClassDeclaration(e,{name:r,super:u,elements:i}){return new Shift$1.ClassDeclaration({name:r,super:u,elements:i})}reduceClassElement(e,{method:r}){return new Shift$1.ClassElement({isStatic:e.isStatic,method:r})}reduceClassExpression(e,{name:r,super:u,elements:i}){return new Shift$1.ClassExpression({name:r,super:u,elements:i})}reduceCompoundAssignmentExpression(e,{binding:r,expression:u}){return new Shift$1.CompoundAssignmentExpression({binding:r,operator:e.operator,expression:u})}reduceComputedMemberAssignmentTarget(e,{object:r,expression:u}){return new Shift$1.ComputedMemberAssignmentTarget({object:r,expression:u})}reduceComputedMemberExpression(e,{object:r,expression:u}){return new Shift$1.ComputedMemberExpression({object:r,expression:u})}reduceComputedPropertyName(e,{expression:r}){return new Shift$1.ComputedPropertyName({expression:r})}reduceConditionalExpression(e,{test:r,consequent:u,alternate:i}){return new Shift$1.ConditionalExpression({test:r,consequent:u,alternate:i})}reduceContinueStatement(e){return new Shift$1.ContinueStatement({label:e.label})}reduceDataProperty(e,{name:r,expression:u}){return new Shift$1.DataProperty({name:r,expression:u})}reduceDebuggerStatement(e){return new Shift$1.DebuggerStatement}reduceDirective(e){return new Shift$1.Directive({rawValue:e.rawValue})}reduceDoWhileStatement(e,{body:r,test:u}){return new Shift$1.DoWhileStatement({body:r,test:u})}reduceEmptyStatement(e){return new Shift$1.EmptyStatement}reduceExport(e,{declaration:r}){return new Shift$1.Export({declaration:r})}reduceExportAllFrom(e){return new Shift$1.ExportAllFrom({moduleSpecifier:e.moduleSpecifier})}reduceExportDefault(e,{body:r}){return new Shift$1.ExportDefault({body:r})}reduceExportFrom(e,{namedExports:r}){return new Shift$1.ExportFrom({namedExports:r,moduleSpecifier:e.moduleSpecifier})}reduceExportFromSpecifier(e){return new Shift$1.ExportFromSpecifier({name:e.name,exportedName:e.exportedName})}reduceExportLocalSpecifier(e,{name:r}){return new Shift$1.ExportLocalSpecifier({name:r,exportedName:e.exportedName})}reduceExportLocals(e,{namedExports:r}){return new Shift$1.ExportLocals({namedExports:r})}reduceExpressionStatement(e,{expression:r}){return new Shift$1.ExpressionStatement({expression:r})}reduceForAwaitStatement(e,{left:r,right:u,body:i}){return new Shift$1.ForAwaitStatement({left:r,right:u,body:i})}reduceForInStatement(e,{left:r,right:u,body:i}){return new Shift$1.ForInStatement({left:r,right:u,body:i})}reduceForOfStatement(e,{left:r,right:u,body:i}){return new Shift$1.ForOfStatement({left:r,right:u,body:i})}reduceForStatement(e,{init:r,test:u,update:i,body:n}){return new Shift$1.ForStatement({init:r,test:u,update:i,body:n})}reduceFormalParameters(e,{items:r,rest:u}){return new Shift$1.FormalParameters({items:r,rest:u})}reduceFunctionBody(e,{directives:r,statements:u}){return new Shift$1.FunctionBody({directives:r,statements:u})}reduceFunctionDeclaration(e,{name:r,params:u,body:i}){return new Shift$1.FunctionDeclaration({isAsync:e.isAsync,isGenerator:e.isGenerator,name:r,params:u,body:i})}reduceFunctionExpression(e,{name:r,params:u,body:i}){return new Shift$1.FunctionExpression({isAsync:e.isAsync,isGenerator:e.isGenerator,name:r,params:u,body:i})}reduceGetter(e,{name:r,body:u}){return new Shift$1.Getter({name:r,body:u})}reduceIdentifierExpression(e){return new Shift$1.IdentifierExpression({name:e.name})}reduceIfStatement(e,{test:r,consequent:u,alternate:i}){return new Shift$1.IfStatement({test:r,consequent:u,alternate:i})}reduceImport(e,{defaultBinding:r,namedImports:u}){return new Shift$1.Import({defaultBinding:r,namedImports:u,moduleSpecifier:e.moduleSpecifier})}reduceImportNamespace(e,{defaultBinding:r,namespaceBinding:u}){return new Shift$1.ImportNamespace({defaultBinding:r,namespaceBinding:u,moduleSpecifier:e.moduleSpecifier})}reduceImportSpecifier(e,{binding:r}){return new Shift$1.ImportSpecifier({name:e.name,binding:r})}reduceLabeledStatement(e,{body:r}){return new Shift$1.LabeledStatement({label:e.label,body:r})}reduceLiteralBooleanExpression(e){return new Shift$1.LiteralBooleanExpression({value:e.value})}reduceLiteralInfinityExpression(e){return new Shift$1.LiteralInfinityExpression}reduceLiteralNullExpression(e){return new Shift$1.LiteralNullExpression}reduceLiteralNumericExpression(e){return new Shift$1.LiteralNumericExpression({value:e.value})}reduceLiteralRegExpExpression(e){return new Shift$1.LiteralRegExpExpression({pattern:e.pattern,global:e.global,ignoreCase:e.ignoreCase,multiLine:e.multiLine,dotAll:e.dotAll,unicode:e.unicode,sticky:e.sticky})}reduceLiteralStringExpression(e){return new Shift$1.LiteralStringExpression({value:e.value})}reduceMethod(e,{name:r,params:u,body:i}){return new Shift$1.Method({isAsync:e.isAsync,isGenerator:e.isGenerator,name:r,params:u,body:i})}reduceModule(e,{directives:r,items:u}){return new Shift$1.Module({directives:r,items:u})}reduceNewExpression(e,{callee:r,arguments:u}){return new Shift$1.NewExpression({callee:r,arguments:u})}reduceNewTargetExpression(e){return new Shift$1.NewTargetExpression}reduceObjectAssignmentTarget(e,{properties:r,rest:u}){return new Shift$1.ObjectAssignmentTarget({properties:r,rest:u})}reduceObjectBinding(e,{properties:r,rest:u}){return new Shift$1.ObjectBinding({properties:r,rest:u})}reduceObjectExpression(e,{properties:r}){return new Shift$1.ObjectExpression({properties:r})}reduceReturnStatement(e,{expression:r}){return new Shift$1.ReturnStatement({expression:r})}reduceScript(e,{directives:r,statements:u}){return new Shift$1.Script({directives:r,statements:u})}reduceSetter(e,{name:r,param:u,body:i}){return new Shift$1.Setter({name:r,param:u,body:i})}reduceShorthandProperty(e,{name:r}){return new Shift$1.ShorthandProperty({name:r})}reduceSpreadElement(e,{expression:r}){return new Shift$1.SpreadElement({expression:r})}reduceSpreadProperty(e,{expression:r}){return new Shift$1.SpreadProperty({expression:r})}reduceStaticMemberAssignmentTarget(e,{object:r}){return new Shift$1.StaticMemberAssignmentTarget({object:r,property:e.property})}reduceStaticMemberExpression(e,{object:r}){return new Shift$1.StaticMemberExpression({object:r,property:e.property})}reduceStaticPropertyName(e){return new Shift$1.StaticPropertyName({value:e.value})}reduceSuper(e){return new Shift$1.Super}reduceSwitchCase(e,{test:r,consequent:u}){return new Shift$1.SwitchCase({test:r,consequent:u})}reduceSwitchDefault(e,{consequent:r}){return new Shift$1.SwitchDefault({consequent:r})}reduceSwitchStatement(e,{discriminant:r,cases:u}){return new Shift$1.SwitchStatement({discriminant:r,cases:u})}reduceSwitchStatementWithDefault(e,{discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n}){return new Shift$1.SwitchStatementWithDefault({discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n})}reduceTemplateElement(e){return new Shift$1.TemplateElement({rawValue:e.rawValue})}reduceTemplateExpression(e,{tag:r,elements:u}){return new Shift$1.TemplateExpression({tag:r,elements:u})}reduceThisExpression(e){return new Shift$1.ThisExpression}reduceThrowStatement(e,{expression:r}){return new Shift$1.ThrowStatement({expression:r})}reduceTryCatchStatement(e,{body:r,catchClause:u}){return new Shift$1.TryCatchStatement({body:r,catchClause:u})}reduceTryFinallyStatement(e,{body:r,catchClause:u,finalizer:i}){return new Shift$1.TryFinallyStatement({body:r,catchClause:u,finalizer:i})}reduceUnaryExpression(e,{operand:r}){return new Shift$1.UnaryExpression({operator:e.operator,operand:r})}reduceUpdateExpression(e,{operand:r}){return new Shift$1.UpdateExpression({isPrefix:e.isPrefix,operator:e.operator,operand:r})}reduceVariableDeclaration(e,{declarators:r}){return new Shift$1.VariableDeclaration({kind:e.kind,declarators:r})}reduceVariableDeclarationStatement(e,{declaration:r}){return new Shift$1.VariableDeclarationStatement({declaration:r})}reduceVariableDeclarator(e,{binding:r,init:u}){return new Shift$1.VariableDeclarator({binding:r,init:u})}reduceWhileStatement(e,{test:r,body:u}){return new Shift$1.WhileStatement({test:r,body:u})}reduceWithStatement(e,{object:r,body:u}){return new Shift$1.WithStatement({object:r,body:u})}reduceYieldExpression(e,{expression:r}){return new Shift$1.YieldExpression({expression:r})}reduceYieldGeneratorExpression(e,{expression:r}){return new Shift$1.YieldGeneratorExpression({expression:r})}};const Shift=gen;var lazyCloneReducer=class{reduceArrayAssignmentTarget(e,{elements:r,rest:u}){return e.elements.length===r.length&&e.elements.every((i,n)=>i===r[n])&&e.rest===u?e:new Shift.ArrayAssignmentTarget({elements:r,rest:u})}reduceArrayBinding(e,{elements:r,rest:u}){return e.elements.length===r.length&&e.elements.every((i,n)=>i===r[n])&&e.rest===u?e:new Shift.ArrayBinding({elements:r,rest:u})}reduceArrayExpression(e,{elements:r}){return e.elements.length===r.length&&e.elements.every((u,i)=>u===r[i])?e:new Shift.ArrayExpression({elements:r})}reduceArrowExpression(e,{params:r,body:u}){return e.params===r&&e.body===u?e:new Shift.ArrowExpression({isAsync:e.isAsync,params:r,body:u})}reduceAssignmentExpression(e,{binding:r,expression:u}){return e.binding===r&&e.expression===u?e:new Shift.AssignmentExpression({binding:r,expression:u})}reduceAssignmentTargetIdentifier(e){return e}reduceAssignmentTargetPropertyIdentifier(e,{binding:r,init:u}){return e.binding===r&&e.init===u?e:new Shift.AssignmentTargetPropertyIdentifier({binding:r,init:u})}reduceAssignmentTargetPropertyProperty(e,{name:r,binding:u}){return e.name===r&&e.binding===u?e:new Shift.AssignmentTargetPropertyProperty({name:r,binding:u})}reduceAssignmentTargetWithDefault(e,{binding:r,init:u}){return e.binding===r&&e.init===u?e:new Shift.AssignmentTargetWithDefault({binding:r,init:u})}reduceAwaitExpression(e,{expression:r}){return e.expression===r?e:new Shift.AwaitExpression({expression:r})}reduceBinaryExpression(e,{left:r,right:u}){return e.left===r&&e.right===u?e:new Shift.BinaryExpression({left:r,operator:e.operator,right:u})}reduceBindingIdentifier(e){return e}reduceBindingPropertyIdentifier(e,{binding:r,init:u}){return e.binding===r&&e.init===u?e:new Shift.BindingPropertyIdentifier({binding:r,init:u})}reduceBindingPropertyProperty(e,{name:r,binding:u}){return e.name===r&&e.binding===u?e:new Shift.BindingPropertyProperty({name:r,binding:u})}reduceBindingWithDefault(e,{binding:r,init:u}){return e.binding===r&&e.init===u?e:new Shift.BindingWithDefault({binding:r,init:u})}reduceBlock(e,{statements:r}){return e.statements.length===r.length&&e.statements.every((u,i)=>u===r[i])?e:new Shift.Block({statements:r})}reduceBlockStatement(e,{block:r}){return e.block===r?e:new Shift.BlockStatement({block:r})}reduceBreakStatement(e){return e}reduceCallExpression(e,{callee:r,arguments:u}){return e.callee===r&&e.arguments.length===u.length&&e.arguments.every((i,n)=>i===u[n])?e:new Shift.CallExpression({callee:r,arguments:u})}reduceCatchClause(e,{binding:r,body:u}){return e.binding===r&&e.body===u?e:new Shift.CatchClause({binding:r,body:u})}reduceClassDeclaration(e,{name:r,super:u,elements:i}){return e.name===r&&e.super===u&&e.elements.length===i.length&&e.elements.every((n,a)=>n===i[a])?e:new Shift.ClassDeclaration({name:r,super:u,elements:i})}reduceClassElement(e,{method:r}){return e.method===r?e:new Shift.ClassElement({isStatic:e.isStatic,method:r})}reduceClassExpression(e,{name:r,super:u,elements:i}){return e.name===r&&e.super===u&&e.elements.length===i.length&&e.elements.every((n,a)=>n===i[a])?e:new Shift.ClassExpression({name:r,super:u,elements:i})}reduceCompoundAssignmentExpression(e,{binding:r,expression:u}){return e.binding===r&&e.expression===u?e:new Shift.CompoundAssignmentExpression({binding:r,operator:e.operator,expression:u})}reduceComputedMemberAssignmentTarget(e,{object:r,expression:u}){return e.object===r&&e.expression===u?e:new Shift.ComputedMemberAssignmentTarget({object:r,expression:u})}reduceComputedMemberExpression(e,{object:r,expression:u}){return e.object===r&&e.expression===u?e:new Shift.ComputedMemberExpression({object:r,expression:u})}reduceComputedPropertyName(e,{expression:r}){return e.expression===r?e:new Shift.ComputedPropertyName({expression:r})}reduceConditionalExpression(e,{test:r,consequent:u,alternate:i}){return e.test===r&&e.consequent===u&&e.alternate===i?e:new Shift.ConditionalExpression({test:r,consequent:u,alternate:i})}reduceContinueStatement(e){return e}reduceDataProperty(e,{name:r,expression:u}){return e.name===r&&e.expression===u?e:new Shift.DataProperty({name:r,expression:u})}reduceDebuggerStatement(e){return e}reduceDirective(e){return e}reduceDoWhileStatement(e,{body:r,test:u}){return e.body===r&&e.test===u?e:new Shift.DoWhileStatement({body:r,test:u})}reduceEmptyStatement(e){return e}reduceExport(e,{declaration:r}){return e.declaration===r?e:new Shift.Export({declaration:r})}reduceExportAllFrom(e){return e}reduceExportDefault(e,{body:r}){return e.body===r?e:new Shift.ExportDefault({body:r})}reduceExportFrom(e,{namedExports:r}){return e.namedExports.length===r.length&&e.namedExports.every((u,i)=>u===r[i])?e:new Shift.ExportFrom({namedExports:r,moduleSpecifier:e.moduleSpecifier})}reduceExportFromSpecifier(e){return e}reduceExportLocalSpecifier(e,{name:r}){return e.name===r?e:new Shift.ExportLocalSpecifier({name:r,exportedName:e.exportedName})}reduceExportLocals(e,{namedExports:r}){return e.namedExports.length===r.length&&e.namedExports.every((u,i)=>u===r[i])?e:new Shift.ExportLocals({namedExports:r})}reduceExpressionStatement(e,{expression:r}){return e.expression===r?e:new Shift.ExpressionStatement({expression:r})}reduceForAwaitStatement(e,{left:r,right:u,body:i}){return e.left===r&&e.right===u&&e.body===i?e:new Shift.ForAwaitStatement({left:r,right:u,body:i})}reduceForInStatement(e,{left:r,right:u,body:i}){return e.left===r&&e.right===u&&e.body===i?e:new Shift.ForInStatement({left:r,right:u,body:i})}reduceForOfStatement(e,{left:r,right:u,body:i}){return e.left===r&&e.right===u&&e.body===i?e:new Shift.ForOfStatement({left:r,right:u,body:i})}reduceForStatement(e,{init:r,test:u,update:i,body:n}){return e.init===r&&e.test===u&&e.update===i&&e.body===n?e:new Shift.ForStatement({init:r,test:u,update:i,body:n})}reduceFormalParameters(e,{items:r,rest:u}){return e.items.length===r.length&&e.items.every((i,n)=>i===r[n])&&e.rest===u?e:new Shift.FormalParameters({items:r,rest:u})}reduceFunctionBody(e,{directives:r,statements:u}){return e.directives.length===r.length&&e.directives.every((i,n)=>i===r[n])&&e.statements.length===u.length&&e.statements.every((i,n)=>i===u[n])?e:new Shift.FunctionBody({directives:r,statements:u})}reduceFunctionDeclaration(e,{name:r,params:u,body:i}){return e.name===r&&e.params===u&&e.body===i?e:new Shift.FunctionDeclaration({isAsync:e.isAsync,isGenerator:e.isGenerator,name:r,params:u,body:i})}reduceFunctionExpression(e,{name:r,params:u,body:i}){return e.name===r&&e.params===u&&e.body===i?e:new Shift.FunctionExpression({isAsync:e.isAsync,isGenerator:e.isGenerator,name:r,params:u,body:i})}reduceGetter(e,{name:r,body:u}){return e.name===r&&e.body===u?e:new Shift.Getter({name:r,body:u})}reduceIdentifierExpression(e){return e}reduceIfStatement(e,{test:r,consequent:u,alternate:i}){return e.test===r&&e.consequent===u&&e.alternate===i?e:new Shift.IfStatement({test:r,consequent:u,alternate:i})}reduceImport(e,{defaultBinding:r,namedImports:u}){return e.defaultBinding===r&&e.namedImports.length===u.length&&e.namedImports.every((i,n)=>i===u[n])?e:new Shift.Import({defaultBinding:r,namedImports:u,moduleSpecifier:e.moduleSpecifier})}reduceImportNamespace(e,{defaultBinding:r,namespaceBinding:u}){return e.defaultBinding===r&&e.namespaceBinding===u?e:new Shift.ImportNamespace({defaultBinding:r,namespaceBinding:u,moduleSpecifier:e.moduleSpecifier})}reduceImportSpecifier(e,{binding:r}){return e.binding===r?e:new Shift.ImportSpecifier({name:e.name,binding:r})}reduceLabeledStatement(e,{body:r}){return e.body===r?e:new Shift.LabeledStatement({label:e.label,body:r})}reduceLiteralBooleanExpression(e){return e}reduceLiteralInfinityExpression(e){return e}reduceLiteralNullExpression(e){return e}reduceLiteralNumericExpression(e){return e}reduceLiteralRegExpExpression(e){return e}reduceLiteralStringExpression(e){return e}reduceMethod(e,{name:r,params:u,body:i}){return e.name===r&&e.params===u&&e.body===i?e:new Shift.Method({isAsync:e.isAsync,isGenerator:e.isGenerator,name:r,params:u,body:i})}reduceModule(e,{directives:r,items:u}){return e.directives.length===r.length&&e.directives.every((i,n)=>i===r[n])&&e.items.length===u.length&&e.items.every((i,n)=>i===u[n])?e:new Shift.Module({directives:r,items:u})}reduceNewExpression(e,{callee:r,arguments:u}){return e.callee===r&&e.arguments.length===u.length&&e.arguments.every((i,n)=>i===u[n])?e:new Shift.NewExpression({callee:r,arguments:u})}reduceNewTargetExpression(e){return e}reduceObjectAssignmentTarget(e,{properties:r,rest:u}){return e.properties.length===r.length&&e.properties.every((i,n)=>i===r[n])&&e.rest===u?e:new Shift.ObjectAssignmentTarget({properties:r,rest:u})}reduceObjectBinding(e,{properties:r,rest:u}){return e.properties.length===r.length&&e.properties.every((i,n)=>i===r[n])&&e.rest===u?e:new Shift.ObjectBinding({properties:r,rest:u})}reduceObjectExpression(e,{properties:r}){return e.properties.length===r.length&&e.properties.every((u,i)=>u===r[i])?e:new Shift.ObjectExpression({properties:r})}reduceReturnStatement(e,{expression:r}){return e.expression===r?e:new Shift.ReturnStatement({expression:r})}reduceScript(e,{directives:r,statements:u}){return e.directives.length===r.length&&e.directives.every((i,n)=>i===r[n])&&e.statements.length===u.length&&e.statements.every((i,n)=>i===u[n])?e:new Shift.Script({directives:r,statements:u})}reduceSetter(e,{name:r,param:u,body:i}){return e.name===r&&e.param===u&&e.body===i?e:new Shift.Setter({name:r,param:u,body:i})}reduceShorthandProperty(e,{name:r}){return e.name===r?e:new Shift.ShorthandProperty({name:r})}reduceSpreadElement(e,{expression:r}){return e.expression===r?e:new Shift.SpreadElement({expression:r})}reduceSpreadProperty(e,{expression:r}){return e.expression===r?e:new Shift.SpreadProperty({expression:r})}reduceStaticMemberAssignmentTarget(e,{object:r}){return e.object===r?e:new Shift.StaticMemberAssignmentTarget({object:r,property:e.property})}reduceStaticMemberExpression(e,{object:r}){return e.object===r?e:new Shift.StaticMemberExpression({object:r,property:e.property})}reduceStaticPropertyName(e){return e}reduceSuper(e){return e}reduceSwitchCase(e,{test:r,consequent:u}){return e.test===r&&e.consequent.length===u.length&&e.consequent.every((i,n)=>i===u[n])?e:new Shift.SwitchCase({test:r,consequent:u})}reduceSwitchDefault(e,{consequent:r}){return e.consequent.length===r.length&&e.consequent.every((u,i)=>u===r[i])?e:new Shift.SwitchDefault({consequent:r})}reduceSwitchStatement(e,{discriminant:r,cases:u}){return e.discriminant===r&&e.cases.length===u.length&&e.cases.every((i,n)=>i===u[n])?e:new Shift.SwitchStatement({discriminant:r,cases:u})}reduceSwitchStatementWithDefault(e,{discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n}){return e.discriminant===r&&e.preDefaultCases.length===u.length&&e.preDefaultCases.every((a,l)=>a===u[l])&&e.defaultCase===i&&e.postDefaultCases.length===n.length&&e.postDefaultCases.every((a,l)=>a===n[l])?e:new Shift.SwitchStatementWithDefault({discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n})}reduceTemplateElement(e){return e}reduceTemplateExpression(e,{tag:r,elements:u}){return e.tag===r&&e.elements.length===u.length&&e.elements.every((i,n)=>i===u[n])?e:new Shift.TemplateExpression({tag:r,elements:u})}reduceThisExpression(e){return e}reduceThrowStatement(e,{expression:r}){return e.expression===r?e:new Shift.ThrowStatement({expression:r})}reduceTryCatchStatement(e,{body:r,catchClause:u}){return e.body===r&&e.catchClause===u?e:new Shift.TryCatchStatement({body:r,catchClause:u})}reduceTryFinallyStatement(e,{body:r,catchClause:u,finalizer:i}){return e.body===r&&e.catchClause===u&&e.finalizer===i?e:new Shift.TryFinallyStatement({body:r,catchClause:u,finalizer:i})}reduceUnaryExpression(e,{operand:r}){return e.operand===r?e:new Shift.UnaryExpression({operator:e.operator,operand:r})}reduceUpdateExpression(e,{operand:r}){return e.operand===r?e:new Shift.UpdateExpression({isPrefix:e.isPrefix,operator:e.operator,operand:r})}reduceVariableDeclaration(e,{declarators:r}){return e.declarators.length===r.length&&e.declarators.every((u,i)=>u===r[i])?e:new Shift.VariableDeclaration({kind:e.kind,declarators:r})}reduceVariableDeclarationStatement(e,{declaration:r}){return e.declaration===r?e:new Shift.VariableDeclarationStatement({declaration:r})}reduceVariableDeclarator(e,{binding:r,init:u}){return e.binding===r&&e.init===u?e:new Shift.VariableDeclarator({binding:r,init:u})}reduceWhileStatement(e,{test:r,body:u}){return e.test===r&&e.body===u?e:new Shift.WhileStatement({test:r,body:u})}reduceWithStatement(e,{object:r,body:u}){return e.object===r&&e.body===u?e:new Shift.WithStatement({object:r,body:u})}reduceYieldExpression(e,{expression:r}){return e.expression===r?e:new Shift.YieldExpression({expression:r})}reduceYieldGeneratorExpression(e,{expression:r}){return e.expression===r?e:new Shift.YieldGeneratorExpression({expression:r})}},monoidalReducer=class{constructor(e){let r=e.empty();this.identity=r;let u;if(e.prototype&&typeof e.prototype.concat=="function")u=Function.prototype.call.bind(e.prototype.concat);else if(typeof e.concat=="function")u=e.concat;else throw new TypeError("Monoid must provide a `concat` method");this.append=(...i)=>i.reduce(u,r)}reduceArrayAssignmentTarget(e,{elements:r,rest:u}){return this.append(...r.filter(i=>i!=null),u==null?this.identity:u)}reduceArrayBinding(e,{elements:r,rest:u}){return this.append(...r.filter(i=>i!=null),u==null?this.identity:u)}reduceArrayExpression(e,{elements:r}){return this.append(...r.filter(u=>u!=null))}reduceArrowExpression(e,{params:r,body:u}){return this.append(r,u)}reduceAssignmentExpression(e,{binding:r,expression:u}){return this.append(r,u)}reduceAssignmentTargetIdentifier(e){return this.identity}reduceAssignmentTargetPropertyIdentifier(e,{binding:r,init:u}){return this.append(r,u==null?this.identity:u)}reduceAssignmentTargetPropertyProperty(e,{name:r,binding:u}){return this.append(r,u)}reduceAssignmentTargetWithDefault(e,{binding:r,init:u}){return this.append(r,u)}reduceAwaitExpression(e,{expression:r}){return r}reduceBinaryExpression(e,{left:r,right:u}){return this.append(r,u)}reduceBindingIdentifier(e){return this.identity}reduceBindingPropertyIdentifier(e,{binding:r,init:u}){return this.append(r,u==null?this.identity:u)}reduceBindingPropertyProperty(e,{name:r,binding:u}){return this.append(r,u)}reduceBindingWithDefault(e,{binding:r,init:u}){return this.append(r,u)}reduceBlock(e,{statements:r}){return this.append(...r)}reduceBlockStatement(e,{block:r}){return r}reduceBreakStatement(e){return this.identity}reduceCallExpression(e,{callee:r,arguments:u}){return this.append(r,...u)}reduceCatchClause(e,{binding:r,body:u}){return this.append(r==null?this.identity:r,u)}reduceClassDeclaration(e,{name:r,super:u,elements:i}){return this.append(r,u==null?this.identity:u,...i)}reduceClassElement(e,{method:r}){return r}reduceClassExpression(e,{name:r,super:u,elements:i}){return this.append(r==null?this.identity:r,u==null?this.identity:u,...i)}reduceCompoundAssignmentExpression(e,{binding:r,expression:u}){return this.append(r,u)}reduceComputedMemberAssignmentTarget(e,{object:r,expression:u}){return this.append(r,u)}reduceComputedMemberExpression(e,{object:r,expression:u}){return this.append(r,u)}reduceComputedPropertyName(e,{expression:r}){return r}reduceConditionalExpression(e,{test:r,consequent:u,alternate:i}){return this.append(r,u,i)}reduceContinueStatement(e){return this.identity}reduceDataProperty(e,{name:r,expression:u}){return this.append(r,u)}reduceDebuggerStatement(e){return this.identity}reduceDirective(e){return this.identity}reduceDoWhileStatement(e,{body:r,test:u}){return this.append(r,u)}reduceEmptyStatement(e){return this.identity}reduceExport(e,{declaration:r}){return r}reduceExportAllFrom(e){return this.identity}reduceExportDefault(e,{body:r}){return r}reduceExportFrom(e,{namedExports:r}){return this.append(...r)}reduceExportFromSpecifier(e){return this.identity}reduceExportLocalSpecifier(e,{name:r}){return r}reduceExportLocals(e,{namedExports:r}){return this.append(...r)}reduceExpressionStatement(e,{expression:r}){return r}reduceForAwaitStatement(e,{left:r,right:u,body:i}){return this.append(r,u,i)}reduceForInStatement(e,{left:r,right:u,body:i}){return this.append(r,u,i)}reduceForOfStatement(e,{left:r,right:u,body:i}){return this.append(r,u,i)}reduceForStatement(e,{init:r,test:u,update:i,body:n}){return this.append(r==null?this.identity:r,u==null?this.identity:u,i==null?this.identity:i,n)}reduceFormalParameters(e,{items:r,rest:u}){return this.append(...r,u==null?this.identity:u)}reduceFunctionBody(e,{directives:r,statements:u}){return this.append(...r,...u)}reduceFunctionDeclaration(e,{name:r,params:u,body:i}){return this.append(r,u,i)}reduceFunctionExpression(e,{name:r,params:u,body:i}){return this.append(r==null?this.identity:r,u,i)}reduceGetter(e,{name:r,body:u}){return this.append(r,u)}reduceIdentifierExpression(e){return this.identity}reduceIfStatement(e,{test:r,consequent:u,alternate:i}){return this.append(r,u,i==null?this.identity:i)}reduceImport(e,{defaultBinding:r,namedImports:u}){return this.append(r==null?this.identity:r,...u)}reduceImportNamespace(e,{defaultBinding:r,namespaceBinding:u}){return this.append(r==null?this.identity:r,u)}reduceImportSpecifier(e,{binding:r}){return r}reduceLabeledStatement(e,{body:r}){return r}reduceLiteralBooleanExpression(e){return this.identity}reduceLiteralInfinityExpression(e){return this.identity}reduceLiteralNullExpression(e){return this.identity}reduceLiteralNumericExpression(e){return this.identity}reduceLiteralRegExpExpression(e){return this.identity}reduceLiteralStringExpression(e){return this.identity}reduceMethod(e,{name:r,params:u,body:i}){return this.append(r,u,i)}reduceModule(e,{directives:r,items:u}){return this.append(...r,...u)}reduceNewExpression(e,{callee:r,arguments:u}){return this.append(r,...u)}reduceNewTargetExpression(e){return this.identity}reduceObjectAssignmentTarget(e,{properties:r,rest:u}){return this.append(...r,u==null?this.identity:u)}reduceObjectBinding(e,{properties:r,rest:u}){return this.append(...r,u==null?this.identity:u)}reduceObjectExpression(e,{properties:r}){return this.append(...r)}reduceReturnStatement(e,{expression:r}){return r==null?this.identity:r}reduceScript(e,{directives:r,statements:u}){return this.append(...r,...u)}reduceSetter(e,{name:r,param:u,body:i}){return this.append(r,u,i)}reduceShorthandProperty(e,{name:r}){return r}reduceSpreadElement(e,{expression:r}){return r}reduceSpreadProperty(e,{expression:r}){return r}reduceStaticMemberAssignmentTarget(e,{object:r}){return r}reduceStaticMemberExpression(e,{object:r}){return r}reduceStaticPropertyName(e){return this.identity}reduceSuper(e){return this.identity}reduceSwitchCase(e,{test:r,consequent:u}){return this.append(r,...u)}reduceSwitchDefault(e,{consequent:r}){return this.append(...r)}reduceSwitchStatement(e,{discriminant:r,cases:u}){return this.append(r,...u)}reduceSwitchStatementWithDefault(e,{discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n}){return this.append(r,...u,i,...n)}reduceTemplateElement(e){return this.identity}reduceTemplateExpression(e,{tag:r,elements:u}){return this.append(r==null?this.identity:r,...u)}reduceThisExpression(e){return this.identity}reduceThrowStatement(e,{expression:r}){return r}reduceTryCatchStatement(e,{body:r,catchClause:u}){return this.append(r,u)}reduceTryFinallyStatement(e,{body:r,catchClause:u,finalizer:i}){return this.append(r,u==null?this.identity:u,i)}reduceUnaryExpression(e,{operand:r}){return r}reduceUpdateExpression(e,{operand:r}){return r}reduceVariableDeclaration(e,{declarators:r}){return this.append(...r)}reduceVariableDeclarationStatement(e,{declaration:r}){return r}reduceVariableDeclarator(e,{binding:r,init:u}){return this.append(r,u==null?this.identity:u)}reduceWhileStatement(e,{test:r,body:u}){return this.append(r,u)}reduceWithStatement(e,{object:r,body:u}){return this.append(r,u)}reduceYieldExpression(e,{expression:r}){return r==null?this.identity:r}reduceYieldGeneratorExpression(e,{expression:r}){return r}},thunkedMonoidalReducer=class{constructor(e){let r=e.empty();this.identity=r;let u;if(e.prototype&&typeof e.prototype.concatThunk=="function")u=Function.prototype.call.bind(e.prototype.concatThunk);else if(typeof e.concatThunk=="function")u=e.concatThunk;else{let i;if(e.prototype&&typeof e.prototype.concat=="function")i=Function.prototype.call.bind(e.prototype.concat);else if(typeof e.concat=="function")i=e.concat;else throw new TypeError("Monoid must provide a `concatThunk` or `concat` method");if(typeof e.isAbsorbing=="function"){let n=e.isAbsorbing;u=(a,l)=>n(a)?a:i(a,l())}else u=(n,a)=>i(n,a())}this.append=(...i)=>i.reduce(u,r)}reduceArrayAssignmentTarget(e,{elements:r,rest:u}){return this.append(...r.filter(i=>i!=null),u==null?()=>this.identity:u)}reduceArrayBinding(e,{elements:r,rest:u}){return this.append(...r.filter(i=>i!=null),u==null?()=>this.identity:u)}reduceArrayExpression(e,{elements:r}){return this.append(...r.filter(u=>u!=null))}reduceArrowExpression(e,{params:r,body:u}){return this.append(r,u)}reduceAssignmentExpression(e,{binding:r,expression:u}){return this.append(r,u)}reduceAssignmentTargetIdentifier(e){return this.identity}reduceAssignmentTargetPropertyIdentifier(e,{binding:r,init:u}){return this.append(r,u==null?()=>this.identity:u)}reduceAssignmentTargetPropertyProperty(e,{name:r,binding:u}){return this.append(r,u)}reduceAssignmentTargetWithDefault(e,{binding:r,init:u}){return this.append(r,u)}reduceAwaitExpression(e,{expression:r}){return r()}reduceBinaryExpression(e,{left:r,right:u}){return this.append(r,u)}reduceBindingIdentifier(e){return this.identity}reduceBindingPropertyIdentifier(e,{binding:r,init:u}){return this.append(r,u==null?()=>this.identity:u)}reduceBindingPropertyProperty(e,{name:r,binding:u}){return this.append(r,u)}reduceBindingWithDefault(e,{binding:r,init:u}){return this.append(r,u)}reduceBlock(e,{statements:r}){return this.append(...r)}reduceBlockStatement(e,{block:r}){return r()}reduceBreakStatement(e){return this.identity}reduceCallExpression(e,{callee:r,arguments:u}){return this.append(r,...u)}reduceCatchClause(e,{binding:r,body:u}){return this.append(r==null?()=>this.identity:r,u)}reduceClassDeclaration(e,{name:r,super:u,elements:i}){return this.append(r,u==null?()=>this.identity:u,...i)}reduceClassElement(e,{method:r}){return r()}reduceClassExpression(e,{name:r,super:u,elements:i}){return this.append(r==null?()=>this.identity:r,u==null?()=>this.identity:u,...i)}reduceCompoundAssignmentExpression(e,{binding:r,expression:u}){return this.append(r,u)}reduceComputedMemberAssignmentTarget(e,{object:r,expression:u}){return this.append(r,u)}reduceComputedMemberExpression(e,{object:r,expression:u}){return this.append(r,u)}reduceComputedPropertyName(e,{expression:r}){return r()}reduceConditionalExpression(e,{test:r,consequent:u,alternate:i}){return this.append(r,u,i)}reduceContinueStatement(e){return this.identity}reduceDataProperty(e,{name:r,expression:u}){return this.append(r,u)}reduceDebuggerStatement(e){return this.identity}reduceDirective(e){return this.identity}reduceDoWhileStatement(e,{body:r,test:u}){return this.append(r,u)}reduceEmptyStatement(e){return this.identity}reduceExport(e,{declaration:r}){return r()}reduceExportAllFrom(e){return this.identity}reduceExportDefault(e,{body:r}){return r()}reduceExportFrom(e,{namedExports:r}){return this.append(...r)}reduceExportFromSpecifier(e){return this.identity}reduceExportLocalSpecifier(e,{name:r}){return r()}reduceExportLocals(e,{namedExports:r}){return this.append(...r)}reduceExpressionStatement(e,{expression:r}){return r()}reduceForAwaitStatement(e,{left:r,right:u,body:i}){return this.append(r,u,i)}reduceForInStatement(e,{left:r,right:u,body:i}){return this.append(r,u,i)}reduceForOfStatement(e,{left:r,right:u,body:i}){return this.append(r,u,i)}reduceForStatement(e,{init:r,test:u,update:i,body:n}){return this.append(r==null?()=>this.identity:r,u==null?()=>this.identity:u,i==null?()=>this.identity:i,n)}reduceFormalParameters(e,{items:r,rest:u}){return this.append(...r,u==null?()=>this.identity:u)}reduceFunctionBody(e,{directives:r,statements:u}){return this.append(...r,...u)}reduceFunctionDeclaration(e,{name:r,params:u,body:i}){return this.append(r,u,i)}reduceFunctionExpression(e,{name:r,params:u,body:i}){return this.append(r==null?()=>this.identity:r,u,i)}reduceGetter(e,{name:r,body:u}){return this.append(r,u)}reduceIdentifierExpression(e){return this.identity}reduceIfStatement(e,{test:r,consequent:u,alternate:i}){return this.append(r,u,i==null?()=>this.identity:i)}reduceImport(e,{defaultBinding:r,namedImports:u}){return this.append(r==null?()=>this.identity:r,...u)}reduceImportNamespace(e,{defaultBinding:r,namespaceBinding:u}){return this.append(r==null?()=>this.identity:r,u)}reduceImportSpecifier(e,{binding:r}){return r()}reduceLabeledStatement(e,{body:r}){return r()}reduceLiteralBooleanExpression(e){return this.identity}reduceLiteralInfinityExpression(e){return this.identity}reduceLiteralNullExpression(e){return this.identity}reduceLiteralNumericExpression(e){return this.identity}reduceLiteralRegExpExpression(e){return this.identity}reduceLiteralStringExpression(e){return this.identity}reduceMethod(e,{name:r,params:u,body:i}){return this.append(r,u,i)}reduceModule(e,{directives:r,items:u}){return this.append(...r,...u)}reduceNewExpression(e,{callee:r,arguments:u}){return this.append(r,...u)}reduceNewTargetExpression(e){return this.identity}reduceObjectAssignmentTarget(e,{properties:r,rest:u}){return this.append(...r,u==null?()=>this.identity:u)}reduceObjectBinding(e,{properties:r,rest:u}){return this.append(...r,u==null?()=>this.identity:u)}reduceObjectExpression(e,{properties:r}){return this.append(...r)}reduceReturnStatement(e,{expression:r}){return r==null?this.identity:r()}reduceScript(e,{directives:r,statements:u}){return this.append(...r,...u)}reduceSetter(e,{name:r,param:u,body:i}){return this.append(r,u,i)}reduceShorthandProperty(e,{name:r}){return r()}reduceSpreadElement(e,{expression:r}){return r()}reduceSpreadProperty(e,{expression:r}){return r()}reduceStaticMemberAssignmentTarget(e,{object:r}){return r()}reduceStaticMemberExpression(e,{object:r}){return r()}reduceStaticPropertyName(e){return this.identity}reduceSuper(e){return this.identity}reduceSwitchCase(e,{test:r,consequent:u}){return this.append(r,...u)}reduceSwitchDefault(e,{consequent:r}){return this.append(...r)}reduceSwitchStatement(e,{discriminant:r,cases:u}){return this.append(r,...u)}reduceSwitchStatementWithDefault(e,{discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n}){return this.append(r,...u,i,...n)}reduceTemplateElement(e){return this.identity}reduceTemplateExpression(e,{tag:r,elements:u}){return this.append(r==null?()=>this.identity:r,...u)}reduceThisExpression(e){return this.identity}reduceThrowStatement(e,{expression:r}){return r()}reduceTryCatchStatement(e,{body:r,catchClause:u}){return this.append(r,u)}reduceTryFinallyStatement(e,{body:r,catchClause:u,finalizer:i}){return this.append(r,u==null?()=>this.identity:u,i)}reduceUnaryExpression(e,{operand:r}){return r()}reduceUpdateExpression(e,{operand:r}){return r()}reduceVariableDeclaration(e,{declarators:r}){return this.append(...r)}reduceVariableDeclarationStatement(e,{declaration:r}){return r()}reduceVariableDeclarator(e,{binding:r,init:u}){return this.append(r,u==null?()=>this.identity:u)}reduceWhileStatement(e,{test:r,body:u}){return this.append(r,u)}reduceWithStatement(e,{object:r,body:u}){return this.append(r,u)}reduceYieldExpression(e,{expression:r}){return r==null?this.identity:r()}reduceYieldGeneratorExpression(e,{expression:r}){return r()}},adapt$2=(s,e)=>({__proto__:e,reduceArrayAssignmentTarget(r,u){return s(super.reduceArrayAssignmentTarget(r,u),r)},reduceArrayBinding(r,u){return s(super.reduceArrayBinding(r,u),r)},reduceArrayExpression(r,u){return s(super.reduceArrayExpression(r,u),r)},reduceArrowExpression(r,u){return s(super.reduceArrowExpression(r,u),r)},reduceAssignmentExpression(r,u){return s(super.reduceAssignmentExpression(r,u),r)},reduceAssignmentTargetIdentifier(r,u){return s(super.reduceAssignmentTargetIdentifier(r,u),r)},reduceAssignmentTargetPropertyIdentifier(r,u){return s(super.reduceAssignmentTargetPropertyIdentifier(r,u),r)},reduceAssignmentTargetPropertyProperty(r,u){return s(super.reduceAssignmentTargetPropertyProperty(r,u),r)},reduceAssignmentTargetWithDefault(r,u){return s(super.reduceAssignmentTargetWithDefault(r,u),r)},reduceAwaitExpression(r,u){return s(super.reduceAwaitExpression(r,u),r)},reduceBinaryExpression(r,u){return s(super.reduceBinaryExpression(r,u),r)},reduceBindingIdentifier(r,u){return s(super.reduceBindingIdentifier(r,u),r)},reduceBindingPropertyIdentifier(r,u){return s(super.reduceBindingPropertyIdentifier(r,u),r)},reduceBindingPropertyProperty(r,u){return s(super.reduceBindingPropertyProperty(r,u),r)},reduceBindingWithDefault(r,u){return s(super.reduceBindingWithDefault(r,u),r)},reduceBlock(r,u){return s(super.reduceBlock(r,u),r)},reduceBlockStatement(r,u){return s(super.reduceBlockStatement(r,u),r)},reduceBreakStatement(r,u){return s(super.reduceBreakStatement(r,u),r)},reduceCallExpression(r,u){return s(super.reduceCallExpression(r,u),r)},reduceCatchClause(r,u){return s(super.reduceCatchClause(r,u),r)},reduceClassDeclaration(r,u){return s(super.reduceClassDeclaration(r,u),r)},reduceClassElement(r,u){return s(super.reduceClassElement(r,u),r)},reduceClassExpression(r,u){return s(super.reduceClassExpression(r,u),r)},reduceCompoundAssignmentExpression(r,u){return s(super.reduceCompoundAssignmentExpression(r,u),r)},reduceComputedMemberAssignmentTarget(r,u){return s(super.reduceComputedMemberAssignmentTarget(r,u),r)},reduceComputedMemberExpression(r,u){return s(super.reduceComputedMemberExpression(r,u),r)},reduceComputedPropertyName(r,u){return s(super.reduceComputedPropertyName(r,u),r)},reduceConditionalExpression(r,u){return s(super.reduceConditionalExpression(r,u),r)},reduceContinueStatement(r,u){return s(super.reduceContinueStatement(r,u),r)},reduceDataProperty(r,u){return s(super.reduceDataProperty(r,u),r)},reduceDebuggerStatement(r,u){return s(super.reduceDebuggerStatement(r,u),r)},reduceDirective(r,u){return s(super.reduceDirective(r,u),r)},reduceDoWhileStatement(r,u){return s(super.reduceDoWhileStatement(r,u),r)},reduceEmptyStatement(r,u){return s(super.reduceEmptyStatement(r,u),r)},reduceExport(r,u){return s(super.reduceExport(r,u),r)},reduceExportAllFrom(r,u){return s(super.reduceExportAllFrom(r,u),r)},reduceExportDefault(r,u){return s(super.reduceExportDefault(r,u),r)},reduceExportFrom(r,u){return s(super.reduceExportFrom(r,u),r)},reduceExportFromSpecifier(r,u){return s(super.reduceExportFromSpecifier(r,u),r)},reduceExportLocalSpecifier(r,u){return s(super.reduceExportLocalSpecifier(r,u),r)},reduceExportLocals(r,u){return s(super.reduceExportLocals(r,u),r)},reduceExpressionStatement(r,u){return s(super.reduceExpressionStatement(r,u),r)},reduceForAwaitStatement(r,u){return s(super.reduceForAwaitStatement(r,u),r)},reduceForInStatement(r,u){return s(super.reduceForInStatement(r,u),r)},reduceForOfStatement(r,u){return s(super.reduceForOfStatement(r,u),r)},reduceForStatement(r,u){return s(super.reduceForStatement(r,u),r)},reduceFormalParameters(r,u){return s(super.reduceFormalParameters(r,u),r)},reduceFunctionBody(r,u){return s(super.reduceFunctionBody(r,u),r)},reduceFunctionDeclaration(r,u){return s(super.reduceFunctionDeclaration(r,u),r)},reduceFunctionExpression(r,u){return s(super.reduceFunctionExpression(r,u),r)},reduceGetter(r,u){return s(super.reduceGetter(r,u),r)},reduceIdentifierExpression(r,u){return s(super.reduceIdentifierExpression(r,u),r)},reduceIfStatement(r,u){return s(super.reduceIfStatement(r,u),r)},reduceImport(r,u){return s(super.reduceImport(r,u),r)},reduceImportNamespace(r,u){return s(super.reduceImportNamespace(r,u),r)},reduceImportSpecifier(r,u){return s(super.reduceImportSpecifier(r,u),r)},reduceLabeledStatement(r,u){return s(super.reduceLabeledStatement(r,u),r)},reduceLiteralBooleanExpression(r,u){return s(super.reduceLiteralBooleanExpression(r,u),r)},reduceLiteralInfinityExpression(r,u){return s(super.reduceLiteralInfinityExpression(r,u),r)},reduceLiteralNullExpression(r,u){return s(super.reduceLiteralNullExpression(r,u),r)},reduceLiteralNumericExpression(r,u){return s(super.reduceLiteralNumericExpression(r,u),r)},reduceLiteralRegExpExpression(r,u){return s(super.reduceLiteralRegExpExpression(r,u),r)},reduceLiteralStringExpression(r,u){return s(super.reduceLiteralStringExpression(r,u),r)},reduceMethod(r,u){return s(super.reduceMethod(r,u),r)},reduceModule(r,u){return s(super.reduceModule(r,u),r)},reduceNewExpression(r,u){return s(super.reduceNewExpression(r,u),r)},reduceNewTargetExpression(r,u){return s(super.reduceNewTargetExpression(r,u),r)},reduceObjectAssignmentTarget(r,u){return s(super.reduceObjectAssignmentTarget(r,u),r)},reduceObjectBinding(r,u){return s(super.reduceObjectBinding(r,u),r)},reduceObjectExpression(r,u){return s(super.reduceObjectExpression(r,u),r)},reduceReturnStatement(r,u){return s(super.reduceReturnStatement(r,u),r)},reduceScript(r,u){return s(super.reduceScript(r,u),r)},reduceSetter(r,u){return s(super.reduceSetter(r,u),r)},reduceShorthandProperty(r,u){return s(super.reduceShorthandProperty(r,u),r)},reduceSpreadElement(r,u){return s(super.reduceSpreadElement(r,u),r)},reduceSpreadProperty(r,u){return s(super.reduceSpreadProperty(r,u),r)},reduceStaticMemberAssignmentTarget(r,u){return s(super.reduceStaticMemberAssignmentTarget(r,u),r)},reduceStaticMemberExpression(r,u){return s(super.reduceStaticMemberExpression(r,u),r)},reduceStaticPropertyName(r,u){return s(super.reduceStaticPropertyName(r,u),r)},reduceSuper(r,u){return s(super.reduceSuper(r,u),r)},reduceSwitchCase(r,u){return s(super.reduceSwitchCase(r,u),r)},reduceSwitchDefault(r,u){return s(super.reduceSwitchDefault(r,u),r)},reduceSwitchStatement(r,u){return s(super.reduceSwitchStatement(r,u),r)},reduceSwitchStatementWithDefault(r,u){return s(super.reduceSwitchStatementWithDefault(r,u),r)},reduceTemplateElement(r,u){return s(super.reduceTemplateElement(r,u),r)},reduceTemplateExpression(r,u){return s(super.reduceTemplateExpression(r,u),r)},reduceThisExpression(r,u){return s(super.reduceThisExpression(r,u),r)},reduceThrowStatement(r,u){return s(super.reduceThrowStatement(r,u),r)},reduceTryCatchStatement(r,u){return s(super.reduceTryCatchStatement(r,u),r)},reduceTryFinallyStatement(r,u){return s(super.reduceTryFinallyStatement(r,u),r)},reduceUnaryExpression(r,u){return s(super.reduceUnaryExpression(r,u),r)},reduceUpdateExpression(r,u){return s(super.reduceUpdateExpression(r,u),r)},reduceVariableDeclaration(r,u){return s(super.reduceVariableDeclaration(r,u),r)},reduceVariableDeclarationStatement(r,u){return s(super.reduceVariableDeclarationStatement(r,u),r)},reduceVariableDeclarator(r,u){return s(super.reduceVariableDeclarator(r,u),r)},reduceWhileStatement(r,u){return s(super.reduceWhileStatement(r,u),r)},reduceWithStatement(r,u){return s(super.reduceWithStatement(r,u),r)},reduceYieldExpression(r,u){return s(super.reduceYieldExpression(r,u),r)},reduceYieldGeneratorExpression(r,u){return s(super.reduceYieldGeneratorExpression(r,u),r)}}),reducers={};const MonoidalReducer$2=monoidalReducer,ThunkedMonoidalReducer$1=thunkedMonoidalReducer,PlusMonoid={empty:()=>0,concat:(s,e)=>s+e},ConcatMonoid={empty:()=>[],concat:(s,e)=>s.concat(e)},AndMonoid={empty:()=>!0,concat:(s,e)=>s&&e,concatThunk:(s,e)=>s&&e()},OrMonoid={empty:()=>!1,concat:(s,e)=>s||e,concatThunk:(s,e)=>s||e()};reducers.PlusReducer=class extends MonoidalReducer$2{constructor(){super(PlusMonoid)}};reducers.ThunkedPlusReducer=class extends ThunkedMonoidalReducer$1{constructor(){super(PlusMonoid)}};reducers.ConcatReducer=class extends MonoidalReducer$2{constructor(){super(ConcatMonoid)}};reducers.ThunkedConcatReducer=class extends ThunkedMonoidalReducer$1{constructor(){super(ConcatMonoid)}};reducers.AndReducer=class extends MonoidalReducer$2{constructor(){super(AndMonoid)}};reducers.ThunkedAndReducer=class extends ThunkedMonoidalReducer$1{constructor(){super(AndMonoid)}};reducers.OrReducer=class extends MonoidalReducer$2{constructor(){super(OrMonoid)}};reducers.ThunkedOrReducer=class extends ThunkedMonoidalReducer$1{constructor(){super(OrMonoid)}};const reduce$3=director_1,thunkedReduce=thunkedDirector,thunkify=thunkify$1,thunkifyClass=thunkifyClass$1,memoize=memoize$1,CloneReducer=cloneReducer,LazyCloneReducer=lazyCloneReducer,MonoidalReducer$1=monoidalReducer,ThunkedMonoidalReducer=thunkedMonoidalReducer,adapt$1=adapt$2,{PlusReducer,ThunkedPlusReducer,ConcatReducer,ThunkedConcatReducer,AndReducer,ThunkedAndReducer,OrReducer,ThunkedOrReducer}=reducers;var src$2={default:reduce$3,reduce:reduce$3,thunkedReduce,thunkify,thunkifyClass,memoize,CloneReducer,LazyCloneReducer,MonoidalReducer:MonoidalReducer$1,ThunkedMonoidalReducer,adapt:adapt$1,PlusReducer,ThunkedPlusReducer,ConcatReducer,ThunkedConcatReducer,AndReducer,ThunkedAndReducer,OrReducer,ThunkedOrReducer},multimap={exports:{}};(function(s,e){function r(i,n){for(var a=i.keys(),l;!(l=a.next()).done;)n(i.get(l.value),l.value,i)}var u=function(){var i;typeof Map<"u"&&(i=Map,Map.prototype.keys||(Map.prototype.keys=function(){var o=[];return this.forEach(function(c,A){o.push(A)}),o}));function n(o){var c=this;c._map=i,n.Map&&(c._map=n.Map),c._=c._map?new c._map:{},o&&o.forEach(function(A){c.set(A[0],A[1])})}n.prototype.get=function(o){return this._map?this._.get(o):this._[o]},n.prototype.set=function(o,c){var A=Array.prototype.slice.call(arguments);o=A.shift();var d=this.get(o);return d||(d=[],this._map?this._.set(o,d):this._[o]=d),Array.prototype.push.apply(d,A),this},n.prototype.delete=function(o,c){if(!this.has(o))return!1;if(arguments.length==1)return this._map?this._.delete(o):delete this._[o],!0;var A=this.get(o),d=A.indexOf(c);return d!=-1?(A.splice(d,1),!0):!1},n.prototype.has=function(o,c){var A=this._map?this._.has(o):this._.hasOwnProperty(o);if(arguments.length==1||!A)return A;var d=this.get(o)||[];return d.indexOf(c)!=-1},n.prototype.keys=function(){return this._map?l(this._.keys()):l(Object.keys(this._))},n.prototype.values=function(){var o=[];return this.forEachEntry(function(c){Array.prototype.push.apply(o,c)}),l(o)},n.prototype.forEachEntry=function(o){r(this,o)},n.prototype.forEach=function(o){var c=this;c.forEachEntry(function(A,d){A.forEach(function(m){o(m,d,c)})})},n.prototype.clear=function(){this._map?this._.clear():this._={}},Object.defineProperty(n.prototype,"size",{configurable:!1,enumerable:!0,get:function(){var o=0;return r(this,function(c){o+=c.length}),o}}),Object.defineProperty(n.prototype,"count",{configurable:!1,enumerable:!0,get:function(){return this._.size}});var a;try{a=new Function("iterator","makeIterator","var keysArray = []; for(var key of iterator){keysArray.push(key);} return makeIterator(keysArray).next;")}catch{}function l(o){if(Array.isArray(o)){var c=0;return{next:function(){return c{r.forEachEntry((u,i)=>{s.set.apply(s,[i].concat(u))})}),s}let identity;class EarlyErrorState$1{constructor(){this.errors=[],this.strictErrors=[],this.usedLabelNames=[],this.freeBreakStatements=[],this.freeContinueStatements=[],this.freeLabeledBreakStatements=[],this.freeLabeledContinueStatements=[],this.newTargetExpressions=[],this.boundNames=new MultiMap,this.lexicallyDeclaredNames=new MultiMap,this.functionDeclarationNames=new MultiMap,this.varDeclaredNames=new MultiMap,this.forOfVarDeclaredNames=[],this.exportedNames=new MultiMap,this.exportedBindings=new MultiMap,this.superCallExpressions=[],this.superCallExpressionsInConstructorMethod=[],this.superPropertyExpressions=[],this.yieldExpressions=[],this.awaitExpressions=[]}addFreeBreakStatement(e){return this.freeBreakStatements.push(e),this}addFreeLabeledBreakStatement(e){return this.freeLabeledBreakStatements.push(e),this}clearFreeBreakStatements(){return this.freeBreakStatements=[],this}addFreeContinueStatement(e){return this.freeContinueStatements.push(e),this}addFreeLabeledContinueStatement(e){return this.freeLabeledContinueStatements.push(e),this}clearFreeContinueStatements(){return this.freeContinueStatements=[],this}enforceFreeBreakStatementErrors(e){return[].push.apply(this.errors,this.freeBreakStatements.map(e)),this.freeBreakStatements=[],this}enforceFreeLabeledBreakStatementErrors(e){return[].push.apply(this.errors,this.freeLabeledBreakStatements.map(e)),this.freeLabeledBreakStatements=[],this}enforceFreeContinueStatementErrors(e){return[].push.apply(this.errors,this.freeContinueStatements.map(e)),this.freeContinueStatements=[],this}enforceFreeLabeledContinueStatementErrors(e){return[].push.apply(this.errors,this.freeLabeledContinueStatements.map(e)),this.freeLabeledContinueStatements=[],this}observeIterationLabel(e){return this.usedLabelNames.push(e),this.freeLabeledBreakStatements=this.freeLabeledBreakStatements.filter(r=>r.label!==e),this.freeLabeledContinueStatements=this.freeLabeledContinueStatements.filter(r=>r.label!==e),this}observeNonIterationLabel(e){return this.usedLabelNames.push(e),this.freeLabeledBreakStatements=this.freeLabeledBreakStatements.filter(r=>r.label!==e),this}clearUsedLabelNames(){return this.usedLabelNames=[],this}observeSuperCallExpression(e){return this.superCallExpressions.push(e),this}observeConstructorMethod(){return this.superCallExpressionsInConstructorMethod=this.superCallExpressions,this.superCallExpressions=[],this}clearSuperCallExpressionsInConstructorMethod(){return this.superCallExpressionsInConstructorMethod=[],this}enforceSuperCallExpressions(e){return[].push.apply(this.errors,this.superCallExpressions.map(e)),[].push.apply(this.errors,this.superCallExpressionsInConstructorMethod.map(e)),this.superCallExpressions=[],this.superCallExpressionsInConstructorMethod=[],this}enforceSuperCallExpressionsInConstructorMethod(e){return[].push.apply(this.errors,this.superCallExpressionsInConstructorMethod.map(e)),this.superCallExpressionsInConstructorMethod=[],this}observeSuperPropertyExpression(e){return this.superPropertyExpressions.push(e),this}clearSuperPropertyExpressions(){return this.superPropertyExpressions=[],this}enforceSuperPropertyExpressions(e){return[].push.apply(this.errors,this.superPropertyExpressions.map(e)),this.superPropertyExpressions=[],this}observeNewTargetExpression(e){return this.newTargetExpressions.push(e),this}clearNewTargetExpressions(){return this.newTargetExpressions=[],this}bindName(e,r){return this.boundNames.set(e,r),this}clearBoundNames(){return this.boundNames=new MultiMap,this}observeLexicalDeclaration(){return addEach(this.lexicallyDeclaredNames,this.boundNames),this.boundNames=new MultiMap,this}observeLexicalBoundary(){return this.previousLexicallyDeclaredNames=this.lexicallyDeclaredNames,this.lexicallyDeclaredNames=new MultiMap,this.functionDeclarationNames=new MultiMap,this}enforceDuplicateLexicallyDeclaredNames(e){return this.lexicallyDeclaredNames.forEachEntry(r=>{r.length>1&&r.slice(1).forEach(u=>{this.addError(e(u))})}),this}enforceConflictingLexicallyDeclaredNames(e,r){return this.lexicallyDeclaredNames.forEachEntry((u,i)=>{e.has(i)&&u.forEach(n=>{this.addError(r(n))})}),this}observeFunctionDeclaration(){return this.observeVarBoundary(),addEach(this.functionDeclarationNames,this.boundNames),this.boundNames=new MultiMap,this}functionDeclarationNamesAreLexical(){return addEach(this.lexicallyDeclaredNames,this.functionDeclarationNames),this.functionDeclarationNames=new MultiMap,this}observeVarDeclaration(){return addEach(this.varDeclaredNames,this.boundNames),this.boundNames=new MultiMap,this}recordForOfVars(){return this.varDeclaredNames.forEach(e=>{this.forOfVarDeclaredNames.push(e)}),this}observeVarBoundary(){return this.lexicallyDeclaredNames=new MultiMap,this.functionDeclarationNames=new MultiMap,this.varDeclaredNames=new MultiMap,this.forOfVarDeclaredNames=[],this}exportName(e,r){return this.exportedNames.set(e,r),this}exportDeclaredNames(){return addEach(this.exportedNames,this.lexicallyDeclaredNames,this.varDeclaredNames),addEach(this.exportedBindings,this.lexicallyDeclaredNames,this.varDeclaredNames),this}exportBinding(e,r){return this.exportedBindings.set(e,r),this}clearExportedBindings(){return this.exportedBindings=new MultiMap,this}observeYieldExpression(e){return this.yieldExpressions.push(e),this}clearYieldExpressions(){return this.yieldExpressions=[],this}observeAwaitExpression(e){return this.awaitExpressions.push(e),this}clearAwaitExpressions(){return this.awaitExpressions=[],this}addError(e){return this.errors.push(e),this}addStrictError(e){return this.strictErrors.push(e),this}enforceStrictErrors(){return[].push.apply(this.errors,this.strictErrors),this.strictErrors=[],this}static empty(){return identity}concat(e){return this===identity?e:e===identity?this:([].push.apply(this.errors,e.errors),[].push.apply(this.strictErrors,e.strictErrors),[].push.apply(this.usedLabelNames,e.usedLabelNames),[].push.apply(this.freeBreakStatements,e.freeBreakStatements),[].push.apply(this.freeContinueStatements,e.freeContinueStatements),[].push.apply(this.freeLabeledBreakStatements,e.freeLabeledBreakStatements),[].push.apply(this.freeLabeledContinueStatements,e.freeLabeledContinueStatements),[].push.apply(this.newTargetExpressions,e.newTargetExpressions),addEach(this.boundNames,e.boundNames),addEach(this.lexicallyDeclaredNames,e.lexicallyDeclaredNames),addEach(this.functionDeclarationNames,e.functionDeclarationNames),addEach(this.varDeclaredNames,e.varDeclaredNames),[].push.apply(this.forOfVarDeclaredNames,e.forOfVarDeclaredNames),addEach(this.exportedNames,e.exportedNames),addEach(this.exportedBindings,e.exportedBindings),[].push.apply(this.superCallExpressions,e.superCallExpressions),[].push.apply(this.superCallExpressionsInConstructorMethod,e.superCallExpressionsInConstructorMethod),[].push.apply(this.superPropertyExpressions,e.superPropertyExpressions),[].push.apply(this.yieldExpressions,e.yieldExpressions),[].push.apply(this.awaitExpressions,e.awaitExpressions),this)}}identity=new EarlyErrorState$1;Object.getOwnPropertyNames(EarlyErrorState$1.prototype).forEach(s=>{s!=="constructor"&&Object.defineProperty(identity,s,{value(){return EarlyErrorState$1.prototype[s].apply(new EarlyErrorState$1,arguments)},enumerable:!1,writable:!0,configurable:!0})});class EarlyError$1 extends Error{constructor(e,r){super(r),this.node=e,this.message=r}}var earlyErrorState={EarlyErrorState:EarlyErrorState$1,EarlyError:EarlyError$1};const{reduce:reduce$2,MonoidalReducer}=src$2,{isStrictModeReservedWord}=utils$1,{ErrorMessages}=errors,{EarlyErrorState,EarlyError}=earlyErrorState;function isStrictFunctionBody({directives:s}){return s.some(e=>e.rawValue==="use strict")}function isLabelledFunction(s){return s.type==="LabeledStatement"&&(s.body.type==="FunctionDeclaration"||isLabelledFunction(s.body))}function isIterationStatement(s){switch(s.type){case"LabeledStatement":return isIterationStatement(s.body);case"DoWhileStatement":case"ForInStatement":case"ForOfStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function isSpecialMethod(s){if(s.name.type!=="StaticPropertyName"||s.name.value!=="constructor")return!1;switch(s.type){case"Getter":case"Setter":return!0;case"Method":return s.isGenerator||s.isAsync}throw new Error("not reached")}function enforceDuplicateConstructorMethods(s,e){let r=s.elements.filter(u=>!u.isStatic&&u.method.type==="Method"&&!u.method.isGenerator&&u.method.name.type==="StaticPropertyName"&&u.method.name.value==="constructor");return r.length>1&&r.slice(1).forEach(u=>{e=e.addError(new EarlyError(u,"Duplicate constructor method in class"))}),e}const SUPERCALL_ERROR=s=>new EarlyError(s,ErrorMessages.ILLEGAL_SUPER_CALL),SUPERPROPERTY_ERROR=s=>new EarlyError(s,"Member access on super must be in a method"),DUPLICATE_BINDING=s=>new EarlyError(s,`Duplicate binding ${JSON.stringify(s.name)}`),FREE_CONTINUE=s=>new EarlyError(s,"Continue statement must be nested within an iteration statement"),UNBOUND_CONTINUE=s=>new EarlyError(s,`Continue statement must be nested within an iteration statement with label ${JSON.stringify(s.label)}`),FREE_BREAK=s=>new EarlyError(s,"Break statement must be nested within an iteration statement or a switch statement"),UNBOUND_BREAK=s=>new EarlyError(s,`Break statement must be nested within a statement with label ${JSON.stringify(s.label)}`);class EarlyErrorChecker$1 extends MonoidalReducer{constructor(){super(EarlyErrorState)}reduceAssignmentExpression(){return super.reduceAssignmentExpression(...arguments).clearBoundNames()}reduceAssignmentTargetIdentifier(e){let r=this.identity;return(e.name==="eval"||e.name==="arguments"||isStrictModeReservedWord(e.name))&&(r=r.addStrictError(new EarlyError(e,`The identifier ${JSON.stringify(e.name)} must not be in binding position in strict mode`))),r}reduceArrowExpression(e,{params:r,body:u}){let i=e.params.rest==null&&e.params.items.every(a=>a.type==="BindingIdentifier");r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),e.body.type==="FunctionBody"&&(u=u.enforceConflictingLexicallyDeclaredNames(r.lexicallyDeclaredNames,DUPLICATE_BINDING),isStrictFunctionBody(e.body)&&(r=r.enforceStrictErrors(),u=u.enforceStrictErrors())),r.yieldExpressions.forEach(a=>{r=r.addError(new EarlyError(a,"Arrow parameters must not contain yield expressions"))}),r.awaitExpressions.forEach(a=>{r=r.addError(new EarlyError(a,"Arrow parameters must not contain await expressions"))});let n=super.reduceArrowExpression(e,{params:r,body:u});return!i&&e.body.type==="FunctionBody"&&isStrictFunctionBody(e.body)&&(n=n.addError(new EarlyError(e,'Functions with non-simple parameter lists may not contain a "use strict" directive'))),n=n.clearYieldExpressions(),n=n.clearAwaitExpressions(),n=n.observeVarBoundary(),n}reduceAwaitExpression(e,{expression:r}){return r.observeAwaitExpression(e)}reduceBindingIdentifier(e){let r=this.identity;return(e.name==="eval"||e.name==="arguments"||isStrictModeReservedWord(e.name))&&(r=r.addStrictError(new EarlyError(e,`The identifier ${JSON.stringify(e.name)} must not be in binding position in strict mode`))),r=r.bindName(e.name,e),r}reduceBlock(){let e=super.reduceBlock(...arguments);return e=e.functionDeclarationNamesAreLexical(),e=e.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),e=e.enforceConflictingLexicallyDeclaredNames(e.varDeclaredNames,DUPLICATE_BINDING),e=e.observeLexicalBoundary(),e}reduceBreakStatement(e){let r=super.reduceBreakStatement(...arguments);return r=e.label==null?r.addFreeBreakStatement(e):r.addFreeLabeledBreakStatement(e),r}reduceCallExpression(e){let r=super.reduceCallExpression(...arguments);return e.callee.type==="Super"&&(r=r.observeSuperCallExpression(e)),r}reduceCatchClause(e,{binding:r,body:u}){r!=null&&(r=r.observeLexicalDeclaration(),r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),r=r.enforceConflictingLexicallyDeclaredNames(u.previousLexicallyDeclaredNames,DUPLICATE_BINDING));let i=super.reduceCatchClause(e,{binding:r,body:u});return i=i.observeLexicalBoundary(),i}reduceClassDeclaration(e,{name:r,super:u,elements:i}){let n=r.enforceStrictErrors(),a=this.append(...i);return a=a.enforceStrictErrors(),e.super!=null&&(u=u.enforceStrictErrors(),n=this.append(n,u),a=a.clearSuperCallExpressionsInConstructorMethod()),n=this.append(n,a),n=enforceDuplicateConstructorMethods(e,n),n=n.observeLexicalDeclaration(),n}reduceClassElement(e){let r=super.reduceClassElement(...arguments);return!e.isStatic&&isSpecialMethod(e.method)&&(r=r.addError(new EarlyError(e,ErrorMessages.ILLEGAL_CONSTRUCTORS))),e.isStatic&&e.method.name.type==="StaticPropertyName"&&e.method.name.value==="prototype"&&(r=r.addError(new EarlyError(e,'Static class methods cannot be named "prototype"'))),r}reduceClassExpression(e,{name:r,super:u,elements:i}){let n=e.name==null?this.identity:r.enforceStrictErrors(),a=this.append(...i);return a=a.enforceStrictErrors(),e.super!=null&&(u=u.enforceStrictErrors(),n=this.append(n,u),a=a.clearSuperCallExpressionsInConstructorMethod()),n=this.append(n,a),n=enforceDuplicateConstructorMethods(e,n),n=n.clearBoundNames(),n}reduceCompoundAssignmentExpression(){return super.reduceCompoundAssignmentExpression(...arguments).clearBoundNames()}reduceComputedMemberExpression(e){let r=super.reduceComputedMemberExpression(...arguments);return e.object.type==="Super"&&(r=r.observeSuperPropertyExpression(e)),r}reduceContinueStatement(e){let r=super.reduceContinueStatement(...arguments);return r=e.label==null?r.addFreeContinueStatement(e):r.addFreeLabeledContinueStatement(e),r}reduceDoWhileStatement(e){let r=super.reduceDoWhileStatement(...arguments);return isLabelledFunction(e.body)&&(r=r.addError(new EarlyError(e.body,"The body of a do-while statement must not be a labeled function declaration"))),r=r.clearFreeContinueStatements(),r=r.clearFreeBreakStatements(),r}reduceExport(){let e=super.reduceExport(...arguments);return e=e.functionDeclarationNamesAreLexical(),e=e.exportDeclaredNames(),e}reduceExportFrom(){let e=super.reduceExportFrom(...arguments);return e=e.clearExportedBindings(),e}reduceExportFromSpecifier(e){let r=super.reduceExportFromSpecifier(...arguments);return r=r.exportName(e.exportedName||e.name,e),r=r.exportBinding(e.name,e),r}reduceExportLocalSpecifier(e){let r=super.reduceExportLocalSpecifier(...arguments);return r=r.exportName(e.exportedName||e.name.name,e),r=r.exportBinding(e.name.name,e),r}reduceExportDefault(e){let r=super.reduceExportDefault(...arguments);return r=r.functionDeclarationNamesAreLexical(),r=r.exportName("default",e),r}reduceFormalParameters(){let e=super.reduceFormalParameters(...arguments);return e=e.observeLexicalDeclaration(),e}reduceForStatement(e,{init:r,test:u,update:i,body:n}){r!=null&&(r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),r=r.enforceConflictingLexicallyDeclaredNames(n.varDeclaredNames,DUPLICATE_BINDING));let a=super.reduceForStatement(e,{init:r,test:u,update:i,body:n});return e.init!=null&&e.init.type==="VariableDeclaration"&&e.init.kind==="const"&&e.init.declarators.forEach(l=>{l.init==null&&(a=a.addError(new EarlyError(l,"Constant lexical declarations must have an initialiser")))}),isLabelledFunction(e.body)&&(a=a.addError(new EarlyError(e.body,"The body of a for statement must not be a labeled function declaration"))),a=a.clearFreeContinueStatements(),a=a.clearFreeBreakStatements(),a=a.observeLexicalBoundary(),a}reduceForInStatement(e,{left:r,right:u,body:i}){r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),r=r.enforceConflictingLexicallyDeclaredNames(i.varDeclaredNames,DUPLICATE_BINDING);let n=super.reduceForInStatement(e,{left:r,right:u,body:i});return isLabelledFunction(e.body)&&(n=n.addError(new EarlyError(e.body,"The body of a for-in statement must not be a labeled function declaration"))),n=n.clearFreeContinueStatements(),n=n.clearFreeBreakStatements(),n=n.observeLexicalBoundary(),n}reduceForOfStatement(e,{left:r,right:u,body:i}){r=r.recordForOfVars(),r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),r=r.enforceConflictingLexicallyDeclaredNames(i.varDeclaredNames,DUPLICATE_BINDING);let n=super.reduceForOfStatement(e,{left:r,right:u,body:i});return isLabelledFunction(e.body)&&(n=n.addError(new EarlyError(e.body,"The body of a for-of statement must not be a labeled function declaration"))),n=n.clearFreeContinueStatements(),n=n.clearFreeBreakStatements(),n=n.observeLexicalBoundary(),n}reduceForAwaitStatement(e,{left:r,right:u,body:i}){r=r.recordForOfVars(),r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),r=r.enforceConflictingLexicallyDeclaredNames(i.varDeclaredNames,DUPLICATE_BINDING);let n=super.reduceForOfStatement(e,{left:r,right:u,body:i});return isLabelledFunction(e.body)&&(n=n.addError(new EarlyError(e.body,"The body of a for-await statement must not be a labeled function declaration"))),n=n.clearFreeContinueStatements(),n=n.clearFreeBreakStatements(),n=n.observeLexicalBoundary(),n}reduceFunctionBody(e){let r=super.reduceFunctionBody(...arguments);return r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),r=r.enforceConflictingLexicallyDeclaredNames(r.varDeclaredNames,DUPLICATE_BINDING),r=r.enforceFreeContinueStatementErrors(FREE_CONTINUE),r=r.enforceFreeLabeledContinueStatementErrors(UNBOUND_CONTINUE),r=r.enforceFreeBreakStatementErrors(FREE_BREAK),r=r.enforceFreeLabeledBreakStatementErrors(UNBOUND_BREAK),r=r.clearUsedLabelNames(),r=r.clearYieldExpressions(),r=r.clearAwaitExpressions(),isStrictFunctionBody(e)&&(r=r.enforceStrictErrors()),r}reduceFunctionDeclaration(e,{name:r,params:u,body:i}){let n=e.params.rest==null&&e.params.items.every(o=>o.type==="BindingIdentifier"),a=!n||e.isGenerator?"addError":"addStrictError";u.lexicallyDeclaredNames.forEachEntry(o=>{o.length>1&&o.slice(1).forEach(c=>{u=u[a](DUPLICATE_BINDING(c))})}),i=i.enforceConflictingLexicallyDeclaredNames(u.lexicallyDeclaredNames,DUPLICATE_BINDING),i=i.enforceSuperCallExpressions(SUPERCALL_ERROR),i=i.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR),u=u.enforceSuperCallExpressions(SUPERCALL_ERROR),u=u.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR),e.isGenerator&&u.yieldExpressions.forEach(o=>{u=u.addError(new EarlyError(o,"Generator parameters must not contain yield expressions"))}),e.isAsync&&u.awaitExpressions.forEach(o=>{u=u.addError(new EarlyError(o,"Async function parameters must not contain await expressions"))}),u=u.clearNewTargetExpressions(),i=i.clearNewTargetExpressions(),isStrictFunctionBody(e.body)&&(u=u.enforceStrictErrors(),i=i.enforceStrictErrors());let l=super.reduceFunctionDeclaration(e,{name:r,params:u,body:i});return!n&&isStrictFunctionBody(e.body)&&(l=l.addError(new EarlyError(e,'Functions with non-simple parameter lists may not contain a "use strict" directive'))),l=l.clearYieldExpressions(),l=l.clearAwaitExpressions(),l=l.observeFunctionDeclaration(),l}reduceFunctionExpression(e,{name:r,params:u,body:i}){let n=e.params.rest==null&&e.params.items.every(o=>o.type==="BindingIdentifier"),a=!n||e.isGenerator?"addError":"addStrictError";u.lexicallyDeclaredNames.forEachEntry((o,c)=>{o.length>1&&o.slice(1).forEach(A=>{u=u[a](new EarlyError(A,`Duplicate binding ${JSON.stringify(c)}`))})}),i=i.enforceConflictingLexicallyDeclaredNames(u.lexicallyDeclaredNames,DUPLICATE_BINDING),i=i.enforceSuperCallExpressions(SUPERCALL_ERROR),i=i.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR),u=u.enforceSuperCallExpressions(SUPERCALL_ERROR),u=u.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR),e.isGenerator&&u.yieldExpressions.forEach(o=>{u=u.addError(new EarlyError(o,"Generator parameters must not contain yield expressions"))}),e.isAsync&&u.awaitExpressions.forEach(o=>{u=u.addError(new EarlyError(o,"Async function parameters must not contain await expressions"))}),u=u.clearNewTargetExpressions(),i=i.clearNewTargetExpressions(),isStrictFunctionBody(e.body)&&(u=u.enforceStrictErrors(),i=i.enforceStrictErrors());let l=super.reduceFunctionExpression(e,{name:r,params:u,body:i});return!n&&isStrictFunctionBody(e.body)&&(l=l.addError(new EarlyError(e,'Functions with non-simple parameter lists may not contain a "use strict" directive'))),l=l.clearBoundNames(),l=l.clearYieldExpressions(),l=l.clearAwaitExpressions(),l=l.observeVarBoundary(),l}reduceGetter(e,{name:r,body:u}){u=u.enforceSuperCallExpressions(SUPERCALL_ERROR),u=u.clearSuperPropertyExpressions(),u=u.clearNewTargetExpressions(),isStrictFunctionBody(e.body)&&(u=u.enforceStrictErrors());let i=super.reduceGetter(e,{name:r,body:u});return i=i.observeVarBoundary(),i}reduceIdentifierExpression(e){let r=this.identity;return isStrictModeReservedWord(e.name)&&(r=r.addStrictError(new EarlyError(e,`The identifier ${JSON.stringify(e.name)} must not be in expression position in strict mode`))),r}reduceIfStatement(e,{test:r,consequent:u,alternate:i}){return isLabelledFunction(e.consequent)&&(u=u.addError(new EarlyError(e.consequent,"The consequent of an if statement must not be a labeled function declaration"))),e.alternate!=null&&isLabelledFunction(e.alternate)&&(i=i.addError(new EarlyError(e.alternate,"The alternate of an if statement must not be a labeled function declaration"))),e.consequent.type==="FunctionDeclaration"&&(u=u.addStrictError(new EarlyError(e.consequent,"FunctionDeclarations in IfStatements are disallowed in strict mode")),u=u.observeLexicalBoundary()),e.alternate!=null&&e.alternate.type==="FunctionDeclaration"&&(i=i.addStrictError(new EarlyError(e.alternate,"FunctionDeclarations in IfStatements are disallowed in strict mode")),i=i.observeLexicalBoundary()),super.reduceIfStatement(e,{test:r,consequent:u,alternate:i})}reduceImport(){let e=super.reduceImport(...arguments);return e=e.observeLexicalDeclaration(),e}reduceImportNamespace(){let e=super.reduceImportNamespace(...arguments);return e=e.observeLexicalDeclaration(),e}reduceLabeledStatement(e){let r=super.reduceLabeledStatement(...arguments);return(e.label==="yield"||isStrictModeReservedWord(e.label))&&(r=r.addStrictError(new EarlyError(e,`The identifier ${JSON.stringify(e.label)} must not be in label position in strict mode`))),r.usedLabelNames.indexOf(e.label)>=0&&(r=r.addError(new EarlyError(e,`Label ${JSON.stringify(e.label)} has already been declared`))),e.body.type==="FunctionDeclaration"&&(r=r.addStrictError(new EarlyError(e,"Labeled FunctionDeclarations are disallowed in strict mode"))),r=isIterationStatement(e.body)?r.observeIterationLabel(e.label):r.observeNonIterationLabel(e.label),r}reduceLiteralRegExpExpression(){return this.identity}reduceMethod(e,{name:r,params:u,body:i}){let n=e.params.rest==null&&e.params.items.every(l=>l.type==="BindingIdentifier");u=u.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),i=i.enforceConflictingLexicallyDeclaredNames(u.lexicallyDeclaredNames,DUPLICATE_BINDING),e.name.type==="StaticPropertyName"&&e.name.value==="constructor"?(i=i.observeConstructorMethod(),u=u.observeConstructorMethod()):(i=i.enforceSuperCallExpressions(SUPERCALL_ERROR),u=u.enforceSuperCallExpressions(SUPERCALL_ERROR)),e.isGenerator&&u.yieldExpressions.forEach(l=>{u=u.addError(new EarlyError(l,"Generator parameters must not contain yield expressions"))}),e.isAsync&&u.awaitExpressions.forEach(l=>{u=u.addError(new EarlyError(l,"Async function parameters must not contain await expressions"))}),i=i.clearSuperPropertyExpressions(),u=u.clearSuperPropertyExpressions(),u=u.clearNewTargetExpressions(),i=i.clearNewTargetExpressions(),isStrictFunctionBody(e.body)&&(u=u.enforceStrictErrors(),i=i.enforceStrictErrors());let a=super.reduceMethod(e,{name:r,params:u,body:i});return!n&&isStrictFunctionBody(e.body)&&(a=a.addError(new EarlyError(e,'Functions with non-simple parameter lists may not contain a "use strict" directive'))),a=a.clearYieldExpressions(),a=a.clearAwaitExpressions(),a=a.observeVarBoundary(),a}reduceModule(){let e=super.reduceModule(...arguments);return e=e.functionDeclarationNamesAreLexical(),e=e.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),e=e.enforceConflictingLexicallyDeclaredNames(e.varDeclaredNames,DUPLICATE_BINDING),e.exportedNames.forEachEntry((r,u)=>{r.length>1&&r.slice(1).forEach(i=>{e=e.addError(new EarlyError(i,`Duplicate export ${JSON.stringify(u)}`))})}),e.exportedBindings.forEachEntry((r,u)=>{!e.lexicallyDeclaredNames.has(u)&&!e.varDeclaredNames.has(u)&&r.forEach(i=>{e=e.addError(new EarlyError(i,`Exported binding ${JSON.stringify(u)} is not declared`))})}),e.newTargetExpressions.forEach(r=>{e=e.addError(new EarlyError(r,"new.target must be within function (but not arrow expression) code"))}),e=e.enforceFreeContinueStatementErrors(FREE_CONTINUE),e=e.enforceFreeLabeledContinueStatementErrors(UNBOUND_CONTINUE),e=e.enforceFreeBreakStatementErrors(FREE_BREAK),e=e.enforceFreeLabeledBreakStatementErrors(UNBOUND_BREAK),e=e.enforceSuperCallExpressions(SUPERCALL_ERROR),e=e.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR),e=e.enforceStrictErrors(),e}reduceNewTargetExpression(e){return this.identity.observeNewTargetExpression(e)}reduceObjectExpression(e){let r=super.reduceObjectExpression(...arguments);return r=r.enforceSuperCallExpressionsInConstructorMethod(SUPERCALL_ERROR),e.properties.filter(i=>i.type==="DataProperty"&&i.name.type==="StaticPropertyName"&&i.name.value==="__proto__").slice(1).forEach(i=>{r=r.addError(new EarlyError(i,"Duplicate __proto__ property in object literal not allowed"))}),r}reduceUpdateExpression(){let e=super.reduceUpdateExpression(...arguments);return e=e.clearBoundNames(),e}reduceUnaryExpression(e){let r=super.reduceUnaryExpression(...arguments);return e.operator==="delete"&&e.operand.type==="IdentifierExpression"&&(r=r.addStrictError(new EarlyError(e,"Identifier expressions must not be deleted in strict mode"))),r}reduceScript(e){let r=super.reduceScript(...arguments);return r=r.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),r=r.enforceConflictingLexicallyDeclaredNames(r.varDeclaredNames,DUPLICATE_BINDING),r.newTargetExpressions.forEach(u=>{r=r.addError(new EarlyError(u,"new.target must be within function (but not arrow expression) code"))}),r=r.enforceFreeContinueStatementErrors(FREE_CONTINUE),r=r.enforceFreeLabeledContinueStatementErrors(UNBOUND_CONTINUE),r=r.enforceFreeBreakStatementErrors(FREE_BREAK),r=r.enforceFreeLabeledBreakStatementErrors(UNBOUND_BREAK),r=r.enforceSuperCallExpressions(SUPERCALL_ERROR),r=r.enforceSuperPropertyExpressions(SUPERPROPERTY_ERROR),isStrictFunctionBody(e)&&(r=r.enforceStrictErrors()),r}reduceSetter(e,{name:r,param:u,body:i}){let n=e.param.type==="BindingIdentifier";u=u.observeLexicalDeclaration(),u=u.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),i=i.enforceConflictingLexicallyDeclaredNames(u.lexicallyDeclaredNames,DUPLICATE_BINDING),u=u.enforceSuperCallExpressions(SUPERCALL_ERROR),i=i.enforceSuperCallExpressions(SUPERCALL_ERROR),u=u.clearSuperPropertyExpressions(),i=i.clearSuperPropertyExpressions(),u=u.clearNewTargetExpressions(),i=i.clearNewTargetExpressions(),isStrictFunctionBody(e.body)&&(u=u.enforceStrictErrors(),i=i.enforceStrictErrors());let a=super.reduceSetter(e,{name:r,param:u,body:i});return!n&&isStrictFunctionBody(e.body)&&(a=a.addError(new EarlyError(e,'Functions with non-simple parameter lists may not contain a "use strict" directive'))),a=a.observeVarBoundary(),a}reduceStaticMemberExpression(e){let r=super.reduceStaticMemberExpression(...arguments);return e.object.type==="Super"&&(r=r.observeSuperPropertyExpression(e)),r}reduceSwitchStatement(e,{discriminant:r,cases:u}){let i=this.append(...u);i=i.functionDeclarationNamesAreLexical(),i=i.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),i=i.enforceConflictingLexicallyDeclaredNames(i.varDeclaredNames,DUPLICATE_BINDING),i=i.observeLexicalBoundary();let n=this.append(r,i);return n=n.clearFreeBreakStatements(),n}reduceSwitchStatementWithDefault(e,{discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n}){let a=this.append(i,...u,...n);a=a.functionDeclarationNamesAreLexical(),a=a.enforceDuplicateLexicallyDeclaredNames(DUPLICATE_BINDING),a=a.enforceConflictingLexicallyDeclaredNames(a.varDeclaredNames,DUPLICATE_BINDING),a=a.observeLexicalBoundary();let l=this.append(r,a);return l=l.clearFreeBreakStatements(),l}reduceVariableDeclaration(e){let r=super.reduceVariableDeclaration(...arguments);switch(e.kind){case"const":case"let":{r=r.observeLexicalDeclaration(),r.lexicallyDeclaredNames.has("let")&&r.lexicallyDeclaredNames.get("let").forEach(u=>{r=r.addError(new EarlyError(u,'Lexical declarations must not have a binding named "let"'))});break}case"var":r=r.observeVarDeclaration();break}return r}reduceVariableDeclarationStatement(e){let r=super.reduceVariableDeclarationStatement(...arguments);return e.declaration.kind==="const"&&e.declaration.declarators.forEach(u=>{u.init==null&&(r=r.addError(new EarlyError(u,"Constant lexical declarations must have an initialiser")))}),r}reduceWhileStatement(e){let r=super.reduceWhileStatement(...arguments);return isLabelledFunction(e.body)&&(r=r.addError(new EarlyError(e.body,"The body of a while statement must not be a labeled function declaration"))),r=r.clearFreeContinueStatements().clearFreeBreakStatements(),r}reduceWithStatement(e){let r=super.reduceWithStatement(...arguments);return isLabelledFunction(e.body)&&(r=r.addError(new EarlyError(e.body,"The body of a with statement must not be a labeled function declaration"))),r=r.addStrictError(new EarlyError(e,"Strict mode code must not include a with statement")),r}reduceYieldExpression(e){let r=super.reduceYieldExpression(...arguments);return r=r.observeYieldExpression(e),r}reduceYieldGeneratorExpression(e){let r=super.reduceYieldGeneratorExpression(...arguments);return r=r.observeYieldExpression(e),r}static check(e){return reduce$2(new EarlyErrorChecker$1,e).errors}}var earlyErrors={EarlyErrorChecker:EarlyErrorChecker$1};const{GenericParser}=parser,{JsError}=tokenizer,{EarlyErrorChecker}=earlyErrors,{isLineTerminator}=utils$1,{Tokenizer,TokenClass,TokenType}=tokenizer;class ParserWithLocation extends GenericParser{constructor(e){super(e),this.locations=new WeakMap,this.comments=[]}startNode(){return this.getLocation()}finishNode(e,r){if(e.type==="Script"||e.type==="Module")return this.locations.set(e,{start:{line:1,column:0,offset:0},end:this.getLocation()}),e;if(e.type==="TemplateExpression")for(let u=0;u0)throw new JsError(0,1,0,a[0].message)}return n}}function generateInterfaceWithLocation(s){return function(r,{earlyErrors:u=!0}={}){let i=new ParserWithLocation(r),n=i[s]();if(u){let a=EarlyErrorChecker.check(n);if(a.length>0){let{node:l,message:o}=a[0],{offset:c,line:A,column:d}=i.locations.get(l).start;throw new JsError(c,A,d,o)}}return{tree:n,locations:i.locations,comments:i.comments}}}const parseScript=generateInterface("parseScript"),parseModule=generateInterface("parseModule"),parseModuleWithLocation=generateInterfaceWithLocation("parseModule"),parseScriptWithLocation=generateInterfaceWithLocation("parseScript");var src$1={default:parseScript,parseScript,parseModule,parseModuleWithLocation,parseScriptWithLocation,EarlyErrorChecker,GenericParser,ParserWithLocation,Tokenizer,TokenClass,TokenType},dist=function(){var s={},e={typeName:"Boolean"},r={typeName:"Number"},u={typeName:"String"};function i(Fe){return{typeName:"Maybe",argument:Fe}}function n(Fe){return{typeName:"List",argument:Fe}}function a(Fe){return{typeName:"Const",argument:Fe}}function l(){return{typeName:"Union",arguments:[].slice.call(arguments,0)}}var o={typeName:"Enum",values:["ArrayAssignmentTarget","ArrayBinding","ArrayExpression","ArrowExpression","AssignmentExpression","AssignmentTargetIdentifier","AssignmentTargetPropertyIdentifier","AssignmentTargetPropertyProperty","AssignmentTargetWithDefault","AwaitExpression","BinaryExpression","BindingIdentifier","BindingPropertyIdentifier","BindingPropertyProperty","BindingWithDefault","Block","BlockStatement","BreakStatement","CallExpression","CatchClause","ClassDeclaration","ClassElement","ClassExpression","CompoundAssignmentExpression","ComputedMemberAssignmentTarget","ComputedMemberExpression","ComputedPropertyName","ConditionalExpression","ContinueStatement","DataProperty","DebuggerStatement","Directive","DoWhileStatement","EmptyStatement","Export","ExportAllFrom","ExportDefault","ExportFrom","ExportFromSpecifier","ExportLocalSpecifier","ExportLocals","ExpressionStatement","ForAwaitStatement","ForInStatement","ForOfStatement","ForStatement","FormalParameters","FunctionBody","FunctionDeclaration","FunctionExpression","Getter","IdentifierExpression","IfStatement","Import","ImportNamespace","ImportSpecifier","LabeledStatement","LiteralBooleanExpression","LiteralInfinityExpression","LiteralNullExpression","LiteralNumericExpression","LiteralRegExpExpression","LiteralStringExpression","Method","Module","NewExpression","NewTargetExpression","ObjectAssignmentTarget","ObjectBinding","ObjectExpression","ReturnStatement","Script","Setter","ShorthandProperty","SpreadElement","SpreadProperty","StaticMemberAssignmentTarget","StaticMemberExpression","StaticPropertyName","Super","SwitchCase","SwitchDefault","SwitchStatement","SwitchStatementWithDefault","TemplateElement","TemplateExpression","ThisExpression","ThrowStatement","TryCatchStatement","TryFinallyStatement","UnaryExpression","UpdateExpression","VariableDeclaration","VariableDeclarationStatement","VariableDeclarator","WhileStatement","WithStatement","YieldExpression","YieldGeneratorExpression"]},c={typeName:"Enum",values:["==","!=","===","!==","<","<=",">",">=","in","instanceof","<<",">>",">>>","+","-","*","/","%","**",",","||","&&","|","^","&"]},A={typeName:"Enum",values:["+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","|=","^=","&="]},d={typeName:"Enum",values:["+","-","!","~","typeof","void","delete"]},m={typeName:"Enum",values:["++","--"]},f={typeName:"Enum",values:["var","let","const"]},E=s.ArrayAssignmentTarget={},D=s.ArrayBinding={},h=s.ArrayExpression={},y=s.ArrowExpression={},_=s.AssignmentExpression={},b=s.AssignmentTargetIdentifier={},P=s.AssignmentTargetPropertyIdentifier={},B=s.AssignmentTargetPropertyProperty={},g=s.AssignmentTargetWithDefault={},x=s.AwaitExpression={},C=s.BinaryExpression={},S=s.BindingIdentifier={},L=s.BindingPropertyIdentifier={},$=s.BindingPropertyProperty={},N=s.BindingWithDefault={},R=s.Block={},O=s.BlockStatement={},U=s.BreakStatement={},G=s.CallExpression={},k=s.CatchClause={},M=s.ClassDeclaration={},H=s.ClassElement={},Y=s.ClassExpression={},ae=s.CompoundAssignmentExpression={},ee=s.ComputedMemberAssignmentTarget={},te=s.ComputedMemberExpression={},v=s.ComputedPropertyName={},X=s.ConditionalExpression={},re=s.ContinueStatement={},Ee=s.DataProperty={},q=s.DebuggerStatement={},K=s.Directive={},le=s.DoWhileStatement={},ue=s.EmptyStatement={},se=s.Export={},W=s.ExportAllFrom={},z=s.ExportDefault={},ce=s.ExportFrom={},De=s.ExportFromSpecifier={},Ae=s.ExportLocalSpecifier={},xe=s.ExportLocals={},_e=s.ExpressionStatement={},Ie=s.ForAwaitStatement={},Re=s.ForInStatement={},Ne=s.ForOfStatement={},we=s.ForStatement={},pe=s.FormalParameters={},ie=s.FunctionBody={},me=s.FunctionDeclaration={},ye=s.FunctionExpression={},be=s.Getter={},de=s.IdentifierExpression={},Le=s.IfStatement={},$e=s.Import={},Pe=s.ImportNamespace={},Se=s.ImportSpecifier={},Oe=s.LabeledStatement={},ke=s.LiteralBooleanExpression={},Me=s.LiteralInfinityExpression={},ve=s.LiteralNullExpression={},We=s.LiteralNumericExpression={},Ge=s.LiteralRegExpExpression={},Ue=s.LiteralStringExpression={},qe=s.Method={},He=s.Module={},Ve=s.NewExpression={},je=s.NewTargetExpression={},Q=s.ObjectAssignmentTarget={},J=s.ObjectBinding={},Ye=s.ObjectExpression={},Xe=s.ReturnStatement={},Ke=s.Script={},ze=s.Setter={},Je=s.ShorthandProperty={},fe=s.SpreadElement={},Ze=s.SpreadProperty={},Qe=s.StaticMemberAssignmentTarget={},et=s.StaticMemberExpression={},tt=s.StaticPropertyName={},oe=s.Super={},Ce=s.SwitchCase={},ge=s.SwitchDefault={},rt=s.SwitchStatement={},ut=s.SwitchStatementWithDefault={},Te=s.TemplateElement={},st=s.TemplateExpression={},it=s.ThisExpression={},nt=s.ThrowStatement={},at=s.TryCatchStatement={},ot=s.TryFinallyStatement={},lt=s.UnaryExpression={},ct=s.UpdateExpression={},ne=s.VariableDeclaration={},pt=s.VariableDeclarationStatement={},Be=s.VariableDeclarator={},ht=s.WhileStatement={},Et=s.WithStatement={},Dt=s.YieldExpression={},At=s.YieldGeneratorExpression={},St=l(te,et),mt=l(P,B);l(M,Y);var dt=l(se,W,z,ce,xe),he=l(v,tt);l(me,ye);var ft=l($e,Pe),gt=l(le,Ie,Re,Ne,we,ht),Z=l(ee,Qe),Ct=l(L,$),Ft=l(be,qe,ze),Tt=l(He,Ke),Bt=l(b,S,de),xt=l(Ee,Ft),w=l(h,y,_,x,C,G,Y,ae,X,ye,de,ke,Me,ve,We,Ge,Ue,St,Ve,je,Ye,st,it,lt,ct,Dt,At),j=l(O,U,M,re,q,ue,_e,me,Le,gt,Oe,Xe,rt,ut,nt,at,ot,pt,Et),yt=l(xt,Je,Ze);return l(E,D,mt,g,Ct,N,R,k,H,K,dt,De,Ae,w,pe,ie,ft,Se,Z,Q,J,yt,Tt,he,fe,j,oe,Ce,ge,Te,ne,Be,Bt),E.typeName="ArrayAssignmentTarget",E.fields=[{name:"type",type:a(o),value:"ArrayAssignmentTarget"},{name:"elements",type:n(i(l(g,l(l(E,Q),l(b,Z)))))},{name:"rest",type:i(l(l(E,Q),l(b,Z)))}],D.typeName="ArrayBinding",D.fields=[{name:"type",type:a(o),value:"ArrayBinding"},{name:"elements",type:n(i(l(N,l(S,l(D,J)))))},{name:"rest",type:i(l(S,l(D,J)))}],h.typeName="ArrayExpression",h.fields=[{name:"type",type:a(o),value:"ArrayExpression"},{name:"elements",type:n(i(l(w,fe)))}],y.typeName="ArrowExpression",y.fields=[{name:"type",type:a(o),value:"ArrowExpression"},{name:"isAsync",type:e},{name:"params",type:pe},{name:"body",type:l(w,ie)}],_.typeName="AssignmentExpression",_.fields=[{name:"type",type:a(o),value:"AssignmentExpression"},{name:"binding",type:l(l(E,Q),l(b,Z))},{name:"expression",type:w}],b.typeName="AssignmentTargetIdentifier",b.fields=[{name:"type",type:a(o),value:"AssignmentTargetIdentifier"},{name:"name",type:u}],P.typeName="AssignmentTargetPropertyIdentifier",P.fields=[{name:"type",type:a(o),value:"AssignmentTargetPropertyIdentifier"},{name:"binding",type:b},{name:"init",type:i(w)}],B.typeName="AssignmentTargetPropertyProperty",B.fields=[{name:"type",type:a(o),value:"AssignmentTargetPropertyProperty"},{name:"name",type:he},{name:"binding",type:l(g,l(l(E,Q),l(b,Z)))}],g.typeName="AssignmentTargetWithDefault",g.fields=[{name:"type",type:a(o),value:"AssignmentTargetWithDefault"},{name:"binding",type:l(l(E,Q),l(b,Z))},{name:"init",type:w}],x.typeName="AwaitExpression",x.fields=[{name:"type",type:a(o),value:"AwaitExpression"},{name:"expression",type:w}],C.typeName="BinaryExpression",C.fields=[{name:"type",type:a(o),value:"BinaryExpression"},{name:"left",type:w},{name:"operator",type:c},{name:"right",type:w}],S.typeName="BindingIdentifier",S.fields=[{name:"type",type:a(o),value:"BindingIdentifier"},{name:"name",type:u}],L.typeName="BindingPropertyIdentifier",L.fields=[{name:"type",type:a(o),value:"BindingPropertyIdentifier"},{name:"binding",type:S},{name:"init",type:i(w)}],$.typeName="BindingPropertyProperty",$.fields=[{name:"type",type:a(o),value:"BindingPropertyProperty"},{name:"name",type:he},{name:"binding",type:l(N,l(S,l(D,J)))}],N.typeName="BindingWithDefault",N.fields=[{name:"type",type:a(o),value:"BindingWithDefault"},{name:"binding",type:l(S,l(D,J))},{name:"init",type:w}],R.typeName="Block",R.fields=[{name:"type",type:a(o),value:"Block"},{name:"statements",type:n(j)}],O.typeName="BlockStatement",O.fields=[{name:"type",type:a(o),value:"BlockStatement"},{name:"block",type:R}],U.typeName="BreakStatement",U.fields=[{name:"type",type:a(o),value:"BreakStatement"},{name:"label",type:i(u)}],G.typeName="CallExpression",G.fields=[{name:"type",type:a(o),value:"CallExpression"},{name:"callee",type:l(w,oe)},{name:"arguments",type:n(l(w,fe))}],k.typeName="CatchClause",k.fields=[{name:"type",type:a(o),value:"CatchClause"},{name:"binding",type:i(l(S,l(D,J)))},{name:"body",type:R}],M.typeName="ClassDeclaration",M.fields=[{name:"type",type:a(o),value:"ClassDeclaration"},{name:"name",type:S},{name:"super",type:i(w)},{name:"elements",type:n(H)}],H.typeName="ClassElement",H.fields=[{name:"type",type:a(o),value:"ClassElement"},{name:"isStatic",type:e},{name:"method",type:Ft}],Y.typeName="ClassExpression",Y.fields=[{name:"type",type:a(o),value:"ClassExpression"},{name:"name",type:i(S)},{name:"super",type:i(w)},{name:"elements",type:n(H)}],ae.typeName="CompoundAssignmentExpression",ae.fields=[{name:"type",type:a(o),value:"CompoundAssignmentExpression"},{name:"binding",type:l(b,Z)},{name:"operator",type:A},{name:"expression",type:w}],ee.typeName="ComputedMemberAssignmentTarget",ee.fields=[{name:"type",type:a(o),value:"ComputedMemberAssignmentTarget"},{name:"object",type:l(w,oe)},{name:"expression",type:w}],te.typeName="ComputedMemberExpression",te.fields=[{name:"type",type:a(o),value:"ComputedMemberExpression"},{name:"object",type:l(w,oe)},{name:"expression",type:w}],v.typeName="ComputedPropertyName",v.fields=[{name:"type",type:a(o),value:"ComputedPropertyName"},{name:"expression",type:w}],X.typeName="ConditionalExpression",X.fields=[{name:"type",type:a(o),value:"ConditionalExpression"},{name:"test",type:w},{name:"consequent",type:w},{name:"alternate",type:w}],re.typeName="ContinueStatement",re.fields=[{name:"type",type:a(o),value:"ContinueStatement"},{name:"label",type:i(u)}],Ee.typeName="DataProperty",Ee.fields=[{name:"type",type:a(o),value:"DataProperty"},{name:"name",type:he},{name:"expression",type:w}],q.typeName="DebuggerStatement",q.fields=[{name:"type",type:a(o),value:"DebuggerStatement"}],K.typeName="Directive",K.fields=[{name:"type",type:a(o),value:"Directive"},{name:"rawValue",type:u}],le.typeName="DoWhileStatement",le.fields=[{name:"type",type:a(o),value:"DoWhileStatement"},{name:"body",type:j},{name:"test",type:w}],ue.typeName="EmptyStatement",ue.fields=[{name:"type",type:a(o),value:"EmptyStatement"}],se.typeName="Export",se.fields=[{name:"type",type:a(o),value:"Export"},{name:"declaration",type:l(M,me,ne)}],W.typeName="ExportAllFrom",W.fields=[{name:"type",type:a(o),value:"ExportAllFrom"},{name:"moduleSpecifier",type:u}],z.typeName="ExportDefault",z.fields=[{name:"type",type:a(o),value:"ExportDefault"},{name:"body",type:l(M,w,me)}],ce.typeName="ExportFrom",ce.fields=[{name:"type",type:a(o),value:"ExportFrom"},{name:"namedExports",type:n(De)},{name:"moduleSpecifier",type:u}],De.typeName="ExportFromSpecifier",De.fields=[{name:"type",type:a(o),value:"ExportFromSpecifier"},{name:"name",type:u},{name:"exportedName",type:i(u)}],Ae.typeName="ExportLocalSpecifier",Ae.fields=[{name:"type",type:a(o),value:"ExportLocalSpecifier"},{name:"name",type:de},{name:"exportedName",type:i(u)}],xe.typeName="ExportLocals",xe.fields=[{name:"type",type:a(o),value:"ExportLocals"},{name:"namedExports",type:n(Ae)}],_e.typeName="ExpressionStatement",_e.fields=[{name:"type",type:a(o),value:"ExpressionStatement"},{name:"expression",type:w}],Ie.typeName="ForAwaitStatement",Ie.fields=[{name:"type",type:a(o),value:"ForAwaitStatement"},{name:"left",type:l(l(l(E,Q),l(b,Z)),ne)},{name:"right",type:w},{name:"body",type:j}],Re.typeName="ForInStatement",Re.fields=[{name:"type",type:a(o),value:"ForInStatement"},{name:"left",type:l(l(l(E,Q),l(b,Z)),ne)},{name:"right",type:w},{name:"body",type:j}],Ne.typeName="ForOfStatement",Ne.fields=[{name:"type",type:a(o),value:"ForOfStatement"},{name:"left",type:l(l(l(E,Q),l(b,Z)),ne)},{name:"right",type:w},{name:"body",type:j}],we.typeName="ForStatement",we.fields=[{name:"type",type:a(o),value:"ForStatement"},{name:"init",type:i(l(w,ne))},{name:"test",type:i(w)},{name:"update",type:i(w)},{name:"body",type:j}],pe.typeName="FormalParameters",pe.fields=[{name:"type",type:a(o),value:"FormalParameters"},{name:"items",type:n(l(N,l(S,l(D,J))))},{name:"rest",type:i(l(S,l(D,J)))}],ie.typeName="FunctionBody",ie.fields=[{name:"type",type:a(o),value:"FunctionBody"},{name:"directives",type:n(K)},{name:"statements",type:n(j)}],me.typeName="FunctionDeclaration",me.fields=[{name:"type",type:a(o),value:"FunctionDeclaration"},{name:"isAsync",type:e},{name:"isGenerator",type:e},{name:"name",type:S},{name:"params",type:pe},{name:"body",type:ie}],ye.typeName="FunctionExpression",ye.fields=[{name:"type",type:a(o),value:"FunctionExpression"},{name:"isAsync",type:e},{name:"isGenerator",type:e},{name:"name",type:i(S)},{name:"params",type:pe},{name:"body",type:ie}],be.typeName="Getter",be.fields=[{name:"type",type:a(o),value:"Getter"},{name:"name",type:he},{name:"body",type:ie}],de.typeName="IdentifierExpression",de.fields=[{name:"type",type:a(o),value:"IdentifierExpression"},{name:"name",type:u}],Le.typeName="IfStatement",Le.fields=[{name:"type",type:a(o),value:"IfStatement"},{name:"test",type:w},{name:"consequent",type:j},{name:"alternate",type:i(j)}],$e.typeName="Import",$e.fields=[{name:"type",type:a(o),value:"Import"},{name:"defaultBinding",type:i(S)},{name:"namedImports",type:n(Se)},{name:"moduleSpecifier",type:u}],Pe.typeName="ImportNamespace",Pe.fields=[{name:"type",type:a(o),value:"ImportNamespace"},{name:"defaultBinding",type:i(S)},{name:"namespaceBinding",type:S},{name:"moduleSpecifier",type:u}],Se.typeName="ImportSpecifier",Se.fields=[{name:"type",type:a(o),value:"ImportSpecifier"},{name:"name",type:i(u)},{name:"binding",type:S}],Oe.typeName="LabeledStatement",Oe.fields=[{name:"type",type:a(o),value:"LabeledStatement"},{name:"label",type:u},{name:"body",type:j}],ke.typeName="LiteralBooleanExpression",ke.fields=[{name:"type",type:a(o),value:"LiteralBooleanExpression"},{name:"value",type:e}],Me.typeName="LiteralInfinityExpression",Me.fields=[{name:"type",type:a(o),value:"LiteralInfinityExpression"}],ve.typeName="LiteralNullExpression",ve.fields=[{name:"type",type:a(o),value:"LiteralNullExpression"}],We.typeName="LiteralNumericExpression",We.fields=[{name:"type",type:a(o),value:"LiteralNumericExpression"},{name:"value",type:r}],Ge.typeName="LiteralRegExpExpression",Ge.fields=[{name:"type",type:a(o),value:"LiteralRegExpExpression"},{name:"pattern",type:u},{name:"global",type:e},{name:"ignoreCase",type:e},{name:"multiLine",type:e},{name:"dotAll",type:e},{name:"unicode",type:e},{name:"sticky",type:e}],Ue.typeName="LiteralStringExpression",Ue.fields=[{name:"type",type:a(o),value:"LiteralStringExpression"},{name:"value",type:u}],qe.typeName="Method",qe.fields=[{name:"type",type:a(o),value:"Method"},{name:"isAsync",type:e},{name:"isGenerator",type:e},{name:"name",type:he},{name:"params",type:pe},{name:"body",type:ie}],He.typeName="Module",He.fields=[{name:"type",type:a(o),value:"Module"},{name:"directives",type:n(K)},{name:"items",type:n(l(dt,ft,j))}],Ve.typeName="NewExpression",Ve.fields=[{name:"type",type:a(o),value:"NewExpression"},{name:"callee",type:w},{name:"arguments",type:n(l(w,fe))}],je.typeName="NewTargetExpression",je.fields=[{name:"type",type:a(o),value:"NewTargetExpression"}],Q.typeName="ObjectAssignmentTarget",Q.fields=[{name:"type",type:a(o),value:"ObjectAssignmentTarget"},{name:"properties",type:n(mt)},{name:"rest",type:i(l(b,Z))}],J.typeName="ObjectBinding",J.fields=[{name:"type",type:a(o),value:"ObjectBinding"},{name:"properties",type:n(Ct)},{name:"rest",type:i(S)}],Ye.typeName="ObjectExpression",Ye.fields=[{name:"type",type:a(o),value:"ObjectExpression"},{name:"properties",type:n(yt)}],Xe.typeName="ReturnStatement",Xe.fields=[{name:"type",type:a(o),value:"ReturnStatement"},{name:"expression",type:i(w)}],Ke.typeName="Script",Ke.fields=[{name:"type",type:a(o),value:"Script"},{name:"directives",type:n(K)},{name:"statements",type:n(j)}],ze.typeName="Setter",ze.fields=[{name:"type",type:a(o),value:"Setter"},{name:"name",type:he},{name:"param",type:l(N,l(S,l(D,J)))},{name:"body",type:ie}],Je.typeName="ShorthandProperty",Je.fields=[{name:"type",type:a(o),value:"ShorthandProperty"},{name:"name",type:de}],fe.typeName="SpreadElement",fe.fields=[{name:"type",type:a(o),value:"SpreadElement"},{name:"expression",type:w}],Ze.typeName="SpreadProperty",Ze.fields=[{name:"type",type:a(o),value:"SpreadProperty"},{name:"expression",type:w}],Qe.typeName="StaticMemberAssignmentTarget",Qe.fields=[{name:"type",type:a(o),value:"StaticMemberAssignmentTarget"},{name:"object",type:l(w,oe)},{name:"property",type:u}],et.typeName="StaticMemberExpression",et.fields=[{name:"type",type:a(o),value:"StaticMemberExpression"},{name:"object",type:l(w,oe)},{name:"property",type:u}],tt.typeName="StaticPropertyName",tt.fields=[{name:"type",type:a(o),value:"StaticPropertyName"},{name:"value",type:u}],oe.typeName="Super",oe.fields=[{name:"type",type:a(o),value:"Super"}],Ce.typeName="SwitchCase",Ce.fields=[{name:"type",type:a(o),value:"SwitchCase"},{name:"test",type:w},{name:"consequent",type:n(j)}],ge.typeName="SwitchDefault",ge.fields=[{name:"type",type:a(o),value:"SwitchDefault"},{name:"consequent",type:n(j)}],rt.typeName="SwitchStatement",rt.fields=[{name:"type",type:a(o),value:"SwitchStatement"},{name:"discriminant",type:w},{name:"cases",type:n(Ce)}],ut.typeName="SwitchStatementWithDefault",ut.fields=[{name:"type",type:a(o),value:"SwitchStatementWithDefault"},{name:"discriminant",type:w},{name:"preDefaultCases",type:n(Ce)},{name:"defaultCase",type:ge},{name:"postDefaultCases",type:n(Ce)}],Te.typeName="TemplateElement",Te.fields=[{name:"type",type:a(o),value:"TemplateElement"},{name:"rawValue",type:u}],st.typeName="TemplateExpression",st.fields=[{name:"type",type:a(o),value:"TemplateExpression"},{name:"tag",type:i(w)},{name:"elements",type:n(l(w,Te))}],it.typeName="ThisExpression",it.fields=[{name:"type",type:a(o),value:"ThisExpression"}],nt.typeName="ThrowStatement",nt.fields=[{name:"type",type:a(o),value:"ThrowStatement"},{name:"expression",type:w}],at.typeName="TryCatchStatement",at.fields=[{name:"type",type:a(o),value:"TryCatchStatement"},{name:"body",type:R},{name:"catchClause",type:k}],ot.typeName="TryFinallyStatement",ot.fields=[{name:"type",type:a(o),value:"TryFinallyStatement"},{name:"body",type:R},{name:"catchClause",type:i(k)},{name:"finalizer",type:R}],lt.typeName="UnaryExpression",lt.fields=[{name:"type",type:a(o),value:"UnaryExpression"},{name:"operator",type:d},{name:"operand",type:w}],ct.typeName="UpdateExpression",ct.fields=[{name:"type",type:a(o),value:"UpdateExpression"},{name:"isPrefix",type:e},{name:"operator",type:m},{name:"operand",type:l(b,Z)}],ne.typeName="VariableDeclaration",ne.fields=[{name:"type",type:a(o),value:"VariableDeclaration"},{name:"kind",type:f},{name:"declarators",type:n(Be)}],pt.typeName="VariableDeclarationStatement",pt.fields=[{name:"type",type:a(o),value:"VariableDeclarationStatement"},{name:"declaration",type:ne}],Be.typeName="VariableDeclarator",Be.fields=[{name:"type",type:a(o),value:"VariableDeclarator"},{name:"binding",type:l(S,l(D,J))},{name:"init",type:i(w)}],ht.typeName="WhileStatement",ht.fields=[{name:"type",type:a(o),value:"WhileStatement"},{name:"test",type:w},{name:"body",type:j}],Et.typeName="WithStatement",Et.fields=[{name:"type",type:a(o),value:"WithStatement"},{name:"object",type:w},{name:"body",type:j}],Dt.typeName="YieldExpression",Dt.fields=[{name:"type",type:a(o),value:"YieldExpression"},{name:"expression",type:i(w)}],At.typeName="YieldGeneratorExpression",At.fields=[{name:"type",type:a(o),value:"YieldGeneratorExpression"},{name:"expression",type:w}],s}(),estraverse$1={};(function(s){(function e(r){var u,i,n,a,l,o;function c(B){var g={},x,C;for(x in B)B.hasOwnProperty(x)&&(C=B[x],typeof C=="object"&&C!==null?g[x]=c(C):g[x]=C);return g}function A(B,g){var x,C,S,L;for(C=B.length,S=0;C;)x=C>>>1,L=S+x,g(B[L])?C=x:(S=L+1,C-=x+1);return S}u={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},n={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},a={},l={},o={},i={Break:a,Skip:l,Remove:o};function d(B,g){this.parent=B,this.key=g}d.prototype.replace=function(g){this.parent[this.key]=g},d.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)};function m(B,g,x,C){this.node=B,this.path=g,this.wrap=x,this.ref=C}function f(){}f.prototype.path=function(){var g,x,C,S,L,$;function N(R,O){if(Array.isArray(O))for(C=0,S=O.length;C=0;--x)if(B[x].node===g)return!0;return!1}f.prototype.traverse=function(g,x){var C,S,L,$,N,R,O,U,G,k,M,H;for(this.__initialize(g,x),H={},C=this.__worklist,S=this.__leavelist,C.push(new m(g,null,null,null)),S.push(new m(null,null,null,null));C.length;){if(L=C.pop(),L===H){if(L=S.pop(),R=this.__execute(x.leave,L),this.__state===a||R===a)return;continue}if(L.node){if(R=this.__execute(x.enter,L),this.__state===a||R===a)return;if(C.push(H),S.push(L),this.__state===l||R===l)continue;if($=L.node,N=$.type||L.wrap,k=this.__keys[N],!k)if(this.__fallback)k=this.__fallback($);else throw new Error("Unknown node type "+N+".");for(U=k.length;(U-=1)>=0;)if(O=k[U],M=$[O],!!M){if(Array.isArray(M)){for(G=M.length;(G-=1)>=0;)if(!!M[G]&&!h(S,M[G])){if(D(N,k[U]))L=new m(M[G],[O,G],"Property",null);else if(E(M[G]))L=new m(M[G],[O,G],null,null);else continue;C.push(L)}}else if(E(M)){if(h(S,M))continue;C.push(new m(M,O,null,null))}}}}},f.prototype.replace=function(g,x){var C,S,L,$,N,R,O,U,G,k,M,H,Y;function ae(ee){var te,v,X,re;if(ee.ref.remove()){for(v=ee.ref.key,re=ee.ref.parent,te=C.length;te--;)if(X=C[te],X.ref&&X.ref.parent===re){if(X.ref.key=0;)if(Y=G[O],k=L[Y],!!k)if(Array.isArray(k)){for(U=k.length;(U-=1)>=0;)if(!!k[U]){if(D($,G[O]))R=new m(k[U],[Y,U],"Property",new d(k,U));else if(E(k[U]))R=new m(k[U],[Y,U],null,new d(k,U));else continue;C.push(R)}}else E(k)&&C.push(new m(k,Y,null,new d(L,Y)))}}return H.root};function y(B,g){var x=new f;return x.traverse(B,g)}function _(B,g){var x=new f;return x.replace(B,g)}function b(B,g){var x;return x=A(g,function(S){return S.range[0]>B.range[0]}),B.extendedRange=[B.range[0],B.range[1]],x!==g.length&&(B.extendedRange[1]=g[x].range[0]),x-=1,x>=0&&(B.extendedRange[0]=g[x].range[1]),B}function P(B,g,x){var C=[],S,L,$,N;if(!B.range)throw new Error("attachComments needs range information");if(!x.length){if(g.length){for($=0,L=g.length;$R.range[0]));)O.extendedRange[1]===R.range[0]?(R.leadingComments||(R.leadingComments=[]),R.leadingComments.push(O),C.splice(N,1)):N+=1;if(N===C.length)return i.Break;if(C[N].extendedRange[0]>R.range[1])return i.Skip}}),N=0,y(B,{leave:function(R){for(var O;NR.range[1])return i.Skip}}),B}return r.Syntax=u,r.traverse=y,r.replace=_,r.attachComments=P,r.VisitorKeys=n,r.VisitorOption=i,r.Controller=f,r.cloneEnvironment=function(){return e({})},r})(s)})(estraverse$1);const Spec=dist.default||dist,estraverse=estraverse$1.cloneEnvironment();Object.keys(estraverse.Syntax).filter(s=>s!=="Property").forEach(s=>{delete estraverse.Syntax[s],delete estraverse.VisitorKeys[s]});Object.assign(estraverse.Syntax,Object.keys(Spec).reduce((s,e)=>(s[e]=e,s),{}));Object.assign(estraverse.VisitorKeys,Object.keys(Spec).reduce((s,e)=>(s[e]=Spec[e].fields.map(r=>r.name),s),{}));const whitespaceArray=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],whitespaceBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!0,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],idStartLargeRegex=/^[\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\u2118-\u211D\u2124\u2126\u2128\u212A-\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\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]$/,idStartBool=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!0,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1],idContinueLargeRegex$1=/^[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\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\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]$/,idContinueBool$1=[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!1,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!0,!1,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!0,!1,!1,!1,!1,!1];var unicode={whitespaceArray,whitespaceBool,idStartLargeRegex,idStartBool,idContinueLargeRegex:idContinueLargeRegex$1,idContinueBool:idContinueBool$1};const{idContinueLargeRegex,idContinueBool}=unicode;function isIdentifierPartES6(s){let e=s.charCodeAt(0);return e<128?idContinueBool[e]:idContinueLargeRegex.test(s)}function needsDoubleDot$1(s){return s.indexOf(".")<0&&s.indexOf("e")<0&&s.indexOf("x")<0}function renderNumber(s){let e;return s>=1e3&&s%10===0?(e=s.toString(10),/[eE]/.test(e)?e.replace(/[eE]\+/,"e"):s.toString(10).replace(/0{3,}$/,r=>"e"+r.length)):s%1===0?s>1e15&&s<1e20?"0x"+s.toString(16).toUpperCase():s.toString(10).replace(/[eE]\+/,"e"):s.toString(10).replace(/^0\./,".").replace(/[eE]\+/,"e")}class TokenStream$2{constructor(){this.result="",this.lastNumber=null,this.lastCodePoint=null,this.lastTokenStr="",this.optionalSemi=!1,this.previousWasRegExp=!1,this.partialHtmlComment=!1}putNumber(e){let r=renderNumber(e);this.put(r),this.lastNumber=r}putOptionalSemi(){this.optionalSemi=!0}putRaw(e){this.result+=e,this.lastTokenStr=e}put(e,r){if(this.optionalSemi&&(this.optionalSemi=!1,e!=="}"&&(this.result+=";",this.lastCodePoint=";",this.previousWasRegExp=!1)),this.lastNumber!==null&&e.length===1&&e==="."){this.result+=needsDoubleDot$1(this.lastNumber)?"..":".",this.lastNumber=null,this.lastCodePoint=".";return}let u=[...e].length;if(u>0){this.lastNumber=null;let i=String.fromCodePoint(e.codePointAt(0)),n=this.lastCodePoint;this.lastCodePoint=String.fromCodePoint(e.codePointAt(u-1));let a=this.previousWasRegExp;this.previousWasRegExp=r,n&&((n==="+"||n==="-")&&n===i||isIdentifierPartES6(n)&&isIdentifierPartES6(i)||n==="/"&&i==="/"||a&&i==="i"||this.partialHtmlComment&&e.startsWith("--"))&&(this.result+=" ")}this.partialHtmlComment=this.lastTokenStr.endsWith("<")&&e==="!",this.result+=e,this.lastTokenStr=e}}var tokenStream={needsDoubleDot:needsDoubleDot$1,TokenStream:TokenStream$2};/* -object-assign -(c) Sindre Sorhus -@license MIT -*/var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function shouldUseNative(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var u=Object.getOwnPropertyNames(e).map(function(n){return e[n]});if(u.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(n){i[n]=n}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var objectAssign$2=shouldUseNative()?Object.assign:function(s,e){for(var r,u=toObject(s),i,n=1;n=48&&h<=55}r=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function c(h){return h===32||h===9||h===11||h===12||h===160||h>=5760&&r.indexOf(h)>=0}function A(h){return h===10||h===13||h===8232||h===8233}function d(h){if(h<=65535)return String.fromCharCode(h);var y=String.fromCharCode(Math.floor((h-65536)/1024)+55296),_=String.fromCharCode((h-65536)%1024+56320);return y+_}for(u=new Array(128),n=0;n<128;++n)u[n]=n>=97&&n<=122||n>=65&&n<=90||n===36||n===95;for(i=new Array(128),n=0;n<128;++n)i[n]=n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===36||n===95;function m(h){return h<128?u[h]:e.NonAsciiIdentifierStart.test(d(h))}function f(h){return h<128?i[h]:e.NonAsciiIdentifierPart.test(d(h))}function E(h){return h<128?u[h]:s.NonAsciiIdentifierStart.test(d(h))}function D(h){return h<128?i[h]:s.NonAsciiIdentifierPart.test(d(h))}code.exports={isDecimalDigit:a,isHexDigit:l,isOctalDigit:o,isWhiteSpace:c,isLineTerminator:A,isIdentifierStartES5:m,isIdentifierPartES5:f,isIdentifierStartES6:E,isIdentifierPartES6:D}})();var keyword$2={exports:{}};(function(){var s=code.exports;function e(m){switch(m){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function r(m,f){return!f&&m==="yield"?!1:u(m,f)}function u(m,f){if(f&&e(m))return!0;switch(m.length){case 2:return m==="if"||m==="in"||m==="do";case 3:return m==="var"||m==="for"||m==="new"||m==="try";case 4:return m==="this"||m==="else"||m==="case"||m==="void"||m==="with"||m==="enum";case 5:return m==="while"||m==="break"||m==="catch"||m==="throw"||m==="const"||m==="yield"||m==="class"||m==="super";case 6:return m==="return"||m==="typeof"||m==="delete"||m==="switch"||m==="export"||m==="import";case 7:return m==="default"||m==="finally"||m==="extends";case 8:return m==="function"||m==="continue"||m==="debugger";case 10:return m==="instanceof";default:return!1}}function i(m,f){return m==="null"||m==="true"||m==="false"||r(m,f)}function n(m,f){return m==="null"||m==="true"||m==="false"||u(m,f)}function a(m){return m==="eval"||m==="arguments"}function l(m){var f,E,D;if(m.length===0||(D=m.charCodeAt(0),!s.isIdentifierStartES5(D)))return!1;for(f=1,E=m.length;f=E||(h=m.charCodeAt(f),!(56320<=h&&h<=57343)))return!1;D=o(D,h)}if(!y(D))return!1;y=s.isIdentifierPartES6}return!0}function A(m,f){return l(m)&&!i(m,f)}function d(m,f){return c(m)&&!n(m,f)}keyword$2.exports={isKeywordES5:r,isKeywordES6:u,isReservedWordES5:i,isReservedWordES6:n,isRestrictedWord:a,isIdentifierNameES5:l,isIdentifierNameES6:c,isIdentifierES5:A,isIdentifierES6:d}})();(function(){utils.ast=ast.exports,utils.code=code.exports,utils.keyword=keyword$2.exports})();const Precedence$3={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,LogicalOR:3,LogicalAND:4,BitwiseOR:5,BitwiseXOR:6,BitwiseAND:7,Equality:8,Relational:9,BitwiseSHIFT:10,Additive:11,Multiplicative:12,Exponential:13,Prefix:14,Postfix:15,New:16,Call:17,TaggedTemplate:18,Member:19,Primary:20},BinaryPrecedence={",":Precedence$3.Sequence,"||":Precedence$3.LogicalOR,"&&":Precedence$3.LogicalAND,"|":Precedence$3.BitwiseOR,"^":Precedence$3.BitwiseXOR,"&":Precedence$3.BitwiseAND,"==":Precedence$3.Equality,"!=":Precedence$3.Equality,"===":Precedence$3.Equality,"!==":Precedence$3.Equality,"<":Precedence$3.Relational,">":Precedence$3.Relational,"<=":Precedence$3.Relational,">=":Precedence$3.Relational,in:Precedence$3.Relational,instanceof:Precedence$3.Relational,"<<":Precedence$3.BitwiseSHIFT,">>":Precedence$3.BitwiseSHIFT,">>>":Precedence$3.BitwiseSHIFT,"+":Precedence$3.Additive,"-":Precedence$3.Additive,"*":Precedence$3.Multiplicative,"%":Precedence$3.Multiplicative,"/":Precedence$3.Multiplicative,"**":Precedence$3.Exponential};function getPrecedence$3(s){switch(s.type){case"ArrayExpression":case"FunctionExpression":case"ClassExpression":case"IdentifierExpression":case"AssignmentTargetIdentifier":case"NewTargetExpression":case"Super":case"LiteralBooleanExpression":case"LiteralNullExpression":case"LiteralNumericExpression":case"LiteralInfinityExpression":case"LiteralRegExpExpression":case"LiteralStringExpression":case"ObjectExpression":case"ThisExpression":case"SpreadElement":case"FunctionBody":return Precedence$3.Primary;case"ArrowExpression":case"AssignmentExpression":case"CompoundAssignmentExpression":case"YieldExpression":case"YieldGeneratorExpression":return Precedence$3.Assignment;case"ConditionalExpression":return Precedence$3.Conditional;case"ComputedMemberExpression":case"StaticMemberExpression":case"ComputedMemberAssignmentTarget":case"StaticMemberAssignmentTarget":switch(s.object.type){case"CallExpression":case"ComputedMemberExpression":case"StaticMemberExpression":case"TemplateExpression":return getPrecedence$3(s.object);default:return Precedence$3.Member}case"TemplateExpression":if(s.tag==null)return Precedence$3.Member;switch(s.tag.type){case"CallExpression":case"ComputedMemberExpression":case"StaticMemberExpression":case"TemplateExpression":return getPrecedence$3(s.tag);default:return Precedence$3.Member}case"BinaryExpression":return BinaryPrecedence[s.operator];case"CallExpression":return Precedence$3.Call;case"NewExpression":return s.arguments.length===0?Precedence$3.New:Precedence$3.Member;case"UpdateExpression":return s.isPrefix?Precedence$3.Prefix:Precedence$3.Postfix;case"AwaitExpression":case"UnaryExpression":return Precedence$3.Prefix;default:throw new Error("unreachable: "+s.type)}}function escapeStringLiteral$3(s){let e="",r=0,u=0;for(let n=0,a=s.length;nr?"'":'"';e+=i;for(let n=0;nu.emit(e,r))}forEach(e){e(this),this.children.forEach(r=>r.forEach(e))}}class Semi$2 extends Token$3{constructor(){super(";")}}class CommaSep$2 extends CodeRep$2{constructor(e){super(),this.children=e}emit(e,r){let u=!0;this.children.forEach(i=>{u?u=!1:e.put(","),i.emit(e,r)})}forEach(e){e(this),this.children.forEach(r=>r.forEach(e))}}class SemiOp$3 extends CodeRep$2{constructor(){super()}emit(e){e.putOptionalSemi()}}var coderep={Precedence:Precedence$3,getPrecedence:getPrecedence$3,escapeStringLiteral:escapeStringLiteral$3,CodeRep:CodeRep$2,Empty:Empty$3,Token:Token$3,RawToken:RawToken$1,NumberCodeRep:NumberCodeRep$3,Paren:Paren$3,Bracket:Bracket$3,Brace:Brace$3,NoIn:NoIn$3,ContainsIn:ContainsIn$3,Seq:Seq$3,Semi:Semi$2,CommaSep:CommaSep$2,SemiOp:SemiOp$3};const objectAssign$1=objectAssign$2,{keyword:keyword$1}=utils,{Precedence:Precedence$2,getPrecedence:getPrecedence$2,escapeStringLiteral:escapeStringLiteral$2,Empty:Empty$2,Token:Token$2,RawToken,NumberCodeRep:NumberCodeRep$2,Paren:Paren$2,Bracket:Bracket$2,Brace:Brace$2,NoIn:NoIn$2,ContainsIn:ContainsIn$2,Seq:Seq$2,Semi:Semi$1,CommaSep:CommaSep$1,SemiOp:SemiOp$2}=coderep;function p(s,e,r){return getPrecedence$2(s)0&&r[r.length-1]==null&&(u=seq$1(u,t(","))),bracket(u)}reduceAwaitExpression(e,{expression:r}){return seq$1(t("await"),p(e.expression,getPrecedence$2(e),r))}reduceSpreadElement(e,{expression:r}){return seq$1(t("..."),p(e.expression,Precedence$2.Assignment,r))}reduceSpreadProperty(e,{expression:r}){return seq$1(t("..."),getAssignmentExpr(r))}reduceAssignmentExpression(e,{binding:r,expression:u}){let i=r,n=u,a=u.containsIn,l=r.startsWithCurly,o=r.startsWithLetSquareBracket,c=r.startsWithFunctionOrClass;return getPrecedence$2(e.expression)0&&r[r.length-1]==null&&(i=seq$1(i,t(",")))),bracket(i)}reduceArrayBinding(e,{elements:r,rest:u}){let i;return r.length===0?i=u==null?empty$1():seq$1(t("..."),u):(r=r.concat(u==null?[]:[seq$1(t("..."),u)]),i=commaSep(r.map(getAssignmentExpr)),r.length>0&&r[r.length-1]==null&&(i=seq$1(i,t(",")))),bracket(i)}reduceObjectAssignmentTarget(e,{properties:r,rest:u}){let i=commaSep(r);r.length===0?i=u==null?empty$1():seq$1(t("..."),u):i=u==null?i:seq$1(i,t(","),t("..."),u);let n=brace(i);return n.startsWithCurly=!0,n}reduceObjectBinding(e,{properties:r,rest:u}){let i=commaSep(r);r.length===0?i=u==null?empty$1():seq$1(t("..."),u):i=u==null?i:seq$1(i,t(","),t("..."),u);let n=brace(i);return n.startsWithCurly=!0,n}reduceAssignmentTargetPropertyIdentifier(e,{binding:r,init:u}){return e.init==null?r:seq$1(r,t("="),p(e.init,Precedence$2.Assignment,u))}reduceAssignmentTargetPropertyProperty(e,{name:r,binding:u}){return seq$1(r,t(":"),u)}reduceBindingPropertyIdentifier(e,{binding:r,init:u}){return e.init==null?r:seq$1(r,t("="),p(e.init,Precedence$2.Assignment,u))}reduceBindingPropertyProperty(e,{name:r,binding:u}){return seq$1(r,t(":"),u)}reduceBlock(e,{statements:r}){return brace(seq$1(...r))}reduceBlockStatement(e,{block:r}){return r}reduceBreakStatement(e){return seq$1(t("break"),e.label?t(e.label):empty$1(),semiOp())}reduceCallExpression(e,{callee:r,arguments:u}){const i=u.map((n,a)=>p(e.arguments[a],Precedence$2.Assignment,n));return objectAssign$1(seq$1(p(e.callee,getPrecedence$2(e),r),paren(commaSep(i))),{startsWithCurly:r.startsWithCurly,startsWithLet:r.startsWithLet,startsWithLetSquareBracket:r.startsWithLetSquareBracket,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceCatchClause(e,{binding:r,body:u}){return r==null?seq$1(t("catch"),u):seq$1(t("catch"),paren(r),u)}reduceClassDeclaration(e,{name:r,super:u,elements:i}){let n=seq$1(t("class"),e.name.name==="*default*"?empty$1():r);return u!=null&&(n=seq$1(n,t("extends"),p(e.super,Precedence$2.New,u))),n=seq$1(n,t("{"),...i,t("}")),n}reduceClassExpression(e,{name:r,super:u,elements:i}){let n=t("class");return r!=null&&(n=seq$1(n,r)),u!=null&&(n=seq$1(n,t("extends"),p(e.super,Precedence$2.New,u))),n=seq$1(n,t("{"),...i,t("}")),n.startsWithFunctionOrClass=!0,n}reduceClassElement(e,{method:r}){return e.isStatic?seq$1(t("static"),r):r}reduceComputedMemberAssignmentTarget(e,{object:r,expression:u}){let i=r.startsWithLetSquareBracket||e.object.type==="IdentifierExpression"&&e.object.name==="let";return objectAssign$1(seq$1(p(e.object,getPrecedence$2(e),r),bracket(u)),{startsWithLet:r.startsWithLet,startsWithLetSquareBracket:i,startsWithCurly:r.startsWithCurly,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceComputedMemberExpression(e,{object:r,expression:u}){let i=r.startsWithLetSquareBracket||e.object.type==="IdentifierExpression"&&e.object.name==="let";return objectAssign$1(seq$1(p(e.object,getPrecedence$2(e),r),bracket(u)),{startsWithLet:r.startsWithLet,startsWithLetSquareBracket:i,startsWithCurly:r.startsWithCurly,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceComputedPropertyName(e,{expression:r}){return bracket(p(e.expression,Precedence$2.Assignment,r))}reduceConditionalExpression(e,{test:r,consequent:u,alternate:i}){let n=r.containsIn||i.containsIn,a=r.startsWithCurly,l=r.startsWithLetSquareBracket,o=r.startsWithFunctionOrClass;return objectAssign$1(seq$1(p(e.test,Precedence$2.LogicalOR,r),t("?"),p(e.consequent,Precedence$2.Assignment,u),t(":"),p(e.alternate,Precedence$2.Assignment,i)),{containsIn:n,startsWithCurly:a,startsWithLetSquareBracket:l,startsWithFunctionOrClass:o})}reduceContinueStatement(e){return seq$1(t("continue"),e.label?t(e.label):empty$1(),semiOp())}reduceDataProperty(e,{name:r,expression:u}){return seq$1(r,t(":"),getAssignmentExpr(u))}reduceDebuggerStatement(){return seq$1(t("debugger"),semiOp())}reduceDoWhileStatement(e,{body:r,test:u}){return seq$1(t("do"),r,t("while"),paren(u),semiOp())}reduceEmptyStatement(){return semi()}reduceExpressionStatement(e,{expression:r}){let u=r.startsWithCurly||r.startsWithLetSquareBracket||r.startsWithFunctionOrClass;return seq$1(u?paren(r):r,semiOp())}reduceForInStatement(e,{left:r,right:u,body:i}){return r=e.left.type==="VariableDeclaration"?noIn$1(markContainsIn$1(r)):r,objectAssign$1(seq$1(t("for"),paren(seq$1(r.startsWithLet?paren(r):r,t("in"),u)),i),{endsWithMissingElse:i.endsWithMissingElse})}reduceForOfStatement(e,{left:r,right:u,body:i}){return r=e.left.type==="VariableDeclaration"?noIn$1(markContainsIn$1(r)):r,objectAssign$1(seq$1(t("for"),paren(seq$1(r.startsWithLet?paren(r):r,t("of"),p(e.right,Precedence$2.Assignment,u))),i),{endsWithMissingElse:i.endsWithMissingElse})}reduceForStatement(e,{init:r,test:u,update:i,body:n}){return r&&(r.startsWithLetSquareBracket&&(r=paren(r)),r=noIn$1(markContainsIn$1(r))),objectAssign$1(seq$1(t("for"),paren(seq$1(r||empty$1(),semi(),u||empty$1(),semi(),i||empty$1())),n),{endsWithMissingElse:n.endsWithMissingElse})}reduceForAwaitStatement(e,{left:r,right:u,body:i}){return r=e.left.type==="VariableDeclaration"?noIn$1(markContainsIn$1(r)):r,objectAssign$1(seq$1(t("for"),t("await"),paren(seq$1(r.startsWithLet?paren(r):r,t("of"),p(e.right,Precedence$2.Assignment,u))),i),{endsWithMissingElse:i.endsWithMissingElse})}reduceFunctionBody(e,{directives:r,statements:u}){return u.length&&(u[0]=this.parenToAvoidBeingDirective(e.statements[0],u[0])),brace(seq$1(...r,...u))}reduceFunctionDeclaration(e,{name:r,params:u,body:i}){return seq$1(e.isAsync?t("async"):empty$1(),t("function"),e.isGenerator?t("*"):empty$1(),e.name.name==="*default*"?empty$1():r,u,i)}reduceFunctionExpression(e,{name:r,params:u,body:i}){let n=seq$1(e.isAsync?t("async"):empty$1(),t("function"),e.isGenerator?t("*"):empty$1(),r||empty$1(),u,i);return n.startsWithFunctionOrClass=!0,n}reduceFormalParameters(e,{items:r,rest:u}){return paren(commaSep(r.concat(u==null?[]:[seq$1(t("..."),u)])))}reduceArrowExpression(e,{params:r,body:u}){r=this.regenerateArrowParams(e.params,r);let i=!1;return e.body.type!=="FunctionBody"&&(u.startsWithCurly?u=paren(u):u.containsIn&&(i=!0)),objectAssign$1(seq$1(e.isAsync?t("async"):empty$1(),r,t("=>"),p(e.body,Precedence$2.Assignment,u)),{containsIn:i})}reduceGetter(e,{name:r,body:u}){return seq$1(t("get"),r,paren(empty$1()),u)}reduceIdentifierExpression(e){let r=t(e.name);return e.name==="let"&&(r.startsWithLet=!0),r}reduceIfStatement(e,{test:r,consequent:u,alternate:i}){return i&&u.endsWithMissingElse&&(u=brace(u)),objectAssign$1(seq$1(t("if"),paren(r),u,i?seq$1(t("else"),i):empty$1()),{endsWithMissingElse:i?i.endsWithMissingElse:!0})}reduceImport(e,{defaultBinding:r,namedImports:u}){let i=[];return r!=null&&i.push(r),u.length>0&&i.push(brace(commaSep(u))),i.length===0?seq$1(t("import"),t(escapeStringLiteral$2(e.moduleSpecifier)),semiOp()):seq$1(t("import"),commaSep(i),t("from"),t(escapeStringLiteral$2(e.moduleSpecifier)),semiOp())}reduceImportNamespace(e,{defaultBinding:r,namespaceBinding:u}){return seq$1(t("import"),r==null?empty$1():seq$1(r,t(",")),t("*"),t("as"),u,t("from"),t(escapeStringLiteral$2(e.moduleSpecifier)),semiOp())}reduceImportSpecifier(e,{binding:r}){return e.name==null?r:seq$1(t(e.name),t("as"),r)}reduceExportAllFrom(e){return seq$1(t("export"),t("*"),t("from"),t(escapeStringLiteral$2(e.moduleSpecifier)),semiOp())}reduceExportFrom(e,{namedExports:r}){return seq$1(t("export"),brace(commaSep(r)),t("from"),t(escapeStringLiteral$2(e.moduleSpecifier)),semiOp())}reduceExportLocals(e,{namedExports:r}){return seq$1(t("export"),brace(commaSep(r)),semiOp())}reduceExport(e,{declaration:r}){switch(e.declaration.type){case"FunctionDeclaration":case"ClassDeclaration":break;default:r=seq$1(r,semiOp())}return seq$1(t("export"),r)}reduceExportDefault(e,{body:r}){switch(r=r.startsWithFunctionOrClass?paren(r):r,e.body.type){case"FunctionDeclaration":case"ClassDeclaration":return seq$1(t("export default"),r);default:return seq$1(t("export default"),p(e.body,Precedence$2.Assignment,r),semiOp())}}reduceExportFromSpecifier(e){return e.exportedName==null?t(e.name):seq$1(t(e.name),t("as"),t(e.exportedName))}reduceExportLocalSpecifier(e,{name:r}){return e.exportedName==null?r:seq$1(r,t("as"),t(e.exportedName))}reduceLabeledStatement(e,{body:r}){return objectAssign$1(seq$1(t(e.label+":"),r),{endsWithMissingElse:r.endsWithMissingElse})}reduceLiteralBooleanExpression(e){return t(e.value.toString())}reduceLiteralNullExpression(){return t("null")}reduceLiteralInfinityExpression(){return t("2e308")}reduceLiteralNumericExpression(e){return new NumberCodeRep$2(e.value)}reduceLiteralRegExpExpression(e){return t(`/${e.pattern}/${e.global?"g":""}${e.ignoreCase?"i":""}${e.multiLine?"m":""}${e.dotAll?"s":""}${e.unicode?"u":""}${e.sticky?"y":""}`,!0)}reduceLiteralStringExpression(e){return t(escapeStringLiteral$2(e.value))}reduceMethod(e,{name:r,params:u,body:i}){return seq$1(e.isAsync?t("async"):empty$1(),e.isGenerator?t("*"):empty$1(),r,u,i)}reduceModule(e,{directives:r,items:u}){return u.length&&(u[0]=this.parenToAvoidBeingDirective(e.items[0],u[0])),seq$1(...r,...u)}reduceNewExpression(e,{callee:r,arguments:u}){const i=u.map((a,l)=>p(e.arguments[l],Precedence$2.Assignment,a));let n=getPrecedence$2(e.callee)===Precedence$2.Call?paren(r):p(e.callee,getPrecedence$2(e),r);return seq$1(t("new"),n,u.length===0?empty$1():paren(commaSep(i)))}reduceNewTargetExpression(){return t("new.target")}reduceObjectExpression(e,{properties:r}){let u=brace(commaSep(r));return u.startsWithCurly=!0,u}reduceUpdateExpression(e,{operand:r}){return e.isPrefix?this.reduceUnaryExpression(...arguments):objectAssign$1(seq$1(p(e.operand,Precedence$2.New,r),t(e.operator)),{startsWithCurly:r.startsWithCurly,startsWithLetSquareBracket:r.startsWithLetSquareBracket,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceUnaryExpression(e,{operand:r}){return seq$1(t(e.operator),p(e.operand,getPrecedence$2(e),r))}reduceReturnStatement(e,{expression:r}){return seq$1(t("return"),r||empty$1(),semiOp())}reduceScript(e,{directives:r,statements:u}){return u.length&&(u[0]=this.parenToAvoidBeingDirective(e.statements[0],u[0])),seq$1(...r,...u)}reduceSetter(e,{name:r,param:u,body:i}){return seq$1(t("set"),r,paren(u),i)}reduceShorthandProperty(e,{name:r}){return r}reduceStaticMemberAssignmentTarget(e,{object:r}){const u=seq$1(p(e.object,getPrecedence$2(e),r),t("."),t(e.property));return u.startsWithLet=r.startsWithLet,u.startsWithCurly=r.startsWithCurly,u.startsWithLetSquareBracket=r.startsWithLetSquareBracket,u.startsWithFunctionOrClass=r.startsWithFunctionOrClass,u}reduceStaticMemberExpression(e,{object:r}){const u=seq$1(p(e.object,getPrecedence$2(e),r),t("."),t(e.property));return u.startsWithLet=r.startsWithLet,u.startsWithCurly=r.startsWithCurly,u.startsWithLetSquareBracket=r.startsWithLetSquareBracket,u.startsWithFunctionOrClass=r.startsWithFunctionOrClass,u}reduceStaticPropertyName(e){if(keyword$1.isIdentifierNameES6(e.value))return t(e.value);let r=parseFloat(e.value);return r>=0&&r.toString()===e.value?new NumberCodeRep$2(r):t(escapeStringLiteral$2(e.value))}reduceSuper(){return t("super")}reduceSwitchCase(e,{test:r,consequent:u}){return seq$1(t("case"),r,t(":"),seq$1(...u))}reduceSwitchDefault(e,{consequent:r}){return seq$1(t("default:"),seq$1(...r))}reduceSwitchStatement(e,{discriminant:r,cases:u}){return seq$1(t("switch"),paren(r),brace(seq$1(...u)))}reduceSwitchStatementWithDefault(e,{discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n}){return seq$1(t("switch"),paren(r),brace(seq$1(...u,i,...n)))}reduceTemplateExpression(e,{tag:r,elements:u}){let i=e.tag==null?empty$1():p(e.tag,getPrecedence$2(e),r);i=seq$1(i,t("`"));for(let n=0,a=e.elements.length;n0?t("}"):empty$1(),u[n],ni?(i=!1,n):seq(this.sep(r),this.t(","),this.sep(u),n)),seq(...e)}semiOp(){return new SemiOp$1}sep(){return empty()}reduceArrayExpression(e,{elements:r}){if(r.length===0)return this.bracket(empty(),null,null,Sep$1.ARRAY_EMPTY);let u=this.commaSep(r.map(i=>this.getAssignmentExpr(i)),Sep$1.ARRAY_BEFORE_COMMA,Sep$1.ARRAY_AFTER_COMMA);return r.length>0&&r[r.length-1]==null&&(u=seq(u,this.sep(Sep$1.ARRAY_BEFORE_COMMA),this.t(","),this.sep(Sep$1.ARRAY_AFTER_COMMA))),this.bracket(u,Sep$1.ARRAY_INITIAL,Sep$1.ARRAY_FINAL)}reduceAwaitExpression(e,{expression:r}){return seq(this.t("await"),this.sep(Sep$1.AWAIT),this.p(e.expression,getPrecedence$1(e),r))}reduceSpreadElement(e,{expression:r}){return seq(this.t("..."),this.sep(Sep$1.SPREAD),this.p(e.expression,Precedence$1.Assignment,r))}reduceSpreadProperty(e,{expression:r}){return seq(this.t("..."),this.sep(Sep$1.SPREAD),this.getAssignmentExpr(r))}reduceAssignmentExpression(e,{binding:r,expression:u}){let i=r,n=u,a=u.containsIn,l=r.startsWithCurly,o=r.startsWithLetSquareBracket,c=r.startsWithFunctionOrClass;return getPrecedence$1(e.expression)this.getAssignmentExpr(n)),Sep$1.ARRAY_BEFORE_COMMA,Sep$1.ARRAY_AFTER_COMMA),r.length>0&&r[r.length-1]==null&&(i=seq(i,this.sep(Sep$1.ARRAY_BEFORE_COMMA),this.t(","),this.sep(Sep$1.ARRAY_AFTER_COMMA)))),this.bracket(i,Sep$1.ARRAY_INITIAL,Sep$1.ARRAY_FINAL,Sep$1.ARRAY_EMPTY)}reduceArrayBinding(e,{elements:r,rest:u}){let i;return r.length===0?i=u==null?empty():seq(this.t("..."),this.sep(Sep$1.REST),u):(r=r.concat(u==null?[]:[seq(this.t("..."),this.sep(Sep$1.REST),u)]),i=this.commaSep(r.map(n=>this.getAssignmentExpr(n)),Sep$1.ARRAY_BEFORE_COMMA,Sep$1.ARRAY_AFTER_COMMA),r.length>0&&r[r.length-1]==null&&(i=seq(i,this.sep(Sep$1.ARRAY_BEFORE_COMMA),this.t(","),this.sep(Sep$1.ARRAY_AFTER_COMMA)))),this.bracket(i,Sep$1.ARRAY_INITIAL,Sep$1.ARRAY_FINAL,Sep$1.ARRAY_EMPTY)}reduceObjectAssignmentTarget(e,{properties:r,rest:u}){let i;r.length===0?i=u==null?empty():seq(this.t("..."),this.sep(Sep$1.REST),u):(i=this.commaSep(r,Sep$1.OBJECT_BEFORE_COMMA,Sep$1.OBJECT_AFTER_COMMA),i=u==null?i:this.commaSep([i,seq(this.t("..."),this.sep(Sep$1.REST),u)],Sep$1.OBJECT_BEFORE_COMMA,Sep$1.OBJECT_AFTER_COMMA));let n=this.brace(i,e,Sep$1.OBJECT_BRACE_INITIAL,Sep$1.OBJECT_BRACE_FINAL,Sep$1.OBJECT_EMPTY);return n.startsWithCurly=!0,n}reduceObjectBinding(e,{properties:r,rest:u}){let i;r.length===0?i=u==null?empty():seq(this.t("..."),this.sep(Sep$1.REST),u):(i=this.commaSep(r,Sep$1.OBJECT_BEFORE_COMMA,Sep$1.OBJECT_AFTER_COMMA),i=u==null?i:this.commaSep([i,seq(this.t("..."),this.sep(Sep$1.REST),u)],Sep$1.OBJECT_BEFORE_COMMA,Sep$1.OBJECT_AFTER_COMMA));let n=this.brace(i,e,Sep$1.OBJECT_BRACE_INITIAL,Sep$1.OBJECT_BRACE_FINAL,Sep$1.OBJECT_EMPTY);return n.startsWithCurly=!0,n}reduceAssignmentTargetPropertyIdentifier(e,{binding:r,init:u}){return e.init==null?r:seq(r,this.sep(Sep$1.BEFORE_DEFAULT_EQUALS),this.t("="),this.sep(Sep$1.AFTER_DEFAULT_EQUALS),this.p(e.init,Precedence$1.Assignment,u))}reduceAssignmentTargetPropertyProperty(e,{name:r,binding:u}){return seq(r,this.sep(Sep$1.BEFORE_PROP),this.t(":"),this.sep(Sep$1.AFTER_PROP),u)}reduceBindingPropertyIdentifier(e,{binding:r,init:u}){return e.init==null?r:seq(r,this.sep(Sep$1.BEFORE_DEFAULT_EQUALS),this.t("="),this.sep(Sep$1.AFTER_DEFAULT_EQUALS),this.p(e.init,Precedence$1.Assignment,u))}reduceBindingPropertyProperty(e,{name:r,binding:u}){return seq(r,this.sep(Sep$1.BEFORE_PROP),this.t(":"),this.sep(Sep$1.AFTER_PROP),u)}reduceBlock(e,{statements:r}){return this.brace(seq(...r),e,Sep$1.BLOCK_BRACE_INITIAL,Sep$1.BLOCK_BRACE_FINAL,Sep$1.BLOCK_EMPTY)}reduceBlockStatement(e,{block:r}){return seq(r,this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceBreakStatement(e){return seq(this.t("break"),e.label?seq(this.sep(Sep$1.BEFORE_JUMP_LABEL),this.t(e.label)):empty(),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceCallExpression(e,{callee:r,arguments:u}){const i=u.map((n,a)=>this.p(e.arguments[a],Precedence$1.Assignment,n));return objectAssign(seq(this.p(e.callee,getPrecedence$1(e),r),this.sep(Sep$1.CALL),this.paren(this.commaSep(i,Sep$1.ARGS_BEFORE_COMMA,Sep$1.ARGS_AFTER_COMMA),Sep$1.CALL_PAREN_BEFORE,Sep$1.CALL_PAREN_AFTER,Sep$1.CALL_PAREN_EMPTY)),{startsWithCurly:r.startsWithCurly,startsWithLet:r.startsWithLet,startsWithLetSquareBracket:r.startsWithLetSquareBracket,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceCatchClause(e,{binding:r,body:u}){return r==null?seq(this.t("catch"),this.sep(Sep$1.BEFORE_CATCH_BINDING),u):seq(this.t("catch"),this.sep(Sep$1.BEFORE_CATCH_BINDING),this.paren(r,Sep$1.CATCH_PAREN_BEFORE,Sep$1.CATCH_PAREN_AFTER),this.sep(Sep$1.AFTER_CATCH_BINDING),u)}reduceClassDeclaration(e,{name:r,super:u,elements:i}){let n=seq(this.t("class"),e.name.name==="*default*"?empty():seq(this.sep(Sep$1.BEFORE_CLASS_NAME),r));return u!=null&&(n=seq(n,this.sep(Sep$1.BEFORE_EXTENDS),this.t("extends"),this.sep(Sep$1.AFTER_EXTENDS),this.p(e.super,Precedence$1.New,u))),n=seq(n,this.sep(Sep$1.BEFORE_CLASS_DECLARATION_ELEMENTS),this.brace(seq(...i),e,Sep$1.CLASS_BRACE_INITIAL,Sep$1.CLASS_BRACE_FINAL,Sep$1.CLASS_EMPTY),this.sep(Sep$1.AFTER_STATEMENT(e))),n}reduceClassExpression(e,{name:r,super:u,elements:i}){let n=this.t("class");return r!=null&&(n=seq(n,this.sep(Sep$1.BEFORE_CLASS_NAME),r)),u!=null&&(n=seq(n,this.sep(Sep$1.BEFORE_EXTENDS),this.t("extends"),this.sep(Sep$1.AFTER_EXTENDS),this.p(e.super,Precedence$1.New,u))),n=seq(n,this.sep(Sep$1.BEFORE_CLASS_EXPRESSION_ELEMENTS),this.brace(seq(...i),e,Sep$1.CLASS_EXPRESSION_BRACE_INITIAL,Sep$1.CLASS_EXPRESSION_BRACE_FINAL,Sep$1.CLASS_EXPRESSION_BRACE_EMPTY)),n.startsWithFunctionOrClass=!0,n}reduceClassElement(e,{method:r}){return r=seq(this.sep(Sep$1.BEFORE_CLASS_ELEMENT),r,this.sep(Sep$1.AFTER_CLASS_ELEMENT)),e.isStatic?seq(this.t("static"),this.sep(Sep$1.AFTER_STATIC),r):r}reduceComputedMemberAssignmentTarget(e,{object:r,expression:u}){let i=r.startsWithLetSquareBracket||e.object.type==="IdentifierExpression"&&e.object.name==="let";return objectAssign(seq(this.p(e.object,getPrecedence$1(e),r),this.sep(Sep$1.COMPUTED_MEMBER_ASSIGNMENT_TARGET),this.bracket(u,Sep$1.COMPUTED_MEMBER_ASSIGNMENT_TARGET_BRACKET_INTIAL,Sep$1.COMPUTED_MEMBER_ASSIGNMENT_TARGET_BRACKET_FINAL)),{startsWithLet:r.startsWithLet,startsWithLetSquareBracket:i,startsWithCurly:r.startsWithCurly,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceComputedMemberExpression(e,{object:r,expression:u}){let i=r.startsWithLetSquareBracket||e.object.type==="IdentifierExpression"&&e.object.name==="let";return objectAssign(seq(this.p(e.object,getPrecedence$1(e),r),this.sep(Sep$1.COMPUTED_MEMBER_EXPRESSION),this.bracket(u,Sep$1.COMPUTED_MEMBER_BRACKET_INTIAL,Sep$1.COMPUTED_MEMBER_BRACKET_FINAL)),{startsWithLet:r.startsWithLet,startsWithLetSquareBracket:i,startsWithCurly:r.startsWithCurly,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceComputedPropertyName(e,{expression:r}){return this.bracket(this.p(e.expression,Precedence$1.Assignment,r),Sep$1.COMPUTED_PROPERTY_BRACKET_INTIAL,Sep$1.COMPUTED_PROPERTY_BRACKET_FINAL)}reduceConditionalExpression(e,{test:r,consequent:u,alternate:i}){let n=r.containsIn||i.containsIn,a=r.startsWithCurly,l=r.startsWithLetSquareBracket,o=r.startsWithFunctionOrClass;return objectAssign(seq(this.p(e.test,Precedence$1.LogicalOR,r),this.sep(Sep$1.BEFORE_TERNARY_QUESTION),this.t("?"),this.sep(Sep$1.AFTER_TERNARY_QUESTION),this.p(e.consequent,Precedence$1.Assignment,u),this.sep(Sep$1.BEFORE_TERNARY_COLON),this.t(":"),this.sep(Sep$1.AFTER_TERNARY_COLON),this.p(e.alternate,Precedence$1.Assignment,i)),{containsIn:n,startsWithCurly:a,startsWithLetSquareBracket:l,startsWithFunctionOrClass:o})}reduceContinueStatement(e){return seq(this.t("continue"),e.label?seq(this.sep(Sep$1.BEFORE_JUMP_LABEL),this.t(e.label)):empty(),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceDataProperty(e,{name:r,expression:u}){return seq(r,this.sep(Sep$1.BEFORE_PROP),this.t(":"),this.sep(Sep$1.AFTER_PROP),this.getAssignmentExpr(u))}reduceDebuggerStatement(e){return seq(this.t("debugger"),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceDoWhileStatement(e,{body:r,test:u}){return seq(this.t("do"),this.sep(Sep$1.AFTER_DO),r,this.sep(Sep$1.BEFORE_DOWHILE_WHILE),this.t("while"),this.sep(Sep$1.AFTER_DOWHILE_WHILE),this.paren(u,Sep$1.DO_WHILE_TEST_PAREN_BEFORE,Sep$1.DO_WHILE_TEST_PAREN_AFTER),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceEmptyStatement(e){return seq(this.t(";"),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceExpressionStatement(e,{expression:r}){let u=r.startsWithCurly||r.startsWithLetSquareBracket||r.startsWithFunctionOrClass;return seq(u?this.paren(r,Sep$1.EXPRESSION_STATEMENT_PAREN_BEFORE,Sep$1.EXPRESSION_STATEMENT_PAREN_AFTER):r,this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceForInStatement(e,{left:r,right:u,body:i}){return r=e.left.type==="VariableDeclaration"?noIn(markContainsIn(r)):r,objectAssign(seq(this.t("for"),this.sep(Sep$1.AFTER_FORIN_FOR),this.paren(seq(r.startsWithLet?this.paren(r,Sep$1.FOR_IN_LET_PAREN_BEFORE,Sep$1.FOR_IN_LET_PAREN_AFTER):r,this.sep(Sep$1.BEFORE_FORIN_IN),this.t("in"),this.sep(Sep$1.AFTER_FORIN_FOR),u),Sep$1.FOR_IN_PAREN_BEFORE,Sep$1.FOR_IN_PAREN_AFTER),this.sep(Sep$1.BEFORE_FORIN_BODY),i,this.sep(Sep$1.AFTER_STATEMENT(e))),{endsWithMissingElse:i.endsWithMissingElse})}reduceForOfStatement(e,{left:r,right:u,body:i}){return r=e.left.type==="VariableDeclaration"?noIn(markContainsIn(r)):r,objectAssign(seq(this.t("for"),this.sep(Sep$1.AFTER_FOROF_FOR),this.paren(seq(r.startsWithLet?this.paren(r,Sep$1.FOR_OF_LET_PAREN_BEFORE,Sep$1.FOR_OF_LET_PAREN_AFTER):r,this.sep(Sep$1.BEFORE_FOROF_OF),this.t("of"),this.sep(Sep$1.AFTER_FOROF_FOR),this.p(e.right,Precedence$1.Assignment,u)),Sep$1.FOR_OF_PAREN_BEFORE,Sep$1.FOR_OF_PAREN_AFTER),this.sep(Sep$1.BEFORE_FOROF_BODY),i,this.sep(Sep$1.AFTER_STATEMENT(e))),{endsWithMissingElse:i.endsWithMissingElse})}reduceForStatement(e,{init:r,test:u,update:i,body:n}){return r&&(r.startsWithLetSquareBracket&&(r=this.paren(r,Sep$1.FOR_LET_PAREN_BEFORE,Sep$1.FOR_LET_PAREN_AFTER)),r=noIn(markContainsIn(r))),objectAssign(seq(this.t("for"),this.sep(Sep$1.AFTER_FOR_FOR),this.paren(seq(r?seq(this.sep(Sep$1.BEFORE_FOR_INIT),r,this.sep(Sep$1.AFTER_FOR_INIT)):this.sep(Sep$1.EMPTY_FOR_INIT),this.t(";"),u?seq(this.sep(Sep$1.BEFORE_FOR_TEST),u,this.sep(Sep$1.AFTER_FOR_TEST)):this.sep(Sep$1.EMPTY_FOR_TEST),this.t(";"),i?seq(this.sep(Sep$1.BEFORE_FOR_UPDATE),i,this.sep(Sep$1.AFTER_FOR_UPDATE)):this.sep(Sep$1.EMPTY_FOR_UPDATE))),this.sep(Sep$1.BEFORE_FOR_BODY),n,this.sep(Sep$1.AFTER_STATEMENT(e))),{endsWithMissingElse:n.endsWithMissingElse})}reduceForAwaitStatement(e,{left:r,right:u,body:i}){return r=e.left.type==="VariableDeclaration"?noIn(markContainsIn(r)):r,objectAssign(seq(this.t("for"),this.sep(Sep$1.AFTER_FOROF_FOR),this.t("await"),this.sep(Sep$1.AFTER_FORAWAIT_AWAIT),this.paren(seq(r.startsWithLet?this.paren(r,Sep$1.FOR_OF_LET_PAREN_BEFORE,Sep$1.FOR_OF_LET_PAREN_AFTER):r,this.sep(Sep$1.BEFORE_FOROF_OF),this.t("of"),this.sep(Sep$1.AFTER_FOROF_FOR),this.p(e.right,Precedence$1.Assignment,u)),Sep$1.FOR_OF_PAREN_BEFORE,Sep$1.FOR_OF_PAREN_AFTER),this.sep(Sep$1.BEFORE_FOROF_BODY),i,this.sep(Sep$1.AFTER_STATEMENT(e))),{endsWithMissingElse:i.endsWithMissingElse})}reduceFunctionBody(e,{directives:r,statements:u}){return u.length&&(u[0]=this.parenToAvoidBeingDirective(e.statements[0],u[0])),seq(...r,r.length?this.sep(Sep$1.AFTER_FUNCTION_DIRECTIVES):empty(),...u)}reduceFunctionDeclaration(e,{name:r,params:u,body:i}){return seq(e.isAsync?this.t("async"):empty(),this.t("function"),e.isGenerator?seq(this.sep(Sep$1.BEFORE_GENERATOR_STAR),this.t("*"),this.sep(Sep$1.AFTER_GENERATOR_STAR)):empty(),this.sep(Sep$1.BEFORE_FUNCTION_NAME(e)),e.name.name==="*default*"?empty():r,this.sep(Sep$1.BEFORE_FUNCTION_PARAMS),this.paren(u,Sep$1.PARAMETERS_PAREN_BEFORE,Sep$1.PARAMETERS_PAREN_AFTER,Sep$1.PARAMETERS_PAREN_EMPTY),this.sep(Sep$1.BEFORE_FUNCTION_DECLARATION_BODY),this.brace(i,e,Sep$1.FUNCTION_BRACE_INITIAL,Sep$1.FUNCTION_BRACE_FINAL,Sep$1.FUNCTION_EMPTY),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceFunctionExpression(e,{name:r,params:u,body:i}){let n=seq(e.isAsync?this.t("async"):empty(),this.t("function"),e.isGenerator?seq(this.sep(Sep$1.BEFORE_GENERATOR_STAR),this.t("*"),this.sep(Sep$1.AFTER_GENERATOR_STAR)):empty(),this.sep(Sep$1.BEFORE_FUNCTION_NAME(e)),r||empty(),this.sep(Sep$1.BEFORE_FUNCTION_PARAMS),this.paren(u,Sep$1.PARAMETERS_PAREN_BEFORE,Sep$1.PARAMETERS_PAREN_AFTER,Sep$1.PARAMETERS_PAREN_EMPTY),this.sep(Sep$1.BEFORE_FUNCTION_EXPRESSION_BODY),this.brace(i,e,Sep$1.FUNCTION_EXPRESSION_BRACE_INITIAL,Sep$1.FUNCTION_EXPRESSION_BRACE_FINAL,Sep$1.FUNCTION_EXPRESSION_EMPTY));return n.startsWithFunctionOrClass=!0,n}reduceFormalParameters(e,{items:r,rest:u}){return this.commaSep(r.concat(u==null?[]:[seq(this.t("..."),this.sep(Sep$1.REST),u)]),Sep$1.PARAMETER_BEFORE_COMMA,Sep$1.PARAMETER_AFTER_COMMA)}reduceArrowExpression(e,{params:r,body:u}){(e.params.rest!=null||e.params.items.length!==1||e.params.items[0].type!=="BindingIdentifier")&&(r=this.paren(r,Sep$1.ARROW_PARAMETERS_PAREN_BEFORE,Sep$1.ARROW_PARAMETERS_PAREN_AFTER,Sep$1.ARROW_PARAMETERS_PAREN_EMPTY));let i=!1;return e.body.type==="FunctionBody"?u=this.brace(u,e,Sep$1.ARROW_BRACE_INITIAL,Sep$1.ARROW_BRACE_FINAL,Sep$1.ARROW_BRACE_EMPTY):u.startsWithCurly?u=this.paren(u,Sep$1.ARROW_BODY_PAREN_BEFORE,Sep$1.ARROW_BODY_PAREN_AFTER):u.containsIn&&(i=!0),objectAssign(seq(e.isAsync?seq(this.t("async"),this.sep(Sep$1.BEFORE_ARROW_ASYNC_PARAMS)):empty(),r,this.sep(Sep$1.BEFORE_ARROW),this.t("=>"),this.sep(Sep$1.AFTER_ARROW),this.p(e.body,Precedence$1.Assignment,u)),{containsIn:i})}reduceGetter(e,{name:r,body:u}){return seq(this.t("get"),this.sep(Sep$1.AFTER_GET),r,this.sep(Sep$1.BEFORE_GET_PARAMS),this.paren(empty(),null,null,Sep$1.GETTER_PARAMS),this.sep(Sep$1.BEFORE_GET_BODY),this.brace(u,e,Sep$1.GET_BRACE_INTIAL,Sep$1.GET_BRACE_FINAL,Sep$1.GET_BRACE_EMPTY))}reduceIdentifierExpression(e){let r=this.t(e.name);return e.name==="let"&&(r.startsWithLet=!0),r}reduceIfStatement(e,{test:r,consequent:u,alternate:i}){return i&&u.endsWithMissingElse&&(u=this.brace(u,e,Sep$1.MISSING_ELSE_INTIIAL,Sep$1.MISSING_ELSE_FINAL,Sep$1.MISSING_ELSE_EMPTY)),objectAssign(seq(this.t("if"),this.sep(Sep$1.AFTER_IF),this.paren(r,Sep$1.IF_PAREN_BEFORE,Sep$1.IF_PAREN_AFTER),this.sep(Sep$1.AFTER_IF_TEST),u,i?seq(this.sep(Sep$1.BEFORE_ELSE),this.t("else"),this.sep(Sep$1.AFTER_ELSE),i):empty(),this.sep(Sep$1.AFTER_STATEMENT(e))),{endsWithMissingElse:i?i.endsWithMissingElse:!0})}reduceImport(e,{defaultBinding:r,namedImports:u}){let i=[];return r!=null&&i.push(r),u.length>0&&i.push(this.brace(this.commaSep(u,Sep$1.NAMED_IMPORT_BEFORE_COMMA,Sep$1.NAMED_IMPORT_AFTER_COMMA),e,Sep$1.IMPORT_BRACE_INTIAL,Sep$1.IMPORT_BRACE_FINAL,Sep$1.IMPORT_BRACE_EMPTY)),i.length===0?seq(this.t("import"),this.sep(Sep$1.BEFORE_IMPORT_MODULE),this.t(escapeStringLiteral$1(e.moduleSpecifier)),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e))):seq(this.t("import"),this.sep(Sep$1.BEFORE_IMPORT_BINDINGS),this.commaSep(i,Sep$1.IMPORT_BEFORE_COMMA,Sep$1.IMPORT_AFTER_COMMA),this.sep(Sep$1.AFTER_IMPORT_BINDINGS),this.t("from"),this.sep(Sep$1.AFTER_FROM),this.t(escapeStringLiteral$1(e.moduleSpecifier)),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceImportNamespace(e,{defaultBinding:r,namespaceBinding:u}){return seq(this.t("import"),this.sep(Sep$1.BEFORE_IMPORT_NAMESPACE),r==null?empty():seq(r,this.sep(Sep$1.IMPORT_BEFORE_COMMA),this.t(","),this.sep(Sep$1.IMPORT_AFTER_COMMA)),this.sep(Sep$1.BEFORE_IMPORT_STAR),this.t("*"),this.sep(Sep$1.AFTER_IMPORT_STAR),this.t("as"),this.sep(Sep$1.AFTER_IMPORT_AS),u,this.sep(Sep$1.AFTER_NAMESPACE_BINDING),this.t("from"),this.sep(Sep$1.AFTER_FROM),this.t(escapeStringLiteral$1(e.moduleSpecifier)),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceImportSpecifier(e,{binding:r}){return e.name==null?r:seq(this.t(e.name),this.sep(Sep$1.BEFORE_IMPORT_AS),this.t("as"),this.sep(Sep$1.AFTER_IMPORT_AS),r)}reduceExportAllFrom(e){return seq(this.t("export"),this.sep(Sep$1.BEFORE_EXPORT_STAR),this.t("*"),this.sep(Sep$1.AFTER_EXPORT_STAR),this.t("from"),this.sep(Sep$1.AFTER_FROM),this.t(escapeStringLiteral$1(e.moduleSpecifier)),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceExportFrom(e,{namedExports:r}){return seq(this.t("export"),this.sep(Sep$1.BEFORE_EXPORT_BINDINGS),this.brace(this.commaSep(r,Sep$1.EXPORTS_BEFORE_COMMA,Sep$1.EXPORTS_AFTER_COMMA),e,Sep$1.EXPORT_BRACE_INITIAL,Sep$1.EXPORT_BRACE_FINAL,Sep$1.EXPORT_BRACE_EMPTY),this.sep(Sep$1.AFTER_EXPORT_FROM_BINDINGS),this.t("from"),this.sep(Sep$1.AFTER_FROM),this.t(escapeStringLiteral$1(e.moduleSpecifier)),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceExportLocals(e,{namedExports:r}){return seq(this.t("export"),this.sep(Sep$1.BEFORE_EXPORT_BINDINGS),this.brace(this.commaSep(r,Sep$1.EXPORTS_BEFORE_COMMA,Sep$1.EXPORTS_AFTER_COMMA),e,Sep$1.EXPORT_BRACE_INITIAL,Sep$1.EXPORT_BRACE_FINAL,Sep$1.EXPORT_BRACE_EMPTY),this.sep(Sep$1.AFTER_EXPORT_LOCAL_BINDINGS),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceExport(e,{declaration:r}){switch(e.declaration.type){case"FunctionDeclaration":case"ClassDeclaration":break;default:r=seq(r,this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}return seq(this.t("export"),this.sep(Sep$1.AFTER_EXPORT),r)}reduceExportDefault(e,{body:r}){switch(r=r.startsWithFunctionOrClass?this.paren(r,Sep$1.EXPORT_PAREN_BEFORE,Sep$1.EXPORT_PAREN_AFTER):r,e.body.type){case"FunctionDeclaration":case"ClassDeclaration":return seq(this.t("export"),this.sep(Sep$1.EXPORT_DEFAULT),this.t("default"),this.sep(Sep$1.AFTER_EXPORT_DEFAULT),r);default:return seq(this.t("export"),this.sep(Sep$1.EXPORT_DEFAULT),this.t("default"),this.sep(Sep$1.AFTER_EXPORT_DEFAULT),this.p(e.body,Precedence$1.Assignment,r),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}}reduceExportFromSpecifier(e){return e.exportedName==null?this.t(e.name):seq(this.t(e.name),this.sep(Sep$1.BEFORE_EXPORT_AS),this.t("as"),this.sep(Sep$1.AFTER_EXPORT_AS),this.t(e.exportedName))}reduceExportLocalSpecifier(e,{name:r}){return e.exportedName==null?r:seq(r,this.sep(Sep$1.BEFORE_EXPORT_AS),this.t("as"),this.sep(Sep$1.AFTER_EXPORT_AS),this.t(e.exportedName))}reduceLabeledStatement(e,{body:r}){return objectAssign(seq(this.t(e.label),this.sep(Sep$1.BEFORE_LABEL_COLON),this.t(":"),this.sep(Sep$1.AFTER_LABEL_COLON),r),{endsWithMissingElse:r.endsWithMissingElse})}reduceLiteralBooleanExpression(e){return this.t(e.value.toString())}reduceLiteralNullExpression(){return this.t("null")}reduceLiteralInfinityExpression(){return this.t("2e308")}reduceLiteralNumericExpression(e){return new NumberCodeRep$1(e.value)}reduceLiteralRegExpExpression(e){return this.t(`/${e.pattern}/${e.global?"g":""}${e.ignoreCase?"i":""}${e.multiLine?"m":""}${e.dotAll?"s":""}${e.unicode?"u":""}${e.sticky?"y":""}`,!0)}reduceLiteralStringExpression(e){return this.t(escapeStringLiteral$1(e.value))}reduceMethod(e,{name:r,params:u,body:i}){return seq(e.isAsync?seq(this.t("async"),this.sep(Sep$1.AFTER_METHOD_ASYNC)):empty(),e.isGenerator?seq(this.t("*"),this.sep(Sep$1.AFTER_METHOD_GENERATOR_STAR)):empty(),r,this.sep(Sep$1.AFTER_METHOD_NAME),this.paren(u,Sep$1.PARAMETERS_PAREN_BEFORE,Sep$1.PARAMETERS_PAREN_AFTER,Sep$1.PARAMETERS_PAREN_EMPTY),this.sep(Sep$1.BEFORE_METHOD_BODY),this.brace(i,e,Sep$1.METHOD_BRACE_INTIAL,Sep$1.METHOD_BRACE_FINAL,Sep$1.METHOD_BRACE_EMPTY))}reduceModule(e,{directives:r,items:u}){return u.length&&(u[0]=this.parenToAvoidBeingDirective(e.items[0],u[0])),seq(...r,r.length?this.sep(Sep$1.AFTER_MODULE_DIRECTIVES):empty(),...u)}reduceNewExpression(e,{callee:r,arguments:u}){const i=u.map((a,l)=>this.p(e.arguments[l],Precedence$1.Assignment,a));let n=getPrecedence$1(e.callee)===Precedence$1.Call?this.paren(r,Sep$1.NEW_CALLEE_PAREN_BEFORE,Sep$1.NEW_CALLEE_PAREN_AFTER):this.p(e.callee,getPrecedence$1(e),r);return seq(this.t("new"),this.sep(Sep$1.AFTER_NEW),n,u.length===0?this.sep(Sep$1.EMPTY_NEW_CALL):seq(this.sep(Sep$1.BEFORE_NEW_ARGS),this.paren(this.commaSep(i,Sep$1.ARGS_BEFORE_COMMA,Sep$1.ARGS_AFTER_COMMA),Sep$1.NEW_PAREN_BEFORE,Sep$1.NEW_PAREN_AFTER,Sep$1.NEW_PAREN_EMPTY)))}reduceNewTargetExpression(){return seq(this.t("new"),this.sep(Sep$1.NEW_TARGET_BEFORE_DOT),this.t("."),this.sep(Sep$1.NEW_TARGET_AFTER_DOT),this.t("target"))}reduceObjectExpression(e,{properties:r}){let u=this.brace(this.commaSep(r,Sep$1.OBJECT_BEFORE_COMMA,Sep$1.OBJECT_AFTER_COMMA),e,Sep$1.OBJECT_BRACE_INITIAL,Sep$1.OBJECT_BRACE_FINAL,Sep$1.OBJECT_EMPTY);return u.startsWithCurly=!0,u}reduceUpdateExpression(e,{operand:r}){return e.isPrefix?this.reduceUnaryExpression(...arguments):objectAssign(seq(this.p(e.operand,Precedence$1.New,r),this.sep(Sep$1.BEFORE_POSTFIX(e.operator)),this.t(e.operator)),{startsWithCurly:r.startsWithCurly,startsWithLetSquareBracket:r.startsWithLetSquareBracket,startsWithFunctionOrClass:r.startsWithFunctionOrClass})}reduceUnaryExpression(e,{operand:r}){return seq(this.t(e.operator),this.sep(Sep$1.UNARY(e.operator)),this.p(e.operand,getPrecedence$1(e),r))}reduceReturnStatement(e,{expression:r}){return seq(this.t("return"),r?seq(this.sep(Sep$1.RETURN),r):empty(),this.semiOp(),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceScript(e,{directives:r,statements:u}){return u.length&&(u[0]=this.parenToAvoidBeingDirective(e.statements[0],u[0])),seq(...r,r.length?this.sep(Sep$1.AFTER_SCRIPT_DIRECTIVES):empty(),...u)}reduceSetter(e,{name:r,param:u,body:i}){return seq(this.t("set"),this.sep(Sep$1.AFTER_SET),r,this.sep(Sep$1.BEFORE_SET_PARAMS),this.paren(u,Sep$1.SETTER_PARAM_BEFORE,Sep$1.SETTER_PARAM_AFTER),this.sep(Sep$1.BEFORE_SET_BODY),this.brace(i,e,Sep$1.SET_BRACE_INTIIAL,Sep$1.SET_BRACE_FINAL,Sep$1.SET_BRACE_EMPTY))}reduceShorthandProperty(e,{name:r}){return r}reduceStaticMemberAssignmentTarget(e,{object:r}){const u=seq(this.p(e.object,getPrecedence$1(e),r),this.sep(Sep$1.BEFORE_STATIC_MEMBER_ASSIGNMENT_TARGET_DOT),this.t("."),this.sep(Sep$1.AFTER_STATIC_MEMBER_ASSIGNMENT_TARGET_DOT),this.t(e.property));return u.startsWithLet=r.startsWithLet,u.startsWithCurly=r.startsWithCurly,u.startsWithLetSquareBracket=r.startsWithLetSquareBracket,u.startsWithFunctionOrClass=r.startsWithFunctionOrClass,u}reduceStaticMemberExpression(e,{object:r}){const u=seq(this.p(e.object,getPrecedence$1(e),r),this.sep(Sep$1.BEFORE_STATIC_MEMBER_DOT),this.t("."),this.sep(Sep$1.AFTER_STATIC_MEMBER_DOT),this.t(e.property));return u.startsWithLet=r.startsWithLet,u.startsWithCurly=r.startsWithCurly,u.startsWithLetSquareBracket=r.startsWithLetSquareBracket,u.startsWithFunctionOrClass=r.startsWithFunctionOrClass,u}reduceStaticPropertyName(e){if(keyword.isIdentifierNameES6(e.value))return this.t(e.value);let r=parseFloat(e.value);return r>=0&&r.toString()===e.value?new NumberCodeRep$1(r):this.t(escapeStringLiteral$1(e.value))}reduceSuper(){return this.t("super")}reduceSwitchCase(e,{test:r,consequent:u}){return seq(this.t("case"),this.sep(Sep$1.BEFORE_CASE_TEST),r,this.sep(Sep$1.AFTER_CASE_TEST),this.t(":"),this.sep(Sep$1.BEFORE_CASE_BODY),seq(...u),this.sep(Sep$1.AFTER_CASE_BODY))}reduceSwitchDefault(e,{consequent:r}){return seq(this.t("default"),this.sep(Sep$1.DEFAULT),this.t(":"),this.sep(Sep$1.BEFORE_CASE_BODY),seq(...r),this.sep(Sep$1.AFTER_DEFAULT_BODY))}reduceSwitchStatement(e,{discriminant:r,cases:u}){return seq(this.t("switch"),this.sep(Sep$1.BEFORE_SWITCH_DISCRIM),this.paren(r,Sep$1.SWITCH_DISCRIM_PAREN_BEFORE,Sep$1.SWITCH_DISCRIM_PAREN_AFTER),this.sep(Sep$1.BEFORE_SWITCH_BODY),this.brace(seq(...u),e,Sep$1.SWITCH_BRACE_INTIAL,Sep$1.SWITCH_BRACE_FINAL,Sep$1.SWITCH_BRACE_EMPTY),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceSwitchStatementWithDefault(e,{discriminant:r,preDefaultCases:u,defaultCase:i,postDefaultCases:n}){return seq(this.t("switch"),this.sep(Sep$1.BEFORE_SWITCH_DISCRIM),this.paren(r,Sep$1.SWITCH_DISCRIM_PAREN_BEFORE,Sep$1.SWITCH_DISCRIM_PAREN_AFTER),this.sep(Sep$1.BEFORE_SWITCH_BODY),this.brace(seq(...u,i,...n),e,Sep$1.SWITCH_BRACE_INTIAL,Sep$1.SWITCH_BRACE_FINAL,Sep$1.SWITCH_BRACE_EMPTY),this.sep(Sep$1.AFTER_STATEMENT(e)))}reduceTemplateExpression(e,{tag:r,elements:u}){let i=e.tag==null?empty():seq(this.p(e.tag,getPrecedence$1(e),r),this.sep(Sep$1.TEMPLATE_TAG));i=seq(i,this.t("`"));for(let n=0,a=e.elements.length;n0&&(l+="}"),l+=e.elements[n].rawValue,n{u.locations.set(e,{start:{line:1,column:0,offset:0},end:null}),r(u,...i),u.locations.get(e).end={line:u.line,column:u.column,offset:u.result.length}}:e.type==="LiteralNumericExpression"?s.emit=(u,...i)=>{u.startEmit(e),r(u,...i),u.finishEmit(e),u.lastNumberNode=e}:s.emit=(u,...i)=>{u.startEmit(e),r(u,...i),u.finishEmit(e)},s}function addLocationToReducer(s){const e=adapt(addLocation,s),r=e.regenerateArrowParams.bind(e);e.regenerateArrowParams=function(i,n){const a=r(i,n);return a!==n&&addLocation(a,i),a};const u=e.parenToAvoidBeingDirective.bind(e);return e.parenToAvoidBeingDirective=function(i,n){const a=u(i,n);return a!==n&&addLocation(a,i),a},e}function codeGenWithLocation$1(s,e=new MinimalCodeGen$1){let r=new TokenStreamWithLocation;return reduce$1(addLocationToReducer(e),s).emit(r),{source:r.result,locations:r.locations}}var withLocation=codeGenWithLocation$1;const reduce=src$2.default,{TokenStream}=tokenStream,MinimalCodeGen=minimalCodegen;function codeGen(s,e=new MinimalCodeGen){let r=new TokenStream;return reduce(e,s).emit(r),r.result}const{ExtensibleCodeGen,FormattedCodeGen,Sep}=formattedCodegen,{Precedence,getPrecedence,escapeStringLiteral,CodeRep,Empty,Token,NumberCodeRep,Paren,Bracket,Brace,NoIn,ContainsIn,Seq,Semi,CommaSep,SemiOp}=coderep,codeGenWithLocation=withLocation;var src={default:codeGen,codeGen,MinimalCodeGen,ExtensibleCodeGen,FormattedCodeGen,Sep,Precedence,getPrecedence,escapeStringLiteral,CodeRep,Empty,Token,NumberCodeRep,Paren,Bracket,Brace,NoIn,ContainsIn,Seq,Semi,CommaSep,SemiOp,codeGenWithLocation};const{replace}=estraverse,codegen=src.default||src,{Pattern}=strudel,isNote=s=>/^[a-gC-G][bs]?[0-9]$/.test(s),shapeshifter=s=>{const{code:e,addReturn:r}=wrapAsync(s),u=src$1.parseScriptWithLocation(disguiseImports(e)),i=[],n=[],a=replace(u.tree,{enter(o,c){var f,E,D;if(n.push(c),n.some(h=>i.includes(h)))return o;if(isBackTickString(o))return minifyWithLocation(o,o,u.locations,i);if(((f=o.directives)==null?void 0:f.length)===1&&!((E=o.statements)!=null&&E.length)){const h=new LiteralStringExpression({value:o.directives[0].rawValue}),y=minifyWithLocation(h,o.directives[0],u.locations,i);return{...o,directives:[],statements:[y]}}if(isStringWithDoubleQuotes(o,u.locations,e))return minifyWithLocation(o,o,u.locations,i);const d={"*":"fast","/":"slow","&":"stack","&&":"append"};if(o.type==="BinaryExpression"&&d[o.operator]&&["LiteralNumericExpression","LiteralStringExpression","IdentifierExpression"].includes((D=o.right)==null?void 0:D.type)&&canBeOverloaded(o.left)){let h=o.left;return o.left.type==="IdentifierExpression"&&(h=wrapFunction("reify",o.left)),new CallExpression({callee:new StaticMemberExpression({property:d[o.operator],object:wrapFunction("reify",h)}),arguments:[o.right]})}const m=isPatternArg(n)||hasModifierCall(c);if(o.type==="CallExpression"&&o.callee.name==="pure"){const h=o.arguments[0];return reifyWithLocation(h,o.arguments[0],u.locations,i)}if(o.type==="IdentifierExpression"){if(isNote(o.name)){const h=o.name[1]==="s"?o.name.replace("s","#"):o.name;return m?reifyWithLocation(new LiteralStringExpression({value:h}),o,u.locations,i):new LiteralStringExpression({value:h})}if(o.name==="r")return new IdentifierExpression({name:"silence"})}return["LiteralStringExpression"].includes(o.type)&&m?reifyWithLocation(o,o,u.locations,i):addMiniNotationLocations(o,u.locations,i)},leave(){n.pop()}});return r(a),undisguiseImports(codegen(a))};function disguiseImports(s){return s.replaceAll("import","_mport")}function undisguiseImports(s){return s.replaceAll("_mport","import")}function wrapAsync(s){return s=`(async () => { -${s} -})()`,{code:s,addReturn:r=>{const u=r.statements[0].expression.callee.body;u.statements=u.statements.slice(0,-1).concat([new ReturnStatement({expression:u.statements.slice(-1)[0]})])}}}function addMiniNotationLocations(s,e,r){const u=["mini","m"];if(s.type==="CallExpression"&&u.includes(s.callee.name)){if(s.arguments.length>1)return console.warn("multi arg mini locations not supported yet..."),s;const i=s.arguments[0];return minifyWithLocation(i,i,e,r)}return s.type==="StaticMemberExpression"&&u.includes(s.property)?minifyWithLocation(s.object,s,e,r):s}function wrapFunction(s,...e){return new CallExpression({callee:new IdentifierExpression({name:s}),arguments:e})}function isBackTickString(s){return s.type==="TemplateExpression"&&s.elements.length===1}function isStringWithDoubleQuotes(s,e,r){if(s.type!=="LiteralStringExpression")return!1;const u=e.get(s);return r.slice(u.start.offset,u.end.offset)[0]==='"'}function isPatternArg(s){if(!s.length)return!1;const e=s.slice(0,-1),r=s[s.length-1];return isPatternFactory(r)?!0:(r==null?void 0:r.type)==="ArrayExpression"?isPatternArg(e):!1}function hasModifierCall(s){return(s==null?void 0:s.type)==="StaticMemberExpression"&&Object.keys(Pattern.prototype.composable).includes(s.property)}const factories=Object.keys(Pattern.prototype.factories).concat(["mini"]);function isPatternFactory(s){return(s==null?void 0:s.type)==="CallExpression"&&factories.includes(s.callee.name)}function canBeOverloaded(s){return s.type==="IdentifierExpression"&&isNote(s.name)||isPatternFactory(s)}function reifyWithLocation(s,e,r,u){const i=getLocationArguments(e,r),n=new CallExpression({callee:new StaticMemberExpression({object:wrapFunction("reify",s),property:"withLocation"}),arguments:i});return u.push(n),n}function minifyWithLocation(s,e,r,u){const i=getLocationArguments(e,r),n=wrapFunction("mini",s),a=new CallExpression({callee:new StaticMemberExpression({object:n,property:"withMiniLocation"}),arguments:i});return u.push(a),a}function getLocationArguments(s,e){const r=e.get(s),u=-1;return[new ArrayExpression({elements:[new LiteralNumericExpression({value:r.start.line+u}),new LiteralNumericExpression({value:r.start.column}),new LiteralNumericExpression({value:r.start.offset})]}),new ArrayExpression({elements:[new LiteralNumericExpression({value:r.end.line+u}),new LiteralNumericExpression({value:r.end.column}),new LiteralNumericExpression({value:r.end.offset})]})]}const tune=`await samples('github:tidalcycles/Dirt-Samples/master') - -stack( - // amen - n("0 1 2 3 4 5 6 7") - .sometimes(x=>x.ply(2)) - .rarely(x=>x.speed("2 | -2")) - .sometimesBy(.4, x=>x.delay(".5")) - .s("amencutup") - .slow(2) - .room(.5) - , - // bass - sine.add(saw.slow(4)).range(0,7).segment(8) - .superimpose(x=>x.add(.1)) - .scale('G0 minor').note() - .s("sawtooth").decay(.1).sustain(0) - .gain(.4).cutoff(perlin.range(300,3000).slow(8)).resonance(10) - .degradeBy("0 0.1 .5 .1") - .rarely(add(note("12"))) - , - // chord - note("Bb3,D4".superimpose(x=>x.add(.2))) - .s('sawtooth').cutoff(1000).struct("<~@3 [~ x]>") - .decay(.05).sustain(.0).delay(.8).delaytime(.125).room(.8) - , - // alien - s("breath").room(1).shape(.6).chop(16).rev().mask("") - , - n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5)) -).reset("")`,ctx=getAudioContext$1(),input=document.getElementById("text");input.innerHTML=tune;evalScope(controls,__vitePreload(()=>Promise.resolve().then(()=>strudel),void 0),__vitePreload(()=>import("./index.d9f8bbbd.js"),[]),__vitePreload(()=>import("./index.b66fb637.js"),[]),__vitePreload(()=>import("./index.66252a18.js"),[]));const{evaluate}=repl({defaultOutput:webaudioOutput,getTime:()=>ctx.currentTime,transpiler:shapeshifter});document.getElementById("start").addEventListener("click",()=>{ctx.resume(),evaluate(input.value)});export{Hap as H,Pattern$3 as P,webaudioOutputTrigger as a,getCachedBuffer as b,chooseInWith as c,reverseBuffer as d,getLoadedBuffer as e,loadGithubSamples as f,getAudioContext$1 as g,samples as h,resetLoadedSamples as i,getLoadedSamples$1 as j,getAugmentedNamespace as k,loadBuffer as l,mod as m,commonjsGlobal as n,getDefaultExportFromCjs as o,panic as p,reify$1 as q,rand as r,strudel as s,stack as t,webaudioOutput as w}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/index.html b/packages/core/examples/vite-vanilla-repl/dist/index.html index 891d3a80..614a6b6c 100644 --- a/packages/core/examples/vite-vanilla-repl/dist/index.html +++ b/packages/core/examples/vite-vanilla-repl/dist/index.html @@ -4,7 +4,7 @@ Vite Vanilla Strudel REPL - +
diff --git a/packages/core/examples/vite-vanilla-repl/main.js b/packages/core/examples/vite-vanilla-repl/main.js index d0497e79..72d80b92 100644 --- a/packages/core/examples/vite-vanilla-repl/main.js +++ b/packages/core/examples/vite-vanilla-repl/main.js @@ -1,6 +1,7 @@ -import { controls, repl, evalScope } from '@strudel.cycles/core'; +import { controls, repl, evalScope, setStringParser } from '@strudel.cycles/core'; +import { mini } from '@strudel.cycles/mini'; import { getAudioContext, webaudioOutput } from '@strudel.cycles/webaudio'; -import shapeshifter from '@strudel.cycles/eval/shapeshifter.mjs'; +// import { transpiler } from '@strudel.cycles/transpiler'; import tune from './tune.mjs'; const ctx = getAudioContext(); @@ -15,10 +16,12 @@ evalScope( import('@strudel.cycles/tonal'), ); +setStringParser(mini) + const { evaluate } = repl({ defaultOutput: webaudioOutput, getTime: () => ctx.currentTime, - transpiler: shapeshifter, + // transpiler, }); document.getElementById('start').addEventListener('click', () => { ctx.resume(); diff --git a/packages/core/examples/vite-vanilla-repl/package.json b/packages/core/examples/vite-vanilla-repl/package.json index c53bb411..b1a5f0f6 100644 --- a/packages/core/examples/vite-vanilla-repl/package.json +++ b/packages/core/examples/vite-vanilla-repl/package.json @@ -5,10 +5,11 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build --base /tidalcycles/strudel/general-purpose-scheduler/packages/core/examples/vite-vanilla-repl/dist/", + "build-githack": "vite build --base /tidalcycles/strudel/use-acorn/packages/core/examples/vite-vanilla-repl/dist/", + "build": "vite build", "preview": "vite preview" }, "devDependencies": { "vite": "^3.2.0" } -} \ No newline at end of file +} diff --git a/packages/core/examples/vite-vanilla-repl/tune.mjs b/packages/core/examples/vite-vanilla-repl/tune.mjs index acdc0a62..88e8a7fe 100644 --- a/packages/core/examples/vite-vanilla-repl/tune.mjs +++ b/packages/core/examples/vite-vanilla-repl/tune.mjs @@ -1,4 +1,4 @@ -export default `await samples('github:tidalcycles/Dirt-Samples/master') +/* export default `await samples('github:tidalcycles/Dirt-Samples/master') stack( // amen @@ -29,3 +29,11 @@ stack( , n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5)) ).reset("")`; + */ + +export default `stack( + n("c3 [eb3,g3]") + .delay("<0 .5>") + .delaytime(".16 | .33") + .delayfeedback(".6 | .8") +).sometimes(x=>x.speed("-1"))`; diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 0214ce41..3db6d720 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -13,6 +13,12 @@ import { unionWithObj } from './value.mjs'; import { compose, removeUndefineds, flatten, id, listRange, curry, mod, numeralArgs, parseNumeral } from './util.mjs'; import drawLine from './drawLine.mjs'; +let stringParser; +// parser is expected to turn a string into a pattern +// if set, the reify function will parse all strings with it +// intended to use with mini to automatically interpret all strings as mini notation +export const setStringParser = (parser) => (stringParser = parser); + /** @class Class representing a pattern. */ export class Pattern { _Pattern = true; // this property is used to detect if a pattern that fails instanceof Pattern is an instance of another Pattern @@ -1561,6 +1567,9 @@ export function reify(thing) { if (isPattern(thing)) { return thing; } + if (stringParser && typeof thing === 'string') { + return stringParser(thing); + } return pure(thing); } diff --git a/packages/eval/shapeshifter.mjs b/packages/eval/shapeshifter.mjs index 500eb0ea..b8ffffd3 100644 --- a/packages/eval/shapeshifter.mjs +++ b/packages/eval/shapeshifter.mjs @@ -30,7 +30,8 @@ const isNote = (name) => /^[a-gC-G][bs]?[0-9]$/.test(name); const addLocations = true; export const addMiniLocations = true; export const minifyStrings = true; -export const wrappedAsync = true; +export const wrappedAsync = false; // this is now handled by core evaluate by default +export const shouldAddReturn = true; export default (_code) => { const { code, addReturn } = wrapAsync(_code); @@ -125,7 +126,7 @@ export default (_code) => { }, }); // add return to last statement (because it's wrapped in an async function artificially) - if (wrappedAsync) { + if (shouldAddReturn) { addReturn(shifted); } const generated = undisguiseImports(codegen(shifted)); @@ -153,7 +154,7 @@ ${code} })()`; } const addReturn = (ast) => { - const body = ast.statements[0].expression.callee.body; // actual code ast inside async function body + const body = wrappedAsync ? ast.statements[0].expression.callee.body : ast; body.statements = body.statements .slice(0, -1) .concat([new ReturnStatement({ expression: body.statements.slice(-1)[0] })]); diff --git a/packages/eval/test/shapeshifter.test.mjs b/packages/eval/test/shapeshifter.test.mjs index 39d9d715..ae958326 100644 --- a/packages/eval/test/shapeshifter.test.mjs +++ b/packages/eval/test/shapeshifter.test.mjs @@ -5,15 +5,21 @@ This program is free software: you can redistribute it and/or modify it under th */ import { describe, it, expect } from 'vitest'; -import shapeshifter from '../shapeshifter.mjs'; +import shapeshifter, { wrappedAsync } from '../shapeshifter.mjs'; describe('shapeshifter', () => { it('Should shift simple double quote string', () => { - expect(shapeshifter('"c3"')).toEqual('(async()=>{return mini("c3").withMiniLocation([1,0,15],[1,4,19])})()'); - }); - it('Should handle dynamic imports', () => { - expect(shapeshifter('const { default: foo } = await import(\'https://bar.com/foo.js\');"c3"')).toEqual( - '(async()=>{const{default:foo}=await import("https://bar.com/foo.js");return mini("c3").withMiniLocation([1,64,79],[1,68,83])})()', - ); + if (wrappedAsync) { + expect(shapeshifter('"c3"')).toEqual('(async()=>{return mini("c3").withMiniLocation([1,0,15],[1,4,19])})()'); + } else { + expect(shapeshifter('"c3"')).toEqual('return mini("c3").withMiniLocation([1,0,0],[1,4,4])'); + } }); + if (wrappedAsync) { + it('Should handle dynamic imports', () => { + expect(shapeshifter('const { default: foo } = await import(\'https://bar.com/foo.js\');"c3"')).toEqual( + 'const{default:foo}=await import("https://bar.com/foo.js");return mini("c3").withMiniLocation([1,64,79],[1,68,83])', + ); + }); + } }); diff --git a/packages/react/src/hooks/useStrudel.mjs b/packages/react/src/hooks/useStrudel.mjs index 571fb8e6..81569f65 100644 --- a/packages/react/src/hooks/useStrudel.mjs +++ b/packages/react/src/hooks/useStrudel.mjs @@ -1,7 +1,6 @@ -// import { Scheduler } from '@strudel.cycles/core'; import { useRef, useCallback, useEffect, useMemo, useState } from 'react'; -import shapeshifter from '@strudel.cycles/eval/shapeshifter.mjs'; import { repl } from '@strudel.cycles/core/repl.mjs'; +import { transpiler } from '@strudel.cycles/transpiler'; function useStrudel({ defaultOutput, interval, getTime, code, evalOnMount = false }) { // scheduler @@ -18,7 +17,7 @@ function useStrudel({ defaultOutput, interval, getTime, code, evalOnMount = fals onSchedulerError: setSchedulerError, onEvalError: setEvalError, getTime, - transpiler: shapeshifter, + transpiler, onEval: ({ pattern: _pattern, code }) => { setActiveCode(code); setPattern(_pattern); diff --git a/packages/transpiler/README.md b/packages/transpiler/README.md new file mode 100644 index 00000000..3a0f5549 --- /dev/null +++ b/packages/transpiler/README.md @@ -0,0 +1,27 @@ +# @strudel.cycles/transpiler + +This package contains a JS code transpiler with the following features: + +- add locations of mini notation strings (double quoted or backticked) for highlighting +- converts pseudo note variables to note strings +- adds return statement to the last expression + +The transpiler is written with [acorn](https://github.com/acornjs/acorn) and aims to replace the `@strudel.cycles/eval` package, which uses [shift-ast](https://www.npmjs.com/package/shift-ast). + +## Install + +```sh +npm i @strudel.cycles/transpiler +``` + +## Use + +```js +import { transpiler } from '@strudel.cycles/core'; +import { evaluate } from '@strudel.cycles/core'; + +transpiler('note("c3 [e3,g3]")', { wrapAsync: false, addReturn: false, simpleLocs: true }); +/* mini('c3 [e3,g3]').withMiniLocation(7,17) */ + +evaluate(note('c3 [e3,g3]'), transpiler); // returns pattern of above code +``` diff --git a/packages/transpiler/index.mjs b/packages/transpiler/index.mjs new file mode 100644 index 00000000..4832a423 --- /dev/null +++ b/packages/transpiler/index.mjs @@ -0,0 +1,5 @@ +import { evaluate as _evaluate } from '@strudel.cycles/core'; +import { transpiler } from './transpiler.mjs'; +export * from './transpiler.mjs'; + +export const evaluate = (code) => _evaluate(code, transpiler); diff --git a/packages/transpiler/package.json b/packages/transpiler/package.json new file mode 100644 index 00000000..df4968b9 --- /dev/null +++ b/packages/transpiler/package.json @@ -0,0 +1,32 @@ +{ + "name": "@strudel.cycles/transpiler", + "version": "0.3.1", + "description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.", + "main": "index.mjs", + "scripts": { + "test": "vitest run" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/tidalcycles/strudel.git" + }, + "keywords": [ + "tidalcycles", + "strudel", + "pattern", + "livecoding", + "algorave" + ], + "author": "Felix Roos ", + "license": "AGPL-3.0-or-later", + "bugs": { + "url": "https://github.com/tidalcycles/strudel/issues" + }, + "homepage": "https://github.com/tidalcycles/strudel#readme", + "dependencies": { + "@strudel.cycles/core": "^0.3.1", + "acorn": "^8.8.1", + "escodegen": "^2.0.0", + "estree-walker": "^3.0.1" + } +} diff --git a/packages/transpiler/test/transpiler.test.mjs b/packages/transpiler/test/transpiler.test.mjs new file mode 100644 index 00000000..6fa79347 --- /dev/null +++ b/packages/transpiler/test/transpiler.test.mjs @@ -0,0 +1,39 @@ +/* +transpiler.test.mjs - +Copyright (C) 2022 Strudel contributors - see +This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . +*/ + +import { describe, it, expect } from 'vitest'; +import { transpiler } from '../transpiler.mjs'; + +const simple = { wrapAsync: false, addReturn: false, simpleLocs: true }; + +describe('transpiler', () => { + it('wraps double quote string with mini and adds location', () => { + expect(transpiler('"c3"', simple)).toEqual("mini('c3').withMiniLocation(0, 4);"); + expect(transpiler('stack("c3","bd sd")', simple)).toEqual( + "stack(mini('c3').withMiniLocation(6, 10), mini('bd sd').withMiniLocation(11, 18));", + ); + }); + it('wraps backtick string with mini and adds location', () => { + expect(transpiler('`c3`', simple)).toEqual("mini('c3').withMiniLocation(0, 4);"); + }); + it('replaces note variables with note strings', () => { + expect(transpiler('seq(c3, d3)', simple)).toEqual("seq('c3', 'd3');"); + }); + it('keeps tagged template literal as is', () => { + expect(transpiler('xxx`c3`', simple)).toEqual('xxx`c3`;'); + }); + it('supports top level await', () => { + expect(transpiler("await samples('xxx');", simple)).toEqual("await samples('xxx');"); + }); + /* it('parses dynamic imports', () => { + expect( + transpiler("const { default: foo } = await import('https://bar.com/foo.js');", { + wrapAsync: false, + addReturn: false, + }), + ).toEqual("const {default: foo} = await import('https://bar.com/foo.js');"); + }); */ +}); diff --git a/packages/transpiler/transpiler.mjs b/packages/transpiler/transpiler.mjs new file mode 100644 index 00000000..a0b24512 --- /dev/null +++ b/packages/transpiler/transpiler.mjs @@ -0,0 +1,129 @@ +import escodegen from 'escodegen'; +import { parse } from 'acorn'; +import { walk } from 'estree-walker'; +import { isNote } from '@strudel.cycles/core'; + +export function transpiler(input, options = {}) { + const { wrapAsync = false, addReturn = true, simpleLocs = false } = options; + + let ast = parse(input, { + ecmaVersion: 2022, + allowAwaitOutsideFunction: true, + locations: true, + }); + + walk(ast, { + enter(node, parent, prop, index) { + if (isBackTickString(node, parent)) { + const { quasis, start, end } = node; + const { raw } = quasis[0].value; + this.skip(); + return this.replace(miniWithLocation(raw, node, simpleLocs)); + } + if (isStringWithDoubleQuotes(node)) { + const { value, start, end } = node; + this.skip(); + return this.replace(miniWithLocation(value, node, simpleLocs)); + } + if (node.type === 'Identifier' && isNote(node.name)) { + this.skip(); + return this.replace({ type: 'Literal', value: node.name }); + } + // TODO: + }, + leave(node, parent, prop, index) {}, + }); + + const { body } = ast; + if (!body?.[body.length - 1]?.expression) { + throw new Error('unexpected ast format without body expression'); + } + + // add return to last statement + if (addReturn) { + const { expression } = body[body.length - 1]; + body[body.length - 1] = { + type: 'ReturnStatement', + argument: expression, + }; + } + const output = escodegen.generate(ast); + if (wrapAsync) { + return `(async ()=>{${output}})()`; + } + return output; +} + +function isStringWithDoubleQuotes(node, locations, code) { + const { raw, type } = node; + if (type !== 'Literal') { + return false; + } + return raw[0] === '"'; +} + +function isBackTickString(node, parent) { + return node.type === 'TemplateLiteral' && parent.type !== 'TaggedTemplateExpression'; +} + +function miniWithLocation(value, node, simpleLocs) { + let locs; + const { start: fromOffset, end: toOffset } = node; + if (simpleLocs) { + locs = [ + { + type: 'Literal', + value: fromOffset, + }, + { + type: 'Literal', + value: toOffset, + }, + ]; + } else { + const { + loc: { + start: { line: fromLine, column: fromColumn }, + end: { line: toLine, column: toColumn }, + }, + } = node; + locs = [ + { + type: 'ArrayExpression', + elements: [fromLine, fromColumn, fromOffset].map((value) => ({ + type: 'Literal', + value, + })), + }, + { + type: 'ArrayExpression', + elements: [toLine, toColumn, toOffset].map((value) => ({ + type: 'Literal', + value, + })), + }, + ]; + } + // with location + return { + type: 'CallExpression', + callee: { + type: 'MemberExpression', + object: { + type: 'CallExpression', + callee: { + type: 'Identifier', + name: 'mini', + }, + arguments: [{ type: 'Literal', value }], + optional: false, + }, + property: { + type: 'Identifier', + name: 'withMiniLocation', + }, + }, + arguments: locs, + optional: false, + }; +} diff --git a/repl/src/runtime.mjs b/repl/src/runtime.mjs index 1da561f9..81fdc2d6 100644 --- a/repl/src/runtime.mjs +++ b/repl/src/runtime.mjs @@ -4,6 +4,7 @@ // import * as tunes from './tunes.mjs'; import { evaluate } from '@strudel.cycles/eval'; +// import { evaluate } from '@strudel.cycles/transpiler'; import { evalScope } from '@strudel.cycles/core'; import * as strudel from '@strudel.cycles/core'; import * as webaudio from '@strudel.cycles/webaudio';