@sage-rsc/talking-head-react 1.7.3 → 1.7.4

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,5 +1,5 @@
1
- import { jsxs as ke, jsx as $ } from "react/jsx-runtime";
2
- import { forwardRef as Ze, useRef as W, useState as ae, useEffect as fe, useCallback as N, useImperativeHandle as Xe, useLayoutEffect as ot } from "react";
1
+ import { jsxs as ke, jsx as ee } from "react/jsx-runtime";
2
+ import { forwardRef as Ze, useRef as W, useState as ae, useEffect as xe, useCallback as N, useImperativeHandle as Xe, useLayoutEffect as ot } from "react";
3
3
  import * as x from "three";
4
4
  import { OrbitControls as st } from "three/addons/controls/OrbitControls.js";
5
5
  import { GLTFLoader as rt } from "three/addons/loaders/GLTFLoader.js";
@@ -7,12 +7,12 @@ import { DRACOLoader as at } from "three/addons/loaders/DRACOLoader.js";
7
7
  import { FBXLoader as qe } from "three/addons/loaders/FBXLoader.js";
8
8
  import { RoomEnvironment as lt } from "three/addons/environments/RoomEnvironment.js";
9
9
  import ut from "three/addons/libs/stats.module.js";
10
- let m, ye, ve;
11
- const z = [0, 0, 0, 0], O = new x.Vector3(), Ue = new x.Vector3(), he = new x.Vector3(), We = new x.Vector3();
10
+ let m, fe, Ie;
11
+ const z = [0, 0, 0, 0], O = new x.Vector3(), Ue = new x.Vector3(), de = new x.Vector3(), We = new x.Vector3();
12
12
  new x.Plane();
13
13
  new x.Ray();
14
14
  new x.Euler();
15
- const de = new x.Quaternion(), _e = new x.Quaternion(), we = new x.Matrix4(), Ce = new x.Matrix4();
15
+ const me = new x.Quaternion(), _e = new x.Quaternion(), we = new x.Matrix4(), Ce = new x.Matrix4();
16
16
  new x.Vector3();
17
17
  const Ve = new x.Vector3(0, 0, 1), ct = new x.Vector3(1, 0, 0), ht = new x.Vector3(0, 1, 0), dt = new x.Vector3(0, 0, 1);
18
18
  class mt {
@@ -338,7 +338,7 @@ class mt {
338
338
  ea: [0, 0, 0, 0]
339
339
  // External acceleration [m/s^2]
340
340
  };
341
- u.boneParent.matrixWorld.decompose(O, de, he), O.copy(Ve).applyQuaternion(de).setY(0).normalize(), de.premultiply(_e.setFromUnitVectors(Ve, O).invert()).normalize(), u.qWorldInverseYaw = de.clone().normalize(), this.data.push(u), this.dict[c] = u;
341
+ u.boneParent.matrixWorld.decompose(O, me, de), O.copy(Ve).applyQuaternion(me).setY(0).normalize(), me.premultiply(_e.setFromUnitVectors(Ve, O).invert()).normalize(), u.qWorldInverseYaw = me.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 (r) {
@@ -369,9 +369,9 @@ class mt {
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, de, he), O.copy(Ve).applyQuaternion(de).setY(0).normalize(), de.premultiply(_e.setFromUnitVectors(Ve, O).invert()).normalize(), i.boneParent.quaternion.multiply(de.invert()), i.boneParent.quaternion.multiply(i.qWorldInverseYaw)), i.isZ && (m = Math.atan(z[0] / i.l), de.setFromAxisAngle(dt, -m), i.boneParent.quaternion.multiply(de)), i.isY && (m = i.l / 3, m = m * Math.tanh(z[1] / m), i.bone.position.setLength(i.l + m)), i.isX && (m = Math.atan(z[2] / i.l), de.setFromAxisAngle(ct, -m), i.boneParent.quaternion.multiply(de)), i.isT && (m = 1.5 * Math.tanh(z[3] * 1.5), de.setFromAxisAngle(ht, -m), i.boneParent.quaternion.multiply(de)), 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(O, me, de), O.copy(Ve).applyQuaternion(me).setY(0).normalize(), me.premultiply(_e.setFromUnitVectors(Ve, O).invert()).normalize(), i.boneParent.quaternion.multiply(me.invert()), i.boneParent.quaternion.multiply(i.qWorldInverseYaw)), i.isZ && (m = Math.atan(z[0] / i.l), me.setFromAxisAngle(dt, -m), i.boneParent.quaternion.multiply(me)), i.isY && (m = i.l / 3, m = m * Math.tanh(z[1] / m), i.bone.position.setLength(i.l + m)), i.isX && (m = Math.atan(z[2] / i.l), me.setFromAxisAngle(ct, -m), i.boneParent.quaternion.multiply(me)), i.isT && (m = 1.5 * Math.tanh(z[3] * 1.5), me.setFromAxisAngle(ht, -m), i.boneParent.quaternion.multiply(me)), i.boneParent.updateWorldMatrix(!1, !0), i.excludes && this.opt.isExcludes)
373
373
  for (n = 0, s = i.excludes.length; n < s; n++)
374
- m = i.excludes[n], he.set(0, 0, 0), m.deltaLocal && (he.x += m.deltaLocal[0], he.y += m.deltaLocal[1], he.z += m.deltaLocal[2]), he.applyMatrix4(m.bone.matrixWorld), Ce.copy(i.boneParent.matrixWorld).invert(), he.applyMatrix4(Ce), O.copy(i.bone.position), !(O.distanceToSquared(he) >= m.radiusSq) && (ve = O.length(), ye = he.length(), !(ye > m.radius + ve) && (ye < Math.abs(m.radius - ve) || (ye = (ye * ye + ve * ve - m.radiusSq) / (2 * ye), he.normalize(), We.copy(he).multiplyScalar(ye), ye = Math.sqrt(ve * ve - ye * ye), O.subVectors(O, We).projectOnPlane(he).normalize().multiplyScalar(ye), Ue.subVectors(i.vBasis, We).projectOnPlane(he).normalize(), ve = Ue.dot(O), ve < 0 && (ve = Math.sqrt(ye * ye - ve * ve), Ue.multiplyScalar(ve), O.add(Ue)), O.add(We).normalize(), he.copy(i.bone.position).normalize(), de.setFromUnitVectors(he, O), i.boneParent.quaternion.premultiply(de), i.boneParent.updateWorldMatrix(!1, !0))));
374
+ m = i.excludes[n], de.set(0, 0, 0), m.deltaLocal && (de.x += m.deltaLocal[0], de.y += m.deltaLocal[1], de.z += m.deltaLocal[2]), de.applyMatrix4(m.bone.matrixWorld), Ce.copy(i.boneParent.matrixWorld).invert(), de.applyMatrix4(Ce), O.copy(i.bone.position), !(O.distanceToSquared(de) >= m.radiusSq) && (Ie = O.length(), fe = de.length(), !(fe > m.radius + Ie) && (fe < Math.abs(m.radius - Ie) || (fe = (fe * fe + Ie * Ie - m.radiusSq) / (2 * fe), de.normalize(), We.copy(de).multiplyScalar(fe), fe = Math.sqrt(Ie * Ie - fe * fe), O.subVectors(O, We).projectOnPlane(de).normalize().multiplyScalar(fe), Ue.subVectors(i.vBasis, We).projectOnPlane(de).normalize(), Ie = Ue.dot(O), Ie < 0 && (Ie = Math.sqrt(fe * fe - Ie * Ie), Ue.multiplyScalar(Ie), O.add(Ue)), O.add(We).normalize(), de.copy(i.bone.position).normalize(), me.setFromUnitVectors(de, O), i.boneParent.quaternion.premultiply(me), i.boneParent.updateWorldMatrix(!1, !0))));
375
375
  }
376
376
  this.helpers.isActive && this.updateHelpers();
377
377
  }
@@ -2629,7 +2629,7 @@ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2629
2629
  fr: Rt,
2630
2630
  fi: It,
2631
2631
  lt: Lt
2632
- }, ie = new x.Quaternion(), _ = new x.Euler(), Te = new x.Vector3(), Ee = new x.Vector3(), Je = new x.Box3();
2632
+ }, ie = new x.Quaternion(), K = new x.Euler(), Te = new x.Vector3(), Ee = new x.Vector3(), $e = new x.Box3();
2633
2633
  new x.Matrix4();
2634
2634
  new x.Matrix4();
2635
2635
  new x.Vector3();
