@voicenter-team/events-sdk 0.0.105 → 0.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/voicenter-events-sdk.cjs.js +11 -11
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.es.js +554 -465
- package/dist/voicenter-events-sdk.es.js.map +1 -1
- package/dist/voicenter-events-sdk.iife.js +9 -9
- package/dist/voicenter-events-sdk.iife.js.map +1 -1
- package/dist/voicenter-events-sdk.umd.js +9 -9
- package/dist/voicenter-events-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var X = (a, t, e) => (
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var xe = (a, t, e) => t in a ? Re(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var X = (a, t, e) => (xe(a, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
4
|
import Ie from "ws";
|
|
5
|
-
import
|
|
6
|
-
function
|
|
5
|
+
import Ue, { LevelEnum as z, ActionNameEnum as Y, LogTypeEnum as Q } from "@voicenter-team/socketio-storage-logger";
|
|
6
|
+
function Be(a) {
|
|
7
7
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
8
8
|
}
|
|
9
9
|
var Te = { exports: {} }, be = { exports: {} };
|
|
@@ -72,7 +72,7 @@ var Te = { exports: {} }, be = { exports: {} };
|
|
|
72
72
|
};
|
|
73
73
|
be.exports = t;
|
|
74
74
|
})();
|
|
75
|
-
var
|
|
75
|
+
var De = be.exports, me = {
|
|
76
76
|
// UTF-8 encoding
|
|
77
77
|
utf8: {
|
|
78
78
|
// Convert a string to a byte array
|
|
@@ -106,39 +106,39 @@ var Be = be.exports, me = {
|
|
|
106
106
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
107
107
|
* @license MIT
|
|
108
108
|
*/
|
|
109
|
-
var
|
|
110
|
-
return a != null && (Ae(a) ||
|
|
109
|
+
var je = function(a) {
|
|
110
|
+
return a != null && (Ae(a) || Pe(a) || !!a._isBuffer);
|
|
111
111
|
};
|
|
112
112
|
function Ae(a) {
|
|
113
113
|
return !!a.constructor && typeof a.constructor.isBuffer == "function" && a.constructor.isBuffer(a);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function Pe(a) {
|
|
116
116
|
return typeof a.readFloatLE == "function" && typeof a.slice == "function" && Ae(a.slice(0, 0));
|
|
117
117
|
}
|
|
118
118
|
(function() {
|
|
119
|
-
var a =
|
|
119
|
+
var a = De, t = we.utf8, e = je, s = we.bin, o = function(h, f) {
|
|
120
120
|
h.constructor == String ? f && f.encoding === "binary" ? h = s.stringToBytes(h) : h = t.stringToBytes(h) : e(h) ? h = Array.prototype.slice.call(h, 0) : !Array.isArray(h) && h.constructor !== Uint8Array && (h = h.toString());
|
|
121
|
-
for (var l = a.bytesToWords(h), d = h.length * 8, i = 1732584193,
|
|
121
|
+
for (var l = a.bytesToWords(h), d = h.length * 8, i = 1732584193, u = -271733879, c = -1732584194, r = 271733878, n = 0; n < l.length; n++)
|
|
122
122
|
l[n] = (l[n] << 8 | l[n] >>> 24) & 16711935 | (l[n] << 24 | l[n] >>> 8) & 4278255360;
|
|
123
123
|
l[d >>> 5] |= 128 << d % 32, l[(d + 64 >>> 9 << 4) + 14] = d;
|
|
124
|
-
for (var
|
|
125
|
-
var P = i, U =
|
|
126
|
-
i =
|
|
124
|
+
for (var p = o._ff, g = o._gg, y = o._hh, T = o._ii, n = 0; n < l.length; n += 16) {
|
|
125
|
+
var P = i, U = u, M = c, _ = r;
|
|
126
|
+
i = p(i, u, c, r, l[n + 0], 7, -680876936), r = p(r, i, u, c, l[n + 1], 12, -389564586), c = p(c, r, i, u, l[n + 2], 17, 606105819), u = p(u, c, r, i, l[n + 3], 22, -1044525330), i = p(i, u, c, r, l[n + 4], 7, -176418897), r = p(r, i, u, c, l[n + 5], 12, 1200080426), c = p(c, r, i, u, l[n + 6], 17, -1473231341), u = p(u, c, r, i, l[n + 7], 22, -45705983), i = p(i, u, c, r, l[n + 8], 7, 1770035416), r = p(r, i, u, c, l[n + 9], 12, -1958414417), c = p(c, r, i, u, l[n + 10], 17, -42063), u = p(u, c, r, i, l[n + 11], 22, -1990404162), i = p(i, u, c, r, l[n + 12], 7, 1804603682), r = p(r, i, u, c, l[n + 13], 12, -40341101), c = p(c, r, i, u, l[n + 14], 17, -1502002290), u = p(u, c, r, i, l[n + 15], 22, 1236535329), i = g(i, u, c, r, l[n + 1], 5, -165796510), r = g(r, i, u, c, l[n + 6], 9, -1069501632), c = g(c, r, i, u, l[n + 11], 14, 643717713), u = g(u, c, r, i, l[n + 0], 20, -373897302), i = g(i, u, c, r, l[n + 5], 5, -701558691), r = g(r, i, u, c, l[n + 10], 9, 38016083), c = g(c, r, i, u, l[n + 15], 14, -660478335), u = g(u, c, r, i, l[n + 4], 20, -405537848), i = g(i, u, c, r, l[n + 9], 5, 568446438), r = g(r, i, u, c, l[n + 14], 9, -1019803690), c = g(c, r, i, u, l[n + 3], 14, -187363961), u = g(u, c, r, i, l[n + 8], 20, 1163531501), i = g(i, u, c, r, l[n + 13], 5, -1444681467), r = g(r, i, u, c, l[n + 2], 9, -51403784), c = g(c, r, i, u, l[n + 7], 14, 1735328473), u = g(u, c, r, i, l[n + 12], 20, -1926607734), i = y(i, u, c, r, l[n + 5], 4, -378558), r = y(r, i, u, c, l[n + 8], 11, -2022574463), c = y(c, r, i, u, l[n + 11], 16, 1839030562), u = y(u, c, r, i, l[n + 14], 23, -35309556), i = y(i, u, c, r, l[n + 1], 4, -1530992060), r = y(r, i, u, c, l[n + 4], 11, 1272893353), c = y(c, r, i, u, l[n + 7], 16, -155497632), u = y(u, c, r, i, l[n + 10], 23, -1094730640), i = y(i, u, c, r, l[n + 13], 4, 681279174), r = y(r, i, u, c, l[n + 0], 11, -358537222), c = y(c, r, i, u, l[n + 3], 16, -722521979), u = y(u, c, r, i, l[n + 6], 23, 76029189), i = y(i, u, c, r, l[n + 9], 4, -640364487), r = y(r, i, u, c, l[n + 12], 11, -421815835), c = y(c, r, i, u, l[n + 15], 16, 530742520), u = y(u, c, r, i, l[n + 2], 23, -995338651), i = T(i, u, c, r, l[n + 0], 6, -198630844), r = T(r, i, u, c, l[n + 7], 10, 1126891415), c = T(c, r, i, u, l[n + 14], 15, -1416354905), u = T(u, c, r, i, l[n + 5], 21, -57434055), i = T(i, u, c, r, l[n + 12], 6, 1700485571), r = T(r, i, u, c, l[n + 3], 10, -1894986606), c = T(c, r, i, u, l[n + 10], 15, -1051523), u = T(u, c, r, i, l[n + 1], 21, -2054922799), i = T(i, u, c, r, l[n + 8], 6, 1873313359), r = T(r, i, u, c, l[n + 15], 10, -30611744), c = T(c, r, i, u, l[n + 6], 15, -1560198380), u = T(u, c, r, i, l[n + 13], 21, 1309151649), i = T(i, u, c, r, l[n + 4], 6, -145523070), r = T(r, i, u, c, l[n + 11], 10, -1120210379), c = T(c, r, i, u, l[n + 2], 15, 718787259), u = T(u, c, r, i, l[n + 9], 21, -343485551), i = i + P >>> 0, u = u + U >>> 0, c = c + M >>> 0, r = r + _ >>> 0;
|
|
127
127
|
}
|
|
128
|
-
return a.endian([i,
|
|
128
|
+
return a.endian([i, u, c, r]);
|
|
129
129
|
};
|
|
130
|
-
o._ff = function(h, f, l, d, i,
|
|
130
|
+
o._ff = function(h, f, l, d, i, u, c) {
|
|
131
131
|
var r = h + (f & l | ~f & d) + (i >>> 0) + c;
|
|
132
|
-
return (r <<
|
|
133
|
-
}, o._gg = function(h, f, l, d, i,
|
|
132
|
+
return (r << u | r >>> 32 - u) + f;
|
|
133
|
+
}, o._gg = function(h, f, l, d, i, u, c) {
|
|
134
134
|
var r = h + (f & d | l & ~d) + (i >>> 0) + c;
|
|
135
|
-
return (r <<
|
|
136
|
-
}, o._hh = function(h, f, l, d, i,
|
|
135
|
+
return (r << u | r >>> 32 - u) + f;
|
|
136
|
+
}, o._hh = function(h, f, l, d, i, u, c) {
|
|
137
137
|
var r = h + (f ^ l ^ d) + (i >>> 0) + c;
|
|
138
|
-
return (r <<
|
|
139
|
-
}, o._ii = function(h, f, l, d, i,
|
|
138
|
+
return (r << u | r >>> 32 - u) + f;
|
|
139
|
+
}, o._ii = function(h, f, l, d, i, u, c) {
|
|
140
140
|
var r = h + (l ^ (f | ~d)) + (i >>> 0) + c;
|
|
141
|
-
return (r <<
|
|
141
|
+
return (r << u | r >>> 32 - u) + f;
|
|
142
142
|
}, o._blocksize = 16, o._digestsize = 16, Te.exports = function(h, f) {
|
|
143
143
|
if (h == null)
|
|
144
144
|
throw new Error("Illegal argument " + h);
|
|
@@ -146,9 +146,9 @@ function je(a) {
|
|
|
146
146
|
return f && f.asBytes ? l : f && f.asString ? s.bytesToString(l) : a.bytesToHex(l);
|
|
147
147
|
};
|
|
148
148
|
})();
|
|
149
|
-
var
|
|
150
|
-
const
|
|
151
|
-
var
|
|
149
|
+
var Fe = Te.exports;
|
|
150
|
+
const Me = /* @__PURE__ */ Be(Fe);
|
|
151
|
+
var te = /* @__PURE__ */ ((a) => (a.BOOTSTRAP = "bootstrap", a.DEBUG_EXTENSIONS = "debugExtensions", a.DEBUG_QUEUE = "debugQueue", a.DEBUG_DIALER = "debugDialer", a.FULL = "full", a))(te || {}), ne = /* @__PURE__ */ ((a) => (a.MAIN = "main", a.NEXT = "next", a))(ne || {}), Z = /* @__PURE__ */ ((a) => (a.USER = "User", a.TOKEN = "Token", a))(Z || {});
|
|
152
152
|
class ae {
|
|
153
153
|
static async getSessionStorageDataByKey(t, e = !0) {
|
|
154
154
|
if (typeof chrome < "u" && typeof chrome.storage < "u") {
|
|
@@ -171,7 +171,7 @@ class ae {
|
|
|
171
171
|
typeof chrome < "u" && typeof chrome.storage < "u" && chrome.storage.session.clear(), typeof window < "u" && typeof window.sessionStorage < "u" && typeof window.sessionStorage.clear == "function" && window.sessionStorage.clear();
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
class
|
|
174
|
+
class qe {
|
|
175
175
|
constructor(t) {
|
|
176
176
|
X(this, "delay", 1e3);
|
|
177
177
|
X(this, "lastLoginTimestamp");
|
|
@@ -187,7 +187,7 @@ class Me {
|
|
|
187
187
|
email: this.eventsSdkClass.options.email && this.eventsSdkClass.options.email,
|
|
188
188
|
password: this.eventsSdkClass.options.password && this.eventsSdkClass.options.password
|
|
189
189
|
};
|
|
190
|
-
if (this.storageKey =
|
|
190
|
+
if (this.storageKey = Me(JSON.stringify({
|
|
191
191
|
...this.eventsSdkClass.options,
|
|
192
192
|
loggerSocketConnection: null
|
|
193
193
|
}, this.eventsSdkClass.getCircularReplacer())), this.lastLoginTimestamp && this.lastLoginTimestamp + this.delay > (/* @__PURE__ */ new Date()).getTime())
|
|
@@ -232,7 +232,7 @@ class Me {
|
|
|
232
232
|
throw new Error("Socket servers not defined");
|
|
233
233
|
if (this.eventsSdkClass.options.isNewStack && !this.eventsSdkClass.servers.length)
|
|
234
234
|
throw new Error("Socket servers not defined");
|
|
235
|
-
this.eventsSdkClass.server && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`), !this.eventsSdkClass.server && this.eventsSdkClass.URLList.length && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${t.Version}`), t.IdentityCode && (this.token = t.IdentityCode, this.eventsSdkClass.connect(
|
|
235
|
+
this.eventsSdkClass.server && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`), !this.eventsSdkClass.server && this.eventsSdkClass.URLList.length && this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${t.Version}`), t.IdentityCode && (this.token = t.IdentityCode, this.eventsSdkClass.connect(ne.MAIN)), t.Token && (this.token = t.Token, this.eventsSdkClass.connect(ne.MAIN)), t.RefreshToken && t.IdentityCodeExpiry && this.eventsSdkClass.options.loginType === Z.USER && (this.refreshToken = t.RefreshToken, this.tokenExpiry = t.IdentityCodeExpiry, this.handleTokenExpiry()), t.RefreshToken && t.TokenExpiry && this.normalizeLoginType(this.eventsSdkClass.options.loginType) === Z.USER && (this.refreshToken = t.RefreshToken, this.tokenExpiry = t.TokenExpiry, this.handleTokenExpiry());
|
|
236
236
|
}
|
|
237
237
|
handleTokenExpiry() {
|
|
238
238
|
if (!this.eventsSdkClass.options.refreshTokenUrl)
|
|
@@ -341,12 +341,13 @@ class Me {
|
|
|
341
341
|
return t.charAt(0).toUpperCase() + t.slice(1).toLowerCase();
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
const
|
|
344
|
+
const Ne = {
|
|
345
345
|
isNewStack: !1,
|
|
346
346
|
loginUrl: "https://loginapi.voicenter.co.il/monitorAPI/Login",
|
|
347
347
|
refreshTokenUrl: "https://loginapi.voicenter.co.il/monitorAPI/RefreshIdentityToken",
|
|
348
348
|
forceNew: !0,
|
|
349
|
-
|
|
349
|
+
/** Initial reconnection delay in seconds will be used as a base, and on each unsuccessfully attempt delay is exponentially increased */
|
|
350
|
+
reconnectionDelay: 5,
|
|
350
351
|
timeout: 1e4,
|
|
351
352
|
keepAliveTimeout: 6e4,
|
|
352
353
|
protocol: "https",
|
|
@@ -381,11 +382,11 @@ function Xe() {
|
|
|
381
382
|
return h(l, !0);
|
|
382
383
|
throw new Error("Cannot find module '" + l + "'");
|
|
383
384
|
}
|
|
384
|
-
var
|
|
385
|
-
t[l][0].call(
|
|
385
|
+
var u = e[l] = { exports: {} };
|
|
386
|
+
t[l][0].call(u.exports, function(c) {
|
|
386
387
|
var r = t[l][1][c];
|
|
387
388
|
return o(r || c);
|
|
388
|
-
},
|
|
389
|
+
}, u, u.exports, a, t, e, s);
|
|
389
390
|
}
|
|
390
391
|
return e[l].exports;
|
|
391
392
|
}
|
|
@@ -397,10 +398,10 @@ function Xe() {
|
|
|
397
398
|
t.exports = a("./lib/");
|
|
398
399
|
}, { "./lib/": 2 }],
|
|
399
400
|
2: [function(a, t, e) {
|
|
400
|
-
function s(i,
|
|
401
|
-
typeof i == "object" && (
|
|
402
|
-
var c, r = o(i), n = r.source,
|
|
403
|
-
return
|
|
401
|
+
function s(i, u) {
|
|
402
|
+
typeof i == "object" && (u = i, i = void 0), u = u || {};
|
|
403
|
+
var c, r = o(i), n = r.source, p = r.id;
|
|
404
|
+
return u.forceNew || u["force new connection"] || u.multiplex === !1 ? (l("ignoring socket cache for %s", n), c = f(n, u)) : (d[p] || (l("new io instance for %s", n), d[p] = f(n, u)), c = d[p]), c.socket(r.path);
|
|
404
405
|
}
|
|
405
406
|
var o = a("./url"), h = a("socket.io-parser"), f = a("./manager"), l = a("debug")("socket.io-client");
|
|
406
407
|
t.exports = e = s;
|
|
@@ -415,7 +416,7 @@ function Xe() {
|
|
|
415
416
|
jitter: this.randomizationFactor()
|
|
416
417
|
}), this.timeout(n.timeout == null ? 2e4 : n.timeout), this.readyState = "closed", this.uri = r, this.connected = [], this.encoding = !1, this.packetBuffer = [], this.encoder = new f.Encoder(), this.decoder = new f.Decoder(), this.autoConnect = n.autoConnect !== !1, void (this.autoConnect && this.open())) : new e(r, n);
|
|
417
418
|
}
|
|
418
|
-
var s = (a("./url"), a("engine.io-client")), o = a("./socket"), h = a("component-emitter"), f = a("socket.io-parser"), l = a("./on"), d = a("component-bind"), i = (a("object-component"), a("debug")("socket.io-client:manager")),
|
|
419
|
+
var s = (a("./url"), a("engine.io-client")), o = a("./socket"), h = a("component-emitter"), f = a("socket.io-parser"), l = a("./on"), d = a("component-bind"), i = (a("object-component"), a("debug")("socket.io-client:manager")), u = a("indexof"), c = a("backo2");
|
|
419
420
|
t.exports = e, e.prototype.emitAll = function() {
|
|
420
421
|
this.emit.apply(this, arguments);
|
|
421
422
|
for (var r in this.nsps)
|
|
@@ -441,22 +442,22 @@ function Xe() {
|
|
|
441
442
|
if (i("readyState %s", this.readyState), ~this.readyState.indexOf("open"))
|
|
442
443
|
return this;
|
|
443
444
|
i("opening %s", this.uri), this.engine = s(this.uri, this.opts);
|
|
444
|
-
var n = this.engine,
|
|
445
|
+
var n = this.engine, p = this;
|
|
445
446
|
this.readyState = "opening", this.skipReconnect = !1;
|
|
446
447
|
var g = l(n, "open", function() {
|
|
447
|
-
|
|
448
|
+
p.onopen(), r && r();
|
|
448
449
|
}), y = l(n, "error", function(U) {
|
|
449
|
-
if (i("connect_error"),
|
|
450
|
+
if (i("connect_error"), p.cleanup(), p.readyState = "closed", p.emitAll("connect_error", U), r) {
|
|
450
451
|
var M = new Error("Connection error");
|
|
451
452
|
M.data = U, r(M);
|
|
452
453
|
} else
|
|
453
|
-
|
|
454
|
+
p.maybeReconnectOnOpen();
|
|
454
455
|
});
|
|
455
456
|
if (this._timeout !== !1) {
|
|
456
457
|
var T = this._timeout;
|
|
457
458
|
i("connect attempt will timeout after %d", T);
|
|
458
459
|
var P = setTimeout(function() {
|
|
459
|
-
i("connect attempt timed out after %d", T), g.destroy(), n.close(), n.emit("error", "timeout"),
|
|
460
|
+
i("connect attempt timed out after %d", T), g.destroy(), n.close(), n.emit("error", "timeout"), p.emitAll("connect_timeout", T);
|
|
460
461
|
}, T);
|
|
461
462
|
this.subs.push({
|
|
462
463
|
destroy: function() {
|
|
@@ -479,21 +480,21 @@ function Xe() {
|
|
|
479
480
|
var n = this.nsps[r];
|
|
480
481
|
if (!n) {
|
|
481
482
|
n = new o(this, r), this.nsps[r] = n;
|
|
482
|
-
var
|
|
483
|
+
var p = this;
|
|
483
484
|
n.on("connect", function() {
|
|
484
|
-
n.id =
|
|
485
|
+
n.id = p.engine.id, ~u(p.connected, n) || p.connected.push(n);
|
|
485
486
|
});
|
|
486
487
|
}
|
|
487
488
|
return n;
|
|
488
489
|
}, e.prototype.destroy = function(r) {
|
|
489
|
-
var n =
|
|
490
|
+
var n = u(this.connected, r);
|
|
490
491
|
~n && this.connected.splice(n, 1), this.connected.length || this.close();
|
|
491
492
|
}, e.prototype.packet = function(r) {
|
|
492
493
|
i("writing packet %j", r);
|
|
493
494
|
var n = this;
|
|
494
|
-
n.encoding ? n.packetBuffer.push(r) : (n.encoding = !0, this.encoder.encode(r, function(
|
|
495
|
-
for (var g = 0; g <
|
|
496
|
-
n.engine.write(
|
|
495
|
+
n.encoding ? n.packetBuffer.push(r) : (n.encoding = !0, this.encoder.encode(r, function(p) {
|
|
496
|
+
for (var g = 0; g < p.length; g++)
|
|
497
|
+
n.engine.write(p[g]);
|
|
497
498
|
n.encoding = !1, n.processPacketQueue();
|
|
498
499
|
}));
|
|
499
500
|
}, e.prototype.processPacketQueue = function() {
|
|
@@ -518,14 +519,14 @@ function Xe() {
|
|
|
518
519
|
else {
|
|
519
520
|
var n = this.backoff.duration();
|
|
520
521
|
i("will wait %dms before reconnect attempt", n), this.reconnecting = !0;
|
|
521
|
-
var
|
|
522
|
+
var p = setTimeout(function() {
|
|
522
523
|
r.skipReconnect || (i("attempting reconnect"), r.emitAll("reconnect_attempt", r.backoff.attempts), r.emitAll("reconnecting", r.backoff.attempts), r.skipReconnect || r.open(function(g) {
|
|
523
524
|
g ? (i("reconnect attempt error"), r.reconnecting = !1, r.reconnect(), r.emitAll("reconnect_error", g.data)) : (i("reconnect success"), r.onreconnect());
|
|
524
525
|
}));
|
|
525
526
|
}, n);
|
|
526
527
|
this.subs.push({
|
|
527
528
|
destroy: function() {
|
|
528
|
-
clearTimeout(
|
|
529
|
+
clearTimeout(p);
|
|
529
530
|
}
|
|
530
531
|
});
|
|
531
532
|
}
|
|
@@ -557,10 +558,10 @@ function Xe() {
|
|
|
557
558
|
t.exports = e;
|
|
558
559
|
}, {}],
|
|
559
560
|
5: [function(a, t, e) {
|
|
560
|
-
function s(n,
|
|
561
|
-
this.io = n, this.nsp =
|
|
561
|
+
function s(n, p) {
|
|
562
|
+
this.io = n, this.nsp = p, this.json = this, this.ids = 0, this.acks = {}, this.io.autoConnect && this.open(), this.receiveBuffer = [], this.sendBuffer = [], this.connected = !1, this.disconnected = !0;
|
|
562
563
|
}
|
|
563
|
-
var o = a("socket.io-parser"), h = a("component-emitter"), f = a("to-array"), l = a("./on"), d = a("component-bind"), i = a("debug")("socket.io-client:socket"),
|
|
564
|
+
var o = a("socket.io-parser"), h = a("component-emitter"), f = a("to-array"), l = a("./on"), d = a("component-bind"), i = a("debug")("socket.io-client:socket"), u = a("has-binary");
|
|
564
565
|
t.exports = s;
|
|
565
566
|
var c = {
|
|
566
567
|
connect: 1,
|
|
@@ -587,10 +588,10 @@ function Xe() {
|
|
|
587
588
|
}, s.prototype.emit = function(n) {
|
|
588
589
|
if (c.hasOwnProperty(n))
|
|
589
590
|
return r.apply(this, arguments), this;
|
|
590
|
-
var
|
|
591
|
-
p
|
|
592
|
-
var y = { type: g, data:
|
|
593
|
-
return typeof
|
|
591
|
+
var p = f(arguments), g = o.EVENT;
|
|
592
|
+
u(p) && (g = o.BINARY_EVENT);
|
|
593
|
+
var y = { type: g, data: p };
|
|
594
|
+
return typeof p[p.length - 1] == "function" && (i("emitting packet with ack id %d", this.ids), this.acks[this.ids] = p.pop(), y.id = this.ids++), this.connected ? this.packet(y) : this.sendBuffer.push(y), this;
|
|
594
595
|
}, s.prototype.packet = function(n) {
|
|
595
596
|
n.nsp = this.nsp, this.io.packet(n);
|
|
596
597
|
}, s.prototype.onopen = function() {
|
|
@@ -622,23 +623,23 @@ function Xe() {
|
|
|
622
623
|
this.emit("error", n.data);
|
|
623
624
|
}
|
|
624
625
|
}, s.prototype.onevent = function(n) {
|
|
625
|
-
var
|
|
626
|
-
i("emitting event %j",
|
|
626
|
+
var p = n.data || [];
|
|
627
|
+
i("emitting event %j", p), n.id != null && (i("attaching ack callback to event"), p.push(this.ack(n.id))), this.connected ? r.apply(this, p) : this.receiveBuffer.push(p);
|
|
627
628
|
}, s.prototype.ack = function(n) {
|
|
628
|
-
var
|
|
629
|
+
var p = this, g = !1;
|
|
629
630
|
return function() {
|
|
630
631
|
if (!g) {
|
|
631
632
|
g = !0;
|
|
632
633
|
var y = f(arguments);
|
|
633
634
|
i("sending ack %j", y);
|
|
634
|
-
var T =
|
|
635
|
-
|
|
635
|
+
var T = u(y) ? o.BINARY_ACK : o.ACK;
|
|
636
|
+
p.packet({ type: T, id: n, data: y });
|
|
636
637
|
}
|
|
637
638
|
};
|
|
638
639
|
}, s.prototype.onack = function(n) {
|
|
639
640
|
i("calling ack %s with %j", n.id, n.data);
|
|
640
|
-
var
|
|
641
|
-
|
|
641
|
+
var p = this.acks[n.id];
|
|
642
|
+
p.apply(this, n.data), delete this.acks[n.id];
|
|
642
643
|
}, s.prototype.onconnect = function() {
|
|
643
644
|
this.connected = !0, this.disconnected = !1, this.emit("connect"), this.emitBuffered();
|
|
644
645
|
}, s.prototype.emitBuffered = function() {
|
|
@@ -803,33 +804,33 @@ function Xe() {
|
|
|
803
804
|
}, { "./socket": 13, "engine.io-parser": 25 }],
|
|
804
805
|
13: [function(a, t) {
|
|
805
806
|
(function(e) {
|
|
806
|
-
function s(n,
|
|
807
|
+
function s(n, p) {
|
|
807
808
|
if (!(this instanceof s))
|
|
808
|
-
return new s(n,
|
|
809
|
-
if (
|
|
810
|
-
var g =
|
|
811
|
-
|
|
809
|
+
return new s(n, p);
|
|
810
|
+
if (p = p || {}, n && typeof n == "object" && (p = n, n = null), n && (n = u(n), p.host = n.host, p.secure = n.protocol == "https" || n.protocol == "wss", p.port = n.port, n.query && (p.query = n.query)), this.secure = p.secure != null ? p.secure : e.location && location.protocol == "https:", p.host) {
|
|
811
|
+
var g = p.host.split(":");
|
|
812
|
+
p.hostname = g.shift(), g.length ? p.port = g.pop() : p.port || (p.port = this.secure ? "443" : "80");
|
|
812
813
|
}
|
|
813
|
-
this.agent =
|
|
814
|
+
this.agent = p.agent || !1, this.hostname = p.hostname || (e.location ? location.hostname : "localhost"), this.port = p.port || (e.location && location.port ? location.port : this.secure ? 443 : 80), this.query = p.query || {}, typeof this.query == "string" && (this.query = r.decode(this.query)), this.upgrade = p.upgrade !== !1, this.path = (p.path || "/engine.io").replace(/\/$/, "") + "/", this.forceJSONP = !!p.forceJSONP, this.jsonp = p.jsonp !== !1, this.forceBase64 = !!p.forceBase64, this.enablesXDR = !!p.enablesXDR, this.timestampParam = p.timestampParam || "t", this.timestampRequests = p.timestampRequests, this.transports = p.transports || ["polling", "websocket"], this.readyState = "", this.writeBuffer = [], this.callbackBuffer = [], this.policyPort = p.policyPort || 843, this.rememberUpgrade = p.rememberUpgrade || !1, this.binaryType = null, this.onlyBinaryUpgrades = p.onlyBinaryUpgrades, this.pfx = p.pfx || null, this.key = p.key || null, this.passphrase = p.passphrase || null, this.cert = p.cert || null, this.ca = p.ca || null, this.ciphers = p.ciphers || null, this.rejectUnauthorized = p.rejectUnauthorized || null, this.open();
|
|
814
815
|
}
|
|
815
816
|
function o(n) {
|
|
816
|
-
var
|
|
817
|
+
var p = {};
|
|
817
818
|
for (var g in n)
|
|
818
|
-
n.hasOwnProperty(g) && (
|
|
819
|
-
return
|
|
819
|
+
n.hasOwnProperty(g) && (p[g] = n[g]);
|
|
820
|
+
return p;
|
|
820
821
|
}
|
|
821
|
-
var h = a("./transports"), f = a("component-emitter"), l = a("debug")("engine.io-client:socket"), d = a("indexof"), i = a("engine.io-parser"),
|
|
822
|
+
var h = a("./transports"), f = a("component-emitter"), l = a("debug")("engine.io-client:socket"), d = a("indexof"), i = a("engine.io-parser"), u = a("parseuri"), c = a("parsejson"), r = a("parseqs");
|
|
822
823
|
t.exports = s, s.priorWebsocketSuccess = !1, f(s.prototype), s.protocol = i.protocol, s.Socket = s, s.Transport = a("./transport"), s.transports = a("./transports"), s.parser = a("engine.io-parser"), s.prototype.createTransport = function(n) {
|
|
823
824
|
l('creating transport "%s"', n);
|
|
824
|
-
var
|
|
825
|
-
|
|
825
|
+
var p = o(this.query);
|
|
826
|
+
p.EIO = i.protocol, p.transport = n, this.id && (p.sid = this.id);
|
|
826
827
|
var g = new h[n]({
|
|
827
828
|
agent: this.agent,
|
|
828
829
|
hostname: this.hostname,
|
|
829
830
|
port: this.port,
|
|
830
831
|
secure: this.secure,
|
|
831
832
|
path: this.path,
|
|
832
|
-
query:
|
|
833
|
+
query: p,
|
|
833
834
|
forceJSONP: this.forceJSONP,
|
|
834
835
|
jsonp: this.jsonp,
|
|
835
836
|
forceBase64: this.forceBase64,
|
|
@@ -848,9 +849,9 @@ function Xe() {
|
|
|
848
849
|
});
|
|
849
850
|
return g;
|
|
850
851
|
}, s.prototype.open = function() {
|
|
851
|
-
var
|
|
852
|
+
var p;
|
|
852
853
|
if (this.rememberUpgrade && s.priorWebsocketSuccess && this.transports.indexOf("websocket") != -1)
|
|
853
|
-
|
|
854
|
+
p = "websocket";
|
|
854
855
|
else {
|
|
855
856
|
if (this.transports.length == 0) {
|
|
856
857
|
var n = this;
|
|
@@ -858,30 +859,30 @@ function Xe() {
|
|
|
858
859
|
n.emit("error", "No transports available");
|
|
859
860
|
}, 0);
|
|
860
861
|
}
|
|
861
|
-
|
|
862
|
+
p = this.transports[0];
|
|
862
863
|
}
|
|
863
864
|
this.readyState = "opening";
|
|
864
|
-
var
|
|
865
|
+
var p;
|
|
865
866
|
try {
|
|
866
|
-
|
|
867
|
+
p = this.createTransport(p);
|
|
867
868
|
} catch {
|
|
868
869
|
return this.transports.shift(), void this.open();
|
|
869
870
|
}
|
|
870
|
-
|
|
871
|
+
p.open(), this.setTransport(p);
|
|
871
872
|
}, s.prototype.setTransport = function(n) {
|
|
872
873
|
l("setting transport %s", n.name);
|
|
873
|
-
var
|
|
874
|
+
var p = this;
|
|
874
875
|
this.transport && (l("clearing existing transport %s", this.transport.name), this.transport.removeAllListeners()), this.transport = n, n.on("drain", function() {
|
|
875
|
-
|
|
876
|
+
p.onDrain();
|
|
876
877
|
}).on("packet", function(g) {
|
|
877
|
-
|
|
878
|
+
p.onPacket(g);
|
|
878
879
|
}).on("error", function(g) {
|
|
879
|
-
|
|
880
|
+
p.onError(g);
|
|
880
881
|
}).on("close", function() {
|
|
881
|
-
|
|
882
|
+
p.onClose("transport close");
|
|
882
883
|
});
|
|
883
884
|
}, s.prototype.probe = function(n) {
|
|
884
|
-
function
|
|
885
|
+
function p() {
|
|
885
886
|
if (b.onlyBinaryUpgrades) {
|
|
886
887
|
var A = !this.supportsBinary && b.transport.supportsBinary;
|
|
887
888
|
C = C || A;
|
|
@@ -921,15 +922,15 @@ function Xe() {
|
|
|
921
922
|
_ && A.name != _.name && (l('"%s" works - aborting "%s"', A.name, _.name), g());
|
|
922
923
|
}
|
|
923
924
|
function M() {
|
|
924
|
-
_.removeListener("open",
|
|
925
|
+
_.removeListener("open", p), _.removeListener("error", y), _.removeListener("close", T), b.removeListener("close", P), b.removeListener("upgrading", U);
|
|
925
926
|
}
|
|
926
927
|
l('probing transport "%s"', n);
|
|
927
928
|
var _ = this.createTransport(n, { probe: 1 }), C = !1, b = this;
|
|
928
|
-
s.priorWebsocketSuccess = !1, _.once("open",
|
|
929
|
+
s.priorWebsocketSuccess = !1, _.once("open", p), _.once("error", y), _.once("close", T), this.once("close", P), this.once("upgrading", U), _.open();
|
|
929
930
|
}, s.prototype.onOpen = function() {
|
|
930
931
|
if (l("socket open"), this.readyState = "open", s.priorWebsocketSuccess = this.transport.name == "websocket", this.emit("open"), this.flush(), this.readyState == "open" && this.upgrade && this.transport.pause) {
|
|
931
932
|
l("starting upgrade probes");
|
|
932
|
-
for (var n = 0,
|
|
933
|
+
for (var n = 0, p = this.upgrades.length; p > n; n++)
|
|
933
934
|
this.probe(this.upgrades[n]);
|
|
934
935
|
}
|
|
935
936
|
}, s.prototype.onPacket = function(n) {
|
|
@@ -942,8 +943,8 @@ function Xe() {
|
|
|
942
943
|
this.setPing();
|
|
943
944
|
break;
|
|
944
945
|
case "error":
|
|
945
|
-
var
|
|
946
|
-
|
|
946
|
+
var p = new Error("server error");
|
|
947
|
+
p.code = n.data, this.emit("error", p);
|
|
947
948
|
break;
|
|
948
949
|
case "message":
|
|
949
950
|
this.emit("data", n.data), this.emit("message", n.data);
|
|
@@ -954,10 +955,10 @@ function Xe() {
|
|
|
954
955
|
this.emit("handshake", n), this.id = n.sid, this.transport.query.sid = n.sid, this.upgrades = this.filterUpgrades(n.upgrades), this.pingInterval = n.pingInterval, this.pingTimeout = n.pingTimeout, this.onOpen(), this.readyState != "closed" && (this.setPing(), this.removeListener("heartbeat", this.onHeartbeat), this.on("heartbeat", this.onHeartbeat));
|
|
955
956
|
}, s.prototype.onHeartbeat = function(n) {
|
|
956
957
|
clearTimeout(this.pingTimeoutTimer);
|
|
957
|
-
var
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
}, n ||
|
|
958
|
+
var p = this;
|
|
959
|
+
p.pingTimeoutTimer = setTimeout(function() {
|
|
960
|
+
p.readyState != "closed" && p.onClose("ping timeout");
|
|
961
|
+
}, n || p.pingInterval + p.pingTimeout);
|
|
961
962
|
}, s.prototype.setPing = function() {
|
|
962
963
|
var n = this;
|
|
963
964
|
clearTimeout(n.pingIntervalTimer), n.pingIntervalTimer = setTimeout(function() {
|
|
@@ -971,22 +972,22 @@ function Xe() {
|
|
|
971
972
|
this.writeBuffer.splice(0, this.prevBufferLen), this.callbackBuffer.splice(0, this.prevBufferLen), this.prevBufferLen = 0, this.writeBuffer.length == 0 ? this.emit("drain") : this.flush();
|
|
972
973
|
}, s.prototype.flush = function() {
|
|
973
974
|
this.readyState != "closed" && this.transport.writable && !this.upgrading && this.writeBuffer.length && (l("flushing %d packets in socket", this.writeBuffer.length), this.transport.send(this.writeBuffer), this.prevBufferLen = this.writeBuffer.length, this.emit("flush"));
|
|
974
|
-
}, s.prototype.write = s.prototype.send = function(n,
|
|
975
|
-
return this.sendPacket("message", n,
|
|
976
|
-
}, s.prototype.sendPacket = function(n,
|
|
975
|
+
}, s.prototype.write = s.prototype.send = function(n, p) {
|
|
976
|
+
return this.sendPacket("message", n, p), this;
|
|
977
|
+
}, s.prototype.sendPacket = function(n, p, g) {
|
|
977
978
|
if (this.readyState != "closing" && this.readyState != "closed") {
|
|
978
|
-
var y = { type: n, data:
|
|
979
|
+
var y = { type: n, data: p };
|
|
979
980
|
this.emit("packetCreate", y), this.writeBuffer.push(y), this.callbackBuffer.push(g), this.flush();
|
|
980
981
|
}
|
|
981
982
|
}, s.prototype.close = function() {
|
|
982
983
|
function n() {
|
|
983
984
|
y.onClose("forced close"), l("socket closing - telling transport to close"), y.transport.close();
|
|
984
985
|
}
|
|
985
|
-
function
|
|
986
|
-
y.removeListener("upgrade",
|
|
986
|
+
function p() {
|
|
987
|
+
y.removeListener("upgrade", p), y.removeListener("upgradeError", p), n();
|
|
987
988
|
}
|
|
988
989
|
function g() {
|
|
989
|
-
y.once("upgrade",
|
|
990
|
+
y.once("upgrade", p), y.once("upgradeError", p);
|
|
990
991
|
}
|
|
991
992
|
if (this.readyState == "opening" || this.readyState == "open") {
|
|
992
993
|
this.readyState = "closing";
|
|
@@ -998,18 +999,18 @@ function Xe() {
|
|
|
998
999
|
return this;
|
|
999
1000
|
}, s.prototype.onError = function(n) {
|
|
1000
1001
|
l("socket error %j", n), s.priorWebsocketSuccess = !1, this.emit("error", n), this.onClose("transport error", n);
|
|
1001
|
-
}, s.prototype.onClose = function(n,
|
|
1002
|
+
}, s.prototype.onClose = function(n, p) {
|
|
1002
1003
|
if (this.readyState == "opening" || this.readyState == "open" || this.readyState == "closing") {
|
|
1003
1004
|
l('socket close with reason: "%s"', n);
|
|
1004
1005
|
var g = this;
|
|
1005
1006
|
clearTimeout(this.pingIntervalTimer), clearTimeout(this.pingTimeoutTimer), setTimeout(function() {
|
|
1006
1007
|
g.writeBuffer = [], g.callbackBuffer = [], g.prevBufferLen = 0;
|
|
1007
|
-
}, 0), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), this.readyState = "closed", this.id = null, this.emit("close", n,
|
|
1008
|
+
}, 0), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), this.readyState = "closed", this.id = null, this.emit("close", n, p);
|
|
1008
1009
|
}
|
|
1009
1010
|
}, s.prototype.filterUpgrades = function(n) {
|
|
1010
|
-
for (var
|
|
1011
|
-
~d(this.transports, n[g]) &&
|
|
1012
|
-
return
|
|
1011
|
+
for (var p = [], g = 0, y = n.length; y > g; g++)
|
|
1012
|
+
~d(this.transports, n[g]) && p.push(n[g]);
|
|
1013
|
+
return p;
|
|
1013
1014
|
};
|
|
1014
1015
|
}).call(this, typeof self < "u" ? self : typeof window < "u" ? window : {});
|
|
1015
1016
|
}, {
|
|
@@ -1053,12 +1054,12 @@ function Xe() {
|
|
|
1053
1054
|
15: [function(a, t, e) {
|
|
1054
1055
|
(function(s) {
|
|
1055
1056
|
function o(i) {
|
|
1056
|
-
var
|
|
1057
|
+
var u, c = !1, r = !1, n = i.jsonp !== !1;
|
|
1057
1058
|
if (s.location) {
|
|
1058
|
-
var
|
|
1059
|
-
g || (g =
|
|
1059
|
+
var p = location.protocol == "https:", g = location.port;
|
|
1060
|
+
g || (g = p ? 443 : 80), c = i.hostname != location.hostname || g != i.port, r = i.secure != p;
|
|
1060
1061
|
}
|
|
1061
|
-
if (i.xdomain = c, i.xscheme = r,
|
|
1062
|
+
if (i.xdomain = c, i.xscheme = r, u = new h(i), "open" in u && !i.forceJSONP)
|
|
1062
1063
|
return new f(i);
|
|
1063
1064
|
if (!n)
|
|
1064
1065
|
throw new Error("JSONP disabled");
|
|
@@ -1072,8 +1073,8 @@ function Xe() {
|
|
|
1072
1073
|
(function(e) {
|
|
1073
1074
|
function s() {
|
|
1074
1075
|
}
|
|
1075
|
-
function o(
|
|
1076
|
-
h.call(this,
|
|
1076
|
+
function o(u) {
|
|
1077
|
+
h.call(this, u), this.query = this.query || {}, l || (e.___eio || (e.___eio = []), l = e.___eio), this.index = l.length;
|
|
1077
1078
|
var c = this;
|
|
1078
1079
|
l.push(function(r) {
|
|
1079
1080
|
c.onData(r);
|
|
@@ -1087,49 +1088,49 @@ function Xe() {
|
|
|
1087
1088
|
f(o, h), o.prototype.supportsBinary = !1, o.prototype.doClose = function() {
|
|
1088
1089
|
this.script && (this.script.parentNode.removeChild(this.script), this.script = null), this.form && (this.form.parentNode.removeChild(this.form), this.form = null, this.iframe = null), h.prototype.doClose.call(this);
|
|
1089
1090
|
}, o.prototype.doPoll = function() {
|
|
1090
|
-
var
|
|
1091
|
-
this.script && (this.script.parentNode.removeChild(this.script), this.script = null), c.async = !0, c.src = this.uri(), c.onerror = function(
|
|
1092
|
-
|
|
1091
|
+
var u = this, c = document.createElement("script");
|
|
1092
|
+
this.script && (this.script.parentNode.removeChild(this.script), this.script = null), c.async = !0, c.src = this.uri(), c.onerror = function(p) {
|
|
1093
|
+
u.onError("jsonp poll error", p);
|
|
1093
1094
|
};
|
|
1094
1095
|
var r = document.getElementsByTagName("script")[0];
|
|
1095
1096
|
r.parentNode.insertBefore(c, r), this.script = c;
|
|
1096
1097
|
var n = typeof navigator < "u" && /gecko/i.test(navigator.userAgent);
|
|
1097
1098
|
n && setTimeout(function() {
|
|
1098
|
-
var
|
|
1099
|
-
document.body.appendChild(
|
|
1099
|
+
var p = document.createElement("iframe");
|
|
1100
|
+
document.body.appendChild(p), document.body.removeChild(p);
|
|
1100
1101
|
}, 100);
|
|
1101
|
-
}, o.prototype.doWrite = function(
|
|
1102
|
+
}, o.prototype.doWrite = function(u, c) {
|
|
1102
1103
|
function r() {
|
|
1103
1104
|
n(), c();
|
|
1104
1105
|
}
|
|
1105
1106
|
function n() {
|
|
1106
|
-
if (
|
|
1107
|
+
if (p.iframe)
|
|
1107
1108
|
try {
|
|
1108
|
-
|
|
1109
|
+
p.form.removeChild(p.iframe);
|
|
1109
1110
|
} catch (M) {
|
|
1110
|
-
|
|
1111
|
+
p.onError("jsonp polling iframe removal error", M);
|
|
1111
1112
|
}
|
|
1112
1113
|
try {
|
|
1113
|
-
var U = '<iframe src="javascript:0" name="' +
|
|
1114
|
+
var U = '<iframe src="javascript:0" name="' + p.iframeId + '">';
|
|
1114
1115
|
g = document.createElement(U);
|
|
1115
1116
|
} catch {
|
|
1116
|
-
g = document.createElement("iframe"), g.name =
|
|
1117
|
+
g = document.createElement("iframe"), g.name = p.iframeId, g.src = "javascript:0";
|
|
1117
1118
|
}
|
|
1118
|
-
g.id =
|
|
1119
|
+
g.id = p.iframeId, p.form.appendChild(g), p.iframe = g;
|
|
1119
1120
|
}
|
|
1120
|
-
var
|
|
1121
|
+
var p = this;
|
|
1121
1122
|
if (!this.form) {
|
|
1122
1123
|
var g, y = document.createElement("form"), T = document.createElement("textarea"), P = this.iframeId = "eio_iframe_" + this.index;
|
|
1123
1124
|
y.className = "socketio", y.style.position = "absolute", y.style.top = "-1000px", y.style.left = "-1000px", y.target = P, y.method = "POST", y.setAttribute("accept-charset", "utf-8"), T.name = "d", y.appendChild(T), document.body.appendChild(y), this.form = y, this.area = T;
|
|
1124
1125
|
}
|
|
1125
|
-
this.form.action = this.uri(), n(),
|
|
1126
|
-
`), this.area.value =
|
|
1126
|
+
this.form.action = this.uri(), n(), u = u.replace(i, `\\
|
|
1127
|
+
`), this.area.value = u.replace(d, "\\n");
|
|
1127
1128
|
try {
|
|
1128
1129
|
this.form.submit();
|
|
1129
1130
|
} catch {
|
|
1130
1131
|
}
|
|
1131
1132
|
this.iframe.attachEvent ? this.iframe.onreadystatechange = function() {
|
|
1132
|
-
|
|
1133
|
+
p.iframe.readyState == "complete" && r();
|
|
1133
1134
|
} : this.iframe.onload = r;
|
|
1134
1135
|
};
|
|
1135
1136
|
}).call(this, typeof self < "u" ? self : typeof window < "u" ? window : {});
|
|
@@ -1140,8 +1141,8 @@ function Xe() {
|
|
|
1140
1141
|
}
|
|
1141
1142
|
function o(r) {
|
|
1142
1143
|
if (d.call(this, r), e.location) {
|
|
1143
|
-
var n = location.protocol == "https:",
|
|
1144
|
-
|
|
1144
|
+
var n = location.protocol == "https:", p = location.port;
|
|
1145
|
+
p || (p = n ? 443 : 80), this.xd = r.hostname != e.location.hostname || p != r.port, this.xs = r.secure != n;
|
|
1145
1146
|
}
|
|
1146
1147
|
}
|
|
1147
1148
|
function h(r) {
|
|
@@ -1151,26 +1152,26 @@ function Xe() {
|
|
|
1151
1152
|
for (var r in h.requests)
|
|
1152
1153
|
h.requests.hasOwnProperty(r) && h.requests[r].abort();
|
|
1153
1154
|
}
|
|
1154
|
-
var l = a("xmlhttprequest"), d = a("./polling"), i = a("component-emitter"),
|
|
1155
|
-
t.exports = o, t.exports.Request = h,
|
|
1155
|
+
var l = a("xmlhttprequest"), d = a("./polling"), i = a("component-emitter"), u = a("component-inherit"), c = a("debug")("engine.io-client:polling-xhr");
|
|
1156
|
+
t.exports = o, t.exports.Request = h, u(o, d), o.prototype.supportsBinary = !0, o.prototype.request = function(r) {
|
|
1156
1157
|
return r = r || {}, r.uri = this.uri(), r.xd = this.xd, r.xs = this.xs, r.agent = this.agent || !1, r.supportsBinary = this.supportsBinary, r.enablesXDR = this.enablesXDR, r.pfx = this.pfx, r.key = this.key, r.passphrase = this.passphrase, r.cert = this.cert, r.ca = this.ca, r.ciphers = this.ciphers, r.rejectUnauthorized = this.rejectUnauthorized, new h(r);
|
|
1157
1158
|
}, o.prototype.doWrite = function(r, n) {
|
|
1158
|
-
var
|
|
1159
|
+
var p = typeof r != "string" && r !== void 0, g = this.request({ method: "POST", data: r, isBinary: p }), y = this;
|
|
1159
1160
|
g.on("success", n), g.on("error", function(T) {
|
|
1160
1161
|
y.onError("xhr post error", T);
|
|
1161
1162
|
}), this.sendXhr = g;
|
|
1162
1163
|
}, o.prototype.doPoll = function() {
|
|
1163
1164
|
c("xhr poll");
|
|
1164
1165
|
var r = this.request(), n = this;
|
|
1165
|
-
r.on("data", function(
|
|
1166
|
-
n.onData(
|
|
1167
|
-
}), r.on("error", function(
|
|
1168
|
-
n.onError("xhr poll error",
|
|
1166
|
+
r.on("data", function(p) {
|
|
1167
|
+
n.onData(p);
|
|
1168
|
+
}), r.on("error", function(p) {
|
|
1169
|
+
n.onError("xhr poll error", p);
|
|
1169
1170
|
}), this.pollXhr = r;
|
|
1170
1171
|
}, i(h.prototype), h.prototype.create = function() {
|
|
1171
1172
|
var r = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
|
|
1172
1173
|
r.pfx = this.pfx, r.key = this.key, r.passphrase = this.passphrase, r.cert = this.cert, r.ca = this.ca, r.ciphers = this.ciphers, r.rejectUnauthorized = this.rejectUnauthorized;
|
|
1173
|
-
var n = this.xhr = new l(r),
|
|
1174
|
+
var n = this.xhr = new l(r), p = this;
|
|
1174
1175
|
try {
|
|
1175
1176
|
if (c("xhr open %s: %s", this.method, this.uri), n.open(this.method, this.uri, this.async), this.supportsBinary && (n.responseType = "arraybuffer"), this.method == "POST")
|
|
1176
1177
|
try {
|
|
@@ -1178,17 +1179,17 @@ function Xe() {
|
|
|
1178
1179
|
} catch {
|
|
1179
1180
|
}
|
|
1180
1181
|
"withCredentials" in n && (n.withCredentials = !0), this.hasXDR() ? (n.onload = function() {
|
|
1181
|
-
|
|
1182
|
+
p.onLoad();
|
|
1182
1183
|
}, n.onerror = function() {
|
|
1183
|
-
|
|
1184
|
+
p.onError(n.responseText);
|
|
1184
1185
|
}) : n.onreadystatechange = function() {
|
|
1185
|
-
n.readyState == 4 && (n.status == 200 || n.status == 1223 ?
|
|
1186
|
-
|
|
1186
|
+
n.readyState == 4 && (n.status == 200 || n.status == 1223 ? p.onLoad() : setTimeout(function() {
|
|
1187
|
+
p.onError(n.status);
|
|
1187
1188
|
}, 0));
|
|
1188
1189
|
}, c("xhr data %s", this.data), n.send(this.data);
|
|
1189
1190
|
} catch (g) {
|
|
1190
1191
|
return void setTimeout(function() {
|
|
1191
|
-
|
|
1192
|
+
p.onError(g);
|
|
1192
1193
|
}, 0);
|
|
1193
1194
|
}
|
|
1194
1195
|
e.document && (this.index = h.requestsCount++, h.requests[this.index] = this);
|
|
@@ -1216,8 +1217,8 @@ function Xe() {
|
|
|
1216
1217
|
} catch {
|
|
1217
1218
|
}
|
|
1218
1219
|
r = n === "application/octet-stream" ? this.xhr.response : this.supportsBinary ? "ok" : this.xhr.responseText;
|
|
1219
|
-
} catch (
|
|
1220
|
-
this.onError(
|
|
1220
|
+
} catch (p) {
|
|
1221
|
+
this.onError(p);
|
|
1221
1222
|
}
|
|
1222
1223
|
r != null && this.onData(r);
|
|
1223
1224
|
}, h.prototype.hasXDR = function() {
|
|
@@ -1229,58 +1230,58 @@ function Xe() {
|
|
|
1229
1230
|
}, { "./polling": 18, "component-emitter": 9, "component-inherit": 21, debug: 22, xmlhttprequest: 20 }],
|
|
1230
1231
|
18: [function(a, t) {
|
|
1231
1232
|
function e(i) {
|
|
1232
|
-
var
|
|
1233
|
-
(!d ||
|
|
1233
|
+
var u = i && i.forceBase64;
|
|
1234
|
+
(!d || u) && (this.supportsBinary = !1), s.call(this, i);
|
|
1234
1235
|
}
|
|
1235
1236
|
var s = a("../transport"), o = a("parseqs"), h = a("engine.io-parser"), f = a("component-inherit"), l = a("debug")("engine.io-client:polling");
|
|
1236
1237
|
t.exports = e;
|
|
1237
1238
|
var d = function() {
|
|
1238
|
-
var i = a("xmlhttprequest"),
|
|
1239
|
-
return
|
|
1239
|
+
var i = a("xmlhttprequest"), u = new i({ xdomain: !1 });
|
|
1240
|
+
return u.responseType != null;
|
|
1240
1241
|
}();
|
|
1241
1242
|
f(e, s), e.prototype.name = "polling", e.prototype.doOpen = function() {
|
|
1242
1243
|
this.poll();
|
|
1243
1244
|
}, e.prototype.pause = function(i) {
|
|
1244
|
-
function
|
|
1245
|
+
function u() {
|
|
1245
1246
|
l("paused"), c.readyState = "paused", i();
|
|
1246
1247
|
}
|
|
1247
1248
|
var c = this;
|
|
1248
1249
|
if (this.readyState = "pausing", this.polling || !this.writable) {
|
|
1249
1250
|
var r = 0;
|
|
1250
1251
|
this.polling && (l("we are currently polling - waiting to pause"), r++, this.once("pollComplete", function() {
|
|
1251
|
-
l("pre-pause polling complete"), --r ||
|
|
1252
|
+
l("pre-pause polling complete"), --r || u();
|
|
1252
1253
|
})), this.writable || (l("we are currently writing - waiting to pause"), r++, this.once("drain", function() {
|
|
1253
|
-
l("pre-pause writing complete"), --r ||
|
|
1254
|
+
l("pre-pause writing complete"), --r || u();
|
|
1254
1255
|
}));
|
|
1255
1256
|
} else
|
|
1256
|
-
|
|
1257
|
+
u();
|
|
1257
1258
|
}, e.prototype.poll = function() {
|
|
1258
1259
|
l("polling"), this.polling = !0, this.doPoll(), this.emit("poll");
|
|
1259
1260
|
}, e.prototype.onData = function(i) {
|
|
1260
|
-
var
|
|
1261
|
+
var u = this;
|
|
1261
1262
|
l("polling got data %s", i);
|
|
1262
1263
|
var c = function(r) {
|
|
1263
|
-
return
|
|
1264
|
+
return u.readyState == "opening" && u.onOpen(), r.type == "close" ? (u.onClose(), !1) : void u.onPacket(r);
|
|
1264
1265
|
};
|
|
1265
1266
|
h.decodePayload(i, this.socket.binaryType, c), this.readyState != "closed" && (this.polling = !1, this.emit("pollComplete"), this.readyState == "open" ? this.poll() : l('ignoring poll - transport state "%s"', this.readyState));
|
|
1266
1267
|
}, e.prototype.doClose = function() {
|
|
1267
1268
|
function i() {
|
|
1268
|
-
l("writing close packet"),
|
|
1269
|
+
l("writing close packet"), u.write([{ type: "close" }]);
|
|
1269
1270
|
}
|
|
1270
|
-
var
|
|
1271
|
+
var u = this;
|
|
1271
1272
|
this.readyState == "open" ? (l("transport open - closing"), i()) : (l("transport not open - deferring close"), this.once("open", i));
|
|
1272
1273
|
}, e.prototype.write = function(i) {
|
|
1273
1274
|
var c = this;
|
|
1274
1275
|
this.writable = !1;
|
|
1275
|
-
var
|
|
1276
|
+
var u = function() {
|
|
1276
1277
|
c.writable = !0, c.emit("drain");
|
|
1277
1278
|
}, c = this;
|
|
1278
1279
|
h.encodePayload(i, this.supportsBinary, function(r) {
|
|
1279
|
-
c.doWrite(r,
|
|
1280
|
+
c.doWrite(r, u);
|
|
1280
1281
|
});
|
|
1281
1282
|
}, e.prototype.uri = function() {
|
|
1282
|
-
var i = this.query || {},
|
|
1283
|
-
return this.timestampRequests !== !1 && (i[this.timestampParam] = +/* @__PURE__ */ new Date() + "-" + s.timestamps++), this.supportsBinary || i.sid || (i.b64 = 1), i = o.encode(i), this.port && (
|
|
1283
|
+
var i = this.query || {}, u = this.secure ? "https" : "http", c = "";
|
|
1284
|
+
return this.timestampRequests !== !1 && (i[this.timestampParam] = +/* @__PURE__ */ new Date() + "-" + s.timestamps++), this.supportsBinary || i.sid || (i.b64 = 1), i = o.encode(i), this.port && (u == "https" && this.port != 443 || u == "http" && this.port != 80) && (c = ":" + this.port), i.length && (i = "?" + i), u + "://" + this.hostname + c + this.path + i;
|
|
1284
1285
|
};
|
|
1285
1286
|
}, {
|
|
1286
1287
|
"../transport": 14,
|
|
@@ -1292,14 +1293,14 @@ function Xe() {
|
|
|
1292
1293
|
}],
|
|
1293
1294
|
19: [function(a, t) {
|
|
1294
1295
|
function e(i) {
|
|
1295
|
-
var
|
|
1296
|
-
|
|
1296
|
+
var u = i && i.forceBase64;
|
|
1297
|
+
u && (this.supportsBinary = !1), s.call(this, i);
|
|
1297
1298
|
}
|
|
1298
1299
|
var s = a("../transport"), o = a("engine.io-parser"), h = a("parseqs"), f = a("component-inherit"), l = a("debug")("engine.io-client:websocket"), d = a("ws");
|
|
1299
1300
|
t.exports = e, f(e, s), e.prototype.name = "websocket", e.prototype.supportsBinary = !0, e.prototype.doOpen = function() {
|
|
1300
1301
|
if (this.check()) {
|
|
1301
|
-
var i = this.uri(),
|
|
1302
|
-
c.pfx = this.pfx, c.key = this.key, c.passphrase = this.passphrase, c.cert = this.cert, c.ca = this.ca, c.ciphers = this.ciphers, c.rejectUnauthorized = this.rejectUnauthorized, this.ws = new d(i,
|
|
1302
|
+
var i = this.uri(), u = void 0, c = { agent: this.agent };
|
|
1303
|
+
c.pfx = this.pfx, c.key = this.key, c.passphrase = this.passphrase, c.cert = this.cert, c.ca = this.ca, c.ciphers = this.ciphers, c.rejectUnauthorized = this.rejectUnauthorized, this.ws = new d(i, u, c), this.ws.binaryType === void 0 && (this.supportsBinary = !1), this.ws.binaryType = "arraybuffer", this.addEventListeners();
|
|
1303
1304
|
}
|
|
1304
1305
|
}, e.prototype.addEventListeners = function() {
|
|
1305
1306
|
var i = this;
|
|
@@ -1307,38 +1308,38 @@ function Xe() {
|
|
|
1307
1308
|
i.onOpen();
|
|
1308
1309
|
}, this.ws.onclose = function() {
|
|
1309
1310
|
i.onClose();
|
|
1310
|
-
}, this.ws.onmessage = function(
|
|
1311
|
-
i.onData(
|
|
1312
|
-
}, this.ws.onerror = function(
|
|
1313
|
-
i.onError("websocket error",
|
|
1311
|
+
}, this.ws.onmessage = function(u) {
|
|
1312
|
+
i.onData(u.data);
|
|
1313
|
+
}, this.ws.onerror = function(u) {
|
|
1314
|
+
i.onError("websocket error", u);
|
|
1314
1315
|
};
|
|
1315
1316
|
}, typeof navigator < "u" && /iPad|iPhone|iPod/i.test(navigator.userAgent) && (e.prototype.onData = function(i) {
|
|
1316
|
-
var
|
|
1317
|
+
var u = this;
|
|
1317
1318
|
setTimeout(function() {
|
|
1318
|
-
s.prototype.onData.call(
|
|
1319
|
+
s.prototype.onData.call(u, i);
|
|
1319
1320
|
}, 0);
|
|
1320
1321
|
}), e.prototype.write = function(i) {
|
|
1321
|
-
function
|
|
1322
|
+
function u() {
|
|
1322
1323
|
c.writable = !0, c.emit("drain");
|
|
1323
1324
|
}
|
|
1324
1325
|
var c = this;
|
|
1325
1326
|
this.writable = !1;
|
|
1326
1327
|
for (var r = 0, n = i.length; n > r; r++)
|
|
1327
|
-
o.encodePacket(i[r], this.supportsBinary, function(
|
|
1328
|
+
o.encodePacket(i[r], this.supportsBinary, function(p) {
|
|
1328
1329
|
try {
|
|
1329
|
-
c.ws.send(
|
|
1330
|
+
c.ws.send(p);
|
|
1330
1331
|
} catch {
|
|
1331
1332
|
l("websocket closed before onclose event");
|
|
1332
1333
|
}
|
|
1333
1334
|
});
|
|
1334
|
-
setTimeout(
|
|
1335
|
+
setTimeout(u, 0);
|
|
1335
1336
|
}, e.prototype.onClose = function() {
|
|
1336
1337
|
s.prototype.onClose.call(this);
|
|
1337
1338
|
}, e.prototype.doClose = function() {
|
|
1338
1339
|
typeof this.ws < "u" && this.ws.close();
|
|
1339
1340
|
}, e.prototype.uri = function() {
|
|
1340
|
-
var i = this.query || {},
|
|
1341
|
-
return this.port && (
|
|
1341
|
+
var i = this.query || {}, u = this.secure ? "wss" : "ws", c = "";
|
|
1342
|
+
return this.port && (u == "wss" && this.port != 443 || u == "ws" && this.port != 80) && (c = ":" + this.port), this.timestampRequests && (i[this.timestampParam] = +/* @__PURE__ */ new Date()), this.supportsBinary || (i.b64 = 1), i = h.encode(i), i.length && (i = "?" + i), u + "://" + this.hostname + c + this.path + i;
|
|
1342
1343
|
}, e.prototype.check = function() {
|
|
1343
1344
|
return !(!d || "__initialize" in d && this.name === e.prototype.name);
|
|
1344
1345
|
};
|
|
@@ -1379,12 +1380,12 @@ function Xe() {
|
|
|
1379
1380
|
var d = arguments, i = this.useColors;
|
|
1380
1381
|
if (d[0] = (i ? "%c" : "") + this.namespace + (i ? " %c" : " ") + d[0] + (i ? "%c " : " ") + "+" + e.humanize(this.diff), !i)
|
|
1381
1382
|
return d;
|
|
1382
|
-
var
|
|
1383
|
-
d = [d[0],
|
|
1383
|
+
var u = "color: " + this.color;
|
|
1384
|
+
d = [d[0], u, "color: inherit"].concat(Array.prototype.slice.call(d, 1));
|
|
1384
1385
|
var c = 0, r = 0;
|
|
1385
1386
|
return d[0].replace(/%[a-z%]/g, function(n) {
|
|
1386
1387
|
n !== "%%" && (c++, n === "%c" && (r = c));
|
|
1387
|
-
}), d.splice(r, 0,
|
|
1388
|
+
}), d.splice(r, 0, u), d;
|
|
1388
1389
|
}
|
|
1389
1390
|
function h() {
|
|
1390
1391
|
return typeof console == "object" && typeof console.log == "function" && Function.prototype.apply.call(console.log, console, arguments);
|
|
@@ -1409,7 +1410,7 @@ function Xe() {
|
|
|
1409
1410
|
}, { "./debug": 23 }],
|
|
1410
1411
|
23: [function(a, t, e) {
|
|
1411
1412
|
function s() {
|
|
1412
|
-
return e.colors[
|
|
1413
|
+
return e.colors[u++ % e.colors.length];
|
|
1413
1414
|
}
|
|
1414
1415
|
function o(c) {
|
|
1415
1416
|
function r() {
|
|
@@ -1435,13 +1436,13 @@ function Xe() {
|
|
|
1435
1436
|
M.apply(g, P);
|
|
1436
1437
|
}
|
|
1437
1438
|
r.enabled = !1, n.enabled = !0;
|
|
1438
|
-
var
|
|
1439
|
-
return
|
|
1439
|
+
var p = e.enabled(c) ? n : r;
|
|
1440
|
+
return p.namespace = c, p;
|
|
1440
1441
|
}
|
|
1441
1442
|
function h(c) {
|
|
1442
1443
|
e.save(c);
|
|
1443
|
-
for (var r = (c || "").split(/[\s,]+/), n = r.length,
|
|
1444
|
-
r[
|
|
1444
|
+
for (var r = (c || "").split(/[\s,]+/), n = r.length, p = 0; n > p; p++)
|
|
1445
|
+
r[p] && (c = r[p].replace(/\*/g, ".*?"), c[0] === "-" ? e.skips.push(new RegExp("^" + c.substr(1) + "$")) : e.names.push(new RegExp("^" + c + "$")));
|
|
1445
1446
|
}
|
|
1446
1447
|
function f() {
|
|
1447
1448
|
e.enable("");
|
|
@@ -1460,18 +1461,18 @@ function Xe() {
|
|
|
1460
1461
|
return c instanceof Error ? c.stack || c.message : c;
|
|
1461
1462
|
}
|
|
1462
1463
|
e = t.exports = o, e.coerce = d, e.disable = f, e.enable = h, e.enabled = l, e.humanize = a("ms"), e.names = [], e.skips = [], e.formatters = {};
|
|
1463
|
-
var i,
|
|
1464
|
+
var i, u = 0;
|
|
1464
1465
|
}, { ms: 24 }],
|
|
1465
1466
|
24: [function(a, t) {
|
|
1466
1467
|
function e(c) {
|
|
1467
1468
|
var r = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(c);
|
|
1468
1469
|
if (r) {
|
|
1469
|
-
var n = parseFloat(r[1]),
|
|
1470
|
-
switch (
|
|
1470
|
+
var n = parseFloat(r[1]), p = (r[2] || "ms").toLowerCase();
|
|
1471
|
+
switch (p) {
|
|
1471
1472
|
case "years":
|
|
1472
1473
|
case "year":
|
|
1473
1474
|
case "y":
|
|
1474
|
-
return n *
|
|
1475
|
+
return n * u;
|
|
1475
1476
|
case "days":
|
|
1476
1477
|
case "day":
|
|
1477
1478
|
case "d":
|
|
@@ -1502,7 +1503,7 @@ function Xe() {
|
|
|
1502
1503
|
function h(c, r, n) {
|
|
1503
1504
|
return r > c ? void 0 : 1.5 * r > c ? Math.floor(c / r) + " " + n : Math.ceil(c / r) + " " + n + "s";
|
|
1504
1505
|
}
|
|
1505
|
-
var f = 1e3, l = 60 * f, d = 60 * l, i = 24 * d,
|
|
1506
|
+
var f = 1e3, l = 60 * f, d = 60 * l, i = 24 * d, u = 365.25 * i;
|
|
1506
1507
|
t.exports = function(c, r) {
|
|
1507
1508
|
return r = r || {}, typeof c == "string" ? e(c) : r.long ? o(c) : s(c);
|
|
1508
1509
|
};
|
|
@@ -1518,8 +1519,8 @@ function Xe() {
|
|
|
1518
1519
|
return e.encodeBase64Packet(C, A);
|
|
1519
1520
|
var v = C.data, m = new Uint8Array(v), L = new Uint8Array(1 + v.byteLength);
|
|
1520
1521
|
L[0] = P[C.type];
|
|
1521
|
-
for (var
|
|
1522
|
-
L[
|
|
1522
|
+
for (var x = 0; x < m.length; x++)
|
|
1523
|
+
L[x + 1] = m[x];
|
|
1523
1524
|
return A(L.buffer);
|
|
1524
1525
|
}
|
|
1525
1526
|
function f(C, b, A) {
|
|
@@ -1541,14 +1542,14 @@ function Xe() {
|
|
|
1541
1542
|
return A(m);
|
|
1542
1543
|
}
|
|
1543
1544
|
function d(C, b, A) {
|
|
1544
|
-
for (var v = new Array(C.length), m = n(C.length, A), L = function(R, S,
|
|
1545
|
-
b(S, function(
|
|
1546
|
-
v[R] = G, V
|
|
1545
|
+
for (var v = new Array(C.length), m = n(C.length, A), L = function(R, S, K) {
|
|
1546
|
+
b(S, function(V, G) {
|
|
1547
|
+
v[R] = G, K(V, v);
|
|
1547
1548
|
});
|
|
1548
|
-
},
|
|
1549
|
-
L(
|
|
1549
|
+
}, x = 0; x < C.length; x++)
|
|
1550
|
+
L(x, C[x], m);
|
|
1550
1551
|
}
|
|
1551
|
-
var i = a("./keys"),
|
|
1552
|
+
var i = a("./keys"), u = a("has-binary"), c = a("arraybuffer.slice"), r = a("base64-arraybuffer"), n = a("after"), p = a("utf8"), g = navigator.userAgent.match(/Android/i), y = /PhantomJS/i.test(navigator.userAgent), T = g || y;
|
|
1552
1553
|
e.protocol = 3;
|
|
1553
1554
|
var P = e.packets = { open: 0, close: 1, ping: 2, pong: 3, message: 4, upgrade: 5, noop: 6 }, U = i(P), M = { type: "error", data: "parser error" }, _ = a("blob");
|
|
1554
1555
|
e.encodePacket = function(C, b, A, v) {
|
|
@@ -1561,7 +1562,7 @@ function Xe() {
|
|
|
1561
1562
|
if (m && m.base64)
|
|
1562
1563
|
return o(C, v);
|
|
1563
1564
|
var L = P[C.type];
|
|
1564
|
-
return C.data !== void 0 && (L += A ?
|
|
1565
|
+
return C.data !== void 0 && (L += A ? p.encode(String(C.data)) : String(C.data)), v("" + L);
|
|
1565
1566
|
}, e.encodeBase64Packet = function(C, b) {
|
|
1566
1567
|
var A = "b" + e.packets[C.type];
|
|
1567
1568
|
if (_ && C.data instanceof _) {
|
|
@@ -1575,9 +1576,9 @@ function Xe() {
|
|
|
1575
1576
|
try {
|
|
1576
1577
|
m = String.fromCharCode.apply(null, new Uint8Array(C.data));
|
|
1577
1578
|
} catch {
|
|
1578
|
-
for (var L = new Uint8Array(C.data),
|
|
1579
|
-
|
|
1580
|
-
m = String.fromCharCode.apply(null,
|
|
1579
|
+
for (var L = new Uint8Array(C.data), x = new Array(L.length), R = 0; R < L.length; R++)
|
|
1580
|
+
x[R] = L[R];
|
|
1581
|
+
m = String.fromCharCode.apply(null, x);
|
|
1581
1582
|
}
|
|
1582
1583
|
return A += s.btoa(m), b(A);
|
|
1583
1584
|
}, e.decodePacket = function(C, b, A) {
|
|
@@ -1586,7 +1587,7 @@ function Xe() {
|
|
|
1586
1587
|
return e.decodeBase64Packet(C.substr(1), b);
|
|
1587
1588
|
if (A)
|
|
1588
1589
|
try {
|
|
1589
|
-
C =
|
|
1590
|
+
C = p.decode(C);
|
|
1590
1591
|
} catch {
|
|
1591
1592
|
return M;
|
|
1592
1593
|
}
|
|
@@ -1605,17 +1606,17 @@ function Xe() {
|
|
|
1605
1606
|
var v = r.decode(C.substr(1));
|
|
1606
1607
|
return b === "blob" && _ && (v = new _([v])), { type: A, data: v };
|
|
1607
1608
|
}, e.encodePayload = function(C, b, A) {
|
|
1608
|
-
function v(
|
|
1609
|
-
return
|
|
1609
|
+
function v(x) {
|
|
1610
|
+
return x.length + ":" + x;
|
|
1610
1611
|
}
|
|
1611
|
-
function m(
|
|
1612
|
-
e.encodePacket(
|
|
1612
|
+
function m(x, R) {
|
|
1613
|
+
e.encodePacket(x, L ? b : !1, !0, function(S) {
|
|
1613
1614
|
R(null, v(S));
|
|
1614
1615
|
});
|
|
1615
1616
|
}
|
|
1616
1617
|
typeof b == "function" && (A = b, b = null);
|
|
1617
|
-
var L =
|
|
1618
|
-
return b && L ? _ && !T ? e.encodePayloadAsBlob(C, A) : e.encodePayloadAsArrayBuffer(C, A) : C.length ? void d(C, m, function(
|
|
1618
|
+
var L = u(C);
|
|
1619
|
+
return b && L ? _ && !T ? e.encodePayloadAsBlob(C, A) : e.encodePayloadAsArrayBuffer(C, A) : C.length ? void d(C, m, function(x, R) {
|
|
1619
1620
|
return A(R.join(""));
|
|
1620
1621
|
}) : A("0:");
|
|
1621
1622
|
}, e.decodePayload = function(C, b, A) {
|
|
@@ -1625,24 +1626,24 @@ function Xe() {
|
|
|
1625
1626
|
var v;
|
|
1626
1627
|
if (C == "")
|
|
1627
1628
|
return A(M, 0, 1);
|
|
1628
|
-
for (var m, L,
|
|
1629
|
-
var
|
|
1630
|
-
if (
|
|
1631
|
-
|
|
1629
|
+
for (var m, L, x = "", R = 0, S = C.length; S > R; R++) {
|
|
1630
|
+
var K = C.charAt(R);
|
|
1631
|
+
if (K != ":")
|
|
1632
|
+
x += K;
|
|
1632
1633
|
else {
|
|
1633
|
-
if (
|
|
1634
|
+
if (x == "" || x != (m = Number(x)) || (L = C.substr(R + 1, m), x != L.length))
|
|
1634
1635
|
return A(M, 0, 1);
|
|
1635
1636
|
if (L.length) {
|
|
1636
1637
|
if (v = e.decodePacket(L, b, !0), M.type == v.type && M.data == v.data)
|
|
1637
1638
|
return A(M, 0, 1);
|
|
1638
|
-
var
|
|
1639
|
-
if (
|
|
1639
|
+
var V = A(v, R + m, S);
|
|
1640
|
+
if (V === !1)
|
|
1640
1641
|
return;
|
|
1641
1642
|
}
|
|
1642
|
-
R += m,
|
|
1643
|
+
R += m, x = "";
|
|
1643
1644
|
}
|
|
1644
1645
|
}
|
|
1645
|
-
return
|
|
1646
|
+
return x != "" ? A(M, 0, 1) : void 0;
|
|
1646
1647
|
}, e.encodePayloadAsArrayBuffer = function(C, b) {
|
|
1647
1648
|
function A(v, m) {
|
|
1648
1649
|
e.encodePacket(v, !0, !0, function(L) {
|
|
@@ -1650,38 +1651,38 @@ function Xe() {
|
|
|
1650
1651
|
});
|
|
1651
1652
|
}
|
|
1652
1653
|
return C.length ? void d(C, A, function(v, m) {
|
|
1653
|
-
var L = m.reduce(function(S,
|
|
1654
|
-
var
|
|
1655
|
-
return
|
|
1656
|
-
}, 0),
|
|
1654
|
+
var L = m.reduce(function(S, K) {
|
|
1655
|
+
var V;
|
|
1656
|
+
return V = typeof K == "string" ? K.length : K.byteLength, S + V.toString().length + V + 2;
|
|
1657
|
+
}, 0), x = new Uint8Array(L), R = 0;
|
|
1657
1658
|
return m.forEach(function(S) {
|
|
1658
|
-
var
|
|
1659
|
-
if (
|
|
1659
|
+
var K = typeof S == "string", V = S;
|
|
1660
|
+
if (K) {
|
|
1660
1661
|
for (var G = new Uint8Array(S.length), q = 0; q < S.length; q++)
|
|
1661
1662
|
G[q] = S.charCodeAt(q);
|
|
1662
|
-
|
|
1663
|
+
V = G.buffer;
|
|
1663
1664
|
}
|
|
1664
|
-
|
|
1665
|
-
for (var J =
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
for (var G = new Uint8Array(
|
|
1669
|
-
|
|
1670
|
-
}), b(
|
|
1665
|
+
x[R++] = K ? 0 : 1;
|
|
1666
|
+
for (var J = V.byteLength.toString(), q = 0; q < J.length; q++)
|
|
1667
|
+
x[R++] = parseInt(J[q]);
|
|
1668
|
+
x[R++] = 255;
|
|
1669
|
+
for (var G = new Uint8Array(V), q = 0; q < G.length; q++)
|
|
1670
|
+
x[R++] = G[q];
|
|
1671
|
+
}), b(x.buffer);
|
|
1671
1672
|
}) : b(new ArrayBuffer(0));
|
|
1672
1673
|
}, e.encodePayloadAsBlob = function(C, b) {
|
|
1673
1674
|
function A(v, m) {
|
|
1674
1675
|
e.encodePacket(v, !0, !0, function(L) {
|
|
1675
|
-
var
|
|
1676
|
-
if (
|
|
1676
|
+
var x = new Uint8Array(1);
|
|
1677
|
+
if (x[0] = 1, typeof L == "string") {
|
|
1677
1678
|
for (var R = new Uint8Array(L.length), S = 0; S < L.length; S++)
|
|
1678
1679
|
R[S] = L.charCodeAt(S);
|
|
1679
|
-
L = R.buffer,
|
|
1680
|
+
L = R.buffer, x[0] = 0;
|
|
1680
1681
|
}
|
|
1681
|
-
for (var
|
|
1682
|
-
G[S] = parseInt(
|
|
1683
|
-
if (G[
|
|
1684
|
-
var q = new _([
|
|
1682
|
+
for (var K = L instanceof ArrayBuffer ? L.byteLength : L.size, V = K.toString(), G = new Uint8Array(V.length + 1), S = 0; S < V.length; S++)
|
|
1683
|
+
G[S] = parseInt(V[S]);
|
|
1684
|
+
if (G[V.length] = 255, _) {
|
|
1685
|
+
var q = new _([x.buffer, G.buffer, L]);
|
|
1685
1686
|
m(null, q);
|
|
1686
1687
|
}
|
|
1687
1688
|
});
|
|
@@ -1692,27 +1693,27 @@ function Xe() {
|
|
|
1692
1693
|
}, e.decodePayloadAsBinary = function(C, b, A) {
|
|
1693
1694
|
typeof b == "function" && (A = b, b = null);
|
|
1694
1695
|
for (var v = C, m = [], L = !1; v.byteLength > 0; ) {
|
|
1695
|
-
for (var
|
|
1696
|
+
for (var x = new Uint8Array(v), R = x[0] === 0, S = "", K = 1; x[K] != 255; K++) {
|
|
1696
1697
|
if (S.length > 310) {
|
|
1697
1698
|
L = !0;
|
|
1698
1699
|
break;
|
|
1699
1700
|
}
|
|
1700
|
-
S +=
|
|
1701
|
+
S += x[K];
|
|
1701
1702
|
}
|
|
1702
1703
|
if (L)
|
|
1703
1704
|
return A(M, 0, 1);
|
|
1704
1705
|
v = c(v, 2 + S.length), S = parseInt(S);
|
|
1705
|
-
var
|
|
1706
|
+
var V = c(v, 0, S);
|
|
1706
1707
|
if (R)
|
|
1707
1708
|
try {
|
|
1708
|
-
|
|
1709
|
+
V = String.fromCharCode.apply(null, new Uint8Array(V));
|
|
1709
1710
|
} catch {
|
|
1710
|
-
var G = new Uint8Array(
|
|
1711
|
-
|
|
1712
|
-
for (var
|
|
1713
|
-
|
|
1711
|
+
var G = new Uint8Array(V);
|
|
1712
|
+
V = "";
|
|
1713
|
+
for (var K = 0; K < G.length; K++)
|
|
1714
|
+
V += String.fromCharCode(G[K]);
|
|
1714
1715
|
}
|
|
1715
|
-
m.push(
|
|
1716
|
+
m.push(V), v = c(v, S);
|
|
1716
1717
|
}
|
|
1717
1718
|
var q = m.length;
|
|
1718
1719
|
m.forEach(function(J, se) {
|
|
@@ -1739,10 +1740,10 @@ function Xe() {
|
|
|
1739
1740
|
}, {}],
|
|
1740
1741
|
27: [function(a, t) {
|
|
1741
1742
|
function e(o, h, f) {
|
|
1742
|
-
function l(i,
|
|
1743
|
+
function l(i, u) {
|
|
1743
1744
|
if (l.count <= 0)
|
|
1744
1745
|
throw new Error("after called too many times");
|
|
1745
|
-
--l.count, i ? (d = !0, h(i), h = f) : l.count !== 0 || d || h(null,
|
|
1746
|
+
--l.count, i ? (d = !0, h(i), h = f) : l.count !== 0 || d || h(null, u);
|
|
1746
1747
|
}
|
|
1747
1748
|
var d = !1;
|
|
1748
1749
|
return f = f || s, l.count = o, o === 0 ? h() : l;
|
|
@@ -1771,52 +1772,52 @@ function Xe() {
|
|
|
1771
1772
|
d += s[f[h] >> 2], d += s[(3 & f[h]) << 4 | f[h + 1] >> 4], d += s[(15 & f[h + 1]) << 2 | f[h + 2] >> 6], d += s[63 & f[h + 2]];
|
|
1772
1773
|
return l % 3 === 2 ? d = d.substring(0, d.length - 1) + "=" : l % 3 === 1 && (d = d.substring(0, d.length - 2) + "=="), d;
|
|
1773
1774
|
}, e.decode = function(o) {
|
|
1774
|
-
var h, f, l, d, i,
|
|
1775
|
-
o[o.length - 1] === "=" && (
|
|
1776
|
-
var n = new ArrayBuffer(
|
|
1775
|
+
var h, f, l, d, i, u = 0.75 * o.length, c = o.length, r = 0;
|
|
1776
|
+
o[o.length - 1] === "=" && (u--, o[o.length - 2] === "=" && u--);
|
|
1777
|
+
var n = new ArrayBuffer(u), p = new Uint8Array(n);
|
|
1777
1778
|
for (h = 0; c > h; h += 4)
|
|
1778
|
-
f = s.indexOf(o[h]), l = s.indexOf(o[h + 1]), d = s.indexOf(o[h + 2]), i = s.indexOf(o[h + 3]),
|
|
1779
|
+
f = s.indexOf(o[h]), l = s.indexOf(o[h + 1]), d = s.indexOf(o[h + 2]), i = s.indexOf(o[h + 3]), p[r++] = f << 2 | l >> 4, p[r++] = (15 & l) << 4 | d >> 2, p[r++] = (3 & d) << 6 | 63 & i;
|
|
1779
1780
|
return n;
|
|
1780
1781
|
};
|
|
1781
1782
|
})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
|
|
1782
1783
|
}, {}],
|
|
1783
1784
|
30: [function(a, t) {
|
|
1784
1785
|
(function(e) {
|
|
1785
|
-
function s(
|
|
1786
|
-
for (var c = 0; c <
|
|
1787
|
-
var r =
|
|
1786
|
+
function s(u) {
|
|
1787
|
+
for (var c = 0; c < u.length; c++) {
|
|
1788
|
+
var r = u[c];
|
|
1788
1789
|
if (r.buffer instanceof ArrayBuffer) {
|
|
1789
1790
|
var n = r.buffer;
|
|
1790
1791
|
if (r.byteLength !== n.byteLength) {
|
|
1791
|
-
var
|
|
1792
|
-
|
|
1792
|
+
var p = new Uint8Array(r.byteLength);
|
|
1793
|
+
p.set(new Uint8Array(n, r.byteOffset, r.byteLength)), n = p.buffer;
|
|
1793
1794
|
}
|
|
1794
|
-
|
|
1795
|
+
u[c] = n;
|
|
1795
1796
|
}
|
|
1796
1797
|
}
|
|
1797
1798
|
}
|
|
1798
|
-
function o(
|
|
1799
|
+
function o(u, c) {
|
|
1799
1800
|
c = c || {};
|
|
1800
1801
|
var r = new f();
|
|
1801
|
-
s(
|
|
1802
|
-
for (var n = 0; n <
|
|
1803
|
-
r.append(
|
|
1802
|
+
s(u);
|
|
1803
|
+
for (var n = 0; n < u.length; n++)
|
|
1804
|
+
r.append(u[n]);
|
|
1804
1805
|
return c.type ? r.getBlob(c.type) : r.getBlob();
|
|
1805
1806
|
}
|
|
1806
|
-
function h(
|
|
1807
|
-
return s(
|
|
1807
|
+
function h(u, c) {
|
|
1808
|
+
return s(u), new Blob(u, c || {});
|
|
1808
1809
|
}
|
|
1809
1810
|
var f = e.BlobBuilder || e.WebKitBlobBuilder || e.MSBlobBuilder || e.MozBlobBuilder, l = function() {
|
|
1810
1811
|
try {
|
|
1811
|
-
var
|
|
1812
|
-
return
|
|
1812
|
+
var u = new Blob(["hi"]);
|
|
1813
|
+
return u.size === 2;
|
|
1813
1814
|
} catch {
|
|
1814
1815
|
return !1;
|
|
1815
1816
|
}
|
|
1816
1817
|
}(), d = l && function() {
|
|
1817
1818
|
try {
|
|
1818
|
-
var
|
|
1819
|
-
return
|
|
1819
|
+
var u = new Blob([new Uint8Array([1, 2])]);
|
|
1820
|
+
return u.size === 2;
|
|
1820
1821
|
} catch {
|
|
1821
1822
|
return !1;
|
|
1822
1823
|
}
|
|
@@ -1830,13 +1831,13 @@ function Xe() {
|
|
|
1830
1831
|
(function(s) {
|
|
1831
1832
|
(function(o) {
|
|
1832
1833
|
function h(v) {
|
|
1833
|
-
for (var m, L,
|
|
1834
|
-
m = v.charCodeAt(R++), m >= 55296 && 56319 >= m && S > R ? (L = v.charCodeAt(R++), (64512 & L) == 56320 ?
|
|
1835
|
-
return
|
|
1834
|
+
for (var m, L, x = [], R = 0, S = v.length; S > R; )
|
|
1835
|
+
m = v.charCodeAt(R++), m >= 55296 && 56319 >= m && S > R ? (L = v.charCodeAt(R++), (64512 & L) == 56320 ? x.push(((1023 & m) << 10) + (1023 & L) + 65536) : (x.push(m), R--)) : x.push(m);
|
|
1836
|
+
return x;
|
|
1836
1837
|
}
|
|
1837
1838
|
function f(v) {
|
|
1838
|
-
for (var m, L = v.length,
|
|
1839
|
-
m = v[
|
|
1839
|
+
for (var m, L = v.length, x = -1, R = ""; ++x < L; )
|
|
1840
|
+
m = v[x], m > 65535 && (m -= 65536, R += M(m >>> 10 & 1023 | 55296), m = 56320 | 1023 & m), R += M(m);
|
|
1840
1841
|
return R;
|
|
1841
1842
|
}
|
|
1842
1843
|
function l(v) {
|
|
@@ -1852,8 +1853,8 @@ function Xe() {
|
|
|
1852
1853
|
var m = "";
|
|
1853
1854
|
return 4294965248 & v ? 4294901760 & v ? !(4292870144 & v) && (m = M(v >> 18 & 7 | 240), m += d(v, 12), m += d(v, 6)) : (l(v), m = M(v >> 12 & 15 | 224), m += d(v, 6)) : m = M(v >> 6 & 31 | 192), m += M(63 & v | 128);
|
|
1854
1855
|
}
|
|
1855
|
-
function
|
|
1856
|
-
for (var m, L = h(v),
|
|
1856
|
+
function u(v) {
|
|
1857
|
+
for (var m, L = h(v), x = L.length, R = -1, S = ""; ++R < x; )
|
|
1857
1858
|
m = L[R], S += i(m);
|
|
1858
1859
|
return S;
|
|
1859
1860
|
}
|
|
@@ -1866,7 +1867,7 @@ function Xe() {
|
|
|
1866
1867
|
throw Error("Invalid continuation byte");
|
|
1867
1868
|
}
|
|
1868
1869
|
function r() {
|
|
1869
|
-
var v, m, L,
|
|
1870
|
+
var v, m, L, x, R;
|
|
1870
1871
|
if (U > P)
|
|
1871
1872
|
throw Error("Invalid byte index");
|
|
1872
1873
|
if (U == P)
|
|
@@ -1884,7 +1885,7 @@ function Xe() {
|
|
|
1884
1885
|
return l(R), R;
|
|
1885
1886
|
throw Error("Invalid continuation byte");
|
|
1886
1887
|
}
|
|
1887
|
-
if ((248 & v) == 240 && (m = c(), L = c(),
|
|
1888
|
+
if ((248 & v) == 240 && (m = c(), L = c(), x = c(), R = (15 & v) << 18 | m << 12 | L << 6 | x, R >= 65536 && 1114111 >= R))
|
|
1888
1889
|
return R;
|
|
1889
1890
|
throw Error("Invalid UTF-8 detected");
|
|
1890
1891
|
}
|
|
@@ -1894,16 +1895,16 @@ function Xe() {
|
|
|
1894
1895
|
L.push(m);
|
|
1895
1896
|
return f(L);
|
|
1896
1897
|
}
|
|
1897
|
-
var
|
|
1898
|
+
var p = typeof e == "object" && e, g = typeof t == "object" && t && t.exports == p && t, y = typeof s == "object" && s;
|
|
1898
1899
|
(y.global === y || y.window === y) && (o = y);
|
|
1899
|
-
var T, P, U, M = String.fromCharCode, _ = { version: "2.0.0", encode:
|
|
1900
|
-
if (
|
|
1900
|
+
var T, P, U, M = String.fromCharCode, _ = { version: "2.0.0", encode: u, decode: n };
|
|
1901
|
+
if (p && !p.nodeType)
|
|
1901
1902
|
if (g)
|
|
1902
1903
|
g.exports = _;
|
|
1903
1904
|
else {
|
|
1904
1905
|
var C = {}, b = C.hasOwnProperty;
|
|
1905
1906
|
for (var A in _)
|
|
1906
|
-
b.call(_, A) && (
|
|
1907
|
+
b.call(_, A) && (p[A] = _[A]);
|
|
1907
1908
|
}
|
|
1908
1909
|
else
|
|
1909
1910
|
o.utf8 = _;
|
|
@@ -1937,8 +1938,8 @@ function Xe() {
|
|
|
1937
1938
|
t.exports = function(o) {
|
|
1938
1939
|
var h = o, f = o.indexOf("["), l = o.indexOf("]");
|
|
1939
1940
|
f != -1 && l != -1 && (o = o.substring(0, f) + o.substring(f, l).replace(/:/g, ";") + o.substring(l, o.length));
|
|
1940
|
-
for (var d = e.exec(o || ""), i = {},
|
|
1941
|
-
i[s[
|
|
1941
|
+
for (var d = e.exec(o || ""), i = {}, u = 14; u--; )
|
|
1942
|
+
i[s[u]] = d[u] || "";
|
|
1942
1943
|
return f != -1 && l != -1 && (i.source = h, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i;
|
|
1943
1944
|
};
|
|
1944
1945
|
}, {}],
|
|
@@ -2048,8 +2049,8 @@ function Xe() {
|
|
|
2048
2049
|
return d.push(c), r;
|
|
2049
2050
|
}
|
|
2050
2051
|
if (o(c)) {
|
|
2051
|
-
for (var n = new Array(c.length),
|
|
2052
|
-
n[
|
|
2052
|
+
for (var n = new Array(c.length), p = 0; p < c.length; p++)
|
|
2053
|
+
n[p] = l(c[p]);
|
|
2053
2054
|
return n;
|
|
2054
2055
|
}
|
|
2055
2056
|
if (typeof c == "object" && !(c instanceof Date)) {
|
|
@@ -2060,13 +2061,13 @@ function Xe() {
|
|
|
2060
2061
|
}
|
|
2061
2062
|
return c;
|
|
2062
2063
|
}
|
|
2063
|
-
var d = [], i = f.data,
|
|
2064
|
-
return
|
|
2064
|
+
var d = [], i = f.data, u = f;
|
|
2065
|
+
return u.data = l(i), u.attachments = d.length, { packet: u, buffers: d };
|
|
2065
2066
|
}, e.reconstructPacket = function(f, l) {
|
|
2066
2067
|
function d(i) {
|
|
2067
2068
|
if (i && i._placeholder) {
|
|
2068
|
-
var
|
|
2069
|
-
return
|
|
2069
|
+
var u = l[i.num];
|
|
2070
|
+
return u;
|
|
2070
2071
|
}
|
|
2071
2072
|
if (o(i)) {
|
|
2072
2073
|
for (var c = 0; c < i.length; c++)
|
|
@@ -2087,10 +2088,10 @@ function Xe() {
|
|
|
2087
2088
|
return c;
|
|
2088
2089
|
if (s.Blob && c instanceof Blob || s.File && c instanceof File) {
|
|
2089
2090
|
i++;
|
|
2090
|
-
var
|
|
2091
|
-
|
|
2092
|
-
n ? n[r] = this.result :
|
|
2093
|
-
},
|
|
2091
|
+
var p = new FileReader();
|
|
2092
|
+
p.onload = function() {
|
|
2093
|
+
n ? n[r] = this.result : u = this.result, --i || l(u);
|
|
2094
|
+
}, p.readAsArrayBuffer(c);
|
|
2094
2095
|
} else if (o(c))
|
|
2095
2096
|
for (var g = 0; g < c.length; g++)
|
|
2096
2097
|
d(c[g], g, c);
|
|
@@ -2098,8 +2099,8 @@ function Xe() {
|
|
|
2098
2099
|
for (var y in c)
|
|
2099
2100
|
d(c[y], y, c);
|
|
2100
2101
|
}
|
|
2101
|
-
var i = 0,
|
|
2102
|
-
d(
|
|
2102
|
+
var i = 0, u = f;
|
|
2103
|
+
d(u), i || l(u);
|
|
2103
2104
|
};
|
|
2104
2105
|
}).call(this, typeof self < "u" ? self : typeof window < "u" ? window : {});
|
|
2105
2106
|
}, { "./is-buffer": 45, isarray: 46 }],
|
|
@@ -2108,7 +2109,7 @@ function Xe() {
|
|
|
2108
2109
|
}
|
|
2109
2110
|
function o(g) {
|
|
2110
2111
|
var y = "", T = !1;
|
|
2111
|
-
return y += g.type, (e.BINARY_EVENT == g.type || e.BINARY_ACK == g.type) && (y += g.attachments, y += "-"), g.nsp && g.nsp != "/" && (T = !0, y += g.nsp), g.id != null && (T && (y += ",", T = !1), y += g.id), g.data != null && (T && (y += ","), y += c.stringify(g.data)),
|
|
2112
|
+
return y += g.type, (e.BINARY_EVENT == g.type || e.BINARY_ACK == g.type) && (y += g.attachments, y += "-"), g.nsp && g.nsp != "/" && (T = !0, y += g.nsp), g.id != null && (T && (y += ",", T = !1), y += g.id), g.data != null && (T && (y += ","), y += c.stringify(g.data)), u("encoded %j as %s", g, y), y;
|
|
2112
2113
|
}
|
|
2113
2114
|
function h(g, y) {
|
|
2114
2115
|
function T(P) {
|
|
@@ -2158,7 +2159,7 @@ function Xe() {
|
|
|
2158
2159
|
} catch {
|
|
2159
2160
|
return i();
|
|
2160
2161
|
}
|
|
2161
|
-
return
|
|
2162
|
+
return u("decoded %s as %j", g, y), y;
|
|
2162
2163
|
}
|
|
2163
2164
|
function d(g) {
|
|
2164
2165
|
this.reconPack = g, this.buffers = [];
|
|
@@ -2166,9 +2167,9 @@ function Xe() {
|
|
|
2166
2167
|
function i() {
|
|
2167
2168
|
return { type: e.ERROR, data: "parser error" };
|
|
2168
2169
|
}
|
|
2169
|
-
var
|
|
2170
|
+
var u = a("debug")("socket.io-parser"), c = a("json3"), r = (a("isarray"), a("component-emitter")), n = a("./binary"), p = a("./is-buffer");
|
|
2170
2171
|
e.protocol = 4, e.types = ["CONNECT", "DISCONNECT", "EVENT", "BINARY_EVENT", "ACK", "BINARY_ACK", "ERROR"], e.CONNECT = 0, e.DISCONNECT = 1, e.EVENT = 2, e.ACK = 3, e.ERROR = 4, e.BINARY_EVENT = 5, e.BINARY_ACK = 6, e.Encoder = s, e.Decoder = f, s.prototype.encode = function(g, y) {
|
|
2171
|
-
if (
|
|
2172
|
+
if (u("encoding packet %j", g), e.BINARY_EVENT == g.type || e.BINARY_ACK == g.type)
|
|
2172
2173
|
h(g, y);
|
|
2173
2174
|
else {
|
|
2174
2175
|
var T = o(g);
|
|
@@ -2179,7 +2180,7 @@ function Xe() {
|
|
|
2179
2180
|
if (typeof g == "string")
|
|
2180
2181
|
y = l(g), e.BINARY_EVENT == y.type || e.BINARY_ACK == y.type ? (this.reconstructor = new d(y), this.reconstructor.reconPack.attachments === 0 && this.emit("decoded", y)) : this.emit("decoded", y);
|
|
2181
2182
|
else {
|
|
2182
|
-
if (!
|
|
2183
|
+
if (!p(g) && !g.base64)
|
|
2183
2184
|
throw new Error("Unknown type: " + g);
|
|
2184
2185
|
if (!this.reconstructor)
|
|
2185
2186
|
throw new Error("got binary data when not reconstructing a packet");
|
|
@@ -2221,25 +2222,25 @@ function Xe() {
|
|
|
2221
2222
|
else {
|
|
2222
2223
|
var w, D = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
|
|
2223
2224
|
if (E == "json-stringify") {
|
|
2224
|
-
var k =
|
|
2225
|
-
if (
|
|
2225
|
+
var k = u.stringify, I = typeof k == "function" && c;
|
|
2226
|
+
if (I) {
|
|
2226
2227
|
(w = function() {
|
|
2227
2228
|
return 1;
|
|
2228
2229
|
}).toJSON = w;
|
|
2229
2230
|
try {
|
|
2230
|
-
|
|
2231
|
+
I = k(0) === "0" && k(new Number()) === "0" && k(new String()) == '""' && k(d) === l && k(l) === l && k() === l && k(w) === "1" && k([w]) == "[1]" && k([l]) == "[null]" && k(null) == "null" && k([l, d, null]) == "[null,null,null]" && k({ a: [w, !0, !1, null, `\0\b
|
|
2231
2232
|
\f\r `] }) == D && k(null, w) === "1" && k([1, 2], null, 1) == `[
|
|
2232
2233
|
1,
|
|
2233
2234
|
2
|
|
2234
2235
|
]` && k(/* @__PURE__ */ new Date(-864e13)) == '"-271821-04-20T00:00:00.000Z"' && k(/* @__PURE__ */ new Date(864e13)) == '"+275760-09-13T00:00:00.000Z"' && k(/* @__PURE__ */ new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && k(/* @__PURE__ */ new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
|
|
2235
2236
|
} catch {
|
|
2236
|
-
|
|
2237
|
+
I = !1;
|
|
2237
2238
|
}
|
|
2238
2239
|
}
|
|
2239
|
-
O =
|
|
2240
|
+
O = I;
|
|
2240
2241
|
}
|
|
2241
2242
|
if (E == "json-parse") {
|
|
2242
|
-
var B =
|
|
2243
|
+
var B = u.parse;
|
|
2243
2244
|
if (typeof B == "function")
|
|
2244
2245
|
try {
|
|
2245
2246
|
if (B("0") === 0 && !B(!1)) {
|
|
@@ -2270,15 +2271,15 @@ function Xe() {
|
|
|
2270
2271
|
}
|
|
2271
2272
|
return o[E] = !!O;
|
|
2272
2273
|
}
|
|
2273
|
-
var h, f, l, d = {}.toString, i = typeof JSON == "object" && JSON,
|
|
2274
|
-
|
|
2274
|
+
var h, f, l, d = {}.toString, i = typeof JSON == "object" && JSON, u = typeof e == "object" && e && !e.nodeType && e;
|
|
2275
|
+
u && i ? (u.stringify = i.stringify, u.parse = i.parse) : u = s.JSON = i || {};
|
|
2275
2276
|
var c = /* @__PURE__ */ new Date(-3509827334573292);
|
|
2276
2277
|
try {
|
|
2277
2278
|
c = c.getUTCFullYear() == -109252 && c.getUTCMonth() === 0 && c.getUTCDate() === 1 && c.getUTCHours() == 10 && c.getUTCMinutes() == 37 && c.getUTCSeconds() == 6 && c.getUTCMilliseconds() == 708;
|
|
2278
2279
|
} catch {
|
|
2279
2280
|
}
|
|
2280
2281
|
if (!o("json")) {
|
|
2281
|
-
var r = "[object Function]", n = "[object Date]",
|
|
2282
|
+
var r = "[object Function]", n = "[object Date]", p = "[object Number]", g = "[object String]", y = "[object Array]", T = "[object Boolean]", P = o("bug-string-char-index");
|
|
2282
2283
|
if (!c)
|
|
2283
2284
|
var U = Math.floor, M = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], _ = function(E, O) {
|
|
2284
2285
|
return M[O] + 365 * (E - 1970) + U((E - 1969 + (O = +(O > 1))) / 4) - U((E - 1901 + O) / 100) + U((E - 1601 + O) / 400);
|
|
@@ -2286,8 +2287,8 @@ function Xe() {
|
|
|
2286
2287
|
(h = {}.hasOwnProperty) || (h = function(E) {
|
|
2287
2288
|
var O, w = {};
|
|
2288
2289
|
return (w.__proto__ = null, w.__proto__ = { toString: 1 }, w).toString != d ? h = function(D) {
|
|
2289
|
-
var k = this.__proto__,
|
|
2290
|
-
return this.__proto__ = k,
|
|
2290
|
+
var k = this.__proto__, I = D in (this.__proto__ = null, this);
|
|
2291
|
+
return this.__proto__ = k, I;
|
|
2291
2292
|
} : (O = w.constructor, h = function(D) {
|
|
2292
2293
|
var k = (this.constructor || O).prototype;
|
|
2293
2294
|
return D in this && !(D in k && this[D] === k[D]);
|
|
@@ -2298,13 +2299,13 @@ function Xe() {
|
|
|
2298
2299
|
return w == "object" ? !!E[O] : !C[w];
|
|
2299
2300
|
};
|
|
2300
2301
|
if (f = function(E, O) {
|
|
2301
|
-
var w, D, k,
|
|
2302
|
+
var w, D, k, I = 0;
|
|
2302
2303
|
(w = function() {
|
|
2303
2304
|
this.valueOf = 0;
|
|
2304
2305
|
}).prototype.valueOf = 0, D = new w();
|
|
2305
2306
|
for (k in D)
|
|
2306
|
-
h.call(D, k) &&
|
|
2307
|
-
return w = D = null,
|
|
2307
|
+
h.call(D, k) && I++;
|
|
2308
|
+
return w = D = null, I ? f = I == 2 ? function(B, N) {
|
|
2308
2309
|
var F, $ = {}, W = d.call(B) == r;
|
|
2309
2310
|
for (F in B)
|
|
2310
2311
|
W && F == "prototype" || h.call($, F) || !($[F] = 1) || !h.call(B, F) || N(F);
|
|
@@ -2323,9 +2324,9 @@ function Xe() {
|
|
|
2323
2324
|
}, !o("json-stringify")) {
|
|
2324
2325
|
var A = { 92: "\\\\", 34: '\\"', 8: "\\b", 12: "\\f", 10: "\\n", 13: "\\r", 9: "\\t" }, v = "000000", m = function(E, O) {
|
|
2325
2326
|
return (v + (O || 0)).slice(-E);
|
|
2326
|
-
}, L = "\\u00",
|
|
2327
|
-
var O, w = '"', D = 0, k = E.length,
|
|
2328
|
-
for (
|
|
2327
|
+
}, L = "\\u00", x = function(E) {
|
|
2328
|
+
var O, w = '"', D = 0, k = E.length, I = k > 10 && P;
|
|
2329
|
+
for (I && (O = E.split("")); k > D; D++) {
|
|
2329
2330
|
var B = E.charCodeAt(D);
|
|
2330
2331
|
switch (B) {
|
|
2331
2332
|
case 8:
|
|
@@ -2342,89 +2343,89 @@ function Xe() {
|
|
|
2342
2343
|
w += L + m(2, B.toString(16));
|
|
2343
2344
|
break;
|
|
2344
2345
|
}
|
|
2345
|
-
w +=
|
|
2346
|
+
w += I ? O[D] : P ? E.charAt(D) : E[D];
|
|
2346
2347
|
}
|
|
2347
2348
|
}
|
|
2348
2349
|
return w + '"';
|
|
2349
|
-
}, R = function(E, O, w, D, k,
|
|
2350
|
-
var N, F, $, W, H, oe, he,
|
|
2350
|
+
}, R = function(E, O, w, D, k, I, B) {
|
|
2351
|
+
var N, F, $, W, H, oe, he, ue, pe, fe, ee, de, ce, ie, ge, ye;
|
|
2351
2352
|
try {
|
|
2352
2353
|
N = O[E];
|
|
2353
2354
|
} catch {
|
|
2354
2355
|
}
|
|
2355
2356
|
if (typeof N == "object" && N)
|
|
2356
2357
|
if (F = d.call(N), F != n || h.call(N, "toJSON"))
|
|
2357
|
-
typeof N.toJSON == "function" && (F !=
|
|
2358
|
+
typeof N.toJSON == "function" && (F != p && F != g && F != y || h.call(N, "toJSON")) && (N = N.toJSON(E));
|
|
2358
2359
|
else if (N > -1 / 0 && 1 / 0 > N) {
|
|
2359
2360
|
if (_) {
|
|
2360
2361
|
for (H = U(N / 864e5), $ = U(H / 365.2425) + 1970 - 1; _($ + 1, 0) <= H; $++)
|
|
2361
2362
|
;
|
|
2362
2363
|
for (W = U((H - _($, 0)) / 30.42); _($, W + 1) <= H; W++)
|
|
2363
2364
|
;
|
|
2364
|
-
H = 1 + H - _($, W), oe = (N % 864e5 + 864e5) % 864e5, he = U(oe / 36e5) % 24,
|
|
2365
|
+
H = 1 + H - _($, W), oe = (N % 864e5 + 864e5) % 864e5, he = U(oe / 36e5) % 24, ue = U(oe / 6e4) % 60, pe = U(oe / 1e3) % 60, fe = oe % 1e3;
|
|
2365
2366
|
} else
|
|
2366
|
-
$ = N.getUTCFullYear(), W = N.getUTCMonth(), H = N.getUTCDate(), he = N.getUTCHours(),
|
|
2367
|
-
N = (0 >= $ || $ >= 1e4 ? (0 > $ ? "-" : "+") + m(6, 0 > $ ? -$ : $) : m(4, $)) + "-" + m(2, W + 1) + "-" + m(2, H) + "T" + m(2, he) + ":" + m(2,
|
|
2367
|
+
$ = N.getUTCFullYear(), W = N.getUTCMonth(), H = N.getUTCDate(), he = N.getUTCHours(), ue = N.getUTCMinutes(), pe = N.getUTCSeconds(), fe = N.getUTCMilliseconds();
|
|
2368
|
+
N = (0 >= $ || $ >= 1e4 ? (0 > $ ? "-" : "+") + m(6, 0 > $ ? -$ : $) : m(4, $)) + "-" + m(2, W + 1) + "-" + m(2, H) + "T" + m(2, he) + ":" + m(2, ue) + ":" + m(2, pe) + "." + m(3, fe) + "Z";
|
|
2368
2369
|
} else
|
|
2369
2370
|
N = null;
|
|
2370
2371
|
if (w && (N = w.call(O, E, N)), N === null)
|
|
2371
2372
|
return "null";
|
|
2372
2373
|
if (F = d.call(N), F == T)
|
|
2373
2374
|
return "" + N;
|
|
2374
|
-
if (F ==
|
|
2375
|
+
if (F == p)
|
|
2375
2376
|
return N > -1 / 0 && 1 / 0 > N ? "" + N : "null";
|
|
2376
2377
|
if (F == g)
|
|
2377
|
-
return
|
|
2378
|
+
return x("" + N);
|
|
2378
2379
|
if (typeof N == "object") {
|
|
2379
2380
|
for (ie = B.length; ie--; )
|
|
2380
2381
|
if (B[ie] === N)
|
|
2381
2382
|
throw TypeError();
|
|
2382
|
-
if (B.push(N), ee = [], ge =
|
|
2383
|
+
if (B.push(N), ee = [], ge = I, I += k, F == y) {
|
|
2383
2384
|
for (ce = 0, ie = N.length; ie > ce; ce++)
|
|
2384
|
-
de = R(ce, N, w, D, k,
|
|
2385
|
+
de = R(ce, N, w, D, k, I, B), ee.push(de === l ? "null" : de);
|
|
2385
2386
|
ye = ee.length ? k ? `[
|
|
2386
|
-
` +
|
|
2387
|
-
` +
|
|
2387
|
+
` + I + ee.join(`,
|
|
2388
|
+
` + I) + `
|
|
2388
2389
|
` + ge + "]" : "[" + ee.join(",") + "]" : "[]";
|
|
2389
2390
|
} else
|
|
2390
2391
|
f(D || N, function(ve) {
|
|
2391
|
-
var Ee = R(ve, N, w, D, k,
|
|
2392
|
-
Ee !== l && ee.push(
|
|
2392
|
+
var Ee = R(ve, N, w, D, k, I, B);
|
|
2393
|
+
Ee !== l && ee.push(x(ve) + ":" + (k ? " " : "") + Ee);
|
|
2393
2394
|
}), ye = ee.length ? k ? `{
|
|
2394
|
-
` +
|
|
2395
|
-
` +
|
|
2395
|
+
` + I + ee.join(`,
|
|
2396
|
+
` + I) + `
|
|
2396
2397
|
` + ge + "}" : "{" + ee.join(",") + "}" : "{}";
|
|
2397
2398
|
return B.pop(), ye;
|
|
2398
2399
|
}
|
|
2399
2400
|
};
|
|
2400
|
-
|
|
2401
|
-
var D, k,
|
|
2401
|
+
u.stringify = function(E, O, w) {
|
|
2402
|
+
var D, k, I, B;
|
|
2402
2403
|
if (typeof O == "function" || typeof O == "object" && O) {
|
|
2403
2404
|
if ((B = d.call(O)) == r)
|
|
2404
2405
|
k = O;
|
|
2405
2406
|
else if (B == y) {
|
|
2406
|
-
|
|
2407
|
-
for (var N, F = 0, $ = O.length; $ > F; N = O[F++], B = d.call(N), (B == g || B ==
|
|
2407
|
+
I = {};
|
|
2408
|
+
for (var N, F = 0, $ = O.length; $ > F; N = O[F++], B = d.call(N), (B == g || B == p) && (I[N] = 1))
|
|
2408
2409
|
;
|
|
2409
2410
|
}
|
|
2410
2411
|
}
|
|
2411
2412
|
if (w)
|
|
2412
|
-
if ((B = d.call(w)) ==
|
|
2413
|
+
if ((B = d.call(w)) == p) {
|
|
2413
2414
|
if ((w -= w % 1) > 0)
|
|
2414
2415
|
for (D = "", w > 10 && (w = 10); D.length < w; D += " ")
|
|
2415
2416
|
;
|
|
2416
2417
|
} else
|
|
2417
2418
|
B == g && (D = w.length <= 10 ? w : w.slice(0, 10));
|
|
2418
|
-
return R("", (N = {}, N[""] = E, N), k,
|
|
2419
|
+
return R("", (N = {}, N[""] = E, N), k, I, D, "", []);
|
|
2419
2420
|
};
|
|
2420
2421
|
}
|
|
2421
2422
|
if (!o("json-parse")) {
|
|
2422
|
-
var S,
|
|
2423
|
+
var S, K, V = String.fromCharCode, G = { 92: "\\", 34: '"', 47: "/", 98: "\b", 116: " ", 110: `
|
|
2423
2424
|
`, 102: "\f", 114: "\r" }, q = function() {
|
|
2424
|
-
throw S =
|
|
2425
|
+
throw S = K = null, SyntaxError();
|
|
2425
2426
|
}, J = function() {
|
|
2426
|
-
for (var E, O, w, D, k,
|
|
2427
|
-
switch (k =
|
|
2427
|
+
for (var E, O, w, D, k, I = K, B = I.length; B > S; )
|
|
2428
|
+
switch (k = I.charCodeAt(S)) {
|
|
2428
2429
|
case 9:
|
|
2429
2430
|
case 10:
|
|
2430
2431
|
case 13:
|
|
@@ -2437,13 +2438,13 @@ function Xe() {
|
|
|
2437
2438
|
case 93:
|
|
2438
2439
|
case 58:
|
|
2439
2440
|
case 44:
|
|
2440
|
-
return E = P ?
|
|
2441
|
+
return E = P ? I.charAt(S) : I[S], S++, E;
|
|
2441
2442
|
case 34:
|
|
2442
2443
|
for (E = "@", S++; B > S; )
|
|
2443
|
-
if (k =
|
|
2444
|
+
if (k = I.charCodeAt(S), 32 > k)
|
|
2444
2445
|
q();
|
|
2445
2446
|
else if (k == 92)
|
|
2446
|
-
switch (k =
|
|
2447
|
+
switch (k = I.charCodeAt(++S)) {
|
|
2447
2448
|
case 92:
|
|
2448
2449
|
case 34:
|
|
2449
2450
|
case 47:
|
|
@@ -2456,8 +2457,8 @@ function Xe() {
|
|
|
2456
2457
|
break;
|
|
2457
2458
|
case 117:
|
|
2458
2459
|
for (O = ++S, w = S + 4; w > S; S++)
|
|
2459
|
-
k =
|
|
2460
|
-
E +=
|
|
2460
|
+
k = I.charCodeAt(S), k >= 48 && 57 >= k || k >= 97 && 102 >= k || k >= 65 && 70 >= k || q();
|
|
2461
|
+
E += V("0x" + I.slice(O, S));
|
|
2461
2462
|
break;
|
|
2462
2463
|
default:
|
|
2463
2464
|
q();
|
|
@@ -2465,34 +2466,34 @@ function Xe() {
|
|
|
2465
2466
|
else {
|
|
2466
2467
|
if (k == 34)
|
|
2467
2468
|
break;
|
|
2468
|
-
for (k =
|
|
2469
|
-
k =
|
|
2470
|
-
E +=
|
|
2469
|
+
for (k = I.charCodeAt(S), O = S; k >= 32 && k != 92 && k != 34; )
|
|
2470
|
+
k = I.charCodeAt(++S);
|
|
2471
|
+
E += I.slice(O, S);
|
|
2471
2472
|
}
|
|
2472
|
-
if (
|
|
2473
|
+
if (I.charCodeAt(S) == 34)
|
|
2473
2474
|
return S++, E;
|
|
2474
2475
|
q();
|
|
2475
2476
|
default:
|
|
2476
|
-
if (O = S, k == 45 && (D = !0, k =
|
|
2477
|
-
for (k == 48 && (k =
|
|
2477
|
+
if (O = S, k == 45 && (D = !0, k = I.charCodeAt(++S)), k >= 48 && 57 >= k) {
|
|
2478
|
+
for (k == 48 && (k = I.charCodeAt(S + 1), k >= 48 && 57 >= k) && q(), D = !1; B > S && (k = I.charCodeAt(S), k >= 48 && 57 >= k); S++)
|
|
2478
2479
|
;
|
|
2479
|
-
if (
|
|
2480
|
-
for (w = ++S; B > w && (k =
|
|
2480
|
+
if (I.charCodeAt(S) == 46) {
|
|
2481
|
+
for (w = ++S; B > w && (k = I.charCodeAt(w), k >= 48 && 57 >= k); w++)
|
|
2481
2482
|
;
|
|
2482
2483
|
w == S && q(), S = w;
|
|
2483
2484
|
}
|
|
2484
|
-
if (k =
|
|
2485
|
-
for (k =
|
|
2485
|
+
if (k = I.charCodeAt(S), k == 101 || k == 69) {
|
|
2486
|
+
for (k = I.charCodeAt(++S), (k == 43 || k == 45) && S++, w = S; B > w && (k = I.charCodeAt(w), k >= 48 && 57 >= k); w++)
|
|
2486
2487
|
;
|
|
2487
2488
|
w == S && q(), S = w;
|
|
2488
2489
|
}
|
|
2489
|
-
return +
|
|
2490
|
+
return +I.slice(O, S);
|
|
2490
2491
|
}
|
|
2491
|
-
if (D && q(),
|
|
2492
|
+
if (D && q(), I.slice(S, S + 4) == "true")
|
|
2492
2493
|
return S += 4, !0;
|
|
2493
|
-
if (
|
|
2494
|
+
if (I.slice(S, S + 5) == "false")
|
|
2494
2495
|
return S += 5, !1;
|
|
2495
|
-
if (
|
|
2496
|
+
if (I.slice(S, S + 4) == "null")
|
|
2496
2497
|
return S += 4, null;
|
|
2497
2498
|
q();
|
|
2498
2499
|
}
|
|
@@ -2525,14 +2526,14 @@ function Xe() {
|
|
|
2525
2526
|
for (D = k.length; D--; )
|
|
2526
2527
|
ke(k, D, w);
|
|
2527
2528
|
else
|
|
2528
|
-
f(k, function(
|
|
2529
|
-
ke(k,
|
|
2529
|
+
f(k, function(I) {
|
|
2530
|
+
ke(k, I, w);
|
|
2530
2531
|
});
|
|
2531
2532
|
return w.call(E, O, k);
|
|
2532
2533
|
};
|
|
2533
|
-
|
|
2534
|
+
u.parse = function(E, O) {
|
|
2534
2535
|
var w, D;
|
|
2535
|
-
return S = 0,
|
|
2536
|
+
return S = 0, K = "" + E, w = se(J()), J() != "$" && q(), S = K = null, O && d.call(O) == r ? Ce((D = {}, D[""] = w, D), "", O) : w;
|
|
2536
2537
|
};
|
|
2537
2538
|
}
|
|
2538
2539
|
}
|
|
@@ -2550,32 +2551,32 @@ function Xe() {
|
|
|
2550
2551
|
}, {}]
|
|
2551
2552
|
}, {}, [1])(1);
|
|
2552
2553
|
}
|
|
2553
|
-
const
|
|
2554
|
+
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2554
2555
|
__proto__: null,
|
|
2555
2556
|
default: Xe
|
|
2556
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2557
|
-
"./v1_3_7.js":
|
|
2557
|
+
}, Symbol.toStringTag, { value: "Module" })), Ve = /* @__PURE__ */ Object.assign({
|
|
2558
|
+
"./v1_3_7.js": Ke
|
|
2558
2559
|
}), $e = /v\d+_\d+_\d+/;
|
|
2559
2560
|
function Ge(a) {
|
|
2560
2561
|
return typeof a == "function";
|
|
2561
2562
|
}
|
|
2562
|
-
const Se = Object.entries(
|
|
2563
|
+
const Se = Object.entries(Ve).reduce(
|
|
2563
2564
|
(a, t) => {
|
|
2564
2565
|
var o;
|
|
2565
2566
|
const e = t[1].default, s = (o = t[0].match($e)) == null ? void 0 : o[0];
|
|
2566
2567
|
return Ge(e) && s && (a[s] = e()), a;
|
|
2567
2568
|
},
|
|
2568
2569
|
{}
|
|
2569
|
-
),
|
|
2570
|
+
), Le = (a) => {
|
|
2570
2571
|
if (a in Se)
|
|
2571
2572
|
return Se[a];
|
|
2572
2573
|
throw new Error(`Socket version ${a} not found`);
|
|
2573
|
-
}, ze = (a, ...t) =>
|
|
2574
|
+
}, ze = (a, ...t) => Le(a)(...t), Je = {
|
|
2574
2575
|
...Se,
|
|
2575
|
-
getSocketVersion:
|
|
2576
|
+
getSocketVersion: Le,
|
|
2576
2577
|
makeSocketVersion: ze
|
|
2577
2578
|
};
|
|
2578
|
-
var We = /* @__PURE__ */ ((a) => (a.RINGING = "Ringing", a.TALKING = "Talking", a.DIALING = "Dialing", a.HOLD = "Hold", a))(We || {}), He = /* @__PURE__ */ ((a) => (a.INCOMING = "Incoming", a.OUTGOING = "Outgoing", a))(He || {}), re = /* @__PURE__ */ ((a) => (a.CONNECTED = "connected", a.DISCONNECTED = "disconnected", a.TRYING_TO_CONNECT = "tryingToConnect", a))(re || {}), Ye = /* @__PURE__ */ ((a) => (a.AUTOMATIC = "Automatic", a.IVR = "IVR", a))(Ye || {}), Qe = /* @__PURE__ */ ((a) => (a.INCOMINC = "Incoming", a.OUTGOING = "Outgoing", a.SPY = "Spy", a.CLICK2CALL = "Click2Call", a))(Qe || {}), Ze = /* @__PURE__ */ ((a) => (a.RESPONSE_FROM_API_VALID = "RESPONSE_FROM_API_VALID", a.RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID", a))(Ze || {}), j = /* @__PURE__ */ ((a) => (a.ALL_DIALER_STATUS = "AllDialersStatus", a.ALL_EXTENSION_STATUS = "AllExtensionsStatus", a.ALL_USERS_STATUS = "AllUsersStatus", a.CONNECT = "connect", a.DISCONNECT = "disconnect", a.CONNECT_ERROR_EVENT = "connect_error", a.EXTENSION_EVENT = "ExtensionEvent", a.KEEP_ALIVE = "keepalive", a.KEEP_ALIVE_RESPONSE = "keepaliveResponse", a.LOGIN_STATUS = "loginStatus", a.LOGIN_SUCCESS = "loginSuccess", a.QUEUE_EVENT = "QueueEvent", a.ONLINE_STATUS_EVENT = "onlineStatusEvent", a.DIALER_EVENT = "DialerEvent", a.EXTENSIONS_UPDATED = "ExtensionsUpdated", a))(j || {}),
|
|
2579
|
+
var We = /* @__PURE__ */ ((a) => (a.RINGING = "Ringing", a.TALKING = "Talking", a.DIALING = "Dialing", a.HOLD = "Hold", a))(We || {}), He = /* @__PURE__ */ ((a) => (a.INCOMING = "Incoming", a.OUTGOING = "Outgoing", a))(He || {}), re = /* @__PURE__ */ ((a) => (a.CONNECTED = "connected", a.DISCONNECTED = "disconnected", a.TRYING_TO_CONNECT = "tryingToConnect", a))(re || {}), Ye = /* @__PURE__ */ ((a) => (a.AUTOMATIC = "Automatic", a.IVR = "IVR", a))(Ye || {}), Qe = /* @__PURE__ */ ((a) => (a.INCOMINC = "Incoming", a.OUTGOING = "Outgoing", a.SPY = "Spy", a.CLICK2CALL = "Click2Call", a))(Qe || {}), Ze = /* @__PURE__ */ ((a) => (a.RESPONSE_FROM_API_VALID = "RESPONSE_FROM_API_VALID", a.RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID", a))(Ze || {}), j = /* @__PURE__ */ ((a) => (a.ALL_DIALER_STATUS = "AllDialersStatus", a.ALL_EXTENSION_STATUS = "AllExtensionsStatus", a.ALL_USERS_STATUS = "AllUsersStatus", a.CONNECT = "connect", a.DISCONNECT = "disconnect", a.CONNECT_ERROR_EVENT = "connect_error", a.EXTENSION_EVENT = "ExtensionEvent", a.KEEP_ALIVE = "keepalive", a.KEEP_ALIVE_RESPONSE = "keepaliveResponse", a.LOGIN_STATUS = "loginStatus", a.LOGIN_SUCCESS = "loginSuccess", a.QUEUE_EVENT = "QueueEvent", a.ONLINE_STATUS_EVENT = "onlineStatusEvent", a.DIALER_EVENT = "DialerEvent", a.EXTENSIONS_UPDATED = "ExtensionsUpdated", a))(j || {}), Oe = /* @__PURE__ */ ((a) => (a.NEWCALL = "NEWCALL", a.ANSWER = "ANSWER", a.HOLD = "HOLD", a.UNHOLD = "UNHOLD", a.HANGUP = "HANGUP", a.USER_STATUS_UPDATE = "userStatusUpdate", a))(Oe || {}), et = /* @__PURE__ */ ((a) => (a.NORMAL_HANGUP = "Normal hangup", a.USER_BUSY = "User busy", a.CALL_REJECTED = "Call Rejected", a.UNALLOCATED_NUMBER = "Unallocated (unassigned) number", a.UNKNOWN = "Unknown", a.NO_USER_RESPONDING = "No user responding", a.USER_ALERTING = "User alerting, no answer", a.ANSWERED_ELSEWHERE = "Answered elsewhere", a))(et || {}), tt = /* @__PURE__ */ ((a) => (a.ANSWER = "ANSWER", a.ABANDONED = "ABANDONED", a.EXIT = "EXIT", a.JOIN = "JOIN", a))(tt || {});
|
|
2579
2580
|
class le {
|
|
2580
2581
|
static mapExtensionEvent(t) {
|
|
2581
2582
|
var f, l;
|
|
@@ -2583,7 +2584,7 @@ class le {
|
|
|
2583
2584
|
let s, o;
|
|
2584
2585
|
t.data.currentCall && (o = this.mapExtensionCall(t, t.data.currentCall));
|
|
2585
2586
|
const h = this.mapExtensionData(t, t.data);
|
|
2586
|
-
return e ===
|
|
2587
|
+
return e === Oe.HANGUP ? s = {
|
|
2587
2588
|
...t,
|
|
2588
2589
|
reason: e,
|
|
2589
2590
|
data: {
|
|
@@ -2736,51 +2737,85 @@ class le {
|
|
|
2736
2737
|
static configureUTCForObject(t, e, s, o) {
|
|
2737
2738
|
const h = (s - o * 60) * 1e3, f = Date.now() - h, l = {};
|
|
2738
2739
|
return e.forEach((d) => {
|
|
2739
|
-
const i = t[d.key],
|
|
2740
|
+
const i = t[d.key], u = d.key;
|
|
2740
2741
|
if (i !== 0 && typeof i == "number" && !isNaN(i)) {
|
|
2741
2742
|
let c = i;
|
|
2742
2743
|
d.format === "ms" && (c = Math.floor(c / 1e3));
|
|
2743
2744
|
const r = (c - o * 60) * 1e3;
|
|
2744
|
-
this.assignProperty(l, `${
|
|
2745
|
+
this.assignProperty(l, `${u}_UTC`, r), this.assignProperty(l, `${u}_UTC_CLIENT`, r + f);
|
|
2745
2746
|
} else
|
|
2746
|
-
this.assignProperty(l, `${
|
|
2747
|
+
this.assignProperty(l, `${u}_UTC`, 0), this.assignProperty(l, `${u}_UTC_CLIENT`, 0);
|
|
2747
2748
|
}), {
|
|
2748
2749
|
...t,
|
|
2749
2750
|
...l
|
|
2750
2751
|
};
|
|
2751
2752
|
}
|
|
2752
2753
|
}
|
|
2753
|
-
var
|
|
2754
|
+
var _e = /* @__PURE__ */ ((a) => (a.UPDATE_MONITORED_EXTENSIONS = "updateMonitoredExtensions", a.KEEP_ALIVE = "keepalive", a))(_e || {});
|
|
2754
2755
|
class nt {
|
|
2756
|
+
/**
|
|
2757
|
+
* Creates an instance of SocketIoClass and sets up network event listeners.
|
|
2758
|
+
*/
|
|
2755
2759
|
constructor(t) {
|
|
2760
|
+
/** The active Socket.IO connection instance */
|
|
2756
2761
|
X(this, "io");
|
|
2762
|
+
/** The Socket.IO function used to create connections based on version */
|
|
2757
2763
|
X(this, "ioFunction");
|
|
2764
|
+
/** Timestamp of the last received event, used for keep-alive calculations */
|
|
2758
2765
|
X(this, "lastEventTimestamp", (/* @__PURE__ */ new Date()).getTime());
|
|
2766
|
+
/** Flag indicating whether automatic reconnection should be attempted */
|
|
2759
2767
|
X(this, "doReconnect", !0);
|
|
2768
|
+
/** Current connection state */
|
|
2769
|
+
X(this, "connectionState", "disconnected");
|
|
2770
|
+
/** Keep-alive interval handle */
|
|
2760
2771
|
X(this, "keepAliveInterval");
|
|
2761
|
-
|
|
2762
|
-
X(this, "
|
|
2763
|
-
|
|
2764
|
-
X(this, "
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2772
|
+
/** Reconnection timeout handle */
|
|
2773
|
+
X(this, "reconnectTimeout");
|
|
2774
|
+
/** Network reconnect timeout handle (debounced) */
|
|
2775
|
+
X(this, "networkReconnectTimeout");
|
|
2776
|
+
/** Current reconnection delay in seconds */
|
|
2777
|
+
X(this, "reconnectionTime", Ne.reconnectionDelay);
|
|
2778
|
+
/** Maximum reconnection delay in seconds */
|
|
2779
|
+
X(this, "maxReconnectionDelay", 120);
|
|
2780
|
+
/** Network event cleanup functions */
|
|
2781
|
+
X(this, "networkCleanup", []);
|
|
2782
|
+
this.eventsSdkClass = t, this.reconnectionTime = t.options.reconnectionDelay, this.setupNetworkListeners();
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Sets up network event listeners
|
|
2786
|
+
*/
|
|
2787
|
+
setupNetworkListeners() {
|
|
2788
|
+
const t = () => this.closeAllConnections(), e = () => this.handleNetworkOnline();
|
|
2789
|
+
typeof window < "u" && (window.addEventListener("offline", t), window.addEventListener("online", e), this.networkCleanup.push(
|
|
2790
|
+
() => window.removeEventListener("offline", t),
|
|
2791
|
+
() => window.removeEventListener("online", e)
|
|
2792
|
+
)), typeof self < "u" && typeof window > "u" && typeof global > "u" && (self.addEventListener("offline", t), self.addEventListener("online", e), this.networkCleanup.push(
|
|
2793
|
+
() => self.removeEventListener("offline", t),
|
|
2794
|
+
() => self.removeEventListener("online", e)
|
|
2795
|
+
));
|
|
2778
2796
|
}
|
|
2797
|
+
/**
|
|
2798
|
+
* Handles network online with debouncing to prevent rapid reconnects
|
|
2799
|
+
*/
|
|
2800
|
+
handleNetworkOnline() {
|
|
2801
|
+
this.networkReconnectTimeout && clearTimeout(this.networkReconnectTimeout), this.networkReconnectTimeout = setTimeout(() => {
|
|
2802
|
+
this.connectionState === "disconnected" && this.doReconnect && this.eventsSdkClass.connect(ne.NEXT);
|
|
2803
|
+
}, 500);
|
|
2804
|
+
}
|
|
2805
|
+
/**
|
|
2806
|
+
* Determines and sets the appropriate Socket.IO function based on client version.
|
|
2807
|
+
*/
|
|
2779
2808
|
getSocketIoFunction(t) {
|
|
2780
2809
|
const e = t.split("v="), s = "v".concat(e[e.length - 1]).replaceAll(".", "_");
|
|
2781
2810
|
this.ioFunction = Je.getSocketVersion(s);
|
|
2782
2811
|
}
|
|
2812
|
+
/**
|
|
2813
|
+
* Initializes a new Socket.IO connection. Prevents multiple simultaneous connections.
|
|
2814
|
+
*/
|
|
2783
2815
|
initSocketConnection() {
|
|
2816
|
+
if (this.connectionState !== "disconnected")
|
|
2817
|
+
return;
|
|
2818
|
+
this.connectionState = "connecting";
|
|
2784
2819
|
const t = this.eventsSdkClass.authClass.token, e = this.eventsSdkClass.options.protocol, s = this.eventsSdkClass.server;
|
|
2785
2820
|
try {
|
|
2786
2821
|
const o = s ? s.Domain : this.eventsSdkClass.URL, h = s ? `${e}://${o}` : this.eventsSdkClass.URL, f = {
|
|
@@ -2788,13 +2823,11 @@ class nt {
|
|
|
2788
2823
|
upgrade: !1,
|
|
2789
2824
|
transports: ["websocket"],
|
|
2790
2825
|
forceNew: !0,
|
|
2791
|
-
query: {
|
|
2792
|
-
token: t
|
|
2793
|
-
},
|
|
2826
|
+
query: { token: t },
|
|
2794
2827
|
timeout: this.eventsSdkClass.options.timeout
|
|
2795
2828
|
};
|
|
2796
2829
|
if (this.ioFunction && h)
|
|
2797
|
-
this.io = this.ioFunction(h, f), this.eventsSdkClass.eventEmitterClass.emit(
|
|
2830
|
+
this.io = this.ioFunction(h, f), this.initSocketEvents(), this.eventsSdkClass.eventEmitterClass.emit(
|
|
2798
2831
|
j.ONLINE_STATUS_EVENT,
|
|
2799
2832
|
{
|
|
2800
2833
|
attemptToConnect: h,
|
|
@@ -2802,88 +2835,144 @@ class nt {
|
|
|
2802
2835
|
}
|
|
2803
2836
|
), this.eventsSdkClass.loggerClass.sdkAttemptToConnect(o);
|
|
2804
2837
|
else
|
|
2805
|
-
throw new Error("Socket server url
|
|
2838
|
+
throw new Error("Socket server url not defined");
|
|
2806
2839
|
} catch (o) {
|
|
2807
|
-
this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(o);
|
|
2840
|
+
this.connectionState = "disconnected", this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(o);
|
|
2808
2841
|
}
|
|
2809
2842
|
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Clears the keep-alive interval
|
|
2845
|
+
*/
|
|
2810
2846
|
clearKeepAliveInterval() {
|
|
2811
|
-
this.keepAliveInterval && clearInterval(this.keepAliveInterval);
|
|
2847
|
+
this.keepAliveInterval && (clearInterval(this.keepAliveInterval), this.keepAliveInterval = void 0);
|
|
2812
2848
|
}
|
|
2849
|
+
/**
|
|
2850
|
+
* Initializes the keep-alive mechanism
|
|
2851
|
+
*/
|
|
2813
2852
|
initKeepAlive() {
|
|
2814
|
-
this.
|
|
2815
|
-
|
|
2816
|
-
this.eventsSdkClass.emit(Oe.KEEP_ALIVE, this.eventsSdkClass.authClass.token), this.eventsSdkClass.loggerClass.keepAliveEmit();
|
|
2817
|
-
return;
|
|
2818
|
-
}
|
|
2853
|
+
this.clearKeepAliveInterval(), this.keepAliveInterval = setInterval(async () => {
|
|
2854
|
+
(/* @__PURE__ */ new Date()).getTime() > this.lastEventTimestamp + this.eventsSdkClass.options.keepAliveTimeout && this.io && this.connectionState === "connected" && this.eventsSdkClass.authClass.token && (this.eventsSdkClass.emit(_e.KEEP_ALIVE, this.eventsSdkClass.authClass.token), this.eventsSdkClass.loggerClass.keepAliveEmit());
|
|
2819
2855
|
}, this.eventsSdkClass.options.keepAliveTimeout);
|
|
2820
2856
|
}
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2857
|
+
/**
|
|
2858
|
+
* Closes all active connections and cleans up resources properly
|
|
2859
|
+
*/
|
|
2860
|
+
async closeAllConnections() {
|
|
2861
|
+
if (this.clearKeepAliveInterval(), this.reconnectTimeout && (clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0), this.networkReconnectTimeout && (clearTimeout(this.networkReconnectTimeout), this.networkReconnectTimeout = void 0), this.io) {
|
|
2862
|
+
const t = this.io;
|
|
2863
|
+
this.io = void 0;
|
|
2864
|
+
try {
|
|
2865
|
+
await Promise.race([
|
|
2866
|
+
new Promise((e) => {
|
|
2867
|
+
t.on("disconnect", () => e()), t.removeAllListeners(), t.close(), t.disconnect();
|
|
2868
|
+
}),
|
|
2869
|
+
new Promise((e) => setTimeout(e, 1e3))
|
|
2870
|
+
]);
|
|
2871
|
+
} catch {
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
this.connectionState = "disconnected", this.eventsSdkClass.loggerClass.stop(), ae.clearSessionStorage();
|
|
2824
2875
|
}
|
|
2876
|
+
/**
|
|
2877
|
+
* Sets up event listeners for all Socket.IO events
|
|
2878
|
+
*/
|
|
2825
2879
|
initSocketEvents() {
|
|
2826
|
-
this.io && this.io.on(j.LOGIN_SUCCESS, (t) => this.onLoginSuccessEvent(t, j.LOGIN_SUCCESS)).on(j.QUEUE_EVENT, (t) => this.onQueueEvent(t, j.QUEUE_EVENT)).on(j.EXTENSION_EVENT, (t) => this.onExtensionEvent(t, j.EXTENSION_EVENT)).on(j.DIALER_EVENT, (t) => this.onDialerEvent(t, j.DIALER_EVENT)).on(j.LOGIN_STATUS, (t) => this.onLoginStatusEvent(t, j.LOGIN_STATUS)).on(j.ALL_EXTENSION_STATUS, (t) => this.onAllExtensionStatus(t, j.ALL_EXTENSION_STATUS)).on(j.ALL_DIALER_STATUS, (t) => this.onAllDialerStatus(t, j.ALL_DIALER_STATUS)).on(j.KEEP_ALIVE_RESPONSE, (t) => this.onKeepAliveResponse(t)).on(j.EXTENSIONS_UPDATED, (t) => this.onExtensionsUpdatedEvent(t, j.EXTENSIONS_UPDATED)).on(j.CONNECT, () => this.onConnect()).on(j.DISCONNECT, (t) => this.onDisconnect(t)).on(j.CONNECT_ERROR_EVENT, (t) => this.onConnectError(t));
|
|
2880
|
+
this.io && (this.io.removeAllListeners(), this.io.on(j.LOGIN_SUCCESS, (t) => this.onLoginSuccessEvent(t, j.LOGIN_SUCCESS)).on(j.QUEUE_EVENT, (t) => this.onQueueEvent(t, j.QUEUE_EVENT)).on(j.EXTENSION_EVENT, (t) => this.onExtensionEvent(t, j.EXTENSION_EVENT)).on(j.DIALER_EVENT, (t) => this.onDialerEvent(t, j.DIALER_EVENT)).on(j.LOGIN_STATUS, (t) => this.onLoginStatusEvent(t, j.LOGIN_STATUS)).on(j.ALL_EXTENSION_STATUS, (t) => this.onAllExtensionStatus(t, j.ALL_EXTENSION_STATUS)).on(j.ALL_DIALER_STATUS, (t) => this.onAllDialerStatus(t, j.ALL_DIALER_STATUS)).on(j.KEEP_ALIVE_RESPONSE, (t) => this.onKeepAliveResponse(t)).on(j.EXTENSIONS_UPDATED, (t) => this.onExtensionsUpdatedEvent(t, j.EXTENSIONS_UPDATED)).on(j.CONNECT, () => this.onConnect()).on(j.DISCONNECT, (t) => this.onDisconnect(t)).on(j.CONNECT_ERROR_EVENT, (t) => this.onConnectError(t)));
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Updates timestamp on every event to prevent unnecessary keep-alives
|
|
2884
|
+
*/
|
|
2885
|
+
updateEventTimestamp() {
|
|
2886
|
+
this.lastEventTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
2827
2887
|
}
|
|
2888
|
+
// Event handlers - all update timestamp first
|
|
2828
2889
|
onLoginSuccessEvent(t, e) {
|
|
2829
|
-
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2890
|
+
this.updateEventTimestamp(), this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2830
2891
|
}
|
|
2831
2892
|
onQueueEvent(t, e) {
|
|
2832
|
-
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, le.mapQueueEvent(t));
|
|
2893
|
+
this.updateEventTimestamp(), this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, le.mapQueueEvent(t));
|
|
2833
2894
|
}
|
|
2834
2895
|
onExtensionEvent(t, e) {
|
|
2896
|
+
this.updateEventTimestamp();
|
|
2835
2897
|
const s = le.mapExtensionEvent(t);
|
|
2836
2898
|
s && (this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, s));
|
|
2837
2899
|
}
|
|
2838
2900
|
onDialerEvent(t, e) {
|
|
2839
|
-
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2901
|
+
this.updateEventTimestamp(), this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2840
2902
|
}
|
|
2841
2903
|
onLoginStatusEvent(t, e) {
|
|
2842
|
-
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, le.mapLoginStatusEvent(t));
|
|
2904
|
+
this.updateEventTimestamp(), this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, le.mapLoginStatusEvent(t));
|
|
2843
2905
|
}
|
|
2844
2906
|
onAllExtensionStatus(t, e) {
|
|
2907
|
+
this.updateEventTimestamp();
|
|
2845
2908
|
const s = le.mapAllExtensionStatus(t);
|
|
2846
2909
|
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, s);
|
|
2847
2910
|
}
|
|
2848
2911
|
onAllDialerStatus(t, e) {
|
|
2849
|
-
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2912
|
+
this.updateEventTimestamp(), this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2850
2913
|
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Handles keep-alive response - fixed to prevent multiple connections
|
|
2916
|
+
*/
|
|
2851
2917
|
onKeepAliveResponse(t) {
|
|
2852
|
-
if (this.eventsSdkClass.loggerClass.keepAliveResponse(t), t.errorCode) {
|
|
2853
|
-
this.
|
|
2918
|
+
if (this.updateEventTimestamp(), this.eventsSdkClass.loggerClass.keepAliveResponse(t), t.errorCode) {
|
|
2919
|
+
this.closeAllConnections().then(() => {
|
|
2920
|
+
this.doReconnect && this.connectionState === "disconnected" && this.scheduleReconnect();
|
|
2921
|
+
});
|
|
2854
2922
|
return;
|
|
2855
2923
|
}
|
|
2856
|
-
this.connected ? this.lastEventTimestamp = (/* @__PURE__ */ new Date()).getTime() : this.initSocketConnection();
|
|
2857
2924
|
}
|
|
2858
2925
|
onExtensionsUpdatedEvent(t, e) {
|
|
2859
|
-
this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2926
|
+
this.updateEventTimestamp(), this.eventsSdkClass.loggerClass.eventLog(e, t), this.eventsSdkClass.eventEmitterClass.emit(e, t);
|
|
2860
2927
|
}
|
|
2928
|
+
/**
|
|
2929
|
+
* Handles successful connection
|
|
2930
|
+
*/
|
|
2861
2931
|
onConnect() {
|
|
2862
|
-
this.connected =
|
|
2932
|
+
this.connectionState = "connected", this.reconnectionTime = this.eventsSdkClass.options.reconnectionDelay, this.reconnectTimeout && (clearTimeout(this.reconnectTimeout), this.reconnectTimeout = void 0), this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2863
2933
|
connectionStatus: re.CONNECTED
|
|
2864
2934
|
}), this.eventsSdkClass.loggerClass.start().then(() => {
|
|
2865
2935
|
this.eventsSdkClass.loggerClass.sdkConnectionSuccess();
|
|
2866
2936
|
});
|
|
2867
2937
|
}
|
|
2938
|
+
/**
|
|
2939
|
+
* Schedules reconnection with exponential backoff
|
|
2940
|
+
*/
|
|
2941
|
+
scheduleReconnect() {
|
|
2942
|
+
!this.doReconnect || this.reconnectTimeout || (this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2943
|
+
connectionStatus: re.TRYING_TO_CONNECT
|
|
2944
|
+
}), this.reconnectTimeout = setTimeout(() => {
|
|
2945
|
+
this.reconnectTimeout = void 0, this.reconnectionTime = Math.min(
|
|
2946
|
+
this.reconnectionTime * 2,
|
|
2947
|
+
this.maxReconnectionDelay
|
|
2948
|
+
), this.reconnectionTime > this.maxReconnectionDelay && (this.reconnectionTime = this.eventsSdkClass.options.reconnectionDelay), this.eventsSdkClass.connect(ne.NEXT);
|
|
2949
|
+
}, this.reconnectionTime * 1e3));
|
|
2950
|
+
}
|
|
2951
|
+
/**
|
|
2952
|
+
* Handles disconnection
|
|
2953
|
+
*/
|
|
2868
2954
|
onDisconnect(t) {
|
|
2869
|
-
this.
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
));
|
|
2955
|
+
if (this.connectionState = "disconnected", this.eventsSdkClass.loggerClass.sdkDisconnect([t]), !this.doReconnect) {
|
|
2956
|
+
this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2957
|
+
connectionStatus: re.DISCONNECTED
|
|
2958
|
+
});
|
|
2959
|
+
return;
|
|
2960
|
+
}
|
|
2961
|
+
this.closeAllConnections(), this.scheduleReconnect();
|
|
2877
2962
|
}
|
|
2963
|
+
/**
|
|
2964
|
+
* Handles connection errors
|
|
2965
|
+
*/
|
|
2878
2966
|
onConnectError(t) {
|
|
2879
|
-
this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2880
|
-
connectionStatus:
|
|
2881
|
-
})
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2967
|
+
this.connectionState = "disconnected", this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(t), this.doReconnect ? this.scheduleReconnect() : this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT, {
|
|
2968
|
+
connectionStatus: re.DISCONNECTED
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* Cleanup when shutting down
|
|
2973
|
+
*/
|
|
2974
|
+
async destroy() {
|
|
2975
|
+
this.doReconnect = !1, this.networkCleanup.forEach((t) => t()), await this.closeAllConnections();
|
|
2887
2976
|
}
|
|
2888
2977
|
}
|
|
2889
2978
|
class rt {
|
|
@@ -2902,7 +2991,7 @@ class rt {
|
|
|
2902
2991
|
this.eventsSdkClass.options.loggerSocketConnection && (t = this.eventsSdkClass.options.loggerSocketConnection), this.eventsSdkClass.socketIoClass.ioFunction && !t && (t = this.eventsSdkClass.socketIoClass.ioFunction(
|
|
2903
2992
|
this.eventsSdkClass.options.loggerServer,
|
|
2904
2993
|
this.eventsSdkClass.options.loggerConnectOptions
|
|
2905
|
-
)), t && (this.storageLogger = new
|
|
2994
|
+
)), t && (this.storageLogger = new Ue({
|
|
2906
2995
|
socket: t,
|
|
2907
2996
|
loggerOptions: this.eventsSdkClass.options.loggerConfig
|
|
2908
2997
|
}));
|
|
@@ -3037,13 +3126,13 @@ class rt {
|
|
|
3037
3126
|
}
|
|
3038
3127
|
eventLog(t, e) {
|
|
3039
3128
|
const s = {
|
|
3040
|
-
[
|
|
3041
|
-
[
|
|
3042
|
-
[
|
|
3043
|
-
[
|
|
3044
|
-
[
|
|
3129
|
+
[te.FULL]: [],
|
|
3130
|
+
[te.BOOTSTRAP]: [j.LOGIN_STATUS, j.LOGIN_SUCCESS, j.ALL_EXTENSION_STATUS, j.ALL_DIALER_STATUS],
|
|
3131
|
+
[te.DEBUG_EXTENSIONS]: [j.ALL_EXTENSION_STATUS, j.EXTENSION_EVENT, j.EXTENSIONS_UPDATED],
|
|
3132
|
+
[te.DEBUG_DIALER]: [j.ALL_DIALER_STATUS, j.DIALER_EVENT],
|
|
3133
|
+
[te.DEBUG_QUEUE]: [j.QUEUE_EVENT]
|
|
3045
3134
|
};
|
|
3046
|
-
this.eventsSdkClass.options.debugOption && (s[this.eventsSdkClass.options.debugOption].includes(t) || this.eventsSdkClass.options.debugOption ===
|
|
3135
|
+
this.eventsSdkClass.options.debugOption && (s[this.eventsSdkClass.options.debugOption].includes(t) || this.eventsSdkClass.options.debugOption === te.FULL) && this.log({
|
|
3047
3136
|
Message: `Event name: ${t}`,
|
|
3048
3137
|
Body: e,
|
|
3049
3138
|
ActionName: Y.WSCONNECT,
|
|
@@ -3108,8 +3197,8 @@ class ct {
|
|
|
3108
3197
|
X(this, "socket");
|
|
3109
3198
|
X(this, "mainServer");
|
|
3110
3199
|
X(this, "alreadyAttemptedOtherServers", []);
|
|
3111
|
-
X(this, "authClass", new
|
|
3112
|
-
X(this, "socketIoClass"
|
|
3200
|
+
X(this, "authClass", new qe(this));
|
|
3201
|
+
X(this, "socketIoClass");
|
|
3113
3202
|
X(this, "loggerClass", new rt(this));
|
|
3114
3203
|
X(this, "eventEmitterClass", new st(this));
|
|
3115
3204
|
X(this, "getCircularReplacer", () => {
|
|
@@ -3126,9 +3215,9 @@ class ct {
|
|
|
3126
3215
|
};
|
|
3127
3216
|
});
|
|
3128
3217
|
this.options = {
|
|
3129
|
-
...
|
|
3218
|
+
...Ne,
|
|
3130
3219
|
...t
|
|
3131
|
-
};
|
|
3220
|
+
}, this.socketIoClass = new nt(this);
|
|
3132
3221
|
}
|
|
3133
3222
|
on(t, e) {
|
|
3134
3223
|
this.eventEmitterClass.on(t, e);
|
|
@@ -3137,16 +3226,16 @@ class ct {
|
|
|
3137
3226
|
this.socketIoClass.io && this.socketIoClass.io.emit(t, ...e);
|
|
3138
3227
|
}
|
|
3139
3228
|
connect(t) {
|
|
3140
|
-
t ===
|
|
3229
|
+
t === ne.MAIN && this.findMainServer(), t === ne.NEXT && this.findNextServer(), this.socketIoClass.doReconnect = !0;
|
|
3141
3230
|
try {
|
|
3142
3231
|
this.loggerClass.init();
|
|
3143
3232
|
} catch (e) {
|
|
3144
3233
|
console.error(e);
|
|
3145
3234
|
}
|
|
3146
|
-
this.socketIoClass.initSocketConnection(), this.socketIoClass.
|
|
3235
|
+
this.socketIoClass.initSocketConnection(), this.socketIoClass.initKeepAlive();
|
|
3147
3236
|
}
|
|
3148
3237
|
async disconnect() {
|
|
3149
|
-
this.socketIoClass.doReconnect = !1, this.socketIoClass.closeAllConnections(), await this.loggerClass.stop();
|
|
3238
|
+
this.socketIoClass.doReconnect = !1, await this.socketIoClass.closeAllConnections(), await this.loggerClass.stop();
|
|
3150
3239
|
}
|
|
3151
3240
|
clearKeepAliveInterval() {
|
|
3152
3241
|
this.socketIoClass.clearKeepAliveInterval();
|
|
@@ -3188,17 +3277,17 @@ export {
|
|
|
3188
3277
|
We as CallStatusEnum,
|
|
3189
3278
|
He as CallTypeEnum,
|
|
3190
3279
|
re as ConnectionStatusEnum,
|
|
3191
|
-
|
|
3280
|
+
te as DebugOption,
|
|
3192
3281
|
Ye as DialerTypeEnum,
|
|
3193
3282
|
Qe as DirectionEnum,
|
|
3194
3283
|
Ze as DoNotCallMeStatusCodeEnum,
|
|
3195
3284
|
j as EventsEnum,
|
|
3196
|
-
|
|
3285
|
+
Oe as ExtensionEventReasonEnum,
|
|
3197
3286
|
et as ExtensionHangupCauseEnum,
|
|
3198
3287
|
Z as LoginType,
|
|
3199
3288
|
tt as QueueEventReasonEnum,
|
|
3200
|
-
|
|
3201
|
-
|
|
3289
|
+
_e as ServerListenerEventsEnum,
|
|
3290
|
+
ne as ServerParameter,
|
|
3202
3291
|
ct as default
|
|
3203
3292
|
};
|
|
3204
3293
|
//# sourceMappingURL=voicenter-events-sdk.es.js.map
|