define(["exports"],function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=_exports.AbortSignalPolyfill=void 0;var Emitter=function(){return babelHelpers.createClass(function(){Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})},[{key:"addEventListener",value:function(type,callback,options){type in this.listeners||(this.listeners[type]=[]),this.listeners[type].push({callback:callback,options:options})}},{key:"removeEventListener",value:function(type,callback){if(type in this.listeners)for(var stack=this.listeners[type],i=0,l=stack.length;i<l;i++)if(stack[i].callback===callback)return void stack.splice(i,1)}},{key:"dispatchEvent",value:function(event){var _this=this;if(event.type in this.listeners){for(var stackToCall=this.listeners[event.type].slice(),i=0,l=stackToCall.length;i<l;i++){listener=void 0;var listener=stackToCall[i];try{listener.callback.call(_this,event)}catch(e){Promise.resolve().then(function(){throw e})}listener.options&&listener.options.once&&_this.removeEventListener(event.type,listener.callback)}return!event.defaultPrevented}}}])}(),AbortSignalPolyfill=_exports.AbortSignalPolyfill=function(_Emitter){function AbortSignalPolyfill(){var _this2=_Emitter.call(this)||this;return _this2.listeners||Emitter.call(_this2),Object.defineProperty(_this2,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(_this2,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(_this2,"reason",{value:void 0,writable:!0,configurable:!0}),_this2}return babelHelpers.inherits(AbortSignalPolyfill,_Emitter),babelHelpers.createClass(AbortSignalPolyfill,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(event){var t,o,e,r,p;"abort"===event.type&&(this.aborted=!0,"function"==typeof this.onabort)&&this.onabort.call(this,event),t=AbortSignalPolyfill,o="dispatchEvent",e=this,r=3,p=babelHelpers.get(babelHelpers.getPrototypeOf(1&r?t.prototype:t),o,e),(2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p)([event])}}])}(Emitter),isMissingRequestSignalSupport="function"==typeof globalThis.Request&&!Object.prototype.hasOwnProperty.call(globalThis.Request.prototype,"signal");"undefined"!=typeof AbortSignal&&!isMissingRequestSignalSupport||Object.defineProperty(globalThis,"AbortSignal",{writable:!0,enumerable:!1,configurable:!0,value:AbortSignalPolyfill}),AbortSignal.timeout||(AbortSignal.timeout=function(duration){var controller=new AbortController;return setTimeout(function(){return controller.abort()},duration),controller.signal}),AbortSignal.any||(AbortSignal.any=function(signals){for(var controller=new AbortController,i=0,length=signals.length;i<length;i++){var signal=signals[i];if(signal.aborted)return controller.abort(signal.reason),controller.signal}function abort(){controller.abort(this.reason)}for(var _i=0,_length=signals.length;_i<_length;_i++)signals[_i].addEventListener("abort",abort);return controller.signal}),AbortSignal.prototype.throwIfAborted||(AbortSignal.prototype.throwIfAborted=function(){var reason;if(this.aborted)throw(reason=this.reason)||((reason=new Error("Aborted")).name="AbortError"),reason}),_exports.default=AbortSignalPolyfill});