(function(){"use strict";function t(t){return"function"==typeof t}function e(){return function(){setTimeout(n,1)}}function n(){for(var t=0;g>t;t+=2){(0,P[t])(P[t+1]),P[t]=void 0,P[t+1]=void 0}g=0}function r(){}function o(t){try{return t.then}catch(t){return F.error=t,F}}function i(e,n,r){n.constructor===e.constructor&&r===x&&constructor.resolve===C?function(t,e){e._state===k?c(t,e._result):e._state===q?a(t,e._result):f(e,void 0,(function(e){s(t,e)}),(function(e){a(t,e)}))}(e,n):r===F?a(e,F.error):void 0===r?c(e,n):t(r)?function(t,e,n){A((function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,(function(n){r||(r=!0,e!==n?s(t,n):c(t,n))}),(function(e){r||(r=!0,a(t,e))}),t._label);!r&&o&&(r=!0,a(t,o))}),t)}(e,n,r):c(e,n)}function s(t,e){t===e?a(t,new TypeError("You cannot resolve a promise with itself")):function(t){return"function"==typeof t||"object"==typeof t&&null!==t}(e)?i(t,e,o(e)):c(t,e)}function u(t){t._onerror&&t._onerror(t._result),l(t)}function c(t,e){t._state===Y&&(t._result=e,t._state=k,0!==t._subscribers.length&&A(l,t))}function a(t,e){t._state===Y&&(t._state=q,t._result=e,A(u,t))}function f(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+k]=n,o[i+q]=r,0===i&&t._state&&A(l,t)}function l(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;si;i++)e.resolve(t[i]).then(n,r)}:function(t,e){e(new TypeError("You must pass an array to race."))})},U=function(t){var e=new this(r);return a(e,t),e},W=d;d.all=L,d.race=N,d.resolve=C,d.reject=U,d._setScheduler=function(t){m=t},d._setAsap=function(t){A=t},d._asap=A,d.prototype={constructor:d,then:x,catch:function(t){return this.then(null,t)}};var z=v;v.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===Y&&t>n;n++)this._eachEntry(e[n],n)},v.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,s=n.resolve;if(s===C){var u=o(t);if(u===x&&t._state!==Y)this._settledAt(t._state,e,t._result);else if("function"!=typeof u)this._remaining--,this._result[e]=t;else if(n===W){var c=new n(r);i(c,t,u),this._willSettleAt(c,e)}else this._willSettleAt(new n((function(e){e(t)})),e)}else this._willSettleAt(s(t),e)},v.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===Y&&(this._remaining--,t===q?a(r,n):this._result[e]=n),0===this._remaining&&c(r,this._result)},v.prototype._willSettleAt=function(t,e){var n=this;f(t,void 0,(function(t){n._settledAt(k,e,t)}),(function(t){n._settledAt(q,e,t)}))};var B=function(){var t;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;(!e||"[object Promise]"!==Object.prototype.toString.call(e.resolve())||e.cast)&&(t.Promise=W)},G={Promise:W,polyfill:B};"function"==typeof define&&define.amd?define((function(){return G})):"undefined"!=typeof module&&module.exports?module.exports=G:void 0!==this&&(this.ES6Promise=G),B()}).call(this);