@shotstack/shotstack-studio 1.2.0 → 1.2.2
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/core/loaders/asset-loader.d.ts +10 -2
- package/dist/core/schemas/asset.d.ts +14 -10
- package/dist/core/schemas/audio-asset.d.ts +10 -6
- package/dist/core/schemas/clip.d.ts +43 -29
- package/dist/core/schemas/edit.d.ts +115 -87
- package/dist/core/schemas/html-asset.d.ts +2 -2
- package/dist/core/schemas/track.d.ts +47 -33
- package/dist/core/schemas/video-asset.d.ts +10 -6
- package/dist/shotstack-studio.es.js +612 -558
- package/dist/shotstack-studio.umd.js +3 -3
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Filter as Kt, deprecation as Ht, GpuProgram as Bt, GlProgram as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import { FFmpeg as
|
|
6
|
-
class
|
|
1
|
+
import * as v from "pixi.js";
|
|
2
|
+
import { Filter as Kt, deprecation as Ht, GpuProgram as Bt, GlProgram as $t, Color as jt } from "pixi.js";
|
|
3
|
+
import * as ft from "opentype.js";
|
|
4
|
+
import * as Ut from "howler";
|
|
5
|
+
import { FFmpeg as Wt } from "@ffmpeg/ffmpeg";
|
|
6
|
+
class It {
|
|
7
7
|
events;
|
|
8
8
|
constructor() {
|
|
9
9
|
this.events = {};
|
|
@@ -23,21 +23,28 @@ class Pt {
|
|
|
23
23
|
i(t);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class Xt extends It {
|
|
27
27
|
registry;
|
|
28
28
|
constructor() {
|
|
29
29
|
super(), this.registry = {};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
class
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
class Te {
|
|
33
|
+
static VIDEO_EXTENSIONS = [".mp4", ".m4v", ".webm", ".ogg", ".ogv"];
|
|
34
|
+
static VIDEO_MIME = {
|
|
35
|
+
".mp4": "video/mp4",
|
|
36
|
+
".m4v": "video/mp4",
|
|
37
|
+
".webm": "video/webm",
|
|
38
|
+
".ogg": "video/ogg",
|
|
39
|
+
".ogv": "video/ogg"
|
|
40
|
+
};
|
|
41
|
+
loadTracker = new Xt();
|
|
37
42
|
async load(e, t) {
|
|
38
43
|
this.updateAssetLoadMetadata(e, "pending", 0);
|
|
39
44
|
try {
|
|
40
|
-
|
|
45
|
+
if (await this.shouldUseSafariVideoLoader(t))
|
|
46
|
+
return await this.loadVideoForSafari(e, t);
|
|
47
|
+
const i = await v.Assets.load(t, (s) => {
|
|
41
48
|
this.updateAssetLoadMetadata(e, "loading", s);
|
|
42
49
|
});
|
|
43
50
|
return this.updateAssetLoadMetadata(e, "success", 1), i;
|
|
@@ -47,7 +54,54 @@ class Yt {
|
|
|
47
54
|
}
|
|
48
55
|
getProgress() {
|
|
49
56
|
const e = Object.keys(this.loadTracker.registry);
|
|
50
|
-
return e.reduce((i, s) => i + this.loadTracker.registry[s].progress, 0) / e.length;
|
|
57
|
+
return e.length === 0 ? 0 : e.reduce((i, s) => i + this.loadTracker.registry[s].progress, 0) / e.length;
|
|
58
|
+
}
|
|
59
|
+
extractUrl(e) {
|
|
60
|
+
if (typeof e == "string") return e;
|
|
61
|
+
const t = Array.isArray(e.src) ? e.src[0] : e.src;
|
|
62
|
+
return typeof t == "string" ? t : t?.src;
|
|
63
|
+
}
|
|
64
|
+
hasVideoExtension(e) {
|
|
65
|
+
const t = new URL(e, window.location.origin).pathname.toLowerCase();
|
|
66
|
+
return Te.VIDEO_EXTENSIONS.some((i) => t.endsWith(i));
|
|
67
|
+
}
|
|
68
|
+
async getContentType(e) {
|
|
69
|
+
try {
|
|
70
|
+
return (await fetch(e, { method: "HEAD" })).headers.get("content-type");
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
canPlayVideo(e) {
|
|
76
|
+
const t = new URL(e, window.location.origin).pathname.toLowerCase(), i = t.slice(t.lastIndexOf(".")), s = Te.VIDEO_MIME[i];
|
|
77
|
+
return s ? document.createElement("video").canPlayType(s) !== "" : !1;
|
|
78
|
+
}
|
|
79
|
+
async isPlayableVideo(e) {
|
|
80
|
+
if (this.hasVideoExtension(e)) return this.canPlayVideo(e);
|
|
81
|
+
const t = await this.getContentType(e);
|
|
82
|
+
return t?.startsWith("video/") ? document.createElement("video").canPlayType(t) !== "" : !1;
|
|
83
|
+
}
|
|
84
|
+
async shouldUseSafariVideoLoader(e) {
|
|
85
|
+
const t = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), i = this.extractUrl(e);
|
|
86
|
+
return t && i !== void 0 && await this.isPlayableVideo(i);
|
|
87
|
+
}
|
|
88
|
+
async loadVideoForSafari(e, t) {
|
|
89
|
+
const i = this.extractUrl(t), s = typeof t == "object" ? t.data ?? {} : {}, n = await new Promise((r, o) => {
|
|
90
|
+
const l = document.createElement("video");
|
|
91
|
+
l.crossOrigin = "anonymous", l.playsInline = !0, l.muted = !0, l.preload = "metadata", l.addEventListener("loadedmetadata", () => {
|
|
92
|
+
try {
|
|
93
|
+
const c = new v.VideoSource({
|
|
94
|
+
resource: l,
|
|
95
|
+
autoPlay: s.autoPlay ?? !1,
|
|
96
|
+
...s
|
|
97
|
+
});
|
|
98
|
+
r(new v.Texture({ source: c }));
|
|
99
|
+
} catch (c) {
|
|
100
|
+
o(c);
|
|
101
|
+
}
|
|
102
|
+
}, { once: !0 }), l.addEventListener("error", () => o(new Error("Video loading failed")), { once: !0 }), this.updateAssetLoadMetadata(e, "loading", 0.5), l.src = i;
|
|
103
|
+
});
|
|
104
|
+
return this.updateAssetLoadMetadata(e, "success", 1), n;
|
|
51
105
|
}
|
|
52
106
|
updateAssetLoadMetadata(e, t, i) {
|
|
53
107
|
this.loadTracker.registry[e] ? (this.loadTracker.registry[e].progress = i, this.loadTracker.registry[e].status = t) : this.loadTracker.registry[e] = { progress: i, status: t };
|
|
@@ -55,16 +109,16 @@ class Yt {
|
|
|
55
109
|
this.loadTracker.emit("onAssetLoadInfoUpdated", { registry: s });
|
|
56
110
|
}
|
|
57
111
|
}
|
|
58
|
-
class
|
|
112
|
+
class Ve {
|
|
59
113
|
static Name = "FontLoadParser";
|
|
60
114
|
name;
|
|
61
115
|
extension;
|
|
62
116
|
validFontExtensions;
|
|
63
117
|
woff2Decompressor;
|
|
64
118
|
constructor() {
|
|
65
|
-
this.name =
|
|
66
|
-
type: [
|
|
67
|
-
priority:
|
|
119
|
+
this.name = Ve.Name, this.extension = {
|
|
120
|
+
type: [v.ExtensionType.LoadParser],
|
|
121
|
+
priority: v.LoaderParserPriority.High,
|
|
68
122
|
ref: null
|
|
69
123
|
}, this.validFontExtensions = ["ttf", "otf", "woff", "woff2"], this.woff2Decompressor = null;
|
|
70
124
|
}
|
|
@@ -75,12 +129,12 @@ class Ze {
|
|
|
75
129
|
async load(e, t, i) {
|
|
76
130
|
const s = e.split("?")[0]?.split(".").pop()?.toLowerCase() ?? "", n = await fetch(e).then((p) => p.arrayBuffer());
|
|
77
131
|
if (s !== "woff2") {
|
|
78
|
-
const p =
|
|
132
|
+
const p = ft.parse(new Uint8Array(n).buffer), k = p.names.fontFamily.en || p.names.fontFamily[Object.keys(p.names.fontFamily)[0]], A = new FontFace(k, `url(${e})`);
|
|
79
133
|
return await A.load(), document.fonts.add(A), A;
|
|
80
134
|
}
|
|
81
135
|
if (await this.loadWoff2Decompressor(), !this.woff2Decompressor)
|
|
82
136
|
throw new Error("Cannot initialize Woff2 decompressor.");
|
|
83
|
-
const r = this.woff2Decompressor.decompress(n), o =
|
|
137
|
+
const r = this.woff2Decompressor.decompress(n), o = ft.parse(new Uint8Array(r).buffer), l = o.names.fontFamily.en || o.names.fontFamily[Object.keys(o.names.fontFamily)[0]], c = new Blob([r], { type: "font/ttf" }), h = URL.createObjectURL(c), g = new FontFace(l, `url(${h})`);
|
|
84
138
|
return await g.load(), document.fonts.add(g), g;
|
|
85
139
|
}
|
|
86
140
|
async loadWoff2Decompressor() {
|
|
@@ -131,14 +185,14 @@ var C;
|
|
|
131
185
|
}
|
|
132
186
|
a.joinValues = i, a.jsonStringifyReplacer = (s, n) => typeof n == "bigint" ? n.toString() : n;
|
|
133
187
|
})(C || (C = {}));
|
|
134
|
-
var
|
|
188
|
+
var pt;
|
|
135
189
|
(function(a) {
|
|
136
190
|
a.mergeShapes = (e, t) => ({
|
|
137
191
|
...e,
|
|
138
192
|
...t
|
|
139
193
|
// second overwrites first
|
|
140
194
|
});
|
|
141
|
-
})(
|
|
195
|
+
})(pt || (pt = {}));
|
|
142
196
|
const f = C.arrayToEnum([
|
|
143
197
|
"string",
|
|
144
198
|
"nan",
|
|
@@ -226,10 +280,10 @@ class F extends Error {
|
|
|
226
280
|
else if (r.path.length === 0)
|
|
227
281
|
i._errors.push(t(r));
|
|
228
282
|
else {
|
|
229
|
-
let o = i,
|
|
230
|
-
for (;
|
|
231
|
-
const c = r.path[
|
|
232
|
-
|
|
283
|
+
let o = i, l = 0;
|
|
284
|
+
for (; l < r.path.length; ) {
|
|
285
|
+
const c = r.path[l];
|
|
286
|
+
l === r.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(r))) : o[c] = o[c] || { _errors: [] }, o = o[c], l++;
|
|
233
287
|
}
|
|
234
288
|
}
|
|
235
289
|
};
|
|
@@ -259,7 +313,7 @@ class F extends Error {
|
|
|
259
313
|
}
|
|
260
314
|
}
|
|
261
315
|
F.create = (a) => new F(a);
|
|
262
|
-
const
|
|
316
|
+
const ke = (a, e) => {
|
|
263
317
|
let t;
|
|
264
318
|
switch (a.code) {
|
|
265
319
|
case u.invalid_type:
|
|
@@ -315,11 +369,11 @@ const _e = (a, e) => {
|
|
|
315
369
|
}
|
|
316
370
|
return { message: t };
|
|
317
371
|
};
|
|
318
|
-
let
|
|
372
|
+
let Yt = ke;
|
|
319
373
|
function Ye() {
|
|
320
|
-
return
|
|
374
|
+
return Yt;
|
|
321
375
|
}
|
|
322
|
-
const
|
|
376
|
+
const qe = (a) => {
|
|
323
377
|
const { data: e, path: t, errorMaps: i, issueData: s } = a, n = [...t, ...s.path || []], r = {
|
|
324
378
|
...s,
|
|
325
379
|
path: n
|
|
@@ -331,8 +385,8 @@ const Xe = (a) => {
|
|
|
331
385
|
message: s.message
|
|
332
386
|
};
|
|
333
387
|
let o = "";
|
|
334
|
-
const
|
|
335
|
-
for (const c of
|
|
388
|
+
const l = i.filter((c) => !!c).slice().reverse();
|
|
389
|
+
for (const c of l)
|
|
336
390
|
o = c(r, { data: e, defaultError: o }).message;
|
|
337
391
|
return {
|
|
338
392
|
...s,
|
|
@@ -341,7 +395,7 @@ const Xe = (a) => {
|
|
|
341
395
|
};
|
|
342
396
|
};
|
|
343
397
|
function d(a, e) {
|
|
344
|
-
const t = Ye(), i =
|
|
398
|
+
const t = Ye(), i = qe({
|
|
345
399
|
issueData: e,
|
|
346
400
|
data: a.data,
|
|
347
401
|
path: a.path,
|
|
@@ -352,13 +406,13 @@ function d(a, e) {
|
|
|
352
406
|
// then schema-bound map if available
|
|
353
407
|
t,
|
|
354
408
|
// then global override map
|
|
355
|
-
t ===
|
|
409
|
+
t === ke ? void 0 : ke
|
|
356
410
|
// then global default map
|
|
357
411
|
].filter((s) => !!s)
|
|
358
412
|
});
|
|
359
413
|
a.common.issues.push(i);
|
|
360
414
|
}
|
|
361
|
-
class
|
|
415
|
+
class z {
|
|
362
416
|
constructor() {
|
|
363
417
|
this.value = "valid";
|
|
364
418
|
}
|
|
@@ -386,7 +440,7 @@ class I {
|
|
|
386
440
|
value: r
|
|
387
441
|
});
|
|
388
442
|
}
|
|
389
|
-
return
|
|
443
|
+
return z.mergeObjectSync(e, i);
|
|
390
444
|
}
|
|
391
445
|
static mergeObjectSync(e, t) {
|
|
392
446
|
const i = {};
|
|
@@ -401,8 +455,8 @@ class I {
|
|
|
401
455
|
}
|
|
402
456
|
const w = Object.freeze({
|
|
403
457
|
status: "aborted"
|
|
404
|
-
}), ye = (a) => ({ status: "dirty", value: a }), M = (a) => ({ status: "valid", value: a }),
|
|
405
|
-
function
|
|
458
|
+
}), ye = (a) => ({ status: "dirty", value: a }), M = (a) => ({ status: "valid", value: a }), mt = (a) => a.status === "aborted", gt = (a) => a.status === "dirty", fe = (a) => a.status === "valid", Oe = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
459
|
+
function Ae(a, e, t, i) {
|
|
406
460
|
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
407
461
|
return e.get(a);
|
|
408
462
|
}
|
|
@@ -415,7 +469,7 @@ var m;
|
|
|
415
469
|
a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
416
470
|
})(m || (m = {}));
|
|
417
471
|
var ve, xe;
|
|
418
|
-
class
|
|
472
|
+
class V {
|
|
419
473
|
constructor(e, t, i, s) {
|
|
420
474
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = i, this._key = s;
|
|
421
475
|
}
|
|
@@ -423,7 +477,7 @@ class K {
|
|
|
423
477
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
424
478
|
}
|
|
425
479
|
}
|
|
426
|
-
const
|
|
480
|
+
const yt = (a, e) => {
|
|
427
481
|
if (fe(e))
|
|
428
482
|
return { success: !0, data: e.value };
|
|
429
483
|
if (!a.common.issues.length)
|
|
@@ -438,16 +492,16 @@ const gt = (a, e) => {
|
|
|
438
492
|
}
|
|
439
493
|
};
|
|
440
494
|
};
|
|
441
|
-
function
|
|
495
|
+
function _(a) {
|
|
442
496
|
if (!a)
|
|
443
497
|
return {};
|
|
444
498
|
const { errorMap: e, invalid_type_error: t, required_error: i, description: s } = a;
|
|
445
499
|
if (e && (t || i))
|
|
446
500
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
447
501
|
return e ? { errorMap: e, description: s } : { errorMap: (r, o) => {
|
|
448
|
-
var
|
|
449
|
-
const { message:
|
|
450
|
-
return r.code === "invalid_enum_value" ? { message:
|
|
502
|
+
var l, c;
|
|
503
|
+
const { message: h } = a;
|
|
504
|
+
return r.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: (l = h ?? i) !== null && l !== void 0 ? l : o.defaultError } : r.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = h ?? t) !== null && c !== void 0 ? c : o.defaultError };
|
|
451
505
|
}, description: s };
|
|
452
506
|
}
|
|
453
507
|
class b {
|
|
@@ -469,7 +523,7 @@ class b {
|
|
|
469
523
|
}
|
|
470
524
|
_processInputParams(e) {
|
|
471
525
|
return {
|
|
472
|
-
status: new
|
|
526
|
+
status: new z(),
|
|
473
527
|
ctx: {
|
|
474
528
|
common: e.parent.common,
|
|
475
529
|
data: e.data,
|
|
@@ -482,7 +536,7 @@ class b {
|
|
|
482
536
|
}
|
|
483
537
|
_parseSync(e) {
|
|
484
538
|
const t = this._parse(e);
|
|
485
|
-
if (
|
|
539
|
+
if (Oe(t))
|
|
486
540
|
throw new Error("Synchronous parse encountered promise.");
|
|
487
541
|
return t;
|
|
488
542
|
}
|
|
@@ -510,7 +564,7 @@ class b {
|
|
|
510
564
|
data: e,
|
|
511
565
|
parsedType: q(e)
|
|
512
566
|
}, n = this._parseSync({ data: e, path: s.path, parent: s });
|
|
513
|
-
return
|
|
567
|
+
return yt(s, n);
|
|
514
568
|
}
|
|
515
569
|
"~validate"(e) {
|
|
516
570
|
var t, i;
|
|
@@ -563,8 +617,8 @@ class b {
|
|
|
563
617
|
parent: null,
|
|
564
618
|
data: e,
|
|
565
619
|
parsedType: q(e)
|
|
566
|
-
}, s = this._parse({ data: e, path: i.path, parent: i }), n = await (
|
|
567
|
-
return
|
|
620
|
+
}, s = this._parse({ data: e, path: i.path, parent: i }), n = await (Oe(s) ? s : Promise.resolve(s));
|
|
621
|
+
return yt(i, n);
|
|
568
622
|
}
|
|
569
623
|
refine(e, t) {
|
|
570
624
|
const i = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
@@ -573,16 +627,16 @@ class b {
|
|
|
573
627
|
code: u.custom,
|
|
574
628
|
...i(s)
|
|
575
629
|
});
|
|
576
|
-
return typeof Promise < "u" && r instanceof Promise ? r.then((
|
|
630
|
+
return typeof Promise < "u" && r instanceof Promise ? r.then((l) => l ? !0 : (o(), !1)) : r ? !0 : (o(), !1);
|
|
577
631
|
});
|
|
578
632
|
}
|
|
579
633
|
refinement(e, t) {
|
|
580
634
|
return this._refinement((i, s) => e(i) ? !0 : (s.addIssue(typeof t == "function" ? t(i, s) : t), !1));
|
|
581
635
|
}
|
|
582
636
|
_refinement(e) {
|
|
583
|
-
return new
|
|
637
|
+
return new X({
|
|
584
638
|
schema: this,
|
|
585
|
-
typeName:
|
|
639
|
+
typeName: x.ZodEffects,
|
|
586
640
|
effect: { type: "refinement", refinement: e }
|
|
587
641
|
});
|
|
588
642
|
}
|
|
@@ -618,36 +672,36 @@ class b {
|
|
|
618
672
|
return ze.create(this, e, this._def);
|
|
619
673
|
}
|
|
620
674
|
transform(e) {
|
|
621
|
-
return new
|
|
622
|
-
...
|
|
675
|
+
return new X({
|
|
676
|
+
..._(this._def),
|
|
623
677
|
schema: this,
|
|
624
|
-
typeName:
|
|
678
|
+
typeName: x.ZodEffects,
|
|
625
679
|
effect: { type: "transform", transform: e }
|
|
626
680
|
});
|
|
627
681
|
}
|
|
628
682
|
default(e) {
|
|
629
683
|
const t = typeof e == "function" ? e : () => e;
|
|
630
|
-
return new
|
|
631
|
-
...
|
|
684
|
+
return new Ne({
|
|
685
|
+
..._(this._def),
|
|
632
686
|
innerType: this,
|
|
633
687
|
defaultValue: t,
|
|
634
|
-
typeName:
|
|
688
|
+
typeName: x.ZodDefault
|
|
635
689
|
});
|
|
636
690
|
}
|
|
637
691
|
brand() {
|
|
638
|
-
return new
|
|
639
|
-
typeName:
|
|
692
|
+
return new Mt({
|
|
693
|
+
typeName: x.ZodBranded,
|
|
640
694
|
type: this,
|
|
641
|
-
...
|
|
695
|
+
..._(this._def)
|
|
642
696
|
});
|
|
643
697
|
}
|
|
644
698
|
catch(e) {
|
|
645
699
|
const t = typeof e == "function" ? e : () => e;
|
|
646
|
-
return new
|
|
647
|
-
...
|
|
700
|
+
return new De({
|
|
701
|
+
..._(this._def),
|
|
648
702
|
innerType: this,
|
|
649
703
|
catchValue: t,
|
|
650
|
-
typeName:
|
|
704
|
+
typeName: x.ZodCatch
|
|
651
705
|
});
|
|
652
706
|
}
|
|
653
707
|
describe(e) {
|
|
@@ -661,7 +715,7 @@ class b {
|
|
|
661
715
|
return Ke.create(this, e);
|
|
662
716
|
}
|
|
663
717
|
readonly() {
|
|
664
|
-
return
|
|
718
|
+
return Ze.create(this);
|
|
665
719
|
}
|
|
666
720
|
isOptional() {
|
|
667
721
|
return this.safeParse(void 0).success;
|
|
@@ -671,17 +725,17 @@ class b {
|
|
|
671
725
|
}
|
|
672
726
|
}
|
|
673
727
|
const qt = /^c[^\s-]{8,}$/i, Gt = /^[0-9a-z]+$/, Qt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Jt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ei = /^[a-z0-9_-]{21}$/i, ti = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ii = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, si = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ni = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
674
|
-
let
|
|
728
|
+
let Xe;
|
|
675
729
|
const ai = /^(?:(?: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])$/, ri = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, oi = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, ci = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, li = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, hi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, zt = "((\\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])))", ui = new RegExp(`^${zt}$`);
|
|
676
|
-
function
|
|
730
|
+
function Lt(a) {
|
|
677
731
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
678
732
|
return a.precision ? e = `${e}\\.\\d{${a.precision}}` : a.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
679
733
|
}
|
|
680
734
|
function di(a) {
|
|
681
|
-
return new RegExp(`^${
|
|
735
|
+
return new RegExp(`^${Lt(a)}$`);
|
|
682
736
|
}
|
|
683
737
|
function fi(a) {
|
|
684
|
-
let e = `${zt}T${
|
|
738
|
+
let e = `${zt}T${Lt(a)}`;
|
|
685
739
|
const t = [];
|
|
686
740
|
return t.push(a.local ? "Z?" : "Z"), a.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
687
741
|
}
|
|
@@ -711,7 +765,7 @@ class j extends b {
|
|
|
711
765
|
received: n.parsedType
|
|
712
766
|
}), w;
|
|
713
767
|
}
|
|
714
|
-
const i = new
|
|
768
|
+
const i = new z();
|
|
715
769
|
let s;
|
|
716
770
|
for (const n of this._def.checks)
|
|
717
771
|
if (n.kind === "min")
|
|
@@ -756,7 +810,7 @@ class j extends b {
|
|
|
756
810
|
message: n.message
|
|
757
811
|
}), i.dirty());
|
|
758
812
|
else if (n.kind === "emoji")
|
|
759
|
-
|
|
813
|
+
Xe || (Xe = new RegExp(ni, "u")), Xe.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
760
814
|
validation: "emoji",
|
|
761
815
|
code: u.invalid_string,
|
|
762
816
|
message: n.message
|
|
@@ -1083,9 +1137,9 @@ j.create = (a) => {
|
|
|
1083
1137
|
var e;
|
|
1084
1138
|
return new j({
|
|
1085
1139
|
checks: [],
|
|
1086
|
-
typeName:
|
|
1140
|
+
typeName: x.ZodString,
|
|
1087
1141
|
coerce: (e = a?.coerce) !== null && e !== void 0 ? e : !1,
|
|
1088
|
-
...
|
|
1142
|
+
..._(a)
|
|
1089
1143
|
});
|
|
1090
1144
|
};
|
|
1091
1145
|
function yi(a, e) {
|
|
@@ -1106,7 +1160,7 @@ class pe extends b {
|
|
|
1106
1160
|
}), w;
|
|
1107
1161
|
}
|
|
1108
1162
|
let i;
|
|
1109
|
-
const s = new
|
|
1163
|
+
const s = new z();
|
|
1110
1164
|
for (const n of this._def.checks)
|
|
1111
1165
|
n.kind === "int" ? C.isInteger(e.data) || (i = this._getOrReturnCtx(e, i), d(i, {
|
|
1112
1166
|
code: u.invalid_type,
|
|
@@ -1260,9 +1314,9 @@ class pe extends b {
|
|
|
1260
1314
|
}
|
|
1261
1315
|
pe.create = (a) => new pe({
|
|
1262
1316
|
checks: [],
|
|
1263
|
-
typeName:
|
|
1317
|
+
typeName: x.ZodNumber,
|
|
1264
1318
|
coerce: a?.coerce || !1,
|
|
1265
|
-
...
|
|
1319
|
+
..._(a)
|
|
1266
1320
|
});
|
|
1267
1321
|
class me extends b {
|
|
1268
1322
|
constructor() {
|
|
@@ -1278,7 +1332,7 @@ class me extends b {
|
|
|
1278
1332
|
if (this._getType(e) !== f.bigint)
|
|
1279
1333
|
return this._getInvalidInput(e);
|
|
1280
1334
|
let i;
|
|
1281
|
-
const s = new
|
|
1335
|
+
const s = new z();
|
|
1282
1336
|
for (const n of this._def.checks)
|
|
1283
1337
|
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (i = this._getOrReturnCtx(e, i), d(i, {
|
|
1284
1338
|
code: u.too_small,
|
|
@@ -1395,12 +1449,12 @@ me.create = (a) => {
|
|
|
1395
1449
|
var e;
|
|
1396
1450
|
return new me({
|
|
1397
1451
|
checks: [],
|
|
1398
|
-
typeName:
|
|
1452
|
+
typeName: x.ZodBigInt,
|
|
1399
1453
|
coerce: (e = a?.coerce) !== null && e !== void 0 ? e : !1,
|
|
1400
|
-
...
|
|
1454
|
+
..._(a)
|
|
1401
1455
|
});
|
|
1402
1456
|
};
|
|
1403
|
-
class
|
|
1457
|
+
class Ge extends b {
|
|
1404
1458
|
_parse(e) {
|
|
1405
1459
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1406
1460
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1413,10 +1467,10 @@ class qe extends b {
|
|
|
1413
1467
|
return M(e.data);
|
|
1414
1468
|
}
|
|
1415
1469
|
}
|
|
1416
|
-
|
|
1417
|
-
typeName:
|
|
1470
|
+
Ge.create = (a) => new Ge({
|
|
1471
|
+
typeName: x.ZodBoolean,
|
|
1418
1472
|
coerce: a?.coerce || !1,
|
|
1419
|
-
...
|
|
1473
|
+
..._(a)
|
|
1420
1474
|
});
|
|
1421
1475
|
class be extends b {
|
|
1422
1476
|
_parse(e) {
|
|
@@ -1434,7 +1488,7 @@ class be extends b {
|
|
|
1434
1488
|
code: u.invalid_date
|
|
1435
1489
|
}), w;
|
|
1436
1490
|
}
|
|
1437
|
-
const i = new
|
|
1491
|
+
const i = new z();
|
|
1438
1492
|
let s;
|
|
1439
1493
|
for (const n of this._def.checks)
|
|
1440
1494
|
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
@@ -1493,10 +1547,10 @@ class be extends b {
|
|
|
1493
1547
|
be.create = (a) => new be({
|
|
1494
1548
|
checks: [],
|
|
1495
1549
|
coerce: a?.coerce || !1,
|
|
1496
|
-
typeName:
|
|
1497
|
-
...
|
|
1550
|
+
typeName: x.ZodDate,
|
|
1551
|
+
..._(a)
|
|
1498
1552
|
});
|
|
1499
|
-
class
|
|
1553
|
+
class Qe extends b {
|
|
1500
1554
|
_parse(e) {
|
|
1501
1555
|
if (this._getType(e) !== f.symbol) {
|
|
1502
1556
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1509,11 +1563,11 @@ class Ge extends b {
|
|
|
1509
1563
|
return M(e.data);
|
|
1510
1564
|
}
|
|
1511
1565
|
}
|
|
1512
|
-
|
|
1513
|
-
typeName:
|
|
1514
|
-
...
|
|
1566
|
+
Qe.create = (a) => new Qe({
|
|
1567
|
+
typeName: x.ZodSymbol,
|
|
1568
|
+
..._(a)
|
|
1515
1569
|
});
|
|
1516
|
-
class
|
|
1570
|
+
class Pe extends b {
|
|
1517
1571
|
_parse(e) {
|
|
1518
1572
|
if (this._getType(e) !== f.undefined) {
|
|
1519
1573
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1526,11 +1580,11 @@ class Ae extends b {
|
|
|
1526
1580
|
return M(e.data);
|
|
1527
1581
|
}
|
|
1528
1582
|
}
|
|
1529
|
-
|
|
1530
|
-
typeName:
|
|
1531
|
-
...
|
|
1583
|
+
Pe.create = (a) => new Pe({
|
|
1584
|
+
typeName: x.ZodUndefined,
|
|
1585
|
+
..._(a)
|
|
1532
1586
|
});
|
|
1533
|
-
class
|
|
1587
|
+
class Ie extends b {
|
|
1534
1588
|
_parse(e) {
|
|
1535
1589
|
if (this._getType(e) !== f.null) {
|
|
1536
1590
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1543,11 +1597,11 @@ class Pe extends b {
|
|
|
1543
1597
|
return M(e.data);
|
|
1544
1598
|
}
|
|
1545
1599
|
}
|
|
1546
|
-
|
|
1547
|
-
typeName:
|
|
1548
|
-
...
|
|
1600
|
+
Ie.create = (a) => new Ie({
|
|
1601
|
+
typeName: x.ZodNull,
|
|
1602
|
+
..._(a)
|
|
1549
1603
|
});
|
|
1550
|
-
class
|
|
1604
|
+
class Je extends b {
|
|
1551
1605
|
constructor() {
|
|
1552
1606
|
super(...arguments), this._any = !0;
|
|
1553
1607
|
}
|
|
@@ -1555,9 +1609,9 @@ class Qe extends b {
|
|
|
1555
1609
|
return M(e.data);
|
|
1556
1610
|
}
|
|
1557
1611
|
}
|
|
1558
|
-
|
|
1559
|
-
typeName:
|
|
1560
|
-
...
|
|
1612
|
+
Je.create = (a) => new Je({
|
|
1613
|
+
typeName: x.ZodAny,
|
|
1614
|
+
..._(a)
|
|
1561
1615
|
});
|
|
1562
1616
|
class ue extends b {
|
|
1563
1617
|
constructor() {
|
|
@@ -1568,8 +1622,8 @@ class ue extends b {
|
|
|
1568
1622
|
}
|
|
1569
1623
|
}
|
|
1570
1624
|
ue.create = (a) => new ue({
|
|
1571
|
-
typeName:
|
|
1572
|
-
...
|
|
1625
|
+
typeName: x.ZodUnknown,
|
|
1626
|
+
..._(a)
|
|
1573
1627
|
});
|
|
1574
1628
|
class G extends b {
|
|
1575
1629
|
_parse(e) {
|
|
@@ -1582,10 +1636,10 @@ class G extends b {
|
|
|
1582
1636
|
}
|
|
1583
1637
|
}
|
|
1584
1638
|
G.create = (a) => new G({
|
|
1585
|
-
typeName:
|
|
1586
|
-
...
|
|
1639
|
+
typeName: x.ZodNever,
|
|
1640
|
+
..._(a)
|
|
1587
1641
|
});
|
|
1588
|
-
class
|
|
1642
|
+
class et extends b {
|
|
1589
1643
|
_parse(e) {
|
|
1590
1644
|
if (this._getType(e) !== f.undefined) {
|
|
1591
1645
|
const i = this._getOrReturnCtx(e);
|
|
@@ -1598,9 +1652,9 @@ class Je extends b {
|
|
|
1598
1652
|
return M(e.data);
|
|
1599
1653
|
}
|
|
1600
1654
|
}
|
|
1601
|
-
|
|
1602
|
-
typeName:
|
|
1603
|
-
...
|
|
1655
|
+
et.create = (a) => new et({
|
|
1656
|
+
typeName: x.ZodVoid,
|
|
1657
|
+
..._(a)
|
|
1604
1658
|
});
|
|
1605
1659
|
class Z extends b {
|
|
1606
1660
|
_parse(e) {
|
|
@@ -1638,9 +1692,9 @@ class Z extends b {
|
|
|
1638
1692
|
exact: !1,
|
|
1639
1693
|
message: s.maxLength.message
|
|
1640
1694
|
}), i.dirty()), t.common.async)
|
|
1641
|
-
return Promise.all([...t.data].map((r, o) => s.type._parseAsync(new
|
|
1642
|
-
const n = [...t.data].map((r, o) => s.type._parseSync(new
|
|
1643
|
-
return
|
|
1695
|
+
return Promise.all([...t.data].map((r, o) => s.type._parseAsync(new V(t, r, t.path, o)))).then((r) => z.mergeArray(i, r));
|
|
1696
|
+
const n = [...t.data].map((r, o) => s.type._parseSync(new V(t, r, t.path, o)));
|
|
1697
|
+
return z.mergeArray(i, n);
|
|
1644
1698
|
}
|
|
1645
1699
|
get element() {
|
|
1646
1700
|
return this._def.type;
|
|
@@ -1672,8 +1726,8 @@ Z.create = (a, e) => new Z({
|
|
|
1672
1726
|
minLength: null,
|
|
1673
1727
|
maxLength: null,
|
|
1674
1728
|
exactLength: null,
|
|
1675
|
-
typeName:
|
|
1676
|
-
...
|
|
1729
|
+
typeName: x.ZodArray,
|
|
1730
|
+
..._(e)
|
|
1677
1731
|
});
|
|
1678
1732
|
function ce(a) {
|
|
1679
1733
|
if (a instanceof P) {
|
|
@@ -1714,22 +1768,22 @@ class P extends b {
|
|
|
1714
1768
|
if (!(this._def.catchall instanceof G && this._def.unknownKeys === "strip"))
|
|
1715
1769
|
for (const c in s.data)
|
|
1716
1770
|
r.includes(c) || o.push(c);
|
|
1717
|
-
const
|
|
1771
|
+
const l = [];
|
|
1718
1772
|
for (const c of r) {
|
|
1719
|
-
const
|
|
1720
|
-
|
|
1773
|
+
const h = n[c], g = s.data[c];
|
|
1774
|
+
l.push({
|
|
1721
1775
|
key: { status: "valid", value: c },
|
|
1722
|
-
value:
|
|
1776
|
+
value: h._parse(new V(s, g, s.path, c)),
|
|
1723
1777
|
alwaysSet: c in s.data
|
|
1724
1778
|
});
|
|
1725
1779
|
}
|
|
1726
1780
|
if (this._def.catchall instanceof G) {
|
|
1727
1781
|
const c = this._def.unknownKeys;
|
|
1728
1782
|
if (c === "passthrough")
|
|
1729
|
-
for (const
|
|
1730
|
-
|
|
1731
|
-
key: { status: "valid", value:
|
|
1732
|
-
value: { status: "valid", value: s.data[
|
|
1783
|
+
for (const h of o)
|
|
1784
|
+
l.push({
|
|
1785
|
+
key: { status: "valid", value: h },
|
|
1786
|
+
value: { status: "valid", value: s.data[h] }
|
|
1733
1787
|
});
|
|
1734
1788
|
else if (c === "strict")
|
|
1735
1789
|
o.length > 0 && (d(s, {
|
|
@@ -1739,30 +1793,30 @@ class P extends b {
|
|
|
1739
1793
|
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1740
1794
|
} else {
|
|
1741
1795
|
const c = this._def.catchall;
|
|
1742
|
-
for (const
|
|
1743
|
-
const g = s.data[
|
|
1744
|
-
|
|
1745
|
-
key: { status: "valid", value:
|
|
1796
|
+
for (const h of o) {
|
|
1797
|
+
const g = s.data[h];
|
|
1798
|
+
l.push({
|
|
1799
|
+
key: { status: "valid", value: h },
|
|
1746
1800
|
value: c._parse(
|
|
1747
|
-
new
|
|
1801
|
+
new V(s, g, s.path, h)
|
|
1748
1802
|
//, ctx.child(key), value, getParsedType(value)
|
|
1749
1803
|
),
|
|
1750
|
-
alwaysSet:
|
|
1804
|
+
alwaysSet: h in s.data
|
|
1751
1805
|
});
|
|
1752
1806
|
}
|
|
1753
1807
|
}
|
|
1754
1808
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1755
1809
|
const c = [];
|
|
1756
|
-
for (const
|
|
1757
|
-
const g = await
|
|
1810
|
+
for (const h of l) {
|
|
1811
|
+
const g = await h.key, p = await h.value;
|
|
1758
1812
|
c.push({
|
|
1759
1813
|
key: g,
|
|
1760
1814
|
value: p,
|
|
1761
|
-
alwaysSet:
|
|
1815
|
+
alwaysSet: h.alwaysSet
|
|
1762
1816
|
});
|
|
1763
1817
|
}
|
|
1764
1818
|
return c;
|
|
1765
|
-
}).then((c) =>
|
|
1819
|
+
}).then((c) => z.mergeObjectSync(i, c)) : z.mergeObjectSync(i, l);
|
|
1766
1820
|
}
|
|
1767
1821
|
get shape() {
|
|
1768
1822
|
return this._def.shape();
|
|
@@ -1774,11 +1828,11 @@ class P extends b {
|
|
|
1774
1828
|
...e !== void 0 ? {
|
|
1775
1829
|
errorMap: (t, i) => {
|
|
1776
1830
|
var s, n, r, o;
|
|
1777
|
-
const
|
|
1831
|
+
const l = (r = (n = (s = this._def).errorMap) === null || n === void 0 ? void 0 : n.call(s, t, i).message) !== null && r !== void 0 ? r : i.defaultError;
|
|
1778
1832
|
return t.code === "unrecognized_keys" ? {
|
|
1779
|
-
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o :
|
|
1833
|
+
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : l
|
|
1780
1834
|
} : {
|
|
1781
|
-
message:
|
|
1835
|
+
message: l
|
|
1782
1836
|
};
|
|
1783
1837
|
}
|
|
1784
1838
|
} : {}
|
|
@@ -1835,7 +1889,7 @@ class P extends b {
|
|
|
1835
1889
|
...this._def.shape(),
|
|
1836
1890
|
...e._def.shape()
|
|
1837
1891
|
}),
|
|
1838
|
-
typeName:
|
|
1892
|
+
typeName: x.ZodObject
|
|
1839
1893
|
});
|
|
1840
1894
|
}
|
|
1841
1895
|
// merge<
|
|
@@ -1954,29 +2008,29 @@ class P extends b {
|
|
|
1954
2008
|
});
|
|
1955
2009
|
}
|
|
1956
2010
|
keyof() {
|
|
1957
|
-
return
|
|
2011
|
+
return Et(C.objectKeys(this.shape));
|
|
1958
2012
|
}
|
|
1959
2013
|
}
|
|
1960
2014
|
P.create = (a, e) => new P({
|
|
1961
2015
|
shape: () => a,
|
|
1962
2016
|
unknownKeys: "strip",
|
|
1963
2017
|
catchall: G.create(),
|
|
1964
|
-
typeName:
|
|
1965
|
-
...
|
|
2018
|
+
typeName: x.ZodObject,
|
|
2019
|
+
..._(e)
|
|
1966
2020
|
});
|
|
1967
2021
|
P.strictCreate = (a, e) => new P({
|
|
1968
2022
|
shape: () => a,
|
|
1969
2023
|
unknownKeys: "strict",
|
|
1970
2024
|
catchall: G.create(),
|
|
1971
|
-
typeName:
|
|
1972
|
-
...
|
|
2025
|
+
typeName: x.ZodObject,
|
|
2026
|
+
..._(e)
|
|
1973
2027
|
});
|
|
1974
2028
|
P.lazycreate = (a, e) => new P({
|
|
1975
2029
|
shape: a,
|
|
1976
2030
|
unknownKeys: "strip",
|
|
1977
2031
|
catchall: G.create(),
|
|
1978
|
-
typeName:
|
|
1979
|
-
...
|
|
2032
|
+
typeName: x.ZodObject,
|
|
2033
|
+
..._(e)
|
|
1980
2034
|
});
|
|
1981
2035
|
class Re extends b {
|
|
1982
2036
|
_parse(e) {
|
|
@@ -2016,7 +2070,7 @@ class Re extends b {
|
|
|
2016
2070
|
{
|
|
2017
2071
|
let n;
|
|
2018
2072
|
const r = [];
|
|
2019
|
-
for (const
|
|
2073
|
+
for (const l of i) {
|
|
2020
2074
|
const c = {
|
|
2021
2075
|
...t,
|
|
2022
2076
|
common: {
|
|
@@ -2024,18 +2078,18 @@ class Re extends b {
|
|
|
2024
2078
|
issues: []
|
|
2025
2079
|
},
|
|
2026
2080
|
parent: null
|
|
2027
|
-
},
|
|
2081
|
+
}, h = l._parseSync({
|
|
2028
2082
|
data: t.data,
|
|
2029
2083
|
path: t.path,
|
|
2030
2084
|
parent: c
|
|
2031
2085
|
});
|
|
2032
|
-
if (
|
|
2033
|
-
return
|
|
2034
|
-
|
|
2086
|
+
if (h.status === "valid")
|
|
2087
|
+
return h;
|
|
2088
|
+
h.status === "dirty" && !n && (n = { result: h, ctx: c }), c.common.issues.length && r.push(c.common.issues);
|
|
2035
2089
|
}
|
|
2036
2090
|
if (n)
|
|
2037
2091
|
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
2038
|
-
const o = r.map((
|
|
2092
|
+
const o = r.map((l) => new F(l));
|
|
2039
2093
|
return d(t, {
|
|
2040
2094
|
code: u.invalid_union,
|
|
2041
2095
|
unionErrors: o
|
|
@@ -2048,11 +2102,11 @@ class Re extends b {
|
|
|
2048
2102
|
}
|
|
2049
2103
|
Re.create = (a, e) => new Re({
|
|
2050
2104
|
options: a,
|
|
2051
|
-
typeName:
|
|
2052
|
-
...
|
|
2105
|
+
typeName: x.ZodUnion,
|
|
2106
|
+
..._(e)
|
|
2053
2107
|
});
|
|
2054
|
-
const $ = (a) => a instanceof
|
|
2055
|
-
class
|
|
2108
|
+
const $ = (a) => a instanceof Ee ? $(a.schema) : a instanceof X ? $(a.innerType()) : a instanceof Me ? [a.value] : a instanceof ie ? a.options : a instanceof Fe ? C.objectValues(a.enum) : a instanceof Ne ? $(a._def.innerType) : a instanceof Pe ? [void 0] : a instanceof Ie ? [null] : a instanceof U ? [void 0, ...$(a.unwrap())] : a instanceof se ? [null, ...$(a.unwrap())] : a instanceof Mt || a instanceof Ze ? $(a.unwrap()) : a instanceof De ? $(a._def.innerType) : [];
|
|
2109
|
+
class at extends b {
|
|
2056
2110
|
_parse(e) {
|
|
2057
2111
|
const { ctx: t } = this._processInputParams(e);
|
|
2058
2112
|
if (t.parsedType !== f.object)
|
|
@@ -2105,26 +2159,26 @@ class nt extends b {
|
|
|
2105
2159
|
s.set(o, n);
|
|
2106
2160
|
}
|
|
2107
2161
|
}
|
|
2108
|
-
return new
|
|
2109
|
-
typeName:
|
|
2162
|
+
return new at({
|
|
2163
|
+
typeName: x.ZodDiscriminatedUnion,
|
|
2110
2164
|
discriminator: e,
|
|
2111
2165
|
options: t,
|
|
2112
2166
|
optionsMap: s,
|
|
2113
|
-
...
|
|
2167
|
+
..._(i)
|
|
2114
2168
|
});
|
|
2115
2169
|
}
|
|
2116
2170
|
}
|
|
2117
|
-
function
|
|
2171
|
+
function tt(a, e) {
|
|
2118
2172
|
const t = q(a), i = q(e);
|
|
2119
2173
|
if (a === e)
|
|
2120
2174
|
return { valid: !0, data: a };
|
|
2121
2175
|
if (t === f.object && i === f.object) {
|
|
2122
2176
|
const s = C.objectKeys(e), n = C.objectKeys(a).filter((o) => s.indexOf(o) !== -1), r = { ...a, ...e };
|
|
2123
2177
|
for (const o of n) {
|
|
2124
|
-
const
|
|
2125
|
-
if (!
|
|
2178
|
+
const l = tt(a[o], e[o]);
|
|
2179
|
+
if (!l.valid)
|
|
2126
2180
|
return { valid: !1 };
|
|
2127
|
-
r[o] =
|
|
2181
|
+
r[o] = l.data;
|
|
2128
2182
|
}
|
|
2129
2183
|
return { valid: !0, data: r };
|
|
2130
2184
|
} else if (t === f.array && i === f.array) {
|
|
@@ -2132,10 +2186,10 @@ function et(a, e) {
|
|
|
2132
2186
|
return { valid: !1 };
|
|
2133
2187
|
const s = [];
|
|
2134
2188
|
for (let n = 0; n < a.length; n++) {
|
|
2135
|
-
const r = a[n], o = e[n],
|
|
2136
|
-
if (!
|
|
2189
|
+
const r = a[n], o = e[n], l = tt(r, o);
|
|
2190
|
+
if (!l.valid)
|
|
2137
2191
|
return { valid: !1 };
|
|
2138
|
-
s.push(
|
|
2192
|
+
s.push(l.data);
|
|
2139
2193
|
}
|
|
2140
2194
|
return { valid: !0, data: s };
|
|
2141
2195
|
} else return t === f.date && i === f.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
|
|
@@ -2143,10 +2197,10 @@ function et(a, e) {
|
|
|
2143
2197
|
class ze extends b {
|
|
2144
2198
|
_parse(e) {
|
|
2145
2199
|
const { status: t, ctx: i } = this._processInputParams(e), s = (n, r) => {
|
|
2146
|
-
if (
|
|
2200
|
+
if (mt(n) || mt(r))
|
|
2147
2201
|
return w;
|
|
2148
|
-
const o =
|
|
2149
|
-
return o.valid ? ((
|
|
2202
|
+
const o = tt(n.value, r.value);
|
|
2203
|
+
return o.valid ? ((gt(n) || gt(r)) && t.dirty(), { status: t.value, value: o.data }) : (d(i, {
|
|
2150
2204
|
code: u.invalid_intersection_types
|
|
2151
2205
|
}), w);
|
|
2152
2206
|
};
|
|
@@ -2175,8 +2229,8 @@ class ze extends b {
|
|
|
2175
2229
|
ze.create = (a, e, t) => new ze({
|
|
2176
2230
|
left: a,
|
|
2177
2231
|
right: e,
|
|
2178
|
-
typeName:
|
|
2179
|
-
...
|
|
2232
|
+
typeName: x.ZodIntersection,
|
|
2233
|
+
..._(t)
|
|
2180
2234
|
});
|
|
2181
2235
|
class W extends b {
|
|
2182
2236
|
_parse(e) {
|
|
@@ -2203,10 +2257,10 @@ class W extends b {
|
|
|
2203
2257
|
type: "array"
|
|
2204
2258
|
}), t.dirty());
|
|
2205
2259
|
const n = [...i.data].map((r, o) => {
|
|
2206
|
-
const
|
|
2207
|
-
return
|
|
2260
|
+
const l = this._def.items[o] || this._def.rest;
|
|
2261
|
+
return l ? l._parse(new V(i, r, i.path, o)) : null;
|
|
2208
2262
|
}).filter((r) => !!r);
|
|
2209
|
-
return i.common.async ? Promise.all(n).then((r) =>
|
|
2263
|
+
return i.common.async ? Promise.all(n).then((r) => z.mergeArray(t, r)) : z.mergeArray(t, n);
|
|
2210
2264
|
}
|
|
2211
2265
|
get items() {
|
|
2212
2266
|
return this._def.items;
|
|
@@ -2223,12 +2277,12 @@ W.create = (a, e) => {
|
|
|
2223
2277
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2224
2278
|
return new W({
|
|
2225
2279
|
items: a,
|
|
2226
|
-
typeName:
|
|
2280
|
+
typeName: x.ZodTuple,
|
|
2227
2281
|
rest: null,
|
|
2228
|
-
...
|
|
2282
|
+
..._(e)
|
|
2229
2283
|
});
|
|
2230
2284
|
};
|
|
2231
|
-
class
|
|
2285
|
+
class Le extends b {
|
|
2232
2286
|
get keySchema() {
|
|
2233
2287
|
return this._def.keyType;
|
|
2234
2288
|
}
|
|
@@ -2246,30 +2300,30 @@ class Ie extends b {
|
|
|
2246
2300
|
const s = [], n = this._def.keyType, r = this._def.valueType;
|
|
2247
2301
|
for (const o in i.data)
|
|
2248
2302
|
s.push({
|
|
2249
|
-
key: n._parse(new
|
|
2250
|
-
value: r._parse(new
|
|
2303
|
+
key: n._parse(new V(i, o, i.path, o)),
|
|
2304
|
+
value: r._parse(new V(i, i.data[o], i.path, o)),
|
|
2251
2305
|
alwaysSet: o in i.data
|
|
2252
2306
|
});
|
|
2253
|
-
return i.common.async ?
|
|
2307
|
+
return i.common.async ? z.mergeObjectAsync(t, s) : z.mergeObjectSync(t, s);
|
|
2254
2308
|
}
|
|
2255
2309
|
get element() {
|
|
2256
2310
|
return this._def.valueType;
|
|
2257
2311
|
}
|
|
2258
2312
|
static create(e, t, i) {
|
|
2259
|
-
return t instanceof b ? new
|
|
2313
|
+
return t instanceof b ? new Le({
|
|
2260
2314
|
keyType: e,
|
|
2261
2315
|
valueType: t,
|
|
2262
|
-
typeName:
|
|
2263
|
-
...
|
|
2264
|
-
}) : new
|
|
2316
|
+
typeName: x.ZodRecord,
|
|
2317
|
+
..._(i)
|
|
2318
|
+
}) : new Le({
|
|
2265
2319
|
keyType: j.create(),
|
|
2266
2320
|
valueType: e,
|
|
2267
|
-
typeName:
|
|
2268
|
-
...
|
|
2321
|
+
typeName: x.ZodRecord,
|
|
2322
|
+
..._(t)
|
|
2269
2323
|
});
|
|
2270
2324
|
}
|
|
2271
2325
|
}
|
|
2272
|
-
class
|
|
2326
|
+
class it extends b {
|
|
2273
2327
|
get keySchema() {
|
|
2274
2328
|
return this._def.keyType;
|
|
2275
2329
|
}
|
|
@@ -2284,38 +2338,38 @@ class tt extends b {
|
|
|
2284
2338
|
expected: f.map,
|
|
2285
2339
|
received: i.parsedType
|
|
2286
2340
|
}), w;
|
|
2287
|
-
const s = this._def.keyType, n = this._def.valueType, r = [...i.data.entries()].map(([o,
|
|
2288
|
-
key: s._parse(new
|
|
2289
|
-
value: n._parse(new
|
|
2341
|
+
const s = this._def.keyType, n = this._def.valueType, r = [...i.data.entries()].map(([o, l], c) => ({
|
|
2342
|
+
key: s._parse(new V(i, o, i.path, [c, "key"])),
|
|
2343
|
+
value: n._parse(new V(i, l, i.path, [c, "value"]))
|
|
2290
2344
|
}));
|
|
2291
2345
|
if (i.common.async) {
|
|
2292
2346
|
const o = /* @__PURE__ */ new Map();
|
|
2293
2347
|
return Promise.resolve().then(async () => {
|
|
2294
|
-
for (const
|
|
2295
|
-
const c = await
|
|
2296
|
-
if (c.status === "aborted" ||
|
|
2348
|
+
for (const l of r) {
|
|
2349
|
+
const c = await l.key, h = await l.value;
|
|
2350
|
+
if (c.status === "aborted" || h.status === "aborted")
|
|
2297
2351
|
return w;
|
|
2298
|
-
(c.status === "dirty" ||
|
|
2352
|
+
(c.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(c.value, h.value);
|
|
2299
2353
|
}
|
|
2300
2354
|
return { status: t.value, value: o };
|
|
2301
2355
|
});
|
|
2302
2356
|
} else {
|
|
2303
2357
|
const o = /* @__PURE__ */ new Map();
|
|
2304
|
-
for (const
|
|
2305
|
-
const c =
|
|
2306
|
-
if (c.status === "aborted" ||
|
|
2358
|
+
for (const l of r) {
|
|
2359
|
+
const c = l.key, h = l.value;
|
|
2360
|
+
if (c.status === "aborted" || h.status === "aborted")
|
|
2307
2361
|
return w;
|
|
2308
|
-
(c.status === "dirty" ||
|
|
2362
|
+
(c.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(c.value, h.value);
|
|
2309
2363
|
}
|
|
2310
2364
|
return { status: t.value, value: o };
|
|
2311
2365
|
}
|
|
2312
2366
|
}
|
|
2313
2367
|
}
|
|
2314
|
-
|
|
2368
|
+
it.create = (a, e, t) => new it({
|
|
2315
2369
|
valueType: e,
|
|
2316
2370
|
keyType: a,
|
|
2317
|
-
typeName:
|
|
2318
|
-
...
|
|
2371
|
+
typeName: x.ZodMap,
|
|
2372
|
+
..._(t)
|
|
2319
2373
|
});
|
|
2320
2374
|
class ge extends b {
|
|
2321
2375
|
_parse(e) {
|
|
@@ -2343,17 +2397,17 @@ class ge extends b {
|
|
|
2343
2397
|
message: s.maxSize.message
|
|
2344
2398
|
}), t.dirty());
|
|
2345
2399
|
const n = this._def.valueType;
|
|
2346
|
-
function r(
|
|
2400
|
+
function r(l) {
|
|
2347
2401
|
const c = /* @__PURE__ */ new Set();
|
|
2348
|
-
for (const
|
|
2349
|
-
if (
|
|
2402
|
+
for (const h of l) {
|
|
2403
|
+
if (h.status === "aborted")
|
|
2350
2404
|
return w;
|
|
2351
|
-
|
|
2405
|
+
h.status === "dirty" && t.dirty(), c.add(h.value);
|
|
2352
2406
|
}
|
|
2353
2407
|
return { status: t.value, value: c };
|
|
2354
2408
|
}
|
|
2355
|
-
const o = [...i.data.values()].map((
|
|
2356
|
-
return i.common.async ? Promise.all(o).then((
|
|
2409
|
+
const o = [...i.data.values()].map((l, c) => n._parse(new V(i, l, i.path, c)));
|
|
2410
|
+
return i.common.async ? Promise.all(o).then((l) => r(l)) : r(o);
|
|
2357
2411
|
}
|
|
2358
2412
|
min(e, t) {
|
|
2359
2413
|
return new ge({
|
|
@@ -2378,8 +2432,8 @@ ge.create = (a, e) => new ge({
|
|
|
2378
2432
|
valueType: a,
|
|
2379
2433
|
minSize: null,
|
|
2380
2434
|
maxSize: null,
|
|
2381
|
-
typeName:
|
|
2382
|
-
...
|
|
2435
|
+
typeName: x.ZodSet,
|
|
2436
|
+
..._(e)
|
|
2383
2437
|
});
|
|
2384
2438
|
class we extends b {
|
|
2385
2439
|
constructor() {
|
|
@@ -2393,58 +2447,58 @@ class we extends b {
|
|
|
2393
2447
|
expected: f.function,
|
|
2394
2448
|
received: t.parsedType
|
|
2395
2449
|
}), w;
|
|
2396
|
-
function i(o,
|
|
2397
|
-
return
|
|
2450
|
+
function i(o, l) {
|
|
2451
|
+
return qe({
|
|
2398
2452
|
data: o,
|
|
2399
2453
|
path: t.path,
|
|
2400
2454
|
errorMaps: [
|
|
2401
2455
|
t.common.contextualErrorMap,
|
|
2402
2456
|
t.schemaErrorMap,
|
|
2403
2457
|
Ye(),
|
|
2404
|
-
|
|
2458
|
+
ke
|
|
2405
2459
|
].filter((c) => !!c),
|
|
2406
2460
|
issueData: {
|
|
2407
2461
|
code: u.invalid_arguments,
|
|
2408
|
-
argumentsError:
|
|
2462
|
+
argumentsError: l
|
|
2409
2463
|
}
|
|
2410
2464
|
});
|
|
2411
2465
|
}
|
|
2412
|
-
function s(o,
|
|
2413
|
-
return
|
|
2466
|
+
function s(o, l) {
|
|
2467
|
+
return qe({
|
|
2414
2468
|
data: o,
|
|
2415
2469
|
path: t.path,
|
|
2416
2470
|
errorMaps: [
|
|
2417
2471
|
t.common.contextualErrorMap,
|
|
2418
2472
|
t.schemaErrorMap,
|
|
2419
2473
|
Ye(),
|
|
2420
|
-
|
|
2474
|
+
ke
|
|
2421
2475
|
].filter((c) => !!c),
|
|
2422
2476
|
issueData: {
|
|
2423
2477
|
code: u.invalid_return_type,
|
|
2424
|
-
returnTypeError:
|
|
2478
|
+
returnTypeError: l
|
|
2425
2479
|
}
|
|
2426
2480
|
});
|
|
2427
2481
|
}
|
|
2428
2482
|
const n = { errorMap: t.common.contextualErrorMap }, r = t.data;
|
|
2429
2483
|
if (this._def.returns instanceof Ce) {
|
|
2430
2484
|
const o = this;
|
|
2431
|
-
return M(async function(...
|
|
2432
|
-
const c = new F([]),
|
|
2433
|
-
throw c.addIssue(i(
|
|
2434
|
-
}), g = await Reflect.apply(r, this,
|
|
2435
|
-
return await o._def.returns._def.type.parseAsync(g, n).catch((
|
|
2436
|
-
throw c.addIssue(s(g,
|
|
2485
|
+
return M(async function(...l) {
|
|
2486
|
+
const c = new F([]), h = await o._def.args.parseAsync(l, n).catch((k) => {
|
|
2487
|
+
throw c.addIssue(i(l, k)), c;
|
|
2488
|
+
}), g = await Reflect.apply(r, this, h);
|
|
2489
|
+
return await o._def.returns._def.type.parseAsync(g, n).catch((k) => {
|
|
2490
|
+
throw c.addIssue(s(g, k)), c;
|
|
2437
2491
|
});
|
|
2438
2492
|
});
|
|
2439
2493
|
} else {
|
|
2440
2494
|
const o = this;
|
|
2441
|
-
return M(function(...
|
|
2442
|
-
const c = o._def.args.safeParse(
|
|
2495
|
+
return M(function(...l) {
|
|
2496
|
+
const c = o._def.args.safeParse(l, n);
|
|
2443
2497
|
if (!c.success)
|
|
2444
|
-
throw new F([i(
|
|
2445
|
-
const
|
|
2498
|
+
throw new F([i(l, c.error)]);
|
|
2499
|
+
const h = Reflect.apply(r, this, c.data), g = o._def.returns.safeParse(h, n);
|
|
2446
2500
|
if (!g.success)
|
|
2447
|
-
throw new F([s(
|
|
2501
|
+
throw new F([s(h, g.error)]);
|
|
2448
2502
|
return g.data;
|
|
2449
2503
|
});
|
|
2450
2504
|
}
|
|
@@ -2477,12 +2531,12 @@ class we extends b {
|
|
|
2477
2531
|
return new we({
|
|
2478
2532
|
args: e || W.create([]).rest(ue.create()),
|
|
2479
2533
|
returns: t || ue.create(),
|
|
2480
|
-
typeName:
|
|
2481
|
-
...
|
|
2534
|
+
typeName: x.ZodFunction,
|
|
2535
|
+
..._(i)
|
|
2482
2536
|
});
|
|
2483
2537
|
}
|
|
2484
2538
|
}
|
|
2485
|
-
class
|
|
2539
|
+
class Ee extends b {
|
|
2486
2540
|
get schema() {
|
|
2487
2541
|
return this._def.getter();
|
|
2488
2542
|
}
|
|
@@ -2491,12 +2545,12 @@ class Le extends b {
|
|
|
2491
2545
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2492
2546
|
}
|
|
2493
2547
|
}
|
|
2494
|
-
|
|
2548
|
+
Ee.create = (a, e) => new Ee({
|
|
2495
2549
|
getter: a,
|
|
2496
|
-
typeName:
|
|
2497
|
-
...
|
|
2550
|
+
typeName: x.ZodLazy,
|
|
2551
|
+
..._(e)
|
|
2498
2552
|
});
|
|
2499
|
-
class
|
|
2553
|
+
class Me extends b {
|
|
2500
2554
|
_parse(e) {
|
|
2501
2555
|
if (e.data !== this._def.value) {
|
|
2502
2556
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2512,16 +2566,16 @@ class Ee extends b {
|
|
|
2512
2566
|
return this._def.value;
|
|
2513
2567
|
}
|
|
2514
2568
|
}
|
|
2515
|
-
|
|
2569
|
+
Me.create = (a, e) => new Me({
|
|
2516
2570
|
value: a,
|
|
2517
|
-
typeName:
|
|
2518
|
-
...
|
|
2571
|
+
typeName: x.ZodLiteral,
|
|
2572
|
+
..._(e)
|
|
2519
2573
|
});
|
|
2520
|
-
function
|
|
2574
|
+
function Et(a, e) {
|
|
2521
2575
|
return new ie({
|
|
2522
2576
|
values: a,
|
|
2523
|
-
typeName:
|
|
2524
|
-
...
|
|
2577
|
+
typeName: x.ZodEnum,
|
|
2578
|
+
..._(e)
|
|
2525
2579
|
});
|
|
2526
2580
|
}
|
|
2527
2581
|
class ie extends b {
|
|
@@ -2537,7 +2591,7 @@ class ie extends b {
|
|
|
2537
2591
|
code: u.invalid_type
|
|
2538
2592
|
}), w;
|
|
2539
2593
|
}
|
|
2540
|
-
if (
|
|
2594
|
+
if (Ae(this, ve) || Rt(this, ve, new Set(this._def.values)), !Ae(this, ve).has(e.data)) {
|
|
2541
2595
|
const t = this._getOrReturnCtx(e), i = this._def.values;
|
|
2542
2596
|
return d(t, {
|
|
2543
2597
|
received: t.data,
|
|
@@ -2582,8 +2636,8 @@ class ie extends b {
|
|
|
2582
2636
|
}
|
|
2583
2637
|
}
|
|
2584
2638
|
ve = /* @__PURE__ */ new WeakMap();
|
|
2585
|
-
ie.create =
|
|
2586
|
-
class
|
|
2639
|
+
ie.create = Et;
|
|
2640
|
+
class Fe extends b {
|
|
2587
2641
|
constructor() {
|
|
2588
2642
|
super(...arguments), xe.set(this, void 0);
|
|
2589
2643
|
}
|
|
@@ -2597,7 +2651,7 @@ class Me extends b {
|
|
|
2597
2651
|
code: u.invalid_type
|
|
2598
2652
|
}), w;
|
|
2599
2653
|
}
|
|
2600
|
-
if (
|
|
2654
|
+
if (Ae(this, xe) || Rt(this, xe, new Set(C.getValidEnumValues(this._def.values))), !Ae(this, xe).has(e.data)) {
|
|
2601
2655
|
const s = C.objectValues(t);
|
|
2602
2656
|
return d(i, {
|
|
2603
2657
|
received: i.data,
|
|
@@ -2612,10 +2666,10 @@ class Me extends b {
|
|
|
2612
2666
|
}
|
|
2613
2667
|
}
|
|
2614
2668
|
xe = /* @__PURE__ */ new WeakMap();
|
|
2615
|
-
|
|
2669
|
+
Fe.create = (a, e) => new Fe({
|
|
2616
2670
|
values: a,
|
|
2617
|
-
typeName:
|
|
2618
|
-
...
|
|
2671
|
+
typeName: x.ZodNativeEnum,
|
|
2672
|
+
..._(e)
|
|
2619
2673
|
});
|
|
2620
2674
|
class Ce extends b {
|
|
2621
2675
|
unwrap() {
|
|
@@ -2638,15 +2692,15 @@ class Ce extends b {
|
|
|
2638
2692
|
}
|
|
2639
2693
|
Ce.create = (a, e) => new Ce({
|
|
2640
2694
|
type: a,
|
|
2641
|
-
typeName:
|
|
2642
|
-
...
|
|
2695
|
+
typeName: x.ZodPromise,
|
|
2696
|
+
..._(e)
|
|
2643
2697
|
});
|
|
2644
|
-
class
|
|
2698
|
+
class X extends b {
|
|
2645
2699
|
innerType() {
|
|
2646
2700
|
return this._def.schema;
|
|
2647
2701
|
}
|
|
2648
2702
|
sourceType() {
|
|
2649
|
-
return this._def.schema._def.typeName ===
|
|
2703
|
+
return this._def.schema._def.typeName === x.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2650
2704
|
}
|
|
2651
2705
|
_parse(e) {
|
|
2652
2706
|
const { status: t, ctx: i } = this._processInputParams(e), s = this._def.effect || null, n = {
|
|
@@ -2663,12 +2717,12 @@ class Y extends b {
|
|
|
2663
2717
|
return Promise.resolve(r).then(async (o) => {
|
|
2664
2718
|
if (t.value === "aborted")
|
|
2665
2719
|
return w;
|
|
2666
|
-
const
|
|
2720
|
+
const l = await this._def.schema._parseAsync({
|
|
2667
2721
|
data: o,
|
|
2668
2722
|
path: i.path,
|
|
2669
2723
|
parent: i
|
|
2670
2724
|
});
|
|
2671
|
-
return
|
|
2725
|
+
return l.status === "aborted" ? w : l.status === "dirty" || t.value === "dirty" ? ye(l.value) : l;
|
|
2672
2726
|
});
|
|
2673
2727
|
{
|
|
2674
2728
|
if (t.value === "aborted")
|
|
@@ -2683,10 +2737,10 @@ class Y extends b {
|
|
|
2683
2737
|
}
|
|
2684
2738
|
if (s.type === "refinement") {
|
|
2685
2739
|
const r = (o) => {
|
|
2686
|
-
const
|
|
2740
|
+
const l = s.refinement(o, n);
|
|
2687
2741
|
if (i.common.async)
|
|
2688
|
-
return Promise.resolve(
|
|
2689
|
-
if (
|
|
2742
|
+
return Promise.resolve(l);
|
|
2743
|
+
if (l instanceof Promise)
|
|
2690
2744
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2691
2745
|
return o;
|
|
2692
2746
|
};
|
|
@@ -2718,17 +2772,17 @@ class Y extends b {
|
|
|
2718
2772
|
C.assertNever(s);
|
|
2719
2773
|
}
|
|
2720
2774
|
}
|
|
2721
|
-
|
|
2775
|
+
X.create = (a, e, t) => new X({
|
|
2722
2776
|
schema: a,
|
|
2723
|
-
typeName:
|
|
2777
|
+
typeName: x.ZodEffects,
|
|
2724
2778
|
effect: e,
|
|
2725
|
-
...
|
|
2779
|
+
..._(t)
|
|
2726
2780
|
});
|
|
2727
|
-
|
|
2781
|
+
X.createWithPreprocess = (a, e, t) => new X({
|
|
2728
2782
|
schema: e,
|
|
2729
2783
|
effect: { type: "preprocess", transform: a },
|
|
2730
|
-
typeName:
|
|
2731
|
-
...
|
|
2784
|
+
typeName: x.ZodEffects,
|
|
2785
|
+
..._(t)
|
|
2732
2786
|
});
|
|
2733
2787
|
class U extends b {
|
|
2734
2788
|
_parse(e) {
|
|
@@ -2740,8 +2794,8 @@ class U extends b {
|
|
|
2740
2794
|
}
|
|
2741
2795
|
U.create = (a, e) => new U({
|
|
2742
2796
|
innerType: a,
|
|
2743
|
-
typeName:
|
|
2744
|
-
...
|
|
2797
|
+
typeName: x.ZodOptional,
|
|
2798
|
+
..._(e)
|
|
2745
2799
|
});
|
|
2746
2800
|
class se extends b {
|
|
2747
2801
|
_parse(e) {
|
|
@@ -2753,10 +2807,10 @@ class se extends b {
|
|
|
2753
2807
|
}
|
|
2754
2808
|
se.create = (a, e) => new se({
|
|
2755
2809
|
innerType: a,
|
|
2756
|
-
typeName:
|
|
2757
|
-
...
|
|
2810
|
+
typeName: x.ZodNullable,
|
|
2811
|
+
..._(e)
|
|
2758
2812
|
});
|
|
2759
|
-
class
|
|
2813
|
+
class Ne extends b {
|
|
2760
2814
|
_parse(e) {
|
|
2761
2815
|
const { ctx: t } = this._processInputParams(e);
|
|
2762
2816
|
let i = t.data;
|
|
@@ -2770,13 +2824,13 @@ class Fe extends b {
|
|
|
2770
2824
|
return this._def.innerType;
|
|
2771
2825
|
}
|
|
2772
2826
|
}
|
|
2773
|
-
|
|
2827
|
+
Ne.create = (a, e) => new Ne({
|
|
2774
2828
|
innerType: a,
|
|
2775
|
-
typeName:
|
|
2829
|
+
typeName: x.ZodDefault,
|
|
2776
2830
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2777
|
-
...
|
|
2831
|
+
..._(e)
|
|
2778
2832
|
});
|
|
2779
|
-
class
|
|
2833
|
+
class De extends b {
|
|
2780
2834
|
_parse(e) {
|
|
2781
2835
|
const { ctx: t } = this._processInputParams(e), i = {
|
|
2782
2836
|
...t,
|
|
@@ -2791,7 +2845,7 @@ class Ne extends b {
|
|
|
2791
2845
|
...i
|
|
2792
2846
|
}
|
|
2793
2847
|
});
|
|
2794
|
-
return
|
|
2848
|
+
return Oe(s) ? s.then((n) => ({
|
|
2795
2849
|
status: "valid",
|
|
2796
2850
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2797
2851
|
get error() {
|
|
@@ -2813,13 +2867,13 @@ class Ne extends b {
|
|
|
2813
2867
|
return this._def.innerType;
|
|
2814
2868
|
}
|
|
2815
2869
|
}
|
|
2816
|
-
|
|
2870
|
+
De.create = (a, e) => new De({
|
|
2817
2871
|
innerType: a,
|
|
2818
|
-
typeName:
|
|
2872
|
+
typeName: x.ZodCatch,
|
|
2819
2873
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2820
|
-
...
|
|
2874
|
+
..._(e)
|
|
2821
2875
|
});
|
|
2822
|
-
class
|
|
2876
|
+
class st extends b {
|
|
2823
2877
|
_parse(e) {
|
|
2824
2878
|
if (this._getType(e) !== f.nan) {
|
|
2825
2879
|
const i = this._getOrReturnCtx(e);
|
|
@@ -2832,11 +2886,11 @@ class it extends b {
|
|
|
2832
2886
|
return { status: "valid", value: e.data };
|
|
2833
2887
|
}
|
|
2834
2888
|
}
|
|
2835
|
-
|
|
2836
|
-
typeName:
|
|
2837
|
-
...
|
|
2889
|
+
st.create = (a) => new st({
|
|
2890
|
+
typeName: x.ZodNaN,
|
|
2891
|
+
..._(a)
|
|
2838
2892
|
});
|
|
2839
|
-
class
|
|
2893
|
+
class Mt extends b {
|
|
2840
2894
|
_parse(e) {
|
|
2841
2895
|
const { ctx: t } = this._processInputParams(e), i = t.data;
|
|
2842
2896
|
return this._def.type._parse({
|
|
@@ -2885,60 +2939,60 @@ class Ke extends b {
|
|
|
2885
2939
|
return new Ke({
|
|
2886
2940
|
in: e,
|
|
2887
2941
|
out: t,
|
|
2888
|
-
typeName:
|
|
2942
|
+
typeName: x.ZodPipeline
|
|
2889
2943
|
});
|
|
2890
2944
|
}
|
|
2891
2945
|
}
|
|
2892
|
-
class
|
|
2946
|
+
class Ze extends b {
|
|
2893
2947
|
_parse(e) {
|
|
2894
2948
|
const t = this._def.innerType._parse(e), i = (s) => (fe(s) && (s.value = Object.freeze(s.value)), s);
|
|
2895
|
-
return
|
|
2949
|
+
return Oe(t) ? t.then((s) => i(s)) : i(t);
|
|
2896
2950
|
}
|
|
2897
2951
|
unwrap() {
|
|
2898
2952
|
return this._def.innerType;
|
|
2899
2953
|
}
|
|
2900
2954
|
}
|
|
2901
|
-
|
|
2955
|
+
Ze.create = (a, e) => new Ze({
|
|
2902
2956
|
innerType: a,
|
|
2903
|
-
typeName:
|
|
2904
|
-
...
|
|
2957
|
+
typeName: x.ZodReadonly,
|
|
2958
|
+
..._(e)
|
|
2905
2959
|
});
|
|
2906
2960
|
P.lazycreate;
|
|
2907
|
-
var
|
|
2961
|
+
var x;
|
|
2908
2962
|
(function(a) {
|
|
2909
2963
|
a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
|
|
2910
|
-
})(
|
|
2964
|
+
})(x || (x = {}));
|
|
2911
2965
|
const L = j.create, y = pe.create;
|
|
2912
|
-
|
|
2966
|
+
st.create;
|
|
2913
2967
|
me.create;
|
|
2914
|
-
qe.create;
|
|
2915
|
-
be.create;
|
|
2916
2968
|
Ge.create;
|
|
2917
|
-
|
|
2918
|
-
Pe.create;
|
|
2969
|
+
be.create;
|
|
2919
2970
|
Qe.create;
|
|
2971
|
+
Pe.create;
|
|
2972
|
+
Ie.create;
|
|
2973
|
+
Je.create;
|
|
2920
2974
|
ue.create;
|
|
2921
2975
|
G.create;
|
|
2922
|
-
|
|
2976
|
+
et.create;
|
|
2923
2977
|
Z.create;
|
|
2924
2978
|
const O = P.create;
|
|
2925
2979
|
P.strictCreate;
|
|
2926
2980
|
const vi = Re.create;
|
|
2927
|
-
|
|
2981
|
+
at.create;
|
|
2928
2982
|
ze.create;
|
|
2929
2983
|
W.create;
|
|
2930
|
-
|
|
2931
|
-
|
|
2984
|
+
Le.create;
|
|
2985
|
+
it.create;
|
|
2932
2986
|
ge.create;
|
|
2933
2987
|
we.create;
|
|
2934
|
-
|
|
2935
|
-
const ne =
|
|
2936
|
-
|
|
2988
|
+
Ee.create;
|
|
2989
|
+
const ne = Me.create, Q = ie.create;
|
|
2990
|
+
Fe.create;
|
|
2937
2991
|
Ce.create;
|
|
2938
|
-
|
|
2992
|
+
X.create;
|
|
2939
2993
|
U.create;
|
|
2940
2994
|
se.create;
|
|
2941
|
-
|
|
2995
|
+
X.createWithPreprocess;
|
|
2942
2996
|
Ke.create;
|
|
2943
2997
|
const xi = Q(["linear", "bezier", "constant"]), wi = Q([
|
|
2944
2998
|
"ease",
|
|
@@ -2976,15 +3030,15 @@ const xi = Q(["linear", "bezier", "constant"]), wi = Q([
|
|
|
2976
3030
|
length: y().positive(),
|
|
2977
3031
|
interpolation: xi.optional(),
|
|
2978
3032
|
easing: wi.optional()
|
|
2979
|
-
}),
|
|
3033
|
+
}), _i = L().url("Invalid audio url format."), ki = ae.extend({
|
|
2980
3034
|
from: y().min(0).max(1),
|
|
2981
3035
|
to: y().min(0).max(1)
|
|
2982
|
-
}).array().or(y().min(0).max(1)),
|
|
3036
|
+
}).array().or(y().min(0).max(1)), vt = O({
|
|
2983
3037
|
type: ne("audio"),
|
|
2984
|
-
src:
|
|
3038
|
+
src: _i,
|
|
2985
3039
|
trim: y().optional(),
|
|
2986
|
-
volume:
|
|
2987
|
-
}), bi = Q(["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"]),
|
|
3040
|
+
volume: ki.optional()
|
|
3041
|
+
}), bi = Q(["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"]), xt = O({
|
|
2988
3042
|
type: ne("html"),
|
|
2989
3043
|
html: L(),
|
|
2990
3044
|
css: L(),
|
|
@@ -2996,28 +3050,28 @@ const xi = Q(["linear", "bezier", "constant"]), wi = Q([
|
|
|
2996
3050
|
right: y().min(0).optional(),
|
|
2997
3051
|
bottom: y().min(0).optional(),
|
|
2998
3052
|
left: y().min(0).optional()
|
|
2999
|
-
}),
|
|
3053
|
+
}), wt = O({
|
|
3000
3054
|
type: ne("image"),
|
|
3001
3055
|
src: Ci,
|
|
3002
3056
|
crop: Si.optional()
|
|
3003
|
-
}), Ti = L().url("Invalid luma url format."),
|
|
3057
|
+
}), Ti = L().url("Invalid luma url format."), _t = O({
|
|
3004
3058
|
type: ne("luma"),
|
|
3005
3059
|
src: Ti
|
|
3006
|
-
}),
|
|
3060
|
+
}), Ft = L().regex(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|transparent$/, "Invalid color format."), kt = O({
|
|
3007
3061
|
width: y().positive(),
|
|
3008
3062
|
height: y().positive()
|
|
3009
|
-
}), _t = O({
|
|
3010
|
-
radius: y().positive()
|
|
3011
3063
|
}), bt = O({
|
|
3064
|
+
radius: y().positive()
|
|
3065
|
+
}), Ct = O({
|
|
3012
3066
|
length: y().positive(),
|
|
3013
3067
|
thickness: y().positive()
|
|
3014
3068
|
}), Oi = O({
|
|
3015
|
-
color:
|
|
3069
|
+
color: Ft,
|
|
3016
3070
|
opacity: y().min(0).max(1)
|
|
3017
3071
|
}), Ai = O({
|
|
3018
|
-
color:
|
|
3072
|
+
color: Ft,
|
|
3019
3073
|
width: y().positive()
|
|
3020
|
-
}),
|
|
3074
|
+
}), St = O({
|
|
3021
3075
|
type: ne("shape"),
|
|
3022
3076
|
width: y().positive().optional(),
|
|
3023
3077
|
height: y().positive().optional(),
|
|
@@ -3025,32 +3079,32 @@ const xi = Q(["linear", "bezier", "constant"]), wi = Q([
|
|
|
3025
3079
|
fill: Oi.optional(),
|
|
3026
3080
|
stroke: Ai.optional(),
|
|
3027
3081
|
rectangle: kt.optional(),
|
|
3028
|
-
circle:
|
|
3029
|
-
line:
|
|
3030
|
-
}).refine((a) => a.shape === "rectangle" ? kt.safeParse(a.rectangle) : a.shape === "circle" ?
|
|
3031
|
-
color:
|
|
3082
|
+
circle: bt.optional(),
|
|
3083
|
+
line: Ct.optional()
|
|
3084
|
+
}).refine((a) => a.shape === "rectangle" ? kt.safeParse(a.rectangle) : a.shape === "circle" ? bt.safeParse(a.circle) : a.shape === "line" ? Ct.safeParse(a.line) : !1), rt = L().regex(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|transparent$/, "Invalid color format."), Pi = O({
|
|
3085
|
+
color: rt.optional(),
|
|
3032
3086
|
family: L().optional(),
|
|
3033
3087
|
size: y().positive().optional(),
|
|
3034
3088
|
weight: y().optional(),
|
|
3035
3089
|
lineHeight: y().optional()
|
|
3036
|
-
}),
|
|
3090
|
+
}), Ii = O({
|
|
3037
3091
|
horizontal: Q(["left", "center", "right"]).optional(),
|
|
3038
3092
|
vertical: Q(["top", "center", "bottom"]).optional()
|
|
3039
|
-
}),
|
|
3040
|
-
color:
|
|
3093
|
+
}), Ri = O({
|
|
3094
|
+
color: rt,
|
|
3041
3095
|
opacity: y().min(0).max(1)
|
|
3042
|
-
}),
|
|
3096
|
+
}), zi = O({
|
|
3043
3097
|
width: y().positive(),
|
|
3044
|
-
color:
|
|
3045
|
-
}),
|
|
3098
|
+
color: rt
|
|
3099
|
+
}), Tt = O({
|
|
3046
3100
|
type: ne("text"),
|
|
3047
3101
|
text: L(),
|
|
3048
3102
|
width: y().positive().optional(),
|
|
3049
3103
|
height: y().positive().optional(),
|
|
3050
3104
|
font: Pi.optional(),
|
|
3051
|
-
alignment:
|
|
3052
|
-
background:
|
|
3053
|
-
stroke:
|
|
3105
|
+
alignment: Ii.optional(),
|
|
3106
|
+
background: Ri.optional(),
|
|
3107
|
+
stroke: zi.optional()
|
|
3054
3108
|
}), Li = L().url("Invalid video url format."), Ei = O({
|
|
3055
3109
|
top: y().min(0).optional(),
|
|
3056
3110
|
right: y().min(0).optional(),
|
|
@@ -3059,25 +3113,25 @@ const xi = Q(["linear", "bezier", "constant"]), wi = Q([
|
|
|
3059
3113
|
}), Mi = ae.extend({
|
|
3060
3114
|
from: y().min(0).max(1),
|
|
3061
3115
|
to: y().min(0).max(1)
|
|
3062
|
-
}).array().or(y().min(0).max(1)),
|
|
3116
|
+
}).array().or(y().min(0).max(1)), Ot = O({
|
|
3063
3117
|
type: ne("video"),
|
|
3064
3118
|
src: Li,
|
|
3065
3119
|
trim: y().optional(),
|
|
3066
3120
|
crop: Ei.optional(),
|
|
3067
3121
|
volume: Mi.optional()
|
|
3068
|
-
}), Fi = vi([
|
|
3122
|
+
}), Fi = vi([Tt, St, xt, wt, Ot, _t, vt]).refine((a) => a.type === "text" ? Tt.safeParse(a) : a.type === "shape" ? St.safeParse(a) : a.type === "html" ? xt.safeParse(a) : a.type === "image" ? wt.safeParse(a) : a.type === "video" ? Ot.safeParse(a) : a.type === "luma" ? _t.safeParse(a) : a.type === "audio" ? vt.safeParse(a) : !1), Ni = Q(["topLeft", "top", "topRight", "left", "center", "right", "bottomLeft", "bottom", "bottomRight"]), Di = Q(["crop", "cover", "contain", "none"]), de = y().min(-10).max(10).default(0), Zi = ae.extend({
|
|
3069
3123
|
from: de,
|
|
3070
3124
|
to: de
|
|
3071
|
-
}).array().or(de),
|
|
3125
|
+
}).array().or(de), Vi = ae.extend({
|
|
3072
3126
|
from: de,
|
|
3073
3127
|
to: de
|
|
3074
|
-
}).array().or(de),
|
|
3128
|
+
}).array().or(de), Ki = O({
|
|
3075
3129
|
x: Zi.default(0),
|
|
3076
|
-
y:
|
|
3077
|
-
}),
|
|
3130
|
+
y: Vi.default(0)
|
|
3131
|
+
}), Hi = ae.extend({
|
|
3078
3132
|
from: y().min(0).max(1),
|
|
3079
3133
|
to: y().min(0).max(1)
|
|
3080
|
-
}).array().or(y().min(0).max(1)),
|
|
3134
|
+
}).array().or(y().min(0).max(1)), Bi = ae.extend({
|
|
3081
3135
|
from: y().min(0),
|
|
3082
3136
|
to: y().min(0)
|
|
3083
3137
|
}).array().or(y().min(0)), $i = O({
|
|
@@ -3085,31 +3139,31 @@ const xi = Q(["linear", "bezier", "constant"]), wi = Q([
|
|
|
3085
3139
|
from: y(),
|
|
3086
3140
|
to: y()
|
|
3087
3141
|
}).array().or(y())
|
|
3088
|
-
}), ji = L(),
|
|
3089
|
-
in:
|
|
3090
|
-
out:
|
|
3142
|
+
}), ji = L(), At = L(), Ui = O({
|
|
3143
|
+
in: At.optional(),
|
|
3144
|
+
out: At.optional()
|
|
3091
3145
|
}), Wi = O({
|
|
3092
3146
|
rotate: $i.default({ angle: 0 })
|
|
3093
|
-
}),
|
|
3147
|
+
}), Nt = O({
|
|
3094
3148
|
asset: Fi,
|
|
3095
3149
|
start: y().min(0),
|
|
3096
3150
|
length: y().positive(),
|
|
3097
3151
|
position: Ni.default("center").optional(),
|
|
3098
3152
|
fit: Di.default("crop").optional(),
|
|
3099
|
-
offset:
|
|
3100
|
-
opacity:
|
|
3101
|
-
scale:
|
|
3153
|
+
offset: Ki.default({ x: 0, y: 0 }).optional(),
|
|
3154
|
+
opacity: Hi.default(1).optional(),
|
|
3155
|
+
scale: Bi.default(1).optional(),
|
|
3102
3156
|
transform: Wi.default({ rotate: { angle: 0 } }).optional(),
|
|
3103
3157
|
effect: ji.optional(),
|
|
3104
3158
|
transition: Ui.optional()
|
|
3105
|
-
}),
|
|
3106
|
-
clips:
|
|
3107
|
-
}),
|
|
3108
|
-
src:
|
|
3159
|
+
}), Xi = O({
|
|
3160
|
+
clips: Nt.array()
|
|
3161
|
+
}), Yi = L().url("Invalid image url format."), qi = O({
|
|
3162
|
+
src: Yi
|
|
3109
3163
|
}), Gi = O({
|
|
3110
3164
|
background: L().optional(),
|
|
3111
3165
|
fonts: qi.array().optional(),
|
|
3112
|
-
tracks:
|
|
3166
|
+
tracks: Xi.array()
|
|
3113
3167
|
}), Qi = O({
|
|
3114
3168
|
size: O({
|
|
3115
3169
|
width: y().positive(),
|
|
@@ -3243,11 +3297,11 @@ class es {
|
|
|
3243
3297
|
};
|
|
3244
3298
|
}
|
|
3245
3299
|
getValue(e, t, i, s) {
|
|
3246
|
-
const n = this.curves[s ?? ""] ?? this.curves.ease, [[r, o], [
|
|
3247
|
-
return N ** 3 * g + 3 * N ** 2 * S * p + 3 * N * S ** 2 *
|
|
3300
|
+
const n = this.curves[s ?? ""] ?? this.curves.ease, [[r, o], [l, c]] = n, h = i + (3 * r - 3 * l + 1) * i * (1 - i), g = e, p = e + (t - e) * o, k = e + (t - e) * c, A = t, S = h, N = 1 - S;
|
|
3301
|
+
return N ** 3 * g + 3 * N ** 2 * S * p + 3 * N * S ** 2 * k + S ** 3 * A;
|
|
3248
3302
|
}
|
|
3249
3303
|
}
|
|
3250
|
-
class
|
|
3304
|
+
class R {
|
|
3251
3305
|
property;
|
|
3252
3306
|
length;
|
|
3253
3307
|
cubicBuilder;
|
|
@@ -3307,8 +3361,8 @@ class z {
|
|
|
3307
3361
|
for (let n = 0; n < e.length; n += 1) {
|
|
3308
3362
|
const r = e[n], o = e[n + 1];
|
|
3309
3363
|
if (n === 0 && r.start !== 0) {
|
|
3310
|
-
const
|
|
3311
|
-
s.push(
|
|
3364
|
+
const h = { start: 0, length: r.start, from: i, to: r.from };
|
|
3365
|
+
s.push(h);
|
|
3312
3366
|
}
|
|
3313
3367
|
if (s.push(r), !o) {
|
|
3314
3368
|
if (r.start + r.length < t) {
|
|
@@ -3318,8 +3372,8 @@ class z {
|
|
|
3318
3372
|
break;
|
|
3319
3373
|
}
|
|
3320
3374
|
if (r.start + r.length !== o.start) {
|
|
3321
|
-
const
|
|
3322
|
-
s.push(
|
|
3375
|
+
const h = { start: r.start + r.length, length: o.start, from: r.to, to: o.from };
|
|
3376
|
+
s.push(h);
|
|
3323
3377
|
}
|
|
3324
3378
|
}
|
|
3325
3379
|
return s;
|
|
@@ -3332,8 +3386,8 @@ class He {
|
|
|
3332
3386
|
validAudioExtensions;
|
|
3333
3387
|
constructor() {
|
|
3334
3388
|
this.name = He.Name, this.extension = {
|
|
3335
|
-
type: [
|
|
3336
|
-
priority:
|
|
3389
|
+
type: [v.ExtensionType.LoadParser],
|
|
3390
|
+
priority: v.LoaderParserPriority.Normal,
|
|
3337
3391
|
ref: null
|
|
3338
3392
|
}, this.validAudioExtensions = ["mp3", "mpeg", "ogg", "wav"];
|
|
3339
3393
|
}
|
|
@@ -3357,63 +3411,63 @@ class ts {
|
|
|
3357
3411
|
this.clipConfiguration = e;
|
|
3358
3412
|
}
|
|
3359
3413
|
build(e, t) {
|
|
3360
|
-
const i = [], s = [], n = [], r = [], o = [], { effect:
|
|
3361
|
-
if (!
|
|
3414
|
+
const i = [], s = [], n = [], r = [], o = [], { effect: l, length: c } = this.clipConfiguration;
|
|
3415
|
+
if (!l)
|
|
3362
3416
|
return { offsetXKeyframes: i, offsetYKeyframes: s, opacityKeyframes: n, scaleKeyframes: r, rotationKeyframes: o };
|
|
3363
|
-
const
|
|
3417
|
+
const h = 0;
|
|
3364
3418
|
switch (this.getPresetName()) {
|
|
3365
3419
|
case "zoomIn": {
|
|
3366
|
-
const p = this.getZoomSpeed(),
|
|
3367
|
-
r.push({ from:
|
|
3420
|
+
const p = this.getZoomSpeed(), k = 1 * this.clipConfiguration.scale, A = p * this.clipConfiguration.scale;
|
|
3421
|
+
r.push({ from: k, to: A, start: h, length: c, interpolation: "linear" });
|
|
3368
3422
|
break;
|
|
3369
3423
|
}
|
|
3370
3424
|
case "zoomOut": {
|
|
3371
|
-
const
|
|
3372
|
-
r.push({ from:
|
|
3425
|
+
const k = this.getZoomSpeed() * this.clipConfiguration.scale, A = 1 * this.clipConfiguration.scale;
|
|
3426
|
+
r.push({ from: k, to: A, start: h, length: c, interpolation: "linear" });
|
|
3373
3427
|
break;
|
|
3374
3428
|
}
|
|
3375
3429
|
case "slideLeft": {
|
|
3376
3430
|
let p = this.getSlideStart();
|
|
3377
|
-
const
|
|
3378
|
-
if (A <
|
|
3379
|
-
const S = Math.abs(
|
|
3380
|
-
r.push({ from: S, to: S, start:
|
|
3431
|
+
const k = e.width + e.width * p * 2, A = t.height / t.width * e.height;
|
|
3432
|
+
if (A < k) {
|
|
3433
|
+
const S = Math.abs(k / e.width);
|
|
3434
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3381
3435
|
} else
|
|
3382
3436
|
p = (A - e.width) / 2 / e.width;
|
|
3383
|
-
i.push({ from: p, to: -p, start:
|
|
3437
|
+
i.push({ from: p, to: -p, start: h, length: c });
|
|
3384
3438
|
break;
|
|
3385
3439
|
}
|
|
3386
3440
|
case "slideRight": {
|
|
3387
3441
|
let p = this.getSlideStart();
|
|
3388
|
-
const
|
|
3389
|
-
if (A <
|
|
3390
|
-
const S = Math.abs(
|
|
3391
|
-
r.push({ from: S, to: S, start:
|
|
3442
|
+
const k = e.width + e.width * p * 2, A = t.height / t.width * e.height;
|
|
3443
|
+
if (A < k) {
|
|
3444
|
+
const S = Math.abs(k / e.width);
|
|
3445
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3392
3446
|
} else
|
|
3393
3447
|
p = (A - e.width) / 2 / e.width;
|
|
3394
|
-
i.push({ from: -p, to: p, start:
|
|
3448
|
+
i.push({ from: -p, to: p, start: h, length: c });
|
|
3395
3449
|
break;
|
|
3396
3450
|
}
|
|
3397
3451
|
case "slideUp": {
|
|
3398
3452
|
let p = this.getSlideStart();
|
|
3399
|
-
const
|
|
3400
|
-
if (A <
|
|
3401
|
-
const S = Math.abs(
|
|
3402
|
-
r.push({ from: S, to: S, start:
|
|
3453
|
+
const k = e.height + e.height * p * 2, A = t.height / t.width * e.width;
|
|
3454
|
+
if (A < k) {
|
|
3455
|
+
const S = Math.abs(k / e.height);
|
|
3456
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3403
3457
|
} else
|
|
3404
3458
|
p = (A - e.height) / 2 / e.height;
|
|
3405
|
-
s.push({ from: p, to: -p, start:
|
|
3459
|
+
s.push({ from: p, to: -p, start: h, length: c });
|
|
3406
3460
|
break;
|
|
3407
3461
|
}
|
|
3408
3462
|
case "slideDown": {
|
|
3409
3463
|
let p = this.getSlideStart();
|
|
3410
|
-
const
|
|
3411
|
-
if (A <
|
|
3412
|
-
const S = Math.abs(
|
|
3413
|
-
r.push({ from: S, to: S, start:
|
|
3464
|
+
const k = e.height + e.height * p * 2, A = t.height / t.width * e.width;
|
|
3465
|
+
if (A < k) {
|
|
3466
|
+
const S = Math.abs(k / e.height);
|
|
3467
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3414
3468
|
} else
|
|
3415
3469
|
p = (A - e.height) / 2 / e.height;
|
|
3416
|
-
s.push({ from: -p, to: p, start:
|
|
3470
|
+
s.push({ from: -p, to: p, start: h, length: c });
|
|
3417
3471
|
break;
|
|
3418
3472
|
}
|
|
3419
3473
|
}
|
|
@@ -3468,33 +3522,33 @@ class is {
|
|
|
3468
3522
|
const r = 0, o = this.getInPresetLength();
|
|
3469
3523
|
switch (this.getInPresetName()) {
|
|
3470
3524
|
case "fade": {
|
|
3471
|
-
const
|
|
3472
|
-
i.push({ from: 0, to:
|
|
3525
|
+
const h = Math.max(0, Math.min(this.clipConfiguration.opacity ?? 1, 1));
|
|
3526
|
+
i.push({ from: 0, to: h, start: r, length: o, interpolation: "linear" });
|
|
3473
3527
|
break;
|
|
3474
3528
|
}
|
|
3475
3529
|
case "zoom": {
|
|
3476
|
-
const
|
|
3477
|
-
s.push({ from:
|
|
3530
|
+
const h = this.clipConfiguration.scale + 9, g = this.clipConfiguration.scale;
|
|
3531
|
+
s.push({ from: h, to: g, start: r, length: o, interpolation: "bezier", easing: "easeIn" }), i.push({ from: 0, to: 1, start: r, length: o, interpolation: "bezier", easing: "easeIn" });
|
|
3478
3532
|
break;
|
|
3479
3533
|
}
|
|
3480
3534
|
case "slideLeft": {
|
|
3481
|
-
const c = this.clipConfiguration.offset?.x + 0.025,
|
|
3482
|
-
e.push({ from: c, to:
|
|
3535
|
+
const c = this.clipConfiguration.offset?.x + 0.025, h = this.clipConfiguration.offset?.x;
|
|
3536
|
+
e.push({ from: c, to: h, start: r, length: o, interpolation: "bezier", easing: "easeIn" }), i.push({ from: 0, to: 1, start: r, length: o, interpolation: "bezier", easing: "easeIn" });
|
|
3483
3537
|
break;
|
|
3484
3538
|
}
|
|
3485
3539
|
case "slideRight": {
|
|
3486
|
-
const c = this.clipConfiguration.offset?.x - 0.025,
|
|
3487
|
-
e.push({ from: c, to:
|
|
3540
|
+
const c = this.clipConfiguration.offset?.x - 0.025, h = this.clipConfiguration.offset?.x;
|
|
3541
|
+
e.push({ from: c, to: h, start: r, length: o, interpolation: "bezier", easing: "easeIn" }), i.push({ from: 0, to: 1, start: r, length: o, interpolation: "bezier", easing: "easeIn" });
|
|
3488
3542
|
break;
|
|
3489
3543
|
}
|
|
3490
3544
|
case "slideUp": {
|
|
3491
|
-
const c = this.clipConfiguration.offset?.y + 0.025,
|
|
3492
|
-
t.push({ from: c, to:
|
|
3545
|
+
const c = this.clipConfiguration.offset?.y + 0.025, h = this.clipConfiguration.offset?.y;
|
|
3546
|
+
t.push({ from: c, to: h, start: r, length: o, interpolation: "bezier", easing: "easeIn" }), i.push({ from: 0, to: 1, start: r, length: o, interpolation: "bezier", easing: "easeIn" });
|
|
3493
3547
|
break;
|
|
3494
3548
|
}
|
|
3495
3549
|
case "slideDown": {
|
|
3496
|
-
const c = this.clipConfiguration.offset?.y - 0.025,
|
|
3497
|
-
t.push({ from: c, to:
|
|
3550
|
+
const c = this.clipConfiguration.offset?.y - 0.025, h = this.clipConfiguration.offset?.y;
|
|
3551
|
+
t.push({ from: c, to: h, start: r, length: o, interpolation: "bezier", easing: "easeOut" }), i.push({ from: 0, to: 1, start: r, length: o, interpolation: "bezier", easing: "easeOut" });
|
|
3498
3552
|
break;
|
|
3499
3553
|
}
|
|
3500
3554
|
case "carouselLeft":
|
|
@@ -3527,28 +3581,28 @@ class is {
|
|
|
3527
3581
|
break;
|
|
3528
3582
|
}
|
|
3529
3583
|
case "zoom": {
|
|
3530
|
-
const
|
|
3531
|
-
s.push({ from:
|
|
3584
|
+
const h = this.clipConfiguration.scale, g = h + 9;
|
|
3585
|
+
s.push({ from: h, to: g, start: o, length: r, interpolation: "bezier", easing: "easeOut" }), i.push({ from: 1, to: 0, start: o, length: r, interpolation: "bezier", easing: "easeOut" });
|
|
3532
3586
|
break;
|
|
3533
3587
|
}
|
|
3534
3588
|
case "slideLeft": {
|
|
3535
|
-
const c = this.clipConfiguration.offset?.x,
|
|
3536
|
-
e.push({ from: c, to:
|
|
3589
|
+
const c = this.clipConfiguration.offset?.x, h = c - 0.025;
|
|
3590
|
+
e.push({ from: c, to: h, start: o, length: r, interpolation: "bezier", easing: "easeOut" }), i.push({ from: 1, to: 0, start: o, length: r, interpolation: "bezier", easing: "easeOut" });
|
|
3537
3591
|
break;
|
|
3538
3592
|
}
|
|
3539
3593
|
case "slideRight": {
|
|
3540
|
-
const c = this.clipConfiguration.offset?.x,
|
|
3541
|
-
e.push({ from: c, to:
|
|
3594
|
+
const c = this.clipConfiguration.offset?.x, h = c + 0.025;
|
|
3595
|
+
e.push({ from: c, to: h, start: o, length: r, interpolation: "bezier", easing: "easeOut" }), i.push({ from: 1, to: 0, start: o, length: r, interpolation: "bezier", easing: "easeOut" });
|
|
3542
3596
|
break;
|
|
3543
3597
|
}
|
|
3544
3598
|
case "slideUp": {
|
|
3545
|
-
const c = this.clipConfiguration.offset?.y,
|
|
3546
|
-
t.push({ from: c, to:
|
|
3599
|
+
const c = this.clipConfiguration.offset?.y, h = c - 0.025;
|
|
3600
|
+
t.push({ from: c, to: h, start: o, length: r, interpolation: "bezier", easing: "easeIn" }), i.push({ from: 1, to: 0, start: o, length: r, interpolation: "bezier", easing: "easeIn" });
|
|
3547
3601
|
break;
|
|
3548
3602
|
}
|
|
3549
3603
|
case "slideDown": {
|
|
3550
|
-
const c = this.clipConfiguration.offset?.y,
|
|
3551
|
-
t.push({ from: c, to:
|
|
3604
|
+
const c = this.clipConfiguration.offset?.y, h = c + 0.025;
|
|
3605
|
+
t.push({ from: c, to: h, start: o, length: r, interpolation: "bezier", easing: "easeIn" }), i.push({ from: 1, to: 0, start: o, length: r, interpolation: "bezier", easing: "easeIn" });
|
|
3552
3606
|
break;
|
|
3553
3607
|
}
|
|
3554
3608
|
case "carouselLeft":
|
|
@@ -3714,17 +3768,17 @@ class ns {
|
|
|
3714
3768
|
}
|
|
3715
3769
|
}
|
|
3716
3770
|
}
|
|
3717
|
-
class
|
|
3771
|
+
class ot {
|
|
3718
3772
|
container;
|
|
3719
3773
|
constructor() {
|
|
3720
|
-
this.container = new
|
|
3774
|
+
this.container = new v.Container();
|
|
3721
3775
|
}
|
|
3722
3776
|
/** @internal */
|
|
3723
3777
|
getContainer() {
|
|
3724
3778
|
return this.container;
|
|
3725
3779
|
}
|
|
3726
3780
|
}
|
|
3727
|
-
class
|
|
3781
|
+
class I extends ot {
|
|
3728
3782
|
static SnapThreshold = 20;
|
|
3729
3783
|
static DiscardedFrameCount = Math.ceil(1 / 30 * 1e3);
|
|
3730
3784
|
static ScaleHandleRadius = 10;
|
|
@@ -3763,15 +3817,15 @@ class R extends rt {
|
|
|
3763
3817
|
super(), this.edit = e, this.layer = 0, this.shouldDispose = !1, this.clipConfiguration = t, this.positionBuilder = new ns(e.size), this.outline = null, this.topLeftScaleHandle = null, this.topRightScaleHandle = null, this.bottomRightScaleHandle = null, this.bottomLeftScaleHandle = null, this.rotationHandle = null, this.isHovering = !1, this.isDragging = !1, this.dragOffset = { x: 0, y: 0 }, this.scaleDirection = null, this.scaleStart = null, this.scaleOffset = { x: 0, y: 0 }, this.isRotating = !1, this.rotationStart = null, this.rotationOffset = { x: 0, y: 0 }, this.initialClipConfiguration = null;
|
|
3764
3818
|
}
|
|
3765
3819
|
configureKeyframes() {
|
|
3766
|
-
if (this.offsetXKeyframeBuilder = new
|
|
3820
|
+
if (this.offsetXKeyframeBuilder = new R(this.clipConfiguration.offset?.x ?? 0, this.getLength()), this.offsetYKeyframeBuilder = new R(this.clipConfiguration.offset?.y ?? 0, this.getLength()), this.scaleKeyframeBuilder = new R(this.clipConfiguration.scale ?? 1, this.getLength(), 1), this.opacityKeyframeBuilder = new R(this.clipConfiguration.opacity ?? 1, this.getLength(), 1), this.rotationKeyframeBuilder = new R(this.clipConfiguration.transform?.rotate?.angle ?? 0, this.getLength()), this.clipHasKeyframes())
|
|
3767
3821
|
return;
|
|
3768
3822
|
const e = [], t = [], i = [], s = [], n = [], r = new ts(this.clipConfiguration).build(this.edit.size, this.getSize());
|
|
3769
3823
|
e.push(...r.offsetXKeyframes), t.push(...r.offsetYKeyframes), i.push(...r.opacityKeyframes), s.push(...r.scaleKeyframes), n.push(...r.rotationKeyframes);
|
|
3770
3824
|
const o = new is(this.clipConfiguration).build();
|
|
3771
|
-
e.push(...o.offsetXKeyframes), t.push(...o.offsetYKeyframes), i.push(...o.opacityKeyframes), s.push(...o.scaleKeyframes), n.push(...o.rotationKeyframes), e.length && (this.offsetXKeyframeBuilder = new
|
|
3825
|
+
e.push(...o.offsetXKeyframes), t.push(...o.offsetYKeyframes), i.push(...o.opacityKeyframes), s.push(...o.scaleKeyframes), n.push(...o.rotationKeyframes), e.length && (this.offsetXKeyframeBuilder = new R(e, this.getLength())), t.length && (this.offsetYKeyframeBuilder = new R(t, this.getLength())), i.length && (this.opacityKeyframeBuilder = new R(i, this.getLength(), 1)), s.length && (this.scaleKeyframeBuilder = new R(s, this.getLength(), 1)), n.length && (this.rotationKeyframeBuilder = new R(n, this.getLength()));
|
|
3772
3826
|
}
|
|
3773
3827
|
async load() {
|
|
3774
|
-
this.outline = new
|
|
3828
|
+
this.outline = new v.Graphics(), this.getContainer().addChild(this.outline), this.topLeftScaleHandle = new v.Graphics(), this.topRightScaleHandle = new v.Graphics(), this.bottomRightScaleHandle = new v.Graphics(), this.bottomLeftScaleHandle = new v.Graphics(), this.getContainer().addChild(this.topLeftScaleHandle), this.getContainer().addChild(this.topRightScaleHandle), this.getContainer().addChild(this.bottomRightScaleHandle), this.getContainer().addChild(this.bottomLeftScaleHandle), this.rotationHandle = new v.Graphics(), this.getContainer().addChild(this.rotationHandle), this.getContainer().cursor = "pointer", this.getContainer().eventMode = "static", this.getContainer().on("pointerdown", this.onPointerStart.bind(this)), this.getContainer().on("pointermove", this.onPointerMove.bind(this)), this.getContainer().on("globalpointermove", this.onPointerMove.bind(this)), this.getContainer().on("pointerup", this.onPointerUp.bind(this)), this.getContainer().on("pointerupoutside", this.onPointerUp.bind(this)), this.getContainer().on("pointerover", this.onPointerOver.bind(this)), this.getContainer().on("pointerout", this.onPointerOut.bind(this));
|
|
3775
3829
|
}
|
|
3776
3830
|
update(e, t) {
|
|
3777
3831
|
if (this.getContainer().visible = this.isActive(), this.getContainer().zIndex = this.layer, !this.isActive())
|
|
@@ -3789,14 +3843,14 @@ class R extends rt {
|
|
|
3789
3843
|
return;
|
|
3790
3844
|
}
|
|
3791
3845
|
const e = this.isHovering || this.isDragging ? 65535 : 16777215, t = this.getSize(), i = this.getScale();
|
|
3792
|
-
if (this.outline.clear(), this.outline.strokeStyle = { width:
|
|
3846
|
+
if (this.outline.clear(), this.outline.strokeStyle = { width: I.OutlineWidth / i, color: e }, this.outline.rect(0, 0, t.width, t.height), this.outline.stroke(), !this.topLeftScaleHandle || !this.topRightScaleHandle || !this.bottomRightScaleHandle || !this.bottomLeftScaleHandle || !this.isActive() || this.edit.getSelectedClip() !== this)
|
|
3793
3847
|
return;
|
|
3794
3848
|
this.topLeftScaleHandle.fillStyle = { color: e }, this.topLeftScaleHandle.clear();
|
|
3795
|
-
const s =
|
|
3849
|
+
const s = I.ScaleHandleRadius * 2 / i;
|
|
3796
3850
|
if (this.topLeftScaleHandle.rect(-s / 2, -s / 2, s, s), this.topLeftScaleHandle.fill(), this.topRightScaleHandle.fillStyle = { color: e }, this.topRightScaleHandle.clear(), this.topRightScaleHandle.rect(t.width - s / 2, -s / 2, s, s), this.topRightScaleHandle.fill(), this.bottomRightScaleHandle.fillStyle = { color: e }, this.bottomRightScaleHandle.clear(), this.bottomRightScaleHandle.rect(t.width - s / 2, t.height - s / 2, s, s), this.bottomRightScaleHandle.fill(), this.bottomLeftScaleHandle.fillStyle = { color: e }, this.bottomLeftScaleHandle.clear(), this.bottomLeftScaleHandle.rect(-s / 2, t.height - s / 2, s, s), this.bottomLeftScaleHandle.fill(), !this.rotationHandle)
|
|
3797
3851
|
return;
|
|
3798
3852
|
const n = t.width / 2, r = -50 / i;
|
|
3799
|
-
this.rotationHandle.clear(), this.rotationHandle.fillStyle = { color: e }, this.rotationHandle.circle(n, r,
|
|
3853
|
+
this.rotationHandle.clear(), this.rotationHandle.fillStyle = { color: e }, this.rotationHandle.circle(n, r, I.RotationHandleRadius / i), this.rotationHandle.fill(), this.outline.strokeStyle = { width: I.OutlineWidth / i, color: e }, this.outline.moveTo(n, 0), this.outline.lineTo(n, r), this.outline.stroke();
|
|
3800
3854
|
}
|
|
3801
3855
|
dispose() {
|
|
3802
3856
|
this.outline?.destroy(), this.outline = null, this.topLeftScaleHandle?.destroy(), this.topLeftScaleHandle = null, this.topRightScaleHandle?.destroy(), this.topRightScaleHandle = null, this.bottomLeftScaleHandle?.destroy(), this.bottomLeftScaleHandle = null, this.bottomRightScaleHandle?.destroy(), this.bottomRightScaleHandle = null, this.rotationHandle?.destroy(), this.rotationHandle = null;
|
|
@@ -3851,21 +3905,21 @@ class R extends rt {
|
|
|
3851
3905
|
return this.edit.playbackTime >= this.getStart() && this.edit.playbackTime < this.getEnd();
|
|
3852
3906
|
}
|
|
3853
3907
|
shouldDiscardFrame() {
|
|
3854
|
-
return this.getPlaybackTime() <
|
|
3908
|
+
return this.getPlaybackTime() < I.DiscardedFrameCount;
|
|
3855
3909
|
}
|
|
3856
3910
|
onPointerStart(e) {
|
|
3857
3911
|
if (e.button !== ss.ButtonLeftClick || (this.edit.setSelectedClip(this), this.initialClipConfiguration = structuredClone(this.clipConfiguration), this.clipHasKeyframes()))
|
|
3858
3912
|
return;
|
|
3859
3913
|
if (this.scaleDirection = null, this.topLeftScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "topLeft"), this.topRightScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "topRight"), this.bottomRightScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "bottomRight"), this.bottomLeftScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "bottomLeft"), this.scaleDirection !== null) {
|
|
3860
3914
|
this.scaleStart = this.getScale() / this.getFitScale();
|
|
3861
|
-
const
|
|
3862
|
-
this.scaleOffset =
|
|
3915
|
+
const l = e.getLocalPosition(this.edit.getContainer());
|
|
3916
|
+
this.scaleOffset = l;
|
|
3863
3917
|
return;
|
|
3864
3918
|
}
|
|
3865
3919
|
if (this.rotationHandle?.getBounds().containsPoint(e.globalX, e.globalY)) {
|
|
3866
3920
|
this.isRotating = !0, this.rotationStart = this.getRotation();
|
|
3867
|
-
const
|
|
3868
|
-
this.rotationOffset =
|
|
3921
|
+
const l = e.getLocalPosition(this.edit.getContainer());
|
|
3922
|
+
this.rotationOffset = l;
|
|
3869
3923
|
return;
|
|
3870
3924
|
}
|
|
3871
3925
|
this.isDragging = !0;
|
|
@@ -3877,15 +3931,15 @@ class R extends rt {
|
|
|
3877
3931
|
}
|
|
3878
3932
|
onPointerMove(e) {
|
|
3879
3933
|
if (this.scaleDirection !== null && this.scaleStart !== null) {
|
|
3880
|
-
const t = e.getLocalPosition(this.edit.getContainer()), i = this.getPosition(), s = this.getPivot(), n = { x: i.x + s.x, y: i.y + s.y }, r = Math.sqrt((this.scaleOffset.x - n.x) ** 2 + (this.scaleOffset.y - n.y) ** 2),
|
|
3881
|
-
this.clipConfiguration.scale = Math.max(
|
|
3934
|
+
const t = e.getLocalPosition(this.edit.getContainer()), i = this.getPosition(), s = this.getPivot(), n = { x: i.x + s.x, y: i.y + s.y }, r = Math.sqrt((this.scaleOffset.x - n.x) ** 2 + (this.scaleOffset.y - n.y) ** 2), l = Math.sqrt((t.x - n.x) ** 2 + (t.y - n.y) ** 2) / r, c = this.scaleStart * l;
|
|
3935
|
+
this.clipConfiguration.scale = Math.max(I.MinScale, Math.min(c, I.MaxScale)), this.scaleKeyframeBuilder = new R(this.clipConfiguration.scale, this.getLength(), 1);
|
|
3882
3936
|
return;
|
|
3883
3937
|
}
|
|
3884
3938
|
if (this.isRotating && this.rotationStart !== null) {
|
|
3885
|
-
const t = e.getLocalPosition(this.edit.getContainer()), i = this.getPosition(), s = this.getPivot(), n = { x: i.x + s.x, y: i.y + s.y }, r = Math.atan2(this.rotationOffset.y - n.y, this.rotationOffset.x - n.x),
|
|
3886
|
-
let c = this.rotationStart +
|
|
3887
|
-
const
|
|
3888
|
-
Math.abs(g) < p ? c = Math.floor(c /
|
|
3939
|
+
const t = e.getLocalPosition(this.edit.getContainer()), i = this.getPosition(), s = this.getPivot(), n = { x: i.x + s.x, y: i.y + s.y }, r = Math.atan2(this.rotationOffset.y - n.y, this.rotationOffset.x - n.x), l = (Math.atan2(t.y - n.y, t.x - n.x) - r) * (180 / Math.PI);
|
|
3940
|
+
let c = this.rotationStart + l;
|
|
3941
|
+
const h = 45, g = c % h, p = 2;
|
|
3942
|
+
Math.abs(g) < p ? c = Math.floor(c / h) * h : Math.abs(g - h) < p && (c = Math.ceil(c / h) * h), this.clipConfiguration.transform || (this.clipConfiguration.transform = { rotate: { angle: 0 } }), this.clipConfiguration.transform.rotate || (this.clipConfiguration.transform.rotate = { angle: 0 }), this.clipConfiguration.transform.rotate.angle = c, this.rotationKeyframeBuilder = new R(this.clipConfiguration.transform.rotate.angle, this.getLength());
|
|
3889
3943
|
return;
|
|
3890
3944
|
}
|
|
3891
3945
|
if (this.isDragging) {
|
|
@@ -3894,19 +3948,19 @@ class R extends rt {
|
|
|
3894
3948
|
{ x: this.edit.size.width, y: 0 },
|
|
3895
3949
|
{ x: 0, y: this.edit.size.height },
|
|
3896
3950
|
{ x: this.edit.size.width, y: this.edit.size.height }
|
|
3897
|
-
], o = { x: this.edit.size.width / 2, y: this.edit.size.height / 2 },
|
|
3951
|
+
], o = { x: this.edit.size.width / 2, y: this.edit.size.height / 2 }, l = [...r, o], c = [
|
|
3898
3952
|
{ x: n.x, y: n.y },
|
|
3899
3953
|
{ x: n.x + this.getSize().width, y: n.y },
|
|
3900
3954
|
{ x: n.x, y: n.y + this.getSize().height },
|
|
3901
3955
|
{ x: n.x + this.getSize().width, y: n.y + this.getSize().height }
|
|
3902
|
-
],
|
|
3903
|
-
let p =
|
|
3956
|
+
], h = { x: n.x + this.getSize().width / 2, y: n.y + this.getSize().height / 2 }, g = [...c, h];
|
|
3957
|
+
let p = I.SnapThreshold, k = I.SnapThreshold, A = null, S = null;
|
|
3904
3958
|
for (const J of g)
|
|
3905
|
-
for (const re of
|
|
3906
|
-
const
|
|
3907
|
-
|
|
3959
|
+
for (const re of l) {
|
|
3960
|
+
const K = Math.abs(J.x - re.x);
|
|
3961
|
+
K < p && (p = K, A = n.x + (re.x - J.x));
|
|
3908
3962
|
const oe = Math.abs(J.y - re.y);
|
|
3909
|
-
oe <
|
|
3963
|
+
oe < k && (k = oe, S = n.y + (re.y - J.y));
|
|
3910
3964
|
}
|
|
3911
3965
|
A !== null && (n.x = A), S !== null && (n.y = S);
|
|
3912
3966
|
const N = this.positionBuilder.absoluteToRelative(
|
|
@@ -3914,7 +3968,7 @@ class R extends rt {
|
|
|
3914
3968
|
this.clipConfiguration.position ?? "center",
|
|
3915
3969
|
n
|
|
3916
3970
|
);
|
|
3917
|
-
this.clipConfiguration.offset || (this.clipConfiguration.offset = { x: 0, y: 0 }), this.clipConfiguration.offset.x = N.x, this.clipConfiguration.offset.y = N.y, this.offsetXKeyframeBuilder = new
|
|
3971
|
+
this.clipConfiguration.offset || (this.clipConfiguration.offset = { x: 0, y: 0 }), this.clipConfiguration.offset.x = N.x, this.clipConfiguration.offset.y = N.y, this.offsetXKeyframeBuilder = new R(this.clipConfiguration.offset.x, this.getLength()), this.offsetYKeyframeBuilder = new R(this.clipConfiguration.offset.y, this.getLength());
|
|
3918
3972
|
}
|
|
3919
3973
|
}
|
|
3920
3974
|
onPointerUp() {
|
|
@@ -3939,11 +3993,11 @@ class R extends rt {
|
|
|
3939
3993
|
}
|
|
3940
3994
|
hasStateChanged() {
|
|
3941
3995
|
if (!this.initialClipConfiguration) return !1;
|
|
3942
|
-
const e = this.clipConfiguration.offset?.x, t = this.clipConfiguration.offset?.y, i = this.clipConfiguration.scale, s = Number(this.clipConfiguration.transform?.rotate?.angle ?? 0), n = this.initialClipConfiguration.offset?.x, r = this.initialClipConfiguration.offset?.y, o = this.initialClipConfiguration.scale,
|
|
3943
|
-
return n !== void 0 && e !== n || r !== void 0 && t !== r || o !== void 0 && i !== o || s !==
|
|
3996
|
+
const e = this.clipConfiguration.offset?.x, t = this.clipConfiguration.offset?.y, i = this.clipConfiguration.scale, s = Number(this.clipConfiguration.transform?.rotate?.angle ?? 0), n = this.initialClipConfiguration.offset?.x, r = this.initialClipConfiguration.offset?.y, o = this.initialClipConfiguration.scale, l = Number(this.initialClipConfiguration.transform?.rotate?.angle ?? 0);
|
|
3997
|
+
return n !== void 0 && e !== n || r !== void 0 && t !== r || o !== void 0 && i !== o || s !== l;
|
|
3944
3998
|
}
|
|
3945
3999
|
}
|
|
3946
|
-
class
|
|
4000
|
+
class nt extends I {
|
|
3947
4001
|
audioResource;
|
|
3948
4002
|
isPlaying;
|
|
3949
4003
|
volumeKeyframeBuilder;
|
|
@@ -3951,12 +4005,12 @@ class st extends R {
|
|
|
3951
4005
|
constructor(e, t) {
|
|
3952
4006
|
super(e, t), this.audioResource = null, this.isPlaying = !1;
|
|
3953
4007
|
const i = t.asset;
|
|
3954
|
-
this.volumeKeyframeBuilder = new
|
|
4008
|
+
this.volumeKeyframeBuilder = new R(i.volume ?? 1, this.getLength()), this.syncTimer = 0;
|
|
3955
4009
|
}
|
|
3956
4010
|
async load() {
|
|
3957
4011
|
await super.load();
|
|
3958
4012
|
const e = this.clipConfiguration.asset, t = e.src, i = { src: t, loadParser: He.Name }, s = await this.edit.assetLoader.load(t, i);
|
|
3959
|
-
if (!(s instanceof
|
|
4013
|
+
if (!(s instanceof Ut.Howl))
|
|
3960
4014
|
throw new Error(`Invalid audio source '${e.src}'.`);
|
|
3961
4015
|
this.audioResource = s, this.configureKeyframes();
|
|
3962
4016
|
}
|
|
@@ -4179,7 +4233,7 @@ const Be = class ee extends Kt {
|
|
|
4179
4233
|
source: cs,
|
|
4180
4234
|
entryPoint: "mainFragment"
|
|
4181
4235
|
}
|
|
4182
|
-
}), n =
|
|
4236
|
+
}), n = $t.from({
|
|
4183
4237
|
vertex: as,
|
|
4184
4238
|
fragment: os.replace(/\$\{ANGLE_STEP\}/, ee.getAngleStep(i).toFixed(7)),
|
|
4185
4239
|
name: "outline-filter"
|
|
@@ -4196,7 +4250,7 @@ const Be = class ee extends Kt {
|
|
|
4196
4250
|
uKnockout: { value: t.knockout ? 1 : 0, type: "f32" }
|
|
4197
4251
|
}
|
|
4198
4252
|
}
|
|
4199
|
-
}), te(this, "uniforms"), te(this, "_thickness"), te(this, "_quality"), te(this, "_color"), this.uniforms = this.resources.outlineUniforms.uniforms, this.uniforms.uAngleStep = ee.getAngleStep(i), this._color = new
|
|
4253
|
+
}), te(this, "uniforms"), te(this, "_thickness"), te(this, "_quality"), te(this, "_color"), this.uniforms = this.resources.outlineUniforms.uniforms, this.uniforms.uAngleStep = ee.getAngleStep(i), this._color = new jt(), this.color = t.color ?? 0, Object.assign(this, t);
|
|
4200
4254
|
}
|
|
4201
4255
|
/**
|
|
4202
4256
|
* Override existing apply method in `Filter`
|
|
@@ -4280,8 +4334,8 @@ te(Be, "DEFAULT_OPTIONS", {
|
|
|
4280
4334
|
});
|
|
4281
4335
|
te(Be, "MIN_SAMPLES", 1);
|
|
4282
4336
|
te(Be, "MAX_SAMPLES", 100);
|
|
4283
|
-
let
|
|
4284
|
-
class us extends
|
|
4337
|
+
let ct = Be;
|
|
4338
|
+
class us extends I {
|
|
4285
4339
|
background;
|
|
4286
4340
|
text;
|
|
4287
4341
|
constructor(e, t) {
|
|
@@ -4292,12 +4346,12 @@ class us extends R {
|
|
|
4292
4346
|
const e = this.clipConfiguration.asset, t = await this.parseDocument();
|
|
4293
4347
|
if (!t)
|
|
4294
4348
|
return;
|
|
4295
|
-
const i = new
|
|
4349
|
+
const i = new v.Graphics();
|
|
4296
4350
|
t.background.color && (i.fillStyle = {
|
|
4297
4351
|
color: t.background.color,
|
|
4298
4352
|
alpha: t.background.opacity ?? 1
|
|
4299
4353
|
}, i.rect(0, 0, e.width ?? this.edit.size.width, e.height ?? this.edit.size.height), i.fill());
|
|
4300
|
-
const s = new
|
|
4354
|
+
const s = new v.Text();
|
|
4301
4355
|
s.text = t.text;
|
|
4302
4356
|
const { horizontal: n, vertical: r } = t.alignment;
|
|
4303
4357
|
s.style = {
|
|
@@ -4310,12 +4364,12 @@ class us extends R {
|
|
|
4310
4364
|
lineHeight: (t.font?.lineHeight ?? 1) * (t.font?.size ?? 32),
|
|
4311
4365
|
align: n
|
|
4312
4366
|
};
|
|
4313
|
-
let o = (e.width ?? this.edit.size.width) / 2 - s.width / 2,
|
|
4314
|
-
if (n === "left" && (o = 0), n === "right" && (o = (e.width ?? this.edit.size.width) - s.width), r === "top" && (
|
|
4367
|
+
let o = (e.width ?? this.edit.size.width) / 2 - s.width / 2, l = (e.height ?? this.edit.size.height) / 2 - s.height / 2;
|
|
4368
|
+
if (n === "left" && (o = 0), n === "right" && (o = (e.width ?? this.edit.size.width) - s.width), r === "top" && (l = 0), r === "bottom" && (l = (e.height ?? this.edit.size.height) - s.height), s.position = {
|
|
4315
4369
|
x: o,
|
|
4316
|
-
y:
|
|
4370
|
+
y: l
|
|
4317
4371
|
}, t.stroke.color && t.stroke.width) {
|
|
4318
|
-
const c = new
|
|
4372
|
+
const c = new ct({
|
|
4319
4373
|
thickness: t.stroke.width,
|
|
4320
4374
|
color: t.stroke.color
|
|
4321
4375
|
});
|
|
@@ -4346,24 +4400,24 @@ class us extends R {
|
|
|
4346
4400
|
const e = this.clipConfiguration.asset, { html: t, css: i, position: s } = e;
|
|
4347
4401
|
if (!t.includes('data-html-type="text"'))
|
|
4348
4402
|
return console.warn("Unsupported html format."), null;
|
|
4349
|
-
const r = new DOMParser().parseFromString(t, "text/html").body.textContent ?? "",
|
|
4350
|
-
if (
|
|
4403
|
+
const r = new DOMParser().parseFromString(t, "text/html").body.textContent ?? "", l = (await new CSSStyleSheet().replace(i)).cssRules[0], c = { text: r, font: {}, alignment: {}, background: {}, stroke: {} };
|
|
4404
|
+
if (l?.constructor.name !== "CSSStyleRule" || !("style" in l))
|
|
4351
4405
|
return console.warn("Unsupported css format."), c;
|
|
4352
|
-
const
|
|
4406
|
+
const h = l.style, g = this.parseAlignment(s ?? "center");
|
|
4353
4407
|
c.font = {
|
|
4354
|
-
color:
|
|
4355
|
-
family:
|
|
4356
|
-
size:
|
|
4357
|
-
weight:
|
|
4358
|
-
lineHeight:
|
|
4408
|
+
color: h.color.length ? h.color : void 0,
|
|
4409
|
+
family: h.fontFamily.length ? h.fontFamily : void 0,
|
|
4410
|
+
size: h.fontSize.length ? parseInt(h.fontSize, 10) : void 0,
|
|
4411
|
+
weight: h.fontWeight.length ? parseInt(h.fontWeight, 10) : void 0,
|
|
4412
|
+
lineHeight: h.lineHeight.length ? parseInt(h.lineHeight, 10) : void 0
|
|
4359
4413
|
}, c.alignment = g;
|
|
4360
4414
|
let p = "";
|
|
4361
|
-
return
|
|
4415
|
+
return h.background.length && (p = h.background), h.backgroundColor.length && (p = h.backgroundColor), c.background = {
|
|
4362
4416
|
color: p.length ? p : void 0,
|
|
4363
|
-
opacity:
|
|
4417
|
+
opacity: h.opacity.length ? parseInt(h.opacity, 10) : void 0
|
|
4364
4418
|
}, c.stroke = {
|
|
4365
|
-
width:
|
|
4366
|
-
color:
|
|
4419
|
+
width: h.strokeWidth.length ? parseInt(h.strokeWidth, 10) : void 0,
|
|
4420
|
+
color: h.stroke.length ? h.stroke : void 0
|
|
4367
4421
|
}, c;
|
|
4368
4422
|
}
|
|
4369
4423
|
parseAlignment(e) {
|
|
@@ -4390,7 +4444,7 @@ class us extends R {
|
|
|
4390
4444
|
}
|
|
4391
4445
|
}
|
|
4392
4446
|
}
|
|
4393
|
-
class ds extends
|
|
4447
|
+
class ds extends I {
|
|
4394
4448
|
texture;
|
|
4395
4449
|
sprite;
|
|
4396
4450
|
constructor(e, t) {
|
|
@@ -4403,9 +4457,9 @@ class ds extends R {
|
|
|
4403
4457
|
crossovern: "anonymous",
|
|
4404
4458
|
data: {}
|
|
4405
4459
|
}, s = await this.edit.assetLoader.load(t, i);
|
|
4406
|
-
if (!(s?.source instanceof
|
|
4460
|
+
if (!(s?.source instanceof v.ImageSource))
|
|
4407
4461
|
throw new Error(`Invalid image source '${e.src}'.`);
|
|
4408
|
-
this.texture = this.createCroppedTexture(s), this.sprite = new
|
|
4462
|
+
this.texture = this.createCroppedTexture(s), this.sprite = new v.Sprite(this.texture), this.getContainer().addChild(this.sprite), this.configureKeyframes();
|
|
4409
4463
|
}
|
|
4410
4464
|
update(e, t) {
|
|
4411
4465
|
super.update(e, t);
|
|
@@ -4423,11 +4477,11 @@ class ds extends R {
|
|
|
4423
4477
|
const t = this.clipConfiguration.asset;
|
|
4424
4478
|
if (!t.crop)
|
|
4425
4479
|
return e;
|
|
4426
|
-
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s),
|
|
4427
|
-
return new
|
|
4480
|
+
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s), l = Math.floor((t.crop?.bottom ?? 0) * s), c = n, h = o, g = i - n - r, p = s - o - l, k = new v.Rectangle(c, h, g, p);
|
|
4481
|
+
return new v.Texture({ source: e.source, frame: k });
|
|
4428
4482
|
}
|
|
4429
4483
|
}
|
|
4430
|
-
class
|
|
4484
|
+
class Pt extends I {
|
|
4431
4485
|
texture;
|
|
4432
4486
|
sprite;
|
|
4433
4487
|
isPlaying;
|
|
@@ -4437,12 +4491,12 @@ class At extends R {
|
|
|
4437
4491
|
async load() {
|
|
4438
4492
|
await super.load();
|
|
4439
4493
|
const e = this.clipConfiguration.asset, t = e.src, i = { src: t, data: { autoPlay: !1, muted: !0 } }, s = await this.edit.assetLoader.load(t, i);
|
|
4440
|
-
if (!(s?.source instanceof
|
|
4494
|
+
if (!(s?.source instanceof v.ImageSource || s?.source instanceof v.VideoSource))
|
|
4441
4495
|
throw new Error(`Invalid luma source '${e.src}'.`);
|
|
4442
|
-
this.texture = s, this.sprite = new
|
|
4496
|
+
this.texture = s, this.sprite = new v.Sprite(this.texture), this.getContainer().addChild(this.sprite), this.configureKeyframes();
|
|
4443
4497
|
}
|
|
4444
4498
|
update(e, t) {
|
|
4445
|
-
if (super.update(e, t), !this.texture || !(this.texture.source instanceof
|
|
4499
|
+
if (super.update(e, t), !this.texture || !(this.texture.source instanceof v.VideoSource))
|
|
4446
4500
|
return;
|
|
4447
4501
|
const i = this.getPlaybackTime(), s = this.edit.isPlaying && this.isActive();
|
|
4448
4502
|
s && (this.isPlaying || (this.isPlaying = !0, this.texture.source.resource.currentTime = i / 1e3, this.texture.source.resource.play().catch(console.error)), this.texture.source.resource.volume !== this.getVolume() && (this.texture.source.resource.volume = this.getVolume()), Math.abs(this.texture.source.resource.currentTime * 1e3 - i) > 100 && (this.texture.source.resource.currentTime = i / 1e3)), !s && this.isPlaying && (this.isPlaying = !1, this.texture.source.resource.pause()), !this.edit.isPlaying && this.isActive() && (this.texture.source.resource.currentTime = i / 1e3);
|
|
@@ -4463,7 +4517,7 @@ class At extends R {
|
|
|
4463
4517
|
return this.sprite;
|
|
4464
4518
|
}
|
|
4465
4519
|
}
|
|
4466
|
-
class fs extends
|
|
4520
|
+
class fs extends I {
|
|
4467
4521
|
shape;
|
|
4468
4522
|
shapeBackground;
|
|
4469
4523
|
constructor(e, t) {
|
|
@@ -4471,23 +4525,23 @@ class fs extends R {
|
|
|
4471
4525
|
}
|
|
4472
4526
|
async load() {
|
|
4473
4527
|
await super.load();
|
|
4474
|
-
const e = this.clipConfiguration.asset, t = new
|
|
4528
|
+
const e = this.clipConfiguration.asset, t = new v.Graphics(), i = e.width ?? this.edit.size.width, s = e.height ?? this.edit.size.height;
|
|
4475
4529
|
t.fillStyle = { color: "transparent" }, t.rect(0, 0, i, s), t.fill();
|
|
4476
|
-
const n = new
|
|
4530
|
+
const n = new v.Graphics();
|
|
4477
4531
|
switch (e.shape) {
|
|
4478
4532
|
case "rectangle": {
|
|
4479
|
-
const r = e.rectangle, o = i / 2 - r.width / 2,
|
|
4480
|
-
n.rect(o,
|
|
4533
|
+
const r = e.rectangle, o = i / 2 - r.width / 2, l = s / 2 - r.height / 2;
|
|
4534
|
+
n.rect(o, l, r.width, r.height);
|
|
4481
4535
|
break;
|
|
4482
4536
|
}
|
|
4483
4537
|
case "circle": {
|
|
4484
|
-
const r = e.circle, o = i / 2,
|
|
4485
|
-
n.circle(o,
|
|
4538
|
+
const r = e.circle, o = i / 2, l = s / 2;
|
|
4539
|
+
n.circle(o, l, r.radius);
|
|
4486
4540
|
break;
|
|
4487
4541
|
}
|
|
4488
4542
|
case "line": {
|
|
4489
|
-
const r = e.line, o = i / 2 - r.length / 2,
|
|
4490
|
-
n.rect(o,
|
|
4543
|
+
const r = e.line, o = i / 2 - r.length / 2, l = s / 2 - r.thickness / 2;
|
|
4544
|
+
n.rect(o, l, r.length, r.thickness);
|
|
4491
4545
|
break;
|
|
4492
4546
|
}
|
|
4493
4547
|
default:
|
|
@@ -4498,7 +4552,7 @@ class fs extends R {
|
|
|
4498
4552
|
color: e.fill?.color ?? "#ffffff",
|
|
4499
4553
|
alpha: e.fill?.opacity ?? 1
|
|
4500
4554
|
}, n.fill(), e.stroke) {
|
|
4501
|
-
const r = new
|
|
4555
|
+
const r = new ct({
|
|
4502
4556
|
thickness: e.stroke.width,
|
|
4503
4557
|
color: e.stroke.color
|
|
4504
4558
|
});
|
|
@@ -4526,7 +4580,7 @@ class fs extends R {
|
|
|
4526
4580
|
return 1;
|
|
4527
4581
|
}
|
|
4528
4582
|
}
|
|
4529
|
-
class ps extends
|
|
4583
|
+
class ps extends I {
|
|
4530
4584
|
background;
|
|
4531
4585
|
text;
|
|
4532
4586
|
constructor(e, t) {
|
|
@@ -4534,12 +4588,12 @@ class ps extends R {
|
|
|
4534
4588
|
}
|
|
4535
4589
|
async load() {
|
|
4536
4590
|
await super.load();
|
|
4537
|
-
const e = this.clipConfiguration.asset, t = new
|
|
4591
|
+
const e = this.clipConfiguration.asset, t = new v.Graphics();
|
|
4538
4592
|
e.background && (t.fillStyle = {
|
|
4539
4593
|
color: e.background.color,
|
|
4540
4594
|
alpha: e.background.opacity
|
|
4541
4595
|
}, t.rect(0, 0, e.width ?? this.edit.size.width, e.height ?? this.edit.size.height), t.fill());
|
|
4542
|
-
const i = new
|
|
4596
|
+
const i = new v.Text();
|
|
4543
4597
|
i.text = e.text;
|
|
4544
4598
|
const s = e.alignment?.horizontal ?? "center", n = e.alignment?.vertical ?? "center";
|
|
4545
4599
|
i.style = {
|
|
@@ -4557,11 +4611,11 @@ class ps extends R {
|
|
|
4557
4611
|
x: r,
|
|
4558
4612
|
y: o
|
|
4559
4613
|
}, e.stroke) {
|
|
4560
|
-
const
|
|
4614
|
+
const l = new ct({
|
|
4561
4615
|
thickness: e.stroke.width,
|
|
4562
4616
|
color: e.stroke.color
|
|
4563
4617
|
});
|
|
4564
|
-
i.filters = [
|
|
4618
|
+
i.filters = [l];
|
|
4565
4619
|
}
|
|
4566
4620
|
this.background = t, this.text = i, this.getContainer().addChild(t), this.getContainer().addChild(i), this.configureKeyframes();
|
|
4567
4621
|
}
|
|
@@ -4585,7 +4639,7 @@ class ps extends R {
|
|
|
4585
4639
|
return 1;
|
|
4586
4640
|
}
|
|
4587
4641
|
}
|
|
4588
|
-
class ms extends
|
|
4642
|
+
class ms extends I {
|
|
4589
4643
|
texture;
|
|
4590
4644
|
sprite;
|
|
4591
4645
|
isPlaying;
|
|
@@ -4594,7 +4648,7 @@ class ms extends R {
|
|
|
4594
4648
|
constructor(e, t) {
|
|
4595
4649
|
super(e, t), this.texture = null, this.sprite = null, this.isPlaying = !1;
|
|
4596
4650
|
const i = this.clipConfiguration.asset;
|
|
4597
|
-
this.volumeKeyframeBuilder = new
|
|
4651
|
+
this.volumeKeyframeBuilder = new R(i.volume ?? 1, this.getLength()), this.syncTimer = 0;
|
|
4598
4652
|
}
|
|
4599
4653
|
/**
|
|
4600
4654
|
* TODO: Add support for .mov and .webm files
|
|
@@ -4605,9 +4659,9 @@ class ms extends R {
|
|
|
4605
4659
|
if (t.endsWith(".mov") || t.endsWith(".webm"))
|
|
4606
4660
|
throw new Error(`Video source '${e.src}' is not supported. .mov and .webm files are currently not supported.`);
|
|
4607
4661
|
const i = { src: t, data: { autoPlay: !1, muted: !1 } }, s = await this.edit.assetLoader.load(t, i);
|
|
4608
|
-
if (!(s?.source instanceof
|
|
4662
|
+
if (!(s?.source instanceof v.VideoSource))
|
|
4609
4663
|
throw new Error(`Invalid video source '${e.src}'.`);
|
|
4610
|
-
this.texture = this.createCroppedTexture(s), this.sprite = new
|
|
4664
|
+
this.texture = this.createCroppedTexture(s), this.sprite = new v.Sprite(this.texture), this.getContainer().addChild(this.sprite), this.configureKeyframes();
|
|
4611
4665
|
}
|
|
4612
4666
|
update(e, t) {
|
|
4613
4667
|
super.update(e, t);
|
|
@@ -4635,11 +4689,11 @@ class ms extends R {
|
|
|
4635
4689
|
const t = this.clipConfiguration.asset;
|
|
4636
4690
|
if (!t.crop)
|
|
4637
4691
|
return e;
|
|
4638
|
-
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s),
|
|
4639
|
-
return new
|
|
4692
|
+
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s), l = Math.floor((t.crop?.bottom ?? 0) * s), c = n, h = o, g = i - n - r, p = s - o - l, k = new v.Rectangle(c, h, g, p);
|
|
4693
|
+
return new v.Texture({ source: e.source, frame: k });
|
|
4640
4694
|
}
|
|
4641
4695
|
}
|
|
4642
|
-
class le extends
|
|
4696
|
+
class le extends ot {
|
|
4643
4697
|
static ZIndexPadding = 100;
|
|
4644
4698
|
assetLoader;
|
|
4645
4699
|
events;
|
|
@@ -4660,10 +4714,10 @@ class le extends rt {
|
|
|
4660
4714
|
/** @internal */
|
|
4661
4715
|
updatedClip;
|
|
4662
4716
|
constructor(e, t = "#ffffff") {
|
|
4663
|
-
super(), this.assetLoader = new
|
|
4717
|
+
super(), this.assetLoader = new Te(), this.edit = null, this.tracks = [], this.clipsToDispose = [], this.clips = [], this.events = new It(), this.size = e, this.playbackTime = 0, this.totalDuration = 0, this.isPlaying = !1, this.selectedClip = null, this.updatedClip = null, this.backgroundColor = t;
|
|
4664
4718
|
}
|
|
4665
4719
|
async load() {
|
|
4666
|
-
const e = new
|
|
4720
|
+
const e = new v.Graphics();
|
|
4667
4721
|
e.fillStyle = {
|
|
4668
4722
|
color: this.backgroundColor
|
|
4669
4723
|
}, e.rect(0, 0, this.size.width, this.size.height), e.fill(), this.getContainer().addChild(e);
|
|
@@ -4698,7 +4752,7 @@ class le extends rt {
|
|
|
4698
4752
|
async loadEdit(e) {
|
|
4699
4753
|
this.clearClips(), this.edit = Ji.parse(e), this.backgroundColor = this.edit.timeline.background || "#000000", await Promise.all(
|
|
4700
4754
|
(this.edit.timeline.fonts ?? []).map(async (t) => {
|
|
4701
|
-
const i = t.src, s = { src: i, loadParser:
|
|
4755
|
+
const i = t.src, s = { src: i, loadParser: Ve.Name };
|
|
4702
4756
|
return this.assetLoader.load(i, s);
|
|
4703
4757
|
})
|
|
4704
4758
|
);
|
|
@@ -4726,7 +4780,7 @@ class le extends rt {
|
|
|
4726
4780
|
};
|
|
4727
4781
|
}
|
|
4728
4782
|
addClip(e, t) {
|
|
4729
|
-
const i =
|
|
4783
|
+
const i = Nt.parse(t), s = this.createPlayerFromAssetType(i);
|
|
4730
4784
|
s.layer = e + 1, this.addPlayer(e, s), this.updateTotalDuration();
|
|
4731
4785
|
}
|
|
4732
4786
|
getClip(e, t) {
|
|
@@ -4751,7 +4805,7 @@ class le extends rt {
|
|
|
4751
4805
|
i.forEach(({ clip: s }) => {
|
|
4752
4806
|
const n = 1e5 - s.layer * le.ZIndexPadding, r = `shotstack-track-${n}`;
|
|
4753
4807
|
let o = this.getContainer().getChildByLabel(r, !1);
|
|
4754
|
-
o || (o = new
|
|
4808
|
+
o || (o = new v.Container({
|
|
4755
4809
|
label: r,
|
|
4756
4810
|
zIndex: n
|
|
4757
4811
|
}), this.getContainer().addChild(o)), o.addChild(s.getContainer());
|
|
@@ -4778,7 +4832,7 @@ class le extends rt {
|
|
|
4778
4832
|
i.forEach(({ clip: s }) => {
|
|
4779
4833
|
const n = 1e5 - s.layer * le.ZIndexPadding, r = `shotstack-track-${n}`;
|
|
4780
4834
|
let o = this.getContainer().getChildByLabel(r, !1);
|
|
4781
|
-
o || (o = new
|
|
4835
|
+
o || (o = new v.Container({
|
|
4782
4836
|
label: r,
|
|
4783
4837
|
zIndex: n
|
|
4784
4838
|
}), this.getContainer().addChild(o)), o.addChild(s.getContainer());
|
|
@@ -4835,7 +4889,7 @@ class le extends rt {
|
|
|
4835
4889
|
this.getContainer().removeChildAt(t);
|
|
4836
4890
|
} else
|
|
4837
4891
|
for (const t of this.getContainer().children)
|
|
4838
|
-
if (t instanceof
|
|
4892
|
+
if (t instanceof v.Container && t.label?.toString().startsWith("shotstack-track-") && t.children.includes(e.getContainer())) {
|
|
4839
4893
|
t.removeChild(e.getContainer());
|
|
4840
4894
|
break;
|
|
4841
4895
|
}
|
|
@@ -4848,7 +4902,7 @@ class le extends rt {
|
|
|
4848
4902
|
const { asset: t } = e.clipConfiguration;
|
|
4849
4903
|
if (t && "src" in t && typeof t.src == "string")
|
|
4850
4904
|
try {
|
|
4851
|
-
|
|
4905
|
+
v.Assets.unload(t.src);
|
|
4852
4906
|
} catch (i) {
|
|
4853
4907
|
console.warn(`Failed to unload asset: ${t.src}`, i);
|
|
4854
4908
|
}
|
|
@@ -4891,11 +4945,11 @@ class le extends rt {
|
|
|
4891
4945
|
break;
|
|
4892
4946
|
}
|
|
4893
4947
|
case "audio": {
|
|
4894
|
-
t = new
|
|
4948
|
+
t = new nt(this, e);
|
|
4895
4949
|
break;
|
|
4896
4950
|
}
|
|
4897
4951
|
case "luma": {
|
|
4898
|
-
t = new
|
|
4952
|
+
t = new Pt(this, e);
|
|
4899
4953
|
break;
|
|
4900
4954
|
}
|
|
4901
4955
|
default:
|
|
@@ -4909,12 +4963,12 @@ class le extends rt {
|
|
|
4909
4963
|
this.tracks[e].push(t), this.clips.push(t);
|
|
4910
4964
|
const i = 1e5 - (e + 1) * le.ZIndexPadding, s = `shotstack-track-${i}`;
|
|
4911
4965
|
let n = this.getContainer().getChildByLabel(s, !1);
|
|
4912
|
-
n || (n = new
|
|
4913
|
-
const r = t instanceof
|
|
4966
|
+
n || (n = new v.Container({ label: s, zIndex: i }), this.getContainer().addChild(n)), n.addChild(t.getContainer());
|
|
4967
|
+
const r = t instanceof Pt;
|
|
4914
4968
|
await t.load(), r && n.setMask({ mask: t.getMask(), inverse: !0 }), this.updateTotalDuration();
|
|
4915
4969
|
}
|
|
4916
4970
|
}
|
|
4917
|
-
class
|
|
4971
|
+
class _e extends ot {
|
|
4918
4972
|
static Width = 250;
|
|
4919
4973
|
static Height = 100;
|
|
4920
4974
|
fps;
|
|
@@ -4927,15 +4981,15 @@ class ke extends rt {
|
|
|
4927
4981
|
super(), this.background = null, this.text = null, this.fps = 0, this.playbackTime = 0, this.playbackDuration = 0, this.isPlaying = !1;
|
|
4928
4982
|
}
|
|
4929
4983
|
async load() {
|
|
4930
|
-
const e = new
|
|
4931
|
-
e.fillStyle = { color: "#424242", alpha: 0.5 }, e.rect(0, 0,
|
|
4932
|
-
const t = new
|
|
4984
|
+
const e = new v.Graphics();
|
|
4985
|
+
e.fillStyle = { color: "#424242", alpha: 0.5 }, e.rect(0, 0, _e.Width, _e.Height), e.fill(), this.getContainer().addChild(e), this.background = e;
|
|
4986
|
+
const t = new v.Text();
|
|
4933
4987
|
t.text = "", t.style = {
|
|
4934
4988
|
fontFamily: "monospace",
|
|
4935
4989
|
fontSize: 14,
|
|
4936
4990
|
fill: "#ffffff",
|
|
4937
4991
|
wordWrap: !0,
|
|
4938
|
-
wordWrapWidth:
|
|
4992
|
+
wordWrapWidth: _e.Width
|
|
4939
4993
|
}, this.getContainer().addChild(t), this.text = t;
|
|
4940
4994
|
}
|
|
4941
4995
|
update(e, t) {
|
|
@@ -4980,13 +5034,13 @@ class he {
|
|
|
4980
5034
|
maxZoom = 4;
|
|
4981
5035
|
currentZoom = 0.8;
|
|
4982
5036
|
constructor(e, t) {
|
|
4983
|
-
this.size = e, this.application = new
|
|
5037
|
+
this.size = e, this.application = new v.Application(), this.edit = t, this.inspector = new _e();
|
|
4984
5038
|
}
|
|
4985
5039
|
async load() {
|
|
4986
5040
|
const e = document.querySelector(he.CanvasSelector);
|
|
4987
5041
|
if (!e)
|
|
4988
5042
|
throw new Error(`Shotstack canvas root element '${he.CanvasSelector}' not found.`);
|
|
4989
|
-
this.registerExtensions(), this.container = new
|
|
5043
|
+
this.registerExtensions(), this.container = new v.Container(), this.background = new v.Graphics(), this.background.fillStyle = { color: "#424242" }, this.background.rect(0, 0, this.size.width, this.size.height), this.background.fill(), await this.configureApplication(), this.configureStage(), this.setupTouchHandling(e), this.edit.getContainer().scale = this.currentZoom, e.appendChild(this.application.canvas);
|
|
4990
5044
|
}
|
|
4991
5045
|
setupTouchHandling(e) {
|
|
4992
5046
|
const t = this.edit.getContainer();
|
|
@@ -4999,11 +5053,11 @@ class he {
|
|
|
4999
5053
|
const o = {
|
|
5000
5054
|
x: this.application.canvas.width / 2,
|
|
5001
5055
|
y: this.application.canvas.height / 2
|
|
5002
|
-
},
|
|
5056
|
+
}, l = {
|
|
5003
5057
|
x: t.position.x - o.x,
|
|
5004
5058
|
y: t.position.y - o.y
|
|
5005
5059
|
}, c = this.currentZoom / r;
|
|
5006
|
-
t.position.x = o.x +
|
|
5060
|
+
t.position.x = o.x + l.x * c, t.position.y = o.y + l.y * c, t.scale.x = this.currentZoom, t.scale.y = this.currentZoom;
|
|
5007
5061
|
}
|
|
5008
5062
|
},
|
|
5009
5063
|
{
|
|
@@ -5035,7 +5089,7 @@ class he {
|
|
|
5035
5089
|
t.scale.x = this.currentZoom, t.scale.y = this.currentZoom;
|
|
5036
5090
|
}
|
|
5037
5091
|
registerExtensions() {
|
|
5038
|
-
he.extensionsRegistered || (
|
|
5092
|
+
he.extensionsRegistered || (v.extensions.add(new He()), v.extensions.add(new Ve()), he.extensionsRegistered = !0);
|
|
5039
5093
|
}
|
|
5040
5094
|
async configureApplication() {
|
|
5041
5095
|
const e = {
|
|
@@ -5052,7 +5106,7 @@ class he {
|
|
|
5052
5106
|
configureStage() {
|
|
5053
5107
|
if (!this.container || !this.background)
|
|
5054
5108
|
throw new Error("Shotstack canvas container not set up.");
|
|
5055
|
-
this.container.addChild(this.background), this.container.addChild(this.edit.getContainer()), this.container.addChild(this.inspector.getContainer()), this.application.stage.addChild(this.container), this.application.stage.eventMode = "static", this.application.stage.hitArea = new
|
|
5109
|
+
this.container.addChild(this.background), this.container.addChild(this.edit.getContainer()), this.container.addChild(this.inspector.getContainer()), this.application.stage.addChild(this.container), this.application.stage.eventMode = "static", this.application.stage.hitArea = new v.Rectangle(0, 0, this.size.width, this.size.height), this.application.stage.on("click", this.onClick.bind(this)), this.edit.getContainer().position = {
|
|
5056
5110
|
x: this.application.canvas.width / 2 - this.edit.size.width * this.currentZoom / 2,
|
|
5057
5111
|
y: this.application.canvas.height / 2 - this.edit.size.height * this.currentZoom / 2
|
|
5058
5112
|
};
|
|
@@ -5142,7 +5196,7 @@ class xs {
|
|
|
5142
5196
|
edit;
|
|
5143
5197
|
application;
|
|
5144
5198
|
constructor(e, t) {
|
|
5145
|
-
this.edit = e, this.application = t.application, this.ffmpeg = new
|
|
5199
|
+
this.edit = e, this.application = t.application, this.ffmpeg = new Wt();
|
|
5146
5200
|
}
|
|
5147
5201
|
async init() {
|
|
5148
5202
|
if (!this.isReady)
|
|
@@ -5156,52 +5210,52 @@ class xs {
|
|
|
5156
5210
|
this.isReady || await this.init();
|
|
5157
5211
|
const i = this.edit.isPlaying, s = this.edit.playbackTime;
|
|
5158
5212
|
this.edit.pause();
|
|
5159
|
-
const n = this.edit.getContainer(), r = n.visible, { x: o, y:
|
|
5213
|
+
const n = this.edit.getContainer(), r = n.visible, { x: o, y: l } = n.position, { x: c, y: h } = n.scale;
|
|
5160
5214
|
n.visible = !1;
|
|
5161
5215
|
const g = this.createProgressOverlay();
|
|
5162
5216
|
try {
|
|
5163
|
-
const p = this.edit.getSize ? this.edit.getSize() : { width: 1920, height: 1080 },
|
|
5217
|
+
const p = this.edit.getSize ? this.edit.getSize() : { width: 1920, height: 1080 }, k = Math.ceil(this.edit.totalDuration * t / 1e3), A = 1e3 / t, S = 100, N = 50, J = 50, re = (T) => Math.round(T / k * N);
|
|
5164
5218
|
this.updateProgressOverlay(g, 0, S);
|
|
5165
|
-
const
|
|
5166
|
-
|
|
5167
|
-
const oe =
|
|
5219
|
+
const K = document.createElement("canvas");
|
|
5220
|
+
K.width = p.width, K.height = p.height;
|
|
5221
|
+
const oe = K.getContext("2d");
|
|
5168
5222
|
if (!oe)
|
|
5169
5223
|
throw new Error("Could not get 2D context for canvas");
|
|
5170
|
-
const
|
|
5224
|
+
const $e = this.findAudioPlayers();
|
|
5171
5225
|
this.updateProgressOverlay(g, 2, S);
|
|
5172
|
-
const
|
|
5173
|
-
if (
|
|
5226
|
+
const H = [];
|
|
5227
|
+
if ($e.length > 0) {
|
|
5174
5228
|
this.updateProgressOverlay(g, 3, S);
|
|
5175
|
-
for (let T = 0; T <
|
|
5176
|
-
const D = await this.processAudioTrack(
|
|
5177
|
-
D &&
|
|
5229
|
+
for (let T = 0; T < $e.length; T += 1) {
|
|
5230
|
+
const D = await this.processAudioTrack($e[T], T);
|
|
5231
|
+
D && H.push(D), this.updateProgressOverlay(g, 4 + T, S);
|
|
5178
5232
|
}
|
|
5179
5233
|
}
|
|
5180
5234
|
n.position.x = 0, n.position.y = 0, n.scale.x = 1, n.scale.y = 1;
|
|
5181
|
-
for (let T = 0; T <
|
|
5235
|
+
for (let T = 0; T < k; T += 1) {
|
|
5182
5236
|
this.edit.seek(T * A), this.edit.tick ? this.edit.tick(0, 0) : (this.edit.update?.(0, 0), this.edit.draw?.());
|
|
5183
5237
|
try {
|
|
5184
5238
|
const { extract: D } = this.application.renderer, E = D.canvas(n);
|
|
5185
|
-
oe.clearRect(0, 0,
|
|
5186
|
-
const
|
|
5187
|
-
await this.ffmpeg.writeFile(
|
|
5239
|
+
oe.clearRect(0, 0, K.width, K.height), oe.drawImage(E, 0, 0);
|
|
5240
|
+
const B = K.toDataURL("image/png"), Se = await (await fetch(B)).arrayBuffer(), Vt = `frame_${T.toString().padStart(6, "0")}.png`;
|
|
5241
|
+
await this.ffmpeg.writeFile(Vt, new Uint8Array(Se));
|
|
5188
5242
|
} catch (D) {
|
|
5189
5243
|
console.error(`Error capturing frame ${T}:`, D);
|
|
5190
5244
|
}
|
|
5191
5245
|
this.updateProgressOverlay(g, re(T + 1), S);
|
|
5192
5246
|
}
|
|
5193
5247
|
this.updateProgressOverlay(g, N, S);
|
|
5194
|
-
let
|
|
5195
|
-
for (const T of
|
|
5196
|
-
|
|
5197
|
-
if (
|
|
5248
|
+
let Y = ["-framerate", t.toString(), "-i", "frame_%06d.png"];
|
|
5249
|
+
for (const T of H)
|
|
5250
|
+
Y = Y.concat(["-i", T.filename]);
|
|
5251
|
+
if (Y = Y.concat(["-c:v", "libx264", "-pix_fmt", "yuv420p", "-crf", "23"]), H.length > 0) {
|
|
5198
5252
|
let T = "";
|
|
5199
|
-
for (let E = 0; E <
|
|
5200
|
-
const
|
|
5201
|
-
T += `[${
|
|
5253
|
+
for (let E = 0; E < H.length; E += 1) {
|
|
5254
|
+
const B = H[E], dt = E + 1, Se = Math.max(0, B.start);
|
|
5255
|
+
T += `[${dt}:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,apad,afade=t=in:st=0:d=0.05,atrim=start=0:end=${B.duration / 1e3 + 0.1},adelay=${Se}|${Se},volume=${B.volume}[a${E}];`;
|
|
5202
5256
|
}
|
|
5203
|
-
const D =
|
|
5204
|
-
T += D,
|
|
5257
|
+
const D = H.length > 1 ? `${H.map((E, B) => `[a${B}]`).join("")}amix=inputs=${H.length}:duration=longest:dropout_transition=0.5:normalize=0[aout]` : "[a0]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo[aout]";
|
|
5258
|
+
T += D, Y = Y.concat([
|
|
5205
5259
|
"-filter_complex",
|
|
5206
5260
|
T,
|
|
5207
5261
|
"-map",
|
|
@@ -5215,37 +5269,37 @@ class xs {
|
|
|
5215
5269
|
"-shortest"
|
|
5216
5270
|
]);
|
|
5217
5271
|
}
|
|
5218
|
-
const
|
|
5219
|
-
|
|
5220
|
-
let
|
|
5221
|
-
const
|
|
5272
|
+
const je = "output.mp4";
|
|
5273
|
+
Y.push(je);
|
|
5274
|
+
let lt = 0;
|
|
5275
|
+
const ht = ({ message: T }) => {
|
|
5222
5276
|
const D = T.includes("frame=") && T.includes("fps=") ? T.match(/frame=\s*(\d+)/) : null;
|
|
5223
5277
|
if (D?.[1]) {
|
|
5224
5278
|
const E = parseInt(D[1], 10);
|
|
5225
|
-
if (!Number.isNaN(E) && E >
|
|
5226
|
-
const
|
|
5227
|
-
this.updateProgressOverlay(g, N +
|
|
5279
|
+
if (!Number.isNaN(E) && E > lt && (lt = E, E <= k)) {
|
|
5280
|
+
const B = Math.round(E / k * J);
|
|
5281
|
+
this.updateProgressOverlay(g, N + B, S);
|
|
5228
5282
|
}
|
|
5229
5283
|
}
|
|
5230
5284
|
};
|
|
5231
|
-
this.ffmpeg.on("log",
|
|
5232
|
-
const
|
|
5233
|
-
|
|
5234
|
-
for (let T = 0; T <
|
|
5285
|
+
this.ffmpeg.on("log", ht), await this.ffmpeg.exec(Y), this.ffmpeg.off("log", ht), this.updateProgressOverlay(g, N + J, S);
|
|
5286
|
+
const Ue = await this.ffmpeg.readFile(je), Dt = Ue instanceof Uint8Array ? Ue : new TextEncoder().encode(Ue.toString()), Zt = new Blob([Dt], { type: "video/mp4" }), ut = URL.createObjectURL(Zt), We = document.createElement("a");
|
|
5287
|
+
We.href = ut, We.download = e, We.click(), URL.revokeObjectURL(ut);
|
|
5288
|
+
for (let T = 0; T < k; T += 1)
|
|
5235
5289
|
try {
|
|
5236
5290
|
await this.ffmpeg.deleteFile(`frame_${T.toString().padStart(6, "0")}.png`);
|
|
5237
5291
|
} catch {
|
|
5238
5292
|
}
|
|
5239
|
-
for (const T of
|
|
5293
|
+
for (const T of H)
|
|
5240
5294
|
try {
|
|
5241
5295
|
await this.ffmpeg.deleteFile(T.filename);
|
|
5242
5296
|
} catch {
|
|
5243
5297
|
}
|
|
5244
|
-
await this.ffmpeg.deleteFile(
|
|
5298
|
+
await this.ffmpeg.deleteFile(je), this.updateProgressOverlay(g, S, S);
|
|
5245
5299
|
} catch (p) {
|
|
5246
5300
|
throw console.error("Error during export:", p), p;
|
|
5247
5301
|
} finally {
|
|
5248
|
-
this.removeProgressOverlay(g), n.position.x = o, n.position.y =
|
|
5302
|
+
this.removeProgressOverlay(g), n.position.x = o, n.position.y = l, n.scale.x = c, n.scale.y = h, n.visible = r, this.edit.seek(s), i && this.edit.play();
|
|
5249
5303
|
}
|
|
5250
5304
|
}
|
|
5251
5305
|
findAudioPlayers() {
|
|
@@ -5256,7 +5310,7 @@ class xs {
|
|
|
5256
5310
|
if (Array.isArray(s))
|
|
5257
5311
|
for (let n = 0; n < s.length; n += 1) {
|
|
5258
5312
|
const r = s[n];
|
|
5259
|
-
(r instanceof
|
|
5313
|
+
(r instanceof nt || r.constructor.name === "AudioPlayer" || r.clipConfiguration?.asset?.type === "audio") && (e.includes(r) || e.push(r));
|
|
5260
5314
|
}
|
|
5261
5315
|
}
|
|
5262
5316
|
return this.searchContainerForPlayers(this.edit.getContainer(), e), e;
|
|
@@ -5264,14 +5318,14 @@ class xs {
|
|
|
5264
5318
|
searchContainerForPlayers(e, t) {
|
|
5265
5319
|
if (e) {
|
|
5266
5320
|
for (const i of e.children)
|
|
5267
|
-
if (i instanceof
|
|
5321
|
+
if (i instanceof v.Container) {
|
|
5268
5322
|
if (i.label?.startsWith("shotstack-track-")) {
|
|
5269
5323
|
for (const n of i.children)
|
|
5270
|
-
if (n instanceof
|
|
5324
|
+
if (n instanceof v.Container) {
|
|
5271
5325
|
const r = n, o = ["player", "clip", "audioPlayer", "entity"];
|
|
5272
|
-
for (const
|
|
5273
|
-
const c = r[
|
|
5274
|
-
c instanceof
|
|
5326
|
+
for (const l of o) {
|
|
5327
|
+
const c = r[l];
|
|
5328
|
+
c instanceof nt && !t.includes(c) && t.push(c);
|
|
5275
5329
|
}
|
|
5276
5330
|
}
|
|
5277
5331
|
}
|