phaser4-rex-plugins
Version:
7 lines • 150 kB
JavaScript
/**
* Minified by jsDelivr using UglifyJS v3.3.20.
* Original file: /npm/js-interpreter@1.4.6/lib/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["js-interpreter"]=e():t["js-interpreter"]=e()}(this,function(){return function(i){var r={};function s(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return i[t].call(e.exports,e,e.exports,s),e.l=!0,e.exports}return s.m=i,s.c=r,s.i=function(t){return t},s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=8)}([function(t,e,i){"use strict";var u="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},l=i(1),r=i(4),f=function t(e,i){"string"==typeof e&&(e=l.parse(e,t.PARSE_OPTIONS)),this.ast=e,this.initFunc_=i,this.paused_=!1,this.polyfills_=[],this.UNDEFINED=new t.Primitive(void 0,this),this.NULL=new t.Primitive(null,this),this.NAN=new t.Primitive(NaN,this),this.TRUE=new t.Primitive(!0,this),this.FALSE=new t.Primitive(!1,this),this.NUMBER_ZERO=new t.Primitive(0,this),this.NUMBER_ONE=new t.Primitive(1,this),this.STRING_EMPTY=new t.Primitive("",this),this.global=this.createScope(this.ast,null),this.NAN.parent=this.NUMBER,this.TRUE.parent=this.BOOLEAN,this.FALSE.parent=this.BOOLEAN,this.NUMBER_ZERO.parent=this.NUMBER,this.NUMBER_ONE.parent=this.NUMBER,this.STRING_EMPTY.parent=this.STRING,this.ast=l.parse(this.polyfills_.join("\n"),t.PARSE_OPTIONS),this.polyfills_=void 0,this.stripLocations_(this.ast,void 0,void 0),this.stateStack=[{node:this.ast,scope:this.global,thisExpression:this.global,done:!1}],this.run(),this.value=this.UNDEFINED,this.ast=e,this.stateStack=[{node:this.ast,scope:this.global,thisExpression:this.global,done:!1}]};f.PARSE_OPTIONS={ecmaVersion:5},f.READONLY_DESCRIPTOR={configurable:!0,enumerable:!0,writable:!1},f.NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!0},f.READONLY_NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!1},f.prototype.appendCode=function(t){var e=this.stateStack[0];if(!e||"Program"!=e.node.type)throw Error("Expecting original AST to start with a Program node.");if("string"==typeof t&&(t=l.parse(t,f.PARSE_OPTIONS)),!t||"Program"!=t.type)throw Error("Expecting new AST to start with a Program node.");this.populateScope_(t,e.scope);for(var i,r=0;i=t.body[r];r++)e.node.body.push(i);e.done=!1},f.prototype.step=function(){var t=this.stateStack[this.stateStack.length-1];return!(!t||"Program"==t.node.type&&t.done)&&(!!this.paused_||(this["step"+t.node.type](),!!t.node.end||this.step()))},f.prototype.run=function(){for(;!this.paused_&&this.step(););return this.paused_},f.prototype.initGlobalScope=function(t){this.setProperty(t,"Infinity",this.createPrimitive(1/0),f.READONLY_DESCRIPTOR),this.setProperty(t,"NaN",this.NAN,f.READONLY_DESCRIPTOR),this.setProperty(t,"undefined",this.UNDEFINED,f.READONLY_DESCRIPTOR),this.setProperty(t,"window",t,f.READONLY_DESCRIPTOR),this.setProperty(t,"self",t),this.initFunction(t),this.initObject(t),t.parent=this.OBJECT,this.initArray(t),this.initNumber(t),this.initString(t),this.initBoolean(t),this.initDate(t),this.initMath(t),this.initRegExp(t),this.initJSON(t),this.initError(t);var e,i=this;e=function(t){return t=t||i.UNDEFINED,i.createPrimitive(isNaN(t.toNumber()))},this.setProperty(t,"isNaN",this.createNativeFunction(e)),e=function(t){return t=t||i.UNDEFINED,i.createPrimitive(isFinite(t.toNumber()))},this.setProperty(t,"isFinite",this.createNativeFunction(e)),this.setProperty(t,"parseFloat",this.getProperty(this.NUMBER,"parseFloat")),this.setProperty(t,"parseInt",this.getProperty(this.NUMBER,"parseInt"));var r=this.createObject(this.FUNCTION);r.eval=!0,this.setProperty(r,"length",this.NUMBER_ONE,f.READONLY_DESCRIPTOR),this.setProperty(t,"eval",r);for(var s=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]],n=0;n<s.length;n++)e=function(e){return function(t){t=(t||i.UNDEFINED).toString();try{t=e(t)}catch(t){i.throwException(i.URI_ERROR,t.message)}return i.createPrimitive(t)}}(s[n][0]),this.setProperty(t,s[n][1],this.createNativeFunction(e));this.initFunc_&&this.initFunc_(this,t)},f.prototype.initFunction=function(t){var e,a=this,h=/^[A-Za-z_$][\w$]*$/;e=function(t){if(this.parent==a.FUNCTION)var e=this;else e=a.createObject(a.FUNCTION);if(arguments.length)var i=arguments[arguments.length-1].toString();else i="";for(var r=[],s=0;s<arguments.length-1;s++){var n=arguments[s].toString();if(!n.match(h))return void a.throwException(a.SYNTAX_ERROR,"Invalid function argument: "+n);r.push(n)}r=r.join(", "),e.parentScope=a.stateStack[0].scope;var o=l.parse("$ = function("+r+") {"+i+"};",f.PARSE_OPTIONS);if(1==o.body.length)return e.node=o.body[0].expression.right,a.setProperty(e,"length",a.createPrimitive(e.node.length),f.READONLY_DESCRIPTOR),e;a.throwException(a.SYNTAX_ERROR,"Invalid code in function body.")},this.FUNCTION=this.createObject(null),this.setProperty(t,"Function",this.FUNCTION),this.FUNCTION.type="function",this.setProperty(this.FUNCTION,"prototype",this.createObject(null)),this.FUNCTION.nativeFunc=e;var s=function(t){if(t.isPrimitive&&!a.getScope().strict)if(t==a.UNDEFINED||t==a.NULL)t=a.global;else{var e=a.createObject(t.parent);e.data=t.data,t=e}return t};e=function(t,e){var i=a.stateStack[a.stateStack.length-1];if(i.func_=this,i.funcThis_=s(t),i.arguments_=[],e)if(a.isa(e,a.ARRAY))for(var r=0;r<e.length;r++)i.arguments_[r]=a.getProperty(e,r);else a.throwException(a.TYPE_ERROR,"CreateListFromArrayLike called on non-object");i.doneArgs_=!0,i.doneExec_=!1},this.setNativeFunctionPrototype(this.FUNCTION,"apply",e),e=function(t,e){var i=a.stateStack[a.stateStack.length-1];i.func_=this,i.funcThis_=s(t),i.arguments_=[];for(var r=1;r<arguments.length;r++)i.arguments_.push(arguments[r]);i.doneArgs_=!0,i.doneExec_=!1},this.setNativeFunctionPrototype(this.FUNCTION,"call",e),this.polyfills_.push("Object.defineProperty(Function.prototype, 'bind', {configurable: true, value:","function(oThis) {","if (typeof this !== 'function') {","throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');","}","var aArgs = Array.prototype.slice.call(arguments, 1),","fToBind = this,","fNOP = function() {},","fBound = function() {","return fToBind.apply(this instanceof fNOP","? this",": oThis,","aArgs.concat(Array.prototype.slice.call(arguments)));","};","if (this.prototype) {","fNOP.prototype = this.prototype;","}","fBound.prototype = new fNOP();","return fBound;","}","});",""),e=function(){return a.createPrimitive(this.toString())},this.setNativeFunctionPrototype(this.FUNCTION,"toString",e),this.setProperty(this.FUNCTION,"toString",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(){return a.createPrimitive(this.valueOf())},this.setNativeFunctionPrototype(this.FUNCTION,"valueOf",e),this.setProperty(this.FUNCTION,"valueOf",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR)},f.prototype.initObject=function(t){var e,h=this;e=function(t){if(!t||t==h.UNDEFINED||t==h.NULL)return this.parent==h.OBJECT?this:h.createObject(h.OBJECT);if(t.isPrimitive){var e=h.createObject(t.parent);return e.data=t.data,e}return t},this.OBJECT=this.createNativeFunction(e),this.setProperty(t,"Object",this.OBJECT),e=function(t){var e=h.createObject(h.ARRAY),i=0;for(var r in t.properties)h.setProperty(e,i,h.createPrimitive(r)),i++;return e},this.setProperty(this.OBJECT,"getOwnPropertyNames",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(t){var e=h.createObject(h.ARRAY),i=0;for(var r in t.properties)t.notEnumerable[r]||(h.setProperty(e,i,h.createPrimitive(r)),i++);return e},this.setProperty(this.OBJECT,"keys",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(t,e,i){if(e=(e||h.UNDEFINED).toString(),i instanceof f.Object){if(t.properties[e]||!t.preventExtensions){var r=h.getProperty(i,"value");r==h.UNDEFINED&&(r=null);var s=h.getProperty(i,"get"),n=h.getProperty(i,"set"),o={configurable:h.pseudoToNative(h.getProperty(i,"configurable")),enumerable:h.pseudoToNative(h.getProperty(i,"enumerable")),writable:h.pseudoToNative(h.getProperty(i,"writable")),get:s==h.UNDEFINED?void 0:s,set:n==h.UNDEFINED?void 0:n};return h.setProperty(t,e,r,o),t}h.throwException(h.TYPE_ERROR,"Can't define property "+e+", object is not extensible")}else h.throwException(h.TYPE_ERROR,"Property description must be an object.")},this.setProperty(this.OBJECT,"defineProperty",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),this.polyfills_.push("Object.defineProperty(Object.prototype, 'defineProperties', {configurable: true, value:","function(obj, props) {","var keys = Object.keys(props);","for (var i = 0; i < keys.length; i++) {","Object.defineProperty(obj, keys[i], props[keys[i]]);","}","return obj;","}","});",""),e=function(t,e){if(!((e=(e||h.UNDEFINED).toString())in t.properties))return h.UNDEFINED;var i=!t.notConfigurable[e],r=!t.notEnumerable[e],s=!t.notWritable[e],n=t.getter[e],o=t.setter[e],a=h.createObject(h.OBJECT);return h.setProperty(a,"configurable",h.createPrimitive(i)),h.setProperty(a,"enumerable",h.createPrimitive(r)),n||o?(h.setProperty(a,"getter",n),h.setProperty(a,"setter",o)):(h.setProperty(a,"writable",h.createPrimitive(s)),h.setProperty(a,"value",h.getProperty(t,e))),a},this.setProperty(this.OBJECT,"getOwnPropertyDescriptor",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(t){return t.parent&&t.parent.properties&&t.parent.properties.prototype?t.parent.properties.prototype:h.NULL},this.setProperty(this.OBJECT,"getPrototypeOf",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(t){return h.createPrimitive(!t.preventExtensions)},this.setProperty(this.OBJECT,"isExtensible",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(t){return t.isPrimitive||(t.preventExtensions=!0),t},this.setProperty(this.OBJECT,"preventExtensions",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(){return h.createPrimitive(this.toString())},this.setNativeFunctionPrototype(this.OBJECT,"toString",e),e=function(){return h.createPrimitive(this.toString())},this.setNativeFunctionPrototype(this.OBJECT,"toLocaleString",e),e=function(){return h.createPrimitive(this.valueOf())},this.setNativeFunctionPrototype(this.OBJECT,"valueOf",e),e=function(t){if(this!=h.NULL&&this!=h.UNDEFINED)return(t=(t||h.UNDEFINED).toString())in this.properties?h.TRUE:h.FALSE;h.throwException(h.TYPE_ERROR,"Cannot convert undefined or null to object")},this.setNativeFunctionPrototype(this.OBJECT,"hasOwnProperty",e),e=function(t){var e=(t=(t||h.UNDEFINED).toString())in this.properties&&!this.notEnumerable[t];return h.createPrimitive(e)},this.setNativeFunctionPrototype(this.OBJECT,"propertyIsEnumerable",e),e=function(t){for(;;){if(!(t.parent&&t.parent.properties&&t.parent.properties.prototype))return h.createPrimitive(!1);if((t=t.parent.properties.prototype)==this)return h.createPrimitive(!0)}},this.setNativeFunctionPrototype(this.OBJECT,"isPrototypeOf",e)},f.prototype.initArray=function(t){var e,h=this,p=function(t,e){var i=t?Math.floor(t.toNumber()):e;return isNaN(i)&&(i=e),i},n=function(t,e){return t.isPrimitive&&e.isPrimitive?t.data===e.data:t===e};e=function(t){if(this.parent==h.ARRAY)var e=this;else e=h.createObject(h.ARRAY);var i=t;if(1==arguments.length&&"number"==i.type)isNaN(h.arrayIndex(i))&&h.throwException(h.RANGE_ERROR,"Invalid array length"),e.length=i.data;else{for(var r=0;r<arguments.length;r++)e.properties[r]=arguments[r];e.length=r}return e},this.ARRAY=this.createNativeFunction(e),this.setProperty(t,"Array",this.ARRAY),e=function(t){return h.createPrimitive(h.isa(t,h.ARRAY))},this.setProperty(this.ARRAY,"isArray",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(){if(this.length){var t=this.properties[this.length-1];delete this.properties[this.length-1],this.length--}else t=h.UNDEFINED;return t},this.setNativeFunctionPrototype(this.ARRAY,"pop",e),e=function(t){for(var e=0;e<arguments.length;e++)this.properties[this.length]=arguments[e],this.length++;return h.createPrimitive(this.length)},this.setNativeFunctionPrototype(this.ARRAY,"push",e),e=function(){if(this.length){for(var t=this.properties[0],e=1;e<this.length;e++)this.properties[e-1]=this.properties[e];this.length--,delete this.properties[this.length]}else t=h.UNDEFINED;return t},this.setNativeFunctionPrototype(this.ARRAY,"shift",e),e=function(t){for(var e=this.length-1;0<=e;e--)this.properties[e+arguments.length]=this.properties[e];this.length+=arguments.length;for(e=0;e<arguments.length;e++)this.properties[e]=arguments[e];return h.createPrimitive(this.length)},this.setNativeFunctionPrototype(this.ARRAY,"unshift",e),e=function(){for(var t=0;t<this.length/2;t++){var e=this.properties[this.length-t-1];this.properties[this.length-t-1]=this.properties[t],this.properties[t]=e}return this},this.setNativeFunctionPrototype(this.ARRAY,"reverse",e),e=function(t,e,i){t=(t=p(t,0))<0?Math.max(this.length+t,0):Math.min(t,this.length),e=p(e,1/0),e=Math.min(e,this.length-t);for(var r=h.createObject(h.ARRAY),s=t;s<t+e;s++)r.properties[r.length++]=this.properties[s],this.properties[s]=this.properties[s+e];for(s=t+e;s<this.length-e;s++)this.properties[s]=this.properties[s+e];for(s=this.length-e;s<this.length;s++)delete this.properties[s];this.length-=e;for(s=this.length-1;t<=s;s--)this.properties[s+arguments.length-2]=this.properties[s];this.length+=arguments.length-2;for(s=2;s<arguments.length;s++)this.properties[t+s-2]=arguments[s];return r},this.setNativeFunctionPrototype(this.ARRAY,"splice",e),e=function(t,e){var i=h.createObject(h.ARRAY),r=p(t,0);r<0&&(r=this.length+r),r=Math.max(0,Math.min(r,this.length));var s=p(e,this.length);s<0&&(s=this.length+s),s=Math.max(0,Math.min(s,this.length));for(var n=0,o=r;o<s;o++){var a=h.getProperty(this,o);h.setProperty(i,n++,a)}return i},this.setNativeFunctionPrototype(this.ARRAY,"slice",e),e=function(t){if(t&&void 0!==t.data)e=t.toString();else var e=void 0;for(var i=[],r=0;r<this.length;r++)i[r]=this.properties[r];return h.createPrimitive(i.join(e))},this.setNativeFunctionPrototype(this.ARRAY,"join",e),e=function(t){for(var e=h.createObject(h.ARRAY),i=0,r=0;r<this.length;r++){var s=h.getProperty(this,r);h.setProperty(e,i++,s)}for(r=0;r<arguments.length;r++){var n=arguments[r];if(h.isa(n,h.ARRAY))for(var o=0;o<n.length;o++){s=h.getProperty(n,o);h.setProperty(e,i++,s)}else h.setProperty(e,i++,n)}return e},this.setNativeFunctionPrototype(this.ARRAY,"concat",e),e=function(t,e){t=t||h.UNDEFINED;var i=p(e,0);i<0&&(i=this.length+i);for(var r=i=Math.max(0,i);r<this.length;r++){var s=h.getProperty(this,r);if(n(s,t))return h.createPrimitive(r)}return h.createPrimitive(-1)},this.setNativeFunctionPrototype(this.ARRAY,"indexOf",e),e=function(t,e){t=t||h.UNDEFINED;var i=p(e,this.length);i<0&&(i=this.length+i);for(var r=i=Math.min(i,this.length-1);0<=r;r--){var s=h.getProperty(this,r);if(n(s,t))return h.createPrimitive(r)}return h.createPrimitive(-1)},this.setNativeFunctionPrototype(this.ARRAY,"lastIndexOf",e),this.polyfills_.push("Object.defineProperty(Array.prototype, 'every', {configurable: true, value:","function(callbackfn, thisArg) {","if (this == null || typeof callbackfn !== 'function') throw new TypeError;","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter', {configurable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw new TypeError;","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach', {configurable: true, value:","function(callback, thisArg) {","if (this == null || typeof callback !== 'function') throw new TypeError;","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map', {configurable: true, value:","function(callback, thisArg) {","if (this == null || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce', {configurable: true, value:","function(callback /*, initialValue*/) {","if (this == null || typeof callback !== 'function') throw new TypeError;","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length == 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw new TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight', {configurable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw new TypeError;","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw new TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some', {configurable: true, value:","function(fun/*, thisArg*/) {","if (this == null || typeof fun !== 'function') throw new TypeError;","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","Object.defineProperty(Array.prototype, 'sort', {configurable: true, value:","function(opt_comp) {","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp ?opt_comp(this[j], this[j + 1]) > 0 : this[j] > this[j + 1]) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (changes <= 1) break;","}","return this;","}","});","Object.defineProperty(Array.prototype, 'toLocaleString', {configurable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")},f.prototype.initNumber=function(t){var e,i=this;e=function(t){return t=t?t.toNumber():0,this.parent!=i.NUMBER?i.createPrimitive(t):(this.data=t,this)},this.NUMBER=this.createNativeFunction(e),this.setProperty(t,"Number",this.NUMBER);for(var r=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"],s=0;s<r.length;s++)this.setProperty(this.NUMBER,r[s],this.createPrimitive(Number[r[s]]));e=function(t){return t=t||i.UNDEFINED,i.createPrimitive(parseFloat(t.toString()))},this.setProperty(this.NUMBER,"parseFloat",this.createNativeFunction(e)),e=function(t,e){return t=t||i.UNDEFINED,e=e||i.UNDEFINED,i.createPrimitive(parseInt(t.toString(),e.toNumber()))},this.setProperty(this.NUMBER,"parseInt",this.createNativeFunction(e)),e=function(t){t=t?t.toNumber():void 0;var e=this.toNumber();return i.createPrimitive(e.toExponential(t))},this.setNativeFunctionPrototype(this.NUMBER,"toExponential",e),e=function(t){t=t?t.toNumber():void 0;var e=this.toNumber();return i.createPrimitive(e.toFixed(t))},this.setNativeFunctionPrototype(this.NUMBER,"toFixed",e),e=function(t){t=t?t.toNumber():void 0;var e=this.toNumber();return i.createPrimitive(e.toPrecision(t))},this.setNativeFunctionPrototype(this.NUMBER,"toPrecision",e),e=function(t){t=t?t.toNumber():10;var e=this.toNumber();return i.createPrimitive(e.toString(t))},this.setNativeFunctionPrototype(this.NUMBER,"toString",e),e=function(t,e){return t=t?i.pseudoToNative(t):void 0,e=e?i.pseudoToNative(e):void 0,i.createPrimitive(this.toNumber().toLocaleString(t,e))},this.setNativeFunctionPrototype(this.NUMBER,"toLocaleString",e)},f.prototype.initString=function(t){var e,o=this;e=function(t){return t=t?t.toString():"",this.parent!=o.STRING?o.createPrimitive(t):(this.data=t,this)},this.STRING=this.createNativeFunction(e),this.setProperty(t,"String",this.STRING),e=function(t){for(var e=0;e<arguments.length;e++)arguments[e]=arguments[e].toNumber();return o.createPrimitive(String.fromCharCode.apply(String,arguments))},this.setProperty(this.STRING,"fromCharCode",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR);for(var i=["toLowerCase","toUpperCase","toLocaleLowerCase","toLocaleUpperCase"],r=0;r<i.length;r++)e=function(t){return function(){return o.createPrimitive(t.apply(this))}}(String.prototype[i[r]]),this.setNativeFunctionPrototype(this.STRING,i[r],e);e=function(){var t=this.toString();return o.createPrimitive(t.replace(/^\s+|\s+$/g,""))},this.setNativeFunctionPrototype(this.STRING,"trim",e),e=function(){var t=this.toString();return o.createPrimitive(t.replace(/^\s+/g,""))},this.setNativeFunctionPrototype(this.STRING,"trimLeft",e),e=function(){var t=this.toString();return o.createPrimitive(t.replace(/\s+$/g,""))},this.setNativeFunctionPrototype(this.STRING,"trimRight",e),i=["charAt","charCodeAt","substring","slice","substr"];for(r=0;r<i.length;r++)e=function(e){return function(){for(var t=0;t<arguments.length;t++)arguments[t]=arguments[t].toNumber();return o.createPrimitive(e.apply(this,arguments))}}(String.prototype[i[r]]),this.setNativeFunctionPrototype(this.STRING,i[r],e);e=function(t,e){var i=this.toString();return t=(t||o.UNDEFINED).toString(),e=e?e.toNumber():void 0,o.createPrimitive(i.indexOf(t,e))},this.setNativeFunctionPrototype(this.STRING,"indexOf",e),e=function(t,e){var i=this.toString();return t=(t||o.UNDEFINED).toString(),e=e?e.toNumber():void 0,o.createPrimitive(i.lastIndexOf(t,e))},this.setNativeFunctionPrototype(this.STRING,"lastIndexOf",e),e=function(t,e,i){return t=(t||o.UNDEFINED).toString(),e=e?o.pseudoToNative(e):void 0,i=i?o.pseudoToNative(i):void 0,o.createPrimitive(this.toString().localeCompare(t,e,i))},this.setNativeFunctionPrototype(this.STRING,"localeCompare",e),e=function(t,e){var i=this.toString();t=t?o.isa(t,o.REGEXP)?t.data:t.toString():void 0,e=e?e.toNumber():void 0;for(var r=i.split(t,e),s=o.createObject(o.ARRAY),n=0;n<r.length;n++)o.setProperty(s,n,o.createPrimitive(r[n]));return s},this.setNativeFunctionPrototype(this.STRING,"split",e),e=function(t){for(var e=this.toString(),i=0;i<arguments.length;i++)e+=arguments[i].toString();return o.createPrimitive(e)},this.setNativeFunctionPrototype(this.STRING,"concat",e),e=function(t){var e=this.toString();t=t?t.data:void 0;var i=e.match(t);if(null===i)return o.NULL;for(var r=o.createObject(o.ARRAY),s=0;s<i.length;s++)o.setProperty(r,s,o.createPrimitive(i[s]));return r},this.setNativeFunctionPrototype(this.STRING,"match",e),e=function(t){var e=this.toString();return t=t?t.data:void 0,o.createPrimitive(e.search(t))},this.setNativeFunctionPrototype(this.STRING,"search",e),e=function(t,e){var i=this.toString();return t=(t||o.UNDEFINED).valueOf(),e=(e||o.UNDEFINED).toString(),o.createPrimitive(i.replace(t,e))},this.setNativeFunctionPrototype(this.STRING,"replace",e)},f.prototype.initBoolean=function(t){var e,i=this;e=function(t){return t=!!t&&t.toBoolean(),this.parent!=i.BOOLEAN?i.createPrimitive(t):(this.data=t,this)},this.BOOLEAN=this.createNativeFunction(e),this.setProperty(t,"Boolean",this.BOOLEAN)},f.prototype.initDate=function(t){var e,c=this;e=function(t,e,i,r,s,n,o){if(this.parent!=c.DATE)return c.createPrimitive(Date());var a=this;if(arguments.length)if(1!=arguments.length||"string"!=t.type&&!c.isa(t,c.STRING)){for(var h=[null],p=0;p<arguments.length;p++)h[p+1]=arguments[p]?arguments[p].toNumber():void 0;a.data=new(Function.prototype.bind.apply(Date,h))}else a.data=new Date(t.toString());else a.data=new Date;return a},this.DATE=this.createNativeFunction(e),this.setProperty(t,"Date",this.DATE),e=function(){return c.createPrimitive((new Date).getTime())},this.setProperty(this.DATE,"now",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(t){return t=t?t.toString():void 0,c.createPrimitive(Date.parse(t))},this.setProperty(this.DATE,"parse",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR),e=function(t,e,i,r,s,n,o){for(var a=[],h=0;h<arguments.length;h++)a[h]=arguments[h]?arguments[h].toNumber():void 0;return c.createPrimitive(Date.UTC.apply(Date,a))},this.setProperty(this.DATE,"UTC",this.createNativeFunction(e),f.NONENUMERABLE_DESCRIPTOR);for(var i=["getDate","getDay","getFullYear","getHours","getMilliseconds","getMinutes","getMonth","getSeconds","getTime","getTimezoneOffset","getUTCDate","getUTCDay","getUTCFullYear","getUTCHours","getUTCMilliseconds","getUTCMinutes","getUTCMonth","getUTCSeconds","getYear","setDate","setFullYear","setHours","setMilliseconds","setMinutes","setMonth","setSeconds","setTime","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear","toDateString","toISOString","toJSON","toGMTString","toLocaleDateString","toLocaleString","toLocaleTimeString","toTimeString","toUTCString"],r=0;r<i.length;r++)e=function(r){return function(t){for(var e=[],i=0;i<arguments.length;i++)e[i]=c.pseudoToNative(arguments[i]);return c.createPrimitive(this.data[r].apply(this.data,e))}}(i[r]),this.setNativeFunctionPrototype(this.DATE,i[r],e)},f.prototype.initMath=function(t){var i=this,e=this.createObject(this.OBJECT);this.setProperty(t,"Math",e);for(var r=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2"],s=0;s<r.length;s++)this.setProperty(e,r[s],this.createPrimitive(Math[r[s]]),f.READONLY_NONENUMERABLE_DESCRIPTOR);var n=["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","random","round","sin","sqrt","tan"];for(s=0;s<n.length;s++){var o=function(e){return function(){for(var t=0;t<arguments.length;t++)arguments[t]=arguments[t].toNumber();return i.createPrimitive(e.apply(Math,arguments))}}(Math[n[s]]);this.setProperty(e,n[s],this.createNativeFunction(o),f.NONENUMERABLE_DESCRIPTOR)}},f.prototype.initRegExp=function(t){var e,s=this;e=function(t,e){if(this.parent==s.REGEXP)var i=this;else i=s.createObject(s.REGEXP);return t=t?t.toString():"",e=e?e.toString():"",s.populateRegExp_(i,new RegExp(t,e))},this.REGEXP=this.createNativeFunction(e),this.setProperty(t,"RegExp",this.REGEXP),this.setProperty(this.REGEXP.properties.prototype,"global",this.UNDEFINED,f.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(this.REGEXP.properties.prototype,"ignoreCase",this.UNDEFINED,f.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(this.REGEXP.properties.prototype,"multiline",this.UNDEFINED,f.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(this.REGEXP.properties.prototype,"source",this.createPrimitive("(?:)"),f.READONLY_NONENUMERABLE_DESCRIPTOR),e=function(t){return t=t.toString(),s.createPrimitive(this.data.test(t))},this.setNativeFunctionPrototype(this.REGEXP,"test",e),e=function(t){t=t.toString(),this.data.lastIndex=s.getProperty(this,"lastIndex").toNumber();var e=this.data.exec(t);if(s.setProperty(this,"lastIndex",s.createPrimitive(this.data.lastIndex)),e){for(var i=s.createObject(s.ARRAY),r=0;r<e.length;r++)s.setProperty(i,r,s.createPrimitive(e[r]));return s.setProperty(i,"index",s.createPrimitive(e.index)),s.setProperty(i,"input",s.createPrimitive(e.input)),i}return s.NULL},this.setNativeFunctionPrototype(this.REGEXP,"exec",e)},f.prototype.initJSON=function(t){var i=this,e=i.createObject(this.OBJECT);this.setProperty(t,"JSON",e);var r=function(t){try{var e=JSON.parse(t.toString())}catch(t){return void i.throwException(i.SYNTAX_ERROR,t.message)}return i.nativeToPseudo(e)};this.setProperty(e,"parse",this.createNativeFunction(r)),r=function(t){var e=i.pseudoToNative(t);return i.createPrimitive(JSON.stringify(e))},this.setProperty(e,"stringify",this.createNativeFunction(r))},f.prototype.initError=function(e){var r=this;this.ERROR=this.createNativeFunction(function(t){if(this.parent==r.ERROR)var e=this;else e=r.createObject(r.ERROR);return t&&r.setProperty(e,"message",r.createPrimitive(String(t)),f.NONENUMERABLE_DESCRIPTOR),e}),this.setProperty(e,"Error",this.ERROR),this.setProperty(this.ERROR.properties.prototype,"message",this.STRING_EMPTY,f.NONENUMERABLE_DESCRIPTOR),this.setProperty(this.ERROR.properties.prototype,"name",this.createPrimitive("Error"),f.NONENUMERABLE_DESCRIPTOR);var t=function(t){var i=r.createNativeFunction(function(t){if(r.isa(this.parent,r.ERROR))var e=this;else e=r.createObject(i);return t&&r.setProperty(e,"message",r.createPrimitive(String(t)),f.NONENUMERABLE_DESCRIPTOR),e});return r.setProperty(i,"prototype",r.createObject(r.ERROR)),r.setProperty(i.properties.prototype,"name",r.createPrimitive(t),f.NONENUMERABLE_DESCRIPTOR),r.setProperty(e,t,i),i};this.EVAL_ERROR=t("EvalError"),this.RANGE_ERROR=t("RangeError"),this.REFERENCE_ERROR=t("ReferenceError"),this.SYNTAX_ERROR=t("SyntaxError"),this.TYPE_ERROR=t("TypeError"),this.URI_ERROR=t("URIError")},f.prototype.isa=function(t,e){if(!t||!e)return!1;for(;t.parent!=e;){if(!t.parent||!t.parent.properties.prototype)return!1;t=t.parent.properties.prototype}return!0},f.prototype.comp=function(t,e){if(t.isPrimitive&&"number"==typeof t.data&&isNaN(t.data)||e.isPrimitive&&"number"==typeof e.data&&isNaN(e.data))return NaN;if(t===e)return 0;var i=t.isPrimitive?t.data:t.toString(),r=e.isPrimitive?e.data:e.toString();return i<r?-1:r<i?1:(t.isPrimitive||e.isPrimitive)&&i==r?0:NaN},f.prototype.arrayIndex=function(t){return t=Number(t),!isFinite(t)||t!=Math.floor(t)||t<0||t>=Math.pow(2,32)?NaN:t},(f.Primitive=function(t,e){var i=void 0===t?"undefined":u(t);this.data=t,"number"==(this.type=i)?this.parent=e.NUMBER:"string"==i?this.parent=e.STRING:"boolean"==i&&(this.parent=e.BOOLEAN)}).prototype.data=void 0,f.Primitive.prototype.type="undefined",f.Primitive.prototype.parent=null,f.Primitive.prototype.isPrimitive=!0,f.Primitive.prototype.toBoolean=function(){return Boolean(this.data)},f.Primitive.prototype.toNumber=function(){return Number(this.data)},f.Primitive.prototype.toString=function(){return String(this.data)},f.Primitive.prototype.valueOf=function(){return this.data},f.prototype.createPrimitive=function(t){return void 0===t?this.UNDEFINED:null===t?this.NULL:!0===t?this.TRUE:!1===t?this.FALSE:0===t?this.NUMBER_ZERO:1===t?this.NUMBER_ONE:""===t?this.STRING_EMPTY:t instanceof RegExp?this.populateRegExp_(this.createObject(this.REGEXP),t):new f.Primitive(t,this)},(f.Object=function(t){this.notConfigurable=Object.create(null),this.notEnumerable=Object.create(null),this.notWritable=Object.create(null),this.getter=Object.create(null),this.setter=Object.create(null),this.properties=Object.create(null),this.parent=t}).prototype.type="object",f.Object.prototype.parent=null,f.Object.prototype.isPrimitive=!1,f.Object.prototype.data=void 0,f.Object.prototype.toBoolean=function(){return!0},f.Object.prototype.toNumber=function(){return Number(void 0===this.data?this.toString():this.data)},f.Object.prototype.toString=function(){return void 0===this.data?"["+this.type+"]":String(this.data)},f.Object.prototype.valueOf=function(){return void 0===this.data?this:this.data},f.prototype.createObject=function(t){var e=new f.Object(t);if(this.isa(e,this.FUNCTION)&&(e.type="function",this.setProperty(e,"prototype",this.createObject(this.OBJECT||null))),this.isa(e,this.ARRAY)&&(e.length=0,e.toString=function(){for(var t=[],e=0;e<this.length;e++){var i=this.properties[e];t[e]=!i||i.isPrimitive&&(null===i.data||void 0===i.data)?"":i.toString()}return t.join(",")}),this.isa(e,this.ERROR)){var i=this;e.toString=function(){var t=i.getProperty(this,"name").toString(),e=i.getProperty(this,"message").toString();return e?t+": "+e:t}}return e},f.prototype.populateRegExp_=function(t,e){return t.data=e,this.setProperty(t,"lastIndex",this.createPrimitive(e.lastIndex),f.NONENUMERABLE_DESCRIPTOR),this.setProperty(t,"source",this.createPrimitive(e.source),f.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(t,"global",this.createPrimitive(e.global),f.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(t,"ignoreCase",this.createPrimitive(e.ignoreCase),f.READONLY_NONENUMERABLE_DESCRIPTOR),this.setProperty(t,"multiline",this.createPrimitive(e.multiline),f.READONLY_NONENUMERABLE_DESCRIPTOR),t.toString=function(){return String(this.data)},t.valueOf=function(){return this.data},t},f.prototype.createFunction=function(t,e){var i=this.createObject(this.FUNCTION);return i.parentScope=e,i.node=t,this.setProperty(i,"length",this.createPrimitive(i.node.params.length),f.READONLY_DESCRIPTOR),i},f.prototype.createNativeFunction=function(t){var e=this.createObject(this.FUNCTION);return e.nativeFunc=t,this.setProperty(e,"length",this.createPrimitive(t.length),f.READONLY_DESCRIPTOR),e},f.prototype.createAsyncFunction=function(t){var e=this.createObject(this.FUNCTION);return e.asyncFunc=t,this.setProperty(e,"length",this.createPrimitive(t.length),f.READONLY_DESCRIPTOR),e},f.prototype.nativeToPseudo=function(t){if("boolean"==typeof t||"number"==typeof t||"string"==typeof t||null==t||t instanceof RegExp)return this.createPrimitive(t);if(t instanceof Function){var e=this;return this.createNativeFunction(function(){return e.nativeToPseudo(t.apply(e,Array.prototype.slice.call(arguments).map(function(t){return e.pseudoToNative(t)})))})}var i;if(t instanceof Array){i=this.createObject(this.ARRAY);for(var r=0;r<t.length;r++)this.setProperty(i,r,this.nativeToPseudo(t[r]))}else for(var s in i=this.createObject(this.OBJECT),t)this.setProperty(i,s,this.nativeToPseudo(t[s]));return i},f.prototype.pseudoToNative=function(t){if(t.isPrimitive||this.isa(t,this.NUMBER)||this.isa(t,this.STRING)||this.isa(t,this.BOOLEAN))return t.data;var e;if(this.isa(t,this.ARRAY)){e=[];for(var i=0;i<t.length;i++)e[i]=this.pseudoToNative(t.properties[i])}else for(var r in e={},t.properties)e[r]=this.pseudoToNative(t.properties[r]);return e},f.prototype.getProperty=function(t,e){if(e=e.toString(),t==this.UNDEFINED||t==this.NULL)return this.throwException(this.TYPE_ERROR,"Cannot read property '"+e+"' of "+t),null;if(this.isa(t,this.STRING)){if("length"==e)return this.createPrimitive(t.data.length);var i=this.arrayIndex(e);if(!isNaN(i)&&i<t.data.length)return this.createPrimitive(t.data[i])}else if(this.isa(t,this.ARRAY)&&"length"==e)return this.createPrimitive(t.length);for(;;){if(t.properties&&e in t.properties){var r=t.getter[e];return r?(r.isGetter=!0,r):t.properties[e]}if(!(t.parent&&t.parent.properties&&t.parent.properties.prototype))break;t=t.parent.properties.prototype}return this.UNDEFINED},f.prototype.hasProperty=function(t,e){if(e=e.toString(),t.isPrimitive)throw TypeError("Primitive data type has no properties");if("length"==e&&(this.isa(t,this.STRING)||this.isa(t,this.ARRAY)))return!0;if(this.isa(t,this.STRING)){var i=this.arrayIndex(e);if(!isNaN(i)&&i<t.data.length)return!0}for(;;){if(t.properties&&e in t.properties)return!0;if(!(t.parent&&t.parent.properties&&t.parent.properties.prototype))break;t=t.parent.properties.prototype}return!1},f.prototype.setProperty=function(t,e,i,r){if(e=e.toString(),r&&t.notConfigurable[e]&&this.throwException(this.TYPE_ERROR,"Cannot redefine property: "+e),"object"!=(void 0===i?"undefined":u(i)))throw Error("Failure to wrap a value: "+i);t!=this.UNDEFINED&&t!=this.NULL||this.throwException(this.TYPE_ERROR,"Cannot set property '"+e+"' of "+t),r&&(r.get||r.set)&&(i||void 0!==r.writable)&&this.throwException(this.TYPE_ERROR,"Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");var s=!this.stateStack||this.getScope().strict;if(t.isPrimitive)s&&this.throwException(this.TYPE_ERROR,"Can't create property '"+e+"' on '"+t.data+"'");else{if(this.isa(t,this.STRING)){var n=this.arrayIndex(e);if("length"==e||!isNaN(n)&&n<t.data.length)return void(s&&this.throwException(this.TYPE_ERROR,"Cannot assign to read only property '"+e+"' of String '"+t.data+"'"))}if(this.isa(t,this.ARRAY)){var o;if("length"==e){var a=this.arrayIndex(i.toNumber());if(isNaN(a)&&this.throwException(this.RANGE_ERROR,"Invalid array length"),a<t.length)for(o in t.properties)o=this.arrayIndex(o),!isNaN(o)&&a<=o&&delete t.properties[o];return void(t.length=a)}isNaN(o=this.arrayIndex(e))||(t.length=Math.max(t.length,o+1))}if(t.properties[e]||!t.preventExtensions)if(r){t.properties[e]=i,r.configurable||(t.notConfigurable[e]=!0);var h=r.get;h?t.getter[e]=h:delete t.getter[e];var p=r.set;if(p?t.setter[e]=p:delete t.setter[e],r.enumerable||!1?delete t.notEnumerable[e]:t.notEnumerable[e]=!0,h||p)delete t.notWritable[e],t.properties[e]=this.UNDEFINED;else r.writable||!1?delete t.notWritable[e]:t.notWritable[e]=!0}else{for(var c=t;;){if(c.setter&&c.setter[e])return c.setter[e];if(!(c.parent&&c.parent.properties&&c.parent.properties.prototype))break;c=c.parent.properties.prototype}t.getter&&t.getter[e]?s&&this.throwException(this.TYPE_ERROR,"Cannot set property '"+e+"' of object '"+t+"' which only has a getter"):t.notWritable[e]?s&&this.throwException(this.TYPE_ERROR,"Cannot assign to read only property '"+e+"' of object '"+t+"'"):t.properties[e]=i}else s&&this.throwException(this.TYPE_ERROR,"Can't add property "+e+", object is not extensible")}},f.prototype.setNativeFunctionPrototype=function(t,e,i){this.setProperty(t.properties.prototype,e,this.createNativeFunction(i),f.NONENUMERABLE_DESCRIPTOR)},f.prototype.deleteProperty=function(t,e){return e=e.toString(),!t.isPrimitive&&!t.notWritable[e]&&(("length"!=e||!this.isa(t,this.ARRAY))&&delete t.properties[e])},f.prototype.getScope=function(){for(var t=this.stateStack.length-1;0<=t;t--)if(this.stateStack[t].scope)return this.stateStack[t].scope;throw Error("No scope found.")},f.prototype.createScope=function(t,e){var i=this.createObject(null);if((i.parentScope=e)||this.initGlobalScope(i),this.populateScope_(t,i),i.strict=!1,e&&e.strict)i.strict=!0;else{var r=t.body&&t.body[0];r&&r.expression&&"Literal"==r.expression.type&&"use strict"==r.expression.value&&(i.strict=!0)}return i},f.prototype.createSpecialScope=function(t,e){if(!t)throw Error("parentScope required");var i=e||this.createObject(null);return i.parentScope=t,i.strict=t.strict,i},f.prototype.getValueFromScope=function(t){for(var e=this.getScope(),i=t.toString();e&&e!=this.global;){if(i in e.properties)return e.properties[i];e=e.parentScope}if(e==this.global&&this.hasProperty(e,i))return this.getProperty(e,i);var r=this.stateStack[this.stateStack.length-1].node;return"UnaryExpression"==r.type&&"typeof"==r.operator?this.UNDEFINED:(this.throwException(this.REFERENCE_ERROR,i+" is not defined"),null)},f.prototype.setValueToScope=function(t,e){for(var i=this.getScope(),r=t.toString();i&&i!=this.global;){if(r in i.properties)return void(i.properties[r]=e);i=i.parentScope}if(i==this.global&&(!i.strict||this.hasProperty(i,r)))return this.setProperty(i,r,e);this.throwException(this.REFERENCE_ERROR,r+" is not defined")},f.prototype.populateScope_=function(t,e){if("VariableDeclaration"==t.type)for(var i=0;i<t.declarations.length;i++)this.setProperty(e,t.declarations[i].id.name,this.UNDEFINED);else{if("FunctionDeclaration"==t.type)return void this.setProperty(e,t.id.name,this.createFunction(t,e));if("FunctionExpression"==t.type)return;if("ExpressionStatement"==t.type)return}var r=t.constructor;for(var s in t){var n=t[s];if(n&&"object"==(void 0===n?"undefined":u(n)))if(n instanceof Array)for(i=0;i<n.length;i++)n[i]&&n[i].constructor==r&&this.populateScope_(n[i],e);else n.constructor==r&&this.populateScope_(n,e)}},f.prototype.stripLocations_=function(t,e,i){for(var r in e?t.start=e:delete t.start,i?t.end=i:delete t.end,t)if(t.hasOwnProperty(r)){var s=t[r];s&&"object"==(void 0===s?"undefined":u(s))&&this.stripLocations_(s,e,i)}},f.prototype.getValue=function(t){if(t instanceof Array){var e=t[0],i=t[1];return this.getProperty(e,i)}return this.getValueFromScope(t)},f.prototype.setValue=function(t,e){if(t instanceof Array){var i=t[0],r=t[1];return this.setProperty(i,r,e)}return this.setValueToScope(t,e)},f.prototype.throwException=function(t,e){if(void 0===e)var i=t;else{i=this.createObject(t);this.setProperty(i,"message",this.createPrimitive(e),f.NONENUMERABLE_DESCRIPTOR)}this.executeException(i)},f.prototype.executeException=function(t){do{this.stateStack.pop();var e=this.stateStack[this.stateStack.length-1];if("TryStatement"==e.node.type)return void(e.throwValue=t)}while(e&&"Program"!=e.node.type);var i;if(this.isa(t,this.ERROR)){var r={EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},s=this.getProperty(t,"name").toString(),n=this.getProperty(t,"message").valueOf();i=(r[s]||Error)(n)}else i=t.toString();throw i},f.prototype.pushGetter_=function(t,e){var i=e instanceof Array?e[0]:e;this.stateStack.push({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:i,func_:t,doneArgs_:!0,arguments_:[]})},f.prototype.pushSetter_=function(t,e,i){var r=e instanceof Array?e[0]:this.global;this.stateStack.push({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:r,func_:t,doneArgs_:!0,arguments_:[i]})},f.prototype.takeStateSnapshot=function(){var t=r(this.stateStack,void 0,void 0,void 0,!0);return this.global=t[0].scope,t},f.prototype.restoreStateSnapshot=function(t){this.stateStack=r(t,void 0,void 0,void 0,!0),this.global=this.stateStack[0].scope,this.initFunc_(this,this.global)},f.prototype.stepArrayExpression=function(){var t=this.stateStack[this.stateStack.length-1],e=t.node,i=t.n_||0;t.array_?t.value&&this.setProperty(t.array_,i-1,t.value):t.array_=this.createObject(this.ARRAY),i<e.elements.length?(t.n_=i+1,e.elements[i]?this.stateStack.push({node:e.elements[i]}):t.value=void 0):(t.array_.length=t.n_||0,this.stateStack.pop(),this.stateStack[this.stateStack.length-1].value=t.array_)},f.prototype.stepAssignmentExpression=function(){var t=this.stateStack[this.stateStack.length-1],e=t.node;if(!t.doneLeft_)return t.doneLeft_=!0,void this.stateStack.push({node:e.left,components:!0});if(!t.doneRight_){if(t.leftSide_||(t.leftSide_=t.value),t.doneGetter_&&(t.leftValue_=t.value),!t.doneGetter_&&"="!=e.operator&&(t.leftValue_=this.getValue(t.leftSide_),t.leftValue_.isGetter)){t.leftValue_.isGetter=!1,t.doneGetter_=!0;var i=t.leftValue_;return void this.pushGetter_(i,t.leftSide_)}return t.doneRight_=!0,void this.stateStack.push({node:e.right})}if(t.doneSetter_)return this.stateStack.pop(),void(this.stateStack[this.stateStack.length-1].value=t.doneSetter_);var r,s=t.value;if("="==e.operator)r=s;else{var n,o,a=s,h=t.leftValue_.toNumber(),p=a.toNumber();if("+="==e.operator)"string"==t.leftValue_.type||"string"==a.type?(n=t.leftValue_.toString(),o=a.toString()):(n=h,o=p),r=n+o;else if("-="==e.operator)r=h-p;else if("*="==e.operator)r=h*p;else if("/="==e.operator)r=h/p;else if("%="==e.operator)r=h%p;else if("<<="==e.operator)r=h<<p;else if(">>="==e.operator)r=h>>p;else if(">>>="==e.operator)r=h>>>p;else if("&="==e.operator)r=h&p;else if("^="==e.operator)r=h^p;else{if("|="!=e.operator)throw SyntaxError("Unknown assignment expression: "+e.operator);r=h|p}r=this.createPrimitive(r)}var c=this.setValue(t.leftSide_,r);if(c)return t.doneSetter_=r,void this.pushSetter_(c,t.leftSide_,r);this.stateStack.pop(),this.stateStack[this.stateStack.length-1].value=r},f.prototype.stepBinaryExpression=function(){var t=this.stateStack[this.stateStack.length-1],e=t.node;if(!t.doneLeft_)return t.doneLeft_=!0,void this.stateStack.push({node:e.left});if(!t.doneRight_)return t.doneRight_=!0,t.leftValue_=t.value,void this.stateStack.push({node:e.right});this.stateStack.pop();var i,r=t.leftValue_,s=t.value,n=this.comp(r,s);if("=="==e.operator||"!="==e.operator)i=r.isPrimitive&&s.isPrimitive?r.data==s.data:0===n,"!="==e.operator&&(i=!i);else if("==="==e.operator||"!=="==e.operator)i=r.isPrimitive&&s.isPrimitive?r.data===s.data:r===s,"!=="==e.operator&&(i=!i);else if(">"==e.operator)i=1==n;else if(">="==e.operator)i=1==n||0===n;else if("<"==e.operator)i=-1==n;else if("<="==e.operator)i=-1==n||0===n;else if("+"==e.operator){i=(o=r.isPrimitive?r.data:r.toString())+(a=s.isPrimitive?s.data:s.toString())}else if("in"==e.operator)i=this.hasProperty(s,r);else if("instanceof"==e.operator)this.isa(s,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Expecting a function in instanceof check"),i=this.isa(r,s);else{var o=r.toNumber(),a=s.toNumber();if("-"==e.operator)i=o-a;else if("*"==e.operator)i=o*a;else if("/"==e.operator)i=o/a;else if("%"==e.operator)i=o%a;else if("&"==e.operator)i=o&a;else if("|"==e.operator)i=o|a;else if("^"==e.operator)i=o^a;else if("<<"==e.operator)i=o<<a;else if(">>"==e.operator)i=o>>a;else{if(">>>"!=e.operator)throw SyntaxError("Unknown binary operator: "+e.operator);i=o>>>a}}this.stateStack[this.stateStack.length-1].value=this.createPrimitive(i)},f.prototype.stepBlockStatement=function(){var t=this.stateStack[this.stateStack.length-1],e=t.node,i=t.n_||0;e.body[i]?(t.n_=i+1,this.stateStack.push({node:e.body[i]})):this.stateStack.pop()},f.prototype.stepBreakStatement=function(){var t=this.stateStack.pop(),e=t.node,i=null;for(e.label&&(i=e.label.name),t=this.stateStack.pop();t&&"CallExpression"!=t.node.type&&"NewExpression"!=t.node.type;){if(i?i==t.label:t.isLoop||t.isSwitch)return;t=this.stateStack.pop()}throw SyntaxError("Illegal break statement")},f.prototype.stepCallExpression=function(){var e=this.stateStack[this.stateStack.length-1],t=e.node;if(!e.doneCallee_)return e.doneCallee_=!0,void this.stateStack.push({node:t.callee,components:!0});if(!e.func_){if("function"==e.value.type)e.func_=e.value;else{if(e.func_=this.getValue(e.value),e.func_.isGetter)return e.func_.isGetter=!1,this.pushGetter_(e.func_,e.value),void(e.func_=null);if(!e.func_)return;if("function"!=e.func_.type)return void this.throwException(this.TYPE_ERROR,(e.func_&&e.func_.type)+" is not a function")}"NewExpression"==e.node.type?(e.funcThis_=this.createObject(e.func_),e.isConstructor_=!0):e.value.length?e.funcThis_=e.value[0]:e.funcThis_=this.getScope().strict?this.UNDEFINED:this.global,e.arguments_=[],e.n_=0}if(!e.doneArgs_){if(0!=e.n_&&e.arguments_.push(e.value),t.arguments[e.n_])return this.stateStack.push({node:t.arguments[e.n_]}),void e.n_++;e.doneArgs_=!0}if(e.doneExec_)this.stateStack.pop(),e.isConstructor_&&"object"!==e.value.type?this.stateStack[this.stateStack.length-1].value=e.funcThis_:this.stateStack[this.stateStack.length-1].value=e.value;else if(e.doneExec_=!0,e.func_.node){for(var i=this.createScope(e.func_.node.body,e.func_.parentScope),r=0;r<e.func_.node.params.length;r++){var s=this.createPrimitive(e.func_.node.params[r].name),n=e.arguments_.length>r?e.arguments_[r]:this.UNDEFINED;this.setProperty(i,s,n)}var o=this.createObject(this.ARRAY);for(r=0;r<e.arguments_.length;r++)this.setProperty(o,this.createPrimitive(r),e.arguments_[r]);this.setProperty(i,"arguments",o);var a={node:e.func_.node.body,scope:i,thisExpression:e.funcThis_};this.stateStack.push(a),e.value=this.UNDEFINED}else if(e.func_.nativeFunc)e.value=e.func_.nativeFunc.apply(e.funcThis_,e.arguments_);else{if(e.func_.asyncFunc){var h=this,p=e.arguments_.concat(function(t){e.value=t||h.UNDEFINED,h.paused_=!1});return e.func_.asyncFunc.apply(e.funcThis_,p),void(this.paused_=!0)}if(e.func_.eval){var c=e.arguments_[0];if(c)if(c.isPrimitive){var u=l.parse(c.toString(),f.PARSE_OPTIONS);e={node:{type:"EvalProgram_",body:u.body}},this.stripLocations_(e.node,t.start,t.end);i=this.getScope();this.populateScope_(u,i),this.stateStack.push(e)}else e.value=c;else e.value=this.UNDEFINED}else this.throwException(this.TYPE_ERROR,"function is not a function")}},f.prototype.stepCatchClause=function(){var t=this.stateStack[this.stateStack.length-1],e=t.node;if(t.done_)this.stateStack.pop();else{var i;if(t.done_=!0,e.param){i=this.createSpecialScope(this.getScope());var r=this.createPrimitive(e.param.name);this.setProperty(i,r,t.throwValue)}this.stateStack.push({node:e.body,scope:i})}},f.prototype.stepConditionalExpression=function(){var t=this.stateStack[this.stateStack.length-1],e=t.mode_||0;if(0==e)return t.mode_=1,void this.stateStack.push({node:t.node.test});if(1==e){t.mode_=2;var i=t.value.toBoolean();if(i&&t.node.consequent)return void this.stateStack.push({node:t.node.consequent});if(!i&&t.node.alternate)return void this.stateStack.push({node:t.node.alternate});this.value=this.UNDEFINED}this.stateStack.pop(),"ConditionalExpression"==t.node.type&&(this.stateStack[this.stateStack.length-1].value=t.value)},f.prototype.stepContinueStatement=function(){var t=this.stateStack[this.stateStack.length-1],e=null;for(t.node.label&&(e=t.node.label.name);t&&"CallExpression"!=t.node.type