text: /**
   * gpu.js
   * http://gpu.rocks/
   *
   * GPU Accelerated JavaScript
   *
   * @version 1.4.7
   * @date Fri Jun 29 2018 21:15:22 GMT-0400 (EDT)
   *
   * @license MIT
   * The MIT License
   *
   * Copyright (c) 2018 gpu.js Team
   */
  "use strict";!function(){function t(e,n,r){function i(a,o){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!o&&u)return u(a,!0);if(s)return s(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var p=n[a]={exports:{}};e[a][0].call(p.exports,function(t){var n=e[a][1][t];return i(n?n:t)},p,p.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}return t}()({1:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=t("../function-builder-base"),o=t("./function-node");e.exports=function(t){function e(){r(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.Node=o,t}return s(e,t),e}(a)},{"../function-builder-base":6,"./function-node":2}],2:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("../function-node-base"),u=t("../../core/utils");e.exports=function(t){function e(t,n,s){r(this,e);var a=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,s));return a.paramSizes=s?s.paramSizes:[],a.memberStates=[],a}return s(e,t),a(e,[{key:"pushMemberState",value:function(t){this.memberStates.push(t)}},{key:"popMemberState",value:function(t){if(this.memberState!==t)throw new Error("Cannot popMemberState "+t+" when in "+this.memberState);this.memberStates.pop()}},{key:"generate",value:function(){return this.debug&&console.log(this),this.functionStringArray=this.astGeneric(this.getJsAST(),[]),this.functionString=this.functionStringArray.join("").trim(),this.functionString}},{key:"getFunctionPrototypeString",value:function(){return this.webGlFunctionPrototypeString?this.webGlFunctionPrototypeString:this.webGlFunctionPrototypeString=this.generate()}},{key:"astFunctionDeclaration",value:function(t,e){return this.addFunction&&this.addFunction(null,u.getAstString(this.jsFunctionString,t)),e}},{key:"astFunctionPrototype",value:function(t,e){if(this.isRootKernel||this.isSubKernel)return e;e.push(this.returnType),e.push(" "),e.push(this.functionName),e.push("(");for(var n=0;n<this.paramNames.length;++n)n>0&&e.push(", "),e.push(this.paramTypes[n]),e.push(" "),e.push("user_"),e.push(this.paramNames[n]);return e.push(");\n"),e}},{key:"astFunctionExpression",value:function(t,e){if(!this.isRootKernel){e.push("function"),this.kernalAst=t,e.push(" "),e.push(this.functionName),e.push("(");for(var n=0;n<this.paramNames.length;++n){var r=this.paramNames[n];n>0&&e.push(", "),e.push(" "),e.push("user_"),e.push(r)}e.push(") {\n")}for(var i=0;i<t.body.body.length;++i)this.astGeneric(t.body.body[i],e),e.push("\n");return this.isRootKernel||e.push("}\n"),e}},{key:"astReturnStatement",value:function(t,e){return this.isRootKernel?(e.push("kernelResult = "),this.astGeneric(t.argument,e),e.push(";")):this.isSubKernel?(e.push(this.functionName+"Result = "),this.astGeneric(t.argument,e),e.push(";"),e.push("return "+this.functionName+"Result;")):(e.push("return "),this.astGeneric(t.argument,e),e.push(";")),e}},{key:"astLiteral",value:function(t,e){if(isNaN(t.value))throw this.astErrorOutput("Non-numeric literal not supported : "+t.value,t);return e.push(t.value),e}},{key:"astBinaryExpression",value:function(t,e){return e.push("("),this.astGeneric(t.left,e),e.push(t.operator),this.astGeneric(t.right,e),e.push(")"),e}},{key:"astIdentifierExpression",value:function(t,e){if("Identifier"!==t.type)throw this.astErrorOutput("IdentifierExpression - not an Identifier",t);switch(this.state){case"input-index-y":case"input-index-z":e.push("(")}switch(t.name){case"gpu_threadX":e.push("threadId.x");break;case"gpu_threadY":e.push("threadId.y");break;case"gpu_threadZ":e.push("threadId.z");break;case"gpu_outputX":e.push("uOutputDim.x");break;case"gpu_outputY":e.push("uOutputDim.y");break;case"gpu_outputZ":e.push("uOutputDim.z");break;case"Infinity":e.push("Infinity");break;default:if(this.constants&&this.constants.hasOwnProperty(t.name))e.push("constants_"+t.name);else{var n=this.getUserParamName(t.name);null!==n?e.push("user_"+n):e.push("user_"+t.name)}}switch(this.state){case"input-index-y":var r=this.paramSizes[this.paramNames.indexOf(this.memberState)];e.push(" * "+r[0]+")");break;case"input-index-z":var i=this.paramSizes[this.paramNames.indexOf(this.memberState)];e.push(" * "+i[0]*i[1]+")")}return e}},{key:"astForStatement",value:function(t,e){if("ForStatement"!==t.type)throw this.astErrorOutput("Invalid for statement",t);if(t.test&&"BinaryExpression"===t.test.type){if(("Identifier"===t.test.right.type||"Literal"===t.test.right.type)&&"<"===t.test.operator&&this.isIdentifierConstant(t.test.right.name)===!1){if(this.loopMaxIterations||(console.warn("Warning: loopMaxIterations is not set! Using default of 1000 which may result in unintended behavior."),console.warn("Set loopMaxIterations or use a for loop of fixed length to silence this message.")),e.push("for ("),this.astGeneric(t.init,e),";"!==e[e.length-1]&&e.push(";"),this.astGeneric(t.test.left,e),e.push(t.test.operator),e.push("LOOP_MAX"),e.push(";"),this.astGeneric(t.update,e),e.push(")"),e.push("{\n"),e.push("if ("),this.astGeneric(t.test.left,e),e.push(t.test.operator),this.astGeneric(t.test.right,e),e.push(") {\n"),"BlockStatement"===t.body.type)for(var n=0;n<t.body.body.length;n++)this.astGeneric(t.body.body[n],e);else this.astGeneric(t.body,e);return e.push("} else {\n"),e.push("break;\n"),e.push("}\n"),e.push("}\n"),e}if(t.init.declarations){var r=JSON.parse(JSON.stringify(t.init.declarations)),i=t.update.argument;if(!Array.isArray(r)||r.length<1)throw console.log(this.jsFunctionString),new Error("Error: Incompatible for loop declaration");if(r.length>1){for(var s=null,a=0;a<r.length;a++){var o=r[a];o.id.name===i.name?(s=o,r.splice(a,1)):(e.push("var "),this.astGeneric(o,e),e.push(";"))}e.push("for (let "),this.astGeneric(s,e),e.push(";")}else e.push("for ("),this.astGeneric(t.init,e);return this.astGeneric(t.test,e),e.push(";"),this.astGeneric(t.update,e),e.push(")"),this.astGeneric(t.body,e),e}}throw this.astErrorOutput("Invalid for statement",t)}},{key:"astWhileStatement",value:function(t,e){if("WhileStatement"!==t.type)throw this.astErrorOutput("Invalid while statement",t);return e.push("for (let i = 0; i < LOOP_MAX; i++) {"),e.push("if ("),this.astGeneric(t.test,e),e.push(") {\n"),this.astGeneric(t.body,e),e.push("} else {\n"),e.push("break;\n"),e.push("}\n"),e.push("}\n"),e}},{key:"astDoWhileStatement",value:function(t,e){if("DoWhileStatement"!==t.type)throw this.astErrorOutput("Invalid while statement",t);return e.push("for (let i = 0; i < LOOP_MAX; i++) {"),this.astGeneric(t.body,e),e.push("if (!"),this.astGeneric(t.test,e),e.push(") {\n"),e.push("break;\n"),e.push("}\n"),e.push("}\n"),e}},{key:"astAssignmentExpression",value:function(t,e){return this.astGeneric(t.left,e),e.push(t.operator),this.astGeneric(t.right,e),e}},{key:"astEmptyStatement",value:function(t,e){return e}},{key:"astBlockStatement",value:function(t,e){e.push("{\n");for(var n=0;n<t.body.length;n++)this.astGeneric(t.body[n],e);return e.push("}\n"),e}},{key:"astExpressionStatement",value:function(t,e){return this.astGeneric(t.expression,e),e.push(";\n"),e}},{key:"astVariableDeclaration",value:function(t,e){e.push("var ");for(var n=0;n<t.declarations.length;n++)n>0&&e.push(","),this.astGeneric(t.declarations[n],e);return e.push(";"),e}},{key:"astVariableDeclarator",value:function(t,e){return this.astGeneric(t.id,e),null!==t.init&&(e.push("="),this.astGeneric(t.init,e)),e}},{key:"astIfStatement",value:function(t,e){return e.push("if ("),this.astGeneric(t.test,e),e.push(")"),"BlockStatement"===t.consequent.type?this.astGeneric(t.consequent,e):(e.push(" {\n"),this.astGeneric(t.consequent,e),e.push("\n}\n")),t.alternate&&(e.push("else "),"BlockStatement"===t.alternate.type?this.astGeneric(t.alternate,e):(e.push(" {\n"),this.astGeneric(t.alternate,e),e.push("\n}\n"))),e}},{key:"astBreakStatement",value:function(t,e){return e.push("break;\n"),e}},{key:"astContinueStatement",value:function(t,e){return e.push("continue;\n"),e}},{key:"astLogicalExpression",value:function(t,e){return e.push("("),this.astGeneric(t.left,e),e.push(t.operator),this.astGeneric(t.right,e),e.push(")"),e}},{key:"astUpdateExpression",value:function(t,e){return t.prefix?(e.push(t.operator),this.astGeneric(t.argument,e)):(this.astGeneric(t.argument,e),e.push(t.operator)),e}},{key:"astUnaryExpression",value:function(t,e){return t.prefix?(e.push(t.operator),this.astGeneric(t.argument,e)):(this.astGeneric(t.argument,e),e.push(t.operator)),e}},{key:"astThisExpression",value:function(t,e){return e.push("_this"),e}},{key:"astMemberExpression",value:function(t,e){if(t.computed)if("Identifier"===t.object.type)this.pushState("identifier"),this.astGeneric(t.object,e),this.popState("identifier"),e.push("["),this.isInput(t.object.name)?this.astGeneric(t.property,e):this.astGeneric(t.property,e),e.push("]");else if(t.object.object)if(t.object.object.object&&this.isInput(t.object.object.object.name)){this.pushMemberState(t.object.object.object.name),this.pushState("input-index-z"),this.astGeneric(t.object,e);var n=e.pop();e.push(" + "),this.popState("input-index-z"),this.pushState("input-index"),this.astGeneric(t.property,e),this.popState("input-index"),e.push(n),this.popMemberState(t.object.object.object.name)}else if(this.isInput(t.object.object.name)){this.pushMemberState(t.object.object.name),this.isState("input-index-z")||this.pushState("input-index-y"),this.astGeneric(t.object,e);var r=e.pop();e.push(" + "),this.isState("input-index-z")||this.popState("input-index-y");var i=this.isState("input-index-z");i?this.pushState("input-index-y"):this.pushState("input-index"),this.astGeneric(t.property,e),i?this.popState("input-index-y"):this.popState("input-index"),e.push(r),this.popMemberState(t.object.object.name)}else{this.astGeneric(t.object,e);var s=e.pop();e.push("]["),this.astGeneric(t.property,e),e.push(s)}else{this.astGeneric(t.object,e);var a=e.pop();e.push("]["),this.astGeneric(t.property,e),e.push(a)}else{var o=this.astMemberExpressionUnroll(t);switch("Identifier"===t.property.type&&t.computed&&(o="user_"+o),0===o.indexOf("this")&&(o="_"+o),this.state){case"input-index-y":case"input-index-z":e.push("(")}switch(o){case"_this.output.x":e.push(this.output[0]);break;case"_this.output.y":e.push(this.output[1]);break;case"_this.output.z":e.push(this.output[2]);break;default:e.push(o)}switch(this.state){case"input-index-y":var u=this.paramSizes[this.paramNames.indexOf(this.memberState)];e.push(" * "+u[0]+")");break;case"input-index-z":var h=this.paramSizes[this.paramNames.indexOf(this.memberState)];e.push(" * "+h[0]*h[1]+")")}}return e}},{key:"astSequenceExpression",value:function(t,e){for(var n=0;n<t.expressions.length;n++)n>0&&e.push(","),this.astGeneric(t.expressions,e);return e}},{key:"astCallExpression",value:function(t,e){if(t.callee){var n=this.astMemberExpressionUnroll(t.callee);this.calledFunctions.indexOf(n)<0&&this.calledFunctions.push(n),this.hasOwnProperty("funcName")||(this.calledFunctionsArguments[n]=[]);var r=[];this.calledFunctionsArguments[n].push(r),e.push(n),e.push("(");for(var i=0;i<t.arguments.length;++i){var s=t.arguments[i];if(i>0&&e.push(", "),this.astGeneric(s,e),"Identifier"===s.type){var a=this.paramNames.indexOf(s.name);a===-1?r.push(null):r.push({name:s.name,type:this.paramTypes[a]})}else r.push(null)}return e.push(")"),e}throw this.astErrorOutput("Unknown CallExpression",t)}},{key:"astArrayExpression",value:function(t,e){var n=t.elements.length;e.push("new Float32Array(");for(var r=0;r<n;++r){r>0&&e.push(", ");var i=t.elements[r];this.astGeneric(i,e)}return e.push(")"),e}},{key:"astDebuggerStatement",value:function(t,e){return e.push("debugger;"),e}},{key:"memberState",get:function(){return this.memberStates[this.memberStates.length-1]}}]),e}(o)},{"../../core/utils":32,"../function-node-base":7}],3:[function(t,e,n){function r(t){return/^function /.test(t)&&(t=t.substring(9)),t.replace(/[_]typeof/g,"typeof")}function i(t){return t.replace(/[_]typeof/g,"typeof")}var s=t("../../core/utils"),a=t("../kernel-run-shortcut");e.exports=function(t,e){return"() => {\n    "+a.toString()+";\n    const utils = {\n      allPropertiesOf: "+i(s.allPropertiesOf.toString())+",\n      clone: "+i(s.clone.toString())+"\n    };\n    const Utils = utils;\n    class "+(e||"Kernel")+" {\n      constructor() {        \n        this.argumentsLength = 0;\n        this._canvas = null;\n        this._webGl = null;\n        this.built = false;\n        this.program = null;\n        this.paramNames = "+JSON.stringify(t.paramNames)+";\n        this.paramTypes = "+JSON.stringify(t.paramTypes)+";\n        this.texSize = "+JSON.stringify(t.texSize)+";\n        this.output = "+JSON.stringify(t.output)+";\n        this._kernelString = `"+t._kernelString+"`;\n        this.output = "+JSON.stringify(t.output)+";\n\t\t    this.run = function() {\n          this.run = null;\n          this.build();\n          return this.run.apply(this, arguments);\n        }.bind(this);\n        this.thread = {\n          x: 0,\n          y: 0,\n          z: 0\n        };\n      }\n      setCanvas(canvas) { this._canvas = canvas; return this; }\n      setWebGl(webGl) { this._webGl = webGl; return this; }\n      "+r(t.build.toString())+"\n      "+r(t.setupParams.toString())+"\n      run () { "+t.kernelString+" }\n      getKernelString() { return this._kernelString; }\n      "+r(t.validateOptions.toString())+"\n    };\n    return kernelRunShortcut(new Kernel());\n  };"}},{"../../core/utils":32,"../kernel-run-shortcut":9}],4:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("../kernel-base"),u=t("../../core/utils"),h=t("./kernel-string");e.exports=function(t){function e(t,n){r(this,e);var s=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return s._fnBody=u.getFunctionBodyFromString(t),s._fn=null,s.run=null,s._canvasCtx=null,s._imageData=null,s._colorData=null,s._kernelString=null,s.thread={x:0,y:0,z:0},s.run=function(){return this.run=null,this.build.apply(this,arguments),this.run.apply(this,arguments)}.bind(s),s}return s(e,t),a(e,[{key:"validateOptions",value:function(){if(!this.output||0===this.output.length){if(1!==arguments.length)throw"Auto dimensions only supported for kernels with only one input";var t=u.getArgumentType(arguments[0]);if("Array"===t)this.output=u.getDimensions(t);else{if("Texture"!==t)throw"Auto dimensions not supported for input type: "+t;this.output=arguments[0].output}}}},{key:"build",value:function(){this.setupParams(arguments),this.validateOptions();for(var t=this.threadDim=u.clone(this.output);t.length<3;)t.push(1);if(this.graphical){var e=this.getCanvas();e.width=t[0],e.height=t[1],this._canvasCtx=e.getContext("2d"),this._imageData=this._canvasCtx.createImageData(t[0],t[1]),this._colorData=new Uint8ClampedArray(t[0]*t[1]*4)}var n=this.getKernelString();this.debug&&(console.log("Options:"),console.dir(this),console.log("Function output:"),console.log(n)),this.kernelString=n,this.run=new Function([],n).bind(this)()}},{key:"color",value:function(t,e,n,r){"undefined"==typeof r&&(r=1),t=Math.floor(255*t),e=Math.floor(255*e),n=Math.floor(255*n),r=Math.floor(255*r);var i=this.output[0],s=this.output[1],a=this.thread.x,o=s-this.thread.y-1,u=a+o*i;this._colorData[4*u+0]=t,this._colorData[4*u+1]=e,this._colorData[4*u+2]=n,this._colorData[4*u+3]=r}},{key:"getKernelString",value:function(){var t=this;if(null!==this._kernelString)return this._kernelString;for(var e=this.functionBuilder,n=this.threadDim||(this.threadDim=u.clone(this.output));n.length<3;)n.push(1);if(e.addKernel(this.fnString,{prototypeOnly:!1,constants:this.constants,output:n,debug:this.debug,loopMaxIterations:this.loopMaxIterations,paramNames:this.paramNames,paramTypes:this.paramTypes,paramSizes:this.paramSizes}),e.addFunctions(this.functions,{constants:this.constants,output:n}),e.addNativeFunctions(this.nativeFunctions),null!==this.subKernels){this.subKernelOutputTextures=[],this.subKernelOutputVariableNames=[];for(var r=0;r<this.subKernels.length;r++){var i=this.subKernels[r];e.addSubKernel(i,{prototypeOnly:!1,constants:this.constants,output:this.output,debug:this.debug,loopMaxIterations:this.loopMaxIterations}),this.subKernelOutputVariableNames.push(i.name+"Result")}}else if(null!==this.subKernelProperties){this.subKernelOutputVariableNames=[];var s=0;for(var a in this.subKernelProperties)if(this.subKernelProperties.hasOwnProperty(a)){var o=this.subKernelProperties[a];e.addSubKernel(o),this.subKernelOutputVariableNames.push(o.name+"Result"),s++}}var h=e.getPrototypes("kernel"),p=null;h.length>1?h=h.filter(function(t){return/^function/.test(t)?t:(p=t,!1)}):p=h.shift();var l=this._kernelString="\n\t\tvar LOOP_MAX = "+this._getLoopMaxString()+";\n\t\tvar _this = this;\n  "+(null===this.subKernelOutputVariableNames?"":this.subKernelOutputVariableNames.map(function(t){return"  var "+t+" = null;\n"}).join(""))+"\n    return function ("+this.paramNames.map(function(t){return"user_"+t}).join(", ")+") {\n  "+this._processInputs()+"\n    var ret = new Array("+n[2]+");\n  "+(null===this.subKernelOutputVariableNames?"":this.subKernelOutputVariableNames.map(function(t){return"  "+t+"Z = new Array("+n[2]+");\n"}).join(""))+"\n    for (this.thread.z = 0; this.thread.z < "+n[2]+"; this.thread.z++) {\n      ret[this.thread.z] = new Array("+n[1]+");\n  "+(null===this.subKernelOutputVariableNames?"":this.subKernelOutputVariableNames.map(function(t){return"    "+t+"Z[this.thread.z] = new Array("+n[1]+");\n"}).join(""))+"\n      for (this.thread.y = 0; this.thread.y < "+n[1]+"; this.thread.y++) {\n        ret[this.thread.z][this.thread.y] = new Array("+n[0]+");\n  "+(null===this.subKernelOutputVariableNames?"":this.subKernelOutputVariableNames.map(function(t){return"      "+t+"Z[this.thread.z][this.thread.y] = new Array("+n[0]+");\n"}).join(""))+"\n        for (this.thread.x = 0; this.thread.x < "+n[0]+"; this.thread.x++) {\n          var kernelResult;\n          "+p+"\n          ret[this.thread.z][this.thread.y][this.thread.x] = kernelResult;\n"+(null===this.subKernelOutputVariableNames?"":this.subKernelOutputVariableNames.map(function(t){return"        "+t+"Z[this.thread.z][this.thread.y][this.thread.x] = "+t+";\n"}).join(""))+"\n          }\n        }\n      }\n      \n      if (this.graphical) {\n        this._imageData.data.set(this._colorData);\n        this._canvasCtx.putImageData(this._imageData, 0, 0);\n        return;\n      }\n      \n      if (this.output.length === 1) {\n        ret = ret[0][0];\n"+(null===this.subKernelOutputVariableNames?"":this.subKernelOutputVariableNames.map(function(t){return"    "+t+" = "+t+"Z[0][0];\n"}).join(""))+"\n      \n    } else if (this.output.length === 2) {\n      ret = ret[0];\n      "+(null===this.subKernelOutputVariableNames?"":this.subKernelOutputVariableNames.map(function(t){return"    "+t+" = "+t+"Z[0];\n"}).join(""))+"\n    }\n    \n    "+(null===this.subKernelOutputVariableNames?"return ret;\n":null!==this.subKernels?"var result = [\n        "+this.subKernelOutputVariableNames.map(function(t){return""+t}).join(",\n")+"\n      ];\n      result.result = ret;\n      return result;\n":"return {\n        result: ret,\n        "+Object.keys(this.subKernelProperties).map(function(e,n){return e+": "+t.subKernelOutputVariableNames[n]}).join(",\n")+"\n      };")+"\n    "+(h.length>0?h.join("\n"):"")+"\n    }.bind(this);";return l}},{key:"toString",value:function(){return h(this)}},{key:"precompileKernelObj",value:function(t){var e=this.threadDim||(this.threadDim=u.clone(this.output));return{threadDim:e}}},{key:"_getLoopMaxString",value:function(){return this.loopMaxIterations?" "+parseInt(this.loopMaxIterations)+";\n":" 1000;\n"}},{key:"_processInputs",value:function(){for(var t=[],e=0;e<this.paramTypes.length;e++)switch(this.paramTypes[e]){case"HTMLImage":t.push("  user_"+this.paramNames[e]+" = this._imageTo2DArray(user_"+this.paramNames[e]+")");break;case"HTMLImageArray":t.push("  user_"+this.paramNames[e]+" = this._imageTo3DArray(user_"+this.paramNames[e]+")");break;case"Input":t.push("  user_"+this.paramNames[e]+" = user_"+this.paramNames[e]+".value")}return t.join(";\n")}},{key:"_imageTo2DArray",value:function(t){this._canvasCtx.drawImage(t,0,0,t.width,t.height);for(var e=this._canvasCtx.getImageData(0,0,t.width,t.height).data,n=new Array(t.height),r=0,i=t.height-1;i>=0;i--){n[i]=new Array(t.width);for(var s=0;s<t.width;s++)n[i][s]=[e[r++]/255,e[r++]/255,e[r++]/255,e[r++]/255]}return n}},{key:"_imageTo3DArray",value:function(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=this._imageTo2DArray(t[n]);return e}}],[{key:"compileKernel",value:function(t){for(var e=t.threadDim;e.length<3;)e.push(1)}}]),e}(o)},{"../../core/utils":32,"../kernel-base":8,"./kernel-string":3}],5:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=(t("../../core/utils"),t("../runner-base")),u=t("./kernel"),h=t("./function-builder");e.exports=function(t){function e(t){r(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,new h,t));return n.Kernel=u,n.kernel=null,n}return s(e,t),a(e,[{key:"getMode",value:function(){return"cpu"}}]),e}(o)},{"../../core/utils":32,"../runner-base":10,"./function-builder":1,"./kernel":4}],6:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();e.exports=function(){function t(e){r(this,t),this.nodeMap={},this.nativeFunctions={},this.gpu=e,this.rootKernel=null,this.Node=null}return i(t,[{key:"addNativeFunction",value:function(t,e){this.nativeFunctions[t]=e}},{key:"addFunction",value:function(t,e,n){this.addFunctionNode(new this.Node(t,e,n).setAddFunction(this.addFunction.bind(this)))}},{key:"addFunctions",value:function(t,e){if(t)if(Array.isArray(t))for(var n=0;n<t.length;n++)this.addFunction(null,t[n],e);else for(var r in t)this.addFunction(r,t[r],e)}},{key:"addNativeFunctions",value:function(t){for(var e in t)t.hasOwnProperty(e)&&this.addNativeFunction(e,t[e])}},{key:"addFunctionNode",value:function(t){this.nodeMap[t.functionName]=t,t.isRootKernel&&(this.rootKernel=t)}},{key:"traceFunctionCalls",value:function(t,e,n){t=t||"kernel",e=e||[];var r=this.nodeMap[t];if(r){var i=e.indexOf(t);if(i===-1){e.push(t),n&&(r.parent=n),r.getFunctionString();for(var s=0;s<r.calledFunctions.length;++s)this.traceFunctionCalls(r.calledFunctions[s],e,r)}else{var a=e.splice(i,1)[0];e.push(a)}}return this.nativeFunctions[t]&&(e.indexOf(t)>=0||e.push(t)),e}},{key:"addKernel",value:function(t,e){var n=new this.Node("kernel",t,e);return n.setAddFunction(this.addFunction.bind(this)),n.isRootKernel=!0,this.addFunctionNode(n),n}},{key:"addSubKernel",value:function(t,e){var n=new this.Node(null,t,e);return n.setAddFunction(this.addFunction.bind(this)),n.isSubKernel=!0,this.addFunctionNode(n),n}},{key:"getPrototypeString",value:function(t){return this.getPrototypes(t).join("\n")}},{key:"getPrototypes",value:function(t){return this.rootKernel.generate(),t?this.getPrototypesFromFunctionNames(this.traceFunctionCalls(t,[]).reverse()):this.getPrototypesFromFunctionNames(Object.keys(this.nodeMap))}},{key:"getStringFromFunctionNames",value:function(t){for(var e=[],n=0;n<t.length;++n){var r=this.nodeMap[t[n]];r&&e.push(this.nodeMap[t[n]].getFunctionString())}return e.join("\n")}},{key:"getPrototypesFromFunctionNames",value:function(t,e){for(var n=[],r=0;r<t.length;++r){var i=t[r],s=this.nodeMap[i];s?n.push(s.getFunctionPrototypeString(e)):this.nativeFunctions[i]&&n.push(this.nativeFunctions[i])}return n}},{key:"getPrototypeStringFromFunctionNames",value:function(t,e){return this.getPrototypesFromFunctionNames(t,e).toString()}},{key:"getString",value:function(t,e){return void 0===e&&(e={}),t?this.getStringFromFunctionNames(this.traceFunctionCalls(t,[],e).reverse(),e):this.getStringFromFunctionNames(Object.keys(this.nodeMap),e)}}]),t}()},{}],7:[function(require,module,exports){function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),utils=require("../core/utils"),acorn=require("acorn");module.exports=function(){function BaseFunctionNode(t,e,n){_classCallCheck(this,BaseFunctionNode),this.calledFunctions=[],this.calledFunctionsArguments={},this.addFunction=null,this.isRootKernel=!1,this.isSubKernel=!1,this.parent=null,this.debug=null,this.prototypeOnly=null,this.constants=null,this.output=null,this.declarations={},this.states=[];var r=void 0,i=void 0;if(n&&(n.hasOwnProperty("debug")&&(this.debug=n.debug),n.hasOwnProperty("prototypeOnly")&&(this.prototypeOnly=n.prototypeOnly),n.hasOwnProperty("constants")&&(this.constants=n.constants),n.hasOwnProperty("output")&&(this.output=n.output),n.hasOwnProperty("loopMaxIterations")&&(this.loopMaxIterations=n.loopMaxIterations),n.hasOwnProperty("paramTypes")&&(this.paramTypes=r=n.paramTypes),n.hasOwnProperty("returnType")&&(i=n.returnType)),!e)throw"jsFunction, parameter is missing";if(this.jsFunctionString=e.toString(),!utils.isFunctionString(this.jsFunctionString))throw console.error("jsFunction, to string conversion check failed: not a function?",this.jsFunctionString),"jsFunction, to string conversion check failed: not a function?";if(utils.isFunction(e)?this.jsFunction=e:this.jsFunction=null,this.functionName=t||e&&e.name||utils.getFunctionNameFromString(this.jsFunctionString),!this.functionName)throw"jsFunction, missing name argument or value";if(this.paramNames=utils.getParamNamesFromString(this.jsFunctionString),r){if(Array.isArray(r)){if(r.length!==this.paramNames.length)throw"Invalid argument type array length, against function length -> ("+r.length+","+this.paramNames.length+")";this.paramTypes=r}else if("object"===("undefined"==typeof r?"undefined":_typeof(r))){var s=Object.keys(r);if(r.hasOwnProperty("returns")&&(this.returnType=r.returns,s.splice(s.indexOf("returns"),1)),s.length>0&&s.length!==this.paramNames.length)throw"Invalid argument type array length, against function length -> ("+s.length+","+this.paramNames.length+")";this.paramTypes=this.paramNames.map(function(t){return r.hasOwnProperty(t)?r[t]:"float"})}}else this.paramTypes=[];this.returnType||(this.returnType=i||"float")}return _createClass(BaseFunctionNode,[{key:"isIdentifierConstant",value:function(t){return!!this.constants&&this.constants.hasOwnProperty(t)}},{key:"isInput",value:function(t){return"Input"===this.paramTypes[this.paramNames.indexOf(t)]}},{key:"setAddFunction",value:function(t){return this.addFunction=t,this}},{key:"pushState",value:function(t){this.states.push(t)}},{key:"popState",value:function(t){if(this.state!==t)throw new Error("Cannot popState "+t+" when in "+this.state);this.states.pop()}},{key:"isState",value:function(t){return this.state===t}},{key:"getJsFunction",value:function getJsFunction(){if(this.jsFunction)return this.jsFunction;if(this.jsFunctionString)return this.jsFunction=eval(this.jsFunctionString),this.jsFunction;throw"Missing jsFunction, and jsFunctionString parameter"}},{key:"astMemberExpressionUnroll",value:function(t){if("Identifier"===t.type)return t.name;if("ThisExpression"===t.type)return"this";if("MemberExpression"===t.type&&t.object&&t.property)return t.object.hasOwnProperty("name")&&"_"===t.object.name[0]?this.astMemberExpressionUnroll(t.property):this.astMemberExpressionUnroll(t.object)+"."+this.astMemberExpressionUnroll(t.property);if(t.hasOwnProperty("expressions")){var e=t.expressions[0];if("Literal"===e.type&&0===e.value&&2===t.expressions.length)return this.astMemberExpressionUnroll(t.expressions[1])}throw this.astErrorOutput("Unknown CallExpression_unroll",t)}},{key:"getJsAST",value:function(t){if(this.jsFunctionAST)return this.jsFunctionAST;if(t=t||acorn,null===t)throw"Missing JS to AST parser";var e=t.parse("var "+this.functionName+" = "+this.jsFunctionString+";",{locations:!0});if(null===e)throw"Failed to parse JS code";var n=e.body[0].declarations[0].init;return this.jsFunctionAST=n,n}},{key:"getFunctionString",value:function(){return this.generate(),this.functionString}},{key:"setFunctionString",value:function(t){this.functionString=t}},{key:"getParamType",value:function(t){var e=this.paramNames.indexOf(t);if(e===-1)return this.declarations.hasOwnProperty(t)?this.declarations[t]:null;if(this.parent){if(this.paramTypes[e])return this.paramTypes[e];for(var n=this.parent.calledFunctionsArguments[this.functionName],r=0;r<n.length;r++){var i=n[r];if(null!==i[e])return this.paramTypes[e]=i[e].type;
  }}else if(this.paramTypes[e])return this.paramTypes[e];return null}},{key:"getUserParamName",value:function(t){var e=this.paramNames.indexOf(t);if(e===-1)return null;if(!this.parent)return null;for(var n=this.parent.calledFunctionsArguments[this.functionName],r=0;r<n.length;r++){var i=n[r],s=i[e];if(null!==s&&"Integer"!==s.type)return s.name}return null}},{key:"generate",value:function(t){throw new Error("generate not defined on BaseFunctionNode")}},{key:"astGeneric",value:function(t,e){if(null===t)throw this.astErrorOutput("NULL ast",t);if(Array.isArray(t)){for(var n=0;n<t.length;n++)this.astGeneric(t[n],e);return e}switch(t.type){case"FunctionDeclaration":return this.astFunctionDeclaration(t,e);case"FunctionExpression":return this.astFunctionExpression(t,e);case"ReturnStatement":return this.astReturnStatement(t,e);case"Literal":return this.astLiteral(t,e);case"BinaryExpression":return this.astBinaryExpression(t,e);case"Identifier":return this.astIdentifierExpression(t,e);case"AssignmentExpression":return this.astAssignmentExpression(t,e);case"ExpressionStatement":return this.astExpressionStatement(t,e);case"EmptyStatement":return this.astEmptyStatement(t,e);case"BlockStatement":return this.astBlockStatement(t,e);case"IfStatement":return this.astIfStatement(t,e);case"BreakStatement":return this.astBreakStatement(t,e);case"ContinueStatement":return this.astContinueStatement(t,e);case"ForStatement":return this.astForStatement(t,e);case"WhileStatement":return this.astWhileStatement(t,e);case"DoWhileStatement":return this.astDoWhileStatement(t,e);case"VariableDeclaration":return this.astVariableDeclaration(t,e);case"VariableDeclarator":return this.astVariableDeclarator(t,e);case"ThisExpression":return this.astThisExpression(t,e);case"SequenceExpression":return this.astSequenceExpression(t,e);case"UnaryExpression":return this.astUnaryExpression(t,e);case"UpdateExpression":return this.astUpdateExpression(t,e);case"LogicalExpression":return this.astLogicalExpression(t,e);case"MemberExpression":return this.astMemberExpression(t,e);case"CallExpression":return this.astCallExpression(t,e);case"ArrayExpression":return this.astArrayExpression(t,e);case"DebuggerStatement":return this.astDebuggerStatement(t,e)}throw this.astErrorOutput("Unknown ast type : "+t.type,t)}},{key:"astErrorOutput",value:function(t,e){return console.error(utils.getAstString(this.jsFunctionString,e)),console.error(t,e,this),t}},{key:"astDebuggerStatement",value:function(t,e){return e}},{key:"astFunctionDeclaration",value:function(t,e){return e}},{key:"astFunctionExpression",value:function(t,e){return e}},{key:"astReturnStatement",value:function(t,e){return e}},{key:"astLiteral",value:function(t,e){return e}},{key:"astBinaryExpression",value:function(t,e){return e}},{key:"astIdentifierExpression",value:function(t,e){return e}},{key:"astAssignmentExpression",value:function(t,e){return e}},{key:"astExpressionStatement",value:function(t,e){return e}},{key:"astEmptyStatement",value:function(t,e){return e}},{key:"astBlockStatement",value:function(t,e){return e}},{key:"astIfStatement",value:function(t,e){return e}},{key:"astBreakStatement",value:function(t,e){return e}},{key:"astContinueStatement",value:function(t,e){return e}},{key:"astForStatement",value:function(t,e){return e}},{key:"astWhileStatement",value:function(t,e){return e}},{key:"astDoWhileStatement",value:function(t,e){return e}},{key:"astVariableDeclaration",value:function(t,e){return e}},{key:"astVariableDeclarator",value:function(t,e){return e}},{key:"astThisExpression",value:function(t,e){return e}},{key:"astSequenceExpression",value:function(t,e){return e}},{key:"astUnaryExpression",value:function(t,e){return e}},{key:"astUpdateExpression",value:function(t,e){return e}},{key:"astLogicalExpression",value:function(t,e){return e}},{key:"astMemberExpression",value:function(t,e){return e}},{key:"astCallExpression",value:function(t,e){return e}},{key:"astArrayExpression",value:function(t,e){return e}},{key:"state",get:function(){return this.states[this.states.length-1]}}]),BaseFunctionNode}()},{"../core/utils":32,acorn:34}],8:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=t("../core/utils"),a=t("../core/input");e.exports=function(){function t(e,n){r(this,t),this.paramNames=s.getParamNamesFromString(e),this.fnString=e,this.output=null,this.debug=!1,this.graphical=!1,this.loopMaxIterations=0,this.constants=null,this.wraparound=null,this.hardcodeConstants=null,this.outputToTexture=null,this.outputImmutable=null,this.texSize=null,this._canvas=null,this._webGl=null,this.threadDim=null,this.floatTextures=null,this.floatOutput=null,this.floatOutputForce=null,this.addFunction=null,this.functions=null,this.nativeFunctions=null,this.subKernels=null,this.subKernelProperties=null,this.subKernelNames=null,this.subKernelOutputVariableNames=null,this.functionBuilder=null,this.paramTypes=null,this.paramSizes=null;for(var i in n)n.hasOwnProperty(i)&&this.hasOwnProperty(i)&&(this[i]=n[i]);n.hasOwnProperty("canvas")&&(this._canvas=n.canvas),n.hasOwnProperty("output")&&this.setOutput(n.output),this._canvas||(this._canvas=s.initCanvas())}return i(t,[{key:"build",value:function(){throw new Error('"build" not defined on Base')}},{key:"setupParams",value:function(t){this.paramTypes=[],this.paramSizes=[];for(var e=0;e<t.length;e++){var n=t[e];this.paramTypes.push(s.getArgumentType(n)),this.paramSizes.push(n.constructor===a?n.size:null)}}},{key:"setAddFunction",value:function(t){return this.addFunction=t,this}},{key:"setFunctions",value:function(t){return this.functions=t,this}},{key:"setOutput",value:function(t){return t.hasOwnProperty("x")?t.hasOwnProperty("y")?t.hasOwnProperty("z")?this.output=[t.x,t.y,t.z]:this.output=[t.x,t.y]:this.output=[t.x]:this.output=t,this}},{key:"setDebug",value:function(t){return this.debug=t,this}},{key:"setGraphical",value:function(t){return this.graphical=t,this}},{key:"setLoopMaxIterations",value:function(t){return this.loopMaxIterations=t,this}},{key:"setConstants",value:function(t){return this.constants=t,this}},{key:"setWraparound",value:function(t){return console.warn("Wraparound mode is not supported and undocumented."),this.wraparound=t,this}},{key:"setHardcodeConstants",value:function(t){return this.hardcodeConstants=t,this}},{key:"setOutputToTexture",value:function(t){return this.outputToTexture=t,this}},{key:"setOutputImmutable",value:function(t){return this.outputImmutable=t,this}},{key:"setFloatTextures",value:function(t){return this.floatTextures=t,this}},{key:"setFloatOutput",value:function(t){return this.floatOutput=t,this}},{key:"setFloatOutputForce",value:function(t){return this.floatOutputForce=t,this}},{key:"setCanvas",value:function(t){return this._canvas=t,this}},{key:"setWebGl",value:function(t){return this._webGl=t,this}},{key:"getCanvas",value:function(){return this._canvas}},{key:"getWebGl",value:function(){return this._webGl}},{key:"validateOptions",value:function(){throw new Error("validateOptions not defined")}},{key:"exec",value:function(){return this.execute.apply(this,arguments)}},{key:"execute",value:function(){var t=this,e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);return s.newPromise(function(n,r){try{n(t.run.apply(t,e))}catch(i){r(i)}})}},{key:"addSubKernel",value:function(t){return null===this.subKernels&&(this.subKernels=[],this.subKernelNames=[]),this.subKernels.push(t),this.subKernelNames.push(s.getFunctionNameFromString(t)),this}},{key:"addSubKernelProperty",value:function(t,e){if(null===this.subKernelProperties&&(this.subKernelProperties={},this.subKernelNames=[]),this.subKernelProperties.hasOwnProperty(t))throw new Error("cannot add sub kernel "+t+", already defined");return this.subKernelProperties[t]=e,this.subKernelNames.push(s.getFunctionNameFromString(e)),this}},{key:"addNativeFunction",value:function(t,e){this.functionBuilder.addNativeFunction(t,e)}}]),t}()},{"../core/input":29,"../core/utils":32}],9:[function(t,e,n){var r=t("../core/utils");e.exports=function(t){var e=function(){return t.run.apply(t,arguments)};return r.allPropertiesOf(t).forEach(function(n){"_"===n[0]&&"_"===n[1]||("function"==typeof t[n]?"add"===n.substring(0,3)||"set"===n.substring(0,3)?e[n]=function(){return t[n].apply(t,arguments),e}:e[n]=t[n].bind(t):(e.__defineGetter__(n,function(){return t[n]}),e.__defineSetter__(n,function(e){t[n]=e})))}),e.kernel=t,e}},{"../core/utils":32}],10:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=t("../core/utils"),a=t("./kernel-run-shortcut");e.exports=function(){function t(e,n){r(this,t),n=n||{},this.kernel=n.kernel,this.canvas=n.canvas,this.webGl=n.webGl,this.fn=null,this.functionBuilder=e,this.fnString=null,this.endianness=s.systemEndianness()}return i(t,[{key:"textureToArray",value:function(t){var e=this.createKernel(function(t){return t[this.thread.z][this.thread.y][this.thread.x]});return e(t)}},{key:"deleteTexture",value:function(t){this.webGl.deleteTexture(t.texture)}},{key:"buildPromiseKernel",value:function(){throw new Error("not yet implemented")}},{key:"getMode",value:function(){throw new Error('"mode" not implemented on BaseRunner')}},{key:"buildKernel",value:function(t,e){e=Object.assign({},e||{});var n=t.toString();return e.functionBuilder||(e.functionBuilder=this.functionBuilder),e.canvas||(e.canvas=this.canvas),e.webGl||(e.webGl=this.webgl),a(new this.Kernel(n,e))}}]),t}()},{"../core/utils":32,"./kernel-run-shortcut":9}],11:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return Math.floor(t+.5)}var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=t("../function-builder-base"),h=t("./function-node");e.exports=function(t){function e(){r(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.Node=h,t}return s(e,t),o(e,[{key:"polyfillStandardFunctions",value:function(){this.addFunction("round",a)}}],[{key:"round",value:function(t){return a(t)}}]),e}(u)},{"../function-builder-base":6,"./function-node":12}],12:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return t.replace(f,"((").replace(d,"((")}var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=t("../function-node-base"),h=t("../../core/utils"),p="Math.",l="this.",c="this.constants.",f=/decode32\(\s+encode32\(/g,d=/encode32\(\s+decode32\(/g;e.exports=function(t){function e(){return r(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),o(e,[{key:"generate",value:function(){return this.debug&&console.log(this),this.prototypeOnly?e.astFunctionPrototype(this.getJsAST(),[],this).join("").trim():(this.functionStringArray=this.astGeneric(this.getJsAST(),[],this),this.functionString=a(this.functionStringArray.join("").trim()),this.functionString)}},{key:"astFunctionDeclaration",value:function(t,e){return this.addFunction&&this.addFunction(null,h.getAstString(this.jsFunctionString,t)),e}},{key:"astFunctionExpression",value:function(t,e){if(this.isRootKernel?(e.push("void"),this.kernalAst=t):e.push(this.returnType),e.push(" "),e.push(this.functionName),e.push("("),!this.isRootKernel)for(var n=0;n<this.paramNames.length;++n){var r=this.paramNames[n];n>0&&e.push(", ");var i=this.getParamType(r);switch(i){case"Texture":case"Input":case"Array":e.push("sampler2D");break;default:e.push("float")}e.push(" "),e.push("user_"),e.push(r)}e.push(") {\n");for(var s=0;s<t.body.body.length;++s)this.astGeneric(t.body.body[s],e),e.push("\n");return e.push("}\n"),e}},{key:"astReturnStatement",value:function(t,e){return this.isRootKernel?(e.push("kernelResult = "),this.astGeneric(t.argument,e),e.push(";"),e.push("return;")):this.isSubKernel?(e.push(this.functionName+"Result = "),this.astGeneric(t.argument,e),e.push(";"),e.push("return "+this.functionName+"Result;")):(e.push("return "),this.astGeneric(t.argument,e),e.push(";")),e}},{key:"astLiteral",value:function(t,e){if(isNaN(t.value))throw this.astErrorOutput("Non-numeric literal not supported : "+t.value,t);return e.push(t.value),Number.isInteger(t.value)&&e.push(".0"),e}},{key:"astBinaryExpression",value:function(t,e){return e.push("("),"%"===t.operator?(e.push("mod("),this.astGeneric(t.left,e),e.push(","),this.astGeneric(t.right,e),e.push(")")):"==="===t.operator?(this.astGeneric(t.left,e),e.push("=="),this.astGeneric(t.right,e)):"!=="===t.operator?(this.astGeneric(t.left,e),e.push("!="),this.astGeneric(t.right,e)):(this.astGeneric(t.left,e),e.push(t.operator),this.astGeneric(t.right,e)),e.push(")"),e}},{key:"astIdentifierExpression",value:function(t,e){if("Identifier"!==t.type)throw this.astErrorOutput("IdentifierExpression - not an Identifier",t);switch(t.name){case"gpu_threadX":e.push("threadId.x");break;case"gpu_threadY":e.push("threadId.y");break;case"gpu_threadZ":e.push("threadId.z");break;case"gpu_outputX":e.push("uOutputDim.x");break;case"gpu_outputY":e.push("uOutputDim.y");break;case"gpu_outputZ":e.push("uOutputDim.z");break;case"Infinity":e.push("3.402823466e+38");break;default:if(this.constants&&this.constants.hasOwnProperty(t.name))e.push("constants_"+t.name);else{var n=this.getUserParamName(t.name);null!==n?e.push("user_"+n):e.push("user_"+t.name)}}return e}},{key:"astForStatement",value:function(t,e){if("ForStatement"!==t.type)throw this.astErrorOutput("Invalid for statment",t);if(t.test&&"BinaryExpression"===t.test.type){if("Identifier"===t.test.right.type&&"<"===t.test.operator&&this.isIdentifierConstant(t.test.right.name)===!1){if(this.loopMaxIterations||(console.warn("Warning: loopMaxIterations is not set! Using default of 1000 which may result in unintended behavior."),console.warn("Set loopMaxIterations or use a for loop of fixed length to silence this message.")),e.push("for ("),this.astGeneric(t.init,e),this.astGeneric(t.test.left,e),e.push(t.test.operator),e.push("LOOP_MAX"),e.push(";"),this.astGeneric(t.update,e),e.push(")"),e.push("{\n"),e.push("if ("),this.astGeneric(t.test.left,e),e.push(t.test.operator),this.astGeneric(t.test.right,e),e.push(") {\n"),"BlockStatement"===t.body.type)for(var n=0;n<t.body.body.length;n++)this.astGeneric(t.body.body[n],e);else this.astGeneric(t.body,e);return e.push("} else {\n"),e.push("break;\n"),e.push("}\n"),e.push("}\n"),e}var r=JSON.parse(JSON.stringify(t.init.declarations)),i=t.update.argument;if(!Array.isArray(r)||r.length<1)throw console.log(this.jsFunctionString),new Error("Error: Incompatible for loop declaration");if(r.length>1){for(var s=null,a=0;a<r.length;a++){var o=r[a];o.id.name===i.name?(s=o,r.splice(a,1)):(e.push("float "),this.astGeneric(o,e),e.push(";"))}e.push("for (float "),this.astGeneric(s,e),e.push(";")}else e.push("for ("),this.astGeneric(t.init,e);return this.astGeneric(t.test,e),e.push(";"),this.astGeneric(t.update,e),e.push(")"),this.astGeneric(t.body,e),e}throw this.astErrorOutput("Invalid for statement",t)}},{key:"astWhileStatement",value:function(t,e){if("WhileStatement"!==t.type)throw this.astErrorOutput("Invalid while statment",t);return e.push("for (float i = 0.0; i < LOOP_MAX; i++) {"),e.push("if ("),this.astGeneric(t.test,e),e.push(") {\n"),this.astGeneric(t.body,e),e.push("} else {\n"),e.push("break;\n"),e.push("}\n"),e.push("}\n"),e}},{key:"astDoWhileStatement",value:function(t,e){if("DoWhileStatement"!==t.type)throw this.astErrorOutput("Invalid while statment",t);return e.push("for (float i = 0.0; i < LOOP_MAX; i++) {"),this.astGeneric(t.body,e),e.push("if (!"),this.astGeneric(t.test,e),e.push(") {\n"),e.push("break;\n"),e.push("}\n"),e.push("}\n"),e}},{key:"astAssignmentExpression",value:function(t,e){return"%="!==t.operator?(this.astGeneric(t.left,e),e.push(t.operator),this.astGeneric(t.right,e),e):(this.astGeneric(t.left,e),e.push("="),e.push("mod("),this.astGeneric(t.left,e),e.push(","),this.astGeneric(t.right,e),e.push(")"),void 0)}},{key:"astEmptyStatement",value:function(t,e){return e}},{key:"astBlockStatement",value:function(t,e){e.push("{\n");for(var n=0;n<t.body.length;n++)this.astGeneric(t.body[n],e);return e.push("}\n"),e}},{key:"astExpressionStatement",value:function(t,e){return this.astGeneric(t.expression,e),e.push(";\n"),e}},{key:"astVariableDeclaration",value:function(t,e){for(var n=0;n<t.declarations.length;n++){var r=t.declarations[n];n>0&&e.push(",");var i=[];this.astGeneric(r,i),"getImage2D("===i[2]||"getImage3D("===i[2]?(0===n&&e.push("vec4 "),this.declarations[r.id.name]="vec4"):(0===n&&e.push("float "),this.declarations[r.id.name]="float"),e.push.apply(e,i)}return e.push(";"),e}},{key:"astVariableDeclarator",value:function(t,e){return this.astGeneric(t.id,e),null!==t.init&&(e.push("="),this.astGeneric(t.init,e)),e}},{key:"astIfStatement",value:function(t,e){return e.push("if ("),this.astGeneric(t.test,e),e.push(")"),"BlockStatement"===t.consequent.type?this.astGeneric(t.consequent,e):(e.push(" {\n"),this.astGeneric(t.consequent,e),e.push("\n}\n")),t.alternate&&(e.push("else "),"BlockStatement"===t.alternate.type?this.astGeneric(t.alternate,e):(e.push(" {\n"),this.astGeneric(t.alternate,e),e.push("\n}\n"))),e}},{key:"astBreakStatement",value:function(t,e){return e.push("break;\n"),e}},{key:"astContinueStatement",value:function(t,e){return e.push("continue;\n"),e}},{key:"astLogicalExpression",value:function(t,e){return e.push("("),this.astGeneric(t.left,e),e.push(t.operator),this.astGeneric(t.right,e),e.push(")"),e}},{key:"astUpdateExpression",value:function(t,e){return t.prefix?(e.push(t.operator),this.astGeneric(t.argument,e)):(this.astGeneric(t.argument,e),e.push(t.operator)),e}},{key:"astUnaryExpression",value:function(t,e){return t.prefix?(e.push(t.operator),this.astGeneric(t.argument,e)):(this.astGeneric(t.argument,e),e.push(t.operator)),e}},{key:"astThisExpression",value:function(t,e){return e.push("this"),e}},{key:"astMemberExpression",value:function(t,e){if(t.computed)if("Identifier"===t.object.type){var n=t.object.name,r=(this.functionName||"kernel",!1);if(this.paramNames){var i=this.paramNames.indexOf(n);i>=0&&"float"===this.paramTypes[i]&&(r=!0)}if(r)this.astGeneric(t.object,e),e.push("[int("),this.astGeneric(t.property,e),e.push(")]");else switch(this.getParamType(t.object.name)){case"vec4":this.astGeneric(t.object,e),e.push("["),e.push(t.property.raw),e.push("]");break;case"HTMLImageArray":e.push("getImage3D("),this.astGeneric(t.object,e),e.push(", vec2("),this.astGeneric(t.object,e),e.push("Size[0],"),this.astGeneric(t.object,e),e.push("Size[1]), vec3("),this.astGeneric(t.object,e),e.push("Dim[0],"),this.astGeneric(t.object,e),e.push("Dim[1],"),this.astGeneric(t.object,e),e.push("Dim[2]"),e.push("), "),this.astGeneric(t.property,e),e.push(")");break;case"HTMLImage":e.push("getImage2D("),this.astGeneric(t.object,e),e.push(", vec2("),this.astGeneric(t.object,e),e.push("Size[0],"),this.astGeneric(t.object,e),e.push("Size[1]), vec3("),this.astGeneric(t.object,e),e.push("Dim[0],"),this.astGeneric(t.object,e),e.push("Dim[1],"),this.astGeneric(t.object,e),e.push("Dim[2]"),e.push("), "),this.astGeneric(t.property,e),e.push(")");break;default:e.push("get("),this.astGeneric(t.object,e),e.push(", vec2("),this.astGeneric(t.object,e),e.push("Size[0],"),this.astGeneric(t.object,e),e.push("Size[1]), vec3("),this.astGeneric(t.object,e),e.push("Dim[0],"),this.astGeneric(t.object,e),e.push("Dim[1],"),this.astGeneric(t.object,e),e.push("Dim[2]"),e.push("), "),this.astGeneric(t.property,e),e.push(")")}}else{this.astGeneric(t.object,e);var s=e.pop();e.push(","),this.astGeneric(t.property,e),e.push(s)}else{var a=this.astMemberExpressionUnroll(t),o=a.toLowerCase();switch(0===a.indexOf(c)&&(a="constants_"+a.slice(c.length)),o){case"this.thread.x":e.push("threadId.x");break;case"this.thread.y":e.push("threadId.y");break;case"this.thread.z":e.push("threadId.z");break;case"this.output.x":e.push(this.output[0]+".0");break;case"this.output.y":e.push(this.output[1]+".0");break;case"this.output.z":e.push(this.output[2]+".0");break;default:e.push(a)}}return e}},{key:"astSequenceExpression",value:function(t,e){for(var n=0;n<t.expressions.length;n++)n>0&&e.push(","),this.astGeneric(t.expressions,e);return e}},{key:"astCallExpression",value:function(t,e){if(t.callee){var n=this.astMemberExpressionUnroll(t.callee);0===n.indexOf(p)&&(n=n.slice(p.length)),0===n.indexOf(l)&&(n=n.slice(l.length)),"atan2"===n&&(n="atan"),this.calledFunctions.indexOf(n)<0&&this.calledFunctions.push(n),this.hasOwnProperty("funcName")||(this.calledFunctionsArguments[n]=[]);var r=[];this.calledFunctionsArguments[n].push(r),e.push(n),e.push("(");for(var i=0;i<t.arguments.length;++i){var s=t.arguments[i];if(i>0&&e.push(", "),this.astGeneric(s,e),"Identifier"===s.type){var a=this.paramNames.indexOf(s.name);a===-1?r.push(null):r.push({name:s.name,type:this.paramTypes[a]})}else r.push(null)}return e.push(")"),e}throw this.astErrorOutput("Unknown CallExpression",t)}},{key:"astArrayExpression",value:function(t,e){var n=t.elements.length;e.push("float["+n+"](");for(var r=0;r<n;++r){r>0&&e.push(", ");var i=t.elements[r];this.astGeneric(i,e)}return e.push(")"),e}},{key:"getFunctionPrototypeString",value:function(){return this.webGlFunctionPrototypeString?this.webGlFunctionPrototypeString:this.webGlFunctionPrototypeString=this.generate()}},{key:"build",value:function(){return this.getFunctionPrototypeString().length>0}}],[{key:"astFunctionPrototype",value:function(t,e){if(this.isRootKernel||this.isSubKernel)return e;e.push(this.returnType),e.push(" "),e.push(this.functionName),e.push("(");for(var n=0;n<this.paramNames.length;++n)n>0&&e.push(", "),e.push(this.paramTypes[n]),e.push(" "),e.push("user_"),e.push(this.paramNames[n]);return e.push(");\n"),e}}]),e}(u)},{"../../core/utils":32,"../function-node-base":7}],13:[function(t,e,n){function r(t){return/^function /.test(t)&&(t=t.substring(9)),t.replace(/[_]typeof/g,"typeof")}function i(t){return t.replace(/[_]typeof/g,"typeof")}var s=t("../../core/utils"),a=t("../kernel-run-shortcut");e.exports=function(t,e){return"() => {\n    "+a.toString()+";\n    const utils = {\n      allPropertiesOf: "+i(s.allPropertiesOf.toString())+",\n      clone: "+i(s.clone.toString())+",\n      splitArray: "+i(s.splitArray.toString())+",\n      getArgumentType: "+i(s.getArgumentType.toString())+",\n      getDimensions: "+i(s.getDimensions.toString())+",\n      dimToTexSize: "+i(s.dimToTexSize.toString())+",\n      flattenTo: "+i(s.flattenTo.toString())+",\n      flatten2dArrayTo: "+i(s.flatten2dArrayTo.toString())+",\n      flatten3dArrayTo: "+i(s.flatten3dArrayTo.toString())+",\n      systemEndianness: '"+i(s.systemEndianness())+"',\n      initWebGl: "+i(s.initWebGl.toString())+",\n      isArray: "+i(s.isArray.toString())+"\n    };\n    const Utils = utils;\n    const canvases = [];\n    const maxTexSizes = {};\n    class "+(e||"Kernel")+" {\n      constructor() {\n        this.maxTexSize = null;\n        this.argumentsLength = 0;\n        this._canvas = null;\n        this._webGl = null;\n        this.built = false;\n        this.program = null;\n        this.paramNames = "+JSON.stringify(t.paramNames)+";\n        this.paramTypes = "+JSON.stringify(t.paramTypes)+";\n        this.texSize = "+JSON.stringify(t.texSize)+";\n        this.output = "+JSON.stringify(t.output)+";\n        this.compiledFragShaderString = `"+t.compiledFragShaderString+"`;\n\t\t    this.compiledVertShaderString = `"+t.compiledVertShaderString+"`;\n\t\t    this.programUniformLocationCache = {};\n\t\t    this.textureCache = {};\n\t\t    this.subKernelOutputTextures = null;\n\t\t    this.subKernelOutputVariableNames = null;\n\t\t    this.uniform1fCache = {};\n\t\t    this.uniform1iCache = {};\n\t\t    this.uniform2fCache = {};\n\t\t    this.uniform2fvCache = {};\n\t\t    this.uniform3fvCache = {};\n      }\n      "+r(t._getFragShaderString.toString())+"\n      "+r(t._getVertShaderString.toString())+"\n      validateOptions() {}\n      setupParams() {}\n      setCanvas(canvas) { this._canvas = canvas; return this; }\n      setWebGl(webGl) { this._webGl = webGl; return this; }\n      "+r(t.getUniformLocation.toString())+"\n      "+r(t.setupParams.toString())+"\n      "+r(t.build.toString())+"\n\t\t  "+r(t.run.toString())+"\n\t\t  "+r(t._addArgument.toString())+"\n\t\t  "+r(t.getArgumentTexture.toString())+"\n\t\t  "+r(t.getTextureCache.toString())+"\n\t\t  "+r(t.getOutputTexture.toString())+"\n\t\t  "+r(t.renderOutput.toString())+"\n\t\t  "+r(t.updateMaxTexSize.toString())+"\n\t\t  "+r(t._setupOutputTexture.toString())+"\n\t\t  "+r(t.detachTextureCache.toString())+"\n\t\t  "+r(t.setUniform1f.toString())+"\n\t\t  "+r(t.setUniform1i.toString())+"\n\t\t  "+r(t.setUniform2f.toString())+"\n\t\t  "+r(t.setUniform2fv.toString())+"\n\t\t  "+r(t.setUniform3fv.toString())+" \n    };\n    return kernelRunShortcut(new Kernel());\n  };"}},{"../../core/utils":32,"../kernel-run-shortcut":9}],14:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("../kernel-base"),u=t("../../core/utils"),h=t("../../core/texture"),p=t("./shader-frag"),l=t("./shader-vert"),c=t("./kernel-string"),f=[],d={};e.exports=function(t){function e(t,n){r(this,e);var s=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return s.textureCache={},s.threadDim={},s.programUniformLocationCache={},s.framebuffer=null,s.buffer=null,s.program=null,s.outputToTexture=n.outputToTexture,s.endianness=u.systemEndianness(),s.subKernelOutputTextures=null,s.subKernelOutputVariableNames=null,s.argumentsLength=0,s.compiledFragShaderString=null,s.compiledVertShaderString=null,s.drawBuffersMap=null,s.outputTexture=null,s.maxTexSize=null,s.uniform1fCache={},s.uniform1iCache={},s.uniform2fCache={},s.uniform2fvCache={},s.uniform3fvCache={},s._webGl||(s._webGl=s.initWebGl()),s}return s(e,t),a(e,null,[{key:"fragShaderString",get:function(){return p}},{key:"vertShaderString",get:function(){return l}}]),a(e,[{key:"initWebGl",value:function(){return u.initWebGl(this.getCanvas())}},{key:"validateOptions",value:function(){var t=u.isFloatReadPixelsSupported();if(this.floatTextures===!0&&!u.OES_texture_float)throw new Error("Float textures are not supported on this browser");if(this.floatOutput===!0&&this.floatOutputForce!==!0&&!t)throw new Error("Float texture outputs are not supported on this browser");if(void 0===this.floatTextures&&u.OES_texture_float&&(this.floatTextures=!0,this.floatOutput=t),!this.output||0===this.output.length){if(1!==arguments.length)throw new Error("Auto output only supported for kernels with only one input");var e=u.getArgumentType(arguments[0]);if("Array"===e)this.output=u.getDimensions(e);else{if("Texture"!==e)throw new Error("Auto output not supported for input type: "+e);this.output=arguments[0].output}}if(this.texSize=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},this.output,!0),this.graphical){if(2!==this.output.length)throw new Error("Output must have 2 dimensions on graphical mode");this.floatOutput&&(this.floatOutput=!1,console.warn("Cannot use graphical mode and float output at the same time")),this.texSize=u.clone(this.output)}else void 0===this.floatOutput&&u.OES_texture_float&&(this.floatOutput=!0)}},{key:"updateMaxTexSize",value:function(){var t=this.texSize,e=this._canvas;if(null===this.maxTexSize){var n=f.indexOf(e);n===-1&&(n=f.length,f.push(e),d[n]=[t[0],t[1]]),this.maxTexSize=d[n]}this.maxTexSize[0]<t[0]&&(this.maxTexSize[0]=t[0]),this.maxTexSize[1]<t[1]&&(this.maxTexSize[1]=t[1])}},{key:"build",value:function(){this.validateOptions(),this.setupParams(arguments),this.updateMaxTexSize();var t=this.texSize,e=this._webGl,n=this._canvas;e.enable(e.SCISSOR_TEST),e.viewport(0,0,this.maxTexSize[0],this.maxTexSize[1]),n.width=this.maxTexSize[0],n.height=this.maxTexSize[1];for(var r=this.threadDim=u.clone(this.output);r.length<3;)r.push(1);this.functionBuilder&&this._addKernels();var i=this._getVertShaderString(arguments),s=e.createShader(e.VERTEX_SHADER);e.shaderSource(s,i),e.compileShader(s);var a=this._getFragShaderString(arguments),o=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(o,a),e.compileShader(o),!e.getShaderParameter(s,e.COMPILE_STATUS))throw console.log(i),console.error("An error occurred compiling the shaders: "+e.getShaderInfoLog(s)),new Error("Error compiling vertex shader");if(!e.getShaderParameter(o,e.COMPILE_STATUS))throw console.log(a),console.error("An error occurred compiling the shaders: "+e.getShaderInfoLog(o)),new Error("Error compiling fragment shader");this.debug&&(console.log("Options:"),console.dir(this),console.log("GLSL Shader Output:"),console.log(a));var h=this.program=e.createProgram();e.attachShader(h,s),e.attachShader(h,o),e.linkProgram(h),this.framebuffer=e.createFramebuffer(),this.framebuffer.width=t[0],this.framebuffer.height=t[1];var p=new Float32Array([-1,-1,1,-1,-1,1,1,1]),l=new Float32Array([0,0,1,0,0,1,1,1]),c=p.byteLength,f=this.buffer;f?e.bindBuffer(e.ARRAY_BUFFER,f):(f=this.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,p.byteLength+l.byteLength,e.STATIC_DRAW)),e.bufferSubData(e.ARRAY_BUFFER,0,p),e.bufferSubData(e.ARRAY_BUFFER,c,l);var d=e.getAttribLocation(this.program,"aPos");e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,e.FALSE,0,0);var g=e.getAttribLocation(this.program,"aTexCoord");e.enableVertexAttribArray(g),
  e.vertexAttribPointer(g,2,e.FLOAT,e.FALSE,0,c),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),this.outputImmutable||(this._setupOutputTexture(),null!==this.subKernelOutputVariableNames&&this.subKernelOutputVariableNames.length>0&&this._setupSubOutputTextures(this.subKernelOutputVariableNames.length))}},{key:"run",value:function(){null===this.program&&this.build.apply(this,arguments);var t=this.paramNames,e=this.paramTypes,n=this.texSize,r=this._webGl;r.useProgram(this.program),r.scissor(0,0,n[0],n[1]),this.hardcodeConstants||(this.setUniform3fv("uOutputDim",this.threadDim),this.setUniform2fv("uTexSize",n)),this.setUniform2f("ratio",n[0]/this.maxTexSize[0],n[1]/this.maxTexSize[1]),this.argumentsLength=0;for(var i=0;i<t.length;i++)this._addArgument(arguments[i],e[i],t[i]);if(this.graphical)return r.bindRenderbuffer(r.RENDERBUFFER,null),r.bindFramebuffer(r.FRAMEBUFFER,null),void r.drawArrays(r.TRIANGLE_STRIP,0,4);r.bindFramebuffer(r.FRAMEBUFFER,this.framebuffer),this.outputImmutable&&this._setupOutputTexture();var s=this.outputTexture;if(null!==this.subKernelOutputVariableNames&&(this.outputImmutable&&(this.subKernelOutputTextures=[],this._setupSubOutputTextures(this.subKernelOutputVariableNames.length)),this.drawBuffers.drawBuffersWEBGL(this.drawBuffersMap)),r.drawArrays(r.TRIANGLE_STRIP,0,4),null!==this.subKernelOutputTextures){if(null!==this.subKernels){var a=[];a.result=this.renderOutput(s);for(var o=0;o<this.subKernels.length;o++)a.push(new h(this.subKernelOutputTextures[o],n,this.threadDim,this.output,this._webGl));return a}if(null!==this.subKernelProperties){var u={result:this.renderOutput(s)},p=0;for(var l in this.subKernelProperties)this.subKernelProperties.hasOwnProperty(l)&&(u[l]=new h(this.subKernelOutputTextures[p],n,this.threadDim,this.output,this._webGl),p++);return u}}return this.renderOutput(s)}},{key:"renderOutput",value:function(t){var e=this.texSize,n=this._webGl,r=this.threadDim,i=this.output;if(this.outputToTexture)return new h(t,e,this.threadDim,i,this._webGl);var s=void 0;if(this.floatOutput)s=new Float32Array(e[0]*e[1]*4),n.readPixels(0,0,e[0],e[1],n.RGBA,n.FLOAT,s);else{var a=new Uint8Array(e[0]*e[1]*4);n.readPixels(0,0,e[0],e[1],n.RGBA,n.UNSIGNED_BYTE,a),s=new Float32Array(a.buffer)}if(s=s.subarray(0,r[0]*r[1]*r[2]),1===i.length)return s;if(2===i.length)return u.splitArray(s,i[0]);if(3===i.length){var o=u.splitArray(s,i[0]*i[1]);return o.map(function(t){return u.splitArray(t,i[0])})}}},{key:"getOutputTexture",value:function(){return this.outputTexture}},{key:"_setupOutputTexture",value:function(){var t=this._webGl,e=this.texSize,n=this.outputTexture=this._webGl.createTexture();t.activeTexture(t.TEXTURE0+this.paramNames.length),t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),this.floatOutput?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e[0],e[1],0,t.RGBA,t.FLOAT,null):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e[0],e[1],0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}},{key:"_setupSubOutputTextures",value:function(t){for(var e=this._webGl,n=this.texSize,r=this.drawBuffersMap=[e.COLOR_ATTACHMENT0],i=this.subKernelOutputTextures=[],s=0;s<t;s++){var a=this._webGl.createTexture();i.push(a),r.push(e.COLOR_ATTACHMENT0+s+1),e.activeTexture(e.TEXTURE0+this.paramNames.length+s),e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),this.floatOutput?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n[0],n[1],0,e.RGBA,e.FLOAT,null):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n[0],n[1],0,e.RGBA,e.UNSIGNED_BYTE,null),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+s+1,e.TEXTURE_2D,a,0)}}},{key:"getArgumentTexture",value:function(t){return this.getTextureCache("ARGUMENT_"+t)}},{key:"getTextureCache",value:function(t){return this.textureCache.hasOwnProperty(t)?this.textureCache[t]:this.textureCache[t]=this._webGl.createTexture()}},{key:"detachTextureCache",value:function(t){delete this.textureCache[t]}},{key:"setUniform1f",value:function(t,e){if(this.uniform1fCache.hasOwnProperty(t)){var n=this.uniform1fCache[t];if(e===n)return}this.uniform1fCache[t]=e;var r=this.getUniformLocation(t);this._webGl.uniform1f(r,e)}},{key:"setUniform1i",value:function(t,e){if(this.uniform1iCache.hasOwnProperty(t)){var n=this.uniform1iCache[t];if(e===n)return}this.uniform1iCache[t]=e;var r=this.getUniformLocation(t);this._webGl.uniform1i(r,e)}},{key:"setUniform2f",value:function(t,e,n){if(this.uniform2fCache.hasOwnProperty(t)){var r=this.uniform2fCache[t];if(e===r[0]&&n===r[1])return}this.uniform2fCache[t]=[e,n];var i=this.getUniformLocation(t);this._webGl.uniform2f(i,e,n)}},{key:"setUniform2fv",value:function(t,e){if(this.uniform2fvCache.hasOwnProperty(t)){var n=this.uniform2fvCache[t];if(e[0]===n[0]&&e[1]===n[1])return}this.uniform2fvCache[t]=e;var r=this.getUniformLocation(t);this._webGl.uniform2fv(r,e)}},{key:"setUniform3fv",value:function(t,e){if(this.uniform3fvCache.hasOwnProperty(t)){var n=this.uniform3fvCache[t];if(e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2])return}this.uniform3fvCache[t]=e;var r=this.getUniformLocation(t);this._webGl.uniform3fv(r,e)}},{key:"getUniformLocation",value:function(t){return this.programUniformLocationCache.hasOwnProperty(t)?this.programUniformLocationCache[t]:this.programUniformLocationCache[t]=this._webGl.getUniformLocation(this.program,t)}},{key:"_getFragShaderArtifactMap",value:function(t){return{HEADER:this._getHeaderString(),LOOP_MAX:this._getLoopMaxString(),CONSTANTS:this._getConstantsString(),DECODE32_ENDIANNESS:this._getDecode32EndiannessString(),ENCODE32_ENDIANNESS:this._getEncode32EndiannessString(),GET_WRAPAROUND:this._getGetWraparoundString(),GET_TEXTURE_CHANNEL:this._getGetTextureChannelString(),GET_TEXTURE_INDEX:this._getGetTextureIndexString(),GET_RESULT:this._getGetResultString(),MAIN_PARAMS:this._getMainParamsString(t),MAIN_CONSTANTS:this._getMainConstantsString(),KERNEL:this._getKernelString(),MAIN_RESULT:this._getMainResultString()}}},{key:"_addArgument",value:function(t,e,n){var r=this._webGl,i=this.getArgumentTexture(n);switch(t instanceof h&&(e="Texture"),e){case"Array":var s=u.getDimensions(t,!0),a=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},s);r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST);var o=a[0]*a[1];this.floatTextures&&(o*=4);var p=new Float32Array(o);u.flattenTo(t,p);var l=void 0;this.floatTextures?r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a[0],a[1],0,r.RGBA,r.FLOAT,p):(l=new Uint8Array(p.buffer),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a[0],a[1],0,r.RGBA,r.UNSIGNED_BYTE,l)),this.hardcodeConstants||(this.setUniform3fv("user_"+n+"Dim",s),this.setUniform2fv("user_"+n+"Size",a)),this.setUniform1i("user_"+n,this.argumentsLength);break;case"Integer":case"Float":this.setUniform1f("user_"+n,t);break;case"Input":var c=t,f=c.size,d=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},f);r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST);var g=d[0]*d[1],m=void 0;if(this.floatTextures?(g*=4,m=new Float32Array(g),m.set(c.value)):m=c.value,this.floatTextures)r.texImage2D(r.TEXTURE_2D,0,r.RGBA,d[0],d[1],0,r.RGBA,r.FLOAT,m);else{var y=new Uint8Array(m.buffer);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,d[0],d[1],0,r.RGBA,r.UNSIGNED_BYTE,y)}this.hardcodeConstants||(this.setUniform3fv("user_"+n+"Dim",f),this.setUniform2fv("user_"+n+"Size",d)),this.setUniform1i("user_"+n,this.argumentsLength);break;case"HTMLImage":var x=t,v=[x.width,x.height,1],b=[x.width,x.height];r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0);var _=0,E=r.RGBA,T=r.RGBA,S=r.UNSIGNED_BYTE;r.texImage2D(r.TEXTURE_2D,_,E,T,S,x),this.setUniform3fv("user_"+n+"Dim",v),this.setUniform2fv("user_"+n+"Size",b),this.setUniform1i("user_"+n,this.argumentsLength);break;case"Texture":var k=t,w=k.dimensions,A=k.size;r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,k.texture),this.setUniform3fv("user_"+n+"Dim",w),this.setUniform2fv("user_"+n+"Size",A),this.setUniform1i("user_"+n,this.argumentsLength);break;default:throw new Error("Input type not supported (WebGL): "+t)}this.argumentsLength++}},{key:"_getHeaderString",value:function(){return null!==this.subKernels||null!==this.subKernelProperties?"#extension GL_EXT_draw_buffers : require\n":""}},{key:"_getLoopMaxString",value:function(){return this.loopMaxIterations?" "+parseInt(this.loopMaxIterations)+".0;\n":" 1000.0;\n"}},{key:"_getConstantsString",value:function(){var t=[],e=this.threadDim,n=this.texSize;return this.hardcodeConstants?t.push("highp vec3 uOutputDim = vec3("+e[0]+","+e[1]+", "+e[2]+")","highp vec2 uTexSize = vec2("+n[0]+", "+n[1]+")"):t.push("uniform highp vec3 uOutputDim","uniform highp vec2 uTexSize"),this._linesToString(t)}},{key:"_getTextureCoordinate",value:function(){var t=this.subKernelOutputVariableNames;return null===t||t.length<1?"varying highp vec2 vTexCoord;\n":"out highp vec2 vTexCoord;\n"}},{key:"_getDecode32EndiannessString",value:function(){return"LE"===this.endianness?"":"  rgba.rgba = rgba.abgr;\n"}},{key:"_getEncode32EndiannessString",value:function(){return"LE"===this.endianness?"":"  rgba.rgba = rgba.abgr;\n"}},{key:"_getGetWraparoundString",value:function(){return this.wraparound?"  xyz = mod(xyz, texDim);\n":""}},{key:"_getGetTextureChannelString",value:function(){return this.floatTextures?this._linesToString(["  int channel = int(integerMod(index, 4.0))","  index = float(int(index) / 4)"]):""}},{key:"_getGetTextureIndexString",value:function(){return this.floatTextures?"  index = float(int(index)/4);\n":""}},{key:"_getGetResultString",value:function(){return this.floatTextures?this._linesToString(["  if (channel == 0) return texel.r","  if (channel == 1) return texel.g","  if (channel == 2) return texel.b","  if (channel == 3) return texel.a"]):"  return decode32(texel);\n"}},{key:"_getMainParamsString",value:function(t){for(var e=[],n=this.paramTypes,r=this.paramNames,i=0;i<r.length;i++){var s=t[i],a=r[i],o=n[i];if(this.hardcodeConstants)if("Array"===o||"Texture"===o){var h=u.getDimensions(s,!0),p=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},h);e.push("uniform highp sampler2D user_"+a,"highp vec2 user_"+a+"Size = vec2("+p[0]+".0, "+p[1]+".0)","highp vec3 user_"+a+"Dim = vec3("+h[0]+".0, "+h[1]+".0, "+h[2]+".0)")}else"Integer"===o?e.push("highp float user_"+a+" = "+s+".0"):"Float"===o&&e.push("highp float user_"+a+" = "+s);else if("Array"===o||"Texture"===o||"Input"===o||"HTMLImage"===o)e.push("uniform highp sampler2D user_"+a,"uniform highp vec2 user_"+a+"Size","uniform highp vec3 user_"+a+"Dim");else{if("Integer"!==o&&"Float"!==o)throw new Error("Param type "+o+" not supported in WebGL, only WebGL2");e.push("uniform highp float user_"+a)}}return this._linesToString(e)}},{key:"_getMainConstantsString",value:function(){var t=[];if(this.constants)for(var e in this.constants)if(this.constants.hasOwnProperty(e)){var n=this.constants[e],r=u.getArgumentType(n);switch(r){case"Integer":t.push("const float constants_"+e+" = "+parseInt(n)+".0");break;case"Float":t.push("const float constants_"+e+" = "+parseFloat(n));break;default:throw new Error("Unsupported constant "+e+" type "+r)}}return this._linesToString(t)}},{key:"_getKernelString",value:function(){var t=[],e=this.subKernelOutputVariableNames;if(null!==e){t.push("highp float kernelResult = 0.0");for(var n=0;n<e.length;n++)t.push("highp float "+e[n]+" = 0.0")}else t.push("highp float kernelResult = 0.0");return this._linesToString(t)+this.functionBuilder.getPrototypeString("kernel")}},{key:"_getMainResultString",value:function(){var t=this.subKernelOutputVariableNames,e=[];if(this.floatOutput&&e.push("  index *= 4.0"),this.graphical)e.push("  threadId = indexTo3D(index, uOutputDim)","  kernel()","  gl_FragColor = actualColor");else if(this.floatOutput)for(var n=["r","g","b","a"],r=0;r<n.length;++r){if(e.push("  threadId = indexTo3D(index, uOutputDim)"),e.push("  kernel()"),t){e.push("  gl_FragData[0]."+n[r]+" = kernelResult");for(var i=0;i<t.length;++i)e.push("  gl_FragData["+(i+1)+"]."+n[r]+" = "+t[i])}else e.push("  gl_FragColor."+n[r]+" = kernelResult");r<n.length-1&&e.push("  index += 1.0")}else if(null!==t){e.push("  threadId = indexTo3D(index, uOutputDim)"),e.push("  kernel()"),e.push("  gl_FragData[0] = encode32(kernelResult)");for(var s=0;s<t.length;s++)e.push("  gl_FragData["+(s+1)+"] = encode32("+t[s]+")")}else e.push("  threadId = indexTo3D(index, uOutputDim)","  kernel()","  gl_FragColor = encode32(kernelResult)");return this._linesToString(e)}},{key:"_linesToString",value:function(t){return t.length>0?t.join(";\n")+";\n":"\n"}},{key:"_replaceArtifacts",value:function(t,e){return t.replace(/[ ]*__([A-Z]+[0-9]*([_]?[A-Z])*)__;\n/g,function(t,n){if(e.hasOwnProperty(n))return e[n];throw"unhandled artifact "+n})}},{key:"_addKernels",value:function(){var t=this,e=this.functionBuilder,n=this._webGl;if(e.addFunctions(this.functions,{constants:this.constants,output:this.output}),e.addNativeFunctions(this.nativeFunctions),e.addKernel(this.fnString,{prototypeOnly:!1,constants:this.constants,output:this.output,debug:this.debug,loopMaxIterations:this.loopMaxIterations,paramNames:this.paramNames,paramTypes:this.paramTypes}),null!==this.subKernels){var r=this.drawBuffers=n.getExtension("WEBGL_draw_buffers");if(!r)throw new Error("could not instantiate draw buffers extension");this.subKernelOutputVariableNames=[],this.subKernels.forEach(function(e){return t._addSubKernel(e)})}else if(null!==this.subKernelProperties){var i=this.drawBuffers=n.getExtension("WEBGL_draw_buffers");if(!i)throw new Error("could not instantiate draw buffers extension");this.subKernelOutputVariableNames=[],Object.keys(this.subKernelProperties).forEach(function(e){return t._addSubKernel(t.subKernelProperties[e])})}}},{key:"_addSubKernel",value:function(t){this.functionBuilder.addSubKernel(t,{prototypeOnly:!1,constants:this.constants,output:this.output,debug:this.debug,loopMaxIterations:this.loopMaxIterations}),this.subKernelOutputVariableNames.push(t.name+"Result")}},{key:"_getFragShaderString",value:function(t){return null!==this.compiledFragShaderString?this.compiledFragShaderString:this.compiledFragShaderString=this._replaceArtifacts(this.constructor.fragShaderString,this._getFragShaderArtifactMap(t))}},{key:"_getVertShaderString",value:function(t){return null!==this.compiledVertShaderString?this.compiledVertShaderString:this.compiledVertShaderString=this.constructor.vertShaderString}},{key:"toString",value:function(){return c(this)}},{key:"addFunction",value:function(t){this.functionBuilder.addFunction(null,t)}}]),e}(o)},{"../../core/texture":30,"../../core/utils":32,"../kernel-base":8,"./kernel-string":13,"./shader-frag":16,"./shader-vert":17}],15:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("../runner-base"),u=t("./kernel"),h=t("./function-builder");e.exports=function(t){function e(t){r(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,new h,t));return n.Kernel=u,n.kernel=null,n}return s(e,t),a(e,[{key:"getMode",value:function(){return"gpu"}}]),e}(o)},{"../runner-base":10,"./function-builder":11,"./kernel":14}],16:[function(t,e,n){e.exports="__HEADER__;\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nconst float LOOP_MAX = __LOOP_MAX__;\n#define EPSILON 0.0000001;\n\n__CONSTANTS__;\n\nvarying highp vec2 vTexCoord;\n\nvec4 round(vec4 x) {\n  return floor(x + 0.5);\n}\n\nhighp float round(highp float x) {\n  return floor(x + 0.5);\n}\n\nvec2 integerMod(vec2 x, float y) {\n  vec2 res = floor(mod(x, y));\n  return res * step(1.0 - floor(y), -res);\n}\n\nvec3 integerMod(vec3 x, float y) {\n  vec3 res = floor(mod(x, y));\n  return res * step(1.0 - floor(y), -res);\n}\n\nvec4 integerMod(vec4 x, vec4 y) {\n  vec4 res = floor(mod(x, y));\n  return res * step(1.0 - floor(y), -res);\n}\n\nhighp float integerMod(highp float x, highp float y) {\n  highp float res = floor(mod(x, y));\n  return res * (res > floor(y) - 1.0 ? 0.0 : 1.0);\n}\n\nhighp int integerMod(highp int x, highp int y) {\n  return int(integerMod(float(x), float(y)));\n}\n\n// Here be dragons!\n// DO NOT OPTIMIZE THIS CODE\n// YOU WILL BREAK SOMETHING ON SOMEBODY'S MACHINE\n// LEAVE IT AS IT IS, LEST YOU WASTE YOUR OWN TIME\nconst vec2 MAGIC_VEC = vec2(1.0, -256.0);\nconst vec4 SCALE_FACTOR = vec4(1.0, 256.0, 65536.0, 0.0);\nconst vec4 SCALE_FACTOR_INV = vec4(1.0, 0.00390625, 0.0000152587890625, 0.0); // 1, 1/256, 1/65536\nhighp float decode32(highp vec4 rgba) {\n  __DECODE32_ENDIANNESS__;\n  rgba *= 255.0;\n  vec2 gte128;\n  gte128.x = rgba.b >= 128.0 ? 1.0 : 0.0;\n  gte128.y = rgba.a >= 128.0 ? 1.0 : 0.0;\n  float exponent = 2.0 * rgba.a - 127.0 + dot(gte128, MAGIC_VEC);\n  float res = exp2(round(exponent));\n  rgba.b = rgba.b - 128.0 * gte128.x;\n  res = dot(rgba, SCALE_FACTOR) * exp2(round(exponent-23.0)) + res;\n  res *= gte128.y * -2.0 + 1.0;\n  return res;\n}\n\nhighp vec4 encode32(highp float f) {\n  highp float F = abs(f);\n  highp float sign = f < 0.0 ? 1.0 : 0.0;\n  highp float exponent = floor(log2(F));\n  highp float mantissa = (exp2(-exponent) * F);\n  // exponent += floor(log2(mantissa));\n  vec4 rgba = vec4(F * exp2(23.0-exponent)) * SCALE_FACTOR_INV;\n  rgba.rg = integerMod(rgba.rg, 256.0);\n  rgba.b = integerMod(rgba.b, 128.0);\n  rgba.a = exponent*0.5 + 63.5;\n  rgba.ba += vec2(integerMod(exponent+127.0, 2.0), sign) * 128.0;\n  rgba = floor(rgba);\n  rgba *= 0.003921569; // 1/255\n  __ENCODE32_ENDIANNESS__;\n  return rgba;\n}\n// Dragons end here\n\nhighp float index;\nhighp vec3 threadId;\n\nhighp vec3 indexTo3D(highp float idx, highp vec3 texDim) {\n  highp float z = floor(idx / (texDim.x * texDim.y));\n  idx -= z * texDim.x * texDim.y;\n  highp float y = floor(idx / texDim.x);\n  highp float x = integerMod(idx, texDim.x);\n  return vec3(x, y, z);\n}\n\nhighp float get(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float z, highp float y, highp float x) {\n  highp vec3 xyz = vec3(x, y, z);\n  xyz = floor(xyz + 0.5);\n  __GET_WRAPAROUND__;\n  highp float index = round(xyz.x + texDim.x * (xyz.y + texDim.y * xyz.z));\n  __GET_TEXTURE_CHANNEL__;\n  highp float w = round(texSize.x);\n  vec2 st = vec2(integerMod(index, w), float(int(index) / int(w))) + 0.5;\n  __GET_TEXTURE_INDEX__;\n  highp vec4 texel = texture2D(tex, st / texSize);\n  __GET_RESULT__;\n}\n\nhighp vec4 getImage2D(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float z, highp float y, highp float x) {\n  highp vec3 xyz = vec3(x, y, z);\n  xyz = floor(xyz + 0.5);\n  __GET_WRAPAROUND__;\n  highp float index = round(xyz.x + texDim.x * (xyz.y + texDim.y * xyz.z));\n  __GET_TEXTURE_CHANNEL__;\n  highp float w = round(texSize.x);\n  vec2 st = vec2(integerMod(index, w), float(int(index) / int(w))) + 0.5;\n  __GET_TEXTURE_INDEX__;\n  return texture2D(tex, st / texSize);\n}\n\nhighp float get(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float y, highp float x) {\n  return get(tex, texSize, texDim, 0.0, y, x);\n}\n\nhighp vec4 getImage2D(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float y, highp float x) {\n  return getImage2D(tex, texSize, texDim, 0.0, y, x);\n}\n\nhighp float get(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float x) {\n  return get(tex, texSize, texDim, 0.0, 0.0, x);\n}\n\nhighp vec4 getImage2D(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float x) {\n  return getImage2D(tex, texSize, texDim, 0.0, 0.0, x);\n}\n\nhighp vec4 actualColor;\nvoid color(float r, float g, float b, float a) {\n  actualColor = vec4(r,g,b,a);\n}\n\nvoid color(float r, float g, float b) {\n  color(r,g,b,1.0);\n}\n\nvoid color(sampler2D image) {\n  actualColor = texture2D(image, vTexCoord);\n}\n\n__MAIN_PARAMS__;\n__MAIN_CONSTANTS__;\n__KERNEL__;\n\nvoid main(void) {\n  index = floor(vTexCoord.s * float(uTexSize.x)) + floor(vTexCoord.t * float(uTexSize.y)) * uTexSize.x;\n  __MAIN_RESULT__;\n}"},{}],17:[function(t,e,n){e.exports="precision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nattribute highp vec2 aPos;\nattribute highp vec2 aTexCoord;\n\nvarying highp vec2 vTexCoord;\nuniform vec2 ratio;\n\nvoid main(void) {\n  gl_Position = vec4((aPos + vec2(1)) * ratio + vec2(-1), 0, 1);\n  vTexCoord = aTexCoord;\n}"},{}],18:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("./kernel"),u=t("../../core/utils");e.exports=function(t){function e(){return r(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),a(e,[{key:"validateOptions",value:function(){this.texSize=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},this.output,!0)}}]),e}(o)},{"../../core/utils":32,"./kernel":14}],19:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=t("../function-builder-base"),o=t("./function-node");e.exports=function(t){function e(){r(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.Node=o,t}return s(e,t),e}(a)},{"../function-builder-base":6,"./function-node":20}],20:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return t.replace(h,"((").replace(p,"((")}var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=t("../web-gl/function-node"),h=/decode32\(\s+encode32\(/g,p=/encode32\(\s+decode32\(/g;e.exports=function(t){function e(){return r(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),o(e,[{key:"generate",value:function(){return this.debug&&console.log(this),this.prototypeOnly?e.astFunctionPrototype(this.getJsAST(),[],this).join("").trim():(this.functionStringArray=this.astGeneric(this.getJsAST(),[],this),this.functionString=a(this.functionStringArray.join("").trim()),this.functionString)}},{key:"astFunctionExpression",value:function(t,e){if(this.isRootKernel?(e.push("void"),this.kernalAst=t):e.push(this.returnType),e.push(" "),e.push(this.functionName),e.push("("),!this.isRootKernel)for(var n=0;n<this.paramNames.length;++n){var r=this.paramNames[n];n>0&&e.push(", ");var i=this.getParamType(r);switch(i){case"Texture":case"Input":case"Array":case"HTMLImage":e.push("sampler2D");break;default:e.push("float")}e.push(" "),e.push("user_"),e.push(r)}e.push(") {\n");for(var s=0;s<t.body.body.length;++s)this.astGeneric(t.body.body[s],e),e.push("\n");return e.push("}\n"),e}},{key:"astIdentifierExpression",value:function(t,e){if("Identifier"!==t.type)throw this.astErrorOutput("IdentifierExpression - not an Identifier",t);switch(t.name){case"gpu_threadX":e.push("threadId.x");break;case"gpu_threadY":e.push("threadId.y");break;case"gpu_threadZ":e.push("threadId.z");break;case"gpu_outputX":e.push("uOutputDim.x");break;case"gpu_outputY":e.push("uOutputDim.y");break;case"gpu_outputZ":e.push("uOutputDim.z");break;case"Infinity":e.push("intBitsToFloat(2139095039)");break;default:if(this.constants&&this.constants.hasOwnProperty(t.name))e.push("constants_"+t.name);else{var n=this.getUserParamName(t.name);null!==n?e.push("user_"+n):e.push("user_"+t.name)}}return e}}]),e}(u)},{"../web-gl/function-node":12}],21:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("../web-gl/kernel"),u=t("../../core/utils"),h=t("../../core/texture"),p=t("./shader-frag"),l=t("./shader-vert");e.exports=function(t){function e(){return r(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),a(e,[{key:"initWebGl",value:function(){return u.initWebGl2(this.getCanvas())}},{key:"validateOptions",value:function(){var t=u.isFloatReadPixelsSupportedWebGL2();if(this.floatOutput===!0&&this.floatOutputForce!==!0&&!t)throw new Error("Float texture outputs are not supported on this browser");if(void 0===this.floatTextures&&(this.floatTextures=!0,this.floatOutput=t),!this.output||0===this.output.length){if(1!==arguments.length)throw new Error("Auto output only supported for kernels with only one input");var e=u.getArgumentType(arguments[0]);if("Array"===e)this.output=u.getDimensions(e);else{if("Texture"!==e)throw new Error("Auto output not supported for input type: "+e);this.output=arguments[0].output}}if(this.texSize=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},this.output,!0),this.graphical){if(2!==this.output.length)throw new Error("Output must have 2 dimensions on graphical mode");this.floatOutput&&(this.floatOutput=!1,console.warn("Cannot use graphical mode and float output at the same time")),this.texSize=u.clone(this.output)}else void 0===this.floatOutput&&(this.floatOutput=!0);(this.floatOutput||this.floatOutputForce)&&this._webGl.getExtension("EXT_color_buffer_float")}},{key:"run",value:function(){null===this.program&&this.build.apply(this,arguments);var t=this.paramNames,e=this.paramTypes,n=this.texSize,r=this._webGl;r.useProgram(this.program),r.scissor(0,0,n[0],n[1]),this.hardcodeConstants||(this.setUniform3fv("uOutputDim",this.threadDim),this.setUniform2fv("uTexSize",n)),this.setUniform2f("ratio",n[0]/this.maxTexSize[0],n[1]/this.maxTexSize[1]),this.argumentsLength=0;for(var i=0;i<t.length;i++)this._addArgument(arguments[i],e[i],t[i]);if(this.graphical)return r.bindRenderbuffer(r.RENDERBUFFER,null),r.bindFramebuffer(r.FRAMEBUFFER,null),void r.drawArrays(r.TRIANGLE_STRIP,0,4);r.bindFramebuffer(r.FRAMEBUFFER,this.framebuffer),this.outputImmutable&&this._setupOutputTexture();var s=this.outputTexture;if(null!==this.subKernelOutputVariableNames&&(this.outputImmutable&&(this.subKernelOutputTextures=[],this._setupSubOutputTextures(this.subKernelOutputVariableNames.length)),r.drawBuffers(this.drawBuffersMap)),r.drawArrays(r.TRIANGLE_STRIP,0,4),null!==this.subKernelOutputTextures){if(null!==this.subKernels){var a=[];a.result=this.renderOutput(s);for(var o=0;o<this.subKernels.length;o++)a.push(new h(this.subKernelOutputTextures[o],n,this.threadDim,this.output,this._webGl));return a}if(null!==this.subKernelProperties){var u={result:this.renderOutput(s)},p=0;for(var l in this.subKernelProperties)this.subKernelProperties.hasOwnProperty(l)&&(u[l]=new h(this.subKernelOutputTextures[p],n,this.threadDim,this.output,this._webGl),p++);return u}}return this.renderOutput(s)}},{key:"getOutputTexture",value:function(){return this.outputTexture}},{key:"_setupOutputTexture",value:function(){var t=this._webGl,e=this.texSize,n=this.outputTexture=this._webGl.createTexture();t.activeTexture(t.TEXTURE0+this.paramNames.length),t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),this.floatOutput?t.texImage2D(t.TEXTURE_2D,0,t.RGBA32F,e[0],e[1],0,t.RGBA,t.FLOAT,null):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e[0],e[1],0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}},{key:"_setupSubOutputTextures",value:function(t){for(var e=this._webGl,n=this.texSize,r=this.drawBuffersMap=[e.COLOR_ATTACHMENT0],i=this.subKernelOutputTextures=[],s=0;s<t;s++){var a=this._webGl.createTexture();i.push(a),
  r.push(e.COLOR_ATTACHMENT0+s+1),e.activeTexture(e.TEXTURE0+this.paramNames.length+s),e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),this.floatOutput?e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,n[0],n[1],0,e.RGBA,e.FLOAT,null):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n[0],n[1],0,e.RGBA,e.UNSIGNED_BYTE,null),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+s+1,e.TEXTURE_2D,a,0)}}},{key:"_addArgument",value:function(t,e,n){var r=this._webGl,i=this.getArgumentTexture(n);switch(t instanceof h&&(e="Texture"),e){case"Array":var s=u.getDimensions(t,!0),a=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},s);r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST);var o=a[0]*a[1];this.floatTextures&&(o*=4);var p=new Float32Array(o);u.flattenTo(t,p);var l=void 0;this.floatTextures?r.texImage2D(r.TEXTURE_2D,0,r.RGBA32F,a[0],a[1],0,r.RGBA,r.FLOAT,p):(l=new Uint8Array(p.buffer),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a[0],a[1],0,r.RGBA,r.UNSIGNED_BYTE,l)),this.hardcodeConstants||(this.setUniform3fv("user_"+n+"Dim",s),this.setUniform2fv("user_"+n+"Size",a)),this.setUniform1i("user_"+n,this.argumentsLength);break;case"Integer":case"Float":this.setUniform1f("user_"+n,t);break;case"Input":var c=t,f=c.size,d=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},f);r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST);var g=d[0]*d[1],m=void 0;if(this.floatTextures?(g*=4,m=new Float32Array(g),m.set(c.value)):m=c.value,this.floatTextures)r.texImage2D(r.TEXTURE_2D,0,r.RGBA32F,d[0],d[1],0,r.RGBA,r.FLOAT,m);else{var y=new Uint8Array(m.buffer);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,d[0],d[1],0,r.RGBA,r.UNSIGNED_BYTE,y)}this.hardcodeConstants||(this.setUniform3fv("user_"+n+"Dim",f),this.setUniform2fv("user_"+n+"Size",d)),this.setUniform1i("user_"+n,this.argumentsLength);break;case"HTMLImage":var x=t,v=[x.width,x.height,1],b=[x.width,x.height];r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0);var _=0,E=r.RGBA,T=r.RGBA,S=r.UNSIGNED_BYTE;r.texImage2D(r.TEXTURE_2D,_,E,T,S,x),this.setUniform3fv("user_"+n+"Dim",v),this.setUniform2fv("user_"+n+"Size",b),this.setUniform1i("user_"+n,this.argumentsLength);break;case"HTMLImageArray":var k=t,w=[k[0].width,k[0].height,k.length],A=[k[0].width,k[0].height];r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D_ARRAY,i),r.texParameteri(r.TEXTURE_2D_ARRAY,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D_ARRAY,r.TEXTURE_MIN_FILTER,r.NEAREST),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0);var O=0,C=r.RGBA,R=k[0].width,P=k[0].height,N=k.length,I=0,D=r.RGBA,L=r.UNSIGNED_BYTE;r.texImage3D(r.TEXTURE_2D_ARRAY,O,C,R,P,N,I,D,L,null);for(var F=0;F<k.length;F++){var G=0,U=0,M=1;r.texSubImage3D(r.TEXTURE_2D_ARRAY,O,G,U,F,k[F].width,k[F].height,M,D,L,k[F])}this.setUniform3fv("user_"+n+"Dim",w),this.setUniform2fv("user_"+n+"Size",A),this.setUniform1i("user_"+n,this.argumentsLength);break;case"Texture":var V=t,j=V.dimensions,B=V.size;r.activeTexture(r.TEXTURE0+this.argumentsLength),r.bindTexture(r.TEXTURE_2D,V.texture),this.setUniform3fv("user_"+n+"Dim",j),this.setUniform2fv("user_"+n+"Size",B),this.setUniform1i("user_"+n,this.argumentsLength);break;default:throw new Error("Input type not supported (WebGL): "+t)}this.argumentsLength++}},{key:"_getHeaderString",value:function(){return""}},{key:"_getTextureCoordinate",value:function(){var t=this.subKernelOutputVariableNames;return null===t||t.length<1?"in highp vec2 vTexCoord;\n":"out highp vec2 vTexCoord;\n"}},{key:"_getMainParamsString",value:function(t){for(var e=[],n=this.paramTypes,r=this.paramNames,i=0;i<r.length;i++){var s=t[i],a=r[i],o=n[i];if(this.hardcodeConstants)if("Array"===o||"Texture"===o){var h=u.getDimensions(s,!0),p=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},h);e.push("uniform highp sampler2D user_"+a,"highp vec2 user_"+a+"Size = vec2("+p[0]+".0, "+p[1]+".0)","highp vec3 user_"+a+"Dim = vec3("+h[0]+".0, "+h[1]+".0, "+h[2]+".0)")}else"Integer"===o?e.push("highp float user_"+a+" = "+s+".0"):"Float"===o&&e.push("highp float user_"+a+" = "+s);else"Array"===o||"Texture"===o||"Input"===o||"HTMLImage"===o?e.push("uniform highp sampler2D user_"+a,"uniform highp vec2 user_"+a+"Size","uniform highp vec3 user_"+a+"Dim"):"HTMLImageArray"===o?e.push("uniform highp sampler2DArray user_"+a,"uniform highp vec2 user_"+a+"Size","uniform highp vec3 user_"+a+"Dim"):"Integer"!==o&&"Float"!==o||e.push("uniform highp float user_"+a)}return this._linesToString(e)}},{key:"_getKernelString",value:function(){var t=[],e=this.subKernelOutputVariableNames;if(null!==e){t.push("highp float kernelResult = 0.0"),t.push("layout(location = 0) out highp vec4 data0");for(var n=0;n<e.length;n++)t.push("highp float "+e[n]+" = 0.0","layout(location = "+(n+1)+") out highp vec4 data"+(n+1))}else t.push("out highp vec4 data0"),t.push("highp float kernelResult = 0.0");return this._linesToString(t)+this.functionBuilder.getPrototypeString("kernel")}},{key:"_getMainResultString",value:function(){var t=this.subKernelOutputVariableNames,e=[];if(this.floatOutput&&e.push("  index *= 4.0"),this.graphical)e.push("  threadId = indexTo3D(index, uOutputDim)","  kernel()","  data0 = actualColor");else if(this.floatOutput)for(var n=["r","g","b","a"],r=0;r<n.length;++r){if(e.push("  threadId = indexTo3D(index, uOutputDim)"),e.push("  kernel()"),t){e.push("  data0."+n[r]+" = kernelResult");for(var i=0;i<t.length;++i)e.push("  data"+(i+1)+"."+n[r]+" = "+t[i])}else e.push("  data0."+n[r]+" = kernelResult");r<n.length-1&&e.push("  index += 1.0")}else if(null!==t){e.push("  threadId = indexTo3D(index, uOutputDim)"),e.push("  kernel()"),e.push("  data0 = encode32(kernelResult)");for(var s=0;s<t.length;s++)e.push("  data"+(s+1)+" = encode32("+t[s]+")")}else e.push("  threadId = indexTo3D(index, uOutputDim)","  kernel()","  data0 = encode32(kernelResult)");return this._linesToString(e)}},{key:"_addKernels",value:function(){var t=this,e=this.functionBuilder;this._webGl;e.addFunctions(this.functions,{constants:this.constants,output:this.output}),e.addNativeFunctions(this.nativeFunctions),e.addKernel(this.fnString,{prototypeOnly:!1,constants:this.constants,output:this.output,debug:this.debug,loopMaxIterations:this.loopMaxIterations,paramNames:this.paramNames,paramTypes:this.paramTypes}),null!==this.subKernels?(this.subKernelOutputTextures=[],this.subKernelOutputVariableNames=[],this.subKernels.forEach(function(e){return t._addSubKernel(e)})):null!==this.subKernelProperties&&(this.subKernelOutputTextures=[],this.subKernelOutputVariableNames=[],Object.keys(this.subKernelProperties).forEach(function(e){return t._addSubKernel(t.subKernelProperties[e])}))}},{key:"_getFragShaderString",value:function(t){return null!==this.compiledFragShaderString?this.compiledFragShaderString:this.compiledFragShaderString=this._replaceArtifacts(this.constructor.fragShaderString,this._getFragShaderArtifactMap(t))}},{key:"_getVertShaderString",value:function(t){return null!==this.compiledVertShaderString?this.compiledVertShaderString:this.compiledVertShaderString=this.constructor.vertShaderString}}],[{key:"fragShaderString",get:function(){return p}},{key:"vertShaderString",get:function(){return l}}]),e}(o)},{"../../core/texture":30,"../../core/utils":32,"../web-gl/kernel":14,"./shader-frag":23,"./shader-vert":24}],22:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("../runner-base"),u=t("./function-builder"),h=t("./kernel");e.exports=function(t){function e(t){r(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,new u,t));return n.Kernel=h,n.kernel=null,n}return s(e,t),a(e,[{key:"getMode",value:function(){return"gpu"}}]),e}(o)},{"../runner-base":10,"./function-builder":19,"./kernel":21}],23:[function(t,e,n){e.exports="#version 300 es\n__HEADER__;\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nconst float LOOP_MAX = __LOOP_MAX__;\n#define EPSILON 0.0000001;\n\n__CONSTANTS__;\n\nin highp vec2 vTexCoord;\n\nvec2 integerMod(vec2 x, float y) {\n  vec2 res = floor(mod(x, y));\n  return res * step(1.0 - floor(y), -res);\n}\n\nvec3 integerMod(vec3 x, float y) {\n  vec3 res = floor(mod(x, y));\n  return res * step(1.0 - floor(y), -res);\n}\n\nvec4 integerMod(vec4 x, vec4 y) {\n  vec4 res = floor(mod(x, y));\n  return res * step(1.0 - floor(y), -res);\n}\n\nhighp float integerMod(highp float x, highp float y) {\n  highp float res = floor(mod(x, y));\n  return res * (res > floor(y) - 1.0 ? 0.0 : 1.0);\n}\n\nhighp int integerMod(highp int x, highp int y) {\n  return int(integerMod(float(x), float(y)));\n}\n\n// Here be dragons!\n// DO NOT OPTIMIZE THIS CODE\n// YOU WILL BREAK SOMETHING ON SOMEBODY'S MACHINE\n// LEAVE IT AS IT IS, LEST YOU WASTE YOUR OWN TIME\nconst vec2 MAGIC_VEC = vec2(1.0, -256.0);\nconst vec4 SCALE_FACTOR = vec4(1.0, 256.0, 65536.0, 0.0);\nconst vec4 SCALE_FACTOR_INV = vec4(1.0, 0.00390625, 0.0000152587890625, 0.0); // 1, 1/256, 1/65536\nhighp float decode32(highp vec4 rgba) {\n  __DECODE32_ENDIANNESS__;\n  rgba *= 255.0;\n  vec2 gte128;\n  gte128.x = rgba.b >= 128.0 ? 1.0 : 0.0;\n  gte128.y = rgba.a >= 128.0 ? 1.0 : 0.0;\n  float exponent = 2.0 * rgba.a - 127.0 + dot(gte128, MAGIC_VEC);\n  float res = exp2(round(exponent));\n  rgba.b = rgba.b - 128.0 * gte128.x;\n  res = dot(rgba, SCALE_FACTOR) * exp2(round(exponent-23.0)) + res;\n  res *= gte128.y * -2.0 + 1.0;\n  return res;\n}\n\nhighp vec4 encode32(highp float f) {\n  highp float F = abs(f);\n  highp float sign = f < 0.0 ? 1.0 : 0.0;\n  highp float exponent = floor(log2(F));\n  highp float mantissa = (exp2(-exponent) * F);\n  // exponent += floor(log2(mantissa));\n  vec4 rgba = vec4(F * exp2(23.0-exponent)) * SCALE_FACTOR_INV;\n  rgba.rg = integerMod(rgba.rg, 256.0);\n  rgba.b = integerMod(rgba.b, 128.0);\n  rgba.a = exponent*0.5 + 63.5;\n  rgba.ba += vec2(integerMod(exponent+127.0, 2.0), sign) * 128.0;\n  rgba = floor(rgba);\n  rgba *= 0.003921569; // 1/255\n  __ENCODE32_ENDIANNESS__;\n  return rgba;\n}\n// Dragons end here\n\nhighp float index;\nhighp vec3 threadId;\n\nhighp vec3 indexTo3D(highp float idx, highp vec3 texDim) {\n  highp float z = floor(idx / (texDim.x * texDim.y));\n  idx -= z * texDim.x * texDim.y;\n  highp float y = floor(idx / texDim.x);\n  highp float x = integerMod(idx, texDim.x);\n  return vec3(x, y, z);\n}\n\nhighp float get(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float z, highp float y, highp float x) {\n  highp vec3 xyz = vec3(x, y, z);\n  xyz = floor(xyz + 0.5);\n  __GET_WRAPAROUND__;\n  highp float index = round(xyz.x + texDim.x * (xyz.y + texDim.y * xyz.z));\n  __GET_TEXTURE_CHANNEL__;\n  highp float w = round(texSize.x);\n  vec2 st = vec2(integerMod(index, w), float(int(index) / int(w))) + 0.5;\n  __GET_TEXTURE_INDEX__;\n  highp vec4 texel = texture(tex, st / texSize);\n  __GET_RESULT__;\n}\n\nhighp vec4 getImage2D(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float z, highp float y, highp float x) {\n  highp vec3 xyz = vec3(x, y, z);\n  xyz = floor(xyz + 0.5);\n  __GET_WRAPAROUND__;\n  highp float index = round(xyz.x + texDim.x * (xyz.y + texDim.y * xyz.z));\n  __GET_TEXTURE_CHANNEL__;\n  highp float w = round(texSize.x);\n  vec2 st = vec2(integerMod(index, w), float(int(index) / int(w))) + 0.5;\n  __GET_TEXTURE_INDEX__;\n  return texture(tex, st / texSize);\n}\n\nhighp vec4 getImage3D(highp sampler2DArray tex, highp vec2 texSize, highp vec3 texDim, highp float z, highp float y, highp float x) {\n  highp vec3 xyz = vec3(x, y, z);\n  xyz = floor(xyz + 0.5);\n  __GET_WRAPAROUND__;\n  highp float index = round(xyz.x + texDim.x * (xyz.y + texDim.y * xyz.z));\n  __GET_TEXTURE_CHANNEL__;\n  highp float w = round(texSize.x);\n  vec2 st = vec2(integerMod(index, w), float(int(index) / int(w))) + 0.5;\n  __GET_TEXTURE_INDEX__;\n  return texture(tex, vec3(st / texSize, z));\n}\n\nhighp float get(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float y, highp float x) {\n  return get(tex, texSize, texDim, 0.0, y, x);\n}\n\nhighp vec4 getImage2D(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float y, highp float x) {\n  return getImage2D(tex, texSize, texDim, 0.0, y, x);\n}\n\nhighp float get(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float x) {\n  return get(tex, texSize, texDim, 0.0, 0.0, x);\n}\n\nhighp vec4 getImage2D(highp sampler2D tex, highp vec2 texSize, highp vec3 texDim, highp float x) {\n  return getImage2D(tex, texSize, texDim, 0.0, 0.0, x);\n}\n\nhighp vec4 actualColor;\nvoid color(float r, float g, float b, float a) {\n  actualColor = vec4(r,g,b,a);\n}\n\nvoid color(float r, float g, float b) {\n  color(r,g,b,1.0);\n}\n\n__MAIN_PARAMS__;\n__MAIN_CONSTANTS__;\n__KERNEL__;\n\nvoid main(void) {\n  index = floor(vTexCoord.s * float(uTexSize.x)) + floor(vTexCoord.t * float(uTexSize.y)) * uTexSize.x;\n  __MAIN_RESULT__;\n}"},{}],24:[function(t,e,n){e.exports="#version 300 es\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nin highp vec2 aPos;\nin highp vec2 aTexCoord;\n\nout highp vec2 vTexCoord;\nuniform vec2 ratio;\n\nvoid main(void) {\n  gl_Position = vec4((aPos + vec2(1)) * ratio + vec2(-1), 0, 1);\n  vTexCoord = aTexCoord;\n}"},{}],25:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("./kernel"),u=t("../../core/utils");e.exports=function(t){function e(){return r(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),a(e,[{key:"validateOptions",value:function(){this._webGl.getExtension("EXT_color_buffer_float"),this.texSize=u.dimToTexSize({floatTextures:this.floatTextures,floatOutput:this.floatOutput},this.output,!0)}}]),e}(o)},{"../../core/utils":32,"./kernel":21}],26:[function(t,e,n){var r=t("./utils");e.exports=function(t,e){var n=e.toString();return new Function("return function "+t+" ("+r.getParamNamesFromString(n).join(", ")+") {"+r.getFunctionBodyFromString(n)+"}")()}},{"./utils":32}],27:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();t("./utils-core");e.exports=function(){function t(){r(this,t)}return i(t,null,[{key:"validateKernelObj",value:function(t){if(null===t)throw"KernelObj being validated is NULL";if("string"==typeof t){try{t=JSON.parse(t)}catch(e){throw console.error(e),"Failed to convert KernelObj from JSON string"}if(null===t)throw"Invalid (NULL) KernelObj JSON string representation"}if(t.isKernelObj!==!0)throw"Failed missing isKernelObj flag check";return t}},{key:"loadKernelObj",value:function(t,e){t=validateKernelObj(t)}}]),t}()},{"./utils-core":31}],28:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t("./utils"),u=t("../backend/web-gl/runner"),h=t("../backend/web-gl2/runner"),p=t("../backend/cpu/runner"),l=t("../backend/web-gl/validator-kernel"),c=t("../backend/web-gl2/validator-kernel"),f=t("./gpu-core"),d=function(t){function e(t){r(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));t=t||{},n._canvas=t.canvas||null,n._webGl=t.webGl||null;var s=t.mode,a=void 0;if(o.isWebGlSupported())a=s||"gpu";else{if(s&&"cpu"!==s)throw new Error('A requested mode of "'+s+'" and is not supported');console.warn("Warning: gpu not supported, falling back to cpu support"),a="cpu"}n.kernels=[];var f={canvas:n._canvas,webGl:n._webGl};switch(a){case"cpu":n._runner=new p(f);break;case"gpu":var d=n.getGPURunner();n._runner=new d(f);break;case"webgl2":n._runner=new h(f);break;case"webgl":n._runner=new u(f);break;case"webgl2-validator":n._runner=new h(f),n._runner.Kernel=c;break;case"webgl-validator":n._runner=new u(f),n._runner.Kernel=l;break;default:throw new Error('"'+s+'" mode is not defined')}return n}return s(e,t),a(e,[{key:"createKernel",value:function(t,e){if("undefined"==typeof t)throw"Missing fn parameter";if(!o.isFunction(t)&&"string"!=typeof t)throw"fn parameter not a function";var n=this._runner.buildKernel(t,e||{});return this._canvas||(this._canvas=n.getCanvas()),this._runner.canvas||(this._runner.canvas=n.getCanvas()),this.kernels.push(n),n}},{key:"createKernelMap",value:function(){var t=void 0,e=void 0;"function"==typeof arguments[arguments.length-2]?(t=arguments[arguments.length-2],e=arguments[arguments.length-1]):t=arguments[arguments.length-1],o.isWebGlDrawBuffersSupported()||(this._runner=new p(e));var n=this.createKernel(t,e);if(Array.isArray(arguments[0]))for(var r=arguments[0],i=0;i<r.length;i++)n.addSubKernel(r[i]);else{var s=arguments[0];for(var a in s)s.hasOwnProperty(a)&&n.addSubKernelProperty(a,s[a])}return n}},{key:"combineKernels",value:function(){var t=arguments[arguments.length-2],e=arguments[arguments.length-1];if("cpu"===this.getMode())return e;for(var n=arguments[0].getCanvas(),r=arguments[0].getWebGl(),i=0;i<arguments.length-1;i++)arguments[i].setCanvas(n).setWebGl(r).setOutputToTexture(!0);return function(){e.apply(null,arguments);var n=t.texSize,r=t.getWebGl(),i=t.threadDim,s=void 0;if(t.floatOutput)s=new Float32Array(n[0]*n[1]*4),r.readPixels(0,0,n[0],n[1],r.RGBA,r.FLOAT,s);else{var a=new Uint8Array(n[0]*n[1]*4);r.readPixels(0,0,n[0],n[1],r.RGBA,r.UNSIGNED_BYTE,a),s=new Float32Array(a.buffer)}if(s=s.subarray(0,i[0]*i[1]*i[2]),1===t.output.length)return s;if(2===t.output.length)return o.splitArray(s,t.output[0]);if(3===t.output.length){var u=o.splitArray(s,t.output[0]*t.output[1]);return u.map(function(e){return o.splitArray(e,t.output[0])})}}}},{key:"getGPURunner",value:function(){return"undefined"!=typeof WebGL2RenderingContext?h:"undefined"!=typeof WebGLRenderingContext?u:void 0}},{key:"addFunction",value:function(t,e,n){return this._runner.functionBuilder.addFunction(null,t,e,n),this}},{key:"addNativeFunction",value:function(t,e){return this._runner.functionBuilder.addNativeFunction(t,e),this}},{key:"getMode",value:function(){return this._runner.getMode()}},{key:"isWebGlSupported",value:function(){return o.isWebGlSupported()}},{key:"getCanvas",value:function(){return this._canvas}},{key:"getWebGl",value:function(){return this._webGl}}]),e}(f);Object.assign(d,f),e.exports=d},{"../backend/cpu/runner":5,"../backend/web-gl/runner":15,"../backend/web-gl/validator-kernel":18,"../backend/web-gl2/runner":22,"../backend/web-gl2/validator-kernel":25,"./gpu-core":27,"./utils":32}],29:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.exports=function i(t,e){if(r(this,i),this.value=t,Array.isArray(e)){this.size=[];for(var n=0;n<e.length;n++)this.size[n]=e[n];for(;this.size.length<3;)this.size.push(1)}else e.z?this.size=[e.x,e.y,e.z]:e.y?this.size=[e.x,e.y,1]:this.size=[e.x,1,1]}},{}],30:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();e.exports=function(){function t(e,n,i,s,a){r(this,t),this.texture=e,this.size=n,this.dimensions=i,this.output=s,this.webGl=a,this.kernel=null}return i(t,[{key:"toArray",value:function(t){if(!t)throw new Error("You need to pass the GPU object for toArray to work.");return this.kernel?this.kernel(this):(this.kernel=t.createKernel(function(t){return t[this.thread.z][this.thread.y][this.thread.x]}).setOutput(this.output),this.kernel(this))}},{key:"delete",value:function(){return this.webGl.deleteTexture(this.texture)}}]),t}()},{}],31:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=function(){function t(){r(this,t)}return i(t,null,[{key:"isCanvas",value:function(t){return null!==t&&t.nodeName&&t.getContext&&"CANVAS"===t.nodeName.toUpperCase()}},{key:"isCanvasSupported",value:function(){return a}},{key:"initCanvas",value:function(){if(!a)return null;var t=document.createElement("canvas");return t.width=2,t.height=2,t}},{key:"isWebGl",value:function(t){return t&&"function"==typeof t.getExtension}},{key:"isWebGlSupported",value:function(){return u}},{key:"isWebGlDrawBuffersSupported",value:function(){return h}},{key:"initWebGlDefaultOptions",value:function(){return{alpha:!1,depth:!1,antialias:!1}}},{key:"initWebGl",value:function(e){if(("undefined"!=typeof a||null===e)&&!a)return null;if(!t.isCanvas(e))throw new Error("Invalid canvas object - "+e);var n=e.getContext("experimental-webgl",t.initWebGlDefaultOptions())||e.getContext("webgl",t.initWebGlDefaultOptions());return n&&(n.OES_texture_float=n.getExtension("OES_texture_float"),n.OES_texture_float_linear=n.getExtension("OES_texture_float_linear"),n.OES_element_index_uint=n.getExtension("OES_element_index_uint")),n}},{key:"initWebGl2",value:function(e){if(("undefined"!=typeof a||null===e)&&!a)return null;if(!t.isCanvas(e))throw new Error("Invalid canvas object - "+e);return e.getContext("webgl2",t.initWebGlDefaultOptions())}}]),t}(),a="undefined"!=typeof document&&s.isCanvas(document.createElement("canvas")),o=s.initWebGl(s.initCanvas()),u=s.isWebGl(o),h=u&&Boolean(o.getExtension("WEBGL_draw_buffers"));u?(s.OES_texture_float=o.OES_texture_float,s.OES_texture_float_linear=o.OES_texture_float_linear,s.OES_element_index_uint=o.OES_element_index_uint):(s.OES_texture_float=!1,s.OES_texture_float_linear=!1,s.OES_element_index_uint=!1),e.exports=s},{}],32:[function(t,e,n){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=t("./utils-core"),h=t("./input"),p=t("./texture"),l=/function ([^(]*)/,c=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,f=/([^\s,]+)/g,d=function(){var t=new ArrayBuffer(4),e=new Uint32Array(t),n=new Uint8Array(t);if(e[0]=3735928559,239===n[0])return"LE";if(222===n[0])return"BE";throw new Error("unknown endianness")}(),g=null,m=null,y=function(){try{return new Function("let i = 1; const j = 1;")(),!0}catch(t){return!1}}(),x=function(e){function n(){return r(this,n),i(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return s(n,e),o(n,null,[{key:"systemEndianness",value:function(){return d}},{key:"isFunction",value:function(t){return"function"==typeof t}},{key:"isFunctionString",value:function(t){return null!==t&&"function"===t.toString().slice(0,"function".length).toLowerCase()}},{key:"getFunctionNameFromString",value:function(t){return l.exec(t)[1]}},{key:"getFunctionBodyFromString",value:function(t){return t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))}},{key:"getParamNamesFromString",value:function(t){var e=t.toString().replace(c,""),n=e.slice(e.indexOf("(")+1,e.indexOf(")")).match(f);return null===n&&(n=[]),n}},{key:"clone",value:function(t){if(null===t||"object"!==("undefined"==typeof t?"undefined":a(t))||t.hasOwnProperty("isActiveClone"))return t;var e=t.constructor();for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t.isActiveClone=null,e[r]=n.clone(t[r]),delete t.isActiveClone);return e}},{key:"newPromise",value:function(t){var e=Promise||small_promise;if(null===e)throw TypeError("Browser is missing Promise implementation. Consider adding small_promise.js polyfill");return new e(t)}},{key:"functionBinder",value:function(t,e){return t.bind?t.bind(e):function(){var n=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);return t.apply(e,n)}}},{key:"isArray",value:function(t){return!isNaN(t.length)}},{key:"getArgumentType",value:function(t){return n.isArray(t)?"IMG"===t[0].nodeName?"HTMLImageArray":"Array":"number"==typeof t?Number.isInteger(t)?"Integer":"Float":t instanceof p?"Texture":t instanceof h?"Input":"IMG"===t.nodeName?"HTMLImage":"Unknown"}},{key:"isFloatReadPixelsSupported",value:function(){if(null!==g)return g;var e=t("../index"),n=new e({mode:"webgl-validator"}).createKernel(function(){return 1},{output:[2],floatTextures:!0,floatOutput:!0,floatOutputForce:!0})();return g=1===n[0]}},{key:"isFloatReadPixelsSupportedWebGL2",value:function(){if(null!==m)return m;var e=t("../index"),n=new e({mode:"webgl2-validator"}).createKernel(function(){return 1},{output:[2],floatTextures:!0,floatOutput:!0,floatOutputForce:!0})();return m=1===n[0]}},{key:"isMixedIdentifiersSupported",value:function(){return y}},{key:"dimToTexSize",value:function(t,e,n){for(var r=e[0],i=1;i<e.length;i++)r*=e[i];!t.floatTextures||n&&!t.floatOutput||(r=Math.ceil(r/4));var s=Math.ceil(Math.sqrt(r));return[s,s]}},{key:"getDimensions",value:function(t,e){var r=void 0;if(n.isArray(t)){for(var i=[],s=t;n.isArray(s);)i.push(s.length),s=s[0];r=i.reverse()}else if(t instanceof p)r=t.output;else{if(!(t instanceof h))throw"Unknown dimensions of "+t;r=t.size}if(e)for(r=n.clone(r);r.length<3;)r.push(1);return r}},{key:"pad",value:function(t,e){function n(t){return Array.apply(null,new Array(t)).map(Number.prototype.valueOf,0)}for(var r=t.length+2*e,i=t.map(function(t){return[].concat(n(e),t,n(e))}),s=0;s<e;s++)i=[].concat([n(r)],i,[n(r)]);return i}},{key:"flatten2dArrayTo",value:function(t,e){for(var n=0,r=0;r<t.length;r++)e.set(t[r],n),n+=t[r].length}},{key:"flatten3dArrayTo",value:function(t,e){for(var n=0,r=0;r<t.length;r++)for(var i=0;i<t[r].length;i++)e.set(t[r][i],n),n+=t[r][i].length}},{key:"flattenTo",value:function(t,e){n.isArray(t[0])?n.isArray(t[0][0])?n.flatten3dArrayTo(t,e):n.flatten2dArrayTo(t,e):e.set(t)}},{key:"splitArray",value:function(t,e){for(var n=[],r=0;r<t.length;r+=e)n.push(Array.prototype.slice.call(t,r,r+e));return n}},{key:"getAstString",value:function(t,e){var n=Array.isArray(t)?t:t.split(/\r?\n/g),r=e.loc.start,i=e.loc.end,s=[];s.push(n[r.line-1].slice(r.column));for(var a=r.line;a<i.line-1;a++)s.push(n[a]);return s.push(n[i.line-1].slice(0,i.column)),s.join("\n")}},{key:"allPropertiesOf",value:function(t){var e=[];do e.push.apply(e,Object.getOwnPropertyNames(t));while(t=Object.getPrototypeOf(t));return e}}]),n}(u);Object.assign(x,u),e.exports=x},{"../index":33,"./input":29,"./texture":30,"./utils-core":31}],33:[function(t,e,n){var r=t("./core/gpu"),i=t("./core/alias"),s=t("./core/utils"),a=t("./core/input"),o=t("./core/texture"),u=t("./backend/cpu/function-builder"),h=t("./backend/cpu/function-node"),p=t("./backend/cpu/kernel"),l=t("./backend/cpu/runner"),c=t("./backend/web-gl/function-builder"),f=t("./backend/web-gl/function-node"),d=t("./backend/web-gl/kernel"),g=t("./backend/web-gl/runner"),m=t("./backend/web-gl2/function-builder"),y=t("./backend/web-gl2/function-node"),x=t("./backend/web-gl2/kernel"),v=t("./backend/web-gl2/runner");r.alias=i,r.utils=s,r.Texture=o,r.Input=a,r.input=function(t,e){return new a(t,e)},r.CPUFunctionBuilder=u,r.CPUFunctionNode=h,r.CPUKernel=p,r.CPURunner=l,r.WebGLFunctionBuilder=c,r.WebGLFunctionNode=f,r.WebGLKernel=d,r.WebGLRunner=g,r.WebGL2FunctionBuilder=m,r.WebGL2FunctionNode=y,r.WebGL2Kernel=x,r.WebGL2Runner=v,"undefined"!=typeof e&&(e.exports=r),"undefined"!=typeof window&&(window.GPU=r)},{"./backend/cpu/function-builder":1,"./backend/cpu/function-node":2,"./backend/cpu/kernel":4,"./backend/cpu/runner":5,"./backend/web-gl/function-builder":11,"./backend/web-gl/function-node":12,"./backend/web-gl/kernel":14,"./backend/web-gl/runner":15,"./backend/web-gl2/function-builder":19,
  "./backend/web-gl2/function-node":20,"./backend/web-gl2/kernel":21,"./backend/web-gl2/runner":22,"./core/alias":26,"./core/gpu":28,"./core/input":29,"./core/texture":30,"./core/utils":32}],34:[function(t,e,n){!function(t,r){"object"==typeof n&&"undefined"!=typeof e?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r(t.acorn={})}(this,function(t){function e(t,e){for(var n=65536,r=0;r<e.length;r+=2){if(n+=e[r],n>t)return!1;if(n+=e[r+1],n>=t)return!0}}function n(t,n){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&U.test(String.fromCharCode(t)):n!==!1&&e(t,V)))}function r(t,n){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&M.test(String.fromCharCode(t)):n!==!1&&(e(t,V)||e(t,j)))))}function i(t,e){return new B(t,{beforeExpr:!0,binop:e})}function s(t,e){return void 0===e&&(e={}),e.keyword=t,X[t]=new B(t,e)}function a(t){return 10===t||13===t||8232===t||8233===t}function o(t,e){return Z.call(t,e)}function u(t,e){for(var n=1,r=0;;){q.lastIndex=r;var i=q.exec(t);if(!(i&&i.index<e))return new et(n,e-r);++n,r=i.index+i[0].length}}function h(t){var e={};for(var n in rt)e[n]=t&&o(t,n)?t[n]:rt[n];if(e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),tt(e.onToken)){var r=e.onToken;e.onToken=function(t){return r.push(t)}}return tt(e.onComment)&&(e.onComment=p(e,e.onComment)),e}function p(t,e){return function(n,r,i,s,a,o){var u={type:n?"Block":"Line",value:r,start:i,end:s};t.locations&&(u.loc=new nt(this,a,o)),t.ranges&&(u.range=[i,s]),e.push(u)}}function l(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}function c(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}function f(t,e,n,r){return t.type=e,t.end=n,this.options.locations&&(t.loc.end=r),this.options.ranges&&(t.range[1]=n),t}function d(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(1023&t)+56320))}function g(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function m(t){return n(t,!0)||36===t||95===t}function y(t){return r(t,!0)||36===t||95===t||8204===t||8205===t}function x(t){return t>=65&&t<=90||t>=97&&t<=122}function v(t){return t>=0&&t<=1114111}function b(t){return 100===t||68===t||115===t||83===t||119===t||87===t}function _(t){return x(t)||95===t}function E(t){return _(t)||T(t)}function T(t){return t>=48&&t<=57}function S(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function k(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}function w(t){return t>=48&&t<=55}function A(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(1023&t)+56320))}function O(t,e){return new st(e,t).parse()}function C(t,e,n){var r=new st(n,t,e);return r.nextToken(),r.parseExpression()}function R(t,e){return new st(e,t)}function P(e,n,r){t.parse_dammit=e,t.LooseParser=n,t.pluginsLoose=r}var N={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},I="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",D={5:I,6:I+" const class extends export import super"},L=/^in(stanceof)?$/,F="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄮㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿪ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ﬀ-ﬆﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼＡ-Ｚａ-ｚｦ-ﾾￂ-ￇￊ-ￏￒ-ￗￚ-ￜ",G="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏０-９＿",U=new RegExp("["+F+"]"),M=new RegExp("["+F+G+"]");F=G=null;var V=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,257,0,11,39,8,0,22,0,12,39,3,3,55,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,698,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,1,31,6124,20,754,9486,286,82,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541],j=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,280,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,19719,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],B=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null},z={beforeExpr:!0},K={startsExpr:!0},X={},W={num:new B("num",K),regexp:new B("regexp",K),string:new B("string",K),name:new B("name",K),eof:new B("eof"),bracketL:new B("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new B("]"),braceL:new B("{",{beforeExpr:!0,startsExpr:!0}),braceR:new B("}"),parenL:new B("(",{beforeExpr:!0,startsExpr:!0}),parenR:new B(")"),comma:new B(",",z),semi:new B(";",z),colon:new B(":",z),dot:new B("."),question:new B("?",z),arrow:new B("=>",z),template:new B("template"),invalidTemplate:new B("invalidTemplate"),ellipsis:new B("...",z),backQuote:new B("`",K),dollarBraceL:new B("${",{beforeExpr:!0,startsExpr:!0}),eq:new B("=",{beforeExpr:!0,isAssign:!0}),assign:new B("_=",{beforeExpr:!0,isAssign:!0}),incDec:new B("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new B("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=/===/!==",6),relational:i("</>/<=/>=",7),bitShift:i("<</>>/>>>",8),plusMin:new B("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),starstar:new B("**",{beforeExpr:!0}),_break:s("break"),_case:s("case",z),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",z),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",z),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",K),_if:s("if"),_return:s("return",z),_switch:s("switch"),_throw:s("throw",z),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",K),_super:s("super",K),_class:s("class",K),_extends:s("extends",z),_export:s("export"),_import:s("import"),_null:s("null",K),_true:s("true",K),_false:s("false",K),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},H=/\r\n?|\n|\u2028|\u2029/,q=new RegExp(H.source,"g"),Y=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,J=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Q=Object.prototype,Z=Q.hasOwnProperty,$=Q.toString,tt=Array.isArray||function(t){return"[object Array]"===$.call(t)},et=function(t,e){this.line=t,this.column=e};et.prototype.offset=function(t){return new et(this.line,this.column+t)};var nt=function(t,e,n){this.start=e,this.end=n,null!==t.sourceFile&&(this.source=t.sourceFile)},rt={ecmaVersion:7,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{}},it={},st=function(t,e,n){this.options=t=h(t),this.sourceFile=t.sourceFile,this.keywords=l(D[t.ecmaVersion>=6?6:5]);var r="";if(!t.allowReserved){for(var i=t.ecmaVersion;!(r=N[i]);i--);"module"==t.sourceType&&(r+=" await")}this.reservedWords=l(r);var s=(r?r+" ":"")+N.strict;this.reservedWordsStrict=l(s),this.reservedWordsStrictBind=l(s+" "+N.strictBind),this.input=String(e),this.containsEsc=!1,this.loadPlugins(t.plugins),n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(H).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=W.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.inFunction=this.inGenerator=this.inAsync=!1,this.yieldPos=this.awaitPos=0,this.labels=[],0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterFunctionScope(),this.regexpState=null};st.prototype.isKeyword=function(t){return this.keywords.test(t)},st.prototype.isReservedWord=function(t){return this.reservedWords.test(t)},st.prototype.extend=function(t,e){this[t]=e(this[t])},st.prototype.loadPlugins=function(t){var e=this;for(var n in t){var r=it[n];if(!r)throw new Error("Plugin '"+n+"' not found");r(e,t[n])}},st.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};var at=st.prototype,ot=/^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/;at.strictDirective=function(t){for(var e=this;;){J.lastIndex=t,t+=J.exec(e.input)[0].length;var n=ot.exec(e.input.slice(t));if(!n)return!1;if("use strict"==(n[1]||n[2]))return!0;t+=n[0].length}},at.eat=function(t){return this.type===t&&(this.next(),!0)},at.isContextual=function(t){return this.type===W.name&&this.value===t&&!this.containsEsc},at.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},at.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},at.canInsertSemicolon=function(){return this.type===W.eof||this.type===W.braceR||H.test(this.input.slice(this.lastTokEnd,this.start))},at.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},at.semicolon=function(){this.eat(W.semi)||this.insertSemicolon()||this.unexpected()},at.afterTrailingComma=function(t,e){if(this.type==t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},at.expect=function(t){this.eat(t)||this.unexpected()},at.unexpected=function(t){this.raise(null!=t?t:this.start,"Unexpected token")},at.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var n=e?t.parenthesizedAssign:t.parenthesizedBind;n>-1&&this.raiseRecoverable(n,"Parenthesized pattern")}},at.checkExpressionErrors=function(t,e){if(!t)return!1;var n=t.shorthandAssign,r=t.doubleProto;return e?(n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),void(r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property"))):n>=0||r>=0},at.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},at.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var ut=st.prototype;ut.parseTopLevel=function(t){var e=this,n={};for(t.body||(t.body=[]);this.type!==W.eof;){var r=e.parseStatement(!0,!0,n);t.body.push(r)}return this.adaptDirectivePrologue(t.body),this.next(),this.options.ecmaVersion>=6&&(t.sourceType=this.options.sourceType),this.finishNode(t,"Program")};var ht={kind:"loop"},pt={kind:"switch"};ut.isLet=function(){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;J.lastIndex=this.pos;var t=J.exec(this.input),e=this.pos+t[0].length,i=this.input.charCodeAt(e);if(91===i||123==i)return!0;if(n(i,!0)){for(var s=e+1;r(this.input.charCodeAt(s),!0);)++s;var a=this.input.slice(e,s);if(!L.test(a))return!0}return!1},ut.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;J.lastIndex=this.pos;var t=J.exec(this.input),e=this.pos+t[0].length;return!(H.test(this.input.slice(this.pos,e))||"function"!==this.input.slice(e,e+8)||e+8!=this.input.length&&r(this.input.charAt(e+8)))},ut.parseStatement=function(t,e,n){var r,i=this.type,s=this.startNode();switch(this.isLet()&&(i=W._var,r="let"),i){case W._break:case W._continue:return this.parseBreakContinueStatement(s,i.keyword);case W._debugger:return this.parseDebuggerStatement(s);case W._do:return this.parseDoStatement(s);case W._for:return this.parseForStatement(s);case W._function:return!t&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1);case W._class:return t||this.unexpected(),this.parseClass(s,!0);case W._if:return this.parseIfStatement(s);case W._return:return this.parseReturnStatement(s);case W._switch:return this.parseSwitchStatement(s);case W._throw:return this.parseThrowStatement(s);case W._try:return this.parseTryStatement(s);case W._const:case W._var:return r=r||this.value,t||"var"==r||this.unexpected(),this.parseVarStatement(s,r);case W._while:return this.parseWhileStatement(s);case W._with:return this.parseWithStatement(s);case W.braceL:return this.parseBlock();case W.semi:return this.parseEmptyStatement(s);case W._export:case W._import:return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===W._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction())return t||this.unexpected(),this.next(),this.parseFunctionStatement(s,!0);var a=this.value,o=this.parseExpression();return i===W.name&&"Identifier"===o.type&&this.eat(W.colon)?this.parseLabeledStatement(s,a,o):this.parseExpressionStatement(s,o)}},ut.parseBreakContinueStatement=function(t,e){var n=this,r="break"==e;this.next(),this.eat(W.semi)||this.insertSemicolon()?t.label=null:this.type!==W.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var s=n.labels[i];if(null==t.label||s.name===t.label.name){if(null!=s.kind&&(r||"loop"===s.kind))break;if(t.label&&r)break}}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,r?"BreakStatement":"ContinueStatement")},ut.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},ut.parseDoStatement=function(t){return this.next(),this.labels.push(ht),t.body=this.parseStatement(!1),this.labels.pop(),this.expect(W._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(W.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},ut.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.inAsync&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(ht),this.enterLexicalScope(),this.expect(W.parenL),this.type===W.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===W._var||this.type===W._const||n){var r=this.startNode(),i=n?"let":this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,"VariableDeclaration"),!(this.type===W._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==r.declarations.length||"var"!==i&&r.declarations[0].init?(e>-1&&this.unexpected(e),this.parseFor(t,r)):(this.options.ecmaVersion>=9&&(this.type===W._in?e>-1&&this.unexpected(e):t.await=e>-1),this.parseForIn(t,r))}var s=new c,a=this.parseExpression(!0,s);return this.type===W._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.options.ecmaVersion>=9&&(this.type===W._in?e>-1&&this.unexpected(e):t.await=e>-1),this.toAssignable(a,!1,s),this.checkLVal(a),this.parseForIn(t,a)):(this.checkExpressionErrors(s,!0),e>-1&&this.unexpected(e),this.parseFor(t,a))},ut.parseFunctionStatement=function(t,e){return this.next(),this.parseFunction(t,!0,!1,e)},ut.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement(!this.strict&&this.type==W._function),t.alternate=this.eat(W._else)?this.parseStatement(!this.strict&&this.type==W._function):null,this.finishNode(t,"IfStatement")},ut.parseReturnStatement=function(t){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(W.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},ut.parseSwitchStatement=function(t){var e=this;this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(W.braceL),this.labels.push(pt),this.enterLexicalScope();for(var n,r=!1;this.type!=W.braceR;)if(e.type===W._case||e.type===W._default){var i=e.type===W._case;n&&e.finishNode(n,"SwitchCase"),t.cases.push(n=e.startNode()),n.consequent=[],e.next(),i?n.test=e.parseExpression():(r&&e.raiseRecoverable(e.lastTokStart,"Multiple default clauses"),r=!0,n.test=null),e.expect(W.colon)}else n||e.unexpected(),n.consequent.push(e.parseStatement(!0));return this.exitLexicalScope(),n&&this.finishNode(n,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},ut.parseThrowStatement=function(t){return this.next(),H.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var lt=[];ut.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===W._catch){var e=this.startNode();this.next(),this.expect(W.parenL),e.param=this.parseBindingAtom(),this.enterLexicalScope(),this.checkLVal(e.param,"let"),this.expect(W.parenR),e.body=this.parseBlock(!1),this.exitLexicalScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(W._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},ut.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")},ut.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(ht),t.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(t,"WhileStatement")},ut.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement(!1),this.finishNode(t,"WithStatement")},ut.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},ut.parseLabeledStatement=function(t,e,n){for(var r=this,i=0,s=r.labels;i<s.length;i+=1){var a=s[i];a.name===e&&r.raise(n.start,"Label '"+e+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===W._switch?"switch":null,u=this.labels.length-1;u>=0;u--){var h=r.labels[u];if(h.statementStart!=t.start)break;h.statementStart=r.start,h.kind=o}return this.labels.push({name:e,kind:o,statementStart:this.start}),t.body=this.parseStatement(!0),("ClassDeclaration"==t.body.type||"VariableDeclaration"==t.body.type&&"var"!=t.body.kind||"FunctionDeclaration"==t.body.type&&(this.strict||t.body.generator))&&this.raiseRecoverable(t.body.start,"Invalid labeled declaration"),this.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")},ut.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},ut.parseBlock=function(t){var e=this;void 0===t&&(t=!0);var n=this.startNode();for(n.body=[],this.expect(W.braceL),t&&this.enterLexicalScope();!this.eat(W.braceR);){var r=e.parseStatement(!0);n.body.push(r)}return t&&this.exitLexicalScope(),this.finishNode(n,"BlockStatement")},ut.parseFor=function(t,e){return t.init=e,this.expect(W.semi),t.test=this.type===W.semi?null:this.parseExpression(),this.expect(W.semi),t.update=this.type===W.parenR?null:this.parseExpression(),this.expect(W.parenR),this.exitLexicalScope(),t.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(t,"ForStatement")},ut.parseForIn=function(t,e){var n=this.type===W._in?"ForInStatement":"ForOfStatement";return this.next(),"ForInStatement"==n&&("AssignmentPattern"===e.type||"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(this.strict||"Identifier"!==e.declarations[0].id.type))&&this.raise(e.start,"Invalid assignment in for-in loop head"),t.left=e,t.right="ForInStatement"==n?this.parseExpression():this.parseMaybeAssign(),this.expect(W.parenR),this.exitLexicalScope(),t.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(t,n)},ut.parseVar=function(t,e,n){var r=this;for(t.declarations=[],t.kind=n;;){var i=r.startNode();if(r.parseVarId(i,n),r.eat(W.eq)?i.init=r.parseMaybeAssign(e):"const"!==n||r.type===W._in||r.options.ecmaVersion>=6&&r.isContextual("of")?"Identifier"==i.id.type||e&&(r.type===W._in||r.isContextual("of"))?i.init=null:r.raise(r.lastTokEnd,"Complex binding patterns require an initialization value"):r.unexpected(),t.declarations.push(r.finishNode(i,"VariableDeclarator")),!r.eat(W.comma))break}return t},ut.parseVarId=function(t,e){t.id=this.parseBindingAtom(e),this.checkLVal(t.id,e,!1)},ut.parseFunction=function(t,e,n,r){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(t.generator=this.eat(W.star)),this.options.ecmaVersion>=8&&(t.async=!!r),e&&(t.id="nullableID"===e&&this.type!=W.name?null:this.parseIdent(),t.id&&this.checkLVal(t.id,"var"));var i=this.inGenerator,s=this.inAsync,a=this.yieldPos,o=this.awaitPos,u=this.inFunction;return this.inGenerator=t.generator,this.inAsync=t.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),e||(t.id=this.type==W.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n),this.inGenerator=i,this.inAsync=s,this.yieldPos=a,this.awaitPos=o,this.inFunction=u,this.finishNode(t,e?"FunctionDeclaration":"FunctionExpression")},ut.parseFunctionParams=function(t){this.expect(W.parenL),t.params=this.parseBindingList(W.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},ut.parseClass=function(t,e){var n=this;this.next(),this.parseClassId(t,e),this.parseClassSuper(t);var r=this.startNode(),i=!1;for(r.body=[],this.expect(W.braceL);!this.eat(W.braceR);){var s=n.parseClassMember(r);s&&"MethodDefinition"===s.type&&"constructor"===s.kind&&(i&&n.raise(s.start,"Duplicate constructor in the same class"),i=!0)}return t.body=this.finishNode(r,"ClassBody"),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},ut.parseClassMember=function(t){var e=this;if(this.eat(W.semi))return null;var n=this.startNode(),r=function(t,r){void 0===r&&(r=!1);var i=e.start,s=e.startLoc;return!!e.eatContextual(t)&&(!(e.type===W.parenL||r&&e.canInsertSemicolon())||(n.key&&e.unexpected(),n.computed=!1,n.key=e.startNodeAt(i,s),n.key.name=t,e.finishNode(n.key,"Identifier"),!1))};n.kind="method",n["static"]=r("static");var i=this.eat(W.star),s=!1;i||(this.options.ecmaVersion>=8&&r("async",!0)?(s=!0,i=this.options.ecmaVersion>=9&&this.eat(W.star)):r("get")?n.kind="get":r("set")&&(n.kind="set")),n.key||this.parsePropertyName(n);var a=n.key;return n.computed||n["static"]||!("Identifier"===a.type&&"constructor"===a.name||"Literal"===a.type&&"constructor"===a.value)?n["static"]&&"Identifier"===a.type&&"prototype"===a.name&&this.raise(a.start,"Classes may not have a static property named prototype"):("method"!==n.kind&&this.raise(a.start,"Constructor can't have get/set modifier"),i&&this.raise(a.start,"Constructor can't be a generator"),s&&this.raise(a.start,"Constructor can't be an async method"),n.kind="constructor"),this.parseClassMethod(t,n,i,s),"get"===n.kind&&0!==n.value.params.length&&this.raiseRecoverable(n.value.start,"getter should have no params"),"set"===n.kind&&1!==n.value.params.length&&this.raiseRecoverable(n.value.start,"setter should have exactly one param"),"set"===n.kind&&"RestElement"===n.value.params[0].type&&this.raiseRecoverable(n.value.params[0].start,"Setter cannot use rest params"),n},ut.parseClassMethod=function(t,e,n,r){e.value=this.parseMethod(n,r),t.body.push(this.finishNode(e,"MethodDefinition"))},ut.parseClassId=function(t,e){t.id=this.type===W.name?this.parseIdent():e===!0?this.unexpected():null},ut.parseClassSuper=function(t){t.superClass=this.eat(W._extends)?this.parseExprSubscripts():null},ut.parseExport=function(t,e){var n=this;if(this.next(),this.eat(W.star))return this.expectContextual("from"),this.type!==W.string&&this.unexpected(),t.source=this.parseExprAtom(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration");if(this.eat(W._default)){this.checkExport(e,"default",this.lastTokStart);var r;if(this.type===W._function||(r=this.isAsyncFunction())){var i=this.startNode();this.next(),r&&this.next(),t.declaration=this.parseFunction(i,"nullableID",!1,r)}else if(this.type===W._class){var s=this.startNode();t.declaration=this.parseClass(s,"nullableID")}else t.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(t,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())t.declaration=this.parseStatement(!0),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id.name,t.declaration.id.start),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==W.string&&this.unexpected(),t.source=this.parseExprAtom();else{for(var a=0,o=t.specifiers;a<o.length;a+=1){var u=o[a];n.checkUnreserved(u.local)}t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},ut.checkExport=function(t,e,n){t&&(o(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)},ut.checkPatternExport=function(t,e){var n=this,r=e.type;if("Identifier"==r)this.checkExport(t,e.name,e.start);else if("ObjectPattern"==r)for(var i=0,s=e.properties;i<s.length;i+=1){var a=s[i];n.checkPatternExport(t,a)}else if("ArrayPattern"==r)for(var o=0,u=e.elements;o<u.length;o+=1){var h=u[o];h&&n.checkPatternExport(t,h)}else"Property"==r?this.checkPatternExport(t,e.value):"AssignmentPattern"==r?this.checkPatternExport(t,e.left):"RestElement"==r?this.checkPatternExport(t,e.argument):"ParenthesizedExpression"==r&&this.checkPatternExport(t,e.expression)},ut.checkVariableExport=function(t,e){var n=this;if(t)for(var r=0,i=e;r<i.length;r+=1){var s=i[r];n.checkPatternExport(t,s.id)}},ut.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},ut.parseExportSpecifiers=function(t){var e=this,n=[],r=!0;for(this.expect(W.braceL);!this.eat(W.braceR);){if(r)r=!1;else if(e.expect(W.comma),e.afterTrailingComma(W.braceR))break;var i=e.startNode();i.local=e.parseIdent(!0),i.exported=e.eatContextual("as")?e.parseIdent(!0):i.local,e.checkExport(t,i.exported.name,i.exported.start),n.push(e.finishNode(i,"ExportSpecifier"))}return n},ut.parseImport=function(t){return this.next(),this.type===W.string?(t.specifiers=lt,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===W.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},ut.parseImportSpecifiers=function(){var t=this,e=[],n=!0;if(this.type===W.name){var r=this.startNode();if(r.local=this.parseIdent(),this.checkLVal(r.local,"let"),e.push(this.finishNode(r,"ImportDefaultSpecifier")),!this.eat(W.comma))return e}if(this.type===W.star){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdent(),this.checkLVal(i.local,"let"),e.push(this.finishNode(i,"ImportNamespaceSpecifier")),e}for(this.expect(W.braceL);!this.eat(W.braceR);){if(n)n=!1;else if(t.expect(W.comma),t.afterTrailingComma(W.braceR))break;var s=t.startNode();s.imported=t.parseIdent(!0),t.eatContextual("as")?s.local=t.parseIdent():(t.checkUnreserved(s.imported),s.local=s.imported),t.checkLVal(s.local,"let"),e.push(t.finishNode(s,"ImportSpecifier"))}return e},ut.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},ut.isDirectiveCandidate=function(t){return"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var ct=st.prototype;ct.toAssignable=function(t,e,n){var r=this;if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Can not use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var i=0,s=t.properties;i<s.length;i+=1){var a=s[i];r.toAssignable(a,e),"RestElement"!==a.type||"ArrayPattern"!==a.argument.type&&"ObjectPattern"!==a.argument.type||r.raise(a.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":
  t.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);case"AssignmentPattern":break;case"ParenthesizedExpression":this.toAssignable(t.expression,e);break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return t},ct.toAssignableList=function(t,e){for(var n=this,r=t.length,i=0;i<r;i++){var s=t[i];s&&n.toAssignable(s,e)}if(r){var a=t[r-1];6===this.options.ecmaVersion&&e&&a&&"RestElement"===a.type&&"Identifier"!==a.argument.type&&this.unexpected(a.argument.start)}return t},ct.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},ct.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==W.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},ct.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case W.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(W.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case W.braceL:return this.parseObj(!0)}return this.parseIdent()},ct.parseBindingList=function(t,e,n){for(var r=this,i=[],s=!0;!this.eat(t);)if(s?s=!1:r.expect(W.comma),e&&r.type===W.comma)i.push(null);else{if(n&&r.afterTrailingComma(t))break;if(r.type===W.ellipsis){var a=r.parseRestBinding();r.parseBindingListItem(a),i.push(a),r.type===W.comma&&r.raise(r.start,"Comma is not permitted after the rest element"),r.expect(t);break}var o=r.parseMaybeDefault(r.start,r.startLoc);r.parseBindingListItem(o),i.push(o)}return i},ct.parseBindingListItem=function(t){return t},ct.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(W.eq))return n;var r=this.startNodeAt(t,e);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},ct.checkLVal=function(t,e,n){var r=this;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),n&&(o(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e&&"none"!==e&&(("var"===e&&!this.canDeclareVarName(t.name)||"var"!==e&&!this.canDeclareLexicalName(t.name))&&this.raiseRecoverable(t.start,"Identifier '"+t.name+"' has already been declared"),"var"===e?this.declareVarName(t.name):this.declareLexicalName(t.name));break;case"MemberExpression":e&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ObjectPattern":for(var i=0,s=t.properties;i<s.length;i+=1){var a=s[i];r.checkLVal(a,e,n)}break;case"Property":this.checkLVal(t.value,e,n);break;case"ArrayPattern":for(var u=0,h=t.elements;u<h.length;u+=1){var p=h[u];p&&r.checkLVal(p,e,n)}break;case"AssignmentPattern":this.checkLVal(t.left,e,n);break;case"RestElement":this.checkLVal(t.argument,e,n);break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,n);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}};var ft=st.prototype;ft.checkPropClash=function(t,e,n){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var r,i=t.key;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var s=t.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===r&&"init"===s&&(e.proto&&(n&&n.doubleProto<0?n.doubleProto=i.start:this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),e.proto=!0));r="$"+r;var a=e[r];if(a){var o;o="init"===s?this.strict&&a.init||a.get||a.set:a.init||a[s],o&&this.raiseRecoverable(i.start,"Redefinition of property")}else a=e[r]={init:!1,get:!1,set:!1};a[s]=!0}},ft.parseExpression=function(t,e){var n=this,r=this.start,i=this.startLoc,s=this.parseMaybeAssign(t,e);if(this.type===W.comma){var a=this.startNodeAt(r,i);for(a.expressions=[s];this.eat(W.comma);)a.expressions.push(n.parseMaybeAssign(t,e));return this.finishNode(a,"SequenceExpression")}return s},ft.parseMaybeAssign=function(t,e,n){if(this.inGenerator&&this.isContextual("yield"))return this.parseYield();var r=!1,i=-1,s=-1;e?(i=e.parenthesizedAssign,s=e.trailingComma,e.parenthesizedAssign=e.trailingComma=-1):(e=new c,r=!0);var a=this.start,o=this.startLoc;this.type!=W.parenL&&this.type!=W.name||(this.potentialArrowAt=this.start);var u=this.parseMaybeConditional(t,e);if(n&&(u=n.call(this,u,a,o)),this.type.isAssign){var h=this.startNodeAt(a,o);return h.operator=this.value,h.left=this.type===W.eq?this.toAssignable(u,!1,e):u,r||c.call(e),e.shorthandAssign=-1,this.checkLVal(u),this.next(),h.right=this.parseMaybeAssign(t),this.finishNode(h,"AssignmentExpression")}return r&&this.checkExpressionErrors(e,!0),i>-1&&(e.parenthesizedAssign=i),s>-1&&(e.trailingComma=s),u},ft.parseMaybeConditional=function(t,e){var n=this.start,r=this.startLoc,i=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return i;if(this.eat(W.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(W.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return i},ft.parseExprOps=function(t,e){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(e,!1);return this.checkExpressionErrors(e)?i:i.start==n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,r,-1,t)},ft.parseExprOp=function(t,e,n,r,i){var s=this.type.binop;if(null!=s&&(!i||this.type!==W._in)&&s>r){var a=this.type===W.logicalOR||this.type===W.logicalAND,o=this.value;this.next();var u=this.start,h=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1),u,h,s,i),l=this.buildBinary(e,n,t,p,o,a);return this.parseExprOp(l,e,n,r,i)}return t},ft.buildBinary=function(t,e,n,r,i,s){var a=this.startNodeAt(t,e);return a.left=n,a.operator=i,a.right=r,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")},ft.parseMaybeUnary=function(t,e){var n,r=this,i=this.start,s=this.startLoc;if(this.inAsync&&this.isContextual("await"))n=this.parseAwait(),e=!0;else if(this.type.prefix){var a=this.startNode(),o=this.type===W.incDec;a.operator=this.value,a.prefix=!0,this.next(),a.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),o?this.checkLVal(a.argument):this.strict&&"delete"===a.operator&&"Identifier"===a.argument.type?this.raiseRecoverable(a.start,"Deleting local variable in strict mode"):e=!0,n=this.finishNode(a,o?"UpdateExpression":"UnaryExpression")}else{if(n=this.parseExprSubscripts(t),this.checkExpressionErrors(t))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=r.startNodeAt(i,s);u.operator=r.value,u.prefix=!1,u.argument=n,r.checkLVal(n),r.next(),n=r.finishNode(u,"UpdateExpression")}}return!e&&this.eat(W.starstar)?this.buildBinary(i,s,n,this.parseMaybeUnary(null,!1),"**",!1):n},ft.parseExprSubscripts=function(t){var e=this.start,n=this.startLoc,r=this.parseExprAtom(t),i="ArrowFunctionExpression"===r.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd);if(this.checkExpressionErrors(t)||i)return r;var s=this.parseSubscripts(r,e,n);return t&&"MemberExpression"===s.type&&(t.parenthesizedAssign>=s.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=s.start&&(t.parenthesizedBind=-1)),s},ft.parseSubscripts=function(t,e,n,r){for(var i=this,s=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd==t.end&&!this.canInsertSemicolon()&&"async"===this.input.slice(t.start,t.end),a=void 0;;)if((a=i.eat(W.bracketL))||i.eat(W.dot)){var o=i.startNodeAt(e,n);o.object=t,o.property=a?i.parseExpression():i.parseIdent(!0),o.computed=!!a,a&&i.expect(W.bracketR),t=i.finishNode(o,"MemberExpression")}else if(!r&&i.eat(W.parenL)){var u=new c,h=i.yieldPos,p=i.awaitPos;i.yieldPos=0,i.awaitPos=0;var l=i.parseExprList(W.parenR,i.options.ecmaVersion>=8,!1,u);if(s&&!i.canInsertSemicolon()&&i.eat(W.arrow))return i.checkPatternErrors(u,!1),i.checkYieldAwaitInDefaultParams(),i.yieldPos=h,i.awaitPos=p,i.parseArrowExpression(i.startNodeAt(e,n),l,!0);i.checkExpressionErrors(u,!0),i.yieldPos=h||i.yieldPos,i.awaitPos=p||i.awaitPos;var f=i.startNodeAt(e,n);f.callee=t,f.arguments=l,t=i.finishNode(f,"CallExpression")}else{if(i.type!==W.backQuote)return t;var d=i.startNodeAt(e,n);d.tag=t,d.quasi=i.parseTemplate({isTagged:!0}),t=i.finishNode(d,"TaggedTemplateExpression")}},ft.parseExprAtom=function(t){var e,n=this.potentialArrowAt==this.start;switch(this.type){case W._super:return this.inFunction||this.raise(this.start,"'super' outside of function or class"),e=this.startNode(),this.next(),this.type!==W.dot&&this.type!==W.bracketL&&this.type!==W.parenL&&this.unexpected(),this.finishNode(e,"Super");case W._this:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case W.name:var r=this.start,i=this.startLoc,s=this.containsEsc,a=this.parseIdent(this.type!==W.name);if(this.options.ecmaVersion>=8&&!s&&"async"===a.name&&!this.canInsertSemicolon()&&this.eat(W._function))return this.parseFunction(this.startNodeAt(r,i),!1,!1,!0);if(n&&!this.canInsertSemicolon()){if(this.eat(W.arrow))return this.parseArrowExpression(this.startNodeAt(r,i),[a],!1);if(this.options.ecmaVersion>=8&&"async"===a.name&&this.type===W.name&&!s)return a=this.parseIdent(),!this.canInsertSemicolon()&&this.eat(W.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,i),[a],!0)}return a;case W.regexp:var o=this.value;return e=this.parseLiteral(o.value),e.regex={pattern:o.pattern,flags:o.flags},e;case W.num:case W.string:return this.parseLiteral(this.value);case W._null:case W._true:case W._false:return e=this.startNode(),e.value=this.type===W._null?null:this.type===W._true,e.raw=this.type.keyword,this.next(),this.finishNode(e,"Literal");case W.parenL:var u=this.start,h=this.parseParenAndDistinguishExpression(n);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(h)&&(t.parenthesizedAssign=u),t.parenthesizedBind<0&&(t.parenthesizedBind=u)),h;case W.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList(W.bracketR,!0,!0,t),this.finishNode(e,"ArrayExpression");case W.braceL:return this.parseObj(!1,t);case W._function:return e=this.startNode(),this.next(),this.parseFunction(e,!1);case W._class:return this.parseClass(this.startNode(),!1);case W._new:return this.parseNew();case W.backQuote:return this.parseTemplate();default:this.unexpected()}},ft.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(e,"Literal")},ft.parseParenExpression=function(){this.expect(W.parenL);var t=this.parseExpression();return this.expect(W.parenR),t},ft.parseParenAndDistinguishExpression=function(t){var e,n=this,r=this.start,i=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,u=this.startLoc,h=[],p=!0,l=!1,f=new c,d=this.yieldPos,g=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==W.parenR;){if(p?p=!1:n.expect(W.comma),s&&n.afterTrailingComma(W.parenR,!0)){l=!0;break}if(n.type===W.ellipsis){a=n.start,h.push(n.parseParenItem(n.parseRestBinding())),n.type===W.comma&&n.raise(n.start,"Comma is not permitted after the rest element");break}h.push(n.parseMaybeAssign(!1,f,n.parseParenItem))}var m=this.start,y=this.startLoc;if(this.expect(W.parenR),t&&!this.canInsertSemicolon()&&this.eat(W.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=g,this.parseParenArrowList(r,i,h);h.length&&!l||this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=g||this.awaitPos,h.length>1?(e=this.startNodeAt(o,u),e.expressions=h,this.finishNodeAt(e,"SequenceExpression",m,y)):e=h[0]}else e=this.parseParenExpression();if(this.options.preserveParens){var x=this.startNodeAt(r,i);return x.expression=e,this.finishNode(x,"ParenthesizedExpression")}return e},ft.parseParenItem=function(t){return t},ft.parseParenArrowList=function(t,e,n){return this.parseArrowExpression(this.startNodeAt(t,e),n)};var dt=[];ft.parseNew=function(){var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(W.dot)){t.meta=e;var n=this.containsEsc;return t.property=this.parseIdent(!0),("target"!==t.property.name||n)&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is new.target"),this.inFunction||this.raiseRecoverable(t.start,"new.target can only be used in functions"),this.finishNode(t,"MetaProperty")}var r=this.start,i=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(),r,i,!0),this.eat(W.parenL)?t.arguments=this.parseExprList(W.parenR,this.options.ecmaVersion>=8,!1):t.arguments=dt,this.finishNode(t,"NewExpression")},ft.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===W.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value,cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===W.backQuote,this.finishNode(n,"TemplateElement")},ft.parseTemplate=function(t){var e=this;void 0===t&&(t={});var n=t.isTagged;void 0===n&&(n=!1);var r=this.startNode();this.next(),r.expressions=[];var i=this.parseTemplateElement({isTagged:n});for(r.quasis=[i];!i.tail;)e.expect(W.dollarBraceL),r.expressions.push(e.parseExpression()),e.expect(W.braceR),r.quasis.push(i=e.parseTemplateElement({isTagged:n}));return this.next(),this.finishNode(r,"TemplateLiteral")},ft.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===W.name||this.type===W.num||this.type===W.string||this.type===W.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===W.star)&&!H.test(this.input.slice(this.lastTokEnd,this.start))},ft.parseObj=function(t,e){var n=this,r=this.startNode(),i=!0,s={};for(r.properties=[],this.next();!this.eat(W.braceR);){if(i)i=!1;else if(n.expect(W.comma),n.afterTrailingComma(W.braceR))break;var a=n.parseProperty(t,e);t||n.checkPropClash(a,s,e),r.properties.push(a)}return this.finishNode(r,t?"ObjectPattern":"ObjectExpression")},ft.parseProperty=function(t,e){var n,r,i,s,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(W.ellipsis))return t?(a.argument=this.parseIdent(!1),this.type===W.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(this.type===W.parenL&&e&&(e.parenthesizedAssign<0&&(e.parenthesizedAssign=this.start),e.parenthesizedBind<0&&(e.parenthesizedBind=this.start)),a.argument=this.parseMaybeAssign(!1,e),this.type===W.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(t||e)&&(i=this.start,s=this.startLoc),t||(n=this.eat(W.star)));var o=this.containsEsc;return this.parsePropertyName(a),!t&&!o&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(a)?(r=!0,n=this.options.ecmaVersion>=9&&this.eat(W.star),this.parsePropertyName(a,e)):r=!1,this.parsePropertyValue(a,t,n,r,i,s,e,o),this.finishNode(a,"Property")},ft.parsePropertyValue=function(t,e,n,r,i,s,a,o){if((n||r)&&this.type===W.colon&&this.unexpected(),this.eat(W.colon))t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init";else if(this.options.ecmaVersion>=6&&this.type===W.parenL)e&&this.unexpected(),t.kind="init",t.method=!0,t.value=this.parseMethod(n,r);else if(e||o||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type==W.comma||this.type==W.braceR)this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?(this.checkUnreserved(t.key),t.kind="init",e?t.value=this.parseMaybeDefault(i,s,t.key):this.type===W.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(i,s,t.key)):t.value=t.key,t.shorthand=!0):this.unexpected();else{(n||r)&&this.unexpected(),t.kind=t.key.name,this.parsePropertyName(t),t.value=this.parseMethod(!1);var u="get"===t.kind?0:1;if(t.value.params.length!==u){var h=t.value.start;"get"===t.kind?this.raiseRecoverable(h,"getter should have no params"):this.raiseRecoverable(h,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")}},ft.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(W.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(W.bracketR),t.key;t.computed=!1}return t.key=this.type===W.num||this.type===W.string?this.parseExprAtom():this.parseIdent(!0)},ft.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=!1,t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},ft.parseMethod=function(t,e){var n=this.startNode(),r=this.inGenerator,i=this.inAsync,s=this.yieldPos,a=this.awaitPos,o=this.inFunction;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=t),this.options.ecmaVersion>=8&&(n.async=!!e),this.inGenerator=n.generator,this.inAsync=n.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),this.expect(W.parenL),n.params=this.parseBindingList(W.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=a,this.inFunction=o,this.finishNode(n,"FunctionExpression")},ft.parseArrowExpression=function(t,e,n){var r=this.inGenerator,i=this.inAsync,s=this.yieldPos,a=this.awaitPos,o=this.inFunction;return this.enterFunctionScope(),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!n),this.inGenerator=!1,this.inAsync=t.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=a,this.inFunction=o,this.finishNode(t,"ArrowFunctionExpression")},ft.parseFunctionBody=function(t,e){var n=e&&this.type!==W.braceL,r=this.strict,i=!1;if(n)t.body=this.parseMaybeAssign(),t.expression=!0,this.checkParams(t,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);r&&!s||(i=this.strictDirective(this.end),i&&s&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var a=this.labels;this.labels=[],i&&(this.strict=!0),this.checkParams(t,!r&&!i&&!e&&this.isSimpleParamList(t.params)),t.body=this.parseBlock(!1),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=a}this.exitFunctionScope(),this.strict&&t.id&&this.checkLVal(t.id,"none"),this.strict=r},ft.isSimpleParamList=function(t){for(var e=0,n=t;e<n.length;e+=1){var r=n[e];if("Identifier"!==r.type)return!1}return!0},ft.checkParams=function(t,e){for(var n=this,r={},i=0,s=t.params;i<s.length;i+=1){var a=s[i];n.checkLVal(a,"var",e?null:r)}},ft.parseExprList=function(t,e,n,r){for(var i=this,s=[],a=!0;!this.eat(t);){if(a)a=!1;else if(i.expect(W.comma),e&&i.afterTrailingComma(t))break;var o=void 0;n&&i.type===W.comma?o=null:i.type===W.ellipsis?(o=i.parseSpread(r),r&&i.type===W.comma&&r.trailingComma<0&&(r.trailingComma=i.start)):o=i.parseMaybeAssign(!1,r),s.push(o)}return s},ft.checkUnreserved=function(t){var e=t.start,n=t.end,r=t.name;if(this.inGenerator&&"yield"===r&&this.raiseRecoverable(e,"Can not use 'yield' as identifier inside a generator"),this.inAsync&&"await"===r&&this.raiseRecoverable(e,"Can not use 'await' as identifier inside an async function"),this.isKeyword(r)&&this.raise(e,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,n).indexOf("\\")!=-1)){var i=this.strict?this.reservedWordsStrict:this.reservedWords;i.test(r)&&(this.inAsync||"await"!==r||this.raiseRecoverable(e,"Can not use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+r+"' is reserved"))}},ft.parseIdent=function(t,e){var n=this.startNode();return t&&"never"==this.options.allowReserved&&(t=!1),this.type===W.name?n.name=this.value:this.type.keyword?(n.name=this.type.keyword,"class"!==n.name&&"function"!==n.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop()):this.unexpected(),this.next(),this.finishNode(n,"Identifier"),t||this.checkUnreserved(n),n},ft.parseYield=function(){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type==W.semi||this.canInsertSemicolon()||this.type!=W.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(W.star),t.argument=this.parseMaybeAssign()),this.finishNode(t,"YieldExpression")},ft.parseAwait=function(){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0),this.finishNode(t,"AwaitExpression")};var gt=st.prototype;gt.raise=function(t,e){var n=u(this.input,t);e+=" ("+n.line+":"+n.column+")";var r=new SyntaxError(e);throw r.pos=t,r.loc=n,r.raisedAt=this.pos,r},gt.raiseRecoverable=gt.raise,gt.curPosition=function(){if(this.options.locations)return new et(this.curLine,this.pos-this.lineStart)};var mt=st.prototype,yt=Object.assign||function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];for(var r=0,i=e;r<i.length;r+=1){var s=i[r];for(var a in s)o(s,a)&&(t[a]=s[a])}return t};mt.enterFunctionScope=function(){this.scopeStack.push({"var":{},lexical:{},childVar:{},parentLexical:{}})},mt.exitFunctionScope=function(){this.scopeStack.pop()},mt.enterLexicalScope=function(){var t=this.scopeStack[this.scopeStack.length-1],e={"var":{},lexical:{},childVar:{},parentLexical:{}};this.scopeStack.push(e),yt(e.parentLexical,t.lexical,t.parentLexical)},mt.exitLexicalScope=function(){var t=this.scopeStack.pop(),e=this.scopeStack[this.scopeStack.length-1];yt(e.childVar,t["var"],t.childVar)},mt.canDeclareVarName=function(t){var e=this.scopeStack[this.scopeStack.length-1];return!o(e.lexical,t)&&!o(e.parentLexical,t)},mt.canDeclareLexicalName=function(t){var e=this.scopeStack[this.scopeStack.length-1];return!o(e.lexical,t)&&!o(e["var"],t)&&!o(e.childVar,t)},mt.declareVarName=function(t){this.scopeStack[this.scopeStack.length-1]["var"][t]=!0},mt.declareLexicalName=function(t){this.scopeStack[this.scopeStack.length-1].lexical[t]=!0};var xt=function(t,e,n){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new nt(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},vt=st.prototype;vt.startNode=function(){return new xt(this,this.start,this.startLoc)},vt.startNodeAt=function(t,e){return new xt(this,t,e)},vt.finishNode=function(t,e){return f.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},vt.finishNodeAt=function(t,e,n,r){return f.call(this,t,e,n,r)};var bt=function(t,e,n,r,i){this.token=t,this.isExpr=!!e,this.preserveSpace=!!n,this.override=r,this.generator=!!i},_t={b_stat:new bt("{",(!1)),b_expr:new bt("{",(!0)),b_tmpl:new bt("${",(!1)),p_stat:new bt("(",(!1)),p_expr:new bt("(",(!0)),q_tmpl:new bt("`",(!0),(!0),function(t){return t.tryReadTemplateToken()}),f_stat:new bt("function",(!1)),f_expr:new bt("function",(!0)),f_expr_gen:new bt("function",(!0),(!1),null,(!0)),f_gen:new bt("function",(!1),(!1),null,(!0))},Et=st.prototype;Et.initialContext=function(){return[_t.b_stat]},Et.braceIsBlock=function(t){var e=this.curContext();return e===_t.f_expr||e===_t.f_stat||(t!==W.colon||e!==_t.b_stat&&e!==_t.b_expr?t===W._return||t==W.name&&this.exprAllowed?H.test(this.input.slice(this.lastTokEnd,this.start)):t===W._else||t===W.semi||t===W.eof||t===W.parenR||t==W.arrow||(t==W.braceL?e===_t.b_stat:t!=W._var&&t!=W.name&&!this.exprAllowed):!e.isExpr)},Et.inGeneratorContext=function(){for(var t=this,e=this.context.length-1;e>=1;e--){var n=t.context[e];if("function"===n.token)return n.generator}return!1},Et.updateContext=function(t){var e,n=this.type;n.keyword&&t==W.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr},W.parenR.updateContext=W.braceR.updateContext=function(){if(1==this.context.length)return void(this.exprAllowed=!0);var t=this.context.pop();t===_t.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr},W.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?_t.b_stat:_t.b_expr),this.exprAllowed=!0},W.dollarBraceL.updateContext=function(){this.context.push(_t.b_tmpl),this.exprAllowed=!0},W.parenL.updateContext=function(t){var e=t===W._if||t===W._for||t===W._with||t===W._while;this.context.push(e?_t.p_stat:_t.p_expr),this.exprAllowed=!0},W.incDec.updateContext=function(){},W._function.updateContext=W._class.updateContext=function(t){t.beforeExpr&&t!==W.semi&&t!==W._else&&(t!==W.colon&&t!==W.braceL||this.curContext()!==_t.b_stat)?this.context.push(_t.f_expr):this.context.push(_t.f_stat),this.exprAllowed=!1},W.backQuote.updateContext=function(){this.curContext()===_t.q_tmpl?this.context.pop():this.context.push(_t.q_tmpl),this.exprAllowed=!1},W.star.updateContext=function(t){if(t==W._function){var e=this.context.length-1;this.context[e]===_t.f_expr?this.context[e]=_t.f_expr_gen:this.context[e]=_t.f_gen}this.exprAllowed=!0},W.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&("of"==this.value&&!this.exprAllowed||"yield"==this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Tt={$LONE:["ASCII","ASCII_Hex_Digit","AHex","Alphabetic","Alpha","Any","Assigned","Bidi_Control","Bidi_C","Bidi_Mirrored","Bidi_M","Case_Ignorable","CI","Cased","Changes_When_Casefolded","CWCF","Changes_When_Casemapped","CWCM","Changes_When_Lowercased","CWL","Changes_When_NFKC_Casefolded","CWKCF","Changes_When_Titlecased","CWT","Changes_When_Uppercased","CWU","Dash","Default_Ignorable_Code_Point","DI","Deprecated","Dep","Diacritic","Dia","Emoji","Emoji_Component","Emoji_Modifier","Emoji_Modifier_Base","Emoji_Presentation","Extender","Ext","Grapheme_Base","Gr_Base","Grapheme_Extend","Gr_Ext","Hex_Digit","Hex","IDS_Binary_Operator","IDSB","IDS_Trinary_Operator","IDST","ID_Continue","IDC","ID_Start","IDS","Ideographic","Ideo","Join_Control","Join_C","Logical_Order_Exception","LOE","Lowercase","Lower","Math","Noncharacter_Code_Point","NChar","Pattern_Syntax","Pat_Syn","Pattern_White_Space","Pat_WS","Quotation_Mark","QMark","Radical","Regional_Indicator","RI","Sentence_Terminal","STerm","Soft_Dotted","SD","Terminal_Punctuation","Term","Unified_Ideograph","UIdeo","Uppercase","Upper","Variation_Selector","VS","White_Space","space","XID_Continue","XIDC","XID_Start","XIDS"],General_Category:["Cased_Letter","LC","Close_Punctuation","Pe","Connector_Punctuation","Pc","Control","Cc","cntrl","Currency_Symbol","Sc","Dash_Punctuation","Pd","Decimal_Number","Nd","digit","Enclosing_Mark","Me","Final_Punctuation","Pf","Format","Cf","Initial_Punctuation","Pi","Letter","L","Letter_Number","Nl","Line_Separator","Zl","Lowercase_Letter","Ll","Mark","M","Combining_Mark","Math_Symbol","Sm","Modifier_Letter","Lm","Modifier_Symbol","Sk","Nonspacing_Mark","Mn","Number","N","Open_Punctuation","Ps","Other","C","Other_Letter","Lo","Other_Number","No","Other_Punctuation","Po","Other_Symbol","So","Paragraph_Separator","Zp","Private_Use","Co","Punctuation","P","punct","Separator","Z","Space_Separator","Zs","Spacing_Mark","Mc","Surrogate","Cs","Symbol","S","Titlecase_Letter","Lt","Unassigned","Cn","Uppercase_Letter","Lu"],Script:["Adlam","Adlm","Ahom","Anatolian_Hieroglyphs","Hluw","Arabic","Arab","Armenian","Armn","Avestan","Avst","Balinese","Bali","Bamum","Bamu","Bassa_Vah","Bass","Batak","Batk","Bengali","Beng","Bhaiksuki","Bhks","Bopomofo","Bopo","Brahmi","Brah","Braille","Brai","Buginese","Bugi","Buhid","Buhd","Canadian_Aboriginal","Cans","Carian","Cari","Caucasian_Albanian","Aghb","Chakma","Cakm","Cham","Cherokee","Cher","Common","Zyyy","Coptic","Copt","Qaac","Cuneiform","Xsux","Cypriot","Cprt","Cyrillic","Cyrl","Deseret","Dsrt","Devanagari","Deva","Duployan","Dupl","Egyptian_Hieroglyphs","Egyp","Elbasan","Elba","Ethiopic","Ethi","Georgian","Geor","Glagolitic","Glag","Gothic","Goth","Grantha","Gran","Greek","Grek","Gujarati","Gujr","Gurmukhi","Guru","Han","Hani","Hangul","Hang","Hanunoo","Hano","Hatran","Hatr","Hebrew","Hebr","Hiragana","Hira","Imperial_Aramaic","Armi","Inherited","Zinh","Qaai","Inscriptional_Pahlavi","Phli","Inscriptional_Parthian","Prti","Javanese","Java","Kaithi","Kthi","Kannada","Knda","Katakana","Kana","Kayah_Li","Kali","Kharoshthi","Khar","Khmer","Khmr","Khojki","Khoj","Khudawadi","Sind","Lao","Laoo","Latin","Latn","Lepcha","Lepc","Limbu","Limb","Linear_A","Lina","Linear_B","Linb","Lisu","Lycian","Lyci","Lydian","Lydi","Mahajani","Mahj","Malayalam","Mlym","Mandaic","Mand","Manichaean","Mani","Marchen","Marc","Masaram_Gondi","Gonm","Meetei_Mayek","Mtei","Mende_Kikakui","Mend","Meroitic_Cursive","Merc","Meroitic_Hieroglyphs","Mero","Miao","Plrd","Modi","Mongolian","Mong","Mro","Mroo","Multani","Mult","Myanmar","Mymr","Nabataean","Nbat","New_Tai_Lue","Talu","Newa","Nko","Nkoo","Nushu","Nshu","Ogham","Ogam","Ol_Chiki","Olck","Old_Hungarian","Hung","Old_Italic","Ital","Old_North_Arabian","Narb","Old_Permic","Perm","Old_Persian","Xpeo","Old_South_Arabian","Sarb","Old_Turkic","Orkh","Oriya","Orya","Osage","Osge","Osmanya","Osma","Pahawh_Hmong","Hmng","Palmyrene","Palm","Pau_Cin_Hau","Pauc","Phags_Pa","Phag","Phoenician","Phnx","Psalter_Pahlavi","Phlp","Rejang","Rjng","Runic","Runr","Samaritan","Samr","Saurashtra","Saur","Sharada","Shrd","Shavian","Shaw","Siddham","Sidd","SignWriting","Sgnw","Sinhala","Sinh","Sora_Sompeng","Sora","Soyombo","Soyo","Sundanese","Sund","Syloti_Nagri","Sylo","Syriac","Syrc","Tagalog","Tglg","Tagbanwa","Tagb","Tai_Le","Tale","Tai_Tham","Lana","Tai_Viet","Tavt","Takri","Takr","Tamil","Taml","Tangut","Tang","Telugu","Telu","Thaana","Thaa","Thai","Tibetan","Tibt","Tifinagh","Tfng","Tirhuta","Tirh","Ugaritic","Ugar","Vai","Vaii","Warang_Citi","Wara","Yi","Yiii","Zanabazar_Square","Zanb"]};Array.prototype.push.apply(Tt.$LONE,Tt.General_Category),Tt.gc=Tt.General_Category,Tt.sc=Tt.Script_Extensions=Tt.scx=Tt.Script;var St=st.prototype,kt=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":""),this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};kt.prototype.reset=function(t,e,n){var r=n.indexOf("u")!==-1;this.start=0|t,this.source=e+"",this.flags=n,this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchN=r&&this.parser.options.ecmaVersion>=9},kt.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},kt.prototype.at=function(t){var e=this.source,n=e.length;if(t>=n)return-1;var r=e.charCodeAt(t);return!this.switchU||r<=55295||r>=57344||t+1>=n?r:(r<<10)+e.charCodeAt(t+1)-56613888},kt.prototype.nextIndex=function(t){var e=this.source,n=e.length;if(t>=n)return n;var r=e.charCodeAt(t);return!this.switchU||r<=55295||r>=57344||t+1>=n?t+1:t+2},kt.prototype.current=function(){return this.at(this.pos)},kt.prototype.lookahead=function(){return this.at(this.nextIndex(this.pos))},kt.prototype.advance=function(){this.pos=this.nextIndex(this.pos);
  },kt.prototype.eat=function(t){return this.current()===t&&(this.advance(),!0)},St.validateRegExpFlags=function(t){for(var e=this,n=t.validFlags,r=t.flags,i=0;i<r.length;i++){var s=r.charAt(i);n.indexOf(s)==-1&&e.raise(t.start,"Invalid regular expression flag"),r.indexOf(s,i+1)>-1&&e.raise(t.start,"Duplicate regular expression flag")}},St.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&t.groupNames.length>0&&(t.switchN=!0,this.regexp_pattern(t))},St.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames.length=0,t.backReferenceNames.length=0,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,n=t.backReferenceNames;e<n.length;e+=1){var r=n[e];t.groupNames.indexOf(r)===-1&&t.raise("Invalid named capture referenced")}},St.regexp_disjunction=function(t){var e=this;for(this.regexp_alternative(t);t.eat(124);)e.regexp_alternative(t);this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},St.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},St.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!(t.switchU?!this.regexp_eatAtom(t):!this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},St.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!n,!0}return t.pos=e,!1},St.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},St.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},St.regexp_eatBracedQuantifier=function(t,e){var n=t.pos;if(t.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue),t.eat(125)))return i!==-1&&i<r&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=n}return!1},St.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},St.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},St.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)&&t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}t.pos=e}return!1},St.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},St.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},St.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},St.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!g(e)&&(t.lastIntValue=e,t.advance(),!0)},St.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;(n=t.current())!==-1&&!g(n);)t.advance();return t.pos!==e},St.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(e===-1||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e)&&(t.advance(),!0)},St.regexp_groupSpecifier=function(t){if(t.eat(63)){if(this.regexp_eatGroupName(t))return t.groupNames.indexOf(t.lastStringValue)!==-1&&t.raise("Duplicate capture group name"),void t.groupNames.push(t.lastStringValue);t.raise("Invalid group")}},St.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},St.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=d(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=d(t.lastIntValue);return!0}return!1},St.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,n=t.current();return t.advance(),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(t)&&(n=t.lastIntValue),m(n)?(t.lastIntValue=n,!0):(t.pos=e,!1)},St.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,n=t.current();return t.advance(),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(t)&&(n=t.lastIntValue),y(n)?(t.lastIntValue=n,!0):(t.pos=e,!1)},St.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},St.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var n=t.lastIntValue;if(t.switchU)return n>t.maxBackReference&&(t.maxBackReference=n),!0;if(n<=t.numCapturingParens)return!0;t.pos=e}return!1},St.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},St.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},St.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},St.regexp_eatZero=function(t){return 48===t.current()&&!T(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},St.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},St.regexp_eatControlLetter=function(t){var e=t.current();return!!x(e)&&(t.lastIntValue=e%32,t.advance(),!0)},St.regexp_eatRegExpUnicodeEscapeSequence=function(t){var e=t.pos;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var n=t.lastIntValue;if(t.switchU&&n>=55296&&n<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var i=t.lastIntValue;if(i>=56320&&i<=57343)return t.lastIntValue=1024*(n-55296)+(i-56320)+65536,!0}t.pos=r,t.lastIntValue=n}return!0}if(t.switchU&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&v(t.lastIntValue))return!0;t.switchU&&t.raise("Invalid unicode escape"),t.pos=e}return!1},St.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},St.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1},St.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(b(e))return t.lastIntValue=-1,t.advance(),!0;if(t.switchU&&this.options.ecmaVersion>=9&&(80===e||112===e)){if(t.lastIntValue=-1,t.advance(),t.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(t)&&t.eat(125))return!0;t.raise("Invalid property name")}return!1},St.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var n=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,n,r),!0}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,i),!0}return!1},St.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){Tt.hasOwnProperty(e)&&Tt[e].indexOf(n)!==-1||t.raise("Invalid property name")},St.regexp_validateUnicodePropertyNameOrValue=function(t,e){Tt.$LONE.indexOf(e)===-1&&t.raise("Invalid property name")},St.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";_(e=t.current());)t.lastStringValue+=d(e),t.advance();return""!==t.lastStringValue},St.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";E(e=t.current());)t.lastStringValue+=d(e),t.advance();return""!==t.lastStringValue},St.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},St.regexp_eatCharacterClass=function(t){if(t.eat(91)){if(t.eat(94),this.regexp_classRanges(t),t.eat(93))return!0;t.raise("Unterminated character class")}return!1},St.regexp_classRanges=function(t){for(var e=this;this.regexp_eatClassAtom(t);){var n=t.lastIntValue;if(t.eat(45)&&e.regexp_eatClassAtom(t)){var r=t.lastIntValue;!t.switchU||n!==-1&&r!==-1||t.raise("Invalid character class"),n!==-1&&r!==-1&&n>r&&t.raise("Range out of order in character class")}}},St.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var n=t.current();(99===n||w(n))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var r=t.current();return 93!==r&&(t.lastIntValue=r,t.advance(),!0)},St.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},St.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!T(e)&&95!==e)&&(t.lastIntValue=e%32,t.advance(),!0)},St.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},St.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;T(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e},St.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;S(n=t.current());)t.lastIntValue=16*t.lastIntValue+k(n),t.advance();return t.pos!==e},St.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var n=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*n+t.lastIntValue:t.lastIntValue=8*e+n}else t.lastIntValue=e;return!0}return!1},St.regexp_eatOctalDigit=function(t){var e=t.current();return w(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},St.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var r=0;r<e;++r){var i=t.current();if(!S(i))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+k(i),t.advance()}return!0};var wt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new nt(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},At=st.prototype;At.next=function(){this.options.onToken&&this.options.onToken(new wt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},At.getToken=function(){return this.next(),new wt(this)},"undefined"!=typeof Symbol&&(At[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===W.eof,value:e}}}}),At.curContext=function(){return this.context[this.context.length-1]},At.nextToken=function(){var t=this.curContext();return t&&t.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(W.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},At.readToken=function(t){return n(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},At.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=57344)return t;var e=this.input.charCodeAt(this.pos+1);return(t<<10)+e-56613888},At.skipBlockComment=function(){var t=this,e=this.options.onComment&&this.curPosition(),n=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(r===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations){q.lastIndex=n;for(var i;(i=q.exec(this.input))&&i.index<this.pos;)++t.curLine,t.lineStart=i.index+i[0].length}this.options.onComment&&this.options.onComment(!0,this.input.slice(n+2,r),n,this.pos,e,this.curPosition())},At.skipLineComment=function(t){for(var e=this,n=this.pos,r=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!a(i);)i=e.input.charCodeAt(++e.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(n+t,this.pos),n,this.pos,r,this.curPosition())},At.skipSpace=function(){var t=this;t:for(;this.pos<this.input.length;){var e=t.input.charCodeAt(t.pos);switch(e){case 32:case 160:++t.pos;break;case 13:10===t.input.charCodeAt(t.pos+1)&&++t.pos;case 10:case 8232:case 8233:++t.pos,t.options.locations&&(++t.curLine,t.lineStart=t.pos);break;case 47:switch(t.input.charCodeAt(t.pos+1)){case 42:t.skipBlockComment();break;case 47:t.skipLineComment(2);break;default:break t}break;default:if(!(e>8&&e<14||e>=5760&&Y.test(String.fromCharCode(e))))break t;++t.pos}}},At.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=t,this.value=e,this.updateContext(n)},At.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken(W.ellipsis)):(++this.pos,this.finishToken(W.dot))},At.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp(W.assign,2):this.finishOp(W.slash,1)},At.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,r=42===t?W.star:W.modulo;return this.options.ecmaVersion>=7&&42==t&&42===e&&(++n,r=W.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp(W.assign,n+1):this.finishOp(r,n)},At.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?this.finishOp(124===t?W.logicalOR:W.logicalAND,2):61===e?this.finishOp(W.assign,2):this.finishOp(124===t?W.bitwiseOR:W.bitwiseAND,1)},At.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(W.assign,2):this.finishOp(W.bitwiseXOR,1)},At.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!=e||this.inModule||62!=this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!H.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(W.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp(W.assign,2):this.finishOp(W.plusMin,1)},At.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),n=1;return e===t?(n=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(W.assign,n+1):this.finishOp(W.bitShift,n)):33!=e||60!=t||this.inModule||45!=this.input.charCodeAt(this.pos+2)||45!=this.input.charCodeAt(this.pos+3)?(61===e&&(n=2),this.finishOp(W.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},At.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(W.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(W.arrow)):this.finishOp(61===t?W.eq:W.prefix,1)},At.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(W.parenL);case 41:return++this.pos,this.finishToken(W.parenR);case 59:return++this.pos,this.finishToken(W.semi);case 44:return++this.pos,this.finishToken(W.comma);case 91:return++this.pos,this.finishToken(W.bracketL);case 93:return++this.pos,this.finishToken(W.bracketR);case 123:return++this.pos,this.finishToken(W.braceL);case 125:return++this.pos,this.finishToken(W.braceR);case 58:return++this.pos,this.finishToken(W.colon);case 63:return++this.pos,this.finishToken(W.question);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(W.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 126:return this.finishOp(W.prefix,1)}this.raise(this.pos,"Unexpected character '"+A(t)+"'")},At.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)},At.readRegexp=function(){for(var t,e,n=this,r=this.pos;;){n.pos>=n.input.length&&n.raise(r,"Unterminated regular expression");var i=n.input.charAt(n.pos);if(H.test(i)&&n.raise(r,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++n.pos}var s=this.input.slice(r,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var u=this.regexpState||(this.regexpState=new kt(this));u.reset(r,s,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var h=null;try{h=new RegExp(s,o)}catch(p){}return this.finishToken(W.regexp,{pattern:s,flags:o,value:h})},At.readInt=function(t,e){for(var n=this,r=this.pos,i=0,s=0,a=null==e?1/0:e;s<a;++s){var o=n.input.charCodeAt(n.pos),u=void 0;if(u=o>=97?o-97+10:o>=65?o-65+10:o>=48&&o<=57?o-48:1/0,u>=t)break;++n.pos,i=i*t+u}return this.pos===r||null!=e&&this.pos-r!==e?null:i},At.readRadixNumber=function(t){this.pos+=2;var e=this.readInt(t);return null==e&&this.raise(this.start+2,"Expected number in radix "+t),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(W.num,e)},At.readNumber=function(t){var e=this.pos;t||null!==this.readInt(10)||this.raise(e,"Invalid number");var r=this.pos-e>=2&&48===this.input.charCodeAt(e);r&&this.strict&&this.raise(e,"Invalid number"),r&&/[89]/.test(this.input.slice(e,this.pos))&&(r=!1);var i=this.input.charCodeAt(this.pos);46!==i||r||(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),69!==i&&101!==i||r||(i=this.input.charCodeAt(++this.pos),43!==i&&45!==i||++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=this.input.slice(e,this.pos),a=r?parseInt(s,8):parseFloat(s);return this.finishToken(W.num,a)},At.readCodePoint=function(){var t,e=this.input.charCodeAt(this.pos);if(123===e){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,"Code point out of bounds")}else t=this.readHexChar(4);return t},At.readString=function(t){for(var e=this,n="",r=++this.pos;;){e.pos>=e.input.length&&e.raise(e.start,"Unterminated string constant");var i=e.input.charCodeAt(e.pos);if(i===t)break;92===i?(n+=e.input.slice(r,e.pos),n+=e.readEscapedChar(!1),r=e.pos):(a(i)&&e.raise(e.start,"Unterminated string constant"),++e.pos)}return n+=this.input.slice(r,this.pos++),this.finishToken(W.string,n)};var Ot={};At.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==Ot)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},At.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ot;this.raise(t,e)},At.readTmplToken=function(){for(var t=this,e="",n=this.pos;;){t.pos>=t.input.length&&t.raise(t.start,"Unterminated template");var r=t.input.charCodeAt(t.pos);if(96===r||36===r&&123===t.input.charCodeAt(t.pos+1))return t.pos!==t.start||t.type!==W.template&&t.type!==W.invalidTemplate?(e+=t.input.slice(n,t.pos),t.finishToken(W.template,e)):36===r?(t.pos+=2,t.finishToken(W.dollarBraceL)):(++t.pos,t.finishToken(W.backQuote));if(92===r)e+=t.input.slice(n,t.pos),e+=t.readEscapedChar(!0),n=t.pos;else if(a(r)){switch(e+=t.input.slice(n,t.pos),++t.pos,r){case 13:10===t.input.charCodeAt(t.pos)&&++t.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}t.options.locations&&(++t.curLine,t.lineStart=t.pos),n=t.pos}else++t.pos}},At.readInvalidTemplateToken=function(){for(var t=this;this.pos<this.input.length;this.pos++)switch(t.input[t.pos]){case"\\":++t.pos;break;case"$":if("{"!==t.input[t.pos+1])break;case"`":return t.finishToken(W.invalidTemplate,t.input.slice(t.start,t.pos))}this.raise(this.start,"Unterminated template")},At.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return A(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\x0B";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";default:if(e>=48&&e<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(n,8);return r>255&&(n=n.slice(0,-1),r=parseInt(n,8)),this.pos+=n.length-1,e=this.input.charCodeAt(this.pos),"0"===n&&56!=e&&57!=e||!this.strict&&!t||this.invalidStringToken(this.pos-1-n.length,"Octal literal in strict mode"),String.fromCharCode(r)}return String.fromCharCode(e)}},At.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return null===n&&this.invalidStringToken(e,"Bad character escape sequence"),n},At.readWord1=function(){var t=this;this.containsEsc=!1;for(var e="",i=!0,s=this.pos,a=this.options.ecmaVersion>=6;this.pos<this.input.length;){var o=t.fullCharCodeAtPos();if(r(o,a))t.pos+=o<=65535?1:2;else{if(92!==o)break;t.containsEsc=!0,e+=t.input.slice(s,t.pos);var u=t.pos;117!=t.input.charCodeAt(++t.pos)&&t.invalidStringToken(t.pos,"Expecting Unicode escape sequence \\uXXXX"),++t.pos;var h=t.readCodePoint();(i?n:r)(h,a)||t.invalidStringToken(u,"Invalid Unicode escape"),e+=A(h),s=t.pos}i=!1}return e+this.input.slice(s,this.pos)},At.readWord=function(){var t=this.readWord1(),e=W.name;return this.keywords.test(t)&&(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+t),e=X[t]),this.finishToken(e,t)};var Ct="5.5.0";t.version=Ct,t.parse=O,t.parseExpressionAt=C,t.tokenizer=R,t.addLooseExports=P,t.Parser=st,t.plugins=it,t.defaultOptions=rt,t.Position=et,t.SourceLocation=nt,t.getLineInfo=u,t.Node=xt,t.TokenType=B,t.tokTypes=W,t.keywordTypes=X,t.TokContext=bt,t.tokContexts=_t,t.isIdentifierChar=r,t.isIdentifierStart=n,t.Token=wt,t.isNewLine=a,t.lineBreak=H,t.lineBreakG=q,t.nonASCIIwhitespace=Y,Object.defineProperty(t,"__esModule",{value:!0})})},{}]},{},[33]);