@streamoji/avatar-widget 0.3.6 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avatar-widget.cjs +7 -5
- package/dist/avatar-widget.js +908 -703
- package/dist/avatar-widget.umd.js +57 -55
- package/dist/avatar-widget.umd.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/package.json +1 -1
package/dist/avatar-widget.js
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useGLTF as
|
|
3
|
-
import { useFrame as
|
|
4
|
-
import { memo as
|
|
5
|
-
import * as
|
|
6
|
-
import { GLTFLoader as
|
|
7
|
-
const
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
(!
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
for (let
|
|
1
|
+
import { jsx as d, jsxs as le } from "react/jsx-runtime";
|
|
2
|
+
import { useGLTF as mt, Environment as on } from "@react-three/drei";
|
|
3
|
+
import { useFrame as an, Canvas as cn, useThree as un } from "@react-three/fiber";
|
|
4
|
+
import { memo as ln, useMemo as bt, useRef as a, useState as y, useEffect as W, useCallback as $e, useLayoutEffect as dn, Suspense as hn } from "react";
|
|
5
|
+
import * as ze from "three";
|
|
6
|
+
import { GLTFLoader as fn } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
7
|
+
const Ye = "https://ai.streamoji.com", B = (...f) => {
|
|
8
|
+
}, mn = (...f) => {
|
|
9
|
+
}, Nt = ({ analyser: f }) => {
|
|
10
|
+
const T = a(null), x = a(null);
|
|
11
|
+
return W(() => {
|
|
12
|
+
const b = T.current;
|
|
13
|
+
if (!b) return;
|
|
14
|
+
const S = b.getContext("2d", { alpha: !0 });
|
|
15
|
+
if (!S) return;
|
|
16
|
+
let H, I = null;
|
|
17
|
+
f && (f.fftSize = 128, I = new Uint8Array(f.frequencyBinCount));
|
|
18
|
+
const Ue = () => {
|
|
19
|
+
H = requestAnimationFrame(Ue), (b.width !== b.offsetWidth || b.height !== b.offsetHeight) && (b.width = b.offsetWidth, b.height = b.offsetHeight);
|
|
20
|
+
const se = b.width, R = b.height;
|
|
21
|
+
if (se === 0 || R === 0) return;
|
|
22
|
+
const we = R / 2;
|
|
23
|
+
S.clearRect(0, 0, se, R), S.fillStyle = "#1e293b";
|
|
24
|
+
const K = 2, l = K + 2, Q = se * 0.95, g = Math.floor(Q / l);
|
|
25
|
+
(!x.current || x.current.length !== g) && (x.current = new Float32Array(g).fill(2));
|
|
26
|
+
const ee = g * l, k = (se - ee) / 2;
|
|
27
|
+
f && I && f.getByteFrequencyData(I);
|
|
28
|
+
const Te = I ? I.length : 0, te = Math.floor(Te * 0.7) / g, Se = new Float32Array(g);
|
|
29
|
+
for (let D = 0; D < g; D++) {
|
|
30
30
|
let J = 0;
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
for (let
|
|
34
|
-
const
|
|
35
|
-
|
|
31
|
+
if (I && te > 0) {
|
|
32
|
+
const V = Math.floor(D * te), $ = Math.floor((D + 1) * te);
|
|
33
|
+
for (let Ee = V; Ee < $; Ee++) {
|
|
34
|
+
const U = I[Ee] || 0;
|
|
35
|
+
U > J && (J = U);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
J < 10 && (J = 0);
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const Y = J / 255, F = J > 0 ? Math.max(2, Math.pow(Y, 1.4) * R * 0.25) : 2;
|
|
40
|
+
Se[D] = F;
|
|
41
41
|
}
|
|
42
|
-
for (let
|
|
43
|
-
const J =
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
42
|
+
for (let D = 0; D < g; D++) {
|
|
43
|
+
const J = g - 1 - D, Y = Math.max(Se[D], Se[J]), F = x.current[D] + (Y - x.current[D]) * 0.3;
|
|
44
|
+
x.current[D] = F;
|
|
45
|
+
const V = k + D * l, $ = we - F / 2;
|
|
46
|
+
S.beginPath(), S.roundRect ? S.roundRect(V, $, K, F, 4) : S.fillRect(V, $, K, F), S.fill();
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return
|
|
50
|
-
cancelAnimationFrame(
|
|
49
|
+
return Ue(), () => {
|
|
50
|
+
cancelAnimationFrame(H);
|
|
51
51
|
};
|
|
52
|
-
}, [
|
|
52
|
+
}, [f]), /* @__PURE__ */ d(
|
|
53
53
|
"canvas",
|
|
54
54
|
{
|
|
55
|
-
ref:
|
|
55
|
+
ref: T,
|
|
56
56
|
style: { width: "100%", height: "100%", display: "block" }
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
|
-
},
|
|
60
|
-
async function
|
|
61
|
-
const
|
|
59
|
+
}, pn = "https://pub-48df6f7d60d6440bbd01676ea5d90e55.r2.dev", Pt = "https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/default-models/avatar-blue-suit.glb";
|
|
60
|
+
async function gn(f) {
|
|
61
|
+
const T = await crypto.subtle.digest(
|
|
62
62
|
"SHA-256",
|
|
63
|
-
new TextEncoder().encode(
|
|
63
|
+
new TextEncoder().encode(f)
|
|
64
64
|
);
|
|
65
|
-
return Array.from(new Uint8Array(
|
|
65
|
+
return Array.from(new Uint8Array(T)).map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const [
|
|
69
|
-
return
|
|
70
|
-
if (!
|
|
71
|
-
|
|
67
|
+
function bn(f) {
|
|
68
|
+
const [T, x] = y(null);
|
|
69
|
+
return W(() => {
|
|
70
|
+
if (!f) {
|
|
71
|
+
x(null);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
let
|
|
75
|
-
return
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
fetch(
|
|
79
|
-
|
|
74
|
+
let b = !1;
|
|
75
|
+
return gn(f).then((S) => {
|
|
76
|
+
if (b) return;
|
|
77
|
+
const H = `${pn}/${S}.glb`;
|
|
78
|
+
fetch(H, { method: "HEAD" }).then((I) => {
|
|
79
|
+
b || x(I.ok ? H : Pt);
|
|
80
80
|
}).catch(() => {
|
|
81
|
-
|
|
81
|
+
b || x(Pt);
|
|
82
82
|
});
|
|
83
83
|
}), () => {
|
|
84
|
-
|
|
84
|
+
b = !0;
|
|
85
85
|
};
|
|
86
|
-
}, [
|
|
86
|
+
}, [f]), T;
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const _n = [
|
|
89
89
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_001.glb",
|
|
90
90
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_002.glb",
|
|
91
91
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_002.glb",
|
|
92
92
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_005.glb"
|
|
93
|
-
],
|
|
93
|
+
], wn = [
|
|
94
94
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/F_Standing_Idle_Variations_001.glb",
|
|
95
95
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/F_Standing_Idle_Variations_003.glb",
|
|
96
96
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/F_Standing_Idle_Variations_003.glb"
|
|
97
|
-
],
|
|
97
|
+
], Sn = [
|
|
98
98
|
{
|
|
99
99
|
id: "m_expr_01",
|
|
100
100
|
name: "Friendly Wave",
|
|
@@ -260,23 +260,23 @@ const fn = [
|
|
|
260
260
|
name: "Take It Easy",
|
|
261
261
|
url: "https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_006.glb"
|
|
262
262
|
}
|
|
263
|
-
],
|
|
263
|
+
], vn = [
|
|
264
264
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_005.glb",
|
|
265
265
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_007.glb",
|
|
266
266
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_006.glb"
|
|
267
|
-
],
|
|
267
|
+
], yn = [
|
|
268
268
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_004.glb",
|
|
269
269
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_005.glb",
|
|
270
270
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_006.glb",
|
|
271
271
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_002.glb"
|
|
272
|
-
],
|
|
272
|
+
], xn = {
|
|
273
273
|
zoom: 0.85,
|
|
274
274
|
position: [0.15, -0.8, 0],
|
|
275
275
|
scale: 1.5,
|
|
276
276
|
rotation: [0.15, 0.02, 0]
|
|
277
|
-
},
|
|
277
|
+
}, Ln = [-0.45, 1.9, 0.1], kn = [-0.45, 1.75, 0.1], Rn = {
|
|
278
278
|
browInnerUp: 0.2
|
|
279
|
-
},
|
|
279
|
+
}, pt = 0.18, An = 1, Bt = "__branding__", nt = {
|
|
280
280
|
neutral: { eyeLookDownLeft: 0.1, eyeLookDownRight: 0.1 },
|
|
281
281
|
happy: {
|
|
282
282
|
mouthSmileLeft: 0.2,
|
|
@@ -358,37 +358,84 @@ const fn = [
|
|
|
358
358
|
mouthUpperUpLeft: 0.1,
|
|
359
359
|
mouthUpperUpRight: 0.1
|
|
360
360
|
}
|
|
361
|
-
},
|
|
362
|
-
{
|
|
361
|
+
}, Tn = [
|
|
362
|
+
{
|
|
363
|
+
key: "viseme_aa",
|
|
364
|
+
mix: { jawOpen: 0.4, mouthSmileLeft: 0.15, mouthSmileRight: 0.15 },
|
|
365
|
+
teethMix: { jawOpen: 0.2, mouthSmileLeft: 0.15, mouthSmileRight: 0.15 }
|
|
366
|
+
},
|
|
363
367
|
{
|
|
364
368
|
key: "viseme_E",
|
|
365
369
|
mix: {
|
|
366
|
-
mouthPressLeft: 0.
|
|
367
|
-
mouthPressRight: 0.
|
|
370
|
+
mouthPressLeft: 0.65,
|
|
371
|
+
mouthPressRight: 0.65,
|
|
368
372
|
mouthDimpleLeft: 1,
|
|
369
373
|
mouthDimpleRight: 1,
|
|
370
|
-
jawOpen: 0.
|
|
374
|
+
jawOpen: 0.25,
|
|
375
|
+
mouthFunnel: 0.1
|
|
376
|
+
},
|
|
377
|
+
teethMix: {
|
|
378
|
+
jawOpen: 0.15,
|
|
379
|
+
mouthPressLeft: 0.65,
|
|
380
|
+
mouthPressRight: 0.65,
|
|
381
|
+
mouthDimpleLeft: 1,
|
|
382
|
+
mouthDimpleRight: 1,
|
|
383
|
+
mouthFunnel: 0.1
|
|
371
384
|
}
|
|
372
385
|
},
|
|
373
386
|
{
|
|
374
387
|
key: "viseme_I",
|
|
375
388
|
mix: {
|
|
376
|
-
mouthPressLeft: 0.
|
|
377
|
-
mouthPressRight: 0.
|
|
378
|
-
mouthDimpleLeft:
|
|
379
|
-
mouthDimpleRight:
|
|
380
|
-
jawOpen: 0.
|
|
389
|
+
mouthPressLeft: 0.55,
|
|
390
|
+
mouthPressRight: 0.55,
|
|
391
|
+
mouthDimpleLeft: 1,
|
|
392
|
+
mouthDimpleRight: 1,
|
|
393
|
+
jawOpen: 0.15,
|
|
394
|
+
mouthFunnel: 0.05
|
|
395
|
+
},
|
|
396
|
+
teethMix: {
|
|
397
|
+
mouthPressLeft: 0.55,
|
|
398
|
+
mouthPressRight: 0.55,
|
|
399
|
+
mouthDimpleLeft: 1,
|
|
400
|
+
mouthDimpleRight: 1,
|
|
401
|
+
jawOpen: 0.15,
|
|
402
|
+
mouthFunnel: 0.05
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
key: "viseme_O",
|
|
407
|
+
mix: { mouthPucker: 0.7, jawOpen: 0.4, mouthFunnel: 0.25 },
|
|
408
|
+
teethMix: { jawForward: 0.6, jawOpen: 0.2, mouthPucker: 0.7, mouthFunnel: 0.25 }
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
key: "viseme_U",
|
|
412
|
+
mix: { mouthFunnel: 1, mouthClose: 0.2 },
|
|
413
|
+
teethMix: {
|
|
414
|
+
mouthFunnel: 1,
|
|
415
|
+
mouthClose: 0.2
|
|
381
416
|
}
|
|
382
417
|
},
|
|
383
|
-
{ key: "viseme_O", mix: { mouthPucker: 1, jawForward: 0.6, jawOpen: 0.2 } },
|
|
384
|
-
{ key: "viseme_U", mix: { mouthFunnel: 1 } },
|
|
385
418
|
{
|
|
386
419
|
key: "viseme_PP",
|
|
387
420
|
mix: {
|
|
421
|
+
mouthDimpleLeft: 0.5,
|
|
422
|
+
mouthDimpleRight: 0.5,
|
|
423
|
+
mouthStretchLeft: 0.3,
|
|
424
|
+
mouthStretchRight: 0.3,
|
|
388
425
|
mouthRollLower: 0.3,
|
|
389
426
|
mouthRollUpper: 0.3,
|
|
390
|
-
|
|
391
|
-
|
|
427
|
+
mouthPressLeft: 0.5,
|
|
428
|
+
mouthPressRight: 0.5
|
|
429
|
+
},
|
|
430
|
+
teethMix: {
|
|
431
|
+
mouthDimpleLeft: 0.5,
|
|
432
|
+
mouthDimpleRight: 0.5,
|
|
433
|
+
mouthStretchLeft: 0.3,
|
|
434
|
+
mouthStretchRight: 0.3,
|
|
435
|
+
mouthRollLower: 0.3,
|
|
436
|
+
mouthRollUpper: 0.3,
|
|
437
|
+
mouthPressLeft: 0.5,
|
|
438
|
+
mouthPressRight: 0.5
|
|
392
439
|
}
|
|
393
440
|
},
|
|
394
441
|
{
|
|
@@ -396,20 +443,43 @@ const fn = [
|
|
|
396
443
|
mix: {
|
|
397
444
|
mouthPucker: 1,
|
|
398
445
|
mouthShrugUpper: 1,
|
|
399
|
-
mouthLowerDownLeft: 0.2,
|
|
400
|
-
mouthLowerDownRight: 0.2,
|
|
401
446
|
mouthDimpleLeft: 1,
|
|
402
447
|
mouthDimpleRight: 1,
|
|
403
|
-
|
|
448
|
+
mouthStretchLeft: 0.5,
|
|
449
|
+
mouthStretchRight: 0.5,
|
|
450
|
+
mouthPressLeft: 0.3,
|
|
451
|
+
mouthPressRight: 0.3,
|
|
452
|
+
mouthRollLower: 0.1
|
|
453
|
+
},
|
|
454
|
+
teethMix: {
|
|
455
|
+
mouthPucker: 1,
|
|
456
|
+
mouthShrugUpper: 1,
|
|
457
|
+
mouthDimpleLeft: 1,
|
|
458
|
+
mouthDimpleRight: 1,
|
|
459
|
+
mouthStretchLeft: 0.5,
|
|
460
|
+
mouthStretchRight: 0.5,
|
|
461
|
+
mouthPressLeft: 0.3,
|
|
462
|
+
mouthPressRight: 0.3,
|
|
463
|
+
mouthRollLower: 0.1
|
|
404
464
|
}
|
|
405
465
|
},
|
|
406
466
|
{
|
|
407
467
|
key: "viseme_DD",
|
|
408
468
|
mix: {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
469
|
+
mouthShrugUpper: 0.25,
|
|
470
|
+
mouthShrugLower: 0.25,
|
|
471
|
+
mouthPressLeft: 0.4,
|
|
472
|
+
mouthPressRight: 0.4,
|
|
473
|
+
mouthFunnel: 0.7,
|
|
474
|
+
jawOpen: 0.1
|
|
475
|
+
},
|
|
476
|
+
teethMix: {
|
|
477
|
+
mouthShrugUpper: 0.25,
|
|
478
|
+
mouthShrugLower: 0.25,
|
|
479
|
+
mouthPressLeft: 0.4,
|
|
480
|
+
mouthPressRight: 0.4,
|
|
481
|
+
mouthFunnel: 0.7,
|
|
482
|
+
jawOpen: 0.1
|
|
413
483
|
}
|
|
414
484
|
},
|
|
415
485
|
{
|
|
@@ -417,44 +487,113 @@ const fn = [
|
|
|
417
487
|
mix: {
|
|
418
488
|
mouthPressLeft: 0.8,
|
|
419
489
|
mouthPressRight: 0.8,
|
|
420
|
-
mouthLowerDownLeft: 0.
|
|
421
|
-
mouthLowerDownRight: 0.
|
|
490
|
+
mouthLowerDownLeft: 0.3,
|
|
491
|
+
mouthLowerDownRight: 0.3,
|
|
492
|
+
jawOpen: 0.1
|
|
493
|
+
},
|
|
494
|
+
teethMix: {
|
|
495
|
+
mouthPressLeft: 0.8,
|
|
496
|
+
mouthPressRight: 0.8,
|
|
497
|
+
mouthLowerDownLeft: 0.3,
|
|
498
|
+
mouthLowerDownRight: 0.3,
|
|
422
499
|
jawOpen: 0.1
|
|
423
500
|
}
|
|
424
501
|
},
|
|
425
502
|
{
|
|
426
503
|
key: "viseme_TH",
|
|
427
|
-
mix: {
|
|
504
|
+
mix: { mouthStretchLeft: 0.4, mouthStretchRight: 0.4, mouthDimpleLeft: 1, mouthDimpleRight: 1, mouthFunnel: 0.4, jawOpen: 0.15, mouthShrugLower: 0.45, mouthShrugUpper: 0.45 },
|
|
505
|
+
teethMix: {
|
|
506
|
+
mouthStretchLeft: 0.4,
|
|
507
|
+
mouthStretchRight: 0.4,
|
|
508
|
+
mouthDimpleLeft: 1,
|
|
509
|
+
mouthDimpleRight: 1,
|
|
510
|
+
mouthFunnel: 0.4,
|
|
511
|
+
jawOpen: 0.15,
|
|
512
|
+
mouthShrugLower: 0.45,
|
|
513
|
+
mouthShrugUpper: 0.45
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
key: "viseme_CH",
|
|
518
|
+
mix: {
|
|
519
|
+
mouthPucker: 0.8,
|
|
520
|
+
mouthShrugLower: 0.7,
|
|
521
|
+
mouthShrugUpper: 0.2,
|
|
522
|
+
mouthLowerDownLeft: 0.6,
|
|
523
|
+
mouthLowerDownRight: 0.6,
|
|
524
|
+
mouthDimpleLeft: 0.5,
|
|
525
|
+
mouthDimpleRight: 0.5,
|
|
526
|
+
mouthUpperUpLeft: 0.8,
|
|
527
|
+
mouthUpperUpRight: 0.8,
|
|
528
|
+
jawOpen: 0.2
|
|
529
|
+
},
|
|
530
|
+
teethMix: {
|
|
531
|
+
mouthPucker: 0.8,
|
|
532
|
+
mouthShrugLower: 0.7,
|
|
533
|
+
mouthShrugUpper: 0.2,
|
|
534
|
+
mouthLowerDownLeft: 0.6,
|
|
535
|
+
mouthLowerDownRight: 0.6,
|
|
536
|
+
mouthDimpleLeft: 0.5,
|
|
537
|
+
mouthDimpleRight: 0.5,
|
|
538
|
+
mouthUpperUpLeft: 0.8,
|
|
539
|
+
mouthUpperUpRight: 0.8,
|
|
540
|
+
jawOpen: 0.2
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
key: "viseme_RR",
|
|
545
|
+
mix: { mouthPucker: 0.4, jawOpen: 0.2, mouthShrugUpper: 0.5, mouthFunnel: 0.15, mouthDimpleLeft: 0.5, mouthDimpleRight: 0.5 },
|
|
546
|
+
teethMix: {
|
|
547
|
+
mouthPucker: 0.4,
|
|
548
|
+
jawOpen: 0.2,
|
|
549
|
+
mouthShrugUpper: 0.5,
|
|
550
|
+
mouthFunnel: 0.15,
|
|
551
|
+
mouthDimpleLeft: 0.5,
|
|
552
|
+
mouthDimpleRight: 0.5
|
|
553
|
+
}
|
|
428
554
|
},
|
|
429
|
-
{ key: "viseme_CH", mix: { mouthPucker: 0.5, jawOpen: 0.2 } },
|
|
430
|
-
{ key: "viseme_RR", mix: { mouthPucker: 0.5, jawOpen: 0.2 } },
|
|
431
555
|
{
|
|
432
556
|
key: "viseme_kk",
|
|
433
557
|
mix: {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
558
|
+
mouthPucker: 0.5,
|
|
559
|
+
jawOpen: 0.2,
|
|
560
|
+
mouthShrugUpper: 0.5,
|
|
561
|
+
mouthFunnel: 0.2,
|
|
562
|
+
mouthDimpleLeft: 0.5,
|
|
563
|
+
mouthDimpleRight: 0.5
|
|
564
|
+
},
|
|
565
|
+
teethMix: {
|
|
566
|
+
mouthPucker: 0.5,
|
|
567
|
+
jawOpen: 0.2,
|
|
568
|
+
mouthShrugUpper: 0.5,
|
|
569
|
+
mouthFunnel: 0.2,
|
|
570
|
+
mouthDimpleLeft: 0.5,
|
|
571
|
+
mouthDimpleRight: 0.5
|
|
441
572
|
}
|
|
442
573
|
},
|
|
443
574
|
{
|
|
444
575
|
key: "viseme_nn",
|
|
445
576
|
mix: {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
mouthFunnel: 0.
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
577
|
+
mouthPucker: 0.6,
|
|
578
|
+
jawOpen: 0.2,
|
|
579
|
+
mouthShrugUpper: 0.7,
|
|
580
|
+
mouthShrugLower: 0.1,
|
|
581
|
+
mouthFunnel: 0.1,
|
|
582
|
+
mouthDimpleLeft: 0.8,
|
|
583
|
+
mouthDimpleRight: 0.8
|
|
584
|
+
},
|
|
585
|
+
teethMix: {
|
|
586
|
+
mouthPucker: 0.6,
|
|
587
|
+
jawOpen: 0.2,
|
|
588
|
+
mouthShrugUpper: 0.7,
|
|
589
|
+
mouthShrugLower: 0.1,
|
|
590
|
+
mouthFunnel: 0.1,
|
|
591
|
+
mouthDimpleLeft: 0.8,
|
|
592
|
+
mouthDimpleRight: 0.8
|
|
454
593
|
}
|
|
455
594
|
},
|
|
456
595
|
{ key: "viseme_sil", mix: {} }
|
|
457
|
-
],
|
|
596
|
+
], Mn = {
|
|
458
597
|
aei: [
|
|
459
598
|
{ v: "E", w: 0.8 },
|
|
460
599
|
{ v: "I", w: 0.2 }
|
|
@@ -483,345 +622,352 @@ const fn = [
|
|
|
483
622
|
],
|
|
484
623
|
sil: [{ v: "sil", w: 1 }]
|
|
485
624
|
};
|
|
486
|
-
function
|
|
487
|
-
if (!
|
|
488
|
-
const
|
|
489
|
-
return
|
|
625
|
+
function En(f) {
|
|
626
|
+
if (!f) return [{ v: "sil", w: 1 }];
|
|
627
|
+
const T = f.toLowerCase();
|
|
628
|
+
return Mn[T] ?? [{ v: "sil", w: 1 }];
|
|
490
629
|
}
|
|
491
|
-
function
|
|
492
|
-
const { camera:
|
|
493
|
-
return
|
|
494
|
-
|
|
495
|
-
}, [
|
|
630
|
+
function In({ target: f }) {
|
|
631
|
+
const { camera: T } = un();
|
|
632
|
+
return W(() => {
|
|
633
|
+
T.lookAt(...f);
|
|
634
|
+
}, [T, f]), null;
|
|
496
635
|
}
|
|
497
|
-
function
|
|
498
|
-
if (!
|
|
636
|
+
function E(f, T, x) {
|
|
637
|
+
if (!f || !f.morphTargetDictionary)
|
|
499
638
|
return;
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
502
|
-
for (const
|
|
503
|
-
|
|
639
|
+
const b = f, S = b.morphTargetDictionary, H = b.morphTargetInfluences;
|
|
640
|
+
if (H)
|
|
641
|
+
for (const I in S)
|
|
642
|
+
I.toLowerCase() === T.toLowerCase() && (H[S[I]] = x);
|
|
504
643
|
}
|
|
505
|
-
function
|
|
506
|
-
if (!
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
509
|
-
for (let
|
|
510
|
-
|
|
644
|
+
function gt(f, T = 0.97) {
|
|
645
|
+
if (!f) return;
|
|
646
|
+
const x = f;
|
|
647
|
+
if (x.morphTargetInfluences)
|
|
648
|
+
for (let b = 0; b < x.morphTargetInfluences.length; b++)
|
|
649
|
+
x.morphTargetInfluences[b] *= T;
|
|
511
650
|
}
|
|
512
|
-
const
|
|
651
|
+
const Dn = ln(
|
|
513
652
|
({
|
|
514
|
-
avatarUrl:
|
|
515
|
-
isPlayingRef:
|
|
516
|
-
visemeQueueRef:
|
|
517
|
-
audioContextRef:
|
|
518
|
-
responseAudioStartTimeRef:
|
|
519
|
-
adjustments:
|
|
520
|
-
mood:
|
|
521
|
-
expression:
|
|
522
|
-
agentResponse:
|
|
523
|
-
isSpeaking:
|
|
524
|
-
nextStartTimeRef:
|
|
525
|
-
stopPlayback:
|
|
526
|
-
setIsSpeaking:
|
|
527
|
-
expressionUrl:
|
|
528
|
-
onExpressionFinished:
|
|
529
|
-
isNudgeResponse:
|
|
530
|
-
avatarGender:
|
|
653
|
+
avatarUrl: f,
|
|
654
|
+
isPlayingRef: T,
|
|
655
|
+
visemeQueueRef: x,
|
|
656
|
+
audioContextRef: b,
|
|
657
|
+
responseAudioStartTimeRef: S,
|
|
658
|
+
adjustments: H,
|
|
659
|
+
mood: I,
|
|
660
|
+
expression: Ue,
|
|
661
|
+
agentResponse: se,
|
|
662
|
+
isSpeaking: R,
|
|
663
|
+
nextStartTimeRef: we,
|
|
664
|
+
stopPlayback: K,
|
|
665
|
+
setIsSpeaking: j,
|
|
666
|
+
expressionUrl: l,
|
|
667
|
+
onExpressionFinished: Q,
|
|
668
|
+
isNudgeResponse: g,
|
|
669
|
+
avatarGender: ee
|
|
531
670
|
}) => {
|
|
532
|
-
const { scene:
|
|
533
|
-
() =>
|
|
534
|
-
[
|
|
535
|
-
),
|
|
536
|
-
() =>
|
|
537
|
-
[
|
|
538
|
-
),
|
|
539
|
-
|
|
540
|
-
if (!(!
|
|
541
|
-
if (
|
|
671
|
+
const { scene: k } = mt(f), Me = mt(ee === "female" ? wn : _n), te = bt(
|
|
672
|
+
() => Me.flatMap((m) => m.animations),
|
|
673
|
+
[Me]
|
|
674
|
+
), D = mt(ee === "female" ? yn : vn), J = bt(
|
|
675
|
+
() => D.flatMap((m) => m.animations),
|
|
676
|
+
[D]
|
|
677
|
+
), Y = a(null), F = a(null), V = a(null), $ = a(null), Ee = a([]), [U] = y(() => new ze.AnimationMixer(k)), N = a({}), O = a(null), ve = a(0), Ne = a(!1), ye = a(0), de = a(null);
|
|
678
|
+
W(() => {
|
|
679
|
+
if (!(!te || !k)) {
|
|
680
|
+
if (te.forEach((m, u) => {
|
|
542
681
|
const s = `idle_${u}`;
|
|
543
|
-
if (!
|
|
544
|
-
const o =
|
|
545
|
-
o.name = s, o.setLoop(
|
|
682
|
+
if (!N.current[s]) {
|
|
683
|
+
const o = U.clipAction(m, k);
|
|
684
|
+
o.name = s, o.setLoop(ze.LoopOnce, 1), o.clampWhenFinished = !0, N.current[s] = o;
|
|
546
685
|
}
|
|
547
|
-
}), J.forEach((
|
|
686
|
+
}), J.forEach((m, u) => {
|
|
548
687
|
const s = `talk_${u}`;
|
|
549
|
-
if (!
|
|
550
|
-
const o =
|
|
551
|
-
o.name = s, o.setLoop(
|
|
688
|
+
if (!N.current[s]) {
|
|
689
|
+
const o = U.clipAction(m, k);
|
|
690
|
+
o.name = s, o.setLoop(ze.LoopOnce, 1), o.clampWhenFinished = !0, N.current[s] = o;
|
|
552
691
|
}
|
|
553
|
-
}),
|
|
554
|
-
const
|
|
555
|
-
|
|
692
|
+
}), te.length > 0) {
|
|
693
|
+
const m = N.current.idle_0, u = O.current && U.existingAction(O.current.getClip());
|
|
694
|
+
m && !u && (m.reset().fadeIn(0.5).play(), O.current = m);
|
|
556
695
|
}
|
|
557
696
|
return () => {
|
|
558
|
-
|
|
697
|
+
U.stopAllAction(), N.current = {}, O.current = null;
|
|
559
698
|
};
|
|
560
699
|
}
|
|
561
|
-
}, [
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
if (!
|
|
565
|
-
|
|
566
|
-
|
|
700
|
+
}, [te, J, k, U]);
|
|
701
|
+
const pe = a("");
|
|
702
|
+
W(() => {
|
|
703
|
+
if (!l || !k || l === pe.current) return;
|
|
704
|
+
pe.current = l, de.current = l, new fn().load(
|
|
705
|
+
l,
|
|
567
706
|
(u) => {
|
|
568
707
|
if (u.animations && u.animations.length > 0) {
|
|
569
|
-
const s = u.animations[0], o =
|
|
570
|
-
if (o.name = `EXPR_${
|
|
571
|
-
const h =
|
|
572
|
-
o.reset().fadeIn(0.3).play(), h && h !== o && h.crossFadeTo(o, 0.3, !0),
|
|
708
|
+
const s = u.animations[0], o = U.clipAction(s, k);
|
|
709
|
+
if (o.name = `EXPR_${l}`, o.setLoop(ze.LoopOnce, 1), o.clampWhenFinished = !0, N.current[`EXPR_${l}`] = o, R && de.current === l) {
|
|
710
|
+
const h = O.current;
|
|
711
|
+
o.reset().fadeIn(0.3).play(), h && h !== o && h.crossFadeTo(o, 0.3, !0), O.current = o, de.current = null;
|
|
573
712
|
}
|
|
574
713
|
}
|
|
575
714
|
},
|
|
576
715
|
void 0,
|
|
577
716
|
(u) => {
|
|
578
|
-
console.error(`[ANIMATION] Failed to load ${
|
|
717
|
+
console.error(`[ANIMATION] Failed to load ${l}`, u);
|
|
579
718
|
}
|
|
580
719
|
);
|
|
581
|
-
}, [
|
|
582
|
-
const
|
|
720
|
+
}, [l, k, U, R]), W(() => {
|
|
721
|
+
const m = (u) => {
|
|
583
722
|
const s = u.action, o = s.name || "";
|
|
584
723
|
if (o.startsWith("idle_")) {
|
|
585
|
-
const
|
|
586
|
-
X && (X.reset().fadeIn(0.5).play(), s.crossFadeTo(X, 0.5, !0),
|
|
724
|
+
const M = (parseInt(o.split("_")[1]) + 1) % te.length, X = N.current[`idle_${M}`];
|
|
725
|
+
X && (X.reset().fadeIn(0.5).play(), s.crossFadeTo(X, 0.5, !0), O.current = X);
|
|
587
726
|
} else if (o.startsWith("EXPR_")) {
|
|
588
|
-
if (
|
|
727
|
+
if (R) {
|
|
589
728
|
const h = Math.floor(
|
|
590
729
|
Math.random() * J.length
|
|
591
|
-
),
|
|
592
|
-
|
|
730
|
+
), M = N.current[`talk_${h}`];
|
|
731
|
+
M && (M.reset().fadeIn(0.5).play(), s.crossFadeTo(M, 0.5, !0), O.current = M);
|
|
593
732
|
} else {
|
|
594
|
-
const h =
|
|
595
|
-
h && (h.reset().fadeIn(0.5).play(), s.crossFadeTo(h, 0.5, !0),
|
|
733
|
+
const h = N.current.idle_0;
|
|
734
|
+
h && (h.reset().fadeIn(0.5).play(), s.crossFadeTo(h, 0.5, !0), O.current = h);
|
|
596
735
|
}
|
|
597
|
-
|
|
736
|
+
Q && Q();
|
|
598
737
|
} else if (o.startsWith("talk_"))
|
|
599
|
-
if (
|
|
600
|
-
const
|
|
601
|
-
X && (X.reset().fadeIn(0.3).play(), s.crossFadeTo(X, 0.3, !0),
|
|
738
|
+
if (R && !g) {
|
|
739
|
+
const M = (parseInt(o.split("_")[1]) + 1) % J.length, X = N.current[`talk_${M}`];
|
|
740
|
+
X && (X.reset().fadeIn(0.3).play(), s.crossFadeTo(X, 0.3, !0), O.current = X);
|
|
602
741
|
} else {
|
|
603
|
-
const h =
|
|
604
|
-
h && (h.reset().fadeIn(0.5).play(), s.crossFadeTo(h, 0.5, !0),
|
|
742
|
+
const h = N.current.idle_0;
|
|
743
|
+
h && (h.reset().fadeIn(0.5).play(), s.crossFadeTo(h, 0.5, !0), O.current = h);
|
|
605
744
|
}
|
|
606
745
|
};
|
|
607
|
-
return
|
|
746
|
+
return U.addEventListener("finished", m), () => U.removeEventListener("finished", m);
|
|
608
747
|
}, [
|
|
609
|
-
M,
|
|
610
|
-
Y,
|
|
611
|
-
J,
|
|
612
|
-
N,
|
|
613
748
|
U,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
749
|
+
te,
|
|
750
|
+
J,
|
|
751
|
+
R,
|
|
752
|
+
g,
|
|
753
|
+
Q
|
|
754
|
+
]), W(() => {
|
|
755
|
+
if (R && k) {
|
|
756
|
+
const m = O.current, u = m?.name || "";
|
|
618
757
|
if (u.startsWith("idle_") || u.startsWith("talk_") || u === "") {
|
|
619
|
-
const s =
|
|
758
|
+
const s = de.current;
|
|
620
759
|
if (s) {
|
|
621
|
-
const o =
|
|
760
|
+
const o = N.current[`EXPR_${s}`];
|
|
622
761
|
if (o) {
|
|
623
|
-
o.reset().fadeIn(0.3).play(),
|
|
762
|
+
o.reset().fadeIn(0.3).play(), m && m !== o && m.crossFadeTo(o, 0.3, !0), O.current = o, de.current = null;
|
|
624
763
|
return;
|
|
625
764
|
}
|
|
626
765
|
}
|
|
627
766
|
if (u.startsWith("idle_") || u === "") {
|
|
628
767
|
const o = Math.floor(
|
|
629
768
|
Math.random() * J.length
|
|
630
|
-
), h =
|
|
631
|
-
h && (h.reset().fadeIn(0.5).play(),
|
|
769
|
+
), h = N.current[`talk_${o}`];
|
|
770
|
+
h && (h.reset().fadeIn(0.5).play(), m && m.crossFadeTo(h, 0.5, !0), O.current = h);
|
|
632
771
|
}
|
|
633
772
|
}
|
|
634
|
-
} else if (!
|
|
635
|
-
const
|
|
773
|
+
} else if (!R && k) {
|
|
774
|
+
const m = O.current, u = m?.name || "";
|
|
636
775
|
if (u.startsWith("talk_") || u.startsWith("EXPR_")) {
|
|
637
|
-
const s =
|
|
638
|
-
s && (s.reset().fadeIn(0.5).play(),
|
|
776
|
+
const s = N.current.idle_0;
|
|
777
|
+
s && (s.reset().fadeIn(0.5).play(), m && m.crossFadeTo(s, 0.5, !0), O.current = s);
|
|
639
778
|
}
|
|
640
779
|
}
|
|
641
|
-
}, [
|
|
642
|
-
if (!
|
|
643
|
-
|
|
780
|
+
}, [R, k, l]), W(() => {
|
|
781
|
+
if (!k) return;
|
|
782
|
+
k.traverse((s) => {
|
|
644
783
|
if (s.isMesh && s.morphTargetDictionary) {
|
|
645
784
|
const o = s.name.toLowerCase();
|
|
646
|
-
(o.includes("head") || o.includes("avatar")) && (
|
|
785
|
+
(o.includes("head") || o.includes("avatar")) && (F.current = s, B(`[ANIMATION] Found head mesh: ${s.name}`)), o.includes("teeth") && (V.current = s, B(`[ANIMATION] Found teeth mesh: ${s.name}`)), o.includes("beard") && ($.current = s, B(`[ANIMATION] Found beard mesh: ${s.name}`));
|
|
647
786
|
}
|
|
648
787
|
});
|
|
649
|
-
const
|
|
650
|
-
|
|
788
|
+
const m = F.current?.morphTargetDictionary;
|
|
789
|
+
m && Object.keys(m).filter(
|
|
651
790
|
(s) => s.toLowerCase().includes("brow")
|
|
652
791
|
);
|
|
653
792
|
const u = [];
|
|
654
|
-
|
|
793
|
+
k.traverse((s) => {
|
|
655
794
|
if (s.isMesh) {
|
|
656
795
|
const h = s.morphTargetDictionary;
|
|
657
|
-
h && Object.keys(h).some((
|
|
796
|
+
h && Object.keys(h).some((M) => M.toLowerCase().includes("brow")) && u.push(s);
|
|
658
797
|
}
|
|
659
|
-
}),
|
|
660
|
-
}, [
|
|
661
|
-
const
|
|
662
|
-
const s = `viseme_${
|
|
663
|
-
if (o)
|
|
798
|
+
}), Ee.current = u, u.length > 0 && B("[ANIMATION] Meshes with brow morphs:", u.length);
|
|
799
|
+
}, [k]);
|
|
800
|
+
const He = (m, u = 1) => {
|
|
801
|
+
const s = `viseme_${m}`.toLowerCase(), o = Tn.find((h) => h.key.toLowerCase() === s);
|
|
802
|
+
if (o) {
|
|
664
803
|
for (const h in o.mix) {
|
|
665
|
-
const
|
|
666
|
-
|
|
804
|
+
const M = o.mix[h] * u;
|
|
805
|
+
E(F.current, h, M), E($.current, h, M), (!o.teethMix || !(h in o.teethMix)) && E(V.current, h, M);
|
|
667
806
|
}
|
|
668
|
-
|
|
669
|
-
|
|
807
|
+
if (o.teethMix)
|
|
808
|
+
for (const h in o.teethMix) {
|
|
809
|
+
const M = o.teethMix[h] * u;
|
|
810
|
+
E(V.current, h, M);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}, xe = (m) => {
|
|
814
|
+
const u = nt[m] ?? nt.neutral;
|
|
670
815
|
for (const s in u)
|
|
671
|
-
|
|
816
|
+
E(F.current, s, u[s]), E(V.current, s, u[s]), E($.current, s, u[s]);
|
|
672
817
|
};
|
|
673
|
-
return
|
|
818
|
+
return an((m, u) => {
|
|
674
819
|
const s = Math.pow(0.88, 60 * u);
|
|
675
|
-
|
|
676
|
-
const o =
|
|
820
|
+
gt(F.current, s), gt(V.current, s), gt($.current, s), xe(I);
|
|
821
|
+
const o = m.clock.elapsedTime;
|
|
677
822
|
let h = 0;
|
|
678
823
|
if (Math.floor(o) % 5 === 0 && Math.floor((o - u) % 5) !== 0) {
|
|
679
824
|
let q = null;
|
|
680
|
-
|
|
681
|
-
|
|
825
|
+
k.traverse((z) => {
|
|
826
|
+
z.name.toLowerCase().includes("hips") && (q = z);
|
|
682
827
|
});
|
|
683
|
-
const
|
|
684
|
-
|
|
828
|
+
const ke = q ? `Hips Y: ${q.position.y.toFixed(4)}` : "Hips not found";
|
|
829
|
+
B(`[ANIMATION] Mixer Time: ${U.time.toFixed(2)}, ${ke}`);
|
|
685
830
|
}
|
|
686
|
-
if (
|
|
687
|
-
const q =
|
|
688
|
-
if (
|
|
689
|
-
|
|
690
|
-
const
|
|
691
|
-
|
|
831
|
+
if (U.update(u), o > ve.current && !Ne.current && (Ne.current = !0, ye.current = o), Ne.current) {
|
|
832
|
+
const q = R ? 0.2 : 0.3, ke = (o - ye.current) / q;
|
|
833
|
+
if (ke >= 1) {
|
|
834
|
+
Ne.current = !1;
|
|
835
|
+
const z = R ? 1 : 2.5;
|
|
836
|
+
ve.current = o + z;
|
|
692
837
|
} else {
|
|
693
|
-
const
|
|
694
|
-
|
|
838
|
+
const z = ke < 0.5 ? ke * 2 : (1 - ke) * 2;
|
|
839
|
+
E(F.current, "eyeBlinkLeft", z), E(F.current, "eyeBlinkRight", z), E(V.current, "eyeBlinkLeft", z), E(V.current, "eyeBlinkRight", z), E($.current, "eyeBlinkLeft", z), E($.current, "eyeBlinkRight", z), h = z * Rn.browInnerUp;
|
|
695
840
|
}
|
|
696
841
|
}
|
|
697
|
-
const
|
|
698
|
-
if (
|
|
699
|
-
const q =
|
|
700
|
-
|
|
701
|
-
|
|
842
|
+
const M = nt[I] ?? nt.neutral, X = M.browInnerUp ?? 0, rt = M.browOuterUpLeft ?? 0, Ke = M.browOuterUpRight ?? 0, je = o * An, Ie = pt * Math.sin(je), ne = pt * 0.7 * Math.sin(je + 0.7), Qe = pt * 0.7 * Math.sin(je + 1.3), oe = (q) => Math.max(0, Math.min(1, q)), De = oe(X + Ie), Le = oe(rt + ne), Pe = oe(Ke + Qe), Oe = oe(De + h);
|
|
843
|
+
if (E(F.current, "browInnerUp", Oe), E(V.current, "browInnerUp", Oe), E($.current, "browInnerUp", Oe), E(F.current, "browOuterUpLeft", Le), E(V.current, "browOuterUpLeft", Le), E($.current, "browOuterUpLeft", Le), E(F.current, "browOuterUpRight", Pe), E(V.current, "browOuterUpRight", Pe), E($.current, "browOuterUpRight", Pe), Y.current) {
|
|
844
|
+
const q = T.current ? 0 : H.rotation[1];
|
|
845
|
+
Y.current.rotation.y = ze.MathUtils.lerp(
|
|
846
|
+
Y.current.rotation.y,
|
|
702
847
|
q,
|
|
703
848
|
0.1
|
|
704
|
-
),
|
|
849
|
+
), Y.current.position.set(...H.position), Y.current.scale.setScalar(H.scale), Y.current.rotation.x = H.rotation[0], Y.current.rotation.z = H.rotation[2];
|
|
705
850
|
}
|
|
706
|
-
if (
|
|
707
|
-
const q =
|
|
708
|
-
for (let
|
|
709
|
-
const
|
|
710
|
-
|
|
851
|
+
if (T.current && b.current) {
|
|
852
|
+
const q = b.current.currentTime, Be = (q - S.current) * 1e3 - -150;
|
|
853
|
+
for (let re = 0; re < x.current.length; re++) {
|
|
854
|
+
const ae = x.current[re];
|
|
855
|
+
Be >= ae.vtime && Be < ae.vtime + ae.vduration && He(ae.viseme, ae.weight ?? 1);
|
|
711
856
|
}
|
|
712
|
-
q >
|
|
857
|
+
q > we.current + 0.5 && (K(), j(!1));
|
|
713
858
|
}
|
|
714
|
-
}), /* @__PURE__ */
|
|
859
|
+
}), /* @__PURE__ */ d("group", { ref: Y, children: /* @__PURE__ */ d("primitive", { object: k }) });
|
|
715
860
|
}
|
|
716
861
|
);
|
|
717
|
-
function
|
|
718
|
-
return
|
|
862
|
+
function On(f) {
|
|
863
|
+
return f ? f.charAt(0).toUpperCase() + f.slice(1).toLowerCase() : "";
|
|
719
864
|
}
|
|
720
|
-
function
|
|
721
|
-
return
|
|
865
|
+
function Wt(f) {
|
|
866
|
+
return f.replace(/\*(.*?)\*/g, " $1 ").replace(/\[.*?\]/g, " ").replace(/<.*?\/>/g, " ").replace(/<.*?>.*?<\/.*?>/g, " ").replace(/\s+/g, " ").trim();
|
|
722
867
|
}
|
|
723
|
-
const
|
|
724
|
-
token:
|
|
725
|
-
agentToken:
|
|
726
|
-
onNavigationRequested:
|
|
727
|
-
avatarGender:
|
|
728
|
-
presetUserDetails:
|
|
868
|
+
const Cn = ({
|
|
869
|
+
token: f,
|
|
870
|
+
agentToken: T,
|
|
871
|
+
onNavigationRequested: x,
|
|
872
|
+
avatarGender: b,
|
|
873
|
+
presetUserDetails: S,
|
|
874
|
+
onAvatarReady: H
|
|
729
875
|
} = {}) => {
|
|
730
|
-
const
|
|
876
|
+
const I = f ?? T ?? "", Ue = bn(I || void 0), [se, R] = y(""), [we, K] = y(""), [j, l] = y("Ready"), [Q, g] = y(!1), [ee, k] = y(!1), [Te, Me] = y([]), [te, Se] = y(""), D = a(null), [J, Y] = y(
|
|
731
877
|
() => typeof window < "u" ? window.matchMedia("(max-width: 480px)").matches : !1
|
|
732
878
|
);
|
|
733
|
-
|
|
734
|
-
const e = window.matchMedia("(max-width: 480px)"), t = () =>
|
|
879
|
+
W(() => {
|
|
880
|
+
const e = window.matchMedia("(max-width: 480px)"), t = () => Y(e.matches);
|
|
735
881
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
736
882
|
}, []);
|
|
737
|
-
const
|
|
883
|
+
const F = J ? 80 : 600, V = a(!1), $ = a([]), Ee = a(0), U = a(!1), N = a([]), O = a(null), ve = a([]);
|
|
738
884
|
a([]);
|
|
739
|
-
const
|
|
885
|
+
const Ne = a([]), ye = a(0), de = a(0), pe = a(0), He = a(0), xe = a(!1), [m, u] = y(
|
|
740
886
|
null
|
|
741
|
-
), s = a(null), [o, h] =
|
|
887
|
+
), s = a(null), [o, h] = y("neutral"), [M, X] = y(""), [rt, Ke] = y(""), [je, Ie] = y("Chat with us"), [ne, Qe] = y(
|
|
742
888
|
null
|
|
743
|
-
), [
|
|
744
|
-
q.current =
|
|
745
|
-
const [
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
if (
|
|
750
|
-
|
|
889
|
+
), [oe, De] = y("hidden"), [Le, Pe] = y(""), Oe = a(null), q = a(oe);
|
|
890
|
+
q.current = oe;
|
|
891
|
+
const [ke, z] = y(null), Be = a(null), re = a(null), [ae, _t] = y(!1), wt = a(null), [he, Xe] = y("hidden"), [St, Vt] = y(""), it = a(he);
|
|
892
|
+
it.current = he;
|
|
893
|
+
const ie = a(""), ge = a(!1), be = a(""), vt = a(Date.now()), st = a([]), Je = a(!1), [ot, qe] = y(!1), [yt, xt] = y(!1), Re = a(null), We = bt(() => ae ? "Try again" : j === "Busy" ? "Busy" : j === "Thinking..." || j === "Processing Voice..." ? j : ne != null && ne !== "" && ne !== "none" && ne !== "<none>" ? `Enter ${On(ne)}` : he !== "hidden" || !yt ? null : Bt, [j, ne, ae, he, yt]), Lt = !ae && j !== "Busy" && j !== "Thinking..." && j !== "Processing Voice..." && (ne == null || ne === "" || ne === "none" || ne === "<none>");
|
|
894
|
+
W(() => {
|
|
895
|
+
if (he !== "hidden" || !Lt) {
|
|
896
|
+
xt(!1), Re.current != null && (clearTimeout(Re.current), Re.current = null);
|
|
751
897
|
return;
|
|
752
898
|
}
|
|
753
|
-
return
|
|
754
|
-
|
|
899
|
+
return Re.current = setTimeout(() => {
|
|
900
|
+
Re.current = null, xt(!0);
|
|
755
901
|
}, 400), () => {
|
|
756
|
-
|
|
902
|
+
Re.current != null && (clearTimeout(Re.current), Re.current = null);
|
|
757
903
|
};
|
|
758
|
-
}, [
|
|
759
|
-
const
|
|
760
|
-
|
|
904
|
+
}, [he, Lt]);
|
|
905
|
+
const Ze = We != null && We !== "";
|
|
906
|
+
W(() => {
|
|
761
907
|
const e = q.current;
|
|
762
908
|
if (!(e === "exiting" || e === "entering")) {
|
|
763
909
|
if (e === "hidden") {
|
|
764
|
-
|
|
910
|
+
Ze && (Pe(We ?? ""), De("entering"));
|
|
765
911
|
return;
|
|
766
912
|
}
|
|
767
|
-
e === "visible" && (!
|
|
913
|
+
e === "visible" && (!Ze || We !== Le) && (Oe.current = Ze ? We : null, De("exiting"));
|
|
768
914
|
}
|
|
769
915
|
}, [
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
]),
|
|
775
|
-
if (
|
|
776
|
-
|
|
916
|
+
Ze,
|
|
917
|
+
We,
|
|
918
|
+
oe,
|
|
919
|
+
Le
|
|
920
|
+
]), W(() => {
|
|
921
|
+
if (j !== "Busy") {
|
|
922
|
+
re.current != null && (clearTimeout(re.current), re.current = null);
|
|
777
923
|
return;
|
|
778
924
|
}
|
|
779
|
-
return
|
|
780
|
-
|
|
925
|
+
return re.current = setTimeout(() => {
|
|
926
|
+
re.current = null, l("Ready"), _t(!0);
|
|
781
927
|
}, 12e3), () => {
|
|
782
|
-
|
|
928
|
+
re.current != null && (clearTimeout(re.current), re.current = null);
|
|
783
929
|
};
|
|
784
|
-
}, [
|
|
785
|
-
if (!
|
|
786
|
-
const e = setTimeout(() =>
|
|
930
|
+
}, [j]), W(() => {
|
|
931
|
+
if (!ae) return;
|
|
932
|
+
const e = setTimeout(() => _t(!1), 2500);
|
|
787
933
|
return () => clearTimeout(e);
|
|
788
|
-
}, [
|
|
789
|
-
const
|
|
934
|
+
}, [ae]);
|
|
935
|
+
const $t = $e(() => {
|
|
790
936
|
const e = q.current;
|
|
791
937
|
if (e === "exiting") {
|
|
792
|
-
|
|
793
|
-
const t =
|
|
794
|
-
|
|
795
|
-
} else e === "entering" &&
|
|
796
|
-
}, []),
|
|
938
|
+
De("hidden");
|
|
939
|
+
const t = Oe.current;
|
|
940
|
+
Oe.current = null, t != null && t !== "" && (Pe(t), De("entering"));
|
|
941
|
+
} else e === "entering" && De("visible");
|
|
942
|
+
}, []), Ht = (e) => {
|
|
797
943
|
if (!e) return;
|
|
798
944
|
if (e.mood != null) {
|
|
799
|
-
const
|
|
800
|
-
h(
|
|
945
|
+
const r = String(e.mood).toLowerCase();
|
|
946
|
+
h(r);
|
|
801
947
|
}
|
|
802
948
|
if (e.expression != null) {
|
|
803
|
-
const
|
|
804
|
-
X(
|
|
805
|
-
const c =
|
|
806
|
-
(
|
|
949
|
+
const r = String(e.expression).trim();
|
|
950
|
+
X(r);
|
|
951
|
+
const c = Sn.find(
|
|
952
|
+
(p) => p.name.toLowerCase() === r.toLowerCase()
|
|
807
953
|
);
|
|
808
|
-
|
|
809
|
-
`[STREAM] Animation match for "${
|
|
810
|
-
),
|
|
954
|
+
B(
|
|
955
|
+
`[STREAM] Animation match for "${r}": ${c ? c.name : "NONE"}`
|
|
956
|
+
), Ke(c?.url ?? "");
|
|
811
957
|
}
|
|
812
958
|
if (e.navigation != null) {
|
|
813
|
-
const
|
|
814
|
-
|
|
959
|
+
const r = String(e.navigation).trim();
|
|
960
|
+
r !== "" && (x ? x(r) : window.open(r, "_blank"));
|
|
815
961
|
}
|
|
816
|
-
const t = e.ask_for || e.lead_capture?.ask_for,
|
|
962
|
+
const t = e.ask_for || e.lead_capture?.ask_for, n = t ? String(t).trim().toLowerCase() : "", i = n === "none" || n === "<none>";
|
|
817
963
|
if (t && !i) {
|
|
818
|
-
const
|
|
819
|
-
if (
|
|
964
|
+
const r = n;
|
|
965
|
+
if (S && (r === "email" && S.email || r === "name" && S.name || r === "phone" && S.phone))
|
|
820
966
|
return;
|
|
821
|
-
|
|
822
|
-
} else (i || e.ask_for === null || e.lead_capture && e.lead_capture.ask_for === null || e.ask_for === "none") && (
|
|
967
|
+
Qe(r || null), Ie(r === "email" ? "Enter your email" : r === "name" ? "Enter your name" : r === "phone" ? "Enter your phone number" : "Chat with us");
|
|
968
|
+
} else (i || e.ask_for === null || e.lead_capture && e.lead_capture.ask_for === null || e.ask_for === "none") && (Qe(null), je !== "Chat with us" && Ie("Chat with us"));
|
|
823
969
|
e.collected, e.valid;
|
|
824
|
-
},
|
|
970
|
+
}, jt = (e) => {
|
|
825
971
|
const t = e.trim();
|
|
826
972
|
if (!t) return null;
|
|
827
973
|
if (t.startsWith("{"))
|
|
@@ -831,127 +977,127 @@ const Ln = ({
|
|
|
831
977
|
return null;
|
|
832
978
|
}
|
|
833
979
|
if (t.includes(":")) {
|
|
834
|
-
const
|
|
835
|
-
return { [i]:
|
|
980
|
+
const n = t.split(":"), i = n[0].trim().toLowerCase(), r = n.slice(1).join(":").trim();
|
|
981
|
+
return { [i]: r };
|
|
836
982
|
}
|
|
837
983
|
return null;
|
|
838
|
-
},
|
|
839
|
-
}, []),
|
|
840
|
-
for (;
|
|
984
|
+
}, Jt = $e(() => {
|
|
985
|
+
}, []), Ae = "§", at = () => {
|
|
986
|
+
for (; ie.current.includes(`
|
|
841
987
|
`); ) {
|
|
842
|
-
const e =
|
|
843
|
-
`), t =
|
|
844
|
-
|
|
845
|
-
const
|
|
846
|
-
|
|
988
|
+
const e = ie.current.indexOf(`
|
|
989
|
+
`), t = ie.current.slice(0, e).trim();
|
|
990
|
+
ie.current = ie.current.slice(e + 1);
|
|
991
|
+
const n = jt(t);
|
|
992
|
+
n && Ht(n);
|
|
847
993
|
}
|
|
848
|
-
},
|
|
849
|
-
if (
|
|
850
|
-
if (e.includes(
|
|
851
|
-
const t = e.indexOf(
|
|
852
|
-
|
|
853
|
-
} else e ===
|
|
854
|
-
else if (e.includes(
|
|
855
|
-
const t = e.indexOf(
|
|
856
|
-
|
|
857
|
-
} else if (e ===
|
|
858
|
-
|
|
994
|
+
}, kt = (e) => {
|
|
995
|
+
if (ge.current)
|
|
996
|
+
if (e.includes(Ae)) {
|
|
997
|
+
const t = e.indexOf(Ae), n = e.slice(0, t), i = e.slice(t + Ae.length);
|
|
998
|
+
n && (be.current += n, K((r) => r + n)), ge.current = !1, i && (ie.current += i, at());
|
|
999
|
+
} else e === Ae ? ge.current = !1 : (be.current += e, K((t) => t + e));
|
|
1000
|
+
else if (e.includes(Ae)) {
|
|
1001
|
+
const t = e.indexOf(Ae), n = e.slice(0, t), i = e.slice(t + Ae.length);
|
|
1002
|
+
ie.current += n, at(), ge.current = !0, i && (be.current += i, K((r) => r + i));
|
|
1003
|
+
} else if (e === Ae) {
|
|
1004
|
+
ge.current = !0;
|
|
859
1005
|
return;
|
|
860
1006
|
} else
|
|
861
|
-
|
|
1007
|
+
ie.current += e, at();
|
|
862
1008
|
};
|
|
863
|
-
|
|
1009
|
+
W(() => {
|
|
864
1010
|
(async () => {
|
|
865
1011
|
if (!sessionStorage.getItem(
|
|
866
1012
|
"STREAMOJI_LEADS_SESSION_LEAD_ID"
|
|
867
1013
|
)) {
|
|
868
|
-
const
|
|
1014
|
+
const r = "secret", c = Math.floor(Date.now() / 1e3).toString();
|
|
869
1015
|
try {
|
|
870
|
-
const
|
|
1016
|
+
const p = new TextEncoder(), _ = await crypto.subtle.importKey(
|
|
871
1017
|
"raw",
|
|
872
|
-
|
|
1018
|
+
p.encode(r),
|
|
873
1019
|
{ name: "HMAC", hash: "SHA-256" },
|
|
874
1020
|
!1,
|
|
875
1021
|
["sign"]
|
|
876
1022
|
), v = await crypto.subtle.sign(
|
|
877
1023
|
"HMAC",
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
),
|
|
881
|
-
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",
|
|
882
|
-
} catch (
|
|
883
|
-
console.error("[SESSION] HMAC generation failed:",
|
|
884
|
-
const
|
|
885
|
-
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",
|
|
1024
|
+
_,
|
|
1025
|
+
p.encode(c)
|
|
1026
|
+
), w = Array.from(new Uint8Array(v)).map((A) => A.toString(16).padStart(2, "0")).join("");
|
|
1027
|
+
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", w), B("[SESSION] New HMAC UID generated and saved:", w);
|
|
1028
|
+
} catch (p) {
|
|
1029
|
+
console.error("[SESSION] HMAC generation failed:", p);
|
|
1030
|
+
const _ = Math.random().toString(36) + Date.now().toString();
|
|
1031
|
+
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", _);
|
|
886
1032
|
}
|
|
887
1033
|
}
|
|
888
|
-
const
|
|
1034
|
+
const n = sessionStorage.getItem("STREAMOJI_LEADS_SESSION_MESSAGES");
|
|
889
1035
|
let i = [];
|
|
890
|
-
if (
|
|
1036
|
+
if (n)
|
|
891
1037
|
try {
|
|
892
|
-
i = JSON.parse(
|
|
1038
|
+
i = JSON.parse(n);
|
|
893
1039
|
} catch {
|
|
894
1040
|
i = [];
|
|
895
1041
|
}
|
|
896
|
-
i.length === 0 &&
|
|
1042
|
+
i.length === 0 && S && (S.name || S.email) ? (i = [{ role: "user", content: `PRESET_USER_DETAILS: Name is "${S.name || ""}" , Email is "${S.email || ""}"` }], sessionStorage.setItem(
|
|
897
1043
|
"STREAMOJI_LEADS_SESSION_MESSAGES",
|
|
898
1044
|
JSON.stringify(i)
|
|
899
|
-
)) :
|
|
1045
|
+
)) : n || sessionStorage.setItem(
|
|
900
1046
|
"STREAMOJI_LEADS_SESSION_MESSAGES",
|
|
901
1047
|
JSON.stringify([])
|
|
902
1048
|
);
|
|
903
1049
|
})();
|
|
904
|
-
}, [
|
|
1050
|
+
}, [S]), W(() => {
|
|
905
1051
|
const e = () => {
|
|
906
|
-
|
|
1052
|
+
vt.current = Date.now(), Je.current && (Je.current = !1, qe(!1), Me([]), Se(""), K(""), k(!1));
|
|
907
1053
|
};
|
|
908
1054
|
window.addEventListener("mousemove", e), window.addEventListener("keydown", e), window.addEventListener("mousedown", e), window.addEventListener("touchstart", e);
|
|
909
1055
|
const t = setInterval(async () => {
|
|
910
|
-
if (Date.now() -
|
|
911
|
-
if (
|
|
912
|
-
|
|
1056
|
+
if (Date.now() - vt.current >= 3e4 && !ee && !Q && j === "Ready" && !Je.current)
|
|
1057
|
+
if (Je.current = !0, st.current.length > 0)
|
|
1058
|
+
qe(!0), Me(st.current);
|
|
913
1059
|
else
|
|
914
1060
|
try {
|
|
915
|
-
const
|
|
1061
|
+
const r = `${Ye}/nudgeUser`, c = {
|
|
916
1062
|
navigationUrl: window.location.href,
|
|
917
|
-
token:
|
|
918
|
-
},
|
|
1063
|
+
token: I
|
|
1064
|
+
}, p = await fetch(r, {
|
|
919
1065
|
method: "POST",
|
|
920
1066
|
headers: {
|
|
921
1067
|
"Content-Type": "application/json"
|
|
922
1068
|
},
|
|
923
1069
|
body: JSON.stringify(c)
|
|
924
1070
|
});
|
|
925
|
-
if (
|
|
926
|
-
const v = (await
|
|
927
|
-
v && v.length > 0 && (
|
|
1071
|
+
if (p.ok) {
|
|
1072
|
+
const v = (await p.json()).nudge_questions;
|
|
1073
|
+
v && v.length > 0 && (B("[NUDGE] Received nudge questions from API:", v), st.current = v, qe(!0), Me(v));
|
|
928
1074
|
}
|
|
929
|
-
} catch (
|
|
930
|
-
console.error("[NUDGE] Error calling /nudgeUser:",
|
|
1075
|
+
} catch (r) {
|
|
1076
|
+
console.error("[NUDGE] Error calling /nudgeUser:", r), Je.current = !1;
|
|
931
1077
|
}
|
|
932
1078
|
}, 1e3);
|
|
933
1079
|
return () => {
|
|
934
1080
|
window.removeEventListener("mousemove", e), window.removeEventListener("keydown", e), window.removeEventListener("mousedown", e), window.removeEventListener("touchstart", e), clearInterval(t);
|
|
935
1081
|
};
|
|
936
|
-
}, [
|
|
937
|
-
if (
|
|
938
|
-
let e = 0, t = 0,
|
|
939
|
-
const
|
|
940
|
-
const c =
|
|
941
|
-
if (
|
|
942
|
-
const
|
|
943
|
-
|
|
1082
|
+
}, [I, ee, Q, j]), W(() => {
|
|
1083
|
+
if (Te.length === 0) return;
|
|
1084
|
+
let e = 0, t = 0, n = !1, i = 100;
|
|
1085
|
+
const r = () => {
|
|
1086
|
+
const c = Te[e];
|
|
1087
|
+
if (n) {
|
|
1088
|
+
const p = c.substring(0, t - 1);
|
|
1089
|
+
Se(p), t--, i = 50;
|
|
944
1090
|
} else {
|
|
945
|
-
const
|
|
946
|
-
|
|
1091
|
+
const p = c.substring(0, t + 1);
|
|
1092
|
+
Se(p), t++, i = 100;
|
|
947
1093
|
}
|
|
948
|
-
!
|
|
1094
|
+
!n && t === c.length ? (n = !0, i = 3e3) : n && t === 0 && (n = !1, e = (e + 1) % Te.length, i = 500), D.current = setTimeout(r, i);
|
|
949
1095
|
};
|
|
950
|
-
return
|
|
951
|
-
|
|
1096
|
+
return r(), () => {
|
|
1097
|
+
D.current && clearTimeout(D.current);
|
|
952
1098
|
};
|
|
953
|
-
}, [
|
|
954
|
-
const
|
|
1099
|
+
}, [Te]);
|
|
1100
|
+
const Rt = () => {
|
|
955
1101
|
try {
|
|
956
1102
|
return JSON.parse(
|
|
957
1103
|
sessionStorage.getItem("STREAMOJI_LEADS_SESSION_MESSAGES") || "[]"
|
|
@@ -959,232 +1105,232 @@ const Ln = ({
|
|
|
959
1105
|
} catch {
|
|
960
1106
|
return [];
|
|
961
1107
|
}
|
|
962
|
-
},
|
|
1108
|
+
}, qt = (e) => {
|
|
963
1109
|
sessionStorage.setItem(
|
|
964
1110
|
"STREAMOJI_LEADS_SESSION_MESSAGES",
|
|
965
1111
|
JSON.stringify(e)
|
|
966
1112
|
);
|
|
967
|
-
}, [
|
|
1113
|
+
}, [ct, ut] = y(!1), [At, lt] = y(0), fe = a(null), et = a([]), Tt = a(0), [Mt, Gt] = y(
|
|
968
1114
|
null
|
|
969
|
-
), [
|
|
1115
|
+
), [zt, dt] = y(
|
|
970
1116
|
null
|
|
971
|
-
),
|
|
1117
|
+
), _e = a(null), Ce = a(
|
|
972
1118
|
null
|
|
973
|
-
),
|
|
974
|
-
e && (
|
|
1119
|
+
), Ge = $e((e = !1) => {
|
|
1120
|
+
e && (xe.current = !0, g(!1), l("Ready")), N.current = [], $.current = [], U.current = !1, k(!1), ye.current = 0, de.current = 0, pe.current = 0, ve.current.forEach((t) => {
|
|
975
1121
|
try {
|
|
976
1122
|
t.stop();
|
|
977
1123
|
} catch {
|
|
978
1124
|
}
|
|
979
|
-
}),
|
|
980
|
-
}, []),
|
|
1125
|
+
}), Be.current && (clearTimeout(Be.current), Be.current = null), z(null), Ke(""), ve.current = [];
|
|
1126
|
+
}, []), Yt = async () => {
|
|
981
1127
|
try {
|
|
982
|
-
const e = await navigator.mediaDevices.getUserMedia({ audio: !0 }), t = window.AudioContext || window.webkitAudioContext,
|
|
983
|
-
|
|
1128
|
+
const e = await navigator.mediaDevices.getUserMedia({ audio: !0 }), t = window.AudioContext || window.webkitAudioContext, n = new t(), i = n.createMediaStreamSource(e), r = n.createAnalyser();
|
|
1129
|
+
r.fftSize = 64, i.connect(r), _e.current = n, Ce.current = i, dt(r);
|
|
984
1130
|
const c = new MediaRecorder(e);
|
|
985
|
-
fe.current = c,
|
|
986
|
-
|
|
1131
|
+
fe.current = c, et.current = [], c.ondataavailable = (p) => {
|
|
1132
|
+
p.data.size > 0 && et.current.push(p.data);
|
|
987
1133
|
}, c.onstop = async () => {
|
|
988
|
-
const
|
|
989
|
-
if (
|
|
990
|
-
|
|
1134
|
+
const p = Date.now() - Tt.current;
|
|
1135
|
+
if (dt(null), Ce.current && (Ce.current.disconnect(), Ce.current = null), _e.current && _e.current.state !== "closed" && (_e.current.close(), _e.current = null), p < 1e3) {
|
|
1136
|
+
l("Recording too short. Hold or click longer."), g(!1);
|
|
991
1137
|
return;
|
|
992
1138
|
}
|
|
993
|
-
const
|
|
1139
|
+
const _ = new Blob(et.current, {
|
|
994
1140
|
type: "audio/wav"
|
|
995
1141
|
});
|
|
996
|
-
await
|
|
997
|
-
},
|
|
1142
|
+
await Zt(_);
|
|
1143
|
+
}, Tt.current = Date.now(), c.start(100), ut(!0), l("Listening...");
|
|
998
1144
|
} catch (e) {
|
|
999
|
-
console.error("Error accessing microphone:", e),
|
|
1145
|
+
console.error("Error accessing microphone:", e), l("Mic Access Error");
|
|
1000
1146
|
}
|
|
1001
|
-
},
|
|
1002
|
-
fe.current && fe.current.state !== "inactive" && (fe.current.stop(), fe.current.stream.getTracks().forEach((e) => e.stop()),
|
|
1003
|
-
},
|
|
1004
|
-
fe.current && fe.current.state !== "inactive" && (fe.current.onstop = null, fe.current.stop(), fe.current.stream.getTracks().forEach((e) => e.stop()),
|
|
1147
|
+
}, Kt = () => {
|
|
1148
|
+
fe.current && fe.current.state !== "inactive" && (fe.current.stop(), fe.current.stream.getTracks().forEach((e) => e.stop()), ut(!1));
|
|
1149
|
+
}, Qt = () => {
|
|
1150
|
+
fe.current && fe.current.state !== "inactive" && (fe.current.onstop = null, fe.current.stop(), fe.current.stream.getTracks().forEach((e) => e.stop()), dt(null), Ce.current && (Ce.current.disconnect(), Ce.current = null), _e.current && _e.current.state !== "closed" && (_e.current.close(), _e.current = null), ut(!1), et.current = [], l("Ready"));
|
|
1005
1151
|
};
|
|
1006
|
-
|
|
1007
|
-
if (!
|
|
1152
|
+
W(() => {
|
|
1153
|
+
if (!ee) return;
|
|
1008
1154
|
const e = () => {
|
|
1009
|
-
const t =
|
|
1155
|
+
const t = pe.current;
|
|
1010
1156
|
if (t <= 0) return;
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
const
|
|
1014
|
-
if (
|
|
1157
|
+
const n = O.current, i = ye.current;
|
|
1158
|
+
if (!n) return;
|
|
1159
|
+
const r = n.currentTime - i, c = Math.min(Math.max(0, r), t), _ = Wt(we).trim().length;
|
|
1160
|
+
if (_ <= 0) return;
|
|
1015
1161
|
const v = Math.min(
|
|
1016
|
-
Math.round(c / t *
|
|
1017
|
-
|
|
1162
|
+
Math.round(c / t * _),
|
|
1163
|
+
_
|
|
1018
1164
|
);
|
|
1019
1165
|
u(v);
|
|
1020
1166
|
};
|
|
1021
1167
|
return clearInterval(s.current ?? void 0), s.current = setInterval(e, 90), () => clearInterval(s.current ?? void 0);
|
|
1022
|
-
}, [
|
|
1168
|
+
}, [ee, we, pe.current]), W(() => {
|
|
1023
1169
|
let e;
|
|
1024
|
-
return
|
|
1025
|
-
|
|
1026
|
-
}, 1e3)) :
|
|
1027
|
-
}, [
|
|
1028
|
-
const
|
|
1029
|
-
const t = e.numberOfChannels,
|
|
1170
|
+
return ct ? (lt(0), e = window.setInterval(() => {
|
|
1171
|
+
lt((t) => t + 1);
|
|
1172
|
+
}, 1e3)) : lt(0), () => clearInterval(e);
|
|
1173
|
+
}, [ct]);
|
|
1174
|
+
const Xt = (e) => {
|
|
1175
|
+
const t = e.numberOfChannels, n = e.length * t * 2 + 44, i = new ArrayBuffer(n), r = new DataView(i);
|
|
1030
1176
|
let c = 0;
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
},
|
|
1034
|
-
|
|
1177
|
+
const p = (w) => {
|
|
1178
|
+
r.setUint16(c, w, !0), c += 2;
|
|
1179
|
+
}, _ = (w) => {
|
|
1180
|
+
r.setUint32(c, w, !0), c += 4;
|
|
1035
1181
|
};
|
|
1036
|
-
|
|
1182
|
+
_(1179011410), _(n - 8), _(1163280727), _(544501094), _(16), p(1), p(t), _(e.sampleRate), _(e.sampleRate * 2 * t), p(t * 2), p(16), _(1635017060), _(n - c - 4);
|
|
1037
1183
|
const v = [];
|
|
1038
|
-
for (let
|
|
1039
|
-
let
|
|
1040
|
-
for (; c <
|
|
1041
|
-
for (let
|
|
1042
|
-
let
|
|
1043
|
-
|
|
1184
|
+
for (let w = 0; w < t; w++) v.push(e.getChannelData(w));
|
|
1185
|
+
let L = 0;
|
|
1186
|
+
for (; c < n; ) {
|
|
1187
|
+
for (let w = 0; w < t; w++) {
|
|
1188
|
+
let A = Math.max(-1, Math.min(1, v[w][L]));
|
|
1189
|
+
A = A < 0 ? A * 32768 : A * 32767, r.setInt16(c, A, !0), c += 2;
|
|
1044
1190
|
}
|
|
1045
|
-
|
|
1191
|
+
L++;
|
|
1046
1192
|
}
|
|
1047
1193
|
return new Blob([i], { type: "audio/wav" });
|
|
1048
|
-
},
|
|
1049
|
-
if (!
|
|
1050
|
-
if (
|
|
1051
|
-
|
|
1194
|
+
}, ht = async (e, t, n = !1) => {
|
|
1195
|
+
if (!xe.current) {
|
|
1196
|
+
if (V.current) {
|
|
1197
|
+
$.current.push({
|
|
1052
1198
|
audio: e,
|
|
1053
1199
|
visemes: t,
|
|
1054
|
-
isNewSegment:
|
|
1200
|
+
isNewSegment: n
|
|
1055
1201
|
});
|
|
1056
1202
|
return;
|
|
1057
1203
|
}
|
|
1058
|
-
|
|
1204
|
+
V.current = !0;
|
|
1059
1205
|
try {
|
|
1060
|
-
const i = window.AudioContext || window.webkitAudioContext,
|
|
1061
|
-
|
|
1062
|
-
const c = window.atob(e),
|
|
1063
|
-
for (let
|
|
1064
|
-
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
const v =
|
|
1068
|
-
let
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1073
|
-
let G =
|
|
1074
|
-
if ((!G || G.context !==
|
|
1075
|
-
|
|
1206
|
+
const i = window.AudioContext || window.webkitAudioContext, r = O.current ?? new i();
|
|
1207
|
+
r.state === "suspended" && await r.resume(), O.current = r;
|
|
1208
|
+
const c = window.atob(e), p = new Uint8Array(c.length);
|
|
1209
|
+
for (let P = 0; P < c.length; P++)
|
|
1210
|
+
p[P] = c.charCodeAt(P);
|
|
1211
|
+
const _ = await r.decodeAudioData(p.buffer.slice(0));
|
|
1212
|
+
pe.current += _.duration;
|
|
1213
|
+
const v = r.currentTime;
|
|
1214
|
+
let L = de.current;
|
|
1215
|
+
const w = !U.current;
|
|
1216
|
+
L < v && (L = v + 0.1), de.current = L + _.duration;
|
|
1217
|
+
const A = r.createBufferSource();
|
|
1218
|
+
A.buffer = _;
|
|
1219
|
+
let G = Mt;
|
|
1220
|
+
if ((!G || G.context !== r) && (G = r.createAnalyser(), G.fftSize = 64, G.connect(r.destination), Gt(G)), A.connect(G), ve.current.push(A), xe.current) {
|
|
1221
|
+
ve.current = ve.current.filter((P) => P !== A);
|
|
1076
1222
|
return;
|
|
1077
1223
|
}
|
|
1078
|
-
if (
|
|
1079
|
-
|
|
1080
|
-
`[AUDIO] setIsSpeaking(true) - First chunk starting at ${
|
|
1224
|
+
if (w) {
|
|
1225
|
+
U.current = !0, k(!0), B(
|
|
1226
|
+
`[AUDIO] setIsSpeaking(true) - First chunk starting at ${L.toFixed(
|
|
1081
1227
|
3
|
|
1082
1228
|
)}`
|
|
1083
|
-
),
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
`[AUDIO] Response started. Initial startTime: ${
|
|
1229
|
+
), ye.current = L;
|
|
1230
|
+
const P = (L - v) * 1e3;
|
|
1231
|
+
Ee.current = performance.now() + P, B(
|
|
1232
|
+
`[AUDIO] Response started. Initial startTime: ${L.toFixed(
|
|
1087
1233
|
3
|
|
1088
1234
|
)}, CT: ${v.toFixed(3)}`
|
|
1089
1235
|
);
|
|
1090
1236
|
}
|
|
1091
|
-
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
`[AUDIO] New segment detected at +${
|
|
1237
|
+
A.start(L);
|
|
1238
|
+
const Z = (L - ye.current) * 1e3;
|
|
1239
|
+
n && (He.current = Z, B(
|
|
1240
|
+
`[AUDIO] New segment detected at +${Z.toFixed(
|
|
1095
1241
|
0
|
|
1096
1242
|
)}ms. Resetting segment offset.`
|
|
1097
|
-
)), t.forEach((
|
|
1098
|
-
const
|
|
1099
|
-
if (
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
`[AUDIO] Viseme "${
|
|
1243
|
+
)), t.forEach((P, ce) => {
|
|
1244
|
+
const C = P.symbol ?? "";
|
|
1245
|
+
if (C) {
|
|
1246
|
+
const ue = En(C), me = Math.round(P.start * 1e3), Fe = Math.round((P.duration ?? 0) * 1e3), Ft = He.current + me;
|
|
1247
|
+
ce < 3 && B(
|
|
1248
|
+
`[AUDIO] Viseme "${C}": segment_relative=${me}ms, segment_offset=${He.current.toFixed(
|
|
1103
1249
|
0
|
|
1104
|
-
)}ms => vtime=${
|
|
1105
|
-
),
|
|
1106
|
-
|
|
1107
|
-
viseme:
|
|
1108
|
-
weight:
|
|
1109
|
-
vtime:
|
|
1110
|
-
vduration:
|
|
1250
|
+
)}ms => vtime=${Ft}ms`
|
|
1251
|
+
), ue.forEach((Ut) => {
|
|
1252
|
+
N.current.push({
|
|
1253
|
+
viseme: Ut.v,
|
|
1254
|
+
weight: Ut.w,
|
|
1255
|
+
vtime: Ft,
|
|
1256
|
+
vduration: Fe
|
|
1111
1257
|
});
|
|
1112
1258
|
});
|
|
1113
1259
|
}
|
|
1114
|
-
}),
|
|
1260
|
+
}), l("Speaking...");
|
|
1115
1261
|
} finally {
|
|
1116
|
-
if (
|
|
1117
|
-
const i =
|
|
1118
|
-
i &&
|
|
1262
|
+
if (V.current = !1, $.current.length > 0) {
|
|
1263
|
+
const i = $.current.shift();
|
|
1264
|
+
i && ht(i.audio, i.visemes, i.isNewSegment);
|
|
1119
1265
|
}
|
|
1120
1266
|
}
|
|
1121
1267
|
}
|
|
1122
|
-
},
|
|
1268
|
+
}, Zt = async (e) => {
|
|
1123
1269
|
try {
|
|
1124
|
-
|
|
1125
|
-
const t = await e.arrayBuffer(), i = await new (window.AudioContext || window.webkitAudioContext)().decodeAudioData(t),
|
|
1126
|
-
c.readAsDataURL(
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
)}`, v = await fetch(
|
|
1270
|
+
g(!0), qe(!1), be.current = "", K(""), l("Processing Voice...");
|
|
1271
|
+
const t = await e.arrayBuffer(), i = await new (window.AudioContext || window.webkitAudioContext)().decodeAudioData(t), r = Xt(i), c = new FileReader();
|
|
1272
|
+
c.readAsDataURL(r), c.onloadend = async () => {
|
|
1273
|
+
const p = c.result.split(",")[1];
|
|
1274
|
+
Ge(), R(""), ie.current = "", ge.current = !1;
|
|
1275
|
+
const _ = `${Ye}/stt?token=${encodeURIComponent(
|
|
1276
|
+
I
|
|
1277
|
+
)}`, v = await fetch(_, {
|
|
1132
1278
|
method: "POST",
|
|
1133
1279
|
headers: { "Content-Type": "application/json" },
|
|
1134
1280
|
body: JSON.stringify({
|
|
1135
|
-
audio_base64:
|
|
1281
|
+
audio_base64: p,
|
|
1136
1282
|
audio_format: "wav"
|
|
1137
1283
|
})
|
|
1138
1284
|
});
|
|
1139
1285
|
if (v.status === 429) {
|
|
1140
1286
|
try {
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1287
|
+
const ce = await v.text(), C = JSON.parse(ce);
|
|
1288
|
+
B("[STT] 429 agent at capacity:", C?.detail);
|
|
1143
1289
|
} catch {
|
|
1144
1290
|
}
|
|
1145
|
-
|
|
1291
|
+
R(""), l("Busy"), g(!1);
|
|
1146
1292
|
return;
|
|
1147
1293
|
}
|
|
1148
1294
|
if (!v.ok) {
|
|
1149
|
-
const
|
|
1150
|
-
let
|
|
1295
|
+
const ce = await v.text();
|
|
1296
|
+
let C = "STT Failed";
|
|
1151
1297
|
try {
|
|
1152
|
-
|
|
1298
|
+
C = JSON.parse(ce).error || C;
|
|
1153
1299
|
} catch {
|
|
1154
|
-
|
|
1300
|
+
ce && (C = ce.slice(0, 200));
|
|
1155
1301
|
}
|
|
1156
|
-
throw new Error(
|
|
1302
|
+
throw new Error(C);
|
|
1157
1303
|
}
|
|
1158
|
-
const
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1304
|
+
const L = v.body;
|
|
1305
|
+
if (B("this is body" + L), !L) {
|
|
1306
|
+
l("STT Failed"), g(!1);
|
|
1161
1307
|
return;
|
|
1162
1308
|
}
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1165
|
-
const
|
|
1166
|
-
let G = "",
|
|
1167
|
-
const
|
|
1168
|
-
switch (
|
|
1309
|
+
const w = L.getReader();
|
|
1310
|
+
xe.current = !1;
|
|
1311
|
+
const A = new TextDecoder();
|
|
1312
|
+
let G = "", Z = !1;
|
|
1313
|
+
const P = async (ce, C) => {
|
|
1314
|
+
switch (ce) {
|
|
1169
1315
|
case "transcript":
|
|
1170
|
-
|
|
1316
|
+
C.transcript != null && R(String(C.transcript));
|
|
1171
1317
|
break;
|
|
1172
1318
|
case "text": {
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1319
|
+
const ue = C.delta ?? C.text ?? "";
|
|
1320
|
+
ue && kt(ue);
|
|
1175
1321
|
break;
|
|
1176
1322
|
}
|
|
1177
1323
|
case "audio": {
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1324
|
+
const ue = C.chunk, me = C.visemes ?? [], Fe = !!C.is_new_segment;
|
|
1325
|
+
ue && await ht(ue, me, Fe);
|
|
1180
1326
|
break;
|
|
1181
1327
|
}
|
|
1182
1328
|
case "done": {
|
|
1183
|
-
|
|
1329
|
+
Z = !0, l("Ready"), g(!1);
|
|
1184
1330
|
break;
|
|
1185
1331
|
}
|
|
1186
1332
|
case "error": {
|
|
1187
|
-
|
|
1333
|
+
Z = !0, l("STT Failed"), g(!1);
|
|
1188
1334
|
break;
|
|
1189
1335
|
}
|
|
1190
1336
|
default:
|
|
@@ -1192,169 +1338,226 @@ const Ln = ({
|
|
|
1192
1338
|
}
|
|
1193
1339
|
};
|
|
1194
1340
|
for (; ; ) {
|
|
1195
|
-
const { done:
|
|
1196
|
-
|
|
1197
|
-
const
|
|
1341
|
+
const { done: ce, value: C } = await w.read();
|
|
1342
|
+
C && (G += A.decode(C, { stream: !0 }));
|
|
1343
|
+
const ue = G.split(`
|
|
1198
1344
|
|
|
1199
1345
|
`);
|
|
1200
|
-
G =
|
|
1201
|
-
for (const
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1346
|
+
G = ue.pop() ?? "";
|
|
1347
|
+
for (const me of ue) {
|
|
1348
|
+
const Fe = Ve(me);
|
|
1349
|
+
Fe && await P(Fe.event, Fe.data);
|
|
1204
1350
|
}
|
|
1205
|
-
if (
|
|
1351
|
+
if (ce) {
|
|
1206
1352
|
if (G.trim()) {
|
|
1207
|
-
const
|
|
1208
|
-
|
|
1353
|
+
const me = Ve(G.trim());
|
|
1354
|
+
me && await P(me.event, me.data);
|
|
1209
1355
|
}
|
|
1210
|
-
|
|
1356
|
+
Z || (l("Ready"), g(!1));
|
|
1211
1357
|
break;
|
|
1212
1358
|
}
|
|
1213
1359
|
}
|
|
1214
1360
|
};
|
|
1215
1361
|
} catch (t) {
|
|
1216
|
-
console.error("Audio Submission Error:", t),
|
|
1362
|
+
console.error("Audio Submission Error:", t), l("STT Failed"), g(!1);
|
|
1217
1363
|
}
|
|
1218
|
-
},
|
|
1219
|
-
e && e.preventDefault(),
|
|
1220
|
-
},
|
|
1364
|
+
}, en = async (e) => {
|
|
1365
|
+
e && e.preventDefault(), qe(!1), be.current = "", K(""), !(!se || Q) && await tn(se);
|
|
1366
|
+
}, Ve = (e) => {
|
|
1221
1367
|
const t = e.split(/\r?\n/);
|
|
1222
|
-
let
|
|
1368
|
+
let n = "", i = "";
|
|
1223
1369
|
for (const c of t)
|
|
1224
|
-
c.startsWith("event:") ?
|
|
1225
|
-
if (!
|
|
1226
|
-
let
|
|
1370
|
+
c.startsWith("event:") ? n = c.slice(6).trim() : c.startsWith("data:") && (i = c.slice(5).trim());
|
|
1371
|
+
if (!n) return null;
|
|
1372
|
+
let r = {};
|
|
1227
1373
|
if (i)
|
|
1228
1374
|
try {
|
|
1229
|
-
|
|
1375
|
+
r = JSON.parse(i);
|
|
1230
1376
|
} catch {
|
|
1231
|
-
|
|
1377
|
+
r = { raw: i };
|
|
1232
1378
|
}
|
|
1233
|
-
return { event:
|
|
1234
|
-
},
|
|
1379
|
+
return { event: n, data: r };
|
|
1380
|
+
}, tt = (e, t) => {
|
|
1235
1381
|
switch (e) {
|
|
1236
1382
|
case "connected":
|
|
1237
|
-
|
|
1383
|
+
ie.current = "", ge.current = !1;
|
|
1238
1384
|
break;
|
|
1239
1385
|
case "text": {
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1386
|
+
const n = t.delta ?? "";
|
|
1387
|
+
n && kt(n);
|
|
1242
1388
|
break;
|
|
1243
1389
|
}
|
|
1244
1390
|
case "audio": {
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1391
|
+
const n = t.chunk, i = t.visemes ?? [];
|
|
1392
|
+
n && ht(n, i);
|
|
1247
1393
|
break;
|
|
1248
1394
|
}
|
|
1249
1395
|
case "done": {
|
|
1250
|
-
const
|
|
1251
|
-
...
|
|
1252
|
-
{ role: "user", content:
|
|
1396
|
+
const n = Rt(), i = be.current.trim(), r = [
|
|
1397
|
+
...n,
|
|
1398
|
+
{ role: "user", content: se || "..." },
|
|
1253
1399
|
{ role: "assistant", content: i }
|
|
1254
1400
|
];
|
|
1255
|
-
|
|
1401
|
+
qt(r), Ne.current = [...N.current], l("Ready"), g(!1), R("");
|
|
1256
1402
|
break;
|
|
1257
1403
|
}
|
|
1258
1404
|
case "error": {
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1405
|
+
const n = t.message ?? "Unknown error";
|
|
1406
|
+
be.current = n, K(n), l("Agent Failed"), g(!1);
|
|
1261
1407
|
break;
|
|
1262
1408
|
}
|
|
1263
1409
|
}
|
|
1264
|
-
},
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1410
|
+
}, Et = async (e, t) => {
|
|
1411
|
+
g(!0), l("Thinking..."), be.current = "", ie.current = "", ge.current = !1, Ge(), pe.current = 0, u(0);
|
|
1412
|
+
try {
|
|
1413
|
+
const n = await fetch(e, {
|
|
1414
|
+
method: "POST",
|
|
1415
|
+
headers: { "Content-Type": "application/json" },
|
|
1416
|
+
body: JSON.stringify(t)
|
|
1417
|
+
});
|
|
1418
|
+
if (n.status === 429) {
|
|
1419
|
+
l("Busy"), g(!1);
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
if (!n.ok) throw new Error("Request failed");
|
|
1423
|
+
const i = n.body;
|
|
1424
|
+
if (!i) {
|
|
1425
|
+
l("Failed"), g(!1);
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
const r = i.getReader();
|
|
1429
|
+
xe.current = !1;
|
|
1430
|
+
const c = new TextDecoder();
|
|
1431
|
+
let p = "";
|
|
1432
|
+
for (; ; ) {
|
|
1433
|
+
const { done: _, value: v } = await r.read();
|
|
1434
|
+
v && (p += c.decode(v, { stream: !0 }));
|
|
1435
|
+
const L = p.split(`
|
|
1436
|
+
|
|
1437
|
+
`);
|
|
1438
|
+
p = L.pop() ?? "";
|
|
1439
|
+
for (const w of L) {
|
|
1440
|
+
const A = Ve(w);
|
|
1441
|
+
A && tt(A.event, A.data);
|
|
1442
|
+
}
|
|
1443
|
+
if (_) {
|
|
1444
|
+
if (p.trim()) {
|
|
1445
|
+
const w = Ve(p.trim());
|
|
1446
|
+
w && tt(w.event, w.data);
|
|
1447
|
+
}
|
|
1448
|
+
l("Ready"), g(!1);
|
|
1449
|
+
break;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
} catch (n) {
|
|
1453
|
+
console.error("Streaming Error:", n), l("Failed"), g(!1);
|
|
1454
|
+
}
|
|
1455
|
+
}, It = $e(async (e, t, n) => {
|
|
1456
|
+
const i = `${Ye}/avatar_tts`;
|
|
1457
|
+
await Et(i, { text: e, userQuery: t, llmPrompt: n });
|
|
1458
|
+
}, []), Dt = $e(async (e, t, n, i) => {
|
|
1459
|
+
const r = `${Ye}/avatar_ttsWithKnowledge`;
|
|
1460
|
+
await Et(r, { userQuery: e, llmPrompt: t, knowledge: n, history: i });
|
|
1461
|
+
}, []), Ot = a(!1);
|
|
1462
|
+
W(() => {
|
|
1463
|
+
H && !Ot.current && (H({ avatarSpeak: It, avatarRespond: Dt }), Ot.current = !0);
|
|
1464
|
+
}, [H, It, Dt]);
|
|
1465
|
+
const tn = async (e) => {
|
|
1466
|
+
g(!0), l("Thinking..."), be.current = "", ie.current = "", ge.current = !1, Ge(), pe.current = 0, u(0);
|
|
1467
|
+
const t = `${Ye}/agent/chat?token=${encodeURIComponent(
|
|
1468
|
+
I
|
|
1268
1469
|
)}`;
|
|
1269
1470
|
try {
|
|
1270
|
-
const
|
|
1471
|
+
const n = Rt();
|
|
1271
1472
|
let i = sessionStorage.getItem("STREAMOJI_LEADS_SESSION_LEAD_ID");
|
|
1272
|
-
i || (
|
|
1473
|
+
i || (mn(
|
|
1273
1474
|
"[CHAT] Session UID missing at send time! Generating emergency backup."
|
|
1274
1475
|
), i = "emergency-" + Math.random().toString(36).substring(7), sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", i));
|
|
1275
|
-
const
|
|
1276
|
-
history:
|
|
1476
|
+
const r = {
|
|
1477
|
+
history: n,
|
|
1277
1478
|
question: e,
|
|
1278
1479
|
lead_id: i
|
|
1279
1480
|
};
|
|
1280
|
-
|
|
1481
|
+
B("[CHAT] Sending payload:", r);
|
|
1281
1482
|
const c = await fetch(t, {
|
|
1282
1483
|
method: "POST",
|
|
1283
1484
|
headers: {
|
|
1284
1485
|
"Content-Type": "application/json"
|
|
1285
1486
|
},
|
|
1286
|
-
body: JSON.stringify(
|
|
1487
|
+
body: JSON.stringify(r),
|
|
1287
1488
|
cache: "default"
|
|
1288
1489
|
});
|
|
1289
1490
|
if (c.status === 429) {
|
|
1290
1491
|
try {
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1492
|
+
const w = await c.json();
|
|
1493
|
+
B("[CHAT] 429 agent at capacity:", w?.detail);
|
|
1293
1494
|
} catch {
|
|
1294
1495
|
}
|
|
1295
|
-
|
|
1496
|
+
R(""), l("Busy"), g(!1);
|
|
1296
1497
|
return;
|
|
1297
1498
|
}
|
|
1298
1499
|
if (!c.ok)
|
|
1299
1500
|
throw new Error("Agent request failed");
|
|
1300
|
-
const
|
|
1301
|
-
if (!
|
|
1302
|
-
|
|
1501
|
+
const p = c.body;
|
|
1502
|
+
if (!p) {
|
|
1503
|
+
l("Agent Failed"), g(!1);
|
|
1303
1504
|
return;
|
|
1304
1505
|
}
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1506
|
+
const _ = p.getReader();
|
|
1507
|
+
xe.current = !1;
|
|
1307
1508
|
const v = new TextDecoder();
|
|
1308
|
-
let
|
|
1509
|
+
let L = "";
|
|
1309
1510
|
for (; ; ) {
|
|
1310
|
-
const { done:
|
|
1311
|
-
|
|
1312
|
-
`[SSE] Chunk received. done=${
|
|
1313
|
-
),
|
|
1314
|
-
const G =
|
|
1511
|
+
const { done: w, value: A } = await _.read();
|
|
1512
|
+
B(
|
|
1513
|
+
`[SSE] Chunk received. done=${w}, length=${A?.length || 0}`
|
|
1514
|
+
), A && (L += v.decode(A, { stream: !0 }));
|
|
1515
|
+
const G = L.split(`
|
|
1315
1516
|
|
|
1316
1517
|
`);
|
|
1317
|
-
|
|
1318
|
-
for (const
|
|
1319
|
-
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1518
|
+
L = G.pop() ?? "";
|
|
1519
|
+
for (const Z of G) {
|
|
1520
|
+
B(`[SSE] Processing block: ${Z.slice(0, 50)}...`);
|
|
1521
|
+
const P = Ve(Z);
|
|
1522
|
+
P && (B(`[SSE] Event: ${P.event}`), tt(P.event, P.data));
|
|
1322
1523
|
}
|
|
1323
|
-
if (
|
|
1324
|
-
if (
|
|
1325
|
-
const
|
|
1326
|
-
|
|
1524
|
+
if (w) {
|
|
1525
|
+
if (B("[SSE] Stream finished"), L.trim()) {
|
|
1526
|
+
const Z = Ve(L.trim());
|
|
1527
|
+
Z && tt(Z.event, Z.data);
|
|
1327
1528
|
}
|
|
1328
|
-
|
|
1529
|
+
l("Ready"), g(!1), R("");
|
|
1329
1530
|
break;
|
|
1330
1531
|
}
|
|
1331
1532
|
}
|
|
1332
|
-
} catch (
|
|
1333
|
-
console.error("Chat Error:",
|
|
1533
|
+
} catch (n) {
|
|
1534
|
+
console.error("Chat Error:", n), l("Agent Failed"), g(!1);
|
|
1334
1535
|
}
|
|
1335
|
-
},
|
|
1536
|
+
}, nn = we.trim(), Ct = Wt(nn), ft = Ct && ee ? Ct.slice(
|
|
1336
1537
|
0,
|
|
1337
|
-
|
|
1538
|
+
m != null && m > 0 ? m : 0
|
|
1338
1539
|
) : "";
|
|
1339
|
-
|
|
1340
|
-
const e =
|
|
1341
|
-
e !== "exiting" && (
|
|
1342
|
-
}, [
|
|
1343
|
-
const
|
|
1344
|
-
const e =
|
|
1345
|
-
e === "entering" ?
|
|
1540
|
+
W(() => {
|
|
1541
|
+
const e = it.current;
|
|
1542
|
+
e !== "exiting" && (ft ? (Vt(ft), e === "hidden" && Xe("entering")) : (e === "visible" || e === "entering") && Xe("exiting"));
|
|
1543
|
+
}, [ft, he]);
|
|
1544
|
+
const rn = $e(() => {
|
|
1545
|
+
const e = it.current;
|
|
1546
|
+
e === "entering" ? Xe("visible") : e === "exiting" && Xe("hidden");
|
|
1346
1547
|
}, []);
|
|
1347
|
-
|
|
1348
|
-
const e =
|
|
1548
|
+
dn(() => {
|
|
1549
|
+
const e = wt.current;
|
|
1349
1550
|
e && (e.scrollTop = e.scrollHeight);
|
|
1350
|
-
}, [
|
|
1551
|
+
}, [St]);
|
|
1552
|
+
const sn = b === "female" ? kn : Ln;
|
|
1553
|
+
return /* @__PURE__ */ le("div", { className: "avatar-widget-container", children: [
|
|
1351
1554
|
/* @__PURE__ */ le("div", { className: "avatar-input-area", children: [
|
|
1352
|
-
|
|
1555
|
+
oe !== "hidden" ? /* @__PURE__ */ d(
|
|
1353
1556
|
"div",
|
|
1354
1557
|
{
|
|
1355
|
-
className: `avatar-thinking-tab${
|
|
1356
|
-
onAnimationEnd:
|
|
1357
|
-
children:
|
|
1558
|
+
className: `avatar-thinking-tab${oe === "exiting" ? " avatar-thinking-tab--exiting" : oe === "entering" ? " avatar-thinking-tab--entering" : ""}`,
|
|
1559
|
+
onAnimationEnd: $t,
|
|
1560
|
+
children: Le === Bt ? /* @__PURE__ */ d(
|
|
1358
1561
|
"a",
|
|
1359
1562
|
{
|
|
1360
1563
|
href: "https://leads.streamoji.com",
|
|
@@ -1362,10 +1565,10 @@ const Ln = ({
|
|
|
1362
1565
|
rel: "noopener noreferrer",
|
|
1363
1566
|
children: "Made by Streamoji Leads"
|
|
1364
1567
|
}
|
|
1365
|
-
) :
|
|
1568
|
+
) : Le
|
|
1366
1569
|
}
|
|
1367
1570
|
) : null,
|
|
1368
|
-
/* @__PURE__ */
|
|
1571
|
+
/* @__PURE__ */ d("div", { className: "avatar-input-container", children: /* @__PURE__ */ d(
|
|
1369
1572
|
"div",
|
|
1370
1573
|
{
|
|
1371
1574
|
style: {
|
|
@@ -1374,13 +1577,13 @@ const Ln = ({
|
|
|
1374
1577
|
width: "100%",
|
|
1375
1578
|
height: "100%"
|
|
1376
1579
|
},
|
|
1377
|
-
children:
|
|
1378
|
-
/* @__PURE__ */
|
|
1580
|
+
children: ct ? /* @__PURE__ */ le("div", { className: "avatar-input-recording", children: [
|
|
1581
|
+
/* @__PURE__ */ d(
|
|
1379
1582
|
"button",
|
|
1380
1583
|
{
|
|
1381
1584
|
type: "button",
|
|
1382
1585
|
className: "avatar-recording-cancel",
|
|
1383
|
-
onClick:
|
|
1586
|
+
onClick: Qt,
|
|
1384
1587
|
title: "Cancel",
|
|
1385
1588
|
children: /* @__PURE__ */ le(
|
|
1386
1589
|
"svg",
|
|
@@ -1395,8 +1598,8 @@ const Ln = ({
|
|
|
1395
1598
|
strokeLinejoin: "round",
|
|
1396
1599
|
style: { display: "block" },
|
|
1397
1600
|
children: [
|
|
1398
|
-
/* @__PURE__ */
|
|
1399
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ d("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1602
|
+
/* @__PURE__ */ d("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1400
1603
|
]
|
|
1401
1604
|
}
|
|
1402
1605
|
)
|
|
@@ -1414,7 +1617,7 @@ const Ln = ({
|
|
|
1414
1617
|
minWidth: 0
|
|
1415
1618
|
},
|
|
1416
1619
|
children: [
|
|
1417
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ d("div", { style: { flex: 1, height: "100%" }, children: /* @__PURE__ */ d(Nt, { analyser: zt }) }),
|
|
1418
1621
|
/* @__PURE__ */ le(
|
|
1419
1622
|
"span",
|
|
1420
1623
|
{
|
|
@@ -1428,23 +1631,23 @@ const Ln = ({
|
|
|
1428
1631
|
fontVariantNumeric: "tabular-nums"
|
|
1429
1632
|
},
|
|
1430
1633
|
children: [
|
|
1431
|
-
Math.floor(
|
|
1634
|
+
Math.floor(At / 60),
|
|
1432
1635
|
":",
|
|
1433
|
-
String(
|
|
1636
|
+
String(At % 60).padStart(2, "0")
|
|
1434
1637
|
]
|
|
1435
1638
|
}
|
|
1436
1639
|
)
|
|
1437
1640
|
]
|
|
1438
1641
|
}
|
|
1439
1642
|
),
|
|
1440
|
-
/* @__PURE__ */
|
|
1643
|
+
/* @__PURE__ */ d(
|
|
1441
1644
|
"button",
|
|
1442
1645
|
{
|
|
1443
1646
|
type: "button",
|
|
1444
1647
|
className: "avatar-recording-confirm",
|
|
1445
|
-
onClick:
|
|
1648
|
+
onClick: Kt,
|
|
1446
1649
|
title: "Send",
|
|
1447
|
-
children: /* @__PURE__ */
|
|
1650
|
+
children: /* @__PURE__ */ d(
|
|
1448
1651
|
"svg",
|
|
1449
1652
|
{
|
|
1450
1653
|
width: "18",
|
|
@@ -1456,13 +1659,13 @@ const Ln = ({
|
|
|
1456
1659
|
strokeLinecap: "round",
|
|
1457
1660
|
strokeLinejoin: "round",
|
|
1458
1661
|
style: { display: "block" },
|
|
1459
|
-
children: /* @__PURE__ */
|
|
1662
|
+
children: /* @__PURE__ */ d("polyline", { points: "20 6 9 17 4 12" })
|
|
1460
1663
|
}
|
|
1461
1664
|
)
|
|
1462
1665
|
}
|
|
1463
1666
|
)
|
|
1464
|
-
] }) :
|
|
1465
|
-
/* @__PURE__ */
|
|
1667
|
+
] }) : ee && !ot ? /* @__PURE__ */ le("div", { className: "avatar-input-speaking", children: [
|
|
1668
|
+
/* @__PURE__ */ d(
|
|
1466
1669
|
"div",
|
|
1467
1670
|
{
|
|
1468
1671
|
style: {
|
|
@@ -1472,20 +1675,20 @@ const Ln = ({
|
|
|
1472
1675
|
alignItems: "center",
|
|
1473
1676
|
paddingRight: "8px"
|
|
1474
1677
|
},
|
|
1475
|
-
children: /* @__PURE__ */
|
|
1678
|
+
children: /* @__PURE__ */ d(Nt, { analyser: Mt })
|
|
1476
1679
|
}
|
|
1477
1680
|
),
|
|
1478
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ d(
|
|
1479
1682
|
"button",
|
|
1480
1683
|
{
|
|
1481
1684
|
type: "button",
|
|
1482
1685
|
className: "avatar-speaking-stop",
|
|
1483
|
-
onClick: () =>
|
|
1686
|
+
onClick: () => Ge(!0),
|
|
1484
1687
|
title: "Stop",
|
|
1485
|
-
children: /* @__PURE__ */
|
|
1688
|
+
children: /* @__PURE__ */ d("span", { className: "avatar-speaking-stop__icon", "aria-hidden": !0 })
|
|
1486
1689
|
}
|
|
1487
1690
|
)
|
|
1488
|
-
] }) :
|
|
1691
|
+
] }) : Q ? /* @__PURE__ */ d(
|
|
1489
1692
|
"div",
|
|
1490
1693
|
{
|
|
1491
1694
|
style: {
|
|
@@ -1495,12 +1698,12 @@ const Ln = ({
|
|
|
1495
1698
|
alignItems: "center",
|
|
1496
1699
|
justifyContent: "center"
|
|
1497
1700
|
},
|
|
1498
|
-
children: /* @__PURE__ */
|
|
1701
|
+
children: /* @__PURE__ */ d("div", { className: "avatar-input-loader" })
|
|
1499
1702
|
}
|
|
1500
1703
|
) : /* @__PURE__ */ le(
|
|
1501
1704
|
"form",
|
|
1502
1705
|
{
|
|
1503
|
-
onSubmit:
|
|
1706
|
+
onSubmit: en,
|
|
1504
1707
|
style: {
|
|
1505
1708
|
flex: 1,
|
|
1506
1709
|
display: "flex",
|
|
@@ -1508,20 +1711,20 @@ const Ln = ({
|
|
|
1508
1711
|
alignItems: "center"
|
|
1509
1712
|
},
|
|
1510
1713
|
children: [
|
|
1511
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ d(
|
|
1512
1715
|
"input",
|
|
1513
1716
|
{
|
|
1514
1717
|
id: "avatar-text-input",
|
|
1515
1718
|
type: "text",
|
|
1516
|
-
value:
|
|
1517
|
-
onChange: (e) =>
|
|
1518
|
-
placeholder:
|
|
1519
|
-
disabled:
|
|
1719
|
+
value: se,
|
|
1720
|
+
onChange: (e) => R(e.target.value),
|
|
1721
|
+
placeholder: j === "Busy" ? "Assisting another user" : te || "Ask me anything",
|
|
1722
|
+
disabled: Q || j === "Busy",
|
|
1520
1723
|
autoComplete: "off",
|
|
1521
1724
|
style: { width: "100%", height: "100%" }
|
|
1522
1725
|
}
|
|
1523
1726
|
),
|
|
1524
|
-
|
|
1727
|
+
j === "Busy" ? /* @__PURE__ */ d(
|
|
1525
1728
|
"button",
|
|
1526
1729
|
{
|
|
1527
1730
|
type: "button",
|
|
@@ -1529,7 +1732,7 @@ const Ln = ({
|
|
|
1529
1732
|
disabled: !0,
|
|
1530
1733
|
style: { backgroundColor: "#1e4a5e" },
|
|
1531
1734
|
title: "Agent at capacity",
|
|
1532
|
-
children: /* @__PURE__ */
|
|
1735
|
+
children: /* @__PURE__ */ d(
|
|
1533
1736
|
"svg",
|
|
1534
1737
|
{
|
|
1535
1738
|
width: "24",
|
|
@@ -1538,7 +1741,7 @@ const Ln = ({
|
|
|
1538
1741
|
fill: "none",
|
|
1539
1742
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1540
1743
|
"aria-hidden": "true",
|
|
1541
|
-
children: /* @__PURE__ */
|
|
1744
|
+
children: /* @__PURE__ */ d(
|
|
1542
1745
|
"path",
|
|
1543
1746
|
{
|
|
1544
1747
|
d: "M4 2L20 2L12 10L4 2z M12 14L4 22L20 22L12 14z",
|
|
@@ -1548,13 +1751,13 @@ const Ln = ({
|
|
|
1548
1751
|
}
|
|
1549
1752
|
)
|
|
1550
1753
|
}
|
|
1551
|
-
) :
|
|
1754
|
+
) : se.trim() === "" ? /* @__PURE__ */ d(
|
|
1552
1755
|
"button",
|
|
1553
1756
|
{
|
|
1554
1757
|
type: "button",
|
|
1555
1758
|
className: "mic-button",
|
|
1556
|
-
onClick:
|
|
1557
|
-
disabled:
|
|
1759
|
+
onClick: Yt,
|
|
1760
|
+
disabled: Q,
|
|
1558
1761
|
style: { backgroundColor: "#1e4a5e" },
|
|
1559
1762
|
children: /* @__PURE__ */ le(
|
|
1560
1763
|
"svg",
|
|
@@ -1565,14 +1768,14 @@ const Ln = ({
|
|
|
1565
1768
|
fill: "none",
|
|
1566
1769
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1567
1770
|
children: [
|
|
1568
|
-
/* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ d(
|
|
1569
1772
|
"path",
|
|
1570
1773
|
{
|
|
1571
1774
|
d: "M12 14C13.66 14 15 12.66 15 11V5C15 3.34 13.66 2 12 2C10.34 2 9 3.34 9 5V11C9 12.66 10.34 14 12 14Z",
|
|
1572
1775
|
fill: "white"
|
|
1573
1776
|
}
|
|
1574
1777
|
),
|
|
1575
|
-
/* @__PURE__ */
|
|
1778
|
+
/* @__PURE__ */ d(
|
|
1576
1779
|
"path",
|
|
1577
1780
|
{
|
|
1578
1781
|
d: "M17 11C17 13.76 14.76 16 12 16C9.24 16 7 13.76 7 11H5C5 14.53 7.61 17.43 11 17.93V21H13V17.93C16.39 17.43 19 14.53 19 11H17Z",
|
|
@@ -1583,15 +1786,15 @@ const Ln = ({
|
|
|
1583
1786
|
}
|
|
1584
1787
|
)
|
|
1585
1788
|
}
|
|
1586
|
-
) : /* @__PURE__ */
|
|
1789
|
+
) : /* @__PURE__ */ d(
|
|
1587
1790
|
"button",
|
|
1588
1791
|
{
|
|
1589
1792
|
type: "submit",
|
|
1590
1793
|
className: "mic-button",
|
|
1591
|
-
disabled:
|
|
1794
|
+
disabled: Q,
|
|
1592
1795
|
style: { backgroundColor: "#1e4a5e" },
|
|
1593
1796
|
title: "Send",
|
|
1594
|
-
children: /* @__PURE__ */
|
|
1797
|
+
children: /* @__PURE__ */ d(
|
|
1595
1798
|
"svg",
|
|
1596
1799
|
{
|
|
1597
1800
|
width: 24,
|
|
@@ -1599,7 +1802,7 @@ const Ln = ({
|
|
|
1599
1802
|
viewBox: "0 0 24 24",
|
|
1600
1803
|
fill: "none",
|
|
1601
1804
|
"aria-hidden": "true",
|
|
1602
|
-
children: /* @__PURE__ */
|
|
1805
|
+
children: /* @__PURE__ */ d(
|
|
1603
1806
|
"path",
|
|
1604
1807
|
{
|
|
1605
1808
|
d: "M19 12H5M19 12L14 17M19 12L14 7",
|
|
@@ -1619,22 +1822,22 @@ const Ln = ({
|
|
|
1619
1822
|
}
|
|
1620
1823
|
) })
|
|
1621
1824
|
] }),
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
|
|
1825
|
+
/* @__PURE__ */ d("div", { className: "avatar-wrapper", children: /* @__PURE__ */ le("div", { className: "avatar-scene-wrapper", children: [
|
|
1826
|
+
he !== "hidden" && /* @__PURE__ */ d(
|
|
1624
1827
|
"div",
|
|
1625
1828
|
{
|
|
1626
|
-
className: `avatar-bubble${
|
|
1627
|
-
onAnimationEnd:
|
|
1628
|
-
children: /* @__PURE__ */
|
|
1829
|
+
className: `avatar-bubble${he === "entering" ? " avatar-bubble--entering" : he === "exiting" ? " avatar-bubble--exiting" : ""}`,
|
|
1830
|
+
onAnimationEnd: rn,
|
|
1831
|
+
children: /* @__PURE__ */ d("div", { ref: wt, className: `avatar-bubble__content${ot ? " avatar-bubble__content--nudge" : ""}`, children: St })
|
|
1629
1832
|
}
|
|
1630
1833
|
),
|
|
1631
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ d(
|
|
1632
1835
|
"div",
|
|
1633
1836
|
{
|
|
1634
1837
|
className: "avatar-canvas-layer",
|
|
1635
|
-
style: { width:
|
|
1838
|
+
style: { width: F, height: F },
|
|
1636
1839
|
children: /* @__PURE__ */ le(
|
|
1637
|
-
|
|
1840
|
+
cn,
|
|
1638
1841
|
{
|
|
1639
1842
|
shadows: !0,
|
|
1640
1843
|
camera: { position: [0.2, 1.4, 3], fov: 42 },
|
|
@@ -1642,30 +1845,30 @@ const Ln = ({
|
|
|
1642
1845
|
dpr: 1.8,
|
|
1643
1846
|
style: { pointerEvents: "none", width: "100%", height: "100%" },
|
|
1644
1847
|
children: [
|
|
1645
|
-
/* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1647
|
-
/* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
|
|
1848
|
+
/* @__PURE__ */ d(In, { target: sn }),
|
|
1849
|
+
/* @__PURE__ */ d("ambientLight", { intensity: 0.7 }),
|
|
1850
|
+
/* @__PURE__ */ d("directionalLight", { position: [0, 2, 2], intensity: 1 }),
|
|
1851
|
+
/* @__PURE__ */ d(on, { preset: "city" }),
|
|
1852
|
+
/* @__PURE__ */ d(hn, { fallback: null, children: Ue !== null && /* @__PURE__ */ d(
|
|
1853
|
+
Dn,
|
|
1651
1854
|
{
|
|
1652
|
-
avatarUrl:
|
|
1653
|
-
isPlayingRef:
|
|
1654
|
-
visemeQueueRef:
|
|
1655
|
-
audioContextRef:
|
|
1656
|
-
responseAudioStartTimeRef:
|
|
1657
|
-
adjustments:
|
|
1855
|
+
avatarUrl: Ue,
|
|
1856
|
+
isPlayingRef: U,
|
|
1857
|
+
visemeQueueRef: N,
|
|
1858
|
+
audioContextRef: O,
|
|
1859
|
+
responseAudioStartTimeRef: ye,
|
|
1860
|
+
adjustments: xn,
|
|
1658
1861
|
mood: o,
|
|
1659
|
-
expression:
|
|
1660
|
-
agentResponse:
|
|
1661
|
-
isSpeaking:
|
|
1662
|
-
nextStartTimeRef:
|
|
1663
|
-
stopPlayback:
|
|
1664
|
-
setIsSpeaking:
|
|
1665
|
-
expressionUrl:
|
|
1666
|
-
onExpressionFinished:
|
|
1667
|
-
isNudgeResponse:
|
|
1668
|
-
avatarGender:
|
|
1862
|
+
expression: M,
|
|
1863
|
+
agentResponse: we,
|
|
1864
|
+
isSpeaking: ee,
|
|
1865
|
+
nextStartTimeRef: de,
|
|
1866
|
+
stopPlayback: Ge,
|
|
1867
|
+
setIsSpeaking: k,
|
|
1868
|
+
expressionUrl: rt,
|
|
1869
|
+
onExpressionFinished: Jt,
|
|
1870
|
+
isNudgeResponse: ot,
|
|
1871
|
+
avatarGender: b
|
|
1669
1872
|
}
|
|
1670
1873
|
) })
|
|
1671
1874
|
]
|
|
@@ -1675,20 +1878,22 @@ const Ln = ({
|
|
|
1675
1878
|
)
|
|
1676
1879
|
] }) })
|
|
1677
1880
|
] });
|
|
1678
|
-
},
|
|
1679
|
-
token:
|
|
1680
|
-
avatarGender:
|
|
1681
|
-
onNavigationRequested:
|
|
1682
|
-
presetUserDetails:
|
|
1683
|
-
|
|
1684
|
-
|
|
1881
|
+
}, Wn = ({
|
|
1882
|
+
token: f,
|
|
1883
|
+
avatarGender: T,
|
|
1884
|
+
onNavigationRequested: x,
|
|
1885
|
+
presetUserDetails: b,
|
|
1886
|
+
onAvatarReady: S
|
|
1887
|
+
}) => /* @__PURE__ */ d(
|
|
1888
|
+
Cn,
|
|
1685
1889
|
{
|
|
1686
|
-
token:
|
|
1687
|
-
onNavigationRequested:
|
|
1688
|
-
avatarGender:
|
|
1689
|
-
presetUserDetails:
|
|
1890
|
+
token: f,
|
|
1891
|
+
onNavigationRequested: x,
|
|
1892
|
+
avatarGender: T,
|
|
1893
|
+
presetUserDetails: b,
|
|
1894
|
+
onAvatarReady: S
|
|
1690
1895
|
}
|
|
1691
1896
|
);
|
|
1692
1897
|
export {
|
|
1693
|
-
|
|
1898
|
+
Wn as AvatarWidget
|
|
1694
1899
|
};
|