11 lines
29 KiB
JavaScript
11 lines
29 KiB
JavaScript
/*!
|
||
* https://github.com/paulmillr/es6-shim
|
||
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
|
||
* and contributors, MIT License
|
||
* es6-shim: v0.23.0
|
||
* see https://github.com/paulmillr/es6-shim/blob/0.22.2/LICENSE
|
||
* Details and documentation:
|
||
* https://github.com/paulmillr/es6-shim/
|
||
*/
|
||
(function(e,t){if(typeof define==="function"&&define.amd){define(t)}else if(typeof exports==="object"){module.exports=t()}else{e.returnExports=t()}})(this,function(){"use strict";var e=function(e){try{e()}catch(t){return false}return true};var t=function(e,t){try{var r=function(){e.apply(this,arguments)};if(!r.__proto__){return false}Object.setPrototypeOf(r,e);r.prototype=Object.create(e.prototype,{constructor:{value:e}});return t(r)}catch(n){return false}};var r=function(){try{Object.defineProperty({},"x",{});return true}catch(e){return false}};var n=function(){var e=false;if(String.prototype.startsWith){try{"/a/".startsWith(/a/)}catch(t){e=true}}return e};var i=new Function("return this;");var o=i();var a=o.isFinite;var u=!!Object.defineProperty&&r();var s=n();var f=Function.call.bind(String.prototype.indexOf);var l=Function.call.bind(Object.prototype.toString);var c=Function.call.bind(Object.prototype.hasOwnProperty);var h;var p=function(){};var v=o.Symbol||{};var y=v.species||"@@species";var b={string:function(e){return l(e)==="[object String]"},regex:function(e){return l(e)==="[object RegExp]"},symbol:function(e){return typeof o.Symbol==="function"&&typeof e==="symbol"}};var d=function(e,t,r,n){if(!n&&t in e){return}if(u){Object.defineProperty(e,t,{configurable:true,enumerable:false,writable:true,value:r})}else{e[t]=r}};var g={getter:function(e,t,r){if(!u){throw new TypeError("getters require true ES5 support")}Object.defineProperty(e,t,{configurable:true,enumerable:false,get:r})},proxy:function(e,t,r){if(!u){throw new TypeError("getters require true ES5 support")}var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,{configurable:n.configurable,enumerable:n.enumerable,get:function i(){return e[t]},set:function o(r){e[t]=r}})},redefine:function(e,t,r){if(u){var n=Object.getOwnPropertyDescriptor(e,t);n.value=r;Object.defineProperty(e,t,n)}else{e[t]=r}}};var m=function(e,t){Object.keys(t).forEach(function(r){var n=t[r];d(e,r,n,false)})};var w=Object.create||function(e,t){function r(){}r.prototype=e;var n=new r;if(typeof t!=="undefined"){m(n,t)}return n};var I=b.symbol(v.iterator)?v.iterator:"_es6-shim iterator_";if(o.Set&&typeof(new o.Set)["@@iterator"]==="function"){I="@@iterator"}var j=function(e,t){if(!t){t=function n(){return this}}var r={};r[I]=t;m(e,r);if(!e[I]&&b.symbol(I)){e[I]=t}};var O=function rt(e){var t=l(e);var r=t==="[object Arguments]";if(!r){r=t!=="[object Array]"&&e!==null&&typeof e==="object"&&typeof e.length==="number"&&e.length>=0&&l(e.callee)==="[object Function]"}return r};var _={RequireObjectCoercible:function(e,t){if(e==null){throw new TypeError(t||"Cannot call method on "+e)}},TypeIsObject:function(e){return e!=null&&Object(e)===e},ToObject:function(e,t){_.RequireObjectCoercible(e,t);return Object(e)},IsCallable:function(e){return typeof e==="function"&&l(e)==="[object Function]"},ToInt32:function(e){return _.ToNumber(e)>>0},ToUint32:function(e){return _.ToNumber(e)>>>0},ToNumber:function(e){if(l(e)==="[object Symbol]"){throw new TypeError("Cannot convert a Symbol value to a number")}return+e},ToInteger:function(e){var t=_.ToNumber(e);if(Number.isNaN(t)){return 0}if(t===0||!Number.isFinite(t)){return t}return(t>0?1:-1)*Math.floor(Math.abs(t))},ToLength:function(e){var t=_.ToInteger(e);if(t<=0){return 0}if(t>Number.MAX_SAFE_INTEGER){return Number.MAX_SAFE_INTEGER}return t},SameValue:function(e,t){if(e===t){if(e===0){return 1/e===1/t}return true}return Number.isNaN(e)&&Number.isNaN(t)},SameValueZero:function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)},IsIterable:function(e){return _.TypeIsObject(e)&&(typeof e[I]!=="undefined"||O(e))},GetIterator:function(e){if(O(e)){return new h(e,"value")}var t=e[I];if(!_.IsCallable(t)){throw new TypeError("value is not an iterable")}var r=t.call(e);if(!_.TypeIsObject(r)){throw new TypeError("bad iterator")}return r},IteratorNext:function(e){var t=arguments.length>1?e.next(arguments[1]):e.next();if(!_.TypeIsObject(t)){throw new TypeError("bad iterator")}return t},Construct:function(e,t){var r;if(_.IsCallable(e[y])){r=e[y]()}else{r=w(e.prototype||null)}m(r,{_es6construct:true});var n=e.apply(r,t);return _.TypeIsObject(n)?n:r}};var M=function(e){if(!_.TypeIsObject(e)){throw new TypeError("bad object")}if(!e._es6construct){if(e.constructor&&_.IsCallable(e.constructor[y])){e=e.constructor[y](e)}m(e,{_es6construct:true})}return e};var T=function(){function e(e){var t=Math.floor(e),r=e-t;if(r<.5){return t}if(r>.5){return t+1}return t%2?t+1:t}function t(t,r,n){var i=(1<<r-1)-1,o,a,u,s,f,l,c;if(t!==t){a=(1<<r)-1;u=Math.pow(2,n-1);o=0}else if(t===Infinity||t===-Infinity){a=(1<<r)-1;u=0;o=t<0?1:0}else if(t===0){a=0;u=0;o=1/t===-Infinity?1:0}else{o=t<0;t=Math.abs(t);if(t>=Math.pow(2,1-i)){a=Math.min(Math.floor(Math.log(t)/Math.LN2),1023);u=e(t/Math.pow(2,a)*Math.pow(2,n));if(u/Math.pow(2,n)>=2){a=a+1;u=1}if(a>i){a=(1<<r)-1;u=0}else{a=a+i;u=u-Math.pow(2,n)}}else{a=0;u=e(t/Math.pow(2,1-i-n))}}f=[];for(s=n;s;s-=1){f.push(u%2?1:0);u=Math.floor(u/2)}for(s=r;s;s-=1){f.push(a%2?1:0);a=Math.floor(a/2)}f.push(o?1:0);f.reverse();l=f.join("");c=[];while(l.length){c.push(parseInt(l.slice(0,8),2));l=l.slice(8)}return c}function r(e,t,r){var n=[],i,o,a,u,s,f,l,c;for(i=e.length;i;i-=1){a=e[i-1];for(o=8;o;o-=1){n.push(a%2?1:0);a=a>>1}}n.reverse();u=n.join("");s=(1<<t-1)-1;f=parseInt(u.slice(0,1),2)?-1:1;l=parseInt(u.slice(1,1+t),2);c=parseInt(u.slice(1+t),2);if(l===(1<<t)-1){return c!==0?NaN:f*Infinity}else if(l>0){return f*Math.pow(2,l-s)*(1+c/Math.pow(2,r))}else if(c!==0){return f*Math.pow(2,-(s-1))*(c/Math.pow(2,r))}else{return f<0?-0:0}}function n(e){return r(e,11,52)}function i(e){return t(e,11,52)}function o(e){return r(e,8,23)}function a(e){return t(e,8,23)}var u={toFloat32:function(e){return o(a(e))}};if(typeof Float32Array!=="undefined"){var s=new Float32Array(1);u.toFloat32=function(e){s[0]=e;return s[0]}}return u}();m(String,{fromCodePoint:function nt(e){var t=[];var r;for(var n=0,i=arguments.length;n<i;n++){r=Number(arguments[n]);if(!_.SameValue(r,_.ToInteger(r))||r<0||r>1114111){throw new RangeError("Invalid code point "+r)}if(r<65536){t.push(String.fromCharCode(r))}else{r-=65536;t.push(String.fromCharCode((r>>10)+55296));t.push(String.fromCharCode(r%1024+56320))}}return t.join("")},raw:function it(e){var t=_.ToObject(e,"bad callSite");var r=t.raw;var n=_.ToObject(r,"bad raw value");var i=n.length;var o=_.ToLength(i);if(o<=0){return""}var a=[];var u=0;var s,f,l,c;while(u<o){s=String(u);f=n[s];l=String(f);a.push(l);if(u+1>=o){break}f=u+1<arguments.length?arguments[u+1]:"";c=String(f);a.push(c);u++}return a.join("")}});if(String.fromCodePoint.length!==1){var N=Function.apply.bind(String.fromCodePoint);d(String,"fromCodePoint",function ot(e){return N(this,arguments)},true)}var E={repeat:function(){var e=function(t,r){if(r<1){return""}if(r%2){return e(t,r-1)+t}var n=e(t,r/2);return n+n};return function(t){_.RequireObjectCoercible(this);var r=String(this);t=_.ToInteger(t);if(t<0||t===Infinity){throw new RangeError("Invalid String#repeat value")}return e(r,t)}}(),startsWith:function(e){_.RequireObjectCoercible(this);var t=String(this);if(b.regex(e)){throw new TypeError('Cannot call method "startsWith" with a regex')}e=String(e);var r=arguments.length>1?arguments[1]:void 0;var n=Math.max(_.ToInteger(r),0);return t.slice(n,n+e.length)===e},endsWith:function(e){_.RequireObjectCoercible(this);var t=String(this);if(b.regex(e)){throw new TypeError('Cannot call method "endsWith" with a regex')}e=String(e);var r=t.length;var n=arguments.length>1?arguments[1]:void 0;var i=typeof n==="undefined"?r:_.ToInteger(n);var o=Math.min(Math.max(i,0),r);return t.slice(o-e.length,o)===e},includes:function at(e){var t=arguments.length>1?arguments[1]:void 0;return f(this,e,t)!==-1},codePointAt:function(e){_.RequireObjectCoercible(this);var t=String(this);var r=_.ToInteger(e);var n=t.length;if(r>=0&&r<n){var i=t.charCodeAt(r);var o=r+1===n;if(i<55296||i>56319||o){return i}var a=t.charCodeAt(r+1);if(a<56320||a>57343){return i}return(i-55296)*1024+(a-56320)+65536}}};m(String.prototype,E);var S="\x85".trim().length!==1;if(S){delete String.prototype.trim;var x=[" \n\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003","\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028","\u2029\ufeff"].join("");var C=new RegExp("(^["+x+"]+)|(["+x+"]+$)","g");m(String.prototype,{trim:function(){if(typeof this==="undefined"||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(C,"")}})}var P=function(e){_.RequireObjectCoercible(e);this._s=String(e);this._i=0};P.prototype.next=function(){var e=this._s,t=this._i;if(typeof e==="undefined"||t>=e.length){this._s=void 0;return{value:void 0,done:true}}var r=e.charCodeAt(t),n,i;if(r<55296||r>56319||t+1===e.length){i=1}else{n=e.charCodeAt(t+1);i=n<56320||n>57343?1:2}this._i=t+i;return{value:e.substr(t,i),done:false}};j(P.prototype);j(String.prototype,function(){return new P(this)});if(!s){m(String.prototype,{startsWith:E.startsWith,endsWith:E.endsWith})}var k={from:function(e){var t=arguments.length>1?arguments[1]:void 0;var r=_.ToObject(e,"bad iterable");if(typeof t!=="undefined"&&!_.IsCallable(t)){throw new TypeError("Array.from: when provided, the second argument must be a function")}var n=arguments.length>2;var i=n?arguments[2]:void 0;var o=_.IsIterable(r);var a;var u,s,f;if(o){s=0;u=_.IsCallable(this)?Object(new this):[];var l=o?_.GetIterator(r):null;var c;do{c=_.IteratorNext(l);if(!c.done){f=c.value;if(t){u[s]=n?t.call(i,f,s):t(f,s)}else{u[s]=f}s+=1}}while(!c.done);a=s}else{a=_.ToLength(r.length);u=_.IsCallable(this)?Object(new this(a)):new Array(a);for(s=0;s<a;++s){f=r[s];if(t){u[s]=n?t.call(i,f,s):t(f,s)}else{u[s]=f}}}u.length=a;return u},of:function(){return Array.from(arguments)}};m(Array,k);var A=function(){try{return Array.from({length:-1}).length===0}catch(e){return false}};if(!A()){d(Array,"from",k.from,true)}h=function(e,t){this.i=0;this.array=e;this.kind=t};m(h.prototype,{next:function(){var e=this.i,t=this.array;if(!(this instanceof h)){throw new TypeError("Not an ArrayIterator")}if(typeof t!=="undefined"){var r=_.ToLength(t.length);for(;e<r;e++){var n=this.kind;var i;if(n==="key"){i=e}else if(n==="value"){i=t[e]}else if(n==="entry"){i=[e,t[e]]}this.i=e+1;return{value:i,done:false}}}this.array=void 0;return{value:void 0,done:true}}});j(h.prototype);var R={copyWithin:function(e,t){var r=arguments[2];var n=_.ToObject(this);var i=_.ToLength(n.length);e=_.ToInteger(e);t=_.ToInteger(t);var o=e<0?Math.max(i+e,0):Math.min(e,i);var a=t<0?Math.max(i+t,0):Math.min(t,i);r=typeof r==="undefined"?i:_.ToInteger(r);var u=r<0?Math.max(i+r,0):Math.min(r,i);var s=Math.min(u-a,i-o);var f=1;if(a<o&&o<a+s){f=-1;a+=s-1;o+=s-1}while(s>0){if(c(n,a)){n[o]=n[a]}else{delete n[a]}a+=f;o+=f;s-=1}return n},fill:function(e){var t=arguments.length>1?arguments[1]:void 0;var r=arguments.length>2?arguments[2]:void 0;var n=_.ToObject(this);var i=_.ToLength(n.length);t=_.ToInteger(typeof t==="undefined"?0:t);r=_.ToInteger(typeof r==="undefined"?i:r);var o=t<0?Math.max(i+t,0):Math.min(t,i);var a=r<0?i+r:r;for(var u=o;u<i&&u<a;++u){n[u]=e}return n},find:function ut(e){var t=_.ToObject(this);var r=_.ToLength(t.length);if(!_.IsCallable(e)){throw new TypeError("Array#find: predicate must be a function")}var n=arguments.length>1?arguments[1]:null;for(var i=0,o;i<r;i++){o=t[i];if(n){if(e.call(n,o,i,t)){return o}}else if(e(o,i,t)){return o}}},findIndex:function st(e){var t=_.ToObject(this);var r=_.ToLength(t.length);if(!_.IsCallable(e)){throw new TypeError("Array#findIndex: predicate must be a function")}var n=arguments.length>1?arguments[1]:null;for(var i=0;i<r;i++){if(n){if(e.call(n,t[i],i,t)){return i}}else if(e(t[i],i,t)){return i}}return-1},keys:function(){return new h(this,"key")},values:function(){return new h(this,"value")},entries:function(){return new h(this,"entry")}};if(Array.prototype.keys&&!_.IsCallable([1].keys().next)){delete Array.prototype.keys}if(Array.prototype.entries&&!_.IsCallable([1].entries().next)){delete Array.prototype.entries}if(Array.prototype.keys&&Array.prototype.entries&&!Array.prototype.values&&Array.prototype[I]){m(Array.prototype,{values:Array.prototype[I]});if(b.symbol(v.unscopables)){Array.prototype[v.unscopables].values=true}}m(Array.prototype,R);j(Array.prototype,function(){return this.values()});if(Object.getPrototypeOf){j(Object.getPrototypeOf([].values()))}var F=Math.pow(2,53)-1;m(Number,{MAX_SAFE_INTEGER:F,MIN_SAFE_INTEGER:-F,EPSILON:2.220446049250313e-16,parseInt:o.parseInt,parseFloat:o.parseFloat,isFinite:function(e){return typeof e==="number"&&a(e)},isInteger:function(e){return Number.isFinite(e)&&_.ToInteger(e)===e},isSafeInteger:function(e){return Number.isInteger(e)&&Math.abs(e)<=Number.MAX_SAFE_INTEGER},isNaN:function(e){return e!==e}});if(![,1].find(function(e,t){return t===0})){d(Array.prototype,"find",R.find,true)}if([,1].findIndex(function(e,t){return t===0})!==0){d(Array.prototype,"findIndex",R.findIndex,true)}if(u){m(Object,{assign:function(e,t){if(!_.TypeIsObject(e)){throw new TypeError("target must be an object")}return Array.prototype.reduce.call(arguments,function(e,t){return Object.keys(Object(t)).reduce(function(e,r){e[r]=t[r];return e},e)})},is:function(e,t){return _.SameValue(e,t)},setPrototypeOf:function(e,t){var r;var n=function(e,t){if(!_.TypeIsObject(e)){throw new TypeError("cannot set prototype on a non-object")}if(!(t===null||_.TypeIsObject(t))){throw new TypeError("can only set prototype to an object or null"+t)}};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]){return}r=function(e){this[t]=e};i.polyfill=i(i({},null),e.prototype)instanceof e}return i}(Object,"__proto__")})}if(Object.setPrototypeOf&&Object.getPrototypeOf&&Object.getPrototypeOf(Object.setPrototypeOf({},null))!==null&&Object.getPrototypeOf(Object.create(null))===null){(function(){var e=Object.create(null);var t=Object.getPrototypeOf,r=Object.setPrototypeOf;Object.getPrototypeOf=function(r){var n=t(r);return n===e?null:n};Object.setPrototypeOf=function(t,n){if(n===null){n=e}return r(t,n)};Object.setPrototypeOf.polyfill=false})()}try{Object.keys("foo")}catch(z){var L=Object.keys;Object.keys=function(e){return L(_.ToObject(e))}}if(!RegExp.prototype.flags&&u){var D=function ft(){if(!_.TypeIsObject(this)){throw new TypeError("Method called on incompatible type: must be an object.")}var e="";if(this.global){e+="g"}if(this.ignoreCase){e+="i"}if(this.multiline){e+="m"}if(this.unicode){e+="u"}if(this.sticky){e+="y"}return e};g.getter(RegExp.prototype,"flags",D)}var q=function(){try{return String(new RegExp(/a/g,"i"))==="/a/i"}catch(e){return false}}();if(!q&&u){var G=RegExp;var W=function lt(e,t){if(b.regex(e)&&b.string(t)){return new lt(e.source,t)}return new G(e,t)};d(W,"toString",G.toString.bind(G),true);if(Object.setPrototypeOf){Object.setPrototypeOf(G,W)}Object.getOwnPropertyNames(G).forEach(function(e){if(e==="$input"){return}if(e in p){return}g.proxy(G,e,W)});W.prototype=G.prototype;g.redefine(G.prototype,"constructor",W);RegExp=W;g.redefine(o,"RegExp",W)}var V={acosh:function(e){var t=Number(e);if(Number.isNaN(t)||e<1){return NaN}if(t===1){return 0}if(t===Infinity){return t}return Math.log(t/Math.E+Math.sqrt(t+1)*Math.sqrt(t-1)/Math.E)+1},asinh:function(e){e=Number(e);if(e===0||!a(e)){return e}return e<0?-Math.asinh(-e):Math.log(e+Math.sqrt(e*e+1))},atanh:function(e){e=Number(e);if(Number.isNaN(e)||e<-1||e>1){return NaN}if(e===-1){return-Infinity}if(e===1){return Infinity}if(e===0){return e}return.5*Math.log((1+e)/(1-e))},cbrt:function(e){e=Number(e);if(e===0){return e}var t=e<0,r;if(t){e=-e}r=Math.pow(e,1/3);return t?-r:r},clz32:function(e){e=Number(e);var t=_.ToUint32(e);if(t===0){return 32}return 32-t.toString(2).length},cosh:function(e){e=Number(e);if(e===0){return 1}if(Number.isNaN(e)){return NaN}if(!a(e)){return Infinity}if(e<0){e=-e}if(e>21){return Math.exp(e)/2}return(Math.exp(e)+Math.exp(-e))/2},expm1:function(e){var t=Number(e);if(t===-Infinity){return-1}if(!a(t)||e===0){return t}if(Math.abs(t)>.5){return Math.exp(t)-1}var r=t;var n=0;var i=1;while(n+r!==n){n+=r;i+=1;r*=t/i}return n},hypot:function(e,t){var r=false;var n=true;var i=false;var o=[];Array.prototype.every.call(arguments,function(e){var t=Number(e);if(Number.isNaN(t)){r=true}else if(t===Infinity||t===-Infinity){i=true}else if(t!==0){n=false}if(i){return false}else if(!r){o.push(Math.abs(t))}return true});if(i){return Infinity}if(r){return NaN}if(n){return 0}o.sort(function(e,t){return t-e});var a=o[0];var u=o.map(function(e){return e/a});var s=u.reduce(function(e,t){return e+t*t},0);return a*Math.sqrt(s)},log2:function(e){return Math.log(e)*Math.LOG2E},log10:function(e){return Math.log(e)*Math.LOG10E},log1p:function(e){var t=Number(e);if(t<-1||Number.isNaN(t)){return NaN}if(t===0||t===Infinity){return t}if(t===-1){return-Infinity}return 1+t-1===0?t:t*(Math.log(1+t)/(1+t-1))},sign:function(e){var t=+e;if(t===0){return t}if(Number.isNaN(t)){return t}return t<0?-1:1},sinh:function(e){var t=Number(e);if(!a(e)||e===0){return e}if(Math.abs(t)<1){return(Math.expm1(t)-Math.expm1(-t))/2}return(Math.exp(t-1)-Math.exp(-t-1))*Math.E/2},tanh:function(e){var t=Number(e);if(Number.isNaN(e)||t===0){return t}if(t===Infinity){return 1}if(t===-Infinity){return-1}var r=Math.expm1(t);var n=Math.expm1(-t);if(r===Infinity){return 1}if(n===Infinity){return-1}return(r-n)/(Math.exp(t)+Math.exp(-t))},trunc:function(e){var t=Number(e);return t<0?-Math.floor(-t):Math.floor(t)},imul:function(e,t){e=_.ToUint32(e);t=_.ToUint32(t);var r=e>>>16&65535;var n=e&65535;var i=t>>>16&65535;var o=t&65535;return n*o+(r*o+n*i<<16>>>0)|0},fround:function(e){if(e===0||e===Infinity||e===-Infinity||Number.isNaN(e)){return e}var t=Number(e);return T.toFloat32(t)}};m(Math,V);d(Math,"tanh",V.tanh,Math.tanh(-2e-17)!==-2e-17);d(Math,"acosh",V.acosh,Math.acosh(Number.MAX_VALUE)===Infinity);var U=Math.round(.5-Number.EPSILON/4)===0&&Math.round(-.5+Number.EPSILON/3.99)===1;var X=Math.round;d(Math,"round",function ct(e){if(-.5<=e&&e<.5&&e!==0){return Math.sign(e*0)}return X(e)},!U);if(Math.imul(4294967295,5)!==-5){Math.imul=V.imul}var Z=function(){var e,t;_.IsPromise=function(e){if(!_.TypeIsObject(e)){return false}if(!e._promiseConstructor){return false}if(typeof e._status==="undefined"){return false}return true};var r=function(e){if(!_.IsCallable(e)){throw new TypeError("bad promise constructor")}var t=this;var r=function(e,r){t.resolve=e;t.reject=r};t.promise=_.Construct(e,[r]);if(!t.promise._es6construct){throw new TypeError("bad promise constructor")}if(!(_.IsCallable(t.resolve)&&_.IsCallable(t.reject))){throw new TypeError("bad promise constructor")}};var n=o.setTimeout;var i;if(typeof window!=="undefined"&&_.IsCallable(window.postMessage)){i=function(){var e=[];var t="zero-timeout-message";var r=function(r){e.push(r);window.postMessage(t,"*")};var n=function(r){if(r.source===window&&r.data===t){r.stopPropagation();if(e.length===0){return}var n=e.shift();n()}};window.addEventListener("message",n,true);return r}}var a=function(){var e=o.Promise;return e&&e.resolve&&function(t){return e.resolve().then(t)}};var u=_.IsCallable(o.setImmediate)?o.setImmediate.bind(o):typeof process==="object"&&process.nextTick?process.nextTick:a()||(_.IsCallable(i)?i():function(e){n(e,0)});var s=function(e,t){if(!_.TypeIsObject(e)){return false}var r=t.resolve;var n=t.reject;try{var i=e.then;if(!_.IsCallable(i)){return false}i.call(e,r,n)}catch(o){n(o)}return true};var f=function(e,t){e.forEach(function(e){u(function(){var r=e.handler;var n=e.capability;var i=n.resolve;var o=n.reject;try{var a=r(t);if(a===n.promise){throw new TypeError("self resolution")}var u=s(a,n);if(!u){i(a)}}catch(f){o(f)}})})};var l=function(e,t,n){return function(i){if(i===e){return n(new TypeError("self resolution"))}var o=e._promiseConstructor;var a=new r(o);var u=s(i,a);if(u){return a.promise.then(t,n)}else{return t(i)}}};e=function(e){var t=this;t=M(t);if(!t._promiseConstructor){throw new TypeError("bad promise")}if(typeof t._status!=="undefined"){throw new TypeError("promise already initialized")}if(!_.IsCallable(e)){throw new TypeError("not a valid resolver")}t._status="unresolved";t._resolveReactions=[];t._rejectReactions=[];var r=function(e){if(t._status!=="unresolved"){return}var r=t._resolveReactions;t._result=e;t._resolveReactions=void 0;t._rejectReactions=void 0;t._status="has-resolution";f(r,e)};var n=function(e){if(t._status!=="unresolved"){return}var r=t._rejectReactions;t._result=e;t._resolveReactions=void 0;t._rejectReactions=void 0;t._status="has-rejection";f(r,e)};try{e(r,n)}catch(i){n(i)}return t};t=e.prototype;var c=function(e,t,r,n){var i=false;return function(o){if(i){return}i=true;t[e]=o;if(--n.count===0){var a=r.resolve;a(t)}}};d(e,y,function(e){var r=this;var n=r.prototype||t;e=e||w(n);m(e,{_status:void 0,_result:void 0,_resolveReactions:void 0,_rejectReactions:void 0,_promiseConstructor:void 0});e._promiseConstructor=r;return e});m(e,{all:function h(e){var t=this;var n=new r(t);var i=n.resolve;var o=n.reject;try{if(!_.IsIterable(e)){throw new TypeError("bad iterable")}var a=_.GetIterator(e);var u=[],s={count:1};for(var f=0;;f++){var l=_.IteratorNext(a);if(l.done){break}var h=t.resolve(l.value);var p=c(f,u,n,s);s.count++;h.then(p,n.reject)}if(--s.count===0){i(u)}}catch(v){o(v)}return n.promise},race:function p(e){var t=this;var n=new r(t);var i=n.resolve;var o=n.reject;try{if(!_.IsIterable(e)){throw new TypeError("bad iterable")}var a=_.GetIterator(e);while(true){var u=_.IteratorNext(a);if(u.done){break}var s=t.resolve(u.value);s.then(i,o)}}catch(f){o(f)}return n.promise},reject:function v(e){var t=this;var n=new r(t);var i=n.reject;i(e);return n.promise},resolve:function b(e){var t=this;if(_.IsPromise(e)){var n=e._promiseConstructor;if(n===t){return e}}var i=new r(t);var o=i.resolve;o(e);return i.promise}});m(t,{"catch":function(e){return this.then(void 0,e)},then:function g(e,t){var n=this;if(!_.IsPromise(n)){throw new TypeError("not a promise")}var i=this.constructor;var o=new r(i);if(!_.IsCallable(t)){t=function(e){throw e}}if(!_.IsCallable(e)){e=function(e){return e}}var a=l(n,e,t);var u={capability:o,handler:a};var s={capability:o,handler:t};switch(n._status){case"unresolved":n._resolveReactions.push(u);n._rejectReactions.push(s);break;case"has-resolution":f([u],n._result);break;case"has-rejection":f([s],n._result);break;default:throw new TypeError("unexpected")}return o.promise}});return e}();if(o.Promise){delete o.Promise.accept;delete o.Promise.defer;delete o.Promise.prototype.chain}m(o,{Promise:Z});var $=t(o.Promise,function(e){return e.resolve(42)instanceof e});var B=function(){try{o.Promise.reject(42).then(null,5).then(null,p);return true}catch(e){return false}}();var H=function(){try{Promise.call(3,p)}catch(e){return true}return false}();if(!$||!B||!H){Promise=Z;d(o,"Promise",Z,true)}var J=function(e){var t=Object.keys(e.reduce(function(e,t){e[t]=true;return e},{}));return e.join(":")===t.join(":")};var K=J(["z","a","bb"]);var Q=J(["z",1,"a","3",2]);if(u){var Y=function ht(e){if(!K){return null}var t=typeof e;if(t==="string"){return"$"+e}else if(t==="number"){if(!Q){return"n"+e}return e}return null};var et=function pt(){return Object.create?Object.create(null):{}};var tt={Map:function(){var e={};function t(e,t){this.key=e;this.value=t;this.next=null;this.prev=null}t.prototype.isRemoved=function(){return this.key===e};function r(e,t){this.head=e._head;this.i=this.head;this.kind=t}r.prototype={next:function(){var e=this.i,t=this.kind,r=this.head,n;if(typeof this.i==="undefined"){return{value:void 0,done:true}}while(e.isRemoved()&&e!==r){e=e.prev}while(e.next!==r){e=e.next;if(!e.isRemoved()){if(t==="key"){n=e.key}else if(t==="value"){n=e.value}else{n=[e.key,e.value]}this.i=e;return{value:n,done:false}}}this.i=void 0;return{value:void 0,done:true}}};j(r.prototype);function n(e){var r=this;if(!_.TypeIsObject(r)){throw new TypeError("Map does not accept arguments when called as a function")}r=M(r);if(!r._es6map){throw new TypeError("bad map")}var n=new t(null,null);n.next=n.prev=n;m(r,{_head:n,_storage:et(),_size:0});if(typeof e!=="undefined"&&e!==null){var i=_.GetIterator(e);var o=r.set;if(!_.IsCallable(o)){throw new TypeError("bad map")}while(true){var a=_.IteratorNext(i);if(a.done){break}var u=a.value;if(!_.TypeIsObject(u)){throw new TypeError("expected iterable of pairs")}o.call(r,u[0],u[1])}}return r}var i=n.prototype;d(n,y,function(e){var t=this;var r=t.prototype||i;e=e||w(r);m(e,{_es6map:true});return e});g.getter(n.prototype,"size",function(){if(typeof this._size==="undefined"){throw new TypeError("size method called on incompatible Map")}return this._size});m(n.prototype,{get:function(e){var t=Y(e);if(t!==null){var r=this._storage[t];if(r){return r.value}else{return}}var n=this._head,i=n;while((i=i.next)!==n){if(_.SameValueZero(i.key,e)){return i.value}}},has:function(e){var t=Y(e);if(t!==null){return typeof this._storage[t]!=="undefined"}var r=this._head,n=r;while((n=n.next)!==r){if(_.SameValueZero(n.key,e)){return true}}return false},set:function(e,r){var n=this._head,i=n,o;var a=Y(e);if(a!==null){if(typeof this._storage[a]!=="undefined"){this._storage[a].value=r;return this}else{o=this._storage[a]=new t(e,r);i=n.prev}}while((i=i.next)!==n){if(_.SameValueZero(i.key,e)){i.value=r;return this}}o=o||new t(e,r);if(_.SameValue(-0,e)){o.key=+0}o.next=this._head;o.prev=this._head.prev;o.prev.next=o;o.next.prev=o;this._size+=1;return this},"delete":function(t){var r=this._head,n=r;var i=Y(t);if(i!==null){if(typeof this._storage[i]==="undefined"){return false}n=this._storage[i].prev;delete this._storage[i]}while((n=n.next)!==r){if(_.SameValueZero(n.key,t)){n.key=n.value=e;n.prev.next=n.next;n.next.prev=n.prev;this._size-=1;return true}}return false},clear:function(){this._size=0;this._storage=et();var t=this._head,r=t,n=r.next;while((r=n)!==t){r.key=r.value=e;n=r.next;r.next=r.prev=t}t.next=t.prev=t},keys:function(){return new r(this,"key")},values:function(){return new r(this,"value")},entries:function(){return new r(this,"key+value")},forEach:function(e){var t=arguments.length>1?arguments[1]:null;var r=this.entries();for(var n=r.next();!n.done;n=r.next()){if(t){e.call(t,n.value[1],n.value[0],this)}else{e(n.value[1],n.value[0],this)}}}});j(n.prototype,function(){return this.entries()});return n}(),Set:function(){var e=function n(e){var t=this;if(!_.TypeIsObject(t)){throw new TypeError("Set does not accept arguments when called as a function")}t=M(t);if(!t._es6set){throw new TypeError("bad set")}m(t,{"[[SetData]]":null,_storage:et()});if(typeof e!=="undefined"&&e!==null){var r=_.GetIterator(e);var n=t.add;if(!_.IsCallable(n)){throw new TypeError("bad set")}while(true){var i=_.IteratorNext(r);if(i.done){break}var o=i.value;n.call(t,o)}}return t};var t=e.prototype;d(e,y,function(e){var r=this;var n=r.prototype||t;e=e||w(n);m(e,{_es6set:true});return e});var r=function i(e){if(!e["[[SetData]]"]){var t=e["[[SetData]]"]=new tt.Map;Object.keys(e._storage).forEach(function(e){if(e.charCodeAt(0)===36){e=e.slice(1)}else if(e.charAt(0)==="n"){e=+e.slice(1)}else{e=+e}t.set(e,e)});e._storage=null}};g.getter(e.prototype,"size",function(){if(typeof this._storage==="undefined"){throw new TypeError("size method called on incompatible Set")}r(this);return this["[[SetData]]"].size});m(e.prototype,{has:function(e){var t;if(this._storage&&(t=Y(e))!==null){return!!this._storage[t]}r(this);return this["[[SetData]]"].has(e)},add:function(e){var t;if(this._storage&&(t=Y(e))!==null){this._storage[t]=true;return this}r(this);this["[[SetData]]"].set(e,e);return this},"delete":function(e){var t;if(this._storage&&(t=Y(e))!==null){var n=c(this._storage,t);return delete this._storage[t]&&n}r(this);return this["[[SetData]]"]["delete"](e)},clear:function(){if(this._storage){this._storage=et()}else{this["[[SetData]]"].clear()}},values:function(){r(this);return this["[[SetData]]"].values()},entries:function(){r(this);return this["[[SetData]]"].entries()},forEach:function(e){var t=arguments.length>1?arguments[1]:null;var n=this;r(n);this["[[SetData]]"].forEach(function(r,i){if(t){e.call(t,i,i,n)}else{e(i,i,n)}})}});d(e,"keys",e.values,true);j(e.prototype,function(){return this.values()});return e}()};m(o,tt);if(o.Map||o.Set){if(typeof o.Map.prototype.clear!=="function"||(new o.Set).size!==0||(new o.Map).size!==0||typeof o.Map.prototype.keys!=="function"||typeof o.Set.prototype.keys!=="function"||typeof o.Map.prototype.forEach!=="function"||typeof o.Set.prototype.forEach!=="function"||e(o.Map)||e(o.Set)||!t(o.Map,function(e){var t=new e([]);t.set(42,42);return t instanceof e})){o.Map=tt.Map;o.Set=tt.Set}}if(o.Set.prototype.keys!==o.Set.prototype.values){d(o.Set.prototype,"keys",o.Set.prototype.values,true)}j(Object.getPrototypeOf((new o.Map).keys()));j(Object.getPrototypeOf((new o.Set).keys()))}return o});
|
||
//# sourceMappingURL=es6-shim.map
|