@streamoji/aitwin 0.2.4 → 0.2.6

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/aitwin.js CHANGED
@@ -1,47 +1,47 @@
1
- import { jsxs as kn, jsx as At } from "react/jsx-runtime";
2
- import { forwardRef as Sn, useRef as F, useState as Be, useCallback as oe, useEffect as Se, useMemo as It, useImperativeHandle as vn } from "react";
3
- import { PipecatClient as bn } from "@pipecat-ai/client-js";
4
- import { WebSocketTransport as Tn, DailyMediaManager as An } from "@pipecat-ai/websocket-transport";
5
- const In = "https://pub-607ad1fc22e2400eb57d17240aab857c.r2.dev", Yt = {
6
- publicBase: In
7
- }, Rn = "0.2.4", Dn = {
8
- version: Rn
9
- }, Mn = {}, be = "https://ai.streamoji.com", Jt = `${Yt.publicBase}/custom-faces`, xn = `${Yt.publicBase}/aitwin-workers/v${Dn.version}/visemeDiffPreview.worker.js`;
10
- function Cn(e) {
1
+ import { jsxs as kn, jsx as It } from "react/jsx-runtime";
2
+ import { forwardRef as vn, useRef as F, useState as Le, useCallback as oe, useEffect as ke, useMemo as Rt, useImperativeHandle as bn } from "react";
3
+ import { PipecatClient as Tn } from "@pipecat-ai/client-js";
4
+ import { WebSocketTransport as An, DailyMediaManager as In } from "@pipecat-ai/websocket-transport";
5
+ const Rn = "https://pub-607ad1fc22e2400eb57d17240aab857c.r2.dev", Jt = {
6
+ publicBase: Rn
7
+ }, Dn = "0.2.6", Mn = {
8
+ version: Dn
9
+ }, Cn = {}, be = "https://ai.streamoji.com", ut = `${Jt.publicBase}/custom-faces`, xn = `${Jt.publicBase}/aitwin-workers/v${Mn.version}/visemeDiffPreview.worker.js`;
10
+ function Pn(e) {
11
11
  if (e) return e;
12
- const t = typeof import.meta < "u" ? Mn?.VITE_AITWIN_WORKER_URL : void 0;
12
+ const t = typeof import.meta < "u" ? Cn?.VITE_AITWIN_WORKER_URL : void 0;
13
13
  return t?.trim() ? t.trim() : xn;
14
14
  }
15
- const Pn = "https://us-central1-streamoji-265f4.cloudfunctions.net/getAiTwin", Qt = "eng_a7f2b9c1", ut = "eng_d4e8f3a2", Ae = "eng_c9b1e6d4", Te = Ae, Bn = /* @__PURE__ */ new Set([
16
- ut,
15
+ const Bn = "https://us-central1-streamoji-265f4.cloudfunctions.net/getAiTwin", Qt = "eng_a7f2b9c1", lt = "eng_d4e8f3a2", Ae = "eng_c9b1e6d4", Te = Ae, Ln = /* @__PURE__ */ new Set([
16
+ lt,
17
17
  Ae
18
18
  ]), Xt = {
19
19
  [Qt]: "oculus_direct",
20
20
  [Ae]: "oculus_direct",
21
- [ut]: "inworld_word"
22
- }, Rt = {
21
+ [lt]: "inworld_word"
22
+ }, Dt = {
23
23
  google: Qt,
24
- inworld: ut,
24
+ inworld: lt,
25
25
  cartesia: Ae
26
26
  };
27
- function Ln(e) {
27
+ function On(e) {
28
28
  return Xt[e];
29
29
  }
30
- function On(e) {
30
+ function Fn(e) {
31
31
  return e === Ae;
32
32
  }
33
- function Fn(e) {
33
+ function Un(e) {
34
34
  if (e.ttsEngineId && e.ttsEngineId in Xt)
35
35
  return e.ttsEngineId;
36
36
  const t = e.tts?.toLowerCase();
37
- return t && t in Rt ? Rt[t] : Te;
37
+ return t && t in Dt ? Dt[t] : Te;
38
38
  }
39
39
  class nt extends Error {
40
40
  constructor(t = "AI twin not found") {
41
41
  super(t), this.name = "AiTwinNotFoundError";
42
42
  }
43
43
  }
44
- async function Un(e, t = Pn) {
44
+ async function Nn(e, t = Bn) {
45
45
  const n = new URL(t);
46
46
  n.searchParams.set("id", e);
47
47
  const r = await fetch(n.toString());
@@ -55,21 +55,21 @@ async function Un(e, t = Pn) {
55
55
  const { tts: i, ...o } = s.data;
56
56
  return {
57
57
  ...o,
58
- ttsEngineId: Fn(s.data)
58
+ ttsEngineId: Un(s.data)
59
59
  };
60
60
  }
61
- const Nn = "https://us-central1-streamoji-265f4.cloudfunctions.net/getAuthToken", Vn = "client_6TNvp3SCs4Og0a1ijm9TommXLql1", $n = "kk8Fq8EmexzP10jMIEwY3R44M5RKUEm1", Hn = "6TNvp3SCs4Og0a1ijm9TommXLql1", Wn = "Swaraj Mali";
61
+ const Vn = "https://us-central1-streamoji-265f4.cloudfunctions.net/getAuthToken", $n = "client_6TNvp3SCs4Og0a1ijm9TommXLql1", Wn = "kk8Fq8EmexzP10jMIEwY3R44M5RKUEm1", Hn = "6TNvp3SCs4Og0a1ijm9TommXLql1", qn = "Swaraj Mali";
62
62
  async function et() {
63
- const e = await fetch(Nn, {
63
+ const e = await fetch(Vn, {
64
64
  method: "POST",
65
65
  headers: {
66
66
  "Content-Type": "application/json",
67
- "Client-Id": Vn,
68
- "Client-Secret": $n
67
+ "Client-Id": $n,
68
+ "Client-Secret": Wn
69
69
  },
70
70
  body: JSON.stringify({
71
71
  userId: Hn,
72
- userName: Wn
72
+ userName: qn
73
73
  })
74
74
  });
75
75
  if (!e.ok)
@@ -79,7 +79,7 @@ async function et() {
79
79
  throw new Error("getAuthToken returned no token");
80
80
  return n;
81
81
  }
82
- async function qn(e, t = be) {
82
+ async function Kn(e, t = be) {
83
83
  const n = await fetch(`${t.replace(/\/$/, "")}/api/session-value`, {
84
84
  headers: { Authorization: `Bearer ${e}` }
85
85
  });
@@ -89,7 +89,7 @@ async function qn(e, t = be) {
89
89
  if (!r.value) throw new Error("Session value response missing value");
90
90
  return r;
91
91
  }
92
- function Kn(e) {
92
+ function jn(e) {
93
93
  const t = e.trim();
94
94
  if (t.length % 2 !== 0) throw new Error("Invalid hex key");
95
95
  const n = new Uint8Array(t.length / 2);
@@ -100,17 +100,17 @@ function Kn(e) {
100
100
  function Ve(e) {
101
101
  return Uint8Array.from(e);
102
102
  }
103
- function jn(e, t) {
103
+ function Gn(e, t) {
104
104
  const n = new Uint8Array(e.length + t.length);
105
105
  return n.set(e, 0), n.set(t, e.length), n;
106
106
  }
107
- async function Gn(e, t) {
107
+ async function zn(e, t) {
108
108
  if (!t) throw new Error("Asset key is required for encrypted assets");
109
109
  if (e.byteLength < 28)
110
110
  throw new Error("Encrypted payload too small");
111
- const n = new Uint8Array(e), r = Ve(n.subarray(0, 12)), s = Ve(n.subarray(12, 28)), i = Ve(n.subarray(28)), o = Ve(jn(i, s)), a = await crypto.subtle.importKey(
111
+ const n = new Uint8Array(e), r = Ve(n.subarray(0, 12)), s = Ve(n.subarray(12, 28)), i = Ve(n.subarray(28)), o = Ve(Gn(i, s)), a = await crypto.subtle.importKey(
112
112
  "raw",
113
- Kn(t),
113
+ jn(t),
114
114
  { name: "AES-GCM" },
115
115
  !1,
116
116
  ["decrypt"]
@@ -136,18 +136,18 @@ function qe(e) {
136
136
  function Ie(e) {
137
137
  return qe(e).encrypted;
138
138
  }
139
- function Dt(e, t = Jt) {
139
+ function Mt(e, t = ut) {
140
140
  const n = `${t.replace(/\/$/, "")}/${e}`;
141
141
  return { twinBase: n, binBase: n, encrypted: !0 };
142
142
  }
143
- function zn(e, t) {
143
+ function Yn(e, t) {
144
144
  return (e ?? t)?.trim() || void 0;
145
145
  }
146
- function Yn(e) {
146
+ function Jn(e) {
147
147
  rt = qe(e);
148
148
  for (const t of st) t();
149
149
  }
150
- function Jn(e, t) {
150
+ function Qn(e, t) {
151
151
  const n = typeof globalThis.location < "u" ? globalThis.location.href : void 0;
152
152
  if (!n) return qe(e);
153
153
  const r = (s) => {
@@ -168,33 +168,33 @@ function Ee() {
168
168
  throw new Error("Twin assets not configured; call setActiveTwinAssets first");
169
169
  return rt;
170
170
  }
171
- function Qn(e) {
171
+ function Xn(e) {
172
172
  return st.add(e), () => st.delete(e);
173
173
  }
174
- function Mt() {
174
+ function Ct() {
175
175
  const e = Ee();
176
176
  return Ie(e) ? `${e.binBase}/sil.bin` : `${e.twinBase}/sil.png`;
177
177
  }
178
- function Xn() {
178
+ function Zn() {
179
179
  const e = Ee();
180
180
  return Ie(e) ? `${e.binBase}/idle.bin` : `${e.twinBase}/idle.mp4`;
181
181
  }
182
- function Zn() {
182
+ function er() {
183
183
  const e = Ee();
184
184
  return Ie(e) ? e.binBase : e.twinBase;
185
185
  }
186
186
  function Ge() {
187
187
  return Ie(Ee());
188
188
  }
189
- function er() {
189
+ function tr() {
190
190
  const e = Ee();
191
191
  return Ie(e) ? `${e.binBase}/atlas.bin` : `${e.twinBase}/atlas.json`;
192
192
  }
193
- function tr() {
193
+ function nr() {
194
194
  const e = Ee();
195
195
  return Ie(e) ? `${e.binBase}/expression_atlas.bin` : `${e.twinBase}/expression_atlas.json`;
196
196
  }
197
- function nr(e) {
197
+ function rr(e) {
198
198
  const t = e.split(/\r?\n/);
199
199
  let n = "", r = "";
200
200
  for (const i of t)
@@ -209,7 +209,7 @@ function nr(e) {
209
209
  }
210
210
  return { event: n, data: s };
211
211
  }
212
- const rr = [
212
+ const sr = [
213
213
  "aa",
214
214
  "CH",
215
215
  "DD",
@@ -225,14 +225,14 @@ const rr = [
225
225
  "kk",
226
226
  "nn",
227
227
  "sil"
228
- ], sr = new Map(
229
- rr.map((e) => [e.toLowerCase(), e])
228
+ ], ir = new Map(
229
+ sr.map((e) => [e.toLowerCase(), e])
230
230
  );
231
- function ir(e) {
231
+ function or(e) {
232
232
  const t = (e ?? "").trim();
233
- return t ? sr.get(t.toLowerCase()) ?? "sil" : "sil";
233
+ return t ? ir.get(t.toLowerCase()) ?? "sil" : "sil";
234
234
  }
235
- const or = {
235
+ const ar = {
236
236
  aei: ["aa", "E", "I"],
237
237
  o: ["O", "U"],
238
238
  ee: ["I"],
@@ -244,12 +244,12 @@ const or = {
244
244
  qw: ["U", "O"],
245
245
  cdgknstxyz: ["DD", "SS", "kk", "CH"]
246
246
  };
247
- function ar(e) {
247
+ function cr(e) {
248
248
  if (!e) return ["sil"];
249
249
  const t = e.toLowerCase();
250
- return or[t] ?? ["sil"];
250
+ return ar[t] ?? ["sil"];
251
251
  }
252
- function cr(e, t) {
252
+ function ur(e, t) {
253
253
  const n = e.word.length;
254
254
  if (n <= 0) return 0;
255
255
  const r = e.wduration;
@@ -261,11 +261,11 @@ function ze(e, t) {
261
261
  const n = Math.max(0, Math.min(e.length - 1, t));
262
262
  return e[n] ?? "";
263
263
  }
264
- function ur(e, t) {
264
+ function lr(e, t) {
265
265
  const n = e.toLowerCase(), r = ze(n, t), s = n.slice(Math.max(0, t - 1), t + 2);
266
266
  return r === "i" || r === "y" ? "I" : s.includes("ee") || r === "e" || n.includes("ea") ? "E" : "aa";
267
267
  }
268
- function lr(e, t) {
268
+ function fr(e, t) {
269
269
  const n = e.toLowerCase(), r = n.slice(
270
270
  Math.max(0, t - 1),
271
271
  Math.min(n.length, t + 3)
@@ -274,7 +274,7 @@ function lr(e, t) {
274
274
  const s = ze(n, t);
275
275
  return s === "u" || s === "w" ? "U" : "O";
276
276
  }
277
- function fr(e, t) {
277
+ function dr(e, t) {
278
278
  const n = e.toLowerCase(), r = n.slice(Math.max(0, t - 2), t + 1);
279
279
  if (/qu/.test(r)) return "U";
280
280
  const s = n.slice(
@@ -283,7 +283,7 @@ function fr(e, t) {
283
283
  );
284
284
  return /wo|wh/.test(s) || ze(n, t) === "o" ? "O" : "U";
285
285
  }
286
- const He = {
286
+ const We = {
287
287
  d: "DD",
288
288
  t: "DD",
289
289
  n: "DD",
@@ -295,46 +295,46 @@ const He = {
295
295
  x: "CH",
296
296
  j: "CH"
297
297
  };
298
- function dr(e, t) {
298
+ function hr(e, t) {
299
299
  const n = e.toLowerCase(), r = ze(n, t);
300
- if (He[r]) return He[r];
300
+ if (We[r]) return We[r];
301
301
  for (let s = 0; s < n.length; s++) {
302
302
  const i = n[s];
303
- if (He[i]) return He[i];
303
+ if (We[i]) return We[i];
304
304
  }
305
305
  return "DD";
306
306
  }
307
- function hr(e, t, n) {
308
- const r = ar(e);
307
+ function mr(e, t, n) {
308
+ const r = cr(e);
309
309
  if (r.length === 1) return r[0];
310
310
  const s = t.trim();
311
311
  if (!s) return r[0];
312
312
  const i = (e ?? "").toLowerCase(), o = Math.max(0, n);
313
313
  switch (i) {
314
314
  case "aei":
315
- return ur(s, o);
316
- case "o":
317
315
  return lr(s, o);
318
- case "qw":
316
+ case "o":
319
317
  return fr(s, o);
320
- case "cdgknstxyz":
318
+ case "qw":
321
319
  return dr(s, o);
320
+ case "cdgknstxyz":
321
+ return hr(s, o);
322
322
  default:
323
323
  return r[0];
324
324
  }
325
325
  }
326
- const mr = 24e3;
327
- function wr(e) {
326
+ const wr = 24e3;
327
+ function gr(e) {
328
328
  let t = e.trim();
329
329
  const n = t.indexOf(",");
330
330
  t.startsWith("data:") && n >= 0 && (t = t.slice(n + 1)), t = t.replace(/\s+/g, "").replace(/-/g, "+").replace(/_/g, "/");
331
331
  const r = t.length % 4;
332
332
  return r !== 0 && (t += "=".repeat(4 - r)), t;
333
333
  }
334
- function gr(e) {
334
+ function _r(e) {
335
335
  return e.length >= 4 && e[0] === 82 && e[1] === 73 && e[2] === 70 && e[3] === 70;
336
336
  }
337
- function xt(e, t, n = mr) {
337
+ function xt(e, t, n = wr) {
338
338
  const r = t.byteOffset % 2 === 0 ? t : t.slice(), s = new Int16Array(
339
339
  r.buffer,
340
340
  r.byteOffset,
@@ -345,15 +345,15 @@ function xt(e, t, n = mr) {
345
345
  const o = e.createBuffer(1, i.length, n);
346
346
  return o.copyToChannel(i, 0), o;
347
347
  }
348
- function _r(e) {
349
- const t = wr(e), n = window.atob(t), r = new Uint8Array(n.length);
348
+ function pr(e) {
349
+ const t = gr(e), n = window.atob(t), r = new Uint8Array(n.length);
350
350
  for (let s = 0; s < n.length; s++)
351
351
  r[s] = n.charCodeAt(s);
352
352
  return r;
353
353
  }
354
- async function pr(e, t) {
355
- const n = _r(t);
356
- if (gr(n)) {
354
+ async function yr(e, t) {
355
+ const n = pr(t);
356
+ if (_r(n)) {
357
357
  const r = n.buffer.slice(
358
358
  n.byteOffset,
359
359
  n.byteOffset + n.byteLength
@@ -372,13 +372,13 @@ async function pr(e, t) {
372
372
  return xt(e, n);
373
373
  }
374
374
  }
375
- function Ct(e) {
375
+ function Pt(e) {
376
376
  let t = 0;
377
377
  for (const n of e)
378
378
  t = Math.max(t, n.vtime + n.vduration);
379
379
  return t;
380
380
  }
381
- function yr(e, t) {
381
+ function Er(e, t) {
382
382
  for (const n of e)
383
383
  if (t >= n.wtime && t < n.wtime + n.wduration)
384
384
  return n;
@@ -386,9 +386,9 @@ function yr(e, t) {
386
386
  }
387
387
  function Zt(e, t) {
388
388
  const n = [], r = [];
389
- let s = null, i = !1, o = !1, a = !1, f = !1, l = 0, w = 0, _ = 0, m = 0, S = null, k = 1, u = t, p = !1;
389
+ let s = null, i = !1, o = !1, a = !1, f = !1, l = 0, w = 0, _ = 0, m = 0, k = null, S = 1, u = t, p = !1;
390
390
  const d = () => {
391
- S != null && (clearTimeout(S), S = null);
391
+ k != null && (clearTimeout(k), k = null);
392
392
  }, I = () => {
393
393
  for (const g of r)
394
394
  try {
@@ -398,46 +398,46 @@ function Zt(e, t) {
398
398
  r.length = 0;
399
399
  }, E = () => {
400
400
  for (const g of r)
401
- g.playbackRate.value = k;
401
+ g.playbackRate.value = S;
402
402
  }, R = () => {
403
403
  !f || i || r.length > 0 || n.length > 0 || (o = !1, d(), e.onSpeakingDone(), e.onNotify());
404
- }, W = (g) => {
405
- const x = Ct(g);
406
- if (x <= 0) {
404
+ }, H = (g) => {
405
+ const C = Pt(g);
406
+ if (C <= 0) {
407
407
  e.onSpeakingDone(), e.onNotify();
408
408
  return;
409
409
  }
410
410
  o = !0, l = performance.now(), e.onSpeakingStart(), e.onNotify(), d();
411
- const b = k > 0 ? x / k : x;
412
- S = setTimeout(() => {
413
- p || (o = !1, S = null, e.onSpeakingDone(), e.onNotify());
411
+ const b = S > 0 ? C / S : C;
412
+ k = setTimeout(() => {
413
+ p || (o = !1, k = null, e.onSpeakingDone(), e.onNotify());
414
414
  }, b);
415
- }, V = (g, x, b, D) => {
416
- x.length !== 0 && (D && (_ = b), x.forEach((A) => {
415
+ }, V = (g, C, b, D) => {
416
+ C.length !== 0 && (D && (_ = b), C.forEach((A) => {
417
417
  const B = String(A.word ?? "").trim();
418
418
  if (!B) return;
419
- const $ = Math.round((A.start ?? 0) * 1e3), U = A.duration != null ? Math.round(A.duration * 1e3) : A.end != null ? Math.max(1, Math.round((A.end - (A.start ?? 0)) * 1e3)) : 0;
419
+ const W = Math.round((A.start ?? 0) * 1e3), U = A.duration != null ? Math.round(A.duration * 1e3) : A.end != null ? Math.max(1, Math.round((A.end - (A.start ?? 0)) * 1e3)) : 0;
420
420
  g.push({
421
421
  word: B,
422
- wtime: _ + $,
422
+ wtime: _ + W,
423
423
  wduration: U,
424
424
  queueIndex: g.length,
425
425
  gesture: A.gesture ?? null,
426
426
  emphasis: A.emphasis === !0
427
427
  });
428
428
  }));
429
- }, H = (g, x, b, D, A, P) => {
429
+ }, $ = (g, C, b, D, A, P) => {
430
430
  b.length !== 0 && (A && (_ = D), b.forEach((B) => {
431
- const $ = String(B.symbol ?? B.viseme ?? "").trim();
432
- if (!$) return;
431
+ const W = String(B.symbol ?? B.viseme ?? "").trim();
432
+ if (!W) return;
433
433
  const U = Math.round((B.start ?? 0) * 1e3), X = Math.max(1, Math.round((B.duration ?? 0) * 1e3)), se = _ + U;
434
434
  let Z;
435
- if (Ln(P) === "oculus_direct")
436
- Z = ir($);
435
+ if (On(P) === "oculus_direct")
436
+ Z = or(W);
437
437
  else {
438
- const ce = yr(x, se), J = ce ? cr(ce, se) : 0;
439
- Z = hr(
440
- $,
438
+ const ce = Er(C, se), J = ce ? ur(ce, se) : 0;
439
+ Z = mr(
440
+ W,
441
441
  ce?.word ?? "",
442
442
  J
443
443
  );
@@ -449,20 +449,20 @@ function Zt(e, t) {
449
449
  vduration: X
450
450
  });
451
451
  }), e.onNotify());
452
- }, j = (g, x, b, D, A, P, B) => {
453
- V(x, D, A, P), H(
452
+ }, j = (g, C, b, D, A, P, B) => {
453
+ V(C, D, A, P), $(
454
454
  g,
455
- x,
455
+ C,
456
456
  b,
457
457
  A,
458
458
  P,
459
459
  B
460
460
  );
461
- }, y = async (g, x, b, D, A, P, B) => {
461
+ }, y = async (g, C, b, D, A, P, B) => {
462
462
  if (p || !b?.trim()) {
463
463
  (D.length > 0 || A.length > 0) && !a && j(
464
464
  g,
465
- x,
465
+ C,
466
466
  D,
467
467
  A,
468
468
  _,
@@ -482,23 +482,23 @@ function Zt(e, t) {
482
482
  }
483
483
  i = !0;
484
484
  try {
485
- const $ = window.AudioContext || window.webkitAudioContext;
486
- s || (s = new $());
485
+ const W = window.AudioContext || window.webkitAudioContext;
486
+ s || (s = new W());
487
487
  const U = s;
488
488
  U.state === "suspended" && await U.resume();
489
- const X = await pr(U, b);
489
+ const X = await yr(U, b);
490
490
  a = !0;
491
491
  const se = U.currentTime;
492
492
  let Z = m;
493
493
  const ce = !o;
494
494
  Z < se && (Z = se + 0.1), m = Z + X.duration;
495
495
  const J = U.createBufferSource();
496
- if (J.buffer = X, J.playbackRate.value = k, J.connect(U.destination), r.push(J), p) {
496
+ if (J.buffer = X, J.playbackRate.value = S, J.connect(U.destination), r.push(J), p) {
497
497
  r.pop();
498
498
  return;
499
499
  }
500
500
  if (ce) {
501
- o = !0, e.onSpeakingStart(), w = Z, _ = 0, g.length = 0, x.length = 0, B?.();
501
+ o = !0, e.onSpeakingStart(), w = Z, _ = 0, g.length = 0, C.length = 0, B?.();
502
502
  const v = (Z - se) * 1e3;
503
503
  l = performance.now() + v;
504
504
  }
@@ -509,25 +509,25 @@ function Zt(e, t) {
509
509
  const c = (Z - w) * 1e3;
510
510
  j(
511
511
  g,
512
- x,
512
+ C,
513
513
  D,
514
514
  A,
515
515
  c,
516
516
  P,
517
517
  u
518
518
  );
519
- } catch ($) {
520
- console.error("[avatarChunkPlayback] audio chunk failed:", $);
519
+ } catch (W) {
520
+ console.error("[avatarChunkPlayback] audio chunk failed:", W);
521
521
  } finally {
522
522
  i = !1;
523
- const $ = n.shift();
524
- $ ? await y(
523
+ const W = n.shift();
524
+ W ? await y(
525
525
  g,
526
- x,
527
- $.audio,
528
- $.visemes,
529
- $.words,
530
- $.isNewSegment,
526
+ C,
527
+ W.audio,
528
+ W.visemes,
529
+ W.words,
530
+ W.isNewSegment,
531
531
  B
532
532
  ) : R();
533
533
  }
@@ -537,9 +537,9 @@ function Zt(e, t) {
537
537
  u = g;
538
538
  },
539
539
  setPlaybackSpeed: (g) => {
540
- k = Math.max(0.1, Math.min(1, g)), E();
540
+ S = Math.max(0.1, Math.min(1, g)), E();
541
541
  },
542
- getPlaybackSpeed: () => k,
542
+ getPlaybackSpeed: () => S,
543
543
  resetForNewStream: (g) => {
544
544
  p = !1, f = !1, u = g;
545
545
  },
@@ -553,17 +553,17 @@ function Zt(e, t) {
553
553
  },
554
554
  markStreamComplete: (g) => {
555
555
  if (f = !0, !a && g.length > 0) {
556
- W(g);
556
+ H(g);
557
557
  return;
558
558
  }
559
559
  R();
560
560
  },
561
561
  playAudioChunk: y,
562
- queueTimingsOnly: (g, x, b, D, A) => {
562
+ queueTimingsOnly: (g, C, b, D, A) => {
563
563
  let P = _;
564
- A && g.length > 0 && (P = Ct(g)), j(
564
+ A && g.length > 0 && (P = Pt(g)), j(
565
565
  g,
566
- x,
566
+ C,
567
567
  b,
568
568
  D,
569
569
  P,
@@ -574,7 +574,7 @@ function Zt(e, t) {
574
574
  getPlaybackElapsedMs: () => o ? a && s && w > 0 ? Math.max(
575
575
  0,
576
576
  (s.currentTime - w) * 1e3
577
- ) : Math.max(0, (performance.now() - l) * k) : 0,
577
+ ) : Math.max(0, (performance.now() - l) * S) : 0,
578
578
  isSpeaking: () => o,
579
579
  getPlaybackStartPerf: () => l,
580
580
  /** User spoke over the bot — drop in-flight chunks until the next utterance. */
@@ -586,23 +586,23 @@ function Zt(e, t) {
586
586
  }
587
587
  };
588
588
  }
589
- function lt(e, t) {
589
+ function ft(e, t) {
590
590
  let n = null;
591
591
  for (const r of e)
592
592
  t < r.vtime || t >= r.vtime + r.vduration || (!n || r.vtime >= n.vtime) && (n = r);
593
593
  return n ? n.viseme : "sil";
594
594
  }
595
- function Ws(e, t) {
595
+ function js(e, t) {
596
596
  for (const n of e)
597
597
  if (t >= n.wtime && t < n.wtime + n.wduration)
598
598
  return n;
599
599
  return null;
600
600
  }
601
- const en = 0.5, tn = 1.5, nn = "Olivia", Er = "f786b574-daa5-4673-aa0c-cbe3e8534c02", ft = 0.85;
602
- function Pt(e, t = be) {
601
+ const en = 0.5, tn = 1.5, nn = "Olivia", Sr = "f786b574-daa5-4673-aa0c-cbe3e8534c02", dt = 0.85;
602
+ function Bt(e, t = be) {
603
603
  const n = `${t.replace(/\/$/, "")}/avatar_ttsWithPoses`, r = [], s = [], i = [];
604
604
  let o = "neutral", a = "", f = Te;
605
- const l = /* @__PURE__ */ new Set(), w = () => l.forEach((k) => k()), _ = Zt(
605
+ const l = /* @__PURE__ */ new Set(), w = () => l.forEach((S) => S()), _ = Zt(
606
606
  {
607
607
  onSpeakingStart: () => e("speaking"),
608
608
  onSpeakingDone: () => e("done"),
@@ -613,30 +613,30 @@ function Pt(e, t = be) {
613
613
  _.stop(), r.length = 0, s.length = 0, i.length = 0, o = "neutral", e("idle"), w();
614
614
  };
615
615
  return {
616
- setDeveloperToken: (k) => {
617
- a = k;
616
+ setDeveloperToken: (S) => {
617
+ a = S;
618
618
  },
619
- setTtsEngineId: (k) => {
620
- f = k;
619
+ setTtsEngineId: (S) => {
620
+ f = S;
621
621
  },
622
622
  getTtsEngineId: () => f,
623
- speak: async (k, u) => {
623
+ speak: async (S, u) => {
624
624
  m(), e("loading");
625
625
  const p = a.trim();
626
626
  if (!p)
627
627
  throw new Error("Developer token required for avatar_ttsWithPoses");
628
628
  const d = u?.ttsEngineId ?? f ?? Te;
629
629
  _.resetForNewStream(d), _.setStreamTtsEngineId(d);
630
- const I = u?.voiceId ?? nn, E = u?.speakingRate ?? ft, R = Math.max(
630
+ const I = u?.voiceId ?? nn, E = u?.speakingRate ?? dt, R = Math.max(
631
631
  en,
632
632
  Math.min(tn, E)
633
- ), W = {
634
- user_query: k,
633
+ ), H = {
634
+ user_query: S,
635
635
  ttsEngineId: d,
636
636
  speakingRate: R,
637
637
  tenant: "aiTwin"
638
638
  };
639
- Bn.has(d) && (W.voice_id = I);
639
+ Ln.has(d) && (H.voice_id = I);
640
640
  try {
641
641
  const V = await fetch(n, {
642
642
  method: "POST",
@@ -644,16 +644,16 @@ function Pt(e, t = be) {
644
644
  "Content-Type": "application/json",
645
645
  Authorization: `Bearer ${p}`
646
646
  },
647
- body: JSON.stringify(W)
647
+ body: JSON.stringify(H)
648
648
  });
649
649
  if (!V.ok)
650
650
  throw new Error(`avatar_ttsWithPoses failed (${V.status})`);
651
- const H = V.body;
652
- if (!H) throw new Error("No response body");
653
- const j = H.getReader(), y = new TextDecoder();
651
+ const $ = V.body;
652
+ if (!$) throw new Error("No response body");
653
+ const j = $.getReader(), y = new TextDecoder();
654
654
  let T = "";
655
- const g = async (x) => {
656
- const b = nr(x);
655
+ const g = async (C) => {
656
+ const b = rr(C);
657
657
  if (b) {
658
658
  if (b.event === "audio") {
659
659
  const D = b.data.chunk, A = b.data.visemes ?? [], P = b.data.words ?? [], B = b.data.is_new_segment ?? !1;
@@ -698,14 +698,14 @@ function Pt(e, t = be) {
698
698
  }
699
699
  };
700
700
  for (; ; ) {
701
- const { done: x, value: b } = await j.read();
701
+ const { done: C, value: b } = await j.read();
702
702
  b && (T += y.decode(b, { stream: !0 }));
703
703
  const D = T.split(`
704
704
 
705
705
  `);
706
706
  T = D.pop() ?? "";
707
707
  for (const A of D) await g(A);
708
- if (x) {
708
+ if (C) {
709
709
  T.trim() && await g(T.trim()), _.markStreamComplete(r);
710
710
  break;
711
711
  }
@@ -721,15 +721,15 @@ function Pt(e, t = be) {
721
721
  getStreamMood: () => o,
722
722
  getPlaybackElapsedMs: () => _.getPlaybackElapsedMs(),
723
723
  isSpeaking: () => _.isSpeaking(),
724
- setPlaybackSpeed: (k) => {
725
- _.setPlaybackSpeed(k);
724
+ setPlaybackSpeed: (S) => {
725
+ _.setPlaybackSpeed(S);
726
726
  },
727
727
  getPlaybackSpeed: () => _.getPlaybackSpeed(),
728
- subscribe: (k) => (l.add(k), () => l.delete(k))
728
+ subscribe: (S) => (l.add(S), () => l.delete(S))
729
729
  };
730
730
  }
731
731
  const rn = 16e3, sn = 24e3;
732
- class kr extends An {
732
+ class kr extends In {
733
733
  constructor() {
734
734
  super(
735
735
  !0,
@@ -745,32 +745,32 @@ class kr extends An {
745
745
  bufferBotAudio(t, n) {
746
746
  }
747
747
  }
748
- const Sr = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
749
- function vr(e) {
750
- return Sr.test(e.trim());
751
- }
748
+ const vr = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
752
749
  function br(e) {
750
+ return vr.test(e.trim());
751
+ }
752
+ function Tr(e) {
753
753
  const t = e.replace(/\/$/, "");
754
754
  return t.startsWith("https://") ? `wss://${t.slice(8)}` : t.startsWith("http://") ? `ws://${t.slice(7)}` : t;
755
755
  }
756
- function Tr(e) {
756
+ function Ar(e) {
757
757
  if (e.wsUrl?.trim()) return e.wsUrl.trim();
758
758
  const t = e.authToken?.trim();
759
759
  if (!t)
760
760
  throw new Error(
761
761
  "Voice connect requires authToken (same JWT as SSE Authorization Bearer)."
762
762
  );
763
- const n = e.apiBase ?? be, r = new URL(`${br(n)}/ws/voice`);
763
+ const n = e.apiBase ?? be, r = new URL(`${Tr(n)}/ws/voice`);
764
764
  r.searchParams.set("authToken", t);
765
765
  const s = e.voiceId?.trim();
766
- s && vr(s) && r.searchParams.set("voiceId", s);
767
- const i = e.speakingRate ?? ft;
766
+ s && br(s) && r.searchParams.set("voiceId", s);
767
+ const i = e.speakingRate ?? dt;
768
768
  return r.searchParams.set(
769
769
  "speaking_rate",
770
770
  String(Math.max(en, Math.min(tn, i)))
771
771
  ), e.ttsStream === !1 ? r.searchParams.set("tts_stream", "false") : r.searchParams.set("tts_stream", "true"), r.toString();
772
772
  }
773
- function Bt(e, t) {
773
+ function Lt(e, t) {
774
774
  if (!Array.isArray(e)) return [];
775
775
  const n = [];
776
776
  for (const r of e)
@@ -784,14 +784,14 @@ function Bt(e, t) {
784
784
  });
785
785
  return n;
786
786
  }
787
- function Ar(e) {
787
+ function Ir(e) {
788
788
  if (!e || typeof e != "object") return null;
789
789
  const t = e, n = t.data;
790
790
  return n && typeof n == "object" ? n : t;
791
791
  }
792
- function Ir(e, t = {}) {
792
+ function Rr(e, t = {}) {
793
793
  const n = [], r = [], s = [], i = [];
794
- let o = "", a = "neutral", f = Ae, l = !1, w = null, _ = null, m = { ...t }, S = 0, k = null;
794
+ let o = "", a = "neutral", f = Ae, l = !1, w = null, _ = null, m = { ...t }, k = 0, S = null;
795
795
  const u = /* @__PURE__ */ new Set(), p = [];
796
796
  let d = !1, I = null;
797
797
  const E = () => u.forEach((c) => c()), R = Zt(
@@ -801,18 +801,18 @@ function Ir(e, t = {}) {
801
801
  onNotify: E
802
802
  },
803
803
  f
804
- ), W = () => {
804
+ ), H = () => {
805
805
  if (I) return I;
806
806
  const c = new MessageChannel();
807
807
  return c.port1.onmessage = () => {
808
808
  const v = p.shift();
809
- v !== void 0 && $(v), p.length > 0 ? c.port2.postMessage(null) : d = !1;
809
+ v !== void 0 && W(v), p.length > 0 ? c.port2.postMessage(null) : d = !1;
810
810
  }, I = c, c;
811
811
  }, V = (c) => {
812
- p.push(c), !d && (d = !0, W().port2.postMessage(null));
813
- }, H = () => R.getPlaybackElapsedMs(), j = (c, v = o) => {
812
+ p.push(c), !d && (d = !0, H().port2.postMessage(null));
813
+ }, $ = () => R.getPlaybackElapsedMs(), j = (c, v = o) => {
814
814
  if (!m.onLipsyncDebug) return;
815
- const L = H(), z = n;
815
+ const L = $(), z = n;
816
816
  m.onLipsyncDebug({
817
817
  event: c,
818
818
  spokenText: v,
@@ -820,32 +820,32 @@ function Ir(e, t = {}) {
820
820
  playbackAnchorPerf: R.getPlaybackStartPerf(),
821
821
  playbackElapsedMs: L,
822
822
  queueLength: z.length,
823
- activeViseme: lt(z, L),
823
+ activeViseme: ft(z, L),
824
824
  segments: i.map((ne) => ({
825
825
  ...ne,
826
826
  visemes: [...ne.visemes]
827
827
  }))
828
828
  });
829
829
  }, y = (c, v) => {
830
- m.onLipsyncDebug && (k = { event: c, spokenText: v }, S === 0 && (S = requestAnimationFrame(() => {
831
- S = 0;
832
- const L = k;
833
- k = null, L && j(L.event, L.spokenText);
830
+ m.onLipsyncDebug && (S = { event: c, spokenText: v }, k === 0 && (k = requestAnimationFrame(() => {
831
+ k = 0;
832
+ const L = S;
833
+ S = null, L && j(L.event, L.spokenText);
834
834
  })));
835
835
  }, T = () => {
836
836
  n.length = 0, r.length = 0, i.length = 0, o = "", a = "neutral", s.length = 0;
837
837
  }, g = () => {
838
838
  R.stop(), T(), y("reset"), E();
839
- }, x = () => {
839
+ }, C = () => {
840
840
  g(), e("idle"), E();
841
841
  }, b = (c, v) => {
842
842
  typeof c.mood == "string" && c.mood.trim() && (a = c.mood.trim()), Array.isArray(c.sentence_emotions) && c.sentence_emotions.length > 0 && (v && (s.length = 0), s.push(
843
- ...Bt(c.sentence_emotions, a)
843
+ ...Lt(c.sentence_emotions, a)
844
844
  ));
845
845
  }, D = (c) => {
846
846
  const v = String(c.spoken_text ?? c.text ?? "").trim();
847
847
  v && (o = v), R.resetForNewStream(f), typeof c.mood == "string" && c.mood.trim() && (a = c.mood.trim()), s.length = 0, s.push(
848
- ...Bt(c.sentence_emotions, a)
848
+ ...Lt(c.sentence_emotions, a)
849
849
  ), Array.isArray(c.gestures) && c.gestures, y("metadata", v), E();
850
850
  }, A = (c, v, L, z) => {
851
851
  if (!m.onLipsyncDebug) return;
@@ -858,8 +858,8 @@ function Ir(e, t = {}) {
858
858
  isNewSegment: !!c.is_new_segment,
859
859
  chunkDurationMs: c.chunk_duration_ms != null ? Number(c.chunk_duration_ms) : null,
860
860
  receivedAtMs: performance.now(),
861
- visemes: ne.map((G, ke) => {
862
- const Y = Re[ke];
861
+ visemes: ne.map((G, Se) => {
862
+ const Y = Re[Se];
863
863
  return {
864
864
  rawSymbol: String(Y?.symbol ?? Y?.viseme ?? G.viseme).trim(),
865
865
  viseme: G.viseme,
@@ -906,8 +906,8 @@ function Ir(e, t = {}) {
906
906
  L,
907
907
  c.visemes ?? []
908
908
  ), y("lipsync", v), E();
909
- }, $ = (c) => {
910
- const v = Ar(c);
909
+ }, W = (c) => {
910
+ const v = Ir(c);
911
911
  if (!v) {
912
912
  console.warn("[realtimeVoice] server message with no payload", c);
913
913
  return;
@@ -935,8 +935,8 @@ function Ir(e, t = {}) {
935
935
  );
936
936
  break;
937
937
  }
938
- }, U = () => w || (_ = new kr(), w = new bn({
939
- transport: new Tn({
938
+ }, U = () => w || (_ = new kr(), w = new Tn({
939
+ transport: new An({
940
940
  mediaManager: _,
941
941
  recorderSampleRate: rn,
942
942
  playerSampleRate: sn
@@ -948,7 +948,7 @@ function Ir(e, t = {}) {
948
948
  l = !0, e("idle"), E();
949
949
  },
950
950
  onDisconnected: () => {
951
- l = !1, x();
951
+ l = !1, C();
952
952
  },
953
953
  onError: (c) => {
954
954
  const v = typeof c == "object" && c !== null && "data" in c ? String(c.data ?? c) : String(c);
@@ -1005,7 +1005,7 @@ function Ir(e, t = {}) {
1005
1005
  e("loading");
1006
1006
  const v = U();
1007
1007
  await v.initDevices();
1008
- const L = Tr(m);
1008
+ const L = Ar(m);
1009
1009
  console.info("[realtimeVoice] connecting (avatar_audio_chunk RTVI):", L);
1010
1010
  try {
1011
1011
  await v.connect({ wsUrl: L });
@@ -1023,7 +1023,7 @@ function Ir(e, t = {}) {
1023
1023
  } catch (c) {
1024
1024
  console.error("[realtimeVoice] disconnect failed:", c);
1025
1025
  }
1026
- l = !1, x();
1026
+ l = !1, C();
1027
1027
  },
1028
1028
  isConnected: () => l,
1029
1029
  unlockAudio: async () => {
@@ -1033,7 +1033,7 @@ function Ir(e, t = {}) {
1033
1033
  getWordQueue: () => r,
1034
1034
  getSentenceEmotions: () => s,
1035
1035
  getStreamMood: () => a,
1036
- getPlaybackElapsedMs: H,
1036
+ getPlaybackElapsedMs: $,
1037
1037
  isSpeaking: () => R.isSpeaking(),
1038
1038
  setPlaybackSpeed: (c) => {
1039
1039
  R.setPlaybackSpeed(c);
@@ -1042,13 +1042,13 @@ function Ir(e, t = {}) {
1042
1042
  subscribe: (c) => (u.add(c), () => u.delete(c))
1043
1043
  };
1044
1044
  }
1045
- function Rr(e, t, n) {
1045
+ function Dr(e, t, n) {
1046
1046
  return {
1047
1047
  width: e.crop?.source_width ?? t,
1048
1048
  height: e.crop?.source_height ?? n
1049
1049
  };
1050
1050
  }
1051
- function Dr(e, t) {
1051
+ function Mr(e, t) {
1052
1052
  const n = e.crop;
1053
1053
  return {
1054
1054
  x: t?.source_x ?? n?.x ?? 0,
@@ -1057,21 +1057,21 @@ function Dr(e, t) {
1057
1057
  height: t?.source_h ?? n?.height ?? e.frame_height ?? 0
1058
1058
  };
1059
1059
  }
1060
- function Mr(e) {
1060
+ function Cr(e) {
1061
1061
  return e ? (e.w ?? 0) > 0 && (e.h ?? 0) > 0 : !1;
1062
1062
  }
1063
1063
  async function Ye(e, t) {
1064
1064
  const n = await fetch(e);
1065
1065
  if (!n.ok) throw new Error(`Failed to load encrypted asset: ${e}`);
1066
1066
  const r = await n.arrayBuffer();
1067
- return Gn(r, t);
1067
+ return zn(r, t);
1068
1068
  }
1069
1069
  async function xr(e, t) {
1070
1070
  if (!t) throw new Error("Missing asset key for encrypted JSON");
1071
1071
  const n = await Ye(e, t), r = new TextDecoder().decode(n);
1072
1072
  return JSON.parse(r);
1073
1073
  }
1074
- async function Cr(e) {
1074
+ async function Pr(e) {
1075
1075
  const t = new Blob([e], { type: "image/webp" }), n = URL.createObjectURL(t);
1076
1076
  return new Promise((r, s) => {
1077
1077
  const i = new Image();
@@ -1082,7 +1082,7 @@ async function Cr(e) {
1082
1082
  }, i.src = n;
1083
1083
  });
1084
1084
  }
1085
- async function Pr(e) {
1085
+ async function Br(e) {
1086
1086
  const t = new Blob([e], { type: "image/png" }), n = URL.createObjectURL(t);
1087
1087
  return new Promise((r, s) => {
1088
1088
  const i = new Image();
@@ -1093,18 +1093,18 @@ async function Pr(e) {
1093
1093
  }, i.src = n;
1094
1094
  });
1095
1095
  }
1096
- function Br(e) {
1096
+ function Lr(e) {
1097
1097
  const t = new Blob([e], { type: "video/mp4" });
1098
1098
  return URL.createObjectURL(t);
1099
1099
  }
1100
- async function Lr(e) {
1101
- const t = Xn();
1100
+ async function Or(e) {
1101
+ const t = Zn();
1102
1102
  if (!Ge()) return t;
1103
1103
  if (!e) throw new Error("Missing asset key for encrypted idle video");
1104
1104
  const n = await Ye(t, e);
1105
- return Br(n);
1105
+ return Lr(n);
1106
1106
  }
1107
- function dt(e, t) {
1107
+ function ht(e, t) {
1108
1108
  return `${e}/${t}_minus_sil.png`;
1109
1109
  }
1110
1110
  const on = 5;
@@ -1114,7 +1114,7 @@ function an(e) {
1114
1114
  const n = e?.crop?.content_threshold;
1115
1115
  return typeof n == "number" && n > 0 ? n : on;
1116
1116
  }
1117
- const qs = [
1117
+ const Gs = [
1118
1118
  "aa",
1119
1119
  "E",
1120
1120
  "I",
@@ -1133,7 +1133,7 @@ const qs = [
1133
1133
  "t01_0.25",
1134
1134
  "t02_0.50",
1135
1135
  "t03_0.75"
1136
- ], Or = it.length, Lt = /* @__PURE__ */ new Set([
1136
+ ], Fr = it.length, Ot = /* @__PURE__ */ new Set([
1137
1137
  "aa__kk",
1138
1138
  "aa__nn",
1139
1139
  "aa__sil",
@@ -1240,16 +1240,16 @@ const qs = [
1240
1240
  "U__nn",
1241
1241
  "U__sil"
1242
1242
  ]);
1243
- function Ot(e, t) {
1243
+ function Ft(e, t) {
1244
1244
  return `${e}__${t}`;
1245
1245
  }
1246
- function Ft(e, t) {
1246
+ function Ut(e, t) {
1247
1247
  return `pairs/${e}/${t}_minus_sil.png`;
1248
1248
  }
1249
1249
  function Ke(e) {
1250
1250
  return `${e}_minus_sil.png`;
1251
1251
  }
1252
- function Fr(e, t) {
1252
+ function Ur(e, t) {
1253
1253
  if (t.has(e)) return e;
1254
1254
  const n = /^pairs\/([^/]+)\//.exec(e);
1255
1255
  if (!n) return null;
@@ -1261,33 +1261,33 @@ function Fr(e, t) {
1261
1261
  function cn(e, t) {
1262
1262
  return e.filter((n) => t.has(n));
1263
1263
  }
1264
- function Ur(e, t, n) {
1265
- const r = ht(e, t);
1264
+ function Nr(e, t, n) {
1265
+ const r = mt(e, t);
1266
1266
  return cn(r, n).length > 0;
1267
1267
  }
1268
- function ht(e, t) {
1268
+ function mt(e, t) {
1269
1269
  if (e === t) return [];
1270
- const n = [], r = Ot(e, t);
1271
- if (Lt.has(r)) {
1270
+ const n = [], r = Ft(e, t);
1271
+ if (Ot.has(r)) {
1272
1272
  for (const i of it)
1273
- n.push(Ft(r, i));
1273
+ n.push(Ut(r, i));
1274
1274
  return n;
1275
1275
  }
1276
- const s = Ot(t, e);
1277
- if (Lt.has(s)) {
1278
- for (let i = Or - 1; i >= 0; i--)
1279
- n.push(Ft(s, it[i]));
1276
+ const s = Ft(t, e);
1277
+ if (Ot.has(s)) {
1278
+ for (let i = Fr - 1; i >= 0; i--)
1279
+ n.push(Ut(s, it[i]));
1280
1280
  return n;
1281
1281
  }
1282
1282
  return [];
1283
1283
  }
1284
- function Nr(e) {
1284
+ function Vr(e) {
1285
1285
  return e < 16 ? [] : e < 35 ? [1] : e < 51 ? [0, 2] : [0, 1, 2];
1286
1286
  }
1287
- function Vr(e, t) {
1288
- return Nr(t).map((r) => e[r]).filter((r) => r != null);
1287
+ function $r(e, t) {
1288
+ return Vr(t).map((r) => e[r]).filter((r) => r != null);
1289
1289
  }
1290
- function $r(e, t, n, r) {
1290
+ function Wr(e, t, n, r) {
1291
1291
  if (r <= 0) return 0;
1292
1292
  const i = Math.max(1, n - t) / r, o = e - t, a = Math.floor(o / i);
1293
1293
  return Math.min(r - 1, Math.max(0, a));
@@ -1297,18 +1297,18 @@ function Hr(e, t, n) {
1297
1297
  const r = t.split("/").pop() ?? t, s = r.includes(".") ? r.slice(0, r.lastIndexOf(".")) : r;
1298
1298
  return `${e}/${s}.bin`;
1299
1299
  }
1300
- const Wr = [0.32, 0.24, 0.16, 0.08, 0], qr = Wr.map(
1300
+ const qr = [0.32, 0.24, 0.16, 0.08, 0], Kr = qr.map(
1301
1301
  (e) => `eyes_${e.toFixed(2)}`
1302
- ), Kr = [
1302
+ ), jr = [
1303
1303
  "eyes_0.32",
1304
1304
  "eyes_0.16",
1305
1305
  "eyes_0.00"
1306
- ], jr = [
1306
+ ], Gr = [
1307
1307
  "eyes_0.32",
1308
1308
  "eyes_0.16",
1309
1309
  "eyes_0.08",
1310
1310
  "eyes_0.00"
1311
- ], Ut = 2, Gr = -30, ot = 20, zr = {
1311
+ ], Nt = 2, zr = -30, ot = 20, Yr = {
1312
1312
  fear: -30,
1313
1313
  anger: -20,
1314
1314
  sad: -10,
@@ -1317,24 +1317,24 @@ const Wr = [0.32, 0.24, 0.16, 0.08, 0], qr = Wr.map(
1317
1317
  happy: 0,
1318
1318
  disgust: 20
1319
1319
  };
1320
- function mt(e) {
1320
+ function wt(e) {
1321
1321
  return `brow_${e}`;
1322
1322
  }
1323
- function wt(e) {
1324
- return zr[e];
1323
+ function gt(e) {
1324
+ return Yr[e];
1325
1325
  }
1326
1326
  function ye(e) {
1327
- return Math.max(Gr, Math.min(ot, e));
1327
+ return Math.max(zr, Math.min(ot, e));
1328
1328
  }
1329
- function Yr(e, t) {
1329
+ function Jr(e, t) {
1330
1330
  if (e === t) return [];
1331
- const n = e < t ? Ut : -Ut, r = [];
1331
+ const n = e < t ? Nt : -Nt, r = [];
1332
1332
  let s = e;
1333
1333
  for (; s !== t; )
1334
1334
  s += n, r.push(s);
1335
1335
  return r;
1336
1336
  }
1337
- const Jr = {
1337
+ const Qr = {
1338
1338
  fear: "fear",
1339
1339
  afraid: "fear",
1340
1340
  anxiety: "fear",
@@ -1359,61 +1359,61 @@ const Jr = {
1359
1359
  };
1360
1360
  function ve(e, t = "neutral") {
1361
1361
  const n = String(e ?? "").trim().toLowerCase();
1362
- return n ? Jr[n] ?? t : t;
1362
+ return n ? Qr[n] ?? t : t;
1363
1363
  }
1364
1364
  function un(e) {
1365
- return e === 0 ? null : dt(mt(e), "eyes_standard");
1365
+ return e === 0 ? null : ht(wt(e), "eyes_standard");
1366
1366
  }
1367
1367
  function ln(e) {
1368
- return un(wt(e));
1368
+ return un(gt(e));
1369
1369
  }
1370
- function Nt(e, t) {
1371
- const n = mt(wt(e));
1372
- return !t || t === "eyes_standard" ? ln(e) : e === "neutral" && t === "eyes_standard" ? null : dt(n, t);
1370
+ function Vt(e, t) {
1371
+ const n = wt(gt(e));
1372
+ return !t || t === "eyes_standard" ? ln(e) : e === "neutral" && t === "eyes_standard" ? null : ht(n, t);
1373
1373
  }
1374
- function Qr(e, t) {
1374
+ function Xr(e, t) {
1375
1375
  const n = [];
1376
1376
  for (const r of t)
1377
- n.push(Nt(e, r));
1377
+ n.push(Vt(e, r));
1378
1378
  for (let r = t.length - 2; r >= 0; r--)
1379
- n.push(Nt(e, t[r]));
1379
+ n.push(Vt(e, t[r]));
1380
1380
  return n.push(ln(e)), n;
1381
1381
  }
1382
- function Xr(e) {
1383
- return e === 0 ? null : dt(mt(e), "eyes_standard");
1382
+ function Zr(e) {
1383
+ return e === 0 ? null : ht(wt(e), "eyes_standard");
1384
1384
  }
1385
- function Zr(e, t) {
1386
- return Yr(e, t).map(Xr).filter((n) => n != null);
1385
+ function es(e, t) {
1386
+ return Jr(e, t).map(Zr).filter((n) => n != null);
1387
1387
  }
1388
- const es = 6;
1389
- function ts(e, t) {
1388
+ const ts = 6;
1389
+ function ns(e, t) {
1390
1390
  for (const n of e)
1391
1391
  if (t >= n.wtime && t < n.wtime + n.wduration)
1392
1392
  return n;
1393
1393
  return null;
1394
1394
  }
1395
- function ns(e) {
1395
+ function rs(e) {
1396
1396
  const t = ye(e);
1397
- return t >= ot ? ot : ye(t + es);
1397
+ return t >= ot ? ot : ye(t + ts);
1398
1398
  }
1399
- function rs(e, t, n) {
1399
+ function ss(e, t, n) {
1400
1400
  const r = ye(n);
1401
- return ts(t, e)?.emphasis ? ns(r) : r;
1401
+ return ns(t, e)?.emphasis ? rs(r) : r;
1402
1402
  }
1403
- function Vt(e) {
1403
+ function $t(e) {
1404
1404
  if (!e) return 0;
1405
1405
  const t = e.match(/^brow_(-?\d+)\//);
1406
1406
  if (!t?.[1]) return null;
1407
1407
  const n = Number.parseInt(t[1], 10);
1408
1408
  return Number.isFinite(n) ? ye(n) : null;
1409
1409
  }
1410
- function Oe(e, t) {
1410
+ function Fe(e, t) {
1411
1411
  return e + Math.random() * (t - e);
1412
1412
  }
1413
- function We() {
1414
- return Oe(14, 32);
1413
+ function He() {
1414
+ return Fe(14, 32);
1415
1415
  }
1416
- function ss(e = {}) {
1416
+ function is(e = {}) {
1417
1417
  const {
1418
1418
  initialDelayMs: t = 800 + Math.random() * 1200,
1419
1419
  intervalMinMs: n = 2200,
@@ -1425,52 +1425,52 @@ function ss(e = {}) {
1425
1425
  postEmotionChangeDelayMs: f = 380,
1426
1426
  minDwellMs: l = 550
1427
1427
  } = e;
1428
- let w = "neutral", _ = "neutral", m = 0, S = 0, k = 0, u = {
1428
+ let w = "neutral", _ = "neutral", m = 0, k = 0, S = 0, u = {
1429
1429
  kind: "idle",
1430
1430
  nextBlinkAt: performance.now() + t
1431
1431
  }, p = null, d = "__eyes_open__|neutral|brow:0";
1432
1432
  function I(y = w) {
1433
- d = `${p ?? "__eyes_open__"}|${y}|brow:${S}`;
1433
+ d = `${p ?? "__eyes_open__"}|${y}|brow:${k}`;
1434
1434
  }
1435
1435
  function E(y, T = w) {
1436
1436
  p = y;
1437
- const g = Vt(y);
1438
- g != null ? S = g : y == null && (S = 0), I(T);
1437
+ const g = $t(y);
1438
+ g != null ? k = g : y == null && (k = 0), I(T);
1439
1439
  }
1440
1440
  function R(y) {
1441
1441
  return un(y);
1442
1442
  }
1443
- function W(y, T, g) {
1444
- const x = ye(T), b = ye(g);
1445
- if (m = b, x === b) {
1443
+ function H(y, T, g) {
1444
+ const C = ye(T), b = ye(g);
1445
+ if (m = b, C === b) {
1446
1446
  E(R(b));
1447
1447
  return;
1448
1448
  }
1449
1449
  const D = [
1450
- ...Zr(x, b),
1450
+ ...es(C, b),
1451
1451
  R(b)
1452
1452
  ];
1453
1453
  u = {
1454
1454
  kind: "browBlend",
1455
1455
  paths: D,
1456
1456
  index: 0,
1457
- holdUntil: y + We(),
1457
+ holdUntil: y + He(),
1458
1458
  targetBrow: b
1459
1459
  }, E(D[0] ?? null);
1460
1460
  }
1461
1461
  function V(y, T) {
1462
1462
  u = {
1463
1463
  kind: "idle",
1464
- nextBlinkAt: y + Oe(n, r)
1464
+ nextBlinkAt: y + Fe(n, r)
1465
1465
  }, _ = T, E(R(m), T);
1466
1466
  }
1467
- function H(y, T, g) {
1468
- const x = g ? Kr : Math.random() < a ? qr : jr;
1467
+ function $(y, T, g) {
1468
+ const C = g ? jr : Math.random() < a ? Kr : Gr;
1469
1469
  u = {
1470
1470
  kind: "playing",
1471
- paths: Qr(T, x),
1471
+ paths: Xr(T, C),
1472
1472
  index: 0,
1473
- holdUntil: y + We(),
1473
+ holdUntil: y + He(),
1474
1474
  after: "idle",
1475
1475
  blinkEmotion: T
1476
1476
  }, _ = T, E(u.paths[0] ?? null, T);
@@ -1478,25 +1478,25 @@ function ss(e = {}) {
1478
1478
  function j(y) {
1479
1479
  if (u.kind === "browBlend") {
1480
1480
  for (; y >= u.holdUntil && u.index < u.paths.length - 1; )
1481
- u.index += 1, u.holdUntil = y + We();
1481
+ u.index += 1, u.holdUntil = y + He();
1482
1482
  const T = u.paths[u.index] ?? null;
1483
- E(T), y >= u.holdUntil && u.index >= u.paths.length - 1 && (S = u.targetBrow, m = u.targetBrow, E(R(u.targetBrow)), u = {
1483
+ E(T), y >= u.holdUntil && u.index >= u.paths.length - 1 && (k = u.targetBrow, m = u.targetBrow, E(R(u.targetBrow)), u = {
1484
1484
  kind: "idle",
1485
1485
  nextBlinkAt: y + f
1486
1486
  });
1487
1487
  return;
1488
1488
  }
1489
1489
  if (u.kind === "idle") {
1490
- E(R(m), _), y >= u.nextBlinkAt && H(y, _, !1);
1490
+ E(R(m), _), y >= u.nextBlinkAt && $(y, _, !1);
1491
1491
  return;
1492
1492
  }
1493
1493
  if (u.kind === "doublePause") {
1494
- E(R(m), u.blinkEmotion), y >= u.resumeAt && H(y, u.blinkEmotion, !0);
1494
+ E(R(m), u.blinkEmotion), y >= u.resumeAt && $(y, u.blinkEmotion, !0);
1495
1495
  return;
1496
1496
  }
1497
1497
  if (u.kind === "playing") {
1498
1498
  for (; y >= u.holdUntil && u.index < u.paths.length - 1; )
1499
- u.index += 1, u.holdUntil = y + We();
1499
+ u.index += 1, u.holdUntil = y + He();
1500
1500
  if (E(u.paths[u.index] ?? null, u.blinkEmotion), y >= u.holdUntil && u.index >= u.paths.length - 1) {
1501
1501
  if (u.after === "resumeIdle") {
1502
1502
  V(y + f, w);
@@ -1505,7 +1505,7 @@ function ss(e = {}) {
1505
1505
  if (u.after === "doublePause") {
1506
1506
  u = {
1507
1507
  kind: "doublePause",
1508
- resumeAt: y + Oe(i, o),
1508
+ resumeAt: y + Fe(i, o),
1509
1509
  blinkEmotion: u.blinkEmotion
1510
1510
  }, E(R(m), u.blinkEmotion);
1511
1511
  return;
@@ -1513,7 +1513,7 @@ function ss(e = {}) {
1513
1513
  if (u.after === "idle" && Math.random() < s) {
1514
1514
  u = {
1515
1515
  kind: "doublePause",
1516
- resumeAt: y + Oe(i, o),
1516
+ resumeAt: y + Fe(i, o),
1517
1517
  blinkEmotion: u.blinkEmotion
1518
1518
  }, E(R(m), u.blinkEmotion);
1519
1519
  return;
@@ -1528,27 +1528,27 @@ function ss(e = {}) {
1528
1528
  const T = ve(y, w);
1529
1529
  if (T === w) return;
1530
1530
  const g = performance.now();
1531
- l > 0 && T !== w && !(w === "neutral" && T !== "neutral") && g - k < l || (w = T, _ = T, k = g);
1531
+ l > 0 && T !== w && !(w === "neutral" && T !== "neutral") && g - S < l || (w = T, _ = T, S = g);
1532
1532
  },
1533
1533
  setTargetEyebrow(y) {
1534
1534
  const T = ye(y);
1535
1535
  if (T === m && u.kind !== "browBlend") return;
1536
- const g = performance.now(), x = u.kind === "browBlend" ? Vt(p) ?? S : S;
1537
- m = T, !(T === x && u.kind !== "browBlend") && (u.kind === "playing" || u.kind === "doublePause" || W(g, x, T));
1536
+ const g = performance.now(), C = u.kind === "browBlend" ? $t(p) ?? k : k;
1537
+ m = T, !(T === C && u.kind !== "browBlend") && (u.kind === "playing" || u.kind === "doublePause" || H(g, C, T));
1538
1538
  },
1539
1539
  getTargetEmotion: () => w,
1540
1540
  getTargetEyebrow: () => m,
1541
1541
  getExpressionPath: () => p,
1542
1542
  getDrawKey: () => d,
1543
1543
  reset() {
1544
- w = "neutral", _ = "neutral", m = 0, S = 0, k = 0, V(
1545
- performance.now() + Oe(n, r),
1544
+ w = "neutral", _ = "neutral", m = 0, k = 0, S = 0, V(
1545
+ performance.now() + Fe(n, r),
1546
1546
  "neutral"
1547
1547
  );
1548
1548
  }
1549
1549
  };
1550
1550
  }
1551
- function is() {
1551
+ function os() {
1552
1552
  const e = document.createElement("video");
1553
1553
  e.muted = !0, e.playsInline = !0, e.preload = "auto", e.setAttribute("playsinline", ""), e.loop = !0;
1554
1554
  let t = !1, n = null, r = "";
@@ -1591,17 +1591,17 @@ function is() {
1591
1591
  }
1592
1592
  };
1593
1593
  }
1594
- const os = 50, fn = 400;
1595
- function as(e, t, n) {
1594
+ const as = 50, fn = 400;
1595
+ function cs(e, t, n) {
1596
1596
  return e.filter((r) => {
1597
1597
  const s = r.queueIndex ?? -1;
1598
1598
  return s >= t && s <= n;
1599
1599
  });
1600
1600
  }
1601
- function cs(e, t) {
1601
+ function us(e, t) {
1602
1602
  const n = [];
1603
1603
  for (const r of e) {
1604
- const s = as(
1604
+ const s = cs(
1605
1605
  t,
1606
1606
  r.start_word,
1607
1607
  r.end_word
@@ -1610,18 +1610,18 @@ function cs(e, t) {
1610
1610
  const i = s[0], o = s[s.length - 1];
1611
1611
  n.push({
1612
1612
  sentence: r,
1613
- startMs: Math.max(0, i.wtime - os),
1613
+ startMs: Math.max(0, i.wtime - as),
1614
1614
  endMs: o.wtime + o.wduration + fn
1615
1615
  });
1616
1616
  }
1617
1617
  return n.sort((r, s) => r.startMs - s.startMs);
1618
1618
  }
1619
- function us(e, t, n, r = "neutral") {
1619
+ function ls(e, t, n, r = "neutral") {
1620
1620
  const s = ve(r);
1621
1621
  if (t.length === 0) return s;
1622
1622
  if (n.length === 0 || e < n[0].wtime)
1623
1623
  return ve(t[0]?.emotion, s);
1624
- const i = cs(t, n);
1624
+ const i = us(t, n);
1625
1625
  let o = null;
1626
1626
  for (const l of i)
1627
1627
  e >= l.startMs && e <= l.endMs && (o = l);
@@ -1642,45 +1642,45 @@ function dn(e, t, n, r, s = on) {
1642
1642
  for (const _ of t) {
1643
1643
  w.clearRect(0, 0, n, r), w.drawImage(_, 0, 0, n, r);
1644
1644
  const m = w.getImageData(0, 0, n, r);
1645
- for (let S = 0; S < f.data.length; S += 4) {
1646
- const k = m.data[S], u = m.data[S + 1], p = m.data[S + 2];
1647
- Math.max(k, u, p) > s && (f.data[S] = k, f.data[S + 1] = u, f.data[S + 2] = p, f.data[S + 3] = 255);
1645
+ for (let k = 0; k < f.data.length; k += 4) {
1646
+ const S = m.data[k], u = m.data[k + 1], p = m.data[k + 2];
1647
+ Math.max(S, u, p) > s && (f.data[k] = S, f.data[k + 1] = u, f.data[k + 2] = p, f.data[k + 3] = 255);
1648
1648
  }
1649
1649
  }
1650
1650
  return o.putImageData(f, 0, 0), i;
1651
1651
  }
1652
- let pe = null, Fe = null;
1652
+ let pe = null, Ue = null;
1653
1653
  const je = /* @__PURE__ */ new Map();
1654
- function ls() {
1655
- pe = null, Fe = null, je.clear();
1654
+ function fs() {
1655
+ pe = null, Ue = null, je.clear();
1656
1656
  }
1657
- Qn(ls);
1658
- function fs(e) {
1659
- return e ?? Fe ?? void 0;
1657
+ Xn(fs);
1658
+ function ds(e) {
1659
+ return e ?? Ue ?? void 0;
1660
1660
  }
1661
- function gt(e) {
1661
+ function _t(e) {
1662
1662
  return new Promise((t, n) => {
1663
1663
  const r = new Image();
1664
1664
  r.decoding = "async", r.onload = () => t(r), r.onerror = () => n(new Error(`Failed to load image: ${e}`)), r.src = e;
1665
1665
  });
1666
1666
  }
1667
- async function ds(e) {
1668
- return Ge() ? Pr(
1669
- await Ye(Mt(), e ?? "")
1670
- ) : gt(Mt());
1667
+ async function hs(e) {
1668
+ return Ge() ? Br(
1669
+ await Ye(Ct(), e ?? "")
1670
+ ) : _t(Ct());
1671
1671
  }
1672
- async function $t(e, t, n, r) {
1672
+ async function Wt(e, t, n, r) {
1673
1673
  const s = n ? await xr(e, r) : await fetch(e).then((l) => {
1674
1674
  if (!l.ok) throw new Error(`Failed to load ${e}`);
1675
1675
  return l.json();
1676
1676
  }), i = s.sheets?.[0];
1677
1677
  if (!i?.path) throw new Error(`${e} has no sheets[0].path`);
1678
- const o = n ? await Cr(
1678
+ const o = n ? await Pr(
1679
1679
  await Ye(
1680
1680
  Hr(t, i.path, n),
1681
1681
  r ?? ""
1682
1682
  )
1683
- ) : await gt(`${t}/${i.path}`), a = /* @__PURE__ */ new Map();
1683
+ ) : await _t(`${t}/${i.path}`), a = /* @__PURE__ */ new Map();
1684
1684
  for (const l of s.cells ?? [])
1685
1685
  l.path && a.set(l.path, l);
1686
1686
  const f = /* @__PURE__ */ new Map();
@@ -1689,29 +1689,29 @@ async function $t(e, t, n, r) {
1689
1689
  return { atlas: o, atlasMeta: s, cellByPath: a, sheetByIndex: f, diffBase: t };
1690
1690
  }
1691
1691
  async function at(e) {
1692
- const t = fs(e), n = Ge();
1692
+ const t = ds(e), n = Ge();
1693
1693
  if (n && !t)
1694
1694
  throw new Error("Encrypted assets enabled but no key provided");
1695
- if (pe && (!n || Fe === (t ?? null))) {
1695
+ if (pe && (!n || Ue === (t ?? null))) {
1696
1696
  const i = await pe;
1697
1697
  return {
1698
- ...Ue(i),
1698
+ ...Ne(i),
1699
1699
  visemePaths: [...i.viseme.cellByPath.keys()]
1700
1700
  };
1701
1701
  }
1702
- Fe = t ?? null, je.clear();
1703
- const r = Zn();
1702
+ Ue = t ?? null, je.clear();
1703
+ const r = er();
1704
1704
  pe = (async () => {
1705
- const i = await ds(t), o = await $t(
1706
- er(),
1705
+ const i = await hs(t), o = await Wt(
1706
+ tr(),
1707
1707
  r,
1708
1708
  n,
1709
1709
  t
1710
1710
  );
1711
1711
  let a = null;
1712
1712
  try {
1713
- a = await $t(
1714
- tr(),
1713
+ a = await Wt(
1714
+ nr(),
1715
1715
  r,
1716
1716
  n,
1717
1717
  t
@@ -1722,20 +1722,20 @@ async function at(e) {
1722
1722
  return { sil: i, viseme: o, expression: a };
1723
1723
  })();
1724
1724
  const s = await pe;
1725
- return { ...Ue(s), visemePaths: [...s.viseme.cellByPath.keys()] };
1725
+ return { ...Ne(s), visemePaths: [...s.viseme.cellByPath.keys()] };
1726
1726
  }
1727
1727
  async function hn(e) {
1728
1728
  if (await at(e), !pe) throw new Error("Assets not loaded");
1729
1729
  return pe;
1730
1730
  }
1731
- function Ue(e) {
1732
- return Rr(
1731
+ function Ne(e) {
1732
+ return Dr(
1733
1733
  e.viseme.atlasMeta,
1734
1734
  e.sil.naturalWidth,
1735
1735
  e.sil.naturalHeight
1736
1736
  );
1737
1737
  }
1738
- function hs(e, t) {
1738
+ function ms(e, t) {
1739
1739
  const n = document.createElement("canvas");
1740
1740
  return n.width = t.w, n.height = t.h, n.getContext("2d", { willReadFrequently: !0 }).drawImage(e.atlas, t.x, t.y, t.w, t.h, 0, 0, t.w, t.h), n;
1741
1741
  }
@@ -1745,40 +1745,40 @@ async function Ht(e, t, n) {
1745
1745
  const i = (async () => {
1746
1746
  const o = t.cellByPath.get(n);
1747
1747
  if (!o) throw new Error(`No atlas cell for path: ${n}`);
1748
- const a = Dr(t.atlasMeta, o), f = Ue(e);
1749
- if (Mr(o)) {
1750
- const _ = hs(t, o), m = document.createElement("canvas");
1748
+ const a = Mr(t.atlasMeta, o), f = Ne(e);
1749
+ if (Cr(o)) {
1750
+ const _ = ms(t, o), m = document.createElement("canvas");
1751
1751
  m.width = f.width, m.height = f.height;
1752
- const S = m.getContext("2d");
1753
- return S.fillStyle = "#000", S.fillRect(0, 0, f.width, f.height), S.drawImage(_, a.x, a.y), m;
1752
+ const k = m.getContext("2d");
1753
+ return k.fillStyle = "#000", k.fillRect(0, 0, f.width, f.height), k.drawImage(_, a.x, a.y), m;
1754
1754
  }
1755
- const l = `${t.diffBase}/${n}`, w = await gt(l);
1755
+ const l = `${t.diffBase}/${n}`, w = await _t(l);
1756
1756
  if (w.naturalWidth === f.width && w.naturalHeight === f.height)
1757
1757
  return w;
1758
1758
  throw new Error(`Diff PNG wrong size for ${n}`);
1759
1759
  })();
1760
1760
  return je.set(r, i), i;
1761
1761
  }
1762
- async function Wt(e, t, n, r, s, i) {
1762
+ async function qt(e, t, n, r, s, i) {
1763
1763
  if (s) {
1764
- const { width: S, height: k } = s;
1764
+ const { width: k, height: S } = s;
1765
1765
  if (i && !i() || t.readyState < HTMLMediaElement.HAVE_CURRENT_DATA)
1766
1766
  return;
1767
1767
  const u = document.createElement("canvas");
1768
- u.width = S, u.height = k;
1768
+ u.width = k, u.height = S;
1769
1769
  const p = u.getContext("2d");
1770
- if (p.clearRect(0, 0, S, k), p.drawImage(t, 0, 0, S, k), i && !i()) return;
1771
- (e.width !== S || e.height !== k) && (e.width = S, e.height = k);
1770
+ if (p.clearRect(0, 0, k, S), p.drawImage(t, 0, 0, k, S), i && !i()) return;
1771
+ (e.width !== k || e.height !== S) && (e.width = k, e.height = S);
1772
1772
  const d = e.getContext("2d");
1773
- d.clearRect(0, 0, S, k), d.drawImage(u, 0, 0);
1773
+ d.clearRect(0, 0, k, S), d.drawImage(u, 0, 0);
1774
1774
  return;
1775
1775
  }
1776
- const o = await hn(), a = an(o.viseme.atlasMeta), { width: f, height: l } = Ue(o);
1776
+ const o = await hn(), a = an(o.viseme.atlasMeta), { width: f, height: l } = Ne(o);
1777
1777
  (e.width !== f || e.height !== l) && (e.width = f, e.height = l);
1778
1778
  const w = [], _ = e.getContext("2d");
1779
1779
  if (_.clearRect(0, 0, f, l), t.readyState < HTMLMediaElement.HAVE_CURRENT_DATA) {
1780
- const S = o.sil;
1781
- _.drawImage(S, 0, 0, f, l);
1780
+ const k = o.sil;
1781
+ _.drawImage(k, 0, 0, f, l);
1782
1782
  return;
1783
1783
  }
1784
1784
  if (w.length === 0) {
@@ -1789,11 +1789,11 @@ async function Wt(e, t, n, r, s, i) {
1789
1789
  _.drawImage(m, 0, 0);
1790
1790
  }
1791
1791
  async function ct(e, t, n) {
1792
- const r = await hn(Fe ?? void 0), s = an(r.viseme.atlasMeta), { width: i, height: o } = Ue(r);
1792
+ const r = await hn(Ue ?? void 0), s = an(r.viseme.atlasMeta), { width: i, height: o } = Ne(r);
1793
1793
  (e.width !== i || e.height !== o) && (e.width = i, e.height = o);
1794
1794
  const a = [];
1795
1795
  if (t.mouthPath) {
1796
- const w = new Set(r.viseme.cellByPath.keys()), _ = Fr(t.mouthPath, w) ?? (w.has(t.mouthPath) ? t.mouthPath : null);
1796
+ const w = new Set(r.viseme.cellByPath.keys()), _ = Ur(t.mouthPath, w) ?? (w.has(t.mouthPath) ? t.mouthPath : null);
1797
1797
  _ && a.push(await Ht(r, r.viseme, _));
1798
1798
  }
1799
1799
  t.expressionPath && r.expression && a.push(
@@ -1813,72 +1813,75 @@ async function ct(e, t, n) {
1813
1813
  );
1814
1814
  f.drawImage(l, 0, 0);
1815
1815
  }
1816
- async function ms(e) {
1816
+ async function ws(e) {
1817
1817
  await ct(e, { mouthPath: null, expressionPath: null });
1818
1818
  }
1819
- function ws(e) {
1819
+ function gs(e) {
1820
1820
  const t = /* @__PURE__ */ new Map();
1821
1821
  for (const n of e)
1822
1822
  t.has(n.vtime) || t.set(n.vtime, n);
1823
1823
  return [...t.values()].sort((n, r) => n.vtime - r.vtime);
1824
1824
  }
1825
- function gs(e) {
1826
- const t = ws(e), n = [];
1825
+ function _s(e) {
1826
+ const t = gs(e), n = [];
1827
1827
  for (let r = 0; r < t.length - 1; r++) {
1828
1828
  const s = t[r].viseme, i = t[r + 1].viseme, o = t[r].vtime, a = t[r + 1].vtime;
1829
1829
  s === i || a <= o || n.push({ from: s, to: i, fromVtime: o, toVtime: a });
1830
1830
  }
1831
1831
  return n;
1832
1832
  }
1833
- function _s(e, t) {
1833
+ function ps(e, t) {
1834
1834
  let n = null;
1835
1835
  for (const r of e)
1836
1836
  t >= r.fromVtime && t < r.toVtime && (n = r);
1837
1837
  return n;
1838
1838
  }
1839
- function ps(e, t) {
1839
+ function ys(e, t) {
1840
1840
  return { gapMs: Math.max(0, t - e), holdEnd: e, transStart: e };
1841
1841
  }
1842
- const mn = 400, ys = 200, Es = 600, ks = "__sil__";
1843
- function Ss() {
1842
+ const mn = 400, Es = 200, Ss = 600, wn = "__sil__";
1843
+ function ks(e) {
1844
+ return e.lastDrawnKey ? e.lastDrawnKey.split("|")[0] === wn : !1;
1845
+ }
1846
+ function vs() {
1844
1847
  return { lastDrawnKey: "" };
1845
1848
  }
1846
- function me(e) {
1849
+ function fe(e) {
1847
1850
  e.lastDrawnKey = "", e.transitionCache = void 0;
1848
1851
  }
1849
- function vs(e, t) {
1852
+ function bs(e, t) {
1850
1853
  if (t?.transitionCache && t.transitionCache.queueLength === e.length)
1851
1854
  return t.transitionCache.transitions;
1852
- const n = gs(e);
1855
+ const n = _s(e);
1853
1856
  return t && (t.transitionCache = { queueLength: e.length, transitions: n }), n;
1854
1857
  }
1855
- function bs(e) {
1858
+ function Ts(e) {
1856
1859
  let t = "sil";
1857
1860
  for (const n of e)
1858
1861
  n.viseme !== "sil" && (t = n.viseme);
1859
1862
  return t;
1860
1863
  }
1861
- function Ts(e, t) {
1862
- return e === "sil" ? !1 : t ? Ur(e, "sil", t) : ht(e, "sil").length > 0;
1864
+ function As(e, t) {
1865
+ return e === "sil" ? !1 : t ? Nr(e, "sil", t) : mt(e, "sil").length > 0;
1863
1866
  }
1864
- function As() {
1865
- return mn + Es;
1867
+ function Is() {
1868
+ return mn + Ss;
1866
1869
  }
1867
- function qt(e) {
1868
- return e ?? ks;
1870
+ function Kt(e) {
1871
+ return e ?? wn;
1869
1872
  }
1870
- function Is(e, t, n, r) {
1873
+ function Rs(e, t, n, r) {
1871
1874
  if (e.length === 0)
1872
1875
  return { diffPath: null, label: "sil" };
1873
- const s = vs(e, r), i = _s(s, t);
1876
+ const s = bs(e, r), i = ps(s, t);
1874
1877
  if (i) {
1875
- const a = i.toVtime - i.fromVtime, f = ps(i.fromVtime, i.toVtime);
1878
+ const a = i.toVtime - i.fromVtime, f = ys(i.fromVtime, i.toVtime);
1876
1879
  if (t >= f.transStart && t < i.toVtime) {
1877
- let l = ht(i.from, i.to);
1880
+ let l = mt(i.from, i.to);
1878
1881
  n && (l = cn(l, n));
1879
- const w = Vr(l, a);
1882
+ const w = $r(l, a);
1880
1883
  if (w.length > 0) {
1881
- const _ = $r(
1884
+ const _ = Wr(
1882
1885
  t,
1883
1886
  f.transStart,
1884
1887
  i.toVtime,
@@ -1889,31 +1892,31 @@ function Is(e, t, n, r) {
1889
1892
  return { diffPath: Ke(i.to), label: i.to };
1890
1893
  }
1891
1894
  }
1892
- const o = lt(e, t);
1895
+ const o = ft(e, t);
1893
1896
  return o === "sil" ? { diffPath: null, label: "sil" } : { diffPath: Ke(o), label: o };
1894
1897
  }
1895
- function wn(e, t) {
1896
- const n = t ?? qt(e.expressionPath);
1897
- return `${qt(e.mouthPath)}|${n}`;
1898
+ function gn(e, t) {
1899
+ const n = t ?? Kt(e.expressionPath);
1900
+ return `${Kt(e.mouthPath)}|${n}`;
1898
1901
  }
1899
- function Rs(e, t, n, r, s, i, o, a, f, l) {
1900
- const w = Is(t, n, f, i), _ = {
1902
+ function Ds(e, t, n, r, s, i, o, a, f, l) {
1903
+ const w = Rs(t, n, f, i), _ = {
1901
1904
  mouthPath: w.diffPath,
1902
1905
  expressionPath: r
1903
- }, m = wn(_, s);
1904
- m !== i.lastDrawnKey && (a(w.label), o(e, _, m, (S) => {
1905
- S === m && (i.lastDrawnKey = m);
1906
+ }, m = gn(_, s);
1907
+ m !== i.lastDrawnKey && (a(w.label), o(e, _, m, (k) => {
1908
+ k === m && (i.lastDrawnKey = m);
1906
1909
  }));
1907
1910
  }
1908
- function Kt(e, t, n, r, s, i, o = null) {
1909
- const a = { mouthPath: null, expressionPath: t }, f = o != null ? `|idle@${Math.round(o * 1e3)}` : "", l = wn(a, n) + f;
1911
+ function jt(e, t, n, r, s, i, o = null) {
1912
+ const a = { mouthPath: null, expressionPath: t }, f = o != null ? `|idle@${Math.round(o * 1e3)}` : "", l = gn(a, n) + f;
1910
1913
  !(o != null) && l === r.lastDrawnKey || (i(
1911
1914
  o != null ? "idle" : "sil"
1912
1915
  ), s(e, a, l, (_) => {
1913
1916
  _ === l && (r.lastDrawnKey = l);
1914
1917
  }));
1915
1918
  }
1916
- function gn(e) {
1919
+ function _n(e) {
1917
1920
  let t = 0, n = null, r = !1, s = !1;
1918
1921
  const i = async () => {
1919
1922
  if (!r) {
@@ -1949,9 +1952,9 @@ function gn(e) {
1949
1952
  }
1950
1953
  };
1951
1954
  }
1952
- const jt = -1, Gt = /* @__PURE__ */ new Map();
1953
- async function Ds(e) {
1954
- let t = Gt.get(e);
1955
+ const Gt = -1, zt = /* @__PURE__ */ new Map();
1956
+ async function Ms(e) {
1957
+ let t = zt.get(e);
1955
1958
  if (!t) {
1956
1959
  const n = await fetch(e);
1957
1960
  if (!n.ok)
@@ -1959,11 +1962,11 @@ async function Ds(e) {
1959
1962
  `Failed to fetch worker script (${n.status}): ${e}`
1960
1963
  );
1961
1964
  const r = await n.blob();
1962
- t = URL.createObjectURL(r), Gt.set(e, t);
1965
+ t = URL.createObjectURL(r), zt.set(e, t);
1963
1966
  }
1964
1967
  return new Worker(t, { name: "visemeDiffPreview" });
1965
1968
  }
1966
- function Ms() {
1969
+ function Cs() {
1967
1970
  return typeof Worker < "u" && typeof OffscreenCanvas < "u";
1968
1971
  }
1969
1972
  function xs(e, t) {
@@ -1971,9 +1974,9 @@ function xs(e, t) {
1971
1974
  const n = e.getContext("2d");
1972
1975
  n && n.drawImage(t, 0, 0);
1973
1976
  }
1974
- function zt(e, t) {
1977
+ function Yt(e, t) {
1975
1978
  let n = 0, r = null;
1976
- const s = gn(async (i, o) => (await at(), await ct(e, i), s.isLatestSeq(o)));
1979
+ const s = _n(async (i, o) => (await at(), await ct(e, i), s.isLatestSeq(o)));
1977
1980
  return {
1978
1981
  usesWorker: !1,
1979
1982
  async loadAssets(i) {
@@ -1984,7 +1987,7 @@ function zt(e, t) {
1984
1987
  return r;
1985
1988
  },
1986
1989
  async renderSilOnly() {
1987
- n += 1, s.reset(), await ms(e);
1990
+ n += 1, s.reset(), await ws(e);
1988
1991
  },
1989
1992
  drawLiveFrame(i, o, a, f) {
1990
1993
  s.enqueue(o, a, f);
@@ -2002,12 +2005,12 @@ function zt(e, t) {
2002
2005
  }
2003
2006
  };
2004
2007
  }
2005
- function Cs(e, t, n) {
2008
+ function Ps(e, t, n) {
2006
2009
  let r = null, s = 1, i = 0, o = !1, a = !1, f = null;
2007
- const l = /* @__PURE__ */ new Map(), w = gn(async (p, d, I) => (l.set(d, {
2010
+ const l = /* @__PURE__ */ new Map(), w = _n(async (p, d, I) => (l.set(d, {
2008
2011
  drawKey: I.drawKey,
2009
2012
  onDisplayed: I.onDisplayed
2010
- }), await k(
2013
+ }), await S(
2011
2014
  {
2012
2015
  type: "drawFrame",
2013
2016
  diffPath: p.mouthPath,
@@ -2017,30 +2020,30 @@ function Cs(e, t, n) {
2017
2020
  void 0,
2018
2021
  !0
2019
2022
  ), !1)), _ = (p) => {
2020
- if (p === jt) {
2023
+ if (p === Gt) {
2021
2024
  let E = -1, R;
2022
- for (const [W, V] of l)
2023
- W >= E && (E = W, R = V);
2025
+ for (const [H, V] of l)
2026
+ H >= E && (E = H, R = V);
2024
2027
  E >= 0 && l.delete(E), R?.onDisplayed?.(R.drawKey);
2025
2028
  return;
2026
2029
  }
2027
2030
  const d = -p, I = l.get(d);
2028
2031
  l.delete(d), I?.onDisplayed?.(I.drawKey);
2029
- }, m = /* @__PURE__ */ new Map(), S = (p, d) => {
2032
+ }, m = /* @__PURE__ */ new Map(), k = (p, d) => {
2030
2033
  a || !r || r.postMessage(p, []);
2031
- }, k = (p, d, I = !1) => {
2034
+ }, S = (p, d, I = !1) => {
2032
2035
  if (a) return Promise.resolve();
2033
2036
  const E = s++;
2034
- return new Promise((R, W) => {
2037
+ return new Promise((R, H) => {
2035
2038
  m.set(E, {
2036
2039
  resolve: (V) => R(V),
2037
- reject: W,
2040
+ reject: H,
2038
2041
  generation: typeof p.generation == "number" ? p.generation : void 0,
2039
2042
  expectRenderDone: I
2040
- }), S({ ...p, requestId: E });
2043
+ }), k({ ...p, requestId: E });
2041
2044
  });
2042
2045
  }, u = (async () => {
2043
- r = await Ds(n), r.onmessage = (p) => {
2046
+ r = await Ms(n), r.onmessage = (p) => {
2044
2047
  if (a) return;
2045
2048
  const d = p.data;
2046
2049
  if (d.type === "status") {
@@ -2053,9 +2056,9 @@ function Cs(e, t, n) {
2053
2056
  d.bitmap.close();
2054
2057
  return;
2055
2058
  }
2056
- if (E && !(d.generation === jt)) {
2057
- const W = -d.generation;
2058
- if (!w.isLatestSeq(W)) {
2059
+ if (E && !(d.generation === Gt)) {
2060
+ const H = -d.generation;
2061
+ if (!w.isLatestSeq(H)) {
2059
2062
  d.bitmap.close();
2060
2063
  return;
2061
2064
  }
@@ -2095,7 +2098,7 @@ function Cs(e, t, n) {
2095
2098
  for (const [, I] of m)
2096
2099
  I.reject(new Error(d));
2097
2100
  m.clear();
2098
- }, await k({ type: "init" }), o = !0;
2101
+ }, await S({ type: "init" }), o = !0;
2099
2102
  })();
2100
2103
  return {
2101
2104
  usesWorker: !0,
@@ -2103,10 +2106,10 @@ function Cs(e, t, n) {
2103
2106
  if (a) return { width: 842, height: 1264 };
2104
2107
  if (await u, a) return { width: 842, height: 1264 };
2105
2108
  if (!o) throw new Error("Worker init failed");
2106
- return await k({
2109
+ return await S({
2107
2110
  type: "loadAssets",
2108
2111
  keyHex: p,
2109
- urls: Jn(Ee())
2112
+ urls: Qn(Ee())
2110
2113
  }) ?? { width: 842, height: 1264 };
2111
2114
  },
2112
2115
  getVisemeAtlasPaths() {
@@ -2116,7 +2119,7 @@ function Cs(e, t, n) {
2116
2119
  if (a || (await u, a)) return;
2117
2120
  i += 1, w.reset(), l.clear();
2118
2121
  const p = i;
2119
- await k({ type: "cancelLiveDraws" }), await k(
2122
+ await S({ type: "cancelLiveDraws" }), await S(
2120
2123
  { type: "renderSil", generation: p },
2121
2124
  void 0,
2122
2125
  !0
@@ -2132,7 +2135,7 @@ function Cs(e, t, n) {
2132
2135
  i += 1, w.reset(), l.clear();
2133
2136
  const E = i;
2134
2137
  try {
2135
- await k({ type: "cancelLiveDraws" }), await k(
2138
+ await S({ type: "cancelLiveDraws" }), await S(
2136
2139
  {
2137
2140
  type: "renderViseme",
2138
2141
  generation: E,
@@ -2160,17 +2163,17 @@ function Cs(e, t, n) {
2160
2163
  }
2161
2164
  };
2162
2165
  }
2163
- function Ps(e, t = {}) {
2164
- if (!Ms())
2165
- return zt(e, t);
2166
- const n = Cn(t.workerScriptUrl);
2166
+ function Bs(e, t = {}) {
2167
+ if (!Cs())
2168
+ return Yt(e, t);
2169
+ const n = Pn(t.workerScriptUrl);
2167
2170
  try {
2168
- return Cs(e, t, n);
2171
+ return Ps(e, t, n);
2169
2172
  } catch {
2170
- return zt(e, t);
2173
+ return Yt(e, t);
2171
2174
  }
2172
2175
  }
2173
- class Bs extends Error {
2176
+ class Ls extends Error {
2174
2177
  constructor(t, n) {
2175
2178
  super(`${t} timed out after ${Math.round(n / 1e3)}s`), this.name = "LoadTimeoutError";
2176
2179
  }
@@ -2178,7 +2181,7 @@ class Bs extends Error {
2178
2181
  function tt(e, t, n) {
2179
2182
  return new Promise((r, s) => {
2180
2183
  const i = globalThis.setTimeout(() => {
2181
- s(new Bs(n, t));
2184
+ s(new Ls(n, t));
2182
2185
  }, t);
2183
2186
  e.then(
2184
2187
  (o) => {
@@ -2190,15 +2193,15 @@ function tt(e, t, n) {
2190
2193
  );
2191
2194
  });
2192
2195
  }
2193
- const Ls = {
2196
+ const Os = {
2194
2197
  position: "relative",
2195
2198
  display: "inline-block",
2196
2199
  lineHeight: 0
2197
- }, Os = {
2200
+ }, Fs = {
2198
2201
  display: "block",
2199
2202
  maxWidth: "100%",
2200
2203
  height: "auto"
2201
- }, Fs = {
2204
+ }, Us = {
2202
2205
  position: "absolute",
2203
2206
  inset: 0,
2204
2207
  display: "flex",
@@ -2210,13 +2213,13 @@ const Ls = {
2210
2213
  fontSize: "0.875rem",
2211
2214
  textAlign: "center"
2212
2215
  };
2213
- function Le(e) {
2214
- return On(e) ? Er : nn;
2216
+ function Oe(e) {
2217
+ return Fn(e) ? Sr : nn;
2215
2218
  }
2216
2219
  function we(e, t) {
2217
2220
  return t?.isSpeaking() ? t : e.isSpeaking() ? e : t?.isConnected() ? t : e;
2218
2221
  }
2219
- const Ks = Sn(function({
2222
+ const zs = vn(function({
2220
2223
  id: t,
2221
2224
  avatarId: n,
2222
2225
  faceId: r,
@@ -2224,40 +2227,40 @@ const Ks = Sn(function({
2224
2227
  authToken: i,
2225
2228
  ttsEngineId: o = Te,
2226
2229
  voiceId: a,
2227
- speakingRate: f = ft,
2230
+ speakingRate: f = dt,
2228
2231
  className: l,
2229
2232
  style: w,
2230
2233
  canvasStyle: _,
2231
2234
  onStatusChange: m,
2232
- onDisplayStatus: S,
2233
- onError: k,
2235
+ onDisplayStatus: k,
2236
+ onError: S,
2234
2237
  onReady: u,
2235
2238
  showErrorOverlay: p = !0,
2236
2239
  onUserTranscript: d,
2237
2240
  onBotOutput: I,
2238
2241
  onRealtimeLipsyncDebug: E
2239
2242
  }, R) {
2240
- const W = F(null), V = F(null), H = F(Ss()), j = F(ss()), y = F(0), T = F(0), g = F(0), x = F(null), b = F(null), D = F(!1), A = F(!1), P = F(!1), B = F("sil"), $ = F(!1), U = F(
2243
+ const H = F(null), V = F(null), $ = F(vs()), j = F(is()), y = F(0), T = F(0), g = F(0), C = F(null), b = F(null), D = F(!1), A = F(!1), P = F(!1), B = F("sil"), W = F(!1), U = F(
2241
2244
  null
2242
- ), X = F(!1), [se, Z] = Be("idle"), [ce, J] = Be(null), [c, v] = Be(!1), [L, z] = Be(!1), [ne, Re] = Be({ width: 842, height: 1264 }), G = F(i ?? null), ke = F(null), Y = F(null), De = F(!1), Je = F({ width: 842, height: 1264 }), Qe = F(null), _t = F(u), ee = F(S), pt = F(k), yt = F(d), Et = F(I), kt = F(E);
2243
- _t.current = u, ee.current = S, pt.current = k, yt.current = d, Et.current = I, kt.current = E;
2244
- const St = oe(
2245
+ ), X = F(!1), [se, Z] = Le("idle"), [ce, J] = Le(null), [c, v] = Le(!1), [L, z] = Le(!1), [ne, Re] = Le({ width: 842, height: 1264 }), G = F(i ?? null), Se = F(null), Y = F(null), De = F(!1), Je = F({ width: 842, height: 1264 }), Qe = F(null), pt = F(u), ee = F(k), yt = F(S), Et = F(d), St = F(I), kt = F(E);
2246
+ pt.current = u, ee.current = k, yt.current = S, Et.current = d, St.current = I, kt.current = E;
2247
+ const vt = oe(
2245
2248
  (h) => {
2246
- const M = h?.ttsEngineId ?? o ?? Y.current?.ttsEngineId ?? Te, C = h?.voiceId ?? a ?? Y.current?.voiceId ?? Le(M);
2247
- return { ttsEngineId: M, voiceId: C };
2249
+ const M = h?.ttsEngineId ?? o ?? Y.current?.ttsEngineId ?? Te, x = h?.voiceId ?? a ?? Y.current?.voiceId ?? Oe(M);
2250
+ return { ttsEngineId: M, voiceId: x };
2248
2251
  },
2249
2252
  [o, a]
2250
- ), fe = oe((h) => {
2251
- J(h), pt.current?.(h);
2253
+ ), de = oe((h) => {
2254
+ J(h), yt.current?.(h);
2252
2255
  }, []), Me = oe(
2253
2256
  (h) => {
2254
2257
  Z(h), m?.(h);
2255
2258
  },
2256
2259
  [m]
2257
2260
  ), q = F(
2258
- Pt(Me, be)
2261
+ Bt(Me, be)
2259
2262
  ), K = F(null);
2260
- Se(() => (q.current = Pt(
2263
+ ke(() => (q.current = Bt(
2261
2264
  Me,
2262
2265
  be
2263
2266
  ), i && q.current.setDeveloperToken(i), q.current.setTtsEngineId(o), () => {
@@ -2265,19 +2268,19 @@ const Ks = Sn(function({
2265
2268
  const h = K.current;
2266
2269
  h && (h.disconnect(), K.current = null);
2267
2270
  }), [Me, i, o]);
2268
- const vt = oe(() => (K.current || (K.current = Ir(
2271
+ const bt = oe(() => (K.current || (K.current = Rr(
2269
2272
  Me,
2270
2273
  {
2271
2274
  speakingRate: f,
2272
- onUserTranscript: (h, M) => yt.current?.(h, M),
2273
- onBotOutput: (h) => Et.current?.(h),
2275
+ onUserTranscript: (h, M) => Et.current?.(h, M),
2276
+ onBotOutput: (h) => St.current?.(h),
2274
2277
  onLipsyncDebug: (h) => kt.current?.(h)
2275
2278
  }
2276
2279
  ), K.current.setTtsEngineId(o)), K.current), [Me, f, o]), ie = oe(() => {
2277
- x.current != null && (clearTimeout(x.current), x.current = null);
2280
+ C.current != null && (clearTimeout(C.current), C.current = null);
2278
2281
  }, []), ue = oe(() => {
2279
2282
  b.current != null && (clearTimeout(b.current), b.current = null), P.current = !1;
2280
- }, []), bt = oe(() => {
2283
+ }, []), Tt = oe(() => {
2281
2284
  !X.current || !U.current || (ue(), P.current = !0, b.current = setTimeout(() => {
2282
2285
  if (b.current = null, we(
2283
2286
  q.current,
@@ -2297,9 +2300,9 @@ const Ks = Sn(function({
2297
2300
  }
2298
2301
  h.restart(), h.setActive(!0);
2299
2302
  const M = h.getVideo();
2300
- let C = !1;
2303
+ let x = !1;
2301
2304
  const O = () => {
2302
- C || (C = !0, M.removeEventListener("playing", N), P.current = !1);
2305
+ x || (x = !0, M.removeEventListener("playing", N), P.current = !1);
2303
2306
  }, N = () => {
2304
2307
  O();
2305
2308
  };
@@ -2308,19 +2311,19 @@ const Ks = Sn(function({
2308
2311
  return;
2309
2312
  }
2310
2313
  setTimeout(O, 300);
2311
- }, ys));
2312
- }, [ue]), Ne = oe(() => {
2314
+ }, Es));
2315
+ }, [ue]), Ce = oe(() => {
2313
2316
  if (ie(), ee.current?.("sil"), D.current = !1, !X.current || !U.current) {
2314
2317
  P.current = !1;
2315
2318
  return;
2316
2319
  }
2317
- bt();
2318
- }, [ie, bt]), Xe = oe(
2320
+ Tt();
2321
+ }, [ie, Tt]), Xe = oe(
2319
2322
  async (h) => {
2320
- const M = T.current, C = V.current, O = W.current, N = () => {
2323
+ const M = T.current, x = V.current, O = H.current, N = () => {
2321
2324
  h?.fallbackOnly || (D.current = !1);
2322
2325
  };
2323
- if (!C || !O || !c) {
2326
+ if (!x || !O || !c) {
2324
2327
  N();
2325
2328
  return;
2326
2329
  }
@@ -2332,40 +2335,44 @@ const Ks = Sn(function({
2332
2335
  return;
2333
2336
  }
2334
2337
  if (h?.fallbackOnly) {
2335
- if (!D.current || (me(H.current), await C.renderSilOnly(), M !== T.current) || we(
2338
+ if (!D.current || (fe($.current), await x.renderSilOnly(), M !== T.current) || we(
2336
2339
  q.current,
2337
2340
  K.current
2338
2341
  ).isSpeaking())
2339
2342
  return;
2340
- Ne();
2343
+ Ce();
2341
2344
  return;
2342
2345
  }
2343
- const te = B.current !== "sil" ? B.current : bs(
2346
+ if (ks($.current)) {
2347
+ fe($.current), Ce();
2348
+ return;
2349
+ }
2350
+ const te = B.current !== "sil" ? B.current : Ts(
2344
2351
  we(
2345
2352
  q.current,
2346
2353
  K.current
2347
2354
  ).getVisemeQueue()
2348
- ), ae = Ts(
2355
+ ), ae = As(
2349
2356
  te,
2350
2357
  Qe.current
2351
2358
  );
2352
- if (me(H.current), !ae) {
2353
- if (await C.renderSilOnly(), M !== T.current || we(
2359
+ if (fe($.current), !ae) {
2360
+ if (await x.renderSilOnly(), M !== T.current || we(
2354
2361
  q.current,
2355
2362
  K.current
2356
2363
  ).isSpeaking())
2357
2364
  return;
2358
- Ne();
2365
+ Ce();
2359
2366
  return;
2360
2367
  }
2361
2368
  try {
2362
- await C.renderViseme(O, "sil", {
2369
+ await x.renderViseme(O, "sil", {
2363
2370
  from: te,
2364
2371
  transitionDurationMs: mn
2365
2372
  });
2366
- } catch (de) {
2367
- if (de?.name !== "AbortError")
2368
- throw de;
2373
+ } catch (he) {
2374
+ if (he?.name !== "AbortError")
2375
+ throw he;
2369
2376
  }
2370
2377
  if (M !== T.current) {
2371
2378
  N();
@@ -2378,104 +2385,104 @@ const Ks = Sn(function({
2378
2385
  N();
2379
2386
  return;
2380
2387
  }
2381
- Ne();
2388
+ Ce();
2382
2389
  },
2383
- [c, Ne]
2390
+ [c, Ce]
2384
2391
  ), xe = oe(() => {
2385
2392
  if (A.current || D.current) return;
2386
2393
  A.current = !0, D.current = !0, ie();
2387
2394
  const h = T.current;
2388
2395
  Xe().finally(() => {
2389
2396
  A.current = !1;
2390
- }), x.current = setTimeout(() => {
2391
- x.current = null, h === T.current && Xe({ fallbackOnly: !0 });
2392
- }, As());
2393
- }, [ie, Xe]), Tt = oe(async () => {
2397
+ }), C.current = setTimeout(() => {
2398
+ C.current = null, h === T.current && Xe({ fallbackOnly: !0 });
2399
+ }, Is());
2400
+ }, [ie, Xe]), At = oe(async () => {
2394
2401
  const h = Math.floor(Date.now() / 1e3);
2395
- if (ke.current && h < ke.current.expiresAt - 60)
2396
- return ke.current.key;
2402
+ if (Se.current && h < Se.current.expiresAt - 60)
2403
+ return Se.current.key;
2397
2404
  const M = G.current ?? await et();
2398
2405
  G.current = M, q.current.setDeveloperToken(M);
2399
- const C = await qn(M, be);
2400
- return ke.current = {
2401
- key: C.value,
2402
- expiresAt: C.expiresAt
2403
- }, C.value;
2406
+ const x = await Kn(M, be);
2407
+ return Se.current = {
2408
+ key: x.value,
2409
+ expiresAt: x.expiresAt
2410
+ }, x.value;
2404
2411
  }, []);
2405
- Se(() => {
2412
+ ke(() => {
2406
2413
  i && (G.current = i, q.current.setDeveloperToken(i));
2407
- }, [i]), Se(() => {
2414
+ }, [i]), ke(() => {
2408
2415
  q.current.setTtsEngineId(o), K.current?.setTtsEngineId(o), Y.current && (Y.current.ttsEngineId = o);
2409
- }, [o]), Se(() => {
2410
- const h = a ?? Le(o);
2416
+ }, [o]), ke(() => {
2417
+ const h = a ?? Oe(o);
2411
2418
  Y.current && (Y.current.voiceId = h);
2412
2419
  }, [a, o]);
2413
- const ge = It(
2414
- () => zn(n, r),
2420
+ const ge = Rt(
2421
+ () => Yn(n, r),
2415
2422
  [n, r]
2416
- ), _n = It(() => s ? JSON.stringify(s) : ge ? `face:${ge}` : `id:${t ?? ""}`, [s, ge, t]);
2417
- return Se(() => {
2423
+ ), pn = Rt(() => s ? JSON.stringify(s) : ge ? `face:${ge}` : `id:${t ?? ""}`, [s, ge, t]);
2424
+ return ke(() => {
2418
2425
  if (!t && !s && !ge) {
2419
- fe("AiTwin requires `assets`, `avatarId`/`faceId`, or `id`");
2426
+ de("AiTwin requires `assets`, `avatarId`/`faceId`, or `id`");
2420
2427
  return;
2421
2428
  }
2422
2429
  let h = !1;
2423
2430
  De.current = !1, v(!1), z(!1), J(null), Y.current = null, U.current = null, X.current = !1;
2424
- const M = W.current;
2431
+ const M = H.current;
2425
2432
  if (!M) return;
2426
- let C = null;
2433
+ let x = null;
2427
2434
  return (async () => {
2428
2435
  try {
2429
2436
  let O, N, te;
2430
2437
  if (s)
2431
- O = s, N = o, te = a ?? Le(N);
2438
+ O = s, N = o, te = a ?? Oe(N);
2432
2439
  else if (ge)
2433
- ee.current?.("loadFace"), O = Dt(ge), N = o, te = a ?? Le(N);
2440
+ ee.current?.("loadFace"), O = Mt(ge), N = o, te = a ?? Oe(N);
2434
2441
  else {
2435
2442
  ee.current?.("getAiTwin");
2436
2443
  const Q = await tt(
2437
- Un(t),
2444
+ Nn(t),
2438
2445
  3e4,
2439
2446
  "getAiTwin"
2440
2447
  );
2441
2448
  if (h) return;
2442
2449
  if (!Q.faceId?.trim())
2443
2450
  throw new Error("getAiTwin returned no faceId");
2444
- N = Q.ttsEngineId, te = a ?? Q.voiceId ?? Le(N), O = Dt(Q.faceId);
2451
+ N = Q.ttsEngineId, te = a ?? Q.voiceId ?? Oe(N), O = Mt(Q.faceId);
2445
2452
  }
2446
- Y.current = { ttsEngineId: N, voiceId: te }, Yn(O), U.current = is(), C = Ps(M, {
2453
+ Y.current = { ttsEngineId: N, voiceId: te }, Jn(O), U.current = os(), x = Bs(M, {
2447
2454
  onStatus: (Q) => {
2448
2455
  h || ee.current?.(Q);
2449
2456
  },
2450
2457
  onError: (Q) => {
2451
- h || fe(Q);
2458
+ h || de(Q);
2452
2459
  },
2453
2460
  shouldAcceptLiveFrame: () => we(
2454
2461
  q.current,
2455
2462
  K.current
2456
2463
  ).isSpeaking() && !D.current
2457
- }), V.current = C, ee.current?.("auth");
2464
+ }), V.current = x, ee.current?.("auth");
2458
2465
  const ae = G.current ?? i ?? await tt(et(), 3e4, "getAuthToken");
2459
2466
  if (h) return;
2460
2467
  G.current = ae, q.current.setDeveloperToken(ae), q.current.setTtsEngineId(N);
2461
- const de = Ge() ? await Tt() : void 0;
2468
+ const he = Ge() ? await At() : void 0;
2462
2469
  if (h) return;
2463
2470
  ee.current?.("loadAssets");
2464
2471
  const le = await tt(
2465
- C.loadAssets(de),
2472
+ x.loadAssets(he),
2466
2473
  18e4,
2467
2474
  "load face assets"
2468
2475
  );
2469
2476
  if (!h && le.width > 0 && le.height > 0 && (Je.current = le, Re(le)), h) return;
2470
- Qe.current = C.getVisemeAtlasPaths(), De.current = !0, v(!0), _t.current?.(), C.renderSilOnly().then(() => {
2477
+ Qe.current = x.getVisemeAtlasPaths(), De.current = !0, v(!0), pt.current?.(), x.renderSilOnly().then(() => {
2471
2478
  h || ee.current?.("sil");
2472
2479
  }), (async () => {
2473
2480
  try {
2474
- const Q = await Lr(de);
2481
+ const Q = await Or(he);
2475
2482
  if (await U.current.load(Q), h) return;
2476
- X.current = !0, z(!0), me(H.current), U.current.setActive(!0);
2483
+ X.current = !0, z(!0), fe($.current), U.current.setActive(!0);
2477
2484
  const re = U.current.getVideo();
2478
- await Wt(
2485
+ await qt(
2479
2486
  M,
2480
2487
  re,
2481
2488
  null,
@@ -2490,60 +2497,60 @@ const Ks = Sn(function({
2490
2497
  } catch (O) {
2491
2498
  if (h) return;
2492
2499
  if (O instanceof nt) {
2493
- fe(O.message);
2500
+ de(O.message);
2494
2501
  return;
2495
2502
  }
2496
- fe(O instanceof Error ? O.message : "Failed to load AI twin");
2503
+ de(O instanceof Error ? O.message : "Failed to load AI twin");
2497
2504
  }
2498
2505
  })(), () => {
2499
- h = !0, U.current?.dispose(), C?.dispose(), V.current = null;
2506
+ h = !0, U.current?.dispose(), x?.dispose(), V.current = null;
2500
2507
  };
2501
- }, [_n, s, ge, t, o, a, i, Tt, fe]), Se(() => {
2508
+ }, [pn, s, ge, t, o, a, i, At, de]), ke(() => {
2502
2509
  const h = { current: !1 }, M = () => {
2503
- const C = W.current, O = V.current, N = we(
2510
+ const x = H.current, O = V.current, N = we(
2504
2511
  q.current,
2505
2512
  K.current
2506
2513
  );
2507
- if (!C || !O || !c) {
2514
+ if (!x || !O || !c) {
2508
2515
  y.current = requestAnimationFrame(M);
2509
2516
  return;
2510
2517
  }
2511
- const te = N.isSpeaking(), ae = te && !$.current, de = $.current && !te;
2512
- ae && (ie(), ue(), D.current = !1, A.current = !1, me(H.current), g.current = 0, B.current = "sil", U.current?.setActive(!1)), de && (j.current.reset(), U.current?.setActive(!1), xe());
2513
- const le = N.getPlaybackElapsedMs(), Q = de || D.current || P.current;
2518
+ const te = N.isSpeaking(), ae = te && !W.current, he = W.current && !te;
2519
+ ae && (ie(), ue(), D.current = !1, A.current = !1, fe($.current), g.current = 0, B.current = "sil", U.current?.setActive(!1)), he && (j.current.reset(), U.current?.setActive(!1), xe());
2520
+ const le = N.getPlaybackElapsedMs(), Q = he || D.current || P.current;
2514
2521
  if (te) {
2515
2522
  X.current && U.current?.setActive(!1);
2516
- const re = N.getVisemeQueue(), _e = re.length > 0 ? lt(re, le) : "sil";
2523
+ const re = N.getVisemeQueue(), _e = re.length > 0 ? ft(re, le) : "sil";
2517
2524
  _e !== "sil" && (B.current = _e);
2518
- const he = us(
2525
+ const me = ls(
2519
2526
  le,
2520
2527
  N.getSentenceEmotions(),
2521
2528
  N.getWordQueue(),
2522
2529
  N.getStreamMood()
2523
2530
  );
2524
- j.current.setTargetEmotion(he), j.current.setTargetEyebrow(
2525
- rs(
2531
+ j.current.setTargetEmotion(me), j.current.setTargetEyebrow(
2532
+ ss(
2526
2533
  le,
2527
2534
  N.getWordQueue(),
2528
- wt(he)
2535
+ gt(me)
2529
2536
  )
2530
2537
  ), j.current.advance(performance.now());
2531
- const Ce = j.current.getExpressionPath(), Ze = j.current.getDrawKey();
2532
- Rs(
2533
- C,
2538
+ const Pe = j.current.getExpressionPath(), Ze = j.current.getDrawKey();
2539
+ Ds(
2540
+ x,
2534
2541
  re,
2535
2542
  le,
2536
- Ce,
2543
+ Pe,
2537
2544
  Ze,
2538
- H.current,
2539
- (Pe, pn, yn, En) => O.drawLiveFrame(Pe, pn, yn, En),
2540
- (Pe) => ee.current?.(Pe),
2545
+ $.current,
2546
+ (Be, yn, En, Sn) => O.drawLiveFrame(Be, yn, En, Sn),
2547
+ (Be) => ee.current?.(Be),
2541
2548
  Qe.current
2542
2549
  );
2543
2550
  } else if (!Q && X.current && U.current) {
2544
2551
  const re = U.current, _e = re.getVideo();
2545
- _e.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA ? (re.setActive(!0), h.current || (h.current = !0, Wt(
2546
- C,
2552
+ _e.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA ? (re.setActive(!0), h.current || (h.current = !0, qt(
2553
+ x,
2547
2554
  _e,
2548
2555
  null,
2549
2556
  void 0,
@@ -2551,23 +2558,23 @@ const Ks = Sn(function({
2551
2558
  () => !N.isSpeaking() && !D.current && !P.current
2552
2559
  ).then(() => ee.current?.("idle")).finally(() => {
2553
2560
  h.current = !1;
2554
- }))) : Kt(
2555
- C,
2561
+ }))) : jt(
2562
+ x,
2556
2563
  null,
2557
2564
  "__sil__",
2558
- H.current,
2559
- (he, Ce, Ze, Pe) => O.drawLiveFrame(he, Ce, Ze, Pe),
2560
- (he) => ee.current?.(he)
2565
+ $.current,
2566
+ (me, Pe, Ze, Be) => O.drawLiveFrame(me, Pe, Ze, Be),
2567
+ (me) => ee.current?.(me)
2561
2568
  );
2562
- } else Q || Kt(
2563
- C,
2569
+ } else Q || jt(
2570
+ x,
2564
2571
  null,
2565
2572
  "__sil__",
2566
- H.current,
2567
- (re, _e, he, Ce) => O.drawLiveFrame(re, _e, he, Ce),
2573
+ $.current,
2574
+ (re, _e, me, Pe) => O.drawLiveFrame(re, _e, me, Pe),
2568
2575
  (re) => ee.current?.(re)
2569
2576
  );
2570
- $.current = te, y.current = requestAnimationFrame(M);
2577
+ W.current = te, y.current = requestAnimationFrame(M);
2571
2578
  };
2572
2579
  return y.current = requestAnimationFrame(M), () => {
2573
2580
  cancelAnimationFrame(y.current), ie(), ue(), q.current.stop(), K.current?.stop();
@@ -2578,38 +2585,38 @@ const Ks = Sn(function({
2578
2585
  xe,
2579
2586
  ie,
2580
2587
  ue
2581
- ]), vn(
2588
+ ]), bn(
2582
2589
  R,
2583
2590
  () => ({
2584
2591
  speakText: async (h, M) => {
2585
- const C = h.trim();
2586
- if (!C) return;
2592
+ const x = h.trim();
2593
+ if (!x) return;
2587
2594
  const O = V.current;
2588
2595
  if (!O || !De.current && !c)
2589
2596
  throw new Error("AI twin is not ready");
2590
- const { ttsEngineId: N, voiceId: te } = St(M);
2591
- J(null), T.current += 1, ie(), ue(), D.current = !1, A.current = !1, B.current = "sil", me(H.current), j.current.reset(), $.current = !1;
2597
+ const { ttsEngineId: N, voiceId: te } = vt(M);
2598
+ J(null), T.current += 1, ie(), ue(), D.current = !1, A.current = !1, B.current = "sil", fe($.current), j.current.reset(), W.current = !1;
2592
2599
  try {
2593
- X.current ? (U.current?.setActive(!1), U.current?.restart(), me(H.current)) : await O.renderSilOnly(), await q.current.speak(C, {
2600
+ X.current ? (U.current?.setActive(!1), U.current?.restart(), fe($.current)) : await O.renderSilOnly(), await q.current.speak(x, {
2594
2601
  voiceId: te,
2595
2602
  speakingRate: M?.speakingRate ?? f,
2596
2603
  ttsEngineId: N
2597
2604
  });
2598
2605
  } catch (ae) {
2599
- throw fe(ae instanceof Error ? ae.message : "TTS failed"), ae;
2606
+ throw de(ae instanceof Error ? ae.message : "TTS failed"), ae;
2600
2607
  }
2601
2608
  },
2602
2609
  stop: () => {
2603
- T.current += 1, ie(), ue(), D.current = !1, A.current = !1, q.current.stop(), K.current?.stop(), me(H.current), $.current = !1, xe();
2610
+ T.current += 1, ie(), ue(), D.current = !1, A.current = !1, q.current.stop(), K.current?.stop(), fe($.current), W.current = !1, xe();
2604
2611
  },
2605
2612
  setTtsEngineId: (h) => {
2606
2613
  q.current.setTtsEngineId(h), K.current?.setTtsEngineId(h), Y.current && (Y.current.ttsEngineId = h);
2607
2614
  },
2608
2615
  renderViseme: async (h, M) => {
2609
- const C = V.current, O = W.current;
2610
- if (!C || !O || !De.current)
2616
+ const x = V.current, O = H.current;
2617
+ if (!x || !O || !De.current)
2611
2618
  throw new Error("AI twin is not ready");
2612
- await C.renderViseme(O, h, {
2619
+ await x.renderViseme(O, h, {
2613
2620
  from: M?.from,
2614
2621
  transitionDurationMs: M?.transitionDurationMs,
2615
2622
  gapMs: M?.gapMs,
@@ -2623,22 +2630,22 @@ const Ks = Sn(function({
2623
2630
  try {
2624
2631
  let M = h.authToken?.trim();
2625
2632
  M || (M = G.current ?? i ?? await et(), G.current = M);
2626
- const C = h.voiceId?.trim() ?? a ?? Y.current?.voiceId, O = vt();
2633
+ const x = h.voiceId?.trim() ?? a ?? Y.current?.voiceId, O = bt();
2627
2634
  await O.unlockAudio(), await O.connect({
2628
2635
  ...h,
2629
2636
  authToken: M,
2630
- voiceId: C,
2637
+ voiceId: x,
2631
2638
  speakingRate: h.speakingRate ?? f
2632
2639
  });
2633
2640
  } catch (M) {
2634
- throw fe(
2641
+ throw de(
2635
2642
  M instanceof Error ? M.message : "Voice connect failed"
2636
2643
  ), M;
2637
2644
  }
2638
2645
  },
2639
2646
  disconnect: async () => {
2640
2647
  const h = K.current;
2641
- h && (T.current += 1, ie(), ue(), D.current = !1, A.current = !1, me(H.current), $.current = !1, await h.disconnect(), xe());
2648
+ h && (T.current += 1, ie(), ue(), D.current = !1, A.current = !1, fe($.current), W.current = !1, await h.disconnect(), xe());
2642
2649
  },
2643
2650
  isConnected: () => K.current?.isConnected() ?? !1
2644
2651
  }),
@@ -2650,58 +2657,71 @@ const Ks = Sn(function({
2650
2657
  ie,
2651
2658
  ue,
2652
2659
  xe,
2653
- fe,
2654
- St,
2660
+ de,
2655
2661
  vt,
2662
+ bt,
2656
2663
  se
2657
2664
  ]
2658
- ), /* @__PURE__ */ kn("div", { className: l, style: { ...Ls, ...w }, children: [
2659
- /* @__PURE__ */ At(
2665
+ ), /* @__PURE__ */ kn("div", { className: l, style: { ...Os, ...w }, children: [
2666
+ /* @__PURE__ */ It(
2660
2667
  "canvas",
2661
2668
  {
2662
- ref: W,
2669
+ ref: H,
2663
2670
  width: ne.width,
2664
2671
  height: ne.height,
2665
- style: { ...Os, ..._ },
2672
+ style: { ...Fs, ..._ },
2666
2673
  "aria-label": t ? `AI twin ${t}` : "AI twin face"
2667
2674
  }
2668
2675
  ),
2669
- p && ce ? /* @__PURE__ */ At("div", { style: Fs, children: ce }) : null
2676
+ p && ce ? /* @__PURE__ */ It("div", { style: Us, children: ce }) : null
2670
2677
  ] });
2671
- }), Us = "thumbnail.webp";
2672
- function js(e, t = Jt) {
2678
+ }), Ns = "thumbnail.webp";
2679
+ function Ys(e, t = ut) {
2673
2680
  const n = e.trim();
2674
2681
  if (!n)
2675
2682
  throw new Error("faceId is required");
2676
- return `${t.replace(/\/$/, "")}/${n}/${Us}`;
2683
+ return `${t.replace(/\/$/, "")}/${n}/${Ns}`;
2684
+ }
2685
+ const Vs = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".webp"]);
2686
+ function $s(e = ".png") {
2687
+ const t = e.toLowerCase();
2688
+ return Vs.has(t) ? `source${t}` : "source.png";
2689
+ }
2690
+ function Js(e, t = ut, n = ".png") {
2691
+ const r = e.trim();
2692
+ if (!r)
2693
+ throw new Error("faceId is required");
2694
+ return `${t.replace(/\/$/, "")}/${r}/${$s(n)}`;
2677
2695
  }
2678
2696
  export {
2679
- Us as AI_TWIN_THUMBNAIL_FILENAME,
2680
- Ks as AiTwin,
2697
+ Ns as AI_TWIN_THUMBNAIL_FILENAME,
2698
+ zs as AiTwin,
2681
2699
  nt as AiTwinNotFoundError,
2682
2700
  Te as DEFAULT_TTS_ENGINE_ID,
2683
2701
  rn as MIC_SAMPLE_RATE,
2684
- rr as OCULUS_VISEME_IDS,
2702
+ sr as OCULUS_VISEME_IDS,
2685
2703
  sn as PLAYBACK_SAMPLE_RATE,
2686
2704
  tn as SPEAKING_RATE_MAX,
2687
2705
  en as SPEAKING_RATE_MIN,
2688
2706
  Ae as TTS_ENGINE_CARTESIA,
2689
2707
  Qt as TTS_ENGINE_GOOGLE,
2690
- ut as TTS_ENGINE_INWORLD,
2691
- qs as VISEME_IDS,
2692
- Er as VISEME_TEST_CARTESIA_VOICE_ID,
2693
- ft as VISEME_TEST_SPEAKING_RATE,
2708
+ lt as TTS_ENGINE_INWORLD,
2709
+ Gs as VISEME_IDS,
2710
+ Sr as VISEME_TEST_CARTESIA_VOICE_ID,
2711
+ dt as VISEME_TEST_SPEAKING_RATE,
2694
2712
  nn as VISEME_TEST_VOICE_ID,
2695
- Tr as buildVoiceWebSocketUrl,
2696
- Pt as createAvatarTtsLipsyncController,
2697
- Ir as createRealtimeVoiceLipsyncController,
2698
- Dt as faceAssetUrls,
2699
- Un as fetchAiTwin,
2713
+ $s as aiTwinSourceFilename,
2714
+ Ar as buildVoiceWebSocketUrl,
2715
+ Bt as createAvatarTtsLipsyncController,
2716
+ Rr as createRealtimeVoiceLipsyncController,
2717
+ Mt as faceAssetUrls,
2718
+ Nn as fetchAiTwin,
2700
2719
  et as fetchDevAuthToken,
2701
- js as getAiTwinThumbnailUrl,
2702
- ir as normalizeOculusViseme,
2703
- zn as resolveDirectFaceId,
2704
- lt as resolveVisemeAtTime,
2705
- Ws as resolveWordAtTime,
2706
- Yn as setActiveTwinAssets
2720
+ Js as getAiTwinSourceUrl,
2721
+ Ys as getAiTwinThumbnailUrl,
2722
+ or as normalizeOculusViseme,
2723
+ Yn as resolveDirectFaceId,
2724
+ ft as resolveVisemeAtTime,
2725
+ js as resolveWordAtTime,
2726
+ Jn as setActiveTwinAssets
2707
2727
  };