@@ -4412,9 +4412,9 @@ class Qe {
4412
4412
  updatePoseDelta() {
4413
4413
  for (const [t, e] of Object.entries(this.poseDelta.props)) {
4414
4414
  if (e.x === 0 && e.y === 0 && e.z === 0) continue;
4415
- _.set(e.x, e.y, e.z);
4415
+ K.set(e.x, e.y, e.z);
4416
4416
  const n = this.poseAvatar.props[t];
4417
- n.isQuaternion ? (ie.setFromEuler(_), n.multiply(ie)) : n.isVector3 && n.add(_);
4417
+ n.isQuaternion ? (ie.setFromEuler(K), n.multiply(ie)) : n.isVector3 && n.add(K);
4418
4418
  }
4419
4419
  }
4420
4420
  /**
@@ -5179,7 +5179,7 @@ class Qe {
5179
5179
  }, o.x ? new x.Vector3(o.x, o.y, o.z) : null, !0, o.d);
5180
5180
  break;
5181
5181
  }
5182
- if ((c || l) && (_.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), _.x = Math.max(-0.9, Math.min(0.9, 2 * _.x - 0.5)), _.y = Math.max(-0.9, Math.min(0.9, -2.5 * _.y)), c ? (Object.assign(this.mtAvatar.eyesLookDown, { system: _.x < 0 ? -_.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: _.x < 0 ? 0 : _.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: _.y < 0 ? -_.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: _.y < 0 ? 0 : _.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: _.y < 0 ? 0 : _.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: _.y < 0 ? -_.y : 0, needsUpdate: !0 }), l && (n = -this.mtAvatar.bodyRotateY.value, o = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5182
+ if ((c || l) && (K.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), K.x = Math.max(-0.9, Math.min(0.9, 2 * K.x - 0.5)), K.y = Math.max(-0.9, Math.min(0.9, -2.5 * K.y)), c ? (Object.assign(this.mtAvatar.eyesLookDown, { system: K.x < 0 ? -K.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: K.x < 0 ? 0 : K.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: K.y < 0 ? -K.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: K.y < 0 ? 0 : K.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: K.y < 0 ? 0 : K.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: K.y < 0 ? -K.y : 0, needsUpdate: !0 }), l && (n = -this.mtAvatar.bodyRotateY.value, o = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5183
5183
  name: "headmove",
5184
5184
  dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
5185
5185
  vs: {
@@ -5200,7 +5200,7 @@ class Qe {
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) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], o = this.mtAvatar[n], o.needsUpdate || Object.assign(o, { base: (this.mood.baseline[n] || 0) + (1 + a / 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 ? a > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = a) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, o = Math.abs(n), o > 1e-4 && (i = o * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / o) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(o, i)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (ie.setFromAxisAngle(kt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(ie)), Je.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Te), Te.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Ee), Ee.sub(this.armature.position), this.objectHips.position.y -= Je.min.y / 2, this.objectHips.position.x -= (Te.x + Ee.x) / 4, this.objectHips.position.z -= (Te.z + Ee.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) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], o = this.mtAvatar[n], o.needsUpdate || Object.assign(o, { base: (this.mood.baseline[n] || 0) + (1 + a / 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 ? a > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = a) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, o = Math.abs(n), o > 1e-4 && (i = o * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / o) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(o, i)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (ie.setFromAxisAngle(kt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(ie)), $e.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Te), Te.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Ee), Ee.sub(this.armature.position), this.objectHips.position.y -= $e.min.y / 2, this.objectHips.position.x -= (Te.x + Ee.x) / 4, this.objectHips.position.z -= (Te.z + Ee.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) {
@@ -5497,10 +5497,10 @@ class Qe {
5497
5497
  if (b && b.visemes && b.visemes.length > 0) {
5498
5498
  const p = b.times[b.visemes.length - 1] + b.durations[b.visemes.length - 1];
5499
5499
  for (let P = 0; P < b.visemes.length; P++) {
5500
- const E = b.visemes[P], y = b.times[P] / p, F = b.durations[P] / p, f = y * d, S = F * d;
5500
+ const E = b.visemes[P], y = b.times[P] / p, F = b.durations[P] / p, f = y * d, w = F * d;
5501
5501
  L.push({
5502
5502
  template: { name: "viseme" },
5503
- ts: [f - Math.min(60, 2 * S / 3), f + Math.min(25, S / 2), f + S + Math.min(60, S / 2)],
5503
+ ts: [f - Math.min(60, 2 * w / 3), f + Math.min(25, w / 2), f + w + Math.min(60, w / 2)],
5504
5504
  vs: {
5505
5505
  ["viseme_" + E]: [null, E === "PP" || E === "FF" ? 0.9 : 0.6, 0]
5506
5506
  }
@@ -6114,10 +6114,10 @@ class Qe {
6114
6114
  }
6115
6115
  this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), Te.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Ee.setFromMatrixPosition(this.objectRightEye.matrixWorld), Te.add(Ee).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"]);
6116
6116
  const n = new x.Vector3().subVectors(e, Te).normalize(), o = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
6117
- _.set(s, o, 0, "YXZ");
6118
- const a = new x.Quaternion().setFromEuler(_), c = new x.Quaternion().copy(a).multiply(ie.clone().invert());
6119
- _.setFromQuaternion(c, "YXZ");
6120
- let l = _.x / (40 / 24) + 0.2, u = _.y / (9 / 4), r = 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;
6117
+ K.set(s, o, 0, "YXZ");
6118
+ const a = new x.Quaternion().setFromEuler(K), c = new x.Quaternion().copy(a).multiply(ie.clone().invert());
6119
+ K.setFromQuaternion(c, "YXZ");
6120
+ let l = K.x / (40 / 24) + 0.2, u = K.y / (9 / 4), r = 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;
6121
6121
  if (t) {
6122
6122
  let R = this.animQueue.findIndex((L) => L.template.name === "lookat");
6123
6123
  R !== -1 && this.animQueue.splice(R, 1);
@@ -6152,8 +6152,8 @@ class Qe {
6152
6152
  const s = new x.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), i = new x.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), a = new x.Vector3().addVectors(s, i).divideScalar(2);
6153
6153
  a.project(this.camera);
6154
6154
  let c = (a.x + 1) / 2 * o.width + o.left, l = -(a.y - 1) / 2 * o.height + o.top;
6155
- t === null && (t = 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"]), _.setFromQuaternion(ie);
6156
- let u = _.x / (40 / 24), r = _.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), b = this.convertRange(e, [l - R, l + R], [-0.3, 0.6]) - u + d, L = this.convertRange(t, [c - g, c + g], [-0.8, 0.8]) - r + h;
6155
+ t === null && (t = 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);
6156
+ let u = K.x / (40 / 24), r = 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), b = this.convertRange(e, [l - R, l + R], [-0.3, 0.6]) - u + d, L = this.convertRange(t, [c - g, c + g], [-0.8, 0.8]) - r + h;
6157
6157
  b = Math.min(0.6, Math.max(-0.3, b)), L = Math.min(0.8, Math.max(-0.8, L));
6158
6158
  let T = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6159
6159
  if (n) {
@@ -6444,7 +6444,7 @@ class Qe {
6444
6444
  return "LeftShoulder";
6445
6445
  if (f.includes("right") && (f.includes("shoulder") || f.includes("clavicle")) && g.has("RightShoulder"))
6446
6446
  return "RightShoulder";
6447
- const S = {
6447
+ const w = {
6448
6448
  // Arm bones - exact matches
6449
6449
  LeftArm: "LeftArm",
6450
6450
  leftArm: "LeftArm",
@@ -6484,8 +6484,8 @@ class Qe {
6484
6484
  Root: "Hips",
6485
6485
  root: "Hips"
6486
6486
  };
6487
- if (S[F]) {
6488
- const H = S[F];
6487
+ if (w[F]) {
6488
+ const H = w[F];
6489
6489
  if (g.has(H))
6490
6490
  return H;
6491
6491
  }
@@ -6509,13 +6509,13 @@ class Qe {
6509
6509
  );
6510
6510
  const T = [], p = /* @__PURE__ */ new Set();
6511
6511
  h.tracks.forEach((y) => {
6512
- const f = y.name.replaceAll("mixamorig", "").split("."), S = f[0], H = f[1], I = b(S);
6512
+ const f = y.name.replaceAll("mixamorig", "").split("."), w = f[0], H = f[1], I = b(w);
6513
6513
  if (!(I && (I === "LeftShoulder" || I === "RightShoulder") && (H === "quaternion" || H === "rotation")))
6514
6514
  if (I && H) {
6515
6515
  const U = `${I}.${H}`, G = y.clone();
6516
- G.name = U, T.push(G), S !== I && R.set(S, I);
6516
+ G.name = U, T.push(G), w !== I && R.set(w, I);
6517
6517
  } else
6518
- p.add(S), (S.toLowerCase().includes("arm") || S.toLowerCase().includes("hand") || S.toLowerCase().includes("shoulder")) && console.warn(`⚠️ Arm bone "${S}" could not be mapped to avatar skeleton`);
6518
+ p.add(w), (w.toLowerCase().includes("arm") || w.toLowerCase().includes("hand") || w.toLowerCase().includes("shoulder")) && console.warn(`⚠️ Arm bone "${w}" could not be mapped to avatar skeleton`);
6519
6519
  }), T.length > 0 ? h = new x.AnimationClip(h.name, h.duration, T) : console.error("No tracks could be mapped! Animation may not work correctly.");
6520
6520
  const P = {};
6521
6521
  h.tracks.forEach((y) => {
@@ -6774,32 +6774,32 @@ const et = Ze(({
6774
6774
  style: R = {},
6775
6775
  animations: b = {}
6776
6776
  }, L) => {
6777
- const T = W(null), p = W(null), P = W(l), E = W(null), y = W(null), F = W(!1), f = W({ remainingText: null, originalText: null, options: null }), S = W([]), H = W(0), [I, U] = ae(!0), [G, j] = ae(null), [Y, ue] = ae(!1), [le, Ie] = ae(!1);
6778
- fe(() => {
6777
+ const T = W(null), p = W(null), P = W(l), E = W(null), y = W(null), F = W(!1), f = W({ remainingText: null, originalText: null, options: null }), w = W([]), H = W(0), [I, U] = ae(!0), [G, j] = ae(null), [Y, ue] = ae(!1), [le, Ae] = ae(!1);
6778
+ xe(() => {
6779
6779
  F.current = le;
6780
- }, [le]), fe(() => {
6780
+ }, [le]), xe(() => {
6781
6781
  P.current = l;
6782
6782
  }, [l]);
6783
6783
  const re = je(), ze = o || re.service;
6784
- let ee;
6785
- ze === "browser" ? ee = {
6784
+ let te;
6785
+ ze === "browser" ? te = {
6786
6786
  service: "browser",
6787
6787
  endpoint: "",
6788
6788
  apiKey: null,
6789
6789
  defaultVoice: "Google US English"
6790
- } : ze === "elevenlabs" ? ee = {
6790
+ } : ze === "elevenlabs" ? te = {
6791
6791
  service: "elevenlabs",
6792
6792
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
6793
6793
  apiKey: i || re.apiKey,
6794
6794
  defaultVoice: s || re.defaultVoice || Pe.defaultVoice,
6795
6795
  voices: re.voices || Pe.voices
6796
- } : ze === "deepgram" ? ee = {
6796
+ } : ze === "deepgram" ? te = {
6797
6797
  service: "deepgram",
6798
6798
  endpoint: "https://api.deepgram.com/v1/speak",
6799
6799
  apiKey: i || re.apiKey,
6800
6800
  defaultVoice: s || re.defaultVoice || Ge.defaultVoice,
6801
6801
  voices: re.voices || Ge.voices
6802
- } : ee = {
6802
+ } : te = {
6803
6803
  ...re,
6804
6804
  // Override API key if provided via props
6805
6805
  apiKey: i !== null ? i : re.apiKey
@@ -6809,14 +6809,14 @@ const et = Ze(({
6809
6809
  body: t,
6810
6810
  avatarMood: e,
6811
6811
  ttsLang: ze === "browser" ? "en-US" : n,
6812
- ttsVoice: s || ee.defaultVoice,
6812
+ ttsVoice: s || te.defaultVoice,
6813
6813
  lipsyncLang: "en",
6814
6814
  showFullAvatar: l,
6815
6815
  bodyMovement: a,
6816
6816
  movementIntensity: c
6817
6817
  }, A = {
6818
- ttsEndpoint: ee.endpoint,
6819
- ttsApikey: ee.apiKey,
6818
+ ttsEndpoint: te.endpoint,
6819
+ ttsApikey: te.apiKey,
6820
6820
  ttsService: ze,
6821
6821
  lipsyncModules: ["en"],
6822
6822
  cameraView: u
@@ -6850,9 +6850,9 @@ const et = Ze(({
6850
6850
  console.error("Error initializing TalkingHead:", C), j(C.message || "Failed to initialize avatar"), U(!1), h(C);
6851
6851
  }
6852
6852
  }, [V, t, e, n, o, s, i, l, a, c, u]);
6853
- fe(() => (M(), () => {
6853
+ xe(() => (M(), () => {
6854
6854
  p.current && (p.current.stop(), p.current.dispose(), p.current = null);
6855
- }), [M]), fe(() => {
6855
+ }), [M]), xe(() => {
6856
6856
  if (!T.current || !p.current) return;
6857
6857
  const C = new ResizeObserver((Q) => {
6858
6858
  for (const se of Q)
@@ -6866,7 +6866,7 @@ const et = Ze(({
6866
6866
  C.disconnect(), window.removeEventListener("resize", X);
6867
6867
  };
6868
6868
  }, [Y]);
6869
- const B = N(async () => {
6869
+ const D = N(async () => {
6870
6870
  if (p.current && p.current.audioCtx)
6871
6871
  try {
6872
6872
  (p.current.audioCtx.state === "suspended" || p.current.audioCtx.state === "interrupted") && (await p.current.audioCtx.resume(), console.log("Audio context resumed"));
@@ -6878,72 +6878,72 @@ const et = Ze(({
6878
6878
  try {
6879
6879
  y.current && (clearInterval(y.current), y.current = null), E.current = { text: C, options: X }, f.current = { remainingText: null, originalText: null, options: null };
6880
6880
  const Q = /[!\.\?\n\p{Extended_Pictographic}]/ug, se = C.split(Q).map((J) => J.trim()).filter((J) => J.length > 0);
6881
- S.current = se, H.current = 0, Ie(!1), F.current = !1, await B();
6882
- const xe = {
6881
+ w.current = se, H.current = 0, Ae(!1), F.current = !1, await D();
6882
+ const be = {
6883
6883
  ...X,
6884
6884
  lipsyncLang: X.lipsyncLang || v.lipsyncLang || "en"
6885
6885
  };
6886
6886
  if (X.onSpeechEnd && p.current) {
6887
6887
  const J = p.current;
6888
- let pe = null, be = 0;
6889
- const Re = 1200;
6890
- let Le = !1;
6891
- pe = setInterval(() => {
6892
- if (be++, F.current)
6888
+ let ge = null, Re = 0;
6889
+ const ve = 1200;
6890
+ let Se = !1;
6891
+ ge = setInterval(() => {
6892
+ if (Re++, F.current)
6893
6893
  return;
6894
- if (be > Re) {
6895
- if (pe && (clearInterval(pe), pe = null, y.current = null), !Le && !F.current) {
6896
- Le = !0;
6894
+ if (Re > ve) {
6895
+ if (ge && (clearInterval(ge), ge = null, y.current = null), !Se && !F.current) {
6896
+ Se = !0;
6897
6897
  try {
6898
6898
  X.onSpeechEnd();
6899
- } catch (w) {
6900
- console.error("Error in onSpeechEnd callback (timeout):", w);
6899
+ } catch (k) {
6900
+ console.error("Error in onSpeechEnd callback (timeout):", k);
6901
6901
  }
6902
6902
  }
6903
6903
  return;
6904
6904
  }
6905
- const Ae = !J.speechQueue || J.speechQueue.length === 0, Oe = !J.audioPlaylist || J.audioPlaylist.length === 0;
6906
- J && J.isSpeaking === !1 && Ae && Oe && J.isAudioPlaying === !1 && !Le && !F.current && setTimeout(() => {
6907
- if (J && !F.current && J.isSpeaking === !1 && (!J.speechQueue || J.speechQueue.length === 0) && (!J.audioPlaylist || J.audioPlaylist.length === 0) && J.isAudioPlaying === !1 && !Le && !F.current) {
6908
- Le = !0, pe && (clearInterval(pe), pe = null, y.current = null);
6905
+ const Le = !J.speechQueue || J.speechQueue.length === 0, Oe = !J.audioPlaylist || J.audioPlaylist.length === 0;
6906
+ J && J.isSpeaking === !1 && Le && Oe && J.isAudioPlaying === !1 && !Se && !F.current && setTimeout(() => {
6907
+ 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) {
6908
+ Se = !0, ge && (clearInterval(ge), ge = null, y.current = null);
6909
6909
  try {
6910
6910
  X.onSpeechEnd();
6911
- } catch (D) {
6912
- console.error("Error in onSpeechEnd callback:", D);
6911
+ } catch (B) {
6912
+ console.error("Error in onSpeechEnd callback:", B);
6913
6913
  }
6914
6914
  }
6915
6915
  }, 100);
6916
- }, 100), y.current = pe;
6916
+ }, 100), y.current = ge;
6917
6917
  }
6918
- p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(C, xe)) : setTimeout(async () => {
6919
- await B(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(C, xe));
6918
+ p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(C, be)) : setTimeout(async () => {
6919
+ await D(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(C, be));
6920
6920
  }, 100);
6921
6921
  } catch (Q) {
6922
6922
  console.error("Error speaking text:", Q), j(Q.message || "Failed to speak text");
6923
6923
  }
6924
- }, [Y, B, v.lipsyncLang]), oe = N(() => {
6925
- p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1), E.current = null, Ie(!1));
6924
+ }, [Y, D, v.lipsyncLang]), oe = N(() => {
6925
+ p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1), E.current = null, Ae(!1));
6926
6926
  }, []), ne = N(() => {
6927
6927
  if (p.current && p.current.pauseSpeaking) {
6928
6928
  const C = p.current;
6929
6929
  if (C.isSpeaking || C.audioPlaylist && C.audioPlaylist.length > 0 || C.speechQueue && C.speechQueue.length > 0) {
6930
6930
  y.current && (clearInterval(y.current), y.current = null);
6931
6931
  let Q = "";
6932
- if (E.current && S.current.length > 0) {
6933
- const se = S.current.length, xe = C.speechQueue ? C.speechQueue.filter((Re) => Re && Re.text && Array.isArray(Re.text) && Re.text.length > 0).length : 0, J = C.audioPlaylist && C.audioPlaylist.length > 0, pe = xe + (J ? 1 : 0), be = se - pe;
6934
- if (pe > 0 && be < se && (Q = S.current.slice(be).join(". ").trim(), !Q && xe > 0 && C.speechQueue)) {
6935
- const Le = C.speechQueue.filter((Ae) => Ae && Ae.text && Array.isArray(Ae.text) && Ae.text.length > 0).map((Ae) => Ae.text.map((Oe) => Oe.word || "").filter((Oe) => Oe.length > 0).join(" ")).filter((Ae) => Ae.length > 0).join(" ");
6936
- Le && Le.trim() && (Q = Le.trim());
6932
+ if (E.current && w.current.length > 0) {
6933
+ const se = w.current.length, be = C.speechQueue ? C.speechQueue.filter((ve) => ve && ve.text && Array.isArray(ve.text) && ve.text.length > 0).length : 0, J = C.audioPlaylist && C.audioPlaylist.length > 0, ge = be + (J ? 1 : 0), Re = se - ge;
6934
+ if (ge > 0 && Re < se && (Q = w.current.slice(Re).join(". ").trim(), !Q && be > 0 && C.speechQueue)) {
6935
+ const Se = C.speechQueue.filter((Le) => Le && Le.text && Array.isArray(Le.text) && Le.text.length > 0).map((Le) => Le.text.map((Oe) => Oe.word || "").filter((Oe) => Oe.length > 0).join(" ")).filter((Le) => Le.length > 0).join(" ");
6936
+ Se && Se.trim() && (Q = Se.trim());
6937
6937
  }
6938
6938
  }
6939
6939
  E.current && (f.current = {
6940
6940
  remainingText: Q || null,
6941
6941
  originalText: E.current.text,
6942
6942
  options: E.current.options
6943
- }), C.speechQueue && (C.speechQueue.length = 0), p.current.pauseSpeaking(), F.current = !0, Ie(!0);
6943
+ }), C.speechQueue && (C.speechQueue.length = 0), p.current.pauseSpeaking(), F.current = !0, Ae(!0);
6944
6944
  }
6945
6945
  }
6946
- }, []), K = N(async () => {
6946
+ }, []), $ = N(async () => {
6947
6947
  if (!p.current || !le)
6948
6948
  return;
6949
6949
  let C = "", X = {};
@@ -6952,10 +6952,10 @@ const et = Ze(({
6952
6952
  else if (E.current && E.current.text)
6953
6953
  C = E.current.text, X = E.current.options || {};
6954
6954
  else {
6955
- console.warn("Resume called but no paused speech found"), Ie(!1), F.current = !1;
6955
+ console.warn("Resume called but no paused speech found"), Ae(!1), F.current = !1;
6956
6956
  return;
6957
6957
  }
6958
- Ie(!1), F.current = !1, await B();
6958
+ Ae(!1), F.current = !1, await D();
6959
6959
  const Q = {
6960
6960
  ...X,
6961
6961
  lipsyncLang: X.lipsyncLang || v.lipsyncLang || "en"
@@ -6963,9 +6963,9 @@ const et = Ze(({
6963
6963
  try {
6964
6964
  await Z(C, Q);
6965
6965
  } catch (se) {
6966
- console.error("Error resuming speech:", se), Ie(!1), F.current = !1;
6966
+ console.error("Error resuming speech:", se), Ae(!1), F.current = !1;
6967
6967
  }
6968
- }, [B, le, Z, v]), me = N((C) => {
6968
+ }, [D, le, Z, v]), pe = N((C) => {
6969
6969
  p.current && p.current.setMood(C);
6970
6970
  }, []), Me = N((C) => {
6971
6971
  p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(C);
@@ -6984,20 +6984,20 @@ const et = Ze(({
6984
6984
  console.warn(`Failed to play ${C}:`, se);
6985
6985
  try {
6986
6986
  p.current.setBodyMovement("idle");
6987
- } catch (xe) {
6988
- console.warn("Fallback animation also failed:", xe);
6987
+ } catch (be) {
6988
+ console.warn("Fallback animation also failed:", be);
6989
6989
  }
6990
6990
  }
6991
6991
  else {
6992
6992
  const se = [".fbx", ".glb", ".gltf"];
6993
- let xe = !1;
6993
+ let be = !1;
6994
6994
  for (const J of se)
6995
6995
  try {
6996
- p.current.playAnimation(C + J, null, 10, 0, 0.01, X), xe = !0;
6996
+ p.current.playAnimation(C + J, null, 10, 0, 0.01, X), be = !0;
6997
6997
  break;
6998
6998
  } catch {
6999
6999
  }
7000
- if (!xe) {
7000
+ if (!be) {
7001
7001
  console.warn("Animation not found:", C);
7002
7002
  try {
7003
7003
  p.current.setBodyMovement("idle");
@@ -7014,9 +7014,9 @@ const et = Ze(({
7014
7014
  speakText: Z,
7015
7015
  stopSpeaking: oe,
7016
7016
  pauseSpeaking: ne,
7017
- resumeSpeaking: K,
7018
- resumeAudioContext: B,
7019
- setMood: me,
7017
+ resumeSpeaking: $,
7018
+ resumeAudioContext: D,
7019
+ setMood: pe,
7020
7020
  setTimingAdjustment: Me,
7021
7021
  playAnimation: He,
7022
7022
  isReady: Y,
@@ -7091,7 +7091,7 @@ const et = Ze(({
7091
7091
  ...R
7092
7092
  },
7093
7093
  children: [
7094
- /* @__PURE__ */ $(
7094
+ /* @__PURE__ */ ee(
7095
7095
  "div",
7096
7096
  {
7097
7097
  ref: T,
@@ -7103,7 +7103,7 @@ const et = Ze(({
7103
7103
  }
7104
7104
  }
7105
7105
  ),
7106
- I && /* @__PURE__ */ $("div", { className: "loading-overlay", style: {
7106
+ I && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7107
7107
  position: "absolute",
7108
7108
  top: "50%",
7109
7109
  left: "50%",
@@ -7112,7 +7112,7 @@ const et = Ze(({
7112
7112
  fontSize: "18px",
7113
7113
  zIndex: 10
7114
7114
  }, children: "Loading avatar..." }),
7115
- G && /* @__PURE__ */ $("div", { className: "error-overlay", style: {
7115
+ G && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7116
7116
  position: "absolute",
7117
7117
  top: "50%",
7118
7118
  left: "50%",
@@ -7207,7 +7207,7 @@ const wt = Ze(({
7207
7207
  console.error("Error initializing TalkingHead:", I), h(I.message || "Failed to initialize avatar"), r(!1), e(I);
7208
7208
  }
7209
7209
  }, []);
7210
- fe(() => (E(), () => {
7210
+ xe(() => (E(), () => {
7211
7211
  l.current && (l.current.stop(), l.current.dispose(), l.current = null);
7212
7212
  }), [E]);
7213
7213
  const y = N((I) => {
@@ -7225,7 +7225,7 @@ const wt = Ze(({
7225
7225
  l.current && (l.current.stopSpeaking(), l.current.setSlowdownRate && (l.current.setSlowdownRate(1), console.log("Reset timing to normal")));
7226
7226
  }, []), f = N((I) => {
7227
7227
  l.current && l.current.setMood(I);
7228
- }, []), S = N((I) => {
7228
+ }, []), w = N((I) => {
7229
7229
  l.current && l.current.setSlowdownRate && (l.current.setSlowdownRate(I), console.log("Timing adjustment set to:", I));
7230
7230
  }, []), H = N((I, U = !1) => {
7231
7231
  if (l.current && l.current.playAnimation) {
@@ -7272,7 +7272,7 @@ const wt = Ze(({
7272
7272
  speakText: y,
7273
7273
  stopSpeaking: F,
7274
7274
  setMood: f,
7275
- setTimingAdjustment: S,
7275
+ setTimingAdjustment: w,
7276
7276
  playAnimation: H,
7277
7277
  isReady: g,
7278
7278
  talkingHead: l.current,
@@ -7334,7 +7334,7 @@ const wt = Ze(({
7334
7334
  }
7335
7335
  }
7336
7336
  })), /* @__PURE__ */ ke("div", { className: `talking-head-container ${o}`, style: s, children: [
7337
- /* @__PURE__ */ $(
7337
+ /* @__PURE__ */ ee(
7338
7338
  "div",
7339
7339
  {
7340
7340
  ref: c,
@@ -7346,7 +7346,7 @@ const wt = Ze(({
7346
7346
  }
7347
7347
  }
7348
7348
  ),
7349
- u && /* @__PURE__ */ $("div", { className: "loading-overlay", style: {
7349
+ u && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7350
7350
  position: "absolute",
7351
7351
  top: "50%",
7352
7352
  left: "50%",
@@ -7355,7 +7355,7 @@ const wt = Ze(({
7355
7355
  fontSize: "18px",
7356
7356
  zIndex: 10
7357
7357
  }, children: "Loading avatar..." }),
7358
- d && /* @__PURE__ */ $("div", { className: "error-overlay", style: {
7358
+ d && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7359
7359
  position: "absolute",
7360
7360
  top: "50%",
7361
7361
  left: "50%",
@@ -7419,7 +7419,7 @@ async function Ct(V, t = "F") {
7419
7419
  }
7420
7420
  return e.length > 0, e;
7421
7421
  }
7422
- async function $e(V, t = "F") {
7422
+ async function Je(V, t = "F") {
7423
7423
  const e = {};
7424
7424
  for (const [n, o] of Object.entries(V))
7425
7425
  try {
@@ -7460,72 +7460,72 @@ const zt = Ze(({
7460
7460
  // e.g., "idle" - will randomly select from this group when idle
7461
7461
  autoSpeak: E = !1
7462
7462
  }, y) => {
7463
- const F = W(null), f = W(null), S = W(u), H = W(null), I = W(null), U = W(!1), G = W({ remainingText: null, originalText: null, options: null }), j = W([]), [Y, ue] = ae(!0), [le, Ie] = ae(null), [re, ze] = ae(!1), [ee, v] = ae(!1), [A, M] = ae(T), B = W(null), Z = W(!1), oe = W(null), ne = W([]), K = W([]);
7464
- fe(() => {
7465
- U.current = ee;
7466
- }, [ee]), fe(() => {
7463
+ const F = W(null), f = W(null), w = W(u), H = W(null), I = W(null), U = W(!1), G = W({ remainingText: null, originalText: null, options: null }), j = W([]), [Y, ue] = ae(!0), [le, Ae] = ae(null), [re, ze] = ae(!1), [te, v] = ae(!1), [A, M] = ae(T), D = W(null), Z = W(!1), oe = W(null), ne = W([]), $ = W([]);
7464
+ xe(() => {
7465
+ U.current = te;
7466
+ }, [te]), xe(() => {
7467
7467
  (async () => {
7468
7468
  if (T.manifest && T.auto)
7469
7469
  try {
7470
- const w = await De(T.manifest);
7471
- M(w);
7470
+ const k = await De(T.manifest);
7471
+ M(k);
7472
7472
  return;
7473
7473
  } catch {
7474
7474
  }
7475
7475
  if (T.manifest && !T.auto)
7476
7476
  try {
7477
- const w = await De(T.manifest);
7478
- M(w);
7479
- } catch (w) {
7480
- console.error("Failed to load animation manifest:", w), M(T);
7477
+ const k = await De(T.manifest);
7478
+ M(k);
7479
+ } catch (k) {
7480
+ console.error("Failed to load animation manifest:", k), M(T);
7481
7481
  }
7482
7482
  else if (T.auto)
7483
7483
  try {
7484
- let w = null;
7484
+ let k = null;
7485
7485
  if (T.manifest)
7486
7486
  try {
7487
- w = await De(T.manifest);
7487
+ k = await De(T.manifest);
7488
7488
  } catch {
7489
7489
  }
7490
7490
  if (typeof T.auto == "string") {
7491
- const D = T.auto, te = {
7492
- talking: `${D}/talking`,
7493
- idle: `${D}/idle`
7494
- }, q = e === "M" ? "male" : "female";
7495
- te[`${q}_talking`] = `${D}/${q}/talking`, te[`${q}_idle`] = `${D}/${q}/idle`, te.shared_talking = `${D}/shared/talking`, te.shared_idle = `${D}/shared/idle`;
7496
- const Se = await $e(te, e);
7497
- if (!Object.values(Se).some((ce) => Array.isArray(ce) && ce.length > 0) && w) {
7498
- M(w);
7491
+ const B = T.auto, q = {
7492
+ talking: `${B}/talking`,
7493
+ idle: `${B}/idle`
7494
+ }, _ = e === "M" ? "male" : "female";
7495
+ q[`${_}_talking`] = `${B}/${_}/talking`, q[`${_}_idle`] = `${B}/${_}/idle`, q.shared_talking = `${B}/shared/talking`, q.shared_idle = `${B}/shared/idle`;
7496
+ const ce = await Je(q, e);
7497
+ if (!Object.values(ce).some((he) => Array.isArray(he) && he.length > 0) && k) {
7498
+ M(k);
7499
7499
  return;
7500
7500
  }
7501
- const ge = {
7501
+ const ye = {
7502
7502
  _genderSpecific: {
7503
- [q]: {},
7503
+ [_]: {},
7504
7504
  shared: {}
7505
7505
  }
7506
7506
  };
7507
- Object.entries(Se).forEach(([ce, Fe]) => {
7508
- if (ce.includes("_")) {
7509
- const [Ne, ...it] = ce.split("_"), Be = it.join("_");
7510
- Ne === "shared" ? (ge._genderSpecific.shared[Be] || (ge._genderSpecific.shared[Be] = []), ge._genderSpecific.shared[Be].push(...Fe)) : Ne === q && (ge._genderSpecific[q][Be] || (ge._genderSpecific[q][Be] = []), ge._genderSpecific[q][Be].push(...Fe));
7507
+ Object.entries(ce).forEach(([he, Fe]) => {
7508
+ if (he.includes("_")) {
7509
+ const [Ne, ...it] = he.split("_"), Be = it.join("_");
7510
+ Ne === "shared" ? (ye._genderSpecific.shared[Be] || (ye._genderSpecific.shared[Be] = []), ye._genderSpecific.shared[Be].push(...Fe)) : Ne === _ && (ye._genderSpecific[_][Be] || (ye._genderSpecific[_][Be] = []), ye._genderSpecific[_][Be].push(...Fe));
7511
7511
  } else
7512
- ge[ce] = Fe;
7513
- }), w && (w._genderSpecific && Object.keys(w._genderSpecific).forEach((ce) => {
7514
- ge._genderSpecific[ce] || (ge._genderSpecific[ce] = {}), Object.entries(w._genderSpecific[ce]).forEach(([Fe, Ne]) => {
7515
- ge._genderSpecific[ce][Fe] || (ge._genderSpecific[ce][Fe] = Ne);
7512
+ ye[he] = Fe;
7513
+ }), k && (k._genderSpecific && Object.keys(k._genderSpecific).forEach((he) => {
7514
+ ye._genderSpecific[he] || (ye._genderSpecific[he] = {}), Object.entries(k._genderSpecific[he]).forEach(([Fe, Ne]) => {
7515
+ ye._genderSpecific[he][Fe] || (ye._genderSpecific[he][Fe] = Ne);
7516
7516
  });
7517
- }), Object.entries(w).forEach(([ce, Fe]) => {
7518
- ce !== "_genderSpecific" && !ge[ce] && (ge[ce] = Fe);
7519
- })), M(ge);
7517
+ }), Object.entries(k).forEach(([he, Fe]) => {
7518
+ he !== "_genderSpecific" && !ye[he] && (ye[he] = Fe);
7519
+ })), M(ye);
7520
7520
  } else if (typeof T.auto == "object") {
7521
- const D = await $e(T.auto, e), te = Object.values(D).some((q) => Array.isArray(q) && q.length > 0);
7522
- M(!te && w ? w : D);
7521
+ const B = await Je(T.auto, e), q = Object.values(B).some((_) => Array.isArray(_) && _.length > 0);
7522
+ M(!q && k ? k : B);
7523
7523
  }
7524
- } catch (w) {
7525
- if (console.error("Failed to auto-discover animations:", w), T.manifest)
7524
+ } catch (k) {
7525
+ if (console.error("Failed to auto-discover animations:", k), T.manifest)
7526
7526
  try {
7527
- const D = await De(T.manifest);
7528
- M(D);
7527
+ const B = await De(T.manifest);
7528
+ M(B);
7529
7529
  } catch {
7530
7530
  M(T);
7531
7531
  }
@@ -7535,10 +7535,10 @@ const zt = Ze(({
7535
7535
  else
7536
7536
  M(T);
7537
7537
  })();
7538
- }, [T, e]), fe(() => {
7539
- S.current = u;
7538
+ }, [T, e]), xe(() => {
7539
+ w.current = u;
7540
7540
  }, [u]);
7541
- const me = je(), Me = s || me.service;
7541
+ const pe = je(), Me = s || pe.service;
7542
7542
  let He;
7543
7543
  Me === "browser" ? He = {
7544
7544
  service: "browser",
@@ -7548,18 +7548,18 @@ const zt = Ze(({
7548
7548
  } : Me === "elevenlabs" ? He = {
7549
7549
  service: "elevenlabs",
7550
7550
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
7551
- apiKey: a || me.apiKey,
7552
- defaultVoice: i || me.defaultVoice || Pe.defaultVoice,
7553
- voices: me.voices || Pe.voices
7551
+ apiKey: a || pe.apiKey,
7552
+ defaultVoice: i || pe.defaultVoice || Pe.defaultVoice,
7553
+ voices: pe.voices || Pe.voices
7554
7554
  } : Me === "deepgram" ? He = {
7555
7555
  service: "deepgram",
7556
7556
  endpoint: "https://api.deepgram.com/v1/speak",
7557
- apiKey: a || me.apiKey,
7558
- defaultVoice: i || me.defaultVoice || Ge.defaultVoice,
7559
- voices: me.voices || Ge.voices
7557
+ apiKey: a || pe.apiKey,
7558
+ defaultVoice: i || pe.defaultVoice || Ge.defaultVoice,
7559
+ voices: pe.voices || Ge.voices
7560
7560
  } : He = {
7561
- ...me,
7562
- apiKey: a !== null ? a : me.apiKey
7561
+ ...pe,
7562
+ apiKey: a !== null ? a : pe.apiKey
7563
7563
  };
7564
7564
  const Ye = {
7565
7565
  url: t,
@@ -7580,168 +7580,175 @@ const zt = Ze(({
7580
7580
  }, X = N(async () => {
7581
7581
  if (!(!F.current || f.current))
7582
7582
  try {
7583
- ue(!0), Ie(null), f.current = new Qe(F.current, C), await f.current.showAvatar(Ye, (w) => {
7584
- if (w.lengthComputable) {
7585
- const D = Math.min(100, Math.round(w.loaded / w.total * 100));
7586
- h(D);
7583
+ ue(!0), Ae(null), f.current = new Qe(F.current, C), await f.current.showAvatar(Ye, (k) => {
7584
+ if (k.lengthComputable) {
7585
+ const B = Math.min(100, Math.round(k.loaded / k.total * 100));
7586
+ h(B);
7587
7587
  }
7588
7588
  }), ue(!1), ze(!0), d(f.current);
7589
- const k = () => {
7589
+ const S = () => {
7590
7590
  document.visibilityState === "visible" ? f.current?.start() : f.current?.stop();
7591
7591
  };
7592
- return document.addEventListener("visibilitychange", k), () => {
7593
- document.removeEventListener("visibilitychange", k);
7592
+ return document.addEventListener("visibilitychange", S), () => {
7593
+ document.removeEventListener("visibilitychange", S);
7594
7594
  };
7595
- } catch (k) {
7596
- console.error("Error initializing TalkingHead:", k), Ie(k.message || "Failed to initialize avatar"), ue(!1), g(k);
7595
+ } catch (S) {
7596
+ console.error("Error initializing TalkingHead:", S), Ae(S.message || "Failed to initialize avatar"), ue(!1), g(S);
7597
7597
  }
7598
7598
  }, []);
7599
- fe(() => (X(), () => {
7599
+ xe(() => (X(), () => {
7600
7600
  f.current && (f.current.stop(), f.current.dispose(), f.current = null);
7601
7601
  }), [X]);
7602
7602
  const Q = N(async () => {
7603
7603
  if (f.current)
7604
7604
  try {
7605
- const k = f.current.audioCtx || f.current.audioContext;
7606
- k && (k.state === "suspended" || k.state === "interrupted") && await k.resume();
7607
- } catch (k) {
7608
- console.warn("Failed to resume audio context:", k);
7605
+ const S = f.current.audioCtx || f.current.audioContext;
7606
+ S && (S.state === "suspended" || S.state === "interrupted") && await S.resume();
7607
+ } catch (S) {
7608
+ console.warn("Failed to resume audio context:", S);
7609
7609
  }
7610
- }, []), se = N((k) => {
7610
+ }, []), se = N((S) => {
7611
7611
  if (!A)
7612
7612
  return [];
7613
- let w = null;
7613
+ let k = null;
7614
7614
  if (A._genderSpecific) {
7615
- const te = (e?.toUpperCase() || "F") === "M" ? "male" : "female", q = A._genderSpecific[te];
7616
- q && q[k] ? w = q[k] : A._genderSpecific.shared && A._genderSpecific.shared[k] && (w = A._genderSpecific.shared[k]);
7615
+ let B = "F";
7616
+ if (e) {
7617
+ const ce = e.toString().toUpperCase().trim();
7618
+ ce === "M" || ce === "MALE" ? B = "M" : (ce === "F" || ce === "FEMALE") && (B = "F");
7619
+ }
7620
+ const q = B === "M" ? "male" : "female";
7621
+ console.log(`🔍 Gender detection: avatarBody="${e}" -> avatarGender="${B}" -> genderKey="${q}"`);
7622
+ const _ = A._genderSpecific[q];
7623
+ _ && _[S] ? (k = _[S], console.log(`✅ Found ${q} animations for "${S}": ${Array.isArray(k) ? k.length : 1} animation(s)`)) : A._genderSpecific.shared && A._genderSpecific.shared[S] ? (k = A._genderSpecific.shared[S], console.log(`✅ Found shared animations for "${S}": ${Array.isArray(k) ? k.length : 1} animation(s)`)) : console.log(`⚠️ No ${q} or shared animations found for "${S}"`);
7617
7624
  }
7618
- return !w && A[k] && (w = A[k]), w ? Array.isArray(w) ? [...w] : typeof w == "string" ? [w] : [] : [];
7619
- }, [A, e]), xe = N((k) => {
7620
- const w = [...k];
7621
- for (let D = w.length - 1; D > 0; D--) {
7622
- const te = Math.floor(Math.random() * (D + 1));
7623
- [w[D], w[te]] = [w[te], w[D]];
7625
+ return !k && A[S] && (k = A[S], console.log(`✅ Found root-level animations for "${S}": ${Array.isArray(k) ? k.length : 1} animation(s)`)), k ? Array.isArray(k) ? [...k] : typeof k == "string" ? [k] : [] : (console.log(`❌ No animations found for "${S}"`), []);
7626
+ }, [A, e]), be = N((S) => {
7627
+ const k = [...S];
7628
+ for (let B = k.length - 1; B > 0; B--) {
7629
+ const q = Math.floor(Math.random() * (B + 1));
7630
+ [k[B], k[q]] = [k[q], k[B]];
7624
7631
  }
7625
- return w;
7626
- }, []), J = N((k) => {
7627
- if (K.current.length === 0) {
7628
- const D = se(k);
7629
- if (D.length === 0)
7632
+ return k;
7633
+ }, []), J = N((S) => {
7634
+ if ($.current.length === 0) {
7635
+ const B = se(S);
7636
+ if (B.length === 0)
7630
7637
  return null;
7631
- K.current = xe(D), ne.current = [];
7638
+ $.current = be(B), ne.current = [];
7632
7639
  }
7633
- const w = K.current.shift();
7634
- return w && ne.current.push(w), w;
7635
- }, [se, xe]), pe = N((k) => k ? k.split("/").pop().replace(".fbx", "").replace(/[-_]/g, " ") : "Unknown", []), be = N((k, w = !1, D = null) => {
7640
+ const k = $.current.shift();
7641
+ return k && ne.current.push(k), k;
7642
+ }, [se, be]), ge = N((S) => S ? S.split("/").pop().replace(".fbx", "").replace(/[-_]/g, " ") : "Unknown", []), Re = N((S, k = !1, B = null) => {
7636
7643
  if (!f.current)
7637
7644
  return null;
7638
- const te = J(k);
7639
- if (te)
7645
+ const q = J(S);
7646
+ if (q)
7640
7647
  try {
7641
- const q = pe(te);
7642
- console.log(`🎬 Playing animation: "${q}"`);
7643
- const Se = () => {
7644
- Z.current && oe.current === k && f.current && (f.current.isSpeaking || f.current.audioPlaylist && f.current.audioPlaylist.length > 0 || f.current.speechQueue && f.current.speechQueue.length > 0) ? setTimeout(() => {
7645
- be(k, w, D);
7646
- }, 100) : (Z.current = !1, oe.current = null, D && D());
7648
+ const _ = ge(q);
7649
+ console.log(`🎬 Playing animation: "${_}"`);
7650
+ const ce = () => {
7651
+ Z.current && oe.current === S && f.current && (f.current.isSpeaking || f.current.audioPlaylist && f.current.audioPlaylist.length > 0 || f.current.speechQueue && f.current.speechQueue.length > 0) ? setTimeout(() => {
7652
+ Re(S, k, B);
7653
+ }, 100) : (Z.current = !1, oe.current = null, B && B());
7647
7654
  };
7648
- return f.current.playAnimation(te, null, 0, 0, 0.01, w, Se), te;
7649
- } catch (q) {
7650
- return console.error("Failed to play animation:", q), null;
7655
+ return f.current.playAnimation(q, null, 0, 0, 0.01, k, ce), q;
7656
+ } catch (_) {
7657
+ return console.error("Failed to play animation:", _), null;
7651
7658
  }
7652
7659
  else
7653
- Z.current && oe.current === k && f.current && (f.current.isSpeaking || f.current.audioPlaylist && f.current.audioPlaylist.length > 0 || f.current.speechQueue && f.current.speechQueue.length > 0) && (K.current = [], ne.current = [], setTimeout(() => {
7654
- be(k, w, D);
7660
+ Z.current && oe.current === S && f.current && (f.current.isSpeaking || f.current.audioPlaylist && f.current.audioPlaylist.length > 0 || f.current.speechQueue && f.current.speechQueue.length > 0) && ($.current = [], ne.current = [], setTimeout(() => {
7661
+ Re(S, k, B);
7655
7662
  }, 100));
7656
7663
  return null;
7657
- }, [J, pe]), Re = N(async (k, w = {}) => {
7658
- if (!f.current || !re || !k || k.trim() === "")
7664
+ }, [J, ge]), ve = N(async (S, k = {}) => {
7665
+ if (!f.current || !re || !S || S.trim() === "")
7659
7666
  return;
7660
7667
  await Q();
7661
- const D = w.animationGroup || p;
7662
- D && !w.skipAnimation && (Z.current = !0, oe.current = D, K.current = [], ne.current = [], be(D)), G.current = { remainingText: null, originalText: null, options: null }, j.current = [], H.current = { text: k, options: w }, I.current && (clearInterval(I.current), I.current = null), v(!1), U.current = !1;
7663
- const te = k.split(/[.!?]+/).filter((Se) => Se.trim().length > 0);
7664
- j.current = te;
7665
- const q = {
7666
- lipsyncLang: w.lipsyncLang || "en",
7668
+ const B = k.animationGroup || p;
7669
+ B && !k.skipAnimation && (Z.current = !0, oe.current = B, $.current = [], ne.current = [], Re(B)), G.current = { remainingText: null, originalText: null, options: null }, j.current = [], H.current = { text: S, options: k }, I.current && (clearInterval(I.current), I.current = null), v(!1), U.current = !1;
7670
+ const q = S.split(/[.!?]+/).filter((ce) => ce.trim().length > 0);
7671
+ j.current = q;
7672
+ const _ = {
7673
+ lipsyncLang: k.lipsyncLang || "en",
7667
7674
  onSpeechEnd: () => {
7668
- I.current && (clearInterval(I.current), I.current = null), Z.current = !1, oe.current = null, K.current = [], ne.current = [], w.onSpeechEnd && w.onSpeechEnd(), R();
7675
+ I.current && (clearInterval(I.current), I.current = null), Z.current = !1, oe.current = null, $.current = [], ne.current = [], k.onSpeechEnd && k.onSpeechEnd(), R();
7669
7676
  }
7670
7677
  };
7671
7678
  try {
7672
- f.current.speakText(k, q);
7673
- } catch (Se) {
7674
- console.error("Error speaking text:", Se), Ie(Se.message || "Failed to speak text");
7679
+ f.current.speakText(S, _);
7680
+ } catch (ce) {
7681
+ console.error("Error speaking text:", ce), Ae(ce.message || "Failed to speak text");
7675
7682
  }
7676
- }, [re, R, Q, p, be]);
7677
- fe(() => {
7683
+ }, [re, R, Q, p, Re]);
7684
+ xe(() => {
7678
7685
  if (!re || !P || !f.current)
7679
7686
  return;
7680
- B.current && clearInterval(B.current);
7681
- const k = () => {
7682
- f.current && !U.current && be(P);
7687
+ D.current && clearInterval(D.current);
7688
+ const S = () => {
7689
+ f.current && !U.current && Re(P);
7683
7690
  };
7684
- return k(), B.current = setInterval(() => {
7685
- k();
7691
+ return S(), D.current = setInterval(() => {
7692
+ S();
7686
7693
  }, 12e3 + Math.random() * 3e3), () => {
7687
- B.current && (clearInterval(B.current), B.current = null);
7694
+ D.current && (clearInterval(D.current), D.current = null);
7688
7695
  };
7689
- }, [re, P, be]), fe(() => {
7690
- re && V && E && f.current && Re(V);
7691
- }, [re, V, E, Re]);
7692
- const Le = N(() => {
7696
+ }, [re, P, Re]), xe(() => {
7697
+ re && V && E && f.current && ve(V);
7698
+ }, [re, V, E, ve]);
7699
+ const Se = N(() => {
7693
7700
  if (f.current)
7694
7701
  try {
7695
- const k = f.current.isSpeaking || !1, w = f.current.audioPlaylist || [], D = f.current.speechQueue || [];
7696
- if (k || w.length > 0 || D.length > 0) {
7702
+ const S = f.current.isSpeaking || !1, k = f.current.audioPlaylist || [], B = f.current.speechQueue || [];
7703
+ if (S || k.length > 0 || B.length > 0) {
7697
7704
  I.current && (clearInterval(I.current), I.current = null);
7698
- let te = "";
7699
- D.length > 0 && (te = D.map((q) => q.text && Array.isArray(q.text) ? q.text.map((Se) => Se.word).join(" ") : q.text || "").join(" ")), G.current = {
7700
- remainingText: te || null,
7705
+ let q = "";
7706
+ B.length > 0 && (q = B.map((_) => _.text && Array.isArray(_.text) ? _.text.map((ce) => ce.word).join(" ") : _.text || "").join(" ")), G.current = {
7707
+ remainingText: q || null,
7701
7708
  originalText: H.current?.text || null,
7702
7709
  options: H.current?.options || null
7703
7710
  }, f.current.speechQueue.length = 0, f.current.pauseSpeaking(), v(!0), U.current = !0;
7704
7711
  }
7705
- } catch (k) {
7706
- console.warn("Error pausing speech:", k);
7712
+ } catch (S) {
7713
+ console.warn("Error pausing speech:", S);
7707
7714
  }
7708
- }, []), Ae = N(async () => {
7709
- if (!(!f.current || !ee))
7715
+ }, []), Le = N(async () => {
7716
+ if (!(!f.current || !te))
7710
7717
  try {
7711
7718
  await Q(), v(!1), U.current = !1;
7712
- const k = G.current?.remainingText, w = G.current?.originalText || H.current?.text, D = G.current?.options || H.current?.options || {}, te = k || w;
7713
- te && Re(te, D);
7714
- } catch (k) {
7715
- console.warn("Error resuming speech:", k), v(!1), U.current = !1;
7719
+ const S = G.current?.remainingText, k = G.current?.originalText || H.current?.text, B = G.current?.options || H.current?.options || {}, q = S || k;
7720
+ q && ve(q, B);
7721
+ } catch (S) {
7722
+ console.warn("Error resuming speech:", S), v(!1), U.current = !1;
7716
7723
  }
7717
- }, [ee, Re, Q]), Oe = N(() => {
7718
- f.current && (f.current.stopSpeaking(), I.current && (clearInterval(I.current), I.current = null), Z.current = !1, oe.current = null, K.current = [], ne.current = [], v(!1), U.current = !1);
7724
+ }, [te, ve, Q]), Oe = N(() => {
7725
+ f.current && (f.current.stopSpeaking(), I.current && (clearInterval(I.current), I.current = null), Z.current = !1, oe.current = null, $.current = [], ne.current = [], v(!1), U.current = !1);
7719
7726
  }, []);
7720
7727
  return Xe(y, () => ({
7721
- speakText: Re,
7722
- pauseSpeaking: Le,
7723
- resumeSpeaking: Ae,
7728
+ speakText: ve,
7729
+ pauseSpeaking: Se,
7730
+ resumeSpeaking: Le,
7724
7731
  stopSpeaking: Oe,
7725
7732
  resumeAudioContext: Q,
7726
- isPaused: () => ee,
7727
- setMood: (k) => f.current?.setMood(k),
7728
- setBodyMovement: (k) => {
7729
- f.current && f.current.setBodyMovement(k);
7733
+ isPaused: () => te,
7734
+ setMood: (S) => f.current?.setMood(S),
7735
+ setBodyMovement: (S) => {
7736
+ f.current && f.current.setBodyMovement(S);
7730
7737
  },
7731
- playAnimation: (k, w = !1) => {
7732
- f.current && f.current.playAnimation && f.current.playAnimation(k, null, 10, 0, 0.01, w);
7738
+ playAnimation: (S, k = !1) => {
7739
+ f.current && f.current.playAnimation && f.current.playAnimation(S, null, 10, 0, 0.01, k);
7733
7740
  },
7734
- playRandomAnimation: (k, w = !1) => be(k, w),
7735
- getRandomAnimation: (k) => getRandomAnimation(k),
7736
- playReaction: (k) => f.current?.playReaction(k),
7741
+ playRandomAnimation: (S, k = !1) => Re(S, k),
7742
+ getRandomAnimation: (S) => getRandomAnimation(S),
7743
+ playReaction: (S) => f.current?.playReaction(S),
7737
7744
  playCelebration: () => f.current?.playCelebration(),
7738
- setShowFullAvatar: (k) => {
7739
- f.current && (S.current = k, f.current.setShowFullAvatar(k));
7745
+ setShowFullAvatar: (S) => {
7746
+ f.current && (w.current = S, f.current.setShowFullAvatar(S));
7740
7747
  },
7741
7748
  isReady: re,
7742
7749
  talkingHead: f.current
7743
7750
  })), /* @__PURE__ */ ke("div", { className: `simple-talking-avatar-container ${b}`, style: L, children: [
7744
- /* @__PURE__ */ $(
7751
+ /* @__PURE__ */ ee(
7745
7752
  "div",
7746
7753
  {
7747
7754
  ref: F,
@@ -7753,7 +7760,7 @@ const zt = Ze(({
7753
7760
  }
7754
7761
  }
7755
7762
  ),
7756
- Y && /* @__PURE__ */ $("div", { className: "loading-overlay", style: {
7763
+ Y && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7757
7764
  position: "absolute",
7758
7765
  top: "50%",
7759
7766
  left: "50%",
@@ -7762,7 +7769,7 @@ const zt = Ze(({
7762
7769
  fontSize: "18px",
7763
7770
  zIndex: 10
7764
7771
  }, children: "Loading avatar..." }),
7765
- le && /* @__PURE__ */ $("div", { className: "error-overlay", style: {
7772
+ le && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7766
7773
  position: "absolute",
7767
7774
  top: "50%",
7768
7775
  left: "50%",
@@ -7828,7 +7835,7 @@ const Ht = Ze(({
7828
7835
  animations: e,
7829
7836
  lipsyncLang: "en"
7830
7837
  });
7831
- fe(() => {
7838
+ xe(() => {
7832
7839
  d.current = {
7833
7840
  onLessonStart: n,
7834
7841
  onLessonComplete: o,
@@ -7836,7 +7843,7 @@ const Ht = Ze(({
7836
7843
  onCurriculumComplete: i,
7837
7844
  onCustomAction: a
7838
7845
  };
7839
- }, [n, o, s, i, a]), fe(() => {
7846
+ }, [n, o, s, i, a]), xe(() => {
7840
7847
  P.current = V?.curriculum || {
7841
7848
  title: "Default Curriculum",
7842
7849
  description: "No curriculum data provided",
@@ -7857,7 +7864,7 @@ const Ht = Ze(({
7857
7864
  lipsyncLang: "en"
7858
7865
  };
7859
7866
  }, [V, t, e]);
7860
- const y = N(() => (P.current || { modules: [] }).modules[r.current.currentModuleIndex]?.lessons[r.current.currentLessonIndex], []), F = N(() => y()?.questions[r.current.currentQuestionIndex], [y]), f = N((v, A) => A.type === "multiple_choice" || A.type === "true_false" ? v === A.answer : A.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), S = N(() => {
7867
+ const y = N(() => (P.current || { modules: [] }).modules[r.current.currentModuleIndex]?.lessons[r.current.currentLessonIndex], []), F = N(() => y()?.questions[r.current.currentQuestionIndex], [y]), f = N((v, A) => A.type === "multiple_choice" || A.type === "true_false" ? v === A.answer : A.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), w = N(() => {
7861
7868
  r.current.lessonCompleted = !0, r.current.isQuestionMode = !1;
7862
7869
  const v = r.current.totalQuestions > 0 ? Math.round(r.current.score / r.current.totalQuestions * 100) : 100;
7863
7870
  let A = "Congratulations! You've completed this lesson";
@@ -7881,9 +7888,9 @@ const Ht = Ze(({
7881
7888
  } catch {
7882
7889
  u.current.playCelebration();
7883
7890
  }
7884
- const M = P.current || { modules: [] }, B = M.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (B?.lessons?.length || 0) - 1, oe = r.current.currentModuleIndex < (M.modules?.length || 0) - 1, ne = Z || oe, K = E.current || { lipsyncLang: "en" };
7891
+ const M = P.current || { modules: [] }, D = M.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (D?.lessons?.length || 0) - 1, oe = r.current.currentModuleIndex < (M.modules?.length || 0) - 1, ne = Z || oe, $ = E.current || { lipsyncLang: "en" };
7885
7892
  u.current.speakText(A, {
7886
- lipsyncLang: K.lipsyncLang,
7893
+ lipsyncLang: $.lipsyncLang,
7887
7894
  onSpeechEnd: () => {
7888
7895
  d.current.onCustomAction({
7889
7896
  type: "lessonCompleteFeedbackDone",
@@ -7934,20 +7941,20 @@ const Ht = Ze(({
7934
7941
  } catch (Z) {
7935
7942
  console.warn("Failed to play questionStart animation:", Z);
7936
7943
  }
7937
- const B = E.current || { lipsyncLang: "en" };
7938
- A.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${A.question}`, { lipsyncLang: B.lipsyncLang }) : A.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: B.lipsyncLang }) : A.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${A.question}`, { lipsyncLang: B.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: B.lipsyncLang });
7944
+ const D = E.current || { lipsyncLang: "en" };
7945
+ A.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${A.question}`, { lipsyncLang: D.lipsyncLang }) : A.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: D.lipsyncLang }) : A.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${A.question}`, { lipsyncLang: D.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: D.lipsyncLang });
7939
7946
  };
7940
7947
  if (u.current && u.current.isReady && A)
7941
7948
  M();
7942
7949
  else if (u.current && u.current.isReady) {
7943
- const B = E.current || { lipsyncLang: "en" };
7944
- u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: B.lipsyncLang });
7950
+ const D = E.current || { lipsyncLang: "en" };
7951
+ u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: D.lipsyncLang });
7945
7952
  } else {
7946
- const B = setInterval(() => {
7947
- u.current && u.current.isReady && (clearInterval(B), A && M());
7953
+ const D = setInterval(() => {
7954
+ u.current && u.current.isReady && (clearInterval(D), A && M());
7948
7955
  }, 100);
7949
7956
  setTimeout(() => {
7950
- clearInterval(B);
7957
+ clearInterval(D);
7951
7958
  }, 5e3);
7952
7959
  }
7953
7960
  }, [e.questionStart, y, F]), U = N(() => {
@@ -7969,40 +7976,40 @@ const Ht = Ze(({
7969
7976
  if (u.current.setMood("happy"), u.current.setBodyMovement("idle"), e.nextQuestion)
7970
7977
  try {
7971
7978
  u.current.playAnimation(e.nextQuestion, !0);
7972
- } catch (K) {
7973
- console.warn("Failed to play nextQuestion animation:", K);
7979
+ } catch ($) {
7980
+ console.warn("Failed to play nextQuestion animation:", $);
7974
7981
  }
7975
- const B = E.current || { lipsyncLang: "en" }, oe = y()?.questions?.length || 0, ne = r.current.currentQuestionIndex >= oe - 1;
7982
+ const D = E.current || { lipsyncLang: "en" }, oe = y()?.questions?.length || 0, ne = r.current.currentQuestionIndex >= oe - 1;
7976
7983
  if (A.type === "code_test") {
7977
- const K = ne ? `Great! Here's your final coding challenge: ${A.question}` : `Great! Now let's move on to your next coding challenge: ${A.question}`;
7978
- u.current.speakText(K, {
7979
- lipsyncLang: B.lipsyncLang
7984
+ const $ = ne ? `Great! Here's your final coding challenge: ${A.question}` : `Great! Now let's move on to your next coding challenge: ${A.question}`;
7985
+ u.current.speakText($, {
7986
+ lipsyncLang: D.lipsyncLang
7980
7987
  });
7981
7988
  } else if (A.type === "multiple_choice") {
7982
- const K = ne ? `Alright! Here's your final question: ${A.question}` : `Alright! Here's your next question: ${A.question}`;
7983
- u.current.speakText(K, {
7984
- lipsyncLang: B.lipsyncLang
7989
+ const $ = ne ? `Alright! Here's your final question: ${A.question}` : `Alright! Here's your next question: ${A.question}`;
7990
+ u.current.speakText($, {
7991
+ lipsyncLang: D.lipsyncLang
7985
7992
  });
7986
7993
  } else if (A.type === "true_false") {
7987
- const K = ne ? `Now let's try this final one: ${A.question}` : `Now let's try this one: ${A.question}`;
7988
- u.current.speakText(K, {
7989
- lipsyncLang: B.lipsyncLang
7994
+ const $ = ne ? `Now let's try this final one: ${A.question}` : `Now let's try this one: ${A.question}`;
7995
+ u.current.speakText($, {
7996
+ lipsyncLang: D.lipsyncLang
7990
7997
  });
7991
7998
  } else {
7992
- const K = ne ? `Here's your final question: ${A.question}` : `Here's the next question: ${A.question}`;
7993
- u.current.speakText(K, {
7994
- lipsyncLang: B.lipsyncLang
7999
+ const $ = ne ? `Here's your final question: ${A.question}` : `Here's the next question: ${A.question}`;
8000
+ u.current.speakText($, {
8001
+ lipsyncLang: D.lipsyncLang
7995
8002
  });
7996
8003
  }
7997
8004
  };
7998
8005
  if (u.current && u.current.isReady && A)
7999
8006
  M();
8000
8007
  else if (A) {
8001
- const B = setInterval(() => {
8002
- u.current && u.current.isReady && (clearInterval(B), M());
8008
+ const D = setInterval(() => {
8009
+ u.current && u.current.isReady && (clearInterval(D), M());
8003
8010
  }, 100);
8004
8011
  setTimeout(() => {
8005
- clearInterval(B);
8012
+ clearInterval(D);
8006
8013
  }, 5e3);
8007
8014
  }
8008
8015
  } else
@@ -8017,7 +8024,7 @@ const Ht = Ze(({
8017
8024
  const v = P.current || { modules: [] }, A = v.modules[r.current.currentModuleIndex];
8018
8025
  if (r.current.currentLessonIndex < (A?.lessons?.length || 0) - 1) {
8019
8026
  r.current.currentLessonIndex += 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
8020
- const B = v.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (B?.lessons?.length || 0) - 1, oe = r.current.currentModuleIndex < (v.modules?.length || 0) - 1, ne = Z || oe;
8027
+ const D = v.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (D?.lessons?.length || 0) - 1, oe = r.current.currentModuleIndex < (v.modules?.length || 0) - 1, ne = Z || oe;
8021
8028
  d.current.onCustomAction({
8022
8029
  type: "lessonStart",
8023
8030
  moduleIndex: r.current.currentModuleIndex,
@@ -8030,12 +8037,12 @@ const Ht = Ze(({
8030
8037
  }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
8031
8038
  } else if (r.current.currentModuleIndex < (v.modules?.length || 0) - 1) {
8032
8039
  r.current.currentModuleIndex += 1, r.current.currentLessonIndex = 0, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
8033
- const Z = v.modules[r.current.currentModuleIndex], oe = r.current.currentLessonIndex < (Z?.lessons?.length || 0) - 1, ne = r.current.currentModuleIndex < (v.modules?.length || 0) - 1, K = oe || ne;
8040
+ const Z = v.modules[r.current.currentModuleIndex], oe = r.current.currentLessonIndex < (Z?.lessons?.length || 0) - 1, ne = r.current.currentModuleIndex < (v.modules?.length || 0) - 1, $ = oe || ne;
8034
8041
  d.current.onCustomAction({
8035
8042
  type: "lessonStart",
8036
8043
  moduleIndex: r.current.currentModuleIndex,
8037
8044
  lessonIndex: r.current.currentLessonIndex,
8038
- hasNextLesson: K
8045
+ hasNextLesson: $
8039
8046
  }), d.current.onLessonStart({
8040
8047
  moduleIndex: r.current.currentModuleIndex,
8041
8048
  lessonIndex: r.current.currentLessonIndex,
@@ -8047,8 +8054,8 @@ const Ht = Ze(({
8047
8054
  const v = y();
8048
8055
  let A = null;
8049
8056
  if (v?.avatar_script && v?.body) {
8050
- const M = v.avatar_script.trim(), B = v.body.trim(), Z = M.match(/[.!?]$/) ? " " : ". ";
8051
- A = `${M}${Z}${B}`;
8057
+ const M = v.avatar_script.trim(), D = v.body.trim(), Z = M.match(/[.!?]$/) ? " " : ". ";
8058
+ A = `${M}${Z}${D}`;
8052
8059
  } else
8053
8060
  A = v?.avatar_script || v?.body || null;
8054
8061
  if (u.current && u.current.isReady && A) {
@@ -8061,7 +8068,7 @@ const Ht = Ze(({
8061
8068
  console.warn("Failed to play teaching animation:", Z);
8062
8069
  }
8063
8070
  M || u.current.setBodyMovement("gesturing");
8064
- const B = E.current || { lipsyncLang: "en" };
8071
+ const D = E.current || { lipsyncLang: "en" };
8065
8072
  d.current.onLessonStart({
8066
8073
  moduleIndex: r.current.currentModuleIndex,
8067
8074
  lessonIndex: r.current.currentLessonIndex,
@@ -8072,7 +8079,7 @@ const Ht = Ze(({
8072
8079
  lessonIndex: r.current.currentLessonIndex,
8073
8080
  lesson: v
8074
8081
  }), u.current.speakText(A, {
8075
- lipsyncLang: B.lipsyncLang,
8082
+ lipsyncLang: D.lipsyncLang,
8076
8083
  onSpeechEnd: () => {
8077
8084
  r.current.isTeaching = !1, d.current.onCustomAction({
8078
8085
  type: "teachingComplete",
@@ -8112,9 +8119,9 @@ const Ht = Ze(({
8112
8119
  r.current.currentQuestionIndex >= Z - 1;
8113
8120
  const oe = r.current.currentQuestionIndex < Z - 1;
8114
8121
  console.log("[CurriculumLearning] Answer feedback - questionIndex:", r.current.currentQuestionIndex, "totalQuestions:", Z, "hasNextQuestion:", oe);
8115
- const ne = A.type === "code_test" ? `Great job! Your code passed all the tests! ${A.explanation || ""}` : `Excellent! That's correct! ${A.explanation || ""}`, K = E.current || { lipsyncLang: "en" };
8122
+ const ne = A.type === "code_test" ? `Great job! Your code passed all the tests! ${A.explanation || ""}` : `Excellent! That's correct! ${A.explanation || ""}`, $ = E.current || { lipsyncLang: "en" };
8116
8123
  u.current.speakText(ne, {
8117
- lipsyncLang: K.lipsyncLang,
8124
+ lipsyncLang: $.lipsyncLang,
8118
8125
  onSpeechEnd: () => {
8119
8126
  d.current.onCustomAction({
8120
8127
  type: "answerFeedbackComplete",
@@ -8138,9 +8145,9 @@ const Ht = Ze(({
8138
8145
  u.current.setBodyMovement("gesturing");
8139
8146
  const Z = y()?.questions?.length || 0, oe = r.current.currentQuestionIndex >= Z - 1, ne = r.current.currentQuestionIndex < Z - 1;
8140
8147
  console.log("[CurriculumLearning] Answer feedback (incorrect) - questionIndex:", r.current.currentQuestionIndex, "totalQuestions:", Z, "hasNextQuestion:", ne);
8141
- const K = A.type === "code_test" ? `Your code didn't pass all the tests. ${A.explanation || "Try again!"}` : `Not quite right, but don't worry! ${A.explanation || ""}${oe ? "" : " Let's move on to the next question."}`, me = E.current || { lipsyncLang: "en" };
8142
- u.current.speakText(K, {
8143
- lipsyncLang: me.lipsyncLang,
8148
+ const $ = A.type === "code_test" ? `Your code didn't pass all the tests. ${A.explanation || "Try again!"}` : `Not quite right, but don't worry! ${A.explanation || ""}${oe ? "" : " Let's move on to the next question."}`, pe = E.current || { lipsyncLang: "en" };
8149
+ u.current.speakText($, {
8150
+ lipsyncLang: pe.lipsyncLang,
8144
8151
  onSpeechEnd: () => {
8145
8152
  d.current.onCustomAction({
8146
8153
  type: "answerFeedbackComplete",
@@ -8231,7 +8238,7 @@ const Ht = Ze(({
8231
8238
  }, 5e3);
8232
8239
  }
8233
8240
  }
8234
- }, [F]), Ie = N(() => {
8241
+ }, [F]), Ae = N(() => {
8235
8242
  const v = P.current || { modules: [] };
8236
8243
  if (v.modules[r.current.currentModuleIndex], r.current.currentLessonIndex > 0)
8237
8244
  r.current.currentLessonIndex -= 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, d.current.onCustomAction({
@@ -8244,8 +8251,8 @@ const Ht = Ze(({
8244
8251
  lesson: y()
8245
8252
  }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
8246
8253
  else if (r.current.currentModuleIndex > 0) {
8247
- const B = v.modules[r.current.currentModuleIndex - 1];
8248
- r.current.currentModuleIndex -= 1, r.current.currentLessonIndex = (B?.lessons?.length || 1) - 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, d.current.onCustomAction({
8254
+ const D = v.modules[r.current.currentModuleIndex - 1];
8255
+ r.current.currentModuleIndex -= 1, r.current.currentLessonIndex = (D?.lessons?.length || 1) - 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, d.current.onCustomAction({
8249
8256
  type: "lessonStart",
8250
8257
  moduleIndex: r.current.currentModuleIndex,
8251
8258
  lessonIndex: r.current.currentLessonIndex
@@ -8265,7 +8272,7 @@ const Ht = Ze(({
8265
8272
  }, 10);
8266
8273
  }, [c, y]);
8267
8274
  ot(() => {
8268
- h.current = j, g.current = G, R.current = S, b.current = U, L.current = H, T.current = I, p.current = Y;
8275
+ h.current = j, g.current = G, R.current = w, b.current = U, L.current = H, T.current = I, p.current = Y;
8269
8276
  }), Xe(l, () => ({
8270
8277
  // Curriculum control methods
8271
8278
  startTeaching: j,
@@ -8275,8 +8282,8 @@ const Ht = Ze(({
8275
8282
  nextQuestion: U,
8276
8283
  previousQuestion: le,
8277
8284
  nextLesson: G,
8278
- previousLesson: Ie,
8279
- completeLesson: S,
8285
+ previousLesson: Ae,
8286
+ completeLesson: w,
8280
8287
  completeCurriculum: H,
8281
8288
  resetCurriculum: re,
8282
8289
  getState: () => ({ ...r.current }),
@@ -8332,8 +8339,8 @@ const Ht = Ze(({
8332
8339
  handleResize: () => u.current?.handleResize(),
8333
8340
  // Avatar readiness check (always returns current value)
8334
8341
  isAvatarReady: () => u.current?.isReady || !1
8335
- }), [j, I, Y, ue, U, G, S, H, re, F, y]);
8336
- const ee = E.current || {
8342
+ }), [j, I, Y, ue, U, G, w, H, re, F, y]);
8343
+ const te = E.current || {
8337
8344
  avatarUrl: "/avatars/brunette.glb",
8338
8345
  avatarBody: "F",
8339
8346
  mood: "happy",
@@ -8346,22 +8353,22 @@ const Ht = Ze(({
8346
8353
  showFullAvatar: !1,
8347
8354
  animations: e
8348
8355
  };
8349
- return /* @__PURE__ */ $("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ $(
8356
+ return /* @__PURE__ */ ee("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ ee(
8350
8357
  et,
8351
8358
  {
8352
8359
  ref: u,
8353
- avatarUrl: ee.avatarUrl,
8354
- avatarBody: ee.avatarBody,
8355
- mood: ee.mood,
8356
- ttsLang: ee.ttsLang,
8357
- ttsService: ee.ttsService,
8358
- ttsVoice: ee.ttsVoice,
8359
- ttsApiKey: ee.ttsApiKey,
8360
- bodyMovement: ee.bodyMovement,
8361
- movementIntensity: ee.movementIntensity,
8362
- showFullAvatar: ee.showFullAvatar,
8360
+ avatarUrl: te.avatarUrl,
8361
+ avatarBody: te.avatarBody,
8362
+ mood: te.mood,
8363
+ ttsLang: te.ttsLang,
8364
+ ttsService: te.ttsService,
8365
+ ttsVoice: te.ttsVoice,
8366
+ ttsApiKey: te.ttsApiKey,
8367
+ bodyMovement: te.bodyMovement,
8368
+ movementIntensity: te.movementIntensity,
8369
+ showFullAvatar: te.showFullAvatar,
8363
8370
  cameraView: "upper",
8364
- animations: ee.animations,
8371
+ animations: te.animations,
8365
8372
  onReady: ze,
8366
8373
  onLoading: () => {
8367
8374
  },
@@ -8381,7 +8388,7 @@ function Ut({
8381
8388
  style: s = {}
8382
8389
  }) {
8383
8390
  const [i, a] = ae([]), [c, l] = ae(/* @__PURE__ */ new Set()), [u, r] = ae(!0), [d, h] = ae(null), [g, R] = ae("all"), [b, L] = ae("");
8384
- fe(() => {
8391
+ xe(() => {
8385
8392
  (async () => {
8386
8393
  r(!0), h(null);
8387
8394
  try {
@@ -8423,22 +8430,22 @@ function Ut({
8423
8430
  }
8424
8431
  })();
8425
8432
  }, [V, t]);
8426
- const T = ["all", ...new Set(i.map((S) => S.group))], p = i.filter((S) => {
8427
- const H = g === "all" || S.group === g, I = b === "" || S.name.toLowerCase().includes(b.toLowerCase()) || S.path.toLowerCase().includes(b.toLowerCase());
8433
+ const T = ["all", ...new Set(i.map((w) => w.group))], p = i.filter((w) => {
8434
+ const H = g === "all" || w.group === g, I = b === "" || w.name.toLowerCase().includes(b.toLowerCase()) || w.path.toLowerCase().includes(b.toLowerCase());
8428
8435
  return H && I;
8429
- }), P = (S) => {
8436
+ }), P = (w) => {
8430
8437
  const H = new Set(c);
8431
- H.has(S) ? H.delete(S) : H.add(S), l(H), n && n(Array.from(H));
8438
+ H.has(w) ? H.delete(w) : H.add(w), l(H), n && n(Array.from(H));
8432
8439
  }, E = () => {
8433
- const S = new Set(c);
8440
+ const w = new Set(c);
8434
8441
  p.forEach((H) => {
8435
- S.add(H.path);
8436
- }), l(S), n && n(Array.from(S));
8442
+ w.add(H.path);
8443
+ }), l(w), n && n(Array.from(w));
8437
8444
  }, y = () => {
8438
- const S = new Set(c);
8445
+ const w = new Set(c);
8439
8446
  p.forEach((H) => {
8440
- S.delete(H.path);
8441
- }), l(S), n && n(Array.from(S));
8447
+ w.delete(H.path);
8448
+ }), l(w), n && n(Array.from(w));
8442
8449
  }, F = () => {
8443
8450
  const H = i.filter((I) => !c.has(I.path)).map((I) => I.path);
8444
8451
  if (H.length === 0) {
@@ -8451,10 +8458,10 @@ This will delete:
8451
8458
  ${H.slice(0, 5).join(`
8452
8459
  `)}${H.length > 5 ? `
8453
8460
  ...` : ""}`) && (o && o(H), a(i.filter((I) => c.has(I.path))), l(/* @__PURE__ */ new Set()));
8454
- }, f = (S) => {
8455
- e && e(S);
8461
+ }, f = (w) => {
8462
+ e && e(w);
8456
8463
  };
8457
- return u ? /* @__PURE__ */ $("div", { style: { padding: "20px", textAlign: "center", ...s }, children: /* @__PURE__ */ $("p", { children: "Loading animations..." }) }) : d ? /* @__PURE__ */ $("div", { style: { padding: "20px", color: "red", ...s }, children: /* @__PURE__ */ ke("p", { children: [
8464
+ 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__ */ ke("p", { children: [
8458
8465
  "Error loading animations: ",
8459
8466
  d
8460
8467
  ] }) }) : /* @__PURE__ */ ke("div", { style: {
@@ -8464,8 +8471,8 @@ ${H.slice(0, 5).join(`
8464
8471
  color: "#fff",
8465
8472
  ...s
8466
8473
  }, children: [
8467
- /* @__PURE__ */ $("h2", { style: { marginTop: 0 }, children: "Animation Selector" }),
8468
- /* @__PURE__ */ $("p", { style: { color: "#aaa", fontSize: "14px" }, children: "Click buttons to play animations. Select animations to keep, then delete will remove the rest." }),
8474
+ /* @__PURE__ */ ee("h2", { style: { marginTop: 0 }, children: "Animation Selector" }),
8475
+ /* @__PURE__ */ ee("p", { style: { color: "#aaa", fontSize: "14px" }, children: "Click buttons to play animations. Select animations to keep, then delete will remove the rest." }),
8469
8476
  /* @__PURE__ */ ke("div", { style: {
8470
8477
  display: "flex",
8471
8478
  gap: "10px",
@@ -8473,13 +8480,13 @@ ${H.slice(0, 5).join(`
8473
8480
  flexWrap: "wrap",
8474
8481
  alignItems: "center"
8475
8482
  }, children: [
8476
- /* @__PURE__ */ $(
8483
+ /* @__PURE__ */ ee(
8477
8484
  "input",
8478
8485
  {
8479
8486
  type: "text",
8480
8487
  placeholder: "Search animations...",
8481
8488
  value: b,
8482
- onChange: (S) => L(S.target.value),
8489
+ onChange: (w) => L(w.target.value),
8483
8490
  style: {
8484
8491
  padding: "8px 12px",
8485
8492
  borderRadius: "6px",
@@ -8492,11 +8499,11 @@ ${H.slice(0, 5).join(`
8492
8499
  }
8493
8500
  }
8494
8501
  ),
8495
- /* @__PURE__ */ $(
8502
+ /* @__PURE__ */ ee(
8496
8503
  "select",
8497
8504
  {
8498
8505
  value: g,
8499
- onChange: (S) => R(S.target.value),
8506
+ onChange: (w) => R(w.target.value),
8500
8507
  style: {
8501
8508
  padding: "8px 12px",
8502
8509
  borderRadius: "6px",
@@ -8505,10 +8512,10 @@ ${H.slice(0, 5).join(`
8505
8512
  color: "#fff",
8506
8513
  fontSize: "14px"
8507
8514
  },
8508
- children: T.map((S) => /* @__PURE__ */ $("option", { value: S, children: S === "all" ? "All Groups" : S }, S))
8515
+ children: T.map((w) => /* @__PURE__ */ ee("option", { value: w, children: w === "all" ? "All Groups" : w }, w))
8509
8516
  }
8510
8517
  ),
8511
- /* @__PURE__ */ $(
8518
+ /* @__PURE__ */ ee(
8512
8519
  "button",
8513
8520
  {
8514
8521
  onClick: E,
@@ -8524,7 +8531,7 @@ ${H.slice(0, 5).join(`
8524
8531
  children: "Select All Visible"
8525
8532
  }
8526
8533
  ),
8527
- /* @__PURE__ */ $(
8534
+ /* @__PURE__ */ ee(
8528
8535
  "button",
8529
8536
  {
8530
8537
  onClick: y,
@@ -8574,7 +8581,7 @@ ${H.slice(0, 5).join(`
8574
8581
  " | Showing: ",
8575
8582
  p.length
8576
8583
  ] }),
8577
- /* @__PURE__ */ $("div", { style: {
8584
+ /* @__PURE__ */ ee("div", { style: {
8578
8585
  display: "grid",
8579
8586
  gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))",
8580
8587
  gap: "10px",
@@ -8583,8 +8590,8 @@ ${H.slice(0, 5).join(`
8583
8590
  padding: "10px",
8584
8591
  backgroundColor: "#1a1a1a",
8585
8592
  borderRadius: "6px"
8586
- }, children: p.map((S, H) => {
8587
- const I = c.has(S.path);
8593
+ }, children: p.map((w, H) => {
8594
+ const I = c.has(w.path);
8588
8595
  return /* @__PURE__ */ ke(
8589
8596
  "div",
8590
8597
  {
@@ -8596,15 +8603,15 @@ ${H.slice(0, 5).join(`
8596
8603
  cursor: "pointer",
8597
8604
  transition: "all 0.2s"
8598
8605
  },
8599
- onClick: () => P(S.path),
8606
+ onClick: () => P(w.path),
8600
8607
  children: [
8601
8608
  /* @__PURE__ */ ke("div", { style: { marginBottom: "8px" }, children: [
8602
- /* @__PURE__ */ $(
8609
+ /* @__PURE__ */ ee(
8603
8610
  "input",
8604
8611
  {
8605
8612
  type: "checkbox",
8606
8613
  checked: I,
8607
- onChange: () => P(S.path),
8614
+ onChange: () => P(w.path),
8608
8615
  onClick: (U) => U.stopPropagation(),
8609
8616
  style: {
8610
8617
  marginRight: "8px",
@@ -8613,22 +8620,22 @@ ${H.slice(0, 5).join(`
8613
8620
  }
8614
8621
  ),
8615
8622
  /* @__PURE__ */ ke("span", { style: { fontSize: "12px", color: "#aaa" }, children: [
8616
- S.group,
8623
+ w.group,
8617
8624
  " ",
8618
- S.gender !== "root" && `(${S.gender})`
8625
+ w.gender !== "root" && `(${w.gender})`
8619
8626
  ] })
8620
8627
  ] }),
8621
- /* @__PURE__ */ $("div", { style: {
8628
+ /* @__PURE__ */ ee("div", { style: {
8622
8629
  fontSize: "13px",
8623
8630
  fontWeight: "bold",
8624
8631
  marginBottom: "8px",
8625
8632
  wordBreak: "break-word"
8626
- }, children: S.name }),
8627
- /* @__PURE__ */ $(
8633
+ }, children: w.name }),
8634
+ /* @__PURE__ */ ee(
8628
8635
  "button",
8629
8636
  {
8630
8637
  onClick: (U) => {
8631
- U.stopPropagation(), f(S.path);
8638
+ U.stopPropagation(), f(w.path);
8632
8639
  },
8633
8640
  style: {
8634
8641
  width: "100%",
@@ -8645,10 +8652,10 @@ ${H.slice(0, 5).join(`
8645
8652
  )
8646
8653
  ]
8647
8654
  },
8648
- `${S.path}-${H}`
8655
+ `${w.path}-${H}`
8649
8656
  );
8650
8657
  }) }),
8651
- p.length === 0 && /* @__PURE__ */ $("div", { style: {
8658
+ p.length === 0 && /* @__PURE__ */ ee("div", { style: {
8652
8659
  padding: "40px",
8653
8660
  textAlign: "center",
8654
8661
  color: "#aaa"