@sage-rsc/talking-head-react 1.7.8 → 1.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- import { jsxs as Ce, jsx as te } from "react/jsx-runtime";
2
- import { forwardRef as Qe, useRef as U, useState as ue, useEffect as be, useCallback as N, useImperativeHandle as qe, useLayoutEffect as lt } from "react";
1
+ import { jsxs as ze, jsx as ee } from "react/jsx-runtime";
2
+ import { forwardRef as qe, useRef as U, useState as he, useEffect as ve, useCallback as N, useImperativeHandle as _e, useLayoutEffect as ut } from "react";
3
3
  import * as b from "three";
4
- import { OrbitControls as ut } from "three/addons/controls/OrbitControls.js";
5
- import { GLTFLoader as ct } from "three/addons/loaders/GLTFLoader.js";
6
- import { DRACOLoader as ht } from "three/addons/loaders/DRACOLoader.js";
7
- import { FBXLoader as et } from "three/addons/loaders/FBXLoader.js";
8
- import { RoomEnvironment as dt } from "three/addons/environments/RoomEnvironment.js";
9
- import mt from "three/addons/libs/stats.module.js";
10
- let p, xe, Ae;
11
- const z = [0, 0, 0, 0], O = new b.Vector3(), Ze = new b.Vector3(), me = new b.Vector3(), Xe = new b.Vector3();
4
+ import { OrbitControls as ct } from "three/addons/controls/OrbitControls.js";
5
+ import { GLTFLoader as ht } from "three/addons/loaders/GLTFLoader.js";
6
+ import { DRACOLoader as dt } from "three/addons/loaders/DRACOLoader.js";
7
+ import { FBXLoader as tt } from "three/addons/loaders/FBXLoader.js";
8
+ import { RoomEnvironment as mt } from "three/addons/environments/RoomEnvironment.js";
9
+ import pt from "three/addons/libs/stats.module.js";
10
+ let p, Re, Le;
11
+ const z = [0, 0, 0, 0], B = new b.Vector3(), Xe = new b.Vector3(), pe = new b.Vector3(), je = new b.Vector3();
12
12
  new b.Plane();
13
13
  new b.Ray();
14
14
  new b.Euler();
15
- const pe = new b.Quaternion(), tt = new b.Quaternion(), He = new b.Matrix4(), Te = new b.Matrix4();
15
+ const ge = new b.Quaternion(), nt = new b.Quaternion(), Me = new b.Matrix4(), Fe = new b.Matrix4();
16
16
  new b.Vector3();
17
- const je = new b.Vector3(0, 0, 1), pt = new b.Vector3(1, 0, 0), gt = new b.Vector3(0, 1, 0), yt = new b.Vector3(0, 0, 1);
18
- class ft {
17
+ const Ye = new b.Vector3(0, 0, 1), gt = new b.Vector3(1, 0, 0), yt = new b.Vector3(0, 1, 0), ft = new b.Vector3(0, 0, 1);
18
+ class xt {
19
19
  constructor(n = null) {
20
20
  this.opt = Object.assign({
21
21
  warmupMs: 2e3,
@@ -321,7 +321,7 @@ class ft {
321
321
  /// Bone's parent object
322
322
  vBasis: l.position.clone(),
323
323
  // Original local position
324
- vWorld: l.parent.getWorldPosition(O).clone(),
324
+ vWorld: l.parent.getWorldPosition(B).clone(),
325
325
  // World position, parent
326
326
  qBasis: l.parent.quaternion.clone(),
327
327
  // Original quaternion, parent
@@ -338,7 +338,7 @@ class ft {
338
338
  ea: [0, 0, 0, 0]
339
339
  // External acceleration [m/s^2]
340
340
  };
341
- u.boneParent.matrixWorld.decompose(O, pe, me), O.copy(je).applyQuaternion(pe).setY(0).normalize(), pe.premultiply(tt.setFromUnitVectors(je, O).invert()).normalize(), u.qWorldInverseYaw = pe.clone().normalize(), this.data.push(u), this.dict[c] = u;
341
+ u.boneParent.matrixWorld.decompose(B, ge, pe), B.copy(Ye).applyQuaternion(ge).setY(0).normalize(), ge.premultiply(nt.setFromUnitVectors(Ye, B).invert()).normalize(), u.qWorldInverseYaw = ge.clone().normalize(), this.data.push(u), this.dict[c] = u;
342
342
  try {
343
343
  this.setValue(c, "type", s.type), this.setValue(c, "stiffness", s.stiffness), this.setValue(c, "damping", s.damping), this.setValue(c, "external", s.external), this.setValue(c, "limits", s.limits), this.setValue(c, "excludes", s.excludes), this.setValue(c, "deltaLocal", s.deltaLocal), this.setValue(c, "deltaWorld", s.deltaWorld), this.setValue(c, "pivot", s.pivot), this.setValue(c, "helper", s.helper);
344
344
  } catch (a) {
@@ -356,22 +356,22 @@ class ft {
356
356
  for (this.timerMs += n, n > 1e3 && (this.timerMs = 0), n /= 1e3, e = 0, o = this.objectsUpdate.length; e < o; e++)
357
357
  i = this.objectsUpdate[e], i.updateMatrix(), i.parent === null ? i.matrixWorld.copy(i.matrix) : i.matrixWorld.multiplyMatrices(i.parent.matrixWorld, i.matrix), i.matrixWorldNeedsUpdate = !1;
358
358
  for (e = 0, o = this.data.length; e < o; e++) {
359
- if (i = this.data[e], O.copy(i.vWorld), He.copy(i.boneParent.matrixWorld), Te.copy(He).invert(), i.vWorld.setFromMatrixPosition(He), O.applyMatrix4(Te), O.length() > 0.5 && (console.info("Info: Unrealistic jump of " + O.length().toFixed(2) + " meters."), O.setLength(0.5)), O.applyQuaternion(i.bone.quaternion), z[0] = O.x, z[1] = O.y, z[2] = -O.z, z[3] = O.length() / 3, i.children)
359
+ if (i = this.data[e], B.copy(i.vWorld), Me.copy(i.boneParent.matrixWorld), Fe.copy(Me).invert(), i.vWorld.setFromMatrixPosition(Me), B.applyMatrix4(Fe), B.length() > 0.5 && (console.info("Info: Unrealistic jump of " + B.length().toFixed(2) + " meters."), B.setLength(0.5)), B.applyQuaternion(i.bone.quaternion), z[0] = B.x, z[1] = B.y, z[2] = -B.z, z[3] = B.length() / 3, i.children)
360
360
  for (t = 0, s = i.children.length; t < s; t++)
361
361
  p = i.children[t], z[0] -= p.v[0] * n / 3, z[1] -= p.v[1] * n / 3, z[2] += p.v[2] * n / 3, z[3] -= p.v[3] * n / 3;
362
- if (p = this.opt.sensitivityFactor, z[0] *= i.ext * p, z[1] *= i.ext * p, z[2] *= i.ext * p, z[3] *= i.ext * p, i.isX && (p = z[0] / n, i.ea[0] = (p - i.ev[0]) / n, i.ev[0] = p, i.a[0] = -i.k[0] * i.p[0] - i.c[0] * i.v[0] - i.ea[0], i.p[0] += i.v[0] * n + i.a[0] * n * n / 2 + z[0], p = i.v[0] + i.a[0] * n / 2, p = -i.k[0] * i.p[0] - i.c[0] * p - i.ea[0], i.v[0] = i.v[0] + (p + i.a[0]) * n / 2), i.isY && (p = z[1] / n, i.ea[1] = (p - i.ev[1]) / n, i.ev[1] = p, i.a[1] = -i.k[1] * i.p[1] - i.c[1] * i.v[1] - i.ea[1], i.p[1] += i.v[1] * n + i.a[1] * n * n / 2 + z[1], p = i.v[1] + i.a[1] * n / 2, p = -i.k[1] * i.p[1] - i.c[1] * p - i.ea[1], i.v[1] = i.v[1] + (p + i.a[1]) * n / 2), i.isZ && (p = z[2] / n, i.ea[2] = (p - i.ev[2]) / n, i.ev[2] = p, i.a[2] = -i.k[2] * i.p[2] - i.c[2] * i.v[2] - i.ea[2], i.p[2] += i.v[2] * n + i.a[2] * n * n / 2 + z[2], p = i.v[2] + i.a[2] * n / 2, p = -i.k[2] * i.p[2] - i.c[2] * p - i.ea[2], i.v[2] = i.v[2] + (p + i.a[2]) * n / 2), i.isT && (p = z[3] / n, i.ea[3] = (p - i.ev[3]) / n, i.ev[3] = p, i.a[3] = -i.k[3] * i.p[3] - i.c[3] * i.v[3] - i.ea[3], i.p[3] += i.v[3] * n + i.a[3] * n * n / 2 + z[3], p = i.v[3] + i.a[3] * n / 2, p = -i.k[3] * i.p[3] - i.c[3] * p - i.ea[3], i.v[3] = i.v[3] + (p + i.a[3]) * n / 2), this.timerMs < this.opt.warmupMs && (i.v[0] *= 1e-4, i.p[0] *= 1e-4, i.v[1] *= 1e-4, i.p[1] *= 1e-4, i.v[2] *= 1e-4, i.p[2] *= 1e-4, i.v[3] *= 1e-4, i.p[3] *= 1e-4), z[0] = i.p[0], z[1] = i.p[1], z[2] = i.p[2], z[3] = i.p[3], p = this.opt.movementFactor, z[0] *= p, z[1] *= p, z[2] *= p, z[3] *= p, i.dl && (p = i.dl, z[0] += p[0], z[1] += p[1], z[2] += p[2]), i.dw && (p = i.dw, O.set(
362
+ if (p = this.opt.sensitivityFactor, z[0] *= i.ext * p, z[1] *= i.ext * p, z[2] *= i.ext * p, z[3] *= i.ext * p, i.isX && (p = z[0] / n, i.ea[0] = (p - i.ev[0]) / n, i.ev[0] = p, i.a[0] = -i.k[0] * i.p[0] - i.c[0] * i.v[0] - i.ea[0], i.p[0] += i.v[0] * n + i.a[0] * n * n / 2 + z[0], p = i.v[0] + i.a[0] * n / 2, p = -i.k[0] * i.p[0] - i.c[0] * p - i.ea[0], i.v[0] = i.v[0] + (p + i.a[0]) * n / 2), i.isY && (p = z[1] / n, i.ea[1] = (p - i.ev[1]) / n, i.ev[1] = p, i.a[1] = -i.k[1] * i.p[1] - i.c[1] * i.v[1] - i.ea[1], i.p[1] += i.v[1] * n + i.a[1] * n * n / 2 + z[1], p = i.v[1] + i.a[1] * n / 2, p = -i.k[1] * i.p[1] - i.c[1] * p - i.ea[1], i.v[1] = i.v[1] + (p + i.a[1]) * n / 2), i.isZ && (p = z[2] / n, i.ea[2] = (p - i.ev[2]) / n, i.ev[2] = p, i.a[2] = -i.k[2] * i.p[2] - i.c[2] * i.v[2] - i.ea[2], i.p[2] += i.v[2] * n + i.a[2] * n * n / 2 + z[2], p = i.v[2] + i.a[2] * n / 2, p = -i.k[2] * i.p[2] - i.c[2] * p - i.ea[2], i.v[2] = i.v[2] + (p + i.a[2]) * n / 2), i.isT && (p = z[3] / n, i.ea[3] = (p - i.ev[3]) / n, i.ev[3] = p, i.a[3] = -i.k[3] * i.p[3] - i.c[3] * i.v[3] - i.ea[3], i.p[3] += i.v[3] * n + i.a[3] * n * n / 2 + z[3], p = i.v[3] + i.a[3] * n / 2, p = -i.k[3] * i.p[3] - i.c[3] * p - i.ea[3], i.v[3] = i.v[3] + (p + i.a[3]) * n / 2), this.timerMs < this.opt.warmupMs && (i.v[0] *= 1e-4, i.p[0] *= 1e-4, i.v[1] *= 1e-4, i.p[1] *= 1e-4, i.v[2] *= 1e-4, i.p[2] *= 1e-4, i.v[3] *= 1e-4, i.p[3] *= 1e-4), z[0] = i.p[0], z[1] = i.p[1], z[2] = i.p[2], z[3] = i.p[3], p = this.opt.movementFactor, z[0] *= p, z[1] *= p, z[2] *= p, z[3] *= p, i.dl && (p = i.dl, z[0] += p[0], z[1] += p[1], z[2] += p[2]), i.dw && (p = i.dw, B.set(
363
363
  i.vBasis.x + z[0],
364
364
  i.vBasis.y + z[1],
365
365
  i.vBasis.z + z[2]
366
- ), O.applyMatrix4(He), O.x += p[0], O.y += p[1], O.z += p[2], O.applyMatrix4(Te), z[0] += O.x - i.vBasis.x, z[1] += O.y - i.vBasis.y, z[2] += O.z - i.vBasis.z), i.limits && this.opt.isLimits && (p = i.limits, p[0] && (p[0][0] !== null && z[0] < p[0][0] && (z[0] = p[0][0]), p[0][1] !== null && z[0] > p[0][1] && (z[0] = p[0][1])), p[1] && (p[1][0] !== null && z[1] < p[1][0] && (z[1] = p[1][0]), p[1][1] !== null && z[1] > p[1][1] && (z[1] = p[1][1])), p[2] && (p[2][0] !== null && z[2] < p[2][0] && (z[2] = p[2][0]), p[2][1] !== null && z[2] > p[2][1] && (z[2] = p[2][1])), p[3] && (p[3][0] !== null && z[3] < p[3][0] && (z[3] = p[3][0]), p[3][1] !== null && z[3] > p[3][1] && (z[3] = p[3][1]))), i.isPoint)
366
+ ), B.applyMatrix4(Me), B.x += p[0], B.y += p[1], B.z += p[2], B.applyMatrix4(Fe), z[0] += B.x - i.vBasis.x, z[1] += B.y - i.vBasis.y, z[2] += B.z - i.vBasis.z), i.limits && this.opt.isLimits && (p = i.limits, p[0] && (p[0][0] !== null && z[0] < p[0][0] && (z[0] = p[0][0]), p[0][1] !== null && z[0] > p[0][1] && (z[0] = p[0][1])), p[1] && (p[1][0] !== null && z[1] < p[1][0] && (z[1] = p[1][0]), p[1][1] !== null && z[1] > p[1][1] && (z[1] = p[1][1])), p[2] && (p[2][0] !== null && z[2] < p[2][0] && (z[2] = p[2][0]), p[2][1] !== null && z[2] > p[2][1] && (z[2] = p[2][1])), p[3] && (p[3][0] !== null && z[3] < p[3][0] && (z[3] = p[3][0]), p[3][1] !== null && z[3] > p[3][1] && (z[3] = p[3][1]))), i.isPoint)
367
367
  i.bone.position.set(
368
368
  i.vBasis.x + z[0],
369
369
  i.vBasis.y + z[1],
370
370
  i.vBasis.z - z[2]
371
371
  );
372
- else if (i.boneParent.quaternion.copy(i.qBasis), i.pivot && this.opt.isPivots && (i.boneParent.updateWorldMatrix(!1, !1), i.boneParent.matrixWorld.decompose(O, pe, me), O.copy(je).applyQuaternion(pe).setY(0).normalize(), pe.premultiply(tt.setFromUnitVectors(je, O).invert()).normalize(), i.boneParent.quaternion.multiply(pe.invert()), i.boneParent.quaternion.multiply(i.qWorldInverseYaw)), i.isZ && (p = Math.atan(z[0] / i.l), pe.setFromAxisAngle(yt, -p), i.boneParent.quaternion.multiply(pe)), i.isY && (p = i.l / 3, p = p * Math.tanh(z[1] / p), i.bone.position.setLength(i.l + p)), i.isX && (p = Math.atan(z[2] / i.l), pe.setFromAxisAngle(pt, -p), i.boneParent.quaternion.multiply(pe)), i.isT && (p = 1.5 * Math.tanh(z[3] * 1.5), pe.setFromAxisAngle(gt, -p), i.boneParent.quaternion.multiply(pe)), i.boneParent.updateWorldMatrix(!1, !0), i.excludes && this.opt.isExcludes)
372
+ else if (i.boneParent.quaternion.copy(i.qBasis), i.pivot && this.opt.isPivots && (i.boneParent.updateWorldMatrix(!1, !1), i.boneParent.matrixWorld.decompose(B, ge, pe), B.copy(Ye).applyQuaternion(ge).setY(0).normalize(), ge.premultiply(nt.setFromUnitVectors(Ye, B).invert()).normalize(), i.boneParent.quaternion.multiply(ge.invert()), i.boneParent.quaternion.multiply(i.qWorldInverseYaw)), i.isZ && (p = Math.atan(z[0] / i.l), ge.setFromAxisAngle(ft, -p), i.boneParent.quaternion.multiply(ge)), i.isY && (p = i.l / 3, p = p * Math.tanh(z[1] / p), i.bone.position.setLength(i.l + p)), i.isX && (p = Math.atan(z[2] / i.l), ge.setFromAxisAngle(gt, -p), i.boneParent.quaternion.multiply(ge)), i.isT && (p = 1.5 * Math.tanh(z[3] * 1.5), ge.setFromAxisAngle(yt, -p), i.boneParent.quaternion.multiply(ge)), i.boneParent.updateWorldMatrix(!1, !0), i.excludes && this.opt.isExcludes)
373
373
  for (t = 0, s = i.excludes.length; t < s; t++)
374
- p = i.excludes[t], me.set(0, 0, 0), p.deltaLocal && (me.x += p.deltaLocal[0], me.y += p.deltaLocal[1], me.z += p.deltaLocal[2]), me.applyMatrix4(p.bone.matrixWorld), Te.copy(i.boneParent.matrixWorld).invert(), me.applyMatrix4(Te), O.copy(i.bone.position), !(O.distanceToSquared(me) >= p.radiusSq) && (Ae = O.length(), xe = me.length(), !(xe > p.radius + Ae) && (xe < Math.abs(p.radius - Ae) || (xe = (xe * xe + Ae * Ae - p.radiusSq) / (2 * xe), me.normalize(), Xe.copy(me).multiplyScalar(xe), xe = Math.sqrt(Ae * Ae - xe * xe), O.subVectors(O, Xe).projectOnPlane(me).normalize().multiplyScalar(xe), Ze.subVectors(i.vBasis, Xe).projectOnPlane(me).normalize(), Ae = Ze.dot(O), Ae < 0 && (Ae = Math.sqrt(xe * xe - Ae * Ae), Ze.multiplyScalar(Ae), O.add(Ze)), O.add(Xe).normalize(), me.copy(i.bone.position).normalize(), pe.setFromUnitVectors(me, O), i.boneParent.quaternion.premultiply(pe), i.boneParent.updateWorldMatrix(!1, !0))));
374
+ p = i.excludes[t], pe.set(0, 0, 0), p.deltaLocal && (pe.x += p.deltaLocal[0], pe.y += p.deltaLocal[1], pe.z += p.deltaLocal[2]), pe.applyMatrix4(p.bone.matrixWorld), Fe.copy(i.boneParent.matrixWorld).invert(), pe.applyMatrix4(Fe), B.copy(i.bone.position), !(B.distanceToSquared(pe) >= p.radiusSq) && (Le = B.length(), Re = pe.length(), !(Re > p.radius + Le) && (Re < Math.abs(p.radius - Le) || (Re = (Re * Re + Le * Le - p.radiusSq) / (2 * Re), pe.normalize(), je.copy(pe).multiplyScalar(Re), Re = Math.sqrt(Le * Le - Re * Re), B.subVectors(B, je).projectOnPlane(pe).normalize().multiplyScalar(Re), Xe.subVectors(i.vBasis, je).projectOnPlane(pe).normalize(), Le = Xe.dot(B), Le < 0 && (Le = Math.sqrt(Re * Re - Le * Le), Xe.multiplyScalar(Le), B.add(Xe)), B.add(je).normalize(), pe.copy(i.bone.position).normalize(), ge.setFromUnitVectors(pe, B), i.boneParent.quaternion.premultiply(ge), i.boneParent.updateWorldMatrix(!1, !0))));
375
375
  }
376
376
  this.helpers.isActive && this.updateHelpers();
377
377
  }
@@ -442,17 +442,17 @@ class ft {
442
442
  */
443
443
  updateHelpers() {
444
444
  if (p = this.helpers.points, p.bones.length) {
445
- Te.copy(this.armature.matrixWorld).invert();
445
+ Fe.copy(this.armature.matrixWorld).invert();
446
446
  const n = p.object.geometry.getAttribute("position");
447
447
  for (let e = 0, t = p.bones.length; e < t; e++)
448
- He.multiplyMatrices(Te, p.bones[e].matrixWorld), O.setFromMatrixPosition(He), n.setXYZ(e, O.x, O.y, O.z);
448
+ Me.multiplyMatrices(Fe, p.bones[e].matrixWorld), B.setFromMatrixPosition(Me), n.setXYZ(e, B.x, B.y, B.z);
449
449
  n.needsUpdate = !0, p.object.updateMatrixWorld();
450
450
  }
451
451
  if (p = this.helpers.lines, p.bones.length) {
452
- Te.copy(this.armature.matrixWorld).invert();
452
+ Fe.copy(this.armature.matrixWorld).invert();
453
453
  const n = p.object.geometry.getAttribute("position");
454
454
  for (let e = 0, t = 0, o = p.bones.length; e < o; e++, t += 2)
455
- He.multiplyMatrices(Te, p.bones[e].matrixWorld), O.setFromMatrixPosition(He), n.setXYZ(t, O.x, O.y, O.z), He.multiplyMatrices(Te, p.bones[e].parent.matrixWorld), O.setFromMatrixPosition(He), n.setXYZ(t + 1, O.x, O.y, O.z);
455
+ Me.multiplyMatrices(Fe, p.bones[e].matrixWorld), B.setFromMatrixPosition(Me), n.setXYZ(t, B.x, B.y, B.z), Me.multiplyMatrices(Fe, p.bones[e].parent.matrixWorld), B.setFromMatrixPosition(Me), n.setXYZ(t + 1, B.x, B.y, B.z);
456
456
  n.needsUpdate = !0, p.object.updateMatrixWorld();
457
457
  }
458
458
  }
@@ -489,7 +489,7 @@ class ft {
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 xt {
492
+ class bt {
493
493
  constructor(n) {
494
494
  this.audioContext = n, this.analyzer = null, this.dataArray = null, this.bufferLength = 0;
495
495
  }
@@ -608,8 +608,8 @@ class xt {
608
608
  for (let a = 0; a < o / 2; a++) {
609
609
  const d = t[(c + a) * 2], h = t[(c + a) * 2 + 1], g = t[(c + a + o / 2) * 2] * l - t[(c + a + o / 2) * 2 + 1] * u, R = t[(c + a + o / 2) * 2] * u + t[(c + a + o / 2) * 2 + 1] * l;
610
610
  t[(c + a) * 2] = d + g, t[(c + a) * 2 + 1] = h + R, t[(c + a + o / 2) * 2] = d - g, t[(c + a + o / 2) * 2 + 1] = h - R;
611
- const f = l * i - u * r, S = l * r + u * i;
612
- l = f, u = S;
611
+ const x = l * i - u * r, S = l * r + u * i;
612
+ l = x, u = S;
613
613
  }
614
614
  }
615
615
  }
@@ -814,7 +814,7 @@ class xt {
814
814
  return o * s;
815
815
  }
816
816
  }
817
- class bt {
817
+ class Rt {
818
818
  /**
819
819
  * @constructor
820
820
  */
@@ -1396,11 +1396,11 @@ class bt {
1396
1396
  return e;
1397
1397
  }
1398
1398
  }
1399
- const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1399
+ const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
1400
  __proto__: null,
1401
- LipsyncEn: bt
1401
+ LipsyncEn: Rt
1402
1402
  }, Symbol.toStringTag, { value: "Module" }));
1403
- class vt {
1403
+ class It {
1404
1404
  /**
1405
1405
  * @constructor
1406
1406
  */
@@ -1754,11 +1754,11 @@ class vt {
1754
1754
  return e;
1755
1755
  }
1756
1756
  }
1757
- const It = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1757
+ const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1758
1758
  __proto__: null,
1759
- LipsyncDe: vt
1759
+ LipsyncDe: It
1760
1760
  }, Symbol.toStringTag, { value: "Module" }));
1761
- class At {
1761
+ class Lt {
1762
1762
  /**
1763
1763
  * @constructor
1764
1764
  */
@@ -2289,11 +2289,11 @@ class At {
2289
2289
  return e;
2290
2290
  }
2291
2291
  }
2292
- const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2292
+ const St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2293
2293
  __proto__: null,
2294
- LipsyncFr: At
2294
+ LipsyncFr: Lt
2295
2295
  }, Symbol.toStringTag, { value: "Module" }));
2296
- class St {
2296
+ class kt {
2297
2297
  /**
2298
2298
  * @constructor
2299
2299
  */
@@ -2436,11 +2436,11 @@ class St {
2436
2436
  return e;
2437
2437
  }
2438
2438
  }
2439
- const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2439
+ const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2440
2440
  __proto__: null,
2441
- LipsyncFi: St
2441
+ LipsyncFi: kt
2442
2442
  }, Symbol.toStringTag, { value: "Module" }));
2443
- class wt {
2443
+ class Ct {
2444
2444
  /**
2445
2445
  * @constructor
2446
2446
  */
@@ -2620,21 +2620,21 @@ class wt {
2620
2620
  return e;
2621
2621
  }
2622
2622
  }
2623
- const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2623
+ const zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2624
2624
  __proto__: null,
2625
- LipsyncLt: wt
2626
- }, Symbol.toStringTag, { value: "Module" })), zt = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIH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JhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxhe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bGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), nt = {
2627
- en: Rt,
2628
- de: It,
2629
- fr: Lt,
2630
- fi: kt,
2631
- lt: Ct
2632
- }, ie = new b.Quaternion(), K = new b.Euler(), Fe = new b.Vector3(), Pe = new b.Vector3(), it = new b.Box3();
2625
+ LipsyncLt: Ct
2626
+ }, Symbol.toStringTag, { value: "Module" })), Ht = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25zdCBzaWxlbmNlRHVyYXRpb25TZWNvbmRzID0gMS4wOwogICAgdGhpcy5fc2lsZW5jZVRocmVzaG9sZEJsb2NrcyA9IE1hdGguY2VpbCgodGhpcy5fc2FtcGxlUmF0ZSAqIHNpbGVuY2VEdXJhdGlvblNlY29uZHMpIC8gMTI4KTsKCiAgICAvLyBNZXRyaWNzIGNvbmZpZ3VyYXRpb24gdmlhIG9wdGlvbnMKICAgIGNvbnN0IG1ldHJpY3NDZmcgPSBvcHRpb25zPy5wcm9jZXNzb3JPcHRpb25zPy5tZXRyaWNz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NlVGhyZXNob2xkQmxvY2tzOwoKICAgICAgICAgIGlmICh0aGlzLl9ub01vcmVEYXRhUmVjZWl2ZWQgfHwgaXNUaW1lZE91dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHRoaXMuX3VuZGVycnVuQmxvY2tzKys7CiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KCiAgICAgIC8vIElmIHdlIGhhdmUgYSBjaHVuayAoY291bGQgYmUgYSBuZXcgb25lIGZyb20gdGhlIGxvZ2ljIGFib3ZlKSwgcHJvY2VzcyBpdC4KICAgICAgaWYgKHRoaXMuX2N1cnJlbnRDaHVuaykgewogICAgICAgIGNvbnN0IHNhbXBsZXNUb0NvcHkgPSBNYXRoLm1pbigKICAgICAgICAgIGJsb2NrU2l6ZSAtIHNhbXBsZXNDb3BpZWQsCiAgICAgICAgICB0aGlzLl9jdXJyZW50Q2h1bmsubGVuZ3RoIC0gdGhpcy5fY3VycmVudENodW5rT2Zmc2V0CiAgICAgICAgKTsKICAgICAgICAvLyBEaXJlY3RseSB3cml0ZSB0byBvdXRwdXRDaGFubmVsIHRvIGF2b2lkIGV4dHJhIGNvcHkKICAgICAgICBjb25zdCBzcmMgPSB0aGlzLl9jdXJyZW50Q2h1bms7CiAgICAgICAgY29uc3QgYmFzZVNyYyA9IH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gICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), it = {
2627
+ en: vt,
2628
+ de: At,
2629
+ fr: St,
2630
+ fi: wt,
2631
+ lt: zt
2632
+ }, oe = new b.Quaternion(), K = new b.Euler(), Pe = new b.Vector3(), Be = new b.Vector3(), ot = new b.Box3();
2633
2633
  new b.Matrix4();
