import { t as e } from "./rolldown-runtime-BNuo_Jkg.js";
//#region ../../node_modules/.pnpm/pusher-js@8.5.0/node_modules/pusher-js/dist/web/pusher.js
var t = /* @__PURE__ */ e(((e, t) => {
	(function(n, r) {
		typeof e == "object" && typeof t == "object" ? t.exports = r() : typeof define == "function" && define.amd ? define([], r) : typeof e == "object" ? e.Pusher = r() : n.Pusher = r();
	})(self, () => (() => {
		var e = {
			594(e, t) {
				var n = this && this.__extends || (function() {
					var e = function(t, n) {
						return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
							e.__proto__ = t;
						} || function(e, t) {
							for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
						}, e(t, n);
					};
					return function(t, n) {
						e(t, n);
						function r() {
							this.constructor = t;
						}
						t.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
					};
				})();
				Object.defineProperty(t, "__esModule", { value: !0 });
				var r = 256, i = function() {
					function e(e) {
						e === void 0 && (e = "="), this._paddingCharacter = e;
					}
					return e.prototype.encodedLength = function(e) {
						return this._paddingCharacter ? (e + 2) / 3 * 4 | 0 : (e * 8 + 5) / 6 | 0;
					}, e.prototype.encode = function(e) {
						for (var t = "", n = 0; n < e.length - 2; n += 3) {
							var r = e[n] << 16 | e[n + 1] << 8 | e[n + 2];
							t += this._encodeByte(r >>> 18 & 63), t += this._encodeByte(r >>> 12 & 63), t += this._encodeByte(r >>> 6 & 63), t += this._encodeByte(r >>> 0 & 63);
						}
						var i = e.length - n;
						if (i > 0) {
							var r = e[n] << 16 | (i === 2 ? e[n + 1] << 8 : 0);
							t += this._encodeByte(r >>> 18 & 63), t += this._encodeByte(r >>> 12 & 63), i === 2 ? t += this._encodeByte(r >>> 6 & 63) : t += this._paddingCharacter || "", t += this._paddingCharacter || "";
						}
						return t;
					}, e.prototype.maxDecodedLength = function(e) {
						return this._paddingCharacter ? e / 4 * 3 | 0 : (e * 6 + 7) / 8 | 0;
					}, e.prototype.decodedLength = function(e) {
						return this.maxDecodedLength(e.length - this._getPaddingLength(e));
					}, e.prototype.decode = function(e) {
						if (e.length === 0) return new Uint8Array();
						for (var t = this._getPaddingLength(e), n = e.length - t, i = new Uint8Array(this.maxDecodedLength(n)), a = 0, o = 0, s = 0, c = 0, l = 0, u = 0, d = 0; o < n - 4; o += 4) c = this._decodeChar(e.charCodeAt(o + 0)), l = this._decodeChar(e.charCodeAt(o + 1)), u = this._decodeChar(e.charCodeAt(o + 2)), d = this._decodeChar(e.charCodeAt(o + 3)), i[a++] = c << 2 | l >>> 4, i[a++] = l << 4 | u >>> 2, i[a++] = u << 6 | d, s |= c & r, s |= l & r, s |= u & r, s |= d & r;
						if (o < n - 1 && (c = this._decodeChar(e.charCodeAt(o)), l = this._decodeChar(e.charCodeAt(o + 1)), i[a++] = c << 2 | l >>> 4, s |= c & r, s |= l & r), o < n - 2 && (u = this._decodeChar(e.charCodeAt(o + 2)), i[a++] = l << 4 | u >>> 2, s |= u & r), o < n - 3 && (d = this._decodeChar(e.charCodeAt(o + 3)), i[a++] = u << 6 | d, s |= d & r), s !== 0) throw Error("Base64Coder: incorrect characters for decoding");
						return i;
					}, e.prototype._encodeByte = function(e) {
						var t = e;
						return t += 65, t += 25 - e >>> 8 & 6, t += 51 - e >>> 8 & -75, t += 61 - e >>> 8 & -15, t += 62 - e >>> 8 & 3, String.fromCharCode(t);
					}, e.prototype._decodeChar = function(e) {
						var t = r;
						return t += (42 - e & e - 44) >>> 8 & -r + e - 43 + 62, t += (46 - e & e - 48) >>> 8 & -r + e - 47 + 63, t += (47 - e & e - 58) >>> 8 & -r + e - 48 + 52, t += (64 - e & e - 91) >>> 8 & -r + e - 65 + 0, t += (96 - e & e - 123) >>> 8 & -r + e - 97 + 26, t;
					}, e.prototype._getPaddingLength = function(e) {
						var t = 0;
						if (this._paddingCharacter) {
							for (var n = e.length - 1; n >= 0 && e[n] === this._paddingCharacter; n--) t++;
							if (e.length < 4 || t > 2) throw Error("Base64Coder: incorrect padding");
						}
						return t;
					}, e;
				}();
				t.Coder = i;
				var a = new i();
				function o(e) {
					return a.encode(e);
				}
				t.encode = o;
				function s(e) {
					return a.decode(e);
				}
				t.decode = s;
				var c = function(e) {
					n(t, e);
					function t() {
						return e !== null && e.apply(this, arguments) || this;
					}
					return t.prototype._encodeByte = function(e) {
						var t = e;
						return t += 65, t += 25 - e >>> 8 & 6, t += 51 - e >>> 8 & -75, t += 61 - e >>> 8 & -13, t += 62 - e >>> 8 & 49, String.fromCharCode(t);
					}, t.prototype._decodeChar = function(e) {
						var t = r;
						return t += (44 - e & e - 46) >>> 8 & -r + e - 45 + 62, t += (94 - e & e - 96) >>> 8 & -r + e - 95 + 63, t += (47 - e & e - 58) >>> 8 & -r + e - 48 + 52, t += (64 - e & e - 91) >>> 8 & -r + e - 65 + 0, t += (96 - e & e - 123) >>> 8 & -r + e - 97 + 26, t;
					}, t;
				}(i);
				t.URLSafeCoder = c;
				var l = new c();
				function u(e) {
					return l.encode(e);
				}
				t.encodeURLSafe = u;
				function d(e) {
					return l.decode(e);
				}
				t.decodeURLSafe = d, t.encodedLength = function(e) {
					return a.encodedLength(e);
				}, t.maxDecodedLength = function(e) {
					return a.maxDecodedLength(e);
				}, t.decodedLength = function(e) {
					return a.decodedLength(e);
				};
			},
			978(e, t) {
				var n = "utf8: invalid source encoding";
				function r(e) {
					for (var t = [], r = 0; r < e.length; r++) {
						var i = e[r];
						if (i & 128) {
							var a = void 0;
							if (i < 224) {
								if (r >= e.length) throw Error(n);
								var o = e[++r];
								if ((o & 192) != 128) throw Error(n);
								i = (i & 31) << 6 | o & 63, a = 128;
							} else if (i < 240) {
								if (r >= e.length - 1) throw Error(n);
								var o = e[++r], s = e[++r];
								if ((o & 192) != 128 || (s & 192) != 128) throw Error(n);
								i = (i & 15) << 12 | (o & 63) << 6 | s & 63, a = 2048;
							} else if (i < 248) {
								if (r >= e.length - 2) throw Error(n);
								var o = e[++r], s = e[++r], c = e[++r];
								if ((o & 192) != 128 || (s & 192) != 128 || (c & 192) != 128) throw Error(n);
								i = (i & 15) << 18 | (o & 63) << 12 | (s & 63) << 6 | c & 63, a = 65536;
							} else throw Error(n);
							if (i < a || i >= 55296 && i <= 57343) throw Error(n);
							if (i >= 65536) {
								if (i > 1114111) throw Error(n);
								i -= 65536, t.push(String.fromCharCode(55296 | i >> 10)), i = 56320 | i & 1023;
							}
						}
						t.push(String.fromCharCode(i));
					}
					return t.join("");
				}
				t.D4 = r;
			},
			721(e, t, n) {
				e.exports = n(207).default;
			},
			207(e, t, n) {
				n.d(t, { default: () => $ });
				class r {
					constructor(e, t) {
						this.lastId = 0, this.prefix = e, this.name = t;
					}
					create(e) {
						this.lastId++;
						var t = this.lastId, n = this.prefix + t, r = this.name + "[" + t + "]", i = !1, a = function() {
							i ||= (e.apply(null, arguments), !0);
						};
						return this[t] = a, {
							number: t,
							id: n,
							name: r,
							callback: a
						};
					}
					remove(e) {
						delete this[e.number];
					}
				}
				var i = new r("_pusher_script_", "Pusher.ScriptReceivers");
				let a = {
					VERSION: "8.5.0",
					PROTOCOL: 7,
					wsPort: 80,
					wssPort: 443,
					wsPath: "",
					httpHost: "sockjs.pusher.com",
					httpPort: 80,
					httpsPort: 443,
					httpPath: "/pusher",
					stats_host: "stats.pusher.com",
					authEndpoint: "/pusher/auth",
					authTransport: "ajax",
					activityTimeout: 12e4,
					pongTimeout: 3e4,
					unavailableTimeout: 1e4,
					userAuthentication: {
						endpoint: "/pusher/user-auth",
						transport: "ajax"
					},
					channelAuthorization: {
						endpoint: "/pusher/auth",
						transport: "ajax"
					},
					cdn_http: "http://js.pusher.com",
					cdn_https: "https://js.pusher.com",
					dependency_suffix: ""
				};
				class o {
					constructor(e) {
						this.options = e, this.receivers = e.receivers || i, this.loading = {};
					}
					load(e, t, n) {
						var r = this;
						if (r.loading[e] && r.loading[e].length > 0) r.loading[e].push(n);
						else {
							r.loading[e] = [n];
							var i = Y.createScriptRequest(r.getPath(e, t)), a = r.receivers.create(function(t) {
								if (r.receivers.remove(a), r.loading[e]) {
									var n = r.loading[e];
									delete r.loading[e];
									for (var o = function(e) {
										e || i.cleanup();
									}, s = 0; s < n.length; s++) n[s](t, o);
								}
							});
							i.send(a);
						}
					}
					getRoot(e) {
						var t, n = Y.getDocument().location.protocol;
						return t = e && e.useTLS || n === "https:" ? this.options.cdn_https : this.options.cdn_http, t.replace(/\/*$/, "") + "/" + this.options.version;
					}
					getPath(e, t) {
						return this.getRoot(t) + "/" + e + this.options.suffix + ".js";
					}
				}
				var s = new r("_pusher_dependencies", "Pusher.DependenciesReceivers"), c = new o({
					cdn_http: a.cdn_http,
					cdn_https: a.cdn_https,
					version: a.VERSION,
					suffix: a.dependency_suffix,
					receivers: s
				});
				let l = {
					baseUrl: "https://pusher.com",
					urls: {
						authenticationEndpoint: { path: "/docs/channels/server_api/authenticating_users" },
						authorizationEndpoint: { path: "/docs/channels/server_api/authorizing-users/" },
						javascriptQuickStart: { path: "/docs/javascript_quick_start" },
						triggeringClientEvents: { path: "/docs/client_api_guide/client_events#trigger-events" },
						encryptedChannelSupport: { fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support" }
					}
				}, u = { buildLogSuffix: function(e) {
					let t = l.urls[e];
					if (!t) return "";
					let n;
					return t.fullUrl ? n = t.fullUrl : t.path && (n = l.baseUrl + t.path), n ? `See: ${n}` : "";
				} };
				var d;
				(function(e) {
					e.UserAuthentication = "user-authentication", e.ChannelAuthorization = "channel-authorization";
				})(d ||= {});
				class ee extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class te extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class f extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class ne extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class p extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class m extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class h extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class g extends Error {
					constructor(e) {
						super(e), Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				class _ extends Error {
					constructor(e, t) {
						super(t), this.status = e, Object.setPrototypeOf(this, new.target.prototype);
					}
				}
				let v = function(e, t, n, r, i) {
					let a = Y.createXHR();
					for (var o in a.open("POST", n.endpoint, !0), a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), n.headers) a.setRequestHeader(o, n.headers[o]);
					if (n.headersProvider != null) {
						let e = n.headersProvider();
						for (var o in e) a.setRequestHeader(o, e[o]);
					}
					return a.onreadystatechange = function() {
						if (a.readyState === 4) if (a.status === 200) {
							let e, t = !1;
							try {
								e = JSON.parse(a.responseText), t = !0;
							} catch {
								i(new _(200, `JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${a.responseText}`), null);
							}
							t && i(null, e);
						} else {
							let e = "";
							switch (r) {
								case d.UserAuthentication:
									e = u.buildLogSuffix("authenticationEndpoint");
									break;
								case d.ChannelAuthorization:
									e = `Clients must be authorized to join private or presence channels. ${u.buildLogSuffix("authorizationEndpoint")}`;
									break;
							}
							i(new _(a.status, `Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${a.status} from ${n.endpoint}. ${e}`), null);
						}
					}, a.send(t), a;
				};
				function y(e) {
					return ce(oe(e));
				}
				for (var b = String.fromCharCode, x = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", re = {}, S = 0, ie = x.length; S < ie; S++) re[x.charAt(S)] = S;
				var ae = function(e) {
					var t = e.charCodeAt(0);
					return t < 128 ? e : t < 2048 ? b(192 | t >>> 6) + b(128 | t & 63) : b(224 | t >>> 12 & 15) + b(128 | t >>> 6 & 63) + b(128 | t & 63);
				}, oe = function(e) {
					return e.replace(/[^\x00-\x7F]/g, ae);
				}, se = function(e) {
					var t = [
						0,
						2,
						1
					][e.length % 3], n = e.charCodeAt(0) << 16 | (e.length > 1 ? e.charCodeAt(1) : 0) << 8 | (e.length > 2 ? e.charCodeAt(2) : 0);
					return [
						x.charAt(n >>> 18),
						x.charAt(n >>> 12 & 63),
						t >= 2 ? "=" : x.charAt(n >>> 6 & 63),
						t >= 1 ? "=" : x.charAt(n & 63)
					].join("");
				}, ce = window.btoa || function(e) {
					return e.replace(/[\s\S]{1,3}/g, se);
				};
				class le {
					constructor(e, t, n, r) {
						this.clear = t, this.timer = e(() => {
							this.timer &&= r(this.timer);
						}, n);
					}
					isRunning() {
						return this.timer !== null;
					}
					ensureAborted() {
						this.timer &&= (this.clear(this.timer), null);
					}
				}
				let ue = le;
				function de(e) {
					window.clearTimeout(e);
				}
				function fe(e) {
					window.clearInterval(e);
				}
				class C extends ue {
					constructor(e, t) {
						super(setTimeout, de, e, function(e) {
							return t(), null;
						});
					}
				}
				class pe extends ue {
					constructor(e, t) {
						super(setInterval, fe, e, function(e) {
							return t(), e;
						});
					}
				}
				let w = {
					now() {
						return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
					},
					defer(e) {
						return new C(0, e);
					},
					method(e, ...t) {
						var n = Array.prototype.slice.call(arguments, 1);
						return function(t) {
							return t[e].apply(t, n.concat(arguments));
						};
					}
				};
				function T(e, ...t) {
					for (var n = 0; n < t.length; n++) {
						var r = t[n];
						for (var i in r) r[i] && r[i].constructor && r[i].constructor === Object ? e[i] = T(e[i] || {}, r[i]) : e[i] = r[i];
					}
					return e;
				}
				function me() {
					for (var e = ["Pusher"], t = 0; t < arguments.length; t++) typeof arguments[t] == "string" ? e.push(arguments[t]) : e.push(k(arguments[t]));
					return e.join(" : ");
				}
				function E(e, t) {
					var n = Array.prototype.indexOf;
					if (e === null) return -1;
					if (n && e.indexOf === n) return e.indexOf(t);
					for (var r = 0, i = e.length; r < i; r++) if (e[r] === t) return r;
					return -1;
				}
				function D(e, t) {
					for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t(e[n], n, e);
				}
				function he(e) {
					var t = [];
					return D(e, function(e, n) {
						t.push(n);
					}), t;
				}
				function ge(e) {
					var t = [];
					return D(e, function(e) {
						t.push(e);
					}), t;
				}
				function O(e, t, n) {
					for (var r = 0; r < e.length; r++) t.call(n || window, e[r], r, e);
				}
				function _e(e, t) {
					for (var n = [], r = 0; r < e.length; r++) n.push(t(e[r], r, e, n));
					return n;
				}
				function ve(e, t) {
					var n = {};
					return D(e, function(e, r) {
						n[r] = t(e);
					}), n;
				}
				function ye(e, t) {
					t ||= function(e) {
						return !!e;
					};
					for (var n = [], r = 0; r < e.length; r++) t(e[r], r, e, n) && n.push(e[r]);
					return n;
				}
				function be(e, t) {
					var n = {};
					return D(e, function(r, i) {
						(t && t(r, i, e, n) || r) && (n[i] = r);
					}), n;
				}
				function xe(e) {
					var t = [];
					return D(e, function(e, n) {
						t.push([n, e]);
					}), t;
				}
				function Se(e, t) {
					for (var n = 0; n < e.length; n++) if (t(e[n], n, e)) return !0;
					return !1;
				}
				function Ce(e, t) {
					for (var n = 0; n < e.length; n++) if (!t(e[n], n, e)) return !1;
					return !0;
				}
				function we(e) {
					return ve(e, function(e) {
						return typeof e == "object" && (e = k(e)), encodeURIComponent(y(e.toString()));
					});
				}
				function Te(e) {
					return _e(xe(we(be(e, function(e) {
						return e !== void 0;
					}))), w.method("join", "=")).join("&");
				}
				function Ee(e) {
					var t = [], n = [];
					return (function e(r, i) {
						var a, o, s;
						switch (typeof r) {
							case "object":
								if (!r) return null;
								for (a = 0; a < t.length; a += 1) if (t[a] === r) return { $ref: n[a] };
								if (t.push(r), n.push(i), Object.prototype.toString.apply(r) === "[object Array]") for (s = [], a = 0; a < r.length; a += 1) s[a] = e(r[a], i + "[" + a + "]");
								else for (o in s = {}, r) Object.prototype.hasOwnProperty.call(r, o) && (s[o] = e(r[o], i + "[" + JSON.stringify(o) + "]"));
								return s;
							case "number":
							case "string":
							case "boolean": return r;
						}
					})(e, "$");
				}
				function k(e) {
					try {
						return JSON.stringify(e);
					} catch {
						return JSON.stringify(Ee(e));
					}
				}
				class De {
					constructor() {
						this.globalLog = (e) => {
							window.console && window.console.log && window.console.log(e);
						};
					}
					debug(...e) {
						this.log(this.globalLog, e);
					}
					warn(...e) {
						this.log(this.globalLogWarn, e);
					}
					error(...e) {
						this.log(this.globalLogError, e);
					}
					globalLogWarn(e) {
						window.console && window.console.warn ? window.console.warn(e) : this.globalLog(e);
					}
					globalLogError(e) {
						window.console && window.console.error ? window.console.error(e) : this.globalLogWarn(e);
					}
					log(e, ...t) {
						var n = me.apply(this, arguments);
						$.log ? $.log(n) : $.logToConsole && e.bind(this)(n);
					}
				}
				let A = new De(), Oe = function(e, t, n, r, i) {
					(n.headers !== void 0 || n.headersProvider != null) && A.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);
					var a = e.nextAuthCallbackID.toString();
					e.nextAuthCallbackID++;
					var o = e.getDocument(), s = o.createElement("script");
					e.auth_callbacks[a] = function(e) {
						i(null, e);
					};
					var c = "Pusher.auth_callbacks['" + a + "']";
					s.src = n.endpoint + "?callback=" + encodeURIComponent(c) + "&" + t;
					var l = o.getElementsByTagName("head")[0] || o.documentElement;
					l.insertBefore(s, l.firstChild);
				};
				class ke {
					constructor(e) {
						this.src = e;
					}
					send(e) {
						var t = this, n = "Error loading " + t.src;
						t.script = document.createElement("script"), t.script.id = e.id, t.script.src = t.src, t.script.type = "text/javascript", t.script.charset = "UTF-8", t.script.addEventListener ? (t.script.onerror = function() {
							e.callback(n);
						}, t.script.onload = function() {
							e.callback(null);
						}) : t.script.onreadystatechange = function() {
							(t.script.readyState === "loaded" || t.script.readyState === "complete") && e.callback(null);
						}, t.script.async === void 0 && document.attachEvent && /opera/i.test(navigator.userAgent) ? (t.errorScript = document.createElement("script"), t.errorScript.id = e.id + "_error", t.errorScript.text = e.name + "('" + n + "');", t.script.async = t.errorScript.async = !1) : t.script.async = !0;
						var r = document.getElementsByTagName("head")[0];
						r.insertBefore(t.script, r.firstChild), t.errorScript && r.insertBefore(t.errorScript, t.script.nextSibling);
					}
					cleanup() {
						this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
					}
				}
				class Ae {
					constructor(e, t) {
						this.url = e, this.data = t;
					}
					send(e) {
						if (!this.request) {
							var t = Te(this.data), n = this.url + "/" + e.number + "?" + t;
							this.request = Y.createScriptRequest(n), this.request.send(e);
						}
					}
					cleanup() {
						this.request && this.request.cleanup();
					}
				}
				let je = {
					name: "jsonp",
					getAgent: function(e, t) {
						return function(n, r) {
							var a = "http" + (t ? "s" : "") + "://" + (e.host || e.options.host) + e.options.path, o = Y.createJSONPRequest(a, n), s = Y.ScriptReceivers.create(function(t, n) {
								i.remove(s), o.cleanup(), n && n.host && (e.host = n.host), r && r(t, n);
							});
							o.send(s);
						};
					}
				};
				function j(e, t, n) {
					var r = e + (t.useTLS ? "s" : ""), i = t.useTLS ? t.hostTLS : t.hostNonTLS;
					return r + "://" + i + n;
				}
				function M(e, t) {
					return "/app/" + e + ("?protocol=" + a.PROTOCOL + "&client=js&version=" + a.VERSION + (t ? "&" + t : ""));
				}
				var Me = { getInitial: function(e, t) {
					return j("ws", t, (t.httpPath || "") + M(e, "flash=false"));
				} }, Ne = { getInitial: function(e, t) {
					return j("http", t, (t.httpPath || "/pusher") + M(e));
				} }, Pe = {
					getInitial: function(e, t) {
						return j("http", t, t.httpPath || "/pusher");
					},
					getPath: function(e, t) {
						return M(e);
					}
				};
				class Fe {
					constructor() {
						this._callbacks = {};
					}
					get(e) {
						return this._callbacks[N(e)];
					}
					add(e, t, n) {
						var r = N(e);
						this._callbacks[r] = this._callbacks[r] || [], this._callbacks[r].push({
							fn: t,
							context: n
						});
					}
					remove(e, t, n) {
						if (!e && !t && !n) {
							this._callbacks = {};
							return;
						}
						var r = e ? [N(e)] : he(this._callbacks);
						t || n ? this.removeCallback(r, t, n) : this.removeAllCallbacks(r);
					}
					removeCallback(e, t, n) {
						O(e, function(e) {
							this._callbacks[e] = ye(this._callbacks[e] || [], function(e) {
								return t && t !== e.fn || n && n !== e.context;
							}), this._callbacks[e].length === 0 && delete this._callbacks[e];
						}, this);
					}
					removeAllCallbacks(e) {
						O(e, function(e) {
							delete this._callbacks[e];
						}, this);
					}
				}
				function N(e) {
					return "_" + e;
				}
				class P {
					constructor(e) {
						this.callbacks = new Fe(), this.global_callbacks = [], this.failThrough = e;
					}
					bind(e, t, n) {
						return this.callbacks.add(e, t, n), this;
					}
					bind_global(e) {
						return this.global_callbacks.push(e), this;
					}
					unbind(e, t, n) {
						return this.callbacks.remove(e, t, n), this;
					}
					unbind_global(e) {
						return e ? (this.global_callbacks = ye(this.global_callbacks || [], (t) => t !== e), this) : (this.global_callbacks = [], this);
					}
					unbind_all() {
						return this.unbind(), this.unbind_global(), this;
					}
					emit(e, t, n) {
						for (var r = 0; r < this.global_callbacks.length; r++) this.global_callbacks[r](e, t);
						var i = this.callbacks.get(e), a = [];
						if (n ? a.push(t, n) : t && a.push(t), i && i.length > 0) for (var r = 0; r < i.length; r++) i[r].fn.apply(i[r].context || window, a);
						else this.failThrough && this.failThrough(e, t);
						return this;
					}
				}
				class Ie extends P {
					constructor(e, t, n, r, i) {
						super(), this.initialize = Y.transportConnectionInitializer, this.hooks = e, this.name = t, this.priority = n, this.key = r, this.options = i, this.state = "new", this.timeline = i.timeline, this.activityTimeout = i.activityTimeout, this.id = this.timeline.generateUniqueID();
					}
					handlesActivityChecks() {
						return !!this.hooks.handlesActivityChecks;
					}
					supportsPing() {
						return !!this.hooks.supportsPing;
					}
					connect() {
						if (this.socket || this.state !== "initialized") return !1;
						var e = this.hooks.urls.getInitial(this.key, this.options);
						try {
							this.socket = this.hooks.getSocket(e, this.options);
						} catch (e) {
							return w.defer(() => {
								this.onError(e), this.changeState("closed");
							}), !1;
						}
						return this.bindListeners(), A.debug("Connecting", {
							transport: this.name,
							url: e
						}), this.changeState("connecting"), !0;
					}
					close() {
						return this.socket ? (this.socket.close(), !0) : !1;
					}
					send(e) {
						return this.state === "open" ? (w.defer(() => {
							this.socket && this.socket.send(e);
						}), !0) : !1;
					}
					ping() {
						this.state === "open" && this.supportsPing() && this.socket.ping();
					}
					onOpen() {
						this.hooks.beforeOpen && this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options)), this.changeState("open"), this.socket.onopen = void 0;
					}
					onError(e) {
						this.emit("error", {
							type: "WebSocketError",
							error: e
						}), this.timeline.error(this.buildTimelineMessage({ error: e.toString() }));
					}
					onClose(e) {
						e ? this.changeState("closed", {
							code: e.code,
							reason: e.reason,
							wasClean: e.wasClean
						}) : this.changeState("closed"), this.unbindListeners(), this.socket = void 0;
					}
					onMessage(e) {
						this.emit("message", e);
					}
					onActivity() {
						this.emit("activity");
					}
					bindListeners() {
						this.socket.onopen = () => {
							this.onOpen();
						}, this.socket.onerror = (e) => {
							this.onError(e);
						}, this.socket.onclose = (e) => {
							this.onClose(e);
						}, this.socket.onmessage = (e) => {
							this.onMessage(e);
						}, this.supportsPing() && (this.socket.onactivity = () => {
							this.onActivity();
						});
					}
					unbindListeners() {
						this.socket && (this.socket.onopen = void 0, this.socket.onerror = void 0, this.socket.onclose = void 0, this.socket.onmessage = void 0, this.supportsPing() && (this.socket.onactivity = void 0));
					}
					changeState(e, t) {
						this.state = e, this.timeline.info(this.buildTimelineMessage({
							state: e,
							params: t
						})), this.emit(e, t);
					}
					buildTimelineMessage(e) {
						return T({ cid: this.id }, e);
					}
				}
				class F {
					constructor(e) {
						this.hooks = e;
					}
					isSupported(e) {
						return this.hooks.isSupported(e);
					}
					createConnection(e, t, n, r) {
						return new Ie(this.hooks, e, t, n, r);
					}
				}
				var Le = new F({
					urls: Me,
					handlesActivityChecks: !1,
					supportsPing: !1,
					isInitialized: function() {
						return !!Y.getWebSocketAPI();
					},
					isSupported: function() {
						return !!Y.getWebSocketAPI();
					},
					getSocket: function(e) {
						return Y.createWebSocket(e);
					}
				}), Re = {
					urls: Ne,
					handlesActivityChecks: !1,
					supportsPing: !0,
					isInitialized: function() {
						return !0;
					}
				}, ze = T({ getSocket: function(e) {
					return Y.HTTPFactory.createStreamingSocket(e);
				} }, Re), Be = T({ getSocket: function(e) {
					return Y.HTTPFactory.createPollingSocket(e);
				} }, Re), Ve = { isSupported: function() {
					return Y.isXHRSupported();
				} };
				let I = {
					ws: Le,
					xhr_streaming: new F(T({}, ze, Ve)),
					xhr_polling: new F(T({}, Be, Ve))
				};
				var He = new F({
					file: "sockjs",
					urls: Pe,
					handlesActivityChecks: !0,
					supportsPing: !1,
					isSupported: function() {
						return !0;
					},
					isInitialized: function() {
						return window.SockJS !== void 0;
					},
					getSocket: function(e, t) {
						return new window.SockJS(e, null, {
							js_path: c.getPath("sockjs", { useTLS: t.useTLS }),
							ignore_null_origin: t.ignoreNullOrigin
						});
					},
					beforeOpen: function(e, t) {
						e.send(JSON.stringify({ path: t }));
					}
				}), Ue = { isSupported: function(e) {
					return Y.isXDRSupported(e.useTLS);
				} }, We = new F(T({}, ze, Ue)), Ge = new F(T({}, Be, Ue));
				I.xdr_streaming = We, I.xdr_polling = Ge, I.sockjs = He;
				let Ke = I;
				class qe extends P {
					constructor() {
						super();
						var e = this;
						window.addEventListener !== void 0 && (window.addEventListener("online", function() {
							e.emit("online");
						}, !1), window.addEventListener("offline", function() {
							e.emit("offline");
						}, !1));
					}
					isOnline() {
						return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
					}
				}
				var Je = new qe();
				class Ye {
					constructor(e, t, n) {
						this.manager = e, this.transport = t, this.minPingDelay = n.minPingDelay, this.maxPingDelay = n.maxPingDelay, this.pingDelay = void 0;
					}
					createConnection(e, t, n, r) {
						r = T({}, r, { activityTimeout: this.pingDelay });
						var i = this.transport.createConnection(e, t, n, r), a = null, o = function() {
							i.unbind("open", o), i.bind("closed", s), a = w.now();
						}, s = (e) => {
							if (i.unbind("closed", s), e.code === 1002 || e.code === 1003) this.manager.reportDeath();
							else if (!e.wasClean && a) {
								var t = w.now() - a;
								t < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(t / 2, this.minPingDelay));
							}
						};
						return i.bind("open", o), i;
					}
					isSupported(e) {
						return this.manager.isAlive() && this.transport.isSupported(e);
					}
				}
				let Xe = {
					decodeMessage: function(e) {
						try {
							var t = JSON.parse(e.data), n = t.data;
							if (typeof n == "string") try {
								n = JSON.parse(t.data);
							} catch {}
							var r = {
								event: t.event,
								channel: t.channel,
								data: n
							};
							return t.user_id && (r.user_id = t.user_id), r;
						} catch (t) {
							throw {
								type: "MessageParseError",
								error: t,
								data: e.data
							};
						}
					},
					encodeMessage: function(e) {
						return JSON.stringify(e);
					},
					processHandshake: function(e) {
						var t = Xe.decodeMessage(e);
						if (t.event === "pusher:connection_established") {
							if (!t.data.activity_timeout) throw "No activity timeout specified in handshake";
							return {
								action: "connected",
								id: t.data.socket_id,
								activityTimeout: t.data.activity_timeout * 1e3
							};
						} else if (t.event === "pusher:error") return {
							action: this.getCloseAction(t.data),
							error: this.getCloseError(t.data)
						};
						else throw "Invalid handshake";
					},
					getCloseAction: function(e) {
						return e.code < 4e3 ? e.code >= 1002 && e.code <= 1004 ? "backoff" : null : e.code === 4e3 ? "tls_only" : e.code < 4100 ? "refused" : e.code < 4200 ? "backoff" : e.code < 4300 ? "retry" : "refused";
					},
					getCloseError: function(e) {
						return e.code !== 1e3 && e.code !== 1001 ? {
							type: "PusherError",
							data: {
								code: e.code,
								message: e.reason || e.message
							}
						} : null;
					}
				}, L = Xe;
				class Ze extends P {
					constructor(e, t) {
						super(), this.id = e, this.transport = t, this.activityTimeout = t.activityTimeout, this.bindListeners();
					}
					handlesActivityChecks() {
						return this.transport.handlesActivityChecks();
					}
					send(e) {
						return this.transport.send(e);
					}
					send_event(e, t, n) {
						var r = {
							event: e,
							data: t
						};
						return n && (r.channel = n), A.debug("Event sent", r), this.send(L.encodeMessage(r));
					}
					ping() {
						this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
					}
					close() {
						this.transport.close();
					}
					bindListeners() {
						var e = {
							message: (e) => {
								var t;
								try {
									t = L.decodeMessage(e);
								} catch (t) {
									this.emit("error", {
										type: "MessageParseError",
										error: t,
										data: e.data
									});
								}
								if (t !== void 0) {
									switch (A.debug("Event recd", t), t.event) {
										case "pusher:error":
											this.emit("error", {
												type: "PusherError",
												data: t.data
											});
											break;
										case "pusher:ping":
											this.emit("ping");
											break;
										case "pusher:pong":
											this.emit("pong");
											break;
									}
									this.emit("message", t);
								}
							},
							activity: () => {
								this.emit("activity");
							},
							error: (e) => {
								this.emit("error", e);
							},
							closed: (e) => {
								t(), e && e.code && this.handleCloseEvent(e), this.transport = null, this.emit("closed");
							}
						}, t = () => {
							D(e, (e, t) => {
								this.transport.unbind(t, e);
							});
						};
						D(e, (e, t) => {
							this.transport.bind(t, e);
						});
					}
					handleCloseEvent(e) {
						var t = L.getCloseAction(e), n = L.getCloseError(e);
						n && this.emit("error", n), t && this.emit(t, {
							action: t,
							error: n
						});
					}
				}
				class Qe {
					constructor(e, t) {
						this.transport = e, this.callback = t, this.bindListeners();
					}
					close() {
						this.unbindListeners(), this.transport.close();
					}
					bindListeners() {
						this.onMessage = (e) => {
							this.unbindListeners();
							var t;
							try {
								t = L.processHandshake(e);
							} catch (e) {
								this.finish("error", { error: e }), this.transport.close();
								return;
							}
							t.action === "connected" ? this.finish("connected", {
								connection: new Ze(t.id, this.transport),
								activityTimeout: t.activityTimeout
							}) : (this.finish(t.action, { error: t.error }), this.transport.close());
						}, this.onClosed = (e) => {
							this.unbindListeners();
							var t = L.getCloseAction(e) || "backoff", n = L.getCloseError(e);
							this.finish(t, { error: n });
						}, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
					}
					unbindListeners() {
						this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
					}
					finish(e, t) {
						this.callback(T({
							transport: this.transport,
							action: e
						}, t));
					}
				}
				class $e {
					constructor(e, t) {
						this.timeline = e, this.options = t || {};
					}
					send(e, t) {
						this.timeline.isEmpty() || this.timeline.send(Y.TimelineTransport.getAgent(this, e), t);
					}
				}
				class R extends P {
					constructor(e, t) {
						super(function(t, n) {
							A.debug("No callbacks on " + e + " for " + t);
						}), this.name = e, this.pusher = t, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
					}
					authorize(e, t) {
						return t(null, { auth: "" });
					}
					trigger(e, t) {
						if (e.indexOf("client-") !== 0) throw new ee("Event '" + e + "' does not start with 'client-'");
						if (!this.subscribed) {
							var n = u.buildLogSuffix("triggeringClientEvents");
							A.warn(`Client event triggered before channel 'subscription_succeeded' event . ${n}`);
						}
						return this.pusher.send_event(e, t, this.name);
					}
					disconnect() {
						this.subscribed = !1, this.subscriptionPending = !1;
					}
					handleEvent(e) {
						var t = e.event, n = e.data;
						t === "pusher_internal:subscription_succeeded" ? this.handleSubscriptionSucceededEvent(e) : t === "pusher_internal:subscription_count" ? this.handleSubscriptionCountEvent(e) : t.indexOf("pusher_internal:") !== 0 && this.emit(t, n, {});
					}
					handleSubscriptionSucceededEvent(e) {
						this.subscriptionPending = !1, this.subscribed = !0, this.subscriptionCancelled ? this.pusher.unsubscribe(this.name) : this.emit("pusher:subscription_succeeded", e.data);
					}
					handleSubscriptionCountEvent(e) {
						e.data.subscription_count && (this.subscriptionCount = e.data.subscription_count), this.emit("pusher:subscription_count", e.data);
					}
					subscribe() {
						this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (e, t) => {
							e ? (this.subscriptionPending = !1, A.error(e.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
								type: "AuthError",
								error: e.message
							}, e instanceof _ ? { status: e.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
								auth: t.auth,
								channel_data: t.channel_data,
								channel: this.name
							});
						}));
					}
					unsubscribe() {
						this.subscribed = !1, this.pusher.send_event("pusher:unsubscribe", { channel: this.name });
					}
					cancelSubscription() {
						this.subscriptionCancelled = !0;
					}
					reinstateSubscription() {
						this.subscriptionCancelled = !1;
					}
				}
				class z extends R {
					authorize(e, t) {
						return this.pusher.config.channelAuthorizer({
							channelName: this.name,
							socketId: e
						}, t);
					}
				}
				class et {
					constructor() {
						this.reset();
					}
					get(e) {
						return Object.prototype.hasOwnProperty.call(this.members, e) ? {
							id: e,
							info: this.members[e]
						} : null;
					}
					each(e) {
						D(this.members, (t, n) => {
							e(this.get(n));
						});
					}
					setMyID(e) {
						this.myID = e;
					}
					onSubscription(e) {
						this.members = e.presence.hash, this.count = e.presence.count, this.me = this.get(this.myID);
					}
					addMember(e) {
						return this.get(e.user_id) === null && this.count++, this.members[e.user_id] = e.user_info, this.get(e.user_id);
					}
					removeMember(e) {
						var t = this.get(e.user_id);
						return t && (delete this.members[e.user_id], this.count--), t;
					}
					reset() {
						this.members = {}, this.count = 0, this.myID = null, this.me = null;
					}
				}
				var tt = function(e, t, n, r) {
					function i(e) {
						return e instanceof n ? e : new n(function(t) {
							t(e);
						});
					}
					return new (n ||= Promise)(function(n, a) {
						function o(e) {
							try {
								c(r.next(e));
							} catch (e) {
								a(e);
							}
						}
						function s(e) {
							try {
								c(r.throw(e));
							} catch (e) {
								a(e);
							}
						}
						function c(e) {
							e.done ? n(e.value) : i(e.value).then(o, s);
						}
						c((r = r.apply(e, t || [])).next());
					});
				};
				class nt extends z {
					constructor(e, t) {
						super(e, t), this.members = new et();
					}
					authorize(e, t) {
						super.authorize(e, (e, n) => tt(this, void 0, void 0, function* () {
							if (!e) if (n = n, n.channel_data != null) {
								var r = JSON.parse(n.channel_data);
								this.members.setMyID(r.user_id);
							} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null) this.members.setMyID(this.pusher.user.user_data.id);
							else {
								let e = u.buildLogSuffix("authorizationEndpoint");
								A.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${e}, or the user should be signed in.`), t("Invalid auth response");
								return;
							}
							t(e, n);
						}));
					}
					handleEvent(e) {
						var t = e.event;
						if (t.indexOf("pusher_internal:") === 0) this.handleInternalEvent(e);
						else {
							var n = e.data, r = {};
							e.user_id && (r.user_id = e.user_id), this.emit(t, n, r);
						}
					}
					handleInternalEvent(e) {
						var t = e.event, n = e.data;
						switch (t) {
							case "pusher_internal:subscription_succeeded":
								this.handleSubscriptionSucceededEvent(e);
								break;
							case "pusher_internal:subscription_count":
								this.handleSubscriptionCountEvent(e);
								break;
							case "pusher_internal:member_added":
								var r = this.members.addMember(n);
								this.emit("pusher:member_added", r);
								break;
							case "pusher_internal:member_removed":
								var i = this.members.removeMember(n);
								i && this.emit("pusher:member_removed", i);
								break;
						}
					}
					handleSubscriptionSucceededEvent(e) {
						this.subscriptionPending = !1, this.subscribed = !0, this.subscriptionCancelled ? this.pusher.unsubscribe(this.name) : (this.members.onSubscription(e.data), this.emit("pusher:subscription_succeeded", this.members));
					}
					disconnect() {
						this.members.reset(), super.disconnect();
					}
				}
				var rt = n(978), B = n(594);
				class it extends z {
					constructor(e, t, n) {
						super(e, t), this.key = null, this.nacl = n;
					}
					authorize(e, t) {
						super.authorize(e, (e, n) => {
							if (e) {
								t(e, n);
								return;
							}
							let r = n.shared_secret;
							if (!r) {
								t(/* @__PURE__ */ Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
								return;
							}
							this.key = (0, B.decode)(r), delete n.shared_secret, t(null, n);
						});
					}
					trigger(e, t) {
						throw new m("Client events are not currently supported for encrypted channels");
					}
					handleEvent(e) {
						var t = e.event, n = e.data;
						if (t.indexOf("pusher_internal:") === 0 || t.indexOf("pusher:") === 0) {
							super.handleEvent(e);
							return;
						}
						this.handleEncryptedEvent(t, n);
					}
					handleEncryptedEvent(e, t) {
						if (!this.key) {
							A.debug("Received encrypted event before key has been retrieved from the authEndpoint");
							return;
						}
						if (!t.ciphertext || !t.nonce) {
							A.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + t);
							return;
						}
						let n = (0, B.decode)(t.ciphertext);
						if (n.length < this.nacl.secretbox.overheadLength) {
							A.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${n.length}`);
							return;
						}
						let r = (0, B.decode)(t.nonce);
						if (r.length < this.nacl.secretbox.nonceLength) {
							A.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${r.length}`);
							return;
						}
						let i = this.nacl.secretbox.open(n, r, this.key);
						if (i === null) {
							A.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (t, a) => {
								if (t) {
									A.error(`Failed to make a request to the authEndpoint: ${a}. Unable to fetch new key, so dropping encrypted event`);
									return;
								}
								if (i = this.nacl.secretbox.open(n, r, this.key), i === null) {
									A.error("Failed to decrypt event with new key. Dropping encrypted event");
									return;
								}
								this.emit(e, this.getDataToEmit(i));
							});
							return;
						}
						this.emit(e, this.getDataToEmit(i));
					}
					getDataToEmit(e) {
						let t = (0, rt.D4)(e);
						try {
							return JSON.parse(t);
						} catch {
							return t;
						}
					}
				}
				class at extends P {
					constructor(e, t) {
						super(), this.state = "initialized", this.connection = null, this.key = e, this.options = t, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
						var n = Y.getNetwork();
						n.bind("online", () => {
							this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
						}), n.bind("offline", () => {
							this.timeline.info({ netinfo: "offline" }), this.connection && this.sendActivityCheck();
						}), this.updateStrategy();
					}
					switchCluster(e) {
						this.key = e, this.updateStrategy(), this.retryIn(0);
					}
					connect() {
						if (!(this.connection || this.runner)) {
							if (!this.strategy.isSupported()) {
								this.updateState("failed");
								return;
							}
							this.updateState("connecting"), this.startConnecting(), this.setUnavailableTimer();
						}
					}
					send(e) {
						return this.connection ? this.connection.send(e) : !1;
					}
					send_event(e, t, n) {
						return this.connection ? this.connection.send_event(e, t, n) : !1;
					}
					disconnect() {
						this.disconnectInternally(), this.updateState("disconnected");
					}
					isUsingTLS() {
						return this.usingTLS;
					}
					startConnecting() {
						var e = (t, n) => {
							t ? this.runner = this.strategy.connect(0, e) : n.action === "error" ? (this.emit("error", {
								type: "HandshakeError",
								error: n.error
							}), this.timeline.error({ handshakeError: n.error })) : (this.abortConnecting(), this.handshakeCallbacks[n.action](n));
						};
						this.runner = this.strategy.connect(0, e);
					}
					abortConnecting() {
						this.runner &&= (this.runner.abort(), null);
					}
					disconnectInternally() {
						this.abortConnecting(), this.clearRetryTimer(), this.clearUnavailableTimer(), this.connection && this.abandonConnection().close();
					}
					updateStrategy() {
						this.strategy = this.options.getStrategy({
							key: this.key,
							timeline: this.timeline,
							useTLS: this.usingTLS
						});
					}
					retryIn(e) {
						this.timeline.info({
							action: "retry",
							delay: e
						}), e > 0 && this.emit("connecting_in", Math.round(e / 1e3)), this.retryTimer = new C(e || 0, () => {
							this.disconnectInternally(), this.connect();
						});
					}
					clearRetryTimer() {
						this.retryTimer &&= (this.retryTimer.ensureAborted(), null);
					}
					setUnavailableTimer() {
						this.unavailableTimer = new C(this.options.unavailableTimeout, () => {
							this.updateState("unavailable");
						});
					}
					clearUnavailableTimer() {
						this.unavailableTimer && this.unavailableTimer.ensureAborted();
					}
					sendActivityCheck() {
						this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new C(this.options.pongTimeout, () => {
							this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
						});
					}
					resetActivityCheck() {
						this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new C(this.activityTimeout, () => {
							this.sendActivityCheck();
						}));
					}
					stopActivityCheck() {
						this.activityTimer && this.activityTimer.ensureAborted();
					}
					buildConnectionCallbacks(e) {
						return T({}, e, {
							message: (e) => {
								this.resetActivityCheck(), this.emit("message", e);
							},
							ping: () => {
								this.send_event("pusher:pong", {});
							},
							activity: () => {
								this.resetActivityCheck();
							},
							error: (e) => {
								this.emit("error", e);
							},
							closed: () => {
								this.abandonConnection(), this.shouldRetry() && this.retryIn(1e3);
							}
						});
					}
					buildHandshakeCallbacks(e) {
						return T({}, e, { connected: (e) => {
							this.activityTimeout = Math.min(this.options.activityTimeout, e.activityTimeout, e.connection.activityTimeout || Infinity), this.clearUnavailableTimer(), this.setConnection(e.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
						} });
					}
					buildErrorCallbacks() {
						let e = (e) => (t) => {
							t.error && this.emit("error", {
								type: "WebSocketError",
								error: t.error
							}), e(t);
						};
						return {
							tls_only: e(() => {
								this.usingTLS = !0, this.updateStrategy(), this.retryIn(0);
							}),
							refused: e(() => {
								this.disconnect();
							}),
							backoff: e(() => {
								this.retryIn(1e3);
							}),
							retry: e(() => {
								this.retryIn(0);
							})
						};
					}
					setConnection(e) {
						for (var t in this.connection = e, this.connectionCallbacks) this.connection.bind(t, this.connectionCallbacks[t]);
						this.resetActivityCheck();
					}
					abandonConnection() {
						if (this.connection) {
							for (var e in this.stopActivityCheck(), this.connectionCallbacks) this.connection.unbind(e, this.connectionCallbacks[e]);
							var t = this.connection;
							return this.connection = null, t;
						}
					}
					updateState(e, t) {
						var n = this.state;
						if (this.state = e, n !== e) {
							var r = e;
							r === "connected" && (r += " with new socket ID " + t.socket_id), A.debug("State changed", n + " -> " + r), this.timeline.info({
								state: e,
								params: t
							}), this.emit("state_change", {
								previous: n,
								current: e
							}), this.emit(e, t);
						}
					}
					shouldRetry() {
						return this.state === "connecting" || this.state === "connected";
					}
				}
				class ot {
					constructor() {
						this.channels = {};
					}
					add(e, t) {
						return this.channels[e] || (this.channels[e] = st(e, t)), this.channels[e];
					}
					all() {
						return ge(this.channels);
					}
					find(e) {
						return this.channels[e];
					}
					remove(e) {
						var t = this.channels[e];
						return delete this.channels[e], t;
					}
					disconnect() {
						D(this.channels, function(e) {
							e.disconnect();
						});
					}
				}
				function st(e, t) {
					if (e.indexOf("private-encrypted-") === 0) {
						if (t.config.nacl) return V.createEncryptedChannel(e, t, t.config.nacl);
						throw new m(`Tried to subscribe to a private-encrypted- channel but no nacl implementation available. ${u.buildLogSuffix("encryptedChannelSupport")}`);
					} else if (e.indexOf("private-") === 0) return V.createPrivateChannel(e, t);
					else if (e.indexOf("presence-") === 0) return V.createPresenceChannel(e, t);
					else if (e.indexOf("#") === 0) throw new te("Cannot create a channel with name \"" + e + "\".");
					else return V.createChannel(e, t);
				}
				let V = {
					createChannels() {
						return new ot();
					},
					createConnectionManager(e, t) {
						return new at(e, t);
					},
					createChannel(e, t) {
						return new R(e, t);
					},
					createPrivateChannel(e, t) {
						return new z(e, t);
					},
					createPresenceChannel(e, t) {
						return new nt(e, t);
					},
					createEncryptedChannel(e, t, n) {
						return new it(e, t, n);
					},
					createTimelineSender(e, t) {
						return new $e(e, t);
					},
					createHandshake(e, t) {
						return new Qe(e, t);
					},
					createAssistantToTheTransportManager(e, t, n) {
						return new Ye(e, t, n);
					}
				};
				class ct {
					constructor(e) {
						this.options = e || {}, this.livesLeft = this.options.lives || Infinity;
					}
					getAssistant(e) {
						return V.createAssistantToTheTransportManager(this, e, {
							minPingDelay: this.options.minPingDelay,
							maxPingDelay: this.options.maxPingDelay
						});
					}
					isAlive() {
						return this.livesLeft > 0;
					}
					reportDeath() {
						--this.livesLeft;
					}
				}
				class H {
					constructor(e, t) {
						this.strategies = e, this.loop = !!t.loop, this.failFast = !!t.failFast, this.timeout = t.timeout, this.timeoutLimit = t.timeoutLimit;
					}
					isSupported() {
						return Se(this.strategies, w.method("isSupported"));
					}
					connect(e, t) {
						var n = this.strategies, r = 0, i = this.timeout, a = null, o = (s, c) => {
							c ? t(null, c) : (r += 1, this.loop && (r %= n.length), r < n.length ? (i && (i *= 2, this.timeoutLimit && (i = Math.min(i, this.timeoutLimit))), a = this.tryStrategy(n[r], e, {
								timeout: i,
								failFast: this.failFast
							}, o)) : t(!0));
						};
						return a = this.tryStrategy(n[r], e, {
							timeout: i,
							failFast: this.failFast
						}, o), {
							abort: function() {
								a.abort();
							},
							forceMinPriority: function(t) {
								e = t, a && a.forceMinPriority(t);
							}
						};
					}
					tryStrategy(e, t, n, r) {
						var i = null, a = null;
						return n.timeout > 0 && (i = new C(n.timeout, function() {
							a.abort(), r(!0);
						})), a = e.connect(t, function(e, t) {
							e && i && i.isRunning() && !n.failFast || (i && i.ensureAborted(), r(e, t));
						}), {
							abort: function() {
								i && i.ensureAborted(), a.abort();
							},
							forceMinPriority: function(e) {
								a.forceMinPriority(e);
							}
						};
					}
				}
				class U {
					constructor(e) {
						this.strategies = e;
					}
					isSupported() {
						return Se(this.strategies, w.method("isSupported"));
					}
					connect(e, t) {
						return lt(this.strategies, e, function(e, n) {
							return function(r, i) {
								if (n[e].error = r, r) {
									ut(n) && t(!0);
									return;
								}
								O(n, function(e) {
									e.forceMinPriority(i.transport.priority);
								}), t(null, i);
							};
						});
					}
				}
				function lt(e, t, n) {
					var r = _e(e, function(e, r, i, a) {
						return e.connect(t, n(r, a));
					});
					return {
						abort: function() {
							O(r, dt);
						},
						forceMinPriority: function(e) {
							O(r, function(t) {
								t.forceMinPriority(e);
							});
						}
					};
				}
				function ut(e) {
					return Ce(e, function(e) {
						return !!e.error;
					});
				}
				function dt(e) {
					!e.error && !e.aborted && (e.abort(), e.aborted = !0);
				}
				class ft {
					constructor(e, t, n) {
						this.strategy = e, this.transports = t, this.ttl = n.ttl || 1800 * 1e3, this.usingTLS = n.useTLS, this.timeline = n.timeline;
					}
					isSupported() {
						return this.strategy.isSupported();
					}
					connect(e, t) {
						var n = this.usingTLS, r = pt(n), i = r && r.cacheSkipCount ? r.cacheSkipCount : 0, a = [this.strategy];
						if (r && r.timestamp + this.ttl >= w.now()) {
							var o = this.transports[r.transport];
							o && (["ws", "wss"].includes(r.transport) || i > 3 ? (this.timeline.info({
								cached: !0,
								transport: r.transport,
								latency: r.latency
							}), a.push(new H([o], {
								timeout: r.latency * 2 + 1e3,
								failFast: !0
							}))) : i++);
						}
						var s = w.now(), c = a.pop().connect(e, function r(o, l) {
							o ? (ht(n), a.length > 0 ? (s = w.now(), c = a.pop().connect(e, r)) : t(o)) : (mt(n, l.transport.name, w.now() - s, i), t(null, l));
						});
						return {
							abort: function() {
								c.abort();
							},
							forceMinPriority: function(t) {
								e = t, c && c.forceMinPriority(t);
							}
						};
					}
				}
				function W(e) {
					return "pusherTransport" + (e ? "TLS" : "NonTLS");
				}
				function pt(e) {
					var t = Y.getLocalStorage();
					if (t) try {
						var n = t[W(e)];
						if (n) return JSON.parse(n);
					} catch {
						ht(e);
					}
					return null;
				}
				function mt(e, t, n, r) {
					var i = Y.getLocalStorage();
					if (i) try {
						i[W(e)] = k({
							timestamp: w.now(),
							transport: t,
							latency: n,
							cacheSkipCount: r
						});
					} catch {}
				}
				function ht(e) {
					var t = Y.getLocalStorage();
					if (t) try {
						delete t[W(e)];
					} catch {}
				}
				class G {
					constructor(e, { delay: t }) {
						this.strategy = e, this.options = { delay: t };
					}
					isSupported() {
						return this.strategy.isSupported();
					}
					connect(e, t) {
						var n = this.strategy, r, i = new C(this.options.delay, function() {
							r = n.connect(e, t);
						});
						return {
							abort: function() {
								i.ensureAborted(), r && r.abort();
							},
							forceMinPriority: function(t) {
								e = t, r && r.forceMinPriority(t);
							}
						};
					}
				}
				class K {
					constructor(e, t, n) {
						this.test = e, this.trueBranch = t, this.falseBranch = n;
					}
					isSupported() {
						return (this.test() ? this.trueBranch : this.falseBranch).isSupported();
					}
					connect(e, t) {
						return (this.test() ? this.trueBranch : this.falseBranch).connect(e, t);
					}
				}
				class gt {
					constructor(e) {
						this.strategy = e;
					}
					isSupported() {
						return this.strategy.isSupported();
					}
					connect(e, t) {
						var n = this.strategy.connect(e, function(e, r) {
							r && n.abort(), t(e, r);
						});
						return n;
					}
				}
				function q(e) {
					return function() {
						return e.isSupported();
					};
				}
				let _t = function(e, t, n) {
					var r = {};
					function i(t, i, a, o, s) {
						var c = n(e, t, i, a, o, s);
						return r[t] = c, c;
					}
					var a = Object.assign({}, t, {
						hostNonTLS: e.wsHost + ":" + e.wsPort,
						hostTLS: e.wsHost + ":" + e.wssPort,
						httpPath: e.wsPath
					}), o = Object.assign({}, a, { useTLS: !0 }), s = Object.assign({}, t, {
						hostNonTLS: e.httpHost + ":" + e.httpPort,
						hostTLS: e.httpHost + ":" + e.httpsPort,
						httpPath: e.httpPath
					}), c = {
						loop: !0,
						timeout: 15e3,
						timeoutLimit: 6e4
					}, l = new ct({
						minPingDelay: 1e4,
						maxPingDelay: e.activityTimeout
					}), u = new ct({
						lives: 2,
						minPingDelay: 1e4,
						maxPingDelay: e.activityTimeout
					}), d = i("ws", "ws", 3, a, l), ee = i("wss", "ws", 3, o, l), te = i("sockjs", "sockjs", 1, s), f = i("xhr_streaming", "xhr_streaming", 1, s, u), ne = i("xdr_streaming", "xdr_streaming", 1, s, u), p = i("xhr_polling", "xhr_polling", 1, s), m = i("xdr_polling", "xdr_polling", 1, s), h = new H([d], c), g = new H([ee], c), _ = new H([te], c), v = new H([new K(q(f), f, ne)], c), y = new H([new K(q(p), p, m)], c), b = new H([new K(q(v), new U([v, new G(y, { delay: 4e3 })]), y)], c), x = new K(q(b), b, _), re = t.useTLS ? new U([h, new G(x, { delay: 2e3 })]) : new U([
						h,
						new G(g, { delay: 2e3 }),
						new G(x, { delay: 5e3 })
					]);
					return new ft(new gt(new K(q(d), re, x)), r, {
						ttl: 18e5,
						timeline: t.timeline,
						useTLS: t.useTLS
					});
				};
				function vt() {
					var e = this;
					e.timeline.info(e.buildTimelineMessage({ transport: e.name + (e.options.useTLS ? "s" : "") })), e.hooks.isInitialized() ? e.changeState("initialized") : e.hooks.file ? (e.changeState("initializing"), c.load(e.hooks.file, { useTLS: e.options.useTLS }, function(t, n) {
						e.hooks.isInitialized() ? (e.changeState("initialized"), n(!0)) : (t && e.onError(t), e.onClose(), n(!1));
					})) : e.onClose();
				}
				let yt = {
					getRequest: function(e) {
						var t = new window.XDomainRequest();
						return t.ontimeout = function() {
							e.emit("error", new f()), e.close();
						}, t.onerror = function(t) {
							e.emit("error", t), e.close();
						}, t.onprogress = function() {
							t.responseText && t.responseText.length > 0 && e.onChunk(200, t.responseText);
						}, t.onload = function() {
							t.responseText && t.responseText.length > 0 && e.onChunk(200, t.responseText), e.emit("finished", 200), e.close();
						}, t;
					},
					abortRequest: function(e) {
						e.ontimeout = e.onerror = e.onprogress = e.onload = null, e.abort();
					}
				};
				class bt extends P {
					constructor(e, t, n) {
						super(), this.hooks = e, this.method = t, this.url = n;
					}
					start(e) {
						this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
							this.close();
						}, Y.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(e);
					}
					close() {
						this.unloader &&= (Y.removeUnloadListener(this.unloader), null), this.xhr &&= (this.hooks.abortRequest(this.xhr), null);
					}
					onChunk(e, t) {
						for (;;) {
							var n = this.advanceBuffer(t);
							if (n) this.emit("chunk", {
								status: e,
								data: n
							});
							else break;
						}
						this.isBufferTooLong(t) && this.emit("buffer_too_long");
					}
					advanceBuffer(e) {
						var t = e.slice(this.position), n = t.indexOf("\n");
						return n === -1 ? null : (this.position += n + 1, t.slice(0, n));
					}
					isBufferTooLong(e) {
						return this.position === e.length && e.length > 262144;
					}
				}
				var xt;
				(function(e) {
					e[e.CONNECTING = 0] = "CONNECTING", e[e.OPEN = 1] = "OPEN", e[e.CLOSED = 3] = "CLOSED";
				})(xt ||= {});
				let J = xt;
				var St = 1;
				class Ct {
					constructor(e, t) {
						this.hooks = e, this.session = Ot(1e3) + "/" + kt(8), this.location = wt(t), this.readyState = J.CONNECTING, this.openStream();
					}
					send(e) {
						return this.sendRaw(JSON.stringify([e]));
					}
					ping() {
						this.hooks.sendHeartbeat(this);
					}
					close(e, t) {
						this.onClose(e, t, !0);
					}
					sendRaw(e) {
						if (this.readyState === J.OPEN) try {
							return Y.createSocketRequest("POST", Et(Tt(this.location, this.session))).start(e), !0;
						} catch {
							return !1;
						}
						else return !1;
					}
					reconnect() {
						this.closeStream(), this.openStream();
					}
					onClose(e, t, n) {
						this.closeStream(), this.readyState = J.CLOSED, this.onclose && this.onclose({
							code: e,
							reason: t,
							wasClean: n
						});
					}
					onChunk(e) {
						if (e.status === 200) {
							this.readyState === J.OPEN && this.onActivity();
							var t;
							switch (e.data.slice(0, 1)) {
								case "o":
									t = JSON.parse(e.data.slice(1) || "{}"), this.onOpen(t);
									break;
								case "a":
									t = JSON.parse(e.data.slice(1) || "[]");
									for (var n = 0; n < t.length; n++) this.onEvent(t[n]);
									break;
								case "m":
									t = JSON.parse(e.data.slice(1) || "null"), this.onEvent(t);
									break;
								case "h":
									this.hooks.onHeartbeat(this);
									break;
								case "c":
									t = JSON.parse(e.data.slice(1) || "[]"), this.onClose(t[0], t[1], !0);
									break;
							}
						}
					}
					onOpen(e) {
						this.readyState === J.CONNECTING ? (e && e.hostname && (this.location.base = Dt(this.location.base, e.hostname)), this.readyState = J.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
					}
					onEvent(e) {
						this.readyState === J.OPEN && this.onmessage && this.onmessage({ data: e });
					}
					onActivity() {
						this.onactivity && this.onactivity();
					}
					onError(e) {
						this.onerror && this.onerror(e);
					}
					openStream() {
						this.stream = Y.createSocketRequest("POST", Et(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (e) => {
							this.onChunk(e);
						}), this.stream.bind("finished", (e) => {
							this.hooks.onFinished(this, e);
						}), this.stream.bind("buffer_too_long", () => {
							this.reconnect();
						});
						try {
							this.stream.start();
						} catch (e) {
							w.defer(() => {
								this.onError(e), this.onClose(1006, "Could not start streaming", !1);
							});
						}
					}
					closeStream() {
						this.stream &&= (this.stream.unbind_all(), this.stream.close(), null);
					}
				}
				function wt(e) {
					var t = /([^\?]*)\/*(\??.*)/.exec(e);
					return {
						base: t[1],
						queryString: t[2]
					};
				}
				function Tt(e, t) {
					return e.base + "/" + t + "/xhr_send";
				}
				function Et(e) {
					return e + (e.indexOf("?") === -1 ? "?" : "&") + "t=" + +/* @__PURE__ */ new Date() + "&n=" + St++;
				}
				function Dt(e, t) {
					var n = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(e);
					return n[1] + t + n[3];
				}
				function Ot(e) {
					return Y.randomInt(e);
				}
				function kt(e) {
					for (var t = [], n = 0; n < e; n++) t.push(Ot(32).toString(32));
					return t.join("");
				}
				let At = Ct, jt = {
					getReceiveURL: function(e, t) {
						return e.base + "/" + t + "/xhr_streaming" + e.queryString;
					},
					onHeartbeat: function(e) {
						e.sendRaw("[]");
					},
					sendHeartbeat: function(e) {
						e.sendRaw("[]");
					},
					onFinished: function(e, t) {
						e.onClose(1006, "Connection interrupted (" + t + ")", !1);
					}
				}, Mt = {
					getReceiveURL: function(e, t) {
						return e.base + "/" + t + "/xhr" + e.queryString;
					},
					onHeartbeat: function() {},
					sendHeartbeat: function(e) {
						e.sendRaw("[]");
					},
					onFinished: function(e, t) {
						t === 200 ? e.reconnect() : e.onClose(1006, "Connection interrupted (" + t + ")", !1);
					}
				}, Nt = {
					getRequest: function(e) {
						var t = new (Y.getXHRAPI())();
						return t.onreadystatechange = t.onprogress = function() {
							switch (t.readyState) {
								case 3:
									t.responseText && t.responseText.length > 0 && e.onChunk(t.status, t.responseText);
									break;
								case 4:
									t.responseText && t.responseText.length > 0 && e.onChunk(t.status, t.responseText), e.emit("finished", t.status), e.close();
									break;
							}
						}, t;
					},
					abortRequest: function(e) {
						e.onreadystatechange = null, e.abort();
					}
				}, Pt = {
					createStreamingSocket(e) {
						return this.createSocket(jt, e);
					},
					createPollingSocket(e) {
						return this.createSocket(Mt, e);
					},
					createSocket(e, t) {
						return new At(e, t);
					},
					createXHR(e, t) {
						return this.createRequest(Nt, e, t);
					},
					createRequest(e, t, n) {
						return new bt(e, t, n);
					}
				};
				Pt.createXDR = function(e, t) {
					return this.createRequest(yt, e, t);
				};
				let Y = {
					nextAuthCallbackID: 1,
					auth_callbacks: {},
					ScriptReceivers: i,
					DependenciesReceivers: s,
					getDefaultStrategy: _t,
					Transports: Ke,
					transportConnectionInitializer: vt,
					HTTPFactory: Pt,
					TimelineTransport: je,
					getXHRAPI() {
						return window.XMLHttpRequest;
					},
					getWebSocketAPI() {
						return window.WebSocket || window.MozWebSocket;
					},
					setup(e) {
						window.Pusher = e;
						var t = () => {
							this.onDocumentBody(e.ready);
						};
						window.JSON ? t() : c.load("json2", {}, t);
					},
					getDocument() {
						return document;
					},
					getProtocol() {
						return this.getDocument().location.protocol;
					},
					getAuthorizers() {
						return {
							ajax: v,
							jsonp: Oe
						};
					},
					onDocumentBody(e) {
						document.body ? e() : setTimeout(() => {
							this.onDocumentBody(e);
						}, 0);
					},
					createJSONPRequest(e, t) {
						return new Ae(e, t);
					},
					createScriptRequest(e) {
						return new ke(e);
					},
					getLocalStorage() {
						try {
							return window.localStorage;
						} catch {
							return;
						}
					},
					createXHR() {
						return this.getXHRAPI() ? this.createXMLHttpRequest() : this.createMicrosoftXHR();
					},
					createXMLHttpRequest() {
						return new (this.getXHRAPI())();
					},
					createMicrosoftXHR() {
						return new ActiveXObject("Microsoft.XMLHTTP");
					},
					getNetwork() {
						return Je;
					},
					createWebSocket(e) {
						return new (this.getWebSocketAPI())(e);
					},
					createSocketRequest(e, t) {
						if (this.isXHRSupported()) return this.HTTPFactory.createXHR(e, t);
						if (this.isXDRSupported(t.indexOf("https:") === 0)) return this.HTTPFactory.createXDR(e, t);
						throw "Cross-origin HTTP requests are not supported";
					},
					isXHRSupported() {
						var e = this.getXHRAPI();
						return !!e && new e().withCredentials !== void 0;
					},
					isXDRSupported(e) {
						var t = e ? "https:" : "http:", n = this.getProtocol();
						return !!window.XDomainRequest && n === t;
					},
					addUnloadListener(e) {
						window.addEventListener === void 0 ? window.attachEvent !== void 0 && window.attachEvent("onunload", e) : window.addEventListener("unload", e, !1);
					},
					removeUnloadListener(e) {
						window.addEventListener === void 0 ? window.detachEvent !== void 0 && window.detachEvent("onunload", e) : window.removeEventListener("unload", e, !1);
					},
					randomInt(e) {
						return Math.floor(function() {
							return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / 2 ** 32;
						}() * e);
					}
				};
				var X;
				(function(e) {
					e[e.ERROR = 3] = "ERROR", e[e.INFO = 6] = "INFO", e[e.DEBUG = 7] = "DEBUG";
				})(X ||= {});
				let Z = X;
				class Ft {
					constructor(e, t, n) {
						this.key = e, this.session = t, this.events = [], this.options = n || {}, this.sent = 0, this.uniqueID = 0;
					}
					log(e, t) {
						e <= this.options.level && (this.events.push(T({}, t, { timestamp: w.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
					}
					error(e) {
						this.log(Z.ERROR, e);
					}
					info(e) {
						this.log(Z.INFO, e);
					}
					debug(e) {
						this.log(Z.DEBUG, e);
					}
					isEmpty() {
						return this.events.length === 0;
					}
					send(e, t) {
						var n = T({
							session: this.session,
							bundle: this.sent + 1,
							key: this.key,
							lib: "js",
							version: this.options.version,
							cluster: this.options.cluster,
							features: this.options.features,
							timeline: this.events
						}, this.options.params);
						return this.events = [], e(n, (e, n) => {
							e || this.sent++, t && t(e, n);
						}), !0;
					}
					generateUniqueID() {
						return this.uniqueID++, this.uniqueID;
					}
				}
				class It {
					constructor(e, t, n, r) {
						this.name = e, this.priority = t, this.transport = n, this.options = r || {};
					}
					isSupported() {
						return this.transport.isSupported({ useTLS: this.options.useTLS });
					}
					connect(e, t) {
						if (!this.isSupported()) return Lt(new g(), t);
						if (this.priority < e) return Lt(new ne(), t);
						var n = !1, r = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), i = null, a = function() {
							r.unbind("initialized", a), r.connect();
						}, o = function() {
							i = V.createHandshake(r, function(e) {
								n = !0, l(), t(null, e);
							});
						}, s = function(e) {
							l(), t(e);
						}, c = function() {
							l(), t(new p(k(r)));
						}, l = function() {
							r.unbind("initialized", a), r.unbind("open", o), r.unbind("error", s), r.unbind("closed", c);
						};
						return r.bind("initialized", a), r.bind("open", o), r.bind("error", s), r.bind("closed", c), r.initialize(), {
							abort: () => {
								n || (l(), i ? i.close() : r.close());
							},
							forceMinPriority: (e) => {
								n || this.priority < e && (i ? i.close() : r.close());
							}
						};
					}
				}
				function Lt(e, t) {
					return w.defer(function() {
						t(e);
					}), {
						abort: function() {},
						forceMinPriority: function() {}
					};
				}
				let { Transports: Rt } = Y;
				var zt = function(e, t, n, r, i, a) {
					var o = Rt[n];
					if (!o) throw new h(n);
					var s = (!e.enabledTransports || E(e.enabledTransports, t) !== -1) && (!e.disabledTransports || E(e.disabledTransports, t) === -1), c;
					return s ? (i = Object.assign({ ignoreNullOrigin: e.ignoreNullOrigin }, i), c = new It(t, r, a ? a.getAssistant(o) : o, i)) : c = Bt, c;
				}, Bt = {
					isSupported: function() {
						return !1;
					},
					connect: function(e, t) {
						var n = w.defer(function() {
							t(new g());
						});
						return {
							abort: function() {
								n.ensureAborted();
							},
							forceMinPriority: function() {}
						};
					}
				};
				function Vt(e) {
					if (e == null) throw "You must pass an options object";
					if (e.cluster == null) throw "Options object must provide a cluster";
					"disableStats" in e && A.warn("The disableStats option is deprecated in favor of enableStats");
				}
				let Ht = (e, t) => {
					var n = "socket_id=" + encodeURIComponent(e.socketId);
					for (var r in t.params) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(t.params[r]);
					if (t.paramsProvider != null) {
						let e = t.paramsProvider();
						for (var r in e) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e[r]);
					}
					return n;
				}, Ut = (e) => {
					if (Y.getAuthorizers()[e.transport] === void 0) throw `'${e.transport}' is not a recognized auth transport`;
					return (t, n) => {
						let r = Ht(t, e);
						Y.getAuthorizers()[e.transport](Y, r, e, d.UserAuthentication, n);
					};
				}, Wt = (e, t) => {
					var n = "socket_id=" + encodeURIComponent(e.socketId);
					for (var r in n += "&channel_name=" + encodeURIComponent(e.channelName), t.params) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(t.params[r]);
					if (t.paramsProvider != null) {
						let e = t.paramsProvider();
						for (var r in e) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(e[r]);
					}
					return n;
				}, Gt = (e) => {
					if (Y.getAuthorizers()[e.transport] === void 0) throw `'${e.transport}' is not a recognized auth transport`;
					return (t, n) => {
						let r = Wt(t, e);
						Y.getAuthorizers()[e.transport](Y, r, e, d.ChannelAuthorization, n);
					};
				}, Kt = (e, t, n) => {
					let r = {
						authTransport: t.transport,
						authEndpoint: t.endpoint,
						auth: {
							params: t.params,
							headers: t.headers
						}
					};
					return (t, i) => {
						n(e.channel(t.channelName), r).authorize(t.socketId, i);
					};
				};
				function qt(e, t) {
					let n = {
						activityTimeout: e.activityTimeout || a.activityTimeout,
						cluster: e.cluster,
						httpPath: e.httpPath || a.httpPath,
						httpPort: e.httpPort || a.httpPort,
						httpsPort: e.httpsPort || a.httpsPort,
						pongTimeout: e.pongTimeout || a.pongTimeout,
						statsHost: e.statsHost || a.stats_host,
						unavailableTimeout: e.unavailableTimeout || a.unavailableTimeout,
						wsPath: e.wsPath || a.wsPath,
						wsPort: e.wsPort || a.wsPort,
						wssPort: e.wssPort || a.wssPort,
						enableStats: Qt(e),
						httpHost: Jt(e),
						useTLS: Zt(e),
						wsHost: Yt(e),
						userAuthenticator: en(e),
						channelAuthorizer: nn(e, t)
					};
					return "disabledTransports" in e && (n.disabledTransports = e.disabledTransports), "enabledTransports" in e && (n.enabledTransports = e.enabledTransports), "ignoreNullOrigin" in e && (n.ignoreNullOrigin = e.ignoreNullOrigin), "timelineParams" in e && (n.timelineParams = e.timelineParams), "nacl" in e && (n.nacl = e.nacl), n;
				}
				function Jt(e) {
					return e.httpHost ? e.httpHost : e.cluster ? `sockjs-${e.cluster}.pusher.com` : a.httpHost;
				}
				function Yt(e) {
					return e.wsHost ? e.wsHost : Xt(e.cluster);
				}
				function Xt(e) {
					return `ws-${e}.pusher.com`;
				}
				function Zt(e) {
					return Y.getProtocol() === "https:" ? !0 : e.forceTLS !== !1;
				}
				function Qt(e) {
					return "enableStats" in e ? e.enableStats : "disableStats" in e ? !e.disableStats : !1;
				}
				let $t = (e) => "customHandler" in e && e.customHandler != null;
				function en(e) {
					let t = Object.assign(Object.assign({}, a.userAuthentication), e.userAuthentication);
					return $t(t) ? t.customHandler : Ut(t);
				}
				function tn(e, t) {
					let n;
					if ("channelAuthorization" in e) n = Object.assign(Object.assign({}, a.channelAuthorization), e.channelAuthorization);
					else if (n = {
						transport: e.authTransport || a.authTransport,
						endpoint: e.authEndpoint || a.authEndpoint
					}, "auth" in e && ("params" in e.auth && (n.params = e.auth.params), "headers" in e.auth && (n.headers = e.auth.headers)), "authorizer" in e) return { customHandler: Kt(t, n, e.authorizer) };
					return n;
				}
				function nn(e, t) {
					let n = tn(e, t);
					return $t(n) ? n.customHandler : Gt(n);
				}
				class rn extends P {
					constructor(e) {
						super(function(e, t) {
							A.debug(`No callbacks on watchlist events for ${e}`);
						}), this.pusher = e, this.bindWatchlistInternalEvent();
					}
					handleEvent(e) {
						e.data.events.forEach((e) => {
							this.emit(e.name, e);
						});
					}
					bindWatchlistInternalEvent() {
						this.pusher.connection.bind("message", (e) => {
							e.event === "pusher_internal:watchlist_events" && this.handleEvent(e);
						});
					}
				}
				function an() {
					let e, t;
					return {
						promise: new Promise((n, r) => {
							e = n, t = r;
						}),
						resolve: e,
						reject: t
					};
				}
				let on = an;
				class sn extends P {
					constructor(e) {
						super(function(e, t) {
							A.debug("No callbacks on user for " + e);
						}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (e, t) => {
							if (e) {
								A.warn(`Error during signin: ${e}`), this._cleanup();
								return;
							}
							this.pusher.send_event("pusher:signin", {
								auth: t.auth,
								user_data: t.user_data
							});
						}, this.pusher = e, this.pusher.connection.bind("state_change", ({ previous: e, current: t }) => {
							e !== "connected" && t === "connected" && this._signin(), e === "connected" && t !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
						}), this.watchlist = new rn(e), this.pusher.connection.bind("message", (e) => {
							e.event === "pusher:signin_success" && this._onSigninSuccess(e.data), this.serverToUserChannel && this.serverToUserChannel.name === e.channel && this.serverToUserChannel.handleEvent(e);
						});
					}
					signin() {
						this.signin_requested || (this.signin_requested = !0, this._signin());
					}
					_signin() {
						this.signin_requested && (this._newSigninPromiseIfNeeded(), this.pusher.connection.state === "connected" && this.pusher.config.userAuthenticator({ socketId: this.pusher.connection.socket_id }, this._onAuthorize));
					}
					_onSigninSuccess(e) {
						try {
							this.user_data = JSON.parse(e.user_data);
						} catch {
							A.error(`Failed parsing user data after signin: ${e.user_data}`), this._cleanup();
							return;
						}
						if (typeof this.user_data.id != "string" || this.user_data.id === "") {
							A.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
							return;
						}
						this._signinDoneResolve(), this._subscribeChannels();
					}
					_subscribeChannels() {
						let e = (e) => {
							e.subscriptionPending && e.subscriptionCancelled ? e.reinstateSubscription() : !e.subscriptionPending && this.pusher.connection.state === "connected" && e.subscribe();
						};
						this.serverToUserChannel = new R(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((e, t) => {
							e.indexOf("pusher_internal:") === 0 || e.indexOf("pusher:") === 0 || this.emit(e, t);
						}), e(this.serverToUserChannel);
					}
					_cleanup() {
						this.user_data = null, this.serverToUserChannel &&= (this.serverToUserChannel.unbind_all(), this.serverToUserChannel.disconnect(), null), this.signin_requested && this._signinDoneResolve();
					}
					_newSigninPromiseIfNeeded() {
						if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done) return;
						let { promise: e, resolve: t, reject: n } = on();
						e.done = !1;
						let r = () => {
							e.done = !0;
						};
						e.then(r).catch(r), this.signinDonePromise = e, this._signinDoneResolve = t;
					}
				}
				class Q {
					static ready() {
						Q.isReady = !0;
						for (var e = 0, t = Q.instances.length; e < t; e++) Q.instances[e].connect();
					}
					static getClientFeatures() {
						return he(be({ ws: Y.Transports.ws }, function(e) {
							return e.isSupported({});
						}));
					}
					constructor(e, t) {
						cn(e), Vt(t), this.key = e, this.options = t, this.config = qt(this.options, this), this.channels = V.createChannels(), this.global_emitter = new P(), this.sessionID = Y.randomInt(1e9), this.timeline = new Ft(this.key, this.sessionID, {
							cluster: this.config.cluster,
							features: Q.getClientFeatures(),
							params: this.config.timelineParams || {},
							limit: 50,
							level: Z.INFO,
							version: a.VERSION
						}), this.config.enableStats && (this.timelineSender = V.createTimelineSender(this.timeline, {
							host: this.config.statsHost,
							path: "/timeline/v2/" + Y.TimelineTransport.name
						}));
						var n = (e) => Y.getDefaultStrategy(this.config, e, zt);
						this.connection = V.createConnectionManager(this.key, {
							getStrategy: n,
							timeline: this.timeline,
							activityTimeout: this.config.activityTimeout,
							pongTimeout: this.config.pongTimeout,
							unavailableTimeout: this.config.unavailableTimeout,
							useTLS: !!this.config.useTLS
						}), this.connection.bind("connected", () => {
							this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
						}), this.connection.bind("message", (e) => {
							var t = e.event.indexOf("pusher_internal:") === 0;
							if (e.channel) {
								var n = this.channel(e.channel);
								n && n.handleEvent(e);
							}
							t || this.global_emitter.emit(e.event, e.data);
						}), this.connection.bind("connecting", () => {
							this.channels.disconnect();
						}), this.connection.bind("disconnected", () => {
							this.channels.disconnect();
						}), this.connection.bind("error", (e) => {
							A.warn(e);
						}), Q.instances.push(this), this.timeline.info({ instances: Q.instances.length }), this.user = new sn(this), Q.isReady && this.connect();
					}
					switchCluster(e) {
						let { appKey: t, cluster: n } = e;
						this.key = t, this.options = Object.assign(Object.assign({}, this.options), { cluster: n }), this.config = qt(this.options, this), this.connection.switchCluster(this.key);
					}
					channel(e) {
						return this.channels.find(e);
					}
					allChannels() {
						return this.channels.all();
					}
					connect() {
						if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
							var e = this.connection.isUsingTLS(), t = this.timelineSender;
							this.timelineSenderTimer = new pe(6e4, function() {
								t.send(e);
							});
						}
					}
					disconnect() {
						this.connection.disconnect(), this.timelineSenderTimer &&= (this.timelineSenderTimer.ensureAborted(), null);
					}
					bind(e, t, n) {
						return this.global_emitter.bind(e, t, n), this;
					}
					unbind(e, t, n) {
						return this.global_emitter.unbind(e, t, n), this;
					}
					bind_global(e) {
						return this.global_emitter.bind_global(e), this;
					}
					unbind_global(e) {
						return this.global_emitter.unbind_global(e), this;
					}
					unbind_all(e) {
						return this.global_emitter.unbind_all(), this;
					}
					subscribeAll() {
						for (var e in this.channels.channels) this.channels.channels.hasOwnProperty(e) && this.subscribe(e);
					}
					subscribe(e) {
						var t = this.channels.add(e, this);
						return t.subscriptionPending && t.subscriptionCancelled ? t.reinstateSubscription() : !t.subscriptionPending && this.connection.state === "connected" && t.subscribe(), t;
					}
					unsubscribe(e) {
						var t = this.channels.find(e);
						t && t.subscriptionPending ? t.cancelSubscription() : (t = this.channels.remove(e), t && t.subscribed && t.unsubscribe());
					}
					send_event(e, t, n) {
						return this.connection.send_event(e, t, n);
					}
					shouldUseTLS() {
						return this.config.useTLS;
					}
					signin() {
						this.user.signin();
					}
				}
				Q.instances = [], Q.isReady = !1, Q.logToConsole = !1, Q.Runtime = Y, Q.ScriptReceivers = Y.ScriptReceivers, Q.DependenciesReceivers = Y.DependenciesReceivers, Q.auth_callbacks = Y.auth_callbacks;
				let $ = Q;
				function cn(e) {
					if (e == null) throw "You must pass your app key when you instantiate Pusher.";
				}
				Y.setup(Q);
			}
		}, t = {};
		function n(r) {
			var i = t[r];
			if (i !== void 0) return i.exports;
			var a = t[r] = { exports: {} };
			return e[r].call(a.exports, a, a.exports, n), a.exports;
		}
		return n.d = (e, t) => {
			for (var r in t) n.o(t, r) && !n.o(e, r) && Object.defineProperty(e, r, {
				enumerable: !0,
				get: t[r]
			});
		}, n.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t), n(721);
	})());
}));
//#endregion
export { t };

//# sourceMappingURL=pusher-CDbNlZBE.js.map