@shotstack/shotstack-studio 1.2.1 → 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 +2 -1
- package/dist/core/schemas/asset.d.ts +10 -6
- package/dist/core/schemas/audio-asset.d.ts +10 -6
- package/dist/core/schemas/clip.d.ts +35 -21
- package/dist/core/schemas/edit.d.ts +70 -42
- package/dist/core/schemas/track.d.ts +35 -21
- package/dist/core/schemas/video-asset.d.ts +10 -6
- package/dist/shotstack-studio.es.js +269 -276
- package/dist/shotstack-studio.umd.js +3 -3
- package/package.json +1 -1
|
@@ -42,15 +42,12 @@ class Te {
|
|
|
42
42
|
async load(e, t) {
|
|
43
43
|
this.updateAssetLoadMetadata(e, "pending", 0);
|
|
44
44
|
try {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
const s = await v.Assets.load(t, (n) => {
|
|
51
|
-
this.updateAssetLoadMetadata(e, "loading", n);
|
|
45
|
+
if (await this.shouldUseSafariVideoLoader(t))
|
|
46
|
+
return await this.loadVideoForSafari(e, t);
|
|
47
|
+
const i = await v.Assets.load(t, (s) => {
|
|
48
|
+
this.updateAssetLoadMetadata(e, "loading", s);
|
|
52
49
|
});
|
|
53
|
-
return this.updateAssetLoadMetadata(e, "success", 1),
|
|
50
|
+
return this.updateAssetLoadMetadata(e, "success", 1), i;
|
|
54
51
|
} catch {
|
|
55
52
|
return this.updateAssetLoadMetadata(e, "failed", 1), null;
|
|
56
53
|
}
|
|
@@ -84,31 +81,27 @@ class Te {
|
|
|
84
81
|
const t = await this.getContentType(e);
|
|
85
82
|
return t?.startsWith("video/") ? document.createElement("video").canPlayType(t) !== "" : !1;
|
|
86
83
|
}
|
|
87
|
-
async
|
|
88
|
-
const
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
() => {
|
|
107
|
-
c(), r(new Error("Video loading failed"));
|
|
108
|
-
},
|
|
109
|
-
{ once: !0 }
|
|
110
|
-
), this.updateAssetLoadMetadata(e, "loading", 0.5), o.src = t;
|
|
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;
|
|
111
103
|
});
|
|
104
|
+
return this.updateAssetLoadMetadata(e, "success", 1), n;
|
|
112
105
|
}
|
|
113
106
|
updateAssetLoadMetadata(e, t, i) {
|
|
114
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 };
|
|
@@ -141,8 +134,8 @@ class Ve {
|
|
|
141
134
|
}
|
|
142
135
|
if (await this.loadWoff2Decompressor(), !this.woff2Decompressor)
|
|
143
136
|
throw new Error("Cannot initialize Woff2 decompressor.");
|
|
144
|
-
const r = this.woff2Decompressor.decompress(n), o = ft.parse(new Uint8Array(r).buffer),
|
|
145
|
-
return await
|
|
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})`);
|
|
138
|
+
return await g.load(), document.fonts.add(g), g;
|
|
146
139
|
}
|
|
147
140
|
async loadWoff2Decompressor() {
|
|
148
141
|
if (this.woff2Decompressor)
|
|
@@ -287,10 +280,10 @@ class F extends Error {
|
|
|
287
280
|
else if (r.path.length === 0)
|
|
288
281
|
i._errors.push(t(r));
|
|
289
282
|
else {
|
|
290
|
-
let o = i,
|
|
291
|
-
for (;
|
|
292
|
-
const c = r.path[
|
|
293
|
-
|
|
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++;
|
|
294
287
|
}
|
|
295
288
|
}
|
|
296
289
|
};
|
|
@@ -392,8 +385,8 @@ const qe = (a) => {
|
|
|
392
385
|
message: s.message
|
|
393
386
|
};
|
|
394
387
|
let o = "";
|
|
395
|
-
const
|
|
396
|
-
for (const c of
|
|
388
|
+
const l = i.filter((c) => !!c).slice().reverse();
|
|
389
|
+
for (const c of l)
|
|
397
390
|
o = c(r, { data: e, defaultError: o }).message;
|
|
398
391
|
return {
|
|
399
392
|
...s,
|
|
@@ -471,10 +464,10 @@ function Rt(a, e, t, i, s) {
|
|
|
471
464
|
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
472
465
|
return e.set(a, t), t;
|
|
473
466
|
}
|
|
474
|
-
var
|
|
467
|
+
var m;
|
|
475
468
|
(function(a) {
|
|
476
469
|
a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
477
|
-
})(
|
|
470
|
+
})(m || (m = {}));
|
|
478
471
|
var ve, xe;
|
|
479
472
|
class V {
|
|
480
473
|
constructor(e, t, i, s) {
|
|
@@ -506,9 +499,9 @@ function _(a) {
|
|
|
506
499
|
if (e && (t || i))
|
|
507
500
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
508
501
|
return e ? { errorMap: e, description: s } : { errorMap: (r, o) => {
|
|
509
|
-
var
|
|
510
|
-
const { message:
|
|
511
|
-
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 };
|
|
512
505
|
}, description: s };
|
|
513
506
|
}
|
|
514
507
|
class b {
|
|
@@ -634,7 +627,7 @@ class b {
|
|
|
634
627
|
code: u.custom,
|
|
635
628
|
...i(s)
|
|
636
629
|
});
|
|
637
|
-
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);
|
|
638
631
|
});
|
|
639
632
|
}
|
|
640
633
|
refinement(e, t) {
|
|
@@ -921,7 +914,7 @@ class j extends b {
|
|
|
921
914
|
return this.refinement((s) => e.test(s), {
|
|
922
915
|
validation: t,
|
|
923
916
|
code: u.invalid_string,
|
|
924
|
-
...
|
|
917
|
+
...m.errToObj(i)
|
|
925
918
|
});
|
|
926
919
|
}
|
|
927
920
|
_addCheck(e) {
|
|
@@ -931,46 +924,46 @@ class j extends b {
|
|
|
931
924
|
});
|
|
932
925
|
}
|
|
933
926
|
email(e) {
|
|
934
|
-
return this._addCheck({ kind: "email", ...
|
|
927
|
+
return this._addCheck({ kind: "email", ...m.errToObj(e) });
|
|
935
928
|
}
|
|
936
929
|
url(e) {
|
|
937
|
-
return this._addCheck({ kind: "url", ...
|
|
930
|
+
return this._addCheck({ kind: "url", ...m.errToObj(e) });
|
|
938
931
|
}
|
|
939
932
|
emoji(e) {
|
|
940
|
-
return this._addCheck({ kind: "emoji", ...
|
|
933
|
+
return this._addCheck({ kind: "emoji", ...m.errToObj(e) });
|
|
941
934
|
}
|
|
942
935
|
uuid(e) {
|
|
943
|
-
return this._addCheck({ kind: "uuid", ...
|
|
936
|
+
return this._addCheck({ kind: "uuid", ...m.errToObj(e) });
|
|
944
937
|
}
|
|
945
938
|
nanoid(e) {
|
|
946
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
939
|
+
return this._addCheck({ kind: "nanoid", ...m.errToObj(e) });
|
|
947
940
|
}
|
|
948
941
|
cuid(e) {
|
|
949
|
-
return this._addCheck({ kind: "cuid", ...
|
|
942
|
+
return this._addCheck({ kind: "cuid", ...m.errToObj(e) });
|
|
950
943
|
}
|
|
951
944
|
cuid2(e) {
|
|
952
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
945
|
+
return this._addCheck({ kind: "cuid2", ...m.errToObj(e) });
|
|
953
946
|
}
|
|
954
947
|
ulid(e) {
|
|
955
|
-
return this._addCheck({ kind: "ulid", ...
|
|
948
|
+
return this._addCheck({ kind: "ulid", ...m.errToObj(e) });
|
|
956
949
|
}
|
|
957
950
|
base64(e) {
|
|
958
|
-
return this._addCheck({ kind: "base64", ...
|
|
951
|
+
return this._addCheck({ kind: "base64", ...m.errToObj(e) });
|
|
959
952
|
}
|
|
960
953
|
base64url(e) {
|
|
961
954
|
return this._addCheck({
|
|
962
955
|
kind: "base64url",
|
|
963
|
-
...
|
|
956
|
+
...m.errToObj(e)
|
|
964
957
|
});
|
|
965
958
|
}
|
|
966
959
|
jwt(e) {
|
|
967
|
-
return this._addCheck({ kind: "jwt", ...
|
|
960
|
+
return this._addCheck({ kind: "jwt", ...m.errToObj(e) });
|
|
968
961
|
}
|
|
969
962
|
ip(e) {
|
|
970
|
-
return this._addCheck({ kind: "ip", ...
|
|
963
|
+
return this._addCheck({ kind: "ip", ...m.errToObj(e) });
|
|
971
964
|
}
|
|
972
965
|
cidr(e) {
|
|
973
|
-
return this._addCheck({ kind: "cidr", ...
|
|
966
|
+
return this._addCheck({ kind: "cidr", ...m.errToObj(e) });
|
|
974
967
|
}
|
|
975
968
|
datetime(e) {
|
|
976
969
|
var t, i;
|
|
@@ -985,7 +978,7 @@ class j extends b {
|
|
|
985
978
|
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
986
979
|
offset: (t = e?.offset) !== null && t !== void 0 ? t : !1,
|
|
987
980
|
local: (i = e?.local) !== null && i !== void 0 ? i : !1,
|
|
988
|
-
...
|
|
981
|
+
...m.errToObj(e?.message)
|
|
989
982
|
});
|
|
990
983
|
}
|
|
991
984
|
date(e) {
|
|
@@ -999,17 +992,17 @@ class j extends b {
|
|
|
999
992
|
}) : this._addCheck({
|
|
1000
993
|
kind: "time",
|
|
1001
994
|
precision: typeof e?.precision > "u" ? null : e?.precision,
|
|
1002
|
-
...
|
|
995
|
+
...m.errToObj(e?.message)
|
|
1003
996
|
});
|
|
1004
997
|
}
|
|
1005
998
|
duration(e) {
|
|
1006
|
-
return this._addCheck({ kind: "duration", ...
|
|
999
|
+
return this._addCheck({ kind: "duration", ...m.errToObj(e) });
|
|
1007
1000
|
}
|
|
1008
1001
|
regex(e, t) {
|
|
1009
1002
|
return this._addCheck({
|
|
1010
1003
|
kind: "regex",
|
|
1011
1004
|
regex: e,
|
|
1012
|
-
...
|
|
1005
|
+
...m.errToObj(t)
|
|
1013
1006
|
});
|
|
1014
1007
|
}
|
|
1015
1008
|
includes(e, t) {
|
|
@@ -1017,49 +1010,49 @@ class j extends b {
|
|
|
1017
1010
|
kind: "includes",
|
|
1018
1011
|
value: e,
|
|
1019
1012
|
position: t?.position,
|
|
1020
|
-
...
|
|
1013
|
+
...m.errToObj(t?.message)
|
|
1021
1014
|
});
|
|
1022
1015
|
}
|
|
1023
1016
|
startsWith(e, t) {
|
|
1024
1017
|
return this._addCheck({
|
|
1025
1018
|
kind: "startsWith",
|
|
1026
1019
|
value: e,
|
|
1027
|
-
...
|
|
1020
|
+
...m.errToObj(t)
|
|
1028
1021
|
});
|
|
1029
1022
|
}
|
|
1030
1023
|
endsWith(e, t) {
|
|
1031
1024
|
return this._addCheck({
|
|
1032
1025
|
kind: "endsWith",
|
|
1033
1026
|
value: e,
|
|
1034
|
-
...
|
|
1027
|
+
...m.errToObj(t)
|
|
1035
1028
|
});
|
|
1036
1029
|
}
|
|
1037
1030
|
min(e, t) {
|
|
1038
1031
|
return this._addCheck({
|
|
1039
1032
|
kind: "min",
|
|
1040
1033
|
value: e,
|
|
1041
|
-
...
|
|
1034
|
+
...m.errToObj(t)
|
|
1042
1035
|
});
|
|
1043
1036
|
}
|
|
1044
1037
|
max(e, t) {
|
|
1045
1038
|
return this._addCheck({
|
|
1046
1039
|
kind: "max",
|
|
1047
1040
|
value: e,
|
|
1048
|
-
...
|
|
1041
|
+
...m.errToObj(t)
|
|
1049
1042
|
});
|
|
1050
1043
|
}
|
|
1051
1044
|
length(e, t) {
|
|
1052
1045
|
return this._addCheck({
|
|
1053
1046
|
kind: "length",
|
|
1054
1047
|
value: e,
|
|
1055
|
-
...
|
|
1048
|
+
...m.errToObj(t)
|
|
1056
1049
|
});
|
|
1057
1050
|
}
|
|
1058
1051
|
/**
|
|
1059
1052
|
* Equivalent to `.min(1)`
|
|
1060
1053
|
*/
|
|
1061
1054
|
nonempty(e) {
|
|
1062
|
-
return this.min(1,
|
|
1055
|
+
return this.min(1, m.errToObj(e));
|
|
1063
1056
|
}
|
|
1064
1057
|
trim() {
|
|
1065
1058
|
return new j({
|
|
@@ -1199,16 +1192,16 @@ class pe extends b {
|
|
|
1199
1192
|
return { status: s.value, value: e.data };
|
|
1200
1193
|
}
|
|
1201
1194
|
gte(e, t) {
|
|
1202
|
-
return this.setLimit("min", e, !0,
|
|
1195
|
+
return this.setLimit("min", e, !0, m.toString(t));
|
|
1203
1196
|
}
|
|
1204
1197
|
gt(e, t) {
|
|
1205
|
-
return this.setLimit("min", e, !1,
|
|
1198
|
+
return this.setLimit("min", e, !1, m.toString(t));
|
|
1206
1199
|
}
|
|
1207
1200
|
lte(e, t) {
|
|
1208
|
-
return this.setLimit("max", e, !0,
|
|
1201
|
+
return this.setLimit("max", e, !0, m.toString(t));
|
|
1209
1202
|
}
|
|
1210
1203
|
lt(e, t) {
|
|
1211
|
-
return this.setLimit("max", e, !1,
|
|
1204
|
+
return this.setLimit("max", e, !1, m.toString(t));
|
|
1212
1205
|
}
|
|
1213
1206
|
setLimit(e, t, i, s) {
|
|
1214
1207
|
return new pe({
|
|
@@ -1219,7 +1212,7 @@ class pe extends b {
|
|
|
1219
1212
|
kind: e,
|
|
1220
1213
|
value: t,
|
|
1221
1214
|
inclusive: i,
|
|
1222
|
-
message:
|
|
1215
|
+
message: m.toString(s)
|
|
1223
1216
|
}
|
|
1224
1217
|
]
|
|
1225
1218
|
});
|
|
@@ -1233,7 +1226,7 @@ class pe extends b {
|
|
|
1233
1226
|
int(e) {
|
|
1234
1227
|
return this._addCheck({
|
|
1235
1228
|
kind: "int",
|
|
1236
|
-
message:
|
|
1229
|
+
message: m.toString(e)
|
|
1237
1230
|
});
|
|
1238
1231
|
}
|
|
1239
1232
|
positive(e) {
|
|
@@ -1241,7 +1234,7 @@ class pe extends b {
|
|
|
1241
1234
|
kind: "min",
|
|
1242
1235
|
value: 0,
|
|
1243
1236
|
inclusive: !1,
|
|
1244
|
-
message:
|
|
1237
|
+
message: m.toString(e)
|
|
1245
1238
|
});
|
|
1246
1239
|
}
|
|
1247
1240
|
negative(e) {
|
|
@@ -1249,7 +1242,7 @@ class pe extends b {
|
|
|
1249
1242
|
kind: "max",
|
|
1250
1243
|
value: 0,
|
|
1251
1244
|
inclusive: !1,
|
|
1252
|
-
message:
|
|
1245
|
+
message: m.toString(e)
|
|
1253
1246
|
});
|
|
1254
1247
|
}
|
|
1255
1248
|
nonpositive(e) {
|
|
@@ -1257,7 +1250,7 @@ class pe extends b {
|
|
|
1257
1250
|
kind: "max",
|
|
1258
1251
|
value: 0,
|
|
1259
1252
|
inclusive: !0,
|
|
1260
|
-
message:
|
|
1253
|
+
message: m.toString(e)
|
|
1261
1254
|
});
|
|
1262
1255
|
}
|
|
1263
1256
|
nonnegative(e) {
|
|
@@ -1265,20 +1258,20 @@ class pe extends b {
|
|
|
1265
1258
|
kind: "min",
|
|
1266
1259
|
value: 0,
|
|
1267
1260
|
inclusive: !0,
|
|
1268
|
-
message:
|
|
1261
|
+
message: m.toString(e)
|
|
1269
1262
|
});
|
|
1270
1263
|
}
|
|
1271
1264
|
multipleOf(e, t) {
|
|
1272
1265
|
return this._addCheck({
|
|
1273
1266
|
kind: "multipleOf",
|
|
1274
1267
|
value: e,
|
|
1275
|
-
message:
|
|
1268
|
+
message: m.toString(t)
|
|
1276
1269
|
});
|
|
1277
1270
|
}
|
|
1278
1271
|
finite(e) {
|
|
1279
1272
|
return this._addCheck({
|
|
1280
1273
|
kind: "finite",
|
|
1281
|
-
message:
|
|
1274
|
+
message: m.toString(e)
|
|
1282
1275
|
});
|
|
1283
1276
|
}
|
|
1284
1277
|
safe(e) {
|
|
@@ -1286,12 +1279,12 @@ class pe extends b {
|
|
|
1286
1279
|
kind: "min",
|
|
1287
1280
|
inclusive: !0,
|
|
1288
1281
|
value: Number.MIN_SAFE_INTEGER,
|
|
1289
|
-
message:
|
|
1282
|
+
message: m.toString(e)
|
|
1290
1283
|
})._addCheck({
|
|
1291
1284
|
kind: "max",
|
|
1292
1285
|
inclusive: !0,
|
|
1293
1286
|
value: Number.MAX_SAFE_INTEGER,
|
|
1294
|
-
message:
|
|
1287
|
+
message: m.toString(e)
|
|
1295
1288
|
});
|
|
1296
1289
|
}
|
|
1297
1290
|
get minValue() {
|
|
@@ -1369,16 +1362,16 @@ class me extends b {
|
|
|
1369
1362
|
}), w;
|
|
1370
1363
|
}
|
|
1371
1364
|
gte(e, t) {
|
|
1372
|
-
return this.setLimit("min", e, !0,
|
|
1365
|
+
return this.setLimit("min", e, !0, m.toString(t));
|
|
1373
1366
|
}
|
|
1374
1367
|
gt(e, t) {
|
|
1375
|
-
return this.setLimit("min", e, !1,
|
|
1368
|
+
return this.setLimit("min", e, !1, m.toString(t));
|
|
1376
1369
|
}
|
|
1377
1370
|
lte(e, t) {
|
|
1378
|
-
return this.setLimit("max", e, !0,
|
|
1371
|
+
return this.setLimit("max", e, !0, m.toString(t));
|
|
1379
1372
|
}
|
|
1380
1373
|
lt(e, t) {
|
|
1381
|
-
return this.setLimit("max", e, !1,
|
|
1374
|
+
return this.setLimit("max", e, !1, m.toString(t));
|
|
1382
1375
|
}
|
|
1383
1376
|
setLimit(e, t, i, s) {
|
|
1384
1377
|
return new me({
|
|
@@ -1389,7 +1382,7 @@ class me extends b {
|
|
|
1389
1382
|
kind: e,
|
|
1390
1383
|
value: t,
|
|
1391
1384
|
inclusive: i,
|
|
1392
|
-
message:
|
|
1385
|
+
message: m.toString(s)
|
|
1393
1386
|
}
|
|
1394
1387
|
]
|
|
1395
1388
|
});
|
|
@@ -1405,7 +1398,7 @@ class me extends b {
|
|
|
1405
1398
|
kind: "min",
|
|
1406
1399
|
value: BigInt(0),
|
|
1407
1400
|
inclusive: !1,
|
|
1408
|
-
message:
|
|
1401
|
+
message: m.toString(e)
|
|
1409
1402
|
});
|
|
1410
1403
|
}
|
|
1411
1404
|
negative(e) {
|
|
@@ -1413,7 +1406,7 @@ class me extends b {
|
|
|
1413
1406
|
kind: "max",
|
|
1414
1407
|
value: BigInt(0),
|
|
1415
1408
|
inclusive: !1,
|
|
1416
|
-
message:
|
|
1409
|
+
message: m.toString(e)
|
|
1417
1410
|
});
|
|
1418
1411
|
}
|
|
1419
1412
|
nonpositive(e) {
|
|
@@ -1421,7 +1414,7 @@ class me extends b {
|
|
|
1421
1414
|
kind: "max",
|
|
1422
1415
|
value: BigInt(0),
|
|
1423
1416
|
inclusive: !0,
|
|
1424
|
-
message:
|
|
1417
|
+
message: m.toString(e)
|
|
1425
1418
|
});
|
|
1426
1419
|
}
|
|
1427
1420
|
nonnegative(e) {
|
|
@@ -1429,14 +1422,14 @@ class me extends b {
|
|
|
1429
1422
|
kind: "min",
|
|
1430
1423
|
value: BigInt(0),
|
|
1431
1424
|
inclusive: !0,
|
|
1432
|
-
message:
|
|
1425
|
+
message: m.toString(e)
|
|
1433
1426
|
});
|
|
1434
1427
|
}
|
|
1435
1428
|
multipleOf(e, t) {
|
|
1436
1429
|
return this._addCheck({
|
|
1437
1430
|
kind: "multipleOf",
|
|
1438
1431
|
value: e,
|
|
1439
|
-
message:
|
|
1432
|
+
message: m.toString(t)
|
|
1440
1433
|
});
|
|
1441
1434
|
}
|
|
1442
1435
|
get minValue() {
|
|
@@ -1528,14 +1521,14 @@ class be extends b {
|
|
|
1528
1521
|
return this._addCheck({
|
|
1529
1522
|
kind: "min",
|
|
1530
1523
|
value: e.getTime(),
|
|
1531
|
-
message:
|
|
1524
|
+
message: m.toString(t)
|
|
1532
1525
|
});
|
|
1533
1526
|
}
|
|
1534
1527
|
max(e, t) {
|
|
1535
1528
|
return this._addCheck({
|
|
1536
1529
|
kind: "max",
|
|
1537
1530
|
value: e.getTime(),
|
|
1538
|
-
message:
|
|
1531
|
+
message: m.toString(t)
|
|
1539
1532
|
});
|
|
1540
1533
|
}
|
|
1541
1534
|
get minDate() {
|
|
@@ -1709,19 +1702,19 @@ class Z extends b {
|
|
|
1709
1702
|
min(e, t) {
|
|
1710
1703
|
return new Z({
|
|
1711
1704
|
...this._def,
|
|
1712
|
-
minLength: { value: e, message:
|
|
1705
|
+
minLength: { value: e, message: m.toString(t) }
|
|
1713
1706
|
});
|
|
1714
1707
|
}
|
|
1715
1708
|
max(e, t) {
|
|
1716
1709
|
return new Z({
|
|
1717
1710
|
...this._def,
|
|
1718
|
-
maxLength: { value: e, message:
|
|
1711
|
+
maxLength: { value: e, message: m.toString(t) }
|
|
1719
1712
|
});
|
|
1720
1713
|
}
|
|
1721
1714
|
length(e, t) {
|
|
1722
1715
|
return new Z({
|
|
1723
1716
|
...this._def,
|
|
1724
|
-
exactLength: { value: e, message:
|
|
1717
|
+
exactLength: { value: e, message: m.toString(t) }
|
|
1725
1718
|
});
|
|
1726
1719
|
}
|
|
1727
1720
|
nonempty(e) {
|
|
@@ -1775,22 +1768,22 @@ class P extends b {
|
|
|
1775
1768
|
if (!(this._def.catchall instanceof G && this._def.unknownKeys === "strip"))
|
|
1776
1769
|
for (const c in s.data)
|
|
1777
1770
|
r.includes(c) || o.push(c);
|
|
1778
|
-
const
|
|
1771
|
+
const l = [];
|
|
1779
1772
|
for (const c of r) {
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1773
|
+
const h = n[c], g = s.data[c];
|
|
1774
|
+
l.push({
|
|
1782
1775
|
key: { status: "valid", value: c },
|
|
1783
|
-
value:
|
|
1776
|
+
value: h._parse(new V(s, g, s.path, c)),
|
|
1784
1777
|
alwaysSet: c in s.data
|
|
1785
1778
|
});
|
|
1786
1779
|
}
|
|
1787
1780
|
if (this._def.catchall instanceof G) {
|
|
1788
1781
|
const c = this._def.unknownKeys;
|
|
1789
1782
|
if (c === "passthrough")
|
|
1790
|
-
for (const
|
|
1791
|
-
|
|
1792
|
-
key: { status: "valid", value:
|
|
1793
|
-
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] }
|
|
1794
1787
|
});
|
|
1795
1788
|
else if (c === "strict")
|
|
1796
1789
|
o.length > 0 && (d(s, {
|
|
@@ -1800,46 +1793,46 @@ class P extends b {
|
|
|
1800
1793
|
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1801
1794
|
} else {
|
|
1802
1795
|
const c = this._def.catchall;
|
|
1803
|
-
for (const
|
|
1804
|
-
const
|
|
1805
|
-
|
|
1806
|
-
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 },
|
|
1807
1800
|
value: c._parse(
|
|
1808
|
-
new V(s,
|
|
1801
|
+
new V(s, g, s.path, h)
|
|
1809
1802
|
//, ctx.child(key), value, getParsedType(value)
|
|
1810
1803
|
),
|
|
1811
|
-
alwaysSet:
|
|
1804
|
+
alwaysSet: h in s.data
|
|
1812
1805
|
});
|
|
1813
1806
|
}
|
|
1814
1807
|
}
|
|
1815
1808
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1816
1809
|
const c = [];
|
|
1817
|
-
for (const
|
|
1818
|
-
const
|
|
1810
|
+
for (const h of l) {
|
|
1811
|
+
const g = await h.key, p = await h.value;
|
|
1819
1812
|
c.push({
|
|
1820
|
-
key:
|
|
1813
|
+
key: g,
|
|
1821
1814
|
value: p,
|
|
1822
|
-
alwaysSet:
|
|
1815
|
+
alwaysSet: h.alwaysSet
|
|
1823
1816
|
});
|
|
1824
1817
|
}
|
|
1825
1818
|
return c;
|
|
1826
|
-
}).then((c) => z.mergeObjectSync(i, c)) : z.mergeObjectSync(i,
|
|
1819
|
+
}).then((c) => z.mergeObjectSync(i, c)) : z.mergeObjectSync(i, l);
|
|
1827
1820
|
}
|
|
1828
1821
|
get shape() {
|
|
1829
1822
|
return this._def.shape();
|
|
1830
1823
|
}
|
|
1831
1824
|
strict(e) {
|
|
1832
|
-
return
|
|
1825
|
+
return m.errToObj, new P({
|
|
1833
1826
|
...this._def,
|
|
1834
1827
|
unknownKeys: "strict",
|
|
1835
1828
|
...e !== void 0 ? {
|
|
1836
1829
|
errorMap: (t, i) => {
|
|
1837
1830
|
var s, n, r, o;
|
|
1838
|
-
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;
|
|
1839
1832
|
return t.code === "unrecognized_keys" ? {
|
|
1840
|
-
message: (o =
|
|
1833
|
+
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : l
|
|
1841
1834
|
} : {
|
|
1842
|
-
message:
|
|
1835
|
+
message: l
|
|
1843
1836
|
};
|
|
1844
1837
|
}
|
|
1845
1838
|
} : {}
|
|
@@ -2077,7 +2070,7 @@ class Re extends b {
|
|
|
2077
2070
|
{
|
|
2078
2071
|
let n;
|
|
2079
2072
|
const r = [];
|
|
2080
|
-
for (const
|
|
2073
|
+
for (const l of i) {
|
|
2081
2074
|
const c = {
|
|
2082
2075
|
...t,
|
|
2083
2076
|
common: {
|
|
@@ -2085,18 +2078,18 @@ class Re extends b {
|
|
|
2085
2078
|
issues: []
|
|
2086
2079
|
},
|
|
2087
2080
|
parent: null
|
|
2088
|
-
},
|
|
2081
|
+
}, h = l._parseSync({
|
|
2089
2082
|
data: t.data,
|
|
2090
2083
|
path: t.path,
|
|
2091
2084
|
parent: c
|
|
2092
2085
|
});
|
|
2093
|
-
if (
|
|
2094
|
-
return
|
|
2095
|
-
|
|
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);
|
|
2096
2089
|
}
|
|
2097
2090
|
if (n)
|
|
2098
2091
|
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
2099
|
-
const o = r.map((
|
|
2092
|
+
const o = r.map((l) => new F(l));
|
|
2100
2093
|
return d(t, {
|
|
2101
2094
|
code: u.invalid_union,
|
|
2102
2095
|
unionErrors: o
|
|
@@ -2182,10 +2175,10 @@ function tt(a, e) {
|
|
|
2182
2175
|
if (t === f.object && i === f.object) {
|
|
2183
2176
|
const s = C.objectKeys(e), n = C.objectKeys(a).filter((o) => s.indexOf(o) !== -1), r = { ...a, ...e };
|
|
2184
2177
|
for (const o of n) {
|
|
2185
|
-
const
|
|
2186
|
-
if (!
|
|
2178
|
+
const l = tt(a[o], e[o]);
|
|
2179
|
+
if (!l.valid)
|
|
2187
2180
|
return { valid: !1 };
|
|
2188
|
-
r[o] =
|
|
2181
|
+
r[o] = l.data;
|
|
2189
2182
|
}
|
|
2190
2183
|
return { valid: !0, data: r };
|
|
2191
2184
|
} else if (t === f.array && i === f.array) {
|
|
@@ -2193,10 +2186,10 @@ function tt(a, e) {
|
|
|
2193
2186
|
return { valid: !1 };
|
|
2194
2187
|
const s = [];
|
|
2195
2188
|
for (let n = 0; n < a.length; n++) {
|
|
2196
|
-
const r = a[n], o = e[n],
|
|
2197
|
-
if (!
|
|
2189
|
+
const r = a[n], o = e[n], l = tt(r, o);
|
|
2190
|
+
if (!l.valid)
|
|
2198
2191
|
return { valid: !1 };
|
|
2199
|
-
s.push(
|
|
2192
|
+
s.push(l.data);
|
|
2200
2193
|
}
|
|
2201
2194
|
return { valid: !0, data: s };
|
|
2202
2195
|
} else return t === f.date && i === f.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
|
|
@@ -2264,8 +2257,8 @@ class W extends b {
|
|
|
2264
2257
|
type: "array"
|
|
2265
2258
|
}), t.dirty());
|
|
2266
2259
|
const n = [...i.data].map((r, o) => {
|
|
2267
|
-
const
|
|
2268
|
-
return
|
|
2260
|
+
const l = this._def.items[o] || this._def.rest;
|
|
2261
|
+
return l ? l._parse(new V(i, r, i.path, o)) : null;
|
|
2269
2262
|
}).filter((r) => !!r);
|
|
2270
2263
|
return i.common.async ? Promise.all(n).then((r) => z.mergeArray(t, r)) : z.mergeArray(t, n);
|
|
2271
2264
|
}
|
|
@@ -2345,28 +2338,28 @@ class it extends b {
|
|
|
2345
2338
|
expected: f.map,
|
|
2346
2339
|
received: i.parsedType
|
|
2347
2340
|
}), w;
|
|
2348
|
-
const s = this._def.keyType, n = this._def.valueType, r = [...i.data.entries()].map(([o,
|
|
2341
|
+
const s = this._def.keyType, n = this._def.valueType, r = [...i.data.entries()].map(([o, l], c) => ({
|
|
2349
2342
|
key: s._parse(new V(i, o, i.path, [c, "key"])),
|
|
2350
|
-
value: n._parse(new V(i,
|
|
2343
|
+
value: n._parse(new V(i, l, i.path, [c, "value"]))
|
|
2351
2344
|
}));
|
|
2352
2345
|
if (i.common.async) {
|
|
2353
2346
|
const o = /* @__PURE__ */ new Map();
|
|
2354
2347
|
return Promise.resolve().then(async () => {
|
|
2355
|
-
for (const
|
|
2356
|
-
const c = await
|
|
2357
|
-
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")
|
|
2358
2351
|
return w;
|
|
2359
|
-
(c.status === "dirty" ||
|
|
2352
|
+
(c.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(c.value, h.value);
|
|
2360
2353
|
}
|
|
2361
2354
|
return { status: t.value, value: o };
|
|
2362
2355
|
});
|
|
2363
2356
|
} else {
|
|
2364
2357
|
const o = /* @__PURE__ */ new Map();
|
|
2365
|
-
for (const
|
|
2366
|
-
const c =
|
|
2367
|
-
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")
|
|
2368
2361
|
return w;
|
|
2369
|
-
(c.status === "dirty" ||
|
|
2362
|
+
(c.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(c.value, h.value);
|
|
2370
2363
|
}
|
|
2371
2364
|
return { status: t.value, value: o };
|
|
2372
2365
|
}
|
|
@@ -2404,28 +2397,28 @@ class ge extends b {
|
|
|
2404
2397
|
message: s.maxSize.message
|
|
2405
2398
|
}), t.dirty());
|
|
2406
2399
|
const n = this._def.valueType;
|
|
2407
|
-
function r(
|
|
2400
|
+
function r(l) {
|
|
2408
2401
|
const c = /* @__PURE__ */ new Set();
|
|
2409
|
-
for (const
|
|
2410
|
-
if (
|
|
2402
|
+
for (const h of l) {
|
|
2403
|
+
if (h.status === "aborted")
|
|
2411
2404
|
return w;
|
|
2412
|
-
|
|
2405
|
+
h.status === "dirty" && t.dirty(), c.add(h.value);
|
|
2413
2406
|
}
|
|
2414
2407
|
return { status: t.value, value: c };
|
|
2415
2408
|
}
|
|
2416
|
-
const o = [...i.data.values()].map((
|
|
2417
|
-
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);
|
|
2418
2411
|
}
|
|
2419
2412
|
min(e, t) {
|
|
2420
2413
|
return new ge({
|
|
2421
2414
|
...this._def,
|
|
2422
|
-
minSize: { value: e, message:
|
|
2415
|
+
minSize: { value: e, message: m.toString(t) }
|
|
2423
2416
|
});
|
|
2424
2417
|
}
|
|
2425
2418
|
max(e, t) {
|
|
2426
2419
|
return new ge({
|
|
2427
2420
|
...this._def,
|
|
2428
|
-
maxSize: { value: e, message:
|
|
2421
|
+
maxSize: { value: e, message: m.toString(t) }
|
|
2429
2422
|
});
|
|
2430
2423
|
}
|
|
2431
2424
|
size(e, t) {
|
|
@@ -2454,7 +2447,7 @@ class we extends b {
|
|
|
2454
2447
|
expected: f.function,
|
|
2455
2448
|
received: t.parsedType
|
|
2456
2449
|
}), w;
|
|
2457
|
-
function i(o,
|
|
2450
|
+
function i(o, l) {
|
|
2458
2451
|
return qe({
|
|
2459
2452
|
data: o,
|
|
2460
2453
|
path: t.path,
|
|
@@ -2466,11 +2459,11 @@ class we extends b {
|
|
|
2466
2459
|
].filter((c) => !!c),
|
|
2467
2460
|
issueData: {
|
|
2468
2461
|
code: u.invalid_arguments,
|
|
2469
|
-
argumentsError:
|
|
2462
|
+
argumentsError: l
|
|
2470
2463
|
}
|
|
2471
2464
|
});
|
|
2472
2465
|
}
|
|
2473
|
-
function s(o,
|
|
2466
|
+
function s(o, l) {
|
|
2474
2467
|
return qe({
|
|
2475
2468
|
data: o,
|
|
2476
2469
|
path: t.path,
|
|
@@ -2482,31 +2475,31 @@ class we extends b {
|
|
|
2482
2475
|
].filter((c) => !!c),
|
|
2483
2476
|
issueData: {
|
|
2484
2477
|
code: u.invalid_return_type,
|
|
2485
|
-
returnTypeError:
|
|
2478
|
+
returnTypeError: l
|
|
2486
2479
|
}
|
|
2487
2480
|
});
|
|
2488
2481
|
}
|
|
2489
2482
|
const n = { errorMap: t.common.contextualErrorMap }, r = t.data;
|
|
2490
2483
|
if (this._def.returns instanceof Ce) {
|
|
2491
2484
|
const o = this;
|
|
2492
|
-
return M(async function(...
|
|
2493
|
-
const c = new F([]),
|
|
2494
|
-
throw c.addIssue(i(
|
|
2495
|
-
}),
|
|
2496
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2497
|
-
throw c.addIssue(s(
|
|
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;
|
|
2498
2491
|
});
|
|
2499
2492
|
});
|
|
2500
2493
|
} else {
|
|
2501
2494
|
const o = this;
|
|
2502
|
-
return M(function(...
|
|
2503
|
-
const c = o._def.args.safeParse(
|
|
2495
|
+
return M(function(...l) {
|
|
2496
|
+
const c = o._def.args.safeParse(l, n);
|
|
2504
2497
|
if (!c.success)
|
|
2505
|
-
throw new F([i(
|
|
2506
|
-
const
|
|
2507
|
-
if (!
|
|
2508
|
-
throw new F([s(
|
|
2509
|
-
return
|
|
2498
|
+
throw new F([i(l, c.error)]);
|
|
2499
|
+
const h = Reflect.apply(r, this, c.data), g = o._def.returns.safeParse(h, n);
|
|
2500
|
+
if (!g.success)
|
|
2501
|
+
throw new F([s(h, g.error)]);
|
|
2502
|
+
return g.data;
|
|
2510
2503
|
});
|
|
2511
2504
|
}
|
|
2512
2505
|
}
|
|
@@ -2724,12 +2717,12 @@ class X extends b {
|
|
|
2724
2717
|
return Promise.resolve(r).then(async (o) => {
|
|
2725
2718
|
if (t.value === "aborted")
|
|
2726
2719
|
return w;
|
|
2727
|
-
const
|
|
2720
|
+
const l = await this._def.schema._parseAsync({
|
|
2728
2721
|
data: o,
|
|
2729
2722
|
path: i.path,
|
|
2730
2723
|
parent: i
|
|
2731
2724
|
});
|
|
2732
|
-
return
|
|
2725
|
+
return l.status === "aborted" ? w : l.status === "dirty" || t.value === "dirty" ? ye(l.value) : l;
|
|
2733
2726
|
});
|
|
2734
2727
|
{
|
|
2735
2728
|
if (t.value === "aborted")
|
|
@@ -2744,10 +2737,10 @@ class X extends b {
|
|
|
2744
2737
|
}
|
|
2745
2738
|
if (s.type === "refinement") {
|
|
2746
2739
|
const r = (o) => {
|
|
2747
|
-
const
|
|
2740
|
+
const l = s.refinement(o, n);
|
|
2748
2741
|
if (i.common.async)
|
|
2749
|
-
return Promise.resolve(
|
|
2750
|
-
if (
|
|
2742
|
+
return Promise.resolve(l);
|
|
2743
|
+
if (l instanceof Promise)
|
|
2751
2744
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2752
2745
|
return o;
|
|
2753
2746
|
};
|
|
@@ -3304,8 +3297,8 @@ class es {
|
|
|
3304
3297
|
};
|
|
3305
3298
|
}
|
|
3306
3299
|
getValue(e, t, i, s) {
|
|
3307
|
-
const n = this.curves[s ?? ""] ?? this.curves.ease, [[r, o], [
|
|
3308
|
-
return N ** 3 *
|
|
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;
|
|
3309
3302
|
}
|
|
3310
3303
|
}
|
|
3311
3304
|
class R {
|
|
@@ -3368,19 +3361,19 @@ class R {
|
|
|
3368
3361
|
for (let n = 0; n < e.length; n += 1) {
|
|
3369
3362
|
const r = e[n], o = e[n + 1];
|
|
3370
3363
|
if (n === 0 && r.start !== 0) {
|
|
3371
|
-
const
|
|
3372
|
-
s.push(
|
|
3364
|
+
const h = { start: 0, length: r.start, from: i, to: r.from };
|
|
3365
|
+
s.push(h);
|
|
3373
3366
|
}
|
|
3374
3367
|
if (s.push(r), !o) {
|
|
3375
3368
|
if (r.start + r.length < t) {
|
|
3376
|
-
const
|
|
3369
|
+
const g = r.start + r.length, p = { start: g, length: t - g, from: r.to, to: r.to };
|
|
3377
3370
|
s.push(p);
|
|
3378
3371
|
}
|
|
3379
3372
|
break;
|
|
3380
3373
|
}
|
|
3381
3374
|
if (r.start + r.length !== o.start) {
|
|
3382
|
-
const
|
|
3383
|
-
s.push(
|
|
3375
|
+
const h = { start: r.start + r.length, length: o.start, from: r.to, to: o.from };
|
|
3376
|
+
s.push(h);
|
|
3384
3377
|
}
|
|
3385
3378
|
}
|
|
3386
3379
|
return s;
|
|
@@ -3418,19 +3411,19 @@ class ts {
|
|
|
3418
3411
|
this.clipConfiguration = e;
|
|
3419
3412
|
}
|
|
3420
3413
|
build(e, t) {
|
|
3421
|
-
const i = [], s = [], n = [], r = [], o = [], { effect:
|
|
3422
|
-
if (!
|
|
3414
|
+
const i = [], s = [], n = [], r = [], o = [], { effect: l, length: c } = this.clipConfiguration;
|
|
3415
|
+
if (!l)
|
|
3423
3416
|
return { offsetXKeyframes: i, offsetYKeyframes: s, opacityKeyframes: n, scaleKeyframes: r, rotationKeyframes: o };
|
|
3424
|
-
const
|
|
3417
|
+
const h = 0;
|
|
3425
3418
|
switch (this.getPresetName()) {
|
|
3426
3419
|
case "zoomIn": {
|
|
3427
3420
|
const p = this.getZoomSpeed(), k = 1 * this.clipConfiguration.scale, A = p * this.clipConfiguration.scale;
|
|
3428
|
-
r.push({ from: k, to: A, start:
|
|
3421
|
+
r.push({ from: k, to: A, start: h, length: c, interpolation: "linear" });
|
|
3429
3422
|
break;
|
|
3430
3423
|
}
|
|
3431
3424
|
case "zoomOut": {
|
|
3432
3425
|
const k = this.getZoomSpeed() * this.clipConfiguration.scale, A = 1 * this.clipConfiguration.scale;
|
|
3433
|
-
r.push({ from: k, to: A, start:
|
|
3426
|
+
r.push({ from: k, to: A, start: h, length: c, interpolation: "linear" });
|
|
3434
3427
|
break;
|
|
3435
3428
|
}
|
|
3436
3429
|
case "slideLeft": {
|
|
@@ -3438,10 +3431,10 @@ class ts {
|
|
|
3438
3431
|
const k = e.width + e.width * p * 2, A = t.height / t.width * e.height;
|
|
3439
3432
|
if (A < k) {
|
|
3440
3433
|
const S = Math.abs(k / e.width);
|
|
3441
|
-
r.push({ from: S, to: S, start:
|
|
3434
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3442
3435
|
} else
|
|
3443
3436
|
p = (A - e.width) / 2 / e.width;
|
|
3444
|
-
i.push({ from: p, to: -p, start:
|
|
3437
|
+
i.push({ from: p, to: -p, start: h, length: c });
|
|
3445
3438
|
break;
|
|
3446
3439
|
}
|
|
3447
3440
|
case "slideRight": {
|
|
@@ -3449,10 +3442,10 @@ class ts {
|
|
|
3449
3442
|
const k = e.width + e.width * p * 2, A = t.height / t.width * e.height;
|
|
3450
3443
|
if (A < k) {
|
|
3451
3444
|
const S = Math.abs(k / e.width);
|
|
3452
|
-
r.push({ from: S, to: S, start:
|
|
3445
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3453
3446
|
} else
|
|
3454
3447
|
p = (A - e.width) / 2 / e.width;
|
|
3455
|
-
i.push({ from: -p, to: p, start:
|
|
3448
|
+
i.push({ from: -p, to: p, start: h, length: c });
|
|
3456
3449
|
break;
|
|
3457
3450
|
}
|
|
3458
3451
|
case "slideUp": {
|
|
@@ -3460,10 +3453,10 @@ class ts {
|
|
|
3460
3453
|
const k = e.height + e.height * p * 2, A = t.height / t.width * e.width;
|
|
3461
3454
|
if (A < k) {
|
|
3462
3455
|
const S = Math.abs(k / e.height);
|
|
3463
|
-
r.push({ from: S, to: S, start:
|
|
3456
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3464
3457
|
} else
|
|
3465
3458
|
p = (A - e.height) / 2 / e.height;
|
|
3466
|
-
s.push({ from: p, to: -p, start:
|
|
3459
|
+
s.push({ from: p, to: -p, start: h, length: c });
|
|
3467
3460
|
break;
|
|
3468
3461
|
}
|
|
3469
3462
|
case "slideDown": {
|
|
@@ -3471,10 +3464,10 @@ class ts {
|
|
|
3471
3464
|
const k = e.height + e.height * p * 2, A = t.height / t.width * e.width;
|
|
3472
3465
|
if (A < k) {
|
|
3473
3466
|
const S = Math.abs(k / e.height);
|
|
3474
|
-
r.push({ from: S, to: S, start:
|
|
3467
|
+
r.push({ from: S, to: S, start: h, length: c, interpolation: "linear" });
|
|
3475
3468
|
} else
|
|
3476
3469
|
p = (A - e.height) / 2 / e.height;
|
|
3477
|
-
s.push({ from: -p, to: p, start:
|
|
3470
|
+
s.push({ from: -p, to: p, start: h, length: c });
|
|
3478
3471
|
break;
|
|
3479
3472
|
}
|
|
3480
3473
|
}
|
|
@@ -3529,33 +3522,33 @@ class is {
|
|
|
3529
3522
|
const r = 0, o = this.getInPresetLength();
|
|
3530
3523
|
switch (this.getInPresetName()) {
|
|
3531
3524
|
case "fade": {
|
|
3532
|
-
const
|
|
3533
|
-
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" });
|
|
3534
3527
|
break;
|
|
3535
3528
|
}
|
|
3536
3529
|
case "zoom": {
|
|
3537
|
-
const
|
|
3538
|
-
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" });
|
|
3539
3532
|
break;
|
|
3540
3533
|
}
|
|
3541
3534
|
case "slideLeft": {
|
|
3542
|
-
const c = this.clipConfiguration.offset?.x + 0.025,
|
|
3543
|
-
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" });
|
|
3544
3537
|
break;
|
|
3545
3538
|
}
|
|
3546
3539
|
case "slideRight": {
|
|
3547
|
-
const c = this.clipConfiguration.offset?.x - 0.025,
|
|
3548
|
-
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" });
|
|
3549
3542
|
break;
|
|
3550
3543
|
}
|
|
3551
3544
|
case "slideUp": {
|
|
3552
|
-
const c = this.clipConfiguration.offset?.y + 0.025,
|
|
3553
|
-
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" });
|
|
3554
3547
|
break;
|
|
3555
3548
|
}
|
|
3556
3549
|
case "slideDown": {
|
|
3557
|
-
const c = this.clipConfiguration.offset?.y - 0.025,
|
|
3558
|
-
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" });
|
|
3559
3552
|
break;
|
|
3560
3553
|
}
|
|
3561
3554
|
case "carouselLeft":
|
|
@@ -3588,28 +3581,28 @@ class is {
|
|
|
3588
3581
|
break;
|
|
3589
3582
|
}
|
|
3590
3583
|
case "zoom": {
|
|
3591
|
-
const
|
|
3592
|
-
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" });
|
|
3593
3586
|
break;
|
|
3594
3587
|
}
|
|
3595
3588
|
case "slideLeft": {
|
|
3596
|
-
const c = this.clipConfiguration.offset?.x,
|
|
3597
|
-
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" });
|
|
3598
3591
|
break;
|
|
3599
3592
|
}
|
|
3600
3593
|
case "slideRight": {
|
|
3601
|
-
const c = this.clipConfiguration.offset?.x,
|
|
3602
|
-
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" });
|
|
3603
3596
|
break;
|
|
3604
3597
|
}
|
|
3605
3598
|
case "slideUp": {
|
|
3606
|
-
const c = this.clipConfiguration.offset?.y,
|
|
3607
|
-
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" });
|
|
3608
3601
|
break;
|
|
3609
3602
|
}
|
|
3610
3603
|
case "slideDown": {
|
|
3611
|
-
const c = this.clipConfiguration.offset?.y,
|
|
3612
|
-
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" });
|
|
3613
3606
|
break;
|
|
3614
3607
|
}
|
|
3615
3608
|
case "carouselLeft":
|
|
@@ -3919,14 +3912,14 @@ class I extends ot {
|
|
|
3919
3912
|
return;
|
|
3920
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) {
|
|
3921
3914
|
this.scaleStart = this.getScale() / this.getFitScale();
|
|
3922
|
-
const
|
|
3923
|
-
this.scaleOffset =
|
|
3915
|
+
const l = e.getLocalPosition(this.edit.getContainer());
|
|
3916
|
+
this.scaleOffset = l;
|
|
3924
3917
|
return;
|
|
3925
3918
|
}
|
|
3926
3919
|
if (this.rotationHandle?.getBounds().containsPoint(e.globalX, e.globalY)) {
|
|
3927
3920
|
this.isRotating = !0, this.rotationStart = this.getRotation();
|
|
3928
|
-
const
|
|
3929
|
-
this.rotationOffset =
|
|
3921
|
+
const l = e.getLocalPosition(this.edit.getContainer());
|
|
3922
|
+
this.rotationOffset = l;
|
|
3930
3923
|
return;
|
|
3931
3924
|
}
|
|
3932
3925
|
this.isDragging = !0;
|
|
@@ -3938,15 +3931,15 @@ class I extends ot {
|
|
|
3938
3931
|
}
|
|
3939
3932
|
onPointerMove(e) {
|
|
3940
3933
|
if (this.scaleDirection !== null && this.scaleStart !== null) {
|
|
3941
|
-
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),
|
|
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;
|
|
3942
3935
|
this.clipConfiguration.scale = Math.max(I.MinScale, Math.min(c, I.MaxScale)), this.scaleKeyframeBuilder = new R(this.clipConfiguration.scale, this.getLength(), 1);
|
|
3943
3936
|
return;
|
|
3944
3937
|
}
|
|
3945
3938
|
if (this.isRotating && this.rotationStart !== null) {
|
|
3946
|
-
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),
|
|
3947
|
-
let c = this.rotationStart +
|
|
3948
|
-
const
|
|
3949
|
-
Math.abs(
|
|
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());
|
|
3950
3943
|
return;
|
|
3951
3944
|
}
|
|
3952
3945
|
if (this.isDragging) {
|
|
@@ -3955,15 +3948,15 @@ class I extends ot {
|
|
|
3955
3948
|
{ x: this.edit.size.width, y: 0 },
|
|
3956
3949
|
{ x: 0, y: this.edit.size.height },
|
|
3957
3950
|
{ x: this.edit.size.width, y: this.edit.size.height }
|
|
3958
|
-
], 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 = [
|
|
3959
3952
|
{ x: n.x, y: n.y },
|
|
3960
3953
|
{ x: n.x + this.getSize().width, y: n.y },
|
|
3961
3954
|
{ x: n.x, y: n.y + this.getSize().height },
|
|
3962
3955
|
{ x: n.x + this.getSize().width, y: n.y + this.getSize().height }
|
|
3963
|
-
],
|
|
3956
|
+
], h = { x: n.x + this.getSize().width / 2, y: n.y + this.getSize().height / 2 }, g = [...c, h];
|
|
3964
3957
|
let p = I.SnapThreshold, k = I.SnapThreshold, A = null, S = null;
|
|
3965
|
-
for (const J of
|
|
3966
|
-
for (const re of
|
|
3958
|
+
for (const J of g)
|
|
3959
|
+
for (const re of l) {
|
|
3967
3960
|
const K = Math.abs(J.x - re.x);
|
|
3968
3961
|
K < p && (p = K, A = n.x + (re.x - J.x));
|
|
3969
3962
|
const oe = Math.abs(J.y - re.y);
|
|
@@ -4000,8 +3993,8 @@ class I extends ot {
|
|
|
4000
3993
|
}
|
|
4001
3994
|
hasStateChanged() {
|
|
4002
3995
|
if (!this.initialClipConfiguration) return !1;
|
|
4003
|
-
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,
|
|
4004
|
-
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;
|
|
4005
3998
|
}
|
|
4006
3999
|
}
|
|
4007
4000
|
class nt extends I {
|
|
@@ -4371,10 +4364,10 @@ class us extends I {
|
|
|
4371
4364
|
lineHeight: (t.font?.lineHeight ?? 1) * (t.font?.size ?? 32),
|
|
4372
4365
|
align: n
|
|
4373
4366
|
};
|
|
4374
|
-
let o = (e.width ?? this.edit.size.width) / 2 - s.width / 2,
|
|
4375
|
-
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 = {
|
|
4376
4369
|
x: o,
|
|
4377
|
-
y:
|
|
4370
|
+
y: l
|
|
4378
4371
|
}, t.stroke.color && t.stroke.width) {
|
|
4379
4372
|
const c = new ct({
|
|
4380
4373
|
thickness: t.stroke.width,
|
|
@@ -4407,24 +4400,24 @@ class us extends I {
|
|
|
4407
4400
|
const e = this.clipConfiguration.asset, { html: t, css: i, position: s } = e;
|
|
4408
4401
|
if (!t.includes('data-html-type="text"'))
|
|
4409
4402
|
return console.warn("Unsupported html format."), null;
|
|
4410
|
-
const r = new DOMParser().parseFromString(t, "text/html").body.textContent ?? "",
|
|
4411
|
-
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))
|
|
4412
4405
|
return console.warn("Unsupported css format."), c;
|
|
4413
|
-
const
|
|
4406
|
+
const h = l.style, g = this.parseAlignment(s ?? "center");
|
|
4414
4407
|
c.font = {
|
|
4415
|
-
color:
|
|
4416
|
-
family:
|
|
4417
|
-
size:
|
|
4418
|
-
weight:
|
|
4419
|
-
lineHeight:
|
|
4420
|
-
}, c.alignment =
|
|
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
|
|
4413
|
+
}, c.alignment = g;
|
|
4421
4414
|
let p = "";
|
|
4422
|
-
return
|
|
4415
|
+
return h.background.length && (p = h.background), h.backgroundColor.length && (p = h.backgroundColor), c.background = {
|
|
4423
4416
|
color: p.length ? p : void 0,
|
|
4424
|
-
opacity:
|
|
4417
|
+
opacity: h.opacity.length ? parseInt(h.opacity, 10) : void 0
|
|
4425
4418
|
}, c.stroke = {
|
|
4426
|
-
width:
|
|
4427
|
-
color:
|
|
4419
|
+
width: h.strokeWidth.length ? parseInt(h.strokeWidth, 10) : void 0,
|
|
4420
|
+
color: h.stroke.length ? h.stroke : void 0
|
|
4428
4421
|
}, c;
|
|
4429
4422
|
}
|
|
4430
4423
|
parseAlignment(e) {
|
|
@@ -4484,7 +4477,7 @@ class ds extends I {
|
|
|
4484
4477
|
const t = this.clipConfiguration.asset;
|
|
4485
4478
|
if (!t.crop)
|
|
4486
4479
|
return e;
|
|
4487
|
-
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),
|
|
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);
|
|
4488
4481
|
return new v.Texture({ source: e.source, frame: k });
|
|
4489
4482
|
}
|
|
4490
4483
|
}
|
|
@@ -4537,18 +4530,18 @@ class fs extends I {
|
|
|
4537
4530
|
const n = new v.Graphics();
|
|
4538
4531
|
switch (e.shape) {
|
|
4539
4532
|
case "rectangle": {
|
|
4540
|
-
const r = e.rectangle, o = i / 2 - r.width / 2,
|
|
4541
|
-
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);
|
|
4542
4535
|
break;
|
|
4543
4536
|
}
|
|
4544
4537
|
case "circle": {
|
|
4545
|
-
const r = e.circle, o = i / 2,
|
|
4546
|
-
n.circle(o,
|
|
4538
|
+
const r = e.circle, o = i / 2, l = s / 2;
|
|
4539
|
+
n.circle(o, l, r.radius);
|
|
4547
4540
|
break;
|
|
4548
4541
|
}
|
|
4549
4542
|
case "line": {
|
|
4550
|
-
const r = e.line, o = i / 2 - r.length / 2,
|
|
4551
|
-
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);
|
|
4552
4545
|
break;
|
|
4553
4546
|
}
|
|
4554
4547
|
default:
|
|
@@ -4618,11 +4611,11 @@ class ps extends I {
|
|
|
4618
4611
|
x: r,
|
|
4619
4612
|
y: o
|
|
4620
4613
|
}, e.stroke) {
|
|
4621
|
-
const
|
|
4614
|
+
const l = new ct({
|
|
4622
4615
|
thickness: e.stroke.width,
|
|
4623
4616
|
color: e.stroke.color
|
|
4624
4617
|
});
|
|
4625
|
-
i.filters = [
|
|
4618
|
+
i.filters = [l];
|
|
4626
4619
|
}
|
|
4627
4620
|
this.background = t, this.text = i, this.getContainer().addChild(t), this.getContainer().addChild(i), this.configureKeyframes();
|
|
4628
4621
|
}
|
|
@@ -4696,7 +4689,7 @@ class ms extends I {
|
|
|
4696
4689
|
const t = this.clipConfiguration.asset;
|
|
4697
4690
|
if (!t.crop)
|
|
4698
4691
|
return e;
|
|
4699
|
-
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),
|
|
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);
|
|
4700
4693
|
return new v.Texture({ source: e.source, frame: k });
|
|
4701
4694
|
}
|
|
4702
4695
|
}
|
|
@@ -5060,11 +5053,11 @@ class he {
|
|
|
5060
5053
|
const o = {
|
|
5061
5054
|
x: this.application.canvas.width / 2,
|
|
5062
5055
|
y: this.application.canvas.height / 2
|
|
5063
|
-
},
|
|
5056
|
+
}, l = {
|
|
5064
5057
|
x: t.position.x - o.x,
|
|
5065
5058
|
y: t.position.y - o.y
|
|
5066
5059
|
}, c = this.currentZoom / r;
|
|
5067
|
-
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;
|
|
5068
5061
|
}
|
|
5069
5062
|
},
|
|
5070
5063
|
{
|
|
@@ -5217,25 +5210,25 @@ class xs {
|
|
|
5217
5210
|
this.isReady || await this.init();
|
|
5218
5211
|
const i = this.edit.isPlaying, s = this.edit.playbackTime;
|
|
5219
5212
|
this.edit.pause();
|
|
5220
|
-
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;
|
|
5221
5214
|
n.visible = !1;
|
|
5222
|
-
const
|
|
5215
|
+
const g = this.createProgressOverlay();
|
|
5223
5216
|
try {
|
|
5224
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);
|
|
5225
|
-
this.updateProgressOverlay(
|
|
5218
|
+
this.updateProgressOverlay(g, 0, S);
|
|
5226
5219
|
const K = document.createElement("canvas");
|
|
5227
5220
|
K.width = p.width, K.height = p.height;
|
|
5228
5221
|
const oe = K.getContext("2d");
|
|
5229
5222
|
if (!oe)
|
|
5230
5223
|
throw new Error("Could not get 2D context for canvas");
|
|
5231
5224
|
const $e = this.findAudioPlayers();
|
|
5232
|
-
this.updateProgressOverlay(
|
|
5225
|
+
this.updateProgressOverlay(g, 2, S);
|
|
5233
5226
|
const H = [];
|
|
5234
5227
|
if ($e.length > 0) {
|
|
5235
|
-
this.updateProgressOverlay(
|
|
5228
|
+
this.updateProgressOverlay(g, 3, S);
|
|
5236
5229
|
for (let T = 0; T < $e.length; T += 1) {
|
|
5237
5230
|
const D = await this.processAudioTrack($e[T], T);
|
|
5238
|
-
D && H.push(D), this.updateProgressOverlay(
|
|
5231
|
+
D && H.push(D), this.updateProgressOverlay(g, 4 + T, S);
|
|
5239
5232
|
}
|
|
5240
5233
|
}
|
|
5241
5234
|
n.position.x = 0, n.position.y = 0, n.scale.x = 1, n.scale.y = 1;
|
|
@@ -5249,9 +5242,9 @@ class xs {
|
|
|
5249
5242
|
} catch (D) {
|
|
5250
5243
|
console.error(`Error capturing frame ${T}:`, D);
|
|
5251
5244
|
}
|
|
5252
|
-
this.updateProgressOverlay(
|
|
5245
|
+
this.updateProgressOverlay(g, re(T + 1), S);
|
|
5253
5246
|
}
|
|
5254
|
-
this.updateProgressOverlay(
|
|
5247
|
+
this.updateProgressOverlay(g, N, S);
|
|
5255
5248
|
let Y = ["-framerate", t.toString(), "-i", "frame_%06d.png"];
|
|
5256
5249
|
for (const T of H)
|
|
5257
5250
|
Y = Y.concat(["-i", T.filename]);
|
|
@@ -5285,11 +5278,11 @@ class xs {
|
|
|
5285
5278
|
const E = parseInt(D[1], 10);
|
|
5286
5279
|
if (!Number.isNaN(E) && E > lt && (lt = E, E <= k)) {
|
|
5287
5280
|
const B = Math.round(E / k * J);
|
|
5288
|
-
this.updateProgressOverlay(
|
|
5281
|
+
this.updateProgressOverlay(g, N + B, S);
|
|
5289
5282
|
}
|
|
5290
5283
|
}
|
|
5291
5284
|
};
|
|
5292
|
-
this.ffmpeg.on("log", ht), await this.ffmpeg.exec(Y), this.ffmpeg.off("log", ht), this.updateProgressOverlay(
|
|
5285
|
+
this.ffmpeg.on("log", ht), await this.ffmpeg.exec(Y), this.ffmpeg.off("log", ht), this.updateProgressOverlay(g, N + J, S);
|
|
5293
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");
|
|
5294
5287
|
We.href = ut, We.download = e, We.click(), URL.revokeObjectURL(ut);
|
|
5295
5288
|
for (let T = 0; T < k; T += 1)
|
|
@@ -5302,11 +5295,11 @@ class xs {
|
|
|
5302
5295
|
await this.ffmpeg.deleteFile(T.filename);
|
|
5303
5296
|
} catch {
|
|
5304
5297
|
}
|
|
5305
|
-
await this.ffmpeg.deleteFile(je), this.updateProgressOverlay(
|
|
5298
|
+
await this.ffmpeg.deleteFile(je), this.updateProgressOverlay(g, S, S);
|
|
5306
5299
|
} catch (p) {
|
|
5307
5300
|
throw console.error("Error during export:", p), p;
|
|
5308
5301
|
} finally {
|
|
5309
|
-
this.removeProgressOverlay(
|
|
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();
|
|
5310
5303
|
}
|
|
5311
5304
|
}
|
|
5312
5305
|
findAudioPlayers() {
|
|
@@ -5330,8 +5323,8 @@ class xs {
|
|
|
5330
5323
|
for (const n of i.children)
|
|
5331
5324
|
if (n instanceof v.Container) {
|
|
5332
5325
|
const r = n, o = ["player", "clip", "audioPlayer", "entity"];
|
|
5333
|
-
for (const
|
|
5334
|
-
const c = r[
|
|
5326
|
+
for (const l of o) {
|
|
5327
|
+
const c = r[l];
|
|
5335
5328
|
c instanceof nt && !t.includes(c) && t.push(c);
|
|
5336
5329
|
}
|
|
5337
5330
|
}
|