import{g as ie}from"./index-D4mISQVM.js";var N={exports:{}};/*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. */var z;function se(){return z||(z=1,(function(H,oe){(function(d){var J=Object.hasOwnProperty,C=Array.isArray?Array.isArray:function(r){return Object.prototype.toString.call(r)==="[object Array]"},Q=10,X=typeof process=="object"&&typeof process.nextTick=="function",j=typeof Symbol=="function",Y=typeof Reflect=="object",Z=typeof setImmediate=="function",S=Z?setImmediate:setTimeout,g=j?Y&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(e){var r=Object.getOwnPropertyNames(e);return r.push.apply(r,Object.getOwnPropertySymbols(e)),r}:Object.keys;function k(){this._events={},this._conf&&F.call(this,this._conf)}function F(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==d&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function I(e,r){var t="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(t+=" Event name: "+r+"."),typeof process<"u"&&process.emitWarning){var i=new Error(t);i.name="MaxListenersExceededWarning",i.emitter=this,i.count=e,process.emitWarning(i)}else console.error(t),console.trace&&console.trace()}var L=function(e,r,t){var i=arguments.length;switch(i){case 0:return[];case 1:return[e];case 2:return[e,r];case 3:return[e,r,t];default:for(var s=new Array(i);i--;)s[i]=arguments[i];return s}};function U(e,r){for(var t={},i,s=e.length,n=0,o=0;o0;)e=n[a],o.call(f,e,t[e]);this._listeners={},this._listenersCount=0,l()}}});function T(e,r,t,i){var s=Object.assign({},r);if(!e)return s;if(typeof e!="object")throw TypeError("options must be an object");var n=Object.keys(e),o=n.length,f,a,l;function u(h){throw Error('Invalid "'+f+'" option value'+(h?". Reason: "+h:""))}for(var p=0;p0;)if(f===e[a])return n;o(r)}}var x=W(["function"]),$=W(["object","function"]);function D(e,r,t){var i,s,n=0,o,f=new e(function(a,l,u){t=T(t,{timeout:0,overload:!1},{timeout:function(m,b){return m*=1,(typeof m!="number"||m<0||!Number.isFinite(m))&&b("timeout must be a positive number"),m}}),i=!t.overload&&typeof e.prototype.cancel=="function"&&typeof u=="function";function p(){s&&(s=null),n&&(clearTimeout(n),n=0)}var h=function(m){p(),a(m)},v=function(m){p(),l(m)};i?r(h,v,u):(s=[function(m){v(m||Error("canceled"))}],r(h,v,function(m){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof m!="function")throw TypeError("onCancel callback must be a function");s.push(m)}),o=!0),t.timeout>0&&(n=setTimeout(function(){var m=Error("timeout");m.code="ETIMEDOUT",n=0,f.cancel(m),l(m)},t.timeout))});return i||(f.cancel=function(a){if(s){for(var l=s.length,u=1;u0;)v=y[f],v!=="_listeners"&&(w=_(e,r,t[v],i+1,s),w&&(h?h.push.apply(h,w):h=w));return h}else if(E==="**"){for(R=i+1===s||i+2===s&&M==="*",R&&t._listeners&&(h=_(e,r,t,s,s)),y=g(t),f=y.length;f-- >0;)v=y[f],v!=="_listeners"&&(v==="*"||v==="**"?(t[v]._listeners&&!R&&(w=_(e,r,t[v],s,s),w&&(h?h.push.apply(h,w):h=w)),w=_(e,r,t[v],i,s)):v===M?w=_(e,r,t[v],i+2,s):w=_(e,r,t[v],i,s),w&&(h?h.push.apply(h,w):h=w));return h}else t[E]&&(h=_(e,r,t[E],i+1,s));if(m=t["*"],m&&_(e,r,m,i+1,s),b=t["**"],b)if(i0;)v=y[f],v!=="_listeners"&&(v===M?_(e,r,b[v],i+2,s):v===E?_(e,r,b[v],i+1,s):(P={},P[v]=b[v],_(e,r,{"**":P},i+1,s)));else b._listeners?_(e,r,b,s,s):b["*"]&&b["*"]._listeners&&_(e,r,b["*"],s,s);return h}function ee(e,r,t){var i=0,s=0,n,o=this.delimiter,f=o.length,a;if(typeof e=="string")if((n=e.indexOf(o))!==-1){a=new Array(5);do a[i++]=e.slice(s,n),s=n+f;while((n=e.indexOf(o,s))!==-1);a[i++]=e.slice(s)}else a=[e],i=1;else a=e,i=e.length;if(i>1){for(n=0;n+10&&l._listeners.length>this._maxListeners&&(l._listeners.warned=!0,I.call(this,l._listeners.length,u))):l._listeners=r,!0;return!0}function G(e,r,t,i){for(var s=g(e),n=s.length,o,f,a,l=e._listeners,u;n-- >0;)f=s[n],o=e[f],f==="_listeners"?a=t:a=t?t.concat(f):[f],u=i||typeof f=="symbol",l&&r.push(u?a:a.join(this.delimiter)),typeof o=="object"&&G.call(this,o,r,a,u);return r}function A(e){for(var r=g(e),t=r.length,i,s,n;t-- >0;)s=r[t],i=e[s],i&&(n=!0,s!=="_listeners"&&!A(i)&&delete e[s]);return n}function V(e,r,t){this.emitter=e,this.event=r,this.listener=t}V.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function re(e,r,t){if(t===!0)s=!0;else if(t===!1)i=!0;else{if(!t||typeof t!="object")throw TypeError("options should be an object or true");var i=t.async,s=t.promisify,n=t.nextTick,o=t.objectify}if(i||n||s){var f=r,a=r._origin||r;if(n&&!X)throw Error("process.nextTick is not supported");s===d&&(s=r.constructor.name==="AsyncFunction"),r=function(){var l=arguments,u=this,p=this.event;return s?n?Promise.resolve():new Promise(function(h){S(h)}).then(function(){return u.event=p,f.apply(u,l)}):(n?process.nextTick:S)(function(){u.event=p,f.apply(u,l)})},r._async=!0,r._origin=a}return[r,o?new V(this,e,r):this]}function c(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,F.call(this,e)}c.EventEmitter2=c,c.prototype.listenTo=function(e,r,t){if(typeof e!="object")throw TypeError("target musts be an object");var i=this;t=T(t,{on:d,off:d,reducers:d},{on:x,off:x,reducers:$});function s(n){if(typeof n!="object")throw TypeError("events must be an object");var o=t.reducers,f=B.call(i,e),a;f===-1?a=new q(i,e,t):a=i._observers[f];for(var l=g(n),u=l.length,p,h=typeof o=="function",v=0;v0;)s=t[i],(!e||s._target===e)&&(s.unsubscribe(r),n=!0);return n},c.prototype.delimiter=".",c.prototype.setMaxListeners=function(e){e!==d&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},c.prototype.getMaxListeners=function(){return this._maxListeners},c.prototype.event="",c.prototype.once=function(e,r,t){return this._once(e,r,!1,t)},c.prototype.prependOnceListener=function(e,r,t){return this._once(e,r,!0,t)},c.prototype._once=function(e,r,t,i){return this._many(e,1,r,t,i)},c.prototype.many=function(e,r,t,i){return this._many(e,r,t,!1,i)},c.prototype.prependMany=function(e,r,t,i){return this._many(e,r,t,!0,i)},c.prototype._many=function(e,r,t,i,s){var n=this;if(typeof t!="function")throw new Error("many only accepts instances of Function");function o(){return--r===0&&n.off(e,o),t.apply(this,arguments)}return o._origin=t,this._on(e,o,i,s)},c.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||k.call(this);var e=arguments[0],r,t=this.wildcard,i,s,n,o,f;if(e==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(t&&(r=e,e!=="newListener"&&e!=="removeListener"&&typeof e=="object")){if(s=e.length,j){for(n=0;n3)for(i=new Array(a-1),o=1;o3)for(s=new Array(l-1),f=1;f0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,I.call(this,this._events[e].length,e))):this._events[e]=r,s)},c.prototype.off=function(e,r){if(typeof r!="function")throw new Error("removeListener only takes instances of Function");var t,i=[];if(this.wildcard){var s=typeof e=="string"?e.split(this.delimiter):e.slice();if(i=_.call(this,null,s,this.listenerTree,0),!i)return this}else{if(!this._events[e])return this;t=this._events[e],i.push({_listeners:t})}for(var n=0;n0){for(i=this._all,r=0,t=i.length;r0;)i=r[t[n]],typeof i=="function"?s.push(i):s.push.apply(s,i);return s}else{if(this.wildcard){if(o=this.listenerTree,!o)return[];var f=[],a=typeof e=="string"?e.split(this.delimiter):e.slice();return _.call(this,f,a,o,0),f}return r?(i=r[e],i?typeof i=="function"?[i]:i:[]):[]}},c.prototype.eventNames=function(e){var r=this._events;return this.wildcard?G.call(this,this.listenerTree,[],null,e):r?g(r):[]},c.prototype.listenerCount=function(e){return this.listeners(e).length},c.prototype.hasListeners=function(e){if(this.wildcard){var r=[],t=typeof e=="string"?e.split(this.delimiter):e.slice();return _.call(this,r,t,this.listenerTree,0),r.length>0}var i=this._events,s=this._all;return!!(s&&s.length||i&&(e===d?g(i).length:i[e]))},c.prototype.listenersAny=function(){return this._all?this._all:[]},c.prototype.waitFor=function(e,r){var t=this,i=typeof r;return i==="number"?r={timeout:r}:i==="function"&&(r={filter:r}),r=T(r,{timeout:0,filter:d,handleError:!1,Promise,overload:!1},{filter:x,Promise:K}),D(r.Promise,function(s,n,o){function f(){var a=r.filter;if(!(a&&!a.apply(t,arguments)))if(t.off(e,f),r.handleError){var l=arguments[0];l?n(l):s(L.apply(null,arguments).slice(1))}else s(L.apply(null,arguments))}o(function(){t.off(e,f)}),t._on(e,f,!1)},{timeout:r.timeout,overload:r.overload})};function te(e,r,t){t=T(t,{Promise,timeout:0,overload:!1},{Promise:K});var i=t.Promise;return D(i,function(s,n,o){var f;if(typeof e.addEventListener=="function"){f=function(){s(L.apply(null,arguments))},o(function(){e.removeEventListener(r,f)}),e.addEventListener(r,f,{once:!0});return}var a=function(){l&&e.removeListener("error",l),s(L.apply(null,arguments))},l;r!=="error"&&(l=function(u){e.removeListener(r,a),n(u)},e.once("error",l)),o(function(){l&&e.removeListener("error",l),e.removeListener(r,a)}),e.once(r,a)},{timeout:t.timeout,overload:t.overload})}var O=c.prototype;Object.defineProperties(c,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if(typeof e!="number"||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:te,writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:Q,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),H.exports=c})()})(N)),N.exports}var ne=se();const le=ie(ne);export{le as y};