var e,t={},n={};function s(){if(e)return n;let t;function s(){if(void 0===t)throw new Error("No runtime abstraction layer installed");return t}return e=1,Object.defineProperty(n,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");t=e}}(s||(s={})),n.default=s,n}var i,o={};var r,c,a={};function l(){if(r)return a;r=1,Object.defineProperty(a,"__esModule",{value:!0}),a.Emitter=a.Event=void 0;const e=s();var t;!function(e){const t={dispose(){}};e.None=function(){return t}}(t||(a.Event=t={}));class n{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let s=0,i=this._callbacks.length;s<i;s++)if(this._callbacks[s]===e){if(this._contexts[s]===t)return this._callbacks.splice(s,1),void this._contexts.splice(s,1);n=!0}if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];const n=[],s=this._callbacks.slice(0),i=this._contexts.slice(0);for(let r=0,c=s.length;r<c;r++)try{n.push(s[r].apply(i[r],t))}catch(o){(0,e.default)().console.error(o)}return n}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class i{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,s)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const o={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),o.dispose=i._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(s)&&s.push(o),o}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return a.Emitter=i,i._noop=function(){},a}var u=function(){if(c)return t;c=1,Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0;const e=s(),n=function(){if(i)return o;function e(e){return"string"==typeof e||e instanceof String}function t(e){return Array.isArray(e)}return i=1,Object.defineProperty(o,"__esModule",{value:!0}),o.stringArray=o.array=o.func=o.error=o.number=o.string=o.boolean=void 0,o.boolean=function(e){return!0===e||!1===e},o.string=e,o.number=function(e){return"number"==typeof e||e instanceof Number},o.error=function(e){return e instanceof Error},o.func=function(e){return"function"==typeof e},o.array=t,o.stringArray=function(n){return t(n)&&n.every(t=>e(t))},o}(),r=l();var a;!function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None}),e.is=function(t){const s=t;return s&&(s===e.None||s===e.Cancelled||n.boolean(s.isCancellationRequested)&&!!s.onCancellationRequested)}}(a||(t.CancellationToken=a={}));const u=Object.freeze(function(t,n){const s=(0,e.default)().timer.setTimeout(t.bind(n),0);return{dispose(){s.dispose()}}});class h{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?u:(this._emitter||(this._emitter=new r.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}return t.CancellationTokenSource=class{get token(){return this._token||(this._token=new h),this._token}cancel(){this._token?this._token.cancel():this._token=a.Cancelled}dispose(){this._token?this._token instanceof h&&this._token.dispose():this._token=a.None}},t}(),h=l();export{u as c,h as e};
