@clockworkdog/cogs-client 3.0.0-alpha.5 → 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.
- package/dist/browser/index.mjs +1175 -1135
- package/dist/browser/index.umd.js +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/state-based/AudioManager.d.ts +1 -1
- package/dist/state-based/AudioManager.js +6 -5
- package/dist/state-based/ClipManager.d.ts +2 -1
- package/dist/state-based/ClipManager.js +6 -2
- package/dist/state-based/ImageManager.d.ts +1 -1
- package/dist/state-based/ImageManager.js +6 -5
- package/dist/state-based/SurfaceManager.d.ts +2 -1
- package/dist/state-based/SurfaceManager.js +7 -4
- package/dist/state-based/VideoManager.d.ts +3 -1
- package/dist/state-based/VideoManager.js +105 -18
- package/package.json +2 -2
package/dist/browser/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var At = /* @__PURE__ */ ((e) => (e.Setup = "setup", e.Preshow = "pre-show", e.InProgress = "in progress", e.Finished = "finished", e))(At || {});
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -13,21 +13,21 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
var
|
|
17
|
-
return
|
|
16
|
+
var Oe = function(e, t) {
|
|
17
|
+
return Oe = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, o) {
|
|
18
18
|
n.__proto__ = o;
|
|
19
19
|
} || function(n, o) {
|
|
20
20
|
for (var i in o) o.hasOwnProperty(i) && (n[i] = o[i]);
|
|
21
|
-
},
|
|
21
|
+
}, Oe(e, t);
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
|
|
23
|
+
function Tt(e, t) {
|
|
24
|
+
Oe(e, t);
|
|
25
25
|
function n() {
|
|
26
26
|
this.constructor = e;
|
|
27
27
|
}
|
|
28
28
|
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function nn(e) {
|
|
31
31
|
var t = typeof Symbol == "function" && e[Symbol.iterator], n = 0;
|
|
32
32
|
return t ? t.call(e) : {
|
|
33
33
|
next: function() {
|
|
@@ -35,7 +35,7 @@ function tn(e) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function on(e, t) {
|
|
39
39
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
40
40
|
if (!n) return e;
|
|
41
41
|
var o = n.call(e), i, a = [], c;
|
|
@@ -52,9 +52,9 @@ function nn(e, t) {
|
|
|
52
52
|
}
|
|
53
53
|
return a;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function rn() {
|
|
56
56
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
57
|
-
e = e.concat(
|
|
57
|
+
e = e.concat(on(arguments[t]));
|
|
58
58
|
return e;
|
|
59
59
|
}
|
|
60
60
|
var St = (
|
|
@@ -65,20 +65,20 @@ var St = (
|
|
|
65
65
|
}
|
|
66
66
|
return e;
|
|
67
67
|
}()
|
|
68
|
-
),
|
|
68
|
+
), sn = (
|
|
69
69
|
/** @class */
|
|
70
70
|
function(e) {
|
|
71
|
-
|
|
71
|
+
Tt(t, e);
|
|
72
72
|
function t(n, o) {
|
|
73
73
|
var i = e.call(this, "error", o) || this;
|
|
74
74
|
return i.message = n.message, i.error = n, i;
|
|
75
75
|
}
|
|
76
76
|
return t;
|
|
77
77
|
}(St)
|
|
78
|
-
),
|
|
78
|
+
), an = (
|
|
79
79
|
/** @class */
|
|
80
80
|
function(e) {
|
|
81
|
-
|
|
81
|
+
Tt(t, e);
|
|
82
82
|
function t(n, o, i) {
|
|
83
83
|
n === void 0 && (n = 1e3), o === void 0 && (o = "");
|
|
84
84
|
var a = e.call(this, "close", i) || this;
|
|
@@ -93,12 +93,12 @@ var St = (
|
|
|
93
93
|
* https://github.com/pladaria/reconnecting-websocket
|
|
94
94
|
* License MIT
|
|
95
95
|
*/
|
|
96
|
-
var
|
|
96
|
+
var un = function() {
|
|
97
97
|
if (typeof WebSocket < "u")
|
|
98
98
|
return WebSocket;
|
|
99
|
-
},
|
|
99
|
+
}, cn = function(e) {
|
|
100
100
|
return typeof e < "u" && !!e && e.CLOSING === 2;
|
|
101
|
-
},
|
|
101
|
+
}, F = {
|
|
102
102
|
maxReconnectionDelay: 1e4,
|
|
103
103
|
minReconnectionDelay: 1e3 + Math.random() * 4e3,
|
|
104
104
|
minUptime: 5e3,
|
|
@@ -106,7 +106,7 @@ var an = function() {
|
|
|
106
106
|
connectionTimeout: 4e3,
|
|
107
107
|
maxRetries: 1 / 0,
|
|
108
108
|
maxEnqueuedMessages: 1 / 0
|
|
109
|
-
},
|
|
109
|
+
}, ln = (
|
|
110
110
|
/** @class */
|
|
111
111
|
function() {
|
|
112
112
|
function e(t, n, o) {
|
|
@@ -118,13 +118,13 @@ var an = function() {
|
|
|
118
118
|
close: []
|
|
119
119
|
}, this._retryCount = -1, this._shouldReconnect = !0, this._connectLock = !1, this._binaryType = "blob", this._closeCalled = !1, this._messageQueue = [], this.onclose = null, this.onerror = null, this.onmessage = null, this.onopen = null, this._handleOpen = function(a) {
|
|
120
120
|
i._debug("open event");
|
|
121
|
-
var c = i._options.minUptime, l = c === void 0 ?
|
|
121
|
+
var c = i._options.minUptime, l = c === void 0 ? F.minUptime : c;
|
|
122
122
|
clearTimeout(i._connectTimeout), i._uptimeTimeout = setTimeout(function() {
|
|
123
123
|
return i._acceptOpen();
|
|
124
|
-
}, l), i._ws.binaryType = i._binaryType, i._messageQueue.forEach(function(
|
|
125
|
-
return i._ws.send(
|
|
126
|
-
}), i._messageQueue = [], i.onopen && i.onopen(a), i._listeners.open.forEach(function(
|
|
127
|
-
return i._callEventListener(a,
|
|
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
130
|
i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(c) {
|
|
@@ -276,7 +276,7 @@ var an = 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 ?
|
|
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) {
|
|
@@ -285,12 +285,12 @@ var an = function() {
|
|
|
285
285
|
var n, o, i = this._listeners[t.type];
|
|
286
286
|
if (i)
|
|
287
287
|
try {
|
|
288
|
-
for (var a =
|
|
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 (
|
|
293
|
-
n = { error:
|
|
292
|
+
} catch (d) {
|
|
293
|
+
n = { error: d };
|
|
294
294
|
} finally {
|
|
295
295
|
try {
|
|
296
296
|
c && !c.done && (o = a.return) && o.call(a);
|
|
@@ -306,10 +306,10 @@ var an = function() {
|
|
|
306
306
|
}, e.prototype._debug = function() {
|
|
307
307
|
for (var t = [], n = 0; n < arguments.length; n++)
|
|
308
308
|
t[n] = arguments[n];
|
|
309
|
-
this._options.debug && console.log.apply(console,
|
|
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 ?
|
|
312
|
-
return this._retryCount > 0 && (
|
|
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,28 +330,28 @@ var an = function() {
|
|
|
330
330
|
var t = this;
|
|
331
331
|
if (!(this._connectLock || !this._shouldReconnect)) {
|
|
332
332
|
this._connectLock = !0;
|
|
333
|
-
var n = this._options, o = n.maxRetries, i = o === void 0 ?
|
|
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
334
|
if (this._retryCount >= i) {
|
|
335
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(), !
|
|
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
342
|
}).then(function(f) {
|
|
343
|
-
t._closeCalled || (t._debug("connect", { url: f, protocols: t._protocols }), t._ws = t._protocols ? new
|
|
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
|
});
|
|
347
347
|
}
|
|
348
348
|
}, e.prototype._handleTimeout = function() {
|
|
349
|
-
this._debug("timeout event"), this._handleError(new
|
|
349
|
+
this._debug("timeout event"), this._handleError(new sn(Error("TIMEOUT"), this));
|
|
350
350
|
}, e.prototype._disconnect = function(t, n) {
|
|
351
351
|
if (t === void 0 && (t = 1e3), this._clearTimeouts(), !!this._ws) {
|
|
352
352
|
this._removeListeners();
|
|
353
353
|
try {
|
|
354
|
-
this._ws.close(t, n), this._handleClose(new
|
|
354
|
+
this._ws.close(t, n), this._handleClose(new an(t, n, this));
|
|
355
355
|
} catch {
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -368,16 +368,16 @@ var an = function() {
|
|
|
368
368
|
}, e;
|
|
369
369
|
}()
|
|
370
370
|
);
|
|
371
|
-
const
|
|
372
|
-
function
|
|
371
|
+
const zt = 12095;
|
|
372
|
+
function dn(e) {
|
|
373
373
|
const t = typeof window < "u" ? window.location : void 0, n = `/assets/${encodeURIComponent(e)}`;
|
|
374
|
-
return `${t?.protocol}//${t?.hostname}:${
|
|
374
|
+
return `${t?.protocol}//${t?.hostname}:${zt}${n}`;
|
|
375
375
|
}
|
|
376
|
-
async function
|
|
376
|
+
async function Sa(e) {
|
|
377
377
|
const t = await fetch(e);
|
|
378
378
|
return URL.createObjectURL(new Blob([await t.arrayBuffer()]));
|
|
379
379
|
}
|
|
380
|
-
class
|
|
380
|
+
class pn {
|
|
381
381
|
_items;
|
|
382
382
|
#e = new EventTarget();
|
|
383
383
|
constructor(t) {
|
|
@@ -385,8 +385,8 @@ class dn {
|
|
|
385
385
|
}
|
|
386
386
|
handleDataStoreItemsMessage(t) {
|
|
387
387
|
this._items = { ...this._items, ...t.items }, Object.entries(t.items).forEach(([n, o]) => {
|
|
388
|
-
this.dispatchEvent(new
|
|
389
|
-
}), this.dispatchEvent(new
|
|
388
|
+
this.dispatchEvent(new Ke(n, o));
|
|
389
|
+
}), this.dispatchEvent(new He(t.items));
|
|
390
390
|
}
|
|
391
391
|
get items() {
|
|
392
392
|
return this._items;
|
|
@@ -396,8 +396,8 @@ class dn {
|
|
|
396
396
|
}
|
|
397
397
|
setItems(t) {
|
|
398
398
|
return this._items = { ...this._items, ...t }, Object.entries(t).forEach(([n, o]) => {
|
|
399
|
-
this.dispatchEvent(new
|
|
400
|
-
}), this.dispatchEvent(new
|
|
399
|
+
this.dispatchEvent(new Ke(n, o));
|
|
400
|
+
}), this.dispatchEvent(new He(t)), this;
|
|
401
401
|
}
|
|
402
402
|
// Type-safe listeners
|
|
403
403
|
addEventListener(t, n, o) {
|
|
@@ -410,20 +410,20 @@ class dn {
|
|
|
410
410
|
this.#e.dispatchEvent(t);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
class
|
|
413
|
+
class Ke extends Event {
|
|
414
414
|
constructor(t, n) {
|
|
415
415
|
super("item"), this.key = t, this.value = n;
|
|
416
416
|
}
|
|
417
417
|
_cogsConnectionEventType = "item";
|
|
418
418
|
}
|
|
419
|
-
class
|
|
419
|
+
class He extends Event {
|
|
420
420
|
constructor(t) {
|
|
421
421
|
super("items"), this.items = t;
|
|
422
422
|
}
|
|
423
423
|
_cogsConnectionEventType = "item";
|
|
424
424
|
}
|
|
425
425
|
const te = globalThis.Date;
|
|
426
|
-
function
|
|
426
|
+
function hn(e) {
|
|
427
427
|
const t = e - te.now();
|
|
428
428
|
function n(...i) {
|
|
429
429
|
return i.length === 0 ? new te(n.now()) : new te(...i);
|
|
@@ -433,25 +433,25 @@ function pn(e) {
|
|
|
433
433
|
return te.now() + t;
|
|
434
434
|
}, globalThis.Date = n;
|
|
435
435
|
}
|
|
436
|
-
let
|
|
437
|
-
function
|
|
438
|
-
return ++
|
|
436
|
+
let fn = 0;
|
|
437
|
+
function _n() {
|
|
438
|
+
return ++fn;
|
|
439
439
|
}
|
|
440
|
-
const
|
|
441
|
-
function
|
|
440
|
+
const mn = 5, vn = 1e4;
|
|
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((
|
|
447
|
-
const h =
|
|
446
|
+
const u = new Promise((p) => {
|
|
447
|
+
const h = _n(), v = Date.now(), _ = performance.now();
|
|
448
448
|
t({ timesync: { id: h } });
|
|
449
|
-
const w = (E, k) =>
|
|
450
|
-
a[h] = { complete: w }, setTimeout(() =>
|
|
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), r =
|
|
454
|
+
const g = (await Promise.all(y)).filter((s) => s !== null), r = yn(g);
|
|
455
455
|
isNaN(r) || n(Date.now() + r);
|
|
456
456
|
}
|
|
457
457
|
const l = (y) => {
|
|
@@ -459,30 +459,30 @@ function vn({ interval: e, send: t, onChange: n = pn, syncSampleSize: o = _n, sy
|
|
|
459
459
|
r && r.complete(g, y.timesync.now);
|
|
460
460
|
};
|
|
461
461
|
c();
|
|
462
|
-
const
|
|
462
|
+
const d = setInterval(c, e);
|
|
463
463
|
return {
|
|
464
464
|
receive: l,
|
|
465
465
|
destroy: () => {
|
|
466
|
-
clearInterval(
|
|
466
|
+
clearInterval(d);
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function yn(e) {
|
|
471
471
|
return e.map(({ sentAt: t, receivedAt: n, clientNow: o, serverNow: i }) => {
|
|
472
472
|
const a = (n - t) / 2;
|
|
473
473
|
return i - o - a;
|
|
474
474
|
}).reduce((t, n) => t + n, 0) / e.length;
|
|
475
475
|
}
|
|
476
|
-
class
|
|
477
|
-
constructor(t, { hostname: n = document.location.hostname, port: o =
|
|
478
|
-
this.manifest = t, this.currentState = { ...i }, this.store = new
|
|
479
|
-
const { useReconnectingWebsocket: c, path: l, pathParams:
|
|
480
|
-
this.urlParams = new URLSearchParams(
|
|
476
|
+
class za {
|
|
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
481
|
const f = `ws://${n}:${o}${l}?${this.urlParams}`;
|
|
482
|
-
this.websocket = c ? new
|
|
482
|
+
this.websocket = c ? new ln(f) : new WebSocket(f);
|
|
483
483
|
let y;
|
|
484
484
|
this.websocket.onopen = () => {
|
|
485
|
-
this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new
|
|
485
|
+
this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new wn()), this.setState(this.currentState), y = gn({
|
|
486
486
|
interval: 6e4,
|
|
487
487
|
send: (g) => {
|
|
488
488
|
this.websocket.send(JSON.stringify(g));
|
|
@@ -499,18 +499,18 @@ class Aa {
|
|
|
499
499
|
console.error(r);
|
|
500
500
|
}
|
|
501
501
|
}), this.websocket.onclose = () => {
|
|
502
|
-
y?.destroy(), this.dispatchEvent(new
|
|
502
|
+
y?.destroy(), this.dispatchEvent(new En());
|
|
503
503
|
}, this.websocket.addEventListener("message", ({ data: g }) => {
|
|
504
504
|
try {
|
|
505
505
|
const r = JSON.parse(g);
|
|
506
506
|
try {
|
|
507
507
|
if (r.config)
|
|
508
|
-
this.currentConfig = r.config, this.dispatchEvent(new
|
|
508
|
+
this.currentConfig = r.config, this.dispatchEvent(new Cn(this.currentConfig));
|
|
509
509
|
else if (r.updates)
|
|
510
|
-
this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new
|
|
510
|
+
this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new An(r.updates));
|
|
511
511
|
else if (r.event && r.event.key)
|
|
512
512
|
this.dispatchEvent(
|
|
513
|
-
new
|
|
513
|
+
new Tn(r.event.key, r.event.value)
|
|
514
514
|
);
|
|
515
515
|
else if (typeof r.message == "object") {
|
|
516
516
|
const s = r.message;
|
|
@@ -523,7 +523,7 @@ class Aa {
|
|
|
523
523
|
};
|
|
524
524
|
break;
|
|
525
525
|
case "show_phase":
|
|
526
|
-
this._showPhase = s.phase, this.dispatchEvent(new
|
|
526
|
+
this._showPhase = s.phase, this.dispatchEvent(new zn(s.phase));
|
|
527
527
|
break;
|
|
528
528
|
case "media_config_update":
|
|
529
529
|
this._mediaConfig = s;
|
|
@@ -535,7 +535,7 @@ class Aa {
|
|
|
535
535
|
this.store.handleDataStoreItemsMessage(s);
|
|
536
536
|
break;
|
|
537
537
|
}
|
|
538
|
-
this.dispatchEvent(new
|
|
538
|
+
this.dispatchEvent(new kn(s));
|
|
539
539
|
}
|
|
540
540
|
} catch (s) {
|
|
541
541
|
console.warn("Error handling data", g, s);
|
|
@@ -568,7 +568,7 @@ class Aa {
|
|
|
568
568
|
get state() {
|
|
569
569
|
return { ...this.currentState };
|
|
570
570
|
}
|
|
571
|
-
_showPhase =
|
|
571
|
+
_showPhase = At.Setup;
|
|
572
572
|
get showPhase() {
|
|
573
573
|
return this._showPhase;
|
|
574
574
|
}
|
|
@@ -584,7 +584,7 @@ class Aa {
|
|
|
584
584
|
* Return asset URLs using the information about the client and server support for HTTP/2
|
|
585
585
|
*/
|
|
586
586
|
getAssetUrl(t) {
|
|
587
|
-
return `${
|
|
587
|
+
return `${dn(t)}?${this.urlParams?.toString() ?? ""}`;
|
|
588
588
|
}
|
|
589
589
|
/**
|
|
590
590
|
* Cached audio outputs use to look up the device/sink ID when a different device label is requested
|
|
@@ -655,7 +655,7 @@ class Aa {
|
|
|
655
655
|
this.eventTarget.dispatchEvent(t);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function bn(e) {
|
|
659
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") ?? "";
|
|
@@ -691,37 +691,37 @@ function yn(e) {
|
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
-
class
|
|
694
|
+
class wn extends Event {
|
|
695
695
|
_cogsConnectionEventType = "open";
|
|
696
696
|
constructor() {
|
|
697
697
|
super("open");
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
class
|
|
700
|
+
class En extends Event {
|
|
701
701
|
_cogsConnectionEventType = "close";
|
|
702
702
|
constructor() {
|
|
703
703
|
super("close");
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
class
|
|
706
|
+
class kn extends Event {
|
|
707
707
|
constructor(t) {
|
|
708
708
|
super("message"), this.message = t;
|
|
709
709
|
}
|
|
710
710
|
_cogsConnectionEventType = "message";
|
|
711
711
|
}
|
|
712
|
-
class
|
|
712
|
+
class Cn extends Event {
|
|
713
713
|
constructor(t) {
|
|
714
714
|
super("config"), this.config = t;
|
|
715
715
|
}
|
|
716
716
|
_cogsConnectionEventType = "config";
|
|
717
717
|
}
|
|
718
|
-
class
|
|
718
|
+
class An extends Event {
|
|
719
719
|
constructor(t) {
|
|
720
720
|
super("state"), this.state = t;
|
|
721
721
|
}
|
|
722
722
|
_cogsConnectionEventType = "state";
|
|
723
723
|
}
|
|
724
|
-
class
|
|
724
|
+
class Tn extends Event {
|
|
725
725
|
constructor(t, n) {
|
|
726
726
|
super("event"), this.name = t, this.value = n;
|
|
727
727
|
}
|
|
@@ -733,7 +733,7 @@ class Sn extends Event {
|
|
|
733
733
|
}
|
|
734
734
|
_cogsConnectionEventType = "mediaConfig";
|
|
735
735
|
}
|
|
736
|
-
class
|
|
736
|
+
class zn extends Event {
|
|
737
737
|
constructor(t) {
|
|
738
738
|
super("showPhase"), this.showPhase = t;
|
|
739
739
|
}
|
|
@@ -741,17 +741,17 @@ class Tn extends Event {
|
|
|
741
741
|
}
|
|
742
742
|
// @__NO_SIDE_EFFECTS__
|
|
743
743
|
function m(e, t, n) {
|
|
744
|
-
function o(l,
|
|
744
|
+
function o(l, d) {
|
|
745
745
|
if (l._zod || Object.defineProperty(l, "_zod", {
|
|
746
746
|
value: {
|
|
747
|
-
def:
|
|
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,
|
|
754
|
+
l._zod.traits.add(e), t(l, d);
|
|
755
755
|
const f = c.prototype, y = Object.keys(f);
|
|
756
756
|
for (let g = 0; g < y.length; g++) {
|
|
757
757
|
const r = y[g];
|
|
@@ -763,9 +763,9 @@ function m(e, t, n) {
|
|
|
763
763
|
}
|
|
764
764
|
Object.defineProperty(a, "name", { value: e });
|
|
765
765
|
function c(l) {
|
|
766
|
-
var
|
|
766
|
+
var d;
|
|
767
767
|
const f = n?.Parent ? new a() : this;
|
|
768
|
-
o(f, l), (
|
|
768
|
+
o(f, l), (d = f._zod).deferred ?? (d.deferred = []);
|
|
769
769
|
for (const y of f._zod.deferred)
|
|
770
770
|
y();
|
|
771
771
|
return f;
|
|
@@ -779,23 +779,23 @@ class K extends Error {
|
|
|
779
779
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
|
-
class
|
|
782
|
+
class It extends Error {
|
|
783
783
|
constructor(t) {
|
|
784
784
|
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
const
|
|
787
|
+
const $t = {};
|
|
788
788
|
function j(e) {
|
|
789
|
-
return
|
|
789
|
+
return $t;
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function In(e) {
|
|
792
792
|
const t = Object.values(e).filter((o) => typeof o == "number");
|
|
793
793
|
return Object.entries(e).filter(([o, i]) => t.indexOf(+o) === -1).map(([o, i]) => i);
|
|
794
794
|
}
|
|
795
|
-
function
|
|
795
|
+
function Ze(e, t) {
|
|
796
796
|
return typeof t == "bigint" ? t.toString() : t;
|
|
797
797
|
}
|
|
798
|
-
function
|
|
798
|
+
function Re(e) {
|
|
799
799
|
return {
|
|
800
800
|
get value() {
|
|
801
801
|
{
|
|
@@ -805,30 +805,30 @@ function xe(e) {
|
|
|
805
805
|
}
|
|
806
806
|
};
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function je(e) {
|
|
809
809
|
return e == null;
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function Ne(e) {
|
|
812
812
|
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
813
813
|
return e.slice(t, n);
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function $n(e, t) {
|
|
816
816
|
const n = (e.toString().split(".")[1] || "").length, o = t.toString();
|
|
817
817
|
let i = (o.split(".")[1] || "").length;
|
|
818
818
|
if (i === 0 && /\d?e-\d?/.test(o)) {
|
|
819
|
-
const
|
|
820
|
-
|
|
819
|
+
const d = o.match(/\d?e-(\d?)/);
|
|
820
|
+
d?.[1] && (i = Number.parseInt(d[1]));
|
|
821
821
|
}
|
|
822
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
|
-
const
|
|
825
|
+
const Je = Symbol("evaluating");
|
|
826
826
|
function C(e, t, n) {
|
|
827
827
|
let o;
|
|
828
828
|
Object.defineProperty(e, t, {
|
|
829
829
|
get() {
|
|
830
|
-
if (o !==
|
|
831
|
-
return o === void 0 && (o =
|
|
830
|
+
if (o !== Je)
|
|
831
|
+
return o === void 0 && (o = Je, o = n()), o;
|
|
832
832
|
},
|
|
833
833
|
set(i) {
|
|
834
834
|
Object.defineProperty(e, t, {
|
|
@@ -855,18 +855,18 @@ function B(...e) {
|
|
|
855
855
|
}
|
|
856
856
|
return Object.defineProperties({}, t);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Ye(e) {
|
|
859
859
|
return JSON.stringify(e);
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function On(e) {
|
|
862
862
|
return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
863
863
|
}
|
|
864
|
-
const
|
|
864
|
+
const Ot = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
865
865
|
};
|
|
866
866
|
function he(e) {
|
|
867
867
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
868
868
|
}
|
|
869
|
-
const
|
|
869
|
+
const Zn = Re(() => {
|
|
870
870
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
871
871
|
return !1;
|
|
872
872
|
try {
|
|
@@ -885,10 +885,10 @@ function H(e) {
|
|
|
885
885
|
const n = t.prototype;
|
|
886
886
|
return !(he(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function Zt(e) {
|
|
889
889
|
return H(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
890
890
|
}
|
|
891
|
-
const
|
|
891
|
+
const Pn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
892
892
|
function J(e) {
|
|
893
893
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
894
894
|
}
|
|
@@ -909,17 +909,17 @@ function b(e) {
|
|
|
909
909
|
}
|
|
910
910
|
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
911
911
|
}
|
|
912
|
-
function
|
|
912
|
+
function xn(e) {
|
|
913
913
|
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
914
914
|
}
|
|
915
|
-
const
|
|
915
|
+
const Ln = {
|
|
916
916
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
917
917
|
int32: [-2147483648, 2147483647],
|
|
918
918
|
uint32: [0, 4294967295],
|
|
919
919
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
920
920
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
921
921
|
};
|
|
922
|
-
function
|
|
922
|
+
function Rn(e, t) {
|
|
923
923
|
const n = e._zod.def, o = B(e._zod.def, {
|
|
924
924
|
get shape() {
|
|
925
925
|
const i = {};
|
|
@@ -934,7 +934,7 @@ function Ln(e, t) {
|
|
|
934
934
|
});
|
|
935
935
|
return D(e, o);
|
|
936
936
|
}
|
|
937
|
-
function
|
|
937
|
+
function jn(e, t) {
|
|
938
938
|
const n = e._zod.def, o = B(e._zod.def, {
|
|
939
939
|
get shape() {
|
|
940
940
|
const i = { ...e._zod.def.shape };
|
|
@@ -949,7 +949,7 @@ function Rn(e, t) {
|
|
|
949
949
|
});
|
|
950
950
|
return D(e, o);
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function Nn(e, t) {
|
|
953
953
|
if (!H(t))
|
|
954
954
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
955
955
|
const n = e._zod.def.checks;
|
|
@@ -964,7 +964,7 @@ function jn(e, t) {
|
|
|
964
964
|
});
|
|
965
965
|
return D(e, i);
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function Dn(e, t) {
|
|
968
968
|
if (!H(t))
|
|
969
969
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
970
970
|
const n = {
|
|
@@ -977,7 +977,7 @@ function Nn(e, t) {
|
|
|
977
977
|
};
|
|
978
978
|
return D(e, n);
|
|
979
979
|
}
|
|
980
|
-
function
|
|
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 };
|
|
@@ -1049,7 +1049,7 @@ function q(e, t = 0) {
|
|
|
1049
1049
|
return !0;
|
|
1050
1050
|
return !1;
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
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;
|
|
@@ -1066,7 +1066,7 @@ function N(e, t, n) {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function De(e) {
|
|
1070
1070
|
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
1071
1071
|
}
|
|
1072
1072
|
function ie(...e) {
|
|
@@ -1078,25 +1078,25 @@ function ie(...e) {
|
|
|
1078
1078
|
inst: o
|
|
1079
1079
|
} : { ...t };
|
|
1080
1080
|
}
|
|
1081
|
-
const
|
|
1081
|
+
const Pt = (e, t) => {
|
|
1082
1082
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
1083
1083
|
value: e._zod,
|
|
1084
1084
|
enumerable: !1
|
|
1085
1085
|
}), Object.defineProperty(e, "issues", {
|
|
1086
1086
|
value: t,
|
|
1087
1087
|
enumerable: !1
|
|
1088
|
-
}), e.message = JSON.stringify(t,
|
|
1088
|
+
}), e.message = JSON.stringify(t, Ze, 2), Object.defineProperty(e, "toString", {
|
|
1089
1089
|
value: () => e.message,
|
|
1090
1090
|
enumerable: !1
|
|
1091
1091
|
});
|
|
1092
|
-
},
|
|
1093
|
-
function
|
|
1092
|
+
}, xt = /* @__PURE__ */ m("$ZodError", Pt), Lt = /* @__PURE__ */ m("$ZodError", Pt, { Parent: Error });
|
|
1093
|
+
function Vn(e, t = (n) => n.message) {
|
|
1094
1094
|
const n = {}, o = [];
|
|
1095
1095
|
for (const i of e.issues)
|
|
1096
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
|
-
function
|
|
1099
|
+
function Bn(e, t = (n) => n.message) {
|
|
1100
1100
|
const n = { _errors: [] }, o = (i) => {
|
|
1101
1101
|
for (const a of i.issues)
|
|
1102
1102
|
if (a.code === "invalid_union" && a.errors.length)
|
|
@@ -1110,28 +1110,28 @@ function Vn(e, t = (n) => n.message) {
|
|
|
1110
1110
|
else {
|
|
1111
1111
|
let c = n, l = 0;
|
|
1112
1112
|
for (; l < a.path.length; ) {
|
|
1113
|
-
const
|
|
1114
|
-
l === a.path.length - 1 ? (c[
|
|
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
|
|
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 (i?.Err ?? e)(c.issues.map((
|
|
1126
|
-
throw
|
|
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
|
-
},
|
|
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 (i?.Err ?? e)(c.issues.map((
|
|
1134
|
-
throw
|
|
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) => {
|
|
@@ -1140,58 +1140,58 @@ const Ne = (e) => (t, n, o, i) => {
|
|
|
1140
1140
|
throw new K();
|
|
1141
1141
|
return a.issues.length ? {
|
|
1142
1142
|
success: !1,
|
|
1143
|
-
error: new (e ??
|
|
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
1146
|
const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
|
|
1147
1147
|
let a = t._zod.run({ value: n, issues: [] }, i);
|
|
1148
1148
|
return a instanceof Promise && (a = await a), a.issues.length ? {
|
|
1149
1149
|
success: !1,
|
|
1150
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
1153
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1154
|
-
return
|
|
1155
|
-
},
|
|
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
1156
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1157
|
-
return
|
|
1158
|
-
},
|
|
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
1159
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1160
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
1162
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1163
1163
|
return ge(e)(t, n, i);
|
|
1164
|
-
},
|
|
1165
|
-
function
|
|
1166
|
-
return new RegExp(
|
|
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
|
+
function po() {
|
|
1166
|
+
return new RegExp(lo, "u");
|
|
1167
1167
|
}
|
|
1168
|
-
const
|
|
1169
|
-
function
|
|
1168
|
+
const ho = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, fo = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, _o = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, mo = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, vo = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Rt = /^[A-Za-z0-9_-]*$/, go = /^\+(?:[0-9]){6,14}[0-9]$/, jt = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", yo = /* @__PURE__ */ new RegExp(`^${jt}$`);
|
|
1169
|
+
function Nt(e) {
|
|
1170
1170
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
1171
1171
|
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1172
1172
|
}
|
|
1173
|
-
function yo(e) {
|
|
1174
|
-
return new RegExp(`^${jt(e)}$`);
|
|
1175
|
-
}
|
|
1176
1173
|
function bo(e) {
|
|
1177
|
-
|
|
1174
|
+
return new RegExp(`^${Nt(e)}$`);
|
|
1175
|
+
}
|
|
1176
|
+
function wo(e) {
|
|
1177
|
+
const t = Nt({ precision: e.precision }), n = ["Z"];
|
|
1178
1178
|
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
1179
1179
|
const o = `${t}(?:${n.join("|")})`;
|
|
1180
|
-
return new RegExp(`^${
|
|
1180
|
+
return new RegExp(`^${jt}T(?:${o})$`);
|
|
1181
1181
|
}
|
|
1182
|
-
const
|
|
1182
|
+
const Eo = (e) => {
|
|
1183
1183
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1184
1184
|
return new RegExp(`^${t}$`);
|
|
1185
|
-
},
|
|
1185
|
+
}, ko = /^-?\d+$/, Co = /^-?\d+(?:\.\d+)?/, Ao = /^null$/i, To = /^[^A-Z]*$/, So = /^[^a-z]*$/, O = /* @__PURE__ */ m("$ZodCheck", (e, t) => {
|
|
1186
1186
|
var n;
|
|
1187
1187
|
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
1188
|
-
}),
|
|
1188
|
+
}), Dt = {
|
|
1189
1189
|
number: "number",
|
|
1190
1190
|
bigint: "bigint",
|
|
1191
1191
|
object: "date"
|
|
1192
|
-
},
|
|
1192
|
+
}, Ut = /* @__PURE__ */ m("$ZodCheckLessThan", (e, t) => {
|
|
1193
1193
|
O.init(e, t);
|
|
1194
|
-
const n =
|
|
1194
|
+
const n = Dt[typeof t.value];
|
|
1195
1195
|
e._zod.onattach.push((o) => {
|
|
1196
1196
|
const i = o._zod.bag, a = (t.inclusive ? i.maximum : i.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1197
1197
|
t.value < a && (t.inclusive ? i.maximum = t.value : i.exclusiveMaximum = t.value);
|
|
@@ -1208,7 +1208,7 @@ const wo = (e) => {
|
|
|
1208
1208
|
};
|
|
1209
1209
|
}), Ft = /* @__PURE__ */ m("$ZodCheckGreaterThan", (e, t) => {
|
|
1210
1210
|
O.init(e, t);
|
|
1211
|
-
const n =
|
|
1211
|
+
const n = Dt[typeof t.value];
|
|
1212
1212
|
e._zod.onattach.push((o) => {
|
|
1213
1213
|
const i = o._zod.bag, a = (t.inclusive ? i.minimum : i.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1214
1214
|
t.value > a && (t.inclusive ? i.minimum = t.value : i.exclusiveMinimum = t.value);
|
|
@@ -1223,14 +1223,14 @@ const wo = (e) => {
|
|
|
1223
1223
|
continue: !t.abort
|
|
1224
1224
|
});
|
|
1225
1225
|
};
|
|
1226
|
-
}),
|
|
1226
|
+
}), zo = /* @__PURE__ */ m("$ZodCheckMultipleOf", (e, t) => {
|
|
1227
1227
|
O.init(e, t), e._zod.onattach.push((n) => {
|
|
1228
1228
|
var o;
|
|
1229
1229
|
(o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value);
|
|
1230
1230
|
}), e._zod.check = (n) => {
|
|
1231
1231
|
if (typeof n.value != typeof t.value)
|
|
1232
1232
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1233
|
-
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) :
|
|
1233
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : $n(n.value, t.value) === 0) || n.issues.push({
|
|
1234
1234
|
origin: typeof n.value,
|
|
1235
1235
|
code: "not_multiple_of",
|
|
1236
1236
|
divisor: t.value,
|
|
@@ -1239,12 +1239,12 @@ const wo = (e) => {
|
|
|
1239
1239
|
continue: !t.abort
|
|
1240
1240
|
});
|
|
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", [i, a] =
|
|
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 = i, l.maximum = a, n && (l.pattern =
|
|
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) {
|
|
@@ -1296,11 +1296,11 @@ const wo = (e) => {
|
|
|
1296
1296
|
inst: e
|
|
1297
1297
|
});
|
|
1298
1298
|
};
|
|
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
1302
|
const i = o.value;
|
|
1303
|
-
return !
|
|
1303
|
+
return !je(i) && i.length !== void 0;
|
|
1304
1304
|
}), e._zod.onattach.push((o) => {
|
|
1305
1305
|
const i = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1306
1306
|
t.maximum < i && (o._zod.bag.maximum = t.maximum);
|
|
@@ -1308,7 +1308,7 @@ const wo = (e) => {
|
|
|
1308
1308
|
const i = o.value;
|
|
1309
1309
|
if (i.length <= t.maximum)
|
|
1310
1310
|
return;
|
|
1311
|
-
const c =
|
|
1311
|
+
const c = De(i);
|
|
1312
1312
|
o.issues.push({
|
|
1313
1313
|
origin: c,
|
|
1314
1314
|
code: "too_big",
|
|
@@ -1319,11 +1319,11 @@ const wo = (e) => {
|
|
|
1319
1319
|
continue: !t.abort
|
|
1320
1320
|
});
|
|
1321
1321
|
};
|
|
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
1325
|
const i = o.value;
|
|
1326
|
-
return !
|
|
1326
|
+
return !je(i) && i.length !== void 0;
|
|
1327
1327
|
}), e._zod.onattach.push((o) => {
|
|
1328
1328
|
const i = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1329
1329
|
t.minimum > i && (o._zod.bag.minimum = t.minimum);
|
|
@@ -1331,7 +1331,7 @@ const wo = (e) => {
|
|
|
1331
1331
|
const i = o.value;
|
|
1332
1332
|
if (i.length >= t.minimum)
|
|
1333
1333
|
return;
|
|
1334
|
-
const c =
|
|
1334
|
+
const c = De(i);
|
|
1335
1335
|
o.issues.push({
|
|
1336
1336
|
origin: c,
|
|
1337
1337
|
code: "too_small",
|
|
@@ -1342,11 +1342,11 @@ const wo = (e) => {
|
|
|
1342
1342
|
continue: !t.abort
|
|
1343
1343
|
});
|
|
1344
1344
|
};
|
|
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
1348
|
const i = o.value;
|
|
1349
|
-
return !
|
|
1349
|
+
return !je(i) && i.length !== void 0;
|
|
1350
1350
|
}), e._zod.onattach.push((o) => {
|
|
1351
1351
|
const i = o._zod.bag;
|
|
1352
1352
|
i.minimum = t.length, i.maximum = t.length, i.length = t.length;
|
|
@@ -1354,7 +1354,7 @@ const wo = (e) => {
|
|
|
1354
1354
|
const i = o.value, a = i.length;
|
|
1355
1355
|
if (a === t.length)
|
|
1356
1356
|
return;
|
|
1357
|
-
const c =
|
|
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 },
|
|
@@ -1382,7 +1382,7 @@ const wo = (e) => {
|
|
|
1382
1382
|
});
|
|
1383
1383
|
}) : (o = e._zod).check ?? (o.check = () => {
|
|
1384
1384
|
});
|
|
1385
|
-
}),
|
|
1385
|
+
}), Po = /* @__PURE__ */ m("$ZodCheckRegex", (e, t) => {
|
|
1386
1386
|
ye.init(e, t), e._zod.check = (n) => {
|
|
1387
1387
|
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1388
1388
|
origin: "string",
|
|
@@ -1394,11 +1394,11 @@ const wo = (e) => {
|
|
|
1394
1394
|
continue: !t.abort
|
|
1395
1395
|
});
|
|
1396
1396
|
};
|
|
1397
|
-
}),
|
|
1398
|
-
t.pattern ?? (t.pattern =
|
|
1399
|
-
}),
|
|
1397
|
+
}), xo = /* @__PURE__ */ m("$ZodCheckLowerCase", (e, t) => {
|
|
1398
|
+
t.pattern ?? (t.pattern = To), ye.init(e, t);
|
|
1399
|
+
}), Lo = /* @__PURE__ */ m("$ZodCheckUpperCase", (e, t) => {
|
|
1400
1400
|
t.pattern ?? (t.pattern = So), ye.init(e, t);
|
|
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
1404
|
t.pattern = o, e._zod.onattach.push((i) => {
|
|
@@ -1415,7 +1415,7 @@ const wo = (e) => {
|
|
|
1415
1415
|
continue: !t.abort
|
|
1416
1416
|
});
|
|
1417
1417
|
};
|
|
1418
|
-
}),
|
|
1418
|
+
}), jo = /* @__PURE__ */ m("$ZodCheckStartsWith", (e, t) => {
|
|
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) => {
|
|
@@ -1432,7 +1432,7 @@ const wo = (e) => {
|
|
|
1432
1432
|
continue: !t.abort
|
|
1433
1433
|
});
|
|
1434
1434
|
};
|
|
1435
|
-
}),
|
|
1435
|
+
}), No = /* @__PURE__ */ m("$ZodCheckEndsWith", (e, t) => {
|
|
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) => {
|
|
@@ -1449,12 +1449,12 @@ const wo = (e) => {
|
|
|
1449
1449
|
continue: !t.abort
|
|
1450
1450
|
});
|
|
1451
1451
|
};
|
|
1452
|
-
}),
|
|
1452
|
+
}), Do = /* @__PURE__ */ m("$ZodCheckOverwrite", (e, t) => {
|
|
1453
1453
|
O.init(e, t), e._zod.check = (n) => {
|
|
1454
1454
|
n.value = t.tx(n.value);
|
|
1455
1455
|
};
|
|
1456
1456
|
});
|
|
1457
|
-
class
|
|
1457
|
+
class Uo {
|
|
1458
1458
|
constructor(t = []) {
|
|
1459
1459
|
this.content = [], this.indent = 0, this && (this.args = t);
|
|
1460
1460
|
}
|
|
@@ -1494,7 +1494,7 @@ const Fo = {
|
|
|
1494
1494
|
e._zod.run = e._zod.parse;
|
|
1495
1495
|
});
|
|
1496
1496
|
else {
|
|
1497
|
-
const i = (c, l,
|
|
1497
|
+
const i = (c, l, d) => {
|
|
1498
1498
|
let f = q(c), y;
|
|
1499
1499
|
for (const g of l) {
|
|
1500
1500
|
if (g._zod.def.when) {
|
|
@@ -1503,7 +1503,7 @@ const Fo = {
|
|
|
1503
1503
|
} else if (f)
|
|
1504
1504
|
continue;
|
|
1505
1505
|
const r = c.issues.length, s = g._zod.check(c);
|
|
1506
|
-
if (s instanceof Promise &&
|
|
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 () => {
|
|
@@ -1516,16 +1516,16 @@ const Fo = {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
return y ? y.then(() => c) : c;
|
|
1519
|
-
}, a = (c, l,
|
|
1519
|
+
}, a = (c, l, d) => {
|
|
1520
1520
|
if (q(c))
|
|
1521
1521
|
return c.aborted = !0, c;
|
|
1522
|
-
const f = i(l, o,
|
|
1522
|
+
const f = i(l, o, d);
|
|
1523
1523
|
if (f instanceof Promise) {
|
|
1524
|
-
if (
|
|
1524
|
+
if (d.async === !1)
|
|
1525
1525
|
throw new K();
|
|
1526
|
-
return f.then((y) => e._zod.parse(y,
|
|
1526
|
+
return f.then((y) => e._zod.parse(y, d));
|
|
1527
1527
|
}
|
|
1528
|
-
return e._zod.parse(f,
|
|
1528
|
+
return e._zod.parse(f, d);
|
|
1529
1529
|
};
|
|
1530
1530
|
e._zod.run = (c, l) => {
|
|
1531
1531
|
if (l.skipChecks)
|
|
@@ -1534,29 +1534,29 @@ const Fo = {
|
|
|
1534
1534
|
const f = e._zod.parse({ value: c.value, issues: [] }, { ...l, skipChecks: !0 });
|
|
1535
1535
|
return f instanceof Promise ? f.then((y) => a(y, c, l)) : a(f, c, l);
|
|
1536
1536
|
}
|
|
1537
|
-
const
|
|
1538
|
-
if (
|
|
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
|
|
1541
|
+
return d.then((f) => i(f, o, l));
|
|
1542
1542
|
}
|
|
1543
|
-
return i(
|
|
1543
|
+
return i(d, o, l);
|
|
1544
1544
|
};
|
|
1545
1545
|
}
|
|
1546
1546
|
e["~standard"] = {
|
|
1547
1547
|
validate: (i) => {
|
|
1548
1548
|
try {
|
|
1549
|
-
const a =
|
|
1549
|
+
const a = Gn(e, i);
|
|
1550
1550
|
return a.success ? { value: a.data } : { issues: a.error?.issues };
|
|
1551
1551
|
} catch {
|
|
1552
|
-
return
|
|
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
|
-
}),
|
|
1559
|
-
A.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ??
|
|
1558
|
+
}), Me = /* @__PURE__ */ m("$ZodString", (e, t) => {
|
|
1559
|
+
A.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Eo(e._zod.bag), e._zod.parse = (n, o) => {
|
|
1560
1560
|
if (t.coerce)
|
|
1561
1561
|
try {
|
|
1562
1562
|
n.value = String(n.value);
|
|
@@ -1570,10 +1570,10 @@ const Fo = {
|
|
|
1570
1570
|
}), n;
|
|
1571
1571
|
};
|
|
1572
1572
|
}), z = /* @__PURE__ */ m("$ZodStringFormat", (e, t) => {
|
|
1573
|
-
ye.init(e, t),
|
|
1573
|
+
ye.init(e, t), Me.init(e, t);
|
|
1574
1574
|
}), Mo = /* @__PURE__ */ m("$ZodGUID", (e, t) => {
|
|
1575
|
-
t.pattern ?? (t.pattern =
|
|
1576
|
-
}),
|
|
1575
|
+
t.pattern ?? (t.pattern = uo), z.init(e, t);
|
|
1576
|
+
}), Vo = /* @__PURE__ */ m("$ZodUUID", (e, t) => {
|
|
1577
1577
|
if (t.version) {
|
|
1578
1578
|
const o = {
|
|
1579
1579
|
v1: 1,
|
|
@@ -1587,13 +1587,13 @@ const Fo = {
|
|
|
1587
1587
|
}[t.version];
|
|
1588
1588
|
if (o === void 0)
|
|
1589
1589
|
throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
1590
|
-
t.pattern ?? (t.pattern =
|
|
1590
|
+
t.pattern ?? (t.pattern = Qe(o));
|
|
1591
1591
|
} else
|
|
1592
|
-
t.pattern ?? (t.pattern =
|
|
1592
|
+
t.pattern ?? (t.pattern = Qe());
|
|
1593
1593
|
z.init(e, t);
|
|
1594
|
-
}),
|
|
1595
|
-
t.pattern ?? (t.pattern =
|
|
1596
|
-
}),
|
|
1594
|
+
}), Bo = /* @__PURE__ */ m("$ZodEmail", (e, t) => {
|
|
1595
|
+
t.pattern ?? (t.pattern = co), z.init(e, t);
|
|
1596
|
+
}), Go = /* @__PURE__ */ m("$ZodURL", (e, t) => {
|
|
1597
1597
|
z.init(e, t), e._zod.check = (n) => {
|
|
1598
1598
|
try {
|
|
1599
1599
|
const o = n.value.trim(), i = new URL(o);
|
|
@@ -1625,32 +1625,32 @@ const Fo = {
|
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
1627
|
};
|
|
1628
|
-
}),
|
|
1629
|
-
t.pattern ?? (t.pattern =
|
|
1630
|
-
}),
|
|
1631
|
-
t.pattern ?? (t.pattern =
|
|
1632
|
-
}),
|
|
1633
|
-
t.pattern ?? (t.pattern = eo), z.init(e, t);
|
|
1634
|
-
}), Ko = /* @__PURE__ */ m("$ZodCUID2", (e, t) => {
|
|
1628
|
+
}), Wo = /* @__PURE__ */ m("$ZodEmoji", (e, t) => {
|
|
1629
|
+
t.pattern ?? (t.pattern = po()), z.init(e, t);
|
|
1630
|
+
}), qo = /* @__PURE__ */ m("$ZodNanoID", (e, t) => {
|
|
1631
|
+
t.pattern ?? (t.pattern = so), z.init(e, t);
|
|
1632
|
+
}), Ko = /* @__PURE__ */ m("$ZodCUID", (e, t) => {
|
|
1635
1633
|
t.pattern ?? (t.pattern = to), z.init(e, t);
|
|
1636
|
-
}), Ho = /* @__PURE__ */ m("$
|
|
1634
|
+
}), Ho = /* @__PURE__ */ m("$ZodCUID2", (e, t) => {
|
|
1637
1635
|
t.pattern ?? (t.pattern = no), z.init(e, t);
|
|
1638
|
-
}), Jo = /* @__PURE__ */ m("$
|
|
1636
|
+
}), Jo = /* @__PURE__ */ m("$ZodULID", (e, t) => {
|
|
1639
1637
|
t.pattern ?? (t.pattern = oo), z.init(e, t);
|
|
1640
|
-
}), Yo = /* @__PURE__ */ m("$
|
|
1638
|
+
}), Yo = /* @__PURE__ */ m("$ZodXID", (e, t) => {
|
|
1641
1639
|
t.pattern ?? (t.pattern = ro), z.init(e, t);
|
|
1642
|
-
}), Qo = /* @__PURE__ */ m("$
|
|
1640
|
+
}), Qo = /* @__PURE__ */ m("$ZodKSUID", (e, t) => {
|
|
1641
|
+
t.pattern ?? (t.pattern = io), z.init(e, t);
|
|
1642
|
+
}), Xo = /* @__PURE__ */ m("$ZodISODateTime", (e, t) => {
|
|
1643
|
+
t.pattern ?? (t.pattern = wo(t)), z.init(e, t);
|
|
1644
|
+
}), er = /* @__PURE__ */ m("$ZodISODate", (e, t) => {
|
|
1645
|
+
t.pattern ?? (t.pattern = yo), z.init(e, t);
|
|
1646
|
+
}), tr = /* @__PURE__ */ m("$ZodISOTime", (e, t) => {
|
|
1643
1647
|
t.pattern ?? (t.pattern = bo(t)), z.init(e, t);
|
|
1644
|
-
}),
|
|
1645
|
-
t.pattern ?? (t.pattern =
|
|
1646
|
-
}),
|
|
1647
|
-
t.pattern ?? (t.pattern =
|
|
1648
|
-
}),
|
|
1649
|
-
t.pattern ?? (t.pattern =
|
|
1650
|
-
}), nr = /* @__PURE__ */ m("$ZodIPv4", (e, t) => {
|
|
1651
|
-
t.pattern ?? (t.pattern = po), z.init(e, t), e._zod.bag.format = "ipv4";
|
|
1652
|
-
}), or = /* @__PURE__ */ m("$ZodIPv6", (e, t) => {
|
|
1653
|
-
t.pattern ?? (t.pattern = ho), z.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
|
|
1648
|
+
}), nr = /* @__PURE__ */ m("$ZodISODuration", (e, t) => {
|
|
1649
|
+
t.pattern ?? (t.pattern = ao), z.init(e, t);
|
|
1650
|
+
}), or = /* @__PURE__ */ m("$ZodIPv4", (e, t) => {
|
|
1651
|
+
t.pattern ?? (t.pattern = ho), z.init(e, t), e._zod.bag.format = "ipv4";
|
|
1652
|
+
}), rr = /* @__PURE__ */ m("$ZodIPv6", (e, t) => {
|
|
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}]`);
|
|
1656
1656
|
} catch {
|
|
@@ -1663,10 +1663,10 @@ const Fo = {
|
|
|
1663
1663
|
});
|
|
1664
1664
|
}
|
|
1665
1665
|
};
|
|
1666
|
-
}),
|
|
1667
|
-
t.pattern ?? (t.pattern =
|
|
1668
|
-
}),
|
|
1669
|
-
t.pattern ?? (t.pattern =
|
|
1666
|
+
}), ir = /* @__PURE__ */ m("$ZodCIDRv4", (e, t) => {
|
|
1667
|
+
t.pattern ?? (t.pattern = _o), z.init(e, t);
|
|
1668
|
+
}), sr = /* @__PURE__ */ m("$ZodCIDRv6", (e, t) => {
|
|
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)
|
|
@@ -1702,8 +1702,8 @@ function Mt(e) {
|
|
|
1702
1702
|
return !1;
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
|
-
const
|
|
1706
|
-
t.pattern ?? (t.pattern =
|
|
1705
|
+
const ar = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
|
|
1706
|
+
t.pattern ?? (t.pattern = vo), z.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
|
|
1707
1707
|
Mt(n.value) || n.issues.push({
|
|
1708
1708
|
code: "invalid_format",
|
|
1709
1709
|
format: "base64",
|
|
@@ -1713,15 +1713,15 @@ const sr = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
|
|
|
1713
1713
|
});
|
|
1714
1714
|
};
|
|
1715
1715
|
});
|
|
1716
|
-
function
|
|
1717
|
-
if (!
|
|
1716
|
+
function ur(e) {
|
|
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
1720
|
return Mt(n);
|
|
1721
1721
|
}
|
|
1722
|
-
const
|
|
1723
|
-
t.pattern ?? (t.pattern =
|
|
1724
|
-
|
|
1722
|
+
const cr = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
|
|
1723
|
+
t.pattern ?? (t.pattern = Rt), z.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
|
|
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 ur = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
|
|
|
1729
1729
|
continue: !t.abort
|
|
1730
1730
|
});
|
|
1731
1731
|
};
|
|
1732
|
-
}),
|
|
1733
|
-
t.pattern ?? (t.pattern =
|
|
1732
|
+
}), lr = /* @__PURE__ */ m("$ZodE164", (e, t) => {
|
|
1733
|
+
t.pattern ?? (t.pattern = go), z.init(e, t);
|
|
1734
1734
|
});
|
|
1735
|
-
function
|
|
1735
|
+
function dr(e, t = null) {
|
|
1736
1736
|
try {
|
|
1737
1737
|
const n = e.split(".");
|
|
1738
1738
|
if (n.length !== 3)
|
|
@@ -1746,9 +1746,9 @@ function lr(e, t = null) {
|
|
|
1746
1746
|
return !1;
|
|
1747
1747
|
}
|
|
1748
1748
|
}
|
|
1749
|
-
const
|
|
1749
|
+
const pr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
1750
1750
|
z.init(e, t), e._zod.check = (n) => {
|
|
1751
|
-
|
|
1751
|
+
dr(n.value, t.alg) || n.issues.push({
|
|
1752
1752
|
code: "invalid_format",
|
|
1753
1753
|
format: "jwt",
|
|
1754
1754
|
input: n.value,
|
|
@@ -1756,8 +1756,8 @@ const dr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1756
1756
|
continue: !t.abort
|
|
1757
1757
|
});
|
|
1758
1758
|
};
|
|
1759
|
-
}),
|
|
1760
|
-
A.init(e, t), e._zod.pattern = e._zod.bag.pattern ??
|
|
1759
|
+
}), Vt = /* @__PURE__ */ m("$ZodNumber", (e, t) => {
|
|
1760
|
+
A.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Co, e._zod.parse = (n, o) => {
|
|
1761
1761
|
if (t.coerce)
|
|
1762
1762
|
try {
|
|
1763
1763
|
n.value = Number(n.value);
|
|
@@ -1775,10 +1775,10 @@ const dr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1775
1775
|
...a ? { received: a } : {}
|
|
1776
1776
|
}), n;
|
|
1777
1777
|
};
|
|
1778
|
-
}),
|
|
1779
|
-
|
|
1780
|
-
}),
|
|
1781
|
-
A.init(e, t), e._zod.pattern =
|
|
1778
|
+
}), hr = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
|
|
1779
|
+
Io.init(e, t), Vt.init(e, t);
|
|
1780
|
+
}), fr = /* @__PURE__ */ m("$ZodNull", (e, t) => {
|
|
1781
|
+
A.init(e, t), e._zod.pattern = Ao, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (n, o) => {
|
|
1782
1782
|
const i = n.value;
|
|
1783
1783
|
return i === null || n.issues.push({
|
|
1784
1784
|
expected: "null",
|
|
@@ -1787,9 +1787,9 @@ const dr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1787
1787
|
inst: e
|
|
1788
1788
|
}), n;
|
|
1789
1789
|
};
|
|
1790
|
-
}),
|
|
1790
|
+
}), _r = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
|
|
1791
1791
|
A.init(e, t), e._zod.parse = (n) => n;
|
|
1792
|
-
}),
|
|
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",
|
|
@@ -1797,10 +1797,10 @@ const dr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1797
1797
|
inst: e
|
|
1798
1798
|
}), n);
|
|
1799
1799
|
});
|
|
1800
|
-
function
|
|
1801
|
-
e.issues.length && t.issues.push(...
|
|
1800
|
+
function Xe(e, t, n) {
|
|
1801
|
+
e.issues.length && t.issues.push(...M(n, e.issues)), t.value[n] = e.value;
|
|
1802
1802
|
}
|
|
1803
|
-
const
|
|
1803
|
+
const vr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
|
|
1804
1804
|
A.init(e, t), e._zod.parse = (n, o) => {
|
|
1805
1805
|
const i = n.value;
|
|
1806
1806
|
if (!Array.isArray(i))
|
|
@@ -1813,24 +1813,24 @@ const mr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
|
|
|
1813
1813
|
n.value = Array(i.length);
|
|
1814
1814
|
const a = [];
|
|
1815
1815
|
for (let c = 0; c < i.length; c++) {
|
|
1816
|
-
const l = i[c],
|
|
1816
|
+
const l = i[c], d = t.element._zod.run({
|
|
1817
1817
|
value: l,
|
|
1818
1818
|
issues: []
|
|
1819
1819
|
}, o);
|
|
1820
|
-
|
|
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(...
|
|
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
|
-
function
|
|
1828
|
+
function Bt(e) {
|
|
1829
1829
|
const t = Object.keys(e.shape);
|
|
1830
1830
|
for (const o of t)
|
|
1831
1831
|
if (!e.shape?.[o]?._zod?.traits?.has("$ZodType"))
|
|
1832
1832
|
throw new Error(`Invalid element at key "${o}": expected a Zod schema`);
|
|
1833
|
-
const n =
|
|
1833
|
+
const n = xn(e.shape);
|
|
1834
1834
|
return {
|
|
1835
1835
|
...e,
|
|
1836
1836
|
keys: t,
|
|
@@ -1839,8 +1839,8 @@ function Vt(e) {
|
|
|
1839
1839
|
optionalKeys: new Set(n)
|
|
1840
1840
|
};
|
|
1841
1841
|
}
|
|
1842
|
-
function
|
|
1843
|
-
const c = [], l = i.keySet,
|
|
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;
|
|
@@ -1848,7 +1848,7 @@ function Bt(e, t, n, o, i, a) {
|
|
|
1848
1848
|
c.push(y);
|
|
1849
1849
|
continue;
|
|
1850
1850
|
}
|
|
1851
|
-
const g =
|
|
1851
|
+
const g = d.run({ value: t[y], issues: [] }, o);
|
|
1852
1852
|
g instanceof Promise ? e.push(g.then((r) => fe(r, n, y, t))) : fe(g, n, y, t);
|
|
1853
1853
|
}
|
|
1854
1854
|
return c.length && n.issues.push({
|
|
@@ -1858,34 +1858,34 @@ function Bt(e, t, n, o, i, a) {
|
|
|
1858
1858
|
inst: a
|
|
1859
1859
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1860
1860
|
}
|
|
1861
|
-
const
|
|
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
|
|
1866
|
+
const d = { ...l };
|
|
1867
1867
|
return Object.defineProperty(t, "shape", {
|
|
1868
|
-
value:
|
|
1869
|
-
}),
|
|
1868
|
+
value: d
|
|
1869
|
+
}), d;
|
|
1870
1870
|
}
|
|
1871
1871
|
});
|
|
1872
1872
|
}
|
|
1873
|
-
const o =
|
|
1873
|
+
const o = Re(() => Bt(t));
|
|
1874
1874
|
C(e._zod, "propValues", () => {
|
|
1875
|
-
const l = t.shape,
|
|
1875
|
+
const l = t.shape, d = {};
|
|
1876
1876
|
for (const f in l) {
|
|
1877
1877
|
const y = l[f]._zod;
|
|
1878
1878
|
if (y.values) {
|
|
1879
|
-
|
|
1879
|
+
d[f] ?? (d[f] = /* @__PURE__ */ new Set());
|
|
1880
1880
|
for (const g of y.values)
|
|
1881
|
-
|
|
1881
|
+
d[f].add(g);
|
|
1882
1882
|
}
|
|
1883
1883
|
}
|
|
1884
|
-
return
|
|
1884
|
+
return d;
|
|
1885
1885
|
});
|
|
1886
1886
|
const i = he, a = t.catchall;
|
|
1887
1887
|
let c;
|
|
1888
|
-
e._zod.parse = (l,
|
|
1888
|
+
e._zod.parse = (l, d) => {
|
|
1889
1889
|
c ?? (c = o.value);
|
|
1890
1890
|
const f = l.value;
|
|
1891
1891
|
if (!i(f))
|
|
@@ -1898,16 +1898,16 @@ const vr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1898
1898
|
l.value = {};
|
|
1899
1899
|
const y = [], g = c.shape;
|
|
1900
1900
|
for (const r of c.keys) {
|
|
1901
|
-
const u = g[r]._zod.run({ value: f[r], issues: [] },
|
|
1902
|
-
u instanceof Promise ? y.push(u.then((
|
|
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 ?
|
|
1904
|
+
return a ? Gt(y, f, l, d, o.value, e) : y.length ? Promise.all(y).then(() => l) : l;
|
|
1905
1905
|
};
|
|
1906
|
-
}),
|
|
1907
|
-
|
|
1908
|
-
const n = e._zod.parse, o =
|
|
1909
|
-
const s = new
|
|
1910
|
-
const E =
|
|
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
|
+
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;");
|
|
@@ -1917,8 +1917,8 @@ const vr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1917
1917
|
h[w] = `key_${v++}`;
|
|
1918
1918
|
s.write("const newResult = {};");
|
|
1919
1919
|
for (const w of u.keys) {
|
|
1920
|
-
const E = h[w], k =
|
|
1921
|
-
s.write(`const ${E} = ${
|
|
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,
|
|
@@ -1942,12 +1942,12 @@ const vr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1942
1942
|
return (w, E) => _(r, w, E);
|
|
1943
1943
|
};
|
|
1944
1944
|
let a;
|
|
1945
|
-
const c = he, l =
|
|
1945
|
+
const c = he, l = !$t.jitless, f = l && Zn.value, y = t.catchall;
|
|
1946
1946
|
let g;
|
|
1947
1947
|
e._zod.parse = (r, s) => {
|
|
1948
1948
|
g ?? (g = o.value);
|
|
1949
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 ?
|
|
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,
|
|
@@ -1955,7 +1955,7 @@ const vr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1955
1955
|
}), r);
|
|
1956
1956
|
};
|
|
1957
1957
|
});
|
|
1958
|
-
function
|
|
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;
|
|
@@ -1967,14 +1967,14 @@ function Xe(e, t, n, o) {
|
|
|
1967
1967
|
errors: e.map((a) => a.issues.map((c) => N(c, o, j())))
|
|
1968
1968
|
}), t);
|
|
1969
1969
|
}
|
|
1970
|
-
const
|
|
1970
|
+
const br = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
1971
1971
|
A.init(e, t), C(e._zod, "optin", () => t.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), C(e._zod, "optout", () => t.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), C(e._zod, "values", () => {
|
|
1972
1972
|
if (t.options.every((i) => i._zod.values))
|
|
1973
1973
|
return new Set(t.options.flatMap((i) => Array.from(i._zod.values)));
|
|
1974
1974
|
}), C(e._zod, "pattern", () => {
|
|
1975
1975
|
if (t.options.every((i) => i._zod.pattern)) {
|
|
1976
1976
|
const i = t.options.map((a) => a._zod.pattern);
|
|
1977
|
-
return new RegExp(`^(${i.map((a) =>
|
|
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;
|
|
@@ -1983,8 +1983,8 @@ const yr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
|
1983
1983
|
return o(i, a);
|
|
1984
1984
|
let c = !1;
|
|
1985
1985
|
const l = [];
|
|
1986
|
-
for (const
|
|
1987
|
-
const f =
|
|
1986
|
+
for (const d of t.options) {
|
|
1987
|
+
const f = d._zod.run({
|
|
1988
1988
|
value: i.value,
|
|
1989
1989
|
issues: []
|
|
1990
1990
|
}, a);
|
|
@@ -1996,15 +1996,15 @@ const yr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
|
1996
1996
|
l.push(f);
|
|
1997
1997
|
}
|
|
1998
1998
|
}
|
|
1999
|
-
return c ? Promise.all(l).then((
|
|
1999
|
+
return c ? Promise.all(l).then((d) => et(d, i, e, a)) : et(l, i, e, a);
|
|
2000
2000
|
};
|
|
2001
|
-
}),
|
|
2001
|
+
}), wr = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
|
|
2002
2002
|
A.init(e, t), e._zod.parse = (n, o) => {
|
|
2003
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(([
|
|
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
|
-
function
|
|
2007
|
+
function Pe(e, t) {
|
|
2008
2008
|
if (e === t)
|
|
2009
2009
|
return { valid: !0, data: e };
|
|
2010
2010
|
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
@@ -2012,7 +2012,7 @@ function Oe(e, t) {
|
|
|
2012
2012
|
if (H(e) && H(t)) {
|
|
2013
2013
|
const n = Object.keys(t), o = Object.keys(e).filter((a) => n.indexOf(a) !== -1), i = { ...e, ...t };
|
|
2014
2014
|
for (const a of o) {
|
|
2015
|
-
const c =
|
|
2015
|
+
const c = Pe(e[a], t[a]);
|
|
2016
2016
|
if (!c.valid)
|
|
2017
2017
|
return {
|
|
2018
2018
|
valid: !1,
|
|
@@ -2027,7 +2027,7 @@ function Oe(e, t) {
|
|
|
2027
2027
|
return { valid: !1, mergeErrorPath: [] };
|
|
2028
2028
|
const n = [];
|
|
2029
2029
|
for (let o = 0; o < e.length; o++) {
|
|
2030
|
-
const i = e[o], a = t[o], c =
|
|
2030
|
+
const i = e[o], a = t[o], c = Pe(i, a);
|
|
2031
2031
|
if (!c.valid)
|
|
2032
2032
|
return {
|
|
2033
2033
|
valid: !1,
|
|
@@ -2039,15 +2039,15 @@ function Oe(e, t) {
|
|
|
2039
2039
|
}
|
|
2040
2040
|
return { valid: !1, mergeErrorPath: [] };
|
|
2041
2041
|
}
|
|
2042
|
-
function
|
|
2042
|
+
function tt(e, t, n) {
|
|
2043
2043
|
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), q(e))
|
|
2044
2044
|
return e;
|
|
2045
|
-
const o =
|
|
2045
|
+
const o = Pe(t.value, n.value);
|
|
2046
2046
|
if (!o.valid)
|
|
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
|
|
2050
|
+
const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
2051
2051
|
A.init(e, t);
|
|
2052
2052
|
const n = t.items;
|
|
2053
2053
|
e._zod.parse = (o, i) => {
|
|
@@ -2060,9 +2060,9 @@ const wr = /* @__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"),
|
|
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 <
|
|
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 },
|
|
@@ -2073,7 +2073,7 @@ const wr = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
|
2073
2073
|
}
|
|
2074
2074
|
let f = -1;
|
|
2075
2075
|
for (const y of n) {
|
|
2076
|
-
if (f++, f >= a.length && f >=
|
|
2076
|
+
if (f++, f >= a.length && f >= d)
|
|
2077
2077
|
continue;
|
|
2078
2078
|
const g = y._zod.run({
|
|
2079
2079
|
value: a[f],
|
|
@@ -2096,9 +2096,9 @@ const wr = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
|
2096
2096
|
};
|
|
2097
2097
|
});
|
|
2098
2098
|
function ue(e, t, n) {
|
|
2099
|
-
e.issues.length && t.issues.push(...
|
|
2099
|
+
e.issues.length && t.issues.push(...M(n, e.issues)), t.value[n] = e.value;
|
|
2100
2100
|
}
|
|
2101
|
-
const
|
|
2101
|
+
const kr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
2102
2102
|
A.init(e, t), e._zod.parse = (n, o) => {
|
|
2103
2103
|
const i = n.value;
|
|
2104
2104
|
if (!H(i))
|
|
@@ -2117,49 +2117,49 @@ const Er = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2117
2117
|
l.add(typeof f == "number" ? f.toString() : f);
|
|
2118
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(...
|
|
2121
|
-
})) : (y.issues.length && n.issues.push(...
|
|
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
|
|
2123
|
+
let d;
|
|
2124
2124
|
for (const f in i)
|
|
2125
|
-
l.has(f) || (
|
|
2126
|
-
|
|
2125
|
+
l.has(f) || (d = d ?? [], d.push(f));
|
|
2126
|
+
d && d.length > 0 && n.issues.push({
|
|
2127
2127
|
code: "unrecognized_keys",
|
|
2128
2128
|
input: i,
|
|
2129
2129
|
inst: e,
|
|
2130
|
-
keys:
|
|
2130
|
+
keys: d
|
|
2131
2131
|
});
|
|
2132
2132
|
} else {
|
|
2133
2133
|
n.value = {};
|
|
2134
2134
|
for (const l of Reflect.ownKeys(i)) {
|
|
2135
2135
|
if (l === "__proto__")
|
|
2136
2136
|
continue;
|
|
2137
|
-
const
|
|
2138
|
-
if (
|
|
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 (
|
|
2140
|
+
if (d.issues.length) {
|
|
2141
2141
|
n.issues.push({
|
|
2142
2142
|
code: "invalid_key",
|
|
2143
2143
|
origin: "record",
|
|
2144
|
-
issues:
|
|
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[
|
|
2148
|
+
}), n.value[d.value] = d.value;
|
|
2149
2149
|
continue;
|
|
2150
2150
|
}
|
|
2151
2151
|
const f = t.valueType._zod.run({ value: i[l], issues: [] }, o);
|
|
2152
2152
|
f instanceof Promise ? a.push(f.then((y) => {
|
|
2153
|
-
y.issues.length && n.issues.push(...
|
|
2154
|
-
})) : (f.issues.length && n.issues.push(...
|
|
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
|
-
}),
|
|
2159
|
+
}), Cr = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
|
|
2160
2160
|
A.init(e, t);
|
|
2161
|
-
const n =
|
|
2162
|
-
e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) =>
|
|
2161
|
+
const n = In(t.entries), o = new Set(n);
|
|
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
2163
|
const c = i.value;
|
|
2164
2164
|
return o.has(c) || i.issues.push({
|
|
2165
2165
|
code: "invalid_value",
|
|
@@ -2168,7 +2168,7 @@ const Er = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2168
2168
|
inst: e
|
|
2169
2169
|
}), i;
|
|
2170
2170
|
};
|
|
2171
|
-
}),
|
|
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);
|
|
@@ -2181,10 +2181,10 @@ const Er = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2181
2181
|
inst: e
|
|
2182
2182
|
}), o;
|
|
2183
2183
|
};
|
|
2184
|
-
}),
|
|
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
|
-
throw new
|
|
2187
|
+
throw new It(e.constructor.name);
|
|
2188
2188
|
const i = t.transform(n.value, n);
|
|
2189
2189
|
if (o.async)
|
|
2190
2190
|
return (i instanceof Promise ? i : Promise.resolve(i)).then((c) => (n.value = c, n));
|
|
@@ -2193,50 +2193,50 @@ const Er = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2193
2193
|
return n.value = i, n;
|
|
2194
2194
|
};
|
|
2195
2195
|
});
|
|
2196
|
-
function
|
|
2196
|
+
function nt(e, t) {
|
|
2197
2197
|
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
2198
2198
|
}
|
|
2199
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
|
-
return n ? new RegExp(`^(${
|
|
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
2205
|
const i = t.innerType._zod.run(n, o);
|
|
2206
|
-
return i instanceof Promise ? i.then((a) =>
|
|
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
|
-
}),
|
|
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
|
-
return n ? new RegExp(`^(${
|
|
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
|
-
}),
|
|
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
2221
|
const i = t.innerType._zod.run(n, o);
|
|
2222
|
-
return i instanceof Promise ? i.then((a) =>
|
|
2222
|
+
return i instanceof Promise ? i.then((a) => ot(a, t)) : ot(i, t);
|
|
2223
2223
|
};
|
|
2224
2224
|
});
|
|
2225
|
-
function
|
|
2225
|
+
function ot(e, t) {
|
|
2226
2226
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
2227
2227
|
}
|
|
2228
|
-
const
|
|
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
|
-
}),
|
|
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
2235
|
const i = t.innerType._zod.run(n, o);
|
|
2236
|
-
return i instanceof Promise ? i.then((a) =>
|
|
2236
|
+
return i instanceof Promise ? i.then((a) => rt(a, e)) : rt(i, e);
|
|
2237
2237
|
};
|
|
2238
2238
|
});
|
|
2239
|
-
function
|
|
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,7 +2244,7 @@ function ot(e, t) {
|
|
|
2244
2244
|
inst: t
|
|
2245
2245
|
}), e;
|
|
2246
2246
|
}
|
|
2247
|
-
const
|
|
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);
|
|
@@ -2263,7 +2263,7 @@ const Or = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
|
|
|
2263
2263
|
input: n.value
|
|
2264
2264
|
}), n.issues = []), n);
|
|
2265
2265
|
};
|
|
2266
|
-
}),
|
|
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);
|
|
@@ -2276,26 +2276,26 @@ const Or = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
|
|
|
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
|
|
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
2283
|
const i = t.innerType._zod.run(n, o);
|
|
2284
|
-
return i instanceof Promise ? i.then(
|
|
2284
|
+
return i instanceof Promise ? i.then(it) : it(i);
|
|
2285
2285
|
};
|
|
2286
2286
|
});
|
|
2287
|
-
function
|
|
2287
|
+
function it(e) {
|
|
2288
2288
|
return e.value = Object.freeze(e.value), e;
|
|
2289
2289
|
}
|
|
2290
|
-
const
|
|
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
2292
|
const o = n.value, i = t.fn(o);
|
|
2293
2293
|
if (i instanceof Promise)
|
|
2294
|
-
return i.then((a) =>
|
|
2295
|
-
|
|
2294
|
+
return i.then((a) => st(a, n, o, e));
|
|
2295
|
+
st(i, n, o, e);
|
|
2296
2296
|
};
|
|
2297
2297
|
});
|
|
2298
|
-
function
|
|
2298
|
+
function st(e, t, n, o) {
|
|
2299
2299
|
if (!e) {
|
|
2300
2300
|
const i = {
|
|
2301
2301
|
code: "custom",
|
|
@@ -2310,8 +2310,8 @@ function it(e, t, n, o) {
|
|
|
2310
2310
|
o._zod.def.params && (i.params = o._zod.def.params), t.issues.push(ie(i));
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
2313
|
-
var
|
|
2314
|
-
class
|
|
2313
|
+
var at;
|
|
2314
|
+
class Rr {
|
|
2315
2315
|
constructor() {
|
|
2316
2316
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
2317
2317
|
}
|
|
@@ -2345,18 +2345,18 @@ class Lr {
|
|
|
2345
2345
|
return this._map.has(t);
|
|
2346
2346
|
}
|
|
2347
2347
|
}
|
|
2348
|
-
function
|
|
2349
|
-
return new
|
|
2348
|
+
function jr() {
|
|
2349
|
+
return new Rr();
|
|
2350
2350
|
}
|
|
2351
|
-
(
|
|
2351
|
+
(at = globalThis).__zod_globalRegistry ?? (at.__zod_globalRegistry = jr());
|
|
2352
2352
|
const le = globalThis.__zod_globalRegistry;
|
|
2353
|
-
function
|
|
2353
|
+
function Nr(e, t) {
|
|
2354
2354
|
return new e({
|
|
2355
2355
|
type: "string",
|
|
2356
2356
|
...b(t)
|
|
2357
2357
|
});
|
|
2358
2358
|
}
|
|
2359
|
-
function
|
|
2359
|
+
function Dr(e, t) {
|
|
2360
2360
|
return new e({
|
|
2361
2361
|
type: "string",
|
|
2362
2362
|
format: "email",
|
|
@@ -2365,7 +2365,7 @@ function Nr(e, t) {
|
|
|
2365
2365
|
...b(t)
|
|
2366
2366
|
});
|
|
2367
2367
|
}
|
|
2368
|
-
function
|
|
2368
|
+
function ut(e, t) {
|
|
2369
2369
|
return new e({
|
|
2370
2370
|
type: "string",
|
|
2371
2371
|
format: "guid",
|
|
@@ -2374,7 +2374,7 @@ function at(e, t) {
|
|
|
2374
2374
|
...b(t)
|
|
2375
2375
|
});
|
|
2376
2376
|
}
|
|
2377
|
-
function
|
|
2377
|
+
function Ur(e, t) {
|
|
2378
2378
|
return new e({
|
|
2379
2379
|
type: "string",
|
|
2380
2380
|
format: "uuid",
|
|
@@ -2403,7 +2403,7 @@ function Mr(e, t) {
|
|
|
2403
2403
|
...b(t)
|
|
2404
2404
|
});
|
|
2405
2405
|
}
|
|
2406
|
-
function
|
|
2406
|
+
function Vr(e, t) {
|
|
2407
2407
|
return new e({
|
|
2408
2408
|
type: "string",
|
|
2409
2409
|
format: "uuid",
|
|
@@ -2413,7 +2413,7 @@ function Ur(e, t) {
|
|
|
2413
2413
|
...b(t)
|
|
2414
2414
|
});
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function Br(e, t) {
|
|
2417
2417
|
return new e({
|
|
2418
2418
|
type: "string",
|
|
2419
2419
|
format: "url",
|
|
@@ -2422,7 +2422,7 @@ function Vr(e, t) {
|
|
|
2422
2422
|
...b(t)
|
|
2423
2423
|
});
|
|
2424
2424
|
}
|
|
2425
|
-
function
|
|
2425
|
+
function Gr(e, t) {
|
|
2426
2426
|
return new e({
|
|
2427
2427
|
type: "string",
|
|
2428
2428
|
format: "emoji",
|
|
@@ -2431,7 +2431,7 @@ function Br(e, t) {
|
|
|
2431
2431
|
...b(t)
|
|
2432
2432
|
});
|
|
2433
2433
|
}
|
|
2434
|
-
function
|
|
2434
|
+
function Wr(e, t) {
|
|
2435
2435
|
return new e({
|
|
2436
2436
|
type: "string",
|
|
2437
2437
|
format: "nanoid",
|
|
@@ -2440,7 +2440,7 @@ function Gr(e, t) {
|
|
|
2440
2440
|
...b(t)
|
|
2441
2441
|
});
|
|
2442
2442
|
}
|
|
2443
|
-
function
|
|
2443
|
+
function qr(e, t) {
|
|
2444
2444
|
return new e({
|
|
2445
2445
|
type: "string",
|
|
2446
2446
|
format: "cuid",
|
|
@@ -2449,7 +2449,7 @@ function Wr(e, t) {
|
|
|
2449
2449
|
...b(t)
|
|
2450
2450
|
});
|
|
2451
2451
|
}
|
|
2452
|
-
function
|
|
2452
|
+
function Kr(e, t) {
|
|
2453
2453
|
return new e({
|
|
2454
2454
|
type: "string",
|
|
2455
2455
|
format: "cuid2",
|
|
@@ -2458,7 +2458,7 @@ function qr(e, t) {
|
|
|
2458
2458
|
...b(t)
|
|
2459
2459
|
});
|
|
2460
2460
|
}
|
|
2461
|
-
function
|
|
2461
|
+
function Hr(e, t) {
|
|
2462
2462
|
return new e({
|
|
2463
2463
|
type: "string",
|
|
2464
2464
|
format: "ulid",
|
|
@@ -2467,7 +2467,7 @@ function Kr(e, t) {
|
|
|
2467
2467
|
...b(t)
|
|
2468
2468
|
});
|
|
2469
2469
|
}
|
|
2470
|
-
function
|
|
2470
|
+
function Jr(e, t) {
|
|
2471
2471
|
return new e({
|
|
2472
2472
|
type: "string",
|
|
2473
2473
|
format: "xid",
|
|
@@ -2476,7 +2476,7 @@ function Hr(e, t) {
|
|
|
2476
2476
|
...b(t)
|
|
2477
2477
|
});
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2479
|
+
function Yr(e, t) {
|
|
2480
2480
|
return new e({
|
|
2481
2481
|
type: "string",
|
|
2482
2482
|
format: "ksuid",
|
|
@@ -2485,7 +2485,7 @@ function Jr(e, t) {
|
|
|
2485
2485
|
...b(t)
|
|
2486
2486
|
});
|
|
2487
2487
|
}
|
|
2488
|
-
function
|
|
2488
|
+
function Qr(e, t) {
|
|
2489
2489
|
return new e({
|
|
2490
2490
|
type: "string",
|
|
2491
2491
|
format: "ipv4",
|
|
@@ -2494,7 +2494,7 @@ function Yr(e, t) {
|
|
|
2494
2494
|
...b(t)
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
|
-
function
|
|
2497
|
+
function Xr(e, t) {
|
|
2498
2498
|
return new e({
|
|
2499
2499
|
type: "string",
|
|
2500
2500
|
format: "ipv6",
|
|
@@ -2503,7 +2503,7 @@ function Qr(e, t) {
|
|
|
2503
2503
|
...b(t)
|
|
2504
2504
|
});
|
|
2505
2505
|
}
|
|
2506
|
-
function
|
|
2506
|
+
function ei(e, t) {
|
|
2507
2507
|
return new e({
|
|
2508
2508
|
type: "string",
|
|
2509
2509
|
format: "cidrv4",
|
|
@@ -2512,7 +2512,7 @@ function Xr(e, t) {
|
|
|
2512
2512
|
...b(t)
|
|
2513
2513
|
});
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2515
|
+
function ti(e, t) {
|
|
2516
2516
|
return new e({
|
|
2517
2517
|
type: "string",
|
|
2518
2518
|
format: "cidrv6",
|
|
@@ -2521,7 +2521,7 @@ function ei(e, t) {
|
|
|
2521
2521
|
...b(t)
|
|
2522
2522
|
});
|
|
2523
2523
|
}
|
|
2524
|
-
function
|
|
2524
|
+
function ni(e, t) {
|
|
2525
2525
|
return new e({
|
|
2526
2526
|
type: "string",
|
|
2527
2527
|
format: "base64",
|
|
@@ -2530,7 +2530,7 @@ function ti(e, t) {
|
|
|
2530
2530
|
...b(t)
|
|
2531
2531
|
});
|
|
2532
2532
|
}
|
|
2533
|
-
function
|
|
2533
|
+
function oi(e, t) {
|
|
2534
2534
|
return new e({
|
|
2535
2535
|
type: "string",
|
|
2536
2536
|
format: "base64url",
|
|
@@ -2539,7 +2539,7 @@ function ni(e, t) {
|
|
|
2539
2539
|
...b(t)
|
|
2540
2540
|
});
|
|
2541
2541
|
}
|
|
2542
|
-
function
|
|
2542
|
+
function ri(e, t) {
|
|
2543
2543
|
return new e({
|
|
2544
2544
|
type: "string",
|
|
2545
2545
|
format: "e164",
|
|
@@ -2548,7 +2548,7 @@ function oi(e, t) {
|
|
|
2548
2548
|
...b(t)
|
|
2549
2549
|
});
|
|
2550
2550
|
}
|
|
2551
|
-
function
|
|
2551
|
+
function ii(e, t) {
|
|
2552
2552
|
return new e({
|
|
2553
2553
|
type: "string",
|
|
2554
2554
|
format: "jwt",
|
|
@@ -2557,7 +2557,7 @@ function ri(e, t) {
|
|
|
2557
2557
|
...b(t)
|
|
2558
2558
|
});
|
|
2559
2559
|
}
|
|
2560
|
-
function
|
|
2560
|
+
function si(e, t) {
|
|
2561
2561
|
return new e({
|
|
2562
2562
|
type: "string",
|
|
2563
2563
|
format: "datetime",
|
|
@@ -2568,7 +2568,7 @@ function ii(e, t) {
|
|
|
2568
2568
|
...b(t)
|
|
2569
2569
|
});
|
|
2570
2570
|
}
|
|
2571
|
-
function
|
|
2571
|
+
function ai(e, t) {
|
|
2572
2572
|
return new e({
|
|
2573
2573
|
type: "string",
|
|
2574
2574
|
format: "date",
|
|
@@ -2576,7 +2576,7 @@ function si(e, t) {
|
|
|
2576
2576
|
...b(t)
|
|
2577
2577
|
});
|
|
2578
2578
|
}
|
|
2579
|
-
function
|
|
2579
|
+
function ui(e, t) {
|
|
2580
2580
|
return new e({
|
|
2581
2581
|
type: "string",
|
|
2582
2582
|
format: "time",
|
|
@@ -2585,7 +2585,7 @@ function ai(e, t) {
|
|
|
2585
2585
|
...b(t)
|
|
2586
2586
|
});
|
|
2587
2587
|
}
|
|
2588
|
-
function
|
|
2588
|
+
function ci(e, t) {
|
|
2589
2589
|
return new e({
|
|
2590
2590
|
type: "string",
|
|
2591
2591
|
format: "duration",
|
|
@@ -2593,14 +2593,14 @@ function ui(e, t) {
|
|
|
2593
2593
|
...b(t)
|
|
2594
2594
|
});
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
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
|
|
2603
|
+
function di(e, t) {
|
|
2604
2604
|
return new e({
|
|
2605
2605
|
type: "number",
|
|
2606
2606
|
check: "number_format",
|
|
@@ -2609,40 +2609,40 @@ function li(e, t) {
|
|
|
2609
2609
|
...b(t)
|
|
2610
2610
|
});
|
|
2611
2611
|
}
|
|
2612
|
-
function
|
|
2612
|
+
function pi(e, t) {
|
|
2613
2613
|
return new e({
|
|
2614
2614
|
type: "null",
|
|
2615
2615
|
...b(t)
|
|
2616
2616
|
});
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function hi(e) {
|
|
2619
2619
|
return new e({
|
|
2620
2620
|
type: "unknown"
|
|
2621
2621
|
});
|
|
2622
2622
|
}
|
|
2623
|
-
function
|
|
2623
|
+
function fi(e, t) {
|
|
2624
2624
|
return new e({
|
|
2625
2625
|
type: "never",
|
|
2626
2626
|
...b(t)
|
|
2627
2627
|
});
|
|
2628
2628
|
}
|
|
2629
|
-
function
|
|
2630
|
-
return new
|
|
2629
|
+
function ct(e, t) {
|
|
2630
|
+
return new Ut({
|
|
2631
2631
|
check: "less_than",
|
|
2632
2632
|
...b(t),
|
|
2633
2633
|
value: e,
|
|
2634
2634
|
inclusive: !1
|
|
2635
2635
|
});
|
|
2636
2636
|
}
|
|
2637
|
-
function
|
|
2638
|
-
return new
|
|
2637
|
+
function Ce(e, t) {
|
|
2638
|
+
return new Ut({
|
|
2639
2639
|
check: "less_than",
|
|
2640
2640
|
...b(t),
|
|
2641
2641
|
value: e,
|
|
2642
2642
|
inclusive: !0
|
|
2643
2643
|
});
|
|
2644
2644
|
}
|
|
2645
|
-
function
|
|
2645
|
+
function lt(e, t) {
|
|
2646
2646
|
return new Ft({
|
|
2647
2647
|
check: "greater_than",
|
|
2648
2648
|
...b(t),
|
|
@@ -2650,7 +2650,7 @@ function ct(e, t) {
|
|
|
2650
2650
|
inclusive: !1
|
|
2651
2651
|
});
|
|
2652
2652
|
}
|
|
2653
|
-
function
|
|
2653
|
+
function Ae(e, t) {
|
|
2654
2654
|
return new Ft({
|
|
2655
2655
|
check: "greater_than",
|
|
2656
2656
|
...b(t),
|
|
@@ -2658,74 +2658,74 @@ function Ce(e, t) {
|
|
|
2658
2658
|
inclusive: !0
|
|
2659
2659
|
});
|
|
2660
2660
|
}
|
|
2661
|
-
function
|
|
2662
|
-
return new
|
|
2661
|
+
function dt(e, t) {
|
|
2662
|
+
return new zo({
|
|
2663
2663
|
check: "multiple_of",
|
|
2664
2664
|
...b(t),
|
|
2665
2665
|
value: e
|
|
2666
2666
|
});
|
|
2667
2667
|
}
|
|
2668
|
-
function
|
|
2669
|
-
return new
|
|
2668
|
+
function Wt(e, t) {
|
|
2669
|
+
return new $o({
|
|
2670
2670
|
check: "max_length",
|
|
2671
2671
|
...b(t),
|
|
2672
2672
|
maximum: e
|
|
2673
2673
|
});
|
|
2674
2674
|
}
|
|
2675
2675
|
function _e(e, t) {
|
|
2676
|
-
return new
|
|
2676
|
+
return new Oo({
|
|
2677
2677
|
check: "min_length",
|
|
2678
2678
|
...b(t),
|
|
2679
2679
|
minimum: e
|
|
2680
2680
|
});
|
|
2681
2681
|
}
|
|
2682
|
-
function
|
|
2683
|
-
return new
|
|
2682
|
+
function qt(e, t) {
|
|
2683
|
+
return new Zo({
|
|
2684
2684
|
check: "length_equals",
|
|
2685
2685
|
...b(t),
|
|
2686
2686
|
length: e
|
|
2687
2687
|
});
|
|
2688
2688
|
}
|
|
2689
|
-
function
|
|
2690
|
-
return new
|
|
2689
|
+
function _i(e, t) {
|
|
2690
|
+
return new Po({
|
|
2691
2691
|
check: "string_format",
|
|
2692
2692
|
format: "regex",
|
|
2693
2693
|
...b(t),
|
|
2694
2694
|
pattern: e
|
|
2695
2695
|
});
|
|
2696
2696
|
}
|
|
2697
|
-
function
|
|
2698
|
-
return new
|
|
2697
|
+
function mi(e) {
|
|
2698
|
+
return new xo({
|
|
2699
2699
|
check: "string_format",
|
|
2700
2700
|
format: "lowercase",
|
|
2701
2701
|
...b(e)
|
|
2702
2702
|
});
|
|
2703
2703
|
}
|
|
2704
|
-
function
|
|
2705
|
-
return new
|
|
2704
|
+
function vi(e) {
|
|
2705
|
+
return new Lo({
|
|
2706
2706
|
check: "string_format",
|
|
2707
2707
|
format: "uppercase",
|
|
2708
2708
|
...b(e)
|
|
2709
2709
|
});
|
|
2710
2710
|
}
|
|
2711
|
-
function
|
|
2712
|
-
return new
|
|
2711
|
+
function gi(e, t) {
|
|
2712
|
+
return new Ro({
|
|
2713
2713
|
check: "string_format",
|
|
2714
2714
|
format: "includes",
|
|
2715
2715
|
...b(t),
|
|
2716
2716
|
includes: e
|
|
2717
2717
|
});
|
|
2718
2718
|
}
|
|
2719
|
-
function
|
|
2720
|
-
return new
|
|
2719
|
+
function yi(e, t) {
|
|
2720
|
+
return new jo({
|
|
2721
2721
|
check: "string_format",
|
|
2722
2722
|
format: "starts_with",
|
|
2723
2723
|
...b(t),
|
|
2724
2724
|
prefix: e
|
|
2725
2725
|
});
|
|
2726
2726
|
}
|
|
2727
|
-
function
|
|
2728
|
-
return new
|
|
2727
|
+
function bi(e, t) {
|
|
2728
|
+
return new No({
|
|
2729
2729
|
check: "string_format",
|
|
2730
2730
|
format: "ends_with",
|
|
2731
2731
|
...b(t),
|
|
@@ -2733,27 +2733,27 @@ function yi(e, t) {
|
|
|
2733
2733
|
});
|
|
2734
2734
|
}
|
|
2735
2735
|
function ee(e) {
|
|
2736
|
-
return new
|
|
2736
|
+
return new Do({
|
|
2737
2737
|
check: "overwrite",
|
|
2738
2738
|
tx: e
|
|
2739
2739
|
});
|
|
2740
2740
|
}
|
|
2741
|
-
function
|
|
2741
|
+
function wi(e) {
|
|
2742
2742
|
return ee((t) => t.normalize(e));
|
|
2743
2743
|
}
|
|
2744
|
-
function
|
|
2744
|
+
function Ei() {
|
|
2745
2745
|
return ee((e) => e.trim());
|
|
2746
2746
|
}
|
|
2747
|
-
function
|
|
2747
|
+
function ki() {
|
|
2748
2748
|
return ee((e) => e.toLowerCase());
|
|
2749
2749
|
}
|
|
2750
|
-
function
|
|
2750
|
+
function Ci() {
|
|
2751
2751
|
return ee((e) => e.toUpperCase());
|
|
2752
2752
|
}
|
|
2753
|
-
function
|
|
2754
|
-
return ee((e) =>
|
|
2753
|
+
function Ai() {
|
|
2754
|
+
return ee((e) => On(e));
|
|
2755
2755
|
}
|
|
2756
|
-
function
|
|
2756
|
+
function Ti(e, t, n) {
|
|
2757
2757
|
return new e({
|
|
2758
2758
|
type: "array",
|
|
2759
2759
|
element: t,
|
|
@@ -2771,8 +2771,8 @@ function Si(e, t, n) {
|
|
|
2771
2771
|
...b(n)
|
|
2772
2772
|
});
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2775
|
-
const t =
|
|
2774
|
+
function zi(e) {
|
|
2775
|
+
const t = Ii((n) => (n.addIssue = (o) => {
|
|
2776
2776
|
if (typeof o == "string")
|
|
2777
2777
|
n.issues.push(ie(o, n.value, t._zod.def));
|
|
2778
2778
|
else {
|
|
@@ -2782,56 +2782,56 @@ function Ti(e) {
|
|
|
2782
2782
|
}, e(n.value, n)));
|
|
2783
2783
|
return t;
|
|
2784
2784
|
}
|
|
2785
|
-
function
|
|
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
|
|
2793
|
-
Qo.init(e, t), $.init(e, t);
|
|
2794
|
-
});
|
|
2795
|
-
function $i(e) {
|
|
2796
|
-
return ii(Ii, e);
|
|
2797
|
-
}
|
|
2798
|
-
const Oi = /* @__PURE__ */ m("ZodISODate", (e, t) => {
|
|
2792
|
+
const $i = /* @__PURE__ */ m("ZodISODateTime", (e, t) => {
|
|
2799
2793
|
Xo.init(e, t), $.init(e, t);
|
|
2800
2794
|
});
|
|
2801
|
-
function
|
|
2802
|
-
return si(
|
|
2795
|
+
function Oi(e) {
|
|
2796
|
+
return si($i, e);
|
|
2803
2797
|
}
|
|
2804
|
-
const
|
|
2798
|
+
const Zi = /* @__PURE__ */ m("ZodISODate", (e, t) => {
|
|
2805
2799
|
er.init(e, t), $.init(e, t);
|
|
2806
2800
|
});
|
|
2807
|
-
function
|
|
2808
|
-
return ai(
|
|
2801
|
+
function Pi(e) {
|
|
2802
|
+
return ai(Zi, e);
|
|
2809
2803
|
}
|
|
2810
|
-
const
|
|
2804
|
+
const xi = /* @__PURE__ */ m("ZodISOTime", (e, t) => {
|
|
2811
2805
|
tr.init(e, t), $.init(e, t);
|
|
2812
2806
|
});
|
|
2813
|
-
function
|
|
2814
|
-
return ui(
|
|
2807
|
+
function Li(e) {
|
|
2808
|
+
return ui(xi, e);
|
|
2809
|
+
}
|
|
2810
|
+
const Ri = /* @__PURE__ */ m("ZodISODuration", (e, t) => {
|
|
2811
|
+
nr.init(e, t), $.init(e, t);
|
|
2812
|
+
});
|
|
2813
|
+
function ji(e) {
|
|
2814
|
+
return ci(Ri, e);
|
|
2815
2815
|
}
|
|
2816
|
-
const
|
|
2817
|
-
|
|
2816
|
+
const Ni = (e, t) => {
|
|
2817
|
+
xt.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
2818
2818
|
format: {
|
|
2819
|
-
value: (n) =>
|
|
2819
|
+
value: (n) => Bn(e, n)
|
|
2820
2820
|
// enumerable: false,
|
|
2821
2821
|
},
|
|
2822
2822
|
flatten: {
|
|
2823
|
-
value: (n) =>
|
|
2823
|
+
value: (n) => Vn(e, n)
|
|
2824
2824
|
// enumerable: false,
|
|
2825
2825
|
},
|
|
2826
2826
|
addIssue: {
|
|
2827
2827
|
value: (n) => {
|
|
2828
|
-
e.issues.push(n), e.message = JSON.stringify(e.issues,
|
|
2828
|
+
e.issues.push(n), e.message = JSON.stringify(e.issues, Ze, 2);
|
|
2829
2829
|
}
|
|
2830
2830
|
// enumerable: false,
|
|
2831
2831
|
},
|
|
2832
2832
|
addIssues: {
|
|
2833
2833
|
value: (n) => {
|
|
2834
|
-
e.issues.push(...n), e.message = JSON.stringify(e.issues,
|
|
2834
|
+
e.issues.push(...n), e.message = JSON.stringify(e.issues, Ze, 2);
|
|
2835
2835
|
}
|
|
2836
2836
|
// enumerable: false,
|
|
2837
2837
|
},
|
|
@@ -2842,14 +2842,14 @@ const ji = (e, t) => {
|
|
|
2842
2842
|
// enumerable: false,
|
|
2843
2843
|
}
|
|
2844
2844
|
});
|
|
2845
|
-
}, P = /* @__PURE__ */ m("ZodError",
|
|
2845
|
+
}, P = /* @__PURE__ */ m("ZodError", Ni, {
|
|
2846
2846
|
Parent: Error
|
|
2847
|
-
}),
|
|
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) =>
|
|
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", {
|
|
@@ -2862,127 +2862,127 @@ const ji = (e, t) => {
|
|
|
2862
2862
|
return le.get(e);
|
|
2863
2863
|
const o = e.clone();
|
|
2864
2864
|
return le.add(o, n[0]), o;
|
|
2865
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2866
|
-
|
|
2865
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Kt = /* @__PURE__ */ m("_ZodString", (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(
|
|
2869
|
-
}),
|
|
2870
|
-
|
|
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
|
|
2873
|
+
return Nr(Yi, e);
|
|
2874
2874
|
}
|
|
2875
2875
|
const $ = /* @__PURE__ */ m("ZodStringFormat", (e, t) => {
|
|
2876
|
-
z.init(e, t),
|
|
2877
|
-
}),
|
|
2878
|
-
|
|
2879
|
-
}),
|
|
2876
|
+
z.init(e, t), Kt.init(e, t);
|
|
2877
|
+
}), Qi = /* @__PURE__ */ m("ZodEmail", (e, t) => {
|
|
2878
|
+
Bo.init(e, t), $.init(e, t);
|
|
2879
|
+
}), pt = /* @__PURE__ */ m("ZodGUID", (e, t) => {
|
|
2880
2880
|
Mo.init(e, t), $.init(e, t);
|
|
2881
2881
|
}), de = /* @__PURE__ */ m("ZodUUID", (e, t) => {
|
|
2882
|
-
|
|
2883
|
-
}),
|
|
2884
|
-
Bo.init(e, t), $.init(e, t);
|
|
2885
|
-
}), Xi = /* @__PURE__ */ m("ZodEmoji", (e, t) => {
|
|
2882
|
+
Vo.init(e, t), $.init(e, t);
|
|
2883
|
+
}), Xi = /* @__PURE__ */ m("ZodURL", (e, t) => {
|
|
2886
2884
|
Go.init(e, t), $.init(e, t);
|
|
2887
|
-
}), es = /* @__PURE__ */ m("
|
|
2885
|
+
}), es = /* @__PURE__ */ m("ZodEmoji", (e, t) => {
|
|
2888
2886
|
Wo.init(e, t), $.init(e, t);
|
|
2889
|
-
}), ts = /* @__PURE__ */ m("
|
|
2887
|
+
}), ts = /* @__PURE__ */ m("ZodNanoID", (e, t) => {
|
|
2890
2888
|
qo.init(e, t), $.init(e, t);
|
|
2891
|
-
}), ns = /* @__PURE__ */ m("
|
|
2889
|
+
}), ns = /* @__PURE__ */ m("ZodCUID", (e, t) => {
|
|
2892
2890
|
Ko.init(e, t), $.init(e, t);
|
|
2893
|
-
}), os = /* @__PURE__ */ m("
|
|
2891
|
+
}), os = /* @__PURE__ */ m("ZodCUID2", (e, t) => {
|
|
2894
2892
|
Ho.init(e, t), $.init(e, t);
|
|
2895
|
-
}), rs = /* @__PURE__ */ m("
|
|
2893
|
+
}), rs = /* @__PURE__ */ m("ZodULID", (e, t) => {
|
|
2896
2894
|
Jo.init(e, t), $.init(e, t);
|
|
2897
|
-
}), is = /* @__PURE__ */ m("
|
|
2895
|
+
}), is = /* @__PURE__ */ m("ZodXID", (e, t) => {
|
|
2898
2896
|
Yo.init(e, t), $.init(e, t);
|
|
2899
|
-
}), ss = /* @__PURE__ */ m("
|
|
2900
|
-
|
|
2901
|
-
}), as = /* @__PURE__ */ m("
|
|
2897
|
+
}), ss = /* @__PURE__ */ m("ZodKSUID", (e, t) => {
|
|
2898
|
+
Qo.init(e, t), $.init(e, t);
|
|
2899
|
+
}), as = /* @__PURE__ */ m("ZodIPv4", (e, t) => {
|
|
2902
2900
|
or.init(e, t), $.init(e, t);
|
|
2903
|
-
}), us = /* @__PURE__ */ m("
|
|
2901
|
+
}), us = /* @__PURE__ */ m("ZodIPv6", (e, t) => {
|
|
2904
2902
|
rr.init(e, t), $.init(e, t);
|
|
2905
|
-
}), cs = /* @__PURE__ */ m("
|
|
2903
|
+
}), cs = /* @__PURE__ */ m("ZodCIDRv4", (e, t) => {
|
|
2906
2904
|
ir.init(e, t), $.init(e, t);
|
|
2907
|
-
}), ls = /* @__PURE__ */ m("
|
|
2905
|
+
}), ls = /* @__PURE__ */ m("ZodCIDRv6", (e, t) => {
|
|
2908
2906
|
sr.init(e, t), $.init(e, t);
|
|
2909
|
-
}), ds = /* @__PURE__ */ m("
|
|
2910
|
-
|
|
2911
|
-
}), ps = /* @__PURE__ */ m("
|
|
2907
|
+
}), ds = /* @__PURE__ */ m("ZodBase64", (e, t) => {
|
|
2908
|
+
ar.init(e, t), $.init(e, t);
|
|
2909
|
+
}), ps = /* @__PURE__ */ m("ZodBase64URL", (e, t) => {
|
|
2912
2910
|
cr.init(e, t), $.init(e, t);
|
|
2913
|
-
}), hs = /* @__PURE__ */ m("
|
|
2914
|
-
|
|
2915
|
-
}),
|
|
2916
|
-
|
|
2911
|
+
}), hs = /* @__PURE__ */ m("ZodE164", (e, t) => {
|
|
2912
|
+
lr.init(e, t), $.init(e, t);
|
|
2913
|
+
}), fs = /* @__PURE__ */ m("ZodJWT", (e, t) => {
|
|
2914
|
+
pr.init(e, t), $.init(e, t);
|
|
2915
|
+
}), Ht = /* @__PURE__ */ m("ZodNumber", (e, t) => {
|
|
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
|
|
2922
|
-
}
|
|
2923
|
-
const fs = /* @__PURE__ */ m("ZodNumberFormat", (e, t) => {
|
|
2924
|
-
pr.init(e, t), Kt.init(e, t);
|
|
2925
|
-
});
|
|
2926
|
-
function pt(e) {
|
|
2927
|
-
return li(fs, e);
|
|
2921
|
+
return li(Ht, e);
|
|
2928
2922
|
}
|
|
2929
|
-
const _s = /* @__PURE__ */ m("
|
|
2930
|
-
hr.init(e, t),
|
|
2923
|
+
const _s = /* @__PURE__ */ m("ZodNumberFormat", (e, t) => {
|
|
2924
|
+
hr.init(e, t), Ht.init(e, t);
|
|
2931
2925
|
});
|
|
2932
|
-
function
|
|
2926
|
+
function ht(e) {
|
|
2933
2927
|
return di(_s, e);
|
|
2934
2928
|
}
|
|
2935
|
-
const
|
|
2929
|
+
const ms = /* @__PURE__ */ m("ZodNull", (e, t) => {
|
|
2936
2930
|
fr.init(e, t), I.init(e, t);
|
|
2937
2931
|
});
|
|
2938
|
-
function
|
|
2939
|
-
return pi(
|
|
2932
|
+
function vs(e) {
|
|
2933
|
+
return pi(ms, e);
|
|
2940
2934
|
}
|
|
2941
|
-
const gs = /* @__PURE__ */ m("
|
|
2935
|
+
const gs = /* @__PURE__ */ m("ZodUnknown", (e, t) => {
|
|
2942
2936
|
_r.init(e, t), I.init(e, t);
|
|
2943
2937
|
});
|
|
2944
|
-
function
|
|
2945
|
-
return hi(gs
|
|
2938
|
+
function ft() {
|
|
2939
|
+
return hi(gs);
|
|
2940
|
+
}
|
|
2941
|
+
const ys = /* @__PURE__ */ m("ZodNever", (e, t) => {
|
|
2942
|
+
mr.init(e, t), I.init(e, t);
|
|
2943
|
+
});
|
|
2944
|
+
function bs(e) {
|
|
2945
|
+
return fi(ys, e);
|
|
2946
2946
|
}
|
|
2947
|
-
const
|
|
2948
|
-
|
|
2947
|
+
const ws = /* @__PURE__ */ m("ZodArray", (e, t) => {
|
|
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
|
-
function
|
|
2951
|
-
return
|
|
2950
|
+
function Es(e, t) {
|
|
2951
|
+
return Ti(ws, e, t);
|
|
2952
2952
|
}
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2953
|
+
const ks = /* @__PURE__ */ m("ZodObject", (e, t) => {
|
|
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
|
-
function
|
|
2956
|
+
function S(e, t) {
|
|
2957
2957
|
const n = {
|
|
2958
2958
|
type: "object",
|
|
2959
2959
|
shape: e ?? {},
|
|
2960
2960
|
...b(t)
|
|
2961
2961
|
};
|
|
2962
|
-
return new
|
|
2962
|
+
return new ks(n);
|
|
2963
2963
|
}
|
|
2964
|
-
const
|
|
2965
|
-
|
|
2964
|
+
const Cs = /* @__PURE__ */ m("ZodUnion", (e, t) => {
|
|
2965
|
+
br.init(e, t), I.init(e, t), e.options = t.options;
|
|
2966
2966
|
});
|
|
2967
2967
|
function G(e, t) {
|
|
2968
|
-
return new
|
|
2968
|
+
return new Cs({
|
|
2969
2969
|
type: "union",
|
|
2970
2970
|
options: e,
|
|
2971
2971
|
...b(t)
|
|
2972
2972
|
});
|
|
2973
2973
|
}
|
|
2974
|
-
const
|
|
2975
|
-
|
|
2974
|
+
const As = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
|
|
2975
|
+
wr.init(e, t), I.init(e, t);
|
|
2976
2976
|
});
|
|
2977
|
-
function
|
|
2978
|
-
return new
|
|
2977
|
+
function Ts(e, t) {
|
|
2978
|
+
return new As({
|
|
2979
2979
|
type: "intersection",
|
|
2980
2980
|
left: e,
|
|
2981
2981
|
right: t
|
|
2982
2982
|
});
|
|
2983
2983
|
}
|
|
2984
2984
|
const Ss = /* @__PURE__ */ m("ZodTuple", (e, t) => {
|
|
2985
|
-
|
|
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
|
});
|
|
@@ -2996,19 +2996,19 @@ function L(e, t, n) {
|
|
|
2996
2996
|
...b(i)
|
|
2997
2997
|
});
|
|
2998
2998
|
}
|
|
2999
|
-
const
|
|
3000
|
-
|
|
2999
|
+
const zs = /* @__PURE__ */ m("ZodRecord", (e, t) => {
|
|
3000
|
+
kr.init(e, t), I.init(e, t), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
3001
3001
|
});
|
|
3002
|
-
function
|
|
3003
|
-
return new
|
|
3002
|
+
function Is(e, t, n) {
|
|
3003
|
+
return new zs({
|
|
3004
3004
|
type: "record",
|
|
3005
3005
|
keyType: e,
|
|
3006
3006
|
valueType: t,
|
|
3007
3007
|
...b(n)
|
|
3008
3008
|
});
|
|
3009
3009
|
}
|
|
3010
|
-
const
|
|
3011
|
-
|
|
3010
|
+
const xe = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
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
3013
|
e.extract = (o, i) => {
|
|
3014
3014
|
const a = {};
|
|
@@ -3017,7 +3017,7 @@ const Ze = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
|
3017
3017
|
a[c] = t.entries[c];
|
|
3018
3018
|
else
|
|
3019
3019
|
throw new Error(`Key ${c} not found in enum`);
|
|
3020
|
-
return new
|
|
3020
|
+
return new xe({
|
|
3021
3021
|
...t,
|
|
3022
3022
|
checks: [],
|
|
3023
3023
|
...b(i),
|
|
@@ -3030,7 +3030,7 @@ const Ze = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
|
3030
3030
|
delete a[c];
|
|
3031
3031
|
else
|
|
3032
3032
|
throw new Error(`Key ${c} not found in enum`);
|
|
3033
|
-
return new
|
|
3033
|
+
return new xe({
|
|
3034
3034
|
...t,
|
|
3035
3035
|
checks: [],
|
|
3036
3036
|
...b(i),
|
|
@@ -3038,16 +3038,16 @@ const Ze = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
|
3038
3038
|
});
|
|
3039
3039
|
};
|
|
3040
3040
|
});
|
|
3041
|
-
function
|
|
3041
|
+
function $s(e, t) {
|
|
3042
3042
|
const n = Array.isArray(e) ? Object.fromEntries(e.map((o) => [o, o])) : e;
|
|
3043
|
-
return new
|
|
3043
|
+
return new xe({
|
|
3044
3044
|
type: "enum",
|
|
3045
3045
|
entries: n,
|
|
3046
3046
|
...b(t)
|
|
3047
3047
|
});
|
|
3048
3048
|
}
|
|
3049
|
-
const
|
|
3050
|
-
|
|
3049
|
+
const Os = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
|
|
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.");
|
|
@@ -3056,16 +3056,16 @@ const $s = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
|
|
|
3056
3056
|
});
|
|
3057
3057
|
});
|
|
3058
3058
|
function R(e, t) {
|
|
3059
|
-
return new
|
|
3059
|
+
return new Os({
|
|
3060
3060
|
type: "literal",
|
|
3061
3061
|
values: Array.isArray(e) ? e : [e],
|
|
3062
3062
|
...b(t)
|
|
3063
3063
|
});
|
|
3064
3064
|
}
|
|
3065
|
-
const
|
|
3066
|
-
|
|
3065
|
+
const Zs = /* @__PURE__ */ m("ZodTransform", (e, t) => {
|
|
3066
|
+
Tr.init(e, t), I.init(e, t), e._zod.parse = (n, o) => {
|
|
3067
3067
|
if (o.direction === "backward")
|
|
3068
|
-
throw new
|
|
3068
|
+
throw new It(e.constructor.name);
|
|
3069
3069
|
n.addIssue = (a) => {
|
|
3070
3070
|
if (typeof a == "string")
|
|
3071
3071
|
n.issues.push(ie(a, n.value, t));
|
|
@@ -3078,78 +3078,78 @@ const Os = /* @__PURE__ */ m("ZodTransform", (e, t) => {
|
|
|
3078
3078
|
return i instanceof Promise ? i.then((a) => (n.value = a, n)) : (n.value = i, n);
|
|
3079
3079
|
};
|
|
3080
3080
|
});
|
|
3081
|
-
function
|
|
3082
|
-
return new
|
|
3081
|
+
function Ps(e) {
|
|
3082
|
+
return new Zs({
|
|
3083
3083
|
type: "transform",
|
|
3084
3084
|
transform: e
|
|
3085
3085
|
});
|
|
3086
3086
|
}
|
|
3087
|
-
const
|
|
3087
|
+
const Jt = /* @__PURE__ */ m("ZodOptional", (e, t) => {
|
|
3088
3088
|
Sr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3089
3089
|
});
|
|
3090
|
-
function
|
|
3091
|
-
return new
|
|
3090
|
+
function _t(e) {
|
|
3091
|
+
return new Jt({
|
|
3092
3092
|
type: "optional",
|
|
3093
3093
|
innerType: e
|
|
3094
3094
|
});
|
|
3095
3095
|
}
|
|
3096
|
-
const
|
|
3097
|
-
|
|
3096
|
+
const xs = /* @__PURE__ */ m("ZodNullable", (e, t) => {
|
|
3097
|
+
zr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3098
3098
|
});
|
|
3099
|
-
function
|
|
3100
|
-
return new
|
|
3099
|
+
function mt(e) {
|
|
3100
|
+
return new xs({
|
|
3101
3101
|
type: "nullable",
|
|
3102
3102
|
innerType: e
|
|
3103
3103
|
});
|
|
3104
3104
|
}
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3105
|
+
const Ls = /* @__PURE__ */ m("ZodDefault", (e, t) => {
|
|
3106
|
+
Ir.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
3107
3107
|
});
|
|
3108
|
-
function
|
|
3109
|
-
return new
|
|
3108
|
+
function Rs(e, t) {
|
|
3109
|
+
return new Ls({
|
|
3110
3110
|
type: "default",
|
|
3111
3111
|
innerType: e,
|
|
3112
3112
|
get defaultValue() {
|
|
3113
|
-
return typeof t == "function" ? t() :
|
|
3113
|
+
return typeof t == "function" ? t() : Zt(t);
|
|
3114
3114
|
}
|
|
3115
3115
|
});
|
|
3116
3116
|
}
|
|
3117
|
-
const
|
|
3118
|
-
|
|
3117
|
+
const js = /* @__PURE__ */ m("ZodPrefault", (e, t) => {
|
|
3118
|
+
$r.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3119
3119
|
});
|
|
3120
|
-
function
|
|
3121
|
-
return new
|
|
3120
|
+
function Ns(e, t) {
|
|
3121
|
+
return new js({
|
|
3122
3122
|
type: "prefault",
|
|
3123
3123
|
innerType: e,
|
|
3124
3124
|
get defaultValue() {
|
|
3125
|
-
return typeof t == "function" ? t() :
|
|
3125
|
+
return typeof t == "function" ? t() : Zt(t);
|
|
3126
3126
|
}
|
|
3127
3127
|
});
|
|
3128
3128
|
}
|
|
3129
|
-
const
|
|
3130
|
-
|
|
3129
|
+
const Yt = /* @__PURE__ */ m("ZodNonOptional", (e, t) => {
|
|
3130
|
+
Or.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3131
3131
|
});
|
|
3132
|
-
function
|
|
3133
|
-
return new
|
|
3132
|
+
function Ds(e, t) {
|
|
3133
|
+
return new Yt({
|
|
3134
3134
|
type: "nonoptional",
|
|
3135
3135
|
innerType: e,
|
|
3136
3136
|
...b(t)
|
|
3137
3137
|
});
|
|
3138
3138
|
}
|
|
3139
|
-
const
|
|
3140
|
-
|
|
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
3142
|
function Fs(e, t) {
|
|
3143
|
-
return new
|
|
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
3149
|
const Ms = /* @__PURE__ */ m("ZodPipe", (e, t) => {
|
|
3150
|
-
|
|
3150
|
+
Pr.init(e, t), I.init(e, t), e.in = t.in, e.out = t.out;
|
|
3151
3151
|
});
|
|
3152
|
-
function
|
|
3152
|
+
function vt(e, t) {
|
|
3153
3153
|
return new Ms({
|
|
3154
3154
|
type: "pipe",
|
|
3155
3155
|
in: e,
|
|
@@ -3157,113 +3157,113 @@ function mt(e, t) {
|
|
|
3157
3157
|
// ...util.normalizeParams(params),
|
|
3158
3158
|
});
|
|
3159
3159
|
}
|
|
3160
|
-
const
|
|
3161
|
-
|
|
3160
|
+
const Vs = /* @__PURE__ */ m("ZodReadonly", (e, t) => {
|
|
3161
|
+
xr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3162
3162
|
});
|
|
3163
|
-
function
|
|
3164
|
-
return new
|
|
3163
|
+
function Bs(e) {
|
|
3164
|
+
return new Vs({
|
|
3165
3165
|
type: "readonly",
|
|
3166
3166
|
innerType: e
|
|
3167
3167
|
});
|
|
3168
3168
|
}
|
|
3169
|
-
const
|
|
3170
|
-
|
|
3169
|
+
const Gs = /* @__PURE__ */ m("ZodCustom", (e, t) => {
|
|
3170
|
+
Lr.init(e, t), I.init(e, t);
|
|
3171
3171
|
});
|
|
3172
|
-
function
|
|
3173
|
-
return Si(
|
|
3172
|
+
function Ws(e, t = {}) {
|
|
3173
|
+
return Si(Gs, e, t);
|
|
3174
3174
|
}
|
|
3175
|
-
function
|
|
3176
|
-
return
|
|
3175
|
+
function qs(e) {
|
|
3176
|
+
return zi(e);
|
|
3177
3177
|
}
|
|
3178
|
-
const be =
|
|
3178
|
+
const be = S({
|
|
3179
3179
|
t: Z().gte(0),
|
|
3180
3180
|
rate: Z().gte(0)
|
|
3181
|
-
}), Q =
|
|
3181
|
+
}), Q = S({
|
|
3182
3182
|
opacity: Z().gte(0).lte(1),
|
|
3183
3183
|
zIndex: Z()
|
|
3184
|
-
}), X =
|
|
3184
|
+
}), X = S({
|
|
3185
3185
|
volume: Z().gte(0).lte(1)
|
|
3186
|
-
}),
|
|
3186
|
+
}), Ks = S({
|
|
3187
3187
|
type: R("image"),
|
|
3188
3188
|
file: Y(),
|
|
3189
3189
|
fit: G([R("contain"), R("cover"), R("none")])
|
|
3190
|
-
}),
|
|
3190
|
+
}), Hs = S({
|
|
3191
3191
|
type: R("audio"),
|
|
3192
3192
|
file: Y(),
|
|
3193
3193
|
audioOutput: Y()
|
|
3194
|
-
}),
|
|
3194
|
+
}), Js = S({
|
|
3195
3195
|
type: R("video"),
|
|
3196
3196
|
file: Y(),
|
|
3197
3197
|
audioOutput: Y(),
|
|
3198
3198
|
fit: G([R("contain"), R("cover"), R("none")])
|
|
3199
|
-
}),
|
|
3199
|
+
}), Ve = L([Z(), vs()]), Ys = L([
|
|
3200
3200
|
Z(),
|
|
3201
|
-
|
|
3202
|
-
set:
|
|
3201
|
+
S({
|
|
3202
|
+
set: S({
|
|
3203
3203
|
...Q.shape
|
|
3204
3204
|
}).partial()
|
|
3205
3205
|
}).partial()
|
|
3206
|
-
]),
|
|
3206
|
+
]), Qs = L([
|
|
3207
3207
|
Z(),
|
|
3208
|
-
|
|
3209
|
-
set:
|
|
3208
|
+
S({
|
|
3209
|
+
set: S({
|
|
3210
3210
|
...Q.shape
|
|
3211
3211
|
}).partial(),
|
|
3212
|
-
lerp:
|
|
3212
|
+
lerp: S({
|
|
3213
3213
|
...Q.shape
|
|
3214
3214
|
}).partial()
|
|
3215
3215
|
}).partial()
|
|
3216
|
-
]),
|
|
3216
|
+
]), Xs = L([
|
|
3217
3217
|
Z(),
|
|
3218
|
-
|
|
3219
|
-
set:
|
|
3218
|
+
S({
|
|
3219
|
+
set: S({
|
|
3220
3220
|
...be.shape,
|
|
3221
3221
|
...X.shape
|
|
3222
3222
|
}).partial()
|
|
3223
3223
|
}).partial()
|
|
3224
|
-
]),
|
|
3224
|
+
]), ea = L([
|
|
3225
3225
|
Z(),
|
|
3226
|
-
|
|
3227
|
-
set:
|
|
3226
|
+
S({
|
|
3227
|
+
set: S({
|
|
3228
3228
|
...be.shape,
|
|
3229
3229
|
...X.shape
|
|
3230
3230
|
}).partial(),
|
|
3231
|
-
lerp:
|
|
3231
|
+
lerp: S({
|
|
3232
3232
|
...X.shape
|
|
3233
3233
|
}).partial()
|
|
3234
3234
|
}).partial()
|
|
3235
|
-
]),
|
|
3235
|
+
]), ta = L([
|
|
3236
3236
|
Z(),
|
|
3237
|
-
|
|
3238
|
-
set:
|
|
3237
|
+
S({
|
|
3238
|
+
set: S({
|
|
3239
3239
|
...be.shape,
|
|
3240
3240
|
...X.shape,
|
|
3241
3241
|
...Q.shape
|
|
3242
3242
|
}).partial()
|
|
3243
3243
|
}).partial()
|
|
3244
|
-
]),
|
|
3244
|
+
]), na = L([
|
|
3245
3245
|
Z(),
|
|
3246
|
-
|
|
3247
|
-
set:
|
|
3246
|
+
S({
|
|
3247
|
+
set: S({
|
|
3248
3248
|
...be.shape,
|
|
3249
3249
|
...X.shape,
|
|
3250
3250
|
...Q.shape
|
|
3251
3251
|
}).partial(),
|
|
3252
|
-
lerp:
|
|
3252
|
+
lerp: S({
|
|
3253
3253
|
...X.shape,
|
|
3254
3254
|
...Q.shape
|
|
3255
3255
|
}).partial()
|
|
3256
3256
|
}).partial()
|
|
3257
|
-
]),
|
|
3258
|
-
...qs.shape,
|
|
3259
|
-
keyframes: L([Ys], G([Js, Me]))
|
|
3260
|
-
}), oa = T({
|
|
3257
|
+
]), oa = S({
|
|
3261
3258
|
...Ks.shape,
|
|
3262
|
-
keyframes: L([
|
|
3263
|
-
}), ra =
|
|
3259
|
+
keyframes: L([Qs], G([Ys, Ve]))
|
|
3260
|
+
}), ra = S({
|
|
3264
3261
|
...Hs.shape,
|
|
3265
|
-
keyframes: L([
|
|
3266
|
-
}), ia =
|
|
3262
|
+
keyframes: L([ea], G([Xs, Ve]))
|
|
3263
|
+
}), ia = S({
|
|
3264
|
+
...Js.shape,
|
|
3265
|
+
keyframes: L([na], G([ta, Ve]))
|
|
3266
|
+
}), sa = Is(Y(), G([oa, ra, ia])), me = {
|
|
3267
3267
|
opacity: 1,
|
|
3268
3268
|
zIndex: 0
|
|
3269
3269
|
}, we = {
|
|
@@ -3276,94 +3276,411 @@ const be = T({
|
|
|
3276
3276
|
volume: 1,
|
|
3277
3277
|
opacity: 1,
|
|
3278
3278
|
zIndex: 0
|
|
3279
|
-
},
|
|
3279
|
+
}, Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3280
3280
|
__proto__: null,
|
|
3281
|
-
MediaSurfaceStateSchema:
|
|
3281
|
+
MediaSurfaceStateSchema: sa,
|
|
3282
3282
|
defaultAudioOptions: we,
|
|
3283
3283
|
defaultImageOptions: me,
|
|
3284
3284
|
defaultVideoOptions: re
|
|
3285
3285
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
n
|
|
3296
|
-
|
|
3297
|
-
return
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
},
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
return
|
|
3326
|
-
}
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
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) {
|
|
3606
|
+
var t = {};
|
|
3607
|
+
/*! howler.js v2.2.1 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */
|
|
3608
|
+
(function() {
|
|
3609
|
+
var n = function() {
|
|
3610
|
+
this.init();
|
|
3611
|
+
};
|
|
3612
|
+
n.prototype = { init: function() {
|
|
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) {
|
|
3616
|
+
var s = this || o;
|
|
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);
|
|
3623
|
+
}
|
|
3624
|
+
return s;
|
|
3625
|
+
}
|
|
3626
|
+
return s._volume;
|
|
3627
|
+
}, mute: function(r) {
|
|
3628
|
+
var s = this || o;
|
|
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);
|
|
3633
|
+
}
|
|
3634
|
+
return s;
|
|
3635
|
+
}, stop: function() {
|
|
3636
|
+
for (var r = this || o, s = 0; s < r._howls.length; s++) r._howls[s].stop();
|
|
3637
|
+
return r;
|
|
3638
|
+
}, unload: function() {
|
|
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-/, "")];
|
|
3643
|
+
}, _setup: function() {
|
|
3644
|
+
var r = this || o;
|
|
3645
|
+
if (r.state = r.ctx && r.ctx.state || "suspended", r._autoSuspend(), !r.usingWebAudio) if (typeof Audio < "u") try {
|
|
3646
|
+
var s = new Audio();
|
|
3647
|
+
s.oncanplaythrough === void 0 && (r._canPlayEvent = "canplay");
|
|
3648
|
+
} catch {
|
|
3649
|
+
r.noAudio = !0;
|
|
3650
|
+
}
|
|
3651
|
+
else r.noAudio = !0;
|
|
3652
|
+
try {
|
|
3653
|
+
var s = new Audio();
|
|
3654
|
+
s.muted && (r.noAudio = !0);
|
|
3655
|
+
} catch {
|
|
3656
|
+
}
|
|
3657
|
+
return r.noAudio || r._setupCodecs(), r;
|
|
3658
|
+
}, _setupCodecs: function() {
|
|
3659
|
+
var r = this || o, s = null;
|
|
3660
|
+
try {
|
|
3661
|
+
s = typeof Audio < "u" ? new Audio() : null;
|
|
3662
|
+
} catch {
|
|
3663
|
+
return r;
|
|
3664
|
+
}
|
|
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;
|
|
3668
|
+
}, _unlockAudio: function() {
|
|
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);
|
|
3672
|
+
var s = function(u) {
|
|
3673
|
+
for (; r._html5AudioPool.length < r.html5PoolSize; ) try {
|
|
3674
|
+
var p = new Audio();
|
|
3675
|
+
p._unlocked = !0, r._releaseHtml5Audio(p);
|
|
3676
|
+
} catch {
|
|
3677
|
+
r.noAudio = !0;
|
|
3678
|
+
break;
|
|
3679
|
+
}
|
|
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[_]);
|
|
3682
|
+
w && w._node && !w._node._unlocked && (w._node._unlocked = !0, w._node.load());
|
|
3683
|
+
}
|
|
3367
3684
|
r._autoResume();
|
|
3368
3685
|
var E = r.ctx.createBufferSource();
|
|
3369
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() {
|
|
@@ -3392,10 +3709,10 @@ function sa() {
|
|
|
3392
3709
|
return r._suspendTimer && clearTimeout(r._suspendTimer), r._suspendTimer = setTimeout(function() {
|
|
3393
3710
|
if (r.autoSuspend) {
|
|
3394
3711
|
r._suspendTimer = null, r.state = "suspending";
|
|
3395
|
-
var
|
|
3712
|
+
var p = function() {
|
|
3396
3713
|
r.state = "suspended", r._resumeAfterSuspend && (delete r._resumeAfterSuspend, r._autoResume());
|
|
3397
3714
|
};
|
|
3398
|
-
r.ctx.suspend().then(
|
|
3715
|
+
r.ctx.suspend().then(p, p);
|
|
3399
3716
|
}
|
|
3400
3717
|
}, 3e4), r;
|
|
3401
3718
|
}
|
|
@@ -3421,84 +3738,84 @@ function sa() {
|
|
|
3421
3738
|
if (o.noAudio) return void r._emit("loaderror", null, "No audio support.");
|
|
3422
3739
|
typeof r._src == "string" && (r._src = [r._src]);
|
|
3423
3740
|
for (var u = 0; u < r._src.length; u++) {
|
|
3424
|
-
var
|
|
3425
|
-
if (r._format && r._format[u])
|
|
3741
|
+
var p, h;
|
|
3742
|
+
if (r._format && r._format[u]) p = r._format[u];
|
|
3426
3743
|
else {
|
|
3427
3744
|
if (typeof (h = r._src[u]) != "string") {
|
|
3428
3745
|
r._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
|
|
3429
3746
|
continue;
|
|
3430
3747
|
}
|
|
3431
|
-
|
|
3748
|
+
p = /^data:audio\/([^;,]+);/i.exec(h), p || (p = /\.([^.]+)$/.exec(h.split("?", 1)[0])), p && (p = p[1].toLowerCase());
|
|
3432
3749
|
}
|
|
3433
|
-
if (
|
|
3750
|
+
if (p || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), p && o.codecs(p)) {
|
|
3434
3751
|
s = r._src[u];
|
|
3435
3752
|
break;
|
|
3436
3753
|
}
|
|
3437
3754
|
}
|
|
3438
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.");
|
|
3439
3756
|
}, play: function(r, s) {
|
|
3440
|
-
var u = this,
|
|
3441
|
-
if (typeof r == "number")
|
|
3757
|
+
var u = this, p = null;
|
|
3758
|
+
if (typeof r == "number") p = r, r = null;
|
|
3442
3759
|
else {
|
|
3443
3760
|
if (typeof r == "string" && u._state === "loaded" && !u._sprite[r]) return null;
|
|
3444
3761
|
if (r === void 0 && (r = "__default", !u._playLock)) {
|
|
3445
|
-
for (var h = 0, v = 0; v < u._sounds.length; v++) u._sounds[v]._paused && !u._sounds[v]._ended && (h++,
|
|
3446
|
-
h === 1 ? r = null :
|
|
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 _ =
|
|
3766
|
+
var _ = p ? u._soundById(p) : u._inactiveSound();
|
|
3450
3767
|
if (!_) return null;
|
|
3451
|
-
if (
|
|
3768
|
+
if (p && !r && (r = _._sprite || "__default"), u._state !== "loaded") {
|
|
3452
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 (
|
|
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[r][0] / 1e3), k = Math.max(0, (u._sprite[r][0] + u._sprite[r][1]) / 1e3 - E), x = 1e3 * k / Math.abs(_._rate),
|
|
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;
|
|
3461
3778
|
_._sprite = r, _._ended = !1;
|
|
3462
|
-
var
|
|
3463
|
-
_._paused = !1, _._seek = E, _._start =
|
|
3779
|
+
var ke = function() {
|
|
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
|
-
var
|
|
3783
|
+
var T = _._node;
|
|
3467
3784
|
if (u._webAudio) {
|
|
3468
|
-
var
|
|
3469
|
-
u._playLock = !1,
|
|
3785
|
+
var Ge = function() {
|
|
3786
|
+
u._playLock = !1, ke(), u._refreshBuffer(_);
|
|
3470
3787
|
var W = _._muted || u._muted ? 0 : _._volume;
|
|
3471
|
-
|
|
3788
|
+
T.gain.setValueAtTime(W, o.ctx.currentTime), _._playStart = o.ctx.currentTime, T.bufferSource.start === void 0 ? _._loop ? T.bufferSource.noteGrainOn(0, E, 86400) : T.bufferSource.noteGrainOn(0, E, k) : _._loop ? T.bufferSource.start(0, E, 86400) : T.bufferSource.start(0, E, k), x !== 1 / 0 && (u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x)), s || setTimeout(function() {
|
|
3472
3789
|
u._emit("play", _._id), u._loadQueue();
|
|
3473
3790
|
}, 0);
|
|
3474
3791
|
};
|
|
3475
|
-
o.state === "running" && o.ctx.state !== "interrupted" ?
|
|
3792
|
+
o.state === "running" && o.ctx.state !== "interrupted" ? Ge() : (u._playLock = !0, u.once("resume", Ge), u._clearTimer(_._id));
|
|
3476
3793
|
} else {
|
|
3477
|
-
var
|
|
3478
|
-
|
|
3794
|
+
var We = function() {
|
|
3795
|
+
T.currentTime = E, T.muted = _._muted || u._muted || o._muted || T.muted, T.volume = _._volume * o.volume(), T.playbackRate = _._rate;
|
|
3479
3796
|
try {
|
|
3480
|
-
var W =
|
|
3481
|
-
if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (u._playLock = !0,
|
|
3482
|
-
u._playLock = !1,
|
|
3797
|
+
var W = T.play();
|
|
3798
|
+
if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (u._playLock = !0, ke(), W.then(function() {
|
|
3799
|
+
u._playLock = !1, T._unlocked = !0, s || (u._emit("play", _._id), u._loadQueue());
|
|
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
|
-
})) : s || (u._playLock = !1,
|
|
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
3803
|
r !== "__default" || _._loop ? u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x) : (u._endTimers[_._id] = function() {
|
|
3487
|
-
u._ended(_),
|
|
3488
|
-
},
|
|
3489
|
-
} catch (
|
|
3490
|
-
u._emit("playerror", _._id,
|
|
3804
|
+
u._ended(_), T.removeEventListener("ended", u._endTimers[_._id], !1);
|
|
3805
|
+
}, T.addEventListener("ended", u._endTimers[_._id], !1));
|
|
3806
|
+
} catch (tn) {
|
|
3807
|
+
u._emit("playerror", _._id, tn);
|
|
3491
3808
|
}
|
|
3492
3809
|
};
|
|
3493
|
-
|
|
3494
|
-
var
|
|
3495
|
-
if (
|
|
3810
|
+
T.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (T.src = u._src, T.load());
|
|
3811
|
+
var en = window && window.ejecta || !T.readyState && o._navigator.isCocoonJS;
|
|
3812
|
+
if (T.readyState >= 3 || en) We();
|
|
3496
3813
|
else {
|
|
3497
3814
|
u._playLock = !0;
|
|
3498
|
-
var
|
|
3499
|
-
|
|
3815
|
+
var qe = function() {
|
|
3816
|
+
We(), T.removeEventListener(o._canPlayEvent, qe, !1);
|
|
3500
3817
|
};
|
|
3501
|
-
|
|
3818
|
+
T.addEventListener(o._canPlayEvent, qe, !1), u._clearTimer(_._id);
|
|
3502
3819
|
}
|
|
3503
3820
|
}
|
|
3504
3821
|
return _._id;
|
|
@@ -3507,10 +3824,10 @@ function sa() {
|
|
|
3507
3824
|
if (s._state !== "loaded" || s._playLock) return s._queue.push({ event: "pause", action: function() {
|
|
3508
3825
|
s.pause(r);
|
|
3509
3826
|
} }), s;
|
|
3510
|
-
for (var u = s._getSoundIds(r),
|
|
3511
|
-
s._clearTimer(u[
|
|
3512
|
-
var h = s._soundById(u[
|
|
3513
|
-
if (h && !h._paused && (h._seek = s.seek(u[
|
|
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) {
|
|
3514
3831
|
if (!h._node.bufferSource) continue;
|
|
3515
3832
|
h._node.bufferSource.stop === void 0 ? h._node.bufferSource.noteOff(0) : h._node.bufferSource.stop(0), s._cleanBuffer(h._node);
|
|
3516
3833
|
} else isNaN(h._node.duration) && h._node.duration !== 1 / 0 || h._node.pause();
|
|
@@ -3522,10 +3839,10 @@ function sa() {
|
|
|
3522
3839
|
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "stop", action: function() {
|
|
3523
3840
|
u.stop(r, s);
|
|
3524
3841
|
} }), u;
|
|
3525
|
-
for (var
|
|
3526
|
-
u._clearTimer(
|
|
3527
|
-
var v = u._soundById(
|
|
3528
|
-
v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, u._stopFade(
|
|
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
3848
|
}, mute: function(r, s) {
|
|
@@ -3537,69 +3854,69 @@ function sa() {
|
|
|
3537
3854
|
if (typeof r != "boolean") return u._muted;
|
|
3538
3855
|
u._muted = r;
|
|
3539
3856
|
}
|
|
3540
|
-
for (var
|
|
3541
|
-
var v = u._soundById(
|
|
3857
|
+
for (var p = u._getSoundIds(s), h = 0; h < p.length; h++) {
|
|
3858
|
+
var v = u._soundById(p[h]);
|
|
3542
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 r, s, u = this,
|
|
3547
|
-
if (
|
|
3548
|
-
|
|
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));
|
|
3549
3866
|
var h;
|
|
3550
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,
|
|
3869
|
+
u.volume.apply(u, p);
|
|
3553
3870
|
} }), u;
|
|
3554
3871
|
s === void 0 && (u._volume = r), s = u._getSoundIds(s);
|
|
3555
|
-
for (var v = 0; v < s.length; v++) (h = u._soundById(s[v])) && (h._volume = r,
|
|
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(r, s, u,
|
|
3874
|
+
}, fade: function(r, s, u, p) {
|
|
3558
3875
|
var h = this;
|
|
3559
3876
|
if (h._state !== "loaded" || h._playLock) return h._queue.push({ event: "fade", action: function() {
|
|
3560
|
-
h.fade(r, s, u,
|
|
3877
|
+
h.fade(r, s, u, p);
|
|
3561
3878
|
} }), h;
|
|
3562
|
-
r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), u = parseFloat(u), h.volume(r,
|
|
3563
|
-
for (var v = h._getSoundIds(
|
|
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; _++) {
|
|
3564
3881
|
var w = h._soundById(v[_]);
|
|
3565
3882
|
if (w) {
|
|
3566
|
-
if (
|
|
3883
|
+
if (p || h._stopFade(v[_]), h._webAudio && !w._muted) {
|
|
3567
3884
|
var E = o.ctx.currentTime, k = E + u / 1e3;
|
|
3568
3885
|
w._volume = r, w._node.gain.setValueAtTime(r, E), w._node.gain.linearRampToValueAtTime(s, k);
|
|
3569
3886
|
}
|
|
3570
|
-
h._startFadeInterval(w, r, s, u, v[_],
|
|
3887
|
+
h._startFadeInterval(w, r, s, u, v[_], p === void 0);
|
|
3571
3888
|
}
|
|
3572
3889
|
}
|
|
3573
3890
|
return h;
|
|
3574
|
-
}, _startFadeInterval: function(r, s, u,
|
|
3575
|
-
var _ = this, w = s, E = u - s, k = Math.abs(E / 0.01), x = Math.max(4, k > 0 ?
|
|
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();
|
|
3576
3893
|
r._fadeTo = u, r._interval = setInterval(function() {
|
|
3577
|
-
var se = (Date.now() -
|
|
3578
|
-
|
|
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
3897
|
}, _stopFade: function(r) {
|
|
3581
3898
|
var s = this, u = s._soundById(r);
|
|
3582
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 r, s, u,
|
|
3585
|
-
if (h.length === 0) return
|
|
3901
|
+
var r, s, u, p = this, h = arguments;
|
|
3902
|
+
if (h.length === 0) return p._loop;
|
|
3586
3903
|
if (h.length === 1) {
|
|
3587
|
-
if (typeof h[0] != "boolean") return !!(u =
|
|
3588
|
-
r = h[0],
|
|
3904
|
+
if (typeof h[0] != "boolean") return !!(u = p._soundById(parseInt(h[0], 10))) && u._loop;
|
|
3905
|
+
r = h[0], p._loop = r;
|
|
3589
3906
|
} else h.length === 2 && (r = h[0], s = parseInt(h[1], 10));
|
|
3590
|
-
for (var v =
|
|
3591
|
-
return
|
|
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 r, s, u = this,
|
|
3594
|
-
if (
|
|
3595
|
-
else if (
|
|
3596
|
-
var h = u._getSoundIds(), v = h.indexOf(
|
|
3597
|
-
v >= 0 ? s = parseInt(
|
|
3598
|
-
} else
|
|
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
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,
|
|
3919
|
+
u.rate.apply(u, p);
|
|
3603
3920
|
} }), u;
|
|
3604
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])) {
|
|
@@ -3609,15 +3926,15 @@ function sa() {
|
|
|
3609
3926
|
}
|
|
3610
3927
|
return u;
|
|
3611
3928
|
}, seek: function() {
|
|
3612
|
-
var r, s, u = this,
|
|
3613
|
-
if (
|
|
3614
|
-
else if (
|
|
3615
|
-
var h = u._getSoundIds(), v = h.indexOf(
|
|
3616
|
-
v >= 0 ? s = parseInt(
|
|
3617
|
-
} else
|
|
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
3936
|
if (typeof r == "number" && (u._state !== "loaded" || u._playLock)) return u._queue.push({ event: "seek", action: function() {
|
|
3620
|
-
u.seek.apply(u,
|
|
3937
|
+
u.seek.apply(u, p);
|
|
3621
3938
|
} }), u;
|
|
3622
3939
|
var _ = u._soundById(s);
|
|
3623
3940
|
if (_) {
|
|
@@ -3634,10 +3951,10 @@ function sa() {
|
|
|
3634
3951
|
u._emit("seek", s), k && u.play(s, !0);
|
|
3635
3952
|
};
|
|
3636
3953
|
if (k && !u._webAudio) {
|
|
3637
|
-
var
|
|
3638
|
-
u._playLock ? setTimeout(
|
|
3954
|
+
var U = function() {
|
|
3955
|
+
u._playLock ? setTimeout(U, 0) : x();
|
|
3639
3956
|
};
|
|
3640
|
-
setTimeout(
|
|
3957
|
+
setTimeout(U, 0);
|
|
3641
3958
|
} else x();
|
|
3642
3959
|
}
|
|
3643
3960
|
return u;
|
|
@@ -3647,28 +3964,28 @@ function sa() {
|
|
|
3647
3964
|
var u = s._soundById(r);
|
|
3648
3965
|
return !!u && !u._paused;
|
|
3649
3966
|
}
|
|
3650
|
-
for (var
|
|
3967
|
+
for (var p = 0; p < s._sounds.length; p++) if (!s._sounds[p]._paused) return !0;
|
|
3651
3968
|
return !1;
|
|
3652
3969
|
}, duration: function(r) {
|
|
3653
|
-
var s = this, u = s._duration,
|
|
3654
|
-
return
|
|
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
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);
|
|
3659
|
-
var
|
|
3660
|
-
|
|
3976
|
+
var p = o._howls.indexOf(r);
|
|
3977
|
+
p >= 0 && o._howls.splice(p, 1);
|
|
3661
3978
|
var h = !0;
|
|
3662
3979
|
for (u = 0; u < o._howls.length; u++) if (o._howls[u]._src === r._src || r._src.indexOf(o._howls[u]._src) >= 0) {
|
|
3663
3980
|
h = !1;
|
|
3664
3981
|
break;
|
|
3665
3982
|
}
|
|
3666
3983
|
return c && h && delete c[r._src], o.noAudio = !1, r._state = "unloaded", r._sounds = [], r = null, null;
|
|
3667
|
-
}, on: function(r, s, u,
|
|
3984
|
+
}, on: function(r, s, u, p) {
|
|
3668
3985
|
var h = this, v = h["_on" + r];
|
|
3669
|
-
return typeof s == "function" && v.push(
|
|
3986
|
+
return typeof s == "function" && v.push(p ? { id: u, fn: s, once: p } : { id: u, fn: s }), h;
|
|
3670
3987
|
}, off: function(r, s, u) {
|
|
3671
|
-
var
|
|
3988
|
+
var p = this, h = p["_on" + r], v = 0;
|
|
3672
3989
|
if (typeof s == "number" && (u = s, s = null), s || u) for (v = 0; v < h.length; v++) {
|
|
3673
3990
|
var _ = u === h[v].id;
|
|
3674
3991
|
if (s === h[v].fn && _ || !s && _) {
|
|
@@ -3676,20 +3993,20 @@ function sa() {
|
|
|
3676
3993
|
break;
|
|
3677
3994
|
}
|
|
3678
3995
|
}
|
|
3679
|
-
else if (r)
|
|
3996
|
+
else if (r) p["_on" + r] = [];
|
|
3680
3997
|
else {
|
|
3681
|
-
var w = Object.keys(
|
|
3682
|
-
for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(
|
|
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
|
|
4001
|
+
return p;
|
|
3685
4002
|
}, once: function(r, s, u) {
|
|
3686
|
-
var
|
|
3687
|
-
return
|
|
4003
|
+
var p = this;
|
|
4004
|
+
return p.on(r, s, u, 1), p;
|
|
3688
4005
|
}, _emit: function(r, s, u) {
|
|
3689
|
-
for (var
|
|
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(
|
|
3692
|
-
return
|
|
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;
|
|
3693
4010
|
}, _loadQueue: function(r) {
|
|
3694
4011
|
var s = this;
|
|
3695
4012
|
if (s._queue.length > 0) {
|
|
@@ -3700,13 +4017,13 @@ function sa() {
|
|
|
3700
4017
|
}, _ended: function(r) {
|
|
3701
4018
|
var s = this, u = r._sprite;
|
|
3702
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;
|
|
3703
|
-
var
|
|
3704
|
-
if (s._emit("end", r._id), !s._webAudio &&
|
|
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) {
|
|
3705
4022
|
s._emit("play", r._id), r._seek = r._start || 0, r._rateSeek = 0, r._playStart = o.ctx.currentTime;
|
|
3706
4023
|
var h = 1e3 * (r._stop - r._start) / Math.abs(r._rate);
|
|
3707
4024
|
s._endTimers[r._id] = setTimeout(s._ended.bind(s, r), h);
|
|
3708
4025
|
}
|
|
3709
|
-
return s._webAudio && !
|
|
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;
|
|
3710
4027
|
}, _clearTimer: function(r) {
|
|
3711
4028
|
var s = this;
|
|
3712
4029
|
if (s._endTimers[r]) {
|
|
@@ -3727,18 +4044,18 @@ function sa() {
|
|
|
3727
4044
|
for (var s = 0; s < r._sounds.length; s++) if (r._sounds[s]._ended) return r._sounds[s].reset();
|
|
3728
4045
|
return new a(r);
|
|
3729
4046
|
}, _drain: function() {
|
|
3730
|
-
var r = this, s = r._pool, u = 0,
|
|
4047
|
+
var r = this, s = r._pool, u = 0, p = 0;
|
|
3731
4048
|
if (!(r._sounds.length < s)) {
|
|
3732
|
-
for (
|
|
3733
|
-
for (
|
|
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
|
-
r._sounds[
|
|
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
4055
|
}, _getSoundIds: function(r) {
|
|
3739
4056
|
var s = this;
|
|
3740
4057
|
if (r === void 0) {
|
|
3741
|
-
for (var u = [],
|
|
4058
|
+
for (var u = [], p = 0; p < s._sounds.length; p++) u.push(s._sounds[p]._id);
|
|
3742
4059
|
return u;
|
|
3743
4060
|
}
|
|
3744
4061
|
return [r];
|
|
@@ -3781,8 +4098,8 @@ function sa() {
|
|
|
3781
4098
|
var s = r._src;
|
|
3782
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]),
|
|
3785
|
-
f(
|
|
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
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(_) {
|
|
@@ -3793,9 +4110,9 @@ function sa() {
|
|
|
3793
4110
|
f(v.response, r);
|
|
3794
4111
|
}, v.onerror = function() {
|
|
3795
4112
|
r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete c[s], r.load());
|
|
3796
|
-
},
|
|
4113
|
+
}, d(v);
|
|
3797
4114
|
}
|
|
3798
|
-
},
|
|
4115
|
+
}, d = function(r) {
|
|
3799
4116
|
try {
|
|
3800
4117
|
r.send();
|
|
3801
4118
|
} catch {
|
|
@@ -3804,10 +4121,10 @@ function sa() {
|
|
|
3804
4121
|
}, f = function(r, s) {
|
|
3805
4122
|
var u = function() {
|
|
3806
4123
|
s._emit("loaderror", null, "Decoding audio data failed.");
|
|
3807
|
-
},
|
|
4124
|
+
}, p = function(h) {
|
|
3808
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(r).then(
|
|
4127
|
+
typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(p).catch(u) : o.ctx.decodeAudioData(r, p, u);
|
|
3811
4128
|
}, y = function(r, s) {
|
|
3812
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() {
|
|
@@ -3820,19 +4137,19 @@ function sa() {
|
|
|
3820
4137
|
o.ctx || (o.usingWebAudio = !1);
|
|
3821
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;
|
|
3822
4139
|
if (r && u && u < 9) {
|
|
3823
|
-
var
|
|
3824
|
-
o._navigator && !
|
|
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
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
|
-
}(
|
|
4148
|
+
}(ze)), ze;
|
|
3832
4149
|
}
|
|
3833
|
-
var
|
|
3834
|
-
const
|
|
3835
|
-
class
|
|
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 }) => {
|
|
@@ -3868,8 +4185,8 @@ class Ta {
|
|
|
3868
4185
|
const n = () => {
|
|
3869
4186
|
const o = Object.entries(this.audioClipPlayers).map(([i, a]) => {
|
|
3870
4187
|
const c = Object.values(a.activeClips), l = c.some(
|
|
3871
|
-
({ state:
|
|
3872
|
-
) ? "playing" : c.some(({ state:
|
|
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";
|
|
3873
4190
|
return [i, l];
|
|
3874
4191
|
});
|
|
3875
4192
|
t.sendInitialMediaClipStates({ mediaType: "audio", files: o });
|
|
@@ -3881,20 +4198,20 @@ class Ta {
|
|
|
3881
4198
|
audioClipPlayers = {};
|
|
3882
4199
|
sinkId = "";
|
|
3883
4200
|
setGlobalVolume(t) {
|
|
3884
|
-
this.globalVolume = t,
|
|
4201
|
+
this.globalVolume = t, Et.Howler.volume(t), this.notifyStateListeners();
|
|
3885
4202
|
}
|
|
3886
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)),
|
|
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 f = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 ||
|
|
3893
|
-
return
|
|
3894
|
-
c.player.off("fade", void 0, g), c.player.loop(a, g), this.updateActiveAudioClip(t, g, (r) => ({ ...r, state: { type: "playing" } })), ne(i) ? oe(c.player, o, i * 1e3, g) :
|
|
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);
|
|
3895
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
|
-
|
|
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
|
() => {
|
|
@@ -3921,35 +4238,35 @@ class Ta {
|
|
|
3921
4238
|
oe(c.player, o, i * 1e3, g);
|
|
3922
4239
|
},
|
|
3923
4240
|
g
|
|
3924
|
-
)) :
|
|
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
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
|
|
3932
|
-
return (o === void 0 || o ===
|
|
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
4251
|
(f) => {
|
|
3935
4252
|
a.player.pause(f), this.updateActiveAudioClip(t, f, (y) => ({ ...y, state: { type: "paused" } })), this.notifyClipStateListeners(l.playId, t, "paused");
|
|
3936
4253
|
},
|
|
3937
|
-
|
|
3938
|
-
), oe(a.player, 0, n * 1e3,
|
|
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
4259
|
stopAudioClip(t, { fade: n }, o, i) {
|
|
3943
|
-
|
|
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
|
|
3946
|
-
return (o === void 0 || o ===
|
|
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
4265
|
(f) => {
|
|
3949
4266
|
a.player.loop(!1, f), a.player.stop(f);
|
|
3950
4267
|
},
|
|
3951
|
-
|
|
3952
|
-
), l.state = { type: "stopping" }) : (a.player.loop(!1,
|
|
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
|
}
|
|
@@ -3967,7 +4284,7 @@ class Ta {
|
|
|
3967
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(i.player, n, o * 1e3, l) :
|
|
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
|
})
|
|
@@ -3989,7 +4306,7 @@ class Ta {
|
|
|
3989
4306
|
}
|
|
3990
4307
|
setAudioSink(t) {
|
|
3991
4308
|
for (const n of Object.values(this.audioClipPlayers))
|
|
3992
|
-
|
|
4309
|
+
Ie(n.player, t);
|
|
3993
4310
|
this.sinkId = t;
|
|
3994
4311
|
}
|
|
3995
4312
|
updateConfig(t) {
|
|
@@ -4002,13 +4319,13 @@ class Ta {
|
|
|
4002
4319
|
this.audioClipPlayers = (() => {
|
|
4003
4320
|
const i = { ...o };
|
|
4004
4321
|
return Object.keys(o).filter(
|
|
4005
|
-
(
|
|
4006
|
-
).forEach((
|
|
4007
|
-
o[
|
|
4008
|
-
}), Object.entries(n).filter(([
|
|
4009
|
-
i[
|
|
4010
|
-
}), Object.keys(o).filter((
|
|
4011
|
-
i[
|
|
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 });
|
|
4012
4329
|
}), i;
|
|
4013
4330
|
})(), this.notifyStateListeners();
|
|
4014
4331
|
}
|
|
@@ -4042,7 +4359,7 @@ class Ta {
|
|
|
4042
4359
|
this.eventTarget.dispatchEvent(new CustomEvent(t, { detail: n }));
|
|
4043
4360
|
}
|
|
4044
4361
|
createPlayer(t, n) {
|
|
4045
|
-
const o = new
|
|
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 Ta {
|
|
|
4050
4367
|
html5: !0,
|
|
4051
4368
|
preload: n.preload
|
|
4052
4369
|
});
|
|
4053
|
-
return
|
|
4370
|
+
return Ie(o, this.sinkId), o;
|
|
4054
4371
|
}
|
|
4055
4372
|
createClip(t, n) {
|
|
4056
4373
|
return {
|
|
@@ -4064,24 +4381,24 @@ class Ta {
|
|
|
4064
4381
|
return n.config.preload !== o.preload && (i.player.unload(), i.player = this.createPlayer(t, o)), i;
|
|
4065
4382
|
}
|
|
4066
4383
|
}
|
|
4067
|
-
function
|
|
4384
|
+
function Ta(...e) {
|
|
4068
4385
|
}
|
|
4069
4386
|
function ne(e) {
|
|
4070
|
-
return !
|
|
4387
|
+
return !Aa && typeof e == "number" && !isNaN(e) && e > 0;
|
|
4071
4388
|
}
|
|
4072
|
-
function
|
|
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
|
|
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
|
-
var
|
|
4084
|
-
class
|
|
4400
|
+
var Le = /* @__PURE__ */ ((e) => (e.Paused = "paused", e.Playing = "playing", e))(Le || {});
|
|
4401
|
+
class Za {
|
|
4085
4402
|
constructor(t, n = document.body) {
|
|
4086
4403
|
this.cogsConnection = t, this.parentElement = n, this.addEventListener("videoClipState", ({ detail: i }) => {
|
|
4087
4404
|
t.sendMediaClipState(i);
|
|
@@ -4185,21 +4502,21 @@ class za {
|
|
|
4185
4502
|
}
|
|
4186
4503
|
setAudioSink(t) {
|
|
4187
4504
|
for (const n of Object.values(this.videoClipPlayers))
|
|
4188
|
-
|
|
4505
|
+
Ct(n, t);
|
|
4189
4506
|
this.sinkId = t;
|
|
4190
4507
|
}
|
|
4191
4508
|
updateConfig(t) {
|
|
4192
4509
|
const n = Object.fromEntries(Object.entries(t).filter(([, { type: i }]) => i === "video" || !i)), o = this.videoClipPlayers;
|
|
4193
4510
|
this.videoClipPlayers = (() => {
|
|
4194
4511
|
const i = { ...o };
|
|
4195
|
-
return Object.keys(o).filter((
|
|
4196
|
-
this.activeClip?.path ===
|
|
4197
|
-
}), Object.entries(n).filter(([
|
|
4198
|
-
i[
|
|
4199
|
-
}), Object.entries(o).filter(([
|
|
4200
|
-
f.config.preload !== n[
|
|
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:
|
|
4519
|
+
preload: kt(n[d].preload),
|
|
4203
4520
|
ephemeral: !1
|
|
4204
4521
|
}, y.videoElement.preload = y.config.preload, y));
|
|
4205
4522
|
}), i;
|
|
@@ -4212,7 +4529,7 @@ class za {
|
|
|
4212
4529
|
clips: { ...this.videoClipPlayers },
|
|
4213
4530
|
activeClip: this.activeClip ? {
|
|
4214
4531
|
path: this.activeClip.path,
|
|
4215
|
-
state: this.videoClipPlayers[this.activeClip.path].videoElement?.paused ?
|
|
4532
|
+
state: this.videoClipPlayers[this.activeClip.path].videoElement?.paused ? Le.Paused : Le.Playing,
|
|
4216
4533
|
loop: this.videoClipPlayers[this.activeClip.path].videoElement?.loop ?? !1,
|
|
4217
4534
|
volume: this.videoClipPlayers[this.activeClip.path].videoElement?.muted ? 0 : this.videoClipPlayers[this.activeClip.path].videoElement?.volume ?? 0
|
|
4218
4535
|
} : void 0
|
|
@@ -4262,7 +4579,7 @@ class za {
|
|
|
4262
4579
|
videoElement: this.createVideoElement(t, n, { volume: 1 }),
|
|
4263
4580
|
volume: 1
|
|
4264
4581
|
};
|
|
4265
|
-
return
|
|
4582
|
+
return Ct(i, this.sinkId), i;
|
|
4266
4583
|
}
|
|
4267
4584
|
unloadClip(t) {
|
|
4268
4585
|
if (this.activeClip?.path === t) {
|
|
@@ -4272,314 +4589,37 @@ class za {
|
|
|
4272
4589
|
this.videoClipPlayers[t]?.videoElement.remove(), this.updateVideoClipPlayer(t, () => null);
|
|
4273
4590
|
}
|
|
4274
4591
|
}
|
|
4275
|
-
function
|
|
4592
|
+
function kt(e) {
|
|
4276
4593
|
return typeof e == "string" ? e : e ? "auto" : "none";
|
|
4277
4594
|
}
|
|
4278
|
-
function
|
|
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
|
-
|
|
4285
|
-
switch (e.type) {
|
|
4286
|
-
case "image": {
|
|
4287
|
-
if (e.keyframes[0][0] > t)
|
|
4288
|
-
return;
|
|
4289
|
-
const o = e.keyframes.filter((a) => a[1] !== null), i = ze(o, t);
|
|
4290
|
-
return { ...me, ...i };
|
|
4291
|
-
}
|
|
4292
|
-
case "audio": {
|
|
4293
|
-
const n = e.keyframes.filter((a) => a[1] !== null), o = wt(n, t);
|
|
4294
|
-
if (!o)
|
|
4295
|
-
return;
|
|
4296
|
-
const i = ze(n, t);
|
|
4297
|
-
return { ...we, ...i, ...o };
|
|
4298
|
-
}
|
|
4299
|
-
case "video": {
|
|
4300
|
-
const n = e.keyframes.filter((a) => a[1] !== null), o = wt(n, t);
|
|
4301
|
-
if (!o)
|
|
4302
|
-
return;
|
|
4303
|
-
const i = ze(n, t);
|
|
4304
|
-
return { ...re, ...i, ...o };
|
|
4305
|
-
}
|
|
4306
|
-
}
|
|
4307
|
-
}
|
|
4308
|
-
function ze(e, t) {
|
|
4309
|
-
const n = {};
|
|
4310
|
-
for (const [i, a] of e)
|
|
4311
|
-
i <= t ? (Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
4312
|
-
n[c] ??= {}, n[c].before = [i, l];
|
|
4313
|
-
}), Object.entries(a.set ?? {}).forEach(([c, l]) => {
|
|
4314
|
-
n[c] ??= {}, n[c].before = [i, l];
|
|
4315
|
-
})) : Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
4316
|
-
n[c] ??= {}, n[c].after === void 0 && (n[c].after = [i, l]);
|
|
4317
|
-
});
|
|
4318
|
-
const o = {};
|
|
4319
|
-
return Object.entries(n).forEach(
|
|
4320
|
-
([i, { before: a, after: c }]) => {
|
|
4321
|
-
if (c === void 0 && a) {
|
|
4322
|
-
o[i] = a[1];
|
|
4323
|
-
return;
|
|
4324
|
-
}
|
|
4325
|
-
if (a && c && a[0] === c[0]) {
|
|
4326
|
-
o[i] = c[1];
|
|
4327
|
-
return;
|
|
4328
|
-
}
|
|
4329
|
-
if (a && typeof a[1] == "number" && c && typeof c[1] == "number") {
|
|
4330
|
-
o[i] = a[1] + (t - a[0]) * (c[1] - a[1]) / (c[0] - a[0]);
|
|
4331
|
-
return;
|
|
4332
|
-
}
|
|
4333
|
-
}
|
|
4334
|
-
), o;
|
|
4335
|
-
}
|
|
4336
|
-
function wt(e, t) {
|
|
4337
|
-
const n = e[0];
|
|
4338
|
-
if (!n || n[0] > t)
|
|
4339
|
-
return;
|
|
4340
|
-
let o = 0, { t: i, rate: a } = we;
|
|
4341
|
-
for (const [f, y] of e) {
|
|
4342
|
-
if (f > t) break;
|
|
4343
|
-
const { set: g } = y;
|
|
4344
|
-
if (!g) continue;
|
|
4345
|
-
const { t: r, rate: s } = g;
|
|
4346
|
-
if (r !== void 0) {
|
|
4347
|
-
o = f, i = r, s !== void 0 && (a = s);
|
|
4348
|
-
continue;
|
|
4349
|
-
}
|
|
4350
|
-
if (s !== void 0) {
|
|
4351
|
-
const d = (f - o) * a;
|
|
4352
|
-
o = f, i += d, a = s;
|
|
4353
|
-
}
|
|
4354
|
-
}
|
|
4355
|
-
const l = (t - o) * a, p = i + l;
|
|
4356
|
-
return {
|
|
4357
|
-
rate: a,
|
|
4358
|
-
t: p
|
|
4359
|
-
};
|
|
4360
|
-
}
|
|
4361
|
-
const ca = 1e3;
|
|
4362
|
-
class Ve {
|
|
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 = ca;
|
|
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(), this.timeout = setTimeout(this.loop, this.delay)) : this.destroy();
|
|
4381
|
-
};
|
|
4382
|
-
}
|
|
4383
|
-
class la extends Ve {
|
|
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 = Ue(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 da = 1e3, Et = 10, Yt = 1e3, pa = 200, ha = 0.5, fa = 0.3;
|
|
4405
|
-
function _a(e) {
|
|
4406
|
-
return Math.sign(e) * Math.pow(Math.abs(e) / Yt, fa) * ha;
|
|
4407
|
-
}
|
|
4408
|
-
class ma extends Ve {
|
|
4409
|
-
videoElement;
|
|
4410
|
-
isSeeking = !1;
|
|
4411
|
-
constructor(t, n, o) {
|
|
4412
|
-
super(t, n, o), this.clipElement = n;
|
|
4413
|
-
}
|
|
4414
|
-
updateVideoElement() {
|
|
4415
|
-
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%";
|
|
4416
|
-
}
|
|
4417
|
-
/**
|
|
4418
|
-
* Helper function to seek to a specified time.
|
|
4419
|
-
* Works with the update loop to poll until seeked event has fired.
|
|
4420
|
-
*/
|
|
4421
|
-
seekTo(t) {
|
|
4422
|
-
this.videoElement && (this.videoElement.addEventListener(
|
|
4423
|
-
"seeked",
|
|
4424
|
-
() => {
|
|
4425
|
-
this.isSeeking = !1;
|
|
4426
|
-
},
|
|
4427
|
-
{ once: !0, passive: !0 }
|
|
4428
|
-
), this.videoElement.currentTime = t / 1e3);
|
|
4429
|
-
}
|
|
4430
|
-
update() {
|
|
4431
|
-
if (this.isSeeking) return;
|
|
4432
|
-
this.delay = da;
|
|
4433
|
-
const t = Ue(this._state, Date.now());
|
|
4434
|
-
if (t ? (!this.videoElement || !this.isConnected(this.videoElement)) && this.updateVideoElement() : (this.videoElement?.remove(), this.videoElement = void 0), !t || !this.videoElement) return;
|
|
4435
|
-
const { t: n, rate: o, volume: i } = { ...re, ...t };
|
|
4436
|
-
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) !== t.opacity && (this.videoElement.style.opacity = String(t.opacity ?? re.opacity));
|
|
4437
|
-
const a = Math.round(t.zIndex ?? re.zIndex);
|
|
4438
|
-
parseInt(this.videoElement.style.zIndex) !== a && (this.videoElement.style.zIndex = String(a)), this.videoElement.volume !== i && (this.videoElement.volume = i), this.videoElement.paused && o > 0 && this.videoElement.play().catch(() => {
|
|
4439
|
-
});
|
|
4440
|
-
const l = this.videoElement.currentTime * 1e3 - n, p = Math.abs(l);
|
|
4441
|
-
switch (this.delay = 100, !0) {
|
|
4442
|
-
case p <= Et:
|
|
4443
|
-
this.videoElement.playbackRate !== o && (this.videoElement.playbackRate = o);
|
|
4444
|
-
break;
|
|
4445
|
-
case (o > 0 && p > Et && p <= Yt): {
|
|
4446
|
-
const f = _a(l), y = Math.max(0, o - f);
|
|
4447
|
-
this.videoElement.playbackRate !== y && (this.videoElement.playbackRate = y);
|
|
4448
|
-
break;
|
|
4449
|
-
}
|
|
4450
|
-
default: {
|
|
4451
|
-
this.videoElement.playbackRate !== o && (this.videoElement.playbackRate = o), this.delay = 10, this.seekTo(n + o * (pa / 1e3));
|
|
4452
|
-
break;
|
|
4453
|
-
}
|
|
4454
|
-
}
|
|
4455
|
-
}
|
|
4456
|
-
destroy() {
|
|
4457
|
-
this.videoElement && (this.videoElement.src = "", this.videoElement.remove());
|
|
4458
|
-
}
|
|
4459
|
-
}
|
|
4460
|
-
const va = 1e3, kt = 10, Qt = 1e3, ga = 200, ya = 0.2, ba = 0.5;
|
|
4461
|
-
function wa(e) {
|
|
4462
|
-
return Math.sign(e) * Math.pow(Math.abs(e) / Qt, ba) * ya;
|
|
4463
|
-
}
|
|
4464
|
-
class Ea extends Ve {
|
|
4465
|
-
audioElement;
|
|
4466
|
-
isSeeking = !1;
|
|
4467
|
-
constructor(t, n, o) {
|
|
4468
|
-
super(t, n, o), this.clipElement = n;
|
|
4469
|
-
}
|
|
4470
|
-
updateAudioElement() {
|
|
4471
|
-
this.destroy(), this.audioElement = document.createElement("audio"), this.clipElement.replaceChildren(this.audioElement);
|
|
4472
|
-
}
|
|
4473
|
-
/**
|
|
4474
|
-
* Helper function to seek to a specified time.
|
|
4475
|
-
* Works with the update loop to poll until seeked event has fired.
|
|
4476
|
-
*/
|
|
4477
|
-
seekTo(t) {
|
|
4478
|
-
this.audioElement && (this.audioElement.addEventListener(
|
|
4479
|
-
"seeked",
|
|
4480
|
-
() => {
|
|
4481
|
-
this.isSeeking = !1;
|
|
4482
|
-
},
|
|
4483
|
-
{ once: !0, passive: !0 }
|
|
4484
|
-
), this.audioElement.currentTime = t / 1e3);
|
|
4485
|
-
}
|
|
4486
|
-
update() {
|
|
4487
|
-
if (this.isSeeking) return;
|
|
4488
|
-
this.delay = va;
|
|
4489
|
-
const t = Ue(this._state, Date.now());
|
|
4490
|
-
if (t ? (!this.audioElement || !this.isConnected(this.audioElement)) && this.updateAudioElement() : this.destroy(), !t || !this.audioElement) return;
|
|
4491
|
-
const { t: n, rate: o, volume: i } = { ...we, ...t };
|
|
4492
|
-
this.audioElement.src.endsWith(this._state.file) || (this.audioElement.src = this._state.file), this.audioElement.volume !== i && (this.audioElement.volume = i), this.audioElement.paused && o > 0 && this.audioElement.play().catch(() => {
|
|
4493
|
-
});
|
|
4494
|
-
const c = this.audioElement.currentTime * 1e3 - n, l = Math.abs(c);
|
|
4495
|
-
switch (this.delay = 100, !0) {
|
|
4496
|
-
case l <= kt:
|
|
4497
|
-
this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o);
|
|
4498
|
-
break;
|
|
4499
|
-
case (o > 0 && l > kt && l <= Qt): {
|
|
4500
|
-
const p = wa(c), f = Math.max(0, o - p);
|
|
4501
|
-
this.audioElement.playbackRate !== f && (this.audioElement.playbackRate = f);
|
|
4502
|
-
break;
|
|
4503
|
-
}
|
|
4504
|
-
default: {
|
|
4505
|
-
this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o), this.delay = 10, this.seekTo(n + o * (ga / 1e3));
|
|
4506
|
-
break;
|
|
4507
|
-
}
|
|
4508
|
-
}
|
|
4509
|
-
}
|
|
4510
|
-
destroy() {
|
|
4511
|
-
this.audioElement && (this.audioElement.src = "", this.audioElement.remove());
|
|
4512
|
-
}
|
|
4513
|
-
}
|
|
4514
|
-
const ka = "data-clip-id";
|
|
4515
|
-
class Ia {
|
|
4516
|
-
_state = {};
|
|
4517
|
-
setState(t) {
|
|
4518
|
-
this._state = t, this.update();
|
|
4519
|
-
}
|
|
4520
|
-
_element;
|
|
4521
|
-
get element() {
|
|
4522
|
-
return this._element;
|
|
4523
|
-
}
|
|
4524
|
-
resources = {};
|
|
4525
|
-
constructor(t) {
|
|
4526
|
-
this._element = document.createElement("div"), this._element.style.width = "100%", this._element.style.height = "100%", this._state = t || {}, this.update();
|
|
4527
|
-
}
|
|
4528
|
-
update() {
|
|
4529
|
-
Object.entries(this.resources).forEach(([n, { element: o, manager: i }]) => {
|
|
4530
|
-
n in this._state || (delete this.resources[n], o.remove(), i?.destroy());
|
|
4531
|
-
});
|
|
4532
|
-
const t = Object.keys(this._state).toSorted().map((n) => {
|
|
4533
|
-
const o = this.resources[n];
|
|
4534
|
-
if (o)
|
|
4535
|
-
return o.element;
|
|
4536
|
-
{
|
|
4537
|
-
const i = document.createElement("div");
|
|
4538
|
-
return i.setAttribute(ka, n), this.resources[n] = { element: i }, i;
|
|
4539
|
-
}
|
|
4540
|
-
});
|
|
4541
|
-
this._element.replaceChildren(...t), Object.keys(this._state).toSorted().forEach((n) => {
|
|
4542
|
-
const o = this._state[n], i = this.resources[n];
|
|
4543
|
-
if (!i)
|
|
4544
|
-
throw new Error("Failed to create resource");
|
|
4545
|
-
if (i.manager)
|
|
4546
|
-
i.manager.setState(o);
|
|
4547
|
-
else
|
|
4548
|
-
switch (o.type) {
|
|
4549
|
-
case "image":
|
|
4550
|
-
i.manager = new la(this._element, i.element, o);
|
|
4551
|
-
break;
|
|
4552
|
-
case "audio":
|
|
4553
|
-
i.manager = new Ea(this._element, i.element, o);
|
|
4554
|
-
break;
|
|
4555
|
-
case "video":
|
|
4556
|
-
i.manager = new ma(this._element, i.element, o);
|
|
4557
|
-
break;
|
|
4558
|
-
}
|
|
4559
|
-
});
|
|
4560
|
-
}
|
|
4561
|
-
}
|
|
4562
|
-
const $a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4601
|
+
const Pa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4563
4602
|
__proto__: null
|
|
4564
4603
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4565
4604
|
export {
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4605
|
+
Oa as CogsAudioPlayer,
|
|
4606
|
+
Cn as CogsConfigChangedEvent,
|
|
4607
|
+
za as CogsConnection,
|
|
4608
|
+
En as CogsConnectionCloseEvent,
|
|
4609
|
+
wn as CogsConnectionOpenEvent,
|
|
4610
|
+
Tn as CogsIncomingEvent,
|
|
4572
4611
|
Sn as CogsMediaConfigChangedEvent,
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
Ke as
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
Ia as
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4612
|
+
kn as CogsMessageEvent,
|
|
4613
|
+
zn as CogsShowPhaseChangedEvent,
|
|
4614
|
+
An as CogsStateChangedEvent,
|
|
4615
|
+
Za as CogsVideoPlayer,
|
|
4616
|
+
ka as DATA_CLIP_ID,
|
|
4617
|
+
Ke as DataStoreItemEvent,
|
|
4618
|
+
He as DataStoreItemsEvent,
|
|
4619
|
+
Pa as ManifestTypes,
|
|
4620
|
+
Ia as MediaSchema,
|
|
4621
|
+
$a as SurfaceManager,
|
|
4622
|
+
dn as assetUrl,
|
|
4623
|
+
Ee as getStateAtTime,
|
|
4624
|
+
Sa as preloadUrl
|
|
4585
4625
|
};
|