@clockworkdog/cogs-client 3.0.0-alpha.6 → 3.0.0-alpha.7

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.
@@ -17,7 +17,7 @@ var Oe = function(e, t) {
17
17
  return Oe = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, o) {
18
18
  n.__proto__ = o;
19
19
  } || function(n, o) {
20
- for (var r in o) o.hasOwnProperty(r) && (n[r] = o[r]);
20
+ for (var i in o) o.hasOwnProperty(i) && (n[i] = o[i]);
21
21
  }, Oe(e, t);
22
22
  };
23
23
  function Tt(e, t) {
@@ -38,14 +38,14 @@ function nn(e) {
38
38
  function on(e, t) {
39
39
  var n = typeof Symbol == "function" && e[Symbol.iterator];
40
40
  if (!n) return e;
41
- var o = n.call(e), r, a = [], c;
41
+ var o = n.call(e), i, a = [], c;
42
42
  try {
43
- for (; (t === void 0 || t-- > 0) && !(r = o.next()).done; ) a.push(r.value);
43
+ for (; (t === void 0 || t-- > 0) && !(i = o.next()).done; ) a.push(i.value);
44
44
  } catch (l) {
45
45
  c = { error: l };
46
46
  } finally {
47
47
  try {
48
- r && !r.done && (n = o.return) && n.call(o);
48
+ i && !i.done && (n = o.return) && n.call(o);
49
49
  } finally {
50
50
  if (c) throw c.error;
51
51
  }
@@ -70,8 +70,8 @@ var St = (
70
70
  function(e) {
71
71
  Tt(t, e);
72
72
  function t(n, o) {
73
- var r = e.call(this, "error", o) || this;
74
- return r.message = n.message, r.error = n, r;
73
+ var i = e.call(this, "error", o) || this;
74
+ return i.message = n.message, i.error = n, i;
75
75
  }
76
76
  return t;
77
77
  }(St)
@@ -79,9 +79,9 @@ var St = (
79
79
  /** @class */
80
80
  function(e) {
81
81
  Tt(t, e);
82
- function t(n, o, r) {
82
+ function t(n, o, i) {
83
83
  n === void 0 && (n = 1e3), o === void 0 && (o = "");
84
- var a = e.call(this, "close", r) || this;
84
+ var a = e.call(this, "close", i) || this;
85
85
  return a.wasClean = !0, a.code = n, a.reason = o, a;
86
86
  }
87
87
  return t;
@@ -98,7 +98,7 @@ var un = function() {
98
98
  return WebSocket;
99
99
  }, cn = function(e) {
100
100
  return typeof e < "u" && !!e && e.CLOSING === 2;
101
- }, M = {
101
+ }, F = {
102
102
  maxReconnectionDelay: 1e4,
103
103
  minReconnectionDelay: 1e3 + Math.random() * 4e3,
104
104
  minUptime: 5e3,
@@ -110,33 +110,33 @@ var un = function() {
110
110
  /** @class */
111
111
  function() {
112
112
  function e(t, n, o) {
113
- var r = this;
113
+ var i = this;
114
114
  o === void 0 && (o = {}), this._listeners = {
115
115
  error: [],
116
116
  message: [],
117
117
  open: [],
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
- r._debug("open event");
121
- var c = r._options.minUptime, l = c === void 0 ? M.minUptime : c;
122
- clearTimeout(r._connectTimeout), r._uptimeTimeout = setTimeout(function() {
123
- return r._acceptOpen();
124
- }, l), r._ws.binaryType = r._binaryType, r._messageQueue.forEach(function(p) {
125
- return r._ws.send(p);
126
- }), r._messageQueue = [], r.onopen && r.onopen(a), r._listeners.open.forEach(function(p) {
127
- return r._callEventListener(a, p);
120
+ i._debug("open event");
121
+ var c = i._options.minUptime, l = c === void 0 ? F.minUptime : c;
122
+ clearTimeout(i._connectTimeout), i._uptimeTimeout = setTimeout(function() {
123
+ return i._acceptOpen();
124
+ }, l), i._ws.binaryType = i._binaryType, i._messageQueue.forEach(function(d) {
125
+ return i._ws.send(d);
126
+ }), i._messageQueue = [], i.onopen && i.onopen(a), i._listeners.open.forEach(function(d) {
127
+ return i._callEventListener(a, d);
128
128
  });
129
129
  }, this._handleMessage = function(a) {
130
- r._debug("message event"), r.onmessage && r.onmessage(a), r._listeners.message.forEach(function(c) {
131
- return r._callEventListener(a, c);
130
+ i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(c) {
131
+ return i._callEventListener(a, c);
132
132
  });
133
133
  }, this._handleError = function(a) {
134
- r._debug("error event", a.message), r._disconnect(void 0, a.message === "TIMEOUT" ? "timeout" : void 0), r.onerror && r.onerror(a), r._debug("exec error listeners"), r._listeners.error.forEach(function(c) {
135
- return r._callEventListener(a, c);
136
- }), r._connect();
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);
136
+ }), i._connect();
137
137
  }, this._handleClose = function(a) {
138
- r._debug("close event"), r._clearTimeouts(), r._shouldReconnect && r._connect(), r.onclose && r.onclose(a), r._listeners.close.forEach(function(c) {
139
- return r._callEventListener(a, c);
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);
140
140
  });
141
141
  }, this._url = t, this._protocols = n, this._options = o, this._options.startClosed && (this._shouldReconnect = !1), this._connect();
142
142
  }
@@ -276,21 +276,21 @@ var un = function() {
276
276
  if (this._ws && this._ws.readyState === this.OPEN)
277
277
  this._debug("send", t), this._ws.send(t);
278
278
  else {
279
- var n = this._options.maxEnqueuedMessages, o = n === void 0 ? M.maxEnqueuedMessages : n;
279
+ var n = this._options.maxEnqueuedMessages, o = n === void 0 ? F.maxEnqueuedMessages : n;
280
280
  this._messageQueue.length < o && (this._debug("enqueue", t), this._messageQueue.push(t));
281
281
  }
282
282
  }, e.prototype.addEventListener = function(t, n) {
283
283
  this._listeners[t] && this._listeners[t].push(n);
284
284
  }, e.prototype.dispatchEvent = function(t) {
285
- var n, o, r = this._listeners[t.type];
286
- if (r)
285
+ var n, o, i = this._listeners[t.type];
286
+ if (i)
287
287
  try {
288
- for (var a = nn(r), c = a.next(); !c.done; c = a.next()) {
288
+ for (var a = nn(i), c = a.next(); !c.done; c = a.next()) {
289
289
  var l = c.value;
290
290
  this._callEventListener(t, l);
291
291
  }
292
- } catch (p) {
293
- n = { error: p };
292
+ } catch (d) {
293
+ n = { error: d };
294
294
  } finally {
295
295
  try {
296
296
  c && !c.done && (o = a.return) && o.call(a);
@@ -308,8 +308,8 @@ var un = function() {
308
308
  t[n] = arguments[n];
309
309
  this._options.debug && console.log.apply(console, rn(["RWS>"], t));
310
310
  }, e.prototype._getNextDelay = function() {
311
- var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? M.reconnectionDelayGrowFactor : n, r = t.minReconnectionDelay, a = r === void 0 ? M.minReconnectionDelay : r, c = t.maxReconnectionDelay, l = c === void 0 ? M.maxReconnectionDelay : c, p = 0;
312
- return this._retryCount > 0 && (p = a * Math.pow(o, this._retryCount - 1), p > l && (p = l)), this._debug("next delay", p), p;
311
+ var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? F.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? F.minReconnectionDelay : i, c = t.maxReconnectionDelay, l = c === void 0 ? F.maxReconnectionDelay : c, d = 0;
312
+ return this._retryCount > 0 && (d = a * Math.pow(o, this._retryCount - 1), d > l && (d = l)), this._debug("next delay", d), d;
313
313
  }, e.prototype._wait = function() {
314
314
  var t = this;
315
315
  return new Promise(function(n) {
@@ -330,17 +330,17 @@ var un = 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, r = o === void 0 ? M.maxRetries : o, a = n.connectionTimeout, c = a === void 0 ? M.connectionTimeout : a, l = n.WebSocket, p = l === void 0 ? un() : l;
334
- if (this._retryCount >= r) {
335
- this._debug("max retries reached", this._retryCount, ">=", r);
333
+ var n = this._options, o = n.maxRetries, i = o === void 0 ? F.maxRetries : o, a = n.connectionTimeout, c = a === void 0 ? F.connectionTimeout : a, l = n.WebSocket, d = l === void 0 ? un() : l;
334
+ if (this._retryCount >= i) {
335
+ this._debug("max retries reached", this._retryCount, ">=", i);
336
336
  return;
337
337
  }
338
- if (this._retryCount++, this._debug("connect", this._retryCount), this._removeListeners(), !cn(p))
338
+ if (this._retryCount++, this._debug("connect", this._retryCount), this._removeListeners(), !cn(d))
339
339
  throw Error("No valid WebSocket class provided");
340
340
  this._wait().then(function() {
341
341
  return t._getNextUrl(t._url);
342
- }).then(function(h) {
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() {
342
+ }).then(function(f) {
343
+ t._closeCalled || (t._debug("connect", { url: f, protocols: t._protocols }), t._ws = t._protocols ? new d(f, t._protocols) : new d(f), t._ws.binaryType = t._binaryType, t._connectLock = !1, t._addListeners(), t._connectTimeout = setTimeout(function() {
344
344
  return t._handleTimeout();
345
345
  }, c));
346
346
  });
@@ -425,8 +425,8 @@ class He extends Event {
425
425
  const te = globalThis.Date;
426
426
  function hn(e) {
427
427
  const t = e - te.now();
428
- function n(...r) {
429
- return r.length === 0 ? new te(n.now()) : new te(...r);
428
+ function n(...i) {
429
+ return i.length === 0 ? new te(n.now()) : new te(...i);
430
430
  }
431
431
  const o = Object.getOwnPropertyDescriptors(te);
432
432
  Object.defineProperties(n, o), n.now = function() {
@@ -438,48 +438,48 @@ function _n() {
438
438
  return ++fn;
439
439
  }
440
440
  const mn = 5, vn = 1e4;
441
- function gn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = mn, syncRequestTimeout: r = vn }) {
441
+ function gn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = mn, syncRequestTimeout: i = vn }) {
442
442
  const a = {};
443
443
  async function c() {
444
444
  const y = [];
445
445
  for (let s = 0; s < o; s++) {
446
- const u = new Promise((d) => {
447
- const f = _n(), v = Date.now(), _ = performance.now();
448
- t({ timesync: { id: f } });
449
- const w = (E, k) => d({ sentAt: _, receivedAt: E, serverNow: k, clientNow: v });
450
- a[f] = { complete: w }, setTimeout(() => d(null), r);
446
+ const u = new Promise((p) => {
447
+ const h = _n(), v = Date.now(), _ = performance.now();
448
+ t({ timesync: { id: h } });
449
+ const w = (E, k) => p({ sentAt: _, receivedAt: E, serverNow: k, clientNow: v });
450
+ a[h] = { complete: w }, setTimeout(() => p(null), i);
451
451
  });
452
452
  y.push(u), await u;
453
453
  }
454
- const g = (await Promise.all(y)).filter((s) => s !== null), i = yn(g);
455
- isNaN(i) || n(Date.now() + i);
454
+ const g = (await Promise.all(y)).filter((s) => s !== null), r = yn(g);
455
+ isNaN(r) || n(Date.now() + r);
456
456
  }
457
457
  const l = (y) => {
458
- const g = performance.now(), i = a[y.timesync.id];
459
- i && i.complete(g, y.timesync.now);
458
+ const g = performance.now(), r = a[y.timesync.id];
459
+ r && r.complete(g, y.timesync.now);
460
460
  };
461
461
  c();
462
- const p = setInterval(c, e);
462
+ const d = setInterval(c, e);
463
463
  return {
464
464
  receive: l,
465
465
  destroy: () => {
466
- clearInterval(p);
466
+ clearInterval(d);
467
467
  }
468
468
  };
469
469
  }
470
470
  function yn(e) {
471
- return e.map(({ sentAt: t, receivedAt: n, clientNow: o, serverNow: r }) => {
471
+ return e.map(({ sentAt: t, receivedAt: n, clientNow: o, serverNow: i }) => {
472
472
  const a = (n - t) / 2;
473
- return r - o - a;
473
+ return i - o - a;
474
474
  }).reduce((t, n) => t + n, 0) / e.length;
475
475
  }
476
476
  class za {
477
- constructor(t, { hostname: n = document.location.hostname, port: o = zt } = {}, r, a) {
478
- this.manifest = t, this.currentState = { ...r }, this.store = new pn(a ?? {});
479
- const { useReconnectingWebsocket: c, path: l, pathParams: p } = bn(document.location.href);
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
- const h = `ws://${n}:${o}${l}?${this.urlParams}`;
482
- this.websocket = c ? new ln(h) : new WebSocket(h);
477
+ constructor(t, { hostname: n = document.location.hostname, port: o = zt } = {}, i, a) {
478
+ this.manifest = t, this.currentState = { ...i }, this.store = new pn(a ?? {});
479
+ const { useReconnectingWebsocket: c, path: l, pathParams: d } = bn(document.location.href);
480
+ this.urlParams = new URLSearchParams(d), this.urlParams.set("screenWidth", window.screen.width.toString()), this.urlParams.set("screenHeight", window.screen.height.toString()), this.urlParams.set("screenPixelRatio", window.devicePixelRatio.toString());
481
+ const f = `ws://${n}:${o}${l}?${this.urlParams}`;
482
+ this.websocket = c ? new ln(f) : new WebSocket(f);
483
483
  let y;
484
484
  this.websocket.onopen = () => {
485
485
  this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new wn()), this.setState(this.currentState), y = gn({
@@ -490,30 +490,30 @@ class za {
490
490
  });
491
491
  }, this.websocket.addEventListener("message", ({ data: g }) => {
492
492
  try {
493
- const i = JSON.parse(g);
494
- if (typeof i == "object" && i !== null && "timesync" in i) {
495
- const s = i;
493
+ const r = JSON.parse(g);
494
+ if (typeof r == "object" && r !== null && "timesync" in r) {
495
+ const s = r;
496
496
  y?.receive(s);
497
497
  }
498
- } catch (i) {
499
- console.error(i);
498
+ } catch (r) {
499
+ console.error(r);
500
500
  }
501
501
  }), this.websocket.onclose = () => {
502
502
  y?.destroy(), this.dispatchEvent(new En());
503
503
  }, this.websocket.addEventListener("message", ({ data: g }) => {
504
504
  try {
505
- const i = JSON.parse(g);
505
+ const r = JSON.parse(g);
506
506
  try {
507
- if (i.config)
508
- this.currentConfig = i.config, this.dispatchEvent(new Cn(this.currentConfig));
509
- else if (i.updates)
510
- this.currentState = { ...this.currentState, ...i.updates }, this.dispatchEvent(new An(i.updates));
511
- else if (i.event && i.event.key)
507
+ if (r.config)
508
+ this.currentConfig = r.config, this.dispatchEvent(new Cn(this.currentConfig));
509
+ else if (r.updates)
510
+ this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new An(r.updates));
511
+ else if (r.event && r.event.key)
512
512
  this.dispatchEvent(
513
- new Tn(i.event.key, i.event.value)
513
+ new Tn(r.event.key, r.event.value)
514
514
  );
515
- else if (typeof i.message == "object") {
516
- const s = i.message;
515
+ else if (typeof r.message == "object") {
516
+ const s = r.message;
517
517
  switch (s.type) {
518
518
  case "adjustable_timer_update":
519
519
  this._timerState = {
@@ -540,8 +540,8 @@ class za {
540
540
  } catch (s) {
541
541
  console.warn("Error handling data", g, s);
542
542
  }
543
- } catch (i) {
544
- console.error("Unable to parse incoming data from server", g, i);
543
+ } catch (r) {
544
+ console.error("Unable to parse incoming data from server", g, r);
545
545
  }
546
546
  }), this.store.addEventListener("items", (g) => {
547
547
  this.sendDataStoreItems(g.items);
@@ -549,8 +549,8 @@ class za {
549
549
  {
550
550
  const g = async () => {
551
551
  if (navigator.mediaDevices) {
552
- const i = (await navigator.mediaDevices.enumerateDevices()).filter(({ kind: s }) => s === "audiooutput");
553
- this.sendAudioOutputs(i), this.audioOutputs = i;
552
+ const r = (await navigator.mediaDevices.enumerateDevices()).filter(({ kind: s }) => s === "audiooutput");
553
+ this.sendAudioOutputs(r), this.audioOutputs = r;
554
554
  }
555
555
  };
556
556
  this.eventTarget.addEventListener("open", g), navigator.mediaDevices?.addEventListener("devicechange", g), g();
@@ -656,7 +656,7 @@ class za {
656
656
  }
657
657
  }
658
658
  function bn(e) {
659
- const t = new URL(e), n = new URLSearchParams(t.searchParams), o = n.get("local_id"), r = 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") ?? "", c = 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"), {
@@ -664,7 +664,7 @@ function bn(e) {
664
664
  pathParams: new URLSearchParams({ t: l }),
665
665
  useReconnectingWebsocket: !0
666
666
  };
667
- } else if (r) {
667
+ } else if (i) {
668
668
  const l = n.get("name") ?? "";
669
669
  return n.delete("simulator"), n.delete("name"), {
670
670
  path: `/simulator/${encodeURIComponent(l)}`,
@@ -741,34 +741,34 @@ class zn extends Event {
741
741
  }
742
742
  // @__NO_SIDE_EFFECTS__
743
743
  function m(e, t, n) {
744
- function o(l, p) {
744
+ function o(l, d) {
745
745
  if (l._zod || Object.defineProperty(l, "_zod", {
746
746
  value: {
747
- def: p,
747
+ def: d,
748
748
  constr: c,
749
749
  traits: /* @__PURE__ */ new Set()
750
750
  },
751
751
  enumerable: !1
752
752
  }), l._zod.traits.has(e))
753
753
  return;
754
- l._zod.traits.add(e), t(l, p);
755
- const h = c.prototype, y = Object.keys(h);
754
+ l._zod.traits.add(e), t(l, d);
755
+ const f = c.prototype, y = Object.keys(f);
756
756
  for (let g = 0; g < y.length; g++) {
757
- const i = y[g];
758
- i in l || (l[i] = h[i].bind(l));
757
+ const r = y[g];
758
+ r in l || (l[r] = f[r].bind(l));
759
759
  }
760
760
  }
761
- const r = n?.Parent ?? Object;
762
- class a extends r {
761
+ const i = n?.Parent ?? Object;
762
+ class a extends i {
763
763
  }
764
764
  Object.defineProperty(a, "name", { value: e });
765
765
  function c(l) {
766
- var p;
767
- const h = n?.Parent ? new a() : this;
768
- o(h, l), (p = h._zod).deferred ?? (p.deferred = []);
769
- for (const y of h._zod.deferred)
766
+ var d;
767
+ const f = n?.Parent ? new a() : this;
768
+ o(f, l), (d = f._zod).deferred ?? (d.deferred = []);
769
+ for (const y of f._zod.deferred)
770
770
  y();
771
- return h;
771
+ return f;
772
772
  }
773
773
  return Object.defineProperty(c, "init", { value: o }), Object.defineProperty(c, Symbol.hasInstance, {
774
774
  value: (l) => n?.Parent && l instanceof n.Parent ? !0 : l?._zod?.traits?.has(e)
@@ -790,7 +790,7 @@ function j(e) {
790
790
  }
791
791
  function In(e) {
792
792
  const t = Object.values(e).filter((o) => typeof o == "number");
793
- return Object.entries(e).filter(([o, r]) => t.indexOf(+o) === -1).map(([o, r]) => r);
793
+ return Object.entries(e).filter(([o, i]) => t.indexOf(+o) === -1).map(([o, i]) => i);
794
794
  }
795
795
  function Ze(e, t) {
796
796
  return typeof t == "bigint" ? t.toString() : t;
@@ -814,12 +814,12 @@ function Ne(e) {
814
814
  }
815
815
  function $n(e, t) {
816
816
  const n = (e.toString().split(".")[1] || "").length, o = t.toString();
817
- let r = (o.split(".")[1] || "").length;
818
- if (r === 0 && /\d?e-\d?/.test(o)) {
819
- const p = o.match(/\d?e-(\d?)/);
820
- p?.[1] && (r = Number.parseInt(p[1]));
817
+ let i = (o.split(".")[1] || "").length;
818
+ if (i === 0 && /\d?e-\d?/.test(o)) {
819
+ const d = o.match(/\d?e-(\d?)/);
820
+ d?.[1] && (i = Number.parseInt(d[1]));
821
821
  }
822
- const a = n > r ? n : r, c = Number.parseInt(e.toFixed(a).replace(".", "")), l = Number.parseInt(t.toFixed(a).replace(".", ""));
822
+ const a = n > i ? n : i, c = Number.parseInt(e.toFixed(a).replace(".", "")), l = Number.parseInt(t.toFixed(a).replace(".", ""));
823
823
  return c % l / 10 ** a;
824
824
  }
825
825
  const Je = Symbol("evaluating");
@@ -830,9 +830,9 @@ function C(e, t, n) {
830
830
  if (o !== Je)
831
831
  return o === void 0 && (o = Je, o = n()), o;
832
832
  },
833
- set(r) {
833
+ set(i) {
834
834
  Object.defineProperty(e, t, {
835
- value: r
835
+ value: i
836
836
  // configurable: true,
837
837
  });
838
838
  },
@@ -922,13 +922,13 @@ const Ln = {
922
922
  function Rn(e, t) {
923
923
  const n = e._zod.def, o = B(e._zod.def, {
924
924
  get shape() {
925
- const r = {};
925
+ const i = {};
926
926
  for (const a in t) {
927
927
  if (!(a in n.shape))
928
928
  throw new Error(`Unrecognized key: "${a}"`);
929
- t[a] && (r[a] = n.shape[a]);
929
+ t[a] && (i[a] = n.shape[a]);
930
930
  }
931
- return V(this, "shape", r), r;
931
+ return V(this, "shape", i), i;
932
932
  },
933
933
  checks: []
934
934
  });
@@ -937,13 +937,13 @@ function Rn(e, t) {
937
937
  function jn(e, t) {
938
938
  const n = e._zod.def, o = B(e._zod.def, {
939
939
  get shape() {
940
- const r = { ...e._zod.def.shape };
940
+ const i = { ...e._zod.def.shape };
941
941
  for (const a in t) {
942
942
  if (!(a in n.shape))
943
943
  throw new Error(`Unrecognized key: "${a}"`);
944
- t[a] && delete r[a];
944
+ t[a] && delete i[a];
945
945
  }
946
- return V(this, "shape", r), r;
946
+ return V(this, "shape", i), i;
947
947
  },
948
948
  checks: []
949
949
  });
@@ -955,14 +955,14 @@ function Nn(e, t) {
955
955
  const n = e._zod.def.checks;
956
956
  if (n && n.length > 0)
957
957
  throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
958
- const r = B(e._zod.def, {
958
+ const i = B(e._zod.def, {
959
959
  get shape() {
960
960
  const a = { ...e._zod.def.shape, ...t };
961
961
  return V(this, "shape", a), a;
962
962
  },
963
963
  checks: []
964
964
  });
965
- return D(e, r);
965
+ return D(e, i);
966
966
  }
967
967
  function Dn(e, t) {
968
968
  if (!H(t))
@@ -977,7 +977,7 @@ function Dn(e, t) {
977
977
  };
978
978
  return D(e, n);
979
979
  }
980
- function Fn(e, t) {
980
+ function Un(e, t) {
981
981
  const n = B(e._zod.def, {
982
982
  get shape() {
983
983
  const o = { ...e._zod.def.shape, ...t._zod.def.shape };
@@ -991,49 +991,49 @@ function Fn(e, t) {
991
991
  });
992
992
  return D(e, n);
993
993
  }
994
- function Mn(e, t, n) {
994
+ function Fn(e, t, n) {
995
995
  const o = B(t._zod.def, {
996
996
  get shape() {
997
- const r = t._zod.def.shape, a = { ...r };
997
+ const i = t._zod.def.shape, a = { ...i };
998
998
  if (n)
999
999
  for (const c in n) {
1000
- if (!(c in r))
1000
+ if (!(c in i))
1001
1001
  throw new Error(`Unrecognized key: "${c}"`);
1002
1002
  n[c] && (a[c] = e ? new e({
1003
1003
  type: "optional",
1004
- innerType: r[c]
1005
- }) : r[c]);
1004
+ innerType: i[c]
1005
+ }) : i[c]);
1006
1006
  }
1007
1007
  else
1008
- for (const c in r)
1008
+ for (const c in i)
1009
1009
  a[c] = e ? new e({
1010
1010
  type: "optional",
1011
- innerType: r[c]
1012
- }) : r[c];
1011
+ innerType: i[c]
1012
+ }) : i[c];
1013
1013
  return V(this, "shape", a), a;
1014
1014
  },
1015
1015
  checks: []
1016
1016
  });
1017
1017
  return D(t, o);
1018
1018
  }
1019
- function Un(e, t, n) {
1019
+ function Mn(e, t, n) {
1020
1020
  const o = B(t._zod.def, {
1021
1021
  get shape() {
1022
- const r = t._zod.def.shape, a = { ...r };
1022
+ const i = t._zod.def.shape, a = { ...i };
1023
1023
  if (n)
1024
1024
  for (const c in n) {
1025
1025
  if (!(c in a))
1026
1026
  throw new Error(`Unrecognized key: "${c}"`);
1027
1027
  n[c] && (a[c] = new e({
1028
1028
  type: "nonoptional",
1029
- innerType: r[c]
1029
+ innerType: i[c]
1030
1030
  }));
1031
1031
  }
1032
1032
  else
1033
- for (const c in r)
1033
+ for (const c in i)
1034
1034
  a[c] = new e({
1035
1035
  type: "nonoptional",
1036
- innerType: r[c]
1036
+ innerType: i[c]
1037
1037
  });
1038
1038
  return V(this, "shape", a), a;
1039
1039
  },
@@ -1049,7 +1049,7 @@ function q(e, t = 0) {
1049
1049
  return !0;
1050
1050
  return !1;
1051
1051
  }
1052
- function U(e, t) {
1052
+ function M(e, t) {
1053
1053
  return t.map((n) => {
1054
1054
  var o;
1055
1055
  return (o = n).path ?? (o.path = []), n.path.unshift(e), n;
@@ -1061,15 +1061,15 @@ function ae(e) {
1061
1061
  function N(e, t, n) {
1062
1062
  const o = { ...e, path: e.path ?? [] };
1063
1063
  if (!e.message) {
1064
- const r = ae(e.inst?._zod.def?.error?.(e)) ?? ae(t?.error?.(e)) ?? ae(n.customError?.(e)) ?? ae(n.localeError?.(e)) ?? "Invalid input";
1065
- o.message = r;
1064
+ const i = ae(e.inst?._zod.def?.error?.(e)) ?? ae(t?.error?.(e)) ?? ae(n.customError?.(e)) ?? ae(n.localeError?.(e)) ?? "Invalid input";
1065
+ o.message = i;
1066
1066
  }
1067
1067
  return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o;
1068
1068
  }
1069
1069
  function De(e) {
1070
1070
  return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
1071
1071
  }
1072
- function re(...e) {
1072
+ function ie(...e) {
1073
1073
  const [t, n, o] = e;
1074
1074
  return typeof t == "string" ? {
1075
1075
  message: t,
@@ -1092,13 +1092,13 @@ const Pt = (e, t) => {
1092
1092
  }, xt = /* @__PURE__ */ m("$ZodError", Pt), Lt = /* @__PURE__ */ m("$ZodError", Pt, { Parent: Error });
1093
1093
  function Vn(e, t = (n) => n.message) {
1094
1094
  const n = {}, o = [];
1095
- for (const r of e.issues)
1096
- r.path.length > 0 ? (n[r.path[0]] = n[r.path[0]] || [], n[r.path[0]].push(t(r))) : o.push(t(r));
1095
+ for (const i of e.issues)
1096
+ i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : o.push(t(i));
1097
1097
  return { formErrors: o, fieldErrors: n };
1098
1098
  }
1099
1099
  function Bn(e, t = (n) => n.message) {
1100
- const n = { _errors: [] }, o = (r) => {
1101
- for (const a of r.issues)
1100
+ const n = { _errors: [] }, o = (i) => {
1101
+ for (const a of i.issues)
1102
1102
  if (a.code === "invalid_union" && a.errors.length)
1103
1103
  a.errors.map((c) => o({ issues: c }));
1104
1104
  else if (a.code === "invalid_key")
@@ -1110,58 +1110,58 @@ function Bn(e, t = (n) => n.message) {
1110
1110
  else {
1111
1111
  let c = n, l = 0;
1112
1112
  for (; l < a.path.length; ) {
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++;
1113
+ const d = a.path[l];
1114
+ l === a.path.length - 1 ? (c[d] = c[d] || { _errors: [] }, c[d]._errors.push(t(a))) : c[d] = c[d] || { _errors: [] }, c = c[d], l++;
1115
1115
  }
1116
1116
  }
1117
1117
  };
1118
1118
  return o(e), n;
1119
1119
  }
1120
- const Fe = (e) => (t, n, o, r) => {
1120
+ const Ue = (e) => (t, n, o, i) => {
1121
1121
  const a = o ? Object.assign(o, { async: !1 }) : { async: !1 }, c = t._zod.run({ value: n, issues: [] }, a);
1122
1122
  if (c instanceof Promise)
1123
1123
  throw new K();
1124
1124
  if (c.issues.length) {
1125
- const l = new (r?.Err ?? e)(c.issues.map((p) => N(p, a, j())));
1126
- throw Ot(l, r?.callee), l;
1125
+ const l = new (i?.Err ?? e)(c.issues.map((d) => N(d, a, j())));
1126
+ throw Ot(l, i?.callee), l;
1127
1127
  }
1128
1128
  return c.value;
1129
- }, Me = (e) => async (t, n, o, r) => {
1129
+ }, Fe = (e) => async (t, n, o, i) => {
1130
1130
  const a = o ? Object.assign(o, { async: !0 }) : { async: !0 };
1131
1131
  let c = t._zod.run({ value: n, issues: [] }, a);
1132
1132
  if (c instanceof Promise && (c = await c), c.issues.length) {
1133
- const l = new (r?.Err ?? e)(c.issues.map((p) => N(p, a, j())));
1134
- throw Ot(l, r?.callee), l;
1133
+ const l = new (i?.Err ?? e)(c.issues.map((d) => N(d, a, j())));
1134
+ throw Ot(l, i?.callee), l;
1135
1135
  }
1136
1136
  return c.value;
1137
1137
  }, ve = (e) => (t, n, o) => {
1138
- const r = o ? { ...o, async: !1 } : { async: !1 }, a = t._zod.run({ value: n, issues: [] }, r);
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 ?? xt)(a.issues.map((c) => N(c, r, j())))
1143
+ error: new (e ?? xt)(a.issues.map((c) => N(c, i, j())))
1144
1144
  } : { success: !0, data: a.value };
1145
1145
  }, Gn = /* @__PURE__ */ ve(Lt), ge = (e) => async (t, n, o) => {
1146
- const r = o ? Object.assign(o, { async: !0 }) : { async: !0 };
1147
- let a = t._zod.run({ value: n, issues: [] }, r);
1146
+ const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
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, r, j())))
1150
+ error: new e(a.issues.map((c) => N(c, i, j())))
1151
1151
  } : { success: !0, data: a.value };
1152
1152
  }, Wn = /* @__PURE__ */ ge(Lt), qn = (e) => (t, n, o) => {
1153
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1154
- return Fe(e)(t, n, r);
1155
- }, Kn = (e) => (t, n, o) => Fe(e)(t, n, o), Hn = (e) => async (t, n, o) => {
1156
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1157
- return Me(e)(t, n, r);
1158
- }, Jn = (e) => async (t, n, o) => Me(e)(t, n, o), Yn = (e) => (t, n, o) => {
1159
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1160
- return ve(e)(t, n, r);
1153
+ const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1154
+ return Ue(e)(t, n, i);
1155
+ }, Kn = (e) => (t, n, o) => Ue(e)(t, n, o), Hn = (e) => async (t, n, o) => {
1156
+ const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1157
+ return Fe(e)(t, n, i);
1158
+ }, Jn = (e) => async (t, n, o) => Fe(e)(t, n, o), Yn = (e) => (t, n, o) => {
1159
+ const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1160
+ return ve(e)(t, n, i);
1161
1161
  }, Qn = (e) => (t, n, o) => ve(e)(t, n, o), Xn = (e) => async (t, n, o) => {
1162
- const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1163
- return ge(e)(t, n, r);
1164
- }, eo = (e) => async (t, n, o) => ge(e)(t, n, o), to = /^[cC][^\s-]{8,}$/, no = /^[0-9a-z]+$/, oo = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, io = /^[0-9a-vA-V]{20}$/, ro = /^[A-Za-z0-9]{27}$/, so = /^[a-zA-Z0-9_-]{21}$/, ao = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, uo = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Qe = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, co = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, lo = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1162
+ const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
1163
+ return ge(e)(t, n, i);
1164
+ }, eo = (e) => async (t, n, o) => ge(e)(t, n, o), to = /^[cC][^\s-]{8,}$/, no = /^[0-9a-z]+$/, oo = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, ro = /^[0-9a-vA-V]{20}$/, io = /^[A-Za-z0-9]{27}$/, so = /^[a-zA-Z0-9_-]{21}$/, ao = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, uo = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Qe = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, co = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, lo = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1165
1165
  function po() {
1166
1166
  return new RegExp(lo, "u");
1167
1167
  }
@@ -1189,12 +1189,12 @@ const Eo = (e) => {
1189
1189
  number: "number",
1190
1190
  bigint: "bigint",
1191
1191
  object: "date"
1192
- }, Ft = /* @__PURE__ */ m("$ZodCheckLessThan", (e, t) => {
1192
+ }, Ut = /* @__PURE__ */ m("$ZodCheckLessThan", (e, t) => {
1193
1193
  O.init(e, t);
1194
1194
  const n = Dt[typeof t.value];
1195
1195
  e._zod.onattach.push((o) => {
1196
- const r = o._zod.bag, a = (t.inclusive ? r.maximum : r.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
1197
- t.value < a && (t.inclusive ? r.maximum = t.value : r.exclusiveMaximum = t.value);
1196
+ const i = o._zod.bag, a = (t.inclusive ? i.maximum : i.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
1197
+ t.value < a && (t.inclusive ? i.maximum = t.value : i.exclusiveMaximum = t.value);
1198
1198
  }), e._zod.check = (o) => {
1199
1199
  (t.inclusive ? o.value <= t.value : o.value < t.value) || o.issues.push({
1200
1200
  origin: n,
@@ -1206,12 +1206,12 @@ const Eo = (e) => {
1206
1206
  continue: !t.abort
1207
1207
  });
1208
1208
  };
1209
- }), Mt = /* @__PURE__ */ m("$ZodCheckGreaterThan", (e, t) => {
1209
+ }), Ft = /* @__PURE__ */ m("$ZodCheckGreaterThan", (e, t) => {
1210
1210
  O.init(e, t);
1211
1211
  const n = Dt[typeof t.value];
1212
1212
  e._zod.onattach.push((o) => {
1213
- const r = o._zod.bag, a = (t.inclusive ? r.minimum : r.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
1214
- t.value > a && (t.inclusive ? r.minimum = t.value : r.exclusiveMinimum = t.value);
1213
+ const i = o._zod.bag, a = (t.inclusive ? i.minimum : i.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
1214
+ t.value > a && (t.inclusive ? i.minimum = t.value : i.exclusiveMinimum = t.value);
1215
1215
  }), e._zod.check = (o) => {
1216
1216
  (t.inclusive ? o.value >= t.value : o.value > t.value) || o.issues.push({
1217
1217
  origin: n,
@@ -1241,10 +1241,10 @@ const Eo = (e) => {
1241
1241
  };
1242
1242
  }), Io = /* @__PURE__ */ m("$ZodCheckNumberFormat", (e, t) => {
1243
1243
  O.init(e, t), t.format = t.format || "float64";
1244
- const n = t.format?.includes("int"), o = n ? "int" : "number", [r, a] = Ln[t.format];
1244
+ const n = t.format?.includes("int"), o = n ? "int" : "number", [i, a] = Ln[t.format];
1245
1245
  e._zod.onattach.push((c) => {
1246
1246
  const l = c._zod.bag;
1247
- l.format = t.format, l.minimum = r, l.maximum = a, n && (l.pattern = ko);
1247
+ l.format = t.format, l.minimum = i, l.maximum = a, n && (l.pattern = ko);
1248
1248
  }), e._zod.check = (c) => {
1249
1249
  const l = c.value;
1250
1250
  if (n) {
@@ -1280,11 +1280,11 @@ const Eo = (e) => {
1280
1280
  return;
1281
1281
  }
1282
1282
  }
1283
- l < r && c.issues.push({
1283
+ l < i && c.issues.push({
1284
1284
  origin: "number",
1285
1285
  input: l,
1286
1286
  code: "too_small",
1287
- minimum: r,
1287
+ minimum: i,
1288
1288
  inclusive: !0,
1289
1289
  inst: e,
1290
1290
  continue: !t.abort
@@ -1299,22 +1299,22 @@ const Eo = (e) => {
1299
1299
  }), $o = /* @__PURE__ */ m("$ZodCheckMaxLength", (e, t) => {
1300
1300
  var n;
1301
1301
  O.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
1302
- const r = o.value;
1303
- return !je(r) && r.length !== void 0;
1302
+ const i = o.value;
1303
+ return !je(i) && i.length !== void 0;
1304
1304
  }), e._zod.onattach.push((o) => {
1305
- const r = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1306
- t.maximum < r && (o._zod.bag.maximum = t.maximum);
1305
+ const i = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1306
+ t.maximum < i && (o._zod.bag.maximum = t.maximum);
1307
1307
  }), e._zod.check = (o) => {
1308
- const r = o.value;
1309
- if (r.length <= t.maximum)
1308
+ const i = o.value;
1309
+ if (i.length <= t.maximum)
1310
1310
  return;
1311
- const c = De(r);
1311
+ const c = De(i);
1312
1312
  o.issues.push({
1313
1313
  origin: c,
1314
1314
  code: "too_big",
1315
1315
  maximum: t.maximum,
1316
1316
  inclusive: !0,
1317
- input: r,
1317
+ input: i,
1318
1318
  inst: e,
1319
1319
  continue: !t.abort
1320
1320
  });
@@ -1322,22 +1322,22 @@ const Eo = (e) => {
1322
1322
  }), Oo = /* @__PURE__ */ m("$ZodCheckMinLength", (e, t) => {
1323
1323
  var n;
1324
1324
  O.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
1325
- const r = o.value;
1326
- return !je(r) && r.length !== void 0;
1325
+ const i = o.value;
1326
+ return !je(i) && i.length !== void 0;
1327
1327
  }), e._zod.onattach.push((o) => {
1328
- const r = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1329
- t.minimum > r && (o._zod.bag.minimum = t.minimum);
1328
+ const i = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1329
+ t.minimum > i && (o._zod.bag.minimum = t.minimum);
1330
1330
  }), e._zod.check = (o) => {
1331
- const r = o.value;
1332
- if (r.length >= t.minimum)
1331
+ const i = o.value;
1332
+ if (i.length >= t.minimum)
1333
1333
  return;
1334
- const c = De(r);
1334
+ const c = De(i);
1335
1335
  o.issues.push({
1336
1336
  origin: c,
1337
1337
  code: "too_small",
1338
1338
  minimum: t.minimum,
1339
1339
  inclusive: !0,
1340
- input: r,
1340
+ input: i,
1341
1341
  inst: e,
1342
1342
  continue: !t.abort
1343
1343
  });
@@ -1345,16 +1345,16 @@ const Eo = (e) => {
1345
1345
  }), Zo = /* @__PURE__ */ m("$ZodCheckLengthEquals", (e, t) => {
1346
1346
  var n;
1347
1347
  O.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
1348
- const r = o.value;
1349
- return !je(r) && r.length !== void 0;
1348
+ const i = o.value;
1349
+ return !je(i) && i.length !== void 0;
1350
1350
  }), e._zod.onattach.push((o) => {
1351
- const r = o._zod.bag;
1352
- r.minimum = t.length, r.maximum = t.length, r.length = t.length;
1351
+ const i = o._zod.bag;
1352
+ i.minimum = t.length, i.maximum = t.length, i.length = t.length;
1353
1353
  }), e._zod.check = (o) => {
1354
- const r = o.value, a = r.length;
1354
+ const i = o.value, a = i.length;
1355
1355
  if (a === t.length)
1356
1356
  return;
1357
- const c = De(r), l = a > t.length;
1357
+ const c = De(i), l = a > t.length;
1358
1358
  o.issues.push({
1359
1359
  origin: c,
1360
1360
  ...l ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
@@ -1367,15 +1367,15 @@ const Eo = (e) => {
1367
1367
  };
1368
1368
  }), ye = /* @__PURE__ */ m("$ZodCheckStringFormat", (e, t) => {
1369
1369
  var n, o;
1370
- O.init(e, t), e._zod.onattach.push((r) => {
1371
- const a = r._zod.bag;
1370
+ O.init(e, t), e._zod.onattach.push((i) => {
1371
+ const a = i._zod.bag;
1372
1372
  a.format = t.format, t.pattern && (a.patterns ?? (a.patterns = /* @__PURE__ */ new Set()), a.patterns.add(t.pattern));
1373
- }), t.pattern ? (n = e._zod).check ?? (n.check = (r) => {
1374
- t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({
1373
+ }), t.pattern ? (n = e._zod).check ?? (n.check = (i) => {
1374
+ t.pattern.lastIndex = 0, !t.pattern.test(i.value) && i.issues.push({
1375
1375
  origin: "string",
1376
1376
  code: "invalid_format",
1377
1377
  format: t.format,
1378
- input: r.value,
1378
+ input: i.value,
1379
1379
  ...t.pattern ? { pattern: t.pattern.toString() } : {},
1380
1380
  inst: e,
1381
1381
  continue: !t.abort
@@ -1401,16 +1401,16 @@ const Eo = (e) => {
1401
1401
  }), Ro = /* @__PURE__ */ m("$ZodCheckIncludes", (e, t) => {
1402
1402
  O.init(e, t);
1403
1403
  const n = J(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
1404
- t.pattern = o, e._zod.onattach.push((r) => {
1405
- const a = r._zod.bag;
1404
+ t.pattern = o, e._zod.onattach.push((i) => {
1405
+ const a = i._zod.bag;
1406
1406
  a.patterns ?? (a.patterns = /* @__PURE__ */ new Set()), a.patterns.add(o);
1407
- }), e._zod.check = (r) => {
1408
- r.value.includes(t.includes, t.position) || r.issues.push({
1407
+ }), e._zod.check = (i) => {
1408
+ i.value.includes(t.includes, t.position) || i.issues.push({
1409
1409
  origin: "string",
1410
1410
  code: "invalid_format",
1411
1411
  format: "includes",
1412
1412
  includes: t.includes,
1413
- input: r.value,
1413
+ input: i.value,
1414
1414
  inst: e,
1415
1415
  continue: !t.abort
1416
1416
  });
@@ -1419,8 +1419,8 @@ const Eo = (e) => {
1419
1419
  O.init(e, t);
1420
1420
  const n = new RegExp(`^${J(t.prefix)}.*`);
1421
1421
  t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
1422
- const r = o._zod.bag;
1423
- r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
1422
+ const i = o._zod.bag;
1423
+ i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(n);
1424
1424
  }), e._zod.check = (o) => {
1425
1425
  o.value.startsWith(t.prefix) || o.issues.push({
1426
1426
  origin: "string",
@@ -1436,8 +1436,8 @@ const Eo = (e) => {
1436
1436
  O.init(e, t);
1437
1437
  const n = new RegExp(`.*${J(t.suffix)}$`);
1438
1438
  t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
1439
- const r = o._zod.bag;
1440
- r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
1439
+ const i = o._zod.bag;
1440
+ i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(n);
1441
1441
  }), e._zod.check = (o) => {
1442
1442
  o.value.endsWith(t.suffix) || o.issues.push({
1443
1443
  origin: "string",
@@ -1454,7 +1454,7 @@ const Eo = (e) => {
1454
1454
  n.value = t.tx(n.value);
1455
1455
  };
1456
1456
  });
1457
- class Fo {
1457
+ class Uo {
1458
1458
  constructor(t = []) {
1459
1459
  this.content = [], this.indent = 0, this && (this.args = t);
1460
1460
  }
@@ -1467,95 +1467,95 @@ class Fo {
1467
1467
  return;
1468
1468
  }
1469
1469
  const o = t.split(`
1470
- `).filter((c) => c), r = Math.min(...o.map((c) => c.length - c.trimStart().length)), a = o.map((c) => c.slice(r)).map((c) => " ".repeat(this.indent * 2) + c);
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
1471
  for (const c of a)
1472
1472
  this.content.push(c);
1473
1473
  }
1474
1474
  compile() {
1475
- const t = Function, n = this?.args, r = [...(this?.content ?? [""]).map((a) => ` ${a}`)];
1476
- return new t(...n, r.join(`
1475
+ const t = Function, n = this?.args, i = [...(this?.content ?? [""]).map((a) => ` ${a}`)];
1476
+ return new t(...n, i.join(`
1477
1477
  `));
1478
1478
  }
1479
1479
  }
1480
- const Mo = {
1480
+ const Fo = {
1481
1481
  major: 4,
1482
1482
  minor: 1,
1483
1483
  patch: 13
1484
1484
  }, A = /* @__PURE__ */ m("$ZodType", (e, t) => {
1485
1485
  var n;
1486
- e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Mo;
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 ?? []];
1488
1488
  e._zod.traits.has("$ZodCheck") && o.unshift(e);
1489
- for (const r of o)
1490
- for (const a of r._zod.onattach)
1489
+ for (const i of o)
1490
+ for (const a of i._zod.onattach)
1491
1491
  a(e);
1492
1492
  if (o.length === 0)
1493
1493
  (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
1494
1494
  e._zod.run = e._zod.parse;
1495
1495
  });
1496
1496
  else {
1497
- const r = (c, l, p) => {
1498
- let h = q(c), y;
1497
+ const i = (c, l, d) => {
1498
+ let f = q(c), y;
1499
1499
  for (const g of l) {
1500
1500
  if (g._zod.def.when) {
1501
1501
  if (!g._zod.def.when(c))
1502
1502
  continue;
1503
- } else if (h)
1503
+ } else if (f)
1504
1504
  continue;
1505
- const i = c.issues.length, s = g._zod.check(c);
1506
- if (s instanceof Promise && p?.async === !1)
1505
+ const r = c.issues.length, s = g._zod.check(c);
1506
+ if (s instanceof Promise && d?.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 !== i && (h || (h = q(c, i)));
1510
+ await s, c.issues.length !== r && (f || (f = q(c, r)));
1511
1511
  });
1512
1512
  else {
1513
- if (c.issues.length === i)
1513
+ if (c.issues.length === r)
1514
1514
  continue;
1515
- h || (h = q(c, i));
1515
+ f || (f = q(c, r));
1516
1516
  }
1517
1517
  }
1518
1518
  return y ? y.then(() => c) : c;
1519
- }, a = (c, l, p) => {
1519
+ }, a = (c, l, d) => {
1520
1520
  if (q(c))
1521
1521
  return c.aborted = !0, c;
1522
- const h = r(l, o, p);
1523
- if (h instanceof Promise) {
1524
- if (p.async === !1)
1522
+ const f = i(l, o, d);
1523
+ if (f instanceof Promise) {
1524
+ if (d.async === !1)
1525
1525
  throw new K();
1526
- return h.then((y) => e._zod.parse(y, p));
1526
+ return f.then((y) => e._zod.parse(y, d));
1527
1527
  }
1528
- return e._zod.parse(h, p);
1528
+ return e._zod.parse(f, d);
1529
1529
  };
1530
1530
  e._zod.run = (c, l) => {
1531
1531
  if (l.skipChecks)
1532
1532
  return e._zod.parse(c, 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 f = e._zod.parse({ value: c.value, issues: [] }, { ...l, skipChecks: !0 });
1535
+ return f instanceof Promise ? f.then((y) => a(y, c, l)) : a(f, c, l);
1536
1536
  }
1537
- const p = e._zod.parse(c, l);
1538
- if (p instanceof Promise) {
1537
+ const d = e._zod.parse(c, l);
1538
+ if (d instanceof Promise) {
1539
1539
  if (l.async === !1)
1540
1540
  throw new K();
1541
- return p.then((h) => r(h, o, l));
1541
+ return d.then((f) => i(f, o, l));
1542
1542
  }
1543
- return r(p, o, l);
1543
+ return i(d, o, l);
1544
1544
  };
1545
1545
  }
1546
1546
  e["~standard"] = {
1547
- validate: (r) => {
1547
+ validate: (i) => {
1548
1548
  try {
1549
- const a = Gn(e, r);
1549
+ const a = Gn(e, i);
1550
1550
  return a.success ? { value: a.data } : { issues: a.error?.issues };
1551
1551
  } catch {
1552
- return Wn(e, r).then((c) => c.success ? { value: c.data } : { issues: c.error?.issues });
1552
+ return Wn(e, i).then((c) => c.success ? { value: c.data } : { issues: c.error?.issues });
1553
1553
  }
1554
1554
  },
1555
1555
  vendor: "zod",
1556
1556
  version: 1
1557
1557
  };
1558
- }), Ue = /* @__PURE__ */ m("$ZodString", (e, t) => {
1558
+ }), Me = /* @__PURE__ */ m("$ZodString", (e, t) => {
1559
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 {
@@ -1570,8 +1570,8 @@ const Mo = {
1570
1570
  }), n;
1571
1571
  };
1572
1572
  }), z = /* @__PURE__ */ m("$ZodStringFormat", (e, t) => {
1573
- ye.init(e, t), Ue.init(e, t);
1574
- }), Uo = /* @__PURE__ */ m("$ZodGUID", (e, t) => {
1573
+ ye.init(e, t), Me.init(e, t);
1574
+ }), Mo = /* @__PURE__ */ m("$ZodGUID", (e, t) => {
1575
1575
  t.pattern ?? (t.pattern = uo), z.init(e, t);
1576
1576
  }), Vo = /* @__PURE__ */ m("$ZodUUID", (e, t) => {
1577
1577
  if (t.version) {
@@ -1596,8 +1596,8 @@ const Mo = {
1596
1596
  }), Go = /* @__PURE__ */ m("$ZodURL", (e, t) => {
1597
1597
  z.init(e, t), e._zod.check = (n) => {
1598
1598
  try {
1599
- const o = n.value.trim(), r = new URL(o);
1600
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(r.hostname) || n.issues.push({
1599
+ const o = n.value.trim(), i = new URL(o);
1600
+ t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(i.hostname) || n.issues.push({
1601
1601
  code: "invalid_format",
1602
1602
  format: "url",
1603
1603
  note: "Invalid hostname",
@@ -1605,7 +1605,7 @@ const Mo = {
1605
1605
  input: n.value,
1606
1606
  inst: e,
1607
1607
  continue: !t.abort
1608
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(r.protocol.endsWith(":") ? r.protocol.slice(0, -1) : r.protocol) || n.issues.push({
1608
+ })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || n.issues.push({
1609
1609
  code: "invalid_format",
1610
1610
  format: "url",
1611
1611
  note: "Invalid protocol",
@@ -1613,7 +1613,7 @@ const Mo = {
1613
1613
  input: n.value,
1614
1614
  inst: e,
1615
1615
  continue: !t.abort
1616
- })), t.normalize ? n.value = r.href : n.value = o;
1616
+ })), t.normalize ? n.value = i.href : n.value = o;
1617
1617
  return;
1618
1618
  } catch {
1619
1619
  n.issues.push({
@@ -1636,20 +1636,20 @@ const Mo = {
1636
1636
  }), Jo = /* @__PURE__ */ m("$ZodULID", (e, t) => {
1637
1637
  t.pattern ?? (t.pattern = oo), z.init(e, t);
1638
1638
  }), Yo = /* @__PURE__ */ m("$ZodXID", (e, t) => {
1639
- t.pattern ?? (t.pattern = io), z.init(e, t);
1640
- }), Qo = /* @__PURE__ */ m("$ZodKSUID", (e, t) => {
1641
1639
  t.pattern ?? (t.pattern = ro), z.init(e, t);
1640
+ }), Qo = /* @__PURE__ */ m("$ZodKSUID", (e, t) => {
1641
+ t.pattern ?? (t.pattern = io), z.init(e, t);
1642
1642
  }), Xo = /* @__PURE__ */ m("$ZodISODateTime", (e, t) => {
1643
1643
  t.pattern ?? (t.pattern = wo(t)), z.init(e, t);
1644
- }), ei = /* @__PURE__ */ m("$ZodISODate", (e, t) => {
1644
+ }), er = /* @__PURE__ */ m("$ZodISODate", (e, t) => {
1645
1645
  t.pattern ?? (t.pattern = yo), z.init(e, t);
1646
- }), ti = /* @__PURE__ */ m("$ZodISOTime", (e, t) => {
1646
+ }), tr = /* @__PURE__ */ m("$ZodISOTime", (e, t) => {
1647
1647
  t.pattern ?? (t.pattern = bo(t)), z.init(e, t);
1648
- }), ni = /* @__PURE__ */ m("$ZodISODuration", (e, t) => {
1648
+ }), nr = /* @__PURE__ */ m("$ZodISODuration", (e, t) => {
1649
1649
  t.pattern ?? (t.pattern = ao), z.init(e, t);
1650
- }), oi = /* @__PURE__ */ m("$ZodIPv4", (e, t) => {
1650
+ }), or = /* @__PURE__ */ m("$ZodIPv4", (e, t) => {
1651
1651
  t.pattern ?? (t.pattern = ho), z.init(e, t), e._zod.bag.format = "ipv4";
1652
- }), ii = /* @__PURE__ */ m("$ZodIPv6", (e, t) => {
1652
+ }), rr = /* @__PURE__ */ m("$ZodIPv6", (e, t) => {
1653
1653
  t.pattern ?? (t.pattern = fo), z.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
1654
1654
  try {
1655
1655
  new URL(`http://[${n.value}]`);
@@ -1663,15 +1663,15 @@ const Mo = {
1663
1663
  });
1664
1664
  }
1665
1665
  };
1666
- }), ri = /* @__PURE__ */ m("$ZodCIDRv4", (e, t) => {
1666
+ }), ir = /* @__PURE__ */ m("$ZodCIDRv4", (e, t) => {
1667
1667
  t.pattern ?? (t.pattern = _o), z.init(e, t);
1668
- }), si = /* @__PURE__ */ m("$ZodCIDRv6", (e, t) => {
1668
+ }), sr = /* @__PURE__ */ m("$ZodCIDRv6", (e, t) => {
1669
1669
  t.pattern ?? (t.pattern = mo), z.init(e, t), e._zod.check = (n) => {
1670
1670
  const o = n.value.split("/");
1671
1671
  try {
1672
1672
  if (o.length !== 2)
1673
1673
  throw new Error();
1674
- const [r, a] = o;
1674
+ const [i, a] = o;
1675
1675
  if (!a)
1676
1676
  throw new Error();
1677
1677
  const c = Number(a);
@@ -1679,7 +1679,7 @@ const Mo = {
1679
1679
  throw new Error();
1680
1680
  if (c < 0 || c > 128)
1681
1681
  throw new Error();
1682
- new URL(`http://[${r}]`);
1682
+ new URL(`http://[${i}]`);
1683
1683
  } catch {
1684
1684
  n.issues.push({
1685
1685
  code: "invalid_format",
@@ -1691,7 +1691,7 @@ const Mo = {
1691
1691
  }
1692
1692
  };
1693
1693
  });
1694
- function Ut(e) {
1694
+ function Mt(e) {
1695
1695
  if (e === "")
1696
1696
  return !0;
1697
1697
  if (e.length % 4 !== 0)
@@ -1702,9 +1702,9 @@ function Ut(e) {
1702
1702
  return !1;
1703
1703
  }
1704
1704
  }
1705
- const ai = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
1705
+ const ar = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
1706
1706
  t.pattern ?? (t.pattern = vo), z.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
1707
- Ut(n.value) || n.issues.push({
1707
+ Mt(n.value) || n.issues.push({
1708
1708
  code: "invalid_format",
1709
1709
  format: "base64",
1710
1710
  input: n.value,
@@ -1713,15 +1713,15 @@ const ai = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
1713
1713
  });
1714
1714
  };
1715
1715
  });
1716
- function ui(e) {
1716
+ function ur(e) {
1717
1717
  if (!Rt.test(e))
1718
1718
  return !1;
1719
1719
  const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
1720
- return Ut(n);
1720
+ return Mt(n);
1721
1721
  }
1722
- const ci = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
1722
+ const cr = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
1723
1723
  t.pattern ?? (t.pattern = Rt), z.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
1724
- ui(n.value) || n.issues.push({
1724
+ ur(n.value) || n.issues.push({
1725
1725
  code: "invalid_format",
1726
1726
  format: "base64url",
1727
1727
  input: n.value,
@@ -1729,10 +1729,10 @@ const ci = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
1729
1729
  continue: !t.abort
1730
1730
  });
1731
1731
  };
1732
- }), li = /* @__PURE__ */ m("$ZodE164", (e, t) => {
1732
+ }), lr = /* @__PURE__ */ m("$ZodE164", (e, t) => {
1733
1733
  t.pattern ?? (t.pattern = go), z.init(e, t);
1734
1734
  });
1735
- function di(e, t = null) {
1735
+ function dr(e, t = null) {
1736
1736
  try {
1737
1737
  const n = e.split(".");
1738
1738
  if (n.length !== 3)
@@ -1740,15 +1740,15 @@ function di(e, t = null) {
1740
1740
  const [o] = n;
1741
1741
  if (!o)
1742
1742
  return !1;
1743
- const r = JSON.parse(atob(o));
1744
- return !("typ" in r && r?.typ !== "JWT" || !r.alg || t && (!("alg" in r) || r.alg !== t));
1743
+ const i = JSON.parse(atob(o));
1744
+ return !("typ" in i && i?.typ !== "JWT" || !i.alg || t && (!("alg" in i) || i.alg !== t));
1745
1745
  } catch {
1746
1746
  return !1;
1747
1747
  }
1748
1748
  }
1749
- const pi = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1749
+ const pr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1750
1750
  z.init(e, t), e._zod.check = (n) => {
1751
- di(n.value, t.alg) || n.issues.push({
1751
+ dr(n.value, t.alg) || n.issues.push({
1752
1752
  code: "invalid_format",
1753
1753
  format: "jwt",
1754
1754
  input: n.value,
@@ -1763,33 +1763,33 @@ const pi = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1763
1763
  n.value = Number(n.value);
1764
1764
  } catch {
1765
1765
  }
1766
- const r = n.value;
1767
- if (typeof r == "number" && !Number.isNaN(r) && Number.isFinite(r))
1766
+ const i = n.value;
1767
+ if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i))
1768
1768
  return n;
1769
- const a = typeof r == "number" ? Number.isNaN(r) ? "NaN" : Number.isFinite(r) ? void 0 : "Infinity" : void 0;
1769
+ const a = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : "Infinity" : void 0;
1770
1770
  return n.issues.push({
1771
1771
  expected: "number",
1772
1772
  code: "invalid_type",
1773
- input: r,
1773
+ input: i,
1774
1774
  inst: e,
1775
1775
  ...a ? { received: a } : {}
1776
1776
  }), n;
1777
1777
  };
1778
- }), hi = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
1778
+ }), hr = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
1779
1779
  Io.init(e, t), Vt.init(e, t);
1780
- }), fi = /* @__PURE__ */ m("$ZodNull", (e, t) => {
1780
+ }), fr = /* @__PURE__ */ m("$ZodNull", (e, t) => {
1781
1781
  A.init(e, t), e._zod.pattern = Ao, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (n, o) => {
1782
- const r = n.value;
1783
- return r === null || n.issues.push({
1782
+ const i = n.value;
1783
+ return i === null || n.issues.push({
1784
1784
  expected: "null",
1785
1785
  code: "invalid_type",
1786
- input: r,
1786
+ input: i,
1787
1787
  inst: e
1788
1788
  }), n;
1789
1789
  };
1790
- }), _i = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
1790
+ }), _r = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
1791
1791
  A.init(e, t), e._zod.parse = (n) => n;
1792
- }), mi = /* @__PURE__ */ m("$ZodNever", (e, t) => {
1792
+ }), mr = /* @__PURE__ */ m("$ZodNever", (e, t) => {
1793
1793
  A.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
1794
1794
  expected: "never",
1795
1795
  code: "invalid_type",
@@ -1798,32 +1798,32 @@ const pi = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
1798
1798
  }), n);
1799
1799
  });
1800
1800
  function Xe(e, t, n) {
1801
- e.issues.length && t.issues.push(...U(n, e.issues)), t.value[n] = e.value;
1801
+ e.issues.length && t.issues.push(...M(n, e.issues)), t.value[n] = e.value;
1802
1802
  }
1803
- const vi = /* @__PURE__ */ m("$ZodArray", (e, t) => {
1803
+ const vr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
1804
1804
  A.init(e, t), e._zod.parse = (n, o) => {
1805
- const r = n.value;
1806
- if (!Array.isArray(r))
1805
+ const i = n.value;
1806
+ if (!Array.isArray(i))
1807
1807
  return n.issues.push({
1808
1808
  expected: "array",
1809
1809
  code: "invalid_type",
1810
- input: r,
1810
+ input: i,
1811
1811
  inst: e
1812
1812
  }), n;
1813
- n.value = Array(r.length);
1813
+ n.value = Array(i.length);
1814
1814
  const a = [];
1815
- for (let c = 0; c < r.length; c++) {
1816
- const l = r[c], p = t.element._zod.run({
1815
+ for (let c = 0; c < i.length; c++) {
1816
+ const l = i[c], d = t.element._zod.run({
1817
1817
  value: l,
1818
1818
  issues: []
1819
1819
  }, o);
1820
- p instanceof Promise ? a.push(p.then((h) => Xe(h, n, c))) : Xe(p, n, c);
1820
+ d instanceof Promise ? a.push(d.then((f) => Xe(f, n, c))) : Xe(d, n, c);
1821
1821
  }
1822
1822
  return a.length ? Promise.all(a).then(() => n) : n;
1823
1823
  };
1824
1824
  });
1825
1825
  function fe(e, t, n, o) {
1826
- e.issues.length && t.issues.push(...U(n, e.issues)), e.value === void 0 ? n in o && (t.value[n] = void 0) : t.value[n] = e.value;
1826
+ e.issues.length && t.issues.push(...M(n, e.issues)), e.value === void 0 ? n in o && (t.value[n] = void 0) : t.value[n] = e.value;
1827
1827
  }
1828
1828
  function Bt(e) {
1829
1829
  const t = Object.keys(e.shape);
@@ -1839,17 +1839,17 @@ function Bt(e) {
1839
1839
  optionalKeys: new Set(n)
1840
1840
  };
1841
1841
  }
1842
- function Gt(e, t, n, o, r, a) {
1843
- const c = [], l = r.keySet, p = r.catchall._zod, h = p.def.type;
1842
+ function Gt(e, t, n, o, i, a) {
1843
+ const c = [], l = i.keySet, d = i.catchall._zod, f = d.def.type;
1844
1844
  for (const y in t) {
1845
1845
  if (l.has(y))
1846
1846
  continue;
1847
- if (h === "never") {
1847
+ if (f === "never") {
1848
1848
  c.push(y);
1849
1849
  continue;
1850
1850
  }
1851
- const g = p.run({ value: t[y], issues: [] }, o);
1852
- g instanceof Promise ? e.push(g.then((i) => fe(i, n, y, t))) : fe(g, n, y, t);
1851
+ const g = d.run({ value: t[y], issues: [] }, o);
1852
+ g instanceof Promise ? e.push(g.then((r) => fe(r, n, y, t))) : fe(g, n, y, t);
1853
1853
  }
1854
1854
  return c.length && n.issues.push({
1855
1855
  code: "unrecognized_keys",
@@ -1858,67 +1858,67 @@ function Gt(e, t, n, o, r, a) {
1858
1858
  inst: a
1859
1859
  }), e.length ? Promise.all(e).then(() => n) : n;
1860
1860
  }
1861
- const gi = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1861
+ const gr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1862
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: () => {
1866
- const p = { ...l };
1866
+ const d = { ...l };
1867
1867
  return Object.defineProperty(t, "shape", {
1868
- value: p
1869
- }), p;
1868
+ value: d
1869
+ }), d;
1870
1870
  }
1871
1871
  });
1872
1872
  }
1873
1873
  const o = Re(() => Bt(t));
1874
1874
  C(e._zod, "propValues", () => {
1875
- const l = t.shape, p = {};
1876
- for (const h in l) {
1877
- const y = l[h]._zod;
1875
+ const l = t.shape, d = {};
1876
+ for (const f in l) {
1877
+ const y = l[f]._zod;
1878
1878
  if (y.values) {
1879
- p[h] ?? (p[h] = /* @__PURE__ */ new Set());
1879
+ d[f] ?? (d[f] = /* @__PURE__ */ new Set());
1880
1880
  for (const g of y.values)
1881
- p[h].add(g);
1881
+ d[f].add(g);
1882
1882
  }
1883
1883
  }
1884
- return p;
1884
+ return d;
1885
1885
  });
1886
- const r = he, a = t.catchall;
1886
+ const i = he, a = t.catchall;
1887
1887
  let c;
1888
- e._zod.parse = (l, p) => {
1888
+ e._zod.parse = (l, d) => {
1889
1889
  c ?? (c = o.value);
1890
- const h = l.value;
1891
- if (!r(h))
1890
+ const f = l.value;
1891
+ if (!i(f))
1892
1892
  return l.issues.push({
1893
1893
  expected: "object",
1894
1894
  code: "invalid_type",
1895
- input: h,
1895
+ input: f,
1896
1896
  inst: e
1897
1897
  }), l;
1898
1898
  l.value = {};
1899
1899
  const y = [], g = c.shape;
1900
- for (const i of c.keys) {
1901
- const u = g[i]._zod.run({ value: h[i], issues: [] }, p);
1902
- u instanceof Promise ? y.push(u.then((d) => fe(d, l, i, h))) : fe(u, l, i, h);
1900
+ for (const r of c.keys) {
1901
+ const u = g[r]._zod.run({ value: f[r], issues: [] }, d);
1902
+ u instanceof Promise ? y.push(u.then((p) => fe(p, l, r, f))) : fe(u, l, r, f);
1903
1903
  }
1904
- return a ? Gt(y, h, l, p, o.value, e) : y.length ? Promise.all(y).then(() => l) : l;
1904
+ return a ? Gt(y, f, l, d, o.value, e) : y.length ? Promise.all(y).then(() => l) : l;
1905
1905
  };
1906
- }), yi = /* @__PURE__ */ m("$ZodObjectJIT", (e, t) => {
1907
- gi.init(e, t);
1908
- const n = e._zod.parse, o = Re(() => Bt(t)), r = (i) => {
1909
- const s = new Fo(["shape", "payload", "ctx"]), u = o.value, d = (w) => {
1906
+ }), yr = /* @__PURE__ */ m("$ZodObjectJIT", (e, t) => {
1907
+ gr.init(e, t);
1908
+ const n = e._zod.parse, o = Re(() => Bt(t)), i = (r) => {
1909
+ const s = new Uo(["shape", "payload", "ctx"]), u = o.value, p = (w) => {
1910
1910
  const E = Ye(w);
1911
1911
  return `shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`;
1912
1912
  };
1913
1913
  s.write("const input = payload.value;");
1914
- const f = /* @__PURE__ */ Object.create(null);
1914
+ const h = /* @__PURE__ */ Object.create(null);
1915
1915
  let v = 0;
1916
1916
  for (const w of u.keys)
1917
- f[w] = `key_${v++}`;
1917
+ h[w] = `key_${v++}`;
1918
1918
  s.write("const newResult = {};");
1919
1919
  for (const w of u.keys) {
1920
- const E = f[w], k = Ye(w);
1921
- s.write(`const ${E} = ${d(w)};`), s.write(`
1920
+ const E = h[w], k = Ye(w);
1921
+ s.write(`const ${E} = ${p(w)};`), s.write(`
1922
1922
  if (${E}.issues.length) {
1923
1923
  payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
1924
1924
  ...iss,
@@ -1939,69 +1939,69 @@ const gi = /* @__PURE__ */ m("$ZodObject", (e, t) => {
1939
1939
  }
1940
1940
  s.write("payload.value = newResult;"), s.write("return payload;");
1941
1941
  const _ = s.compile();
1942
- return (w, E) => _(i, w, E);
1942
+ return (w, E) => _(r, w, E);
1943
1943
  };
1944
1944
  let a;
1945
- const c = he, l = !$t.jitless, h = l && Zn.value, y = t.catchall;
1945
+ const c = he, l = !$t.jitless, f = l && Zn.value, y = t.catchall;
1946
1946
  let g;
1947
- e._zod.parse = (i, s) => {
1947
+ e._zod.parse = (r, s) => {
1948
1948
  g ?? (g = o.value);
1949
- const u = i.value;
1950
- return c(u) ? l && h && s?.async === !1 && s.jitless !== !0 ? (a || (a = r(t.shape)), i = a(i, s), y ? Gt([], u, i, s, g, e) : i) : n(i, s) : (i.issues.push({
1949
+ const u = r.value;
1950
+ return c(u) ? l && f && s?.async === !1 && s.jitless !== !0 ? (a || (a = i(t.shape)), r = a(r, s), y ? Gt([], u, r, s, g, e) : r) : n(r, s) : (r.issues.push({
1951
1951
  expected: "object",
1952
1952
  code: "invalid_type",
1953
1953
  input: u,
1954
1954
  inst: e
1955
- }), i);
1955
+ }), r);
1956
1956
  };
1957
1957
  });
1958
1958
  function et(e, t, n, o) {
1959
1959
  for (const a of e)
1960
1960
  if (a.issues.length === 0)
1961
1961
  return t.value = a.value, t;
1962
- const r = e.filter((a) => !q(a));
1963
- return r.length === 1 ? (t.value = r[0].value, r[0]) : (t.issues.push({
1962
+ const i = e.filter((a) => !q(a));
1963
+ return i.length === 1 ? (t.value = i[0].value, i[0]) : (t.issues.push({
1964
1964
  code: "invalid_union",
1965
1965
  input: t.value,
1966
1966
  inst: n,
1967
1967
  errors: e.map((a) => a.issues.map((c) => N(c, o, j())))
1968
1968
  }), t);
1969
1969
  }
1970
- const bi = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
1971
- A.init(e, t), C(e._zod, "optin", () => t.options.some((r) => r._zod.optin === "optional") ? "optional" : void 0), C(e._zod, "optout", () => t.options.some((r) => r._zod.optout === "optional") ? "optional" : void 0), C(e._zod, "values", () => {
1972
- if (t.options.every((r) => r._zod.values))
1973
- return new Set(t.options.flatMap((r) => Array.from(r._zod.values)));
1970
+ const br = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
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
+ if (t.options.every((i) => i._zod.values))
1973
+ return new Set(t.options.flatMap((i) => Array.from(i._zod.values)));
1974
1974
  }), C(e._zod, "pattern", () => {
1975
- if (t.options.every((r) => r._zod.pattern)) {
1976
- const r = t.options.map((a) => a._zod.pattern);
1977
- return new RegExp(`^(${r.map((a) => Ne(a.source)).join("|")})$`);
1975
+ if (t.options.every((i) => i._zod.pattern)) {
1976
+ const i = t.options.map((a) => a._zod.pattern);
1977
+ return new RegExp(`^(${i.map((a) => Ne(a.source)).join("|")})$`);
1978
1978
  }
1979
1979
  });
1980
1980
  const n = t.options.length === 1, o = t.options[0]._zod.run;
1981
- e._zod.parse = (r, a) => {
1981
+ e._zod.parse = (i, a) => {
1982
1982
  if (n)
1983
- return o(r, a);
1983
+ return o(i, a);
1984
1984
  let c = !1;
1985
1985
  const l = [];
1986
- for (const p of t.options) {
1987
- const h = p._zod.run({
1988
- value: r.value,
1986
+ for (const d of t.options) {
1987
+ const f = d._zod.run({
1988
+ value: i.value,
1989
1989
  issues: []
1990
1990
  }, a);
1991
- if (h instanceof Promise)
1992
- l.push(h), c = !0;
1991
+ if (f instanceof Promise)
1992
+ l.push(f), c = !0;
1993
1993
  else {
1994
- if (h.issues.length === 0)
1995
- return h;
1996
- l.push(h);
1994
+ if (f.issues.length === 0)
1995
+ return f;
1996
+ l.push(f);
1997
1997
  }
1998
1998
  }
1999
- return c ? Promise.all(l).then((p) => et(p, r, e, a)) : et(l, r, e, a);
1999
+ return c ? Promise.all(l).then((d) => et(d, i, e, a)) : et(l, i, e, a);
2000
2000
  };
2001
- }), wi = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
2001
+ }), wr = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
2002
2002
  A.init(e, t), e._zod.parse = (n, o) => {
2003
- const r = n.value, a = t.left._zod.run({ value: r, issues: [] }, o), c = t.right._zod.run({ value: r, issues: [] }, o);
2004
- return a instanceof Promise || c instanceof Promise ? Promise.all([a, c]).then(([p, h]) => tt(n, p, h)) : tt(n, a, c);
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(([d, f]) => tt(n, d, f)) : tt(n, a, c);
2005
2005
  };
2006
2006
  });
2007
2007
  function Pe(e, t) {
@@ -2010,7 +2010,7 @@ function Pe(e, t) {
2010
2010
  if (e instanceof Date && t instanceof Date && +e == +t)
2011
2011
  return { valid: !0, data: e };
2012
2012
  if (H(e) && H(t)) {
2013
- const n = Object.keys(t), o = Object.keys(e).filter((a) => n.indexOf(a) !== -1), r = { ...e, ...t };
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
2015
  const c = Pe(e[a], t[a]);
2016
2016
  if (!c.valid)
@@ -2018,16 +2018,16 @@ function Pe(e, t) {
2018
2018
  valid: !1,
2019
2019
  mergeErrorPath: [a, ...c.mergeErrorPath]
2020
2020
  };
2021
- r[a] = c.data;
2021
+ i[a] = c.data;
2022
2022
  }
2023
- return { valid: !0, data: r };
2023
+ return { valid: !0, data: i };
2024
2024
  }
2025
2025
  if (Array.isArray(e) && Array.isArray(t)) {
2026
2026
  if (e.length !== t.length)
2027
2027
  return { valid: !1, mergeErrorPath: [] };
2028
2028
  const n = [];
2029
2029
  for (let o = 0; o < e.length; o++) {
2030
- const r = e[o], a = t[o], c = Pe(r, a);
2030
+ const i = e[o], a = t[o], c = Pe(i, a);
2031
2031
  if (!c.valid)
2032
2032
  return {
2033
2033
  valid: !1,
@@ -2047,10 +2047,10 @@ function tt(e, t, n) {
2047
2047
  throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
2048
2048
  return e.value = o.data, e;
2049
2049
  }
2050
- const Ei = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
2050
+ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
2051
2051
  A.init(e, t);
2052
2052
  const n = t.items;
2053
- e._zod.parse = (o, r) => {
2053
+ e._zod.parse = (o, i) => {
2054
2054
  const a = o.value;
2055
2055
  if (!Array.isArray(a))
2056
2056
  return o.issues.push({
@@ -2060,9 +2060,9 @@ const Ei = /* @__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 c = [], l = [...n].reverse().findIndex((y) => y._zod.optin !== "optional"), d = l === -1 ? 0 : n.length - l;
2064
2064
  if (!t.rest) {
2065
- const y = a.length > n.length, g = a.length < p - 1;
2065
+ const y = a.length > n.length, g = a.length < d - 1;
2066
2066
  if (y || g)
2067
2067
  return o.issues.push({
2068
2068
  ...y ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length },
@@ -2071,108 +2071,108 @@ const Ei = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
2071
2071
  origin: "array"
2072
2072
  }), o;
2073
2073
  }
2074
- let h = -1;
2074
+ let f = -1;
2075
2075
  for (const y of n) {
2076
- if (h++, h >= a.length && h >= p)
2076
+ if (f++, f >= a.length && f >= d)
2077
2077
  continue;
2078
2078
  const g = y._zod.run({
2079
- value: a[h],
2079
+ value: a[f],
2080
2080
  issues: []
2081
- }, r);
2082
- g instanceof Promise ? c.push(g.then((i) => ue(i, o, h))) : ue(g, o, h);
2081
+ }, i);
2082
+ g instanceof Promise ? c.push(g.then((r) => ue(r, o, f))) : ue(g, o, f);
2083
2083
  }
2084
2084
  if (t.rest) {
2085
2085
  const y = a.slice(n.length);
2086
2086
  for (const g of y) {
2087
- h++;
2088
- const i = t.rest._zod.run({
2087
+ f++;
2088
+ const r = t.rest._zod.run({
2089
2089
  value: g,
2090
2090
  issues: []
2091
- }, r);
2092
- i instanceof Promise ? c.push(i.then((s) => ue(s, o, h))) : ue(i, o, h);
2091
+ }, i);
2092
+ r instanceof Promise ? c.push(r.then((s) => ue(s, o, f))) : ue(r, o, f);
2093
2093
  }
2094
2094
  }
2095
2095
  return c.length ? Promise.all(c).then(() => o) : o;
2096
2096
  };
2097
2097
  });
2098
2098
  function ue(e, t, n) {
2099
- e.issues.length && t.issues.push(...U(n, e.issues)), t.value[n] = e.value;
2099
+ e.issues.length && t.issues.push(...M(n, e.issues)), t.value[n] = e.value;
2100
2100
  }
2101
- const ki = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
2101
+ const kr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
2102
2102
  A.init(e, t), e._zod.parse = (n, o) => {
2103
- const r = n.value;
2104
- if (!H(r))
2103
+ const i = n.value;
2104
+ if (!H(i))
2105
2105
  return n.issues.push({
2106
2106
  expected: "record",
2107
2107
  code: "invalid_type",
2108
- input: r,
2108
+ input: i,
2109
2109
  inst: e
2110
2110
  }), n;
2111
2111
  const a = [], c = t.keyType._zod.values;
2112
2112
  if (c) {
2113
2113
  n.value = {};
2114
2114
  const l = /* @__PURE__ */ new Set();
2115
- for (const h of c)
2116
- if (typeof h == "string" || typeof h == "number" || typeof h == "symbol") {
2117
- l.add(typeof h == "number" ? h.toString() : h);
2118
- const y = t.valueType._zod.run({ value: r[h], issues: [] }, o);
2115
+ for (const f of c)
2116
+ if (typeof f == "string" || typeof f == "number" || typeof f == "symbol") {
2117
+ l.add(typeof f == "number" ? f.toString() : f);
2118
+ const y = t.valueType._zod.run({ value: i[f], issues: [] }, o);
2119
2119
  y instanceof Promise ? a.push(y.then((g) => {
2120
- g.issues.length && n.issues.push(...U(h, g.issues)), n.value[h] = g.value;
2121
- })) : (y.issues.length && n.issues.push(...U(h, y.issues)), n.value[h] = y.value);
2120
+ g.issues.length && n.issues.push(...M(f, g.issues)), n.value[f] = g.value;
2121
+ })) : (y.issues.length && n.issues.push(...M(f, y.issues)), n.value[f] = y.value);
2122
2122
  }
2123
- let p;
2124
- for (const h in r)
2125
- l.has(h) || (p = p ?? [], p.push(h));
2126
- p && p.length > 0 && n.issues.push({
2123
+ let d;
2124
+ for (const f in i)
2125
+ l.has(f) || (d = d ?? [], d.push(f));
2126
+ d && d.length > 0 && n.issues.push({
2127
2127
  code: "unrecognized_keys",
2128
- input: r,
2128
+ input: i,
2129
2129
  inst: e,
2130
- keys: p
2130
+ keys: d
2131
2131
  });
2132
2132
  } else {
2133
2133
  n.value = {};
2134
- for (const l of Reflect.ownKeys(r)) {
2134
+ for (const l of Reflect.ownKeys(i)) {
2135
2135
  if (l === "__proto__")
2136
2136
  continue;
2137
- const p = t.keyType._zod.run({ value: l, issues: [] }, o);
2138
- if (p instanceof Promise)
2137
+ const d = t.keyType._zod.run({ value: l, issues: [] }, o);
2138
+ if (d instanceof Promise)
2139
2139
  throw new Error("Async schemas not supported in object keys currently");
2140
- if (p.issues.length) {
2140
+ if (d.issues.length) {
2141
2141
  n.issues.push({
2142
2142
  code: "invalid_key",
2143
2143
  origin: "record",
2144
- issues: p.issues.map((y) => N(y, o, j())),
2144
+ issues: d.issues.map((y) => N(y, o, j())),
2145
2145
  input: l,
2146
2146
  path: [l],
2147
2147
  inst: e
2148
- }), n.value[p.value] = p.value;
2148
+ }), n.value[d.value] = d.value;
2149
2149
  continue;
2150
2150
  }
2151
- const h = t.valueType._zod.run({ value: r[l], issues: [] }, o);
2152
- h instanceof Promise ? a.push(h.then((y) => {
2153
- y.issues.length && n.issues.push(...U(l, y.issues)), n.value[p.value] = y.value;
2154
- })) : (h.issues.length && n.issues.push(...U(l, h.issues)), n.value[p.value] = h.value);
2151
+ const f = t.valueType._zod.run({ value: i[l], issues: [] }, o);
2152
+ f instanceof Promise ? a.push(f.then((y) => {
2153
+ y.issues.length && n.issues.push(...M(l, y.issues)), n.value[d.value] = y.value;
2154
+ })) : (f.issues.length && n.issues.push(...M(l, f.issues)), n.value[d.value] = f.value);
2155
2155
  }
2156
2156
  }
2157
2157
  return a.length ? Promise.all(a).then(() => n) : n;
2158
2158
  };
2159
- }), Ci = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
2159
+ }), Cr = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
2160
2160
  A.init(e, t);
2161
2161
  const n = In(t.entries), o = new Set(n);
2162
- e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((r) => Pn.has(typeof r)).map((r) => typeof r == "string" ? J(r) : r.toString()).join("|")})$`), e._zod.parse = (r, a) => {
2163
- const c = r.value;
2164
- return o.has(c) || r.issues.push({
2162
+ e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) => Pn.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({
2165
2165
  code: "invalid_value",
2166
2166
  values: n,
2167
2167
  input: c,
2168
2168
  inst: e
2169
- }), r;
2169
+ }), i;
2170
2170
  };
2171
- }), Ai = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
2171
+ }), Ar = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
2172
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
- 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, r) => {
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) => {
2176
2176
  const a = o.value;
2177
2177
  return n.has(a) || o.issues.push({
2178
2178
  code: "invalid_value",
@@ -2181,62 +2181,62 @@ const ki = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
2181
2181
  inst: e
2182
2182
  }), o;
2183
2183
  };
2184
- }), Ti = /* @__PURE__ */ m("$ZodTransform", (e, t) => {
2184
+ }), Tr = /* @__PURE__ */ m("$ZodTransform", (e, t) => {
2185
2185
  A.init(e, t), e._zod.parse = (n, o) => {
2186
2186
  if (o.direction === "backward")
2187
2187
  throw new It(e.constructor.name);
2188
- const r = t.transform(n.value, n);
2188
+ const i = t.transform(n.value, n);
2189
2189
  if (o.async)
2190
- return (r instanceof Promise ? r : Promise.resolve(r)).then((c) => (n.value = c, n));
2191
- if (r instanceof Promise)
2190
+ return (i instanceof Promise ? i : Promise.resolve(i)).then((c) => (n.value = c, n));
2191
+ if (i instanceof Promise)
2192
2192
  throw new K();
2193
- return n.value = r, n;
2193
+ return n.value = i, n;
2194
2194
  };
2195
2195
  });
2196
2196
  function nt(e, t) {
2197
2197
  return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
2198
2198
  }
2199
- const Si = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
2199
+ const Sr = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
2200
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(`^(${Ne(n.source)})?$`) : void 0;
2203
2203
  }), e._zod.parse = (n, o) => {
2204
2204
  if (t.innerType._zod.optin === "optional") {
2205
- const r = t.innerType._zod.run(n, o);
2206
- return r instanceof Promise ? r.then((a) => nt(a, n.value)) : nt(r, n.value);
2205
+ const i = t.innerType._zod.run(n, o);
2206
+ return i instanceof Promise ? i.then((a) => nt(a, n.value)) : nt(i, n.value);
2207
2207
  }
2208
2208
  return n.value === void 0 ? n : t.innerType._zod.run(n, o);
2209
2209
  };
2210
- }), zi = /* @__PURE__ */ m("$ZodNullable", (e, t) => {
2210
+ }), zr = /* @__PURE__ */ m("$ZodNullable", (e, t) => {
2211
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(`^(${Ne(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
- }), Ii = /* @__PURE__ */ m("$ZodDefault", (e, t) => {
2215
+ }), Ir = /* @__PURE__ */ m("$ZodDefault", (e, t) => {
2216
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)
2220
2220
  return n.value = t.defaultValue, n;
2221
- const r = t.innerType._zod.run(n, o);
2222
- return r instanceof Promise ? r.then((a) => ot(a, t)) : ot(r, t);
2221
+ const i = t.innerType._zod.run(n, o);
2222
+ return i instanceof Promise ? i.then((a) => ot(a, t)) : ot(i, t);
2223
2223
  };
2224
2224
  });
2225
2225
  function ot(e, t) {
2226
2226
  return e.value === void 0 && (e.value = t.defaultValue), e;
2227
2227
  }
2228
- const $i = /* @__PURE__ */ m("$ZodPrefault", (e, t) => {
2228
+ const $r = /* @__PURE__ */ m("$ZodPrefault", (e, t) => {
2229
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
- }), Oi = /* @__PURE__ */ m("$ZodNonOptional", (e, t) => {
2230
+ }), Or = /* @__PURE__ */ m("$ZodNonOptional", (e, t) => {
2231
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) => {
2235
- const r = t.innerType._zod.run(n, o);
2236
- return r instanceof Promise ? r.then((a) => it(a, e)) : it(r, e);
2235
+ const i = t.innerType._zod.run(n, o);
2236
+ return i instanceof Promise ? i.then((a) => rt(a, e)) : rt(i, e);
2237
2237
  };
2238
2238
  });
2239
- function it(e, t) {
2239
+ function rt(e, t) {
2240
2240
  return !e.issues.length && e.value === void 0 && e.issues.push({
2241
2241
  code: "invalid_type",
2242
2242
  expected: "nonoptional",
@@ -2244,60 +2244,60 @@ function it(e, t) {
2244
2244
  inst: t
2245
2245
  }), e;
2246
2246
  }
2247
- const Zi = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
2247
+ const Zr = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
2248
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
- const r = t.innerType._zod.run(n, o);
2252
- return r instanceof Promise ? r.then((a) => (n.value = a.value, a.issues.length && (n.value = t.catchValue({
2251
+ const i = t.innerType._zod.run(n, o);
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
2255
  issues: a.issues.map((c) => N(c, o, j()))
2256
2256
  },
2257
2257
  input: n.value
2258
- }), n.issues = []), n)) : (n.value = r.value, r.issues.length && (n.value = t.catchValue({
2258
+ }), n.issues = []), n)) : (n.value = i.value, i.issues.length && (n.value = t.catchValue({
2259
2259
  ...n,
2260
2260
  error: {
2261
- issues: r.issues.map((a) => N(a, o, j()))
2261
+ issues: i.issues.map((a) => N(a, o, j()))
2262
2262
  },
2263
2263
  input: n.value
2264
2264
  }), n.issues = []), n);
2265
2265
  };
2266
- }), Pi = /* @__PURE__ */ m("$ZodPipe", (e, t) => {
2266
+ }), Pr = /* @__PURE__ */ m("$ZodPipe", (e, t) => {
2267
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
2270
  return a instanceof Promise ? a.then((c) => ce(c, t.in, o)) : ce(a, t.in, o);
2271
2271
  }
2272
- const r = t.in._zod.run(n, o);
2273
- return r instanceof Promise ? r.then((a) => ce(a, t.out, o)) : ce(r, t.out, o);
2272
+ const i = t.in._zod.run(n, o);
2273
+ return i instanceof Promise ? i.then((a) => ce(a, t.out, o)) : ce(i, t.out, o);
2274
2274
  };
2275
2275
  });
2276
2276
  function ce(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
- const xi = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
2279
+ const xr = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
2280
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
- const r = t.innerType._zod.run(n, o);
2284
- return r instanceof Promise ? r.then(rt) : rt(r);
2283
+ const i = t.innerType._zod.run(n, o);
2284
+ return i instanceof Promise ? i.then(it) : it(i);
2285
2285
  };
2286
2286
  });
2287
- function rt(e) {
2287
+ function it(e) {
2288
2288
  return e.value = Object.freeze(e.value), e;
2289
2289
  }
2290
- const Li = /* @__PURE__ */ m("$ZodCustom", (e, t) => {
2290
+ const Lr = /* @__PURE__ */ m("$ZodCustom", (e, t) => {
2291
2291
  O.init(e, t), A.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
2292
- const o = n.value, r = t.fn(o);
2293
- if (r instanceof Promise)
2294
- return r.then((a) => st(a, n, o, e));
2295
- st(r, n, o, e);
2292
+ const o = n.value, i = t.fn(o);
2293
+ if (i instanceof Promise)
2294
+ return i.then((a) => st(a, n, o, e));
2295
+ st(i, n, o, e);
2296
2296
  };
2297
2297
  });
2298
2298
  function st(e, t, n, o) {
2299
2299
  if (!e) {
2300
- const r = {
2300
+ const i = {
2301
2301
  code: "custom",
2302
2302
  input: n,
2303
2303
  inst: o,
@@ -2307,11 +2307,11 @@ function st(e, t, n, o) {
2307
2307
  continue: !o._zod.def.abort
2308
2308
  // params: inst._zod.def.params,
2309
2309
  };
2310
- o._zod.def.params && (r.params = o._zod.def.params), t.issues.push(re(r));
2310
+ o._zod.def.params && (i.params = o._zod.def.params), t.issues.push(ie(i));
2311
2311
  }
2312
2312
  }
2313
2313
  var at;
2314
- class Ri {
2314
+ class Rr {
2315
2315
  constructor() {
2316
2316
  this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
2317
2317
  }
@@ -2336,8 +2336,8 @@ class Ri {
2336
2336
  if (n) {
2337
2337
  const o = { ...this.get(n) ?? {} };
2338
2338
  delete o.id;
2339
- const r = { ...o, ...this._map.get(t) };
2340
- return Object.keys(r).length ? r : void 0;
2339
+ const i = { ...o, ...this._map.get(t) };
2340
+ return Object.keys(i).length ? i : void 0;
2341
2341
  }
2342
2342
  return this._map.get(t);
2343
2343
  }
@@ -2345,18 +2345,18 @@ class Ri {
2345
2345
  return this._map.has(t);
2346
2346
  }
2347
2347
  }
2348
- function ji() {
2349
- return new Ri();
2348
+ function jr() {
2349
+ return new Rr();
2350
2350
  }
2351
- (at = globalThis).__zod_globalRegistry ?? (at.__zod_globalRegistry = ji());
2351
+ (at = globalThis).__zod_globalRegistry ?? (at.__zod_globalRegistry = jr());
2352
2352
  const le = globalThis.__zod_globalRegistry;
2353
- function Ni(e, t) {
2353
+ function Nr(e, t) {
2354
2354
  return new e({
2355
2355
  type: "string",
2356
2356
  ...b(t)
2357
2357
  });
2358
2358
  }
2359
- function Di(e, t) {
2359
+ function Dr(e, t) {
2360
2360
  return new e({
2361
2361
  type: "string",
2362
2362
  format: "email",
@@ -2374,7 +2374,7 @@ function ut(e, t) {
2374
2374
  ...b(t)
2375
2375
  });
2376
2376
  }
2377
- function Fi(e, t) {
2377
+ function Ur(e, t) {
2378
2378
  return new e({
2379
2379
  type: "string",
2380
2380
  format: "uuid",
@@ -2383,7 +2383,7 @@ function Fi(e, t) {
2383
2383
  ...b(t)
2384
2384
  });
2385
2385
  }
2386
- function Mi(e, t) {
2386
+ function Fr(e, t) {
2387
2387
  return new e({
2388
2388
  type: "string",
2389
2389
  format: "uuid",
@@ -2393,7 +2393,7 @@ function Mi(e, t) {
2393
2393
  ...b(t)
2394
2394
  });
2395
2395
  }
2396
- function Ui(e, t) {
2396
+ function Mr(e, t) {
2397
2397
  return new e({
2398
2398
  type: "string",
2399
2399
  format: "uuid",
@@ -2403,7 +2403,7 @@ function Ui(e, t) {
2403
2403
  ...b(t)
2404
2404
  });
2405
2405
  }
2406
- function Vi(e, t) {
2406
+ function Vr(e, t) {
2407
2407
  return new e({
2408
2408
  type: "string",
2409
2409
  format: "uuid",
@@ -2413,7 +2413,7 @@ function Vi(e, t) {
2413
2413
  ...b(t)
2414
2414
  });
2415
2415
  }
2416
- function Bi(e, t) {
2416
+ function Br(e, t) {
2417
2417
  return new e({
2418
2418
  type: "string",
2419
2419
  format: "url",
@@ -2422,7 +2422,7 @@ function Bi(e, t) {
2422
2422
  ...b(t)
2423
2423
  });
2424
2424
  }
2425
- function Gi(e, t) {
2425
+ function Gr(e, t) {
2426
2426
  return new e({
2427
2427
  type: "string",
2428
2428
  format: "emoji",
@@ -2431,7 +2431,7 @@ function Gi(e, t) {
2431
2431
  ...b(t)
2432
2432
  });
2433
2433
  }
2434
- function Wi(e, t) {
2434
+ function Wr(e, t) {
2435
2435
  return new e({
2436
2436
  type: "string",
2437
2437
  format: "nanoid",
@@ -2440,7 +2440,7 @@ function Wi(e, t) {
2440
2440
  ...b(t)
2441
2441
  });
2442
2442
  }
2443
- function qi(e, t) {
2443
+ function qr(e, t) {
2444
2444
  return new e({
2445
2445
  type: "string",
2446
2446
  format: "cuid",
@@ -2449,7 +2449,7 @@ function qi(e, t) {
2449
2449
  ...b(t)
2450
2450
  });
2451
2451
  }
2452
- function Ki(e, t) {
2452
+ function Kr(e, t) {
2453
2453
  return new e({
2454
2454
  type: "string",
2455
2455
  format: "cuid2",
@@ -2458,7 +2458,7 @@ function Ki(e, t) {
2458
2458
  ...b(t)
2459
2459
  });
2460
2460
  }
2461
- function Hi(e, t) {
2461
+ function Hr(e, t) {
2462
2462
  return new e({
2463
2463
  type: "string",
2464
2464
  format: "ulid",
@@ -2467,7 +2467,7 @@ function Hi(e, t) {
2467
2467
  ...b(t)
2468
2468
  });
2469
2469
  }
2470
- function Ji(e, t) {
2470
+ function Jr(e, t) {
2471
2471
  return new e({
2472
2472
  type: "string",
2473
2473
  format: "xid",
@@ -2476,7 +2476,7 @@ function Ji(e, t) {
2476
2476
  ...b(t)
2477
2477
  });
2478
2478
  }
2479
- function Yi(e, t) {
2479
+ function Yr(e, t) {
2480
2480
  return new e({
2481
2481
  type: "string",
2482
2482
  format: "ksuid",
@@ -2485,7 +2485,7 @@ function Yi(e, t) {
2485
2485
  ...b(t)
2486
2486
  });
2487
2487
  }
2488
- function Qi(e, t) {
2488
+ function Qr(e, t) {
2489
2489
  return new e({
2490
2490
  type: "string",
2491
2491
  format: "ipv4",
@@ -2494,7 +2494,7 @@ function Qi(e, t) {
2494
2494
  ...b(t)
2495
2495
  });
2496
2496
  }
2497
- function Xi(e, t) {
2497
+ function Xr(e, t) {
2498
2498
  return new e({
2499
2499
  type: "string",
2500
2500
  format: "ipv6",
@@ -2503,7 +2503,7 @@ function Xi(e, t) {
2503
2503
  ...b(t)
2504
2504
  });
2505
2505
  }
2506
- function er(e, t) {
2506
+ function ei(e, t) {
2507
2507
  return new e({
2508
2508
  type: "string",
2509
2509
  format: "cidrv4",
@@ -2512,7 +2512,7 @@ function er(e, t) {
2512
2512
  ...b(t)
2513
2513
  });
2514
2514
  }
2515
- function tr(e, t) {
2515
+ function ti(e, t) {
2516
2516
  return new e({
2517
2517
  type: "string",
2518
2518
  format: "cidrv6",
@@ -2521,7 +2521,7 @@ function tr(e, t) {
2521
2521
  ...b(t)
2522
2522
  });
2523
2523
  }
2524
- function nr(e, t) {
2524
+ function ni(e, t) {
2525
2525
  return new e({
2526
2526
  type: "string",
2527
2527
  format: "base64",
@@ -2530,7 +2530,7 @@ function nr(e, t) {
2530
2530
  ...b(t)
2531
2531
  });
2532
2532
  }
2533
- function or(e, t) {
2533
+ function oi(e, t) {
2534
2534
  return new e({
2535
2535
  type: "string",
2536
2536
  format: "base64url",
@@ -2539,7 +2539,7 @@ function or(e, t) {
2539
2539
  ...b(t)
2540
2540
  });
2541
2541
  }
2542
- function ir(e, t) {
2542
+ function ri(e, t) {
2543
2543
  return new e({
2544
2544
  type: "string",
2545
2545
  format: "e164",
@@ -2548,7 +2548,7 @@ function ir(e, t) {
2548
2548
  ...b(t)
2549
2549
  });
2550
2550
  }
2551
- function rr(e, t) {
2551
+ function ii(e, t) {
2552
2552
  return new e({
2553
2553
  type: "string",
2554
2554
  format: "jwt",
@@ -2557,7 +2557,7 @@ function rr(e, t) {
2557
2557
  ...b(t)
2558
2558
  });
2559
2559
  }
2560
- function sr(e, t) {
2560
+ function si(e, t) {
2561
2561
  return new e({
2562
2562
  type: "string",
2563
2563
  format: "datetime",
@@ -2568,7 +2568,7 @@ function sr(e, t) {
2568
2568
  ...b(t)
2569
2569
  });
2570
2570
  }
2571
- function ar(e, t) {
2571
+ function ai(e, t) {
2572
2572
  return new e({
2573
2573
  type: "string",
2574
2574
  format: "date",
@@ -2576,7 +2576,7 @@ function ar(e, t) {
2576
2576
  ...b(t)
2577
2577
  });
2578
2578
  }
2579
- function ur(e, t) {
2579
+ function ui(e, t) {
2580
2580
  return new e({
2581
2581
  type: "string",
2582
2582
  format: "time",
@@ -2585,7 +2585,7 @@ function ur(e, t) {
2585
2585
  ...b(t)
2586
2586
  });
2587
2587
  }
2588
- function cr(e, t) {
2588
+ function ci(e, t) {
2589
2589
  return new e({
2590
2590
  type: "string",
2591
2591
  format: "duration",
@@ -2593,14 +2593,14 @@ function cr(e, t) {
2593
2593
  ...b(t)
2594
2594
  });
2595
2595
  }
2596
- function lr(e, t) {
2596
+ function li(e, t) {
2597
2597
  return new e({
2598
2598
  type: "number",
2599
2599
  checks: [],
2600
2600
  ...b(t)
2601
2601
  });
2602
2602
  }
2603
- function dr(e, t) {
2603
+ function di(e, t) {
2604
2604
  return new e({
2605
2605
  type: "number",
2606
2606
  check: "number_format",
@@ -2609,25 +2609,25 @@ function dr(e, t) {
2609
2609
  ...b(t)
2610
2610
  });
2611
2611
  }
2612
- function pr(e, t) {
2612
+ function pi(e, t) {
2613
2613
  return new e({
2614
2614
  type: "null",
2615
2615
  ...b(t)
2616
2616
  });
2617
2617
  }
2618
- function hr(e) {
2618
+ function hi(e) {
2619
2619
  return new e({
2620
2620
  type: "unknown"
2621
2621
  });
2622
2622
  }
2623
- function fr(e, t) {
2623
+ function fi(e, t) {
2624
2624
  return new e({
2625
2625
  type: "never",
2626
2626
  ...b(t)
2627
2627
  });
2628
2628
  }
2629
2629
  function ct(e, t) {
2630
- return new Ft({
2630
+ return new Ut({
2631
2631
  check: "less_than",
2632
2632
  ...b(t),
2633
2633
  value: e,
@@ -2635,7 +2635,7 @@ function ct(e, t) {
2635
2635
  });
2636
2636
  }
2637
2637
  function Ce(e, t) {
2638
- return new Ft({
2638
+ return new Ut({
2639
2639
  check: "less_than",
2640
2640
  ...b(t),
2641
2641
  value: e,
@@ -2643,7 +2643,7 @@ function Ce(e, t) {
2643
2643
  });
2644
2644
  }
2645
2645
  function lt(e, t) {
2646
- return new Mt({
2646
+ return new Ft({
2647
2647
  check: "greater_than",
2648
2648
  ...b(t),
2649
2649
  value: e,
@@ -2651,7 +2651,7 @@ function lt(e, t) {
2651
2651
  });
2652
2652
  }
2653
2653
  function Ae(e, t) {
2654
- return new Mt({
2654
+ return new Ft({
2655
2655
  check: "greater_than",
2656
2656
  ...b(t),
2657
2657
  value: e,
@@ -2686,7 +2686,7 @@ function qt(e, t) {
2686
2686
  length: e
2687
2687
  });
2688
2688
  }
2689
- function _r(e, t) {
2689
+ function _i(e, t) {
2690
2690
  return new Po({
2691
2691
  check: "string_format",
2692
2692
  format: "regex",
@@ -2694,21 +2694,21 @@ function _r(e, t) {
2694
2694
  pattern: e
2695
2695
  });
2696
2696
  }
2697
- function mr(e) {
2697
+ function mi(e) {
2698
2698
  return new xo({
2699
2699
  check: "string_format",
2700
2700
  format: "lowercase",
2701
2701
  ...b(e)
2702
2702
  });
2703
2703
  }
2704
- function vr(e) {
2704
+ function vi(e) {
2705
2705
  return new Lo({
2706
2706
  check: "string_format",
2707
2707
  format: "uppercase",
2708
2708
  ...b(e)
2709
2709
  });
2710
2710
  }
2711
- function gr(e, t) {
2711
+ function gi(e, t) {
2712
2712
  return new Ro({
2713
2713
  check: "string_format",
2714
2714
  format: "includes",
@@ -2716,7 +2716,7 @@ function gr(e, t) {
2716
2716
  includes: e
2717
2717
  });
2718
2718
  }
2719
- function yr(e, t) {
2719
+ function yi(e, t) {
2720
2720
  return new jo({
2721
2721
  check: "string_format",
2722
2722
  format: "starts_with",
@@ -2724,7 +2724,7 @@ function yr(e, t) {
2724
2724
  prefix: e
2725
2725
  });
2726
2726
  }
2727
- function br(e, t) {
2727
+ function bi(e, t) {
2728
2728
  return new No({
2729
2729
  check: "string_format",
2730
2730
  format: "ends_with",
@@ -2738,22 +2738,22 @@ function ee(e) {
2738
2738
  tx: e
2739
2739
  });
2740
2740
  }
2741
- function wr(e) {
2741
+ function wi(e) {
2742
2742
  return ee((t) => t.normalize(e));
2743
2743
  }
2744
- function Er() {
2744
+ function Ei() {
2745
2745
  return ee((e) => e.trim());
2746
2746
  }
2747
- function kr() {
2747
+ function ki() {
2748
2748
  return ee((e) => e.toLowerCase());
2749
2749
  }
2750
- function Cr() {
2750
+ function Ci() {
2751
2751
  return ee((e) => e.toUpperCase());
2752
2752
  }
2753
- function Ar() {
2753
+ function Ai() {
2754
2754
  return ee((e) => On(e));
2755
2755
  }
2756
- function Tr(e, t, n) {
2756
+ function Ti(e, t, n) {
2757
2757
  return new e({
2758
2758
  type: "array",
2759
2759
  element: t,
@@ -2763,7 +2763,7 @@ function Tr(e, t, n) {
2763
2763
  ...b(n)
2764
2764
  });
2765
2765
  }
2766
- function Sr(e, t, n) {
2766
+ function Si(e, t, n) {
2767
2767
  return new e({
2768
2768
  type: "custom",
2769
2769
  check: "custom",
@@ -2771,49 +2771,49 @@ function Sr(e, t, n) {
2771
2771
  ...b(n)
2772
2772
  });
2773
2773
  }
2774
- function zr(e) {
2775
- const t = Ir((n) => (n.addIssue = (o) => {
2774
+ function zi(e) {
2775
+ const t = Ii((n) => (n.addIssue = (o) => {
2776
2776
  if (typeof o == "string")
2777
- n.issues.push(re(o, n.value, t._zod.def));
2777
+ n.issues.push(ie(o, n.value, t._zod.def));
2778
2778
  else {
2779
- const r = o;
2780
- r.fatal && (r.continue = !1), r.code ?? (r.code = "custom"), r.input ?? (r.input = n.value), r.inst ?? (r.inst = t), r.continue ?? (r.continue = !t._zod.def.abort), n.issues.push(re(r));
2779
+ const i = o;
2780
+ i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = n.value), i.inst ?? (i.inst = t), i.continue ?? (i.continue = !t._zod.def.abort), n.issues.push(ie(i));
2781
2781
  }
2782
2782
  }, e(n.value, n)));
2783
2783
  return t;
2784
2784
  }
2785
- function Ir(e, t) {
2785
+ function Ii(e, t) {
2786
2786
  const n = new O({
2787
2787
  check: "custom",
2788
2788
  ...b(t)
2789
2789
  });
2790
2790
  return n._zod.check = e, n;
2791
2791
  }
2792
- const $r = /* @__PURE__ */ m("ZodISODateTime", (e, t) => {
2792
+ const $i = /* @__PURE__ */ m("ZodISODateTime", (e, t) => {
2793
2793
  Xo.init(e, t), $.init(e, t);
2794
2794
  });
2795
- function Or(e) {
2796
- return sr($r, e);
2795
+ function Oi(e) {
2796
+ return si($i, e);
2797
2797
  }
2798
- const Zr = /* @__PURE__ */ m("ZodISODate", (e, t) => {
2799
- ei.init(e, t), $.init(e, t);
2798
+ const Zi = /* @__PURE__ */ m("ZodISODate", (e, t) => {
2799
+ er.init(e, t), $.init(e, t);
2800
2800
  });
2801
- function Pr(e) {
2802
- return ar(Zr, e);
2801
+ function Pi(e) {
2802
+ return ai(Zi, e);
2803
2803
  }
2804
- const xr = /* @__PURE__ */ m("ZodISOTime", (e, t) => {
2805
- ti.init(e, t), $.init(e, t);
2804
+ const xi = /* @__PURE__ */ m("ZodISOTime", (e, t) => {
2805
+ tr.init(e, t), $.init(e, t);
2806
2806
  });
2807
- function Lr(e) {
2808
- return ur(xr, e);
2807
+ function Li(e) {
2808
+ return ui(xi, e);
2809
2809
  }
2810
- const Rr = /* @__PURE__ */ m("ZodISODuration", (e, t) => {
2811
- ni.init(e, t), $.init(e, t);
2810
+ const Ri = /* @__PURE__ */ m("ZodISODuration", (e, t) => {
2811
+ nr.init(e, t), $.init(e, t);
2812
2812
  });
2813
- function jr(e) {
2814
- return cr(Rr, e);
2813
+ function ji(e) {
2814
+ return ci(Ri, e);
2815
2815
  }
2816
- const Nr = (e, t) => {
2816
+ const Ni = (e, t) => {
2817
2817
  xt.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
2818
2818
  format: {
2819
2819
  value: (n) => Bn(e, n)
@@ -2842,14 +2842,14 @@ const Nr = (e, t) => {
2842
2842
  // enumerable: false,
2843
2843
  }
2844
2844
  });
2845
- }, P = /* @__PURE__ */ m("ZodError", Nr, {
2845
+ }, P = /* @__PURE__ */ m("ZodError", Ni, {
2846
2846
  Parent: Error
2847
- }), Dr = /* @__PURE__ */ Fe(P), Fr = /* @__PURE__ */ Me(P), Mr = /* @__PURE__ */ ve(P), Ur = /* @__PURE__ */ ge(P), Vr = /* @__PURE__ */ qn(P), Br = /* @__PURE__ */ Kn(P), Gr = /* @__PURE__ */ Hn(P), Wr = /* @__PURE__ */ Jn(P), qr = /* @__PURE__ */ Yn(P), Kr = /* @__PURE__ */ Qn(P), Hr = /* @__PURE__ */ Xn(P), Jr = /* @__PURE__ */ eo(P), 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, {
2847
+ }), Di = /* @__PURE__ */ Ue(P), Ui = /* @__PURE__ */ Fe(P), Fi = /* @__PURE__ */ ve(P), Mi = /* @__PURE__ */ ge(P), Vi = /* @__PURE__ */ qn(P), Bi = /* @__PURE__ */ Kn(P), Gi = /* @__PURE__ */ Hn(P), Wi = /* @__PURE__ */ Jn(P), qi = /* @__PURE__ */ Yn(P), Ki = /* @__PURE__ */ Qn(P), Hi = /* @__PURE__ */ Xn(P), Ji = /* @__PURE__ */ eo(P), 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)
2851
2851
  ]
2852
- })), e.clone = (n, o) => D(e, n, o), e.brand = () => e, e.register = (n, o) => (n.add(e, o), e), e.parse = (n, o) => Dr(e, n, o, { callee: e.parse }), e.safeParse = (n, o) => Mr(e, n, o), e.parseAsync = async (n, o) => Fr(e, n, o, { callee: e.parseAsync }), e.safeParseAsync = async (n, o) => Ur(e, n, o), e.spa = e.safeParseAsync, e.encode = (n, o) => Vr(e, n, o), e.decode = (n, o) => Br(e, n, o), e.encodeAsync = async (n, o) => Gr(e, n, o), e.decodeAsync = async (n, o) => Wr(e, n, o), e.safeEncode = (n, o) => qr(e, n, o), e.safeDecode = (n, o) => Kr(e, n, o), e.safeEncodeAsync = async (n, o) => Hr(e, n, o), e.safeDecodeAsync = async (n, o) => Jr(e, n, o), e.refine = (n, o) => e.check(Ws(n, o)), e.superRefine = (n) => e.check(qs(n)), e.overwrite = (n) => e.check(ee(n)), e.optional = () => _t(e), e.nullable = () => mt(e), e.nullish = () => _t(mt(e)), e.nonoptional = (n) => Ds(e, n), e.array = () => Es(e), e.or = (n) => G([e, n]), e.and = (n) => Ts(e, n), e.transform = (n) => vt(e, Ps(n)), e.default = (n) => Rs(e, n), e.prefault = (n) => Ns(e, n), e.catch = (n) => Ms(e, n), e.pipe = (n) => vt(e, n), e.readonly = () => Bs(e), e.describe = (n) => {
2852
+ })), e.clone = (n, o) => D(e, n, o), e.brand = () => e, e.register = (n, o) => (n.add(e, o), e), e.parse = (n, o) => Di(e, n, o, { callee: e.parse }), e.safeParse = (n, o) => Fi(e, n, o), e.parseAsync = async (n, o) => Ui(e, n, o, { callee: e.parseAsync }), e.safeParseAsync = async (n, o) => Mi(e, n, o), e.spa = e.safeParseAsync, e.encode = (n, o) => Vi(e, n, o), e.decode = (n, o) => Bi(e, n, o), e.encodeAsync = async (n, o) => Gi(e, n, o), e.decodeAsync = async (n, o) => Wi(e, n, o), e.safeEncode = (n, o) => qi(e, n, o), e.safeDecode = (n, o) => Ki(e, n, o), e.safeEncodeAsync = async (n, o) => Hi(e, n, o), e.safeDecodeAsync = async (n, o) => Ji(e, n, o), e.refine = (n, o) => e.check(Ws(n, o)), e.superRefine = (n) => e.check(qs(n)), e.overwrite = (n) => e.check(ee(n)), e.optional = () => _t(e), e.nullable = () => mt(e), e.nullish = () => _t(mt(e)), e.nonoptional = (n) => Ds(e, n), e.array = () => Es(e), e.or = (n) => G([e, n]), e.and = (n) => Ts(e, n), e.transform = (n) => vt(e, Ps(n)), e.default = (n) => Rs(e, n), e.prefault = (n) => Ns(e, n), e.catch = (n) => Fs(e, n), e.pipe = (n) => vt(e, n), e.readonly = () => Bs(e), e.describe = (n) => {
2853
2853
  const o = e.clone();
2854
2854
  return le.add(o, { description: n }), o;
2855
2855
  }, Object.defineProperty(e, "description", {
@@ -2863,24 +2863,24 @@ const Nr = (e, t) => {
2863
2863
  const o = e.clone();
2864
2864
  return le.add(o, n[0]), o;
2865
2865
  }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Kt = /* @__PURE__ */ m("_ZodString", (e, t) => {
2866
- Ue.init(e, t), I.init(e, t);
2866
+ Me.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(_r(...o)), e.includes = (...o) => e.check(gr(...o)), e.startsWith = (...o) => e.check(yr(...o)), e.endsWith = (...o) => e.check(br(...o)), e.min = (...o) => e.check(_e(...o)), e.max = (...o) => e.check(Wt(...o)), e.length = (...o) => e.check(qt(...o)), e.nonempty = (...o) => e.check(_e(1, ...o)), e.lowercase = (o) => e.check(mr(o)), e.uppercase = (o) => e.check(vr(o)), e.trim = () => e.check(Er()), e.normalize = (...o) => e.check(wr(...o)), e.toLowerCase = () => e.check(kr()), e.toUpperCase = () => e.check(Cr()), e.slugify = () => e.check(Ar());
2869
- }), Yr = /* @__PURE__ */ m("ZodString", (e, t) => {
2870
- Ue.init(e, t), Kt.init(e, t), e.email = (n) => e.check(Di(Qr, n)), e.url = (n) => e.check(Bi(Xr, n)), e.jwt = (n) => e.check(rr(fs, n)), e.emoji = (n) => e.check(Gi(es, n)), e.guid = (n) => e.check(ut(pt, n)), e.uuid = (n) => e.check(Fi(de, n)), e.uuidv4 = (n) => e.check(Mi(de, n)), e.uuidv6 = (n) => e.check(Ui(de, n)), e.uuidv7 = (n) => e.check(Vi(de, n)), e.nanoid = (n) => e.check(Wi(ts, n)), e.guid = (n) => e.check(ut(pt, n)), e.cuid = (n) => e.check(qi(ns, n)), e.cuid2 = (n) => e.check(Ki(os, n)), e.ulid = (n) => e.check(Hi(is, n)), e.base64 = (n) => e.check(nr(ds, n)), e.base64url = (n) => e.check(or(ps, n)), e.xid = (n) => e.check(Ji(rs, n)), e.ksuid = (n) => e.check(Yi(ss, n)), e.ipv4 = (n) => e.check(Qi(as, n)), e.ipv6 = (n) => e.check(Xi(us, n)), e.cidrv4 = (n) => e.check(er(cs, n)), e.cidrv6 = (n) => e.check(tr(ls, n)), e.e164 = (n) => e.check(ir(hs, n)), e.datetime = (n) => e.check(Or(n)), e.date = (n) => e.check(Pr(n)), e.time = (n) => e.check(Lr(n)), e.duration = (n) => e.check(jr(n));
2868
+ e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(_i(...o)), e.includes = (...o) => e.check(gi(...o)), e.startsWith = (...o) => e.check(yi(...o)), e.endsWith = (...o) => e.check(bi(...o)), e.min = (...o) => e.check(_e(...o)), e.max = (...o) => e.check(Wt(...o)), e.length = (...o) => e.check(qt(...o)), e.nonempty = (...o) => e.check(_e(1, ...o)), e.lowercase = (o) => e.check(mi(o)), e.uppercase = (o) => e.check(vi(o)), e.trim = () => e.check(Ei()), e.normalize = (...o) => e.check(wi(...o)), e.toLowerCase = () => e.check(ki()), e.toUpperCase = () => e.check(Ci()), e.slugify = () => e.check(Ai());
2869
+ }), Yi = /* @__PURE__ */ m("ZodString", (e, t) => {
2870
+ Me.init(e, t), Kt.init(e, t), e.email = (n) => e.check(Dr(Qi, n)), e.url = (n) => e.check(Br(Xi, n)), e.jwt = (n) => e.check(ii(fs, n)), e.emoji = (n) => e.check(Gr(es, n)), e.guid = (n) => e.check(ut(pt, n)), e.uuid = (n) => e.check(Ur(de, n)), e.uuidv4 = (n) => e.check(Fr(de, n)), e.uuidv6 = (n) => e.check(Mr(de, n)), e.uuidv7 = (n) => e.check(Vr(de, n)), e.nanoid = (n) => e.check(Wr(ts, n)), e.guid = (n) => e.check(ut(pt, n)), e.cuid = (n) => e.check(qr(ns, n)), e.cuid2 = (n) => e.check(Kr(os, n)), e.ulid = (n) => e.check(Hr(rs, n)), e.base64 = (n) => e.check(ni(ds, n)), e.base64url = (n) => e.check(oi(ps, n)), e.xid = (n) => e.check(Jr(is, n)), e.ksuid = (n) => e.check(Yr(ss, n)), e.ipv4 = (n) => e.check(Qr(as, n)), e.ipv6 = (n) => e.check(Xr(us, n)), e.cidrv4 = (n) => e.check(ei(cs, n)), e.cidrv6 = (n) => e.check(ti(ls, n)), e.e164 = (n) => e.check(ri(hs, n)), e.datetime = (n) => e.check(Oi(n)), e.date = (n) => e.check(Pi(n)), e.time = (n) => e.check(Li(n)), e.duration = (n) => e.check(ji(n));
2871
2871
  });
2872
2872
  function Y(e) {
2873
- return Ni(Yr, e);
2873
+ return Nr(Yi, e);
2874
2874
  }
2875
2875
  const $ = /* @__PURE__ */ m("ZodStringFormat", (e, t) => {
2876
2876
  z.init(e, t), Kt.init(e, t);
2877
- }), Qr = /* @__PURE__ */ m("ZodEmail", (e, t) => {
2877
+ }), Qi = /* @__PURE__ */ m("ZodEmail", (e, t) => {
2878
2878
  Bo.init(e, t), $.init(e, t);
2879
2879
  }), pt = /* @__PURE__ */ m("ZodGUID", (e, t) => {
2880
- Uo.init(e, t), $.init(e, t);
2880
+ Mo.init(e, t), $.init(e, t);
2881
2881
  }), de = /* @__PURE__ */ m("ZodUUID", (e, t) => {
2882
2882
  Vo.init(e, t), $.init(e, t);
2883
- }), Xr = /* @__PURE__ */ m("ZodURL", (e, t) => {
2883
+ }), Xi = /* @__PURE__ */ m("ZodURL", (e, t) => {
2884
2884
  Go.init(e, t), $.init(e, t);
2885
2885
  }), es = /* @__PURE__ */ m("ZodEmoji", (e, t) => {
2886
2886
  Wo.init(e, t), $.init(e, t);
@@ -2890,68 +2890,68 @@ const $ = /* @__PURE__ */ m("ZodStringFormat", (e, t) => {
2890
2890
  Ko.init(e, t), $.init(e, t);
2891
2891
  }), os = /* @__PURE__ */ m("ZodCUID2", (e, t) => {
2892
2892
  Ho.init(e, t), $.init(e, t);
2893
- }), is = /* @__PURE__ */ m("ZodULID", (e, t) => {
2893
+ }), rs = /* @__PURE__ */ m("ZodULID", (e, t) => {
2894
2894
  Jo.init(e, t), $.init(e, t);
2895
- }), rs = /* @__PURE__ */ m("ZodXID", (e, t) => {
2895
+ }), is = /* @__PURE__ */ m("ZodXID", (e, t) => {
2896
2896
  Yo.init(e, t), $.init(e, t);
2897
2897
  }), ss = /* @__PURE__ */ m("ZodKSUID", (e, t) => {
2898
2898
  Qo.init(e, t), $.init(e, t);
2899
2899
  }), as = /* @__PURE__ */ m("ZodIPv4", (e, t) => {
2900
- oi.init(e, t), $.init(e, t);
2900
+ or.init(e, t), $.init(e, t);
2901
2901
  }), us = /* @__PURE__ */ m("ZodIPv6", (e, t) => {
2902
- ii.init(e, t), $.init(e, t);
2902
+ rr.init(e, t), $.init(e, t);
2903
2903
  }), cs = /* @__PURE__ */ m("ZodCIDRv4", (e, t) => {
2904
- ri.init(e, t), $.init(e, t);
2904
+ ir.init(e, t), $.init(e, t);
2905
2905
  }), ls = /* @__PURE__ */ m("ZodCIDRv6", (e, t) => {
2906
- si.init(e, t), $.init(e, t);
2906
+ sr.init(e, t), $.init(e, t);
2907
2907
  }), ds = /* @__PURE__ */ m("ZodBase64", (e, t) => {
2908
- ai.init(e, t), $.init(e, t);
2908
+ ar.init(e, t), $.init(e, t);
2909
2909
  }), ps = /* @__PURE__ */ m("ZodBase64URL", (e, t) => {
2910
- ci.init(e, t), $.init(e, t);
2910
+ cr.init(e, t), $.init(e, t);
2911
2911
  }), hs = /* @__PURE__ */ m("ZodE164", (e, t) => {
2912
- li.init(e, t), $.init(e, t);
2912
+ lr.init(e, t), $.init(e, t);
2913
2913
  }), fs = /* @__PURE__ */ m("ZodJWT", (e, t) => {
2914
- pi.init(e, t), $.init(e, t);
2914
+ pr.init(e, t), $.init(e, t);
2915
2915
  }), Ht = /* @__PURE__ */ m("ZodNumber", (e, t) => {
2916
- Vt.init(e, t), I.init(e, t), e.gt = (o, r) => e.check(lt(o, r)), e.gte = (o, r) => e.check(Ae(o, r)), e.min = (o, r) => e.check(Ae(o, r)), e.lt = (o, r) => e.check(ct(o, r)), e.lte = (o, r) => e.check(Ce(o, r)), e.max = (o, r) => e.check(Ce(o, r)), e.int = (o) => e.check(ht(o)), e.safe = (o) => e.check(ht(o)), e.positive = (o) => e.check(lt(0, o)), e.nonnegative = (o) => e.check(Ae(0, o)), e.negative = (o) => e.check(ct(0, o)), e.nonpositive = (o) => e.check(Ce(0, o)), e.multipleOf = (o, r) => e.check(dt(o, r)), e.step = (o, r) => e.check(dt(o, r)), e.finite = () => e;
2916
+ Vt.init(e, t), I.init(e, t), e.gt = (o, i) => e.check(lt(o, i)), e.gte = (o, i) => e.check(Ae(o, i)), e.min = (o, i) => e.check(Ae(o, i)), e.lt = (o, i) => e.check(ct(o, i)), e.lte = (o, i) => e.check(Ce(o, i)), e.max = (o, i) => e.check(Ce(o, i)), e.int = (o) => e.check(ht(o)), e.safe = (o) => e.check(ht(o)), e.positive = (o) => e.check(lt(0, o)), e.nonnegative = (o) => e.check(Ae(0, o)), e.negative = (o) => e.check(ct(0, o)), e.nonpositive = (o) => e.check(Ce(0, o)), e.multipleOf = (o, i) => e.check(dt(o, i)), e.step = (o, i) => e.check(dt(o, i)), e.finite = () => e;
2917
2917
  const n = e._zod.bag;
2918
2918
  e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
2919
2919
  });
2920
2920
  function Z(e) {
2921
- return lr(Ht, e);
2921
+ return li(Ht, e);
2922
2922
  }
2923
2923
  const _s = /* @__PURE__ */ m("ZodNumberFormat", (e, t) => {
2924
- hi.init(e, t), Ht.init(e, t);
2924
+ hr.init(e, t), Ht.init(e, t);
2925
2925
  });
2926
2926
  function ht(e) {
2927
- return dr(_s, e);
2927
+ return di(_s, e);
2928
2928
  }
2929
2929
  const ms = /* @__PURE__ */ m("ZodNull", (e, t) => {
2930
- fi.init(e, t), I.init(e, t);
2930
+ fr.init(e, t), I.init(e, t);
2931
2931
  });
2932
2932
  function vs(e) {
2933
- return pr(ms, e);
2933
+ return pi(ms, e);
2934
2934
  }
2935
2935
  const gs = /* @__PURE__ */ m("ZodUnknown", (e, t) => {
2936
- _i.init(e, t), I.init(e, t);
2936
+ _r.init(e, t), I.init(e, t);
2937
2937
  });
2938
2938
  function ft() {
2939
- return hr(gs);
2939
+ return hi(gs);
2940
2940
  }
2941
2941
  const ys = /* @__PURE__ */ m("ZodNever", (e, t) => {
2942
- mi.init(e, t), I.init(e, t);
2942
+ mr.init(e, t), I.init(e, t);
2943
2943
  });
2944
2944
  function bs(e) {
2945
- return fr(ys, e);
2945
+ return fi(ys, e);
2946
2946
  }
2947
2947
  const ws = /* @__PURE__ */ m("ZodArray", (e, t) => {
2948
- vi.init(e, t), I.init(e, t), e.element = t.element, e.min = (n, o) => e.check(_e(n, o)), e.nonempty = (n) => e.check(_e(1, n)), e.max = (n, o) => e.check(Wt(n, o)), e.length = (n, o) => e.check(qt(n, o)), e.unwrap = () => e.element;
2948
+ vr.init(e, t), I.init(e, t), e.element = t.element, e.min = (n, o) => e.check(_e(n, o)), e.nonempty = (n) => e.check(_e(1, n)), e.max = (n, o) => e.check(Wt(n, o)), e.length = (n, o) => e.check(qt(n, o)), e.unwrap = () => e.element;
2949
2949
  });
2950
2950
  function Es(e, t) {
2951
- return Tr(ws, e, t);
2951
+ return Ti(ws, e, t);
2952
2952
  }
2953
2953
  const ks = /* @__PURE__ */ m("ZodObject", (e, t) => {
2954
- yi.init(e, t), I.init(e, t), C(e, "shape", () => t.shape), e.keyof = () => $s(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: ft() }), e.loose = () => e.clone({ ...e._zod.def, catchall: ft() }), e.strict = () => e.clone({ ...e._zod.def, catchall: bs() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => Nn(e, n), e.safeExtend = (n) => Dn(e, n), e.merge = (n) => Fn(e, n), e.pick = (n) => Rn(e, n), e.omit = (n) => jn(e, n), e.partial = (...n) => Mn(Jt, e, n[0]), e.required = (...n) => Un(Yt, e, n[0]);
2954
+ yr.init(e, t), I.init(e, t), C(e, "shape", () => t.shape), e.keyof = () => $s(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: ft() }), e.loose = () => e.clone({ ...e._zod.def, catchall: ft() }), e.strict = () => e.clone({ ...e._zod.def, catchall: bs() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => Nn(e, n), e.safeExtend = (n) => Dn(e, n), e.merge = (n) => Un(e, n), e.pick = (n) => Rn(e, n), e.omit = (n) => jn(e, n), e.partial = (...n) => Fn(Jt, e, n[0]), e.required = (...n) => Mn(Yt, e, n[0]);
2955
2955
  });
2956
2956
  function S(e, t) {
2957
2957
  const n = {
@@ -2962,7 +2962,7 @@ function S(e, t) {
2962
2962
  return new ks(n);
2963
2963
  }
2964
2964
  const Cs = /* @__PURE__ */ m("ZodUnion", (e, t) => {
2965
- bi.init(e, t), I.init(e, t), e.options = t.options;
2965
+ br.init(e, t), I.init(e, t), e.options = t.options;
2966
2966
  });
2967
2967
  function G(e, t) {
2968
2968
  return new Cs({
@@ -2972,7 +2972,7 @@ function G(e, t) {
2972
2972
  });
2973
2973
  }
2974
2974
  const As = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
2975
- wi.init(e, t), I.init(e, t);
2975
+ wr.init(e, t), I.init(e, t);
2976
2976
  });
2977
2977
  function Ts(e, t) {
2978
2978
  return new As({
@@ -2982,22 +2982,22 @@ function Ts(e, t) {
2982
2982
  });
2983
2983
  }
2984
2984
  const Ss = /* @__PURE__ */ m("ZodTuple", (e, t) => {
2985
- Ei.init(e, t), I.init(e, t), e.rest = (n) => e.clone({
2985
+ Er.init(e, t), I.init(e, t), e.rest = (n) => e.clone({
2986
2986
  ...e._zod.def,
2987
2987
  rest: n
2988
2988
  });
2989
2989
  });
2990
2990
  function L(e, t, n) {
2991
- const o = t instanceof A, r = 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 Ss({
2993
2993
  type: "tuple",
2994
2994
  items: e,
2995
2995
  rest: a,
2996
- ...b(r)
2996
+ ...b(i)
2997
2997
  });
2998
2998
  }
2999
2999
  const zs = /* @__PURE__ */ m("ZodRecord", (e, t) => {
3000
- ki.init(e, t), I.init(e, t), e.keyType = t.keyType, e.valueType = t.valueType;
3000
+ kr.init(e, t), I.init(e, t), e.keyType = t.keyType, e.valueType = t.valueType;
3001
3001
  });
3002
3002
  function Is(e, t, n) {
3003
3003
  return new zs({
@@ -3008,9 +3008,9 @@ function Is(e, t, n) {
3008
3008
  });
3009
3009
  }
3010
3010
  const xe = /* @__PURE__ */ m("ZodEnum", (e, t) => {
3011
- Ci.init(e, t), I.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
3011
+ Cr.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
- e.extract = (o, r) => {
3013
+ e.extract = (o, i) => {
3014
3014
  const a = {};
3015
3015
  for (const c of o)
3016
3016
  if (n.has(c))
@@ -3020,10 +3020,10 @@ const xe = /* @__PURE__ */ m("ZodEnum", (e, t) => {
3020
3020
  return new xe({
3021
3021
  ...t,
3022
3022
  checks: [],
3023
- ...b(r),
3023
+ ...b(i),
3024
3024
  entries: a
3025
3025
  });
3026
- }, e.exclude = (o, r) => {
3026
+ }, e.exclude = (o, i) => {
3027
3027
  const a = { ...t.entries };
3028
3028
  for (const c of o)
3029
3029
  if (n.has(c))
@@ -3033,7 +3033,7 @@ const xe = /* @__PURE__ */ m("ZodEnum", (e, t) => {
3033
3033
  return new xe({
3034
3034
  ...t,
3035
3035
  checks: [],
3036
- ...b(r),
3036
+ ...b(i),
3037
3037
  entries: a
3038
3038
  });
3039
3039
  };
@@ -3047,7 +3047,7 @@ function $s(e, t) {
3047
3047
  });
3048
3048
  }
3049
3049
  const Os = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
3050
- Ai.init(e, t), I.init(e, t), e.values = new Set(t.values), Object.defineProperty(e, "value", {
3050
+ Ar.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.");
@@ -3063,19 +3063,19 @@ function R(e, t) {
3063
3063
  });
3064
3064
  }
3065
3065
  const Zs = /* @__PURE__ */ m("ZodTransform", (e, t) => {
3066
- Ti.init(e, t), I.init(e, t), e._zod.parse = (n, o) => {
3066
+ Tr.init(e, t), I.init(e, t), e._zod.parse = (n, o) => {
3067
3067
  if (o.direction === "backward")
3068
3068
  throw new It(e.constructor.name);
3069
3069
  n.addIssue = (a) => {
3070
3070
  if (typeof a == "string")
3071
- n.issues.push(re(a, n.value, t));
3071
+ n.issues.push(ie(a, n.value, t));
3072
3072
  else {
3073
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));
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(ie(c));
3075
3075
  }
3076
3076
  };
3077
- const r = t.transform(n.value, n);
3078
- return r instanceof Promise ? r.then((a) => (n.value = a, n)) : (n.value = r, n);
3077
+ const i = t.transform(n.value, n);
3078
+ return i instanceof Promise ? i.then((a) => (n.value = a, n)) : (n.value = i, n);
3079
3079
  };
3080
3080
  });
3081
3081
  function Ps(e) {
@@ -3085,7 +3085,7 @@ function Ps(e) {
3085
3085
  });
3086
3086
  }
3087
3087
  const Jt = /* @__PURE__ */ m("ZodOptional", (e, t) => {
3088
- Si.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3088
+ Sr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3089
3089
  });
3090
3090
  function _t(e) {
3091
3091
  return new Jt({
@@ -3094,7 +3094,7 @@ function _t(e) {
3094
3094
  });
3095
3095
  }
3096
3096
  const xs = /* @__PURE__ */ m("ZodNullable", (e, t) => {
3097
- zi.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3097
+ zr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3098
3098
  });
3099
3099
  function mt(e) {
3100
3100
  return new xs({
@@ -3103,7 +3103,7 @@ function mt(e) {
3103
3103
  });
3104
3104
  }
3105
3105
  const Ls = /* @__PURE__ */ m("ZodDefault", (e, t) => {
3106
- Ii.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
3106
+ Ir.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
3107
3107
  });
3108
3108
  function Rs(e, t) {
3109
3109
  return new Ls({
@@ -3115,7 +3115,7 @@ function Rs(e, t) {
3115
3115
  });
3116
3116
  }
3117
3117
  const js = /* @__PURE__ */ m("ZodPrefault", (e, t) => {
3118
- $i.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3118
+ $r.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3119
3119
  });
3120
3120
  function Ns(e, t) {
3121
3121
  return new js({
@@ -3127,7 +3127,7 @@ function Ns(e, t) {
3127
3127
  });
3128
3128
  }
3129
3129
  const Yt = /* @__PURE__ */ m("ZodNonOptional", (e, t) => {
3130
- Oi.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3130
+ Or.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3131
3131
  });
3132
3132
  function Ds(e, t) {
3133
3133
  return new Yt({
@@ -3136,21 +3136,21 @@ function Ds(e, t) {
3136
3136
  ...b(t)
3137
3137
  });
3138
3138
  }
3139
- const Fs = /* @__PURE__ */ m("ZodCatch", (e, t) => {
3140
- Zi.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
3139
+ const Us = /* @__PURE__ */ m("ZodCatch", (e, t) => {
3140
+ Zr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
3141
3141
  });
3142
- function Ms(e, t) {
3143
- return new Fs({
3142
+ function Fs(e, t) {
3143
+ return new Us({
3144
3144
  type: "catch",
3145
3145
  innerType: e,
3146
3146
  catchValue: typeof t == "function" ? t : () => t
3147
3147
  });
3148
3148
  }
3149
- const Us = /* @__PURE__ */ m("ZodPipe", (e, t) => {
3150
- Pi.init(e, t), I.init(e, t), e.in = t.in, e.out = t.out;
3149
+ const Ms = /* @__PURE__ */ m("ZodPipe", (e, t) => {
3150
+ Pr.init(e, t), I.init(e, t), e.in = t.in, e.out = t.out;
3151
3151
  });
3152
3152
  function vt(e, t) {
3153
- return new Us({
3153
+ return new Ms({
3154
3154
  type: "pipe",
3155
3155
  in: e,
3156
3156
  out: t
@@ -3158,7 +3158,7 @@ function vt(e, t) {
3158
3158
  });
3159
3159
  }
3160
3160
  const Vs = /* @__PURE__ */ m("ZodReadonly", (e, t) => {
3161
- xi.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3161
+ xr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
3162
3162
  });
3163
3163
  function Bs(e) {
3164
3164
  return new Vs({
@@ -3167,13 +3167,13 @@ function Bs(e) {
3167
3167
  });
3168
3168
  }
3169
3169
  const Gs = /* @__PURE__ */ m("ZodCustom", (e, t) => {
3170
- Li.init(e, t), I.init(e, t);
3170
+ Lr.init(e, t), I.init(e, t);
3171
3171
  });
3172
3172
  function Ws(e, t = {}) {
3173
- return Sr(Gs, e, t);
3173
+ return Si(Gs, e, t);
3174
3174
  }
3175
3175
  function qs(e) {
3176
- return zr(e);
3176
+ return zi(e);
3177
3177
  }
3178
3178
  const be = S({
3179
3179
  t: Z().gte(0),
@@ -3257,20 +3257,20 @@ const be = S({
3257
3257
  ]), oa = S({
3258
3258
  ...Ks.shape,
3259
3259
  keyframes: L([Qs], G([Ys, Ve]))
3260
- }), ia = S({
3260
+ }), ra = S({
3261
3261
  ...Hs.shape,
3262
3262
  keyframes: L([ea], G([Xs, Ve]))
3263
- }), ra = S({
3263
+ }), ia = S({
3264
3264
  ...Js.shape,
3265
3265
  keyframes: L([na], G([ta, Ve]))
3266
- }), sa = Is(Y(), G([oa, ia, ra])), me = {
3266
+ }), sa = Is(Y(), G([oa, ra, ia])), me = {
3267
3267
  opacity: 1,
3268
3268
  zIndex: 0
3269
3269
  }, we = {
3270
3270
  t: 0,
3271
3271
  rate: 1,
3272
3272
  volume: 1
3273
- }, ie = {
3273
+ }, re = {
3274
3274
  t: 0,
3275
3275
  rate: 1,
3276
3276
  volume: 1,
@@ -3281,11 +3281,328 @@ const be = S({
3281
3281
  MediaSurfaceStateSchema: sa,
3282
3282
  defaultAudioOptions: we,
3283
3283
  defaultImageOptions: me,
3284
- defaultVideoOptions: ie
3284
+ defaultVideoOptions: re
3285
3285
  }, Symbol.toStringTag, { value: "Module" }));
3286
- var Te = {}, gt;
3287
- function aa() {
3288
- return gt || (gt = 1, function(e) {
3286
+ function Ee(e, t) {
3287
+ switch (e.type) {
3288
+ case "image": {
3289
+ if (e.keyframes[0][0] > t)
3290
+ return;
3291
+ const o = e.keyframes.filter((a) => a[1] !== null), i = Te(o, t);
3292
+ return { ...me, ...i };
3293
+ }
3294
+ case "audio": {
3295
+ const n = e.keyframes.filter((a) => a[1] !== null), o = gt(n, t);
3296
+ if (!o)
3297
+ return;
3298
+ const i = Te(n, t);
3299
+ return { ...we, ...i, ...o };
3300
+ }
3301
+ case "video": {
3302
+ const n = e.keyframes.filter((a) => a[1] !== null), o = gt(n, t);
3303
+ if (!o)
3304
+ return;
3305
+ const i = Te(n, t);
3306
+ return { ...re, ...i, ...o };
3307
+ }
3308
+ }
3309
+ }
3310
+ function Te(e, t) {
3311
+ const n = {};
3312
+ for (const [i, a] of e)
3313
+ i <= t ? (Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
3314
+ n[c] ??= {}, n[c].before = [i, l];
3315
+ }), Object.entries(a.set ?? {}).forEach(([c, l]) => {
3316
+ n[c] ??= {}, n[c].before = [i, l];
3317
+ })) : Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
3318
+ n[c] ??= {}, n[c].after === void 0 && (n[c].after = [i, l]);
3319
+ });
3320
+ const o = {};
3321
+ return Object.entries(n).forEach(
3322
+ ([i, { before: a, after: c }]) => {
3323
+ if (c === void 0 && a) {
3324
+ o[i] = a[1];
3325
+ return;
3326
+ }
3327
+ if (a && c && a[0] === c[0]) {
3328
+ o[i] = c[1];
3329
+ return;
3330
+ }
3331
+ if (a && typeof a[1] == "number" && c && typeof c[1] == "number") {
3332
+ o[i] = a[1] + (t - a[0]) * (c[1] - a[1]) / (c[0] - a[0]);
3333
+ return;
3334
+ }
3335
+ }
3336
+ ), o;
3337
+ }
3338
+ function gt(e, t) {
3339
+ const n = e[0];
3340
+ if (!n || n[0] > t)
3341
+ return;
3342
+ let o = 0, { t: i, rate: a } = we;
3343
+ for (const [f, y] of e) {
3344
+ if (f > t) break;
3345
+ const { set: g } = y;
3346
+ if (!g) continue;
3347
+ const { t: r, rate: s } = g;
3348
+ if (r !== void 0) {
3349
+ o = f, i = r, s !== void 0 && (a = s);
3350
+ continue;
3351
+ }
3352
+ if (s !== void 0) {
3353
+ const p = (f - o) * a;
3354
+ o = f, i += p, a = s;
3355
+ }
3356
+ }
3357
+ const l = (t - o) * a, d = i + l;
3358
+ return {
3359
+ rate: a,
3360
+ t: d
3361
+ };
3362
+ }
3363
+ const aa = 1e3;
3364
+ class Be {
3365
+ constructor(t, n, o, i) {
3366
+ this.surfaceElement = t, this.clipElement = n, this.constructAssetURL = i, this._state = o, setTimeout(this.loop);
3367
+ }
3368
+ /**
3369
+ * This is the delay to be used in the update loop.
3370
+ * It is intended to be dynamic for each loop.
3371
+ */
3372
+ delay = aa;
3373
+ isConnected(t) {
3374
+ return !(!this.surfaceElement || !this.clipElement || !this.surfaceElement.contains(this.clipElement) || t && !this.clipElement.contains(t));
3375
+ }
3376
+ _state;
3377
+ setState(t) {
3378
+ this._state = t, clearTimeout(this.timeout), this.loop();
3379
+ }
3380
+ timeout;
3381
+ loop = async () => {
3382
+ this.isConnected() ? (this.update(), isFinite(this.delay) && (this.timeout = setTimeout(this.loop, this.delay))) : this.destroy();
3383
+ };
3384
+ }
3385
+ class ua extends Be {
3386
+ imageElement;
3387
+ constructor(t, n, o, i) {
3388
+ super(t, n, o, i), this.clipElement = n;
3389
+ }
3390
+ updateImageElement() {
3391
+ this.imageElement = document.createElement("img"), this.clipElement.replaceChildren(this.imageElement), this.imageElement.style.position = "absolute", this.imageElement.style.height = "100%", this.imageElement.style.widows = "100%";
3392
+ }
3393
+ update() {
3394
+ const t = Ee(this._state, Date.now());
3395
+ if (t ? (!this.imageElement || !this.isConnected(this.imageElement)) && this.updateImageElement() : (this.imageElement?.remove(), this.imageElement = void 0), !this.imageElement || !t) return;
3396
+ const n = this.constructAssetURL(this._state.file);
3397
+ this.imageElement.src.includes(n) || (this.imageElement.src = n), this.imageElement.style.objectFit !== this._state.fit && (this.imageElement.style.objectFit = this._state.fit), parseFloat(this.imageElement.style.opacity) !== t.opacity && (this.imageElement.style.opacity = String(t.opacity ?? me.opacity));
3398
+ const o = Math.round(t.zIndex ?? me.zIndex);
3399
+ parseInt(this.imageElement.style.zIndex) !== o && (this.imageElement.style.zIndex = String(o));
3400
+ const { opacity: i } = t;
3401
+ typeof i == "string" && i !== this.imageElement.style.opacity && (this.imageElement.style.opacity = i);
3402
+ }
3403
+ destroy() {
3404
+ this.imageElement?.remove();
3405
+ }
3406
+ }
3407
+ const ca = 1e3, Se = 10, Qt = 1e3, la = 200, da = 0.15, yt = 0.7, pa = 0.3;
3408
+ function ha(e) {
3409
+ return -Math.sign(e) * Math.pow(Math.abs(e) / Qt, pa) * da;
3410
+ }
3411
+ const fa = 5;
3412
+ function _a(e, t, n) {
3413
+ const o = Ee(e, t);
3414
+ if (!o) return !1;
3415
+ const { t: i, rate: a } = o;
3416
+ if (i === void 0 || a === void 0) return !1;
3417
+ const c = e.keyframes.filter(([f, y]) => f > t && (y?.set?.t !== void 0 || y?.set?.rate !== void 0))[0];
3418
+ if (c?.[1]?.set?.t !== 0) return !1;
3419
+ const l = (n - i) / a, d = c[0] - t;
3420
+ return Math.abs(l - d) <= fa;
3421
+ }
3422
+ class ma extends Be {
3423
+ videoElement;
3424
+ // We seek to another part of the video and do nothing until we get there
3425
+ isSeeking = !1;
3426
+ // We change playbackRate to intercept the server time of the video and don't change course until we intercept
3427
+ timeToIntercept = void 0;
3428
+ constructor(t, n, o, i) {
3429
+ super(t, n, o, i), this.clipElement = n;
3430
+ }
3431
+ updateVideoElement() {
3432
+ this.destroy(), this.videoElement = document.createElement("video"), this.clipElement.replaceChildren(this.videoElement), this.videoElement.style.position = "absolute", this.videoElement.style.width = "100%", this.videoElement.style.height = "100%";
3433
+ }
3434
+ get videoDuration() {
3435
+ if (this.videoElement && !(this.videoElement.readyState < HTMLMediaElement.HAVE_METADATA))
3436
+ return this.videoElement.duration * 1e3;
3437
+ }
3438
+ /**
3439
+ * Helper function to seek to a specified time.
3440
+ * Works with the update loop to poll until seeked event has fired.
3441
+ */
3442
+ seekTo(t) {
3443
+ this.videoElement && (this.videoElement.addEventListener(
3444
+ "seeked",
3445
+ () => {
3446
+ console.debug("seeked"), this.isSeeking = !1;
3447
+ },
3448
+ { once: !0, passive: !0 }
3449
+ ), this.videoElement.currentTime = t / 1e3);
3450
+ }
3451
+ update() {
3452
+ if (this.isSeeking) return;
3453
+ const t = Date.now(), n = Ee(this._state, t);
3454
+ if (n ? (!this.videoElement || !this.isConnected(this.videoElement)) && this.updateVideoElement() : (this.videoElement?.remove(), this.videoElement = void 0), !n || !this.videoElement) return;
3455
+ const { t: o, rate: i, volume: a } = { ...re, ...n }, c = this.constructAssetURL(this._state.file);
3456
+ this.videoElement.src.includes(c) || (this.videoElement.src = c), this.videoElement.style.objectFit !== this._state.fit && (this.videoElement.style.objectFit = this._state.fit), parseFloat(this.videoElement.style.opacity) !== n.opacity && (this.videoElement.style.opacity = String(n.opacity ?? re.opacity));
3457
+ const l = Math.round(n.zIndex ?? re.zIndex);
3458
+ parseInt(this.videoElement.style.zIndex) !== l && (this.videoElement.style.zIndex = String(l)), this.videoElement.volume !== a && (this.videoElement.volume = a);
3459
+ const d = this.videoDuration;
3460
+ if (d !== void 0) {
3461
+ if (_a(this._state, t, d))
3462
+ this.videoElement.loop || (console.debug("starting loop"), this.videoElement.loop = !0);
3463
+ else if (this.videoElement.loop && (console.debug("stopping loop"), this.videoElement.loop = !1), o > d) {
3464
+ console.debug("ended"), this.delay = 1 / 0;
3465
+ return;
3466
+ }
3467
+ }
3468
+ this.videoElement.paused && i > 0 && (d === void 0 || d > o) && this.videoElement.play().catch(() => {
3469
+ });
3470
+ const y = this.videoElement.currentTime * 1e3 - o, g = Math.abs(y);
3471
+ if (this.timeToIntercept !== void 0)
3472
+ if (g <= Se)
3473
+ console.log("intercepted", `${y.toFixed(0)}ms`), this.timeToIntercept = void 0;
3474
+ else {
3475
+ const r = y / (i - this.videoElement.playbackRate);
3476
+ r < this.timeToIntercept && r > 0 ? (console.debug(`intercepting ${r.toFixed(0)}ms`, `${y.toFixed(0)}ms`), this.timeToIntercept = r) : (console.debug("missed intercept", y, this.timeToIntercept, r), this.timeToIntercept = void 0);
3477
+ }
3478
+ switch (!0) {
3479
+ case g <= Se: {
3480
+ console.debug(`${i}x`, y.toFixed(0)), this.timeToIntercept = void 0, this.videoElement.playbackRate !== i && (this.videoElement.playbackRate = i), this.delay = ca;
3481
+ break;
3482
+ }
3483
+ case this.timeToIntercept !== void 0:
3484
+ this.delay = this.timeToIntercept * yt;
3485
+ break;
3486
+ case (i > 0 && g > Se && g <= Qt && this.timeToIntercept === void 0): {
3487
+ const r = ha(y), s = Math.max(0, i + r);
3488
+ this.timeToIntercept = y / (i - s), console.debug(`${s.toFixed(2)}x`, `${y.toFixed(0)}ms`), this.videoElement.playbackRate !== s && (this.videoElement.playbackRate = s), this.delay = this.timeToIntercept * yt;
3489
+ break;
3490
+ }
3491
+ default: {
3492
+ this.videoElement.playbackRate !== i && (this.videoElement.playbackRate = i), console.debug("seeking"), this.delay = 10, this.seekTo(o + i * la);
3493
+ break;
3494
+ }
3495
+ }
3496
+ }
3497
+ destroy() {
3498
+ this.videoElement && (this.videoElement.src = "", this.videoElement.remove());
3499
+ }
3500
+ }
3501
+ const va = 1e3, bt = 10, Xt = 1e3, ga = 200, ya = 0.2, ba = 0.5;
3502
+ function wa(e) {
3503
+ return Math.sign(e) * Math.pow(Math.abs(e) / Xt, ba) * ya;
3504
+ }
3505
+ class Ea extends Be {
3506
+ audioElement;
3507
+ isSeeking = !1;
3508
+ constructor(t, n, o, i) {
3509
+ super(t, n, o, i), this.clipElement = n;
3510
+ }
3511
+ updateAudioElement() {
3512
+ this.destroy(), this.audioElement = document.createElement("audio"), this.clipElement.replaceChildren(this.audioElement);
3513
+ }
3514
+ /**
3515
+ * Helper function to seek to a specified time.
3516
+ * Works with the update loop to poll until seeked event has fired.
3517
+ */
3518
+ seekTo(t) {
3519
+ this.audioElement && (this.audioElement.addEventListener(
3520
+ "seeked",
3521
+ () => {
3522
+ this.isSeeking = !1;
3523
+ },
3524
+ { once: !0, passive: !0 }
3525
+ ), this.audioElement.currentTime = t / 1e3);
3526
+ }
3527
+ update() {
3528
+ if (this.isSeeking) return;
3529
+ this.delay = va;
3530
+ const t = Ee(this._state, Date.now());
3531
+ if (t ? (!this.audioElement || !this.isConnected(this.audioElement)) && this.updateAudioElement() : this.destroy(), !t || !this.audioElement) return;
3532
+ const { t: n, rate: o, volume: i } = { ...we, ...t }, a = this.constructAssetURL(this._state.file);
3533
+ this.audioElement.src.includes(a) || (this.audioElement.src = a), this.audioElement.volume !== i && (this.audioElement.volume = i), this.audioElement.paused && o > 0 && this.audioElement.play().catch(() => {
3534
+ });
3535
+ const l = this.audioElement.currentTime * 1e3 - n, d = Math.abs(l);
3536
+ switch (this.delay = 100, !0) {
3537
+ case d <= bt:
3538
+ this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o);
3539
+ break;
3540
+ case (o > 0 && d > bt && d <= Xt): {
3541
+ const f = wa(l), y = Math.max(0, o - f);
3542
+ this.audioElement.playbackRate !== y && (this.audioElement.playbackRate = y);
3543
+ break;
3544
+ }
3545
+ default: {
3546
+ this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o), this.delay = 10, this.seekTo(n + o * (ga / 1e3));
3547
+ break;
3548
+ }
3549
+ }
3550
+ }
3551
+ destroy() {
3552
+ this.audioElement && (this.audioElement.src = "", this.audioElement.remove());
3553
+ }
3554
+ }
3555
+ const ka = "data-clip-id";
3556
+ class $a {
3557
+ constructor(t, n) {
3558
+ this.constructAssetUrl = t, 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();
3559
+ }
3560
+ _state = {};
3561
+ setState(t) {
3562
+ this._state = t, this.update();
3563
+ }
3564
+ _element;
3565
+ get element() {
3566
+ return this._element;
3567
+ }
3568
+ resources = {};
3569
+ update() {
3570
+ Object.entries(this.resources).forEach(([n, { element: o, manager: i }]) => {
3571
+ n in this._state || (delete this.resources[n], o.remove(), i?.destroy());
3572
+ });
3573
+ const t = Object.keys(this._state).toSorted().map((n) => {
3574
+ const o = this.resources[n];
3575
+ if (o)
3576
+ return o.element;
3577
+ {
3578
+ const i = document.createElement("div");
3579
+ return i.setAttribute(ka, n), this.resources[n] = { element: i }, i;
3580
+ }
3581
+ });
3582
+ this._element.replaceChildren(...t), Object.keys(this._state).toSorted().forEach((n) => {
3583
+ const o = this._state[n], i = this.resources[n];
3584
+ if (!i)
3585
+ throw new Error("Failed to create resource");
3586
+ if (i.manager)
3587
+ i.manager.setState(o);
3588
+ else
3589
+ switch (o.type) {
3590
+ case "image":
3591
+ i.manager = new ua(this._element, i.element, o, this.constructAssetUrl);
3592
+ break;
3593
+ case "audio":
3594
+ i.manager = new Ea(this._element, i.element, o, this.constructAssetUrl);
3595
+ break;
3596
+ case "video":
3597
+ i.manager = new ma(this._element, i.element, o, this.constructAssetUrl);
3598
+ break;
3599
+ }
3600
+ });
3601
+ }
3602
+ }
3603
+ var ze = {}, wt;
3604
+ function Ca() {
3605
+ return wt || (wt = 1, function(e) {
3289
3606
  var t = {};
3290
3607
  /*! howler.js v2.2.1 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */
3291
3608
  (function() {
@@ -3293,174 +3610,174 @@ function aa() {
3293
3610
  this.init();
3294
3611
  };
3295
3612
  n.prototype = { init: function() {
3296
- var i = this || o;
3297
- return i._counter = 1e3, i._html5AudioPool = [], i.html5PoolSize = 10, i._codecs = {}, i._howls = [], i._muted = !1, i._volume = 1, i._canPlayEvent = "canplaythrough", i._navigator = typeof window < "u" && window.navigator ? window.navigator : null, i.masterGain = null, i.noAudio = !1, i.usingWebAudio = !0, i.autoSuspend = !0, i.ctx = null, i.autoUnlock = !0, i._setup(), i;
3298
- }, volume: function(i) {
3613
+ var r = this || o;
3614
+ return r._counter = 1e3, r._html5AudioPool = [], r.html5PoolSize = 10, r._codecs = {}, r._howls = [], r._muted = !1, r._volume = 1, r._canPlayEvent = "canplaythrough", r._navigator = typeof window < "u" && window.navigator ? window.navigator : null, r.masterGain = null, r.noAudio = !1, r.usingWebAudio = !0, r.autoSuspend = !0, r.ctx = null, r.autoUnlock = !0, r._setup(), r;
3615
+ }, volume: function(r) {
3299
3616
  var s = this || o;
3300
- if (i = parseFloat(i), s.ctx || g(), i !== void 0 && i >= 0 && i <= 1) {
3301
- if (s._volume = i, s._muted) return s;
3302
- s.usingWebAudio && s.masterGain.gain.setValueAtTime(i, 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]);
3305
- v && v._node && (v._node.volume = v._volume * i);
3617
+ if (r = parseFloat(r), s.ctx || g(), r !== void 0 && r >= 0 && r <= 1) {
3618
+ if (s._volume = r, s._muted) return s;
3619
+ s.usingWebAudio && s.masterGain.gain.setValueAtTime(r, o.ctx.currentTime);
3620
+ for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var p = s._howls[u]._getSoundIds(), h = 0; h < p.length; h++) {
3621
+ var v = s._howls[u]._soundById(p[h]);
3622
+ v && v._node && (v._node.volume = v._volume * r);
3306
3623
  }
3307
3624
  return s;
3308
3625
  }
3309
3626
  return s._volume;
3310
- }, mute: function(i) {
3627
+ }, mute: function(r) {
3311
3628
  var s = this || o;
3312
- s.ctx || g(), s._muted = i, s.usingWebAudio && s.masterGain.gain.setValueAtTime(i ? 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]);
3315
- v && v._node && (v._node.muted = !!i || v._muted);
3629
+ s.ctx || g(), s._muted = r, s.usingWebAudio && s.masterGain.gain.setValueAtTime(r ? 0 : s._volume, o.ctx.currentTime);
3630
+ for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var p = s._howls[u]._getSoundIds(), h = 0; h < p.length; h++) {
3631
+ var v = s._howls[u]._soundById(p[h]);
3632
+ v && v._node && (v._node.muted = !!r || v._muted);
3316
3633
  }
3317
3634
  return s;
3318
3635
  }, stop: function() {
3319
- for (var i = this || o, s = 0; s < i._howls.length; s++) i._howls[s].stop();
3320
- return i;
3636
+ for (var r = this || o, s = 0; s < r._howls.length; s++) r._howls[s].stop();
3637
+ return r;
3321
3638
  }, unload: function() {
3322
- for (var i = this || o, s = i._howls.length - 1; s >= 0; s--) i._howls[s].unload();
3323
- return i.usingWebAudio && i.ctx && i.ctx.close !== void 0 && (i.ctx.close(), i.ctx = null, g()), i;
3324
- }, codecs: function(i) {
3325
- return (this || o)._codecs[i.replace(/^x-/, "")];
3639
+ for (var r = this || o, s = r._howls.length - 1; s >= 0; s--) r._howls[s].unload();
3640
+ return r.usingWebAudio && r.ctx && r.ctx.close !== void 0 && (r.ctx.close(), r.ctx = null, g()), r;
3641
+ }, codecs: function(r) {
3642
+ return (this || o)._codecs[r.replace(/^x-/, "")];
3326
3643
  }, _setup: function() {
3327
- var i = this || o;
3328
- if (i.state = i.ctx && i.ctx.state || "suspended", i._autoSuspend(), !i.usingWebAudio) if (typeof Audio < "u") try {
3644
+ var r = this || o;
3645
+ if (r.state = r.ctx && r.ctx.state || "suspended", r._autoSuspend(), !r.usingWebAudio) if (typeof Audio < "u") try {
3329
3646
  var s = new Audio();
3330
- s.oncanplaythrough === void 0 && (i._canPlayEvent = "canplay");
3647
+ s.oncanplaythrough === void 0 && (r._canPlayEvent = "canplay");
3331
3648
  } catch {
3332
- i.noAudio = !0;
3649
+ r.noAudio = !0;
3333
3650
  }
3334
- else i.noAudio = !0;
3651
+ else r.noAudio = !0;
3335
3652
  try {
3336
3653
  var s = new Audio();
3337
- s.muted && (i.noAudio = !0);
3654
+ s.muted && (r.noAudio = !0);
3338
3655
  } catch {
3339
3656
  }
3340
- return i.noAudio || i._setupCodecs(), i;
3657
+ return r.noAudio || r._setupCodecs(), r;
3341
3658
  }, _setupCodecs: function() {
3342
- var i = this || o, s = null;
3659
+ var r = this || o, s = null;
3343
3660
  try {
3344
3661
  s = typeof Audio < "u" ? new Audio() : null;
3345
3662
  } catch {
3346
- return i;
3663
+ return r;
3347
3664
  }
3348
- if (!s || typeof s.canPlayType != "function") return i;
3349
- var u = s.canPlayType("audio/mpeg;").replace(/^no$/, ""), d = i._navigator && i._navigator.userAgent.match(/OPR\/([0-6].)/g), f = d && parseInt(d[0].split("/")[1], 10) < 33;
3350
- return i._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$/, "") }, i;
3665
+ if (!s || typeof s.canPlayType != "function") return r;
3666
+ var u = s.canPlayType("audio/mpeg;").replace(/^no$/, ""), p = r._navigator && r._navigator.userAgent.match(/OPR\/([0-6].)/g), h = p && parseInt(p[0].split("/")[1], 10) < 33;
3667
+ return r._codecs = { mp3: !(h || !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;
3351
3668
  }, _unlockAudio: function() {
3352
- var i = this || o;
3353
- if (!i._audioUnlocked && i.ctx) {
3354
- i._audioUnlocked = !1, i.autoUnlock = !1, i._mobileUnloaded || i.ctx.sampleRate === 44100 || (i._mobileUnloaded = !0, i.unload()), i._scratchBuffer = i.ctx.createBuffer(1, 1, 22050);
3669
+ var r = this || o;
3670
+ if (!r._audioUnlocked && r.ctx) {
3671
+ 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
3672
  var s = function(u) {
3356
- for (; i._html5AudioPool.length < i.html5PoolSize; ) try {
3357
- var d = new Audio();
3358
- d._unlocked = !0, i._releaseHtml5Audio(d);
3673
+ for (; r._html5AudioPool.length < r.html5PoolSize; ) try {
3674
+ var p = new Audio();
3675
+ p._unlocked = !0, r._releaseHtml5Audio(p);
3359
3676
  } catch {
3360
- i.noAudio = !0;
3677
+ r.noAudio = !0;
3361
3678
  break;
3362
3679
  }
3363
- for (var f = 0; f < i._howls.length; f++) if (!i._howls[f]._webAudio) for (var v = i._howls[f]._getSoundIds(), _ = 0; _ < v.length; _++) {
3364
- var w = i._howls[f]._soundById(v[_]);
3680
+ for (var h = 0; h < r._howls.length; h++) if (!r._howls[h]._webAudio) for (var v = r._howls[h]._getSoundIds(), _ = 0; _ < v.length; _++) {
3681
+ var w = r._howls[h]._soundById(v[_]);
3365
3682
  w && w._node && !w._node._unlocked && (w._node._unlocked = !0, w._node.load());
3366
3683
  }
3367
- i._autoResume();
3368
- var E = i.ctx.createBufferSource();
3369
- E.buffer = i._scratchBuffer, E.connect(i.ctx.destination), E.start === void 0 ? E.noteOn(0) : E.start(0), typeof i.ctx.resume == "function" && i.ctx.resume(), E.onended = function() {
3370
- E.disconnect(0), i._audioUnlocked = !0, document.removeEventListener("touchstart", s, !0), document.removeEventListener("touchend", s, !0), document.removeEventListener("click", s, !0);
3371
- for (var k = 0; k < i._howls.length; k++) i._howls[k]._emit("unlock");
3684
+ r._autoResume();
3685
+ var E = r.ctx.createBufferSource();
3686
+ E.buffer = r._scratchBuffer, E.connect(r.ctx.destination), E.start === void 0 ? E.noteOn(0) : E.start(0), typeof r.ctx.resume == "function" && r.ctx.resume(), E.onended = function() {
3687
+ E.disconnect(0), r._audioUnlocked = !0, document.removeEventListener("touchstart", s, !0), document.removeEventListener("touchend", s, !0), document.removeEventListener("click", s, !0);
3688
+ for (var k = 0; k < r._howls.length; k++) r._howls[k]._emit("unlock");
3372
3689
  };
3373
3690
  };
3374
- return document.addEventListener("touchstart", s, !0), document.addEventListener("touchend", s, !0), document.addEventListener("click", s, !0), i;
3691
+ return document.addEventListener("touchstart", s, !0), document.addEventListener("touchend", s, !0), document.addEventListener("click", s, !0), r;
3375
3692
  }
3376
3693
  }, _obtainHtml5Audio: function() {
3377
- var i = this || o;
3378
- if (i._html5AudioPool.length) return i._html5AudioPool.pop();
3694
+ var r = this || o;
3695
+ if (r._html5AudioPool.length) return r._html5AudioPool.pop();
3379
3696
  var s = new Audio().play();
3380
3697
  return s && typeof Promise < "u" && (s instanceof Promise || typeof s.then == "function") && s.catch(function() {
3381
3698
  console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.");
3382
3699
  }), new Audio();
3383
- }, _releaseHtml5Audio: function(i) {
3700
+ }, _releaseHtml5Audio: function(r) {
3384
3701
  var s = this || o;
3385
- return i._unlocked && s._html5AudioPool.push(i), s;
3702
+ return r._unlocked && s._html5AudioPool.push(r), s;
3386
3703
  }, _autoSuspend: function() {
3387
- var i = this;
3388
- if (i.autoSuspend && i.ctx && i.ctx.suspend !== void 0 && o.usingWebAudio) {
3389
- for (var s = 0; s < i._howls.length; s++) if (i._howls[s]._webAudio) {
3390
- for (var u = 0; u < i._howls[s]._sounds.length; u++) if (!i._howls[s]._sounds[u]._paused) return i;
3704
+ var r = this;
3705
+ if (r.autoSuspend && r.ctx && r.ctx.suspend !== void 0 && o.usingWebAudio) {
3706
+ for (var s = 0; s < r._howls.length; s++) if (r._howls[s]._webAudio) {
3707
+ for (var u = 0; u < r._howls[s]._sounds.length; u++) if (!r._howls[s]._sounds[u]._paused) return r;
3391
3708
  }
3392
- return i._suspendTimer && clearTimeout(i._suspendTimer), i._suspendTimer = setTimeout(function() {
3393
- if (i.autoSuspend) {
3394
- i._suspendTimer = null, i.state = "suspending";
3395
- var d = function() {
3396
- i.state = "suspended", i._resumeAfterSuspend && (delete i._resumeAfterSuspend, i._autoResume());
3709
+ return r._suspendTimer && clearTimeout(r._suspendTimer), r._suspendTimer = setTimeout(function() {
3710
+ if (r.autoSuspend) {
3711
+ r._suspendTimer = null, r.state = "suspending";
3712
+ var p = function() {
3713
+ r.state = "suspended", r._resumeAfterSuspend && (delete r._resumeAfterSuspend, r._autoResume());
3397
3714
  };
3398
- i.ctx.suspend().then(d, d);
3715
+ r.ctx.suspend().then(p, p);
3399
3716
  }
3400
- }, 3e4), i;
3717
+ }, 3e4), r;
3401
3718
  }
3402
3719
  }, _autoResume: function() {
3403
- var i = this;
3404
- if (i.ctx && i.ctx.resume !== void 0 && o.usingWebAudio) return i.state === "running" && i.ctx.state !== "interrupted" && i._suspendTimer ? (clearTimeout(i._suspendTimer), i._suspendTimer = null) : i.state === "suspended" || i.state === "running" && i.ctx.state === "interrupted" ? (i.ctx.resume().then(function() {
3405
- i.state = "running";
3406
- for (var s = 0; s < i._howls.length; s++) i._howls[s]._emit("resume");
3407
- }), i._suspendTimer && (clearTimeout(i._suspendTimer), i._suspendTimer = null)) : i.state === "suspending" && (i._resumeAfterSuspend = !0), i;
3720
+ var r = this;
3721
+ if (r.ctx && r.ctx.resume !== void 0 && o.usingWebAudio) return r.state === "running" && r.ctx.state !== "interrupted" && r._suspendTimer ? (clearTimeout(r._suspendTimer), r._suspendTimer = null) : r.state === "suspended" || r.state === "running" && r.ctx.state === "interrupted" ? (r.ctx.resume().then(function() {
3722
+ r.state = "running";
3723
+ for (var s = 0; s < r._howls.length; s++) r._howls[s]._emit("resume");
3724
+ }), r._suspendTimer && (clearTimeout(r._suspendTimer), r._suspendTimer = null)) : r.state === "suspending" && (r._resumeAfterSuspend = !0), r;
3408
3725
  } };
3409
- var o = new n(), r = function(i) {
3726
+ var o = new n(), i = function(r) {
3410
3727
  var s = this;
3411
- if (!i.src || i.src.length === 0) return void console.error("An array of source files must be passed with any new Howl.");
3412
- s.init(i);
3728
+ if (!r.src || r.src.length === 0) return void console.error("An array of source files must be passed with any new Howl.");
3729
+ s.init(r);
3413
3730
  };
3414
- r.prototype = { init: function(i) {
3731
+ i.prototype = { init: function(r) {
3415
3732
  var s = this;
3416
- return o.ctx || g(), s._autoplay = i.autoplay || !1, s._format = typeof i.format != "string" ? i.format : [i.format], s._html5 = i.html5 || !1, s._muted = i.mute || !1, s._loop = i.loop || !1, s._pool = i.pool || 5, s._preload = typeof i.preload != "boolean" && i.preload !== "metadata" || i.preload, s._rate = i.rate || 1, s._sprite = i.sprite || {}, s._src = typeof i.src != "string" ? i.src : [i.src], s._volume = i.volume !== void 0 ? i.volume : 1, s._xhr = { method: i.xhr && i.xhr.method ? i.xhr.method : "GET", headers: i.xhr && i.xhr.headers ? i.xhr.headers : null, withCredentials: !(!i.xhr || !i.xhr.withCredentials) && i.xhr.withCredentials }, s._duration = 0, s._state = "unloaded", s._sounds = [], s._endTimers = {}, s._queue = [], s._playLock = !1, s._onend = i.onend ? [{ fn: i.onend }] : [], s._onfade = i.onfade ? [{ fn: i.onfade }] : [], s._onload = i.onload ? [{ fn: i.onload }] : [], s._onloaderror = i.onloaderror ? [{ fn: i.onloaderror }] : [], s._onplayerror = i.onplayerror ? [{ fn: i.onplayerror }] : [], s._onpause = i.onpause ? [{ fn: i.onpause }] : [], s._onplay = i.onplay ? [{ fn: i.onplay }] : [], s._onstop = i.onstop ? [{ fn: i.onstop }] : [], s._onmute = i.onmute ? [{ fn: i.onmute }] : [], s._onvolume = i.onvolume ? [{ fn: i.onvolume }] : [], s._onrate = i.onrate ? [{ fn: i.onrate }] : [], s._onseek = i.onseek ? [{ fn: i.onseek }] : [], s._onunlock = i.onunlock ? [{ fn: i.onunlock }] : [], s._onresume = [], s._webAudio = o.usingWebAudio && !s._html5, o.ctx !== void 0 && o.ctx && o.autoUnlock && o._unlockAudio(), o._howls.push(s), s._autoplay && s._queue.push({ event: "play", action: function() {
3733
+ return o.ctx || g(), s._autoplay = r.autoplay || !1, s._format = typeof r.format != "string" ? r.format : [r.format], s._html5 = r.html5 || !1, s._muted = r.mute || !1, s._loop = r.loop || !1, s._pool = r.pool || 5, s._preload = typeof r.preload != "boolean" && r.preload !== "metadata" || r.preload, s._rate = r.rate || 1, s._sprite = r.sprite || {}, s._src = typeof r.src != "string" ? r.src : [r.src], s._volume = r.volume !== void 0 ? r.volume : 1, s._xhr = { method: r.xhr && r.xhr.method ? r.xhr.method : "GET", headers: r.xhr && r.xhr.headers ? r.xhr.headers : null, withCredentials: !(!r.xhr || !r.xhr.withCredentials) && r.xhr.withCredentials }, s._duration = 0, s._state = "unloaded", s._sounds = [], s._endTimers = {}, s._queue = [], s._playLock = !1, s._onend = r.onend ? [{ fn: r.onend }] : [], s._onfade = r.onfade ? [{ fn: r.onfade }] : [], s._onload = r.onload ? [{ fn: r.onload }] : [], s._onloaderror = r.onloaderror ? [{ fn: r.onloaderror }] : [], s._onplayerror = r.onplayerror ? [{ fn: r.onplayerror }] : [], s._onpause = r.onpause ? [{ fn: r.onpause }] : [], s._onplay = r.onplay ? [{ fn: r.onplay }] : [], s._onstop = r.onstop ? [{ fn: r.onstop }] : [], s._onmute = r.onmute ? [{ fn: r.onmute }] : [], s._onvolume = r.onvolume ? [{ fn: r.onvolume }] : [], s._onrate = r.onrate ? [{ fn: r.onrate }] : [], s._onseek = r.onseek ? [{ fn: r.onseek }] : [], s._onunlock = r.onunlock ? [{ fn: r.onunlock }] : [], s._onresume = [], s._webAudio = o.usingWebAudio && !s._html5, o.ctx !== void 0 && o.ctx && o.autoUnlock && o._unlockAudio(), o._howls.push(s), s._autoplay && s._queue.push({ event: "play", action: function() {
3417
3734
  s.play();
3418
3735
  } }), s._preload && s._preload !== "none" && s.load(), s;
3419
3736
  }, load: function() {
3420
- var i = this, s = null;
3421
- if (o.noAudio) return void i._emit("loaderror", null, "No audio support.");
3422
- typeof i._src == "string" && (i._src = [i._src]);
3423
- for (var u = 0; u < i._src.length; u++) {
3424
- var d, f;
3425
- if (i._format && i._format[u]) d = i._format[u];
3737
+ var r = this, s = null;
3738
+ if (o.noAudio) return void r._emit("loaderror", null, "No audio support.");
3739
+ typeof r._src == "string" && (r._src = [r._src]);
3740
+ for (var u = 0; u < r._src.length; u++) {
3741
+ var p, h;
3742
+ if (r._format && r._format[u]) p = r._format[u];
3426
3743
  else {
3427
- if (typeof (f = i._src[u]) != "string") {
3428
- i._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
3744
+ if (typeof (h = r._src[u]) != "string") {
3745
+ r._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
3429
3746
  continue;
3430
3747
  }
3431
- d = /^data:audio\/([^;,]+);/i.exec(f), d || (d = /\.([^.]+)$/.exec(f.split("?", 1)[0])), d && (d = d[1].toLowerCase());
3748
+ p = /^data:audio\/([^;,]+);/i.exec(h), p || (p = /\.([^.]+)$/.exec(h.split("?", 1)[0])), p && (p = p[1].toLowerCase());
3432
3749
  }
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 = i._src[u];
3750
+ if (p || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), p && o.codecs(p)) {
3751
+ s = r._src[u];
3435
3752
  break;
3436
3753
  }
3437
3754
  }
3438
- return s ? (i._src = s, i._state = "loading", window.location.protocol === "https:" && s.slice(0, 5) === "http:" && (i._html5 = !0, i._webAudio = !1), new a(i), i._webAudio && l(i), i) : void i._emit("loaderror", null, "No codec support for selected audio sources.");
3439
- }, play: function(i, s) {
3440
- var u = this, d = null;
3441
- if (typeof i == "number") d = i, i = null;
3755
+ 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.");
3756
+ }, play: function(r, s) {
3757
+ var u = this, p = null;
3758
+ if (typeof r == "number") p = r, r = null;
3442
3759
  else {
3443
- if (typeof i == "string" && u._state === "loaded" && !u._sprite[i]) return null;
3444
- if (i === void 0 && (i = "__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);
3446
- f === 1 ? i = null : d = null;
3760
+ if (typeof r == "string" && u._state === "loaded" && !u._sprite[r]) return null;
3761
+ if (r === void 0 && (r = "__default", !u._playLock)) {
3762
+ for (var h = 0, v = 0; v < u._sounds.length; v++) u._sounds[v]._paused && !u._sounds[v]._ended && (h++, p = u._sounds[v]._id);
3763
+ h === 1 ? r = null : p = null;
3447
3764
  }
3448
3765
  }
3449
- var _ = d ? u._soundById(d) : u._inactiveSound();
3766
+ var _ = p ? u._soundById(p) : u._inactiveSound();
3450
3767
  if (!_) return null;
3451
- if (d && !i && (i = _._sprite || "__default"), u._state !== "loaded") {
3452
- _._sprite = i, _._ended = !1;
3768
+ if (p && !r && (r = _._sprite || "__default"), u._state !== "loaded") {
3769
+ _._sprite = r, _._ended = !1;
3453
3770
  var w = _._id;
3454
3771
  return u._queue.push({ event: "play", action: function() {
3455
3772
  u.play(w);
3456
3773
  } }), w;
3457
3774
  }
3458
- if (d && !_._paused) return s || u._loadQueue("play"), _._id;
3775
+ if (p && !_._paused) return s || u._loadQueue("play"), _._id;
3459
3776
  u._webAudio && o._autoResume();
3460
- var E = Math.max(0, _._seek > 0 ? _._seek : u._sprite[i][0] / 1e3), k = Math.max(0, (u._sprite[i][0] + u._sprite[i][1]) / 1e3 - E), x = 1e3 * k / Math.abs(_._rate), F = u._sprite[i][0] / 1e3, se = (u._sprite[i][0] + u._sprite[i][1]) / 1e3;
3461
- _._sprite = i, _._ended = !1;
3777
+ var E = Math.max(0, _._seek > 0 ? _._seek : u._sprite[r][0] / 1e3), k = Math.max(0, (u._sprite[r][0] + u._sprite[r][1]) / 1e3 - E), x = 1e3 * k / Math.abs(_._rate), U = u._sprite[r][0] / 1e3, se = (u._sprite[r][0] + u._sprite[r][1]) / 1e3;
3778
+ _._sprite = r, _._ended = !1;
3462
3779
  var ke = function() {
3463
- _._paused = !1, _._seek = E, _._start = F, _._stop = se, _._loop = !(!_._loop && !u._sprite[i][2]);
3780
+ _._paused = !1, _._seek = E, _._start = U, _._stop = se, _._loop = !(!_._loop && !u._sprite[r][2]);
3464
3781
  };
3465
3782
  if (E >= se) return void u._ended(_);
3466
3783
  var T = _._node;
@@ -3483,7 +3800,7 @@ function aa() {
3483
3800
  }).catch(function() {
3484
3801
  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
3802
  })) : s || (u._playLock = !1, ke(), u._emit("play", _._id), u._loadQueue()), T.playbackRate = _._rate, T.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
- i !== "__default" || _._loop ? u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x) : (u._endTimers[_._id] = function() {
3803
+ r !== "__default" || _._loop ? u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x) : (u._endTimers[_._id] = function() {
3487
3804
  u._ended(_), T.removeEventListener("ended", u._endTimers[_._id], !1);
3488
3805
  }, T.addEventListener("ended", u._endTimers[_._id], !1));
3489
3806
  } catch (tn) {
@@ -3502,126 +3819,126 @@ function aa() {
3502
3819
  }
3503
3820
  }
3504
3821
  return _._id;
3505
- }, pause: function(i) {
3822
+ }, pause: function(r) {
3506
3823
  var s = this;
3507
3824
  if (s._state !== "loaded" || s._playLock) return s._queue.push({ event: "pause", action: function() {
3508
- s.pause(i);
3825
+ s.pause(r);
3509
3826
  } }), s;
3510
- for (var u = s._getSoundIds(i), 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) {
3514
- if (!f._node.bufferSource) continue;
3515
- f._node.bufferSource.stop === void 0 ? f._node.bufferSource.noteOff(0) : f._node.bufferSource.stop(0), s._cleanBuffer(f._node);
3516
- } else isNaN(f._node.duration) && f._node.duration !== 1 / 0 || f._node.pause();
3517
- arguments[1] || s._emit("pause", f ? f._id : null);
3827
+ for (var u = s._getSoundIds(r), p = 0; p < u.length; p++) {
3828
+ s._clearTimer(u[p]);
3829
+ var h = s._soundById(u[p]);
3830
+ if (h && !h._paused && (h._seek = s.seek(u[p]), h._rateSeek = 0, h._paused = !0, s._stopFade(u[p]), h._node)) if (s._webAudio) {
3831
+ if (!h._node.bufferSource) continue;
3832
+ h._node.bufferSource.stop === void 0 ? h._node.bufferSource.noteOff(0) : h._node.bufferSource.stop(0), s._cleanBuffer(h._node);
3833
+ } else isNaN(h._node.duration) && h._node.duration !== 1 / 0 || h._node.pause();
3834
+ arguments[1] || s._emit("pause", h ? h._id : null);
3518
3835
  }
3519
3836
  return s;
3520
- }, stop: function(i, s) {
3837
+ }, stop: function(r, s) {
3521
3838
  var u = this;
3522
3839
  if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "stop", action: function() {
3523
- u.stop(i, s);
3840
+ u.stop(r, s);
3524
3841
  } }), u;
3525
- for (var d = u._getSoundIds(i), 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));
3842
+ for (var p = u._getSoundIds(r), h = 0; h < p.length; h++) {
3843
+ u._clearTimer(p[h]);
3844
+ var v = u._soundById(p[h]);
3845
+ v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, u._stopFade(p[h]), 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));
3529
3846
  }
3530
3847
  return u;
3531
- }, mute: function(i, s) {
3848
+ }, mute: function(r, s) {
3532
3849
  var u = this;
3533
3850
  if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "mute", action: function() {
3534
- u.mute(i, s);
3851
+ u.mute(r, s);
3535
3852
  } }), u;
3536
3853
  if (s === void 0) {
3537
- if (typeof i != "boolean") return u._muted;
3538
- u._muted = i;
3854
+ if (typeof r != "boolean") return u._muted;
3855
+ u._muted = r;
3539
3856
  }
3540
- for (var d = u._getSoundIds(s), f = 0; f < d.length; f++) {
3541
- var v = u._soundById(d[f]);
3542
- v && (v._muted = i, v._interval && u._stopFade(v._id), u._webAudio && v._node ? v._node.gain.setValueAtTime(i ? 0 : v._volume, o.ctx.currentTime) : v._node && (v._node.muted = !!o._muted || i), u._emit("mute", v._id));
3857
+ for (var p = u._getSoundIds(s), h = 0; h < p.length; h++) {
3858
+ var v = u._soundById(p[h]);
3859
+ 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));
3543
3860
  }
3544
3861
  return u;
3545
3862
  }, volume: function() {
3546
- var i, 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) : i = parseFloat(d[0]) : d.length >= 2 && (i = parseFloat(d[0]), s = parseInt(d[1], 10));
3549
- var f;
3550
- if (!(i !== void 0 && i >= 0 && i <= 1)) return f = s ? u._soundById(s) : u._sounds[0], f ? f._volume : 0;
3863
+ var r, s, u = this, p = arguments;
3864
+ if (p.length === 0) return u._volume;
3865
+ p.length === 1 || p.length === 2 && p[1] === void 0 ? u._getSoundIds().indexOf(p[0]) >= 0 ? s = parseInt(p[0], 10) : r = parseFloat(p[0]) : p.length >= 2 && (r = parseFloat(p[0]), s = parseInt(p[1], 10));
3866
+ var h;
3867
+ if (!(r !== void 0 && r >= 0 && r <= 1)) return h = s ? u._soundById(s) : u._sounds[0], h ? h._volume : 0;
3551
3868
  if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "volume", action: function() {
3552
- u.volume.apply(u, d);
3869
+ u.volume.apply(u, p);
3553
3870
  } }), u;
3554
- s === void 0 && (u._volume = i), s = u._getSoundIds(s);
3555
- for (var v = 0; v < s.length; v++) (f = u._soundById(s[v])) && (f._volume = i, d[2] || u._stopFade(s[v]), u._webAudio && f._node && !f._muted ? f._node.gain.setValueAtTime(i, o.ctx.currentTime) : f._node && !f._muted && (f._node.volume = i * o.volume()), u._emit("volume", f._id));
3871
+ s === void 0 && (u._volume = r), s = u._getSoundIds(s);
3872
+ for (var v = 0; v < s.length; v++) (h = u._soundById(s[v])) && (h._volume = r, p[2] || u._stopFade(s[v]), u._webAudio && h._node && !h._muted ? h._node.gain.setValueAtTime(r, o.ctx.currentTime) : h._node && !h._muted && (h._node.volume = r * o.volume()), u._emit("volume", h._id));
3556
3873
  return u;
3557
- }, fade: function(i, s, u, d) {
3558
- var f = this;
3559
- if (f._state !== "loaded" || f._playLock) return f._queue.push({ event: "fade", action: function() {
3560
- f.fade(i, s, u, d);
3561
- } }), f;
3562
- i = Math.min(Math.max(0, parseFloat(i)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), u = parseFloat(u), f.volume(i, d);
3563
- for (var v = f._getSoundIds(d), _ = 0; _ < v.length; _++) {
3564
- var w = f._soundById(v[_]);
3874
+ }, fade: function(r, s, u, p) {
3875
+ var h = this;
3876
+ if (h._state !== "loaded" || h._playLock) return h._queue.push({ event: "fade", action: function() {
3877
+ h.fade(r, s, u, p);
3878
+ } }), h;
3879
+ r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), u = parseFloat(u), h.volume(r, p);
3880
+ for (var v = h._getSoundIds(p), _ = 0; _ < v.length; _++) {
3881
+ var w = h._soundById(v[_]);
3565
3882
  if (w) {
3566
- if (d || f._stopFade(v[_]), f._webAudio && !w._muted) {
3883
+ if (p || h._stopFade(v[_]), h._webAudio && !w._muted) {
3567
3884
  var E = o.ctx.currentTime, k = E + u / 1e3;
3568
- w._volume = i, w._node.gain.setValueAtTime(i, E), w._node.gain.linearRampToValueAtTime(s, k);
3885
+ w._volume = r, w._node.gain.setValueAtTime(r, E), w._node.gain.linearRampToValueAtTime(s, k);
3569
3886
  }
3570
- f._startFadeInterval(w, i, s, u, v[_], d === void 0);
3887
+ h._startFadeInterval(w, r, s, u, v[_], p === void 0);
3571
3888
  }
3572
3889
  }
3573
- return f;
3574
- }, _startFadeInterval: function(i, s, u, d, f, v) {
3575
- var _ = this, w = s, E = u - s, k = Math.abs(E / 0.01), x = Math.max(4, k > 0 ? d / k : d), F = Date.now();
3576
- i._fadeTo = u, i._interval = setInterval(function() {
3577
- var se = (Date.now() - F) / d;
3578
- F = Date.now(), w += E * se, w = Math.round(100 * w) / 100, w = E < 0 ? Math.max(u, w) : Math.min(u, w), _._webAudio ? i._volume = w : _.volume(w, i._id, !0), v && (_._volume = w), (u < s && w <= u || u > s && w >= u) && (clearInterval(i._interval), i._interval = null, i._fadeTo = null, _.volume(u, i._id), _._emit("fade", i._id));
3890
+ return h;
3891
+ }, _startFadeInterval: function(r, s, u, p, h, v) {
3892
+ var _ = this, w = s, E = u - s, k = Math.abs(E / 0.01), x = Math.max(4, k > 0 ? p / k : p), U = Date.now();
3893
+ r._fadeTo = u, r._interval = setInterval(function() {
3894
+ var se = (Date.now() - U) / p;
3895
+ U = Date.now(), w += E * se, w = Math.round(100 * w) / 100, w = E < 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));
3579
3896
  }, x);
3580
- }, _stopFade: function(i) {
3581
- var s = this, u = s._soundById(i);
3582
- return u && u._interval && (s._webAudio && u._node.gain.cancelScheduledValues(o.ctx.currentTime), clearInterval(u._interval), u._interval = null, s.volume(u._fadeTo, i), u._fadeTo = null, s._emit("fade", i)), s;
3897
+ }, _stopFade: function(r) {
3898
+ var s = this, u = s._soundById(r);
3899
+ 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;
3583
3900
  }, loop: function() {
3584
- var i, s, u, d = this, f = arguments;
3585
- if (f.length === 0) return d._loop;
3586
- if (f.length === 1) {
3587
- if (typeof f[0] != "boolean") return !!(u = d._soundById(parseInt(f[0], 10))) && u._loop;
3588
- i = f[0], d._loop = i;
3589
- } else f.length === 2 && (i = f[0], s = parseInt(f[1], 10));
3590
- for (var v = d._getSoundIds(s), _ = 0; _ < v.length; _++) (u = d._soundById(v[_])) && (u._loop = i, d._webAudio && u._node && u._node.bufferSource && (u._node.bufferSource.loop = i, i && (u._node.bufferSource.loopStart = u._start || 0, u._node.bufferSource.loopEnd = u._stop)));
3591
- return d;
3901
+ var r, s, u, p = this, h = arguments;
3902
+ if (h.length === 0) return p._loop;
3903
+ if (h.length === 1) {
3904
+ if (typeof h[0] != "boolean") return !!(u = p._soundById(parseInt(h[0], 10))) && u._loop;
3905
+ r = h[0], p._loop = r;
3906
+ } else h.length === 2 && (r = h[0], s = parseInt(h[1], 10));
3907
+ for (var v = p._getSoundIds(s), _ = 0; _ < v.length; _++) (u = p._soundById(v[_])) && (u._loop = r, p._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)));
3908
+ return p;
3592
3909
  }, rate: function() {
3593
- var i, s, u = this, d = arguments;
3594
- if (d.length === 0) s = u._sounds[0]._id;
3595
- else if (d.length === 1) {
3596
- var f = u._getSoundIds(), v = f.indexOf(d[0]);
3597
- v >= 0 ? s = parseInt(d[0], 10) : i = parseFloat(d[0]);
3598
- } else d.length === 2 && (i = parseFloat(d[0]), s = parseInt(d[1], 10));
3910
+ var r, s, u = this, p = arguments;
3911
+ if (p.length === 0) s = u._sounds[0]._id;
3912
+ else if (p.length === 1) {
3913
+ var h = u._getSoundIds(), v = h.indexOf(p[0]);
3914
+ v >= 0 ? s = parseInt(p[0], 10) : r = parseFloat(p[0]);
3915
+ } else p.length === 2 && (r = parseFloat(p[0]), s = parseInt(p[1], 10));
3599
3916
  var _;
3600
- if (typeof i != "number") return _ = u._soundById(s), _ ? _._rate : u._rate;
3917
+ if (typeof r != "number") return _ = u._soundById(s), _ ? _._rate : u._rate;
3601
3918
  if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "rate", action: function() {
3602
- u.rate.apply(u, d);
3919
+ u.rate.apply(u, p);
3603
3920
  } }), u;
3604
- s === void 0 && (u._rate = i), s = u._getSoundIds(s);
3921
+ s === void 0 && (u._rate = r), s = u._getSoundIds(s);
3605
3922
  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 = i, u._webAudio && _._node && _._node.bufferSource ? _._node.bufferSource.playbackRate.setValueAtTime(i, o.ctx.currentTime) : _._node && (_._node.playbackRate = i);
3923
+ 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
3924
  var E = u.seek(s[w]), k = (u._sprite[_._sprite][0] + u._sprite[_._sprite][1]) / 1e3 - E, x = 1e3 * k / Math.abs(_._rate);
3608
3925
  !u._endTimers[s[w]] && _._paused || (u._clearTimer(s[w]), u._endTimers[s[w]] = setTimeout(u._ended.bind(u, _), x)), u._emit("rate", _._id);
3609
3926
  }
3610
3927
  return u;
3611
3928
  }, seek: function() {
3612
- var i, s, u = this, d = arguments;
3613
- if (d.length === 0) s = u._sounds[0]._id;
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, i = parseFloat(d[0]));
3617
- } else d.length === 2 && (i = parseFloat(d[0]), s = parseInt(d[1], 10));
3929
+ var r, s, u = this, p = arguments;
3930
+ if (p.length === 0) s = u._sounds[0]._id;
3931
+ else if (p.length === 1) {
3932
+ var h = u._getSoundIds(), v = h.indexOf(p[0]);
3933
+ v >= 0 ? s = parseInt(p[0], 10) : u._sounds.length && (s = u._sounds[0]._id, r = parseFloat(p[0]));
3934
+ } else p.length === 2 && (r = parseFloat(p[0]), s = parseInt(p[1], 10));
3618
3935
  if (s === void 0) return u;
3619
- if (typeof i == "number" && (u._state !== "loaded" || u._playLock)) return u._queue.push({ event: "seek", action: function() {
3620
- u.seek.apply(u, d);
3936
+ if (typeof r == "number" && (u._state !== "loaded" || u._playLock)) return u._queue.push({ event: "seek", action: function() {
3937
+ u.seek.apply(u, p);
3621
3938
  } }), u;
3622
3939
  var _ = u._soundById(s);
3623
3940
  if (_) {
3624
- if (!(typeof i == "number" && i >= 0)) {
3941
+ if (!(typeof r == "number" && r >= 0)) {
3625
3942
  if (u._webAudio) {
3626
3943
  var w = u.playing(s) ? o.ctx.currentTime - _._playStart : 0, E = _._rateSeek ? _._rateSeek - _._seek : 0;
3627
3944
  return _._seek + (E + w * Math.abs(_._rate));
@@ -3629,187 +3946,187 @@ function aa() {
3629
3946
  return _._node.currentTime;
3630
3947
  }
3631
3948
  var k = u.playing(s);
3632
- k && u.pause(s, !0), _._seek = i, _._ended = !1, u._clearTimer(s), u._webAudio || !_._node || isNaN(_._node.duration) || (_._node.currentTime = i);
3949
+ k && u.pause(s, !0), _._seek = r, _._ended = !1, u._clearTimer(s), u._webAudio || !_._node || isNaN(_._node.duration) || (_._node.currentTime = r);
3633
3950
  var x = function() {
3634
3951
  u._emit("seek", s), k && u.play(s, !0);
3635
3952
  };
3636
3953
  if (k && !u._webAudio) {
3637
- var F = function() {
3638
- u._playLock ? setTimeout(F, 0) : x();
3954
+ var U = function() {
3955
+ u._playLock ? setTimeout(U, 0) : x();
3639
3956
  };
3640
- setTimeout(F, 0);
3957
+ setTimeout(U, 0);
3641
3958
  } else x();
3642
3959
  }
3643
3960
  return u;
3644
- }, playing: function(i) {
3961
+ }, playing: function(r) {
3645
3962
  var s = this;
3646
- if (typeof i == "number") {
3647
- var u = s._soundById(i);
3963
+ if (typeof r == "number") {
3964
+ var u = s._soundById(r);
3648
3965
  return !!u && !u._paused;
3649
3966
  }
3650
- for (var d = 0; d < s._sounds.length; d++) if (!s._sounds[d]._paused) return !0;
3967
+ for (var p = 0; p < s._sounds.length; p++) if (!s._sounds[p]._paused) return !0;
3651
3968
  return !1;
3652
- }, duration: function(i) {
3653
- var s = this, u = s._duration, d = s._soundById(i);
3654
- return d && (u = s._sprite[d._sprite][1] / 1e3), u;
3969
+ }, duration: function(r) {
3970
+ var s = this, u = s._duration, p = s._soundById(r);
3971
+ return p && (u = s._sprite[p._sprite][1] / 1e3), u;
3655
3972
  }, state: function() {
3656
3973
  return this._state;
3657
3974
  }, unload: function() {
3658
- for (var i = this, s = i._sounds, u = 0; u < s.length; u++) s[u]._paused || i.stop(s[u]._id), i._webAudio || (i._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, i._clearTimer(s[u]._id);
3659
- var d = o._howls.indexOf(i);
3660
- d >= 0 && o._howls.splice(d, 1);
3661
- var f = !0;
3662
- for (u = 0; u < o._howls.length; u++) if (o._howls[u]._src === i._src || i._src.indexOf(o._howls[u]._src) >= 0) {
3663
- f = !1;
3975
+ 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);
3976
+ var p = o._howls.indexOf(r);
3977
+ p >= 0 && o._howls.splice(p, 1);
3978
+ var h = !0;
3979
+ for (u = 0; u < o._howls.length; u++) if (o._howls[u]._src === r._src || r._src.indexOf(o._howls[u]._src) >= 0) {
3980
+ h = !1;
3664
3981
  break;
3665
3982
  }
3666
- return c && f && delete c[i._src], o.noAudio = !1, i._state = "unloaded", i._sounds = [], i = null, null;
3667
- }, on: function(i, s, u, d) {
3668
- var f = this, v = f["_on" + i];
3669
- return typeof s == "function" && v.push(d ? { id: u, fn: s, once: d } : { id: u, fn: s }), f;
3670
- }, off: function(i, s, u) {
3671
- var d = this, f = d["_on" + i], 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;
3674
- if (s === f[v].fn && _ || !s && _) {
3675
- f.splice(v, 1);
3983
+ return c && h && delete c[r._src], o.noAudio = !1, r._state = "unloaded", r._sounds = [], r = null, null;
3984
+ }, on: function(r, s, u, p) {
3985
+ var h = this, v = h["_on" + r];
3986
+ return typeof s == "function" && v.push(p ? { id: u, fn: s, once: p } : { id: u, fn: s }), h;
3987
+ }, off: function(r, s, u) {
3988
+ var p = this, h = p["_on" + r], v = 0;
3989
+ if (typeof s == "number" && (u = s, s = null), s || u) for (v = 0; v < h.length; v++) {
3990
+ var _ = u === h[v].id;
3991
+ if (s === h[v].fn && _ || !s && _) {
3992
+ h.splice(v, 1);
3676
3993
  break;
3677
3994
  }
3678
3995
  }
3679
- else if (i) d["_on" + i] = [];
3996
+ else if (r) p["_on" + r] = [];
3680
3997
  else {
3681
- var w = Object.keys(d);
3682
- for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(d[w[v]]) && (d[w[v]] = []);
3998
+ var w = Object.keys(p);
3999
+ for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(p[w[v]]) && (p[w[v]] = []);
3683
4000
  }
3684
- return d;
3685
- }, once: function(i, s, u) {
3686
- var d = this;
3687
- return d.on(i, s, u, 1), d;
3688
- }, _emit: function(i, s, u) {
3689
- for (var d = this, f = d["_on" + i], v = f.length - 1; v >= 0; v--) f[v].id && f[v].id !== s && i !== "load" || (setTimeout((function(_) {
4001
+ return p;
4002
+ }, once: function(r, s, u) {
4003
+ var p = this;
4004
+ return p.on(r, s, u, 1), p;
4005
+ }, _emit: function(r, s, u) {
4006
+ for (var p = this, h = p["_on" + r], v = h.length - 1; v >= 0; v--) h[v].id && h[v].id !== s && r !== "load" || (setTimeout((function(_) {
3690
4007
  _.call(this, s, u);
3691
- }).bind(d, f[v].fn), 0), f[v].once && d.off(i, f[v].fn, f[v].id));
3692
- return d._loadQueue(i), d;
3693
- }, _loadQueue: function(i) {
4008
+ }).bind(p, h[v].fn), 0), h[v].once && p.off(r, h[v].fn, h[v].id));
4009
+ return p._loadQueue(r), p;
4010
+ }, _loadQueue: function(r) {
3694
4011
  var s = this;
3695
4012
  if (s._queue.length > 0) {
3696
4013
  var u = s._queue[0];
3697
- u.event === i && (s._queue.shift(), s._loadQueue()), i || u.action();
4014
+ u.event === r && (s._queue.shift(), s._loadQueue()), r || u.action();
3698
4015
  }
3699
4016
  return s;
3700
- }, _ended: function(i) {
3701
- var s = this, u = i._sprite;
3702
- if (!s._webAudio && i._node && !i._node.paused && !i._node.ended && i._node.currentTime < i._stop) return setTimeout(s._ended.bind(s, i), 100), s;
3703
- var d = !(!i._loop && !s._sprite[u][2]);
3704
- if (s._emit("end", i._id), !s._webAudio && d && s.stop(i._id, !0).play(i._id), s._webAudio && d) {
3705
- s._emit("play", i._id), i._seek = i._start || 0, i._rateSeek = 0, i._playStart = o.ctx.currentTime;
3706
- var f = 1e3 * (i._stop - i._start) / Math.abs(i._rate);
3707
- s._endTimers[i._id] = setTimeout(s._ended.bind(s, i), f);
4017
+ }, _ended: function(r) {
4018
+ var s = this, u = r._sprite;
4019
+ 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;
4020
+ var p = !(!r._loop && !s._sprite[u][2]);
4021
+ if (s._emit("end", r._id), !s._webAudio && p && s.stop(r._id, !0).play(r._id), s._webAudio && p) {
4022
+ s._emit("play", r._id), r._seek = r._start || 0, r._rateSeek = 0, r._playStart = o.ctx.currentTime;
4023
+ var h = 1e3 * (r._stop - r._start) / Math.abs(r._rate);
4024
+ s._endTimers[r._id] = setTimeout(s._ended.bind(s, r), h);
3708
4025
  }
3709
- return s._webAudio && !d && (i._paused = !0, i._ended = !0, i._seek = i._start || 0, i._rateSeek = 0, s._clearTimer(i._id), s._cleanBuffer(i._node), o._autoSuspend()), s._webAudio || d || s.stop(i._id, !0), s;
3710
- }, _clearTimer: function(i) {
4026
+ return s._webAudio && !p && (r._paused = !0, r._ended = !0, r._seek = r._start || 0, r._rateSeek = 0, s._clearTimer(r._id), s._cleanBuffer(r._node), o._autoSuspend()), s._webAudio || p || s.stop(r._id, !0), s;
4027
+ }, _clearTimer: function(r) {
3711
4028
  var s = this;
3712
- if (s._endTimers[i]) {
3713
- if (typeof s._endTimers[i] != "function") clearTimeout(s._endTimers[i]);
4029
+ if (s._endTimers[r]) {
4030
+ if (typeof s._endTimers[r] != "function") clearTimeout(s._endTimers[r]);
3714
4031
  else {
3715
- var u = s._soundById(i);
3716
- u && u._node && u._node.removeEventListener("ended", s._endTimers[i], !1);
4032
+ var u = s._soundById(r);
4033
+ u && u._node && u._node.removeEventListener("ended", s._endTimers[r], !1);
3717
4034
  }
3718
- delete s._endTimers[i];
4035
+ delete s._endTimers[r];
3719
4036
  }
3720
4037
  return s;
3721
- }, _soundById: function(i) {
3722
- for (var s = this, u = 0; u < s._sounds.length; u++) if (i === s._sounds[u]._id) return s._sounds[u];
4038
+ }, _soundById: function(r) {
4039
+ for (var s = this, u = 0; u < s._sounds.length; u++) if (r === s._sounds[u]._id) return s._sounds[u];
3723
4040
  return null;
3724
4041
  }, _inactiveSound: function() {
3725
- var i = this;
3726
- i._drain();
3727
- for (var s = 0; s < i._sounds.length; s++) if (i._sounds[s]._ended) return i._sounds[s].reset();
3728
- return new a(i);
4042
+ var r = this;
4043
+ r._drain();
4044
+ for (var s = 0; s < r._sounds.length; s++) if (r._sounds[s]._ended) return r._sounds[s].reset();
4045
+ return new a(r);
3729
4046
  }, _drain: function() {
3730
- var i = this, s = i._pool, u = 0, d = 0;
3731
- if (!(i._sounds.length < s)) {
3732
- for (d = 0; d < i._sounds.length; d++) i._sounds[d]._ended && u++;
3733
- for (d = i._sounds.length - 1; d >= 0; d--) {
4047
+ var r = this, s = r._pool, u = 0, p = 0;
4048
+ if (!(r._sounds.length < s)) {
4049
+ for (p = 0; p < r._sounds.length; p++) r._sounds[p]._ended && u++;
4050
+ for (p = r._sounds.length - 1; p >= 0; p--) {
3734
4051
  if (u <= s) return;
3735
- i._sounds[d]._ended && (i._webAudio && i._sounds[d]._node && i._sounds[d]._node.disconnect(0), i._sounds.splice(d, 1), u--);
4052
+ r._sounds[p]._ended && (r._webAudio && r._sounds[p]._node && r._sounds[p]._node.disconnect(0), r._sounds.splice(p, 1), u--);
3736
4053
  }
3737
4054
  }
3738
- }, _getSoundIds: function(i) {
4055
+ }, _getSoundIds: function(r) {
3739
4056
  var s = this;
3740
- if (i === void 0) {
3741
- for (var u = [], d = 0; d < s._sounds.length; d++) u.push(s._sounds[d]._id);
4057
+ if (r === void 0) {
4058
+ for (var u = [], p = 0; p < s._sounds.length; p++) u.push(s._sounds[p]._id);
3742
4059
  return u;
3743
4060
  }
3744
- return [i];
3745
- }, _refreshBuffer: function(i) {
4061
+ return [r];
4062
+ }, _refreshBuffer: function(r) {
3746
4063
  var s = this;
3747
- return i._node.bufferSource = o.ctx.createBufferSource(), i._node.bufferSource.buffer = c[s._src], i._panner ? i._node.bufferSource.connect(i._panner) : i._node.bufferSource.connect(i._node), i._node.bufferSource.loop = i._loop, i._loop && (i._node.bufferSource.loopStart = i._start || 0, i._node.bufferSource.loopEnd = i._stop || 0), i._node.bufferSource.playbackRate.setValueAtTime(i._rate, o.ctx.currentTime), s;
3748
- }, _cleanBuffer: function(i) {
4064
+ 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;
4065
+ }, _cleanBuffer: function(r) {
3749
4066
  var s = this, u = o._navigator && o._navigator.vendor.indexOf("Apple") >= 0;
3750
- if (o._scratchBuffer && i.bufferSource && (i.bufferSource.onended = null, i.bufferSource.disconnect(0), u)) try {
3751
- i.bufferSource.buffer = o._scratchBuffer;
4067
+ if (o._scratchBuffer && r.bufferSource && (r.bufferSource.onended = null, r.bufferSource.disconnect(0), u)) try {
4068
+ r.bufferSource.buffer = o._scratchBuffer;
3752
4069
  } catch {
3753
4070
  }
3754
- return i.bufferSource = null, s;
3755
- }, _clearSound: function(i) {
3756
- /MSIE |Trident\//.test(o._navigator && o._navigator.userAgent) || (i.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");
4071
+ return r.bufferSource = null, s;
4072
+ }, _clearSound: function(r) {
4073
+ /MSIE |Trident\//.test(o._navigator && o._navigator.userAgent) || (r.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");
3757
4074
  } };
3758
- var a = function(i) {
3759
- this._parent = i, this.init();
4075
+ var a = function(r) {
4076
+ this._parent = r, this.init();
3760
4077
  };
3761
4078
  a.prototype = { init: function() {
3762
- var i = this, s = i._parent;
3763
- return i._muted = s._muted, i._loop = s._loop, i._volume = s._volume, i._rate = s._rate, i._seek = 0, i._paused = !0, i._ended = !0, i._sprite = "__default", i._id = ++o._counter, s._sounds.push(i), i.create(), i;
4079
+ var r = this, s = r._parent;
4080
+ 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
4081
  }, create: function() {
3765
- var i = this, s = i._parent, u = o._muted || i._muted || i._parent._muted ? 0 : i._volume;
3766
- return s._webAudio ? (i._node = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), i._node.gain.setValueAtTime(u, o.ctx.currentTime), i._node.paused = !0, i._node.connect(o.masterGain)) : o.noAudio || (i._node = o._obtainHtml5Audio(), i._errorFn = i._errorListener.bind(i), i._node.addEventListener("error", i._errorFn, !1), i._loadFn = i._loadListener.bind(i), i._node.addEventListener(o._canPlayEvent, i._loadFn, !1), i._endFn = i._endListener.bind(i), i._node.addEventListener("ended", i._endFn, !1), i._node.src = s._src, i._node.preload = s._preload === !0 ? "auto" : s._preload, i._node.volume = u * o.volume(), i._node.load()), i;
4082
+ var r = this, s = r._parent, u = o._muted || r._muted || r._parent._muted ? 0 : r._volume;
4083
+ 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;
3767
4084
  }, reset: function() {
3768
- var i = this, s = i._parent;
3769
- return i._muted = s._muted, i._loop = s._loop, i._volume = s._volume, i._rate = s._rate, i._seek = 0, i._rateSeek = 0, i._paused = !0, i._ended = !0, i._sprite = "__default", i._id = ++o._counter, i;
4085
+ var r = this, s = r._parent;
4086
+ 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;
3770
4087
  }, _errorListener: function() {
3771
- var i = this;
3772
- i._parent._emit("loaderror", i._id, i._node.error ? i._node.error.code : 0), i._node.removeEventListener("error", i._errorFn, !1);
4088
+ var r = this;
4089
+ r._parent._emit("loaderror", r._id, r._node.error ? r._node.error.code : 0), r._node.removeEventListener("error", r._errorFn, !1);
3773
4090
  }, _loadListener: function() {
3774
- var i = this, s = i._parent;
3775
- s._duration = Math.ceil(10 * i._node.duration) / 10, Object.keys(s._sprite).length === 0 && (s._sprite = { __default: [0, 1e3 * s._duration] }), s._state !== "loaded" && (s._state = "loaded", s._emit("load"), s._loadQueue()), i._node.removeEventListener(o._canPlayEvent, i._loadFn, !1);
4091
+ var r = this, s = r._parent;
4092
+ s._duration = Math.ceil(10 * r._node.duration) / 10, Object.keys(s._sprite).length === 0 && (s._sprite = { __default: [0, 1e3 * s._duration] }), s._state !== "loaded" && (s._state = "loaded", s._emit("load"), s._loadQueue()), r._node.removeEventListener(o._canPlayEvent, r._loadFn, !1);
3776
4093
  }, _endListener: function() {
3777
- var i = this, s = i._parent;
3778
- s._duration === 1 / 0 && (s._duration = Math.ceil(10 * i._node.duration) / 10, s._sprite.__default[1] === 1 / 0 && (s._sprite.__default[1] = 1e3 * s._duration), s._ended(i)), i._node.removeEventListener("ended", i._endFn, !1);
4094
+ var r = this, s = r._parent;
4095
+ 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
4096
  } };
3780
- var c = {}, l = function(i) {
3781
- var s = i._src;
3782
- if (c[s]) return i._duration = c[s].duration, void y(i);
4097
+ var c = {}, l = function(r) {
4098
+ var s = r._src;
4099
+ if (c[s]) return r._duration = c[s].duration, void y(r);
3783
4100
  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);
3785
- h(d.buffer, i);
4101
+ for (var u = atob(s.split(",")[1]), p = new Uint8Array(u.length), h = 0; h < u.length; ++h) p[h] = u.charCodeAt(h);
4102
+ f(p.buffer, r);
3786
4103
  } else {
3787
4104
  var v = new XMLHttpRequest();
3788
- v.open(i._xhr.method, s, !0), v.withCredentials = i._xhr.withCredentials, v.responseType = "arraybuffer", i._xhr.headers && Object.keys(i._xhr.headers).forEach(function(_) {
3789
- v.setRequestHeader(_, i._xhr.headers[_]);
4105
+ v.open(r._xhr.method, s, !0), v.withCredentials = r._xhr.withCredentials, v.responseType = "arraybuffer", r._xhr.headers && Object.keys(r._xhr.headers).forEach(function(_) {
4106
+ v.setRequestHeader(_, r._xhr.headers[_]);
3790
4107
  }), v.onload = function() {
3791
4108
  var _ = (v.status + "")[0];
3792
- if (_ !== "0" && _ !== "2" && _ !== "3") return void i._emit("loaderror", null, "Failed loading audio file with status: " + v.status + ".");
3793
- h(v.response, i);
4109
+ if (_ !== "0" && _ !== "2" && _ !== "3") return void r._emit("loaderror", null, "Failed loading audio file with status: " + v.status + ".");
4110
+ f(v.response, r);
3794
4111
  }, v.onerror = function() {
3795
- i._webAudio && (i._html5 = !0, i._webAudio = !1, i._sounds = [], delete c[s], i.load());
3796
- }, p(v);
4112
+ r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete c[s], r.load());
4113
+ }, d(v);
3797
4114
  }
3798
- }, p = function(i) {
4115
+ }, d = function(r) {
3799
4116
  try {
3800
- i.send();
4117
+ r.send();
3801
4118
  } catch {
3802
- i.onerror();
4119
+ r.onerror();
3803
4120
  }
3804
- }, h = function(i, s) {
4121
+ }, f = function(r, s) {
3805
4122
  var u = function() {
3806
4123
  s._emit("loaderror", null, "Decoding audio data failed.");
3807
- }, d = function(f) {
3808
- f && s._sounds.length > 0 ? (c[s._src] = f, y(s, f)) : u();
4124
+ }, p = function(h) {
4125
+ h && s._sounds.length > 0 ? (c[s._src] = h, y(s, h)) : u();
3809
4126
  };
3810
- typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(i).then(d).catch(u) : o.ctx.decodeAudioData(i, d, u);
3811
- }, y = function(i, s) {
3812
- s && !i._duration && (i._duration = s.duration), Object.keys(i._sprite).length === 0 && (i._sprite = { __default: [0, 1e3 * i._duration] }), i._state !== "loaded" && (i._state = "loaded", i._emit("load"), i._loadQueue());
4127
+ typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(p).catch(u) : o.ctx.decodeAudioData(r, p, u);
4128
+ }, y = function(r, s) {
4129
+ 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
4130
  }, g = function() {
3814
4131
  if (o.usingWebAudio) {
3815
4132
  try {
@@ -3818,21 +4135,21 @@ function aa() {
3818
4135
  o.usingWebAudio = !1;
3819
4136
  }
3820
4137
  o.ctx || (o.usingWebAudio = !1);
3821
- var i = /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 (i && u && u < 9) {
3823
- var d = /safari/.test(o._navigator && o._navigator.userAgent.toLowerCase());
3824
- o._navigator && !d && (o.usingWebAudio = !1);
4138
+ 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;
4139
+ if (r && u && u < 9) {
4140
+ var p = /safari/.test(o._navigator && o._navigator.userAgent.toLowerCase());
4141
+ o._navigator && !p && (o.usingWebAudio = !1);
3825
4142
  }
3826
4143
  o.usingWebAudio && (o.masterGain = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), o.masterGain.gain.setValueAtTime(o._muted ? 0 : o._volume, o.ctx.currentTime), o.masterGain.connect(o.ctx.destination)), o._setup();
3827
4144
  }
3828
4145
  };
3829
- e.Howler = o, e.Howl = r, typeof t < "u" ? (t.HowlerGlobal = n, t.Howler = o, t.Howl = r, t.Sound = a) : typeof window < "u" && (window.HowlerGlobal = n, window.Howler = o, window.Howl = r, window.Sound = a);
4146
+ e.Howler = o, e.Howl = i, typeof t < "u" ? (t.HowlerGlobal = n, t.Howler = o, t.Howl = i, t.Sound = a) : typeof window < "u" && (window.HowlerGlobal = n, window.Howler = o, window.Howl = i, window.Sound = a);
3830
4147
  })();
3831
- }(Te)), Te;
4148
+ }(ze)), ze;
3832
4149
  }
3833
- var yt = aa();
3834
- const ua = typeof navigator < "u" && typeof navigator.standalone < "u";
3835
- class $a {
4150
+ var Et = Ca();
4151
+ const Aa = typeof navigator < "u" && typeof navigator.standalone < "u";
4152
+ class Oa {
3836
4153
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3837
4154
  constructor(t) {
3838
4155
  this.cogsConnection = t, this.addEventListener("audioClipState", ({ detail: o }) => {
@@ -3841,8 +4158,8 @@ class $a {
3841
4158
  switch (o.type) {
3842
4159
  case "media_config_update":
3843
4160
  if (this.globalVolume !== o.globalVolume && this.setGlobalVolume(o.globalVolume), o.audioOutput !== void 0) {
3844
- const r = t.getAudioSinkId(o.audioOutput);
3845
- this.setAudioSink(r ?? "");
4161
+ const i = t.getAudioSinkId(o.audioOutput);
4162
+ this.setAudioSink(i ?? "");
3846
4163
  }
3847
4164
  this.updateConfig(o.files);
3848
4165
  break;
@@ -3866,11 +4183,11 @@ class $a {
3866
4183
  }
3867
4184
  });
3868
4185
  const n = () => {
3869
- const o = Object.entries(this.audioClipPlayers).map(([r, a]) => {
4186
+ const o = Object.entries(this.audioClipPlayers).map(([i, a]) => {
3870
4187
  const c = Object.values(a.activeClips), l = c.some(
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";
3873
- return [r, l];
4188
+ ({ state: d }) => d.type === "playing" || d.type === "pausing" || d.type === "stopping" || d.type === "play_requested" || d.type === "pause_requested" || d.type === "stop_requested"
4189
+ ) ? "playing" : c.some(({ state: d }) => d.type === "paused") ? "paused" : "stopped";
4190
+ return [i, l];
3874
4191
  });
3875
4192
  t.sendInitialMediaClipStates({ mediaType: "audio", files: o });
3876
4193
  };
@@ -3881,20 +4198,20 @@ class $a {
3881
4198
  audioClipPlayers = {};
3882
4199
  sinkId = "";
3883
4200
  setGlobalVolume(t) {
3884
- this.globalVolume = t, yt.Howler.volume(t), this.notifyStateListeners();
4201
+ this.globalVolume = t, Et.Howler.volume(t), this.notifyStateListeners();
3885
4202
  }
3886
- playAudioClip(t, { playId: n, volume: o, fade: r, loop: a }) {
4203
+ playAudioClip(t, { playId: n, volume: o, fade: i, loop: a }) {
3887
4204
  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));
4205
+ const l = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "paused").map(([g]) => parseInt(g)), d = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pausing").map(([g]) => parseInt(g));
3889
4206
  l.forEach((g) => {
3890
4207
  c.player.play(g);
3891
4208
  });
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()];
3893
- return p.forEach((g) => {
3894
- c.player.off("fade", void 0, g), c.player.loop(a, g), this.updateActiveAudioClip(t, g, (i) => ({ ...i, state: { type: "playing" } })), ne(r) ? oe(c.player, o, r * 1e3, g) : ze(c.player, o, g);
3895
- }), [...l, ...h, ...y].forEach((g) => {
4209
+ const f = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 || d.length > 0 || f.length > 0 ? [] : [c.player.play()];
4210
+ return d.forEach((g) => {
4211
+ 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) : $e(c.player, o, g);
4212
+ }), [...l, ...f, ...y].forEach((g) => {
3896
4213
  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
- Se(c.player, this.sinkId);
4214
+ Ie(c.player, this.sinkId);
3898
4215
  }), c.player.once("stop", () => this.handleStoppedClip(t, n, g), g), c.player.on(
3899
4216
  "end",
3900
4217
  () => {
@@ -3902,7 +4219,7 @@ class $a {
3902
4219
  },
3903
4220
  g
3904
4221
  );
3905
- const i = {
4222
+ const r = {
3906
4223
  playId: n,
3907
4224
  state: { type: "play_requested" },
3908
4225
  loop: a,
@@ -3915,41 +4232,41 @@ class $a {
3915
4232
  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" } }));
3916
4233
  },
3917
4234
  g
3918
- ), ne(r) ? (c.player.volume(0, g), c.player.mute(!1, g), c.player.once(
4235
+ ), ne(i) ? (c.player.volume(0, g), c.player.mute(!1, g), c.player.once(
3919
4236
  "play",
3920
4237
  () => {
3921
- oe(c.player, o, r * 1e3, g);
4238
+ oe(c.player, o, i * 1e3, g);
3922
4239
  },
3923
4240
  g
3924
- )) : ze(c.player, o, g), c.activeClips = { ...c.activeClips, [g]: i };
4241
+ )) : $e(c.player, o, g), c.activeClips = { ...c.activeClips, [g]: r };
3925
4242
  }), c;
3926
4243
  }), this.notifyClipStateListeners(n, t, "playing");
3927
4244
  }
3928
- pauseAudioClip(t, { fade: n }, o, r) {
4245
+ pauseAudioClip(t, { fade: n }, o, i) {
3929
4246
  Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
3930
4247
  Object.entries(a.activeClips).map(([c, l]) => {
3931
- const p = parseInt(c);
3932
- return (o === void 0 || o === p) && (r && l.state.type === "pause_requested" || l.state.type === "playing" || l.state.type === "pausing" ? ne(n) ? (a.player.once(
4248
+ const d = parseInt(c);
4249
+ return (o === void 0 || o === d) && (i && l.state.type === "pause_requested" || l.state.type === "playing" || l.state.type === "pausing" ? ne(n) ? (a.player.once(
3933
4250
  "fade",
3934
- (h) => {
3935
- a.player.pause(h), this.updateActiveAudioClip(t, h, (y) => ({ ...y, state: { type: "paused" } })), this.notifyClipStateListeners(l.playId, t, "paused");
4251
+ (f) => {
4252
+ a.player.pause(f), this.updateActiveAudioClip(t, f, (y) => ({ ...y, state: { type: "paused" } })), this.notifyClipStateListeners(l.playId, t, "paused");
3936
4253
  },
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];
4254
+ d
4255
+ ), oe(a.player, 0, n * 1e3, d), l.state = { type: "pausing" }) : (a.player.pause(d), 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];
3939
4256
  })
3940
4257
  ), a));
3941
4258
  }
3942
- stopAudioClip(t, { fade: n }, o, r) {
3943
- ca("Stop audio clip", { activeClips: this.audioClipPlayers[t]?.activeClips }), Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
4259
+ stopAudioClip(t, { fade: n }, o, i) {
4260
+ Ta("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
4261
  Object.entries(a.activeClips).map(([c, l]) => {
3945
- const p = parseInt(c);
3946
- return (o === void 0 || o === p) && (r && 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(
4262
+ const d = parseInt(c);
4263
+ return (o === void 0 || o === d) && (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", d), oe(a.player, 0, n * 1e3, d), a.player.once(
3947
4264
  "fade",
3948
- (h) => {
3949
- a.player.loop(!1, h), a.player.stop(h);
4265
+ (f) => {
4266
+ a.player.loop(!1, f), a.player.stop(f);
3950
4267
  },
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];
4268
+ d
4269
+ ), l.state = { type: "stopping" }) : (a.player.loop(!1, d), a.player.stop(d)) : (l.state.type === "play_requested" || l.state.type === "pause_requested" || l.state.type === "stop_requested") && (l.state = { type: "stop_requested", fade: n })), [c, l];
3953
4270
  })
3954
4271
  ), a));
3955
4272
  }
@@ -3963,23 +4280,23 @@ class $a {
3963
4280
  console.warn("Invalid volume", n);
3964
4281
  return;
3965
4282
  }
3966
- Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (r) => (r.activeClips = Object.fromEntries(
3967
- Object.entries(r.activeClips).map(([a, c]) => {
4283
+ Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (i) => (i.activeClips = Object.fromEntries(
4284
+ Object.entries(i.activeClips).map(([a, c]) => {
3968
4285
  if (c.state.type !== "pausing" && c.state.type !== "stopping") {
3969
4286
  const l = parseInt(a);
3970
- return ne(o) ? oe(r.player, n, o * 1e3, l) : ze(r.player, n, l), [a, { ...c, volume: n }];
4287
+ return ne(o) ? oe(i.player, n, o * 1e3, l) : $e(i.player, n, l), [a, { ...c, volume: n }];
3971
4288
  } else
3972
4289
  return [a, c];
3973
4290
  })
3974
- ), r));
4291
+ ), i));
3975
4292
  }
3976
4293
  handleStoppedClip(t, n, o) {
3977
- this.updateAudioClipPlayer(t, (r) => (delete r.activeClips[o], r)), this.notifyClipStateListeners(n, t, "stopped");
4294
+ this.updateAudioClipPlayer(t, (i) => (delete i.activeClips[o], i)), this.notifyClipStateListeners(n, t, "stopped");
3978
4295
  }
3979
4296
  updateActiveAudioClip(t, n, o) {
3980
4297
  this.updateAudioClipPlayer(
3981
4298
  t,
3982
- (r) => n in r.activeClips ? { ...r, activeClips: { ...r.activeClips, [n]: o(r.activeClips[n]) } } : r
4299
+ (i) => n in i.activeClips ? { ...i, activeClips: { ...i.activeClips, [n]: o(i.activeClips[n]) } } : i
3983
4300
  );
3984
4301
  }
3985
4302
  updateAudioClipPlayer(t, n) {
@@ -3989,38 +4306,38 @@ class $a {
3989
4306
  }
3990
4307
  setAudioSink(t) {
3991
4308
  for (const n of Object.values(this.audioClipPlayers))
3992
- Se(n.player, t);
4309
+ Ie(n.player, t);
3993
4310
  this.sinkId = t;
3994
4311
  }
3995
4312
  updateConfig(t) {
3996
4313
  const n = Object.fromEntries(
3997
- Object.entries(t).filter((r) => {
3998
- const a = r[1].type;
4314
+ Object.entries(t).filter((i) => {
4315
+ const a = i[1].type;
3999
4316
  return a === "audio" || !a;
4000
4317
  })
4001
4318
  ), o = this.audioClipPlayers;
4002
4319
  this.audioClipPlayers = (() => {
4003
- const r = { ...o };
4320
+ const i = { ...o };
4004
4321
  return Object.keys(o).filter(
4005
- (p) => !(p in n) && !o[p].config.ephemeral
4006
- ).forEach((p) => {
4007
- o[p].player.unload(), delete r[p];
4008
- }), Object.entries(n).filter(([p]) => !o[p]).forEach(([p, h]) => {
4009
- r[p] = this.createClip(p, { ...h, ephemeral: !1 });
4010
- }), Object.keys(o).filter((p) => p in n).forEach((p) => {
4011
- r[p] = this.updatedClip(p, r[p], { ...n[p], ephemeral: !1 });
4012
- }), r;
4322
+ (d) => !(d in n) && !o[d].config.ephemeral
4323
+ ).forEach((d) => {
4324
+ o[d].player.unload(), delete i[d];
4325
+ }), Object.entries(n).filter(([d]) => !o[d]).forEach(([d, f]) => {
4326
+ i[d] = this.createClip(d, { ...f, ephemeral: !1 });
4327
+ }), Object.keys(o).filter((d) => d in n).forEach((d) => {
4328
+ i[d] = this.updatedClip(d, i[d], { ...n[d], ephemeral: !1 });
4329
+ }), i;
4013
4330
  })(), this.notifyStateListeners();
4014
4331
  }
4015
4332
  notifyStateListeners() {
4016
4333
  const t = Object.entries(this.audioClipPlayers).reduce(
4017
- (r, [a, c]) => (r[a] = {
4334
+ (i, [a, c]) => (i[a] = {
4018
4335
  config: { preload: c.config.preload, ephemeral: c.config.ephemeral },
4019
4336
  activeClips: c.activeClips
4020
- }, r),
4337
+ }, i),
4021
4338
  {}
4022
4339
  ), n = Object.values(this.audioClipPlayers).some(
4023
- ({ activeClips: r }) => Object.values(r).some((a) => a.state.type === "playing" || a.state.type === "pausing" || a.state.type === "stopping")
4340
+ ({ activeClips: i }) => Object.values(i).some((a) => a.state.type === "playing" || a.state.type === "pausing" || a.state.type === "stopping")
4024
4341
  ), o = {
4025
4342
  globalVolume: this.globalVolume,
4026
4343
  isPlaying: n,
@@ -4042,7 +4359,7 @@ class $a {
4042
4359
  this.eventTarget.dispatchEvent(new CustomEvent(t, { detail: n }));
4043
4360
  }
4044
4361
  createPlayer(t, n) {
4045
- const o = new yt.Howl({
4362
+ const o = new Et.Howl({
4046
4363
  src: this.cogsConnection.getAssetUrl(t),
4047
4364
  autoplay: !1,
4048
4365
  loop: !1,
@@ -4050,7 +4367,7 @@ class $a {
4050
4367
  html5: !0,
4051
4368
  preload: n.preload
4052
4369
  });
4053
- return Se(o, this.sinkId), o;
4370
+ return Ie(o, this.sinkId), o;
4054
4371
  }
4055
4372
  createClip(t, n) {
4056
4373
  return {
@@ -4060,46 +4377,46 @@ class $a {
4060
4377
  };
4061
4378
  }
4062
4379
  updatedClip(t, n, o) {
4063
- const r = { ...n, config: o };
4064
- return n.config.preload !== o.preload && (r.player.unload(), r.player = this.createPlayer(t, o)), r;
4380
+ const i = { ...n, config: o };
4381
+ return n.config.preload !== o.preload && (i.player.unload(), i.player = this.createPlayer(t, o)), i;
4065
4382
  }
4066
4383
  }
4067
- function ca(...e) {
4384
+ function Ta(...e) {
4068
4385
  }
4069
4386
  function ne(e) {
4070
- return !ua && typeof e == "number" && !isNaN(e) && e > 0;
4387
+ return !Aa && typeof e == "number" && !isNaN(e) && e > 0;
4071
4388
  }
4072
- function Se(e, t) {
4389
+ function Ie(e, t) {
4073
4390
  t !== void 0 && (e._html5 ? e._sounds?.forEach((n) => {
4074
4391
  n._node?.setSinkId?.(t);
4075
4392
  }) : console.warn("Cannot set sink ID: web audio not supported", e));
4076
4393
  }
4077
- function ze(e, t, n) {
4394
+ function $e(e, t, n) {
4078
4395
  e.volume(t, n), e.mute(t === 0, n);
4079
4396
  }
4080
4397
  function oe(e, t, n, o) {
4081
4398
  e.fade(e.volume(o), t, n, o);
4082
4399
  }
4083
4400
  var Le = /* @__PURE__ */ ((e) => (e.Paused = "paused", e.Playing = "playing", e))(Le || {});
4084
- class Oa {
4401
+ class Za {
4085
4402
  constructor(t, n = document.body) {
4086
- this.cogsConnection = t, this.parentElement = n, this.addEventListener("videoClipState", ({ detail: r }) => {
4087
- t.sendMediaClipState(r);
4088
- }), t.addEventListener("message", ({ message: r }) => {
4089
- switch (r.type) {
4403
+ this.cogsConnection = t, this.parentElement = n, this.addEventListener("videoClipState", ({ detail: i }) => {
4404
+ t.sendMediaClipState(i);
4405
+ }), t.addEventListener("message", ({ message: i }) => {
4406
+ switch (i.type) {
4090
4407
  case "media_config_update":
4091
- if (this.setGlobalVolume(r.globalVolume), r.audioOutput !== void 0) {
4092
- const a = t.getAudioSinkId(r.audioOutput);
4408
+ if (this.setGlobalVolume(i.globalVolume), i.audioOutput !== void 0) {
4409
+ const a = t.getAudioSinkId(i.audioOutput);
4093
4410
  this.setAudioSink(a ?? "");
4094
4411
  }
4095
- this.updateConfig(r.files);
4412
+ this.updateConfig(i.files);
4096
4413
  break;
4097
4414
  case "video_play":
4098
- this.playVideoClip(r.file, {
4099
- playId: r.playId,
4100
- volume: r.volume,
4101
- loop: !!r.loop,
4102
- fit: r.fit
4415
+ this.playVideoClip(i.file, {
4416
+ playId: i.playId,
4417
+ volume: i.volume,
4418
+ loop: !!i.loop,
4419
+ fit: i.fit
4103
4420
  });
4104
4421
  break;
4105
4422
  case "video_pause":
@@ -4109,19 +4426,19 @@ class Oa {
4109
4426
  this.stopVideoClip();
4110
4427
  break;
4111
4428
  case "video_set_volume":
4112
- this.setVideoClipVolume({ volume: r.volume });
4429
+ this.setVideoClipVolume({ volume: i.volume });
4113
4430
  break;
4114
4431
  case "video_set_fit":
4115
- this.setVideoClipFit({ fit: r.fit });
4432
+ this.setVideoClipFit({ fit: i.fit });
4116
4433
  break;
4117
4434
  }
4118
4435
  });
4119
4436
  const o = () => {
4120
- const r = Object.entries(this.videoClipPlayers).map(([a, c]) => {
4437
+ const i = Object.entries(this.videoClipPlayers).map(([a, c]) => {
4121
4438
  const l = c.videoElement.paused ? c.videoElement.currentTime === 0 || c.videoElement.currentTime === c.videoElement.duration ? "paused" : "stopped" : "playing";
4122
4439
  return [a, l];
4123
4440
  });
4124
- t.sendInitialMediaClipStates({ mediaType: "video", files: r });
4441
+ t.sendInitialMediaClipStates({ mediaType: "video", files: i });
4125
4442
  };
4126
4443
  t.addEventListener("open", o), o();
4127
4444
  }
@@ -4145,8 +4462,8 @@ class Oa {
4145
4462
  pe(n.videoElement, n.volume * t);
4146
4463
  }), this.globalVolume = t, this.notifyStateListeners();
4147
4464
  }
4148
- playVideoClip(t, { playId: n, volume: o, loop: r, 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, pe(c.videoElement, o * this.globalVolume), c.videoElement.loop = r, 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));
4465
+ playVideoClip(t, { playId: n, volume: o, loop: i, fit: a }) {
4466
+ 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, pe(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));
4150
4467
  }
4151
4468
  pauseVideoClip() {
4152
4469
  if (this.pendingClip && (this.pendingClip.actionOncePlaying = "pause"), this.activeClip) {
@@ -4185,24 +4502,24 @@ class Oa {
4185
4502
  }
4186
4503
  setAudioSink(t) {
4187
4504
  for (const n of Object.values(this.videoClipPlayers))
4188
- wt(n, t);
4505
+ Ct(n, t);
4189
4506
  this.sinkId = t;
4190
4507
  }
4191
4508
  updateConfig(t) {
4192
- const n = Object.fromEntries(Object.entries(t).filter(([, { type: r }]) => r === "video" || !r)), o = this.videoClipPlayers;
4509
+ const n = Object.fromEntries(Object.entries(t).filter(([, { type: i }]) => i === "video" || !i)), o = this.videoClipPlayers;
4193
4510
  this.videoClipPlayers = (() => {
4194
- const r = { ...o };
4195
- return Object.keys(o).filter((p) => !(p in n)).forEach((p) => {
4196
- this.activeClip?.path === p && o[p]?.config.ephemeral === !1 ? this.updateVideoClipPlayer(p, (h) => (h.config = { ...h.config, ephemeral: !0 }, h)) : (this.unloadClip(p), delete r[p]);
4197
- }), Object.entries(n).filter(([p]) => !o[p]).forEach(([p, h]) => {
4198
- r[p] = this.createClipPlayer(p, { ...h, preload: bt(h.preload), ephemeral: !1, fit: "contain" });
4199
- }), Object.entries(o).filter(([p]) => p in n).forEach(([p, h]) => {
4200
- h.config.preload !== n[p].preload && this.updateVideoClipPlayer(p, (y) => (y.config = {
4511
+ const i = { ...o };
4512
+ return Object.keys(o).filter((d) => !(d in n)).forEach((d) => {
4513
+ this.activeClip?.path === d && o[d]?.config.ephemeral === !1 ? this.updateVideoClipPlayer(d, (f) => (f.config = { ...f.config, ephemeral: !0 }, f)) : (this.unloadClip(d), delete i[d]);
4514
+ }), Object.entries(n).filter(([d]) => !o[d]).forEach(([d, f]) => {
4515
+ i[d] = this.createClipPlayer(d, { ...f, preload: kt(f.preload), ephemeral: !1, fit: "contain" });
4516
+ }), Object.entries(o).filter(([d]) => d in n).forEach(([d, f]) => {
4517
+ f.config.preload !== n[d].preload && this.updateVideoClipPlayer(d, (y) => (y.config = {
4201
4518
  ...y.config,
4202
- preload: bt(n[p].preload),
4519
+ preload: kt(n[d].preload),
4203
4520
  ephemeral: !1
4204
4521
  }, y.videoElement.preload = y.config.preload, y));
4205
- }), r;
4522
+ }), i;
4206
4523
  })(), this.notifyStateListeners();
4207
4524
  }
4208
4525
  notifyStateListeners() {
@@ -4233,36 +4550,36 @@ class Oa {
4233
4550
  this.eventTarget.dispatchEvent(new CustomEvent(t, { detail: n }));
4234
4551
  }
4235
4552
  createVideoElement(t, n, { volume: o }) {
4236
- const r = document.createElement("video");
4237
- return r.playsInline = !0, r.src = this.cogsConnection.getAssetUrl(t), r.autoplay = !1, r.loop = !1, pe(r, o * this.globalVolume), r.preload = n.preload, r.addEventListener("playing", () => {
4553
+ const i = document.createElement("video");
4554
+ return i.playsInline = !0, i.src = this.cogsConnection.getAssetUrl(t), i.autoplay = !1, i.loop = !1, pe(i, o * this.globalVolume), i.preload = n.preload, i.addEventListener("playing", () => {
4238
4555
  if (this.pendingClip?.path === t) {
4239
4556
  switch (this.pendingClip.actionOncePlaying) {
4240
4557
  case "play": {
4241
- r.style.display = "block", this.notifyClipStateListeners(this.pendingClip.playId, t, "playing");
4558
+ i.style.display = "block", this.notifyClipStateListeners(this.pendingClip.playId, t, "playing");
4242
4559
  break;
4243
4560
  }
4244
4561
  case "pause": {
4245
- r.style.display = "block", r.pause(), this.notifyClipStateListeners(this.pendingClip.playId, t, "paused");
4562
+ i.style.display = "block", i.pause(), this.notifyClipStateListeners(this.pendingClip.playId, t, "paused");
4246
4563
  break;
4247
4564
  }
4248
4565
  case "stop": {
4249
- r.pause(), this.notifyClipStateListeners(this.pendingClip.playId, t, "stopped");
4566
+ i.pause(), this.notifyClipStateListeners(this.pendingClip.playId, t, "stopped");
4250
4567
  break;
4251
4568
  }
4252
4569
  }
4253
4570
  this.activeClip && this.handleStoppedClip(this.activeClip.path), this.activeClip = this.pendingClip, this.pendingClip = void 0;
4254
- } else this.activeClip?.path === t ? this.notifyClipStateListeners(this.activeClip.playId, t, "playing") : r.pause();
4255
- }), r.addEventListener("ended", () => {
4256
- !this.pendingClip && !r.loop && this.handleStoppedClip(t);
4257
- }), r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "100%", r.style.height = "100%", r.style.objectFit = n.fit, r.style.display = "none", this.parentElement.appendChild(r), r;
4571
+ } else this.activeClip?.path === t ? this.notifyClipStateListeners(this.activeClip.playId, t, "playing") : i.pause();
4572
+ }), i.addEventListener("ended", () => {
4573
+ !this.pendingClip && !i.loop && this.handleStoppedClip(t);
4574
+ }), i.style.position = "absolute", i.style.top = "0", i.style.left = "0", i.style.width = "100%", i.style.height = "100%", i.style.objectFit = n.fit, i.style.display = "none", this.parentElement.appendChild(i), i;
4258
4575
  }
4259
4576
  createClipPlayer(t, n) {
4260
- const r = {
4577
+ const i = {
4261
4578
  config: n,
4262
4579
  videoElement: this.createVideoElement(t, n, { volume: 1 }),
4263
4580
  volume: 1
4264
4581
  };
4265
- return wt(r, this.sinkId), r;
4582
+ return Ct(i, this.sinkId), i;
4266
4583
  }
4267
4584
  unloadClip(t) {
4268
4585
  if (this.activeClip?.path === t) {
@@ -4272,336 +4589,20 @@ class Oa {
4272
4589
  this.videoClipPlayers[t]?.videoElement.remove(), this.updateVideoClipPlayer(t, () => null);
4273
4590
  }
4274
4591
  }
4275
- function bt(e) {
4592
+ function kt(e) {
4276
4593
  return typeof e == "string" ? e : e ? "auto" : "none";
4277
4594
  }
4278
- function wt(e, t) {
4595
+ function Ct(e, t) {
4279
4596
  t !== void 0 && typeof e.videoElement.setSinkId == "function" && e.videoElement.setSinkId(t);
4280
4597
  }
4281
4598
  function pe(e, t) {
4282
4599
  e.volume = t, e.muted = t === 0;
4283
4600
  }
4284
- function Ee(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), r = Ie(o, t);
4290
- return { ...me, ...r };
4291
- }
4292
- case "audio": {
4293
- const n = e.keyframes.filter((a) => a[1] !== null), o = Et(n, t);
4294
- if (!o)
4295
- return;
4296
- const r = Ie(n, t);
4297
- return { ...we, ...r, ...o };
4298
- }
4299
- case "video": {
4300
- const n = e.keyframes.filter((a) => a[1] !== null), o = Et(n, t);
4301
- if (!o)
4302
- return;
4303
- const r = Ie(n, t);
4304
- return { ...ie, ...r, ...o };
4305
- }
4306
- }
4307
- }
4308
- function Ie(e, t) {
4309
- const n = {};
4310
- for (const [r, a] of e)
4311
- r <= t ? (Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
4312
- n[c] ??= {}, n[c].before = [r, l];
4313
- }), Object.entries(a.set ?? {}).forEach(([c, l]) => {
4314
- n[c] ??= {}, n[c].before = [r, l];
4315
- })) : Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
4316
- n[c] ??= {}, n[c].after === void 0 && (n[c].after = [r, l]);
4317
- });
4318
- const o = {};
4319
- return Object.entries(n).forEach(
4320
- ([r, { before: a, after: c }]) => {
4321
- if (c === void 0 && a) {
4322
- o[r] = a[1];
4323
- return;
4324
- }
4325
- if (a && c && a[0] === c[0]) {
4326
- o[r] = c[1];
4327
- return;
4328
- }
4329
- if (a && typeof a[1] == "number" && c && typeof c[1] == "number") {
4330
- o[r] = a[1] + (t - a[0]) * (c[1] - a[1]) / (c[0] - a[0]);
4331
- return;
4332
- }
4333
- }
4334
- ), o;
4335
- }
4336
- function Et(e, t) {
4337
- const n = e[0];
4338
- if (!n || n[0] > t)
4339
- return;
4340
- let o = 0, { t: r, rate: a } = we;
4341
- for (const [h, y] of e) {
4342
- if (h > t) break;
4343
- const { set: g } = y;
4344
- if (!g) continue;
4345
- const { t: i, rate: s } = g;
4346
- if (i !== void 0) {
4347
- o = h, r = i, s !== void 0 && (a = s);
4348
- continue;
4349
- }
4350
- if (s !== void 0) {
4351
- const d = (h - o) * a;
4352
- o = h, r += d, a = s;
4353
- }
4354
- }
4355
- const l = (t - o) * a, p = r + l;
4356
- return {
4357
- rate: a,
4358
- t: p
4359
- };
4360
- }
4361
- const la = 1e3;
4362
- class Be {
4363
- constructor(t, n, o) {
4364
- this.surfaceElement = t, this.clipElement = n, this._state = o, setTimeout(this.loop);
4365
- }
4366
- /**
4367
- * This is the delay to be used in the update loop.
4368
- * It is intended to be dynamic for each loop.
4369
- */
4370
- delay = la;
4371
- isConnected(t) {
4372
- return !(!this.surfaceElement || !this.clipElement || !this.surfaceElement.contains(this.clipElement) || t && !this.clipElement.contains(t));
4373
- }
4374
- _state;
4375
- setState(t) {
4376
- this._state = t, clearTimeout(this.timeout), this.loop();
4377
- }
4378
- timeout;
4379
- loop = async () => {
4380
- this.isConnected() ? (this.update(), isFinite(this.delay) && (this.timeout = setTimeout(this.loop, this.delay))) : this.destroy();
4381
- };
4382
- }
4383
- class da extends Be {
4384
- imageElement;
4385
- constructor(t, n, o) {
4386
- super(t, n, o), this.clipElement = n;
4387
- }
4388
- updateImageElement() {
4389
- this.imageElement = document.createElement("img"), this.clipElement.replaceChildren(this.imageElement), this.imageElement.style.position = "absolute", this.imageElement.style.height = "100%", this.imageElement.style.widows = "100%";
4390
- }
4391
- update() {
4392
- const t = Ee(this._state, Date.now());
4393
- if (t ? (!this.imageElement || !this.isConnected(this.imageElement)) && this.updateImageElement() : (this.imageElement?.remove(), this.imageElement = void 0), !this.imageElement || !t) return;
4394
- this.imageElement.src.startsWith(this._state.file) || (this.imageElement.src = this._state.file), this.imageElement.style.objectFit !== this._state.fit && (this.imageElement.style.objectFit = this._state.fit), parseFloat(this.imageElement.style.opacity) !== t.opacity && (this.imageElement.style.opacity = String(t.opacity ?? me.opacity));
4395
- const n = Math.round(t.zIndex ?? me.zIndex);
4396
- parseInt(this.imageElement.style.zIndex) !== n && (this.imageElement.style.zIndex = String(n));
4397
- const { opacity: o } = t;
4398
- typeof o == "string" && o !== this.imageElement.style.opacity && (this.imageElement.style.opacity = o);
4399
- }
4400
- destroy() {
4401
- this.imageElement?.remove();
4402
- }
4403
- }
4404
- const pa = 1e3, $e = 10, Qt = 1e3, ha = 200, fa = 0.15, kt = 0.7, _a = 0.3;
4405
- function ma(e) {
4406
- return -Math.sign(e) * Math.pow(Math.abs(e) / Qt, _a) * fa;
4407
- }
4408
- const va = 5;
4409
- function ga(e, t, n) {
4410
- const o = Ee(e, t);
4411
- if (!o) return !1;
4412
- const { t: r, rate: a } = o;
4413
- if (r === void 0 || a === void 0) return !1;
4414
- const c = e.keyframes.filter(([h, y]) => h > t && (y?.set?.t !== void 0 || y?.set?.rate !== void 0))[0];
4415
- if (c?.[1]?.set?.t !== 0) return !1;
4416
- const l = (n - r) / a, p = c[0] - t;
4417
- return Math.abs(l - p) <= va;
4418
- }
4419
- class ya extends Be {
4420
- videoElement;
4421
- // We seek to another part of the video and do nothing until we get there
4422
- isSeeking = !1;
4423
- // We change playbackRate to intercept the server time of the video and don't change course until we intercept
4424
- timeToIntercept = void 0;
4425
- constructor(t, n, o) {
4426
- super(t, n, o), this.clipElement = n;
4427
- }
4428
- updateVideoElement() {
4429
- this.destroy(), this.videoElement = document.createElement("video"), this.clipElement.replaceChildren(this.videoElement), this.videoElement.style.position = "absolute", this.videoElement.style.width = "100%", this.videoElement.style.height = "100%";
4430
- }
4431
- get videoDuration() {
4432
- if (this.videoElement && !(this.videoElement.readyState < HTMLMediaElement.HAVE_METADATA))
4433
- return this.videoElement.duration * 1e3;
4434
- }
4435
- /**
4436
- * Helper function to seek to a specified time.
4437
- * Works with the update loop to poll until seeked event has fired.
4438
- */
4439
- seekTo(t) {
4440
- this.videoElement && (this.videoElement.addEventListener(
4441
- "seeked",
4442
- () => {
4443
- console.debug("seeked"), this.isSeeking = !1;
4444
- },
4445
- { once: !0, passive: !0 }
4446
- ), this.videoElement.currentTime = t / 1e3);
4447
- }
4448
- update() {
4449
- if (this.isSeeking) return;
4450
- const t = Date.now(), n = Ee(this._state, t);
4451
- if (n ? (!this.videoElement || !this.isConnected(this.videoElement)) && this.updateVideoElement() : (this.videoElement?.remove(), this.videoElement = void 0), !n || !this.videoElement) return;
4452
- const { t: o, rate: r, volume: a } = { ...ie, ...n };
4453
- this.videoElement.src.endsWith(this._state.file) || (this.videoElement.src = this._state.file), this.videoElement.style.objectFit !== this._state.fit && (this.videoElement.style.objectFit = this._state.fit), parseFloat(this.videoElement.style.opacity) !== n.opacity && (this.videoElement.style.opacity = String(n.opacity ?? ie.opacity));
4454
- const c = Math.round(n.zIndex ?? ie.zIndex);
4455
- parseInt(this.videoElement.style.zIndex) !== c && (this.videoElement.style.zIndex = String(c)), this.videoElement.volume !== a && (this.videoElement.volume = a);
4456
- const l = this.videoDuration;
4457
- if (l !== void 0) {
4458
- if (ga(this._state, t, l))
4459
- this.videoElement.loop || (console.debug("starting loop"), this.videoElement.loop = !0);
4460
- else if (this.videoElement.loop && (console.debug("stopping loop"), this.videoElement.loop = !1), o > l) {
4461
- console.debug("ended"), this.delay = 1 / 0;
4462
- return;
4463
- }
4464
- }
4465
- this.videoElement.paused && r > 0 && (l === void 0 || l > o) && this.videoElement.play().catch(() => {
4466
- });
4467
- const h = this.videoElement.currentTime * 1e3 - o, y = Math.abs(h);
4468
- if (this.timeToIntercept !== void 0)
4469
- if (y <= $e)
4470
- console.log("intercepted", `${h.toFixed(0)}ms`), this.timeToIntercept = void 0;
4471
- else {
4472
- const g = h / (r - this.videoElement.playbackRate);
4473
- g < this.timeToIntercept && g > 0 ? (console.debug(`intercepting ${g.toFixed(0)}ms`, `${h.toFixed(0)}ms`), this.timeToIntercept = g) : (console.debug("missed intercept", h, this.timeToIntercept, g), this.timeToIntercept = void 0);
4474
- }
4475
- switch (!0) {
4476
- case y <= $e: {
4477
- console.debug(`${r}x`, h.toFixed(0)), this.timeToIntercept = void 0, this.videoElement.playbackRate !== r && (this.videoElement.playbackRate = r), this.delay = pa;
4478
- break;
4479
- }
4480
- case this.timeToIntercept !== void 0:
4481
- this.delay = this.timeToIntercept * kt;
4482
- break;
4483
- case (r > 0 && y > $e && y <= Qt && this.timeToIntercept === void 0): {
4484
- const g = ma(h), i = Math.max(0, r + g);
4485
- this.timeToIntercept = h / (r - i), console.debug(`${i.toFixed(2)}x`, `${h.toFixed(0)}ms`), this.videoElement.playbackRate !== i && (this.videoElement.playbackRate = i), this.delay = this.timeToIntercept * kt;
4486
- break;
4487
- }
4488
- default: {
4489
- this.videoElement.playbackRate !== r && (this.videoElement.playbackRate = r), console.debug("seeking"), this.delay = 10, this.seekTo(o + r * ha);
4490
- break;
4491
- }
4492
- }
4493
- }
4494
- destroy() {
4495
- this.videoElement && (this.videoElement.src = "", this.videoElement.remove());
4496
- }
4497
- }
4498
- const ba = 1e3, Ct = 10, Xt = 1e3, wa = 200, Ea = 0.2, ka = 0.5;
4499
- function Ca(e) {
4500
- return Math.sign(e) * Math.pow(Math.abs(e) / Xt, ka) * Ea;
4501
- }
4502
- class Aa extends Be {
4503
- audioElement;
4504
- isSeeking = !1;
4505
- constructor(t, n, o) {
4506
- super(t, n, o), this.clipElement = n;
4507
- }
4508
- updateAudioElement() {
4509
- this.destroy(), this.audioElement = document.createElement("audio"), this.clipElement.replaceChildren(this.audioElement);
4510
- }
4511
- /**
4512
- * Helper function to seek to a specified time.
4513
- * Works with the update loop to poll until seeked event has fired.
4514
- */
4515
- seekTo(t) {
4516
- this.audioElement && (this.audioElement.addEventListener(
4517
- "seeked",
4518
- () => {
4519
- this.isSeeking = !1;
4520
- },
4521
- { once: !0, passive: !0 }
4522
- ), this.audioElement.currentTime = t / 1e3);
4523
- }
4524
- update() {
4525
- if (this.isSeeking) return;
4526
- this.delay = ba;
4527
- const t = Ee(this._state, Date.now());
4528
- if (t ? (!this.audioElement || !this.isConnected(this.audioElement)) && this.updateAudioElement() : this.destroy(), !t || !this.audioElement) return;
4529
- const { t: n, rate: o, volume: r } = { ...we, ...t };
4530
- this.audioElement.src.endsWith(this._state.file) || (this.audioElement.src = this._state.file), this.audioElement.volume !== r && (this.audioElement.volume = r), this.audioElement.paused && o > 0 && this.audioElement.play().catch(() => {
4531
- });
4532
- const c = this.audioElement.currentTime * 1e3 - n, l = Math.abs(c);
4533
- switch (this.delay = 100, !0) {
4534
- case l <= Ct:
4535
- this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o);
4536
- break;
4537
- case (o > 0 && l > Ct && l <= Xt): {
4538
- const p = Ca(c), h = Math.max(0, o - p);
4539
- this.audioElement.playbackRate !== h && (this.audioElement.playbackRate = h);
4540
- break;
4541
- }
4542
- default: {
4543
- this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o), this.delay = 10, this.seekTo(n + o * (wa / 1e3));
4544
- break;
4545
- }
4546
- }
4547
- }
4548
- destroy() {
4549
- this.audioElement && (this.audioElement.src = "", this.audioElement.remove());
4550
- }
4551
- }
4552
- const Ta = "data-clip-id";
4553
- class Za {
4554
- _state = {};
4555
- setState(t) {
4556
- this._state = t, this.update();
4557
- }
4558
- _element;
4559
- get element() {
4560
- return this._element;
4561
- }
4562
- resources = {};
4563
- constructor(t) {
4564
- this._element = document.createElement("div"), this._element.style.width = "100%", this._element.style.height = "100%", this._state = t || {}, this.update();
4565
- }
4566
- update() {
4567
- Object.entries(this.resources).forEach(([n, { element: o, manager: r }]) => {
4568
- n in this._state || (delete this.resources[n], o.remove(), r?.destroy());
4569
- });
4570
- const t = Object.keys(this._state).toSorted().map((n) => {
4571
- const o = this.resources[n];
4572
- if (o)
4573
- return o.element;
4574
- {
4575
- const r = document.createElement("div");
4576
- return r.setAttribute(Ta, n), this.resources[n] = { element: r }, r;
4577
- }
4578
- });
4579
- this._element.replaceChildren(...t), Object.keys(this._state).toSorted().forEach((n) => {
4580
- const o = this._state[n], r = this.resources[n];
4581
- if (!r)
4582
- throw new Error("Failed to create resource");
4583
- if (r.manager)
4584
- r.manager.setState(o);
4585
- else
4586
- switch (o.type) {
4587
- case "image":
4588
- r.manager = new da(this._element, r.element, o);
4589
- break;
4590
- case "audio":
4591
- r.manager = new Aa(this._element, r.element, o);
4592
- break;
4593
- case "video":
4594
- r.manager = new ya(this._element, r.element, o);
4595
- break;
4596
- }
4597
- });
4598
- }
4599
- }
4600
4601
  const Pa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4601
4602
  __proto__: null
4602
4603
  }, Symbol.toStringTag, { value: "Module" }));
4603
4604
  export {
4604
- $a as CogsAudioPlayer,
4605
+ Oa as CogsAudioPlayer,
4605
4606
  Cn as CogsConfigChangedEvent,
4606
4607
  za as CogsConnection,
4607
4608
  En as CogsConnectionCloseEvent,
@@ -4611,12 +4612,13 @@ export {
4611
4612
  kn as CogsMessageEvent,
4612
4613
  zn as CogsShowPhaseChangedEvent,
4613
4614
  An as CogsStateChangedEvent,
4614
- Oa as CogsVideoPlayer,
4615
+ Za as CogsVideoPlayer,
4616
+ ka as DATA_CLIP_ID,
4615
4617
  Ke as DataStoreItemEvent,
4616
4618
  He as DataStoreItemsEvent,
4617
4619
  Pa as ManifestTypes,
4618
4620
  Ia as MediaSchema,
4619
- Za as SurfaceManager,
4621
+ $a as SurfaceManager,
4620
4622
  dn as assetUrl,
4621
4623
  Ee as getStateAtTime,
4622
4624
  Sa as preloadUrl