@flowengage/react-chatbot 0.2.7 → 0.2.8
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.
|
@@ -24,13 +24,13 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
24
24
|
agentName: "flowengage.agentName",
|
|
25
25
|
agentHeadshot: "flowengage.agentHeadshot",
|
|
26
26
|
visitorEmail: "flowengage.visitorEmail"
|
|
27
|
-
},
|
|
28
|
-
if (!
|
|
27
|
+
}, ee = 1e4, te = 6e4, h = typeof window < "u", ne = () => {
|
|
28
|
+
if (!h) return "server-chat-id";
|
|
29
29
|
let e = window.sessionStorage.getItem(m.chatId);
|
|
30
30
|
if (e) return e;
|
|
31
31
|
let t = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
32
32
|
return window.sessionStorage.setItem(m.chatId, t), t;
|
|
33
|
-
},
|
|
33
|
+
}, re = () => h ? {
|
|
34
34
|
isOpen: !1,
|
|
35
35
|
activeScreen: window.sessionStorage.getItem(m.activeScreen) || "ai",
|
|
36
36
|
isHumanHandled: window.sessionStorage.getItem(m.isHumanHandled) === "true",
|
|
@@ -44,8 +44,8 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
44
44
|
agentName: null,
|
|
45
45
|
agentHeadshot: null,
|
|
46
46
|
visitorEmail: ""
|
|
47
|
-
},
|
|
48
|
-
|
|
47
|
+
}, ie = (e) => {
|
|
48
|
+
h && Object.entries(e).forEach(([e, t]) => {
|
|
49
49
|
let n = m[e];
|
|
50
50
|
if (n) {
|
|
51
51
|
if (t == null || t === !1) {
|
|
@@ -55,22 +55,22 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
55
55
|
window.sessionStorage.setItem(n, String(t));
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
},
|
|
59
|
-
if (!
|
|
58
|
+
}, ae = () => h && window.sessionStorage.getItem(m.visitorEmail) || "", oe = (e) => {
|
|
59
|
+
if (!h) return;
|
|
60
60
|
let t = typeof e == "string" ? e.trim() : "";
|
|
61
61
|
if (!t) {
|
|
62
62
|
window.sessionStorage.removeItem(m.visitorEmail);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
window.sessionStorage.setItem(m.visitorEmail, t);
|
|
66
|
-
},
|
|
66
|
+
}, se = async (e) => {
|
|
67
67
|
let t = await e.json().catch(() => ({}));
|
|
68
68
|
if (!e.ok) {
|
|
69
69
|
let n = Error(t.message || t.error || `Request failed with status ${e.status}`);
|
|
70
70
|
throw n.status = e.status, n;
|
|
71
71
|
}
|
|
72
72
|
return t;
|
|
73
|
-
},
|
|
73
|
+
}, g = async (e, t = {}) => {
|
|
74
74
|
try {
|
|
75
75
|
return await fetch(e, {
|
|
76
76
|
mode: "cors",
|
|
@@ -80,7 +80,7 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
80
80
|
let n = /* @__PURE__ */ Error(`Network error reaching ${e}. Check: (1) backend is running, (2) CORS allows this origin, (3) siteId is correct. Original: ${t.message}`);
|
|
81
81
|
throw n.status = 0, n.cause = t, n;
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, ce = async ({ apiBaseUrl: e, siteId: t }) => {
|
|
84
84
|
let n = typeof window < "u" ? window.location.origin : "http://localhost", r = `${e}/api/widget/bootstrap?${new URLSearchParams({
|
|
85
85
|
siteId: t,
|
|
86
86
|
origin: n
|
|
@@ -91,9 +91,9 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
91
91
|
origin: n,
|
|
92
92
|
url: r
|
|
93
93
|
});
|
|
94
|
-
let i = await
|
|
94
|
+
let i = await se(await g(r, { method: "GET" }));
|
|
95
95
|
return console.log("[FlowEngageAPI] bootstrap success", i), i.data;
|
|
96
|
-
},
|
|
96
|
+
}, le = ({ apiBaseUrl: e, userId: t, siteId: n }) => {
|
|
97
97
|
let r = (t, n) => {
|
|
98
98
|
let r = `${e}${t}`, i = JSON.stringify(n);
|
|
99
99
|
if (typeof navigator < "u" && navigator.sendBeacon) try {
|
|
@@ -107,7 +107,7 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
107
107
|
headers: { "Content-Type": "application/json" },
|
|
108
108
|
body: i
|
|
109
109
|
}).catch(() => {}), !0) : !1;
|
|
110
|
-
}, i = async (r, i = {}) =>
|
|
110
|
+
}, i = async (r, i = {}) => se(await g(`${e}${r}`, {
|
|
111
111
|
...i,
|
|
112
112
|
headers: {
|
|
113
113
|
"Content-Type": "application/json",
|
|
@@ -263,82 +263,82 @@ var d = Object.defineProperty, f = (e, t) => {
|
|
|
263
263
|
return navigator.sendBeacon(`${e}/api/ai/voice/sync`, i);
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
|
-
},
|
|
267
|
-
|
|
266
|
+
}, _ = Object.create(null);
|
|
267
|
+
_.open = "0", _.close = "1", _.ping = "2", _.pong = "3", _.message = "4", _.upgrade = "5", _.noop = "6";
|
|
268
268
|
var ue = Object.create(null);
|
|
269
|
-
Object.keys(
|
|
270
|
-
ue[
|
|
269
|
+
Object.keys(_).forEach((e) => {
|
|
270
|
+
ue[_[e]] = e;
|
|
271
271
|
});
|
|
272
|
-
var
|
|
272
|
+
var v = {
|
|
273
273
|
type: "error",
|
|
274
274
|
data: "parser error"
|
|
275
|
-
},
|
|
275
|
+
}, y = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", de = typeof ArrayBuffer == "function", fe = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e && e.buffer instanceof ArrayBuffer, pe = ({ type: e, data: t }, n, r) => y && t instanceof Blob ? n ? r(t) : me(t, r) : de && (t instanceof ArrayBuffer || fe(t)) ? n ? r(t) : me(new Blob([t]), r) : r(_[e] + (t || "")), me = (e, t) => {
|
|
276
276
|
let n = new FileReader();
|
|
277
277
|
return n.onload = function() {
|
|
278
278
|
let e = n.result.split(",")[1];
|
|
279
279
|
t("b" + (e || ""));
|
|
280
280
|
}, n.readAsDataURL(e);
|
|
281
281
|
};
|
|
282
|
-
function
|
|
282
|
+
function he(e) {
|
|
283
283
|
return e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
284
284
|
}
|
|
285
|
-
var
|
|
286
|
-
function
|
|
287
|
-
if (
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
var ge;
|
|
286
|
+
function _e(e, t) {
|
|
287
|
+
if (y && e.data instanceof Blob) return e.data.arrayBuffer().then(he).then(t);
|
|
288
|
+
if (de && (e.data instanceof ArrayBuffer || fe(e.data))) return t(he(e.data));
|
|
289
|
+
pe(e, !1, (e) => {
|
|
290
|
+
ge ||= new TextEncoder(), t(ge.encode(e));
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
//#endregion
|
|
294
294
|
//#region node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js
|
|
295
|
-
var
|
|
296
|
-
for (let e = 0; e < 64; e++)
|
|
297
|
-
var
|
|
295
|
+
var ve = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ye = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
296
|
+
for (let e = 0; e < 64; e++) ye[ve.charCodeAt(e)] = e;
|
|
297
|
+
var be = (e) => {
|
|
298
298
|
let t = e.length * .75, n = e.length, r, i = 0, a, o, s, c;
|
|
299
299
|
e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
|
|
300
300
|
let l = new ArrayBuffer(t), u = new Uint8Array(l);
|
|
301
|
-
for (r = 0; r < n; r += 4) a =
|
|
301
|
+
for (r = 0; r < n; r += 4) a = ye[e.charCodeAt(r)], o = ye[e.charCodeAt(r + 1)], s = ye[e.charCodeAt(r + 2)], c = ye[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63;
|
|
302
302
|
return l;
|
|
303
|
-
},
|
|
303
|
+
}, xe = typeof ArrayBuffer == "function", Se = (e, t) => {
|
|
304
304
|
if (typeof e != "string") return {
|
|
305
305
|
type: "message",
|
|
306
|
-
data:
|
|
306
|
+
data: we(e, t)
|
|
307
307
|
};
|
|
308
308
|
let n = e.charAt(0);
|
|
309
309
|
return n === "b" ? {
|
|
310
310
|
type: "message",
|
|
311
|
-
data:
|
|
311
|
+
data: Ce(e.substring(1), t)
|
|
312
312
|
} : ue[n] ? e.length > 1 ? {
|
|
313
313
|
type: ue[n],
|
|
314
314
|
data: e.substring(1)
|
|
315
|
-
} : { type: ue[n] } :
|
|
316
|
-
},
|
|
315
|
+
} : { type: ue[n] } : v;
|
|
316
|
+
}, Ce = (e, t) => xe ? we(be(e), t) : {
|
|
317
317
|
base64: !0,
|
|
318
318
|
data: e
|
|
319
|
-
},
|
|
319
|
+
}, we = (e, t) => {
|
|
320
320
|
switch (t) {
|
|
321
321
|
case "blob": return e instanceof Blob ? e : new Blob([e]);
|
|
322
322
|
default: return e instanceof ArrayBuffer ? e : e.buffer;
|
|
323
323
|
}
|
|
324
|
-
},
|
|
324
|
+
}, Te = "", Ee = (e, t) => {
|
|
325
325
|
let n = e.length, r = Array(n), i = 0;
|
|
326
326
|
e.forEach((e, a) => {
|
|
327
|
-
|
|
328
|
-
r[a] = e, ++i === n && t(r.join(
|
|
327
|
+
pe(e, !1, (e) => {
|
|
328
|
+
r[a] = e, ++i === n && t(r.join(Te));
|
|
329
329
|
});
|
|
330
330
|
});
|
|
331
|
-
},
|
|
332
|
-
let n = e.split(
|
|
331
|
+
}, De = (e, t) => {
|
|
332
|
+
let n = e.split(Te), r = [];
|
|
333
333
|
for (let e = 0; e < n.length; e++) {
|
|
334
|
-
let i =
|
|
334
|
+
let i = Se(n[e], t);
|
|
335
335
|
if (r.push(i), i.type === "error") break;
|
|
336
336
|
}
|
|
337
337
|
return r;
|
|
338
338
|
};
|
|
339
|
-
function
|
|
339
|
+
function Oe() {
|
|
340
340
|
return new TransformStream({ transform(e, t) {
|
|
341
|
-
|
|
341
|
+
_e(e, (n) => {
|
|
342
342
|
let r = n.length, i;
|
|
343
343
|
if (r < 126) i = new Uint8Array(1), new DataView(i.buffer).setUint8(0, r);
|
|
344
344
|
else if (r < 65536) {
|
|
@@ -354,44 +354,44 @@ function ke() {
|
|
|
354
354
|
});
|
|
355
355
|
} });
|
|
356
356
|
}
|
|
357
|
-
var
|
|
358
|
-
function
|
|
357
|
+
var ke;
|
|
358
|
+
function Ae(e) {
|
|
359
359
|
return e.reduce((e, t) => e + t.length, 0);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function je(e, t) {
|
|
362
362
|
if (e[0].length === t) return e.shift();
|
|
363
363
|
let n = new Uint8Array(t), r = 0;
|
|
364
364
|
for (let i = 0; i < t; i++) n[i] = e[0][r++], r === e[0].length && (e.shift(), r = 0);
|
|
365
365
|
return e.length && r < e[0].length && (e[0] = e[0].slice(r)), n;
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
|
|
367
|
+
function Me(e, t) {
|
|
368
|
+
ke ||= new TextDecoder();
|
|
369
369
|
let n = [], r = 0, i = -1, a = !1;
|
|
370
370
|
return new TransformStream({ transform(o, s) {
|
|
371
371
|
for (n.push(o);;) {
|
|
372
372
|
if (r === 0) {
|
|
373
|
-
if (
|
|
374
|
-
let e =
|
|
373
|
+
if (Ae(n) < 1) break;
|
|
374
|
+
let e = je(n, 1);
|
|
375
375
|
a = (e[0] & 128) == 128, i = e[0] & 127, r = i < 126 ? 3 : i === 126 ? 1 : 2;
|
|
376
376
|
} else if (r === 1) {
|
|
377
|
-
if (
|
|
378
|
-
let e =
|
|
377
|
+
if (Ae(n) < 2) break;
|
|
378
|
+
let e = je(n, 2);
|
|
379
379
|
i = new DataView(e.buffer, e.byteOffset, e.length).getUint16(0), r = 3;
|
|
380
380
|
} else if (r === 2) {
|
|
381
|
-
if (
|
|
382
|
-
let e =
|
|
381
|
+
if (Ae(n) < 8) break;
|
|
382
|
+
let e = je(n, 8), t = new DataView(e.buffer, e.byteOffset, e.length), a = t.getUint32(0);
|
|
383
383
|
if (a > 2 ** 21 - 1) {
|
|
384
|
-
s.enqueue(
|
|
384
|
+
s.enqueue(v);
|
|
385
385
|
break;
|
|
386
386
|
}
|
|
387
387
|
i = a * 2 ** 32 + t.getUint32(4), r = 3;
|
|
388
388
|
} else {
|
|
389
|
-
if (
|
|
390
|
-
let e =
|
|
391
|
-
s.enqueue(
|
|
389
|
+
if (Ae(n) < i) break;
|
|
390
|
+
let e = je(n, i);
|
|
391
|
+
s.enqueue(Se(a ? e : ke.decode(e), t)), r = 0;
|
|
392
392
|
}
|
|
393
393
|
if (i === 0 || i > e) {
|
|
394
|
-
s.enqueue(
|
|
394
|
+
s.enqueue(v);
|
|
395
395
|
break;
|
|
396
396
|
}
|
|
397
397
|
}
|
|
@@ -399,21 +399,21 @@ function Ne(e, t) {
|
|
|
399
399
|
}
|
|
400
400
|
//#endregion
|
|
401
401
|
//#region node_modules/@socket.io/component-emitter/lib/esm/index.js
|
|
402
|
-
function
|
|
403
|
-
if (e) return
|
|
402
|
+
function b(e) {
|
|
403
|
+
if (e) return Ne(e);
|
|
404
404
|
}
|
|
405
|
-
function
|
|
406
|
-
for (var t in
|
|
405
|
+
function Ne(e) {
|
|
406
|
+
for (var t in b.prototype) e[t] = b.prototype[t];
|
|
407
407
|
return e;
|
|
408
408
|
}
|
|
409
|
-
|
|
409
|
+
b.prototype.on = b.prototype.addEventListener = function(e, t) {
|
|
410
410
|
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + e] = this._callbacks["$" + e] || []).push(t), this;
|
|
411
|
-
},
|
|
411
|
+
}, b.prototype.once = function(e, t) {
|
|
412
412
|
function n() {
|
|
413
413
|
this.off(e, n), t.apply(this, arguments);
|
|
414
414
|
}
|
|
415
415
|
return n.fn = t, this.on(e, n), this;
|
|
416
|
-
},
|
|
416
|
+
}, b.prototype.off = b.prototype.removeListener = b.prototype.removeAllListeners = b.prototype.removeEventListener = function(e, t) {
|
|
417
417
|
if (this._callbacks = this._callbacks || {}, arguments.length == 0) return this._callbacks = {}, this;
|
|
418
418
|
var n = this._callbacks["$" + e];
|
|
419
419
|
if (!n) return this;
|
|
@@ -423,7 +423,7 @@ y.prototype.on = y.prototype.addEventListener = function(e, t) {
|
|
|
423
423
|
break;
|
|
424
424
|
}
|
|
425
425
|
return n.length === 0 && delete this._callbacks["$" + e], this;
|
|
426
|
-
},
|
|
426
|
+
}, b.prototype.emit = function(e) {
|
|
427
427
|
this._callbacks = this._callbacks || {};
|
|
428
428
|
for (var t = Array(arguments.length - 1), n = this._callbacks["$" + e], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
|
|
429
429
|
if (n) {
|
|
@@ -431,43 +431,43 @@ y.prototype.on = y.prototype.addEventListener = function(e, t) {
|
|
|
431
431
|
for (var r = 0, i = n.length; r < i; ++r) n[r].apply(this, t);
|
|
432
432
|
}
|
|
433
433
|
return this;
|
|
434
|
-
},
|
|
434
|
+
}, b.prototype.emitReserved = b.prototype.emit, b.prototype.listeners = function(e) {
|
|
435
435
|
return this._callbacks = this._callbacks || {}, this._callbacks["$" + e] || [];
|
|
436
|
-
},
|
|
436
|
+
}, b.prototype.hasListeners = function(e) {
|
|
437
437
|
return !!this.listeners(e).length;
|
|
438
438
|
};
|
|
439
439
|
//#endregion
|
|
440
440
|
//#region node_modules/engine.io-client/build/esm/globals.js
|
|
441
|
-
var
|
|
441
|
+
var Pe = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), Fe = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ie = "arraybuffer";
|
|
442
442
|
//#endregion
|
|
443
443
|
//#region node_modules/engine.io-client/build/esm/util.js
|
|
444
|
-
function
|
|
444
|
+
function x(e, ...t) {
|
|
445
445
|
return t.reduce((t, n) => (e.hasOwnProperty(n) && (t[n] = e[n]), t), {});
|
|
446
446
|
}
|
|
447
|
-
var
|
|
448
|
-
function
|
|
449
|
-
t.useNativeTimers ? (e.setTimeoutFn =
|
|
447
|
+
var Le = Fe.setTimeout, Re = Fe.clearTimeout;
|
|
448
|
+
function ze(e, t) {
|
|
449
|
+
t.useNativeTimers ? (e.setTimeoutFn = Le.bind(Fe), e.clearTimeoutFn = Re.bind(Fe)) : (e.setTimeoutFn = Fe.setTimeout.bind(Fe), e.clearTimeoutFn = Fe.clearTimeout.bind(Fe));
|
|
450
450
|
}
|
|
451
|
-
var
|
|
452
|
-
function
|
|
453
|
-
return typeof e == "string" ?
|
|
451
|
+
var Be = 1.33;
|
|
452
|
+
function Ve(e) {
|
|
453
|
+
return typeof e == "string" ? He(e) : Math.ceil((e.byteLength || e.size) * Be);
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function He(e) {
|
|
456
456
|
let t = 0, n = 0;
|
|
457
457
|
for (let r = 0, i = e.length; r < i; r++) t = e.charCodeAt(r), t < 128 ? n += 1 : t < 2048 ? n += 2 : t < 55296 || t >= 57344 ? n += 3 : (r++, n += 4);
|
|
458
458
|
return n;
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function Ue() {
|
|
461
461
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
462
462
|
}
|
|
463
463
|
//#endregion
|
|
464
464
|
//#region node_modules/engine.io-client/build/esm/contrib/parseqs.js
|
|
465
|
-
function
|
|
465
|
+
function We(e) {
|
|
466
466
|
let t = "";
|
|
467
467
|
for (let n in e) e.hasOwnProperty(n) && (t.length && (t += "&"), t += encodeURIComponent(n) + "=" + encodeURIComponent(e[n]));
|
|
468
468
|
return t;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function Ge(e) {
|
|
471
471
|
let t = {}, n = e.split("&");
|
|
472
472
|
for (let e = 0, r = n.length; e < r; e++) {
|
|
473
473
|
let r = n[e].split("=");
|
|
@@ -477,16 +477,16 @@ function Ke(e) {
|
|
|
477
477
|
}
|
|
478
478
|
//#endregion
|
|
479
479
|
//#region node_modules/engine.io-client/build/esm/transport.js
|
|
480
|
-
var
|
|
480
|
+
var Ke = class extends Error {
|
|
481
481
|
constructor(e, t, n) {
|
|
482
482
|
super(e), this.description = t, this.context = n, this.type = "TransportError";
|
|
483
483
|
}
|
|
484
|
-
},
|
|
484
|
+
}, qe = class extends b {
|
|
485
485
|
constructor(e) {
|
|
486
|
-
super(), this.writable = !1,
|
|
486
|
+
super(), this.writable = !1, ze(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
487
487
|
}
|
|
488
488
|
onError(e, t, n) {
|
|
489
|
-
return super.emitReserved("error", new
|
|
489
|
+
return super.emitReserved("error", new Ke(e, t, n)), this;
|
|
490
490
|
}
|
|
491
491
|
open() {
|
|
492
492
|
return this.readyState = "opening", this.doOpen(), this;
|
|
@@ -501,7 +501,7 @@ var qe = class extends Error {
|
|
|
501
501
|
this.readyState = "open", this.writable = !0, super.emitReserved("open");
|
|
502
502
|
}
|
|
503
503
|
onData(e) {
|
|
504
|
-
let t =
|
|
504
|
+
let t = Se(e, this.socket.binaryType);
|
|
505
505
|
this.onPacket(t);
|
|
506
506
|
}
|
|
507
507
|
onPacket(e) {
|
|
@@ -522,10 +522,10 @@ var qe = class extends Error {
|
|
|
522
522
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
523
523
|
}
|
|
524
524
|
_query(e) {
|
|
525
|
-
let t =
|
|
525
|
+
let t = We(e);
|
|
526
526
|
return t.length ? "?" + t : "";
|
|
527
527
|
}
|
|
528
|
-
},
|
|
528
|
+
}, S = class extends qe {
|
|
529
529
|
constructor() {
|
|
530
530
|
super(...arguments), this._polling = !1;
|
|
531
531
|
}
|
|
@@ -553,7 +553,7 @@ var qe = class extends Error {
|
|
|
553
553
|
this._polling = !0, this.doPoll(), this.emitReserved("poll");
|
|
554
554
|
}
|
|
555
555
|
onData(e) {
|
|
556
|
-
|
|
556
|
+
De(e, this.socket.binaryType).forEach((e) => {
|
|
557
557
|
if (this.readyState === "opening" && e.type === "open" && this.onOpen(), e.type === "close") return this.onClose({ description: "transport closed by the server" }), !1;
|
|
558
558
|
this.onPacket(e);
|
|
559
559
|
}), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
@@ -565,7 +565,7 @@ var qe = class extends Error {
|
|
|
565
565
|
this.readyState === "open" ? e() : this.once("open", e);
|
|
566
566
|
}
|
|
567
567
|
write(e) {
|
|
568
|
-
this.writable = !1,
|
|
568
|
+
this.writable = !1, Ee(e, (e) => {
|
|
569
569
|
this.doWrite(e, () => {
|
|
570
570
|
this.writable = !0, this.emitReserved("drain");
|
|
571
571
|
});
|
|
@@ -573,17 +573,17 @@ var qe = class extends Error {
|
|
|
573
573
|
}
|
|
574
574
|
uri() {
|
|
575
575
|
let e = this.opts.secure ? "https" : "http", t = this.query || {};
|
|
576
|
-
return !1 !== this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
576
|
+
return !1 !== this.opts.timestampRequests && (t[this.opts.timestampParam] = Ue()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
|
|
577
577
|
}
|
|
578
|
-
},
|
|
578
|
+
}, C = !1;
|
|
579
579
|
try {
|
|
580
|
-
|
|
580
|
+
C = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
581
581
|
} catch {}
|
|
582
|
-
var
|
|
582
|
+
var w = C;
|
|
583
583
|
//#endregion
|
|
584
584
|
//#region node_modules/engine.io-client/build/esm/transports/polling-xhr.js
|
|
585
|
-
function
|
|
586
|
-
var
|
|
585
|
+
function Je() {}
|
|
586
|
+
var Ye = class extends S {
|
|
587
587
|
constructor(e) {
|
|
588
588
|
if (super(e), typeof location < "u") {
|
|
589
589
|
let t = location.protocol === "https:", n = location.port;
|
|
@@ -605,13 +605,13 @@ var Xe = class extends x {
|
|
|
605
605
|
this.onError("xhr poll error", e, t);
|
|
606
606
|
}), this.pollXhr = e;
|
|
607
607
|
}
|
|
608
|
-
},
|
|
608
|
+
}, Xe = class e extends b {
|
|
609
609
|
constructor(e, t, n) {
|
|
610
|
-
super(), this.createRequest = e,
|
|
610
|
+
super(), this.createRequest = e, ze(this, n), this._opts = n, this._method = n.method || "GET", this._uri = t, this._data = n.data === void 0 ? null : n.data, this._create();
|
|
611
611
|
}
|
|
612
612
|
_create() {
|
|
613
613
|
var t;
|
|
614
|
-
let n =
|
|
614
|
+
let n = x(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
615
615
|
n.xdomain = !!this._opts.xd;
|
|
616
616
|
let r = this._xhr = this.createRequest(n);
|
|
617
617
|
try {
|
|
@@ -647,7 +647,7 @@ var Xe = class extends x {
|
|
|
647
647
|
}
|
|
648
648
|
_cleanup(t) {
|
|
649
649
|
if (!(this._xhr === void 0 || this._xhr === null)) {
|
|
650
|
-
if (this._xhr.onreadystatechange =
|
|
650
|
+
if (this._xhr.onreadystatechange = Je, t) try {
|
|
651
651
|
this._xhr.abort();
|
|
652
652
|
} catch {}
|
|
653
653
|
typeof document < "u" && delete e.requests[this._index], this._xhr = null;
|
|
@@ -661,46 +661,46 @@ var Xe = class extends x {
|
|
|
661
661
|
this._cleanup();
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
|
-
if (
|
|
665
|
-
if (typeof attachEvent == "function") attachEvent("onunload",
|
|
664
|
+
if (Xe.requestsCount = 0, Xe.requests = {}, typeof document < "u") {
|
|
665
|
+
if (typeof attachEvent == "function") attachEvent("onunload", Ze);
|
|
666
666
|
else if (typeof addEventListener == "function") {
|
|
667
|
-
let e = "onpagehide" in
|
|
668
|
-
addEventListener(e,
|
|
667
|
+
let e = "onpagehide" in Fe ? "pagehide" : "unload";
|
|
668
|
+
addEventListener(e, Ze, !1);
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
function
|
|
672
|
-
for (let e in
|
|
671
|
+
function Ze() {
|
|
672
|
+
for (let e in Xe.requests) Xe.requests.hasOwnProperty(e) && Xe.requests[e].abort();
|
|
673
673
|
}
|
|
674
|
-
var
|
|
675
|
-
let e =
|
|
674
|
+
var Qe = (function() {
|
|
675
|
+
let e = et({ xdomain: !1 });
|
|
676
676
|
return e && e.responseType !== null;
|
|
677
|
-
})(),
|
|
677
|
+
})(), $e = class extends Ye {
|
|
678
678
|
constructor(e) {
|
|
679
679
|
super(e);
|
|
680
680
|
let t = e && e.forceBase64;
|
|
681
|
-
this.supportsBinary =
|
|
681
|
+
this.supportsBinary = Qe && !t;
|
|
682
682
|
}
|
|
683
683
|
request(e = {}) {
|
|
684
|
-
return Object.assign(e, { xd: this.xd }, this.opts), new
|
|
684
|
+
return Object.assign(e, { xd: this.xd }, this.opts), new Xe(et, this.uri(), e);
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
|
-
function
|
|
687
|
+
function et(e) {
|
|
688
688
|
let t = e.xdomain;
|
|
689
689
|
try {
|
|
690
|
-
if (typeof XMLHttpRequest < "u" && (!t ||
|
|
690
|
+
if (typeof XMLHttpRequest < "u" && (!t || w)) return new XMLHttpRequest();
|
|
691
691
|
} catch {}
|
|
692
692
|
if (!t) try {
|
|
693
|
-
return new
|
|
693
|
+
return new Fe[["Active", "Object"].join("X")]("Microsoft.XMLHTTP");
|
|
694
694
|
} catch {}
|
|
695
695
|
}
|
|
696
696
|
//#endregion
|
|
697
697
|
//#region node_modules/engine.io-client/build/esm/transports/websocket.js
|
|
698
|
-
var
|
|
698
|
+
var tt = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative", nt = class extends qe {
|
|
699
699
|
get name() {
|
|
700
700
|
return "websocket";
|
|
701
701
|
}
|
|
702
702
|
doOpen() {
|
|
703
|
-
let e = this.uri(), t = this.opts.protocols, n =
|
|
703
|
+
let e = this.uri(), t = this.opts.protocols, n = tt ? {} : x(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
704
704
|
this.opts.extraHeaders && (n.headers = this.opts.extraHeaders);
|
|
705
705
|
try {
|
|
706
706
|
this.ws = this.createSocket(e, t, n);
|
|
@@ -721,11 +721,11 @@ var nt = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
721
721
|
this.writable = !1;
|
|
722
722
|
for (let t = 0; t < e.length; t++) {
|
|
723
723
|
let n = e[t], r = t === e.length - 1;
|
|
724
|
-
|
|
724
|
+
pe(n, this.supportsBinary, (e) => {
|
|
725
725
|
try {
|
|
726
726
|
this.doWrite(n, e);
|
|
727
727
|
} catch {}
|
|
728
|
-
r &&
|
|
728
|
+
r && Pe(() => {
|
|
729
729
|
this.writable = !0, this.emitReserved("drain");
|
|
730
730
|
}, this.setTimeoutFn);
|
|
731
731
|
});
|
|
@@ -736,18 +736,18 @@ var nt = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
736
736
|
}
|
|
737
737
|
uri() {
|
|
738
738
|
let e = this.opts.secure ? "wss" : "ws", t = this.query || {};
|
|
739
|
-
return this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
739
|
+
return this.opts.timestampRequests && (t[this.opts.timestampParam] = Ue()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
740
740
|
}
|
|
741
|
-
},
|
|
742
|
-
websocket: class extends
|
|
741
|
+
}, rt = Fe.WebSocket || Fe.MozWebSocket, it = {
|
|
742
|
+
websocket: class extends nt {
|
|
743
743
|
createSocket(e, t, n) {
|
|
744
|
-
return
|
|
744
|
+
return tt ? new rt(e, t, n) : t ? new rt(e, t) : new rt(e);
|
|
745
745
|
}
|
|
746
746
|
doWrite(e, t) {
|
|
747
747
|
this.ws.send(t);
|
|
748
748
|
}
|
|
749
749
|
},
|
|
750
|
-
webtransport: class extends
|
|
750
|
+
webtransport: class extends qe {
|
|
751
751
|
get name() {
|
|
752
752
|
return "webtransport";
|
|
753
753
|
}
|
|
@@ -763,7 +763,7 @@ var nt = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
763
763
|
this.onError("webtransport error", e);
|
|
764
764
|
}), this._transport.ready.then(() => {
|
|
765
765
|
this._transport.createBidirectionalStream().then((e) => {
|
|
766
|
-
let t =
|
|
766
|
+
let t = Me(2 ** 53 - 1, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), r = Oe();
|
|
767
767
|
r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
|
|
768
768
|
let i = () => {
|
|
769
769
|
n.read().then(({ done: e, value: t }) => {
|
|
@@ -781,7 +781,7 @@ var nt = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
781
781
|
for (let t = 0; t < e.length; t++) {
|
|
782
782
|
let n = e[t], r = t === e.length - 1;
|
|
783
783
|
this._writer.write(n).then(() => {
|
|
784
|
-
r &&
|
|
784
|
+
r && Pe(() => {
|
|
785
785
|
this.writable = !0, this.emitReserved("drain");
|
|
786
786
|
}, this.setTimeoutFn);
|
|
787
787
|
});
|
|
@@ -792,8 +792,8 @@ var nt = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
792
792
|
(e = this._transport) == null || e.close();
|
|
793
793
|
}
|
|
794
794
|
},
|
|
795
|
-
polling:
|
|
796
|
-
},
|
|
795
|
+
polling: $e
|
|
796
|
+
}, at = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, ot = [
|
|
797
797
|
"source",
|
|
798
798
|
"protocol",
|
|
799
799
|
"authority",
|
|
@@ -809,19 +809,19 @@ var nt = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
809
809
|
"query",
|
|
810
810
|
"anchor"
|
|
811
811
|
];
|
|
812
|
-
function
|
|
812
|
+
function st(e) {
|
|
813
813
|
if (e.length > 8e3) throw "URI too long";
|
|
814
814
|
let t = e, n = e.indexOf("["), r = e.indexOf("]");
|
|
815
815
|
n != -1 && r != -1 && (e = e.substring(0, n) + e.substring(n, r).replace(/:/g, ";") + e.substring(r, e.length));
|
|
816
|
-
let i =
|
|
817
|
-
for (; o--;) a[
|
|
818
|
-
return n != -1 && r != -1 && (a.source = t, a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ":"), a.authority = a.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), a.ipv6uri = !0), a.pathNames =
|
|
816
|
+
let i = at.exec(e || ""), a = {}, o = 14;
|
|
817
|
+
for (; o--;) a[ot[o]] = i[o] || "";
|
|
818
|
+
return n != -1 && r != -1 && (a.source = t, a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ":"), a.authority = a.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), a.ipv6uri = !0), a.pathNames = ct(a, a.path), a.queryKey = lt(a, a.query), a;
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function ct(e, t) {
|
|
821
821
|
let n = t.replace(/\/{2,9}/g, "/").split("/");
|
|
822
822
|
return (t.slice(0, 1) == "/" || t.length === 0) && n.splice(0, 1), t.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
|
|
823
823
|
}
|
|
824
|
-
function
|
|
824
|
+
function lt(e, t) {
|
|
825
825
|
let n = {};
|
|
826
826
|
return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(e, t, r) {
|
|
827
827
|
t && (n[t] = r);
|
|
@@ -829,17 +829,17 @@ function ut(e, t) {
|
|
|
829
829
|
}
|
|
830
830
|
//#endregion
|
|
831
831
|
//#region node_modules/engine.io-client/build/esm/socket.js
|
|
832
|
-
var
|
|
833
|
-
|
|
834
|
-
|
|
832
|
+
var ut = typeof addEventListener == "function" && typeof removeEventListener == "function", dt = [];
|
|
833
|
+
ut && addEventListener("offline", () => {
|
|
834
|
+
dt.forEach((e) => e());
|
|
835
835
|
}, !1);
|
|
836
|
-
var
|
|
836
|
+
var ft = class e extends b {
|
|
837
837
|
constructor(e, t) {
|
|
838
|
-
if (super(), this.binaryType =
|
|
839
|
-
let n =
|
|
838
|
+
if (super(), this.binaryType = Ie, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = Infinity, e && typeof e == "object" && (t = e, e = null), e) {
|
|
839
|
+
let n = st(e);
|
|
840
840
|
t.hostname = n.host, t.secure = n.protocol === "https" || n.protocol === "wss", t.port = n.port, n.query && (t.query = n.query);
|
|
841
|
-
} else t.host && (t.hostname =
|
|
842
|
-
|
|
841
|
+
} else t.host && (t.hostname = st(t.host).host);
|
|
842
|
+
ze(this, t), this.secure = t.secure == null ? typeof location < "u" && location.protocol === "https:" : t.secure, t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((e) => {
|
|
843
843
|
let t = e.prototype.name;
|
|
844
844
|
this.transports.push(t), this._transportsByName[t] = e;
|
|
845
845
|
}), this.opts = Object.assign({
|
|
@@ -854,11 +854,11 @@ var pt = class e extends y {
|
|
|
854
854
|
perMessageDeflate: { threshold: 1024 },
|
|
855
855
|
transportOptions: {},
|
|
856
856
|
closeOnBeforeunload: !1
|
|
857
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
857
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Ge(this.opts.query)), ut && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
858
858
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
859
859
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
860
860
|
this._onClose("transport close", { description: "network connection lost" });
|
|
861
|
-
},
|
|
861
|
+
}, dt.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
|
|
862
862
|
}
|
|
863
863
|
createTransport(e) {
|
|
864
864
|
let t = Object.assign({}, this.opts.query);
|
|
@@ -931,7 +931,7 @@ var pt = class e extends y {
|
|
|
931
931
|
let e = 1;
|
|
932
932
|
for (let t = 0; t < this.writeBuffer.length; t++) {
|
|
933
933
|
let n = this.writeBuffer[t].data;
|
|
934
|
-
if (n && (e +=
|
|
934
|
+
if (n && (e += Ve(n)), t > 0 && e > this._maxPayload) return this.writeBuffer.slice(0, t);
|
|
935
935
|
e += 2;
|
|
936
936
|
}
|
|
937
937
|
return this.writeBuffer;
|
|
@@ -939,7 +939,7 @@ var pt = class e extends y {
|
|
|
939
939
|
_hasPingExpired() {
|
|
940
940
|
if (!this._pingTimeoutTime) return !0;
|
|
941
941
|
let e = Date.now() > this._pingTimeoutTime;
|
|
942
|
-
return e && (this._pingTimeoutTime = 0,
|
|
942
|
+
return e && (this._pingTimeoutTime = 0, Pe(() => {
|
|
943
943
|
this._onClose("ping timeout");
|
|
944
944
|
}, this.setTimeoutFn)), e;
|
|
945
945
|
}
|
|
@@ -977,16 +977,16 @@ var pt = class e extends y {
|
|
|
977
977
|
}
|
|
978
978
|
_onClose(e, t) {
|
|
979
979
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
980
|
-
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(),
|
|
981
|
-
let e =
|
|
982
|
-
e !== -1 &&
|
|
980
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), ut && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
981
|
+
let e = dt.indexOf(this._offlineEventListener);
|
|
982
|
+
e !== -1 && dt.splice(e, 1);
|
|
983
983
|
}
|
|
984
984
|
this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
987
|
};
|
|
988
|
-
|
|
989
|
-
var
|
|
988
|
+
ft.protocol = 4;
|
|
989
|
+
var pt = class extends ft {
|
|
990
990
|
constructor() {
|
|
991
991
|
super(...arguments), this._upgrades = [];
|
|
992
992
|
}
|
|
@@ -995,7 +995,7 @@ var mt = class extends pt {
|
|
|
995
995
|
}
|
|
996
996
|
_probe(e) {
|
|
997
997
|
let t = this.createTransport(e), n = !1;
|
|
998
|
-
|
|
998
|
+
ft.priorWebsocketSuccess = !1;
|
|
999
999
|
let r = () => {
|
|
1000
1000
|
n || (t.send([{
|
|
1001
1001
|
type: "ping",
|
|
@@ -1003,7 +1003,7 @@ var mt = class extends pt {
|
|
|
1003
1003
|
}]), t.once("packet", (e) => {
|
|
1004
1004
|
if (!n) if (e.type === "pong" && e.data === "probe") {
|
|
1005
1005
|
if (this.upgrading = !0, this.emitReserved("upgrading", t), !t) return;
|
|
1006
|
-
|
|
1006
|
+
ft.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
|
|
1007
1007
|
n || this.readyState !== "closed" && (l(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
|
|
1008
1008
|
});
|
|
1009
1009
|
} else {
|
|
@@ -1043,54 +1043,54 @@ var mt = class extends pt {
|
|
|
1043
1043
|
for (let n = 0; n < e.length; n++) ~this.transports.indexOf(e[n]) && t.push(e[n]);
|
|
1044
1044
|
return t;
|
|
1045
1045
|
}
|
|
1046
|
-
},
|
|
1046
|
+
}, mt = class extends pt {
|
|
1047
1047
|
constructor(e, t = {}) {
|
|
1048
1048
|
let n = typeof e == "object" ? e : t;
|
|
1049
1049
|
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || [
|
|
1050
1050
|
"polling",
|
|
1051
1051
|
"websocket",
|
|
1052
1052
|
"webtransport"
|
|
1053
|
-
]).map((e) =>
|
|
1053
|
+
]).map((e) => it[e]).filter((e) => !!e)), super(e, n);
|
|
1054
1054
|
}
|
|
1055
1055
|
};
|
|
1056
|
-
|
|
1056
|
+
mt.protocol;
|
|
1057
1057
|
//#endregion
|
|
1058
1058
|
//#region node_modules/socket.io-client/build/esm/url.js
|
|
1059
|
-
function
|
|
1059
|
+
function ht(e, t = "", n) {
|
|
1060
1060
|
let r = e;
|
|
1061
|
-
n ||= typeof location < "u" && location, e ??= n.protocol + "//" + n.host, typeof e == "string" && (e.charAt(0) === "/" && (e = e.charAt(1) === "/" ? n.protocol + e : n.host + e), /^(https?|wss?):\/\//.test(e) || (e = n === void 0 ? "https://" + e : n.protocol + "//" + e), r =
|
|
1061
|
+
n ||= typeof location < "u" && location, e ??= n.protocol + "//" + n.host, typeof e == "string" && (e.charAt(0) === "/" && (e = e.charAt(1) === "/" ? n.protocol + e : n.host + e), /^(https?|wss?):\/\//.test(e) || (e = n === void 0 ? "https://" + e : n.protocol + "//" + e), r = st(e)), r.port || (/^(http|ws)$/.test(r.protocol) ? r.port = "80" : /^(http|ws)s$/.test(r.protocol) && (r.port = "443")), r.path = r.path || "/";
|
|
1062
1062
|
let i = r.host.indexOf(":") === -1 ? r.host : "[" + r.host + "]";
|
|
1063
1063
|
return r.id = r.protocol + "://" + i + ":" + r.port + t, r.href = r.protocol + "://" + i + (n && n.port === r.port ? "" : ":" + r.port), r;
|
|
1064
1064
|
}
|
|
1065
1065
|
//#endregion
|
|
1066
1066
|
//#region node_modules/socket.io-parser/build/esm/is-binary.js
|
|
1067
|
-
var
|
|
1068
|
-
function
|
|
1069
|
-
return
|
|
1067
|
+
var gt = typeof ArrayBuffer == "function", _t = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, vt = Object.prototype.toString, yt = typeof Blob == "function" || typeof Blob < "u" && vt.call(Blob) === "[object BlobConstructor]", bt = typeof File == "function" || typeof File < "u" && vt.call(File) === "[object FileConstructor]";
|
|
1068
|
+
function xt(e) {
|
|
1069
|
+
return gt && (e instanceof ArrayBuffer || _t(e)) || yt && e instanceof Blob || bt && e instanceof File;
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function St(e, t) {
|
|
1072
1072
|
if (!e || typeof e != "object") return !1;
|
|
1073
1073
|
if (Array.isArray(e)) {
|
|
1074
|
-
for (let t = 0, n = e.length; t < n; t++) if (
|
|
1074
|
+
for (let t = 0, n = e.length; t < n; t++) if (St(e[t])) return !0;
|
|
1075
1075
|
return !1;
|
|
1076
1076
|
}
|
|
1077
|
-
if (
|
|
1078
|
-
if (e.toJSON && typeof e.toJSON == "function" && arguments.length === 1) return
|
|
1079
|
-
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) &&
|
|
1077
|
+
if (xt(e)) return !0;
|
|
1078
|
+
if (e.toJSON && typeof e.toJSON == "function" && arguments.length === 1) return St(e.toJSON(), !0);
|
|
1079
|
+
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && St(e[t])) return !0;
|
|
1080
1080
|
return !1;
|
|
1081
1081
|
}
|
|
1082
1082
|
//#endregion
|
|
1083
1083
|
//#region node_modules/socket.io-parser/build/esm/binary.js
|
|
1084
|
-
function
|
|
1084
|
+
function Ct(e) {
|
|
1085
1085
|
let t = [], n = e.data, r = e;
|
|
1086
|
-
return r.data =
|
|
1086
|
+
return r.data = wt(n, t), r.attachments = t.length, {
|
|
1087
1087
|
packet: r,
|
|
1088
1088
|
buffers: t
|
|
1089
1089
|
};
|
|
1090
1090
|
}
|
|
1091
|
-
function
|
|
1091
|
+
function wt(e, t) {
|
|
1092
1092
|
if (!e) return e;
|
|
1093
|
-
if (
|
|
1093
|
+
if (xt(e)) {
|
|
1094
1094
|
let n = {
|
|
1095
1095
|
_placeholder: !0,
|
|
1096
1096
|
num: t.length
|
|
@@ -1098,53 +1098,53 @@ function Tt(e, t) {
|
|
|
1098
1098
|
return t.push(e), n;
|
|
1099
1099
|
} else if (Array.isArray(e)) {
|
|
1100
1100
|
let n = Array(e.length);
|
|
1101
|
-
for (let r = 0; r < e.length; r++) n[r] =
|
|
1101
|
+
for (let r = 0; r < e.length; r++) n[r] = wt(e[r], t);
|
|
1102
1102
|
return n;
|
|
1103
1103
|
} else if (typeof e == "object" && !(e instanceof Date)) {
|
|
1104
1104
|
let n = {};
|
|
1105
|
-
for (let r in e) Object.prototype.hasOwnProperty.call(e, r) && (n[r] =
|
|
1105
|
+
for (let r in e) Object.prototype.hasOwnProperty.call(e, r) && (n[r] = wt(e[r], t));
|
|
1106
1106
|
return n;
|
|
1107
1107
|
}
|
|
1108
1108
|
return e;
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1111
|
-
return e.data =
|
|
1110
|
+
function Tt(e, t) {
|
|
1111
|
+
return e.data = Et(e.data, t), delete e.attachments, e;
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1113
|
+
function Et(e, t) {
|
|
1114
1114
|
if (!e) return e;
|
|
1115
1115
|
if (e && e._placeholder === !0) {
|
|
1116
1116
|
if (typeof e.num == "number" && e.num >= 0 && e.num < t.length) return t[e.num];
|
|
1117
1117
|
throw Error("illegal attachments");
|
|
1118
|
-
} else if (Array.isArray(e)) for (let n = 0; n < e.length; n++) e[n] =
|
|
1119
|
-
else if (typeof e == "object") for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (e[n] =
|
|
1118
|
+
} else if (Array.isArray(e)) for (let n = 0; n < e.length; n++) e[n] = Et(e[n], t);
|
|
1119
|
+
else if (typeof e == "object") for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (e[n] = Et(e[n], t));
|
|
1120
1120
|
return e;
|
|
1121
1121
|
}
|
|
1122
1122
|
//#endregion
|
|
1123
1123
|
//#region node_modules/socket.io-parser/build/esm/index.js
|
|
1124
|
-
var
|
|
1125
|
-
Decoder: () =>
|
|
1126
|
-
Encoder: () =>
|
|
1127
|
-
PacketType: () =>
|
|
1128
|
-
isPacketValid: () =>
|
|
1124
|
+
var Dt = /* @__PURE__ */ f({
|
|
1125
|
+
Decoder: () => At,
|
|
1126
|
+
Encoder: () => kt,
|
|
1127
|
+
PacketType: () => T,
|
|
1128
|
+
isPacketValid: () => Lt,
|
|
1129
1129
|
protocol: () => 5
|
|
1130
|
-
}),
|
|
1130
|
+
}), Ot = [
|
|
1131
1131
|
"connect",
|
|
1132
1132
|
"connect_error",
|
|
1133
1133
|
"disconnect",
|
|
1134
1134
|
"disconnecting",
|
|
1135
1135
|
"newListener",
|
|
1136
1136
|
"removeListener"
|
|
1137
|
-
],
|
|
1137
|
+
], T;
|
|
1138
1138
|
(function(e) {
|
|
1139
1139
|
e[e.CONNECT = 0] = "CONNECT", e[e.DISCONNECT = 1] = "DISCONNECT", e[e.EVENT = 2] = "EVENT", e[e.ACK = 3] = "ACK", e[e.CONNECT_ERROR = 4] = "CONNECT_ERROR", e[e.BINARY_EVENT = 5] = "BINARY_EVENT", e[e.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1140
|
-
})(
|
|
1141
|
-
var
|
|
1140
|
+
})(T ||= {});
|
|
1141
|
+
var kt = class {
|
|
1142
1142
|
constructor(e) {
|
|
1143
1143
|
this.replacer = e;
|
|
1144
1144
|
}
|
|
1145
1145
|
encode(e) {
|
|
1146
|
-
return (e.type ===
|
|
1147
|
-
type: e.type ===
|
|
1146
|
+
return (e.type === T.EVENT || e.type === T.ACK) && St(e) ? this.encodeAsBinary({
|
|
1147
|
+
type: e.type === T.EVENT ? T.BINARY_EVENT : T.BINARY_ACK,
|
|
1148
1148
|
nsp: e.nsp,
|
|
1149
1149
|
data: e.data,
|
|
1150
1150
|
id: e.id
|
|
@@ -1152,13 +1152,13 @@ var At = class {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
encodeAsString(e) {
|
|
1154
1154
|
let t = "" + e.type;
|
|
1155
|
-
return (e.type ===
|
|
1155
|
+
return (e.type === T.BINARY_EVENT || e.type === T.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
|
|
1156
1156
|
}
|
|
1157
1157
|
encodeAsBinary(e) {
|
|
1158
|
-
let t =
|
|
1158
|
+
let t = Ct(e), n = this.encodeAsString(t.packet), r = t.buffers;
|
|
1159
1159
|
return r.unshift(n), r;
|
|
1160
1160
|
}
|
|
1161
|
-
},
|
|
1161
|
+
}, At = class e extends b {
|
|
1162
1162
|
constructor(e) {
|
|
1163
1163
|
super(), this.opts = Object.assign({
|
|
1164
1164
|
reviver: void 0,
|
|
@@ -1170,22 +1170,22 @@ var At = class {
|
|
|
1170
1170
|
if (typeof e == "string") {
|
|
1171
1171
|
if (this.reconstructor) throw Error("got plaintext data when reconstructing a packet");
|
|
1172
1172
|
t = this.decodeString(e);
|
|
1173
|
-
let n = t.type ===
|
|
1174
|
-
n || t.type ===
|
|
1175
|
-
} else if (
|
|
1173
|
+
let n = t.type === T.BINARY_EVENT;
|
|
1174
|
+
n || t.type === T.BINARY_ACK ? (t.type = n ? T.EVENT : T.ACK, this.reconstructor = new jt(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
|
|
1175
|
+
} else if (xt(e) || e.base64) if (this.reconstructor) t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
1176
1176
|
else throw Error("got binary data when not reconstructing a packet");
|
|
1177
1177
|
else throw Error("Unknown type: " + e);
|
|
1178
1178
|
}
|
|
1179
1179
|
decodeString(t) {
|
|
1180
1180
|
let n = 0, r = { type: Number(t.charAt(0)) };
|
|
1181
|
-
if (
|
|
1182
|
-
if (r.type ===
|
|
1181
|
+
if (T[r.type] === void 0) throw Error("unknown packet type " + r.type);
|
|
1182
|
+
if (r.type === T.BINARY_EVENT || r.type === T.BINARY_ACK) {
|
|
1183
1183
|
let e = n + 1;
|
|
1184
1184
|
for (; t.charAt(++n) !== "-" && n != t.length;);
|
|
1185
1185
|
let i = t.substring(e, n);
|
|
1186
1186
|
if (i != Number(i) || t.charAt(n) !== "-") throw Error("Illegal attachments");
|
|
1187
1187
|
let a = Number(i);
|
|
1188
|
-
if (!
|
|
1188
|
+
if (!Nt(a) || a < 0) throw Error("Illegal attachments");
|
|
1189
1189
|
if (a > this.opts.maxAttachments) throw Error("too many attachments");
|
|
1190
1190
|
r.attachments = a;
|
|
1191
1191
|
}
|
|
@@ -1223,25 +1223,25 @@ var At = class {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
static isPayloadValid(e, t) {
|
|
1225
1225
|
switch (e) {
|
|
1226
|
-
case
|
|
1227
|
-
case
|
|
1228
|
-
case
|
|
1229
|
-
case
|
|
1230
|
-
case
|
|
1231
|
-
case
|
|
1232
|
-
case
|
|
1226
|
+
case T.CONNECT: return Ft(t);
|
|
1227
|
+
case T.DISCONNECT: return t === void 0;
|
|
1228
|
+
case T.CONNECT_ERROR: return typeof t == "string" || Ft(t);
|
|
1229
|
+
case T.EVENT:
|
|
1230
|
+
case T.BINARY_EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Ot.indexOf(t[0]) === -1);
|
|
1231
|
+
case T.ACK:
|
|
1232
|
+
case T.BINARY_ACK: return Array.isArray(t);
|
|
1233
1233
|
}
|
|
1234
1234
|
}
|
|
1235
1235
|
destroy() {
|
|
1236
1236
|
this.reconstructor &&= (this.reconstructor.finishedReconstruction(), null);
|
|
1237
1237
|
}
|
|
1238
|
-
},
|
|
1238
|
+
}, jt = class {
|
|
1239
1239
|
constructor(e) {
|
|
1240
1240
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1241
1241
|
}
|
|
1242
1242
|
takeBinaryData(e) {
|
|
1243
1243
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1244
|
-
let e =
|
|
1244
|
+
let e = Tt(this.reconPack, this.buffers);
|
|
1245
1245
|
return this.finishedReconstruction(), e;
|
|
1246
1246
|
}
|
|
1247
1247
|
return null;
|
|
@@ -1250,48 +1250,48 @@ var At = class {
|
|
|
1250
1250
|
this.reconPack = null, this.buffers = [];
|
|
1251
1251
|
}
|
|
1252
1252
|
};
|
|
1253
|
-
function
|
|
1253
|
+
function Mt(e) {
|
|
1254
1254
|
return typeof e == "string";
|
|
1255
1255
|
}
|
|
1256
|
-
var
|
|
1256
|
+
var Nt = Number.isInteger || function(e) {
|
|
1257
1257
|
return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
|
|
1258
1258
|
};
|
|
1259
|
-
function
|
|
1260
|
-
return e === void 0 ||
|
|
1259
|
+
function Pt(e) {
|
|
1260
|
+
return e === void 0 || Nt(e);
|
|
1261
1261
|
}
|
|
1262
|
-
function
|
|
1262
|
+
function Ft(e) {
|
|
1263
1263
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function It(e, t) {
|
|
1266
1266
|
switch (e) {
|
|
1267
|
-
case
|
|
1268
|
-
case
|
|
1269
|
-
case
|
|
1270
|
-
case
|
|
1271
|
-
case
|
|
1267
|
+
case T.CONNECT: return t === void 0 || Ft(t);
|
|
1268
|
+
case T.DISCONNECT: return t === void 0;
|
|
1269
|
+
case T.EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Ot.indexOf(t[0]) === -1);
|
|
1270
|
+
case T.ACK: return Array.isArray(t);
|
|
1271
|
+
case T.CONNECT_ERROR: return typeof t == "string" || Ft(t);
|
|
1272
1272
|
default: return !1;
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return
|
|
1275
|
+
function Lt(e) {
|
|
1276
|
+
return Mt(e.nsp) && Pt(e.id) && It(e.type, e.data);
|
|
1277
1277
|
}
|
|
1278
1278
|
//#endregion
|
|
1279
1279
|
//#region node_modules/socket.io-client/build/esm/on.js
|
|
1280
|
-
function
|
|
1280
|
+
function Rt(e, t, n) {
|
|
1281
1281
|
return e.on(t, n), function() {
|
|
1282
1282
|
e.off(t, n);
|
|
1283
1283
|
};
|
|
1284
1284
|
}
|
|
1285
1285
|
//#endregion
|
|
1286
1286
|
//#region node_modules/socket.io-client/build/esm/socket.js
|
|
1287
|
-
var
|
|
1287
|
+
var zt = Object.freeze({
|
|
1288
1288
|
connect: 1,
|
|
1289
1289
|
connect_error: 1,
|
|
1290
1290
|
disconnect: 1,
|
|
1291
1291
|
disconnecting: 1,
|
|
1292
1292
|
newListener: 1,
|
|
1293
1293
|
removeListener: 1
|
|
1294
|
-
}),
|
|
1294
|
+
}), Bt = class extends b {
|
|
1295
1295
|
constructor(e, t, n) {
|
|
1296
1296
|
super(), this.connected = !1, this.recovered = !1, this.receiveBuffer = [], this.sendBuffer = [], this._queue = [], this._queueSeq = 0, this.ids = 0, this.acks = {}, this.flags = {}, this.io = e, this.nsp = t, n && n.auth && (this.auth = n.auth), this._opts = Object.assign({}, n), this.io._autoConnect && this.open();
|
|
1297
1297
|
}
|
|
@@ -1302,10 +1302,10 @@ var Bt = Object.freeze({
|
|
|
1302
1302
|
if (this.subs) return;
|
|
1303
1303
|
let e = this.io;
|
|
1304
1304
|
this.subs = [
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1305
|
+
Rt(e, "open", this.onopen.bind(this)),
|
|
1306
|
+
Rt(e, "packet", this.onpacket.bind(this)),
|
|
1307
|
+
Rt(e, "error", this.onerror.bind(this)),
|
|
1308
|
+
Rt(e, "close", this.onclose.bind(this))
|
|
1309
1309
|
];
|
|
1310
1310
|
}
|
|
1311
1311
|
get active() {
|
|
@@ -1321,10 +1321,10 @@ var Bt = Object.freeze({
|
|
|
1321
1321
|
return e.unshift("message"), this.emit.apply(this, e), this;
|
|
1322
1322
|
}
|
|
1323
1323
|
emit(e, ...t) {
|
|
1324
|
-
if (
|
|
1324
|
+
if (zt.hasOwnProperty(e)) throw Error("\"" + e.toString() + "\" is a reserved event name");
|
|
1325
1325
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) return this._addToQueue(t), this;
|
|
1326
1326
|
let n = {
|
|
1327
|
-
type:
|
|
1327
|
+
type: T.EVENT,
|
|
1328
1328
|
data: t
|
|
1329
1329
|
};
|
|
1330
1330
|
if (n.options = {}, n.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
|
|
@@ -1382,7 +1382,7 @@ var Bt = Object.freeze({
|
|
|
1382
1382
|
}
|
|
1383
1383
|
_sendConnectPacket(e) {
|
|
1384
1384
|
this.packet({
|
|
1385
|
-
type:
|
|
1385
|
+
type: T.CONNECT,
|
|
1386
1386
|
data: this._pid ? Object.assign({
|
|
1387
1387
|
pid: this._pid,
|
|
1388
1388
|
offset: this._lastOffset
|
|
@@ -1405,21 +1405,21 @@ var Bt = Object.freeze({
|
|
|
1405
1405
|
}
|
|
1406
1406
|
onpacket(e) {
|
|
1407
1407
|
if (e.nsp === this.nsp) switch (e.type) {
|
|
1408
|
-
case
|
|
1408
|
+
case T.CONNECT:
|
|
1409
1409
|
e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", /* @__PURE__ */ Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
|
|
1410
1410
|
break;
|
|
1411
|
-
case
|
|
1412
|
-
case
|
|
1411
|
+
case T.EVENT:
|
|
1412
|
+
case T.BINARY_EVENT:
|
|
1413
1413
|
this.onevent(e);
|
|
1414
1414
|
break;
|
|
1415
|
-
case
|
|
1416
|
-
case
|
|
1415
|
+
case T.ACK:
|
|
1416
|
+
case T.BINARY_ACK:
|
|
1417
1417
|
this.onack(e);
|
|
1418
1418
|
break;
|
|
1419
|
-
case
|
|
1419
|
+
case T.DISCONNECT:
|
|
1420
1420
|
this.ondisconnect();
|
|
1421
1421
|
break;
|
|
1422
|
-
case
|
|
1422
|
+
case T.CONNECT_ERROR:
|
|
1423
1423
|
this.destroy();
|
|
1424
1424
|
let t = Error(e.data.message);
|
|
1425
1425
|
t.data = e.data.data, this.emitReserved("connect_error", t);
|
|
@@ -1441,7 +1441,7 @@ var Bt = Object.freeze({
|
|
|
1441
1441
|
let t = this, n = !1;
|
|
1442
1442
|
return function(...r) {
|
|
1443
1443
|
n || (n = !0, t.packet({
|
|
1444
|
-
type:
|
|
1444
|
+
type: T.ACK,
|
|
1445
1445
|
id: e,
|
|
1446
1446
|
data: r
|
|
1447
1447
|
}));
|
|
@@ -1466,7 +1466,7 @@ var Bt = Object.freeze({
|
|
|
1466
1466
|
this.subs &&= (this.subs.forEach((e) => e()), void 0), this.io._destroy(this);
|
|
1467
1467
|
}
|
|
1468
1468
|
disconnect() {
|
|
1469
|
-
return this.connected && this.packet({ type:
|
|
1469
|
+
return this.connected && this.packet({ type: T.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
|
|
1470
1470
|
}
|
|
1471
1471
|
close() {
|
|
1472
1472
|
return this.disconnect();
|
|
@@ -1523,35 +1523,35 @@ var Bt = Object.freeze({
|
|
|
1523
1523
|
};
|
|
1524
1524
|
//#endregion
|
|
1525
1525
|
//#region node_modules/socket.io-client/build/esm/contrib/backo2.js
|
|
1526
|
-
function
|
|
1526
|
+
function Vt(e) {
|
|
1527
1527
|
e ||= {}, this.ms = e.min || 100, this.max = e.max || 1e4, this.factor = e.factor || 2, this.jitter = e.jitter > 0 && e.jitter <= 1 ? e.jitter : 0, this.attempts = 0;
|
|
1528
1528
|
}
|
|
1529
|
-
|
|
1529
|
+
Vt.prototype.duration = function() {
|
|
1530
1530
|
var e = this.ms * this.factor ** + this.attempts++;
|
|
1531
1531
|
if (this.jitter) {
|
|
1532
1532
|
var t = Math.random(), n = Math.floor(t * this.jitter * e);
|
|
1533
1533
|
e = Math.floor(t * 10) & 1 ? e + n : e - n;
|
|
1534
1534
|
}
|
|
1535
1535
|
return Math.min(e, this.max) | 0;
|
|
1536
|
-
},
|
|
1536
|
+
}, Vt.prototype.reset = function() {
|
|
1537
1537
|
this.attempts = 0;
|
|
1538
|
-
},
|
|
1538
|
+
}, Vt.prototype.setMin = function(e) {
|
|
1539
1539
|
this.ms = e;
|
|
1540
|
-
},
|
|
1540
|
+
}, Vt.prototype.setMax = function(e) {
|
|
1541
1541
|
this.max = e;
|
|
1542
|
-
},
|
|
1542
|
+
}, Vt.prototype.setJitter = function(e) {
|
|
1543
1543
|
this.jitter = e;
|
|
1544
1544
|
};
|
|
1545
1545
|
//#endregion
|
|
1546
1546
|
//#region node_modules/socket.io-client/build/esm/manager.js
|
|
1547
|
-
var
|
|
1547
|
+
var Ht = class extends b {
|
|
1548
1548
|
constructor(e, t) {
|
|
1549
|
-
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t ||= {}, t.path = t.path || "/socket.io", this.opts = t,
|
|
1549
|
+
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t ||= {}, t.path = t.path || "/socket.io", this.opts = t, ze(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || Infinity), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor(t.randomizationFactor ?? .5), this.backoff = new Vt({
|
|
1550
1550
|
min: this.reconnectionDelay(),
|
|
1551
1551
|
max: this.reconnectionDelayMax(),
|
|
1552
1552
|
jitter: this.randomizationFactor()
|
|
1553
1553
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
1554
|
-
let n = t.parser ||
|
|
1554
|
+
let n = t.parser || Dt;
|
|
1555
1555
|
this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
1556
1556
|
}
|
|
1557
1557
|
reconnection(e) {
|
|
@@ -1580,14 +1580,14 @@ var Ut = class extends y {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
open(e) {
|
|
1582
1582
|
if (~this._readyState.indexOf("open")) return this;
|
|
1583
|
-
this.engine = new
|
|
1583
|
+
this.engine = new mt(this.uri, this.opts);
|
|
1584
1584
|
let t = this.engine, n = this;
|
|
1585
1585
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
1586
|
-
let r =
|
|
1586
|
+
let r = Rt(t, "open", function() {
|
|
1587
1587
|
n.onopen(), e && e();
|
|
1588
1588
|
}), i = (t) => {
|
|
1589
1589
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", t), e ? e(t) : this.maybeReconnectOnOpen();
|
|
1590
|
-
}, a =
|
|
1590
|
+
}, a = Rt(t, "error", i);
|
|
1591
1591
|
if (!1 !== this._timeout) {
|
|
1592
1592
|
let e = this._timeout, n = this.setTimeoutFn(() => {
|
|
1593
1593
|
r(), i(/* @__PURE__ */ Error("timeout")), t.close();
|
|
@@ -1604,7 +1604,7 @@ var Ut = class extends y {
|
|
|
1604
1604
|
onopen() {
|
|
1605
1605
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
1606
1606
|
let e = this.engine;
|
|
1607
|
-
this.subs.push(
|
|
1607
|
+
this.subs.push(Rt(e, "ping", this.onping.bind(this)), Rt(e, "data", this.ondata.bind(this)), Rt(e, "error", this.onerror.bind(this)), Rt(e, "close", this.onclose.bind(this)), Rt(this.decoder, "decoded", this.ondecoded.bind(this)));
|
|
1608
1608
|
}
|
|
1609
1609
|
onping() {
|
|
1610
1610
|
this.emitReserved("ping");
|
|
@@ -1617,7 +1617,7 @@ var Ut = class extends y {
|
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
1619
|
ondecoded(e) {
|
|
1620
|
-
|
|
1620
|
+
Pe(() => {
|
|
1621
1621
|
this.emitReserved("packet", e);
|
|
1622
1622
|
}, this.setTimeoutFn);
|
|
1623
1623
|
}
|
|
@@ -1626,7 +1626,7 @@ var Ut = class extends y {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
socket(e, t) {
|
|
1628
1628
|
let n = this.nsps[e];
|
|
1629
|
-
return n ? this._autoConnect && !n.active && n.connect() : (n = new
|
|
1629
|
+
return n ? this._autoConnect && !n.active && n.connect() : (n = new Bt(this, e, t), this.nsps[e] = n), n;
|
|
1630
1630
|
}
|
|
1631
1631
|
_destroy(e) {
|
|
1632
1632
|
let t = Object.keys(this.nsps);
|
|
@@ -1671,21 +1671,21 @@ var Ut = class extends y {
|
|
|
1671
1671
|
let e = this.backoff.attempts;
|
|
1672
1672
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
|
|
1673
1673
|
}
|
|
1674
|
-
},
|
|
1675
|
-
function
|
|
1674
|
+
}, Ut = {};
|
|
1675
|
+
function Wt(e, t) {
|
|
1676
1676
|
typeof e == "object" && (t = e, e = void 0), t ||= {};
|
|
1677
|
-
let n =
|
|
1678
|
-
return s ? c = new
|
|
1679
|
-
}
|
|
1680
|
-
Object.assign(
|
|
1681
|
-
Manager:
|
|
1682
|
-
Socket:
|
|
1683
|
-
io:
|
|
1684
|
-
connect:
|
|
1677
|
+
let n = ht(e, t.path || "/socket.io"), r = n.source, i = n.id, a = n.path, o = Ut[i] && a in Ut[i].nsps, s = t.forceNew || t["force new connection"] || !1 === t.multiplex || o, c;
|
|
1678
|
+
return s ? c = new Ht(r, t) : (Ut[i] || (Ut[i] = new Ht(r, t)), c = Ut[i]), n.query && !t.query && (t.query = n.queryKey), c.socket(n.path, t);
|
|
1679
|
+
}
|
|
1680
|
+
Object.assign(Wt, {
|
|
1681
|
+
Manager: Ht,
|
|
1682
|
+
Socket: Bt,
|
|
1683
|
+
io: Wt,
|
|
1684
|
+
connect: Wt
|
|
1685
1685
|
});
|
|
1686
1686
|
//#endregion
|
|
1687
1687
|
//#region src/services/socketClient.js
|
|
1688
|
-
var
|
|
1688
|
+
var Gt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Wt(e, {
|
|
1689
1689
|
transports: ["polling", "websocket"],
|
|
1690
1690
|
upgrade: !0,
|
|
1691
1691
|
rememberUpgrade: !1,
|
|
@@ -1698,7 +1698,7 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
|
|
|
1698
1698
|
chatId: n,
|
|
1699
1699
|
siteId: r
|
|
1700
1700
|
}
|
|
1701
|
-
}),
|
|
1701
|
+
}), Kt = ({ socket: e, chatId: t }) => {
|
|
1702
1702
|
if (!e || !t || typeof window > "u") return () => {};
|
|
1703
1703
|
let n = window.location.pathname + window.location.search, r = Date.now(), i = () => {
|
|
1704
1704
|
console.log("[FlowEngageTracking] visitor:session_start", {
|
|
@@ -1757,7 +1757,7 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
|
|
|
1757
1757
|
}, window.history.replaceState = (...e) => {
|
|
1758
1758
|
u(...e), c();
|
|
1759
1759
|
};
|
|
1760
|
-
let d = window.setInterval(s,
|
|
1760
|
+
let d = window.setInterval(s, ee), f = () => {
|
|
1761
1761
|
o(n, r), e.emit("visitor:session_end", {
|
|
1762
1762
|
chatId: t,
|
|
1763
1763
|
timestamp: Date.now()
|
|
@@ -1769,14 +1769,14 @@ var Kt = ({ apiBaseUrl: e, userId: t, chatId: n, siteId: r }) => Gt(e, {
|
|
|
1769
1769
|
window.clearInterval(d), window.history.pushState = l, window.history.replaceState = u, window.removeEventListener("popstate", c), window.removeEventListener("hashchange", c), window.removeEventListener("beforeunload", f);
|
|
1770
1770
|
}
|
|
1771
1771
|
};
|
|
1772
|
-
},
|
|
1773
|
-
let e = r(
|
|
1772
|
+
}, qt = t(null), Jt = () => {
|
|
1773
|
+
let e = r(qt);
|
|
1774
1774
|
if (!e) throw Error("useFlowEngage must be used inside FlowEngageProvider");
|
|
1775
1775
|
return e;
|
|
1776
1776
|
};
|
|
1777
1777
|
//#endregion
|
|
1778
1778
|
//#region src/utils/feDebug.js
|
|
1779
|
-
function
|
|
1779
|
+
function Yt() {
|
|
1780
1780
|
if (typeof window > "u") return !1;
|
|
1781
1781
|
try {
|
|
1782
1782
|
let e = window.localStorage?.getItem("FE_DEBUG_VOICE");
|
|
@@ -1787,15 +1787,15 @@ function Xt() {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
//#endregion
|
|
1789
1789
|
//#region src/utils/navigateAndHighlight.js
|
|
1790
|
-
function
|
|
1791
|
-
|
|
1790
|
+
function Xt(...e) {
|
|
1791
|
+
Yt() && console.log("[FlowEngage:shadowNavigate]", ...e);
|
|
1792
1792
|
}
|
|
1793
|
-
var
|
|
1793
|
+
var Zt = () => {
|
|
1794
1794
|
if (typeof document > "u" || document.getElementById("fe-highlight-styles")) return;
|
|
1795
1795
|
let e = document.createElement("style");
|
|
1796
1796
|
e.id = "fe-highlight-styles", e.textContent = "\n .fe-highlight-section {\n outline: 3px solid #7c3aed !important;\n box-shadow: 0 0 15px rgba(124, 58, 237, 0.6) !important;\n transition: all 0.3s ease !important;\n border-radius: 8px !important;\n }\n ", document.head.appendChild(e);
|
|
1797
1797
|
};
|
|
1798
|
-
function
|
|
1798
|
+
function Qt(e, t) {
|
|
1799
1799
|
if (typeof document > "u") return null;
|
|
1800
1800
|
if (e) {
|
|
1801
1801
|
let n = document.getElementById(e) || document.querySelector(`[data-section="${e}"]`);
|
|
@@ -1828,16 +1828,16 @@ function $t(e, t) {
|
|
|
1828
1828
|
}
|
|
1829
1829
|
return null;
|
|
1830
1830
|
}
|
|
1831
|
-
function
|
|
1832
|
-
!e || typeof document > "u" || (
|
|
1831
|
+
function $t(e) {
|
|
1832
|
+
!e || typeof document > "u" || (Zt(), en(), e.classList.add("fe-highlight-section"), e.scrollIntoView({
|
|
1833
1833
|
behavior: "smooth",
|
|
1834
1834
|
block: "center"
|
|
1835
1835
|
}));
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function en() {
|
|
1838
1838
|
typeof document > "u" || document.querySelectorAll(".fe-highlight-section").forEach((e) => e.classList.remove("fe-highlight-section"));
|
|
1839
1839
|
}
|
|
1840
|
-
function
|
|
1840
|
+
function tn(e) {
|
|
1841
1841
|
if (typeof window > "u") return e;
|
|
1842
1842
|
try {
|
|
1843
1843
|
let t = new URL(String(e).trim(), window.location.href);
|
|
@@ -1846,31 +1846,31 @@ function nn(e) {
|
|
|
1846
1846
|
return e;
|
|
1847
1847
|
}
|
|
1848
1848
|
}
|
|
1849
|
-
async function
|
|
1849
|
+
async function nn(e) {
|
|
1850
1850
|
if (typeof window > "u") return !1;
|
|
1851
1851
|
try {
|
|
1852
|
-
let t =
|
|
1853
|
-
if (
|
|
1852
|
+
let t = tn(e), n = new URL(t, window.location.origin);
|
|
1853
|
+
if (Xt("input:", e, "→ normalized:", t, "href:", n.href), n.hash && n.pathname === window.location.pathname) {
|
|
1854
1854
|
let e = n.hash.slice(1), t = document.getElementById(e);
|
|
1855
|
-
if (t) return
|
|
1855
|
+
if (t) return Xt("branch: hash scroll (same path)"), t.scrollIntoView({
|
|
1856
1856
|
behavior: "smooth",
|
|
1857
1857
|
block: "start"
|
|
1858
1858
|
}), !0;
|
|
1859
1859
|
}
|
|
1860
|
-
if (n.pathname === window.location.pathname && n.search === window.location.search && !n.hash) return
|
|
1860
|
+
if (n.pathname === window.location.pathname && n.search === window.location.search && !n.hash) return Xt("branch: already on page (no nav)"), !1;
|
|
1861
1861
|
let r = n.pathname + n.search + n.hash, i = window.next?.router;
|
|
1862
|
-
if (i?.push) return
|
|
1862
|
+
if (i?.push) return Xt("branch: Next.js Pages router.push", r), new Promise((e) => {
|
|
1863
1863
|
let t = () => {
|
|
1864
1864
|
i.events?.off("routeChangeComplete", t), e(!0);
|
|
1865
1865
|
};
|
|
1866
1866
|
i.events?.on("routeChangeComplete", t), i.push(r), setTimeout(t, 4e3);
|
|
1867
1867
|
});
|
|
1868
1868
|
let a = window.__NEXT_ROUTER__;
|
|
1869
|
-
return a?.push ? (
|
|
1869
|
+
return a?.push ? (Xt("branch: __NEXT_ROUTER__.push", r), a.push(r), !0) : (Xt("branch: location.assign (full navigation)", n.href), window.location.assign(n.href), !0);
|
|
1870
1870
|
} catch (t) {
|
|
1871
1871
|
console.warn("[FlowEngage] shadowNavigate error:", t);
|
|
1872
1872
|
try {
|
|
1873
|
-
window.location.href =
|
|
1873
|
+
window.location.href = tn(e);
|
|
1874
1874
|
} catch {
|
|
1875
1875
|
window.location.href = e;
|
|
1876
1876
|
}
|
|
@@ -1879,12 +1879,12 @@ async function rn(e) {
|
|
|
1879
1879
|
}
|
|
1880
1880
|
//#endregion
|
|
1881
1881
|
//#region src/provider/FlowEngageProvider.jsx
|
|
1882
|
-
var
|
|
1882
|
+
var rn = (e) => !e || typeof e != "string" ? e : e.replace(/<human_assistance_request>[\s\S]*?<\/human_assistance_request>/gi, "").replace(/<human_assistance_request>/gi, "").replace(/<\/human_assistance_request>/gi, "").replace(/<navigate[^>]*\/>/gi, "").replace(/<navigate[^>]*>[\s\S]*?<\/navigate>/gi, "").replace(/<[a-z]+(?:_[a-z]+)+[^>]*>[\s\S]*?<\/[a-z]+(?:_[a-z]+)+>/gi, "").replace(/<[a-z]+(?:_[a-z]+)+[^>]*\/>/gi, "").trim(), an = (e = []) => e.map((e) => ({
|
|
1883
1883
|
...e,
|
|
1884
|
-
message:
|
|
1884
|
+
message: rn(e.message),
|
|
1885
1885
|
isPending: !1,
|
|
1886
1886
|
id: e.messageId || `${e.sender}-${e.timestamp || Date.now()}-${Math.random()}`
|
|
1887
|
-
})),
|
|
1887
|
+
})), on = (e, t) => e ? typeof e == "string" ? e : e.message || e.error || e.reason || t : t, sn = (e = {}) => {
|
|
1888
1888
|
if (!e?.candidate) return null;
|
|
1889
1889
|
if (typeof e.candidate == "object") return e.candidate;
|
|
1890
1890
|
let t = e.sdpMid !== void 0 && e.sdpMid !== null && e.sdpMid !== "", n = e.sdpMLineIndex !== void 0 && e.sdpMLineIndex !== null;
|
|
@@ -1893,7 +1893,7 @@ var an = (e) => !e || typeof e != "string" ? e : e.replace(/<human_assistance_re
|
|
|
1893
1893
|
...t ? { sdpMid: e.sdpMid } : {},
|
|
1894
1894
|
...n ? { sdpMLineIndex: e.sdpMLineIndex } : {}
|
|
1895
1895
|
};
|
|
1896
|
-
},
|
|
1896
|
+
}, cn = (e) => {
|
|
1897
1897
|
if (!e) return null;
|
|
1898
1898
|
let t = typeof e == "object" ? e : { candidate: e };
|
|
1899
1899
|
return {
|
|
@@ -1902,139 +1902,139 @@ var an = (e) => !e || typeof e != "string" ? e : e.replace(/<human_assistance_re
|
|
|
1902
1902
|
sdpMLineIndex: t.sdpMLineIndex ?? null,
|
|
1903
1903
|
candidatePreview: typeof t.candidate == "string" ? t.candidate.slice(0, 80) : null
|
|
1904
1904
|
};
|
|
1905
|
-
},
|
|
1905
|
+
}, ln = (e = [], t = "Agent") => {
|
|
1906
1906
|
for (let t of e) if (typeof t == "string" && t.trim()) return t.trim();
|
|
1907
1907
|
return t;
|
|
1908
1908
|
};
|
|
1909
|
-
function
|
|
1909
|
+
function un({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
1910
1910
|
let c = a(() => e ? {
|
|
1911
1911
|
...t || {},
|
|
1912
1912
|
siteId: e
|
|
1913
|
-
} : t || null, [e, t]), u = a(() =>
|
|
1913
|
+
} : t || null, [e, t]), u = a(() => ln([c?.widgetSettings?.branding?.fallbackAgentName, c?.widgetSettings?.branding?.headerName], "Agent"), [c]), [d, f] = s("booting"), [m, ee] = s(null), [h, se] = s(null), [g, _] = s(""), [ue, v] = s([]), [y, de] = s(re().isOpen), [fe, pe] = s(re().activeScreen), [me, he] = s(re().isHumanHandled), [ge, _e] = s(re().agentName), [ve, ye] = s(re().agentHeadshot), [be, xe] = s(ae()), [Se, Ce] = s(!1), [we, Te] = s(!1), [Ee, De] = s("idle"), [Oe, ke] = s(!1), [Ae, je] = s(!1), [Me, b] = s(""), [Ne, Pe] = s(!1), [Fe, Ie] = s(!1), [x, Le] = s(null), [Re, ze] = s(null), [Be, Ve] = s("idle"), [He, Ue] = s(null), [We, Ge] = s(!1), [Ke, qe] = s(""), S = o(null), C = o(null), w = o(""), Je = o(null), Ye = o(null), Xe = o(null), Ze = o(null), Qe = o(null), $e = o([]), et = o(null), tt = o(null), nt = o(!1), rt = o(!1), it = o(""), at = o([]), ot = o(!1), st = o({
|
|
1914
1914
|
notifyRouteChange: () => {},
|
|
1915
1915
|
cleanup: () => {}
|
|
1916
|
-
}),
|
|
1917
|
-
let e =
|
|
1916
|
+
}), ct = a(() => {
|
|
1917
|
+
let e = h?.widgetSettings?.call?.maxDurationSeconds ?? c?.widgetSettings?.call?.maxDurationSeconds ?? c?.callMaxDurationSeconds, t = Number(e);
|
|
1918
1918
|
return Number.isFinite(t) && t > 0 ? t : 900;
|
|
1919
|
-
}, [c,
|
|
1919
|
+
}, [c, h]);
|
|
1920
1920
|
i(() => {
|
|
1921
|
-
|
|
1922
|
-
}, [
|
|
1923
|
-
let
|
|
1924
|
-
|
|
1925
|
-
},
|
|
1921
|
+
Je.current = x;
|
|
1922
|
+
}, [x]);
|
|
1923
|
+
let lt = () => {
|
|
1924
|
+
qe("");
|
|
1925
|
+
}, ut = (e) => {
|
|
1926
1926
|
let t = typeof e == "string" ? e.trim().toLowerCase() : "";
|
|
1927
|
-
return
|
|
1928
|
-
},
|
|
1929
|
-
|
|
1930
|
-
},
|
|
1931
|
-
let t =
|
|
1932
|
-
if (!t?.connected || !n ||
|
|
1927
|
+
return xe(t), oe(t), t;
|
|
1928
|
+
}, dt = () => {
|
|
1929
|
+
Ye.current &&= (Ye.current.close(), null), Xe.current &&= (Xe.current.getTracks().forEach((e) => e.stop()), null), Ze.current &&= (Ze.current.srcObject = null, Ze.current.remove(), null), Qe.current = null, $e.current = [], et.current = null, tt.current = null, nt.current = !1, Ge(!1), Le(null), ze(null), Ve("idle"), Ue(null);
|
|
1930
|
+
}, ft = (e = (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
1931
|
+
let t = S.current, n = et.current || Qe.current?.callId;
|
|
1932
|
+
if (!t?.connected || !n || nt.current) {
|
|
1933
1933
|
console.log("[FlowEngageProvider] skipping call:connected emit", {
|
|
1934
1934
|
callId: n,
|
|
1935
|
-
chatId:
|
|
1935
|
+
chatId: w.current,
|
|
1936
1936
|
socketConnected: !!t?.connected,
|
|
1937
|
-
alreadyReported:
|
|
1937
|
+
alreadyReported: nt.current
|
|
1938
1938
|
});
|
|
1939
1939
|
return;
|
|
1940
1940
|
}
|
|
1941
1941
|
console.log("[FlowEngageProvider] emitting call:connected", {
|
|
1942
1942
|
callId: n,
|
|
1943
|
-
chatId:
|
|
1943
|
+
chatId: w.current,
|
|
1944
1944
|
connectedAt: e
|
|
1945
|
-
}),
|
|
1945
|
+
}), nt.current = !0, t.emit("call:connected", {
|
|
1946
1946
|
callId: n,
|
|
1947
|
-
chatId:
|
|
1947
|
+
chatId: w.current,
|
|
1948
1948
|
connectedAt: e
|
|
1949
1949
|
});
|
|
1950
|
-
},
|
|
1950
|
+
}, pt = (e = {}) => {
|
|
1951
1951
|
if (!e.callId) return;
|
|
1952
|
-
let t =
|
|
1952
|
+
let t = tt.current === e.callId, n = et.current === e.callId, r = Je.current?.callId === e.callId;
|
|
1953
1953
|
if (!(!t && !n && !r)) {
|
|
1954
1954
|
if (console.log("[FlowEngageProvider] syncing accepted call state", {
|
|
1955
1955
|
callId: e.callId,
|
|
1956
|
-
chatId: e.chatId ||
|
|
1956
|
+
chatId: e.chatId || w.current,
|
|
1957
1957
|
isAcceptingHere: t,
|
|
1958
1958
|
isAlreadyActive: n,
|
|
1959
1959
|
isIncomingHere: r
|
|
1960
|
-
}),
|
|
1961
|
-
|
|
1960
|
+
}), Le(null), t || n) {
|
|
1961
|
+
et.current = e.callId, ze(e.callId), Ve((e) => e === "connected" ? e : "connecting"), de(!0);
|
|
1962
1962
|
return;
|
|
1963
1963
|
}
|
|
1964
|
-
|
|
1964
|
+
Ve("idle");
|
|
1965
1965
|
}
|
|
1966
|
-
},
|
|
1966
|
+
}, mt = (e = {}) => {
|
|
1967
1967
|
if (!e.callId) return;
|
|
1968
|
-
let t =
|
|
1968
|
+
let t = tt.current === e.callId, n = et.current === e.callId, r = Je.current?.callId === e.callId;
|
|
1969
1969
|
if (!(!t && !n && !r)) {
|
|
1970
1970
|
if (console.log("[FlowEngageProvider] syncing ended incoming call state", {
|
|
1971
1971
|
callId: e.callId,
|
|
1972
|
-
chatId: e.chatId ||
|
|
1972
|
+
chatId: e.chatId || w.current,
|
|
1973
1973
|
isAcceptingHere: t,
|
|
1974
1974
|
isAlreadyActive: n,
|
|
1975
1975
|
isIncomingHere: r,
|
|
1976
1976
|
reason: e.reason || e.status || null
|
|
1977
1977
|
}), n) {
|
|
1978
|
-
|
|
1978
|
+
dt();
|
|
1979
1979
|
return;
|
|
1980
1980
|
}
|
|
1981
|
-
|
|
1981
|
+
tt.current = null, Qe.current = null, $e.current = [], Le(null), Ve("idle");
|
|
1982
1982
|
}
|
|
1983
|
-
},
|
|
1984
|
-
let t =
|
|
1983
|
+
}, ht = async (e = {}) => {
|
|
1984
|
+
let t = Ye.current, n = S.current, r = e.sdpOffer || e.offer?.sdp;
|
|
1985
1985
|
if (!t || !n?.connected || !r || !e.callId) {
|
|
1986
1986
|
console.log("[FlowEngageProvider] deferring remote offer until peer/socket ready", {
|
|
1987
1987
|
callId: e.callId,
|
|
1988
|
-
chatId:
|
|
1988
|
+
chatId: w.current,
|
|
1989
1989
|
hasPeerConnection: !!t,
|
|
1990
1990
|
socketConnected: !!n?.connected,
|
|
1991
1991
|
hasOffer: !!r
|
|
1992
|
-
}),
|
|
1992
|
+
}), Qe.current = e;
|
|
1993
1993
|
return;
|
|
1994
1994
|
}
|
|
1995
1995
|
if (console.log("[FlowEngageProvider] applying remote offer", {
|
|
1996
1996
|
callId: e.callId,
|
|
1997
|
-
chatId:
|
|
1997
|
+
chatId: w.current,
|
|
1998
1998
|
offerLength: r.length,
|
|
1999
1999
|
signalingState: t.signalingState
|
|
2000
2000
|
}), await t.setRemoteDescription(new RTCSessionDescription({
|
|
2001
2001
|
type: "offer",
|
|
2002
2002
|
sdp: r
|
|
2003
|
-
})),
|
|
2003
|
+
})), $e.current.length > 0) {
|
|
2004
2004
|
console.log("[FlowEngageProvider] flushing queued agent ICE candidates after remote offer", {
|
|
2005
2005
|
callId: e.callId,
|
|
2006
|
-
chatId:
|
|
2007
|
-
queuedCount:
|
|
2006
|
+
chatId: w.current,
|
|
2007
|
+
queuedCount: $e.current.length
|
|
2008
2008
|
});
|
|
2009
|
-
for (let e of
|
|
2010
|
-
|
|
2009
|
+
for (let e of $e.current) await t.addIceCandidate(new RTCIceCandidate(e));
|
|
2010
|
+
$e.current = [];
|
|
2011
2011
|
}
|
|
2012
2012
|
let i = await t.createAnswer();
|
|
2013
2013
|
await t.setLocalDescription(i), console.log("[FlowEngageProvider] created local answer", {
|
|
2014
2014
|
callId: e.callId,
|
|
2015
|
-
chatId:
|
|
2015
|
+
chatId: w.current,
|
|
2016
2016
|
answerLength: i.sdp?.length || 0,
|
|
2017
2017
|
signalingState: t.signalingState
|
|
2018
2018
|
}), n.emit("call:answer", {
|
|
2019
2019
|
callId: e.callId,
|
|
2020
2020
|
sdpAnswer: i.sdp,
|
|
2021
|
-
chatId:
|
|
2021
|
+
chatId: w.current
|
|
2022
2022
|
});
|
|
2023
2023
|
};
|
|
2024
2024
|
i(() => {
|
|
2025
|
-
|
|
2026
|
-
isOpen:
|
|
2027
|
-
activeScreen:
|
|
2028
|
-
isHumanHandled:
|
|
2029
|
-
agentName:
|
|
2030
|
-
agentHeadshot:
|
|
2025
|
+
ie({
|
|
2026
|
+
isOpen: y,
|
|
2027
|
+
activeScreen: fe,
|
|
2028
|
+
isHumanHandled: me,
|
|
2029
|
+
agentName: ge,
|
|
2030
|
+
agentHeadshot: ve
|
|
2031
2031
|
});
|
|
2032
2032
|
}, [
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2033
|
+
y,
|
|
2034
|
+
fe,
|
|
2035
|
+
me,
|
|
2036
|
+
ge,
|
|
2037
|
+
ve
|
|
2038
2038
|
]), i(() => {
|
|
2039
2039
|
let e = !0;
|
|
2040
2040
|
return (async () => {
|
|
@@ -2045,48 +2045,48 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2045
2045
|
});
|
|
2046
2046
|
let t = p(c);
|
|
2047
2047
|
console.log("[FlowEngageProvider] config validated", t);
|
|
2048
|
-
let n = await
|
|
2048
|
+
let n = await ce(t);
|
|
2049
2049
|
if (!e) return;
|
|
2050
|
-
let i =
|
|
2051
|
-
|
|
2052
|
-
let a =
|
|
2050
|
+
let i = ne();
|
|
2051
|
+
w.current = i;
|
|
2052
|
+
let a = le({
|
|
2053
2053
|
apiBaseUrl: t.apiBaseUrl,
|
|
2054
2054
|
userId: n.userId,
|
|
2055
2055
|
siteId: t.siteId
|
|
2056
2056
|
});
|
|
2057
|
-
|
|
2057
|
+
C.current = a, se({
|
|
2058
2058
|
...n,
|
|
2059
2059
|
apiBaseUrl: t.apiBaseUrl
|
|
2060
|
-
}),
|
|
2060
|
+
}), _(i), console.log("[FlowEngageProvider] bootstrap resolved", {
|
|
2061
2061
|
bootstrapData: n,
|
|
2062
2062
|
resolvedChatId: i
|
|
2063
2063
|
});
|
|
2064
|
-
let o =
|
|
2064
|
+
let o = Gt({
|
|
2065
2065
|
apiBaseUrl: t.apiBaseUrl,
|
|
2066
2066
|
userId: n.userId,
|
|
2067
2067
|
chatId: i,
|
|
2068
2068
|
siteId: t.siteId
|
|
2069
2069
|
});
|
|
2070
|
-
|
|
2071
|
-
console.log("[FlowEngageProvider] socket connected"),
|
|
2070
|
+
S.current = o, o.on("connect", () => {
|
|
2071
|
+
console.log("[FlowEngageProvider] socket connected"), De("connected");
|
|
2072
2072
|
}), o.on("disconnect", () => {
|
|
2073
|
-
console.log("[FlowEngageProvider] socket disconnected"),
|
|
2073
|
+
console.log("[FlowEngageProvider] socket disconnected"), De("disconnected");
|
|
2074
2074
|
}), o.on("aiTyping", () => {
|
|
2075
|
-
console.log("[FlowEngageProvider] received aiTyping", { chatId:
|
|
2075
|
+
console.log("[FlowEngageProvider] received aiTyping", { chatId: w.current }), Te(!0);
|
|
2076
2076
|
}), o.on("ai:typing", () => {
|
|
2077
|
-
console.log("[FlowEngageProvider] received ai:typing", { chatId:
|
|
2077
|
+
console.log("[FlowEngageProvider] received ai:typing", { chatId: w.current }), Te(!0);
|
|
2078
2078
|
}), o.on("messageReceived", (e) => {
|
|
2079
2079
|
let t = e.message || e, n = {
|
|
2080
2080
|
...t,
|
|
2081
|
-
message:
|
|
2081
|
+
message: rn(t.message)
|
|
2082
2082
|
};
|
|
2083
|
-
|
|
2083
|
+
Te(!1), Ce(!1), v((e) => [...e.filter((e) => !e.isPending), {
|
|
2084
2084
|
...n,
|
|
2085
2085
|
isPending: !1,
|
|
2086
2086
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
2087
2087
|
}]);
|
|
2088
2088
|
}), o.on("conversationStarted", (e) => {
|
|
2089
|
-
console.log("[FlowEngageProvider] conversationStarted", e), e?.message &&
|
|
2089
|
+
console.log("[FlowEngageProvider] conversationStarted", e), e?.message && v((t) => [...t, {
|
|
2090
2090
|
id: `system-start-${Date.now()}`,
|
|
2091
2091
|
sender: "system",
|
|
2092
2092
|
message: e.message,
|
|
@@ -2096,9 +2096,9 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2096
2096
|
}), o.on("message:new", (e) => {
|
|
2097
2097
|
let t = e.message || e, n = {
|
|
2098
2098
|
...t,
|
|
2099
|
-
message:
|
|
2099
|
+
message: rn(t.message)
|
|
2100
2100
|
};
|
|
2101
|
-
|
|
2101
|
+
Te(!1), (n.sender === "agent" || n.agent_name || n.sender === "ai" || n.sender === "bot") && Ce(!1), v((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
|
|
2102
2102
|
...n,
|
|
2103
2103
|
isPending: !1,
|
|
2104
2104
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
@@ -2110,14 +2110,14 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2110
2110
|
...n,
|
|
2111
2111
|
isPending: !1,
|
|
2112
2112
|
id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
|
|
2113
|
-
}]), (n.sender === "agent" || n.agent_name) && (
|
|
2113
|
+
}]), (n.sender === "agent" || n.agent_name) && (he(!0), pe("agent"), _e(ln([
|
|
2114
2114
|
n.agent_name,
|
|
2115
2115
|
n.agentName,
|
|
2116
2116
|
n.metadata?.agentName
|
|
2117
|
-
], u)), n.sender_headshot &&
|
|
2117
|
+
], u)), n.sender_headshot && ye(n.sender_headshot), de(!0));
|
|
2118
2118
|
}), o.on("agent:joined", (e) => {
|
|
2119
|
-
let t =
|
|
2120
|
-
|
|
2119
|
+
let t = ln([e.agent?.name, e.agentName], u);
|
|
2120
|
+
he(!0), pe("agent"), _e(t), ye(e.agent?.headshot || null), de(!0), v((e) => [...e, {
|
|
2121
2121
|
id: `agent-joined-${Date.now()}`,
|
|
2122
2122
|
sender: "system",
|
|
2123
2123
|
message: `${t} has joined the chat.`,
|
|
@@ -2125,8 +2125,8 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2125
2125
|
isPending: !1
|
|
2126
2126
|
}]);
|
|
2127
2127
|
}), o.on("agentJoined", (e) => {
|
|
2128
|
-
let t =
|
|
2129
|
-
|
|
2128
|
+
let t = ln([e.agent?.name, e.agentName], u);
|
|
2129
|
+
he(!0), pe("agent"), _e(t), ye(e.agent?.headshot || null), de(!0), v((e) => [...e, {
|
|
2130
2130
|
id: `agent-joined-${Date.now()}`,
|
|
2131
2131
|
sender: "system",
|
|
2132
2132
|
message: `${t} has joined the chat.`,
|
|
@@ -2134,12 +2134,12 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2134
2134
|
isPending: !1
|
|
2135
2135
|
}]);
|
|
2136
2136
|
}), o.on("agent:left", (e = {}) => {
|
|
2137
|
-
let t =
|
|
2137
|
+
let t = ln([
|
|
2138
2138
|
e.agent?.name,
|
|
2139
2139
|
e.agentName,
|
|
2140
|
-
|
|
2140
|
+
ge
|
|
2141
2141
|
], u);
|
|
2142
|
-
|
|
2142
|
+
he(!1), pe("ai"), v((e) => [...e, {
|
|
2143
2143
|
id: `agent-left-${Date.now()}`,
|
|
2144
2144
|
sender: "system",
|
|
2145
2145
|
message: `${t} has left the chat.`,
|
|
@@ -2147,12 +2147,12 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2147
2147
|
isPending: !1
|
|
2148
2148
|
}]);
|
|
2149
2149
|
}), o.on("agentLeft", (e = {}) => {
|
|
2150
|
-
let t =
|
|
2150
|
+
let t = ln([
|
|
2151
2151
|
e.agent?.name,
|
|
2152
2152
|
e.agentName,
|
|
2153
|
-
|
|
2153
|
+
ge
|
|
2154
2154
|
], u);
|
|
2155
|
-
|
|
2155
|
+
he(!1), pe("ai"), v((e) => [...e, {
|
|
2156
2156
|
id: `agent-left-${Date.now()}`,
|
|
2157
2157
|
sender: "system",
|
|
2158
2158
|
message: `${t} has left the chat.`,
|
|
@@ -2160,9 +2160,9 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2160
2160
|
isPending: !1
|
|
2161
2161
|
}]);
|
|
2162
2162
|
}), o.on("conversationEnded", (e) => {
|
|
2163
|
-
|
|
2163
|
+
Ie(!0);
|
|
2164
2164
|
let t = e?.message || "This conversation has ended. Thank you for reaching out!";
|
|
2165
|
-
|
|
2165
|
+
v((e) => [...e, {
|
|
2166
2166
|
id: `conversation-ended-${Date.now()}`,
|
|
2167
2167
|
sender: "system",
|
|
2168
2168
|
message: t,
|
|
@@ -2170,42 +2170,42 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2170
2170
|
isPending: !1
|
|
2171
2171
|
}]);
|
|
2172
2172
|
}), o.on("chat:history_update", (e) => {
|
|
2173
|
-
|
|
2173
|
+
v(an(e.chat_history || []));
|
|
2174
2174
|
}), o.on("typing:start", (e) => {
|
|
2175
2175
|
console.log("[FlowEngageProvider] received typing:start", {
|
|
2176
|
-
chatId: e?.chatId ||
|
|
2176
|
+
chatId: e?.chatId || w.current,
|
|
2177
2177
|
sender: e?.sender
|
|
2178
|
-
}), e.sender === "agent" &&
|
|
2178
|
+
}), e.sender === "agent" && Ce(!0);
|
|
2179
2179
|
}), o.on("typing:stop", (e) => {
|
|
2180
2180
|
console.log("[FlowEngageProvider] received typing:stop", {
|
|
2181
|
-
chatId: e?.chatId ||
|
|
2181
|
+
chatId: e?.chatId || w.current,
|
|
2182
2182
|
sender: e?.sender
|
|
2183
|
-
}), e.sender === "agent" &&
|
|
2183
|
+
}), e.sender === "agent" && Ce(!1);
|
|
2184
2184
|
}), o.on("call:incoming", (e = {}) => {
|
|
2185
|
-
let t =
|
|
2185
|
+
let t = ln([
|
|
2186
2186
|
e.agentName,
|
|
2187
2187
|
e.ownerName,
|
|
2188
2188
|
e.agent?.name,
|
|
2189
|
-
|
|
2189
|
+
ge
|
|
2190
2190
|
], u);
|
|
2191
2191
|
console.log("[FlowEngageProvider] received call:incoming", {
|
|
2192
2192
|
callId: e.callId,
|
|
2193
|
-
chatId:
|
|
2193
|
+
chatId: w.current,
|
|
2194
2194
|
agentName: t
|
|
2195
|
-
}),
|
|
2195
|
+
}), lt(), nt.current = !1, Le({
|
|
2196
2196
|
callId: e.callId,
|
|
2197
2197
|
from: e.from || "owner",
|
|
2198
2198
|
agentId: e.agentId || null,
|
|
2199
2199
|
agentName: t
|
|
2200
|
-
}),
|
|
2200
|
+
}), _e((e) => ln([t, e], u)), Ve("incoming"), Ue(null), de(!0);
|
|
2201
2201
|
}), o.on("call:offer", async (e = {}) => {
|
|
2202
2202
|
console.log("[FlowEngageProvider] received call:offer", {
|
|
2203
2203
|
callId: e.callId,
|
|
2204
|
-
chatId: e.chatId ||
|
|
2204
|
+
chatId: e.chatId || w.current,
|
|
2205
2205
|
offerLength: (e.sdpOffer || e.offer?.sdp || "").length
|
|
2206
|
-
}),
|
|
2206
|
+
}), Qe.current = e;
|
|
2207
2207
|
try {
|
|
2208
|
-
await
|
|
2208
|
+
await ht(e);
|
|
2209
2209
|
} catch (e) {
|
|
2210
2210
|
console.error("[FlowEngageProvider] failed to apply remote offer", e);
|
|
2211
2211
|
}
|
|
@@ -2213,95 +2213,95 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2213
2213
|
if (!e.candidate) {
|
|
2214
2214
|
console.log("[FlowEngageProvider] skipping agent ICE candidate", {
|
|
2215
2215
|
callId: e.callId,
|
|
2216
|
-
chatId: e.chatId ||
|
|
2217
|
-
hasPeerConnection: !!
|
|
2216
|
+
chatId: e.chatId || w.current,
|
|
2217
|
+
hasPeerConnection: !!Ye.current,
|
|
2218
2218
|
hasCandidate: !!e.candidate
|
|
2219
2219
|
});
|
|
2220
2220
|
return;
|
|
2221
2221
|
}
|
|
2222
2222
|
try {
|
|
2223
|
-
let t =
|
|
2223
|
+
let t = sn(e);
|
|
2224
2224
|
if (!t) {
|
|
2225
2225
|
console.warn("[FlowEngageProvider] ignoring invalid ICE candidate payload", e);
|
|
2226
2226
|
return;
|
|
2227
2227
|
}
|
|
2228
2228
|
if (console.log("[FlowEngageProvider] adding agent ICE candidate", {
|
|
2229
2229
|
callId: e.callId,
|
|
2230
|
-
chatId: e.chatId ||
|
|
2231
|
-
candidate:
|
|
2232
|
-
hasRemoteDescription: !!
|
|
2233
|
-
}), !
|
|
2230
|
+
chatId: e.chatId || w.current,
|
|
2231
|
+
candidate: cn(t),
|
|
2232
|
+
hasRemoteDescription: !!Ye.current?.remoteDescription
|
|
2233
|
+
}), !Ye.current || !Ye.current.remoteDescription) {
|
|
2234
2234
|
console.log("[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready", {
|
|
2235
2235
|
callId: e.callId,
|
|
2236
|
-
chatId: e.chatId ||
|
|
2237
|
-
queueSize:
|
|
2238
|
-
}),
|
|
2236
|
+
chatId: e.chatId || w.current,
|
|
2237
|
+
queueSize: $e.current.length + 1
|
|
2238
|
+
}), $e.current.push(t);
|
|
2239
2239
|
return;
|
|
2240
2240
|
}
|
|
2241
|
-
await
|
|
2241
|
+
await Ye.current.addIceCandidate(new RTCIceCandidate(t));
|
|
2242
2242
|
} catch (e) {
|
|
2243
2243
|
console.error("[FlowEngageProvider] failed to add ICE candidate", e);
|
|
2244
2244
|
}
|
|
2245
2245
|
}), o.on("call:ended", () => {
|
|
2246
|
-
|
|
2246
|
+
lt(), dt();
|
|
2247
2247
|
}), o.on("call:accepted", (e = {}) => {
|
|
2248
2248
|
console.log("[FlowEngageProvider] received call:accepted", {
|
|
2249
2249
|
callId: e.callId,
|
|
2250
|
-
chatId: e.chatId ||
|
|
2251
|
-
}),
|
|
2250
|
+
chatId: e.chatId || w.current
|
|
2251
|
+
}), pt(e);
|
|
2252
2252
|
}), o.on("call:accepted_by_other", (e = {}) => {
|
|
2253
2253
|
console.log("[FlowEngageProvider] received call:accepted_by_other", {
|
|
2254
2254
|
callId: e.callId,
|
|
2255
|
-
chatId: e.chatId ||
|
|
2256
|
-
}),
|
|
2255
|
+
chatId: e.chatId || w.current
|
|
2256
|
+
}), pt(e);
|
|
2257
2257
|
}), o.on("call:rejected", (e = {}) => {
|
|
2258
2258
|
console.log("[FlowEngageProvider] received call:rejected", {
|
|
2259
2259
|
callId: e.callId,
|
|
2260
|
-
chatId: e.chatId ||
|
|
2260
|
+
chatId: e.chatId || w.current,
|
|
2261
2261
|
reason: e.reason
|
|
2262
|
-
}),
|
|
2262
|
+
}), mt(e);
|
|
2263
2263
|
}), o.on("call:missed", (e = {}) => {
|
|
2264
2264
|
console.log("[FlowEngageProvider] received call:missed", {
|
|
2265
2265
|
callId: e.callId,
|
|
2266
|
-
chatId: e.chatId ||
|
|
2266
|
+
chatId: e.chatId || w.current,
|
|
2267
2267
|
reason: e.reason
|
|
2268
|
-
}),
|
|
2268
|
+
}), mt(e);
|
|
2269
2269
|
}), o.on("call:failed", (e = {}) => {
|
|
2270
2270
|
console.log("[FlowEngageProvider] received call:failed", {
|
|
2271
2271
|
callId: e.callId,
|
|
2272
|
-
chatId: e.chatId ||
|
|
2272
|
+
chatId: e.chatId || w.current,
|
|
2273
2273
|
reason: e.reason
|
|
2274
|
-
}),
|
|
2274
|
+
}), mt(e);
|
|
2275
2275
|
}), o.on("call:connected", (e = {}) => {
|
|
2276
2276
|
if (!e.callId) return;
|
|
2277
|
-
let t =
|
|
2277
|
+
let t = tt.current === e.callId, n = et.current === e.callId, r = Je.current?.callId === e.callId;
|
|
2278
2278
|
if (console.log("[FlowEngageProvider] received call:connected", {
|
|
2279
2279
|
callId: e.callId,
|
|
2280
|
-
chatId: e.chatId ||
|
|
2280
|
+
chatId: e.chatId || w.current,
|
|
2281
2281
|
connectedAt: e.connectedAt,
|
|
2282
2282
|
status: e.status,
|
|
2283
2283
|
isAcceptingHere: t,
|
|
2284
2284
|
isAlreadyActive: n,
|
|
2285
2285
|
isIncomingHere: r
|
|
2286
2286
|
}), !t && !n) {
|
|
2287
|
-
r && (
|
|
2287
|
+
r && (Le(null), Ve("idle"));
|
|
2288
2288
|
return;
|
|
2289
2289
|
}
|
|
2290
|
-
|
|
2290
|
+
nt.current = !0, tt.current = null, et.current = e.callId, ze(e.callId), Le(null), Ve("connected"), Ue(e.connectedAt || (/* @__PURE__ */ new Date()).toISOString()), de(!0);
|
|
2291
2291
|
}), o.on("call:unavailable", (e = {}) => {
|
|
2292
|
-
|
|
2292
|
+
dt(), qe(on(e, "This visitor is not available for a call right now.")), de(!0);
|
|
2293
2293
|
}), o.on("call:error", (e = {}) => {
|
|
2294
|
-
|
|
2294
|
+
dt(), qe(on(e, "We couldn't connect the call right now.")), de(!0);
|
|
2295
2295
|
}), o.on("visitor:navigate", ({ url: e, section: t, highlight: n } = {}) => {
|
|
2296
2296
|
e && (console.log("[FlowEngageProvider] visitor:navigate", {
|
|
2297
2297
|
url: e,
|
|
2298
2298
|
section: t,
|
|
2299
2299
|
highlight: n
|
|
2300
|
-
}),
|
|
2300
|
+
}), nn(e).then((e) => {
|
|
2301
2301
|
let r = t || n;
|
|
2302
2302
|
r && setTimeout(() => {
|
|
2303
|
-
let e =
|
|
2304
|
-
e &&
|
|
2303
|
+
let e = Qt(null, r);
|
|
2304
|
+
e && $t(e);
|
|
2305
2305
|
}, e ? 300 : 150);
|
|
2306
2306
|
}));
|
|
2307
2307
|
}), o.on("visitor:highlight", ({ sectionId: e, sectionText: t } = {}) => {
|
|
@@ -2310,200 +2310,200 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2310
2310
|
sectionId: e,
|
|
2311
2311
|
sectionText: t
|
|
2312
2312
|
});
|
|
2313
|
-
let n =
|
|
2314
|
-
n &&
|
|
2313
|
+
let n = Qt(e || null, t || null);
|
|
2314
|
+
n && $t(n);
|
|
2315
2315
|
}), o.on("visitor:clear_highlight", () => {
|
|
2316
|
-
|
|
2317
|
-
}),
|
|
2316
|
+
en();
|
|
2317
|
+
}), st.current = Kt({
|
|
2318
2318
|
socket: o,
|
|
2319
2319
|
chatId: i
|
|
2320
2320
|
}), console.log("[FlowEngageProvider] tracking started", { chatId: i });
|
|
2321
2321
|
let s = await a.loadHistory(i, r);
|
|
2322
|
-
if (console.log("[FlowEngageProvider] history loaded", s), !e || (
|
|
2322
|
+
if (console.log("[FlowEngageProvider] history loaded", s), !e || (v(an(s.chat_history || [])), he(!!s.is_human_handled), pe(s.is_human_handled ? "agent" : fe), await new Promise((e) => setTimeout(e, 500)), !e)) return;
|
|
2323
2323
|
try {
|
|
2324
2324
|
await a.startConversation(i, r);
|
|
2325
2325
|
} catch {}
|
|
2326
2326
|
f("ready"), console.log("[FlowEngageProvider] status ready");
|
|
2327
2327
|
} catch (t) {
|
|
2328
2328
|
if (!e) return;
|
|
2329
|
-
console.error("[FlowEngageProvider] boot failed", t),
|
|
2329
|
+
console.error("[FlowEngageProvider] boot failed", t), ee(t), f("error");
|
|
2330
2330
|
}
|
|
2331
2331
|
})(), () => {
|
|
2332
|
-
e = !1,
|
|
2332
|
+
e = !1, st.current?.cleanup?.(), dt(), S.current?.disconnect();
|
|
2333
2333
|
};
|
|
2334
2334
|
}, [c, r]), i(() => () => {
|
|
2335
|
-
if (
|
|
2336
|
-
let e =
|
|
2337
|
-
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(r, i, e, t) || n.syncVoice(e, t).catch(() => {}),
|
|
2335
|
+
if (Ne && !ot.current && at.current.length > 0) {
|
|
2336
|
+
let e = w.current, t = at.current, n = C.current, r = h?.apiBaseUrl || "", i = h?.userId || "";
|
|
2337
|
+
n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(r, i, e, t) || n.syncVoice(e, t).catch(() => {}), ot.current = !0);
|
|
2338
2338
|
}
|
|
2339
|
-
}, [
|
|
2340
|
-
if (!
|
|
2339
|
+
}, [Ne, h]), i(() => {
|
|
2340
|
+
if (!C.current || !g || d !== "ready" || me) return;
|
|
2341
2341
|
let e = window.setInterval(async () => {
|
|
2342
2342
|
try {
|
|
2343
|
-
let e = await
|
|
2344
|
-
|
|
2343
|
+
let e = await C.current.checkHumanHandled(g);
|
|
2344
|
+
he(!!e.is_human_handled), e.is_human_handled && (pe("agent"), e.agent_info?.name && _e(e.agent_info.name), e.agent_info?.headshot && ye(e.agent_info.headshot));
|
|
2345
2345
|
} catch {}
|
|
2346
2346
|
}, 1e4);
|
|
2347
2347
|
return () => window.clearInterval(e);
|
|
2348
2348
|
}, [
|
|
2349
|
-
|
|
2349
|
+
g,
|
|
2350
2350
|
d,
|
|
2351
|
-
|
|
2351
|
+
me
|
|
2352
2352
|
]);
|
|
2353
|
-
let
|
|
2354
|
-
if (!(!
|
|
2355
|
-
|
|
2356
|
-
callId:
|
|
2357
|
-
chatId:
|
|
2358
|
-
socketConnected: !!
|
|
2359
|
-
hasPendingOffer:
|
|
2353
|
+
let gt = async () => {
|
|
2354
|
+
if (!(!x?.callId || !C.current || !S.current || !g)) {
|
|
2355
|
+
lt(), tt.current = x.callId, console.log("[FlowEngageProvider] acceptCall started", {
|
|
2356
|
+
callId: x?.callId,
|
|
2357
|
+
chatId: g,
|
|
2358
|
+
socketConnected: !!S.current?.connected,
|
|
2359
|
+
hasPendingOffer: !!Qe.current
|
|
2360
2360
|
});
|
|
2361
2361
|
try {
|
|
2362
2362
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
2363
2363
|
console.log("[FlowEngageProvider] microphone stream acquired", {
|
|
2364
|
-
callId:
|
|
2365
|
-
chatId:
|
|
2364
|
+
callId: x.callId,
|
|
2365
|
+
chatId: g,
|
|
2366
2366
|
trackCount: e.getTracks().length
|
|
2367
|
-
}),
|
|
2367
|
+
}), Xe.current = e;
|
|
2368
2368
|
let t = new RTCPeerConnection({ iceServers: [{ urls: "stun:stun.l.google.com:19302" }] });
|
|
2369
|
-
|
|
2369
|
+
Ye.current = t, t.onconnectionstatechange = () => {
|
|
2370
2370
|
let e = t.connectionState;
|
|
2371
2371
|
if (console.log("[FlowEngageProvider] peer connection state changed", {
|
|
2372
|
-
callId:
|
|
2373
|
-
chatId:
|
|
2372
|
+
callId: x.callId,
|
|
2373
|
+
chatId: g,
|
|
2374
2374
|
connectionState: e,
|
|
2375
2375
|
iceConnectionState: t.iceConnectionState,
|
|
2376
2376
|
signalingState: t.signalingState
|
|
2377
2377
|
}), e === "connected") {
|
|
2378
2378
|
let e = (/* @__PURE__ */ new Date()).toISOString();
|
|
2379
|
-
|
|
2379
|
+
Ve("connected"), Ue((t) => t || e), ft(e);
|
|
2380
2380
|
return;
|
|
2381
2381
|
}
|
|
2382
|
-
e === "connecting" &&
|
|
2382
|
+
e === "connecting" && Ve((e) => e === "connected" ? e : "connecting");
|
|
2383
2383
|
}, t.oniceconnectionstatechange = () => {
|
|
2384
2384
|
let e = t.iceConnectionState;
|
|
2385
2385
|
if (console.log("[FlowEngageProvider] ICE connection state changed", {
|
|
2386
|
-
callId:
|
|
2387
|
-
chatId:
|
|
2386
|
+
callId: x.callId,
|
|
2387
|
+
chatId: g,
|
|
2388
2388
|
iceConnectionState: e,
|
|
2389
2389
|
connectionState: t.connectionState,
|
|
2390
2390
|
signalingState: t.signalingState
|
|
2391
2391
|
}), e === "connected" || e === "completed") {
|
|
2392
2392
|
let e = (/* @__PURE__ */ new Date()).toISOString();
|
|
2393
|
-
|
|
2393
|
+
Ve("connected"), Ue((t) => t || e), ft(e);
|
|
2394
2394
|
return;
|
|
2395
2395
|
}
|
|
2396
|
-
(e === "checking" || e === "new") &&
|
|
2396
|
+
(e === "checking" || e === "new") && Ve((e) => e === "connected" ? e : "connecting");
|
|
2397
2397
|
}, e.getTracks().forEach((n) => {
|
|
2398
2398
|
t.addTrack(n, e);
|
|
2399
2399
|
}), t.onicecandidate = (e) => {
|
|
2400
|
-
if (!e.candidate || !
|
|
2400
|
+
if (!e.candidate || !S.current?.connected) {
|
|
2401
2401
|
console.log("[FlowEngageProvider] local ICE candidate skipped", {
|
|
2402
|
-
callId:
|
|
2403
|
-
chatId:
|
|
2402
|
+
callId: x.callId,
|
|
2403
|
+
chatId: g,
|
|
2404
2404
|
hasCandidate: !!e.candidate,
|
|
2405
|
-
socketConnected: !!
|
|
2405
|
+
socketConnected: !!S.current?.connected
|
|
2406
2406
|
});
|
|
2407
2407
|
return;
|
|
2408
2408
|
}
|
|
2409
2409
|
console.log("[FlowEngageProvider] emitting local ICE candidate", {
|
|
2410
|
-
callId:
|
|
2411
|
-
chatId:
|
|
2412
|
-
candidate:
|
|
2413
|
-
}),
|
|
2414
|
-
callId:
|
|
2410
|
+
callId: x.callId,
|
|
2411
|
+
chatId: g,
|
|
2412
|
+
candidate: cn(e.candidate)
|
|
2413
|
+
}), S.current.emit("call:ice-candidate", {
|
|
2414
|
+
callId: x.callId,
|
|
2415
2415
|
candidate: e.candidate,
|
|
2416
|
-
chatId:
|
|
2416
|
+
chatId: g,
|
|
2417
2417
|
from: "customer"
|
|
2418
2418
|
});
|
|
2419
2419
|
}, t.ontrack = (e) => {
|
|
2420
2420
|
if (console.log("[FlowEngageProvider] remote audio track received", {
|
|
2421
|
-
callId:
|
|
2422
|
-
chatId:
|
|
2421
|
+
callId: x.callId,
|
|
2422
|
+
chatId: g,
|
|
2423
2423
|
streamCount: e.streams?.length || 0
|
|
2424
|
-
}), !
|
|
2424
|
+
}), !Ze.current) {
|
|
2425
2425
|
let e = document.createElement("audio");
|
|
2426
|
-
e.id = "flowengage-remote-audio", e.autoplay = !0,
|
|
2426
|
+
e.id = "flowengage-remote-audio", e.autoplay = !0, Ze.current = e, document.body.appendChild(e);
|
|
2427
2427
|
}
|
|
2428
|
-
|
|
2428
|
+
Ze.current.srcObject = e.streams[0];
|
|
2429
2429
|
};
|
|
2430
|
-
let n =
|
|
2430
|
+
let n = Qe.current;
|
|
2431
2431
|
n && (console.log("[FlowEngageProvider] found pending remote offer during accept", {
|
|
2432
|
-
callId: n.callId ||
|
|
2433
|
-
chatId:
|
|
2434
|
-
}), await
|
|
2432
|
+
callId: n.callId || x.callId,
|
|
2433
|
+
chatId: g
|
|
2434
|
+
}), await ht({
|
|
2435
2435
|
...n,
|
|
2436
|
-
callId: n.callId ||
|
|
2437
|
-
})), await
|
|
2438
|
-
callId:
|
|
2439
|
-
chatId:
|
|
2440
|
-
}),
|
|
2436
|
+
callId: n.callId || x.callId
|
|
2437
|
+
})), await C.current.acceptCall(x.callId, g), console.log("[FlowEngageProvider] acceptCall API succeeded", {
|
|
2438
|
+
callId: x.callId,
|
|
2439
|
+
chatId: g
|
|
2440
|
+
}), et.current = x.callId, ze(x.callId), Ve("connecting"), Le(null), de(!0);
|
|
2441
2441
|
} catch (e) {
|
|
2442
|
-
if (console.error("[FlowEngageProvider] acceptCall failed", e),
|
|
2443
|
-
|
|
2442
|
+
if (console.error("[FlowEngageProvider] acceptCall failed", e), tt.current = null, dt(), e?.status === 404 || e?.status === 409 || e?.status === 422) {
|
|
2443
|
+
qe(on(e, "This visitor call is no longer available."));
|
|
2444
2444
|
return;
|
|
2445
2445
|
}
|
|
2446
2446
|
if (e?.name === "NotAllowedError" || e?.name === "PermissionDeniedError") {
|
|
2447
2447
|
try {
|
|
2448
|
-
await
|
|
2448
|
+
await C.current.rejectCall(x.callId, g);
|
|
2449
2449
|
} catch (e) {
|
|
2450
2450
|
console.error("[FlowEngageProvider] failed to reject call after microphone denial", e);
|
|
2451
2451
|
}
|
|
2452
|
-
|
|
2452
|
+
qe("Microphone access was denied. Please allow microphone access to accept the call.");
|
|
2453
2453
|
return;
|
|
2454
2454
|
}
|
|
2455
|
-
|
|
2455
|
+
qe("We couldn't connect the call right now. Please try again.");
|
|
2456
2456
|
}
|
|
2457
2457
|
}
|
|
2458
|
-
},
|
|
2459
|
-
if (!
|
|
2460
|
-
|
|
2458
|
+
}, _t = async () => {
|
|
2459
|
+
if (!x?.callId || !C.current || !g) {
|
|
2460
|
+
dt();
|
|
2461
2461
|
return;
|
|
2462
2462
|
}
|
|
2463
|
-
|
|
2463
|
+
lt();
|
|
2464
2464
|
try {
|
|
2465
|
-
await
|
|
2465
|
+
await C.current.rejectCall(x.callId, g);
|
|
2466
2466
|
} catch (e) {
|
|
2467
|
-
console.error("[FlowEngageProvider] rejectCall failed", e),
|
|
2467
|
+
console.error("[FlowEngageProvider] rejectCall failed", e), qe(on(e, "We couldn't decline the call cleanly."));
|
|
2468
2468
|
} finally {
|
|
2469
|
-
|
|
2469
|
+
dt();
|
|
2470
2470
|
}
|
|
2471
|
-
},
|
|
2472
|
-
if (!
|
|
2473
|
-
|
|
2471
|
+
}, vt = async () => {
|
|
2472
|
+
if (!Re || !C.current || !g) {
|
|
2473
|
+
dt();
|
|
2474
2474
|
return;
|
|
2475
2475
|
}
|
|
2476
|
-
|
|
2476
|
+
lt();
|
|
2477
2477
|
try {
|
|
2478
|
-
await
|
|
2478
|
+
await C.current.endWebRTCCall(Re, g);
|
|
2479
2479
|
} catch (e) {
|
|
2480
|
-
console.error("[FlowEngageProvider] endWebRTCCall failed", e),
|
|
2480
|
+
console.error("[FlowEngageProvider] endWebRTCCall failed", e), qe(on(e, "The call ended locally, but the server could not be updated."));
|
|
2481
2481
|
} finally {
|
|
2482
|
-
|
|
2482
|
+
dt();
|
|
2483
2483
|
}
|
|
2484
|
-
},
|
|
2485
|
-
let e =
|
|
2484
|
+
}, yt = () => {
|
|
2485
|
+
let e = Xe.current?.getAudioTracks?.() || [], t = Ye.current?.getSenders?.().map((e) => e.track).filter((e) => e?.kind === "audio") || [], n = [...e, ...t].filter(Boolean);
|
|
2486
2486
|
if (n.length === 0) {
|
|
2487
2487
|
console.warn("[FlowEngageProvider] no local audio tracks available for mute");
|
|
2488
2488
|
return;
|
|
2489
2489
|
}
|
|
2490
|
-
let r = !
|
|
2490
|
+
let r = !We;
|
|
2491
2491
|
n.forEach((e) => {
|
|
2492
2492
|
e.enabled = !r;
|
|
2493
2493
|
}), console.log("[FlowEngageProvider] toggled local mute", {
|
|
2494
2494
|
nextMuted: r,
|
|
2495
2495
|
trackCount: n.length
|
|
2496
|
-
}),
|
|
2497
|
-
},
|
|
2498
|
-
if (
|
|
2499
|
-
await
|
|
2496
|
+
}), Ge(r);
|
|
2497
|
+
}, bt = async () => {
|
|
2498
|
+
if (de(!0), C.current && g) try {
|
|
2499
|
+
await C.current.updateChatStatus(g, "open");
|
|
2500
2500
|
} catch {}
|
|
2501
|
-
},
|
|
2502
|
-
let t =
|
|
2503
|
-
if (!t || !
|
|
2501
|
+
}, xt = async (e) => {
|
|
2502
|
+
let t = ut(e);
|
|
2503
|
+
if (!t || !C.current || !w.current) return t;
|
|
2504
2504
|
try {
|
|
2505
|
-
await
|
|
2506
|
-
chatId:
|
|
2505
|
+
await C.current.trackVisitor({
|
|
2506
|
+
chatId: w.current,
|
|
2507
2507
|
currentPagePath: typeof window < "u" && window.location.pathname || "/",
|
|
2508
2508
|
email: t
|
|
2509
2509
|
});
|
|
@@ -2511,67 +2511,67 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2511
2511
|
console.error("[FlowEngageProvider] failed to persist visitor email", e);
|
|
2512
2512
|
}
|
|
2513
2513
|
return t;
|
|
2514
|
-
},
|
|
2515
|
-
if (!
|
|
2514
|
+
}, St = () => {
|
|
2515
|
+
if (!g || !S.current?.connected || rt.current) {
|
|
2516
2516
|
console.log("[FlowEngageProvider] skipped typing:start emit", {
|
|
2517
|
-
chatId:
|
|
2518
|
-
socketConnected: !!
|
|
2519
|
-
alreadyTyping:
|
|
2517
|
+
chatId: g,
|
|
2518
|
+
socketConnected: !!S.current?.connected,
|
|
2519
|
+
alreadyTyping: rt.current
|
|
2520
2520
|
});
|
|
2521
2521
|
return;
|
|
2522
2522
|
}
|
|
2523
|
-
|
|
2524
|
-
chatId:
|
|
2523
|
+
rt.current = !0, console.log("[FlowEngageProvider] emitting typing:start", {
|
|
2524
|
+
chatId: g,
|
|
2525
2525
|
sender: "user"
|
|
2526
|
-
}),
|
|
2527
|
-
chatId:
|
|
2526
|
+
}), S.current.emit("typing:start", {
|
|
2527
|
+
chatId: g,
|
|
2528
2528
|
sender: "user"
|
|
2529
2529
|
});
|
|
2530
|
-
},
|
|
2531
|
-
if (
|
|
2532
|
-
chatId:
|
|
2530
|
+
}, Ct = () => {
|
|
2531
|
+
if (g && S.current?.connected && it.current !== "" && (console.log("[FlowEngageProvider] clearing typing draft", {
|
|
2532
|
+
chatId: g,
|
|
2533
2533
|
sender: "user"
|
|
2534
|
-
}),
|
|
2535
|
-
chatId:
|
|
2534
|
+
}), S.current.emit("typing:update", {
|
|
2535
|
+
chatId: g,
|
|
2536
2536
|
sender: "user",
|
|
2537
2537
|
text: ""
|
|
2538
|
-
}),
|
|
2538
|
+
}), it.current = ""), !g || !S.current?.connected || !rt.current) {
|
|
2539
2539
|
console.log("[FlowEngageProvider] skipped typing:stop emit", {
|
|
2540
|
-
chatId:
|
|
2541
|
-
socketConnected: !!
|
|
2542
|
-
wasTyping:
|
|
2540
|
+
chatId: g,
|
|
2541
|
+
socketConnected: !!S.current?.connected,
|
|
2542
|
+
wasTyping: rt.current
|
|
2543
2543
|
});
|
|
2544
2544
|
return;
|
|
2545
2545
|
}
|
|
2546
|
-
|
|
2547
|
-
chatId:
|
|
2546
|
+
rt.current = !1, console.log("[FlowEngageProvider] emitting typing:stop", {
|
|
2547
|
+
chatId: g,
|
|
2548
2548
|
sender: "user"
|
|
2549
|
-
}),
|
|
2550
|
-
chatId:
|
|
2549
|
+
}), S.current.emit("typing:stop", {
|
|
2550
|
+
chatId: g,
|
|
2551
2551
|
sender: "user"
|
|
2552
2552
|
});
|
|
2553
|
-
},
|
|
2553
|
+
}, wt = (e = "") => {
|
|
2554
2554
|
let t = typeof e == "string" ? e : "";
|
|
2555
|
-
if (!
|
|
2555
|
+
if (!g || !S.current?.connected) {
|
|
2556
2556
|
console.log("[FlowEngageProvider] skipped typing:update emit", {
|
|
2557
|
-
chatId:
|
|
2558
|
-
socketConnected: !!
|
|
2557
|
+
chatId: g,
|
|
2558
|
+
socketConnected: !!S.current?.connected,
|
|
2559
2559
|
textLength: t.length
|
|
2560
2560
|
});
|
|
2561
2561
|
return;
|
|
2562
2562
|
}
|
|
2563
|
-
|
|
2564
|
-
chatId:
|
|
2563
|
+
it.current !== t && (it.current = t, console.log("[FlowEngageProvider] emitting typing:update", {
|
|
2564
|
+
chatId: g,
|
|
2565
2565
|
sender: "user",
|
|
2566
2566
|
textLength: t.length
|
|
2567
|
-
}),
|
|
2568
|
-
chatId:
|
|
2567
|
+
}), S.current.emit("typing:update", {
|
|
2568
|
+
chatId: g,
|
|
2569
2569
|
sender: "user",
|
|
2570
2570
|
text: t
|
|
2571
2571
|
}));
|
|
2572
|
-
},
|
|
2573
|
-
if (!e.trim() || !
|
|
2574
|
-
|
|
2572
|
+
}, Tt = async (e, t = "", n = null) => {
|
|
2573
|
+
if (!e.trim() || !C.current || !g || d !== "ready" || Fe) return;
|
|
2574
|
+
Ct();
|
|
2575
2575
|
let i = `pending-user-${Date.now()}`, a = {
|
|
2576
2576
|
id: i,
|
|
2577
2577
|
sender: "user",
|
|
@@ -2580,64 +2580,64 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2580
2580
|
isPending: !0,
|
|
2581
2581
|
...n || {}
|
|
2582
2582
|
};
|
|
2583
|
-
if (
|
|
2584
|
-
|
|
2585
|
-
chatId:
|
|
2583
|
+
if (v((e) => [...e, a]), me && S.current?.connected) {
|
|
2584
|
+
S.current.emit("customer:message", {
|
|
2585
|
+
chatId: g,
|
|
2586
2586
|
content: e,
|
|
2587
2587
|
sender: "user",
|
|
2588
|
-
email:
|
|
2588
|
+
email: be || void 0,
|
|
2589
2589
|
...n || {}
|
|
2590
2590
|
});
|
|
2591
2591
|
return;
|
|
2592
2592
|
}
|
|
2593
|
-
|
|
2593
|
+
ke(!0);
|
|
2594
2594
|
try {
|
|
2595
|
-
let i = await
|
|
2595
|
+
let i = await C.current.sendAiMessage(g, e, r, t, {
|
|
2596
2596
|
...n || {},
|
|
2597
|
-
...
|
|
2597
|
+
...be ? { email: be } : {}
|
|
2598
2598
|
});
|
|
2599
|
-
|
|
2599
|
+
v(an(i.chat_history || [])), he(!!i.is_human_handled), pe(i.is_human_handled ? "agent" : "ai"), Te(!1), await C.current.updateChatStatus(g, "messageSent");
|
|
2600
2600
|
} catch (e) {
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
},
|
|
2601
|
+
v((e) => e.filter((e) => e.id !== i)), Te(!1), e.status === 429 ? (je(!0), b(e.message), window.setTimeout(() => {
|
|
2602
|
+
je(!1), b("");
|
|
2603
|
+
}, te)) : ee(e);
|
|
2604
2604
|
} finally {
|
|
2605
|
-
|
|
2605
|
+
ke(!1);
|
|
2606
2606
|
}
|
|
2607
|
-
},
|
|
2608
|
-
if (!(!
|
|
2607
|
+
}, Et = async (e) => {
|
|
2608
|
+
if (!(!C.current || !g)) {
|
|
2609
2609
|
try {
|
|
2610
2610
|
let t = e ? "voice" : "text";
|
|
2611
|
-
await
|
|
2611
|
+
await C.current.setChatMode(g, t);
|
|
2612
2612
|
} catch (e) {
|
|
2613
2613
|
console.error("[FlowEngageProvider] setVoiceMode failed", e);
|
|
2614
2614
|
}
|
|
2615
|
-
|
|
2615
|
+
Pe(e), e && (ot.current = !1);
|
|
2616
2616
|
}
|
|
2617
|
-
},
|
|
2618
|
-
if (!
|
|
2619
|
-
if (
|
|
2620
|
-
|
|
2617
|
+
}, Dt = async (e) => {
|
|
2618
|
+
if (!ot.current) {
|
|
2619
|
+
if (ot.current = !0, !C.current || !g || !e?.length) {
|
|
2620
|
+
Pe(!1);
|
|
2621
2621
|
return;
|
|
2622
2622
|
}
|
|
2623
2623
|
try {
|
|
2624
|
-
let t = await
|
|
2625
|
-
t?.chat_history &&
|
|
2624
|
+
let t = await C.current.syncVoice(g, e);
|
|
2625
|
+
t?.chat_history && v(an(t.chat_history));
|
|
2626
2626
|
} catch {} finally {
|
|
2627
|
-
|
|
2627
|
+
Pe(!1);
|
|
2628
2628
|
}
|
|
2629
2629
|
}
|
|
2630
|
-
},
|
|
2631
|
-
if (!(!
|
|
2632
|
-
|
|
2630
|
+
}, Ot = async () => {
|
|
2631
|
+
if (!(!C.current || !g)) {
|
|
2632
|
+
Ne && !ot.current && at.current.length > 0 && await Dt(at.current);
|
|
2633
2633
|
try {
|
|
2634
|
-
await
|
|
2634
|
+
await C.current.endConversation(g);
|
|
2635
2635
|
} catch {
|
|
2636
2636
|
try {
|
|
2637
|
-
await
|
|
2637
|
+
await C.current.updateChatStatus(g, "ended");
|
|
2638
2638
|
} catch {}
|
|
2639
2639
|
}
|
|
2640
|
-
|
|
2640
|
+
Ie(!0), v((e) => [...e, {
|
|
2641
2641
|
id: `conversation-ended-${Date.now()}`,
|
|
2642
2642
|
sender: "system",
|
|
2643
2643
|
message: "This conversation has ended. Thank you for reaching out!",
|
|
@@ -2647,140 +2647,140 @@ function dn({ siteId: e, config: t, children: n, language: r = "en" }) {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
};
|
|
2649
2649
|
i(() => {
|
|
2650
|
-
if (
|
|
2651
|
-
let e = new Date(
|
|
2652
|
-
|
|
2650
|
+
if (Be !== "connected" || !Re || !g || !He || !ct) return;
|
|
2651
|
+
let e = new Date(He).getTime(), t = Number.isFinite(e) ? Date.now() - e : 0, n = Math.max(0, ct * 1e3 - t), r = window.setTimeout(() => {
|
|
2652
|
+
qe("The call ended because it reached the time limit."), vt();
|
|
2653
2653
|
}, n);
|
|
2654
2654
|
return () => window.clearTimeout(r);
|
|
2655
2655
|
}, [
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2656
|
+
Re,
|
|
2657
|
+
He,
|
|
2658
|
+
Be,
|
|
2659
|
+
g,
|
|
2660
|
+
vt,
|
|
2661
|
+
ct
|
|
2662
2662
|
]), i(() => {
|
|
2663
2663
|
let e = () => {
|
|
2664
|
-
let e =
|
|
2664
|
+
let e = w.current, t = C.current;
|
|
2665
2665
|
if (!t || !e) return;
|
|
2666
|
-
if (
|
|
2667
|
-
t.beaconEndWebRTCCall(
|
|
2666
|
+
if (et.current) {
|
|
2667
|
+
t.beaconEndWebRTCCall(et.current, e);
|
|
2668
2668
|
return;
|
|
2669
2669
|
}
|
|
2670
|
-
let n =
|
|
2670
|
+
let n = tt.current || Je.current?.callId;
|
|
2671
2671
|
n && t.beaconCustomerUnavailable(n, e);
|
|
2672
2672
|
};
|
|
2673
2673
|
return window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), () => {
|
|
2674
2674
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
2675
2675
|
};
|
|
2676
2676
|
}, []);
|
|
2677
|
-
let
|
|
2677
|
+
let T = a(() => ({
|
|
2678
2678
|
status: d,
|
|
2679
2679
|
error: m,
|
|
2680
|
-
runtimeConfig:
|
|
2680
|
+
runtimeConfig: h,
|
|
2681
2681
|
resolvedConfig: c,
|
|
2682
|
-
chatId:
|
|
2682
|
+
chatId: g,
|
|
2683
2683
|
chatHistory: ue,
|
|
2684
|
-
isOpen:
|
|
2685
|
-
activeScreen:
|
|
2686
|
-
isHumanHandled:
|
|
2687
|
-
agentName:
|
|
2688
|
-
agentHeadshot:
|
|
2689
|
-
visitorEmail:
|
|
2690
|
-
isAgentTyping:
|
|
2691
|
-
isAiTyping:
|
|
2692
|
-
connectionStatus:
|
|
2693
|
-
isLoading:
|
|
2694
|
-
isVoiceMode:
|
|
2695
|
-
isRateLimited:
|
|
2696
|
-
rateLimitMessage:
|
|
2697
|
-
isConversationEnded:
|
|
2698
|
-
incomingCall:
|
|
2699
|
-
activeCallId:
|
|
2700
|
-
callConnectionState:
|
|
2701
|
-
callConnectedAt:
|
|
2702
|
-
isCallMuted:
|
|
2703
|
-
webRTCError:
|
|
2684
|
+
isOpen: y,
|
|
2685
|
+
activeScreen: fe,
|
|
2686
|
+
isHumanHandled: me,
|
|
2687
|
+
agentName: ge,
|
|
2688
|
+
agentHeadshot: ve,
|
|
2689
|
+
visitorEmail: be,
|
|
2690
|
+
isAgentTyping: Se,
|
|
2691
|
+
isAiTyping: we,
|
|
2692
|
+
connectionStatus: Ee,
|
|
2693
|
+
isLoading: Oe,
|
|
2694
|
+
isVoiceMode: Ne,
|
|
2695
|
+
isRateLimited: Ae,
|
|
2696
|
+
rateLimitMessage: Me,
|
|
2697
|
+
isConversationEnded: Fe,
|
|
2698
|
+
incomingCall: x,
|
|
2699
|
+
activeCallId: Re,
|
|
2700
|
+
callConnectionState: Be,
|
|
2701
|
+
callConnectedAt: He,
|
|
2702
|
+
isCallMuted: We,
|
|
2703
|
+
webRTCError: Ke,
|
|
2704
2704
|
language: r,
|
|
2705
|
-
historyRef:
|
|
2706
|
-
hasSyncedRef:
|
|
2707
|
-
dismissCallError:
|
|
2708
|
-
captureVisitorEmail:
|
|
2709
|
-
startTyping:
|
|
2710
|
-
stopTyping:
|
|
2711
|
-
updateTypingDraft:
|
|
2712
|
-
notifyRouteChange: () =>
|
|
2713
|
-
openWidget:
|
|
2714
|
-
closeWidget: () =>
|
|
2705
|
+
historyRef: at,
|
|
2706
|
+
hasSyncedRef: ot,
|
|
2707
|
+
dismissCallError: lt,
|
|
2708
|
+
captureVisitorEmail: xt,
|
|
2709
|
+
startTyping: St,
|
|
2710
|
+
stopTyping: Ct,
|
|
2711
|
+
updateTypingDraft: wt,
|
|
2712
|
+
notifyRouteChange: () => st.current?.notifyRouteChange?.(),
|
|
2713
|
+
openWidget: bt,
|
|
2714
|
+
closeWidget: () => de(!1),
|
|
2715
2715
|
toggleWidget: () => {
|
|
2716
|
-
if (
|
|
2717
|
-
|
|
2716
|
+
if (y) {
|
|
2717
|
+
de(!1);
|
|
2718
2718
|
return;
|
|
2719
2719
|
}
|
|
2720
|
-
|
|
2720
|
+
bt();
|
|
2721
2721
|
},
|
|
2722
|
-
sendMessage:
|
|
2723
|
-
setVoiceMode:
|
|
2724
|
-
onMessageSync:
|
|
2725
|
-
endConversation:
|
|
2726
|
-
acceptCall:
|
|
2727
|
-
rejectCall:
|
|
2728
|
-
endWebRTCCall:
|
|
2729
|
-
toggleCallMute:
|
|
2730
|
-
startTyping:
|
|
2731
|
-
stopTyping:
|
|
2732
|
-
updateTypingDraft:
|
|
2722
|
+
sendMessage: Tt,
|
|
2723
|
+
setVoiceMode: Et,
|
|
2724
|
+
onMessageSync: Dt,
|
|
2725
|
+
endConversation: Ot,
|
|
2726
|
+
acceptCall: gt,
|
|
2727
|
+
rejectCall: _t,
|
|
2728
|
+
endWebRTCCall: vt,
|
|
2729
|
+
toggleCallMute: yt,
|
|
2730
|
+
startTyping: St,
|
|
2731
|
+
stopTyping: Ct,
|
|
2732
|
+
updateTypingDraft: wt
|
|
2733
2733
|
}), [
|
|
2734
2734
|
d,
|
|
2735
2735
|
m,
|
|
2736
|
-
|
|
2736
|
+
h,
|
|
2737
2737
|
c,
|
|
2738
|
-
|
|
2738
|
+
g,
|
|
2739
2739
|
ue,
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
Pe,
|
|
2751
|
-
je,
|
|
2740
|
+
y,
|
|
2741
|
+
fe,
|
|
2742
|
+
me,
|
|
2743
|
+
ge,
|
|
2744
|
+
ve,
|
|
2745
|
+
be,
|
|
2746
|
+
Se,
|
|
2747
|
+
we,
|
|
2748
|
+
Ee,
|
|
2749
|
+
Oe,
|
|
2752
2750
|
Ne,
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2751
|
+
Ae,
|
|
2752
|
+
Me,
|
|
2753
|
+
Fe,
|
|
2754
|
+
x,
|
|
2755
|
+
Re,
|
|
2756
|
+
Be,
|
|
2757
|
+
He,
|
|
2758
|
+
We,
|
|
2759
|
+
Ke,
|
|
2760
2760
|
r,
|
|
2761
|
+
xt,
|
|
2761
2762
|
St,
|
|
2762
2763
|
Ct,
|
|
2763
2764
|
wt,
|
|
2764
|
-
|
|
2765
|
+
gt,
|
|
2765
2766
|
_t,
|
|
2766
2767
|
vt,
|
|
2767
2768
|
yt,
|
|
2768
2769
|
bt,
|
|
2769
|
-
|
|
2770
|
+
Tt,
|
|
2770
2771
|
Et,
|
|
2771
2772
|
Dt,
|
|
2772
2773
|
Ot,
|
|
2773
|
-
|
|
2774
|
-
ut
|
|
2774
|
+
lt
|
|
2775
2775
|
]);
|
|
2776
|
-
return /* @__PURE__ */ l(
|
|
2777
|
-
value:
|
|
2776
|
+
return /* @__PURE__ */ l(qt.Provider, {
|
|
2777
|
+
value: T,
|
|
2778
2778
|
children: n
|
|
2779
2779
|
});
|
|
2780
2780
|
}
|
|
2781
2781
|
//#endregion
|
|
2782
2782
|
//#region src/lib/svgIcons.jsx
|
|
2783
|
-
var
|
|
2783
|
+
var dn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
2784
2784
|
width: "40",
|
|
2785
2785
|
height: "40",
|
|
2786
2786
|
viewBox: "0 0 40 40",
|
|
@@ -2806,7 +2806,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2806
2806
|
fill: "#3E87C8"
|
|
2807
2807
|
})
|
|
2808
2808
|
]
|
|
2809
|
-
}),
|
|
2809
|
+
}), fn = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ u("svg", {
|
|
2810
2810
|
width: e,
|
|
2811
2811
|
height: e,
|
|
2812
2812
|
viewBox: "0 0 24 24",
|
|
@@ -2822,7 +2822,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2822
2822
|
strokeLinecap: "round",
|
|
2823
2823
|
strokeLinejoin: "round"
|
|
2824
2824
|
})]
|
|
2825
|
-
}),
|
|
2825
|
+
}), pn = ({ size: e = 20 }) => /* @__PURE__ */ u("svg", {
|
|
2826
2826
|
width: e,
|
|
2827
2827
|
height: e,
|
|
2828
2828
|
viewBox: "0 0 24 24",
|
|
@@ -2837,7 +2837,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2837
2837
|
x2: "1",
|
|
2838
2838
|
y2: "23"
|
|
2839
2839
|
})]
|
|
2840
|
-
}),
|
|
2840
|
+
}), mn = () => /* @__PURE__ */ u("svg", {
|
|
2841
2841
|
width: "18",
|
|
2842
2842
|
height: "18",
|
|
2843
2843
|
viewBox: "0 0 24 24",
|
|
@@ -2852,7 +2852,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2852
2852
|
x2: "12",
|
|
2853
2853
|
y2: "5"
|
|
2854
2854
|
}), /* @__PURE__ */ l("polyline", { points: "5 12 12 5 19 12" })]
|
|
2855
|
-
}),
|
|
2855
|
+
}), hn = () => /* @__PURE__ */ u("svg", {
|
|
2856
2856
|
width: "14",
|
|
2857
2857
|
height: "14",
|
|
2858
2858
|
viewBox: "0 0 24 24",
|
|
@@ -2862,7 +2862,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2862
2862
|
strokeLinecap: "round",
|
|
2863
2863
|
strokeLinejoin: "round",
|
|
2864
2864
|
children: [/* @__PURE__ */ l("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ l("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
|
|
2865
|
-
}),
|
|
2865
|
+
}), gn = () => /* @__PURE__ */ l("svg", {
|
|
2866
2866
|
width: "18",
|
|
2867
2867
|
height: "18",
|
|
2868
2868
|
viewBox: "0 0 24 24",
|
|
@@ -2872,7 +2872,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2872
2872
|
strokeLinecap: "round",
|
|
2873
2873
|
strokeLinejoin: "round",
|
|
2874
2874
|
children: /* @__PURE__ */ l("path", { d: "M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.42 19.42 0 01-6.12-6.11A19.79 19.79 0 012 4.11 2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.37 1.91.71 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.9.34 1.85.58 2.81.71A2 2 0 0122 16.92z" })
|
|
2875
|
-
}),
|
|
2875
|
+
}), _n = ({ className: e = "" }) => /* @__PURE__ */ u("svg", {
|
|
2876
2876
|
className: e,
|
|
2877
2877
|
width: "14",
|
|
2878
2878
|
height: "14",
|
|
@@ -2901,7 +2901,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2901
2901
|
y2: "16"
|
|
2902
2902
|
})
|
|
2903
2903
|
]
|
|
2904
|
-
}),
|
|
2904
|
+
}), vn = ({ size: e = 18, strokeWidth: t = 2.5 }) => /* @__PURE__ */ u("svg", {
|
|
2905
2905
|
width: e,
|
|
2906
2906
|
height: e,
|
|
2907
2907
|
viewBox: "0 0 24 24",
|
|
@@ -2921,7 +2921,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2921
2921
|
x2: "18",
|
|
2922
2922
|
y2: "18"
|
|
2923
2923
|
})]
|
|
2924
|
-
}),
|
|
2924
|
+
}), yn = ({ size: e = 14 }) => /* @__PURE__ */ u("svg", {
|
|
2925
2925
|
width: e,
|
|
2926
2926
|
height: e,
|
|
2927
2927
|
viewBox: "0 0 24 24",
|
|
@@ -2947,7 +2947,7 @@ var fn = ({ color: e = "#3888FF" }) => /* @__PURE__ */ u("svg", {
|
|
|
2947
2947
|
});
|
|
2948
2948
|
//#endregion
|
|
2949
2949
|
//#region src/components/Launcher.jsx
|
|
2950
|
-
function
|
|
2950
|
+
function bn({ isOpen: e, openWidget: t, launcherText: n, primaryColor: r, posInline: i }) {
|
|
2951
2951
|
return e ? null : /* @__PURE__ */ u("button", {
|
|
2952
2952
|
onClick: t,
|
|
2953
2953
|
"aria-label": n,
|
|
@@ -2978,16 +2978,16 @@ function xn({ isOpen: e, openWidget: t, launcherText: n, primaryColor: r, posInl
|
|
|
2978
2978
|
onMouseLeave: (e) => {
|
|
2979
2979
|
e.currentTarget.style.transform = "translateY(0)", e.currentTarget.style.boxShadow = "0 8px 24px rgba(0,0,0,0.18)";
|
|
2980
2980
|
},
|
|
2981
|
-
children: [/* @__PURE__ */ l("span", { children: n }), /* @__PURE__ */ l(
|
|
2981
|
+
children: [/* @__PURE__ */ l("span", { children: n }), /* @__PURE__ */ l(dn, { color: "#fff" })]
|
|
2982
2982
|
});
|
|
2983
2983
|
}
|
|
2984
2984
|
//#endregion
|
|
2985
2985
|
//#region src/components/ChatHeader.jsx
|
|
2986
|
-
function
|
|
2986
|
+
function xn(e) {
|
|
2987
2987
|
return typeof e == "string" ? e.trim() : e && typeof e == "object" && typeof e.src == "string" ? e.src.trim() : "";
|
|
2988
2988
|
}
|
|
2989
|
-
function
|
|
2990
|
-
let [n, r] = s("loading"), a =
|
|
2989
|
+
function Sn(t) {
|
|
2990
|
+
let [n, r] = s("loading"), a = xn(t);
|
|
2991
2991
|
return i(() => {
|
|
2992
2992
|
if (e.isValidElement(t) || typeof t == "function") {
|
|
2993
2993
|
r("square");
|
|
@@ -3011,8 +3011,8 @@ function Cn(t) {
|
|
|
3011
3011
|
resolvedLogoUrl: a
|
|
3012
3012
|
};
|
|
3013
3013
|
}
|
|
3014
|
-
function
|
|
3015
|
-
let { state: p, resolvedLogoUrl: m } =
|
|
3014
|
+
function Cn({ logoUrl: t, brandName: n, agentName: r, fallbackAgentName: i, activeScreen: a, branding: o, isConversationEnded: s, closeWidget: c, isInitial: d, botLabel: f = "AI" }) {
|
|
3015
|
+
let { state: p, resolvedLogoUrl: m } = Sn(t);
|
|
3016
3016
|
return /* @__PURE__ */ u("div", {
|
|
3017
3017
|
style: {
|
|
3018
3018
|
display: "flex",
|
|
@@ -3148,7 +3148,7 @@ function wn({ logoUrl: t, brandName: n, agentName: r, fallbackAgentName: i, acti
|
|
|
3148
3148
|
letterSpacing: "0.5px",
|
|
3149
3149
|
color: "var(--flowengage-primary)"
|
|
3150
3150
|
},
|
|
3151
|
-
children: [/* @__PURE__ */ l(
|
|
3151
|
+
children: [/* @__PURE__ */ l(yn, { size: 11 }), /* @__PURE__ */ l("span", { children: f })]
|
|
3152
3152
|
})]
|
|
3153
3153
|
}), /* @__PURE__ */ u("div", {
|
|
3154
3154
|
style: {
|
|
@@ -3193,18 +3193,18 @@ function wn({ logoUrl: t, brandName: n, agentName: r, fallbackAgentName: i, acti
|
|
|
3193
3193
|
onMouseLeave: (e) => {
|
|
3194
3194
|
e.currentTarget.style.background = "transparent";
|
|
3195
3195
|
},
|
|
3196
|
-
children: /* @__PURE__ */ l(
|
|
3196
|
+
children: /* @__PURE__ */ l(vn, {})
|
|
3197
3197
|
})
|
|
3198
3198
|
})]
|
|
3199
3199
|
});
|
|
3200
3200
|
}
|
|
3201
3201
|
//#endregion
|
|
3202
3202
|
//#region src/utils/messageFormatting.js
|
|
3203
|
-
var
|
|
3203
|
+
var wn = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Tn = (e = "") => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), En = (e = "") => {
|
|
3204
3204
|
let t = String(e || "").trim();
|
|
3205
3205
|
if (!t) return "";
|
|
3206
3206
|
if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return t;
|
|
3207
|
-
let n = t.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").split(/\n\s*\n/).map((e) => e.trim()).filter(Boolean), r = (e) =>
|
|
3207
|
+
let n = t.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").split(/\n\s*\n/).map((e) => e.trim()).filter(Boolean), r = (e) => Tn(e).replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, "<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*\n]+)\*/g, "<em>$1</em>");
|
|
3208
3208
|
return n.map((e) => {
|
|
3209
3209
|
let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
|
|
3210
3210
|
if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
|
|
@@ -3214,7 +3214,7 @@ var Tn = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim
|
|
|
3214
3214
|
};
|
|
3215
3215
|
//#endregion
|
|
3216
3216
|
//#region src/components/MessageList.jsx
|
|
3217
|
-
function
|
|
3217
|
+
function Dn({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext: r, TypingDots: a }) {
|
|
3218
3218
|
let s = o(null), c = (e) => {
|
|
3219
3219
|
if (!e) return "just now";
|
|
3220
3220
|
let t = /* @__PURE__ */ new Date(), n = new Date(e), r = Math.floor((t - n) / 1e3);
|
|
@@ -3242,7 +3242,7 @@ function On({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
|
|
|
3242
3242
|
},
|
|
3243
3243
|
children: [
|
|
3244
3244
|
e.map((e) => {
|
|
3245
|
-
let t = e.sender === "system", n = e.sender === "user", i = e.sender === "ai" || e.sender === "bot", a = e.isPending, o =
|
|
3245
|
+
let t = e.sender === "system", n = e.sender === "user", i = e.sender === "ai" || e.sender === "bot", a = e.isPending, o = wn(e.replyToContent || e.replyContext?.message || ""), s = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
|
|
3246
3246
|
return t ? /* @__PURE__ */ l("div", {
|
|
3247
3247
|
style: {
|
|
3248
3248
|
display: "flex",
|
|
@@ -3282,7 +3282,7 @@ function On({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
|
|
|
3282
3282
|
color: "#fff",
|
|
3283
3283
|
boxShadow: "0 8px 20px rgba(59,130,246,0.24)"
|
|
3284
3284
|
},
|
|
3285
|
-
children: /* @__PURE__ */ l(
|
|
3285
|
+
children: /* @__PURE__ */ l(yn, { size: 16 })
|
|
3286
3286
|
}), /* @__PURE__ */ u("div", {
|
|
3287
3287
|
style: {
|
|
3288
3288
|
display: "flex",
|
|
@@ -3313,7 +3313,7 @@ function On({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
|
|
|
3313
3313
|
onMouseLeave: (e) => {
|
|
3314
3314
|
e.currentTarget.style.color = "#9ca3af";
|
|
3315
3315
|
},
|
|
3316
|
-
children: [/* @__PURE__ */ l(
|
|
3316
|
+
children: [/* @__PURE__ */ l(hn, {}), "Reply"]
|
|
3317
3317
|
}),
|
|
3318
3318
|
/* @__PURE__ */ u("div", {
|
|
3319
3319
|
style: {
|
|
@@ -3356,7 +3356,7 @@ function On({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
|
|
|
3356
3356
|
}),
|
|
3357
3357
|
i ? /* @__PURE__ */ l("div", {
|
|
3358
3358
|
className: "flowengage-message-content",
|
|
3359
|
-
dangerouslySetInnerHTML: { __html:
|
|
3359
|
+
dangerouslySetInnerHTML: { __html: En(e.message) }
|
|
3360
3360
|
}) : /* @__PURE__ */ l("div", {
|
|
3361
3361
|
style: { whiteSpace: n ? "normal" : "pre-wrap" },
|
|
3362
3362
|
children: e.message
|
|
@@ -3424,7 +3424,7 @@ function On({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
|
|
|
3424
3424
|
color: "#fff",
|
|
3425
3425
|
boxShadow: "0 8px 20px rgba(59,130,246,0.24)"
|
|
3426
3426
|
},
|
|
3427
|
-
children: /* @__PURE__ */ l(
|
|
3427
|
+
children: /* @__PURE__ */ l(yn, { size: 16 })
|
|
3428
3428
|
}), /* @__PURE__ */ l("div", {
|
|
3429
3429
|
style: {
|
|
3430
3430
|
display: "flex",
|
|
@@ -3457,7 +3457,7 @@ function On({ chatHistory: e, isAiTyping: t, isAgentTyping: n, setReplyContext:
|
|
|
3457
3457
|
}
|
|
3458
3458
|
//#endregion
|
|
3459
3459
|
//#region src/components/WelcomeScreen.jsx
|
|
3460
|
-
function
|
|
3460
|
+
function On({ greetings: e, recommendations: t, onSendMessage: n, visitorEmail: r, emailInput: i, setEmailInput: a, emailError: o, setEmailError: s, onCaptureEmail: d, botLabel: f }) {
|
|
3461
3461
|
return /* @__PURE__ */ u("div", {
|
|
3462
3462
|
style: {
|
|
3463
3463
|
display: "flex",
|
|
@@ -3510,7 +3510,7 @@ function kn({ greetings: e, recommendations: t, onSendMessage: n, visitorEmail:
|
|
|
3510
3510
|
background: "rgba(255,255,255,0.18)",
|
|
3511
3511
|
color: "#fff"
|
|
3512
3512
|
},
|
|
3513
|
-
children: /* @__PURE__ */ l(
|
|
3513
|
+
children: /* @__PURE__ */ l(yn, { size: 14 })
|
|
3514
3514
|
}), /* @__PURE__ */ u("span", { children: [f, " • Start With Email"] })]
|
|
3515
3515
|
}),
|
|
3516
3516
|
/* @__PURE__ */ l("div", {
|
|
@@ -3630,8 +3630,8 @@ function kn({ greetings: e, recommendations: t, onSendMessage: n, visitorEmail:
|
|
|
3630
3630
|
}
|
|
3631
3631
|
//#endregion
|
|
3632
3632
|
//#region src/components/ChatInput.jsx
|
|
3633
|
-
function
|
|
3634
|
-
let
|
|
3633
|
+
function kn({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: c, clearReplyContext: d, requiresEmail: f, emailInput: p, setEmailInput: m, emailError: ee }) {
|
|
3634
|
+
let te = c?.sender === "user" ? "You" : c?.sender === "agent" ? "Agent" : "AI Assistant";
|
|
3635
3635
|
return /* @__PURE__ */ u("div", {
|
|
3636
3636
|
style: {
|
|
3637
3637
|
padding: "0 20px 4px",
|
|
@@ -3677,7 +3677,7 @@ function An({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
3677
3677
|
fontWeight: 600,
|
|
3678
3678
|
color: "var(--flowengage-primary)"
|
|
3679
3679
|
},
|
|
3680
|
-
children: ["Replying to ",
|
|
3680
|
+
children: ["Replying to ", te]
|
|
3681
3681
|
}), /* @__PURE__ */ l("div", {
|
|
3682
3682
|
style: {
|
|
3683
3683
|
overflow: "hidden",
|
|
@@ -3749,7 +3749,7 @@ function An({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
3749
3749
|
onMouseLeave: (e) => {
|
|
3750
3750
|
e.currentTarget.style.background = "transparent";
|
|
3751
3751
|
},
|
|
3752
|
-
children: /* @__PURE__ */ l(
|
|
3752
|
+
children: /* @__PURE__ */ l(gn, {})
|
|
3753
3753
|
}),
|
|
3754
3754
|
/* @__PURE__ */ l("input", {
|
|
3755
3755
|
style: {
|
|
@@ -3800,25 +3800,25 @@ function An({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
|
|
|
3800
3800
|
onMouseLeave: (e) => {
|
|
3801
3801
|
e.currentTarget.style.background = "transparent", e.currentTarget.style.color = s ? "#d1d5db" : "var(--flowengage-primary)";
|
|
3802
3802
|
},
|
|
3803
|
-
children: /* @__PURE__ */ l(
|
|
3803
|
+
children: /* @__PURE__ */ l(mn, {})
|
|
3804
3804
|
})
|
|
3805
3805
|
]
|
|
3806
3806
|
}),
|
|
3807
|
-
f &&
|
|
3807
|
+
f && ee && /* @__PURE__ */ l("div", {
|
|
3808
3808
|
style: {
|
|
3809
3809
|
padding: "8px 16px 0",
|
|
3810
3810
|
fontSize: "12px",
|
|
3811
3811
|
fontWeight: 500,
|
|
3812
3812
|
color: "#f43f5e"
|
|
3813
3813
|
},
|
|
3814
|
-
children:
|
|
3814
|
+
children: ee
|
|
3815
3815
|
})
|
|
3816
3816
|
]
|
|
3817
3817
|
});
|
|
3818
3818
|
}
|
|
3819
3819
|
//#endregion
|
|
3820
3820
|
//#region src/components/StatusBanners.jsx
|
|
3821
|
-
var
|
|
3821
|
+
var An = ({ muted: e = !1 }) => /* @__PURE__ */ u("svg", {
|
|
3822
3822
|
width: "16",
|
|
3823
3823
|
height: "16",
|
|
3824
3824
|
viewBox: "0 0 24 24",
|
|
@@ -3838,7 +3838,7 @@ var jn = ({ muted: e = !1 }) => /* @__PURE__ */ u("svg", {
|
|
|
3838
3838
|
y2: "22"
|
|
3839
3839
|
})
|
|
3840
3840
|
]
|
|
3841
|
-
}),
|
|
3841
|
+
}), jn = ({ variant: e, onClick: t, children: n, icon: r, compact: i = !1, iconOnly: a = !1, active: o = !1, ariaLabel: s }) => /* @__PURE__ */ u("button", {
|
|
3842
3842
|
type: "button",
|
|
3843
3843
|
className: [
|
|
3844
3844
|
"flowengage-call-btn",
|
|
@@ -3852,10 +3852,10 @@ var jn = ({ muted: e = !1 }) => /* @__PURE__ */ u("svg", {
|
|
|
3852
3852
|
title: s || n,
|
|
3853
3853
|
children: [r, !a && /* @__PURE__ */ l("span", { children: n })]
|
|
3854
3854
|
});
|
|
3855
|
-
function
|
|
3856
|
-
let
|
|
3857
|
-
if (!
|
|
3858
|
-
let { audioContext: e, oscillator: t, interval: n, toneTimeout: r } =
|
|
3855
|
+
function Mn({ webRTCError: e, micError: t, setMicError: r, dismissCallError: s, incomingCall: d, rejectCall: f, acceptCall: p, activeCallId: m, callConnectionState: ee, formatCallDuration: te, callDurationSeconds: h, endWebRTCCall: ne, isCallMuted: re, toggleCallMute: ie, isAIVoiceActive: ae, currentCallAgentName: oe, isRateLimited: se, rateLimitMessage: g }) {
|
|
3856
|
+
let ce = o(null), le = n(() => {
|
|
3857
|
+
if (!ce.current) return;
|
|
3858
|
+
let { audioContext: e, oscillator: t, interval: n, toneTimeout: r } = ce.current;
|
|
3859
3859
|
window.clearInterval(n), window.clearTimeout(r);
|
|
3860
3860
|
try {
|
|
3861
3861
|
t.stop();
|
|
@@ -3863,42 +3863,42 @@ function Nn({ webRTCError: e, micError: t, setMicError: r, dismissCallError: s,
|
|
|
3863
3863
|
try {
|
|
3864
3864
|
e.close();
|
|
3865
3865
|
} catch {}
|
|
3866
|
-
|
|
3867
|
-
}, []),
|
|
3868
|
-
if (
|
|
3866
|
+
ce.current = null;
|
|
3867
|
+
}, []), _ = n(() => {
|
|
3868
|
+
if (ce.current || typeof window > "u") return;
|
|
3869
3869
|
let e = window.AudioContext || window.webkitAudioContext || null;
|
|
3870
3870
|
if (e) try {
|
|
3871
3871
|
let t = new e(), n = t.createOscillator(), r = t.createGain();
|
|
3872
3872
|
n.connect(r), r.connect(t.destination), n.frequency.value = 0, n.type = "sine", r.gain.value = .3;
|
|
3873
3873
|
let i = () => {
|
|
3874
|
-
|
|
3874
|
+
ce.current && (window.clearTimeout(ce.current.toneTimeout), n.frequency.value = 440, ce.current.toneTimeout = window.setTimeout(() => {
|
|
3875
3875
|
n.frequency.value = 0;
|
|
3876
3876
|
}, 400));
|
|
3877
3877
|
};
|
|
3878
3878
|
t.state === "suspended" && t.resume().catch((e) => {
|
|
3879
3879
|
console.warn("[FlowEngage] ringtone autoplay blocked", e);
|
|
3880
|
-
}), n.start(),
|
|
3880
|
+
}), n.start(), ce.current = {
|
|
3881
3881
|
audioContext: t,
|
|
3882
3882
|
oscillator: n,
|
|
3883
3883
|
interval: null,
|
|
3884
3884
|
toneTimeout: null
|
|
3885
|
-
}, i(),
|
|
3885
|
+
}, i(), ce.current.interval = window.setInterval(i, 1e3);
|
|
3886
3886
|
} catch (e) {
|
|
3887
3887
|
console.warn("[FlowEngage] failed to start ringtone", e);
|
|
3888
3888
|
}
|
|
3889
3889
|
}, []);
|
|
3890
3890
|
i(() => {
|
|
3891
3891
|
if (d) {
|
|
3892
|
-
|
|
3892
|
+
_();
|
|
3893
3893
|
return;
|
|
3894
3894
|
}
|
|
3895
|
-
|
|
3895
|
+
le();
|
|
3896
3896
|
}, [
|
|
3897
3897
|
d,
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
]), i(() => () =>
|
|
3901
|
-
let ue =
|
|
3898
|
+
_,
|
|
3899
|
+
le
|
|
3900
|
+
]), i(() => () => le(), [le]);
|
|
3901
|
+
let ue = ae ? "header-mode" : "bottom-mode", v = !!(d || m), y = d ? "incoming" : ee === "connected" ? "connected" : "connecting", de = a(() => y === "incoming" ? "Incoming Call" : y === "connected" ? "Voice Call Active" : "Connecting Call", [y]), fe = a(() => y === "incoming" ? `${oe} wants to join a voice call` : y === "connected" ? `You are connected to ${oe} from this conversation.` : `Please wait while ${oe}'s voice connection finishes setting up.`, [oe, y]);
|
|
3902
3902
|
return /* @__PURE__ */ u(c, { children: [
|
|
3903
3903
|
(e || t) && /* @__PURE__ */ u("div", {
|
|
3904
3904
|
style: {
|
|
@@ -3912,7 +3912,7 @@ function Nn({ webRTCError: e, micError: t, setMicError: r, dismissCallError: s,
|
|
|
3912
3912
|
gap: "10px"
|
|
3913
3913
|
},
|
|
3914
3914
|
children: [
|
|
3915
|
-
/* @__PURE__ */ l(
|
|
3915
|
+
/* @__PURE__ */ l(_n, { className: "" }),
|
|
3916
3916
|
/* @__PURE__ */ l("span", {
|
|
3917
3917
|
style: {
|
|
3918
3918
|
fontSize: "12px",
|
|
@@ -3945,84 +3945,84 @@ function Nn({ webRTCError: e, micError: t, setMicError: r, dismissCallError: s,
|
|
|
3945
3945
|
})
|
|
3946
3946
|
]
|
|
3947
3947
|
}),
|
|
3948
|
-
|
|
3948
|
+
v && /* @__PURE__ */ l("div", {
|
|
3949
3949
|
className: `incoming-call-overlay ${ue}`,
|
|
3950
3950
|
children: /* @__PURE__ */ l("div", {
|
|
3951
|
-
className: ["incoming-call-container",
|
|
3952
|
-
children:
|
|
3951
|
+
className: ["incoming-call-container", y === "connected" ? "connected-layout" : ""].filter(Boolean).join(" "),
|
|
3952
|
+
children: y === "connected" ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
|
|
3953
3953
|
className: "call-connected-top",
|
|
3954
3954
|
children: [/* @__PURE__ */ u("div", {
|
|
3955
3955
|
className: "call-connected-identity",
|
|
3956
3956
|
children: [/* @__PURE__ */ l("div", {
|
|
3957
|
-
className: `call-icon-wrapper ${
|
|
3958
|
-
children: /* @__PURE__ */ l(
|
|
3957
|
+
className: `call-icon-wrapper ${y}`,
|
|
3958
|
+
children: /* @__PURE__ */ l(pn, { size: 20 })
|
|
3959
3959
|
}), /* @__PURE__ */ u("div", {
|
|
3960
3960
|
className: "call-info-group",
|
|
3961
3961
|
children: [/* @__PURE__ */ l("h3", {
|
|
3962
3962
|
className: "call-title",
|
|
3963
|
-
children:
|
|
3963
|
+
children: de
|
|
3964
3964
|
}), /* @__PURE__ */ l("p", {
|
|
3965
3965
|
className: "call-subtitle",
|
|
3966
|
-
children:
|
|
3966
|
+
children: fe
|
|
3967
3967
|
})]
|
|
3968
3968
|
})]
|
|
3969
3969
|
}), /* @__PURE__ */ l("div", {
|
|
3970
3970
|
className: "call-timer",
|
|
3971
|
-
children:
|
|
3971
|
+
children: te(h)
|
|
3972
3972
|
})]
|
|
3973
3973
|
}), /* @__PURE__ */ u("div", {
|
|
3974
3974
|
className: "call-actions connected",
|
|
3975
|
-
children: [/* @__PURE__ */ l(
|
|
3975
|
+
children: [/* @__PURE__ */ l(jn, {
|
|
3976
3976
|
variant: "mute",
|
|
3977
|
-
onClick:
|
|
3978
|
-
compact:
|
|
3979
|
-
active:
|
|
3980
|
-
icon: /* @__PURE__ */ l(
|
|
3981
|
-
children:
|
|
3982
|
-
}), /* @__PURE__ */ l(
|
|
3977
|
+
onClick: ie,
|
|
3978
|
+
compact: ae,
|
|
3979
|
+
active: re,
|
|
3980
|
+
icon: /* @__PURE__ */ l(An, { muted: re }),
|
|
3981
|
+
children: re ? "Unmute" : "Mute"
|
|
3982
|
+
}), /* @__PURE__ */ l(jn, {
|
|
3983
3983
|
variant: "end",
|
|
3984
|
-
onClick:
|
|
3985
|
-
compact:
|
|
3986
|
-
icon: /* @__PURE__ */ l(
|
|
3984
|
+
onClick: ne,
|
|
3985
|
+
compact: ae,
|
|
3986
|
+
icon: /* @__PURE__ */ l(pn, { size: 14 }),
|
|
3987
3987
|
children: "End"
|
|
3988
3988
|
})]
|
|
3989
3989
|
})] }) : /* @__PURE__ */ u(c, { children: [
|
|
3990
3990
|
/* @__PURE__ */ u("div", {
|
|
3991
|
-
className: `call-icon-wrapper ${
|
|
3991
|
+
className: `call-icon-wrapper ${y}`,
|
|
3992
3992
|
children: [
|
|
3993
|
-
/* @__PURE__ */ l(
|
|
3994
|
-
|
|
3995
|
-
|
|
3993
|
+
/* @__PURE__ */ l(gn, {}),
|
|
3994
|
+
y === "incoming" && /* @__PURE__ */ l("div", { className: "call-pulse-animation" }),
|
|
3995
|
+
y === "connecting" && /* @__PURE__ */ l("div", { className: "call-connecting-animation" })
|
|
3996
3996
|
]
|
|
3997
3997
|
}),
|
|
3998
3998
|
/* @__PURE__ */ u("div", {
|
|
3999
3999
|
className: "call-info-group",
|
|
4000
4000
|
children: [/* @__PURE__ */ l("h3", {
|
|
4001
4001
|
className: "call-title",
|
|
4002
|
-
children:
|
|
4002
|
+
children: de
|
|
4003
4003
|
}), /* @__PURE__ */ l("p", {
|
|
4004
4004
|
className: "call-subtitle",
|
|
4005
|
-
children:
|
|
4005
|
+
children: fe
|
|
4006
4006
|
})]
|
|
4007
4007
|
}),
|
|
4008
4008
|
/* @__PURE__ */ l("div", {
|
|
4009
4009
|
className: "call-actions",
|
|
4010
|
-
children:
|
|
4010
|
+
children: y === "incoming" && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(jn, {
|
|
4011
4011
|
variant: "reject",
|
|
4012
4012
|
onClick: async () => {
|
|
4013
|
-
|
|
4013
|
+
le(), await f();
|
|
4014
4014
|
},
|
|
4015
4015
|
iconOnly: !0,
|
|
4016
|
-
icon: /* @__PURE__ */ l(
|
|
4016
|
+
icon: /* @__PURE__ */ l(pn, { size: 14 }),
|
|
4017
4017
|
ariaLabel: "Decline call",
|
|
4018
4018
|
children: "Decline"
|
|
4019
|
-
}), /* @__PURE__ */ l(
|
|
4019
|
+
}), /* @__PURE__ */ l(jn, {
|
|
4020
4020
|
variant: "accept",
|
|
4021
4021
|
onClick: async () => {
|
|
4022
|
-
|
|
4022
|
+
le(), await p();
|
|
4023
4023
|
},
|
|
4024
4024
|
iconOnly: !0,
|
|
4025
|
-
icon: /* @__PURE__ */ l(
|
|
4025
|
+
icon: /* @__PURE__ */ l(gn, {}),
|
|
4026
4026
|
ariaLabel: "Accept call",
|
|
4027
4027
|
children: "Accept"
|
|
4028
4028
|
})] })
|
|
@@ -4030,7 +4030,7 @@ function Nn({ webRTCError: e, micError: t, setMicError: r, dismissCallError: s,
|
|
|
4030
4030
|
] })
|
|
4031
4031
|
})
|
|
4032
4032
|
}),
|
|
4033
|
-
|
|
4033
|
+
se && /* @__PURE__ */ l("div", {
|
|
4034
4034
|
style: {
|
|
4035
4035
|
margin: "0 20px 10px",
|
|
4036
4036
|
padding: "12px 16px",
|
|
@@ -4039,13 +4039,13 @@ function Nn({ webRTCError: e, micError: t, setMicError: r, dismissCallError: s,
|
|
|
4039
4039
|
background: "#fee2e2",
|
|
4040
4040
|
color: "#991b1b"
|
|
4041
4041
|
},
|
|
4042
|
-
children:
|
|
4042
|
+
children: g
|
|
4043
4043
|
})
|
|
4044
4044
|
] });
|
|
4045
4045
|
}
|
|
4046
4046
|
//#endregion
|
|
4047
4047
|
//#region node_modules/livekit-client/dist/livekit-client.esm.mjs
|
|
4048
|
-
function
|
|
4048
|
+
function Nn(e, t) {
|
|
4049
4049
|
return t.forEach(function(t) {
|
|
4050
4050
|
t && typeof t != "string" && !Array.isArray(t) && Object.keys(t).forEach(function(n) {
|
|
4051
4051
|
if (n !== "default" && !(n in e)) {
|
|
@@ -4060,14 +4060,14 @@ function Pn(e, t) {
|
|
|
4060
4060
|
});
|
|
4061
4061
|
}), Object.freeze(e);
|
|
4062
4062
|
}
|
|
4063
|
-
var
|
|
4063
|
+
var Pn = Object.defineProperty, Fn = (e, t, n) => t in e ? Pn(e, t, {
|
|
4064
4064
|
enumerable: !0,
|
|
4065
4065
|
configurable: !0,
|
|
4066
4066
|
writable: !0,
|
|
4067
4067
|
value: n
|
|
4068
|
-
}) : e[t] = n,
|
|
4068
|
+
}) : e[t] = n, In = (e, t, n) => Fn(e, typeof t == "symbol" ? t : t + "", n), Ln = class {
|
|
4069
4069
|
constructor() {
|
|
4070
|
-
|
|
4070
|
+
In(this, "_locking"), In(this, "_locks"), this._locking = Promise.resolve(), this._locks = 0;
|
|
4071
4071
|
}
|
|
4072
4072
|
isLocked() {
|
|
4073
4073
|
return this._locks > 0;
|
|
@@ -4080,38 +4080,38 @@ var Fn = Object.defineProperty, In = (e, t, n) => t in e ? Fn(e, t, {
|
|
|
4080
4080
|
return this._locking = this._locking.then(() => t), n;
|
|
4081
4081
|
}
|
|
4082
4082
|
};
|
|
4083
|
-
function
|
|
4083
|
+
function E(e, t) {
|
|
4084
4084
|
if (!e) throw Error(t);
|
|
4085
4085
|
}
|
|
4086
|
-
var
|
|
4087
|
-
function
|
|
4086
|
+
var Rn = 34028234663852886e22, zn = -34028234663852886e22, Bn = 4294967295, Vn = 2147483647, Hn = -2147483648;
|
|
4087
|
+
function Un(e) {
|
|
4088
4088
|
if (typeof e != "number") throw Error("invalid int 32: " + typeof e);
|
|
4089
|
-
if (!Number.isInteger(e) || e >
|
|
4089
|
+
if (!Number.isInteger(e) || e > Vn || e < Hn) throw Error("invalid int 32: " + e);
|
|
4090
4090
|
}
|
|
4091
|
-
function
|
|
4091
|
+
function Wn(e) {
|
|
4092
4092
|
if (typeof e != "number") throw Error("invalid uint 32: " + typeof e);
|
|
4093
|
-
if (!Number.isInteger(e) || e >
|
|
4093
|
+
if (!Number.isInteger(e) || e > Bn || e < 0) throw Error("invalid uint 32: " + e);
|
|
4094
4094
|
}
|
|
4095
|
-
function
|
|
4095
|
+
function Gn(e) {
|
|
4096
4096
|
if (typeof e != "number") throw Error("invalid float 32: " + typeof e);
|
|
4097
|
-
if (Number.isFinite(e) && (e >
|
|
4097
|
+
if (Number.isFinite(e) && (e > Rn || e < zn)) throw Error("invalid float 32: " + e);
|
|
4098
4098
|
}
|
|
4099
|
-
var
|
|
4100
|
-
function
|
|
4101
|
-
let t = e[
|
|
4102
|
-
return
|
|
4099
|
+
var Kn = Symbol("@bufbuild/protobuf/enum-type");
|
|
4100
|
+
function qn(e) {
|
|
4101
|
+
let t = e[Kn];
|
|
4102
|
+
return E(t, "missing enum type on enum object"), t;
|
|
4103
4103
|
}
|
|
4104
|
-
function
|
|
4105
|
-
e[
|
|
4104
|
+
function Jn(e, t, n, r) {
|
|
4105
|
+
e[Kn] = Yn(t, n.map((t) => ({
|
|
4106
4106
|
no: t.no,
|
|
4107
4107
|
name: t.name,
|
|
4108
4108
|
localName: e[t.no]
|
|
4109
4109
|
})));
|
|
4110
4110
|
}
|
|
4111
|
-
function
|
|
4111
|
+
function Yn(e, t, n) {
|
|
4112
4112
|
let r = Object.create(null), i = Object.create(null), a = [];
|
|
4113
4113
|
for (let e of t) {
|
|
4114
|
-
let t =
|
|
4114
|
+
let t = Zn(e);
|
|
4115
4115
|
a.push(t), r[e.name] = t, i[e.no] = t;
|
|
4116
4116
|
}
|
|
4117
4117
|
return {
|
|
@@ -4125,18 +4125,18 @@ function Xn(e, t, n) {
|
|
|
4125
4125
|
}
|
|
4126
4126
|
};
|
|
4127
4127
|
}
|
|
4128
|
-
function
|
|
4128
|
+
function Xn(e, t, n) {
|
|
4129
4129
|
let r = {};
|
|
4130
4130
|
for (let e of t) {
|
|
4131
|
-
let t =
|
|
4131
|
+
let t = Zn(e);
|
|
4132
4132
|
r[t.localName] = t.no, r[t.no] = t.localName;
|
|
4133
4133
|
}
|
|
4134
|
-
return
|
|
4134
|
+
return Jn(r, e, t), r;
|
|
4135
4135
|
}
|
|
4136
|
-
function
|
|
4136
|
+
function Zn(e) {
|
|
4137
4137
|
return "localName" in e ? e : Object.assign(Object.assign({}, e), { localName: e.name });
|
|
4138
4138
|
}
|
|
4139
|
-
var
|
|
4139
|
+
var Qn = class {
|
|
4140
4140
|
equals(e) {
|
|
4141
4141
|
return this.getType().runtime.util.equals(this.getType(), this, e);
|
|
4142
4142
|
}
|
|
@@ -4179,11 +4179,11 @@ var $n = class {
|
|
|
4179
4179
|
return Object.getPrototypeOf(this).constructor;
|
|
4180
4180
|
}
|
|
4181
4181
|
};
|
|
4182
|
-
function
|
|
4182
|
+
function $n(e, t, n, r) {
|
|
4183
4183
|
let i = r?.localName ?? t.substring(t.lastIndexOf(".") + 1), a = { [i]: function(t) {
|
|
4184
4184
|
e.util.initFields(this), e.util.initPartial(t, this);
|
|
4185
4185
|
} }[i];
|
|
4186
|
-
return Object.setPrototypeOf(a.prototype, new
|
|
4186
|
+
return Object.setPrototypeOf(a.prototype, new Qn()), Object.assign(a, {
|
|
4187
4187
|
runtime: e,
|
|
4188
4188
|
typeName: t,
|
|
4189
4189
|
fields: e.util.newFieldList(n),
|
|
@@ -4201,7 +4201,7 @@ function er(e, t, n, r) {
|
|
|
4201
4201
|
}
|
|
4202
4202
|
}), a;
|
|
4203
4203
|
}
|
|
4204
|
-
function
|
|
4204
|
+
function er() {
|
|
4205
4205
|
let e = 0, t = 0;
|
|
4206
4206
|
for (let n = 0; n < 28; n += 7) {
|
|
4207
4207
|
let r = this.buf[this.pos++];
|
|
@@ -4215,7 +4215,7 @@ function tr() {
|
|
|
4215
4215
|
}
|
|
4216
4216
|
throw Error("invalid varint");
|
|
4217
4217
|
}
|
|
4218
|
-
function
|
|
4218
|
+
function tr(e, t, n) {
|
|
4219
4219
|
for (let r = 0; r < 28; r += 7) {
|
|
4220
4220
|
let i = e >>> r, a = !(!(i >>> 7) && t == 0), o = (a ? i | 128 : i) & 255;
|
|
4221
4221
|
if (n.push(o), !a) return;
|
|
@@ -4229,48 +4229,48 @@ function nr(e, t, n) {
|
|
|
4229
4229
|
n.push(t >>> 31 & 1);
|
|
4230
4230
|
}
|
|
4231
4231
|
}
|
|
4232
|
-
var
|
|
4233
|
-
function
|
|
4232
|
+
var nr = 4294967296;
|
|
4233
|
+
function rr(e) {
|
|
4234
4234
|
let t = e[0] === "-";
|
|
4235
4235
|
t && (e = e.slice(1));
|
|
4236
4236
|
let n = 1e6, r = 0, i = 0;
|
|
4237
4237
|
function a(t, a) {
|
|
4238
4238
|
let o = Number(e.slice(t, a));
|
|
4239
|
-
i *= n, r = r * n + o, r >=
|
|
4239
|
+
i *= n, r = r * n + o, r >= nr && (i += r / nr | 0, r %= nr);
|
|
4240
4240
|
}
|
|
4241
|
-
return a(-24, -18), a(-18, -12), a(-12, -6), a(-6), t ?
|
|
4241
|
+
return a(-24, -18), a(-18, -12), a(-12, -6), a(-6), t ? cr(r, i) : sr(r, i);
|
|
4242
4242
|
}
|
|
4243
|
-
function
|
|
4244
|
-
let n =
|
|
4245
|
-
r && (n =
|
|
4246
|
-
let i =
|
|
4243
|
+
function ir(e, t) {
|
|
4244
|
+
let n = sr(e, t), r = n.hi & 2147483648;
|
|
4245
|
+
r && (n = cr(n.lo, n.hi));
|
|
4246
|
+
let i = ar(n.lo, n.hi);
|
|
4247
4247
|
return r ? "-" + i : i;
|
|
4248
4248
|
}
|
|
4249
|
-
function
|
|
4250
|
-
if ({lo: e, hi: t} =
|
|
4249
|
+
function ar(e, t) {
|
|
4250
|
+
if ({lo: e, hi: t} = or(e, t), t <= 2097151) return String(nr * t + e);
|
|
4251
4251
|
let n = e & 16777215, r = (e >>> 24 | t << 8) & 16777215, i = t >> 16 & 65535, a = n + r * 6777216 + i * 6710656, o = r + i * 8147497, s = i * 2, c = 1e7;
|
|
4252
|
-
return a >= c && (o += Math.floor(a / c), a %= c), o >= c && (s += Math.floor(o / c), o %= c), s.toString() +
|
|
4252
|
+
return a >= c && (o += Math.floor(a / c), a %= c), o >= c && (s += Math.floor(o / c), o %= c), s.toString() + lr(o) + lr(a);
|
|
4253
4253
|
}
|
|
4254
|
-
function
|
|
4254
|
+
function or(e, t) {
|
|
4255
4255
|
return {
|
|
4256
4256
|
lo: e >>> 0,
|
|
4257
4257
|
hi: t >>> 0
|
|
4258
4258
|
};
|
|
4259
4259
|
}
|
|
4260
|
-
function
|
|
4260
|
+
function sr(e, t) {
|
|
4261
4261
|
return {
|
|
4262
4262
|
lo: e | 0,
|
|
4263
4263
|
hi: t | 0
|
|
4264
4264
|
};
|
|
4265
4265
|
}
|
|
4266
|
-
function
|
|
4267
|
-
return t = ~t, e ? e = ~e + 1 : t += 1,
|
|
4266
|
+
function cr(e, t) {
|
|
4267
|
+
return t = ~t, e ? e = ~e + 1 : t += 1, sr(e, t);
|
|
4268
4268
|
}
|
|
4269
|
-
var
|
|
4269
|
+
var lr = (e) => {
|
|
4270
4270
|
let t = String(e);
|
|
4271
4271
|
return "0000000".slice(t.length) + t;
|
|
4272
4272
|
};
|
|
4273
|
-
function
|
|
4273
|
+
function ur(e, t) {
|
|
4274
4274
|
if (e >= 0) {
|
|
4275
4275
|
for (; e > 127;) t.push(e & 127 | 128), e >>>= 7;
|
|
4276
4276
|
t.push(e);
|
|
@@ -4279,7 +4279,7 @@ function dr(e, t) {
|
|
|
4279
4279
|
t.push(1);
|
|
4280
4280
|
}
|
|
4281
4281
|
}
|
|
4282
|
-
function
|
|
4282
|
+
function dr() {
|
|
4283
4283
|
let e = this.buf[this.pos++], t = e & 127;
|
|
4284
4284
|
if (!(e & 128) || (e = this.buf[this.pos++], t |= (e & 127) << 7, !(e & 128)) || (e = this.buf[this.pos++], t |= (e & 127) << 14, !(e & 128)) || (e = this.buf[this.pos++], t |= (e & 127) << 21, !(e & 128))) return this.assertBounds(), t;
|
|
4285
4285
|
e = this.buf[this.pos++], t |= (e & 15) << 28;
|
|
@@ -4287,7 +4287,7 @@ function fr() {
|
|
|
4287
4287
|
if (e & 128) throw Error("invalid varint");
|
|
4288
4288
|
return this.assertBounds(), t >>> 0;
|
|
4289
4289
|
}
|
|
4290
|
-
function
|
|
4290
|
+
function fr() {
|
|
4291
4291
|
let e = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
4292
4292
|
if (typeof BigInt == "function" && typeof e.getBigInt64 == "function" && typeof e.getBigUint64 == "function" && typeof e.setBigInt64 == "function" && typeof e.setBigUint64 == "function" && (typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1")) {
|
|
4293
4293
|
let t = BigInt("-9223372036854775808"), n = BigInt("9223372036854775807"), r = BigInt("0"), i = BigInt("18446744073709551615");
|
|
@@ -4324,7 +4324,7 @@ function pr() {
|
|
|
4324
4324
|
}
|
|
4325
4325
|
};
|
|
4326
4326
|
}
|
|
4327
|
-
let t = (e) =>
|
|
4327
|
+
let t = (e) => E(/^-?[0-9]+$/.test(e), `int64 invalid: ${e}`), n = (e) => E(/^[0-9]+$/.test(e), `uint64 invalid: ${e}`);
|
|
4328
4328
|
return {
|
|
4329
4329
|
zero: "0",
|
|
4330
4330
|
supported: !1,
|
|
@@ -4335,70 +4335,70 @@ function pr() {
|
|
|
4335
4335
|
return typeof e != "string" && (e = e.toString()), n(e), e;
|
|
4336
4336
|
},
|
|
4337
4337
|
enc(e) {
|
|
4338
|
-
return typeof e != "string" && (e = e.toString()), t(e),
|
|
4338
|
+
return typeof e != "string" && (e = e.toString()), t(e), rr(e);
|
|
4339
4339
|
},
|
|
4340
4340
|
uEnc(e) {
|
|
4341
|
-
return typeof e != "string" && (e = e.toString()), n(e),
|
|
4341
|
+
return typeof e != "string" && (e = e.toString()), n(e), rr(e);
|
|
4342
4342
|
},
|
|
4343
4343
|
dec(e, t) {
|
|
4344
|
-
return
|
|
4344
|
+
return ir(e, t);
|
|
4345
4345
|
},
|
|
4346
4346
|
uDec(e, t) {
|
|
4347
|
-
return
|
|
4347
|
+
return ar(e, t);
|
|
4348
4348
|
}
|
|
4349
4349
|
};
|
|
4350
4350
|
}
|
|
4351
|
-
var
|
|
4351
|
+
var D = fr(), O;
|
|
4352
4352
|
(function(e) {
|
|
4353
4353
|
e[e.DOUBLE = 1] = "DOUBLE", e[e.FLOAT = 2] = "FLOAT", e[e.INT64 = 3] = "INT64", e[e.UINT64 = 4] = "UINT64", e[e.INT32 = 5] = "INT32", e[e.FIXED64 = 6] = "FIXED64", e[e.FIXED32 = 7] = "FIXED32", e[e.BOOL = 8] = "BOOL", e[e.STRING = 9] = "STRING", e[e.BYTES = 12] = "BYTES", e[e.UINT32 = 13] = "UINT32", e[e.SFIXED32 = 15] = "SFIXED32", e[e.SFIXED64 = 16] = "SFIXED64", e[e.SINT32 = 17] = "SINT32", e[e.SINT64 = 18] = "SINT64";
|
|
4354
|
-
})(
|
|
4355
|
-
var
|
|
4354
|
+
})(O ||= {});
|
|
4355
|
+
var pr;
|
|
4356
4356
|
(function(e) {
|
|
4357
4357
|
e[e.BIGINT = 0] = "BIGINT", e[e.STRING = 1] = "STRING";
|
|
4358
|
-
})(
|
|
4359
|
-
function
|
|
4358
|
+
})(pr ||= {});
|
|
4359
|
+
function mr(e, t, n) {
|
|
4360
4360
|
if (t === n) return !0;
|
|
4361
|
-
if (e ==
|
|
4361
|
+
if (e == O.BYTES) {
|
|
4362
4362
|
if (!(t instanceof Uint8Array) || !(n instanceof Uint8Array) || t.length !== n.length) return !1;
|
|
4363
4363
|
for (let e = 0; e < t.length; e++) if (t[e] !== n[e]) return !1;
|
|
4364
4364
|
return !0;
|
|
4365
4365
|
}
|
|
4366
4366
|
switch (e) {
|
|
4367
|
-
case
|
|
4368
|
-
case
|
|
4369
|
-
case
|
|
4370
|
-
case
|
|
4371
|
-
case
|
|
4367
|
+
case O.UINT64:
|
|
4368
|
+
case O.FIXED64:
|
|
4369
|
+
case O.INT64:
|
|
4370
|
+
case O.SFIXED64:
|
|
4371
|
+
case O.SINT64: return t == n;
|
|
4372
4372
|
}
|
|
4373
4373
|
return !1;
|
|
4374
4374
|
}
|
|
4375
|
-
function
|
|
4375
|
+
function hr(e, t) {
|
|
4376
4376
|
switch (e) {
|
|
4377
|
-
case
|
|
4378
|
-
case
|
|
4379
|
-
case
|
|
4380
|
-
case
|
|
4381
|
-
case
|
|
4382
|
-
case
|
|
4383
|
-
case
|
|
4384
|
-
case
|
|
4385
|
-
case
|
|
4386
|
-
case
|
|
4377
|
+
case O.BOOL: return !1;
|
|
4378
|
+
case O.UINT64:
|
|
4379
|
+
case O.FIXED64:
|
|
4380
|
+
case O.INT64:
|
|
4381
|
+
case O.SFIXED64:
|
|
4382
|
+
case O.SINT64: return t == 0 ? D.zero : "0";
|
|
4383
|
+
case O.DOUBLE:
|
|
4384
|
+
case O.FLOAT: return 0;
|
|
4385
|
+
case O.BYTES: return new Uint8Array();
|
|
4386
|
+
case O.STRING: return "";
|
|
4387
4387
|
default: return 0;
|
|
4388
4388
|
}
|
|
4389
4389
|
}
|
|
4390
|
-
function
|
|
4390
|
+
function gr(e, t) {
|
|
4391
4391
|
switch (e) {
|
|
4392
|
-
case
|
|
4393
|
-
case
|
|
4394
|
-
case
|
|
4392
|
+
case O.BOOL: return t === !1;
|
|
4393
|
+
case O.STRING: return t === "";
|
|
4394
|
+
case O.BYTES: return t instanceof Uint8Array && !t.byteLength;
|
|
4395
4395
|
default: return t == 0;
|
|
4396
4396
|
}
|
|
4397
4397
|
}
|
|
4398
|
-
var
|
|
4398
|
+
var _r;
|
|
4399
4399
|
(function(e) {
|
|
4400
4400
|
e[e.Varint = 0] = "Varint", e[e.Bit64 = 1] = "Bit64", e[e.LengthDelimited = 2] = "LengthDelimited", e[e.StartGroup = 3] = "StartGroup", e[e.EndGroup = 4] = "EndGroup", e[e.Bit32 = 5] = "Bit32";
|
|
4401
|
-
})(
|
|
4401
|
+
})(_r ||= {});
|
|
4402
4402
|
var vr = class {
|
|
4403
4403
|
constructor(e) {
|
|
4404
4404
|
this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
|
|
@@ -4429,11 +4429,11 @@ var vr = class {
|
|
|
4429
4429
|
return this.buf.length && (this.chunks.push(new Uint8Array(this.buf)), this.buf = []), this.chunks.push(e), this;
|
|
4430
4430
|
}
|
|
4431
4431
|
uint32(e) {
|
|
4432
|
-
for (
|
|
4432
|
+
for (Wn(e); e > 127;) this.buf.push(e & 127 | 128), e >>>= 7;
|
|
4433
4433
|
return this.buf.push(e), this;
|
|
4434
4434
|
}
|
|
4435
4435
|
int32(e) {
|
|
4436
|
-
return
|
|
4436
|
+
return Un(e), ur(e, this.buf), this;
|
|
4437
4437
|
}
|
|
4438
4438
|
bool(e) {
|
|
4439
4439
|
return this.buf.push(e ? 1 : 0), this;
|
|
@@ -4446,7 +4446,7 @@ var vr = class {
|
|
|
4446
4446
|
return this.uint32(t.byteLength), this.raw(t);
|
|
4447
4447
|
}
|
|
4448
4448
|
float(e) {
|
|
4449
|
-
|
|
4449
|
+
Gn(e);
|
|
4450
4450
|
let t = new Uint8Array(4);
|
|
4451
4451
|
return new DataView(t.buffer).setFloat32(0, e, !0), this.raw(t);
|
|
4452
4452
|
}
|
|
@@ -4455,41 +4455,41 @@ var vr = class {
|
|
|
4455
4455
|
return new DataView(t.buffer).setFloat64(0, e, !0), this.raw(t);
|
|
4456
4456
|
}
|
|
4457
4457
|
fixed32(e) {
|
|
4458
|
-
|
|
4458
|
+
Wn(e);
|
|
4459
4459
|
let t = new Uint8Array(4);
|
|
4460
4460
|
return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
|
|
4461
4461
|
}
|
|
4462
4462
|
sfixed32(e) {
|
|
4463
|
-
|
|
4463
|
+
Un(e);
|
|
4464
4464
|
let t = new Uint8Array(4);
|
|
4465
4465
|
return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
|
|
4466
4466
|
}
|
|
4467
4467
|
sint32(e) {
|
|
4468
|
-
return
|
|
4468
|
+
return Un(e), e = (e << 1 ^ e >> 31) >>> 0, ur(e, this.buf), this;
|
|
4469
4469
|
}
|
|
4470
4470
|
sfixed64(e) {
|
|
4471
|
-
let t = new Uint8Array(8), n = new DataView(t.buffer), r =
|
|
4471
|
+
let t = new Uint8Array(8), n = new DataView(t.buffer), r = D.enc(e);
|
|
4472
4472
|
return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
|
|
4473
4473
|
}
|
|
4474
4474
|
fixed64(e) {
|
|
4475
|
-
let t = new Uint8Array(8), n = new DataView(t.buffer), r =
|
|
4475
|
+
let t = new Uint8Array(8), n = new DataView(t.buffer), r = D.uEnc(e);
|
|
4476
4476
|
return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
|
|
4477
4477
|
}
|
|
4478
4478
|
int64(e) {
|
|
4479
|
-
let t =
|
|
4480
|
-
return
|
|
4479
|
+
let t = D.enc(e);
|
|
4480
|
+
return tr(t.lo, t.hi, this.buf), this;
|
|
4481
4481
|
}
|
|
4482
4482
|
sint64(e) {
|
|
4483
|
-
let t =
|
|
4484
|
-
return
|
|
4483
|
+
let t = D.enc(e), n = t.hi >> 31;
|
|
4484
|
+
return tr(t.lo << 1 ^ n, (t.hi << 1 | t.lo >>> 31) ^ n, this.buf), this;
|
|
4485
4485
|
}
|
|
4486
4486
|
uint64(e) {
|
|
4487
|
-
let t =
|
|
4488
|
-
return
|
|
4487
|
+
let t = D.uEnc(e);
|
|
4488
|
+
return tr(t.lo, t.hi, this.buf), this;
|
|
4489
4489
|
}
|
|
4490
4490
|
}, yr = class {
|
|
4491
4491
|
constructor(e, t) {
|
|
4492
|
-
this.varint64 =
|
|
4492
|
+
this.varint64 = er, this.uint32 = dr, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength), this.textDecoder = t ?? new TextDecoder();
|
|
4493
4493
|
}
|
|
4494
4494
|
tag() {
|
|
4495
4495
|
let e = this.uint32(), t = e >>> 3, n = e & 7;
|
|
@@ -4499,21 +4499,21 @@ var vr = class {
|
|
|
4499
4499
|
skip(e, t) {
|
|
4500
4500
|
let n = this.pos;
|
|
4501
4501
|
switch (e) {
|
|
4502
|
-
case
|
|
4502
|
+
case _r.Varint:
|
|
4503
4503
|
for (; this.buf[this.pos++] & 128;);
|
|
4504
4504
|
break;
|
|
4505
|
-
case
|
|
4506
|
-
case
|
|
4505
|
+
case _r.Bit64: this.pos += 4;
|
|
4506
|
+
case _r.Bit32:
|
|
4507
4507
|
this.pos += 4;
|
|
4508
4508
|
break;
|
|
4509
|
-
case
|
|
4509
|
+
case _r.LengthDelimited:
|
|
4510
4510
|
let n = this.uint32();
|
|
4511
4511
|
this.pos += n;
|
|
4512
4512
|
break;
|
|
4513
|
-
case
|
|
4513
|
+
case _r.StartGroup:
|
|
4514
4514
|
for (;;) {
|
|
4515
4515
|
let [e, n] = this.tag();
|
|
4516
|
-
if (n ===
|
|
4516
|
+
if (n === _r.EndGroup) {
|
|
4517
4517
|
if (t !== void 0 && e !== t) throw Error("invalid end group tag");
|
|
4518
4518
|
break;
|
|
4519
4519
|
}
|
|
@@ -4535,14 +4535,14 @@ var vr = class {
|
|
|
4535
4535
|
return e >>> 1 ^ -(e & 1);
|
|
4536
4536
|
}
|
|
4537
4537
|
int64() {
|
|
4538
|
-
return
|
|
4538
|
+
return D.dec(...this.varint64());
|
|
4539
4539
|
}
|
|
4540
4540
|
uint64() {
|
|
4541
|
-
return
|
|
4541
|
+
return D.uDec(...this.varint64());
|
|
4542
4542
|
}
|
|
4543
4543
|
sint64() {
|
|
4544
4544
|
let [e, t] = this.varint64(), n = -(e & 1);
|
|
4545
|
-
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n,
|
|
4545
|
+
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n, D.dec(e, t);
|
|
4546
4546
|
}
|
|
4547
4547
|
bool() {
|
|
4548
4548
|
let [e, t] = this.varint64();
|
|
@@ -4555,10 +4555,10 @@ var vr = class {
|
|
|
4555
4555
|
return this.view.getInt32((this.pos += 4) - 4, !0);
|
|
4556
4556
|
}
|
|
4557
4557
|
fixed64() {
|
|
4558
|
-
return
|
|
4558
|
+
return D.uDec(this.sfixed32(), this.sfixed32());
|
|
4559
4559
|
}
|
|
4560
4560
|
sfixed64() {
|
|
4561
|
-
return
|
|
4561
|
+
return D.dec(this.sfixed32(), this.sfixed32());
|
|
4562
4562
|
}
|
|
4563
4563
|
float() {
|
|
4564
4564
|
return this.view.getFloat32((this.pos += 4) - 4, !0);
|
|
@@ -4599,7 +4599,7 @@ function Sr(e) {
|
|
|
4599
4599
|
if (t.default !== void 0) return t.default;
|
|
4600
4600
|
switch (t.kind) {
|
|
4601
4601
|
case "enum": return t.T.values[0].no;
|
|
4602
|
-
case "scalar": return
|
|
4602
|
+
case "scalar": return hr(t.T, t.L);
|
|
4603
4603
|
case "message":
|
|
4604
4604
|
let e = t.T, n = new e();
|
|
4605
4605
|
return e.fieldWrapper ? e.fieldWrapper.unwrapField(n) : n;
|
|
@@ -4691,7 +4691,7 @@ function kr(e, t) {
|
|
|
4691
4691
|
return t.extendee.typeName === n.typeName && !!n.runtime.bin.listUnknownFields(e).find((e) => e.no == t.field.no);
|
|
4692
4692
|
}
|
|
4693
4693
|
function Ar(e, t) {
|
|
4694
|
-
|
|
4694
|
+
E(e.extendee.typeName == t.getType().typeName, `extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`);
|
|
4695
4695
|
}
|
|
4696
4696
|
function jr(e, t) {
|
|
4697
4697
|
let n = e.localName;
|
|
@@ -4699,7 +4699,7 @@ function jr(e, t) {
|
|
|
4699
4699
|
if (e.oneof) return t[e.oneof.localName].case === n;
|
|
4700
4700
|
switch (e.kind) {
|
|
4701
4701
|
case "enum":
|
|
4702
|
-
case "scalar": return e.opt || e.req ? t[n] !== void 0 : e.kind == "enum" ? t[n] !== e.T.values[0].no : !
|
|
4702
|
+
case "scalar": return e.opt || e.req ? t[n] !== void 0 : e.kind == "enum" ? t[n] !== e.T.values[0].no : !gr(e.T, t[n]);
|
|
4703
4703
|
case "message": return t[n] !== void 0;
|
|
4704
4704
|
case "map": return Object.keys(t[n]).length > 0;
|
|
4705
4705
|
}
|
|
@@ -4716,7 +4716,7 @@ function Mr(e, t) {
|
|
|
4716
4716
|
t[n] = r ? e.T.values[0].no : void 0;
|
|
4717
4717
|
break;
|
|
4718
4718
|
case "scalar":
|
|
4719
|
-
t[n] = r ?
|
|
4719
|
+
t[n] = r ? hr(e.T, e.L) : void 0;
|
|
4720
4720
|
break;
|
|
4721
4721
|
case "message":
|
|
4722
4722
|
t[n] = void 0;
|
|
@@ -4724,14 +4724,14 @@ function Mr(e, t) {
|
|
|
4724
4724
|
}
|
|
4725
4725
|
}
|
|
4726
4726
|
function Nr(e, t) {
|
|
4727
|
-
if (typeof e != "object" || !e || !Object.getOwnPropertyNames(
|
|
4727
|
+
if (typeof e != "object" || !e || !Object.getOwnPropertyNames(Qn.prototype).every((t) => t in e && typeof e[t] == "function")) return !1;
|
|
4728
4728
|
let n = e.getType();
|
|
4729
4729
|
return n === null || typeof n != "function" || !("typeName" in n) || typeof n.typeName != "string" ? !1 : t === void 0 ? !0 : n.typeName == t.typeName;
|
|
4730
4730
|
}
|
|
4731
4731
|
function Pr(e, t) {
|
|
4732
4732
|
return Nr(t) || !e.fieldWrapper ? t : e.fieldWrapper.wrapField(t);
|
|
4733
4733
|
}
|
|
4734
|
-
|
|
4734
|
+
O.DOUBLE, O.FLOAT, O.INT64, O.UINT64, O.INT32, O.UINT32, O.BOOL, O.STRING, O.BYTES;
|
|
4735
4735
|
var Fr = { ignoreUnknownFields: !1 }, Ir = {
|
|
4736
4736
|
emitDefaultValues: !1,
|
|
4737
4737
|
enumAsInteger: !1,
|
|
@@ -4804,10 +4804,10 @@ function Vr() {
|
|
|
4804
4804
|
return r;
|
|
4805
4805
|
},
|
|
4806
4806
|
readScalar(e, t, n) {
|
|
4807
|
-
return Gr(e, t, n ??
|
|
4807
|
+
return Gr(e, t, n ?? pr.BIGINT, !0);
|
|
4808
4808
|
},
|
|
4809
4809
|
writeScalar(e, t, n) {
|
|
4810
|
-
if (t !== void 0 && (n ||
|
|
4810
|
+
if (t !== void 0 && (n || gr(e, t))) return Xr(e, t);
|
|
4811
4811
|
},
|
|
4812
4812
|
debug: Hr
|
|
4813
4813
|
};
|
|
@@ -4823,7 +4823,7 @@ function Hr(e) {
|
|
|
4823
4823
|
function Ur(e, t, n, r, i) {
|
|
4824
4824
|
let a = n.localName;
|
|
4825
4825
|
if (n.repeated) {
|
|
4826
|
-
if (
|
|
4826
|
+
if (E(n.kind != "map"), t === null) return;
|
|
4827
4827
|
if (!Array.isArray(t)) throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${Hr(t)}`);
|
|
4828
4828
|
let o = e[a];
|
|
4829
4829
|
for (let e of t) {
|
|
@@ -4869,7 +4869,7 @@ function Ur(e, t, n, r, i) {
|
|
|
4869
4869
|
break;
|
|
4870
4870
|
case "scalar":
|
|
4871
4871
|
try {
|
|
4872
|
-
o[s] = Gr(n.V.T, a,
|
|
4872
|
+
o[s] = Gr(n.V.T, a, pr.BIGINT, !0);
|
|
4873
4873
|
} catch (e) {
|
|
4874
4874
|
let r = `cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${Hr(t)}`;
|
|
4875
4875
|
throw e instanceof Error && e.message.length > 0 && (r += `: ${e.message}`), Error(r);
|
|
@@ -4915,7 +4915,7 @@ function Ur(e, t, n, r, i) {
|
|
|
4915
4915
|
}
|
|
4916
4916
|
}
|
|
4917
4917
|
function Wr(e, t) {
|
|
4918
|
-
if (e ===
|
|
4918
|
+
if (e === O.BOOL) switch (t) {
|
|
4919
4919
|
case "true":
|
|
4920
4920
|
t = !0;
|
|
4921
4921
|
break;
|
|
@@ -4923,46 +4923,46 @@ function Wr(e, t) {
|
|
|
4923
4923
|
t = !1;
|
|
4924
4924
|
break;
|
|
4925
4925
|
}
|
|
4926
|
-
return Gr(e, t,
|
|
4926
|
+
return Gr(e, t, pr.BIGINT, !0).toString();
|
|
4927
4927
|
}
|
|
4928
4928
|
function Gr(e, t, n, r) {
|
|
4929
|
-
if (t === null) return r ?
|
|
4929
|
+
if (t === null) return r ? hr(e, n) : zr;
|
|
4930
4930
|
switch (e) {
|
|
4931
|
-
case
|
|
4932
|
-
case
|
|
4931
|
+
case O.DOUBLE:
|
|
4932
|
+
case O.FLOAT:
|
|
4933
4933
|
if (t === "NaN") return NaN;
|
|
4934
4934
|
if (t === "Infinity") return Infinity;
|
|
4935
4935
|
if (t === "-Infinity") return -Infinity;
|
|
4936
4936
|
if (t === "" || typeof t == "string" && t.trim().length !== t.length || typeof t != "string" && typeof t != "number") break;
|
|
4937
4937
|
let r = Number(t);
|
|
4938
4938
|
if (Number.isNaN(r) || !Number.isFinite(r)) break;
|
|
4939
|
-
return e ==
|
|
4940
|
-
case
|
|
4941
|
-
case
|
|
4942
|
-
case
|
|
4943
|
-
case
|
|
4944
|
-
case
|
|
4939
|
+
return e == O.FLOAT && Gn(r), r;
|
|
4940
|
+
case O.INT32:
|
|
4941
|
+
case O.FIXED32:
|
|
4942
|
+
case O.SFIXED32:
|
|
4943
|
+
case O.SINT32:
|
|
4944
|
+
case O.UINT32:
|
|
4945
4945
|
let i;
|
|
4946
4946
|
if (typeof t == "number" ? i = t : typeof t == "string" && t.length > 0 && t.trim().length === t.length && (i = Number(t)), i === void 0) break;
|
|
4947
|
-
return e ==
|
|
4948
|
-
case
|
|
4949
|
-
case
|
|
4950
|
-
case
|
|
4947
|
+
return e == O.UINT32 || e == O.FIXED32 ? Wn(i) : Un(i), i;
|
|
4948
|
+
case O.INT64:
|
|
4949
|
+
case O.SFIXED64:
|
|
4950
|
+
case O.SINT64:
|
|
4951
4951
|
if (typeof t != "number" && typeof t != "string") break;
|
|
4952
|
-
let a =
|
|
4952
|
+
let a = D.parse(t);
|
|
4953
4953
|
return n ? a.toString() : a;
|
|
4954
|
-
case
|
|
4955
|
-
case
|
|
4954
|
+
case O.FIXED64:
|
|
4955
|
+
case O.UINT64:
|
|
4956
4956
|
if (typeof t != "number" && typeof t != "string") break;
|
|
4957
|
-
let o =
|
|
4957
|
+
let o = D.uParse(t);
|
|
4958
4958
|
return n ? o.toString() : o;
|
|
4959
|
-
case
|
|
4959
|
+
case O.BOOL:
|
|
4960
4960
|
if (typeof t != "boolean") break;
|
|
4961
4961
|
return t;
|
|
4962
|
-
case
|
|
4962
|
+
case O.STRING:
|
|
4963
4963
|
if (typeof t != "string") break;
|
|
4964
4964
|
return t;
|
|
4965
|
-
case
|
|
4965
|
+
case O.BYTES:
|
|
4966
4966
|
if (t === "") return new Uint8Array();
|
|
4967
4967
|
if (typeof t != "string") break;
|
|
4968
4968
|
return Er.dec(t);
|
|
@@ -4988,7 +4988,7 @@ function qr(e) {
|
|
|
4988
4988
|
}
|
|
4989
4989
|
function Jr(e, t, n) {
|
|
4990
4990
|
if (e.kind == "map") {
|
|
4991
|
-
|
|
4991
|
+
E(typeof t == "object" && !!t);
|
|
4992
4992
|
let r = {}, i = Object.entries(t);
|
|
4993
4993
|
switch (e.V.kind) {
|
|
4994
4994
|
case "scalar":
|
|
@@ -5005,7 +5005,7 @@ function Jr(e, t, n) {
|
|
|
5005
5005
|
return n.emitDefaultValues || i.length > 0 ? r : void 0;
|
|
5006
5006
|
}
|
|
5007
5007
|
if (e.repeated) {
|
|
5008
|
-
|
|
5008
|
+
E(Array.isArray(t));
|
|
5009
5009
|
let r = [];
|
|
5010
5010
|
switch (e.kind) {
|
|
5011
5011
|
case "scalar":
|
|
@@ -5027,25 +5027,25 @@ function Jr(e, t, n) {
|
|
|
5027
5027
|
}
|
|
5028
5028
|
}
|
|
5029
5029
|
function Yr(e, t, n) {
|
|
5030
|
-
return
|
|
5030
|
+
return E(typeof t == "number"), e.typeName == "google.protobuf.NullValue" ? null : n ? t : e.findNumber(t)?.name ?? t;
|
|
5031
5031
|
}
|
|
5032
5032
|
function Xr(e, t) {
|
|
5033
5033
|
switch (e) {
|
|
5034
|
-
case
|
|
5035
|
-
case
|
|
5036
|
-
case
|
|
5037
|
-
case
|
|
5038
|
-
case
|
|
5039
|
-
case
|
|
5040
|
-
case
|
|
5041
|
-
case
|
|
5042
|
-
case
|
|
5043
|
-
case
|
|
5044
|
-
case
|
|
5045
|
-
case
|
|
5046
|
-
case
|
|
5047
|
-
case
|
|
5048
|
-
case
|
|
5034
|
+
case O.INT32:
|
|
5035
|
+
case O.SFIXED32:
|
|
5036
|
+
case O.SINT32:
|
|
5037
|
+
case O.FIXED32:
|
|
5038
|
+
case O.UINT32: return E(typeof t == "number"), t;
|
|
5039
|
+
case O.FLOAT:
|
|
5040
|
+
case O.DOUBLE: return E(typeof t == "number"), Number.isNaN(t) ? "NaN" : t === Infinity ? "Infinity" : t === -Infinity ? "-Infinity" : t;
|
|
5041
|
+
case O.STRING: return E(typeof t == "string"), t;
|
|
5042
|
+
case O.BOOL: return E(typeof t == "boolean"), t;
|
|
5043
|
+
case O.UINT64:
|
|
5044
|
+
case O.FIXED64:
|
|
5045
|
+
case O.INT64:
|
|
5046
|
+
case O.SFIXED64:
|
|
5047
|
+
case O.SINT64: return E(typeof t == "bigint" || typeof t == "string" || typeof t == "number"), t.toString();
|
|
5048
|
+
case O.BYTES: return E(t instanceof Uint8Array), Er.enc(t);
|
|
5049
5049
|
}
|
|
5050
5050
|
}
|
|
5051
5051
|
var Zr = Symbol("@bufbuild/protobuf/unknown-fields"), Qr = {
|
|
@@ -5085,7 +5085,7 @@ function ni() {
|
|
|
5085
5085
|
},
|
|
5086
5086
|
readMessage(e, t, n, r, i) {
|
|
5087
5087
|
let a = e.getType(), o = i ? t.len : t.pos + n, s, c;
|
|
5088
|
-
for (; t.pos < o && ([s, c] = t.tag(), !(i === !0 && c ==
|
|
5088
|
+
for (; t.pos < o && ([s, c] = t.tag(), !(i === !0 && c == _r.EndGroup));) {
|
|
5089
5089
|
let n = a.fields.find(s);
|
|
5090
5090
|
if (!n) {
|
|
5091
5091
|
let n = t.skip(c, s);
|
|
@@ -5094,7 +5094,7 @@ function ni() {
|
|
|
5094
5094
|
}
|
|
5095
5095
|
ri(e, t, n, c, r);
|
|
5096
5096
|
}
|
|
5097
|
-
if (i && (c !=
|
|
5097
|
+
if (i && (c != _r.EndGroup || s !== n)) throw Error("invalid end group tag");
|
|
5098
5098
|
},
|
|
5099
5099
|
readField: ri,
|
|
5100
5100
|
writeMessage(e, t, n) {
|
|
@@ -5118,10 +5118,10 @@ function ri(e, t, n, r, i) {
|
|
|
5118
5118
|
switch (n.oneof && (e = e[n.oneof.localName], e.case != o && delete e.value, e.case = o, o = "value"), n.kind) {
|
|
5119
5119
|
case "scalar":
|
|
5120
5120
|
case "enum":
|
|
5121
|
-
let s = n.kind == "enum" ?
|
|
5121
|
+
let s = n.kind == "enum" ? O.INT32 : n.T, c = si;
|
|
5122
5122
|
if (n.kind == "scalar" && n.L > 0 && (c = oi), a) {
|
|
5123
5123
|
let n = e[o];
|
|
5124
|
-
if (r ==
|
|
5124
|
+
if (r == _r.LengthDelimited && s != O.STRING && s != O.BYTES) {
|
|
5125
5125
|
let e = t.uint32() + t.pos;
|
|
5126
5126
|
for (; t.pos < e;) n.push(c(t, s));
|
|
5127
5127
|
} else n.push(c(t, s));
|
|
@@ -5164,9 +5164,9 @@ function ai(e, t, n) {
|
|
|
5164
5164
|
break;
|
|
5165
5165
|
}
|
|
5166
5166
|
}
|
|
5167
|
-
if (a === void 0 && (a =
|
|
5167
|
+
if (a === void 0 && (a = hr(e.K, pr.BIGINT)), typeof a != "string" && typeof a != "number" && (a = a.toString()), o === void 0) switch (e.V.kind) {
|
|
5168
5168
|
case "scalar":
|
|
5169
|
-
o =
|
|
5169
|
+
o = hr(e.V.T, pr.BIGINT);
|
|
5170
5170
|
break;
|
|
5171
5171
|
case "enum":
|
|
5172
5172
|
o = e.V.T.values[0].no;
|
|
@@ -5183,59 +5183,59 @@ function oi(e, t) {
|
|
|
5183
5183
|
}
|
|
5184
5184
|
function si(e, t) {
|
|
5185
5185
|
switch (t) {
|
|
5186
|
-
case
|
|
5187
|
-
case
|
|
5188
|
-
case
|
|
5189
|
-
case
|
|
5190
|
-
case
|
|
5191
|
-
case
|
|
5192
|
-
case
|
|
5193
|
-
case
|
|
5194
|
-
case
|
|
5195
|
-
case
|
|
5196
|
-
case
|
|
5197
|
-
case
|
|
5198
|
-
case
|
|
5199
|
-
case
|
|
5200
|
-
case
|
|
5186
|
+
case O.STRING: return e.string();
|
|
5187
|
+
case O.BOOL: return e.bool();
|
|
5188
|
+
case O.DOUBLE: return e.double();
|
|
5189
|
+
case O.FLOAT: return e.float();
|
|
5190
|
+
case O.INT32: return e.int32();
|
|
5191
|
+
case O.INT64: return e.int64();
|
|
5192
|
+
case O.UINT64: return e.uint64();
|
|
5193
|
+
case O.FIXED64: return e.fixed64();
|
|
5194
|
+
case O.BYTES: return e.bytes();
|
|
5195
|
+
case O.FIXED32: return e.fixed32();
|
|
5196
|
+
case O.SFIXED32: return e.sfixed32();
|
|
5197
|
+
case O.SFIXED64: return e.sfixed64();
|
|
5198
|
+
case O.SINT64: return e.sint64();
|
|
5199
|
+
case O.UINT32: return e.uint32();
|
|
5200
|
+
case O.SINT32: return e.sint32();
|
|
5201
5201
|
}
|
|
5202
5202
|
}
|
|
5203
5203
|
function ci(e, t, n, r) {
|
|
5204
|
-
|
|
5204
|
+
E(t !== void 0);
|
|
5205
5205
|
let i = e.repeated;
|
|
5206
5206
|
switch (e.kind) {
|
|
5207
5207
|
case "scalar":
|
|
5208
5208
|
case "enum":
|
|
5209
|
-
let a = e.kind == "enum" ?
|
|
5210
|
-
if (i) if (
|
|
5209
|
+
let a = e.kind == "enum" ? O.INT32 : e.T;
|
|
5210
|
+
if (i) if (E(Array.isArray(t)), e.packed) fi(n, a, e.no, t);
|
|
5211
5211
|
else for (let r of t) di(n, a, e.no, r);
|
|
5212
5212
|
else di(n, a, e.no, t);
|
|
5213
5213
|
break;
|
|
5214
5214
|
case "message":
|
|
5215
5215
|
if (i) {
|
|
5216
|
-
|
|
5216
|
+
E(Array.isArray(t));
|
|
5217
5217
|
for (let i of t) ui(n, r, e, i);
|
|
5218
5218
|
} else ui(n, r, e, t);
|
|
5219
5219
|
break;
|
|
5220
5220
|
case "map":
|
|
5221
|
-
|
|
5221
|
+
E(typeof t == "object" && !!t);
|
|
5222
5222
|
for (let [i, a] of Object.entries(t)) li(n, r, e, i, a);
|
|
5223
5223
|
break;
|
|
5224
5224
|
}
|
|
5225
5225
|
}
|
|
5226
5226
|
function li(e, t, n, r, i) {
|
|
5227
|
-
e.tag(n.no,
|
|
5227
|
+
e.tag(n.no, _r.LengthDelimited), e.fork();
|
|
5228
5228
|
let a = r;
|
|
5229
5229
|
switch (n.K) {
|
|
5230
|
-
case
|
|
5231
|
-
case
|
|
5232
|
-
case
|
|
5233
|
-
case
|
|
5234
|
-
case
|
|
5230
|
+
case O.INT32:
|
|
5231
|
+
case O.FIXED32:
|
|
5232
|
+
case O.UINT32:
|
|
5233
|
+
case O.SFIXED32:
|
|
5234
|
+
case O.SINT32:
|
|
5235
5235
|
a = Number.parseInt(r);
|
|
5236
5236
|
break;
|
|
5237
|
-
case
|
|
5238
|
-
|
|
5237
|
+
case O.BOOL:
|
|
5238
|
+
E(r == "true" || r == "false"), a = r == "true";
|
|
5239
5239
|
break;
|
|
5240
5240
|
}
|
|
5241
5241
|
switch (di(e, n.K, 1, a), n.V.kind) {
|
|
@@ -5243,54 +5243,54 @@ function li(e, t, n, r, i) {
|
|
|
5243
5243
|
di(e, n.V.T, 2, i);
|
|
5244
5244
|
break;
|
|
5245
5245
|
case "enum":
|
|
5246
|
-
di(e,
|
|
5246
|
+
di(e, O.INT32, 2, i);
|
|
5247
5247
|
break;
|
|
5248
5248
|
case "message":
|
|
5249
|
-
|
|
5249
|
+
E(i !== void 0), e.tag(2, _r.LengthDelimited).bytes(i.toBinary(t));
|
|
5250
5250
|
break;
|
|
5251
5251
|
}
|
|
5252
5252
|
e.join();
|
|
5253
5253
|
}
|
|
5254
5254
|
function ui(e, t, n, r) {
|
|
5255
5255
|
let i = Pr(n.T, r);
|
|
5256
|
-
n.delimited ? e.tag(n.no,
|
|
5256
|
+
n.delimited ? e.tag(n.no, _r.StartGroup).raw(i.toBinary(t)).tag(n.no, _r.EndGroup) : e.tag(n.no, _r.LengthDelimited).bytes(i.toBinary(t));
|
|
5257
5257
|
}
|
|
5258
5258
|
function di(e, t, n, r) {
|
|
5259
|
-
|
|
5259
|
+
E(r !== void 0);
|
|
5260
5260
|
let [i, a] = pi(t);
|
|
5261
5261
|
e.tag(n, i)[a](r);
|
|
5262
5262
|
}
|
|
5263
5263
|
function fi(e, t, n, r) {
|
|
5264
5264
|
if (!r.length) return;
|
|
5265
|
-
e.tag(n,
|
|
5265
|
+
e.tag(n, _r.LengthDelimited).fork();
|
|
5266
5266
|
let [, i] = pi(t);
|
|
5267
5267
|
for (let t = 0; t < r.length; t++) e[i](r[t]);
|
|
5268
5268
|
e.join();
|
|
5269
5269
|
}
|
|
5270
5270
|
function pi(e) {
|
|
5271
|
-
let t =
|
|
5271
|
+
let t = _r.Varint;
|
|
5272
5272
|
switch (e) {
|
|
5273
|
-
case
|
|
5274
|
-
case
|
|
5275
|
-
t =
|
|
5273
|
+
case O.BYTES:
|
|
5274
|
+
case O.STRING:
|
|
5275
|
+
t = _r.LengthDelimited;
|
|
5276
5276
|
break;
|
|
5277
|
-
case
|
|
5278
|
-
case
|
|
5279
|
-
case
|
|
5280
|
-
t =
|
|
5277
|
+
case O.DOUBLE:
|
|
5278
|
+
case O.FIXED64:
|
|
5279
|
+
case O.SFIXED64:
|
|
5280
|
+
t = _r.Bit64;
|
|
5281
5281
|
break;
|
|
5282
|
-
case
|
|
5283
|
-
case
|
|
5284
|
-
case
|
|
5285
|
-
t =
|
|
5282
|
+
case O.FIXED32:
|
|
5283
|
+
case O.SFIXED32:
|
|
5284
|
+
case O.FLOAT:
|
|
5285
|
+
t = _r.Bit32;
|
|
5286
5286
|
break;
|
|
5287
5287
|
}
|
|
5288
|
-
let n =
|
|
5288
|
+
let n = O[e].toLowerCase();
|
|
5289
5289
|
return [t, n];
|
|
5290
5290
|
}
|
|
5291
5291
|
function mi() {
|
|
5292
5292
|
return {
|
|
5293
|
-
setEnumType:
|
|
5293
|
+
setEnumType: Jn,
|
|
5294
5294
|
initPartial(e, t) {
|
|
5295
5295
|
if (e === void 0) return;
|
|
5296
5296
|
let n = t.getType();
|
|
@@ -5301,7 +5301,7 @@ function mi() {
|
|
|
5301
5301
|
let e = a[n].case;
|
|
5302
5302
|
if (e === void 0) continue;
|
|
5303
5303
|
let t = r.findField(e), o = a[n].value;
|
|
5304
|
-
t && t.kind == "message" && !Nr(o, t.T) ? o = new t.T(o) : t && t.kind === "scalar" && t.T ===
|
|
5304
|
+
t && t.kind == "message" && !Nr(o, t.T) ? o = new t.T(o) : t && t.kind === "scalar" && t.T === O.BYTES && (o = gi(o)), i[n] = {
|
|
5305
5305
|
case: e,
|
|
5306
5306
|
value: o
|
|
5307
5307
|
};
|
|
@@ -5309,13 +5309,13 @@ function mi() {
|
|
|
5309
5309
|
case "scalar":
|
|
5310
5310
|
case "enum":
|
|
5311
5311
|
let s = a[n];
|
|
5312
|
-
r.T ===
|
|
5312
|
+
r.T === O.BYTES && (s = r.repeated ? s.map(gi) : gi(s)), i[n] = s;
|
|
5313
5313
|
break;
|
|
5314
5314
|
case "map":
|
|
5315
5315
|
switch (r.V.kind) {
|
|
5316
5316
|
case "scalar":
|
|
5317
5317
|
case "enum":
|
|
5318
|
-
if (r.V.T ===
|
|
5318
|
+
if (r.V.T === O.BYTES) for (let [e, t] of Object.entries(a[n])) i[n][e] = gi(t);
|
|
5319
5319
|
else Object.assign(i[n], a[n]);
|
|
5320
5320
|
break;
|
|
5321
5321
|
case "message":
|
|
@@ -5345,8 +5345,8 @@ function mi() {
|
|
|
5345
5345
|
if (r.length !== i.length) return !1;
|
|
5346
5346
|
switch (e.kind) {
|
|
5347
5347
|
case "message": return r.every((t, n) => e.T.equals(t, i[n]));
|
|
5348
|
-
case "scalar": return r.every((t, n) =>
|
|
5349
|
-
case "enum": return r.every((e, t) =>
|
|
5348
|
+
case "scalar": return r.every((t, n) => mr(e.T, t, i[n]));
|
|
5349
|
+
case "enum": return r.every((e, t) => mr(O.INT32, e, i[t]));
|
|
5350
5350
|
}
|
|
5351
5351
|
throw Error(`repeated cannot contain ${e.kind}`);
|
|
5352
5352
|
}
|
|
@@ -5354,16 +5354,16 @@ function mi() {
|
|
|
5354
5354
|
case "message":
|
|
5355
5355
|
let t = r, n = i;
|
|
5356
5356
|
return e.T.fieldWrapper && (t !== void 0 && !Nr(t) && (t = e.T.fieldWrapper.wrapField(t)), n !== void 0 && !Nr(n) && (n = e.T.fieldWrapper.wrapField(n))), e.T.equals(t, n);
|
|
5357
|
-
case "enum": return
|
|
5358
|
-
case "scalar": return
|
|
5357
|
+
case "enum": return mr(O.INT32, r, i);
|
|
5358
|
+
case "scalar": return mr(e.T, r, i);
|
|
5359
5359
|
case "oneof":
|
|
5360
5360
|
if (r.case !== i.case) return !1;
|
|
5361
5361
|
let a = e.findField(r.case);
|
|
5362
5362
|
if (a === void 0) return !0;
|
|
5363
5363
|
switch (a.kind) {
|
|
5364
5364
|
case "message": return a.T.equals(r.value, i.value);
|
|
5365
|
-
case "enum": return
|
|
5366
|
-
case "scalar": return
|
|
5365
|
+
case "enum": return mr(O.INT32, r.value, i.value);
|
|
5366
|
+
case "scalar": return mr(a.T, r.value, i.value);
|
|
5367
5367
|
}
|
|
5368
5368
|
throw Error(`oneof cannot contain ${a.kind}`);
|
|
5369
5369
|
case "map":
|
|
@@ -5372,10 +5372,10 @@ function mi() {
|
|
|
5372
5372
|
case "message":
|
|
5373
5373
|
let t = e.V.T;
|
|
5374
5374
|
return o.every((e) => t.equals(r[e], i[e]));
|
|
5375
|
-
case "enum": return o.every((e) =>
|
|
5375
|
+
case "enum": return o.every((e) => mr(O.INT32, r[e], i[e]));
|
|
5376
5376
|
case "scalar":
|
|
5377
5377
|
let n = e.V.T;
|
|
5378
|
-
return o.every((e) =>
|
|
5378
|
+
return o.every((e) => mr(n, r[e], i[e]));
|
|
5379
5379
|
}
|
|
5380
5380
|
break;
|
|
5381
5381
|
}
|
|
@@ -5422,11 +5422,11 @@ function _i(e, t, n) {
|
|
|
5422
5422
|
initFields: n
|
|
5423
5423
|
}),
|
|
5424
5424
|
makeMessageType(e, t, n) {
|
|
5425
|
-
return
|
|
5425
|
+
return $n(this, e, t, n);
|
|
5426
5426
|
},
|
|
5427
|
-
makeEnum:
|
|
5428
|
-
makeEnumType:
|
|
5429
|
-
getEnumType:
|
|
5427
|
+
makeEnum: Xn,
|
|
5428
|
+
makeEnumType: Yn,
|
|
5429
|
+
getEnumType: qn,
|
|
5430
5430
|
makeExtension(e, t, n) {
|
|
5431
5431
|
return br(this, e, t, n);
|
|
5432
5432
|
}
|
|
@@ -5523,7 +5523,7 @@ var Ci = new Set([
|
|
|
5523
5523
|
this.kind = "oneof", this.repeated = !1, this.packed = !1, this.opt = !1, this.req = !1, this.default = void 0, this.fields = [], this.name = e, this.localName = bi(e);
|
|
5524
5524
|
}
|
|
5525
5525
|
addField(e) {
|
|
5526
|
-
|
|
5526
|
+
E(e.oneof === this, `field ${e.name} not one of ${this.name}`), this.fields.push(e);
|
|
5527
5527
|
}
|
|
5528
5528
|
findField(e) {
|
|
5529
5529
|
if (!this._lookup) {
|
|
@@ -5537,7 +5537,7 @@ function ki(e, t) {
|
|
|
5537
5537
|
let n = [], r;
|
|
5538
5538
|
for (let t of typeof e == "function" ? e() : e) {
|
|
5539
5539
|
let e = t;
|
|
5540
|
-
if (e.localName = yi(t.name, t.oneof !== void 0), e.jsonName = t.jsonName ?? xi(t.name), e.repeated = t.repeated ?? !1, t.kind == "scalar" && (e.L = t.L ??
|
|
5540
|
+
if (e.localName = yi(t.name, t.oneof !== void 0), e.jsonName = t.jsonName ?? xi(t.name), e.repeated = t.repeated ?? !1, t.kind == "scalar" && (e.L = t.L ?? pr.BIGINT), e.delimited = t.delimited ?? !1, e.req = t.req ?? !1, e.opt = t.opt ?? !1, t.packed === void 0 && (e.packed = t.kind == "enum" || t.kind == "scalar" && t.T != O.BYTES && t.T != O.STRING), t.oneof !== void 0) {
|
|
5541
5541
|
let n = typeof t.oneof == "string" ? t.oneof : t.oneof.name;
|
|
5542
5542
|
(!r || r.name != n) && (r = new Oi(n)), e.oneof = r, r.addField(e);
|
|
5543
5543
|
}
|
|
@@ -5564,13 +5564,13 @@ var k = _i("proto3", (e) => new vi(e, (e) => ki(e)), (e) => {
|
|
|
5564
5564
|
r[n] = {};
|
|
5565
5565
|
break;
|
|
5566
5566
|
case "scalar":
|
|
5567
|
-
r[n] =
|
|
5567
|
+
r[n] = hr(t.T, t.L);
|
|
5568
5568
|
break;
|
|
5569
5569
|
}
|
|
5570
5570
|
}
|
|
5571
|
-
}), Ai = class e extends
|
|
5571
|
+
}), Ai = class e extends Qn {
|
|
5572
5572
|
constructor(e) {
|
|
5573
|
-
super(), this.seconds =
|
|
5573
|
+
super(), this.seconds = D.zero, this.nanos = 0, k.util.initPartial(e, this);
|
|
5574
5574
|
}
|
|
5575
5575
|
fromJson(e, t) {
|
|
5576
5576
|
if (typeof e != "string") throw Error(`cannot decode google.protobuf.Timestamp from JSON: ${k.json.debug(e)}`);
|
|
@@ -5579,7 +5579,7 @@ var k = _i("proto3", (e) => new vi(e, (e) => ki(e)), (e) => {
|
|
|
5579
5579
|
let r = Date.parse(n[1] + "-" + n[2] + "-" + n[3] + "T" + n[4] + ":" + n[5] + ":" + n[6] + (n[8] ? n[8] : "Z"));
|
|
5580
5580
|
if (Number.isNaN(r)) throw Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");
|
|
5581
5581
|
if (r < Date.parse("0001-01-01T00:00:00Z") || r > Date.parse("9999-12-31T23:59:59Z")) throw Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");
|
|
5582
|
-
return this.seconds =
|
|
5582
|
+
return this.seconds = D.parse(r / 1e3), this.nanos = 0, n[7] && (this.nanos = parseInt("1" + n[7] + "0".repeat(9 - n[7].length)) - 1e9), this;
|
|
5583
5583
|
}
|
|
5584
5584
|
toJson(e) {
|
|
5585
5585
|
let t = Number(this.seconds) * 1e3;
|
|
@@ -5601,7 +5601,7 @@ var k = _i("proto3", (e) => new vi(e, (e) => ki(e)), (e) => {
|
|
|
5601
5601
|
static fromDate(t) {
|
|
5602
5602
|
let n = t.getTime();
|
|
5603
5603
|
return new e({
|
|
5604
|
-
seconds:
|
|
5604
|
+
seconds: D.parse(Math.floor(n / 1e3)),
|
|
5605
5605
|
nanos: n % 1e3 * 1e6
|
|
5606
5606
|
});
|
|
5607
5607
|
}
|
|
@@ -9204,7 +9204,7 @@ function Jo() {
|
|
|
9204
9204
|
return o.levels[e] === void 0 && (e = void 0), e;
|
|
9205
9205
|
}
|
|
9206
9206
|
}
|
|
9207
|
-
function
|
|
9207
|
+
function ee() {
|
|
9208
9208
|
if (!(typeof window === t || !f)) {
|
|
9209
9209
|
try {
|
|
9210
9210
|
window.localStorage.removeItem(f);
|
|
@@ -9214,7 +9214,7 @@ function Jo() {
|
|
|
9214
9214
|
} catch {}
|
|
9215
9215
|
}
|
|
9216
9216
|
}
|
|
9217
|
-
function
|
|
9217
|
+
function te(e) {
|
|
9218
9218
|
var t = e;
|
|
9219
9219
|
if (typeof t == "string" && o.levels[t.toUpperCase()] !== void 0 && (t = o.levels[t.toUpperCase()]), typeof t == "number" && t >= 0 && t <= o.levels.SILENT) return t;
|
|
9220
9220
|
throw TypeError("log.setLevel() called with invalid level: " + e);
|
|
@@ -9229,20 +9229,20 @@ function Jo() {
|
|
|
9229
9229
|
}, o.methodFactory = n || d, o.getLevel = function() {
|
|
9230
9230
|
return u ?? c ?? s;
|
|
9231
9231
|
}, o.setLevel = function(e, t) {
|
|
9232
|
-
return u =
|
|
9232
|
+
return u = te(e), t !== !1 && p(u), l.call(o);
|
|
9233
9233
|
}, o.setDefaultLevel = function(e) {
|
|
9234
|
-
c =
|
|
9234
|
+
c = te(e), m() || o.setLevel(e, !1);
|
|
9235
9235
|
}, o.resetLevel = function() {
|
|
9236
|
-
u = null,
|
|
9236
|
+
u = null, ee(), l.call(o);
|
|
9237
9237
|
}, o.enableAll = function(e) {
|
|
9238
9238
|
o.setLevel(o.levels.TRACE, e);
|
|
9239
9239
|
}, o.disableAll = function(e) {
|
|
9240
9240
|
o.setLevel(o.levels.SILENT, e);
|
|
9241
9241
|
}, o.rebuild = function() {
|
|
9242
|
-
if (a !== o && (s =
|
|
9243
|
-
}, s =
|
|
9244
|
-
var
|
|
9245
|
-
|
|
9242
|
+
if (a !== o && (s = te(a.getLevel())), l.call(o), a === o) for (var e in i) i[e].rebuild();
|
|
9243
|
+
}, s = te(a ? a.getLevel() : "WARN");
|
|
9244
|
+
var h = m();
|
|
9245
|
+
h != null && (u = te(h)), l.call(o);
|
|
9246
9246
|
}
|
|
9247
9247
|
a = new f(), a.getLogger = function(e) {
|
|
9248
9248
|
if (typeof e != "symbol" && typeof e != "string" || e === "") throw TypeError("You must supply a name when creating a logger.");
|
|
@@ -9441,7 +9441,7 @@ function ds() {
|
|
|
9441
9441
|
function a() {
|
|
9442
9442
|
a.init.call(this);
|
|
9443
9443
|
}
|
|
9444
|
-
ls.exports = a, ls.exports.once =
|
|
9444
|
+
ls.exports = a, ls.exports.once = h, a.EventEmitter = a, a.prototype._events = void 0, a.prototype._eventsCount = 0, a.prototype._maxListeners = void 0;
|
|
9445
9445
|
var o = 10;
|
|
9446
9446
|
function s(e) {
|
|
9447
9447
|
if (typeof e != "function") throw TypeError("The \"listener\" argument must be of type Function. Received type " + typeof e);
|
|
@@ -9525,7 +9525,7 @@ function ds() {
|
|
|
9525
9525
|
break;
|
|
9526
9526
|
}
|
|
9527
9527
|
if (i < 0) return this;
|
|
9528
|
-
i === 0 ? n.shift() :
|
|
9528
|
+
i === 0 ? n.shift() : ee(n, i), n.length === 1 && (r[e] = n[0]), r.removeListener !== void 0 && this.emit("removeListener", e, o || t);
|
|
9529
9529
|
}
|
|
9530
9530
|
return this;
|
|
9531
9531
|
}, a.prototype.off = a.prototype.removeListener, a.prototype.removeAllListeners = function(e) {
|
|
@@ -9545,7 +9545,7 @@ function ds() {
|
|
|
9545
9545
|
var r = e._events;
|
|
9546
9546
|
if (r === void 0) return [];
|
|
9547
9547
|
var i = r[t];
|
|
9548
|
-
return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ?
|
|
9548
|
+
return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? te(i) : m(i, i.length);
|
|
9549
9549
|
}
|
|
9550
9550
|
a.prototype.listeners = function(e) {
|
|
9551
9551
|
return f(this, e, !0);
|
|
@@ -9570,15 +9570,15 @@ function ds() {
|
|
|
9570
9570
|
for (var n = Array(t), r = 0; r < t; ++r) n[r] = e[r];
|
|
9571
9571
|
return n;
|
|
9572
9572
|
}
|
|
9573
|
-
function
|
|
9573
|
+
function ee(e, t) {
|
|
9574
9574
|
for (; t + 1 < e.length; t++) e[t] = e[t + 1];
|
|
9575
9575
|
e.pop();
|
|
9576
9576
|
}
|
|
9577
|
-
function
|
|
9577
|
+
function te(e) {
|
|
9578
9578
|
for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
|
|
9579
9579
|
return t;
|
|
9580
9580
|
}
|
|
9581
|
-
function
|
|
9581
|
+
function h(e, t) {
|
|
9582
9582
|
return new Promise(function(n, r) {
|
|
9583
9583
|
function i(n) {
|
|
9584
9584
|
e.removeListener(t, a), r(n);
|
|
@@ -9586,13 +9586,13 @@ function ds() {
|
|
|
9586
9586
|
function a() {
|
|
9587
9587
|
typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
|
|
9588
9588
|
}
|
|
9589
|
-
|
|
9589
|
+
re(e, t, a, { once: !0 }), t !== "error" && ne(e, i, { once: !0 });
|
|
9590
9590
|
});
|
|
9591
9591
|
}
|
|
9592
|
-
function
|
|
9593
|
-
typeof e.on == "function" &&
|
|
9592
|
+
function ne(e, t, n) {
|
|
9593
|
+
typeof e.on == "function" && re(e, "error", t, n);
|
|
9594
9594
|
}
|
|
9595
|
-
function
|
|
9595
|
+
function re(e, t, n, r) {
|
|
9596
9596
|
if (typeof e.on == "function") r.once ? e.once(t, n) : e.on(t, n);
|
|
9597
9597
|
else if (typeof e.addEventListener == "function") e.addEventListener(t, function i(a) {
|
|
9598
9598
|
r.once && e.removeEventListener(t, i), n(a);
|
|
@@ -10694,7 +10694,7 @@ function cc() {
|
|
|
10694
10694
|
}, e.exports = t;
|
|
10695
10695
|
})(oc), oc.exports);
|
|
10696
10696
|
}
|
|
10697
|
-
var lc = cc(), uc = /* @__PURE__ */ Wo(lc), dc = /* @__PURE__ */
|
|
10697
|
+
var lc = cc(), uc = /* @__PURE__ */ Wo(lc), dc = /* @__PURE__ */ Nn({
|
|
10698
10698
|
__proto__: null,
|
|
10699
10699
|
default: uc
|
|
10700
10700
|
}, [lc]);
|
|
@@ -12376,7 +12376,7 @@ var nd = class e extends Nc {
|
|
|
12376
12376
|
})(od ||= {});
|
|
12377
12377
|
var sd = class {
|
|
12378
12378
|
constructor() {
|
|
12379
|
-
this.pendingTasks = /* @__PURE__ */ new Map(), this.taskMutex = new
|
|
12379
|
+
this.pendingTasks = /* @__PURE__ */ new Map(), this.taskMutex = new Ln(), this.nextTaskIndex = 0;
|
|
12380
12380
|
}
|
|
12381
12381
|
run(e) {
|
|
12382
12382
|
return N(this, void 0, void 0, function* () {
|
|
@@ -12498,7 +12498,7 @@ var dd = 250, fd = class {
|
|
|
12498
12498
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
12499
12499
|
this.rtt = 0, this.state = G.DISCONNECTED, this.log = M, this._requestId = 0, this.useV0SignalPath = !1, this.resetCallbacks = () => {
|
|
12500
12500
|
this.onAnswer = void 0, this.onLeave = void 0, this.onLocalTrackPublished = void 0, this.onLocalTrackUnpublished = void 0, this.onNegotiateRequested = void 0, this.onOffer = void 0, this.onRemoteMuteChanged = void 0, this.onSubscribedQualityUpdate = void 0, this.onTokenRefresh = void 0, this.onTrickle = void 0, this.onClose = void 0, this.onMediaSectionsRequirement = void 0;
|
|
12501
|
-
}, this.log = Qo(t.loggerName ?? Zo.Signal), this.loggerContextCb = t.loggerContextCb, this.useJSON = e, this.requestQueue = new sd(), this.queuedRequests = [], this.closingLock = new
|
|
12501
|
+
}, this.log = Qo(t.loggerName ?? Zo.Signal), this.loggerContextCb = t.loggerContextCb, this.useJSON = e, this.requestQueue = new sd(), this.queuedRequests = [], this.closingLock = new Ln(), this.connectionLock = new Ln(), this.state = G.DISCONNECTED;
|
|
12502
12502
|
}
|
|
12503
12503
|
get logContext() {
|
|
12504
12504
|
return this.loggerContextCb?.call(this) ?? {};
|
|
@@ -12736,12 +12736,12 @@ var dd = 250, fd = class {
|
|
|
12736
12736
|
sendPing() {
|
|
12737
12737
|
return Promise.all([this.sendRequest({
|
|
12738
12738
|
case: "ping",
|
|
12739
|
-
value:
|
|
12739
|
+
value: D.parse(Date.now())
|
|
12740
12740
|
}), this.sendRequest({
|
|
12741
12741
|
case: "pingReq",
|
|
12742
12742
|
value: new jo({
|
|
12743
|
-
timestamp:
|
|
12744
|
-
rtt:
|
|
12743
|
+
timestamp: D.parse(Date.now()),
|
|
12744
|
+
rtt: D.parse(this.rtt)
|
|
12745
12745
|
})
|
|
12746
12746
|
})]);
|
|
12747
12747
|
}
|
|
@@ -13701,7 +13701,7 @@ var Nd = .7, Pd = 20, Fd = {
|
|
|
13701
13701
|
}
|
|
13702
13702
|
}), Pd), this.close = () => {
|
|
13703
13703
|
this._pc &&= (this._pc.close(), this._pc.onconnectionstatechange = null, this._pc.oniceconnectionstatechange = null, this._pc.onicegatheringstatechange = null, this._pc.ondatachannel = null, this._pc.onnegotiationneeded = null, this._pc.onsignalingstatechange = null, this._pc.onicecandidate = null, this._pc.ondatachannel = null, this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.oniceconnectionstatechange = null, null);
|
|
13704
|
-
}, this.log = Qo(t.loggerName ?? Zo.PCTransport), this.loggerOptions = t, this.config = e, this._pc = this.createPC(), this.offerLock = new
|
|
13704
|
+
}, this.log = Qo(t.loggerName ?? Zo.PCTransport), this.loggerOptions = t, this.config = e, this._pc = this.createPC(), this.offerLock = new Ln();
|
|
13705
13705
|
}
|
|
13706
13706
|
createPC() {
|
|
13707
13707
|
let e = new RTCPeerConnection(this.config);
|
|
@@ -14085,7 +14085,7 @@ var qd = class {
|
|
|
14085
14085
|
}, this.publisher.onOffer = (e, t) => {
|
|
14086
14086
|
var n;
|
|
14087
14087
|
(n = this.onPublisherOffer) == null || n.call(this, e, t);
|
|
14088
|
-
}, this.state = K.NEW, this.connectionLock = new
|
|
14088
|
+
}, this.state = K.NEW, this.connectionLock = new Ln(), this.remoteOfferLock = new Ln();
|
|
14089
14089
|
}
|
|
14090
14090
|
get logContext() {
|
|
14091
14091
|
var e;
|
|
@@ -14325,7 +14325,7 @@ var qd = class {
|
|
|
14325
14325
|
e.updateCachedRegionSettings(this.serverUrl, this.token, t);
|
|
14326
14326
|
}
|
|
14327
14327
|
};
|
|
14328
|
-
Xd.cache = /* @__PURE__ */ new Map(), Xd.settingsTimeouts = /* @__PURE__ */ new Map(), Xd.connectionTrackers = /* @__PURE__ */ new Map(), Xd.fetchLock = new
|
|
14328
|
+
Xd.cache = /* @__PURE__ */ new Map(), Xd.settingsTimeouts = /* @__PURE__ */ new Map(), Xd.connectionTrackers = /* @__PURE__ */ new Map(), Xd.fetchLock = new Ln();
|
|
14329
14329
|
function Zd(e) {
|
|
14330
14330
|
return `${e.protocol.replace("ws", "http")}//${e.host}/settings`;
|
|
14331
14331
|
}
|
|
@@ -14446,7 +14446,7 @@ var lf = 1e3, uf = 1e4, df = class extends W {
|
|
|
14446
14446
|
this.debouncedTrackMuteHandler.cancel("unmute"), yield this.resumeUpstream();
|
|
14447
14447
|
}), this.handleEnded = () => {
|
|
14448
14448
|
this.isInBackground && (this.reacquireTrack = !0), this._mediaStreamTrack.removeEventListener("mute", this.handleTrackMuteEvent), this._mediaStreamTrack.removeEventListener("unmute", this.handleTrackUnmuteEvent), this.emit(V.Ended, this);
|
|
14449
|
-
}, this.reacquireTrack = !1, this.providedByUser = r, this.muteLock = new
|
|
14449
|
+
}, this.reacquireTrack = !1, this.providedByUser = r, this.muteLock = new Ln(), this.pauseUpstreamLock = new Ln(), this.trackChangeLock = new Ln(), this.trackChangeLock.lock().then((t) => N(this, void 0, void 0, function* () {
|
|
14450
14450
|
try {
|
|
14451
14451
|
yield this.setMediaStreamTrack(e, !0);
|
|
14452
14452
|
} finally {
|
|
@@ -15005,7 +15005,7 @@ var Af = 5e3, jf = class extends df {
|
|
|
15005
15005
|
}), this._currentBitrate = e;
|
|
15006
15006
|
}
|
|
15007
15007
|
this.prevStats = t;
|
|
15008
|
-
}), this.senderLock = new
|
|
15008
|
+
}), this.senderLock = new Ln();
|
|
15009
15009
|
}
|
|
15010
15010
|
get isSimulcast() {
|
|
15011
15011
|
return !!(this.sender && this.sender.getParameters().encodings.length > 1);
|
|
@@ -15468,7 +15468,7 @@ var Kf = class extends fs.EventEmitter {
|
|
|
15468
15468
|
}), this.log = Qo(e.loggerName ?? Zo.Engine), this.loggerOptions = {
|
|
15469
15469
|
loggerName: e.loggerName,
|
|
15470
15470
|
loggerContextCb: () => this.logContext
|
|
15471
|
-
}, this.client = new fd(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new
|
|
15471
|
+
}, this.client = new fd(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new Ln(), this.dataProcessLock = new Ln(), this.dcBufferStatus = new Map([
|
|
15472
15472
|
[q.RELIABLE, !0],
|
|
15473
15473
|
[q.LOSSY, !0],
|
|
15474
15474
|
[q.DATA_TRACK_LOSSY, !0]
|
|
@@ -16573,7 +16573,7 @@ var Jf = class {
|
|
|
16573
16573
|
}
|
|
16574
16574
|
});
|
|
16575
16575
|
yield this.engine.sendDataPacket(i, q.RELIABLE);
|
|
16576
|
-
let a = 0, o = new
|
|
16576
|
+
let a = 0, o = new Ln(), s = this.engine, c = this.log;
|
|
16577
16577
|
return new ep(new WritableStream({
|
|
16578
16578
|
write(e) {
|
|
16579
16579
|
return N(this, void 0, void 0, function* () {
|
|
@@ -18849,13 +18849,13 @@ var Em = class extends wm {
|
|
|
18849
18849
|
this.log.debug("waiting for agent", Object.assign(Object.assign({}, this.logContext), U(e)));
|
|
18850
18850
|
let m = setTimeout(() => {
|
|
18851
18851
|
i(/* @__PURE__ */ Error("agent not active within 10 seconds"));
|
|
18852
|
-
}, 1e4),
|
|
18852
|
+
}, 1e4), ee = yield this.waitUntilActiveAgentPresent();
|
|
18853
18853
|
clearTimeout(m), this.log.debug("sending preconnect buffer", Object.assign(Object.assign({}, this.logContext), U(e)));
|
|
18854
|
-
let
|
|
18854
|
+
let te = yield this.streamBytes({
|
|
18855
18855
|
name: "preconnect-buffer",
|
|
18856
18856
|
mimeType: n,
|
|
18857
18857
|
topic: "lk.agent.pre-connect-audio-buffer",
|
|
18858
|
-
destinationIdentities: [
|
|
18858
|
+
destinationIdentities: [ee.identity],
|
|
18859
18859
|
attributes: {
|
|
18860
18860
|
trackId: f.trackSid,
|
|
18861
18861
|
sampleRate: String(o.sampleRate ?? "48000"),
|
|
@@ -18866,7 +18866,7 @@ var Em = class extends wm {
|
|
|
18866
18866
|
for (var u = !0, d = cs(t), p; p = yield d.next(), a = p.done, !a; u = !0) {
|
|
18867
18867
|
l = p.value, u = !1;
|
|
18868
18868
|
let e = l;
|
|
18869
|
-
yield
|
|
18869
|
+
yield te.write(e);
|
|
18870
18870
|
}
|
|
18871
18871
|
} catch (e) {
|
|
18872
18872
|
s = { error: e };
|
|
@@ -18877,7 +18877,7 @@ var Em = class extends wm {
|
|
|
18877
18877
|
if (s) throw s.error;
|
|
18878
18878
|
}
|
|
18879
18879
|
}
|
|
18880
|
-
yield
|
|
18880
|
+
yield te.close(), r();
|
|
18881
18881
|
} catch (e) {
|
|
18882
18882
|
i(e);
|
|
18883
18883
|
}
|
|
@@ -19035,7 +19035,7 @@ var Em = class extends wm {
|
|
|
19035
19035
|
attachedFiles: t?.attachments
|
|
19036
19036
|
}, r = new ra({ value: {
|
|
19037
19037
|
case: "chatMessage",
|
|
19038
|
-
value: new pa(Object.assign(Object.assign({}, n), { timestamp:
|
|
19038
|
+
value: new pa(Object.assign(Object.assign({}, n), { timestamp: D.parse(n.timestamp) }))
|
|
19039
19039
|
} });
|
|
19040
19040
|
return yield this.engine.sendDataPacket(r, q.RELIABLE), this.emit(z.ChatMessage, n), n;
|
|
19041
19041
|
});
|
|
@@ -19048,8 +19048,8 @@ var Em = class extends wm {
|
|
|
19048
19048
|
}), r = new ra({ value: {
|
|
19049
19049
|
case: "chatMessage",
|
|
19050
19050
|
value: new pa(Object.assign(Object.assign({}, n), {
|
|
19051
|
-
timestamp:
|
|
19052
|
-
editTimestamp:
|
|
19051
|
+
timestamp: D.parse(n.timestamp),
|
|
19052
|
+
editTimestamp: D.parse(n.editTimestamp)
|
|
19053
19053
|
}))
|
|
19054
19054
|
} });
|
|
19055
19055
|
return yield this.engine.sendDataPacket(r, q.RELIABLE), this.emit(z.ChatMessage, n), n;
|
|
@@ -19816,7 +19816,7 @@ var jm = 4 * 1e3, Mm = class e extends fs.EventEmitter {
|
|
|
19816
19816
|
}).on("packetAvailable", (e) => {
|
|
19817
19817
|
let { bytes: t } = e;
|
|
19818
19818
|
this.engine.sendLossyBytes(t, q.DATA_TRACK_LOSSY, "wait");
|
|
19819
|
-
}), this.disconnectLock = new
|
|
19819
|
+
}), this.disconnectLock = new Ln(), this.localParticipant = new Em("", "", this.engine, this.options, this.rpcHandlers, this.outgoingDataStreamManager, this.outgoingDataTrackManager), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.incomingDataTrackManager.updateE2eeManager(this.e2eeManager ?? null), this.outgoingDataTrackManager.updateE2eeManager(this.e2eeManager ?? null), this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", ou(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", ou(this.options.audioCaptureDefaults.deviceId)), this.options.audioOutput?.deviceId && this.switchActiveDevice("audiooutput", ou(this.options.audioOutput.deviceId)).catch((e) => this.log.warn(`Could not set audio output: ${e.message}`, this.logContext)), Bl()) {
|
|
19820
19820
|
let t = new AbortController();
|
|
19821
19821
|
(i = (r = navigator.mediaDevices)?.addEventListener) == null || i.call(r, "devicechange", this.handleDeviceChange, { signal: t.signal }), e.cleanupRegistry && e.cleanupRegistry.register(this, () => {
|
|
19822
19822
|
t.abort();
|
|
@@ -20372,7 +20372,7 @@ var jm = 4 * 1e3, Mm = class e extends fs.EventEmitter {
|
|
|
20372
20372
|
name: "simulated-room",
|
|
20373
20373
|
emptyTimeout: 0,
|
|
20374
20374
|
maxParticipants: 0,
|
|
20375
|
-
creationTime:
|
|
20375
|
+
creationTime: D.parse((/* @__PURE__ */ new Date()).getTime()),
|
|
20376
20376
|
metadata: "",
|
|
20377
20377
|
numParticipants: 1,
|
|
20378
20378
|
numPublishers: 1,
|
|
@@ -20417,7 +20417,7 @@ var jm = 4 * 1e3, Mm = class e extends fs.EventEmitter {
|
|
|
20417
20417
|
identity: `simulated-${e}`,
|
|
20418
20418
|
state: Ji.ACTIVE,
|
|
20419
20419
|
tracks: [],
|
|
20420
|
-
joinedAt:
|
|
20420
|
+
joinedAt: D.parse(Date.now())
|
|
20421
20421
|
}), r = this.getOrCreateParticipant(t.identity, t);
|
|
20422
20422
|
if (n.video) {
|
|
20423
20423
|
let i = tu(160 * (n.aspectRatios[e % n.aspectRatios.length] ?? 1), 160, !1, !0), a = new Qi({
|
|
@@ -21676,7 +21676,7 @@ var hh = class extends Bm {
|
|
|
21676
21676
|
//#endregion
|
|
21677
21677
|
//#region src/utils/voiceClientTools.js
|
|
21678
21678
|
function $(...e) {
|
|
21679
|
-
|
|
21679
|
+
Yt() && console.log("[FlowEngage:voice-tools]", ...e);
|
|
21680
21680
|
}
|
|
21681
21681
|
function gh(e) {
|
|
21682
21682
|
if (e.labels && e.labels.length) return e.labels[0].textContent?.trim() || null;
|
|
@@ -21856,9 +21856,9 @@ function Oh(e) {
|
|
|
21856
21856
|
return $("navigate_to_page ✖", e), e;
|
|
21857
21857
|
}
|
|
21858
21858
|
try {
|
|
21859
|
-
if ($("navigate_to_page → shadowNavigate", n), await
|
|
21860
|
-
let e =
|
|
21861
|
-
e &&
|
|
21859
|
+
if ($("navigate_to_page → shadowNavigate", n), await nn(n), await new Promise((e) => setTimeout(e, 400)), r && typeof r == "string") {
|
|
21860
|
+
let e = Qt(null, r);
|
|
21861
|
+
e && $t(e), $("navigate_to_page · highlight", {
|
|
21862
21862
|
sectionText: r,
|
|
21863
21863
|
found: !!e
|
|
21864
21864
|
});
|
|
@@ -21872,8 +21872,8 @@ function Oh(e) {
|
|
|
21872
21872
|
},
|
|
21873
21873
|
highlight_on_page: async (e) => {
|
|
21874
21874
|
$("highlight_on_page ▶", e);
|
|
21875
|
-
let t = wh(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i =
|
|
21876
|
-
return i ? (
|
|
21875
|
+
let t = wh(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText, i = Qt(n || null, r || null);
|
|
21876
|
+
return i ? ($t(i), $("highlight_on_page ✓"), "Highlighted the section.") : ($("highlight_on_page ✖ no element"), "Could not find that section on the page.");
|
|
21877
21877
|
},
|
|
21878
21878
|
search_site_content: async (e) => {
|
|
21879
21879
|
$("search_site_content ▶", e);
|
|
@@ -21956,12 +21956,13 @@ var kh = {
|
|
|
21956
21956
|
error: "#ef4444"
|
|
21957
21957
|
};
|
|
21958
21958
|
function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, historyRef: d, hasSyncedRef: f, onMessageSync: p, onStartSync: m }) {
|
|
21959
|
-
let [
|
|
21959
|
+
let [ee, te] = s("idle"), [h, ne] = s(null), [re, ie] = s(!1), [ae, oe] = s([]), se = o(null), g = o(null);
|
|
21960
21960
|
i(() => {
|
|
21961
21961
|
let t = !1, n = null;
|
|
21962
21962
|
return (async () => {
|
|
21963
21963
|
try {
|
|
21964
21964
|
if (await navigator.mediaDevices.getUserMedia({ audio: !0 }), t) return;
|
|
21965
|
+
oe([]);
|
|
21965
21966
|
let i = Oh({
|
|
21966
21967
|
siteId: r || null,
|
|
21967
21968
|
apiBaseUrl: a || null
|
|
@@ -21969,7 +21970,7 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
21969
21970
|
agentId: e,
|
|
21970
21971
|
clientTools: i,
|
|
21971
21972
|
onModeChange: ({ mode: e }) => {
|
|
21972
|
-
t ||
|
|
21973
|
+
t || te(e === "speaking" ? "speaking" : "listening");
|
|
21973
21974
|
},
|
|
21974
21975
|
onMessage: (e) => {
|
|
21975
21976
|
if (t) return;
|
|
@@ -21980,20 +21981,20 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
21980
21981
|
message: r,
|
|
21981
21982
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
21982
21983
|
};
|
|
21983
|
-
d.current = [...d.current, i];
|
|
21984
|
+
d.current = [...d.current, i], oe((e) => [...e, i]);
|
|
21984
21985
|
},
|
|
21985
21986
|
onError: (e) => {
|
|
21986
|
-
t || (console.error("[VoiceInterface] ElevenLabs error", e),
|
|
21987
|
+
t || (console.error("[VoiceInterface] ElevenLabs error", e), te("error"), ne("Voice session encountered an error."));
|
|
21987
21988
|
},
|
|
21988
21989
|
onDisconnect: () => {
|
|
21989
|
-
t || (console.log("[VoiceInterface] session disconnected"),
|
|
21990
|
+
t || (console.log("[VoiceInterface] session disconnected"), ie(!1), te("idle"));
|
|
21990
21991
|
}
|
|
21991
21992
|
});
|
|
21992
21993
|
if (t) {
|
|
21993
21994
|
o.endSession().catch(() => {});
|
|
21994
21995
|
return;
|
|
21995
21996
|
}
|
|
21996
|
-
n = o,
|
|
21997
|
+
n = o, se.current = o, ie(!0), te("listening");
|
|
21997
21998
|
try {
|
|
21998
21999
|
let e = typeof window < "u" ? window.location.href : "", t = "";
|
|
21999
22000
|
try {
|
|
@@ -22005,10 +22006,10 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22005
22006
|
} catch {}
|
|
22006
22007
|
typeof m == "function" && m();
|
|
22007
22008
|
} catch (e) {
|
|
22008
|
-
t || (console.error("[VoiceInterface] startSession failed", e),
|
|
22009
|
+
t || (console.error("[VoiceInterface] startSession failed", e), te("error"), ne("Could not start voice session. Please try again."));
|
|
22009
22010
|
}
|
|
22010
22011
|
})(), () => {
|
|
22011
|
-
t = !0, n ? n.endSession().catch(() => {}) :
|
|
22012
|
+
t = !0, n ? n.endSession().catch(() => {}) : se.current && se.current.endSession().catch(() => {});
|
|
22012
22013
|
};
|
|
22013
22014
|
}, [
|
|
22014
22015
|
e,
|
|
@@ -22017,18 +22018,18 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22017
22018
|
d,
|
|
22018
22019
|
m
|
|
22019
22020
|
]);
|
|
22020
|
-
let
|
|
22021
|
+
let ce = n(async () => {
|
|
22021
22022
|
try {
|
|
22022
|
-
await
|
|
22023
|
+
await se.current?.endSession?.();
|
|
22023
22024
|
} catch {}
|
|
22024
|
-
|
|
22025
|
+
se.current = null, ie(!1), te("idle"), typeof p == "function" && await p(d.current), typeof c == "function" && c();
|
|
22025
22026
|
}, [
|
|
22026
22027
|
d,
|
|
22027
22028
|
p,
|
|
22028
22029
|
c
|
|
22029
|
-
]),
|
|
22030
|
+
]), le = ee === "listening" || ee === "speaking", _ = Ah[ee] || Ah.idle, ue = kh[ee] || kh.idle;
|
|
22030
22031
|
return /* @__PURE__ */ u("div", {
|
|
22031
|
-
ref:
|
|
22032
|
+
ref: g,
|
|
22032
22033
|
style: {
|
|
22033
22034
|
display: "flex",
|
|
22034
22035
|
flexDirection: "column",
|
|
@@ -22050,19 +22051,19 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22050
22051
|
justifyContent: "center"
|
|
22051
22052
|
},
|
|
22052
22053
|
children: [
|
|
22053
|
-
|
|
22054
|
+
le && /* @__PURE__ */ l("div", { style: {
|
|
22054
22055
|
position: "absolute",
|
|
22055
22056
|
inset: "-16px",
|
|
22056
22057
|
borderRadius: "50%",
|
|
22057
|
-
border: `2px solid ${
|
|
22058
|
+
border: `2px solid ${_}`,
|
|
22058
22059
|
animation: "fe-orb-pulse 1.4s ease-in-out infinite",
|
|
22059
22060
|
opacity: .6
|
|
22060
22061
|
} }),
|
|
22061
|
-
|
|
22062
|
+
le && /* @__PURE__ */ l("div", { style: {
|
|
22062
22063
|
position: "absolute",
|
|
22063
22064
|
inset: "-8px",
|
|
22064
22065
|
borderRadius: "50%",
|
|
22065
|
-
border: `2px solid ${
|
|
22066
|
+
border: `2px solid ${_}`,
|
|
22066
22067
|
animation: "fe-orb-pulse 1.4s ease-in-out 0.35s infinite",
|
|
22067
22068
|
opacity: .4
|
|
22068
22069
|
} }),
|
|
@@ -22071,18 +22072,18 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22071
22072
|
width: "140px",
|
|
22072
22073
|
height: "140px",
|
|
22073
22074
|
borderRadius: "50%",
|
|
22074
|
-
background:
|
|
22075
|
-
border: `3px solid ${
|
|
22075
|
+
background: ue,
|
|
22076
|
+
border: `3px solid ${_}`,
|
|
22076
22077
|
display: "flex",
|
|
22077
22078
|
alignItems: "center",
|
|
22078
22079
|
justifyContent: "center",
|
|
22079
22080
|
transition: "all 0.35s ease",
|
|
22080
|
-
transform:
|
|
22081
|
-
boxShadow: `0 0 40px ${
|
|
22081
|
+
transform: ee === "speaking" ? "scale(1.08)" : "scale(1)",
|
|
22082
|
+
boxShadow: `0 0 40px ${ue}, 0 8px 32px rgba(0,0,0,0.08)`
|
|
22082
22083
|
},
|
|
22083
|
-
children: /* @__PURE__ */ l(
|
|
22084
|
+
children: /* @__PURE__ */ l(fn, {
|
|
22084
22085
|
size: 44,
|
|
22085
|
-
color:
|
|
22086
|
+
color: _
|
|
22086
22087
|
})
|
|
22087
22088
|
})
|
|
22088
22089
|
]
|
|
@@ -22091,18 +22092,18 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22091
22092
|
style: {
|
|
22092
22093
|
fontSize: "15px",
|
|
22093
22094
|
fontWeight: 600,
|
|
22094
|
-
color:
|
|
22095
|
+
color: ee === "error" ? "#ef4444" : "#374151",
|
|
22095
22096
|
letterSpacing: "0.01em",
|
|
22096
22097
|
textAlign: "center"
|
|
22097
22098
|
},
|
|
22098
22099
|
children: [
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22100
|
+
ee === "idle" && "Starting voice session…",
|
|
22101
|
+
ee === "listening" && "Listening…",
|
|
22102
|
+
ee === "speaking" && "AI is speaking…",
|
|
22103
|
+
ee === "error" && (h || "Error")
|
|
22103
22104
|
]
|
|
22104
22105
|
}),
|
|
22105
|
-
|
|
22106
|
+
ae.length > 0 && /* @__PURE__ */ l("div", {
|
|
22106
22107
|
style: {
|
|
22107
22108
|
width: "100%",
|
|
22108
22109
|
maxHeight: "160px",
|
|
@@ -22112,7 +22113,7 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22112
22113
|
gap: "8px",
|
|
22113
22114
|
padding: "0 4px"
|
|
22114
22115
|
},
|
|
22115
|
-
children:
|
|
22116
|
+
children: ae.map((e, t) => /* @__PURE__ */ l("div", {
|
|
22116
22117
|
style: {
|
|
22117
22118
|
display: "flex",
|
|
22118
22119
|
justifyContent: e.sender === "user" ? "flex-end" : "flex-start"
|
|
@@ -22132,7 +22133,7 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22132
22133
|
}, t))
|
|
22133
22134
|
}),
|
|
22134
22135
|
/* @__PURE__ */ u("button", {
|
|
22135
|
-
onClick:
|
|
22136
|
+
onClick: ce,
|
|
22136
22137
|
style: {
|
|
22137
22138
|
display: "flex",
|
|
22138
22139
|
alignItems: "center",
|
|
@@ -22153,7 +22154,7 @@ function jh({ agentId: e, chatId: t, siteId: r, apiBaseUrl: a, onEnd: c, history
|
|
|
22153
22154
|
onMouseLeave: (e) => {
|
|
22154
22155
|
e.currentTarget.style.background = "#fee2e2";
|
|
22155
22156
|
},
|
|
22156
|
-
children: [/* @__PURE__ */ l(
|
|
22157
|
+
children: [/* @__PURE__ */ l(pn, { size: 18 }), "End Voice Session"]
|
|
22157
22158
|
}),
|
|
22158
22159
|
/* @__PURE__ */ l("style", { children: "\n @keyframes fe-orb-pulse {\n 0% { transform: scale(1); opacity: 0.6; }\n 50% { transform: scale(1.18); opacity: 0.15; }\n 100% { transform: scale(1); opacity: 0.6; }\n }\n " })
|
|
22159
22160
|
]
|
|
@@ -22214,134 +22215,134 @@ var Mh = [
|
|
|
22214
22215
|
})
|
|
22215
22216
|
});
|
|
22216
22217
|
function Ph() {
|
|
22217
|
-
let { status: e, runtimeConfig: t, resolvedConfig: n, chatId: r, chatHistory: a, isOpen: o, activeScreen: c, isHumanHandled: d, agentName: f, visitorEmail: p, isAgentTyping: m, isAiTyping:
|
|
22218
|
-
...
|
|
22219
|
-
...
|
|
22220
|
-
},
|
|
22221
|
-
...
|
|
22222
|
-
...
|
|
22223
|
-
},
|
|
22218
|
+
let { status: e, runtimeConfig: t, resolvedConfig: n, chatId: r, chatHistory: a, isOpen: o, activeScreen: c, isHumanHandled: d, agentName: f, visitorEmail: p, isAgentTyping: m, isAiTyping: ee, isLoading: te, isVoiceMode: h, isRateLimited: ne, rateLimitMessage: re, isConversationEnded: ie, incomingCall: ae, activeCallId: oe, callConnectionState: se, callConnectedAt: g, isCallMuted: ce, webRTCError: le, language: _, historyRef: ue, onMessageSync: v, endConversation: y, acceptCall: de, rejectCall: fe, endWebRTCCall: pe, toggleCallMute: me, dismissCallError: he, captureVisitorEmail: ge, openWidget: _e, closeWidget: ve, sendMessage: ye, setVoiceMode: be, startTyping: xe, stopTyping: Se, updateTypingDraft: Ce } = Jt(), [we, Te] = s(""), [Ee, De] = s(null), [Oe, ke] = s(null), [Ae, je] = s(null), [Me, b] = s(0), [Ne, Pe] = s(p || ""), [Fe, Ie] = s(""), x = t?.widgetSettings || {}, Le = n?.widgetSettings || {}, Re = {
|
|
22219
|
+
...x.branding || {},
|
|
22220
|
+
...Le.branding || {}
|
|
22221
|
+
}, ze = {
|
|
22222
|
+
...x.theme || {},
|
|
22223
|
+
...Le.theme || {}
|
|
22224
|
+
}, Be = ze.primaryColor || "#3B82F6", Ve = ze.accentColor || "#1D4ED8", He = (ze.position || "bottom-right") === "bottom-left" ? {
|
|
22224
22225
|
left: "1.5rem",
|
|
22225
22226
|
bottom: "1.5rem"
|
|
22226
22227
|
} : {
|
|
22227
22228
|
right: "1.5rem",
|
|
22228
22229
|
bottom: "1.5rem"
|
|
22229
|
-
},
|
|
22230
|
-
"--flowengage-primary":
|
|
22231
|
-
"--flowengage-accent":
|
|
22230
|
+
}, Ue = {
|
|
22231
|
+
"--flowengage-primary": Be,
|
|
22232
|
+
"--flowengage-accent": Ve,
|
|
22232
22233
|
position: "fixed",
|
|
22233
22234
|
zIndex: 999999,
|
|
22234
22235
|
border: "none",
|
|
22235
22236
|
outline: "none",
|
|
22236
22237
|
fontFamily: "ui-sans-serif, system-ui, sans-serif",
|
|
22237
|
-
...o ? {} :
|
|
22238
|
-
},
|
|
22238
|
+
...o ? {} : He
|
|
22239
|
+
}, We = Le.recommendations?.[_] || x.recommendations?.[_] || Mh, Ge = Le.greetings?.[_] || x.greetings?.[_], Ke = Re.chatButtonText || "Chat with us", qe = Re.headerName || t?.websiteName || "OpenSense Labs", S = Re.logoUrl || null, C = Re.hideWatermark || !1, w = Le.elevenLabsAgentId || t?.elevenLabsAgentId || null, Je = t?.siteId || n?.siteId || null, Ye = t?.apiBaseUrl || "", Xe = Re.fallbackAgentName || "Agent", Ze = Re.botLabel || "AI", Qe = ae?.agentName || f || Xe, $e = !p && a.length === 0;
|
|
22239
22240
|
i(() => {
|
|
22240
|
-
|
|
22241
|
+
Pe(p || ""), p && Ie("");
|
|
22241
22242
|
}, [p]), i(() => {
|
|
22242
|
-
if (!
|
|
22243
|
-
|
|
22243
|
+
if (!g || se !== "connected") {
|
|
22244
|
+
b(0);
|
|
22244
22245
|
return;
|
|
22245
22246
|
}
|
|
22246
22247
|
let e = () => {
|
|
22247
|
-
let e = new Date(
|
|
22248
|
-
isNaN(e) ||
|
|
22248
|
+
let e = new Date(g).getTime();
|
|
22249
|
+
isNaN(e) || b(Math.max(0, Math.floor((Date.now() - e) / 1e3)));
|
|
22249
22250
|
};
|
|
22250
22251
|
e();
|
|
22251
22252
|
let t = window.setInterval(e, 1e3);
|
|
22252
22253
|
return () => window.clearInterval(t);
|
|
22253
|
-
}, [
|
|
22254
|
-
if (!d ||
|
|
22255
|
-
|
|
22254
|
+
}, [g, se]), i(() => {
|
|
22255
|
+
if (!d || h || ie) {
|
|
22256
|
+
Ce(""), Se();
|
|
22256
22257
|
return;
|
|
22257
22258
|
}
|
|
22258
|
-
if (!
|
|
22259
|
-
|
|
22259
|
+
if (!we.trim()) {
|
|
22260
|
+
Ce(""), Se();
|
|
22260
22261
|
return;
|
|
22261
22262
|
}
|
|
22262
|
-
|
|
22263
|
+
xe();
|
|
22263
22264
|
let e = window.setTimeout(() => {
|
|
22264
|
-
we
|
|
22265
|
+
Ce(we);
|
|
22265
22266
|
}, 120), t = window.setTimeout(() => {
|
|
22266
|
-
|
|
22267
|
+
Se();
|
|
22267
22268
|
}, 1200);
|
|
22268
22269
|
return () => {
|
|
22269
22270
|
window.clearTimeout(e), window.clearTimeout(t);
|
|
22270
22271
|
};
|
|
22271
22272
|
}, [
|
|
22272
|
-
|
|
22273
|
+
we,
|
|
22273
22274
|
d,
|
|
22274
|
-
|
|
22275
|
-
|
|
22275
|
+
h,
|
|
22276
|
+
ie,
|
|
22277
|
+
xe,
|
|
22276
22278
|
Se,
|
|
22277
|
-
Ce
|
|
22278
|
-
we
|
|
22279
|
+
Ce
|
|
22279
22280
|
]);
|
|
22280
|
-
let
|
|
22281
|
+
let et = (e) => e ? {
|
|
22281
22282
|
replyTo: e.messageId || e.id || null,
|
|
22282
22283
|
replyToContent: (e.replyToContent || e.message || "").replace(/<[^>]+>/g, "").trim().slice(0, 200),
|
|
22283
22284
|
replyToSender: e.sender || null
|
|
22284
|
-
} : null,
|
|
22285
|
-
if (e.preventDefault(),
|
|
22286
|
-
if (
|
|
22287
|
-
let e =
|
|
22285
|
+
} : null, tt = async (e) => {
|
|
22286
|
+
if (e.preventDefault(), ie) return;
|
|
22287
|
+
if ($e) {
|
|
22288
|
+
let e = Ne.trim().toLowerCase();
|
|
22288
22289
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) {
|
|
22289
|
-
|
|
22290
|
+
Ie("Please enter a valid email to start the chat.");
|
|
22290
22291
|
return;
|
|
22291
22292
|
}
|
|
22292
|
-
await
|
|
22293
|
+
await ge(e), Ie("");
|
|
22293
22294
|
return;
|
|
22294
22295
|
}
|
|
22295
|
-
if (!
|
|
22296
|
-
let t =
|
|
22297
|
-
|
|
22298
|
-
},
|
|
22299
|
-
if (
|
|
22300
|
-
|
|
22296
|
+
if (!we.trim()) return;
|
|
22297
|
+
let t = we.trim(), n = et(Ae);
|
|
22298
|
+
Te(""), je(null), await ye(t, "", n);
|
|
22299
|
+
}, nt = async () => {
|
|
22300
|
+
if ($e) {
|
|
22301
|
+
Ie("Please share your email before starting a call.");
|
|
22301
22302
|
return;
|
|
22302
22303
|
}
|
|
22303
|
-
if (
|
|
22304
|
-
|
|
22304
|
+
if (h) {
|
|
22305
|
+
be(!1);
|
|
22305
22306
|
return;
|
|
22306
22307
|
}
|
|
22307
|
-
|
|
22308
|
+
ke(null);
|
|
22308
22309
|
try {
|
|
22309
|
-
|
|
22310
|
+
De(await navigator.mediaDevices.getUserMedia({ audio: !0 })), be(!0);
|
|
22310
22311
|
} catch (e) {
|
|
22311
|
-
|
|
22312
|
+
ke(e.message || "Could not access microphone.");
|
|
22312
22313
|
}
|
|
22313
|
-
},
|
|
22314
|
-
|
|
22315
|
-
},
|
|
22314
|
+
}, rt = () => {
|
|
22315
|
+
Ee && (Ee.getTracks().forEach((e) => e.stop()), De(null)), be(!1);
|
|
22316
|
+
}, it = (e) => {
|
|
22316
22317
|
let t = Math.floor(e / 60), n = e % 60;
|
|
22317
22318
|
return `${t.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
|
|
22318
22319
|
};
|
|
22319
22320
|
return e === "ready" ? /* @__PURE__ */ u("div", {
|
|
22320
22321
|
className: "flowengage-shell",
|
|
22321
22322
|
"data-open": o ? "true" : "false",
|
|
22322
|
-
style:
|
|
22323
|
-
children: [/* @__PURE__ */ l(
|
|
22323
|
+
style: Ue,
|
|
22324
|
+
children: [/* @__PURE__ */ l(bn, {
|
|
22324
22325
|
isOpen: o,
|
|
22325
|
-
openWidget:
|
|
22326
|
-
launcherText:
|
|
22327
|
-
primaryColor:
|
|
22328
|
-
posInline:
|
|
22326
|
+
openWidget: _e,
|
|
22327
|
+
launcherText: Ke,
|
|
22328
|
+
primaryColor: Be,
|
|
22329
|
+
posInline: He
|
|
22329
22330
|
}), o && /* @__PURE__ */ u("div", {
|
|
22330
22331
|
className: "flowengage-chat-panel",
|
|
22331
|
-
style: { background: a.length === 0 && !
|
|
22332
|
+
style: { background: a.length === 0 && !h ? `linear-gradient(to bottom, ${Be} 0%, ${Be} 70%, white 85%)` : "white" },
|
|
22332
22333
|
children: [
|
|
22333
|
-
/* @__PURE__ */ l(
|
|
22334
|
-
logoUrl:
|
|
22335
|
-
brandName:
|
|
22334
|
+
/* @__PURE__ */ l(Cn, {
|
|
22335
|
+
logoUrl: S,
|
|
22336
|
+
brandName: qe,
|
|
22336
22337
|
agentName: f,
|
|
22337
|
-
fallbackAgentName:
|
|
22338
|
+
fallbackAgentName: Xe,
|
|
22338
22339
|
activeScreen: c,
|
|
22339
|
-
branding:
|
|
22340
|
-
isConversationEnded:
|
|
22341
|
-
endConversation:
|
|
22342
|
-
closeWidget:
|
|
22343
|
-
isInitial: a.length === 0 && !
|
|
22344
|
-
botLabel:
|
|
22340
|
+
branding: Re,
|
|
22341
|
+
isConversationEnded: ie,
|
|
22342
|
+
endConversation: y,
|
|
22343
|
+
closeWidget: ve,
|
|
22344
|
+
isInitial: a.length === 0 && !h,
|
|
22345
|
+
botLabel: Ze
|
|
22345
22346
|
}),
|
|
22346
22347
|
/* @__PURE__ */ l("div", {
|
|
22347
22348
|
style: {
|
|
@@ -22351,7 +22352,7 @@ function Ph() {
|
|
|
22351
22352
|
flexDirection: "column"
|
|
22352
22353
|
},
|
|
22353
22354
|
className: "flowengage-content-wrapper",
|
|
22354
|
-
children:
|
|
22355
|
+
children: h ? /* @__PURE__ */ l("div", {
|
|
22355
22356
|
style: {
|
|
22356
22357
|
flex: 1,
|
|
22357
22358
|
display: "flex",
|
|
@@ -22359,13 +22360,13 @@ function Ph() {
|
|
|
22359
22360
|
},
|
|
22360
22361
|
className: "fe-screen-fade-in",
|
|
22361
22362
|
children: /* @__PURE__ */ l(jh, {
|
|
22362
|
-
agentId:
|
|
22363
|
+
agentId: w,
|
|
22363
22364
|
chatId: r,
|
|
22364
|
-
siteId:
|
|
22365
|
-
apiBaseUrl:
|
|
22365
|
+
siteId: Je,
|
|
22366
|
+
apiBaseUrl: Ye,
|
|
22366
22367
|
historyRef: ue,
|
|
22367
|
-
onMessageSync:
|
|
22368
|
-
onEnd:
|
|
22368
|
+
onMessageSync: v,
|
|
22369
|
+
onEnd: rt
|
|
22369
22370
|
})
|
|
22370
22371
|
}, "voice") : a.length === 0 ? /* @__PURE__ */ l("div", {
|
|
22371
22372
|
style: {
|
|
@@ -22374,17 +22375,17 @@ function Ph() {
|
|
|
22374
22375
|
flexDirection: "column"
|
|
22375
22376
|
},
|
|
22376
22377
|
className: "fe-screen-fade-in",
|
|
22377
|
-
children: /* @__PURE__ */ l(
|
|
22378
|
-
greetings:
|
|
22379
|
-
recommendations:
|
|
22380
|
-
onSendMessage:
|
|
22378
|
+
children: /* @__PURE__ */ l(On, {
|
|
22379
|
+
greetings: Ge,
|
|
22380
|
+
recommendations: We,
|
|
22381
|
+
onSendMessage: ye,
|
|
22381
22382
|
visitorEmail: p,
|
|
22382
|
-
emailInput:
|
|
22383
|
-
setEmailInput:
|
|
22384
|
-
emailError:
|
|
22385
|
-
setEmailError:
|
|
22386
|
-
onCaptureEmail:
|
|
22387
|
-
botLabel:
|
|
22383
|
+
emailInput: Ne,
|
|
22384
|
+
setEmailInput: Pe,
|
|
22385
|
+
emailError: Fe,
|
|
22386
|
+
setEmailError: Ie,
|
|
22387
|
+
onCaptureEmail: ge,
|
|
22388
|
+
botLabel: Ze
|
|
22388
22389
|
})
|
|
22389
22390
|
}, "welcome") : /* @__PURE__ */ l("div", {
|
|
22390
22391
|
style: {
|
|
@@ -22393,58 +22394,58 @@ function Ph() {
|
|
|
22393
22394
|
flexDirection: "column"
|
|
22394
22395
|
},
|
|
22395
22396
|
className: "fe-screen-fade-in",
|
|
22396
|
-
children: /* @__PURE__ */ l(
|
|
22397
|
+
children: /* @__PURE__ */ l(Dn, {
|
|
22397
22398
|
chatHistory: a,
|
|
22398
|
-
isAiTyping:
|
|
22399
|
+
isAiTyping: ee,
|
|
22399
22400
|
isAgentTyping: m,
|
|
22400
|
-
setReplyContext:
|
|
22401
|
+
setReplyContext: je,
|
|
22401
22402
|
TypingDots: Nh
|
|
22402
22403
|
})
|
|
22403
22404
|
}, "history")
|
|
22404
22405
|
}),
|
|
22405
|
-
/* @__PURE__ */ l(
|
|
22406
|
-
webRTCError:
|
|
22407
|
-
micError:
|
|
22408
|
-
setMicError:
|
|
22409
|
-
dismissCallError:
|
|
22410
|
-
incomingCall:
|
|
22411
|
-
rejectCall:
|
|
22412
|
-
acceptCall:
|
|
22413
|
-
activeCallId:
|
|
22414
|
-
callConnectionState:
|
|
22415
|
-
formatCallDuration:
|
|
22416
|
-
callDurationSeconds:
|
|
22417
|
-
endWebRTCCall:
|
|
22418
|
-
isCallMuted:
|
|
22419
|
-
toggleCallMute:
|
|
22420
|
-
isAIVoiceActive:
|
|
22421
|
-
currentCallAgentName:
|
|
22422
|
-
isRateLimited:
|
|
22423
|
-
rateLimitMessage:
|
|
22406
|
+
/* @__PURE__ */ l(Mn, {
|
|
22407
|
+
webRTCError: le,
|
|
22408
|
+
micError: Oe,
|
|
22409
|
+
setMicError: ke,
|
|
22410
|
+
dismissCallError: he,
|
|
22411
|
+
incomingCall: ae,
|
|
22412
|
+
rejectCall: fe,
|
|
22413
|
+
acceptCall: de,
|
|
22414
|
+
activeCallId: oe,
|
|
22415
|
+
callConnectionState: se,
|
|
22416
|
+
formatCallDuration: it,
|
|
22417
|
+
callDurationSeconds: Me,
|
|
22418
|
+
endWebRTCCall: pe,
|
|
22419
|
+
isCallMuted: ce,
|
|
22420
|
+
toggleCallMute: me,
|
|
22421
|
+
isAIVoiceActive: h,
|
|
22422
|
+
currentCallAgentName: Qe,
|
|
22423
|
+
isRateLimited: ne,
|
|
22424
|
+
rateLimitMessage: re
|
|
22424
22425
|
}),
|
|
22425
|
-
!
|
|
22426
|
+
!h && /* @__PURE__ */ l("div", {
|
|
22426
22427
|
style: {
|
|
22427
22428
|
position: "relative",
|
|
22428
22429
|
zIndex: 1
|
|
22429
22430
|
},
|
|
22430
|
-
children: /* @__PURE__ */ l(
|
|
22431
|
-
input:
|
|
22432
|
-
setInput:
|
|
22433
|
-
onSubmit:
|
|
22434
|
-
isConversationEnded:
|
|
22435
|
-
callUiActive: !!(
|
|
22436
|
-
handleToggleVoice:
|
|
22431
|
+
children: /* @__PURE__ */ l(kn, {
|
|
22432
|
+
input: we,
|
|
22433
|
+
setInput: Te,
|
|
22434
|
+
onSubmit: tt,
|
|
22435
|
+
isConversationEnded: ie,
|
|
22436
|
+
callUiActive: !!(ae || oe),
|
|
22437
|
+
handleToggleVoice: nt,
|
|
22437
22438
|
activeScreen: c,
|
|
22438
|
-
inputDisabled:
|
|
22439
|
-
replyContext:
|
|
22440
|
-
clearReplyContext: () =>
|
|
22441
|
-
requiresEmail:
|
|
22442
|
-
emailInput:
|
|
22443
|
-
setEmailInput:
|
|
22444
|
-
emailError:
|
|
22439
|
+
inputDisabled: te || ne || ie,
|
|
22440
|
+
replyContext: Ae,
|
|
22441
|
+
clearReplyContext: () => je(null),
|
|
22442
|
+
requiresEmail: $e,
|
|
22443
|
+
emailInput: Ne,
|
|
22444
|
+
setEmailInput: Pe,
|
|
22445
|
+
emailError: Fe
|
|
22445
22446
|
})
|
|
22446
22447
|
}),
|
|
22447
|
-
!
|
|
22448
|
+
!C && /* @__PURE__ */ l("div", {
|
|
22448
22449
|
style: {
|
|
22449
22450
|
position: "relative",
|
|
22450
22451
|
zIndex: 1,
|
|
@@ -22474,4 +22475,4 @@ function Ph() {
|
|
|
22474
22475
|
}) : null;
|
|
22475
22476
|
}
|
|
22476
22477
|
//#endregion
|
|
22477
|
-
export {
|
|
22478
|
+
export { un as FlowEngageProvider, Ph as FlowEngageWidget, Jt as useFlowEngage };
|