@sage-rsc/talking-head-react 1.0.44 → 1.0.46

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.js CHANGED
@@ -1,21 +1,21 @@
1
- import { jsxs as Le, jsx as se } from "react/jsx-runtime";
2
- import { forwardRef as ye, useRef as X, useState as re, useCallback as M, useEffect as he, useImperativeHandle as fe, useLayoutEffect as He } from "react";
1
+ import { jsxs as Ce, jsx as oe } from "react/jsx-runtime";
2
+ import { forwardRef as be, useRef as Y, useState as re, useCallback as E, useEffect as he, useImperativeHandle as Re, useLayoutEffect as Pe } from "react";
3
3
  import * as f from "three";
4
- import { OrbitControls as Te } from "three/addons/controls/OrbitControls.js";
5
- import { GLTFLoader as Me } from "three/addons/loaders/GLTFLoader.js";
6
- import { DRACOLoader as Ee } from "three/addons/loaders/DRACOLoader.js";
7
- import { FBXLoader as be } from "three/addons/loaders/FBXLoader.js";
8
- import { RoomEnvironment as Fe } from "three/addons/environments/RoomEnvironment.js";
9
- import Pe from "three/addons/libs/stats.module.js";
10
- let m, j, K;
11
- const A = [0, 0, 0, 0], k = new f.Vector3(), ue = new f.Vector3(), G = new f.Vector3(), de = new f.Vector3();
4
+ import { OrbitControls as Be } from "three/addons/controls/OrbitControls.js";
5
+ import { GLTFLoader as De } from "three/addons/loaders/GLTFLoader.js";
6
+ import { DRACOLoader as Oe } from "three/addons/loaders/DRACOLoader.js";
7
+ import { FBXLoader as Le } from "three/addons/loaders/FBXLoader.js";
8
+ import { RoomEnvironment as Ne } from "three/addons/environments/RoomEnvironment.js";
9
+ import Ue from "three/addons/libs/stats.module.js";
10
+ let m, Q, J;
11
+ const A = [0, 0, 0, 0], k = new f.Vector3(), me = new f.Vector3(), Z = new f.Vector3(), pe = new f.Vector3();
12
12
  new f.Plane();
13
13
  new f.Ray();
14
14
  new f.Euler();
15
- const Z = new f.Quaternion(), Re = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
15
+ const X = new f.Quaternion(), Se = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
16
16
  new f.Vector3();
17
- const ce = new f.Vector3(0, 0, 1), Be = new f.Vector3(1, 0, 0), De = new f.Vector3(0, 1, 0), Oe = new f.Vector3(0, 0, 1);
18
- class Ne {
17
+ const ge = new f.Vector3(0, 0, 1), We = new f.Vector3(1, 0, 0), Ve = new f.Vector3(0, 1, 0), Ge = new f.Vector3(0, 0, 1);
18
+ class Ze {
19
19
  constructor(t = null) {
20
20
  this.opt = Object.assign({
21
21
  warmupMs: 2e3,
@@ -338,7 +338,7 @@ class Ne {
338
338
  ea: [0, 0, 0, 0]
339
339
  // External acceleration [m/s^2]
340
340
  };
341
- u.boneParent.matrixWorld.decompose(k, Z, G), k.copy(ce).applyQuaternion(Z).setY(0).normalize(), Z.premultiply(Re.setFromUnitVectors(ce, k).invert()).normalize(), u.qWorldInverseYaw = Z.clone().normalize(), this.data.push(u), this.dict[h] = u;
341
+ u.boneParent.matrixWorld.decompose(k, X, Z), k.copy(ge).applyQuaternion(X).setY(0).normalize(), X.premultiply(Se.setFromUnitVectors(ge, k).invert()).normalize(), u.qWorldInverseYaw = X.clone().normalize(), this.data.push(u), this.dict[h] = u;
342
342
  try {
343
343
  this.setValue(h, "type", s.type), this.setValue(h, "stiffness", s.stiffness), this.setValue(h, "damping", s.damping), this.setValue(h, "external", s.external), this.setValue(h, "limits", s.limits), this.setValue(h, "excludes", s.excludes), this.setValue(h, "deltaLocal", s.deltaLocal), this.setValue(h, "deltaWorld", s.deltaWorld), this.setValue(h, "pivot", s.pivot), this.setValue(h, "helper", s.helper);
344
344
  } catch (l) {
@@ -369,9 +369,9 @@ class Ne {
369
369
  o.vBasis.y + A[1],
370
370
  o.vBasis.z - A[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, Z, G), k.copy(ce).applyQuaternion(Z).setY(0).normalize(), Z.premultiply(Re.setFromUnitVectors(ce, k).invert()).normalize(), o.boneParent.quaternion.multiply(Z.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(A[0] / o.l), Z.setFromAxisAngle(Oe, -m), o.boneParent.quaternion.multiply(Z)), o.isY && (m = o.l / 3, m = m * Math.tanh(A[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(A[2] / o.l), Z.setFromAxisAngle(Be, -m), o.boneParent.quaternion.multiply(Z)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), Z.setFromAxisAngle(De, -m), o.boneParent.quaternion.multiply(Z)), o.boneParent.updateWorldMatrix(!1, !0), o.excludes && this.opt.isExcludes)
372
+ else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(k, X, Z), k.copy(ge).applyQuaternion(X).setY(0).normalize(), X.premultiply(Se.setFromUnitVectors(ge, k).invert()).normalize(), o.boneParent.quaternion.multiply(X.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(A[0] / o.l), X.setFromAxisAngle(Ge, -m), o.boneParent.quaternion.multiply(X)), o.isY && (m = o.l / 3, m = m * Math.tanh(A[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(A[2] / o.l), X.setFromAxisAngle(We, -m), o.boneParent.quaternion.multiply(X)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), X.setFromAxisAngle(Ve, -m), o.boneParent.quaternion.multiply(X)), 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], G.set(0, 0, 0), m.deltaLocal && (G.x += m.deltaLocal[0], G.y += m.deltaLocal[1], G.z += m.deltaLocal[2]), G.applyMatrix4(m.bone.matrixWorld), te.copy(o.boneParent.matrixWorld).invert(), G.applyMatrix4(te), k.copy(o.bone.position), !(k.distanceToSquared(G) >= m.radiusSq) && (K = k.length(), j = G.length(), !(j > m.radius + K) && (j < Math.abs(m.radius - K) || (j = (j * j + K * K - m.radiusSq) / (2 * j), G.normalize(), de.copy(G).multiplyScalar(j), j = Math.sqrt(K * K - j * j), k.subVectors(k, de).projectOnPlane(G).normalize().multiplyScalar(j), ue.subVectors(o.vBasis, de).projectOnPlane(G).normalize(), K = ue.dot(k), K < 0 && (K = Math.sqrt(j * j - K * K), ue.multiplyScalar(K), k.add(ue)), k.add(de).normalize(), G.copy(o.bone.position).normalize(), Z.setFromUnitVectors(G, k), o.boneParent.quaternion.premultiply(Z), o.boneParent.updateWorldMatrix(!1, !0))));
374
+ m = o.excludes[i], Z.set(0, 0, 0), m.deltaLocal && (Z.x += m.deltaLocal[0], Z.y += m.deltaLocal[1], Z.z += m.deltaLocal[2]), Z.applyMatrix4(m.bone.matrixWorld), te.copy(o.boneParent.matrixWorld).invert(), Z.applyMatrix4(te), k.copy(o.bone.position), !(k.distanceToSquared(Z) >= m.radiusSq) && (J = k.length(), Q = Z.length(), !(Q > m.radius + J) && (Q < Math.abs(m.radius - J) || (Q = (Q * Q + J * J - m.radiusSq) / (2 * Q), Z.normalize(), pe.copy(Z).multiplyScalar(Q), Q = Math.sqrt(J * J - Q * Q), k.subVectors(k, pe).projectOnPlane(Z).normalize().multiplyScalar(Q), me.subVectors(o.vBasis, pe).projectOnPlane(Z).normalize(), J = me.dot(k), J < 0 && (J = Math.sqrt(Q * Q - J * J), me.multiplyScalar(J), k.add(me)), k.add(pe).normalize(), Z.copy(o.bone.position).normalize(), X.setFromUnitVectors(Z, k), o.boneParent.quaternion.premultiply(X), o.boneParent.updateWorldMatrix(!1, !0))));
375
375
  }
376
376
  this.helpers.isActive && this.updateHelpers();
377
377
  }
@@ -489,7 +489,7 @@ class Ne {
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 Ue {
492
+ class Xe {
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 Ue {
814
814
  return n * s;
815
815
  }
816
816
  }
817
- class We {
817
+ class Ye {
818
818
  /**
819
819
  * @constructor
820
820
  */
@@ -1396,11 +1396,11 @@ class We {
1396
1396
  return e;
1397
1397
  }
1398
1398
  }
1399
- const Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1399
+ const je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
1400
  __proto__: null,
1401
- LipsyncEn: We
1401
+ LipsyncEn: Ye
1402
1402
  }, Symbol.toStringTag, { value: "Module" }));
1403
- class Ge {
1403
+ class Qe {
1404
1404
  /**
1405
1405
  * @constructor
1406
1406
  */
@@ -1754,11 +1754,11 @@ class Ge {
1754
1754
  return e;
1755
1755
  }
1756
1756
  }
1757
- const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1757
+ const qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1758
1758
  __proto__: null,
1759
- LipsyncDe: Ge
1759
+ LipsyncDe: Qe
1760
1760
  }, Symbol.toStringTag, { value: "Module" }));
1761
- class Xe {
1761
+ class _e {
1762
1762
  /**
1763
1763
  * @constructor
1764
1764
  */
@@ -2289,11 +2289,11 @@ class Xe {
2289
2289
  return e;
2290
2290
  }
2291
2291
  }
2292
- const Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2292
+ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2293
2293
  __proto__: null,
2294
- LipsyncFr: Xe
2294
+ LipsyncFr: _e
2295
2295
  }, Symbol.toStringTag, { value: "Module" }));
2296
- class je {
2296
+ class Je {
2297
2297
  /**
2298
2298
  * @constructor
2299
2299
  */
@@ -2436,11 +2436,11 @@ class je {
2436
2436
  return e;
2437
2437
  }
2438
2438
  }
2439
- const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2439
+ const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2440
2440
  __proto__: null,
2441
- LipsyncFi: je
2441
+ LipsyncFi: Je
2442
2442
  }, Symbol.toStringTag, { value: "Module" }));
