!function(e,n){"object"==typeofexports&&"undefined"!=typeofmodule?n():"function"==typeofdefine&&define.amd?define(n):n()}(0,function(){"use strict";functione(e){varn=this.constructor;returnthis.then(function(t){returnn.resolve(e()).then(function(){returnt})},function(t){returnn.resolve(e()).then(function(){returnn.reject(t)})})}functionn(){}functiont(e){if(!(thisinstanceoft))thrownewTypeError("Promises must be constructed via new");if("function"!=typeofe)thrownewTypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],u(e,this)}functiono(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,t._immediateFn(function(){vart=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){varo;try{o=t(e._value)}catch(f){returnvoidi(n.promise,f)}r(n.promise,o)}else(1===e._state?r:i)(n.promise,e._value)})):e._deferreds.push(n)}functionr(e,n){try{if(n===e)thrownewTypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeofn||"function"==typeofn)){varo=n.then;if(ninstanceoft)returne._state=3,e._value=n,voidf(e);if("function"==typeofo)returnvoidu(function(e,n){returnfunction(){e.apply(n,arguments)}}(o,n),e)}e._state=1,e._value=n,f(e)}catch(r){i(e,r)}}functioni(e,n){e._state=2,e._value=n,f(e)}functionf(e){2===e._state&&0===e._deferreds.length&&t._immediateFn(function(){e._handled||t._unhandledRejectionFn(e._value)});for(varn=0,r=e._deferreds.length;r>n;n++)o(e,e._deferreds[n]);e._deferreds=null}functionu(e,n){vart=!1;try{e(function(e){t||(t=!0,r(n,e))},function(e){t||(t=!0,i(n,e))})}catch(o){if(t)return;t=!0,i(n,o)}}varc=setTimeout;t.prototype["catch"]=function(e){returnthis.then(null,e)},t.prototype.then=function(e,t){varr=newthis.constructor(n);returno(this,newfunction(e,n,t){this.onFulfilled="function"==typeofe?e:null,this.onRejected="function"==typeofn?n:null,this.promise=t}(e,t,r)),r},t.prototype["finally"]=e,t.all=function(e){returnnewt(function(n,t){functiono(e,f){try{if(f&&("object"==typeoff||"function"==typeoff)){varu=f.then;if("function"==typeofu)returnvoidu.call(f,function(n){o(e,n)},t)}r[e]=f,0==--i&&n(r)}catch(c){t(c)}}if(!e||"undefined"==typeofe.length)thrownewTypeError("Promise.all accepts an array");varr=Array.prototype.slice.call(e);if(0===r.length)returnn([]);for(vari=r.length,f=0;r.length>f;f++)o(f,r[f])})},t.resolve=function(e){returne&&"object"==typeofe&&e.constructor===t?e:newt(function(n){n(e)})},t.reject=function(e){returnnewt(function(n,t){t(e)})},t.race=function(e){returnnewt(function(n,t){for(varo=0,r=e.length;r>o;o++)e[o].then(n,t)})},t._immediateFn="function"==typeofsetImmediate&&function(e){setImmediate(e)}||function(e){c(e,0)},t._unhandledRejectionFn=function(e){void0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};varl=function(){if("undefined"!=typeofself)returnself;if("undefined"!=typeofwindow)returnwindow;if("undefined"!=typeofglobal)returnglobal;throwError("unable to locate global object")}();"Promise"inl?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=t});