2634
2634
  new b.Matrix4();
2635
2635
  new b.Vector3();
2636
2636
  new b.Vector3(0, 0, 1);
2637
- const Ht = new b.Vector3(1, 0, 0);
2637
+ const Tt = new b.Vector3(1, 0, 0);
2638
2638
  new b.Vector3(0, 1, 0);
2639
2639
  new b.Vector3(0, 0, 1);
2640
2640
  class $e {
@@ -2763,7 +2763,7 @@ class $e {
2763
2763
  avatarOnlyCamera: null,
2764
2764
  statsNode: null,
2765
2765
  statsStyle: null
2766
- }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new mt(), 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 pt(), 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: {
@@ -4086,7 +4086,7 @@ class $e {
4086
4086
  this.opt.lightSpotDispersion
4087
4087
  ), this.setLighting(this.opt);
4088
4088
  const r = new b.PMREMGenerator(this.renderer);
4089
- r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new dt()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new ut(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;
4089
+ r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new mt()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new ct(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;
4090
4090
  }
4091
4091
  this.ikMesh = new b.SkinnedMesh();
4092
4092
  const s = {
@@ -4104,14 +4104,14 @@ class $e {
4104
4104
  Object.entries(s).forEach((r, c) => {
4105
4105
  const l = new b.Bone();
4106
4106
  l.name = r[0], r[1] ? this.ikMesh.getObjectByName(r[1]).add(l) : this.ikMesh.add(l), i.push(l);
4107
- }), this.ikMesh.bind(new b.Skeleton(i)), this.dynamicbones = new ft(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
4107
+ }), this.ikMesh.bind(new b.Skeleton(i)), this.dynamicbones = new xt(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
4108
4108
  }
4109
4109
  /**
4110
4110
  * Helper that re/creates the audio context and the other nodes.
4111
4111
  * @param {number} sampleRate
4112
4112
  */
4113
4113
  initAudioGraph(n = null) {
4114
- if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), n ? this.audioCtx = new AudioContext({ sampleRate: n }) : 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 xt(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(
4114
+ if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), n ? this.audioCtx = new AudioContext({ sampleRate: n }) : 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 bt(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(
4115
4115
  this.opt.mixerGainSpeech,
4116
4116
  this.opt.mixerGainBackground
4117
4117
  ), this.workletLoaded = !1, this.streamWorkletNode) {
@@ -4228,13 +4228,13 @@ class $e {
4228
4228
  const a = s.morphTargetDictionary[l], d = i.morphAttributes.position[a], h = i.morphAttributes.normal?.[a];
4229
4229
  r || (r = new b.Float32BufferAttribute(d.count * 3, 3), h && (c = new b.Float32BufferAttribute(d.count * 3, 3)));
4230
4230
  for (let g = 0; g < d.count; g++) {
4231
- const R = r.getX(g) + d.getX(g) * u, f = r.getY(g) + d.getY(g) * u, S = r.getZ(g) + d.getZ(g) * u;
4232
- r.setXYZ(g, R, f, S);
4231
+ const R = r.getX(g) + d.getX(g) * u, x = r.getY(g) + d.getY(g) * u, S = r.getZ(g) + d.getZ(g) * u;
4232
+ r.setXYZ(g, R, x, S);
4233
4233
  }
4234
4234
  if (h)
4235
4235
  for (let g = 0; g < d.count; g++) {
4236
- const R = c.getX(g) + h.getX(g) * u, f = c.getY(g) + h.getY(g) * u, S = c.getZ(g) + h.getZ(g) * u;
4237
- c.setXYZ(g, R, f, S);
4236
+ const R = c.getX(g) + h.getX(g) * u, x = c.getY(g) + h.getY(g) * u, S = c.getZ(g) + h.getZ(g) * u;
4237
+ c.setXYZ(g, R, x, S);
4238
4238
  }
4239
4239
  }
4240
4240
  if (r) {
@@ -4252,9 +4252,9 @@ class $e {
4252
4252
  async showAvatar(n, e = null) {
4253
4253
  if (!n || !n.hasOwnProperty("url"))
4254
4254
  throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
4255
- const t = new ct();
4255
+ const t = new ht();
4256
4256
  if (this.dracoEnabled) {
4257
- const l = new ht();
4257
+ const l = new dt();
4258
4258
  l.setDecoderPath(this.dracoDecoderPath), t.setDRACOLoader(l);
4259
4259
  }
4260
4260
  let o = await t.loadAsync(n.url, e);
@@ -4414,7 +4414,7 @@ class $e {
4414
4414
  if (e.x === 0 && e.y === 0 && e.z === 0) continue;
4415
4415
  K.set(e.x, e.y, e.z);
4416
4416
  const t = this.poseAvatar.props[n];
4417
- t.isQuaternion ? (ie.setFromEuler(K), t.multiply(ie)) : t.isVector3 && t.add(K);
4417
+ t.isQuaternion ? (oe.setFromEuler(K), t.multiply(oe)) : t.isVector3 && t.add(K);
4418
4418
  }
4419
4419
  }
4420
4420
  /**
@@ -5115,8 +5115,8 @@ class $e {
5115
5115
  else {
5116
5116
  g.newvalue = h[o + 1];
5117
5117
  const R = a.ts[o + 1] - a.ts[o];
5118
- let f = 1;
5119
- R > 1e-4 && (f = (this.animClock - a.ts[o]) / R), f < 1 && (g.easing && (f = g.easing(f)), g.newvalue = (1 - f) * h[o] + f * g.newvalue), g.ref && g.ref !== a.vs && g.ref.hasOwnProperty(d) && delete g.ref[d], g.ref = a.vs;
5118
+ let x = 1;
5119
+ R > 1e-4 && (x = (this.animClock - a.ts[o]) / R), x < 1 && (g.easing && (x = g.easing(x)), g.newvalue = (1 - x) * h[o] + x * g.newvalue), g.ref && g.ref !== a.vs && g.ref.hasOwnProperty(d) && delete g.ref[d], g.ref = a.vs;
5120
5120
  }
5121
5121
  if (r)
5122
5122
  switch (d) {
@@ -5200,7 +5200,7 @@ class $e {
5200
5200
  eyeLookOutRight: [null, 0],
5201
5201
  eyeContact: [0]
5202
5202
  }
5203
- })))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (t = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], o = this.mtAvatar[t], o.needsUpdate || Object.assign(o, { base: (this.mood.baseline[t] || 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) && c ? 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), t = this.volumeHeadTarget - this.volumeHeadCurrent, o = Math.abs(t), o > 1e-4 && (i = o * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / o) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(t) * Math.min(o, i)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (ie.setFromAxisAngle(Ht, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(ie)), it.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Fe), Fe.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Pe), Pe.sub(this.armature.position), this.objectHips.position.y -= it.min.y / 2, this.objectHips.position.x -= (Fe.x + Pe.x) / 4, this.objectHips.position.z -= (Fe.z + Pe.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
5203
+ })))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (t = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], o = this.mtAvatar[t], o.needsUpdate || Object.assign(o, { base: (this.mood.baseline[t] || 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) && c ? 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), t = this.volumeHeadTarget - this.volumeHeadCurrent, o = Math.abs(t), o > 1e-4 && (i = o * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / o) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(t) * Math.min(o, i)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (oe.setFromAxisAngle(Tt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(oe)), ot.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Pe), Pe.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Be), Be.sub(this.armature.position), this.objectHips.position.y -= ot.min.y / 2, this.objectHips.position.x -= (Pe.x + Be.x) / 4, this.objectHips.position.z -= (Pe.z + Be.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
5204
5204
  this.stats && this.stats.end();
5205
5205
  else {
5206
5206
  if (this.cameraClock !== null && this.cameraClock < 1e3) {
@@ -5231,8 +5231,8 @@ class $e {
5231
5231
  if (!this.lipsync.hasOwnProperty(n)) {
5232
5232
  const t = n.toLowerCase(), o = "Lipsync" + n.charAt(0).toUpperCase() + n.slice(1);
5233
5233
  try {
5234
- const s = nt[t];
5235
- s && s[o] ? this.lipsync[n] = new s[o]() : console.warn(`Lip-sync module for ${n} not found. Available modules:`, Object.keys(nt));
5234
+ const s = it[t];
5235
+ s && s[o] ? this.lipsync[n] = new s[o]() : console.warn(`Lip-sync module for ${n} not found. Available modules:`, Object.keys(it));
5236
5236
  } catch (s) {
5237
5237
  console.warn(`Failed to load lip-sync module for ${n}:`, s);
5238
5238
  }
@@ -5269,12 +5269,12 @@ class $e {
5269
5269
  e = e || {};
5270
5270
  const s = /[!\.\?\n\p{Extended_Pictographic}]/ug, i = /[ ]/ug, r = /[\p{L}\p{N},\.\p{Quotation_Mark}!€\$\+\p{Dash_Punctuation}%&\?]/ug, c = /[\p{Extended_Pictographic}]/ug, l = e.lipsyncLang || this.avatar.lipsyncLang || this.opt.lipsyncLang;
5271
5271
  let u = "", a = "", d = 0, h = [], g = [];
5272
- const R = Array.from(this.segmenter.segment(n), (f) => f.segment);
5273
- for (let f = 0; f < R.length; f++) {
5274
- const S = f === R.length - 1, W = R[f].match(r);
5275
- let m = R[f].match(s);
5276
- const B = R[f].match(c), M = R[f].match(i);
5277
- if (m && !S && !B && R[f + 1].match(s) && (m = !1), t && (u += R[f]), W && (!o || o.every((y) => f < y[0] || f > y[1])) && (a += R[f]), (M || m || S) && (a.length && (a = this.lipsyncPreProcessText(a, l), a.length && h.push({
5272
+ const R = Array.from(this.segmenter.segment(n), (x) => x.segment);
5273
+ for (let x = 0; x < R.length; x++) {
5274
+ const S = x === R.length - 1, W = R[x].match(r);
5275
+ let m = R[x].match(s);
5276
+ const O = R[x].match(c), M = R[x].match(i);
5277
+ if (m && !S && !O && R[x + 1].match(s) && (m = !1), t && (u += R[x]), W && (!o || o.every((y) => x < y[0] || x > y[1])) && (a += R[x]), (M || m || S) && (a.length && (a = this.lipsyncPreProcessText(a, l), a.length && h.push({
5278
5278
  mark: d,
5279
5279
  word: a
5280
5280
  })), u.length && (g.push({
@@ -5307,8 +5307,8 @@ class $e {
5307
5307
  };
5308
5308
  t && (y.onSubtitles = t), h.length && !e.avatarMute && (y.text = h, e.avatarMood && (y.mood = e.avatarMood), e.ttsLang && (y.lang = e.ttsLang), e.ttsVoice && (y.voice = e.ttsVoice), e.ttsRate && (y.rate = e.ttsRate), e.ttsVoice && (y.pitch = e.ttsPitch), e.ttsVolume && (y.volume = e.ttsVolume)), this.speechQueue.push(y), h = [], a = "", d = 0, g = [];
5309
5309
  }
5310
- if (B) {
5311
- let y = this.animEmojis[R[f]];
5310
+ if (O) {
5311
+ let y = this.animEmojis[R[x]];
5312
5312
  y && y.link && (y = this.animEmojis[y.link]), y && this.speechQueue.push({ emoji: y });
5313
5313
  }
5314
5314
  this.speechQueue.push({ break: 100 });
@@ -5404,13 +5404,13 @@ class $e {
5404
5404
  const h = d.times[d.visemes.length - 1] + d.durations[d.visemes.length - 1], g = Math.min(u, Math.max(0, u - d.visemes.length * 150));
5405
5405
  let R = 0.6 + this.convertRange(g, [0, u], [0, 0.4]);
5406
5406
  if (u = Math.min(u, d.visemes.length * 200), h > 0)
5407
- for (let f = 0; f < d.visemes.length; f++) {
5408
- const S = l + d.times[f] / h * u, W = d.durations[f] / h * u;
5407
+ for (let x = 0; x < d.visemes.length; x++) {
5408
+ const S = l + d.times[x] / h * u, W = d.durations[x] / h * u;
5409
5409
  i.push({
5410
5410
  template: { name: "viseme" },
5411
5411
  ts: [S - Math.min(60, 2 * W / 3), S + Math.min(25, W / 2), S + W + Math.min(60, W / 2)],
5412
5412
  vs: {
5413
- ["viseme_" + d.visemes[f]]: [null, d.visemes[f] === "PP" || d.visemes[f] === "FF" ? 0.9 : R, 0]
5413
+ ["viseme_" + d.visemes[x]]: [null, d.visemes[x] === "PP" || d.visemes[x] === "FF" ? 0.9 : R, 0]
5414
5414
  }
5415
5415
  });
5416
5416
  }
@@ -5476,7 +5476,7 @@ class $e {
5476
5476
  }, this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioSpeechSource.buffer = t.audio, this.audioSpeechSource.playbackRate.value = 1 / this.animSlowdownRate, this.audioSpeechSource.connect(this.audioAnalyzerNode);
5477
5477
  const o = t.delay / 1e3;
5478
5478
  this.audioStartTime = this.audioCtx.currentTime + o, this.audioSpeechSource.addEventListener("ended", () => {
5479
- this.audioSpeechSource.disconnect(), this.audioStartTime = null, this.currentAudioItem = null, this.playAudio(!0);
5479
+ this.audioSpeechSource.disconnect(), this.audioStartTime = null, this.currentAudioItem = null, this.isSpeaking = !0, this.playAudio(!0);
5480
5480
  }, { once: !0 }), t.anim && t.anim.length > 0 && t.anim.forEach((s) => {
5481
5481
  if (s && s.ts && s.ts.length > 0) {
5482
5482
  const i = {
@@ -5517,7 +5517,7 @@ class $e {
5517
5517
  t.anim && (t.isRaw || (s = Math.abs(Math.min(0, ...t.anim.map((r) => Math.min(...r.ts))))), this.currentAudioItem.delay = s), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioSpeechSource.buffer = o, this.audioSpeechSource.playbackRate.value = 1 / this.animSlowdownRate, this.audioSpeechSource.connect(this.audioAnalyzerNode);
5518
5518
  const i = s / 1e3;
5519
5519
  this.audioStartTime = this.audioCtx.currentTime + i, this.audioSpeechSource.addEventListener("ended", () => {
5520
- this.audioSpeechSource.disconnect(), this.audioStartTime = null, this.currentAudioItem = null, this.playAudio(!0);
5520
+ this.audioSpeechSource.disconnect(), this.audioStartTime = null, this.currentAudioItem = null, this.isSpeaking = !0, this.playAudio(!0);
5521
5521
  }, { once: !0 }), t.anim && t.anim.forEach((r) => {
5522
5522
  for (let c = 0; c < r.ts.length; c++)
5523
5523
  r.ts[c] = this.animClock + r.ts[c] + s;
@@ -5537,17 +5537,17 @@ class $e {
5537
5537
  s.lang = i, s.rate = Math.max(0.1, Math.min(10, r)), s.pitch = Math.max(0, Math.min(2, c)), s.volume = Math.max(0, Math.min(1, l));
5538
5538
  const u = speechSynthesis.getVoices(), a = n.voice || this.avatar.ttsVoice || this.opt.ttsVoice;
5539
5539
  if (a && u.length > 0) {
5540
- const m = u.find((B) => B.name.includes(a) || B.lang === i);
5540
+ const m = u.find((O) => O.name.includes(a) || O.lang === i);
5541
5541
  m && (s.voice = m);
5542
5542
  }
5543
- const d = o.length * 100 / s.rate, h = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (d / 1e3), this.audioCtx.sampleRate), g = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", R = this.lipsyncPreProcessText(o, g), f = this.lipsyncWordsToVisemes(R, g), S = [];
5544
- if (f && f.visemes && f.visemes.length > 0) {
5545
- const m = f.times[f.visemes.length - 1] + f.durations[f.visemes.length - 1];
5546
- for (let B = 0; B < f.visemes.length; B++) {
5547
- const M = f.visemes[B], y = f.times[B] / m, F = f.durations[B] / m, L = y * d, x = F * d;
5543
+ const d = o.length * 100 / s.rate, h = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (d / 1e3), this.audioCtx.sampleRate), g = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", R = this.lipsyncPreProcessText(o, g), x = this.lipsyncWordsToVisemes(R, g), S = [];
5544
+ if (x && x.visemes && x.visemes.length > 0) {
5545
+ const m = x.times[x.visemes.length - 1] + x.durations[x.visemes.length - 1];
5546
+ for (let O = 0; O < x.visemes.length; O++) {
5547
+ const M = x.visemes[O], y = x.times[O] / m, F = x.durations[O] / m, L = y * d, f = F * d;
5548
5548
  S.push({
5549
5549
  template: { name: "viseme" },
5550
- ts: [L - Math.min(60, 2 * x / 3), L + Math.min(25, x / 2), L + x + Math.min(60, x / 2)],
5550
+ ts: [L - Math.min(60, 2 * f / 3), L + Math.min(25, f / 2), L + f + Math.min(60, f / 2)],
5551
5551
  vs: {
5552
5552
  ["viseme_" + M]: [null, M === "PP" || M === "FF" ? 0.9 : 0.6, 0]
5553
5553
  }
@@ -5619,15 +5619,15 @@ class $e {
5619
5619
  console.error("Text-based lip-sync failed, using fallback:", d);
5620
5620
  const h = e.toLowerCase().split(/\s+/), g = [];
5621
5621
  for (const R of h)
5622
- for (const f of R) {
5622
+ for (const x of R) {
5623
5623
  let S = "aa";
5624
- "aeiou".includes(f) ? S = "aa" : "bp".includes(f) ? S = "PP" : "fv".includes(f) ? S = "FF" : "st".includes(f) ? S = "SS" : "dln".includes(f) ? S = "DD" : "kg".includes(f) ? S = "kk" : "rw".includes(f) && (S = "RR"), g.push(S);
5624
+ "aeiou".includes(x) ? S = "aa" : "bp".includes(x) ? S = "PP" : "fv".includes(x) ? S = "FF" : "st".includes(x) ? S = "SS" : "dln".includes(x) ? S = "DD" : "kg".includes(x) ? S = "kk" : "rw".includes(x) && (S = "RR"), g.push(S);
5625
5625
  }
5626
5626
  l = {
5627
- visemes: g.map((R, f) => ({
5627
+ visemes: g.map((R, x) => ({
5628
5628
  viseme: R,
5629
- startTime: f * r.duration / g.length,
5630
- endTime: (f + 1) * r.duration / g.length,
5629
+ startTime: x * r.duration / g.length,
5630
+ endTime: (x + 1) * r.duration / g.length,
5631
5631
  duration: r.duration / g.length,
5632
5632
  intensity: 0.6
5633
5633
  })),
@@ -5639,12 +5639,12 @@ class $e {
5639
5639
  const u = [];
5640
5640
  if (l.visemes && l.visemes.length > 0)
5641
5641
  for (let d = 0; d < l.visemes.length; d++) {
5642
- const h = l.visemes[d], g = h.startTime * 1e3, R = h.duration * 1e3, f = h.intensity;
5642
+ const h = l.visemes[d], g = h.startTime * 1e3, R = h.duration * 1e3, x = h.intensity;
5643
5643
  u.push({
5644
5644
  template: { name: "viseme" },
5645
5645
  ts: [g - Math.min(60, 2 * R / 3), g + Math.min(25, R / 2), g + R + Math.min(60, R / 2)],
5646
5646
  vs: {
5647
- ["viseme_" + h.viseme]: [null, f, 0]
5647
+ ["viseme_" + h.viseme]: [null, x, 0]
5648
5648
  }
5649
5649
  });
5650
5650
  }
@@ -5701,15 +5701,15 @@ class $e {
5701
5701
  console.error("Text-based lip-sync failed, using fallback:", d);
5702
5702
  const h = e.toLowerCase().split(/\s+/), g = [];
5703
5703
  for (const R of h)
5704
- for (const f of R) {
5704
+ for (const x of R) {
5705
5705
  let S = "aa";
5706
- "aeiou".includes(f) ? S = "aa" : "bp".includes(f) ? S = "PP" : "fv".includes(f) ? S = "FF" : "st".includes(f) ? S = "SS" : "dln".includes(f) ? S = "DD" : "kg".includes(f) ? S = "kk" : "rw".includes(f) && (S = "RR"), g.push(S);
5706
+ "aeiou".includes(x) ? S = "aa" : "bp".includes(x) ? S = "PP" : "fv".includes(x) ? S = "FF" : "st".includes(x) ? S = "SS" : "dln".includes(x) ? S = "DD" : "kg".includes(x) ? S = "kk" : "rw".includes(x) && (S = "RR"), g.push(S);
5707
5707
  }
5708
5708
  l = {
5709
- visemes: g.map((R, f) => ({
5709
+ visemes: g.map((R, x) => ({
5710
5710
  viseme: R,
5711
- startTime: f * r.duration / g.length,
5712
- endTime: (f + 1) * r.duration / g.length,
5711
+ startTime: x * r.duration / g.length,
5712
+ endTime: (x + 1) * r.duration / g.length,
5713
5713
  duration: r.duration / g.length,
5714
5714
  intensity: 0.6
5715
5715
  })),
@@ -5721,12 +5721,12 @@ class $e {
5721
5721
  const u = [];
5722
5722
  if (l.visemes && l.visemes.length > 0)
5723
5723
  for (let d = 0; d < l.visemes.length; d++) {
5724
- const h = l.visemes[d], g = h.startTime * 1e3, R = h.duration * 1e3, f = h.intensity;
5724
+ const h = l.visemes[d], g = h.startTime * 1e3, R = h.duration * 1e3, x = h.intensity;
5725
5725
  u.push({
5726
5726
  template: { name: "viseme" },
5727
5727
  ts: [g - Math.min(60, 2 * R / 3), g + Math.min(25, R / 2), g + R + Math.min(60, R / 2)],
5728
5728
  vs: {
5729
- ["viseme_" + h.viseme]: [null, f, 0]
5729
+ ["viseme_" + h.viseme]: [null, x, 0]
5730
5730
  }
5731
5731
  });
5732
5732
  }
@@ -5889,7 +5889,7 @@ class $e {
5889
5889
  if (this.currentAudioItem.anim) {
5890
5890
  const d = this.animClock + this.currentAudioItem.delay, h = t * 1e3, g = d + h;
5891
5891
  a = this.currentAudioItem.anim.map((R) => {
5892
- const f = {
5892
+ const x = {
5893
5893
  template: R.template,
5894
5894
  ts: [],
5895
5895
  vs: []
@@ -5898,10 +5898,10 @@ class $e {
5898
5898
  const W = R.ts[S];
5899
5899
  if (W > g) {
5900
5900
  const m = W - g;
5901
- f.ts.push(m), f.vs.push(R.vs[S]);
5901
+ x.ts.push(m), x.vs.push(R.vs[S]);
5902
5902
  }
5903
5903
  }
5904
- return f.ts.length > 0 ? f : null;
5904
+ return x.ts.length > 0 ? x : null;
5905
5905
  }).filter((R) => R !== null);
5906
5906
  }
5907
5907
  n = {
@@ -5957,7 +5957,7 @@ class $e {
5957
5957
  }
5958
5958
  if (!this.workletLoaded)
5959
5959
  try {
5960
- const r = this.audioCtx.audioWorklet.addModule(zt.href), c = new Promise(
5960
+ const r = this.audioCtx.audioWorklet.addModule(Ht.href), c = new Promise(
5961
5961
  (l, u) => setTimeout(() => u(new Error("Worklet loading timed out")), 5e3)
5962
5962
  );
5963
5963
  await Promise.race([r, c]), this.workletLoaded = !0;
@@ -6195,7 +6195,7 @@ class $e {
6195
6195
  */
6196
6196
  lookAtCamera(n) {
6197
6197
  let e;
6198
- if (this.speakTo && (e = new b.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), Fe.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), Pe.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(Fe, Pe).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) {
6198
+ if (this.speakTo && (e = new b.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), Pe.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), Be.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(Pe, Be).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) {
6199
6199
  if (this.avatar.hasOwnProperty("avatarIgnoreCamera")) {
6200
6200
  if (this.avatar.avatarIgnoreCamera) {
6201
6201
  this.lookAhead(n);
@@ -6208,16 +6208,16 @@ class $e {
6208
6208
  this.lookAt(null, null, n);
6209
6209
  return;
6210
6210
  }
6211
- this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), Fe.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Pe.setFromMatrixPosition(this.objectRightEye.matrixWorld), Fe.add(Pe).divideScalar(2), ie.copy(this.armature.quaternion), ie.multiply(this.poseTarget.props["Hips.quaternion"]), ie.multiply(this.poseTarget.props["Spine.quaternion"]), ie.multiply(this.poseTarget.props["Spine1.quaternion"]), ie.multiply(this.poseTarget.props["Spine2.quaternion"]), ie.multiply(this.poseTarget.props["Neck.quaternion"]), ie.multiply(this.poseTarget.props["Head.quaternion"]);
6212
- const t = new b.Vector3().subVectors(e, Fe).normalize(), o = Math.atan2(t.x, t.z), s = Math.asin(-t.y);
6211
+ this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), Pe.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Be.setFromMatrixPosition(this.objectRightEye.matrixWorld), Pe.add(Be).divideScalar(2), oe.copy(this.armature.quaternion), oe.multiply(this.poseTarget.props["Hips.quaternion"]), oe.multiply(this.poseTarget.props["Spine.quaternion"]), oe.multiply(this.poseTarget.props["Spine1.quaternion"]), oe.multiply(this.poseTarget.props["Spine2.quaternion"]), oe.multiply(this.poseTarget.props["Neck.quaternion"]), oe.multiply(this.poseTarget.props["Head.quaternion"]);
6212
+ const t = new b.Vector3().subVectors(e, Pe).normalize(), o = Math.atan2(t.x, t.z), s = Math.asin(-t.y);
6213
6213
  K.set(s, o, 0, "YXZ");
6214
- const r = new b.Quaternion().setFromEuler(K), c = new b.Quaternion().copy(r).multiply(ie.clone().invert());
6214
+ const r = new b.Quaternion().setFromEuler(K), c = new b.Quaternion().copy(r).multiply(oe.clone().invert());
6215
6215
  K.setFromQuaternion(c, "YXZ");
6216
6216
  let l = K.x / (40 / 24) + 0.2, u = K.y / (9 / 4), a = Math.min(0.6, Math.max(-0.3, l)), d = Math.min(0.8, Math.max(-0.8, u)), h = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6217
6217
  if (n) {
6218
6218
  let R = this.animQueue.findIndex((S) => S.template.name === "lookat");
6219
6219
  R !== -1 && this.animQueue.splice(R, 1);
6220
- const f = {
6220
+ const x = {
6221
6221
  name: "lookat",
6222
6222
  dt: [750, n],
6223
6223
  vs: {
@@ -6232,7 +6232,7 @@ class $e {
6232
6232
  headMove: [0]
6233
6233
  }
6234
6234
  };
6235
- this.animQueue.push(this.animFactory(f));
6235
+ this.animQueue.push(this.animFactory(x));
6236
6236
  }
6237
6237
  }
6238
6238
  /**
@@ -6248,18 +6248,18 @@ class $e {
6248
6248
  const s = new b.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), i = new b.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), r = new b.Vector3().addVectors(s, i).divideScalar(2);
6249
6249
  r.project(this.camera);
6250
6250
  let c = (r.x + 1) / 2 * o.width + o.left, l = -(r.y - 1) / 2 * o.height + o.top;
6251
- n === null && (n = c), e === null && (e = l), ie.copy(this.armature.quaternion), ie.multiply(this.poseTarget.props["Hips.quaternion"]), ie.multiply(this.poseTarget.props["Spine.quaternion"]), ie.multiply(this.poseTarget.props["Spine1.quaternion"]), ie.multiply(this.poseTarget.props["Spine2.quaternion"]), ie.multiply(this.poseTarget.props["Neck.quaternion"]), ie.multiply(this.poseTarget.props["Head.quaternion"]), K.setFromQuaternion(ie);
6252
- let u = K.x / (40 / 24), a = K.y / (9 / 4), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), h = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - c, c), R = Math.max(window.innerHeight - l, l), f = this.convertRange(e, [l - R, l + R], [-0.3, 0.6]) - u + d, S = this.convertRange(n, [c - g, c + g], [-0.8, 0.8]) - a + h;
6253
- f = Math.min(0.6, Math.max(-0.3, f)), S = Math.min(0.8, Math.max(-0.8, S));
6251
+ n === null && (n = c), e === null && (e = l), oe.copy(this.armature.quaternion), oe.multiply(this.poseTarget.props["Hips.quaternion"]), oe.multiply(this.poseTarget.props["Spine.quaternion"]), oe.multiply(this.poseTarget.props["Spine1.quaternion"]), oe.multiply(this.poseTarget.props["Spine2.quaternion"]), oe.multiply(this.poseTarget.props["Neck.quaternion"]), oe.multiply(this.poseTarget.props["Head.quaternion"]), K.setFromQuaternion(oe);
6252
+ let u = K.x / (40 / 24), a = K.y / (9 / 4), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), h = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - c, c), R = Math.max(window.innerHeight - l, l), x = this.convertRange(e, [l - R, l + R], [-0.3, 0.6]) - u + d, S = this.convertRange(n, [c - g, c + g], [-0.8, 0.8]) - a + h;
6253
+ x = Math.min(0.6, Math.max(-0.3, x)), S = Math.min(0.8, Math.max(-0.8, S));
6254
6254
  let W = (Math.random() - 0.5) / 4, m = (Math.random() - 0.5) / 4;
6255
6255
  if (t) {
6256
- let B = this.animQueue.findIndex((y) => y.template.name === "lookat");
6257
- B !== -1 && this.animQueue.splice(B, 1);
6256
+ let O = this.animQueue.findIndex((y) => y.template.name === "lookat");
6257
+ O !== -1 && this.animQueue.splice(O, 1);
6258
6258
  const M = {
6259
6259
  name: "lookat",
6260
6260
  dt: [750, t],
6261
6261
  vs: {
6262
- bodyRotateX: [f + W],
6262
+ bodyRotateX: [x + W],
6263
6263
  bodyRotateY: [S + m],
6264
6264
  eyesRotateX: [-3 * W + 0.1],
6265
6265
  eyesRotateY: [-5 * m],
@@ -6482,7 +6482,7 @@ class $e {
6482
6482
  } catch (h) {
6483
6483
  console.warn(`Could not verify file existence for ${n}, attempting to load anyway:`, h);
6484
6484
  }
6485
- const a = new et();
6485
+ const a = new tt();
6486
6486
  let d;
6487
6487
  try {
6488
6488
  d = await a.loadAsync(n, e);
@@ -6493,13 +6493,13 @@ class $e {
6493
6493
  suggestion: "Make sure the file is a valid FBX file and the path is correct"
6494
6494
  }), h.message && h.message.includes("version number") && (console.error("FBX Loader Error: Cannot find version number"), console.error("This error usually means:"), console.error("1. The file is not a valid FBX file (might be GLB, corrupted, or wrong format)"), console.error("2. The file might be corrupted"), console.error("3. The file path might be incorrect"), console.error("4. The server returned an HTML error page instead of the FBX file"), console.error("5. The file might not exist at that path"), console.error(""), console.error("Solution: Please verify:"), console.error(` - File exists at: ${n}`), console.error(" - File is a valid FBX binary file"), console.error(" - File path matches your public folder structure"), console.error(" - File is not corrupted"));
6495
6495
  try {
6496
- const g = await fetch(n), R = g.headers.get("content-type"), f = await g.text();
6496
+ const g = await fetch(n), R = g.headers.get("content-type"), x = await g.text();
6497
6497
  console.error("Response details:", {
6498
6498
  status: g.status,
6499
6499
  contentType: R,
6500
- firstBytes: f.substring(0, 100),
6501
- isHTML: f.trim().startsWith("<!DOCTYPE") || f.trim().startsWith("<html")
6502
- }), (f.trim().startsWith("<!DOCTYPE") || f.trim().startsWith("<html")) && console.error("The server returned an HTML page instead of an FBX file. The file path is likely incorrect.");
6500
+ firstBytes: x.substring(0, 100),
6501
+ isHTML: x.trim().startsWith("<!DOCTYPE") || x.trim().startsWith("<html")
6502
+ }), (x.trim().startsWith("<!DOCTYPE") || x.trim().startsWith("<html")) && console.error("The server returned an HTML page instead of an FBX file. The file path is likely incorrect.");
6503
6503
  } catch (g) {
6504
6504
  console.error("Could not fetch file for debugging:", g);
6505
6505
  }
@@ -6511,7 +6511,7 @@ class $e {
6511
6511
  this.armature && this.armature.traverse((y) => {
6512
6512
  (y.isBone || y.type === "Bone") && g.add(y.name);
6513
6513
  });
6514
- const R = /* @__PURE__ */ new Map(), f = (y) => {
6514
+ const R = /* @__PURE__ */ new Map(), x = (y) => {
6515
6515
  if (g.has(y))
6516
6516
  return y;
6517
6517
  let F = y.replace(/^mixamorig/i, "").replace(/^CC_Base_/i, "").replace(/^RPM_/i, "");
@@ -6540,7 +6540,7 @@ class $e {
6540
6540
  return "LeftShoulder";
6541
6541
  if (L.includes("right") && (L.includes("shoulder") || L.includes("clavicle")) && g.has("RightShoulder"))
6542
6542
  return "RightShoulder";
6543
- const x = {
6543
+ const f = {
6544
6544
  // Arm bones - exact matches
6545
6545
  LeftArm: "LeftArm",
6546
6546
  leftArm: "LeftArm",
@@ -6580,8 +6580,8 @@ class $e {
6580
6580
  Root: "Hips",
6581
6581
  root: "Hips"
6582
6582
  };
6583
- if (x[F]) {
6584
- const T = x[F];
6583
+ if (f[F]) {
6584
+ const T = f[F];
6585
6585
  if (g.has(T))
6586
6586
  return T;
6587
6587
  }
@@ -6605,26 +6605,26 @@ class $e {
6605
6605
  );
6606
6606
  const W = [], m = /* @__PURE__ */ new Set();
6607
6607
  h.tracks.forEach((y) => {
6608
- const L = y.name.replaceAll("mixamorig", "").split("."), x = L[0], T = L[1], A = f(x);
6608
+ const L = y.name.replaceAll("mixamorig", "").split("."), f = L[0], T = L[1], A = x(f);
6609
6609
  if (!(A && (A === "LeftShoulder" || A === "RightShoulder") && (T === "quaternion" || T === "rotation")))
6610
6610
  if (A && T) {
6611
6611
  const D = `${A}.${T}`, V = y.clone();
6612
- V.name = D, W.push(V), x !== A && R.set(x, A);
6612
+ V.name = D, W.push(V), f !== A && R.set(f, A);
6613
6613
  } else
6614
- m.add(x), (x.toLowerCase().includes("arm") || x.toLowerCase().includes("hand") || x.toLowerCase().includes("shoulder")) && console.warn(`⚠️ Arm bone "${x}" could not be mapped to avatar skeleton`);
6614
+ m.add(f), (f.toLowerCase().includes("arm") || f.toLowerCase().includes("hand") || f.toLowerCase().includes("shoulder")) && console.warn(`⚠️ Arm bone "${f}" could not be mapped to avatar skeleton`);
6615
6615
  }), W.length > 0 ? h = new b.AnimationClip(h.name, h.duration, W) : console.error("No tracks could be mapped! Animation may not work correctly.");
6616
- const B = {};
6616
+ const O = {};
6617
6617
  h.tracks.forEach((y) => {
6618
6618
  y.name = y.name.replaceAll("mixamorig", "");
6619
6619
  const F = y.name.split(".");
6620
6620
  if (F[1] === "position") {
6621
6621
  for (let L = 0; L < y.values.length; L++)
6622
6622
  y.values[L] = y.values[L] * s;
6623
- B[y.name] = new b.Vector3(y.values[0], y.values[1], y.values[2]);
6624
- } else F[1] === "quaternion" ? B[y.name] = new b.Quaternion(y.values[0], y.values[1], y.values[2], y.values[3]) : F[1] === "rotation" && (B[F[0] + ".quaternion"] = new b.Quaternion().setFromEuler(new b.Euler(y.values[0], y.values[1], y.values[2], "XYZ")).normalize());
6623
+ O[y.name] = new b.Vector3(y.values[0], y.values[1], y.values[2]);
6624
+ } else F[1] === "quaternion" ? O[y.name] = new b.Quaternion(y.values[0], y.values[1], y.values[2], y.values[3]) : F[1] === "rotation" && (O[F[0] + ".quaternion"] = new b.Quaternion().setFromEuler(new b.Euler(y.values[0], y.values[1], y.values[2], "XYZ")).normalize());
6625
6625
  });
6626
- const M = { props: B };
6627
- B["Hips.position"] && (B["Hips.position"].y < 0.5 ? M.lying = !0 : M.standing = !0), this.animClips.push({
6626
+ const M = { props: O };
6627
+ O["Hips.position"] && (O["Hips.position"].y < 0.5 ? M.lying = !0 : M.standing = !0), this.animClips.push({
6628
6628
  url: n + "-" + o,
6629
6629
  clip: h,
6630
6630
  pose: M
@@ -6665,7 +6665,7 @@ class $e {
6665
6665
  let r = this.animQueue.find((c) => c.template.name === "pose");
6666
6666
  r && (r.ts[0] = this.animClock + t * 1e3 + 2e3), this.setPoseFromTemplate(i);
6667
6667
  } else {
6668
- let c = await new et().loadAsync(n, e);
6668
+ let c = await new tt().loadAsync(n, e);
6669
6669
  if (c && c.animations && c.animations[o]) {
6670
6670
  let l = c.animations[o];
6671
6671
  const u = {};
@@ -6720,7 +6720,7 @@ class $e {
6720
6720
  const d = [];
6721
6721
  for (let R = 1; R < r.ts.length; R++) d.push(r.ts[R] - r.ts[R - 1]);
6722
6722
  const h = i.template?.rescale || d.map((R) => R / u), g = e * 1e3 - u;
6723
- r.ts = r.ts.map((R, f, S) => f === 0 ? c : S[f - 1] + d[f - 1] + h[f - 1] * g);
6723
+ r.ts = r.ts.map((R, x, S) => x === 0 ? c : S[x - 1] + d[x - 1] + h[x - 1] * g);
6724
6724
  } else {
6725
6725
  const d = e * 1e3 / u;
6726
6726
  r.ts = r.ts.map((h) => c + d * (h - c));
@@ -6759,15 +6759,15 @@ class $e {
6759
6759
  R.forEach((S) => {
6760
6760
  S.bone = this.ikMesh.getObjectByName(S.link), S.bone.quaternion.copy(this.getPoseTemplateProp(S.link + ".quaternion"));
6761
6761
  }), h.updateMatrixWorld(!0);
6762
- const f = n.iterations || 10;
6762
+ const x = n.iterations || 10;
6763
6763
  if (e)
6764
- for (let S = 0; S < f; S++) {
6764
+ for (let S = 0; S < x; S++) {
6765
6765
  let W = !1;
6766
- for (let m = 0, B = R.length; m < B; m++) {
6766
+ for (let m = 0, O = R.length; m < O; m++) {
6767
6767
  const M = R[m].bone;
6768
6768
  M.matrixWorld.decompose(c, l, u), l.invert(), i.setFromMatrixPosition(g.matrixWorld), r.subVectors(i, c), r.applyQuaternion(l), r.normalize(), s.subVectors(e, c), s.applyQuaternion(l), s.normalize();
6769
6769
  let y = s.dot(r);
6770
- y > 1 ? y = 1 : y < -1 && (y = -1), y = Math.acos(y), !(y < 1e-5) && (R[m].minAngle !== void 0 && y < R[m].minAngle && (y = R[m].minAngle), R[m].maxAngle !== void 0 && y > R[m].maxAngle && (y = R[m].maxAngle), a.crossVectors(r, s), a.normalize(), ie.setFromAxisAngle(a, y), M.quaternion.multiply(ie), M.rotation.setFromVector3(d.setFromEuler(M.rotation).clamp(new b.Vector3(
6770
+ y > 1 ? y = 1 : y < -1 && (y = -1), y = Math.acos(y), !(y < 1e-5) && (R[m].minAngle !== void 0 && y < R[m].minAngle && (y = R[m].minAngle), R[m].maxAngle !== void 0 && y > R[m].maxAngle && (y = R[m].maxAngle), a.crossVectors(r, s), a.normalize(), oe.setFromAxisAngle(a, y), M.quaternion.multiply(oe), M.rotation.setFromVector3(d.setFromEuler(M.rotation).clamp(new b.Vector3(
6771
6771
  R[m].minx !== void 0 ? R[m].minx : -1 / 0,
6772
6772
  R[m].miny !== void 0 ? R[m].miny : -1 / 0,
6773
6773
  R[m].minz !== void 0 ? R[m].minz : -1 / 0
@@ -6790,7 +6790,7 @@ class $e {
6790
6790
  this.isRunning = !1, this.stop(), this.stopSpeaking(), this.streamStop(), this.isAvatarOnly ? this.armature && (this.armature.parent && this.armature.parent.remove(this.armature), this.clearThree(this.armature)) : (this.clearThree(this.scene), this.resizeobserver.disconnect(), this.renderer && (this.renderer.dispose(), this.renderer.domElement && this.renderer.domElement.parentNode && this.renderer.domElement.parentNode.removeChild(this.renderer.domElement), this.renderer = null)), this.clearThree(this.ikMesh), this.dynamicbones.dispose();
6791
6791
  }
6792
6792
  }
6793
- const Oe = {
6793
+ const De = {
6794
6794
  apiKey: "sk_ace57ef3ef65a92b9d3bee2a00183b78ca790bc3e10964f2",
6795
6795
  // Replace with your actual API key (should start with sk_)
6796
6796
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
@@ -6810,7 +6810,7 @@ const Oe = {
6810
6810
  josh: "VR6AewLTigWG4xSOukaG"
6811
6811
  // Male, American
6812
6812
  }
6813
- }, Ye = {
6813
+ }, Qe = {
6814
6814
  defaultVoice: "aura-2-thalia-en",
6815
6815
  // Thalia (Female, English)
6816
6816
  voices: {
@@ -6830,17 +6830,17 @@ const Oe = {
6830
6830
  // Male, English - Powerful
6831
6831
  }
6832
6832
  };
6833
- function _e() {
6833
+ function Ke() {
6834
6834
  return {
6835
6835
  service: "elevenlabs",
6836
- endpoint: Oe.endpoint,
6837
- apiKey: Oe.apiKey,
6838
- defaultVoice: Oe.defaultVoice,
6839
- voices: Oe.voices
6836
+ endpoint: De.endpoint,
6837
+ apiKey: De.apiKey,
6838
+ defaultVoice: De.defaultVoice,
6839
+ voices: De.voices
6840
6840
  };
6841
6841
  }
6842
- function Gt() {
6843
- const G = _e(), n = [];
6842
+ function Zt() {
6843
+ const G = Ke(), n = [];
6844
6844
  return Object.entries(G.voices).forEach(([e, t]) => {
6845
6845
  n.push({
6846
6846
  value: t,
@@ -6848,7 +6848,7 @@ function Gt() {
6848
6848
  });
6849
6849
  }), n;
6850
6850
  }
6851
- const st = Qe(({
6851
+ const rt = qe(({
6852
6852
  avatarUrl: G = "/avatars/brunette.glb",
6853
6853
  avatarBody: n = "F",
6854
6854
  mood: e = "neutral",
@@ -6868,58 +6868,58 @@ const st = Qe(({
6868
6868
  },
6869
6869
  className: g = "",
6870
6870
  style: R = {},
6871
- animations: f = {}
6871
+ animations: x = {}
6872
6872
  }, S) => {
6873
- const W = U(null), m = U(null), B = U(l), M = U(null), y = U(null), F = U(!1), L = U({ remainingText: null, originalText: null, options: null }), x = U([]), T = U(0), [A, D] = ue(!0), [V, j] = ue(null), [Y, ye] = ue(!1), [ae, ke] = ue(!1);
6874
- be(() => {
6875
- F.current = ae;
6876
- }, [ae]), be(() => {
6877
- B.current = l;
6873
+ const W = U(null), m = U(null), O = U(l), M = U(null), y = U(null), F = U(!1), L = U({ remainingText: null, originalText: null, options: null }), f = U([]), T = U(0), [A, D] = he(!0), [V, Z] = he(null), [Y, xe] = he(!1), [le, Ce] = he(!1);
6874
+ ve(() => {
6875
+ F.current = le;
6876
+ }, [le]), ve(() => {
6877
+ O.current = l;
6878
6878
  }, [l]);
6879
- const he = _e(), ge = o || he.service;
6880
- let oe;
6881
- ge === "browser" ? oe = {
6879
+ const de = Ke(), ye = o || de.service;
6880
+ let se;
6881
+ ye === "browser" ? se = {
6882
6882
  service: "browser",
6883
6883
  endpoint: "",
6884
6884
  apiKey: null,
6885
6885
  defaultVoice: "Google US English"
6886
- } : ge === "elevenlabs" ? oe = {
6886
+ } : ye === "elevenlabs" ? se = {
6887
6887
  service: "elevenlabs",
6888
6888
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
6889
- apiKey: i || he.apiKey,
6890
- defaultVoice: s || he.defaultVoice || Oe.defaultVoice,
6891
- voices: he.voices || Oe.voices
6892
- } : ge === "deepgram" ? oe = {
6889
+ apiKey: i || de.apiKey,
6890
+ defaultVoice: s || de.defaultVoice || De.defaultVoice,
6891
+ voices: de.voices || De.voices
6892
+ } : ye === "deepgram" ? se = {
6893
6893
  service: "deepgram",
6894
6894
  endpoint: "https://api.deepgram.com/v1/speak",
6895
- apiKey: i || he.apiKey,
6896
- defaultVoice: s || he.defaultVoice || Ye.defaultVoice,
6897
- voices: he.voices || Ye.voices
6898
- } : oe = {
6899
- ...he,
6895
+ apiKey: i || de.apiKey,
6896
+ defaultVoice: s || de.defaultVoice || Qe.defaultVoice,
6897
+ voices: de.voices || Qe.voices
6898
+ } : se = {
6899
+ ...de,
6900
6900
  // Override API key if provided via props
6901
- apiKey: i !== null ? i : he.apiKey
6901
+ apiKey: i !== null ? i : de.apiKey
6902
6902
  };
6903
6903
  const v = {
6904
6904
  url: G,
6905
6905
  body: n,
6906
6906
  avatarMood: e,
6907
- ttsLang: ge === "browser" ? "en-US" : t,
6908
- ttsVoice: s || oe.defaultVoice,
6907
+ ttsLang: ye === "browser" ? "en-US" : t,
6908
+ ttsVoice: s || se.defaultVoice,
6909
6909
  lipsyncLang: "en",
6910
6910
  showFullAvatar: l,
6911
6911
  bodyMovement: r,
6912
6912
  movementIntensity: c
6913
6913
  }, I = {
6914
- ttsEndpoint: oe.endpoint,
6915
- ttsApikey: oe.apiKey,
6916
- ttsService: ge,
6914
+ ttsEndpoint: se.endpoint,
6915
+ ttsApikey: se.apiKey,
6916
+ ttsService: ye,
6917
6917
  lipsyncModules: ["en"],
6918
6918
  cameraView: u
6919
6919
  }, H = N(async () => {
6920
6920
  if (!(!W.current || m.current))
6921
6921
  try {
6922
- if (D(!0), j(null), m.current = new $e(W.current, I), m.current.controls && (m.current.controls.enableRotate = !1, m.current.controls.enableZoom = !1, m.current.controls.enablePan = !1, m.current.controls.enableDamping = !1), f && Object.keys(f).length > 0 && (m.current.customAnimations = f), await m.current.showAvatar(v, (Q) => {
6922
+ if (D(!0), Z(null), m.current = new $e(W.current, I), m.current.controls && (m.current.controls.enableRotate = !1, m.current.controls.enableZoom = !1, m.current.controls.enablePan = !1, m.current.controls.enableDamping = !1), x && Object.keys(x).length > 0 && (m.current.customAnimations = x), await m.current.showAvatar(v, (Q) => {
6923
6923
  if (Q.lengthComputable) {
6924
6924
  const re = Math.min(100, Math.round(Q.loaded / Q.total * 100));
6925
6925
  d(re);
@@ -6935,31 +6935,31 @@ const st = Qe(({
6935
6935
  } catch (Q) {
6936
6936
  console.warn("Error setting full body mode on initialization:", Q);
6937
6937
  }
6938
- m.current && m.current.controls && (m.current.controls.enableRotate = !1, m.current.controls.enableZoom = !1, m.current.controls.enablePan = !1, m.current.controls.enableDamping = !1, m.current.controls.update()), D(!1), ye(!0), a(m.current);
6939
- const X = () => {
6938
+ m.current && m.current.controls && (m.current.controls.enableRotate = !1, m.current.controls.enableZoom = !1, m.current.controls.enablePan = !1, m.current.controls.enableDamping = !1, m.current.controls.update()), D(!1), xe(!0), a(m.current);
6939
+ const j = () => {
6940
6940
  document.visibilityState === "visible" ? m.current?.start() : m.current?.stop();
6941
6941
  };
6942
- return document.addEventListener("visibilitychange", X), () => {
6943
- document.removeEventListener("visibilitychange", X);
6942
+ return document.addEventListener("visibilitychange", j), () => {
6943
+ document.removeEventListener("visibilitychange", j);
6944
6944
  };
6945
6945
  } catch (w) {
6946
- console.error("Error initializing TalkingHead:", w), j(w.message || "Failed to initialize avatar"), D(!1), h(w);
6946
+ console.error("Error initializing TalkingHead:", w), Z(w.message || "Failed to initialize avatar"), D(!1), h(w);
6947
6947
  }
6948
6948
  }, [G, n, e, t, o, s, i, l, r, c, u]);
6949
- be(() => (H(), () => {
6949
+ ve(() => (H(), () => {
6950
6950
  m.current && (m.current.stop(), m.current.dispose(), m.current = null);
6951
- }), [H]), be(() => {
6951
+ }), [H]), ve(() => {
6952
6952
  if (!W.current || !m.current) return;
6953
6953
  const w = new ResizeObserver((Q) => {
6954
6954
  for (const re of Q)
6955
6955
  m.current && m.current.onResize && m.current.onResize();
6956
6956
  });
6957
6957
  w.observe(W.current);
6958
- const X = () => {
6958
+ const j = () => {
6959
6959
  m.current && m.current.onResize && m.current.onResize();
6960
6960
  };
6961
- return window.addEventListener("resize", X), () => {
6962
- w.disconnect(), window.removeEventListener("resize", X);
6961
+ return window.addEventListener("resize", j), () => {
6962
+ w.disconnect(), window.removeEventListener("resize", j);
6963
6963
  };
6964
6964
  }, [Y]);
6965
6965
  const E = N(async () => {
@@ -6969,169 +6969,169 @@ const st = Qe(({
6969
6969
  } catch (w) {
6970
6970
  console.warn("Failed to resume audio context:", w);
6971
6971
  }
6972
- }, []), Z = N(async (w, X = {}) => {
6972
+ }, []), X = N(async (w, j = {}) => {
6973
6973
  if (m.current && Y)
6974
6974
  try {
6975
- y.current && (clearInterval(y.current), y.current = null), M.current = { text: w, options: X }, L.current = { remainingText: null, originalText: null, options: null };
6976
- const Q = /[!\.\?\n\p{Extended_Pictographic}]/ug, re = w.split(Q).map((J) => J.trim()).filter((J) => J.length > 0);
6977
- x.current = re, T.current = 0, ke(!1), F.current = !1, await E();
6978
- const Le = {
6979
- ...X,
6980
- lipsyncLang: X.lipsyncLang || v.lipsyncLang || "en"
6975
+ y.current && (clearInterval(y.current), y.current = null), M.current = { text: w, options: j }, L.current = { remainingText: null, originalText: null, options: null };
6976
+ const Q = /[!\.\?\n\p{Extended_Pictographic}]/ug, re = w.split(Q).map(($) => $.trim()).filter(($) => $.length > 0);
6977
+ f.current = re, T.current = 0, Ce(!1), F.current = !1, await E();
6978
+ const Se = {
6979
+ ...j,
6980
+ lipsyncLang: j.lipsyncLang || v.lipsyncLang || "en"
6981
6981
  };
6982
- if (X.onSpeechEnd && m.current) {
6983
- const J = m.current;
6984
- let le = null, Ee = 0;
6985
- const ze = 1200;
6986
- let Se = !1;
6987
- le = setInterval(() => {
6988
- if (Ee++, F.current)
6982
+ if (j.onSpeechEnd && m.current) {
6983
+ const $ = m.current;
6984
+ let ue = null, Oe = 0;
6985
+ const He = 1200;
6986
+ let ke = !1;
6987
+ ue = setInterval(() => {
6988
+ if (Oe++, F.current)
6989
6989
  return;
6990
- if (Ee > ze) {
6991
- if (le && (clearInterval(le), le = null, y.current = null), !Se && !F.current) {
6992
- Se = !0;
6990
+ if (Oe > He) {
6991
+ if (ue && (clearInterval(ue), ue = null, y.current = null), !ke && !F.current) {
6992
+ ke = !0;
6993
6993
  try {
6994
- X.onSpeechEnd();
6995
- } catch (Ve) {
6996
- console.error("Error in onSpeechEnd callback (timeout):", Ve);
6994
+ j.onSpeechEnd();
6995
+ } catch (Ze) {
6996
+ console.error("Error in onSpeechEnd callback (timeout):", Ze);
6997
6997
  }
6998
6998
  }
6999
6999
  return;
7000
7000
  }
7001
- const ve = !J.speechQueue || J.speechQueue.length === 0, Ie = !J.audioPlaylist || J.audioPlaylist.length === 0;
7002
- J && J.isSpeaking === !1 && ve && Ie && J.isAudioPlaying === !1 && !Se && !F.current && setTimeout(() => {
7003
- if (J && !F.current && J.isSpeaking === !1 && (!J.speechQueue || J.speechQueue.length === 0) && (!J.audioPlaylist || J.audioPlaylist.length === 0) && J.isAudioPlaying === !1 && !Se && !F.current) {
7004
- Se = !0, le && (clearInterval(le), le = null, y.current = null);
7001
+ const Ie = !$.speechQueue || $.speechQueue.length === 0, fe = !$.audioPlaylist || $.audioPlaylist.length === 0;
7002
+ $ && $.isSpeaking === !1 && Ie && fe && $.isAudioPlaying === !1 && !ke && !F.current && setTimeout(() => {
7003
+ if ($ && !F.current && $.isSpeaking === !1 && (!$.speechQueue || $.speechQueue.length === 0) && (!$.audioPlaylist || $.audioPlaylist.length === 0) && $.isAudioPlaying === !1 && !ke && !F.current) {
7004
+ ke = !0, ue && (clearInterval(ue), ue = null, y.current = null);
7005
7005
  try {
7006
- X.onSpeechEnd();
7007
- } catch (Ke) {
7008
- console.error("Error in onSpeechEnd callback:", Ke);
7006
+ j.onSpeechEnd();
7007
+ } catch (Je) {
7008
+ console.error("Error in onSpeechEnd callback:", Je);
7009
7009
  }
7010
7010
  }
7011
7011
  }, 100);
7012
- }, 100), y.current = le;
7012
+ }, 100), y.current = ue;
7013
7013
  }
7014
- m.current.lipsync && Object.keys(m.current.lipsync).length > 0 ? (m.current.setSlowdownRate && m.current.setSlowdownRate(1.05), m.current.speakText(w, Le)) : setTimeout(async () => {
7015
- await E(), m.current && m.current.lipsync && (m.current.setSlowdownRate && m.current.setSlowdownRate(1.05), m.current.speakText(w, Le));
7014
+ m.current.lipsync && Object.keys(m.current.lipsync).length > 0 ? (m.current.setSlowdownRate && m.current.setSlowdownRate(1.05), m.current.speakText(w, Se)) : setTimeout(async () => {
7015
+ await E(), m.current && m.current.lipsync && (m.current.setSlowdownRate && m.current.setSlowdownRate(1.05), m.current.speakText(w, Se));
7016
7016
  }, 100);
7017
7017
  } catch (Q) {
7018
- console.error("Error speaking text:", Q), j(Q.message || "Failed to speak text");
7018
+ console.error("Error speaking text:", Q), Z(Q.message || "Failed to speak text");
7019
7019
  }
7020
- }, [Y, E, v.lipsyncLang]), se = N(() => {
7021
- m.current && (m.current.stopSpeaking(), m.current.setSlowdownRate && m.current.setSlowdownRate(1), M.current = null, ke(!1));
7022
- }, []), ne = N(() => {
7020
+ }, [Y, E, v.lipsyncLang]), ie = N(() => {
7021
+ m.current && (m.current.stopSpeaking(), m.current.setSlowdownRate && m.current.setSlowdownRate(1), M.current = null, Ce(!1));
7022
+ }, []), te = N(() => {
7023
7023
  if (m.current && m.current.pauseSpeaking) {
7024
7024
  const w = m.current;
7025
7025
  if (w.isSpeaking || w.audioPlaylist && w.audioPlaylist.length > 0 || w.speechQueue && w.speechQueue.length > 0) {
7026
7026
  y.current && (clearInterval(y.current), y.current = null);
7027
7027
  let Q = "";
7028
- if (M.current && x.current.length > 0) {
7029
- const re = x.current.length, Le = w.speechQueue ? w.speechQueue.filter((ze) => ze && ze.text && Array.isArray(ze.text) && ze.text.length > 0).length : 0, J = w.audioPlaylist && w.audioPlaylist.length > 0, le = Le + (J ? 1 : 0), Ee = re - le;
7030
- if (le > 0 && Ee < re && (Q = x.current.slice(Ee).join(". ").trim(), !Q && Le > 0 && w.speechQueue)) {
7031
- const Se = w.speechQueue.filter((ve) => ve && ve.text && Array.isArray(ve.text) && ve.text.length > 0).map((ve) => ve.text.map((Ie) => Ie.word || "").filter((Ie) => Ie.length > 0).join(" ")).filter((ve) => ve.length > 0).join(" ");
7032
- Se && Se.trim() && (Q = Se.trim());
7028
+ if (M.current && f.current.length > 0) {
7029
+ const re = f.current.length, Se = w.speechQueue ? w.speechQueue.filter((He) => He && He.text && Array.isArray(He.text) && He.text.length > 0).length : 0, $ = w.audioPlaylist && w.audioPlaylist.length > 0, ue = Se + ($ ? 1 : 0), Oe = re - ue;
7030
+ if (ue > 0 && Oe < re && (Q = f.current.slice(Oe).join(". ").trim(), !Q && Se > 0 && w.speechQueue)) {
7031
+ const ke = w.speechQueue.filter((Ie) => Ie && Ie.text && Array.isArray(Ie.text) && Ie.text.length > 0).map((Ie) => Ie.text.map((fe) => fe.word || "").filter((fe) => fe.length > 0).join(" ")).filter((Ie) => Ie.length > 0).join(" ");
7032
+ ke && ke.trim() && (Q = ke.trim());
7033
7033
  }
7034
7034
  }
7035
7035
  M.current && (L.current = {
7036
7036
  remainingText: Q || null,
7037
7037
  originalText: M.current.text,
7038
7038
  options: M.current.options
7039
- }), w.speechQueue && (w.speechQueue.length = 0), m.current.pauseSpeaking(), F.current = !0, ke(!0);
7039
+ }), w.speechQueue && (w.speechQueue.length = 0), m.current.pauseSpeaking(), F.current = !0, Ce(!0);
7040
7040
  }
7041
7041
  }
7042
- }, []), $ = N(async () => {
7043
- if (!m.current || !ae)
7042
+ }, []), J = N(async () => {
7043
+ if (!m.current || !le)
7044
7044
  return;
7045
- let w = "", X = {};
7045
+ let w = "", j = {};
7046
7046
  if (L.current && L.current.remainingText)
7047
- w = L.current.remainingText, X = L.current.options || {}, L.current = { remainingText: null, originalText: null, options: null };
7047
+ w = L.current.remainingText, j = L.current.options || {}, L.current = { remainingText: null, originalText: null, options: null };
7048
7048
  else if (M.current && M.current.text)
7049
- w = M.current.text, X = M.current.options || {};
7049
+ w = M.current.text, j = M.current.options || {};
7050
7050
  else {
7051
- console.warn("Resume called but no paused speech found"), ke(!1), F.current = !1;
7051
+ console.warn("Resume called but no paused speech found"), Ce(!1), F.current = !1;
7052
7052
  return;
7053
7053
  }
7054
- ke(!1), F.current = !1, await E();
7054
+ Ce(!1), F.current = !1, await E();
7055
7055
  const Q = {
7056
- ...X,
7057
- lipsyncLang: X.lipsyncLang || v.lipsyncLang || "en"
7056
+ ...j,
7057
+ lipsyncLang: j.lipsyncLang || v.lipsyncLang || "en"
7058
7058
  };
7059
7059
  try {
7060
- await Z(w, Q);
7060
+ await X(w, Q);
7061
7061
  } catch (re) {
7062
- console.error("Error resuming speech:", re), ke(!1), F.current = !1;
7062
+ console.error("Error resuming speech:", re), Ce(!1), F.current = !1;
7063
7063
  }
7064
- }, [E, ae, Z, v]), Re = N((w) => {
7064
+ }, [E, le, X, v]), be = N((w) => {
7065
7065
  m.current && m.current.setMood(w);
7066
- }, []), We = N((w) => {
7066
+ }, []), Ge = N((w) => {
7067
7067
  m.current && m.current.setSlowdownRate && m.current.setSlowdownRate(w);
7068
- }, []), Me = N((w, X = !1) => {
7068
+ }, []), Ee = N((w, j = !1) => {
7069
7069
  if (m.current && m.current.playAnimation) {
7070
- if (f && f[w] && (w = f[w]), m.current.setShowFullAvatar)
7070
+ if (x && x[w] && (w = x[w]), m.current.setShowFullAvatar)
7071
7071
  try {
7072
- m.current.setShowFullAvatar(B.current);
7072
+ m.current.setShowFullAvatar(O.current);
7073
7073
  } catch (re) {
7074
7074
  console.warn("Error setting full body mode:", re);
7075
7075
  }
7076
7076
  if (w.includes("."))
7077
7077
  try {
7078
- m.current.playAnimation(w, null, 10, 0, 0.01, X);
7078
+ m.current.playAnimation(w, null, 10, 0, 0.01, j);
7079
7079
  } catch (re) {
7080
7080
  console.warn(`Failed to play ${w}:`, re);
7081
7081
  try {
7082
7082
  m.current.setBodyMovement("idle");
7083
- } catch (Le) {
7084
- console.warn("Fallback animation also failed:", Le);
7083
+ } catch (Se) {
7084
+ console.warn("Fallback animation also failed:", Se);
7085
7085
  }
7086
7086
  }
7087
7087
  else {
7088
7088
  const re = [".fbx", ".glb", ".gltf"];
7089
- let Le = !1;
7090
- for (const J of re)
7089
+ let Se = !1;
7090
+ for (const $ of re)
7091
7091
  try {
7092
- m.current.playAnimation(w + J, null, 10, 0, 0.01, X), Le = !0;
7092
+ m.current.playAnimation(w + $, null, 10, 0, 0.01, j), Se = !0;
7093
7093
  break;
7094
7094
  } catch {
7095
7095
  }
7096
- if (!Le) {
7096
+ if (!Se) {
7097
7097
  console.warn("Animation not found:", w);
7098
7098
  try {
7099
7099
  m.current.setBodyMovement("idle");
7100
- } catch (J) {
7101
- console.warn("Fallback animation also failed:", J);
7100
+ } catch ($) {
7101
+ console.warn("Fallback animation also failed:", $);
7102
7102
  }
7103
7103
  }
7104
7104
  }
7105
7105
  }
7106
- }, [f]), Be = N(() => {
7106
+ }, [x]), Ne = N(() => {
7107
7107
  m.current && m.current.onResize && m.current.onResize();
7108
7108
  }, []);
7109
- return qe(S, () => ({
7110
- speakText: Z,
7111
- stopSpeaking: se,
7112
- pauseSpeaking: ne,
7113
- resumeSpeaking: $,
7109
+ return _e(S, () => ({
7110
+ speakText: X,
7111
+ stopSpeaking: ie,
7112
+ pauseSpeaking: te,
7113
+ resumeSpeaking: J,
7114
7114
  resumeAudioContext: E,
7115
- setMood: Re,
7116
- setTimingAdjustment: We,
7117
- playAnimation: Me,
7115
+ setMood: be,
7116
+ setTimingAdjustment: Ge,
7117
+ playAnimation: Ee,
7118
7118
  isReady: Y,
7119
- isPaused: ae,
7119
+ isPaused: le,
7120
7120
  talkingHead: m.current,
7121
- handleResize: Be,
7121
+ handleResize: Ne,
7122
7122
  setBodyMovement: (w) => {
7123
7123
  if (m.current && m.current.setShowFullAvatar && m.current.setBodyMovement)
7124
7124
  try {
7125
- m.current.setShowFullAvatar(B.current), m.current.setBodyMovement(w);
7126
- } catch (X) {
7127
- console.warn("Error setting body movement:", X);
7125
+ m.current.setShowFullAvatar(O.current), m.current.setBodyMovement(w);
7126
+ } catch (j) {
7127
+ console.warn("Error setting body movement:", j);
7128
7128
  }
7129
7129
  },
7130
7130
  setMovementIntensity: (w) => m.current?.setMovementIntensity(w),
7131
7131
  playRandomDance: () => {
7132
7132
  if (m.current && m.current.setShowFullAvatar && m.current.playRandomDance)
7133
7133
  try {
7134
- m.current.setShowFullAvatar(B.current), m.current.playRandomDance();
7134
+ m.current.setShowFullAvatar(O.current), m.current.playRandomDance();
7135
7135
  } catch (w) {
7136
7136
  console.warn("Error playing random dance:", w);
7137
7137
  }
@@ -7139,15 +7139,15 @@ const st = Qe(({
7139
7139
  playReaction: (w) => {
7140
7140
  if (m.current && m.current.setShowFullAvatar && m.current.playReaction)
7141
7141
  try {
7142
- m.current.setShowFullAvatar(B.current), m.current.playReaction(w);
7143
- } catch (X) {
7144
- console.warn("Error playing reaction:", X);
7142
+ m.current.setShowFullAvatar(O.current), m.current.playReaction(w);
7143
+ } catch (j) {
7144
+ console.warn("Error playing reaction:", j);
7145
7145
  }
7146
7146
  },
7147
7147
  playCelebration: () => {
7148
7148
  if (m.current && m.current.setShowFullAvatar && m.current.playCelebration)
7149
7149
  try {
7150
- m.current.setShowFullAvatar(B.current), m.current.playCelebration();
7150
+ m.current.setShowFullAvatar(O.current), m.current.playCelebration();
7151
7151
  } catch (w) {
7152
7152
  console.warn("Error playing celebration:", w);
7153
7153
  }
@@ -7155,9 +7155,9 @@ const st = Qe(({
7155
7155
  setShowFullAvatar: (w) => {
7156
7156
  if (m.current && m.current.setShowFullAvatar)
7157
7157
  try {
7158
- B.current = w, m.current.setShowFullAvatar(w);
7159
- } catch (X) {
7160
- console.warn("Error setting showFullAvatar:", X);
7158
+ O.current = w, m.current.setShowFullAvatar(w);
7159
+ } catch (j) {
7160
+ console.warn("Error setting showFullAvatar:", j);
7161
7161
  }
7162
7162
  },
7163
7163
  lockAvatarPosition: () => {
@@ -7176,7 +7176,7 @@ const st = Qe(({
7176
7176
  console.warn("Error unlocking avatar position:", w);
7177
7177
  }
7178
7178
  }
7179
- })), /* @__PURE__ */ Ce(
7179
+ })), /* @__PURE__ */ ze(
7180
7180
  "div",
7181
7181
  {
7182
7182
  className: `talking-head-avatar ${g}`,
@@ -7187,7 +7187,7 @@ const st = Qe(({
7187
7187
  ...R
7188
7188
  },
7189
7189
  children: [
7190
- /* @__PURE__ */ te(
7190
+ /* @__PURE__ */ ee(
7191
7191
  "div",
7192
7192
  {
7193
7193
  ref: W,
@@ -7199,7 +7199,7 @@ const st = Qe(({
7199
7199
  }
7200
7200
  }
7201
7201
  ),
7202
- A && /* @__PURE__ */ te("div", { className: "loading-overlay", style: {
7202
+ A && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7203
7203
  position: "absolute",
7204
7204
  top: "50%",
7205
7205
  left: "50%",
@@ -7208,7 +7208,7 @@ const st = Qe(({
7208
7208
  fontSize: "18px",
7209
7209
  zIndex: 10
7210
7210
  }, children: "Loading avatar..." }),
7211
- V && /* @__PURE__ */ te("div", { className: "error-overlay", style: {
7211
+ V && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7212
7212
  position: "absolute",
7213
7213
  top: "50%",
7214
7214
  left: "50%",
@@ -7224,8 +7224,8 @@ const st = Qe(({
7224
7224
  }
7225
7225
  );
7226
7226
  });
7227
- st.displayName = "TalkingHeadAvatar";
7228
- const Tt = Qe(({
7227
+ rt.displayName = "TalkingHeadAvatar";
7228
+ const Mt = qe(({
7229
7229
  text: G = "Hello! I'm a talking avatar. How are you today?",
7230
7230
  onLoading: n = () => {
7231
7231
  },
@@ -7237,16 +7237,16 @@ const Tt = Qe(({
7237
7237
  style: s = {},
7238
7238
  avatarConfig: i = {}
7239
7239
  }, r) => {
7240
- const c = U(null), l = U(null), [u, a] = ue(!0), [d, h] = ue(null), [g, R] = ue(!1), f = _e(), S = i.ttsService || f.service, W = S === "browser" ? {
7240
+ const c = U(null), l = U(null), [u, a] = he(!0), [d, h] = he(null), [g, R] = he(!1), x = Ke(), S = i.ttsService || x.service, W = S === "browser" ? {
7241
7241
  endpoint: "",
7242
7242
  apiKey: null,
7243
7243
  defaultVoice: "Google US English"
7244
7244
  } : {
7245
- ...f,
7245
+ ...x,
7246
7246
  // Override API key if provided via avatarConfig
7247
- apiKey: i.ttsApiKey !== void 0 && i.ttsApiKey !== null ? i.ttsApiKey : f.apiKey,
7247
+ apiKey: i.ttsApiKey !== void 0 && i.ttsApiKey !== null ? i.ttsApiKey : x.apiKey,
7248
7248
  // Override endpoint for ElevenLabs if service is explicitly set
7249
- endpoint: S === "elevenlabs" && i.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : f.endpoint
7249
+ endpoint: S === "elevenlabs" && i.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : x.endpoint
7250
7250
  }, m = {
7251
7251
  url: "/avatars/brunette.glb",
7252
7252
  // Use brunette avatar (working glTF file)
@@ -7261,7 +7261,7 @@ const Tt = Qe(({
7261
7261
  bodyMovement: "idle",
7262
7262
  movementIntensity: 0.5,
7263
7263
  ...i
7264
- }, B = {
7264
+ }, O = {
7265
7265
  ttsEndpoint: W.endpoint,
7266
7266
  ttsApikey: W.apiKey,
7267
7267
  ttsService: S,
@@ -7270,22 +7270,22 @@ const Tt = Qe(({
7270
7270
  }, M = N(async () => {
7271
7271
  if (!(!c.current || l.current))
7272
7272
  try {
7273
- if (a(!0), h(null), l.current = new $e(c.current, B), await l.current.showAvatar(m, (V) => {
7273
+ if (a(!0), h(null), l.current = new $e(c.current, O), await l.current.showAvatar(m, (V) => {
7274
7274
  if (V.lengthComputable) {
7275
- const j = Math.min(100, Math.round(V.loaded / V.total * 100));
7276
- n(j);
7275
+ const Z = Math.min(100, Math.round(V.loaded / V.total * 100));
7276
+ n(Z);
7277
7277
  }
7278
7278
  }), l.current.morphs && l.current.morphs.length > 0) {
7279
7279
  const V = l.current.morphs[0].morphTargetDictionary;
7280
7280
  console.log("Available morph targets:", Object.keys(V));
7281
- const j = Object.keys(V).filter((Y) => Y.startsWith("viseme_"));
7282
- console.log("Viseme morph targets found:", j), j.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"));
7281
+ const Z = Object.keys(V).filter((Y) => Y.startsWith("viseme_"));
7282
+ console.log("Viseme morph targets found:", Z), Z.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"));
7283
7283
  }
7284
7284
  if (await new Promise((V) => {
7285
- const j = () => {
7286
- l.current.lipsync && Object.keys(l.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(l.current.lipsync)), V()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(j, 100));
7285
+ const Z = () => {
7286
+ l.current.lipsync && Object.keys(l.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(l.current.lipsync)), V()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(Z, 100));
7287
7287
  };
7288
- j();
7288
+ Z();
7289
7289
  }), l.current && l.current.setShowFullAvatar)
7290
7290
  try {
7291
7291
  l.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
@@ -7303,7 +7303,7 @@ const Tt = Qe(({
7303
7303
  console.error("Error initializing TalkingHead:", A), h(A.message || "Failed to initialize avatar"), a(!1), e(A);
7304
7304
  }
7305
7305
  }, []);
7306
- be(() => (M(), () => {
7306
+ ve(() => (M(), () => {
7307
7307
  l.current && (l.current.stop(), l.current.dispose(), l.current = null);
7308
7308
  }), [M]);
7309
7309
  const y = N((A) => {
@@ -7321,21 +7321,21 @@ const Tt = Qe(({
7321
7321
  l.current && (l.current.stopSpeaking(), l.current.setSlowdownRate && (l.current.setSlowdownRate(1), console.log("Reset timing to normal")));
7322
7322
  }, []), L = N((A) => {
7323
7323
  l.current && l.current.setMood(A);
7324
- }, []), x = N((A) => {
7324
+ }, []), f = N((A) => {
7325
7325
  l.current && l.current.setSlowdownRate && (l.current.setSlowdownRate(A), console.log("Timing adjustment set to:", A));
7326
7326
  }, []), T = N((A, D = !1) => {
7327
7327
  if (l.current && l.current.playAnimation) {
7328
7328
  if (l.current.setShowFullAvatar)
7329
7329
  try {
7330
7330
  l.current.setShowFullAvatar(!0);
7331
- } catch (j) {
7332
- console.warn("Error setting full body mode:", j);
7331
+ } catch (Z) {
7332
+ console.warn("Error setting full body mode:", Z);
7333
7333
  }
7334
7334
  if (A.includes("."))
7335
7335
  try {
7336
7336
  l.current.playAnimation(A, null, 10, 0, 0.01, D), console.log("Playing animation:", A);
7337
- } catch (j) {
7338
- console.log(`Failed to play ${A}:`, j);
7337
+ } catch (Z) {
7338
+ console.log(`Failed to play ${A}:`, Z);
7339
7339
  try {
7340
7340
  l.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
7341
7341
  } catch (Y) {
@@ -7343,32 +7343,32 @@ const Tt = Qe(({
7343
7343
  }
7344
7344
  }
7345
7345
  else {
7346
- const j = [".fbx", ".glb", ".gltf"];
7346
+ const Z = [".fbx", ".glb", ".gltf"];
7347
7347
  let Y = !1;
7348
- for (const ye of j)
7348
+ for (const xe of Z)
7349
7349
  try {
7350
- l.current.playAnimation(A + ye, null, 10, 0, 0.01, D), console.log("Playing animation:", A + ye), Y = !0;
7350
+ l.current.playAnimation(A + xe, null, 10, 0, 0.01, D), console.log("Playing animation:", A + xe), Y = !0;
7351
7351
  break;
7352
7352
  } catch {
7353
- console.log(`Failed to play ${A}${ye}, trying next format...`);
7353
+ console.log(`Failed to play ${A}${xe}, trying next format...`);
7354
7354
  }
7355
7355
  if (!Y) {
7356
7356
  console.warn("Animation system not available or animation not found:", A);
7357
7357
  try {
7358
7358
  l.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
7359
- } catch (ye) {
7360
- console.warn("Fallback animation also failed:", ye);
7359
+ } catch (xe) {
7360
+ console.warn("Fallback animation also failed:", xe);
7361
7361
  }
7362
7362
  }
7363
7363
  }
7364
7364
  } else
7365
7365
  console.warn("Animation system not available or animation not found:", A);
7366
7366
  }, []);
7367
- return qe(r, () => ({
7367
+ return _e(r, () => ({
7368
7368
  speakText: y,
7369
7369
  stopSpeaking: F,
7370
7370
  setMood: L,
7371
- setTimingAdjustment: x,
7371
+ setTimingAdjustment: f,
7372
7372
  playAnimation: T,
7373
7373
  isReady: g,
7374
7374
  talkingHead: l.current,
@@ -7429,8 +7429,8 @@ const Tt = Qe(({
7429
7429
  console.warn("Error unlocking avatar position:", A);
7430
7430
  }
7431
7431
  }
7432
- })), /* @__PURE__ */ Ce("div", { className: `talking-head-container ${o}`, style: s, children: [
7433
- /* @__PURE__ */ te(
7432
+ })), /* @__PURE__ */ ze("div", { className: `talking-head-container ${o}`, style: s, children: [
7433
+ /* @__PURE__ */ ee(
7434
7434
  "div",
7435
7435
  {
7436
7436
  ref: c,
@@ -7442,7 +7442,7 @@ const Tt = Qe(({
7442
7442
  }
7443
7443
  }
7444
7444
  ),
7445
- u && /* @__PURE__ */ te("div", { className: "loading-overlay", style: {
7445
+ u && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7446
7446
  position: "absolute",
7447
7447
  top: "50%",
7448
7448
  left: "50%",
@@ -7451,7 +7451,7 @@ const Tt = Qe(({
7451
7451
  fontSize: "18px",
7452
7452
  zIndex: 10
7453
7453
  }, children: "Loading avatar..." }),
7454
- d && /* @__PURE__ */ te("div", { className: "error-overlay", style: {
7454
+ d && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7455
7455
  position: "absolute",
7456
7456
  top: "50%",
7457
7457
  left: "50%",
@@ -7465,8 +7465,8 @@ const Tt = Qe(({
7465
7465
  }, children: d })
7466
7466
  ] });
7467
7467
  });
7468
- Tt.displayName = "TalkingHeadComponent";
7469
- async function Ue(G) {
7468
+ Mt.displayName = "TalkingHeadComponent";
7469
+ async function Ve(G) {
7470
7470
  try {
7471
7471
  const n = await fetch(G);
7472
7472
  if (!n.ok) {
@@ -7483,7 +7483,7 @@ async function Ue(G) {
7483
7483
  return n instanceof SyntaxError || console.warn("⚠️ Could not load animation manifest (this is optional):", G), {};
7484
7484
  }
7485
7485
  }
7486
- async function Mt(G, n = "F") {
7486
+ async function Ft(G, n = "F") {
7487
7487
  const e = [], t = G.replace(/\/$/, "");
7488
7488
  try {
7489
7489
  const i = [
@@ -7527,18 +7527,18 @@ async function Mt(G, n = "F") {
7527
7527
  }
7528
7528
  return e.length > 0, e;
7529
7529
  }
7530
- async function ot(G, n = "F") {
7530
+ async function st(G, n = "F") {
7531
7531
  const e = {};
7532
7532
  for (const [t, o] of Object.entries(G))
7533
7533
  try {
7534
- const s = await Mt(o, n);
7534
+ const s = await Ft(o, n);
7535
7535
  s.length > 0 && (e[t] = s);
7536
7536
  } catch (s) {
7537
7537
  console.error(`❌ Failed to auto-load animations from ${o}:`, s);
7538
7538
  }
7539
7539
  return e;
7540
7540
  }
7541
- const Ft = Qe(({
7541
+ const Et = qe(({
7542
7542
  text: G = null,
7543
7543
  avatarUrl: n = "/avatars/brunette.glb",
7544
7544
  avatarBody: e = "F",
@@ -7559,22 +7559,22 @@ const Ft = Qe(({
7559
7559
  },
7560
7560
  onSpeechStart: R = () => {
7561
7561
  },
7562
- onSpeechEnd: f = () => {
7562
+ onSpeechEnd: x = () => {
7563
7563
  },
7564
7564
  className: S = "",
7565
7565
  style: W = {},
7566
7566
  animations: m = {},
7567
- autoAnimationGroup: B = null,
7567
+ autoAnimationGroup: O = null,
7568
7568
  // e.g., "talking" - will randomly select from this group when speaking
7569
7569
  autoIdleGroup: M = null,
7570
7570
  // e.g., "idle" - will randomly select from this group when idle
7571
7571
  autoSpeak: y = !1
7572
7572
  }, F) => {
7573
- const L = U(null), x = U(null), T = U(u), A = U(null), D = U(null), V = U(!1), j = U({ remainingText: null, originalText: null, options: null }), Y = U([]), [ye, ae] = ue(!0), [ke, he] = ue(null), [ge, oe] = ue(!1), [v, I] = ue(!1), [H, E] = ue(m), Z = U(null), se = U(!1), ne = U(null), $ = U([]), Re = U([]), We = U(0), Me = U(null);
7574
- be(() => {
7573
+ const L = U(null), f = U(null), T = U(u), A = U(null), D = U(null), V = U(!1), Z = U({ remainingText: null, originalText: null, options: null }), Y = U([]), [xe, le] = he(!0), [Ce, de] = he(null), [ye, se] = he(!1), [v, I] = he(!1), [H, E] = he(m), X = U(null), ie = U(!1), te = U(null), J = U([]), be = U([]), Ge = U(0), Ee = U(null);
7574
+ ve(() => {
7575
7575
  V.current = v;
7576
7576
  }, [v]);
7577
- const Be = N((k) => {
7577
+ const Ne = N((k) => {
7578
7578
  let C = "F";
7579
7579
  if (k) {
7580
7580
  const P = k.toString().toUpperCase().trim();
@@ -7582,64 +7582,64 @@ const Ft = Qe(({
7582
7582
  }
7583
7583
  return C === "M" ? "male" : "female";
7584
7584
  }, []);
7585
- be(() => {
7585
+ ve(() => {
7586
7586
  (async () => {
7587
7587
  if (m.manifest && m.auto)
7588
7588
  try {
7589
- const C = await Ue(m.manifest);
7589
+ const C = await Ve(m.manifest);
7590
7590
  E(C);
7591
7591
  return;
7592
7592
  } catch {
7593
7593
  }
7594
7594
  if (m.manifest && !m.auto) {
7595
- const C = await Ue(m.manifest), P = Object.keys(C).length > 0;
7595
+ const C = await Ve(m.manifest), P = Object.keys(C).length > 0;
7596
7596
  E(P ? C : m);
7597
7597
  } else if (m.auto)
7598
7598
  try {
7599
7599
  let C = null;
7600
7600
  if (m.manifest)
7601
7601
  try {
7602
- C = await Ue(m.manifest);
7602
+ C = await Ve(m.manifest);
7603
7603
  } catch {
7604
7604
  }
7605
7605
  if (typeof m.auto == "string") {
7606
7606
  const P = m.auto, _ = {
7607
7607
  talking: `${P}/talking`,
7608
7608
  idle: `${P}/idle`
7609
- }, ee = Be(e);
7610
- _[`${ee}_talking`] = `${P}/${ee}/talking`, _[`${ee}_idle`] = `${P}/${ee}/idle`, _.shared_talking = `${P}/shared/talking`, _.shared_idle = `${P}/shared/idle`;
7611
- const fe = await ot(_, e);
7612
- if (!Object.values(fe).some((q) => Array.isArray(q) && q.length > 0) && C) {
7609
+ }, q = Ne(e);
7610
+ _[`${q}_talking`] = `${P}/${q}/talking`, _[`${q}_idle`] = `${P}/${q}/idle`, _.shared_talking = `${P}/shared/talking`, _.shared_idle = `${P}/shared/idle`;
7611
+ const ae = await st(_, e);
7612
+ if (!Object.values(ae).some((ne) => Array.isArray(ne) && ne.length > 0) && C) {
7613
7613
  E(C);
7614
7614
  return;
7615
7615
  }
7616
- const de = {
7616
+ const me = {
7617
7617
  _genderSpecific: {
7618
- [ee]: {},
7618
+ [q]: {},
7619
7619
  shared: {}
7620
7620
  }
7621
7621
  };
7622
- Object.entries(fe).forEach(([q, ce]) => {
7623
- if (q.includes("_")) {
7624
- const [we, ...Ge] = q.split("_"), Ne = Ge.join("_");
7625
- we === "shared" ? (de._genderSpecific.shared[Ne] || (de._genderSpecific.shared[Ne] = []), de._genderSpecific.shared[Ne].push(...ce)) : we === ee && (de._genderSpecific[ee][Ne] || (de._genderSpecific[ee][Ne] = []), de._genderSpecific[ee][Ne].push(...ce));
7622
+ Object.entries(ae).forEach(([ne, we]) => {
7623
+ if (ne.includes("_")) {
7624
+ const [ce, ...Te] = ne.split("_"), Ae = Te.join("_");
7625
+ ce === "shared" ? (me._genderSpecific.shared[Ae] || (me._genderSpecific.shared[Ae] = []), me._genderSpecific.shared[Ae].push(...we)) : ce === q && (me._genderSpecific[q][Ae] || (me._genderSpecific[q][Ae] = []), me._genderSpecific[q][Ae].push(...we));
7626
7626
  } else
7627
- de[q] = ce;
7628
- }), C && (C._genderSpecific && Object.keys(C._genderSpecific).forEach((q) => {
7629
- de._genderSpecific[q] || (de._genderSpecific[q] = {}), Object.entries(C._genderSpecific[q]).forEach(([ce, we]) => {
7630
- de._genderSpecific[q][ce] || (de._genderSpecific[q][ce] = we);
7627
+ me[ne] = we;
7628
+ }), C && (C._genderSpecific && Object.keys(C._genderSpecific).forEach((ne) => {
7629
+ me._genderSpecific[ne] || (me._genderSpecific[ne] = {}), Object.entries(C._genderSpecific[ne]).forEach(([we, ce]) => {
7630
+ me._genderSpecific[ne][we] || (me._genderSpecific[ne][we] = ce);
7631
7631
  });
7632
- }), Object.entries(C).forEach(([q, ce]) => {
7633
- q !== "_genderSpecific" && !de[q] && (de[q] = ce);
7634
- })), E(de);
7632
+ }), Object.entries(C).forEach(([ne, we]) => {
7633
+ ne !== "_genderSpecific" && !me[ne] && (me[ne] = we);
7634
+ })), E(me);
7635
7635
  } else if (typeof m.auto == "object") {
7636
- const P = await ot(m.auto, e), _ = Object.values(P).some((ee) => Array.isArray(ee) && ee.length > 0);
7636
+ const P = await st(m.auto, e), _ = Object.values(P).some((q) => Array.isArray(q) && q.length > 0);
7637
7637
  E(!_ && C ? C : P);
7638
7638
  }
7639
7639
  } catch (C) {
7640
7640
  if (console.error("Failed to auto-discover animations:", C), m.manifest)
7641
7641
  try {
7642
- const P = await Ue(m.manifest);
7642
+ const P = await Ve(m.manifest);
7643
7643
  E(P);
7644
7644
  } catch {
7645
7645
  E(m);
@@ -7650,28 +7650,28 @@ const Ft = Qe(({
7650
7650
  else
7651
7651
  E(m);
7652
7652
  })();
7653
- }, [m, e, Be]), be(() => {
7653
+ }, [m, e, Ne]), ve(() => {
7654
7654
  T.current = u;
7655
7655
  }, [u]);
7656
- const w = _e(), X = s || w.service;
7656
+ const w = Ke(), j = s || w.service;
7657
7657
  let Q;
7658
- X === "browser" ? Q = {
7658
+ j === "browser" ? Q = {
7659
7659
  service: "browser",
7660
7660
  endpoint: "",
7661
7661
  apiKey: null,
7662
7662
  defaultVoice: "Google US English"
7663
- } : X === "elevenlabs" ? Q = {
7663
+ } : j === "elevenlabs" ? Q = {
7664
7664
  service: "elevenlabs",
7665
7665
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
7666
7666
  apiKey: r || w.apiKey,
7667
- defaultVoice: i || w.defaultVoice || Oe.defaultVoice,
7668
- voices: w.voices || Oe.voices
7669
- } : X === "deepgram" ? Q = {
7667
+ defaultVoice: i || w.defaultVoice || De.defaultVoice,
7668
+ voices: w.voices || De.voices
7669
+ } : j === "deepgram" ? Q = {
7670
7670
  service: "deepgram",
7671
7671
  endpoint: "https://api.deepgram.com/v1/speak",
7672
7672
  apiKey: r || w.apiKey,
7673
- defaultVoice: i || w.defaultVoice || Ye.defaultVoice,
7674
- voices: w.voices || Ye.voices
7673
+ defaultVoice: i || w.defaultVoice || Qe.defaultVoice,
7674
+ voices: w.voices || Qe.voices
7675
7675
  } : Q = {
7676
7676
  ...w,
7677
7677
  apiKey: r !== null ? r : w.apiKey
@@ -7680,223 +7680,232 @@ const Ft = Qe(({
7680
7680
  url: n,
7681
7681
  body: e,
7682
7682
  avatarMood: t,
7683
- ttsLang: X === "browser" ? "en-US" : o,
7683
+ ttsLang: j === "browser" ? "en-US" : o,
7684
7684
  ttsVoice: i || Q.defaultVoice,
7685
7685
  lipsyncLang: "en",
7686
7686
  showFullAvatar: u,
7687
7687
  bodyMovement: c,
7688
7688
  movementIntensity: l
7689
- }, Le = {
7689
+ }, Se = {
7690
7690
  ttsEndpoint: Q.endpoint,
7691
7691
  ttsApikey: Q.apiKey,
7692
- ttsService: X,
7692
+ ttsService: j,
7693
7693
  lipsyncModules: ["en"],
7694
7694
  cameraView: a
7695
- }, J = N(async () => {
7696
- if (!(!L.current || x.current))
7695
+ }, $ = N(async () => {
7696
+ if (!(!L.current || f.current))
7697
7697
  try {
7698
- ae(!0), he(null), x.current = new $e(L.current, Le), await x.current.showAvatar(re, (C) => {
7698
+ le(!0), de(null), f.current = new $e(L.current, Se), await f.current.showAvatar(re, (C) => {
7699
7699
  if (C.lengthComputable) {
7700
7700
  const P = Math.min(100, Math.round(C.loaded / C.total * 100));
7701
7701
  h(P);
7702
7702
  }
7703
- }), ae(!1), oe(!0), d(x.current);
7703
+ }), le(!1), se(!0), d(f.current);
7704
7704
  const k = () => {
7705
- document.visibilityState === "visible" ? x.current?.start() : x.current?.stop();
7705
+ document.visibilityState === "visible" ? f.current?.start() : f.current?.stop();
7706
7706
  };
7707
7707
  return document.addEventListener("visibilitychange", k), () => {
7708
7708
  document.removeEventListener("visibilitychange", k);
7709
7709
  };
7710
7710
  } catch (k) {
7711
- console.error("Error initializing TalkingHead:", k), he(k.message || "Failed to initialize avatar"), ae(!1), g(k);
7711
+ console.error("Error initializing TalkingHead:", k), de(k.message || "Failed to initialize avatar"), le(!1), g(k);
7712
7712
  }
7713
7713
  }, []);
7714
- be(() => (J(), () => {
7715
- x.current && (x.current.stop(), x.current.dispose(), x.current = null);
7716
- }), [J]);
7717
- const le = N(async () => {
7718
- if (x.current)
7714
+ ve(() => ($(), () => {
7715
+ f.current && (f.current.stop(), f.current.dispose(), f.current = null);
7716
+ }), [$]);
7717
+ const ue = N(async () => {
7718
+ if (f.current)
7719
7719
  try {
7720
- const k = x.current.audioCtx || x.current.audioContext;
7720
+ const k = f.current.audioCtx || f.current.audioContext;
7721
7721
  k && (k.state === "suspended" || k.state === "interrupted") && await k.resume();
7722
7722
  } catch (k) {
7723
7723
  console.warn("Failed to resume audio context:", k);
7724
7724
  }
7725
- }, []), Ee = N((k) => {
7725
+ }, []), Oe = N((k) => {
7726
7726
  if (!H)
7727
7727
  return [];
7728
7728
  let C = null;
7729
7729
  if (H._genderSpecific) {
7730
- const P = Be(e), _ = H._genderSpecific[P];
7730
+ const P = Ne(e), _ = H._genderSpecific[P];
7731
7731
  _ && _[k] ? C = _[k] : H._genderSpecific.shared && H._genderSpecific.shared[k] && (C = H._genderSpecific.shared[k]);
7732
7732
  }
7733
7733
  return !C && H[k] && (C = H[k]), C ? Array.isArray(C) ? [...C] : typeof C == "string" ? [C] : [] : ((Object.keys(H).length > 0 || H._genderSpecific && Object.keys(H._genderSpecific).length > 0) && console.warn(`⚠️ No animations found for group "${k}". Make sure animations are configured correctly.`), []);
7734
- }, [H, e, Be]), ze = N((k) => {
7734
+ }, [H, e, Ne]), He = N((k) => {
7735
7735
  const C = [...k];
7736
7736
  for (let P = C.length - 1; P > 0; P--) {
7737
7737
  const _ = Math.floor(Math.random() * (P + 1));
7738
7738
  [C[P], C[_]] = [C[_], C[P]];
7739
7739
  }
7740
7740
  return C;
7741
- }, []), Se = N((k) => {
7742
- if (Re.current.length === 0) {
7743
- const P = Ee(k);
7741
+ }, []), ke = N((k) => {
7742
+ if (be.current.length === 0) {
7743
+ const P = Oe(k);
7744
7744
  if (P.length === 0)
7745
7745
  return null;
7746
- Re.current = ze(P), $.current = [];
7746
+ be.current = He(P), J.current = [];
7747
7747
  }
7748
- const C = Re.current.shift();
7749
- return C && $.current.push(C), C;
7750
- }, [Ee, ze]), ve = N((k) => k ? k.split("/").pop().replace(".fbx", "").replace(/[-_]/g, " ") : "Unknown", []), Ie = N((k, C = !1, P = null) => {
7751
- if (!x.current)
7748
+ const C = be.current.shift();
7749
+ return C && J.current.push(C), C;
7750
+ }, [Oe, He]), Ie = N((k) => k ? k.split("/").pop().replace(".fbx", "").replace(/[-_]/g, " ") : "Unknown", []), fe = N((k, C = !1, P = null) => {
7751
+ if (!f.current)
7752
7752
  return null;
7753
- const _ = Se(k);
7753
+ const _ = ke(k);
7754
7754
  if (_)
7755
7755
  try {
7756
- const ee = ve(_);
7757
- console.log(`🎬 Playing animation: "${ee}"`);
7758
- const fe = () => {
7759
- se.current && ne.current === k && x.current && (x.current.isSpeaking || x.current.audioPlaylist && x.current.audioPlaylist.length > 0 || x.current.speechQueue && x.current.speechQueue.length > 0) ? setTimeout(() => {
7760
- Ie(k, C, P);
7761
- }, 100) : (se.current = !1, ne.current = null, P && P());
7756
+ const q = Ie(_);
7757
+ console.log(`🎬 Playing animation: "${q}"`);
7758
+ const ae = () => {
7759
+ ie.current && te.current === k && f.current && (f.current.isSpeaking || f.current.audioPlaylist && f.current.audioPlaylist.length > 0 || f.current.speechQueue && f.current.speechQueue.length > 0) ? setTimeout(() => {
7760
+ fe(k, C, P);
7761
+ }, 100) : (ie.current = !1, te.current = null, P && P());
7762
7762
  };
7763
- return x.current.playAnimation(_, null, 0, 0, 0.01, C, fe), _;
7764
- } catch (ee) {
7765
- return console.error("Failed to play animation:", ee), null;
7763
+ return f.current.playAnimation(_, null, 0, 0, 0.01, C, ae), _;
7764
+ } catch (q) {
7765
+ return console.error("Failed to play animation:", q), null;
7766
7766
  }
7767
7767
  else
7768
- se.current && ne.current === k && x.current && (x.current.isSpeaking || x.current.audioPlaylist && x.current.audioPlaylist.length > 0 || x.current.speechQueue && x.current.speechQueue.length > 0) && (Re.current = [], $.current = [], setTimeout(() => {
7769
- Ie(k, C, P);
7768
+ ie.current && te.current === k && f.current && (f.current.isSpeaking || f.current.audioPlaylist && f.current.audioPlaylist.length > 0 || f.current.speechQueue && f.current.speechQueue.length > 0) && (be.current = [], J.current = [], setTimeout(() => {
7769
+ fe(k, C, P);
7770
7770
  }, 100));
7771
7771
  return null;
7772
- }, [Se, ve]), De = N(async (k, C = {}) => {
7773
- if (!x.current || !ge || !k || k.trim() === "")
7772
+ }, [ke, Ie]), Ue = N(async (k, C = {}) => {
7773
+ if (!f.current || !ye || !k || k.trim() === "")
7774
7774
  return;
7775
- await le();
7776
- const P = C.animationGroup || B;
7777
- P && !C.skipAnimation && (se.current = !0, ne.current = P, Re.current = [], $.current = [], Ie(P));
7775
+ await ue();
7776
+ const P = C.animationGroup || O;
7777
+ P && !C.skipAnimation && (ie.current = !0, te.current = P, be.current = [], J.current = [], fe(P));
7778
7778
  try {
7779
7779
  R(k), C.onSpeechStart && C.onSpeechStart(k);
7780
- } catch (fe) {
7781
- console.warn("Error in onSpeechStart callback:", fe);
7780
+ } catch (ae) {
7781
+ console.warn("Error in onSpeechStart callback:", ae);
7782
7782
  }
7783
- j.current = { remainingText: null, originalText: null, options: null }, Y.current = [], A.current = { text: k, options: C }, D.current && (clearInterval(D.current), D.current = null), I(!1), V.current = !1;
7784
- const _ = k.split(/[.!?]+/).filter((fe) => fe.trim().length > 0);
7785
- Y.current = _, We.current = 0;
7786
- const ee = {
7783
+ Z.current = { remainingText: null, originalText: null, options: null }, Y.current = [], A.current = { text: k, options: C }, D.current && (clearInterval(D.current), D.current = null), I(!1), V.current = !1;
7784
+ const _ = k.split(/[.!?]+/).filter((ae) => ae.trim().length > 0);
7785
+ Y.current = _, Ge.current = 0;
7786
+ const q = {
7787
7787
  lipsyncLang: C.lipsyncLang || "en",
7788
7788
  onSpeechEnd: () => {
7789
- D.current && (clearInterval(D.current), D.current = null), se.current = !1, ne.current = null, Re.current = [], $.current = [], C.onSpeechEnd && C.onSpeechEnd(), f();
7789
+ D.current && (clearInterval(D.current), D.current = null), ie.current = !1, te.current = null, be.current = [], J.current = [], C.onSpeechEnd && C.onSpeechEnd(), x();
7790
7790
  }
7791
7791
  };
7792
7792
  try {
7793
- x.current.speakText(k, ee);
7794
- } catch (fe) {
7795
- console.error("Error speaking text:", fe), he(fe.message || "Failed to speak text");
7793
+ f.current.speakText(k, q);
7794
+ } catch (ae) {
7795
+ console.error("Error speaking text:", ae), de(ae.message || "Failed to speak text");
7796
7796
  }
7797
- }, [ge, f, le, B, Ie]);
7798
- be(() => {
7799
- if (!ge || !M || !x.current)
7797
+ }, [ye, x, ue, O, fe]);
7798
+ ve(() => {
7799
+ if (!ye || !M || !f.current)
7800
7800
  return;
7801
- Z.current && clearInterval(Z.current);
7801
+ X.current && clearInterval(X.current);
7802
7802
  const k = () => {
7803
- x.current && !V.current && Ie(M);
7803
+ f.current && !V.current && fe(M);
7804
7804
  };
7805
- return k(), Z.current = setInterval(() => {
7805
+ return k(), X.current = setInterval(() => {
7806
7806
  k();
7807
7807
  }, 12e3 + Math.random() * 3e3), () => {
7808
- Z.current && (clearInterval(Z.current), Z.current = null);
7808
+ X.current && (clearInterval(X.current), X.current = null);
7809
7809
  };
7810
- }, [ge, M, Ie]), be(() => {
7811
- ge && G && y && x.current && De(G);
7812
- }, [ge, G, y, De]);
7813
- const Ve = N(() => {
7814
- if (x.current)
7810
+ }, [ye, M, fe]), ve(() => {
7811
+ ye && G && y && f.current && Ue(G);
7812
+ }, [ye, G, y, Ue]);
7813
+ const Ze = N(() => {
7814
+ if (f.current)
7815
7815
  try {
7816
- const k = x.current.isSpeaking || !1, C = [...x.current.audioPlaylist || []], P = [...x.current.speechQueue || []];
7816
+ const k = f.current.isSpeaking || !1, C = [...f.current.audioPlaylist || []], P = [...f.current.speechQueue || []];
7817
7817
  if (k || C.length > 0 || P.length > 0) {
7818
7818
  D.current && (clearInterval(D.current), D.current = null);
7819
7819
  const _ = Y.current;
7820
- let ee = [];
7821
- const fe = x.current.isAudioPlaying || !1;
7820
+ let q = [];
7821
+ const ae = f.current.isAudioPlaying || !1;
7822
7822
  if (_.length > 0) {
7823
- const q = C.length + P.length, ce = fe ? 1 : 0, we = _.length - q - ce, Ge = fe ? we : we + ce;
7824
- Ge < _.length && (ee = _.slice(Ge));
7823
+ const ce = C.length + P.length, Te = ae ? 1 : 0, Ae = _.length - ce - Te, et = ae ? Ae : Ae + Te;
7824
+ et < _.length && (q = _.slice(et));
7825
7825
  } else
7826
- C.length > 0 && C.forEach((q) => {
7827
- if (q.text)
7828
- if (Array.isArray(q.text)) {
7829
- const ce = q.text.map((we) => we.word).join(" ");
7830
- ce.trim() && ee.push(ce);
7831
- } else q.text.trim() && ee.push(q.text);
7832
- }), P.length > 0 && P.forEach((q) => {
7833
- if (q.text)
7834
- if (Array.isArray(q.text)) {
7835
- const ce = q.text.map((we) => we.word).join(" ");
7836
- ce.trim() && ee.push(ce);
7837
- } else q.text.trim() && ee.push(q.text);
7826
+ C.length > 0 && C.forEach((ce) => {
7827
+ if (ce.text)
7828
+ if (Array.isArray(ce.text)) {
7829
+ const Te = ce.text.map((Ae) => Ae.word).join(" ");
7830
+ Te.trim() && q.push(Te);
7831
+ } else ce.text.trim() && q.push(ce.text);
7832
+ }), P.length > 0 && P.forEach((ce) => {
7833
+ if (ce.text)
7834
+ if (Array.isArray(ce.text)) {
7835
+ const Te = ce.text.map((Ae) => Ae.word).join(" ");
7836
+ Te.trim() && q.push(Te);
7837
+ } else ce.text.trim() && q.push(ce.text);
7838
7838
  });
7839
- const Je = ee.join(" ");
7840
- j.current = {
7841
- remainingText: Je || null,
7839
+ const We = q.join(" ");
7840
+ Z.current = {
7841
+ remainingText: We || null,
7842
7842
  originalText: A.current?.text || null,
7843
7843
  options: A.current?.options || null,
7844
7844
  // Track if we're pausing mid-sentence (has currently playing audio)
7845
7845
  isMidSentence: C.length > 0
7846
- }, x.current.speechQueue.length = 0;
7847
- const de = x.current.pauseSpeaking();
7848
- Me.current = de, I(!0), V.current = !0;
7846
+ };
7847
+ const ne = f.current.isAudioPlaying || !1 ? [...f.current.speechQueue || []] : null, we = f.current.pauseSpeaking();
7848
+ we && we.audio && ne ? (f.current.speechQueue.length = 0, f.current.speechQueue.push(...ne)) : f.current.speechQueue.length = 0, Ee.current = we, I(!0), V.current = !0;
7849
7849
  }
7850
7850
  } catch (k) {
7851
7851
  console.warn("Error pausing speech:", k);
7852
7852
  }
7853
- }, []), Ke = N(async () => {
7854
- if (!(!x.current || !v))
7853
+ }, []), Je = N(async () => {
7854
+ if (!(!f.current || !v))
7855
7855
  try {
7856
- if (await le(), I(!1), V.current = !1, Me.current && Me.current.audio) {
7857
- await x.current.playAudio(!1, Me.current), Me.current = null;
7856
+ if (await ue(), I(!1), V.current = !1, Ee.current && Ee.current.audio) {
7857
+ ie.current = !0;
7858
+ const q = Z.current?.options || A.current?.options || {}, ae = q.animationGroup || O;
7859
+ ae && (te.current = ae);
7860
+ const We = Z.current?.remainingText;
7861
+ We && f.current.speechQueue && We.split(/[.!?]+/).filter((ne) => ne.trim().length > 0).forEach((ne) => {
7862
+ f.current.speechQueue.push({
7863
+ text: ne.trim(),
7864
+ options: q
7865
+ });
7866
+ }), f.current.isSpeaking = !0, await f.current.playAudio(!1, Ee.current), ae && !q.skipAnimation && (be.current = [], J.current = [], fe(ae)), Ee.current = null;
7858
7867
  return;
7859
7868
  }
7860
- const k = j.current?.remainingText, C = j.current?.originalText || A.current?.text, P = j.current?.options || A.current?.options || {}, _ = k || C;
7861
- _ && De(_, P), Me.current = null;
7869
+ const k = Z.current?.remainingText, C = Z.current?.originalText || A.current?.text, P = Z.current?.options || A.current?.options || {}, _ = k || C;
7870
+ _ && Ue(_, P), Ee.current = null;
7862
7871
  } catch (k) {
7863
- console.warn("Error resuming speech:", k), I(!1), V.current = !1, Me.current = null;
7872
+ console.warn("Error resuming speech:", k), I(!1), V.current = !1, Ee.current = null;
7864
7873
  }
7865
- }, [v, De, le]), at = N(() => {
7866
- if (x.current) {
7867
- x.current.stopSpeaking(), D.current && (clearInterval(D.current), D.current = null), se.current = !1, ne.current = null, Re.current = [], $.current = [], I(!1), V.current = !1;
7874
+ }, [v, Ue, ue, O, fe]), lt = N(() => {
7875
+ if (f.current) {
7876
+ f.current.stopSpeaking(), D.current && (clearInterval(D.current), D.current = null), ie.current = !1, te.current = null, be.current = [], J.current = [], I(!1), V.current = !1;
7868
7877
  try {
7869
- f();
7878
+ x();
7870
7879
  } catch (k) {
7871
7880
  console.warn("Error in onSpeechEnd callback (stopSpeaking):", k);
7872
7881
  }
7873
7882
  }
7874
- }, [f]);
7875
- return qe(F, () => ({
7876
- speakText: De,
7877
- pauseSpeaking: Ve,
7878
- resumeSpeaking: Ke,
7879
- stopSpeaking: at,
7880
- resumeAudioContext: le,
7883
+ }, [x]);
7884
+ return _e(F, () => ({
7885
+ speakText: Ue,
7886
+ pauseSpeaking: Ze,
7887
+ resumeSpeaking: Je,
7888
+ stopSpeaking: lt,
7889
+ resumeAudioContext: ue,
7881
7890
  isPaused: () => v,
7882
- setMood: (k) => x.current?.setMood(k),
7891
+ setMood: (k) => f.current?.setMood(k),
7883
7892
  setBodyMovement: (k) => {
7884
- x.current && x.current.setBodyMovement(k);
7893
+ f.current && f.current.setBodyMovement(k);
7885
7894
  },
7886
7895
  playAnimation: (k, C = !1) => {
7887
- x.current && x.current.playAnimation && x.current.playAnimation(k, null, 10, 0, 0.01, C);
7896
+ f.current && f.current.playAnimation && f.current.playAnimation(k, null, 10, 0, 0.01, C);
7888
7897
  },
7889
- playRandomAnimation: (k, C = !1) => Ie(k, C),
7898
+ playRandomAnimation: (k, C = !1) => fe(k, C),
7890
7899
  getRandomAnimation: (k) => getRandomAnimation(k),
7891
- playReaction: (k) => x.current?.playReaction(k),
7892
- playCelebration: () => x.current?.playCelebration(),
7900
+ playReaction: (k) => f.current?.playReaction(k),
7901
+ playCelebration: () => f.current?.playCelebration(),
7893
7902
  setShowFullAvatar: (k) => {
7894
- x.current && (T.current = k, x.current.setShowFullAvatar(k));
7903
+ f.current && (T.current = k, f.current.setShowFullAvatar(k));
7895
7904
  },
7896
- isReady: ge,
7897
- talkingHead: x.current
7898
- })), /* @__PURE__ */ Ce("div", { className: `simple-talking-avatar-container ${S}`, style: W, children: [
7899
- /* @__PURE__ */ te(
7905
+ isReady: ye,
7906
+ talkingHead: f.current
7907
+ })), /* @__PURE__ */ ze("div", { className: `simple-talking-avatar-container ${S}`, style: W, children: [
7908
+ /* @__PURE__ */ ee(
7900
7909
  "div",
7901
7910
  {
7902
7911
  ref: L,
@@ -7908,7 +7917,7 @@ const Ft = Qe(({
7908
7917
  }
7909
7918
  }
7910
7919
  ),
7911
- ye && /* @__PURE__ */ te("div", { className: "loading-overlay", style: {
7920
+ xe && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7912
7921
  position: "absolute",
7913
7922
  top: "50%",
7914
7923
  left: "50%",
@@ -7917,7 +7926,7 @@ const Ft = Qe(({
7917
7926
  fontSize: "18px",
7918
7927
  zIndex: 10
7919
7928
  }, children: "Loading avatar..." }),
7920
- ke && /* @__PURE__ */ te("div", { className: "error-overlay", style: {
7929
+ Ce && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7921
7930
  position: "absolute",
7922
7931
  top: "50%",
7923
7932
  left: "50%",
@@ -7928,11 +7937,11 @@ const Ft = Qe(({
7928
7937
  zIndex: 10,
7929
7938
  padding: "20px",
7930
7939
  borderRadius: "8px"
7931
- }, children: ke })
7940
+ }, children: Ce })
7932
7941
  ] });
7933
7942
  });
7934
- Ft.displayName = "SimpleTalkingAvatar";
7935
- const Et = Qe(({
7943
+ Et.displayName = "SimpleTalkingAvatar";
7944
+ const Pt = qe(({
7936
7945
  curriculumData: G = null,
7937
7946
  avatarConfig: n = {},
7938
7947
  animations: e = {},
@@ -7964,7 +7973,7 @@ const Et = Qe(({
7964
7973
  onQuestionAnswer: s,
7965
7974
  onCurriculumComplete: i,
7966
7975
  onCustomAction: r
7967
- }), h = U(null), g = U(null), R = U(null), f = U(null), S = U(null), W = U(null), m = U(null), B = U(G?.curriculum || {
7976
+ }), h = U(null), g = U(null), R = U(null), x = U(null), S = U(null), W = U(null), m = U(null), O = U(G?.curriculum || {
7968
7977
  title: "Default Curriculum",
7969
7978
  description: "No curriculum data provided",
7970
7979
  language: "en",
@@ -7983,7 +7992,7 @@ const Et = Qe(({
7983
7992
  animations: e,
7984
7993
  lipsyncLang: "en"
7985
7994
  });
7986
- be(() => {
7995
+ ve(() => {
7987
7996
  d.current = {
7988
7997
  onLessonStart: t,
7989
7998
  onLessonComplete: o,
@@ -7991,8 +8000,8 @@ const Et = Qe(({
7991
8000
  onCurriculumComplete: i,
7992
8001
  onCustomAction: r
7993
8002
  };
7994
- }, [t, o, s, i, r]), be(() => {
7995
- B.current = G?.curriculum || {
8003
+ }, [t, o, s, i, r]), ve(() => {
8004
+ O.current = G?.curriculum || {
7996
8005
  title: "Default Curriculum",
7997
8006
  description: "No curriculum data provided",
7998
8007
  language: "en",
@@ -8012,7 +8021,7 @@ const Et = Qe(({
8012
8021
  lipsyncLang: "en"
8013
8022
  };
8014
8023
  }, [G, n, e]);
8015
- const y = N(() => (B.current || { modules: [] }).modules[a.current.currentModuleIndex]?.lessons[a.current.currentLessonIndex], []), F = N(() => y()?.questions[a.current.currentQuestionIndex], [y]), L = N((v, I) => I.type === "multiple_choice" || I.type === "true_false" ? v === I.answer : I.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), x = N(() => {
8024
+ const y = N(() => (O.current || { modules: [] }).modules[a.current.currentModuleIndex]?.lessons[a.current.currentLessonIndex], []), F = N(() => y()?.questions[a.current.currentQuestionIndex], [y]), L = N((v, I) => I.type === "multiple_choice" || I.type === "true_false" ? v === I.answer : I.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), f = N(() => {
8016
8025
  a.current.lessonCompleted = !0, a.current.isQuestionMode = !1;
8017
8026
  const v = a.current.totalQuestions > 0 ? Math.round(a.current.score / a.current.totalQuestions * 100) : 100;
8018
8027
  let I = "Congratulations! You've completed this lesson";
@@ -8036,9 +8045,9 @@ const Et = Qe(({
8036
8045
  } catch {
8037
8046
  u.current.playCelebration();
8038
8047
  }
8039
- const H = B.current || { modules: [] }, E = H.modules[a.current.currentModuleIndex], Z = a.current.currentLessonIndex < (E?.lessons?.length || 0) - 1, se = a.current.currentModuleIndex < (H.modules?.length || 0) - 1, ne = Z || se, $ = M.current || { lipsyncLang: "en" };
8048
+ const H = O.current || { modules: [] }, E = H.modules[a.current.currentModuleIndex], X = a.current.currentLessonIndex < (E?.lessons?.length || 0) - 1, ie = a.current.currentModuleIndex < (H.modules?.length || 0) - 1, te = X || ie, J = M.current || { lipsyncLang: "en" };
8040
8049
  u.current.speakText(I, {
8041
- lipsyncLang: $.lipsyncLang,
8050
+ lipsyncLang: J.lipsyncLang,
8042
8051
  onSpeechEnd: () => {
8043
8052
  d.current.onCustomAction({
8044
8053
  type: "lessonCompleteFeedbackDone",
@@ -8047,14 +8056,14 @@ const Et = Qe(({
8047
8056
  score: a.current.score,
8048
8057
  totalQuestions: a.current.totalQuestions,
8049
8058
  percentage: v,
8050
- hasNextLesson: ne
8059
+ hasNextLesson: te
8051
8060
  });
8052
8061
  }
8053
8062
  });
8054
8063
  }
8055
8064
  }, [e.lessonComplete]), T = N(() => {
8056
8065
  a.current.curriculumCompleted = !0;
8057
- const v = B.current || { modules: [] };
8066
+ const v = O.current || { modules: [] };
8058
8067
  if (d.current.onCurriculumComplete({
8059
8068
  modules: v.modules.length,
8060
8069
  totalLessons: v.modules.reduce((I, H) => I + H.lessons.length, 0)
@@ -8086,8 +8095,8 @@ const Et = Qe(({
8086
8095
  if (u.current.setMood("happy"), e.questionStart)
8087
8096
  try {
8088
8097
  u.current.playAnimation(e.questionStart, !0);
8089
- } catch (Z) {
8090
- console.warn("Failed to play questionStart animation:", Z);
8098
+ } catch (X) {
8099
+ console.warn("Failed to play questionStart animation:", X);
8091
8100
  }
8092
8101
  const E = M.current || { lipsyncLang: "en" };
8093
8102
  I.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${I.question}`, { lipsyncLang: E.lipsyncLang }) : I.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${I.question}`, { lipsyncLang: E.lipsyncLang }) : I.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${I.question}`, { lipsyncLang: E.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${I.question}`, { lipsyncLang: E.lipsyncLang });
@@ -8124,28 +8133,28 @@ const Et = Qe(({
8124
8133
  if (u.current.setMood("happy"), u.current.setBodyMovement("idle"), e.nextQuestion)
8125
8134
  try {
8126
8135
  u.current.playAnimation(e.nextQuestion, !0);
8127
- } catch ($) {
8128
- console.warn("Failed to play nextQuestion animation:", $);
8136
+ } catch (J) {
8137
+ console.warn("Failed to play nextQuestion animation:", J);
8129
8138
  }
8130
- const E = M.current || { lipsyncLang: "en" }, se = y()?.questions?.length || 0, ne = a.current.currentQuestionIndex >= se - 1;
8139
+ const E = M.current || { lipsyncLang: "en" }, ie = y()?.questions?.length || 0, te = a.current.currentQuestionIndex >= ie - 1;
8131
8140
  if (I.type === "code_test") {
8132
- const $ = ne ? `Great! Here's your final coding challenge: ${I.question}` : `Great! Now let's move on to your next coding challenge: ${I.question}`;
8133
- u.current.speakText($, {
8141
+ const J = te ? `Great! Here's your final coding challenge: ${I.question}` : `Great! Now let's move on to your next coding challenge: ${I.question}`;
8142
+ u.current.speakText(J, {
8134
8143
  lipsyncLang: E.lipsyncLang
8135
8144
  });
8136
8145
  } else if (I.type === "multiple_choice") {
8137
- const $ = ne ? `Alright! Here's your final question: ${I.question}` : `Alright! Here's your next question: ${I.question}`;
8138
- u.current.speakText($, {
8146
+ const J = te ? `Alright! Here's your final question: ${I.question}` : `Alright! Here's your next question: ${I.question}`;
8147
+ u.current.speakText(J, {
8139
8148
  lipsyncLang: E.lipsyncLang
8140
8149
  });
8141
8150
  } else if (I.type === "true_false") {
8142
- const $ = ne ? `Now let's try this final one: ${I.question}` : `Now let's try this one: ${I.question}`;
8143
- u.current.speakText($, {
8151
+ const J = te ? `Now let's try this final one: ${I.question}` : `Now let's try this one: ${I.question}`;
8152
+ u.current.speakText(J, {
8144
8153
  lipsyncLang: E.lipsyncLang
8145
8154
  });
8146
8155
  } else {
8147
- const $ = ne ? `Here's your final question: ${I.question}` : `Here's the next question: ${I.question}`;
8148
- u.current.speakText($, {
8156
+ const J = te ? `Here's your final question: ${I.question}` : `Here's the next question: ${I.question}`;
8157
+ u.current.speakText(J, {
8149
8158
  lipsyncLang: E.lipsyncLang
8150
8159
  });
8151
8160
  }
@@ -8169,15 +8178,15 @@ const Et = Qe(({
8169
8178
  score: a.current.score
8170
8179
  });
8171
8180
  }, [e.nextQuestion, y, F]), V = N(() => {
8172
- const v = B.current || { modules: [] }, I = v.modules[a.current.currentModuleIndex];
8181
+ const v = O.current || { modules: [] }, I = v.modules[a.current.currentModuleIndex];
8173
8182
  if (a.current.currentLessonIndex < (I?.lessons?.length || 0) - 1) {
8174
8183
  a.current.currentLessonIndex += 1, a.current.currentQuestionIndex = 0, a.current.lessonCompleted = !1, a.current.isQuestionMode = !1, a.current.isTeaching = !1, a.current.score = 0, a.current.totalQuestions = 0;
8175
- const E = v.modules[a.current.currentModuleIndex], Z = a.current.currentLessonIndex < (E?.lessons?.length || 0) - 1, se = a.current.currentModuleIndex < (v.modules?.length || 0) - 1, ne = Z || se;
8184
+ const E = v.modules[a.current.currentModuleIndex], X = a.current.currentLessonIndex < (E?.lessons?.length || 0) - 1, ie = a.current.currentModuleIndex < (v.modules?.length || 0) - 1, te = X || ie;
8176
8185
  d.current.onCustomAction({
8177
8186
  type: "lessonStart",
8178
8187
  moduleIndex: a.current.currentModuleIndex,
8179
8188
  lessonIndex: a.current.currentLessonIndex,
8180
- hasNextLesson: ne
8189
+ hasNextLesson: te
8181
8190
  }), d.current.onLessonStart({
8182
8191
  moduleIndex: a.current.currentModuleIndex,
8183
8192
  lessonIndex: a.current.currentLessonIndex,
@@ -8185,12 +8194,12 @@ const Et = Qe(({
8185
8194
  }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
8186
8195
  } else if (a.current.currentModuleIndex < (v.modules?.length || 0) - 1) {
8187
8196
  a.current.currentModuleIndex += 1, a.current.currentLessonIndex = 0, a.current.currentQuestionIndex = 0, a.current.lessonCompleted = !1, a.current.isQuestionMode = !1, a.current.isTeaching = !1, a.current.score = 0, a.current.totalQuestions = 0;
8188
- const Z = v.modules[a.current.currentModuleIndex], se = a.current.currentLessonIndex < (Z?.lessons?.length || 0) - 1, ne = a.current.currentModuleIndex < (v.modules?.length || 0) - 1, $ = se || ne;
8197
+ const X = v.modules[a.current.currentModuleIndex], ie = a.current.currentLessonIndex < (X?.lessons?.length || 0) - 1, te = a.current.currentModuleIndex < (v.modules?.length || 0) - 1, J = ie || te;
8189
8198
  d.current.onCustomAction({
8190
8199
  type: "lessonStart",
8191
8200
  moduleIndex: a.current.currentModuleIndex,
8192
8201
  lessonIndex: a.current.currentLessonIndex,
8193
- hasNextLesson: $
8202
+ hasNextLesson: J
8194
8203
  }), d.current.onLessonStart({
8195
8204
  moduleIndex: a.current.currentModuleIndex,
8196
8205
  lessonIndex: a.current.currentLessonIndex,
@@ -8198,12 +8207,12 @@ const Et = Qe(({
8198
8207
  }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
8199
8208
  } else
8200
8209
  S.current && S.current();
8201
- }, []), j = N(() => {
8210
+ }, []), Z = N(() => {
8202
8211
  const v = y();
8203
8212
  let I = null;
8204
8213
  if (v?.avatar_script && v?.body) {
8205
- const H = v.avatar_script.trim(), E = v.body.trim(), Z = H.match(/[.!?]$/) ? " " : ". ";
8206
- I = `${H}${Z}${E}`;
8214
+ const H = v.avatar_script.trim(), E = v.body.trim(), X = H.match(/[.!?]$/) ? " " : ". ";
8215
+ I = `${H}${X}${E}`;
8207
8216
  } else
8208
8217
  I = v?.avatar_script || v?.body || null;
8209
8218
  if (u.current && u.current.isReady && I) {
@@ -8212,8 +8221,8 @@ const Et = Qe(({
8212
8221
  if (e.teaching)
8213
8222
  try {
8214
8223
  u.current.playAnimation(e.teaching, !0), H = !0;
8215
- } catch (Z) {
8216
- console.warn("Failed to play teaching animation:", Z);
8224
+ } catch (X) {
8225
+ console.warn("Failed to play teaching animation:", X);
8217
8226
  }
8218
8227
  H || u.current.setBodyMovement("gesturing");
8219
8228
  const E = M.current || { lipsyncLang: "en" };
@@ -8263,13 +8272,13 @@ const Et = Qe(({
8263
8272
  u.current.setBodyMovement("happy");
8264
8273
  }
8265
8274
  u.current.setBodyMovement("gesturing");
8266
- const Z = y()?.questions?.length || 0;
8267
- a.current.currentQuestionIndex >= Z - 1;
8268
- const se = a.current.currentQuestionIndex < Z - 1;
8269
- console.log("[CurriculumLearning] Answer feedback - questionIndex:", a.current.currentQuestionIndex, "totalQuestions:", Z, "hasNextQuestion:", se);
8270
- const ne = I.type === "code_test" ? `Great job! Your code passed all the tests! ${I.explanation || ""}` : `Excellent! That's correct! ${I.explanation || ""}`, $ = M.current || { lipsyncLang: "en" };
8271
- u.current.speakText(ne, {
8272
- lipsyncLang: $.lipsyncLang,
8275
+ const X = y()?.questions?.length || 0;
8276
+ a.current.currentQuestionIndex >= X - 1;
8277
+ const ie = a.current.currentQuestionIndex < X - 1;
8278
+ console.log("[CurriculumLearning] Answer feedback - questionIndex:", a.current.currentQuestionIndex, "totalQuestions:", X, "hasNextQuestion:", ie);
8279
+ const te = I.type === "code_test" ? `Great job! Your code passed all the tests! ${I.explanation || ""}` : `Excellent! That's correct! ${I.explanation || ""}`, J = M.current || { lipsyncLang: "en" };
8280
+ u.current.speakText(te, {
8281
+ lipsyncLang: J.lipsyncLang,
8273
8282
  onSpeechEnd: () => {
8274
8283
  d.current.onCustomAction({
8275
8284
  type: "answerFeedbackComplete",
@@ -8277,7 +8286,7 @@ const Et = Qe(({
8277
8286
  lessonIndex: a.current.currentLessonIndex,
8278
8287
  questionIndex: a.current.currentQuestionIndex,
8279
8288
  isCorrect: !0,
8280
- hasNextQuestion: se,
8289
+ hasNextQuestion: ie,
8281
8290
  score: a.current.score,
8282
8291
  totalQuestions: a.current.totalQuestions
8283
8292
  });
@@ -8291,11 +8300,11 @@ const Et = Qe(({
8291
8300
  u.current.setBodyMovement("idle");
8292
8301
  }
8293
8302
  u.current.setBodyMovement("gesturing");
8294
- const Z = y()?.questions?.length || 0, se = a.current.currentQuestionIndex >= Z - 1, ne = a.current.currentQuestionIndex < Z - 1;
8295
- console.log("[CurriculumLearning] Answer feedback (incorrect) - questionIndex:", a.current.currentQuestionIndex, "totalQuestions:", Z, "hasNextQuestion:", ne);
8296
- const $ = I.type === "code_test" ? `Your code didn't pass all the tests. ${I.explanation || "Try again!"}` : `Not quite right, but don't worry! ${I.explanation || ""}${se ? "" : " Let's move on to the next question."}`, Re = M.current || { lipsyncLang: "en" };
8297
- u.current.speakText($, {
8298
- lipsyncLang: Re.lipsyncLang,
8303
+ const X = y()?.questions?.length || 0, ie = a.current.currentQuestionIndex >= X - 1, te = a.current.currentQuestionIndex < X - 1;
8304
+ console.log("[CurriculumLearning] Answer feedback (incorrect) - questionIndex:", a.current.currentQuestionIndex, "totalQuestions:", X, "hasNextQuestion:", te);
8305
+ const J = I.type === "code_test" ? `Your code didn't pass all the tests. ${I.explanation || "Try again!"}` : `Not quite right, but don't worry! ${I.explanation || ""}${ie ? "" : " Let's move on to the next question."}`, be = M.current || { lipsyncLang: "en" };
8306
+ u.current.speakText(J, {
8307
+ lipsyncLang: be.lipsyncLang,
8299
8308
  onSpeechEnd: () => {
8300
8309
  d.current.onCustomAction({
8301
8310
  type: "answerFeedbackComplete",
@@ -8303,7 +8312,7 @@ const Et = Qe(({
8303
8312
  lessonIndex: a.current.currentLessonIndex,
8304
8313
  questionIndex: a.current.currentQuestionIndex,
8305
8314
  isCorrect: !1,
8306
- hasNextQuestion: ne,
8315
+ hasNextQuestion: te,
8307
8316
  score: a.current.score,
8308
8317
  totalQuestions: a.current.totalQuestions
8309
8318
  });
@@ -8311,20 +8320,20 @@ const Et = Qe(({
8311
8320
  });
8312
8321
  }
8313
8322
  else {
8314
- const Z = y()?.questions?.length || 0;
8323
+ const X = y()?.questions?.length || 0;
8315
8324
  d.current.onCustomAction({
8316
8325
  type: "answerFeedbackComplete",
8317
8326
  moduleIndex: a.current.currentModuleIndex,
8318
8327
  lessonIndex: a.current.currentLessonIndex,
8319
8328
  questionIndex: a.current.currentQuestionIndex,
8320
8329
  isCorrect: H,
8321
- hasNextQuestion: a.current.currentQuestionIndex < Z - 1,
8330
+ hasNextQuestion: a.current.currentQuestionIndex < X - 1,
8322
8331
  score: a.current.score,
8323
8332
  totalQuestions: a.current.totalQuestions,
8324
8333
  avatarNotReady: !0
8325
8334
  });
8326
8335
  }
8327
- }, [e.correct, e.incorrect, F, y, L]), ye = N((v) => {
8336
+ }, [e.correct, e.incorrect, F, y, L]), xe = N((v) => {
8328
8337
  const I = F();
8329
8338
  if (!v || typeof v != "object") {
8330
8339
  console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
@@ -8352,7 +8361,7 @@ const Et = Qe(({
8352
8361
  testResult: H,
8353
8362
  question: I
8354
8363
  }), m.current && m.current(H);
8355
- }, [F, L]), ae = N(() => {
8364
+ }, [F, L]), le = N(() => {
8356
8365
  if (a.current.currentQuestionIndex > 0) {
8357
8366
  a.current.currentQuestionIndex -= 1;
8358
8367
  const v = F();
@@ -8386,8 +8395,8 @@ const Et = Qe(({
8386
8395
  }, 5e3);
8387
8396
  }
8388
8397
  }
8389
- }, [F]), ke = N(() => {
8390
- const v = B.current || { modules: [] };
8398
+ }, [F]), Ce = N(() => {
8399
+ const v = O.current || { modules: [] };
8391
8400
  if (v.modules[a.current.currentModuleIndex], a.current.currentLessonIndex > 0)
8392
8401
  a.current.currentLessonIndex -= 1, a.current.currentQuestionIndex = 0, a.current.lessonCompleted = !1, a.current.isQuestionMode = !1, a.current.isTeaching = !1, a.current.score = 0, a.current.totalQuestions = 0, d.current.onCustomAction({
8393
8402
  type: "lessonStart",
@@ -8410,30 +8419,30 @@ const Et = Qe(({
8410
8419
  lesson: y()
8411
8420
  }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
8412
8421
  }
8413
- }, [y]), he = N(() => {
8422
+ }, [y]), de = N(() => {
8414
8423
  a.current.currentModuleIndex = 0, a.current.currentLessonIndex = 0, a.current.currentQuestionIndex = 0, a.current.isTeaching = !1, a.current.isQuestionMode = !1, a.current.lessonCompleted = !1, a.current.curriculumCompleted = !1, a.current.score = 0, a.current.totalQuestions = 0;
8415
- }, []), ge = N((v) => {
8424
+ }, []), ye = N((v) => {
8416
8425
  console.log("Avatar is ready!", v);
8417
8426
  const I = y(), H = I?.avatar_script || I?.body;
8418
8427
  c && H && setTimeout(() => {
8419
8428
  h.current && h.current();
8420
8429
  }, 10);
8421
8430
  }, [c, y]);
8422
- lt(() => {
8423
- h.current = j, g.current = V, R.current = x, f.current = D, S.current = T, W.current = A, m.current = Y;
8424
- }), qe(l, () => ({
8431
+ ut(() => {
8432
+ h.current = Z, g.current = V, R.current = f, x.current = D, S.current = T, W.current = A, m.current = Y;
8433
+ }), _e(l, () => ({
8425
8434
  // Curriculum control methods
8426
- startTeaching: j,
8435
+ startTeaching: Z,
8427
8436
  startQuestions: A,
8428
8437
  handleAnswerSelect: Y,
8429
- handleCodeTestResult: ye,
8438
+ handleCodeTestResult: xe,
8430
8439
  nextQuestion: D,
8431
- previousQuestion: ae,
8440
+ previousQuestion: le,
8432
8441
  nextLesson: V,
8433
- previousLesson: ke,
8434
- completeLesson: x,
8442
+ previousLesson: Ce,
8443
+ completeLesson: f,
8435
8444
  completeCurriculum: T,
8436
- resetCurriculum: he,
8445
+ resetCurriculum: de,
8437
8446
  getState: () => ({ ...a.current }),
8438
8447
  getCurrentQuestion: () => F(),
8439
8448
  getCurrentLesson: () => y(),
@@ -8487,8 +8496,8 @@ const Et = Qe(({
8487
8496
  handleResize: () => u.current?.handleResize(),
8488
8497
  // Avatar readiness check (always returns current value)
8489
8498
  isAvatarReady: () => u.current?.isReady || !1
8490
- }), [j, A, Y, ye, D, V, x, T, he, F, y]);
8491
- const oe = M.current || {
8499
+ }), [Z, A, Y, xe, D, V, f, T, de, F, y]);
8500
+ const se = M.current || {
8492
8501
  avatarUrl: "/avatars/brunette.glb",
8493
8502
  avatarBody: "F",
8494
8503
  mood: "happy",
@@ -8501,23 +8510,23 @@ const Et = Qe(({
8501
8510
  showFullAvatar: !1,
8502
8511
  animations: e
8503
8512
  };
8504
- return /* @__PURE__ */ te("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ te(
8505
- st,
8513
+ return /* @__PURE__ */ ee("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ ee(
8514
+ rt,
8506
8515
  {
8507
8516
  ref: u,
8508
- avatarUrl: oe.avatarUrl,
8509
- avatarBody: oe.avatarBody,
8510
- mood: oe.mood,
8511
- ttsLang: oe.ttsLang,
8512
- ttsService: oe.ttsService,
8513
- ttsVoice: oe.ttsVoice,
8514
- ttsApiKey: oe.ttsApiKey,
8515
- bodyMovement: oe.bodyMovement,
8516
- movementIntensity: oe.movementIntensity,
8517
- showFullAvatar: oe.showFullAvatar,
8517
+ avatarUrl: se.avatarUrl,
8518
+ avatarBody: se.avatarBody,
8519
+ mood: se.mood,
8520
+ ttsLang: se.ttsLang,
8521
+ ttsService: se.ttsService,
8522
+ ttsVoice: se.ttsVoice,
8523
+ ttsApiKey: se.ttsApiKey,
8524
+ bodyMovement: se.bodyMovement,
8525
+ movementIntensity: se.movementIntensity,
8526
+ showFullAvatar: se.showFullAvatar,
8518
8527
  cameraView: "upper",
8519
- animations: oe.animations,
8520
- onReady: ge,
8528
+ animations: se.animations,
8529
+ onReady: ye,
8521
8530
  onLoading: () => {
8522
8531
  },
8523
8532
  onError: (v) => {
@@ -8526,8 +8535,8 @@ const Et = Qe(({
8526
8535
  }
8527
8536
  ) });
8528
8537
  });
8529
- Et.displayName = "CurriculumLearning";
8530
- function Zt({
8538
+ Pt.displayName = "CurriculumLearning";
8539
+ function Xt({
8531
8540
  manifestPath: G = "/animations/manifest.json",
8532
8541
  avatarBody: n = "F",
8533
8542
  onAnimationPlay: e = null,
@@ -8535,30 +8544,30 @@ function Zt({
8535
8544
  onDeleteAnimations: o = null,
8536
8545
  style: s = {}
8537
8546
  }) {
8538
- const [i, r] = ue([]), [c, l] = ue(/* @__PURE__ */ new Set()), [u, a] = ue(!0), [d, h] = ue(null), [g, R] = ue("all"), [f, S] = ue("");
8539
- be(() => {
8547
+ const [i, r] = he([]), [c, l] = he(/* @__PURE__ */ new Set()), [u, a] = he(!0), [d, h] = he(null), [g, R] = he("all"), [x, S] = he("");
8548
+ ve(() => {
8540
8549
  (async () => {
8541
8550
  a(!0), h(null);
8542
8551
  try {
8543
- const T = await Ue(G), A = [];
8552
+ const T = await Ve(G), A = [];
8544
8553
  if (T._genderSpecific) {
8545
8554
  const V = (n?.toUpperCase() || "F") === "M" ? "male" : "female";
8546
- T._genderSpecific[V] && Object.entries(T._genderSpecific[V]).forEach(([j, Y]) => {
8547
- (Array.isArray(Y) ? Y : [Y]).forEach((ae) => {
8555
+ T._genderSpecific[V] && Object.entries(T._genderSpecific[V]).forEach(([Z, Y]) => {
8556
+ (Array.isArray(Y) ? Y : [Y]).forEach((le) => {
8548
8557
  A.push({
8549
- path: ae,
8550
- group: j,
8558
+ path: le,
8559
+ group: Z,
8551
8560
  gender: V,
8552
- name: ae.split("/").pop().replace(".fbx", "")
8561
+ name: le.split("/").pop().replace(".fbx", "")
8553
8562
  });
8554
8563
  });
8555
- }), T._genderSpecific.shared && Object.entries(T._genderSpecific.shared).forEach(([j, Y]) => {
8556
- (Array.isArray(Y) ? Y : [Y]).forEach((ae) => {
8564
+ }), T._genderSpecific.shared && Object.entries(T._genderSpecific.shared).forEach(([Z, Y]) => {
8565
+ (Array.isArray(Y) ? Y : [Y]).forEach((le) => {
8557
8566
  A.push({
8558
- path: ae,
8559
- group: j,
8567
+ path: le,
8568
+ group: Z,
8560
8569
  gender: "shared",
8561
- name: ae.split("/").pop().replace(".fbx", "")
8570
+ name: le.split("/").pop().replace(".fbx", "")
8562
8571
  });
8563
8572
  });
8564
8573
  });
@@ -8578,22 +8587,22 @@ function Zt({
8578
8587
  }
8579
8588
  })();
8580
8589
  }, [G, n]);
8581
- const W = ["all", ...new Set(i.map((x) => x.group))], m = i.filter((x) => {
8582
- const T = g === "all" || x.group === g, A = f === "" || x.name.toLowerCase().includes(f.toLowerCase()) || x.path.toLowerCase().includes(f.toLowerCase());
8590
+ const W = ["all", ...new Set(i.map((f) => f.group))], m = i.filter((f) => {
8591
+ const T = g === "all" || f.group === g, A = x === "" || f.name.toLowerCase().includes(x.toLowerCase()) || f.path.toLowerCase().includes(x.toLowerCase());
8583
8592
  return T && A;
8584
- }), B = (x) => {
8593
+ }), O = (f) => {
8585
8594
  const T = new Set(c);
8586
- T.has(x) ? T.delete(x) : T.add(x), l(T), t && t(Array.from(T));
8595
+ T.has(f) ? T.delete(f) : T.add(f), l(T), t && t(Array.from(T));
8587
8596
  }, M = () => {
8588
- const x = new Set(c);
8597
+ const f = new Set(c);
8589
8598
  m.forEach((T) => {
8590
- x.add(T.path);
8591
- }), l(x), t && t(Array.from(x));
8599
+ f.add(T.path);
8600
+ }), l(f), t && t(Array.from(f));
8592
8601
  }, y = () => {
8593
- const x = new Set(c);
8602
+ const f = new Set(c);
8594
8603
  m.forEach((T) => {
8595
- x.delete(T.path);
8596
- }), l(x), t && t(Array.from(x));
8604
+ f.delete(T.path);
8605
+ }), l(f), t && t(Array.from(f));
8597
8606
  }, F = () => {
8598
8607
  const T = i.filter((A) => !c.has(A.path)).map((A) => A.path);
8599
8608
  if (T.length === 0) {
@@ -8606,35 +8615,35 @@ This will delete:
8606
8615
  ${T.slice(0, 5).join(`
8607
8616
  `)}${T.length > 5 ? `
8608
8617
  ...` : ""}`) && (o && o(T), r(i.filter((A) => c.has(A.path))), l(/* @__PURE__ */ new Set()));
8609
- }, L = (x) => {
8610
- e && e(x);
8618
+ }, L = (f) => {
8619
+ e && e(f);
8611
8620
  };
8612
- return u ? /* @__PURE__ */ te("div", { style: { padding: "20px", textAlign: "center", ...s }, children: /* @__PURE__ */ te("p", { children: "Loading animations..." }) }) : d ? /* @__PURE__ */ te("div", { style: { padding: "20px", color: "red", ...s }, children: /* @__PURE__ */ Ce("p", { children: [
8621
+ return u ? /* @__PURE__ */ ee("div", { style: { padding: "20px", textAlign: "center", ...s }, children: /* @__PURE__ */ ee("p", { children: "Loading animations..." }) }) : d ? /* @__PURE__ */ ee("div", { style: { padding: "20px", color: "red", ...s }, children: /* @__PURE__ */ ze("p", { children: [
8613
8622
  "Error loading animations: ",
8614
8623
  d
8615
- ] }) }) : /* @__PURE__ */ Ce("div", { style: {
8624
+ ] }) }) : /* @__PURE__ */ ze("div", { style: {
8616
8625
  padding: "20px",
8617
8626
  backgroundColor: "#2a2a2a",
8618
8627
  borderRadius: "8px",
8619
8628
  color: "#fff",
8620
8629
  ...s
8621
8630
  }, children: [
8622
- /* @__PURE__ */ te("h2", { style: { marginTop: 0 }, children: "Animation Selector" }),
8623
- /* @__PURE__ */ te("p", { style: { color: "#aaa", fontSize: "14px" }, children: "Click buttons to play animations. Select animations to keep, then delete will remove the rest." }),
8624
- /* @__PURE__ */ Ce("div", { style: {
8631
+ /* @__PURE__ */ ee("h2", { style: { marginTop: 0 }, children: "Animation Selector" }),
8632
+ /* @__PURE__ */ ee("p", { style: { color: "#aaa", fontSize: "14px" }, children: "Click buttons to play animations. Select animations to keep, then delete will remove the rest." }),
8633
+ /* @__PURE__ */ ze("div", { style: {
8625
8634
  display: "flex",
8626
8635
  gap: "10px",
8627
8636
  marginBottom: "20px",
8628
8637
  flexWrap: "wrap",
8629
8638
  alignItems: "center"
8630
8639
  }, children: [
8631
- /* @__PURE__ */ te(
8640
+ /* @__PURE__ */ ee(
8632
8641
  "input",
8633
8642
  {
8634
8643
  type: "text",
8635
8644
  placeholder: "Search animations...",
8636
- value: f,
8637
- onChange: (x) => S(x.target.value),
8645
+ value: x,
8646
+ onChange: (f) => S(f.target.value),
8638
8647
  style: {
8639
8648
  padding: "8px 12px",
8640
8649
  borderRadius: "6px",
@@ -8647,11 +8656,11 @@ ${T.slice(0, 5).join(`
8647
8656
  }
8648
8657
  }
8649
8658
  ),
8650
- /* @__PURE__ */ te(
8659
+ /* @__PURE__ */ ee(
8651
8660
  "select",
8652
8661
  {
8653
8662
  value: g,
8654
- onChange: (x) => R(x.target.value),
8663
+ onChange: (f) => R(f.target.value),
8655
8664
  style: {
8656
8665
  padding: "8px 12px",
8657
8666
  borderRadius: "6px",
@@ -8660,10 +8669,10 @@ ${T.slice(0, 5).join(`
8660
8669
  color: "#fff",
8661
8670
  fontSize: "14px"
8662
8671
  },
8663
- children: W.map((x) => /* @__PURE__ */ te("option", { value: x, children: x === "all" ? "All Groups" : x }, x))
8672
+ children: W.map((f) => /* @__PURE__ */ ee("option", { value: f, children: f === "all" ? "All Groups" : f }, f))
8664
8673
  }
8665
8674
  ),
8666
- /* @__PURE__ */ te(
8675
+ /* @__PURE__ */ ee(
8667
8676
  "button",
8668
8677
  {
8669
8678
  onClick: M,
@@ -8679,7 +8688,7 @@ ${T.slice(0, 5).join(`
8679
8688
  children: "Select All Visible"
8680
8689
  }
8681
8690
  ),
8682
- /* @__PURE__ */ te(
8691
+ /* @__PURE__ */ ee(
8683
8692
  "button",
8684
8693
  {
8685
8694
  onClick: y,
@@ -8695,7 +8704,7 @@ ${T.slice(0, 5).join(`
8695
8704
  children: "Deselect All Visible"
8696
8705
  }
8697
8706
  ),
8698
- /* @__PURE__ */ Ce(
8707
+ /* @__PURE__ */ ze(
8699
8708
  "button",
8700
8709
  {
8701
8710
  onClick: F,
@@ -8717,7 +8726,7 @@ ${T.slice(0, 5).join(`
8717
8726
  }
8718
8727
  )
8719
8728
  ] }),
8720
- /* @__PURE__ */ Ce("div", { style: {
8729
+ /* @__PURE__ */ ze("div", { style: {
8721
8730
  marginBottom: "15px",
8722
8731
  fontSize: "14px",
8723
8732
  color: "#aaa"
@@ -8729,7 +8738,7 @@ ${T.slice(0, 5).join(`
8729
8738
  " | Showing: ",
8730
8739
  m.length
8731
8740
  ] }),
8732
- /* @__PURE__ */ te("div", { style: {
8741
+ /* @__PURE__ */ ee("div", { style: {
8733
8742
  display: "grid",
8734
8743
  gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))",
8735
8744
  gap: "10px",
@@ -8738,9 +8747,9 @@ ${T.slice(0, 5).join(`
8738
8747
  padding: "10px",
8739
8748
  backgroundColor: "#1a1a1a",
8740
8749
  borderRadius: "6px"
8741
- }, children: m.map((x, T) => {
8742
- const A = c.has(x.path);
8743
- return /* @__PURE__ */ Ce(
8750
+ }, children: m.map((f, T) => {
8751
+ const A = c.has(f.path);
8752
+ return /* @__PURE__ */ ze(
8744
8753
  "div",
8745
8754
  {
8746
8755
  style: {
@@ -8751,15 +8760,15 @@ ${T.slice(0, 5).join(`
8751
8760
  cursor: "pointer",
8752
8761
  transition: "all 0.2s"
8753
8762
  },
8754
- onClick: () => B(x.path),
8763
+ onClick: () => O(f.path),
8755
8764
  children: [
8756
- /* @__PURE__ */ Ce("div", { style: { marginBottom: "8px" }, children: [
8757
- /* @__PURE__ */ te(
8765
+ /* @__PURE__ */ ze("div", { style: { marginBottom: "8px" }, children: [
8766
+ /* @__PURE__ */ ee(
8758
8767
  "input",
8759
8768
  {
8760
8769
  type: "checkbox",
8761
8770
  checked: A,
8762
- onChange: () => B(x.path),
8771
+ onChange: () => O(f.path),
8763
8772
  onClick: (D) => D.stopPropagation(),
8764
8773
  style: {
8765
8774
  marginRight: "8px",
@@ -8767,23 +8776,23 @@ ${T.slice(0, 5).join(`
8767
8776
  }
8768
8777
  }
8769
8778
  ),
8770
- /* @__PURE__ */ Ce("span", { style: { fontSize: "12px", color: "#aaa" }, children: [
8771
- x.group,
8779
+ /* @__PURE__ */ ze("span", { style: { fontSize: "12px", color: "#aaa" }, children: [
8780
+ f.group,
8772
8781
  " ",
8773
- x.gender !== "root" && `(${x.gender})`
8782
+ f.gender !== "root" && `(${f.gender})`
8774
8783
  ] })
8775
8784
  ] }),
8776
- /* @__PURE__ */ te("div", { style: {
8785
+ /* @__PURE__ */ ee("div", { style: {
8777
8786
  fontSize: "13px",
8778
8787
  fontWeight: "bold",
8779
8788
  marginBottom: "8px",
8780
8789
  wordBreak: "break-word"
8781
- }, children: x.name }),
8782
- /* @__PURE__ */ te(
8790
+ }, children: f.name }),
8791
+ /* @__PURE__ */ ee(
8783
8792
  "button",
8784
8793
  {
8785
8794
  onClick: (D) => {
8786
- D.stopPropagation(), L(x.path);
8795
+ D.stopPropagation(), L(f.path);
8787
8796
  },
8788
8797
  style: {
8789
8798
  width: "100%",
@@ -8800,17 +8809,17 @@ ${T.slice(0, 5).join(`
8800
8809
  )
8801
8810
  ]
8802
8811
  },
8803
- `${x.path}-${T}`
8812
+ `${f.path}-${T}`
8804
8813
  );
8805
8814
  }) }),
8806
- m.length === 0 && /* @__PURE__ */ te("div", { style: {
8815
+ m.length === 0 && /* @__PURE__ */ ee("div", { style: {
8807
8816
  padding: "40px",
8808
8817
  textAlign: "center",
8809
8818
  color: "#aaa"
8810
8819
  }, children: "No animations found matching your filters." })
8811
8820
  ] });
8812
8821
  }
8813
- const rt = {
8822
+ const at = {
8814
8823
  // Code-based dance animations (no FBX required)
8815
8824
  dance: {
8816
8825
  name: "dance",
@@ -8913,16 +8922,16 @@ const rt = {
8913
8922
  duration: 5e3,
8914
8923
  description: "Excited, energetic movement"
8915
8924
  }
8916
- }, Xt = (G) => rt[G] || null, jt = (G) => rt.hasOwnProperty(G);
8925
+ }, jt = (G) => at[G] || null, Yt = (G) => at.hasOwnProperty(G);
8917
8926
  export {
8918
- Zt as AnimationSelector,
8919
- Et as CurriculumLearning,
8920
- Ft as SimpleTalkingAvatar,
8921
- st as TalkingHeadAvatar,
8922
- Tt as TalkingHeadComponent,
8923
- rt as animations,
8924
- _e as getActiveTTSConfig,
8925
- Xt as getAnimation,
8926
- Gt as getVoiceOptions,
8927
- jt as hasAnimation
8927
+ Xt as AnimationSelector,
8928
+ Pt as CurriculumLearning,
8929
+ Et as SimpleTalkingAvatar,
8930
+ rt as TalkingHeadAvatar,
8931
+ Mt as TalkingHeadComponent,
8932
+ at as animations,
8933
+ Ke as getActiveTTSConfig,
8934
+ jt as getAnimation,
8935
+ Zt as getVoiceOptions,
8936
+ Yt as hasAnimation
8928
8937
  };