!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function f(n){var t=this.constructor;return this.then(function(i){return t.resolve(n()).then(function(){return i})},function(i){return t.resolve(n()).then(function(){return t.reject(i)})})}function e(n){return new this(function(t,i){function e(n,i){if(i&&("object"==typeof i||"function"==typeof i)){var u=i.then;if("function"==typeof u)return void u.call(i,function(t){e(n,t)},function(i){r[n]={status:"rejected",reason:i};0==--f&&t(r)})}r[n]={status:"fulfilled",value:i};0==--f&&t(r)}var r,f,u;if(!n||"undefined"==typeof n.length)return i(new TypeError(typeof n+" "+n+" is not iterable(cannot read property Symbol(Symbol.iterator))"));if(r=Array.prototype.slice.call(n),0===r.length)return t([]);for(f=r.length,u=0;r.length>u;u++)e(u,r[u])})}function o(n){return!(!n||"undefined"==typeof n.length)}function l(){}function n(t){if(!(this instanceof n))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0;this._handled=!1;this._value=undefined;this._deferreds=[];h(t,this)}function s(t,u){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,n._immediateFn(function(){var n=1===t._state?u.onFulfilled:u.onRejected,f;if(null!==n){try{f=n(t._value)}catch(e){return void i(u.promise,e)}r(u.promise,f)}else(1===t._state?r:i)(u.promise,t._value)})):t._deferreds.push(u)}function r(t,r){try{if(r===t)throw new TypeError("A promise cannot be resolved with itself.");if(r&&("object"==typeof r||"function"==typeof r)){var f=r.then;if(r instanceof n)return t._state=3,t._value=r,void u(t);if("function"==typeof f)return void h(function(n,t){return function(){n.apply(t,arguments)}}(f,r),t)}t._state=1;t._value=r;u(t)}catch(e){i(t,e)}}function i(n,t){n._state=2;n._value=t;u(n)}function u(t){2===t._state&&0===t._deferreds.length&&n._immediateFn(function(){t._handled||n._unhandledRejectionFn(t._value)});for(var i=0,r=t._deferreds.length;r>i;i++)s(t,t._deferreds[i]);t._deferreds=null}function h(n,t){var u=!1;try{n(function(n){u||(u=!0,r(t,n))},function(n){u||(u=!0,i(t,n))})}catch(f){if(u)return;u=!0;i(t,f)}}var a=setTimeout,c="undefined"!=typeof setImmediate?setImmediate:null,t;n.prototype["catch"]=function(n){return this.then(null,n)};n.prototype.then=function(n,t){var i=new this.constructor(l);return s(this,new function(n,t,i){this.onFulfilled="function"==typeof n?n:null;this.onRejected="function"==typeof t?t:null;this.promise=i}(n,t,i)),i};n.prototype["finally"]=f;n.all=function(t){return new n(function(n,i){function f(t,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var o=u.then;if("function"==typeof o)return void o.call(u,function(n){f(t,n)},i)}r[t]=u;0==--e&&n(r)}catch(s){i(s)}}var r,e,u;if(!o(t))return i(new TypeError("Promise.all accepts an array"));if(r=Array.prototype.slice.call(t),0===r.length)return n([]);for(e=r.length,u=0;r.length>u;u++)f(u,r[u])})};n.allSettled=e;n.resolve=function(t){return t&&"object"==typeof t&&t.constructor===n?t:new n(function(n){n(t)})};n.reject=function(t){return new n(function(n,i){i(t)})};n.race=function(t){return new n(function(i,r){if(!o(t))return r(new TypeError("Promise.race accepts an array"));for(var u=0,f=t.length;f>u;u++)n.resolve(t[u]).then(i,r)})};n._immediateFn="function"==typeof c&&function(n){c(n)}||function(n){a(n,0)};n._unhandledRejectionFn=function(n){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",n)};t=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object");}();"function"!=typeof t.Promise?t.Promise=n:(t.Promise.prototype["finally"]||(t.Promise.prototype["finally"]=f),t.Promise.allSettled||(t.Promise.allSettled=e))})