/*! caf.js
	v7.0.6 (c) 2019 Kyle Simpson
	MIT License: http://getify.mit-license.org
*/

!function UMD(t,e){"function"==typeof define&&define.amd?define(e):e(t)}("undefined"!=typeof global?global:"undefined"!=typeof self?self:this,function DEF(t){"use strict";if(!t.AbortController){class e{constructor(){const t="undefined"!=typeof document?document.createDocumentFragment():{};["addEventListener","dispatchEvent","removeEventListener"].forEach(e=>this[e]=((...n)=>t[e]&&t[e](...n)))}}class n extends e{constructor(){super(),this.aborted=!1}toString(){return"[object AbortSignal]"}}class o{constructor(){this.signal=new n}abort(){this.signal.aborted=!0;try{this.signal.dispatchEvent(new Event("abort"))}catch(t){if("undefined"!=typeof document){const t=document.createEvent("Event");t.initEvent("abort",!1,!0),this.signal.dispatchEvent(t)}}}toString(){return"[object AbortController]"}}"undefined"!=typeof Symbol&&Symbol.toStringTag&&(o.prototype[Symbol.toStringTag]="AbortController",n.prototype[Symbol.toStringTag]="AbortSignal"),t.AbortController=o,t.AbortSignal=n}}),function UMD(t,e,n){"function"==typeof define&&define.amd?define(n):"undefined"!=typeof module&&module.exports?module.exports=n(t,e):e[t]=n(t,e)}("CAF",this,function DEF(t,e){"use strict";class n{constructor(){this.controller=new AbortController,this.signal=this.controller.signal,this.signal.pr=new Promise((t,e)=>this.rej=e),this.signal.pr.catch(Function.prototype)}abort(t){this.rej(t),this.controller.abort()}}const o=Symbol("Timeout Token");return CAF.cancelToken=n,CAF.delay=delay,CAF.timeout=function timeout(t,e="Timeout"){t=Number(t)||0;var r=new n;return delay(r.signal,t).then(cleanup,cleanup),Object.defineProperty(r,o,{value:!0,writable:!1,enumerable:!1,configurable:!1}),r;function cleanup(){r.abort(e),r=null}},CAF;function CAF(t){return function instance(e,...r){var i=e instanceof n?e.signal:e;if(i.aborted)return i.pr;var l=i.pr.catch(function onCancelation(t){try{var e=u.return();throw void 0!==e.value?e.value:t}finally{u=a=l=s=null}}),{it:u,result:a}=function _runner(t,...e){var n=t.apply(this,e);return t=e=null,{it:n,result:function getNextResult(t){try{var e=n.next(t);t=null}catch(t){return Promise.reject(t)}return function processResult(t){var e=Promise.resolve(t.value);return t.done?n=null:(e=e.then(getNextResult,function onRejection(t){return Promise.resolve(n.throw(t)).then(processResult)})).catch(function cleanup(){n=null}),t=null,e}(e)}()}}.call(this,t,i,...r),s=Promise.race([a,l]);return e!==i&&e[o]?s.then(function t(){e.abort()},function c(){e.abort()}):s.catch(Function.prototype),i=r=null,s}}function delay(t,e){"number"==typeof t&&"number"!=typeof e&&([e,t]=[t,e]);var o=t&&t instanceof n?t.signal:t;return o&&o.aborted?o.pr:new Promise(function c(t,n){o&&o.pr.catch(function onAbort(){r&&(clearTimeout(r),n(`delay (${e}) interrupted`)),t=n=r=o=null});var r=setTimeout(function onTimeout(){t(`delayed: ${e}`),t=n=r=o=null},e)})}});