@sage-rsc/talking-head-react 1.0.59 → 1.0.61
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/index.cjs +2 -2
- package/dist/index.js +355 -360
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +3 -5
- package/src/components/TalkingHeadAvatar.jsx +56 -32
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as Me, jsx as he } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ie, useRef as X, useState as ue, useEffect as pe, useCallback as T, useImperativeHandle as Le, useLayoutEffect as Ne } from "react";
|
|
3
3
|
import * as f from "three";
|
|
4
|
-
import { OrbitControls as
|
|
5
|
-
import { GLTFLoader as
|
|
6
|
-
import { DRACOLoader as
|
|
7
|
-
import { FBXLoader as
|
|
8
|
-
import { RoomEnvironment as
|
|
9
|
-
import
|
|
10
|
-
let m, K,
|
|
11
|
-
const L = [0, 0, 0, 0], k = new f.Vector3(),
|
|
4
|
+
import { OrbitControls as Ue } from "three/addons/controls/OrbitControls.js";
|
|
5
|
+
import { GLTFLoader as We } from "three/addons/loaders/GLTFLoader.js";
|
|
6
|
+
import { DRACOLoader as Ve } from "three/addons/loaders/DRACOLoader.js";
|
|
7
|
+
import { FBXLoader as we } from "three/addons/loaders/FBXLoader.js";
|
|
8
|
+
import { RoomEnvironment as Ge } from "three/addons/environments/RoomEnvironment.js";
|
|
9
|
+
import Ze from "three/addons/libs/stats.module.js";
|
|
10
|
+
let m, K, ee;
|
|
11
|
+
const L = [0, 0, 0, 0], k = new f.Vector3(), be = new f.Vector3(), Q = new f.Vector3(), ve = new f.Vector3();
|
|
12
12
|
new f.Plane();
|
|
13
13
|
new f.Ray();
|
|
14
14
|
new f.Euler();
|
|
15
|
-
const q = new f.Quaternion(),
|
|
15
|
+
const q = new f.Quaternion(), ze = new f.Quaternion(), oe = new f.Matrix4(), se = new f.Matrix4();
|
|
16
16
|
new f.Vector3();
|
|
17
|
-
const
|
|
18
|
-
class
|
|
17
|
+
const Re = new f.Vector3(0, 0, 1), Xe = new f.Vector3(1, 0, 0), Ye = new f.Vector3(0, 1, 0), je = new f.Vector3(0, 0, 1);
|
|
18
|
+
class Qe {
|
|
19
19
|
constructor(t = null) {
|
|
20
20
|
this.opt = Object.assign({
|
|
21
21
|
warmupMs: 2e3,
|
|
@@ -338,7 +338,7 @@ class je {
|
|
|
338
338
|
ea: [0, 0, 0, 0]
|
|
339
339
|
// External acceleration [m/s^2]
|
|
340
340
|
};
|
|
341
|
-
h.boneParent.matrixWorld.decompose(k, q, Q), k.copy(
|
|
341
|
+
h.boneParent.matrixWorld.decompose(k, q, Q), k.copy(Re).applyQuaternion(q).setY(0).normalize(), q.premultiply(ze.setFromUnitVectors(Re, k).invert()).normalize(), h.qWorldInverseYaw = q.clone().normalize(), this.data.push(h), this.dict[u] = h;
|
|
342
342
|
try {
|
|
343
343
|
this.setValue(u, "type", s.type), this.setValue(u, "stiffness", s.stiffness), this.setValue(u, "damping", s.damping), this.setValue(u, "external", s.external), this.setValue(u, "limits", s.limits), this.setValue(u, "excludes", s.excludes), this.setValue(u, "deltaLocal", s.deltaLocal), this.setValue(u, "deltaWorld", s.deltaWorld), this.setValue(u, "pivot", s.pivot), this.setValue(u, "helper", s.helper);
|
|
344
344
|
} catch (r) {
|
|
@@ -369,9 +369,9 @@ class je {
|
|
|
369
369
|
o.vBasis.y + L[1],
|
|
370
370
|
o.vBasis.z - L[2]
|
|
371
371
|
);
|
|
372
|
-
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(k, q, Q), k.copy(
|
|
372
|
+
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(k, q, Q), k.copy(Re).applyQuaternion(q).setY(0).normalize(), q.premultiply(ze.setFromUnitVectors(Re, k).invert()).normalize(), o.boneParent.quaternion.multiply(q.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(L[0] / o.l), q.setFromAxisAngle(je, -m), o.boneParent.quaternion.multiply(q)), o.isY && (m = o.l / 3, m = m * Math.tanh(L[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(L[2] / o.l), q.setFromAxisAngle(Xe, -m), o.boneParent.quaternion.multiply(q)), o.isT && (m = 1.5 * Math.tanh(L[3] * 1.5), q.setFromAxisAngle(Ye, -m), o.boneParent.quaternion.multiply(q)), o.boneParent.updateWorldMatrix(!1, !0), o.excludes && this.opt.isExcludes)
|
|
373
373
|
for (i = 0, s = o.excludes.length; i < s; i++)
|
|
374
|
-
m = o.excludes[i], Q.set(0, 0, 0), m.deltaLocal && (Q.x += m.deltaLocal[0], Q.y += m.deltaLocal[1], Q.z += m.deltaLocal[2]), Q.applyMatrix4(m.bone.matrixWorld), se.copy(o.boneParent.matrixWorld).invert(), Q.applyMatrix4(se), k.copy(o.bone.position), !(k.distanceToSquared(Q) >= m.radiusSq) && (
|
|
374
|
+
m = o.excludes[i], Q.set(0, 0, 0), m.deltaLocal && (Q.x += m.deltaLocal[0], Q.y += m.deltaLocal[1], Q.z += m.deltaLocal[2]), Q.applyMatrix4(m.bone.matrixWorld), se.copy(o.boneParent.matrixWorld).invert(), Q.applyMatrix4(se), k.copy(o.bone.position), !(k.distanceToSquared(Q) >= m.radiusSq) && (ee = k.length(), K = Q.length(), !(K > m.radius + ee) && (K < Math.abs(m.radius - ee) || (K = (K * K + ee * ee - m.radiusSq) / (2 * K), Q.normalize(), ve.copy(Q).multiplyScalar(K), K = Math.sqrt(ee * ee - K * K), k.subVectors(k, ve).projectOnPlane(Q).normalize().multiplyScalar(K), be.subVectors(o.vBasis, ve).projectOnPlane(Q).normalize(), ee = be.dot(k), ee < 0 && (ee = Math.sqrt(K * K - ee * ee), be.multiplyScalar(ee), k.add(be)), k.add(ve).normalize(), Q.copy(o.bone.position).normalize(), q.setFromUnitVectors(Q, k), o.boneParent.quaternion.premultiply(q), o.boneParent.updateWorldMatrix(!1, !0))));
|
|
375
375
|
}
|
|
376
376
|
this.helpers.isActive && this.updateHelpers();
|
|
377
377
|
}
|
|
@@ -489,7 +489,7 @@ class je {
|
|
|
489
489
|
this.stop(), this.scene = null, this.armature = null, this.config = [], this.data = [], this.dict = {}, this.objectsUpdate = [], this.timerMs = 0;
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
|
-
class
|
|
492
|
+
class qe {
|
|
493
493
|
constructor(t) {
|
|
494
494
|
this.audioContext = t, this.analyzer = null, this.dataArray = null, this.bufferLength = 0;
|
|
495
495
|
}
|
|
@@ -814,7 +814,7 @@ class Qe {
|
|
|
814
814
|
return n * s;
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class _e {
|
|
818
818
|
/**
|
|
819
819
|
* @constructor
|
|
820
820
|
*/
|
|
@@ -1396,11 +1396,11 @@ class qe {
|
|
|
1396
1396
|
return e;
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
const
|
|
1399
|
+
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1400
1400
|
__proto__: null,
|
|
1401
|
-
LipsyncEn:
|
|
1401
|
+
LipsyncEn: _e
|
|
1402
1402
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1403
|
-
class
|
|
1403
|
+
class Je {
|
|
1404
1404
|
/**
|
|
1405
1405
|
* @constructor
|
|
1406
1406
|
*/
|
|
@@ -1754,11 +1754,11 @@ class Ke {
|
|
|
1754
1754
|
return e;
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1758
1758
|
__proto__: null,
|
|
1759
|
-
LipsyncDe:
|
|
1759
|
+
LipsyncDe: Je
|
|
1760
1760
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1761
|
-
class
|
|
1761
|
+
class et {
|
|
1762
1762
|
/**
|
|
1763
1763
|
* @constructor
|
|
1764
1764
|
*/
|
|
@@ -2289,11 +2289,11 @@ class $e {
|
|
|
2289
2289
|
return e;
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
|
-
const
|
|
2292
|
+
const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2293
2293
|
__proto__: null,
|
|
2294
|
-
LipsyncFr:
|
|
2294
|
+
LipsyncFr: et
|
|
2295
2295
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2296
|
-
class
|
|
2296
|
+
class it {
|
|
2297
2297
|
/**
|
|
2298
2298
|
* @constructor
|
|
2299
2299
|
*/
|
|
@@ -2436,11 +2436,11 @@ class tt {
|
|
|
2436
2436
|
return e;
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
const
|
|
2439
|
+
const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2440
2440
|
__proto__: null,
|
|
2441
|
-
LipsyncFi:
|
|
2441
|
+
LipsyncFi: it
|
|
2442
2442
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2443
|
-
class
|
|
2443
|
+
class ot {
|
|
2444
2444
|
/**
|
|
2445
2445
|
* @constructor
|
|
2446
2446
|
*/
|
|
@@ -2620,24 +2620,24 @@ class nt {
|
|
|
2620
2620
|
return e;
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
|
-
const
|
|
2623
|
+
const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2624
2624
|
__proto__: null,
|
|
2625
|
-
LipsyncLt:
|
|
2626
|
-
}, Symbol.toStringTag, { value: "Module" })), st = new URL("data:text/javascript;base64,Y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5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgIC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iB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), ze = {
|
|
2627
|
-
en:
|
|
2628
|
-
de:
|
|
2629
|
-
fr:
|
|
2630
|
-
fi:
|
|
2631
|
-
lt:
|
|
2632
|
-
},
|
|
2625
|
+
LipsyncLt: ot
|
|
2626
|
+
}, Symbol.toStringTag, { value: "Module" })), at = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25zdCBzaWxlbmNlRHVyYXRpb25TZWNvbmRzID0gMS4wOwogICAgdGhpcy5fc2lsZW5jZVRocmVzaG9sZEJsb2NrcyA9IE1hdGguY2VpbCgodGhpcy5fc2FtcGxlUmF0ZSAqIHNpbGVuY2VEdXJhdGlvblNlY29uZHMpIC8gMTI4KTsKCiAgICAvLyBNZXRyaWNzIGNvbmZpZ3VyYXRpb24gdmlhIG9wdGlvbnMKICAgIGNvbnN0IG1ldHJpY3NDZmcgP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Ll9zaWxlbmNlRnJhbWVzQ291bnQgPiB0aGlzLl9zaWxlbmNlVGhyZXNob2xkQmxvY2tzOwoKICAgICAgICAgIGlmICh0aGlzLl9ub01vcmVEYXRhUmVjZWl2ZWQgfHwgaXNUaW1lZE91dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmc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m9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Ce = {
|
|
2627
|
+
en: Ke,
|
|
2628
|
+
de: $e,
|
|
2629
|
+
fr: tt,
|
|
2630
|
+
fi: nt,
|
|
2631
|
+
lt: st
|
|
2632
|
+
}, W = new f.Quaternion(), M = new f.Euler(), re = new f.Vector3(), le = new f.Vector3(), He = new f.Box3();
|
|
2633
2633
|
new f.Matrix4();
|
|
2634
2634
|
new f.Matrix4();
|
|
2635
2635
|
new f.Vector3();
|
|
2636
2636
|
new f.Vector3(0, 0, 1);
|
|
2637
|
-
const
|
|
2637
|
+
const rt = new f.Vector3(1, 0, 0);
|
|
2638
2638
|
new f.Vector3(0, 1, 0);
|
|
2639
2639
|
new f.Vector3(0, 0, 1);
|
|
2640
|
-
class
|
|
2640
|
+
class Ee {
|
|
2641
2641
|
/**
|
|
2642
2642
|
* Avatar.
|
|
2643
2643
|
* @typedef {Object} Avatar
|
|
@@ -2763,7 +2763,7 @@ class Me {
|
|
|
2763
2763
|
avatarOnlyCamera: null,
|
|
2764
2764
|
statsNode: null,
|
|
2765
2765
|
statsStyle: null
|
|
2766
|
-
}, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new
|
|
2766
|
+
}, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new Ze(), this.opt.statsStyle && (this.stats.dom.style.cssText = this.opt.statsStyle), this.opt.statsNode.appendChild(this.stats.dom)), this.poseTemplates = {
|
|
2767
2767
|
side: {
|
|
2768
2768
|
standing: !0,
|
|
2769
2769
|
props: {
|
|
@@ -4062,7 +4062,7 @@ class Me {
|
|
|
4062
4062
|
this.opt.lightSpotDispersion
|
|
4063
4063
|
), this.setLighting(this.opt);
|
|
4064
4064
|
const l = new f.PMREMGenerator(this.renderer);
|
|
4065
|
-
l.compileEquirectangularShader(), this.scene.environment = l.fromScene(new
|
|
4065
|
+
l.compileEquirectangularShader(), this.scene.environment = l.fromScene(new Ge()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Ue(this.camera, this.renderer.domElement), this.controls.enableZoom = this.opt.cameraZoomEnable, this.controls.enableRotate = this.opt.cameraRotateEnable, this.controls.enablePan = this.opt.cameraPanEnable, this.controls.minDistance = 2, this.controls.maxDistance = 2e3, this.controls.autoRotateSpeed = 0, this.controls.autoRotate = !1, this.controls.update(), this.cameraClock = null;
|
|
4066
4066
|
}
|
|
4067
4067
|
this.ikMesh = new f.SkinnedMesh();
|
|
4068
4068
|
const s = {
|
|
@@ -4080,14 +4080,14 @@ class Me {
|
|
|
4080
4080
|
Object.entries(s).forEach((l, u) => {
|
|
4081
4081
|
const a = new f.Bone();
|
|
4082
4082
|
a.name = l[0], l[1] ? this.ikMesh.getObjectByName(l[1]).add(a) : this.ikMesh.add(a), o.push(a);
|
|
4083
|
-
}), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new
|
|
4083
|
+
}), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new Qe(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
|
|
4084
4084
|
}
|
|
4085
4085
|
/**
|
|
4086
4086
|
* Helper that re/creates the audio context and the other nodes.
|
|
4087
4087
|
* @param {number} sampleRate
|
|
4088
4088
|
*/
|
|
4089
4089
|
initAudioGraph(t = null) {
|
|
4090
|
-
if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new
|
|
4090
|
+
if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new qe(this.audioCtx), this.audioReverbNode = this.audioCtx.createConvolver(), this.audioBackgroundGainNode.connect(this.audioReverbNode), this.audioAnalyzerNode.connect(this.audioSpeechGainNode), this.audioSpeechGainNode.connect(this.audioReverbNode), this.audioStreamGainNode.connect(this.audioReverbNode), this.audioReverbNode.connect(this.audioCtx.destination), this.setReverb(this.currentReverb || null), this.setMixerGain(
|
|
4091
4091
|
this.opt.mixerGainSpeech,
|
|
4092
4092
|
this.opt.mixerGainBackground
|
|
4093
4093
|
), this.workletLoaded = !1, this.streamWorkletNode) {
|
|
@@ -4228,9 +4228,9 @@ class Me {
|
|
|
4228
4228
|
async showAvatar(t, e = null) {
|
|
4229
4229
|
if (!t || !t.hasOwnProperty("url"))
|
|
4230
4230
|
throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
|
|
4231
|
-
const i = new
|
|
4231
|
+
const i = new We();
|
|
4232
4232
|
if (this.dracoEnabled) {
|
|
4233
|
-
const a = new
|
|
4233
|
+
const a = new Ve();
|
|
4234
4234
|
a.setDecoderPath(this.dracoDecoderPath), i.setDRACOLoader(a);
|
|
4235
4235
|
}
|
|
4236
4236
|
let n = await i.loadAsync(t.url, e);
|
|
@@ -4376,7 +4376,7 @@ class Me {
|
|
|
4376
4376
|
if (e.x === 0 && e.y === 0 && e.z === 0) continue;
|
|
4377
4377
|
M.set(e.x, e.y, e.z);
|
|
4378
4378
|
const i = this.poseAvatar.props[t];
|
|
4379
|
-
i.isQuaternion ? (
|
|
4379
|
+
i.isQuaternion ? (W.setFromEuler(M), i.multiply(W)) : i.isVector3 && i.add(M);
|
|
4380
4380
|
}
|
|
4381
4381
|
}
|
|
4382
4382
|
/**
|
|
@@ -5180,7 +5180,7 @@ class Me {
|
|
|
5180
5180
|
eyeLookOutRight: [null, 0],
|
|
5181
5181
|
eyeContact: [0]
|
|
5182
5182
|
}
|
|
5183
|
-
})))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (i = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], n = this.mtAvatar[i], n.needsUpdate || Object.assign(n, { base: (this.mood.baseline[i] || 0) + (1 + l / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && u ? l > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = l) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), i = this.volumeHeadTarget - this.volumeHeadCurrent, n = Math.abs(i), n > 1e-4 && (o = n * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / n) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(i) * Math.min(n, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (
|
|
5183
|
+
})))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (i = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], n = this.mtAvatar[i], n.needsUpdate || Object.assign(n, { base: (this.mood.baseline[i] || 0) + (1 + l / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && u ? l > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = l) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), i = this.volumeHeadTarget - this.volumeHeadCurrent, n = Math.abs(i), n > 1e-4 && (o = n * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / n) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(i) * Math.min(n, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (W.setFromAxisAngle(rt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(W)), He.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(re), re.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(le), le.sub(this.armature.position), this.objectHips.position.y -= He.min.y / 2, this.objectHips.position.x -= (re.x + le.x) / 4, this.objectHips.position.z -= (re.z + le.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
|
|
5184
5184
|
this.stats && this.stats.end();
|
|
5185
5185
|
else {
|
|
5186
5186
|
if (this.cameraClock !== null && this.cameraClock < 1e3) {
|
|
@@ -5211,8 +5211,8 @@ class Me {
|
|
|
5211
5211
|
if (!this.lipsync.hasOwnProperty(t)) {
|
|
5212
5212
|
const i = t.toLowerCase(), n = "Lipsync" + t.charAt(0).toUpperCase() + t.slice(1);
|
|
5213
5213
|
try {
|
|
5214
|
-
const s =
|
|
5215
|
-
s && s[n] ? (this.lipsync[t] = new s[n](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(
|
|
5214
|
+
const s = Ce[i];
|
|
5215
|
+
s && s[n] ? (this.lipsync[t] = new s[n](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(Ce));
|
|
5216
5216
|
} catch (s) {
|
|
5217
5217
|
console.warn(`Failed to load lip-sync module for ${t}:`, s);
|
|
5218
5218
|
}
|
|
@@ -5251,10 +5251,10 @@ class Me {
|
|
|
5251
5251
|
let h = "", r = "", c = 0, d = [], g = [];
|
|
5252
5252
|
const y = Array.from(this.segmenter.segment(t), (x) => x.segment);
|
|
5253
5253
|
for (let x = 0; x < y.length; x++) {
|
|
5254
|
-
const I = x === y.length - 1,
|
|
5254
|
+
const I = x === y.length - 1, E = y[x].match(l);
|
|
5255
5255
|
let p = y[x].match(s);
|
|
5256
5256
|
const H = y[x].match(u), z = y[x].match(o);
|
|
5257
|
-
if (p && !I && !H && y[x + 1].match(s) && (p = !1), i && (h += y[x]),
|
|
5257
|
+
if (p && !I && !H && y[x + 1].match(s) && (p = !1), i && (h += y[x]), E && (!n || n.every((v) => x < v[0] || x > v[1])) && (r += y[x]), (z || p || I) && (r.length && (r = this.lipsyncPreProcessText(r, a), r.length && d.push({
|
|
5258
5258
|
mark: c,
|
|
5259
5259
|
word: r
|
|
5260
5260
|
})), h.length && (g.push({
|
|
@@ -5267,14 +5267,14 @@ class Me {
|
|
|
5267
5267
|
}), h = ""), r.length)) {
|
|
5268
5268
|
const v = this.lipsyncWordsToVisemes(r, a);
|
|
5269
5269
|
if (v && v.visemes && v.visemes.length) {
|
|
5270
|
-
const
|
|
5271
|
-
for (let
|
|
5270
|
+
const N = v.times[v.visemes.length - 1] + v.durations[v.visemes.length - 1];
|
|
5271
|
+
for (let D = 0; D < v.visemes.length; D++)
|
|
5272
5272
|
g.push({
|
|
5273
5273
|
mark: c,
|
|
5274
5274
|
template: { name: "viseme" },
|
|
5275
|
-
ts: [(v.times[
|
|
5275
|
+
ts: [(v.times[D] - 0.6) / N, (v.times[D] + 0.5) / N, (v.times[D] + v.durations[D] + 0.5) / N],
|
|
5276
5276
|
vs: {
|
|
5277
|
-
["viseme_" + v.visemes[
|
|
5277
|
+
["viseme_" + v.visemes[D]]: [null, v.visemes[D] === "PP" || v.visemes[D] === "FF" ? 0.9 : 0.6, 0]
|
|
5278
5278
|
}
|
|
5279
5279
|
});
|
|
5280
5280
|
}
|
|
@@ -5385,10 +5385,10 @@ class Me {
|
|
|
5385
5385
|
let y = 0.6 + this.convertRange(g, [0, h], [0, 0.4]);
|
|
5386
5386
|
if (h = Math.min(h, c.visemes.length * 200), d > 0)
|
|
5387
5387
|
for (let x = 0; x < c.visemes.length; x++) {
|
|
5388
|
-
const I = a + c.times[x] / d * h,
|
|
5388
|
+
const I = a + c.times[x] / d * h, E = c.durations[x] / d * h;
|
|
5389
5389
|
o.push({
|
|
5390
5390
|
template: { name: "viseme" },
|
|
5391
|
-
ts: [I - Math.min(60, 2 *
|
|
5391
|
+
ts: [I - Math.min(60, 2 * E / 3), I + Math.min(25, E / 2), I + E + Math.min(60, E / 2)],
|
|
5392
5392
|
vs: {
|
|
5393
5393
|
["viseme_" + c.visemes[x]]: [null, c.visemes[x] === "PP" || c.visemes[x] === "FF" ? 0.9 : y, 0]
|
|
5394
5394
|
}
|
|
@@ -5486,18 +5486,18 @@ class Me {
|
|
|
5486
5486
|
if (x && x.visemes && x.visemes.length > 0) {
|
|
5487
5487
|
const p = x.times[x.visemes.length - 1] + x.durations[x.visemes.length - 1];
|
|
5488
5488
|
for (let H = 0; H < x.visemes.length; H++) {
|
|
5489
|
-
const z = x.visemes[H], v = x.times[H] / p,
|
|
5489
|
+
const z = x.visemes[H], v = x.times[H] / p, N = x.durations[H] / p, D = v * c, J = N * c;
|
|
5490
5490
|
I.push({
|
|
5491
5491
|
template: { name: "viseme" },
|
|
5492
|
-
ts: [
|
|
5492
|
+
ts: [D - Math.min(60, 2 * J / 3), D + Math.min(25, J / 2), D + J + Math.min(60, J / 2)],
|
|
5493
5493
|
vs: {
|
|
5494
5494
|
["viseme_" + z]: [null, z === "PP" || z === "FF" ? 0.9 : 0.6, 0]
|
|
5495
5495
|
}
|
|
5496
5496
|
});
|
|
5497
5497
|
}
|
|
5498
5498
|
}
|
|
5499
|
-
const
|
|
5500
|
-
this.audioPlaylist.push({ anim:
|
|
5499
|
+
const E = [...t.anim, ...I];
|
|
5500
|
+
this.audioPlaylist.push({ anim: E, audio: d }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
|
|
5501
5501
|
e();
|
|
5502
5502
|
}, s.onerror = (p) => {
|
|
5503
5503
|
console.error("Speech synthesis error:", p.error), i(p.error);
|
|
@@ -5895,7 +5895,7 @@ class Me {
|
|
|
5895
5895
|
}
|
|
5896
5896
|
if (!this.workletLoaded)
|
|
5897
5897
|
try {
|
|
5898
|
-
const l = this.audioCtx.audioWorklet.addModule(
|
|
5898
|
+
const l = this.audioCtx.audioWorklet.addModule(at.href), u = new Promise(
|
|
5899
5899
|
(a, h) => setTimeout(() => h(new Error("Worklet loading timed out")), 5e3)
|
|
5900
5900
|
);
|
|
5901
5901
|
await Promise.race([l, u]), this.workletLoaded = !0;
|
|
@@ -6133,7 +6133,7 @@ class Me {
|
|
|
6133
6133
|
*/
|
|
6134
6134
|
lookAtCamera(t) {
|
|
6135
6135
|
let e;
|
|
6136
|
-
if (this.speakTo && (e = new f.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0),
|
|
6136
|
+
if (this.speakTo && (e = new f.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), re.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), le.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(re, le).divideScalar(2)) : this.speakTo.isObject3D ? this.speakTo.getWorldPosition(e) : this.speakTo.isVector3 ? e.set(this.speakTo) : this.speakTo.x && this.speakTo.y && this.speakTo.z && e.set(this.speakTo.x, this.speakTo.y, this.speakTo.z)), !e) {
|
|
6137
6137
|
if (this.avatar.hasOwnProperty("avatarIgnoreCamera")) {
|
|
6138
6138
|
if (this.avatar.avatarIgnoreCamera) {
|
|
6139
6139
|
this.lookAhead(t);
|
|
@@ -6146,10 +6146,10 @@ class Me {
|
|
|
6146
6146
|
this.lookAt(null, null, t);
|
|
6147
6147
|
return;
|
|
6148
6148
|
}
|
|
6149
|
-
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0),
|
|
6150
|
-
const i = new f.Vector3().subVectors(e,
|
|
6149
|
+
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), re.setFromMatrixPosition(this.objectLeftEye.matrixWorld), le.setFromMatrixPosition(this.objectRightEye.matrixWorld), re.add(le).divideScalar(2), W.copy(this.armature.quaternion), W.multiply(this.poseTarget.props["Hips.quaternion"]), W.multiply(this.poseTarget.props["Spine.quaternion"]), W.multiply(this.poseTarget.props["Spine1.quaternion"]), W.multiply(this.poseTarget.props["Spine2.quaternion"]), W.multiply(this.poseTarget.props["Neck.quaternion"]), W.multiply(this.poseTarget.props["Head.quaternion"]);
|
|
6150
|
+
const i = new f.Vector3().subVectors(e, re).normalize(), n = Math.atan2(i.x, i.z), s = Math.asin(-i.y);
|
|
6151
6151
|
M.set(s, n, 0, "YXZ");
|
|
6152
|
-
const l = new f.Quaternion().setFromEuler(M), u = new f.Quaternion().copy(l).multiply(
|
|
6152
|
+
const l = new f.Quaternion().setFromEuler(M), u = new f.Quaternion().copy(l).multiply(W.clone().invert());
|
|
6153
6153
|
M.setFromQuaternion(u, "YXZ");
|
|
6154
6154
|
let a = M.x / (40 / 24) + 0.2, h = M.y / (9 / 4), r = Math.min(0.6, Math.max(-0.3, a)), c = Math.min(0.8, Math.max(-0.8, h)), d = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
|
|
6155
6155
|
if (t) {
|
|
@@ -6186,10 +6186,10 @@ class Me {
|
|
|
6186
6186
|
const s = new f.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new f.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), l = new f.Vector3().addVectors(s, o).divideScalar(2);
|
|
6187
6187
|
l.project(this.camera);
|
|
6188
6188
|
let u = (l.x + 1) / 2 * n.width + n.left, a = -(l.y - 1) / 2 * n.height + n.top;
|
|
6189
|
-
t === null && (t = u), e === null && (e = a),
|
|
6189
|
+
t === null && (t = u), e === null && (e = a), W.copy(this.armature.quaternion), W.multiply(this.poseTarget.props["Hips.quaternion"]), W.multiply(this.poseTarget.props["Spine.quaternion"]), W.multiply(this.poseTarget.props["Spine1.quaternion"]), W.multiply(this.poseTarget.props["Spine2.quaternion"]), W.multiply(this.poseTarget.props["Neck.quaternion"]), W.multiply(this.poseTarget.props["Head.quaternion"]), M.setFromQuaternion(W);
|
|
6190
6190
|
let h = M.x / (40 / 24), r = M.y / (9 / 4), c = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - u, u), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - h + c, I = this.convertRange(t, [u - g, u + g], [-0.8, 0.8]) - r + d;
|
|
6191
6191
|
x = Math.min(0.6, Math.max(-0.3, x)), I = Math.min(0.8, Math.max(-0.8, I));
|
|
6192
|
-
let
|
|
6192
|
+
let E = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
|
|
6193
6193
|
if (i) {
|
|
6194
6194
|
let H = this.animQueue.findIndex((v) => v.template.name === "lookat");
|
|
6195
6195
|
H !== -1 && this.animQueue.splice(H, 1);
|
|
@@ -6197,9 +6197,9 @@ class Me {
|
|
|
6197
6197
|
name: "lookat",
|
|
6198
6198
|
dt: [750, i],
|
|
6199
6199
|
vs: {
|
|
6200
|
-
bodyRotateX: [x +
|
|
6200
|
+
bodyRotateX: [x + E],
|
|
6201
6201
|
bodyRotateY: [I + p],
|
|
6202
|
-
eyesRotateX: [-3 *
|
|
6202
|
+
eyesRotateX: [-3 * E + 0.1],
|
|
6203
6203
|
eyesRotateY: [-5 * p],
|
|
6204
6204
|
browInnerUp: [[0, 0.7]],
|
|
6205
6205
|
mouthLeft: [[0, 0.7]],
|
|
@@ -6403,7 +6403,7 @@ class Me {
|
|
|
6403
6403
|
} catch (c) {
|
|
6404
6404
|
console.warn(`Could not verify file existence for ${t}, attempting to load anyway:`, c);
|
|
6405
6405
|
}
|
|
6406
|
-
const h = new
|
|
6406
|
+
const h = new we();
|
|
6407
6407
|
let r;
|
|
6408
6408
|
try {
|
|
6409
6409
|
r = await h.loadAsync(t, e);
|
|
@@ -6480,7 +6480,7 @@ class Me {
|
|
|
6480
6480
|
let l = this.animQueue.find((u) => u.template.name === "pose");
|
|
6481
6481
|
l && (l.ts[0] = this.animClock + i * 1e3 + 2e3), this.setPoseFromTemplate(o);
|
|
6482
6482
|
} else {
|
|
6483
|
-
let u = await new
|
|
6483
|
+
let u = await new we().loadAsync(t, e);
|
|
6484
6484
|
if (u && u.animations && u.animations[n]) {
|
|
6485
6485
|
let a = u.animations[n];
|
|
6486
6486
|
const h = {};
|
|
@@ -6577,12 +6577,12 @@ class Me {
|
|
|
6577
6577
|
const x = t.iterations || 10;
|
|
6578
6578
|
if (e)
|
|
6579
6579
|
for (let I = 0; I < x; I++) {
|
|
6580
|
-
let
|
|
6580
|
+
let E = !1;
|
|
6581
6581
|
for (let p = 0, H = y.length; p < H; p++) {
|
|
6582
6582
|
const z = y[p].bone;
|
|
6583
6583
|
z.matrixWorld.decompose(u, a, h), a.invert(), o.setFromMatrixPosition(g.matrixWorld), l.subVectors(o, u), l.applyQuaternion(a), l.normalize(), s.subVectors(e, u), s.applyQuaternion(a), s.normalize();
|
|
6584
6584
|
let v = s.dot(l);
|
|
6585
|
-
v > 1 ? v = 1 : v < -1 && (v = -1), v = Math.acos(v), !(v < 1e-5) && (y[p].minAngle !== void 0 && v < y[p].minAngle && (v = y[p].minAngle), y[p].maxAngle !== void 0 && v > y[p].maxAngle && (v = y[p].maxAngle), r.crossVectors(l, s), r.normalize(),
|
|
6585
|
+
v > 1 ? v = 1 : v < -1 && (v = -1), v = Math.acos(v), !(v < 1e-5) && (y[p].minAngle !== void 0 && v < y[p].minAngle && (v = y[p].minAngle), y[p].maxAngle !== void 0 && v > y[p].maxAngle && (v = y[p].maxAngle), r.crossVectors(l, s), r.normalize(), W.setFromAxisAngle(r, v), z.quaternion.multiply(W), z.rotation.setFromVector3(c.setFromEuler(z.rotation).clamp(new f.Vector3(
|
|
6586
6586
|
y[p].minx !== void 0 ? y[p].minx : -1 / 0,
|
|
6587
6587
|
y[p].miny !== void 0 ? y[p].miny : -1 / 0,
|
|
6588
6588
|
y[p].minz !== void 0 ? y[p].minz : -1 / 0
|
|
@@ -6590,9 +6590,9 @@ class Me {
|
|
|
6590
6590
|
y[p].maxx !== void 0 ? y[p].maxx : 1 / 0,
|
|
6591
6591
|
y[p].maxy !== void 0 ? y[p].maxy : 1 / 0,
|
|
6592
6592
|
y[p].maxz !== void 0 ? y[p].maxz : 1 / 0
|
|
6593
|
-
))), z.updateMatrixWorld(!0),
|
|
6593
|
+
))), z.updateMatrixWorld(!0), E = !0);
|
|
6594
6594
|
}
|
|
6595
|
-
if (!
|
|
6595
|
+
if (!E) break;
|
|
6596
6596
|
}
|
|
6597
6597
|
n && y.forEach((I) => {
|
|
6598
6598
|
this.poseTarget.props[I.link + ".quaternion"].copy(I.bone.quaternion), this.poseTarget.props[I.link + ".quaternion"].t = this.animClock, this.poseTarget.props[I.link + ".quaternion"].d = n;
|
|
@@ -6625,7 +6625,7 @@ const me = {
|
|
|
6625
6625
|
josh: "VR6AewLTigWG4xSOukaG"
|
|
6626
6626
|
// Male, American
|
|
6627
6627
|
}
|
|
6628
|
-
},
|
|
6628
|
+
}, Te = {
|
|
6629
6629
|
defaultVoice: "aura-2-thalia-en",
|
|
6630
6630
|
// Thalia (Female, English)
|
|
6631
6631
|
voices: {
|
|
@@ -6645,7 +6645,7 @@ const me = {
|
|
|
6645
6645
|
// Male, English - Powerful
|
|
6646
6646
|
}
|
|
6647
6647
|
};
|
|
6648
|
-
function
|
|
6648
|
+
function Ae() {
|
|
6649
6649
|
return {
|
|
6650
6650
|
service: "elevenlabs",
|
|
6651
6651
|
endpoint: me.endpoint,
|
|
@@ -6654,17 +6654,17 @@ function Le() {
|
|
|
6654
6654
|
voices: me.voices
|
|
6655
6655
|
};
|
|
6656
6656
|
}
|
|
6657
|
-
function
|
|
6658
|
-
const
|
|
6659
|
-
return Object.entries(
|
|
6657
|
+
function bt() {
|
|
6658
|
+
const O = Ae(), t = [];
|
|
6659
|
+
return Object.entries(O.voices).forEach(([e, i]) => {
|
|
6660
6660
|
t.push({
|
|
6661
6661
|
value: i,
|
|
6662
|
-
label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${
|
|
6662
|
+
label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${O.service})`
|
|
6663
6663
|
});
|
|
6664
6664
|
}), t;
|
|
6665
6665
|
}
|
|
6666
|
-
const
|
|
6667
|
-
avatarUrl:
|
|
6666
|
+
const Fe = Ie(({
|
|
6667
|
+
avatarUrl: O = "/avatars/brunette.glb",
|
|
6668
6668
|
avatarBody: t = "F",
|
|
6669
6669
|
mood: e = "neutral",
|
|
6670
6670
|
ttsLang: i = "en",
|
|
@@ -6685,199 +6685,199 @@ const Ee = ve(({
|
|
|
6685
6685
|
style: y = {},
|
|
6686
6686
|
animations: x = {}
|
|
6687
6687
|
}, I) => {
|
|
6688
|
-
const
|
|
6688
|
+
const E = X(null), p = X(null), H = X(a), z = X(null), v = X(null), [N, D] = ue(!0), [J, ae] = ue(null), [S, G] = ue(!1), [B, U] = ue(!1);
|
|
6689
6689
|
pe(() => {
|
|
6690
6690
|
H.current = a;
|
|
6691
6691
|
}, [a]);
|
|
6692
|
-
const
|
|
6693
|
-
let
|
|
6694
|
-
|
|
6692
|
+
const Z = Ae(), _ = n || Z.service;
|
|
6693
|
+
let ne;
|
|
6694
|
+
_ === "browser" ? ne = {
|
|
6695
6695
|
service: "browser",
|
|
6696
6696
|
endpoint: "",
|
|
6697
6697
|
apiKey: null,
|
|
6698
6698
|
defaultVoice: "Google US English"
|
|
6699
|
-
} :
|
|
6699
|
+
} : _ === "elevenlabs" ? ne = {
|
|
6700
6700
|
service: "elevenlabs",
|
|
6701
6701
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
6702
|
-
apiKey: o ||
|
|
6703
|
-
defaultVoice: s ||
|
|
6704
|
-
voices:
|
|
6705
|
-
} :
|
|
6702
|
+
apiKey: o || Z.apiKey,
|
|
6703
|
+
defaultVoice: s || Z.defaultVoice || me.defaultVoice,
|
|
6704
|
+
voices: Z.voices || me.voices
|
|
6705
|
+
} : _ === "deepgram" ? ne = {
|
|
6706
6706
|
service: "deepgram",
|
|
6707
6707
|
endpoint: "https://api.deepgram.com/v1/speak",
|
|
6708
|
-
apiKey: o ||
|
|
6709
|
-
defaultVoice: s ||
|
|
6710
|
-
voices:
|
|
6711
|
-
} :
|
|
6712
|
-
...
|
|
6708
|
+
apiKey: o || Z.apiKey,
|
|
6709
|
+
defaultVoice: s || Z.defaultVoice || Te.defaultVoice,
|
|
6710
|
+
voices: Z.voices || Te.voices
|
|
6711
|
+
} : ne = {
|
|
6712
|
+
...Z,
|
|
6713
6713
|
// Override API key if provided via props
|
|
6714
|
-
apiKey: o !== null ? o :
|
|
6714
|
+
apiKey: o !== null ? o : Z.apiKey
|
|
6715
6715
|
};
|
|
6716
|
-
const
|
|
6717
|
-
url:
|
|
6716
|
+
const ce = {
|
|
6717
|
+
url: O,
|
|
6718
6718
|
body: t,
|
|
6719
6719
|
avatarMood: e,
|
|
6720
|
-
ttsLang:
|
|
6721
|
-
ttsVoice: s ||
|
|
6720
|
+
ttsLang: _ === "browser" ? "en-US" : i,
|
|
6721
|
+
ttsVoice: s || ne.defaultVoice,
|
|
6722
6722
|
lipsyncLang: "en",
|
|
6723
6723
|
showFullAvatar: a,
|
|
6724
6724
|
bodyMovement: l,
|
|
6725
6725
|
movementIntensity: u
|
|
6726
|
-
},
|
|
6727
|
-
ttsEndpoint:
|
|
6728
|
-
ttsApikey:
|
|
6729
|
-
ttsService:
|
|
6726
|
+
}, fe = {
|
|
6727
|
+
ttsEndpoint: ne.endpoint,
|
|
6728
|
+
ttsApikey: ne.apiKey,
|
|
6729
|
+
ttsService: _,
|
|
6730
6730
|
lipsyncModules: ["en"],
|
|
6731
6731
|
cameraView: h
|
|
6732
|
-
},
|
|
6733
|
-
if (!(!
|
|
6732
|
+
}, xe = T(async () => {
|
|
6733
|
+
if (!(!E.current || p.current))
|
|
6734
6734
|
try {
|
|
6735
|
-
if (D(!0),
|
|
6735
|
+
if (D(!0), ae(null), p.current = new Ee(E.current, fe), p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1), x && Object.keys(x).length > 0 && (p.current.customAnimations = x), await p.current.showAvatar(ce, (j) => {
|
|
6736
6736
|
if (j.lengthComputable) {
|
|
6737
|
-
const
|
|
6738
|
-
c(
|
|
6737
|
+
const F = Math.min(100, Math.round(j.loaded / j.total * 100));
|
|
6738
|
+
c(F);
|
|
6739
6739
|
}
|
|
6740
6740
|
}), await new Promise((j) => {
|
|
6741
|
-
const
|
|
6742
|
-
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? j() : setTimeout(
|
|
6741
|
+
const F = () => {
|
|
6742
|
+
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? j() : setTimeout(F, 100);
|
|
6743
6743
|
};
|
|
6744
|
-
|
|
6744
|
+
F();
|
|
6745
6745
|
}), p.current && p.current.setShowFullAvatar)
|
|
6746
6746
|
try {
|
|
6747
6747
|
p.current.setShowFullAvatar(a);
|
|
6748
6748
|
} catch (j) {
|
|
6749
6749
|
console.warn("Error setting full body mode on initialization:", j);
|
|
6750
6750
|
}
|
|
6751
|
-
p.current && p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1, p.current.controls.update()), D(!1),
|
|
6752
|
-
const
|
|
6751
|
+
p.current && p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1, p.current.controls.update()), D(!1), G(!0), r(p.current);
|
|
6752
|
+
const P = () => {
|
|
6753
6753
|
document.visibilityState === "visible" ? p.current?.start() : p.current?.stop();
|
|
6754
6754
|
};
|
|
6755
|
-
return document.addEventListener("visibilitychange",
|
|
6756
|
-
document.removeEventListener("visibilitychange",
|
|
6755
|
+
return document.addEventListener("visibilitychange", P), () => {
|
|
6756
|
+
document.removeEventListener("visibilitychange", P);
|
|
6757
6757
|
};
|
|
6758
6758
|
} catch (A) {
|
|
6759
|
-
console.error("Error initializing TalkingHead:", A),
|
|
6759
|
+
console.error("Error initializing TalkingHead:", A), ae(A.message || "Failed to initialize avatar"), D(!1), d(A);
|
|
6760
6760
|
}
|
|
6761
|
-
}, [
|
|
6762
|
-
pe(() => (
|
|
6761
|
+
}, [O, t, e, i, n, s, o, a, l, u, h]);
|
|
6762
|
+
pe(() => (xe(), () => {
|
|
6763
6763
|
p.current && (p.current.stop(), p.current.dispose(), p.current = null);
|
|
6764
|
-
}), [
|
|
6765
|
-
if (!
|
|
6764
|
+
}), [xe]), pe(() => {
|
|
6765
|
+
if (!E.current || !p.current) return;
|
|
6766
6766
|
const A = new ResizeObserver((j) => {
|
|
6767
|
-
for (const
|
|
6767
|
+
for (const F of j)
|
|
6768
6768
|
p.current && p.current.onResize && p.current.onResize();
|
|
6769
6769
|
});
|
|
6770
|
-
A.observe(
|
|
6771
|
-
const
|
|
6770
|
+
A.observe(E.current);
|
|
6771
|
+
const P = () => {
|
|
6772
6772
|
p.current && p.current.onResize && p.current.onResize();
|
|
6773
6773
|
};
|
|
6774
|
-
return window.addEventListener("resize",
|
|
6775
|
-
A.disconnect(), window.removeEventListener("resize",
|
|
6774
|
+
return window.addEventListener("resize", P), () => {
|
|
6775
|
+
A.disconnect(), window.removeEventListener("resize", P);
|
|
6776
6776
|
};
|
|
6777
|
-
}, [
|
|
6778
|
-
const
|
|
6777
|
+
}, [S]);
|
|
6778
|
+
const Y = T(async () => {
|
|
6779
6779
|
if (p.current && p.current.audioCtx)
|
|
6780
6780
|
try {
|
|
6781
6781
|
(p.current.audioCtx.state === "suspended" || p.current.audioCtx.state === "interrupted") && (await p.current.audioCtx.resume(), console.log("Audio context resumed"));
|
|
6782
6782
|
} catch (A) {
|
|
6783
6783
|
console.warn("Failed to resume audio context:", A);
|
|
6784
6784
|
}
|
|
6785
|
-
}, []),
|
|
6786
|
-
if (p.current &&
|
|
6785
|
+
}, []), b = T(async (A, P = {}) => {
|
|
6786
|
+
if (p.current && S)
|
|
6787
6787
|
try {
|
|
6788
|
-
z.current = { text: A, options:
|
|
6788
|
+
v.current && (clearInterval(v.current), v.current = null), z.current = { text: A, options: P }, U(!1), await Y();
|
|
6789
6789
|
const j = {
|
|
6790
|
-
...
|
|
6791
|
-
lipsyncLang:
|
|
6790
|
+
...P,
|
|
6791
|
+
lipsyncLang: P.lipsyncLang || ce.lipsyncLang || "en"
|
|
6792
6792
|
};
|
|
6793
|
-
if (
|
|
6794
|
-
const
|
|
6795
|
-
let
|
|
6796
|
-
const
|
|
6793
|
+
if (P.onSpeechEnd && p.current) {
|
|
6794
|
+
const F = p.current;
|
|
6795
|
+
let $ = null, de = 0;
|
|
6796
|
+
const Se = 1200;
|
|
6797
6797
|
let ye = !1;
|
|
6798
|
-
|
|
6799
|
-
if (de++,
|
|
6800
|
-
|
|
6798
|
+
$ = setInterval(() => {
|
|
6799
|
+
if (de++, B)
|
|
6800
|
+
return;
|
|
6801
|
+
if (de > Se) {
|
|
6802
|
+
if ($ && (clearInterval($), $ = null, v.current = null), !ye && !B) {
|
|
6801
6803
|
ye = !0;
|
|
6802
6804
|
try {
|
|
6803
|
-
|
|
6804
|
-
} catch (
|
|
6805
|
-
console.error("Error in onSpeechEnd callback (timeout):",
|
|
6805
|
+
P.onSpeechEnd();
|
|
6806
|
+
} catch (ke) {
|
|
6807
|
+
console.error("Error in onSpeechEnd callback (timeout):", ke);
|
|
6806
6808
|
}
|
|
6807
6809
|
}
|
|
6808
6810
|
return;
|
|
6809
6811
|
}
|
|
6810
|
-
const
|
|
6811
|
-
|
|
6812
|
-
if (B &&
|
|
6813
|
-
ye = !0,
|
|
6812
|
+
const Be = !F.speechQueue || F.speechQueue.length === 0, De = !F.audioPlaylist || F.audioPlaylist.length === 0;
|
|
6813
|
+
F && F.isSpeaking === !1 && Be && De && F.isAudioPlaying === !1 && !ye && !B && setTimeout(() => {
|
|
6814
|
+
if (F && !B && F.isSpeaking === !1 && (!F.speechQueue || F.speechQueue.length === 0) && (!F.audioPlaylist || F.audioPlaylist.length === 0) && F.isAudioPlaying === !1 && !ye && !B) {
|
|
6815
|
+
ye = !0, $ && (clearInterval($), $ = null, v.current = null);
|
|
6814
6816
|
try {
|
|
6815
|
-
|
|
6816
|
-
} catch (
|
|
6817
|
-
console.error("Error in onSpeechEnd callback:",
|
|
6817
|
+
P.onSpeechEnd();
|
|
6818
|
+
} catch (Oe) {
|
|
6819
|
+
console.error("Error in onSpeechEnd callback:", Oe);
|
|
6818
6820
|
}
|
|
6819
6821
|
}
|
|
6820
6822
|
}, 100);
|
|
6821
|
-
}, 100)
|
|
6823
|
+
}, 100), v.current = $;
|
|
6822
6824
|
}
|
|
6823
6825
|
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(A, j)) : setTimeout(async () => {
|
|
6824
|
-
await
|
|
6826
|
+
await Y(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(A, j));
|
|
6825
6827
|
}, 100);
|
|
6826
6828
|
} catch (j) {
|
|
6827
|
-
console.error("Error speaking text:", j),
|
|
6829
|
+
console.error("Error speaking text:", j), ae(j.message || "Failed to speak text");
|
|
6828
6830
|
}
|
|
6829
|
-
}, [
|
|
6830
|
-
p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1), z.current = null,
|
|
6831
|
-
}, []),
|
|
6831
|
+
}, [S, Y, ce.lipsyncLang]), R = T(() => {
|
|
6832
|
+
p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1), z.current = null, U(!1));
|
|
6833
|
+
}, []), w = T(() => {
|
|
6832
6834
|
if (p.current && p.current.pauseSpeaking) {
|
|
6833
|
-
const A = p.current
|
|
6834
|
-
(
|
|
6835
|
+
const A = p.current;
|
|
6836
|
+
(A.isSpeaking || A.audioPlaylist && A.audioPlaylist.length > 0 || A.speechQueue && A.speechQueue.length > 0) && (v.current && (clearInterval(v.current), v.current = null), A.speechQueue && (A.speechQueue.length = 0), p.current.pauseSpeaking(), U(!0));
|
|
6835
6837
|
}
|
|
6836
|
-
}, []),
|
|
6837
|
-
if (p.current &&
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
z.current = null;
|
|
6848
|
-
}, [re, W]), C = T((A) => {
|
|
6838
|
+
}, []), C = T(async () => {
|
|
6839
|
+
if (p.current && B && z.current && z.current.text) {
|
|
6840
|
+
const A = z.current, P = A.options || {};
|
|
6841
|
+
U(!1), await Y();
|
|
6842
|
+
const j = {
|
|
6843
|
+
...P,
|
|
6844
|
+
lipsyncLang: P.lipsyncLang || ce.lipsyncLang || "en"
|
|
6845
|
+
};
|
|
6846
|
+
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), await b(A.text, j));
|
|
6847
|
+
}
|
|
6848
|
+
}, [Y, B, b]), V = T((A) => {
|
|
6849
6849
|
p.current && p.current.setMood(A);
|
|
6850
|
-
}, []),
|
|
6850
|
+
}, []), te = T((A) => {
|
|
6851
6851
|
p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(A);
|
|
6852
|
-
}, []),
|
|
6852
|
+
}, []), ie = T((A, P = !1) => {
|
|
6853
6853
|
if (p.current && p.current.playAnimation) {
|
|
6854
6854
|
if (x && x[A] && (A = x[A]), p.current.setShowFullAvatar)
|
|
6855
6855
|
try {
|
|
6856
6856
|
p.current.setShowFullAvatar(H.current);
|
|
6857
|
-
} catch (
|
|
6858
|
-
console.warn("Error setting full body mode:",
|
|
6857
|
+
} catch (F) {
|
|
6858
|
+
console.warn("Error setting full body mode:", F);
|
|
6859
6859
|
}
|
|
6860
6860
|
if (A.includes("."))
|
|
6861
6861
|
try {
|
|
6862
|
-
p.current.playAnimation(A, null, 10, 0, 0.01,
|
|
6863
|
-
} catch (
|
|
6864
|
-
console.warn(`Failed to play ${A}:`,
|
|
6862
|
+
p.current.playAnimation(A, null, 10, 0, 0.01, P);
|
|
6863
|
+
} catch (F) {
|
|
6864
|
+
console.warn(`Failed to play ${A}:`, F);
|
|
6865
6865
|
try {
|
|
6866
6866
|
p.current.setBodyMovement("idle");
|
|
6867
|
-
} catch (
|
|
6868
|
-
console.warn("Fallback animation also failed:",
|
|
6867
|
+
} catch ($) {
|
|
6868
|
+
console.warn("Fallback animation also failed:", $);
|
|
6869
6869
|
}
|
|
6870
6870
|
}
|
|
6871
6871
|
else {
|
|
6872
|
-
const
|
|
6873
|
-
let
|
|
6874
|
-
for (const de of
|
|
6872
|
+
const F = [".fbx", ".glb", ".gltf"];
|
|
6873
|
+
let $ = !1;
|
|
6874
|
+
for (const de of F)
|
|
6875
6875
|
try {
|
|
6876
|
-
p.current.playAnimation(A + de, null, 10, 0, 0.01,
|
|
6876
|
+
p.current.playAnimation(A + de, null, 10, 0, 0.01, P), $ = !0;
|
|
6877
6877
|
break;
|
|
6878
6878
|
} catch {
|
|
6879
6879
|
}
|
|
6880
|
-
if (
|
|
6880
|
+
if (!$) {
|
|
6881
6881
|
console.warn("Animation not found:", A);
|
|
6882
6882
|
try {
|
|
6883
6883
|
p.current.setBodyMovement("idle");
|
|
@@ -6887,28 +6887,28 @@ const Ee = ve(({
|
|
|
6887
6887
|
}
|
|
6888
6888
|
}
|
|
6889
6889
|
}
|
|
6890
|
-
}, [x]),
|
|
6890
|
+
}, [x]), ge = T(() => {
|
|
6891
6891
|
p.current && p.current.onResize && p.current.onResize();
|
|
6892
6892
|
}, []);
|
|
6893
|
-
return
|
|
6894
|
-
speakText:
|
|
6895
|
-
stopSpeaking:
|
|
6896
|
-
pauseSpeaking:
|
|
6897
|
-
resumeSpeaking:
|
|
6898
|
-
resumeAudioContext:
|
|
6899
|
-
setMood:
|
|
6900
|
-
setTimingAdjustment:
|
|
6901
|
-
playAnimation:
|
|
6902
|
-
isReady:
|
|
6903
|
-
isPaused:
|
|
6893
|
+
return Le(I, () => ({
|
|
6894
|
+
speakText: b,
|
|
6895
|
+
stopSpeaking: R,
|
|
6896
|
+
pauseSpeaking: w,
|
|
6897
|
+
resumeSpeaking: C,
|
|
6898
|
+
resumeAudioContext: Y,
|
|
6899
|
+
setMood: V,
|
|
6900
|
+
setTimingAdjustment: te,
|
|
6901
|
+
playAnimation: ie,
|
|
6902
|
+
isReady: S,
|
|
6903
|
+
isPaused: B,
|
|
6904
6904
|
talkingHead: p.current,
|
|
6905
|
-
handleResize:
|
|
6905
|
+
handleResize: ge,
|
|
6906
6906
|
setBodyMovement: (A) => {
|
|
6907
6907
|
if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
|
|
6908
6908
|
try {
|
|
6909
6909
|
p.current.setShowFullAvatar(H.current), p.current.setBodyMovement(A);
|
|
6910
|
-
} catch (
|
|
6911
|
-
console.warn("Error setting body movement:",
|
|
6910
|
+
} catch (P) {
|
|
6911
|
+
console.warn("Error setting body movement:", P);
|
|
6912
6912
|
}
|
|
6913
6913
|
},
|
|
6914
6914
|
setMovementIntensity: (A) => p.current?.setMovementIntensity(A),
|
|
@@ -6924,8 +6924,8 @@ const Ee = ve(({
|
|
|
6924
6924
|
if (p.current && p.current.setShowFullAvatar && p.current.playReaction)
|
|
6925
6925
|
try {
|
|
6926
6926
|
p.current.setShowFullAvatar(H.current), p.current.playReaction(A);
|
|
6927
|
-
} catch (
|
|
6928
|
-
console.warn("Error playing reaction:",
|
|
6927
|
+
} catch (P) {
|
|
6928
|
+
console.warn("Error playing reaction:", P);
|
|
6929
6929
|
}
|
|
6930
6930
|
},
|
|
6931
6931
|
playCelebration: () => {
|
|
@@ -6940,8 +6940,8 @@ const Ee = ve(({
|
|
|
6940
6940
|
if (p.current && p.current.setShowFullAvatar)
|
|
6941
6941
|
try {
|
|
6942
6942
|
H.current = A, p.current.setShowFullAvatar(A);
|
|
6943
|
-
} catch (
|
|
6944
|
-
console.warn("Error setting showFullAvatar:",
|
|
6943
|
+
} catch (P) {
|
|
6944
|
+
console.warn("Error setting showFullAvatar:", P);
|
|
6945
6945
|
}
|
|
6946
6946
|
},
|
|
6947
6947
|
lockAvatarPosition: () => {
|
|
@@ -6960,7 +6960,7 @@ const Ee = ve(({
|
|
|
6960
6960
|
console.warn("Error unlocking avatar position:", A);
|
|
6961
6961
|
}
|
|
6962
6962
|
}
|
|
6963
|
-
})), /* @__PURE__ */
|
|
6963
|
+
})), /* @__PURE__ */ Me(
|
|
6964
6964
|
"div",
|
|
6965
6965
|
{
|
|
6966
6966
|
className: `talking-head-avatar ${g}`,
|
|
@@ -6974,7 +6974,7 @@ const Ee = ve(({
|
|
|
6974
6974
|
/* @__PURE__ */ he(
|
|
6975
6975
|
"div",
|
|
6976
6976
|
{
|
|
6977
|
-
ref:
|
|
6977
|
+
ref: E,
|
|
6978
6978
|
className: "talking-head-viewer",
|
|
6979
6979
|
style: {
|
|
6980
6980
|
width: "100%",
|
|
@@ -6983,7 +6983,7 @@ const Ee = ve(({
|
|
|
6983
6983
|
}
|
|
6984
6984
|
}
|
|
6985
6985
|
),
|
|
6986
|
-
|
|
6986
|
+
N && /* @__PURE__ */ he("div", { className: "loading-overlay", style: {
|
|
6987
6987
|
position: "absolute",
|
|
6988
6988
|
top: "50%",
|
|
6989
6989
|
left: "50%",
|
|
@@ -6992,7 +6992,7 @@ const Ee = ve(({
|
|
|
6992
6992
|
fontSize: "18px",
|
|
6993
6993
|
zIndex: 10
|
|
6994
6994
|
}, children: "Loading avatar..." }),
|
|
6995
|
-
|
|
6995
|
+
J && /* @__PURE__ */ he("div", { className: "error-overlay", style: {
|
|
6996
6996
|
position: "absolute",
|
|
6997
6997
|
top: "50%",
|
|
6998
6998
|
left: "50%",
|
|
@@ -7003,14 +7003,14 @@ const Ee = ve(({
|
|
|
7003
7003
|
zIndex: 10,
|
|
7004
7004
|
padding: "20px",
|
|
7005
7005
|
borderRadius: "8px"
|
|
7006
|
-
}, children:
|
|
7006
|
+
}, children: J })
|
|
7007
7007
|
]
|
|
7008
7008
|
}
|
|
7009
7009
|
);
|
|
7010
7010
|
});
|
|
7011
|
-
|
|
7012
|
-
const
|
|
7013
|
-
text:
|
|
7011
|
+
Fe.displayName = "TalkingHeadAvatar";
|
|
7012
|
+
const lt = Ie(({
|
|
7013
|
+
text: O = "Hello! I'm a talking avatar. How are you today?",
|
|
7014
7014
|
onLoading: t = () => {
|
|
7015
7015
|
},
|
|
7016
7016
|
onError: e = () => {
|
|
@@ -7021,7 +7021,7 @@ const rt = ve(({
|
|
|
7021
7021
|
style: s = {},
|
|
7022
7022
|
avatarConfig: o = {}
|
|
7023
7023
|
}, l) => {
|
|
7024
|
-
const u =
|
|
7024
|
+
const u = X(null), a = X(null), [h, r] = ue(!0), [c, d] = ue(null), [g, y] = ue(!1), x = Ae(), I = o.ttsService || x.service, E = I === "browser" ? {
|
|
7025
7025
|
endpoint: "",
|
|
7026
7026
|
apiKey: null,
|
|
7027
7027
|
defaultVoice: "Google US English"
|
|
@@ -7037,7 +7037,7 @@ const rt = ve(({
|
|
|
7037
7037
|
body: "F",
|
|
7038
7038
|
avatarMood: "neutral",
|
|
7039
7039
|
ttsLang: I === "browser" ? "en-US" : "en",
|
|
7040
|
-
ttsVoice: o.ttsVoice ||
|
|
7040
|
+
ttsVoice: o.ttsVoice || E.defaultVoice,
|
|
7041
7041
|
lipsyncLang: "en",
|
|
7042
7042
|
// English lip-sync
|
|
7043
7043
|
showFullAvatar: !0,
|
|
@@ -7046,42 +7046,42 @@ const rt = ve(({
|
|
|
7046
7046
|
movementIntensity: 0.5,
|
|
7047
7047
|
...o
|
|
7048
7048
|
}, H = {
|
|
7049
|
-
ttsEndpoint:
|
|
7050
|
-
ttsApikey:
|
|
7049
|
+
ttsEndpoint: E.endpoint,
|
|
7050
|
+
ttsApikey: E.apiKey,
|
|
7051
7051
|
ttsService: I,
|
|
7052
7052
|
lipsyncModules: ["en"],
|
|
7053
7053
|
cameraView: "upper"
|
|
7054
7054
|
}, z = T(async () => {
|
|
7055
7055
|
if (!(!u.current || a.current))
|
|
7056
7056
|
try {
|
|
7057
|
-
if (r(!0), d(null), a.current = new
|
|
7058
|
-
if (
|
|
7059
|
-
const
|
|
7060
|
-
t(
|
|
7057
|
+
if (r(!0), d(null), a.current = new Ee(u.current, H), await a.current.showAvatar(p, (B) => {
|
|
7058
|
+
if (B.lengthComputable) {
|
|
7059
|
+
const U = Math.min(100, Math.round(B.loaded / B.total * 100));
|
|
7060
|
+
t(U);
|
|
7061
7061
|
}
|
|
7062
7062
|
}), a.current.morphs && a.current.morphs.length > 0) {
|
|
7063
|
-
const
|
|
7064
|
-
console.log("Available morph targets:", Object.keys(
|
|
7065
|
-
const
|
|
7066
|
-
console.log("Viseme morph targets found:",
|
|
7063
|
+
const B = a.current.morphs[0].morphTargetDictionary;
|
|
7064
|
+
console.log("Available morph targets:", Object.keys(B));
|
|
7065
|
+
const U = Object.keys(B).filter((Z) => Z.startsWith("viseme_"));
|
|
7066
|
+
console.log("Viseme morph targets found:", U), U.length === 0 && (console.warn("No viseme morph targets found! Lip-sync will not work properly."), console.log("Expected viseme targets: viseme_aa, viseme_E, viseme_I, viseme_O, viseme_U, viseme_PP, viseme_SS, viseme_TH, viseme_DD, viseme_FF, viseme_kk, viseme_nn, viseme_RR, viseme_CH, viseme_sil"));
|
|
7067
7067
|
}
|
|
7068
|
-
if (await new Promise((
|
|
7069
|
-
const
|
|
7070
|
-
a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)),
|
|
7068
|
+
if (await new Promise((B) => {
|
|
7069
|
+
const U = () => {
|
|
7070
|
+
a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)), B()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(U, 100));
|
|
7071
7071
|
};
|
|
7072
|
-
|
|
7072
|
+
U();
|
|
7073
7073
|
}), a.current && a.current.setShowFullAvatar)
|
|
7074
7074
|
try {
|
|
7075
7075
|
a.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
|
|
7076
|
-
} catch (
|
|
7077
|
-
console.warn("Error setting full body mode on initialization:",
|
|
7076
|
+
} catch (B) {
|
|
7077
|
+
console.warn("Error setting full body mode on initialization:", B);
|
|
7078
7078
|
}
|
|
7079
7079
|
r(!1), y(!0), i(a.current);
|
|
7080
|
-
const
|
|
7080
|
+
const G = () => {
|
|
7081
7081
|
document.visibilityState === "visible" ? a.current?.start() : a.current?.stop();
|
|
7082
7082
|
};
|
|
7083
|
-
return document.addEventListener("visibilitychange",
|
|
7084
|
-
document.removeEventListener("visibilitychange",
|
|
7083
|
+
return document.addEventListener("visibilitychange", G), () => {
|
|
7084
|
+
document.removeEventListener("visibilitychange", G);
|
|
7085
7085
|
};
|
|
7086
7086
|
} catch (S) {
|
|
7087
7087
|
console.error("Error initializing TalkingHead:", S), d(S.message || "Failed to initialize avatar"), r(!1), e(S);
|
|
@@ -7096,72 +7096,72 @@ const rt = ve(({
|
|
|
7096
7096
|
console.log("Speaking text:", S), console.log("Avatar config:", p), console.log("TalkingHead instance:", a.current), a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)), a.current.setSlowdownRate && (a.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), a.current.speakText(S)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
7097
7097
|
a.current && a.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), a.current.setSlowdownRate && (a.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), a.current.speakText(S)) : console.error("Lip-sync still not ready after waiting");
|
|
7098
7098
|
}, 500));
|
|
7099
|
-
} catch (
|
|
7100
|
-
console.error("Error speaking text:",
|
|
7099
|
+
} catch (G) {
|
|
7100
|
+
console.error("Error speaking text:", G), d(G.message || "Failed to speak text");
|
|
7101
7101
|
}
|
|
7102
7102
|
else
|
|
7103
7103
|
console.warn("Avatar not ready for speaking. isReady:", g, "talkingHeadRef:", !!a.current);
|
|
7104
|
-
}, [g, p]),
|
|
7104
|
+
}, [g, p]), N = T(() => {
|
|
7105
7105
|
a.current && (a.current.stopSpeaking(), a.current.setSlowdownRate && (a.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
7106
|
-
}, []),
|
|
7106
|
+
}, []), D = T((S) => {
|
|
7107
7107
|
a.current && a.current.setMood(S);
|
|
7108
|
-
}, []),
|
|
7108
|
+
}, []), J = T((S) => {
|
|
7109
7109
|
a.current && a.current.setSlowdownRate && (a.current.setSlowdownRate(S), console.log("Timing adjustment set to:", S));
|
|
7110
|
-
}, []),
|
|
7110
|
+
}, []), ae = T((S, G = !1) => {
|
|
7111
7111
|
if (a.current && a.current.playAnimation) {
|
|
7112
7112
|
if (a.current.setShowFullAvatar)
|
|
7113
7113
|
try {
|
|
7114
7114
|
a.current.setShowFullAvatar(!0);
|
|
7115
|
-
} catch (
|
|
7116
|
-
console.warn("Error setting full body mode:",
|
|
7115
|
+
} catch (U) {
|
|
7116
|
+
console.warn("Error setting full body mode:", U);
|
|
7117
7117
|
}
|
|
7118
7118
|
if (S.includes("."))
|
|
7119
7119
|
try {
|
|
7120
|
-
a.current.playAnimation(S, null, 10, 0, 0.01,
|
|
7121
|
-
} catch (
|
|
7122
|
-
console.log(`Failed to play ${S}:`,
|
|
7120
|
+
a.current.playAnimation(S, null, 10, 0, 0.01, G), console.log("Playing animation:", S);
|
|
7121
|
+
} catch (U) {
|
|
7122
|
+
console.log(`Failed to play ${S}:`, U);
|
|
7123
7123
|
try {
|
|
7124
7124
|
a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
7125
|
-
} catch (
|
|
7126
|
-
console.warn("Fallback animation also failed:",
|
|
7125
|
+
} catch (Z) {
|
|
7126
|
+
console.warn("Fallback animation also failed:", Z);
|
|
7127
7127
|
}
|
|
7128
7128
|
}
|
|
7129
7129
|
else {
|
|
7130
|
-
const
|
|
7131
|
-
let
|
|
7132
|
-
for (const
|
|
7130
|
+
const U = [".fbx", ".glb", ".gltf"];
|
|
7131
|
+
let Z = !1;
|
|
7132
|
+
for (const _ of U)
|
|
7133
7133
|
try {
|
|
7134
|
-
a.current.playAnimation(S +
|
|
7134
|
+
a.current.playAnimation(S + _, null, 10, 0, 0.01, G), console.log("Playing animation:", S + _), Z = !0;
|
|
7135
7135
|
break;
|
|
7136
7136
|
} catch {
|
|
7137
|
-
console.log(`Failed to play ${S}${
|
|
7137
|
+
console.log(`Failed to play ${S}${_}, trying next format...`);
|
|
7138
7138
|
}
|
|
7139
|
-
if (!
|
|
7139
|
+
if (!Z) {
|
|
7140
7140
|
console.warn("Animation system not available or animation not found:", S);
|
|
7141
7141
|
try {
|
|
7142
7142
|
a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
7143
|
-
} catch (
|
|
7144
|
-
console.warn("Fallback animation also failed:",
|
|
7143
|
+
} catch (_) {
|
|
7144
|
+
console.warn("Fallback animation also failed:", _);
|
|
7145
7145
|
}
|
|
7146
7146
|
}
|
|
7147
7147
|
}
|
|
7148
7148
|
} else
|
|
7149
7149
|
console.warn("Animation system not available or animation not found:", S);
|
|
7150
7150
|
}, []);
|
|
7151
|
-
return
|
|
7151
|
+
return Le(l, () => ({
|
|
7152
7152
|
speakText: v,
|
|
7153
|
-
stopSpeaking:
|
|
7154
|
-
setMood:
|
|
7155
|
-
setTimingAdjustment:
|
|
7156
|
-
playAnimation:
|
|
7153
|
+
stopSpeaking: N,
|
|
7154
|
+
setMood: D,
|
|
7155
|
+
setTimingAdjustment: J,
|
|
7156
|
+
playAnimation: ae,
|
|
7157
7157
|
isReady: g,
|
|
7158
7158
|
talkingHead: a.current,
|
|
7159
7159
|
setBodyMovement: (S) => {
|
|
7160
7160
|
if (a.current && a.current.setShowFullAvatar && a.current.setBodyMovement)
|
|
7161
7161
|
try {
|
|
7162
7162
|
a.current.setShowFullAvatar(!0), a.current.setBodyMovement(S), console.log("Body movement set with full body mode:", S);
|
|
7163
|
-
} catch (
|
|
7164
|
-
console.warn("Error setting body movement:",
|
|
7163
|
+
} catch (G) {
|
|
7164
|
+
console.warn("Error setting body movement:", G);
|
|
7165
7165
|
}
|
|
7166
7166
|
},
|
|
7167
7167
|
setMovementIntensity: (S) => a.current?.setMovementIntensity(S),
|
|
@@ -7177,8 +7177,8 @@ const rt = ve(({
|
|
|
7177
7177
|
if (a.current && a.current.setShowFullAvatar && a.current.playReaction)
|
|
7178
7178
|
try {
|
|
7179
7179
|
a.current.setShowFullAvatar(!0), a.current.playReaction(S), console.log("Reaction played with full body mode:", S);
|
|
7180
|
-
} catch (
|
|
7181
|
-
console.warn("Error playing reaction:",
|
|
7180
|
+
} catch (G) {
|
|
7181
|
+
console.warn("Error playing reaction:", G);
|
|
7182
7182
|
}
|
|
7183
7183
|
},
|
|
7184
7184
|
playCelebration: () => {
|
|
@@ -7193,8 +7193,8 @@ const rt = ve(({
|
|
|
7193
7193
|
if (a.current && a.current.setShowFullAvatar)
|
|
7194
7194
|
try {
|
|
7195
7195
|
a.current.setShowFullAvatar(S), console.log("Show full avatar set to:", S);
|
|
7196
|
-
} catch (
|
|
7197
|
-
console.warn("Error setting showFullAvatar:",
|
|
7196
|
+
} catch (G) {
|
|
7197
|
+
console.warn("Error setting showFullAvatar:", G);
|
|
7198
7198
|
}
|
|
7199
7199
|
},
|
|
7200
7200
|
lockAvatarPosition: () => {
|
|
@@ -7213,7 +7213,7 @@ const rt = ve(({
|
|
|
7213
7213
|
console.warn("Error unlocking avatar position:", S);
|
|
7214
7214
|
}
|
|
7215
7215
|
}
|
|
7216
|
-
})), /* @__PURE__ */
|
|
7216
|
+
})), /* @__PURE__ */ Me("div", { className: `talking-head-container ${n}`, style: s, children: [
|
|
7217
7217
|
/* @__PURE__ */ he(
|
|
7218
7218
|
"div",
|
|
7219
7219
|
{
|
|
@@ -7249,9 +7249,9 @@ const rt = ve(({
|
|
|
7249
7249
|
}, children: c })
|
|
7250
7250
|
] });
|
|
7251
7251
|
});
|
|
7252
|
-
|
|
7253
|
-
const
|
|
7254
|
-
curriculumData:
|
|
7252
|
+
lt.displayName = "TalkingHeadComponent";
|
|
7253
|
+
const ht = Ie(({
|
|
7254
|
+
curriculumData: O = null,
|
|
7255
7255
|
avatarConfig: t = {},
|
|
7256
7256
|
animations: e = {},
|
|
7257
7257
|
onLessonStart: i = () => {
|
|
@@ -7266,7 +7266,7 @@ const lt = ve(({
|
|
|
7266
7266
|
},
|
|
7267
7267
|
autoStart: u = !1
|
|
7268
7268
|
}, a) => {
|
|
7269
|
-
const h =
|
|
7269
|
+
const h = X(null), r = X({
|
|
7270
7270
|
currentModuleIndex: 0,
|
|
7271
7271
|
currentLessonIndex: 0,
|
|
7272
7272
|
currentQuestionIndex: 0,
|
|
@@ -7276,18 +7276,18 @@ const lt = ve(({
|
|
|
7276
7276
|
curriculumCompleted: !1,
|
|
7277
7277
|
score: 0,
|
|
7278
7278
|
totalQuestions: 0
|
|
7279
|
-
}), c =
|
|
7279
|
+
}), c = X({
|
|
7280
7280
|
onLessonStart: i,
|
|
7281
7281
|
onLessonComplete: n,
|
|
7282
7282
|
onQuestionAnswer: s,
|
|
7283
7283
|
onCurriculumComplete: o,
|
|
7284
7284
|
onCustomAction: l
|
|
7285
|
-
}), d =
|
|
7285
|
+
}), d = X(null), g = X(null), y = X(null), x = X(null), I = X(null), E = X(null), p = X(null), H = X(O?.curriculum || {
|
|
7286
7286
|
title: "Default Curriculum",
|
|
7287
7287
|
description: "No curriculum data provided",
|
|
7288
7288
|
language: "en",
|
|
7289
7289
|
modules: []
|
|
7290
|
-
}), z =
|
|
7290
|
+
}), z = X({
|
|
7291
7291
|
avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
|
|
7292
7292
|
avatarBody: t.avatarBody || "F",
|
|
7293
7293
|
mood: t.mood || "happy",
|
|
@@ -7310,7 +7310,7 @@ const lt = ve(({
|
|
|
7310
7310
|
onCustomAction: l
|
|
7311
7311
|
};
|
|
7312
7312
|
}, [i, n, s, o, l]), pe(() => {
|
|
7313
|
-
H.current =
|
|
7313
|
+
H.current = O?.curriculum || {
|
|
7314
7314
|
title: "Default Curriculum",
|
|
7315
7315
|
description: "No curriculum data provided",
|
|
7316
7316
|
language: "en",
|
|
@@ -7329,17 +7329,12 @@ const lt = ve(({
|
|
|
7329
7329
|
animations: e,
|
|
7330
7330
|
lipsyncLang: "en"
|
|
7331
7331
|
};
|
|
7332
|
-
}, [
|
|
7333
|
-
const v = T(() => (H.current || { modules: [] }).modules[r.current.currentModuleIndex]?.lessons[r.current.currentLessonIndex], []),
|
|
7332
|
+
}, [O, t, e]);
|
|
7333
|
+
const v = T(() => (H.current || { modules: [] }).modules[r.current.currentModuleIndex]?.lessons[r.current.currentLessonIndex], []), N = T(() => v()?.questions[r.current.currentQuestionIndex], [v]), D = T((b, R) => R.type === "multiple_choice" || R.type === "true_false" ? b === R.answer : R.type === "code_test" && typeof b == "object" && b !== null ? b.passed === !0 : !1, []), J = T(() => {
|
|
7334
7334
|
r.current.lessonCompleted = !0, r.current.isQuestionMode = !1;
|
|
7335
7335
|
const b = r.current.totalQuestions > 0 ? Math.round(r.current.score / r.current.totalQuestions * 100) : 100;
|
|
7336
7336
|
let R = "Congratulations! You've completed this lesson";
|
|
7337
|
-
if (r.current.totalQuestions > 0
|
|
7338
|
-
const w = r.current.score === 1 ? "one" : r.current.score, C = r.current.totalQuestions === 1 ? "one" : r.current.totalQuestions, O = b === 50 ? "fifty" : `${b}`;
|
|
7339
|
-
R += ` You got ${w} correct out of ${C} question${r.current.totalQuestions === 1 ? "" : "s"}, which is ${O} percent. `;
|
|
7340
|
-
} else
|
|
7341
|
-
R += "! ";
|
|
7342
|
-
if (b >= 80 ? R += "Excellent work! You have a great understanding of this topic." : b >= 60 ? R += "Good job! You understand most of the concepts." : R += "Keep practicing! You're making progress.", c.current.onLessonComplete({
|
|
7337
|
+
if (r.current.totalQuestions > 0 ? R += ` You got ${r.current.score} correct out of ${r.current.totalQuestions} question${r.current.totalQuestions === 1 ? "" : "s"}, achieving a score of ${b} percent. ` : R += "! ", b >= 80 ? R += "Excellent work! You have a great understanding of this topic." : b >= 60 ? R += "Good job! You understand most of the concepts." : R += "Keep practicing! You're making progress.", c.current.onLessonComplete({
|
|
7343
7338
|
moduleIndex: r.current.currentModuleIndex,
|
|
7344
7339
|
lessonIndex: r.current.currentLessonIndex,
|
|
7345
7340
|
score: r.current.score,
|
|
@@ -7359,9 +7354,9 @@ const lt = ve(({
|
|
|
7359
7354
|
} catch {
|
|
7360
7355
|
h.current.playCelebration();
|
|
7361
7356
|
}
|
|
7362
|
-
const w = H.current || { modules: [] }, C = w.modules[r.current.currentModuleIndex],
|
|
7357
|
+
const w = H.current || { modules: [] }, C = w.modules[r.current.currentModuleIndex], V = r.current.currentLessonIndex < (C?.lessons?.length || 0) - 1, te = r.current.currentModuleIndex < (w.modules?.length || 0) - 1, ie = V || te, ge = z.current || { lipsyncLang: "en" };
|
|
7363
7358
|
h.current.speakText(R, {
|
|
7364
|
-
lipsyncLang:
|
|
7359
|
+
lipsyncLang: ge.lipsyncLang,
|
|
7365
7360
|
onSpeechEnd: () => {
|
|
7366
7361
|
c.current.onCustomAction({
|
|
7367
7362
|
type: "lessonCompleteFeedbackDone",
|
|
@@ -7375,7 +7370,7 @@ const lt = ve(({
|
|
|
7375
7370
|
}
|
|
7376
7371
|
});
|
|
7377
7372
|
}
|
|
7378
|
-
}, [e.lessonComplete]),
|
|
7373
|
+
}, [e.lessonComplete]), ae = T(() => {
|
|
7379
7374
|
r.current.curriculumCompleted = !0;
|
|
7380
7375
|
const b = H.current || { modules: [] };
|
|
7381
7376
|
if (c.current.onCurriculumComplete({
|
|
@@ -7394,7 +7389,7 @@ const lt = ve(({
|
|
|
7394
7389
|
}, [e.curriculumComplete]), S = T(() => {
|
|
7395
7390
|
const b = v();
|
|
7396
7391
|
r.current.isQuestionMode = !0, r.current.currentQuestionIndex = 0, r.current.totalQuestions = b?.questions?.length || 0, r.current.score = 0;
|
|
7397
|
-
const R =
|
|
7392
|
+
const R = N();
|
|
7398
7393
|
R && c.current.onCustomAction({
|
|
7399
7394
|
type: "questionStart",
|
|
7400
7395
|
moduleIndex: r.current.currentModuleIndex,
|
|
@@ -7409,8 +7404,8 @@ const lt = ve(({
|
|
|
7409
7404
|
if (h.current.setMood("happy"), e.questionStart)
|
|
7410
7405
|
try {
|
|
7411
7406
|
h.current.playAnimation(e.questionStart, !0);
|
|
7412
|
-
} catch (
|
|
7413
|
-
console.warn("Failed to play questionStart animation:",
|
|
7407
|
+
} catch (V) {
|
|
7408
|
+
console.warn("Failed to play questionStart animation:", V);
|
|
7414
7409
|
}
|
|
7415
7410
|
const C = z.current || { lipsyncLang: "en" };
|
|
7416
7411
|
R.type === "code_test" ? h.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang: C.lipsyncLang }) : R.type === "multiple_choice" ? h.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: C.lipsyncLang }) : R.type === "true_false" ? h.current.speakText(`Let's start with some true or false questions. First question: ${R.question}`, { lipsyncLang: C.lipsyncLang }) : h.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: C.lipsyncLang });
|
|
@@ -7428,11 +7423,11 @@ const lt = ve(({
|
|
|
7428
7423
|
clearInterval(C);
|
|
7429
7424
|
}, 5e3);
|
|
7430
7425
|
}
|
|
7431
|
-
}, [e.questionStart, v,
|
|
7426
|
+
}, [e.questionStart, v, N]), G = T(() => {
|
|
7432
7427
|
const b = v();
|
|
7433
7428
|
if (r.current.currentQuestionIndex < (b?.questions?.length || 0) - 1) {
|
|
7434
7429
|
h.current && h.current.stopSpeaking && h.current.stopSpeaking(), r.current.currentQuestionIndex += 1;
|
|
7435
|
-
const R =
|
|
7430
|
+
const R = N();
|
|
7436
7431
|
R && c.current.onCustomAction({
|
|
7437
7432
|
type: "nextQuestion",
|
|
7438
7433
|
moduleIndex: r.current.currentModuleIndex,
|
|
@@ -7447,8 +7442,8 @@ const lt = ve(({
|
|
|
7447
7442
|
if (h.current.setMood("happy"), h.current.setBodyMovement("idle"), e.nextQuestion)
|
|
7448
7443
|
try {
|
|
7449
7444
|
h.current.playAnimation(e.nextQuestion, !0);
|
|
7450
|
-
} catch (
|
|
7451
|
-
console.warn("Failed to play nextQuestion animation:",
|
|
7445
|
+
} catch (V) {
|
|
7446
|
+
console.warn("Failed to play nextQuestion animation:", V);
|
|
7452
7447
|
}
|
|
7453
7448
|
const C = z.current || { lipsyncLang: "en" };
|
|
7454
7449
|
R.type === "code_test" ? h.current.speakText(`Great! Now let's move on to your next coding challenge: ${R.question}`, {
|
|
@@ -7479,11 +7474,11 @@ const lt = ve(({
|
|
|
7479
7474
|
totalQuestions: r.current.totalQuestions,
|
|
7480
7475
|
score: r.current.score
|
|
7481
7476
|
});
|
|
7482
|
-
}, [e.nextQuestion, v,
|
|
7477
|
+
}, [e.nextQuestion, v, N]), B = T(() => {
|
|
7483
7478
|
const b = H.current || { modules: [] }, R = b.modules[r.current.currentModuleIndex];
|
|
7484
7479
|
if (r.current.currentLessonIndex < (R?.lessons?.length || 0) - 1) {
|
|
7485
7480
|
r.current.currentLessonIndex += 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
|
|
7486
|
-
const C = b.modules[r.current.currentModuleIndex],
|
|
7481
|
+
const C = b.modules[r.current.currentModuleIndex], V = r.current.currentLessonIndex < (C?.lessons?.length || 0) - 1, te = r.current.currentModuleIndex < (b.modules?.length || 0) - 1, ie = V || te;
|
|
7487
7482
|
c.current.onCustomAction({
|
|
7488
7483
|
type: "lessonStart",
|
|
7489
7484
|
moduleIndex: r.current.currentModuleIndex,
|
|
@@ -7496,12 +7491,12 @@ const lt = ve(({
|
|
|
7496
7491
|
}), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"));
|
|
7497
7492
|
} else if (r.current.currentModuleIndex < (b.modules?.length || 0) - 1) {
|
|
7498
7493
|
r.current.currentModuleIndex += 1, r.current.currentLessonIndex = 0, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
|
|
7499
|
-
const
|
|
7494
|
+
const V = b.modules[r.current.currentModuleIndex], te = r.current.currentLessonIndex < (V?.lessons?.length || 0) - 1, ie = r.current.currentModuleIndex < (b.modules?.length || 0) - 1, ge = te || ie;
|
|
7500
7495
|
c.current.onCustomAction({
|
|
7501
7496
|
type: "lessonStart",
|
|
7502
7497
|
moduleIndex: r.current.currentModuleIndex,
|
|
7503
7498
|
lessonIndex: r.current.currentLessonIndex,
|
|
7504
|
-
hasNextLesson:
|
|
7499
|
+
hasNextLesson: ge
|
|
7505
7500
|
}), c.current.onLessonStart({
|
|
7506
7501
|
moduleIndex: r.current.currentModuleIndex,
|
|
7507
7502
|
lessonIndex: r.current.currentLessonIndex,
|
|
@@ -7509,12 +7504,12 @@ const lt = ve(({
|
|
|
7509
7504
|
}), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"));
|
|
7510
7505
|
} else
|
|
7511
7506
|
I.current && I.current();
|
|
7512
|
-
}, []),
|
|
7507
|
+
}, []), U = T(() => {
|
|
7513
7508
|
const b = v();
|
|
7514
7509
|
let R = null;
|
|
7515
7510
|
if (b?.avatar_script && b?.body) {
|
|
7516
|
-
const w = b.avatar_script.trim(), C = b.body.trim(),
|
|
7517
|
-
R = `${w}${
|
|
7511
|
+
const w = b.avatar_script.trim(), C = b.body.trim(), V = w.match(/[.!?]$/) ? " " : ". ";
|
|
7512
|
+
R = `${w}${V}${C}`;
|
|
7518
7513
|
} else
|
|
7519
7514
|
R = b?.avatar_script || b?.body || null;
|
|
7520
7515
|
if (h.current && h.current.isReady && R) {
|
|
@@ -7523,8 +7518,8 @@ const lt = ve(({
|
|
|
7523
7518
|
if (e.teaching)
|
|
7524
7519
|
try {
|
|
7525
7520
|
h.current.playAnimation(e.teaching, !0), w = !0;
|
|
7526
|
-
} catch (
|
|
7527
|
-
console.warn("Failed to play teaching animation:",
|
|
7521
|
+
} catch (V) {
|
|
7522
|
+
console.warn("Failed to play teaching animation:", V);
|
|
7528
7523
|
}
|
|
7529
7524
|
w || h.current.setBodyMovement("gesturing");
|
|
7530
7525
|
const C = z.current || { lipsyncLang: "en" };
|
|
@@ -7550,8 +7545,8 @@ const lt = ve(({
|
|
|
7550
7545
|
}
|
|
7551
7546
|
});
|
|
7552
7547
|
}
|
|
7553
|
-
}, [e.teaching, v]),
|
|
7554
|
-
const R =
|
|
7548
|
+
}, [e.teaching, v]), Z = T((b) => {
|
|
7549
|
+
const R = N(), w = D(b, R);
|
|
7555
7550
|
if (w && (r.current.score += 1), c.current.onQuestionAnswer({
|
|
7556
7551
|
moduleIndex: r.current.currentModuleIndex,
|
|
7557
7552
|
lessonIndex: r.current.currentLessonIndex,
|
|
@@ -7568,9 +7563,9 @@ const lt = ve(({
|
|
|
7568
7563
|
h.current.setBodyMovement("happy");
|
|
7569
7564
|
}
|
|
7570
7565
|
h.current.setBodyMovement("gesturing");
|
|
7571
|
-
const C = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`,
|
|
7566
|
+
const C = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, V = z.current || { lipsyncLang: "en" };
|
|
7572
7567
|
h.current.speakText(C, {
|
|
7573
|
-
lipsyncLang:
|
|
7568
|
+
lipsyncLang: V.lipsyncLang,
|
|
7574
7569
|
onSpeechEnd: () => {
|
|
7575
7570
|
const ie = v()?.questions?.length || 0;
|
|
7576
7571
|
c.current.onCustomAction({
|
|
@@ -7593,9 +7588,9 @@ const lt = ve(({
|
|
|
7593
7588
|
h.current.setBodyMovement("idle");
|
|
7594
7589
|
}
|
|
7595
7590
|
h.current.setBodyMovement("gesturing");
|
|
7596
|
-
const C = R.type === "code_test" ? `Your code didn't pass all the tests. ${R.explanation || "Try again!"}` : `Not quite right, but don't worry! ${R.explanation || ""} Let's move on to the next question.`,
|
|
7591
|
+
const C = R.type === "code_test" ? `Your code didn't pass all the tests. ${R.explanation || "Try again!"}` : `Not quite right, but don't worry! ${R.explanation || ""} Let's move on to the next question.`, V = z.current || { lipsyncLang: "en" };
|
|
7597
7592
|
h.current.speakText(C, {
|
|
7598
|
-
lipsyncLang:
|
|
7593
|
+
lipsyncLang: V.lipsyncLang,
|
|
7599
7594
|
onSpeechEnd: () => {
|
|
7600
7595
|
const ie = v()?.questions?.length || 0;
|
|
7601
7596
|
c.current.onCustomAction({
|
|
@@ -7612,21 +7607,21 @@ const lt = ve(({
|
|
|
7612
7607
|
});
|
|
7613
7608
|
}
|
|
7614
7609
|
else {
|
|
7615
|
-
const
|
|
7610
|
+
const V = v()?.questions?.length || 0;
|
|
7616
7611
|
c.current.onCustomAction({
|
|
7617
7612
|
type: "answerFeedbackComplete",
|
|
7618
7613
|
moduleIndex: r.current.currentModuleIndex,
|
|
7619
7614
|
lessonIndex: r.current.currentLessonIndex,
|
|
7620
7615
|
questionIndex: r.current.currentQuestionIndex,
|
|
7621
7616
|
isCorrect: w,
|
|
7622
|
-
hasNextQuestion: r.current.currentQuestionIndex <
|
|
7617
|
+
hasNextQuestion: r.current.currentQuestionIndex < V - 1,
|
|
7623
7618
|
score: r.current.score,
|
|
7624
7619
|
totalQuestions: r.current.totalQuestions,
|
|
7625
7620
|
avatarNotReady: !0
|
|
7626
7621
|
});
|
|
7627
7622
|
}
|
|
7628
|
-
}, [e.correct, e.incorrect,
|
|
7629
|
-
const R =
|
|
7623
|
+
}, [e.correct, e.incorrect, N, v, D]), _ = T((b) => {
|
|
7624
|
+
const R = N();
|
|
7630
7625
|
if (!b || typeof b != "object") {
|
|
7631
7626
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
7632
7627
|
return;
|
|
@@ -7653,10 +7648,10 @@ const lt = ve(({
|
|
|
7653
7648
|
testResult: w,
|
|
7654
7649
|
question: R
|
|
7655
7650
|
}), p.current && p.current(w);
|
|
7656
|
-
}, [
|
|
7651
|
+
}, [N, D]), ne = T(() => {
|
|
7657
7652
|
if (r.current.currentQuestionIndex > 0) {
|
|
7658
7653
|
r.current.currentQuestionIndex -= 1;
|
|
7659
|
-
const b =
|
|
7654
|
+
const b = N();
|
|
7660
7655
|
b && c.current.onCustomAction({
|
|
7661
7656
|
type: "questionStart",
|
|
7662
7657
|
moduleIndex: r.current.currentModuleIndex,
|
|
@@ -7687,7 +7682,7 @@ const lt = ve(({
|
|
|
7687
7682
|
}, 5e3);
|
|
7688
7683
|
}
|
|
7689
7684
|
}
|
|
7690
|
-
}, [
|
|
7685
|
+
}, [N]), ce = T(() => {
|
|
7691
7686
|
const b = H.current || { modules: [] };
|
|
7692
7687
|
if (b.modules[r.current.currentModuleIndex], r.current.currentLessonIndex > 0)
|
|
7693
7688
|
r.current.currentLessonIndex -= 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, c.current.onCustomAction({
|
|
@@ -7711,32 +7706,32 @@ const lt = ve(({
|
|
|
7711
7706
|
lesson: v()
|
|
7712
7707
|
}), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"));
|
|
7713
7708
|
}
|
|
7714
|
-
}, [v]),
|
|
7709
|
+
}, [v]), fe = T(() => {
|
|
7715
7710
|
r.current.currentModuleIndex = 0, r.current.currentLessonIndex = 0, r.current.currentQuestionIndex = 0, r.current.isTeaching = !1, r.current.isQuestionMode = !1, r.current.lessonCompleted = !1, r.current.curriculumCompleted = !1, r.current.score = 0, r.current.totalQuestions = 0;
|
|
7716
|
-
}, []),
|
|
7711
|
+
}, []), xe = T((b) => {
|
|
7717
7712
|
console.log("Avatar is ready!", b);
|
|
7718
7713
|
const R = v(), w = R?.avatar_script || R?.body;
|
|
7719
7714
|
u && w && setTimeout(() => {
|
|
7720
7715
|
d.current && d.current();
|
|
7721
7716
|
}, 10);
|
|
7722
7717
|
}, [u, v]);
|
|
7723
|
-
|
|
7724
|
-
d.current =
|
|
7725
|
-
}),
|
|
7718
|
+
Ne(() => {
|
|
7719
|
+
d.current = U, g.current = B, y.current = J, x.current = G, I.current = ae, E.current = S, p.current = Z;
|
|
7720
|
+
}), Le(a, () => ({
|
|
7726
7721
|
// Curriculum control methods
|
|
7727
|
-
startTeaching:
|
|
7722
|
+
startTeaching: U,
|
|
7728
7723
|
startQuestions: S,
|
|
7729
|
-
handleAnswerSelect:
|
|
7730
|
-
handleCodeTestResult:
|
|
7731
|
-
nextQuestion:
|
|
7732
|
-
previousQuestion:
|
|
7733
|
-
nextLesson:
|
|
7734
|
-
previousLesson:
|
|
7735
|
-
completeLesson:
|
|
7736
|
-
completeCurriculum:
|
|
7737
|
-
resetCurriculum:
|
|
7724
|
+
handleAnswerSelect: Z,
|
|
7725
|
+
handleCodeTestResult: _,
|
|
7726
|
+
nextQuestion: G,
|
|
7727
|
+
previousQuestion: ne,
|
|
7728
|
+
nextLesson: B,
|
|
7729
|
+
previousLesson: ce,
|
|
7730
|
+
completeLesson: J,
|
|
7731
|
+
completeCurriculum: ae,
|
|
7732
|
+
resetCurriculum: fe,
|
|
7738
7733
|
getState: () => ({ ...r.current }),
|
|
7739
|
-
getCurrentQuestion: () =>
|
|
7734
|
+
getCurrentQuestion: () => N(),
|
|
7740
7735
|
getCurrentLesson: () => v(),
|
|
7741
7736
|
// Direct access to avatar ref (always returns current value)
|
|
7742
7737
|
getAvatarRef: () => h.current,
|
|
@@ -7788,8 +7783,8 @@ const lt = ve(({
|
|
|
7788
7783
|
handleResize: () => h.current?.handleResize(),
|
|
7789
7784
|
// Avatar readiness check (always returns current value)
|
|
7790
7785
|
isAvatarReady: () => h.current?.isReady || !1
|
|
7791
|
-
}), [
|
|
7792
|
-
const
|
|
7786
|
+
}), [U, S, Z, _, G, B, J, ae, fe, N, v]);
|
|
7787
|
+
const Y = z.current || {
|
|
7793
7788
|
avatarUrl: "/avatars/brunette.glb",
|
|
7794
7789
|
avatarBody: "F",
|
|
7795
7790
|
mood: "happy",
|
|
@@ -7803,22 +7798,22 @@ const lt = ve(({
|
|
|
7803
7798
|
animations: e
|
|
7804
7799
|
};
|
|
7805
7800
|
return /* @__PURE__ */ he("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ he(
|
|
7806
|
-
|
|
7801
|
+
Fe,
|
|
7807
7802
|
{
|
|
7808
7803
|
ref: h,
|
|
7809
|
-
avatarUrl:
|
|
7810
|
-
avatarBody:
|
|
7811
|
-
mood:
|
|
7812
|
-
ttsLang:
|
|
7813
|
-
ttsService:
|
|
7814
|
-
ttsVoice:
|
|
7815
|
-
ttsApiKey:
|
|
7816
|
-
bodyMovement:
|
|
7817
|
-
movementIntensity:
|
|
7818
|
-
showFullAvatar:
|
|
7804
|
+
avatarUrl: Y.avatarUrl,
|
|
7805
|
+
avatarBody: Y.avatarBody,
|
|
7806
|
+
mood: Y.mood,
|
|
7807
|
+
ttsLang: Y.ttsLang,
|
|
7808
|
+
ttsService: Y.ttsService,
|
|
7809
|
+
ttsVoice: Y.ttsVoice,
|
|
7810
|
+
ttsApiKey: Y.ttsApiKey,
|
|
7811
|
+
bodyMovement: Y.bodyMovement,
|
|
7812
|
+
movementIntensity: Y.movementIntensity,
|
|
7813
|
+
showFullAvatar: Y.showFullAvatar,
|
|
7819
7814
|
cameraView: "upper",
|
|
7820
|
-
animations:
|
|
7821
|
-
onReady:
|
|
7815
|
+
animations: Y.animations,
|
|
7816
|
+
onReady: xe,
|
|
7822
7817
|
onLoading: () => {
|
|
7823
7818
|
},
|
|
7824
7819
|
onError: (b) => {
|
|
@@ -7827,8 +7822,8 @@ const lt = ve(({
|
|
|
7827
7822
|
}
|
|
7828
7823
|
) });
|
|
7829
7824
|
});
|
|
7830
|
-
|
|
7831
|
-
const
|
|
7825
|
+
ht.displayName = "CurriculumLearning";
|
|
7826
|
+
const Pe = {
|
|
7832
7827
|
// Code-based dance animations (no FBX required)
|
|
7833
7828
|
dance: {
|
|
7834
7829
|
name: "dance",
|
|
@@ -7931,14 +7926,14 @@ const Fe = {
|
|
|
7931
7926
|
duration: 5e3,
|
|
7932
7927
|
description: "Excited, energetic movement"
|
|
7933
7928
|
}
|
|
7934
|
-
},
|
|
7929
|
+
}, vt = (O) => Pe[O] || null, Rt = (O) => Pe.hasOwnProperty(O);
|
|
7935
7930
|
export {
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7931
|
+
ht as CurriculumLearning,
|
|
7932
|
+
Fe as TalkingHeadAvatar,
|
|
7933
|
+
lt as TalkingHeadComponent,
|
|
7934
|
+
Pe as animations,
|
|
7935
|
+
Ae as getActiveTTSConfig,
|
|
7936
|
+
vt as getAnimation,
|
|
7937
|
+
bt as getVoiceOptions,
|
|
7943
7938
|
Rt as hasAnimation
|
|
7944
7939
|
};
|