!function(t){"object"==typeof module&&"object"==typeof module.exports?t(require,exports):"function"==typeof define&&define.amd&&define(["require","exports"],t)}(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n="fulfilled",r="pending",o="rejected",i=(s.attempt=function(e){return new s(function(t){t(e())})},s.race=function(i){return new s(function(t,e){for(var n=0,r=i;n<r.length;n++){var o=r[n];"object"==typeof o&&"function"==typeof o.then?o.then(t,e):t(o)}})},s.prototype.finally=function(e){function n(t){return Promise.resolve(e()).then(t)}return this.then(function(t){return n(function(){return t})},function(t){return n(function(){return Promise.reject(t)})})},s.prototype.then=function(e,n){function r(t){return i._state="fulfilled",i._value=t,e(t)}function o(t){return i._state="rejected",i._reason=t,n(t)}var i=this;return new s(function(t){return t(i._promise.then(r,o))})},s.prototype.isFulfilled=function(){return this._state===n},s.prototype.isPending=function(){return this._state===r},s.prototype.isRejected=function(){return this._state===o},s.prototype.isResolved=function(){return this._state!==r},s.prototype.reason=function(){if(this._state!==o)throw new Error("Attempting to read failure reason from a Task that is not rejected. This Task is "+this._state+".");return this._reason},s.prototype.value=function(){if(this._state!==n)throw new Error("Attempting to read value from a Task that is not resolved. This Task is "+this._state+".");return this._value},s);function s(t){this._promise=new Promise(t),this._state="pending"}e.Task=i});