2443
- class qe {
2443
+ class et {
2444
2444
  /**
2445
2445
  * @constructor
2446
2446
  */
@@ -2620,24 +2620,24 @@ class qe {
2620
2620
  return e;
2621
2621
  }
2622
2622
  }
2623
- const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2623
+ const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2624
2624
  __proto__: null,
2625
- LipsyncLt: qe
2626
- }, Symbol.toStringTag, { value: "Module" })), Ke = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25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ICAgIHRoaXMuX2N1cnJlbnRDaHVuayA9IHRoaXMuX2J1ZmZlclF1ZXVlLnNoaWZ0KCk7CiAgICAgICAgICB0aGlzLl9jdXJyZW50Q2h1bmtPZmZzZXQgPSAwOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAvLyBCdWZmZXIgaXMgZW1wdHkuIENoZWNrIGZvciBlbmQgY29uZGl0aW9ucy4KICAgICAgICAgIGNvbnN0IGlzVGltZWRPdXQgPSB0aGlzLl9zaWxlbmNlRnJhbWVzQ291bnQgPiB0aGlzLl9zaWxlbmNlVGhyZXNob2xkQmxvY2tzOwoKICAgICAgICAgIGlmICh0aGlzLl9ub01vcmVEYXRhUmVjZWl2ZWQgfHwgaXNUaW1lZE91dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHRoaXMuX3VuZGVycnVuQmxvY2tzKys7CiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KCiAgICAgIC8vIElmIHdlIGhhdmUgYSBjaHVuayAoY291bGQgYmUgYSBuZXcgb25lIGZyb20gdGhlIGxvZ2ljIGFib3ZlKSwgcHJvY2VzcyBpdC4KICAgICAgaWYgKHRoaXMuX2N1cnJlbnRDaHVuaykgewogICAgICAgIGNvbnN0IHNhbXBsZXNUb0NvcHkgPSBNYXRoLm1pbigKIC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ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICBtYXhRdWV1ZWRNczogTWF0aC5yb3VuZCgodGhpcy5fbWF4UXVldWVTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICB1bmRlcnJ1bkJsb2NrczogdGhpcy5fdW5kZXJydW5CbG9ja3MsCiAgICAgICAgICAgICAgZnJhbWVzUHJvY2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), ve = {
2627
- en: Ve,
2628
- de: Ze,
2629
- fr: Ye,
2630
- fi: Qe,
2631
- lt: _e
2632
- }, N = new f.Quaternion(), T = new f.Euler(), ie = new f.Vector3(), oe = new f.Vector3(), Ie = new f.Box3();
2625
+ LipsyncLt: et
2626
+ }, Symbol.toStringTag, { value: "Module" })), it = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZ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AgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHRoaXMuX3VuZGVycnVuQm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NzZWQ7CiAgICAgICAgdHJ5IHsKICAgICAgICAgIHRoaXMucG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgIHR5cGU6ICJtZXRyaWNzIiwKICAgICAgICAgICAgZGF0YTogewogICAgICAgICAgICAgIHN0YXRlOiB0aGlzLl9zdGF0ZSwKICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzLAogICAgICAgICAgICAgIHF1ZXVlZE1zOiBNYXRoLnJvdW5kKChxdWV1ZWRTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICBtYXhRdWV1ZWRNczogTWF0aC5yb3VuZCgodGhpcy5fbWF4UXVldWVTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICB1bmRlcnJ1bkJsb2NrczogdGhpcy5fdW5kZXJydW5CbG9ja3MsCiAgICAgICAgICAgICAgZnJhbWVzUHJvY2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), ke = {
2627
+ en: je,
2628
+ de: qe,
2629
+ fr: Ke,
2630
+ fi: $e,
2631
+ lt: tt
2632
+ }, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), ne = new f.Vector3(), we = 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 Je = new f.Vector3(1, 0, 0);
2637
+ const nt = new f.Vector3(1, 0, 0);
2638
2638
  new f.Vector3(0, 1, 0);
2639
2639
  new f.Vector3(0, 0, 1);
