(function () {var Da={};function Hb(r,e){var o={destCol:1,srcCol:1,srcLine:1};r.forEach(function(r){r.destCol>e||(o=r)});var $=e-o.destCol;return{column:o.srcCol+$,line:o.srcLine}}Object.defineProperty(Da,"__esModule",{value:!0});var Ea=Hb;function Ib(r){for(var e=[],o=1,$="",s=0,t=!1,c=!1,n=!1,p=0;p1)for(var r=1;r2&&N.push("'"+this.terminals_[b]+"'");x=y.showPosition?"Parse error on line "+(o+1)+":\n"+y.showPosition()+"\nExpecting "+N.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(x,{text:y.match,token:this.terminals_[g]||g,line:y.yylineno,loc:_,expected:N})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+E+", token: "+g);switch(k[0]){case 1:i.push(g),s.push(y.yytext),n.push(y.yylloc),i.push(k[1]),g=null,m?(g=m,m=null):(a=y.yyleng,h=y.yytext,o=y.yylineno,_=y.yylloc,c>0&&c--);break;case 2:if(S=this.productions_[k[1]][1],$.$=s[s.length-S],$._$={first_line:n[n.length-(S||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(S||1)].first_column,last_column:n[n.length-1].last_column},f&&($._$.range=[n[n.length-(S||1)].range[0],n[n.length-1].range[1]]),void 0!==(I=this.performAction.apply($,[h,a,o,u.yy,k[1],s,n].concat(l))))return I;S&&(i=i.slice(0,-1*S*2),s=s.slice(0,-1*S),n=n.slice(0,-1*S)),i.push(this.productions_[k[1]][0]),s.push($.$),n.push($._$),d=r[i[i.length-2]][i[i.length-1]],i.push(d);break;case 3:return!0;}}return!0}},P={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 n=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=[n[0],n[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,n;if(this.options.backtrack_lexer&&(n={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&&(n.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 r in n)this[r]=n[r];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 n=this._currentRules(),r=0;re[0].length)){if(e=i,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,n[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[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 L(){this.yy={}}return T.lexer=P,L.prototype=T,T.Parser=L,new L}();return"undefined"!=typeof require&&void 0!==this&&(this.parser=i,this.Parser=i.Parser,this.parse=function(){return i.parse.apply(i,arguments)},this.main=function(){},void 0!==t&&require.main===t&&this.main(Jb.argv.slice(1))),t.exports}.call({});var Nb={};Nb={parse:Mb.parse};function cb(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function db(e){for(var r=1;r2&&void 0!==arguments[2]?arguments[2]:1,o=Math.max(r.first_line-1-e,0),n=r.last_line+e,$=t.split("\n").slice(o,n).map(function(t,e){var n=e+o+1,$=n>=r.first_line&&n<=r.last_line;return"".concat($?">":" "," ").concat(n," | ").concat(t)});if(r.first_line===r.last_line){var a=Ka(r.first_column," "),i=Ka(r.last_column-r.first_column,"^"),c=r.first_line-o;$.splice(c,0," | ".concat(a).concat(i))}return $.join("\n")}var ec=kb;xa.printLoc=ec;var lb=function(r){hb(e,bc(Error));var t=ib(e);function e(r,o,n){var $;return gb(this,e),($=t.call(this,r)).sourceContext=kb(o,n),$.loc=o,$}return e}(),fc=function(r){hb(e,lb);var t=ib(e);function e(){return gb(this,e),t.apply(this,arguments)}return e}();function gc(r,t,e){return new fc(r,t,e)}var ha=gc;function hc(r,t,e){return new lb(r,t,e)}xa.createUserError=ha;var ea=hc;xa.createCompilerError=ea;var mb={};function ic(r,e){return mc(r)||lc(r,e)||kc(r,e)||jc()}function jc(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function kc(r,e){if(r){if("string"==typeof r)return nb(r,e);var a=Object.prototype.toString.call(r).slice(8,-1);return"Object"===a&&r.constructor&&(a=r.constructor.name),"Map"===a||"Set"===a?Array.from(a):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?nb(r,e):void 0}}function nb(r,e){(null==e||e>r.length)&&(e=r.length);for(var a=0,t=new Array(e);a>1,h=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,c=0,i=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(r=isNaN(t)?1:0,o=w):(o=Math.floor(Math.log(t)/Math.LN2),t*($=Math.pow(2,-o))<1&&(o--,$*=2),(t+=o+M>=1?h/$:h*Math.pow(2,1-M))*$>=2&&(o++,$/=2),o+M>=w?(r=0,o=w):o+M>=1?(r=(t*$-1)*Math.pow(2,e),o+=M):(r=t*Math.pow(2,M-1)*Math.pow(2,e),o=0));e>=8;a[0+c]=255&r,c+=1,r/=256,e-=8);for(o=o<0;a[0+c]=255&o,c+=1,o/=256,p-=8);a[0+c-1]|=128*i}Object.defineProperty(Oa,"__esModule",{value:!0});var pc=oc;Oa.write=pc;var K={};function Z(r){return tc(r)||sc(r)||rc(r)||qc()}function qc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function rc(r,$){if(r){if("string"==typeof r)return Pa(r,$);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Pa(r,$):void 0}}function sc(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}function tc(r){if(Array.isArray(r))return Pa(r)}function Pa(r,$){(null==$||$>r.length)&&($=r.length);for(var e=0,t=new Array($);e<$;e++)t[e]=r[e];return t}var uc=K&&K.__importStar||function(r){if(r&&r.__esModule)return r;var $={};if(null!=r)for(var e in r)Object.hasOwnProperty.call(r,e)&&($[e]=r[e]);return $.default=r,$};Object.defineProperty(K,"__esModule",{value:!0});var vc=uc(Oa),pb=[0,97,115,109];K.MAGIC=pb;var qb=[1,0,0,0];K.WASM_VERSION=qb;var ya=1e-5;K.EPSILON=ya;var ia={TYPE:1,IMPORT:2,FUNC:3,MEMORY:5,GLOBAL:6,EXPORT:7,CODE:10};K.SECTION=ia;var rb={FUNC:0,TABLE:1,MEMORY:2,GLOBAL:3};K.EXPORT_TYPE=rb;var q={block:function(r){return[2,r]},loop:function(r){return[3,r]},if:function(r){return[4,r]},else:5,end:11,br_if:function(r){return[13].concat(Z(aa(r)))},call:function(r){return[16].concat(Z(aa(r)))},drop:26,select:27,local_get:function(r){return[32].concat(Z(aa(r)))},local_set:function(r){return[33].concat(Z(aa(r)))},local_tee:function(r){return[34].concat(Z(aa(r)))},global_get:function(r){return[35].concat(Z(aa(r)))},global_set:function(r){return[36].concat(Z(aa(r)))},f64_load:function(r,$){return[43].concat(Z(aa(r)),Z(aa($)))},f64_store:function(r,$){return[57].concat(Z(aa(r)),Z(aa($)))},i32_const:function(r){return[65].concat(Z(wb(r)))},f64_const:function(r){return[68].concat(Z(vb(r)))},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};K.op=q;var H={i32:127,i64:126,f32:125,f64:124};K.VAL_TYPE=H;var Qa={const:0,var:1};K.MUTABILITY=Qa;var ba={void:64,i32:127,i64:126,f32:125,f64:124};K.BLOCK=ba;var sb=96;K.FUNCTION_TYPE=sb;var wc=2;K.MEMORY_IDX=wc;var tb=3;K.GLOBAL_TYPE=tb;var ub=0;K.TYPE_IDX=ub;var oa=[q.f64_abs].concat(Z(q.f64_const(ya)),[q.f64_lt]);K.IS_ZEROISH=oa;var ca=[q.f64_abs].concat(Z(q.f64_const(ya)),[q.f64_gt]);function vb(r){var $=new Uint8Array(8);return vc.write($,r),$}K.IS_NOT_ZEROISH=ca;var xc=vb;K.encodef64=xc;var pa=function(r){return[r.length].concat(r.split("").map(function(r){return r.charCodeAt(0)}))};function aa(r){var $=[];do{var e=127&r;0!==(r>>>=7)&&(e|=128),$.push(e)}while(0!==r);return $}K.encodeString=pa;var la=aa;function wb(r){for(var $=[],e=0,t=Math.ceil(Math.log2(Math.abs(r))),o=r<0,n=!0;n;)e=127&r,r>>=7,o&&(r|=-(1<Ac?1/$:0}},Cc=Bc;qa.default=Cc;var za={};Object.defineProperty(za,"__esModule",{value:!0});var Dc=65536,Ec=8,Fc=2,xb=1048576;za.MAX_LOOP_COUNT=xb;var Aa=8388608;za.BUFFER_SIZE=Aa;var Sa=Math.ceil(Aa*Ec*Fc/Dc);za.WASM_MEMORY_SIZE=Sa;var yb={};function G(n){return Jc(n)||Ic(n)||Hc(n)||Gc()}function Gc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Hc(n,$){if(n){if("string"==typeof n)return Ta(n,$);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ta(n,$):void 0}}function Ic(n){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(n))return Array.from(n)}function Jc(n){if(Array.isArray(n))return Ta(n)}function Ta(n,$){(null==$||$>n.length)&&($=n.length);for(var e=0,r=new Array($);e<$;e++)r[e]=n[e];return r}Object.defineProperty(yb,"__esModule",{value:!0});var va={sqr:{args:[H.f64],returns:[H.f64],binary:[].concat(G(q.local_get(0)),G(q.local_get(0)),[q.f64_mul])},bor:{args:[H.f64,H.f64],returns:[H.f64],binary:[].concat(G(q.local_get(0)),G(ca),G(q.local_get(1)),G(ca),[q.i32_or],G(q.i32_const(0)),[q.i32_ne,q.f64_convert_i32_s])},band:{args:[H.f64,H.f64],returns:[H.f64],binary:[].concat(G(q.local_get(0)),G(ca),G(q.local_get(1)),G(ca),[q.i32_and],G(q.i32_const(0)),[q.i32_ne,q.f64_convert_i32_s])},sign:{args:[H.f64],returns:[H.f64],binary:[].concat(G(q.f64_const(0)),G(q.local_get(0)),[q.f64_lt],G(q.local_get(0)),G(q.f64_const(0)),[q.f64_lt,q.i32_sub,q.f64_convert_i32_s])},mod:{args:[H.f64,H.f64],returns:[H.f64],localVariables:[H.i32],binary:[].concat(G(q.local_get(1)),[q.i32_trunc_f64_s],G(q.local_tee(2)),G(q.i32_const(0)),[q.i32_ne],G(q.if(ba.f64)),G(q.local_get(0)),[q.i32_trunc_f64_s],G(q.local_get(2)),[q.i32_rem_s,q.f64_convert_i32_s,q.else],G(q.f64_const(0)),[q.end])},bitwiseOr:{args:[H.f64,H.f64],returns:[H.f64],binary:[].concat(G(q.local_get(0)),[q.i64_trunc_s_f64],G(q.local_get(1)),[q.i64_trunc_s_f64,q.i64_or,q.f64_convert_i64_s])},bitwiseAnd:{args:[H.f64,H.f64],returns:[H.f64],binary:[].concat(G(q.local_get(0)),[q.i64_trunc_s_f64],G(q.local_get(1)),[q.i64_trunc_s_f64,q.i64_and,q.f64_convert_i64_s])},div:{args:[H.f64,H.f64],returns:[H.f64],localVariables:[H.i32],binary:[].concat(G(q.local_get(1)),G(q.f64_const(0)),[q.f64_ne],G(q.if(ba.f64)),G(q.local_get(0)),G(q.local_get(1)),[q.f64_div,q.else],G(q.f64_const(0)),[q.end])},_getBufferIndex:{args:[H.f64],returns:[H.i32],localVariables:[H.f64,H.i32],binary:[].concat(G(q.f64_const(ya)),G(q.local_get(0)),[q.f64_add],G(q.local_tee(1)),[q.i32_trunc_f64_s],G(q.local_set(2)),G(q.i32_const(-1)),G(q.local_get(2)),G(q.i32_const(8)),[q.i32_mul],G(q.local_get(2)),G(q.i32_const(0)),[q.i32_lt_s],G(q.local_get(2)),G(q.i32_const(Aa-1)),[q.i32_gt_s,q.i32_or,q.select])}};yb.localFuncMap=va;var Ba={};function Kc(r,$){return Nc(r)||Mc(r,$)||zb(r,$)||Lc()}function Lc(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Mc(r,$){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var a=[],o=!0,e=!1,n=void 0;try{for(var t,_=r[Symbol.iterator]();!(o=(t=_.next()).done)&&(a.push(t.value),!$||a.length!==$);o=!0);}catch(c){e=!0,n=c}finally{try{o||null==_.return||_.return()}finally{if(e)throw n}}return a}}function Nc(r){if(Array.isArray(r))return r}function z(r){return Qc(r)||Pc(r)||zb(r)||Oc()}function Oc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zb(r,$){if(r){if("string"==typeof r)return Ua(r,$);var a=Object.prototype.toString.call(r).slice(8,-1);return"Object"===a&&r.constructor&&(a=r.constructor.name),"Map"===a||"Set"===a?Array.from(a):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Ua(r,$):void 0}}function Pc(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}function Qc(r){if(Array.isArray(r))return Ua(r)}function Ua(r,$){(null==$||$>r.length)&&($=r.length);for(var a=0,o=new Array($);a<$;a++)o[a]=r[a];return o}var Rc=Ba&&Ba.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ba,"__esModule",{value:!0});var Ab=Rc(qa);function Y(r,$){var a,o,e;switch(r.type){case"SCRIPT":var n=r.body.map(function(r,a){return[].concat(z(Y(r,$)),[q.drop])});return ta(n);case"EXPRESSION_BLOCK":return Va(r.body,$);case"BINARY_EXPRESSION":var t=Y(r.left,$),_=Y(r.right,$),c={"+":[q.f64_add],"-":[q.f64_sub],"*":[q.f64_mul],"/":$.resolveFunc("div"),"%":$.resolveFunc("mod"),"|":$.resolveFunc("bitwiseOr"),"&":$.resolveFunc("bitwiseAnd"),"^":$.resolveFunc("pow"),"==":[q.f64_sub].concat(z(oa),[q.f64_convert_i32_s]),"!=":[q.f64_sub].concat(z(ca),[q.f64_convert_i32_s]),"<":[q.f64_lt,q.f64_convert_i32_s],">":[q.f64_gt,q.f64_convert_i32_s],"<=":[q.f64_le,q.f64_convert_i32_s],">=":[q.f64_ge,q.f64_convert_i32_s]}[r.operator];if(null==c)throw ea("Unknown binary expression operator ".concat(r.operator),r.loc,$.rawSource);return[].concat(z(t),z(_),z(c));case"CALL_EXPRESSION":var i=r.callee.value,v=r.arguments,l=function(a){if(v.lengtha)throw ha("Too many arguments passed to `".concat(i,"()`. Expected ").concat(a," but got ").concat(v.length,"."),v[a].loc,$.rawSource)};switch(i){case"exec2":return l(2),Va(r.arguments,$);case"exec3":return l(3),Va(r.arguments,$);case"if":l(3);var V=Kc(r.arguments,3);return Uc(V[0],V[1],V[2],$);case"while":return l(1),Sc(r.arguments[0],$);case"loop":return l(2),Tc(r.arguments[0],r.arguments[1],$);case"megabuf":case"gmegabuf":l(1);var s=$.resolveLocal(H.i32);return[].concat(z(Y(r.arguments[0],$)),z(null!==(a=$.resolveFunc("_getBufferIndex"))&&void 0!==a?a:[]),z(q.local_tee(s)),z(q.i32_const(-1)),[q.i32_ne],z(q.if(ba.f64)),z(q.local_get(s)),z(q.f64_load(3,Cb(i))),[q.else],z(q.f64_const(0)),[q.end]);case"assign":l(2);var W=r.arguments[0];if("IDENTIFIER"!=W.type)throw ha("Expected the first argument of `assign()` to be an identifier.",W.loc,$.rawSource);var u=$.resolveVar(W.value);return[].concat(z(Y(r.arguments[1],$)),z(q.global_set(u)),z(q.global_get(u)));}var g=ta(r.arguments.map(function(r){return Y(r,$)}));switch(i){case"abs":return l(1),[].concat(z(g),[q.f64_abs]);case"sqrt":return l(1),[].concat(z(g),[q.f64_abs,q.f64_sqrt]);case"int":return l(1),[].concat(z(g),[q.f64_floor]);case"min":return l(2),[].concat(z(g),[q.f64_min]);case"max":return l(2),[].concat(z(g),[q.f64_max]);case"above":return l(2),[].concat(z(g),[q.f64_gt,q.f64_convert_i32_s]);case"below":return l(2),[].concat(z(g),[q.f64_lt,q.f64_convert_i32_s]);case"equal":return l(2),[].concat(z(g),[q.f64_sub],z(oa),[q.f64_convert_i32_s]);case"bnot":return l(1),[].concat(z(g),z(oa),[q.f64_convert_i32_s]);case"floor":return l(1),[].concat(z(g),[q.f64_floor]);case"ceil":return l(1),[].concat(z(g),[q.f64_ceil]);}var d=$.resolveFunc(i);if(null==d||i.startsWith("_"))throw ha("\"".concat(i,"\" is not defined."),r.callee.loc,$.rawSource);if(null!=Ab.default[i])l(Ab.default[i].length);else{if(null==va[i])throw ea("Missing arity information for the function `".concat(i,"()`"),r.callee.loc,$.rawSource);l(va[i].args.length)}return[].concat(z(g),z(d));case"ASSIGNMENT_EXPRESSION":var m=r.left,p=Y(r.right,$),b=Vc(r,$);if("IDENTIFIER"===m.type){var y=$.resolveVar(m.value),f=q.global_get(y),A=q.global_set(y);return null===b?[].concat(z(p),z(A),z(f)):[].concat(z(f),z(p),z(b),z(A),z(f))}if("CALL_EXPRESSION"!==m.type)throw ea("Unexpected left hand side type for assignment: ".concat(m.type),r.loc,$.rawSource);var C=$.resolveLocal(H.i32);if(1!==m.arguments.length)throw ha("Expected 1 argument when assinging to a buffer but got ".concat(m.arguments.length,"."),0===m.arguments.length?m.loc:m.arguments[1].loc,$.rawSource);var E=m.callee.value;if("gmegabuf"!==E&&"megabuf"!==E)throw ha("The only function calls which may be assigned to are `gmegabuf()` and `megabuf()`.",m.callee.loc,$.rawSource);var h=Cb(E);if(null===b){var S=$.resolveLocal(H.i32),I=$.resolveLocal(H.f64);return[].concat(z(p),z(q.local_set(I)),z(Y(m.arguments[0],$)),z(null!==(o=$.resolveFunc("_getBufferIndex"))&&void 0!==o?o:[]),z(q.local_tee(S)),z(q.i32_const(0)),[q.i32_lt_s],z(q.if(ba.f64)),z(q.f64_const(0)),[q.else],z(q.local_get(S)),z(q.local_tee(C)),z(q.local_get(I)),z(q.f64_store(3,h)),z(q.local_get(I)),[q.end])}var w=$.resolveLocal(H.i32),L=$.resolveLocal(H.i32),O=$.resolveLocal(H.f64),T=$.resolveLocal(H.f64);return[].concat(z(p),z(q.local_set(O)),z(Y(m.arguments[0],$)),z(null!==(e=$.resolveFunc("_getBufferIndex"))&&void 0!==e?e:[]),z(q.local_tee(w)),z(q.i32_const(-1)),[q.i32_ne],z(q.local_tee(L)),z(q.if(ba.f64)),z(q.local_get(w)),z(q.f64_load(3,h)),[q.else],z(q.f64_const(0)),[q.end],z(q.local_get(O)),z(b),z(q.local_tee(T)),z(q.local_get(L)),z(q.if(ba.void)),z(q.local_get(w)),z(q.local_get(T)),z(q.f64_store(3,h)),[q.end]);case"LOGICAL_EXPRESSION":var U=Y(r.left,$),R=Y(r.right,$),x={"&&":{comparison:oa,shortCircutValue:0},"||":{comparison:ca,shortCircutValue:1}}[r.operator];if(null==x)throw ea("Unknown logical expression operator ".concat(r.operator),r.loc,$.rawSource);var F=x.comparison,N=x.shortCircutValue;return[].concat(z(U),z(F),z(q.if(ba.f64)),z(q.f64_const(N)),[q.else],z(R),z(ca),[q.f64_convert_i32_s,q.end]);case"UNARY_EXPRESSION":var B=Y(r.value,$),P={"-":[q.f64_neg],"+":[],"!":[].concat(z(oa),[q.f64_convert_i32_s])}[r.operator];if(null==P)throw ea("Unknown logical unary operator ".concat(r.operator),r.loc,$.rawSource);return[].concat(z(B),z(P));case"IDENTIFIER":var k=r.value;return q.global_get($.resolveVar(k));case"NUMBER_LITERAL":return q.f64_const(r.value);default:throw ea("Unknown AST node type ".concat(r.type),r.loc,$.rawSource);}}var Bb=Y;function Va(r,$){var a=r.map(function(r,a){return Y(r,$)});return ta(fb(a,[q.drop]))}function Sc(r,$){var a=Y(r,$),o=$.resolveLocal(H.i32);return[].concat(z(q.i32_const(0)),z(q.local_set(o)),z(q.loop(ba.void)),z(q.local_get(o)),z(q.i32_const(1)),[q.i32_add],z(q.local_tee(o)),z(q.i32_const(xb)),[q.i32_lt_u],z(a),z(ca),[q.i32_and],z(q.br_if(0)),[q.end],z(q.f64_const(0)))}function Tc(r,$,a){var o=Y($,a),e=a.resolveLocal(H.i32);return[].concat(z(q.block(ba.void)),z(Y(r,a)),[q.i32_trunc_f64_s],z(q.local_tee(e)),z(q.i32_const(0)),[q.i32_le_s],z(q.br_if(1)),z(q.loop(ba.void)),z(o),[q.drop],z(q.local_get(e)),z(q.i32_const(1)),[q.i32_sub],z(q.local_tee(e)),z(q.i32_const(0)),[q.i32_ne],z(q.br_if(0)),[q.end,q.end],z(q.f64_const(0)))}function Uc(r,$,a,o){return[].concat(z(Y(r,o)),z(ca),z(q.if(ba.f64)),z(Y($,o)),[q.else],z(Y(a,o)),[q.end])}function Cb(r){switch(r){case"gmegabuf":return 8*Aa;case"megabuf":return 0;}}function Vc(r,$){var a={"+=":[q.f64_add],"-=":[q.f64_sub],"*=":[q.f64_mul],"/=":[q.f64_div],"%=":$.resolveFunc("mod"),"=":null}[r.operator];if(void 0===a)throw ea("Unknown assignment operator \"".concat(r.operator,"\""),r.loc,$.rawSource);return a}Ba.emit=Bb;var ra={};function J(r){return Yc(r)||Xc(r)||Db(r)||Wc()}function Wc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xc(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}function Yc(r){if(Array.isArray(r))return Wa(r)}function wa(r,e){return _c(r)||$c(r,e)||Db(r,e)||Zc()}function Zc(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Db(r,e){if(r){if("string"==typeof r)return Wa(r,e);var a=Object.prototype.toString.call(r).slice(8,-1);return"Object"===a&&r.constructor&&(a=r.constructor.name),"Map"===a||"Set"===a?Array.from(a):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Wa(r,e):void 0}}function Wa(r,e){(null==e||e>r.length)&&(e=r.length);for(var a=0,n=new Array(e);ar.length)&&(e=r.length);for(var t=0,a=new Array(e);t