@clockworkdog/cogs-client 3.0.0-alpha.1 → 3.0.0-alpha.10
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/AudioPlayer.js +6 -5
- package/dist/CogsConnection.js +37 -20
- package/dist/DataStore.js +11 -15
- package/dist/VideoPlayer.js +10 -7
- package/dist/browser/index.mjs +1454 -1162
- package/dist/browser/index.umd.js +6 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/state-based/MediaClipManager.d.ts +45 -0
- package/dist/state-based/MediaClipManager.js +261 -0
- package/dist/state-based/MediaPreloader.d.ts +14 -0
- package/dist/state-based/MediaPreloader.js +86 -0
- package/dist/state-based/SurfaceManager.d.ts +19 -0
- package/dist/state-based/SurfaceManager.js +84 -0
- package/dist/types/MediaSchema.d.ts +13 -0
- package/dist/types/MediaSchema.js +3 -0
- package/dist/utils/getStateAtTime.js +3 -3
- package/package.json +12 -4
package/dist/browser/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var kt = /* @__PURE__ */ ((e) => (e.Setup = "setup", e.Preshow = "pre-show", e.InProgress = "in progress", e.Finished = "finished", e))(kt || {});
|
|
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 Ae = function(e, t) {
|
|
17
|
+
return Ae = 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
|
+
}, Ae(e, t);
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
|
|
23
|
+
function Et(e, t) {
|
|
24
|
+
Ae(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 on(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,12 +35,12 @@ function Ht(e) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function rn(e, t) {
|
|
39
39
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
40
40
|
if (!n) return e;
|
|
41
|
-
var o = n.call(e), i,
|
|
41
|
+
var o = n.call(e), i, a = [], c;
|
|
42
42
|
try {
|
|
43
|
-
for (; (t === void 0 || t-- > 0) && !(i = o.next()).done; )
|
|
43
|
+
for (; (t === void 0 || t-- > 0) && !(i = o.next()).done; ) a.push(i.value);
|
|
44
44
|
} catch (l) {
|
|
45
45
|
c = { error: l };
|
|
46
46
|
} finally {
|
|
@@ -50,14 +50,14 @@ function Qt(e, t) {
|
|
|
50
50
|
if (c) throw c.error;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return a;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function sn() {
|
|
56
56
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
57
|
-
e = e.concat(
|
|
57
|
+
e = e.concat(rn(arguments[t]));
|
|
58
58
|
return e;
|
|
59
59
|
}
|
|
60
|
-
var
|
|
60
|
+
var Ct = (
|
|
61
61
|
/** @class */
|
|
62
62
|
/* @__PURE__ */ function() {
|
|
63
63
|
function e(t, n) {
|
|
@@ -65,27 +65,27 @@ var wt = (
|
|
|
65
65
|
}
|
|
66
66
|
return e;
|
|
67
67
|
}()
|
|
68
|
-
),
|
|
68
|
+
), an = (
|
|
69
69
|
/** @class */
|
|
70
70
|
function(e) {
|
|
71
|
-
|
|
71
|
+
Et(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
|
-
}(
|
|
78
|
-
),
|
|
77
|
+
}(Ct)
|
|
78
|
+
), un = (
|
|
79
79
|
/** @class */
|
|
80
80
|
function(e) {
|
|
81
|
-
|
|
81
|
+
Et(t, e);
|
|
82
82
|
function t(n, o, i) {
|
|
83
83
|
n === void 0 && (n = 1e3), o === void 0 && (o = "");
|
|
84
|
-
var
|
|
85
|
-
return
|
|
84
|
+
var a = e.call(this, "close", i) || this;
|
|
85
|
+
return a.wasClean = !0, a.code = n, a.reason = o, a;
|
|
86
86
|
}
|
|
87
87
|
return t;
|
|
88
|
-
}(
|
|
88
|
+
}(Ct)
|
|
89
89
|
);
|
|
90
90
|
/*!
|
|
91
91
|
* Reconnecting WebSocket
|
|
@@ -93,12 +93,12 @@ var wt = (
|
|
|
93
93
|
* https://github.com/pladaria/reconnecting-websocket
|
|
94
94
|
* License MIT
|
|
95
95
|
*/
|
|
96
|
-
var
|
|
96
|
+
var cn = function() {
|
|
97
97
|
if (typeof WebSocket < "u")
|
|
98
98
|
return WebSocket;
|
|
99
|
-
},
|
|
99
|
+
}, ln = function(e) {
|
|
100
100
|
return typeof e < "u" && !!e && e.CLOSING === 2;
|
|
101
|
-
},
|
|
101
|
+
}, M = {
|
|
102
102
|
maxReconnectionDelay: 1e4,
|
|
103
103
|
minReconnectionDelay: 1e3 + Math.random() * 4e3,
|
|
104
104
|
minUptime: 5e3,
|
|
@@ -106,7 +106,7 @@ var tn = function() {
|
|
|
106
106
|
connectionTimeout: 4e3,
|
|
107
107
|
maxRetries: 1 / 0,
|
|
108
108
|
maxEnqueuedMessages: 1 / 0
|
|
109
|
-
},
|
|
109
|
+
}, dn = (
|
|
110
110
|
/** @class */
|
|
111
111
|
function() {
|
|
112
112
|
function e(t, n, o) {
|
|
@@ -116,27 +116,27 @@ var tn = function() {
|
|
|
116
116
|
message: [],
|
|
117
117
|
open: [],
|
|
118
118
|
close: []
|
|
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(
|
|
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 ? M.minUptime : c;
|
|
122
122
|
clearTimeout(i._connectTimeout), i._uptimeTimeout = setTimeout(function() {
|
|
123
123
|
return i._acceptOpen();
|
|
124
124
|
}, l), i._ws.binaryType = i._binaryType, i._messageQueue.forEach(function(p) {
|
|
125
125
|
return i._ws.send(p);
|
|
126
|
-
}), i._messageQueue = [], i.onopen && i.onopen(
|
|
127
|
-
return i._callEventListener(
|
|
126
|
+
}), i._messageQueue = [], i.onopen && i.onopen(a), i._listeners.open.forEach(function(p) {
|
|
127
|
+
return i._callEventListener(a, p);
|
|
128
128
|
});
|
|
129
|
-
}, this._handleMessage = function(
|
|
130
|
-
i._debug("message event"), i.onmessage && i.onmessage(
|
|
131
|
-
return i._callEventListener(
|
|
129
|
+
}, this._handleMessage = function(a) {
|
|
130
|
+
i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(c) {
|
|
131
|
+
return i._callEventListener(a, c);
|
|
132
132
|
});
|
|
133
|
-
}, this._handleError = function(
|
|
134
|
-
i._debug("error event",
|
|
135
|
-
return i._callEventListener(
|
|
133
|
+
}, this._handleError = function(a) {
|
|
134
|
+
i._debug("error event", a.message), i._disconnect(void 0, a.message === "TIMEOUT" ? "timeout" : void 0), i.onerror && i.onerror(a), i._debug("exec error listeners"), i._listeners.error.forEach(function(c) {
|
|
135
|
+
return i._callEventListener(a, c);
|
|
136
136
|
}), i._connect();
|
|
137
|
-
}, this._handleClose = function(
|
|
138
|
-
i._debug("close event"), i._clearTimeouts(), i._shouldReconnect && i._connect(), i.onclose && i.onclose(
|
|
139
|
-
return i._callEventListener(
|
|
137
|
+
}, this._handleClose = function(a) {
|
|
138
|
+
i._debug("close event"), i._clearTimeouts(), i._shouldReconnect && i._connect(), i.onclose && i.onclose(a), i._listeners.close.forEach(function(c) {
|
|
139
|
+
return i._callEventListener(a, c);
|
|
140
140
|
});
|
|
141
141
|
}, this._url = t, this._protocols = n, this._options = o, this._options.startClosed && (this._shouldReconnect = !1), this._connect();
|
|
142
142
|
}
|
|
@@ -276,7 +276,7 @@ var tn = 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 ? M.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,7 +285,7 @@ var tn = function() {
|
|
|
285
285
|
var n, o, i = this._listeners[t.type];
|
|
286
286
|
if (i)
|
|
287
287
|
try {
|
|
288
|
-
for (var
|
|
288
|
+
for (var a = on(i), c = a.next(); !c.done; c = a.next()) {
|
|
289
289
|
var l = c.value;
|
|
290
290
|
this._callEventListener(t, l);
|
|
291
291
|
}
|
|
@@ -293,7 +293,7 @@ var tn = function() {
|
|
|
293
293
|
n = { error: p };
|
|
294
294
|
} finally {
|
|
295
295
|
try {
|
|
296
|
-
c && !c.done && (o =
|
|
296
|
+
c && !c.done && (o = a.return) && o.call(a);
|
|
297
297
|
} finally {
|
|
298
298
|
if (n) throw n.error;
|
|
299
299
|
}
|
|
@@ -306,10 +306,10 @@ var tn = 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, sn(["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 && (p =
|
|
311
|
+
var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? M.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? M.minReconnectionDelay : i, c = t.maxReconnectionDelay, l = c === void 0 ? M.maxReconnectionDelay : c, p = 0;
|
|
312
|
+
return this._retryCount > 0 && (p = a * Math.pow(o, this._retryCount - 1), p > l && (p = l)), this._debug("next delay", p), p;
|
|
313
313
|
}, e.prototype._wait = function() {
|
|
314
314
|
var t = this;
|
|
315
315
|
return new Promise(function(n) {
|
|
@@ -330,28 +330,28 @@ var tn = 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 ? M.maxRetries : o, a = n.connectionTimeout, c = a === void 0 ? M.connectionTimeout : a, l = n.WebSocket, p = l === void 0 ? cn() : l;
|
|
334
334
|
if (this._retryCount >= i) {
|
|
335
335
|
this._debug("max retries reached", this._retryCount, ">=", i);
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
|
-
if (this._retryCount++, this._debug("connect", this._retryCount), this._removeListeners(), !
|
|
338
|
+
if (this._retryCount++, this._debug("connect", this._retryCount), this._removeListeners(), !ln(p))
|
|
339
339
|
throw Error("No valid WebSocket class provided");
|
|
340
340
|
this._wait().then(function() {
|
|
341
341
|
return t._getNextUrl(t._url);
|
|
342
|
-
}).then(function(
|
|
343
|
-
t._closeCalled || (t._debug("connect", { url:
|
|
342
|
+
}).then(function(h) {
|
|
343
|
+
t._closeCalled || (t._debug("connect", { url: h, protocols: t._protocols }), t._ws = t._protocols ? new p(h, t._protocols) : new p(h), t._ws.binaryType = t._binaryType, t._connectLock = !1, t._addListeners(), t._connectTimeout = setTimeout(function() {
|
|
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 an(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 un(t, n, this));
|
|
355
355
|
} catch {
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -368,24 +368,25 @@ var tn = function() {
|
|
|
368
368
|
}, e;
|
|
369
369
|
}()
|
|
370
370
|
);
|
|
371
|
-
const
|
|
372
|
-
function
|
|
371
|
+
const St = 12095;
|
|
372
|
+
function pn(e) {
|
|
373
373
|
const t = typeof window < "u" ? window.location : void 0, n = `/assets/${encodeURIComponent(e)}`;
|
|
374
|
-
return `${t?.protocol}//${t?.hostname}:${
|
|
374
|
+
return `${t?.protocol}//${t?.hostname}:${St}${n}`;
|
|
375
375
|
}
|
|
376
|
-
async function
|
|
376
|
+
async function ka(e) {
|
|
377
377
|
const t = await fetch(e);
|
|
378
378
|
return URL.createObjectURL(new Blob([await t.arrayBuffer()]));
|
|
379
379
|
}
|
|
380
|
-
class
|
|
380
|
+
class fn {
|
|
381
|
+
_items;
|
|
381
382
|
#e = new EventTarget();
|
|
382
383
|
constructor(t) {
|
|
383
384
|
this._items = { ...t };
|
|
384
385
|
}
|
|
385
386
|
handleDataStoreItemsMessage(t) {
|
|
386
387
|
this._items = { ...this._items, ...t.items }, Object.entries(t.items).forEach(([n, o]) => {
|
|
387
|
-
this.dispatchEvent(new
|
|
388
|
-
}), this.dispatchEvent(new
|
|
388
|
+
this.dispatchEvent(new We(n, o));
|
|
389
|
+
}), this.dispatchEvent(new qe(t.items));
|
|
389
390
|
}
|
|
390
391
|
get items() {
|
|
391
392
|
return this._items;
|
|
@@ -395,8 +396,8 @@ class sn {
|
|
|
395
396
|
}
|
|
396
397
|
setItems(t) {
|
|
397
398
|
return this._items = { ...this._items, ...t }, Object.entries(t).forEach(([n, o]) => {
|
|
398
|
-
this.dispatchEvent(new
|
|
399
|
-
}), this.dispatchEvent(new
|
|
399
|
+
this.dispatchEvent(new We(n, o));
|
|
400
|
+
}), this.dispatchEvent(new qe(t)), this;
|
|
400
401
|
}
|
|
401
402
|
// Type-safe listeners
|
|
402
403
|
addEventListener(t, n, o) {
|
|
@@ -409,18 +410,20 @@ class sn {
|
|
|
409
410
|
this.#e.dispatchEvent(t);
|
|
410
411
|
}
|
|
411
412
|
}
|
|
412
|
-
class
|
|
413
|
+
class We extends Event {
|
|
413
414
|
constructor(t, n) {
|
|
414
|
-
super("item"), this.key = t, this.value = n
|
|
415
|
+
super("item"), this.key = t, this.value = n;
|
|
415
416
|
}
|
|
417
|
+
_cogsConnectionEventType = "item";
|
|
416
418
|
}
|
|
417
|
-
class
|
|
419
|
+
class qe extends Event {
|
|
418
420
|
constructor(t) {
|
|
419
|
-
super("items"), this.items = t
|
|
421
|
+
super("items"), this.items = t;
|
|
420
422
|
}
|
|
423
|
+
_cogsConnectionEventType = "item";
|
|
421
424
|
}
|
|
422
425
|
const te = globalThis.Date;
|
|
423
|
-
function
|
|
426
|
+
function hn(e) {
|
|
424
427
|
const t = e - te.now();
|
|
425
428
|
function n(...i) {
|
|
426
429
|
return i.length === 0 ? new te(n.now()) : new te(...i);
|
|
@@ -430,29 +433,29 @@ function an(e) {
|
|
|
430
433
|
return te.now() + t;
|
|
431
434
|
}, globalThis.Date = n;
|
|
432
435
|
}
|
|
433
|
-
let
|
|
434
|
-
function
|
|
435
|
-
return ++
|
|
436
|
+
let _n = 0;
|
|
437
|
+
function mn() {
|
|
438
|
+
return ++_n;
|
|
436
439
|
}
|
|
437
|
-
const
|
|
438
|
-
function
|
|
439
|
-
const
|
|
440
|
+
const vn = 5, gn = 1e4;
|
|
441
|
+
function yn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = vn, syncRequestTimeout: i = gn }) {
|
|
442
|
+
const a = {};
|
|
440
443
|
async function c() {
|
|
441
444
|
const y = [];
|
|
442
445
|
for (let s = 0; s < o; s++) {
|
|
443
|
-
const
|
|
444
|
-
const f =
|
|
446
|
+
const u = new Promise((d) => {
|
|
447
|
+
const f = mn(), v = Date.now(), _ = performance.now();
|
|
445
448
|
t({ timesync: { id: f } });
|
|
446
|
-
const w = (k,
|
|
447
|
-
|
|
449
|
+
const w = (k, E) => d({ sentAt: _, receivedAt: k, serverNow: E, clientNow: v });
|
|
450
|
+
a[f] = { complete: w }, setTimeout(() => d(null), i);
|
|
448
451
|
});
|
|
449
|
-
y.push(
|
|
452
|
+
y.push(u), await u;
|
|
450
453
|
}
|
|
451
|
-
const g = (await Promise.all(y)).filter((s) => s !== null), r =
|
|
454
|
+
const g = (await Promise.all(y)).filter((s) => s !== null), r = bn(g);
|
|
452
455
|
isNaN(r) || n(Date.now() + r);
|
|
453
456
|
}
|
|
454
457
|
const l = (y) => {
|
|
455
|
-
const g = performance.now(), r =
|
|
458
|
+
const g = performance.now(), r = a[y.timesync.id];
|
|
456
459
|
r && r.complete(g, y.timesync.now);
|
|
457
460
|
};
|
|
458
461
|
c();
|
|
@@ -464,22 +467,22 @@ function pn({ interval: e, send: t, onChange: n = an, syncSampleSize: o = ln, sy
|
|
|
464
467
|
}
|
|
465
468
|
};
|
|
466
469
|
}
|
|
467
|
-
function
|
|
470
|
+
function bn(e) {
|
|
468
471
|
return e.map(({ sentAt: t, receivedAt: n, clientNow: o, serverNow: i }) => {
|
|
469
|
-
const
|
|
470
|
-
return i - o -
|
|
472
|
+
const a = (n - t) / 2;
|
|
473
|
+
return i - o - a;
|
|
471
474
|
}).reduce((t, n) => t + n, 0) / e.length;
|
|
472
475
|
}
|
|
473
|
-
class
|
|
474
|
-
constructor(t, { hostname: n = document.location.hostname, port: o =
|
|
475
|
-
this.manifest = t, this.
|
|
476
|
-
const { useReconnectingWebsocket: c, path: l, pathParams: p } =
|
|
476
|
+
class Ea {
|
|
477
|
+
constructor(t, { hostname: n = document.location.hostname, port: o = St } = {}, i, a) {
|
|
478
|
+
this.manifest = t, this.currentState = { ...i }, this.store = new fn(a ?? {});
|
|
479
|
+
const { useReconnectingWebsocket: c, path: l, pathParams: p } = wn(document.location.href);
|
|
477
480
|
this.urlParams = new URLSearchParams(p), this.urlParams.set("screenWidth", window.screen.width.toString()), this.urlParams.set("screenHeight", window.screen.height.toString()), this.urlParams.set("screenPixelRatio", window.devicePixelRatio.toString());
|
|
478
|
-
const
|
|
479
|
-
this.websocket = c ? new
|
|
481
|
+
const h = `ws://${n}:${o}${l}?${this.urlParams}`;
|
|
482
|
+
this.websocket = c ? new dn(h) : new WebSocket(h);
|
|
480
483
|
let y;
|
|
481
484
|
this.websocket.onopen = () => {
|
|
482
|
-
this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new
|
|
485
|
+
this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new kn()), this.setState(this.currentState), y = yn({
|
|
483
486
|
interval: 6e4,
|
|
484
487
|
send: (g) => {
|
|
485
488
|
this.websocket.send(JSON.stringify(g));
|
|
@@ -496,18 +499,18 @@ class ia {
|
|
|
496
499
|
console.error(r);
|
|
497
500
|
}
|
|
498
501
|
}), this.websocket.onclose = () => {
|
|
499
|
-
y?.destroy(), this.dispatchEvent(new
|
|
502
|
+
y?.destroy(), this.dispatchEvent(new En());
|
|
500
503
|
}, this.websocket.addEventListener("message", ({ data: g }) => {
|
|
501
504
|
try {
|
|
502
505
|
const r = JSON.parse(g);
|
|
503
506
|
try {
|
|
504
507
|
if (r.config)
|
|
505
|
-
this.currentConfig = r.config, this.dispatchEvent(new
|
|
508
|
+
this.currentConfig = r.config, this.dispatchEvent(new Sn(this.currentConfig));
|
|
506
509
|
else if (r.updates)
|
|
507
|
-
this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new
|
|
510
|
+
this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new An(r.updates));
|
|
508
511
|
else if (r.event && r.event.key)
|
|
509
512
|
this.dispatchEvent(
|
|
510
|
-
new
|
|
513
|
+
new Tn(r.event.key, r.event.value)
|
|
511
514
|
);
|
|
512
515
|
else if (typeof r.message == "object") {
|
|
513
516
|
const s = r.message;
|
|
@@ -520,19 +523,19 @@ class ia {
|
|
|
520
523
|
};
|
|
521
524
|
break;
|
|
522
525
|
case "show_phase":
|
|
523
|
-
this._showPhase = s.phase, this.dispatchEvent(new
|
|
526
|
+
this._showPhase = s.phase, this.dispatchEvent(new In(s.phase));
|
|
524
527
|
break;
|
|
525
528
|
case "media_config_update":
|
|
526
529
|
this._mediaConfig = s;
|
|
527
|
-
for (const
|
|
528
|
-
s[
|
|
529
|
-
this.dispatchEvent(new
|
|
530
|
+
for (const u of ["preferOptimizedAudio", "preferOptimizedVideo", "preferOptimizedImages"])
|
|
531
|
+
s[u] ? this.urlParams.set(u, "true") : this.urlParams.delete(u);
|
|
532
|
+
this.dispatchEvent(new zn(s));
|
|
530
533
|
break;
|
|
531
534
|
case "data_store_items":
|
|
532
535
|
this.store.handleDataStoreItemsMessage(s);
|
|
533
536
|
break;
|
|
534
537
|
}
|
|
535
|
-
this.dispatchEvent(new
|
|
538
|
+
this.dispatchEvent(new Cn(s));
|
|
536
539
|
}
|
|
537
540
|
} catch (s) {
|
|
538
541
|
console.warn("Error handling data", g, s);
|
|
@@ -553,20 +556,27 @@ class ia {
|
|
|
553
556
|
this.eventTarget.addEventListener("open", g), navigator.mediaDevices?.addEventListener("devicechange", g), g();
|
|
554
557
|
}
|
|
555
558
|
}
|
|
559
|
+
websocket;
|
|
560
|
+
eventTarget = new EventTarget();
|
|
561
|
+
currentConfig = {};
|
|
556
562
|
// Received on open connection
|
|
557
563
|
get config() {
|
|
558
564
|
return { ...this.currentConfig };
|
|
559
565
|
}
|
|
566
|
+
currentState = {};
|
|
560
567
|
// Received on open connection - TODO: set initial state from manifest?
|
|
561
568
|
get state() {
|
|
562
569
|
return { ...this.currentState };
|
|
563
570
|
}
|
|
571
|
+
_showPhase = kt.Setup;
|
|
564
572
|
get showPhase() {
|
|
565
573
|
return this._showPhase;
|
|
566
574
|
}
|
|
575
|
+
_timerState = null;
|
|
567
576
|
get timerState() {
|
|
568
577
|
return this._timerState ? { ...this._timerState } : null;
|
|
569
578
|
}
|
|
579
|
+
_mediaConfig = null;
|
|
570
580
|
get mediaConfig() {
|
|
571
581
|
return this._mediaConfig ? { ...this._mediaConfig } : null;
|
|
572
582
|
}
|
|
@@ -574,11 +584,24 @@ class ia {
|
|
|
574
584
|
* Return asset URLs using the information about the client and server support for HTTP/2
|
|
575
585
|
*/
|
|
576
586
|
getAssetUrl(t) {
|
|
577
|
-
return `${
|
|
587
|
+
return `${pn(t)}?${this.urlParams?.toString() ?? ""}`;
|
|
578
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* Cached audio outputs use to look up the device/sink ID when a different device label is requested
|
|
591
|
+
*/
|
|
592
|
+
audioOutputs = void 0;
|
|
593
|
+
_selectedAudioOutput = "";
|
|
579
594
|
get selectedAudioOutput() {
|
|
580
595
|
return this._selectedAudioOutput;
|
|
581
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Stores data in COGS
|
|
599
|
+
*/
|
|
600
|
+
store;
|
|
601
|
+
/**
|
|
602
|
+
* URL parameters use for the websocket connection and asset URLs
|
|
603
|
+
*/
|
|
604
|
+
urlParams;
|
|
582
605
|
get isConnected() {
|
|
583
606
|
return this.websocket.readyState === WebSocket.OPEN;
|
|
584
607
|
}
|
|
@@ -632,8 +655,8 @@ class ia {
|
|
|
632
655
|
this.eventTarget.dispatchEvent(t);
|
|
633
656
|
}
|
|
634
657
|
}
|
|
635
|
-
function
|
|
636
|
-
const t = new URL(e), n = new URLSearchParams(t.searchParams), o = n.get("local_id"), i = n.get("simulator") === "true",
|
|
658
|
+
function wn(e) {
|
|
659
|
+
const t = new URL(e), n = new URLSearchParams(t.searchParams), o = n.get("local_id"), i = n.get("simulator") === "true", a = n.get("display") ?? "", c = t.pathname.startsWith("/plugin/") ? decodeURIComponent(t.pathname.split("/")[2]) : void 0;
|
|
637
660
|
if (o) {
|
|
638
661
|
const l = n.get("t") ?? "";
|
|
639
662
|
return n.delete("local_id"), {
|
|
@@ -648,10 +671,10 @@ function hn(e) {
|
|
|
648
671
|
pathParams: n,
|
|
649
672
|
useReconnectingWebsocket: !0
|
|
650
673
|
};
|
|
651
|
-
} else if (
|
|
674
|
+
} else if (a) {
|
|
652
675
|
const l = n.get("displayIdIndex") ?? "";
|
|
653
676
|
return n.delete("display"), n.delete("displayIdIndex"), {
|
|
654
|
-
path: `/display/${encodeURIComponent(
|
|
677
|
+
path: `/display/${encodeURIComponent(a)}/${encodeURIComponent(l)}`
|
|
655
678
|
};
|
|
656
679
|
} else {
|
|
657
680
|
if (c)
|
|
@@ -668,48 +691,56 @@ function hn(e) {
|
|
|
668
691
|
}
|
|
669
692
|
}
|
|
670
693
|
}
|
|
671
|
-
class
|
|
694
|
+
class kn extends Event {
|
|
695
|
+
_cogsConnectionEventType = "open";
|
|
672
696
|
constructor() {
|
|
673
|
-
super("open")
|
|
697
|
+
super("open");
|
|
674
698
|
}
|
|
675
699
|
}
|
|
676
|
-
class
|
|
700
|
+
class En extends Event {
|
|
701
|
+
_cogsConnectionEventType = "close";
|
|
677
702
|
constructor() {
|
|
678
|
-
super("close")
|
|
703
|
+
super("close");
|
|
679
704
|
}
|
|
680
705
|
}
|
|
681
|
-
class
|
|
706
|
+
class Cn extends Event {
|
|
682
707
|
constructor(t) {
|
|
683
|
-
super("message"), this.message = t
|
|
708
|
+
super("message"), this.message = t;
|
|
684
709
|
}
|
|
710
|
+
_cogsConnectionEventType = "message";
|
|
685
711
|
}
|
|
686
|
-
class
|
|
712
|
+
class Sn extends Event {
|
|
687
713
|
constructor(t) {
|
|
688
|
-
super("config"), this.config = t
|
|
714
|
+
super("config"), this.config = t;
|
|
689
715
|
}
|
|
716
|
+
_cogsConnectionEventType = "config";
|
|
690
717
|
}
|
|
691
|
-
class
|
|
718
|
+
class An extends Event {
|
|
692
719
|
constructor(t) {
|
|
693
|
-
super("state"), this.state = t
|
|
720
|
+
super("state"), this.state = t;
|
|
694
721
|
}
|
|
722
|
+
_cogsConnectionEventType = "state";
|
|
695
723
|
}
|
|
696
|
-
class
|
|
724
|
+
class Tn extends Event {
|
|
697
725
|
constructor(t, n) {
|
|
698
|
-
super("event"), this.name = t, this.value = n
|
|
726
|
+
super("event"), this.name = t, this.value = n;
|
|
699
727
|
}
|
|
728
|
+
_cogsConnectionEventType = "event";
|
|
700
729
|
}
|
|
701
|
-
class
|
|
730
|
+
class zn extends Event {
|
|
702
731
|
constructor(t) {
|
|
703
|
-
super("mediaConfig"), this.mediaConfig = t
|
|
732
|
+
super("mediaConfig"), this.mediaConfig = t;
|
|
704
733
|
}
|
|
734
|
+
_cogsConnectionEventType = "mediaConfig";
|
|
705
735
|
}
|
|
706
|
-
class
|
|
736
|
+
class In extends Event {
|
|
707
737
|
constructor(t) {
|
|
708
|
-
super("showPhase"), this.showPhase = t
|
|
738
|
+
super("showPhase"), this.showPhase = t;
|
|
709
739
|
}
|
|
740
|
+
_cogsConnectionEventType = "showPhase";
|
|
710
741
|
}
|
|
711
742
|
// @__NO_SIDE_EFFECTS__
|
|
712
|
-
function
|
|
743
|
+
function m(e, t, n) {
|
|
713
744
|
function o(l, p) {
|
|
714
745
|
if (l._zod || Object.defineProperty(l, "_zod", {
|
|
715
746
|
value: {
|
|
@@ -721,23 +752,23 @@ function _(e, t, n) {
|
|
|
721
752
|
}), l._zod.traits.has(e))
|
|
722
753
|
return;
|
|
723
754
|
l._zod.traits.add(e), t(l, p);
|
|
724
|
-
const
|
|
755
|
+
const h = c.prototype, y = Object.keys(h);
|
|
725
756
|
for (let g = 0; g < y.length; g++) {
|
|
726
757
|
const r = y[g];
|
|
727
|
-
r in l || (l[r] =
|
|
758
|
+
r in l || (l[r] = h[r].bind(l));
|
|
728
759
|
}
|
|
729
760
|
}
|
|
730
761
|
const i = n?.Parent ?? Object;
|
|
731
|
-
class
|
|
762
|
+
class a extends i {
|
|
732
763
|
}
|
|
733
|
-
Object.defineProperty(
|
|
764
|
+
Object.defineProperty(a, "name", { value: e });
|
|
734
765
|
function c(l) {
|
|
735
766
|
var p;
|
|
736
|
-
const
|
|
737
|
-
o(
|
|
738
|
-
for (const y of
|
|
767
|
+
const h = n?.Parent ? new a() : this;
|
|
768
|
+
o(h, l), (p = h._zod).deferred ?? (p.deferred = []);
|
|
769
|
+
for (const y of h._zod.deferred)
|
|
739
770
|
y();
|
|
740
|
-
return
|
|
771
|
+
return h;
|
|
741
772
|
}
|
|
742
773
|
return Object.defineProperty(c, "init", { value: o }), Object.defineProperty(c, Symbol.hasInstance, {
|
|
743
774
|
value: (l) => n?.Parent && l instanceof n.Parent ? !0 : l?._zod?.traits?.has(e)
|
|
@@ -748,23 +779,23 @@ class K extends Error {
|
|
|
748
779
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
749
780
|
}
|
|
750
781
|
}
|
|
751
|
-
class
|
|
782
|
+
class At extends Error {
|
|
752
783
|
constructor(t) {
|
|
753
784
|
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
754
785
|
}
|
|
755
786
|
}
|
|
756
|
-
const
|
|
757
|
-
function
|
|
758
|
-
return
|
|
787
|
+
const Tt = {};
|
|
788
|
+
function j(e) {
|
|
789
|
+
return Tt;
|
|
759
790
|
}
|
|
760
|
-
function
|
|
791
|
+
function On(e) {
|
|
761
792
|
const t = Object.values(e).filter((o) => typeof o == "number");
|
|
762
793
|
return Object.entries(e).filter(([o, i]) => t.indexOf(+o) === -1).map(([o, i]) => i);
|
|
763
794
|
}
|
|
764
795
|
function Te(e, t) {
|
|
765
796
|
return typeof t == "bigint" ? t.toString() : t;
|
|
766
797
|
}
|
|
767
|
-
function
|
|
798
|
+
function $e(e) {
|
|
768
799
|
return {
|
|
769
800
|
get value() {
|
|
770
801
|
{
|
|
@@ -774,30 +805,30 @@ function Ze(e) {
|
|
|
774
805
|
}
|
|
775
806
|
};
|
|
776
807
|
}
|
|
777
|
-
function
|
|
808
|
+
function Pe(e) {
|
|
778
809
|
return e == null;
|
|
779
810
|
}
|
|
780
|
-
function
|
|
811
|
+
function Ze(e) {
|
|
781
812
|
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
782
813
|
return e.slice(t, n);
|
|
783
814
|
}
|
|
784
|
-
function
|
|
815
|
+
function $n(e, t) {
|
|
785
816
|
const n = (e.toString().split(".")[1] || "").length, o = t.toString();
|
|
786
817
|
let i = (o.split(".")[1] || "").length;
|
|
787
818
|
if (i === 0 && /\d?e-\d?/.test(o)) {
|
|
788
819
|
const p = o.match(/\d?e-(\d?)/);
|
|
789
820
|
p?.[1] && (i = Number.parseInt(p[1]));
|
|
790
821
|
}
|
|
791
|
-
const
|
|
792
|
-
return c % l / 10 **
|
|
822
|
+
const a = n > i ? n : i, c = Number.parseInt(e.toFixed(a).replace(".", "")), l = Number.parseInt(t.toFixed(a).replace(".", ""));
|
|
823
|
+
return c % l / 10 ** a;
|
|
793
824
|
}
|
|
794
|
-
const
|
|
795
|
-
function
|
|
825
|
+
const Ke = Symbol("evaluating");
|
|
826
|
+
function C(e, t, n) {
|
|
796
827
|
let o;
|
|
797
828
|
Object.defineProperty(e, t, {
|
|
798
829
|
get() {
|
|
799
|
-
if (o !==
|
|
800
|
-
return o === void 0 && (o =
|
|
830
|
+
if (o !== Ke)
|
|
831
|
+
return o === void 0 && (o = Ke, o = n()), o;
|
|
801
832
|
},
|
|
802
833
|
set(i) {
|
|
803
834
|
Object.defineProperty(e, t, {
|
|
@@ -808,7 +839,7 @@ function E(e, t, n) {
|
|
|
808
839
|
configurable: !0
|
|
809
840
|
});
|
|
810
841
|
}
|
|
811
|
-
function
|
|
842
|
+
function V(e, t, n) {
|
|
812
843
|
Object.defineProperty(e, t, {
|
|
813
844
|
value: n,
|
|
814
845
|
writable: !0,
|
|
@@ -824,18 +855,18 @@ function B(...e) {
|
|
|
824
855
|
}
|
|
825
856
|
return Object.defineProperties({}, t);
|
|
826
857
|
}
|
|
827
|
-
function
|
|
858
|
+
function He(e) {
|
|
828
859
|
return JSON.stringify(e);
|
|
829
860
|
}
|
|
830
|
-
function
|
|
861
|
+
function Pn(e) {
|
|
831
862
|
return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
832
863
|
}
|
|
833
|
-
const
|
|
864
|
+
const zt = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
834
865
|
};
|
|
835
866
|
function pe(e) {
|
|
836
867
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
837
868
|
}
|
|
838
|
-
const
|
|
869
|
+
const Zn = $e(() => {
|
|
839
870
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
840
871
|
return !1;
|
|
841
872
|
try {
|
|
@@ -845,7 +876,7 @@ const Sn = Ze(() => {
|
|
|
845
876
|
return !1;
|
|
846
877
|
}
|
|
847
878
|
});
|
|
848
|
-
function
|
|
879
|
+
function H(e) {
|
|
849
880
|
if (pe(e) === !1)
|
|
850
881
|
return !1;
|
|
851
882
|
const t = e.constructor;
|
|
@@ -854,11 +885,11 @@ function J(e) {
|
|
|
854
885
|
const n = t.prototype;
|
|
855
886
|
return !(pe(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
856
887
|
}
|
|
857
|
-
function
|
|
858
|
-
return
|
|
888
|
+
function It(e) {
|
|
889
|
+
return H(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
859
890
|
}
|
|
860
|
-
const
|
|
861
|
-
function
|
|
891
|
+
const xn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
892
|
+
function J(e) {
|
|
862
893
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
863
894
|
}
|
|
864
895
|
function D(e, t, n) {
|
|
@@ -878,79 +909,79 @@ function b(e) {
|
|
|
878
909
|
}
|
|
879
910
|
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
880
911
|
}
|
|
881
|
-
function
|
|
912
|
+
function Ln(e) {
|
|
882
913
|
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
883
914
|
}
|
|
884
|
-
const
|
|
915
|
+
const Rn = {
|
|
885
916
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
886
917
|
int32: [-2147483648, 2147483647],
|
|
887
918
|
uint32: [0, 4294967295],
|
|
888
919
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
889
920
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
890
921
|
};
|
|
891
|
-
function
|
|
922
|
+
function jn(e, t) {
|
|
892
923
|
const n = e._zod.def, o = B(e._zod.def, {
|
|
893
924
|
get shape() {
|
|
894
925
|
const i = {};
|
|
895
|
-
for (const
|
|
896
|
-
if (!(
|
|
897
|
-
throw new Error(`Unrecognized key: "${
|
|
898
|
-
t[
|
|
926
|
+
for (const a in t) {
|
|
927
|
+
if (!(a in n.shape))
|
|
928
|
+
throw new Error(`Unrecognized key: "${a}"`);
|
|
929
|
+
t[a] && (i[a] = n.shape[a]);
|
|
899
930
|
}
|
|
900
|
-
return
|
|
931
|
+
return V(this, "shape", i), i;
|
|
901
932
|
},
|
|
902
933
|
checks: []
|
|
903
934
|
});
|
|
904
935
|
return D(e, o);
|
|
905
936
|
}
|
|
906
|
-
function
|
|
937
|
+
function Nn(e, t) {
|
|
907
938
|
const n = e._zod.def, o = B(e._zod.def, {
|
|
908
939
|
get shape() {
|
|
909
940
|
const i = { ...e._zod.def.shape };
|
|
910
|
-
for (const
|
|
911
|
-
if (!(
|
|
912
|
-
throw new Error(`Unrecognized key: "${
|
|
913
|
-
t[
|
|
941
|
+
for (const a in t) {
|
|
942
|
+
if (!(a in n.shape))
|
|
943
|
+
throw new Error(`Unrecognized key: "${a}"`);
|
|
944
|
+
t[a] && delete i[a];
|
|
914
945
|
}
|
|
915
|
-
return
|
|
946
|
+
return V(this, "shape", i), i;
|
|
916
947
|
},
|
|
917
948
|
checks: []
|
|
918
949
|
});
|
|
919
950
|
return D(e, o);
|
|
920
951
|
}
|
|
921
|
-
function
|
|
922
|
-
if (!
|
|
952
|
+
function Dn(e, t) {
|
|
953
|
+
if (!H(t))
|
|
923
954
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
924
955
|
const n = e._zod.def.checks;
|
|
925
956
|
if (n && n.length > 0)
|
|
926
957
|
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
927
958
|
const i = B(e._zod.def, {
|
|
928
959
|
get shape() {
|
|
929
|
-
const
|
|
930
|
-
return
|
|
960
|
+
const a = { ...e._zod.def.shape, ...t };
|
|
961
|
+
return V(this, "shape", a), a;
|
|
931
962
|
},
|
|
932
963
|
checks: []
|
|
933
964
|
});
|
|
934
965
|
return D(e, i);
|
|
935
966
|
}
|
|
936
|
-
function
|
|
937
|
-
if (!
|
|
967
|
+
function Un(e, t) {
|
|
968
|
+
if (!H(t))
|
|
938
969
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
939
970
|
const n = {
|
|
940
971
|
...e._zod.def,
|
|
941
972
|
get shape() {
|
|
942
973
|
const o = { ...e._zod.def.shape, ...t };
|
|
943
|
-
return
|
|
974
|
+
return V(this, "shape", o), o;
|
|
944
975
|
},
|
|
945
976
|
checks: e._zod.def.checks
|
|
946
977
|
};
|
|
947
978
|
return D(e, n);
|
|
948
979
|
}
|
|
949
|
-
function
|
|
980
|
+
function Mn(e, t) {
|
|
950
981
|
const n = B(e._zod.def, {
|
|
951
982
|
get shape() {
|
|
952
983
|
const o = { ...e._zod.def.shape, ...t._zod.def.shape };
|
|
953
|
-
return
|
|
984
|
+
return V(this, "shape", o), o;
|
|
954
985
|
},
|
|
955
986
|
get catchall() {
|
|
956
987
|
return t._zod.def.catchall;
|
|
@@ -960,51 +991,51 @@ function xn(e, t) {
|
|
|
960
991
|
});
|
|
961
992
|
return D(e, n);
|
|
962
993
|
}
|
|
963
|
-
function
|
|
994
|
+
function Fn(e, t, n) {
|
|
964
995
|
const o = B(t._zod.def, {
|
|
965
996
|
get shape() {
|
|
966
|
-
const i = t._zod.def.shape,
|
|
997
|
+
const i = t._zod.def.shape, a = { ...i };
|
|
967
998
|
if (n)
|
|
968
999
|
for (const c in n) {
|
|
969
1000
|
if (!(c in i))
|
|
970
1001
|
throw new Error(`Unrecognized key: "${c}"`);
|
|
971
|
-
n[c] && (
|
|
1002
|
+
n[c] && (a[c] = e ? new e({
|
|
972
1003
|
type: "optional",
|
|
973
1004
|
innerType: i[c]
|
|
974
1005
|
}) : i[c]);
|
|
975
1006
|
}
|
|
976
1007
|
else
|
|
977
1008
|
for (const c in i)
|
|
978
|
-
|
|
1009
|
+
a[c] = e ? new e({
|
|
979
1010
|
type: "optional",
|
|
980
1011
|
innerType: i[c]
|
|
981
1012
|
}) : i[c];
|
|
982
|
-
return
|
|
1013
|
+
return V(this, "shape", a), a;
|
|
983
1014
|
},
|
|
984
1015
|
checks: []
|
|
985
1016
|
});
|
|
986
1017
|
return D(t, o);
|
|
987
1018
|
}
|
|
988
|
-
function
|
|
1019
|
+
function Vn(e, t, n) {
|
|
989
1020
|
const o = B(t._zod.def, {
|
|
990
1021
|
get shape() {
|
|
991
|
-
const i = t._zod.def.shape,
|
|
1022
|
+
const i = t._zod.def.shape, a = { ...i };
|
|
992
1023
|
if (n)
|
|
993
1024
|
for (const c in n) {
|
|
994
|
-
if (!(c in
|
|
1025
|
+
if (!(c in a))
|
|
995
1026
|
throw new Error(`Unrecognized key: "${c}"`);
|
|
996
|
-
n[c] && (
|
|
1027
|
+
n[c] && (a[c] = new e({
|
|
997
1028
|
type: "nonoptional",
|
|
998
1029
|
innerType: i[c]
|
|
999
1030
|
}));
|
|
1000
1031
|
}
|
|
1001
1032
|
else
|
|
1002
1033
|
for (const c in i)
|
|
1003
|
-
|
|
1034
|
+
a[c] = new e({
|
|
1004
1035
|
type: "nonoptional",
|
|
1005
1036
|
innerType: i[c]
|
|
1006
1037
|
});
|
|
1007
|
-
return
|
|
1038
|
+
return V(this, "shape", a), a;
|
|
1008
1039
|
},
|
|
1009
1040
|
checks: []
|
|
1010
1041
|
});
|
|
@@ -1018,7 +1049,7 @@ function q(e, t = 0) {
|
|
|
1018
1049
|
return !0;
|
|
1019
1050
|
return !1;
|
|
1020
1051
|
}
|
|
1021
|
-
function
|
|
1052
|
+
function F(e, t) {
|
|
1022
1053
|
return t.map((n) => {
|
|
1023
1054
|
var o;
|
|
1024
1055
|
return (o = n).path ?? (o.path = []), n.path.unshift(e), n;
|
|
@@ -1027,7 +1058,7 @@ function V(e, t) {
|
|
|
1027
1058
|
function se(e) {
|
|
1028
1059
|
return typeof e == "string" ? e : e?.message;
|
|
1029
1060
|
}
|
|
1030
|
-
function
|
|
1061
|
+
function N(e, t, n) {
|
|
1031
1062
|
const o = { ...e, path: e.path ?? [] };
|
|
1032
1063
|
if (!e.message) {
|
|
1033
1064
|
const i = se(e.inst?._zod.def?.error?.(e)) ?? se(t?.error?.(e)) ?? se(n.customError?.(e)) ?? se(n.localeError?.(e)) ?? "Invalid input";
|
|
@@ -1047,7 +1078,7 @@ function re(...e) {
|
|
|
1047
1078
|
inst: o
|
|
1048
1079
|
} : { ...t };
|
|
1049
1080
|
}
|
|
1050
|
-
const
|
|
1081
|
+
const Ot = (e, t) => {
|
|
1051
1082
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
1052
1083
|
value: e._zod,
|
|
1053
1084
|
enumerable: !1
|
|
@@ -1058,112 +1089,112 @@ const Tt = (e, t) => {
|
|
|
1058
1089
|
value: () => e.message,
|
|
1059
1090
|
enumerable: !1
|
|
1060
1091
|
});
|
|
1061
|
-
},
|
|
1062
|
-
function
|
|
1092
|
+
}, $t = /* @__PURE__ */ m("$ZodError", Ot), Pt = /* @__PURE__ */ m("$ZodError", Ot, { Parent: Error });
|
|
1093
|
+
function Bn(e, t = (n) => n.message) {
|
|
1063
1094
|
const n = {}, o = [];
|
|
1064
1095
|
for (const i of e.issues)
|
|
1065
1096
|
i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : o.push(t(i));
|
|
1066
1097
|
return { formErrors: o, fieldErrors: n };
|
|
1067
1098
|
}
|
|
1068
|
-
function
|
|
1099
|
+
function Gn(e, t = (n) => n.message) {
|
|
1069
1100
|
const n = { _errors: [] }, o = (i) => {
|
|
1070
|
-
for (const
|
|
1071
|
-
if (
|
|
1072
|
-
|
|
1073
|
-
else if (
|
|
1074
|
-
o({ issues:
|
|
1075
|
-
else if (
|
|
1076
|
-
o({ issues:
|
|
1077
|
-
else if (
|
|
1078
|
-
n._errors.push(t(
|
|
1101
|
+
for (const a of i.issues)
|
|
1102
|
+
if (a.code === "invalid_union" && a.errors.length)
|
|
1103
|
+
a.errors.map((c) => o({ issues: c }));
|
|
1104
|
+
else if (a.code === "invalid_key")
|
|
1105
|
+
o({ issues: a.issues });
|
|
1106
|
+
else if (a.code === "invalid_element")
|
|
1107
|
+
o({ issues: a.issues });
|
|
1108
|
+
else if (a.path.length === 0)
|
|
1109
|
+
n._errors.push(t(a));
|
|
1079
1110
|
else {
|
|
1080
1111
|
let c = n, l = 0;
|
|
1081
|
-
for (; l <
|
|
1082
|
-
const p =
|
|
1083
|
-
l ===
|
|
1112
|
+
for (; l < a.path.length; ) {
|
|
1113
|
+
const p = a.path[l];
|
|
1114
|
+
l === a.path.length - 1 ? (c[p] = c[p] || { _errors: [] }, c[p]._errors.push(t(a))) : c[p] = c[p] || { _errors: [] }, c = c[p], l++;
|
|
1084
1115
|
}
|
|
1085
1116
|
}
|
|
1086
1117
|
};
|
|
1087
1118
|
return o(e), n;
|
|
1088
1119
|
}
|
|
1089
1120
|
const Le = (e) => (t, n, o, i) => {
|
|
1090
|
-
const
|
|
1121
|
+
const a = o ? Object.assign(o, { async: !1 }) : { async: !1 }, c = t._zod.run({ value: n, issues: [] }, a);
|
|
1091
1122
|
if (c instanceof Promise)
|
|
1092
1123
|
throw new K();
|
|
1093
1124
|
if (c.issues.length) {
|
|
1094
|
-
const l = new (i?.Err ?? e)(c.issues.map((p) =>
|
|
1095
|
-
throw
|
|
1125
|
+
const l = new (i?.Err ?? e)(c.issues.map((p) => N(p, a, j())));
|
|
1126
|
+
throw zt(l, i?.callee), l;
|
|
1096
1127
|
}
|
|
1097
1128
|
return c.value;
|
|
1098
|
-
},
|
|
1099
|
-
const
|
|
1100
|
-
let c = t._zod.run({ value: n, issues: [] },
|
|
1129
|
+
}, Re = (e) => async (t, n, o, i) => {
|
|
1130
|
+
const a = o ? Object.assign(o, { async: !0 }) : { async: !0 };
|
|
1131
|
+
let c = t._zod.run({ value: n, issues: [] }, a);
|
|
1101
1132
|
if (c instanceof Promise && (c = await c), c.issues.length) {
|
|
1102
|
-
const l = new (i?.Err ?? e)(c.issues.map((p) =>
|
|
1103
|
-
throw
|
|
1133
|
+
const l = new (i?.Err ?? e)(c.issues.map((p) => N(p, a, j())));
|
|
1134
|
+
throw zt(l, i?.callee), l;
|
|
1104
1135
|
}
|
|
1105
1136
|
return c.value;
|
|
1106
1137
|
}, _e = (e) => (t, n, o) => {
|
|
1107
|
-
const i = o ? { ...o, async: !1 } : { async: !1 },
|
|
1108
|
-
if (
|
|
1138
|
+
const i = o ? { ...o, async: !1 } : { async: !1 }, a = t._zod.run({ value: n, issues: [] }, i);
|
|
1139
|
+
if (a instanceof Promise)
|
|
1109
1140
|
throw new K();
|
|
1110
|
-
return
|
|
1141
|
+
return a.issues.length ? {
|
|
1111
1142
|
success: !1,
|
|
1112
|
-
error: new (e ??
|
|
1113
|
-
} : { success: !0, data:
|
|
1114
|
-
},
|
|
1143
|
+
error: new (e ?? $t)(a.issues.map((c) => N(c, i, j())))
|
|
1144
|
+
} : { success: !0, data: a.value };
|
|
1145
|
+
}, Wn = /* @__PURE__ */ _e(Pt), me = (e) => async (t, n, o) => {
|
|
1115
1146
|
const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
|
|
1116
|
-
let
|
|
1117
|
-
return
|
|
1147
|
+
let a = t._zod.run({ value: n, issues: [] }, i);
|
|
1148
|
+
return a instanceof Promise && (a = await a), a.issues.length ? {
|
|
1118
1149
|
success: !1,
|
|
1119
|
-
error: new e(
|
|
1120
|
-
} : { success: !0, data:
|
|
1121
|
-
},
|
|
1150
|
+
error: new e(a.issues.map((c) => N(c, i, j())))
|
|
1151
|
+
} : { success: !0, data: a.value };
|
|
1152
|
+
}, qn = /* @__PURE__ */ me(Pt), Kn = (e) => (t, n, o) => {
|
|
1122
1153
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1123
1154
|
return Le(e)(t, n, i);
|
|
1124
|
-
},
|
|
1155
|
+
}, Hn = (e) => (t, n, o) => Le(e)(t, n, o), Jn = (e) => async (t, n, o) => {
|
|
1125
1156
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1126
|
-
return
|
|
1127
|
-
},
|
|
1157
|
+
return Re(e)(t, n, i);
|
|
1158
|
+
}, Qn = (e) => async (t, n, o) => Re(e)(t, n, o), Yn = (e) => (t, n, o) => {
|
|
1128
1159
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1129
1160
|
return _e(e)(t, n, i);
|
|
1130
|
-
},
|
|
1161
|
+
}, Xn = (e) => (t, n, o) => _e(e)(t, n, o), eo = (e) => async (t, n, o) => {
|
|
1131
1162
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1132
1163
|
return me(e)(t, n, i);
|
|
1133
|
-
},
|
|
1134
|
-
function
|
|
1135
|
-
return new RegExp(
|
|
1164
|
+
}, to = (e) => async (t, n, o) => me(e)(t, n, o), no = /^[cC][^\s-]{8,}$/, oo = /^[0-9a-z]+$/, ro = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, io = /^[0-9a-vA-V]{20}$/, so = /^[A-Za-z0-9]{27}$/, ao = /^[a-zA-Z0-9_-]{21}$/, uo = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, co = /^([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})$/, Je = (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)$/, lo = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, po = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1165
|
+
function fo() {
|
|
1166
|
+
return new RegExp(po, "u");
|
|
1136
1167
|
}
|
|
1137
|
-
const
|
|
1138
|
-
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])$/, _o = /^(([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}|:))$/, mo = /^((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])$/, vo = /^(([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])$/, go = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Zt = /^[A-Za-z0-9_-]*$/, yo = /^\+(?:[0-9]){6,14}[0-9]$/, xt = "(?:(?:\\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])))", bo = /* @__PURE__ */ new RegExp(`^${xt}$`);
|
|
1169
|
+
function Lt(e) {
|
|
1139
1170
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
1140
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+)?)?`;
|
|
1141
1172
|
}
|
|
1142
|
-
function
|
|
1143
|
-
return new RegExp(`^${
|
|
1173
|
+
function wo(e) {
|
|
1174
|
+
return new RegExp(`^${Lt(e)}$`);
|
|
1144
1175
|
}
|
|
1145
|
-
function
|
|
1146
|
-
const t =
|
|
1176
|
+
function ko(e) {
|
|
1177
|
+
const t = Lt({ precision: e.precision }), n = ["Z"];
|
|
1147
1178
|
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
1148
1179
|
const o = `${t}(?:${n.join("|")})`;
|
|
1149
|
-
return new RegExp(`^${
|
|
1180
|
+
return new RegExp(`^${xt}T(?:${o})$`);
|
|
1150
1181
|
}
|
|
1151
|
-
const
|
|
1182
|
+
const Eo = (e) => {
|
|
1152
1183
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1153
1184
|
return new RegExp(`^${t}$`);
|
|
1154
|
-
},
|
|
1185
|
+
}, Co = /^-?\d+$/, So = /^-?\d+(?:\.\d+)?/, Ao = /^null$/i, To = /^[^A-Z]*$/, zo = /^[^a-z]*$/, $ = /* @__PURE__ */ m("$ZodCheck", (e, t) => {
|
|
1155
1186
|
var n;
|
|
1156
1187
|
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
1157
|
-
}),
|
|
1188
|
+
}), Rt = {
|
|
1158
1189
|
number: "number",
|
|
1159
1190
|
bigint: "bigint",
|
|
1160
1191
|
object: "date"
|
|
1161
|
-
},
|
|
1162
|
-
|
|
1163
|
-
const n =
|
|
1192
|
+
}, jt = /* @__PURE__ */ m("$ZodCheckLessThan", (e, t) => {
|
|
1193
|
+
$.init(e, t);
|
|
1194
|
+
const n = Rt[typeof t.value];
|
|
1164
1195
|
e._zod.onattach.push((o) => {
|
|
1165
|
-
const i = o._zod.bag,
|
|
1166
|
-
t.value <
|
|
1196
|
+
const i = o._zod.bag, a = (t.inclusive ? i.maximum : i.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1197
|
+
t.value < a && (t.inclusive ? i.maximum = t.value : i.exclusiveMaximum = t.value);
|
|
1167
1198
|
}), e._zod.check = (o) => {
|
|
1168
1199
|
(t.inclusive ? o.value <= t.value : o.value < t.value) || o.issues.push({
|
|
1169
1200
|
origin: n,
|
|
@@ -1175,12 +1206,12 @@ const mo = (e) => {
|
|
|
1175
1206
|
continue: !t.abort
|
|
1176
1207
|
});
|
|
1177
1208
|
};
|
|
1178
|
-
}),
|
|
1179
|
-
|
|
1180
|
-
const n =
|
|
1209
|
+
}), Nt = /* @__PURE__ */ m("$ZodCheckGreaterThan", (e, t) => {
|
|
1210
|
+
$.init(e, t);
|
|
1211
|
+
const n = Rt[typeof t.value];
|
|
1181
1212
|
e._zod.onattach.push((o) => {
|
|
1182
|
-
const i = o._zod.bag,
|
|
1183
|
-
t.value >
|
|
1213
|
+
const i = o._zod.bag, a = (t.inclusive ? i.minimum : i.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1214
|
+
t.value > a && (t.inclusive ? i.minimum = t.value : i.exclusiveMinimum = t.value);
|
|
1184
1215
|
}), e._zod.check = (o) => {
|
|
1185
1216
|
(t.inclusive ? o.value >= t.value : o.value > t.value) || o.issues.push({
|
|
1186
1217
|
origin: n,
|
|
@@ -1192,14 +1223,14 @@ const mo = (e) => {
|
|
|
1192
1223
|
continue: !t.abort
|
|
1193
1224
|
});
|
|
1194
1225
|
};
|
|
1195
|
-
}),
|
|
1196
|
-
|
|
1226
|
+
}), Io = /* @__PURE__ */ m("$ZodCheckMultipleOf", (e, t) => {
|
|
1227
|
+
$.init(e, t), e._zod.onattach.push((n) => {
|
|
1197
1228
|
var o;
|
|
1198
1229
|
(o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value);
|
|
1199
1230
|
}), e._zod.check = (n) => {
|
|
1200
1231
|
if (typeof n.value != typeof t.value)
|
|
1201
1232
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1202
|
-
(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({
|
|
1203
1234
|
origin: typeof n.value,
|
|
1204
1235
|
code: "not_multiple_of",
|
|
1205
1236
|
divisor: t.value,
|
|
@@ -1208,12 +1239,12 @@ const mo = (e) => {
|
|
|
1208
1239
|
continue: !t.abort
|
|
1209
1240
|
});
|
|
1210
1241
|
};
|
|
1211
|
-
}),
|
|
1212
|
-
|
|
1213
|
-
const n = t.format?.includes("int"), o = n ? "int" : "number", [i,
|
|
1242
|
+
}), Oo = /* @__PURE__ */ m("$ZodCheckNumberFormat", (e, t) => {
|
|
1243
|
+
$.init(e, t), t.format = t.format || "float64";
|
|
1244
|
+
const n = t.format?.includes("int"), o = n ? "int" : "number", [i, a] = Rn[t.format];
|
|
1214
1245
|
e._zod.onattach.push((c) => {
|
|
1215
1246
|
const l = c._zod.bag;
|
|
1216
|
-
l.format = t.format, l.minimum = i, l.maximum =
|
|
1247
|
+
l.format = t.format, l.minimum = i, l.maximum = a, n && (l.pattern = Co);
|
|
1217
1248
|
}), e._zod.check = (c) => {
|
|
1218
1249
|
const l = c.value;
|
|
1219
1250
|
if (n) {
|
|
@@ -1257,19 +1288,19 @@ const mo = (e) => {
|
|
|
1257
1288
|
inclusive: !0,
|
|
1258
1289
|
inst: e,
|
|
1259
1290
|
continue: !t.abort
|
|
1260
|
-
}), l >
|
|
1291
|
+
}), l > a && c.issues.push({
|
|
1261
1292
|
origin: "number",
|
|
1262
1293
|
input: l,
|
|
1263
1294
|
code: "too_big",
|
|
1264
|
-
maximum:
|
|
1295
|
+
maximum: a,
|
|
1265
1296
|
inst: e
|
|
1266
1297
|
});
|
|
1267
1298
|
};
|
|
1268
|
-
}),
|
|
1299
|
+
}), $o = /* @__PURE__ */ m("$ZodCheckMaxLength", (e, t) => {
|
|
1269
1300
|
var n;
|
|
1270
|
-
|
|
1301
|
+
$.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
|
|
1271
1302
|
const i = o.value;
|
|
1272
|
-
return !
|
|
1303
|
+
return !Pe(i) && i.length !== void 0;
|
|
1273
1304
|
}), e._zod.onattach.push((o) => {
|
|
1274
1305
|
const i = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1275
1306
|
t.maximum < i && (o._zod.bag.maximum = t.maximum);
|
|
@@ -1288,11 +1319,11 @@ const mo = (e) => {
|
|
|
1288
1319
|
continue: !t.abort
|
|
1289
1320
|
});
|
|
1290
1321
|
};
|
|
1291
|
-
}),
|
|
1322
|
+
}), Po = /* @__PURE__ */ m("$ZodCheckMinLength", (e, t) => {
|
|
1292
1323
|
var n;
|
|
1293
|
-
|
|
1324
|
+
$.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
|
|
1294
1325
|
const i = o.value;
|
|
1295
|
-
return !
|
|
1326
|
+
return !Pe(i) && i.length !== void 0;
|
|
1296
1327
|
}), e._zod.onattach.push((o) => {
|
|
1297
1328
|
const i = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1298
1329
|
t.minimum > i && (o._zod.bag.minimum = t.minimum);
|
|
@@ -1311,19 +1342,19 @@ const mo = (e) => {
|
|
|
1311
1342
|
continue: !t.abort
|
|
1312
1343
|
});
|
|
1313
1344
|
};
|
|
1314
|
-
}),
|
|
1345
|
+
}), Zo = /* @__PURE__ */ m("$ZodCheckLengthEquals", (e, t) => {
|
|
1315
1346
|
var n;
|
|
1316
|
-
|
|
1347
|
+
$.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
|
|
1317
1348
|
const i = o.value;
|
|
1318
|
-
return !
|
|
1349
|
+
return !Pe(i) && i.length !== void 0;
|
|
1319
1350
|
}), e._zod.onattach.push((o) => {
|
|
1320
1351
|
const i = o._zod.bag;
|
|
1321
1352
|
i.minimum = t.length, i.maximum = t.length, i.length = t.length;
|
|
1322
1353
|
}), e._zod.check = (o) => {
|
|
1323
|
-
const i = o.value,
|
|
1324
|
-
if (
|
|
1354
|
+
const i = o.value, a = i.length;
|
|
1355
|
+
if (a === t.length)
|
|
1325
1356
|
return;
|
|
1326
|
-
const c = xe(i), l =
|
|
1357
|
+
const c = xe(i), l = a > t.length;
|
|
1327
1358
|
o.issues.push({
|
|
1328
1359
|
origin: c,
|
|
1329
1360
|
...l ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
@@ -1334,11 +1365,11 @@ const mo = (e) => {
|
|
|
1334
1365
|
continue: !t.abort
|
|
1335
1366
|
});
|
|
1336
1367
|
};
|
|
1337
|
-
}), ve = /* @__PURE__ */
|
|
1368
|
+
}), ve = /* @__PURE__ */ m("$ZodCheckStringFormat", (e, t) => {
|
|
1338
1369
|
var n, o;
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1370
|
+
$.init(e, t), e._zod.onattach.push((i) => {
|
|
1371
|
+
const a = i._zod.bag;
|
|
1372
|
+
a.format = t.format, t.pattern && (a.patterns ?? (a.patterns = /* @__PURE__ */ new Set()), a.patterns.add(t.pattern));
|
|
1342
1373
|
}), t.pattern ? (n = e._zod).check ?? (n.check = (i) => {
|
|
1343
1374
|
t.pattern.lastIndex = 0, !t.pattern.test(i.value) && i.issues.push({
|
|
1344
1375
|
origin: "string",
|
|
@@ -1351,7 +1382,7 @@ const mo = (e) => {
|
|
|
1351
1382
|
});
|
|
1352
1383
|
}) : (o = e._zod).check ?? (o.check = () => {
|
|
1353
1384
|
});
|
|
1354
|
-
}),
|
|
1385
|
+
}), xo = /* @__PURE__ */ m("$ZodCheckRegex", (e, t) => {
|
|
1355
1386
|
ve.init(e, t), e._zod.check = (n) => {
|
|
1356
1387
|
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1357
1388
|
origin: "string",
|
|
@@ -1363,16 +1394,16 @@ const mo = (e) => {
|
|
|
1363
1394
|
continue: !t.abort
|
|
1364
1395
|
});
|
|
1365
1396
|
};
|
|
1366
|
-
}),
|
|
1367
|
-
t.pattern ?? (t.pattern =
|
|
1368
|
-
}),
|
|
1369
|
-
t.pattern ?? (t.pattern =
|
|
1370
|
-
}),
|
|
1371
|
-
|
|
1372
|
-
const n =
|
|
1397
|
+
}), Lo = /* @__PURE__ */ m("$ZodCheckLowerCase", (e, t) => {
|
|
1398
|
+
t.pattern ?? (t.pattern = To), ve.init(e, t);
|
|
1399
|
+
}), Ro = /* @__PURE__ */ m("$ZodCheckUpperCase", (e, t) => {
|
|
1400
|
+
t.pattern ?? (t.pattern = zo), ve.init(e, t);
|
|
1401
|
+
}), jo = /* @__PURE__ */ m("$ZodCheckIncludes", (e, t) => {
|
|
1402
|
+
$.init(e, t);
|
|
1403
|
+
const n = J(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
1373
1404
|
t.pattern = o, e._zod.onattach.push((i) => {
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1405
|
+
const a = i._zod.bag;
|
|
1406
|
+
a.patterns ?? (a.patterns = /* @__PURE__ */ new Set()), a.patterns.add(o);
|
|
1376
1407
|
}), e._zod.check = (i) => {
|
|
1377
1408
|
i.value.includes(t.includes, t.position) || i.issues.push({
|
|
1378
1409
|
origin: "string",
|
|
@@ -1384,9 +1415,9 @@ const mo = (e) => {
|
|
|
1384
1415
|
continue: !t.abort
|
|
1385
1416
|
});
|
|
1386
1417
|
};
|
|
1387
|
-
}),
|
|
1388
|
-
|
|
1389
|
-
const n = new RegExp(`^${
|
|
1418
|
+
}), No = /* @__PURE__ */ m("$ZodCheckStartsWith", (e, t) => {
|
|
1419
|
+
$.init(e, t);
|
|
1420
|
+
const n = new RegExp(`^${J(t.prefix)}.*`);
|
|
1390
1421
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
|
|
1391
1422
|
const i = o._zod.bag;
|
|
1392
1423
|
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(n);
|
|
@@ -1401,9 +1432,9 @@ const mo = (e) => {
|
|
|
1401
1432
|
continue: !t.abort
|
|
1402
1433
|
});
|
|
1403
1434
|
};
|
|
1404
|
-
}),
|
|
1405
|
-
|
|
1406
|
-
const n = new RegExp(`.*${
|
|
1435
|
+
}), Do = /* @__PURE__ */ m("$ZodCheckEndsWith", (e, t) => {
|
|
1436
|
+
$.init(e, t);
|
|
1437
|
+
const n = new RegExp(`.*${J(t.suffix)}$`);
|
|
1407
1438
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
|
|
1408
1439
|
const i = o._zod.bag;
|
|
1409
1440
|
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(n);
|
|
@@ -1418,12 +1449,12 @@ const mo = (e) => {
|
|
|
1418
1449
|
continue: !t.abort
|
|
1419
1450
|
});
|
|
1420
1451
|
};
|
|
1421
|
-
}),
|
|
1422
|
-
|
|
1452
|
+
}), Uo = /* @__PURE__ */ m("$ZodCheckOverwrite", (e, t) => {
|
|
1453
|
+
$.init(e, t), e._zod.check = (n) => {
|
|
1423
1454
|
n.value = t.tx(n.value);
|
|
1424
1455
|
};
|
|
1425
1456
|
});
|
|
1426
|
-
class
|
|
1457
|
+
class Mo {
|
|
1427
1458
|
constructor(t = []) {
|
|
1428
1459
|
this.content = [], this.indent = 0, this && (this.args = t);
|
|
1429
1460
|
}
|
|
@@ -1436,78 +1467,78 @@ class xo {
|
|
|
1436
1467
|
return;
|
|
1437
1468
|
}
|
|
1438
1469
|
const o = t.split(`
|
|
1439
|
-
`).filter((c) => c), i = Math.min(...o.map((c) => c.length - c.trimStart().length)),
|
|
1440
|
-
for (const c of
|
|
1470
|
+
`).filter((c) => c), i = Math.min(...o.map((c) => c.length - c.trimStart().length)), a = o.map((c) => c.slice(i)).map((c) => " ".repeat(this.indent * 2) + c);
|
|
1471
|
+
for (const c of a)
|
|
1441
1472
|
this.content.push(c);
|
|
1442
1473
|
}
|
|
1443
1474
|
compile() {
|
|
1444
|
-
const t = Function, n = this?.args, i = [...(this?.content ?? [""]).map((
|
|
1475
|
+
const t = Function, n = this?.args, i = [...(this?.content ?? [""]).map((a) => ` ${a}`)];
|
|
1445
1476
|
return new t(...n, i.join(`
|
|
1446
1477
|
`));
|
|
1447
1478
|
}
|
|
1448
1479
|
}
|
|
1449
|
-
const
|
|
1480
|
+
const Fo = {
|
|
1450
1481
|
major: 4,
|
|
1451
1482
|
minor: 1,
|
|
1452
1483
|
patch: 13
|
|
1453
|
-
},
|
|
1484
|
+
}, S = /* @__PURE__ */ m("$ZodType", (e, t) => {
|
|
1454
1485
|
var n;
|
|
1455
|
-
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version =
|
|
1486
|
+
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Fo;
|
|
1456
1487
|
const o = [...e._zod.def.checks ?? []];
|
|
1457
1488
|
e._zod.traits.has("$ZodCheck") && o.unshift(e);
|
|
1458
1489
|
for (const i of o)
|
|
1459
|
-
for (const
|
|
1460
|
-
|
|
1490
|
+
for (const a of i._zod.onattach)
|
|
1491
|
+
a(e);
|
|
1461
1492
|
if (o.length === 0)
|
|
1462
1493
|
(n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
|
|
1463
1494
|
e._zod.run = e._zod.parse;
|
|
1464
1495
|
});
|
|
1465
1496
|
else {
|
|
1466
1497
|
const i = (c, l, p) => {
|
|
1467
|
-
let
|
|
1498
|
+
let h = q(c), y;
|
|
1468
1499
|
for (const g of l) {
|
|
1469
1500
|
if (g._zod.def.when) {
|
|
1470
1501
|
if (!g._zod.def.when(c))
|
|
1471
1502
|
continue;
|
|
1472
|
-
} else if (
|
|
1503
|
+
} else if (h)
|
|
1473
1504
|
continue;
|
|
1474
1505
|
const r = c.issues.length, s = g._zod.check(c);
|
|
1475
1506
|
if (s instanceof Promise && p?.async === !1)
|
|
1476
1507
|
throw new K();
|
|
1477
1508
|
if (y || s instanceof Promise)
|
|
1478
1509
|
y = (y ?? Promise.resolve()).then(async () => {
|
|
1479
|
-
await s, c.issues.length !== r && (
|
|
1510
|
+
await s, c.issues.length !== r && (h || (h = q(c, r)));
|
|
1480
1511
|
});
|
|
1481
1512
|
else {
|
|
1482
1513
|
if (c.issues.length === r)
|
|
1483
1514
|
continue;
|
|
1484
|
-
|
|
1515
|
+
h || (h = q(c, r));
|
|
1485
1516
|
}
|
|
1486
1517
|
}
|
|
1487
1518
|
return y ? y.then(() => c) : c;
|
|
1488
|
-
},
|
|
1519
|
+
}, a = (c, l, p) => {
|
|
1489
1520
|
if (q(c))
|
|
1490
1521
|
return c.aborted = !0, c;
|
|
1491
|
-
const
|
|
1492
|
-
if (
|
|
1522
|
+
const h = i(l, o, p);
|
|
1523
|
+
if (h instanceof Promise) {
|
|
1493
1524
|
if (p.async === !1)
|
|
1494
1525
|
throw new K();
|
|
1495
|
-
return
|
|
1526
|
+
return h.then((y) => e._zod.parse(y, p));
|
|
1496
1527
|
}
|
|
1497
|
-
return e._zod.parse(
|
|
1528
|
+
return e._zod.parse(h, p);
|
|
1498
1529
|
};
|
|
1499
1530
|
e._zod.run = (c, l) => {
|
|
1500
1531
|
if (l.skipChecks)
|
|
1501
1532
|
return e._zod.parse(c, l);
|
|
1502
1533
|
if (l.direction === "backward") {
|
|
1503
|
-
const
|
|
1504
|
-
return
|
|
1534
|
+
const h = e._zod.parse({ value: c.value, issues: [] }, { ...l, skipChecks: !0 });
|
|
1535
|
+
return h instanceof Promise ? h.then((y) => a(y, c, l)) : a(h, c, l);
|
|
1505
1536
|
}
|
|
1506
1537
|
const p = e._zod.parse(c, l);
|
|
1507
1538
|
if (p instanceof Promise) {
|
|
1508
1539
|
if (l.async === !1)
|
|
1509
1540
|
throw new K();
|
|
1510
|
-
return p.then((
|
|
1541
|
+
return p.then((h) => i(h, o, l));
|
|
1511
1542
|
}
|
|
1512
1543
|
return i(p, o, l);
|
|
1513
1544
|
};
|
|
@@ -1515,17 +1546,17 @@ const Lo = {
|
|
|
1515
1546
|
e["~standard"] = {
|
|
1516
1547
|
validate: (i) => {
|
|
1517
1548
|
try {
|
|
1518
|
-
const
|
|
1519
|
-
return
|
|
1549
|
+
const a = Wn(e, i);
|
|
1550
|
+
return a.success ? { value: a.data } : { issues: a.error?.issues };
|
|
1520
1551
|
} catch {
|
|
1521
|
-
return
|
|
1552
|
+
return qn(e, i).then((c) => c.success ? { value: c.data } : { issues: c.error?.issues });
|
|
1522
1553
|
}
|
|
1523
1554
|
},
|
|
1524
1555
|
vendor: "zod",
|
|
1525
1556
|
version: 1
|
|
1526
1557
|
};
|
|
1527
|
-
}),
|
|
1528
|
-
|
|
1558
|
+
}), je = /* @__PURE__ */ m("$ZodString", (e, t) => {
|
|
1559
|
+
S.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Eo(e._zod.bag), e._zod.parse = (n, o) => {
|
|
1529
1560
|
if (t.coerce)
|
|
1530
1561
|
try {
|
|
1531
1562
|
n.value = String(n.value);
|
|
@@ -1538,11 +1569,11 @@ const Lo = {
|
|
|
1538
1569
|
inst: e
|
|
1539
1570
|
}), n;
|
|
1540
1571
|
};
|
|
1541
|
-
}), z = /* @__PURE__ */
|
|
1542
|
-
ve.init(e, t),
|
|
1543
|
-
}),
|
|
1544
|
-
t.pattern ?? (t.pattern =
|
|
1545
|
-
}),
|
|
1572
|
+
}), z = /* @__PURE__ */ m("$ZodStringFormat", (e, t) => {
|
|
1573
|
+
ve.init(e, t), je.init(e, t);
|
|
1574
|
+
}), Vo = /* @__PURE__ */ m("$ZodGUID", (e, t) => {
|
|
1575
|
+
t.pattern ?? (t.pattern = co), z.init(e, t);
|
|
1576
|
+
}), Bo = /* @__PURE__ */ m("$ZodUUID", (e, t) => {
|
|
1546
1577
|
if (t.version) {
|
|
1547
1578
|
const o = {
|
|
1548
1579
|
v1: 1,
|
|
@@ -1556,13 +1587,13 @@ const Lo = {
|
|
|
1556
1587
|
}[t.version];
|
|
1557
1588
|
if (o === void 0)
|
|
1558
1589
|
throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
1559
|
-
t.pattern ?? (t.pattern =
|
|
1590
|
+
t.pattern ?? (t.pattern = Je(o));
|
|
1560
1591
|
} else
|
|
1561
|
-
t.pattern ?? (t.pattern =
|
|
1592
|
+
t.pattern ?? (t.pattern = Je());
|
|
1562
1593
|
z.init(e, t);
|
|
1563
|
-
}),
|
|
1564
|
-
t.pattern ?? (t.pattern =
|
|
1565
|
-
}),
|
|
1594
|
+
}), Go = /* @__PURE__ */ m("$ZodEmail", (e, t) => {
|
|
1595
|
+
t.pattern ?? (t.pattern = lo), z.init(e, t);
|
|
1596
|
+
}), Wo = /* @__PURE__ */ m("$ZodURL", (e, t) => {
|
|
1566
1597
|
z.init(e, t), e._zod.check = (n) => {
|
|
1567
1598
|
try {
|
|
1568
1599
|
const o = n.value.trim(), i = new URL(o);
|
|
@@ -1594,32 +1625,32 @@ const Lo = {
|
|
|
1594
1625
|
});
|
|
1595
1626
|
}
|
|
1596
1627
|
};
|
|
1597
|
-
}),
|
|
1598
|
-
t.pattern ?? (t.pattern =
|
|
1599
|
-
}),
|
|
1600
|
-
t.pattern ?? (t.pattern =
|
|
1601
|
-
}),
|
|
1602
|
-
t.pattern ?? (t.pattern =
|
|
1603
|
-
}),
|
|
1604
|
-
t.pattern ?? (t.pattern =
|
|
1605
|
-
}),
|
|
1606
|
-
t.pattern ?? (t.pattern =
|
|
1607
|
-
}),
|
|
1608
|
-
t.pattern ?? (t.pattern =
|
|
1609
|
-
}),
|
|
1610
|
-
t.pattern ?? (t.pattern =
|
|
1611
|
-
}),
|
|
1612
|
-
t.pattern ?? (t.pattern =
|
|
1613
|
-
}),
|
|
1614
|
-
t.pattern ?? (t.pattern =
|
|
1615
|
-
}),
|
|
1616
|
-
t.pattern ?? (t.pattern =
|
|
1617
|
-
}),
|
|
1618
|
-
t.pattern ?? (t.pattern =
|
|
1619
|
-
}),
|
|
1620
|
-
t.pattern ?? (t.pattern =
|
|
1621
|
-
}),
|
|
1622
|
-
t.pattern ?? (t.pattern =
|
|
1628
|
+
}), qo = /* @__PURE__ */ m("$ZodEmoji", (e, t) => {
|
|
1629
|
+
t.pattern ?? (t.pattern = fo()), z.init(e, t);
|
|
1630
|
+
}), Ko = /* @__PURE__ */ m("$ZodNanoID", (e, t) => {
|
|
1631
|
+
t.pattern ?? (t.pattern = ao), z.init(e, t);
|
|
1632
|
+
}), Ho = /* @__PURE__ */ m("$ZodCUID", (e, t) => {
|
|
1633
|
+
t.pattern ?? (t.pattern = no), z.init(e, t);
|
|
1634
|
+
}), Jo = /* @__PURE__ */ m("$ZodCUID2", (e, t) => {
|
|
1635
|
+
t.pattern ?? (t.pattern = oo), z.init(e, t);
|
|
1636
|
+
}), Qo = /* @__PURE__ */ m("$ZodULID", (e, t) => {
|
|
1637
|
+
t.pattern ?? (t.pattern = ro), z.init(e, t);
|
|
1638
|
+
}), Yo = /* @__PURE__ */ m("$ZodXID", (e, t) => {
|
|
1639
|
+
t.pattern ?? (t.pattern = io), z.init(e, t);
|
|
1640
|
+
}), Xo = /* @__PURE__ */ m("$ZodKSUID", (e, t) => {
|
|
1641
|
+
t.pattern ?? (t.pattern = so), z.init(e, t);
|
|
1642
|
+
}), er = /* @__PURE__ */ m("$ZodISODateTime", (e, t) => {
|
|
1643
|
+
t.pattern ?? (t.pattern = ko(t)), z.init(e, t);
|
|
1644
|
+
}), tr = /* @__PURE__ */ m("$ZodISODate", (e, t) => {
|
|
1645
|
+
t.pattern ?? (t.pattern = bo), z.init(e, t);
|
|
1646
|
+
}), nr = /* @__PURE__ */ m("$ZodISOTime", (e, t) => {
|
|
1647
|
+
t.pattern ?? (t.pattern = wo(t)), z.init(e, t);
|
|
1648
|
+
}), or = /* @__PURE__ */ m("$ZodISODuration", (e, t) => {
|
|
1649
|
+
t.pattern ?? (t.pattern = uo), z.init(e, t);
|
|
1650
|
+
}), rr = /* @__PURE__ */ m("$ZodIPv4", (e, t) => {
|
|
1651
|
+
t.pattern ?? (t.pattern = ho), z.init(e, t), e._zod.bag.format = "ipv4";
|
|
1652
|
+
}), ir = /* @__PURE__ */ m("$ZodIPv6", (e, t) => {
|
|
1653
|
+
t.pattern ?? (t.pattern = _o), z.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
|
|
1623
1654
|
try {
|
|
1624
1655
|
new URL(`http://[${n.value}]`);
|
|
1625
1656
|
} catch {
|
|
@@ -1632,19 +1663,19 @@ const Lo = {
|
|
|
1632
1663
|
});
|
|
1633
1664
|
}
|
|
1634
1665
|
};
|
|
1635
|
-
}),
|
|
1636
|
-
t.pattern ?? (t.pattern =
|
|
1637
|
-
}),
|
|
1638
|
-
t.pattern ?? (t.pattern =
|
|
1666
|
+
}), sr = /* @__PURE__ */ m("$ZodCIDRv4", (e, t) => {
|
|
1667
|
+
t.pattern ?? (t.pattern = mo), z.init(e, t);
|
|
1668
|
+
}), ar = /* @__PURE__ */ m("$ZodCIDRv6", (e, t) => {
|
|
1669
|
+
t.pattern ?? (t.pattern = vo), z.init(e, t), e._zod.check = (n) => {
|
|
1639
1670
|
const o = n.value.split("/");
|
|
1640
1671
|
try {
|
|
1641
1672
|
if (o.length !== 2)
|
|
1642
1673
|
throw new Error();
|
|
1643
|
-
const [i,
|
|
1644
|
-
if (!
|
|
1674
|
+
const [i, a] = o;
|
|
1675
|
+
if (!a)
|
|
1645
1676
|
throw new Error();
|
|
1646
|
-
const c = Number(
|
|
1647
|
-
if (`${c}` !==
|
|
1677
|
+
const c = Number(a);
|
|
1678
|
+
if (`${c}` !== a)
|
|
1648
1679
|
throw new Error();
|
|
1649
1680
|
if (c < 0 || c > 128)
|
|
1650
1681
|
throw new Error();
|
|
@@ -1660,7 +1691,7 @@ const Lo = {
|
|
|
1660
1691
|
}
|
|
1661
1692
|
};
|
|
1662
1693
|
});
|
|
1663
|
-
function
|
|
1694
|
+
function Dt(e) {
|
|
1664
1695
|
if (e === "")
|
|
1665
1696
|
return !0;
|
|
1666
1697
|
if (e.length % 4 !== 0)
|
|
@@ -1671,9 +1702,9 @@ function jt(e) {
|
|
|
1671
1702
|
return !1;
|
|
1672
1703
|
}
|
|
1673
1704
|
}
|
|
1674
|
-
const
|
|
1675
|
-
t.pattern ?? (t.pattern =
|
|
1676
|
-
|
|
1705
|
+
const ur = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
|
|
1706
|
+
t.pattern ?? (t.pattern = go), z.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
|
|
1707
|
+
Dt(n.value) || n.issues.push({
|
|
1677
1708
|
code: "invalid_format",
|
|
1678
1709
|
format: "base64",
|
|
1679
1710
|
input: n.value,
|
|
@@ -1682,15 +1713,15 @@ const tr = /* @__PURE__ */ _("$ZodBase64", (e, t) => {
|
|
|
1682
1713
|
});
|
|
1683
1714
|
};
|
|
1684
1715
|
});
|
|
1685
|
-
function
|
|
1686
|
-
if (!
|
|
1716
|
+
function cr(e) {
|
|
1717
|
+
if (!Zt.test(e))
|
|
1687
1718
|
return !1;
|
|
1688
1719
|
const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
|
|
1689
|
-
return
|
|
1720
|
+
return Dt(n);
|
|
1690
1721
|
}
|
|
1691
|
-
const
|
|
1692
|
-
t.pattern ?? (t.pattern =
|
|
1693
|
-
|
|
1722
|
+
const lr = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
|
|
1723
|
+
t.pattern ?? (t.pattern = Zt), z.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
|
|
1724
|
+
cr(n.value) || n.issues.push({
|
|
1694
1725
|
code: "invalid_format",
|
|
1695
1726
|
format: "base64url",
|
|
1696
1727
|
input: n.value,
|
|
@@ -1698,10 +1729,10 @@ const or = /* @__PURE__ */ _("$ZodBase64URL", (e, t) => {
|
|
|
1698
1729
|
continue: !t.abort
|
|
1699
1730
|
});
|
|
1700
1731
|
};
|
|
1701
|
-
}),
|
|
1702
|
-
t.pattern ?? (t.pattern =
|
|
1732
|
+
}), dr = /* @__PURE__ */ m("$ZodE164", (e, t) => {
|
|
1733
|
+
t.pattern ?? (t.pattern = yo), z.init(e, t);
|
|
1703
1734
|
});
|
|
1704
|
-
function
|
|
1735
|
+
function pr(e, t = null) {
|
|
1705
1736
|
try {
|
|
1706
1737
|
const n = e.split(".");
|
|
1707
1738
|
if (n.length !== 3)
|
|
@@ -1715,9 +1746,9 @@ function ir(e, t = null) {
|
|
|
1715
1746
|
return !1;
|
|
1716
1747
|
}
|
|
1717
1748
|
}
|
|
1718
|
-
const
|
|
1749
|
+
const fr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
1719
1750
|
z.init(e, t), e._zod.check = (n) => {
|
|
1720
|
-
|
|
1751
|
+
pr(n.value, t.alg) || n.issues.push({
|
|
1721
1752
|
code: "invalid_format",
|
|
1722
1753
|
format: "jwt",
|
|
1723
1754
|
input: n.value,
|
|
@@ -1725,8 +1756,8 @@ const sr = /* @__PURE__ */ _("$ZodJWT", (e, t) => {
|
|
|
1725
1756
|
continue: !t.abort
|
|
1726
1757
|
});
|
|
1727
1758
|
};
|
|
1728
|
-
}),
|
|
1729
|
-
|
|
1759
|
+
}), Ut = /* @__PURE__ */ m("$ZodNumber", (e, t) => {
|
|
1760
|
+
S.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? So, e._zod.parse = (n, o) => {
|
|
1730
1761
|
if (t.coerce)
|
|
1731
1762
|
try {
|
|
1732
1763
|
n.value = Number(n.value);
|
|
@@ -1735,19 +1766,19 @@ const sr = /* @__PURE__ */ _("$ZodJWT", (e, t) => {
|
|
|
1735
1766
|
const i = n.value;
|
|
1736
1767
|
if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i))
|
|
1737
1768
|
return n;
|
|
1738
|
-
const
|
|
1769
|
+
const a = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : "Infinity" : void 0;
|
|
1739
1770
|
return n.issues.push({
|
|
1740
1771
|
expected: "number",
|
|
1741
1772
|
code: "invalid_type",
|
|
1742
1773
|
input: i,
|
|
1743
1774
|
inst: e,
|
|
1744
|
-
...
|
|
1775
|
+
...a ? { received: a } : {}
|
|
1745
1776
|
}), n;
|
|
1746
1777
|
};
|
|
1747
|
-
}),
|
|
1748
|
-
|
|
1749
|
-
}),
|
|
1750
|
-
|
|
1778
|
+
}), hr = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
|
|
1779
|
+
Oo.init(e, t), Ut.init(e, t);
|
|
1780
|
+
}), _r = /* @__PURE__ */ m("$ZodNull", (e, t) => {
|
|
1781
|
+
S.init(e, t), e._zod.pattern = Ao, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (n, o) => {
|
|
1751
1782
|
const i = n.value;
|
|
1752
1783
|
return i === null || n.issues.push({
|
|
1753
1784
|
expected: "null",
|
|
@@ -1756,21 +1787,21 @@ const sr = /* @__PURE__ */ _("$ZodJWT", (e, t) => {
|
|
|
1756
1787
|
inst: e
|
|
1757
1788
|
}), n;
|
|
1758
1789
|
};
|
|
1759
|
-
}),
|
|
1760
|
-
|
|
1761
|
-
}),
|
|
1762
|
-
|
|
1790
|
+
}), mr = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
|
|
1791
|
+
S.init(e, t), e._zod.parse = (n) => n;
|
|
1792
|
+
}), vr = /* @__PURE__ */ m("$ZodNever", (e, t) => {
|
|
1793
|
+
S.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
|
|
1763
1794
|
expected: "never",
|
|
1764
1795
|
code: "invalid_type",
|
|
1765
1796
|
input: n.value,
|
|
1766
1797
|
inst: e
|
|
1767
1798
|
}), n);
|
|
1768
1799
|
});
|
|
1769
|
-
function
|
|
1770
|
-
e.issues.length && t.issues.push(...
|
|
1800
|
+
function Qe(e, t, n) {
|
|
1801
|
+
e.issues.length && t.issues.push(...F(n, e.issues)), t.value[n] = e.value;
|
|
1771
1802
|
}
|
|
1772
|
-
const
|
|
1773
|
-
|
|
1803
|
+
const gr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
|
|
1804
|
+
S.init(e, t), e._zod.parse = (n, o) => {
|
|
1774
1805
|
const i = n.value;
|
|
1775
1806
|
if (!Array.isArray(i))
|
|
1776
1807
|
return n.issues.push({
|
|
@@ -1780,26 +1811,26 @@ const dr = /* @__PURE__ */ _("$ZodArray", (e, t) => {
|
|
|
1780
1811
|
inst: e
|
|
1781
1812
|
}), n;
|
|
1782
1813
|
n.value = Array(i.length);
|
|
1783
|
-
const
|
|
1814
|
+
const a = [];
|
|
1784
1815
|
for (let c = 0; c < i.length; c++) {
|
|
1785
1816
|
const l = i[c], p = t.element._zod.run({
|
|
1786
1817
|
value: l,
|
|
1787
1818
|
issues: []
|
|
1788
1819
|
}, o);
|
|
1789
|
-
p instanceof Promise ?
|
|
1820
|
+
p instanceof Promise ? a.push(p.then((h) => Qe(h, n, c))) : Qe(p, n, c);
|
|
1790
1821
|
}
|
|
1791
|
-
return
|
|
1822
|
+
return a.length ? Promise.all(a).then(() => n) : n;
|
|
1792
1823
|
};
|
|
1793
1824
|
});
|
|
1794
1825
|
function fe(e, t, n, o) {
|
|
1795
|
-
e.issues.length && t.issues.push(...
|
|
1826
|
+
e.issues.length && t.issues.push(...F(n, e.issues)), e.value === void 0 ? n in o && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
1796
1827
|
}
|
|
1797
|
-
function
|
|
1828
|
+
function Mt(e) {
|
|
1798
1829
|
const t = Object.keys(e.shape);
|
|
1799
1830
|
for (const o of t)
|
|
1800
1831
|
if (!e.shape?.[o]?._zod?.traits?.has("$ZodType"))
|
|
1801
1832
|
throw new Error(`Invalid element at key "${o}": expected a Zod schema`);
|
|
1802
|
-
const n =
|
|
1833
|
+
const n = Ln(e.shape);
|
|
1803
1834
|
return {
|
|
1804
1835
|
...e,
|
|
1805
1836
|
keys: t,
|
|
@@ -1808,12 +1839,12 @@ function Rt(e) {
|
|
|
1808
1839
|
optionalKeys: new Set(n)
|
|
1809
1840
|
};
|
|
1810
1841
|
}
|
|
1811
|
-
function
|
|
1812
|
-
const c = [], l = i.keySet, p = i.catchall._zod,
|
|
1842
|
+
function Ft(e, t, n, o, i, a) {
|
|
1843
|
+
const c = [], l = i.keySet, p = i.catchall._zod, h = p.def.type;
|
|
1813
1844
|
for (const y in t) {
|
|
1814
1845
|
if (l.has(y))
|
|
1815
1846
|
continue;
|
|
1816
|
-
if (
|
|
1847
|
+
if (h === "never") {
|
|
1817
1848
|
c.push(y);
|
|
1818
1849
|
continue;
|
|
1819
1850
|
}
|
|
@@ -1824,11 +1855,11 @@ function Dt(e, t, n, o, i, u) {
|
|
|
1824
1855
|
code: "unrecognized_keys",
|
|
1825
1856
|
keys: c,
|
|
1826
1857
|
input: t,
|
|
1827
|
-
inst:
|
|
1858
|
+
inst: a
|
|
1828
1859
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1829
1860
|
}
|
|
1830
|
-
const
|
|
1831
|
-
if (
|
|
1861
|
+
const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
1862
|
+
if (S.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1832
1863
|
const l = t.shape;
|
|
1833
1864
|
Object.defineProperty(t, "shape", {
|
|
1834
1865
|
get: () => {
|
|
@@ -1839,138 +1870,138 @@ const pr = /* @__PURE__ */ _("$ZodObject", (e, t) => {
|
|
|
1839
1870
|
}
|
|
1840
1871
|
});
|
|
1841
1872
|
}
|
|
1842
|
-
const o =
|
|
1843
|
-
|
|
1873
|
+
const o = $e(() => Mt(t));
|
|
1874
|
+
C(e._zod, "propValues", () => {
|
|
1844
1875
|
const l = t.shape, p = {};
|
|
1845
|
-
for (const
|
|
1846
|
-
const y = l[
|
|
1876
|
+
for (const h in l) {
|
|
1877
|
+
const y = l[h]._zod;
|
|
1847
1878
|
if (y.values) {
|
|
1848
|
-
p[
|
|
1879
|
+
p[h] ?? (p[h] = /* @__PURE__ */ new Set());
|
|
1849
1880
|
for (const g of y.values)
|
|
1850
|
-
p[
|
|
1881
|
+
p[h].add(g);
|
|
1851
1882
|
}
|
|
1852
1883
|
}
|
|
1853
1884
|
return p;
|
|
1854
1885
|
});
|
|
1855
|
-
const i = pe,
|
|
1886
|
+
const i = pe, a = t.catchall;
|
|
1856
1887
|
let c;
|
|
1857
1888
|
e._zod.parse = (l, p) => {
|
|
1858
1889
|
c ?? (c = o.value);
|
|
1859
|
-
const
|
|
1860
|
-
if (!i(
|
|
1890
|
+
const h = l.value;
|
|
1891
|
+
if (!i(h))
|
|
1861
1892
|
return l.issues.push({
|
|
1862
1893
|
expected: "object",
|
|
1863
1894
|
code: "invalid_type",
|
|
1864
|
-
input:
|
|
1895
|
+
input: h,
|
|
1865
1896
|
inst: e
|
|
1866
1897
|
}), l;
|
|
1867
1898
|
l.value = {};
|
|
1868
1899
|
const y = [], g = c.shape;
|
|
1869
1900
|
for (const r of c.keys) {
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1901
|
+
const u = g[r]._zod.run({ value: h[r], issues: [] }, p);
|
|
1902
|
+
u instanceof Promise ? y.push(u.then((d) => fe(d, l, r, h))) : fe(u, l, r, h);
|
|
1872
1903
|
}
|
|
1873
|
-
return
|
|
1904
|
+
return a ? Ft(y, h, l, p, o.value, e) : y.length ? Promise.all(y).then(() => l) : l;
|
|
1874
1905
|
};
|
|
1875
|
-
}),
|
|
1876
|
-
|
|
1877
|
-
const n = e._zod.parse, o =
|
|
1878
|
-
const s = new
|
|
1879
|
-
const k =
|
|
1906
|
+
}), br = /* @__PURE__ */ m("$ZodObjectJIT", (e, t) => {
|
|
1907
|
+
yr.init(e, t);
|
|
1908
|
+
const n = e._zod.parse, o = $e(() => Mt(t)), i = (r) => {
|
|
1909
|
+
const s = new Mo(["shape", "payload", "ctx"]), u = o.value, d = (w) => {
|
|
1910
|
+
const k = He(w);
|
|
1880
1911
|
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1881
1912
|
};
|
|
1882
1913
|
s.write("const input = payload.value;");
|
|
1883
1914
|
const f = /* @__PURE__ */ Object.create(null);
|
|
1884
1915
|
let v = 0;
|
|
1885
|
-
for (const w of
|
|
1916
|
+
for (const w of u.keys)
|
|
1886
1917
|
f[w] = `key_${v++}`;
|
|
1887
1918
|
s.write("const newResult = {};");
|
|
1888
|
-
for (const w of
|
|
1889
|
-
const k = f[w],
|
|
1919
|
+
for (const w of u.keys) {
|
|
1920
|
+
const k = f[w], E = He(w);
|
|
1890
1921
|
s.write(`const ${k} = ${d(w)};`), s.write(`
|
|
1891
1922
|
if (${k}.issues.length) {
|
|
1892
1923
|
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
1893
1924
|
...iss,
|
|
1894
|
-
path: iss.path ? [${
|
|
1925
|
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
|
1895
1926
|
})));
|
|
1896
1927
|
}
|
|
1897
1928
|
|
|
1898
1929
|
|
|
1899
1930
|
if (${k}.value === undefined) {
|
|
1900
|
-
if (${
|
|
1901
|
-
newResult[${
|
|
1931
|
+
if (${E} in input) {
|
|
1932
|
+
newResult[${E}] = undefined;
|
|
1902
1933
|
}
|
|
1903
1934
|
} else {
|
|
1904
|
-
newResult[${
|
|
1935
|
+
newResult[${E}] = ${k}.value;
|
|
1905
1936
|
}
|
|
1906
1937
|
|
|
1907
1938
|
`);
|
|
1908
1939
|
}
|
|
1909
1940
|
s.write("payload.value = newResult;"), s.write("return payload;");
|
|
1910
|
-
const
|
|
1911
|
-
return (w, k) =>
|
|
1941
|
+
const _ = s.compile();
|
|
1942
|
+
return (w, k) => _(r, w, k);
|
|
1912
1943
|
};
|
|
1913
|
-
let
|
|
1914
|
-
const c = pe, l = !
|
|
1944
|
+
let a;
|
|
1945
|
+
const c = pe, l = !Tt.jitless, h = l && Zn.value, y = t.catchall;
|
|
1915
1946
|
let g;
|
|
1916
1947
|
e._zod.parse = (r, s) => {
|
|
1917
1948
|
g ?? (g = o.value);
|
|
1918
|
-
const
|
|
1919
|
-
return c(
|
|
1949
|
+
const u = r.value;
|
|
1950
|
+
return c(u) ? l && h && s?.async === !1 && s.jitless !== !0 ? (a || (a = i(t.shape)), r = a(r, s), y ? Ft([], u, r, s, g, e) : r) : n(r, s) : (r.issues.push({
|
|
1920
1951
|
expected: "object",
|
|
1921
1952
|
code: "invalid_type",
|
|
1922
|
-
input:
|
|
1953
|
+
input: u,
|
|
1923
1954
|
inst: e
|
|
1924
1955
|
}), r);
|
|
1925
1956
|
};
|
|
1926
1957
|
});
|
|
1927
|
-
function
|
|
1928
|
-
for (const
|
|
1929
|
-
if (
|
|
1930
|
-
return t.value =
|
|
1931
|
-
const i = e.filter((
|
|
1958
|
+
function Ye(e, t, n, o) {
|
|
1959
|
+
for (const a of e)
|
|
1960
|
+
if (a.issues.length === 0)
|
|
1961
|
+
return t.value = a.value, t;
|
|
1962
|
+
const i = e.filter((a) => !q(a));
|
|
1932
1963
|
return i.length === 1 ? (t.value = i[0].value, i[0]) : (t.issues.push({
|
|
1933
1964
|
code: "invalid_union",
|
|
1934
1965
|
input: t.value,
|
|
1935
1966
|
inst: n,
|
|
1936
|
-
errors: e.map((
|
|
1967
|
+
errors: e.map((a) => a.issues.map((c) => N(c, o, j())))
|
|
1937
1968
|
}), t);
|
|
1938
1969
|
}
|
|
1939
|
-
const
|
|
1940
|
-
|
|
1970
|
+
const wr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
1971
|
+
S.init(e, t), C(e._zod, "optin", () => t.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), C(e._zod, "optout", () => t.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), C(e._zod, "values", () => {
|
|
1941
1972
|
if (t.options.every((i) => i._zod.values))
|
|
1942
1973
|
return new Set(t.options.flatMap((i) => Array.from(i._zod.values)));
|
|
1943
|
-
}),
|
|
1974
|
+
}), C(e._zod, "pattern", () => {
|
|
1944
1975
|
if (t.options.every((i) => i._zod.pattern)) {
|
|
1945
|
-
const i = t.options.map((
|
|
1946
|
-
return new RegExp(`^(${i.map((
|
|
1976
|
+
const i = t.options.map((a) => a._zod.pattern);
|
|
1977
|
+
return new RegExp(`^(${i.map((a) => Ze(a.source)).join("|")})$`);
|
|
1947
1978
|
}
|
|
1948
1979
|
});
|
|
1949
1980
|
const n = t.options.length === 1, o = t.options[0]._zod.run;
|
|
1950
|
-
e._zod.parse = (i,
|
|
1981
|
+
e._zod.parse = (i, a) => {
|
|
1951
1982
|
if (n)
|
|
1952
|
-
return o(i,
|
|
1983
|
+
return o(i, a);
|
|
1953
1984
|
let c = !1;
|
|
1954
1985
|
const l = [];
|
|
1955
1986
|
for (const p of t.options) {
|
|
1956
|
-
const
|
|
1987
|
+
const h = p._zod.run({
|
|
1957
1988
|
value: i.value,
|
|
1958
1989
|
issues: []
|
|
1959
|
-
},
|
|
1960
|
-
if (
|
|
1961
|
-
l.push(
|
|
1990
|
+
}, a);
|
|
1991
|
+
if (h instanceof Promise)
|
|
1992
|
+
l.push(h), c = !0;
|
|
1962
1993
|
else {
|
|
1963
|
-
if (
|
|
1964
|
-
return
|
|
1965
|
-
l.push(
|
|
1994
|
+
if (h.issues.length === 0)
|
|
1995
|
+
return h;
|
|
1996
|
+
l.push(h);
|
|
1966
1997
|
}
|
|
1967
1998
|
}
|
|
1968
|
-
return c ? Promise.all(l).then((p) =>
|
|
1999
|
+
return c ? Promise.all(l).then((p) => Ye(p, i, e, a)) : Ye(l, i, e, a);
|
|
1969
2000
|
};
|
|
1970
|
-
}),
|
|
1971
|
-
|
|
1972
|
-
const i = n.value,
|
|
1973
|
-
return
|
|
2001
|
+
}), kr = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
|
|
2002
|
+
S.init(e, t), e._zod.parse = (n, o) => {
|
|
2003
|
+
const i = n.value, a = t.left._zod.run({ value: i, issues: [] }, o), c = t.right._zod.run({ value: i, issues: [] }, o);
|
|
2004
|
+
return a instanceof Promise || c instanceof Promise ? Promise.all([a, c]).then(([p, h]) => Xe(n, p, h)) : Xe(n, a, c);
|
|
1974
2005
|
};
|
|
1975
2006
|
});
|
|
1976
2007
|
function ze(e, t) {
|
|
@@ -1978,16 +2009,16 @@ function ze(e, t) {
|
|
|
1978
2009
|
return { valid: !0, data: e };
|
|
1979
2010
|
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
1980
2011
|
return { valid: !0, data: e };
|
|
1981
|
-
if (
|
|
1982
|
-
const n = Object.keys(t), o = Object.keys(e).filter((
|
|
1983
|
-
for (const
|
|
1984
|
-
const c = ze(e[
|
|
2012
|
+
if (H(e) && H(t)) {
|
|
2013
|
+
const n = Object.keys(t), o = Object.keys(e).filter((a) => n.indexOf(a) !== -1), i = { ...e, ...t };
|
|
2014
|
+
for (const a of o) {
|
|
2015
|
+
const c = ze(e[a], t[a]);
|
|
1985
2016
|
if (!c.valid)
|
|
1986
2017
|
return {
|
|
1987
2018
|
valid: !1,
|
|
1988
|
-
mergeErrorPath: [
|
|
2019
|
+
mergeErrorPath: [a, ...c.mergeErrorPath]
|
|
1989
2020
|
};
|
|
1990
|
-
i[
|
|
2021
|
+
i[a] = c.data;
|
|
1991
2022
|
}
|
|
1992
2023
|
return { valid: !0, data: i };
|
|
1993
2024
|
}
|
|
@@ -1996,7 +2027,7 @@ function ze(e, t) {
|
|
|
1996
2027
|
return { valid: !1, mergeErrorPath: [] };
|
|
1997
2028
|
const n = [];
|
|
1998
2029
|
for (let o = 0; o < e.length; o++) {
|
|
1999
|
-
const i = e[o],
|
|
2030
|
+
const i = e[o], a = t[o], c = ze(i, a);
|
|
2000
2031
|
if (!c.valid)
|
|
2001
2032
|
return {
|
|
2002
2033
|
valid: !1,
|
|
@@ -2008,7 +2039,7 @@ function ze(e, t) {
|
|
|
2008
2039
|
}
|
|
2009
2040
|
return { valid: !1, mergeErrorPath: [] };
|
|
2010
2041
|
}
|
|
2011
|
-
function
|
|
2042
|
+
function Xe(e, t, n) {
|
|
2012
2043
|
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), q(e))
|
|
2013
2044
|
return e;
|
|
2014
2045
|
const o = ze(t.value, n.value);
|
|
@@ -2016,14 +2047,14 @@ function He(e, t, n) {
|
|
|
2016
2047
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
|
|
2017
2048
|
return e.value = o.data, e;
|
|
2018
2049
|
}
|
|
2019
|
-
const
|
|
2020
|
-
|
|
2050
|
+
const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
2051
|
+
S.init(e, t);
|
|
2021
2052
|
const n = t.items;
|
|
2022
2053
|
e._zod.parse = (o, i) => {
|
|
2023
|
-
const
|
|
2024
|
-
if (!Array.isArray(
|
|
2054
|
+
const a = o.value;
|
|
2055
|
+
if (!Array.isArray(a))
|
|
2025
2056
|
return o.issues.push({
|
|
2026
|
-
input:
|
|
2057
|
+
input: a,
|
|
2027
2058
|
inst: e,
|
|
2028
2059
|
expected: "tuple",
|
|
2029
2060
|
code: "invalid_type"
|
|
@@ -2031,67 +2062,67 @@ const mr = /* @__PURE__ */ _("$ZodTuple", (e, t) => {
|
|
|
2031
2062
|
o.value = [];
|
|
2032
2063
|
const c = [], l = [...n].reverse().findIndex((y) => y._zod.optin !== "optional"), p = l === -1 ? 0 : n.length - l;
|
|
2033
2064
|
if (!t.rest) {
|
|
2034
|
-
const y =
|
|
2065
|
+
const y = a.length > n.length, g = a.length < p - 1;
|
|
2035
2066
|
if (y || g)
|
|
2036
2067
|
return o.issues.push({
|
|
2037
2068
|
...y ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length },
|
|
2038
|
-
input:
|
|
2069
|
+
input: a,
|
|
2039
2070
|
inst: e,
|
|
2040
2071
|
origin: "array"
|
|
2041
2072
|
}), o;
|
|
2042
2073
|
}
|
|
2043
|
-
let
|
|
2074
|
+
let h = -1;
|
|
2044
2075
|
for (const y of n) {
|
|
2045
|
-
if (
|
|
2076
|
+
if (h++, h >= a.length && h >= p)
|
|
2046
2077
|
continue;
|
|
2047
2078
|
const g = y._zod.run({
|
|
2048
|
-
value:
|
|
2079
|
+
value: a[h],
|
|
2049
2080
|
issues: []
|
|
2050
2081
|
}, i);
|
|
2051
|
-
g instanceof Promise ? c.push(g.then((r) => ae(r, o,
|
|
2082
|
+
g instanceof Promise ? c.push(g.then((r) => ae(r, o, h))) : ae(g, o, h);
|
|
2052
2083
|
}
|
|
2053
2084
|
if (t.rest) {
|
|
2054
|
-
const y =
|
|
2085
|
+
const y = a.slice(n.length);
|
|
2055
2086
|
for (const g of y) {
|
|
2056
|
-
|
|
2087
|
+
h++;
|
|
2057
2088
|
const r = t.rest._zod.run({
|
|
2058
2089
|
value: g,
|
|
2059
2090
|
issues: []
|
|
2060
2091
|
}, i);
|
|
2061
|
-
r instanceof Promise ? c.push(r.then((s) => ae(s, o,
|
|
2092
|
+
r instanceof Promise ? c.push(r.then((s) => ae(s, o, h))) : ae(r, o, h);
|
|
2062
2093
|
}
|
|
2063
2094
|
}
|
|
2064
2095
|
return c.length ? Promise.all(c).then(() => o) : o;
|
|
2065
2096
|
};
|
|
2066
2097
|
});
|
|
2067
2098
|
function ae(e, t, n) {
|
|
2068
|
-
e.issues.length && t.issues.push(...
|
|
2099
|
+
e.issues.length && t.issues.push(...F(n, e.issues)), t.value[n] = e.value;
|
|
2069
2100
|
}
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2101
|
+
const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
2102
|
+
S.init(e, t), e._zod.parse = (n, o) => {
|
|
2072
2103
|
const i = n.value;
|
|
2073
|
-
if (!
|
|
2104
|
+
if (!H(i))
|
|
2074
2105
|
return n.issues.push({
|
|
2075
2106
|
expected: "record",
|
|
2076
2107
|
code: "invalid_type",
|
|
2077
2108
|
input: i,
|
|
2078
2109
|
inst: e
|
|
2079
2110
|
}), n;
|
|
2080
|
-
const
|
|
2111
|
+
const a = [], c = t.keyType._zod.values;
|
|
2081
2112
|
if (c) {
|
|
2082
2113
|
n.value = {};
|
|
2083
2114
|
const l = /* @__PURE__ */ new Set();
|
|
2084
|
-
for (const
|
|
2085
|
-
if (typeof
|
|
2086
|
-
l.add(typeof
|
|
2087
|
-
const y = t.valueType._zod.run({ value: i[
|
|
2088
|
-
y instanceof Promise ?
|
|
2089
|
-
g.issues.length && n.issues.push(...
|
|
2090
|
-
})) : (y.issues.length && n.issues.push(...
|
|
2115
|
+
for (const h of c)
|
|
2116
|
+
if (typeof h == "string" || typeof h == "number" || typeof h == "symbol") {
|
|
2117
|
+
l.add(typeof h == "number" ? h.toString() : h);
|
|
2118
|
+
const y = t.valueType._zod.run({ value: i[h], issues: [] }, o);
|
|
2119
|
+
y instanceof Promise ? a.push(y.then((g) => {
|
|
2120
|
+
g.issues.length && n.issues.push(...F(h, g.issues)), n.value[h] = g.value;
|
|
2121
|
+
})) : (y.issues.length && n.issues.push(...F(h, y.issues)), n.value[h] = y.value);
|
|
2091
2122
|
}
|
|
2092
2123
|
let p;
|
|
2093
|
-
for (const
|
|
2094
|
-
l.has(
|
|
2124
|
+
for (const h in i)
|
|
2125
|
+
l.has(h) || (p = p ?? [], p.push(h));
|
|
2095
2126
|
p && p.length > 0 && n.issues.push({
|
|
2096
2127
|
code: "unrecognized_keys",
|
|
2097
2128
|
input: i,
|
|
@@ -2110,25 +2141,25 @@ const vr = /* @__PURE__ */ _("$ZodRecord", (e, t) => {
|
|
|
2110
2141
|
n.issues.push({
|
|
2111
2142
|
code: "invalid_key",
|
|
2112
2143
|
origin: "record",
|
|
2113
|
-
issues: p.issues.map((y) =>
|
|
2144
|
+
issues: p.issues.map((y) => N(y, o, j())),
|
|
2114
2145
|
input: l,
|
|
2115
2146
|
path: [l],
|
|
2116
2147
|
inst: e
|
|
2117
2148
|
}), n.value[p.value] = p.value;
|
|
2118
2149
|
continue;
|
|
2119
2150
|
}
|
|
2120
|
-
const
|
|
2121
|
-
|
|
2122
|
-
y.issues.length && n.issues.push(...
|
|
2123
|
-
})) : (
|
|
2151
|
+
const h = t.valueType._zod.run({ value: i[l], issues: [] }, o);
|
|
2152
|
+
h instanceof Promise ? a.push(h.then((y) => {
|
|
2153
|
+
y.issues.length && n.issues.push(...F(l, y.issues)), n.value[p.value] = y.value;
|
|
2154
|
+
})) : (h.issues.length && n.issues.push(...F(l, h.issues)), n.value[p.value] = h.value);
|
|
2124
2155
|
}
|
|
2125
2156
|
}
|
|
2126
|
-
return
|
|
2157
|
+
return a.length ? Promise.all(a).then(() => n) : n;
|
|
2127
2158
|
};
|
|
2128
|
-
}),
|
|
2129
|
-
|
|
2130
|
-
const n =
|
|
2131
|
-
e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) =>
|
|
2159
|
+
}), Sr = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
|
|
2160
|
+
S.init(e, t);
|
|
2161
|
+
const n = On(t.entries), o = new Set(n);
|
|
2162
|
+
e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) => xn.has(typeof i)).map((i) => typeof i == "string" ? J(i) : i.toString()).join("|")})$`), e._zod.parse = (i, a) => {
|
|
2132
2163
|
const c = i.value;
|
|
2133
2164
|
return o.has(c) || i.issues.push({
|
|
2134
2165
|
code: "invalid_value",
|
|
@@ -2137,23 +2168,23 @@ const vr = /* @__PURE__ */ _("$ZodRecord", (e, t) => {
|
|
|
2137
2168
|
inst: e
|
|
2138
2169
|
}), i;
|
|
2139
2170
|
};
|
|
2140
|
-
}),
|
|
2141
|
-
if (
|
|
2171
|
+
}), Ar = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
|
|
2172
|
+
if (S.init(e, t), t.values.length === 0)
|
|
2142
2173
|
throw new Error("Cannot create literal schema with no valid values");
|
|
2143
2174
|
const n = new Set(t.values);
|
|
2144
|
-
e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((o) => typeof o == "string" ?
|
|
2145
|
-
const
|
|
2146
|
-
return n.has(
|
|
2175
|
+
e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((o) => typeof o == "string" ? J(o) : o ? J(o.toString()) : String(o)).join("|")})$`), e._zod.parse = (o, i) => {
|
|
2176
|
+
const a = o.value;
|
|
2177
|
+
return n.has(a) || o.issues.push({
|
|
2147
2178
|
code: "invalid_value",
|
|
2148
2179
|
values: t.values,
|
|
2149
|
-
input:
|
|
2180
|
+
input: a,
|
|
2150
2181
|
inst: e
|
|
2151
2182
|
}), o;
|
|
2152
2183
|
};
|
|
2153
|
-
}),
|
|
2154
|
-
|
|
2184
|
+
}), Tr = /* @__PURE__ */ m("$ZodTransform", (e, t) => {
|
|
2185
|
+
S.init(e, t), e._zod.parse = (n, o) => {
|
|
2155
2186
|
if (o.direction === "backward")
|
|
2156
|
-
throw new
|
|
2187
|
+
throw new At(e.constructor.name);
|
|
2157
2188
|
const i = t.transform(n.value, n);
|
|
2158
2189
|
if (o.async)
|
|
2159
2190
|
return (i instanceof Promise ? i : Promise.resolve(i)).then((c) => (n.value = c, n));
|
|
@@ -2162,50 +2193,50 @@ const vr = /* @__PURE__ */ _("$ZodRecord", (e, t) => {
|
|
|
2162
2193
|
return n.value = i, n;
|
|
2163
2194
|
};
|
|
2164
2195
|
});
|
|
2165
|
-
function
|
|
2196
|
+
function et(e, t) {
|
|
2166
2197
|
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
2167
2198
|
}
|
|
2168
|
-
const
|
|
2169
|
-
|
|
2199
|
+
const zr = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
|
|
2200
|
+
S.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", C(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), C(e._zod, "pattern", () => {
|
|
2170
2201
|
const n = t.innerType._zod.pattern;
|
|
2171
|
-
return n ? new RegExp(`^(${
|
|
2202
|
+
return n ? new RegExp(`^(${Ze(n.source)})?$`) : void 0;
|
|
2172
2203
|
}), e._zod.parse = (n, o) => {
|
|
2173
2204
|
if (t.innerType._zod.optin === "optional") {
|
|
2174
2205
|
const i = t.innerType._zod.run(n, o);
|
|
2175
|
-
return i instanceof Promise ? i.then((
|
|
2206
|
+
return i instanceof Promise ? i.then((a) => et(a, n.value)) : et(i, n.value);
|
|
2176
2207
|
}
|
|
2177
2208
|
return n.value === void 0 ? n : t.innerType._zod.run(n, o);
|
|
2178
2209
|
};
|
|
2179
|
-
}),
|
|
2180
|
-
|
|
2210
|
+
}), Ir = /* @__PURE__ */ m("$ZodNullable", (e, t) => {
|
|
2211
|
+
S.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "pattern", () => {
|
|
2181
2212
|
const n = t.innerType._zod.pattern;
|
|
2182
|
-
return n ? new RegExp(`^(${
|
|
2183
|
-
}),
|
|
2184
|
-
}),
|
|
2185
|
-
|
|
2213
|
+
return n ? new RegExp(`^(${Ze(n.source)}|null)$`) : void 0;
|
|
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
|
+
}), Or = /* @__PURE__ */ m("$ZodDefault", (e, t) => {
|
|
2216
|
+
S.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
|
|
2186
2217
|
if (o.direction === "backward")
|
|
2187
2218
|
return t.innerType._zod.run(n, o);
|
|
2188
2219
|
if (n.value === void 0)
|
|
2189
2220
|
return n.value = t.defaultValue, n;
|
|
2190
2221
|
const i = t.innerType._zod.run(n, o);
|
|
2191
|
-
return i instanceof Promise ? i.then((
|
|
2222
|
+
return i instanceof Promise ? i.then((a) => tt(a, t)) : tt(i, t);
|
|
2192
2223
|
};
|
|
2193
2224
|
});
|
|
2194
|
-
function
|
|
2225
|
+
function tt(e, t) {
|
|
2195
2226
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
2196
2227
|
}
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2199
|
-
}),
|
|
2200
|
-
|
|
2228
|
+
const $r = /* @__PURE__ */ m("$ZodPrefault", (e, t) => {
|
|
2229
|
+
S.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (o.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o));
|
|
2230
|
+
}), Pr = /* @__PURE__ */ m("$ZodNonOptional", (e, t) => {
|
|
2231
|
+
S.init(e, t), C(e._zod, "values", () => {
|
|
2201
2232
|
const n = t.innerType._zod.values;
|
|
2202
2233
|
return n ? new Set([...n].filter((o) => o !== void 0)) : void 0;
|
|
2203
2234
|
}), e._zod.parse = (n, o) => {
|
|
2204
2235
|
const i = t.innerType._zod.run(n, o);
|
|
2205
|
-
return i instanceof Promise ? i.then((
|
|
2236
|
+
return i instanceof Promise ? i.then((a) => nt(a, e)) : nt(i, e);
|
|
2206
2237
|
};
|
|
2207
2238
|
});
|
|
2208
|
-
function
|
|
2239
|
+
function nt(e, t) {
|
|
2209
2240
|
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
2210
2241
|
code: "invalid_type",
|
|
2211
2242
|
expected: "nonoptional",
|
|
@@ -2213,58 +2244,58 @@ function Xe(e, t) {
|
|
|
2213
2244
|
inst: t
|
|
2214
2245
|
}), e;
|
|
2215
2246
|
}
|
|
2216
|
-
const
|
|
2217
|
-
|
|
2247
|
+
const Zr = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
|
|
2248
|
+
S.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
|
|
2218
2249
|
if (o.direction === "backward")
|
|
2219
2250
|
return t.innerType._zod.run(n, o);
|
|
2220
2251
|
const i = t.innerType._zod.run(n, o);
|
|
2221
|
-
return i instanceof Promise ? i.then((
|
|
2252
|
+
return i instanceof Promise ? i.then((a) => (n.value = a.value, a.issues.length && (n.value = t.catchValue({
|
|
2222
2253
|
...n,
|
|
2223
2254
|
error: {
|
|
2224
|
-
issues:
|
|
2255
|
+
issues: a.issues.map((c) => N(c, o, j()))
|
|
2225
2256
|
},
|
|
2226
2257
|
input: n.value
|
|
2227
2258
|
}), n.issues = []), n)) : (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
2228
2259
|
...n,
|
|
2229
2260
|
error: {
|
|
2230
|
-
issues: i.issues.map((
|
|
2261
|
+
issues: i.issues.map((a) => N(a, o, j()))
|
|
2231
2262
|
},
|
|
2232
2263
|
input: n.value
|
|
2233
2264
|
}), n.issues = []), n);
|
|
2234
2265
|
};
|
|
2235
|
-
}),
|
|
2236
|
-
|
|
2266
|
+
}), xr = /* @__PURE__ */ m("$ZodPipe", (e, t) => {
|
|
2267
|
+
S.init(e, t), C(e._zod, "values", () => t.in._zod.values), C(e._zod, "optin", () => t.in._zod.optin), C(e._zod, "optout", () => t.out._zod.optout), C(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => {
|
|
2237
2268
|
if (o.direction === "backward") {
|
|
2238
|
-
const
|
|
2239
|
-
return
|
|
2269
|
+
const a = t.out._zod.run(n, o);
|
|
2270
|
+
return a instanceof Promise ? a.then((c) => ue(c, t.in, o)) : ue(a, t.in, o);
|
|
2240
2271
|
}
|
|
2241
2272
|
const i = t.in._zod.run(n, o);
|
|
2242
|
-
return i instanceof Promise ? i.then((
|
|
2273
|
+
return i instanceof Promise ? i.then((a) => ue(a, t.out, o)) : ue(i, t.out, o);
|
|
2243
2274
|
};
|
|
2244
2275
|
});
|
|
2245
2276
|
function ue(e, t, n) {
|
|
2246
2277
|
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
|
|
2247
2278
|
}
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2279
|
+
const Lr = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
|
|
2280
|
+
S.init(e, t), C(e._zod, "propValues", () => t.innerType._zod.propValues), C(e._zod, "values", () => t.innerType._zod.values), C(e._zod, "optin", () => t.innerType?._zod?.optin), C(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (n, o) => {
|
|
2250
2281
|
if (o.direction === "backward")
|
|
2251
2282
|
return t.innerType._zod.run(n, o);
|
|
2252
2283
|
const i = t.innerType._zod.run(n, o);
|
|
2253
|
-
return i instanceof Promise ? i.then(
|
|
2284
|
+
return i instanceof Promise ? i.then(ot) : ot(i);
|
|
2254
2285
|
};
|
|
2255
2286
|
});
|
|
2256
|
-
function
|
|
2287
|
+
function ot(e) {
|
|
2257
2288
|
return e.value = Object.freeze(e.value), e;
|
|
2258
2289
|
}
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2290
|
+
const Rr = /* @__PURE__ */ m("$ZodCustom", (e, t) => {
|
|
2291
|
+
$.init(e, t), S.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
|
|
2261
2292
|
const o = n.value, i = t.fn(o);
|
|
2262
2293
|
if (i instanceof Promise)
|
|
2263
|
-
return i.then((
|
|
2264
|
-
|
|
2294
|
+
return i.then((a) => rt(a, n, o, e));
|
|
2295
|
+
rt(i, n, o, e);
|
|
2265
2296
|
};
|
|
2266
2297
|
});
|
|
2267
|
-
function
|
|
2298
|
+
function rt(e, t, n, o) {
|
|
2268
2299
|
if (!e) {
|
|
2269
2300
|
const i = {
|
|
2270
2301
|
code: "custom",
|
|
@@ -2279,8 +2310,8 @@ function tt(e, t, n, o) {
|
|
|
2279
2310
|
o._zod.def.params && (i.params = o._zod.def.params), t.issues.push(re(i));
|
|
2280
2311
|
}
|
|
2281
2312
|
}
|
|
2282
|
-
var
|
|
2283
|
-
class
|
|
2313
|
+
var it;
|
|
2314
|
+
class jr {
|
|
2284
2315
|
constructor() {
|
|
2285
2316
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
2286
2317
|
}
|
|
@@ -2314,18 +2345,18 @@ class Ir {
|
|
|
2314
2345
|
return this._map.has(t);
|
|
2315
2346
|
}
|
|
2316
2347
|
}
|
|
2317
|
-
function
|
|
2318
|
-
return new
|
|
2348
|
+
function Nr() {
|
|
2349
|
+
return new jr();
|
|
2319
2350
|
}
|
|
2320
|
-
(
|
|
2351
|
+
(it = globalThis).__zod_globalRegistry ?? (it.__zod_globalRegistry = Nr());
|
|
2321
2352
|
const ce = globalThis.__zod_globalRegistry;
|
|
2322
|
-
function
|
|
2353
|
+
function Dr(e, t) {
|
|
2323
2354
|
return new e({
|
|
2324
2355
|
type: "string",
|
|
2325
2356
|
...b(t)
|
|
2326
2357
|
});
|
|
2327
2358
|
}
|
|
2328
|
-
function
|
|
2359
|
+
function Ur(e, t) {
|
|
2329
2360
|
return new e({
|
|
2330
2361
|
type: "string",
|
|
2331
2362
|
format: "email",
|
|
@@ -2334,7 +2365,7 @@ function Pr(e, t) {
|
|
|
2334
2365
|
...b(t)
|
|
2335
2366
|
});
|
|
2336
2367
|
}
|
|
2337
|
-
function
|
|
2368
|
+
function st(e, t) {
|
|
2338
2369
|
return new e({
|
|
2339
2370
|
type: "string",
|
|
2340
2371
|
format: "guid",
|
|
@@ -2343,7 +2374,7 @@ function ot(e, t) {
|
|
|
2343
2374
|
...b(t)
|
|
2344
2375
|
});
|
|
2345
2376
|
}
|
|
2346
|
-
function
|
|
2377
|
+
function Mr(e, t) {
|
|
2347
2378
|
return new e({
|
|
2348
2379
|
type: "string",
|
|
2349
2380
|
format: "uuid",
|
|
@@ -2352,7 +2383,7 @@ function xr(e, t) {
|
|
|
2352
2383
|
...b(t)
|
|
2353
2384
|
});
|
|
2354
2385
|
}
|
|
2355
|
-
function
|
|
2386
|
+
function Fr(e, t) {
|
|
2356
2387
|
return new e({
|
|
2357
2388
|
type: "string",
|
|
2358
2389
|
format: "uuid",
|
|
@@ -2362,7 +2393,7 @@ function Lr(e, t) {
|
|
|
2362
2393
|
...b(t)
|
|
2363
2394
|
});
|
|
2364
2395
|
}
|
|
2365
|
-
function
|
|
2396
|
+
function Vr(e, t) {
|
|
2366
2397
|
return new e({
|
|
2367
2398
|
type: "string",
|
|
2368
2399
|
format: "uuid",
|
|
@@ -2372,7 +2403,7 @@ function jr(e, t) {
|
|
|
2372
2403
|
...b(t)
|
|
2373
2404
|
});
|
|
2374
2405
|
}
|
|
2375
|
-
function
|
|
2406
|
+
function Br(e, t) {
|
|
2376
2407
|
return new e({
|
|
2377
2408
|
type: "string",
|
|
2378
2409
|
format: "uuid",
|
|
@@ -2382,7 +2413,7 @@ function Nr(e, t) {
|
|
|
2382
2413
|
...b(t)
|
|
2383
2414
|
});
|
|
2384
2415
|
}
|
|
2385
|
-
function
|
|
2416
|
+
function Gr(e, t) {
|
|
2386
2417
|
return new e({
|
|
2387
2418
|
type: "string",
|
|
2388
2419
|
format: "url",
|
|
@@ -2391,7 +2422,7 @@ function Rr(e, t) {
|
|
|
2391
2422
|
...b(t)
|
|
2392
2423
|
});
|
|
2393
2424
|
}
|
|
2394
|
-
function
|
|
2425
|
+
function Wr(e, t) {
|
|
2395
2426
|
return new e({
|
|
2396
2427
|
type: "string",
|
|
2397
2428
|
format: "emoji",
|
|
@@ -2400,7 +2431,7 @@ function Dr(e, t) {
|
|
|
2400
2431
|
...b(t)
|
|
2401
2432
|
});
|
|
2402
2433
|
}
|
|
2403
|
-
function
|
|
2434
|
+
function qr(e, t) {
|
|
2404
2435
|
return new e({
|
|
2405
2436
|
type: "string",
|
|
2406
2437
|
format: "nanoid",
|
|
@@ -2409,7 +2440,7 @@ function Fr(e, t) {
|
|
|
2409
2440
|
...b(t)
|
|
2410
2441
|
});
|
|
2411
2442
|
}
|
|
2412
|
-
function
|
|
2443
|
+
function Kr(e, t) {
|
|
2413
2444
|
return new e({
|
|
2414
2445
|
type: "string",
|
|
2415
2446
|
format: "cuid",
|
|
@@ -2418,7 +2449,7 @@ function Ur(e, t) {
|
|
|
2418
2449
|
...b(t)
|
|
2419
2450
|
});
|
|
2420
2451
|
}
|
|
2421
|
-
function
|
|
2452
|
+
function Hr(e, t) {
|
|
2422
2453
|
return new e({
|
|
2423
2454
|
type: "string",
|
|
2424
2455
|
format: "cuid2",
|
|
@@ -2427,7 +2458,7 @@ function Vr(e, t) {
|
|
|
2427
2458
|
...b(t)
|
|
2428
2459
|
});
|
|
2429
2460
|
}
|
|
2430
|
-
function
|
|
2461
|
+
function Jr(e, t) {
|
|
2431
2462
|
return new e({
|
|
2432
2463
|
type: "string",
|
|
2433
2464
|
format: "ulid",
|
|
@@ -2436,7 +2467,7 @@ function Mr(e, t) {
|
|
|
2436
2467
|
...b(t)
|
|
2437
2468
|
});
|
|
2438
2469
|
}
|
|
2439
|
-
function
|
|
2470
|
+
function Qr(e, t) {
|
|
2440
2471
|
return new e({
|
|
2441
2472
|
type: "string",
|
|
2442
2473
|
format: "xid",
|
|
@@ -2445,7 +2476,7 @@ function Br(e, t) {
|
|
|
2445
2476
|
...b(t)
|
|
2446
2477
|
});
|
|
2447
2478
|
}
|
|
2448
|
-
function
|
|
2479
|
+
function Yr(e, t) {
|
|
2449
2480
|
return new e({
|
|
2450
2481
|
type: "string",
|
|
2451
2482
|
format: "ksuid",
|
|
@@ -2454,7 +2485,7 @@ function Wr(e, t) {
|
|
|
2454
2485
|
...b(t)
|
|
2455
2486
|
});
|
|
2456
2487
|
}
|
|
2457
|
-
function
|
|
2488
|
+
function Xr(e, t) {
|
|
2458
2489
|
return new e({
|
|
2459
2490
|
type: "string",
|
|
2460
2491
|
format: "ipv4",
|
|
@@ -2463,7 +2494,7 @@ function Gr(e, t) {
|
|
|
2463
2494
|
...b(t)
|
|
2464
2495
|
});
|
|
2465
2496
|
}
|
|
2466
|
-
function
|
|
2497
|
+
function ei(e, t) {
|
|
2467
2498
|
return new e({
|
|
2468
2499
|
type: "string",
|
|
2469
2500
|
format: "ipv6",
|
|
@@ -2472,7 +2503,7 @@ function qr(e, t) {
|
|
|
2472
2503
|
...b(t)
|
|
2473
2504
|
});
|
|
2474
2505
|
}
|
|
2475
|
-
function
|
|
2506
|
+
function ti(e, t) {
|
|
2476
2507
|
return new e({
|
|
2477
2508
|
type: "string",
|
|
2478
2509
|
format: "cidrv4",
|
|
@@ -2481,7 +2512,7 @@ function Kr(e, t) {
|
|
|
2481
2512
|
...b(t)
|
|
2482
2513
|
});
|
|
2483
2514
|
}
|
|
2484
|
-
function
|
|
2515
|
+
function ni(e, t) {
|
|
2485
2516
|
return new e({
|
|
2486
2517
|
type: "string",
|
|
2487
2518
|
format: "cidrv6",
|
|
@@ -2490,7 +2521,7 @@ function Jr(e, t) {
|
|
|
2490
2521
|
...b(t)
|
|
2491
2522
|
});
|
|
2492
2523
|
}
|
|
2493
|
-
function
|
|
2524
|
+
function oi(e, t) {
|
|
2494
2525
|
return new e({
|
|
2495
2526
|
type: "string",
|
|
2496
2527
|
format: "base64",
|
|
@@ -2499,7 +2530,7 @@ function Hr(e, t) {
|
|
|
2499
2530
|
...b(t)
|
|
2500
2531
|
});
|
|
2501
2532
|
}
|
|
2502
|
-
function
|
|
2533
|
+
function ri(e, t) {
|
|
2503
2534
|
return new e({
|
|
2504
2535
|
type: "string",
|
|
2505
2536
|
format: "base64url",
|
|
@@ -2508,7 +2539,7 @@ function Qr(e, t) {
|
|
|
2508
2539
|
...b(t)
|
|
2509
2540
|
});
|
|
2510
2541
|
}
|
|
2511
|
-
function
|
|
2542
|
+
function ii(e, t) {
|
|
2512
2543
|
return new e({
|
|
2513
2544
|
type: "string",
|
|
2514
2545
|
format: "e164",
|
|
@@ -2517,7 +2548,7 @@ function Yr(e, t) {
|
|
|
2517
2548
|
...b(t)
|
|
2518
2549
|
});
|
|
2519
2550
|
}
|
|
2520
|
-
function
|
|
2551
|
+
function si(e, t) {
|
|
2521
2552
|
return new e({
|
|
2522
2553
|
type: "string",
|
|
2523
2554
|
format: "jwt",
|
|
@@ -2526,7 +2557,7 @@ function Xr(e, t) {
|
|
|
2526
2557
|
...b(t)
|
|
2527
2558
|
});
|
|
2528
2559
|
}
|
|
2529
|
-
function
|
|
2560
|
+
function ai(e, t) {
|
|
2530
2561
|
return new e({
|
|
2531
2562
|
type: "string",
|
|
2532
2563
|
format: "datetime",
|
|
@@ -2537,7 +2568,7 @@ function ei(e, t) {
|
|
|
2537
2568
|
...b(t)
|
|
2538
2569
|
});
|
|
2539
2570
|
}
|
|
2540
|
-
function
|
|
2571
|
+
function ui(e, t) {
|
|
2541
2572
|
return new e({
|
|
2542
2573
|
type: "string",
|
|
2543
2574
|
format: "date",
|
|
@@ -2545,7 +2576,7 @@ function ti(e, t) {
|
|
|
2545
2576
|
...b(t)
|
|
2546
2577
|
});
|
|
2547
2578
|
}
|
|
2548
|
-
function
|
|
2579
|
+
function ci(e, t) {
|
|
2549
2580
|
return new e({
|
|
2550
2581
|
type: "string",
|
|
2551
2582
|
format: "time",
|
|
@@ -2554,7 +2585,7 @@ function ni(e, t) {
|
|
|
2554
2585
|
...b(t)
|
|
2555
2586
|
});
|
|
2556
2587
|
}
|
|
2557
|
-
function
|
|
2588
|
+
function li(e, t) {
|
|
2558
2589
|
return new e({
|
|
2559
2590
|
type: "string",
|
|
2560
2591
|
format: "duration",
|
|
@@ -2562,14 +2593,14 @@ function oi(e, t) {
|
|
|
2562
2593
|
...b(t)
|
|
2563
2594
|
});
|
|
2564
2595
|
}
|
|
2565
|
-
function
|
|
2596
|
+
function di(e, t) {
|
|
2566
2597
|
return new e({
|
|
2567
2598
|
type: "number",
|
|
2568
2599
|
checks: [],
|
|
2569
2600
|
...b(t)
|
|
2570
2601
|
});
|
|
2571
2602
|
}
|
|
2572
|
-
function
|
|
2603
|
+
function pi(e, t) {
|
|
2573
2604
|
return new e({
|
|
2574
2605
|
type: "number",
|
|
2575
2606
|
check: "number_format",
|
|
@@ -2578,25 +2609,25 @@ function ii(e, t) {
|
|
|
2578
2609
|
...b(t)
|
|
2579
2610
|
});
|
|
2580
2611
|
}
|
|
2581
|
-
function
|
|
2612
|
+
function fi(e, t) {
|
|
2582
2613
|
return new e({
|
|
2583
2614
|
type: "null",
|
|
2584
2615
|
...b(t)
|
|
2585
2616
|
});
|
|
2586
2617
|
}
|
|
2587
|
-
function
|
|
2618
|
+
function hi(e) {
|
|
2588
2619
|
return new e({
|
|
2589
2620
|
type: "unknown"
|
|
2590
2621
|
});
|
|
2591
2622
|
}
|
|
2592
|
-
function
|
|
2623
|
+
function _i(e, t) {
|
|
2593
2624
|
return new e({
|
|
2594
2625
|
type: "never",
|
|
2595
2626
|
...b(t)
|
|
2596
2627
|
});
|
|
2597
2628
|
}
|
|
2598
|
-
function
|
|
2599
|
-
return new
|
|
2629
|
+
function at(e, t) {
|
|
2630
|
+
return new jt({
|
|
2600
2631
|
check: "less_than",
|
|
2601
2632
|
...b(t),
|
|
2602
2633
|
value: e,
|
|
@@ -2604,15 +2635,15 @@ function rt(e, t) {
|
|
|
2604
2635
|
});
|
|
2605
2636
|
}
|
|
2606
2637
|
function be(e, t) {
|
|
2607
|
-
return new
|
|
2638
|
+
return new jt({
|
|
2608
2639
|
check: "less_than",
|
|
2609
2640
|
...b(t),
|
|
2610
2641
|
value: e,
|
|
2611
2642
|
inclusive: !0
|
|
2612
2643
|
});
|
|
2613
2644
|
}
|
|
2614
|
-
function
|
|
2615
|
-
return new
|
|
2645
|
+
function ut(e, t) {
|
|
2646
|
+
return new Nt({
|
|
2616
2647
|
check: "greater_than",
|
|
2617
2648
|
...b(t),
|
|
2618
2649
|
value: e,
|
|
@@ -2620,81 +2651,81 @@ function it(e, t) {
|
|
|
2620
2651
|
});
|
|
2621
2652
|
}
|
|
2622
2653
|
function we(e, t) {
|
|
2623
|
-
return new
|
|
2654
|
+
return new Nt({
|
|
2624
2655
|
check: "greater_than",
|
|
2625
2656
|
...b(t),
|
|
2626
2657
|
value: e,
|
|
2627
2658
|
inclusive: !0
|
|
2628
2659
|
});
|
|
2629
2660
|
}
|
|
2630
|
-
function
|
|
2631
|
-
return new
|
|
2661
|
+
function ct(e, t) {
|
|
2662
|
+
return new Io({
|
|
2632
2663
|
check: "multiple_of",
|
|
2633
2664
|
...b(t),
|
|
2634
2665
|
value: e
|
|
2635
2666
|
});
|
|
2636
2667
|
}
|
|
2637
|
-
function
|
|
2638
|
-
return new
|
|
2668
|
+
function Vt(e, t) {
|
|
2669
|
+
return new $o({
|
|
2639
2670
|
check: "max_length",
|
|
2640
2671
|
...b(t),
|
|
2641
2672
|
maximum: e
|
|
2642
2673
|
});
|
|
2643
2674
|
}
|
|
2644
2675
|
function he(e, t) {
|
|
2645
|
-
return new
|
|
2676
|
+
return new Po({
|
|
2646
2677
|
check: "min_length",
|
|
2647
2678
|
...b(t),
|
|
2648
2679
|
minimum: e
|
|
2649
2680
|
});
|
|
2650
2681
|
}
|
|
2651
|
-
function
|
|
2652
|
-
return new
|
|
2682
|
+
function Bt(e, t) {
|
|
2683
|
+
return new Zo({
|
|
2653
2684
|
check: "length_equals",
|
|
2654
2685
|
...b(t),
|
|
2655
2686
|
length: e
|
|
2656
2687
|
});
|
|
2657
2688
|
}
|
|
2658
|
-
function
|
|
2659
|
-
return new
|
|
2689
|
+
function mi(e, t) {
|
|
2690
|
+
return new xo({
|
|
2660
2691
|
check: "string_format",
|
|
2661
2692
|
format: "regex",
|
|
2662
2693
|
...b(t),
|
|
2663
2694
|
pattern: e
|
|
2664
2695
|
});
|
|
2665
2696
|
}
|
|
2666
|
-
function
|
|
2667
|
-
return new
|
|
2697
|
+
function vi(e) {
|
|
2698
|
+
return new Lo({
|
|
2668
2699
|
check: "string_format",
|
|
2669
2700
|
format: "lowercase",
|
|
2670
2701
|
...b(e)
|
|
2671
2702
|
});
|
|
2672
2703
|
}
|
|
2673
|
-
function
|
|
2674
|
-
return new
|
|
2704
|
+
function gi(e) {
|
|
2705
|
+
return new Ro({
|
|
2675
2706
|
check: "string_format",
|
|
2676
2707
|
format: "uppercase",
|
|
2677
2708
|
...b(e)
|
|
2678
2709
|
});
|
|
2679
2710
|
}
|
|
2680
|
-
function
|
|
2681
|
-
return new
|
|
2711
|
+
function yi(e, t) {
|
|
2712
|
+
return new jo({
|
|
2682
2713
|
check: "string_format",
|
|
2683
2714
|
format: "includes",
|
|
2684
2715
|
...b(t),
|
|
2685
2716
|
includes: e
|
|
2686
2717
|
});
|
|
2687
2718
|
}
|
|
2688
|
-
function
|
|
2689
|
-
return new
|
|
2719
|
+
function bi(e, t) {
|
|
2720
|
+
return new No({
|
|
2690
2721
|
check: "string_format",
|
|
2691
2722
|
format: "starts_with",
|
|
2692
2723
|
...b(t),
|
|
2693
2724
|
prefix: e
|
|
2694
2725
|
});
|
|
2695
2726
|
}
|
|
2696
|
-
function
|
|
2697
|
-
return new
|
|
2727
|
+
function wi(e, t) {
|
|
2728
|
+
return new Do({
|
|
2698
2729
|
check: "string_format",
|
|
2699
2730
|
format: "ends_with",
|
|
2700
2731
|
...b(t),
|
|
@@ -2702,27 +2733,27 @@ function hi(e, t) {
|
|
|
2702
2733
|
});
|
|
2703
2734
|
}
|
|
2704
2735
|
function ee(e) {
|
|
2705
|
-
return new
|
|
2736
|
+
return new Uo({
|
|
2706
2737
|
check: "overwrite",
|
|
2707
2738
|
tx: e
|
|
2708
2739
|
});
|
|
2709
2740
|
}
|
|
2710
|
-
function
|
|
2741
|
+
function ki(e) {
|
|
2711
2742
|
return ee((t) => t.normalize(e));
|
|
2712
2743
|
}
|
|
2713
|
-
function
|
|
2744
|
+
function Ei() {
|
|
2714
2745
|
return ee((e) => e.trim());
|
|
2715
2746
|
}
|
|
2716
|
-
function
|
|
2747
|
+
function Ci() {
|
|
2717
2748
|
return ee((e) => e.toLowerCase());
|
|
2718
2749
|
}
|
|
2719
|
-
function
|
|
2750
|
+
function Si() {
|
|
2720
2751
|
return ee((e) => e.toUpperCase());
|
|
2721
2752
|
}
|
|
2722
|
-
function
|
|
2723
|
-
return ee((e) =>
|
|
2753
|
+
function Ai() {
|
|
2754
|
+
return ee((e) => Pn(e));
|
|
2724
2755
|
}
|
|
2725
|
-
function
|
|
2756
|
+
function Ti(e, t, n) {
|
|
2726
2757
|
return new e({
|
|
2727
2758
|
type: "array",
|
|
2728
2759
|
element: t,
|
|
@@ -2732,7 +2763,7 @@ function bi(e, t, n) {
|
|
|
2732
2763
|
...b(n)
|
|
2733
2764
|
});
|
|
2734
2765
|
}
|
|
2735
|
-
function
|
|
2766
|
+
function zi(e, t, n) {
|
|
2736
2767
|
return new e({
|
|
2737
2768
|
type: "custom",
|
|
2738
2769
|
check: "custom",
|
|
@@ -2740,8 +2771,8 @@ function wi(e, t, n) {
|
|
|
2740
2771
|
...b(n)
|
|
2741
2772
|
});
|
|
2742
2773
|
}
|
|
2743
|
-
function
|
|
2744
|
-
const t =
|
|
2774
|
+
function Ii(e) {
|
|
2775
|
+
const t = Oi((n) => (n.addIssue = (o) => {
|
|
2745
2776
|
if (typeof o == "string")
|
|
2746
2777
|
n.issues.push(re(o, n.value, t._zod.def));
|
|
2747
2778
|
else {
|
|
@@ -2751,45 +2782,45 @@ function ki(e) {
|
|
|
2751
2782
|
}, e(n.value, n)));
|
|
2752
2783
|
return t;
|
|
2753
2784
|
}
|
|
2754
|
-
function
|
|
2755
|
-
const n = new
|
|
2785
|
+
function Oi(e, t) {
|
|
2786
|
+
const n = new $({
|
|
2756
2787
|
check: "custom",
|
|
2757
2788
|
...b(t)
|
|
2758
2789
|
});
|
|
2759
2790
|
return n._zod.check = e, n;
|
|
2760
2791
|
}
|
|
2761
|
-
const
|
|
2762
|
-
|
|
2792
|
+
const $i = /* @__PURE__ */ m("ZodISODateTime", (e, t) => {
|
|
2793
|
+
er.init(e, t), O.init(e, t);
|
|
2763
2794
|
});
|
|
2764
|
-
function
|
|
2765
|
-
return
|
|
2795
|
+
function Pi(e) {
|
|
2796
|
+
return ai($i, e);
|
|
2766
2797
|
}
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2798
|
+
const Zi = /* @__PURE__ */ m("ZodISODate", (e, t) => {
|
|
2799
|
+
tr.init(e, t), O.init(e, t);
|
|
2769
2800
|
});
|
|
2770
|
-
function
|
|
2771
|
-
return
|
|
2801
|
+
function xi(e) {
|
|
2802
|
+
return ui(Zi, e);
|
|
2772
2803
|
}
|
|
2773
|
-
const
|
|
2774
|
-
|
|
2804
|
+
const Li = /* @__PURE__ */ m("ZodISOTime", (e, t) => {
|
|
2805
|
+
nr.init(e, t), O.init(e, t);
|
|
2775
2806
|
});
|
|
2776
|
-
function
|
|
2777
|
-
return
|
|
2807
|
+
function Ri(e) {
|
|
2808
|
+
return ci(Li, e);
|
|
2778
2809
|
}
|
|
2779
|
-
const
|
|
2780
|
-
|
|
2810
|
+
const ji = /* @__PURE__ */ m("ZodISODuration", (e, t) => {
|
|
2811
|
+
or.init(e, t), O.init(e, t);
|
|
2781
2812
|
});
|
|
2782
|
-
function
|
|
2783
|
-
return
|
|
2813
|
+
function Ni(e) {
|
|
2814
|
+
return li(ji, e);
|
|
2784
2815
|
}
|
|
2785
|
-
const
|
|
2786
|
-
|
|
2816
|
+
const Di = (e, t) => {
|
|
2817
|
+
$t.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
2787
2818
|
format: {
|
|
2788
|
-
value: (n) =>
|
|
2819
|
+
value: (n) => Gn(e, n)
|
|
2789
2820
|
// enumerable: false,
|
|
2790
2821
|
},
|
|
2791
2822
|
flatten: {
|
|
2792
|
-
value: (n) =>
|
|
2823
|
+
value: (n) => Bn(e, n)
|
|
2793
2824
|
// enumerable: false,
|
|
2794
2825
|
},
|
|
2795
2826
|
addIssue: {
|
|
@@ -2811,14 +2842,14 @@ const Oi = (e, t) => {
|
|
|
2811
2842
|
// enumerable: false,
|
|
2812
2843
|
}
|
|
2813
2844
|
});
|
|
2814
|
-
},
|
|
2845
|
+
}, Z = /* @__PURE__ */ m("ZodError", Di, {
|
|
2815
2846
|
Parent: Error
|
|
2816
|
-
}),
|
|
2847
|
+
}), Ui = /* @__PURE__ */ Le(Z), Mi = /* @__PURE__ */ Re(Z), Fi = /* @__PURE__ */ _e(Z), Vi = /* @__PURE__ */ me(Z), Bi = /* @__PURE__ */ Kn(Z), Gi = /* @__PURE__ */ Hn(Z), Wi = /* @__PURE__ */ Jn(Z), qi = /* @__PURE__ */ Qn(Z), Ki = /* @__PURE__ */ Yn(Z), Hi = /* @__PURE__ */ Xn(Z), Ji = /* @__PURE__ */ eo(Z), Qi = /* @__PURE__ */ to(Z), I = /* @__PURE__ */ m("ZodType", (e, t) => (S.init(e, t), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(B(t, {
|
|
2817
2848
|
checks: [
|
|
2818
2849
|
...t.checks ?? [],
|
|
2819
2850
|
...n.map((o) => typeof o == "function" ? { _zod: { check: o, def: { check: "custom" }, onattach: [] } } : o)
|
|
2820
2851
|
]
|
|
2821
|
-
})), 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) => Ui(e, n, o, { callee: e.parse }), e.safeParse = (n, o) => Fi(e, n, o), e.parseAsync = async (n, o) => Mi(e, n, o, { callee: e.parseAsync }), e.safeParseAsync = async (n, o) => Vi(e, n, o), e.spa = e.safeParseAsync, e.encode = (n, o) => Bi(e, n, o), e.decode = (n, o) => Gi(e, n, o), e.encodeAsync = async (n, o) => Wi(e, n, o), e.decodeAsync = async (n, o) => qi(e, n, o), e.safeEncode = (n, o) => Ki(e, n, o), e.safeDecode = (n, o) => Hi(e, n, o), e.safeEncodeAsync = async (n, o) => Ji(e, n, o), e.safeDecodeAsync = async (n, o) => Qi(e, n, o), e.refine = (n, o) => e.check(qs(n, o)), e.superRefine = (n) => e.check(Ks(n)), e.overwrite = (n) => e.check(ee(n)), e.optional = () => ft(e), e.nullable = () => ht(e), e.nullish = () => ft(ht(e)), e.nonoptional = (n) => Us(e, n), e.array = () => Es(e), e.or = (n) => G([e, n]), e.and = (n) => Ts(e, n), e.transform = (n) => _t(e, xs(n)), e.default = (n) => js(e, n), e.prefault = (n) => Ds(e, n), e.catch = (n) => Fs(e, n), e.pipe = (n) => _t(e, n), e.readonly = () => Gs(e), e.describe = (n) => {
|
|
2822
2853
|
const o = e.clone();
|
|
2823
2854
|
return ce.add(o, { description: n }), o;
|
|
2824
2855
|
}, Object.defineProperty(e, "description", {
|
|
@@ -2831,96 +2862,96 @@ const Oi = (e, t) => {
|
|
|
2831
2862
|
return ce.get(e);
|
|
2832
2863
|
const o = e.clone();
|
|
2833
2864
|
return ce.add(o, n[0]), o;
|
|
2834
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2835
|
-
|
|
2865
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Gt = /* @__PURE__ */ m("_ZodString", (e, t) => {
|
|
2866
|
+
je.init(e, t), I.init(e, t);
|
|
2836
2867
|
const n = e._zod.bag;
|
|
2837
|
-
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(
|
|
2838
|
-
}),
|
|
2839
|
-
|
|
2868
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(mi(...o)), e.includes = (...o) => e.check(yi(...o)), e.startsWith = (...o) => e.check(bi(...o)), e.endsWith = (...o) => e.check(wi(...o)), e.min = (...o) => e.check(he(...o)), e.max = (...o) => e.check(Vt(...o)), e.length = (...o) => e.check(Bt(...o)), e.nonempty = (...o) => e.check(he(1, ...o)), e.lowercase = (o) => e.check(vi(o)), e.uppercase = (o) => e.check(gi(o)), e.trim = () => e.check(Ei()), e.normalize = (...o) => e.check(ki(...o)), e.toLowerCase = () => e.check(Ci()), e.toUpperCase = () => e.check(Si()), e.slugify = () => e.check(Ai());
|
|
2869
|
+
}), Yi = /* @__PURE__ */ m("ZodString", (e, t) => {
|
|
2870
|
+
je.init(e, t), Gt.init(e, t), e.email = (n) => e.check(Ur(Xi, n)), e.url = (n) => e.check(Gr(es, n)), e.jwt = (n) => e.check(si(_s, n)), e.emoji = (n) => e.check(Wr(ts, n)), e.guid = (n) => e.check(st(lt, n)), e.uuid = (n) => e.check(Mr(le, n)), e.uuidv4 = (n) => e.check(Fr(le, n)), e.uuidv6 = (n) => e.check(Vr(le, n)), e.uuidv7 = (n) => e.check(Br(le, n)), e.nanoid = (n) => e.check(qr(ns, n)), e.guid = (n) => e.check(st(lt, n)), e.cuid = (n) => e.check(Kr(os, n)), e.cuid2 = (n) => e.check(Hr(rs, n)), e.ulid = (n) => e.check(Jr(is, n)), e.base64 = (n) => e.check(oi(ps, n)), e.base64url = (n) => e.check(ri(fs, n)), e.xid = (n) => e.check(Qr(ss, n)), e.ksuid = (n) => e.check(Yr(as, n)), e.ipv4 = (n) => e.check(Xr(us, n)), e.ipv6 = (n) => e.check(ei(cs, n)), e.cidrv4 = (n) => e.check(ti(ls, n)), e.cidrv6 = (n) => e.check(ni(ds, n)), e.e164 = (n) => e.check(ii(hs, n)), e.datetime = (n) => e.check(Pi(n)), e.date = (n) => e.check(xi(n)), e.time = (n) => e.check(Ri(n)), e.duration = (n) => e.check(Ni(n));
|
|
2840
2871
|
});
|
|
2841
2872
|
function Q(e) {
|
|
2842
|
-
return
|
|
2843
|
-
}
|
|
2844
|
-
const
|
|
2845
|
-
z.init(e, t),
|
|
2846
|
-
}),
|
|
2847
|
-
|
|
2848
|
-
}),
|
|
2849
|
-
|
|
2850
|
-
}), le = /* @__PURE__ */
|
|
2851
|
-
|
|
2852
|
-
}),
|
|
2853
|
-
|
|
2854
|
-
}),
|
|
2855
|
-
|
|
2856
|
-
}),
|
|
2857
|
-
|
|
2858
|
-
}),
|
|
2859
|
-
|
|
2860
|
-
}),
|
|
2861
|
-
|
|
2862
|
-
}),
|
|
2863
|
-
|
|
2864
|
-
}),
|
|
2865
|
-
|
|
2866
|
-
}),
|
|
2867
|
-
|
|
2868
|
-
}),
|
|
2869
|
-
|
|
2870
|
-
}),
|
|
2871
|
-
|
|
2872
|
-
}),
|
|
2873
|
-
|
|
2874
|
-
}),
|
|
2875
|
-
|
|
2876
|
-
}),
|
|
2877
|
-
|
|
2878
|
-
}),
|
|
2879
|
-
|
|
2880
|
-
}),
|
|
2881
|
-
|
|
2882
|
-
}),
|
|
2883
|
-
|
|
2884
|
-
}),
|
|
2885
|
-
|
|
2873
|
+
return Dr(Yi, e);
|
|
2874
|
+
}
|
|
2875
|
+
const O = /* @__PURE__ */ m("ZodStringFormat", (e, t) => {
|
|
2876
|
+
z.init(e, t), Gt.init(e, t);
|
|
2877
|
+
}), Xi = /* @__PURE__ */ m("ZodEmail", (e, t) => {
|
|
2878
|
+
Go.init(e, t), O.init(e, t);
|
|
2879
|
+
}), lt = /* @__PURE__ */ m("ZodGUID", (e, t) => {
|
|
2880
|
+
Vo.init(e, t), O.init(e, t);
|
|
2881
|
+
}), le = /* @__PURE__ */ m("ZodUUID", (e, t) => {
|
|
2882
|
+
Bo.init(e, t), O.init(e, t);
|
|
2883
|
+
}), es = /* @__PURE__ */ m("ZodURL", (e, t) => {
|
|
2884
|
+
Wo.init(e, t), O.init(e, t);
|
|
2885
|
+
}), ts = /* @__PURE__ */ m("ZodEmoji", (e, t) => {
|
|
2886
|
+
qo.init(e, t), O.init(e, t);
|
|
2887
|
+
}), ns = /* @__PURE__ */ m("ZodNanoID", (e, t) => {
|
|
2888
|
+
Ko.init(e, t), O.init(e, t);
|
|
2889
|
+
}), os = /* @__PURE__ */ m("ZodCUID", (e, t) => {
|
|
2890
|
+
Ho.init(e, t), O.init(e, t);
|
|
2891
|
+
}), rs = /* @__PURE__ */ m("ZodCUID2", (e, t) => {
|
|
2892
|
+
Jo.init(e, t), O.init(e, t);
|
|
2893
|
+
}), is = /* @__PURE__ */ m("ZodULID", (e, t) => {
|
|
2894
|
+
Qo.init(e, t), O.init(e, t);
|
|
2895
|
+
}), ss = /* @__PURE__ */ m("ZodXID", (e, t) => {
|
|
2896
|
+
Yo.init(e, t), O.init(e, t);
|
|
2897
|
+
}), as = /* @__PURE__ */ m("ZodKSUID", (e, t) => {
|
|
2898
|
+
Xo.init(e, t), O.init(e, t);
|
|
2899
|
+
}), us = /* @__PURE__ */ m("ZodIPv4", (e, t) => {
|
|
2900
|
+
rr.init(e, t), O.init(e, t);
|
|
2901
|
+
}), cs = /* @__PURE__ */ m("ZodIPv6", (e, t) => {
|
|
2902
|
+
ir.init(e, t), O.init(e, t);
|
|
2903
|
+
}), ls = /* @__PURE__ */ m("ZodCIDRv4", (e, t) => {
|
|
2904
|
+
sr.init(e, t), O.init(e, t);
|
|
2905
|
+
}), ds = /* @__PURE__ */ m("ZodCIDRv6", (e, t) => {
|
|
2906
|
+
ar.init(e, t), O.init(e, t);
|
|
2907
|
+
}), ps = /* @__PURE__ */ m("ZodBase64", (e, t) => {
|
|
2908
|
+
ur.init(e, t), O.init(e, t);
|
|
2909
|
+
}), fs = /* @__PURE__ */ m("ZodBase64URL", (e, t) => {
|
|
2910
|
+
lr.init(e, t), O.init(e, t);
|
|
2911
|
+
}), hs = /* @__PURE__ */ m("ZodE164", (e, t) => {
|
|
2912
|
+
dr.init(e, t), O.init(e, t);
|
|
2913
|
+
}), _s = /* @__PURE__ */ m("ZodJWT", (e, t) => {
|
|
2914
|
+
fr.init(e, t), O.init(e, t);
|
|
2915
|
+
}), Wt = /* @__PURE__ */ m("ZodNumber", (e, t) => {
|
|
2916
|
+
Ut.init(e, t), I.init(e, t), e.gt = (o, i) => e.check(ut(o, i)), e.gte = (o, i) => e.check(we(o, i)), e.min = (o, i) => e.check(we(o, i)), e.lt = (o, i) => e.check(at(o, i)), e.lte = (o, i) => e.check(be(o, i)), e.max = (o, i) => e.check(be(o, i)), e.int = (o) => e.check(dt(o)), e.safe = (o) => e.check(dt(o)), e.positive = (o) => e.check(ut(0, o)), e.nonnegative = (o) => e.check(we(0, o)), e.negative = (o) => e.check(at(0, o)), e.nonpositive = (o) => e.check(be(0, o)), e.multipleOf = (o, i) => e.check(ct(o, i)), e.step = (o, i) => e.check(ct(o, i)), e.finite = () => e;
|
|
2886
2917
|
const n = e._zod.bag;
|
|
2887
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;
|
|
2888
2919
|
});
|
|
2889
2920
|
function P(e) {
|
|
2890
|
-
return
|
|
2921
|
+
return di(Wt, e);
|
|
2891
2922
|
}
|
|
2892
|
-
const
|
|
2893
|
-
|
|
2923
|
+
const ms = /* @__PURE__ */ m("ZodNumberFormat", (e, t) => {
|
|
2924
|
+
hr.init(e, t), Wt.init(e, t);
|
|
2894
2925
|
});
|
|
2895
|
-
function
|
|
2896
|
-
return
|
|
2926
|
+
function dt(e) {
|
|
2927
|
+
return pi(ms, e);
|
|
2897
2928
|
}
|
|
2898
|
-
const
|
|
2899
|
-
|
|
2929
|
+
const vs = /* @__PURE__ */ m("ZodNull", (e, t) => {
|
|
2930
|
+
_r.init(e, t), I.init(e, t);
|
|
2900
2931
|
});
|
|
2901
|
-
function
|
|
2902
|
-
return
|
|
2932
|
+
function gs(e) {
|
|
2933
|
+
return fi(vs, e);
|
|
2903
2934
|
}
|
|
2904
|
-
const
|
|
2905
|
-
|
|
2935
|
+
const ys = /* @__PURE__ */ m("ZodUnknown", (e, t) => {
|
|
2936
|
+
mr.init(e, t), I.init(e, t);
|
|
2906
2937
|
});
|
|
2907
|
-
function
|
|
2908
|
-
return
|
|
2938
|
+
function pt() {
|
|
2939
|
+
return hi(ys);
|
|
2909
2940
|
}
|
|
2910
|
-
const
|
|
2911
|
-
|
|
2941
|
+
const bs = /* @__PURE__ */ m("ZodNever", (e, t) => {
|
|
2942
|
+
vr.init(e, t), I.init(e, t);
|
|
2912
2943
|
});
|
|
2913
|
-
function
|
|
2914
|
-
return
|
|
2944
|
+
function ws(e) {
|
|
2945
|
+
return _i(bs, e);
|
|
2915
2946
|
}
|
|
2916
|
-
const
|
|
2917
|
-
|
|
2947
|
+
const ks = /* @__PURE__ */ m("ZodArray", (e, t) => {
|
|
2948
|
+
gr.init(e, t), I.init(e, t), e.element = t.element, e.min = (n, o) => e.check(he(n, o)), e.nonempty = (n) => e.check(he(1, n)), e.max = (n, o) => e.check(Vt(n, o)), e.length = (n, o) => e.check(Bt(n, o)), e.unwrap = () => e.element;
|
|
2918
2949
|
});
|
|
2919
|
-
function
|
|
2920
|
-
return
|
|
2950
|
+
function Es(e, t) {
|
|
2951
|
+
return Ti(ks, e, t);
|
|
2921
2952
|
}
|
|
2922
|
-
const
|
|
2923
|
-
|
|
2953
|
+
const Cs = /* @__PURE__ */ m("ZodObject", (e, t) => {
|
|
2954
|
+
br.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: pt() }), e.loose = () => e.clone({ ...e._zod.def, catchall: pt() }), e.strict = () => e.clone({ ...e._zod.def, catchall: ws() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => Dn(e, n), e.safeExtend = (n) => Un(e, n), e.merge = (n) => Mn(e, n), e.pick = (n) => jn(e, n), e.omit = (n) => Nn(e, n), e.partial = (...n) => Fn(qt, e, n[0]), e.required = (...n) => Vn(Kt, e, n[0]);
|
|
2924
2955
|
});
|
|
2925
2956
|
function T(e, t) {
|
|
2926
2957
|
const n = {
|
|
@@ -2928,95 +2959,95 @@ function T(e, t) {
|
|
|
2928
2959
|
shape: e ?? {},
|
|
2929
2960
|
...b(t)
|
|
2930
2961
|
};
|
|
2931
|
-
return new
|
|
2962
|
+
return new Cs(n);
|
|
2932
2963
|
}
|
|
2933
|
-
const
|
|
2934
|
-
|
|
2964
|
+
const Ss = /* @__PURE__ */ m("ZodUnion", (e, t) => {
|
|
2965
|
+
wr.init(e, t), I.init(e, t), e.options = t.options;
|
|
2935
2966
|
});
|
|
2936
|
-
function
|
|
2937
|
-
return new
|
|
2967
|
+
function G(e, t) {
|
|
2968
|
+
return new Ss({
|
|
2938
2969
|
type: "union",
|
|
2939
2970
|
options: e,
|
|
2940
2971
|
...b(t)
|
|
2941
2972
|
});
|
|
2942
2973
|
}
|
|
2943
|
-
const
|
|
2944
|
-
|
|
2974
|
+
const As = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
|
|
2975
|
+
kr.init(e, t), I.init(e, t);
|
|
2945
2976
|
});
|
|
2946
|
-
function
|
|
2947
|
-
return new
|
|
2977
|
+
function Ts(e, t) {
|
|
2978
|
+
return new As({
|
|
2948
2979
|
type: "intersection",
|
|
2949
2980
|
left: e,
|
|
2950
2981
|
right: t
|
|
2951
2982
|
});
|
|
2952
2983
|
}
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2984
|
+
const zs = /* @__PURE__ */ m("ZodTuple", (e, t) => {
|
|
2985
|
+
Er.init(e, t), I.init(e, t), e.rest = (n) => e.clone({
|
|
2955
2986
|
...e._zod.def,
|
|
2956
2987
|
rest: n
|
|
2957
2988
|
});
|
|
2958
2989
|
});
|
|
2959
2990
|
function L(e, t, n) {
|
|
2960
|
-
const o = t instanceof
|
|
2961
|
-
return new
|
|
2991
|
+
const o = t instanceof S, i = o ? n : t, a = o ? t : null;
|
|
2992
|
+
return new zs({
|
|
2962
2993
|
type: "tuple",
|
|
2963
2994
|
items: e,
|
|
2964
|
-
rest:
|
|
2995
|
+
rest: a,
|
|
2965
2996
|
...b(i)
|
|
2966
2997
|
});
|
|
2967
2998
|
}
|
|
2968
|
-
const
|
|
2969
|
-
|
|
2999
|
+
const Is = /* @__PURE__ */ m("ZodRecord", (e, t) => {
|
|
3000
|
+
Cr.init(e, t), I.init(e, t), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
2970
3001
|
});
|
|
2971
|
-
function
|
|
2972
|
-
return new
|
|
3002
|
+
function Os(e, t, n) {
|
|
3003
|
+
return new Is({
|
|
2973
3004
|
type: "record",
|
|
2974
3005
|
keyType: e,
|
|
2975
3006
|
valueType: t,
|
|
2976
3007
|
...b(n)
|
|
2977
3008
|
});
|
|
2978
3009
|
}
|
|
2979
|
-
const
|
|
2980
|
-
|
|
3010
|
+
const Ie = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
3011
|
+
Sr.init(e, t), I.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
2981
3012
|
const n = new Set(Object.keys(t.entries));
|
|
2982
3013
|
e.extract = (o, i) => {
|
|
2983
|
-
const
|
|
3014
|
+
const a = {};
|
|
2984
3015
|
for (const c of o)
|
|
2985
3016
|
if (n.has(c))
|
|
2986
|
-
|
|
3017
|
+
a[c] = t.entries[c];
|
|
2987
3018
|
else
|
|
2988
3019
|
throw new Error(`Key ${c} not found in enum`);
|
|
2989
|
-
return new
|
|
3020
|
+
return new Ie({
|
|
2990
3021
|
...t,
|
|
2991
3022
|
checks: [],
|
|
2992
3023
|
...b(i),
|
|
2993
|
-
entries:
|
|
3024
|
+
entries: a
|
|
2994
3025
|
});
|
|
2995
3026
|
}, e.exclude = (o, i) => {
|
|
2996
|
-
const
|
|
3027
|
+
const a = { ...t.entries };
|
|
2997
3028
|
for (const c of o)
|
|
2998
3029
|
if (n.has(c))
|
|
2999
|
-
delete
|
|
3030
|
+
delete a[c];
|
|
3000
3031
|
else
|
|
3001
3032
|
throw new Error(`Key ${c} not found in enum`);
|
|
3002
|
-
return new
|
|
3033
|
+
return new Ie({
|
|
3003
3034
|
...t,
|
|
3004
3035
|
checks: [],
|
|
3005
3036
|
...b(i),
|
|
3006
|
-
entries:
|
|
3037
|
+
entries: a
|
|
3007
3038
|
});
|
|
3008
3039
|
};
|
|
3009
3040
|
});
|
|
3010
|
-
function
|
|
3041
|
+
function $s(e, t) {
|
|
3011
3042
|
const n = Array.isArray(e) ? Object.fromEntries(e.map((o) => [o, o])) : e;
|
|
3012
|
-
return new
|
|
3043
|
+
return new Ie({
|
|
3013
3044
|
type: "enum",
|
|
3014
3045
|
entries: n,
|
|
3015
3046
|
...b(t)
|
|
3016
3047
|
});
|
|
3017
3048
|
}
|
|
3018
|
-
const
|
|
3019
|
-
|
|
3049
|
+
const Ps = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
|
|
3050
|
+
Ar.init(e, t), I.init(e, t), e.values = new Set(t.values), Object.defineProperty(e, "value", {
|
|
3020
3051
|
get() {
|
|
3021
3052
|
if (t.values.length > 1)
|
|
3022
3053
|
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
@@ -3024,154 +3055,155 @@ const As = /* @__PURE__ */ _("ZodLiteral", (e, t) => {
|
|
|
3024
3055
|
}
|
|
3025
3056
|
});
|
|
3026
3057
|
});
|
|
3027
|
-
function
|
|
3028
|
-
return new
|
|
3058
|
+
function R(e, t) {
|
|
3059
|
+
return new Ps({
|
|
3029
3060
|
type: "literal",
|
|
3030
3061
|
values: Array.isArray(e) ? e : [e],
|
|
3031
3062
|
...b(t)
|
|
3032
3063
|
});
|
|
3033
3064
|
}
|
|
3034
|
-
const
|
|
3035
|
-
|
|
3065
|
+
const Zs = /* @__PURE__ */ m("ZodTransform", (e, t) => {
|
|
3066
|
+
Tr.init(e, t), I.init(e, t), e._zod.parse = (n, o) => {
|
|
3036
3067
|
if (o.direction === "backward")
|
|
3037
|
-
throw new
|
|
3038
|
-
n.addIssue = (
|
|
3039
|
-
if (typeof
|
|
3040
|
-
n.issues.push(re(
|
|
3068
|
+
throw new At(e.constructor.name);
|
|
3069
|
+
n.addIssue = (a) => {
|
|
3070
|
+
if (typeof a == "string")
|
|
3071
|
+
n.issues.push(re(a, n.value, t));
|
|
3041
3072
|
else {
|
|
3042
|
-
const c =
|
|
3073
|
+
const c = a;
|
|
3043
3074
|
c.fatal && (c.continue = !1), c.code ?? (c.code = "custom"), c.input ?? (c.input = n.value), c.inst ?? (c.inst = e), n.issues.push(re(c));
|
|
3044
3075
|
}
|
|
3045
3076
|
};
|
|
3046
3077
|
const i = t.transform(n.value, n);
|
|
3047
|
-
return i instanceof Promise ? i.then((
|
|
3078
|
+
return i instanceof Promise ? i.then((a) => (n.value = a, n)) : (n.value = i, n);
|
|
3048
3079
|
};
|
|
3049
3080
|
});
|
|
3050
|
-
function
|
|
3051
|
-
return new
|
|
3081
|
+
function xs(e) {
|
|
3082
|
+
return new Zs({
|
|
3052
3083
|
type: "transform",
|
|
3053
3084
|
transform: e
|
|
3054
3085
|
});
|
|
3055
3086
|
}
|
|
3056
|
-
const
|
|
3057
|
-
|
|
3087
|
+
const qt = /* @__PURE__ */ m("ZodOptional", (e, t) => {
|
|
3088
|
+
zr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3058
3089
|
});
|
|
3059
|
-
function
|
|
3060
|
-
return new
|
|
3090
|
+
function ft(e) {
|
|
3091
|
+
return new qt({
|
|
3061
3092
|
type: "optional",
|
|
3062
3093
|
innerType: e
|
|
3063
3094
|
});
|
|
3064
3095
|
}
|
|
3065
|
-
const
|
|
3066
|
-
|
|
3096
|
+
const Ls = /* @__PURE__ */ m("ZodNullable", (e, t) => {
|
|
3097
|
+
Ir.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3067
3098
|
});
|
|
3068
|
-
function
|
|
3069
|
-
return new
|
|
3099
|
+
function ht(e) {
|
|
3100
|
+
return new Ls({
|
|
3070
3101
|
type: "nullable",
|
|
3071
3102
|
innerType: e
|
|
3072
3103
|
});
|
|
3073
3104
|
}
|
|
3074
|
-
const
|
|
3075
|
-
|
|
3105
|
+
const Rs = /* @__PURE__ */ m("ZodDefault", (e, t) => {
|
|
3106
|
+
Or.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
3076
3107
|
});
|
|
3077
|
-
function
|
|
3078
|
-
return new
|
|
3108
|
+
function js(e, t) {
|
|
3109
|
+
return new Rs({
|
|
3079
3110
|
type: "default",
|
|
3080
3111
|
innerType: e,
|
|
3081
3112
|
get defaultValue() {
|
|
3082
|
-
return typeof t == "function" ? t() :
|
|
3113
|
+
return typeof t == "function" ? t() : It(t);
|
|
3083
3114
|
}
|
|
3084
3115
|
});
|
|
3085
3116
|
}
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3117
|
+
const Ns = /* @__PURE__ */ m("ZodPrefault", (e, t) => {
|
|
3118
|
+
$r.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3088
3119
|
});
|
|
3089
|
-
function
|
|
3090
|
-
return new
|
|
3120
|
+
function Ds(e, t) {
|
|
3121
|
+
return new Ns({
|
|
3091
3122
|
type: "prefault",
|
|
3092
3123
|
innerType: e,
|
|
3093
3124
|
get defaultValue() {
|
|
3094
|
-
return typeof t == "function" ? t() :
|
|
3125
|
+
return typeof t == "function" ? t() : It(t);
|
|
3095
3126
|
}
|
|
3096
3127
|
});
|
|
3097
3128
|
}
|
|
3098
|
-
const
|
|
3099
|
-
|
|
3129
|
+
const Kt = /* @__PURE__ */ m("ZodNonOptional", (e, t) => {
|
|
3130
|
+
Pr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3100
3131
|
});
|
|
3101
|
-
function
|
|
3102
|
-
return new
|
|
3132
|
+
function Us(e, t) {
|
|
3133
|
+
return new Kt({
|
|
3103
3134
|
type: "nonoptional",
|
|
3104
3135
|
innerType: e,
|
|
3105
3136
|
...b(t)
|
|
3106
3137
|
});
|
|
3107
3138
|
}
|
|
3108
|
-
const
|
|
3109
|
-
|
|
3139
|
+
const Ms = /* @__PURE__ */ m("ZodCatch", (e, t) => {
|
|
3140
|
+
Zr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
3110
3141
|
});
|
|
3111
|
-
function
|
|
3112
|
-
return new
|
|
3142
|
+
function Fs(e, t) {
|
|
3143
|
+
return new Ms({
|
|
3113
3144
|
type: "catch",
|
|
3114
3145
|
innerType: e,
|
|
3115
3146
|
catchValue: typeof t == "function" ? t : () => t
|
|
3116
3147
|
});
|
|
3117
3148
|
}
|
|
3118
|
-
const
|
|
3119
|
-
|
|
3149
|
+
const Vs = /* @__PURE__ */ m("ZodPipe", (e, t) => {
|
|
3150
|
+
xr.init(e, t), I.init(e, t), e.in = t.in, e.out = t.out;
|
|
3120
3151
|
});
|
|
3121
|
-
function
|
|
3122
|
-
return new
|
|
3152
|
+
function _t(e, t) {
|
|
3153
|
+
return new Vs({
|
|
3123
3154
|
type: "pipe",
|
|
3124
3155
|
in: e,
|
|
3125
3156
|
out: t
|
|
3126
3157
|
// ...util.normalizeParams(params),
|
|
3127
3158
|
});
|
|
3128
3159
|
}
|
|
3129
|
-
const
|
|
3130
|
-
|
|
3160
|
+
const Bs = /* @__PURE__ */ m("ZodReadonly", (e, t) => {
|
|
3161
|
+
Lr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3131
3162
|
});
|
|
3132
|
-
function
|
|
3133
|
-
return new
|
|
3163
|
+
function Gs(e) {
|
|
3164
|
+
return new Bs({
|
|
3134
3165
|
type: "readonly",
|
|
3135
3166
|
innerType: e
|
|
3136
3167
|
});
|
|
3137
3168
|
}
|
|
3138
|
-
const
|
|
3139
|
-
|
|
3169
|
+
const Ws = /* @__PURE__ */ m("ZodCustom", (e, t) => {
|
|
3170
|
+
Rr.init(e, t), I.init(e, t);
|
|
3140
3171
|
});
|
|
3141
|
-
function
|
|
3142
|
-
return
|
|
3172
|
+
function qs(e, t = {}) {
|
|
3173
|
+
return zi(Ws, e, t);
|
|
3143
3174
|
}
|
|
3144
|
-
function
|
|
3145
|
-
return
|
|
3175
|
+
function Ks(e) {
|
|
3176
|
+
return Ii(e);
|
|
3146
3177
|
}
|
|
3147
3178
|
const ge = T({
|
|
3148
3179
|
t: P().gte(0),
|
|
3149
3180
|
rate: P().gte(0)
|
|
3150
3181
|
}), Y = T({
|
|
3151
|
-
opacity: P().gte(0).lte(1)
|
|
3182
|
+
opacity: P().gte(0).lte(1),
|
|
3183
|
+
zIndex: P().default(0)
|
|
3152
3184
|
}), X = T({
|
|
3153
3185
|
volume: P().gte(0).lte(1)
|
|
3154
|
-
}),
|
|
3155
|
-
type:
|
|
3186
|
+
}), Hs = T({
|
|
3187
|
+
type: R("image"),
|
|
3156
3188
|
file: Q(),
|
|
3157
|
-
fit:
|
|
3158
|
-
}),
|
|
3159
|
-
type:
|
|
3189
|
+
fit: G([R("contain"), R("cover"), R("none")])
|
|
3190
|
+
}), Js = T({
|
|
3191
|
+
type: R("audio"),
|
|
3160
3192
|
file: Q(),
|
|
3161
3193
|
audioOutput: Q()
|
|
3162
|
-
}),
|
|
3163
|
-
type:
|
|
3194
|
+
}), Qs = T({
|
|
3195
|
+
type: R("video"),
|
|
3164
3196
|
file: Q(),
|
|
3165
3197
|
audioOutput: Q(),
|
|
3166
|
-
fit:
|
|
3167
|
-
}),
|
|
3198
|
+
fit: G([R("contain"), R("cover"), R("none")])
|
|
3199
|
+
}), Ne = L([P(), gs()]), Ys = L([
|
|
3168
3200
|
P(),
|
|
3169
3201
|
T({
|
|
3170
3202
|
set: T({
|
|
3171
3203
|
...Y.shape
|
|
3172
3204
|
}).partial()
|
|
3173
3205
|
}).partial()
|
|
3174
|
-
]),
|
|
3206
|
+
]), Xs = L([
|
|
3175
3207
|
P(),
|
|
3176
3208
|
T({
|
|
3177
3209
|
set: T({
|
|
@@ -3181,7 +3213,7 @@ const ge = T({
|
|
|
3181
3213
|
...Y.shape
|
|
3182
3214
|
}).partial()
|
|
3183
3215
|
}).partial()
|
|
3184
|
-
]),
|
|
3216
|
+
]), ea = L([
|
|
3185
3217
|
P(),
|
|
3186
3218
|
T({
|
|
3187
3219
|
set: T({
|
|
@@ -3189,7 +3221,7 @@ const ge = T({
|
|
|
3189
3221
|
...X.shape
|
|
3190
3222
|
}).partial()
|
|
3191
3223
|
}).partial()
|
|
3192
|
-
]),
|
|
3224
|
+
]), ta = L([
|
|
3193
3225
|
P(),
|
|
3194
3226
|
T({
|
|
3195
3227
|
set: T({
|
|
@@ -3200,7 +3232,7 @@ const ge = T({
|
|
|
3200
3232
|
...X.shape
|
|
3201
3233
|
}).partial()
|
|
3202
3234
|
}).partial()
|
|
3203
|
-
]),
|
|
3235
|
+
]), na = L([
|
|
3204
3236
|
P(),
|
|
3205
3237
|
T({
|
|
3206
3238
|
set: T({
|
|
@@ -3209,7 +3241,7 @@ const ge = T({
|
|
|
3209
3241
|
...Y.shape
|
|
3210
3242
|
}).partial()
|
|
3211
3243
|
}).partial()
|
|
3212
|
-
]),
|
|
3244
|
+
]), oa = L([
|
|
3213
3245
|
P(),
|
|
3214
3246
|
T({
|
|
3215
3247
|
set: T({
|
|
@@ -3222,36 +3254,38 @@ const ge = T({
|
|
|
3222
3254
|
...Y.shape
|
|
3223
3255
|
}).partial()
|
|
3224
3256
|
}).partial()
|
|
3225
|
-
]),
|
|
3226
|
-
...
|
|
3227
|
-
keyframes: L([
|
|
3228
|
-
}),
|
|
3229
|
-
...
|
|
3230
|
-
keyframes: L([
|
|
3231
|
-
}),
|
|
3232
|
-
...
|
|
3233
|
-
keyframes: L([
|
|
3234
|
-
}),
|
|
3235
|
-
opacity: 1
|
|
3257
|
+
]), ra = T({
|
|
3258
|
+
...Hs.shape,
|
|
3259
|
+
keyframes: L([Xs], G([Ys, Ne]))
|
|
3260
|
+
}), ia = T({
|
|
3261
|
+
...Js.shape,
|
|
3262
|
+
keyframes: L([ta], G([ea, Ne]))
|
|
3263
|
+
}), sa = T({
|
|
3264
|
+
...Qs.shape,
|
|
3265
|
+
keyframes: L([oa], G([na, Ne]))
|
|
3266
|
+
}), aa = Os(Q(), G([ra, ia, sa])), Ht = {
|
|
3267
|
+
opacity: 1,
|
|
3268
|
+
zIndex: 0
|
|
3236
3269
|
}, De = {
|
|
3237
3270
|
t: 0,
|
|
3238
3271
|
rate: 1,
|
|
3239
3272
|
volume: 1
|
|
3240
|
-
},
|
|
3273
|
+
}, Jt = {
|
|
3241
3274
|
t: 0,
|
|
3242
3275
|
rate: 1,
|
|
3243
3276
|
volume: 1,
|
|
3244
|
-
opacity: 1
|
|
3245
|
-
|
|
3277
|
+
opacity: 1,
|
|
3278
|
+
zIndex: 0
|
|
3279
|
+
}, Ca = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3246
3280
|
__proto__: null,
|
|
3247
|
-
MediaSurfaceStateSchema:
|
|
3281
|
+
MediaSurfaceStateSchema: aa,
|
|
3248
3282
|
defaultAudioOptions: De,
|
|
3249
|
-
defaultImageOptions:
|
|
3250
|
-
defaultVideoOptions:
|
|
3283
|
+
defaultImageOptions: Ht,
|
|
3284
|
+
defaultVideoOptions: Jt
|
|
3251
3285
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3252
|
-
var ke = {},
|
|
3253
|
-
function
|
|
3254
|
-
return
|
|
3286
|
+
var ke = {}, mt;
|
|
3287
|
+
function ua() {
|
|
3288
|
+
return mt || (mt = 1, function(e) {
|
|
3255
3289
|
var t = {};
|
|
3256
3290
|
/*! howler.js v2.2.1 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */
|
|
3257
3291
|
(function() {
|
|
@@ -3266,8 +3300,8 @@ function ta() {
|
|
|
3266
3300
|
if (r = parseFloat(r), s.ctx || g(), r !== void 0 && r >= 0 && r <= 1) {
|
|
3267
3301
|
if (s._volume = r, s._muted) return s;
|
|
3268
3302
|
s.usingWebAudio && s.masterGain.gain.setValueAtTime(r, o.ctx.currentTime);
|
|
3269
|
-
for (var
|
|
3270
|
-
var v = s._howls[
|
|
3303
|
+
for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var d = s._howls[u]._getSoundIds(), f = 0; f < d.length; f++) {
|
|
3304
|
+
var v = s._howls[u]._soundById(d[f]);
|
|
3271
3305
|
v && v._node && (v._node.volume = v._volume * r);
|
|
3272
3306
|
}
|
|
3273
3307
|
return s;
|
|
@@ -3276,8 +3310,8 @@ function ta() {
|
|
|
3276
3310
|
}, mute: function(r) {
|
|
3277
3311
|
var s = this || o;
|
|
3278
3312
|
s.ctx || g(), s._muted = r, s.usingWebAudio && s.masterGain.gain.setValueAtTime(r ? 0 : s._volume, o.ctx.currentTime);
|
|
3279
|
-
for (var
|
|
3280
|
-
var v = s._howls[
|
|
3313
|
+
for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var d = s._howls[u]._getSoundIds(), f = 0; f < d.length; f++) {
|
|
3314
|
+
var v = s._howls[u]._soundById(d[f]);
|
|
3281
3315
|
v && v._node && (v._node.muted = !!r || v._muted);
|
|
3282
3316
|
}
|
|
3283
3317
|
return s;
|
|
@@ -3312,13 +3346,13 @@ function ta() {
|
|
|
3312
3346
|
return r;
|
|
3313
3347
|
}
|
|
3314
3348
|
if (!s || typeof s.canPlayType != "function") return r;
|
|
3315
|
-
var
|
|
3316
|
-
return r._codecs = { mp3: !(f || !
|
|
3349
|
+
var u = s.canPlayType("audio/mpeg;").replace(/^no$/, ""), d = r._navigator && r._navigator.userAgent.match(/OPR\/([0-6].)/g), f = d && parseInt(d[0].split("/")[1], 10) < 33;
|
|
3350
|
+
return r._codecs = { mp3: !(f || !u && !s.canPlayType("audio/mp3;").replace(/^no$/, "")), mpeg: !!u, opus: !!s.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""), ogg: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), oga: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), wav: !!(s.canPlayType('audio/wav; codecs="1"') || s.canPlayType("audio/wav")).replace(/^no$/, ""), aac: !!s.canPlayType("audio/aac;").replace(/^no$/, ""), caf: !!s.canPlayType("audio/x-caf;").replace(/^no$/, ""), m4a: !!(s.canPlayType("audio/x-m4a;") || s.canPlayType("audio/m4a;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), m4b: !!(s.canPlayType("audio/x-m4b;") || s.canPlayType("audio/m4b;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), mp4: !!(s.canPlayType("audio/x-mp4;") || s.canPlayType("audio/mp4;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), weba: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), webm: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), dolby: !!s.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""), flac: !!(s.canPlayType("audio/x-flac;") || s.canPlayType("audio/flac;")).replace(/^no$/, "") }, r;
|
|
3317
3351
|
}, _unlockAudio: function() {
|
|
3318
3352
|
var r = this || o;
|
|
3319
3353
|
if (!r._audioUnlocked && r.ctx) {
|
|
3320
3354
|
r._audioUnlocked = !1, r.autoUnlock = !1, r._mobileUnloaded || r.ctx.sampleRate === 44100 || (r._mobileUnloaded = !0, r.unload()), r._scratchBuffer = r.ctx.createBuffer(1, 1, 22050);
|
|
3321
|
-
var s = function(
|
|
3355
|
+
var s = function(u) {
|
|
3322
3356
|
for (; r._html5AudioPool.length < r.html5PoolSize; ) try {
|
|
3323
3357
|
var d = new Audio();
|
|
3324
3358
|
d._unlocked = !0, r._releaseHtml5Audio(d);
|
|
@@ -3326,15 +3360,15 @@ function ta() {
|
|
|
3326
3360
|
r.noAudio = !0;
|
|
3327
3361
|
break;
|
|
3328
3362
|
}
|
|
3329
|
-
for (var f = 0; f < r._howls.length; f++) if (!r._howls[f]._webAudio) for (var v = r._howls[f]._getSoundIds(),
|
|
3330
|
-
var w = r._howls[f]._soundById(v[
|
|
3363
|
+
for (var f = 0; f < r._howls.length; f++) if (!r._howls[f]._webAudio) for (var v = r._howls[f]._getSoundIds(), _ = 0; _ < v.length; _++) {
|
|
3364
|
+
var w = r._howls[f]._soundById(v[_]);
|
|
3331
3365
|
w && w._node && !w._node._unlocked && (w._node._unlocked = !0, w._node.load());
|
|
3332
3366
|
}
|
|
3333
3367
|
r._autoResume();
|
|
3334
3368
|
var k = r.ctx.createBufferSource();
|
|
3335
3369
|
k.buffer = r._scratchBuffer, k.connect(r.ctx.destination), k.start === void 0 ? k.noteOn(0) : k.start(0), typeof r.ctx.resume == "function" && r.ctx.resume(), k.onended = function() {
|
|
3336
3370
|
k.disconnect(0), r._audioUnlocked = !0, document.removeEventListener("touchstart", s, !0), document.removeEventListener("touchend", s, !0), document.removeEventListener("click", s, !0);
|
|
3337
|
-
for (var
|
|
3371
|
+
for (var E = 0; E < r._howls.length; E++) r._howls[E]._emit("unlock");
|
|
3338
3372
|
};
|
|
3339
3373
|
};
|
|
3340
3374
|
return document.addEventListener("touchstart", s, !0), document.addEventListener("touchend", s, !0), document.addEventListener("click", s, !0), r;
|
|
@@ -3353,7 +3387,7 @@ function ta() {
|
|
|
3353
3387
|
var r = this;
|
|
3354
3388
|
if (r.autoSuspend && r.ctx && r.ctx.suspend !== void 0 && o.usingWebAudio) {
|
|
3355
3389
|
for (var s = 0; s < r._howls.length; s++) if (r._howls[s]._webAudio) {
|
|
3356
|
-
for (var
|
|
3390
|
+
for (var u = 0; u < r._howls[s]._sounds.length; u++) if (!r._howls[s]._sounds[u]._paused) return r;
|
|
3357
3391
|
}
|
|
3358
3392
|
return r._suspendTimer && clearTimeout(r._suspendTimer), r._suspendTimer = setTimeout(function() {
|
|
3359
3393
|
if (r.autoSuspend) {
|
|
@@ -3386,97 +3420,97 @@ function ta() {
|
|
|
3386
3420
|
var r = this, s = null;
|
|
3387
3421
|
if (o.noAudio) return void r._emit("loaderror", null, "No audio support.");
|
|
3388
3422
|
typeof r._src == "string" && (r._src = [r._src]);
|
|
3389
|
-
for (var
|
|
3423
|
+
for (var u = 0; u < r._src.length; u++) {
|
|
3390
3424
|
var d, f;
|
|
3391
|
-
if (r._format && r._format[
|
|
3425
|
+
if (r._format && r._format[u]) d = r._format[u];
|
|
3392
3426
|
else {
|
|
3393
|
-
if (typeof (f = r._src[
|
|
3427
|
+
if (typeof (f = r._src[u]) != "string") {
|
|
3394
3428
|
r._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
|
|
3395
3429
|
continue;
|
|
3396
3430
|
}
|
|
3397
3431
|
d = /^data:audio\/([^;,]+);/i.exec(f), d || (d = /\.([^.]+)$/.exec(f.split("?", 1)[0])), d && (d = d[1].toLowerCase());
|
|
3398
3432
|
}
|
|
3399
3433
|
if (d || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), d && o.codecs(d)) {
|
|
3400
|
-
s = r._src[
|
|
3434
|
+
s = r._src[u];
|
|
3401
3435
|
break;
|
|
3402
3436
|
}
|
|
3403
3437
|
}
|
|
3404
|
-
return s ? (r._src = s, r._state = "loading", window.location.protocol === "https:" && s.slice(0, 5) === "http:" && (r._html5 = !0, r._webAudio = !1), new
|
|
3438
|
+
return s ? (r._src = s, r._state = "loading", window.location.protocol === "https:" && s.slice(0, 5) === "http:" && (r._html5 = !0, r._webAudio = !1), new a(r), r._webAudio && l(r), r) : void r._emit("loaderror", null, "No codec support for selected audio sources.");
|
|
3405
3439
|
}, play: function(r, s) {
|
|
3406
|
-
var
|
|
3440
|
+
var u = this, d = null;
|
|
3407
3441
|
if (typeof r == "number") d = r, r = null;
|
|
3408
3442
|
else {
|
|
3409
|
-
if (typeof r == "string" &&
|
|
3410
|
-
if (r === void 0 && (r = "__default", !
|
|
3411
|
-
for (var f = 0, v = 0; v <
|
|
3443
|
+
if (typeof r == "string" && u._state === "loaded" && !u._sprite[r]) return null;
|
|
3444
|
+
if (r === void 0 && (r = "__default", !u._playLock)) {
|
|
3445
|
+
for (var f = 0, v = 0; v < u._sounds.length; v++) u._sounds[v]._paused && !u._sounds[v]._ended && (f++, d = u._sounds[v]._id);
|
|
3412
3446
|
f === 1 ? r = null : d = null;
|
|
3413
3447
|
}
|
|
3414
3448
|
}
|
|
3415
|
-
var
|
|
3416
|
-
if (!
|
|
3417
|
-
if (d && !r && (r =
|
|
3418
|
-
|
|
3419
|
-
var w =
|
|
3420
|
-
return
|
|
3421
|
-
|
|
3449
|
+
var _ = d ? u._soundById(d) : u._inactiveSound();
|
|
3450
|
+
if (!_) return null;
|
|
3451
|
+
if (d && !r && (r = _._sprite || "__default"), u._state !== "loaded") {
|
|
3452
|
+
_._sprite = r, _._ended = !1;
|
|
3453
|
+
var w = _._id;
|
|
3454
|
+
return u._queue.push({ event: "play", action: function() {
|
|
3455
|
+
u.play(w);
|
|
3422
3456
|
} }), w;
|
|
3423
3457
|
}
|
|
3424
|
-
if (d && !
|
|
3425
|
-
|
|
3426
|
-
var k = Math.max(0,
|
|
3427
|
-
|
|
3458
|
+
if (d && !_._paused) return s || u._loadQueue("play"), _._id;
|
|
3459
|
+
u._webAudio && o._autoResume();
|
|
3460
|
+
var k = Math.max(0, _._seek > 0 ? _._seek : u._sprite[r][0] / 1e3), E = Math.max(0, (u._sprite[r][0] + u._sprite[r][1]) / 1e3 - k), x = 1e3 * E / Math.abs(_._rate), U = u._sprite[r][0] / 1e3, ie = (u._sprite[r][0] + u._sprite[r][1]) / 1e3;
|
|
3461
|
+
_._sprite = r, _._ended = !1;
|
|
3428
3462
|
var ye = function() {
|
|
3429
|
-
|
|
3463
|
+
_._paused = !1, _._seek = k, _._start = U, _._stop = ie, _._loop = !(!_._loop && !u._sprite[r][2]);
|
|
3430
3464
|
};
|
|
3431
|
-
if (k >= ie) return void
|
|
3432
|
-
var
|
|
3433
|
-
if (
|
|
3434
|
-
var
|
|
3435
|
-
|
|
3436
|
-
var
|
|
3437
|
-
|
|
3438
|
-
|
|
3465
|
+
if (k >= ie) return void u._ended(_);
|
|
3466
|
+
var A = _._node;
|
|
3467
|
+
if (u._webAudio) {
|
|
3468
|
+
var Ve = function() {
|
|
3469
|
+
u._playLock = !1, ye(), u._refreshBuffer(_);
|
|
3470
|
+
var W = _._muted || u._muted ? 0 : _._volume;
|
|
3471
|
+
A.gain.setValueAtTime(W, o.ctx.currentTime), _._playStart = o.ctx.currentTime, A.bufferSource.start === void 0 ? _._loop ? A.bufferSource.noteGrainOn(0, k, 86400) : A.bufferSource.noteGrainOn(0, k, E) : _._loop ? A.bufferSource.start(0, k, 86400) : A.bufferSource.start(0, k, E), x !== 1 / 0 && (u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x)), s || setTimeout(function() {
|
|
3472
|
+
u._emit("play", _._id), u._loadQueue();
|
|
3439
3473
|
}, 0);
|
|
3440
3474
|
};
|
|
3441
|
-
o.state === "running" && o.ctx.state !== "interrupted" ?
|
|
3475
|
+
o.state === "running" && o.ctx.state !== "interrupted" ? Ve() : (u._playLock = !0, u.once("resume", Ve), u._clearTimer(_._id));
|
|
3442
3476
|
} else {
|
|
3443
|
-
var
|
|
3444
|
-
|
|
3477
|
+
var Be = function() {
|
|
3478
|
+
A.currentTime = k, A.muted = _._muted || u._muted || o._muted || A.muted, A.volume = _._volume * o.volume(), A.playbackRate = _._rate;
|
|
3445
3479
|
try {
|
|
3446
|
-
var
|
|
3447
|
-
if (
|
|
3448
|
-
|
|
3480
|
+
var W = A.play();
|
|
3481
|
+
if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (u._playLock = !0, ye(), W.then(function() {
|
|
3482
|
+
u._playLock = !1, A._unlocked = !0, s || (u._emit("play", _._id), u._loadQueue());
|
|
3449
3483
|
}).catch(function() {
|
|
3450
|
-
|
|
3451
|
-
})) : s || (
|
|
3452
|
-
r !== "__default" ||
|
|
3453
|
-
|
|
3454
|
-
},
|
|
3455
|
-
} catch (
|
|
3456
|
-
|
|
3484
|
+
u._playLock = !1, u._emit("playerror", _._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."), _._ended = !0, _._paused = !0;
|
|
3485
|
+
})) : s || (u._playLock = !1, ye(), u._emit("play", _._id), u._loadQueue()), A.playbackRate = _._rate, A.paused) return void u._emit("playerror", _._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
|
|
3486
|
+
r !== "__default" || _._loop ? u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x) : (u._endTimers[_._id] = function() {
|
|
3487
|
+
u._ended(_), A.removeEventListener("ended", u._endTimers[_._id], !1);
|
|
3488
|
+
}, A.addEventListener("ended", u._endTimers[_._id], !1));
|
|
3489
|
+
} catch (nn) {
|
|
3490
|
+
u._emit("playerror", _._id, nn);
|
|
3457
3491
|
}
|
|
3458
3492
|
};
|
|
3459
|
-
|
|
3460
|
-
var
|
|
3461
|
-
if (
|
|
3493
|
+
A.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (A.src = u._src, A.load());
|
|
3494
|
+
var tn = window && window.ejecta || !A.readyState && o._navigator.isCocoonJS;
|
|
3495
|
+
if (A.readyState >= 3 || tn) Be();
|
|
3462
3496
|
else {
|
|
3463
|
-
|
|
3464
|
-
var
|
|
3465
|
-
|
|
3497
|
+
u._playLock = !0;
|
|
3498
|
+
var Ge = function() {
|
|
3499
|
+
Be(), A.removeEventListener(o._canPlayEvent, Ge, !1);
|
|
3466
3500
|
};
|
|
3467
|
-
|
|
3501
|
+
A.addEventListener(o._canPlayEvent, Ge, !1), u._clearTimer(_._id);
|
|
3468
3502
|
}
|
|
3469
3503
|
}
|
|
3470
|
-
return
|
|
3504
|
+
return _._id;
|
|
3471
3505
|
}, pause: function(r) {
|
|
3472
3506
|
var s = this;
|
|
3473
3507
|
if (s._state !== "loaded" || s._playLock) return s._queue.push({ event: "pause", action: function() {
|
|
3474
3508
|
s.pause(r);
|
|
3475
3509
|
} }), s;
|
|
3476
|
-
for (var
|
|
3477
|
-
s._clearTimer(
|
|
3478
|
-
var f = s._soundById(
|
|
3479
|
-
if (f && !f._paused && (f._seek = s.seek(
|
|
3510
|
+
for (var u = s._getSoundIds(r), d = 0; d < u.length; d++) {
|
|
3511
|
+
s._clearTimer(u[d]);
|
|
3512
|
+
var f = s._soundById(u[d]);
|
|
3513
|
+
if (f && !f._paused && (f._seek = s.seek(u[d]), f._rateSeek = 0, f._paused = !0, s._stopFade(u[d]), f._node)) if (s._webAudio) {
|
|
3480
3514
|
if (!f._node.bufferSource) continue;
|
|
3481
3515
|
f._node.bufferSource.stop === void 0 ? f._node.bufferSource.noteOff(0) : f._node.bufferSource.stop(0), s._cleanBuffer(f._node);
|
|
3482
3516
|
} else isNaN(f._node.duration) && f._node.duration !== 1 / 0 || f._node.pause();
|
|
@@ -3484,160 +3518,160 @@ function ta() {
|
|
|
3484
3518
|
}
|
|
3485
3519
|
return s;
|
|
3486
3520
|
}, stop: function(r, s) {
|
|
3487
|
-
var
|
|
3488
|
-
if (
|
|
3489
|
-
|
|
3490
|
-
} }),
|
|
3491
|
-
for (var d =
|
|
3492
|
-
|
|
3493
|
-
var v =
|
|
3494
|
-
v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0,
|
|
3521
|
+
var u = this;
|
|
3522
|
+
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "stop", action: function() {
|
|
3523
|
+
u.stop(r, s);
|
|
3524
|
+
} }), u;
|
|
3525
|
+
for (var d = u._getSoundIds(r), f = 0; f < d.length; f++) {
|
|
3526
|
+
u._clearTimer(d[f]);
|
|
3527
|
+
var v = u._soundById(d[f]);
|
|
3528
|
+
v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, u._stopFade(d[f]), v._node && (u._webAudio ? v._node.bufferSource && (v._node.bufferSource.stop === void 0 ? v._node.bufferSource.noteOff(0) : v._node.bufferSource.stop(0), u._cleanBuffer(v._node)) : isNaN(v._node.duration) && v._node.duration !== 1 / 0 || (v._node.currentTime = v._start || 0, v._node.pause(), v._node.duration === 1 / 0 && u._clearSound(v._node))), s || u._emit("stop", v._id));
|
|
3495
3529
|
}
|
|
3496
|
-
return
|
|
3530
|
+
return u;
|
|
3497
3531
|
}, mute: function(r, s) {
|
|
3498
|
-
var
|
|
3499
|
-
if (
|
|
3500
|
-
|
|
3501
|
-
} }),
|
|
3532
|
+
var u = this;
|
|
3533
|
+
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "mute", action: function() {
|
|
3534
|
+
u.mute(r, s);
|
|
3535
|
+
} }), u;
|
|
3502
3536
|
if (s === void 0) {
|
|
3503
|
-
if (typeof r != "boolean") return
|
|
3504
|
-
|
|
3537
|
+
if (typeof r != "boolean") return u._muted;
|
|
3538
|
+
u._muted = r;
|
|
3505
3539
|
}
|
|
3506
|
-
for (var d =
|
|
3507
|
-
var v =
|
|
3508
|
-
v && (v._muted = r, v._interval &&
|
|
3540
|
+
for (var d = u._getSoundIds(s), f = 0; f < d.length; f++) {
|
|
3541
|
+
var v = u._soundById(d[f]);
|
|
3542
|
+
v && (v._muted = r, v._interval && u._stopFade(v._id), u._webAudio && v._node ? v._node.gain.setValueAtTime(r ? 0 : v._volume, o.ctx.currentTime) : v._node && (v._node.muted = !!o._muted || r), u._emit("mute", v._id));
|
|
3509
3543
|
}
|
|
3510
|
-
return
|
|
3544
|
+
return u;
|
|
3511
3545
|
}, volume: function() {
|
|
3512
|
-
var r, s,
|
|
3513
|
-
if (d.length === 0) return
|
|
3514
|
-
d.length === 1 || d.length === 2 && d[1] === void 0 ?
|
|
3546
|
+
var r, s, u = this, d = arguments;
|
|
3547
|
+
if (d.length === 0) return u._volume;
|
|
3548
|
+
d.length === 1 || d.length === 2 && d[1] === void 0 ? u._getSoundIds().indexOf(d[0]) >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]) : d.length >= 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3515
3549
|
var f;
|
|
3516
|
-
if (!(r !== void 0 && r >= 0 && r <= 1)) return f = s ?
|
|
3517
|
-
if (
|
|
3518
|
-
|
|
3519
|
-
} }),
|
|
3520
|
-
s === void 0 && (
|
|
3521
|
-
for (var v = 0; v < s.length; v++) (f =
|
|
3522
|
-
return
|
|
3523
|
-
}, fade: function(r, s,
|
|
3550
|
+
if (!(r !== void 0 && r >= 0 && r <= 1)) return f = s ? u._soundById(s) : u._sounds[0], f ? f._volume : 0;
|
|
3551
|
+
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "volume", action: function() {
|
|
3552
|
+
u.volume.apply(u, d);
|
|
3553
|
+
} }), u;
|
|
3554
|
+
s === void 0 && (u._volume = r), s = u._getSoundIds(s);
|
|
3555
|
+
for (var v = 0; v < s.length; v++) (f = u._soundById(s[v])) && (f._volume = r, d[2] || u._stopFade(s[v]), u._webAudio && f._node && !f._muted ? f._node.gain.setValueAtTime(r, o.ctx.currentTime) : f._node && !f._muted && (f._node.volume = r * o.volume()), u._emit("volume", f._id));
|
|
3556
|
+
return u;
|
|
3557
|
+
}, fade: function(r, s, u, d) {
|
|
3524
3558
|
var f = this;
|
|
3525
3559
|
if (f._state !== "loaded" || f._playLock) return f._queue.push({ event: "fade", action: function() {
|
|
3526
|
-
f.fade(r, s,
|
|
3560
|
+
f.fade(r, s, u, d);
|
|
3527
3561
|
} }), f;
|
|
3528
|
-
r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1),
|
|
3529
|
-
for (var v = f._getSoundIds(d),
|
|
3530
|
-
var w = f._soundById(v[
|
|
3562
|
+
r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), u = parseFloat(u), f.volume(r, d);
|
|
3563
|
+
for (var v = f._getSoundIds(d), _ = 0; _ < v.length; _++) {
|
|
3564
|
+
var w = f._soundById(v[_]);
|
|
3531
3565
|
if (w) {
|
|
3532
|
-
if (d || f._stopFade(v[
|
|
3533
|
-
var k = o.ctx.currentTime,
|
|
3534
|
-
w._volume = r, w._node.gain.setValueAtTime(r, k), w._node.gain.linearRampToValueAtTime(s,
|
|
3566
|
+
if (d || f._stopFade(v[_]), f._webAudio && !w._muted) {
|
|
3567
|
+
var k = o.ctx.currentTime, E = k + u / 1e3;
|
|
3568
|
+
w._volume = r, w._node.gain.setValueAtTime(r, k), w._node.gain.linearRampToValueAtTime(s, E);
|
|
3535
3569
|
}
|
|
3536
|
-
f._startFadeInterval(w, r, s,
|
|
3570
|
+
f._startFadeInterval(w, r, s, u, v[_], d === void 0);
|
|
3537
3571
|
}
|
|
3538
3572
|
}
|
|
3539
3573
|
return f;
|
|
3540
|
-
}, _startFadeInterval: function(r, s,
|
|
3541
|
-
var
|
|
3542
|
-
r._fadeTo =
|
|
3543
|
-
var ie = (Date.now() -
|
|
3544
|
-
|
|
3574
|
+
}, _startFadeInterval: function(r, s, u, d, f, v) {
|
|
3575
|
+
var _ = this, w = s, k = u - s, E = Math.abs(k / 0.01), x = Math.max(4, E > 0 ? d / E : d), U = Date.now();
|
|
3576
|
+
r._fadeTo = u, r._interval = setInterval(function() {
|
|
3577
|
+
var ie = (Date.now() - U) / d;
|
|
3578
|
+
U = Date.now(), w += k * ie, w = Math.round(100 * w) / 100, w = k < 0 ? Math.max(u, w) : Math.min(u, w), _._webAudio ? r._volume = w : _.volume(w, r._id, !0), v && (_._volume = w), (u < s && w <= u || u > s && w >= u) && (clearInterval(r._interval), r._interval = null, r._fadeTo = null, _.volume(u, r._id), _._emit("fade", r._id));
|
|
3545
3579
|
}, x);
|
|
3546
3580
|
}, _stopFade: function(r) {
|
|
3547
|
-
var s = this,
|
|
3548
|
-
return
|
|
3581
|
+
var s = this, u = s._soundById(r);
|
|
3582
|
+
return u && u._interval && (s._webAudio && u._node.gain.cancelScheduledValues(o.ctx.currentTime), clearInterval(u._interval), u._interval = null, s.volume(u._fadeTo, r), u._fadeTo = null, s._emit("fade", r)), s;
|
|
3549
3583
|
}, loop: function() {
|
|
3550
|
-
var r, s,
|
|
3584
|
+
var r, s, u, d = this, f = arguments;
|
|
3551
3585
|
if (f.length === 0) return d._loop;
|
|
3552
3586
|
if (f.length === 1) {
|
|
3553
|
-
if (typeof f[0] != "boolean") return !!(
|
|
3587
|
+
if (typeof f[0] != "boolean") return !!(u = d._soundById(parseInt(f[0], 10))) && u._loop;
|
|
3554
3588
|
r = f[0], d._loop = r;
|
|
3555
3589
|
} else f.length === 2 && (r = f[0], s = parseInt(f[1], 10));
|
|
3556
|
-
for (var v = d._getSoundIds(s),
|
|
3590
|
+
for (var v = d._getSoundIds(s), _ = 0; _ < v.length; _++) (u = d._soundById(v[_])) && (u._loop = r, d._webAudio && u._node && u._node.bufferSource && (u._node.bufferSource.loop = r, r && (u._node.bufferSource.loopStart = u._start || 0, u._node.bufferSource.loopEnd = u._stop)));
|
|
3557
3591
|
return d;
|
|
3558
3592
|
}, rate: function() {
|
|
3559
|
-
var r, s,
|
|
3560
|
-
if (d.length === 0) s =
|
|
3593
|
+
var r, s, u = this, d = arguments;
|
|
3594
|
+
if (d.length === 0) s = u._sounds[0]._id;
|
|
3561
3595
|
else if (d.length === 1) {
|
|
3562
|
-
var f =
|
|
3596
|
+
var f = u._getSoundIds(), v = f.indexOf(d[0]);
|
|
3563
3597
|
v >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]);
|
|
3564
3598
|
} else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3565
|
-
var
|
|
3566
|
-
if (typeof r != "number") return
|
|
3567
|
-
if (
|
|
3568
|
-
|
|
3569
|
-
} }),
|
|
3570
|
-
s === void 0 && (
|
|
3571
|
-
for (var w = 0; w < s.length; w++) if (
|
|
3572
|
-
|
|
3573
|
-
var k =
|
|
3574
|
-
!
|
|
3599
|
+
var _;
|
|
3600
|
+
if (typeof r != "number") return _ = u._soundById(s), _ ? _._rate : u._rate;
|
|
3601
|
+
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "rate", action: function() {
|
|
3602
|
+
u.rate.apply(u, d);
|
|
3603
|
+
} }), u;
|
|
3604
|
+
s === void 0 && (u._rate = r), s = u._getSoundIds(s);
|
|
3605
|
+
for (var w = 0; w < s.length; w++) if (_ = u._soundById(s[w])) {
|
|
3606
|
+
u.playing(s[w]) && (_._rateSeek = u.seek(s[w]), _._playStart = u._webAudio ? o.ctx.currentTime : _._playStart), _._rate = r, u._webAudio && _._node && _._node.bufferSource ? _._node.bufferSource.playbackRate.setValueAtTime(r, o.ctx.currentTime) : _._node && (_._node.playbackRate = r);
|
|
3607
|
+
var k = u.seek(s[w]), E = (u._sprite[_._sprite][0] + u._sprite[_._sprite][1]) / 1e3 - k, x = 1e3 * E / Math.abs(_._rate);
|
|
3608
|
+
!u._endTimers[s[w]] && _._paused || (u._clearTimer(s[w]), u._endTimers[s[w]] = setTimeout(u._ended.bind(u, _), x)), u._emit("rate", _._id);
|
|
3575
3609
|
}
|
|
3576
|
-
return
|
|
3610
|
+
return u;
|
|
3577
3611
|
}, seek: function() {
|
|
3578
|
-
var r, s,
|
|
3579
|
-
if (d.length === 0) s =
|
|
3612
|
+
var r, s, u = this, d = arguments;
|
|
3613
|
+
if (d.length === 0) s = u._sounds[0]._id;
|
|
3580
3614
|
else if (d.length === 1) {
|
|
3581
|
-
var f =
|
|
3582
|
-
v >= 0 ? s = parseInt(d[0], 10) :
|
|
3615
|
+
var f = u._getSoundIds(), v = f.indexOf(d[0]);
|
|
3616
|
+
v >= 0 ? s = parseInt(d[0], 10) : u._sounds.length && (s = u._sounds[0]._id, r = parseFloat(d[0]));
|
|
3583
3617
|
} else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3584
|
-
if (s === void 0) return
|
|
3585
|
-
if (typeof r == "number" && (
|
|
3586
|
-
|
|
3587
|
-
} }),
|
|
3588
|
-
var
|
|
3589
|
-
if (
|
|
3618
|
+
if (s === void 0) return u;
|
|
3619
|
+
if (typeof r == "number" && (u._state !== "loaded" || u._playLock)) return u._queue.push({ event: "seek", action: function() {
|
|
3620
|
+
u.seek.apply(u, d);
|
|
3621
|
+
} }), u;
|
|
3622
|
+
var _ = u._soundById(s);
|
|
3623
|
+
if (_) {
|
|
3590
3624
|
if (!(typeof r == "number" && r >= 0)) {
|
|
3591
|
-
if (
|
|
3592
|
-
var w =
|
|
3593
|
-
return
|
|
3625
|
+
if (u._webAudio) {
|
|
3626
|
+
var w = u.playing(s) ? o.ctx.currentTime - _._playStart : 0, k = _._rateSeek ? _._rateSeek - _._seek : 0;
|
|
3627
|
+
return _._seek + (k + w * Math.abs(_._rate));
|
|
3594
3628
|
}
|
|
3595
|
-
return
|
|
3629
|
+
return _._node.currentTime;
|
|
3596
3630
|
}
|
|
3597
|
-
var
|
|
3598
|
-
|
|
3631
|
+
var E = u.playing(s);
|
|
3632
|
+
E && u.pause(s, !0), _._seek = r, _._ended = !1, u._clearTimer(s), u._webAudio || !_._node || isNaN(_._node.duration) || (_._node.currentTime = r);
|
|
3599
3633
|
var x = function() {
|
|
3600
|
-
|
|
3634
|
+
u._emit("seek", s), E && u.play(s, !0);
|
|
3601
3635
|
};
|
|
3602
|
-
if (
|
|
3603
|
-
var
|
|
3604
|
-
|
|
3636
|
+
if (E && !u._webAudio) {
|
|
3637
|
+
var U = function() {
|
|
3638
|
+
u._playLock ? setTimeout(U, 0) : x();
|
|
3605
3639
|
};
|
|
3606
|
-
setTimeout(
|
|
3640
|
+
setTimeout(U, 0);
|
|
3607
3641
|
} else x();
|
|
3608
3642
|
}
|
|
3609
|
-
return
|
|
3643
|
+
return u;
|
|
3610
3644
|
}, playing: function(r) {
|
|
3611
3645
|
var s = this;
|
|
3612
3646
|
if (typeof r == "number") {
|
|
3613
|
-
var
|
|
3614
|
-
return !!
|
|
3647
|
+
var u = s._soundById(r);
|
|
3648
|
+
return !!u && !u._paused;
|
|
3615
3649
|
}
|
|
3616
3650
|
for (var d = 0; d < s._sounds.length; d++) if (!s._sounds[d]._paused) return !0;
|
|
3617
3651
|
return !1;
|
|
3618
3652
|
}, duration: function(r) {
|
|
3619
|
-
var s = this,
|
|
3620
|
-
return d && (
|
|
3653
|
+
var s = this, u = s._duration, d = s._soundById(r);
|
|
3654
|
+
return d && (u = s._sprite[d._sprite][1] / 1e3), u;
|
|
3621
3655
|
}, state: function() {
|
|
3622
3656
|
return this._state;
|
|
3623
3657
|
}, unload: function() {
|
|
3624
|
-
for (var r = this, s = r._sounds,
|
|
3658
|
+
for (var r = this, s = r._sounds, u = 0; u < s.length; u++) s[u]._paused || r.stop(s[u]._id), r._webAudio || (r._clearSound(s[u]._node), s[u]._node.removeEventListener("error", s[u]._errorFn, !1), s[u]._node.removeEventListener(o._canPlayEvent, s[u]._loadFn, !1), s[u]._node.removeEventListener("ended", s[u]._endFn, !1), o._releaseHtml5Audio(s[u]._node)), delete s[u]._node, r._clearTimer(s[u]._id);
|
|
3625
3659
|
var d = o._howls.indexOf(r);
|
|
3626
3660
|
d >= 0 && o._howls.splice(d, 1);
|
|
3627
3661
|
var f = !0;
|
|
3628
|
-
for (
|
|
3662
|
+
for (u = 0; u < o._howls.length; u++) if (o._howls[u]._src === r._src || r._src.indexOf(o._howls[u]._src) >= 0) {
|
|
3629
3663
|
f = !1;
|
|
3630
3664
|
break;
|
|
3631
3665
|
}
|
|
3632
3666
|
return c && f && delete c[r._src], o.noAudio = !1, r._state = "unloaded", r._sounds = [], r = null, null;
|
|
3633
|
-
}, on: function(r, s,
|
|
3667
|
+
}, on: function(r, s, u, d) {
|
|
3634
3668
|
var f = this, v = f["_on" + r];
|
|
3635
|
-
return typeof s == "function" && v.push(d ? { id:
|
|
3636
|
-
}, off: function(r, s,
|
|
3669
|
+
return typeof s == "function" && v.push(d ? { id: u, fn: s, once: d } : { id: u, fn: s }), f;
|
|
3670
|
+
}, off: function(r, s, u) {
|
|
3637
3671
|
var d = this, f = d["_on" + r], v = 0;
|
|
3638
|
-
if (typeof s == "number" && (
|
|
3639
|
-
var
|
|
3640
|
-
if (s === f[v].fn &&
|
|
3672
|
+
if (typeof s == "number" && (u = s, s = null), s || u) for (v = 0; v < f.length; v++) {
|
|
3673
|
+
var _ = u === f[v].id;
|
|
3674
|
+
if (s === f[v].fn && _ || !s && _) {
|
|
3641
3675
|
f.splice(v, 1);
|
|
3642
3676
|
break;
|
|
3643
3677
|
}
|
|
@@ -3648,25 +3682,25 @@ function ta() {
|
|
|
3648
3682
|
for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(d[w[v]]) && (d[w[v]] = []);
|
|
3649
3683
|
}
|
|
3650
3684
|
return d;
|
|
3651
|
-
}, once: function(r, s,
|
|
3685
|
+
}, once: function(r, s, u) {
|
|
3652
3686
|
var d = this;
|
|
3653
|
-
return d.on(r, s,
|
|
3654
|
-
}, _emit: function(r, s,
|
|
3655
|
-
for (var d = this, f = d["_on" + r], v = f.length - 1; v >= 0; v--) f[v].id && f[v].id !== s && r !== "load" || (setTimeout((function(
|
|
3656
|
-
|
|
3687
|
+
return d.on(r, s, u, 1), d;
|
|
3688
|
+
}, _emit: function(r, s, u) {
|
|
3689
|
+
for (var d = this, f = d["_on" + r], v = f.length - 1; v >= 0; v--) f[v].id && f[v].id !== s && r !== "load" || (setTimeout((function(_) {
|
|
3690
|
+
_.call(this, s, u);
|
|
3657
3691
|
}).bind(d, f[v].fn), 0), f[v].once && d.off(r, f[v].fn, f[v].id));
|
|
3658
3692
|
return d._loadQueue(r), d;
|
|
3659
3693
|
}, _loadQueue: function(r) {
|
|
3660
3694
|
var s = this;
|
|
3661
3695
|
if (s._queue.length > 0) {
|
|
3662
|
-
var
|
|
3663
|
-
|
|
3696
|
+
var u = s._queue[0];
|
|
3697
|
+
u.event === r && (s._queue.shift(), s._loadQueue()), r || u.action();
|
|
3664
3698
|
}
|
|
3665
3699
|
return s;
|
|
3666
3700
|
}, _ended: function(r) {
|
|
3667
|
-
var s = this,
|
|
3701
|
+
var s = this, u = r._sprite;
|
|
3668
3702
|
if (!s._webAudio && r._node && !r._node.paused && !r._node.ended && r._node.currentTime < r._stop) return setTimeout(s._ended.bind(s, r), 100), s;
|
|
3669
|
-
var d = !(!r._loop && !s._sprite[
|
|
3703
|
+
var d = !(!r._loop && !s._sprite[u][2]);
|
|
3670
3704
|
if (s._emit("end", r._id), !s._webAudio && d && s.stop(r._id, !0).play(r._id), s._webAudio && d) {
|
|
3671
3705
|
s._emit("play", r._id), r._seek = r._start || 0, r._rateSeek = 0, r._playStart = o.ctx.currentTime;
|
|
3672
3706
|
var f = 1e3 * (r._stop - r._start) / Math.abs(r._rate);
|
|
@@ -3678,42 +3712,42 @@ function ta() {
|
|
|
3678
3712
|
if (s._endTimers[r]) {
|
|
3679
3713
|
if (typeof s._endTimers[r] != "function") clearTimeout(s._endTimers[r]);
|
|
3680
3714
|
else {
|
|
3681
|
-
var
|
|
3682
|
-
|
|
3715
|
+
var u = s._soundById(r);
|
|
3716
|
+
u && u._node && u._node.removeEventListener("ended", s._endTimers[r], !1);
|
|
3683
3717
|
}
|
|
3684
3718
|
delete s._endTimers[r];
|
|
3685
3719
|
}
|
|
3686
3720
|
return s;
|
|
3687
3721
|
}, _soundById: function(r) {
|
|
3688
|
-
for (var s = this,
|
|
3722
|
+
for (var s = this, u = 0; u < s._sounds.length; u++) if (r === s._sounds[u]._id) return s._sounds[u];
|
|
3689
3723
|
return null;
|
|
3690
3724
|
}, _inactiveSound: function() {
|
|
3691
3725
|
var r = this;
|
|
3692
3726
|
r._drain();
|
|
3693
3727
|
for (var s = 0; s < r._sounds.length; s++) if (r._sounds[s]._ended) return r._sounds[s].reset();
|
|
3694
|
-
return new
|
|
3728
|
+
return new a(r);
|
|
3695
3729
|
}, _drain: function() {
|
|
3696
|
-
var r = this, s = r._pool,
|
|
3730
|
+
var r = this, s = r._pool, u = 0, d = 0;
|
|
3697
3731
|
if (!(r._sounds.length < s)) {
|
|
3698
|
-
for (d = 0; d < r._sounds.length; d++) r._sounds[d]._ended &&
|
|
3732
|
+
for (d = 0; d < r._sounds.length; d++) r._sounds[d]._ended && u++;
|
|
3699
3733
|
for (d = r._sounds.length - 1; d >= 0; d--) {
|
|
3700
|
-
if (
|
|
3701
|
-
r._sounds[d]._ended && (r._webAudio && r._sounds[d]._node && r._sounds[d]._node.disconnect(0), r._sounds.splice(d, 1),
|
|
3734
|
+
if (u <= s) return;
|
|
3735
|
+
r._sounds[d]._ended && (r._webAudio && r._sounds[d]._node && r._sounds[d]._node.disconnect(0), r._sounds.splice(d, 1), u--);
|
|
3702
3736
|
}
|
|
3703
3737
|
}
|
|
3704
3738
|
}, _getSoundIds: function(r) {
|
|
3705
3739
|
var s = this;
|
|
3706
3740
|
if (r === void 0) {
|
|
3707
|
-
for (var
|
|
3708
|
-
return
|
|
3741
|
+
for (var u = [], d = 0; d < s._sounds.length; d++) u.push(s._sounds[d]._id);
|
|
3742
|
+
return u;
|
|
3709
3743
|
}
|
|
3710
3744
|
return [r];
|
|
3711
3745
|
}, _refreshBuffer: function(r) {
|
|
3712
3746
|
var s = this;
|
|
3713
3747
|
return r._node.bufferSource = o.ctx.createBufferSource(), r._node.bufferSource.buffer = c[s._src], r._panner ? r._node.bufferSource.connect(r._panner) : r._node.bufferSource.connect(r._node), r._node.bufferSource.loop = r._loop, r._loop && (r._node.bufferSource.loopStart = r._start || 0, r._node.bufferSource.loopEnd = r._stop || 0), r._node.bufferSource.playbackRate.setValueAtTime(r._rate, o.ctx.currentTime), s;
|
|
3714
3748
|
}, _cleanBuffer: function(r) {
|
|
3715
|
-
var s = this,
|
|
3716
|
-
if (o._scratchBuffer && r.bufferSource && (r.bufferSource.onended = null, r.bufferSource.disconnect(0),
|
|
3749
|
+
var s = this, u = o._navigator && o._navigator.vendor.indexOf("Apple") >= 0;
|
|
3750
|
+
if (o._scratchBuffer && r.bufferSource && (r.bufferSource.onended = null, r.bufferSource.disconnect(0), u)) try {
|
|
3717
3751
|
r.bufferSource.buffer = o._scratchBuffer;
|
|
3718
3752
|
} catch {
|
|
3719
3753
|
}
|
|
@@ -3721,15 +3755,15 @@ function ta() {
|
|
|
3721
3755
|
}, _clearSound: function(r) {
|
|
3722
3756
|
/MSIE |Trident\//.test(o._navigator && o._navigator.userAgent) || (r.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");
|
|
3723
3757
|
} };
|
|
3724
|
-
var
|
|
3758
|
+
var a = function(r) {
|
|
3725
3759
|
this._parent = r, this.init();
|
|
3726
3760
|
};
|
|
3727
|
-
|
|
3761
|
+
a.prototype = { init: function() {
|
|
3728
3762
|
var r = this, s = r._parent;
|
|
3729
3763
|
return r._muted = s._muted, r._loop = s._loop, r._volume = s._volume, r._rate = s._rate, r._seek = 0, r._paused = !0, r._ended = !0, r._sprite = "__default", r._id = ++o._counter, s._sounds.push(r), r.create(), r;
|
|
3730
3764
|
}, create: function() {
|
|
3731
|
-
var r = this, s = r._parent,
|
|
3732
|
-
return s._webAudio ? (r._node = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), r._node.gain.setValueAtTime(
|
|
3765
|
+
var r = this, s = r._parent, u = o._muted || r._muted || r._parent._muted ? 0 : r._volume;
|
|
3766
|
+
return s._webAudio ? (r._node = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), r._node.gain.setValueAtTime(u, o.ctx.currentTime), r._node.paused = !0, r._node.connect(o.masterGain)) : o.noAudio || (r._node = o._obtainHtml5Audio(), r._errorFn = r._errorListener.bind(r), r._node.addEventListener("error", r._errorFn, !1), r._loadFn = r._loadListener.bind(r), r._node.addEventListener(o._canPlayEvent, r._loadFn, !1), r._endFn = r._endListener.bind(r), r._node.addEventListener("ended", r._endFn, !1), r._node.src = s._src, r._node.preload = s._preload === !0 ? "auto" : s._preload, r._node.volume = u * o.volume(), r._node.load()), r;
|
|
3733
3767
|
}, reset: function() {
|
|
3734
3768
|
var r = this, s = r._parent;
|
|
3735
3769
|
return r._muted = s._muted, r._loop = s._loop, r._volume = s._volume, r._rate = s._rate, r._seek = 0, r._rateSeek = 0, r._paused = !0, r._ended = !0, r._sprite = "__default", r._id = ++o._counter, r;
|
|
@@ -3747,16 +3781,16 @@ function ta() {
|
|
|
3747
3781
|
var s = r._src;
|
|
3748
3782
|
if (c[s]) return r._duration = c[s].duration, void y(r);
|
|
3749
3783
|
if (/^data:[^;]+;base64,/.test(s)) {
|
|
3750
|
-
for (var
|
|
3751
|
-
|
|
3784
|
+
for (var u = atob(s.split(",")[1]), d = new Uint8Array(u.length), f = 0; f < u.length; ++f) d[f] = u.charCodeAt(f);
|
|
3785
|
+
h(d.buffer, r);
|
|
3752
3786
|
} else {
|
|
3753
3787
|
var v = new XMLHttpRequest();
|
|
3754
|
-
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(
|
|
3755
|
-
v.setRequestHeader(
|
|
3788
|
+
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(_) {
|
|
3789
|
+
v.setRequestHeader(_, r._xhr.headers[_]);
|
|
3756
3790
|
}), v.onload = function() {
|
|
3757
|
-
var
|
|
3758
|
-
if (
|
|
3759
|
-
|
|
3791
|
+
var _ = (v.status + "")[0];
|
|
3792
|
+
if (_ !== "0" && _ !== "2" && _ !== "3") return void r._emit("loaderror", null, "Failed loading audio file with status: " + v.status + ".");
|
|
3793
|
+
h(v.response, r);
|
|
3760
3794
|
}, v.onerror = function() {
|
|
3761
3795
|
r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete c[s], r.load());
|
|
3762
3796
|
}, p(v);
|
|
@@ -3767,13 +3801,13 @@ function ta() {
|
|
|
3767
3801
|
} catch {
|
|
3768
3802
|
r.onerror();
|
|
3769
3803
|
}
|
|
3770
|
-
},
|
|
3771
|
-
var
|
|
3804
|
+
}, h = function(r, s) {
|
|
3805
|
+
var u = function() {
|
|
3772
3806
|
s._emit("loaderror", null, "Decoding audio data failed.");
|
|
3773
3807
|
}, d = function(f) {
|
|
3774
|
-
f && s._sounds.length > 0 ? (c[s._src] = f, y(s, f)) :
|
|
3808
|
+
f && s._sounds.length > 0 ? (c[s._src] = f, y(s, f)) : u();
|
|
3775
3809
|
};
|
|
3776
|
-
typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(d).catch(
|
|
3810
|
+
typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(d).catch(u) : o.ctx.decodeAudioData(r, d, u);
|
|
3777
3811
|
}, y = function(r, s) {
|
|
3778
3812
|
s && !r._duration && (r._duration = s.duration), Object.keys(r._sprite).length === 0 && (r._sprite = { __default: [0, 1e3 * r._duration] }), r._state !== "loaded" && (r._state = "loaded", r._emit("load"), r._loadQueue());
|
|
3779
3813
|
}, g = function() {
|
|
@@ -3784,24 +3818,24 @@ function ta() {
|
|
|
3784
3818
|
o.usingWebAudio = !1;
|
|
3785
3819
|
}
|
|
3786
3820
|
o.ctx || (o.usingWebAudio = !1);
|
|
3787
|
-
var r = /iP(hone|od|ad)/.test(o._navigator && o._navigator.platform), s = o._navigator && o._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),
|
|
3788
|
-
if (r &&
|
|
3821
|
+
var r = /iP(hone|od|ad)/.test(o._navigator && o._navigator.platform), s = o._navigator && o._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), u = s ? parseInt(s[1], 10) : null;
|
|
3822
|
+
if (r && u && u < 9) {
|
|
3789
3823
|
var d = /safari/.test(o._navigator && o._navigator.userAgent.toLowerCase());
|
|
3790
3824
|
o._navigator && !d && (o.usingWebAudio = !1);
|
|
3791
3825
|
}
|
|
3792
3826
|
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();
|
|
3793
3827
|
}
|
|
3794
3828
|
};
|
|
3795
|
-
e.Howler = o, e.Howl = i, typeof t < "u" ? (t.HowlerGlobal = n, t.Howler = o, t.Howl = i, t.Sound =
|
|
3829
|
+
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);
|
|
3796
3830
|
})();
|
|
3797
3831
|
}(ke)), ke;
|
|
3798
3832
|
}
|
|
3799
|
-
var
|
|
3800
|
-
const
|
|
3801
|
-
class
|
|
3833
|
+
var vt = ua();
|
|
3834
|
+
const ca = typeof navigator < "u" && typeof navigator.standalone < "u";
|
|
3835
|
+
class Sa {
|
|
3802
3836
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3803
3837
|
constructor(t) {
|
|
3804
|
-
this.cogsConnection = t, this.
|
|
3838
|
+
this.cogsConnection = t, this.addEventListener("audioClipState", ({ detail: o }) => {
|
|
3805
3839
|
t.sendMediaClipState(o);
|
|
3806
3840
|
}), t.addEventListener("message", ({ message: o }) => {
|
|
3807
3841
|
switch (o.type) {
|
|
@@ -3832,8 +3866,8 @@ class aa {
|
|
|
3832
3866
|
}
|
|
3833
3867
|
});
|
|
3834
3868
|
const n = () => {
|
|
3835
|
-
const o = Object.entries(this.audioClipPlayers).map(([i,
|
|
3836
|
-
const c = Object.values(
|
|
3869
|
+
const o = Object.entries(this.audioClipPlayers).map(([i, a]) => {
|
|
3870
|
+
const c = Object.values(a.activeClips), l = c.some(
|
|
3837
3871
|
({ state: p }) => p.type === "playing" || p.type === "pausing" || p.type === "stopping" || p.type === "play_requested" || p.type === "pause_requested" || p.type === "stop_requested"
|
|
3838
3872
|
) ? "playing" : c.some(({ state: p }) => p.type === "paused") ? "paused" : "stopped";
|
|
3839
3873
|
return [i, l];
|
|
@@ -3842,21 +3876,25 @@ class aa {
|
|
|
3842
3876
|
};
|
|
3843
3877
|
t.addEventListener("open", n), n();
|
|
3844
3878
|
}
|
|
3879
|
+
eventTarget = new EventTarget();
|
|
3880
|
+
globalVolume = 1;
|
|
3881
|
+
audioClipPlayers = {};
|
|
3882
|
+
sinkId = "";
|
|
3845
3883
|
setGlobalVolume(t) {
|
|
3846
|
-
this.globalVolume = t,
|
|
3884
|
+
this.globalVolume = t, vt.Howler.volume(t), this.notifyStateListeners();
|
|
3847
3885
|
}
|
|
3848
|
-
playAudioClip(t, { playId: n, volume: o, fade: i, loop:
|
|
3886
|
+
playAudioClip(t, { playId: n, volume: o, fade: i, loop: a }) {
|
|
3849
3887
|
t in this.audioClipPlayers || (this.audioClipPlayers[t] = this.createClip(t, { preload: !1, ephemeral: !0 })), this.updateAudioClipPlayer(t, (c) => {
|
|
3850
3888
|
const l = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "paused").map(([g]) => parseInt(g)), p = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pausing").map(([g]) => parseInt(g));
|
|
3851
3889
|
l.forEach((g) => {
|
|
3852
3890
|
c.player.play(g);
|
|
3853
3891
|
});
|
|
3854
|
-
const
|
|
3892
|
+
const h = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 || p.length > 0 || h.length > 0 ? [] : [c.player.play()];
|
|
3855
3893
|
return p.forEach((g) => {
|
|
3856
|
-
c.player.off("fade", void 0, g), c.player.loop(
|
|
3857
|
-
}), [...l, ...
|
|
3858
|
-
c.player.loop(
|
|
3859
|
-
|
|
3894
|
+
c.player.off("fade", void 0, g), c.player.loop(a, g), this.updateActiveAudioClip(t, g, (r) => ({ ...r, state: { type: "playing" } })), ne(i) ? oe(c.player, o, i * 1e3, g) : Ce(c.player, o, g);
|
|
3895
|
+
}), [...l, ...h, ...y].forEach((g) => {
|
|
3896
|
+
c.player.loop(a, g), c.player.off("play", void 0, g), c.player.off("pause", void 0, g), c.player.off("fade", void 0, g), c.player.off("end", void 0, g), c.player.off("stop", void 0, g), c.player.once("play", () => {
|
|
3897
|
+
Ee(c.player, this.sinkId);
|
|
3860
3898
|
}), c.player.once("stop", () => this.handleStoppedClip(t, n, g), g), c.player.on(
|
|
3861
3899
|
"end",
|
|
3862
3900
|
() => {
|
|
@@ -3867,14 +3905,14 @@ class aa {
|
|
|
3867
3905
|
const r = {
|
|
3868
3906
|
playId: n,
|
|
3869
3907
|
state: { type: "play_requested" },
|
|
3870
|
-
loop:
|
|
3908
|
+
loop: a,
|
|
3871
3909
|
volume: o
|
|
3872
3910
|
};
|
|
3873
3911
|
c.player.once(
|
|
3874
3912
|
"play",
|
|
3875
3913
|
() => {
|
|
3876
3914
|
const s = c.activeClips[g]?.state;
|
|
3877
|
-
s?.type === "pause_requested" ? this.pauseAudioClip(t, { fade: s.fade }, g, !0) : s?.type === "stop_requested" ? this.stopAudioClip(t, { fade: s.fade }, g, !0) : this.updateActiveAudioClip(t, g, (
|
|
3915
|
+
s?.type === "pause_requested" ? this.pauseAudioClip(t, { fade: s.fade }, g, !0) : s?.type === "stop_requested" ? this.stopAudioClip(t, { fade: s.fade }, g, !0) : this.updateActiveAudioClip(t, g, (u) => ({ ...u, state: { type: "playing" } }));
|
|
3878
3916
|
},
|
|
3879
3917
|
g
|
|
3880
3918
|
), ne(i) ? (c.player.volume(0, g), c.player.mute(!1, g), c.player.once(
|
|
@@ -3883,37 +3921,37 @@ class aa {
|
|
|
3883
3921
|
oe(c.player, o, i * 1e3, g);
|
|
3884
3922
|
},
|
|
3885
3923
|
g
|
|
3886
|
-
)) :
|
|
3924
|
+
)) : Ce(c.player, o, g), c.activeClips = { ...c.activeClips, [g]: r };
|
|
3887
3925
|
}), c;
|
|
3888
3926
|
}), this.notifyClipStateListeners(n, t, "playing");
|
|
3889
3927
|
}
|
|
3890
3928
|
pauseAudioClip(t, { fade: n }, o, i) {
|
|
3891
|
-
Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (
|
|
3892
|
-
Object.entries(
|
|
3929
|
+
Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
|
|
3930
|
+
Object.entries(a.activeClips).map(([c, l]) => {
|
|
3893
3931
|
const p = parseInt(c);
|
|
3894
|
-
return (o === void 0 || o === p) && (i && l.state.type === "pause_requested" || l.state.type === "playing" || l.state.type === "pausing" ? ne(n) ? (
|
|
3932
|
+
return (o === void 0 || o === p) && (i && l.state.type === "pause_requested" || l.state.type === "playing" || l.state.type === "pausing" ? ne(n) ? (a.player.once(
|
|
3895
3933
|
"fade",
|
|
3896
|
-
(
|
|
3897
|
-
|
|
3934
|
+
(h) => {
|
|
3935
|
+
a.player.pause(h), this.updateActiveAudioClip(t, h, (y) => ({ ...y, state: { type: "paused" } })), this.notifyClipStateListeners(l.playId, t, "paused");
|
|
3898
3936
|
},
|
|
3899
3937
|
p
|
|
3900
|
-
), oe(
|
|
3938
|
+
), oe(a.player, 0, n * 1e3, p), l.state = { type: "pausing" }) : (a.player.pause(p), l.state = { type: "paused" }, this.notifyClipStateListeners(l.playId, t, "paused")) : (l.state.type === "play_requested" || l.state.type === "pause_requested") && (l.state = { type: "pause_requested", fade: n })), [c, l];
|
|
3901
3939
|
})
|
|
3902
|
-
),
|
|
3940
|
+
), a));
|
|
3903
3941
|
}
|
|
3904
3942
|
stopAudioClip(t, { fade: n }, o, i) {
|
|
3905
|
-
|
|
3906
|
-
Object.entries(
|
|
3943
|
+
la("Stop audio clip", { activeClips: this.audioClipPlayers[t]?.activeClips }), Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
|
|
3944
|
+
Object.entries(a.activeClips).map(([c, l]) => {
|
|
3907
3945
|
const p = parseInt(c);
|
|
3908
|
-
return (o === void 0 || o === p) && (i && l.state.type === "stop_requested" || l.state.type === "playing" || l.state.type === "pausing" || l.state.type === "paused" || l.state.type === "stopping" ? ne(n) && l.state.type !== "paused" ? (
|
|
3946
|
+
return (o === void 0 || o === p) && (i && l.state.type === "stop_requested" || l.state.type === "playing" || l.state.type === "pausing" || l.state.type === "paused" || l.state.type === "stopping" ? ne(n) && l.state.type !== "paused" ? (a.player.off("fade", p), oe(a.player, 0, n * 1e3, p), a.player.once(
|
|
3909
3947
|
"fade",
|
|
3910
|
-
(
|
|
3911
|
-
|
|
3948
|
+
(h) => {
|
|
3949
|
+
a.player.loop(!1, h), a.player.stop(h);
|
|
3912
3950
|
},
|
|
3913
3951
|
p
|
|
3914
|
-
), l.state = { type: "stopping" }) : (
|
|
3952
|
+
), l.state = { type: "stopping" }) : (a.player.loop(!1, p), a.player.stop(p)) : (l.state.type === "play_requested" || l.state.type === "pause_requested" || l.state.type === "stop_requested") && (l.state = { type: "stop_requested", fade: n })), [c, l];
|
|
3915
3953
|
})
|
|
3916
|
-
),
|
|
3954
|
+
), a));
|
|
3917
3955
|
}
|
|
3918
3956
|
stopAllAudioClips(t) {
|
|
3919
3957
|
Object.keys(this.audioClipPlayers).forEach((n) => {
|
|
@@ -3926,12 +3964,12 @@ class aa {
|
|
|
3926
3964
|
return;
|
|
3927
3965
|
}
|
|
3928
3966
|
Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (i) => (i.activeClips = Object.fromEntries(
|
|
3929
|
-
Object.entries(i.activeClips).map(([
|
|
3967
|
+
Object.entries(i.activeClips).map(([a, c]) => {
|
|
3930
3968
|
if (c.state.type !== "pausing" && c.state.type !== "stopping") {
|
|
3931
|
-
const l = parseInt(
|
|
3932
|
-
return ne(o) ? oe(i.player, n, o * 1e3, l) :
|
|
3969
|
+
const l = parseInt(a);
|
|
3970
|
+
return ne(o) ? oe(i.player, n, o * 1e3, l) : Ce(i.player, n, l), [a, { ...c, volume: n }];
|
|
3933
3971
|
} else
|
|
3934
|
-
return [
|
|
3972
|
+
return [a, c];
|
|
3935
3973
|
})
|
|
3936
3974
|
), i));
|
|
3937
3975
|
}
|
|
@@ -3951,14 +3989,14 @@ class aa {
|
|
|
3951
3989
|
}
|
|
3952
3990
|
setAudioSink(t) {
|
|
3953
3991
|
for (const n of Object.values(this.audioClipPlayers))
|
|
3954
|
-
|
|
3992
|
+
Ee(n.player, t);
|
|
3955
3993
|
this.sinkId = t;
|
|
3956
3994
|
}
|
|
3957
3995
|
updateConfig(t) {
|
|
3958
3996
|
const n = Object.fromEntries(
|
|
3959
3997
|
Object.entries(t).filter((i) => {
|
|
3960
|
-
const
|
|
3961
|
-
return
|
|
3998
|
+
const a = i[1].type;
|
|
3999
|
+
return a === "audio" || !a;
|
|
3962
4000
|
})
|
|
3963
4001
|
), o = this.audioClipPlayers;
|
|
3964
4002
|
this.audioClipPlayers = (() => {
|
|
@@ -3967,8 +4005,8 @@ class aa {
|
|
|
3967
4005
|
(p) => !(p in n) && !o[p].config.ephemeral
|
|
3968
4006
|
).forEach((p) => {
|
|
3969
4007
|
o[p].player.unload(), delete i[p];
|
|
3970
|
-
}), Object.entries(n).filter(([p]) => !o[p]).forEach(([p,
|
|
3971
|
-
i[p] = this.createClip(p, { ...
|
|
4008
|
+
}), Object.entries(n).filter(([p]) => !o[p]).forEach(([p, h]) => {
|
|
4009
|
+
i[p] = this.createClip(p, { ...h, ephemeral: !1 });
|
|
3972
4010
|
}), Object.keys(o).filter((p) => p in n).forEach((p) => {
|
|
3973
4011
|
i[p] = this.updatedClip(p, i[p], { ...n[p], ephemeral: !1 });
|
|
3974
4012
|
}), i;
|
|
@@ -3976,13 +4014,13 @@ class aa {
|
|
|
3976
4014
|
}
|
|
3977
4015
|
notifyStateListeners() {
|
|
3978
4016
|
const t = Object.entries(this.audioClipPlayers).reduce(
|
|
3979
|
-
(i, [
|
|
4017
|
+
(i, [a, c]) => (i[a] = {
|
|
3980
4018
|
config: { preload: c.config.preload, ephemeral: c.config.ephemeral },
|
|
3981
4019
|
activeClips: c.activeClips
|
|
3982
4020
|
}, i),
|
|
3983
4021
|
{}
|
|
3984
4022
|
), n = Object.values(this.audioClipPlayers).some(
|
|
3985
|
-
({ activeClips: i }) => Object.values(i).some((
|
|
4023
|
+
({ activeClips: i }) => Object.values(i).some((a) => a.state.type === "playing" || a.state.type === "pausing" || a.state.type === "stopping")
|
|
3986
4024
|
), o = {
|
|
3987
4025
|
globalVolume: this.globalVolume,
|
|
3988
4026
|
isPlaying: n,
|
|
@@ -4004,7 +4042,7 @@ class aa {
|
|
|
4004
4042
|
this.eventTarget.dispatchEvent(new CustomEvent(t, { detail: n }));
|
|
4005
4043
|
}
|
|
4006
4044
|
createPlayer(t, n) {
|
|
4007
|
-
const o = new
|
|
4045
|
+
const o = new vt.Howl({
|
|
4008
4046
|
src: this.cogsConnection.getAssetUrl(t),
|
|
4009
4047
|
autoplay: !1,
|
|
4010
4048
|
loop: !1,
|
|
@@ -4012,7 +4050,7 @@ class aa {
|
|
|
4012
4050
|
html5: !0,
|
|
4013
4051
|
preload: n.preload
|
|
4014
4052
|
});
|
|
4015
|
-
return
|
|
4053
|
+
return Ee(o, this.sinkId), o;
|
|
4016
4054
|
}
|
|
4017
4055
|
createClip(t, n) {
|
|
4018
4056
|
return {
|
|
@@ -4026,34 +4064,33 @@ class aa {
|
|
|
4026
4064
|
return n.config.preload !== o.preload && (i.player.unload(), i.player = this.createPlayer(t, o)), i;
|
|
4027
4065
|
}
|
|
4028
4066
|
}
|
|
4029
|
-
function
|
|
4067
|
+
function la(...e) {
|
|
4030
4068
|
}
|
|
4031
4069
|
function ne(e) {
|
|
4032
|
-
return !
|
|
4070
|
+
return !ca && typeof e == "number" && !isNaN(e) && e > 0;
|
|
4033
4071
|
}
|
|
4034
|
-
function
|
|
4072
|
+
function Ee(e, t) {
|
|
4035
4073
|
t !== void 0 && (e._html5 ? e._sounds?.forEach((n) => {
|
|
4036
4074
|
n._node?.setSinkId?.(t);
|
|
4037
4075
|
}) : console.warn("Cannot set sink ID: web audio not supported", e));
|
|
4038
4076
|
}
|
|
4039
|
-
function
|
|
4077
|
+
function Ce(e, t, n) {
|
|
4040
4078
|
e.volume(t, n), e.mute(t === 0, n);
|
|
4041
4079
|
}
|
|
4042
4080
|
function oe(e, t, n, o) {
|
|
4043
4081
|
e.fade(e.volume(o), t, n, o);
|
|
4044
4082
|
}
|
|
4045
|
-
var
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
this.cogsConnection = t, this.eventTarget = new EventTarget(), this.globalVolume = 1, this.videoClipPlayers = {}, this.sinkId = "", this.parentElement = n, this.addEventListener("videoClipState", ({ detail: i }) => {
|
|
4083
|
+
var Oe = /* @__PURE__ */ ((e) => (e.Paused = "paused", e.Playing = "playing", e))(Oe || {});
|
|
4084
|
+
class Aa {
|
|
4085
|
+
constructor(t, n = document.body) {
|
|
4086
|
+
this.cogsConnection = t, this.parentElement = n, this.addEventListener("videoClipState", ({ detail: i }) => {
|
|
4050
4087
|
t.sendMediaClipState(i);
|
|
4051
4088
|
}), t.addEventListener("message", ({ message: i }) => {
|
|
4052
4089
|
switch (i.type) {
|
|
4053
4090
|
case "media_config_update":
|
|
4054
4091
|
if (this.setGlobalVolume(i.globalVolume), i.audioOutput !== void 0) {
|
|
4055
|
-
const
|
|
4056
|
-
this.setAudioSink(
|
|
4092
|
+
const a = t.getAudioSinkId(i.audioOutput);
|
|
4093
|
+
this.setAudioSink(a ?? "");
|
|
4057
4094
|
}
|
|
4058
4095
|
this.updateConfig(i.files);
|
|
4059
4096
|
break;
|
|
@@ -4080,29 +4117,36 @@ class ua {
|
|
|
4080
4117
|
}
|
|
4081
4118
|
});
|
|
4082
4119
|
const o = () => {
|
|
4083
|
-
const i = Object.entries(this.videoClipPlayers).map(([
|
|
4120
|
+
const i = Object.entries(this.videoClipPlayers).map(([a, c]) => {
|
|
4084
4121
|
const l = c.videoElement.paused ? c.videoElement.currentTime === 0 || c.videoElement.currentTime === c.videoElement.duration ? "paused" : "stopped" : "playing";
|
|
4085
|
-
return [
|
|
4122
|
+
return [a, l];
|
|
4086
4123
|
});
|
|
4087
4124
|
t.sendInitialMediaClipStates({ mediaType: "video", files: i });
|
|
4088
4125
|
};
|
|
4089
4126
|
t.addEventListener("open", o), o();
|
|
4090
4127
|
}
|
|
4128
|
+
eventTarget = new EventTarget();
|
|
4129
|
+
globalVolume = 1;
|
|
4130
|
+
videoClipPlayers = {};
|
|
4131
|
+
activeClip;
|
|
4132
|
+
pendingClip;
|
|
4133
|
+
parentElement;
|
|
4134
|
+
sinkId = "";
|
|
4091
4135
|
setParentElement(t) {
|
|
4092
4136
|
this.parentElement = t, Object.values(this.videoClipPlayers).forEach((n) => {
|
|
4093
4137
|
t.appendChild(n.videoElement);
|
|
4094
4138
|
});
|
|
4095
4139
|
}
|
|
4096
4140
|
resetParentElement() {
|
|
4097
|
-
this.setParentElement(
|
|
4141
|
+
this.setParentElement(document.body);
|
|
4098
4142
|
}
|
|
4099
4143
|
setGlobalVolume(t) {
|
|
4100
4144
|
Object.values(this.videoClipPlayers).forEach((n) => {
|
|
4101
4145
|
de(n.videoElement, n.volume * t);
|
|
4102
4146
|
}), this.globalVolume = t, this.notifyStateListeners();
|
|
4103
4147
|
}
|
|
4104
|
-
playVideoClip(t, { playId: n, volume: o, loop: i, fit:
|
|
4105
|
-
this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit:
|
|
4148
|
+
playVideoClip(t, { playId: n, volume: o, loop: i, fit: a }) {
|
|
4149
|
+
this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit: a })), this.pendingClip && this.updateVideoClipPlayer(this.pendingClip.path, (c) => (c.videoElement.load(), c)), this.activeClip?.path !== t && (this.pendingClip = { path: t, playId: n, actionOncePlaying: "play" }), this.updateVideoClipPlayer(t, (c) => (c.volume = o, de(c.videoElement, o * this.globalVolume), c.videoElement.loop = i, c.videoElement.style.objectFit = a, c.videoElement.currentTime === c.videoElement.duration && (c.videoElement.currentTime = 0), c.videoElement.play(), this.activeClip || (c.videoElement.style.display = "block"), c));
|
|
4106
4150
|
}
|
|
4107
4151
|
pauseVideoClip() {
|
|
4108
4152
|
if (this.pendingClip && (this.pendingClip.actionOncePlaying = "pause"), this.activeClip) {
|
|
@@ -4141,7 +4185,7 @@ class ua {
|
|
|
4141
4185
|
}
|
|
4142
4186
|
setAudioSink(t) {
|
|
4143
4187
|
for (const n of Object.values(this.videoClipPlayers))
|
|
4144
|
-
|
|
4188
|
+
yt(n, t);
|
|
4145
4189
|
this.sinkId = t;
|
|
4146
4190
|
}
|
|
4147
4191
|
updateConfig(t) {
|
|
@@ -4149,13 +4193,13 @@ class ua {
|
|
|
4149
4193
|
this.videoClipPlayers = (() => {
|
|
4150
4194
|
const i = { ...o };
|
|
4151
4195
|
return Object.keys(o).filter((p) => !(p in n)).forEach((p) => {
|
|
4152
|
-
this.activeClip?.path === p && o[p]?.config.ephemeral === !1 ? this.updateVideoClipPlayer(p, (
|
|
4153
|
-
}), Object.entries(n).filter(([p]) => !o[p]).forEach(([p,
|
|
4154
|
-
i[p] = this.createClipPlayer(p, { ...
|
|
4155
|
-
}), Object.entries(o).filter(([p]) => p in n).forEach(([p,
|
|
4156
|
-
|
|
4196
|
+
this.activeClip?.path === p && o[p]?.config.ephemeral === !1 ? this.updateVideoClipPlayer(p, (h) => (h.config = { ...h.config, ephemeral: !0 }, h)) : (this.unloadClip(p), delete i[p]);
|
|
4197
|
+
}), Object.entries(n).filter(([p]) => !o[p]).forEach(([p, h]) => {
|
|
4198
|
+
i[p] = this.createClipPlayer(p, { ...h, preload: gt(h.preload), ephemeral: !1, fit: "contain" });
|
|
4199
|
+
}), Object.entries(o).filter(([p]) => p in n).forEach(([p, h]) => {
|
|
4200
|
+
h.config.preload !== n[p].preload && this.updateVideoClipPlayer(p, (y) => (y.config = {
|
|
4157
4201
|
...y.config,
|
|
4158
|
-
preload:
|
|
4202
|
+
preload: gt(n[p].preload),
|
|
4159
4203
|
ephemeral: !1
|
|
4160
4204
|
}, y.videoElement.preload = y.config.preload, y));
|
|
4161
4205
|
}), i;
|
|
@@ -4168,7 +4212,7 @@ class ua {
|
|
|
4168
4212
|
clips: { ...this.videoClipPlayers },
|
|
4169
4213
|
activeClip: this.activeClip ? {
|
|
4170
4214
|
path: this.activeClip.path,
|
|
4171
|
-
state: this.videoClipPlayers[this.activeClip.path].videoElement?.paused ?
|
|
4215
|
+
state: this.videoClipPlayers[this.activeClip.path].videoElement?.paused ? Oe.Paused : Oe.Playing,
|
|
4172
4216
|
loop: this.videoClipPlayers[this.activeClip.path].videoElement?.loop ?? !1,
|
|
4173
4217
|
volume: this.videoClipPlayers[this.activeClip.path].videoElement?.muted ? 0 : this.videoClipPlayers[this.activeClip.path].videoElement?.volume ?? 0
|
|
4174
4218
|
} : void 0
|
|
@@ -4218,7 +4262,7 @@ class ua {
|
|
|
4218
4262
|
videoElement: this.createVideoElement(t, n, { volume: 1 }),
|
|
4219
4263
|
volume: 1
|
|
4220
4264
|
};
|
|
4221
|
-
return
|
|
4265
|
+
return yt(i, this.sinkId), i;
|
|
4222
4266
|
}
|
|
4223
4267
|
unloadClip(t) {
|
|
4224
4268
|
if (this.activeClip?.path === t) {
|
|
@@ -4228,112 +4272,360 @@ class ua {
|
|
|
4228
4272
|
this.videoClipPlayers[t]?.videoElement.remove(), this.updateVideoClipPlayer(t, () => null);
|
|
4229
4273
|
}
|
|
4230
4274
|
}
|
|
4231
|
-
function
|
|
4275
|
+
function gt(e) {
|
|
4232
4276
|
return typeof e == "string" ? e : e ? "auto" : "none";
|
|
4233
4277
|
}
|
|
4234
|
-
function
|
|
4278
|
+
function yt(e, t) {
|
|
4235
4279
|
t !== void 0 && typeof e.videoElement.setSinkId == "function" && e.videoElement.setSinkId(t);
|
|
4236
4280
|
}
|
|
4237
4281
|
function de(e, t) {
|
|
4238
4282
|
e.volume = t, e.muted = t === 0;
|
|
4239
4283
|
}
|
|
4240
|
-
function
|
|
4284
|
+
function Ue(e, t) {
|
|
4241
4285
|
switch (e.type) {
|
|
4242
4286
|
case "image": {
|
|
4243
4287
|
if (e.keyframes[0][0] > t)
|
|
4244
4288
|
return;
|
|
4245
|
-
const o = e.keyframes.filter((
|
|
4246
|
-
return { ...
|
|
4289
|
+
const o = e.keyframes.filter((a) => a[1] !== null), i = Se(o, t);
|
|
4290
|
+
return { ...Ht, ...i };
|
|
4247
4291
|
}
|
|
4248
4292
|
case "audio": {
|
|
4249
|
-
const n = e.keyframes.filter((
|
|
4293
|
+
const n = e.keyframes.filter((a) => a[1] !== null), o = bt(n, t);
|
|
4250
4294
|
if (!o)
|
|
4251
4295
|
return;
|
|
4252
|
-
const i =
|
|
4296
|
+
const i = Se(n, t);
|
|
4253
4297
|
return { ...De, ...i, ...o };
|
|
4254
4298
|
}
|
|
4255
4299
|
case "video": {
|
|
4256
|
-
const n = e.keyframes.filter((
|
|
4300
|
+
const n = e.keyframes.filter((a) => a[1] !== null), o = bt(n, t);
|
|
4257
4301
|
if (!o)
|
|
4258
4302
|
return;
|
|
4259
|
-
const i =
|
|
4260
|
-
return { ...
|
|
4303
|
+
const i = Se(n, t);
|
|
4304
|
+
return { ...Jt, ...i, ...o };
|
|
4261
4305
|
}
|
|
4262
4306
|
}
|
|
4263
4307
|
}
|
|
4264
|
-
function
|
|
4308
|
+
function Se(e, t) {
|
|
4265
4309
|
const n = {};
|
|
4266
|
-
for (const [i,
|
|
4267
|
-
i <= t ? (Object.entries(
|
|
4310
|
+
for (const [i, a] of e)
|
|
4311
|
+
i <= t ? (Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
4268
4312
|
n[c] ??= {}, n[c].before = [i, l];
|
|
4269
|
-
}), Object.entries(
|
|
4313
|
+
}), Object.entries(a.set ?? {}).forEach(([c, l]) => {
|
|
4270
4314
|
n[c] ??= {}, n[c].before = [i, l];
|
|
4271
|
-
})) : Object.entries(
|
|
4315
|
+
})) : Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
4272
4316
|
n[c] ??= {}, n[c].after === void 0 && (n[c].after = [i, l]);
|
|
4273
4317
|
});
|
|
4274
4318
|
const o = {};
|
|
4275
4319
|
return Object.entries(n).forEach(
|
|
4276
|
-
([i, { before:
|
|
4277
|
-
if (c === void 0 &&
|
|
4278
|
-
o[i] =
|
|
4320
|
+
([i, { before: a, after: c }]) => {
|
|
4321
|
+
if (c === void 0 && a) {
|
|
4322
|
+
o[i] = a[1];
|
|
4279
4323
|
return;
|
|
4280
4324
|
}
|
|
4281
|
-
if (
|
|
4325
|
+
if (a && c && a[0] === c[0]) {
|
|
4282
4326
|
o[i] = c[1];
|
|
4283
4327
|
return;
|
|
4284
4328
|
}
|
|
4285
|
-
if (
|
|
4286
|
-
o[i] =
|
|
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]);
|
|
4287
4331
|
return;
|
|
4288
4332
|
}
|
|
4289
4333
|
}
|
|
4290
4334
|
), o;
|
|
4291
4335
|
}
|
|
4292
|
-
function
|
|
4336
|
+
function bt(e, t) {
|
|
4293
4337
|
const n = e[0];
|
|
4294
4338
|
if (!n || n[0] > t)
|
|
4295
4339
|
return;
|
|
4296
|
-
let o = 0, { t: i, rate:
|
|
4297
|
-
for (const [
|
|
4298
|
-
if (
|
|
4340
|
+
let o = 0, { t: i, rate: a } = De;
|
|
4341
|
+
for (const [h, y] of e) {
|
|
4342
|
+
if (h > t) break;
|
|
4299
4343
|
const { set: g } = y;
|
|
4300
4344
|
if (!g) continue;
|
|
4301
4345
|
const { t: r, rate: s } = g;
|
|
4302
4346
|
if (r !== void 0) {
|
|
4303
|
-
o =
|
|
4347
|
+
o = h, i = r, s !== void 0 && (a = s);
|
|
4304
4348
|
continue;
|
|
4305
4349
|
}
|
|
4306
4350
|
if (s !== void 0) {
|
|
4307
|
-
const d = (
|
|
4308
|
-
o =
|
|
4351
|
+
const d = (h - o) * a;
|
|
4352
|
+
o = h, i += d, a = s;
|
|
4309
4353
|
}
|
|
4310
4354
|
}
|
|
4311
|
-
const l = (t - o) *
|
|
4355
|
+
const l = (t - o) * a, p = i + l;
|
|
4312
4356
|
return {
|
|
4313
|
-
rate:
|
|
4357
|
+
rate: a,
|
|
4314
4358
|
t: p
|
|
4315
4359
|
};
|
|
4316
4360
|
}
|
|
4317
|
-
|
|
4361
|
+
class Me {
|
|
4362
|
+
constructor(t, n, o, i, a) {
|
|
4363
|
+
this.surfaceElement = t, this.clipElement = n, this.constructAssetURL = i, this.mediaPreloader = a, this._state = o, setTimeout(this.loop);
|
|
4364
|
+
}
|
|
4365
|
+
isConnected(t) {
|
|
4366
|
+
return !(!this.surfaceElement || !this.clipElement || !this.surfaceElement.contains(this.clipElement) || t && !this.clipElement.contains(t));
|
|
4367
|
+
}
|
|
4368
|
+
_state;
|
|
4369
|
+
setState(t) {
|
|
4370
|
+
this._state = t, clearTimeout(this.timeout), this.loop();
|
|
4371
|
+
}
|
|
4372
|
+
timeout;
|
|
4373
|
+
loop = async () => {
|
|
4374
|
+
this.isConnected() ? (this.update(), this.timeout = setTimeout(this.loop, 0)) : this.destroy();
|
|
4375
|
+
};
|
|
4376
|
+
}
|
|
4377
|
+
function Fe(e, t, n, o, i) {
|
|
4378
|
+
let a;
|
|
4379
|
+
switch (n.type) {
|
|
4380
|
+
case "image":
|
|
4381
|
+
{
|
|
4382
|
+
a = e instanceof HTMLImageElement ? e : document.createElement("img");
|
|
4383
|
+
const c = o(n.file);
|
|
4384
|
+
a.src.includes(c) || (a.src = c);
|
|
4385
|
+
}
|
|
4386
|
+
break;
|
|
4387
|
+
case "audio":
|
|
4388
|
+
a = e instanceof HTMLAudioElement ? e : i.getElement(n.file, n.type);
|
|
4389
|
+
break;
|
|
4390
|
+
case "video":
|
|
4391
|
+
a = e instanceof HTMLVideoElement ? e : i.getElement(n.file, n.type);
|
|
4392
|
+
break;
|
|
4393
|
+
}
|
|
4394
|
+
return t.replaceChildren(a), a.style.position = "absolute", a.style.width = "100%", a.style.height = "100%", a;
|
|
4395
|
+
}
|
|
4396
|
+
function Qt(e, t, n) {
|
|
4397
|
+
const o = String(t.opacity);
|
|
4398
|
+
e.style.opacity !== o && (e.style.opacity = o);
|
|
4399
|
+
const i = Math.round(t.zIndex ?? 0);
|
|
4400
|
+
parseInt(e.style.zIndex) !== i && (e.style.zIndex = String(i)), e.style.objectFit !== n && (e.style.objectFit = n);
|
|
4401
|
+
}
|
|
4402
|
+
function Yt(e, t, n) {
|
|
4403
|
+
e.volume !== t.volume && (e.volume = t.volume), e.sinkId !== n && e.setSinkId(n).catch(() => {
|
|
4404
|
+
});
|
|
4405
|
+
}
|
|
4406
|
+
const wt = 50, da = 5, Xt = 1e3, pa = 5, fa = 5, ha = 0.3, _a = 0.1;
|
|
4407
|
+
function ma(e) {
|
|
4408
|
+
return Math.sign(e) * Math.pow(Math.abs(e) / Xt, ha) * _a;
|
|
4409
|
+
}
|
|
4410
|
+
function en(e, t, n, o) {
|
|
4411
|
+
if (e.paused && t.rate > 0 && e.play().catch(() => {
|
|
4412
|
+
}), e.duration) {
|
|
4413
|
+
const l = n.filter(([p, h]) => p > t.t && (h?.set?.t !== void 0 || h?.set?.rate !== void 0))[0];
|
|
4414
|
+
if (l?.[1]?.set?.t === 0) {
|
|
4415
|
+
const p = (e.duration - t.t) / t.rate, h = l[0] - t.t, y = Math.abs(p - h) <= fa;
|
|
4416
|
+
e.loop !== y && (e.loop = y);
|
|
4417
|
+
}
|
|
4418
|
+
}
|
|
4419
|
+
const a = e.currentTime * 1e3 - t.t, c = Math.abs(a);
|
|
4420
|
+
switch (!0) {
|
|
4421
|
+
case (o.state === "idle" && t.rate > 0 && c <= wt):
|
|
4422
|
+
return e.playbackRate !== t.rate && (e.playbackRate = t.rate), { state: "idle" };
|
|
4423
|
+
case (o.state === "idle" && t.rate > 0 && c > wt && c <= Xt): {
|
|
4424
|
+
const l = ma(a), p = Math.max(0, t.rate - l);
|
|
4425
|
+
return e.playbackRate !== p && (e.playbackRate = p), { state: "intercepting" };
|
|
4426
|
+
}
|
|
4427
|
+
case (o.state === "intercepting" && t.rate > 0 && c <= da):
|
|
4428
|
+
return e.playbackRate !== t.rate && (e.playbackRate = t.rate), { state: "idle" };
|
|
4429
|
+
case (o.state === "intercepting" && Math.sign(a) === Math.sign(e.playbackRate - t.rate)):
|
|
4430
|
+
return console.warn(a, "missed intercept"), { state: "idle" };
|
|
4431
|
+
case o.state === "intercepting":
|
|
4432
|
+
return { state: "intercepting" };
|
|
4433
|
+
case o.state === "seeking":
|
|
4434
|
+
return { state: "seeking" };
|
|
4435
|
+
default:
|
|
4436
|
+
return e.playbackRate !== t.rate && (e.playbackRate = t.rate), e.currentTime = (t.t + t.rate * pa) / 1e3, { state: "seeking" };
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4439
|
+
class va extends Me {
|
|
4440
|
+
imageElement;
|
|
4441
|
+
update() {
|
|
4442
|
+
const t = Ue(this._state, Date.now());
|
|
4443
|
+
t ? this.imageElement = Fe(
|
|
4444
|
+
this.imageElement,
|
|
4445
|
+
this.clipElement,
|
|
4446
|
+
this._state,
|
|
4447
|
+
this.constructAssetURL,
|
|
4448
|
+
this.mediaPreloader
|
|
4449
|
+
) : this.imageElement && this.destroy(), !(!t || !this.imageElement) && Qt(this.imageElement, t, this._state.fit);
|
|
4450
|
+
}
|
|
4451
|
+
destroy() {
|
|
4452
|
+
this.imageElement && (this.imageElement.remove(), this.imageElement.src = "", this.imageElement = void 0);
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
class ga extends Me {
|
|
4456
|
+
syncState = { state: "idle" };
|
|
4457
|
+
audioElement;
|
|
4458
|
+
update() {
|
|
4459
|
+
const t = Ue(this._state, Date.now());
|
|
4460
|
+
if (t ? this.audioElement = Fe(
|
|
4461
|
+
this.audioElement,
|
|
4462
|
+
this.clipElement,
|
|
4463
|
+
this._state,
|
|
4464
|
+
this.constructAssetURL,
|
|
4465
|
+
this.mediaPreloader
|
|
4466
|
+
) : this.destroy(), !t || !this.audioElement) return;
|
|
4467
|
+
Yt(this.audioElement, t, this._state.audioOutput);
|
|
4468
|
+
const n = en(this.audioElement, t, this._state.keyframes, this.syncState);
|
|
4469
|
+
this.syncState.state !== "seeking" && n.state === "seeking" && this.audioElement.addEventListener(
|
|
4470
|
+
"seeked",
|
|
4471
|
+
() => {
|
|
4472
|
+
this.syncState = { state: "idle" };
|
|
4473
|
+
},
|
|
4474
|
+
{ passive: !0, once: !0 }
|
|
4475
|
+
), this.syncState = n;
|
|
4476
|
+
}
|
|
4477
|
+
destroy() {
|
|
4478
|
+
this.audioElement?.remove(), this.audioElement = void 0;
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
class ya extends Me {
|
|
4482
|
+
syncState = { state: "idle" };
|
|
4483
|
+
videoElement;
|
|
4484
|
+
update() {
|
|
4485
|
+
const t = Ue(this._state, Date.now());
|
|
4486
|
+
if (t ? this.videoElement = Fe(
|
|
4487
|
+
this.videoElement,
|
|
4488
|
+
this.clipElement,
|
|
4489
|
+
this._state,
|
|
4490
|
+
this.constructAssetURL,
|
|
4491
|
+
this.mediaPreloader
|
|
4492
|
+
) : this.destroy(), !t || !this.videoElement) return;
|
|
4493
|
+
Qt(this.videoElement, t, this._state.fit), Yt(this.videoElement, t, this._state.audioOutput);
|
|
4494
|
+
const n = en(this.videoElement, t, this._state.keyframes, this.syncState);
|
|
4495
|
+
this.syncState.state !== "seeking" && n.state === "seeking" && this.videoElement.addEventListener(
|
|
4496
|
+
"seeked",
|
|
4497
|
+
() => {
|
|
4498
|
+
this.syncState = { state: "idle" };
|
|
4499
|
+
},
|
|
4500
|
+
{ passive: !0, once: !0 }
|
|
4501
|
+
), this.syncState = n;
|
|
4502
|
+
}
|
|
4503
|
+
destroy() {
|
|
4504
|
+
this.videoElement?.remove(), this.videoElement = void 0;
|
|
4505
|
+
}
|
|
4506
|
+
}
|
|
4507
|
+
class ba {
|
|
4508
|
+
_state;
|
|
4509
|
+
_elements = {};
|
|
4510
|
+
_constructAssetURL;
|
|
4511
|
+
constructor(t, n = {}) {
|
|
4512
|
+
this._constructAssetURL = t, this._state = n;
|
|
4513
|
+
}
|
|
4514
|
+
get state() {
|
|
4515
|
+
return { ...this._state };
|
|
4516
|
+
}
|
|
4517
|
+
setState(t) {
|
|
4518
|
+
this._state = t, this.update();
|
|
4519
|
+
}
|
|
4520
|
+
update() {
|
|
4521
|
+
for (const [t, n] of Object.entries(this._elements))
|
|
4522
|
+
t in this._state || (n.element.src = "", delete this._elements[t]), n.inUse = n.element.isConnected;
|
|
4523
|
+
for (const [t, n] of Object.entries(this._state)) {
|
|
4524
|
+
if (t in this._elements)
|
|
4525
|
+
continue;
|
|
4526
|
+
let o;
|
|
4527
|
+
switch (n.preload === !0 ? o = "auto" : n.preload === !1 ? o = "none" : o = n.preload, n.type) {
|
|
4528
|
+
case "audio": {
|
|
4529
|
+
const i = document.createElement("audio");
|
|
4530
|
+
i.src = this._constructAssetURL(t), i.preload = o, this._elements[t] = { element: i, inUse: !1, type: "audio" };
|
|
4531
|
+
break;
|
|
4532
|
+
}
|
|
4533
|
+
case "video": {
|
|
4534
|
+
const i = document.createElement("video");
|
|
4535
|
+
i.src = this._constructAssetURL(t), i.preload = o, this._elements[t] = { element: i, inUse: !1, type: "video" };
|
|
4536
|
+
break;
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
getElement(t, n) {
|
|
4542
|
+
const o = this._elements[t];
|
|
4543
|
+
if (o && o.inUse === !1)
|
|
4544
|
+
return o.inUse = !0, o.element;
|
|
4545
|
+
{
|
|
4546
|
+
const i = document.createElement(n);
|
|
4547
|
+
return i.src = this._constructAssetURL(t), this._elements[t] = { element: i, type: n, inUse: !0 }, i;
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
releaseElement(t) {
|
|
4551
|
+
if (typeof t == "string") {
|
|
4552
|
+
const n = this._elements[t];
|
|
4553
|
+
n && (n.inUse = !1);
|
|
4554
|
+
} else
|
|
4555
|
+
Object.entries(this._elements).forEach(([n, o]) => {
|
|
4556
|
+
o.element === t && delete this._elements[n];
|
|
4557
|
+
});
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
const wa = "data-clip-id";
|
|
4561
|
+
class Ta {
|
|
4562
|
+
constructor(t, n, o = new ba(t)) {
|
|
4563
|
+
this.constructAssetUrl = t, this.mediaPreloader = o, this._element = document.createElement("div"), this._element.className = "surface-manager", this._element.style.width = "100%", this._element.style.height = "100%", this._state = n || {}, this.update();
|
|
4564
|
+
}
|
|
4565
|
+
_state = {};
|
|
4566
|
+
setState(t) {
|
|
4567
|
+
this._state = t, this.update();
|
|
4568
|
+
}
|
|
4569
|
+
_element;
|
|
4570
|
+
get element() {
|
|
4571
|
+
return this._element;
|
|
4572
|
+
}
|
|
4573
|
+
resources = {};
|
|
4574
|
+
update() {
|
|
4575
|
+
Object.entries(this.resources).forEach(([n, { element: o, manager: i }]) => {
|
|
4576
|
+
n in this._state || (delete this.resources[n], o.remove(), i?.destroy());
|
|
4577
|
+
});
|
|
4578
|
+
const t = Object.keys(this._state).toSorted().map((n) => {
|
|
4579
|
+
const o = this.resources[n];
|
|
4580
|
+
if (o)
|
|
4581
|
+
return o.element;
|
|
4582
|
+
{
|
|
4583
|
+
const i = document.createElement("div");
|
|
4584
|
+
return i.setAttribute(wa, n), this.resources[n] = { element: i }, i;
|
|
4585
|
+
}
|
|
4586
|
+
});
|
|
4587
|
+
this._element.replaceChildren(...t), Object.keys(this._state).toSorted().forEach((n) => {
|
|
4588
|
+
const o = this._state[n], i = this.resources[n];
|
|
4589
|
+
if (!i)
|
|
4590
|
+
throw new Error("Failed to create resource");
|
|
4591
|
+
if (i.manager)
|
|
4592
|
+
i.manager.setState(o);
|
|
4593
|
+
else
|
|
4594
|
+
switch (o.type) {
|
|
4595
|
+
case "image":
|
|
4596
|
+
i.manager = new va(this._element, i.element, o, this.constructAssetUrl, this.mediaPreloader);
|
|
4597
|
+
break;
|
|
4598
|
+
case "audio":
|
|
4599
|
+
i.manager = new ga(this._element, i.element, o, this.constructAssetUrl, this.mediaPreloader);
|
|
4600
|
+
break;
|
|
4601
|
+
case "video":
|
|
4602
|
+
i.manager = new ya(this._element, i.element, o, this.constructAssetUrl, this.mediaPreloader);
|
|
4603
|
+
break;
|
|
4604
|
+
}
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4318
4609
|
__proto__: null
|
|
4319
4610
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4320
4611
|
export {
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4612
|
+
Sa as CogsAudioPlayer,
|
|
4613
|
+
Sn as CogsConfigChangedEvent,
|
|
4614
|
+
Ea as CogsConnection,
|
|
4615
|
+
En as CogsConnectionCloseEvent,
|
|
4616
|
+
kn as CogsConnectionOpenEvent,
|
|
4617
|
+
Tn as CogsIncomingEvent,
|
|
4618
|
+
zn as CogsMediaConfigChangedEvent,
|
|
4619
|
+
Cn as CogsMessageEvent,
|
|
4620
|
+
In as CogsShowPhaseChangedEvent,
|
|
4621
|
+
An as CogsStateChangedEvent,
|
|
4622
|
+
Aa as CogsVideoPlayer,
|
|
4623
|
+
We as DataStoreItemEvent,
|
|
4624
|
+
qe as DataStoreItemsEvent,
|
|
4625
|
+
za as ManifestTypes,
|
|
4626
|
+
Ca as MediaSchema,
|
|
4627
|
+
Ta as SurfaceManager,
|
|
4628
|
+
pn as assetUrl,
|
|
4629
|
+
Ue as getStateAtTime,
|
|
4630
|
+
ka as preloadUrl
|
|
4339
4631
|
};
|