2640
- class Se {
2640
+ class He {
2641
2641
  /**
2642
2642
  * Avatar.
2643
2643
  * @typedef {Object} Avatar
@@ -2763,7 +2763,7 @@ class Se {
2763
2763
  avatarOnlyCamera: null,
2764
2764
  statsNode: null,
2765
2765
  statsStyle: null
2766
- }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new Pe(), this.opt.statsStyle && (this.stats.dom.style.cssText = this.opt.statsStyle), this.opt.statsNode.appendChild(this.stats.dom)), this.poseTemplates = {
2766
+ }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new Ue(), 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 Se {
4062
4062
  this.opt.lightSpotDispersion
4063
4063
  ), this.setLighting(this.opt);
4064
4064
  const r = new f.PMREMGenerator(this.renderer);
4065
- r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new Fe()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Te(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;
4065
+ r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new Ne()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Be(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 Se {
4080
4080
  Object.entries(s).forEach((r, h) => {
4081
4081
  const a = new f.Bone();
4082
4082
  a.name = r[0], r[1] ? this.ikMesh.getObjectByName(r[1]).add(a) : this.ikMesh.add(a), o.push(a);
4083
- }), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new Ne(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
4083
+ }), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new Ze(), 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 Ue(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(
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 Xe(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 Se {
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 Me();
4231
+ const i = new De();
4232
4232
  if (this.dracoEnabled) {
4233
- const a = new Ee();
4233
+ const a = new Oe();
4234
4234
  a.setDecoderPath(this.dracoDecoderPath), i.setDRACOLoader(a);
4235
4235
  }
4236
4236
  let n = await i.loadAsync(t.url, e);
@@ -4374,9 +4374,9 @@ class Se {
4374
4374
  updatePoseDelta() {
4375
4375
  for (const [t, e] of Object.entries(this.poseDelta.props)) {
4376
4376
  if (e.x === 0 && e.y === 0 && e.z === 0) continue;
4377
- T.set(e.x, e.y, e.z);
4377
+ M.set(e.x, e.y, e.z);
4378
4378
  const i = this.poseAvatar.props[t];
4379
- i.isQuaternion ? (N.setFromEuler(T), i.multiply(N)) : i.isVector3 && i.add(T);
4379
+ i.isQuaternion ? (N.setFromEuler(M), i.multiply(N)) : i.isVector3 && i.add(M);
4380
4380
  }
4381
4381
  }
4382
4382
  /**
@@ -5159,7 +5159,7 @@ class Se {
5159
5159
  }, n.x ? new f.Vector3(n.x, n.y, n.z) : null, !0, n.d);
5160
5160
  break;
5161
5161
  }
5162
- if ((h || a) && (T.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), T.x = Math.max(-0.9, Math.min(0.9, 2 * T.x - 0.5)), T.y = Math.max(-0.9, Math.min(0.9, -2.5 * T.y)), h ? (Object.assign(this.mtAvatar.eyesLookDown, { system: T.x < 0 ? -T.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: T.x < 0 ? 0 : T.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: T.y < 0 ? -T.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: T.y < 0 ? 0 : T.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: T.y < 0 ? 0 : T.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: T.y < 0 ? -T.y : 0, needsUpdate: !0 }), a && (i = -this.mtAvatar.bodyRotateY.value, n = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5162
+ if ((h || a) && (M.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), M.x = Math.max(-0.9, Math.min(0.9, 2 * M.x - 0.5)), M.y = Math.max(-0.9, Math.min(0.9, -2.5 * M.y)), h ? (Object.assign(this.mtAvatar.eyesLookDown, { system: M.x < 0 ? -M.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: M.x < 0 ? 0 : M.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: M.y < 0 ? -M.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: M.y < 0 ? 0 : M.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: M.y < 0 ? 0 : M.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: M.y < 0 ? -M.y : 0, needsUpdate: !0 }), a && (i = -this.mtAvatar.bodyRotateY.value, n = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5163
5163
  name: "headmove",
5164
5164
  dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
5165
5165
  vs: {
@@ -5180,7 +5180,7 @@ class Se {
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 + r / 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) && h ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (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 && (N.setFromAxisAngle(Je, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), Ie.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(oe), oe.sub(this.armature.position), this.objectHips.position.y -= Ie.min.y / 2, this.objectHips.position.x -= (ie.x + oe.x) / 4, this.objectHips.position.z -= (ie.z + oe.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
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 + r / 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) && h ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (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 && (N.setFromAxisAngle(nt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), we.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(ne), ne.sub(this.armature.position), this.objectHips.position.y -= we.min.y / 2, this.objectHips.position.x -= (ie.x + ne.x) / 4, this.objectHips.position.z -= (ie.z + ne.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 Se {
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 = ve[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(ve));
5214
+ const s = ke[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(ke));
5216
5216
  } catch (s) {
5217
5217
  console.warn(`Failed to load lip-sync module for ${t}:`, s);
5218
5218
  }
@@ -5251,10 +5251,10 @@ class Se {
5251
5251
  let u = "", l = "", 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 v = x === y.length - 1, C = y[x].match(r);
5254
+ const v = x === y.length - 1, T = y[x].match(r);
5255
5255
  let p = y[x].match(s);
5256
- const E = y[x].match(h), z = y[x].match(o);
5257
- if (p && !v && !E && y[x + 1].match(s) && (p = !1), i && (u += y[x]), C && (!n || n.every((I) => x < I[0] || x > I[1])) && (l += y[x]), (z || p || v) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && d.push({
5256
+ const F = y[x].match(h), C = y[x].match(o);
5257
+ if (p && !v && !F && y[x + 1].match(s) && (p = !1), i && (u += y[x]), T && (!n || n.every((I) => x < I[0] || x > I[1])) && (l += y[x]), (C || p || v) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && d.push({
5258
5258
  mark: c,
5259
5259
  word: l
5260
5260
  })), u.length && (g.push({
@@ -5267,14 +5267,14 @@ class Se {
5267
5267
  }), u = ""), l.length)) {
5268
5268
  const I = this.lipsyncWordsToVisemes(l, a);
5269
5269
  if (I && I.visemes && I.visemes.length) {
5270
- const D = I.times[I.visemes.length - 1] + I.durations[I.visemes.length - 1];
5271
- for (let P = 0; P < I.visemes.length; P++)
5270
+ const O = I.times[I.visemes.length - 1] + I.durations[I.visemes.length - 1];
5271
+ for (let B = 0; B < I.visemes.length; B++)
5272
5272
  g.push({
5273
5273
  mark: c,
5274
5274
  template: { name: "viseme" },
5275
- ts: [(I.times[P] - 0.6) / D, (I.times[P] + 0.5) / D, (I.times[P] + I.durations[P] + 0.5) / D],
5275
+ ts: [(I.times[B] - 0.6) / O, (I.times[B] + 0.5) / O, (I.times[B] + I.durations[B] + 0.5) / O],
5276
5276
  vs: {
5277
- ["viseme_" + I.visemes[P]]: [null, I.visemes[P] === "PP" || I.visemes[P] === "FF" ? 0.9 : 0.6, 0]
5277
+ ["viseme_" + I.visemes[B]]: [null, I.visemes[B] === "PP" || I.visemes[B] === "FF" ? 0.9 : 0.6, 0]
5278
5278
  }
5279
5279
  });
5280
5280
  }
@@ -5287,7 +5287,7 @@ class Se {
5287
5287
  };
5288
5288
  i && (I.onSubtitles = i), d.length && !e.avatarMute && (I.text = d, e.avatarMood && (I.mood = e.avatarMood), e.ttsLang && (I.lang = e.ttsLang), e.ttsVoice && (I.voice = e.ttsVoice), e.ttsRate && (I.rate = e.ttsRate), e.ttsVoice && (I.pitch = e.ttsPitch), e.ttsVolume && (I.volume = e.ttsVolume)), this.speechQueue.push(I), d = [], l = "", c = 0, g = [];
5289
5289
  }
5290
- if (E) {
5290
+ if (F) {
5291
5291
  let I = this.animEmojis[y[x]];
5292
5292
  I && I.link && (I = this.animEmojis[I.link]), I && this.speechQueue.push({ emoji: I });
5293
5293
  }
@@ -5385,10 +5385,10 @@ class Se {
5385
5385
  let y = 0.6 + this.convertRange(g, [0, u], [0, 0.4]);
5386
5386
  if (u = Math.min(u, c.visemes.length * 200), d > 0)
5387
5387
  for (let x = 0; x < c.visemes.length; x++) {
5388
- const v = a + c.times[x] / d * u, C = c.durations[x] / d * u;
5388
+ const v = a + c.times[x] / d * u, T = c.durations[x] / d * u;
5389
5389
  o.push({
5390
5390
  template: { name: "viseme" },
5391
- ts: [v - Math.min(60, 2 * C / 3), v + Math.min(25, C / 2), v + C + Math.min(60, C / 2)],
5391
+ ts: [v - Math.min(60, 2 * T / 3), v + Math.min(25, T / 2), v + T + Math.min(60, T / 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
  }
@@ -5470,7 +5470,7 @@ class Se {
5470
5470
  s.lang = o, s.rate = Math.max(0.1, Math.min(10, r)), s.pitch = Math.max(0, Math.min(2, h)), s.volume = Math.max(0, Math.min(1, a));
5471
5471
  const u = speechSynthesis.getVoices(), l = t.voice || this.avatar.ttsVoice || this.opt.ttsVoice;
5472
5472
  if (l && u.length > 0) {
5473
- const p = u.find((E) => E.name.includes(l) || E.lang === o);
5473
+ const p = u.find((F) => F.name.includes(l) || F.lang === o);
5474
5474
  p && (s.voice = p);
5475
5475
  }
5476
5476
  const c = n.length * 100 / s.rate, d = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (c / 1e3), this.audioCtx.sampleRate), g = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", y = this.lipsyncPreProcessText(n, g), x = this.lipsyncWordsToVisemes(y, g);
@@ -5485,19 +5485,19 @@ class Se {
5485
5485
  const v = [];
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
- for (let E = 0; E < x.visemes.length; E++) {
5489
- const z = x.visemes[E], I = x.times[E] / p, D = x.durations[E] / p, P = I * c, J = D * c;
5488
+ for (let F = 0; F < x.visemes.length; F++) {
5489
+ const C = x.visemes[F], I = x.times[F] / p, O = x.durations[F] / p, B = I * c, $ = O * c;
5490
5490
  v.push({
5491
5491
  template: { name: "viseme" },
5492
- ts: [P - Math.min(60, 2 * J / 3), P + Math.min(25, J / 2), P + J + Math.min(60, J / 2)],
5492
+ ts: [B - Math.min(60, 2 * $ / 3), B + Math.min(25, $ / 2), B + $ + Math.min(60, $ / 2)],
5493
5493
  vs: {
5494
- ["viseme_" + z]: [null, z === "PP" || z === "FF" ? 0.9 : 0.6, 0]
5494
+ ["viseme_" + C]: [null, C === "PP" || C === "FF" ? 0.9 : 0.6, 0]
5495
5495
  }
5496
5496
  });
5497
5497
  }
5498
5498
  }
5499
- const C = [...t.anim, ...v];
5500
- this.audioPlaylist.push({ anim: C, audio: d }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
5499
+ const T = [...t.anim, ...v];
5500
+ this.audioPlaylist.push({ anim: T, 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 Se {
5895
5895
  }
5896
5896
  if (!this.workletLoaded)
5897
5897
  try {
5898
- const r = this.audioCtx.audioWorklet.addModule(Ke.href), h = new Promise(
5898
+ const r = this.audioCtx.audioWorklet.addModule(it.href), h = new Promise(
5899
5899
  (a, u) => setTimeout(() => u(new Error("Worklet loading timed out")), 5e3)
5900
5900
  );
5901
5901
  await Promise.race([r, h]), this.workletLoaded = !0;
@@ -6133,7 +6133,7 @@ class Se {
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), ie.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), oe.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(ie, oe).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) {
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), ie.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), ne.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(ie, ne).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,12 +6146,12 @@ class Se {
6146
6146
  this.lookAt(null, null, t);
6147
6147
  return;
6148
6148
  }
6149
- this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), ie.setFromMatrixPosition(this.objectLeftEye.matrixWorld), oe.setFromMatrixPosition(this.objectRightEye.matrixWorld), ie.add(oe).divideScalar(2), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]);
6149
+ this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), ie.setFromMatrixPosition(this.objectLeftEye.matrixWorld), ne.setFromMatrixPosition(this.objectRightEye.matrixWorld), ie.add(ne).divideScalar(2), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]);
6150
6150
  const i = new f.Vector3().subVectors(e, ie).normalize(), n = Math.atan2(i.x, i.z), s = Math.asin(-i.y);
6151
- T.set(s, n, 0, "YXZ");
6152
- const r = new f.Quaternion().setFromEuler(T), h = new f.Quaternion().copy(r).multiply(N.clone().invert());
6153
- T.setFromQuaternion(h, "YXZ");
6154
- let a = T.x / (40 / 24) + 0.2, u = T.y / (9 / 4), l = Math.min(0.6, Math.max(-0.3, a)), c = Math.min(0.8, Math.max(-0.8, u)), d = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6151
+ M.set(s, n, 0, "YXZ");
6152
+ const r = new f.Quaternion().setFromEuler(M), h = new f.Quaternion().copy(r).multiply(N.clone().invert());
6153
+ M.setFromQuaternion(h, "YXZ");
6154
+ let a = M.x / (40 / 24) + 0.2, u = M.y / (9 / 4), l = Math.min(0.6, Math.max(-0.3, a)), c = Math.min(0.8, Math.max(-0.8, u)), d = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6155
6155
  if (t) {
6156
6156
  let y = this.animQueue.findIndex((v) => v.template.name === "lookat");
6157
6157
  y !== -1 && this.animQueue.splice(y, 1);
@@ -6186,20 +6186,20 @@ class Se {
6186
6186
  const s = new f.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new f.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), r = new f.Vector3().addVectors(s, o).divideScalar(2);
6187
6187
  r.project(this.camera);
6188
6188
  let h = (r.x + 1) / 2 * n.width + n.left, a = -(r.y - 1) / 2 * n.height + n.top;
6189
- t === null && (t = h), e === null && (e = a), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]), T.setFromQuaternion(N);
6190
- let u = T.x / (40 / 24), l = T.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 - h, h), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - u + c, v = this.convertRange(t, [h - g, h + g], [-0.8, 0.8]) - l + d;
6189
+ t === null && (t = h), e === null && (e = a), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]), M.setFromQuaternion(N);
6190
+ let u = M.x / (40 / 24), l = 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 - h, h), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - u + c, v = this.convertRange(t, [h - g, h + g], [-0.8, 0.8]) - l + d;
6191
6191
  x = Math.min(0.6, Math.max(-0.3, x)), v = Math.min(0.8, Math.max(-0.8, v));
6192
- let C = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6192
+ let T = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6193
6193
  if (i) {
6194
- let E = this.animQueue.findIndex((I) => I.template.name === "lookat");
6195
- E !== -1 && this.animQueue.splice(E, 1);
6196
- const z = {
6194
+ let F = this.animQueue.findIndex((I) => I.template.name === "lookat");
6195
+ F !== -1 && this.animQueue.splice(F, 1);
6196
+ const C = {
6197
6197
  name: "lookat",
6198
6198
  dt: [750, i],
6199
6199
  vs: {
6200
- bodyRotateX: [x + C],
6200
+ bodyRotateX: [x + T],
6201
6201
  bodyRotateY: [v + p],
6202
- eyesRotateX: [-3 * C + 0.1],
6202
+ eyesRotateX: [-3 * T + 0.1],
6203
6203
  eyesRotateY: [-5 * p],
6204
6204
  browInnerUp: [[0, 0.7]],
6205
6205
  mouthLeft: [[0, 0.7]],
@@ -6208,7 +6208,7 @@ class Se {
6208
6208
  headMove: [0]
6209
6209
  }
6210
6210
  };
6211
- this.animQueue.push(this.animFactory(z));
6211
+ this.animQueue.push(this.animFactory(C));
6212
6212
  }
6213
6213
  }
6214
6214
  /**
@@ -6403,7 +6403,7 @@ class Se {
6403
6403
  } catch (c) {
6404
6404
  console.warn(`Could not verify file existence for ${t}, attempting to load anyway:`, c);
6405
6405
  }
6406
- const u = new be();
6406
+ const u = new Le();
6407
6407
  let l;
6408
6408
  try {
6409
6409
  l = await u.loadAsync(t, e);
@@ -6480,7 +6480,7 @@ class Se {
6480
6480
  let r = this.animQueue.find((h) => h.template.name === "pose");
6481
6481
  r && (r.ts[0] = this.animClock + i * 1e3 + 2e3), this.setPoseFromTemplate(o);
6482
6482
  } else {
6483
- let h = await new be().loadAsync(t, e);
6483
+ let h = await new Le().loadAsync(t, e);
6484
6484
  if (h && h.animations && h.animations[n]) {
6485
6485
  let a = h.animations[n];
6486
6486
  const u = {};
@@ -6577,12 +6577,12 @@ class Se {
6577
6577
  const x = t.iterations || 10;
6578
6578
  if (e)
6579
6579
  for (let v = 0; v < x; v++) {
6580
- let C = !1;
6581
- for (let p = 0, E = y.length; p < E; p++) {
6582
- const z = y[p].bone;
6583
- z.matrixWorld.decompose(h, a, u), a.invert(), o.setFromMatrixPosition(g.matrixWorld), r.subVectors(o, h), r.applyQuaternion(a), r.normalize(), s.subVectors(e, h), s.applyQuaternion(a), s.normalize();
6580
+ let T = !1;
6581
+ for (let p = 0, F = y.length; p < F; p++) {
6582
+ const C = y[p].bone;
6583
+ C.matrixWorld.decompose(h, a, u), a.invert(), o.setFromMatrixPosition(g.matrixWorld), r.subVectors(o, h), r.applyQuaternion(a), r.normalize(), s.subVectors(e, h), s.applyQuaternion(a), s.normalize();
6584
6584
  let I = s.dot(r);
6585
- I > 1 ? I = 1 : I < -1 && (I = -1), I = Math.acos(I), !(I < 1e-5) && (y[p].minAngle !== void 0 && I < y[p].minAngle && (I = y[p].minAngle), y[p].maxAngle !== void 0 && I > y[p].maxAngle && (I = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, I), z.quaternion.multiply(N), z.rotation.setFromVector3(c.setFromEuler(z.rotation).clamp(new f.Vector3(
6585
+ I > 1 ? I = 1 : I < -1 && (I = -1), I = Math.acos(I), !(I < 1e-5) && (y[p].minAngle !== void 0 && I < y[p].minAngle && (I = y[p].minAngle), y[p].maxAngle !== void 0 && I > y[p].maxAngle && (I = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, I), C.quaternion.multiply(N), C.rotation.setFromVector3(c.setFromEuler(C.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 Se {
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), C = !0);
6593
+ ))), C.updateMatrixWorld(!0), T = !0);
6594
6594
  }
6595
- if (!C) break;
6595
+ if (!T) break;
6596
6596
  }
6597
6597
  n && y.forEach((v) => {
6598
6598
  this.poseTarget.props[v.link + ".quaternion"].copy(v.bone.quaternion), this.poseTarget.props[v.link + ".quaternion"].t = this.animClock, this.poseTarget.props[v.link + ".quaternion"].d = n;
@@ -6625,7 +6625,7 @@ const ae = {
6625
6625
  josh: "VR6AewLTigWG4xSOukaG"
6626
6626
  // Male, American
6627
6627
  }
6628
- }, Ae = {
6628
+ }, ze = {
6629
6629
  defaultVoice: "aura-2-thalia-en",
6630
6630
  // Thalia (Female, English)
6631
6631
  voices: {
@@ -6645,7 +6645,7 @@ const ae = {
6645
6645
  // Male, English - Powerful
6646
6646
  }
6647
6647
  };
6648
- function xe() {
6648
+ function ve() {
6649
6649
  return {
6650
6650
  service: "elevenlabs",
6651
6651
  endpoint: ae.endpoint,
@@ -6654,17 +6654,17 @@ function xe() {
6654
6654
  voices: ae.voices
6655
6655
  };
6656
6656
  }
6657
- function ht() {
6658
- const B = xe(), t = [];
6659
- return Object.entries(B.voices).forEach(([e, i]) => {
6657
+ function pt() {
6658
+ const D = ve(), t = [];
6659
+ return Object.entries(D.voices).forEach(([e, i]) => {
6660
6660
  t.push({
6661
6661
  value: i,
6662
- label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${B.service})`
6662
+ label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${D.service})`
6663
6663
  });
6664
6664
  }), t;
6665
6665
  }
6666
- const ke = ye(({
6667
- avatarUrl: B = "/avatars/brunette.glb",
6666
+ const Te = be(({
6667
+ avatarUrl: D = "/avatars/brunette.glb",
6668
6668
  avatarBody: t = "F",
6669
6669
  mood: e = "neutral",
6670
6670
  ttsLang: i = "en",
@@ -6685,66 +6685,66 @@ const ke = ye(({
6685
6685
  style: y = {},
6686
6686
  animations: x = {}
6687
6687
  }, v) => {
6688
- const C = X(null), p = X(null), [E, z] = re(!0), [I, D] = re(null), [P, J] = re(!1), Y = xe(), S = n || Y.service;
6689
- let F;
6690
- S === "browser" ? F = {
6688
+ const T = Y(null), p = Y(null), [F, C] = re(!0), [I, O] = re(null), [B, $] = re(!1), j = ve(), S = n || j.service;
6689
+ let P;
6690
+ S === "browser" ? P = {
6691
6691
  service: "browser",
6692
6692
  endpoint: "",
6693
6693
  apiKey: null,
6694
6694
  defaultVoice: "Google US English"
6695
- } : S === "elevenlabs" ? F = {
6695
+ } : S === "elevenlabs" ? P = {
6696
6696
  service: "elevenlabs",
6697
6697
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
6698
- apiKey: o || Y.apiKey,
6699
- defaultVoice: s || Y.defaultVoice || ae.defaultVoice,
6700
- voices: Y.voices || ae.voices
6701
- } : S === "deepgram" ? F = {
6698
+ apiKey: o || j.apiKey,
6699
+ defaultVoice: s || j.defaultVoice || ae.defaultVoice,
6700
+ voices: j.voices || ae.voices
6701
+ } : S === "deepgram" ? P = {
6702
6702
  service: "deepgram",
6703
6703
  endpoint: "https://api.deepgram.com/v1/speak",
6704
- apiKey: o || Y.apiKey,
6705
- defaultVoice: s || Y.defaultVoice || Ae.defaultVoice,
6706
- voices: Y.voices || Ae.voices
6707
- } : F = {
6708
- ...Y,
6704
+ apiKey: o || j.apiKey,
6705
+ defaultVoice: s || j.defaultVoice || ze.defaultVoice,
6706
+ voices: j.voices || ze.voices
6707
+ } : P = {
6708
+ ...j,
6709
6709
  // Override API key if provided via props
6710
- apiKey: o !== null ? o : Y.apiKey
6710
+ apiKey: o !== null ? o : j.apiKey
6711
6711
  };
6712
6712
  const W = {
6713
- url: B,
6713
+ url: D,
6714
6714
  body: t,
6715
6715
  avatarMood: e,
6716
6716
  ttsLang: S === "browser" ? "en-US" : i,
6717
- ttsVoice: s || F.defaultVoice,
6717
+ ttsVoice: s || P.defaultVoice,
6718
6718
  lipsyncLang: "en",
6719
6719
  showFullAvatar: a,
6720
6720
  bodyMovement: r,
6721
6721
  movementIntensity: h
6722
6722
  }, V = {
6723
- ttsEndpoint: F.endpoint,
6724
- ttsApikey: F.apiKey,
6723
+ ttsEndpoint: P.endpoint,
6724
+ ttsApikey: P.apiKey,
6725
6725
  ttsService: S,
6726
6726
  lipsyncModules: ["en"],
6727
6727
  cameraView: u
6728
- }, Q = M(async () => {
6729
- if (!(!C.current || p.current))
6728
+ }, q = E(async () => {
6729
+ if (!(!T.current || p.current))
6730
6730
  try {
6731
- if (z(!0), D(null), p.current = new Se(C.current, V), 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(W, (U) => {
6731
+ if (C(!0), O(null), p.current = new He(T.current, V), 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(W, (U) => {
6732
6732
  if (U.lengthComputable) {
6733
- const O = Math.min(100, Math.round(U.loaded / U.total * 100));
6734
- c(O);
6733
+ const w = Math.min(100, Math.round(U.loaded / U.total * 100));
6734
+ c(w);
6735
6735
  }
6736
6736
  }), await new Promise((U) => {
6737
- const O = () => {
6738
- p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? U() : setTimeout(O, 100);
6737
+ const w = () => {
6738
+ p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? U() : setTimeout(w, 100);
6739
6739
  };
6740
- O();
6740
+ w();
6741
6741
  }), p.current && p.current.setShowFullAvatar)
6742
6742
  try {
6743
6743
  p.current.setShowFullAvatar(a);
6744
6744
  } catch (U) {
6745
6745
  console.warn("Error setting full body mode on initialization:", U);
6746
6746
  }
6747
- 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()), z(!1), J(!0), l(p.current);
6747
+ 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()), C(!1), $(!0), l(p.current);
6748
6748
  const H = () => {
6749
6749
  document.visibilityState === "visible" ? p.current?.start() : p.current?.stop();
6750
6750
  };
@@ -6752,128 +6752,152 @@ const ke = ye(({
6752
6752
  document.removeEventListener("visibilitychange", H);
6753
6753
  };
6754
6754
  } catch (L) {
6755
- console.error("Error initializing TalkingHead:", L), D(L.message || "Failed to initialize avatar"), z(!1), d(L);
6755
+ console.error("Error initializing TalkingHead:", L), O(L.message || "Failed to initialize avatar"), C(!1), d(L);
6756
6756
  }
6757
- }, [B, t, e, i, n, s, o, a, r, h, u]);
6758
- he(() => (Q(), () => {
6757
+ }, [D, t, e, i, n, s, o, a, r, h, u]);
6758
+ he(() => (q(), () => {
6759
6759
  p.current && (p.current.stop(), p.current.dispose(), p.current = null);
6760
- }), [Q]), he(() => {
6761
- if (!C.current || !p.current) return;
6760
+ }), [q]), he(() => {
6761
+ if (!T.current || !p.current) return;
6762
6762
  const L = new ResizeObserver((U) => {
6763
- for (const O of U)
6763
+ for (const w of U)
6764
6764
  p.current && p.current.onResize && p.current.onResize();
6765
6765
  });
6766
- L.observe(C.current);
6766
+ L.observe(T.current);
6767
6767
  const H = () => {
6768
6768
  p.current && p.current.onResize && p.current.onResize();
6769
6769
  };
6770
6770
  return window.addEventListener("resize", H), () => {
6771
6771
  L.disconnect(), window.removeEventListener("resize", H);
6772
6772
  };
6773
- }, [P]);
6774
- const q = M(async () => {
6773
+ }, [B]);
6774
+ const _ = E(async () => {
6775
6775
  if (p.current && p.current.audioCtx)
6776
6776
  try {
6777
6777
  (p.current.audioCtx.state === "suspended" || p.current.audioCtx.state === "interrupted") && (await p.current.audioCtx.resume(), console.log("Audio context resumed"));
6778
6778
  } catch (L) {
6779
6779
  console.warn("Failed to resume audio context:", L);
6780
6780
  }
6781
- }, []), le = M(async (L, H = {}) => {
6782
- if (p.current && P)
6781
+ }, []), le = E(async (L, H = {}) => {
6782
+ if (p.current && B)
6783
6783
  try {
6784
- await q();
6784
+ await _();
6785
6785
  const U = {
6786
6786
  ...H,
6787
6787
  lipsyncLang: H.lipsyncLang || W.lipsyncLang || "en"
6788
6788
  };
6789
6789
  if (H.onSpeechEnd && p.current) {
6790
- const O = p.current, ne = O.onAudioEnd;
6791
- let $ = null, pe = 0;
6792
- const ze = 600, Ce = () => {
6793
- if (pe++, pe > ze) {
6794
- $ && (clearInterval($), $ = null);
6790
+ const w = p.current;
6791
+ let G = null, se = 0, ue = !1;
6792
+ const Ee = 1200, Fe = 1e4;
6793
+ let Ie = 0;
6794
+ const fe = setInterval(() => {
6795
+ Ie++, w && w.isSpeaking && (w.audioPlaylist && w.audioPlaylist.length > 0 || w.isAudioPlaying === !0) && (ue = !0, clearInterval(fe), G = setInterval(Ae, 50));
6796
+ const de = !w.speechQueue || w.speechQueue.length === 0;
6797
+ if (w && !w.isSpeaking && de && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1)) {
6798
+ clearInterval(fe);
6799
+ try {
6800
+ H.onSpeechEnd();
6801
+ } catch (ce) {
6802
+ console.error("Error in onSpeechEnd callback:", ce);
6803
+ }
6804
+ return;
6805
+ }
6806
+ if (Ie * 50 > Fe) {
6807
+ if (clearInterval(fe), w && w.isSpeaking)
6808
+ ue = !0, G = setInterval(Ae, 50);
6809
+ else if (w && !w.isSpeaking && de && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1))
6810
+ try {
6811
+ H.onSpeechEnd();
6812
+ } catch (ce) {
6813
+ console.error("Error in onSpeechEnd callback:", ce);
6814
+ }
6815
+ }
6816
+ }, 50), Ae = () => {
6817
+ if (se++, se > Ee) {
6818
+ G && (clearInterval(G), G = null);
6795
6819
  try {
6796
6820
  H.onSpeechEnd();
6797
- } catch (ge) {
6798
- console.error("Error in onSpeechEnd callback:", ge);
6821
+ } catch (xe) {
6822
+ console.error("Error in onSpeechEnd callback:", xe);
6799
6823
  }
6800
6824
  return;
6801
6825
  }
6802
- O && (!O.isSpeaking || O.isSpeaking === !1) && (!O.audioPlaylist || O.audioPlaylist.length === 0) && (!O.isAudioPlaying || O.isAudioPlaying === !1) && ($ && (clearInterval($), $ = null), setTimeout(() => {
6826
+ if (!ue)
6827
+ return;
6828
+ const de = !w.speechQueue || w.speechQueue.length === 0;
6829
+ w && (!w.isSpeaking || w.isSpeaking === !1) && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1) && de && (G && (clearInterval(G), G = null), setTimeout(() => {
6803
6830
  try {
6804
6831
  H.onSpeechEnd();
6805
- } catch (ge) {
6806
- console.error("Error in onSpeechEnd callback:", ge);
6832
+ } catch (xe) {
6833
+ console.error("Error in onSpeechEnd callback:", xe);
6807
6834
  }
6808
- }, 10));
6835
+ }, 50));
6809
6836
  };
6810
- setTimeout(() => {
6811
- $ = setInterval(Ce, 50);
6812
- }, 100);
6813
6837
  }
6814
6838
  p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(L, U)) : setTimeout(async () => {
6815
- await q(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(L, U));
6839
+ await _(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(L, U));
6816
6840
  }, 100);
6817
6841
  } catch (U) {
6818
- console.error("Error speaking text:", U), D(U.message || "Failed to speak text");
6842
+ console.error("Error speaking text:", U), O(U.message || "Failed to speak text");
6819
6843
  }
6820
- }, [P, q, W.lipsyncLang]), me = M(() => {
6844
+ }, [B, _, W.lipsyncLang]), ye = E(() => {
6821
6845
  p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1));
6822
- }, []), _ = M((L) => {
6846
+ }, []), K = E((L) => {
6823
6847
  p.current && p.current.setMood(L);
6824
- }, []), b = M((L) => {
6848
+ }, []), b = E((L) => {
6825
6849
  p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(L);
6826
- }, []), R = M((L, H = !1) => {
6850
+ }, []), R = E((L, H = !1) => {
6827
6851
  if (p.current && p.current.playAnimation) {
6828
6852
  if (x && x[L] && (L = x[L]), p.current.setShowFullAvatar)
6829
6853
  try {
6830
6854
  p.current.setShowFullAvatar(!0);
6831
- } catch (O) {
6832
- console.warn("Error setting full body mode:", O);
6855
+ } catch (w) {
6856
+ console.warn("Error setting full body mode:", w);
6833
6857
  }
6834
6858
  if (L.includes("."))
6835
6859
  try {
6836
6860
  p.current.playAnimation(L, null, 10, 0, 0.01, H);
6837
- } catch (O) {
6838
- console.warn(`Failed to play ${L}:`, O);
6861
+ } catch (w) {
6862
+ console.warn(`Failed to play ${L}:`, w);
6839
6863
  try {
6840
6864
  p.current.setBodyMovement("idle");
6841
- } catch (ne) {
6842
- console.warn("Fallback animation also failed:", ne);
6865
+ } catch (G) {
6866
+ console.warn("Fallback animation also failed:", G);
6843
6867
  }
6844
6868
  }
6845
6869
  else {
6846
- const O = [".fbx", ".glb", ".gltf"];
6847
- let ne = !1;
6848
- for (const $ of O)
6870
+ const w = [".fbx", ".glb", ".gltf"];
6871
+ let G = !1;
6872
+ for (const se of w)
6849
6873
  try {
6850
- p.current.playAnimation(L + $, null, 10, 0, 0.01, H), ne = !0;
6874
+ p.current.playAnimation(L + se, null, 10, 0, 0.01, H), G = !0;
6851
6875
  break;
6852
6876
  } catch {
6853
6877
  }
6854
- if (!ne) {
6878
+ if (!G) {
6855
6879
  console.warn("Animation not found:", L);
6856
6880
  try {
6857
6881
  p.current.setBodyMovement("idle");
6858
- } catch ($) {
6859
- console.warn("Fallback animation also failed:", $);
6882
+ } catch (se) {
6883
+ console.warn("Fallback animation also failed:", se);
6860
6884
  }
6861
6885
  }
6862
6886
  }
6863
6887
  }
6864
- }, [x]), w = M(() => {
6888
+ }, [x]), z = E(() => {
6865
6889
  p.current && p.current.onResize && p.current.onResize();
6866
6890
  }, []);
6867
- return fe(v, () => ({
6891
+ return Re(v, () => ({
6868
6892
  speakText: le,
6869
- stopSpeaking: me,
6870
- resumeAudioContext: q,
6871
- setMood: _,
6893
+ stopSpeaking: ye,
6894
+ resumeAudioContext: _,
6895
+ setMood: K,
6872
6896
  setTimingAdjustment: b,
6873
6897
  playAnimation: R,
6874
- isReady: P,
6898
+ isReady: B,
6875
6899
  talkingHead: p.current,
6876
- handleResize: w,
6900
+ handleResize: z,
6877
6901
  setBodyMovement: (L) => {
6878
6902
  if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
6879
6903
  try {
@@ -6931,7 +6955,7 @@ const ke = ye(({
6931
6955
  console.warn("Error unlocking avatar position:", L);
6932
6956
  }
6933
6957
  }
6934
- })), /* @__PURE__ */ Le(
6958
+ })), /* @__PURE__ */ Ce(
6935
6959
  "div",
6936
6960
  {
6937
6961
  className: `talking-head-avatar ${g}`,
@@ -6942,10 +6966,10 @@ const ke = ye(({
6942
6966
  ...y
6943
6967
  },
6944
6968
  children: [
6945
- /* @__PURE__ */ se(
6969
+ /* @__PURE__ */ oe(
6946
6970
  "div",
6947
6971
  {
6948
- ref: C,
6972
+ ref: T,
6949
6973
  className: "talking-head-viewer",
6950
6974
  style: {
6951
6975
  width: "100%",
@@ -6954,7 +6978,7 @@ const ke = ye(({
6954
6978
  }
6955
6979
  }
6956
6980
  ),
6957
- E && /* @__PURE__ */ se("div", { className: "loading-overlay", style: {
6981
+ F && /* @__PURE__ */ oe("div", { className: "loading-overlay", style: {
6958
6982
  position: "absolute",
6959
6983
  top: "50%",
6960
6984
  left: "50%",
@@ -6963,7 +6987,7 @@ const ke = ye(({
6963
6987
  fontSize: "18px",
6964
6988
  zIndex: 10
6965
6989
  }, children: "Loading avatar..." }),
6966
- I && /* @__PURE__ */ se("div", { className: "error-overlay", style: {
6990
+ I && /* @__PURE__ */ oe("div", { className: "error-overlay", style: {
6967
6991
  position: "absolute",
6968
6992
  top: "50%",
6969
6993
  left: "50%",
@@ -6979,9 +7003,9 @@ const ke = ye(({
6979
7003
  }
6980
7004
  );
6981
7005
  });
6982
- ke.displayName = "TalkingHeadAvatar";
6983
- const $e = ye(({
6984
- text: B = "Hello! I'm a talking avatar. How are you today?",
7006
+ Te.displayName = "TalkingHeadAvatar";
7007
+ const ot = be(({
7008
+ text: D = "Hello! I'm a talking avatar. How are you today?",
6985
7009
  onLoading: t = () => {
6986
7010
  },
6987
7011
  onError: e = () => {
@@ -6992,7 +7016,7 @@ const $e = ye(({
6992
7016
  style: s = {},
6993
7017
  avatarConfig: o = {}
6994
7018
  }, r) => {
6995
- const h = X(null), a = X(null), [u, l] = re(!0), [c, d] = re(null), [g, y] = re(!1), x = xe(), v = o.ttsService || x.service, C = v === "browser" ? {
7019
+ const h = Y(null), a = Y(null), [u, l] = re(!0), [c, d] = re(null), [g, y] = re(!1), x = ve(), v = o.ttsService || x.service, T = v === "browser" ? {
6996
7020
  endpoint: "",
6997
7021
  apiKey: null,
6998
7022
  defaultVoice: "Google US English"
@@ -7008,7 +7032,7 @@ const $e = ye(({
7008
7032
  body: "F",
7009
7033
  avatarMood: "neutral",
7010
7034
  ttsLang: v === "browser" ? "en-US" : "en",
7011
- ttsVoice: o.ttsVoice || C.defaultVoice,
7035
+ ttsVoice: o.ttsVoice || T.defaultVoice,
7012
7036
  lipsyncLang: "en",
7013
7037
  // English lip-sync
7014
7038
  showFullAvatar: !0,
@@ -7016,16 +7040,16 @@ const $e = ye(({
7016
7040
  bodyMovement: "idle",
7017
7041
  movementIntensity: 0.5,
7018
7042
  ...o
7019
- }, E = {
7020
- ttsEndpoint: C.endpoint,
7021
- ttsApikey: C.apiKey,
7043
+ }, F = {
7044
+ ttsEndpoint: T.endpoint,
7045
+ ttsApikey: T.apiKey,
7022
7046
  ttsService: v,
7023
7047
  lipsyncModules: ["en"],
7024
7048
  cameraView: "upper"
7025
- }, z = M(async () => {
7049
+ }, C = E(async () => {
7026
7050
  if (!(!h.current || a.current))
7027
7051
  try {
7028
- if (l(!0), d(null), a.current = new Se(h.current, E), await a.current.showAvatar(p, (W) => {
7052
+ if (l(!0), d(null), a.current = new He(h.current, F), await a.current.showAvatar(p, (W) => {
7029
7053
  if (W.lengthComputable) {
7030
7054
  const V = Math.min(100, Math.round(W.loaded / W.total * 100));
7031
7055
  t(V);
@@ -7033,7 +7057,7 @@ const $e = ye(({
7033
7057
  }), a.current.morphs && a.current.morphs.length > 0) {
7034
7058
  const W = a.current.morphs[0].morphTargetDictionary;
7035
7059
  console.log("Available morph targets:", Object.keys(W));
7036
- const V = Object.keys(W).filter((Q) => Q.startsWith("viseme_"));
7060
+ const V = Object.keys(W).filter((q) => q.startsWith("viseme_"));
7037
7061
  console.log("Viseme morph targets found:", V), V.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"));
7038
7062
  }
7039
7063
  if (await new Promise((W) => {
@@ -7048,37 +7072,37 @@ const $e = ye(({
7048
7072
  console.warn("Error setting full body mode on initialization:", W);
7049
7073
  }
7050
7074
  l(!1), y(!0), i(a.current);
7051
- const F = () => {
7075
+ const P = () => {
7052
7076
  document.visibilityState === "visible" ? a.current?.start() : a.current?.stop();
7053
7077
  };
7054
- return document.addEventListener("visibilitychange", F), () => {
7055
- document.removeEventListener("visibilitychange", F);
7078
+ return document.addEventListener("visibilitychange", P), () => {
7079
+ document.removeEventListener("visibilitychange", P);
7056
7080
  };
7057
7081
  } catch (S) {
7058
7082
  console.error("Error initializing TalkingHead:", S), d(S.message || "Failed to initialize avatar"), l(!1), e(S);
7059
7083
  }
7060
7084
  }, []);
7061
- he(() => (z(), () => {
7085
+ he(() => (C(), () => {
7062
7086
  a.current && (a.current.stop(), a.current.dispose(), a.current = null);
7063
- }), [z]);
7064
- const I = M((S) => {
7087
+ }), [C]);
7088
+ const I = E((S) => {
7065
7089
  if (a.current && g)
7066
7090
  try {
7067
7091
  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(() => {
7068
7092
  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");
7069
7093
  }, 500));
7070
- } catch (F) {
7071
- console.error("Error speaking text:", F), d(F.message || "Failed to speak text");
7094
+ } catch (P) {
7095
+ console.error("Error speaking text:", P), d(P.message || "Failed to speak text");
7072
7096
  }
7073
7097
  else
7074
7098
  console.warn("Avatar not ready for speaking. isReady:", g, "talkingHeadRef:", !!a.current);
7075
- }, [g, p]), D = M(() => {
7099
+ }, [g, p]), O = E(() => {
7076
7100
  a.current && (a.current.stopSpeaking(), a.current.setSlowdownRate && (a.current.setSlowdownRate(1), console.log("Reset timing to normal")));
7077
- }, []), P = M((S) => {
7101
+ }, []), B = E((S) => {
7078
7102
  a.current && a.current.setMood(S);
7079
- }, []), J = M((S) => {
7103
+ }, []), $ = E((S) => {
7080
7104
  a.current && a.current.setSlowdownRate && (a.current.setSlowdownRate(S), console.log("Timing adjustment set to:", S));
7081
- }, []), Y = M((S, F = !1) => {
7105
+ }, []), j = E((S, P = !1) => {
7082
7106
  if (a.current && a.current.playAnimation) {
7083
7107
  if (a.current.setShowFullAvatar)
7084
7108
  try {
@@ -7088,51 +7112,51 @@ const $e = ye(({
7088
7112
  }
7089
7113
  if (S.includes("."))
7090
7114
  try {
7091
- a.current.playAnimation(S, null, 10, 0, 0.01, F), console.log("Playing animation:", S);
7115
+ a.current.playAnimation(S, null, 10, 0, 0.01, P), console.log("Playing animation:", S);
7092
7116
  } catch (V) {
7093
7117
  console.log(`Failed to play ${S}:`, V);
7094
7118
  try {
7095
7119
  a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
7096
- } catch (Q) {
7097
- console.warn("Fallback animation also failed:", Q);
7120
+ } catch (q) {
7121
+ console.warn("Fallback animation also failed:", q);
7098
7122
  }
7099
7123
  }
7100
7124
  else {
7101
7125
  const V = [".fbx", ".glb", ".gltf"];
7102
- let Q = !1;
7103
- for (const q of V)
7126
+ let q = !1;
7127
+ for (const _ of V)
7104
7128
  try {
7105
- a.current.playAnimation(S + q, null, 10, 0, 0.01, F), console.log("Playing animation:", S + q), Q = !0;
7129
+ a.current.playAnimation(S + _, null, 10, 0, 0.01, P), console.log("Playing animation:", S + _), q = !0;
7106
7130
  break;
7107
7131
  } catch {
7108
- console.log(`Failed to play ${S}${q}, trying next format...`);
7132
+ console.log(`Failed to play ${S}${_}, trying next format...`);
7109
7133
  }
7110
- if (!Q) {
7134
+ if (!q) {
7111
7135
  console.warn("Animation system not available or animation not found:", S);
7112
7136
  try {
7113
7137
  a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
7114
- } catch (q) {
7115
- console.warn("Fallback animation also failed:", q);
7138
+ } catch (_) {
7139
+ console.warn("Fallback animation also failed:", _);
7116
7140
  }
7117
7141
  }
7118
7142
  }
7119
7143
  } else
7120
7144
  console.warn("Animation system not available or animation not found:", S);
7121
7145
  }, []);
7122
- return fe(r, () => ({
7146
+ return Re(r, () => ({
7123
7147
  speakText: I,
7124
- stopSpeaking: D,
7125
- setMood: P,
7126
- setTimingAdjustment: J,
7127
- playAnimation: Y,
7148
+ stopSpeaking: O,
7149
+ setMood: B,
7150
+ setTimingAdjustment: $,
7151
+ playAnimation: j,
7128
7152
  isReady: g,
7129
7153
  talkingHead: a.current,
7130
7154
  setBodyMovement: (S) => {
7131
7155
  if (a.current && a.current.setShowFullAvatar && a.current.setBodyMovement)
7132
7156
  try {
7133
7157
  a.current.setShowFullAvatar(!0), a.current.setBodyMovement(S), console.log("Body movement set with full body mode:", S);
7134
- } catch (F) {
7135
- console.warn("Error setting body movement:", F);
7158
+ } catch (P) {
7159
+ console.warn("Error setting body movement:", P);
7136
7160
  }
7137
7161
  },
7138
7162
  setMovementIntensity: (S) => a.current?.setMovementIntensity(S),
@@ -7148,8 +7172,8 @@ const $e = ye(({
7148
7172
  if (a.current && a.current.setShowFullAvatar && a.current.playReaction)
7149
7173
  try {
7150
7174
  a.current.setShowFullAvatar(!0), a.current.playReaction(S), console.log("Reaction played with full body mode:", S);
7151
- } catch (F) {
7152
- console.warn("Error playing reaction:", F);
7175
+ } catch (P) {
7176
+ console.warn("Error playing reaction:", P);
7153
7177
  }
7154
7178
  },
7155
7179
  playCelebration: () => {
@@ -7164,8 +7188,8 @@ const $e = ye(({
7164
7188
  if (a.current && a.current.setShowFullAvatar)
7165
7189
  try {
7166
7190
  a.current.setShowFullAvatar(S), console.log("Show full avatar set to:", S);
7167
- } catch (F) {
7168
- console.warn("Error setting showFullAvatar:", F);
7191
+ } catch (P) {
7192
+ console.warn("Error setting showFullAvatar:", P);
7169
7193
  }
7170
7194
  },
7171
7195
  lockAvatarPosition: () => {
@@ -7184,8 +7208,8 @@ const $e = ye(({
7184
7208
  console.warn("Error unlocking avatar position:", S);
7185
7209
  }
7186
7210
  }
7187
- })), /* @__PURE__ */ Le("div", { className: `talking-head-container ${n}`, style: s, children: [
7188
- /* @__PURE__ */ se(
7211
+ })), /* @__PURE__ */ Ce("div", { className: `talking-head-container ${n}`, style: s, children: [
7212
+ /* @__PURE__ */ oe(
7189
7213
  "div",
7190
7214
  {
7191
7215
  ref: h,
@@ -7197,7 +7221,7 @@ const $e = ye(({
7197
7221
  }
7198
7222
  }
7199
7223
  ),
7200
- u && /* @__PURE__ */ se("div", { className: "loading-overlay", style: {
7224
+ u && /* @__PURE__ */ oe("div", { className: "loading-overlay", style: {
7201
7225
  position: "absolute",
7202
7226
  top: "50%",
7203
7227
  left: "50%",
@@ -7206,7 +7230,7 @@ const $e = ye(({
7206
7230
  fontSize: "18px",
7207
7231
  zIndex: 10
7208
7232
  }, children: "Loading avatar..." }),
7209
- c && /* @__PURE__ */ se("div", { className: "error-overlay", style: {
7233
+ c && /* @__PURE__ */ oe("div", { className: "error-overlay", style: {
7210
7234
  position: "absolute",
7211
7235
  top: "50%",
7212
7236
  left: "50%",
@@ -7220,9 +7244,9 @@ const $e = ye(({
7220
7244
  }, children: c })
7221
7245
  ] });
7222
7246
  });
7223
- $e.displayName = "TalkingHeadComponent";
7224
- const et = ye(({
7225
- curriculumData: B = null,
7247
+ ot.displayName = "TalkingHeadComponent";
7248
+ const st = be(({
7249
+ curriculumData: D = null,
7226
7250
  avatarConfig: t = {},
7227
7251
  animations: e = {},
7228
7252
  onLessonStart: i = () => {
@@ -7237,7 +7261,7 @@ const et = ye(({
7237
7261
  },
7238
7262
  autoStart: h = !1
7239
7263
  }, a) => {
7240
- const u = X(null), l = X({
7264
+ const u = Y(null), l = Y({
7241
7265
  currentModuleIndex: 0,
7242
7266
  currentLessonIndex: 0,
7243
7267
  currentQuestionIndex: 0,
@@ -7247,18 +7271,18 @@ const et = ye(({
7247
7271
  curriculumCompleted: !1,
7248
7272
  score: 0,
7249
7273
  totalQuestions: 0
7250
- }), c = X({
7274
+ }), c = Y({
7251
7275
  onLessonStart: i,
7252
7276
  onLessonComplete: n,
7253
7277
  onQuestionAnswer: s,
7254
7278
  onCurriculumComplete: o,
7255
7279
  onCustomAction: r
7256
- }), d = X(null), g = X(null), y = X(null), x = X(null), v = X(null), C = X(null), p = X(null), E = X(B?.curriculum || {
7280
+ }), d = Y(null), g = Y(null), y = Y(null), x = Y(null), v = Y(null), T = Y(null), p = Y(null), F = Y(D?.curriculum || {
7257
7281
  title: "Default Curriculum",
7258
7282
  description: "No curriculum data provided",
7259
7283
  language: "en",
7260
7284
  modules: []
7261
- }), z = X({
7285
+ }), C = Y({
7262
7286
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7263
7287
  avatarBody: t.avatarBody || "F",
7264
7288
  mood: t.mood || "happy",
@@ -7281,12 +7305,12 @@ const et = ye(({
7281
7305
  onCustomAction: r
7282
7306
  };
7283
7307
  }, [i, n, s, o, r]), he(() => {
7284
- E.current = B?.curriculum || {
7308
+ F.current = D?.curriculum || {
7285
7309
  title: "Default Curriculum",
7286
7310
  description: "No curriculum data provided",
7287
7311
  language: "en",
7288
7312
  modules: []
7289
- }, z.current = {
7313
+ }, C.current = {
7290
7314
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7291
7315
  avatarBody: t.avatarBody || "F",
7292
7316
  mood: t.mood || "happy",
@@ -7300,8 +7324,8 @@ const et = ye(({
7300
7324
  animations: e,
7301
7325
  lipsyncLang: "en"
7302
7326
  };
7303
- }, [B, t, e]);
7304
- const I = M(() => (E.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), D = M(() => I()?.questions[l.current.currentQuestionIndex], [I]), P = M((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 = M(() => {
7327
+ }, [D, t, e]);
7328
+ const I = E(() => (F.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), O = E(() => I()?.questions[l.current.currentQuestionIndex], [I]), B = E((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, []), $ = E(() => {
7305
7329
  l.current.lessonCompleted = !0, l.current.isQuestionMode = !1;
7306
7330
  const b = l.current.totalQuestions > 0 ? Math.round(l.current.score / l.current.totalQuestions * 100) : 100;
7307
7331
  let R = "Congratulations! You've completed this lesson";
@@ -7325,25 +7349,25 @@ const et = ye(({
7325
7349
  } catch {
7326
7350
  u.current.playCelebration();
7327
7351
  }
7328
- const w = E.current || { modules: [] }, L = w.modules[l.current.currentModuleIndex], H = l.current.currentLessonIndex < (L?.lessons?.length || 0) - 1, U = l.current.currentModuleIndex < (w.modules?.length || 0) - 1, O = H || U, ne = z.current || { lipsyncLang: "en" };
7329
- O ? u.current.speakText(R, {
7330
- lipsyncLang: ne.lipsyncLang,
7352
+ const z = F.current || { modules: [] }, L = z.modules[l.current.currentModuleIndex], H = l.current.currentLessonIndex < (L?.lessons?.length || 0) - 1, U = l.current.currentModuleIndex < (z.modules?.length || 0) - 1, w = H || U, G = C.current || { lipsyncLang: "en" };
7353
+ w ? u.current.speakText(R, {
7354
+ lipsyncLang: G.lipsyncLang,
7331
7355
  onSpeechEnd: () => {
7332
7356
  g.current && g.current();
7333
7357
  }
7334
7358
  }) : u.current.speakText(R, {
7335
- lipsyncLang: ne.lipsyncLang,
7359
+ lipsyncLang: G.lipsyncLang,
7336
7360
  onSpeechEnd: () => {
7337
7361
  v.current && v.current();
7338
7362
  }
7339
7363
  });
7340
7364
  }
7341
- }, [e.lessonComplete]), Y = M(() => {
7365
+ }, [e.lessonComplete]), j = E(() => {
7342
7366
  l.current.curriculumCompleted = !0;
7343
- const b = E.current || { modules: [] };
7367
+ const b = F.current || { modules: [] };
7344
7368
  if (c.current.onCurriculumComplete({
7345
7369
  modules: b.modules.length,
7346
- totalLessons: b.modules.reduce((R, w) => R + w.lessons.length, 0)
7370
+ totalLessons: b.modules.reduce((R, z) => R + z.lessons.length, 0)
7347
7371
  }), u.current) {
7348
7372
  if (u.current.setMood("celebrating"), e.curriculumComplete)
7349
7373
  try {
@@ -7351,13 +7375,13 @@ const et = ye(({
7351
7375
  } catch {
7352
7376
  u.current.playCelebration();
7353
7377
  }
7354
- const R = z.current || { lipsyncLang: "en" };
7378
+ const R = C.current || { lipsyncLang: "en" };
7355
7379
  u.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: R.lipsyncLang });
7356
7380
  }
7357
- }, [e.curriculumComplete]), S = M(() => {
7381
+ }, [e.curriculumComplete]), S = E(() => {
7358
7382
  const b = I();
7359
7383
  l.current.isQuestionMode = !0, l.current.currentQuestionIndex = 0, l.current.totalQuestions = b?.questions?.length || 0;
7360
- const R = D();
7384
+ const R = O();
7361
7385
  if (R && c.current.onCustomAction({
7362
7386
  type: "questionStart",
7363
7387
  moduleIndex: l.current.currentModuleIndex,
@@ -7372,20 +7396,20 @@ const et = ye(({
7372
7396
  } catch (L) {
7373
7397
  console.warn("Failed to play questionStart animation:", L);
7374
7398
  }
7375
- const w = z.current || { lipsyncLang: "en" };
7376
- R.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang: w.lipsyncLang }) : R.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: w.lipsyncLang }) : R.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${R.question}`, { lipsyncLang: w.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: w.lipsyncLang });
7399
+ const z = C.current || { lipsyncLang: "en" };
7400
+ R.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang: z.lipsyncLang }) : R.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: z.lipsyncLang }) : R.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${R.question}`, { lipsyncLang: z.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: z.lipsyncLang });
7377
7401
  } else if (u.current && u.current.isReady) {
7378
- const w = z.current || { lipsyncLang: "en" };
7379
- u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: w.lipsyncLang });
7402
+ const z = C.current || { lipsyncLang: "en" };
7403
+ u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: z.lipsyncLang });
7380
7404
  } else
7381
7405
  setTimeout(() => {
7382
- C.current && C.current();
7406
+ T.current && T.current();
7383
7407
  }, 100);
7384
- }, [e.questionStart, I, D]), F = M(() => {
7408
+ }, [e.questionStart, I, O]), P = E(() => {
7385
7409
  const b = I();
7386
7410
  if (l.current.currentQuestionIndex < (b?.questions?.length || 0) - 1) {
7387
7411
  l.current.currentQuestionIndex += 1;
7388
- const R = D();
7412
+ const R = O();
7389
7413
  if (R && c.current.onCustomAction({
7390
7414
  type: "nextQuestion",
7391
7415
  moduleIndex: l.current.currentModuleIndex,
@@ -7400,21 +7424,21 @@ const et = ye(({
7400
7424
  } catch (L) {
7401
7425
  console.warn("Failed to play nextQuestion animation:", L);
7402
7426
  }
7403
- const w = z.current || { lipsyncLang: "en" };
7427
+ const z = C.current || { lipsyncLang: "en" };
7404
7428
  R.type === "code_test" ? u.current.speakText(`Great! Now let's move on to your next coding challenge: ${R.question}`, {
7405
- lipsyncLang: w.lipsyncLang
7429
+ lipsyncLang: z.lipsyncLang
7406
7430
  }) : R.type === "multiple_choice" ? u.current.speakText(`Alright! Here's your next question: ${R.question}`, {
7407
- lipsyncLang: w.lipsyncLang
7431
+ lipsyncLang: z.lipsyncLang
7408
7432
  }) : R.type === "true_false" ? u.current.speakText(`Now let's try this one: ${R.question}`, {
7409
- lipsyncLang: w.lipsyncLang
7433
+ lipsyncLang: z.lipsyncLang
7410
7434
  }) : u.current.speakText(`Here's the next question: ${R.question}`, {
7411
- lipsyncLang: w.lipsyncLang
7435
+ lipsyncLang: z.lipsyncLang
7412
7436
  });
7413
7437
  }
7414
7438
  } else
7415
7439
  y.current && y.current();
7416
- }, [e.nextQuestion, I, D]), W = M(() => {
7417
- const b = E.current || { modules: [] }, R = b.modules[l.current.currentModuleIndex];
7440
+ }, [e.nextQuestion, I, O]), W = E(() => {
7441
+ const b = F.current || { modules: [] }, R = b.modules[l.current.currentModuleIndex];
7418
7442
  l.current.currentLessonIndex < (R?.lessons?.length || 0) - 1 ? (l.current.currentLessonIndex += 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
7419
7443
  type: "lessonStart",
7420
7444
  moduleIndex: l.current.currentModuleIndex,
@@ -7424,25 +7448,25 @@ const et = ye(({
7424
7448
  moduleIndex: l.current.currentModuleIndex,
7425
7449
  lessonIndex: l.current.currentLessonIndex
7426
7450
  }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), d.current && d.current())) : v.current && v.current();
7427
- }, []), V = M(() => {
7451
+ }, []), V = E(() => {
7428
7452
  const b = I();
7429
7453
  let R = null;
7430
7454
  if (b?.avatar_script && b?.body) {
7431
- const w = b.avatar_script.trim(), L = b.body.trim(), H = w.match(/[.!?]$/) ? " " : ". ";
7432
- R = `${w}${H}${L}`;
7455
+ const z = b.avatar_script.trim(), L = b.body.trim(), H = z.match(/[.!?]$/) ? " " : ". ";
7456
+ R = `${z}${H}${L}`;
7433
7457
  } else
7434
7458
  R = b?.avatar_script || b?.body || null;
7435
7459
  if (u.current && u.current.isReady && R) {
7436
7460
  l.current.isTeaching = !0, l.current.isQuestionMode = !1, u.current.setMood("happy");
7437
- let w = !1;
7461
+ let z = !1;
7438
7462
  if (e.teaching)
7439
7463
  try {
7440
- u.current.playAnimation(e.teaching, !0), w = !0;
7464
+ u.current.playAnimation(e.teaching, !0), z = !0;
7441
7465
  } catch (H) {
7442
7466
  console.warn("Failed to play teaching animation:", H);
7443
7467
  }
7444
- w || u.current.setBodyMovement("gesturing");
7445
- const L = z.current || { lipsyncLang: "en" };
7468
+ z || u.current.setBodyMovement("gesturing");
7469
+ const L = C.current || { lipsyncLang: "en" };
7446
7470
  c.current.onLessonStart({
7447
7471
  moduleIndex: l.current.currentModuleIndex,
7448
7472
  lessonIndex: l.current.currentLessonIndex,
@@ -7455,21 +7479,21 @@ const et = ye(({
7455
7479
  }), u.current.speakText(R, {
7456
7480
  lipsyncLang: L.lipsyncLang,
7457
7481
  onSpeechEnd: () => {
7458
- l.current.isTeaching = !1, b.questions && b.questions.length > 0 ? C.current && C.current() : y.current && y.current();
7482
+ l.current.isTeaching = !1, b.questions && b.questions.length > 0 ? T.current && T.current() : y.current && y.current();
7459
7483
  }
7460
7484
  });
7461
7485
  }
7462
- }, [e.teaching, I]), Q = M((b) => {
7463
- const R = D(), w = P(b, R);
7464
- if (w && (l.current.score += 1), c.current.onQuestionAnswer({
7486
+ }, [e.teaching, I]), q = E((b) => {
7487
+ const R = O(), z = B(b, R);
7488
+ if (z && (l.current.score += 1), c.current.onQuestionAnswer({
7465
7489
  moduleIndex: l.current.currentModuleIndex,
7466
7490
  lessonIndex: l.current.currentLessonIndex,
7467
7491
  questionIndex: l.current.currentQuestionIndex,
7468
7492
  answer: b,
7469
- isCorrect: w,
7493
+ isCorrect: z,
7470
7494
  question: R
7471
7495
  }), u.current)
7472
- if (w) {
7496
+ if (z) {
7473
7497
  if (u.current.setMood("happy"), e.correct)
7474
7498
  try {
7475
7499
  u.current.playReaction("happy");
@@ -7477,7 +7501,7 @@ const et = ye(({
7477
7501
  u.current.setBodyMovement("happy");
7478
7502
  }
7479
7503
  u.current.setBodyMovement("gesturing");
7480
- const L = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, H = z.current || { lipsyncLang: "en" };
7504
+ const L = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, H = C.current || { lipsyncLang: "en" };
7481
7505
  u.current.speakText(L, {
7482
7506
  lipsyncLang: H.lipsyncLang,
7483
7507
  onSpeechEnd: () => {
@@ -7492,7 +7516,7 @@ const et = ye(({
7492
7516
  u.current.setBodyMovement("idle");
7493
7517
  }
7494
7518
  u.current.setBodyMovement("gesturing");
7495
- const L = 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.`, H = z.current || { lipsyncLang: "en" };
7519
+ const L = 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.`, H = C.current || { lipsyncLang: "en" };
7496
7520
  u.current.speakText(L, {
7497
7521
  lipsyncLang: H.lipsyncLang,
7498
7522
  onSpeechEnd: () => {
@@ -7502,8 +7526,8 @@ const et = ye(({
7502
7526
  }
7503
7527
  else
7504
7528
  x.current && x.current();
7505
- }, [e.correct, e.incorrect, D, P]), q = M((b) => {
7506
- const R = D();
7529
+ }, [e.correct, e.incorrect, O, B]), _ = E((b) => {
7530
+ const R = O();
7507
7531
  if (!b || typeof b != "object") {
7508
7532
  console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
7509
7533
  return;
@@ -7512,7 +7536,7 @@ const et = ye(({
7512
7536
  console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
7513
7537
  return;
7514
7538
  }
7515
- const w = {
7539
+ const z = {
7516
7540
  passed: b.passed === !0,
7517
7541
  results: b.results || [],
7518
7542
  output: b.output || "",
@@ -7527,41 +7551,41 @@ const et = ye(({
7527
7551
  moduleIndex: l.current.currentModuleIndex,
7528
7552
  lessonIndex: l.current.currentLessonIndex,
7529
7553
  questionIndex: l.current.currentQuestionIndex,
7530
- testResult: w,
7554
+ testResult: z,
7531
7555
  question: R
7532
- }), p.current && p.current(w);
7533
- }, [D, P]), le = M(() => {
7556
+ }), p.current && p.current(z);
7557
+ }, [O, B]), le = E(() => {
7534
7558
  l.current.currentModuleIndex = 0, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.isTeaching = !1, l.current.isQuestionMode = !1, l.current.lessonCompleted = !1, l.current.curriculumCompleted = !1, l.current.score = 0, l.current.totalQuestions = 0;
7535
- }, []), me = M((b) => {
7559
+ }, []), ye = E((b) => {
7536
7560
  console.log("Avatar is ready!", b);
7537
- const R = I(), w = R?.avatar_script || R?.body;
7538
- h && w && setTimeout(() => {
7561
+ const R = I(), z = R?.avatar_script || R?.body;
7562
+ h && z && setTimeout(() => {
7539
7563
  d.current && d.current();
7540
7564
  }, 10);
7541
7565
  }, [h, I]);
7542
- He(() => {
7543
- d.current = V, g.current = W, y.current = J, x.current = F, v.current = Y, C.current = S, p.current = Q;
7544
- }), fe(a, () => ({
7566
+ Pe(() => {
7567
+ d.current = V, g.current = W, y.current = $, x.current = P, v.current = j, T.current = S, p.current = q;
7568
+ }), Re(a, () => ({
7545
7569
  // Curriculum control methods
7546
7570
  startTeaching: V,
7547
7571
  startQuestions: S,
7548
- handleAnswerSelect: Q,
7549
- handleCodeTestResult: q,
7550
- nextQuestion: F,
7572
+ handleAnswerSelect: q,
7573
+ handleCodeTestResult: _,
7574
+ nextQuestion: P,
7551
7575
  nextLesson: W,
7552
- completeLesson: J,
7553
- completeCurriculum: Y,
7576
+ completeLesson: $,
7577
+ completeCurriculum: j,
7554
7578
  resetCurriculum: le,
7555
7579
  getState: () => ({ ...l.current }),
7556
- getCurrentQuestion: () => D(),
7580
+ getCurrentQuestion: () => O(),
7557
7581
  getCurrentLesson: () => I(),
7558
7582
  // Direct access to avatar ref (always returns current value)
7559
7583
  getAvatarRef: () => u.current,
7560
7584
  // Convenience methods that delegate to avatar (always check current ref)
7561
7585
  speakText: async (b, R = {}) => {
7562
7586
  await u.current?.resumeAudioContext?.();
7563
- const w = z.current || { lipsyncLang: "en" };
7564
- u.current?.speakText(b, { ...R, lipsyncLang: R.lipsyncLang || w.lipsyncLang });
7587
+ const z = C.current || { lipsyncLang: "en" };
7588
+ u.current?.speakText(b, { ...R, lipsyncLang: R.lipsyncLang || z.lipsyncLang });
7565
7589
  },
7566
7590
  resumeAudioContext: async () => {
7567
7591
  if (u.current?.resumeAudioContext)
@@ -7572,8 +7596,8 @@ const et = ye(({
7572
7596
  if (R.state === "suspended" || R.state === "interrupted")
7573
7597
  try {
7574
7598
  await R.resume(), console.log("Audio context resumed via talkingHead");
7575
- } catch (w) {
7576
- console.warn("Failed to resume audio context:", w);
7599
+ } catch (z) {
7600
+ console.warn("Failed to resume audio context:", z);
7577
7601
  }
7578
7602
  } else
7579
7603
  console.warn("Audio context not available yet");
@@ -7602,8 +7626,8 @@ const et = ye(({
7602
7626
  handleResize: () => u.current?.handleResize(),
7603
7627
  // Avatar readiness check (always returns current value)
7604
7628
  isAvatarReady: () => u.current?.isReady || !1
7605
- }), [V, S, Q, q, F, W, J, Y, le, D, I]);
7606
- const _ = z.current || {
7629
+ }), [V, S, q, _, P, W, $, j, le, O, I]);
7630
+ const K = C.current || {
7607
7631
  avatarUrl: "/avatars/brunette.glb",
7608
7632
  avatarBody: "F",
7609
7633
  mood: "happy",
@@ -7616,23 +7640,23 @@ const et = ye(({
7616
7640
  showFullAvatar: !0,
7617
7641
  animations: e
7618
7642
  };
7619
- return /* @__PURE__ */ se("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ se(
7620
- ke,
7643
+ return /* @__PURE__ */ oe("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ oe(
7644
+ Te,
7621
7645
  {
7622
7646
  ref: u,
7623
- avatarUrl: _.avatarUrl,
7624
- avatarBody: _.avatarBody,
7625
- mood: _.mood,
7626
- ttsLang: _.ttsLang,
7627
- ttsService: _.ttsService,
7628
- ttsVoice: _.ttsVoice,
7629
- ttsApiKey: _.ttsApiKey,
7630
- bodyMovement: _.bodyMovement,
7631
- movementIntensity: _.movementIntensity,
7632
- showFullAvatar: _.showFullAvatar,
7647
+ avatarUrl: K.avatarUrl,
7648
+ avatarBody: K.avatarBody,
7649
+ mood: K.mood,
7650
+ ttsLang: K.ttsLang,
7651
+ ttsService: K.ttsService,
7652
+ ttsVoice: K.ttsVoice,
7653
+ ttsApiKey: K.ttsApiKey,
7654
+ bodyMovement: K.bodyMovement,
7655
+ movementIntensity: K.movementIntensity,
7656
+ showFullAvatar: K.showFullAvatar,
7633
7657
  cameraView: "upper",
7634
- animations: _.animations,
7635
- onReady: me,
7658
+ animations: K.animations,
7659
+ onReady: ye,
7636
7660
  onLoading: () => {
7637
7661
  },
7638
7662
  onError: (b) => {
@@ -7641,8 +7665,8 @@ const et = ye(({
7641
7665
  }
7642
7666
  ) });
7643
7667
  });
7644
- et.displayName = "CurriculumLearning";
7645
- const we = {
7668
+ st.displayName = "CurriculumLearning";
7669
+ const Me = {
7646
7670
  // Code-based dance animations (no FBX required)
7647
7671
  dance: {
7648
7672
  name: "dance",
@@ -7745,14 +7769,14 @@ const we = {
7745
7769
  duration: 5e3,
7746
7770
  description: "Excited, energetic movement"
7747
7771
  }
7748
- }, ut = (B) => we[B] || null, dt = (B) => we.hasOwnProperty(B);
7772
+ }, gt = (D) => Me[D] || null, yt = (D) => Me.hasOwnProperty(D);
7749
7773
  export {
7750
- et as CurriculumLearning,
7751
- ke as TalkingHeadAvatar,
7752
- $e as TalkingHeadComponent,
7753
- we as animations,
7754
- xe as getActiveTTSConfig,
7755
- ut as getAnimation,
7756
- ht as getVoiceOptions,
7757
- dt as hasAnimation
7774
+ st as CurriculumLearning,
7775
+ Te as TalkingHeadAvatar,
7776
+ ot as TalkingHeadComponent,
7777
+ Me as animations,
7778
+ ve as getActiveTTSConfig,
7779
+ gt as getAnimation,
7780
+ pt as getVoiceOptions,
7781
+ yt as hasAnimation
7758
7782
  };