517 lines
14 KiB
JavaScript
517 lines
14 KiB
JavaScript
// Metro module 652 (f653).
|
|
function $mk66842($env) {
|
|
return function wrapListener(a0) {
|
|
const r1 = $env;
|
|
if (r1[3].once) {
|
|
r1[0].removeEventListener(r1[1], r1[4]);
|
|
}
|
|
(0, r1[2])(a0);
|
|
};
|
|
}
|
|
let ownKeys, apply, NumberIsNaN2, c575_4, _addListener, onceWrapper, _listeners, listenerCount;
|
|
const EventEmitter = function EventEmitter() {
|
|
EventEmitter.init.call(this);
|
|
};
|
|
_addListener = function _addListener(a0, a1, a2, a3) {
|
|
let r10, r27, r31;
|
|
if (typeof a2 !== "function") {
|
|
throw new TypeError("The \"listener\" argument must be of type Function. Received type " + typeof a2);
|
|
}
|
|
let _events = a0._events;
|
|
if (_events === void 0) {
|
|
const _events2 = Object.create(null);
|
|
a0._events = _events2;
|
|
a0._eventsCount = 0;
|
|
r10 = void 0;
|
|
_events = _events2;
|
|
} else {
|
|
if (_events.newListener !== void 0) {
|
|
a0.emit.call(a0, "newListener", a1, a2.listener ? a2.listener : a2);
|
|
_events = a0._events;
|
|
}
|
|
r10 = _events[a1];
|
|
}
|
|
if (r10 === void 0) {
|
|
_events[a1] = a2;
|
|
a0._eventsCount = a0._eventsCount + 1;
|
|
} else {
|
|
if (typeof r10 === "function") {
|
|
const r30 = [, ,];
|
|
if (a3) {
|
|
r30[0] = a2;
|
|
r30[1] = r10;
|
|
r31 = r30;
|
|
} else {
|
|
r30[0] = r10;
|
|
r30[1] = a2;
|
|
r31 = r30;
|
|
}
|
|
_events[a1] = r31;
|
|
r27 = r31;
|
|
} else if (a3) {
|
|
r10.unshift(a2);
|
|
r27 = r10;
|
|
} else {
|
|
r10.push(a2);
|
|
r27 = r10;
|
|
}
|
|
const r33 = a0._maxListeners === void 0 ? EventEmitter.defaultMaxListeners : a0._maxListeners;
|
|
if (r33 > 0 && r27.length > r33 && !r27.warned) {
|
|
r27.warned = true;
|
|
const error = new Error("Possible EventEmitter memory leak detected. " + r27.length + " " + String(a1) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
error.name = "MaxListenersExceededWarning";
|
|
error.emitter = a0;
|
|
error.type = a1;
|
|
error.count = r27.length;
|
|
if (console && console.warn) {
|
|
console.warn(error);
|
|
}
|
|
}
|
|
}
|
|
return a0;
|
|
};
|
|
onceWrapper = function onceWrapper() {
|
|
if (this.fired) {
|
|
return void 0;
|
|
}
|
|
this.target.removeListener(this.type, this.wrapFn);
|
|
this.fired = true;
|
|
return arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
};
|
|
_listeners = function _listeners({ _events }, a1, a2) {
|
|
let r19, length3;
|
|
if (_events === void 0) {
|
|
return [];
|
|
}
|
|
const r7 = _events[a1];
|
|
if (r7 === void 0) {
|
|
r19 = [];
|
|
} else if (typeof r7 === "function") {
|
|
r19 = a2 ? [r7.listener || r7] : [r7];
|
|
} else if (a2) {
|
|
const array2 = new Array(r7.length);
|
|
const length2 = array2.length;
|
|
let r27 = 0;
|
|
const r28 = 0 < length2;
|
|
r19 = array2;
|
|
if (r28) {
|
|
do {
|
|
let listener = r7[r27].listener;
|
|
const r1 = r27;
|
|
if (!listener) {
|
|
listener = r7[r1];
|
|
}
|
|
array2[r1] = listener;
|
|
r27 = r1 + 1;
|
|
length3 = array2.length;
|
|
r19 = array2;
|
|
} while (r27 < length3);
|
|
}
|
|
} else {
|
|
const length = r7.length;
|
|
const array = new Array(length);
|
|
let r0 = 0;
|
|
const r3 = 0 < length;
|
|
r19 = array;
|
|
if (r3) {
|
|
do {
|
|
array[r0] = r7[r0];
|
|
r0 = r0 + 1;
|
|
r19 = array;
|
|
} while (r0 < length);
|
|
}
|
|
}
|
|
return r19;
|
|
};
|
|
listenerCount = function listenerCount(a0) {
|
|
const _events = this._events;
|
|
if (_events !== void 0) {
|
|
const r5 = _events[a0];
|
|
if (typeof r5 === "function") {
|
|
return 1;
|
|
}
|
|
if (r5 !== void 0) {
|
|
return r5.length;
|
|
}
|
|
}
|
|
return 0;
|
|
};
|
|
const r7 = typeof globalThis.Reflect === "object" ? Reflect : null;
|
|
apply = r7 && typeof r7.apply === "function" ? r7.apply : function ReflectApply(a0, a1, a2) {
|
|
return Function.prototype.apply.call(a0, a1, a2);
|
|
};
|
|
ownKeys = r7 && typeof r7.ownKeys === "function" ? r7.ownKeys : Object.getOwnPropertySymbols ? function ReflectOwnKeys(a0) {
|
|
return Object.getOwnPropertyNames(a0).concat(Object.getOwnPropertySymbols(a0));
|
|
} : function ReflectOwnKeys(a0) {
|
|
return Object.getOwnPropertyNames(a0);
|
|
};
|
|
NumberIsNaN2 = Number.isNaN || function NumberIsNaN(a0) {
|
|
return a0 != a0;
|
|
};
|
|
module.exports = EventEmitter;
|
|
module.exports.once = function once(c12430_0, c12430_1) {
|
|
return new Promise(function(c23818_0, c23818_1) {
|
|
let resolver2;
|
|
let env23819;
|
|
const errorListener2 = function errorListener(a0) {
|
|
c12430_0.removeListener(c12430_1, resolver2);
|
|
c23818_1(a0);
|
|
};
|
|
resolver2 = function resolver() {
|
|
if (typeof c12430_0.removeListener === "function") {
|
|
c12430_0.removeListener("error", errorListener2);
|
|
}
|
|
c23818_0([].slice.call(arguments));
|
|
};
|
|
const r16 = {
|
|
once: true
|
|
};
|
|
const r8 = env23819 = {};
|
|
env23819[0] = c12430_0;
|
|
env23819[1] = c12430_1;
|
|
env23819[2] = resolver2;
|
|
env23819[3] = r16;
|
|
if (typeof c12430_0.on === "function") {
|
|
if (r16.once) {
|
|
c12430_0.once(c12430_1, resolver2);
|
|
} else {
|
|
c12430_0.on(c12430_1, resolver2);
|
|
}
|
|
} else {
|
|
if (typeof c12430_0.addEventListener !== "function") {
|
|
throw new TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof c12430_0);
|
|
}
|
|
const r18 = $mk66842(r8);
|
|
env23819[4] = r18;
|
|
c12430_0.addEventListener(c12430_1, r18);
|
|
}
|
|
if (c12430_1 !== "error" && typeof c12430_0.on === "function") {
|
|
let env23820;
|
|
const r33 = {
|
|
once: true
|
|
};
|
|
const r34 = env23820 = {};
|
|
env23820[0] = c12430_0;
|
|
env23820[1] = "error";
|
|
env23820[2] = errorListener2;
|
|
env23820[3] = r33;
|
|
if (typeof c12430_0.on === "function") {
|
|
if (r33.once) {
|
|
c12430_0.once("error", errorListener2);
|
|
} else {
|
|
c12430_0.on("error", errorListener2);
|
|
}
|
|
} else {
|
|
if (typeof c12430_0.addEventListener !== "function") {
|
|
throw new TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof c12430_0);
|
|
}
|
|
const r38 = $mk66842(r34);
|
|
env23820[4] = r38;
|
|
c12430_0.addEventListener("error", r38);
|
|
}
|
|
}
|
|
});
|
|
};
|
|
EventEmitter.EventEmitter = EventEmitter;
|
|
EventEmitter.prototype._events = void 0;
|
|
EventEmitter.prototype._eventsCount = 0;
|
|
EventEmitter.prototype._maxListeners = void 0;
|
|
c575_4 = 10;
|
|
Object.defineProperty(EventEmitter, "defaultMaxListeners", {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return c575_4;
|
|
},
|
|
set: function set(a0) {
|
|
if (typeof a0 === "number" && !(a0 < 0) && !NumberIsNaN2(a0)) {
|
|
c575_4 = a0;
|
|
return void 0;
|
|
}
|
|
throw new RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + a0 + ".");
|
|
}
|
|
});
|
|
EventEmitter.init = function() {
|
|
if (!(this._events !== void 0 && this._events !== Object.getPrototypeOf(this)._events)) {
|
|
this._events = Object.create(null);
|
|
this._eventsCount = 0;
|
|
}
|
|
this._maxListeners = this._maxListeners || void 0;
|
|
};
|
|
EventEmitter.prototype.setMaxListeners = function setMaxListeners(a0) {
|
|
if (typeof a0 === "number" && !(a0 < 0) && !NumberIsNaN2(a0)) {
|
|
this._maxListeners = a0;
|
|
return this;
|
|
}
|
|
throw new RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + a0 + ".");
|
|
};
|
|
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
return this._maxListeners === void 0 ? EventEmitter.defaultMaxListeners : this._maxListeners;
|
|
};
|
|
EventEmitter.prototype.emit = function emit(a0) {
|
|
let r29;
|
|
const r9 = [];
|
|
const r5 = 1 < arguments.length;
|
|
let r0 = 1;
|
|
if (r5) {
|
|
do {
|
|
r9.push(arguments[r0]);
|
|
r0 = r0 + 1;
|
|
} while (r0 < arguments.length);
|
|
}
|
|
const r7 = a0 === "error";
|
|
const _events = this._events;
|
|
if (_events !== void 0) {
|
|
r29 = r7 ? _events.error === void 0 : r7;
|
|
} else {
|
|
r29 = r7;
|
|
if (!r29) {
|
|
return false;
|
|
}
|
|
}
|
|
if (r29) {
|
|
const context = r9.length > 0 ? r9[0] : void 0;
|
|
if (context instanceof Error) {
|
|
throw context;
|
|
}
|
|
const error = new Error("Unhandled error." + (context ? " (" + context.message + ")" : ""));
|
|
error.context = context;
|
|
throw error;
|
|
}
|
|
const r31 = _events[a0];
|
|
if (r31 === void 0) {
|
|
return false;
|
|
}
|
|
if (typeof r31 === "function") {
|
|
apply(r31, this, r9);
|
|
} else {
|
|
const length = r31.length;
|
|
const array = new Array(length);
|
|
const r38 = 0 < length;
|
|
let r1 = 0;
|
|
if (r38) {
|
|
do {
|
|
array[r1] = r31[r1];
|
|
r1 = r1 + 1;
|
|
} while (r1 < length);
|
|
}
|
|
const r40 = 0 < length;
|
|
let r41 = 0;
|
|
if (r40) {
|
|
do {
|
|
apply(array[r41], this, r9);
|
|
r41 = r41 + 1;
|
|
} while (r41 < length);
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
EventEmitter.prototype.addListener = function addListener(a0, a1) {
|
|
_addListener(this, a0, a1, false);
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
EventEmitter.prototype.prependListener = function prependListener(a0, a1) {
|
|
_addListener(this, a0, a1, true);
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.once = function once(a0, a1) {
|
|
if (typeof a1 !== "function") {
|
|
throw new TypeError("The \"listener\" argument must be of type Function. Received type " + typeof a1);
|
|
}
|
|
const on = this.on;
|
|
const r5 = {
|
|
fired: false,
|
|
wrapFn: void 0,
|
|
target: this,
|
|
type: a0,
|
|
listener: a1
|
|
};
|
|
const wrapFn = onceWrapper.bind(r5);
|
|
wrapFn.listener = a1;
|
|
r5.wrapFn = wrapFn;
|
|
on.call(this, a0, wrapFn);
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.prependOnceListener = function prependOnceListener(a0, a1) {
|
|
if (typeof a1 !== "function") {
|
|
throw new TypeError("The \"listener\" argument must be of type Function. Received type " + typeof a1);
|
|
}
|
|
const prependListener2 = this.prependListener;
|
|
const r5 = {
|
|
fired: false,
|
|
wrapFn: void 0,
|
|
target: this,
|
|
type: a0,
|
|
listener: a1
|
|
};
|
|
const wrapFn = onceWrapper.bind(r5);
|
|
wrapFn.listener = a1;
|
|
r5.wrapFn = wrapFn;
|
|
prependListener2.call(this, a0, wrapFn);
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.removeListener = function removeListener(a0, a1) {
|
|
let r30, length;
|
|
if (typeof a1 !== "function") {
|
|
throw new TypeError("The \"listener\" argument must be of type Function. Received type " + typeof a1);
|
|
}
|
|
const _events = this._events;
|
|
if (_events === void 0) {
|
|
return this;
|
|
}
|
|
const r10 = _events[a0];
|
|
if (r10 === void 0) {
|
|
return this;
|
|
}
|
|
L31: {
|
|
if (r10 !== a1 && r10.listener !== a1) {
|
|
if (typeof r10 === "function") {
|
|
break L31;
|
|
}
|
|
let r2 = r10.length - 1;
|
|
let r15 = void 0;
|
|
let r1 = -1;
|
|
if (0 <= r2) {
|
|
while (true) {
|
|
const r21 = r10[r2];
|
|
const r0 = r2;
|
|
if (r21 !== a1 && r10[r0].listener !== a1) {
|
|
r2 = r0 - 1;
|
|
r15 = void 0;
|
|
r1 = -1;
|
|
if (0 <= r2) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
r15 = r10[r0].listener;
|
|
r1 = r0;
|
|
break;
|
|
}
|
|
}
|
|
if (r1 < 0) {
|
|
return this;
|
|
}
|
|
if (r1 === 0) {
|
|
r10.shift();
|
|
} else {
|
|
if (r1 + 1 < r10.length) {
|
|
do {
|
|
const r27 = r1 + 1;
|
|
r10[r1] = r10[r27];
|
|
length = r10.length;
|
|
r30 = r27 + 1;
|
|
r1 = r27;
|
|
} while (r30 < length);
|
|
}
|
|
r10.pop();
|
|
}
|
|
if (r10.length === 1) {
|
|
_events[a0] = r10[0];
|
|
}
|
|
if (_events.removeListener === void 0) {
|
|
break L31;
|
|
}
|
|
const emit2 = this.emit;
|
|
if (!r15) {
|
|
r15 = a1;
|
|
}
|
|
emit2.call(this, "removeListener", a0, r15);
|
|
} else {
|
|
const _eventsCount = this._eventsCount - 1;
|
|
this._eventsCount = _eventsCount;
|
|
if (_eventsCount == 0) {
|
|
this._events = Object.create(null);
|
|
} else {
|
|
delete _events[a0];
|
|
if (_events.removeListener) {
|
|
this.emit("removeListener", a0, r10.listener || a1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
EventEmitter.prototype.removeAllListeners = function removeAllListeners(a0) {
|
|
const _events = this._events;
|
|
if (_events === void 0) {
|
|
return this;
|
|
}
|
|
if (_events.removeListener === void 0) {
|
|
if (arguments.length === 0) {
|
|
this._events = Object.create(null);
|
|
this._eventsCount = 0;
|
|
} else if (_events[a0] !== void 0) {
|
|
const _eventsCount = this._eventsCount - 1;
|
|
this._eventsCount = _eventsCount;
|
|
if (_eventsCount == 0) {
|
|
this._events = Object.create(null);
|
|
} else {
|
|
delete _events[a0];
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
if (arguments.length === 0) {
|
|
const r13 = Object.keys(_events);
|
|
const r5 = 0 < r13.length;
|
|
let r28 = 0;
|
|
if (r5) {
|
|
do {
|
|
const r14 = r13[r28];
|
|
const r2 = r28;
|
|
if (r14 !== "removeListener") {
|
|
this.removeAllListeners(r14);
|
|
}
|
|
r28 = r2 + 1;
|
|
} while (r28 < r13.length);
|
|
}
|
|
this.removeAllListeners("removeListener");
|
|
this._events = Object.create(null);
|
|
this._eventsCount = 0;
|
|
return this;
|
|
}
|
|
const r11 = _events[a0];
|
|
if (typeof r11 === "function") {
|
|
this.removeListener(a0, r11);
|
|
} else if (r11 !== void 0) {
|
|
let r0 = r11.length - 1;
|
|
while (0 <= r0) {
|
|
this.removeListener(a0, r11[r0]);
|
|
r0 = r0 - 1;
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.listeners = function listeners(a0) {
|
|
return _listeners(this, a0, true);
|
|
};
|
|
EventEmitter.prototype.rawListeners = function rawListeners(a0) {
|
|
return _listeners(this, a0, false);
|
|
};
|
|
EventEmitter.listenerCount = function(a0, a1) {
|
|
let r10;
|
|
if (typeof a0.listenerCount === "function") {
|
|
r10 = a0.listenerCount(a1);
|
|
} else {
|
|
const call = listenerCount.call;
|
|
if (call === Function.prototype.call) {
|
|
const _events = a0._events;
|
|
let r11 = 0;
|
|
if (_events !== void 0) {
|
|
const r12 = _events[a1];
|
|
r11 = typeof r12 !== "function" ? r12 !== void 0 ? r12.length : 0 : 1;
|
|
}
|
|
r10 = r11;
|
|
} else {
|
|
r10 = call.call(listenerCount, a0, a1);
|
|
}
|
|
}
|
|
return r10;
|
|
};
|
|
EventEmitter.prototype.listenerCount = listenerCount;
|
|
EventEmitter.prototype.eventNames = function eventNames() {
|
|
return this._eventsCount > 0 ? ownKeys(this._events) : [];
|
|
};
|