@streamoji/avatar-widget 0.3.5 → 0.3.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.
- package/dist/avatar-widget.cjs +7 -5
- package/dist/avatar-widget.css +1 -1
- package/dist/avatar-widget.js +960 -749
- package/dist/avatar-widget.umd.css +1 -1
- package/dist/avatar-widget.umd.js +58 -56
- package/dist/avatar-widget.umd.js.map +1 -1
- 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 c, useState as v, 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 = (...m) => {
|
|
8
|
+
}, mn = (...m) => {
|
|
9
|
+
}, Nt = ({ analyser: m }) => {
|
|
10
|
+
const T = c(null), y = c(null);
|
|
11
|
+
return W(() => {
|
|
12
|
+
const b = T.current;
|
|
13
|
+
if (!b) return;
|
|
14
|
+
const x = b.getContext("2d", { alpha: !0 });
|
|
15
|
+
if (!x) return;
|
|
16
|
+
let H, I = null;
|
|
17
|
+
m && (m.fftSize = 128, I = new Uint8Array(m.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
|
+
x.clearRect(0, 0, se, R), x.fillStyle = "#1e293b";
|
|
24
|
+
const K = 2, l = K + 2, Q = se * 0.95, g = Math.floor(Q / l);
|
|
25
|
+
(!y.current || y.current.length !== g) && (y.current = new Float32Array(g).fill(2));
|
|
26
|
+
const ee = g * l, k = (se - ee) / 2;
|
|
27
|
+
m && I && m.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 = y.current[D] + (Y - y.current[D]) * 0.3;
|
|
44
|
+
y.current[D] = F;
|
|
45
|
+
const V = k + D * l, $ = we - F / 2;
|
|
46
|
+
x.beginPath(), x.roundRect ? x.roundRect(V, $, K, F, 4) : x.fillRect(V, $, K, F), x.fill();
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return
|
|
50
|
-
cancelAnimationFrame(
|
|
49
|
+
return Ue(), () => {
|
|
50
|
+
cancelAnimationFrame(H);
|
|
51
51
|
};
|
|
52
|
-
}, [
|
|
52
|
+
}, [m]), /* @__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(m) {
|
|
61
|
+
const T = await crypto.subtle.digest(
|
|
62
62
|
"SHA-256",
|
|
63
|
-
new TextEncoder().encode(
|
|
63
|
+
new TextEncoder().encode(m)
|
|
64
64
|
);
|
|
65
|
-
return Array.from(new Uint8Array(
|
|
65
|
+
return Array.from(new Uint8Array(T)).map((y) => y.toString(16).padStart(2, "0")).join("");
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const [
|
|
69
|
-
return
|
|
70
|
-
if (!
|
|
71
|
-
|
|
67
|
+
function bn(m) {
|
|
68
|
+
const [T, y] = v(null);
|
|
69
|
+
return W(() => {
|
|
70
|
+
if (!m) {
|
|
71
|
+
y(null);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
let
|
|
75
|
-
return
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
fetch(
|
|
79
|
-
|
|
74
|
+
let b = !1;
|
|
75
|
+
return gn(m).then((x) => {
|
|
76
|
+
if (b) return;
|
|
77
|
+
const H = `${pn}/${x}.glb`;
|
|
78
|
+
fetch(H, { method: "HEAD" }).then((I) => {
|
|
79
|
+
b || y(I.ok ? H : Pt);
|
|
80
80
|
}).catch(() => {
|
|
81
|
-
|
|
81
|
+
b || y(Pt);
|
|
82
82
|
});
|
|
83
83
|
}), () => {
|
|
84
|
-
|
|
84
|
+
b = !0;
|
|
85
85
|
};
|
|
86
|
-
}, [
|
|
86
|
+
}, [m]), 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 un = [
|
|
|
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 un = [
|
|
|
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,
|
|
425
|
+
mouthRollLower: 0.3,
|
|
426
|
+
mouthRollUpper: 0.3,
|
|
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,
|
|
388
435
|
mouthRollLower: 0.3,
|
|
389
436
|
mouthRollUpper: 0.3,
|
|
390
|
-
|
|
391
|
-
|
|
437
|
+
mouthPressLeft: 0.5,
|
|
438
|
+
mouthPressRight: 0.5
|
|
392
439
|
}
|
|
393
440
|
},
|
|
394
441
|
{
|
|
@@ -396,20 +443,43 @@ const un = [
|
|
|
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 un = [
|
|
|
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 un = [
|
|
|
483
622
|
],
|
|
484
623
|
sil: [{ v: "sil", w: 1 }]
|
|
485
624
|
};
|
|
486
|
-
function
|
|
487
|
-
if (!
|
|
488
|
-
const
|
|
489
|
-
return
|
|
625
|
+
function En(m) {
|
|
626
|
+
if (!m) return [{ v: "sil", w: 1 }];
|
|
627
|
+
const T = m.toLowerCase();
|
|
628
|
+
return Mn[T] ?? [{ v: "sil", w: 1 }];
|
|
490
629
|
}
|
|
491
|
-
function
|
|
492
|
-
const { camera:
|
|
493
|
-
return
|
|
494
|
-
|
|
495
|
-
}, [
|
|
630
|
+
function In({ target: m }) {
|
|
631
|
+
const { camera: T } = un();
|
|
632
|
+
return W(() => {
|
|
633
|
+
T.lookAt(...m);
|
|
634
|
+
}, [T, m]), null;
|
|
496
635
|
}
|
|
497
|
-
function
|
|
498
|
-
if (!
|
|
636
|
+
function E(m, T, y) {
|
|
637
|
+
if (!m || !m.morphTargetDictionary)
|
|
499
638
|
return;
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
502
|
-
for (const
|
|
503
|
-
|
|
639
|
+
const b = m, x = b.morphTargetDictionary, H = b.morphTargetInfluences;
|
|
640
|
+
if (H)
|
|
641
|
+
for (const I in x)
|
|
642
|
+
I.toLowerCase() === T.toLowerCase() && (H[x[I]] = y);
|
|
504
643
|
}
|
|
505
|
-
function
|
|
506
|
-
if (!
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
509
|
-
for (let
|
|
510
|
-
|
|
644
|
+
function gt(m, T = 0.97) {
|
|
645
|
+
if (!m) return;
|
|
646
|
+
const y = m;
|
|
647
|
+
if (y.morphTargetInfluences)
|
|
648
|
+
for (let b = 0; b < y.morphTargetInfluences.length; b++)
|
|
649
|
+
y.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: m,
|
|
654
|
+
isPlayingRef: T,
|
|
655
|
+
visemeQueueRef: y,
|
|
656
|
+
audioContextRef: b,
|
|
657
|
+
responseAudioStartTimeRef: x,
|
|
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 (
|
|
542
|
-
const
|
|
543
|
-
if (!
|
|
544
|
-
const
|
|
545
|
-
|
|
671
|
+
const { scene: k } = mt(m), Me = mt(ee === "female" ? wn : _n), te = bt(
|
|
672
|
+
() => Me.flatMap((p) => p.animations),
|
|
673
|
+
[Me]
|
|
674
|
+
), D = mt(ee === "female" ? yn : vn), J = bt(
|
|
675
|
+
() => D.flatMap((p) => p.animations),
|
|
676
|
+
[D]
|
|
677
|
+
), Y = c(null), F = c(null), V = c(null), $ = c(null), Ee = c([]), [U] = v(() => new ze.AnimationMixer(k)), N = c({}), O = c(null), ve = c(0), Ne = c(!1), ye = c(0), de = c(null);
|
|
678
|
+
W(() => {
|
|
679
|
+
if (!(!te || !k)) {
|
|
680
|
+
if (te.forEach((p, u) => {
|
|
681
|
+
const s = `idle_${u}`;
|
|
682
|
+
if (!N.current[s]) {
|
|
683
|
+
const o = U.clipAction(p, k);
|
|
684
|
+
o.name = s, o.setLoop(ze.LoopOnce, 1), o.clampWhenFinished = !0, N.current[s] = o;
|
|
546
685
|
}
|
|
547
|
-
}), J.forEach((
|
|
548
|
-
const
|
|
549
|
-
if (!
|
|
550
|
-
const
|
|
551
|
-
|
|
686
|
+
}), J.forEach((p, u) => {
|
|
687
|
+
const s = `talk_${u}`;
|
|
688
|
+
if (!N.current[s]) {
|
|
689
|
+
const o = U.clipAction(p, 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 p = N.current.idle_0, u = O.current && U.existingAction(O.current.getClip());
|
|
694
|
+
p && !u && (p.reset().fadeIn(0.5).play(), O.current = p);
|
|
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 = c("");
|
|
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
|
|
570
|
-
if (
|
|
571
|
-
const h =
|
|
572
|
-
|
|
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
|
|
583
|
-
const
|
|
584
|
-
if (
|
|
585
|
-
const
|
|
586
|
-
X && (X.reset().fadeIn(0.5).play(),
|
|
587
|
-
} else if (
|
|
588
|
-
if (
|
|
720
|
+
}, [l, k, U, R]), W(() => {
|
|
721
|
+
const p = (u) => {
|
|
722
|
+
const s = u.action, o = s.name || "";
|
|
723
|
+
if (o.startsWith("idle_")) {
|
|
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);
|
|
726
|
+
} else if (o.startsWith("EXPR_")) {
|
|
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(),
|
|
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
|
-
|
|
598
|
-
} else if (
|
|
599
|
-
if (
|
|
600
|
-
const
|
|
601
|
-
X && (X.reset().fadeIn(0.3).play(),
|
|
736
|
+
Q && Q();
|
|
737
|
+
} else if (o.startsWith("talk_"))
|
|
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(),
|
|
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", p), () => U.removeEventListener("finished", p);
|
|
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 p = O.current, u = p?.name || "";
|
|
618
757
|
if (u.startsWith("idle_") || u.startsWith("talk_") || u === "") {
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
621
|
-
const
|
|
622
|
-
if (
|
|
623
|
-
|
|
758
|
+
const s = de.current;
|
|
759
|
+
if (s) {
|
|
760
|
+
const o = N.current[`EXPR_${s}`];
|
|
761
|
+
if (o) {
|
|
762
|
+
o.reset().fadeIn(0.3).play(), p && p !== o && p.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
|
-
const
|
|
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(), p && p.crossFadeTo(h, 0.5, !0), O.current = h);
|
|
632
771
|
}
|
|
633
772
|
}
|
|
634
|
-
} else if (!
|
|
635
|
-
const
|
|
773
|
+
} else if (!R && k) {
|
|
774
|
+
const p = O.current, u = p?.name || "";
|
|
636
775
|
if (u.startsWith("talk_") || u.startsWith("EXPR_")) {
|
|
637
|
-
const
|
|
638
|
-
|
|
776
|
+
const s = N.current.idle_0;
|
|
777
|
+
s && (s.reset().fadeIn(0.5).play(), p && p.crossFadeTo(s, 0.5, !0), O.current = s);
|
|
639
778
|
}
|
|
640
779
|
}
|
|
641
|
-
}, [
|
|
642
|
-
if (!
|
|
643
|
-
|
|
644
|
-
if (
|
|
645
|
-
const
|
|
646
|
-
(
|
|
780
|
+
}, [R, k, l]), W(() => {
|
|
781
|
+
if (!k) return;
|
|
782
|
+
k.traverse((s) => {
|
|
783
|
+
if (s.isMesh && s.morphTargetDictionary) {
|
|
784
|
+
const o = s.name.toLowerCase();
|
|
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
|
-
|
|
651
|
-
(
|
|
788
|
+
const p = F.current?.morphTargetDictionary;
|
|
789
|
+
p && Object.keys(p).filter(
|
|
790
|
+
(s) => s.toLowerCase().includes("brow")
|
|
652
791
|
);
|
|
653
792
|
const u = [];
|
|
654
|
-
|
|
655
|
-
if (
|
|
656
|
-
const h =
|
|
657
|
-
h && Object.keys(h).some((
|
|
793
|
+
k.traverse((s) => {
|
|
794
|
+
if (s.isMesh) {
|
|
795
|
+
const h = s.morphTargetDictionary;
|
|
796
|
+
h && Object.keys(h).some((M) => M.toLowerCase().includes("brow")) && u.push(s);
|
|
658
797
|
}
|
|
659
|
-
}),
|
|
660
|
-
}, [
|
|
661
|
-
const
|
|
662
|
-
const
|
|
663
|
-
if (
|
|
664
|
-
for (const h in
|
|
665
|
-
const
|
|
666
|
-
|
|
798
|
+
}), Ee.current = u, u.length > 0 && B("[ANIMATION] Meshes with brow morphs:", u.length);
|
|
799
|
+
}, [k]);
|
|
800
|
+
const He = (p, u = 1) => {
|
|
801
|
+
const s = `viseme_${p}`.toLowerCase(), o = Tn.find((h) => h.key.toLowerCase() === s);
|
|
802
|
+
if (o) {
|
|
803
|
+
for (const h in o.mix) {
|
|
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
|
-
|
|
670
|
-
|
|
671
|
-
|
|
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 = (p) => {
|
|
814
|
+
const u = nt[p] ?? nt.neutral;
|
|
815
|
+
for (const s in u)
|
|
816
|
+
E(F.current, s, u[s]), E(V.current, s, u[s]), E($.current, s, u[s]);
|
|
672
817
|
};
|
|
673
|
-
return
|
|
674
|
-
const
|
|
675
|
-
|
|
676
|
-
const
|
|
818
|
+
return an((p, u) => {
|
|
819
|
+
const s = Math.pow(0.88, 60 * u);
|
|
820
|
+
gt(F.current, s), gt(V.current, s), gt($.current, s), xe(I);
|
|
821
|
+
const o = p.clock.elapsedTime;
|
|
677
822
|
let h = 0;
|
|
678
|
-
if (Math.floor(
|
|
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 - x.current) * 1e3 - -150;
|
|
853
|
+
for (let re = 0; re < y.current.length; re++) {
|
|
854
|
+
const ae = y.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(m) {
|
|
863
|
+
return m ? m.charAt(0).toUpperCase() + m.slice(1).toLowerCase() : "";
|
|
719
864
|
}
|
|
720
|
-
function
|
|
721
|
-
return
|
|
865
|
+
function Wt(m) {
|
|
866
|
+
return m.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: m,
|
|
870
|
+
agentToken: T,
|
|
871
|
+
onNavigationRequested: y,
|
|
872
|
+
avatarGender: b,
|
|
873
|
+
presetUserDetails: x,
|
|
874
|
+
onAvatarReady: H
|
|
729
875
|
} = {}) => {
|
|
730
|
-
const
|
|
876
|
+
const I = m ?? T ?? "", Ue = bn(I || void 0), [se, R] = v(""), [we, K] = v(""), [j, l] = v("Ready"), [Q, g] = v(!1), [ee, k] = v(!1), [Te, Me] = v([]), [te, Se] = v(""), D = c(null), [J, Y] = v(
|
|
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
|
|
738
|
-
|
|
739
|
-
const
|
|
883
|
+
const F = J ? 80 : 600, V = c(!1), $ = c([]), Ee = c(0), U = c(!1), N = c([]), O = c(null), ve = c([]);
|
|
884
|
+
c([]);
|
|
885
|
+
const Ne = c([]), ye = c(0), de = c(0), pe = c(0), He = c(0), xe = c(!1), [p, u] = v(
|
|
740
886
|
null
|
|
741
|
-
),
|
|
887
|
+
), s = c(null), [o, h] = v("neutral"), [M, X] = v(""), [rt, Ke] = v(""), [je, Ie] = v("Chat with us"), [ne, Qe] = v(
|
|
742
888
|
null
|
|
743
|
-
), [
|
|
744
|
-
q.current =
|
|
745
|
-
const [
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
if (
|
|
750
|
-
|
|
889
|
+
), [oe, De] = v("hidden"), [Le, Pe] = v(""), Oe = c(null), q = c(oe);
|
|
890
|
+
q.current = oe;
|
|
891
|
+
const [ke, z] = v(null), Be = c(null), re = c(null), [ae, _t] = v(!1), wt = c(null), [he, Xe] = v("hidden"), [St, Vt] = v(""), it = c(he);
|
|
892
|
+
it.current = he;
|
|
893
|
+
const ie = c(""), ge = c(!1), be = c(""), vt = c(Date.now()), st = c([]), Je = c(!1), [ot, qe] = v(!1), [yt, xt] = v(!1), Re = c(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
|
-
|
|
916
|
+
Ze,
|
|
917
|
+
We,
|
|
918
|
+
oe,
|
|
773
919
|
Le
|
|
774
|
-
]),
|
|
775
|
-
if (
|
|
776
|
-
|
|
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
|
|
806
|
-
(
|
|
949
|
+
const r = String(e.expression).trim();
|
|
950
|
+
X(r);
|
|
951
|
+
const a = Sn.find(
|
|
952
|
+
(f) => f.name.toLowerCase() === r.toLowerCase()
|
|
807
953
|
);
|
|
808
|
-
|
|
809
|
-
`[STREAM] Animation match for "${
|
|
810
|
-
),
|
|
954
|
+
B(
|
|
955
|
+
`[STREAM] Animation match for "${r}": ${a ? a.name : "NONE"}`
|
|
956
|
+
), Ke(a?.url ?? "");
|
|
811
957
|
}
|
|
812
958
|
if (e.navigation != null) {
|
|
813
|
-
const
|
|
814
|
-
|
|
959
|
+
const r = String(e.navigation).trim();
|
|
960
|
+
r !== "" && (y ? y(r) : window.open(r, "_blank"));
|
|
815
961
|
}
|
|
816
|
-
const t = e.ask_for || e.lead_capture?.ask_for,
|
|
817
|
-
if (t && !
|
|
818
|
-
const
|
|
819
|
-
if (
|
|
962
|
+
const t = e.ask_for || e.lead_capture?.ask_for, n = t ? String(t).trim().toLowerCase() : "", i = n === "none" || n === "<none>";
|
|
963
|
+
if (t && !i) {
|
|
964
|
+
const r = n;
|
|
965
|
+
if (x && (r === "email" && x.email || r === "name" && x.name || r === "phone" && x.phone))
|
|
820
966
|
return;
|
|
821
|
-
|
|
822
|
-
} else (
|
|
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,119 +977,127 @@ const An = ({
|
|
|
831
977
|
return null;
|
|
832
978
|
}
|
|
833
979
|
if (t.includes(":")) {
|
|
834
|
-
const
|
|
835
|
-
return { [
|
|
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
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
984
|
+
}, Jt = $e(() => {
|
|
985
|
+
}, []), Ae = "§", at = () => {
|
|
986
|
+
for (; ie.current.includes(`
|
|
987
|
+
`); ) {
|
|
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);
|
|
993
|
+
}
|
|
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;
|
|
844
1005
|
return;
|
|
845
1006
|
} else
|
|
846
|
-
|
|
847
|
-
`); ) {
|
|
848
|
-
const t = pe.current.indexOf(`
|
|
849
|
-
`), r = pe.current.slice(0, t).trim();
|
|
850
|
-
pe.current = pe.current.slice(t + 1);
|
|
851
|
-
const o = Ut(r);
|
|
852
|
-
o && Ft(o);
|
|
853
|
-
}
|
|
1007
|
+
ie.current += e, at();
|
|
854
1008
|
};
|
|
855
|
-
|
|
1009
|
+
W(() => {
|
|
856
1010
|
(async () => {
|
|
857
1011
|
if (!sessionStorage.getItem(
|
|
858
1012
|
"STREAMOJI_LEADS_SESSION_LEAD_ID"
|
|
859
1013
|
)) {
|
|
860
|
-
const
|
|
1014
|
+
const r = "secret", a = Math.floor(Date.now() / 1e3).toString();
|
|
861
1015
|
try {
|
|
862
|
-
const
|
|
1016
|
+
const f = new TextEncoder(), _ = await crypto.subtle.importKey(
|
|
863
1017
|
"raw",
|
|
864
|
-
|
|
1018
|
+
f.encode(r),
|
|
865
1019
|
{ name: "HMAC", hash: "SHA-256" },
|
|
866
1020
|
!1,
|
|
867
1021
|
["sign"]
|
|
868
|
-
),
|
|
1022
|
+
), S = await crypto.subtle.sign(
|
|
869
1023
|
"HMAC",
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
),
|
|
873
|
-
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",
|
|
874
|
-
} catch (
|
|
875
|
-
console.error("[SESSION] HMAC generation failed:",
|
|
876
|
-
const
|
|
877
|
-
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",
|
|
1024
|
+
_,
|
|
1025
|
+
f.encode(a)
|
|
1026
|
+
), w = Array.from(new Uint8Array(S)).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 (f) {
|
|
1029
|
+
console.error("[SESSION] HMAC generation failed:", f);
|
|
1030
|
+
const _ = Math.random().toString(36) + Date.now().toString();
|
|
1031
|
+
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", _);
|
|
878
1032
|
}
|
|
879
1033
|
}
|
|
880
|
-
const
|
|
881
|
-
let
|
|
882
|
-
if (
|
|
1034
|
+
const n = sessionStorage.getItem("STREAMOJI_LEADS_SESSION_MESSAGES");
|
|
1035
|
+
let i = [];
|
|
1036
|
+
if (n)
|
|
883
1037
|
try {
|
|
884
|
-
|
|
1038
|
+
i = JSON.parse(n);
|
|
885
1039
|
} catch {
|
|
886
|
-
|
|
1040
|
+
i = [];
|
|
887
1041
|
}
|
|
888
|
-
|
|
1042
|
+
i.length === 0 && x && (x.name || x.email) ? (i = [{ role: "user", content: `PRESET_USER_DETAILS: Name is "${x.name || ""}" , Email is "${x.email || ""}"` }], sessionStorage.setItem(
|
|
889
1043
|
"STREAMOJI_LEADS_SESSION_MESSAGES",
|
|
890
|
-
JSON.stringify(
|
|
891
|
-
)) :
|
|
1044
|
+
JSON.stringify(i)
|
|
1045
|
+
)) : n || sessionStorage.setItem(
|
|
892
1046
|
"STREAMOJI_LEADS_SESSION_MESSAGES",
|
|
893
1047
|
JSON.stringify([])
|
|
894
1048
|
);
|
|
895
1049
|
})();
|
|
896
|
-
}, [
|
|
1050
|
+
}, [x]), W(() => {
|
|
897
1051
|
const e = () => {
|
|
898
|
-
|
|
1052
|
+
vt.current = Date.now(), Je.current && (Je.current = !1, qe(!1), Me([]), Se(""), K(""), k(!1));
|
|
899
1053
|
};
|
|
900
1054
|
window.addEventListener("mousemove", e), window.addEventListener("keydown", e), window.addEventListener("mousedown", e), window.addEventListener("touchstart", e);
|
|
901
1055
|
const t = setInterval(async () => {
|
|
902
|
-
if (Date.now() -
|
|
903
|
-
if (
|
|
904
|
-
|
|
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);
|
|
905
1059
|
else
|
|
906
1060
|
try {
|
|
907
|
-
const
|
|
1061
|
+
const r = `${Ye}/nudgeUser`, a = {
|
|
908
1062
|
navigationUrl: window.location.href,
|
|
909
|
-
token:
|
|
910
|
-
},
|
|
1063
|
+
token: I
|
|
1064
|
+
}, f = await fetch(r, {
|
|
911
1065
|
method: "POST",
|
|
912
1066
|
headers: {
|
|
913
1067
|
"Content-Type": "application/json"
|
|
914
1068
|
},
|
|
915
|
-
body: JSON.stringify(
|
|
1069
|
+
body: JSON.stringify(a)
|
|
916
1070
|
});
|
|
917
|
-
if (
|
|
918
|
-
const
|
|
919
|
-
|
|
1071
|
+
if (f.ok) {
|
|
1072
|
+
const S = (await f.json()).nudge_questions;
|
|
1073
|
+
S && S.length > 0 && (B("[NUDGE] Received nudge questions from API:", S), st.current = S, qe(!0), Me(S));
|
|
920
1074
|
}
|
|
921
|
-
} catch (
|
|
922
|
-
console.error("[NUDGE] Error calling /nudgeUser:",
|
|
1075
|
+
} catch (r) {
|
|
1076
|
+
console.error("[NUDGE] Error calling /nudgeUser:", r), Je.current = !1;
|
|
923
1077
|
}
|
|
924
1078
|
}, 1e3);
|
|
925
1079
|
return () => {
|
|
926
1080
|
window.removeEventListener("mousemove", e), window.removeEventListener("keydown", e), window.removeEventListener("mousedown", e), window.removeEventListener("touchstart", e), clearInterval(t);
|
|
927
1081
|
};
|
|
928
|
-
}, [
|
|
929
|
-
if (
|
|
930
|
-
let e = 0, t = 0,
|
|
931
|
-
const
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
const
|
|
935
|
-
|
|
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 a = Te[e];
|
|
1087
|
+
if (n) {
|
|
1088
|
+
const f = a.substring(0, t - 1);
|
|
1089
|
+
Se(f), t--, i = 50;
|
|
936
1090
|
} else {
|
|
937
|
-
const
|
|
938
|
-
|
|
1091
|
+
const f = a.substring(0, t + 1);
|
|
1092
|
+
Se(f), t++, i = 100;
|
|
939
1093
|
}
|
|
940
|
-
!
|
|
1094
|
+
!n && t === a.length ? (n = !0, i = 3e3) : n && t === 0 && (n = !1, e = (e + 1) % Te.length, i = 500), D.current = setTimeout(r, i);
|
|
941
1095
|
};
|
|
942
|
-
return
|
|
943
|
-
|
|
1096
|
+
return r(), () => {
|
|
1097
|
+
D.current && clearTimeout(D.current);
|
|
944
1098
|
};
|
|
945
|
-
}, [
|
|
946
|
-
const
|
|
1099
|
+
}, [Te]);
|
|
1100
|
+
const Rt = () => {
|
|
947
1101
|
try {
|
|
948
1102
|
return JSON.parse(
|
|
949
1103
|
sessionStorage.getItem("STREAMOJI_LEADS_SESSION_MESSAGES") || "[]"
|
|
@@ -951,232 +1105,232 @@ const An = ({
|
|
|
951
1105
|
} catch {
|
|
952
1106
|
return [];
|
|
953
1107
|
}
|
|
954
|
-
},
|
|
1108
|
+
}, qt = (e) => {
|
|
955
1109
|
sessionStorage.setItem(
|
|
956
1110
|
"STREAMOJI_LEADS_SESSION_MESSAGES",
|
|
957
1111
|
JSON.stringify(e)
|
|
958
1112
|
);
|
|
959
|
-
}, [
|
|
1113
|
+
}, [ct, ut] = v(!1), [At, lt] = v(0), fe = c(null), et = c([]), Tt = c(0), [Mt, Gt] = v(
|
|
960
1114
|
null
|
|
961
|
-
), [
|
|
1115
|
+
), [zt, dt] = v(
|
|
962
1116
|
null
|
|
963
|
-
),
|
|
1117
|
+
), _e = c(null), Ce = c(
|
|
964
1118
|
null
|
|
965
|
-
),
|
|
966
|
-
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) => {
|
|
967
1121
|
try {
|
|
968
1122
|
t.stop();
|
|
969
1123
|
} catch {
|
|
970
1124
|
}
|
|
971
|
-
}),
|
|
972
|
-
}, []),
|
|
1125
|
+
}), Be.current && (clearTimeout(Be.current), Be.current = null), z(null), Ke(""), ve.current = [];
|
|
1126
|
+
}, []), Yt = async () => {
|
|
973
1127
|
try {
|
|
974
|
-
const e = await navigator.mediaDevices.getUserMedia({ audio: !0 }), t = window.AudioContext || window.webkitAudioContext,
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
},
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
|
|
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);
|
|
1130
|
+
const a = new MediaRecorder(e);
|
|
1131
|
+
fe.current = a, et.current = [], a.ondataavailable = (f) => {
|
|
1132
|
+
f.data.size > 0 && et.current.push(f.data);
|
|
1133
|
+
}, a.onstop = async () => {
|
|
1134
|
+
const f = 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), f < 1e3) {
|
|
1136
|
+
l("Recording too short. Hold or click longer."), g(!1);
|
|
983
1137
|
return;
|
|
984
1138
|
}
|
|
985
|
-
const
|
|
1139
|
+
const _ = new Blob(et.current, {
|
|
986
1140
|
type: "audio/wav"
|
|
987
1141
|
});
|
|
988
|
-
await
|
|
989
|
-
},
|
|
1142
|
+
await Zt(_);
|
|
1143
|
+
}, Tt.current = Date.now(), a.start(100), ut(!0), l("Listening...");
|
|
990
1144
|
} catch (e) {
|
|
991
|
-
console.error("Error accessing microphone:", e),
|
|
1145
|
+
console.error("Error accessing microphone:", e), l("Mic Access Error");
|
|
992
1146
|
}
|
|
993
|
-
},
|
|
994
|
-
|
|
995
|
-
},
|
|
996
|
-
|
|
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"));
|
|
997
1151
|
};
|
|
998
|
-
|
|
999
|
-
if (!
|
|
1152
|
+
W(() => {
|
|
1153
|
+
if (!ee) return;
|
|
1000
1154
|
const e = () => {
|
|
1001
|
-
const t =
|
|
1155
|
+
const t = pe.current;
|
|
1002
1156
|
if (t <= 0) return;
|
|
1003
|
-
const
|
|
1004
|
-
if (!
|
|
1005
|
-
const
|
|
1006
|
-
if (
|
|
1007
|
-
const
|
|
1008
|
-
Math.round(
|
|
1009
|
-
|
|
1157
|
+
const n = O.current, i = ye.current;
|
|
1158
|
+
if (!n) return;
|
|
1159
|
+
const r = n.currentTime - i, a = Math.min(Math.max(0, r), t), _ = Wt(we).trim().length;
|
|
1160
|
+
if (_ <= 0) return;
|
|
1161
|
+
const S = Math.min(
|
|
1162
|
+
Math.round(a / t * _),
|
|
1163
|
+
_
|
|
1010
1164
|
);
|
|
1011
|
-
u(
|
|
1165
|
+
u(S);
|
|
1012
1166
|
};
|
|
1013
|
-
return clearInterval(
|
|
1014
|
-
}, [
|
|
1167
|
+
return clearInterval(s.current ?? void 0), s.current = setInterval(e, 90), () => clearInterval(s.current ?? void 0);
|
|
1168
|
+
}, [ee, we, pe.current]), W(() => {
|
|
1015
1169
|
let e;
|
|
1016
|
-
return
|
|
1017
|
-
|
|
1018
|
-
}, 1e3)) :
|
|
1019
|
-
}, [
|
|
1020
|
-
const
|
|
1021
|
-
const t = e.numberOfChannels,
|
|
1022
|
-
let
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
},
|
|
1026
|
-
|
|
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);
|
|
1176
|
+
let a = 0;
|
|
1177
|
+
const f = (w) => {
|
|
1178
|
+
r.setUint16(a, w, !0), a += 2;
|
|
1179
|
+
}, _ = (w) => {
|
|
1180
|
+
r.setUint32(a, w, !0), a += 4;
|
|
1027
1181
|
};
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
for (let
|
|
1031
|
-
let
|
|
1032
|
-
for (;
|
|
1033
|
-
for (let
|
|
1034
|
-
let
|
|
1035
|
-
|
|
1182
|
+
_(1179011410), _(n - 8), _(1163280727), _(544501094), _(16), f(1), f(t), _(e.sampleRate), _(e.sampleRate * 2 * t), f(t * 2), f(16), _(1635017060), _(n - a - 4);
|
|
1183
|
+
const S = [];
|
|
1184
|
+
for (let w = 0; w < t; w++) S.push(e.getChannelData(w));
|
|
1185
|
+
let L = 0;
|
|
1186
|
+
for (; a < n; ) {
|
|
1187
|
+
for (let w = 0; w < t; w++) {
|
|
1188
|
+
let A = Math.max(-1, Math.min(1, S[w][L]));
|
|
1189
|
+
A = A < 0 ? A * 32768 : A * 32767, r.setInt16(a, A, !0), a += 2;
|
|
1036
1190
|
}
|
|
1037
|
-
|
|
1191
|
+
L++;
|
|
1038
1192
|
}
|
|
1039
|
-
return new Blob([
|
|
1040
|
-
},
|
|
1041
|
-
if (!
|
|
1042
|
-
if (
|
|
1043
|
-
|
|
1193
|
+
return new Blob([i], { type: "audio/wav" });
|
|
1194
|
+
}, ht = async (e, t, n = !1) => {
|
|
1195
|
+
if (!xe.current) {
|
|
1196
|
+
if (V.current) {
|
|
1197
|
+
$.current.push({
|
|
1044
1198
|
audio: e,
|
|
1045
1199
|
visemes: t,
|
|
1046
|
-
isNewSegment:
|
|
1200
|
+
isNewSegment: n
|
|
1047
1201
|
});
|
|
1048
1202
|
return;
|
|
1049
1203
|
}
|
|
1050
|
-
|
|
1204
|
+
V.current = !0;
|
|
1051
1205
|
try {
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
for (let
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1059
|
-
const
|
|
1060
|
-
let
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1065
|
-
let G =
|
|
1066
|
-
if ((!G || G.context !==
|
|
1067
|
-
|
|
1206
|
+
const i = window.AudioContext || window.webkitAudioContext, r = O.current ?? new i();
|
|
1207
|
+
r.state === "suspended" && await r.resume(), O.current = r;
|
|
1208
|
+
const a = window.atob(e), f = new Uint8Array(a.length);
|
|
1209
|
+
for (let P = 0; P < a.length; P++)
|
|
1210
|
+
f[P] = a.charCodeAt(P);
|
|
1211
|
+
const _ = await r.decodeAudioData(f.buffer.slice(0));
|
|
1212
|
+
pe.current += _.duration;
|
|
1213
|
+
const S = r.currentTime;
|
|
1214
|
+
let L = de.current;
|
|
1215
|
+
const w = !U.current;
|
|
1216
|
+
L < S && (L = S + 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);
|
|
1068
1222
|
return;
|
|
1069
1223
|
}
|
|
1070
|
-
if (
|
|
1071
|
-
|
|
1072
|
-
`[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(
|
|
1073
1227
|
3
|
|
1074
1228
|
)}`
|
|
1075
|
-
),
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
`[AUDIO] Response started. Initial startTime: ${
|
|
1229
|
+
), ye.current = L;
|
|
1230
|
+
const P = (L - S) * 1e3;
|
|
1231
|
+
Ee.current = performance.now() + P, B(
|
|
1232
|
+
`[AUDIO] Response started. Initial startTime: ${L.toFixed(
|
|
1079
1233
|
3
|
|
1080
|
-
)}, CT: ${
|
|
1234
|
+
)}, CT: ${S.toFixed(3)}`
|
|
1081
1235
|
);
|
|
1082
1236
|
}
|
|
1083
|
-
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
`[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(
|
|
1087
1241
|
0
|
|
1088
1242
|
)}ms. Resetting segment offset.`
|
|
1089
|
-
)), t.forEach((
|
|
1090
|
-
const
|
|
1091
|
-
if (
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
`[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(
|
|
1095
1249
|
0
|
|
1096
|
-
)}ms => vtime=${
|
|
1097
|
-
),
|
|
1098
|
-
|
|
1099
|
-
viseme:
|
|
1100
|
-
weight:
|
|
1101
|
-
vtime:
|
|
1102
|
-
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
|
|
1103
1257
|
});
|
|
1104
1258
|
});
|
|
1105
1259
|
}
|
|
1106
|
-
}),
|
|
1260
|
+
}), l("Speaking...");
|
|
1107
1261
|
} finally {
|
|
1108
|
-
if (
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1262
|
+
if (V.current = !1, $.current.length > 0) {
|
|
1263
|
+
const i = $.current.shift();
|
|
1264
|
+
i && ht(i.audio, i.visemes, i.isNewSegment);
|
|
1111
1265
|
}
|
|
1112
1266
|
}
|
|
1113
1267
|
}
|
|
1114
|
-
},
|
|
1268
|
+
}, Zt = async (e) => {
|
|
1115
1269
|
try {
|
|
1116
|
-
|
|
1117
|
-
const t = await e.arrayBuffer(),
|
|
1118
|
-
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1123
|
-
)}`,
|
|
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), a = new FileReader();
|
|
1272
|
+
a.readAsDataURL(r), a.onloadend = async () => {
|
|
1273
|
+
const f = a.result.split(",")[1];
|
|
1274
|
+
Ge(), R(""), ie.current = "", ge.current = !1;
|
|
1275
|
+
const _ = `${Ye}/stt?token=${encodeURIComponent(
|
|
1276
|
+
I
|
|
1277
|
+
)}`, S = await fetch(_, {
|
|
1124
1278
|
method: "POST",
|
|
1125
1279
|
headers: { "Content-Type": "application/json" },
|
|
1126
1280
|
body: JSON.stringify({
|
|
1127
|
-
audio_base64:
|
|
1281
|
+
audio_base64: f,
|
|
1128
1282
|
audio_format: "wav"
|
|
1129
1283
|
})
|
|
1130
1284
|
});
|
|
1131
|
-
if (
|
|
1285
|
+
if (S.status === 429) {
|
|
1132
1286
|
try {
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1287
|
+
const ce = await S.text(), C = JSON.parse(ce);
|
|
1288
|
+
B("[STT] 429 agent at capacity:", C?.detail);
|
|
1135
1289
|
} catch {
|
|
1136
1290
|
}
|
|
1137
|
-
|
|
1291
|
+
R(""), l("Busy"), g(!1);
|
|
1138
1292
|
return;
|
|
1139
1293
|
}
|
|
1140
|
-
if (!
|
|
1141
|
-
const
|
|
1142
|
-
let
|
|
1294
|
+
if (!S.ok) {
|
|
1295
|
+
const ce = await S.text();
|
|
1296
|
+
let C = "STT Failed";
|
|
1143
1297
|
try {
|
|
1144
|
-
|
|
1298
|
+
C = JSON.parse(ce).error || C;
|
|
1145
1299
|
} catch {
|
|
1146
|
-
|
|
1300
|
+
ce && (C = ce.slice(0, 200));
|
|
1147
1301
|
}
|
|
1148
|
-
throw new Error(
|
|
1302
|
+
throw new Error(C);
|
|
1149
1303
|
}
|
|
1150
|
-
const
|
|
1151
|
-
if (
|
|
1152
|
-
|
|
1304
|
+
const L = S.body;
|
|
1305
|
+
if (B("this is body" + L), !L) {
|
|
1306
|
+
l("STT Failed"), g(!1);
|
|
1153
1307
|
return;
|
|
1154
1308
|
}
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
const
|
|
1158
|
-
let G = "",
|
|
1159
|
-
const
|
|
1160
|
-
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) {
|
|
1161
1315
|
case "transcript":
|
|
1162
|
-
|
|
1316
|
+
C.transcript != null && R(String(C.transcript));
|
|
1163
1317
|
break;
|
|
1164
1318
|
case "text": {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1319
|
+
const ue = C.delta ?? C.text ?? "";
|
|
1320
|
+
ue && kt(ue);
|
|
1167
1321
|
break;
|
|
1168
1322
|
}
|
|
1169
1323
|
case "audio": {
|
|
1170
|
-
const
|
|
1171
|
-
|
|
1324
|
+
const ue = C.chunk, me = C.visemes ?? [], Fe = !!C.is_new_segment;
|
|
1325
|
+
ue && await ht(ue, me, Fe);
|
|
1172
1326
|
break;
|
|
1173
1327
|
}
|
|
1174
1328
|
case "done": {
|
|
1175
|
-
|
|
1329
|
+
Z = !0, l("Ready"), g(!1);
|
|
1176
1330
|
break;
|
|
1177
1331
|
}
|
|
1178
1332
|
case "error": {
|
|
1179
|
-
|
|
1333
|
+
Z = !0, l("STT Failed"), g(!1);
|
|
1180
1334
|
break;
|
|
1181
1335
|
}
|
|
1182
1336
|
default:
|
|
@@ -1184,169 +1338,226 @@ const An = ({
|
|
|
1184
1338
|
}
|
|
1185
1339
|
};
|
|
1186
1340
|
for (; ; ) {
|
|
1187
|
-
const { done:
|
|
1188
|
-
|
|
1189
|
-
const
|
|
1341
|
+
const { done: ce, value: C } = await w.read();
|
|
1342
|
+
C && (G += A.decode(C, { stream: !0 }));
|
|
1343
|
+
const ue = G.split(`
|
|
1190
1344
|
|
|
1191
1345
|
`);
|
|
1192
|
-
G =
|
|
1193
|
-
for (const
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1346
|
+
G = ue.pop() ?? "";
|
|
1347
|
+
for (const me of ue) {
|
|
1348
|
+
const Fe = Ve(me);
|
|
1349
|
+
Fe && await P(Fe.event, Fe.data);
|
|
1196
1350
|
}
|
|
1197
|
-
if (
|
|
1351
|
+
if (ce) {
|
|
1198
1352
|
if (G.trim()) {
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1353
|
+
const me = Ve(G.trim());
|
|
1354
|
+
me && await P(me.event, me.data);
|
|
1201
1355
|
}
|
|
1202
|
-
|
|
1356
|
+
Z || (l("Ready"), g(!1));
|
|
1203
1357
|
break;
|
|
1204
1358
|
}
|
|
1205
1359
|
}
|
|
1206
1360
|
};
|
|
1207
1361
|
} catch (t) {
|
|
1208
|
-
console.error("Audio Submission Error:", t),
|
|
1362
|
+
console.error("Audio Submission Error:", t), l("STT Failed"), g(!1);
|
|
1209
1363
|
}
|
|
1210
|
-
},
|
|
1211
|
-
e && e.preventDefault(),
|
|
1212
|
-
},
|
|
1364
|
+
}, en = async (e) => {
|
|
1365
|
+
e && e.preventDefault(), qe(!1), be.current = "", K(""), !(!se || Q) && await tn(se);
|
|
1366
|
+
}, Ve = (e) => {
|
|
1213
1367
|
const t = e.split(/\r?\n/);
|
|
1214
|
-
let
|
|
1215
|
-
for (const
|
|
1216
|
-
|
|
1217
|
-
if (!
|
|
1218
|
-
let
|
|
1219
|
-
if (
|
|
1368
|
+
let n = "", i = "";
|
|
1369
|
+
for (const a of t)
|
|
1370
|
+
a.startsWith("event:") ? n = a.slice(6).trim() : a.startsWith("data:") && (i = a.slice(5).trim());
|
|
1371
|
+
if (!n) return null;
|
|
1372
|
+
let r = {};
|
|
1373
|
+
if (i)
|
|
1220
1374
|
try {
|
|
1221
|
-
|
|
1375
|
+
r = JSON.parse(i);
|
|
1222
1376
|
} catch {
|
|
1223
|
-
|
|
1377
|
+
r = { raw: i };
|
|
1224
1378
|
}
|
|
1225
|
-
return { event:
|
|
1226
|
-
},
|
|
1379
|
+
return { event: n, data: r };
|
|
1380
|
+
}, tt = (e, t) => {
|
|
1227
1381
|
switch (e) {
|
|
1228
1382
|
case "connected":
|
|
1229
|
-
|
|
1383
|
+
ie.current = "", ge.current = !1;
|
|
1230
1384
|
break;
|
|
1231
1385
|
case "text": {
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1386
|
+
const n = t.delta ?? "";
|
|
1387
|
+
n && kt(n);
|
|
1234
1388
|
break;
|
|
1235
1389
|
}
|
|
1236
1390
|
case "audio": {
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1391
|
+
const n = t.chunk, i = t.visemes ?? [];
|
|
1392
|
+
n && ht(n, i);
|
|
1239
1393
|
break;
|
|
1240
1394
|
}
|
|
1241
1395
|
case "done": {
|
|
1242
|
-
const
|
|
1243
|
-
...
|
|
1244
|
-
{ role: "user", content:
|
|
1245
|
-
{ role: "assistant", content:
|
|
1396
|
+
const n = Rt(), i = be.current.trim(), r = [
|
|
1397
|
+
...n,
|
|
1398
|
+
{ role: "user", content: se || "..." },
|
|
1399
|
+
{ role: "assistant", content: i }
|
|
1246
1400
|
];
|
|
1247
|
-
|
|
1401
|
+
qt(r), Ne.current = [...N.current], l("Ready"), g(!1), R("");
|
|
1248
1402
|
break;
|
|
1249
1403
|
}
|
|
1250
1404
|
case "error": {
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1405
|
+
const n = t.message ?? "Unknown error";
|
|
1406
|
+
be.current = n, K(n), l("Agent Failed"), g(!1);
|
|
1253
1407
|
break;
|
|
1254
1408
|
}
|
|
1255
1409
|
}
|
|
1256
|
-
},
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
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 a = new TextDecoder();
|
|
1431
|
+
let f = "";
|
|
1432
|
+
for (; ; ) {
|
|
1433
|
+
const { done: _, value: S } = await r.read();
|
|
1434
|
+
S && (f += a.decode(S, { stream: !0 }));
|
|
1435
|
+
const L = f.split(`
|
|
1436
|
+
|
|
1437
|
+
`);
|
|
1438
|
+
f = 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 (f.trim()) {
|
|
1445
|
+
const w = Ve(f.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, i, r, a = "inworld") => {
|
|
1456
|
+
const f = `${Ye}/avatar_tts`;
|
|
1457
|
+
await Et(f, { text: e, userQuery: t, llmPrompt: n, accessKey: i, agentUrl: r, flow: a });
|
|
1458
|
+
}, []), Dt = $e(async (e, t, n, i, r = "inworld") => {
|
|
1459
|
+
const a = `${Ye}/avatar_ttsWithKnowledge`;
|
|
1460
|
+
await Et(a, { userQuery: e, llmPrompt: t, knowledge: n, history: i, flow: r });
|
|
1461
|
+
}, []), Ot = c(!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
|
|
1260
1469
|
)}`;
|
|
1261
1470
|
try {
|
|
1262
|
-
const
|
|
1263
|
-
let
|
|
1264
|
-
|
|
1471
|
+
const n = Rt();
|
|
1472
|
+
let i = sessionStorage.getItem("STREAMOJI_LEADS_SESSION_LEAD_ID");
|
|
1473
|
+
i || (mn(
|
|
1265
1474
|
"[CHAT] Session UID missing at send time! Generating emergency backup."
|
|
1266
|
-
),
|
|
1267
|
-
const
|
|
1268
|
-
history:
|
|
1475
|
+
), i = "emergency-" + Math.random().toString(36).substring(7), sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", i));
|
|
1476
|
+
const r = {
|
|
1477
|
+
history: n,
|
|
1269
1478
|
question: e,
|
|
1270
|
-
lead_id:
|
|
1479
|
+
lead_id: i
|
|
1271
1480
|
};
|
|
1272
|
-
|
|
1273
|
-
const
|
|
1481
|
+
B("[CHAT] Sending payload:", r);
|
|
1482
|
+
const a = await fetch(t, {
|
|
1274
1483
|
method: "POST",
|
|
1275
1484
|
headers: {
|
|
1276
1485
|
"Content-Type": "application/json"
|
|
1277
1486
|
},
|
|
1278
|
-
body: JSON.stringify(
|
|
1487
|
+
body: JSON.stringify(r),
|
|
1279
1488
|
cache: "default"
|
|
1280
1489
|
});
|
|
1281
|
-
if (
|
|
1490
|
+
if (a.status === 429) {
|
|
1282
1491
|
try {
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1492
|
+
const w = await a.json();
|
|
1493
|
+
B("[CHAT] 429 agent at capacity:", w?.detail);
|
|
1285
1494
|
} catch {
|
|
1286
1495
|
}
|
|
1287
|
-
|
|
1496
|
+
R(""), l("Busy"), g(!1);
|
|
1288
1497
|
return;
|
|
1289
1498
|
}
|
|
1290
|
-
if (!
|
|
1499
|
+
if (!a.ok)
|
|
1291
1500
|
throw new Error("Agent request failed");
|
|
1292
|
-
const
|
|
1293
|
-
if (!
|
|
1294
|
-
|
|
1501
|
+
const f = a.body;
|
|
1502
|
+
if (!f) {
|
|
1503
|
+
l("Agent Failed"), g(!1);
|
|
1295
1504
|
return;
|
|
1296
1505
|
}
|
|
1297
|
-
const
|
|
1298
|
-
|
|
1299
|
-
const
|
|
1300
|
-
let
|
|
1506
|
+
const _ = f.getReader();
|
|
1507
|
+
xe.current = !1;
|
|
1508
|
+
const S = new TextDecoder();
|
|
1509
|
+
let L = "";
|
|
1301
1510
|
for (; ; ) {
|
|
1302
|
-
const { done:
|
|
1303
|
-
|
|
1304
|
-
`[SSE] Chunk received. done=${
|
|
1305
|
-
),
|
|
1306
|
-
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 += S.decode(A, { stream: !0 }));
|
|
1515
|
+
const G = L.split(`
|
|
1307
1516
|
|
|
1308
1517
|
`);
|
|
1309
|
-
|
|
1310
|
-
for (const
|
|
1311
|
-
|
|
1312
|
-
const
|
|
1313
|
-
|
|
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));
|
|
1314
1523
|
}
|
|
1315
|
-
if (
|
|
1316
|
-
if (
|
|
1317
|
-
const
|
|
1318
|
-
|
|
1524
|
+
if (w) {
|
|
1525
|
+
if (B("[SSE] Stream finished"), L.trim()) {
|
|
1526
|
+
const Z = Ve(L.trim());
|
|
1527
|
+
Z && tt(Z.event, Z.data);
|
|
1319
1528
|
}
|
|
1320
|
-
|
|
1529
|
+
l("Ready"), g(!1), R("");
|
|
1321
1530
|
break;
|
|
1322
1531
|
}
|
|
1323
1532
|
}
|
|
1324
|
-
} catch (
|
|
1325
|
-
console.error("Chat Error:",
|
|
1533
|
+
} catch (n) {
|
|
1534
|
+
console.error("Chat Error:", n), l("Agent Failed"), g(!1);
|
|
1326
1535
|
}
|
|
1327
|
-
},
|
|
1536
|
+
}, nn = we.trim(), Ct = Wt(nn), ft = Ct && ee ? Ct.slice(
|
|
1328
1537
|
0,
|
|
1329
|
-
|
|
1538
|
+
p != null && p > 0 ? p : 0
|
|
1330
1539
|
) : "";
|
|
1331
|
-
|
|
1332
|
-
const e =
|
|
1333
|
-
e !== "exiting" && (
|
|
1334
|
-
}, [
|
|
1335
|
-
const
|
|
1336
|
-
const e =
|
|
1337
|
-
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");
|
|
1338
1547
|
}, []);
|
|
1339
|
-
|
|
1340
|
-
const e =
|
|
1548
|
+
dn(() => {
|
|
1549
|
+
const e = wt.current;
|
|
1341
1550
|
e && (e.scrollTop = e.scrollHeight);
|
|
1342
|
-
}, [
|
|
1343
|
-
|
|
1344
|
-
|
|
1551
|
+
}, [St]);
|
|
1552
|
+
const sn = b === "female" ? kn : Ln;
|
|
1553
|
+
return /* @__PURE__ */ le("div", { className: "avatar-widget-container", children: [
|
|
1554
|
+
/* @__PURE__ */ le("div", { className: "avatar-input-area", children: [
|
|
1555
|
+
oe !== "hidden" ? /* @__PURE__ */ d(
|
|
1345
1556
|
"div",
|
|
1346
1557
|
{
|
|
1347
|
-
className: `avatar-thinking-tab${
|
|
1348
|
-
onAnimationEnd:
|
|
1349
|
-
children: Le ===
|
|
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(
|
|
1350
1561
|
"a",
|
|
1351
1562
|
{
|
|
1352
1563
|
href: "https://leads.streamoji.com",
|
|
@@ -1357,7 +1568,7 @@ const An = ({
|
|
|
1357
1568
|
) : Le
|
|
1358
1569
|
}
|
|
1359
1570
|
) : null,
|
|
1360
|
-
/* @__PURE__ */
|
|
1571
|
+
/* @__PURE__ */ d("div", { className: "avatar-input-container", children: /* @__PURE__ */ d(
|
|
1361
1572
|
"div",
|
|
1362
1573
|
{
|
|
1363
1574
|
style: {
|
|
@@ -1366,15 +1577,15 @@ const An = ({
|
|
|
1366
1577
|
width: "100%",
|
|
1367
1578
|
height: "100%"
|
|
1368
1579
|
},
|
|
1369
|
-
children:
|
|
1370
|
-
/* @__PURE__ */
|
|
1580
|
+
children: ct ? /* @__PURE__ */ le("div", { className: "avatar-input-recording", children: [
|
|
1581
|
+
/* @__PURE__ */ d(
|
|
1371
1582
|
"button",
|
|
1372
1583
|
{
|
|
1373
1584
|
type: "button",
|
|
1374
1585
|
className: "avatar-recording-cancel",
|
|
1375
|
-
onClick:
|
|
1586
|
+
onClick: Qt,
|
|
1376
1587
|
title: "Cancel",
|
|
1377
|
-
children: /* @__PURE__ */
|
|
1588
|
+
children: /* @__PURE__ */ le(
|
|
1378
1589
|
"svg",
|
|
1379
1590
|
{
|
|
1380
1591
|
width: "18",
|
|
@@ -1387,14 +1598,14 @@ const An = ({
|
|
|
1387
1598
|
strokeLinejoin: "round",
|
|
1388
1599
|
style: { display: "block" },
|
|
1389
1600
|
children: [
|
|
1390
|
-
/* @__PURE__ */
|
|
1391
|
-
/* @__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" })
|
|
1392
1603
|
]
|
|
1393
1604
|
}
|
|
1394
1605
|
)
|
|
1395
1606
|
}
|
|
1396
1607
|
),
|
|
1397
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ le(
|
|
1398
1609
|
"div",
|
|
1399
1610
|
{
|
|
1400
1611
|
style: {
|
|
@@ -1406,8 +1617,8 @@ const An = ({
|
|
|
1406
1617
|
minWidth: 0
|
|
1407
1618
|
},
|
|
1408
1619
|
children: [
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ d("div", { style: { flex: 1, height: "100%" }, children: /* @__PURE__ */ d(Nt, { analyser: zt }) }),
|
|
1621
|
+
/* @__PURE__ */ le(
|
|
1411
1622
|
"span",
|
|
1412
1623
|
{
|
|
1413
1624
|
style: {
|
|
@@ -1420,23 +1631,23 @@ const An = ({
|
|
|
1420
1631
|
fontVariantNumeric: "tabular-nums"
|
|
1421
1632
|
},
|
|
1422
1633
|
children: [
|
|
1423
|
-
Math.floor(
|
|
1634
|
+
Math.floor(At / 60),
|
|
1424
1635
|
":",
|
|
1425
|
-
String(
|
|
1636
|
+
String(At % 60).padStart(2, "0")
|
|
1426
1637
|
]
|
|
1427
1638
|
}
|
|
1428
1639
|
)
|
|
1429
1640
|
]
|
|
1430
1641
|
}
|
|
1431
1642
|
),
|
|
1432
|
-
/* @__PURE__ */
|
|
1643
|
+
/* @__PURE__ */ d(
|
|
1433
1644
|
"button",
|
|
1434
1645
|
{
|
|
1435
1646
|
type: "button",
|
|
1436
1647
|
className: "avatar-recording-confirm",
|
|
1437
|
-
onClick:
|
|
1648
|
+
onClick: Kt,
|
|
1438
1649
|
title: "Send",
|
|
1439
|
-
children: /* @__PURE__ */
|
|
1650
|
+
children: /* @__PURE__ */ d(
|
|
1440
1651
|
"svg",
|
|
1441
1652
|
{
|
|
1442
1653
|
width: "18",
|
|
@@ -1448,13 +1659,13 @@ const An = ({
|
|
|
1448
1659
|
strokeLinecap: "round",
|
|
1449
1660
|
strokeLinejoin: "round",
|
|
1450
1661
|
style: { display: "block" },
|
|
1451
|
-
children: /* @__PURE__ */
|
|
1662
|
+
children: /* @__PURE__ */ d("polyline", { points: "20 6 9 17 4 12" })
|
|
1452
1663
|
}
|
|
1453
1664
|
)
|
|
1454
1665
|
}
|
|
1455
1666
|
)
|
|
1456
|
-
] }) :
|
|
1457
|
-
/* @__PURE__ */
|
|
1667
|
+
] }) : ee && !ot ? /* @__PURE__ */ le("div", { className: "avatar-input-speaking", children: [
|
|
1668
|
+
/* @__PURE__ */ d(
|
|
1458
1669
|
"div",
|
|
1459
1670
|
{
|
|
1460
1671
|
style: {
|
|
@@ -1464,20 +1675,20 @@ const An = ({
|
|
|
1464
1675
|
alignItems: "center",
|
|
1465
1676
|
paddingRight: "8px"
|
|
1466
1677
|
},
|
|
1467
|
-
children: /* @__PURE__ */
|
|
1678
|
+
children: /* @__PURE__ */ d(Nt, { analyser: Mt })
|
|
1468
1679
|
}
|
|
1469
1680
|
),
|
|
1470
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ d(
|
|
1471
1682
|
"button",
|
|
1472
1683
|
{
|
|
1473
1684
|
type: "button",
|
|
1474
1685
|
className: "avatar-speaking-stop",
|
|
1475
|
-
onClick: () =>
|
|
1686
|
+
onClick: () => Ge(!0),
|
|
1476
1687
|
title: "Stop",
|
|
1477
|
-
children: /* @__PURE__ */
|
|
1688
|
+
children: /* @__PURE__ */ d("span", { className: "avatar-speaking-stop__icon", "aria-hidden": !0 })
|
|
1478
1689
|
}
|
|
1479
1690
|
)
|
|
1480
|
-
] }) :
|
|
1691
|
+
] }) : Q ? /* @__PURE__ */ d(
|
|
1481
1692
|
"div",
|
|
1482
1693
|
{
|
|
1483
1694
|
style: {
|
|
@@ -1487,12 +1698,12 @@ const An = ({
|
|
|
1487
1698
|
alignItems: "center",
|
|
1488
1699
|
justifyContent: "center"
|
|
1489
1700
|
},
|
|
1490
|
-
children: /* @__PURE__ */
|
|
1701
|
+
children: /* @__PURE__ */ d("div", { className: "avatar-input-loader" })
|
|
1491
1702
|
}
|
|
1492
|
-
) : /* @__PURE__ */
|
|
1703
|
+
) : /* @__PURE__ */ le(
|
|
1493
1704
|
"form",
|
|
1494
1705
|
{
|
|
1495
|
-
onSubmit:
|
|
1706
|
+
onSubmit: en,
|
|
1496
1707
|
style: {
|
|
1497
1708
|
flex: 1,
|
|
1498
1709
|
display: "flex",
|
|
@@ -1500,20 +1711,20 @@ const An = ({
|
|
|
1500
1711
|
alignItems: "center"
|
|
1501
1712
|
},
|
|
1502
1713
|
children: [
|
|
1503
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ d(
|
|
1504
1715
|
"input",
|
|
1505
1716
|
{
|
|
1506
1717
|
id: "avatar-text-input",
|
|
1507
1718
|
type: "text",
|
|
1508
|
-
value:
|
|
1509
|
-
onChange: (e) =>
|
|
1510
|
-
placeholder:
|
|
1511
|
-
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",
|
|
1512
1723
|
autoComplete: "off",
|
|
1513
1724
|
style: { width: "100%", height: "100%" }
|
|
1514
1725
|
}
|
|
1515
1726
|
),
|
|
1516
|
-
|
|
1727
|
+
j === "Busy" ? /* @__PURE__ */ d(
|
|
1517
1728
|
"button",
|
|
1518
1729
|
{
|
|
1519
1730
|
type: "button",
|
|
@@ -1521,7 +1732,7 @@ const An = ({
|
|
|
1521
1732
|
disabled: !0,
|
|
1522
1733
|
style: { backgroundColor: "#1e4a5e" },
|
|
1523
1734
|
title: "Agent at capacity",
|
|
1524
|
-
children: /* @__PURE__ */
|
|
1735
|
+
children: /* @__PURE__ */ d(
|
|
1525
1736
|
"svg",
|
|
1526
1737
|
{
|
|
1527
1738
|
width: "24",
|
|
@@ -1530,7 +1741,7 @@ const An = ({
|
|
|
1530
1741
|
fill: "none",
|
|
1531
1742
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1532
1743
|
"aria-hidden": "true",
|
|
1533
|
-
children: /* @__PURE__ */
|
|
1744
|
+
children: /* @__PURE__ */ d(
|
|
1534
1745
|
"path",
|
|
1535
1746
|
{
|
|
1536
1747
|
d: "M4 2L20 2L12 10L4 2z M12 14L4 22L20 22L12 14z",
|
|
@@ -1540,15 +1751,15 @@ const An = ({
|
|
|
1540
1751
|
}
|
|
1541
1752
|
)
|
|
1542
1753
|
}
|
|
1543
|
-
) :
|
|
1754
|
+
) : se.trim() === "" ? /* @__PURE__ */ d(
|
|
1544
1755
|
"button",
|
|
1545
1756
|
{
|
|
1546
1757
|
type: "button",
|
|
1547
1758
|
className: "mic-button",
|
|
1548
|
-
onClick:
|
|
1549
|
-
disabled:
|
|
1759
|
+
onClick: Yt,
|
|
1760
|
+
disabled: Q,
|
|
1550
1761
|
style: { backgroundColor: "#1e4a5e" },
|
|
1551
|
-
children: /* @__PURE__ */
|
|
1762
|
+
children: /* @__PURE__ */ le(
|
|
1552
1763
|
"svg",
|
|
1553
1764
|
{
|
|
1554
1765
|
width: "28",
|
|
@@ -1557,14 +1768,14 @@ const An = ({
|
|
|
1557
1768
|
fill: "none",
|
|
1558
1769
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1559
1770
|
children: [
|
|
1560
|
-
/* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ d(
|
|
1561
1772
|
"path",
|
|
1562
1773
|
{
|
|
1563
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",
|
|
1564
1775
|
fill: "white"
|
|
1565
1776
|
}
|
|
1566
1777
|
),
|
|
1567
|
-
/* @__PURE__ */
|
|
1778
|
+
/* @__PURE__ */ d(
|
|
1568
1779
|
"path",
|
|
1569
1780
|
{
|
|
1570
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",
|
|
@@ -1575,15 +1786,15 @@ const An = ({
|
|
|
1575
1786
|
}
|
|
1576
1787
|
)
|
|
1577
1788
|
}
|
|
1578
|
-
) : /* @__PURE__ */
|
|
1789
|
+
) : /* @__PURE__ */ d(
|
|
1579
1790
|
"button",
|
|
1580
1791
|
{
|
|
1581
1792
|
type: "submit",
|
|
1582
1793
|
className: "mic-button",
|
|
1583
|
-
disabled:
|
|
1794
|
+
disabled: Q,
|
|
1584
1795
|
style: { backgroundColor: "#1e4a5e" },
|
|
1585
1796
|
title: "Send",
|
|
1586
|
-
children: /* @__PURE__ */
|
|
1797
|
+
children: /* @__PURE__ */ d(
|
|
1587
1798
|
"svg",
|
|
1588
1799
|
{
|
|
1589
1800
|
width: 24,
|
|
@@ -1591,7 +1802,7 @@ const An = ({
|
|
|
1591
1802
|
viewBox: "0 0 24 24",
|
|
1592
1803
|
fill: "none",
|
|
1593
1804
|
"aria-hidden": "true",
|
|
1594
|
-
children: /* @__PURE__ */
|
|
1805
|
+
children: /* @__PURE__ */ d(
|
|
1595
1806
|
"path",
|
|
1596
1807
|
{
|
|
1597
1808
|
d: "M19 12H5M19 12L14 17M19 12L14 7",
|
|
@@ -1611,22 +1822,22 @@ const An = ({
|
|
|
1611
1822
|
}
|
|
1612
1823
|
) })
|
|
1613
1824
|
] }),
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
|
|
1825
|
+
/* @__PURE__ */ d("div", { className: "avatar-wrapper", children: /* @__PURE__ */ le("div", { className: "avatar-scene-wrapper", children: [
|
|
1826
|
+
he !== "hidden" && /* @__PURE__ */ d(
|
|
1616
1827
|
"div",
|
|
1617
1828
|
{
|
|
1618
|
-
className: `avatar-bubble${
|
|
1619
|
-
onAnimationEnd:
|
|
1620
|
-
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 })
|
|
1621
1832
|
}
|
|
1622
1833
|
),
|
|
1623
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ d(
|
|
1624
1835
|
"div",
|
|
1625
1836
|
{
|
|
1626
1837
|
className: "avatar-canvas-layer",
|
|
1627
|
-
style: { width:
|
|
1628
|
-
children: /* @__PURE__ */
|
|
1629
|
-
|
|
1838
|
+
style: { width: F, height: F },
|
|
1839
|
+
children: /* @__PURE__ */ le(
|
|
1840
|
+
cn,
|
|
1630
1841
|
{
|
|
1631
1842
|
shadows: !0,
|
|
1632
1843
|
camera: { position: [0.2, 1.4, 3], fov: 42 },
|
|
@@ -1634,30 +1845,30 @@ const An = ({
|
|
|
1634
1845
|
dpr: 1.8,
|
|
1635
1846
|
style: { pointerEvents: "none", width: "100%", height: "100%" },
|
|
1636
1847
|
children: [
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
/* @__PURE__ */
|
|
1642
|
-
|
|
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,
|
|
1643
1854
|
{
|
|
1644
|
-
avatarUrl:
|
|
1645
|
-
isPlayingRef:
|
|
1646
|
-
visemeQueueRef:
|
|
1647
|
-
audioContextRef:
|
|
1648
|
-
responseAudioStartTimeRef:
|
|
1649
|
-
adjustments:
|
|
1650
|
-
mood:
|
|
1651
|
-
expression:
|
|
1652
|
-
agentResponse:
|
|
1653
|
-
isSpeaking:
|
|
1654
|
-
nextStartTimeRef:
|
|
1655
|
-
stopPlayback:
|
|
1656
|
-
setIsSpeaking:
|
|
1657
|
-
expressionUrl:
|
|
1658
|
-
onExpressionFinished:
|
|
1659
|
-
isNudgeResponse:
|
|
1660
|
-
avatarGender:
|
|
1855
|
+
avatarUrl: Ue,
|
|
1856
|
+
isPlayingRef: U,
|
|
1857
|
+
visemeQueueRef: N,
|
|
1858
|
+
audioContextRef: O,
|
|
1859
|
+
responseAudioStartTimeRef: ye,
|
|
1860
|
+
adjustments: xn,
|
|
1861
|
+
mood: o,
|
|
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
|
|
1661
1872
|
}
|
|
1662
1873
|
) })
|
|
1663
1874
|
]
|
|
@@ -1667,20 +1878,20 @@ const An = ({
|
|
|
1667
1878
|
)
|
|
1668
1879
|
] }) })
|
|
1669
1880
|
] });
|
|
1670
|
-
},
|
|
1671
|
-
token:
|
|
1672
|
-
avatarGender:
|
|
1673
|
-
onNavigationRequested:
|
|
1674
|
-
presetUserDetails:
|
|
1675
|
-
}) => /* @__PURE__ */
|
|
1676
|
-
|
|
1881
|
+
}, Wn = ({
|
|
1882
|
+
token: m,
|
|
1883
|
+
avatarGender: T,
|
|
1884
|
+
onNavigationRequested: y,
|
|
1885
|
+
presetUserDetails: b
|
|
1886
|
+
}) => /* @__PURE__ */ d(
|
|
1887
|
+
Cn,
|
|
1677
1888
|
{
|
|
1678
|
-
token:
|
|
1679
|
-
onNavigationRequested:
|
|
1680
|
-
avatarGender:
|
|
1681
|
-
presetUserDetails:
|
|
1889
|
+
token: m,
|
|
1890
|
+
onNavigationRequested: y,
|
|
1891
|
+
avatarGender: T,
|
|
1892
|
+
presetUserDetails: b
|
|
1682
1893
|
}
|
|
1683
1894
|
);
|
|
1684
1895
|
export {
|
|
1685
|
-
|
|
1896
|
+
Wn as AvatarWidget
|
|
1686
1897
|
};
|