import { fileURLToPath as __cjsFileURLToPath } from 'url';
import { dirname as __cjsDirname } from 'path';
const __dirname = __cjsDirname(__cjsFileURLToPath(import.meta.url));
import { i as e, o as t, t as n } from "./chunk-hvVJRdgc.js";
import { a as r, c as i, i as a, l as o, n as s, o as c, r as l, s as u, t as d, u as f } from "./builtin_esm-external-require-https-CiDIUPOC.js";
import * as p from "tls";
import * as m from "zlib";
import * as h from "buffer";
import g from "react-devtools-core";
//#region builtin:esm-external-require-tls
var _ = /* @__PURE__ */ n(((e, t) => {
	t.exports = p.default;
})), v = /* @__PURE__ */ n(((e, t) => {
	t.exports = m.default;
})), y = /* @__PURE__ */ n(((e, t) => {
	var n = [
		"nodebuffer",
		"arraybuffer",
		"fragments"
	], r = typeof Blob < "u";
	r && n.push("blob"), t.exports = {
		BINARY_TYPES: n,
		CLOSE_TIMEOUT: 3e4,
		EMPTY_BUFFER: Buffer.alloc(0),
		GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
		hasBlob: r,
		kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
		kListener: Symbol("kListener"),
		kStatusCode: Symbol("status-code"),
		kWebSocket: Symbol("websocket"),
		NOOP: () => {}
	};
})), b = /* @__PURE__ */ n(((t, n) => {
	var r = o(), a = i(), s = u(), c = typeof __webpack_require__ == "function" ? __non_webpack_require__ : e, l = process.config && process.config.variables || {}, d = !!process.env.PREBUILDS_ONLY, f = process.versions.modules, p = j() ? "electron" : A() ? "node-webkit" : "node", m = process.env.npm_config_arch || s.arch(), h = process.env.npm_config_platform || s.platform(), g = process.env.LIBC || (M(h) ? "musl" : "glibc"), _ = process.env.ARM_VERSION || (m === "arm64" ? "8" : l.arm_version) || "", v = (process.versions.uv || "").split(".")[0];
	n.exports = y;
	function y(e) {
		return c(y.resolve(e));
	}
	y.resolve = y.path = function(e) {
		e = a.resolve(e || ".");
		try {
			var t = c(a.join(e, "package.json")).name.toUpperCase().replace(/-/g, "_");
			process.env[t + "_PREBUILD"] && (e = process.env[t + "_PREBUILD"]);
		} catch {}
		if (!d) {
			var n = x(a.join(e, "build/Release"), S);
			if (n) return n;
			var r = x(a.join(e, "build/Debug"), S);
			if (r) return r;
		}
		var i = l(e);
		if (i) return i;
		var o = l(a.dirname(process.execPath));
		if (o) return o;
		var s = [
			"platform=" + h,
			"arch=" + m,
			"runtime=" + p,
			"abi=" + f,
			"uv=" + v,
			_ ? "armv=" + _ : "",
			"libc=" + g,
			"node=" + process.versions.node,
			process.versions.electron ? "electron=" + process.versions.electron : "",
			typeof __webpack_require__ == "function" ? "webpack=true" : ""
		].filter(Boolean).join(" ");
		throw Error("No native build was found for " + s + "\n    loaded from: " + e + "\n");
		function l(e) {
			var t = b(a.join(e, "prebuilds")).map(C).filter(w(h, m)).sort(T)[0];
			if (t) {
				var n = a.join(e, "prebuilds", t.name), r = b(n).map(E).filter(D(p, f)).sort(k(p))[0];
				if (r) return a.join(n, r.file);
			}
		}
	};
	function b(e) {
		try {
			return r.readdirSync(e);
		} catch {
			return [];
		}
	}
	function x(e, t) {
		var n = b(e).filter(t);
		return n[0] && a.join(e, n[0]);
	}
	function S(e) {
		return /\.node$/.test(e);
	}
	function C(e) {
		var t = e.split("-");
		if (t.length === 2) {
			var n = t[0], r = t[1].split("+");
			if (n && r.length && r.every(Boolean)) return {
				name: e,
				platform: n,
				architectures: r
			};
		}
	}
	function w(e, t) {
		return function(n) {
			return n == null || n.platform !== e ? !1 : n.architectures.includes(t);
		};
	}
	function T(e, t) {
		return e.architectures.length - t.architectures.length;
	}
	function E(e) {
		var t = e.split("."), n = t.pop(), r = {
			file: e,
			specificity: 0
		};
		if (n === "node") {
			for (var i = 0; i < t.length; i++) {
				var a = t[i];
				if (a === "node" || a === "electron" || a === "node-webkit") r.runtime = a;
				else if (a === "napi") r.napi = !0;
				else if (a.slice(0, 3) === "abi") r.abi = a.slice(3);
				else if (a.slice(0, 2) === "uv") r.uv = a.slice(2);
				else if (a.slice(0, 4) === "armv") r.armv = a.slice(4);
				else if (a === "glibc" || a === "musl") r.libc = a;
				else continue;
				r.specificity++;
			}
			return r;
		}
	}
	function D(e, t) {
		return function(n) {
			return !(n == null || n.runtime && n.runtime !== e && !O(n) || n.abi && n.abi !== t && !n.napi || n.uv && n.uv !== v || n.armv && n.armv !== _ || n.libc && n.libc !== g);
		};
	}
	function O(e) {
		return e.runtime === "node" && e.napi;
	}
	function k(e) {
		return function(t, n) {
			return t.runtime === n.runtime ? t.abi === n.abi ? t.specificity === n.specificity ? 0 : t.specificity > n.specificity ? -1 : 1 : t.abi ? -1 : 1 : t.runtime === e ? -1 : 1;
		};
	}
	function A() {
		return !!(process.versions && process.versions.nw);
	}
	function j() {
		return process.versions && process.versions.electron || process.env.ELECTRON_RUN_AS_NODE ? !0 : typeof window < "u" && window.process && window.process.type === "renderer";
	}
	function M(e) {
		return e === "linux" && r.existsSync("/etc/alpine-release");
	}
	y.parseTags = E, y.matchTags = D, y.compareTags = k, y.parseTuple = C, y.matchTuple = w, y.compareTuples = T;
})), x = /* @__PURE__ */ n(((t, n) => {
	var r = typeof __webpack_require__ == "function" ? __non_webpack_require__ : e;
	typeof r.addon == "function" ? n.exports = r.addon.bind(r) : n.exports = b();
})), S = /* @__PURE__ */ n(((e, t) => {
	t.exports = {
		mask: (e, t, n, r, i) => {
			for (var a = 0; a < i; a++) n[r + a] = e[a] ^ t[a & 3];
		},
		unmask: (e, t) => {
			let n = e.length;
			for (var r = 0; r < n; r++) e[r] ^= t[r & 3];
		}
	};
})), C = /* @__PURE__ */ n(((e, t) => {
	try {
		t.exports = x()(__dirname);
	} catch {
		t.exports = S();
	}
})), w = /* @__PURE__ */ n(((e, t) => {
	var { EMPTY_BUFFER: n } = y(), r = Buffer[Symbol.species];
	function i(e, t) {
		if (e.length === 0) return n;
		if (e.length === 1) return e[0];
		let i = Buffer.allocUnsafe(t), a = 0;
		for (let t = 0; t < e.length; t++) {
			let n = e[t];
			i.set(n, a), a += n.length;
		}
		return a < t ? new r(i.buffer, i.byteOffset, a) : i;
	}
	function a(e, t, n, r, i) {
		for (let a = 0; a < i; a++) n[r + a] = e[a] ^ t[a & 3];
	}
	function o(e, t) {
		for (let n = 0; n < e.length; n++) e[n] ^= t[n & 3];
	}
	function s(e) {
		return e.length === e.buffer.byteLength ? e.buffer : e.buffer.slice(e.byteOffset, e.byteOffset + e.length);
	}
	function c(e) {
		if (c.readOnly = !0, Buffer.isBuffer(e)) return e;
		let t;
		return e instanceof ArrayBuffer ? t = new r(e) : ArrayBuffer.isView(e) ? t = new r(e.buffer, e.byteOffset, e.byteLength) : (t = Buffer.from(e), c.readOnly = !1), t;
	}
	/* istanbul ignore else  */
	if (t.exports = {
		concat: i,
		mask: a,
		toArrayBuffer: s,
		toBuffer: c,
		unmask: o
	}, !process.env.WS_NO_BUFFER_UTIL) try {
		let e = C();
		t.exports.mask = function(t, n, r, i, o) {
			o < 48 ? a(t, n, r, i, o) : e.mask(t, n, r, i, o);
		}, t.exports.unmask = function(t, n) {
			t.length < 32 ? o(t, n) : e.unmask(t, n);
		};
	} catch {}
})), T = /* @__PURE__ */ n(((e, t) => {
	var n = Symbol("kDone"), r = Symbol("kRun");
	t.exports = class {
		constructor(e) {
			this[n] = () => {
				this.pending--, this[r]();
			}, this.concurrency = e || Infinity, this.jobs = [], this.pending = 0;
		}
		add(e) {
			this.jobs.push(e), this[r]();
		}
		[r]() {
			if (this.pending !== this.concurrency && this.jobs.length) {
				let e = this.jobs.shift();
				this.pending++, e(this[n]);
			}
		}
	};
})), E = /* @__PURE__ */ n(((e, t) => {
	var n = v(), r = w(), i = T(), { kStatusCode: a } = y(), o = Buffer[Symbol.species], s = Buffer.from([
		0,
		0,
		255,
		255
	]), c = Symbol("permessage-deflate"), l = Symbol("total-length"), u = Symbol("callback"), d = Symbol("buffers"), f = Symbol("error"), p;
	t.exports = class {
		constructor(e) {
			this._options = e || {}, this._threshold = this._options.threshold === void 0 ? 1024 : this._options.threshold, this._maxPayload = this._options.maxPayload | 0, this._isServer = !!this._options.isServer, this._deflate = null, this._inflate = null, this.params = null, p ||= new i(this._options.concurrencyLimit === void 0 ? 10 : this._options.concurrencyLimit);
		}
		static get extensionName() {
			return "permessage-deflate";
		}
		offer() {
			let e = {};
			return this._options.serverNoContextTakeover && (e.server_no_context_takeover = !0), this._options.clientNoContextTakeover && (e.client_no_context_takeover = !0), this._options.serverMaxWindowBits && (e.server_max_window_bits = this._options.serverMaxWindowBits), this._options.clientMaxWindowBits ? e.client_max_window_bits = this._options.clientMaxWindowBits : this._options.clientMaxWindowBits ?? (e.client_max_window_bits = !0), e;
		}
		accept(e) {
			return e = this.normalizeParams(e), this.params = this._isServer ? this.acceptAsServer(e) : this.acceptAsClient(e), this.params;
		}
		cleanup() {
			if (this._inflate &&= (this._inflate.close(), null), this._deflate) {
				let e = this._deflate[u];
				this._deflate.close(), this._deflate = null, e && e(/* @__PURE__ */ Error("The deflate stream was closed while data was being processed"));
			}
		}
		acceptAsServer(e) {
			let t = this._options, n = e.find((e) => !(t.serverNoContextTakeover === !1 && e.server_no_context_takeover || e.server_max_window_bits && (t.serverMaxWindowBits === !1 || typeof t.serverMaxWindowBits == "number" && t.serverMaxWindowBits > e.server_max_window_bits) || typeof t.clientMaxWindowBits == "number" && !e.client_max_window_bits));
			if (!n) throw Error("None of the extension offers can be accepted");
			return t.serverNoContextTakeover && (n.server_no_context_takeover = !0), t.clientNoContextTakeover && (n.client_no_context_takeover = !0), typeof t.serverMaxWindowBits == "number" && (n.server_max_window_bits = t.serverMaxWindowBits), typeof t.clientMaxWindowBits == "number" ? n.client_max_window_bits = t.clientMaxWindowBits : (n.client_max_window_bits === !0 || t.clientMaxWindowBits === !1) && delete n.client_max_window_bits, n;
		}
		acceptAsClient(e) {
			let t = e[0];
			if (this._options.clientNoContextTakeover === !1 && t.client_no_context_takeover) throw Error("Unexpected parameter \"client_no_context_takeover\"");
			if (!t.client_max_window_bits) typeof this._options.clientMaxWindowBits == "number" && (t.client_max_window_bits = this._options.clientMaxWindowBits);
			else if (this._options.clientMaxWindowBits === !1 || typeof this._options.clientMaxWindowBits == "number" && t.client_max_window_bits > this._options.clientMaxWindowBits) throw Error("Unexpected or invalid parameter \"client_max_window_bits\"");
			return t;
		}
		normalizeParams(e) {
			return e.forEach((e) => {
				Object.keys(e).forEach((t) => {
					let n = e[t];
					if (n.length > 1) throw Error(`Parameter "${t}" must have only a single value`);
					if (n = n[0], t === "client_max_window_bits") {
						if (n !== !0) {
							let e = +n;
							if (!Number.isInteger(e) || e < 8 || e > 15) throw TypeError(`Invalid value for parameter "${t}": ${n}`);
							n = e;
						} else if (!this._isServer) throw TypeError(`Invalid value for parameter "${t}": ${n}`);
					} else if (t === "server_max_window_bits") {
						let e = +n;
						if (!Number.isInteger(e) || e < 8 || e > 15) throw TypeError(`Invalid value for parameter "${t}": ${n}`);
						n = e;
					} else if (t === "client_no_context_takeover" || t === "server_no_context_takeover") {
						if (n !== !0) throw TypeError(`Invalid value for parameter "${t}": ${n}`);
					} else throw Error(`Unknown parameter "${t}"`);
					e[t] = n;
				});
			}), e;
		}
		decompress(e, t, n) {
			p.add((r) => {
				this._decompress(e, t, (e, t) => {
					r(), n(e, t);
				});
			});
		}
		compress(e, t, n) {
			p.add((r) => {
				this._compress(e, t, (e, t) => {
					r(), n(e, t);
				});
			});
		}
		_decompress(e, t, i) {
			let a = this._isServer ? "client" : "server";
			if (!this._inflate) {
				let e = `${a}_max_window_bits`, t = typeof this.params[e] == "number" ? this.params[e] : n.Z_DEFAULT_WINDOWBITS;
				this._inflate = n.createInflateRaw({
					...this._options.zlibInflateOptions,
					windowBits: t
				}), this._inflate[c] = this, this._inflate[l] = 0, this._inflate[d] = [], this._inflate.on("error", g), this._inflate.on("data", h);
			}
			this._inflate[u] = i, this._inflate.write(e), t && this._inflate.write(s), this._inflate.flush(() => {
				let e = this._inflate[f];
				if (e) {
					this._inflate.close(), this._inflate = null, i(e);
					return;
				}
				let n = r.concat(this._inflate[d], this._inflate[l]);
				this._inflate._readableState.endEmitted ? (this._inflate.close(), this._inflate = null) : (this._inflate[l] = 0, this._inflate[d] = [], t && this.params[`${a}_no_context_takeover`] && this._inflate.reset()), i(null, n);
			});
		}
		_compress(e, t, i) {
			let a = this._isServer ? "server" : "client";
			if (!this._deflate) {
				let e = `${a}_max_window_bits`, t = typeof this.params[e] == "number" ? this.params[e] : n.Z_DEFAULT_WINDOWBITS;
				this._deflate = n.createDeflateRaw({
					...this._options.zlibDeflateOptions,
					windowBits: t
				}), this._deflate[l] = 0, this._deflate[d] = [], this._deflate.on("data", m);
			}
			this._deflate[u] = i, this._deflate.write(e), this._deflate.flush(n.Z_SYNC_FLUSH, () => {
				if (!this._deflate) return;
				let e = r.concat(this._deflate[d], this._deflate[l]);
				t && (e = new o(e.buffer, e.byteOffset, e.length - 4)), this._deflate[u] = null, this._deflate[l] = 0, this._deflate[d] = [], t && this.params[`${a}_no_context_takeover`] && this._deflate.reset(), i(null, e);
			});
		}
	};
	function m(e) {
		this[d].push(e), this[l] += e.length;
	}
	function h(e) {
		if (this[l] += e.length, this[c]._maxPayload < 1 || this[l] <= this[c]._maxPayload) {
			this[d].push(e);
			return;
		}
		this[f] = /* @__PURE__ */ RangeError("Max payload size exceeded"), this[f].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH", this[f][a] = 1009, this.removeListener("data", h), this.reset();
	}
	function g(e) {
		if (this[c]._inflate = null, this[f]) {
			this[u](this[f]);
			return;
		}
		e[a] = 1007, this[u](e);
	}
})), D = /* @__PURE__ */ n(((e, t) => {
	t.exports = h.default;
})), O = /* @__PURE__ */ n(((e, t) => {
	function n(e) {
		let t = e.length, n = 0;
		for (; n < t;) if (!(e[n] & 128)) n++;
		else if ((e[n] & 224) == 192) {
			if (n + 1 === t || (e[n + 1] & 192) != 128 || (e[n] & 254) == 192) return !1;
			n += 2;
		} else if ((e[n] & 240) == 224) {
			if (n + 2 >= t || (e[n + 1] & 192) != 128 || (e[n + 2] & 192) != 128 || e[n] === 224 && (e[n + 1] & 224) == 128 || e[n] === 237 && (e[n + 1] & 224) == 160) return !1;
			n += 3;
		} else if ((e[n] & 248) == 240) {
			if (n + 3 >= t || (e[n + 1] & 192) != 128 || (e[n + 2] & 192) != 128 || (e[n + 3] & 192) != 128 || e[n] === 240 && (e[n + 1] & 240) == 128 || e[n] === 244 && e[n + 1] > 143 || e[n] > 244) return !1;
			n += 4;
		} else return !1;
		return !0;
	}
	t.exports = n;
})), k = /* @__PURE__ */ n(((e, t) => {
	try {
		t.exports = x()(__dirname);
	} catch {
		t.exports = O();
	}
})), A = /* @__PURE__ */ n(((e, t) => {
	var { isUtf8: n } = D(), { hasBlob: r } = y(), i = [
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		1,
		0,
		1,
		1,
		1,
		1,
		1,
		0,
		0,
		1,
		1,
		0,
		1,
		1,
		0,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		0,
		0,
		0,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		1,
		0,
		1,
		0,
		1,
		0
	];
	function a(e) {
		return e >= 1e3 && e <= 1014 && e !== 1004 && e !== 1005 && e !== 1006 || e >= 3e3 && e <= 4999;
	}
	function o(e) {
		let t = e.length, n = 0;
		for (; n < t;) if (!(e[n] & 128)) n++;
		else if ((e[n] & 224) == 192) {
			if (n + 1 === t || (e[n + 1] & 192) != 128 || (e[n] & 254) == 192) return !1;
			n += 2;
		} else if ((e[n] & 240) == 224) {
			if (n + 2 >= t || (e[n + 1] & 192) != 128 || (e[n + 2] & 192) != 128 || e[n] === 224 && (e[n + 1] & 224) == 128 || e[n] === 237 && (e[n + 1] & 224) == 160) return !1;
			n += 3;
		} else if ((e[n] & 248) == 240) {
			if (n + 3 >= t || (e[n + 1] & 192) != 128 || (e[n + 2] & 192) != 128 || (e[n + 3] & 192) != 128 || e[n] === 240 && (e[n + 1] & 240) == 128 || e[n] === 244 && e[n + 1] > 143 || e[n] > 244) return !1;
			n += 4;
		} else return !1;
		return !0;
	}
	function s(e) {
		return r && typeof e == "object" && typeof e.arrayBuffer == "function" && typeof e.type == "string" && typeof e.stream == "function" && (e[Symbol.toStringTag] === "Blob" || e[Symbol.toStringTag] === "File");
	}
	if (t.exports = {
		isBlob: s,
		isValidStatusCode: a,
		isValidUTF8: o,
		tokenChars: i
	}, n) t.exports.isValidUTF8 = function(e) {
		return e.length < 24 ? o(e) : n(e);
	};
	else if (!process.env.WS_NO_UTF_8_VALIDATE) try {
		let e = k();
		t.exports.isValidUTF8 = function(t) {
			return t.length < 32 ? o(t) : e(t);
		};
	} catch {}
})), j = /* @__PURE__ */ n(((e, t) => {
	var { Writable: n } = l(), r = E(), { BINARY_TYPES: i, EMPTY_BUFFER: a, kStatusCode: o, kWebSocket: s } = y(), { concat: c, toArrayBuffer: u, unmask: d } = w(), { isValidStatusCode: f, isValidUTF8: p } = A(), m = Buffer[Symbol.species], h = 0, g = 1, _ = 2, v = 3, b = 4, x = 5, S = 6;
	t.exports = class extends n {
		constructor(e = {}) {
			super(), this._allowSynchronousEvents = e.allowSynchronousEvents === void 0 ? !0 : e.allowSynchronousEvents, this._binaryType = e.binaryType || i[0], this._extensions = e.extensions || {}, this._isServer = !!e.isServer, this._maxPayload = e.maxPayload | 0, this._skipUTF8Validation = !!e.skipUTF8Validation, this[s] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this._errored = !1, this._loop = !1, this._state = h;
		}
		_write(e, t, n) {
			if (this._opcode === 8 && this._state == h) return n();
			this._bufferedBytes += e.length, this._buffers.push(e), this.startLoop(n);
		}
		consume(e) {
			if (this._bufferedBytes -= e, e === this._buffers[0].length) return this._buffers.shift();
			if (e < this._buffers[0].length) {
				let t = this._buffers[0];
				return this._buffers[0] = new m(t.buffer, t.byteOffset + e, t.length - e), new m(t.buffer, t.byteOffset, e);
			}
			let t = Buffer.allocUnsafe(e);
			do {
				let n = this._buffers[0], r = t.length - e;
				e >= n.length ? t.set(this._buffers.shift(), r) : (t.set(new Uint8Array(n.buffer, n.byteOffset, e), r), this._buffers[0] = new m(n.buffer, n.byteOffset + e, n.length - e)), e -= n.length;
			} while (e > 0);
			return t;
		}
		startLoop(e) {
			this._loop = !0;
			do
				switch (this._state) {
					case h:
						this.getInfo(e);
						break;
					case g:
						this.getPayloadLength16(e);
						break;
					case _:
						this.getPayloadLength64(e);
						break;
					case v:
						this.getMask();
						break;
					case b:
						this.getData(e);
						break;
					case x:
					case S:
						this._loop = !1;
						return;
				}
			while (this._loop);
			this._errored || e();
		}
		getInfo(e) {
			if (this._bufferedBytes < 2) {
				this._loop = !1;
				return;
			}
			let t = this.consume(2);
			if (t[0] & 48) {
				e(this.createError(RangeError, "RSV2 and RSV3 must be clear", !0, 1002, "WS_ERR_UNEXPECTED_RSV_2_3"));
				return;
			}
			let n = (t[0] & 64) == 64;
			if (n && !this._extensions[r.extensionName]) {
				e(this.createError(RangeError, "RSV1 must be clear", !0, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
				return;
			}
			if (this._fin = (t[0] & 128) == 128, this._opcode = t[0] & 15, this._payloadLength = t[1] & 127, this._opcode === 0) {
				if (n) {
					e(this.createError(RangeError, "RSV1 must be clear", !0, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
					return;
				}
				if (!this._fragmented) {
					e(this.createError(RangeError, "invalid opcode 0", !0, 1002, "WS_ERR_INVALID_OPCODE"));
					return;
				}
				this._opcode = this._fragmented;
			} else if (this._opcode === 1 || this._opcode === 2) {
				if (this._fragmented) {
					e(this.createError(RangeError, `invalid opcode ${this._opcode}`, !0, 1002, "WS_ERR_INVALID_OPCODE"));
					return;
				}
				this._compressed = n;
			} else if (this._opcode > 7 && this._opcode < 11) {
				if (!this._fin) {
					e(this.createError(RangeError, "FIN must be set", !0, 1002, "WS_ERR_EXPECTED_FIN"));
					return;
				}
				if (n) {
					e(this.createError(RangeError, "RSV1 must be clear", !0, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
					return;
				}
				if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
					e(this.createError(RangeError, `invalid payload length ${this._payloadLength}`, !0, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"));
					return;
				}
			} else {
				e(this.createError(RangeError, `invalid opcode ${this._opcode}`, !0, 1002, "WS_ERR_INVALID_OPCODE"));
				return;
			}
			if (!this._fin && !this._fragmented && (this._fragmented = this._opcode), this._masked = (t[1] & 128) == 128, this._isServer) {
				if (!this._masked) {
					e(this.createError(RangeError, "MASK must be set", !0, 1002, "WS_ERR_EXPECTED_MASK"));
					return;
				}
			} else if (this._masked) {
				e(this.createError(RangeError, "MASK must be clear", !0, 1002, "WS_ERR_UNEXPECTED_MASK"));
				return;
			}
			this._payloadLength === 126 ? this._state = g : this._payloadLength === 127 ? this._state = _ : this.haveLength(e);
		}
		getPayloadLength16(e) {
			if (this._bufferedBytes < 2) {
				this._loop = !1;
				return;
			}
			this._payloadLength = this.consume(2).readUInt16BE(0), this.haveLength(e);
		}
		getPayloadLength64(e) {
			if (this._bufferedBytes < 8) {
				this._loop = !1;
				return;
			}
			let t = this.consume(8), n = t.readUInt32BE(0);
			if (n > 2 ** 21 - 1) {
				e(this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", !1, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"));
				return;
			}
			this._payloadLength = n * 2 ** 32 + t.readUInt32BE(4), this.haveLength(e);
		}
		haveLength(e) {
			if (this._payloadLength && this._opcode < 8 && (this._totalPayloadLength += this._payloadLength, this._totalPayloadLength > this._maxPayload && this._maxPayload > 0)) {
				e(this.createError(RangeError, "Max payload size exceeded", !1, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
				return;
			}
			this._masked ? this._state = v : this._state = b;
		}
		getMask() {
			if (this._bufferedBytes < 4) {
				this._loop = !1;
				return;
			}
			this._mask = this.consume(4), this._state = b;
		}
		getData(e) {
			let t = a;
			if (this._payloadLength) {
				if (this._bufferedBytes < this._payloadLength) {
					this._loop = !1;
					return;
				}
				t = this.consume(this._payloadLength), this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0 && d(t, this._mask);
			}
			if (this._opcode > 7) {
				this.controlMessage(t, e);
				return;
			}
			if (this._compressed) {
				this._state = x, this.decompress(t, e);
				return;
			}
			t.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(t)), this.dataMessage(e);
		}
		decompress(e, t) {
			this._extensions[r.extensionName].decompress(e, this._fin, (e, n) => {
				if (e) return t(e);
				if (n.length) {
					if (this._messageLength += n.length, this._messageLength > this._maxPayload && this._maxPayload > 0) {
						t(this.createError(RangeError, "Max payload size exceeded", !1, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
						return;
					}
					this._fragments.push(n);
				}
				this.dataMessage(t), this._state === h && this.startLoop(t);
			});
		}
		dataMessage(e) {
			if (!this._fin) {
				this._state = h;
				return;
			}
			let t = this._messageLength, n = this._fragments;
			if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._fragments = [], this._opcode === 2) {
				let r;
				r = this._binaryType === "nodebuffer" ? c(n, t) : this._binaryType === "arraybuffer" ? u(c(n, t)) : this._binaryType === "blob" ? new Blob(n) : n, this._allowSynchronousEvents ? (this.emit("message", r, !0), this._state = h) : (this._state = S, setImmediate(() => {
					this.emit("message", r, !0), this._state = h, this.startLoop(e);
				}));
			} else {
				let r = c(n, t);
				if (!this._skipUTF8Validation && !p(r)) {
					e(this.createError(Error, "invalid UTF-8 sequence", !0, 1007, "WS_ERR_INVALID_UTF8"));
					return;
				}
				this._state === x || this._allowSynchronousEvents ? (this.emit("message", r, !1), this._state = h) : (this._state = S, setImmediate(() => {
					this.emit("message", r, !1), this._state = h, this.startLoop(e);
				}));
			}
		}
		controlMessage(e, t) {
			if (this._opcode === 8) {
				if (e.length === 0) this._loop = !1, this.emit("conclude", 1005, a), this.end();
				else {
					let n = e.readUInt16BE(0);
					if (!f(n)) {
						t(this.createError(RangeError, `invalid status code ${n}`, !0, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
						return;
					}
					let r = new m(e.buffer, e.byteOffset + 2, e.length - 2);
					if (!this._skipUTF8Validation && !p(r)) {
						t(this.createError(Error, "invalid UTF-8 sequence", !0, 1007, "WS_ERR_INVALID_UTF8"));
						return;
					}
					this._loop = !1, this.emit("conclude", n, r), this.end();
				}
				this._state = h;
				return;
			}
			this._allowSynchronousEvents ? (this.emit(this._opcode === 9 ? "ping" : "pong", e), this._state = h) : (this._state = S, setImmediate(() => {
				this.emit(this._opcode === 9 ? "ping" : "pong", e), this._state = h, this.startLoop(t);
			}));
		}
		createError(e, t, n, r, i) {
			this._loop = !1, this._errored = !0;
			let a = new e(n ? `Invalid WebSocket frame: ${t}` : t);
			return Error.captureStackTrace(a, this.createError), a.code = i, a[o] = r, a;
		}
	};
})), M = /* @__PURE__ */ n(((e, t) => {
	var { Duplex: n } = l(), { randomFillSync: r } = c(), i = E(), { EMPTY_BUFFER: a, kWebSocket: o, NOOP: s } = y(), { isBlob: u, isValidStatusCode: d } = A(), { mask: f, toBuffer: p } = w(), m = Symbol("kByteLength"), h = Buffer.alloc(4), g = 8 * 1024, _, v = g, b = 0, x = 1, S = 2;
	t.exports = class e {
		constructor(e, t, n) {
			this._extensions = t || {}, n && (this._generateMask = n, this._maskBuffer = Buffer.alloc(4)), this._socket = e, this._firstFragment = !0, this._compress = !1, this._bufferedBytes = 0, this._queue = [], this._state = b, this.onerror = s, this[o] = void 0;
		}
		static frame(e, t) {
			let n, i = !1, a = 2, o = !1;
			t.mask && (n = t.maskBuffer || h, t.generateMask ? t.generateMask(n) : (v === g && (_ === void 0 && (_ = Buffer.alloc(g)), r(_, 0, g), v = 0), n[0] = _[v++], n[1] = _[v++], n[2] = _[v++], n[3] = _[v++]), o = (n[0] | n[1] | n[2] | n[3]) === 0, a = 6);
			let s;
			typeof e == "string" ? (!t.mask || o) && t[m] !== void 0 ? s = t[m] : (e = Buffer.from(e), s = e.length) : (s = e.length, i = t.mask && t.readOnly && !o);
			let c = s;
			s >= 65536 ? (a += 8, c = 127) : s > 125 && (a += 2, c = 126);
			let l = Buffer.allocUnsafe(i ? s + a : a);
			return l[0] = t.fin ? t.opcode | 128 : t.opcode, t.rsv1 && (l[0] |= 64), l[1] = c, c === 126 ? l.writeUInt16BE(s, 2) : c === 127 && (l[2] = l[3] = 0, l.writeUIntBE(s, 4, 6)), !t.mask || (l[1] |= 128, l[a - 4] = n[0], l[a - 3] = n[1], l[a - 2] = n[2], l[a - 1] = n[3], o) ? [l, e] : i ? (f(e, n, l, a, s), [l]) : (f(e, n, e, 0, s), [l, e]);
		}
		close(t, n, r, i) {
			let o;
			if (t === void 0) o = a;
			else if (typeof t != "number" || !d(t)) throw TypeError("First argument must be a valid error code number");
			else if (n === void 0 || !n.length) o = Buffer.allocUnsafe(2), o.writeUInt16BE(t, 0);
			else {
				let e = Buffer.byteLength(n);
				if (e > 123) throw RangeError("The message must not be greater than 123 bytes");
				o = Buffer.allocUnsafe(2 + e), o.writeUInt16BE(t, 0), typeof n == "string" ? o.write(n, 2) : o.set(n, 2);
			}
			let s = {
				[m]: o.length,
				fin: !0,
				generateMask: this._generateMask,
				mask: r,
				maskBuffer: this._maskBuffer,
				opcode: 8,
				readOnly: !1,
				rsv1: !1
			};
			this._state === b ? this.sendFrame(e.frame(o, s), i) : this.enqueue([
				this.dispatch,
				o,
				!1,
				s,
				i
			]);
		}
		ping(t, n, r) {
			let i, a;
			if (typeof t == "string" ? (i = Buffer.byteLength(t), a = !1) : u(t) ? (i = t.size, a = !1) : (t = p(t), i = t.length, a = p.readOnly), i > 125) throw RangeError("The data size must not be greater than 125 bytes");
			let o = {
				[m]: i,
				fin: !0,
				generateMask: this._generateMask,
				mask: n,
				maskBuffer: this._maskBuffer,
				opcode: 9,
				readOnly: a,
				rsv1: !1
			};
			u(t) ? this._state === b ? this.getBlobData(t, !1, o, r) : this.enqueue([
				this.getBlobData,
				t,
				!1,
				o,
				r
			]) : this._state === b ? this.sendFrame(e.frame(t, o), r) : this.enqueue([
				this.dispatch,
				t,
				!1,
				o,
				r
			]);
		}
		pong(t, n, r) {
			let i, a;
			if (typeof t == "string" ? (i = Buffer.byteLength(t), a = !1) : u(t) ? (i = t.size, a = !1) : (t = p(t), i = t.length, a = p.readOnly), i > 125) throw RangeError("The data size must not be greater than 125 bytes");
			let o = {
				[m]: i,
				fin: !0,
				generateMask: this._generateMask,
				mask: n,
				maskBuffer: this._maskBuffer,
				opcode: 10,
				readOnly: a,
				rsv1: !1
			};
			u(t) ? this._state === b ? this.getBlobData(t, !1, o, r) : this.enqueue([
				this.getBlobData,
				t,
				!1,
				o,
				r
			]) : this._state === b ? this.sendFrame(e.frame(t, o), r) : this.enqueue([
				this.dispatch,
				t,
				!1,
				o,
				r
			]);
		}
		send(e, t, n) {
			let r = this._extensions[i.extensionName], a = t.binary ? 2 : 1, o = t.compress, s, c;
			typeof e == "string" ? (s = Buffer.byteLength(e), c = !1) : u(e) ? (s = e.size, c = !1) : (e = p(e), s = e.length, c = p.readOnly), this._firstFragment ? (this._firstFragment = !1, o && r && r.params[r._isServer ? "server_no_context_takeover" : "client_no_context_takeover"] && (o = s >= r._threshold), this._compress = o) : (o = !1, a = 0), t.fin && (this._firstFragment = !0);
			let l = {
				[m]: s,
				fin: t.fin,
				generateMask: this._generateMask,
				mask: t.mask,
				maskBuffer: this._maskBuffer,
				opcode: a,
				readOnly: c,
				rsv1: o
			};
			u(e) ? this._state === b ? this.getBlobData(e, this._compress, l, n) : this.enqueue([
				this.getBlobData,
				e,
				this._compress,
				l,
				n
			]) : this._state === b ? this.dispatch(e, this._compress, l, n) : this.enqueue([
				this.dispatch,
				e,
				this._compress,
				l,
				n
			]);
		}
		getBlobData(t, n, r, i) {
			this._bufferedBytes += r[m], this._state = S, t.arrayBuffer().then((t) => {
				if (this._socket.destroyed) {
					let e = /* @__PURE__ */ Error("The socket was closed while the blob was being read");
					process.nextTick(C, this, e, i);
					return;
				}
				this._bufferedBytes -= r[m];
				let a = p(t);
				n ? this.dispatch(a, n, r, i) : (this._state = b, this.sendFrame(e.frame(a, r), i), this.dequeue());
			}).catch((e) => {
				process.nextTick(T, this, e, i);
			});
		}
		dispatch(t, n, r, a) {
			if (!n) {
				this.sendFrame(e.frame(t, r), a);
				return;
			}
			let o = this._extensions[i.extensionName];
			this._bufferedBytes += r[m], this._state = x, o.compress(t, r.fin, (t, n) => {
				if (this._socket.destroyed) {
					C(this, /* @__PURE__ */ Error("The socket was closed while data was being compressed"), a);
					return;
				}
				this._bufferedBytes -= r[m], this._state = b, r.readOnly = !1, this.sendFrame(e.frame(n, r), a), this.dequeue();
			});
		}
		dequeue() {
			for (; this._state === b && this._queue.length;) {
				let e = this._queue.shift();
				this._bufferedBytes -= e[3][m], Reflect.apply(e[0], this, e.slice(1));
			}
		}
		enqueue(e) {
			this._bufferedBytes += e[3][m], this._queue.push(e);
		}
		sendFrame(e, t) {
			e.length === 2 ? (this._socket.cork(), this._socket.write(e[0]), this._socket.write(e[1], t), this._socket.uncork()) : this._socket.write(e[0], t);
		}
	};
	function C(e, t, n) {
		typeof n == "function" && n(t);
		for (let n = 0; n < e._queue.length; n++) {
			let r = e._queue[n], i = r[r.length - 1];
			typeof i == "function" && i(t);
		}
	}
	function T(e, t, n) {
		C(e, t, n), e.onerror(t);
	}
})), ee = /* @__PURE__ */ n(((e, t) => {
	var { kForOnEventAttribute: n, kListener: r } = y(), i = Symbol("kCode"), a = Symbol("kData"), o = Symbol("kError"), s = Symbol("kMessage"), c = Symbol("kReason"), l = Symbol("kTarget"), u = Symbol("kType"), d = Symbol("kWasClean"), f = class {
		constructor(e) {
			this[l] = null, this[u] = e;
		}
		get target() {
			return this[l];
		}
		get type() {
			return this[u];
		}
	};
	Object.defineProperty(f.prototype, "target", { enumerable: !0 }), Object.defineProperty(f.prototype, "type", { enumerable: !0 });
	var p = class extends f {
		constructor(e, t = {}) {
			super(e), this[i] = t.code === void 0 ? 0 : t.code, this[c] = t.reason === void 0 ? "" : t.reason, this[d] = t.wasClean === void 0 ? !1 : t.wasClean;
		}
		get code() {
			return this[i];
		}
		get reason() {
			return this[c];
		}
		get wasClean() {
			return this[d];
		}
	};
	Object.defineProperty(p.prototype, "code", { enumerable: !0 }), Object.defineProperty(p.prototype, "reason", { enumerable: !0 }), Object.defineProperty(p.prototype, "wasClean", { enumerable: !0 });
	var m = class extends f {
		constructor(e, t = {}) {
			super(e), this[o] = t.error === void 0 ? null : t.error, this[s] = t.message === void 0 ? "" : t.message;
		}
		get error() {
			return this[o];
		}
		get message() {
			return this[s];
		}
	};
	Object.defineProperty(m.prototype, "error", { enumerable: !0 }), Object.defineProperty(m.prototype, "message", { enumerable: !0 });
	var h = class extends f {
		constructor(e, t = {}) {
			super(e), this[a] = t.data === void 0 ? null : t.data;
		}
		get data() {
			return this[a];
		}
	};
	Object.defineProperty(h.prototype, "data", { enumerable: !0 }), t.exports = {
		CloseEvent: p,
		ErrorEvent: m,
		Event: f,
		EventTarget: {
			addEventListener(e, t, i = {}) {
				for (let a of this.listeners(e)) if (!i[n] && a[r] === t && !a[n]) return;
				let a;
				if (e === "message") a = function(e, n) {
					let r = new h("message", { data: n ? e : e.toString() });
					r[l] = this, g(t, this, r);
				};
				else if (e === "close") a = function(e, n) {
					let r = new p("close", {
						code: e,
						reason: n.toString(),
						wasClean: this._closeFrameReceived && this._closeFrameSent
					});
					r[l] = this, g(t, this, r);
				};
				else if (e === "error") a = function(e) {
					let n = new m("error", {
						error: e,
						message: e.message
					});
					n[l] = this, g(t, this, n);
				};
				else if (e === "open") a = function() {
					let e = new f("open");
					e[l] = this, g(t, this, e);
				};
				else return;
				a[n] = !!i[n], a[r] = t, i.once ? this.once(e, a) : this.on(e, a);
			},
			removeEventListener(e, t) {
				for (let i of this.listeners(e)) if (i[r] === t && !i[n]) {
					this.removeListener(e, i);
					break;
				}
			}
		},
		MessageEvent: h
	};
	function g(e, t, n) {
		typeof e == "object" && e.handleEvent ? e.handleEvent.call(e, n) : e.call(t, n);
	}
})), N = /* @__PURE__ */ n(((e, t) => {
	var { tokenChars: n } = A();
	function r(e, t, n) {
		e[t] === void 0 ? e[t] = [n] : e[t].push(n);
	}
	function i(e) {
		let t = Object.create(null), i = Object.create(null), a = !1, o = !1, s = !1, c, l, u = -1, d = -1, f = -1, p = 0;
		for (; p < e.length; p++) if (d = e.charCodeAt(p), c === void 0) if (f === -1 && n[d] === 1) u === -1 && (u = p);
		else if (p !== 0 && (d === 32 || d === 9)) f === -1 && u !== -1 && (f = p);
		else if (d === 59 || d === 44) {
			if (u === -1) throw SyntaxError(`Unexpected character at index ${p}`);
			f === -1 && (f = p);
			let n = e.slice(u, f);
			d === 44 ? (r(t, n, i), i = Object.create(null)) : c = n, u = f = -1;
		} else throw SyntaxError(`Unexpected character at index ${p}`);
		else if (l === void 0) if (f === -1 && n[d] === 1) u === -1 && (u = p);
		else if (d === 32 || d === 9) f === -1 && u !== -1 && (f = p);
		else if (d === 59 || d === 44) {
			if (u === -1) throw SyntaxError(`Unexpected character at index ${p}`);
			f === -1 && (f = p), r(i, e.slice(u, f), !0), d === 44 && (r(t, c, i), i = Object.create(null), c = void 0), u = f = -1;
		} else if (d === 61 && u !== -1 && f === -1) l = e.slice(u, p), u = f = -1;
		else throw SyntaxError(`Unexpected character at index ${p}`);
		else if (o) {
			if (n[d] !== 1) throw SyntaxError(`Unexpected character at index ${p}`);
			u === -1 ? u = p : a ||= !0, o = !1;
		} else if (s) if (n[d] === 1) u === -1 && (u = p);
		else if (d === 34 && u !== -1) s = !1, f = p;
		else if (d === 92) o = !0;
		else throw SyntaxError(`Unexpected character at index ${p}`);
		else if (d === 34 && e.charCodeAt(p - 1) === 61) s = !0;
		else if (f === -1 && n[d] === 1) u === -1 && (u = p);
		else if (u !== -1 && (d === 32 || d === 9)) f === -1 && (f = p);
		else if (d === 59 || d === 44) {
			if (u === -1) throw SyntaxError(`Unexpected character at index ${p}`);
			f === -1 && (f = p);
			let n = e.slice(u, f);
			a &&= (n = n.replace(/\\/g, ""), !1), r(i, l, n), d === 44 && (r(t, c, i), i = Object.create(null), c = void 0), l = void 0, u = f = -1;
		} else throw SyntaxError(`Unexpected character at index ${p}`);
		if (u === -1 || s || d === 32 || d === 9) throw SyntaxError("Unexpected end of input");
		f === -1 && (f = p);
		let m = e.slice(u, f);
		return c === void 0 ? r(t, m, i) : (l === void 0 ? r(i, m, !0) : a ? r(i, l, m.replace(/\\/g, "")) : r(i, l, m), r(t, c, i)), t;
	}
	function a(e) {
		return Object.keys(e).map((t) => {
			let n = e[t];
			return Array.isArray(n) || (n = [n]), n.map((e) => [t].concat(Object.keys(e).map((t) => {
				let n = e[t];
				return Array.isArray(n) || (n = [n]), n.map((e) => e === !0 ? t : `${t}=${e}`).join("; ");
			})).join("; ")).join(", ");
		}).join(", ");
	}
	t.exports = {
		format: a,
		parse: i
	};
})), P = /* @__PURE__ */ n(((e, t) => {
	var n = f(), i = d(), o = s(), u = a(), p = _(), { randomBytes: m, createHash: h } = c(), { Duplex: g, Readable: v } = l(), { URL: b } = r(), x = E(), S = j(), C = M(), { isBlob: T } = A(), { BINARY_TYPES: D, CLOSE_TIMEOUT: O, EMPTY_BUFFER: k, GUID: P, kForOnEventAttribute: F, kListener: I, kStatusCode: L, kWebSocket: R, NOOP: z } = y(), { EventTarget: { addEventListener: B, removeEventListener: te } } = ee(), { format: ne, parse: re } = N(), { toBuffer: ie } = w(), V = Symbol("kAborted"), H = [8, 13], U = [
		"CONNECTING",
		"OPEN",
		"CLOSING",
		"CLOSED"
	], ae = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/, W = class e extends n {
		constructor(t, n, r) {
			super(), this._binaryType = D[0], this._closeCode = 1006, this._closeFrameReceived = !1, this._closeFrameSent = !1, this._closeMessage = k, this._closeTimer = null, this._errorEmitted = !1, this._extensions = {}, this._paused = !1, this._protocol = "", this._readyState = e.CONNECTING, this._receiver = null, this._sender = null, this._socket = null, t === null ? (this._autoPong = r.autoPong, this._closeTimeout = r.closeTimeout, this._isServer = !0) : (this._bufferedAmount = 0, this._isServer = !1, this._redirects = 0, n === void 0 ? n = [] : Array.isArray(n) || (typeof n == "object" && n ? (r = n, n = []) : n = [n]), G(this, t, n, r));
		}
		get binaryType() {
			return this._binaryType;
		}
		set binaryType(e) {
			D.includes(e) && (this._binaryType = e, this._receiver && (this._receiver._binaryType = e));
		}
		get bufferedAmount() {
			return this._socket ? this._socket._writableState.length + this._sender._bufferedBytes : this._bufferedAmount;
		}
		get extensions() {
			return Object.keys(this._extensions).join();
		}
		get isPaused() {
			return this._paused;
		}
		/* istanbul ignore next */
		get onclose() {
			return null;
		}
		/* istanbul ignore next */
		get onerror() {
			return null;
		}
		/* istanbul ignore next */
		get onopen() {
			return null;
		}
		/* istanbul ignore next */
		get onmessage() {
			return null;
		}
		get protocol() {
			return this._protocol;
		}
		get readyState() {
			return this._readyState;
		}
		get url() {
			return this._url;
		}
		setSocket(t, n, r) {
			let i = new S({
				allowSynchronousEvents: r.allowSynchronousEvents,
				binaryType: this.binaryType,
				extensions: this._extensions,
				isServer: this._isServer,
				maxPayload: r.maxPayload,
				skipUTF8Validation: r.skipUTF8Validation
			}), a = new C(t, this._extensions, r.generateMask);
			this._receiver = i, this._sender = a, this._socket = t, i[R] = this, a[R] = this, t[R] = this, i.on("conclude", ce), i.on("drain", le), i.on("error", ue), i.on("message", de), i.on("ping", fe), i.on("pong", pe), a.onerror = me, t.setTimeout && t.setTimeout(0), t.setNoDelay && t.setNoDelay(), n.length > 0 && t.unshift(n), t.on("close", Q), t.on("data", $), t.on("end", he), t.on("error", ge), this._readyState = e.OPEN, this.emit("open");
		}
		emitClose() {
			if (!this._socket) {
				this._readyState = e.CLOSED, this.emit("close", this._closeCode, this._closeMessage);
				return;
			}
			this._extensions[x.extensionName] && this._extensions[x.extensionName].cleanup(), this._receiver.removeAllListeners(), this._readyState = e.CLOSED, this.emit("close", this._closeCode, this._closeMessage);
		}
		close(t, n) {
			if (this.readyState !== e.CLOSED) {
				if (this.readyState === e.CONNECTING) {
					q(this, this._req, "WebSocket was closed before the connection was established");
					return;
				}
				if (this.readyState === e.CLOSING) {
					this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end();
					return;
				}
				this._readyState = e.CLOSING, this._sender.close(t, n, !this._isServer, (e) => {
					e || (this._closeFrameSent = !0, (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end());
				}), Z(this);
			}
		}
		pause() {
			this.readyState === e.CONNECTING || this.readyState === e.CLOSED || (this._paused = !0, this._socket.pause());
		}
		ping(t, n, r) {
			if (this.readyState === e.CONNECTING) throw Error("WebSocket is not open: readyState 0 (CONNECTING)");
			if (typeof t == "function" ? (r = t, t = n = void 0) : typeof n == "function" && (r = n, n = void 0), typeof t == "number" && (t = t.toString()), this.readyState !== e.OPEN) {
				J(this, t, r);
				return;
			}
			n === void 0 && (n = !this._isServer), this._sender.ping(t || k, n, r);
		}
		pong(t, n, r) {
			if (this.readyState === e.CONNECTING) throw Error("WebSocket is not open: readyState 0 (CONNECTING)");
			if (typeof t == "function" ? (r = t, t = n = void 0) : typeof n == "function" && (r = n, n = void 0), typeof t == "number" && (t = t.toString()), this.readyState !== e.OPEN) {
				J(this, t, r);
				return;
			}
			n === void 0 && (n = !this._isServer), this._sender.pong(t || k, n, r);
		}
		resume() {
			this.readyState === e.CONNECTING || this.readyState === e.CLOSED || (this._paused = !1, this._receiver._writableState.needDrain || this._socket.resume());
		}
		send(t, n, r) {
			if (this.readyState === e.CONNECTING) throw Error("WebSocket is not open: readyState 0 (CONNECTING)");
			if (typeof n == "function" && (r = n, n = {}), typeof t == "number" && (t = t.toString()), this.readyState !== e.OPEN) {
				J(this, t, r);
				return;
			}
			let i = {
				binary: typeof t != "string",
				mask: !this._isServer,
				compress: !0,
				fin: !0,
				...n
			};
			this._extensions[x.extensionName] || (i.compress = !1), this._sender.send(t || k, i, r);
		}
		terminate() {
			if (this.readyState !== e.CLOSED) {
				if (this.readyState === e.CONNECTING) {
					q(this, this._req, "WebSocket was closed before the connection was established");
					return;
				}
				this._socket && (this._readyState = e.CLOSING, this._socket.destroy());
			}
		}
	};
	Object.defineProperty(W, "CONNECTING", {
		enumerable: !0,
		value: U.indexOf("CONNECTING")
	}), Object.defineProperty(W.prototype, "CONNECTING", {
		enumerable: !0,
		value: U.indexOf("CONNECTING")
	}), Object.defineProperty(W, "OPEN", {
		enumerable: !0,
		value: U.indexOf("OPEN")
	}), Object.defineProperty(W.prototype, "OPEN", {
		enumerable: !0,
		value: U.indexOf("OPEN")
	}), Object.defineProperty(W, "CLOSING", {
		enumerable: !0,
		value: U.indexOf("CLOSING")
	}), Object.defineProperty(W.prototype, "CLOSING", {
		enumerable: !0,
		value: U.indexOf("CLOSING")
	}), Object.defineProperty(W, "CLOSED", {
		enumerable: !0,
		value: U.indexOf("CLOSED")
	}), Object.defineProperty(W.prototype, "CLOSED", {
		enumerable: !0,
		value: U.indexOf("CLOSED")
	}), [
		"binaryType",
		"bufferedAmount",
		"extensions",
		"isPaused",
		"protocol",
		"readyState",
		"url"
	].forEach((e) => {
		Object.defineProperty(W.prototype, e, { enumerable: !0 });
	}), [
		"open",
		"error",
		"close",
		"message"
	].forEach((e) => {
		Object.defineProperty(W.prototype, `on${e}`, {
			enumerable: !0,
			get() {
				for (let t of this.listeners(e)) if (t[F]) return t[I];
				return null;
			},
			set(t) {
				for (let t of this.listeners(e)) if (t[F]) {
					this.removeListener(e, t);
					break;
				}
				typeof t == "function" && this.addEventListener(e, t, { [F]: !0 });
			}
		});
	}), W.prototype.addEventListener = B, W.prototype.removeEventListener = te, t.exports = W;
	function G(e, t, n, r) {
		let a = {
			allowSynchronousEvents: !0,
			autoPong: !0,
			closeTimeout: O,
			protocolVersion: H[1],
			maxPayload: 100 * 1024 * 1024,
			skipUTF8Validation: !1,
			perMessageDeflate: !0,
			followRedirects: !1,
			maxRedirects: 10,
			...r,
			socketPath: void 0,
			hostname: void 0,
			protocol: void 0,
			timeout: void 0,
			method: "GET",
			host: void 0,
			path: void 0,
			port: void 0
		};
		if (e._autoPong = a.autoPong, e._closeTimeout = a.closeTimeout, !H.includes(a.protocolVersion)) throw RangeError(`Unsupported protocol version: ${a.protocolVersion} (supported versions: ${H.join(", ")})`);
		let s;
		if (t instanceof b) s = t;
		else try {
			s = new b(t);
		} catch {
			throw SyntaxError(`Invalid URL: ${t}`);
		}
		s.protocol === "http:" ? s.protocol = "ws:" : s.protocol === "https:" && (s.protocol = "wss:"), e._url = s.href;
		let c = s.protocol === "wss:", l = s.protocol === "ws+unix:", u;
		if (s.protocol !== "ws:" && !c && !l ? u = "The URL's protocol must be one of \"ws:\", \"wss:\", \"http:\", \"https:\", or \"ws+unix:\"" : l && !s.pathname ? u = "The URL's pathname is empty" : s.hash && (u = "The URL contains a fragment identifier"), u) {
			let t = SyntaxError(u);
			if (e._redirects === 0) throw t;
			K(e, t);
			return;
		}
		let d = c ? 443 : 80, f = m(16).toString("base64"), p = c ? i.request : o.request, g = /* @__PURE__ */ new Set(), _;
		if (a.createConnection = a.createConnection || (c ? se : oe), a.defaultPort = a.defaultPort || d, a.port = s.port || d, a.host = s.hostname.startsWith("[") ? s.hostname.slice(1, -1) : s.hostname, a.headers = {
			...a.headers,
			"Sec-WebSocket-Version": a.protocolVersion,
			"Sec-WebSocket-Key": f,
			Connection: "Upgrade",
			Upgrade: "websocket"
		}, a.path = s.pathname + s.search, a.timeout = a.handshakeTimeout, a.perMessageDeflate && (_ = new x({
			...a.perMessageDeflate,
			isServer: !1,
			maxPayload: a.maxPayload
		}), a.headers["Sec-WebSocket-Extensions"] = ne({ [x.extensionName]: _.offer() })), n.length) {
			for (let e of n) {
				if (typeof e != "string" || !ae.test(e) || g.has(e)) throw SyntaxError("An invalid or duplicated subprotocol was specified");
				g.add(e);
			}
			a.headers["Sec-WebSocket-Protocol"] = n.join(",");
		}
		if (a.origin && (a.protocolVersion < 13 ? a.headers["Sec-WebSocket-Origin"] = a.origin : a.headers.Origin = a.origin), (s.username || s.password) && (a.auth = `${s.username}:${s.password}`), l) {
			let e = a.path.split(":");
			a.socketPath = e[0], a.path = e[1];
		}
		let v;
		if (a.followRedirects) {
			if (e._redirects === 0) {
				e._originalIpc = l, e._originalSecure = c, e._originalHostOrSocketPath = l ? a.socketPath : s.host;
				let t = r && r.headers;
				if (r = {
					...r,
					headers: {}
				}, t) for (let [e, n] of Object.entries(t)) r.headers[e.toLowerCase()] = n;
			} else if (e.listenerCount("redirect") === 0) {
				let t = l ? e._originalIpc ? a.socketPath === e._originalHostOrSocketPath : !1 : e._originalIpc ? !1 : s.host === e._originalHostOrSocketPath;
				(!t || e._originalSecure && !c) && (delete a.headers.authorization, delete a.headers.cookie, t || delete a.headers.host, a.auth = void 0);
			}
			a.auth && !r.headers.authorization && (r.headers.authorization = "Basic " + Buffer.from(a.auth).toString("base64")), v = e._req = p(a), e._redirects && e.emit("redirect", e.url, v);
		} else v = e._req = p(a);
		a.timeout && v.on("timeout", () => {
			q(e, v, "Opening handshake has timed out");
		}), v.on("error", (t) => {
			v === null || v[V] || (v = e._req = null, K(e, t));
		}), v.on("response", (i) => {
			let o = i.headers.location, s = i.statusCode;
			if (o && a.followRedirects && s >= 300 && s < 400) {
				if (++e._redirects > a.maxRedirects) {
					q(e, v, "Maximum redirects exceeded");
					return;
				}
				v.abort();
				let i;
				try {
					i = new b(o, t);
				} catch {
					K(e, /* @__PURE__ */ SyntaxError(`Invalid URL: ${o}`));
					return;
				}
				G(e, i, n, r);
			} else e.emit("unexpected-response", v, i) || q(e, v, `Unexpected server response: ${i.statusCode}`);
		}), v.on("upgrade", (t, n, r) => {
			if (e.emit("upgrade", t), e.readyState !== W.CONNECTING) return;
			v = e._req = null;
			let i = t.headers.upgrade;
			if (i === void 0 || i.toLowerCase() !== "websocket") {
				q(e, n, "Invalid Upgrade header");
				return;
			}
			let o = h("sha1").update(f + P).digest("base64");
			if (t.headers["sec-websocket-accept"] !== o) {
				q(e, n, "Invalid Sec-WebSocket-Accept header");
				return;
			}
			let s = t.headers["sec-websocket-protocol"], c;
			if (s === void 0 ? g.size && (c = "Server sent no subprotocol") : g.size ? g.has(s) || (c = "Server sent an invalid subprotocol") : c = "Server sent a subprotocol but none was requested", c) {
				q(e, n, c);
				return;
			}
			s && (e._protocol = s);
			let l = t.headers["sec-websocket-extensions"];
			if (l !== void 0) {
				if (!_) {
					q(e, n, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
					return;
				}
				let t;
				try {
					t = re(l);
				} catch {
					q(e, n, "Invalid Sec-WebSocket-Extensions header");
					return;
				}
				let r = Object.keys(t);
				if (r.length !== 1 || r[0] !== x.extensionName) {
					q(e, n, "Server indicated an extension that was not requested");
					return;
				}
				try {
					_.accept(t[x.extensionName]);
				} catch {
					q(e, n, "Invalid Sec-WebSocket-Extensions header");
					return;
				}
				e._extensions[x.extensionName] = _;
			}
			e.setSocket(n, r, {
				allowSynchronousEvents: a.allowSynchronousEvents,
				generateMask: a.generateMask,
				maxPayload: a.maxPayload,
				skipUTF8Validation: a.skipUTF8Validation
			});
		}), a.finishRequest ? a.finishRequest(v, e) : v.end();
	}
	function K(e, t) {
		e._readyState = W.CLOSING, e._errorEmitted = !0, e.emit("error", t), e.emitClose();
	}
	function oe(e) {
		return e.path = e.socketPath, u.connect(e);
	}
	function se(e) {
		return e.path = void 0, !e.servername && e.servername !== "" && (e.servername = u.isIP(e.host) ? "" : e.host), p.connect(e);
	}
	function q(e, t, n) {
		e._readyState = W.CLOSING;
		let r = Error(n);
		Error.captureStackTrace(r, q), t.setHeader ? (t[V] = !0, t.abort(), t.socket && !t.socket.destroyed && t.socket.destroy(), process.nextTick(K, e, r)) : (t.destroy(r), t.once("error", e.emit.bind(e, "error")), t.once("close", e.emitClose.bind(e)));
	}
	function J(e, t, n) {
		if (t) {
			let n = T(t) ? t.size : ie(t).length;
			e._socket ? e._sender._bufferedBytes += n : e._bufferedAmount += n;
		}
		if (n) {
			let t = /* @__PURE__ */ Error(`WebSocket is not open: readyState ${e.readyState} (${U[e.readyState]})`);
			process.nextTick(n, t);
		}
	}
	function ce(e, t) {
		let n = this[R];
		n._closeFrameReceived = !0, n._closeMessage = t, n._closeCode = e, n._socket[R] !== void 0 && (n._socket.removeListener("data", $), process.nextTick(X, n._socket), e === 1005 ? n.close() : n.close(e, t));
	}
	function le() {
		let e = this[R];
		e.isPaused || e._socket.resume();
	}
	function ue(e) {
		let t = this[R];
		t._socket[R] !== void 0 && (t._socket.removeListener("data", $), process.nextTick(X, t._socket), t.close(e[L])), t._errorEmitted || (t._errorEmitted = !0, t.emit("error", e));
	}
	function Y() {
		this[R].emitClose();
	}
	function de(e, t) {
		this[R].emit("message", e, t);
	}
	function fe(e) {
		let t = this[R];
		t._autoPong && t.pong(e, !this._isServer, z), t.emit("ping", e);
	}
	function pe(e) {
		this[R].emit("pong", e);
	}
	function X(e) {
		e.resume();
	}
	function me(e) {
		let t = this[R];
		t.readyState !== W.CLOSED && (t.readyState === W.OPEN && (t._readyState = W.CLOSING, Z(t)), this._socket.end(), t._errorEmitted || (t._errorEmitted = !0, t.emit("error", e)));
	}
	function Z(e) {
		e._closeTimer = setTimeout(e._socket.destroy.bind(e._socket), e._closeTimeout);
	}
	function Q() {
		let e = this[R];
		if (this.removeListener("close", Q), this.removeListener("data", $), this.removeListener("end", he), e._readyState = W.CLOSING, !this._readableState.endEmitted && !e._closeFrameReceived && !e._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
			let t = this.read(this._readableState.length);
			e._receiver.write(t);
		}
		e._receiver.end(), this[R] = void 0, clearTimeout(e._closeTimer), e._receiver._writableState.finished || e._receiver._writableState.errorEmitted ? e.emitClose() : (e._receiver.on("error", Y), e._receiver.on("finish", Y));
	}
	function $(e) {
		this[R]._receiver.write(e) || this.pause();
	}
	function he() {
		let e = this[R];
		e._readyState = W.CLOSING, e._receiver.end(), this.end();
	}
	function ge() {
		let e = this[R];
		this.removeListener("error", ge), this.on("error", z), e && (e._readyState = W.CLOSING, this.destroy());
	}
})), F = /* @__PURE__ */ n(((e, t) => {
	P();
	var { Duplex: n } = l();
	function r(e) {
		e.emit("close");
	}
	function i() {
		!this.destroyed && this._writableState.finished && this.destroy();
	}
	function a(e) {
		this.removeListener("error", a), this.destroy(), this.listenerCount("error") === 0 && this.emit("error", e);
	}
	function o(e, t) {
		let o = !0, s = new n({
			...t,
			autoDestroy: !1,
			emitClose: !1,
			objectMode: !1,
			writableObjectMode: !1
		});
		return e.on("message", function(t, n) {
			let r = !n && s._readableState.objectMode ? t.toString() : t;
			s.push(r) || e.pause();
		}), e.once("error", function(e) {
			s.destroyed || (o = !1, s.destroy(e));
		}), e.once("close", function() {
			s.destroyed || s.push(null);
		}), s._destroy = function(t, n) {
			if (e.readyState === e.CLOSED) {
				n(t), process.nextTick(r, s);
				return;
			}
			let i = !1;
			e.once("error", function(e) {
				i = !0, n(e);
			}), e.once("close", function() {
				i || n(t), process.nextTick(r, s);
			}), o && e.terminate();
		}, s._final = function(t) {
			if (e.readyState === e.CONNECTING) {
				e.once("open", function() {
					s._final(t);
				});
				return;
			}
			e._socket !== null && (e._socket._writableState.finished ? (t(), s._readableState.endEmitted && s.destroy()) : (e._socket.once("finish", function() {
				t();
			}), e.close()));
		}, s._read = function() {
			e.isPaused && e.resume();
		}, s._write = function(t, n, r) {
			if (e.readyState === e.CONNECTING) {
				e.once("open", function() {
					s._write(t, n, r);
				});
				return;
			}
			e.send(t, r);
		}, s.on("end", i), s.on("error", a), s;
	}
	t.exports = o;
})), I = /* @__PURE__ */ n(((e, t) => {
	var { tokenChars: n } = A();
	function r(e) {
		let t = /* @__PURE__ */ new Set(), r = -1, i = -1, a = 0;
		for (; a < e.length; a++) {
			let o = e.charCodeAt(a);
			if (i === -1 && n[o] === 1) r === -1 && (r = a);
			else if (a !== 0 && (o === 32 || o === 9)) i === -1 && r !== -1 && (i = a);
			else if (o === 44) {
				if (r === -1) throw SyntaxError(`Unexpected character at index ${a}`);
				i === -1 && (i = a);
				let n = e.slice(r, i);
				if (t.has(n)) throw SyntaxError(`The "${n}" subprotocol is duplicated`);
				t.add(n), r = i = -1;
			} else throw SyntaxError(`Unexpected character at index ${a}`);
		}
		if (r === -1 || i !== -1) throw SyntaxError("Unexpected end of input");
		let o = e.slice(r, a);
		if (t.has(o)) throw SyntaxError(`The "${o}" subprotocol is duplicated`);
		return t.add(o), t;
	}
	t.exports = { parse: r };
})), L = /* @__PURE__ */ n(((e, t) => {
	var n = f(), r = s(), { Duplex: i } = l(), { createHash: a } = c(), o = N(), u = E(), d = I(), p = P(), { CLOSE_TIMEOUT: m, GUID: h, kWebSocket: g } = y(), _ = /^[+/0-9A-Za-z]{22}==$/, v = 0, b = 1, x = 2;
	t.exports = class extends n {
		constructor(e, t) {
			if (super(), e = {
				allowSynchronousEvents: !0,
				autoPong: !0,
				maxPayload: 100 * 1024 * 1024,
				skipUTF8Validation: !1,
				perMessageDeflate: !1,
				handleProtocols: null,
				clientTracking: !0,
				closeTimeout: m,
				verifyClient: null,
				noServer: !1,
				backlog: null,
				server: null,
				host: null,
				path: null,
				port: null,
				WebSocket: p,
				...e
			}, e.port == null && !e.server && !e.noServer || e.port != null && (e.server || e.noServer) || e.server && e.noServer) throw TypeError("One and only one of the \"port\", \"server\", or \"noServer\" options must be specified");
			if (e.port == null ? e.server && (this._server = e.server) : (this._server = r.createServer((e, t) => {
				let n = r.STATUS_CODES[426];
				t.writeHead(426, {
					"Content-Length": n.length,
					"Content-Type": "text/plain"
				}), t.end(n);
			}), this._server.listen(e.port, e.host, e.backlog, t)), this._server) {
				let e = this.emit.bind(this, "connection");
				this._removeListeners = S(this._server, {
					listening: this.emit.bind(this, "listening"),
					error: this.emit.bind(this, "error"),
					upgrade: (t, n, r) => {
						this.handleUpgrade(t, n, r, e);
					}
				});
			}
			e.perMessageDeflate === !0 && (e.perMessageDeflate = {}), e.clientTracking && (this.clients = /* @__PURE__ */ new Set(), this._shouldEmitClose = !1), this.options = e, this._state = v;
		}
		address() {
			if (this.options.noServer) throw Error("The server is operating in \"noServer\" mode");
			return this._server ? this._server.address() : null;
		}
		close(e) {
			if (this._state === x) {
				e && this.once("close", () => {
					e(/* @__PURE__ */ Error("The server is not running"));
				}), process.nextTick(C, this);
				return;
			}
			if (e && this.once("close", e), this._state !== b) if (this._state = b, this.options.noServer || this.options.server) this._server && (this._removeListeners(), this._removeListeners = this._server = null), this.clients && this.clients.size ? this._shouldEmitClose = !0 : process.nextTick(C, this);
			else {
				let e = this._server;
				this._removeListeners(), this._removeListeners = this._server = null, e.close(() => {
					C(this);
				});
			}
		}
		shouldHandle(e) {
			if (this.options.path) {
				let t = e.url.indexOf("?");
				if ((t === -1 ? e.url : e.url.slice(0, t)) !== this.options.path) return !1;
			}
			return !0;
		}
		handleUpgrade(e, t, n, r) {
			t.on("error", w);
			let i = e.headers["sec-websocket-key"], a = e.headers.upgrade, s = +e.headers["sec-websocket-version"];
			if (e.method !== "GET") {
				D(this, e, t, 405, "Invalid HTTP method");
				return;
			}
			if (a === void 0 || a.toLowerCase() !== "websocket") {
				D(this, e, t, 400, "Invalid Upgrade header");
				return;
			}
			if (i === void 0 || !_.test(i)) {
				D(this, e, t, 400, "Missing or invalid Sec-WebSocket-Key header");
				return;
			}
			if (s !== 13 && s !== 8) {
				D(this, e, t, 400, "Missing or invalid Sec-WebSocket-Version header", { "Sec-WebSocket-Version": "13, 8" });
				return;
			}
			if (!this.shouldHandle(e)) {
				T(t, 400);
				return;
			}
			let c = e.headers["sec-websocket-protocol"], l = /* @__PURE__ */ new Set();
			if (c !== void 0) try {
				l = d.parse(c);
			} catch {
				D(this, e, t, 400, "Invalid Sec-WebSocket-Protocol header");
				return;
			}
			let f = e.headers["sec-websocket-extensions"], p = {};
			if (this.options.perMessageDeflate && f !== void 0) {
				let n = new u({
					...this.options.perMessageDeflate,
					isServer: !0,
					maxPayload: this.options.maxPayload
				});
				try {
					let e = o.parse(f);
					e[u.extensionName] && (n.accept(e[u.extensionName]), p[u.extensionName] = n);
				} catch {
					D(this, e, t, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header");
					return;
				}
			}
			if (this.options.verifyClient) {
				let a = {
					origin: e.headers[`${s === 8 ? "sec-websocket-origin" : "origin"}`],
					secure: !!(e.socket.authorized || e.socket.encrypted),
					req: e
				};
				if (this.options.verifyClient.length === 2) {
					this.options.verifyClient(a, (a, o, s, c) => {
						if (!a) return T(t, o || 401, s, c);
						this.completeUpgrade(p, i, l, e, t, n, r);
					});
					return;
				}
				if (!this.options.verifyClient(a)) return T(t, 401);
			}
			this.completeUpgrade(p, i, l, e, t, n, r);
		}
		completeUpgrade(e, t, n, r, i, s, c) {
			if (!i.readable || !i.writable) return i.destroy();
			if (i[g]) throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");
			if (this._state > v) return T(i, 503);
			let l = [
				"HTTP/1.1 101 Switching Protocols",
				"Upgrade: websocket",
				"Connection: Upgrade",
				`Sec-WebSocket-Accept: ${a("sha1").update(t + h).digest("base64")}`
			], d = new this.options.WebSocket(null, void 0, this.options);
			if (n.size) {
				let e = this.options.handleProtocols ? this.options.handleProtocols(n, r) : n.values().next().value;
				e && (l.push(`Sec-WebSocket-Protocol: ${e}`), d._protocol = e);
			}
			if (e[u.extensionName]) {
				let t = e[u.extensionName].params, n = o.format({ [u.extensionName]: [t] });
				l.push(`Sec-WebSocket-Extensions: ${n}`), d._extensions = e;
			}
			this.emit("headers", l, r), i.write(l.concat("\r\n").join("\r\n")), i.removeListener("error", w), d.setSocket(i, s, {
				allowSynchronousEvents: this.options.allowSynchronousEvents,
				maxPayload: this.options.maxPayload,
				skipUTF8Validation: this.options.skipUTF8Validation
			}), this.clients && (this.clients.add(d), d.on("close", () => {
				this.clients.delete(d), this._shouldEmitClose && !this.clients.size && process.nextTick(C, this);
			})), c(d, r);
		}
	};
	function S(e, t) {
		for (let n of Object.keys(t)) e.on(n, t[n]);
		return function() {
			for (let n of Object.keys(t)) e.removeListener(n, t[n]);
		};
	}
	function C(e) {
		e._state = x, e.emit("close");
	}
	function w() {
		this.destroy();
	}
	function T(e, t, n, i) {
		n ||= r.STATUS_CODES[t], i = {
			Connection: "close",
			"Content-Type": "text/html",
			"Content-Length": Buffer.byteLength(n),
			...i
		}, e.once("finish", e.destroy), e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n` + Object.keys(i).map((e) => `${e}: ${i[e]}`).join("\r\n") + "\r\n\r\n" + n);
	}
	function D(e, t, n, r, i, a) {
		if (e.listenerCount("wsClientError")) {
			let r = Error(i);
			Error.captureStackTrace(r, D), e.emit("wsClientError", r, n, t);
		} else T(n, r, i, a);
	}
}));
F(), N(), E(), j(), M(), I();
var R = /* @__PURE__ */ t(P(), 1);
L();
var z = R.default, B = global;
B.WebSocket ||= z, B.window ||= global, B.self ||= global, B.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [
	{
		type: 1,
		value: 7,
		isEnabled: !0
	},
	{
		type: 2,
		value: "InternalApp",
		isEnabled: !0,
		isValid: !0
	},
	{
		type: 2,
		value: "InternalAppContext",
		isEnabled: !0,
		isValid: !0
	},
	{
		type: 2,
		value: "InternalStdoutContext",
		isEnabled: !0,
		isValid: !0
	},
	{
		type: 2,
		value: "InternalStderrContext",
		isEnabled: !0,
		isValid: !0
	},
	{
		type: 2,
		value: "InternalStdinContext",
		isEnabled: !0,
		isValid: !0
	},
	{
		type: 2,
		value: "InternalFocusContext",
		isEnabled: !0,
		isValid: !0
	}
], g.initialize(), g.connectToDevTools();
//#endregion
export {};
