@clockworkdog/cogs-client 3.0.0-alpha.10 → 3.0.0-alpha.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.
@@ -13,15 +13,15 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
13
13
  See the Apache Version 2.0 License for specific language governing permissions
14
14
  and limitations under the License.
15
15
  ***************************************************************************** */
16
- var Ae = function(e, t) {
17
- return Ae = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, o) {
16
+ var Se = function(e, t) {
17
+ return Se = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, o) {
18
18
  n.__proto__ = o;
19
19
  } || function(n, o) {
20
20
  for (var i in o) o.hasOwnProperty(i) && (n[i] = o[i]);
21
- }, Ae(e, t);
21
+ }, Se(e, t);
22
22
  };
23
23
  function Et(e, t) {
24
- Ae(e, t);
24
+ Se(e, t);
25
25
  function n() {
26
26
  this.constructor = e;
27
27
  }
@@ -38,16 +38,16 @@ function on(e) {
38
38
  function rn(e, t) {
39
39
  var n = typeof Symbol == "function" && e[Symbol.iterator];
40
40
  if (!n) return e;
41
- var o = n.call(e), i, a = [], c;
41
+ var o = n.call(e), i, a = [], u;
42
42
  try {
43
43
  for (; (t === void 0 || t-- > 0) && !(i = o.next()).done; ) a.push(i.value);
44
44
  } catch (l) {
45
- c = { error: l };
45
+ u = { error: l };
46
46
  } finally {
47
47
  try {
48
48
  i && !i.done && (n = o.return) && n.call(o);
49
49
  } finally {
50
- if (c) throw c.error;
50
+ if (u) throw u.error;
51
51
  }
52
52
  }
53
53
  return a;
@@ -118,7 +118,7 @@ var cn = function() {
118
118
  close: []
119
119
  }, this._retryCount = -1, this._shouldReconnect = !0, this._connectLock = !1, this._binaryType = "blob", this._closeCalled = !1, this._messageQueue = [], this.onclose = null, this.onerror = null, this.onmessage = null, this.onopen = null, this._handleOpen = function(a) {
120
120
  i._debug("open event");
121
- var c = i._options.minUptime, l = c === void 0 ? M.minUptime : c;
121
+ var u = i._options.minUptime, l = u === void 0 ? M.minUptime : u;
122
122
  clearTimeout(i._connectTimeout), i._uptimeTimeout = setTimeout(function() {
123
123
  return i._acceptOpen();
124
124
  }, l), i._ws.binaryType = i._binaryType, i._messageQueue.forEach(function(p) {
@@ -127,16 +127,16 @@ var cn = function() {
127
127
  return i._callEventListener(a, p);
128
128
  });
129
129
  }, this._handleMessage = function(a) {
130
- i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(c) {
131
- return i._callEventListener(a, c);
130
+ i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(u) {
131
+ return i._callEventListener(a, u);
132
132
  });
133
133
  }, this._handleError = function(a) {
134
- i._debug("error event", a.message), i._disconnect(void 0, a.message === "TIMEOUT" ? "timeout" : void 0), i.onerror && i.onerror(a), i._debug("exec error listeners"), i._listeners.error.forEach(function(c) {
135
- return i._callEventListener(a, c);
134
+ i._debug("error event", a.message), i._disconnect(void 0, a.message === "TIMEOUT" ? "timeout" : void 0), i.onerror && i.onerror(a), i._debug("exec error listeners"), i._listeners.error.forEach(function(u) {
135
+ return i._callEventListener(a, u);
136
136
  }), i._connect();
137
137
  }, this._handleClose = function(a) {
138
- i._debug("close event"), i._clearTimeouts(), i._shouldReconnect && i._connect(), i.onclose && i.onclose(a), i._listeners.close.forEach(function(c) {
139
- return i._callEventListener(a, c);
138
+ i._debug("close event"), i._clearTimeouts(), i._shouldReconnect && i._connect(), i.onclose && i.onclose(a), i._listeners.close.forEach(function(u) {
139
+ return i._callEventListener(a, u);
140
140
  });
141
141
  }, this._url = t, this._protocols = n, this._options = o, this._options.startClosed && (this._shouldReconnect = !1), this._connect();
142
142
  }
@@ -285,15 +285,15 @@ var cn = function() {
285
285
  var n, o, i = this._listeners[t.type];
286
286
  if (i)
287
287
  try {
288
- for (var a = on(i), c = a.next(); !c.done; c = a.next()) {
289
- var l = c.value;
288
+ for (var a = on(i), u = a.next(); !u.done; u = a.next()) {
289
+ var l = u.value;
290
290
  this._callEventListener(t, l);
291
291
  }
292
292
  } catch (p) {
293
293
  n = { error: p };
294
294
  } finally {
295
295
  try {
296
- c && !c.done && (o = a.return) && o.call(a);
296
+ u && !u.done && (o = a.return) && o.call(a);
297
297
  } finally {
298
298
  if (n) throw n.error;
299
299
  }
@@ -308,7 +308,7 @@ var cn = function() {
308
308
  t[n] = arguments[n];
309
309
  this._options.debug && console.log.apply(console, sn(["RWS>"], t));
310
310
  }, e.prototype._getNextDelay = function() {
311
- var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? M.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? M.minReconnectionDelay : i, c = t.maxReconnectionDelay, l = c === void 0 ? M.maxReconnectionDelay : c, p = 0;
311
+ var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? M.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? M.minReconnectionDelay : i, u = t.maxReconnectionDelay, l = u === void 0 ? M.maxReconnectionDelay : u, p = 0;
312
312
  return this._retryCount > 0 && (p = a * Math.pow(o, this._retryCount - 1), p > l && (p = l)), this._debug("next delay", p), p;
313
313
  }, e.prototype._wait = function() {
314
314
  var t = this;
@@ -330,7 +330,7 @@ var cn = function() {
330
330
  var t = this;
331
331
  if (!(this._connectLock || !this._shouldReconnect)) {
332
332
  this._connectLock = !0;
333
- var n = this._options, o = n.maxRetries, i = o === void 0 ? M.maxRetries : o, a = n.connectionTimeout, c = a === void 0 ? M.connectionTimeout : a, l = n.WebSocket, p = l === void 0 ? cn() : l;
333
+ var n = this._options, o = n.maxRetries, i = o === void 0 ? M.maxRetries : o, a = n.connectionTimeout, u = a === void 0 ? M.connectionTimeout : a, l = n.WebSocket, p = l === void 0 ? cn() : l;
334
334
  if (this._retryCount >= i) {
335
335
  this._debug("max retries reached", this._retryCount, ">=", i);
336
336
  return;
@@ -342,7 +342,7 @@ var cn = function() {
342
342
  }).then(function(h) {
343
343
  t._closeCalled || (t._debug("connect", { url: h, protocols: t._protocols }), t._ws = t._protocols ? new p(h, t._protocols) : new p(h), t._ws.binaryType = t._binaryType, t._connectLock = !1, t._addListeners(), t._connectTimeout = setTimeout(function() {
344
344
  return t._handleTimeout();
345
- }, c));
345
+ }, u));
346
346
  });
347
347
  }
348
348
  }, e.prototype._handleTimeout = function() {
@@ -368,10 +368,10 @@ var cn = function() {
368
368
  }, e;
369
369
  }()
370
370
  );
371
- const St = 12095;
371
+ const At = 12095;
372
372
  function pn(e) {
373
373
  const t = typeof window < "u" ? window.location : void 0, n = `/assets/${encodeURIComponent(e)}`;
374
- return `${t?.protocol}//${t?.hostname}:${St}${n}`;
374
+ return `${t?.protocol}//${t?.hostname}:${At}${n}`;
375
375
  }
376
376
  async function ka(e) {
377
377
  const t = await fetch(e);
@@ -440,16 +440,16 @@ function mn() {
440
440
  const vn = 5, gn = 1e4;
441
441
  function yn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = vn, syncRequestTimeout: i = gn }) {
442
442
  const a = {};
443
- async function c() {
443
+ async function u() {
444
444
  const y = [];
445
445
  for (let s = 0; s < o; s++) {
446
- const u = new Promise((d) => {
446
+ const c = new Promise((d) => {
447
447
  const f = mn(), v = Date.now(), _ = performance.now();
448
448
  t({ timesync: { id: f } });
449
449
  const w = (k, E) => d({ sentAt: _, receivedAt: k, serverNow: E, clientNow: v });
450
450
  a[f] = { complete: w }, setTimeout(() => d(null), i);
451
451
  });
452
- y.push(u), await u;
452
+ y.push(c), await c;
453
453
  }
454
454
  const g = (await Promise.all(y)).filter((s) => s !== null), r = bn(g);
455
455
  isNaN(r) || n(Date.now() + r);
@@ -458,8 +458,8 @@ function yn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = vn, sy
458
458
  const g = performance.now(), r = a[y.timesync.id];
459
459
  r && r.complete(g, y.timesync.now);
460
460
  };
461
- c();
462
- const p = setInterval(c, e);
461
+ u();
462
+ const p = setInterval(u, e);
463
463
  return {
464
464
  receive: l,
465
465
  destroy: () => {
@@ -474,12 +474,12 @@ function bn(e) {
474
474
  }).reduce((t, n) => t + n, 0) / e.length;
475
475
  }
476
476
  class Ea {
477
- constructor(t, { hostname: n = document.location.hostname, port: o = St } = {}, i, a) {
477
+ constructor(t, { hostname: n = document.location.hostname, port: o = At } = {}, i, a) {
478
478
  this.manifest = t, this.currentState = { ...i }, this.store = new fn(a ?? {});
479
- const { useReconnectingWebsocket: c, path: l, pathParams: p } = wn(document.location.href);
479
+ const { useReconnectingWebsocket: u, path: l, pathParams: p } = wn(document.location.href);
480
480
  this.urlParams = new URLSearchParams(p), this.urlParams.set("screenWidth", window.screen.width.toString()), this.urlParams.set("screenHeight", window.screen.height.toString()), this.urlParams.set("screenPixelRatio", window.devicePixelRatio.toString());
481
481
  const h = `ws://${n}:${o}${l}?${this.urlParams}`;
482
- this.websocket = c ? new dn(h) : new WebSocket(h);
482
+ this.websocket = u ? new dn(h) : new WebSocket(h);
483
483
  let y;
484
484
  this.websocket.onopen = () => {
485
485
  this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new kn()), this.setState(this.currentState), y = yn({
@@ -505,9 +505,9 @@ class Ea {
505
505
  const r = JSON.parse(g);
506
506
  try {
507
507
  if (r.config)
508
- this.currentConfig = r.config, this.dispatchEvent(new Sn(this.currentConfig));
508
+ this.currentConfig = r.config, this.dispatchEvent(new An(this.currentConfig));
509
509
  else if (r.updates)
510
- this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new An(r.updates));
510
+ this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new Sn(r.updates));
511
511
  else if (r.event && r.event.key)
512
512
  this.dispatchEvent(
513
513
  new Tn(r.event.key, r.event.value)
@@ -527,8 +527,8 @@ class Ea {
527
527
  break;
528
528
  case "media_config_update":
529
529
  this._mediaConfig = s;
530
- for (const u of ["preferOptimizedAudio", "preferOptimizedVideo", "preferOptimizedImages"])
531
- s[u] ? this.urlParams.set(u, "true") : this.urlParams.delete(u);
530
+ for (const c of ["preferOptimizedAudio", "preferOptimizedVideo", "preferOptimizedImages"])
531
+ s[c] ? this.urlParams.set(c, "true") : this.urlParams.delete(c);
532
532
  this.dispatchEvent(new zn(s));
533
533
  break;
534
534
  case "data_store_items":
@@ -656,7 +656,7 @@ class Ea {
656
656
  }
657
657
  }
658
658
  function wn(e) {
659
- const t = new URL(e), n = new URLSearchParams(t.searchParams), o = n.get("local_id"), i = n.get("simulator") === "true", a = n.get("display") ?? "", c = t.pathname.startsWith("/plugin/") ? decodeURIComponent(t.pathname.split("/")[2]) : void 0;
659
+ const t = new URL(e), n = new URLSearchParams(t.searchParams), o = n.get("local_id"), i = n.get("simulator") === "true", a = n.get("display") ?? "", u = t.pathname.startsWith("/plugin/") ? decodeURIComponent(t.pathname.split("/")[2]) : void 0;
660
660
  if (o) {
661
661
  const l = n.get("t") ?? "";
662
662
  return n.delete("local_id"), {
@@ -677,9 +677,9 @@ function wn(e) {
677
677
  path: `/display/${encodeURIComponent(a)}/${encodeURIComponent(l)}`
678
678
  };
679
679
  } else {
680
- if (c)
680
+ if (u)
681
681
  return {
682
- path: `/plugin/${encodeURIComponent(c)}`,
682
+ path: `/plugin/${encodeURIComponent(u)}`,
683
683
  useReconnectingWebsocket: !0
684
684
  };
685
685
  {
@@ -709,13 +709,13 @@ class Cn extends Event {
709
709
  }
710
710
  _cogsConnectionEventType = "message";
711
711
  }
712
- class Sn extends Event {
712
+ class An extends Event {
713
713
  constructor(t) {
714
714
  super("config"), this.config = t;
715
715
  }
716
716
  _cogsConnectionEventType = "config";
717
717
  }
718
- class An extends Event {
718
+ class Sn extends Event {
719
719
  constructor(t) {
720
720
  super("state"), this.state = t;
721
721
  }
@@ -745,14 +745,14 @@ function m(e, t, n) {
745
745
  if (l._zod || Object.defineProperty(l, "_zod", {
746
746
  value: {
747
747
  def: p,
748
- constr: c,
748
+ constr: u,
749
749
  traits: /* @__PURE__ */ new Set()
750
750
  },
751
751
  enumerable: !1
752
752
  }), l._zod.traits.has(e))
753
753
  return;
754
754
  l._zod.traits.add(e), t(l, p);
755
- const h = c.prototype, y = Object.keys(h);
755
+ const h = u.prototype, y = Object.keys(h);
756
756
  for (let g = 0; g < y.length; g++) {
757
757
  const r = y[g];
758
758
  r in l || (l[r] = h[r].bind(l));
@@ -762,7 +762,7 @@ function m(e, t, n) {
762
762
  class a extends i {
763
763
  }
764
764
  Object.defineProperty(a, "name", { value: e });
765
- function c(l) {
765
+ function u(l) {
766
766
  var p;
767
767
  const h = n?.Parent ? new a() : this;
768
768
  o(h, l), (p = h._zod).deferred ?? (p.deferred = []);
@@ -770,16 +770,16 @@ function m(e, t, n) {
770
770
  y();
771
771
  return h;
772
772
  }
773
- return Object.defineProperty(c, "init", { value: o }), Object.defineProperty(c, Symbol.hasInstance, {
773
+ return Object.defineProperty(u, "init", { value: o }), Object.defineProperty(u, Symbol.hasInstance, {
774
774
  value: (l) => n?.Parent && l instanceof n.Parent ? !0 : l?._zod?.traits?.has(e)
775
- }), Object.defineProperty(c, "name", { value: e }), c;
775
+ }), Object.defineProperty(u, "name", { value: e }), u;
776
776
  }
777
777
  class K extends Error {
778
778
  constructor() {
779
779
  super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
780
780
  }
781
781
  }
782
- class At extends Error {
782
+ class St extends Error {
783
783
  constructor(t) {
784
784
  super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
785
785
  }
@@ -819,8 +819,8 @@ function $n(e, t) {
819
819
  const p = o.match(/\d?e-(\d?)/);
820
820
  p?.[1] && (i = Number.parseInt(p[1]));
821
821
  }
822
- const a = n > i ? n : i, c = Number.parseInt(e.toFixed(a).replace(".", "")), l = Number.parseInt(t.toFixed(a).replace(".", ""));
823
- return c % l / 10 ** a;
822
+ const a = n > i ? n : i, u = Number.parseInt(e.toFixed(a).replace(".", "")), l = Number.parseInt(t.toFixed(a).replace(".", ""));
823
+ return u % l / 10 ** a;
824
824
  }
825
825
  const Ke = Symbol("evaluating");
826
826
  function C(e, t, n) {
@@ -996,20 +996,20 @@ function Fn(e, t, n) {
996
996
  get shape() {
997
997
  const i = t._zod.def.shape, a = { ...i };
998
998
  if (n)
999
- for (const c in n) {
1000
- if (!(c in i))
1001
- throw new Error(`Unrecognized key: "${c}"`);
1002
- n[c] && (a[c] = e ? new e({
999
+ for (const u in n) {
1000
+ if (!(u in i))
1001
+ throw new Error(`Unrecognized key: "${u}"`);
1002
+ n[u] && (a[u] = e ? new e({
1003
1003
  type: "optional",
1004
- innerType: i[c]
1005
- }) : i[c]);
1004
+ innerType: i[u]
1005
+ }) : i[u]);
1006
1006
  }
1007
1007
  else
1008
- for (const c in i)
1009
- a[c] = e ? new e({
1008
+ for (const u in i)
1009
+ a[u] = e ? new e({
1010
1010
  type: "optional",
1011
- innerType: i[c]
1012
- }) : i[c];
1011
+ innerType: i[u]
1012
+ }) : i[u];
1013
1013
  return V(this, "shape", a), a;
1014
1014
  },
1015
1015
  checks: []
@@ -1021,19 +1021,19 @@ function Vn(e, t, n) {
1021
1021
  get shape() {
1022
1022
  const i = t._zod.def.shape, a = { ...i };
1023
1023
  if (n)
1024
- for (const c in n) {
1025
- if (!(c in a))
1026
- throw new Error(`Unrecognized key: "${c}"`);
1027
- n[c] && (a[c] = new e({
1024
+ for (const u in n) {
1025
+ if (!(u in a))
1026
+ throw new Error(`Unrecognized key: "${u}"`);
1027
+ n[u] && (a[u] = new e({
1028
1028
  type: "nonoptional",
1029
- innerType: i[c]
1029
+ innerType: i[u]
1030
1030
  }));
1031
1031
  }
1032
1032
  else
1033
- for (const c in i)
1034
- a[c] = new e({
1033
+ for (const u in i)
1034
+ a[u] = new e({
1035
1035
  type: "nonoptional",
1036
- innerType: i[c]
1036
+ innerType: i[u]
1037
1037
  });
1038
1038
  return V(this, "shape", a), a;
1039
1039
  },
@@ -1100,7 +1100,7 @@ function Gn(e, t = (n) => n.message) {
1100
1100
  const n = { _errors: [] }, o = (i) => {
1101
1101
  for (const a of i.issues)
1102
1102
  if (a.code === "invalid_union" && a.errors.length)
1103
- a.errors.map((c) => o({ issues: c }));
1103
+ a.errors.map((u) => o({ issues: u }));
1104
1104
  else if (a.code === "invalid_key")
1105
1105
  o({ issues: a.issues });
1106
1106
  else if (a.code === "invalid_element")
@@ -1108,46 +1108,46 @@ function Gn(e, t = (n) => n.message) {
1108
1108
  else if (a.path.length === 0)
1109
1109
  n._errors.push(t(a));
1110
1110
  else {
1111
- let c = n, l = 0;
1111
+ let u = n, l = 0;
1112
1112
  for (; l < a.path.length; ) {
1113
1113
  const p = a.path[l];
1114
- l === a.path.length - 1 ? (c[p] = c[p] || { _errors: [] }, c[p]._errors.push(t(a))) : c[p] = c[p] || { _errors: [] }, c = c[p], l++;
1114
+ l === a.path.length - 1 ? (u[p] = u[p] || { _errors: [] }, u[p]._errors.push(t(a))) : u[p] = u[p] || { _errors: [] }, u = u[p], l++;
1115
1115
  }
1116
1116
  }
1117
1117
  };
1118
1118
  return o(e), n;
1119
1119
  }
1120
1120
  const Le = (e) => (t, n, o, i) => {
1121
- const a = o ? Object.assign(o, { async: !1 }) : { async: !1 }, c = t._zod.run({ value: n, issues: [] }, a);
1122
- if (c instanceof Promise)
1121
+ const a = o ? Object.assign(o, { async: !1 }) : { async: !1 }, u = t._zod.run({ value: n, issues: [] }, a);
1122
+ if (u instanceof Promise)
1123
1123
  throw new K();
1124
- if (c.issues.length) {
1125
- const l = new (i?.Err ?? e)(c.issues.map((p) => N(p, a, j())));
1124
+ if (u.issues.length) {
1125
+ const l = new (i?.Err ?? e)(u.issues.map((p) => N(p, a, j())));
1126
1126
  throw zt(l, i?.callee), l;
1127
1127
  }
1128
- return c.value;
1128
+ return u.value;
1129
1129
  }, Re = (e) => async (t, n, o, i) => {
1130
1130
  const a = o ? Object.assign(o, { async: !0 }) : { async: !0 };
1131
- let c = t._zod.run({ value: n, issues: [] }, a);
1132
- if (c instanceof Promise && (c = await c), c.issues.length) {
1133
- const l = new (i?.Err ?? e)(c.issues.map((p) => N(p, a, j())));
1131
+ let u = t._zod.run({ value: n, issues: [] }, a);
1132
+ if (u instanceof Promise && (u = await u), u.issues.length) {
1133
+ const l = new (i?.Err ?? e)(u.issues.map((p) => N(p, a, j())));
1134
1134
  throw zt(l, i?.callee), l;
1135
1135
  }
1136
- return c.value;
1136
+ return u.value;
1137
1137
  }, _e = (e) => (t, n, o) => {
1138
1138
  const i = o ? { ...o, async: !1 } : { async: !1 }, a = t._zod.run({ value: n, issues: [] }, i);
1139
1139
  if (a instanceof Promise)
1140
1140
  throw new K();
1141
1141
  return a.issues.length ? {
1142
1142
  success: !1,
1143
- error: new (e ?? $t)(a.issues.map((c) => N(c, i, j())))
1143
+ error: new (e ?? $t)(a.issues.map((u) => N(u, i, j())))
1144
1144
  } : { success: !0, data: a.value };
1145
1145
  }, Wn = /* @__PURE__ */ _e(Pt), me = (e) => async (t, n, o) => {
1146
1146
  const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
1147
1147
  let a = t._zod.run({ value: n, issues: [] }, i);
1148
1148
  return a instanceof Promise && (a = await a), a.issues.length ? {
1149
1149
  success: !1,
1150
- error: new e(a.issues.map((c) => N(c, i, j())))
1150
+ error: new e(a.issues.map((u) => N(u, i, j())))
1151
1151
  } : { success: !0, data: a.value };
1152
1152
  }, qn = /* @__PURE__ */ me(Pt), Kn = (e) => (t, n, o) => {
1153
1153
  const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
@@ -1182,7 +1182,7 @@ function ko(e) {
1182
1182
  const Eo = (e) => {
1183
1183
  const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
1184
1184
  return new RegExp(`^${t}$`);
1185
- }, Co = /^-?\d+$/, So = /^-?\d+(?:\.\d+)?/, Ao = /^null$/i, To = /^[^A-Z]*$/, zo = /^[^a-z]*$/, $ = /* @__PURE__ */ m("$ZodCheck", (e, t) => {
1185
+ }, Co = /^-?\d+$/, Ao = /^-?\d+(?:\.\d+)?/, So = /^null$/i, To = /^[^A-Z]*$/, zo = /^[^a-z]*$/, $ = /* @__PURE__ */ m("$ZodCheck", (e, t) => {
1186
1186
  var n;
1187
1187
  e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
1188
1188
  }), Rt = {
@@ -1242,14 +1242,14 @@ const Eo = (e) => {
1242
1242
  }), Oo = /* @__PURE__ */ m("$ZodCheckNumberFormat", (e, t) => {
1243
1243
  $.init(e, t), t.format = t.format || "float64";
1244
1244
  const n = t.format?.includes("int"), o = n ? "int" : "number", [i, a] = Rn[t.format];
1245
- e._zod.onattach.push((c) => {
1246
- const l = c._zod.bag;
1245
+ e._zod.onattach.push((u) => {
1246
+ const l = u._zod.bag;
1247
1247
  l.format = t.format, l.minimum = i, l.maximum = a, n && (l.pattern = Co);
1248
- }), e._zod.check = (c) => {
1249
- const l = c.value;
1248
+ }), e._zod.check = (u) => {
1249
+ const l = u.value;
1250
1250
  if (n) {
1251
1251
  if (!Number.isInteger(l)) {
1252
- c.issues.push({
1252
+ u.issues.push({
1253
1253
  expected: o,
1254
1254
  format: t.format,
1255
1255
  code: "invalid_type",
@@ -1260,7 +1260,7 @@ const Eo = (e) => {
1260
1260
  return;
1261
1261
  }
1262
1262
  if (!Number.isSafeInteger(l)) {
1263
- l > 0 ? c.issues.push({
1263
+ l > 0 ? u.issues.push({
1264
1264
  input: l,
1265
1265
  code: "too_big",
1266
1266
  maximum: Number.MAX_SAFE_INTEGER,
@@ -1268,7 +1268,7 @@ const Eo = (e) => {
1268
1268
  inst: e,
1269
1269
  origin: o,
1270
1270
  continue: !t.abort
1271
- }) : c.issues.push({
1271
+ }) : u.issues.push({
1272
1272
  input: l,
1273
1273
  code: "too_small",
1274
1274
  minimum: Number.MIN_SAFE_INTEGER,
@@ -1280,7 +1280,7 @@ const Eo = (e) => {
1280
1280
  return;
1281
1281
  }
1282
1282
  }
1283
- l < i && c.issues.push({
1283
+ l < i && u.issues.push({
1284
1284
  origin: "number",
1285
1285
  input: l,
1286
1286
  code: "too_small",
@@ -1288,7 +1288,7 @@ const Eo = (e) => {
1288
1288
  inclusive: !0,
1289
1289
  inst: e,
1290
1290
  continue: !t.abort
1291
- }), l > a && c.issues.push({
1291
+ }), l > a && u.issues.push({
1292
1292
  origin: "number",
1293
1293
  input: l,
1294
1294
  code: "too_big",
@@ -1308,9 +1308,9 @@ const Eo = (e) => {
1308
1308
  const i = o.value;
1309
1309
  if (i.length <= t.maximum)
1310
1310
  return;
1311
- const c = xe(i);
1311
+ const u = xe(i);
1312
1312
  o.issues.push({
1313
- origin: c,
1313
+ origin: u,
1314
1314
  code: "too_big",
1315
1315
  maximum: t.maximum,
1316
1316
  inclusive: !0,
@@ -1331,9 +1331,9 @@ const Eo = (e) => {
1331
1331
  const i = o.value;
1332
1332
  if (i.length >= t.minimum)
1333
1333
  return;
1334
- const c = xe(i);
1334
+ const u = xe(i);
1335
1335
  o.issues.push({
1336
- origin: c,
1336
+ origin: u,
1337
1337
  code: "too_small",
1338
1338
  minimum: t.minimum,
1339
1339
  inclusive: !0,
@@ -1354,9 +1354,9 @@ const Eo = (e) => {
1354
1354
  const i = o.value, a = i.length;
1355
1355
  if (a === t.length)
1356
1356
  return;
1357
- const c = xe(i), l = a > t.length;
1357
+ const u = xe(i), l = a > t.length;
1358
1358
  o.issues.push({
1359
- origin: c,
1359
+ origin: u,
1360
1360
  ...l ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
1361
1361
  inclusive: !0,
1362
1362
  exact: !0,
@@ -1467,9 +1467,9 @@ class Mo {
1467
1467
  return;
1468
1468
  }
1469
1469
  const o = t.split(`
1470
- `).filter((c) => c), i = Math.min(...o.map((c) => c.length - c.trimStart().length)), a = o.map((c) => c.slice(i)).map((c) => " ".repeat(this.indent * 2) + c);
1471
- for (const c of a)
1472
- this.content.push(c);
1470
+ `).filter((u) => u), i = Math.min(...o.map((u) => u.length - u.trimStart().length)), a = o.map((u) => u.slice(i)).map((u) => " ".repeat(this.indent * 2) + u);
1471
+ for (const u of a)
1472
+ this.content.push(u);
1473
1473
  }
1474
1474
  compile() {
1475
1475
  const t = Function, n = this?.args, i = [...(this?.content ?? [""]).map((a) => ` ${a}`)];
@@ -1481,7 +1481,7 @@ const Fo = {
1481
1481
  major: 4,
1482
1482
  minor: 1,
1483
1483
  patch: 13
1484
- }, S = /* @__PURE__ */ m("$ZodType", (e, t) => {
1484
+ }, A = /* @__PURE__ */ m("$ZodType", (e, t) => {
1485
1485
  var n;
1486
1486
  e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Fo;
1487
1487
  const o = [...e._zod.def.checks ?? []];
@@ -1494,31 +1494,31 @@ const Fo = {
1494
1494
  e._zod.run = e._zod.parse;
1495
1495
  });
1496
1496
  else {
1497
- const i = (c, l, p) => {
1498
- let h = q(c), y;
1497
+ const i = (u, l, p) => {
1498
+ let h = q(u), y;
1499
1499
  for (const g of l) {
1500
1500
  if (g._zod.def.when) {
1501
- if (!g._zod.def.when(c))
1501
+ if (!g._zod.def.when(u))
1502
1502
  continue;
1503
1503
  } else if (h)
1504
1504
  continue;
1505
- const r = c.issues.length, s = g._zod.check(c);
1505
+ const r = u.issues.length, s = g._zod.check(u);
1506
1506
  if (s instanceof Promise && p?.async === !1)
1507
1507
  throw new K();
1508
1508
  if (y || s instanceof Promise)
1509
1509
  y = (y ?? Promise.resolve()).then(async () => {
1510
- await s, c.issues.length !== r && (h || (h = q(c, r)));
1510
+ await s, u.issues.length !== r && (h || (h = q(u, r)));
1511
1511
  });
1512
1512
  else {
1513
- if (c.issues.length === r)
1513
+ if (u.issues.length === r)
1514
1514
  continue;
1515
- h || (h = q(c, r));
1515
+ h || (h = q(u, r));
1516
1516
  }
1517
1517
  }
1518
- return y ? y.then(() => c) : c;
1519
- }, a = (c, l, p) => {
1520
- if (q(c))
1521
- return c.aborted = !0, c;
1518
+ return y ? y.then(() => u) : u;
1519
+ }, a = (u, l, p) => {
1520
+ if (q(u))
1521
+ return u.aborted = !0, u;
1522
1522
  const h = i(l, o, p);
1523
1523
  if (h instanceof Promise) {
1524
1524
  if (p.async === !1)
@@ -1527,14 +1527,14 @@ const Fo = {
1527
1527
  }
1528
1528
  return e._zod.parse(h, p);
1529
1529
  };
1530
- e._zod.run = (c, l) => {
1530
+ e._zod.run = (u, l) => {
1531
1531
  if (l.skipChecks)
1532
- return e._zod.parse(c, l);
1532
+ return e._zod.parse(u, l);
1533
1533
  if (l.direction === "backward") {
1534
- const h = e._zod.parse({ value: c.value, issues: [] }, { ...l, skipChecks: !0 });
1535
- return h instanceof Promise ? h.then((y) => a(y, c, l)) : a(h, c, l);
1534
+ const h = e._zod.parse({ value: u.value, issues: [] }, { ...l, skipChecks: !0 });
1535
+ return h instanceof Promise ? h.then((y) => a(y, u, l)) : a(h, u, l);
1536
1536
  }
1537
- const p = e._zod.parse(c, l);
1537
+ const p = e._zod.parse(u, l);
1538
1538
  if (p instanceof Promise) {
1539
1539
  if (l.async === !1)
1540
1540
  throw new K();
@@ -1549,14 +1549,14 @@ const Fo = {
1549
1549
  const a = Wn(e, i);
1550
1550
  return a.success ? { value: a.data } : { issues: a.error?.issues };
1551
1551
  } catch {
1552
- return qn(e, i).then((c) => c.success ? { value: c.data } : { issues: c.error?.issues });
1552
+ return qn(e, i).then((u) => u.success ? { value: u.data } : { issues: u.error?.issues });
1553
1553
  }
1554
1554
  },
1555
1555
  vendor: "zod",
1556
1556
  version: 1
1557
1557
  };
1558
1558
  }), je = /* @__PURE__ */ m("$ZodString", (e, t) => {
1559
- S.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Eo(e._zod.bag), e._zod.parse = (n, o) => {
1559
+ A.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Eo(e._zod.bag), e._zod.parse = (n, o) => {
1560
1560
  if (t.coerce)
1561
1561
  try {
1562
1562
  n.value = String(n.value);
@@ -1674,10 +1674,10 @@ const Fo = {
1674
1674
  const [i, a] = o;
1675
1675
  if (!a)
1676
1676
  throw new Error();
1677
- const c = Number(a);
1678
- if (`${c}` !== a)
1677
+ const u = Number(a);
1678
+ if (`${u}` !== a)
1679
1679
  throw new Error();
1680
- if (c < 0 || c > 128)
1680
+ if (u < 0 || u > 128)
1681
1681
  throw new Error();
1682
1682
  new URL(`http://[${i}]`);
1683
1683
  } catch {
@@ -1757,7 +1757,7 @@ const fr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1757
1757
  });
1758
1758
  };
1759
1759
  }), Ut = /* @__PURE__ */ m("$ZodNumber", (e, t) => {
1760
- S.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? So, e._zod.parse = (n, o) => {
1760
+ A.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Ao, e._zod.parse = (n, o) => {
1761
1761
  if (t.coerce)
1762
1762
  try {
1763
1763
  n.value = Number(n.value);
@@ -1778,7 +1778,7 @@ const fr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1778
1778
  }), hr = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
1779
1779
  Oo.init(e, t), Ut.init(e, t);
1780
1780
  }), _r = /* @__PURE__ */ m("$ZodNull", (e, t) => {
1781
- S.init(e, t), e._zod.pattern = Ao, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (n, o) => {
1781
+ A.init(e, t), e._zod.pattern = So, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (n, o) => {
1782
1782
  const i = n.value;
1783
1783
  return i === null || n.issues.push({
1784
1784
  expected: "null",
@@ -1788,9 +1788,9 @@ const fr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1788
1788
  }), n;
1789
1789
  };
1790
1790
  }), mr = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
1791
- S.init(e, t), e._zod.parse = (n) => n;
1791
+ A.init(e, t), e._zod.parse = (n) => n;
1792
1792
  }), vr = /* @__PURE__ */ m("$ZodNever", (e, t) => {
1793
- S.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
1793
+ A.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
1794
1794
  expected: "never",
1795
1795
  code: "invalid_type",
1796
1796
  input: n.value,
@@ -1801,7 +1801,7 @@ function Qe(e, t, n) {
1801
1801
  e.issues.length && t.issues.push(...F(n, e.issues)), t.value[n] = e.value;
1802
1802
  }
1803
1803
  const gr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
1804
- S.init(e, t), e._zod.parse = (n, o) => {
1804
+ A.init(e, t), e._zod.parse = (n, o) => {
1805
1805
  const i = n.value;
1806
1806
  if (!Array.isArray(i))
1807
1807
  return n.issues.push({
@@ -1812,12 +1812,12 @@ const gr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
1812
1812
  }), n;
1813
1813
  n.value = Array(i.length);
1814
1814
  const a = [];
1815
- for (let c = 0; c < i.length; c++) {
1816
- const l = i[c], p = t.element._zod.run({
1815
+ for (let u = 0; u < i.length; u++) {
1816
+ const l = i[u], p = t.element._zod.run({
1817
1817
  value: l,
1818
1818
  issues: []
1819
1819
  }, o);
1820
- p instanceof Promise ? a.push(p.then((h) => Qe(h, n, c))) : Qe(p, n, c);
1820
+ p instanceof Promise ? a.push(p.then((h) => Qe(h, n, u))) : Qe(p, n, u);
1821
1821
  }
1822
1822
  return a.length ? Promise.all(a).then(() => n) : n;
1823
1823
  };
@@ -1840,26 +1840,26 @@ function Mt(e) {
1840
1840
  };
1841
1841
  }
1842
1842
  function Ft(e, t, n, o, i, a) {
1843
- const c = [], l = i.keySet, p = i.catchall._zod, h = p.def.type;
1843
+ const u = [], l = i.keySet, p = i.catchall._zod, h = p.def.type;
1844
1844
  for (const y in t) {
1845
1845
  if (l.has(y))
1846
1846
  continue;
1847
1847
  if (h === "never") {
1848
- c.push(y);
1848
+ u.push(y);
1849
1849
  continue;
1850
1850
  }
1851
1851
  const g = p.run({ value: t[y], issues: [] }, o);
1852
1852
  g instanceof Promise ? e.push(g.then((r) => fe(r, n, y, t))) : fe(g, n, y, t);
1853
1853
  }
1854
- return c.length && n.issues.push({
1854
+ return u.length && n.issues.push({
1855
1855
  code: "unrecognized_keys",
1856
- keys: c,
1856
+ keys: u,
1857
1857
  input: t,
1858
1858
  inst: a
1859
1859
  }), e.length ? Promise.all(e).then(() => n) : n;
1860
1860
  }
1861
1861
  const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1862
- if (S.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
1862
+ if (A.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
1863
1863
  const l = t.shape;
1864
1864
  Object.defineProperty(t, "shape", {
1865
1865
  get: () => {
@@ -1884,9 +1884,9 @@ const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1884
1884
  return p;
1885
1885
  });
1886
1886
  const i = pe, a = t.catchall;
1887
- let c;
1887
+ let u;
1888
1888
  e._zod.parse = (l, p) => {
1889
- c ?? (c = o.value);
1889
+ u ?? (u = o.value);
1890
1890
  const h = l.value;
1891
1891
  if (!i(h))
1892
1892
  return l.issues.push({
@@ -1896,27 +1896,27 @@ const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1896
1896
  inst: e
1897
1897
  }), l;
1898
1898
  l.value = {};
1899
- const y = [], g = c.shape;
1900
- for (const r of c.keys) {
1901
- const u = g[r]._zod.run({ value: h[r], issues: [] }, p);
1902
- u instanceof Promise ? y.push(u.then((d) => fe(d, l, r, h))) : fe(u, l, r, h);
1899
+ const y = [], g = u.shape;
1900
+ for (const r of u.keys) {
1901
+ const c = g[r]._zod.run({ value: h[r], issues: [] }, p);
1902
+ c instanceof Promise ? y.push(c.then((d) => fe(d, l, r, h))) : fe(c, l, r, h);
1903
1903
  }
1904
1904
  return a ? Ft(y, h, l, p, o.value, e) : y.length ? Promise.all(y).then(() => l) : l;
1905
1905
  };
1906
1906
  }), br = /* @__PURE__ */ m("$ZodObjectJIT", (e, t) => {
1907
1907
  yr.init(e, t);
1908
1908
  const n = e._zod.parse, o = $e(() => Mt(t)), i = (r) => {
1909
- const s = new Mo(["shape", "payload", "ctx"]), u = o.value, d = (w) => {
1909
+ const s = new Mo(["shape", "payload", "ctx"]), c = o.value, d = (w) => {
1910
1910
  const k = He(w);
1911
1911
  return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1912
1912
  };
1913
1913
  s.write("const input = payload.value;");
1914
1914
  const f = /* @__PURE__ */ Object.create(null);
1915
1915
  let v = 0;
1916
- for (const w of u.keys)
1916
+ for (const w of c.keys)
1917
1917
  f[w] = `key_${v++}`;
1918
1918
  s.write("const newResult = {};");
1919
- for (const w of u.keys) {
1919
+ for (const w of c.keys) {
1920
1920
  const k = f[w], E = He(w);
1921
1921
  s.write(`const ${k} = ${d(w)};`), s.write(`
1922
1922
  if (${k}.issues.length) {
@@ -1942,15 +1942,15 @@ const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1942
1942
  return (w, k) => _(r, w, k);
1943
1943
  };
1944
1944
  let a;
1945
- const c = pe, l = !Tt.jitless, h = l && Zn.value, y = t.catchall;
1945
+ const u = pe, l = !Tt.jitless, h = l && Zn.value, y = t.catchall;
1946
1946
  let g;
1947
1947
  e._zod.parse = (r, s) => {
1948
1948
  g ?? (g = o.value);
1949
- const u = r.value;
1950
- return c(u) ? l && h && s?.async === !1 && s.jitless !== !0 ? (a || (a = i(t.shape)), r = a(r, s), y ? Ft([], u, r, s, g, e) : r) : n(r, s) : (r.issues.push({
1949
+ const c = r.value;
1950
+ return u(c) ? l && h && s?.async === !1 && s.jitless !== !0 ? (a || (a = i(t.shape)), r = a(r, s), y ? Ft([], c, r, s, g, e) : r) : n(r, s) : (r.issues.push({
1951
1951
  expected: "object",
1952
1952
  code: "invalid_type",
1953
- input: u,
1953
+ input: c,
1954
1954
  inst: e
1955
1955
  }), r);
1956
1956
  };
@@ -1964,11 +1964,11 @@ function Ye(e, t, n, o) {
1964
1964
  code: "invalid_union",
1965
1965
  input: t.value,
1966
1966
  inst: n,
1967
- errors: e.map((a) => a.issues.map((c) => N(c, o, j())))
1967
+ errors: e.map((a) => a.issues.map((u) => N(u, o, j())))
1968
1968
  }), t);
1969
1969
  }
1970
1970
  const wr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1971
- S.init(e, t), C(e._zod, "optin", () => t.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), C(e._zod, "optout", () => t.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), C(e._zod, "values", () => {
1971
+ A.init(e, t), C(e._zod, "optin", () => t.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), C(e._zod, "optout", () => t.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), C(e._zod, "values", () => {
1972
1972
  if (t.options.every((i) => i._zod.values))
1973
1973
  return new Set(t.options.flatMap((i) => Array.from(i._zod.values)));
1974
1974
  }), C(e._zod, "pattern", () => {
@@ -1981,7 +1981,7 @@ const wr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1981
1981
  e._zod.parse = (i, a) => {
1982
1982
  if (n)
1983
1983
  return o(i, a);
1984
- let c = !1;
1984
+ let u = !1;
1985
1985
  const l = [];
1986
1986
  for (const p of t.options) {
1987
1987
  const h = p._zod.run({
@@ -1989,19 +1989,19 @@ const wr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1989
1989
  issues: []
1990
1990
  }, a);
1991
1991
  if (h instanceof Promise)
1992
- l.push(h), c = !0;
1992
+ l.push(h), u = !0;
1993
1993
  else {
1994
1994
  if (h.issues.length === 0)
1995
1995
  return h;
1996
1996
  l.push(h);
1997
1997
  }
1998
1998
  }
1999
- return c ? Promise.all(l).then((p) => Ye(p, i, e, a)) : Ye(l, i, e, a);
1999
+ return u ? Promise.all(l).then((p) => Ye(p, i, e, a)) : Ye(l, i, e, a);
2000
2000
  };
2001
2001
  }), kr = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
2002
- S.init(e, t), e._zod.parse = (n, o) => {
2003
- const i = n.value, a = t.left._zod.run({ value: i, issues: [] }, o), c = t.right._zod.run({ value: i, issues: [] }, o);
2004
- return a instanceof Promise || c instanceof Promise ? Promise.all([a, c]).then(([p, h]) => Xe(n, p, h)) : Xe(n, a, c);
2002
+ A.init(e, t), e._zod.parse = (n, o) => {
2003
+ const i = n.value, a = t.left._zod.run({ value: i, issues: [] }, o), u = t.right._zod.run({ value: i, issues: [] }, o);
2004
+ return a instanceof Promise || u instanceof Promise ? Promise.all([a, u]).then(([p, h]) => Xe(n, p, h)) : Xe(n, a, u);
2005
2005
  };
2006
2006
  });
2007
2007
  function ze(e, t) {
@@ -2012,13 +2012,13 @@ function ze(e, t) {
2012
2012
  if (H(e) && H(t)) {
2013
2013
  const n = Object.keys(t), o = Object.keys(e).filter((a) => n.indexOf(a) !== -1), i = { ...e, ...t };
2014
2014
  for (const a of o) {
2015
- const c = ze(e[a], t[a]);
2016
- if (!c.valid)
2015
+ const u = ze(e[a], t[a]);
2016
+ if (!u.valid)
2017
2017
  return {
2018
2018
  valid: !1,
2019
- mergeErrorPath: [a, ...c.mergeErrorPath]
2019
+ mergeErrorPath: [a, ...u.mergeErrorPath]
2020
2020
  };
2021
- i[a] = c.data;
2021
+ i[a] = u.data;
2022
2022
  }
2023
2023
  return { valid: !0, data: i };
2024
2024
  }
@@ -2027,13 +2027,13 @@ function ze(e, t) {
2027
2027
  return { valid: !1, mergeErrorPath: [] };
2028
2028
  const n = [];
2029
2029
  for (let o = 0; o < e.length; o++) {
2030
- const i = e[o], a = t[o], c = ze(i, a);
2031
- if (!c.valid)
2030
+ const i = e[o], a = t[o], u = ze(i, a);
2031
+ if (!u.valid)
2032
2032
  return {
2033
2033
  valid: !1,
2034
- mergeErrorPath: [o, ...c.mergeErrorPath]
2034
+ mergeErrorPath: [o, ...u.mergeErrorPath]
2035
2035
  };
2036
- n.push(c.data);
2036
+ n.push(u.data);
2037
2037
  }
2038
2038
  return { valid: !0, data: n };
2039
2039
  }
@@ -2048,7 +2048,7 @@ function Xe(e, t, n) {
2048
2048
  return e.value = o.data, e;
2049
2049
  }
2050
2050
  const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
2051
- S.init(e, t);
2051
+ A.init(e, t);
2052
2052
  const n = t.items;
2053
2053
  e._zod.parse = (o, i) => {
2054
2054
  const a = o.value;
@@ -2060,7 +2060,7 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
2060
2060
  code: "invalid_type"
2061
2061
  }), o;
2062
2062
  o.value = [];
2063
- const c = [], l = [...n].reverse().findIndex((y) => y._zod.optin !== "optional"), p = l === -1 ? 0 : n.length - l;
2063
+ const u = [], l = [...n].reverse().findIndex((y) => y._zod.optin !== "optional"), p = l === -1 ? 0 : n.length - l;
2064
2064
  if (!t.rest) {
2065
2065
  const y = a.length > n.length, g = a.length < p - 1;
2066
2066
  if (y || g)
@@ -2079,7 +2079,7 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
2079
2079
  value: a[h],
2080
2080
  issues: []
2081
2081
  }, i);
2082
- g instanceof Promise ? c.push(g.then((r) => ae(r, o, h))) : ae(g, o, h);
2082
+ g instanceof Promise ? u.push(g.then((r) => ae(r, o, h))) : ae(g, o, h);
2083
2083
  }
2084
2084
  if (t.rest) {
2085
2085
  const y = a.slice(n.length);
@@ -2089,17 +2089,17 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
2089
2089
  value: g,
2090
2090
  issues: []
2091
2091
  }, i);
2092
- r instanceof Promise ? c.push(r.then((s) => ae(s, o, h))) : ae(r, o, h);
2092
+ r instanceof Promise ? u.push(r.then((s) => ae(s, o, h))) : ae(r, o, h);
2093
2093
  }
2094
2094
  }
2095
- return c.length ? Promise.all(c).then(() => o) : o;
2095
+ return u.length ? Promise.all(u).then(() => o) : o;
2096
2096
  };
2097
2097
  });
2098
2098
  function ae(e, t, n) {
2099
2099
  e.issues.length && t.issues.push(...F(n, e.issues)), t.value[n] = e.value;
2100
2100
  }
2101
2101
  const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
2102
- S.init(e, t), e._zod.parse = (n, o) => {
2102
+ A.init(e, t), e._zod.parse = (n, o) => {
2103
2103
  const i = n.value;
2104
2104
  if (!H(i))
2105
2105
  return n.issues.push({
@@ -2108,11 +2108,11 @@ const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
2108
2108
  input: i,
2109
2109
  inst: e
2110
2110
  }), n;
2111
- const a = [], c = t.keyType._zod.values;
2112
- if (c) {
2111
+ const a = [], u = t.keyType._zod.values;
2112
+ if (u) {
2113
2113
  n.value = {};
2114
2114
  const l = /* @__PURE__ */ new Set();
2115
- for (const h of c)
2115
+ for (const h of u)
2116
2116
  if (typeof h == "string" || typeof h == "number" || typeof h == "symbol") {
2117
2117
  l.add(typeof h == "number" ? h.toString() : h);
2118
2118
  const y = t.valueType._zod.run({ value: i[h], issues: [] }, o);
@@ -2156,20 +2156,20 @@ const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
2156
2156
  }
2157
2157
  return a.length ? Promise.all(a).then(() => n) : n;
2158
2158
  };
2159
- }), Sr = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
2160
- S.init(e, t);
2159
+ }), Ar = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
2160
+ A.init(e, t);
2161
2161
  const n = On(t.entries), o = new Set(n);
2162
2162
  e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) => xn.has(typeof i)).map((i) => typeof i == "string" ? J(i) : i.toString()).join("|")})$`), e._zod.parse = (i, a) => {
2163
- const c = i.value;
2164
- return o.has(c) || i.issues.push({
2163
+ const u = i.value;
2164
+ return o.has(u) || i.issues.push({
2165
2165
  code: "invalid_value",
2166
2166
  values: n,
2167
- input: c,
2167
+ input: u,
2168
2168
  inst: e
2169
2169
  }), i;
2170
2170
  };
2171
- }), Ar = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
2172
- if (S.init(e, t), t.values.length === 0)
2171
+ }), Sr = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
2172
+ if (A.init(e, t), t.values.length === 0)
2173
2173
  throw new Error("Cannot create literal schema with no valid values");
2174
2174
  const n = new Set(t.values);
2175
2175
  e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((o) => typeof o == "string" ? J(o) : o ? J(o.toString()) : String(o)).join("|")})$`), e._zod.parse = (o, i) => {
@@ -2182,12 +2182,12 @@ const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
2182
2182
  }), o;
2183
2183
  };
2184
2184
  }), Tr = /* @__PURE__ */ m("$ZodTransform", (e, t) => {
2185
- S.init(e, t), e._zod.parse = (n, o) => {
2185
+ A.init(e, t), e._zod.parse = (n, o) => {
2186
2186
  if (o.direction === "backward")
2187
- throw new At(e.constructor.name);
2187
+ throw new St(e.constructor.name);
2188
2188
  const i = t.transform(n.value, n);
2189
2189
  if (o.async)
2190
- return (i instanceof Promise ? i : Promise.resolve(i)).then((c) => (n.value = c, n));
2190
+ return (i instanceof Promise ? i : Promise.resolve(i)).then((u) => (n.value = u, n));
2191
2191
  if (i instanceof Promise)
2192
2192
  throw new K();
2193
2193
  return n.value = i, n;
@@ -2197,7 +2197,7 @@ function et(e, t) {
2197
2197
  return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
2198
2198
  }
2199
2199
  const zr = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
2200
- S.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", C(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), C(e._zod, "pattern", () => {
2200
+ A.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", C(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), C(e._zod, "pattern", () => {
2201
2201
  const n = t.innerType._zod.pattern;
2202
2202
  return n ? new RegExp(`^(${Ze(n.source)})?$`) : void 0;
2203
2203
  }), e._zod.parse = (n, o) => {
@@ -2208,12 +2208,12 @@ const zr = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
2208
2208
  return n.value === void 0 ? n : t.innerType._zod.run(n, o);
2209
2209
  };
2210
2210
  }), Ir = /* @__PURE__ */ m("$ZodNullable", (e, t) => {
2211
- S.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "pattern", () => {
2211
+ A.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "pattern", () => {
2212
2212
  const n = t.innerType._zod.pattern;
2213
2213
  return n ? new RegExp(`^(${Ze(n.source)}|null)$`) : void 0;
2214
2214
  }), C(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, o) => n.value === null ? n : t.innerType._zod.run(n, o);
2215
2215
  }), Or = /* @__PURE__ */ m("$ZodDefault", (e, t) => {
2216
- S.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
2216
+ A.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
2217
2217
  if (o.direction === "backward")
2218
2218
  return t.innerType._zod.run(n, o);
2219
2219
  if (n.value === void 0)
@@ -2226,9 +2226,9 @@ function tt(e, t) {
2226
2226
  return e.value === void 0 && (e.value = t.defaultValue), e;
2227
2227
  }
2228
2228
  const $r = /* @__PURE__ */ m("$ZodPrefault", (e, t) => {
2229
- S.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (o.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o));
2229
+ A.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (o.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o));
2230
2230
  }), Pr = /* @__PURE__ */ m("$ZodNonOptional", (e, t) => {
2231
- S.init(e, t), C(e._zod, "values", () => {
2231
+ A.init(e, t), C(e._zod, "values", () => {
2232
2232
  const n = t.innerType._zod.values;
2233
2233
  return n ? new Set([...n].filter((o) => o !== void 0)) : void 0;
2234
2234
  }), e._zod.parse = (n, o) => {
@@ -2245,14 +2245,14 @@ function nt(e, t) {
2245
2245
  }), e;
2246
2246
  }
2247
2247
  const Zr = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
2248
- S.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
2248
+ A.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
2249
2249
  if (o.direction === "backward")
2250
2250
  return t.innerType._zod.run(n, o);
2251
2251
  const i = t.innerType._zod.run(n, o);
2252
2252
  return i instanceof Promise ? i.then((a) => (n.value = a.value, a.issues.length && (n.value = t.catchValue({
2253
2253
  ...n,
2254
2254
  error: {
2255
- issues: a.issues.map((c) => N(c, o, j()))
2255
+ issues: a.issues.map((u) => N(u, o, j()))
2256
2256
  },
2257
2257
  input: n.value
2258
2258
  }), n.issues = []), n)) : (n.value = i.value, i.issues.length && (n.value = t.catchValue({
@@ -2264,10 +2264,10 @@ const Zr = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
2264
2264
  }), n.issues = []), n);
2265
2265
  };
2266
2266
  }), xr = /* @__PURE__ */ m("$ZodPipe", (e, t) => {
2267
- S.init(e, t), C(e._zod, "values", () => t.in._zod.values), C(e._zod, "optin", () => t.in._zod.optin), C(e._zod, "optout", () => t.out._zod.optout), C(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => {
2267
+ A.init(e, t), C(e._zod, "values", () => t.in._zod.values), C(e._zod, "optin", () => t.in._zod.optin), C(e._zod, "optout", () => t.out._zod.optout), C(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => {
2268
2268
  if (o.direction === "backward") {
2269
2269
  const a = t.out._zod.run(n, o);
2270
- return a instanceof Promise ? a.then((c) => ue(c, t.in, o)) : ue(a, t.in, o);
2270
+ return a instanceof Promise ? a.then((u) => ue(u, t.in, o)) : ue(a, t.in, o);
2271
2271
  }
2272
2272
  const i = t.in._zod.run(n, o);
2273
2273
  return i instanceof Promise ? i.then((a) => ue(a, t.out, o)) : ue(i, t.out, o);
@@ -2277,7 +2277,7 @@ function ue(e, t, n) {
2277
2277
  return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
2278
2278
  }
2279
2279
  const Lr = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
2280
- S.init(e, t), C(e._zod, "propValues", () => t.innerType._zod.propValues), C(e._zod, "values", () => t.innerType._zod.values), C(e._zod, "optin", () => t.innerType?._zod?.optin), C(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (n, o) => {
2280
+ A.init(e, t), C(e._zod, "propValues", () => t.innerType._zod.propValues), C(e._zod, "values", () => t.innerType._zod.values), C(e._zod, "optin", () => t.innerType?._zod?.optin), C(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (n, o) => {
2281
2281
  if (o.direction === "backward")
2282
2282
  return t.innerType._zod.run(n, o);
2283
2283
  const i = t.innerType._zod.run(n, o);
@@ -2288,7 +2288,7 @@ function ot(e) {
2288
2288
  return e.value = Object.freeze(e.value), e;
2289
2289
  }
2290
2290
  const Rr = /* @__PURE__ */ m("$ZodCustom", (e, t) => {
2291
- $.init(e, t), S.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
2291
+ $.init(e, t), A.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
2292
2292
  const o = n.value, i = t.fn(o);
2293
2293
  if (i instanceof Promise)
2294
2294
  return i.then((a) => rt(a, n, o, e));
@@ -2747,10 +2747,10 @@ function Ei() {
2747
2747
  function Ci() {
2748
2748
  return ee((e) => e.toLowerCase());
2749
2749
  }
2750
- function Si() {
2750
+ function Ai() {
2751
2751
  return ee((e) => e.toUpperCase());
2752
2752
  }
2753
- function Ai() {
2753
+ function Si() {
2754
2754
  return ee((e) => Pn(e));
2755
2755
  }
2756
2756
  function Ti(e, t, n) {
@@ -2844,7 +2844,7 @@ const Di = (e, t) => {
2844
2844
  });
2845
2845
  }, Z = /* @__PURE__ */ m("ZodError", Di, {
2846
2846
  Parent: Error
2847
- }), Ui = /* @__PURE__ */ Le(Z), Mi = /* @__PURE__ */ Re(Z), Fi = /* @__PURE__ */ _e(Z), Vi = /* @__PURE__ */ me(Z), Bi = /* @__PURE__ */ Kn(Z), Gi = /* @__PURE__ */ Hn(Z), Wi = /* @__PURE__ */ Jn(Z), qi = /* @__PURE__ */ Qn(Z), Ki = /* @__PURE__ */ Yn(Z), Hi = /* @__PURE__ */ Xn(Z), Ji = /* @__PURE__ */ eo(Z), Qi = /* @__PURE__ */ to(Z), I = /* @__PURE__ */ m("ZodType", (e, t) => (S.init(e, t), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(B(t, {
2847
+ }), Ui = /* @__PURE__ */ Le(Z), Mi = /* @__PURE__ */ Re(Z), Fi = /* @__PURE__ */ _e(Z), Vi = /* @__PURE__ */ me(Z), Bi = /* @__PURE__ */ Kn(Z), Gi = /* @__PURE__ */ Hn(Z), Wi = /* @__PURE__ */ Jn(Z), qi = /* @__PURE__ */ Qn(Z), Ki = /* @__PURE__ */ Yn(Z), Hi = /* @__PURE__ */ Xn(Z), Ji = /* @__PURE__ */ eo(Z), Qi = /* @__PURE__ */ to(Z), I = /* @__PURE__ */ m("ZodType", (e, t) => (A.init(e, t), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(B(t, {
2848
2848
  checks: [
2849
2849
  ...t.checks ?? [],
2850
2850
  ...n.map((o) => typeof o == "function" ? { _zod: { check: o, def: { check: "custom" }, onattach: [] } } : o)
@@ -2865,7 +2865,7 @@ const Di = (e, t) => {
2865
2865
  }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Gt = /* @__PURE__ */ m("_ZodString", (e, t) => {
2866
2866
  je.init(e, t), I.init(e, t);
2867
2867
  const n = e._zod.bag;
2868
- e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(mi(...o)), e.includes = (...o) => e.check(yi(...o)), e.startsWith = (...o) => e.check(bi(...o)), e.endsWith = (...o) => e.check(wi(...o)), e.min = (...o) => e.check(he(...o)), e.max = (...o) => e.check(Vt(...o)), e.length = (...o) => e.check(Bt(...o)), e.nonempty = (...o) => e.check(he(1, ...o)), e.lowercase = (o) => e.check(vi(o)), e.uppercase = (o) => e.check(gi(o)), e.trim = () => e.check(Ei()), e.normalize = (...o) => e.check(ki(...o)), e.toLowerCase = () => e.check(Ci()), e.toUpperCase = () => e.check(Si()), e.slugify = () => e.check(Ai());
2868
+ e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(mi(...o)), e.includes = (...o) => e.check(yi(...o)), e.startsWith = (...o) => e.check(bi(...o)), e.endsWith = (...o) => e.check(wi(...o)), e.min = (...o) => e.check(he(...o)), e.max = (...o) => e.check(Vt(...o)), e.length = (...o) => e.check(Bt(...o)), e.nonempty = (...o) => e.check(he(1, ...o)), e.lowercase = (o) => e.check(vi(o)), e.uppercase = (o) => e.check(gi(o)), e.trim = () => e.check(Ei()), e.normalize = (...o) => e.check(ki(...o)), e.toLowerCase = () => e.check(Ci()), e.toUpperCase = () => e.check(Ai()), e.slugify = () => e.check(Si());
2869
2869
  }), Yi = /* @__PURE__ */ m("ZodString", (e, t) => {
2870
2870
  je.init(e, t), Gt.init(e, t), e.email = (n) => e.check(Ur(Xi, n)), e.url = (n) => e.check(Gr(es, n)), e.jwt = (n) => e.check(si(_s, n)), e.emoji = (n) => e.check(Wr(ts, n)), e.guid = (n) => e.check(st(lt, n)), e.uuid = (n) => e.check(Mr(le, n)), e.uuidv4 = (n) => e.check(Fr(le, n)), e.uuidv6 = (n) => e.check(Vr(le, n)), e.uuidv7 = (n) => e.check(Br(le, n)), e.nanoid = (n) => e.check(qr(ns, n)), e.guid = (n) => e.check(st(lt, n)), e.cuid = (n) => e.check(Kr(os, n)), e.cuid2 = (n) => e.check(Hr(rs, n)), e.ulid = (n) => e.check(Jr(is, n)), e.base64 = (n) => e.check(oi(ps, n)), e.base64url = (n) => e.check(ri(fs, n)), e.xid = (n) => e.check(Qr(ss, n)), e.ksuid = (n) => e.check(Yr(as, n)), e.ipv4 = (n) => e.check(Xr(us, n)), e.ipv6 = (n) => e.check(ei(cs, n)), e.cidrv4 = (n) => e.check(ti(ls, n)), e.cidrv6 = (n) => e.check(ni(ds, n)), e.e164 = (n) => e.check(ii(hs, n)), e.datetime = (n) => e.check(Pi(n)), e.date = (n) => e.check(xi(n)), e.time = (n) => e.check(Ri(n)), e.duration = (n) => e.check(Ni(n));
2871
2871
  });
@@ -2961,21 +2961,21 @@ function T(e, t) {
2961
2961
  };
2962
2962
  return new Cs(n);
2963
2963
  }
2964
- const Ss = /* @__PURE__ */ m("ZodUnion", (e, t) => {
2964
+ const As = /* @__PURE__ */ m("ZodUnion", (e, t) => {
2965
2965
  wr.init(e, t), I.init(e, t), e.options = t.options;
2966
2966
  });
2967
2967
  function G(e, t) {
2968
- return new Ss({
2968
+ return new As({
2969
2969
  type: "union",
2970
2970
  options: e,
2971
2971
  ...b(t)
2972
2972
  });
2973
2973
  }
2974
- const As = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
2974
+ const Ss = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
2975
2975
  kr.init(e, t), I.init(e, t);
2976
2976
  });
2977
2977
  function Ts(e, t) {
2978
- return new As({
2978
+ return new Ss({
2979
2979
  type: "intersection",
2980
2980
  left: e,
2981
2981
  right: t
@@ -2988,7 +2988,7 @@ const zs = /* @__PURE__ */ m("ZodTuple", (e, t) => {
2988
2988
  });
2989
2989
  });
2990
2990
  function L(e, t, n) {
2991
- const o = t instanceof S, i = o ? n : t, a = o ? t : null;
2991
+ const o = t instanceof A, i = o ? n : t, a = o ? t : null;
2992
2992
  return new zs({
2993
2993
  type: "tuple",
2994
2994
  items: e,
@@ -3008,15 +3008,15 @@ function Os(e, t, n) {
3008
3008
  });
3009
3009
  }
3010
3010
  const Ie = /* @__PURE__ */ m("ZodEnum", (e, t) => {
3011
- Sr.init(e, t), I.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
3011
+ Ar.init(e, t), I.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
3012
3012
  const n = new Set(Object.keys(t.entries));
3013
3013
  e.extract = (o, i) => {
3014
3014
  const a = {};
3015
- for (const c of o)
3016
- if (n.has(c))
3017
- a[c] = t.entries[c];
3015
+ for (const u of o)
3016
+ if (n.has(u))
3017
+ a[u] = t.entries[u];
3018
3018
  else
3019
- throw new Error(`Key ${c} not found in enum`);
3019
+ throw new Error(`Key ${u} not found in enum`);
3020
3020
  return new Ie({
3021
3021
  ...t,
3022
3022
  checks: [],
@@ -3025,11 +3025,11 @@ const Ie = /* @__PURE__ */ m("ZodEnum", (e, t) => {
3025
3025
  });
3026
3026
  }, e.exclude = (o, i) => {
3027
3027
  const a = { ...t.entries };
3028
- for (const c of o)
3029
- if (n.has(c))
3030
- delete a[c];
3028
+ for (const u of o)
3029
+ if (n.has(u))
3030
+ delete a[u];
3031
3031
  else
3032
- throw new Error(`Key ${c} not found in enum`);
3032
+ throw new Error(`Key ${u} not found in enum`);
3033
3033
  return new Ie({
3034
3034
  ...t,
3035
3035
  checks: [],
@@ -3047,7 +3047,7 @@ function $s(e, t) {
3047
3047
  });
3048
3048
  }
3049
3049
  const Ps = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
3050
- Ar.init(e, t), I.init(e, t), e.values = new Set(t.values), Object.defineProperty(e, "value", {
3050
+ Sr.init(e, t), I.init(e, t), e.values = new Set(t.values), Object.defineProperty(e, "value", {
3051
3051
  get() {
3052
3052
  if (t.values.length > 1)
3053
3053
  throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
@@ -3065,13 +3065,13 @@ function R(e, t) {
3065
3065
  const Zs = /* @__PURE__ */ m("ZodTransform", (e, t) => {
3066
3066
  Tr.init(e, t), I.init(e, t), e._zod.parse = (n, o) => {
3067
3067
  if (o.direction === "backward")
3068
- throw new At(e.constructor.name);
3068
+ throw new St(e.constructor.name);
3069
3069
  n.addIssue = (a) => {
3070
3070
  if (typeof a == "string")
3071
3071
  n.issues.push(re(a, n.value, t));
3072
3072
  else {
3073
- const c = a;
3074
- c.fatal && (c.continue = !1), c.code ?? (c.code = "custom"), c.input ?? (c.input = n.value), c.inst ?? (c.inst = e), n.issues.push(re(c));
3073
+ const u = a;
3074
+ u.fatal && (u.continue = !1), u.code ?? (u.code = "custom"), u.input ?? (u.input = n.value), u.inst ?? (u.inst = e), n.issues.push(re(u));
3075
3075
  }
3076
3076
  };
3077
3077
  const i = t.transform(n.value, n);
@@ -3300,8 +3300,8 @@ function ua() {
3300
3300
  if (r = parseFloat(r), s.ctx || g(), r !== void 0 && r >= 0 && r <= 1) {
3301
3301
  if (s._volume = r, s._muted) return s;
3302
3302
  s.usingWebAudio && s.masterGain.gain.setValueAtTime(r, o.ctx.currentTime);
3303
- for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var d = s._howls[u]._getSoundIds(), f = 0; f < d.length; f++) {
3304
- var v = s._howls[u]._soundById(d[f]);
3303
+ for (var c = 0; c < s._howls.length; c++) if (!s._howls[c]._webAudio) for (var d = s._howls[c]._getSoundIds(), f = 0; f < d.length; f++) {
3304
+ var v = s._howls[c]._soundById(d[f]);
3305
3305
  v && v._node && (v._node.volume = v._volume * r);
3306
3306
  }
3307
3307
  return s;
@@ -3310,8 +3310,8 @@ function ua() {
3310
3310
  }, mute: function(r) {
3311
3311
  var s = this || o;
3312
3312
  s.ctx || g(), s._muted = r, s.usingWebAudio && s.masterGain.gain.setValueAtTime(r ? 0 : s._volume, o.ctx.currentTime);
3313
- for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var d = s._howls[u]._getSoundIds(), f = 0; f < d.length; f++) {
3314
- var v = s._howls[u]._soundById(d[f]);
3313
+ for (var c = 0; c < s._howls.length; c++) if (!s._howls[c]._webAudio) for (var d = s._howls[c]._getSoundIds(), f = 0; f < d.length; f++) {
3314
+ var v = s._howls[c]._soundById(d[f]);
3315
3315
  v && v._node && (v._node.muted = !!r || v._muted);
3316
3316
  }
3317
3317
  return s;
@@ -3346,13 +3346,13 @@ function ua() {
3346
3346
  return r;
3347
3347
  }
3348
3348
  if (!s || typeof s.canPlayType != "function") return r;
3349
- var u = s.canPlayType("audio/mpeg;").replace(/^no$/, ""), d = r._navigator && r._navigator.userAgent.match(/OPR\/([0-6].)/g), f = d && parseInt(d[0].split("/")[1], 10) < 33;
3350
- return r._codecs = { mp3: !(f || !u && !s.canPlayType("audio/mp3;").replace(/^no$/, "")), mpeg: !!u, opus: !!s.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""), ogg: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), oga: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), wav: !!(s.canPlayType('audio/wav; codecs="1"') || s.canPlayType("audio/wav")).replace(/^no$/, ""), aac: !!s.canPlayType("audio/aac;").replace(/^no$/, ""), caf: !!s.canPlayType("audio/x-caf;").replace(/^no$/, ""), m4a: !!(s.canPlayType("audio/x-m4a;") || s.canPlayType("audio/m4a;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), m4b: !!(s.canPlayType("audio/x-m4b;") || s.canPlayType("audio/m4b;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), mp4: !!(s.canPlayType("audio/x-mp4;") || s.canPlayType("audio/mp4;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), weba: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), webm: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), dolby: !!s.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""), flac: !!(s.canPlayType("audio/x-flac;") || s.canPlayType("audio/flac;")).replace(/^no$/, "") }, r;
3349
+ var c = s.canPlayType("audio/mpeg;").replace(/^no$/, ""), d = r._navigator && r._navigator.userAgent.match(/OPR\/([0-6].)/g), f = d && parseInt(d[0].split("/")[1], 10) < 33;
3350
+ return r._codecs = { mp3: !(f || !c && !s.canPlayType("audio/mp3;").replace(/^no$/, "")), mpeg: !!c, opus: !!s.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""), ogg: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), oga: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), wav: !!(s.canPlayType('audio/wav; codecs="1"') || s.canPlayType("audio/wav")).replace(/^no$/, ""), aac: !!s.canPlayType("audio/aac;").replace(/^no$/, ""), caf: !!s.canPlayType("audio/x-caf;").replace(/^no$/, ""), m4a: !!(s.canPlayType("audio/x-m4a;") || s.canPlayType("audio/m4a;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), m4b: !!(s.canPlayType("audio/x-m4b;") || s.canPlayType("audio/m4b;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), mp4: !!(s.canPlayType("audio/x-mp4;") || s.canPlayType("audio/mp4;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), weba: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), webm: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), dolby: !!s.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""), flac: !!(s.canPlayType("audio/x-flac;") || s.canPlayType("audio/flac;")).replace(/^no$/, "") }, r;
3351
3351
  }, _unlockAudio: function() {
3352
3352
  var r = this || o;
3353
3353
  if (!r._audioUnlocked && r.ctx) {
3354
3354
  r._audioUnlocked = !1, r.autoUnlock = !1, r._mobileUnloaded || r.ctx.sampleRate === 44100 || (r._mobileUnloaded = !0, r.unload()), r._scratchBuffer = r.ctx.createBuffer(1, 1, 22050);
3355
- var s = function(u) {
3355
+ var s = function(c) {
3356
3356
  for (; r._html5AudioPool.length < r.html5PoolSize; ) try {
3357
3357
  var d = new Audio();
3358
3358
  d._unlocked = !0, r._releaseHtml5Audio(d);
@@ -3387,7 +3387,7 @@ function ua() {
3387
3387
  var r = this;
3388
3388
  if (r.autoSuspend && r.ctx && r.ctx.suspend !== void 0 && o.usingWebAudio) {
3389
3389
  for (var s = 0; s < r._howls.length; s++) if (r._howls[s]._webAudio) {
3390
- for (var u = 0; u < r._howls[s]._sounds.length; u++) if (!r._howls[s]._sounds[u]._paused) return r;
3390
+ for (var c = 0; c < r._howls[s]._sounds.length; c++) if (!r._howls[s]._sounds[c]._paused) return r;
3391
3391
  }
3392
3392
  return r._suspendTimer && clearTimeout(r._suspendTimer), r._suspendTimer = setTimeout(function() {
3393
3393
  if (r.autoSuspend) {
@@ -3420,85 +3420,85 @@ function ua() {
3420
3420
  var r = this, s = null;
3421
3421
  if (o.noAudio) return void r._emit("loaderror", null, "No audio support.");
3422
3422
  typeof r._src == "string" && (r._src = [r._src]);
3423
- for (var u = 0; u < r._src.length; u++) {
3423
+ for (var c = 0; c < r._src.length; c++) {
3424
3424
  var d, f;
3425
- if (r._format && r._format[u]) d = r._format[u];
3425
+ if (r._format && r._format[c]) d = r._format[c];
3426
3426
  else {
3427
- if (typeof (f = r._src[u]) != "string") {
3427
+ if (typeof (f = r._src[c]) != "string") {
3428
3428
  r._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
3429
3429
  continue;
3430
3430
  }
3431
3431
  d = /^data:audio\/([^;,]+);/i.exec(f), d || (d = /\.([^.]+)$/.exec(f.split("?", 1)[0])), d && (d = d[1].toLowerCase());
3432
3432
  }
3433
3433
  if (d || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), d && o.codecs(d)) {
3434
- s = r._src[u];
3434
+ s = r._src[c];
3435
3435
  break;
3436
3436
  }
3437
3437
  }
3438
3438
  return s ? (r._src = s, r._state = "loading", window.location.protocol === "https:" && s.slice(0, 5) === "http:" && (r._html5 = !0, r._webAudio = !1), new a(r), r._webAudio && l(r), r) : void r._emit("loaderror", null, "No codec support for selected audio sources.");
3439
3439
  }, play: function(r, s) {
3440
- var u = this, d = null;
3440
+ var c = this, d = null;
3441
3441
  if (typeof r == "number") d = r, r = null;
3442
3442
  else {
3443
- if (typeof r == "string" && u._state === "loaded" && !u._sprite[r]) return null;
3444
- if (r === void 0 && (r = "__default", !u._playLock)) {
3445
- for (var f = 0, v = 0; v < u._sounds.length; v++) u._sounds[v]._paused && !u._sounds[v]._ended && (f++, d = u._sounds[v]._id);
3443
+ if (typeof r == "string" && c._state === "loaded" && !c._sprite[r]) return null;
3444
+ if (r === void 0 && (r = "__default", !c._playLock)) {
3445
+ for (var f = 0, v = 0; v < c._sounds.length; v++) c._sounds[v]._paused && !c._sounds[v]._ended && (f++, d = c._sounds[v]._id);
3446
3446
  f === 1 ? r = null : d = null;
3447
3447
  }
3448
3448
  }
3449
- var _ = d ? u._soundById(d) : u._inactiveSound();
3449
+ var _ = d ? c._soundById(d) : c._inactiveSound();
3450
3450
  if (!_) return null;
3451
- if (d && !r && (r = _._sprite || "__default"), u._state !== "loaded") {
3451
+ if (d && !r && (r = _._sprite || "__default"), c._state !== "loaded") {
3452
3452
  _._sprite = r, _._ended = !1;
3453
3453
  var w = _._id;
3454
- return u._queue.push({ event: "play", action: function() {
3455
- u.play(w);
3454
+ return c._queue.push({ event: "play", action: function() {
3455
+ c.play(w);
3456
3456
  } }), w;
3457
3457
  }
3458
- if (d && !_._paused) return s || u._loadQueue("play"), _._id;
3459
- u._webAudio && o._autoResume();
3460
- var k = Math.max(0, _._seek > 0 ? _._seek : u._sprite[r][0] / 1e3), E = Math.max(0, (u._sprite[r][0] + u._sprite[r][1]) / 1e3 - k), x = 1e3 * E / Math.abs(_._rate), U = u._sprite[r][0] / 1e3, ie = (u._sprite[r][0] + u._sprite[r][1]) / 1e3;
3458
+ if (d && !_._paused) return s || c._loadQueue("play"), _._id;
3459
+ c._webAudio && o._autoResume();
3460
+ var k = Math.max(0, _._seek > 0 ? _._seek : c._sprite[r][0] / 1e3), E = Math.max(0, (c._sprite[r][0] + c._sprite[r][1]) / 1e3 - k), x = 1e3 * E / Math.abs(_._rate), U = c._sprite[r][0] / 1e3, ie = (c._sprite[r][0] + c._sprite[r][1]) / 1e3;
3461
3461
  _._sprite = r, _._ended = !1;
3462
3462
  var ye = function() {
3463
- _._paused = !1, _._seek = k, _._start = U, _._stop = ie, _._loop = !(!_._loop && !u._sprite[r][2]);
3463
+ _._paused = !1, _._seek = k, _._start = U, _._stop = ie, _._loop = !(!_._loop && !c._sprite[r][2]);
3464
3464
  };
3465
- if (k >= ie) return void u._ended(_);
3466
- var A = _._node;
3467
- if (u._webAudio) {
3465
+ if (k >= ie) return void c._ended(_);
3466
+ var S = _._node;
3467
+ if (c._webAudio) {
3468
3468
  var Ve = function() {
3469
- u._playLock = !1, ye(), u._refreshBuffer(_);
3470
- var W = _._muted || u._muted ? 0 : _._volume;
3471
- A.gain.setValueAtTime(W, o.ctx.currentTime), _._playStart = o.ctx.currentTime, A.bufferSource.start === void 0 ? _._loop ? A.bufferSource.noteGrainOn(0, k, 86400) : A.bufferSource.noteGrainOn(0, k, E) : _._loop ? A.bufferSource.start(0, k, 86400) : A.bufferSource.start(0, k, E), x !== 1 / 0 && (u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x)), s || setTimeout(function() {
3472
- u._emit("play", _._id), u._loadQueue();
3469
+ c._playLock = !1, ye(), c._refreshBuffer(_);
3470
+ var W = _._muted || c._muted ? 0 : _._volume;
3471
+ S.gain.setValueAtTime(W, o.ctx.currentTime), _._playStart = o.ctx.currentTime, S.bufferSource.start === void 0 ? _._loop ? S.bufferSource.noteGrainOn(0, k, 86400) : S.bufferSource.noteGrainOn(0, k, E) : _._loop ? S.bufferSource.start(0, k, 86400) : S.bufferSource.start(0, k, E), x !== 1 / 0 && (c._endTimers[_._id] = setTimeout(c._ended.bind(c, _), x)), s || setTimeout(function() {
3472
+ c._emit("play", _._id), c._loadQueue();
3473
3473
  }, 0);
3474
3474
  };
3475
- o.state === "running" && o.ctx.state !== "interrupted" ? Ve() : (u._playLock = !0, u.once("resume", Ve), u._clearTimer(_._id));
3475
+ o.state === "running" && o.ctx.state !== "interrupted" ? Ve() : (c._playLock = !0, c.once("resume", Ve), c._clearTimer(_._id));
3476
3476
  } else {
3477
3477
  var Be = function() {
3478
- A.currentTime = k, A.muted = _._muted || u._muted || o._muted || A.muted, A.volume = _._volume * o.volume(), A.playbackRate = _._rate;
3478
+ S.currentTime = k, S.muted = _._muted || c._muted || o._muted || S.muted, S.volume = _._volume * o.volume(), S.playbackRate = _._rate;
3479
3479
  try {
3480
- var W = A.play();
3481
- if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (u._playLock = !0, ye(), W.then(function() {
3482
- u._playLock = !1, A._unlocked = !0, s || (u._emit("play", _._id), u._loadQueue());
3480
+ var W = S.play();
3481
+ if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (c._playLock = !0, ye(), W.then(function() {
3482
+ c._playLock = !1, S._unlocked = !0, s || (c._emit("play", _._id), c._loadQueue());
3483
3483
  }).catch(function() {
3484
- u._playLock = !1, u._emit("playerror", _._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."), _._ended = !0, _._paused = !0;
3485
- })) : s || (u._playLock = !1, ye(), u._emit("play", _._id), u._loadQueue()), A.playbackRate = _._rate, A.paused) return void u._emit("playerror", _._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
3486
- r !== "__default" || _._loop ? u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x) : (u._endTimers[_._id] = function() {
3487
- u._ended(_), A.removeEventListener("ended", u._endTimers[_._id], !1);
3488
- }, A.addEventListener("ended", u._endTimers[_._id], !1));
3484
+ c._playLock = !1, c._emit("playerror", _._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."), _._ended = !0, _._paused = !0;
3485
+ })) : s || (c._playLock = !1, ye(), c._emit("play", _._id), c._loadQueue()), S.playbackRate = _._rate, S.paused) return void c._emit("playerror", _._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
3486
+ r !== "__default" || _._loop ? c._endTimers[_._id] = setTimeout(c._ended.bind(c, _), x) : (c._endTimers[_._id] = function() {
3487
+ c._ended(_), S.removeEventListener("ended", c._endTimers[_._id], !1);
3488
+ }, S.addEventListener("ended", c._endTimers[_._id], !1));
3489
3489
  } catch (nn) {
3490
- u._emit("playerror", _._id, nn);
3490
+ c._emit("playerror", _._id, nn);
3491
3491
  }
3492
3492
  };
3493
- A.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (A.src = u._src, A.load());
3494
- var tn = window && window.ejecta || !A.readyState && o._navigator.isCocoonJS;
3495
- if (A.readyState >= 3 || tn) Be();
3493
+ S.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (S.src = c._src, S.load());
3494
+ var tn = window && window.ejecta || !S.readyState && o._navigator.isCocoonJS;
3495
+ if (S.readyState >= 3 || tn) Be();
3496
3496
  else {
3497
- u._playLock = !0;
3497
+ c._playLock = !0;
3498
3498
  var Ge = function() {
3499
- Be(), A.removeEventListener(o._canPlayEvent, Ge, !1);
3499
+ Be(), S.removeEventListener(o._canPlayEvent, Ge, !1);
3500
3500
  };
3501
- A.addEventListener(o._canPlayEvent, Ge, !1), u._clearTimer(_._id);
3501
+ S.addEventListener(o._canPlayEvent, Ge, !1), c._clearTimer(_._id);
3502
3502
  }
3503
3503
  }
3504
3504
  return _._id;
@@ -3507,10 +3507,10 @@ function ua() {
3507
3507
  if (s._state !== "loaded" || s._playLock) return s._queue.push({ event: "pause", action: function() {
3508
3508
  s.pause(r);
3509
3509
  } }), s;
3510
- for (var u = s._getSoundIds(r), d = 0; d < u.length; d++) {
3511
- s._clearTimer(u[d]);
3512
- var f = s._soundById(u[d]);
3513
- if (f && !f._paused && (f._seek = s.seek(u[d]), f._rateSeek = 0, f._paused = !0, s._stopFade(u[d]), f._node)) if (s._webAudio) {
3510
+ for (var c = s._getSoundIds(r), d = 0; d < c.length; d++) {
3511
+ s._clearTimer(c[d]);
3512
+ var f = s._soundById(c[d]);
3513
+ if (f && !f._paused && (f._seek = s.seek(c[d]), f._rateSeek = 0, f._paused = !0, s._stopFade(c[d]), f._node)) if (s._webAudio) {
3514
3514
  if (!f._node.bufferSource) continue;
3515
3515
  f._node.bufferSource.stop === void 0 ? f._node.bufferSource.noteOff(0) : f._node.bufferSource.stop(0), s._cleanBuffer(f._node);
3516
3516
  } else isNaN(f._node.duration) && f._node.duration !== 1 / 0 || f._node.pause();
@@ -3518,159 +3518,159 @@ function ua() {
3518
3518
  }
3519
3519
  return s;
3520
3520
  }, stop: function(r, s) {
3521
- var u = this;
3522
- if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "stop", action: function() {
3523
- u.stop(r, s);
3524
- } }), u;
3525
- for (var d = u._getSoundIds(r), f = 0; f < d.length; f++) {
3526
- u._clearTimer(d[f]);
3527
- var v = u._soundById(d[f]);
3528
- v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, u._stopFade(d[f]), v._node && (u._webAudio ? v._node.bufferSource && (v._node.bufferSource.stop === void 0 ? v._node.bufferSource.noteOff(0) : v._node.bufferSource.stop(0), u._cleanBuffer(v._node)) : isNaN(v._node.duration) && v._node.duration !== 1 / 0 || (v._node.currentTime = v._start || 0, v._node.pause(), v._node.duration === 1 / 0 && u._clearSound(v._node))), s || u._emit("stop", v._id));
3521
+ var c = this;
3522
+ if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "stop", action: function() {
3523
+ c.stop(r, s);
3524
+ } }), c;
3525
+ for (var d = c._getSoundIds(r), f = 0; f < d.length; f++) {
3526
+ c._clearTimer(d[f]);
3527
+ var v = c._soundById(d[f]);
3528
+ v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, c._stopFade(d[f]), v._node && (c._webAudio ? v._node.bufferSource && (v._node.bufferSource.stop === void 0 ? v._node.bufferSource.noteOff(0) : v._node.bufferSource.stop(0), c._cleanBuffer(v._node)) : isNaN(v._node.duration) && v._node.duration !== 1 / 0 || (v._node.currentTime = v._start || 0, v._node.pause(), v._node.duration === 1 / 0 && c._clearSound(v._node))), s || c._emit("stop", v._id));
3529
3529
  }
3530
- return u;
3530
+ return c;
3531
3531
  }, mute: function(r, s) {
3532
- var u = this;
3533
- if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "mute", action: function() {
3534
- u.mute(r, s);
3535
- } }), u;
3532
+ var c = this;
3533
+ if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "mute", action: function() {
3534
+ c.mute(r, s);
3535
+ } }), c;
3536
3536
  if (s === void 0) {
3537
- if (typeof r != "boolean") return u._muted;
3538
- u._muted = r;
3537
+ if (typeof r != "boolean") return c._muted;
3538
+ c._muted = r;
3539
3539
  }
3540
- for (var d = u._getSoundIds(s), f = 0; f < d.length; f++) {
3541
- var v = u._soundById(d[f]);
3542
- v && (v._muted = r, v._interval && u._stopFade(v._id), u._webAudio && v._node ? v._node.gain.setValueAtTime(r ? 0 : v._volume, o.ctx.currentTime) : v._node && (v._node.muted = !!o._muted || r), u._emit("mute", v._id));
3540
+ for (var d = c._getSoundIds(s), f = 0; f < d.length; f++) {
3541
+ var v = c._soundById(d[f]);
3542
+ v && (v._muted = r, v._interval && c._stopFade(v._id), c._webAudio && v._node ? v._node.gain.setValueAtTime(r ? 0 : v._volume, o.ctx.currentTime) : v._node && (v._node.muted = !!o._muted || r), c._emit("mute", v._id));
3543
3543
  }
3544
- return u;
3544
+ return c;
3545
3545
  }, volume: function() {
3546
- var r, s, u = this, d = arguments;
3547
- if (d.length === 0) return u._volume;
3548
- d.length === 1 || d.length === 2 && d[1] === void 0 ? u._getSoundIds().indexOf(d[0]) >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]) : d.length >= 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
3546
+ var r, s, c = this, d = arguments;
3547
+ if (d.length === 0) return c._volume;
3548
+ d.length === 1 || d.length === 2 && d[1] === void 0 ? c._getSoundIds().indexOf(d[0]) >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]) : d.length >= 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
3549
3549
  var f;
3550
- if (!(r !== void 0 && r >= 0 && r <= 1)) return f = s ? u._soundById(s) : u._sounds[0], f ? f._volume : 0;
3551
- if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "volume", action: function() {
3552
- u.volume.apply(u, d);
3553
- } }), u;
3554
- s === void 0 && (u._volume = r), s = u._getSoundIds(s);
3555
- for (var v = 0; v < s.length; v++) (f = u._soundById(s[v])) && (f._volume = r, d[2] || u._stopFade(s[v]), u._webAudio && f._node && !f._muted ? f._node.gain.setValueAtTime(r, o.ctx.currentTime) : f._node && !f._muted && (f._node.volume = r * o.volume()), u._emit("volume", f._id));
3556
- return u;
3557
- }, fade: function(r, s, u, d) {
3550
+ if (!(r !== void 0 && r >= 0 && r <= 1)) return f = s ? c._soundById(s) : c._sounds[0], f ? f._volume : 0;
3551
+ if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "volume", action: function() {
3552
+ c.volume.apply(c, d);
3553
+ } }), c;
3554
+ s === void 0 && (c._volume = r), s = c._getSoundIds(s);
3555
+ for (var v = 0; v < s.length; v++) (f = c._soundById(s[v])) && (f._volume = r, d[2] || c._stopFade(s[v]), c._webAudio && f._node && !f._muted ? f._node.gain.setValueAtTime(r, o.ctx.currentTime) : f._node && !f._muted && (f._node.volume = r * o.volume()), c._emit("volume", f._id));
3556
+ return c;
3557
+ }, fade: function(r, s, c, d) {
3558
3558
  var f = this;
3559
3559
  if (f._state !== "loaded" || f._playLock) return f._queue.push({ event: "fade", action: function() {
3560
- f.fade(r, s, u, d);
3560
+ f.fade(r, s, c, d);
3561
3561
  } }), f;
3562
- r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), u = parseFloat(u), f.volume(r, d);
3562
+ r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), c = parseFloat(c), f.volume(r, d);
3563
3563
  for (var v = f._getSoundIds(d), _ = 0; _ < v.length; _++) {
3564
3564
  var w = f._soundById(v[_]);
3565
3565
  if (w) {
3566
3566
  if (d || f._stopFade(v[_]), f._webAudio && !w._muted) {
3567
- var k = o.ctx.currentTime, E = k + u / 1e3;
3567
+ var k = o.ctx.currentTime, E = k + c / 1e3;
3568
3568
  w._volume = r, w._node.gain.setValueAtTime(r, k), w._node.gain.linearRampToValueAtTime(s, E);
3569
3569
  }
3570
- f._startFadeInterval(w, r, s, u, v[_], d === void 0);
3570
+ f._startFadeInterval(w, r, s, c, v[_], d === void 0);
3571
3571
  }
3572
3572
  }
3573
3573
  return f;
3574
- }, _startFadeInterval: function(r, s, u, d, f, v) {
3575
- var _ = this, w = s, k = u - s, E = Math.abs(k / 0.01), x = Math.max(4, E > 0 ? d / E : d), U = Date.now();
3576
- r._fadeTo = u, r._interval = setInterval(function() {
3574
+ }, _startFadeInterval: function(r, s, c, d, f, v) {
3575
+ var _ = this, w = s, k = c - s, E = Math.abs(k / 0.01), x = Math.max(4, E > 0 ? d / E : d), U = Date.now();
3576
+ r._fadeTo = c, r._interval = setInterval(function() {
3577
3577
  var ie = (Date.now() - U) / d;
3578
- U = Date.now(), w += k * ie, w = Math.round(100 * w) / 100, w = k < 0 ? Math.max(u, w) : Math.min(u, w), _._webAudio ? r._volume = w : _.volume(w, r._id, !0), v && (_._volume = w), (u < s && w <= u || u > s && w >= u) && (clearInterval(r._interval), r._interval = null, r._fadeTo = null, _.volume(u, r._id), _._emit("fade", r._id));
3578
+ U = Date.now(), w += k * ie, w = Math.round(100 * w) / 100, w = k < 0 ? Math.max(c, w) : Math.min(c, w), _._webAudio ? r._volume = w : _.volume(w, r._id, !0), v && (_._volume = w), (c < s && w <= c || c > s && w >= c) && (clearInterval(r._interval), r._interval = null, r._fadeTo = null, _.volume(c, r._id), _._emit("fade", r._id));
3579
3579
  }, x);
3580
3580
  }, _stopFade: function(r) {
3581
- var s = this, u = s._soundById(r);
3582
- return u && u._interval && (s._webAudio && u._node.gain.cancelScheduledValues(o.ctx.currentTime), clearInterval(u._interval), u._interval = null, s.volume(u._fadeTo, r), u._fadeTo = null, s._emit("fade", r)), s;
3581
+ var s = this, c = s._soundById(r);
3582
+ return c && c._interval && (s._webAudio && c._node.gain.cancelScheduledValues(o.ctx.currentTime), clearInterval(c._interval), c._interval = null, s.volume(c._fadeTo, r), c._fadeTo = null, s._emit("fade", r)), s;
3583
3583
  }, loop: function() {
3584
- var r, s, u, d = this, f = arguments;
3584
+ var r, s, c, d = this, f = arguments;
3585
3585
  if (f.length === 0) return d._loop;
3586
3586
  if (f.length === 1) {
3587
- if (typeof f[0] != "boolean") return !!(u = d._soundById(parseInt(f[0], 10))) && u._loop;
3587
+ if (typeof f[0] != "boolean") return !!(c = d._soundById(parseInt(f[0], 10))) && c._loop;
3588
3588
  r = f[0], d._loop = r;
3589
3589
  } else f.length === 2 && (r = f[0], s = parseInt(f[1], 10));
3590
- for (var v = d._getSoundIds(s), _ = 0; _ < v.length; _++) (u = d._soundById(v[_])) && (u._loop = r, d._webAudio && u._node && u._node.bufferSource && (u._node.bufferSource.loop = r, r && (u._node.bufferSource.loopStart = u._start || 0, u._node.bufferSource.loopEnd = u._stop)));
3590
+ for (var v = d._getSoundIds(s), _ = 0; _ < v.length; _++) (c = d._soundById(v[_])) && (c._loop = r, d._webAudio && c._node && c._node.bufferSource && (c._node.bufferSource.loop = r, r && (c._node.bufferSource.loopStart = c._start || 0, c._node.bufferSource.loopEnd = c._stop)));
3591
3591
  return d;
3592
3592
  }, rate: function() {
3593
- var r, s, u = this, d = arguments;
3594
- if (d.length === 0) s = u._sounds[0]._id;
3593
+ var r, s, c = this, d = arguments;
3594
+ if (d.length === 0) s = c._sounds[0]._id;
3595
3595
  else if (d.length === 1) {
3596
- var f = u._getSoundIds(), v = f.indexOf(d[0]);
3596
+ var f = c._getSoundIds(), v = f.indexOf(d[0]);
3597
3597
  v >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]);
3598
3598
  } else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
3599
3599
  var _;
3600
- if (typeof r != "number") return _ = u._soundById(s), _ ? _._rate : u._rate;
3601
- if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "rate", action: function() {
3602
- u.rate.apply(u, d);
3603
- } }), u;
3604
- s === void 0 && (u._rate = r), s = u._getSoundIds(s);
3605
- for (var w = 0; w < s.length; w++) if (_ = u._soundById(s[w])) {
3606
- u.playing(s[w]) && (_._rateSeek = u.seek(s[w]), _._playStart = u._webAudio ? o.ctx.currentTime : _._playStart), _._rate = r, u._webAudio && _._node && _._node.bufferSource ? _._node.bufferSource.playbackRate.setValueAtTime(r, o.ctx.currentTime) : _._node && (_._node.playbackRate = r);
3607
- var k = u.seek(s[w]), E = (u._sprite[_._sprite][0] + u._sprite[_._sprite][1]) / 1e3 - k, x = 1e3 * E / Math.abs(_._rate);
3608
- !u._endTimers[s[w]] && _._paused || (u._clearTimer(s[w]), u._endTimers[s[w]] = setTimeout(u._ended.bind(u, _), x)), u._emit("rate", _._id);
3600
+ if (typeof r != "number") return _ = c._soundById(s), _ ? _._rate : c._rate;
3601
+ if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "rate", action: function() {
3602
+ c.rate.apply(c, d);
3603
+ } }), c;
3604
+ s === void 0 && (c._rate = r), s = c._getSoundIds(s);
3605
+ for (var w = 0; w < s.length; w++) if (_ = c._soundById(s[w])) {
3606
+ c.playing(s[w]) && (_._rateSeek = c.seek(s[w]), _._playStart = c._webAudio ? o.ctx.currentTime : _._playStart), _._rate = r, c._webAudio && _._node && _._node.bufferSource ? _._node.bufferSource.playbackRate.setValueAtTime(r, o.ctx.currentTime) : _._node && (_._node.playbackRate = r);
3607
+ var k = c.seek(s[w]), E = (c._sprite[_._sprite][0] + c._sprite[_._sprite][1]) / 1e3 - k, x = 1e3 * E / Math.abs(_._rate);
3608
+ !c._endTimers[s[w]] && _._paused || (c._clearTimer(s[w]), c._endTimers[s[w]] = setTimeout(c._ended.bind(c, _), x)), c._emit("rate", _._id);
3609
3609
  }
3610
- return u;
3610
+ return c;
3611
3611
  }, seek: function() {
3612
- var r, s, u = this, d = arguments;
3613
- if (d.length === 0) s = u._sounds[0]._id;
3612
+ var r, s, c = this, d = arguments;
3613
+ if (d.length === 0) s = c._sounds[0]._id;
3614
3614
  else if (d.length === 1) {
3615
- var f = u._getSoundIds(), v = f.indexOf(d[0]);
3616
- v >= 0 ? s = parseInt(d[0], 10) : u._sounds.length && (s = u._sounds[0]._id, r = parseFloat(d[0]));
3615
+ var f = c._getSoundIds(), v = f.indexOf(d[0]);
3616
+ v >= 0 ? s = parseInt(d[0], 10) : c._sounds.length && (s = c._sounds[0]._id, r = parseFloat(d[0]));
3617
3617
  } else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
3618
- if (s === void 0) return u;
3619
- if (typeof r == "number" && (u._state !== "loaded" || u._playLock)) return u._queue.push({ event: "seek", action: function() {
3620
- u.seek.apply(u, d);
3621
- } }), u;
3622
- var _ = u._soundById(s);
3618
+ if (s === void 0) return c;
3619
+ if (typeof r == "number" && (c._state !== "loaded" || c._playLock)) return c._queue.push({ event: "seek", action: function() {
3620
+ c.seek.apply(c, d);
3621
+ } }), c;
3622
+ var _ = c._soundById(s);
3623
3623
  if (_) {
3624
3624
  if (!(typeof r == "number" && r >= 0)) {
3625
- if (u._webAudio) {
3626
- var w = u.playing(s) ? o.ctx.currentTime - _._playStart : 0, k = _._rateSeek ? _._rateSeek - _._seek : 0;
3625
+ if (c._webAudio) {
3626
+ var w = c.playing(s) ? o.ctx.currentTime - _._playStart : 0, k = _._rateSeek ? _._rateSeek - _._seek : 0;
3627
3627
  return _._seek + (k + w * Math.abs(_._rate));
3628
3628
  }
3629
3629
  return _._node.currentTime;
3630
3630
  }
3631
- var E = u.playing(s);
3632
- E && u.pause(s, !0), _._seek = r, _._ended = !1, u._clearTimer(s), u._webAudio || !_._node || isNaN(_._node.duration) || (_._node.currentTime = r);
3631
+ var E = c.playing(s);
3632
+ E && c.pause(s, !0), _._seek = r, _._ended = !1, c._clearTimer(s), c._webAudio || !_._node || isNaN(_._node.duration) || (_._node.currentTime = r);
3633
3633
  var x = function() {
3634
- u._emit("seek", s), E && u.play(s, !0);
3634
+ c._emit("seek", s), E && c.play(s, !0);
3635
3635
  };
3636
- if (E && !u._webAudio) {
3636
+ if (E && !c._webAudio) {
3637
3637
  var U = function() {
3638
- u._playLock ? setTimeout(U, 0) : x();
3638
+ c._playLock ? setTimeout(U, 0) : x();
3639
3639
  };
3640
3640
  setTimeout(U, 0);
3641
3641
  } else x();
3642
3642
  }
3643
- return u;
3643
+ return c;
3644
3644
  }, playing: function(r) {
3645
3645
  var s = this;
3646
3646
  if (typeof r == "number") {
3647
- var u = s._soundById(r);
3648
- return !!u && !u._paused;
3647
+ var c = s._soundById(r);
3648
+ return !!c && !c._paused;
3649
3649
  }
3650
3650
  for (var d = 0; d < s._sounds.length; d++) if (!s._sounds[d]._paused) return !0;
3651
3651
  return !1;
3652
3652
  }, duration: function(r) {
3653
- var s = this, u = s._duration, d = s._soundById(r);
3654
- return d && (u = s._sprite[d._sprite][1] / 1e3), u;
3653
+ var s = this, c = s._duration, d = s._soundById(r);
3654
+ return d && (c = s._sprite[d._sprite][1] / 1e3), c;
3655
3655
  }, state: function() {
3656
3656
  return this._state;
3657
3657
  }, unload: function() {
3658
- for (var r = this, s = r._sounds, u = 0; u < s.length; u++) s[u]._paused || r.stop(s[u]._id), r._webAudio || (r._clearSound(s[u]._node), s[u]._node.removeEventListener("error", s[u]._errorFn, !1), s[u]._node.removeEventListener(o._canPlayEvent, s[u]._loadFn, !1), s[u]._node.removeEventListener("ended", s[u]._endFn, !1), o._releaseHtml5Audio(s[u]._node)), delete s[u]._node, r._clearTimer(s[u]._id);
3658
+ for (var r = this, s = r._sounds, c = 0; c < s.length; c++) s[c]._paused || r.stop(s[c]._id), r._webAudio || (r._clearSound(s[c]._node), s[c]._node.removeEventListener("error", s[c]._errorFn, !1), s[c]._node.removeEventListener(o._canPlayEvent, s[c]._loadFn, !1), s[c]._node.removeEventListener("ended", s[c]._endFn, !1), o._releaseHtml5Audio(s[c]._node)), delete s[c]._node, r._clearTimer(s[c]._id);
3659
3659
  var d = o._howls.indexOf(r);
3660
3660
  d >= 0 && o._howls.splice(d, 1);
3661
3661
  var f = !0;
3662
- for (u = 0; u < o._howls.length; u++) if (o._howls[u]._src === r._src || r._src.indexOf(o._howls[u]._src) >= 0) {
3662
+ for (c = 0; c < o._howls.length; c++) if (o._howls[c]._src === r._src || r._src.indexOf(o._howls[c]._src) >= 0) {
3663
3663
  f = !1;
3664
3664
  break;
3665
3665
  }
3666
- return c && f && delete c[r._src], o.noAudio = !1, r._state = "unloaded", r._sounds = [], r = null, null;
3667
- }, on: function(r, s, u, d) {
3666
+ return u && f && delete u[r._src], o.noAudio = !1, r._state = "unloaded", r._sounds = [], r = null, null;
3667
+ }, on: function(r, s, c, d) {
3668
3668
  var f = this, v = f["_on" + r];
3669
- return typeof s == "function" && v.push(d ? { id: u, fn: s, once: d } : { id: u, fn: s }), f;
3670
- }, off: function(r, s, u) {
3669
+ return typeof s == "function" && v.push(d ? { id: c, fn: s, once: d } : { id: c, fn: s }), f;
3670
+ }, off: function(r, s, c) {
3671
3671
  var d = this, f = d["_on" + r], v = 0;
3672
- if (typeof s == "number" && (u = s, s = null), s || u) for (v = 0; v < f.length; v++) {
3673
- var _ = u === f[v].id;
3672
+ if (typeof s == "number" && (c = s, s = null), s || c) for (v = 0; v < f.length; v++) {
3673
+ var _ = c === f[v].id;
3674
3674
  if (s === f[v].fn && _ || !s && _) {
3675
3675
  f.splice(v, 1);
3676
3676
  break;
@@ -3682,25 +3682,25 @@ function ua() {
3682
3682
  for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(d[w[v]]) && (d[w[v]] = []);
3683
3683
  }
3684
3684
  return d;
3685
- }, once: function(r, s, u) {
3685
+ }, once: function(r, s, c) {
3686
3686
  var d = this;
3687
- return d.on(r, s, u, 1), d;
3688
- }, _emit: function(r, s, u) {
3687
+ return d.on(r, s, c, 1), d;
3688
+ }, _emit: function(r, s, c) {
3689
3689
  for (var d = this, f = d["_on" + r], v = f.length - 1; v >= 0; v--) f[v].id && f[v].id !== s && r !== "load" || (setTimeout((function(_) {
3690
- _.call(this, s, u);
3690
+ _.call(this, s, c);
3691
3691
  }).bind(d, f[v].fn), 0), f[v].once && d.off(r, f[v].fn, f[v].id));
3692
3692
  return d._loadQueue(r), d;
3693
3693
  }, _loadQueue: function(r) {
3694
3694
  var s = this;
3695
3695
  if (s._queue.length > 0) {
3696
- var u = s._queue[0];
3697
- u.event === r && (s._queue.shift(), s._loadQueue()), r || u.action();
3696
+ var c = s._queue[0];
3697
+ c.event === r && (s._queue.shift(), s._loadQueue()), r || c.action();
3698
3698
  }
3699
3699
  return s;
3700
3700
  }, _ended: function(r) {
3701
- var s = this, u = r._sprite;
3701
+ var s = this, c = r._sprite;
3702
3702
  if (!s._webAudio && r._node && !r._node.paused && !r._node.ended && r._node.currentTime < r._stop) return setTimeout(s._ended.bind(s, r), 100), s;
3703
- var d = !(!r._loop && !s._sprite[u][2]);
3703
+ var d = !(!r._loop && !s._sprite[c][2]);
3704
3704
  if (s._emit("end", r._id), !s._webAudio && d && s.stop(r._id, !0).play(r._id), s._webAudio && d) {
3705
3705
  s._emit("play", r._id), r._seek = r._start || 0, r._rateSeek = 0, r._playStart = o.ctx.currentTime;
3706
3706
  var f = 1e3 * (r._stop - r._start) / Math.abs(r._rate);
@@ -3712,14 +3712,14 @@ function ua() {
3712
3712
  if (s._endTimers[r]) {
3713
3713
  if (typeof s._endTimers[r] != "function") clearTimeout(s._endTimers[r]);
3714
3714
  else {
3715
- var u = s._soundById(r);
3716
- u && u._node && u._node.removeEventListener("ended", s._endTimers[r], !1);
3715
+ var c = s._soundById(r);
3716
+ c && c._node && c._node.removeEventListener("ended", s._endTimers[r], !1);
3717
3717
  }
3718
3718
  delete s._endTimers[r];
3719
3719
  }
3720
3720
  return s;
3721
3721
  }, _soundById: function(r) {
3722
- for (var s = this, u = 0; u < s._sounds.length; u++) if (r === s._sounds[u]._id) return s._sounds[u];
3722
+ for (var s = this, c = 0; c < s._sounds.length; c++) if (r === s._sounds[c]._id) return s._sounds[c];
3723
3723
  return null;
3724
3724
  }, _inactiveSound: function() {
3725
3725
  var r = this;
@@ -3727,27 +3727,27 @@ function ua() {
3727
3727
  for (var s = 0; s < r._sounds.length; s++) if (r._sounds[s]._ended) return r._sounds[s].reset();
3728
3728
  return new a(r);
3729
3729
  }, _drain: function() {
3730
- var r = this, s = r._pool, u = 0, d = 0;
3730
+ var r = this, s = r._pool, c = 0, d = 0;
3731
3731
  if (!(r._sounds.length < s)) {
3732
- for (d = 0; d < r._sounds.length; d++) r._sounds[d]._ended && u++;
3732
+ for (d = 0; d < r._sounds.length; d++) r._sounds[d]._ended && c++;
3733
3733
  for (d = r._sounds.length - 1; d >= 0; d--) {
3734
- if (u <= s) return;
3735
- r._sounds[d]._ended && (r._webAudio && r._sounds[d]._node && r._sounds[d]._node.disconnect(0), r._sounds.splice(d, 1), u--);
3734
+ if (c <= s) return;
3735
+ r._sounds[d]._ended && (r._webAudio && r._sounds[d]._node && r._sounds[d]._node.disconnect(0), r._sounds.splice(d, 1), c--);
3736
3736
  }
3737
3737
  }
3738
3738
  }, _getSoundIds: function(r) {
3739
3739
  var s = this;
3740
3740
  if (r === void 0) {
3741
- for (var u = [], d = 0; d < s._sounds.length; d++) u.push(s._sounds[d]._id);
3742
- return u;
3741
+ for (var c = [], d = 0; d < s._sounds.length; d++) c.push(s._sounds[d]._id);
3742
+ return c;
3743
3743
  }
3744
3744
  return [r];
3745
3745
  }, _refreshBuffer: function(r) {
3746
3746
  var s = this;
3747
- return r._node.bufferSource = o.ctx.createBufferSource(), r._node.bufferSource.buffer = c[s._src], r._panner ? r._node.bufferSource.connect(r._panner) : r._node.bufferSource.connect(r._node), r._node.bufferSource.loop = r._loop, r._loop && (r._node.bufferSource.loopStart = r._start || 0, r._node.bufferSource.loopEnd = r._stop || 0), r._node.bufferSource.playbackRate.setValueAtTime(r._rate, o.ctx.currentTime), s;
3747
+ return r._node.bufferSource = o.ctx.createBufferSource(), r._node.bufferSource.buffer = u[s._src], r._panner ? r._node.bufferSource.connect(r._panner) : r._node.bufferSource.connect(r._node), r._node.bufferSource.loop = r._loop, r._loop && (r._node.bufferSource.loopStart = r._start || 0, r._node.bufferSource.loopEnd = r._stop || 0), r._node.bufferSource.playbackRate.setValueAtTime(r._rate, o.ctx.currentTime), s;
3748
3748
  }, _cleanBuffer: function(r) {
3749
- var s = this, u = o._navigator && o._navigator.vendor.indexOf("Apple") >= 0;
3750
- if (o._scratchBuffer && r.bufferSource && (r.bufferSource.onended = null, r.bufferSource.disconnect(0), u)) try {
3749
+ var s = this, c = o._navigator && o._navigator.vendor.indexOf("Apple") >= 0;
3750
+ if (o._scratchBuffer && r.bufferSource && (r.bufferSource.onended = null, r.bufferSource.disconnect(0), c)) try {
3751
3751
  r.bufferSource.buffer = o._scratchBuffer;
3752
3752
  } catch {
3753
3753
  }
@@ -3762,8 +3762,8 @@ function ua() {
3762
3762
  var r = this, s = r._parent;
3763
3763
  return r._muted = s._muted, r._loop = s._loop, r._volume = s._volume, r._rate = s._rate, r._seek = 0, r._paused = !0, r._ended = !0, r._sprite = "__default", r._id = ++o._counter, s._sounds.push(r), r.create(), r;
3764
3764
  }, create: function() {
3765
- var r = this, s = r._parent, u = o._muted || r._muted || r._parent._muted ? 0 : r._volume;
3766
- return s._webAudio ? (r._node = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), r._node.gain.setValueAtTime(u, o.ctx.currentTime), r._node.paused = !0, r._node.connect(o.masterGain)) : o.noAudio || (r._node = o._obtainHtml5Audio(), r._errorFn = r._errorListener.bind(r), r._node.addEventListener("error", r._errorFn, !1), r._loadFn = r._loadListener.bind(r), r._node.addEventListener(o._canPlayEvent, r._loadFn, !1), r._endFn = r._endListener.bind(r), r._node.addEventListener("ended", r._endFn, !1), r._node.src = s._src, r._node.preload = s._preload === !0 ? "auto" : s._preload, r._node.volume = u * o.volume(), r._node.load()), r;
3765
+ var r = this, s = r._parent, c = o._muted || r._muted || r._parent._muted ? 0 : r._volume;
3766
+ return s._webAudio ? (r._node = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), r._node.gain.setValueAtTime(c, o.ctx.currentTime), r._node.paused = !0, r._node.connect(o.masterGain)) : o.noAudio || (r._node = o._obtainHtml5Audio(), r._errorFn = r._errorListener.bind(r), r._node.addEventListener("error", r._errorFn, !1), r._loadFn = r._loadListener.bind(r), r._node.addEventListener(o._canPlayEvent, r._loadFn, !1), r._endFn = r._endListener.bind(r), r._node.addEventListener("ended", r._endFn, !1), r._node.src = s._src, r._node.preload = s._preload === !0 ? "auto" : s._preload, r._node.volume = c * o.volume(), r._node.load()), r;
3767
3767
  }, reset: function() {
3768
3768
  var r = this, s = r._parent;
3769
3769
  return r._muted = s._muted, r._loop = s._loop, r._volume = s._volume, r._rate = s._rate, r._seek = 0, r._rateSeek = 0, r._paused = !0, r._ended = !0, r._sprite = "__default", r._id = ++o._counter, r;
@@ -3777,11 +3777,11 @@ function ua() {
3777
3777
  var r = this, s = r._parent;
3778
3778
  s._duration === 1 / 0 && (s._duration = Math.ceil(10 * r._node.duration) / 10, s._sprite.__default[1] === 1 / 0 && (s._sprite.__default[1] = 1e3 * s._duration), s._ended(r)), r._node.removeEventListener("ended", r._endFn, !1);
3779
3779
  } };
3780
- var c = {}, l = function(r) {
3780
+ var u = {}, l = function(r) {
3781
3781
  var s = r._src;
3782
- if (c[s]) return r._duration = c[s].duration, void y(r);
3782
+ if (u[s]) return r._duration = u[s].duration, void y(r);
3783
3783
  if (/^data:[^;]+;base64,/.test(s)) {
3784
- for (var u = atob(s.split(",")[1]), d = new Uint8Array(u.length), f = 0; f < u.length; ++f) d[f] = u.charCodeAt(f);
3784
+ for (var c = atob(s.split(",")[1]), d = new Uint8Array(c.length), f = 0; f < c.length; ++f) d[f] = c.charCodeAt(f);
3785
3785
  h(d.buffer, r);
3786
3786
  } else {
3787
3787
  var v = new XMLHttpRequest();
@@ -3792,7 +3792,7 @@ function ua() {
3792
3792
  if (_ !== "0" && _ !== "2" && _ !== "3") return void r._emit("loaderror", null, "Failed loading audio file with status: " + v.status + ".");
3793
3793
  h(v.response, r);
3794
3794
  }, v.onerror = function() {
3795
- r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete c[s], r.load());
3795
+ r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete u[s], r.load());
3796
3796
  }, p(v);
3797
3797
  }
3798
3798
  }, p = function(r) {
@@ -3802,12 +3802,12 @@ function ua() {
3802
3802
  r.onerror();
3803
3803
  }
3804
3804
  }, h = function(r, s) {
3805
- var u = function() {
3805
+ var c = function() {
3806
3806
  s._emit("loaderror", null, "Decoding audio data failed.");
3807
3807
  }, d = function(f) {
3808
- f && s._sounds.length > 0 ? (c[s._src] = f, y(s, f)) : u();
3808
+ f && s._sounds.length > 0 ? (u[s._src] = f, y(s, f)) : c();
3809
3809
  };
3810
- typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(d).catch(u) : o.ctx.decodeAudioData(r, d, u);
3810
+ typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(d).catch(c) : o.ctx.decodeAudioData(r, d, c);
3811
3811
  }, y = function(r, s) {
3812
3812
  s && !r._duration && (r._duration = s.duration), Object.keys(r._sprite).length === 0 && (r._sprite = { __default: [0, 1e3 * r._duration] }), r._state !== "loaded" && (r._state = "loaded", r._emit("load"), r._loadQueue());
3813
3813
  }, g = function() {
@@ -3818,8 +3818,8 @@ function ua() {
3818
3818
  o.usingWebAudio = !1;
3819
3819
  }
3820
3820
  o.ctx || (o.usingWebAudio = !1);
3821
- var r = /iP(hone|od|ad)/.test(o._navigator && o._navigator.platform), s = o._navigator && o._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), u = s ? parseInt(s[1], 10) : null;
3822
- if (r && u && u < 9) {
3821
+ var r = /iP(hone|od|ad)/.test(o._navigator && o._navigator.platform), s = o._navigator && o._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), c = s ? parseInt(s[1], 10) : null;
3822
+ if (r && c && c < 9) {
3823
3823
  var d = /safari/.test(o._navigator && o._navigator.userAgent.toLowerCase());
3824
3824
  o._navigator && !d && (o.usingWebAudio = !1);
3825
3825
  }
@@ -3832,7 +3832,7 @@ function ua() {
3832
3832
  }
3833
3833
  var vt = ua();
3834
3834
  const ca = typeof navigator < "u" && typeof navigator.standalone < "u";
3835
- class Sa {
3835
+ class Aa {
3836
3836
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3837
3837
  constructor(t) {
3838
3838
  this.cogsConnection = t, this.addEventListener("audioClipState", ({ detail: o }) => {
@@ -3867,9 +3867,9 @@ class Sa {
3867
3867
  });
3868
3868
  const n = () => {
3869
3869
  const o = Object.entries(this.audioClipPlayers).map(([i, a]) => {
3870
- const c = Object.values(a.activeClips), l = c.some(
3870
+ const u = Object.values(a.activeClips), l = u.some(
3871
3871
  ({ state: p }) => p.type === "playing" || p.type === "pausing" || p.type === "stopping" || p.type === "play_requested" || p.type === "pause_requested" || p.type === "stop_requested"
3872
- ) ? "playing" : c.some(({ state: p }) => p.type === "paused") ? "paused" : "stopped";
3872
+ ) ? "playing" : u.some(({ state: p }) => p.type === "paused") ? "paused" : "stopped";
3873
3873
  return [i, l];
3874
3874
  });
3875
3875
  t.sendInitialMediaClipStates({ mediaType: "audio", files: o });
@@ -3884,21 +3884,21 @@ class Sa {
3884
3884
  this.globalVolume = t, vt.Howler.volume(t), this.notifyStateListeners();
3885
3885
  }
3886
3886
  playAudioClip(t, { playId: n, volume: o, fade: i, loop: a }) {
3887
- t in this.audioClipPlayers || (this.audioClipPlayers[t] = this.createClip(t, { preload: !1, ephemeral: !0 })), this.updateAudioClipPlayer(t, (c) => {
3888
- const l = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "paused").map(([g]) => parseInt(g)), p = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pausing").map(([g]) => parseInt(g));
3887
+ t in this.audioClipPlayers || (this.audioClipPlayers[t] = this.createClip(t, { preload: !1, ephemeral: !0 })), this.updateAudioClipPlayer(t, (u) => {
3888
+ const l = Object.entries(u.activeClips).filter(([, { state: g }]) => g.type === "paused").map(([g]) => parseInt(g)), p = Object.entries(u.activeClips).filter(([, { state: g }]) => g.type === "pausing").map(([g]) => parseInt(g));
3889
3889
  l.forEach((g) => {
3890
- c.player.play(g);
3890
+ u.player.play(g);
3891
3891
  });
3892
- const h = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 || p.length > 0 || h.length > 0 ? [] : [c.player.play()];
3892
+ const h = Object.entries(u.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 || p.length > 0 || h.length > 0 ? [] : [u.player.play()];
3893
3893
  return p.forEach((g) => {
3894
- c.player.off("fade", void 0, g), c.player.loop(a, g), this.updateActiveAudioClip(t, g, (r) => ({ ...r, state: { type: "playing" } })), ne(i) ? oe(c.player, o, i * 1e3, g) : Ce(c.player, o, g);
3894
+ u.player.off("fade", void 0, g), u.player.loop(a, g), this.updateActiveAudioClip(t, g, (r) => ({ ...r, state: { type: "playing" } })), ne(i) ? oe(u.player, o, i * 1e3, g) : Ce(u.player, o, g);
3895
3895
  }), [...l, ...h, ...y].forEach((g) => {
3896
- c.player.loop(a, g), c.player.off("play", void 0, g), c.player.off("pause", void 0, g), c.player.off("fade", void 0, g), c.player.off("end", void 0, g), c.player.off("stop", void 0, g), c.player.once("play", () => {
3897
- Ee(c.player, this.sinkId);
3898
- }), c.player.once("stop", () => this.handleStoppedClip(t, n, g), g), c.player.on(
3896
+ u.player.loop(a, g), u.player.off("play", void 0, g), u.player.off("pause", void 0, g), u.player.off("fade", void 0, g), u.player.off("end", void 0, g), u.player.off("stop", void 0, g), u.player.once("play", () => {
3897
+ Ee(u.player, this.sinkId);
3898
+ }), u.player.once("stop", () => this.handleStoppedClip(t, n, g), g), u.player.on(
3899
3899
  "end",
3900
3900
  () => {
3901
- c.activeClips[g]?.loop || this.handleStoppedClip(t, n, g);
3901
+ u.activeClips[g]?.loop || this.handleStoppedClip(t, n, g);
3902
3902
  },
3903
3903
  g
3904
3904
  );
@@ -3908,48 +3908,48 @@ class Sa {
3908
3908
  loop: a,
3909
3909
  volume: o
3910
3910
  };
3911
- c.player.once(
3911
+ u.player.once(
3912
3912
  "play",
3913
3913
  () => {
3914
- const s = c.activeClips[g]?.state;
3915
- s?.type === "pause_requested" ? this.pauseAudioClip(t, { fade: s.fade }, g, !0) : s?.type === "stop_requested" ? this.stopAudioClip(t, { fade: s.fade }, g, !0) : this.updateActiveAudioClip(t, g, (u) => ({ ...u, state: { type: "playing" } }));
3914
+ const s = u.activeClips[g]?.state;
3915
+ s?.type === "pause_requested" ? this.pauseAudioClip(t, { fade: s.fade }, g, !0) : s?.type === "stop_requested" ? this.stopAudioClip(t, { fade: s.fade }, g, !0) : this.updateActiveAudioClip(t, g, (c) => ({ ...c, state: { type: "playing" } }));
3916
3916
  },
3917
3917
  g
3918
- ), ne(i) ? (c.player.volume(0, g), c.player.mute(!1, g), c.player.once(
3918
+ ), ne(i) ? (u.player.volume(0, g), u.player.mute(!1, g), u.player.once(
3919
3919
  "play",
3920
3920
  () => {
3921
- oe(c.player, o, i * 1e3, g);
3921
+ oe(u.player, o, i * 1e3, g);
3922
3922
  },
3923
3923
  g
3924
- )) : Ce(c.player, o, g), c.activeClips = { ...c.activeClips, [g]: r };
3925
- }), c;
3924
+ )) : Ce(u.player, o, g), u.activeClips = { ...u.activeClips, [g]: r };
3925
+ }), u;
3926
3926
  }), this.notifyClipStateListeners(n, t, "playing");
3927
3927
  }
3928
3928
  pauseAudioClip(t, { fade: n }, o, i) {
3929
3929
  Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
3930
- Object.entries(a.activeClips).map(([c, l]) => {
3931
- const p = parseInt(c);
3930
+ Object.entries(a.activeClips).map(([u, l]) => {
3931
+ const p = parseInt(u);
3932
3932
  return (o === void 0 || o === p) && (i && l.state.type === "pause_requested" || l.state.type === "playing" || l.state.type === "pausing" ? ne(n) ? (a.player.once(
3933
3933
  "fade",
3934
3934
  (h) => {
3935
3935
  a.player.pause(h), this.updateActiveAudioClip(t, h, (y) => ({ ...y, state: { type: "paused" } })), this.notifyClipStateListeners(l.playId, t, "paused");
3936
3936
  },
3937
3937
  p
3938
- ), oe(a.player, 0, n * 1e3, p), l.state = { type: "pausing" }) : (a.player.pause(p), l.state = { type: "paused" }, this.notifyClipStateListeners(l.playId, t, "paused")) : (l.state.type === "play_requested" || l.state.type === "pause_requested") && (l.state = { type: "pause_requested", fade: n })), [c, l];
3938
+ ), oe(a.player, 0, n * 1e3, p), l.state = { type: "pausing" }) : (a.player.pause(p), l.state = { type: "paused" }, this.notifyClipStateListeners(l.playId, t, "paused")) : (l.state.type === "play_requested" || l.state.type === "pause_requested") && (l.state = { type: "pause_requested", fade: n })), [u, l];
3939
3939
  })
3940
3940
  ), a));
3941
3941
  }
3942
3942
  stopAudioClip(t, { fade: n }, o, i) {
3943
3943
  la("Stop audio clip", { activeClips: this.audioClipPlayers[t]?.activeClips }), Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
3944
- Object.entries(a.activeClips).map(([c, l]) => {
3945
- const p = parseInt(c);
3944
+ Object.entries(a.activeClips).map(([u, l]) => {
3945
+ const p = parseInt(u);
3946
3946
  return (o === void 0 || o === p) && (i && l.state.type === "stop_requested" || l.state.type === "playing" || l.state.type === "pausing" || l.state.type === "paused" || l.state.type === "stopping" ? ne(n) && l.state.type !== "paused" ? (a.player.off("fade", p), oe(a.player, 0, n * 1e3, p), a.player.once(
3947
3947
  "fade",
3948
3948
  (h) => {
3949
3949
  a.player.loop(!1, h), a.player.stop(h);
3950
3950
  },
3951
3951
  p
3952
- ), l.state = { type: "stopping" }) : (a.player.loop(!1, p), a.player.stop(p)) : (l.state.type === "play_requested" || l.state.type === "pause_requested" || l.state.type === "stop_requested") && (l.state = { type: "stop_requested", fade: n })), [c, l];
3952
+ ), l.state = { type: "stopping" }) : (a.player.loop(!1, p), a.player.stop(p)) : (l.state.type === "play_requested" || l.state.type === "pause_requested" || l.state.type === "stop_requested") && (l.state = { type: "stop_requested", fade: n })), [u, l];
3953
3953
  })
3954
3954
  ), a));
3955
3955
  }
@@ -3964,12 +3964,12 @@ class Sa {
3964
3964
  return;
3965
3965
  }
3966
3966
  Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (i) => (i.activeClips = Object.fromEntries(
3967
- Object.entries(i.activeClips).map(([a, c]) => {
3968
- if (c.state.type !== "pausing" && c.state.type !== "stopping") {
3967
+ Object.entries(i.activeClips).map(([a, u]) => {
3968
+ if (u.state.type !== "pausing" && u.state.type !== "stopping") {
3969
3969
  const l = parseInt(a);
3970
- return ne(o) ? oe(i.player, n, o * 1e3, l) : Ce(i.player, n, l), [a, { ...c, volume: n }];
3970
+ return ne(o) ? oe(i.player, n, o * 1e3, l) : Ce(i.player, n, l), [a, { ...u, volume: n }];
3971
3971
  } else
3972
- return [a, c];
3972
+ return [a, u];
3973
3973
  })
3974
3974
  ), i));
3975
3975
  }
@@ -4014,9 +4014,9 @@ class Sa {
4014
4014
  }
4015
4015
  notifyStateListeners() {
4016
4016
  const t = Object.entries(this.audioClipPlayers).reduce(
4017
- (i, [a, c]) => (i[a] = {
4018
- config: { preload: c.config.preload, ephemeral: c.config.ephemeral },
4019
- activeClips: c.activeClips
4017
+ (i, [a, u]) => (i[a] = {
4018
+ config: { preload: u.config.preload, ephemeral: u.config.ephemeral },
4019
+ activeClips: u.activeClips
4020
4020
  }, i),
4021
4021
  {}
4022
4022
  ), n = Object.values(this.audioClipPlayers).some(
@@ -4081,7 +4081,7 @@ function oe(e, t, n, o) {
4081
4081
  e.fade(e.volume(o), t, n, o);
4082
4082
  }
4083
4083
  var Oe = /* @__PURE__ */ ((e) => (e.Paused = "paused", e.Playing = "playing", e))(Oe || {});
4084
- class Aa {
4084
+ class Sa {
4085
4085
  constructor(t, n = document.body) {
4086
4086
  this.cogsConnection = t, this.parentElement = n, this.addEventListener("videoClipState", ({ detail: i }) => {
4087
4087
  t.sendMediaClipState(i);
@@ -4117,8 +4117,8 @@ class Aa {
4117
4117
  }
4118
4118
  });
4119
4119
  const o = () => {
4120
- const i = Object.entries(this.videoClipPlayers).map(([a, c]) => {
4121
- const l = c.videoElement.paused ? c.videoElement.currentTime === 0 || c.videoElement.currentTime === c.videoElement.duration ? "paused" : "stopped" : "playing";
4120
+ const i = Object.entries(this.videoClipPlayers).map(([a, u]) => {
4121
+ const l = u.videoElement.paused ? u.videoElement.currentTime === 0 || u.videoElement.currentTime === u.videoElement.duration ? "paused" : "stopped" : "playing";
4122
4122
  return [a, l];
4123
4123
  });
4124
4124
  t.sendInitialMediaClipStates({ mediaType: "video", files: i });
@@ -4146,7 +4146,7 @@ class Aa {
4146
4146
  }), this.globalVolume = t, this.notifyStateListeners();
4147
4147
  }
4148
4148
  playVideoClip(t, { playId: n, volume: o, loop: i, fit: a }) {
4149
- this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit: a })), this.pendingClip && this.updateVideoClipPlayer(this.pendingClip.path, (c) => (c.videoElement.load(), c)), this.activeClip?.path !== t && (this.pendingClip = { path: t, playId: n, actionOncePlaying: "play" }), this.updateVideoClipPlayer(t, (c) => (c.volume = o, de(c.videoElement, o * this.globalVolume), c.videoElement.loop = i, c.videoElement.style.objectFit = a, c.videoElement.currentTime === c.videoElement.duration && (c.videoElement.currentTime = 0), c.videoElement.play(), this.activeClip || (c.videoElement.style.display = "block"), c));
4149
+ this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit: a })), this.pendingClip && this.updateVideoClipPlayer(this.pendingClip.path, (u) => (u.videoElement.load(), u)), this.activeClip?.path !== t && (this.pendingClip = { path: t, playId: n, actionOncePlaying: "play" }), this.updateVideoClipPlayer(t, (u) => (u.volume = o, de(u.videoElement, o * this.globalVolume), u.videoElement.loop = i, u.videoElement.style.objectFit = a, u.videoElement.currentTime === u.videoElement.duration && (u.videoElement.currentTime = 0), u.videoElement.play(), this.activeClip || (u.videoElement.style.display = "block"), u));
4150
4150
  }
4151
4151
  pauseVideoClip() {
4152
4152
  if (this.pendingClip && (this.pendingClip.actionOncePlaying = "pause"), this.activeClip) {
@@ -4282,52 +4282,53 @@ function de(e, t) {
4282
4282
  e.volume = t, e.muted = t === 0;
4283
4283
  }
4284
4284
  function Ue(e, t) {
4285
- switch (e.type) {
4286
- case "image": {
4287
- if (e.keyframes[0][0] > t)
4288
- return;
4289
- const o = e.keyframes.filter((a) => a[1] !== null), i = Se(o, t);
4290
- return { ...Ht, ...i };
4291
- }
4292
- case "audio": {
4293
- const n = e.keyframes.filter((a) => a[1] !== null), o = bt(n, t);
4294
- if (!o)
4295
- return;
4296
- const i = Se(n, t);
4297
- return { ...De, ...i, ...o };
4298
- }
4299
- case "video": {
4300
- const n = e.keyframes.filter((a) => a[1] !== null), o = bt(n, t);
4301
- if (!o)
4302
- return;
4303
- const i = Se(n, t);
4304
- return { ...Jt, ...i, ...o };
4285
+ if (!e.keyframes.filter((o) => o[1] === null).some((o) => o[0] <= t))
4286
+ switch (e.type) {
4287
+ case "image": {
4288
+ if (e.keyframes[0][0] > t)
4289
+ return;
4290
+ const i = e.keyframes.filter((u) => u[1] !== null), a = Ae(i, t);
4291
+ return { ...Ht, ...a };
4292
+ }
4293
+ case "audio": {
4294
+ const o = e.keyframes.filter((u) => u[1] !== null), i = bt(o, t);
4295
+ if (!i)
4296
+ return;
4297
+ const a = Ae(o, t);
4298
+ return { ...De, ...a, ...i };
4299
+ }
4300
+ case "video": {
4301
+ const o = e.keyframes.filter((u) => u[1] !== null), i = bt(o, t);
4302
+ if (!i)
4303
+ return;
4304
+ const a = Ae(o, t);
4305
+ return { ...Jt, ...a, ...i };
4306
+ }
4305
4307
  }
4306
- }
4307
4308
  }
4308
- function Se(e, t) {
4309
+ function Ae(e, t) {
4309
4310
  const n = {};
4310
4311
  for (const [i, a] of e)
4311
- i <= t ? (Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
4312
- n[c] ??= {}, n[c].before = [i, l];
4313
- }), Object.entries(a.set ?? {}).forEach(([c, l]) => {
4314
- n[c] ??= {}, n[c].before = [i, l];
4315
- })) : Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
4316
- n[c] ??= {}, n[c].after === void 0 && (n[c].after = [i, l]);
4312
+ i <= t ? (Object.entries(a.lerp ?? {}).forEach(([u, l]) => {
4313
+ n[u] ??= {}, n[u].before = [i, l];
4314
+ }), Object.entries(a.set ?? {}).forEach(([u, l]) => {
4315
+ n[u] ??= {}, n[u].before = [i, l];
4316
+ })) : Object.entries(a.lerp ?? {}).forEach(([u, l]) => {
4317
+ n[u] ??= {}, n[u].after === void 0 && (n[u].after = [i, l]);
4317
4318
  });
4318
4319
  const o = {};
4319
4320
  return Object.entries(n).forEach(
4320
- ([i, { before: a, after: c }]) => {
4321
- if (c === void 0 && a) {
4321
+ ([i, { before: a, after: u }]) => {
4322
+ if (u === void 0 && a) {
4322
4323
  o[i] = a[1];
4323
4324
  return;
4324
4325
  }
4325
- if (a && c && a[0] === c[0]) {
4326
- o[i] = c[1];
4326
+ if (a && u && a[0] === u[0]) {
4327
+ o[i] = u[1];
4327
4328
  return;
4328
4329
  }
4329
- if (a && typeof a[1] == "number" && c && typeof c[1] == "number") {
4330
- o[i] = a[1] + (t - a[0]) * (c[1] - a[1]) / (c[0] - a[0]);
4330
+ if (a && typeof a[1] == "number" && u && typeof u[1] == "number") {
4331
+ o[i] = a[1] + (t - a[0]) * (u[1] - a[1]) / (u[0] - a[0]);
4331
4332
  return;
4332
4333
  }
4333
4334
  }
@@ -4359,15 +4360,15 @@ function bt(e, t) {
4359
4360
  };
4360
4361
  }
4361
4362
  class Me {
4362
- constructor(t, n, o, i, a) {
4363
- this.surfaceElement = t, this.clipElement = n, this.constructAssetURL = i, this.mediaPreloader = a, this._state = o, setTimeout(this.loop);
4363
+ constructor(t, n, o, i, a, u) {
4364
+ this.surfaceElement = t, this.clipElement = n, this.constructAssetURL = i, this.getAudioOutput = a, this.mediaPreloader = u, this._state = o, setTimeout(this.loop);
4364
4365
  }
4365
4366
  isConnected(t) {
4366
4367
  return !(!this.surfaceElement || !this.clipElement || !this.surfaceElement.contains(this.clipElement) || t && !this.clipElement.contains(t));
4367
4368
  }
4368
4369
  _state;
4369
4370
  setState(t) {
4370
- this._state = t, clearTimeout(this.timeout), this.loop();
4371
+ this._state = t;
4371
4372
  }
4372
4373
  timeout;
4373
4374
  loop = async () => {
@@ -4376,22 +4377,19 @@ class Me {
4376
4377
  }
4377
4378
  function Fe(e, t, n, o, i) {
4378
4379
  let a;
4380
+ const u = o(n.file);
4379
4381
  switch (n.type) {
4380
4382
  case "image":
4381
- {
4382
- a = e instanceof HTMLImageElement ? e : document.createElement("img");
4383
- const c = o(n.file);
4384
- a.src.includes(c) || (a.src = c);
4385
- }
4383
+ a = e instanceof HTMLImageElement ? e : document.createElement("img"), a.src.includes(u) || (a.src = u);
4386
4384
  break;
4387
4385
  case "audio":
4388
- a = e instanceof HTMLAudioElement ? e : i.getElement(n.file, n.type);
4386
+ e instanceof HTMLAudioElement && e.src.includes(u) ? a = e : a = i.getElement(n.file, n.type);
4389
4387
  break;
4390
4388
  case "video":
4391
- a = e instanceof HTMLVideoElement ? e : i.getElement(n.file, n.type);
4389
+ e instanceof HTMLVideoElement && e.src.includes(u) ? a = e : a = i.getElement(n.file, n.type);
4392
4390
  break;
4393
4391
  }
4394
- return t.replaceChildren(a), a.style.position = "absolute", a.style.width = "100%", a.style.height = "100%", a;
4392
+ return (t.children.length !== 1 || t.childNodes[0] !== a) && t.replaceChildren(a), a.style.position = "absolute", a.style.width = "100%", a.style.height = "100%", a;
4395
4393
  }
4396
4394
  function Qt(e, t, n) {
4397
4395
  const o = String(t.opacity);
@@ -4400,8 +4398,12 @@ function Qt(e, t, n) {
4400
4398
  parseInt(e.style.zIndex) !== i && (e.style.zIndex = String(i)), e.style.objectFit !== n && (e.style.objectFit = n);
4401
4399
  }
4402
4400
  function Yt(e, t, n) {
4403
- e.volume !== t.volume && (e.volume = t.volume), e.sinkId !== n && e.setSinkId(n).catch(() => {
4404
- });
4401
+ if (e.volume !== t.volume && (e.volume = t.volume), e.sinkId !== n)
4402
+ try {
4403
+ e.setSinkId(n).catch(() => {
4404
+ });
4405
+ } catch {
4406
+ }
4405
4407
  }
4406
4408
  const wt = 50, da = 5, Xt = 1e3, pa = 5, fa = 5, ha = 0.3, _a = 0.1;
4407
4409
  function ma(e) {
@@ -4416,15 +4418,15 @@ function en(e, t, n, o) {
4416
4418
  e.loop !== y && (e.loop = y);
4417
4419
  }
4418
4420
  }
4419
- const a = e.currentTime * 1e3 - t.t, c = Math.abs(a);
4421
+ const a = e.currentTime * 1e3 - t.t, u = Math.abs(a);
4420
4422
  switch (!0) {
4421
- case (o.state === "idle" && t.rate > 0 && c <= wt):
4423
+ case (o.state === "idle" && t.rate > 0 && u <= wt):
4422
4424
  return e.playbackRate !== t.rate && (e.playbackRate = t.rate), { state: "idle" };
4423
- case (o.state === "idle" && t.rate > 0 && c > wt && c <= Xt): {
4425
+ case (o.state === "idle" && t.rate > 0 && u > wt && u <= Xt): {
4424
4426
  const l = ma(a), p = Math.max(0, t.rate - l);
4425
4427
  return e.playbackRate !== p && (e.playbackRate = p), { state: "intercepting" };
4426
4428
  }
4427
- case (o.state === "intercepting" && t.rate > 0 && c <= da):
4429
+ case (o.state === "intercepting" && t.rate > 0 && u <= da):
4428
4430
  return e.playbackRate !== t.rate && (e.playbackRate = t.rate), { state: "idle" };
4429
4431
  case (o.state === "intercepting" && Math.sign(a) === Math.sign(e.playbackRate - t.rate)):
4430
4432
  return console.warn(a, "missed intercept"), { state: "idle" };
@@ -4464,15 +4466,16 @@ class ga extends Me {
4464
4466
  this.constructAssetURL,
4465
4467
  this.mediaPreloader
4466
4468
  ) : this.destroy(), !t || !this.audioElement) return;
4467
- Yt(this.audioElement, t, this._state.audioOutput);
4468
- const n = en(this.audioElement, t, this._state.keyframes, this.syncState);
4469
- this.syncState.state !== "seeking" && n.state === "seeking" && this.audioElement.addEventListener(
4469
+ const n = this.getAudioOutput(this._state.audioOutput);
4470
+ Yt(this.audioElement, t, n);
4471
+ const o = en(this.audioElement, t, this._state.keyframes, this.syncState);
4472
+ this.syncState.state !== "seeking" && o.state === "seeking" && this.audioElement.addEventListener(
4470
4473
  "seeked",
4471
4474
  () => {
4472
4475
  this.syncState = { state: "idle" };
4473
4476
  },
4474
4477
  { passive: !0, once: !0 }
4475
- ), this.syncState = n;
4478
+ ), this.syncState = o;
4476
4479
  }
4477
4480
  destroy() {
4478
4481
  this.audioElement?.remove(), this.audioElement = void 0;
@@ -4490,15 +4493,16 @@ class ya extends Me {
4490
4493
  this.constructAssetURL,
4491
4494
  this.mediaPreloader
4492
4495
  ) : this.destroy(), !t || !this.videoElement) return;
4493
- Qt(this.videoElement, t, this._state.fit), Yt(this.videoElement, t, this._state.audioOutput);
4494
- const n = en(this.videoElement, t, this._state.keyframes, this.syncState);
4495
- this.syncState.state !== "seeking" && n.state === "seeking" && this.videoElement.addEventListener(
4496
+ const n = this.getAudioOutput(this._state.audioOutput);
4497
+ Qt(this.videoElement, t, this._state.fit), Yt(this.videoElement, t, n);
4498
+ const o = en(this.videoElement, t, this._state.keyframes, this.syncState);
4499
+ this.syncState.state !== "seeking" && o.state === "seeking" && this.videoElement.addEventListener(
4496
4500
  "seeked",
4497
4501
  () => {
4498
4502
  this.syncState = { state: "idle" };
4499
4503
  },
4500
4504
  { passive: !0, once: !0 }
4501
- ), this.syncState = n;
4505
+ ), this.syncState = o;
4502
4506
  }
4503
4507
  destroy() {
4504
4508
  this.videoElement?.remove(), this.videoElement = void 0;
@@ -4518,8 +4522,16 @@ class ba {
4518
4522
  this._state = t, this.update();
4519
4523
  }
4520
4524
  update() {
4521
- for (const [t, n] of Object.entries(this._elements))
4522
- t in this._state || (n.element.src = "", delete this._elements[t]), n.inUse = n.element.isConnected;
4525
+ for (const [t, n] of Object.entries(this._elements)) {
4526
+ if (!(t in this._state)) {
4527
+ if (n.inUse) {
4528
+ console.warn(`Failed to clean up element ${n.element.src}`);
4529
+ continue;
4530
+ }
4531
+ n.element.src = "", n.element.load(), delete this._elements[t];
4532
+ }
4533
+ n.inUse = n.element.isConnected;
4534
+ }
4523
4535
  for (const [t, n] of Object.entries(this._state)) {
4524
4536
  if (t in this._elements)
4525
4537
  continue;
@@ -4544,7 +4556,7 @@ class ba {
4544
4556
  return o.inUse = !0, o.element;
4545
4557
  {
4546
4558
  const i = document.createElement(n);
4547
- return i.src = this._constructAssetURL(t), this._elements[t] = { element: i, type: n, inUse: !0 }, i;
4559
+ return i.src = this._constructAssetURL(t), n === "video" && (this._elements[t] = { element: i, type: n, inUse: !0 }), i;
4548
4560
  }
4549
4561
  }
4550
4562
  releaseElement(t) {
@@ -4559,8 +4571,8 @@ class ba {
4559
4571
  }
4560
4572
  const wa = "data-clip-id";
4561
4573
  class Ta {
4562
- constructor(t, n, o = new ba(t)) {
4563
- this.constructAssetUrl = t, this.mediaPreloader = o, this._element = document.createElement("div"), this._element.className = "surface-manager", this._element.style.width = "100%", this._element.style.height = "100%", this._state = n || {}, this.update();
4574
+ constructor(t, n, o, i = new ba(t)) {
4575
+ this.constructAssetUrl = t, this.getAudioOutput = n, this.mediaPreloader = i, this._element = document.createElement("div"), this._element.className = "surface-manager", this._element.style.width = "100%", this._element.style.height = "100%", this._state = o || {}, this.update();
4564
4576
  }
4565
4577
  _state = {};
4566
4578
  setState(t) {
@@ -4593,13 +4605,34 @@ class Ta {
4593
4605
  else
4594
4606
  switch (o.type) {
4595
4607
  case "image":
4596
- i.manager = new va(this._element, i.element, o, this.constructAssetUrl, this.mediaPreloader);
4608
+ i.manager = new va(
4609
+ this._element,
4610
+ i.element,
4611
+ o,
4612
+ this.constructAssetUrl,
4613
+ this.getAudioOutput,
4614
+ this.mediaPreloader
4615
+ );
4597
4616
  break;
4598
4617
  case "audio":
4599
- i.manager = new ga(this._element, i.element, o, this.constructAssetUrl, this.mediaPreloader);
4618
+ i.manager = new ga(
4619
+ this._element,
4620
+ i.element,
4621
+ o,
4622
+ this.constructAssetUrl,
4623
+ this.getAudioOutput,
4624
+ this.mediaPreloader
4625
+ );
4600
4626
  break;
4601
4627
  case "video":
4602
- i.manager = new ya(this._element, i.element, o, this.constructAssetUrl, this.mediaPreloader);
4628
+ i.manager = new ya(
4629
+ this._element,
4630
+ i.element,
4631
+ o,
4632
+ this.constructAssetUrl,
4633
+ this.getAudioOutput,
4634
+ this.mediaPreloader
4635
+ );
4603
4636
  break;
4604
4637
  }
4605
4638
  });
@@ -4609,8 +4642,8 @@ const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4609
4642
  __proto__: null
4610
4643
  }, Symbol.toStringTag, { value: "Module" }));
4611
4644
  export {
4612
- Sa as CogsAudioPlayer,
4613
- Sn as CogsConfigChangedEvent,
4645
+ Aa as CogsAudioPlayer,
4646
+ An as CogsConfigChangedEvent,
4614
4647
  Ea as CogsConnection,
4615
4648
  En as CogsConnectionCloseEvent,
4616
4649
  kn as CogsConnectionOpenEvent,
@@ -4618,8 +4651,8 @@ export {
4618
4651
  zn as CogsMediaConfigChangedEvent,
4619
4652
  Cn as CogsMessageEvent,
4620
4653
  In as CogsShowPhaseChangedEvent,
4621
- An as CogsStateChangedEvent,
4622
- Aa as CogsVideoPlayer,
4654
+ Sn as CogsStateChangedEvent,
4655
+ Sa as CogsVideoPlayer,
4623
4656
  We as DataStoreItemEvent,
4624
4657
  qe as DataStoreItemsEvent,
4625
4658
  za as ManifestTypes,