diff --git a/package.json b/package.json index 0e91f0b4..ce42d467 100644 --- a/package.json +++ b/package.json @@ -43,5 +43,10 @@ "prettier": { "trailingComma": "es5" }, - "version": "0.0.0-next-87012d8d" + "version": "0.0.0-next-87012d8d", + "pnpm": { + "patchedDependencies": { + "butterchurn@3.0.0-beta.5": "patches/butterchurn@3.0.0-beta.5.patch" + } + } } diff --git a/patches/butterchurn@3.0.0-beta.5.patch b/patches/butterchurn@3.0.0-beta.5.patch new file mode 100644 index 00000000..2101d485 --- /dev/null +++ b/patches/butterchurn@3.0.0-beta.5.patch @@ -0,0 +1,2356 @@ +diff --git a/dist/butterchurn.js b/dist/butterchurn.js +index bc11139fbe6e0757842662f9d3a59e07c9866468..a26aa8c376de3a758649ebb9adb73c94c074382b 100644 +--- a/dist/butterchurn.js ++++ b/dist/butterchurn.js +@@ -184,2333 +184,7 @@ window.memcpy = function memcpy(megabuf, dst, src, len) { + }; + /* eslint-enable */ + +-var src = {}; +- +-var parser$1 = {}; +- +-var preProcessor = {}; +- +-var hasRequiredPreProcessor; +- +-function requirePreProcessor () { +- if (hasRequiredPreProcessor) return preProcessor; +- hasRequiredPreProcessor = 1; +- Object.defineProperty(preProcessor, "__esModule", { value: true }); +- function getLoc(mapper, destCol) { +- let previousAnchor = { destCol: 1, srcCol: 1, srcLine: 1 }; +- // Find the last anchor with a destCol > destCol. +- // Reversed: Find the first anchor with a destCol <= destCol +- // TODO: Use binary search +- mapper.forEach(anchor => { +- if (anchor.destCol > destCol) { +- return; +- } +- previousAnchor = anchor; +- }); +- const remainingColumns = destCol - previousAnchor.destCol; +- return { +- column: previousAnchor.srcCol + remainingColumns, +- line: previousAnchor.srcLine, +- }; +- } +- preProcessor.getLoc = getLoc; +- // Started with this function: https://github.com/WACUP/vis_milk2/blob/cc2e85aed44373d0b6b2115c0806ec035856860a/vis_milk2/state.cpp#L1532-L1557 +- function preProcess(src) { +- const mapper = []; +- let srcLine = 1; +- let dest = ""; +- let lineStart = 0; +- let inlineComment = false; +- let blockComment = false; +- let emitAnchor = false; +- for (let i = 0; i < src.length; i++) { +- const char = src[i]; +- if (emitAnchor) { +- const destCol = dest.length + 1; +- const srcCol = i - lineStart + 1; +- mapper.push({ destCol, srcCol, srcLine }); +- emitAnchor = false; +- } +- if (char === "\n") { +- inlineComment = false; +- srcLine++; +- lineStart = i + 1; +- emitAnchor = true; +- } +- else if (char === "\r" && src[i + 1] === "\n") { +- i++; +- inlineComment = false; +- srcLine++; +- lineStart = i + 1; +- emitAnchor = true; +- } +- else if (blockComment && char === "*" && src[i + 1] === "/") { +- // TODO: What if we are not currently in a block comment? +- blockComment = false; +- i++; +- emitAnchor = true; +- } +- else if ((char === "\\" && src[i + 1] === "\\") || +- (char === "/" && src[i + 1] === "/")) { +- inlineComment = true; +- i++; +- } +- else if (char === "/" && src[i + 1] === "*") { +- blockComment = true; +- i++; +- } +- else if (!inlineComment && !blockComment) { +- dest += char; +- } +- } +- return [dest, mapper]; +- } +- preProcessor.preProcess = preProcess; +- +- return preProcessor; +-} +- +-function commonjsRequire(path) { +- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); +-} +- +-var parser = {}; +- +-/* parser generated by jison 0.4.18 */ +- +-var hasRequiredParser$1; +- +-function requireParser$1 () { +- if (hasRequiredParser$1) return parser; +- hasRequiredParser$1 = 1; +- (function (exports) { +- /* +- Returns a Parser object of the following structure: +- +- Parser: { +- yy: {} +- } +- +- Parser.prototype: { +- yy: {}, +- trace: function(), +- symbols_: {associative list: name ==> number}, +- terminals_: {associative list: number ==> name}, +- productions_: [...], +- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), +- table: [...], +- defaultActions: {...}, +- parseError: function(str, hash), +- parse: function(input), +- +- lexer: { +- EOF: 1, +- parseError: function(str, hash), +- setInput: function(input), +- input: function(), +- unput: function(str), +- more: function(), +- less: function(n), +- pastInput: function(), +- upcomingInput: function(), +- showPosition: function(), +- test_match: function(regex_match_array, rule_index), +- next: function(), +- lex: function(), +- begin: function(condition), +- popState: function(), +- _currentRules: function(), +- topState: function(), +- pushState: function(condition), +- +- options: { +- ranges: boolean (optional: true ==> token location info will include a .range[] member) +- flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) +- backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) +- }, +- +- performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), +- rules: [...], +- conditions: {associative list: name ==> set}, +- } +- } +- +- +- token location info (@$, _$, etc.): { +- first_line: n, +- last_line: n, +- first_column: n, +- last_column: n, +- range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) +- } +- +- +- the parseError function receives a 'hash' object with these members for lexer and parser errors: { +- text: (matched text) +- token: (the produced terminal token, if any) +- line: (yylineno) +- } +- while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { +- loc: (yylloc) +- expected: (string describing the set of expected tokens) +- recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) +- } +- */ +- var parser = (function () { +- var o = function (k, v, o, l) { for (o = o || {}, l = k.length; l--; o[k[l]] = v) +- ; return o; }, $V0 = [1, 18], $V1 = [1, 7], $V2 = [1, 19], $V3 = [1, 20], $V4 = [1, 14], $V5 = [1, 15], $V6 = [1, 16], $V7 = [1, 33], $V8 = [1, 31], $V9 = [1, 23], $Va = [1, 22], $Vb = [1, 24], $Vc = [1, 25], $Vd = [1, 26], $Ve = [1, 27], $Vf = [1, 28], $Vg = [1, 29], $Vh = [1, 30], $Vi = [5, 8, 15, 18, 20, 28, 29, 32, 33, 34, 35, 36, 37, 38], $Vj = [5, 15, 18], $Vk = [5, 12, 15, 17, 18, 24, 25, 28, 29, 30], $Vl = [1, 57], $Vm = [5, 8, 12, 15, 17, 18, 24, 25, 28, 29, 30], $Vn = [15, 18], $Vo = [5, 8, 15, 18, 28, 29, 38], $Vp = [5, 8, 15, 18, 28, 29, 32, 33, 38], $Vq = [5, 8, 15, 18, 28, 29, 32, 33, 34, 37, 38], $Vr = [5, 8, 15, 18, 28, 29, 32, 33, 34, 35, 36, 37, 38], $Vs = [5, 8, 15, 18], $Vt = [5, 8, 15, 18, 20, 22, 28, 29, 32, 33, 34, 35, 36, 37, 38]; +- var parser = { trace: function trace() { }, +- yy: {}, +- symbols_: { "error": 2, "SCRIPT": 3, "expression": 4, "EOF": 5, "expressionsOptionalTrailingSemi": 6, "separator": 7, ";": 8, "expressions": 9, "EXPRESSION_BLOCK": 10, "IDENTIFIER": 11, "IDENTIFIER_TOKEN": 12, "argument": 13, "arguments": 14, ",": 15, "FUNCTION_CALL": 16, "(": 17, ")": 18, "LOGICAL_EXPRESSION": 19, "LOGICAL_OPERATOR_TOKEN": 20, "ASSIGNMENT": 21, "ASSIGNMENT_OPERATOR_TOKEN": 22, "number": 23, "DIGITS_TOKEN": 24, ".": 25, "NUMBER_LITERAL": 26, "UNARY_EXPRESSION": 27, "-": 28, "+": 29, "!": 30, "BINARY_EXPRESSION": 31, "*": 32, "/": 33, "%": 34, "&": 35, "|": 36, "^": 37, "COMPARISON_TOKEN": 38, "$accept": 0, "$end": 1 }, +- terminals_: { 2: "error", 5: "EOF", 8: ";", 12: "IDENTIFIER_TOKEN", 15: ",", 17: "(", 18: ")", 20: "LOGICAL_OPERATOR_TOKEN", 22: "ASSIGNMENT_OPERATOR_TOKEN", 24: "DIGITS_TOKEN", 25: ".", 28: "-", 29: "+", 30: "!", 32: "*", 33: "/", 34: "%", 35: "&", 36: "|", 37: "^", 38: "COMPARISON_TOKEN" }, +- productions_: [0, [3, 2], [3, 2], [3, 1], [7, 1], [7, 2], [9, 2], [9, 3], [6, 1], [6, 2], [10, 1], [11, 1], [13, 1], [13, 1], [14, 1], [14, 3], [16, 3], [16, 4], [19, 3], [21, 3], [21, 3], [23, 1], [23, 2], [23, 3], [23, 2], [23, 1], [26, 1], [27, 2], [27, 2], [27, 2], [31, 3], [31, 3], [31, 3], [31, 3], [31, 3], [31, 3], [31, 3], [31, 3], [31, 3], [4, 1], [4, 1], [4, 3], [4, 1], [4, 1], [4, 1], [4, 1], [4, 1], [4, 3]], +- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +- /* this == yyval */ +- var $0 = $$.length - 1; +- switch (yystate) { +- case 1: +- return { type: 'SCRIPT', body: [$$[$0 - 1]], loc: this._$ }; +- case 2: +- return { type: 'SCRIPT', body: $$[$0 - 1], loc: this._$ }; +- case 3: +- return { type: 'SCRIPT', body: [], loc: this._$ }; +- case 6: +- this.$ = [$$[$0 - 1]]; +- break; +- case 7: +- this.$ = $$[$0 - 2].concat([$$[$0 - 1]]); +- break; +- case 8: +- this.$ = $$[$0]; +- break; +- case 9: +- this.$ = $$[$0 - 1].concat([$$[$0]]); +- break; +- case 10: +- this.$ = { type: 'EXPRESSION_BLOCK', body: $$[$0], loc: this._$ }; +- break; +- case 11: +- this.$ = { type: 'IDENTIFIER', value: $$[$0].toLowerCase(), loc: this._$ }; +- break; +- case 14: +- this.$ = [$$[$0]]; +- break; +- case 15: +- this.$ = $$[$0 - 2].concat([$$[$0]]); +- break; +- case 16: +- this.$ = { type: 'CALL_EXPRESSION', callee: $$[$0 - 2], arguments: [], loc: this._$ }; +- break; +- case 17: +- this.$ = { type: 'CALL_EXPRESSION', callee: $$[$0 - 3], arguments: $$[$0 - 1], loc: this._$ }; +- break; +- case 18: +- this.$ = { type: 'LOGICAL_EXPRESSION', left: $$[$0 - 2], right: $$[$0], operator: $$[$0 - 1], loc: this._$ }; +- break; +- case 19: +- case 20: +- this.$ = { type: 'ASSIGNMENT_EXPRESSION', left: $$[$0 - 2], operator: $$[$0 - 1], right: $$[$0], loc: this._$ }; +- break; +- case 21: +- this.$ = Number($$[$0]); +- break; +- case 22: +- this.$ = Number($$[$0 - 1]); +- break; +- case 23: +- this.$ = Number($$[$0 - 2] + $$[$0 - 1] + $$[$0]); +- break; +- case 24: +- this.$ = Number('0' + $$[$0 - 1] + $$[$0]); +- break; +- case 25: +- this.$ = 0; +- break; +- case 26: +- this.$ = { type: 'NUMBER_LITERAL', value: $$[$0], loc: this._$ }; +- break; +- case 27: +- case 28: +- case 29: +- this.$ = { type: 'UNARY_EXPRESSION', value: $$[$0], operator: $$[$0 - 1], loc: this._$ }; +- break; +- case 30: +- case 31: +- case 32: +- case 33: +- case 34: +- case 35: +- case 36: +- case 37: +- case 38: +- this.$ = { type: 'BINARY_EXPRESSION', left: $$[$0 - 2], right: $$[$0], operator: $$[$0 - 1], loc: this._$ }; +- break; +- case 41: +- case 47: +- this.$ = $$[$0 - 1]; +- break; +- } +- }, +- table: [{ 3: 1, 4: 2, 5: [1, 4], 6: 3, 9: 13, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 1: [3] }, { 5: [1, 21], 7: 32, 8: $V7, 20: $V8, 28: $V9, 29: $Va, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg, 38: $Vh }, { 5: [1, 34] }, { 1: [2, 3] }, o($Vi, [2, 39]), o($Vi, [2, 40]), { 4: 35, 6: 37, 9: 13, 10: 36, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, o($Vi, [2, 42]), o($Vi, [2, 43]), o($Vi, [2, 44], { 22: [1, 38] }), o($Vi, [2, 45], { 17: [1, 40], 22: [1, 39] }), o($Vi, [2, 46]), o($Vj, [2, 8], { 31: 5, 27: 6, 26: 8, 21: 9, 16: 10, 11: 11, 19: 12, 23: 17, 4: 41, 12: $V0, 17: $V1, 24: $V2, 25: $V3, 28: $V4, 29: $V5, 30: $V6 }), { 4: 42, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 43, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 44, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, o($Vi, [2, 26]), o([5, 8, 15, 17, 18, 20, 22, 28, 29, 32, 33, 34, 35, 36, 37, 38], [2, 11]), o($Vi, [2, 21], { 25: [1, 45] }), o($Vi, [2, 25], { 24: [1, 46] }), { 1: [2, 1] }, { 4: 47, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 48, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 49, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 50, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 51, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 52, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 53, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 54, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 55, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 56, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, o($Vk, [2, 6], { 8: $Vl }), o($Vm, [2, 4]), { 1: [2, 2] }, { 7: 32, 8: $V7, 18: [1, 58], 20: $V8, 28: $V9, 29: $Va, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg, 38: $Vh }, { 18: [1, 59] }, o($Vn, [2, 10]), { 4: 60, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 61, 11: 11, 12: $V0, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, { 4: 65, 6: 37, 9: 13, 10: 66, 11: 11, 12: $V0, 13: 64, 14: 63, 16: 10, 17: $V1, 18: [1, 62], 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, o($Vj, [2, 9], { 7: 67, 8: $V7, 20: $V8, 28: $V9, 29: $Va, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg, 38: $Vh }), o($Vo, [2, 27], { 20: $V8, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg }), o($Vo, [2, 28], { 20: $V8, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg }), o($Vo, [2, 29], { 20: $V8, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg }), o($Vi, [2, 22], { 24: [1, 68] }), o($Vi, [2, 24]), o($Vo, [2, 30], { 20: $V8, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg }), o($Vo, [2, 31], { 20: $V8, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg }), o($Vp, [2, 32], { 20: $V8, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg }), o($Vp, [2, 33], { 20: $V8, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg }), o($Vq, [2, 34], { 20: $V8, 35: $Ve, 36: $Vf }), o($Vr, [2, 35], { 20: $V8 }), o($Vr, [2, 36], { 20: $V8 }), o($Vq, [2, 37], { 20: $V8, 35: $Ve, 36: $Vf }), o($Vs, [2, 38], { 20: $V8, 28: $V9, 29: $Va, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg, 38: $Vh }), o($Vi, [2, 18]), o($Vm, [2, 5]), o($Vi, [2, 41]), o($Vi, [2, 47]), o($Vs, [2, 20], { 20: $V8, 28: $V9, 29: $Va, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg, 38: $Vh }), o($Vs, [2, 19], { 20: $V8, 28: $V9, 29: $Va, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg, 38: $Vh }), o($Vt, [2, 16]), { 15: [1, 70], 18: [1, 69] }, o($Vn, [2, 14]), o($Vn, [2, 12], { 7: 32, 8: $V7, 20: $V8, 28: $V9, 29: $Va, 32: $Vb, 33: $Vc, 34: $Vd, 35: $Ve, 36: $Vf, 37: $Vg, 38: $Vh }), o($Vn, [2, 13]), o($Vk, [2, 7], { 8: $Vl }), o($Vi, [2, 23]), o($Vt, [2, 17]), { 4: 65, 6: 37, 9: 13, 10: 66, 11: 11, 12: $V0, 13: 71, 16: 10, 17: $V1, 19: 12, 21: 9, 23: 17, 24: $V2, 25: $V3, 26: 8, 27: 6, 28: $V4, 29: $V5, 30: $V6, 31: 5 }, o($Vn, [2, 15])], +- defaultActions: { 4: [2, 3], 21: [2, 1], 34: [2, 2] }, +- parseError: function parseError(str, hash) { +- if (hash.recoverable) { +- this.trace(str); +- } +- else { +- var error = new Error(str); +- error.hash = hash; +- throw error; +- } +- }, +- parse: function parse(input) { +- var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; +- var args = lstack.slice.call(arguments, 1); +- var lexer = Object.create(this.lexer); +- var sharedState = { yy: {} }; +- for (var k in this.yy) { +- if (Object.prototype.hasOwnProperty.call(this.yy, k)) { +- sharedState.yy[k] = this.yy[k]; +- } +- } +- lexer.setInput(input, sharedState.yy); +- sharedState.yy.lexer = lexer; +- sharedState.yy.parser = this; +- if (typeof lexer.yylloc == 'undefined') { +- lexer.yylloc = {}; +- } +- var yyloc = lexer.yylloc; +- lstack.push(yyloc); +- var ranges = lexer.options && lexer.options.ranges; +- if (typeof sharedState.yy.parseError === 'function') { +- this.parseError = sharedState.yy.parseError; +- } +- else { +- this.parseError = Object.getPrototypeOf(this).parseError; +- } +- var lex = function () { +- var token; +- token = lexer.lex() || EOF; +- if (typeof token !== 'number') { +- token = self.symbols_[token] || token; +- } +- return token; +- }; +- var symbol, state, action, r, yyval = {}, p, len, newState, expected; +- while (true) { +- state = stack[stack.length - 1]; +- if (this.defaultActions[state]) { +- action = this.defaultActions[state]; +- } +- else { +- if (symbol === null || typeof symbol == 'undefined') { +- symbol = lex(); +- } +- action = table[state] && table[state][symbol]; +- } +- if (typeof action === 'undefined' || !action.length || !action[0]) { +- var errStr = ''; +- expected = []; +- for (p in table[state]) { +- if (this.terminals_[p] && p > TERROR) { +- expected.push('\'' + this.terminals_[p] + '\''); +- } +- } +- if (lexer.showPosition) { +- errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; +- } +- else { +- errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); +- } +- this.parseError(errStr, { +- text: lexer.match, +- token: this.terminals_[symbol] || symbol, +- line: lexer.yylineno, +- loc: yyloc, +- expected: expected +- }); +- } +- if (action[0] instanceof Array && action.length > 1) { +- throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); +- } +- switch (action[0]) { +- case 1: +- stack.push(symbol); +- vstack.push(lexer.yytext); +- lstack.push(lexer.yylloc); +- stack.push(action[1]); +- symbol = null; +- { +- yyleng = lexer.yyleng; +- yytext = lexer.yytext; +- yylineno = lexer.yylineno; +- yyloc = lexer.yylloc; +- } +- break; +- case 2: +- len = this.productions_[action[1]][1]; +- yyval.$ = vstack[vstack.length - len]; +- yyval._$ = { +- first_line: lstack[lstack.length - (len || 1)].first_line, +- last_line: lstack[lstack.length - 1].last_line, +- first_column: lstack[lstack.length - (len || 1)].first_column, +- last_column: lstack[lstack.length - 1].last_column +- }; +- if (ranges) { +- yyval._$.range = [ +- lstack[lstack.length - (len || 1)].range[0], +- lstack[lstack.length - 1].range[1] +- ]; +- } +- r = this.performAction.apply(yyval, [ +- yytext, +- yyleng, +- yylineno, +- sharedState.yy, +- action[1], +- vstack, +- lstack +- ].concat(args)); +- if (typeof r !== 'undefined') { +- return r; +- } +- if (len) { +- stack = stack.slice(0, -1 * len * 2); +- vstack = vstack.slice(0, -1 * len); +- lstack = lstack.slice(0, -1 * len); +- } +- stack.push(this.productions_[action[1]][0]); +- vstack.push(yyval.$); +- lstack.push(yyval._$); +- newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; +- stack.push(newState); +- break; +- case 3: +- return true; +- } +- } +- return true; +- } }; +- /* generated by jison-lex 0.3.4 */ +- var lexer = (function () { +- var lexer = ({ +- EOF: 1, +- parseError: function parseError(str, hash) { +- if (this.yy.parser) { +- this.yy.parser.parseError(str, hash); +- } +- else { +- throw new Error(str); +- } +- }, +- // resets the lexer, sets new input +- setInput: function (input, yy) { +- this.yy = yy || this.yy || {}; +- this._input = input; +- this._more = this._backtrack = this.done = false; +- this.yylineno = this.yyleng = 0; +- this.yytext = this.matched = this.match = ''; +- this.conditionStack = ['INITIAL']; +- this.yylloc = { +- first_line: 1, +- first_column: 0, +- last_line: 1, +- last_column: 0 +- }; +- if (this.options.ranges) { +- this.yylloc.range = [0, 0]; +- } +- this.offset = 0; +- return this; +- }, +- // consumes and returns one char from the input +- input: function () { +- var ch = this._input[0]; +- this.yytext += ch; +- this.yyleng++; +- this.offset++; +- this.match += ch; +- this.matched += ch; +- var lines = ch.match(/(?:\r\n?|\n).*/g); +- if (lines) { +- this.yylineno++; +- this.yylloc.last_line++; +- } +- else { +- this.yylloc.last_column++; +- } +- if (this.options.ranges) { +- this.yylloc.range[1]++; +- } +- this._input = this._input.slice(1); +- return ch; +- }, +- // unshifts one char (or a string) into the input +- unput: function (ch) { +- var len = ch.length; +- var lines = ch.split(/(?:\r\n?|\n)/g); +- this._input = ch + this._input; +- this.yytext = this.yytext.substr(0, this.yytext.length - len); +- //this.yyleng -= len; +- this.offset -= len; +- var oldLines = this.match.split(/(?:\r\n?|\n)/g); +- this.match = this.match.substr(0, this.match.length - 1); +- this.matched = this.matched.substr(0, this.matched.length - 1); +- if (lines.length - 1) { +- this.yylineno -= lines.length - 1; +- } +- var r = this.yylloc.range; +- this.yylloc = { +- first_line: this.yylloc.first_line, +- last_line: this.yylineno + 1, +- first_column: this.yylloc.first_column, +- last_column: lines ? +- (lines.length === oldLines.length ? this.yylloc.first_column : 0) +- + oldLines[oldLines.length - lines.length].length - lines[0].length : +- this.yylloc.first_column - len +- }; +- if (this.options.ranges) { +- this.yylloc.range = [r[0], r[0] + this.yyleng - len]; +- } +- this.yyleng = this.yytext.length; +- return this; +- }, +- // When called from action, caches matched text and appends it on next action +- more: function () { +- this._more = true; +- return this; +- }, +- // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +- reject: function () { +- if (this.options.backtrack_lexer) { +- this._backtrack = true; +- } +- else { +- return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { +- text: "", +- token: null, +- line: this.yylineno +- }); +- } +- return this; +- }, +- // retain first n characters of the match +- less: function (n) { +- this.unput(this.match.slice(n)); +- }, +- // displays already matched input, i.e. for error messages +- pastInput: function () { +- var past = this.matched.substr(0, this.matched.length - this.match.length); +- return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); +- }, +- // displays upcoming input, i.e. for error messages +- upcomingInput: function () { +- var next = this.match; +- if (next.length < 20) { +- next += this._input.substr(0, 20 - next.length); +- } +- return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); +- }, +- // displays the character position where the lexing error occurred, i.e. for error messages +- showPosition: function () { +- var pre = this.pastInput(); +- var c = new Array(pre.length + 1).join("-"); +- return pre + this.upcomingInput() + "\n" + c + "^"; +- }, +- // test the lexed token: return FALSE when not a match, otherwise return token +- test_match: function (match, indexed_rule) { +- var token, lines, backup; +- if (this.options.backtrack_lexer) { +- // save context +- backup = { +- yylineno: this.yylineno, +- yylloc: { +- first_line: this.yylloc.first_line, +- last_line: this.last_line, +- first_column: this.yylloc.first_column, +- last_column: this.yylloc.last_column +- }, +- yytext: this.yytext, +- match: this.match, +- matches: this.matches, +- matched: this.matched, +- yyleng: this.yyleng, +- offset: this.offset, +- _more: this._more, +- _input: this._input, +- yy: this.yy, +- conditionStack: this.conditionStack.slice(0), +- done: this.done +- }; +- if (this.options.ranges) { +- backup.yylloc.range = this.yylloc.range.slice(0); +- } +- } +- lines = match[0].match(/(?:\r\n?|\n).*/g); +- if (lines) { +- this.yylineno += lines.length; +- } +- this.yylloc = { +- first_line: this.yylloc.last_line, +- last_line: this.yylineno + 1, +- first_column: this.yylloc.last_column, +- last_column: lines ? +- lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : +- this.yylloc.last_column + match[0].length +- }; +- this.yytext += match[0]; +- this.match += match[0]; +- this.matches = match; +- this.yyleng = this.yytext.length; +- if (this.options.ranges) { +- this.yylloc.range = [this.offset, this.offset += this.yyleng]; +- } +- this._more = false; +- this._backtrack = false; +- this._input = this._input.slice(match[0].length); +- this.matched += match[0]; +- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); +- if (this.done && this._input) { +- this.done = false; +- } +- if (token) { +- return token; +- } +- else if (this._backtrack) { +- // recover context +- for (var k in backup) { +- this[k] = backup[k]; +- } +- return false; // rule action called reject() implying the next rule should be tested instead. +- } +- return false; +- }, +- // return next match in input +- next: function () { +- if (this.done) { +- return this.EOF; +- } +- if (!this._input) { +- this.done = true; +- } +- var token, match, tempMatch, index; +- if (!this._more) { +- this.yytext = ''; +- this.match = ''; +- } +- var rules = this._currentRules(); +- for (var i = 0; i < rules.length; i++) { +- tempMatch = this._input.match(this.rules[rules[i]]); +- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { +- match = tempMatch; +- index = i; +- if (this.options.backtrack_lexer) { +- token = this.test_match(tempMatch, rules[i]); +- if (token !== false) { +- return token; +- } +- else if (this._backtrack) { +- match = false; +- continue; // rule action called reject() implying a rule MISmatch. +- } +- else { +- // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) +- return false; +- } +- } +- else if (!this.options.flex) { +- break; +- } +- } +- } +- if (match) { +- token = this.test_match(match, rules[index]); +- if (token !== false) { +- return token; +- } +- // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) +- return false; +- } +- if (this._input === "") { +- return this.EOF; +- } +- else { +- return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { +- text: "", +- token: null, +- line: this.yylineno +- }); +- } +- }, +- // return next match that has a token +- lex: function lex() { +- var r = this.next(); +- if (r) { +- return r; +- } +- else { +- return this.lex(); +- } +- }, +- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +- begin: function begin(condition) { +- this.conditionStack.push(condition); +- }, +- // pop the previously active lexer condition state off the condition stack +- popState: function popState() { +- var n = this.conditionStack.length - 1; +- if (n > 0) { +- return this.conditionStack.pop(); +- } +- else { +- return this.conditionStack[0]; +- } +- }, +- // produce the lexer rule set which is active for the currently active lexer condition state +- _currentRules: function _currentRules() { +- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { +- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; +- } +- else { +- return this.conditions["INITIAL"].rules; +- } +- }, +- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +- topState: function topState(n) { +- n = this.conditionStack.length - 1 - Math.abs(n || 0); +- if (n >= 0) { +- return this.conditionStack[n]; +- } +- else { +- return "INITIAL"; +- } +- }, +- // alias for begin(condition) +- pushState: function pushState(condition) { +- this.begin(condition); +- }, +- // return the number of states currently on the stack +- stateStackSize: function stateStackSize() { +- return this.conditionStack.length; +- }, +- options: {}, +- performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { +- switch ($avoiding_name_collisions) { +- case 0: /* skip whitespace */ +- break; +- case 1: +- return 24; +- case 2: +- return 38; +- case 3: +- return 22; +- case 4: +- return 20; +- case 5: +- return 12; +- case 6: +- return 5; +- case 7: +- return yy_.yytext[0]; +- } +- }, +- rules: [/^(?:\s+)/, /^(?:[0-9]+)/, /^(?:(==|!=|<=|>=|<|>))/, /^(?:[+\-*/%]?=)/, /^(?:(\&\&)|\|\|)/, /^(?:[a-zA-Z_][a-zA-Z0-9._]*)/, /^(?:$)/, /^(?:.)/], +- conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } } +- }); +- return lexer; +- })(); +- parser.lexer = lexer; +- function Parser() { +- this.yy = {}; +- } +- Parser.prototype = parser; +- parser.Parser = Parser; +- return new Parser; +- })(); +- if (typeof commonjsRequire !== 'undefined' && 'object' !== 'undefined') { +- exports.parser = parser; +- exports.Parser = parser.Parser; +- exports.parse = function () { return parser.parse.apply(parser, arguments); }; +- exports.main = () => { }; +- } +- +- } (parser)); +- return parser; +-} +- +-var envParser; +-var hasRequiredEnvParser; +- +-function requireEnvParser () { +- if (hasRequiredEnvParser) return envParser; +- hasRequiredEnvParser = 1; +- // This module is in charge of selecting either the pre-built module or the one +- // that builds it a runtime with jison. +- let parserImpl = requireParser$1(); +- /* +- let parserImpl = null; +- // Always use the dynamic one, while we figure out why the built one doens't work. +- if (process.env.NODE_ENV === "production") { +- parserImpl = require("../build/parser"); +- } else { +- parserImpl = require("../tools/buildParser"); +- } +- */ +- envParser = { parse: parserImpl.parse }; +- +- return envParser; +-} +- +-var astUtils = {}; +- +-var hasRequiredAstUtils; +- +-function requireAstUtils () { +- if (hasRequiredAstUtils) return astUtils; +- hasRequiredAstUtils = 1; +- Object.defineProperty(astUtils, "__esModule", { value: true }); +- const CHILDREN = { +- ASSIGNMENT_EXPRESSION: [ +- { type: "NODE", key: "right" }, +- ], +- SCRIPT: [{ type: "ARRAY", key: "body" }], +- EXPRESSION_BLOCK: [{ type: "ARRAY", key: "body" }], +- UNARY_EXPRESSION: [{ type: "NODE", key: "value" }], +- NUMBER_LITERAL: [], +- IDENTIFIER: [], +- CALL_EXPRESSION: [ +- { type: "ARRAY", key: "arguments" }, +- { type: "NODE", key: "callee" }, +- ], +- BINARY_EXPRESSION: [ +- { type: "NODE", key: "left" }, +- { type: "NODE", key: "right" }, +- ], +- LOGICAL_EXPRESSION: [ +- { type: "NODE", key: "left" }, +- { type: "NODE", key: "right" }, +- ], +- }; +- function mapAst(ast, cb) { +- const children = CHILDREN[ast.type]; +- let newAst = ast; +- if (children == null) { +- throw new Error(`Unknown children definition for ${ast.type}`); +- } +- children.forEach(child => { +- if (child.type === "NODE") { +- const orignalChild = ast[child.key]; +- const newChild = mapAst(orignalChild, cb); +- if (newChild !== orignalChild) { +- newAst = Object.assign(Object.assign({}, newAst), { [child.key]: newChild }); +- } +- } +- else if (child.type === "ARRAY") { +- const orignalChildren = ast[child.key]; +- const newChildren = orignalChildren.map(originalChild => mapAst(originalChild, cb)); +- const childrenHaveChanged = orignalChildren.some((child, i) => child !== newChildren[i]); +- if (childrenHaveChanged) { +- newAst = Object.assign(Object.assign({}, newAst), { [child.key]: newChildren }); +- } +- } +- }); +- return cb(newAst); +- } +- astUtils.mapAst = mapAst; +- +- return astUtils; +-} +- +-var errorUtils = {}; +- +-var utils = {}; +- +-var hasRequiredUtils; +- +-function requireUtils () { +- if (hasRequiredUtils) return utils; +- hasRequiredUtils = 1; +- Object.defineProperty(utils, "__esModule", { value: true }); +- function arrayJoin(arr, joiner) { +- const newArr = []; +- for (let i = 0; i < arr.length; i++) { +- newArr.push(arr[i]); +- const last = i === arr.length - 1; +- if (!last) { +- newArr.push(joiner); +- } +- } +- return newArr; +- } +- utils.arrayJoin = arrayJoin; +- function flatten(arr) { +- return [].concat.apply([], arr); +- } +- utils.flatten = flatten; +- function times(n, cb) { +- return new Array(n).fill(null).map((_, i) => cb(i)); +- } +- utils.times = times; +- function repeat(n, char) { +- return new Array(n).fill(char).join(""); +- } +- utils.repeat = repeat; +- // Maintain an ordered list of indexes for namespace/key pairs. +- // In Wasm binary variables are referenced by their index. In our emitter we +- // want to emit variables indexes as we encounter their names. This data +- // structure lets us issue variable indexes on demmand and then iterate through +- // them post facto. +- // +- // `null` may be passed for the namespace argument in order to get a global +- // variable that exists in all namespaces. +- class ScopedIdMap { +- constructor() { +- this._map = new Map(); +- } +- // Get the index of a given namespace/key pair +- get(namespace, key) { +- const jointKey = namespace == null ? key : `${namespace}::${key}`; +- if (!this._map.has(jointKey)) { +- this._map.set(jointKey, this._map.size); +- } +- // @ts-ignore We know the key is here. +- return this._map.get(jointKey); +- } +- size() { +- return this._map.size; +- } +- } +- utils.ScopedIdMap = ScopedIdMap; +- function formatList(list) { +- if (list.length === 0) { +- throw new Error("Cannot format an empty list"); +- } +- if (list.length === 1) { +- return list[0]; +- } +- const quoted = list.map(name => `"${name}"`); +- const last = quoted.pop(); +- return quoted.join(", ") + ` and ${last}`; +- } +- utils.formatList = formatList; +- +- return utils; +-} +- +-var hasRequiredErrorUtils; +- +-function requireErrorUtils () { +- if (hasRequiredErrorUtils) return errorUtils; +- hasRequiredErrorUtils = 1; +- Object.defineProperty(errorUtils, "__esModule", { value: true }); +- const utils_1 = requireUtils(); +- /* Build up a string showing a formatted source location in context with line numbers. +- * +- * 2 | z = sqr(y, 10); +- * > 3 | x = wat(); +- * | ^^^ +- * 4 | y = 100; +- */ +- function printLoc(loc, rawSource, contextLines = 1) { +- const firstIndex = Math.max(loc.first_line - 1 - contextLines, 0); +- const lastIndex = loc.last_line + contextLines; +- const sourceLines = rawSource.split("\n").slice(firstIndex, lastIndex); +- const annotatedLines = sourceLines.map((line, i) => { +- const lineNumber = i + firstIndex + 1; +- const inRange = lineNumber >= loc.first_line && lineNumber <= loc.last_line; +- const gutter = inRange ? ">" : " "; +- return `${gutter} ${lineNumber} | ${line}`; +- }); +- if (loc.first_line === loc.last_line) { +- const padding = utils_1.repeat(loc.first_column, " "); +- const underline = utils_1.repeat(loc.last_column - loc.first_column, "^"); +- const insertIndex = loc.first_line - firstIndex; +- annotatedLines.splice(insertIndex, 0, ` | ${padding}${underline}`); +- } +- return annotatedLines.join("\n"); +- } +- errorUtils.printLoc = printLoc; +- class CompilerError extends Error { +- constructor(message, loc, rawSource) { +- super(message); +- // TODO: Create an error message that encourages users to open an issue at +- // https://github.com/captbaritone/eel-wasm/issues is they see this, and gives +- // Them an easy way to attach the right context. +- this.sourceContext = printLoc(loc, rawSource); +- this.loc = loc; +- } +- } +- class UserError extends CompilerError { +- } +- function createUserError(message, loc, rawSource) { +- return new UserError(message, loc, rawSource); +- } +- errorUtils.createUserError = createUserError; +- function createCompilerError(message, loc, rawSource) { +- return new CompilerError(message, loc, rawSource); +- } +- errorUtils.createCompilerError = createCompilerError; +- +- return errorUtils; +-} +- +-var hasRequiredParser; +- +-function requireParser () { +- if (hasRequiredParser) return parser$1; +- hasRequiredParser = 1; +- Object.defineProperty(parser$1, "__esModule", { value: true }); +- const preProcessor_1 = requirePreProcessor(); +- const envParser_1 = requireEnvParser(); +- const astUtils_1 = requireAstUtils(); +- const errorUtils_1 = requireErrorUtils(); +- function mapLoc(loc, mapper) { +- const first = preProcessor_1.getLoc(mapper, loc.first_column); +- const last = preProcessor_1.getLoc(mapper, loc.last_column); +- return { +- first_column: first.column, +- last_column: last.column, +- first_line: first.line, +- last_line: last.line, +- }; +- } +- function parse(code) { +- const [processedCode, mapper] = preProcessor_1.preProcess(code); +- try { +- const ast = envParser_1.parse(processedCode); +- return astUtils_1.mapAst(ast, (node) => { +- if (node.loc.first_line !== 1 || node.loc.last_line != 1) { +- throw errorUtils_1.createCompilerError("Unexpected multiline", node.loc, code); +- } +- return Object.assign(Object.assign({}, node), { loc: mapLoc(node.loc, mapper) }); +- }); +- } +- catch (e) { +- if (e.hash == null) { +- throw e; +- } +- throw errorUtils_1.createUserError(`Parse Error: ${e.message.split("\n")[3]}`, mapLoc(e.hash.loc, mapper), code); +- } +- } +- parser$1.parse = parse; +- +- return parser$1; +-} +- +-var compiler = {}; +- +-var emitter = {}; +- +-var encoding = {}; +- +-var ieee754 = {}; +- +-var hasRequiredIeee754; +- +-function requireIeee754 () { +- if (hasRequiredIeee754) return ieee754; +- hasRequiredIeee754 = 1; +- Object.defineProperty(ieee754, "__esModule", { value: true }); +- // Copied from https://github.com/feross/ieee754/blob/master/index.js +- function write(buffer, value) { +- // Originally these four were arguments, but we only ever use it like this. +- const offset = 0; +- let mLen = 52; +- const nBytes = 8; +- var e, m, c; +- var eLen = nBytes * 8 - mLen - 1; +- var eMax = (1 << eLen) - 1; +- var eBias = eMax >> 1; +- var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; +- var i = 0 ; +- var d = 1 ; +- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; +- value = Math.abs(value); +- if (isNaN(value) || value === Infinity) { +- m = isNaN(value) ? 1 : 0; +- e = eMax; +- } +- else { +- e = Math.floor(Math.log(value) / Math.LN2); +- if (value * (c = Math.pow(2, -e)) < 1) { +- e--; +- c *= 2; +- } +- if (e + eBias >= 1) { +- value += rt / c; +- } +- else { +- value += rt * Math.pow(2, 1 - eBias); +- } +- if (value * c >= 2) { +- e++; +- c /= 2; +- } +- if (e + eBias >= eMax) { +- m = 0; +- e = eMax; +- } +- else if (e + eBias >= 1) { +- m = (value * c - 1) * Math.pow(2, mLen); +- e = e + eBias; +- } +- else { +- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); +- e = 0; +- } +- } +- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) { } +- e = (e << mLen) | m; +- eLen += mLen; +- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) { } +- buffer[offset + i - d] |= s * 128; +- } +- ieee754.write = write; +- +- return ieee754; +-} +- +-var hasRequiredEncoding; +- +-function requireEncoding () { +- if (hasRequiredEncoding) return encoding; +- hasRequiredEncoding = 1; +- (function (exports) { +- var __importStar = (encoding && encoding.__importStar) || function (mod) { +- if (mod && mod.__esModule) return mod; +- var result = {}; +- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; +- result["default"] = mod; +- return result; +- }; +- Object.defineProperty(exports, "__esModule", { value: true }); +- const ieee754 = __importStar(requireIeee754()); +- const utils_1 = requireUtils(); +- exports.MAGIC = [0x00, 0x61, 0x73, 0x6d]; +- exports.WASM_VERSION = [0x01, 0x00, 0x00, 0x00]; +- exports.EPSILON = 0.00001; +- // An intial attempt to construct a Wasm binary by hand. +- /* +- 0 custom section +- 1 type section +- 2 import section +- 3 function section +- 4 table section +- 5 memory section +- 6 global section +- 7 export section +- 8 start section +- 9 element section +- 10 code section +- 11 data section +- */ +- // https://webassembly.github.io/spec/core/binary/modules.html#sections +- exports.SECTION = { +- TYPE: 1, +- IMPORT: 2, +- FUNC: 3, +- MEMORY: 5, +- GLOBAL: 6, +- EXPORT: 7, +- CODE: 10, +- }; +- exports.EXPORT_TYPE = { +- FUNC: 0x00, +- TABLE: 0x01, +- MEMORY: 0x02, +- GLOBAL: 0x03, +- }; +- exports.op = { +- /* +- * Control Instructions +- * https://webassembly.github.io/spec/core/binary/instructions.html#control-instructions +- */ +- // unreachable: 0x00, +- // nop: 0x01, +- block: (blockType) => [0x02, blockType], +- loop: (blockType) => [0x03, blockType], +- if: (retType) => [0x04, retType], +- else: 0x05, +- end: 0x0b, +- // br: (i: number) => [0x0c, ...signedLEB128(i)], +- br_if: (i) => [0x0d, ...unsignedLEB128(i)], +- // br_table: 0x0d, +- // return: 0x0f, +- call: (i) => [0x10, ...unsignedLEB128(i)], +- // call_indirect: 0x11, +- /* +- * Parametric Instructions +- * https://webassembly.github.io/spec/core/binary/instructions.html#parametric-instructions +- */ +- drop: 0x1a, +- select: 0x1b, +- /* +- * Variable Instructions +- * https://webassembly.github.io/spec/core/binary/instructions.html#variable-instructions +- */ +- local_get: (i) => [0x20, ...unsignedLEB128(i)], +- local_set: (i) => [0x21, ...unsignedLEB128(i)], +- local_tee: (i) => [0x22, ...unsignedLEB128(i)], +- global_get: (i) => [0x23, ...unsignedLEB128(i)], +- global_set: (i) => [0x24, ...unsignedLEB128(i)], +- /* +- * Memory Instructions +- * https://webassembly.github.io/spec/core/binary/instructions.html#memory-instructions +- */ +- f64_load: (align, offset) => [ +- 0x2b, +- ...unsignedLEB128(align), +- ...unsignedLEB128(offset), +- ], +- f64_store: (align, offset) => [ +- 0x39, +- ...unsignedLEB128(align), +- ...unsignedLEB128(offset), +- ], +- /* +- * Numeric Instructions +- * https://webassembly.github.io/spec/core/binary/instructions.html#numeric-instructions +- */ +- i32_const: (i) => [0x41, ...signedLEB128(i)], +- // i64_const: 0x42, +- // f32_const: 0x43, +- f64_const: (i) => [0x44, ...encodef64(i)], +- i32_eqz: 0x45, +- // i32_eq: 0x46, +- i32_ne: 0x47, +- i32_lt_s: 0x48, +- i32_lt_u: 0x49, +- i32_gt_s: 0x4a, +- // i32_gt_u: 0x4b, +- i32_le_s: 0x4c, +- i32_le_u: 0x4d, +- i32_ge_s: 0x4e, +- // i32_ge_u: 0x4f, +- // [0x50...0x5a] i64 +- // [0x5b...0x60] f32 +- f64_eq: 0x61, +- f64_ne: 0x62, +- f64_lt: 0x63, +- f64_gt: 0x64, +- f64_le: 0x65, +- f64_ge: 0x66, +- // i32_clz: 0x67, +- // i32_ctz: 0x68, +- // i32_popcnt: 0x69, +- i32_add: 0x6a, +- i32_sub: 0x6b, +- i32_mul: 0x6c, +- // i32_div_s: 0x6d, +- // i32_div_u: 0x6e, +- i32_rem_s: 0x6f, +- // i32_rem_u: 0x70, +- i32_and: 0x71, +- i32_or: 0x72, +- // [0x73...0x78] More i32 +- // [0x79...0x8a] More i64 +- i64_rem_s: 0x81, +- i64_and: 0x83, +- i64_or: 0x84, +- // [0x8b...0x98] More f32 +- f64_abs: 0x99, +- f64_neg: 0x9a, +- f64_ceil: 0x9b, +- f64_floor: 0x9c, +- // f64_trunc: 0x9d, +- // f64_nearest: 0x9e, +- f64_sqrt: 0x9f, +- f64_add: 0xa0, +- f64_sub: 0xa1, +- f64_mul: 0xa2, +- f64_div: 0xa3, +- f64_min: 0xa4, +- f64_max: 0xa5, +- // f64_copysign: 0xa6, +- i32_trunc_f64_s: 0xaa, +- i32_trunc_f64_u: 0xab, +- i64_trunc_s_f64: 0xb0, +- f64_convert_i64_s: 0xb9, +- f64_convert_i32_s: 0xb7, +- }; +- // https://webassembly.github.io/spec/core/binary/instructions.html#binary-blocktype +- exports.VAL_TYPE = { +- i32: 0x7f, +- i64: 0x7e, +- f32: 0x7d, +- f64: 0x7c, +- }; +- exports.MUTABILITY = { +- const: 0x00, +- var: 0x01, +- }; +- exports.BLOCK = { +- void: 0x40, +- i32: 0x7f, +- i64: 0x7e, +- f32: 0x7d, +- f64: 0x7c, +- }; +- // http://webassembly.github.io/spec/core/binary/types.html#function-types +- exports.FUNCTION_TYPE = 0x60; +- // I think these might actually be specific to importdesc +- exports.MEMORY_IDX = 0x02; +- exports.GLOBAL_TYPE = 0x03; +- exports.TYPE_IDX = 0x00; +- // Takes an f64 on the stack and leaves an int32 boolean representing if it's +- // within epsilon of zero. +- exports.IS_ZEROISH = [ +- exports.op.f64_abs, +- ...exports.op.f64_const(exports.EPSILON), +- exports.op.f64_lt, +- ]; +- exports.IS_NOT_ZEROISH = [ +- exports.op.f64_abs, +- ...exports.op.f64_const(exports.EPSILON), +- exports.op.f64_gt, +- ]; +- // f64 +- function encodef64(num) { +- const arr = new Uint8Array(8); +- ieee754.write(arr, num); +- return arr; +- } +- exports.encodef64 = encodef64; +- exports.encodeString = (str) => [str.length].concat(str.split("").map(s => s.charCodeAt(0))); +- function unsignedLEB128(n) { +- const buffer = []; +- do { +- let byte = n & 0x7f; +- n >>>= 7; +- if (n !== 0) { +- byte |= 0x80; +- } +- buffer.push(byte); +- } while (n !== 0); +- return buffer; +- } +- exports.unsignedLEB128 = unsignedLEB128; +- // https://github.com/shmishtopher/wasm-LEB128/blob/2f1039636e758293e571f996e8012c4d69f4b58f/lib/index.js#L6 +- function signedLEB128(value) { +- let bytes = []; +- let byte = 0x00; +- let size = Math.ceil(Math.log2(Math.abs(value))); +- let negative = value < 0; +- let more = true; +- while (more) { +- byte = value & 127; +- value = value >> 7; +- if (negative) { +- value = value | -(1 << (size - 7)); +- } +- if ((value == 0 && (byte & 0x40) == 0) || +- (value == -1 && (byte & 0x40) == 0x40)) { +- more = false; +- } +- else { +- byte = byte | 128; +- } +- bytes.push(byte); +- } +- return bytes; +- } +- exports.signedLEB128 = signedLEB128; +- // https://webassembly.github.io/spec/core/binary/conventions.html#binary-vec +- // Vectors are encoded with their length followed by their element sequence +- exports.encodeFlatVector = (data) => unsignedLEB128(data.length).concat(data); +- exports.encodeNestedVector = (data) => unsignedLEB128(data.length).concat(utils_1.flatten(data)); +- // subSections is an array of arrays +- function encodeSection(type, subSections) { +- // Sections are all optional, so if we get an empty vector of subSections, we +- // can omit the whole section. +- if (subSections.length === 0) { +- return []; +- } +- // The size of this vector is not needed for decoding, but can be +- // used to skip sections when navigating through a binary. +- // TODO: Remove this assertion once we are more confident in our output. +- const vec = exports.encodeFlatVector(exports.encodeNestedVector(subSections)); +- vec.unshift(type); +- return vec; +- } +- exports.encodeSection = encodeSection; +- +- } (encoding)); +- return encoding; +-} +- +-var shims = {}; +- +-var hasRequiredShims; +- +-function requireShims () { +- if (hasRequiredShims) return shims; +- hasRequiredShims = 1; +- Object.defineProperty(shims, "__esModule", { value: true }); +- const EPSILON = 0.00001; +- const shims$1 = { +- // TODO: Reimplement some of these functions natively in Wasm? +- sin: Math.sin, +- cos: Math.cos, +- tan: Math.tan, +- asin: Math.asin, +- acos: Math.acos, +- atan: Math.atan, +- atan2: Math.atan2, +- rand: a => Math.random() * a, +- pow: Math.pow, +- log: Math.log, +- log10: Math.log10, +- exp: Math.exp, +- sigmoid: function (x, y) { +- const t = 1 + Math.exp(-x * y); +- return Math.abs(t) > EPSILON ? 1.0 / t : 0; +- }, +- }; +- shims.default = shims$1; +- +- return shims; +-} +- +-var wasmFunctions = {}; +- +-var constants = {}; +- +-var hasRequiredConstants; +- +-function requireConstants () { +- if (hasRequiredConstants) return constants; +- hasRequiredConstants = 1; +- (function (exports) { +- Object.defineProperty(exports, "__esModule", { value: true }); +- // https://webassembly.github.io/spec/core/exec/runtime.html#page-size +- const WASM_PAGE_SIZE = 65536; +- const BYTES_PER_F64 = 8; +- const BUFFER_COUNT = 2; +- // https://github.com/WACUP/vis_milk2/blob/de9625a89e724afe23ed273b96b8e48496095b6c/ns-eel2/ns-eel.h#L136 +- exports.MAX_LOOP_COUNT = 1048576; +- // The number of items allowed in each buffer (megabuf/gmegabuf). +- // https://github.com/WACUP/vis_milk2/blob/de9625a89e724afe23ed273b96b8e48496095b6c/ns-eel2/ns-eel.h#L145 +- exports.BUFFER_SIZE = 65536 * 128; +- exports.WASM_MEMORY_SIZE = Math.ceil((exports.BUFFER_SIZE * BYTES_PER_F64 * BUFFER_COUNT) / WASM_PAGE_SIZE); +- +- } (constants)); +- return constants; +-} +- +-var hasRequiredWasmFunctions; +- +-function requireWasmFunctions () { +- if (hasRequiredWasmFunctions) return wasmFunctions; +- hasRequiredWasmFunctions = 1; +- Object.defineProperty(wasmFunctions, "__esModule", { value: true }); +- const encoding_1 = requireEncoding(); +- const constants_1 = requireConstants(); +- wasmFunctions.localFuncMap = { +- sqr: { +- args: [encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- binary: [...encoding_1.op.local_get(0), ...encoding_1.op.local_get(0), encoding_1.op.f64_mul], +- }, +- bor: { +- args: [encoding_1.VAL_TYPE.f64, encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- binary: [ +- ...encoding_1.op.local_get(0), +- ...encoding_1.IS_NOT_ZEROISH, +- ...encoding_1.op.local_get(1), +- ...encoding_1.IS_NOT_ZEROISH, +- encoding_1.op.i32_or, +- ...encoding_1.op.i32_const(0), +- encoding_1.op.i32_ne, +- encoding_1.op.f64_convert_i32_s, +- ], +- }, +- band: { +- args: [encoding_1.VAL_TYPE.f64, encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- binary: [ +- ...encoding_1.op.local_get(0), +- ...encoding_1.IS_NOT_ZEROISH, +- ...encoding_1.op.local_get(1), +- ...encoding_1.IS_NOT_ZEROISH, +- encoding_1.op.i32_and, +- ...encoding_1.op.i32_const(0), +- encoding_1.op.i32_ne, +- encoding_1.op.f64_convert_i32_s, +- ], +- }, +- sign: { +- args: [encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- binary: [ +- ...encoding_1.op.f64_const(0), +- ...encoding_1.op.local_get(0), +- encoding_1.op.f64_lt, +- ...encoding_1.op.local_get(0), +- ...encoding_1.op.f64_const(0), +- encoding_1.op.f64_lt, +- encoding_1.op.i32_sub, +- encoding_1.op.f64_convert_i32_s, +- ], +- }, +- mod: { +- args: [encoding_1.VAL_TYPE.f64, encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- localVariables: [encoding_1.VAL_TYPE.i32], +- // TODO: Simplify all this type coersion +- binary: [ +- ...encoding_1.op.local_get(1), +- encoding_1.op.i32_trunc_f64_s, +- ...encoding_1.op.local_tee(2), +- ...encoding_1.op.i32_const(0), +- encoding_1.op.i32_ne, +- ...encoding_1.op.if(encoding_1.BLOCK.f64), +- ...encoding_1.op.local_get(0), +- encoding_1.op.i32_trunc_f64_s, +- ...encoding_1.op.local_get(2), +- encoding_1.op.i32_rem_s, +- encoding_1.op.f64_convert_i32_s, +- encoding_1.op.else, +- ...encoding_1.op.f64_const(0), +- encoding_1.op.end, +- ], +- }, +- bitwiseOr: { +- args: [encoding_1.VAL_TYPE.f64, encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- binary: [ +- ...encoding_1.op.local_get(0), +- encoding_1.op.i64_trunc_s_f64, +- ...encoding_1.op.local_get(1), +- encoding_1.op.i64_trunc_s_f64, +- encoding_1.op.i64_or, +- encoding_1.op.f64_convert_i64_s, +- ], +- }, +- bitwiseAnd: { +- args: [encoding_1.VAL_TYPE.f64, encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- binary: [ +- ...encoding_1.op.local_get(0), +- encoding_1.op.i64_trunc_s_f64, +- ...encoding_1.op.local_get(1), +- encoding_1.op.i64_trunc_s_f64, +- encoding_1.op.i64_and, +- encoding_1.op.f64_convert_i64_s, +- ], +- }, +- div: { +- args: [encoding_1.VAL_TYPE.f64, encoding_1.VAL_TYPE.f64], +- returns: [encoding_1.VAL_TYPE.f64], +- localVariables: [encoding_1.VAL_TYPE.i32], +- binary: [ +- ...encoding_1.op.local_get(1), +- ...encoding_1.op.f64_const(0), +- encoding_1.op.f64_ne, +- ...encoding_1.op.if(encoding_1.BLOCK.f64), +- ...encoding_1.op.local_get(0), +- ...encoding_1.op.local_get(1), +- encoding_1.op.f64_div, +- encoding_1.op.else, +- ...encoding_1.op.f64_const(0), +- encoding_1.op.end, +- ], +- }, +- // Takes a float buffer index and converts it to an int. Values out of range +- // are returned as `-1`. +- // +- // NOTE: There's actually a subtle bug that exists in Milkdrop's Eel +- // implementation, which we reproduce here. +- // +- // Wasm's `trunc()` rounds towards zero. This means that for index `-1` we +- // will return zero, since: `roundTowardZero(-1 + EPSILON) == 0` +- // +- // A subsequent check handles negative indexes, so negative indexes > than +- // `-1` are not affected. +- _getBufferIndex: { +- args: [encoding_1.VAL_TYPE.f64 /* 0: $index */], +- returns: [encoding_1.VAL_TYPE.i32 /* $noramlizedIndex */], +- localVariables: [ +- encoding_1.VAL_TYPE.f64, +- encoding_1.VAL_TYPE.i32, +- ], +- binary: [ +- ...encoding_1.op.f64_const(encoding_1.EPSILON), +- ...encoding_1.op.local_get(0), +- encoding_1.op.f64_add, +- // STACK: [$i + EPSILON] +- ...encoding_1.op.local_tee(1), +- encoding_1.op.i32_trunc_f64_s, +- // TODO We could probably make this a tee and get rid of the next get if we swap the final condition +- ...encoding_1.op.local_set(2), +- // STACK: [] +- ...encoding_1.op.i32_const(-1), +- ...encoding_1.op.local_get(2), +- // STACK: [-1, $truncated] +- ...encoding_1.op.i32_const(8), +- encoding_1.op.i32_mul, +- // STACK: [-1, $truncated * 8] +- ...encoding_1.op.local_get(2), +- ...encoding_1.op.i32_const(0), +- // STACK: [-1, $truncated * 8, $truncated, 0] +- encoding_1.op.i32_lt_s, +- // STACK: [-1, $truncated * 8, ] +- ...encoding_1.op.local_get(2), +- ...encoding_1.op.i32_const(constants_1.BUFFER_SIZE - 1), +- encoding_1.op.i32_gt_s, +- // STACK: [-1, $truncated * 8, , ] +- encoding_1.op.i32_or, +- // STACK: [-1, $truncated * 8, ] +- encoding_1.op.select, +- ], +- }, +- }; +- +- return wasmFunctions; +-} +- +-var hasRequiredEmitter; +- +-function requireEmitter () { +- if (hasRequiredEmitter) return emitter; +- hasRequiredEmitter = 1; +- var __importDefault = (emitter && emitter.__importDefault) || function (mod) { +- return (mod && mod.__esModule) ? mod : { "default": mod }; +- }; +- Object.defineProperty(emitter, "__esModule", { value: true }); +- const encoding_1 = requireEncoding(); +- const shims_1 = __importDefault(requireShims()); +- const errorUtils_1 = requireErrorUtils(); +- const wasmFunctions_1 = requireWasmFunctions(); +- const utils_1 = requireUtils(); +- const constants_1 = requireConstants(); +- function emit(ast, context) { +- var _a, _b, _c; +- switch (ast.type) { +- case "SCRIPT": { +- const body = ast.body.map((statement, i) => { +- return [...emit(statement, context), encoding_1.op.drop]; +- }); +- return utils_1.flatten(body); +- } +- case "EXPRESSION_BLOCK": { +- return emitExpressionBlock(ast.body, context); +- } +- case "BINARY_EXPRESSION": { +- const left = emit(ast.left, context); +- const right = emit(ast.right, context); +- const operatorToOps = { +- "+": [encoding_1.op.f64_add], +- "-": [encoding_1.op.f64_sub], +- "*": [encoding_1.op.f64_mul], +- "/": context.resolveFunc("div"), +- "%": context.resolveFunc("mod"), +- "|": context.resolveFunc("bitwiseOr"), +- "&": context.resolveFunc("bitwiseAnd"), +- "^": context.resolveFunc("pow"), +- // Comparison operators +- "==": [encoding_1.op.f64_sub, ...encoding_1.IS_ZEROISH, encoding_1.op.f64_convert_i32_s], +- "!=": [encoding_1.op.f64_sub, ...encoding_1.IS_NOT_ZEROISH, encoding_1.op.f64_convert_i32_s], +- "<": [encoding_1.op.f64_lt, encoding_1.op.f64_convert_i32_s], +- ">": [encoding_1.op.f64_gt, encoding_1.op.f64_convert_i32_s], +- "<=": [encoding_1.op.f64_le, encoding_1.op.f64_convert_i32_s], +- ">=": [encoding_1.op.f64_ge, encoding_1.op.f64_convert_i32_s], +- }; +- const code = operatorToOps[ast.operator]; +- if (code == null) { +- throw errorUtils_1.createCompilerError(`Unknown binary expression operator ${ast.operator}`, ast.loc, context.rawSource); +- } +- return [...left, ...right, ...code]; +- } +- case "CALL_EXPRESSION": { +- const functionName = ast.callee.value; +- // Destructure this so that TypeScript knows it won't get mutated. +- const argList = ast.arguments; +- const assertArity = (arity) => { +- if (argList.length < arity) { +- throw errorUtils_1.createUserError(`Too few arguments passed to \`${functionName}()\`. Expected ${arity} but only got ${argList.length}.`, ast.loc, context.rawSource); +- } +- if (argList.length > arity) { +- throw errorUtils_1.createUserError(`Too many arguments passed to \`${functionName}()\`. Expected ${arity} but got ${argList.length}.`, argList[arity].loc, context.rawSource); +- } +- }; +- // Some functions have special behavior +- switch (functionName) { +- case "exec2": +- assertArity(2); +- return emitExpressionBlock(ast.arguments, context); +- case "exec3": +- assertArity(3); +- return emitExpressionBlock(ast.arguments, context); +- case "if": +- assertArity(3); +- const [test, consiquent, alternate] = ast.arguments; +- return emitConditional(test, consiquent, alternate, context); +- case "while": +- assertArity(1); +- return emitWhile(ast.arguments[0], context); +- case "loop": +- assertArity(2); +- return emitLoop(ast.arguments[0], ast.arguments[1], context); +- case "megabuf": +- case "gmegabuf": +- assertArity(1); +- const index = context.resolveLocal(encoding_1.VAL_TYPE.i32); +- return [ +- ...emit(ast.arguments[0], context), +- ...((_a = context.resolveFunc("_getBufferIndex")) !== null && _a !== void 0 ? _a : []), +- ...encoding_1.op.local_tee(index), +- ...encoding_1.op.i32_const(-1), +- encoding_1.op.i32_ne, +- // STACK: [in range] +- ...encoding_1.op.if(encoding_1.BLOCK.f64), +- ...encoding_1.op.local_get(index), +- ...encoding_1.op.f64_load(3, emitAddMemoryOffset(functionName)), +- encoding_1.op.else, +- ...encoding_1.op.f64_const(0), +- encoding_1.op.end, +- ]; +- case "assign": +- assertArity(2); +- const variableIdentifier = ast.arguments[0]; +- if (variableIdentifier.type != "IDENTIFIER") { +- throw errorUtils_1.createUserError("Expected the first argument of `assign()` to be an identifier.", variableIdentifier.loc, context.rawSource); +- } +- const resolvedName = context.resolveVar(variableIdentifier.value); +- return [ +- ...emit(ast.arguments[1], context), +- ...encoding_1.op.global_set(resolvedName), +- ...encoding_1.op.global_get(resolvedName), +- ]; +- } +- // Function calls which can be linlined +- const args = utils_1.flatten(ast.arguments.map(node => emit(node, context))); +- // This is just a continuation of the above switch statement, but it's for functions which all parse their args the same. +- switch (functionName) { +- case "abs": +- assertArity(1); +- return [...args, encoding_1.op.f64_abs]; +- case "sqrt": +- assertArity(1); +- return [...args, encoding_1.op.f64_abs, encoding_1.op.f64_sqrt]; +- case "int": +- assertArity(1); +- return [...args, encoding_1.op.f64_floor]; +- case "min": +- assertArity(2); +- return [...args, encoding_1.op.f64_min]; +- case "max": +- assertArity(2); +- return [...args, encoding_1.op.f64_max]; +- case "above": +- assertArity(2); +- return [...args, encoding_1.op.f64_gt, encoding_1.op.f64_convert_i32_s]; +- case "below": +- assertArity(2); +- return [...args, encoding_1.op.f64_lt, encoding_1.op.f64_convert_i32_s]; +- case "equal": +- assertArity(2); +- return [...args, encoding_1.op.f64_sub, ...encoding_1.IS_ZEROISH, encoding_1.op.f64_convert_i32_s]; +- case "bnot": +- assertArity(1); +- return [...args, ...encoding_1.IS_ZEROISH, encoding_1.op.f64_convert_i32_s]; +- case "floor": +- assertArity(1); +- return [...args, encoding_1.op.f64_floor]; +- case "ceil": +- assertArity(1); +- return [...args, encoding_1.op.f64_ceil]; +- } +- const invocation = context.resolveFunc(functionName); +- if (invocation == null || +- // Ensure this isn't a private function. This is a bit awkward becuase +- // Eel does implement some _ functions but while they are _intended_ to be +- // private, they accidentally expose them. We should find a cleaner way +- // to defining user accessible functions vs utility functions used by +- // the compiler. +- functionName.startsWith("_")) { +- throw errorUtils_1.createUserError(`"${functionName}" is not defined.`, ast.callee.loc, context.rawSource); +- } +- if (shims_1.default[functionName] != null) { +- assertArity(shims_1.default[functionName].length); +- } +- else if (wasmFunctions_1.localFuncMap[functionName] != null) { +- assertArity(wasmFunctions_1.localFuncMap[functionName].args.length); +- } +- else { +- throw errorUtils_1.createCompilerError(`Missing arity information for the function \`${functionName}()\``, ast.callee.loc, context.rawSource); +- } +- return [...args, ...invocation]; +- } +- case "ASSIGNMENT_EXPRESSION": { +- const { left } = ast; +- const rightCode = emit(ast.right, context); +- const mutationCode = getAssignmentOperatorMutation(ast, context); +- if (left.type === "IDENTIFIER") { +- const resolvedName = context.resolveVar(left.value); +- // TODO: In lots of cases we don't care about the return value. In those +- // cases we should try to find a way to omit the `get/drop` combo. +- // Peephole optimization seems to be the conventional way to do this. +- // https://en.wikipedia.org/wiki/Peephole_optimization +- const get = encoding_1.op.global_get(resolvedName); +- const set = encoding_1.op.global_set(resolvedName); +- // `=` is a special case in that it does not need the original value. +- if (mutationCode === null) { +- return [...rightCode, ...set, ...get]; +- } +- return [...get, ...rightCode, ...mutationCode, ...set, ...get]; +- } +- if (left.type !== "CALL_EXPRESSION") { +- throw errorUtils_1.createCompilerError( +- // @ts-ignore This is a guard in case the parser has an error +- `Unexpected left hand side type for assignment: ${left.type}`, ast.loc, context.rawSource); +- } +- // Special assignment case for `megabuf(n) = e` and `gmegabuf(n) = e`. +- const localIndex = context.resolveLocal(encoding_1.VAL_TYPE.i32); +- if (left.arguments.length !== 1) { +- throw errorUtils_1.createUserError(`Expected 1 argument when assinging to a buffer but got ${left.arguments.length}.`, left.arguments.length === 0 ? left.loc : left.arguments[1].loc, context.rawSource); +- } +- const bufferName = left.callee.value; +- if (bufferName !== "gmegabuf" && bufferName !== "megabuf") { +- throw errorUtils_1.createUserError("The only function calls which may be assigned to are `gmegabuf()` and `megabuf()`.", left.callee.loc, context.rawSource); +- } +- const addOffset = emitAddMemoryOffset(bufferName); +- if (mutationCode === null) { +- // TODO: Move this to wasmFunctions once we know how to call functions +- // from within functions (need to get the offset). +- const unnormalizedIndex = context.resolveLocal(encoding_1.VAL_TYPE.i32); +- const rightValue = context.resolveLocal(encoding_1.VAL_TYPE.f64); +- return [ +- // Emit the right hand side unconditionally to ensure it always runs. +- ...rightCode, +- ...encoding_1.op.local_set(rightValue), +- ...emit(left.arguments[0], context), +- ...((_b = context.resolveFunc("_getBufferIndex")) !== null && _b !== void 0 ? _b : []), +- ...encoding_1.op.local_tee(unnormalizedIndex), +- ...encoding_1.op.i32_const(0), +- encoding_1.op.i32_lt_s, +- // STACK: [is the index out of range?] +- ...encoding_1.op.if(encoding_1.BLOCK.f64), +- ...encoding_1.op.f64_const(0), +- encoding_1.op.else, +- ...encoding_1.op.local_get(unnormalizedIndex), +- ...encoding_1.op.local_tee(localIndex), +- // STACK: [buffer index] +- ...encoding_1.op.local_get(rightValue), +- // STACK: [buffer index, right] +- ...encoding_1.op.f64_store(3, addOffset), +- // STACK: [] +- ...encoding_1.op.local_get(rightValue), +- // STACK: [Right/Buffer value] +- encoding_1.op.end, +- ]; +- } +- // TODO: Move this to wasmFunctions once we know how to call functions +- // from within functions (need to get the offset). +- const index = context.resolveLocal(encoding_1.VAL_TYPE.i32); +- const inBounds = context.resolveLocal(encoding_1.VAL_TYPE.i32); +- const rightValue = context.resolveLocal(encoding_1.VAL_TYPE.f64); +- const result = context.resolveLocal(encoding_1.VAL_TYPE.f64); +- return [ +- ...rightCode, +- ...encoding_1.op.local_set(rightValue), +- ...emit(left.arguments[0], context), +- ...((_c = context.resolveFunc("_getBufferIndex")) !== null && _c !== void 0 ? _c : []), +- ...encoding_1.op.local_tee(index), +- // STACK: [index] +- ...encoding_1.op.i32_const(-1), +- encoding_1.op.i32_ne, +- ...encoding_1.op.local_tee(inBounds), +- ...encoding_1.op.if(encoding_1.BLOCK.f64), +- ...encoding_1.op.local_get(index), +- ...encoding_1.op.f64_load(3, addOffset), +- encoding_1.op.else, +- ...encoding_1.op.f64_const(0), +- encoding_1.op.end, +- // STACK: [current value from memory || 0] +- // Apply the mutation +- ...encoding_1.op.local_get(rightValue), +- ...mutationCode, +- ...encoding_1.op.local_tee(result), +- // STACK: [new value] +- ...encoding_1.op.local_get(inBounds), +- ...encoding_1.op.if(encoding_1.BLOCK.void), +- ...encoding_1.op.local_get(index), +- ...encoding_1.op.local_get(result), +- ...encoding_1.op.f64_store(3, addOffset), +- encoding_1.op.end, +- ]; +- } +- case "LOGICAL_EXPRESSION": { +- const left = emit(ast.left, context); +- const right = emit(ast.right, context); +- const behaviorMap = { +- "&&": { +- comparison: encoding_1.IS_ZEROISH, +- shortCircutValue: 0, +- }, +- "||": { +- comparison: encoding_1.IS_NOT_ZEROISH, +- shortCircutValue: 1, +- }, +- }; +- const behavior = behaviorMap[ast.operator]; +- if (behavior == null) { +- throw errorUtils_1.createCompilerError(`Unknown logical expression operator ${ast.operator}`, ast.loc, context.rawSource); +- } +- const { comparison, shortCircutValue } = behavior; +- return [ +- ...left, +- ...comparison, +- ...encoding_1.op.if(encoding_1.BLOCK.f64), +- ...encoding_1.op.f64_const(shortCircutValue), +- encoding_1.op.else, +- ...right, +- ...encoding_1.IS_NOT_ZEROISH, +- encoding_1.op.f64_convert_i32_s, +- encoding_1.op.end, +- ]; +- } +- case "UNARY_EXPRESSION": { +- const value = emit(ast.value, context); +- const operatorToCode = { +- "-": [encoding_1.op.f64_neg], +- "+": [], +- "!": [...encoding_1.IS_ZEROISH, encoding_1.op.f64_convert_i32_s], +- }; +- const code = operatorToCode[ast.operator]; +- if (code == null) { +- throw errorUtils_1.createCompilerError(`Unknown logical unary operator ${ast.operator}`, ast.loc, context.rawSource); +- } +- return [...value, ...code]; +- } +- case "IDENTIFIER": +- const variableName = ast.value; +- // TODO: It's a bit odd that not every IDENTIFIER node gets emitted. In +- // function calls and assignments we just peek at the name and never emit +- // it. +- return encoding_1.op.global_get(context.resolveVar(variableName)); +- case "NUMBER_LITERAL": +- return encoding_1.op.f64_const(ast.value); +- default: +- throw errorUtils_1.createCompilerError( +- // @ts-ignore This runtime check is here because the caller may not be type-checked +- `Unknown AST node type ${ast.type}`, +- // @ts-ignore This runtime check is here because the caller may not be type-checked +- ast.loc, context.rawSource); +- } +- } +- emitter.emit = emit; +- function emitExpressionBlock(body, context) { +- const statements = body.map((statement, i) => { +- return emit(statement, context); +- }); +- return utils_1.flatten(utils_1.arrayJoin(statements, [encoding_1.op.drop])); +- } +- function emitWhile(expression, context) { +- const body = emit(expression, context); +- const iterationCount = context.resolveLocal(encoding_1.VAL_TYPE.i32); +- return [ +- ...encoding_1.op.i32_const(0), +- ...encoding_1.op.local_set(iterationCount), +- ...encoding_1.op.loop(encoding_1.BLOCK.void), +- // Increment and check loop count +- ...encoding_1.op.local_get(iterationCount), +- ...encoding_1.op.i32_const(1), +- encoding_1.op.i32_add, +- ...encoding_1.op.local_tee(iterationCount), +- // STACK: [iteration count] +- ...encoding_1.op.i32_const(constants_1.MAX_LOOP_COUNT), +- encoding_1.op.i32_lt_u, +- // STACK: [loop in range] +- ...body, +- ...encoding_1.IS_NOT_ZEROISH, +- // STACK: [loop in range, body is truthy] +- encoding_1.op.i32_and, +- // STACK: [can continue] +- ...encoding_1.op.br_if(0), +- encoding_1.op.end, +- ...encoding_1.op.f64_const(0), +- ]; +- } +- function emitLoop(count, expression, context) { +- const body = emit(expression, context); +- const localIndex = context.resolveLocal(encoding_1.VAL_TYPE.i32); +- return [ +- ...encoding_1.op.block(encoding_1.BLOCK.void), +- // Assign the count to a variable +- ...emit(count, context), +- encoding_1.op.i32_trunc_f64_s, +- ...encoding_1.op.local_tee(localIndex), +- ...encoding_1.op.i32_const(0), +- encoding_1.op.i32_le_s, +- ...encoding_1.op.br_if(1), +- ...encoding_1.op.loop(encoding_1.BLOCK.void), +- // Run the body +- ...body, +- encoding_1.op.drop, +- // Decrement the count +- ...encoding_1.op.local_get(localIndex), +- ...encoding_1.op.i32_const(1), +- encoding_1.op.i32_sub, +- ...encoding_1.op.local_tee(localIndex), +- ...encoding_1.op.i32_const(0), +- encoding_1.op.i32_ne, +- ...encoding_1.op.br_if(0), +- encoding_1.op.end, +- encoding_1.op.end, +- ...encoding_1.op.f64_const(0), +- ]; +- } +- function emitConditional(test, consiquent, alternate, context) { +- // TODO: In some cases https://webassembly.studio/ compiles these to use `select`. +- // Is that an optimization that we might want as well? +- return [ +- ...emit(test, context), +- ...encoding_1.IS_NOT_ZEROISH, +- ...encoding_1.op.if(encoding_1.BLOCK.f64), +- ...emit(consiquent, context), +- encoding_1.op.else, +- ...emit(alternate, context), +- encoding_1.op.end, +- ]; +- } +- // There are two sections of memory. This function emits code to add the correct +- // offset to an i32 index already on the stack. +- function emitAddMemoryOffset(name) { +- switch (name) { +- case "gmegabuf": +- return constants_1.BUFFER_SIZE * 8; +- case "megabuf": +- return 0; +- } +- } +- function getAssignmentOperatorMutation(ast, context) { +- const operatorToCode = { +- "+=": [encoding_1.op.f64_add], +- "-=": [encoding_1.op.f64_sub], +- "*=": [encoding_1.op.f64_mul], +- "/=": [encoding_1.op.f64_div], +- "%=": context.resolveFunc("mod"), +- "=": null, +- }; +- const operatorCode = operatorToCode[ast.operator]; +- if (operatorCode === undefined) { +- throw errorUtils_1.createCompilerError(`Unknown assignment operator "${ast.operator}"`, ast.loc, context.rawSource); +- } +- return operatorCode; +- } +- +- return emitter; +-} +- +-var hasRequiredCompiler; +- +-function requireCompiler () { +- if (hasRequiredCompiler) return compiler; +- hasRequiredCompiler = 1; +- var __importDefault = (compiler && compiler.__importDefault) || function (mod) { +- return (mod && mod.__esModule) ? mod : { "default": mod }; +- }; +- var __importStar = (compiler && compiler.__importStar) || function (mod) { +- if (mod && mod.__esModule) return mod; +- var result = {}; +- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; +- result["default"] = mod; +- return result; +- }; +- Object.defineProperty(compiler, "__esModule", { value: true }); +- const parser_1 = requireParser(); +- const emitter_1 = requireEmitter(); +- const encoding_1 = requireEncoding(); +- const shims_1 = __importDefault(requireShims()); +- const Utils = __importStar(requireUtils()); +- const wasmFunctions_1 = requireWasmFunctions(); +- const constants_1 = requireConstants(); +- function compileModule({ pools, functions: funcs, eelVersion = 2, preParsed = false, }) { +- if (Object.keys(pools).includes("shims")) { +- throw new Error('You may not name a pool "shims". "shims" is reserved for injected JavaScript functions.'); +- } +- // Collect all the globals that we expect to get as imports. +- const importedVars = []; +- Object.entries(pools).forEach(([poolName, pool]) => { +- pool.forEach(variableName => { +- importedVars.push([poolName, variableName]); +- }); +- }); +- // Ensure all the imported globals get the first ids. +- const varResolver = new Utils.ScopedIdMap(); +- importedVars.forEach(([poolName, variableName]) => { +- varResolver.get(poolName, variableName); +- }); +- const functionImports = Object.entries(shims_1.default).map(([name, func]) => { +- return { +- args: new Array(func.length).fill(null).map(_ => encoding_1.VAL_TYPE.f64), +- // Shims implicitly always return a number +- returns: [encoding_1.VAL_TYPE.f64], +- name, +- }; +- }); +- const localFuncOrder = []; +- const moduleFuncs = []; +- Object.entries(funcs).forEach(([name, { pool, code }]) => { +- if (pools[pool] == null) { +- const poolsList = Object.keys(pools); +- if (poolsList.length === 0) { +- throw new Error(`The function "${name}" was declared as using a variable ` + +- `pool named "${pool}" but no pools were defined.`); +- } +- throw new Error(`The function "${name}" was declared as using a variable ` + +- `pool named "${pool}" which is not among the variable ` + +- `pools defined. The defined variable pools are: ` + +- `${Utils.formatList(poolsList)}.`); +- } +- const ast = preParsed ? code : parser_1.parse(code); +- if (typeof ast === "string") { +- // TODO: Change the API so this can be enforced by types +- throw new Error("Got passed unparsed code without setting the preParsed flag"); +- } +- if (ast.type !== "SCRIPT") { +- throw new Error("Invalid AST"); +- } +- if (ast.body.length === 0) { +- return; +- } +- const localVariables = []; +- const context = { +- resolveVar: name => { +- // The `reg00`-`reg99` variables are special in that they are shared between all pools. +- if (/^reg\d\d$/.test(name)) { +- return varResolver.get(null, name); +- } +- return varResolver.get(pool, name); +- }, +- resolveLocal: type => { +- // TODO: We could provide a way for the emitter to release a local +- // variable so that we can reuse it, much in the same way a traditional +- // compiler does in register allocation. +- localVariables.push(type); +- return localVariables.length - 1; +- }, +- resolveFunc: name => { +- // If this is a shim, return the shim index. +- const shimdex = functionImports.findIndex(func => func.name === name); +- if (shimdex !== -1) { +- const call = encoding_1.op.call(shimdex); +- if (name === "rand" && eelVersion === 1) { +- return [...call, encoding_1.op.f64_floor]; +- } +- return call; +- } +- // If it's not a shim and it's not a defined function, return null. +- // The emitter will generate a nice error. +- if (wasmFunctions_1.localFuncMap[name] == null) { +- return null; +- } +- let index = localFuncOrder.indexOf(name); +- if (index === -1) { +- localFuncOrder.push(name); +- index = localFuncOrder.length - 1; +- } +- return encoding_1.op.call(index + functionImports.length); +- }, +- rawSource: code, +- }; +- const binary = emitter_1.emit(ast, context); +- moduleFuncs.push({ +- binary, +- exportName: name, +- args: [], +- returns: [], +- localVariables, +- }); +- }); +- const localFuncs = localFuncOrder.map(name => { +- const func = wasmFunctions_1.localFuncMap[name]; +- // This check is technicaly redundant since we check inside resolveLocalFunc +- // in the compiler context. It's here just to catch potential compiler bugs. +- if (func == null) { +- throw new Error(`Undefined local function "${name}"`); +- } +- return func; +- }); +- // Given a function definition, return a hashable string representation of its signature. +- const getSignatureKey = (func) => { +- return [...func.args, "|", ...func.returns].join("-"); +- }; +- // https://webassembly.github.io/spec/core/binary/modules.html#type-section +- const types = []; +- const typeIndexByKey = new Map(); +- [...functionImports, ...localFuncs, ...moduleFuncs].forEach(func => { +- const key = getSignatureKey(func); +- if (typeIndexByKey.has(key)) { +- return; +- } +- types.push([ +- encoding_1.FUNCTION_TYPE, +- ...encoding_1.encodeFlatVector(func.args), +- ...encoding_1.encodeFlatVector(func.returns), +- ]); +- typeIndexByKey.set(key, types.length - 1); +- }); +- function getTypeIndex(func) { +- const key = getSignatureKey(func); +- const typeIndex = typeIndexByKey.get(key); +- if (typeIndex == null) { +- throw new Error(`Failed to get a type index for key ${key}`); +- } +- return typeIndex; +- } +- // https://webassembly.github.io/spec/core/binary/modules.html#import-section +- const imports = [ +- ...importedVars.map(([namespace, name]) => { +- return [ +- ...encoding_1.encodeString(namespace), +- ...encoding_1.encodeString(name), +- ...[encoding_1.GLOBAL_TYPE, encoding_1.VAL_TYPE.f64, encoding_1.MUTABILITY.var], +- ]; +- }), +- ...functionImports.map((func, i) => { +- const typeIndex = getTypeIndex(func); +- return [ +- ...encoding_1.encodeString("shims"), +- ...encoding_1.encodeString(func.name), +- ...[encoding_1.TYPE_IDX, ...encoding_1.unsignedLEB128(typeIndex)], +- ]; +- }), +- ]; +- // https://webassembly.github.io/spec/core/binary/modules.html#function-section +- // +- // > Functions are referenced through function indices, starting with the smallest +- // > index not referencing a function import. +- const functions = [...localFuncs, ...moduleFuncs].map(func => { +- const typeIndex = getTypeIndex(func); +- return encoding_1.unsignedLEB128(typeIndex); +- }); +- const memories = [ +- // Only one memory +- [ +- 0x01, +- ...encoding_1.unsignedLEB128(constants_1.WASM_MEMORY_SIZE), +- ...encoding_1.unsignedLEB128(constants_1.WASM_MEMORY_SIZE), +- ], +- ]; +- // https://webassembly.github.io/spec/core/binary/modules.html#global-section +- const globalCount = varResolver.size() - importedVars.length; +- const globals = Utils.times(globalCount, () => { +- return [ +- encoding_1.VAL_TYPE.f64, +- encoding_1.MUTABILITY.var, +- ...encoding_1.op.f64_const(0), +- encoding_1.op.end, +- ]; +- }); +- // https://webassembly.github.io/spec/core/binary/modules.html#binary-exportsec +- const xports = [...moduleFuncs].map((func, i) => { +- const funcIndex = i + functionImports.length + localFuncs.length; +- return [ +- ...encoding_1.encodeString(func.exportName), +- encoding_1.EXPORT_TYPE.FUNC, +- ...encoding_1.unsignedLEB128(funcIndex), +- ]; +- }); +- /* Uncomment this to expose memory +- xports.push([ +- ...encodeString("memory"), +- EXPORT_TYPE.MEMORY, +- ...unsignedLEB128(0), +- ]); +- */ +- // https://webassembly.github.io/spec/core/binary/modules.html#code-section +- const codes = [...localFuncs, ...moduleFuncs].map(func => { +- var _a; +- // TODO: We could collapose consecutive types here, or even move to a two +- // pass approach where ids are resolved after the emitter is run. +- const localTypes = ((_a = func.localVariables) !== null && _a !== void 0 ? _a : []).map(type => { +- return [...encoding_1.unsignedLEB128(1), type]; +- }); +- // It's a bit odd that every other section is an array of arrays and this +- // one is an array of vectors. The spec says this is so that when navigating +- // the binary functions can be skipped efficiently. +- return encoding_1.encodeFlatVector([ +- ...encoding_1.encodeNestedVector(localTypes), +- ...func.binary, +- encoding_1.op.end, +- ]); +- }); +- return new Uint8Array([ +- // Magic module header +- ...encoding_1.MAGIC, +- // Version number +- ...encoding_1.WASM_VERSION, +- ...encoding_1.encodeSection(encoding_1.SECTION.TYPE, types), +- ...encoding_1.encodeSection(encoding_1.SECTION.IMPORT, imports), +- ...encoding_1.encodeSection(encoding_1.SECTION.FUNC, functions), +- ...encoding_1.encodeSection(encoding_1.SECTION.MEMORY, memories), +- ...encoding_1.encodeSection(encoding_1.SECTION.GLOBAL, globals), +- ...encoding_1.encodeSection(encoding_1.SECTION.EXPORT, xports), +- ...encoding_1.encodeSection(encoding_1.SECTION.CODE, codes), +- ]); +- } +- compiler.compileModule = compileModule; +- +- return compiler; +-} +- +-var loader = {}; +- +-var hasRequiredLoader; +- +-function requireLoader () { +- if (hasRequiredLoader) return loader; +- hasRequiredLoader = 1; +- var __importDefault = (loader && loader.__importDefault) || function (mod) { +- return (mod && mod.__esModule) ? mod : { "default": mod }; +- }; +- Object.defineProperty(loader, "__esModule", { value: true }); +- const shims_1 = __importDefault(requireShims()); +- const compiler_1 = requireCompiler(); +- async function loadModule({ pools, functions, eelVersion = 2, }) { +- let compilerPools = {}; +- Object.entries(pools).forEach(([key, globals]) => { +- compilerPools[key] = new Set(Object.keys(globals)); +- }); +- const buffer = compiler_1.compileModule({ +- pools: compilerPools, +- functions, +- eelVersion, +- }); +- const mod = await WebAssembly.compile(buffer); +- var importObject = Object.assign(Object.assign({}, pools), { shims: shims_1.default }); +- return await WebAssembly.instantiate(mod, importObject); +- } +- loader.loadModule = loadModule; +- +- return loader; +-} +- +-var hasRequiredSrc; +- +-function requireSrc () { +- if (hasRequiredSrc) return src; +- hasRequiredSrc = 1; +- var __importDefault = (src && src.__importDefault) || function (mod) { +- return (mod && mod.__esModule) ? mod : { "default": mod }; +- }; +- Object.defineProperty(src, "__esModule", { value: true }); +- const parser_1 = requireParser(); +- src.parse = parser_1.parse; +- const compiler_1 = requireCompiler(); +- src.compileModule = compiler_1.compileModule; +- const shims_1 = __importDefault(requireShims()); +- src.shims = shims_1.default; +- const loader_1 = requireLoader(); +- src.loadModule = loader_1.loadModule; +- +- return src; +-} +- +-var srcExports = requireSrc(); ++function t(t,e){let n={destCol:1,srcCol:1,srcLine:1};t.forEach(t=>{t.destCol>e||(n=t);});const r=e-n.destCol;return {column:n.srcCol+r,line:n.srcLine}}var e=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,18],n=[1,7],r=[1,19],s=[1,20],i=[1,14],o=[1,15],a=[1,16],c=[1,33],l=[1,31],h=[1,23],u=[1,22],y=[1,24],p=[1,25],f=[1,26],g=[1,27],m=[1,28],_=[1,29],E=[1,30],d=[5,8,15,18,20,28,29,32,33,34,35,36,37,38],b=[5,15,18],w=[5,12,15,17,18,24,25,28,29,30],S=[1,57],I=[5,8,12,15,17,18,24,25,28,29,30],k=[15,18],O=[5,8,15,18,28,29,38],N=[5,8,15,18,28,29,32,33,38],v=[5,8,15,18,28,29,32,33,34,37,38],R=[5,8,15,18,28,29,32,33,34,35,36,37,38],$=[5,8,15,18],A=[5,8,15,18,20,22,28,29,32,33,34,35,36,37,38],x={trace:function(){},yy:{},symbols_:{error:2,SCRIPT:3,expression:4,EOF:5,expressionsOptionalTrailingSemi:6,separator:7,";":8,expressions:9,EXPRESSION_BLOCK:10,IDENTIFIER:11,IDENTIFIER_TOKEN:12,argument:13,arguments:14,",":15,FUNCTION_CALL:16,"(":17,")":18,LOGICAL_EXPRESSION:19,LOGICAL_OPERATOR_TOKEN:20,ASSIGNMENT:21,ASSIGNMENT_OPERATOR_TOKEN:22,number:23,DIGITS_TOKEN:24,".":25,NUMBER_LITERAL:26,UNARY_EXPRESSION:27,"-":28,"+":29,"!":30,BINARY_EXPRESSION:31,"*":32,"/":33,"%":34,"&":35,"|":36,"^":37,COMPARISON_TOKEN:38,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:";",12:"IDENTIFIER_TOKEN",15:",",17:"(",18:")",20:"LOGICAL_OPERATOR_TOKEN",22:"ASSIGNMENT_OPERATOR_TOKEN",24:"DIGITS_TOKEN",25:".",28:"-",29:"+",30:"!",32:"*",33:"/",34:"%",35:"&",36:"|",37:"^",38:"COMPARISON_TOKEN"},productions_:[0,[3,2],[3,2],[3,1],[7,1],[7,2],[9,2],[9,3],[6,1],[6,2],[10,1],[11,1],[13,1],[13,1],[14,1],[14,3],[16,3],[16,4],[19,3],[21,3],[21,3],[23,1],[23,2],[23,3],[23,2],[23,1],[26,1],[27,2],[27,2],[27,2],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[4,1],[4,1],[4,3],[4,1],[4,1],[4,1],[4,1],[4,1],[4,3]],performAction:function(t,e,n,r,s,i,o){var a=i.length-1;switch(s){case 1:return {type:"SCRIPT",body:[i[a-1]],loc:this._$};case 2:return {type:"SCRIPT",body:i[a-1],loc:this._$};case 3:return {type:"SCRIPT",body:[],loc:this._$};case 6:this.$=[i[a-1]];break;case 7:this.$=i[a-2].concat([i[a-1]]);break;case 8:this.$=i[a];break;case 9:this.$=i[a-1].concat([i[a]]);break;case 10:this.$={type:"EXPRESSION_BLOCK",body:i[a],loc:this._$};break;case 11:this.$={type:"IDENTIFIER",value:i[a].toLowerCase(),loc:this._$};break;case 14:this.$=[i[a]];break;case 15:this.$=i[a-2].concat([i[a]]);break;case 16:this.$={type:"CALL_EXPRESSION",callee:i[a-2],arguments:[],loc:this._$};break;case 17:this.$={type:"CALL_EXPRESSION",callee:i[a-3],arguments:i[a-1],loc:this._$};break;case 18:this.$={type:"LOGICAL_EXPRESSION",left:i[a-2],right:i[a],operator:i[a-1],loc:this._$};break;case 19:case 20:this.$={type:"ASSIGNMENT_EXPRESSION",left:i[a-2],operator:i[a-1],right:i[a],loc:this._$};break;case 21:this.$=Number(i[a]);break;case 22:this.$=Number(i[a-1]);break;case 23:this.$=Number(i[a-2]+i[a-1]+i[a]);break;case 24:this.$=Number("0"+i[a-1]+i[a]);break;case 25:this.$=0;break;case 26:this.$={type:"NUMBER_LITERAL",value:i[a],loc:this._$};break;case 27:case 28:case 29:this.$={type:"UNARY_EXPRESSION",value:i[a],operator:i[a-1],loc:this._$};break;case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:this.$={type:"BINARY_EXPRESSION",left:i[a-2],right:i[a],operator:i[a-1],loc:this._$};break;case 41:case 47:this.$=i[a-1];}},table:[{3:1,4:2,5:[1,4],6:3,9:13,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{1:[3]},{5:[1,21],7:32,8:c,20:l,28:h,29:u,32:y,33:p,34:f,35:g,36:m,37:_,38:E},{5:[1,34]},{1:[2,3]},t(d,[2,39]),t(d,[2,40]),{4:35,6:37,9:13,10:36,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},t(d,[2,42]),t(d,[2,43]),t(d,[2,44],{22:[1,38]}),t(d,[2,45],{17:[1,40],22:[1,39]}),t(d,[2,46]),t(b,[2,8],{31:5,27:6,26:8,21:9,16:10,11:11,19:12,23:17,4:41,12:e,17:n,24:r,25:s,28:i,29:o,30:a}),{4:42,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:43,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:44,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},t(d,[2,26]),t([5,8,15,17,18,20,22,28,29,32,33,34,35,36,37,38],[2,11]),t(d,[2,21],{25:[1,45]}),t(d,[2,25],{24:[1,46]}),{1:[2,1]},{4:47,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:48,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:49,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:50,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:51,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:52,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:53,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:54,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:55,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:56,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},t(w,[2,6],{8:S}),t(I,[2,4]),{1:[2,2]},{7:32,8:c,18:[1,58],20:l,28:h,29:u,32:y,33:p,34:f,35:g,36:m,37:_,38:E},{18:[1,59]},t(k,[2,10]),{4:60,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:61,11:11,12:e,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},{4:65,6:37,9:13,10:66,11:11,12:e,13:64,14:63,16:10,17:n,18:[1,62],19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},t(b,[2,9],{7:67,8:c,20:l,28:h,29:u,32:y,33:p,34:f,35:g,36:m,37:_,38:E}),t(O,[2,27],{20:l,32:y,33:p,34:f,35:g,36:m,37:_}),t(O,[2,28],{20:l,32:y,33:p,34:f,35:g,36:m,37:_}),t(O,[2,29],{20:l,32:y,33:p,34:f,35:g,36:m,37:_}),t(d,[2,22],{24:[1,68]}),t(d,[2,24]),t(O,[2,30],{20:l,32:y,33:p,34:f,35:g,36:m,37:_}),t(O,[2,31],{20:l,32:y,33:p,34:f,35:g,36:m,37:_}),t(N,[2,32],{20:l,34:f,35:g,36:m,37:_}),t(N,[2,33],{20:l,34:f,35:g,36:m,37:_}),t(v,[2,34],{20:l,35:g,36:m}),t(R,[2,35],{20:l}),t(R,[2,36],{20:l}),t(v,[2,37],{20:l,35:g,36:m}),t($,[2,38],{20:l,28:h,29:u,32:y,33:p,34:f,35:g,36:m,37:_,38:E}),t(d,[2,18]),t(I,[2,5]),t(d,[2,41]),t(d,[2,47]),t($,[2,20],{20:l,28:h,29:u,32:y,33:p,34:f,35:g,36:m,37:_,38:E}),t($,[2,19],{20:l,28:h,29:u,32:y,33:p,34:f,35:g,36:m,37:_,38:E}),t(A,[2,16]),{15:[1,70],18:[1,69]},t(k,[2,14]),t(k,[2,12],{7:32,8:c,20:l,28:h,29:u,32:y,33:p,34:f,35:g,36:m,37:_,38:E}),t(k,[2,13]),t(w,[2,7],{8:S}),t(d,[2,23]),t(A,[2,17]),{4:65,6:37,9:13,10:66,11:11,12:e,13:71,16:10,17:n,19:12,21:9,23:17,24:r,25:s,26:8,27:6,28:i,29:o,30:a,31:5},t(k,[2,15])],defaultActions:{4:[2,3],21:[2,1],34:[2,2]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t);},parse:function(t){var e=this,n=[0],r=[null],s=[],i=this.table,o="",a=0,c=0,l=s.slice.call(arguments,1),h=Object.create(this.lexer),u={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(u.yy[y]=this.yy[y]);h.setInput(t,u.yy),u.yy.lexer=h,u.yy.parser=this,void 0===h.yylloc&&(h.yylloc={});var p=h.yylloc;s.push(p);var f=h.options&&h.options.ranges;"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var g,m,_,E,d,b,w,S,I=function(){var t;return "number"!=typeof(t=h.lex()||1)&&(t=e.symbols_[t]||t),t},k={};;){if(m=n[n.length-1],this.defaultActions[m]?_=this.defaultActions[m]:(null==g&&(g=I()),_=i[m]&&i[m][g]),void 0===_||!_.length||!_[0]){var O="";for(d in S=[],i[m])this.terminals_[d]&&d>2&&S.push("'"+this.terminals_[d]+"'");O=h.showPosition?"Parse error on line "+(a+1)+":\n"+h.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(O,{text:h.match,token:this.terminals_[g]||g,line:h.yylineno,loc:p,expected:S});}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+g);switch(_[0]){case 1:n.push(g),r.push(h.yytext),s.push(h.yylloc),n.push(_[1]),g=null,c=h.yyleng,o=h.yytext,a=h.yylineno,p=h.yylloc;break;case 2:if(b=this.productions_[_[1]][1],k.$=r[r.length-b],k._$={first_line:s[s.length-(b||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(b||1)].first_column,last_column:s[s.length-1].last_column},f&&(k._$.range=[s[s.length-(b||1)].range[0],s[s.length-1].range[1]]),void 0!==(E=this.performAction.apply(k,[o,c,a,u.yy,_[1],r,s].concat(l))))return E;b&&(n=n.slice(0,-1*b*2),r=r.slice(0,-1*b),s=s.slice(0,-1*b)),n.push(this.productions_[_[1]][0]),r.push(k.$),s.push(k._$),w=i[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return true}}return true}},L={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e);},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=false,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=true,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=true,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t));},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return (t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=false,this._backtrack=false,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=false),n)return n;if(this._backtrack){for(var i in s)this[i]=s[i];return false}return false},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=true),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),i=0;ie[0].length)){if(e=n,r=i,this.options.backtrack_lexer){if(false!==(t=this.test_match(n,s[i])))return t;if(this._backtrack){e=false;continue}return false}if(!this.options.flex)break}return e?false!==(t=this.test_match(e,s[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t);},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return (t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t);},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:break;case 1:return 24;case 2:return 38;case 3:return 22;case 4:return 20;case 5:return 12;case 6:return 5;case 7:return e.yytext[0]}},rules:[/^(?:\s+)/,/^(?:[0-9]+)/,/^(?:(==|!=|<=|>=|<|>))/,/^(?:[+\-*/%]?=)/,/^(?:(\&\&)|\|\|)/,/^(?:[a-zA-Z_][a-zA-Z0-9._]*)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:true}}};function T(){this.yy={};}return x.lexer=L,T.prototype=x,x.Parser=T,new T}();const n={ASSIGNMENT_EXPRESSION:[{type:"NODE",key:"right"}],SCRIPT:[{type:"ARRAY",key:"body"}],EXPRESSION_BLOCK:[{type:"ARRAY",key:"body"}],UNARY_EXPRESSION:[{type:"NODE",key:"value"}],NUMBER_LITERAL:[],IDENTIFIER:[],CALL_EXPRESSION:[{type:"ARRAY",key:"arguments"},{type:"NODE",key:"callee"}],BINARY_EXPRESSION:[{type:"NODE",key:"left"},{type:"NODE",key:"right"}],LOGICAL_EXPRESSION:[{type:"NODE",key:"left"},{type:"NODE",key:"right"}]};function r(t,e){const s=n[t.type];let i=t;if(null==s)throw new Error(`Unknown children definition for ${t.type}`);return s.forEach(n=>{if("NODE"===n.type){const s=t[n.key],o=r(s,e);o!==s&&(i={...i,[n.key]:o});}else if("ARRAY"===n.type){const s=t[n.key],o=s.map(t=>r(t,e)),a=s.some((t,e)=>t!==o[e]);a&&(i={...i,[n.key]:o});}}),e(i)}function s(t){return [].concat.apply([],t)}function i(t,e){return new Array(t).fill(e).join("")}class o{constructor(){this._map=new Map;}get(t,e){const n=null==t?e:`${t}::${e}`;return this._map.has(n)||this._map.set(n,this._map.size),this._map.get(n)}size(){return this._map.size}}class a extends Error{constructor(t,e,n){super(t),this.sourceContext=function(t,e,n=1){const r=Math.max(t.first_line-1-n,0),s=t.last_line+n,o=e.split("\n").slice(r,s).map((e,n)=>{const s=n+r+1;return `${s>=t.first_line&&s<=t.last_line?">":" "} ${s} | ${e}`});if(t.first_line===t.last_line){const e=i(t.first_column," "),n=i(t.last_column-t.first_column,"^"),s=t.first_line-r;o.splice(s,0,` | ${e}${n}`);}return o.join("\n")}(e,n),this.loc=e;}}class c extends a{}function l(t,e,n){return new c(t,e,n)}function h(t,e,n){return new a(t,e,n)}function u(e,n){const r=t(n,e.first_column),s=t(n,e.last_column);return {first_column:r.column,last_column:s.column,first_line:r.line,last_line:s.line}}function y(t){const[n,s]=function(t){const e=[];let n=1,r="",s=0,i=false,o=false,a=false;for(let c=0;c{if(1!==e.loc.first_line||1!=e.loc.last_line)throw h("Unexpected multiline",e.loc,t);return Object.assign(Object.assign({},e),{loc:u(e.loc,s)})})}catch(e){if(null==e.hash)throw e;throw l(`Parse Error: ${e.message.split("\n")[3]}`,u(e.hash.loc,s),t)}}const p=[0,97,115,109],f=[1,0,0,0],g=1e-5,m=1,_=2,E=3,d=5,b=6,w=7,S=10,I=0,k=t=>[2,t],O=t=>[3,t],N=t=>[4,t],v=5,R=11,$=t=>[13,...Pt(t)],A=t=>[16,...Pt(t)],x=26,L=27,T=t=>[32,...Pt(t)],P=t=>[33,...Pt(t)],C=t=>[34,...Pt(t)],M=t=>[35,...Pt(t)],F=t=>[36,...Pt(t)],X=(t,e)=>[43,...Pt(t),...Pt(e)],j=(t,e)=>[57,...Pt(t),...Pt(e)],U=t=>[65,...Ct(t)],D=t=>[66,...Ct(t)],B=t=>[68,...Lt(t)],V=71,G=72,K=73,Y=74,z=76,q=82,W=98,Z=99,J=100,H=101,Q=102,tt=106,et=107,nt=108,rt=113,st=114,it=129,ot=131,at=132,ct=153,lt=154,ht=155,ut=156,yt=159,pt=160,ft=161,gt=162,mt=163,_t=164,Et=165,dt=170,bt=176,wt=185,St=183,It=176,kt=127,Ot=126,Nt=124,vt=1,Rt=64,$t=124,At=[ct,...B(g),Z],xt=[ct,...B(g),J];function Lt(t){const e=new Uint8Array(8);return function(t,e){const n=new ArrayBuffer(8);new DataView(n).setFloat64(0,e);const r=new Uint8Array(n).reverse();t.set(r,0);}(e,t),e}const Tt=t=>[t.length].concat(t.split("").map(t=>t.charCodeAt(0)));function Pt(t){const e=[];do{let n=127&t;0!==(t>>>=7)&&(n|=128),e.push(n);}while(0!==t);return e}function Ct(t){let e=[],n=0,r=Math.ceil(Math.log2(Math.abs(t))),s=t<0,i=true;for(;i;)n=127&t,t>>=7,s&&(t|=-(1<Pt(t.length).concat(t),Ft=t=>Pt(t.length).concat(s(t));function Xt(t,e){if(0===e.length)return [];const n=Mt(Ft(e));return n.unshift(t),n}const jt=(t,e,n)=>{const r=[...Tt(e),...n];return [t,...Mt(r)]},Ut={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,rand:t=>Math.random()*t,pow:Math.pow,log:Math.log,log10:Math.log10,exp:Math.exp,sigmoid:function(t,e){const n=1+Math.exp(-t*e);return Math.abs(n)>1e-5?1/n:0}},Dt=1048576,Bt=Math.ceil(2048),Vt=B(Math.pow(2,31)),Gt=B(Math.pow(2,31));function Kt(t){return [...T(t),...Vt,Z,...N($t),...T(t),ct,v,...Gt,R,It]}const Yt={sqr:{args:[Nt],returns:[Nt],binary:[...T(0),...T(0),gt]},bor:{args:[Nt,Nt],returns:[Nt],binary:[...T(0),...xt,...T(1),...xt,st,...U(0),V,St]},band:{args:[Nt,Nt],returns:[Nt],binary:[...T(0),...xt,...T(1),...xt,rt,...U(0),V,St]},sign:{args:[Nt],returns:[Nt],binary:[...B(0),...T(0),Z,...T(0),...B(0),Z,et,St]},mod:{args:[Nt,Nt],returns:[Nt],localVariables:[Ot],binary:[...Kt(1),...C(2),...D(0),q,...N($t),...Kt(0),...T(2),it,wt,v,...B(0),R]},bitwiseOr:{args:[Nt,Nt],returns:[Nt],binary:[...T(0),bt,...T(1),bt,at,wt]},bitwiseAnd:{args:[Nt,Nt],returns:[Nt],binary:[...T(0),bt,...T(1),bt,ot,wt]},div:{args:[Nt,Nt],returns:[Nt],localVariables:[kt],binary:[...T(1),...B(0),W,...N($t),...T(0),...T(1),mt,v,...B(0),R]},_getBufferIndex:{args:[Nt],returns:[kt],localVariables:[Nt,kt],binary:[...B(g),...T(0),pt,...C(1),dt,...P(2),...U(-1),...T(2),...U(8),nt,...T(2),...U(0),G,...T(2),...U(8388607),Y,st,L]}};function zt(t,e){var n,r,i;switch(t.type){case "SCRIPT":return s(t.body.map((t,n)=>[...zt(t,e),x]));case "EXPRESSION_BLOCK":return qt(t.body,e);case "BINARY_EXPRESSION":{const n=zt(t.left,e),r=zt(t.right,e),s={"+":[pt],"-":[ft],"*":[gt],"/":e.resolveFunc("div"),"%":e.resolveFunc("mod"),"|":e.resolveFunc("bitwiseOr"),"&":e.resolveFunc("bitwiseAnd"),"^":e.resolveFunc("pow"),"==":[ft,...At,St],"!=":[ft,...xt,St],"<":[Z,St],">":[J,St],"<=":[H,St],">=":[Q,St]}[t.operator];if(null==s)throw h(`Unknown binary expression operator ${t.operator}`,t.loc,e.rawSource);return [...n,...r,...s]}case "CALL_EXPRESSION":{const r=t.callee.value,i=t.arguments,o=n=>{if(i.lengthn)throw l(`Too many arguments passed to \`${r}()\`. Expected ${n} but got ${i.length}.`,i[n].loc,e.rawSource)};switch(r){case "exec2":return o(2),qt(t.arguments,e);case "exec3":return o(3),qt(t.arguments,e);case "if":o(3);const[s,i,a]=t.arguments;return function(t,e,n,r){return [...zt(t,r),...xt,...N($t),...zt(e,r),v,...zt(n,r),R]}(s,i,a,e);case "while":return o(1),function(t,e){const n=zt(t,e),r=e.resolveLocal(kt);return [...U(0),...P(r),...O(Rt),...T(r),...U(1),tt,...C(r),...U(Dt),K,...n,...xt,rt,...$(0),R,...B(0)]}(t.arguments[0],e);case "loop":return o(2),function(t,e,n){const r=zt(e,n),s=n.resolveLocal(kt);return [...k(Rt),...zt(t,n),dt,...C(s),...U(0),z,...$(1),...O(Rt),...r,x,...T(s),...U(1),et,...C(s),...U(0),V,...$(0),R,R,...B(0)]}(t.arguments[0],t.arguments[1],e);case "megabuf":case "gmegabuf":o(1);const c=e.resolveLocal(kt);return [...zt(t.arguments[0],e),...null!==(n=e.resolveFunc("_getBufferIndex"))&&void 0!==n?n:[],...C(c),...U(-1),V,...N($t),...T(c),...X(3,Wt(r)),v,...B(0),R];case "assign":o(2);const h=t.arguments[0];if("IDENTIFIER"!=h.type)throw l("Expected the first argument of `assign()` to be an identifier.",h.loc,e.rawSource);const u=e.resolveVar(h.value);return [...zt(t.arguments[1],e),...F(u),...M(u)]}const a=s(t.arguments.map(t=>zt(t,e)));switch(r){case "abs":return o(1),[...a,ct];case "sqrt":return o(1),[...a,ct,yt];case "int":case "floor":return o(1),[...a,ut];case "min":return o(2),[...a,_t];case "max":return o(2),[...a,Et];case "above":return o(2),[...a,J,St];case "below":return o(2),[...a,Z,St];case "equal":return o(2),[...a,ft,...At,St];case "bnot":return o(1),[...a,...At,St];case "ceil":return o(1),[...a,ht]}const c=e.resolveFunc(r);if(null==c||r.startsWith("_"))throw l(`"${r}" is not defined.`,t.callee.loc,e.rawSource);if(null!=Ut[r])o(Ut[r].length);else {if(null==Yt[r])throw h(`Missing arity information for the function \`${r}()\``,t.callee.loc,e.rawSource);o(Yt[r].args.length);}return [...a,...c]}case "ASSIGNMENT_EXPRESSION":{const{left:n}=t,s=zt(t.right,e),o=function(t,e){const n={"+=":[pt],"-=":[ft],"*=":[gt],"/=":[mt],"%=":e.resolveFunc("mod"),"=":null},r=n[t.operator];if(void 0===r)throw h(`Unknown assignment operator "${t.operator}"`,t.loc,e.rawSource);return r}(t,e);if("IDENTIFIER"===n.type){const t=e.resolveVar(n.value),r=M(t),i=F(t);return null===o?[...s,...i,...r]:[...r,...s,...o,...i,...r]}if("CALL_EXPRESSION"!==n.type)throw h(`Unexpected left hand side type for assignment: ${n.type}`,t.loc,e.rawSource);const a=e.resolveLocal(kt);if(1!==n.arguments.length)throw l(`Expected 1 argument when assigning to a buffer but got ${n.arguments.length}.`,0===n.arguments.length?n.loc:n.arguments[1].loc,e.rawSource);const c=n.callee.value;if("gmegabuf"!==c&&"megabuf"!==c)throw l("The only function calls which may be assigned to are `gmegabuf()` and `megabuf()`.",n.callee.loc,e.rawSource);const u=Wt(c);if(null===o){const t=e.resolveLocal(kt),i=e.resolveLocal(Nt);return [...s,...P(i),...zt(n.arguments[0],e),...null!==(r=e.resolveFunc("_getBufferIndex"))&&void 0!==r?r:[],...C(t),...U(0),G,...N($t),...B(0),v,...T(t),...C(a),...T(i),...j(3,u),...T(i),R]}const y=e.resolveLocal(kt),p=e.resolveLocal(kt),f=e.resolveLocal(Nt),g=e.resolveLocal(Nt);return [...s,...P(f),...zt(n.arguments[0],e),...null!==(i=e.resolveFunc("_getBufferIndex"))&&void 0!==i?i:[],...C(y),...U(-1),V,...C(p),...N($t),...T(y),...X(3,u),v,...B(0),R,...T(f),...o,...C(g),...T(p),...N(Rt),...T(y),...T(g),...j(3,u),R]}case "LOGICAL_EXPRESSION":{const n=zt(t.left,e),r=zt(t.right,e),s={"&&":{comparison:At,shortCircuitValue:0},"||":{comparison:xt,shortCircuitValue:1}}[t.operator];if(null==s)throw h(`Unknown logical expression operator ${t.operator}`,t.loc,e.rawSource);const{comparison:i,shortCircuitValue:o}=s;return [...n,...i,...N($t),...B(o),v,...r,...xt,St,R]}case "UNARY_EXPRESSION":{const n=zt(t.value,e),r={"-":[lt],"+":[],"!":[...At,St]}[t.operator];if(null==r)throw h(`Unknown logical unary operator ${t.operator}`,t.loc,e.rawSource);return [...n,...r]}case "IDENTIFIER":const o=t.value;return M(e.resolveVar(o));case "NUMBER_LITERAL":return B(t.value);default:throw h(`Unknown AST node type ${t.type}`,t.loc,e.rawSource)}}function qt(t,e){return s(function(t,e){const n=[];for(let r=0;rzt(t,e)),[x]))}function Wt(t){switch(t){case "gmegabuf":return 67108864;case "megabuf":return 0}}function Zt({pools:t,functions:e,eelVersion:n=2,preParsed:r=false}){if(Object.keys(t).includes("shims"))throw new Error('You may not name a pool "shims". "shims" is reserved for injected JavaScript functions.');const s=[];Object.entries(t).forEach(([t,e])=>{e.forEach(e=>{s.push([t,e]);});});const i=new o;s.forEach(([t,e])=>{i.get(t,e);});const a=Object.entries(Ut).map(([t,e])=>({args:new Array(e.length).fill(null).map(t=>Nt),returns:[Nt],name:t})),c=[],l=[];Object.entries(e).forEach(([e,{pool:s,code:o}])=>{if(null==t[s]){const n=Object.keys(t);if(0===n.length)throw new Error(`The function "${e}" was declared as using a variable pool named "${s}" but no pools were defined.`);throw new Error(`The function "${e}" was declared as using a variable pool named "${s}" which is not among the variable pools defined. The defined variable pools are: ${function(t){if(0===t.length)throw new Error("Cannot format an empty list");if(1===t.length)return t[0];const e=t.map(t=>`"${t}"`),n=e.pop();return e.join(", ")+` and ${n}`}(n)}.`)}const h=r?o:y(o);if("string"==typeof h)throw new Error("Got passed unparsed code without setting the preParsed flag");if("SCRIPT"!==h.type)throw new Error("Invalid AST");if(0===h.body.length)return;const u=[],p={resolveVar:t=>/^reg\d\d$/.test(t)?i.get(null,t):i.get(s,t),resolveLocal:t=>(u.push(t),u.length-1),resolveFunc:t=>{const e=a.findIndex(e=>e.name===t);if(-1!==e){const r=A(e);return "rand"===t&&1===n?[...r,ut]:r}if(null==Yt[t])return null;let r=c.indexOf(t);return -1===r&&(c.push(t),r=c.length-1),A(r+a.length)},rawSource:o},f=zt(h,p);l.push({binary:f,exportName:e,args:[],returns:[],localVariables:u});});const h=c.map(t=>{const e=Yt[t];if(null==e)throw new Error(`Undefined local function "${t}"`);return e}),u=t=>[...t.args,"|",...t.returns].join("-"),g=[],k=new Map;function O(t){const e=u(t),n=k.get(e);if(null==n)throw new Error(`Failed to get a type index for key ${e}`);return n}[...a,...h,...l].forEach(t=>{const e=u(t);k.has(e)||(g.push([96,...Mt(t.args),...Mt(t.returns)]),k.set(e,g.length-1));});const N=[...s.map(([t,e])=>[...Tt(t),...Tt(e),3,Nt,vt]),...a.map((t,e)=>{const n=O(t);return [...Tt("shims"),...Tt(t.name),0,...Pt(n)]})],v=[...h,...l].map(t=>Pt(O(t))),$=[[1,...Pt(Bt),...Pt(Bt)]],x=i.size()-s.length,L=(T=()=>[Nt,vt,...B(0),R],new Array(x).fill(null).map((t,e)=>T(e)));var T;const P=[...l].map((t,e)=>{const n=e+a.length+h.length;return [...Tt(t.exportName),I,...Pt(n)]}),C=[...h,...l].map(t=>{var e;const n=(null!==(e=t.localVariables)&&void 0!==e?e:[]).map(t=>[...Pt(1),t]);return Mt([...Ft(n),...t.binary,R])}),M=[...a.map(t=>t.name),...c,...l.map(t=>t.exportName)].map((t,e)=>[...Pt(e),...Tt(t)]),F=[1,...Mt(Ft(M))];return new Uint8Array([...p,...f,...Xt(m,g),...Xt(_,N),...Xt(E,v),...Xt(d,$),...Xt(b,L),...Xt(w,P),...Xt(S,C),...jt(0,"name",F)])}async function Jt({pools:t,functions:e,eelVersion:n=2}){let r={};Object.entries(t).forEach(([t,e])=>{r[t]=new Set(Object.keys(e));});const s=Zt({pools:r,functions:e,eelVersion:n}),i=await WebAssembly.compile(s);var o=Object.assign(Object.assign({},t),{shims:Ut});return await WebAssembly.instantiate(i,o)} + + // Runtime header offsets + const ID_OFFSET = -8; +@@ -12630,7 +10304,7 @@ class Visualizer { + } + } + +- const mod = await srcExports.loadModule({ ++ const mod = await Jt({ + pools: wasmVarPools, + functions: wasmFunctions, + eelVersion: preset.version || 2, +diff --git a/dist/butterchurn.min.js b/dist/butterchurn.min.js +index 4842342a245e4ac06c83db66becd53737cf26e84..2cc9f8ea71e5956bf9e0afe80d71cd1a7f080ca2 100644 +--- a/dist/butterchurn.min.js ++++ b/dist/butterchurn.min.js +@@ -1,2 +1,2 @@ +-{const t=(t,e)=>{var i="function"==typeof e,s="function"==typeof e,r="function"==typeof e;Object.defineProperty(Math,t,{configurable:i,enumerable:r,writable:s,value:e})};t("DEG_PER_RAD",Math.PI/180),t("RAD_PER_DEG",180/Math.PI);const e=new Float32Array(1);t("scale",function(t,e,i,s,r){return 0===arguments.length||Number.isNaN(t)||Number.isNaN(e)||Number.isNaN(i)||Number.isNaN(s)||Number.isNaN(r)?NaN:t===1/0||t===-1/0?t:(t-e)*(r-s)/(i-e)+s}),t("fscale",function(t,i,s,r,a){return e[0]=Math.scale(t,i,s,r,a),e[0]}),t("clamp",function(t,e,i){return Math.min(i,Math.max(e,t))}),t("radians",function(t){return t*Math.DEG_PER_RAD}),t("degrees",function(t){return t*Math.RAD_PER_DEG})}var t=1e-5;window.sqr=function(t){return t*t},window.sqrt=function(t){return Math.sqrt(Math.abs(t))},window.log10=function(t){return Math.log(t)*Math.LOG10E},window.sign=function(t){return t>0?1:t<0?-1:0},window.rand=function(t){var e=Math.floor(t);return e<1?Math.random():Math.random()*e},window.randint=function(t){return Math.floor(rand(t))},window.bnot=function(e){return Math.abs(e)t?1/s:0},window.bor=function(e,i){return Math.abs(e)>t||Math.abs(i)>t?1:0},window.band=function(e,i){return Math.abs(e)>t&&Math.abs(i)>t?1:0},window.equal=function(e,i){return Math.abs(e-i)e?1:0},window.below=function(t,e){return tt?i:s},window.memcpy=function(t,e,i,s){let r=e,a=i,o=s;return a<0&&(o+=a,r-=a,a=0),r<0&&(o+=r,a-=r,r=0),o>0&&t.copyWithin(r,a,o),e};var e,i={},s={},r={};function a(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var o,h,A,n={};function l(){return o||(o=1,function(t){var e=function(){var t=function(t,e,i,s){for(i=i||{},s=t.length;s--;i[t[s]]=e);return i},e=[1,18],i=[1,7],s=[1,19],r=[1,20],a=[1,14],o=[1,15],h=[1,16],A=[1,33],n=[1,31],l=[1,23],c=[1,22],g=[1,24],m=[1,25],u=[1,26],f=[1,27],d=[1,28],p=[1,29],_=[1,30],E=[5,8,15,18,20,28,29,32,33,34,35,36,37,38],b=[5,15,18],x=[5,12,15,17,18,24,25,28,29,30],v=[1,57],T=[5,8,12,15,17,18,24,25,28,29,30],S=[15,18],P=[5,8,15,18,28,29,38],w=[5,8,15,18,28,29,32,33,38],I=[5,8,15,18,28,29,32,33,34,37,38],R=[5,8,15,18,28,29,32,33,34,35,36,37,38],y=[5,8,15,18],B=[5,8,15,18,20,22,28,29,32,33,34,35,36,37,38],L={trace:function(){},yy:{},symbols_:{error:2,SCRIPT:3,expression:4,EOF:5,expressionsOptionalTrailingSemi:6,separator:7,";":8,expressions:9,EXPRESSION_BLOCK:10,IDENTIFIER:11,IDENTIFIER_TOKEN:12,argument:13,arguments:14,",":15,FUNCTION_CALL:16,"(":17,")":18,LOGICAL_EXPRESSION:19,LOGICAL_OPERATOR_TOKEN:20,ASSIGNMENT:21,ASSIGNMENT_OPERATOR_TOKEN:22,number:23,DIGITS_TOKEN:24,".":25,NUMBER_LITERAL:26,UNARY_EXPRESSION:27,"-":28,"+":29,"!":30,BINARY_EXPRESSION:31,"*":32,"/":33,"%":34,"&":35,"|":36,"^":37,COMPARISON_TOKEN:38,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:";",12:"IDENTIFIER_TOKEN",15:",",17:"(",18:")",20:"LOGICAL_OPERATOR_TOKEN",22:"ASSIGNMENT_OPERATOR_TOKEN",24:"DIGITS_TOKEN",25:".",28:"-",29:"+",30:"!",32:"*",33:"/",34:"%",35:"&",36:"|",37:"^",38:"COMPARISON_TOKEN"},productions_:[0,[3,2],[3,2],[3,1],[7,1],[7,2],[9,2],[9,3],[6,1],[6,2],[10,1],[11,1],[13,1],[13,1],[14,1],[14,3],[16,3],[16,4],[19,3],[21,3],[21,3],[23,1],[23,2],[23,3],[23,2],[23,1],[26,1],[27,2],[27,2],[27,2],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[4,1],[4,1],[4,3],[4,1],[4,1],[4,1],[4,1],[4,1],[4,3]],performAction:function(t,e,i,s,r,a,o){var h=a.length-1;switch(r){case 1:return{type:"SCRIPT",body:[a[h-1]],loc:this._$};case 2:return{type:"SCRIPT",body:a[h-1],loc:this._$};case 3:return{type:"SCRIPT",body:[],loc:this._$};case 6:this.$=[a[h-1]];break;case 7:this.$=a[h-2].concat([a[h-1]]);break;case 8:this.$=a[h];break;case 9:this.$=a[h-1].concat([a[h]]);break;case 10:this.$={type:"EXPRESSION_BLOCK",body:a[h],loc:this._$};break;case 11:this.$={type:"IDENTIFIER",value:a[h].toLowerCase(),loc:this._$};break;case 14:this.$=[a[h]];break;case 15:this.$=a[h-2].concat([a[h]]);break;case 16:this.$={type:"CALL_EXPRESSION",callee:a[h-2],arguments:[],loc:this._$};break;case 17:this.$={type:"CALL_EXPRESSION",callee:a[h-3],arguments:a[h-1],loc:this._$};break;case 18:this.$={type:"LOGICAL_EXPRESSION",left:a[h-2],right:a[h],operator:a[h-1],loc:this._$};break;case 19:case 20:this.$={type:"ASSIGNMENT_EXPRESSION",left:a[h-2],operator:a[h-1],right:a[h],loc:this._$};break;case 21:this.$=Number(a[h]);break;case 22:this.$=Number(a[h-1]);break;case 23:this.$=Number(a[h-2]+a[h-1]+a[h]);break;case 24:this.$=Number("0"+a[h-1]+a[h]);break;case 25:this.$=0;break;case 26:this.$={type:"NUMBER_LITERAL",value:a[h],loc:this._$};break;case 27:case 28:case 29:this.$={type:"UNARY_EXPRESSION",value:a[h],operator:a[h-1],loc:this._$};break;case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:this.$={type:"BINARY_EXPRESSION",left:a[h-2],right:a[h],operator:a[h-1],loc:this._$};break;case 41:case 47:this.$=a[h-1]}},table:[{3:1,4:2,5:[1,4],6:3,9:13,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{1:[3]},{5:[1,21],7:32,8:A,20:n,28:l,29:c,32:g,33:m,34:u,35:f,36:d,37:p,38:_},{5:[1,34]},{1:[2,3]},t(E,[2,39]),t(E,[2,40]),{4:35,6:37,9:13,10:36,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(E,[2,42]),t(E,[2,43]),t(E,[2,44],{22:[1,38]}),t(E,[2,45],{17:[1,40],22:[1,39]}),t(E,[2,46]),t(b,[2,8],{31:5,27:6,26:8,21:9,16:10,11:11,19:12,23:17,4:41,12:e,17:i,24:s,25:r,28:a,29:o,30:h}),{4:42,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:43,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:44,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(E,[2,26]),t([5,8,15,17,18,20,22,28,29,32,33,34,35,36,37,38],[2,11]),t(E,[2,21],{25:[1,45]}),t(E,[2,25],{24:[1,46]}),{1:[2,1]},{4:47,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:48,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:49,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:50,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:51,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:52,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:53,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:54,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:55,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:56,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(x,[2,6],{8:v}),t(T,[2,4]),{1:[2,2]},{7:32,8:A,18:[1,58],20:n,28:l,29:c,32:g,33:m,34:u,35:f,36:d,37:p,38:_},{18:[1,59]},t(S,[2,10]),{4:60,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:61,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:65,6:37,9:13,10:66,11:11,12:e,13:64,14:63,16:10,17:i,18:[1,62],19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(b,[2,9],{7:67,8:A,20:n,28:l,29:c,32:g,33:m,34:u,35:f,36:d,37:p,38:_}),t(P,[2,27],{20:n,32:g,33:m,34:u,35:f,36:d,37:p}),t(P,[2,28],{20:n,32:g,33:m,34:u,35:f,36:d,37:p}),t(P,[2,29],{20:n,32:g,33:m,34:u,35:f,36:d,37:p}),t(E,[2,22],{24:[1,68]}),t(E,[2,24]),t(P,[2,30],{20:n,32:g,33:m,34:u,35:f,36:d,37:p}),t(P,[2,31],{20:n,32:g,33:m,34:u,35:f,36:d,37:p}),t(w,[2,32],{20:n,34:u,35:f,36:d,37:p}),t(w,[2,33],{20:n,34:u,35:f,36:d,37:p}),t(I,[2,34],{20:n,35:f,36:d}),t(R,[2,35],{20:n}),t(R,[2,36],{20:n}),t(I,[2,37],{20:n,35:f,36:d}),t(y,[2,38],{20:n,28:l,29:c,32:g,33:m,34:u,35:f,36:d,37:p,38:_}),t(E,[2,18]),t(T,[2,5]),t(E,[2,41]),t(E,[2,47]),t(y,[2,20],{20:n,28:l,29:c,32:g,33:m,34:u,35:f,36:d,37:p,38:_}),t(y,[2,19],{20:n,28:l,29:c,32:g,33:m,34:u,35:f,36:d,37:p,38:_}),t(B,[2,16]),{15:[1,70],18:[1,69]},t(S,[2,14]),t(S,[2,12],{7:32,8:A,20:n,28:l,29:c,32:g,33:m,34:u,35:f,36:d,37:p,38:_}),t(S,[2,13]),t(x,[2,7],{8:v}),t(E,[2,23]),t(B,[2,17]),{4:65,6:37,9:13,10:66,11:11,12:e,13:71,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(S,[2,15])],defaultActions:{4:[2,3],21:[2,1],34:[2,2]},parseError:function(t,e){if(!e.recoverable){var i=new Error(t);throw i.hash=e,i}this.trace(t)},parse:function(t){var e=this,i=[0],s=[null],r=[],a=this.table,o="",h=0,A=0,n=r.slice.call(arguments,1),l=Object.create(this.lexer),c={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(c.yy[g]=this.yy[g]);l.setInput(t,c.yy),c.yy.lexer=l,c.yy.parser=this,void 0===l.yylloc&&(l.yylloc={});var m=l.yylloc;r.push(m);var u=l.options&&l.options.ranges;"function"==typeof c.yy.parseError?this.parseError=c.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var f,d,p,_,E,b,x,v,T=function(){var t;return"number"!=typeof(t=l.lex()||1)&&(t=e.symbols_[t]||t),t},S={};;){if(d=i[i.length-1],this.defaultActions[d]?p=this.defaultActions[d]:(null==f&&(f=T()),p=a[d]&&a[d][f]),void 0===p||!p.length||!p[0]){var P="";for(E in v=[],a[d])this.terminals_[E]&&E>2&&v.push("'"+this.terminals_[E]+"'");P=l.showPosition?"Parse error on line "+(h+1)+":\n"+l.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(h+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(P,{text:l.match,token:this.terminals_[f]||f,line:l.yylineno,loc:m,expected:v})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+f);switch(p[0]){case 1:i.push(f),s.push(l.yytext),r.push(l.yylloc),i.push(p[1]),f=null,A=l.yyleng,o=l.yytext,h=l.yylineno,m=l.yylloc;break;case 2:if(b=this.productions_[p[1]][1],S.$=s[s.length-b],S._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},u&&(S._$.range=[r[r.length-(b||1)].range[0],r[r.length-1].range[1]]),void 0!==(_=this.performAction.apply(S,[o,A,h,c.yy,p[1],s,r].concat(n))))return _;b&&(i=i.slice(0,-1*b*2),s=s.slice(0,-1*b),r=r.slice(0,-1*b)),i.push(this.productions_[p[1]][0]),s.push(S.$),r.push(S._$),x=a[i[i.length-2]][i[i.length-1]],i.push(x);break;case 3:return!0}}return!0}},C={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var i,s,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var a in r)this[a]=r[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,i,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),a=0;ae[0].length)){if(e=i,s=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,r[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,i,s){switch(i){case 0:break;case 1:return 24;case 2:return 38;case 3:return 22;case 4:return 20;case 5:return 12;case 6:return 5;case 7:return e.yytext[0]}},rules:[/^(?:\s+)/,/^(?:[0-9]+)/,/^(?:(==|!=|<=|>=|<|>))/,/^(?:[+\-*/%]?=)/,/^(?:(\&\&)|\|\|)/,/^(?:[a-zA-Z_][a-zA-Z0-9._]*)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};function U(){this.yy={}}return L.lexer=C,U.prototype=L,L.Parser=U,new U}();void 0!==a&&(t.parser=e,t.Parser=e.Parser,t.parse=function(){return e.parse.apply(e,arguments)},t.main=()=>{})}(n)),n}var c,g={};var m,u,f,d={},p={};function _(){if(m)return p;m=1,Object.defineProperty(p,"__esModule",{value:!0}),p.arrayJoin=function(t,e){const i=[];for(let s=0;se(i))},p.repeat=function(t,e){return new Array(t).fill(e).join("")};return p.ScopedIdMap=class{constructor(){this._map=new Map}get(t,e){const i=null==t?e:`${t}::${e}`;return this._map.has(i)||this._map.set(i,this._map.size),this._map.get(i)}size(){return this._map.size}},p.formatList=function(t){if(0===t.length)throw new Error("Cannot format an empty list");if(1===t.length)return t[0];const e=t.map(t=>`"${t}"`),i=e.pop();return e.join(", ")+` and ${i}`},p}function E(){if(u)return d;u=1,Object.defineProperty(d,"__esModule",{value:!0});const t=_();function e(e,i,s=1){const r=Math.max(e.first_line-1-s,0),a=e.last_line+s,o=i.split("\n").slice(r,a).map((t,i)=>{const s=i+r+1;return`${s>=e.first_line&&s<=e.last_line?">":" "} ${s} | ${t}`});if(e.first_line===e.last_line){const i=t.repeat(e.first_column," "),s=t.repeat(e.last_column-e.first_column,"^"),a=e.first_line-r;o.splice(a,0,` | ${i}${s}`)}return o.join("\n")}d.printLoc=e;class i extends Error{constructor(t,i,s){super(t),this.sourceContext=e(i,s),this.loc=i}}class s extends i{}return d.createUserError=function(t,e,i){return new s(t,e,i)},d.createCompilerError=function(t,e,s){return new i(t,e,s)},d}function b(){if(f)return s;f=1,Object.defineProperty(s,"__esModule",{value:!0});const t=(e||(e=1,Object.defineProperty(r,"__esModule",{value:!0}),r.getLoc=function(t,e){let i={destCol:1,srcCol:1,srcLine:1};t.forEach(t=>{t.destCol>e||(i=t)});const s=e-i.destCol;return{column:i.srcCol+s,line:i.srcLine}},r.preProcess=function(t){const e=[];let i=1,s="",r=0,a=!1,o=!1,h=!1;for(let A=0;A{if("NODE"===t.type){const r=i[t.key],o=e(r,s);o!==r&&(a=Object.assign(Object.assign({},a),{[t.key]:o}))}else if("ARRAY"===t.type){const r=i[t.key],o=r.map(t=>e(t,s)),h=r.some((t,e)=>t!==o[e]);h&&(a=Object.assign(Object.assign({},a),{[t.key]:o}))}}),s(a)},g}(),o=E();function n(e,i){const s=t.getLoc(i,e.first_column),r=t.getLoc(i,e.last_column);return{first_column:s.column,last_column:r.column,first_line:s.line,last_line:r.line}}return s.parse=function(e){const[s,r]=t.preProcess(e);try{const t=i.parse(s);return a.mapAst(t,t=>{if(1!==t.loc.first_line||1!=t.loc.last_line)throw o.createCompilerError("Unexpected multiline",t.loc,e);return Object.assign(Object.assign({},t),{loc:n(t.loc,r)})})}catch(t){if(null==t.hash)throw t;throw o.createUserError(`Parse Error: ${t.message.split("\n")[3]}`,n(t.hash.loc,r),e)}},s}var x,v,T={},S={},P={},w={};function I(){if(x)return w;return x=1,Object.defineProperty(w,"__esModule",{value:!0}),w.write=function(t,e){let i=52;var s,r,a,o=64-i-1,h=(1<>1,n=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=0,c=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(r=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+A>=1?n/a:n*Math.pow(2,1-A))*a>=2&&(s++,a/=2),s+A>=h?(r=0,s=h):s+A>=1?(r=(e*a-1)*Math.pow(2,i),s+=A):(r=e*Math.pow(2,A-1)*Math.pow(2,i),s=0));i>=8;t[0+l]=255&r,l+=1,r/=256,i-=8);for(s=s<0;t[0+l]=255&s,l+=1,s/=256,o-=8);t[0+l-1]|=128*c},w}function R(){return v||(v=1,function(t){var e=P&&P.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e};Object.defineProperty(t,"__esModule",{value:!0});const i=e(I()),s=_();function r(t){const e=new Uint8Array(8);return i.write(e,t),e}function a(t){const e=[];do{let i=127&t;0!==(t>>>=7)&&(i|=128),e.push(i)}while(0!==t);return e}function o(t){let e=[],i=0,s=Math.ceil(Math.log2(Math.abs(t))),r=t<0,a=!0;for(;a;)i=127&t,t>>=7,r&&(t|=-(1<[2,t],loop:t=>[3,t],if:t=>[4,t],else:5,end:11,br_if:t=>[13,...a(t)],call:t=>[16,...a(t)],drop:26,select:27,local_get:t=>[32,...a(t)],local_set:t=>[33,...a(t)],local_tee:t=>[34,...a(t)],global_get:t=>[35,...a(t)],global_set:t=>[36,...a(t)],f64_load:(t,e)=>[43,...a(t),...a(e)],f64_store:(t,e)=>[57,...a(t),...a(e)],i32_const:t=>[65,...o(t)],f64_const:t=>[68,...r(t)],i32_eqz:69,i32_ne:71,i32_lt_s:72,i32_lt_u:73,i32_gt_s:74,i32_le_s:76,i32_le_u:77,i32_ge_s:78,f64_eq:97,f64_ne:98,f64_lt:99,f64_gt:100,f64_le:101,f64_ge:102,i32_add:106,i32_sub:107,i32_mul:108,i32_rem_s:111,i32_and:113,i32_or:114,i64_rem_s:129,i64_and:131,i64_or:132,f64_abs:153,f64_neg:154,f64_ceil:155,f64_floor:156,f64_sqrt:159,f64_add:160,f64_sub:161,f64_mul:162,f64_div:163,f64_min:164,f64_max:165,i32_trunc_f64_s:170,i32_trunc_f64_u:171,i64_trunc_s_f64:176,f64_convert_i64_s:185,f64_convert_i32_s:183},t.VAL_TYPE={i32:127,i64:126,f32:125,f64:124},t.MUTABILITY={const:0,var:1},t.BLOCK={void:64,i32:127,i64:126,f32:125,f64:124},t.FUNCTION_TYPE=96,t.MEMORY_IDX=2,t.GLOBAL_TYPE=3,t.TYPE_IDX=0,t.IS_ZEROISH=[t.op.f64_abs,...t.op.f64_const(t.EPSILON),t.op.f64_lt],t.IS_NOT_ZEROISH=[t.op.f64_abs,...t.op.f64_const(t.EPSILON),t.op.f64_gt],t.encodef64=r,t.encodeString=t=>[t.length].concat(t.split("").map(t=>t.charCodeAt(0))),t.unsignedLEB128=a,t.signedLEB128=o,t.encodeFlatVector=t=>a(t.length).concat(t),t.encodeNestedVector=t=>a(t.length).concat(s.flatten(t)),t.encodeSection=function(e,i){if(0===i.length)return[];const s=t.encodeFlatVector(t.encodeNestedVector(i));return s.unshift(e),s}}(P)),P}var y,B={};function L(){if(y)return B;y=1,Object.defineProperty(B,"__esModule",{value:!0});const t={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,rand:t=>Math.random()*t,pow:Math.pow,log:Math.log,log10:Math.log10,exp:Math.exp,sigmoid:function(t,e){const i=1+Math.exp(-t*e);return Math.abs(i)>1e-5?1/i:0}};return B.default=t,B}var C,U,M,F,Q={},V={};function D(){return C||(C=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});t.MAX_LOOP_COUNT=1048576,t.BUFFER_SIZE=8388608,t.WASM_MEMORY_SIZE=Math.ceil(8*t.BUFFER_SIZE*2/65536)}(V)),V}function q(){if(U)return Q;U=1,Object.defineProperty(Q,"__esModule",{value:!0});const t=R(),e=D();return Q.localFuncMap={sqr:{args:[t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],binary:[...t.op.local_get(0),...t.op.local_get(0),t.op.f64_mul]},bor:{args:[t.VAL_TYPE.f64,t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],binary:[...t.op.local_get(0),...t.IS_NOT_ZEROISH,...t.op.local_get(1),...t.IS_NOT_ZEROISH,t.op.i32_or,...t.op.i32_const(0),t.op.i32_ne,t.op.f64_convert_i32_s]},band:{args:[t.VAL_TYPE.f64,t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],binary:[...t.op.local_get(0),...t.IS_NOT_ZEROISH,...t.op.local_get(1),...t.IS_NOT_ZEROISH,t.op.i32_and,...t.op.i32_const(0),t.op.i32_ne,t.op.f64_convert_i32_s]},sign:{args:[t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],binary:[...t.op.f64_const(0),...t.op.local_get(0),t.op.f64_lt,...t.op.local_get(0),...t.op.f64_const(0),t.op.f64_lt,t.op.i32_sub,t.op.f64_convert_i32_s]},mod:{args:[t.VAL_TYPE.f64,t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],localVariables:[t.VAL_TYPE.i32],binary:[...t.op.local_get(1),t.op.i32_trunc_f64_s,...t.op.local_tee(2),...t.op.i32_const(0),t.op.i32_ne,...t.op.if(t.BLOCK.f64),...t.op.local_get(0),t.op.i32_trunc_f64_s,...t.op.local_get(2),t.op.i32_rem_s,t.op.f64_convert_i32_s,t.op.else,...t.op.f64_const(0),t.op.end]},bitwiseOr:{args:[t.VAL_TYPE.f64,t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],binary:[...t.op.local_get(0),t.op.i64_trunc_s_f64,...t.op.local_get(1),t.op.i64_trunc_s_f64,t.op.i64_or,t.op.f64_convert_i64_s]},bitwiseAnd:{args:[t.VAL_TYPE.f64,t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],binary:[...t.op.local_get(0),t.op.i64_trunc_s_f64,...t.op.local_get(1),t.op.i64_trunc_s_f64,t.op.i64_and,t.op.f64_convert_i64_s]},div:{args:[t.VAL_TYPE.f64,t.VAL_TYPE.f64],returns:[t.VAL_TYPE.f64],localVariables:[t.VAL_TYPE.i32],binary:[...t.op.local_get(1),...t.op.f64_const(0),t.op.f64_ne,...t.op.if(t.BLOCK.f64),...t.op.local_get(0),...t.op.local_get(1),t.op.f64_div,t.op.else,...t.op.f64_const(0),t.op.end]},_getBufferIndex:{args:[t.VAL_TYPE.f64],returns:[t.VAL_TYPE.i32],localVariables:[t.VAL_TYPE.f64,t.VAL_TYPE.i32],binary:[...t.op.f64_const(t.EPSILON),...t.op.local_get(0),t.op.f64_add,...t.op.local_tee(1),t.op.i32_trunc_f64_s,...t.op.local_set(2),...t.op.i32_const(-1),...t.op.local_get(2),...t.op.i32_const(8),t.op.i32_mul,...t.op.local_get(2),...t.op.i32_const(0),t.op.i32_lt_s,...t.op.local_get(2),...t.op.i32_const(e.BUFFER_SIZE-1),t.op.i32_gt_s,t.op.i32_or,t.op.select]}},Q}function z(){if(M)return S;M=1;var t=S&&S.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(S,"__esModule",{value:!0});const e=R(),i=t(L()),s=E(),r=q(),a=_(),o=D();function h(t,l){var c,g,m;switch(t.type){case"SCRIPT":{const i=t.body.map((t,i)=>[...h(t,l),e.op.drop]);return a.flatten(i)}case"EXPRESSION_BLOCK":return A(t.body,l);case"BINARY_EXPRESSION":{const i=h(t.left,l),r=h(t.right,l),a={"+":[e.op.f64_add],"-":[e.op.f64_sub],"*":[e.op.f64_mul],"/":l.resolveFunc("div"),"%":l.resolveFunc("mod"),"|":l.resolveFunc("bitwiseOr"),"&":l.resolveFunc("bitwiseAnd"),"^":l.resolveFunc("pow"),"==":[e.op.f64_sub,...e.IS_ZEROISH,e.op.f64_convert_i32_s],"!=":[e.op.f64_sub,...e.IS_NOT_ZEROISH,e.op.f64_convert_i32_s],"<":[e.op.f64_lt,e.op.f64_convert_i32_s],">":[e.op.f64_gt,e.op.f64_convert_i32_s],"<=":[e.op.f64_le,e.op.f64_convert_i32_s],">=":[e.op.f64_ge,e.op.f64_convert_i32_s]}[t.operator];if(null==a)throw s.createCompilerError(`Unknown binary expression operator ${t.operator}`,t.loc,l.rawSource);return[...i,...r,...a]}case"CALL_EXPRESSION":{const g=t.callee.value,m=t.arguments,u=e=>{if(m.lengthe)throw s.createUserError(`Too many arguments passed to \`${g}()\`. Expected ${e} but got ${m.length}.`,m[e].loc,l.rawSource)};switch(g){case"exec2":return u(2),A(t.arguments,l);case"exec3":return u(3),A(t.arguments,l);case"if":u(3);const[i,r,a]=t.arguments;return function(t,i,s,r){return[...h(t,r),...e.IS_NOT_ZEROISH,...e.op.if(e.BLOCK.f64),...h(i,r),e.op.else,...h(s,r),e.op.end]}(i,r,a,l);case"while":return u(1),function(t,i){const s=h(t,i),r=i.resolveLocal(e.VAL_TYPE.i32);return[...e.op.i32_const(0),...e.op.local_set(r),...e.op.loop(e.BLOCK.void),...e.op.local_get(r),...e.op.i32_const(1),e.op.i32_add,...e.op.local_tee(r),...e.op.i32_const(o.MAX_LOOP_COUNT),e.op.i32_lt_u,...s,...e.IS_NOT_ZEROISH,e.op.i32_and,...e.op.br_if(0),e.op.end,...e.op.f64_const(0)]}(t.arguments[0],l);case"loop":return u(2),function(t,i,s){const r=h(i,s),a=s.resolveLocal(e.VAL_TYPE.i32);return[...e.op.block(e.BLOCK.void),...h(t,s),e.op.i32_trunc_f64_s,...e.op.local_tee(a),...e.op.i32_const(0),e.op.i32_le_s,...e.op.br_if(1),...e.op.loop(e.BLOCK.void),...r,e.op.drop,...e.op.local_get(a),...e.op.i32_const(1),e.op.i32_sub,...e.op.local_tee(a),...e.op.i32_const(0),e.op.i32_ne,...e.op.br_if(0),e.op.end,e.op.end,...e.op.f64_const(0)]}(t.arguments[0],t.arguments[1],l);case"megabuf":case"gmegabuf":u(1);const m=l.resolveLocal(e.VAL_TYPE.i32);return[...h(t.arguments[0],l),...null!==(c=l.resolveFunc("_getBufferIndex"))&&void 0!==c?c:[],...e.op.local_tee(m),...e.op.i32_const(-1),e.op.i32_ne,...e.op.if(e.BLOCK.f64),...e.op.local_get(m),...e.op.f64_load(3,n(g)),e.op.else,...e.op.f64_const(0),e.op.end];case"assign":u(2);const f=t.arguments[0];if("IDENTIFIER"!=f.type)throw s.createUserError("Expected the first argument of `assign()` to be an identifier.",f.loc,l.rawSource);const d=l.resolveVar(f.value);return[...h(t.arguments[1],l),...e.op.global_set(d),...e.op.global_get(d)]}const f=a.flatten(t.arguments.map(t=>h(t,l)));switch(g){case"abs":return u(1),[...f,e.op.f64_abs];case"sqrt":return u(1),[...f,e.op.f64_abs,e.op.f64_sqrt];case"int":case"floor":return u(1),[...f,e.op.f64_floor];case"min":return u(2),[...f,e.op.f64_min];case"max":return u(2),[...f,e.op.f64_max];case"above":return u(2),[...f,e.op.f64_gt,e.op.f64_convert_i32_s];case"below":return u(2),[...f,e.op.f64_lt,e.op.f64_convert_i32_s];case"equal":return u(2),[...f,e.op.f64_sub,...e.IS_ZEROISH,e.op.f64_convert_i32_s];case"bnot":return u(1),[...f,...e.IS_ZEROISH,e.op.f64_convert_i32_s];case"ceil":return u(1),[...f,e.op.f64_ceil]}const d=l.resolveFunc(g);if(null==d||g.startsWith("_"))throw s.createUserError(`"${g}" is not defined.`,t.callee.loc,l.rawSource);if(null!=i.default[g])u(i.default[g].length);else{if(null==r.localFuncMap[g])throw s.createCompilerError(`Missing arity information for the function \`${g}()\``,t.callee.loc,l.rawSource);u(r.localFuncMap[g].args.length)}return[...f,...d]}case"ASSIGNMENT_EXPRESSION":{const{left:i}=t,r=h(t.right,l),a=function(t,i){const r={"+=":[e.op.f64_add],"-=":[e.op.f64_sub],"*=":[e.op.f64_mul],"/=":[e.op.f64_div],"%=":i.resolveFunc("mod"),"=":null},a=r[t.operator];if(void 0===a)throw s.createCompilerError(`Unknown assignment operator "${t.operator}"`,t.loc,i.rawSource);return a}(t,l);if("IDENTIFIER"===i.type){const t=l.resolveVar(i.value),s=e.op.global_get(t),o=e.op.global_set(t);return null===a?[...r,...o,...s]:[...s,...r,...a,...o,...s]}if("CALL_EXPRESSION"!==i.type)throw s.createCompilerError(`Unexpected left hand side type for assignment: ${i.type}`,t.loc,l.rawSource);const o=l.resolveLocal(e.VAL_TYPE.i32);if(1!==i.arguments.length)throw s.createUserError(`Expected 1 argument when assinging to a buffer but got ${i.arguments.length}.`,0===i.arguments.length?i.loc:i.arguments[1].loc,l.rawSource);const A=i.callee.value;if("gmegabuf"!==A&&"megabuf"!==A)throw s.createUserError("The only function calls which may be assigned to are `gmegabuf()` and `megabuf()`.",i.callee.loc,l.rawSource);const c=n(A);if(null===a){const t=l.resolveLocal(e.VAL_TYPE.i32),s=l.resolveLocal(e.VAL_TYPE.f64);return[...r,...e.op.local_set(s),...h(i.arguments[0],l),...null!==(g=l.resolveFunc("_getBufferIndex"))&&void 0!==g?g:[],...e.op.local_tee(t),...e.op.i32_const(0),e.op.i32_lt_s,...e.op.if(e.BLOCK.f64),...e.op.f64_const(0),e.op.else,...e.op.local_get(t),...e.op.local_tee(o),...e.op.local_get(s),...e.op.f64_store(3,c),...e.op.local_get(s),e.op.end]}const u=l.resolveLocal(e.VAL_TYPE.i32),f=l.resolveLocal(e.VAL_TYPE.i32),d=l.resolveLocal(e.VAL_TYPE.f64),p=l.resolveLocal(e.VAL_TYPE.f64);return[...r,...e.op.local_set(d),...h(i.arguments[0],l),...null!==(m=l.resolveFunc("_getBufferIndex"))&&void 0!==m?m:[],...e.op.local_tee(u),...e.op.i32_const(-1),e.op.i32_ne,...e.op.local_tee(f),...e.op.if(e.BLOCK.f64),...e.op.local_get(u),...e.op.f64_load(3,c),e.op.else,...e.op.f64_const(0),e.op.end,...e.op.local_get(d),...a,...e.op.local_tee(p),...e.op.local_get(f),...e.op.if(e.BLOCK.void),...e.op.local_get(u),...e.op.local_get(p),...e.op.f64_store(3,c),e.op.end]}case"LOGICAL_EXPRESSION":{const i=h(t.left,l),r=h(t.right,l),a={"&&":{comparison:e.IS_ZEROISH,shortCircutValue:0},"||":{comparison:e.IS_NOT_ZEROISH,shortCircutValue:1}}[t.operator];if(null==a)throw s.createCompilerError(`Unknown logical expression operator ${t.operator}`,t.loc,l.rawSource);const{comparison:o,shortCircutValue:A}=a;return[...i,...o,...e.op.if(e.BLOCK.f64),...e.op.f64_const(A),e.op.else,...r,...e.IS_NOT_ZEROISH,e.op.f64_convert_i32_s,e.op.end]}case"UNARY_EXPRESSION":{const i=h(t.value,l),r={"-":[e.op.f64_neg],"+":[],"!":[...e.IS_ZEROISH,e.op.f64_convert_i32_s]}[t.operator];if(null==r)throw s.createCompilerError(`Unknown logical unary operator ${t.operator}`,t.loc,l.rawSource);return[...i,...r]}case"IDENTIFIER":const u=t.value;return e.op.global_get(l.resolveVar(u));case"NUMBER_LITERAL":return e.op.f64_const(t.value);default:throw s.createCompilerError(`Unknown AST node type ${t.type}`,t.loc,l.rawSource)}}function A(t,i){const s=t.map((t,e)=>h(t,i));return a.flatten(a.arrayJoin(s,[e.op.drop]))}function n(t){switch(t){case"gmegabuf":return 8*o.BUFFER_SIZE;case"megabuf":return 0}}return S.emit=h,S}function N(){if(F)return T;F=1;var t=T&&T.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},e=T&&T.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e};Object.defineProperty(T,"__esModule",{value:!0});const i=b(),s=z(),r=R(),a=t(L()),o=e(_()),h=q(),A=D();return T.compileModule=function({pools:t,functions:e,eelVersion:n=2,preParsed:l=!1}){if(Object.keys(t).includes("shims"))throw new Error('You may not name a pool "shims". "shims" is reserved for injected JavaScript functions.');const c=[];Object.entries(t).forEach(([t,e])=>{e.forEach(e=>{c.push([t,e])})});const g=new o.ScopedIdMap;c.forEach(([t,e])=>{g.get(t,e)});const m=Object.entries(a.default).map(([t,e])=>({args:new Array(e.length).fill(null).map(t=>r.VAL_TYPE.f64),returns:[r.VAL_TYPE.f64],name:t})),u=[],f=[];Object.entries(e).forEach(([e,{pool:a,code:A}])=>{if(null==t[a]){const i=Object.keys(t);if(0===i.length)throw new Error(`The function "${e}" was declared as using a variable pool named "${a}" but no pools were defined.`);throw new Error(`The function "${e}" was declared as using a variable pool named "${a}" which is not among the variable pools defined. The defined variable pools are: ${o.formatList(i)}.`)}const c=l?A:i.parse(A);if("string"==typeof c)throw new Error("Got passed unparsed code without setting the preParsed flag");if("SCRIPT"!==c.type)throw new Error("Invalid AST");if(0===c.body.length)return;const d=[],p={resolveVar:t=>/^reg\d\d$/.test(t)?g.get(null,t):g.get(a,t),resolveLocal:t=>(d.push(t),d.length-1),resolveFunc:t=>{const e=m.findIndex(e=>e.name===t);if(-1!==e){const i=r.op.call(e);return"rand"===t&&1===n?[...i,r.op.f64_floor]:i}if(null==h.localFuncMap[t])return null;let i=u.indexOf(t);return-1===i&&(u.push(t),i=u.length-1),r.op.call(i+m.length)},rawSource:A},_=s.emit(c,p);f.push({binary:_,exportName:e,args:[],returns:[],localVariables:d})});const d=u.map(t=>{const e=h.localFuncMap[t];if(null==e)throw new Error(`Undefined local function "${t}"`);return e}),p=t=>[...t.args,"|",...t.returns].join("-"),_=[],E=new Map;function b(t){const e=p(t),i=E.get(e);if(null==i)throw new Error(`Failed to get a type index for key ${e}`);return i}[...m,...d,...f].forEach(t=>{const e=p(t);E.has(e)||(_.push([r.FUNCTION_TYPE,...r.encodeFlatVector(t.args),...r.encodeFlatVector(t.returns)]),E.set(e,_.length-1))});const x=[...c.map(([t,e])=>[...r.encodeString(t),...r.encodeString(e),r.GLOBAL_TYPE,r.VAL_TYPE.f64,r.MUTABILITY.var]),...m.map((t,e)=>{const i=b(t);return[...r.encodeString("shims"),...r.encodeString(t.name),r.TYPE_IDX,...r.unsignedLEB128(i)]})],v=[...d,...f].map(t=>{const e=b(t);return r.unsignedLEB128(e)}),T=[[1,...r.unsignedLEB128(A.WASM_MEMORY_SIZE),...r.unsignedLEB128(A.WASM_MEMORY_SIZE)]],S=g.size()-c.length,P=o.times(S,()=>[r.VAL_TYPE.f64,r.MUTABILITY.var,...r.op.f64_const(0),r.op.end]),w=[...f].map((t,e)=>{const i=e+m.length+d.length;return[...r.encodeString(t.exportName),r.EXPORT_TYPE.FUNC,...r.unsignedLEB128(i)]}),I=[...d,...f].map(t=>{var e;const i=(null!==(e=t.localVariables)&&void 0!==e?e:[]).map(t=>[...r.unsignedLEB128(1),t]);return r.encodeFlatVector([...r.encodeNestedVector(i),...t.binary,r.op.end])});return new Uint8Array([...r.MAGIC,...r.WASM_VERSION,...r.encodeSection(r.SECTION.TYPE,_),...r.encodeSection(r.SECTION.IMPORT,x),...r.encodeSection(r.SECTION.FUNC,v),...r.encodeSection(r.SECTION.MEMORY,T),...r.encodeSection(r.SECTION.GLOBAL,P),...r.encodeSection(r.SECTION.EXPORT,w),...r.encodeSection(r.SECTION.CODE,I)])},T}var X,O,k={};var G=function(){if(O)return i;O=1;var t=i&&i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(i,"__esModule",{value:!0});const e=b();i.parse=e.parse;const s=N();i.compileModule=s.compileModule;const r=t(L());i.shims=r.default;const a=function(){if(X)return k;X=1;var t=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(k,"__esModule",{value:!0});const e=t(L()),i=N();return k.loadModule=async function({pools:t,functions:s,eelVersion:r=2}){let a={};Object.entries(t).forEach(([t,e])=>{a[t]=new Set(Object.keys(e))});const o=i.compileModule({pools:a,functions:s,eelVersion:r}),h=await WebAssembly.compile(o);var A=Object.assign(Object.assign({},t),{shims:e.default});return await WebAssembly.instantiate(h,A)},k}();return i.loadModule=a.loadModule,i}();const Y="undefined"!=typeof BigUint64Array,W=Symbol(),J=new TextDecoder("utf-16le");function K(t,e){const i=new Uint32Array(t)[e+-4>>>2]>>>1,s=new Uint16Array(t,e,i);return i<=32?String.fromCharCode.apply(String,s):J.decode(s)}function j(t){const e={};function i(t,e){return t?K(t.buffer,e):""}const s=t.env=t.env||{};return s.abort=s.abort||function(t,r,a,o){const h=e.memory||s.memory;throw Error(`abort: ${i(h,t)} at ${i(h,r)}:${a}:${o}`)},s.trace=s.trace||function(t,r,...a){const o=e.memory||s.memory;console.log(`trace: ${i(o,t)}${r?" ":""}${a.slice(0,r).join(", ")}`)},s.seed=s.seed||Date.now,t.Math=t.Math||Math,t.Date=t.Date||Date,e}function H(t,e){const i=e.exports,s=i.memory,r=i.table,a=i.__new,o=i.__retain,h=i.__rtti_base||-1;function A(t){const e=function(t){const e=new Uint32Array(s.buffer);if((t>>>=0)>=e[h>>>2])throw Error(`invalid id: ${t}`);return e[(h+4>>>2)+2*t]}(t);if(!(7&e))throw Error(`not an array: ${t}, flags=${e}`);return e}function n(t){const e=new Uint32Array(s.buffer);if((t>>>=0)>=e[h>>>2])throw Error(`invalid id: ${t}`);return e[(h+4>>>2)+2*t+1]}function l(t){return 31-Math.clz32(t>>>6&31)}function c(t,e,i){const r=s.buffer;if(i)switch(t){case 2:return new Float32Array(r);case 3:return new Float64Array(r)}else switch(t){case 0:return new(e?Int8Array:Uint8Array)(r);case 1:return new(e?Int16Array:Uint16Array)(r);case 2:return new(e?Int32Array:Uint32Array)(r);case 3:return new(e?BigInt64Array:BigUint64Array)(r)}throw Error(`unsupported align: ${t}`)}function g(t){const e=new Uint32Array(s.buffer),i=A(e[t+-8>>>2]),r=l(i);let a=4&i?t:e[t+4>>>2];const o=2&i?e[t+12>>>2]:e[a+-4>>>2]>>>r;return c(r,2048&i,4096&i).subarray(a>>>=r,a+o)}function m(t,e,i){return new t(u(t,e,i))}function u(t,e,i){const r=s.buffer,a=new Uint32Array(r),o=a[i+4>>>2];return new t(r,o,a[o+-4>>>2]>>>e)}function f(e,i,s){t[`__get${i}`]=m.bind(null,e,s),t[`__get${i}View`]=u.bind(null,e,s)}return t.__newString=function(t){if(null==t)return 0;const e=t.length,i=a(e<<1,1),r=new Uint16Array(s.buffer);for(var o=0,h=i>>>1;o>>2])throw Error(`not a string: ${t}`);return K(e,t)},t.__newArray=function(t,e){const i=A(t),r=l(i),h=e.length,n=a(h<>>2]=o(n),A[e+4>>>2]=n,A[e+8>>>2]=h<>>2]=h),g=e}const m=c(r,2048&i,4096&i);if(16384&i)for(let t=0;t>>r)+t]=o(e[t]);else m.set(e,n>>>r);return g},t.__getArrayView=g,t.__getArray=function(t){const e=g(t),i=e.length,s=new Array(i);for(let t=0;t>>2];return e.slice(t,t+i)},[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].forEach(t=>{f(t,t.name,31-Math.clz32(t.BYTES_PER_ELEMENT))}),Y&&[BigUint64Array,BigInt64Array].forEach(t=>{f(t,t.name.slice(3),3)}),t.__instanceof=function(t,e){const i=new Uint32Array(s.buffer);let r=i[t+-8>>>2];if(r<=i[h>>>2])do{if(r==e)return!0;r=n(r)}while(r);return!1},t.memory=t.memory||s,t.table=t.table||r,it(i,t)}function Z(t){return"undefined"!=typeof Response&&t instanceof Response}function $(t){return t instanceof WebAssembly.Module}async function tt(t,e={}){if(Z(t=await t))return et(t,e);const i=$(t)?t:await WebAssembly.compile(t),s=j(e),r=await WebAssembly.instantiate(i,e);return{module:i,instance:r,exports:H(s,r)}}async function et(t,e={}){if(!WebAssembly.instantiateStreaming)return tt(Z(t=await t)?t.arrayBuffer():t,e);const i=j(e),s=await WebAssembly.instantiateStreaming(t,e),r=H(i,s.instance);return{...s,exports:r}}function it(t,e={}){const i=t.__argumentsLength?e=>{t.__argumentsLength.value=e}:t.__setArgumentsLength||t.__setargc||(()=>{});for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const r=t[s];let a=s.split("."),o=e;for(;a.length>1;){let t=a.shift();Object.prototype.hasOwnProperty.call(o,t)||(o[t]={}),o=o[t]}let h=a[0],A=h.indexOf("#");if(A>=0){const e=h.substring(0,A),a=o[e];if(void 0===a||!a.prototype){const t=function(...e){return t.wrap(t.prototype.constructor(0,...e))};t.prototype={valueOf(){return this[W]}},t.wrap=function(e){return Object.create(t.prototype,{[W]:{value:e,writable:!1}})},a&&Object.getOwnPropertyNames(a).forEach(e=>Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))),o[e]=t}if(h=h.substring(A+1),o=o[e].prototype,/^(get|set):/.test(h)){if(!Object.prototype.hasOwnProperty.call(o,h=h.substring(4))){let e=t[s.replace("set:","get:")],i=t[s.replace("get:","set:")];Object.defineProperty(o,h,{get(){return e(this[W])},set(t){i(this[W],t)},enumerable:!0})}}else"constructor"===h?(o[h]=(...t)=>(i(t.length),r(...t))).original=r:(o[h]=function(...t){return i(t.length),r(this[W],...t)}).original=r}else/^(get|set):/.test(h)?Object.prototype.hasOwnProperty.call(o,h=h.substring(4))||Object.defineProperty(o,h,{get:t[s.replace("set:","get:")],set:t[s.replace("get:","set:")],enumerable:!0}):"function"==typeof r&&r!==i?(o[h]=(...t)=>(i(t.length),r(...t))).original=r:o[h]=r}return e}var st={instantiate:tt,instantiateSync:function(t,e={}){const i=$(t)?t:new WebAssembly.Module(t),s=j(e),r=new WebAssembly.Instance(i,e);return{module:i,instance:r,exports:H(s,r)}},instantiateStreaming:et,demangle:it};class rt{constructor(t,e,i=!1){this.samplesIn=t,this.samplesOut=e,this.equalize=i,this.NFREQ=2*e,this.equalize&&this.initEqualizeTable(),this.initBitRevTable(),this.initCosSinTable()}initEqualizeTable(){this.equalizeArr=new Float32Array(this.samplesOut);const t=1/this.samplesOut;for(let e=0;ee){const i=this.bitrevtable[e];this.bitrevtable[e]=this.bitrevtable[t],this.bitrevtable[t]=i}let i=this.NFREQ>>1;for(;i>=1&&t>=i;)t-=i,i>>=1;t+=i}}initCosSinTable(){let t=2,e=0;for(;t<=this.NFREQ;)e+=1,t<<=1;this.cossintable=[new Float32Array(e),new Float32Array(e)],t=2;let i=0;for(;t<=this.NFREQ;){const e=-2*Math.PI/t;this.cossintable[0][i]=Math.cos(e),this.cossintable[1][i]=Math.sin(e),i+=1,t<<=1}}timeToFrequencyDomain(t){const e=new Float32Array(this.NFREQ),i=new Float32Array(this.NFREQ);for(let s=0;s>1;for(let r=0;r0){let i=t;!ot.isFiniteNumber(i)||i<15?i=15:i>144&&(i=144),this.imm.fill(0);for(let t=0;t<3;t++)for(let e=this.starts[t];ethis.avg[t]?.2:.5,s=ot.adjustRateToFPS(s,30,i),this.avg[t]=this.avg[t]*s+this.imm[t]*(1-s),s=e<50?.9:.992,s=ot.adjustRateToFPS(s,30,i),this.longAvg[t]=this.longAvg[t]*s+this.imm[t]*(1-s),this.longAvg[t]<.001?(this.val[t]=1,this.att[t]=1):(this.val[t]=this.imm[t]/this.longAvg[t],this.att[t]=this.avg[t]/this.longAvg[t])}}}}const ht={baseVals:{gammaadj:1.25,wave_g:.5,mv_x:12,warpscale:1,brighten:0,mv_y:9,wave_scale:1,echo_alpha:0,additivewave:0,sx:1,sy:1,warp:.01,red_blue:0,wave_mode:0,wave_brighten:0,wrap:0,zoomexp:1,fshader:0,wave_r:.5,echo_zoom:1,wave_smoothing:.75,warpanimspeed:1,wave_dots:0,wave_x:.5,wave_y:.5,zoom:1,solarize:0,modwavealphabyvolume:0,dx:0,cx:.5,dy:0,darken_center:0,cy:.5,invert:0,bmotionvectorson:0,rot:0,modwavealphaend:.95,wave_mystery:-.2,decay:.9,wave_a:1,wave_b:.5,rating:5,modwavealphastart:.75,darken:0,echo_orient:0,ib_r:.5,ib_g:.5,ib_b:.5,ib_a:0,ib_size:0,ob_r:.5,ob_g:.5,ob_b:.5,ob_a:0,ob_size:0,mv_dx:0,mv_dy:0,mv_a:0,mv_r:.5,mv_g:.5,mv_b:.5,mv_l:0},init_eqs:function(){return{}},frame_eqs:function(t){return t.rkeys=["warp"],t.zoom=1.01+.02*t.treb_att,t.warp=.15+.25*t.bass_att,t},pixel_eqs:function(t){return t.warp=t.warp+.15*t.rad,t},waves:[{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""}],shapes:[{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}}],warp:"shader_body {\nret = texture2D(sampler_main, uv).rgb;\nret -= 0.004;\n}\n",comp:"shader_body {\nret = texture2D(sampler_main, uv).rgb;\nret *= hue_shader;\n}\n"};class At{static atan2(t,e){let i=Math.atan2(t,e);return i<0&&(i+=2*Math.PI),i}static cloneVars(t){return Object.assign({},t)}static range(t,e){return void 0===e?[...Array(t).keys()]:Array.from({length:e-t},(e,i)=>i+t)}static pick(t,e){const i={};for(let s=0;s>>8,this.state[0]=t^e^e>>>19,(this.state[0]>>>0)/4294967296}nextInt(t){return Math.floor(this.next()*t)}rand(t){return t<1?this.next():Math.floor(this.next()*Math.floor(t))}reset(t){nt.initializeState(this.state,t),this.warmUp()}}function lt(){return{random:Math.random,rand:t=>t<1?Math.random():Math.random()*Math.floor(t),randint:t=>Math.floor((t<1?Math.random():Math.random()*Math.floor(t))+1),getRNG:()=>null,reset:()=>{}}}let ct=null;function gt(t={}){return ct=t.deterministic||t.testMode?function(t=1){const e=new nt(t);return{random:()=>e.next(),rand:t=>e.rand(t),randint:t=>Math.floor(e.rand(t)+1),getRNG:()=>e,reset:i=>{void 0!==i?e.reset(i):e.reset(t)}}}(t.seed||12345):lt(),(t.deterministic||t.testMode)&&(window.rand=t=>ct.rand(t),window.randint=t=>ct.randint(t),Math.random=()=>ct.random()),ct}function mt(){return ct||(ct=lt()),ct}class ut{constructor(t,e,i){this.rng=mt(),this.preset=t,this.texsizeX=i.texsizeX,this.texsizeY=i.texsizeY,this.mesh_width=i.mesh_width,this.mesh_height=i.mesh_height,this.aspectx=i.aspectx,this.aspecty=i.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.qs=At.range(1,33).map(t=>`q${t}`),this.ts=At.range(1,9).map(t=>`t${t}`),this.regs=At.range(100).map(t=>t<10?`reg0${t}`:`reg${t}`),this.initializeEquations(e)}initializeEquations(t){this.runVertEQs=""!==this.preset.pixel_eqs,this.mdVSQInit=null,this.mdVSRegs=null,this.mdVSFrame=null,this.mdVSUserKeys=null,this.mdVSFrameMap=null,this.mdVSShapes=null,this.mdVSUserKeysShapes=null,this.mdVSFrameMapShapes=null,this.mdVSWaves=null,this.mdVSUserKeysWaves=null,this.mdVSFrameMapWaves=null,this.mdVSQAfterFrame=null,this.gmegabuf=new Array(1048576).fill(0);const e={frame:t.frame,time:t.time,fps:t.fps,bass:t.bass,bass_att:t.bass_att,mid:t.mid,mid_att:t.mid_att,treb:t.treb,treb_att:t.treb_att,meshx:this.mesh_width,meshy:this.mesh_height,aspectx:this.invAspectx,aspecty:this.invAspecty,pixelsx:this.texsizeX,pixelsy:this.texsizeY,gmegabuf:this.gmegabuf};this.mdVS=Object.assign({},this.preset.baseVals,e),this.mdVS.megabuf=new Array(1048576).fill(0),this.mdVS.rand_start=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]),this.mdVS.rand_preset=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]);const i=this.qs.concat(this.regs,Object.keys(this.mdVS)),s=this.preset.init_eqs(At.cloneVars(this.mdVS));this.mdVSQInit=At.pick(s,this.qs),this.mdVSRegs=At.pick(s,this.regs);const r=At.pick(s,Object.keys(At.omit(s,i)));if(r.megabuf=s.megabuf,r.gmegabuf=s.gmegabuf,this.mdVSFrame=this.preset.frame_eqs(Object.assign({},this.mdVS,this.mdVSQInit,this.mdVSRegs,r)),this.mdVSUserKeys=Object.keys(At.omit(this.mdVSFrame,i)),this.mdVSFrameMap=At.pick(this.mdVSFrame,this.mdVSUserKeys),this.mdVSQAfterFrame=At.pick(this.mdVSFrame,this.qs),this.mdVSRegs=At.pick(this.mdVSFrame,this.regs),this.mdVSWaves=[],this.mdVSTWaveInits=[],this.mdVSUserKeysWaves=[],this.mdVSFrameMapWaves=[],this.preset.waves&&this.preset.waves.length>0)for(let t=0;t0)for(let t=0;t`q${t}`),this.ts=At.range(1,9).map(t=>`t${t}`),this.regs=At.range(100).map(t=>t<10?`reg0${t}`:`reg${t}`),this.globalKeys=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy"],this.frameKeys=["decay","wave_a","wave_r","wave_g","wave_b","wave_x","wave_y","wave_scale","wave_smoothing","wave_mode","old_wave_mode","wave_mystery","ob_size","ob_r","ob_g","ob_b","ob_a","ib_size","ib_r","ib_g","ib_b","ib_a","mv_x","mv_y","mv_dx","mv_dy","mv_l","mv_r","mv_g","mv_b","mv_a","echo_zoom","echo_alpha","echo_orient","wave_dots","wave_thick","additivewave","wave_brighten","modwavealphabyvolume","modwavealphastart","modwavealphaend","darken_center","gammaadj","warp","warpanimspeed","warpscale","zoom","zoomexp","rot","cx","cy","dx","dy","sx","sy","fshader","wrap","invert","brighten","darken","solarize","bmotionvectorson","b1n","b2n","b3n","b1x","b2x","b3x","b1ed"],this.waveFrameKeys=["samples","sep","scaling","spectrum","smoothing","r","g","b","a"],this.waveFrameInputKeys=["samples","r","g","b","a"],this.initializeEquations(e)}getQVars(t){return At.pickWasm(this.preset.globalPools[t],this.qs)}getTVars(t){return At.pickWasm(this.preset.globalPools[t],this.ts)}initializeEquations(t){this.runVertEQs=!!this.preset.pixel_eqs,this.mdVSQInit=null,this.mdVSQAfterFrame=null;const e={frame:t.frame,time:t.time,fps:t.fps,bass:t.bass,bass_att:t.bass_att,mid:t.mid,mid_att:t.mid_att,treb:t.treb,treb_att:t.treb_att,meshx:this.mesh_width,meshy:this.mesh_height,aspectx:this.invAspectx,aspecty:this.invAspecty,pixelsx:this.texsizeX,pixelsy:this.texsizeY};if(this.mdVS=Object.assign({},this.preset.baseVals,e),At.setWasm(this.preset.globalPools.perFrame,this.mdVS,Object.keys(this.mdVS)),this.rand_start=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]),this.rand_preset=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]),this.preset.init_eqs(),this.mdVSQInit=this.getQVars("perFrame"),this.preset.frame_eqs(),this.mdVSQAfterFrame=this.getQVars("perFrame"),this.mdVSTWaveInits=[],this.preset.waves&&this.preset.waves.length>0)for(let t=0;t0)for(let t=0;t-1){const i=t.substring(0,e),s=t.substring(e),r=s.indexOf("{"),a=s.lastIndexOf("}");return[i,s.substring(r+1,a)]}return["",t]}static getFragmentFloatPrecision(t){return t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0?"highp":t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}static getUserSamplers(t){const e=[],i=t.match(dt);if(i&&i.length>0)for(let t=0;t0){const t=s[1];e.push({sampler:t})}}return e}}class Et{static smoothWave(t,e,i,s=!1){const r=-.15,a=1.15,o=1.15,h=-.15;let A,n=0,l=0,c=1;for(let g=0;g-.01&&a>.001&&i.length>0){const h=bt.processWaveform(i,r),A=bt.processWaveform(s,r),n=Math.floor(r.wave_mode)%8,l=Math.floor(r.old_wave_mode)%8,c=2*r.wave_x-1,g=2*r.wave_y-1;this.numVert=0,this.oldNumVert=0;const m=t&&n!==l?2:1;for(let t=0;t1)||(u=.5*u+.5,u-=Math.floor(u),u=Math.abs(u),u=2*u-1),0===t?(s=this.positions,m=this.positions2):(s=this.oldPositions,m=this.oldPositions2),a=r.wave_a,0===e){if(r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=Math.floor(h.length/2)+1;const t=1/(i-1),e=Math.floor((h.length-i)/2);for(let a=0;a0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=Math.floor(h.length/2);for(let t=0;t=1024&&this.texsizeX<2048?a*=.11:a*=.13,r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=h.length;for(let t=0;t=1024&&this.texsizeX<2048?a*=.22:a*=.33,a*=1.3,a*=r.treb*r.treb,r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=h.length;for(let t=0;t0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=h.length,i>this.texsizeX/3&&(i=Math.floor(this.texsizeX/3));const t=1/i,e=Math.floor((h.length-i)/2),n=.45+.5*(.5*u+.5),l=1-n;for(let r=0;r1&&(i=i*l+n*(2*s[3*(r-1)+0]-s[3*(r-2)+0]),a=a*l+n*(2*s[3*(r-1)+1]-s[3*(r-2)+1])),s[3*r+0]=i,s[3*r+1]=a,s[3*r+2]=0}}else if(5===e){if(this.texsizeX<1024?a*=.09:this.texsizeX>=1024&&this.texsizeX<2048?a*=.11:a*=.13,r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1);const t=Math.cos(.3*r.time),e=Math.sin(.3*r.time);i=h.length;for(let i=0;i0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=Math.floor(h.length/2),i>this.texsizeX/3&&(i=Math.floor(this.texsizeX/3));const t=Math.floor((h.length-i)/2),n=.5*Math.PI*u;let l=Math.cos(n),f=Math.sin(n);const d=[c*Math.cos(n+.5*Math.PI)-3*l,c*Math.cos(n+.5*Math.PI)+3*l],p=[c*Math.sin(n+.5*Math.PI)-3*f,c*Math.sin(n+.5*Math.PI)+3*f];for(let t=0;t<2;t++)for(let e=0;e<4;e++){let i,s=!1;switch(e){case 0:d[t]>1.1&&(i=(1.1-d[1-t])/(d[t]-d[1-t]),s=!0);break;case 1:d[t]<-1.1&&(i=(-1.1-d[1-t])/(d[t]-d[1-t]),s=!0);break;case 2:p[t]>1.1&&(i=(1.1-p[1-t])/(p[t]-p[1-t]),s=!0);break;case 3:p[t]<-1.1&&(i=(-1.1-p[1-t])/(p[t]-p[1-t]),s=!0)}if(s){const e=d[t]-d[1-t],s=p[t]-p[1-t];d[t]=d[1-t]+e*i,p[t]=p[1-t]+s*i}}l=(d[1]-d[0])/i,f=(p[1]-p[0])/i;const _=Math.atan2(f,l),E=Math.cos(_+.5*Math.PI),b=Math.sin(_+.5*Math.PI);if(6===e)for(let e=0;e0&&(a=u*this.alpha+f*this.oldAlpha);let d=Math.clamp(r.wave_r,0,1),p=Math.clamp(r.wave_g,0,1),_=Math.clamp(r.wave_b,0,1);if(0!==r.wave_brighten){const t=Math.max(d,p,_);t>.01&&(d/=t,p/=t,_/=t)}if(this.color=[d,p,_,a],this.oldNumVert>0)if(7===n){const t=(this.oldNumVert-1)/(2*this.numVert);for(let e=0;e0){let A;if(a.preset.useWASM)A=a.runWaveFrameEquations(this.index,r);else{const t=Object.assign({},a.mdVSWaves[this.index],a.mdVSFrameMapWaves[this.index],a.mdVSQAfterFrame,a.mdVSTWaveInits[this.index],r);A=a.runWaveFrameEquations(this.index,t)}const n=512;Object.prototype.hasOwnProperty.call(A,"samples")?this.samples=A.samples:this.samples=n,this.samples>n&&(this.samples=n),this.samples=Math.floor(this.samples);const l=a.preset.waves[this.index].baseVals,c=Math.floor(A.sep),g=A.scaling,m=A.spectrum,u=A.smoothing,f=l.usedots,d=A.r,p=A.g,_=A.b,E=A.a,b=a.preset.baseVals.wave_scale;if(this.samples-=c,this.samples>=2||0!==f&&this.samples>=1){const r=0!==m,x=(r?.15:.004)*g*b,v=r?i:t,T=r?s:e,S=r?0:Math.floor((n-this.samples)/2-c/2),P=r?0:Math.floor((n-this.samples)/2+c/2),w=r?(n-c)/this.samples:1,I=(.98*u)**.5,R=1-I;this.pointsData[0][0]=v[S],this.pointsData[1][0]=T[P];for(let t=1;t=0;t--)this.pointsData[0][t]=this.pointsData[0][t]*R+this.pointsData[0][t+1]*I,this.pointsData[1][t]=this.pointsData[1][t]*R+this.pointsData[1][t+1]*I;for(let t=0;t=1024?1:0)):this.gl.uniform1f(this.sizeLoc,1+(this.texsizeX>=1024?1:0)):(this.gl.uniform1f(this.sizeLoc,1),e&&(o=4)),i?this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE):this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA);const h=t?this.gl.POINTS:this.gl.LINE_STRIP;for(let t=0;t0,R=Math.abs(T)>=1,y=Math.abs(v)>=1,B=Math.abs(w)>=1;this.positions[0]=A,this.positions[1]=n,this.positions[2]=0,this.colors[0]=l,this.colors[1]=c,this.colors[2]=g,this.colors[3]=m*t,R&&(this.uvs[0]=.5,this.uvs[1]=.5);const L=.25*Math.PI;for(let e=1;e<=s+1;e++){const i=2*((e-1)/s)*Math.PI,r=i+h+L;if(this.positions[3*e+0]=A+o*Math.cos(r)*this.aspecty,this.positions[3*e+1]=n+o*Math.sin(r),this.positions[3*e+2]=0,this.colors[4*e+0]=u,this.colors[4*e+1]=f,this.colors[4*e+2]=d,this.colors[4*e+3]=p*t,R){const t=i+P+L;this.uvs[2*e+0]=.5+.5*Math.cos(t)/S*this.aspecty,this.uvs[2*e+1]=.5+.5*Math.sin(t)/S}I&&(this.borderPositions[3*(e-1)+0]=this.positions[3*e+0],this.borderPositions[3*(e-1)+1]=this.positions[3*e+1],this.borderPositions[3*(e-1)+2]=this.positions[3*e+2])}this.drawCustomShapeInstance(r,s,R,I,y,B)}}else{this.setupShapeBuffers(i.mdVSFrame.wrap);let s=Object.assign({},i.mdVSShapes[this.index],i.mdVSFrameMapShapes[this.index],e);""===i.preset.shapes[this.index].frame_eqs_str&&(s=Object.assign(s,i.mdVSQAfterFrame,i.mdVSTShapeInits[this.index]));const a=i.preset.shapes[this.index].baseVals,o=Math.clamp(a.num_inst,1,1024);for(let e=0;e0,B=Math.abs(P)>=1,L=Math.abs(S)>=1,C=Math.abs(R)>=1;this.positions[0]=l,this.positions[1]=c,this.positions[2]=0,this.colors[0]=g,this.colors[1]=m,this.colors[2]=u,this.colors[3]=f*t,B&&(this.uvs[0]=.5,this.uvs[1]=.5);const U=.25*Math.PI;for(let e=1;e<=h+1;e++){const i=2*((e-1)/h)*Math.PI,s=i+n+U;if(this.positions[3*e+0]=l+A*Math.cos(s)*this.aspecty,this.positions[3*e+1]=c+A*Math.sin(s),this.positions[3*e+2]=0,this.colors[4*e+0]=d,this.colors[4*e+1]=p,this.colors[4*e+2]=_,this.colors[4*e+3]=E*t,B){const t=i+I+U;this.uvs[2*e+0]=.5+.5*Math.cos(t)/w*this.aspecty,this.uvs[2*e+1]=.5+.5*Math.sin(t)/w}y&&(this.borderPositions[3*(e-1)+0]=this.positions[3*e+0],this.borderPositions[3*(e-1)+1]=this.positions[3*e+1],this.borderPositions[3*(e-1)+2]=this.positions[3*e+2])}this.mdVSShapeFrame=o,this.drawCustomShapeInstance(r,h,B,y,L,C)}const h=i.mdVSUserKeysShapes[this.index],A=At.pick(this.mdVSShapeFrame,h);i.mdVSFrameMapShapes[this.index]=A}}setupShapeBuffers(t){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.colors,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.uvVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.uvs,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aUvLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aUvLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.borderPositionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.borderPositions,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aBorderPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aBorderPosLoc);const e=0!==t?this.gl.REPEAT:this.gl.CLAMP_TO_EDGE;this.gl.samplerParameteri(this.mainSampler,this.gl.TEXTURE_WRAP_S,e),this.gl.samplerParameteri(this.mainSampler,this.gl.TEXTURE_WRAP_T,e)}drawCustomShapeInstance(t,e,i,s,r,a){if(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.positions,0,3*(e+2)),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.colors,0,4*(e+2)),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),i&&(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.uvVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.uvs,0,2*(e+2)),this.gl.vertexAttribPointer(this.aUvLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aUvLocation)),this.gl.uniform1f(this.texturedLoc,i?1:0),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.bindSampler(0,this.mainSampler),this.gl.uniform1i(this.textureLoc,0),a?this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE):this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,e+2),s){this.gl.useProgram(this.borderShaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.borderPositionVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.borderPositions,0,3*(e+1)),this.gl.vertexAttribPointer(this.aBorderPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aBorderPosLoc),this.gl.uniform4fv(this.uBorderColorLoc,this.borderColor);const t=r?4:1;for(let i=0;i0&&t[3]>0){const t=2,s=2,r=t/2,a=s/2,o=i/2,h=e/2+o,A=o*t,n=o*s,l=h*t,c=h*s;let g=[-r+A,-a+c,0],m=[-r+A,a-c,0],u=[-r+l,a-c,0],f=[-r+l,-a+c,0];return this.addTriangle(0,f,m,g),this.addTriangle(9,f,u,m),g=[r-A,-a+c,0],m=[r-A,a-c,0],u=[r-l,a-c,0],f=[r-l,-a+c,0],this.addTriangle(18,g,m,f),this.addTriangle(27,m,u,f),g=[-r+A,-a+n,0],m=[-r+A,c-a,0],u=[r-A,c-a,0],f=[r-A,-a+n,0],this.addTriangle(36,f,m,g),this.addTriangle(45,f,u,m),g=[-r+A,a-n,0],m=[-r+A,a-c,0],u=[r-A,a-c,0],f=[r-A,a-n,0],this.addTriangle(54,g,m,f),this.addTriangle(63,m,u,f),!0}return!1}drawBorder(t,e,i){this.generateBorder(t,e,i)&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLoc),this.gl.uniform4fv(this.colorLoc,t),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLES,0,this.positions.length/3))}}class St{constructor(t,e){this.gl=t,this.aspectx=e.aspectx,this.aspecty=e.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.generatePositions(),this.colors=new Float32Array([0,0,0,3/32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),this.positionVertexBuf=this.gl.createBuffer(),this.colorVertexBuf=this.gl.createBuffer(),this.floatPrecision=_t.getFragmentFloatPrecision(this.gl),this.createShader()}updateGlobals(t){this.aspectx=t.aspectx,this.aspecty=t.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.generatePositions()}generatePositions(){const t=.05;this.positions=new Float32Array([0,0,0,-.05*this.aspecty,0,0,0,-.05,0,t*this.aspecty,0,0,0,t,0,-.05*this.aspecty,0,0])}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n in vec3 aPos;\n in vec4 aColor;\n out vec4 vColor;\n void main(void) {\n vColor = aColor;\n gl_Position = vec4(aPos, 1.0);\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`\n #version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n in vec4 vColor;\n out vec4 fragColor;\n void main(void) {\n fragColor = vColor;\n }\n `.trim()),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.aPosLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.aColorLocation=this.gl.getAttribLocation(this.shaderProgram,"aColor")}drawDarkenCenter(t){0!==t.darken_center&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.colors,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,this.positions.length/3))}}class Pt{constructor(t,e){this.gl=t,this.maxX=64,this.maxY=48,this.positions=new Float32Array(this.maxX*this.maxY*2*3),this.texsizeX=e.texsizeX,this.texsizeY=e.texsizeY,this.mesh_width=e.mesh_width,this.mesh_height=e.mesh_height,this.positionVertexBuf=this.gl.createBuffer(),this.floatPrecision=_t.getFragmentFloatPrecision(this.gl),this.createShader()}updateGlobals(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.mesh_width=t.mesh_width,this.mesh_height=t.mesh_height}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n in vec3 aPos;\n void main(void) {\n gl_Position = vec4(aPos, 1.0);\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`\n #version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n out vec4 fragColor;\n uniform vec4 u_color;\n void main(void) {\n fragColor = u_color;\n }\n `.trim()),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.aPosLoc=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.colorLoc=this.gl.getUniformLocation(this.shaderProgram,"u_color")}getMotionDir(t,e,i){const s=Math.floor(i*this.mesh_height),r=i*this.mesh_height-s,a=Math.floor(e*this.mesh_width),o=e*this.mesh_width-a,h=a+1,A=s+1,n=this.mesh_width+1;let l,c;return l=t[2*(s*n+a)+0]*(1-o)*(1-r),c=t[2*(s*n+a)+1]*(1-o)*(1-r),l+=t[2*(s*n+h)+0]*o*(1-r),c+=t[2*(s*n+h)+1]*o*(1-r),l+=t[2*(A*n+a)+0]*(1-o)*r,c+=t[2*(A*n+a)+1]*(1-o)*r,l+=t[2*(A*n+h)+0]*o*r,c+=t[2*(A*n+h)+1]*o*r,[l,1-c]}generateMotionVectors(t,e){const i=0===t.bmotionvectorson?0:t.mv_a;let s=Math.floor(t.mv_x),r=Math.floor(t.mv_y);if(i>.001&&s>0&&r>0){let a=t.mv_x-s,o=t.mv_y-r;s>this.maxX&&(s=this.maxX,a=0),r>this.maxY&&(r=this.maxY,o=0);const h=t.mv_dx,A=t.mv_dy,n=t.mv_l,l=1/this.texsizeX;this.numVecVerts=0;for(let t=0;t1e-4&&i<.9999)for(let t=0;t1e-4&&r<.9999){const t=this.getMotionDir(e,r,i);let s=t[0],a=t[1],o=s-r,h=a-i;o*=n,h*=n;let A=Math.sqrt(o*o+h*h);A1e-8?(A=l/A,o*=A,h*=A):(o=l,o=l),s=r+o,a=i+h;const c=2*r-1,g=2*i-1,m=2*s-1,u=2*a-1;this.positions[3*this.numVecVerts+0]=c,this.positions[3*this.numVecVerts+1]=g,this.positions[3*this.numVecVerts+2]=0,this.positions[3*(this.numVecVerts+1)+0]=m,this.positions[3*(this.numVecVerts+1)+1]=u,this.positions[3*(this.numVecVerts+1)+2]=0,this.numVecVerts+=2}}}if(this.numVecVerts>0)return this.color=[t.mv_r,t.mv_g,t.mv_b,i],!0}return!1}drawMotionVectors(t,e){this.generateMotionVectors(t,e)&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLoc),this.gl.uniform4fv(this.colorLoc,this.color),this.gl.lineWidth(1),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.LINES,0,this.numVecVerts))}}class wt{constructor(t,e,i,s={}){this.gl=t,this.noise=e,this.image=i,this.rng=mt(),this.texsizeX=s.texsizeX,this.texsizeY=s.texsizeY,this.mesh_width=s.mesh_width,this.mesh_height=s.mesh_height,this.aspectx=s.aspectx,this.aspecty=s.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.buildPositions(),this.indexBuf=t.createBuffer(),this.positionVertexBuf=this.gl.createBuffer(),this.warpUvVertexBuf=this.gl.createBuffer(),this.warpColorVertexBuf=this.gl.createBuffer(),this.floatPrecision=_t.getFragmentFloatPrecision(this.gl),this.createShader(),this.mainSampler=this.gl.createSampler(),this.mainSamplerFW=this.gl.createSampler(),this.mainSamplerFC=this.gl.createSampler(),this.mainSamplerPW=this.gl.createSampler(),this.mainSamplerPC=this.gl.createSampler(),t.samplerParameteri(this.mainSampler,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.samplerParameteri(this.mainSampler,t.TEXTURE_MAG_FILTER,t.LINEAR),t.samplerParameteri(this.mainSampler,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.mainSampler,t.TEXTURE_WRAP_T,t.REPEAT),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_MAG_FILTER,t.LINEAR),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_WRAP_T,t.REPEAT),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_MAG_FILTER,t.LINEAR),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_MAG_FILTER,t.NEAREST),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_WRAP_T,t.REPEAT),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_MAG_FILTER,t.NEAREST),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}buildPositions(){const t=this.mesh_width,e=this.mesh_height,i=t+1,s=e+1,r=2/t,a=2/e,o=[];for(let t=0;t= 2.0) ? -1.0 : 1.0;\n vec2 uv_echo = ((uv - 0.5) *\n (1.0 / echo_zoom) *\n vec2(orient_x, orient_y)) + 0.5;\n\n ret = mix(texture(sampler_main, uv).rgb,\n texture(sampler_main, uv_echo).rgb,\n echo_alpha);\n\n ret *= gammaAdj;\n\n if(fShader >= 1.0) {\n ret *= hue_shader;\n } else if(fShader > 0.001) {\n ret *= (1.0 - fShader) + (fShader * hue_shader);\n }\n\n if(brighten != 0) ret = sqrt(ret);\n if(darken != 0) ret = ret*ret;\n if(solarize != 0) ret = ret * (1.0 - ret) * 4.0;\n if(invert != 0) ret = 1.0 - ret;",i="";else{const s=_t.getShaderParts(t);i=s[0],e=s[1]}e=e.replace(/texture2D/g,"texture"),e=e.replace(/texture3D/g,"texture"),this.userTextures=_t.getUserSamplers(i),this.shaderProgram=this.gl.createProgram();const s=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(s,"\n #version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n in vec4 aCompColor;\n out vec2 vUv;\n out vec4 vColor;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n vUv = aPos * halfmad + halfmad;\n vColor = aCompColor;\n }\n ".trim()),this.gl.compileShader(s);const r=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(r,`\n #version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n precision mediump sampler3D;\n\n vec3 lum(vec3 v){\n return vec3(dot(v, vec3(0.32,0.49,0.29)));\n }\n\n in vec2 vUv;\n in vec4 vColor;\n out vec4 fragColor;\n uniform sampler2D sampler_main;\n uniform sampler2D sampler_fw_main;\n uniform sampler2D sampler_fc_main;\n uniform sampler2D sampler_pw_main;\n uniform sampler2D sampler_pc_main;\n uniform sampler2D sampler_blur1;\n uniform sampler2D sampler_blur2;\n uniform sampler2D sampler_blur3;\n uniform sampler2D sampler_noise_lq;\n uniform sampler2D sampler_noise_lq_lite;\n uniform sampler2D sampler_noise_mq;\n uniform sampler2D sampler_noise_hq;\n uniform sampler2D sampler_pw_noise_lq;\n uniform sampler3D sampler_noisevol_lq;\n uniform sampler3D sampler_noisevol_hq;\n\n uniform float time;\n uniform float gammaAdj;\n uniform float echo_zoom;\n uniform float echo_alpha;\n uniform float echo_orientation;\n uniform int invert;\n uniform int brighten;\n uniform int darken;\n uniform int solarize;\n uniform vec2 resolution;\n uniform vec4 aspect;\n uniform vec4 texsize;\n uniform vec4 texsize_noise_lq;\n uniform vec4 texsize_noise_mq;\n uniform vec4 texsize_noise_hq;\n uniform vec4 texsize_noise_lq_lite;\n uniform vec4 texsize_noisevol_lq;\n uniform vec4 texsize_noisevol_hq;\n\n uniform float bass;\n uniform float mid;\n uniform float treb;\n uniform float vol;\n uniform float bass_att;\n uniform float mid_att;\n uniform float treb_att;\n uniform float vol_att;\n\n uniform float frame;\n uniform float fps;\n\n uniform vec4 _qa;\n uniform vec4 _qb;\n uniform vec4 _qc;\n uniform vec4 _qd;\n uniform vec4 _qe;\n uniform vec4 _qf;\n uniform vec4 _qg;\n uniform vec4 _qh;\n\n #define q1 _qa.x\n #define q2 _qa.y\n #define q3 _qa.z\n #define q4 _qa.w\n #define q5 _qb.x\n #define q6 _qb.y\n #define q7 _qb.z\n #define q8 _qb.w\n #define q9 _qc.x\n #define q10 _qc.y\n #define q11 _qc.z\n #define q12 _qc.w\n #define q13 _qd.x\n #define q14 _qd.y\n #define q15 _qd.z\n #define q16 _qd.w\n #define q17 _qe.x\n #define q18 _qe.y\n #define q19 _qe.z\n #define q20 _qe.w\n #define q21 _qf.x\n #define q22 _qf.y\n #define q23 _qf.z\n #define q24 _qf.w\n #define q25 _qg.x\n #define q26 _qg.y\n #define q27 _qg.z\n #define q28 _qg.w\n #define q29 _qh.x\n #define q30 _qh.y\n #define q31 _qh.z\n #define q32 _qh.w\n\n uniform vec4 slow_roam_cos;\n uniform vec4 roam_cos;\n uniform vec4 slow_roam_sin;\n uniform vec4 roam_sin;\n\n uniform float blur1_min;\n uniform float blur1_max;\n uniform float blur2_min;\n uniform float blur2_max;\n uniform float blur3_min;\n uniform float blur3_max;\n\n uniform float scale1;\n uniform float scale2;\n uniform float scale3;\n uniform float bias1;\n uniform float bias2;\n uniform float bias3;\n\n uniform vec4 rand_frame;\n uniform vec4 rand_preset;\n\n uniform float fShader;\n\n float PI = ${Math.PI};\n\n ${i}\n\n void main(void) {\n vec3 ret;\n vec2 uv = vUv;\n vec2 uv_orig = vUv;\n uv.y = 1.0 - uv.y;\n uv_orig.y = 1.0 - uv_orig.y;\n float rad = length(uv - 0.5);\n float ang = atan(uv.x - 0.5, uv.y - 0.5);\n vec3 hue_shader = vColor.rgb;\n\n ${e}\n\n fragColor = vec4(ret, vColor.a);\n }\n `.trim()),this.gl.compileShader(r),this.gl.attachShader(this.shaderProgram,s),this.gl.attachShader(this.shaderProgram,r),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.compColorLocation=this.gl.getAttribLocation(this.shaderProgram,"aCompColor"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_main"),this.textureFWLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_fw_main"),this.textureFCLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_fc_main"),this.texturePWLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_pw_main"),this.texturePCLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_pc_main"),this.blurTexture1Loc=this.gl.getUniformLocation(this.shaderProgram,"sampler_blur1"),this.blurTexture2Loc=this.gl.getUniformLocation(this.shaderProgram,"sampler_blur2"),this.blurTexture3Loc=this.gl.getUniformLocation(this.shaderProgram,"sampler_blur3"),this.noiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_lq"),this.noiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_mq"),this.noiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_hq"),this.noiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_lq_lite"),this.noisePointLQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_pw_noise_lq"),this.noiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noisevol_lq"),this.noiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noisevol_hq"),this.timeLoc=this.gl.getUniformLocation(this.shaderProgram,"time"),this.gammaAdjLoc=this.gl.getUniformLocation(this.shaderProgram,"gammaAdj"),this.echoZoomLoc=this.gl.getUniformLocation(this.shaderProgram,"echo_zoom"),this.echoAlphaLoc=this.gl.getUniformLocation(this.shaderProgram,"echo_alpha"),this.echoOrientationLoc=this.gl.getUniformLocation(this.shaderProgram,"echo_orientation"),this.invertLoc=this.gl.getUniformLocation(this.shaderProgram,"invert"),this.brightenLoc=this.gl.getUniformLocation(this.shaderProgram,"brighten"),this.darkenLoc=this.gl.getUniformLocation(this.shaderProgram,"darken"),this.solarizeLoc=this.gl.getUniformLocation(this.shaderProgram,"solarize"),this.texsizeLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize"),this.texsizeNoiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_lq"),this.texsizeNoiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_mq"),this.texsizeNoiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_hq"),this.texsizeNoiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_lq_lite"),this.texsizeNoiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noisevol_lq"),this.texsizeNoiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noisevol_hq"),this.resolutionLoc=this.gl.getUniformLocation(this.shaderProgram,"resolution"),this.aspectLoc=this.gl.getUniformLocation(this.shaderProgram,"aspect"),this.bassLoc=this.gl.getUniformLocation(this.shaderProgram,"bass"),this.midLoc=this.gl.getUniformLocation(this.shaderProgram,"mid"),this.trebLoc=this.gl.getUniformLocation(this.shaderProgram,"treb"),this.volLoc=this.gl.getUniformLocation(this.shaderProgram,"vol"),this.bassAttLoc=this.gl.getUniformLocation(this.shaderProgram,"bass_att"),this.midAttLoc=this.gl.getUniformLocation(this.shaderProgram,"mid_att"),this.trebAttLoc=this.gl.getUniformLocation(this.shaderProgram,"treb_att"),this.volAttLoc=this.gl.getUniformLocation(this.shaderProgram,"vol_att"),this.frameLoc=this.gl.getUniformLocation(this.shaderProgram,"frame"),this.fpsLoc=this.gl.getUniformLocation(this.shaderProgram,"fps"),this.blur1MinLoc=this.gl.getUniformLocation(this.shaderProgram,"blur1_min"),this.blur1MaxLoc=this.gl.getUniformLocation(this.shaderProgram,"blur1_max"),this.blur2MinLoc=this.gl.getUniformLocation(this.shaderProgram,"blur2_min"),this.blur2MaxLoc=this.gl.getUniformLocation(this.shaderProgram,"blur2_max"),this.blur3MinLoc=this.gl.getUniformLocation(this.shaderProgram,"blur3_min"),this.blur3MaxLoc=this.gl.getUniformLocation(this.shaderProgram,"blur3_max"),this.scale1Loc=this.gl.getUniformLocation(this.shaderProgram,"scale1"),this.scale2Loc=this.gl.getUniformLocation(this.shaderProgram,"scale2"),this.scale3Loc=this.gl.getUniformLocation(this.shaderProgram,"scale3"),this.bias1Loc=this.gl.getUniformLocation(this.shaderProgram,"bias1"),this.bias2Loc=this.gl.getUniformLocation(this.shaderProgram,"bias2"),this.bias3Loc=this.gl.getUniformLocation(this.shaderProgram,"bias3"),this.randPresetLoc=this.gl.getUniformLocation(this.shaderProgram,"rand_preset"),this.randFrameLoc=this.gl.getUniformLocation(this.shaderProgram,"rand_frame"),this.fShaderLoc=this.gl.getUniformLocation(this.shaderProgram,"fShader"),this.qaLoc=this.gl.getUniformLocation(this.shaderProgram,"_qa"),this.qbLoc=this.gl.getUniformLocation(this.shaderProgram,"_qb"),this.qcLoc=this.gl.getUniformLocation(this.shaderProgram,"_qc"),this.qdLoc=this.gl.getUniformLocation(this.shaderProgram,"_qd"),this.qeLoc=this.gl.getUniformLocation(this.shaderProgram,"_qe"),this.qfLoc=this.gl.getUniformLocation(this.shaderProgram,"_qf"),this.qgLoc=this.gl.getUniformLocation(this.shaderProgram,"_qg"),this.qhLoc=this.gl.getUniformLocation(this.shaderProgram,"_qh"),this.slowRoamCosLoc=this.gl.getUniformLocation(this.shaderProgram,"slow_roam_cos"),this.roamCosLoc=this.gl.getUniformLocation(this.shaderProgram,"roam_cos"),this.slowRoamSinLoc=this.gl.getUniformLocation(this.shaderProgram,"slow_roam_sin"),this.roamSinLoc=this.gl.getUniformLocation(this.shaderProgram,"roam_sin");for(let t=0;t lumaMax))\n color = vec4(rgbA, 1.0);\n else\n color = vec4(rgbB, 1.0);\n\n fragColor = color;\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.texsizeLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize")}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"#version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }"),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n\n void main(void) {\n fragColor = vec4(texture(uTexture, uv).rgb, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture")}renderQuadTexture(t){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(this.textureLoc,0),this.useFXAA()&&this.gl.uniform4fv(this.texsizeLoc,new Float32Array([this.texsizeX,this.texsizeY,1/this.texsizeX,1/this.texsizeY])),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class yt{constructor(t){this.gl=t,this.positions=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.vertexBuf=this.gl.createBuffer(),this.floatPrecision=_t.getFragmentFloatPrecision(this.gl),this.createShader()}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"#version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }"),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n\n void main(void) {\n fragColor = vec4(texture(uTexture, uv).rgb, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture")}renderQuadTexture(t){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.uniform1i(this.textureLoc,0),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class Bt{constructor(t,e){this.gl=t,this.blurLevel=e;const i=[4,3.8,3.5,2.9,1.9,1.2,.7,.3],s=i[0]+i[1]+i[2]+i[3],r=i[4]+i[5]+i[6]+i[7],a=0+(i[2]+i[3])/s*2,o=2+(i[6]+i[7])/r*2;this.wds=new Float32Array([s,r,a,o]),this.wDiv=1/(2*(s+r)),this.positions=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.vertexBuf=this.gl.createBuffer(),this.floatPrecision=_t.getFragmentFloatPrecision(this.gl),this.createShader()}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n uniform vec4 texsize;\n uniform float ed1;\n uniform float ed2;\n uniform float ed3;\n uniform vec4 wds;\n uniform float wdiv;\n\n void main(void) {\n float w1 = wds[0];\n float w2 = wds[1];\n float d1 = wds[2];\n float d2 = wds[3];\n\n vec2 uv2 = uv.xy;\n\n vec3 blur =\n ( texture(uTexture, uv2 + vec2(0.0, d1 * texsize.w) ).xyz\n + texture(uTexture, uv2 + vec2(0.0,-d1 * texsize.w) ).xyz) * w1 +\n ( texture(uTexture, uv2 + vec2(0.0, d2 * texsize.w) ).xyz\n + texture(uTexture, uv2 + vec2(0.0,-d2 * texsize.w) ).xyz) * w2;\n\n blur.xyz *= wdiv;\n\n float t = min(min(uv.x, uv.y), 1.0 - max(uv.x, uv.y));\n t = sqrt(t);\n t = ed1 + ed2 * clamp(t * ed3, 0.0, 1.0);\n blur.xyz *= t;\n\n fragColor = vec4(blur, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.texsizeLocation=this.gl.getUniformLocation(this.shaderProgram,"texsize"),this.ed1Loc=this.gl.getUniformLocation(this.shaderProgram,"ed1"),this.ed2Loc=this.gl.getUniformLocation(this.shaderProgram,"ed2"),this.ed3Loc=this.gl.getUniformLocation(this.shaderProgram,"ed3"),this.wdsLocation=this.gl.getUniformLocation(this.shaderProgram,"wds"),this.wdivLoc=this.gl.getUniformLocation(this.shaderProgram,"wdiv")}renderQuadTexture(t,e,i){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(this.textureLoc,0);const s=0===this.blurLevel?e.b1ed:0;this.gl.uniform4fv(this.texsizeLocation,[i[0],i[1],1/i[0],1/i[1]]),this.gl.uniform1f(this.ed1Loc,1-s),this.gl.uniform1f(this.ed2Loc,s),this.gl.uniform1f(this.ed3Loc,5),this.gl.uniform4fv(this.wdsLocation,this.wds),this.gl.uniform1f(this.wdivLoc,this.wDiv),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class Lt{constructor(t,e){this.gl=t,this.blurLevel=e;const i=[4,3.8,3.5,2.9,1.9,1.2,.7,.3],s=i[0]+i[1],r=i[2]+i[3],a=i[4]+i[5],o=i[6]+i[7],h=0+2*i[1]/s,A=2+2*i[3]/r,n=4+2*i[5]/a,l=6+2*i[7]/o;this.ws=new Float32Array([s,r,a,o]),this.ds=new Float32Array([h,A,n,l]),this.wDiv=.5/(s+r+a+o),this.positions=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.vertexBuf=this.gl.createBuffer(),this.floatPrecision=_t.getFragmentFloatPrecision(this.gl),this.createShader()}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n uniform vec4 texsize;\n uniform float scale;\n uniform float bias;\n uniform vec4 ws;\n uniform vec4 ds;\n uniform float wdiv;\n\n void main(void) {\n float w1 = ws[0];\n float w2 = ws[1];\n float w3 = ws[2];\n float w4 = ws[3];\n float d1 = ds[0];\n float d2 = ds[1];\n float d3 = ds[2];\n float d4 = ds[3];\n\n vec2 uv2 = uv.xy;\n\n vec3 blur =\n ( texture(uTexture, uv2 + vec2( d1 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d1 * texsize.z,0.0) ).xyz) * w1 +\n ( texture(uTexture, uv2 + vec2( d2 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d2 * texsize.z,0.0) ).xyz) * w2 +\n ( texture(uTexture, uv2 + vec2( d3 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d3 * texsize.z,0.0) ).xyz) * w3 +\n ( texture(uTexture, uv2 + vec2( d4 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d4 * texsize.z,0.0) ).xyz) * w4;\n\n blur.xyz *= wdiv;\n blur.xyz = blur.xyz * scale + bias;\n\n fragColor = vec4(blur, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.texsizeLocation=this.gl.getUniformLocation(this.shaderProgram,"texsize"),this.scaleLoc=this.gl.getUniformLocation(this.shaderProgram,"scale"),this.biasLoc=this.gl.getUniformLocation(this.shaderProgram,"bias"),this.wsLoc=this.gl.getUniformLocation(this.shaderProgram,"ws"),this.dsLocation=this.gl.getUniformLocation(this.shaderProgram,"ds"),this.wdivLoc=this.gl.getUniformLocation(this.shaderProgram,"wdiv")}getScaleAndBias(t,e){const i=[1,1,1],s=[0,0,0];let r,a;return i[0]=1/(e[0]-t[0]),s[0]=-t[0]*i[0],r=(t[1]-t[0])/(e[0]-t[0]),a=(e[1]-t[0])/(e[0]-t[0]),i[1]=1/(a-r),s[1]=-r*i[1],r=(t[2]-t[1])/(e[1]-t[1]),a=(e[2]-t[1])/(e[1]-t[1]),i[2]=1/(a-r),s[2]=-r*i[2],{scale:i[this.blurLevel],bias:s[this.blurLevel]}}renderQuadTexture(t,e,i,s,r){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(this.textureLoc,0);const{scale:a,bias:o}=this.getScaleAndBias(i,s);this.gl.uniform4fv(this.texsizeLocation,[r[0],r[1],1/r[0],1/r[1]]),this.gl.uniform1f(this.scaleLoc,a),this.gl.uniform1f(this.biasLoc,o),this.gl.uniform4fv(this.wsLoc,this.ws),this.gl.uniform4fv(this.dsLocation,this.ds),this.gl.uniform1f(this.wdivLoc,this.wDiv),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class Ct{constructor(t,e,i,s={}){this.blurLevel=t,this.blurRatios=e,this.gl=i,this.texsizeX=s.texsizeX,this.texsizeY=s.texsizeY,this.anisoExt=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.blurHorizontalFrameBuffer=this.gl.createFramebuffer(),this.blurVerticalFrameBuffer=this.gl.createFramebuffer(),this.blurHorizontalTexture=this.gl.createTexture(),this.blurVerticalTexture=this.gl.createTexture(),this.setupFrameBufferTextures(),this.blurHorizontal=new Lt(i,this.blurLevel,s),this.blurVertical=new Bt(i,this.blurLevel,s)}updateGlobals(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.setupFrameBufferTextures()}getTextureSize(t){let e=Math.max(this.texsizeX*t,16);e=16*Math.floor((e+3)/16);let i=Math.max(this.texsizeY*t,16);return i=4*Math.floor((i+3)/4),[e,i]}setupFrameBufferTextures(){const t=this.blurLevel>0?this.blurRatios[this.blurLevel-1]:[1,1],e=this.blurRatios[this.blurLevel],i=this.getTextureSize(t[1]),s=this.getTextureSize(e[0]);this.bindFrameBufferTexture(this.blurHorizontalFrameBuffer,this.blurHorizontalTexture,s);const r=s,a=this.getTextureSize(e[1]);this.bindFrameBufferTexture(this.blurVerticalFrameBuffer,this.blurVerticalTexture,a),this.horizontalTexsizes=[i,s],this.verticalTexsizes=[r,a]}bindFrambufferAndSetViewport(t,e){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.viewport(0,0,e[0],e[1])}bindFrameBufferTexture(t,e,i){if(this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,i[0],i[1],0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,new Uint8Array(i[0]*i[1]*4)),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_2D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e,0)}renderBlurTexture(t,e,i,s){this.bindFrambufferAndSetViewport(this.blurHorizontalFrameBuffer,this.horizontalTexsizes[1]),this.blurHorizontal.renderQuadTexture(t,e,i,s,this.horizontalTexsizes[0]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.blurHorizontalTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.bindFrambufferAndSetViewport(this.blurVerticalFrameBuffer,this.verticalTexsizes[1]),this.blurVertical.renderQuadTexture(this.blurHorizontalTexture,e,this.verticalTexsizes[0]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.blurVerticalTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D)}}class Ut{constructor(t){this.gl=t,this.randomFn=mt().random,this.anisoExt=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.noiseTexLQ=this.gl.createTexture(),this.noiseTexLQLite=this.gl.createTexture(),this.noiseTexMQ=this.gl.createTexture(),this.noiseTexHQ=this.gl.createTexture(),this.noiseTexVolLQ=this.gl.createTexture(),this.noiseTexVolHQ=this.gl.createTexture(),this.nTexArrLQ=Ut.createNoiseTex(256,1,this.randomFn),this.nTexArrLQLite=Ut.createNoiseTex(32,1,this.randomFn),this.nTexArrMQ=Ut.createNoiseTex(256,4,this.randomFn),this.nTexArrHQ=Ut.createNoiseTex(256,8,this.randomFn),this.nTexArrVolLQ=Ut.createNoiseVolTex(32,1,this.randomFn),this.nTexArrVolHQ=Ut.createNoiseVolTex(32,4,this.randomFn),this.bindTexture(this.noiseTexLQ,this.nTexArrLQ,256,256),this.bindTexture(this.noiseTexLQLite,this.nTexArrLQLite,32,32),this.bindTexture(this.noiseTexMQ,this.nTexArrMQ,256,256),this.bindTexture(this.noiseTexHQ,this.nTexArrHQ,256,256),this.bindTexture3D(this.noiseTexVolLQ,this.nTexArrVolLQ,32,32,32),this.bindTexture3D(this.noiseTexVolHQ,this.nTexArrVolHQ,32,32,32),this.noiseTexPointLQ=this.gl.createSampler(),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_MAG_FILTER,t.NEAREST),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_WRAP_T,t.REPEAT)}bindTexture(t,e,i,s){if(this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,i,s,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_2D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}}bindTexture3D(t,e,i,s,r){if(this.gl.bindTexture(this.gl.TEXTURE_3D,t),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage3D(this.gl.TEXTURE_3D,0,this.gl.RGBA,i,s,r,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.generateMipmap(this.gl.TEXTURE_3D),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_R,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_3D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}}static fCubicInterpolate(t,e,i,s,r){const a=r*r,o=s-i-t+e;return o*(r*a)+(t-e-o)*a+(i-t)*r+e}static dwCubicInterpolate(t,e,i,s,r){const a=[];for(let o=0;o<4;o++){let h=Ut.fCubicInterpolate(t[o]/255,e[o]/255,i[o]/255,s[o]/255,r);h=Math.clamp(h,0,1),a[o]=255*h}return a}static createNoiseVolTex(t,e,i){const s=t*t*t,r=new Uint8Array(4*s),a=e>1?216:256,o=.5*a;for(let t=0;t1){for(let i=0;i1?216:256,o=.5*a;for(let t=0;t1){for(let i=0;i{this.samplers.clouds2=this.gl.createTexture(),this.bindTexture(this.samplers.clouds2,this.clouds2Image,128,128)},this.clouds2Image.src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4RP+RXhpZgAASUkqAAgAAAAJAA8BAgAGAAAAegAAABABAgAVAAAAgAAAABIBAwABAAAAAQAAABoBBQABAAAAoAAAABsBBQABAAAAqAAAACgBAwABAAAAAgAAADIBAgAUAAAAsAAAABMCAwABAAAAAQAAAGmHBAABAAAAxAAAAGYFAABDYW5vbgBDYW5vbiBQb3dlclNob3QgUzExMAAAAAAAAAAAAAAAAEgAAAABAAAASAAAAAEAAAAyMDAyOjAxOjE5IDE3OjMzOjIwABsAmoIFAAEAAABWAwAAnYIFAAEAAABeAwAAAJAHAAQAAAAwMjEwA5ACABQAAAAOAgAABJACABQAAAAiAgAAAZEHAAQAAAABAgMAApEFAAEAAAA+AwAAAZIKAAEAAABGAwAAApIFAAEAAABOAwAABJIKAAEAAABmAwAABZIFAAEAAABuAwAABpIFAAEAAAB2AwAAB5IDAAEAAAAFAAAACZIDAAEAAAAAAAAACpIFAAEAAAB+AwAAfJIHAJoBAACGAwAAhpIHAAgBAAA2AgAAAKAHAAQAAAAwMTAwAaADAAEAAAABAAAAAqAEAAEAAACAAAAAA6AEAAEAAACAAAAABaAEAAEAAAAwBQAADqIFAAEAAAAgBQAAD6IFAAEAAAAoBQAAEKIDAAEAAAACAAAAF6IDAAEAAAACAAAAAKMHAAEAAAADAAAAAAAAADIwMDI6MDE6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kriqrsJWxW0rbVuSr99ANzXLXZ29dSlur+XlS3CdLyvRW1rWsOg55I76MWupyoT6jbvpihtxp8LD4Bj61/RJHoRq8ZmNWFvJWyrcxIjultxP7juNXdEoJouRFqT7rSvqTJXuOffOvaIT6YBJOBxnU9ogpwBjVbTrSDAkxyMc9/5q7NcSOSvbxXtr9r9r920ZqrXhYBSQdQJjQIJx+dTVup7ajSNqknPtqCcAx1lTg5qllPvxcltwj8agSnqpIQSEuqB7nB51dqYjlRLo75BP2xquu+ZckWnoNqw0StqgH2lOYUUeQPzoHM/pRM7E4HYDJ+1EEw7hRxnueB96rabFcqrkmPJa9UNoBLK+x+bng9+NU9woj0+Utb1vtObAMteiR6ae+5I8du+plWqFah0t5VKbEV1xW4uuIO5IA4Bz986z71mvbqpRbmTUaqX429sNhyO4r03BnIWOfIxn8aA3N9CsigDnyen3olFayFDk0665W4Eq1v69HlyC00raWmlBSkKzwSPtwceQdYw+L3rDWLhqggJQ41FiI2RcnBWc/MtQAABJ8eO2tAWXcl2/p3WX3S4pwpVuWySl3I/wD1pQ9erfrM2c+0i3I8sFBcQtMTkI7c7e3PvoZNcPHcCQjj371aiCPGUB5rLNfviqyKYiTU2VrbQdiXHBnIz21CqNq1WpwUzaPDMhtxsLCmkZwD747aOLwgXNHt522avZjQiLWHEEp+dsDcBt9uSM/jVFRLZ6vWBSZF2dNHZSIzzKm5jbRStSRzwUkHgZznHfVxLkyLxgH9DVdo1j6nIpK31QaoylfqMEEDCgBoHl0OU7HVUm2VpS3wpvGc8d9ak6WVGL1IdnW51Ht6NMmuO+ozMGGHMEYKSBhJAPIOO5OfGqC//h1doNVcnUOnThGUopKS0HAoc9iO/wDHjUqak0bGNxz+lQtbK3xrX//Z",this.emptyImage=new Image,this.emptyImage.onload=()=>{this.samplers.empty=this.gl.createTexture(),this.bindTexture(this.samplers.empty,this.emptyImage,1,1)},this.emptyImage.src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="}bindTexture(t,e,i,s){if(this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,i,s,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_2D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}}loadExtraImages(t){Object.keys(t).forEach(e=>{const{data:i,width:s,height:r}=t[e];if(!this.samplers[e]){const t=new Image;t.onload=()=>{this.samplers[e]=this.gl.createTexture(),this.bindTexture(this.samplers[e],t,s,r)},t.src=i}})}getTexture(t){const e=this.samplers[t];return e||this.samplers.clouds2}}class Ft{constructor(t,e={}){this.gl=t,this.texsizeX=e.texsizeX,this.texsizeY=e.texsizeY,this.aspectx=e.aspectx,this.aspecty=e.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.buildPositions(),this.textTexture=this.gl.createTexture(),this.indexBuf=t.createBuffer(),this.positionVertexBuf=this.gl.createBuffer(),this.vertexBuf=this.gl.createBuffer(),this.canvas=document.createElement("canvas"),this.canvas.width=this.texsizeX,this.canvas.height=this.texsizeY,this.context2D=this.canvas.getContext("2d",{willReadFrequently:!1}),this.floatPrecision=_t.getFragmentFloatPrecision(this.gl),this.createShader()}generateTitleTexture(t){this.context2D.clearRect(0,0,this.texsizeX,this.texsizeY),this.fontSize=Math.floor(this.texsizeX/256*16),this.fontSize=Math.max(this.fontSize,6),this.context2D.font=`italic ${this.fontSize}px Times New Roman`;let e=t,i=this.context2D.measureText(e).width;if(i>this.texsizeX){const t=this.texsizeX/i*.91;e=`${e.substring(0,Math.floor(e.length*t))}...`,i=this.context2D.measureText(e).width}this.context2D.fillStyle="#FFFFFF",this.context2D.fillText(e,(this.texsizeX-i)/2,this.texsizeY/2);const s=new Uint8Array(this.context2D.getImageData(0,0,this.texsizeX,this.texsizeY).data.buffer);this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.textTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.texsizeX,this.texsizeY,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.bindTexture(this.gl.TEXTURE_2D,null)}updateGlobals(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.aspectx=t.aspectx,this.aspecty=t.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.canvas.width=this.texsizeX,this.canvas.height=this.texsizeY}buildPositions(){const t=2/15,e=2/7,i=[];for(let s=0;s<8;s++){const r=s*e-1;for(let e=0;e<16;e++){const s=e*t-1;i.push(s,-r,0)}}const s=[];for(let t=0;t<7;t++)for(let e=0;e<15;e++){const i=e+16*t,r=e+16*(t+1),a=e+1+16*(t+1),o=e+1+16*t;s.push(i,r,o),s.push(r,a,o)}this.vertices=new Float32Array(i),this.indices=new Uint16Array(s)}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"#version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n in vec2 aUv;\n out vec2 uv_orig;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv_orig = aPos * halfmad + halfmad;\n uv = aUv;\n }"),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv_orig;\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n uniform float textColor;\n\n void main(void) {\n fragColor = texture(uTexture, uv) * vec4(textColor);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.uvLocation=this.gl.getAttribLocation(this.shaderProgram,"aUv"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.textColorLoc=this.gl.getUniformLocation(this.shaderProgram,"textColor")}generateUvs(t,e,i){const s=[];for(let i=0;i<8;i++)for(let r=0;r<16;r++){const a=2*(r/15)-1;let o=2*(.75*(i/7-.5)+.5)-1;t>=1&&(o+=1/this.texsizeY),s.push(a,e?o:-o)}const r=Math.max(0,1-1.5*t)**1.8*1.3;for(let t=0;t<8;t++)for(let e=0;e<16;e++){const a=16*t+e;s[a]+=.07*r*Math.sin(.31*i.time+.39*s[a]-1.94*s[a+1]),s[a]+=.044*r*Math.sin(.81*i.time-1.91*s[a]+.27*s[a+1]),s[a]+=.061*r*Math.sin(1.31*i.time+.61*s[a]+.74*s[a+1]),s[a+1]+=.061*r*Math.sin(.37*i.time+1.83*s[a]+.69*s[a+1]),s[a+1]+=.07*r*Math.sin(.67*i.time+.42*s[a]-1.39*s[a+1]),s[a+1]+=.087*r*Math.sin(1.07*i.time+3.55*s[a]+.89*s[a+1])}const a=1.01/(t**.21+.01);for(let t=0;t=2&&(0===t&&(this.vertInfoC[o*(this.mesh_width+1)+t]=.5*(h+n)+(2*this.rng.random()-1)*r*this.aspecty),this.vertInfoC[o*(this.mesh_width+1)+e]=.5*(A+l)+(2*this.rng.random()-1)*r*this.aspecty),e-t>=2&&(0===i&&(this.vertInfoC[i*(this.mesh_width+1)+a]=.5*(h+A)+(2*this.rng.random()-1)*r*this.aspectx),this.vertInfoC[s*(this.mesh_width+1)+a]=.5*(n+l)+(2*this.rng.random()-1)*r*this.aspectx),s-i>=2&&e-t>=2&&(h=this.vertInfoC[o*(this.mesh_width+1)+t],A=this.vertInfoC[o*(this.mesh_width+1)+e],n=this.vertInfoC[i*(this.mesh_width+1)+a],l=this.vertInfoC[s*(this.mesh_width+1)+a],this.vertInfoC[o*(this.mesh_width+1)+a]=.25*(n+l+h+A)+(2*this.rng.random()-1)*r,this.genPlasma(t,a,i,o,.5*r),this.genPlasma(a,e,i,o,.5*r),this.genPlasma(t,a,o,s,.5*r),this.genPlasma(a,e,o,s,.5*r))}createBlendPattern(){const t=1+Math.floor(3*this.rng.random());if(0===t){let t=0;for(let e=0;e<=this.mesh_height;e++)for(let e=0;e<=this.mesh_width;e++)this.vertInfoA[t]=1,this.vertInfoC[t]=0,t+=1}else if(1===t){const t=6.28*this.rng.random(),e=Math.cos(t),i=Math.sin(t),s=.1+.2*this.rng.random(),r=1/s;let a=0;for(let t=0;t<=this.mesh_height;t++){const o=t/this.mesh_height*this.aspecty;for(let t=0;t<=this.mesh_width;t++){let h=(t/this.mesh_width*this.aspectx-.5)*e+(o-.5)*i+.5;h=(h-.5)/Math.sqrt(2)+.5,this.vertInfoA[a]=r*(1+s),this.vertInfoC[a]=r*h-r,a+=1}}}else if(2===t){const t=.12+.13*this.rng.random(),e=1/t;this.vertInfoC[0]=this.rng.random(),this.vertInfoC[this.mesh_width]=this.rng.random(),this.vertInfoC[this.mesh_height*(this.mesh_width+1)]=this.rng.random(),this.vertInfoC[this.mesh_height*(this.mesh_width+1)+this.mesh_width]=this.rng.random(),this.genPlasma(0,this.mesh_width,0,this.mesh_height,.25);let i=this.vertInfoC[0],s=this.vertInfoC[0],r=0;for(let t=0;t<=this.mesh_height;t++)for(let t=0;t<=this.mesh_width;t++)i>this.vertInfoC[r]&&(i=this.vertInfoC[r]),sthis.texsizeX?this.texsizeX/this.texsizeY:1,this.aspecty=this.texsizeX>this.texsizeY?this.texsizeY/this.texsizeX:1,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.qs=At.range(1,33).map(t=>`q${t}`),this.ts=At.range(1,9).map(t=>`t${t}`),this.regs=At.range(0,100).map(t=>t<10?`reg0${t}`:`reg${t}`),this.blurRatios=[[.5,.25],[.125,.125],[.0625,.0625]],this.audioLevels=new ot(this.audio),this.prevFrameBuffer=this.gl.createFramebuffer(),this.targetFrameBuffer=this.gl.createFramebuffer(),this.prevTexture=this.gl.createTexture(),this.targetTexture=this.gl.createTexture(),this.compFrameBuffer=this.gl.createFramebuffer(),this.compTexture=this.gl.createTexture(),this.anisoExt=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.bindFrameBufferTexture(this.prevFrameBuffer,this.prevTexture),this.bindFrameBufferTexture(this.targetFrameBuffer,this.targetTexture),this.bindFrameBufferTexture(this.compFrameBuffer,this.compTexture);const s={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};this.noise=new Ut(t),this.image=new Mt(t),this.warpShader=new wt(t,this.noise,this.image,s),this.compShader=new It(t,this.noise,this.image,s),this.outputShader=new Rt(t,s),this.prevWarpShader=new wt(t,this.noise,this.image,s),this.prevCompShader=new It(t,this.noise,this.image,s),this.numBlurPasses=0,this.blurShader1=new Ct(0,this.blurRatios,t,s),this.blurShader2=new Ct(1,this.blurRatios,t,s),this.blurShader3=new Ct(2,this.blurRatios,t,s),this.blurTexture1=this.blurShader1.blurVerticalTexture,this.blurTexture2=this.blurShader2.blurVerticalTexture,this.blurTexture3=this.blurShader3.blurVerticalTexture,this.basicWaveform=new bt(t,s),this.customWaveforms=At.range(4).map(e=>new xt(e,t,s)),this.customShapes=At.range(4).map(e=>new vt(e,t,s)),this.prevCustomWaveforms=At.range(4).map(e=>new xt(e,t,s)),this.prevCustomShapes=At.range(4).map(e=>new vt(e,t,s)),this.darkenCenter=new St(t,s),this.innerBorder=new Tt(t,s),this.outerBorder=new Tt(t,s),this.motionVectors=new Pt(t,s),this.titleText=new Ft(t,s),this.blendPattern=new Qt(s),this.resampleShader=new yt(t),this.supertext={startTime:-1},this.warpUVs=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*2),this.warpColor=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*4),this.gl.clearColor(0,0,0,1),this.blankPreset=ht;const r={frame:0,time:0,fps:45,bass:1,bass_att:1,mid:1,mid_att:1,treb:1,treb_att:1};this.preset=ht,this.prevPreset=this.preset,this.presetEquationRunner=new ut(this.preset,r,s),this.prevPresetEquationRunner=new ut(this.prevPreset,r,s),this.preset.useWASM||(this.regVars=this.presetEquationRunner.mdVSRegs)}static getHighestBlur(t){return/sampler_blur3/.test(t)?3:/sampler_blur2/.test(t)?2:/sampler_blur1/.test(t)?1:0}loadPreset(t,e){this.blendPattern.createBlendPattern(),this.blending=!0,this.blendStartTime=this.time,this.blendDuration=e,this.blendProgress=0,this.prevPresetEquationRunner=this.presetEquationRunner,this.prevPreset=this.preset,this.preset=t,this.presetTime=this.time;const i={frame:this.frameNum,time:this.time,fps:this.fps,bass:this.audioLevels.bass,bass_att:this.audioLevels.bass_att,mid:this.audioLevels.mid,mid_att:this.audioLevels.mid_att,treb:this.audioLevels.treb,treb_att:this.audioLevels.treb_att},s={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};t.useWASM?(this.preset.globalPools.perFrame.old_wave_mode.value=this.prevPreset.baseVals.wave_mode,this.preset.baseVals.old_wave_mode=this.prevPreset.baseVals.wave_mode,this.presetEquationRunner=new ft(this.preset,i,s),this.preset.pixel_eqs_initialize_array&&this.preset.pixel_eqs_initialize_array(this.mesh_width,this.mesh_height)):(this.preset.baseVals.old_wave_mode=this.prevPreset.baseVals.wave_mode,this.presetEquationRunner=new ut(this.preset,i,s),this.regVars=this.presetEquationRunner.mdVSRegs);const r=this.prevWarpShader;this.prevWarpShader=this.warpShader,this.warpShader=r;const a=this.prevCompShader;this.prevCompShader=this.compShader,this.compShader=a;const o=this.preset.warp.trim(),h=this.preset.comp.trim();this.warpShader.updateShader(o),this.compShader.updateShader(h),0===o.length?this.numBlurPasses=0:this.numBlurPasses=Vt.getHighestBlur(o),0!==h.length&&(this.numBlurPasses=Math.max(this.numBlurPasses,Vt.getHighestBlur(h)))}loadExtraImages(t){this.image.loadExtraImages(t)}setRendererSize(t,e,i){const s=this.texsizeX,r=this.texsizeY;if(this.width=t,this.height=e,this.mesh_width=i.meshWidth||this.mesh_width,this.mesh_height=i.meshHeight||this.mesh_height,this.pixelRatio=i.pixelRatio||this.pixelRatio,this.textureRatio=i.textureRatio||this.textureRatio,this.texsizeX=t*this.pixelRatio*this.textureRatio,this.texsizeY=e*this.pixelRatio*this.textureRatio,this.aspectx=this.texsizeY>this.texsizeX?this.texsizeX/this.texsizeY:1,this.aspecty=this.texsizeX>this.texsizeY?this.texsizeY/this.texsizeX:1,this.texsizeX!==s||this.texsizeY!==r){const t=this.gl.createTexture();this.bindFrameBufferTexture(this.targetFrameBuffer,t),this.bindFrambufferAndSetViewport(this.targetFrameBuffer,this.texsizeX,this.texsizeY),this.resampleShader.renderQuadTexture(this.targetTexture),this.targetTexture=t,this.bindFrameBufferTexture(this.prevFrameBuffer,this.prevTexture),this.bindFrameBufferTexture(this.compFrameBuffer,this.compTexture)}this.updateGlobals(),this.frameNum>0&&this.renderToScreen()}setInternalMeshSize(t,e){this.mesh_width=t,this.mesh_height=e,this.updateGlobals()}setOutputAA(t){this.outputFXAA=t}updateGlobals(){const t={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};this.presetEquationRunner.updateGlobals(t),this.prevPresetEquationRunner.updateGlobals(t),this.warpShader.updateGlobals(t),this.prevWarpShader.updateGlobals(t),this.compShader.updateGlobals(t),this.prevCompShader.updateGlobals(t),this.outputShader.updateGlobals(t),this.blurShader1.updateGlobals(t),this.blurShader2.updateGlobals(t),this.blurShader3.updateGlobals(t),this.basicWaveform.updateGlobals(t),this.customWaveforms.forEach(e=>e.updateGlobals(t)),this.customShapes.forEach(e=>e.updateGlobals(t)),this.prevCustomWaveforms.forEach(e=>e.updateGlobals(t)),this.prevCustomShapes.forEach(e=>e.updateGlobals(t)),this.darkenCenter.updateGlobals(t),this.innerBorder.updateGlobals(t),this.outerBorder.updateGlobals(t),this.motionVectors.updateGlobals(t),this.titleText.updateGlobals(t),this.blendPattern.updateGlobals(t),this.warpUVs=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*2),this.warpColor=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*4),this.preset.pixel_eqs_initialize_array&&this.preset.pixel_eqs_initialize_array(this.mesh_width,this.mesh_height)}calcTimeAndFPS(t){let e;if(t)e=t;else{const t=performance.now();e=(t-this.lastTime)/1e3,(e>1||e<0||this.frame<2)&&(e=1/30),this.lastTime=t}this.time+=1/this.fps,this.blending&&(this.blendProgress=(this.time-this.blendStartTime)/this.blendDuration,this.blendProgress>1&&(this.blending=!1));const i=this.timeHist[this.timeHist.length-1]+e;this.timeHist.push(i),this.timeHist.length>this.timeHistMax&&this.timeHist.shift();const s=this.timeHist.length/(i-this.timeHist[0]);if(Math.abs(s-this.fps)>3&&this.frame>this.timeHistMax)this.fps=s;else{const t=.93;this.fps=t*this.fps+(1-t)*s}}runPixelEquations(t,e,i,s){const r=this.mesh_width,a=this.mesh_height,o=r+1,h=a+1,A=this.time*e.warpanimspeed,n=1/e.warpscale,l=11.68+4*Math.cos(1.413*A+10),c=8.77+3*Math.cos(1.113*A+7),g=10.54+3*Math.cos(1.233*A+3),m=11.49+4*Math.cos(.933*A+5),u=0/this.texsizeX,f=0/this.texsizeY,d=this.aspectx,p=this.aspecty;let _=0,E=0;if(t.preset.useWASM){const r=t.preset.globalPools.perVertex;if(At.setWasm(r,i,t.globalKeys),At.setWasm(r,t.mdVSQAfterFrame,t.qs),r.zoom.value=e.zoom,r.zoomexp.value=e.zoomexp,r.rot.value=e.rot,r.warp.value=e.warp,r.cx.value=e.cx,r.cy.value=e.cy,r.dx.value=e.dx,r.dy.value=e.dy,r.sx.value=e.sx,r.sy.value=e.sy,t.preset.pixel_eqs_wasm(t.runVertEQs,this.mesh_width,this.mesh_height,this.time,e.warpanimspeed,e.warpscale,this.aspectx,this.aspecty),s){const e=t.preset.pixel_eqs_get_array();let i=0,s=0;for(let t=0;t0&&(this.blurShader1.renderBlurTexture(this.targetTexture,r,A,n),this.numBlurPasses>1&&(this.blurShader2.renderBlurTexture(this.blurTexture1,r,A,n),this.numBlurPasses>2&&this.blurShader3.renderBlurTexture(this.blurTexture2,r,A,n)),this.bindFrambufferAndSetViewport(this.targetFrameBuffer,this.texsizeX,this.texsizeY)),this.motionVectors.drawMotionVectors(a,this.warpUVs),this.preset.shapes&&this.preset.shapes.length>0&&this.customShapes.forEach((t,e)=>{t.drawCustomShape(this.blending?this.blendProgress:1,i,this.presetEquationRunner,this.preset.shapes[e],this.prevTexture)}),this.preset.waves&&this.preset.waves.length>0&&this.customWaveforms.forEach((t,e)=>{t.drawCustomWaveform(this.blending?this.blendProgress:1,this.audio.timeArrayL,this.audio.timeArrayR,this.audio.freqArrayL,this.audio.freqArrayR,i,this.presetEquationRunner,this.preset.waves[e])}),this.blending&&(this.prevPreset.shapes&&this.prevPreset.shapes.length>0&&this.prevCustomShapes.forEach((t,e)=>{t.drawCustomShape(1-this.blendProgress,s,this.prevPresetEquationRunner,this.prevPreset.shapes[e],this.prevTexture)}),this.prevPreset.waves&&this.prevPreset.waves.length>0&&this.prevCustomWaveforms.forEach((t,e)=>{t.drawCustomWaveform(1-this.blendProgress,this.audio.timeArrayL,this.audio.timeArrayR,this.audio.freqArrayL,this.audio.freqArrayR,s,this.prevPresetEquationRunner,this.prevPreset.waves[e])})),this.basicWaveform.drawBasicWaveform(this.blending,this.blendProgress,this.audio.timeArrayL,this.audio.timeArrayR,a),this.darkenCenter.drawDarkenCenter(a);const l=[a.ob_r,a.ob_g,a.ob_b,a.ob_a];this.outerBorder.drawBorder(l,a.ob_size,0);const c=[a.ib_r,a.ib_g,a.ib_b,a.ib_a];if(this.innerBorder.drawBorder(c,a.ib_size,a.ob_size),this.supertext.startTime>=0){const t=(this.time-this.supertext.startTime)/this.supertext.duration;t>=1&&this.titleText.renderTitle(t,!0,i)}this.globalVars=i,this.mdVSFrame=r,this.mdVSFrameMixed=a,this.renderToScreen()}renderToScreen(){this.outputFXAA?this.bindFrambufferAndSetViewport(this.compFrameBuffer,this.texsizeX,this.texsizeY):this.bindFrambufferAndSetViewport(null,this.width,this.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.enable(this.gl.BLEND),this.gl.blendEquation(this.gl.FUNC_ADD),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA);const{blurMins:t,blurMaxs:e}=Vt.getBlurValues(this.mdVSFrameMixed);if(this.blending?(this.prevCompShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,t,e,this.prevMDVSFrame,this.prevPresetEquationRunner.mdVSQAfterFrame,this.warpColor),this.compShader.renderQuadTexture(!0,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,t,e,this.mdVSFrameMixed,this.presetEquationRunner.mdVSQAfterFrame,this.warpColor)):this.compShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,t,e,this.mdVSFrame,this.presetEquationRunner.mdVSQAfterFrame,this.warpColor),this.supertext.startTime>=0){const t=(this.time-this.supertext.startTime)/this.supertext.duration;this.titleText.renderTitle(t,!1,this.globalVars),t>=1&&(this.supertext.startTime=-1)}this.outputFXAA&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.compTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.bindFrambufferAndSetViewport(null,this.width,this.height),this.outputShader.renderQuadTexture(this.compTexture))}launchSongTitleAnim(t){this.supertext={startTime:this.time,duration:1.7},this.titleText.generateTitleTexture(t)}toDataURL(){const t=new Uint8Array(this.texsizeX*this.texsizeY*4),e=this.gl.createFramebuffer(),i=this.gl.createTexture();this.bindFrameBufferTexture(e,i);const{blurMins:s,blurMaxs:r}=Vt.getBlurValues(this.mdVSFrameMixed);this.compShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,s,r,this.mdVSFrame,this.presetEquationRunner.mdVSQAfterFrame,this.warpColor),this.gl.readPixels(0,0,this.texsizeX,this.texsizeY,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Array.from({length:this.texsizeY},(e,i)=>t.slice(i*this.texsizeX*4,(i+1)*this.texsizeX*4)).forEach((e,i)=>t.set(e,(this.texsizeY-i-1)*this.texsizeX*4));const a=document.createElement("canvas");a.width=this.texsizeX,a.height=this.texsizeY;const o=a.getContext("2d",{willReadFrequently:!1}),h=o.createImageData(this.texsizeX,this.texsizeY);return h.data.set(t),o.putImageData(h,0,0),this.gl.deleteTexture(i),this.gl.deleteFramebuffer(e),a.toDataURL()}warpBufferToDataURL(){const t=new Uint8Array(this.texsizeX*this.texsizeY*4);this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.targetFrameBuffer),this.gl.readPixels(0,0,this.texsizeX,this.texsizeY,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t);const e=document.createElement("canvas");e.width=this.texsizeX,e.height=this.texsizeY;const i=e.getContext("2d",{willReadFrequently:!1}),s=i.createImageData(this.texsizeX,this.texsizeY);return s.data.set(t),i.putImageData(s,0,0),e.toDataURL()}}class Dt{constructor(t,e,i){this.opts=i,this.rng=gt(i),this.deterministicMode=i.deterministic||i.testMode,this.audio=new at(t);const s=i.width||1200,r=i.height||900;window.OffscreenCanvas?this.internalCanvas=new OffscreenCanvas(s,r):(this.internalCanvas=document.createElement("canvas"),this.internalCanvas.width=s,this.internalCanvas.height=r),this.gl=this.internalCanvas.getContext("webgl2",{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1}),this.outputGl=e.getContext("2d",{willReadFrequently:!1}),this.baseValsDefaults={decay:.98,gammaadj:2,echo_zoom:2,echo_alpha:0,echo_orient:0,red_blue:0,brighten:0,darken:0,wrap:1,darken_center:0,solarize:0,invert:0,bmotionvectorson:1,fshader:0,b1n:0,b2n:0,b3n:0,b1x:1,b2x:1,b3x:1,b1ed:.25,wave_mode:0,additivewave:0,wave_dots:0,wave_thick:0,wave_a:.8,wave_scale:1,wave_smoothing:.75,wave_mystery:0,modwavealphabyvolume:0,modwavealphastart:.75,modwavealphaend:.95,wave_r:1,wave_g:1,wave_b:1,wave_x:.5,wave_y:.5,wave_brighten:1,mv_x:12,mv_y:9,mv_dx:0,mv_dy:0,mv_l:.9,mv_r:1,mv_g:1,mv_b:1,mv_a:1,warpanimspeed:1,warpscale:1,zoomexp:1,zoom:1,rot:0,cx:.5,cy:.5,dx:0,dy:0,warp:1,sx:1,sy:1,ob_size:.01,ob_r:0,ob_g:0,ob_b:0,ob_a:0,ib_size:.01,ib_r:.25,ib_g:.25,ib_b:.25,ib_a:0},this.shapeBaseValsDefaults={enabled:0,sides:4,additive:0,thickoutline:0,textured:0,num_inst:1,tex_zoom:1,tex_ang:0,x:.5,y:.5,rad:.1,ang:0,r:1,g:0,b:0,a:1,r2:0,g2:1,b2:0,a2:0,border_r:1,border_g:1,border_b:1,border_a:.1},this.waveBaseValsDefaults={enabled:0,samples:512,sep:0,scaling:1,smoothing:.5,r:1,g:1,b:1,a:1,spectrum:0,usedots:0,thick:0,additive:0},this.qs=At.range(1,33).map(t=>`q${t}`),this.ts=At.range(1,9).map(t=>`t${t}`),this.globalPerFrameVars=["old_wave_mode","frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset"],this.globalPerPixelVars=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset","x","y","rad","ang"],this.globalShapeVars=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset","instance"],this.shapeBaseVars=["x","y","rad","ang","r","g","b","a","r2","g2","b2","a2","border_r","border_g","border_b","border_a","thickoutline","textured","tex_zoom","tex_ang","additive"],this.globalWaveVars=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset","x","y","sample","value1","value2"],this.renderer=new Vt(this.gl,this.audio,i)}loseGLContext(){this.gl.getExtension("WEBGL_lose_context").loseContext(),this.outputGl=null}connectAudio(t){this.audioNode=t,this.audio.connectAudio(t)}disconnectAudio(t){this.audio.disconnectAudio(t)}static overrideDefaultVars(t,e){const i={};return Object.keys(t).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)?i[s]=e[s]:i[s]=t[s]}),i}createQVars(){const t={};return this.qs.forEach(e=>{t[e]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),t}createTVars(){const t={};return this.ts.forEach(e=>{t[e]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),t}createPerFramePool(t){const e={};return Object.keys(this.baseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalPerFrameVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}createPerPixelPool(t){const e={};return Object.keys(this.baseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalPerPixelVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}createCustomShapePerFramePool(t){const e={};return Object.keys(this.shapeBaseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalShapeVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}createCustomWavePerFramePool(t){const e={};return Object.keys(this.waveBaseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalWaveVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}static makeShapeResetPool(t,e,i){return e.reduce((e,s)=>({...e,[`${s}_${i}`]:t[s]}),{})}static base64ToArrayBuffer(t){for(var e=window.atob(t),i=e.length,s=new Uint8Array(i),r=0;rt||(()=>{}),A=await st.instantiate(Dt.base64ToArrayBuffer("AGFzbQEAAAABPQpgAABgAXwBfGACfHwBfGACf38AYAR/f39/AGAJf39/f3x8fHx8AGADf399AGABfwF/YAJ/fwF/YAF+AX8CuBWMAQNlbnYFYWJvcnQABAhwaXhlbEVxcwtwZXJQaXhlbEVxcwAADHBpeGVsVmFyUG9vbAR3YXJwA3wBDHBpeGVsVmFyUG9vb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AAsLCyACJJACIAYgBzYCACAEQQRrIgJBADYCBCACQQA2AgggAiABNgIMIAIgADYCECAEQRBqC7sCAQF/AkAgAUUNACAAQQA6AAAgACABakEEayICQQA6AAMgAUECTQ0AIABBADoAASAAQQA6AAIgAkEAOgACIAJBADoAASABQQZNDQAgAEEAOgADIAJBADoAACABQQhNDQAgAEEAIABrQQNxIgJqIgBBADYCACAAIAEgAmtBfHEiAmpBHGsiAUEANgIYIAJBCE0NACAAQQA2AgQgAEEANgIIIAFBADYCECABQQA2AhQgAkEYTQ0AIABBADYCDCAAQQA2AhAgAEEANgIUIABBADYCGCABQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgwgACAAQQRxQRhqIgFqIQAgAiABayEBA0AgAUEgTwRAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCABQSBrIQEgAEEgaiEADAELCwsLdwECfwJ/QQxBAxACIgFFBEBBDEECEAIhAQsgAQtBADYCACABQQA2AgQgAUEANgIIIABB/////wBLBEBBoAhB0AhBEkE5EAAACyAAQQJ0IgBBABACIgIgABADIAEoAgAaIAEgAjYCACABIAI2AgQgASAANgIIIAELuwQDAX8KfgF8IABC////////////AINCNIhClQh9IgVCBoenQQN0QYAJaiIBKQMAIQcgASkDCCEEIAEpAxAhAiAFQj+DIgVCAFIEQAJ+IAcgBYYgBELAACAFfSIDiIQhByAEIAWGIAIgA4iEIQQgAiAFhiABKQMYIAOIhAshAgsgAEL/////////B4NCgICAgICAgAiEIgVC/////w+DIgMgBEIgiCIIfiAEQv////8PgyIGIAN+IglCIIh8IQQgBiAFQiCIIgZ+IARC/////w+DfCEDIAYgCH4gBEIgiHwgA0IgiHwkkwIgBUIghyACQiCIfiIEIAlC/////w+DIANCIIZ8fCECIAIgBFStI5MCIAUgB358fCIIQgKGIAJCPoiEIgdCP4ciBUIBhyAHhSIDeSEEIAMgBIYgBSACQgKGhSIGQsAAIAR9iIQiAkL/////D4MhAyACQiCIIglCtISjiwJ+IANCorW/yAx+IANCtISjiw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FASOMAiSGASONAiSHASOOAiSIASOPAiSJAQsIAEHMCiSQAgsLvAIDAEGMCAsvLAAAAAEAAAAAAAAAAQAAABwAAABJAG4AdgBhAGwAaQBkACAAbABlAG4AZwB0AGgAQbwICzk8AAAAAQAAAAAAAAABAAAAJgAAAH4AbABpAGIALwBhAHIAcgBhAHkAYgB1AGYAZgBlAHIALgB0AHMAQYAJC8ABboP5ogAAAADRVyf8KRVETpmVYtvA3TT1q2NR/kGQQzw6biS3YcW73uouSQbg0k1CHOsd/hyS0Qn1NYLoPqcpsSZwnOmERLsuOdaROUF+X7SLX4Sc9DlTg/+X+B87KPm9ixEv7w+YBd7PfjZtH20KWmY/Rk+3Ccsnx7ondS3qX573OQc9e/Hl67Ff+2vqklKKRjADVghdjR8gvM/wq2t7/GGR46kdNvSaX4WZZQgb5l6A2P+NQGigFFcVBgYxJ3NN"),{pixelEqs:{perPixelEqs:h(o.exports.perPixel)},pixelVarPool:{warp:r.perVertex.warp,zoom:r.perVertex.zoom,zoomexp:r.perVertex.zoomexp,cx:r.perVertex.cx,cy:r.perVertex.cy,sx:r.perVertex.sx,sy:r.perVertex.sy,dx:r.perVertex.dx,dy:r.perVertex.dy,rot:r.perVertex.rot,x:r.perVertex.x,y:r.perVertex.y,ang:r.perVertex.ang,rad:r.perVertex.rad},qVarPool:i,tVarPool:s,shapePool0:Dt.makeShapeResetPool(r.shapePerFrame0,this.shapeBaseVars,0),shapePool1:Dt.makeShapeResetPool(r.shapePerFrame1,this.shapeBaseVars,1),shapePool2:Dt.makeShapeResetPool(r.shapePerFrame2,this.shapeBaseVars,2),shapePool3:Dt.makeShapeResetPool(r.shapePerFrame3,this.shapeBaseVars,3),console:{logi:t=>{console.log("logi: "+t)},logf:t=>{console.log("logf: "+t)}},env:{abort:()=>{}}});t.globalPools=r,t.init_eqs=h(o.exports.presetInit),t.frame_eqs=h(o.exports.perFrame),t.save_qs=A.exports.saveQs,t.restore_qs=A.exports.restoreQs,t.save_ts=A.exports.saveTs,t.restore_ts=A.exports.restoreTs,o.exports.perPixel&&(t.pixel_eqs=o.exports.perPixel),t.pixel_eqs_initialize_array=(e,i)=>{const s=A.exports.createFloat32Array((e+1)*(i+1)*2);t.pixel_eqs_array=s},t.pixel_eqs_get_array=()=>A.exports.__getFloat32ArrayView(t.pixel_eqs_array),t.pixel_eqs_wasm=(...e)=>A.exports.runPixelEquations(t.pixel_eqs_array,...e);for(let e=0;eA.exports[`shape${e}_save`](),t.shapes[e].frame_eqs_restore=()=>A.exports[`shape${e}_restore`]());for(let e=0;e{var i="function"==typeof e,s="function"==typeof e,r="function"==typeof e;Object.defineProperty(Math,t,{configurable:i,enumerable:r,writable:s,value:e})};t("DEG_PER_RAD",Math.PI/180),t("RAD_PER_DEG",180/Math.PI);const e=new Float32Array(1);t("scale",function(t,e,i,s,r){return 0===arguments.length||Number.isNaN(t)||Number.isNaN(e)||Number.isNaN(i)||Number.isNaN(s)||Number.isNaN(r)?NaN:t===1/0||t===-1/0?t:(t-e)*(r-s)/(i-e)+s}),t("fscale",function(t,i,s,r,a){return e[0]=Math.scale(t,i,s,r,a),e[0]}),t("clamp",function(t,e,i){return Math.min(i,Math.max(e,t))}),t("radians",function(t){return t*Math.DEG_PER_RAD}),t("degrees",function(t){return t*Math.RAD_PER_DEG})}var t=1e-5;function e(t,e){let i={destCol:1,srcCol:1,srcLine:1};t.forEach(t=>{t.destCol>e||(i=t)});const s=e-i.destCol;return{column:i.srcCol+s,line:i.srcLine}}window.sqr=function(t){return t*t},window.sqrt=function(t){return Math.sqrt(Math.abs(t))},window.log10=function(t){return Math.log(t)*Math.LOG10E},window.sign=function(t){return t>0?1:t<0?-1:0},window.rand=function(t){var e=Math.floor(t);return e<1?Math.random():Math.random()*e},window.randint=function(t){return Math.floor(rand(t))},window.bnot=function(e){return Math.abs(e)t?1/s:0},window.bor=function(e,i){return Math.abs(e)>t||Math.abs(i)>t?1:0},window.band=function(e,i){return Math.abs(e)>t&&Math.abs(i)>t?1:0},window.equal=function(e,i){return Math.abs(e-i)e?1:0},window.below=function(t,e){return tt?i:s},window.memcpy=function(t,e,i,s){let r=e,a=i,o=s;return a<0&&(o+=a,r-=a,a=0),r<0&&(o+=r,a-=r,r=0),o>0&&t.copyWithin(r,a,o),e};var i=function(){var t=function(t,e,i,s){for(i=i||{},s=t.length;s--;i[t[s]]=e);return i},e=[1,18],i=[1,7],s=[1,19],r=[1,20],a=[1,14],o=[1,15],h=[1,16],A=[1,33],n=[1,31],l=[1,23],g=[1,22],c=[1,24],m=[1,25],u=[1,26],f=[1,27],d=[1,28],p=[1,29],E=[1,30],_=[5,8,15,18,20,28,29,32,33,34,35,36,37,38],b=[5,15,18],x=[5,12,15,17,18,24,25,28,29,30],v=[1,57],T=[5,8,12,15,17,18,24,25,28,29,30],w=[15,18],S=[5,8,15,18,28,29,38],P=[5,8,15,18,28,29,32,33,38],R=[5,8,15,18,28,29,32,33,34,37,38],I=[5,8,15,18,28,29,32,33,34,35,36,37,38],y=[5,8,15,18],B=[5,8,15,18,20,22,28,29,32,33,34,35,36,37,38],L={trace:function(){},yy:{},symbols_:{error:2,SCRIPT:3,expression:4,EOF:5,expressionsOptionalTrailingSemi:6,separator:7,";":8,expressions:9,EXPRESSION_BLOCK:10,IDENTIFIER:11,IDENTIFIER_TOKEN:12,argument:13,arguments:14,",":15,FUNCTION_CALL:16,"(":17,")":18,LOGICAL_EXPRESSION:19,LOGICAL_OPERATOR_TOKEN:20,ASSIGNMENT:21,ASSIGNMENT_OPERATOR_TOKEN:22,number:23,DIGITS_TOKEN:24,".":25,NUMBER_LITERAL:26,UNARY_EXPRESSION:27,"-":28,"+":29,"!":30,BINARY_EXPRESSION:31,"*":32,"/":33,"%":34,"&":35,"|":36,"^":37,COMPARISON_TOKEN:38,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:";",12:"IDENTIFIER_TOKEN",15:",",17:"(",18:")",20:"LOGICAL_OPERATOR_TOKEN",22:"ASSIGNMENT_OPERATOR_TOKEN",24:"DIGITS_TOKEN",25:".",28:"-",29:"+",30:"!",32:"*",33:"/",34:"%",35:"&",36:"|",37:"^",38:"COMPARISON_TOKEN"},productions_:[0,[3,2],[3,2],[3,1],[7,1],[7,2],[9,2],[9,3],[6,1],[6,2],[10,1],[11,1],[13,1],[13,1],[14,1],[14,3],[16,3],[16,4],[19,3],[21,3],[21,3],[23,1],[23,2],[23,3],[23,2],[23,1],[26,1],[27,2],[27,2],[27,2],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[31,3],[4,1],[4,1],[4,3],[4,1],[4,1],[4,1],[4,1],[4,1],[4,3]],performAction:function(t,e,i,s,r,a,o){var h=a.length-1;switch(r){case 1:return{type:"SCRIPT",body:[a[h-1]],loc:this._$};case 2:return{type:"SCRIPT",body:a[h-1],loc:this._$};case 3:return{type:"SCRIPT",body:[],loc:this._$};case 6:this.$=[a[h-1]];break;case 7:this.$=a[h-2].concat([a[h-1]]);break;case 8:this.$=a[h];break;case 9:this.$=a[h-1].concat([a[h]]);break;case 10:this.$={type:"EXPRESSION_BLOCK",body:a[h],loc:this._$};break;case 11:this.$={type:"IDENTIFIER",value:a[h].toLowerCase(),loc:this._$};break;case 14:this.$=[a[h]];break;case 15:this.$=a[h-2].concat([a[h]]);break;case 16:this.$={type:"CALL_EXPRESSION",callee:a[h-2],arguments:[],loc:this._$};break;case 17:this.$={type:"CALL_EXPRESSION",callee:a[h-3],arguments:a[h-1],loc:this._$};break;case 18:this.$={type:"LOGICAL_EXPRESSION",left:a[h-2],right:a[h],operator:a[h-1],loc:this._$};break;case 19:case 20:this.$={type:"ASSIGNMENT_EXPRESSION",left:a[h-2],operator:a[h-1],right:a[h],loc:this._$};break;case 21:this.$=Number(a[h]);break;case 22:this.$=Number(a[h-1]);break;case 23:this.$=Number(a[h-2]+a[h-1]+a[h]);break;case 24:this.$=Number("0"+a[h-1]+a[h]);break;case 25:this.$=0;break;case 26:this.$={type:"NUMBER_LITERAL",value:a[h],loc:this._$};break;case 27:case 28:case 29:this.$={type:"UNARY_EXPRESSION",value:a[h],operator:a[h-1],loc:this._$};break;case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:this.$={type:"BINARY_EXPRESSION",left:a[h-2],right:a[h],operator:a[h-1],loc:this._$};break;case 41:case 47:this.$=a[h-1]}},table:[{3:1,4:2,5:[1,4],6:3,9:13,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{1:[3]},{5:[1,21],7:32,8:A,20:n,28:l,29:g,32:c,33:m,34:u,35:f,36:d,37:p,38:E},{5:[1,34]},{1:[2,3]},t(_,[2,39]),t(_,[2,40]),{4:35,6:37,9:13,10:36,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(_,[2,42]),t(_,[2,43]),t(_,[2,44],{22:[1,38]}),t(_,[2,45],{17:[1,40],22:[1,39]}),t(_,[2,46]),t(b,[2,8],{31:5,27:6,26:8,21:9,16:10,11:11,19:12,23:17,4:41,12:e,17:i,24:s,25:r,28:a,29:o,30:h}),{4:42,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:43,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:44,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(_,[2,26]),t([5,8,15,17,18,20,22,28,29,32,33,34,35,36,37,38],[2,11]),t(_,[2,21],{25:[1,45]}),t(_,[2,25],{24:[1,46]}),{1:[2,1]},{4:47,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:48,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:49,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:50,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:51,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:52,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:53,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:54,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:55,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:56,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(x,[2,6],{8:v}),t(T,[2,4]),{1:[2,2]},{7:32,8:A,18:[1,58],20:n,28:l,29:g,32:c,33:m,34:u,35:f,36:d,37:p,38:E},{18:[1,59]},t(w,[2,10]),{4:60,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:61,11:11,12:e,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},{4:65,6:37,9:13,10:66,11:11,12:e,13:64,14:63,16:10,17:i,18:[1,62],19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(b,[2,9],{7:67,8:A,20:n,28:l,29:g,32:c,33:m,34:u,35:f,36:d,37:p,38:E}),t(S,[2,27],{20:n,32:c,33:m,34:u,35:f,36:d,37:p}),t(S,[2,28],{20:n,32:c,33:m,34:u,35:f,36:d,37:p}),t(S,[2,29],{20:n,32:c,33:m,34:u,35:f,36:d,37:p}),t(_,[2,22],{24:[1,68]}),t(_,[2,24]),t(S,[2,30],{20:n,32:c,33:m,34:u,35:f,36:d,37:p}),t(S,[2,31],{20:n,32:c,33:m,34:u,35:f,36:d,37:p}),t(P,[2,32],{20:n,34:u,35:f,36:d,37:p}),t(P,[2,33],{20:n,34:u,35:f,36:d,37:p}),t(R,[2,34],{20:n,35:f,36:d}),t(I,[2,35],{20:n}),t(I,[2,36],{20:n}),t(R,[2,37],{20:n,35:f,36:d}),t(y,[2,38],{20:n,28:l,29:g,32:c,33:m,34:u,35:f,36:d,37:p,38:E}),t(_,[2,18]),t(T,[2,5]),t(_,[2,41]),t(_,[2,47]),t(y,[2,20],{20:n,28:l,29:g,32:c,33:m,34:u,35:f,36:d,37:p,38:E}),t(y,[2,19],{20:n,28:l,29:g,32:c,33:m,34:u,35:f,36:d,37:p,38:E}),t(B,[2,16]),{15:[1,70],18:[1,69]},t(w,[2,14]),t(w,[2,12],{7:32,8:A,20:n,28:l,29:g,32:c,33:m,34:u,35:f,36:d,37:p,38:E}),t(w,[2,13]),t(x,[2,7],{8:v}),t(_,[2,23]),t(B,[2,17]),{4:65,6:37,9:13,10:66,11:11,12:e,13:71,16:10,17:i,19:12,21:9,23:17,24:s,25:r,26:8,27:6,28:a,29:o,30:h,31:5},t(w,[2,15])],defaultActions:{4:[2,3],21:[2,1],34:[2,2]},parseError:function(t,e){if(!e.recoverable){var i=new Error(t);throw i.hash=e,i}this.trace(t)},parse:function(t){var e=this,i=[0],s=[null],r=[],a=this.table,o="",h=0,A=0,n=r.slice.call(arguments,1),l=Object.create(this.lexer),g={yy:{}};for(var c in this.yy)Object.prototype.hasOwnProperty.call(this.yy,c)&&(g.yy[c]=this.yy[c]);l.setInput(t,g.yy),g.yy.lexer=l,g.yy.parser=this,void 0===l.yylloc&&(l.yylloc={});var m=l.yylloc;r.push(m);var u=l.options&&l.options.ranges;"function"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var f,d,p,E,_,b,x,v,T=function(){var t;return"number"!=typeof(t=l.lex()||1)&&(t=e.symbols_[t]||t),t},w={};;){if(d=i[i.length-1],this.defaultActions[d]?p=this.defaultActions[d]:(null==f&&(f=T()),p=a[d]&&a[d][f]),void 0===p||!p.length||!p[0]){var S;for(_ in v=[],a[d])this.terminals_[_]&&_>2&&v.push("'"+this.terminals_[_]+"'");S=l.showPosition?"Parse error on line "+(h+1)+":\n"+l.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(h+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(S,{text:l.match,token:this.terminals_[f]||f,line:l.yylineno,loc:m,expected:v})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+f);switch(p[0]){case 1:i.push(f),s.push(l.yytext),r.push(l.yylloc),i.push(p[1]),f=null,A=l.yyleng,o=l.yytext,h=l.yylineno,m=l.yylloc;break;case 2:if(b=this.productions_[p[1]][1],w.$=s[s.length-b],w._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},u&&(w._$.range=[r[r.length-(b||1)].range[0],r[r.length-1].range[1]]),void 0!==(E=this.performAction.apply(w,[o,A,h,g.yy,p[1],s,r].concat(n))))return E;b&&(i=i.slice(0,-1*b*2),s=s.slice(0,-1*b),r=r.slice(0,-1*b)),i.push(this.productions_[p[1]][0]),s.push(w.$),r.push(w._$),x=a[i[i.length-2]][i[i.length-1]],i.push(x);break;case 3:return!0}}return!0}},U={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var i,s,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var a in r)this[a]=r[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,i,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),a=0;ae[0].length)){if(e=i,s=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,r[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,i,s){switch(i){case 0:break;case 1:return 24;case 2:return 38;case 3:return 22;case 4:return 20;case 5:return 12;case 6:return 5;case 7:return e.yytext[0]}},rules:[/^(?:\s+)/,/^(?:[0-9]+)/,/^(?:(==|!=|<=|>=|<|>))/,/^(?:[+\-*/%]?=)/,/^(?:(\&\&)|\|\|)/,/^(?:[a-zA-Z_][a-zA-Z0-9._]*)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};function C(){this.yy={}}return L.lexer=U,C.prototype=L,L.Parser=C,new C}();const s={ASSIGNMENT_EXPRESSION:[{type:"NODE",key:"right"}],SCRIPT:[{type:"ARRAY",key:"body"}],EXPRESSION_BLOCK:[{type:"ARRAY",key:"body"}],UNARY_EXPRESSION:[{type:"NODE",key:"value"}],NUMBER_LITERAL:[],IDENTIFIER:[],CALL_EXPRESSION:[{type:"ARRAY",key:"arguments"},{type:"NODE",key:"callee"}],BINARY_EXPRESSION:[{type:"NODE",key:"left"},{type:"NODE",key:"right"}],LOGICAL_EXPRESSION:[{type:"NODE",key:"left"},{type:"NODE",key:"right"}]};function r(t,e){const i=s[t.type];let a=t;if(null==i)throw new Error(`Unknown children definition for ${t.type}`);return i.forEach(i=>{if("NODE"===i.type){const s=t[i.key],o=r(s,e);o!==s&&(a={...a,[i.key]:o})}else if("ARRAY"===i.type){const s=t[i.key],o=s.map(t=>r(t,e)),h=s.some((t,e)=>t!==o[e]);h&&(a={...a,[i.key]:o})}}),e(a)}function a(t){return[].concat.apply([],t)}function o(t,e){return new Array(t).fill(e).join("")}class h{constructor(){this._map=new Map}get(t,e){const i=null==t?e:`${t}::${e}`;return this._map.has(i)||this._map.set(i,this._map.size),this._map.get(i)}size(){return this._map.size}}class A extends Error{constructor(t,e,i){super(t),this.sourceContext=function(t,e,i=1){const s=Math.max(t.first_line-1-i,0),r=t.last_line+i,a=e.split("\n").slice(s,r).map((e,i)=>{const r=i+s+1;return`${r>=t.first_line&&r<=t.last_line?">":" "} ${r} | ${e}`});if(t.first_line===t.last_line){const e=o(t.first_column," "),i=o(t.last_column-t.first_column,"^"),r=t.first_line-s;a.splice(r,0,` | ${e}${i}`)}return a.join("\n")}(e,i),this.loc=e}}class n extends A{}function l(t,e,i){return new n(t,e,i)}function g(t,e,i){return new A(t,e,i)}function c(t,i){const s=e(i,t.first_column),r=e(i,t.last_column);return{first_column:s.column,last_column:r.column,first_line:s.line,last_line:r.line}}function m(t){const[e,s]=function(t){const e=[];let i=1,s="",r=0,a=!1,o=!1,h=!1;for(let A=0;A{if(1!==e.loc.first_line||1!=e.loc.last_line)throw g("Unexpected multiline",e.loc,t);return Object.assign(Object.assign({},e),{loc:c(e.loc,s)})})}catch(e){if(null==e.hash)throw e;throw l(`Parse Error: ${e.message.split("\n")[3]}`,c(e.hash.loc,s),t)}}const u=[0,97,115,109],f=[1,0,0,0],d=1e-5,p=t=>[2,t],E=t=>[3,t],_=t=>[4,t],b=11,x=t=>[13,...G(t)],v=t=>[16,...G(t)],T=t=>[32,...G(t)],w=t=>[33,...G(t)],S=t=>[34,...G(t)],P=t=>[35,...G(t)],R=t=>[36,...G(t)],I=(t,e)=>[43,...G(t),...G(e)],y=(t,e)=>[57,...G(t),...G(e)],B=t=>[65,...O(t)],L=t=>[68,...X(t)],U=99,C=153,F=161,Q=176,M=183,D=127,V=124,q=124,z=[C,...L(d),U],N=[C,...L(d),100];function X(t){const e=new Uint8Array(8);return function(t,e){const i=new ArrayBuffer(8);new DataView(i).setFloat64(0,e);const s=new Uint8Array(i).reverse();t.set(s,0)}(e,t),e}const k=t=>[t.length].concat(t.split("").map(t=>t.charCodeAt(0)));function G(t){const e=[];do{let i=127&t;0!=(t>>>=7)&&(i|=128),e.push(i)}while(0!==t);return e}function O(t){let e=[],i=0,s=Math.ceil(Math.log2(Math.abs(t))),r=t<0,a=!0;for(;a;)i=127&t,t>>=7,r&&(t|=-(1<G(t.length).concat(t),Y=t=>G(t.length).concat(a(t));function J(t,e){if(0===e.length)return[];const i=W(Y(e));return i.unshift(t),i}const K=(t,e,i)=>{const s=[...k(e),...i];return[t,...W(s)]},j={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,rand:t=>Math.random()*t,pow:Math.pow,log:Math.log,log10:Math.log10,exp:Math.exp,sigmoid:function(t,e){const i=1+Math.exp(-t*e);return Math.abs(i)>1e-5?1/i:0}},H=Math.ceil(2048),Z=L(Math.pow(2,31)),$=L(Math.pow(2,31));function tt(t){return[...T(t),...Z,U,..._(q),...T(t),C,5,...$,b,176]}const et={sqr:{args:[V],returns:[V],binary:[...T(0),...T(0),162]},bor:{args:[V,V],returns:[V],binary:[...T(0),...N,...T(1),...N,114,...B(0),71,M]},band:{args:[V,V],returns:[V],binary:[...T(0),...N,...T(1),...N,113,...B(0),71,M]},sign:{args:[V],returns:[V],binary:[...L(0),...T(0),U,...T(0),...L(0),U,107,M]},mod:{args:[V,V],returns:[V],localVariables:[126],binary:[...tt(1),...S(2),...(t=>[66,...O(t)])(0),82,..._(q),...tt(0),...T(2),129,185,5,...L(0),b]},bitwiseOr:{args:[V,V],returns:[V],binary:[...T(0),Q,...T(1),Q,132,185]},bitwiseAnd:{args:[V,V],returns:[V],binary:[...T(0),Q,...T(1),Q,131,185]},div:{args:[V,V],returns:[V],localVariables:[D],binary:[...T(1),...L(0),98,..._(q),...T(0),...T(1),163,5,...L(0),b]},_getBufferIndex:{args:[V],returns:[D],localVariables:[V,D],binary:[...L(d),...T(0),160,...S(1),170,...w(2),...B(-1),...T(2),...B(8),108,...T(2),...B(0),72,...T(2),...B(8388607),74,114,27]}};function it(t,e){var i,s,r;switch(t.type){case"SCRIPT":return a(t.body.map((t,i)=>[...it(t,e),26]));case"EXPRESSION_BLOCK":return st(t.body,e);case"BINARY_EXPRESSION":{const i=it(t.left,e),s=it(t.right,e),r={"+":[160],"-":[F],"*":[162],"/":e.resolveFunc("div"),"%":e.resolveFunc("mod"),"|":e.resolveFunc("bitwiseOr"),"&":e.resolveFunc("bitwiseAnd"),"^":e.resolveFunc("pow"),"==":[F,...z,M],"!=":[F,...N,M],"<":[U,M],">":[100,M],"<=":[101,M],">=":[102,M]}[t.operator];if(null==r)throw g(`Unknown binary expression operator ${t.operator}`,t.loc,e.rawSource);return[...i,...s,...r]}case"CALL_EXPRESSION":{const s=t.callee.value,r=t.arguments,o=i=>{if(r.lengthi)throw l(`Too many arguments passed to \`${s}()\`. Expected ${i} but got ${r.length}.`,r[i].loc,e.rawSource)};switch(s){case"exec2":return o(2),st(t.arguments,e);case"exec3":return o(3),st(t.arguments,e);case"if":o(3);const[r,a,h]=t.arguments;return function(t,e,i,s){return[...it(t,s),...N,..._(q),...it(e,s),5,...it(i,s),b]}(r,a,h,e);case"while":return o(1),function(t,e){const i=it(t,e),s=e.resolveLocal(D);return[...B(0),...w(s),...E(64),...T(s),...B(1),106,...S(s),...B(1048576),73,...i,...N,113,...x(0),b,...L(0)]}(t.arguments[0],e);case"loop":return o(2),function(t,e,i){const s=it(e,i),r=i.resolveLocal(D);return[...p(64),...it(t,i),170,...S(r),...B(0),76,...x(1),...E(64),...s,26,...T(r),...B(1),107,...S(r),...B(0),71,...x(0),b,b,...L(0)]}(t.arguments[0],t.arguments[1],e);case"megabuf":case"gmegabuf":o(1);const A=e.resolveLocal(D);return[...it(t.arguments[0],e),...null!==(i=e.resolveFunc("_getBufferIndex"))&&void 0!==i?i:[],...S(A),...B(-1),71,..._(q),...T(A),...I(3,rt(s)),5,...L(0),b];case"assign":o(2);const n=t.arguments[0];if("IDENTIFIER"!=n.type)throw l("Expected the first argument of `assign()` to be an identifier.",n.loc,e.rawSource);const g=e.resolveVar(n.value);return[...it(t.arguments[1],e),...R(g),...P(g)]}const h=a(t.arguments.map(t=>it(t,e)));switch(s){case"abs":return o(1),[...h,C];case"sqrt":return o(1),[...h,C,159];case"int":case"floor":return o(1),[...h,156];case"min":return o(2),[...h,164];case"max":return o(2),[...h,165];case"above":return o(2),[...h,100,M];case"below":return o(2),[...h,U,M];case"equal":return o(2),[...h,F,...z,M];case"bnot":return o(1),[...h,...z,M];case"ceil":return o(1),[...h,155]}const A=e.resolveFunc(s);if(null==A||s.startsWith("_"))throw l(`"${s}" is not defined.`,t.callee.loc,e.rawSource);if(null!=j[s])o(j[s].length);else{if(null==et[s])throw g(`Missing arity information for the function \`${s}()\``,t.callee.loc,e.rawSource);o(et[s].args.length)}return[...h,...A]}case"ASSIGNMENT_EXPRESSION":{const{left:i}=t,a=it(t.right,e),o=function(t,e){const i={"+=":[160],"-=":[F],"*=":[162],"/=":[163],"%=":e.resolveFunc("mod"),"=":null}[t.operator];if(void 0===i)throw g(`Unknown assignment operator "${t.operator}"`,t.loc,e.rawSource);return i}(t,e);if("IDENTIFIER"===i.type){const t=e.resolveVar(i.value),s=P(t),r=R(t);return null===o?[...a,...r,...s]:[...s,...a,...o,...r,...s]}if("CALL_EXPRESSION"!==i.type)throw g(`Unexpected left hand side type for assignment: ${i.type}`,t.loc,e.rawSource);const h=e.resolveLocal(D);if(1!==i.arguments.length)throw l(`Expected 1 argument when assigning to a buffer but got ${i.arguments.length}.`,0===i.arguments.length?i.loc:i.arguments[1].loc,e.rawSource);const A=i.callee.value;if("gmegabuf"!==A&&"megabuf"!==A)throw l("The only function calls which may be assigned to are `gmegabuf()` and `megabuf()`.",i.callee.loc,e.rawSource);const n=rt(A);if(null===o){const t=e.resolveLocal(D),r=e.resolveLocal(V);return[...a,...w(r),...it(i.arguments[0],e),...null!==(s=e.resolveFunc("_getBufferIndex"))&&void 0!==s?s:[],...S(t),...B(0),72,..._(q),...L(0),5,...T(t),...S(h),...T(r),...y(3,n),...T(r),b]}const c=e.resolveLocal(D),m=e.resolveLocal(D),u=e.resolveLocal(V),f=e.resolveLocal(V);return[...a,...w(u),...it(i.arguments[0],e),...null!==(r=e.resolveFunc("_getBufferIndex"))&&void 0!==r?r:[],...S(c),...B(-1),71,...S(m),..._(q),...T(c),...I(3,n),5,...L(0),b,...T(u),...o,...S(f),...T(m),..._(64),...T(c),...T(f),...y(3,n),b]}case"LOGICAL_EXPRESSION":{const i=it(t.left,e),s=it(t.right,e),r={"&&":{comparison:z,shortCircuitValue:0},"||":{comparison:N,shortCircuitValue:1}}[t.operator];if(null==r)throw g(`Unknown logical expression operator ${t.operator}`,t.loc,e.rawSource);const{comparison:a,shortCircuitValue:o}=r;return[...i,...a,..._(q),...L(o),5,...s,...N,M,b]}case"UNARY_EXPRESSION":{const i=it(t.value,e),s={"-":[154],"+":[],"!":[...z,M]}[t.operator];if(null==s)throw g(`Unknown logical unary operator ${t.operator}`,t.loc,e.rawSource);return[...i,...s]}case"IDENTIFIER":const o=t.value;return P(e.resolveVar(o));case"NUMBER_LITERAL":return L(t.value);default:throw g(`Unknown AST node type ${t.type}`,t.loc,e.rawSource)}}function st(t,e){return a(function(t,e){const i=[];for(let s=0;sit(t,e)),[26]))}function rt(t){switch(t){case"gmegabuf":return 67108864;case"megabuf":return 0}}function at({pools:t,functions:e,eelVersion:i=2,preParsed:s=!1}){if(Object.keys(t).includes("shims"))throw new Error('You may not name a pool "shims". "shims" is reserved for injected JavaScript functions.');const r=[];Object.entries(t).forEach(([t,e])=>{e.forEach(e=>{r.push([t,e])})});const a=new h;r.forEach(([t,e])=>{a.get(t,e)});const o=Object.entries(j).map(([t,e])=>({args:new Array(e.length).fill(null).map(t=>V),returns:[V],name:t})),A=[],n=[];Object.entries(e).forEach(([e,{pool:r,code:h}])=>{if(null==t[r]){const i=Object.keys(t);if(0===i.length)throw new Error(`The function "${e}" was declared as using a variable pool named "${r}" but no pools were defined.`);throw new Error(`The function "${e}" was declared as using a variable pool named "${r}" which is not among the variable pools defined. The defined variable pools are: ${function(t){if(0===t.length)throw new Error("Cannot format an empty list");if(1===t.length)return t[0];const e=t.map(t=>`"${t}"`),i=e.pop();return e.join(", ")+` and ${i}`}(i)}.`)}const l=s?h:m(h);if("string"==typeof l)throw new Error("Got passed unparsed code without setting the preParsed flag");if("SCRIPT"!==l.type)throw new Error("Invalid AST");if(0===l.body.length)return;const g=[],c={resolveVar:t=>/^reg\d\d$/.test(t)?a.get(null,t):a.get(r,t),resolveLocal:t=>(g.push(t),g.length-1),resolveFunc:t=>{const e=o.findIndex(e=>e.name===t);if(-1!==e){const s=v(e);return"rand"===t&&1===i?[...s,156]:s}if(null==et[t])return null;let s=A.indexOf(t);return-1===s&&(A.push(t),s=A.length-1),v(s+o.length)},rawSource:h},u=it(l,c);n.push({binary:u,exportName:e,args:[],returns:[],localVariables:g})});const l=A.map(t=>{const e=et[t];if(null==e)throw new Error(`Undefined local function "${t}"`);return e}),g=t=>[...t.args,"|",...t.returns].join("-"),c=[],d=new Map;function p(t){const e=g(t),i=d.get(e);if(null==i)throw new Error(`Failed to get a type index for key ${e}`);return i}[...o,...l,...n].forEach(t=>{const e=g(t);d.has(e)||(c.push([96,...W(t.args),...W(t.returns)]),d.set(e,c.length-1))});const E=[...r.map(([t,e])=>[...k(t),...k(e),3,V,1]),...o.map((t,e)=>{const i=p(t);return[...k("shims"),...k(t.name),0,...G(i)]})],_=[...l,...n].map(t=>G(p(t))),x=[[1,...G(H),...G(H)]],T=a.size()-r.length,w=(S=()=>[V,1,...L(0),b],new Array(T).fill(null).map((t,e)=>S()));var S;const P=[...n].map((t,e)=>{const i=e+o.length+l.length;return[...k(t.exportName),0,...G(i)]}),R=[...l,...n].map(t=>{var e;const i=(null!==(e=t.localVariables)&&void 0!==e?e:[]).map(t=>[...G(1),t]);return W([...Y(i),...t.binary,b])}),I=[...o.map(t=>t.name),...A,...n.map(t=>t.exportName)].map((t,e)=>[...G(e),...k(t)]),y=[1,...W(Y(I))];return new Uint8Array([...u,...f,...J(1,c),...J(2,E),...J(3,_),...J(5,x),...J(6,w),...J(7,P),...J(10,R),...K(0,"name",y)])}const ot="undefined"!=typeof BigUint64Array,ht=Symbol(),At=new TextDecoder("utf-16le");function nt(t,e){const i=new Uint32Array(t)[e+-4>>>2]>>>1,s=new Uint16Array(t,e,i);return i<=32?String.fromCharCode.apply(String,s):At.decode(s)}function lt(t){const e={};function i(t,e){return t?nt(t.buffer,e):""}const s=t.env=t.env||{};return s.abort=s.abort||function(t,r,a,o){const h=e.memory||s.memory;throw Error(`abort: ${i(h,t)} at ${i(h,r)}:${a}:${o}`)},s.trace=s.trace||function(t,r,...a){const o=e.memory||s.memory;console.log(`trace: ${i(o,t)}${r?" ":""}${a.slice(0,r).join(", ")}`)},s.seed=s.seed||Date.now,t.Math=t.Math||Math,t.Date=t.Date||Date,e}function gt(t,e){const i=e.exports,s=i.memory,r=i.table,a=i.__new,o=i.__retain,h=i.__rtti_base||-1;function A(t){const e=function(t){const e=new Uint32Array(s.buffer);if((t>>>=0)>=e[h>>>2])throw Error(`invalid id: ${t}`);return e[(h+4>>>2)+2*t]}(t);if(!(7&e))throw Error(`not an array: ${t}, flags=${e}`);return e}function n(t){const e=new Uint32Array(s.buffer);if((t>>>=0)>=e[h>>>2])throw Error(`invalid id: ${t}`);return e[(h+4>>>2)+2*t+1]}function l(t){return 31-Math.clz32(t>>>6&31)}function g(t,e,i){const r=s.buffer;if(i)switch(t){case 2:return new Float32Array(r);case 3:return new Float64Array(r)}else switch(t){case 0:return new(e?Int8Array:Uint8Array)(r);case 1:return new(e?Int16Array:Uint16Array)(r);case 2:return new(e?Int32Array:Uint32Array)(r);case 3:return new(e?BigInt64Array:BigUint64Array)(r)}throw Error(`unsupported align: ${t}`)}function c(t){const e=new Uint32Array(s.buffer),i=A(e[t+-8>>>2]),r=l(i);let a=4&i?t:e[t+4>>>2];const o=2&i?e[t+12>>>2]:e[a+-4>>>2]>>>r;return g(r,2048&i,4096&i).subarray(a>>>=r,a+o)}function m(t,e,i){return new t(u(t,e,i))}function u(t,e,i){const r=s.buffer,a=new Uint32Array(r),o=a[i+4>>>2];return new t(r,o,a[o+-4>>>2]>>>e)}function f(e,i,s){t[`__get${i}`]=m.bind(null,e,s),t[`__get${i}View`]=u.bind(null,e,s)}return t.__newString=function(t){if(null==t)return 0;const e=t.length,i=a(e<<1,1),r=new Uint16Array(s.buffer);for(var o=0,h=i>>>1;o>>2])throw Error(`not a string: ${t}`);return nt(e,t)},t.__newArray=function(t,e){const i=A(t),r=l(i),h=e.length,n=a(h<>>2]=o(n),A[e+4>>>2]=n,A[e+8>>>2]=h<>>2]=h),c=e}const m=g(r,2048&i,4096&i);if(16384&i)for(let t=0;t>>r)+t]=o(e[t]);else m.set(e,n>>>r);return c},t.__getArrayView=c,t.__getArray=function(t){const e=c(t),i=e.length,s=new Array(i);for(let t=0;t>>2];return e.slice(t,t+i)},[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].forEach(t=>{f(t,t.name,31-Math.clz32(t.BYTES_PER_ELEMENT))}),ot&&[BigUint64Array,BigInt64Array].forEach(t=>{f(t,t.name.slice(3),3)}),t.__instanceof=function(t,e){const i=new Uint32Array(s.buffer);let r=i[t+-8>>>2];if(r<=i[h>>>2])do{if(r==e)return!0;r=n(r)}while(r);return!1},t.memory=t.memory||s,t.table=t.table||r,dt(i,t)}function ct(t){return"undefined"!=typeof Response&&t instanceof Response}function mt(t){return t instanceof WebAssembly.Module}async function ut(t,e={}){if(ct(t=await t))return ft(t,e);const i=mt(t)?t:await WebAssembly.compile(t),s=lt(e),r=await WebAssembly.instantiate(i,e);return{module:i,instance:r,exports:gt(s,r)}}async function ft(t,e={}){if(!WebAssembly.instantiateStreaming)return ut(ct(t=await t)?t.arrayBuffer():t,e);const i=lt(e),s=await WebAssembly.instantiateStreaming(t,e),r=gt(i,s.instance);return{...s,exports:r}}function dt(t,e={}){const i=t.__argumentsLength?e=>{t.__argumentsLength.value=e}:t.__setArgumentsLength||t.__setargc||(()=>{});for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const r=t[s];let a=s.split("."),o=e;for(;a.length>1;){let t=a.shift();Object.prototype.hasOwnProperty.call(o,t)||(o[t]={}),o=o[t]}let h=a[0],A=h.indexOf("#");if(A>=0){const e=h.substring(0,A),a=o[e];if(void 0===a||!a.prototype){const t=function(...e){return t.wrap(t.prototype.constructor(0,...e))};t.prototype={valueOf(){return this[ht]}},t.wrap=function(e){return Object.create(t.prototype,{[ht]:{value:e,writable:!1}})},a&&Object.getOwnPropertyNames(a).forEach(e=>Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))),o[e]=t}if(h=h.substring(A+1),o=o[e].prototype,/^(get|set):/.test(h)){if(!Object.prototype.hasOwnProperty.call(o,h=h.substring(4))){let e=t[s.replace("set:","get:")],i=t[s.replace("get:","set:")];Object.defineProperty(o,h,{get(){return e(this[ht])},set(t){i(this[ht],t)},enumerable:!0})}}else"constructor"===h?(o[h]=(...t)=>(i(t.length),r(...t))).original=r:(o[h]=function(...t){return i(t.length),r(this[ht],...t)}).original=r}else/^(get|set):/.test(h)?Object.prototype.hasOwnProperty.call(o,h=h.substring(4))||Object.defineProperty(o,h,{get:t[s.replace("set:","get:")],set:t[s.replace("get:","set:")],enumerable:!0}):"function"==typeof r&&r!==i?(o[h]=(...t)=>(i(t.length),r(...t))).original=r:o[h]=r}return e}var pt={instantiate:ut,instantiateSync:function(t,e={}){const i=mt(t)?t:new WebAssembly.Module(t),s=lt(e),r=new WebAssembly.Instance(i,e);return{module:i,instance:r,exports:gt(s,r)}},instantiateStreaming:ft,demangle:dt};class Et{constructor(t,e,i=!1){this.samplesIn=t,this.samplesOut=e,this.equalize=i,this.NFREQ=2*e,this.equalize&&this.initEqualizeTable(),this.initBitRevTable(),this.initCosSinTable()}initEqualizeTable(){this.equalizeArr=new Float32Array(this.samplesOut);const t=1/this.samplesOut;for(let e=0;ee){const i=this.bitrevtable[e];this.bitrevtable[e]=this.bitrevtable[t],this.bitrevtable[t]=i}let i=this.NFREQ>>1;for(;i>=1&&t>=i;)t-=i,i>>=1;t+=i}}initCosSinTable(){let t=2,e=0;for(;t<=this.NFREQ;)e+=1,t<<=1;this.cossintable=[new Float32Array(e),new Float32Array(e)],t=2;let i=0;for(;t<=this.NFREQ;){const e=-2*Math.PI/t;this.cossintable[0][i]=Math.cos(e),this.cossintable[1][i]=Math.sin(e),i+=1,t<<=1}}timeToFrequencyDomain(t){const e=new Float32Array(this.NFREQ),i=new Float32Array(this.NFREQ);for(let s=0;s>1;for(let r=0;r0){let i=t;!bt.isFiniteNumber(i)||i<15?i=15:i>144&&(i=144),this.imm.fill(0);for(let t=0;t<3;t++)for(let e=this.starts[t];ethis.avg[t]?.2:.5,s=bt.adjustRateToFPS(s,30,i),this.avg[t]=this.avg[t]*s+this.imm[t]*(1-s),s=e<50?.9:.992,s=bt.adjustRateToFPS(s,30,i),this.longAvg[t]=this.longAvg[t]*s+this.imm[t]*(1-s),this.longAvg[t]<.001?(this.val[t]=1,this.att[t]=1):(this.val[t]=this.imm[t]/this.longAvg[t],this.att[t]=this.avg[t]/this.longAvg[t])}}}}const xt={baseVals:{gammaadj:1.25,wave_g:.5,mv_x:12,warpscale:1,brighten:0,mv_y:9,wave_scale:1,echo_alpha:0,additivewave:0,sx:1,sy:1,warp:.01,red_blue:0,wave_mode:0,wave_brighten:0,wrap:0,zoomexp:1,fshader:0,wave_r:.5,echo_zoom:1,wave_smoothing:.75,warpanimspeed:1,wave_dots:0,wave_x:.5,wave_y:.5,zoom:1,solarize:0,modwavealphabyvolume:0,dx:0,cx:.5,dy:0,darken_center:0,cy:.5,invert:0,bmotionvectorson:0,rot:0,modwavealphaend:.95,wave_mystery:-.2,decay:.9,wave_a:1,wave_b:.5,rating:5,modwavealphastart:.75,darken:0,echo_orient:0,ib_r:.5,ib_g:.5,ib_b:.5,ib_a:0,ib_size:0,ob_r:.5,ob_g:.5,ob_b:.5,ob_a:0,ob_size:0,mv_dx:0,mv_dy:0,mv_a:0,mv_r:.5,mv_g:.5,mv_b:.5,mv_l:0},init_eqs:function(){return{}},frame_eqs:function(t){return t.rkeys=["warp"],t.zoom=1.01+.02*t.treb_att,t.warp=.15+.25*t.bass_att,t},pixel_eqs:function(t){return t.warp=t.warp+.15*t.rad,t},waves:[{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""},{baseVals:{a:1,enabled:0,b:1,g:1,scaling:1,samples:512,additive:0,usedots:0,spectrum:0,r:1,smoothing:.5,thick:0,sep:0},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t},point_eqs:""}],shapes:[{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}},{baseVals:{r2:0,a:1,enabled:0,b:0,tex_ang:0,thickoutline:0,g:0,textured:0,g2:1,tex_zoom:1,additive:0,border_a:.1,border_b:1,b2:0,a2:0,r:1,border_g:1,rad:.1,x:.5,y:.5,ang:0,sides:4,border_r:1},init_eqs:function(t){return t.rkeys=[],t},frame_eqs:function(t){return t}}],warp:"shader_body {\nret = texture2D(sampler_main, uv).rgb;\nret -= 0.004;\n}\n",comp:"shader_body {\nret = texture2D(sampler_main, uv).rgb;\nret *= hue_shader;\n}\n"};class vt{static atan2(t,e){let i=Math.atan2(t,e);return i<0&&(i+=2*Math.PI),i}static cloneVars(t){return Object.assign({},t)}static range(t,e){return void 0===e?[...Array(t).keys()]:Array.from({length:e-t},(e,i)=>i+t)}static pick(t,e){const i={};for(let s=0;s>>8,this.state[0]=t^e^e>>>19,(this.state[0]>>>0)/4294967296}nextInt(t){return Math.floor(this.next()*t)}rand(t){return t<1?this.next():Math.floor(this.next()*Math.floor(t))}reset(t){Tt.initializeState(this.state,t),this.warmUp()}}function wt(){return{random:Math.random,rand:t=>t<1?Math.random():Math.random()*Math.floor(t),randint:t=>Math.floor((t<1?Math.random():Math.random()*Math.floor(t))+1),getRNG:()=>null,reset:()=>{}}}let St=null;function Pt(t={}){return St=t.deterministic||t.testMode?function(t=1){const e=new Tt(t);return{random:()=>e.next(),rand:t=>e.rand(t),randint:t=>Math.floor(e.rand(t)+1),getRNG:()=>e,reset:i=>{void 0!==i?e.reset(i):e.reset(t)}}}(t.seed||12345):wt(),(t.deterministic||t.testMode)&&(window.rand=t=>St.rand(t),window.randint=t=>St.randint(t),Math.random=()=>St.random()),St}function Rt(){return St||(St=wt()),St}class It{constructor(t,e,i){this.rng=Rt(),this.preset=t,this.texsizeX=i.texsizeX,this.texsizeY=i.texsizeY,this.mesh_width=i.mesh_width,this.mesh_height=i.mesh_height,this.aspectx=i.aspectx,this.aspecty=i.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.qs=vt.range(1,33).map(t=>`q${t}`),this.ts=vt.range(1,9).map(t=>`t${t}`),this.regs=vt.range(100).map(t=>t<10?`reg0${t}`:`reg${t}`),this.initializeEquations(e)}initializeEquations(t){this.runVertEQs=""!==this.preset.pixel_eqs,this.mdVSQInit=null,this.mdVSRegs=null,this.mdVSFrame=null,this.mdVSUserKeys=null,this.mdVSFrameMap=null,this.mdVSShapes=null,this.mdVSUserKeysShapes=null,this.mdVSFrameMapShapes=null,this.mdVSWaves=null,this.mdVSUserKeysWaves=null,this.mdVSFrameMapWaves=null,this.mdVSQAfterFrame=null,this.gmegabuf=new Array(1048576).fill(0);const e={frame:t.frame,time:t.time,fps:t.fps,bass:t.bass,bass_att:t.bass_att,mid:t.mid,mid_att:t.mid_att,treb:t.treb,treb_att:t.treb_att,meshx:this.mesh_width,meshy:this.mesh_height,aspectx:this.invAspectx,aspecty:this.invAspecty,pixelsx:this.texsizeX,pixelsy:this.texsizeY,gmegabuf:this.gmegabuf};this.mdVS=Object.assign({},this.preset.baseVals,e),this.mdVS.megabuf=new Array(1048576).fill(0),this.mdVS.rand_start=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]),this.mdVS.rand_preset=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]);const i=this.qs.concat(this.regs,Object.keys(this.mdVS)),s=this.preset.init_eqs(vt.cloneVars(this.mdVS));this.mdVSQInit=vt.pick(s,this.qs),this.mdVSRegs=vt.pick(s,this.regs);const r=vt.pick(s,Object.keys(vt.omit(s,i)));if(r.megabuf=s.megabuf,r.gmegabuf=s.gmegabuf,this.mdVSFrame=this.preset.frame_eqs(Object.assign({},this.mdVS,this.mdVSQInit,this.mdVSRegs,r)),this.mdVSUserKeys=Object.keys(vt.omit(this.mdVSFrame,i)),this.mdVSFrameMap=vt.pick(this.mdVSFrame,this.mdVSUserKeys),this.mdVSQAfterFrame=vt.pick(this.mdVSFrame,this.qs),this.mdVSRegs=vt.pick(this.mdVSFrame,this.regs),this.mdVSWaves=[],this.mdVSTWaveInits=[],this.mdVSUserKeysWaves=[],this.mdVSFrameMapWaves=[],this.preset.waves&&this.preset.waves.length>0)for(let t=0;t0)for(let t=0;t`q${t}`),this.ts=vt.range(1,9).map(t=>`t${t}`),this.regs=vt.range(100).map(t=>t<10?`reg0${t}`:`reg${t}`),this.globalKeys=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy"],this.frameKeys=["decay","wave_a","wave_r","wave_g","wave_b","wave_x","wave_y","wave_scale","wave_smoothing","wave_mode","old_wave_mode","wave_mystery","ob_size","ob_r","ob_g","ob_b","ob_a","ib_size","ib_r","ib_g","ib_b","ib_a","mv_x","mv_y","mv_dx","mv_dy","mv_l","mv_r","mv_g","mv_b","mv_a","echo_zoom","echo_alpha","echo_orient","wave_dots","wave_thick","additivewave","wave_brighten","modwavealphabyvolume","modwavealphastart","modwavealphaend","darken_center","gammaadj","warp","warpanimspeed","warpscale","zoom","zoomexp","rot","cx","cy","dx","dy","sx","sy","fshader","wrap","invert","brighten","darken","solarize","bmotionvectorson","b1n","b2n","b3n","b1x","b2x","b3x","b1ed"],this.waveFrameKeys=["samples","sep","scaling","spectrum","smoothing","r","g","b","a"],this.waveFrameInputKeys=["samples","r","g","b","a"],this.initializeEquations(e)}getQVars(t){return vt.pickWasm(this.preset.globalPools[t],this.qs)}getTVars(t){return vt.pickWasm(this.preset.globalPools[t],this.ts)}initializeEquations(t){this.runVertEQs=!!this.preset.pixel_eqs,this.mdVSQInit=null,this.mdVSQAfterFrame=null;const e={frame:t.frame,time:t.time,fps:t.fps,bass:t.bass,bass_att:t.bass_att,mid:t.mid,mid_att:t.mid_att,treb:t.treb,treb_att:t.treb_att,meshx:this.mesh_width,meshy:this.mesh_height,aspectx:this.invAspectx,aspecty:this.invAspecty,pixelsx:this.texsizeX,pixelsy:this.texsizeY};if(this.mdVS=Object.assign({},this.preset.baseVals,e),vt.setWasm(this.preset.globalPools.perFrame,this.mdVS,Object.keys(this.mdVS)),this.rand_start=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]),this.rand_preset=new Float32Array([this.rng.random(),this.rng.random(),this.rng.random(),this.rng.random()]),this.preset.init_eqs(),this.mdVSQInit=this.getQVars("perFrame"),this.preset.frame_eqs(),this.mdVSQAfterFrame=this.getQVars("perFrame"),this.mdVSTWaveInits=[],this.preset.waves&&this.preset.waves.length>0)for(let t=0;t0)for(let t=0;t-1){const i=t.substring(0,e),s=t.substring(e),r=s.indexOf("{"),a=s.lastIndexOf("}");return[i,s.substring(r+1,a)]}return["",t]}static getFragmentFloatPrecision(t){return t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0?"highp":t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}static getUserSamplers(t){const e=[],i=t.match(Bt);if(i&&i.length>0)for(let t=0;t0){const t=s[1];e.push({sampler:t})}}return e}}class Ct{static smoothWave(t,e,i,s=!1){const r=-.15,a=1.15,o=1.15,h=-.15;let A,n=0,l=0,g=1;for(let c=0;c-.01&&a>.001&&i.length>0){const h=Ft.processWaveform(i,r),A=Ft.processWaveform(s,r),n=Math.floor(r.wave_mode)%8,l=Math.floor(r.old_wave_mode)%8,g=2*r.wave_x-1,c=2*r.wave_y-1;this.numVert=0,this.oldNumVert=0;const m=t&&n!==l?2:1;for(let t=0;t1)||(u=.5*u+.5,u-=Math.floor(u),u=Math.abs(u),u=2*u-1),0===t?(s=this.positions,m=this.positions2):(s=this.oldPositions,m=this.oldPositions2),a=r.wave_a,0===e){if(r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=Math.floor(h.length/2)+1;const t=1/(i-1),e=Math.floor((h.length-i)/2);for(let a=0;a0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=Math.floor(h.length/2);for(let t=0;t=1024&&this.texsizeX<2048?a*=.11:a*=.13,r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=h.length;for(let t=0;t=1024&&this.texsizeX<2048?a*=.22:a*=.33,a*=1.3,a*=r.treb*r.treb,r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=h.length;for(let t=0;t0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=h.length,i>this.texsizeX/3&&(i=Math.floor(this.texsizeX/3));const t=1/i,e=Math.floor((h.length-i)/2),n=.45+.5*(.5*u+.5),l=1-n;for(let r=0;r1&&(i=i*l+n*(2*s[3*(r-1)+0]-s[3*(r-2)+0]),a=a*l+n*(2*s[3*(r-1)+1]-s[3*(r-2)+1])),s[3*r+0]=i,s[3*r+1]=a,s[3*r+2]=0}}else if(5===e){if(this.texsizeX<1024?a*=.09:this.texsizeX>=1024&&this.texsizeX<2048?a*=.11:a*=.13,r.modwavealphabyvolume>0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1);const t=Math.cos(.3*r.time),e=Math.sin(.3*r.time);i=h.length;for(let i=0;i0){const t=r.modwavealphaend-r.modwavealphastart;a*=(o-r.modwavealphastart)/t}a=Math.clamp(a,0,1),i=Math.floor(h.length/2),i>this.texsizeX/3&&(i=Math.floor(this.texsizeX/3));const t=Math.floor((h.length-i)/2),n=.5*Math.PI*u;let l=Math.cos(n),f=Math.sin(n);const d=[g*Math.cos(n+.5*Math.PI)-3*l,g*Math.cos(n+.5*Math.PI)+3*l],p=[g*Math.sin(n+.5*Math.PI)-3*f,g*Math.sin(n+.5*Math.PI)+3*f];for(let t=0;t<2;t++)for(let e=0;e<4;e++){let i,s=!1;switch(e){case 0:d[t]>1.1&&(i=(1.1-d[1-t])/(d[t]-d[1-t]),s=!0);break;case 1:d[t]<-1.1&&(i=(-1.1-d[1-t])/(d[t]-d[1-t]),s=!0);break;case 2:p[t]>1.1&&(i=(1.1-p[1-t])/(p[t]-p[1-t]),s=!0);break;case 3:p[t]<-1.1&&(i=(-1.1-p[1-t])/(p[t]-p[1-t]),s=!0)}if(s){const e=d[t]-d[1-t],s=p[t]-p[1-t];d[t]=d[1-t]+e*i,p[t]=p[1-t]+s*i}}l=(d[1]-d[0])/i,f=(p[1]-p[0])/i;const E=Math.atan2(f,l),_=Math.cos(E+.5*Math.PI),b=Math.sin(E+.5*Math.PI);if(6===e)for(let e=0;e0&&(a=u*this.alpha+f*this.oldAlpha);let d=Math.clamp(r.wave_r,0,1),p=Math.clamp(r.wave_g,0,1),E=Math.clamp(r.wave_b,0,1);if(0!==r.wave_brighten){const t=Math.max(d,p,E);t>.01&&(d/=t,p/=t,E/=t)}if(this.color=[d,p,E,a],this.oldNumVert>0)if(7===n){const t=(this.oldNumVert-1)/(2*this.numVert);for(let e=0;e0){let A;if(a.preset.useWASM)A=a.runWaveFrameEquations(this.index,r);else{const t=Object.assign({},a.mdVSWaves[this.index],a.mdVSFrameMapWaves[this.index],a.mdVSQAfterFrame,a.mdVSTWaveInits[this.index],r);A=a.runWaveFrameEquations(this.index,t)}const n=512;Object.prototype.hasOwnProperty.call(A,"samples")?this.samples=A.samples:this.samples=n,this.samples>n&&(this.samples=n),this.samples=Math.floor(this.samples);const l=a.preset.waves[this.index].baseVals,g=Math.floor(A.sep),c=A.scaling,m=A.spectrum,u=A.smoothing,f=l.usedots,d=A.r,p=A.g,E=A.b,_=A.a,b=a.preset.baseVals.wave_scale;if(this.samples-=g,this.samples>=2||0!==f&&this.samples>=1){const r=0!==m,x=(r?.15:.004)*c*b,v=r?i:t,T=r?s:e,w=r?0:Math.floor((n-this.samples)/2-g/2),S=r?0:Math.floor((n-this.samples)/2+g/2),P=r?(n-g)/this.samples:1,R=(.98*u)**.5,I=1-R;this.pointsData[0][0]=v[w],this.pointsData[1][0]=T[S];for(let t=1;t=0;t--)this.pointsData[0][t]=this.pointsData[0][t]*I+this.pointsData[0][t+1]*R,this.pointsData[1][t]=this.pointsData[1][t]*I+this.pointsData[1][t+1]*R;for(let t=0;t=1024?1:0)):this.gl.uniform1f(this.sizeLoc,1+(this.texsizeX>=1024?1:0)):(this.gl.uniform1f(this.sizeLoc,1),e&&(o=4)),i?this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE):this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA);const h=t?this.gl.POINTS:this.gl.LINE_STRIP;for(let t=0;t0,I=Math.abs(T)>=1,y=Math.abs(v)>=1,B=Math.abs(P)>=1;this.positions[0]=A,this.positions[1]=n,this.positions[2]=0,this.colors[0]=l,this.colors[1]=g,this.colors[2]=c,this.colors[3]=m*t,I&&(this.uvs[0]=.5,this.uvs[1]=.5);const L=.25*Math.PI;for(let e=1;e<=s+1;e++){const i=2*((e-1)/s)*Math.PI,r=i+h+L;if(this.positions[3*e+0]=A+o*Math.cos(r)*this.aspecty,this.positions[3*e+1]=n+o*Math.sin(r),this.positions[3*e+2]=0,this.colors[4*e+0]=u,this.colors[4*e+1]=f,this.colors[4*e+2]=d,this.colors[4*e+3]=p*t,I){const t=i+S+L;this.uvs[2*e+0]=.5+.5*Math.cos(t)/w*this.aspecty,this.uvs[2*e+1]=.5+.5*Math.sin(t)/w}R&&(this.borderPositions[3*(e-1)+0]=this.positions[3*e+0],this.borderPositions[3*(e-1)+1]=this.positions[3*e+1],this.borderPositions[3*(e-1)+2]=this.positions[3*e+2])}this.drawCustomShapeInstance(r,s,I,R,y,B)}}else{this.setupShapeBuffers(i.mdVSFrame.wrap);let s=Object.assign({},i.mdVSShapes[this.index],i.mdVSFrameMapShapes[this.index],e);""===i.preset.shapes[this.index].frame_eqs_str&&(s=Object.assign(s,i.mdVSQAfterFrame,i.mdVSTShapeInits[this.index]));const a=i.preset.shapes[this.index].baseVals,o=Math.clamp(a.num_inst,1,1024);for(let e=0;e0,B=Math.abs(S)>=1,L=Math.abs(w)>=1,U=Math.abs(I)>=1;this.positions[0]=l,this.positions[1]=g,this.positions[2]=0,this.colors[0]=c,this.colors[1]=m,this.colors[2]=u,this.colors[3]=f*t,B&&(this.uvs[0]=.5,this.uvs[1]=.5);const C=.25*Math.PI;for(let e=1;e<=h+1;e++){const i=2*((e-1)/h)*Math.PI,s=i+n+C;if(this.positions[3*e+0]=l+A*Math.cos(s)*this.aspecty,this.positions[3*e+1]=g+A*Math.sin(s),this.positions[3*e+2]=0,this.colors[4*e+0]=d,this.colors[4*e+1]=p,this.colors[4*e+2]=E,this.colors[4*e+3]=_*t,B){const t=i+R+C;this.uvs[2*e+0]=.5+.5*Math.cos(t)/P*this.aspecty,this.uvs[2*e+1]=.5+.5*Math.sin(t)/P}y&&(this.borderPositions[3*(e-1)+0]=this.positions[3*e+0],this.borderPositions[3*(e-1)+1]=this.positions[3*e+1],this.borderPositions[3*(e-1)+2]=this.positions[3*e+2])}this.mdVSShapeFrame=o,this.drawCustomShapeInstance(r,h,B,y,L,U)}const h=i.mdVSUserKeysShapes[this.index],A=vt.pick(this.mdVSShapeFrame,h);i.mdVSFrameMapShapes[this.index]=A}}setupShapeBuffers(t){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.colors,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.uvVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.uvs,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aUvLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aUvLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.borderPositionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.borderPositions,this.gl.DYNAMIC_DRAW),this.gl.vertexAttribPointer(this.aBorderPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aBorderPosLoc);const e=0!==t?this.gl.REPEAT:this.gl.CLAMP_TO_EDGE;this.gl.samplerParameteri(this.mainSampler,this.gl.TEXTURE_WRAP_S,e),this.gl.samplerParameteri(this.mainSampler,this.gl.TEXTURE_WRAP_T,e)}drawCustomShapeInstance(t,e,i,s,r,a){if(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.positions,0,3*(e+2)),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.colors,0,4*(e+2)),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),i&&(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.uvVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.uvs,0,2*(e+2)),this.gl.vertexAttribPointer(this.aUvLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aUvLocation)),this.gl.uniform1f(this.texturedLoc,i?1:0),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.bindSampler(0,this.mainSampler),this.gl.uniform1i(this.textureLoc,0),a?this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE):this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,e+2),s){this.gl.useProgram(this.borderShaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.borderPositionVertexBuf),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,this.borderPositions,0,3*(e+1)),this.gl.vertexAttribPointer(this.aBorderPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aBorderPosLoc),this.gl.uniform4fv(this.uBorderColorLoc,this.borderColor);const t=r?4:1;for(let i=0;i0&&t[3]>0){const t=2,s=2,r=t/2,a=s/2,o=i/2,h=e/2+o,A=o*t,n=o*s,l=h*t,g=h*s;let c=[-r+A,-a+g,0],m=[-r+A,a-g,0],u=[-r+l,a-g,0],f=[-r+l,-a+g,0];return this.addTriangle(0,f,m,c),this.addTriangle(9,f,u,m),c=[r-A,-a+g,0],m=[r-A,a-g,0],u=[r-l,a-g,0],f=[r-l,-a+g,0],this.addTriangle(18,c,m,f),this.addTriangle(27,m,u,f),c=[-r+A,-a+n,0],m=[-r+A,g-a,0],u=[r-A,g-a,0],f=[r-A,-a+n,0],this.addTriangle(36,f,m,c),this.addTriangle(45,f,u,m),c=[-r+A,a-n,0],m=[-r+A,a-g,0],u=[r-A,a-g,0],f=[r-A,a-n,0],this.addTriangle(54,c,m,f),this.addTriangle(63,m,u,f),!0}return!1}drawBorder(t,e,i){this.generateBorder(t,e,i)&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLoc),this.gl.uniform4fv(this.colorLoc,t),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLES,0,this.positions.length/3))}}class Vt{constructor(t,e){this.gl=t,this.aspectx=e.aspectx,this.aspecty=e.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.generatePositions(),this.colors=new Float32Array([0,0,0,3/32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),this.positionVertexBuf=this.gl.createBuffer(),this.colorVertexBuf=this.gl.createBuffer(),this.floatPrecision=Ut.getFragmentFloatPrecision(this.gl),this.createShader()}updateGlobals(t){this.aspectx=t.aspectx,this.aspecty=t.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.generatePositions()}generatePositions(){const t=.05;this.positions=new Float32Array([0,0,0,-.05*this.aspecty,0,0,0,-.05,0,t*this.aspecty,0,0,0,t,0,-.05*this.aspecty,0,0])}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n in vec3 aPos;\n in vec4 aColor;\n out vec4 vColor;\n void main(void) {\n vColor = aColor;\n gl_Position = vec4(aPos, 1.0);\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`\n #version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n in vec4 vColor;\n out vec4 fragColor;\n void main(void) {\n fragColor = vColor;\n }\n `.trim()),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.aPosLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.aColorLocation=this.gl.getAttribLocation(this.shaderProgram,"aColor")}drawDarkenCenter(t){0!==t.darken_center&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLocation,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.colorVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.colors,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aColorLocation,4,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aColorLocation),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,this.positions.length/3))}}class qt{constructor(t,e){this.gl=t,this.maxX=64,this.maxY=48,this.positions=new Float32Array(this.maxX*this.maxY*2*3),this.texsizeX=e.texsizeX,this.texsizeY=e.texsizeY,this.mesh_width=e.mesh_width,this.mesh_height=e.mesh_height,this.positionVertexBuf=this.gl.createBuffer(),this.floatPrecision=Ut.getFragmentFloatPrecision(this.gl),this.createShader()}updateGlobals(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.mesh_width=t.mesh_width,this.mesh_height=t.mesh_height}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n in vec3 aPos;\n void main(void) {\n gl_Position = vec4(aPos, 1.0);\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`\n #version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n out vec4 fragColor;\n uniform vec4 u_color;\n void main(void) {\n fragColor = u_color;\n }\n `.trim()),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.aPosLoc=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.colorLoc=this.gl.getUniformLocation(this.shaderProgram,"u_color")}getMotionDir(t,e,i){const s=Math.floor(i*this.mesh_height),r=i*this.mesh_height-s,a=Math.floor(e*this.mesh_width),o=e*this.mesh_width-a,h=a+1,A=s+1,n=this.mesh_width+1;let l,g;return l=t[2*(s*n+a)+0]*(1-o)*(1-r),g=t[2*(s*n+a)+1]*(1-o)*(1-r),l+=t[2*(s*n+h)+0]*o*(1-r),g+=t[2*(s*n+h)+1]*o*(1-r),l+=t[2*(A*n+a)+0]*(1-o)*r,g+=t[2*(A*n+a)+1]*(1-o)*r,l+=t[2*(A*n+h)+0]*o*r,g+=t[2*(A*n+h)+1]*o*r,[l,1-g]}generateMotionVectors(t,e){const i=0===t.bmotionvectorson?0:t.mv_a;let s=Math.floor(t.mv_x),r=Math.floor(t.mv_y);if(i>.001&&s>0&&r>0){let a=t.mv_x-s,o=t.mv_y-r;s>this.maxX&&(s=this.maxX,a=0),r>this.maxY&&(r=this.maxY,o=0);const h=t.mv_dx,A=t.mv_dy,n=t.mv_l,l=1/this.texsizeX;this.numVecVerts=0;for(let t=0;t1e-4&&i<.9999)for(let t=0;t1e-4&&r<.9999){const t=this.getMotionDir(e,r,i);let s=t[0],a=t[1],o=s-r,h=a-i;o*=n,h*=n;let A=Math.sqrt(o*o+h*h);A1e-8?(A=l/A,o*=A,h*=A):(o=l,o=l),s=r+o,a=i+h;const g=2*r-1,c=2*i-1,m=2*s-1,u=2*a-1;this.positions[3*this.numVecVerts+0]=g,this.positions[3*this.numVecVerts+1]=c,this.positions[3*this.numVecVerts+2]=0,this.positions[3*(this.numVecVerts+1)+0]=m,this.positions[3*(this.numVecVerts+1)+1]=u,this.positions[3*(this.numVecVerts+1)+2]=0,this.numVecVerts+=2}}}if(this.numVecVerts>0)return this.color=[t.mv_r,t.mv_g,t.mv_b,i],!0}return!1}drawMotionVectors(t,e){this.generateMotionVectors(t,e)&&(this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionVertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.aPosLoc,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.aPosLoc),this.gl.uniform4fv(this.colorLoc,this.color),this.gl.lineWidth(1),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.LINES,0,this.numVecVerts))}}class zt{constructor(t,e,i,s={}){this.gl=t,this.noise=e,this.image=i,this.rng=Rt(),this.texsizeX=s.texsizeX,this.texsizeY=s.texsizeY,this.mesh_width=s.mesh_width,this.mesh_height=s.mesh_height,this.aspectx=s.aspectx,this.aspecty=s.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.buildPositions(),this.indexBuf=t.createBuffer(),this.positionVertexBuf=this.gl.createBuffer(),this.warpUvVertexBuf=this.gl.createBuffer(),this.warpColorVertexBuf=this.gl.createBuffer(),this.floatPrecision=Ut.getFragmentFloatPrecision(this.gl),this.createShader(),this.mainSampler=this.gl.createSampler(),this.mainSamplerFW=this.gl.createSampler(),this.mainSamplerFC=this.gl.createSampler(),this.mainSamplerPW=this.gl.createSampler(),this.mainSamplerPC=this.gl.createSampler(),t.samplerParameteri(this.mainSampler,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.samplerParameteri(this.mainSampler,t.TEXTURE_MAG_FILTER,t.LINEAR),t.samplerParameteri(this.mainSampler,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.mainSampler,t.TEXTURE_WRAP_T,t.REPEAT),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_MAG_FILTER,t.LINEAR),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.mainSamplerFW,t.TEXTURE_WRAP_T,t.REPEAT),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_MAG_FILTER,t.LINEAR),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.samplerParameteri(this.mainSamplerFC,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_MAG_FILTER,t.NEAREST),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.mainSamplerPW,t.TEXTURE_WRAP_T,t.REPEAT),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_MAG_FILTER,t.NEAREST),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.samplerParameteri(this.mainSamplerPC,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}buildPositions(){const t=this.mesh_width,e=this.mesh_height,i=t+1,s=e+1,r=2/t,a=2/e,o=[];for(let t=0;t= 2.0) ? -1.0 : 1.0;\n vec2 uv_echo = ((uv - 0.5) *\n (1.0 / echo_zoom) *\n vec2(orient_x, orient_y)) + 0.5;\n\n ret = mix(texture(sampler_main, uv).rgb,\n texture(sampler_main, uv_echo).rgb,\n echo_alpha);\n\n ret *= gammaAdj;\n\n if(fShader >= 1.0) {\n ret *= hue_shader;\n } else if(fShader > 0.001) {\n ret *= (1.0 - fShader) + (fShader * hue_shader);\n }\n\n if(brighten != 0) ret = sqrt(ret);\n if(darken != 0) ret = ret*ret;\n if(solarize != 0) ret = ret * (1.0 - ret) * 4.0;\n if(invert != 0) ret = 1.0 - ret;",i="";else{const s=Ut.getShaderParts(t);i=s[0],e=s[1]}e=e.replace(/texture2D/g,"texture"),e=e.replace(/texture3D/g,"texture"),this.userTextures=Ut.getUserSamplers(i),this.shaderProgram=this.gl.createProgram();const s=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(s,"\n #version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n in vec4 aCompColor;\n out vec2 vUv;\n out vec4 vColor;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n vUv = aPos * halfmad + halfmad;\n vColor = aCompColor;\n }\n ".trim()),this.gl.compileShader(s);const r=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(r,`\n #version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n precision mediump sampler3D;\n\n vec3 lum(vec3 v){\n return vec3(dot(v, vec3(0.32,0.49,0.29)));\n }\n\n in vec2 vUv;\n in vec4 vColor;\n out vec4 fragColor;\n uniform sampler2D sampler_main;\n uniform sampler2D sampler_fw_main;\n uniform sampler2D sampler_fc_main;\n uniform sampler2D sampler_pw_main;\n uniform sampler2D sampler_pc_main;\n uniform sampler2D sampler_blur1;\n uniform sampler2D sampler_blur2;\n uniform sampler2D sampler_blur3;\n uniform sampler2D sampler_noise_lq;\n uniform sampler2D sampler_noise_lq_lite;\n uniform sampler2D sampler_noise_mq;\n uniform sampler2D sampler_noise_hq;\n uniform sampler2D sampler_pw_noise_lq;\n uniform sampler3D sampler_noisevol_lq;\n uniform sampler3D sampler_noisevol_hq;\n\n uniform float time;\n uniform float gammaAdj;\n uniform float echo_zoom;\n uniform float echo_alpha;\n uniform float echo_orientation;\n uniform int invert;\n uniform int brighten;\n uniform int darken;\n uniform int solarize;\n uniform vec2 resolution;\n uniform vec4 aspect;\n uniform vec4 texsize;\n uniform vec4 texsize_noise_lq;\n uniform vec4 texsize_noise_mq;\n uniform vec4 texsize_noise_hq;\n uniform vec4 texsize_noise_lq_lite;\n uniform vec4 texsize_noisevol_lq;\n uniform vec4 texsize_noisevol_hq;\n\n uniform float bass;\n uniform float mid;\n uniform float treb;\n uniform float vol;\n uniform float bass_att;\n uniform float mid_att;\n uniform float treb_att;\n uniform float vol_att;\n\n uniform float frame;\n uniform float fps;\n\n uniform vec4 _qa;\n uniform vec4 _qb;\n uniform vec4 _qc;\n uniform vec4 _qd;\n uniform vec4 _qe;\n uniform vec4 _qf;\n uniform vec4 _qg;\n uniform vec4 _qh;\n\n #define q1 _qa.x\n #define q2 _qa.y\n #define q3 _qa.z\n #define q4 _qa.w\n #define q5 _qb.x\n #define q6 _qb.y\n #define q7 _qb.z\n #define q8 _qb.w\n #define q9 _qc.x\n #define q10 _qc.y\n #define q11 _qc.z\n #define q12 _qc.w\n #define q13 _qd.x\n #define q14 _qd.y\n #define q15 _qd.z\n #define q16 _qd.w\n #define q17 _qe.x\n #define q18 _qe.y\n #define q19 _qe.z\n #define q20 _qe.w\n #define q21 _qf.x\n #define q22 _qf.y\n #define q23 _qf.z\n #define q24 _qf.w\n #define q25 _qg.x\n #define q26 _qg.y\n #define q27 _qg.z\n #define q28 _qg.w\n #define q29 _qh.x\n #define q30 _qh.y\n #define q31 _qh.z\n #define q32 _qh.w\n\n uniform vec4 slow_roam_cos;\n uniform vec4 roam_cos;\n uniform vec4 slow_roam_sin;\n uniform vec4 roam_sin;\n\n uniform float blur1_min;\n uniform float blur1_max;\n uniform float blur2_min;\n uniform float blur2_max;\n uniform float blur3_min;\n uniform float blur3_max;\n\n uniform float scale1;\n uniform float scale2;\n uniform float scale3;\n uniform float bias1;\n uniform float bias2;\n uniform float bias3;\n\n uniform vec4 rand_frame;\n uniform vec4 rand_preset;\n\n uniform float fShader;\n\n float PI = ${Math.PI};\n\n ${i}\n\n void main(void) {\n vec3 ret;\n vec2 uv = vUv;\n vec2 uv_orig = vUv;\n uv.y = 1.0 - uv.y;\n uv_orig.y = 1.0 - uv_orig.y;\n float rad = length(uv - 0.5);\n float ang = atan(uv.x - 0.5, uv.y - 0.5);\n vec3 hue_shader = vColor.rgb;\n\n ${e}\n\n fragColor = vec4(ret, vColor.a);\n }\n `.trim()),this.gl.compileShader(r),this.gl.attachShader(this.shaderProgram,s),this.gl.attachShader(this.shaderProgram,r),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.compColorLocation=this.gl.getAttribLocation(this.shaderProgram,"aCompColor"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_main"),this.textureFWLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_fw_main"),this.textureFCLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_fc_main"),this.texturePWLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_pw_main"),this.texturePCLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_pc_main"),this.blurTexture1Loc=this.gl.getUniformLocation(this.shaderProgram,"sampler_blur1"),this.blurTexture2Loc=this.gl.getUniformLocation(this.shaderProgram,"sampler_blur2"),this.blurTexture3Loc=this.gl.getUniformLocation(this.shaderProgram,"sampler_blur3"),this.noiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_lq"),this.noiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_mq"),this.noiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_hq"),this.noiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noise_lq_lite"),this.noisePointLQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_pw_noise_lq"),this.noiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noisevol_lq"),this.noiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,"sampler_noisevol_hq"),this.timeLoc=this.gl.getUniformLocation(this.shaderProgram,"time"),this.gammaAdjLoc=this.gl.getUniformLocation(this.shaderProgram,"gammaAdj"),this.echoZoomLoc=this.gl.getUniformLocation(this.shaderProgram,"echo_zoom"),this.echoAlphaLoc=this.gl.getUniformLocation(this.shaderProgram,"echo_alpha"),this.echoOrientationLoc=this.gl.getUniformLocation(this.shaderProgram,"echo_orientation"),this.invertLoc=this.gl.getUniformLocation(this.shaderProgram,"invert"),this.brightenLoc=this.gl.getUniformLocation(this.shaderProgram,"brighten"),this.darkenLoc=this.gl.getUniformLocation(this.shaderProgram,"darken"),this.solarizeLoc=this.gl.getUniformLocation(this.shaderProgram,"solarize"),this.texsizeLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize"),this.texsizeNoiseLQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_lq"),this.texsizeNoiseMQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_mq"),this.texsizeNoiseHQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_hq"),this.texsizeNoiseLQLiteLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noise_lq_lite"),this.texsizeNoiseVolLQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noisevol_lq"),this.texsizeNoiseVolHQLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize_noisevol_hq"),this.resolutionLoc=this.gl.getUniformLocation(this.shaderProgram,"resolution"),this.aspectLoc=this.gl.getUniformLocation(this.shaderProgram,"aspect"),this.bassLoc=this.gl.getUniformLocation(this.shaderProgram,"bass"),this.midLoc=this.gl.getUniformLocation(this.shaderProgram,"mid"),this.trebLoc=this.gl.getUniformLocation(this.shaderProgram,"treb"),this.volLoc=this.gl.getUniformLocation(this.shaderProgram,"vol"),this.bassAttLoc=this.gl.getUniformLocation(this.shaderProgram,"bass_att"),this.midAttLoc=this.gl.getUniformLocation(this.shaderProgram,"mid_att"),this.trebAttLoc=this.gl.getUniformLocation(this.shaderProgram,"treb_att"),this.volAttLoc=this.gl.getUniformLocation(this.shaderProgram,"vol_att"),this.frameLoc=this.gl.getUniformLocation(this.shaderProgram,"frame"),this.fpsLoc=this.gl.getUniformLocation(this.shaderProgram,"fps"),this.blur1MinLoc=this.gl.getUniformLocation(this.shaderProgram,"blur1_min"),this.blur1MaxLoc=this.gl.getUniformLocation(this.shaderProgram,"blur1_max"),this.blur2MinLoc=this.gl.getUniformLocation(this.shaderProgram,"blur2_min"),this.blur2MaxLoc=this.gl.getUniformLocation(this.shaderProgram,"blur2_max"),this.blur3MinLoc=this.gl.getUniformLocation(this.shaderProgram,"blur3_min"),this.blur3MaxLoc=this.gl.getUniformLocation(this.shaderProgram,"blur3_max"),this.scale1Loc=this.gl.getUniformLocation(this.shaderProgram,"scale1"),this.scale2Loc=this.gl.getUniformLocation(this.shaderProgram,"scale2"),this.scale3Loc=this.gl.getUniformLocation(this.shaderProgram,"scale3"),this.bias1Loc=this.gl.getUniformLocation(this.shaderProgram,"bias1"),this.bias2Loc=this.gl.getUniformLocation(this.shaderProgram,"bias2"),this.bias3Loc=this.gl.getUniformLocation(this.shaderProgram,"bias3"),this.randPresetLoc=this.gl.getUniformLocation(this.shaderProgram,"rand_preset"),this.randFrameLoc=this.gl.getUniformLocation(this.shaderProgram,"rand_frame"),this.fShaderLoc=this.gl.getUniformLocation(this.shaderProgram,"fShader"),this.qaLoc=this.gl.getUniformLocation(this.shaderProgram,"_qa"),this.qbLoc=this.gl.getUniformLocation(this.shaderProgram,"_qb"),this.qcLoc=this.gl.getUniformLocation(this.shaderProgram,"_qc"),this.qdLoc=this.gl.getUniformLocation(this.shaderProgram,"_qd"),this.qeLoc=this.gl.getUniformLocation(this.shaderProgram,"_qe"),this.qfLoc=this.gl.getUniformLocation(this.shaderProgram,"_qf"),this.qgLoc=this.gl.getUniformLocation(this.shaderProgram,"_qg"),this.qhLoc=this.gl.getUniformLocation(this.shaderProgram,"_qh"),this.slowRoamCosLoc=this.gl.getUniformLocation(this.shaderProgram,"slow_roam_cos"),this.roamCosLoc=this.gl.getUniformLocation(this.shaderProgram,"roam_cos"),this.slowRoamSinLoc=this.gl.getUniformLocation(this.shaderProgram,"slow_roam_sin"),this.roamSinLoc=this.gl.getUniformLocation(this.shaderProgram,"roam_sin");for(let t=0;t lumaMax))\n color = vec4(rgbA, 1.0);\n else\n color = vec4(rgbB, 1.0);\n\n fragColor = color;\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.texsizeLoc=this.gl.getUniformLocation(this.shaderProgram,"texsize")}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"#version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }"),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n\n void main(void) {\n fragColor = vec4(texture(uTexture, uv).rgb, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture")}renderQuadTexture(t){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(this.textureLoc,0),this.useFXAA()&&this.gl.uniform4fv(this.texsizeLoc,new Float32Array([this.texsizeX,this.texsizeY,1/this.texsizeX,1/this.texsizeY])),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class kt{constructor(t){this.gl=t,this.positions=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.vertexBuf=this.gl.createBuffer(),this.floatPrecision=Ut.getFragmentFloatPrecision(this.gl),this.createShader()}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"#version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }"),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n\n void main(void) {\n fragColor = vec4(texture(uTexture, uv).rgb, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture")}renderQuadTexture(t){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.uniform1i(this.textureLoc,0),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class Gt{constructor(t,e){this.gl=t,this.blurLevel=e;const i=[4,3.8,3.5,2.9,1.9,1.2,.7,.3],s=i[0]+i[1]+i[2]+i[3],r=i[4]+i[5]+i[6]+i[7],a=0+(i[2]+i[3])/s*2,o=2+(i[6]+i[7])/r*2;this.wds=new Float32Array([s,r,a,o]),this.wDiv=1/(2*(s+r)),this.positions=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.vertexBuf=this.gl.createBuffer(),this.floatPrecision=Ut.getFragmentFloatPrecision(this.gl),this.createShader()}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n uniform vec4 texsize;\n uniform float ed1;\n uniform float ed2;\n uniform float ed3;\n uniform vec4 wds;\n uniform float wdiv;\n\n void main(void) {\n float w1 = wds[0];\n float w2 = wds[1];\n float d1 = wds[2];\n float d2 = wds[3];\n\n vec2 uv2 = uv.xy;\n\n vec3 blur =\n ( texture(uTexture, uv2 + vec2(0.0, d1 * texsize.w) ).xyz\n + texture(uTexture, uv2 + vec2(0.0,-d1 * texsize.w) ).xyz) * w1 +\n ( texture(uTexture, uv2 + vec2(0.0, d2 * texsize.w) ).xyz\n + texture(uTexture, uv2 + vec2(0.0,-d2 * texsize.w) ).xyz) * w2;\n\n blur.xyz *= wdiv;\n\n float t = min(min(uv.x, uv.y), 1.0 - max(uv.x, uv.y));\n t = sqrt(t);\n t = ed1 + ed2 * clamp(t * ed3, 0.0, 1.0);\n blur.xyz *= t;\n\n fragColor = vec4(blur, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.texsizeLocation=this.gl.getUniformLocation(this.shaderProgram,"texsize"),this.ed1Loc=this.gl.getUniformLocation(this.shaderProgram,"ed1"),this.ed2Loc=this.gl.getUniformLocation(this.shaderProgram,"ed2"),this.ed3Loc=this.gl.getUniformLocation(this.shaderProgram,"ed3"),this.wdsLocation=this.gl.getUniformLocation(this.shaderProgram,"wds"),this.wdivLoc=this.gl.getUniformLocation(this.shaderProgram,"wdiv")}renderQuadTexture(t,e,i){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(this.textureLoc,0);const s=0===this.blurLevel?e.b1ed:0;this.gl.uniform4fv(this.texsizeLocation,[i[0],i[1],1/i[0],1/i[1]]),this.gl.uniform1f(this.ed1Loc,1-s),this.gl.uniform1f(this.ed2Loc,s),this.gl.uniform1f(this.ed3Loc,5),this.gl.uniform4fv(this.wdsLocation,this.wds),this.gl.uniform1f(this.wdivLoc,this.wDiv),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class Ot{constructor(t,e){this.gl=t,this.blurLevel=e;const i=[4,3.8,3.5,2.9,1.9,1.2,.7,.3],s=i[0]+i[1],r=i[2]+i[3],a=i[4]+i[5],o=i[6]+i[7],h=0+2*i[1]/s,A=2+2*i[3]/r,n=4+2*i[5]/a,l=6+2*i[7]/o;this.ws=new Float32Array([s,r,a,o]),this.ds=new Float32Array([h,A,n,l]),this.wDiv=.5/(s+r+a+o),this.positions=new Float32Array([-1,-1,1,-1,-1,1,1,1]),this.vertexBuf=this.gl.createBuffer(),this.floatPrecision=Ut.getFragmentFloatPrecision(this.gl),this.createShader()}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"\n #version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv = aPos * halfmad + halfmad;\n }\n ".trim()),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n uniform vec4 texsize;\n uniform float scale;\n uniform float bias;\n uniform vec4 ws;\n uniform vec4 ds;\n uniform float wdiv;\n\n void main(void) {\n float w1 = ws[0];\n float w2 = ws[1];\n float w3 = ws[2];\n float w4 = ws[3];\n float d1 = ds[0];\n float d2 = ds[1];\n float d3 = ds[2];\n float d4 = ds[3];\n\n vec2 uv2 = uv.xy;\n\n vec3 blur =\n ( texture(uTexture, uv2 + vec2( d1 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d1 * texsize.z,0.0) ).xyz) * w1 +\n ( texture(uTexture, uv2 + vec2( d2 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d2 * texsize.z,0.0) ).xyz) * w2 +\n ( texture(uTexture, uv2 + vec2( d3 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d3 * texsize.z,0.0) ).xyz) * w3 +\n ( texture(uTexture, uv2 + vec2( d4 * texsize.z,0.0) ).xyz\n + texture(uTexture, uv2 + vec2(-d4 * texsize.z,0.0) ).xyz) * w4;\n\n blur.xyz *= wdiv;\n blur.xyz = blur.xyz * scale + bias;\n\n fragColor = vec4(blur, 1.0);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.texsizeLocation=this.gl.getUniformLocation(this.shaderProgram,"texsize"),this.scaleLoc=this.gl.getUniformLocation(this.shaderProgram,"scale"),this.biasLoc=this.gl.getUniformLocation(this.shaderProgram,"bias"),this.wsLoc=this.gl.getUniformLocation(this.shaderProgram,"ws"),this.dsLocation=this.gl.getUniformLocation(this.shaderProgram,"ds"),this.wdivLoc=this.gl.getUniformLocation(this.shaderProgram,"wdiv")}getScaleAndBias(t,e){const i=[1,1,1],s=[0,0,0];let r,a;return i[0]=1/(e[0]-t[0]),s[0]=-t[0]*i[0],r=(t[1]-t[0])/(e[0]-t[0]),a=(e[1]-t[0])/(e[0]-t[0]),i[1]=1/(a-r),s[1]=-r*i[1],r=(t[2]-t[1])/(e[1]-t[1]),a=(e[2]-t[1])/(e[1]-t[1]),i[2]=1/(a-r),s[2]=-r*i[2],{scale:i[this.blurLevel],bias:s[this.blurLevel]}}renderQuadTexture(t,e,i,s,r){this.gl.useProgram(this.shaderProgram),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertexBuf),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.positions,this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this.positionLocation,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this.positionLocation),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.uniform1i(this.textureLoc,0);const{scale:a,bias:o}=this.getScaleAndBias(i,s);this.gl.uniform4fv(this.texsizeLocation,[r[0],r[1],1/r[0],1/r[1]]),this.gl.uniform1f(this.scaleLoc,a),this.gl.uniform1f(this.biasLoc,o),this.gl.uniform4fv(this.wsLoc,this.ws),this.gl.uniform4fv(this.dsLocation,this.ds),this.gl.uniform1f(this.wdivLoc,this.wDiv),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}}class Wt{constructor(t,e,i,s={}){this.blurLevel=t,this.blurRatios=e,this.gl=i,this.texsizeX=s.texsizeX,this.texsizeY=s.texsizeY,this.anisoExt=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.blurHorizontalFrameBuffer=this.gl.createFramebuffer(),this.blurVerticalFrameBuffer=this.gl.createFramebuffer(),this.blurHorizontalTexture=this.gl.createTexture(),this.blurVerticalTexture=this.gl.createTexture(),this.setupFrameBufferTextures(),this.blurHorizontal=new Ot(i,this.blurLevel,s),this.blurVertical=new Gt(i,this.blurLevel,s)}updateGlobals(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.setupFrameBufferTextures()}getTextureSize(t){let e=Math.max(this.texsizeX*t,16);e=16*Math.floor((e+3)/16);let i=Math.max(this.texsizeY*t,16);return i=4*Math.floor((i+3)/4),[e,i]}setupFrameBufferTextures(){const t=this.blurLevel>0?this.blurRatios[this.blurLevel-1]:[1,1],e=this.blurRatios[this.blurLevel],i=this.getTextureSize(t[1]),s=this.getTextureSize(e[0]);this.bindFrameBufferTexture(this.blurHorizontalFrameBuffer,this.blurHorizontalTexture,s);const r=s,a=this.getTextureSize(e[1]);this.bindFrameBufferTexture(this.blurVerticalFrameBuffer,this.blurVerticalTexture,a),this.horizontalTexsizes=[i,s],this.verticalTexsizes=[r,a]}bindFrambufferAndSetViewport(t,e){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.viewport(0,0,e[0],e[1])}bindFrameBufferTexture(t,e,i){if(this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,i[0],i[1],0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,new Uint8Array(i[0]*i[1]*4)),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_2D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e,0)}renderBlurTexture(t,e,i,s){this.bindFrambufferAndSetViewport(this.blurHorizontalFrameBuffer,this.horizontalTexsizes[1]),this.blurHorizontal.renderQuadTexture(t,e,i,s,this.horizontalTexsizes[0]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.blurHorizontalTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.bindFrambufferAndSetViewport(this.blurVerticalFrameBuffer,this.verticalTexsizes[1]),this.blurVertical.renderQuadTexture(this.blurHorizontalTexture,e,this.verticalTexsizes[0]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.blurVerticalTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D)}}class Yt{constructor(t){this.gl=t,this.randomFn=Rt().random,this.anisoExt=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.noiseTexLQ=this.gl.createTexture(),this.noiseTexLQLite=this.gl.createTexture(),this.noiseTexMQ=this.gl.createTexture(),this.noiseTexHQ=this.gl.createTexture(),this.noiseTexVolLQ=this.gl.createTexture(),this.noiseTexVolHQ=this.gl.createTexture(),this.nTexArrLQ=Yt.createNoiseTex(256,1,this.randomFn),this.nTexArrLQLite=Yt.createNoiseTex(32,1,this.randomFn),this.nTexArrMQ=Yt.createNoiseTex(256,4,this.randomFn),this.nTexArrHQ=Yt.createNoiseTex(256,8,this.randomFn),this.nTexArrVolLQ=Yt.createNoiseVolTex(32,1,this.randomFn),this.nTexArrVolHQ=Yt.createNoiseVolTex(32,4,this.randomFn),this.bindTexture(this.noiseTexLQ,this.nTexArrLQ,256,256),this.bindTexture(this.noiseTexLQLite,this.nTexArrLQLite,32,32),this.bindTexture(this.noiseTexMQ,this.nTexArrMQ,256,256),this.bindTexture(this.noiseTexHQ,this.nTexArrHQ,256,256),this.bindTexture3D(this.noiseTexVolLQ,this.nTexArrVolLQ,32,32,32),this.bindTexture3D(this.noiseTexVolHQ,this.nTexArrVolHQ,32,32,32),this.noiseTexPointLQ=this.gl.createSampler(),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_MAG_FILTER,t.NEAREST),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_WRAP_S,t.REPEAT),t.samplerParameteri(this.noiseTexPointLQ,t.TEXTURE_WRAP_T,t.REPEAT)}bindTexture(t,e,i,s){if(this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,i,s,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_2D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}}bindTexture3D(t,e,i,s,r){if(this.gl.bindTexture(this.gl.TEXTURE_3D,t),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage3D(this.gl.TEXTURE_3D,0,this.gl.RGBA,i,s,r,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.generateMipmap(this.gl.TEXTURE_3D),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_R,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_3D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}}static fCubicInterpolate(t,e,i,s,r){const a=r*r,o=s-i-t+e;return o*(r*a)+(t-e-o)*a+(i-t)*r+e}static dwCubicInterpolate(t,e,i,s,r){const a=[];for(let o=0;o<4;o++){let h=Yt.fCubicInterpolate(t[o]/255,e[o]/255,i[o]/255,s[o]/255,r);h=Math.clamp(h,0,1),a[o]=255*h}return a}static createNoiseVolTex(t,e,i){const s=t*t*t,r=new Uint8Array(4*s),a=e>1?216:256,o=.5*a;for(let t=0;t1){for(let i=0;i1?216:256,o=.5*a;for(let t=0;t1){for(let i=0;i{this.samplers.clouds2=this.gl.createTexture(),this.bindTexture(this.samplers.clouds2,this.clouds2Image,128,128)},this.clouds2Image.src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4RP+RXhpZgAASUkqAAgAAAAJAA8BAgAGAAAAegAAABABAgAVAAAAgAAAABIBAwABAAAAAQAAABoBBQABAAAAoAAAABsBBQABAAAAqAAAACgBAwABAAAAAgAAADIBAgAUAAAAsAAAABMCAwABAAAAAQAAAGmHBAABAAAAxAAAAGYFAABDYW5vbgBDYW5vbiBQb3dlclNob3QgUzExMAAAAAAAAAAAAAAAAEgAAAABAAAASAAAAAEAAAAyMDAyOjAxOjE5IDE3OjMzOjIwABsAmoIFAAEAAABWAwAAnYIFAAEAAABeAwAAAJAHAAQAAAAwMjEwA5ACABQAAAAOAgAABJACABQAAAAiAgAAAZEHAAQAAAABAgMAApEFAAEAAAA+AwAAAZIKAAEAAABGAwAAApIFAAEAAABOAwA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9DVdo1j6nIpK31QaoylfqMEEDCgBoHl0OU7HVUm2VpS3wpvGc8d9ak6WVGL1IdnW51Ht6NMmuO+ozMGGHMEYKSBhJAPIOO5OfGqC//h1doNVcnUOnThGUopKS0HAoc9iO/wDHjUqak0bGNxz+lQtbK3xrX//Z",this.emptyImage=new Image,this.emptyImage.onload=()=>{this.samplers.empty=this.gl.createTexture(),this.bindTexture(this.samplers.empty,this.emptyImage,1,1)},this.emptyImage.src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="}bindTexture(t,e,i,s){if(this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,i,s,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.anisoExt){const t=this.gl.getParameter(this.anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);this.gl.texParameterf(this.gl.TEXTURE_2D,this.anisoExt.TEXTURE_MAX_ANISOTROPY_EXT,t)}}loadExtraImages(t){Object.keys(t).forEach(e=>{const{data:i,width:s,height:r}=t[e];if(!this.samplers[e]){const t=new Image;t.onload=()=>{this.samplers[e]=this.gl.createTexture(),this.bindTexture(this.samplers[e],t,s,r)},t.src=i}})}getTexture(t){const e=this.samplers[t];return e||this.samplers.clouds2}}class Kt{constructor(t,e={}){this.gl=t,this.texsizeX=e.texsizeX,this.texsizeY=e.texsizeY,this.aspectx=e.aspectx,this.aspecty=e.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.buildPositions(),this.textTexture=this.gl.createTexture(),this.indexBuf=t.createBuffer(),this.positionVertexBuf=this.gl.createBuffer(),this.vertexBuf=this.gl.createBuffer(),this.canvas=document.createElement("canvas"),this.canvas.width=this.texsizeX,this.canvas.height=this.texsizeY,this.context2D=this.canvas.getContext("2d",{willReadFrequently:!1}),this.floatPrecision=Ut.getFragmentFloatPrecision(this.gl),this.createShader()}generateTitleTexture(t){this.context2D.clearRect(0,0,this.texsizeX,this.texsizeY),this.fontSize=Math.floor(this.texsizeX/256*16),this.fontSize=Math.max(this.fontSize,6),this.context2D.font=`italic ${this.fontSize}px Times New Roman`;let e=t,i=this.context2D.measureText(e).width;if(i>this.texsizeX){const t=this.texsizeX/i*.91;e=`${e.substring(0,Math.floor(e.length*t))}...`,i=this.context2D.measureText(e).width}this.context2D.fillStyle="#FFFFFF",this.context2D.fillText(e,(this.texsizeX-i)/2,this.texsizeY/2);const s=new Uint8Array(this.context2D.getImageData(0,0,this.texsizeX,this.texsizeY).data.buffer);this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.textTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.texsizeX,this.texsizeY,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR_MIPMAP_LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.bindTexture(this.gl.TEXTURE_2D,null)}updateGlobals(t){this.texsizeX=t.texsizeX,this.texsizeY=t.texsizeY,this.aspectx=t.aspectx,this.aspecty=t.aspecty,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.canvas.width=this.texsizeX,this.canvas.height=this.texsizeY}buildPositions(){const t=2/15,e=2/7,i=[];for(let s=0;s<8;s++){const r=s*e-1;for(let e=0;e<16;e++){const s=e*t-1;i.push(s,-r,0)}}const s=[];for(let t=0;t<7;t++)for(let e=0;e<15;e++){const i=e+16*t,r=e+16*(t+1),a=e+1+16*(t+1),o=e+1+16*t;s.push(i,r,o),s.push(r,a,o)}this.vertices=new Float32Array(i),this.indices=new Uint16Array(s)}createShader(){this.shaderProgram=this.gl.createProgram();const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,"#version 300 es\n const vec2 halfmad = vec2(0.5);\n in vec2 aPos;\n in vec2 aUv;\n out vec2 uv_orig;\n out vec2 uv;\n void main(void) {\n gl_Position = vec4(aPos, 0.0, 1.0);\n uv_orig = aPos * halfmad + halfmad;\n uv = aUv;\n }"),this.gl.compileShader(t);const e=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(e,`#version 300 es\n precision ${this.floatPrecision} float;\n precision highp int;\n precision mediump sampler2D;\n\n in vec2 uv_orig;\n in vec2 uv;\n out vec4 fragColor;\n uniform sampler2D uTexture;\n uniform float textColor;\n\n void main(void) {\n fragColor = texture(uTexture, uv) * vec4(textColor);\n }`),this.gl.compileShader(e),this.gl.attachShader(this.shaderProgram,t),this.gl.attachShader(this.shaderProgram,e),this.gl.linkProgram(this.shaderProgram),this.positionLocation=this.gl.getAttribLocation(this.shaderProgram,"aPos"),this.uvLocation=this.gl.getAttribLocation(this.shaderProgram,"aUv"),this.textureLoc=this.gl.getUniformLocation(this.shaderProgram,"uTexture"),this.textColorLoc=this.gl.getUniformLocation(this.shaderProgram,"textColor")}generateUvs(t,e,i){const s=[];for(let i=0;i<8;i++)for(let r=0;r<16;r++){const a=2*(r/15)-1;let o=2*(.75*(i/7-.5)+.5)-1;t>=1&&(o+=1/this.texsizeY),s.push(a,e?o:-o)}const r=Math.max(0,1-1.5*t)**1.8*1.3;for(let t=0;t<8;t++)for(let e=0;e<16;e++){const a=16*t+e;s[a]+=.07*r*Math.sin(.31*i.time+.39*s[a]-1.94*s[a+1]),s[a]+=.044*r*Math.sin(.81*i.time-1.91*s[a]+.27*s[a+1]),s[a]+=.061*r*Math.sin(1.31*i.time+.61*s[a]+.74*s[a+1]),s[a+1]+=.061*r*Math.sin(.37*i.time+1.83*s[a]+.69*s[a+1]),s[a+1]+=.07*r*Math.sin(.67*i.time+.42*s[a]-1.39*s[a+1]),s[a+1]+=.087*r*Math.sin(1.07*i.time+3.55*s[a]+.89*s[a+1])}const a=1.01/(t**.21+.01);for(let t=0;t=2&&(0===t&&(this.vertInfoC[o*(this.mesh_width+1)+t]=.5*(h+n)+(2*this.rng.random()-1)*r*this.aspecty),this.vertInfoC[o*(this.mesh_width+1)+e]=.5*(A+l)+(2*this.rng.random()-1)*r*this.aspecty),e-t>=2&&(0===i&&(this.vertInfoC[i*(this.mesh_width+1)+a]=.5*(h+A)+(2*this.rng.random()-1)*r*this.aspectx),this.vertInfoC[s*(this.mesh_width+1)+a]=.5*(n+l)+(2*this.rng.random()-1)*r*this.aspectx),s-i>=2&&e-t>=2&&(h=this.vertInfoC[o*(this.mesh_width+1)+t],A=this.vertInfoC[o*(this.mesh_width+1)+e],n=this.vertInfoC[i*(this.mesh_width+1)+a],l=this.vertInfoC[s*(this.mesh_width+1)+a],this.vertInfoC[o*(this.mesh_width+1)+a]=.25*(n+l+h+A)+(2*this.rng.random()-1)*r,this.genPlasma(t,a,i,o,.5*r),this.genPlasma(a,e,i,o,.5*r),this.genPlasma(t,a,o,s,.5*r),this.genPlasma(a,e,o,s,.5*r))}createBlendPattern(){const t=1+Math.floor(3*this.rng.random());if(0===t){let t=0;for(let e=0;e<=this.mesh_height;e++)for(let e=0;e<=this.mesh_width;e++)this.vertInfoA[t]=1,this.vertInfoC[t]=0,t+=1}else if(1===t){const t=6.28*this.rng.random(),e=Math.cos(t),i=Math.sin(t),s=.1+.2*this.rng.random(),r=1/s;let a=0;for(let t=0;t<=this.mesh_height;t++){const o=t/this.mesh_height*this.aspecty;for(let t=0;t<=this.mesh_width;t++){let h=(t/this.mesh_width*this.aspectx-.5)*e+(o-.5)*i+.5;h=(h-.5)/Math.sqrt(2)+.5,this.vertInfoA[a]=r*(1+s),this.vertInfoC[a]=r*h-r,a+=1}}}else if(2===t){const t=.12+.13*this.rng.random(),e=1/t;this.vertInfoC[0]=this.rng.random(),this.vertInfoC[this.mesh_width]=this.rng.random(),this.vertInfoC[this.mesh_height*(this.mesh_width+1)]=this.rng.random(),this.vertInfoC[this.mesh_height*(this.mesh_width+1)+this.mesh_width]=this.rng.random(),this.genPlasma(0,this.mesh_width,0,this.mesh_height,.25);let i=this.vertInfoC[0],s=this.vertInfoC[0],r=0;for(let t=0;t<=this.mesh_height;t++)for(let t=0;t<=this.mesh_width;t++)i>this.vertInfoC[r]&&(i=this.vertInfoC[r]),sthis.texsizeX?this.texsizeX/this.texsizeY:1,this.aspecty=this.texsizeX>this.texsizeY?this.texsizeY/this.texsizeX:1,this.invAspectx=1/this.aspectx,this.invAspecty=1/this.aspecty,this.qs=vt.range(1,33).map(t=>`q${t}`),this.ts=vt.range(1,9).map(t=>`t${t}`),this.regs=vt.range(0,100).map(t=>t<10?`reg0${t}`:`reg${t}`),this.blurRatios=[[.5,.25],[.125,.125],[.0625,.0625]],this.audioLevels=new bt(this.audio),this.prevFrameBuffer=this.gl.createFramebuffer(),this.targetFrameBuffer=this.gl.createFramebuffer(),this.prevTexture=this.gl.createTexture(),this.targetTexture=this.gl.createTexture(),this.compFrameBuffer=this.gl.createFramebuffer(),this.compTexture=this.gl.createTexture(),this.anisoExt=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.bindFrameBufferTexture(this.prevFrameBuffer,this.prevTexture),this.bindFrameBufferTexture(this.targetFrameBuffer,this.targetTexture),this.bindFrameBufferTexture(this.compFrameBuffer,this.compTexture);const s={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};this.noise=new Yt(t),this.image=new Jt(t),this.warpShader=new zt(t,this.noise,this.image,s),this.compShader=new Nt(t,this.noise,this.image,s),this.outputShader=new Xt(t,s),this.prevWarpShader=new zt(t,this.noise,this.image,s),this.prevCompShader=new Nt(t,this.noise,this.image,s),this.numBlurPasses=0,this.blurShader1=new Wt(0,this.blurRatios,t,s),this.blurShader2=new Wt(1,this.blurRatios,t,s),this.blurShader3=new Wt(2,this.blurRatios,t,s),this.blurTexture1=this.blurShader1.blurVerticalTexture,this.blurTexture2=this.blurShader2.blurVerticalTexture,this.blurTexture3=this.blurShader3.blurVerticalTexture,this.basicWaveform=new Ft(t,s),this.customWaveforms=vt.range(4).map(e=>new Qt(e,t,s)),this.customShapes=vt.range(4).map(e=>new Mt(e,t,s)),this.prevCustomWaveforms=vt.range(4).map(e=>new Qt(e,t,s)),this.prevCustomShapes=vt.range(4).map(e=>new Mt(e,t,s)),this.darkenCenter=new Vt(t,s),this.innerBorder=new Dt(t,s),this.outerBorder=new Dt(t,s),this.motionVectors=new qt(t,s),this.titleText=new Kt(t,s),this.blendPattern=new jt(s),this.resampleShader=new kt(t),this.supertext={startTime:-1},this.warpUVs=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*2),this.warpColor=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*4),this.gl.clearColor(0,0,0,1),this.blankPreset=xt;const r={frame:0,time:0,fps:45,bass:1,bass_att:1,mid:1,mid_att:1,treb:1,treb_att:1};this.preset=xt,this.prevPreset=this.preset,this.presetEquationRunner=new It(this.preset,r,s),this.prevPresetEquationRunner=new It(this.prevPreset,r,s),this.preset.useWASM||(this.regVars=this.presetEquationRunner.mdVSRegs)}static getHighestBlur(t){return/sampler_blur3/.test(t)?3:/sampler_blur2/.test(t)?2:/sampler_blur1/.test(t)?1:0}loadPreset(t,e){this.blendPattern.createBlendPattern(),this.blending=!0,this.blendStartTime=this.time,this.blendDuration=e,this.blendProgress=0,this.prevPresetEquationRunner=this.presetEquationRunner,this.prevPreset=this.preset,this.preset=t,this.presetTime=this.time;const i={frame:this.frameNum,time:this.time,fps:this.fps,bass:this.audioLevels.bass,bass_att:this.audioLevels.bass_att,mid:this.audioLevels.mid,mid_att:this.audioLevels.mid_att,treb:this.audioLevels.treb,treb_att:this.audioLevels.treb_att},s={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};t.useWASM?(this.preset.globalPools.perFrame.old_wave_mode.value=this.prevPreset.baseVals.wave_mode,this.preset.baseVals.old_wave_mode=this.prevPreset.baseVals.wave_mode,this.presetEquationRunner=new yt(this.preset,i,s),this.preset.pixel_eqs_initialize_array&&this.preset.pixel_eqs_initialize_array(this.mesh_width,this.mesh_height)):(this.preset.baseVals.old_wave_mode=this.prevPreset.baseVals.wave_mode,this.presetEquationRunner=new It(this.preset,i,s),this.regVars=this.presetEquationRunner.mdVSRegs);const r=this.prevWarpShader;this.prevWarpShader=this.warpShader,this.warpShader=r;const a=this.prevCompShader;this.prevCompShader=this.compShader,this.compShader=a;const o=this.preset.warp.trim(),h=this.preset.comp.trim();this.warpShader.updateShader(o),this.compShader.updateShader(h),0===o.length?this.numBlurPasses=0:this.numBlurPasses=Ht.getHighestBlur(o),0!==h.length&&(this.numBlurPasses=Math.max(this.numBlurPasses,Ht.getHighestBlur(h)))}loadExtraImages(t){this.image.loadExtraImages(t)}setRendererSize(t,e,i){const s=this.texsizeX,r=this.texsizeY;if(this.width=t,this.height=e,this.mesh_width=i.meshWidth||this.mesh_width,this.mesh_height=i.meshHeight||this.mesh_height,this.pixelRatio=i.pixelRatio||this.pixelRatio,this.textureRatio=i.textureRatio||this.textureRatio,this.texsizeX=t*this.pixelRatio*this.textureRatio,this.texsizeY=e*this.pixelRatio*this.textureRatio,this.aspectx=this.texsizeY>this.texsizeX?this.texsizeX/this.texsizeY:1,this.aspecty=this.texsizeX>this.texsizeY?this.texsizeY/this.texsizeX:1,this.texsizeX!==s||this.texsizeY!==r){const t=this.gl.createTexture();this.bindFrameBufferTexture(this.targetFrameBuffer,t),this.bindFrambufferAndSetViewport(this.targetFrameBuffer,this.texsizeX,this.texsizeY),this.resampleShader.renderQuadTexture(this.targetTexture),this.targetTexture=t,this.bindFrameBufferTexture(this.prevFrameBuffer,this.prevTexture),this.bindFrameBufferTexture(this.compFrameBuffer,this.compTexture)}this.updateGlobals(),this.frameNum>0&&this.renderToScreen()}setInternalMeshSize(t,e){this.mesh_width=t,this.mesh_height=e,this.updateGlobals()}setOutputAA(t){this.outputFXAA=t}updateGlobals(){const t={pixelRatio:this.pixelRatio,textureRatio:this.textureRatio,texsizeX:this.texsizeX,texsizeY:this.texsizeY,mesh_width:this.mesh_width,mesh_height:this.mesh_height,aspectx:this.aspectx,aspecty:this.aspecty};this.presetEquationRunner.updateGlobals(t),this.prevPresetEquationRunner.updateGlobals(t),this.warpShader.updateGlobals(t),this.prevWarpShader.updateGlobals(t),this.compShader.updateGlobals(t),this.prevCompShader.updateGlobals(t),this.outputShader.updateGlobals(t),this.blurShader1.updateGlobals(t),this.blurShader2.updateGlobals(t),this.blurShader3.updateGlobals(t),this.basicWaveform.updateGlobals(t),this.customWaveforms.forEach(e=>e.updateGlobals(t)),this.customShapes.forEach(e=>e.updateGlobals(t)),this.prevCustomWaveforms.forEach(e=>e.updateGlobals(t)),this.prevCustomShapes.forEach(e=>e.updateGlobals(t)),this.darkenCenter.updateGlobals(t),this.innerBorder.updateGlobals(t),this.outerBorder.updateGlobals(t),this.motionVectors.updateGlobals(t),this.titleText.updateGlobals(t),this.blendPattern.updateGlobals(t),this.warpUVs=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*2),this.warpColor=new Float32Array((this.mesh_width+1)*(this.mesh_height+1)*4),this.preset.pixel_eqs_initialize_array&&this.preset.pixel_eqs_initialize_array(this.mesh_width,this.mesh_height)}calcTimeAndFPS(t){let e;if(t)e=t;else{const t=performance.now();e=(t-this.lastTime)/1e3,(e>1||e<0||this.frame<2)&&(e=1/30),this.lastTime=t}this.time+=1/this.fps,this.blending&&(this.blendProgress=(this.time-this.blendStartTime)/this.blendDuration,this.blendProgress>1&&(this.blending=!1));const i=this.timeHist[this.timeHist.length-1]+e;this.timeHist.push(i),this.timeHist.length>this.timeHistMax&&this.timeHist.shift();const s=this.timeHist.length/(i-this.timeHist[0]);if(Math.abs(s-this.fps)>3&&this.frame>this.timeHistMax)this.fps=s;else{const t=.93;this.fps=t*this.fps+(1-t)*s}}runPixelEquations(t,e,i,s){const r=this.mesh_width,a=this.mesh_height,o=r+1,h=a+1,A=this.time*e.warpanimspeed,n=1/e.warpscale,l=11.68+4*Math.cos(1.413*A+10),g=8.77+3*Math.cos(1.113*A+7),c=10.54+3*Math.cos(1.233*A+3),m=11.49+4*Math.cos(.933*A+5),u=0/this.texsizeX,f=0/this.texsizeY,d=this.aspectx,p=this.aspecty;let E=0,_=0;if(t.preset.useWASM){const r=t.preset.globalPools.perVertex;if(vt.setWasm(r,i,t.globalKeys),vt.setWasm(r,t.mdVSQAfterFrame,t.qs),r.zoom.value=e.zoom,r.zoomexp.value=e.zoomexp,r.rot.value=e.rot,r.warp.value=e.warp,r.cx.value=e.cx,r.cy.value=e.cy,r.dx.value=e.dx,r.dy.value=e.dy,r.sx.value=e.sx,r.sy.value=e.sy,t.preset.pixel_eqs_wasm(t.runVertEQs,this.mesh_width,this.mesh_height,this.time,e.warpanimspeed,e.warpscale,this.aspectx,this.aspecty),s){const e=t.preset.pixel_eqs_get_array();let i=0,s=0;for(let t=0;t0&&(this.blurShader1.renderBlurTexture(this.targetTexture,r,A,n),this.numBlurPasses>1&&(this.blurShader2.renderBlurTexture(this.blurTexture1,r,A,n),this.numBlurPasses>2&&this.blurShader3.renderBlurTexture(this.blurTexture2,r,A,n)),this.bindFrambufferAndSetViewport(this.targetFrameBuffer,this.texsizeX,this.texsizeY)),this.motionVectors.drawMotionVectors(a,this.warpUVs),this.preset.shapes&&this.preset.shapes.length>0&&this.customShapes.forEach((t,e)=>{t.drawCustomShape(this.blending?this.blendProgress:1,i,this.presetEquationRunner,this.preset.shapes[e],this.prevTexture)}),this.preset.waves&&this.preset.waves.length>0&&this.customWaveforms.forEach((t,e)=>{t.drawCustomWaveform(this.blending?this.blendProgress:1,this.audio.timeArrayL,this.audio.timeArrayR,this.audio.freqArrayL,this.audio.freqArrayR,i,this.presetEquationRunner,this.preset.waves[e])}),this.blending&&(this.prevPreset.shapes&&this.prevPreset.shapes.length>0&&this.prevCustomShapes.forEach((t,e)=>{t.drawCustomShape(1-this.blendProgress,s,this.prevPresetEquationRunner,this.prevPreset.shapes[e],this.prevTexture)}),this.prevPreset.waves&&this.prevPreset.waves.length>0&&this.prevCustomWaveforms.forEach((t,e)=>{t.drawCustomWaveform(1-this.blendProgress,this.audio.timeArrayL,this.audio.timeArrayR,this.audio.freqArrayL,this.audio.freqArrayR,s,this.prevPresetEquationRunner,this.prevPreset.waves[e])})),this.basicWaveform.drawBasicWaveform(this.blending,this.blendProgress,this.audio.timeArrayL,this.audio.timeArrayR,a),this.darkenCenter.drawDarkenCenter(a);const l=[a.ob_r,a.ob_g,a.ob_b,a.ob_a];this.outerBorder.drawBorder(l,a.ob_size,0);const g=[a.ib_r,a.ib_g,a.ib_b,a.ib_a];if(this.innerBorder.drawBorder(g,a.ib_size,a.ob_size),this.supertext.startTime>=0){const t=(this.time-this.supertext.startTime)/this.supertext.duration;t>=1&&this.titleText.renderTitle(t,!0,i)}this.globalVars=i,this.mdVSFrame=r,this.mdVSFrameMixed=a,this.renderToScreen()}renderToScreen(){this.outputFXAA?this.bindFrambufferAndSetViewport(this.compFrameBuffer,this.texsizeX,this.texsizeY):this.bindFrambufferAndSetViewport(null,this.width,this.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.enable(this.gl.BLEND),this.gl.blendEquation(this.gl.FUNC_ADD),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA);const{blurMins:t,blurMaxs:e}=Ht.getBlurValues(this.mdVSFrameMixed);if(this.blending?(this.prevCompShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,t,e,this.prevMDVSFrame,this.prevPresetEquationRunner.mdVSQAfterFrame,this.warpColor),this.compShader.renderQuadTexture(!0,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,t,e,this.mdVSFrameMixed,this.presetEquationRunner.mdVSQAfterFrame,this.warpColor)):this.compShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,t,e,this.mdVSFrame,this.presetEquationRunner.mdVSQAfterFrame,this.warpColor),this.supertext.startTime>=0){const t=(this.time-this.supertext.startTime)/this.supertext.duration;this.titleText.renderTitle(t,!1,this.globalVars),t>=1&&(this.supertext.startTime=-1)}this.outputFXAA&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.compTexture),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.bindFrambufferAndSetViewport(null,this.width,this.height),this.outputShader.renderQuadTexture(this.compTexture))}launchSongTitleAnim(t){this.supertext={startTime:this.time,duration:1.7},this.titleText.generateTitleTexture(t)}toDataURL(){const t=new Uint8Array(this.texsizeX*this.texsizeY*4),e=this.gl.createFramebuffer(),i=this.gl.createTexture();this.bindFrameBufferTexture(e,i);const{blurMins:s,blurMaxs:r}=Ht.getBlurValues(this.mdVSFrameMixed);this.compShader.renderQuadTexture(!1,this.targetTexture,this.blurTexture1,this.blurTexture2,this.blurTexture3,s,r,this.mdVSFrame,this.presetEquationRunner.mdVSQAfterFrame,this.warpColor),this.gl.readPixels(0,0,this.texsizeX,this.texsizeY,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Array.from({length:this.texsizeY},(e,i)=>t.slice(i*this.texsizeX*4,(i+1)*this.texsizeX*4)).forEach((e,i)=>t.set(e,(this.texsizeY-i-1)*this.texsizeX*4));const a=document.createElement("canvas");a.width=this.texsizeX,a.height=this.texsizeY;const o=a.getContext("2d",{willReadFrequently:!1}),h=o.createImageData(this.texsizeX,this.texsizeY);return h.data.set(t),o.putImageData(h,0,0),this.gl.deleteTexture(i),this.gl.deleteFramebuffer(e),a.toDataURL()}warpBufferToDataURL(){const t=new Uint8Array(this.texsizeX*this.texsizeY*4);this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.targetFrameBuffer),this.gl.readPixels(0,0,this.texsizeX,this.texsizeY,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t);const e=document.createElement("canvas");e.width=this.texsizeX,e.height=this.texsizeY;const i=e.getContext("2d",{willReadFrequently:!1}),s=i.createImageData(this.texsizeX,this.texsizeY);return s.data.set(t),i.putImageData(s,0,0),e.toDataURL()}}class Zt{constructor(t,e,i){this.opts=i,this.rng=Pt(i),this.deterministicMode=i.deterministic||i.testMode,this.audio=new _t(t);const s=i.width||1200,r=i.height||900;window.OffscreenCanvas?this.internalCanvas=new OffscreenCanvas(s,r):(this.internalCanvas=document.createElement("canvas"),this.internalCanvas.width=s,this.internalCanvas.height=r),this.gl=this.internalCanvas.getContext("webgl2",{alpha:!1,antialias:!1,depth:!1,stencil:!1,premultipliedAlpha:!1}),this.outputGl=e.getContext("2d",{willReadFrequently:!1}),this.baseValsDefaults={decay:.98,gammaadj:2,echo_zoom:2,echo_alpha:0,echo_orient:0,red_blue:0,brighten:0,darken:0,wrap:1,darken_center:0,solarize:0,invert:0,bmotionvectorson:1,fshader:0,b1n:0,b2n:0,b3n:0,b1x:1,b2x:1,b3x:1,b1ed:.25,wave_mode:0,additivewave:0,wave_dots:0,wave_thick:0,wave_a:.8,wave_scale:1,wave_smoothing:.75,wave_mystery:0,modwavealphabyvolume:0,modwavealphastart:.75,modwavealphaend:.95,wave_r:1,wave_g:1,wave_b:1,wave_x:.5,wave_y:.5,wave_brighten:1,mv_x:12,mv_y:9,mv_dx:0,mv_dy:0,mv_l:.9,mv_r:1,mv_g:1,mv_b:1,mv_a:1,warpanimspeed:1,warpscale:1,zoomexp:1,zoom:1,rot:0,cx:.5,cy:.5,dx:0,dy:0,warp:1,sx:1,sy:1,ob_size:.01,ob_r:0,ob_g:0,ob_b:0,ob_a:0,ib_size:.01,ib_r:.25,ib_g:.25,ib_b:.25,ib_a:0},this.shapeBaseValsDefaults={enabled:0,sides:4,additive:0,thickoutline:0,textured:0,num_inst:1,tex_zoom:1,tex_ang:0,x:.5,y:.5,rad:.1,ang:0,r:1,g:0,b:0,a:1,r2:0,g2:1,b2:0,a2:0,border_r:1,border_g:1,border_b:1,border_a:.1},this.waveBaseValsDefaults={enabled:0,samples:512,sep:0,scaling:1,smoothing:.5,r:1,g:1,b:1,a:1,spectrum:0,usedots:0,thick:0,additive:0},this.qs=vt.range(1,33).map(t=>`q${t}`),this.ts=vt.range(1,9).map(t=>`t${t}`),this.globalPerFrameVars=["old_wave_mode","frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset"],this.globalPerPixelVars=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset","x","y","rad","ang"],this.globalShapeVars=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset","instance"],this.shapeBaseVars=["x","y","rad","ang","r","g","b","a","r2","g2","b2","a2","border_r","border_g","border_b","border_a","thickoutline","textured","tex_zoom","tex_ang","additive"],this.globalWaveVars=["frame","time","fps","bass","bass_att","mid","mid_att","treb","treb_att","meshx","meshy","aspectx","aspecty","pixelsx","pixelsy","rand_start","rand_preset","x","y","sample","value1","value2"],this.renderer=new Ht(this.gl,this.audio,i)}loseGLContext(){this.gl.getExtension("WEBGL_lose_context").loseContext(),this.outputGl=null}connectAudio(t){this.audioNode=t,this.audio.connectAudio(t)}disconnectAudio(t){this.audio.disconnectAudio(t)}static overrideDefaultVars(t,e){const i={};return Object.keys(t).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)?i[s]=e[s]:i[s]=t[s]}),i}createQVars(){const t={};return this.qs.forEach(e=>{t[e]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),t}createTVars(){const t={};return this.ts.forEach(e=>{t[e]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),t}createPerFramePool(t){const e={};return Object.keys(this.baseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalPerFrameVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}createPerPixelPool(t){const e={};return Object.keys(this.baseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalPerPixelVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}createCustomShapePerFramePool(t){const e={};return Object.keys(this.shapeBaseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalShapeVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}createCustomWavePerFramePool(t){const e={};return Object.keys(this.waveBaseValsDefaults).forEach(i=>{e[i]=new WebAssembly.Global({value:"f64",mutable:!0},t[i])}),this.globalWaveVars.forEach(t=>{e[t]=new WebAssembly.Global({value:"f64",mutable:!0},0)}),e}static makeShapeResetPool(t,e,i){return e.reduce((e,s)=>({...e,[`${s}_${i}`]:t[s]}),{})}static base64ToArrayBuffer(t){for(var e=window.atob(t),i=e.length,s=new Uint8Array(i),r=0;r{s[t]=new Set(Object.keys(e))});const r=at({pools:s,functions:e,eelVersion:i}),a=await WebAssembly.compile(r);var o=Object.assign(Object.assign({},t),{shims:j});return await WebAssembly.instantiate(a,o)}({pools:r,functions:a,eelVersion:t.version||2}),h=t=>t||(()=>{}),A=await pt.instantiate(Zt.base64ToArrayBuffer("AGFzbQEAAAABPQpgAABgAXwBfGACfHwBfGACf38AYAR/f39/AGAJf39/f3x8fHx8AGADf399AGABfwF/YAJ/fwF/YAF+AX8CuBWMAQNlbnYFYWJvcnQABAhwaXhlbEVxcwtwZXJQaXhlbEVxcwAADHBpeGVsVmFyUG9vbAR3YXJwA3wBDHBpeGVsVmFyUG9vbAR6b29tA3wBDHBpeGVsVmFyUG9vbAd6b29tZXhwA3wBDHBpeGVsVmFyUG9vbAJjeAN8AQxwaXhlbFZhclBvb2wCY3kDfAEMcGl4ZWxWYXJQb29sAnN4A3wBDHBpeGVsVmFyUG9vbAJzeQN8AQxwaXhlbFZhclBvb2wCZHgDfAEMcGl4ZWxWYXJQb29sAmR5A3wBDHBpeGVsVmFyUG9vbANyb3QDfAEMcGl4ZWxWYXJQb29sA3JhZAN8AQxwaXhlbFZhclBvb2wDYW5nA3wBDHBpeGVsVmFyUG9vbAF4A3wBDHBpeGVsVmFyUG9vbAF5A3wBCHFWYXJQb29sAnExA3wBCHFWYXJQb29sAnEyA3wBCHFWYXJQb29sAnEzA3wBCHFWYXJQb29sAnE0A3wBCHFWYXJQb29sAnE1A3wBCHFWYXJQb29sAnE2A3wBCHFWYXJQb29sAnE3A3wBCHFWYXJQb29sAnE4A3wBCHFWYXJQb29sAnE5A3wBCHFWYXJQb29sA3ExMAN8AQhxVmFyUG9vbANxMTEDfAEIcVZhclBvb2wDcTEyA3wBCHFWYXJQb29sA3ExMwN8AQhxVmFyUG9vbANxMTQD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NwJPYBI3Ek9wEjciT4ASNzJPkBI3Qk+gELawAj5gEkYCPnASRhI+gBJGIj6QEkYyPqASRkI+sBJGUj7AEkZiPtASRnI+4BJGgj7wEkaSPwASRqI/EBJGsj8gEkbCPzASRtI/QBJG4j9QEkbyP2ASRwI/cBJHEj+AEkciP5ASRzI/oBJHQLdQAjdST7ASN2JPwBI3ck/QEjeCT+ASN5JP8BI3okgAIjeySBAiN8JIICI30kgwIjfiSEAiN/JIUCI4ABJIYCI4EBJIcCI4IBJIgCI4MBJIkCI4QBJIoCI4UBJIsCI4YBJIwCI4cBJI0CI4gBJI4CI4kBJI8CC3UAI/sBJHUj/AEkdiP9ASR3I/4BJHgj/wEkeSOAAiR6I4ECJHsjggIkfCODAiR9I4QCJH4jhQIkfyOGAiSAASOHAiSBASOIAiSCASOJAiSDASOKAiSEASOLAiSFASOMAiSGASONAiSHASOOAiSIASOPAiSJAQsIAEHMCiSQAgsLvAIDAEGMCAsvLAAAAAEAAAAAAAAAAQAAABwAAABJAG4AdgBhAGwAaQBkACAAbABlAG4AZwB0AGgAQbwICzk8AAAAAQAAAAAAAAABAAAAJgAAAH4AbABpAGIALwBhAHIAcgBhAHkAYgB1AGYAZgBlAHIALgB0AHMAQYAJC8ABboP5ogAAAADRVyf8KRVETpmVYtvA3TT1q2NR/kGQQzw6biS3YcW73uouSQbg0k1CHOsd/hyS0Qn1NYLoPqcpsSZwnOmERLsuOdaROUF+X7SLX4Sc9DlTg/+X+B87KPm9ixEv7w+YBd7PfjZtH20KWmY/Rk+3Ccsnx7ondS3qX573OQc9e/Hl67Ff+2vqklKKRjADVghdjR8gvM/wq2t7/GGR46kdNvSaX4WZZQgb5l6A2P+NQGigFFcVBgYxJ3NN"),{pixelEqs:{perPixelEqs:h(o.exports.perPixel)},pixelVarPool:{warp:r.perVertex.warp,zoom:r.perVertex.zoom,zoomexp:r.perVertex.zoomexp,cx:r.perVertex.cx,cy:r.perVertex.cy,sx:r.perVertex.sx,sy:r.perVertex.sy,dx:r.perVertex.dx,dy:r.perVertex.dy,rot:r.perVertex.rot,x:r.perVertex.x,y:r.perVertex.y,ang:r.perVertex.ang,rad:r.perVertex.rad},qVarPool:i,tVarPool:s,shapePool0:Zt.makeShapeResetPool(r.shapePerFrame0,this.shapeBaseVars,0),shapePool1:Zt.makeShapeResetPool(r.shapePerFrame1,this.shapeBaseVars,1),shapePool2:Zt.makeShapeResetPool(r.shapePerFrame2,this.shapeBaseVars,2),shapePool3:Zt.makeShapeResetPool(r.shapePerFrame3,this.shapeBaseVars,3),console:{logi:t=>{console.log("logi: "+t)},logf:t=>{console.log("logf: "+t)}},env:{abort:()=>{}}});t.globalPools=r,t.init_eqs=h(o.exports.presetInit),t.frame_eqs=h(o.exports.perFrame),t.save_qs=A.exports.saveQs,t.restore_qs=A.exports.restoreQs,t.save_ts=A.exports.saveTs,t.restore_ts=A.exports.restoreTs,o.exports.perPixel&&(t.pixel_eqs=o.exports.perPixel),t.pixel_eqs_initialize_array=(e,i)=>{const s=A.exports.createFloat32Array((e+1)*(i+1)*2);t.pixel_eqs_array=s},t.pixel_eqs_get_array=()=>A.exports.__getFloat32ArrayView(t.pixel_eqs_array),t.pixel_eqs_wasm=(...e)=>A.exports.runPixelEquations(t.pixel_eqs_array,...e);for(let e=0;eA.exports[`shape${e}_save`](),t.shapes[e].frame_eqs_restore=()=>A.exports[`shape${e}_restore`]());for(let e=0;e