@spatialwalk/avatarkit 1.0.0-beta.11 → 1.0.0-beta.13

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.
@@ -30,7 +30,7 @@ class rn {
30
30
  }
31
31
  }
32
32
  var nn = /* @__PURE__ */ ((r) => (r.CAMERA = "camera", r.ANIMATION_IDLE = "frameIdle", r.ANIMATION_MONO = "frameMono", r.AUDIO_MONO = "audioMono", r.MODEL_SHAPE = "shape", r.MODEL_GS = "gsStandard", r))(nn || {});
33
- function Ti(r) {
33
+ function Bi(r) {
34
34
  var e, t, n, i, a, o, s, l, g, c, u, m, v, w, y, S, x;
35
35
  return {
36
36
  camera: ((t = (e = r.camera) == null ? void 0 : e.resource) == null ? void 0 : t.remote) || null,
@@ -41,11 +41,11 @@ function Ti(r) {
41
41
  gsStandard: ((x = (S = (y = r.models) == null ? void 0 : y.gsStandard) == null ? void 0 : S.resource) == null ? void 0 : x.remote) || null
42
42
  };
43
43
  }
44
- function Bi(r) {
44
+ function Di(r) {
45
45
  var e, t, n, i, a, o;
46
46
  return !!((n = (t = (e = r.animations) == null ? void 0 : e.frameMono) == null ? void 0 : t.resource) != null && n.remote && ((o = (a = (i = r.animations) == null ? void 0 : i.audioMono) == null ? void 0 : a.resource) != null && o.remote));
47
47
  }
48
- function Di(r) {
48
+ function Oi(r) {
49
49
  var e, t, n, i, a, o;
50
50
  try {
51
51
  const s = JSON.parse(r);
@@ -60,14 +60,14 @@ class se extends Error {
60
60
  super(e), this.code = t, this.name = "SPAvatarError";
61
61
  }
62
62
  }
63
- var Ie = /* @__PURE__ */ ((r) => (r.network = "network", r.external = "external", r))(Ie || {});
63
+ var ke = /* @__PURE__ */ ((r) => (r.network = "network", r.external = "external", r))(ke || {});
64
64
  function an() {
65
65
  return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).get("debug") === "1";
66
66
  }
67
67
  function on() {
68
68
  return an();
69
69
  }
70
- const k = {
70
+ const M = {
71
71
  // Dynamic debug mode check (includes URL parameter)
72
72
  get debug() {
73
73
  return on();
@@ -114,7 +114,7 @@ function Vt(r) {
114
114
  has_eyelid: (((e = r.eyeLid) == null ? void 0 : e.length) || 0) > 0
115
115
  };
116
116
  }
117
- function ut(r) {
117
+ function dt(r) {
118
118
  return {
119
119
  translation: r.translation || [0, 0, 0],
120
120
  rotation: r.rotation || [0, 0, 0],
@@ -129,9 +129,9 @@ var $t = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
129
129
  function sn(r) {
130
130
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
131
131
  }
132
- var qt = { exports: {} }, Be = { exports: {} }, dt;
132
+ var qt = { exports: {} }, Oe = { exports: {} }, ht;
133
133
  function ln() {
134
- return dt || (dt = 1, function(r, e) {
134
+ return ht || (ht = 1, function(r, e) {
135
135
  (function(t, n) {
136
136
  r.exports = n();
137
137
  })($t, function() {
@@ -210,7 +210,7 @@ function ln() {
210
210
  }(s[w]);
211
211
  return u;
212
212
  });
213
- }(Be)), Be.exports;
213
+ }(Oe)), Oe.exports;
214
214
  }
215
215
  (function(r, e) {
216
216
  (function(t, n) {
@@ -337,7 +337,7 @@ function ln() {
337
337
  })(qt);
338
338
  var cn = qt.exports;
339
339
  const un = /* @__PURE__ */ sn(cn);
340
- let ht = () => {
340
+ let ft = () => {
341
341
  var r = (() => {
342
342
  var e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Object.getOwnPropertyNames, i = Object.prototype.hasOwnProperty, a = (f, p) => {
343
343
  for (var A in p) e(f, A, { get: p[A], enumerable: !0 });
@@ -432,21 +432,21 @@ let ht = () => {
432
432
  return (p) => {
433
433
  const A = z(p), C = f += 1;
434
434
  return (E) => {
435
- var ot;
435
+ var st;
436
436
  var P;
437
437
  if (E.options.memoization === !1) return A(E);
438
438
  const R = E.index, q = (P = E.cache)[C] || (P[C] = /* @__PURE__ */ new Map()), j = q.get(R);
439
439
  if (j === !1) return !1;
440
440
  if (m(j)) return E.index = j, !0;
441
- if (j) return E.index = j.index, (ot = j.output) != null && ot.length && E.output.push(...j.output), !0;
441
+ if (j) return E.index = j.index, (st = j.output) != null && st.length && E.output.push(...j.output), !0;
442
442
  {
443
- const st = E.output.length;
443
+ const lt = E.output.length;
444
444
  if (A(E)) {
445
- const lt = E.index, ct = E.output.length;
446
- if (ct > st) {
447
- const Qr = E.output.slice(st, ct);
448
- q.set(R, { index: lt, output: Qr });
449
- } else q.set(R, lt);
445
+ const ct = E.index, ut = E.output.length;
446
+ if (ut > lt) {
447
+ const Qr = E.output.slice(lt, ut);
448
+ q.set(R, { index: ct, output: Qr });
449
+ } else q.set(R, ct);
450
450
  return !0;
451
451
  } else return q.set(R, !1), !1;
452
452
  }
@@ -461,7 +461,7 @@ let ht = () => {
461
461
  if (g(f)) return re(f);
462
462
  if (v(f)) return U(Object.values(f));
463
463
  throw new Error("Invalid rule");
464
- }), ie = "abcdefghijklmnopqrstuvwxyz", Fe = (f) => {
464
+ }), ie = "abcdefghijklmnopqrstuvwxyz", Le = (f) => {
465
465
  let p = "";
466
466
  for (; f > 0; ) {
467
467
  const A = (f - 1) % 26;
@@ -472,36 +472,36 @@ let ht = () => {
472
472
  let p = 0;
473
473
  for (let A = 0, C = f.length; A < C; A++) p = p * 26 + ie.indexOf(f[A]) + 1;
474
474
  return p;
475
- }, Re = (f, p) => {
476
- if (p < f) return Re(p, f);
475
+ }, Te = (f, p) => {
476
+ if (p < f) return Te(p, f);
477
477
  const A = [];
478
478
  for (; f <= p; ) A.push(f++);
479
479
  return A;
480
- }, ir = (f, p, A) => Re(f, p).map((C) => String(C).padStart(A, "0")), Ye = (f, p) => Re($(f), $(p)).map(Fe), J = (f) => f, Xe = (f) => ar((p) => L(p, f, { memoization: !1 }).join("")), ar = (f) => {
480
+ }, ir = (f, p, A) => Te(f, p).map((C) => String(C).padStart(A, "0")), Xe = (f, p) => Te($(f), $(p)).map(Le), J = (f) => f, Qe = (f) => ar((p) => L(p, f, { memoization: !1 }).join("")), ar = (f) => {
481
481
  const p = {};
482
482
  return (A) => p[A] ?? (p[A] = f(A));
483
- }, or = _(/^\*\*\/\*$/, ".*"), sr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, p, A) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}`), lr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (f, p, A, C) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}(?:${C.replaceAll(",", "|").replaceAll(".", "\\.")})`), Le = _(/\\./, J), cr = _(/[$.*+?^(){}[\]\|]/, (f) => `\\${f}`), ur = _(/./, J), dr = _(/^(?:!!)*!(.*)$/, (f, p) => `(?!^${at(p)}$).*?`), hr = _(/^(!!)+/, ""), fr = U([dr, hr]), mr = _(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = _(/^(\*\*\/)+/, "(?:^|.*/)"), pr = _(/\/(\*\*)$/, "(?:/.*|$)"), vr = _(/\*\*/, ".*"), Qe = U([mr, gr, pr, vr]), wr = _(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = _(/\*/, "[^/]*"), et = U([wr, yr]), tt = _("?", "[^/]"), Ar = _("[", J), Sr = _("]", J), br = _(/[!^]/, "^/"), Cr = _(/[a-z]-[a-z]|[0-9]-[0-9]/i, J), _r = _(/[$.*+?^(){}[\|]/, (f) => `\\${f}`), Er = _(/[^\]]/, J), xr = U([Le, _r, Cr, Er]), rt = re([Ar, X(br), K(xr), Sr]), Pr = _("{", "(?:"), Ir = _("}", ")"), kr = _(/(\d+)\.\.(\d+)/, (f, p, A) => ir(+p, +A, Math.min(p.length, A.length)).join("|")), Mr = _(/([a-z]+)\.\.([a-z]+)/, (f, p, A) => Ye(p, A).join("|")), Fr = _(/([A-Z]+)\.\.([A-Z]+)/, (f, p, A) => Ye(p.toLowerCase(), A.toLowerCase()).join("|").toUpperCase()), Rr = U([kr, Mr, Fr]), nt = re([Pr, Rr, Ir]), Lr = _("{", "(?:"), Tr = _("}", ")"), Br = _(",", "|"), Dr = _(/[$.*+?^(){[\]\|]/, (f) => `\\${f}`), Or = _(/[^}]/, J), Nr = T(() => it), Ur = U([Qe, et, tt, rt, nt, Nr, Le, Dr, Br, Or]), it = re([Lr, K(Ur), Tr]), zr = K(U([or, sr, lr, fr, Qe, et, tt, rt, nt, it, Le, cr, ur])), Vr = zr, $r = Xe(Vr), at = $r, qr = _(/\\./, J), Wr = _(/./, J), Gr = _(/\*\*\*+/, "*"), jr = _(/([^/{[(!])\*\*/, (f, p) => `${p}*`), Hr = _(/(^|.)\*\*(?=[^*/)\]}])/, (f, p) => `${p}*`), Kr = K(U([qr, Gr, jr, Hr, Wr])), Jr = Kr, Zr = Xe(Jr), Yr = Zr, Te = (f, p) => {
483
+ }, or = _(/^\*\*\/\*$/, ".*"), sr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, p, A) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}`), lr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (f, p, A, C) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}(?:${C.replaceAll(",", "|").replaceAll(".", "\\.")})`), Be = _(/\\./, J), cr = _(/[$.*+?^(){}[\]\|]/, (f) => `\\${f}`), ur = _(/./, J), dr = _(/^(?:!!)*!(.*)$/, (f, p) => `(?!^${ot(p)}$).*?`), hr = _(/^(!!)+/, ""), fr = U([dr, hr]), mr = _(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = _(/^(\*\*\/)+/, "(?:^|.*/)"), pr = _(/\/(\*\*)$/, "(?:/.*|$)"), vr = _(/\*\*/, ".*"), et = U([mr, gr, pr, vr]), wr = _(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = _(/\*/, "[^/]*"), tt = U([wr, yr]), rt = _("?", "[^/]"), Ar = _("[", J), Sr = _("]", J), br = _(/[!^]/, "^/"), Cr = _(/[a-z]-[a-z]|[0-9]-[0-9]/i, J), _r = _(/[$.*+?^(){}[\|]/, (f) => `\\${f}`), Er = _(/[^\]]/, J), xr = U([Be, _r, Cr, Er]), nt = re([Ar, X(br), K(xr), Sr]), Pr = _("{", "(?:"), Ir = _("}", ")"), kr = _(/(\d+)\.\.(\d+)/, (f, p, A) => ir(+p, +A, Math.min(p.length, A.length)).join("|")), Mr = _(/([a-z]+)\.\.([a-z]+)/, (f, p, A) => Xe(p, A).join("|")), Fr = _(/([A-Z]+)\.\.([A-Z]+)/, (f, p, A) => Xe(p.toLowerCase(), A.toLowerCase()).join("|").toUpperCase()), Rr = U([kr, Mr, Fr]), it = re([Pr, Rr, Ir]), Lr = _("{", "(?:"), Tr = _("}", ")"), Br = _(",", "|"), Dr = _(/[$.*+?^(){[\]\|]/, (f) => `\\${f}`), Or = _(/[^}]/, J), Nr = T(() => at), Ur = U([et, tt, rt, nt, it, Nr, Be, Dr, Br, Or]), at = re([Lr, K(Ur), Tr]), zr = K(U([or, sr, lr, fr, et, tt, rt, nt, it, at, Be, cr, ur])), Vr = zr, $r = Qe(Vr), ot = $r, qr = _(/\\./, J), Wr = _(/./, J), Gr = _(/\*\*\*+/, "*"), jr = _(/([^/{[(!])\*\*/, (f, p) => `${p}*`), Hr = _(/(^|.)\*\*(?=[^*/)\]}])/, (f, p) => `${p}*`), Kr = K(U([qr, Gr, jr, Hr, Wr])), Jr = Kr, Zr = Qe(Jr), Yr = Zr, De = (f, p) => {
484
484
  const A = Array.isArray(f) ? f : [f];
485
485
  if (!A.length) return !1;
486
- const C = A.map(Te.compile), E = A.every((R) => /(\/(?:\*\*)?|\[\/\])$/.test(R)), P = p.replace(/[\\\/]+/g, "/").replace(/\/$/, E ? "/" : "");
486
+ const C = A.map(De.compile), E = A.every((R) => /(\/(?:\*\*)?|\[\/\])$/.test(R)), P = p.replace(/[\\\/]+/g, "/").replace(/\/$/, E ? "/" : "");
487
487
  return C.some((R) => R.test(P));
488
488
  };
489
- Te.compile = (f) => new RegExp(`^${at(Yr(f))}$`, "s");
490
- var Xr = Te;
489
+ De.compile = (f) => new RegExp(`^${ot(Yr(f))}$`, "s");
490
+ var Xr = De;
491
491
  return s(l);
492
492
  })();
493
493
  return r.default || r;
494
- }, De;
495
- const dn = (r, e) => (De || (De = ht(), ht = null), De(r, e)), hn = /^[A-Za-z]:\//;
494
+ }, Ne;
495
+ const dn = (r, e) => (Ne || (Ne = ft(), ft = null), Ne(r, e)), hn = /^[A-Za-z]:\//;
496
496
  function ce(r = "") {
497
497
  return r && r.replace(/\\/g, "/").replace(hn, (e) => e.toUpperCase());
498
498
  }
499
- const fn = /^[/\\]{2}/, mn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, Wt = /^[A-Za-z]:$/, ft = /^\/([A-Za-z]:)?$/, gn = /.(\.[^./]+|\.)$/, pn = /^[/\\]|^[a-zA-Z]:[/\\]/, vn = "/", je = function(r) {
499
+ const fn = /^[/\\]{2}/, mn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, Wt = /^[A-Za-z]:$/, mt = /^\/([A-Za-z]:)?$/, gn = /.(\.[^./]+|\.)$/, pn = /^[/\\]|^[a-zA-Z]:[/\\]/, vn = "/", Ke = function(r) {
500
500
  if (r.length === 0)
501
501
  return ".";
502
502
  r = ce(r);
503
503
  const e = r.match(fn), t = ve(r), n = r[r.length - 1] === "/";
504
- return r = He(r, !t), r.length === 0 ? t ? "/" : n ? "./" : "." : (n && (r += "/"), Wt.test(r) && (r += "/"), e ? t ? `//${r}` : `//./${r}` : t && !ve(r) ? `/${r}` : r);
504
+ return r = Je(r, !t), r.length === 0 ? t ? "/" : n ? "./" : "." : (n && (r += "/"), Wt.test(r) && (r += "/"), e ? t ? `//${r}` : `//./${r}` : t && !ve(r) ? `/${r}` : r);
505
505
  }, wn = function(...r) {
506
506
  let e = "";
507
507
  for (const t of r)
@@ -511,21 +511,21 @@ const fn = /^[/\\]{2}/, mn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,
511
511
  n && i ? e += t.slice(1) : e += n || i ? t : `/${t}`;
512
512
  } else
513
513
  e += t;
514
- return je(e);
514
+ return Ke(e);
515
515
  };
516
516
  function yn() {
517
517
  return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
518
518
  }
519
- const ke = function(...r) {
519
+ const Me = function(...r) {
520
520
  r = r.map((n) => ce(n));
521
521
  let e = "", t = !1;
522
522
  for (let n = r.length - 1; n >= -1 && !t; n--) {
523
523
  const i = n >= 0 ? r[n] : yn();
524
524
  !i || i.length === 0 || (e = `${i}/${e}`, t = ve(i));
525
525
  }
526
- return e = He(e, !t), t && !ve(e) ? `/${e}` : e.length > 0 ? e : ".";
526
+ return e = Je(e, !t), t && !ve(e) ? `/${e}` : e.length > 0 ? e : ".";
527
527
  };
528
- function He(r, e) {
528
+ function Je(r, e) {
529
529
  let t = "", n = 0, i = -1, a = 0, o = null;
530
530
  for (let s = 0; s <= r.length; ++s) {
531
531
  if (s < r.length)
@@ -564,7 +564,7 @@ const ve = function(r) {
564
564
  const e = gn.exec(ce(r));
565
565
  return e && e[1] || "";
566
566
  }, Sn = function(r, e) {
567
- const t = ke(r).replace(ft, "$1").split("/"), n = ke(e).replace(ft, "$1").split("/");
567
+ const t = Me(r).replace(mt, "$1").split("/"), n = Me(e).replace(mt, "$1").split("/");
568
568
  if (n[0][1] === ":" && t[0][1] === ":" && t[0] !== n[0])
569
569
  return n.join("/");
570
570
  const i = [...t];
@@ -582,7 +582,7 @@ const ve = function(r) {
582
582
  Boolean
583
583
  );
584
584
  return ce(
585
- r.root ? ke(...t) : t.join("/")
585
+ r.root ? Me(...t) : t.join("/")
586
586
  );
587
587
  }, Ht = function(r, e) {
588
588
  const t = ce(r).split("/");
@@ -605,7 +605,7 @@ const ve = function(r) {
605
605
  ext: n,
606
606
  name: t.slice(0, t.length - n.length)
607
607
  };
608
- }, _n = (r, e) => dn(e, je(r)), mt = {
608
+ }, _n = (r, e) => dn(e, Ke(r)), gt = {
609
609
  __proto__: null,
610
610
  basename: Ht,
611
611
  dirname: jt,
@@ -614,22 +614,22 @@ const ve = function(r) {
614
614
  isAbsolute: ve,
615
615
  join: wn,
616
616
  matchesGlob: _n,
617
- normalize: je,
618
- normalizeString: He,
617
+ normalize: Ke,
618
+ normalizeString: Je,
619
619
  parse: Cn,
620
620
  relative: Sn,
621
- resolve: ke,
621
+ resolve: Me,
622
622
  sep: vn,
623
623
  toNamespacedPath: An
624
624
  }, En = /* @__PURE__ */ (() => {
625
625
  var r;
626
626
  return ((r = globalThis.process) == null ? void 0 : r.platform) === "win32" ? ";" : ":";
627
- })(), xn = { posix: void 0, win32: void 0 }, Kt = (r = En) => new Proxy(mt, {
627
+ })(), xn = { posix: void 0, win32: void 0 }, Kt = (r = En) => new Proxy(gt, {
628
628
  get(e, t) {
629
- return t === "delimiter" ? r : t === "posix" ? $e : t === "win32" ? Pn : xn[t] || mt[t];
629
+ return t === "delimiter" ? r : t === "posix" ? We : t === "win32" ? Pn : xn[t] || gt[t];
630
630
  }
631
- }), $e = /* @__PURE__ */ Kt(":"), Pn = /* @__PURE__ */ Kt(";");
632
- var M = /* @__PURE__ */ ((r) => (r[r.Error = 0] = "Error", r[r.Warning = 1] = "Warning", r[r.Log = 2] = "Log", r[r.Verbose = 3] = "Verbose", r[r.Debug = 4] = "Debug", r))(M || {}), I = /* @__PURE__ */ ((r) => (r.Error = "error", r.Warning = "warn", r.Log = "log", r.Verbose = "verbose", r.Debug = "debug", r))(I || {}), te = /* @__PURE__ */ ((r) => (r.JSON = "json", r.Pretty = "pretty", r))(te || {});
631
+ }), We = /* @__PURE__ */ Kt(":"), Pn = /* @__PURE__ */ Kt(";");
632
+ var k = /* @__PURE__ */ ((r) => (r[r.Error = 0] = "Error", r[r.Warning = 1] = "Warning", r[r.Log = 2] = "Log", r[r.Verbose = 3] = "Verbose", r[r.Debug = 4] = "Debug", r))(k || {}), I = /* @__PURE__ */ ((r) => (r.Error = "error", r.Warning = "warn", r.Log = "log", r.Verbose = "verbose", r.Debug = "debug", r))(I || {}), te = /* @__PURE__ */ ((r) => (r.JSON = "json", r.Pretty = "pretty", r))(te || {});
633
633
  const In = !0;
634
634
  function F(r, e, t = r) {
635
635
  return (n) => {
@@ -671,36 +671,36 @@ function kn(r = In) {
671
671
  bgWhite: r ? F("\x1B[47m", "\x1B[49m") : String
672
672
  };
673
673
  }
674
- const B = kn(), qe = {
675
- [I.Error]: M.Error,
676
- [I.Warning]: M.Warning,
677
- [I.Log]: M.Log,
678
- [I.Verbose]: M.Verbose,
679
- [I.Debug]: M.Debug
674
+ const B = kn(), Ge = {
675
+ [I.Error]: k.Error,
676
+ [I.Warning]: k.Warning,
677
+ [I.Log]: k.Log,
678
+ [I.Verbose]: k.Verbose,
679
+ [I.Debug]: k.Debug
680
680
  }, Mn = {
681
- [M.Error]: I.Error,
682
- [M.Warning]: I.Warning,
683
- [M.Log]: I.Log,
684
- [M.Verbose]: I.Verbose,
685
- [M.Debug]: I.Debug
686
- }, gt = [
681
+ [k.Error]: I.Error,
682
+ [k.Warning]: I.Warning,
683
+ [k.Log]: I.Log,
684
+ [k.Verbose]: I.Verbose,
685
+ [k.Debug]: I.Debug
686
+ }, pt = [
687
687
  I.Error,
688
688
  I.Warning,
689
689
  I.Log,
690
690
  I.Verbose,
691
691
  I.Debug
692
692
  ], Fn = {
693
- [M.Error]: B.red,
694
- [M.Warning]: B.yellow,
695
- [M.Log]: B.blue,
696
- [M.Verbose]: B.cyan,
697
- [M.Debug]: B.green
698
- }, pt = [
699
- M.Error,
700
- M.Warning,
701
- M.Log,
702
- M.Verbose,
703
- M.Debug
693
+ [k.Error]: B.red,
694
+ [k.Warning]: B.yellow,
695
+ [k.Log]: B.blue,
696
+ [k.Verbose]: B.cyan,
697
+ [k.Debug]: B.green
698
+ }, Fe = [
699
+ k.Error,
700
+ k.Warning,
701
+ k.Log,
702
+ k.Verbose,
703
+ k.Debug
704
704
  ], vt = [te.JSON, te.Pretty];
705
705
  function Rn(r) {
706
706
  return r.stack == null ? [] : r.stack.split(`
@@ -765,10 +765,10 @@ function wt(r) {
765
765
  }
766
766
  return e;
767
767
  }
768
- function Ee(r) {
768
+ function xe(r) {
769
769
  const e = [];
770
770
  e.push(r["@localetime"]), e.push(
771
- Fn[qe[r.level]](
771
+ Fn[Ge[r.level]](
772
772
  `[${r.level}]`
773
773
  )
774
774
  );
@@ -795,53 +795,65 @@ function Ee(r) {
795
795
  ${r.error.stack}`), i;
796
796
  }
797
797
  function Tn(r) {
798
- return r >= M.Debug;
798
+ return r >= k.Debug;
799
799
  }
800
800
  function Bn(r) {
801
- return r >= M.Verbose;
801
+ return r >= k.Verbose;
802
802
  }
803
803
  function Dn(r) {
804
- return r >= M.Log;
804
+ return r >= k.Log;
805
805
  }
806
806
  function On(r) {
807
- return r >= M.Warning;
807
+ return r >= k.Warning;
808
808
  }
809
809
  function Nn(r) {
810
- return r >= M.Error;
810
+ return r >= k.Error;
811
811
  }
812
812
  function Xt() {
813
813
  return typeof window < "u";
814
814
  }
815
815
  function Un() {
816
- return !Xt() && We() === te.Pretty;
816
+ return !Xt() && je() === te.Pretty;
817
817
  }
818
818
  function zn(r, e) {
819
819
  return Un() ? `\x1B]8;;file://${r}\x1B\\${e}\x1B]8;;\x1B\\` : e;
820
820
  }
821
- const Ke = {
822
- logLevel: M.Debug,
821
+ const _e = {
822
+ configured: !1,
823
+ logLevel: k.Debug,
823
824
  format: te.JSON,
824
825
  timeFormatter: (r) => r.toISOString()
825
826
  };
826
827
  function yt() {
827
- return Ke.logLevel;
828
+ return _e.logLevel;
828
829
  }
829
- function We() {
830
- return Ke.format;
830
+ function Vn(r) {
831
+ if (Fe.includes(r))
832
+ _e.logLevel = r;
833
+ else
834
+ throw new Error(
835
+ `log level ${r} is not available. available log levels are: ${Fe.join(
836
+ ", "
837
+ )}`
838
+ );
839
+ _e.configured = !0;
831
840
  }
832
- function Vn() {
833
- return Ke.timeFormatter;
841
+ function je() {
842
+ return _e.format;
843
+ }
844
+ function $n() {
845
+ return _e.timeFormatter;
834
846
  }
835
847
  function Qt(r) {
836
848
  const e = {
837
849
  fields: {},
838
850
  context: r,
839
- logLevel: M.Debug,
851
+ logLevel: k.Debug,
840
852
  format: te.JSON,
841
853
  shouldUseGlobalConfig: !1,
842
854
  errorProcessor: (c) => c,
843
855
  timeFormatter: (c) => c.toISOString(),
844
- useGlobalConfig: () => (e.shouldUseGlobalConfig = !0, e.format = We(), e.logLevel = yt(), e.child()),
856
+ useGlobalConfig: () => (e.shouldUseGlobalConfig = !0, e.format = je(), e.logLevel = yt(), e.child()),
845
857
  child: (c) => {
846
858
  const u = Qt(e.context);
847
859
  return c != null ? u.fields = { ...e.fields, ...c } : u.fields = e.fields, u.fields != null && "context" in u.fields ? u.context = u.fields.context : u.context = e.context, u.logLevel = e.logLevel, u.format = e.format, u.shouldUseGlobalConfig = e.shouldUseGlobalConfig, u;
@@ -852,13 +864,13 @@ function Qt(r) {
852
864
  },
853
865
  withLogLevel: (c) => {
854
866
  const u = e.child();
855
- if (pt.includes(c))
867
+ if (Fe.includes(c))
856
868
  u.logLevel = c, u.shouldUseGlobalConfig = !1, u.debug(
857
869
  `setting log level to ${Mn[c]} (${c})`
858
870
  );
859
871
  else
860
872
  throw new Error(
861
- `log level ${c} is not available. available log levels are: ${pt.join(
873
+ `log level ${c} is not available. available log levels are: ${Fe.join(
862
874
  ", "
863
875
  )}`
864
876
  );
@@ -866,13 +878,13 @@ function Qt(r) {
866
878
  },
867
879
  withLogLevelString: (c) => {
868
880
  const u = e.child();
869
- if (gt.includes(c))
870
- u.logLevel = qe[c], u.shouldUseGlobalConfig = !1, u.debug(
871
- `setting log level to ${c} (${qe[c]})`
881
+ if (pt.includes(c))
882
+ u.logLevel = Ge[c], u.shouldUseGlobalConfig = !1, u.debug(
883
+ `setting log level to ${c} (${Ge[c]})`
872
884
  );
873
885
  else
874
886
  throw new Error(
875
- `log level ${c} is not available. available log levels are: ${gt.join(
887
+ `log level ${c} is not available. available log levels are: ${pt.join(
876
888
  ", "
877
889
  )}`
878
890
  );
@@ -940,7 +952,7 @@ function Qt(r) {
940
952
  const u = e.child();
941
953
  return u.errorProcessor = c, u;
942
954
  }
943
- }, t = () => e.shouldUseGlobalConfig ? yt() : e.logLevel, n = () => e.shouldUseGlobalConfig ? We() : e.format, i = () => e.shouldUseGlobalConfig ? Vn() : e.timeFormatter ?? ((c) => c.toISOString()), a = (c) => c != null && c.length > 0 ? Object.keys(e.fields).length > 0 ? [e.fields, ...c] : c : e.fields, o = (c, u, m) => {
955
+ }, t = () => e.shouldUseGlobalConfig ? yt() : e.logLevel, n = () => e.shouldUseGlobalConfig ? je() : e.format, i = () => e.shouldUseGlobalConfig ? $n() : e.timeFormatter ?? ((c) => c.toISOString()), a = (c) => c != null && c.length > 0 ? Object.keys(e.fields).length > 0 ? [e.fields, ...c] : c : e.fields, o = (c, u, m) => {
944
956
  const v = n();
945
957
  if (Xt() && v === te.Pretty) {
946
958
  c.fields = Object.fromEntries(
@@ -950,10 +962,10 @@ function Qt(r) {
950
962
  })
951
963
  );
952
964
  const y = m ?? e.fields;
953
- Array.isArray(y) && y.length > 0 ? console[u](Ee(c), ...y) : Object.keys(y).length > 0 ? console[u](Ee(c), y) : console[u](Ee(c));
965
+ Array.isArray(y) && y.length > 0 ? console[u](xe(c), ...y) : Object.keys(y).length > 0 ? console[u](xe(c), y) : console[u](xe(c));
954
966
  return;
955
967
  }
956
- const w = v === te.Pretty ? Ee(c) : JSON.stringify(c);
968
+ const w = v === te.Pretty ? xe(c) : JSON.stringify(c);
957
969
  console[u](w);
958
970
  }, s = {
959
971
  [I.Debug]: Tn,
@@ -1001,35 +1013,36 @@ function Qt(r) {
1001
1013
  o(y, "error", w);
1002
1014
  }, e.errorWithError = (c, u, ...m) => e.withError(u).error(c, void 0, ...m), e;
1003
1015
  }
1004
- function $n(r) {
1016
+ function qn(r) {
1005
1017
  var a;
1006
- const t = un.parse(new Error())[1], n = ((a = t.fileName) == null ? void 0 : a.replace("async", "").trim()) ?? "", i = $e.join(...n.split($e.sep).slice(-2));
1018
+ const t = un.parse(new Error())[1], n = ((a = t.fileName) == null ? void 0 : a.replace("async", "").trim()) ?? "", i = We.join(...n.split(We.sep).slice(-2));
1007
1019
  return r = r ?? `${i}:${t.lineNumber}`, Qt(zn(n, r));
1008
1020
  }
1009
- const qn = (r) => $n(r).useGlobalConfig();
1021
+ const Wn = (r) => qn(r).useGlobalConfig();
1010
1022
  let Q = [];
1011
1023
  const At = 100;
1012
- async function Wn() {
1024
+ async function Gn() {
1013
1025
  if (Q.length === 0)
1014
1026
  return;
1015
1027
  const r = [...Q];
1016
1028
  Q = [];
1017
1029
  try {
1018
- await Gn();
1030
+ await jn();
1019
1031
  } catch (e) {
1020
1032
  h.warn("[CLS] Failed to flush logs:", e instanceof Error ? e.message : String(e)), Q.unshift(...r), Q.length > At && (Q = Q.slice(0, At));
1021
1033
  }
1022
1034
  }
1023
- async function Gn(r) {
1035
+ async function jn(r) {
1024
1036
  }
1025
- function jn() {
1026
- Q.length > 0 && Wn(), h.log("[CLS] Cleaned up");
1037
+ function Hn() {
1038
+ Q.length > 0 && Gn(), h.log("[CLS] Cleaned up");
1027
1039
  }
1028
- const h = qn("Web").withErrorProcessor((r) => r).useGlobalConfig(), D = {
1040
+ Vn(k.Warning);
1041
+ const h = Wn("Web").withErrorProcessor((r) => r).useGlobalConfig(), D = {
1029
1042
  config: null,
1030
1043
  promise: null
1031
1044
  };
1032
- async function Hn(r) {
1045
+ async function Kn(r) {
1033
1046
  return D.promise ? (await D.promise, D.config || {}) : D.config ? D.config : (D.promise = (async () => {
1034
1047
  try {
1035
1048
  const t = typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") ? `/api/config/sdk?version=${r}` : `https://config.spatialwalk.top/sdk?version=${r}`;
@@ -1047,17 +1060,17 @@ async function Hn(r) {
1047
1060
  throw new Error("Invalid config response: missing endpoints");
1048
1061
  const a = {};
1049
1062
  i.endpoints.cn && (a[le.cn] = `https://${i.endpoints.cn}`), i.endpoints.us && (a[le.us] = `https://${i.endpoints.us}`), i.endpoints.test && (a[le.test] = `https://${i.endpoints.test}`), D.config = a, h.log("[SdkConfigLoader] SDK config fetched successfully:", a);
1050
- } catch (e) {
1051
- h.warn("[SdkConfigLoader] Failed to fetch SDK config:", e instanceof Error ? e.message : String(e)), D.config = {};
1063
+ } catch {
1064
+ D.config = {};
1052
1065
  } finally {
1053
1066
  D.promise = null;
1054
1067
  }
1055
1068
  })(), await D.promise, D.config || {});
1056
1069
  }
1057
- function Kn() {
1070
+ function Jn() {
1058
1071
  D.config = null, D.promise = null;
1059
1072
  }
1060
- class Jn {
1073
+ class Zn {
1061
1074
  constructor(e) {
1062
1075
  d(this, "module");
1063
1076
  d(this, "allocatedPointers");
@@ -1277,7 +1290,7 @@ class Jn {
1277
1290
  };
1278
1291
  }
1279
1292
  }
1280
- class Zn {
1293
+ class Yn {
1281
1294
  constructor(e = {}) {
1282
1295
  // 配置
1283
1296
  d(this, "options");
@@ -1347,7 +1360,7 @@ class Zn {
1347
1360
  async loadWASMModule() {
1348
1361
  try {
1349
1362
  const { default: e } = await import("./avatar_core_wasm-D4eEi7Eh.js");
1350
- this.wasmConfig && Object.keys(this.wasmConfig).length > 0 ? this.wasmModule = await e(this.wasmConfig) : this.wasmModule = await e(), this.validateWASMModule(), this.memoryManager = new Jn(this.wasmModule), this.setupCAPIFunctions(), h.log("✅ Created new WASM instance with clean C++ memory");
1363
+ this.wasmConfig && Object.keys(this.wasmConfig).length > 0 ? this.wasmModule = await e(this.wasmConfig) : this.wasmModule = await e(), this.validateWASMModule(), this.memoryManager = new Zn(this.wasmModule), this.setupCAPIFunctions(), h.log("✅ Created new WASM instance with clean C++ memory");
1351
1364
  } catch (e) {
1352
1365
  const t = e instanceof Error ? e.message : String(e);
1353
1366
  throw new Error(`Failed to load WASM module: ${t}`);
@@ -1806,7 +1819,7 @@ class b {
1806
1819
  */
1807
1820
  static async initializeWASMModule() {
1808
1821
  try {
1809
- h.log("[AvatarKit] Initializing WASM module..."), this._avatarCore = new Zn({
1822
+ h.log("[AvatarKit] Initializing WASM module..."), this._avatarCore = new Yn({
1810
1823
  logLevel: "basic",
1811
1824
  enableValidation: !0,
1812
1825
  enablePerformanceMetrics: !0,
@@ -1876,7 +1889,7 @@ class b {
1876
1889
  static cleanup() {
1877
1890
  if (this._isInitialized)
1878
1891
  try {
1879
- this._avatarCore && (this._avatarCore.release(), this._avatarCore = null), this._appId = null, this._configuration = null, this._sessionToken = null, this._userId = null, this._dynamicSdkConfig = null, this._isInitialized = !1, Kn(), jn(), h.log("[AvatarKit] Cleanup completed");
1892
+ this._avatarCore && (this._avatarCore.release(), this._avatarCore = null), this._appId = null, this._configuration = null, this._sessionToken = null, this._userId = null, this._dynamicSdkConfig = null, this._isInitialized = !1, Jn(), Hn(), h.log("[AvatarKit] Cleanup completed");
1880
1893
  } catch (e) {
1881
1894
  h.error("Failed to cleanup AvatarKit:", e instanceof Error ? e.message : String(e));
1882
1895
  }
@@ -1886,7 +1899,7 @@ class b {
1886
1899
  */
1887
1900
  static async _fetchSdkConfig() {
1888
1901
  try {
1889
- this._dynamicSdkConfig = await Hn(this._version);
1902
+ this._dynamicSdkConfig = await Kn(this._version);
1890
1903
  } catch (e) {
1891
1904
  const t = e instanceof Error ? e.message : String(e);
1892
1905
  h.warn("Failed to fetch SDK config from remote, using defaults:", t), this.logEvent("sdk_config", "warning", {
@@ -1940,7 +1953,7 @@ class b {
1940
1953
  h[a](`[Telemetry] ${e}`, i);
1941
1954
  }
1942
1955
  }
1943
- d(b, "_isInitialized", !1), d(b, "_appId", null), d(b, "_configuration", null), d(b, "_sessionToken", null), d(b, "_userId", null), d(b, "_version", "1.0.0-beta.11"), d(b, "_avatarCore", null), d(b, "_dynamicSdkConfig", null), d(b, "_logLevels", {
1956
+ d(b, "_isInitialized", !1), d(b, "_appId", null), d(b, "_configuration", null), d(b, "_sessionToken", null), d(b, "_userId", null), d(b, "_version", "1.0.0-beta.13"), d(b, "_avatarCore", null), d(b, "_dynamicSdkConfig", null), d(b, "_logLevels", {
1944
1957
  debug: "log",
1945
1958
  info: "log",
1946
1959
  warning: "warn",
@@ -1951,7 +1964,7 @@ const Ce = class Ce {
1951
1964
  d(this, "audio", null);
1952
1965
  d(this, "streamingPlayer", null);
1953
1966
  d(this, "_isPlaying", !1);
1954
- d(this, "fps", k.animation.fps);
1967
+ d(this, "fps", M.animation.fps);
1955
1968
  d(this, "onEndedCallback");
1956
1969
  d(this, "useStreaming", !1);
1957
1970
  }
@@ -2009,9 +2022,9 @@ const Ce = class Ce {
2009
2022
  async createAndInitializeStreamingPlayer() {
2010
2023
  if (this.streamingPlayer)
2011
2024
  return;
2012
- const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-CLFmPod8.js");
2025
+ const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-CsVJinsO.js");
2013
2026
  this.streamingPlayer = new e({
2014
- sampleRate: k.audio.sampleRate,
2027
+ sampleRate: M.audio.sampleRate,
2015
2028
  channelCount: 1,
2016
2029
  debug: !1
2017
2030
  });
@@ -2086,7 +2099,7 @@ const Ce = class Ce {
2086
2099
  };
2087
2100
  d(Ce, "audioUnlocked", !1);
2088
2101
  let be = Ce;
2089
- function Yn() {
2102
+ function Xn() {
2090
2103
  let r = 0, e = 0;
2091
2104
  for (let n = 0; n < 28; n += 7) {
2092
2105
  let i = this.buf[this.pos++];
@@ -2103,7 +2116,7 @@ function Yn() {
2103
2116
  }
2104
2117
  throw new Error("invalid varint");
2105
2118
  }
2106
- function Oe(r, e, t) {
2119
+ function Ue(r, e, t) {
2107
2120
  for (let a = 0; a < 28; a = a + 7) {
2108
2121
  const o = r >>> a, s = !(!(o >>> 7) && e == 0), l = (s ? o | 128 : o) & 255;
2109
2122
  if (t.push(l), !s)
@@ -2119,7 +2132,7 @@ function Oe(r, e, t) {
2119
2132
  t.push(e >>> 31 & 1);
2120
2133
  }
2121
2134
  }
2122
- const Pe = 4294967296;
2135
+ const Ie = 4294967296;
2123
2136
  function St(r) {
2124
2137
  const e = r[0] === "-";
2125
2138
  e && (r = r.slice(1));
@@ -2127,33 +2140,33 @@ function St(r) {
2127
2140
  let n = 0, i = 0;
2128
2141
  function a(o, s) {
2129
2142
  const l = Number(r.slice(o, s));
2130
- i *= t, n = n * t + l, n >= Pe && (i = i + (n / Pe | 0), n = n % Pe);
2143
+ i *= t, n = n * t + l, n >= Ie && (i = i + (n / Ie | 0), n = n % Ie);
2131
2144
  }
2132
- return a(-24, -18), a(-18, -12), a(-12, -6), a(-6), e ? tr(n, i) : Je(n, i);
2145
+ return a(-24, -18), a(-18, -12), a(-12, -6), a(-6), e ? tr(n, i) : Ze(n, i);
2133
2146
  }
2134
- function Xn(r, e) {
2135
- let t = Je(r, e);
2147
+ function Qn(r, e) {
2148
+ let t = Ze(r, e);
2136
2149
  const n = t.hi & 2147483648;
2137
2150
  n && (t = tr(t.lo, t.hi));
2138
2151
  const i = er(t.lo, t.hi);
2139
2152
  return n ? "-" + i : i;
2140
2153
  }
2141
2154
  function er(r, e) {
2142
- if ({ lo: r, hi: e } = Qn(r, e), e <= 2097151)
2143
- return String(Pe * e + r);
2155
+ if ({ lo: r, hi: e } = ei(r, e), e <= 2097151)
2156
+ return String(Ie * e + r);
2144
2157
  const t = r & 16777215, n = (r >>> 24 | e << 8) & 16777215, i = e >> 16 & 65535;
2145
2158
  let a = t + n * 6777216 + i * 6710656, o = n + i * 8147497, s = i * 2;
2146
2159
  const l = 1e7;
2147
2160
  return a >= l && (o += Math.floor(a / l), a %= l), o >= l && (s += Math.floor(o / l), o %= l), s.toString() + bt(o) + bt(a);
2148
2161
  }
2149
- function Qn(r, e) {
2162
+ function ei(r, e) {
2150
2163
  return { lo: r >>> 0, hi: e >>> 0 };
2151
2164
  }
2152
- function Je(r, e) {
2165
+ function Ze(r, e) {
2153
2166
  return { lo: r | 0, hi: e | 0 };
2154
2167
  }
2155
2168
  function tr(r, e) {
2156
- return e = ~e, r ? r = ~r + 1 : e += 1, Je(r, e);
2169
+ return e = ~e, r ? r = ~r + 1 : e += 1, Ze(r, e);
2157
2170
  }
2158
2171
  const bt = (r) => {
2159
2172
  const e = String(r);
@@ -2170,7 +2183,7 @@ function Ct(r, e) {
2170
2183
  e.push(1);
2171
2184
  }
2172
2185
  }
2173
- function ei() {
2186
+ function ti() {
2174
2187
  let r = this.buf[this.pos++], e = r & 127;
2175
2188
  if (!(r & 128))
2176
2189
  return this.assertBounds(), e;
@@ -2187,8 +2200,8 @@ function ei() {
2187
2200
  throw new Error("invalid varint");
2188
2201
  return this.assertBounds(), e >>> 0;
2189
2202
  }
2190
- const H = /* @__PURE__ */ ti();
2191
- function ti() {
2203
+ const H = /* @__PURE__ */ ri();
2204
+ function ri() {
2192
2205
  const r = new DataView(new ArrayBuffer(8));
2193
2206
  if (typeof BigInt == "function" && typeof r.getBigInt64 == "function" && typeof r.getBigUint64 == "function" && typeof r.setBigInt64 == "function" && typeof r.setBigUint64 == "function" && (!!globalThis.Deno || typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1")) {
2194
2207
  const t = BigInt("-9223372036854775808"), n = BigInt("9223372036854775807"), i = BigInt("0"), a = BigInt("18446744073709551615");
@@ -2243,7 +2256,7 @@ function ti() {
2243
2256
  return typeof t != "string" && (t = t.toString()), Et(t), St(t);
2244
2257
  },
2245
2258
  dec(t, n) {
2246
- return Xn(t, n);
2259
+ return Qn(t, n);
2247
2260
  },
2248
2261
  uDec(t, n) {
2249
2262
  return er(t, n);
@@ -2258,11 +2271,11 @@ function Et(r) {
2258
2271
  if (!/^[0-9]+$/.test(r))
2259
2272
  throw new Error("invalid uint64: " + r);
2260
2273
  }
2261
- const Ne = Symbol.for("@bufbuild/protobuf/text-encoding");
2274
+ const ze = Symbol.for("@bufbuild/protobuf/text-encoding");
2262
2275
  function rr() {
2263
- if (globalThis[Ne] == null) {
2276
+ if (globalThis[ze] == null) {
2264
2277
  const r = new globalThis.TextEncoder(), e = new globalThis.TextDecoder();
2265
- globalThis[Ne] = {
2278
+ globalThis[ze] = {
2266
2279
  encodeUtf8(t) {
2267
2280
  return r.encode(t);
2268
2281
  },
@@ -2278,13 +2291,13 @@ function rr() {
2278
2291
  }
2279
2292
  };
2280
2293
  }
2281
- return globalThis[Ne];
2294
+ return globalThis[ze];
2282
2295
  }
2283
2296
  var ee;
2284
2297
  (function(r) {
2285
2298
  r[r.Varint = 0] = "Varint", r[r.Bit64 = 1] = "Bit64", r[r.LengthDelimited = 2] = "LengthDelimited", r[r.StartGroup = 3] = "StartGroup", r[r.EndGroup = 4] = "EndGroup", r[r.Bit32 = 5] = "Bit32";
2286
2299
  })(ee || (ee = {}));
2287
- const ri = 34028234663852886e22, ni = -34028234663852886e22, ii = 4294967295, ai = 2147483647, oi = -2147483648;
2300
+ const ni = 34028234663852886e22, ii = -34028234663852886e22, ai = 4294967295, oi = 2147483647, si = -2147483648;
2288
2301
  class ue {
2289
2302
  constructor(e = rr().encodeUtf8) {
2290
2303
  this.encodeUtf8 = e, this.stack = [], this.chunks = [], this.buf = [];
@@ -2349,7 +2362,7 @@ class ue {
2349
2362
  * Write a `int32` value, a signed 32 bit varint.
2350
2363
  */
2351
2364
  int32(e) {
2352
- return Ue(e), Ct(e, this.buf), this;
2365
+ return Ve(e), Ct(e, this.buf), this;
2353
2366
  }
2354
2367
  /**
2355
2368
  * Write a `bool` value, a variant.
@@ -2374,7 +2387,7 @@ class ue {
2374
2387
  * Write a `float` value, 32-bit floating point number.
2375
2388
  */
2376
2389
  float(e) {
2377
- si(e);
2390
+ li(e);
2378
2391
  let t = new Uint8Array(4);
2379
2392
  return new DataView(t.buffer).setFloat32(0, e, !0), this.raw(t);
2380
2393
  }
@@ -2397,7 +2410,7 @@ class ue {
2397
2410
  * Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
2398
2411
  */
2399
2412
  sfixed32(e) {
2400
- Ue(e);
2413
+ Ve(e);
2401
2414
  let t = new Uint8Array(4);
2402
2415
  return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
2403
2416
  }
@@ -2405,7 +2418,7 @@ class ue {
2405
2418
  * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
2406
2419
  */
2407
2420
  sint32(e) {
2408
- return Ue(e), e = (e << 1 ^ e >> 31) >>> 0, Ct(e, this.buf), this;
2421
+ return Ve(e), e = (e << 1 ^ e >> 31) >>> 0, Ct(e, this.buf), this;
2409
2422
  }
2410
2423
  /**
2411
2424
  * Write a `fixed64` value, a signed, fixed-length 64-bit integer.
@@ -2426,26 +2439,26 @@ class ue {
2426
2439
  */
2427
2440
  int64(e) {
2428
2441
  let t = H.enc(e);
2429
- return Oe(t.lo, t.hi, this.buf), this;
2442
+ return Ue(t.lo, t.hi, this.buf), this;
2430
2443
  }
2431
2444
  /**
2432
2445
  * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
2433
2446
  */
2434
2447
  sint64(e) {
2435
2448
  const t = H.enc(e), n = t.hi >> 31, i = t.lo << 1 ^ n, a = (t.hi << 1 | t.lo >>> 31) ^ n;
2436
- return Oe(i, a, this.buf), this;
2449
+ return Ue(i, a, this.buf), this;
2437
2450
  }
2438
2451
  /**
2439
2452
  * Write a `uint64` value, an unsigned 64-bit varint.
2440
2453
  */
2441
2454
  uint64(e) {
2442
2455
  const t = H.uEnc(e);
2443
- return Oe(t.lo, t.hi, this.buf), this;
2456
+ return Ue(t.lo, t.hi, this.buf), this;
2444
2457
  }
2445
2458
  }
2446
2459
  class O {
2447
2460
  constructor(e, t = rr().decodeUtf8) {
2448
- this.decodeUtf8 = t, this.varint64 = Yn, this.uint32 = ei, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength);
2461
+ this.decodeUtf8 = t, this.varint64 = Xn, this.uint32 = ti, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength);
2449
2462
  }
2450
2463
  /**
2451
2464
  * Reads a tag - field number and wire type.
@@ -2590,12 +2603,12 @@ class O {
2590
2603
  return this.decodeUtf8(this.bytes());
2591
2604
  }
2592
2605
  }
2593
- function Ue(r) {
2606
+ function Ve(r) {
2594
2607
  if (typeof r == "string")
2595
2608
  r = Number(r);
2596
2609
  else if (typeof r != "number")
2597
2610
  throw new Error("invalid int32: " + typeof r);
2598
- if (!Number.isInteger(r) || r > ai || r < oi)
2611
+ if (!Number.isInteger(r) || r > oi || r < si)
2599
2612
  throw new Error("invalid int32: " + r);
2600
2613
  }
2601
2614
  function xt(r) {
@@ -2603,21 +2616,21 @@ function xt(r) {
2603
2616
  r = Number(r);
2604
2617
  else if (typeof r != "number")
2605
2618
  throw new Error("invalid uint32: " + typeof r);
2606
- if (!Number.isInteger(r) || r > ii || r < 0)
2619
+ if (!Number.isInteger(r) || r > ai || r < 0)
2607
2620
  throw new Error("invalid uint32: " + r);
2608
2621
  }
2609
- function si(r) {
2622
+ function li(r) {
2610
2623
  if (typeof r == "string") {
2611
2624
  const e = r;
2612
2625
  if (r = Number(r), Number.isNaN(r) && e !== "NaN")
2613
2626
  throw new Error("invalid float32: " + e);
2614
2627
  } else if (typeof r != "number")
2615
2628
  throw new Error("invalid float32: " + typeof r);
2616
- if (Number.isFinite(r) && (r > ri || r < ni))
2629
+ if (Number.isFinite(r) && (r > ni || r < ii))
2617
2630
  throw new Error("invalid float32: " + r);
2618
2631
  }
2619
- var _e = /* @__PURE__ */ ((r) => (r[r.MESSAGE_UNSPECIFIED = 0] = "MESSAGE_UNSPECIFIED", r[r.MESSAGE_ERROR = 2] = "MESSAGE_ERROR", r[r.MESSAGE_SERVER_RESPONSE_ANIMATION = 1004] = "MESSAGE_SERVER_RESPONSE_ANIMATION", r[r.MESSAGE_CLIENT_AUDIO_INPUT = 2003] = "MESSAGE_CLIENT_AUDIO_INPUT", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(_e || {});
2620
- function li(r) {
2632
+ var Ee = /* @__PURE__ */ ((r) => (r[r.MESSAGE_UNSPECIFIED = 0] = "MESSAGE_UNSPECIFIED", r[r.MESSAGE_ERROR = 2] = "MESSAGE_ERROR", r[r.MESSAGE_SERVER_RESPONSE_ANIMATION = 1004] = "MESSAGE_SERVER_RESPONSE_ANIMATION", r[r.MESSAGE_CLIENT_AUDIO_INPUT = 2003] = "MESSAGE_CLIENT_AUDIO_INPUT", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(Ee || {});
2633
+ function ci(r) {
2621
2634
  switch (r) {
2622
2635
  case 0:
2623
2636
  case "MESSAGE_UNSPECIFIED":
@@ -2637,7 +2650,7 @@ function li(r) {
2637
2650
  return -1;
2638
2651
  }
2639
2652
  }
2640
- function ci(r) {
2653
+ function ui(r) {
2641
2654
  switch (r) {
2642
2655
  case 0:
2643
2656
  return "MESSAGE_UNSPECIFIED";
@@ -2694,13 +2707,13 @@ const he = {
2694
2707
  fromJSON(r) {
2695
2708
  return {
2696
2709
  reqId: V(r.reqId) ? globalThis.String(r.reqId) : "",
2697
- audio: V(r.audio) ? ui(r.audio) : new Uint8Array(0),
2710
+ audio: V(r.audio) ? di(r.audio) : new Uint8Array(0),
2698
2711
  end: V(r.end) ? globalThis.Boolean(r.end) : !1
2699
2712
  };
2700
2713
  },
2701
2714
  toJSON(r) {
2702
2715
  const e = {};
2703
- return r.reqId !== "" && (e.reqId = r.reqId), r.audio.length !== 0 && (e.audio = di(r.audio)), r.end !== !1 && (e.end = r.end), e;
2716
+ return r.reqId !== "" && (e.reqId = r.reqId), r.audio.length !== 0 && (e.audio = hi(r.audio)), r.end !== !1 && (e.end = r.end), e;
2704
2717
  },
2705
2718
  create(r) {
2706
2719
  return he.fromPartial(r ?? {});
@@ -3028,7 +3041,7 @@ const pe = {
3028
3041
  function Rt() {
3029
3042
  return { type: 0, error: void 0, serverResponseAnimation: void 0, clientAudioInput: void 0 };
3030
3043
  }
3031
- const Ge = {
3044
+ const He = {
3032
3045
  encode(r, e = new ue()) {
3033
3046
  return r.type !== 0 && e.uint32(8).int32(r.type), r.error !== void 0 && pe.encode(r.error, e.uint32(18).fork()).join(), r.serverResponseAnimation !== void 0 && ge.encode(r.serverResponseAnimation, e.uint32(26).fork()).join(), r.clientAudioInput !== void 0 && he.encode(r.clientAudioInput, e.uint32(34).fork()).join(), e;
3034
3047
  },
@@ -3072,7 +3085,7 @@ const Ge = {
3072
3085
  },
3073
3086
  fromJSON(r) {
3074
3087
  return {
3075
- type: V(r.type) ? li(r.type) : 0,
3088
+ type: V(r.type) ? ci(r.type) : 0,
3076
3089
  error: V(r.error) ? pe.fromJSON(r.error) : void 0,
3077
3090
  serverResponseAnimation: V(r.serverResponseAnimation) ? ge.fromJSON(r.serverResponseAnimation) : void 0,
3078
3091
  clientAudioInput: V(r.clientAudioInput) ? he.fromJSON(r.clientAudioInput) : void 0
@@ -3080,23 +3093,23 @@ const Ge = {
3080
3093
  },
3081
3094
  toJSON(r) {
3082
3095
  const e = {};
3083
- return r.type !== 0 && (e.type = ci(r.type)), r.error !== void 0 && (e.error = pe.toJSON(r.error)), r.serverResponseAnimation !== void 0 && (e.serverResponseAnimation = ge.toJSON(r.serverResponseAnimation)), r.clientAudioInput !== void 0 && (e.clientAudioInput = he.toJSON(r.clientAudioInput)), e;
3096
+ return r.type !== 0 && (e.type = ui(r.type)), r.error !== void 0 && (e.error = pe.toJSON(r.error)), r.serverResponseAnimation !== void 0 && (e.serverResponseAnimation = ge.toJSON(r.serverResponseAnimation)), r.clientAudioInput !== void 0 && (e.clientAudioInput = he.toJSON(r.clientAudioInput)), e;
3084
3097
  },
3085
3098
  create(r) {
3086
- return Ge.fromPartial(r ?? {});
3099
+ return He.fromPartial(r ?? {});
3087
3100
  },
3088
3101
  fromPartial(r) {
3089
3102
  const e = Rt();
3090
3103
  return e.type = r.type ?? 0, e.error = r.error !== void 0 && r.error !== null ? pe.fromPartial(r.error) : void 0, e.serverResponseAnimation = r.serverResponseAnimation !== void 0 && r.serverResponseAnimation !== null ? ge.fromPartial(r.serverResponseAnimation) : void 0, e.clientAudioInput = r.clientAudioInput !== void 0 && r.clientAudioInput !== null ? he.fromPartial(r.clientAudioInput) : void 0, e;
3091
3104
  }
3092
3105
  };
3093
- function ui(r) {
3106
+ function di(r) {
3094
3107
  const e = globalThis.atob(r), t = new Uint8Array(e.length);
3095
3108
  for (let n = 0; n < e.length; ++n)
3096
3109
  t[n] = e.charCodeAt(n);
3097
3110
  return t;
3098
3111
  }
3099
- function di(r) {
3112
+ function hi(r) {
3100
3113
  const e = [];
3101
3114
  return r.forEach((t) => {
3102
3115
  e.push(globalThis.String.fromCharCode(t));
@@ -3105,7 +3118,7 @@ function di(r) {
3105
3118
  function V(r) {
3106
3119
  return r != null;
3107
3120
  }
3108
- let hi = (r) => crypto.getRandomValues(new Uint8Array(r)), fi = (r, e, t) => {
3121
+ let fi = (r) => crypto.getRandomValues(new Uint8Array(r)), mi = (r, e, t) => {
3109
3122
  let n = (2 << Math.log2(r.length - 1)) - 1, i = -~(1.6 * n * e / r.length);
3110
3123
  return (a = e) => {
3111
3124
  let o = "";
@@ -3115,13 +3128,13 @@ let hi = (r) => crypto.getRandomValues(new Uint8Array(r)), fi = (r, e, t) => {
3115
3128
  if (o += r[s[l] & n] || "", o.length >= a) return o;
3116
3129
  }
3117
3130
  };
3118
- }, mi = (r, e = 21) => fi(r, e | 0, hi);
3119
- const gi = mi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 12);
3120
- function pi() {
3121
- const r = /* @__PURE__ */ new Date(), e = r.getUTCFullYear(), t = String(r.getUTCMonth() + 1).padStart(2, "0"), n = String(r.getUTCDate()).padStart(2, "0"), i = String(r.getUTCHours()).padStart(2, "0"), a = String(r.getUTCMinutes()).padStart(2, "0"), o = String(r.getUTCSeconds()).padStart(2, "0"), s = `${e}${t}${n}${i}${a}${o}`, l = gi();
3131
+ }, gi = (r, e = 21) => mi(r, e | 0, fi);
3132
+ const pi = gi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 12);
3133
+ function vi() {
3134
+ const r = /* @__PURE__ */ new Date(), e = r.getUTCFullYear(), t = String(r.getUTCMonth() + 1).padStart(2, "0"), n = String(r.getUTCDate()).padStart(2, "0"), i = String(r.getUTCHours()).padStart(2, "0"), a = String(r.getUTCMinutes()).padStart(2, "0"), o = String(r.getUTCSeconds()).padStart(2, "0"), s = `${e}${t}${n}${i}${a}${o}`, l = pi();
3122
3135
  return `${s}_${l}`;
3123
3136
  }
3124
- class vi {
3137
+ class wi {
3125
3138
  constructor() {
3126
3139
  d(this, "events", /* @__PURE__ */ new Map());
3127
3140
  }
@@ -3141,7 +3154,7 @@ class vi {
3141
3154
  e ? this.events.delete(e) : this.events.clear();
3142
3155
  }
3143
3156
  }
3144
- class wi extends vi {
3157
+ class yi extends wi {
3145
3158
  constructor(t) {
3146
3159
  super();
3147
3160
  d(this, "wsUrl");
@@ -3200,14 +3213,14 @@ class wi extends vi {
3200
3213
  return h.error("[AnimationWebSocketClient] WebSocket not connected"), !1;
3201
3214
  try {
3202
3215
  const a = {
3203
- type: _e.MESSAGE_CLIENT_AUDIO_INPUT,
3216
+ type: Ee.MESSAGE_CLIENT_AUDIO_INPUT,
3204
3217
  clientAudioInput: {
3205
3218
  reqId: t,
3206
3219
  audio: new Uint8Array(n),
3207
3220
  end: i
3208
3221
  }
3209
3222
  }, o = new ue();
3210
- Ge.encode(a, o);
3223
+ He.encode(a, o);
3211
3224
  const s = o.finish();
3212
3225
  return this.ws.send(s), !0;
3213
3226
  } catch (a) {
@@ -3225,7 +3238,7 @@ class wi extends vi {
3225
3238
  * 使用统一的 ReqID 生成规则:YYYYMMDDHHmmss_nanoid
3226
3239
  */
3227
3240
  generateReqId() {
3228
- return pi();
3241
+ return vi();
3229
3242
  }
3230
3243
  /**
3231
3244
  * 获取连接状态
@@ -3276,7 +3289,7 @@ class wi extends vi {
3276
3289
  }
3277
3290
  handleMessage(t) {
3278
3291
  try {
3279
- const n = new O(new Uint8Array(t)), i = Ge.decode(n);
3292
+ const n = new O(new Uint8Array(t)), i = He.decode(n);
3280
3293
  if (i.error) {
3281
3294
  h.error(`[AnimationWebSocketClient] Server error: reqId=${i.error.reqId}, code=${i.error.code}, reason=${i.error.reason}`), b.logEvent("character_animation_service", "error", {
3282
3295
  characterId: this.currentCharacterId,
@@ -3287,7 +3300,7 @@ class wi extends vi {
3287
3300
  }), this.emit("error", new Error(i.error.reason || "Server error"));
3288
3301
  return;
3289
3302
  }
3290
- if (i.type === _e.MESSAGE_ERROR) {
3303
+ if (i.type === Ee.MESSAGE_ERROR) {
3291
3304
  h.warn("[AnimationWebSocketClient] MESSAGE_ERROR received but no error field in message"), b.logEvent("character_animation_service", "warning", {
3292
3305
  characterId: this.currentCharacterId,
3293
3306
  event: "message_error_without_payload"
@@ -3314,18 +3327,18 @@ class wi extends vi {
3314
3327
  }, t);
3315
3328
  }
3316
3329
  }
3317
- class yi {
3330
+ class Ai {
3318
3331
  constructor(e) {
3319
3332
  d(this, "wsClient");
3320
3333
  d(this, "dataController");
3321
3334
  // 组合播放层
3322
3335
  d(this, "currentReqId", null);
3323
3336
  d(this, "hasSentEnd", !1);
3324
- d(this, "audioBytesPerSecond", k.audio.sampleRate * 2);
3337
+ d(this, "audioBytesPerSecond", M.audio.sampleRate * 2);
3325
3338
  d(this, "audioMetrics", this.createAudioMetrics());
3326
3339
  this.dataController = e;
3327
3340
  const t = b.getEnvironmentConfig();
3328
- this.wsClient = new wi({
3341
+ this.wsClient = new yi({
3329
3342
  wsUrl: t.driveningressWsUrl,
3330
3343
  reconnectAttempts: 5,
3331
3344
  debug: !1,
@@ -3419,10 +3432,10 @@ class yi {
3419
3432
  handleMessage(e) {
3420
3433
  try {
3421
3434
  switch (e.type) {
3422
- case _e.MESSAGE_SERVER_RESPONSE_ANIMATION:
3435
+ case Ee.MESSAGE_SERVER_RESPONSE_ANIMATION:
3423
3436
  this.handleAnimationMessage(e);
3424
3437
  break;
3425
- case _e.MESSAGE_ERROR:
3438
+ case Ee.MESSAGE_ERROR:
3426
3439
  this.handleErrorMessage(e);
3427
3440
  break;
3428
3441
  }
@@ -3526,7 +3539,7 @@ class yi {
3526
3539
  });
3527
3540
  }
3528
3541
  }
3529
- class Ai {
3542
+ class Si {
3530
3543
  constructor(e, t) {
3531
3544
  // ========== Configuration and Composition ==========
3532
3545
  d(this, "networkLayer");
@@ -3551,7 +3564,7 @@ class Ai {
3551
3564
  // ========== Playback Loop ==========
3552
3565
  d(this, "playbackLoopId", null);
3553
3566
  d(this, "lastRenderedFrameIndex", -1);
3554
- this.avatar = e, this.playbackMode = (t == null ? void 0 : t.playbackMode) ?? Ie.network, this.playbackMode === Ie.network && (this.networkLayer = new yi(this));
3567
+ this.avatar = e, this.playbackMode = (t == null ? void 0 : t.playbackMode) ?? ke.network, this.playbackMode === ke.network && (this.networkLayer = new Ai(this));
3555
3568
  }
3556
3569
  // ========== 内部访问器(供 NetworkLayer 和 AvatarView 使用)==========
3557
3570
  /**
@@ -3773,7 +3786,7 @@ class Ai {
3773
3786
  startPlaybackLoop() {
3774
3787
  if (this.playbackLoopId)
3775
3788
  return;
3776
- const e = k.animation.fps, t = async () => {
3789
+ const e = M.animation.fps, t = async () => {
3777
3790
  if (!this.isPlaying || !this.animationPlayer) {
3778
3791
  this.playbackLoopId = null;
3779
3792
  return;
@@ -3864,7 +3877,7 @@ function nr(r) {
3864
3877
  }
3865
3878
  return String(r);
3866
3879
  }
3867
- async function Si(r) {
3880
+ async function bi(r) {
3868
3881
  try {
3869
3882
  const e = await fetch(r);
3870
3883
  if (!e.ok)
@@ -3876,14 +3889,14 @@ async function Si(r) {
3876
3889
  }
3877
3890
  }
3878
3891
  const Lt = /* @__PURE__ */ new Map();
3879
- async function ze(r) {
3892
+ async function $e(r) {
3880
3893
  const e = Lt.get(r);
3881
3894
  if (e)
3882
3895
  return e;
3883
- const t = await Si(r);
3896
+ const t = await bi(r);
3884
3897
  return Lt.set(r, t), t;
3885
3898
  }
3886
- class bi {
3899
+ class Ci {
3887
3900
  constructor(e = "/") {
3888
3901
  d(this, "baseAssetsPath");
3889
3902
  d(this, "characterAssets");
@@ -3929,7 +3942,7 @@ class bi {
3929
3942
  if (!y)
3930
3943
  throw new Error(`[loadTemplateResources] Missing CDN URL for ${w} (${S})`);
3931
3944
  s(S, !1), h.log(`📥 Loading ${w} from API CDN: ${y}`);
3932
- const x = await ze(y);
3945
+ const x = await $e(y);
3933
3946
  h.log(`✅ ${w} loaded: ${x.byteLength} bytes`), l[w] = x, s(S, !0);
3934
3947
  });
3935
3948
  return await Promise.all(g), l;
@@ -3939,7 +3952,7 @@ class bi {
3939
3952
  * Uses centralized FLAME CDN config (shared across all characters)
3940
3953
  */
3941
3954
  async loadGlobalFlameResources(e = null) {
3942
- const { cdnBaseUrl: t, resources: n } = k.flame, i = {
3955
+ const { cdnBaseUrl: t, resources: n } = M.flame, i = {
3943
3956
  flameModel: {
3944
3957
  url: `${t}/${n.flameModel}`,
3945
3958
  resourceName: n.flameModel
@@ -3968,7 +3981,7 @@ class bi {
3968
3981
  }));
3969
3982
  }, l = {}, g = Object.entries(i).map(async ([c, { url: u, resourceName: m }]) => {
3970
3983
  s(m, !1), h.log(`📥 Loading ${c} from global CDN: ${u}`);
3971
- const v = await ze(u);
3984
+ const v = await $e(u);
3972
3985
  h.log(`✅ ${c} loaded: ${v.byteLength} bytes`), l[c] = v, s(m, !0);
3973
3986
  });
3974
3987
  return await Promise.all(g), l;
@@ -4023,13 +4036,13 @@ class bi {
4023
4036
  total: m,
4024
4037
  progress: Math.round(u / m * 100)
4025
4038
  }));
4026
- }, w = {}, y = c.map(async ({ key: T, url: z, filename: ie, optional: Fe }) => {
4039
+ }, w = {}, y = c.map(async ({ key: T, url: z, filename: ie, optional: Le }) => {
4027
4040
  v(ie, !1);
4028
4041
  try {
4029
- const $ = await ze(z);
4042
+ const $ = await $e(z);
4030
4043
  return T === "shape" ? w.shape = $ : T === "pointCloud" ? w.pointCloud = $ : T === "idleAnimation" ? w.idleAnimation = $ : T === "monoAnimation" && (w.monoAnimation = $), this.characterAssets.set(T, $), v(ie, !0), { key: T, success: !0 };
4031
4044
  } catch ($) {
4032
- if (!Fe)
4045
+ if (!Le)
4033
4046
  throw $;
4034
4047
  return h.warn(`⚠️ Optional resource ${ie} failed to load:`, $), v(ie, !0), { key: T, success: !1 };
4035
4048
  }
@@ -4136,7 +4149,7 @@ class bi {
4136
4149
  }
4137
4150
  }
4138
4151
  }
4139
- const Me = class Me {
4152
+ const Re = class Re {
4140
4153
  constructor() {
4141
4154
  d(this, "avatarDownloader", null);
4142
4155
  d(this, "_templateInitialized", !1);
@@ -4145,7 +4158,7 @@ const Me = class Me {
4145
4158
  * 通过全局单例来访问
4146
4159
  */
4147
4160
  static get shared() {
4148
- return this._instance || (this._instance = new Me()), this._instance;
4161
+ return this._instance || (this._instance = new Re()), this._instance;
4149
4162
  }
4150
4163
  /**
4151
4164
  * 加载数字人
@@ -4159,7 +4172,7 @@ const Me = class Me {
4159
4172
  try {
4160
4173
  if (!b.isInitialized)
4161
4174
  throw new Error("AvatarKit not initialized. Please call AvatarKit.initialize() first.");
4162
- this.avatarDownloader || (this.avatarDownloader = new bi()), h.log("[AvatarManager] Step 1: Fetching character metadata..."), t == null || t({ type: oe.downloading, progress: 10 });
4175
+ this.avatarDownloader || (this.avatarDownloader = new Ci()), h.log("[AvatarManager] Step 1: Fetching character metadata..."), t == null || t({ type: oe.downloading, progress: 10 });
4163
4176
  const i = await this.avatarDownloader.getCharacterById(e);
4164
4177
  h.log("[AvatarManager] Step 2: Downloading resources..."), t == null || t({ type: oe.downloading, progress: 30 });
4165
4178
  const a = await this.avatarDownloader.preloadResources(i, {
@@ -4195,12 +4208,12 @@ const Me = class Me {
4195
4208
  this.avatarDownloader && this.avatarDownloader.clear();
4196
4209
  }
4197
4210
  };
4198
- d(Me, "_instance", null);
4199
- let Tt = Me, ye = null, Bt = null, Dt = null, Ot = null, Nt = null, Ut = null;
4200
- const Ze = 2048, zt = Ze - 1;
4201
- function Ci(r, e, t) {
4211
+ d(Re, "_instance", null);
4212
+ let Tt = Re, ye = null, Bt = null, Dt = null, Ot = null, Nt = null, Ut = null;
4213
+ const Ye = 2048, zt = Ye - 1;
4214
+ function _i(r, e, t) {
4202
4215
  const i = r.length / 13;
4203
- (!ye || ye.length !== i) && (ye = new Float32Array(i), Bt = new Uint32Array(ye.buffer), Dt = new Uint32Array(i), Ot = new Uint32Array(i), Nt = new Uint32Array(i), Ut = new Uint32Array(Ze));
4216
+ (!ye || ye.length !== i) && (ye = new Float32Array(i), Bt = new Uint32Array(ye.buffer), Dt = new Uint32Array(i), Ot = new Uint32Array(i), Nt = new Uint32Array(i), Ut = new Uint32Array(Ye));
4204
4217
  const a = ye, o = Bt, s = Dt, l = Ot, g = Nt, c = Ut, u = e[0], m = e[1], v = e[2], w = t[0], y = t[1], S = t[2];
4205
4218
  for (let x = 0; x < i; x++) {
4206
4219
  const L = x * 13;
@@ -4210,19 +4223,19 @@ function Ci(r, e, t) {
4210
4223
  const L = o[x];
4211
4224
  o[x] = L ^ (-(L >> 31) | 2147483648);
4212
4225
  }
4213
- Ve(o, s, l, c, 0, i), Ve(o, l, s, c, 11, i), Ve(o, s, l, c, 22, i);
4226
+ qe(o, s, l, c, 0, i), qe(o, l, s, c, 11, i), qe(o, s, l, c, 22, i);
4214
4227
  for (let x = 0; x < i; x++)
4215
4228
  g[x] = l[i - 1 - x];
4216
4229
  return g;
4217
4230
  }
4218
- function Ve(r, e, t, n, i, a) {
4231
+ function qe(r, e, t, n, i, a) {
4219
4232
  n.fill(0);
4220
4233
  for (let s = 0; s < a; s++) {
4221
4234
  const l = r[e[s]] >> i & zt;
4222
4235
  n[l]++;
4223
4236
  }
4224
4237
  let o = 0;
4225
- for (let s = 0; s < Ze; s++) {
4238
+ for (let s = 0; s < Ye; s++) {
4226
4239
  const l = n[s];
4227
4240
  n[s] = o, o += l;
4228
4241
  }
@@ -4231,19 +4244,19 @@ function Ve(r, e, t, n, i, a) {
4231
4244
  t[n[g]++] = l;
4232
4245
  }
4233
4246
  }
4234
- const xe = 13;
4247
+ const Pe = 13;
4235
4248
  let Ae = null;
4236
- function _i(r, e) {
4237
- const t = e.length, n = t * xe;
4249
+ function Ei(r, e) {
4250
+ const t = e.length, n = t * Pe;
4238
4251
  (!Ae || Ae.length !== n) && (Ae = new Float32Array(n));
4239
4252
  for (let i = 0; i < t; i++) {
4240
- const o = e[i] * xe, s = i * xe;
4241
- for (let l = 0; l < xe; l++)
4253
+ const o = e[i] * Pe, s = i * Pe;
4254
+ for (let l = 0; l < Pe; l++)
4242
4255
  Ae[s + l] = r[o + l];
4243
4256
  }
4244
4257
  return Ae;
4245
4258
  }
4246
- const Ei = `#version 300 es
4259
+ const xi = `#version 300 es
4247
4260
  precision highp float;
4248
4261
 
4249
4262
  in vec2 v_relativePosition;
@@ -4273,7 +4286,7 @@ void main() {
4273
4286
  // 预乘 alpha 输出(匹配 premultipliedAlpha: true)
4274
4287
  // 颜色值需要乘以 alpha,这样 WebGL 才能正确混合
4275
4288
  fragColor = vec4(v_color.rgb * alpha, alpha);
4276
- }`, xi = `#version 300 es
4289
+ }`, Pi = `#version 300 es
4277
4290
  precision highp float;
4278
4291
 
4279
4292
  // 基础四边形顶点属性(共享4个顶点)
@@ -4441,7 +4454,7 @@ void main() {
4441
4454
  v_relativePosition = relativeCoord * BOUNDS_RADIUS;
4442
4455
  v_color = a_color;
4443
4456
  }`;
4444
- class Pi {
4457
+ class Ii {
4445
4458
  // 跟踪当前 buffer 大小
4446
4459
  constructor(e, t) {
4447
4460
  d(this, "canvas");
@@ -4633,14 +4646,14 @@ class Pi {
4633
4646
  const t = e.createShader(e.VERTEX_SHADER);
4634
4647
  if (!t)
4635
4648
  throw new Error("Failed to create vertex shader");
4636
- if (e.shaderSource(t, xi), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS)) {
4649
+ if (e.shaderSource(t, Pi), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS)) {
4637
4650
  const a = e.getShaderInfoLog(t);
4638
4651
  throw e.deleteShader(t), new Error(`Vertex shader compilation failed: ${a}`);
4639
4652
  }
4640
4653
  const n = e.createShader(e.FRAGMENT_SHADER);
4641
4654
  if (!n)
4642
4655
  throw e.deleteShader(t), new Error("Failed to create fragment shader");
4643
- if (e.shaderSource(n, Ei), e.compileShader(n), !e.getShaderParameter(n, e.COMPILE_STATUS)) {
4656
+ if (e.shaderSource(n, xi), e.compileShader(n), !e.getShaderParameter(n, e.COMPILE_STATUS)) {
4644
4657
  const a = e.getShaderInfoLog(n);
4645
4658
  throw e.deleteShader(t), e.deleteShader(n), new Error(`Fragment shader compilation failed: ${a}`);
4646
4659
  }
@@ -4669,7 +4682,7 @@ class Pi {
4669
4682
  this.gl = null, this.isInitialized = !1;
4670
4683
  }
4671
4684
  }
4672
- const Ii = `/**
4685
+ const ki = `/**
4673
4686
  * WebGPU 3DGS 渲染着色器
4674
4687
  *
4675
4688
  * 实例化渲染:每个 splat 绘制一个四边形
@@ -4932,7 +4945,7 @@ fn fragmentMain(input: VertexOutput) -> @location(0) vec4f {
4932
4945
  return vec4f(input.color.rgb * alpha, alpha);
4933
4946
  }
4934
4947
  `;
4935
- class ki {
4948
+ class Mi {
4936
4949
  constructor(e, t) {
4937
4950
  d(this, "canvas");
4938
4951
  d(this, "backgroundColor");
@@ -5019,7 +5032,7 @@ class ki {
5019
5032
  return;
5020
5033
  const e = this.device.createShaderModule({
5021
5034
  label: "3DGS Render Shader",
5022
- code: Ii
5035
+ code: ki
5023
5036
  }), t = this.device.createBindGroupLayout({
5024
5037
  label: "Uniform Bind Group Layout",
5025
5038
  entries: [
@@ -5200,16 +5213,16 @@ class ki {
5200
5213
  (e = this.sortIndexBuffer) == null || e.destroy(), (t = this.splatDataBuffer) == null || t.destroy(), (n = this.quadVertexBuffer) == null || n.destroy(), (i = this.uniformBuffer) == null || i.destroy(), (a = this.device) == null || a.destroy(), this.sortIndexBuffer = null, this.splatDataBuffer = null, this.quadVertexBuffer = null, this.uniformBuffer = null, this.uniformBindGroup = null, this.storageBindGroup = null, this.device = null, this.context = null, this.renderPipeline = null;
5201
5214
  }
5202
5215
  }
5203
- class Mi {
5216
+ class Fi {
5204
5217
  // 排序耗时
5205
5218
  constructor(e) {
5206
5219
  d(this, "renderer", null);
5207
5220
  d(this, "backend", null);
5208
5221
  d(this, "canvas");
5209
5222
  d(this, "options");
5210
- // 相机配置
5223
+ // Camera configuration
5211
5224
  d(this, "camera");
5212
- // 矩阵缓存(复用缓冲区,避免每帧分配)
5225
+ // Matrix cache (reuse buffers to avoid per-frame allocation)
5213
5226
  d(this, "viewMatrix", new Float32Array(16));
5214
5227
  d(this, "projectionMatrix", new Float32Array(16));
5215
5228
  // 当前数据(GPU 格式:[pos3, color4, cov6] x N)
@@ -5233,24 +5246,24 @@ class Mi {
5233
5246
  };
5234
5247
  }
5235
5248
  /**
5236
- * 初始化渲染系统
5249
+ * Initialize render system
5237
5250
  */
5238
5251
  async initialize() {
5239
5252
  const { preferBackend: e, backgroundColor: t = [0, 0, 0, 0] } = this.options;
5240
5253
  if (e !== "webgl" && await this.checkWebGPUSupport())
5241
5254
  try {
5242
- this.renderer = new ki(this.canvas, t), await this.renderer.initialize(), this.backend = "webgpu", h.log("✅ Using WebGPU renderer"), this.updateCameraAspect();
5255
+ this.renderer = new Mi(this.canvas, t), await this.renderer.initialize(), this.backend = "webgpu", h.log("✅ Using WebGPU renderer"), this.updateCameraAspect();
5243
5256
  return;
5244
5257
  } catch (i) {
5245
5258
  h.warn("⚠️ WebGPU init failed, fallback to WebGL:", i);
5246
5259
  }
5247
- this.renderer = new Pi(this.canvas, t), await this.renderer.initialize(), this.backend = "webgl", h.log("✅ Using WebGL renderer"), this.updateCameraAspect();
5260
+ this.renderer = new Ii(this.canvas, t), await this.renderer.initialize(), this.backend = "webgl", h.log("✅ Using WebGL renderer"), this.updateCameraAspect();
5248
5261
  }
5249
5262
  /**
5250
- * 加载已打包的 Splat 数据(零拷贝,GPU 格式)
5251
- * 直接接收 WASM packed 数据
5263
+ * Load packed Splat data (zero-copy, GPU format)
5264
+ * Directly receives WASM packed data
5252
5265
  *
5253
- * @param packedData Float32Array [pos3, color4, cov6] x N 个点
5266
+ * @param packedData Float32Array [pos3, color4, cov6] x N points
5254
5267
  */
5255
5268
  loadSplatsFromPackedData(e) {
5256
5269
  if (!this.renderer)
@@ -5265,7 +5278,7 @@ class Mi {
5265
5278
  return;
5266
5279
  const e = performance.now();
5267
5280
  this.updateCameraMatrices();
5268
- const t = Math.floor(this.originalPackedData.length / 13), n = performance.now(), i = Ci(
5281
+ const t = Math.floor(this.originalPackedData.length / 13), n = performance.now(), i = _i(
5269
5282
  this.originalPackedData,
5270
5283
  this.camera.position,
5271
5284
  this.getCameraForward()
@@ -5273,7 +5286,7 @@ class Mi {
5273
5286
  if (this.sortTime = performance.now() - n, this.backend === "webgpu")
5274
5287
  this.renderer.loadSplatsFromPackedData(this.originalPackedData, t, i);
5275
5288
  else {
5276
- const a = _i(this.originalPackedData, i);
5289
+ const a = Ei(this.originalPackedData, i);
5277
5290
  this.renderer.loadSplatsFromPackedData(a, t);
5278
5291
  }
5279
5292
  this.renderer.render(
@@ -5283,13 +5296,13 @@ class Mi {
5283
5296
  ), this.renderTime = performance.now() - e;
5284
5297
  }
5285
5298
  /**
5286
- * 更新相机参数
5299
+ * Update camera parameters
5287
5300
  */
5288
5301
  updateCamera(e) {
5289
5302
  Object.assign(this.camera, e), this.updateCameraAspect();
5290
5303
  }
5291
5304
  /**
5292
- * 处理窗口大小变化
5305
+ * Handle window resize
5293
5306
  */
5294
5307
  handleResize() {
5295
5308
  this.updateCameraAspect();
@@ -5301,15 +5314,15 @@ class Mi {
5301
5314
  return this.backend;
5302
5315
  }
5303
5316
  /**
5304
- * 清理资源
5317
+ * Dispose resources
5305
5318
  */
5306
5319
  dispose() {
5307
5320
  var e;
5308
5321
  (e = this.renderer) == null || e.dispose(), this.renderer = null, this.originalPackedData = null;
5309
5322
  }
5310
- // ========== 私有方法 ==========
5323
+ // ========== Private Methods ==========
5311
5324
  /**
5312
- * 检查 WebGPU 支持
5325
+ * Check WebGPU support
5313
5326
  */
5314
5327
  async checkWebGPUSupport() {
5315
5328
  if (!navigator.gpu)
@@ -5321,13 +5334,13 @@ class Mi {
5321
5334
  }
5322
5335
  }
5323
5336
  /**
5324
- * 更新相机长宽比
5337
+ * Update camera aspect ratio
5325
5338
  */
5326
5339
  updateCameraAspect() {
5327
5340
  this.camera.aspect = this.canvas.width / this.canvas.height;
5328
5341
  }
5329
5342
  /**
5330
- * 更新相机矩阵
5343
+ * Update camera matrices
5331
5344
  */
5332
5345
  updateCameraMatrices() {
5333
5346
  const { position: e, target: t, up: n } = this.camera;
@@ -5339,7 +5352,7 @@ class Mi {
5339
5352
  ), this.updateViewMatrix(e, t, n);
5340
5353
  }
5341
5354
  /**
5342
- * 获取相机前向向量
5355
+ * Get camera forward vector
5343
5356
  */
5344
5357
  getCameraForward() {
5345
5358
  const e = [
@@ -5352,16 +5365,16 @@ class Mi {
5352
5365
  return t > 0 && (e[0] /= t, e[1] /= t, e[2] /= t), e;
5353
5366
  }
5354
5367
  /**
5355
- * 更新透视投影矩阵(复用缓冲区)
5368
+ * Update perspective projection matrix (reuse buffer)
5356
5369
  */
5357
5370
  updatePerspectiveMatrix(e, t, n, i) {
5358
5371
  const a = e * Math.PI / 180, o = 1 / Math.tan(a / 2), s = i / (n - i), l = this.projectionMatrix;
5359
5372
  l[0] = o / t, l[1] = 0, l[2] = 0, l[3] = 0, l[4] = 0, l[5] = o, l[6] = 0, l[7] = 0, l[8] = 0, l[9] = 0, l[10] = s, l[11] = -1, l[12] = 0, l[13] = 0, l[14] = s * n, l[15] = 0;
5360
5373
  }
5361
5374
  /**
5362
- * 更新视图矩阵(直接更新预分配的缓冲区,避免每帧分配)
5363
- * 等价于:inverse(translation) * inverse(rotation) = T^(-1) * R^(-1)
5364
- * 其中 T 是平移矩阵,R 是旋转矩阵
5375
+ * Update view matrix (directly update pre-allocated buffer to avoid per-frame allocation)
5376
+ * Equivalent to: inverse(translation) * inverse(rotation) = T^(-1) * R^(-1)
5377
+ * Where T is translation matrix, R is rotation matrix
5365
5378
  */
5366
5379
  updateViewMatrix(e, t, n) {
5367
5380
  const i = [
@@ -5390,7 +5403,7 @@ function ae(r, e, t) {
5390
5403
  i[a] = r[a] + (e[a] - r[a]) * t;
5391
5404
  return i;
5392
5405
  }
5393
- function Fi(r, e, t) {
5406
+ function Ri(r, e, t) {
5394
5407
  const n = 0.5 - Math.cos(t * Math.PI) * 0.5;
5395
5408
  return {
5396
5409
  translation: ae(r.translation || [0, 0, 0], e.translation || [0, 0, 0], n),
@@ -5405,15 +5418,15 @@ function Fi(r, e, t) {
5405
5418
  expression: ae(r.expression || [], e.expression || [], n)
5406
5419
  };
5407
5420
  }
5408
- function Ri(r, e, t, n = 25) {
5421
+ function Li(r, e, t, n = 25) {
5409
5422
  const i = Math.max(1, Math.floor(t / 1e3 * n)), a = Array.from({ length: i });
5410
5423
  for (let o = 0; o < i; o++) {
5411
5424
  const s = o / (i - 1);
5412
- a[o] = Fi(r, e, s);
5425
+ a[o] = Ri(r, e, s);
5413
5426
  }
5414
5427
  return a;
5415
5428
  }
5416
- class Oi {
5429
+ class Ni {
5417
5430
  /**
5418
5431
  * 构造函数
5419
5432
  * 创建统一的 AvatarController,内部根据配置自动组合网络层
@@ -5445,8 +5458,8 @@ class Oi {
5445
5458
  d(this, "cachedIdleFirstFrame", null);
5446
5459
  d(this, "idleCurrentFrameIndex", 0);
5447
5460
  this.avatar = e;
5448
- const n = (t == null ? void 0 : t.playbackMode) ?? Ie.network;
5449
- this.playbackMode = n, this.avatarController = new Ai(e, {
5461
+ const n = (t == null ? void 0 : t.playbackMode) ?? ke.network;
5462
+ this.playbackMode = n, this.avatarController = new Si(e, {
5450
5463
  playbackMode: n
5451
5464
  }), this.avatarController.setRenderCallback((i, a) => {
5452
5465
  this.renderRealtimeFrame(i, a);
@@ -5500,11 +5513,11 @@ class Oi {
5500
5513
  */
5501
5514
  generateAndAlignTransitionFrames(e, t) {
5502
5515
  const n = this.alignFlamePair(e, t);
5503
- let i = Ri(
5516
+ let i = Li(
5504
5517
  n.from,
5505
5518
  n.to,
5506
5519
  this.transitionDurationMs,
5507
- k.animation.fps
5520
+ M.animation.fps
5508
5521
  );
5509
5522
  return i.length < 2 && (i = [n.from, n.to]), i[0] = n.from, i[i.length - 1] = n.to, i;
5510
5523
  }
@@ -5517,7 +5530,7 @@ class Oi {
5517
5530
  if (e)
5518
5531
  try {
5519
5532
  const t = await e.getCurrentFrameParams(0);
5520
- this.cachedIdleFirstFrame = ut(t);
5533
+ this.cachedIdleFirstFrame = dt(t);
5521
5534
  } catch (t) {
5522
5535
  h.warn("[AvatarView] Failed to get idle first frame:", t instanceof Error ? t.message : String(t));
5523
5536
  }
@@ -5555,17 +5568,17 @@ class Oi {
5555
5568
  */
5556
5569
  async initializeView(e) {
5557
5570
  try {
5558
- k.debug && h.log("[AvatarView] Initializing avatar view...");
5571
+ M.debug && h.log("[AvatarView] Initializing avatar view...");
5559
5572
  const t = b.getAvatarCore();
5560
5573
  if (!t)
5561
5574
  throw new Error("AvatarCore not available. AvatarKit initialization may have failed.");
5562
5575
  const n = e.getResources();
5563
- k.debug && h.log("[AvatarView] Loading character data..."), await t.loadCharacterFromBuffers(
5576
+ M.debug && h.log("[AvatarView] Loading character data..."), await t.loadCharacterFromBuffers(
5564
5577
  n.characterData.shape,
5565
5578
  n.characterData.pointCloud
5566
- ), n.characterData.idleAnimation && (k.debug && h.log("[AvatarView] Loading idle animation..."), await t.loadAnimationFromBuffer(n.characterData.idleAnimation)), k.debug && h.log("[AvatarView] Initializing render system...");
5579
+ ), n.characterData.idleAnimation && (M.debug && h.log("[AvatarView] Loading idle animation..."), await t.loadAnimationFromBuffer(n.characterData.idleAnimation)), M.debug && h.log("[AvatarView] Initializing render system...");
5567
5580
  const i = this.resolveCameraConfig(n);
5568
- await this.initializeRenderSystem(i), k.debug && h.log("[AvatarView] Starting rendering..."), await this.renderFirstFrame(), this.startIdleAnimationLoop(), this.isInitialized = !0, k.debug && h.log("[AvatarView] Avatar view initialized successfully");
5581
+ await this.initializeRenderSystem(i), M.debug && h.log("[AvatarView] Starting rendering..."), await this.renderFirstFrame(), this.startIdleAnimationLoop(), this.isInitialized = !0, M.debug && h.log("[AvatarView] Avatar view initialized successfully");
5569
5582
  } catch (t) {
5570
5583
  throw h.error("[AvatarView] Failed to initialize avatar view:", t instanceof Error ? t.message : String(t)), t;
5571
5584
  }
@@ -5574,18 +5587,18 @@ class Oi {
5574
5587
  * 初始化渲染系统
5575
5588
  */
5576
5589
  async initializeRenderSystem(e) {
5577
- this.cameraConfig = e || this.getDefaultCameraConfig(), e ? h.log("[AvatarView] Using resolved camera config:", e) : h.log("[AvatarView] No camera config in resources, using default static config:", this.cameraConfig), this.renderSystem = new Mi({
5590
+ this.cameraConfig = e || this.getDefaultCameraConfig(), e ? h.log("[AvatarView] Using resolved camera config:", e) : h.log("[AvatarView] No camera config in resources, using default static config:", this.cameraConfig), this.renderSystem = new Fi({
5578
5591
  canvas: this.canvas,
5579
5592
  camera: this.cameraConfig,
5580
5593
  backgroundColor: [0, 0, 0, 0]
5581
5594
  // 透明背景,让 CSS 背景透出
5582
- }), await this.renderSystem.initialize(), k.debug && h.log("[AvatarView] Render system initialized successfully");
5595
+ }), await this.renderSystem.initialize(), M.debug && h.log("[AvatarView] Render system initialized successfully");
5583
5596
  }
5584
5597
  /**
5585
5598
  * 获取默认相机配置
5586
5599
  */
5587
5600
  getDefaultCameraConfig() {
5588
- return { ...k.camera };
5601
+ return { ...M.camera };
5589
5602
  }
5590
5603
  /**
5591
5604
  * 根据资源解析最终的相机配置,优先使用角色设置,其次 camera.json
@@ -5656,7 +5669,7 @@ class Oi {
5656
5669
  eyes_pose: [0, 0, 0, 0, 0, 0]
5657
5670
  }, n = await e.computeFrameFlatFromParams(t);
5658
5671
  if (n)
5659
- this.renderSystem.loadSplatsFromPackedData(n), this.renderSystem.renderFrame(), k.debug && h.log("[AvatarView] First frame rendered successfully");
5672
+ this.renderSystem.loadSplatsFromPackedData(n), this.renderSystem.renderFrame(), M.debug && h.log("[AvatarView] First frame rendered successfully");
5660
5673
  else
5661
5674
  throw new Error("Failed to compute first frame splat data");
5662
5675
  }
@@ -5667,7 +5680,7 @@ class Oi {
5667
5680
  if (this.idleAnimationLoopId)
5668
5681
  return;
5669
5682
  if (this.renderingState !== "idle") {
5670
- k.debug && h.log("[AvatarView] Skip starting idle loop because not in idle state");
5683
+ M.debug && h.log("[AvatarView] Skip starting idle loop because not in idle state");
5671
5684
  return;
5672
5685
  }
5673
5686
  this.idleCurrentFrameIndex = 0;
@@ -5699,7 +5712,7 @@ class Oi {
5699
5712
  h.error("[AvatarView] Idle animation loop error:", o instanceof Error ? o.message : String(o)), this.stopIdleAnimationLoop();
5700
5713
  }
5701
5714
  };
5702
- this.idleAnimationLoopId = requestAnimationFrame(i), k.debug && h.log("[AvatarView] Idle animation loop started");
5715
+ this.idleAnimationLoopId = requestAnimationFrame(i), M.debug && h.log("[AvatarView] Idle animation loop started");
5703
5716
  }
5704
5717
  /**
5705
5718
  * 开始实时对话动画循环
@@ -5754,19 +5767,19 @@ class Oi {
5754
5767
  h.error("[AvatarView] Realtime animation loop error:", o instanceof Error ? o.message : String(o)), this.stopRealtimeAnimationLoop();
5755
5768
  }
5756
5769
  };
5757
- this.realtimeAnimationLoopId = requestAnimationFrame(i), k.debug && h.log("[AvatarView] Realtime animation loop started");
5770
+ this.realtimeAnimationLoopId = requestAnimationFrame(i), M.debug && h.log("[AvatarView] Realtime animation loop started");
5758
5771
  }
5759
5772
  /**
5760
5773
  * 停止idle动画循环
5761
5774
  */
5762
5775
  stopIdleAnimationLoop() {
5763
- this.idleAnimationLoopId && (cancelAnimationFrame(this.idleAnimationLoopId), this.idleAnimationLoopId = null, k.debug && h.log("[AvatarView] Idle animation loop stopped"));
5776
+ this.idleAnimationLoopId && (cancelAnimationFrame(this.idleAnimationLoopId), this.idleAnimationLoopId = null, M.debug && h.log("[AvatarView] Idle animation loop stopped"));
5764
5777
  }
5765
5778
  /**
5766
5779
  * 停止实时对话动画循环
5767
5780
  */
5768
5781
  stopRealtimeAnimationLoop() {
5769
- this.realtimeAnimationLoopId && (cancelAnimationFrame(this.realtimeAnimationLoopId), this.realtimeAnimationLoopId = null, k.debug && h.log("[AvatarView] Realtime animation loop stopped"));
5782
+ this.realtimeAnimationLoopId && (cancelAnimationFrame(this.realtimeAnimationLoopId), this.realtimeAnimationLoopId = null, M.debug && h.log("[AvatarView] Realtime animation loop stopped"));
5770
5783
  }
5771
5784
  /**
5772
5785
  * 停止所有动画循环
@@ -5859,13 +5872,13 @@ class Oi {
5859
5872
  if (n && e.length > 0) {
5860
5873
  if (this.renderingState !== "transitioningToSpeaking")
5861
5874
  return;
5862
- const i = await n.getCurrentFrameParams(this.idleCurrentFrameIndex), a = ut(i);
5875
+ const i = await n.getCurrentFrameParams(this.idleCurrentFrameIndex), a = dt(i);
5863
5876
  await this.getCachedIdleFirstFrame();
5864
5877
  const o = e[0];
5865
5878
  this.transitionKeyframes = this.generateAndAlignTransitionFrames(a, o), this.transitionStartTime = performance.now(), this.transitionKeyframes.length === 0 ? (this.setState(
5866
5879
  "speaking"
5867
5880
  /* Speaking */
5868
- ), this.avatarController.onTransitionComplete()) : k.debug && h.log("[AvatarView] Transition started:", this.transitionKeyframes.length, "frames");
5881
+ ), this.avatarController.onTransitionComplete()) : M.debug && h.log("[AvatarView] Transition started:", this.transitionKeyframes.length, "frames");
5869
5882
  }
5870
5883
  } catch (n) {
5871
5884
  h.warn("[AvatarView] Transition generation failed:", n instanceof Error ? n.message : String(n)), this.renderingState === "transitioningToSpeaking" && (this.setState(
@@ -5879,7 +5892,7 @@ class Oi {
5879
5892
  * 开始实时渲染循环
5880
5893
  */
5881
5894
  startRealtimeRendering() {
5882
- k.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"), b.logEvent("character_view", "info", {
5895
+ M.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"), b.logEvent("character_view", "info", {
5883
5896
  characterId: this.avatar.id,
5884
5897
  event: "rendering_started",
5885
5898
  keyframesCount: this.currentKeyframes.length
@@ -5908,7 +5921,7 @@ class Oi {
5908
5921
  if (b.getAvatarCore() && this.currentKeyframes.length > 0) {
5909
5922
  const n = this.lastRealtimeProtoFrame || this.currentKeyframes[Math.max(0, this.lastRenderedFrameIndex)], i = await this.getCachedIdleFirstFrame();
5910
5923
  if (i && (this.transitionKeyframes = this.generateAndAlignTransitionFrames(n, i), this.transitionStartTime = performance.now(), this.transitionKeyframes.length > 0 && this.renderingState === "transitioningToIdle")) {
5911
- k.debug && h.log("[AvatarView] Return transition started:", this.transitionKeyframes.length, "frames"), this.realtimeAnimationLoopId || this.startRealtimeAnimationLoop();
5924
+ M.debug && h.log("[AvatarView] Return transition started:", this.transitionKeyframes.length, "frames"), this.realtimeAnimationLoopId || this.startRealtimeAnimationLoop();
5912
5925
  return;
5913
5926
  }
5914
5927
  }
@@ -5927,7 +5940,7 @@ class Oi {
5927
5940
  * 关闭 avatarController 并清理所有相关资源
5928
5941
  */
5929
5942
  dispose() {
5930
- k.debug && h.log("[AvatarView] Disposing avatar view..."), b.logEvent("character_view", "info", {
5943
+ M.debug && h.log("[AvatarView] Disposing avatar view..."), b.logEvent("character_view", "info", {
5931
5944
  characterId: this.avatar.id,
5932
5945
  event: "disposed"
5933
5946
  }), this.avatarController && (this.avatarController.clear(), this.avatarController.dispose()), this.stopAllAnimationLoops(), this.setState(
@@ -5937,11 +5950,11 @@ class Oi {
5937
5950
  const e = b.getAvatarCore();
5938
5951
  if (e)
5939
5952
  try {
5940
- e.releaseCurrentCharacter(), k.debug && h.log("[AvatarView] AvatarCore character resources released");
5953
+ e.releaseCurrentCharacter(), M.debug && h.log("[AvatarView] AvatarCore character resources released");
5941
5954
  } catch (t) {
5942
5955
  h.error("[AvatarView] Failed to release AvatarCore resources:", t instanceof Error ? t.message : String(t));
5943
5956
  }
5944
- this.renderSystem && (this.renderSystem.dispose(), this.renderSystem = null), this.canvas && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), window.removeEventListener("resize", this.onWindowResize), this.isInitialized = !1, k.debug && h.log("[AvatarView] Avatar view disposed successfully");
5957
+ this.renderSystem && (this.renderSystem.dispose(), this.renderSystem = null), this.canvas && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), window.removeEventListener("resize", this.onWindowResize), this.isInitialized = !1, M.debug && h.log("[AvatarView] Avatar view disposed successfully");
5945
5958
  }
5946
5959
  /**
5947
5960
  * 获取相机配置
@@ -5955,7 +5968,7 @@ class Oi {
5955
5968
  * @internal
5956
5969
  */
5957
5970
  updateCameraConfig(e) {
5958
- this.cameraConfig = e, k.debug && h.log("[AvatarView] Camera config updated:", e), this.renderSystem && (this.renderSystem.updateCamera(e), k.debug && h.log("[AvatarView] Applied new camera config to render system"));
5971
+ this.cameraConfig = e, M.debug && h.log("[AvatarView] Camera config updated:", e), this.renderSystem && (this.renderSystem.updateCamera(e), M.debug && h.log("[AvatarView] Applied new camera config to render system"));
5959
5972
  }
5960
5973
  /**
5961
5974
  * 处理尺寸变化:通知渲染系统更新视口与投影
@@ -5966,6 +5979,7 @@ class Oi {
5966
5979
  /**
5967
5980
  * 获取渲染性能统计
5968
5981
  * @returns 渲染性能统计数据,如果渲染系统未初始化则返回 null
5982
+ * @internal Not part of public API yet
5969
5983
  */
5970
5984
  getPerformanceStats() {
5971
5985
  return !this.renderSystem || !this.isInitialized ? null : {
@@ -5977,7 +5991,7 @@ class Oi {
5977
5991
  }
5978
5992
  }
5979
5993
  export {
5980
- k as A,
5994
+ M as A,
5981
5995
  Se as C,
5982
5996
  le as E,
5983
5997
  oe as L,
@@ -5985,15 +5999,15 @@ export {
5985
5999
  se as S,
5986
6000
  b as a,
5987
6001
  rn as b,
5988
- Ai as c,
6002
+ Si as c,
5989
6003
  Tt as d,
5990
6004
  nr as e,
5991
- Oi as f,
6005
+ Ni as f,
5992
6006
  Z as g,
5993
- Ie as h,
5994
- Ti as i,
5995
- Bi as j,
5996
- Di as k,
6007
+ ke as h,
6008
+ Bi as i,
6009
+ Di as j,
6010
+ Oi as k,
5997
6011
  h as l
5998
6012
  };
5999
- //# sourceMappingURL=index-Ck21a9C4.js.map
6013
+ //# sourceMappingURL=index-Cy9jPcQt.js.map