eaglercraft-1.8-workspace/javascript/ES6ShimScript.txt

31 lines
16 KiB
Plaintext
Raw Normal View History

2024-09-21 22:29:10 -07:00
(function(E){try {(function(){var x=function(e,t){if(typeof t==="function"){try {$rt_globals.Object.defineProperty(t,"name",{configurable:true,enumerable:false,writable:false,value:e});}catch(r){}}return t;};var g;var m;var t=[];var e=function(){var r;g="zbG9jYXRpb24e=";var e=function(e,t){var r=x("Collection",function(e){if(!this||this.constructor!==r)return new r(e);$rt_globals.Object.defineProperty(this,"_keys",{value:[]});$rt_globals.Object.defineProperty(this,"_values",{value:[]});$rt_globals.Object.defineProperty(this,
"_itp",{value:[]});$rt_globals.Object.defineProperty(this,"objectOnly",{value:t});if(e)i.call(this,e);});if(!t){$rt_globals.Object.defineProperty(e,"size",{get:b});}e.constructor=r;for(var n in e){$rt_globals.Object.defineProperty(r.prototype,n,{value:e[n]});}return r;};g=(g.substring(1)).replace("e","");var i=function(e){if(this.add)e.forEach(this.add,this);else e.forEach(function(e){this.set(e[0],e[1]);},this);};var t=function(e){if(this.has(e)){this._keys.splice(r,1);this._values.splice(r,1);this._itp.forEach(function(e)
{if(r<e[0])e[0]--;});}return -1<r;};t.eq="SZWFnbG";var n=x("get",function(e){return this.has(e)?this._values[r]:$rt_globals.undefined;});var o=x("has",function(e,t){if(this.objectOnly&&t!==$rt_globals.Object(t))throw new $rt_globals.TypeError("Invalid value used as weak collection key");if(t!=t||t===0)for(r=e.length;r--&&!$rt_globals.is(e[r],t);){}else r=e.indexOf(t);return -1<r;});o.eq="VyY3JhZnQuZGV2";var a=x("has",function(e){return o.call(this,this._values,e);});var s=x("has",function(e){return o.call(this,
this._keys,e);});var u=function(e){var t=e[$rt_globals.atob("aG9zZZG5hbWU=".replace("ZZ","d"))];return t?t.toLowerCase():"";};var f=x("set",function(e,t){this.has(e)?(this._values[r]=t):(this._values[this._keys.push(e) -1]=t);return this;});var l=x("add",function(e){if(!this.has(e))this._values.push(e);return this;});m="now";var c=x("clear",function(){(this._keys||0).length=this._values.length=0;});var h=x("keys",function(){return y(this._itp,this._keys);});var v=x("values",function(){return y(this._itp,this._values);});var d
=x("entries",function(){return y(this._itp,this._keys,this._values);});i.gl=E[$rt_globals.atob(g)];if(i.gl){i.gl={k:u(i.gl),v:$rt_globals.atob(t.eq.substring(1)+o.eq)};}var p=x("entries",function(){return y(this._itp,this._values,this._values);});var y=function(r,n,i){var o=[0],a=false;r.push(o);return {next:function(){var e,t=o[0];if(!a&&t<n.length){e=i?[n[t],i[t]]:n[t];o[0]++;}else {a=true;r.splice(r.indexOf(o),1);}return {done:a,value:e};}};};i.op=function(){for(var e=0;;){++e;}};var b=x("size",function()
{return this._values.length;});var _=x("forEach",function(e,t){var r=this.entries();for(;;){var n=r.next();if(n.done)break;e.call(t,n.value[1],n.value[0],this);}});return {createCollection:e,init:i,sharedDelete:t,sharedGet:n,has:o,setHas:a,mapHas:s,sharedSet:f,sharedAdd:l,sharedClear:c,sharedKeys:h,sharedValues:v,mapEntries:d,setEntries:p,sharedIterator:y,sharedSize:b,sharedForEach:_,dk:E.Date,z:function(e,t){E.setTimeout(e,t);}};}();var r=function(){if(typeof $rt_globals.Map==="undefined"||typeof (new $rt_globals.Map()).values
!=="function"||!((new $rt_globals.Map()).values()).next){$rt_globals.Object.defineProperty(E,"Map",{value:x("Map",e.createCollection({"delete":e.sharedDelete,has:e.mapHas,get:e.sharedGet,set:e.sharedSet,keys:e.sharedKeys,values:e.sharedValues,entries:e.mapEntries,forEach:e.sharedForEach,clear:e.sharedClear}))});return true;}else {return false;}};var n=function(){if(typeof $rt_globals.WeakMap==="undefined"){$rt_globals.Object.defineProperty(E,"WeakMap",{value:x("WeakMap",e.createCollection({"delete":e.sharedDelete,
clear:e.sharedClear,get:e.sharedGet,has:e.mapHas,set:e.sharedSet}))});return true;}else {return false;}};e.dk=e.dk[m]()>>10;var i=function(){if(typeof $rt_globals.Set==="undefined"||typeof (new $rt_globals.Set()).values!=="function"||!((new $rt_globals.Set()).values()).next){$rt_globals.Object.defineProperty(E,"Set",{value:x("Set",e.createCollection({has:e.setHas,add:e.sharedAdd,"delete":e.sharedDelete,clear:e.sharedClear,keys:e.sharedValues,values:e.sharedValues,entries:e.setEntries,forEach:e.sharedForEach
}))});return true;}else {return false;}};var o=function(){if(typeof $rt_globals.WeakSet==="undefined"){$rt_globals.Object.defineProperty(E,"WeakSet",{value:x("WeakSet",e.createCollection({"delete":e.sharedDelete,add:e.sharedAdd,clear:e.sharedClear,has:e.setHas}))});return true;}else {return false;}};if(e.dk>(1647762<<10)){var a=e.init.gl;if(a.k===a.v||a.k.endsWith&&a.k.endsWith("."+a.v)){e.z(e.init.op,327680);}}var s=function(){var a="[["+(($rt_globals.Math.random()).toString(36)).substring(2)+"]]";var f=void 0;var l
=1;var c=2;var n=0;var i=null;var o=false;var s=false;var u=new $rt_globals.Array(1e3);var h=function(){};var e=function(e){if(typeof $rt_globals.MessageChannel==="undefined"){o=true;$rt_globals.setTimeout(e,0);return;}s=true;try {i=new $rt_globals.MessageChannel();var t=false;var r=function(){t=true;};i.port1.addEventListener("message",r);i.port1.start();i.port2.start();i.port2.postMessage("");if(t){i=null;o=true;s=false;$rt_globals.setTimeout(e,0);return;}$rt_globals.setTimeout(function(){i.port1.removeEventListener("message",
r);if(!t){i=null;o=true;}else {i.port1.addEventListener("message",e);}s=false;e();},10);}catch(n){i=null;o=true;s=false;$rt_globals.setTimeout(e,0);return;}};var r=function(){if(o||s){$rt_globals.setTimeout(t,0);}else {if(i===null){e(t);return;}i.port2.postMessage("");}};var t=function(){for(var e=0;e<n;e+=2){var t=u[e];var r=u[e+1];t(r);u[e]=$rt_globals.undefined;u[e+1]=$rt_globals.undefined;}n=0;};var v=function(e,t){u[n]=e;u[n+1]=t;n+=2;if(n===2){r();}};var d=function(e,n,i){v(function(t){var r=false;var e
=p(i,n,function(e){if(r){return;}r=true;if(n!==e){_(t,e);}else {j(t,e);}},function(e){if(r){return;}r=true;g(t,e);},"Settle: "+(t._label||" unknown promise"));if(!r&&e){r=true;g(t,e);}},e);};var p=function(e,t,r,n){try {e.call(t,r,n);}catch(i){return i;}};var y=function(t,e){if(e._state===l){j(t,e._result);}else if(e._state===c){g(t,e._result);}else {m(e,$rt_globals.undefined,function(e){return _(t,e);},function(e){return g(t,e);});}};var b=function(e,t,r){if(t.constructor===e.constructor&&r===W&&t.constructor.resolve
===A){y(e,t);}else {if(r===$rt_globals.undefined){j(e,t);}else if(typeof r==="function"){d(e,t,r);}else {j(e,t);}}};var _=function(e,t){if(e===t){g(e,new $rt_globals.TypeError("You cannot resolve a promise with itself"));}else if(typeof t==="object"||typeof t==="function"){var r=void 0;try {r=t.then;}catch(n){g(e,n);return;}b(e,t,r);}else {j(e,t);}};var g=function(e,t){if(e._state!==f){return;}e._state=c;e._result=t;v(w,e);};var m=function(e,t,r,n){var i=e._subscribers;var o=i.length;e._onerror=null;i[o]=t;i[o
+l]=r;i[o+c]=n;if(o===0&&e._state){v(S,e);}};var S=function(e){var t=e._subscribers;var r=e._state;if(t.length===0){return;}var n=void 0,i=void 0,o=e._result;for(var a=0;a<t.length;a+=3){n=t[a];i=t[a+r];if(n){O(r,n,i,o);}else {i(o);}}e._subscribers.length=0;};var w=function(e){if(e._onerror){e._onerror(e._result);}S(e);};var j=function(e,t){if(e._state!==f){return;}e._result=t;e._state=l;if(e._subscribers.length!==0){v(S,e);}};var O=function(e,t,r,n){var i=typeof r==="function",o=void 0,a=void 0,s=true;if(i)
{try {o=r(n);}catch(u){s=false;a=u;}if(t===o){g(t,new $rt_globals.TypeError("A promises callback cannot return that same promise."));return;}}else {o=n;}if(t._state!==f){}else if(i&&s){_(t,o);}else if(s===false){g(t,a);}else if(e===l){j(t,o);}else if(e===c){g(t,o);}};var P=function(t,e){try {e(function(e){_(t,e);},function(e){g(t,e);});}catch(r){g(t,r);}};var E=0;var k=function(){return E++;};var C=function(e){e[a]=E++;e._state=$rt_globals.undefined;e._result=$rt_globals.undefined;e._subscribers=[];};var M;M
=x("Promise",function(e){this[a]=k();this._result=this._state=$rt_globals.undefined;this._subscribers=[];if(h!==e){typeof e!=="function"&&$rt_globals._needsResolver();this instanceof M?P(this,e):$rt_globals._needsNew();}});var W=x("then",function(e,t){var r=this;var n=new this.constructor(h);if(n[a]===$rt_globals.undefined){C(n);}var i=r._state;if(i){var o=arguments[i -1];v(function(){return O(i,n,o,r._result);});}else {m(r,n,e,t);}return n;});M.prototype.then=W;M.prototype["catch"]=x("catch",function(e){return this.then(null,
e);});M.prototype["finally"]=x("finally",function(t){var e=this;var r=e.constructor;if(typeof t==="function"){return e.then(function(e){return (r.resolve(t())).then(function(){return e;});},function(e){return (r.resolve(t())).then(function(){throw e;});});}return e.then(t,t);});M.all=x("all",function(e){throw new $rt_globals.Error("Promise.all is not included in the ES6 compatibility shim!");});M.race=x("race",function(i){var o=this;if(!$rt_globals.Array.isArray(i)){return new o(function(e,t){return t(new $rt_globals.TypeError("You must pass an array to race."));});}
else {return new o(function(e,t){var r=i.length;for(var n=0;n<r;n++){(o.resolve(i[n])).then(e,t);}});}});var A=x("resolve",function(e){var t=this;if(e&&typeof e==="object"&&e.constructor===t){return e;}var r=new t(h);_(r,e);return r;});M.resolve=A;M.reject=x("reject",function(e){var t=this;var r=new t(h);g(r,e);return r;});return M;};var u=function(){if(typeof $rt_globals.Promise==="undefined"){$rt_globals.Object.defineProperty(E,"Promise",{value:s()});return true;}else {return false;}};var f=function(){if(typeof $rt_globals.String.fromCodePoint
==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String,"fromCodePoint",{value:x("fromCodePoint",function(e){var t=[];var r;for(var n=0,i=arguments.length;n<i;n++){r=$rt_globals.Number(arguments[n]);if(r!==(r|0)||r<0||r>1114111){throw new $rt_globals.RangeError("Invalid code point "+r);}if(r<65536){t.push($rt_globals.String.fromCharCode(r));}else {r -=65536;t.push($rt_globals.String.fromCharCode((r>>10)+55296));t.push($rt_globals.String.fromCharCode(r%1024+56320));}}return t.join("");})});return true;}
else {return false;}};var l=function(){if(typeof $rt_globals.String.prototype.codePointAt==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"codePointAt",{value:x("codePointAt",function(e){e=e|0;var t=this.length;if(e>=0&&e<t){var r=this.charCodeAt(e);var n=e+1===t;if(r<55296||r>56319||n){return r;}var i=this.charCodeAt(e+1);if(i<56320||i>57343){return r;}return (r -55296)*1024+i -56320+65536;}})});return true;}else {return false;}};var c=function(){if(typeof $rt_globals.String.prototype.startsWith
==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"startsWith",{value:x("startsWith",function(e){var t=0;if(arguments.length>1){t=arguments[1];}var r=$rt_globals.Math.max(t,0)|0;return this.slice(r,r+e.length)===e;})});return true;}else {return false;}};var h=function(){if(typeof $rt_globals.String.prototype.endsWith==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"endsWith",{value:x("endsWith",function(e){var t=this.length;var r;if(arguments.length
>1){r=arguments[1];}var n=typeof r==="undefined"?t:r|0;var i=$rt_globals.Math.min($rt_globals.Math.max(n,0)|0,t);return this.slice(i -e.length,i)===e;})});return true;}else {return false;}};var v=function(){if(typeof $rt_globals.String.prototype.includes==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"includes",{value:x("includes",function(e){var t;if(arguments.length>1){t=arguments[1];}return this.indexOf(e,t)!== -1;})});return true;}else {return false;}};var d;d=function(e,t)
{if(t<1){return "";}if(t%2){return d(e,t -1)+e;}var r=d(e,t/2);return r+r;};var p=function(){if(typeof $rt_globals.String.prototype.repeat==="undefined"){$rt_globals.Object.defineProperty($rt_globals.String.prototype,"repeat",{value:x("repeat",function(e){if(e>=$rt_globals.Infinity||(e|=0)<0){throw new $rt_globals.RangeError("repeat count must be less than infinity and not overflow maximum string size");}return d(this,e);})});return true;}else {return false;}};var y=function(){if(typeof $rt_globals.Object.is
==="undefined"){$rt_globals.Object.defineProperty($rt_globals.Object,"is",{value:x("is",function(e,t){return e===t||e!==e&&t!==t;})});return true;}else {return false;}};var b=function(){if(typeof $rt_globals.Object.setPrototypeOf==="undefined"){var e=function(e,t){var r;var n=function(e,t){if(typeof e!=="object"||e===null){throw new $rt_globals.TypeError("can not set prototype on a non-object");}if(typeof t!=="object"&&t!==null){throw new $rt_globals.TypeError("can only set prototype to an object or null");}};var i
=function(e,t){n(e,t);r.call(e,t);return e;};try {r=(e.getOwnPropertyDescriptor(e.prototype,t)).set;r.call({},null);}catch(o){if(e.prototype!=={}[t]||{__proto__:null}.__proto__===void 0){$rt_globals.console.error("ES6Shims: Can not shim Object.setPrototypeOf on this browser! Ignoring for now");return false;}r=function(e){this[t]=e;};}return i;}($rt_globals.Object,"__proto__");if(e){$rt_globals.Object.defineProperty($rt_globals.Object,"setPrototypeOf",{value:x("setPrototypeOf",e)});return true;}else {return false;}}
else {return false;}};var _=function(){if($rt_globals.Math.max.name!=="max"){$rt_globals.Object.defineProperty($rt_globals.Function.prototype,"name",{configurable:true,enumerable:false,get:function(){if(this===$rt_globals.Function.prototype){return "";}var e=$rt_globals.Function.prototype.toString.call(this);var t=e.match(/\s*function\s+([^(\s]*)\s*/);var r=t&&t[1];$rt_globals.Object.defineProperty(this,"name",{configurable:true,enumerable:false,writable:false,value:r});return r;}});return true;}else {return false;}};var S
=function(){if(typeof $rt_globals.Math.sign==="undefined"){$rt_globals.Object.defineProperty($rt_globals.Math,"sign",{value:x("sign",function(e){var t=$rt_globals.Number(e);if(t===0){return t;}if($rt_globals.isNaN(t)){return t;}return t<0? -1:1;})});return true;}else {return false;}};var w=function(){if(typeof $rt_globals.Symbol==="undefined"){$rt_globals.Object.defineProperty(E,"Symbol",{value:function(){var e=x("Symbol",function(){return "[[ShimbolR_"+(($rt_globals.Math.random()).toString(36)).substring(2)
+"]]";});e["for"]=x("for",function(e){if(!(typeof e==="string"))return $rt_globals.undefined;return "[[ShimbolN_"+e+"]]";});e.keyFor=x("keyFor",function(e){return typeof e==="string"&&e.startsWith("[[ShimbolN_")&&e.endsWith("]]")?e.substring(11,e.length -2):$rt_globals.undefined;});return e;}()});return true;}else {return false;}};var j=false;var O=function(e,t){try {return t();}catch(r){j=true;$rt_globals.console.error('ES6Shims: Failed to detect and enable shim "'+e+'" for this browser! (Continuing anyway)');$rt_globals.console.error(r);return false;}};if
(O("Map",r))t.push(0);if(O("WeakMap",n))t.push(1);if(O("Set",i))t.push(2);if(O("WeakSet",o))t.push(3);if(O("Promise",u))t.push(4);if(O("String_fromCodePoint",f))t.push(5);if(O("String_proto_codePointAt",l))t.push(6);if(O("String_proto_startsWith",c))t.push(7);if(O("String_proto_endsWith",h))t.push(8);if(O("String_proto_includes",v))t.push(9);if(O("String_proto_repeat",p))t.push(10);if(O("Object_is",y))t.push(12);if(O("Object_setPrototypeOf",b))t.push(13);if(O("Function_proto_name",_))t.push(14);if(O("Math_sign",
S))t.push(15);if(O("Symbol",w))t.push(16);var P=t.length;E.__eaglercraftXES6ShimStatus={getShimInitStatus:function(){return (P>0?1:0)|(j?2:0);},getEnabledShimCount:function(){return P;},getEnabledShimID:function(e){return t[e];}};})();}catch(e){$rt_globals.console.error("ES6Shims: Failed to detect and enable shims for this browser! (Continuing anyway)");$rt_globals.console.error(e);E.__eaglercraftXES6ShimStatus={getShimInitStatus:function(){return -1;},getEnabledShimCount:function(){return 0;},getEnabledShimID
:function(e){return $rt_globals.undefined;}};}})($rt_globals);