!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){W=t}function r(t){z=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof U?function(){U(a)}:c()}function s(){var t=0,e=new H(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<N;t+=2){var e=Q[t],n=Q[t+1];e(n),Q[t]=void 0,Q[t+1]=void 0}N=0}function f(){try{var t=Function("return this")().require("vertx");return U=t.runOnLoop||t.runOnContext,i()}catch(e){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[V]&&x(r);var o=n._state;if(o){var i=arguments[o-1];z(function(){return T(o,r,i,n._result)})}else j(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return w(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function y(t,e,n){z(function(t){var r=!1,o=_(n,e,function(n){r||(r=!0,e!==n?w(t,n):A(t,n))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,S(t,o))},t)}function m(t,e){e._state===Z?A(t,e._result):e._state===$?S(t,e._result):j(e,void 0,function(e){return w(t,e)},function(e){return S(t,e)})}function b(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?m(t,n):void 0===r?A(t,n):e(r)?y(t,n,r):A(t,n)}function w(e,n){if(e===n)S(e,v());else if(t(n)){var r=void 0;try{r=n.then}catch(o){return void S(e,o)}b(e,n,r)}else A(e,n)}function g(t){t._onerror&&t._onerror(t._result),E(t)}function A(t,e){t._state===X&&(t._result=e,t._state=Z,0!==t._subscribers.length&&z(E,t))}function S(t,e){t._state===X&&(t._state=$,t._result=e,z(g,t))}function j(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+Z]=n,o[i+$]=r,0===i&&t._state&&z(E,t)}function E(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?T(n,r,o,i):o(i);t._subscribers.length=0}}function T(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=!0;if(i){try{s=r(o)}catch(a){c=!1,u=a}if(n===s)return void S(n,d())}else s=o;n._state!==X||(i&&c?w(n,s):c===!1?S(n,u):t===Z?A(n,s):t===$&&S(n,s))}function M(t,e){try{e(function(e){w(t,e)},function(e){S(t,e)})}catch(n){S(t,n)}}function P(){return tt++}function x(t){t[V]=tt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function C(){return new Error("Array Methods must be provided an Array")}function O(t){return new et(this,t).promise}function k(t){var e=this;return new e(L(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return S(n,t),n}function Y(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function D(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=nt}var K=void 0;K=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var L=K,N=0,U=void 0,W=void 0,z=function(t,e){Q[N]=t,Q[N+1]=e,N+=2,2===N&&(W?W(a):R())},B="undefined"!=typeof window?window:void 0,G=B||{},H=G.MutationObserver||G.WebKitMutationObserver,I="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),J="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),R=void 0;R=I?o():H?s():J?u():void 0===B&&"function"==typeof require?f():c();var V=Math.random().toString(36).substring(2),X=void 0,Z=1,$=2,tt=0,et=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[V]||x(this.promise),L(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&A(this.promise,this._result))):S(this.promise,C())}return t.prototype._enumerate=function(t){for(var e=0;this._state===X&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=void 0,i=void 0,s=!1;try{o=t.then}catch(u){s=!0,i=u}if(o===l&&t._state!==X)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===nt){var c=new n(p);s?S(c,i):b(c,t,o),this._willSettleAt(c,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===X&&(this._remaining--,t===$?S(r,n):this._result[e]=n),0===this._remaining&&A(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,function(t){return n._settledAt(Z,e,t)},function(t){return n._settledAt($,e,t)})},t}(),nt=function(){function t(e){this[V]=P(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&Y(),this instanceof t?M(this,e):q())}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype["finally"]=function(t){var n=this,r=n.constructor;return e(t)?n.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})}):n.then(t,t)},t}();return nt.prototype.then=l,nt.all=O,nt.race=k,nt.resolve=h,nt.reject=F,nt._setScheduler=n,nt._setAsap=r,nt._asap=z,nt.polyfill=D,nt.Promise=nt,nt.polyfill(),nt});;
Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){var o,len,thisArg,k,kValue;if(this==null)throw new TypeError('"this" is null or not defined');if(o=Object(this),len=o.length>>>0,typeof predicate!="function")throw new TypeError("predicate must be a function");for(thisArg=arguments[1],k=0;k<len;){if(kValue=o[k],predicate.call(thisArg,kValue,k,o))return k;k++}return-1},configurable:!0,writable:!0});Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(predicate){var o,len,thisArg,k,kValue;if(this==null)throw new TypeError('"this" is null or not defined');if(o=Object(this),len=o.length>>>0,typeof predicate!="function")throw new TypeError("predicate must be a function");for(thisArg=arguments[1],k=0;k<len;){if(kValue=o[k],predicate.call(thisArg,kValue,k,o))return kValue;k++}return undefined},configurable:!0,writable:!0});Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(searchElement,fromIndex){function sameValueZero(x,y){return x===y||typeof x=="number"&&typeof y=="number"&&isNaN(x)&&isNaN(y)}var o,len,n,k;if(this==null)throw new TypeError('"this" is null or not defined');if(o=Object(this),len=o.length>>>0,len===0)return!1;for(n=fromIndex|0,k=Math.max(n>=0?n:len-Math.abs(n),0);k<len;){if(sameValueZero(o[k],searchElement))return!0;k++}return!1}});String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(search,rawPos){var pos=rawPos>0?rawPos|0:0;return this.substring(pos,pos+search.length)===search}});String.prototype.includes||(String.prototype.includes=function(search,start){"use strict";if(search instanceof RegExp)throw TypeError("first argument must not be a RegExp");return start===undefined&&(start=0),this.indexOf(search,start)!==-1});Promise.allSettled||(Promise.allSettled=promises=>Promise.all(promises.map(promise=>promise.then(value=>({status:"fulfilled",value})).catch(reason=>({status:"rejected",reason})))));typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(target){"use strict";var to,index,nextSource,nextKey;if(target==null)throw new TypeError("Cannot convert undefined or null to object");for(to=Object(target),index=1;index<arguments.length;index++)if(nextSource=arguments[index],nextSource!=null)for(nextKey in nextSource)Object.prototype.hasOwnProperty.call(nextSource,nextKey)&&(to[nextKey]=nextSource[nextKey]);return to},writable:!0,configurable:!0});Object.entries||(Object.entries=function(obj){for(var ownProps=Object.keys(obj),i=ownProps.length,resArray=new Array(i);i--;)resArray[i]=[ownProps[i],obj[ownProps[i]]];return resArray}),function(global){var checkIfIteratorIsSupported=function(){try{return!!Symbol.iterator}catch(error){return!1}},iteratorSupported=checkIfIteratorIsSupported(),createIterator=function(items){var iterator={next:function(){var value=items.shift();return{done:value===void 0,value:value}}};return iteratorSupported&&(iterator[Symbol.iterator]=function(){return iterator}),iterator},serializeParam=function(value){return encodeURIComponent(value).replace(/%20/g,"+")},deserializeParam=function(value){return decodeURIComponent(String(value).replace(/\+/g," "))},polyfillURLSearchParams=function(){var URLSearchParams=function(searchString){var typeofSearchString,_this,i,entry,key;if(Object.defineProperty(this,"_entries",{writable:!0,value:{}}),typeofSearchString=typeof searchString,typeofSearchString!=="undefined")if(typeofSearchString==="string")searchString!==""&&this._fromString(searchString);else if(searchString instanceof URLSearchParams)_this=this,searchString.forEach(function(value,name){_this.append(name,value)});else if(searchString!==null&&typeofSearchString==="object")if(Object.prototype.toString.call(searchString)==="[object Array]")for(i=0;i<searchString.length;i++)if(entry=searchString[i],Object.prototype.toString.call(entry)==="[object Array]"||entry.length!==2)this.append(entry[0],entry[1]);else throw new TypeError("Expected [string, any] as entry at index "+i+" of URLSearchParams's input");else for(key in searchString)searchString.hasOwnProperty(key)&&this.append(key,searchString[key]);else throw new TypeError("Unsupported input's type for URLSearchParams");},proto=URLSearchParams.prototype;proto.append=function(name,value){name in this._entries?this._entries[name].push(String(value)):this._entries[name]=[String(value)]};proto.delete=function(name){delete this._entries[name]};proto.get=function(name){return name in this._entries?this._entries[name][0]:null};proto.getAll=function(name){return name in this._entries?this._entries[name].slice(0):[]};proto.has=function(name){return name in this._entries};proto.set=function(name,value){this._entries[name]=[String(value)]};proto.forEach=function(callback,thisArg){var entries,name,i;for(name in this._entries)if(this._entries.hasOwnProperty(name))for(entries=this._entries[name],i=0;i<entries.length;i++)callback.call(thisArg,entries[i],name,this)};proto.keys=function(){var items=[];return this.forEach(function(value,name){items.push(name)}),createIterator(items)};proto.values=function(){var items=[];return this.forEach(function(value){items.push(value)}),createIterator(items)};proto.entries=function(){var items=[];return this.forEach(function(value,name){items.push([name,value])}),createIterator(items)};iteratorSupported&&(proto[Symbol.iterator]=proto.entries);proto.toString=function(){var searchArray=[];return this.forEach(function(value,name){searchArray.push(serializeParam(name)+"="+serializeParam(value))}),searchArray.join("&")};global.URLSearchParams=URLSearchParams},checkIfURLSearchParamsSupported=function(){try{var URLSearchParams=global.URLSearchParams;return new URLSearchParams("?a=1").toString()==="a=1"&&typeof URLSearchParams.prototype.set=="function"}catch(e){return!1}},proto;checkIfURLSearchParamsSupported()||polyfillURLSearchParams();proto=global.URLSearchParams.prototype;typeof proto.sort!="function"&&(proto.sort=function(){var _this=this,items=[],i;for(this.forEach(function(value,name){items.push([name,value]);_this._entries||_this.delete(name)}),items.sort(function(a,b){return a[0]<b[0]?-1:a[0]>b[0]?1:0}),_this._entries&&(_this._entries={}),i=0;i<items.length;i++)this.append(items[i][0],items[i][1])});typeof proto._fromString!="function"&&Object.defineProperty(proto,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(searchString){var keys,attributes,attribute,i;if(this._entries)this._entries={};else for(keys=[],this.forEach(function(value,name){keys.push(name)}),i=0;i<keys.length;i++)this.delete(keys[i]);for(searchString=searchString.replace(/^\?/,""),attributes=searchString.split("&"),i=0;i<attributes.length;i++)attribute=attributes[i].split("="),this.append(deserializeParam(attribute[0]),attribute.length>1?deserializeParam(attribute[1]):"")}})}(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:this),function(global){var checkIfURLIsSupported=function(){try{var u=new global.URL("b","http://a");return u.pathname="c d",u.href==="http://a/c%20d"&&u.searchParams}catch(e){return!1}},polyfillURL=function(){var _URL=global.URL,URL=function(url,base){var doc,baseElement,anchorElement,inputElement,search;if(typeof url!="string"&&(url=String(url)),doc=document,base&&(global.location===void 0||base!==global.location.href)){doc=document.implementation.createHTMLDocument("");baseElement=doc.createElement("base");baseElement.href=base;doc.head.appendChild(baseElement);try{if(baseElement.href.indexOf(base)!==0)throw new Error(baseElement.href);}catch(err){throw new Error("URL unable to set base "+base+" due to "+err);}}if(anchorElement=doc.createElement("a"),anchorElement.href=url,baseElement&&(doc.body.appendChild(anchorElement),anchorElement.href=anchorElement.href),inputElement=doc.createElement("input"),inputElement.type="url",inputElement.value=url,anchorElement.protocol===":"||!/:/.test(anchorElement.href)||!inputElement.checkValidity()&&!base)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:anchorElement});var searchParams=new global.URLSearchParams(this.search),enableSearchUpdate=!0,enableSearchParamsUpdate=!0,_this=this;["append","delete","set"].forEach(function(methodName){var method=searchParams[methodName];searchParams[methodName]=function(){method.apply(searchParams,arguments);enableSearchUpdate&&(enableSearchParamsUpdate=!1,_this.search=searchParams.toString(),enableSearchParamsUpdate=!0)}});Object.defineProperty(this,"searchParams",{value:searchParams,enumerable:!0});search=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==search&&(search=this.search,enableSearchParamsUpdate&&(enableSearchUpdate=!1,this.searchParams._fromString(this.search),enableSearchUpdate=!0))}})},proto=URL.prototype,linkURLWithAnchorAttribute=function(attributeName){Object.defineProperty(proto,attributeName,{get:function(){return this._anchorElement[attributeName]},set:function(value){this._anchorElement[attributeName]=value},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(attributeName){linkURLWithAnchorAttribute(attributeName)});Object.defineProperty(proto,"search",{get:function(){return this._anchorElement.search},set:function(value){this._anchorElement.search=value;this._updateSearchParams()},enumerable:!0});Object.defineProperties(proto,{toString:{get:function(){var _this=this;return function(){return _this.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(value){this._anchorElement.href=value;this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(value){this._anchorElement.pathname=value},enumerable:!0},origin:{get:function(){var expectedPort={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],addPortToOrigin=this._anchorElement.port!=expectedPort&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(addPortToOrigin?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(){},enumerable:!0},username:{get:function(){return""},set:function(){},enumerable:!0}});URL.createObjectURL=function(){return _URL.createObjectURL.apply(_URL,arguments)};URL.revokeObjectURL=function(){return _URL.revokeObjectURL.apply(_URL,arguments)};global.URL=URL},getOrigin;if(checkIfURLIsSupported()||polyfillURL(),global.location!==void 0&&!("origin"in global.location)){getOrigin=function(){return global.location.protocol+"//"+global.location.hostname+(global.location.port?":"+global.location.port:"")};try{Object.defineProperty(global.location,"origin",{get:getOrigin,enumerable:!0})}catch(e){setInterval(function(){global.location.origin=getOrigin()},100)}}}(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:this);
