@designcombo/state 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.es.js +107 -106
- package/dist/index.umd.js +1 -1
- package/dist/utils/load-item.d.ts +2 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
var fi = Object.defineProperty;
|
2
2
|
var pi = (t, r, n) => r in t ? fi(t, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[r] = n;
|
3
3
|
var Ot = (t, r, n) => pi(t, typeof r != "symbol" ? r + "" : r, n);
|
4
|
-
import { subject as $t, filter as Kt, DESIGN_PREFIX as di, ADD_PREFIX as hi, LAYER_PREFIX as yi, HISTORY_PREFIX as mi, ACTIVE_PREFIX as bi, EDIT_PREFIX as gi, DESIGN_LOAD as _i, DESIGN_RESIZE as vi, HISTORY_UNDO as Ii, HISTORY_REDO as Si, LAYER_DELETE as wi, ADD_CAPTION as Ti, ADD_TEXT as ki, ADD_IMAGE as Ei, ADD_AUDIO as Ai, ADD_VIDEO as Oi, ACTIVE_SPLIT as
|
4
|
+
import { subject as $t, filter as Kt, DESIGN_PREFIX as di, ADD_PREFIX as hi, LAYER_PREFIX as yi, HISTORY_PREFIX as mi, ACTIVE_PREFIX as bi, EDIT_PREFIX as gi, DESIGN_LOAD as _i, DESIGN_RESIZE as vi, HISTORY_UNDO as Ii, HISTORY_REDO as Si, LAYER_DELETE as wi, ADD_CAPTION as Ti, ADD_TEXT as ki, ADD_IMAGE as Ei, ADD_AUDIO as Ai, ADD_VIDEO as Oi, ACTIVE_SPLIT as xi, ACTIVE_CLONE as Mi, ACTIVE_PASTE as Pi, EDIT_OBJECT as Di } from "@designcombo/events";
|
5
5
|
var nn = function(t, r) {
|
6
6
|
return nn = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
|
7
7
|
n.__proto__ = i;
|
@@ -86,15 +86,15 @@ var tr = function() {
|
|
86
86
|
if (f)
|
87
87
|
if (this._parentage = null, Array.isArray(f))
|
88
88
|
try {
|
89
|
-
for (var d = an(f),
|
90
|
-
var F =
|
89
|
+
for (var d = an(f), x = d.next(); !x.done; x = d.next()) {
|
90
|
+
var F = x.value;
|
91
91
|
F.remove(this);
|
92
92
|
}
|
93
93
|
} catch (l) {
|
94
94
|
r = { error: l };
|
95
95
|
} finally {
|
96
96
|
try {
|
97
|
-
|
97
|
+
x && !x.done && (n = d.return) && n.call(d);
|
98
98
|
} finally {
|
99
99
|
if (r) throw r.error;
|
100
100
|
}
|
@@ -321,8 +321,8 @@ var An = function() {
|
|
321
321
|
}, t.prototype.subscribe = function(r, n, i) {
|
322
322
|
var s = this, c = Gi(r) ? r : new un(r, n, i);
|
323
323
|
return Xe(function() {
|
324
|
-
var f = s, d = f.operator,
|
325
|
-
c.add(d ? d.call(c,
|
324
|
+
var f = s, d = f.operator, x = f.source;
|
325
|
+
c.add(d ? d.call(c, x) : x ? s._subscribe(c) : s._trySubscribe(c));
|
326
326
|
}), c;
|
327
327
|
}, t.prototype._trySubscribe = function(r) {
|
328
328
|
try {
|
@@ -337,8 +337,8 @@ var An = function() {
|
|
337
337
|
next: function(d) {
|
338
338
|
try {
|
339
339
|
r(d);
|
340
|
-
} catch (
|
341
|
-
c(
|
340
|
+
} catch (x) {
|
341
|
+
c(x), f.unsubscribe();
|
342
342
|
}
|
343
343
|
},
|
344
344
|
error: c,
|
@@ -392,7 +392,7 @@ var Wi = Yn(function(t) {
|
|
392
392
|
return n.closed = !1, n.currentObservers = null, n.observers = [], n.isStopped = !1, n.hasError = !1, n.thrownError = null, n;
|
393
393
|
}
|
394
394
|
return r.prototype.lift = function(n) {
|
395
|
-
var i = new
|
395
|
+
var i = new xn(this, this);
|
396
396
|
return i.operator = n, i;
|
397
397
|
}, r.prototype._throwIfClosed = function() {
|
398
398
|
if (this.closed)
|
@@ -405,8 +405,8 @@ var Wi = Yn(function(t) {
|
|
405
405
|
i.currentObservers || (i.currentObservers = Array.from(i.observers));
|
406
406
|
try {
|
407
407
|
for (var f = an(i.currentObservers), d = f.next(); !d.done; d = f.next()) {
|
408
|
-
var
|
409
|
-
|
408
|
+
var x = d.value;
|
409
|
+
x.next(n);
|
410
410
|
}
|
411
411
|
} catch (F) {
|
412
412
|
s = { error: F };
|
@@ -462,9 +462,9 @@ var Wi = Yn(function(t) {
|
|
462
462
|
var n = new An();
|
463
463
|
return n.source = this, n;
|
464
464
|
}, r.create = function(n, i) {
|
465
|
-
return new
|
465
|
+
return new xn(n, i);
|
466
466
|
}, r;
|
467
|
-
}(An),
|
467
|
+
}(An), xn = function(t) {
|
468
468
|
ge(r, t);
|
469
469
|
function r(n, i) {
|
470
470
|
var s = t.call(this) || this;
|
@@ -483,7 +483,7 @@ var Wi = Yn(function(t) {
|
|
483
483
|
var i, s;
|
484
484
|
return (s = (i = this.source) === null || i === void 0 ? void 0 : i.subscribe(n)) !== null && s !== void 0 ? s : Vn;
|
485
485
|
}, r;
|
486
|
-
}(Qn),
|
486
|
+
}(Qn), Mn = function(t) {
|
487
487
|
ge(r, t);
|
488
488
|
function r(n) {
|
489
489
|
var i = t.call(this) || this;
|
@@ -513,8 +513,8 @@ function bn(t) {
|
|
513
513
|
var qe = { exports: {} };
|
514
514
|
qe.exports;
|
515
515
|
(function(t, r) {
|
516
|
-
var n = 200, i = "__lodash_hash_undefined__", s = 1, c = 2, f = 9007199254740991, d = "[object Arguments]",
|
517
|
-
N[U] = N[bt] = N[Se] = N[ir] = N[ar] = N[sr] = N[or] = N[z] = N[cr] = !0, N[d] = N[
|
516
|
+
var n = 200, i = "__lodash_hash_undefined__", s = 1, c = 2, f = 9007199254740991, d = "[object Arguments]", x = "[object Array]", F = "[object AsyncFunction]", E = "[object Boolean]", H = "[object Date]", b = "[object Error]", p = "[object Function]", h = "[object GeneratorFunction]", l = "[object Map]", y = "[object Number]", v = "[object Null]", _ = "[object Object]", m = "[object Promise]", g = "[object Proxy]", C = "[object RegExp]", O = "[object Set]", I = "[object String]", M = "[object Symbol]", S = "[object Undefined]", j = "[object WeakMap]", k = "[object ArrayBuffer]", T = "[object DataView]", U = "[object Float32Array]", bt = "[object Float64Array]", Se = "[object Int8Array]", ir = "[object Int16Array]", ar = "[object Int32Array]", sr = "[object Uint8Array]", or = "[object Uint8ClampedArray]", z = "[object Uint16Array]", cr = "[object Uint32Array]", ur = /[\\^$.*+?()[\]{}|]/g, it = /^\[object .+?Constructor\]$/, we = /^(?:0|[1-9]\d*)$/, N = {};
|
517
|
+
N[U] = N[bt] = N[Se] = N[ir] = N[ar] = N[sr] = N[or] = N[z] = N[cr] = !0, N[d] = N[x] = N[k] = N[E] = N[T] = N[H] = N[b] = N[p] = N[l] = N[y] = N[_] = N[C] = N[O] = N[I] = N[j] = !1;
|
518
518
|
var Te = typeof nt == "object" && nt && nt.Object === Object && nt, lr = typeof self == "object" && self && self.Object === Object && self, at = Te || lr || Function("return this")(), ke = r && !r.nodeType && r, Ee = ke && !0 && t && !t.nodeType && t, Vt = Ee && Ee.exports === ke, Xt = Vt && Te.process, Ae = function() {
|
519
519
|
try {
|
520
520
|
return Xt && Xt.binding && Xt.binding("util");
|
@@ -533,7 +533,7 @@ qe.exports;
|
|
533
533
|
e[A + o] = a[o];
|
534
534
|
return e;
|
535
535
|
}
|
536
|
-
function
|
536
|
+
function xe(e, a) {
|
537
537
|
for (var o = -1, u = e == null ? 0 : e.length; ++o < u; )
|
538
538
|
if (a(e[o], o, e))
|
539
539
|
return !0;
|
@@ -555,7 +555,7 @@ qe.exports;
|
|
555
555
|
function Zt(e, a) {
|
556
556
|
return e == null ? void 0 : e[a];
|
557
557
|
}
|
558
|
-
function
|
558
|
+
function Me(e) {
|
559
559
|
var a = -1, o = Array(e.size);
|
560
560
|
return e.forEach(function(u, A) {
|
561
561
|
o[++a] = [A, u];
|
@@ -652,11 +652,11 @@ qe.exports;
|
|
652
652
|
string: new B()
|
653
653
|
};
|
654
654
|
}
|
655
|
-
function
|
655
|
+
function xr(e) {
|
656
656
|
var a = ot(this, e).delete(e);
|
657
657
|
return this.size -= a ? 1 : 0, a;
|
658
658
|
}
|
659
|
-
function
|
659
|
+
function Mr(e) {
|
660
660
|
return ot(this, e).get(e);
|
661
661
|
}
|
662
662
|
function Pr(e) {
|
@@ -666,7 +666,7 @@ qe.exports;
|
|
666
666
|
var o = ot(this, e), u = o.size;
|
667
667
|
return o.set(e, a), this.size += o.size == u ? 0 : 1, this;
|
668
668
|
}
|
669
|
-
q.prototype.clear = Or, q.prototype.delete =
|
669
|
+
q.prototype.clear = Or, q.prototype.delete = xr, q.prototype.get = Mr, q.prototype.has = Pr, q.prototype.set = Dr;
|
670
670
|
function Ut(e) {
|
671
671
|
var a = -1, o = e == null ? 0 : e.length;
|
672
672
|
for (this.__data__ = new q(); ++a < o; )
|
@@ -737,7 +737,7 @@ qe.exports;
|
|
737
737
|
return e === a ? !0 : e == null || a == null || !ft(e) && !ft(a) ? e !== e && a !== a : Nr(e, a, o, u, He, A);
|
738
738
|
}
|
739
739
|
function Nr(e, a, o, u, A, w) {
|
740
|
-
var D = Wt(e), P = Wt(a), L = D ?
|
740
|
+
var D = Wt(e), P = Wt(a), L = D ? x : lt(e), R = P ? x : lt(a);
|
741
741
|
L = L == d ? _ : L, R = R == d ? _ : R;
|
742
742
|
var Y = L == _, J = R == _, G = L == R;
|
743
743
|
if (G && Bt(e)) {
|
@@ -792,7 +792,7 @@ qe.exports;
|
|
792
792
|
break;
|
793
793
|
}
|
794
794
|
if (G) {
|
795
|
-
if (!
|
795
|
+
if (!xe(a, function(yt, At) {
|
796
796
|
if (!jt(G, At) && (V === yt || A(V, yt, o, u, w)))
|
797
797
|
return G.push(At);
|
798
798
|
})) {
|
@@ -824,7 +824,7 @@ qe.exports;
|
|
824
824
|
case I:
|
825
825
|
return e == a + "";
|
826
826
|
case l:
|
827
|
-
var P =
|
827
|
+
var P = Me;
|
828
828
|
case O:
|
829
829
|
var L = u & s;
|
830
830
|
if (P || (P = ct), e.size != a.size && !L)
|
@@ -835,7 +835,7 @@ qe.exports;
|
|
835
835
|
u |= c, D.set(e, a);
|
836
836
|
var Y = ue(P(e), P(a), u, A, w, D);
|
837
837
|
return D.delete(e), Y;
|
838
|
-
case
|
838
|
+
case M:
|
839
839
|
if (se)
|
840
840
|
return se.call(e) == se.call(a);
|
841
841
|
}
|
@@ -993,8 +993,8 @@ const rt = /* @__PURE__ */ bn(Bi);
|
|
993
993
|
var Je = { exports: {} };
|
994
994
|
Je.exports;
|
995
995
|
(function(t, r) {
|
996
|
-
var n = 200, i = "__lodash_hash_undefined__", s = 9007199254740991, c = "[object Arguments]", f = "[object Array]", d = "[object Boolean]",
|
997
|
-
z[c] = z[f] = z[C] = z[O] = z[d] = z[
|
996
|
+
var n = 200, i = "__lodash_hash_undefined__", s = 9007199254740991, c = "[object Arguments]", f = "[object Array]", d = "[object Boolean]", x = "[object Date]", F = "[object Error]", E = "[object Function]", H = "[object GeneratorFunction]", b = "[object Map]", p = "[object Number]", h = "[object Object]", l = "[object Promise]", y = "[object RegExp]", v = "[object Set]", _ = "[object String]", m = "[object Symbol]", g = "[object WeakMap]", C = "[object ArrayBuffer]", O = "[object DataView]", I = "[object Float32Array]", M = "[object Float64Array]", S = "[object Int8Array]", j = "[object Int16Array]", k = "[object Int32Array]", T = "[object Uint8Array]", U = "[object Uint8ClampedArray]", bt = "[object Uint16Array]", Se = "[object Uint32Array]", ir = /[\\^$.*+?()[\]{}|]/g, ar = /\w*$/, sr = /^\[object .+?Constructor\]$/, or = /^(?:0|[1-9]\d*)$/, z = {};
|
997
|
+
z[c] = z[f] = z[C] = z[O] = z[d] = z[x] = z[I] = z[M] = z[S] = z[j] = z[k] = z[b] = z[p] = z[h] = z[y] = z[v] = z[_] = z[m] = z[T] = z[U] = z[bt] = z[Se] = !0, z[F] = z[E] = z[g] = !1;
|
998
998
|
var cr = typeof nt == "object" && nt && nt.Object === Object && nt, ur = typeof self == "object" && self && self.Object === Object && self, it = cr || ur || Function("return this")(), we = r && !r.nodeType && r, N = we && !0 && t && !t.nodeType && t, Te = N && N.exports === we;
|
999
999
|
function lr(e, a) {
|
1000
1000
|
return e.set(a[0], a[1]), e;
|
@@ -1045,13 +1045,13 @@ Je.exports;
|
|
1045
1045
|
return e(a(o));
|
1046
1046
|
};
|
1047
1047
|
}
|
1048
|
-
function
|
1048
|
+
function xe(e) {
|
1049
1049
|
var a = -1, o = Array(e.size);
|
1050
1050
|
return e.forEach(function(u) {
|
1051
1051
|
o[++a] = u;
|
1052
1052
|
}), o;
|
1053
1053
|
}
|
1054
|
-
var fr = Array.prototype, pr = Function.prototype, jt = Object.prototype, Zt = it["__core-js_shared__"],
|
1054
|
+
var fr = Array.prototype, pr = Function.prototype, jt = Object.prototype, Zt = it["__core-js_shared__"], Me = function() {
|
1055
1055
|
var e = /[^.]+$/.exec(Zt && Zt.keys && Zt.keys.IE_PROTO || "");
|
1056
1056
|
return e ? "Symbol(src)_1." + e : "";
|
1057
1057
|
}(), Pe = pr.toString, ct = jt.hasOwnProperty, Rt = jt.toString, dr = RegExp(
|
@@ -1149,10 +1149,10 @@ Je.exports;
|
|
1149
1149
|
function Or() {
|
1150
1150
|
this.__data__ = new B();
|
1151
1151
|
}
|
1152
|
-
function
|
1152
|
+
function xr(e) {
|
1153
1153
|
return this.__data__.delete(e);
|
1154
1154
|
}
|
1155
|
-
function
|
1155
|
+
function Mr(e) {
|
1156
1156
|
return this.__data__.get(e);
|
1157
1157
|
}
|
1158
1158
|
function Pr(e) {
|
@@ -1168,7 +1168,7 @@ Je.exports;
|
|
1168
1168
|
}
|
1169
1169
|
return o.set(e, a), this;
|
1170
1170
|
}
|
1171
|
-
q.prototype.clear = Or, q.prototype.delete =
|
1171
|
+
q.prototype.clear = Or, q.prototype.delete = xr, q.prototype.get = Mr, q.prototype.has = Pr, q.prototype.set = Dr;
|
1172
1172
|
function Ut(e, a) {
|
1173
1173
|
var o = le(e) || Wt(e) ? Xt(e.length, String) : [], u = o.length, A = !!u;
|
1174
1174
|
for (var w in e)
|
@@ -1270,7 +1270,7 @@ Je.exports;
|
|
1270
1270
|
return a.lastIndex = e.lastIndex, a;
|
1271
1271
|
}
|
1272
1272
|
function Nr(e, a, o) {
|
1273
|
-
var u = a ? o(
|
1273
|
+
var u = a ? o(xe(e), !0) : xe(e);
|
1274
1274
|
return Vt(u, at, new e.constructor());
|
1275
1275
|
}
|
1276
1276
|
function Hr(e) {
|
@@ -1339,12 +1339,12 @@ Je.exports;
|
|
1339
1339
|
case C:
|
1340
1340
|
return ce(e);
|
1341
1341
|
case d:
|
1342
|
-
case
|
1342
|
+
case x:
|
1343
1343
|
return new A(+e);
|
1344
1344
|
case O:
|
1345
1345
|
return kt(e, u);
|
1346
1346
|
case I:
|
1347
|
-
case
|
1347
|
+
case M:
|
1348
1348
|
case S:
|
1349
1349
|
case j:
|
1350
1350
|
case k:
|
@@ -1374,7 +1374,7 @@ Je.exports;
|
|
1374
1374
|
return a == "string" || a == "number" || a == "symbol" || a == "boolean" ? e !== "__proto__" : e === null;
|
1375
1375
|
}
|
1376
1376
|
function Vr(e) {
|
1377
|
-
return !!
|
1377
|
+
return !!Me && Me in e;
|
1378
1378
|
}
|
1379
1379
|
function Ue(e) {
|
1380
1380
|
var a = e && e.constructor, o = typeof a == "function" && a.prototype || jt;
|
@@ -1536,7 +1536,6 @@ const Pn = async (t, r) => {
|
|
1536
1536
|
}), c = ei(t.trim, { duration: i.duration }), f = {
|
1537
1537
|
width: i.width,
|
1538
1538
|
height: i.height,
|
1539
|
-
duration: i.duration,
|
1540
1539
|
opacity: 100,
|
1541
1540
|
src: n,
|
1542
1541
|
volume: t.details.volume ?? 100,
|
@@ -1567,7 +1566,8 @@ const Pn = async (t, r) => {
|
|
1567
1566
|
name: "video",
|
1568
1567
|
details: f,
|
1569
1568
|
playbackRate: t.playbackRate || 1,
|
1570
|
-
display: _e(t.display, { duration: i.duration, trim: c })
|
1569
|
+
display: _e(t.display, { duration: i.duration, trim: c }),
|
1570
|
+
duration: i.duration
|
1571
1571
|
};
|
1572
1572
|
}, Dn = async (t) => {
|
1573
1573
|
const r = t.id, n = t.details, s = (await Yi(n.src)).duration, c = ei(t.trim, { duration: s });
|
@@ -1580,11 +1580,11 @@ const Pn = async (t, r) => {
|
|
1580
1580
|
playbackRate: t.playbackRate || 1,
|
1581
1581
|
details: {
|
1582
1582
|
src: n.src,
|
1583
|
-
duration: s,
|
1584
1583
|
volume: n.volume ?? 100
|
1585
1584
|
// Default volume
|
1586
1585
|
},
|
1587
|
-
metadata: { ...t.metadata }
|
1586
|
+
metadata: { ...t.metadata },
|
1587
|
+
duration: s
|
1588
1588
|
};
|
1589
1589
|
}, Cn = async (t, r) => {
|
1590
1590
|
const n = t.details, i = await Ki(n.src), s = rr(r, i);
|
@@ -1776,7 +1776,7 @@ function Ji(t) {
|
|
1776
1776
|
const y = (h = p.value) == null ? void 0 : h.payload, v = y.size, _ = y.trackItemIds, m = y.trackItemsMap, g = y.trackItemDetailsMap;
|
1777
1777
|
console.warn("IMPROVE FONTS LOADING");
|
1778
1778
|
const C = _.map(async (I) => {
|
1779
|
-
var
|
1779
|
+
var M;
|
1780
1780
|
try {
|
1781
1781
|
const S = g[I], j = m[I];
|
1782
1782
|
if (S.type === "image") {
|
@@ -1789,7 +1789,7 @@ function Ji(t) {
|
|
1789
1789
|
g[I] = { type: "image", details: T }, m[I] = U;
|
1790
1790
|
} else if (S.type === "video") {
|
1791
1791
|
const k = Z(
|
1792
|
-
(
|
1792
|
+
(M = p.value) == null ? void 0 : M.payload.trackItemsMap[I]
|
1793
1793
|
), T = await Pn(
|
1794
1794
|
{ ...S, ...k, ...j },
|
1795
1795
|
{
|
@@ -1840,7 +1840,7 @@ function Ji(t) {
|
|
1840
1840
|
size: y
|
1841
1841
|
});
|
1842
1842
|
}
|
1843
|
-
}),
|
1843
|
+
}), x = s.subscribe((p) => {
|
1844
1844
|
if (p.key === Ii) return t.undo();
|
1845
1845
|
if (p.key === Si) return t.redo();
|
1846
1846
|
}), F = i.subscribe((p) => {
|
@@ -1849,7 +1849,7 @@ function Ji(t) {
|
|
1849
1849
|
if ((l = p.value) != null && l.payload.trackItemIds && (h.push((y = p.value) == null ? void 0 : y.payload.trackItemIds), t.updateState({ activeIds: h })), p.key === wi) {
|
1850
1850
|
const _ = (v = p.value) == null ? void 0 : v.payload.trackItemIds, m = Z(t.getState()), g = _ && _.length ? _ : m.activeIds, C = m.trackItemIds, O = m.trackItemDetailsMap, I = C.filter(
|
1851
1851
|
(T) => !g.includes(T)
|
1852
|
-
),
|
1852
|
+
), M = Object.fromEntries(
|
1853
1853
|
Object.entries(O).filter(
|
1854
1854
|
([T]) => !g.includes(T)
|
1855
1855
|
)
|
@@ -1864,7 +1864,7 @@ function Ji(t) {
|
|
1864
1864
|
t.updateState(
|
1865
1865
|
{
|
1866
1866
|
trackItemIds: I,
|
1867
|
-
trackItemDetailsMap:
|
1867
|
+
trackItemDetailsMap: M,
|
1868
1868
|
activeIds: [],
|
1869
1869
|
trackItemsMap: j,
|
1870
1870
|
tracks: S,
|
@@ -1879,14 +1879,14 @@ function Ji(t) {
|
|
1879
1879
|
let l = [], y = "text";
|
1880
1880
|
if (p.key === Ti) {
|
1881
1881
|
y = "caption";
|
1882
|
-
const I = (_ = p.value) == null ? void 0 : _.payload,
|
1882
|
+
const I = (_ = p.value) == null ? void 0 : _.payload, M = [];
|
1883
1883
|
for (const k of I) {
|
1884
1884
|
const T = jn(k, {
|
1885
1885
|
size: h.size
|
1886
1886
|
});
|
1887
|
-
|
1887
|
+
M.push(T);
|
1888
1888
|
}
|
1889
|
-
const S = await Promise.all(
|
1889
|
+
const S = await Promise.all(M), j = [];
|
1890
1890
|
for (const k of S) {
|
1891
1891
|
const T = k.id;
|
1892
1892
|
j.push(T);
|
@@ -1902,38 +1902,38 @@ function Ji(t) {
|
|
1902
1902
|
y = "text";
|
1903
1903
|
const I = await Rn((m = p.value) == null ? void 0 : m.payload, {
|
1904
1904
|
size: h.size
|
1905
|
-
}), { details:
|
1905
|
+
}), { details: M, ...S } = I;
|
1906
1906
|
h.trackItemDetailsMap[S.id] = {
|
1907
1907
|
type: y,
|
1908
|
-
details:
|
1908
|
+
details: M
|
1909
1909
|
}, h.trackItemsMap[S.id] = S, h.trackItemIds.push(S.id), l = [S.id];
|
1910
1910
|
}
|
1911
1911
|
if (p.key === Ei) {
|
1912
1912
|
y = "image";
|
1913
1913
|
const I = await Cn((g = p.value) == null ? void 0 : g.payload, {
|
1914
1914
|
size: h.size
|
1915
|
-
}), { details:
|
1915
|
+
}), { details: M, ...S } = I;
|
1916
1916
|
h.trackItemDetailsMap[S.id] = {
|
1917
1917
|
type: y,
|
1918
|
-
details:
|
1918
|
+
details: M
|
1919
1919
|
}, h.trackItemsMap[S.id] = S, h.trackItemIds.push(S.id), l = [S.id];
|
1920
1920
|
}
|
1921
1921
|
if (p.key === Ai) {
|
1922
1922
|
y = "audio";
|
1923
|
-
const I = await Dn((C = p.value) == null ? void 0 : C.payload), { details:
|
1923
|
+
const I = await Dn((C = p.value) == null ? void 0 : C.payload), { details: M, ...S } = I;
|
1924
1924
|
h.trackItemDetailsMap[S.id] = {
|
1925
1925
|
type: y,
|
1926
|
-
details:
|
1926
|
+
details: M
|
1927
1927
|
}, h.trackItemsMap[S.id] = S, h.trackItemIds.push(S.id), l = [S.id];
|
1928
1928
|
}
|
1929
1929
|
if (p.key === Oi) {
|
1930
1930
|
y = "video";
|
1931
1931
|
const I = await Pn((O = p.value) == null ? void 0 : O.payload, {
|
1932
1932
|
size: h.size
|
1933
|
-
}), { details:
|
1933
|
+
}), { details: M, ...S } = I;
|
1934
1934
|
h.trackItemDetailsMap[S.id] = {
|
1935
1935
|
type: y,
|
1936
|
-
details:
|
1936
|
+
details: M
|
1937
1937
|
}, h.trackItemsMap[S.id] = S, h.trackItemIds.push(S.id), l = [S.id];
|
1938
1938
|
}
|
1939
1939
|
h.tracks.unshift({
|
@@ -1960,7 +1960,7 @@ function Ji(t) {
|
|
1960
1960
|
);
|
1961
1961
|
}), H = c.subscribe(async (p) => {
|
1962
1962
|
var h;
|
1963
|
-
if (p.key ===
|
1963
|
+
if (p.key === xi) {
|
1964
1964
|
const l = Z(t.getState()), y = (h = p.value) == null ? void 0 : h.options.time;
|
1965
1965
|
if (l.activeIds.length === 1) {
|
1966
1966
|
const v = l.activeIds[0], _ = l.trackItemsMap[v];
|
@@ -1995,7 +1995,7 @@ function Ji(t) {
|
|
1995
1995
|
}
|
1996
1996
|
return;
|
1997
1997
|
}
|
1998
|
-
if (p.key ===
|
1998
|
+
if (p.key === Mi) {
|
1999
1999
|
const l = Z(t.getState());
|
2000
2000
|
if (l.activeIds.length) {
|
2001
2001
|
const y = l.activeIds, v = [], _ = {
|
@@ -2016,8 +2016,8 @@ function Ji(t) {
|
|
2016
2016
|
if (p.key === Pi) {
|
2017
2017
|
const l = localStorage.getItem("DesignComboTemp");
|
2018
2018
|
if (!l) return;
|
2019
|
-
const y = Z(t.getState()), v = JSON.parse(l), _ = {}, m = v.trackItemsMap, g = v.trackItemDetailsMap, C = v.tracks, O = [], I = v.activeIds.map(async (
|
2020
|
-
const S = g[
|
2019
|
+
const y = Z(t.getState()), v = JSON.parse(l), _ = {}, m = v.trackItemsMap, g = v.trackItemDetailsMap, C = v.tracks, O = [], I = v.activeIds.map(async (M) => {
|
2020
|
+
const S = g[M];
|
2021
2021
|
(S.type === "caption" || S.type === "text") && S.details.fontUrl && await gn([
|
2022
2022
|
{
|
2023
2023
|
fontFamily: S.details.fontFamily,
|
@@ -2025,14 +2025,14 @@ function Ji(t) {
|
|
2025
2025
|
}
|
2026
2026
|
]);
|
2027
2027
|
const j = Fn();
|
2028
|
-
return _[
|
2029
|
-
...m[
|
2028
|
+
return _[M] = j, y.trackItemsMap[j] = {
|
2029
|
+
...m[M],
|
2030
2030
|
id: j
|
2031
2031
|
}, y.trackItemDetailsMap[j] = S, y.trackItemIds.push(j), !0;
|
2032
2032
|
});
|
2033
|
-
await Promise.all(I), C.forEach((
|
2034
|
-
const S =
|
2035
|
-
...
|
2033
|
+
await Promise.all(I), C.forEach((M) => {
|
2034
|
+
const S = M.items.map((k) => _[k]), j = {
|
2035
|
+
...M,
|
2036
2036
|
items: S,
|
2037
2037
|
id: ln()
|
2038
2038
|
};
|
@@ -2079,13 +2079,13 @@ function Ji(t) {
|
|
2079
2079
|
});
|
2080
2080
|
return {
|
2081
2081
|
unsubscribe: () => {
|
2082
|
-
E.unsubscribe(), H.unsubscribe(), b.unsubscribe(),
|
2082
|
+
E.unsubscribe(), H.unsubscribe(), b.unsubscribe(), x.unsubscribe(), F.unsubscribe(), d.unsubscribe();
|
2083
2083
|
}
|
2084
2084
|
};
|
2085
2085
|
}
|
2086
2086
|
const Zi = { Date: !0, RegExp: !0, String: !0, Number: !0 };
|
2087
2087
|
function ni(t, r, n = { cyclesFix: !0 }, i = []) {
|
2088
|
-
var d,
|
2088
|
+
var d, x;
|
2089
2089
|
let s = [];
|
2090
2090
|
const c = Array.isArray(t);
|
2091
2091
|
for (const F in t) {
|
@@ -2099,7 +2099,7 @@ function ni(t, r, n = { cyclesFix: !0 }, i = []) {
|
|
2099
2099
|
continue;
|
2100
2100
|
}
|
2101
2101
|
const b = r[F], p = typeof E == "object" && typeof b == "object" && Array.isArray(E) === Array.isArray(b);
|
2102
|
-
if (E && b && p && !Zi[(
|
2102
|
+
if (E && b && p && !Zi[(x = (d = Object.getPrototypeOf(E)) == null ? void 0 : d.constructor) == null ? void 0 : x.name] && (!n.cyclesFix || !i.includes(E))) {
|
2103
2103
|
const h = ni(E, b, n, n.cyclesFix ? i.concat([E]) : []);
|
2104
2104
|
s.push.apply(s, h.map((l) => (l.path.unshift(H), l)));
|
2105
2105
|
} else E !== b && // treat NaN values as equivalent
|
@@ -2159,7 +2159,7 @@ function W(t, ...r) {
|
|
2159
2159
|
`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`
|
2160
2160
|
);
|
2161
2161
|
}
|
2162
|
-
var
|
2162
|
+
var Mt = Object.getPrototypeOf;
|
2163
2163
|
function Pt(t) {
|
2164
2164
|
return !!t && !!t[Q];
|
2165
2165
|
}
|
@@ -2171,7 +2171,7 @@ var Qi = Object.prototype.constructor.toString();
|
|
2171
2171
|
function ai(t) {
|
2172
2172
|
if (!t || typeof t != "object")
|
2173
2173
|
return !1;
|
2174
|
-
const r =
|
2174
|
+
const r = Mt(t);
|
2175
2175
|
if (r === null)
|
2176
2176
|
return !0;
|
2177
2177
|
const n = Object.hasOwnProperty.call(r, "constructor") && r.constructor;
|
@@ -2205,7 +2205,7 @@ function ve(t) {
|
|
2205
2205
|
function Ie(t) {
|
2206
2206
|
return t instanceof Set;
|
2207
2207
|
}
|
2208
|
-
function
|
2208
|
+
function xt(t) {
|
2209
2209
|
return t.copy_ || t.base_;
|
2210
2210
|
}
|
2211
2211
|
function fn(t, r) {
|
@@ -2230,9 +2230,9 @@ function fn(t, r) {
|
|
2230
2230
|
value: t[f]
|
2231
2231
|
});
|
2232
2232
|
}
|
2233
|
-
return Object.create(
|
2233
|
+
return Object.create(Mt(t), i);
|
2234
2234
|
} else {
|
2235
|
-
const i =
|
2235
|
+
const i = Mt(t);
|
2236
2236
|
if (i !== null && n)
|
2237
2237
|
return { ...t };
|
2238
2238
|
const s = Object.create(i);
|
@@ -2316,7 +2316,7 @@ function Ze(t, r, n) {
|
|
2316
2316
|
let c = s, f = !1;
|
2317
2317
|
i.type_ === 3 && (c = new Set(s), s.clear(), f = !0), he(
|
2318
2318
|
c,
|
2319
|
-
(d,
|
2319
|
+
(d, x) => Un(t, i, s, d, x, n, f)
|
2320
2320
|
), Qe(t, s, !1), n && t.patches_ && Ct("Patches").generatePatches_(
|
2321
2321
|
i,
|
2322
2322
|
n,
|
@@ -2329,8 +2329,8 @@ function Ze(t, r, n) {
|
|
2329
2329
|
function Un(t, r, n, i, s, c, f) {
|
2330
2330
|
if (process.env.NODE_ENV !== "production" && s === n && W(5), Pt(s)) {
|
2331
2331
|
const d = c && r && r.type_ !== 3 && // Set objects are atomic since they have no keys.
|
2332
|
-
!ye(r.assigned_, i) ? c.concat(i) : void 0,
|
2333
|
-
if (si(n, i,
|
2332
|
+
!ye(r.assigned_, i) ? c.concat(i) : void 0, x = Ze(t, s, d);
|
2333
|
+
if (si(n, i, x), Pt(x))
|
2334
2334
|
t.canAutoFreeze_ = !1;
|
2335
2335
|
else
|
2336
2336
|
return;
|
@@ -2377,24 +2377,24 @@ var In = {
|
|
2377
2377
|
get(t, r) {
|
2378
2378
|
if (r === Q)
|
2379
2379
|
return t;
|
2380
|
-
const n =
|
2380
|
+
const n = xt(t);
|
2381
2381
|
if (!ye(n, r))
|
2382
2382
|
return sa(t, n, r);
|
2383
2383
|
const i = n[r];
|
2384
2384
|
return t.finalized_ || !vt(i) ? i : i === en(t.base_, r) ? (rn(t), t.copy_[r] = mn(i, t)) : i;
|
2385
2385
|
},
|
2386
2386
|
has(t, r) {
|
2387
|
-
return r in
|
2387
|
+
return r in xt(t);
|
2388
2388
|
},
|
2389
2389
|
ownKeys(t) {
|
2390
|
-
return Reflect.ownKeys(
|
2390
|
+
return Reflect.ownKeys(xt(t));
|
2391
2391
|
},
|
2392
2392
|
set(t, r, n) {
|
2393
|
-
const i = ci(
|
2393
|
+
const i = ci(xt(t), r);
|
2394
2394
|
if (i != null && i.set)
|
2395
2395
|
return i.set.call(t.draft_, n), !0;
|
2396
2396
|
if (!t.modified_) {
|
2397
|
-
const s = en(
|
2397
|
+
const s = en(xt(t), r), c = s == null ? void 0 : s[Q];
|
2398
2398
|
if (c && c.base_ === n)
|
2399
2399
|
return t.copy_[r] = n, t.assigned_[r] = !1, !0;
|
2400
2400
|
if (ta(n, s) && (n !== void 0 || ye(t.base_, r)))
|
@@ -2411,7 +2411,7 @@ var In = {
|
|
2411
2411
|
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
2412
2412
|
// the same guarantee in ES5 mode.
|
2413
2413
|
getOwnPropertyDescriptor(t, r) {
|
2414
|
-
const n =
|
2414
|
+
const n = xt(t), i = Reflect.getOwnPropertyDescriptor(n, r);
|
2415
2415
|
return i && {
|
2416
2416
|
writable: !0,
|
2417
2417
|
configurable: t.type_ !== 1 || r !== "length",
|
@@ -2423,7 +2423,7 @@ var In = {
|
|
2423
2423
|
W(11);
|
2424
2424
|
},
|
2425
2425
|
getPrototypeOf(t) {
|
2426
|
-
return
|
2426
|
+
return Mt(t.base_);
|
2427
2427
|
},
|
2428
2428
|
setPrototypeOf() {
|
2429
2429
|
W(12);
|
@@ -2442,7 +2442,7 @@ be.set = function(t, r, n) {
|
|
2442
2442
|
};
|
2443
2443
|
function en(t, r) {
|
2444
2444
|
const n = t[Q];
|
2445
|
-
return (n ?
|
2445
|
+
return (n ? xt(n) : t)[r];
|
2446
2446
|
}
|
2447
2447
|
function sa(t, r, n) {
|
2448
2448
|
var s;
|
@@ -2456,12 +2456,12 @@ function sa(t, r, n) {
|
|
2456
2456
|
function ci(t, r) {
|
2457
2457
|
if (!(r in t))
|
2458
2458
|
return;
|
2459
|
-
let n =
|
2459
|
+
let n = Mt(t);
|
2460
2460
|
for (; n; ) {
|
2461
2461
|
const i = Object.getOwnPropertyDescriptor(n, r);
|
2462
2462
|
if (i)
|
2463
2463
|
return i;
|
2464
|
-
n =
|
2464
|
+
n = Mt(n);
|
2465
2465
|
}
|
2466
2466
|
}
|
2467
2467
|
function yn(t) {
|
@@ -2480,8 +2480,8 @@ var oa = class {
|
|
2480
2480
|
const c = n;
|
2481
2481
|
n = r;
|
2482
2482
|
const f = this;
|
2483
|
-
return function(
|
2484
|
-
return f.produce(
|
2483
|
+
return function(x = c, ...F) {
|
2484
|
+
return f.produce(x, (E) => n.call(this, E, ...F));
|
2485
2485
|
};
|
2486
2486
|
}
|
2487
2487
|
typeof n != "function" && W(6), i !== void 0 && typeof i != "function" && W(7);
|
@@ -2505,7 +2505,7 @@ var oa = class {
|
|
2505
2505
|
W(1, r);
|
2506
2506
|
}, this.produceWithPatches = (r, n) => {
|
2507
2507
|
if (typeof r == "function")
|
2508
|
-
return (f, ...d) => this.produceWithPatches(f, (
|
2508
|
+
return (f, ...d) => this.produceWithPatches(f, (x) => r(x, ...d));
|
2509
2509
|
let i, s;
|
2510
2510
|
return [this.produce(r, n, (f, d) => {
|
2511
2511
|
i = f, s = d;
|
@@ -2691,7 +2691,7 @@ function Ln() {
|
|
2691
2691
|
_++;
|
2692
2692
|
});
|
2693
2693
|
}
|
2694
|
-
function
|
2694
|
+
function x(b, p, h, l) {
|
2695
2695
|
h.push({
|
2696
2696
|
op: r,
|
2697
2697
|
path: [],
|
@@ -2760,7 +2760,7 @@ function Ln() {
|
|
2760
2760
|
);
|
2761
2761
|
if (Ie(b))
|
2762
2762
|
return new Set(Array.from(b).map(E));
|
2763
|
-
const p = Object.create(
|
2763
|
+
const p = Object.create(Mt(b));
|
2764
2764
|
for (const h in b)
|
2765
2765
|
p[h] = E(b[h]);
|
2766
2766
|
return ye(b, de) && (p[de] = b[de]), p;
|
@@ -2771,7 +2771,7 @@ function Ln() {
|
|
2771
2771
|
ra("Patches", {
|
2772
2772
|
applyPatches_: F,
|
2773
2773
|
generatePatches_: s,
|
2774
|
-
generateReplacementPatches_:
|
2774
|
+
generateReplacementPatches_: x
|
2775
2775
|
});
|
2776
2776
|
}
|
2777
2777
|
var tt = new oa(), ua = tt.produce;
|
@@ -2810,7 +2810,7 @@ function Sa(t, r) {
|
|
2810
2810
|
var Sn = Object.prototype, wa = Sn.hasOwnProperty, wn = Sn.toString, Gn = _a.Symbol, Ta = Sn.propertyIsEnumerable, Wn = Gn ? Gn.isConcatSpreadable : void 0, Bn = Math.max;
|
2811
2811
|
function ka(t, r, n, i, s) {
|
2812
2812
|
var c = -1, f = t.length;
|
2813
|
-
for (n || (n =
|
2813
|
+
for (n || (n = xa), s || (s = []); ++c < f; ) {
|
2814
2814
|
var d = t[c];
|
2815
2815
|
n(d) ? Sa(s, d) : s[s.length] = d;
|
2816
2816
|
}
|
@@ -2838,10 +2838,10 @@ function Oa(t, r) {
|
|
2838
2838
|
return f[r] = c, va(t, this, f);
|
2839
2839
|
};
|
2840
2840
|
}
|
2841
|
-
function
|
2841
|
+
function xa(t) {
|
2842
2842
|
return Da(t) || Pa(t) || !!(Wn && t && t[Wn]);
|
2843
2843
|
}
|
2844
|
-
function
|
2844
|
+
function Ma(t) {
|
2845
2845
|
if (typeof t == "string" || Na(t))
|
2846
2846
|
return t;
|
2847
2847
|
var r = t + "";
|
@@ -2875,7 +2875,7 @@ function Na(t) {
|
|
2875
2875
|
return typeof t == "symbol" || li(t) && wn.call(t) == ma;
|
2876
2876
|
}
|
2877
2877
|
var Ha = Oa(function(t, r) {
|
2878
|
-
return t == null ? {} : Ea(t, Ia(ka(r),
|
2878
|
+
return t == null ? {} : Ea(t, Ia(ka(r), Ma));
|
2879
2879
|
}), Ua = Ha;
|
2880
2880
|
const $n = /* @__PURE__ */ bn(Ua), La = {
|
2881
2881
|
width: 1080,
|
@@ -2890,7 +2890,8 @@ const $n = /* @__PURE__ */ bn(Ua), La = {
|
|
2890
2890
|
scale: {
|
2891
2891
|
unit: 1,
|
2892
2892
|
zoom: 1,
|
2893
|
-
segments: 1
|
2893
|
+
segments: 1,
|
2894
|
+
index: 1
|
2894
2895
|
},
|
2895
2896
|
duration: 0,
|
2896
2897
|
activeIds: [],
|
@@ -2912,7 +2913,7 @@ class $a {
|
|
2912
2913
|
Ot(this, "redos", []);
|
2913
2914
|
Ot(this, "listener");
|
2914
2915
|
const n = r || Ga;
|
2915
|
-
this.stateSubject = new
|
2916
|
+
this.stateSubject = new Mn(n), this.stateHistorySubject = new Mn({
|
2916
2917
|
handleRedo: !1,
|
2917
2918
|
handleUndo: !1
|
2918
2919
|
}), this.prevState = n, this.initListeners();
|
@@ -3025,14 +3026,14 @@ class $a {
|
|
3025
3026
|
trackItemIds: c,
|
3026
3027
|
tracks: f,
|
3027
3028
|
transitionIds: d,
|
3028
|
-
transitionsMap:
|
3029
|
+
transitionsMap: x,
|
3029
3030
|
trackItemsMap: F
|
3030
3031
|
} = this.getState(), E = Z({
|
3031
3032
|
trackItemDetailsMap: s,
|
3032
3033
|
trackItemIds: c,
|
3033
3034
|
tracks: f,
|
3034
3035
|
transitionIds: d,
|
3035
|
-
transitionsMap:
|
3036
|
+
transitionsMap: x,
|
3036
3037
|
trackItemsMap: F
|
3037
3038
|
}), H = [], b = [], p = [], h = [], l = [], y = [];
|
3038
3039
|
n.forEach((k) => {
|
@@ -3077,8 +3078,8 @@ class $a {
|
|
3077
3078
|
transitionsMap: g,
|
3078
3079
|
trackItemsMap: C,
|
3079
3080
|
trackItemDetailsMap: O
|
3080
|
-
}),
|
3081
|
-
this.prevState =
|
3081
|
+
}), M = Z(this.getState()), S = { ...M, ...I };
|
3082
|
+
this.prevState = M, this.redos.push({ redos: n, type: i });
|
3082
3083
|
const j = Yt(S.trackItemsMap);
|
3083
3084
|
this.stateSubject.next({ ...S, duration: j }), this.stateHistorySubject.next({ handleRedo: !1, handleUndo: !0 });
|
3084
3085
|
}
|
@@ -3096,14 +3097,14 @@ class $a {
|
|
3096
3097
|
trackItemIds: c,
|
3097
3098
|
tracks: f,
|
3098
3099
|
transitionIds: d,
|
3099
|
-
transitionsMap:
|
3100
|
+
transitionsMap: x,
|
3100
3101
|
trackItemsMap: F
|
3101
3102
|
} = this.getState(), E = Z({
|
3102
3103
|
trackItemDetailsMap: s,
|
3103
3104
|
trackItemIds: c,
|
3104
3105
|
tracks: f,
|
3105
3106
|
transitionIds: d,
|
3106
|
-
transitionsMap:
|
3107
|
+
transitionsMap: x,
|
3107
3108
|
trackItemsMap: F
|
3108
3109
|
}), H = [], b = [], p = [], h = [], l = [], y = [];
|
3109
3110
|
n.forEach((k) => {
|
@@ -3148,8 +3149,8 @@ class $a {
|
|
3148
3149
|
transitionsMap: g,
|
3149
3150
|
trackItemsMap: C,
|
3150
3151
|
trackItemDetailsMap: O
|
3151
|
-
}),
|
3152
|
-
this.prevState =
|
3152
|
+
}), M = Z(this.getState()), S = { ...M, ...I };
|
3153
|
+
this.prevState = M, this.undos.push({ undos: n, type: i });
|
3153
3154
|
const j = Yt(S.trackItemsMap);
|
3154
3155
|
this.stateSubject.next({ ...S, duration: j }), this.stateHistorySubject.next({ handleRedo: !0, handleUndo: !1 });
|
3155
3156
|
}
|
package/dist/index.umd.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
(function(A,q){typeof exports=="object"&&typeof module<"u"?module.exports=q(require("@designcombo/events")):typeof define=="function"&&define.amd?define(["@designcombo/events"],q):(A=typeof globalThis<"u"?globalThis:A||self,A.events=q(A.events))})(this,function(A){"use strict";var Ia=Object.defineProperty;var va=(A,q,lt)=>q in A?Ia(A,q,{enumerable:!0,configurable:!0,writable:!0,value:lt}):A[q]=lt;var Ft=(A,q,lt)=>va(A,typeof q!="symbol"?q+"":q,lt);var q=function(t,r){return q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},q(t,r)};function lt(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");q(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}function ir(t){var r=typeof Symbol=="function"&&Symbol.iterator,n=r&&t[r],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function ar(t,r){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),s,c=[],f;try{for(;(r===void 0||r-- >0)&&!(s=i.next()).done;)c.push(s.value)}catch(d){f={error:d}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(f)throw f.error}}return c}function sr(t,r,n){if(n||arguments.length===2)for(var i=0,s=r.length,c;i<s;i++)(c||!(i in r))&&(c||(c=Array.prototype.slice.call(r,0,i)),c[i]=r[i]);return t.concat(c||Array.prototype.slice.call(r))}typeof SuppressedError=="function"&&SuppressedError;function yt(t){return typeof t=="function"}function wn(t){var r=function(i){Error.call(i),i.stack=new Error().stack},n=t(r);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var or=wn(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
2
2
|
`+n.map(function(i,s){return s+1+") "+i.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function cr(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Se=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var f=this._parentage;if(f)if(this._parentage=null,Array.isArray(f))try{for(var d=ir(f),M=d.next();!M.done;M=d.next()){var z=M.value;z.remove(this)}}catch(l){r={error:l}}finally{try{M&&!M.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}else f.remove(this);var E=this.initialTeardown;if(yt(E))try{E()}catch(l){c=l instanceof or?l.errors:[l]}var U=this._finalizers;if(U){this._finalizers=null;try{for(var b=ir(U),p=b.next();!p.done;p=b.next()){var h=p.value;try{En(h)}catch(l){c=c??[],l instanceof or?c=sr(sr([],ar(c)),ar(l.errors)):c.push(l)}}}catch(l){i={error:l}}finally{try{p&&!p.done&&(s=b.return)&&s.call(b)}finally{if(i)throw i.error}}}if(c)throw new or(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)En(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(r)}},t.prototype._hasParent=function(r){var n=this._parentage;return n===r||Array.isArray(n)&&n.includes(r)},t.prototype._addParent=function(r){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(r),n):n?[n,r]:r},t.prototype._removeParent=function(r){var n=this._parentage;n===r?this._parentage=null:Array.isArray(n)&&cr(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&cr(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),Tn=Se.EMPTY;function kn(t){return t instanceof Se||t&&"closed"in t&&yt(t.remove)&&yt(t.add)&&yt(t.unsubscribe)}function En(t){yt(t)?t():t.unsubscribe()}var An={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},On={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,sr([t,r],ar(n)))},clearTimeout:function(t){var r=On.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function li(t){On.setTimeout(function(){throw t})}function xn(){}function we(t){t()}var Mn=function(t){lt(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,kn(n)&&n.add(i)):i.destination=hi,i}return r.create=function(n,i,s){return new lr(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Se),fi=Function.prototype.bind;function ur(t,r){return fi.call(t,r)}var pi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){Te(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){Te(i)}else Te(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){Te(n)}},t}(),lr=function(t){lt(r,t);function r(n,i,s){var c=t.call(this)||this,f;if(yt(n)||!n)f={next:n??void 0,error:i??void 0,complete:s??void 0};else{var d;c&&An.useDeprecatedNextContext?(d=Object.create(n),d.unsubscribe=function(){return c.unsubscribe()},f={next:n.next&&ur(n.next,d),error:n.error&&ur(n.error,d),complete:n.complete&&ur(n.complete,d)}):f=n}return c.destination=new pi(f),c}return r}(Mn);function Te(t){li(t)}function di(t){throw t}var hi={closed:!0,next:xn,error:di,complete:xn},yi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function mi(t){return t}function bi(t){return t.length===0?mi:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var Pn=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=_i(r)?r:new lr(r,n,i);return we(function(){var f=s,d=f.operator,M=f.source;c.add(d?d.call(c,M):M?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Dn(n),new n(function(s,c){var f=new lr({next:function(d){try{r(d)}catch(M){c(M),f.unsubscribe()}},error:c,complete:s});i.subscribe(f)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[yi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return bi(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Dn(r),new r(function(i,s){var c;n.subscribe(function(f){return c=f},function(f){return s(f)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Dn(t){var r;return(r=t??An.Promise)!==null&&r!==void 0?r:Promise}function gi(t){return t&&yt(t.next)&&yt(t.error)&&yt(t.complete)}function _i(t){return t&&t instanceof Mn||gi(t)&&kn(t)}var Ii=wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Cn=function(t){lt(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new jn(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new Ii},r.prototype.next=function(n){var i=this;we(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var f=ir(i.currentObservers),d=f.next();!d.done;d=f.next()){var M=d.value;M.next(n)}}catch(z){s={error:z}}finally{try{d&&!d.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;we(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;we(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,f=s.isStopped,d=s.observers;return c||f?Tn:(this.currentObservers=null,d.push(n),new Se(function(){i.currentObservers=null,cr(d,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,f=i.isStopped;s?n.error(c):f&&n.complete()},r.prototype.asObservable=function(){var n=new Pn;return n.source=this,n},r.create=function(n,i){return new jn(n,i)},r}(Pn),jn=function(t){lt(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:Tn},r}(Cn),Rn=function(t){lt(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Cn),nt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ke={exports:{}};ke.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,f=9007199254740991,d="[object Arguments]",M="[object Array]",z="[object AsyncFunction]",E="[object Boolean]",U="[object Date]",b="[object Error]",p="[object Function]",h="[object GeneratorFunction]",l="[object Map]",y="[object Number]",I="[object Null]",_="[object Object]",m="[object Promise]",g="[object Proxy]",j="[object RegExp]",x="[object Set]",v="[object String]",P="[object Symbol]",S="[object Undefined]",R="[object WeakMap]",k="[object ArrayBuffer]",T="[object DataView]",L="[object Float32Array]",vt="[object Float64Array]",De="[object Int8Array]",Or="[object Int16Array]",xr="[object Int32Array]",Mr="[object Uint8Array]",Pr="[object Uint8ClampedArray]",N="[object Uint16Array]",Dr="[object Uint32Array]",Cr=/[\\^$.*+?()[\]{}|]/g,st=/^\[object .+?Constructor\]$/,Ce=/^(?:0|[1-9]\d*)$/,H={};H[L]=H[vt]=H[De]=H[Or]=H[xr]=H[Mr]=H[Pr]=H[N]=H[Dr]=!0,H[d]=H[M]=H[k]=H[E]=H[T]=H[U]=H[b]=H[p]=H[l]=H[y]=H[_]=H[j]=H[x]=H[v]=H[R]=!1;var je=typeof nt=="object"&&nt&&nt.Object===Object&&nt,jr=typeof self=="object"&&self&&self.Object===Object&&self,ot=je||jr||Function("return this")(),Re=r&&!r.nodeType&&r,Fe=Re&&!0&&t&&!t.nodeType&&t,ne=Fe&&Fe.exports===Re,ie=ne&&je.process,ze=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),ae=ze&&ze.isTypedArray;function Ne(e,a){for(var o=-1,u=e==null?0:e.length,O=0,w=[];++o<u;){var C=e[o];a(C,o,e)&&(w[O++]=C)}return w}function se(e,a){for(var o=-1,u=a.length,O=e.length;++o<u;)e[O+o]=a[o];return e}function He(e,a){for(var o=-1,u=e==null?0:e.length;++o<u;)if(a(e[o],o,e))return!0;return!1}function Rr(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function Fr(e){return function(a){return e(a)}}function Nt(e,a){return e.has(a)}function oe(e,a){return e==null?void 0:e[a]}function Ue(e){var a=-1,o=Array(e.size);return e.forEach(function(u,O){o[++a]=[O,u]}),o}function Le(e,a){return function(o){return e(a(o))}}function ft(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Ht=Array.prototype,zr=Function.prototype,xt=Object.prototype,Ut=ot["__core-js_shared__"],ce=zr.toString,at=xt.hasOwnProperty,Ge=function(){var e=/[^.]+$/.exec(Ut&&Ut.keys&&Ut.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),We=xt.toString,Nr=RegExp("^"+ce.call(at).replace(Cr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ue=ne?ot.Buffer:void 0,Lt=ot.Symbol,Be=ot.Uint8Array,Gt=xt.propertyIsEnumerable,Mt=Ht.splice,ct=Lt?Lt.toStringTag:void 0,Wt=Object.getOwnPropertySymbols,le=ue?ue.isBuffer:void 0,Pt=Le(Object.keys,Object),fe=bt(ot,"DataView"),Dt=bt(ot,"Map"),pe=bt(ot,"Promise"),de=bt(ot,"Set"),he=bt(ot,"WeakMap"),St=bt(Object,"create"),$e=Z(fe),mt=Z(Dt),Hr=Z(pe),Ur=Z(de),Lr=Z(he),Ke=Lt?Lt.prototype:void 0,ye=Ke?Ke.valueOf:void 0;function $(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Gr(){this.__data__=St?St(null):{},this.size=0}function Wr(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function Br(e){var a=this.__data__;if(St){var o=a[e];return o===i?void 0:o}return at.call(a,e)?a[e]:void 0}function $r(e){var a=this.__data__;return St?a[e]!==void 0:at.call(a,e)}function Kr(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=St&&a===void 0?i:a,this}$.prototype.clear=Gr,$.prototype.delete=Wr,$.prototype.get=Br,$.prototype.has=$r,$.prototype.set=Kr;function Y(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Yr(){this.__data__=[],this.size=0}function Vr(e){var a=this.__data__,o=Kt(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Mt.call(a,o,1),--this.size,!0}function Xr(e){var a=this.__data__,o=Kt(a,e);return o<0?void 0:a[o][1]}function qr(e){return Kt(this.__data__,e)>-1}function Zr(e,a){var o=this.__data__,u=Kt(o,e);return u<0?(++this.size,o.push([e,a])):o[u][1]=a,this}Y.prototype.clear=Yr,Y.prototype.delete=Vr,Y.prototype.get=Xr,Y.prototype.has=qr,Y.prototype.set=Zr;function J(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Jr(){this.size=0,this.__data__={hash:new $,map:new(Dt||Y),string:new $}}function Qr(e){var a=ut(this,e).delete(e);return this.size-=a?1:0,a}function tn(e){return ut(this,e).get(e)}function en(e){return ut(this,e).has(e)}function rn(e,a){var o=ut(this,e),u=o.size;return o.set(e,a),this.size+=o.size==u?0:1,this}J.prototype.clear=Jr,J.prototype.delete=Qr,J.prototype.get=tn,J.prototype.has=en,J.prototype.set=rn;function Bt(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new J;++a<o;)this.add(e[a])}function Ye(e){return this.__data__.set(e,i),this}function $t(e){return this.__data__.has(e)}Bt.prototype.add=Bt.prototype.push=Ye,Bt.prototype.has=$t;function pt(e){var a=this.__data__=new Y(e);this.size=a.size}function me(){this.__data__=new Y,this.size=0}function nn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function an(e){return this.__data__.get(e)}function sn(e){return this.__data__.has(e)}function on(e,a){var o=this.__data__;if(o instanceof Y){var u=o.__data__;if(!Dt||u.length<n-1)return u.push([e,a]),this.size=++o.size,this;o=this.__data__=new J(u)}return o.set(e,a),this.size=o.size,this}pt.prototype.clear=me,pt.prototype.delete=nn,pt.prototype.get=an,pt.prototype.has=sn,pt.prototype.set=on;function cn(e,a){var o=Yt(e),u=!o&&Je(e),O=!o&&!u&&Vt(e),w=!o&&!u&&!O&&er(e),C=o||u||O||w,D=C?Rr(e.length,String):[],G=D.length;for(var F in e)at.call(e,F)&&!(C&&(F=="length"||O&&(F=="offset"||F=="parent")||w&&(F=="buffer"||F=="byteLength"||F=="byteOffset")||mn(F,G)))&&D.push(F);return D}function Kt(e,a){for(var o=e.length;o--;)if(Ze(e[o][0],a))return o;return-1}function be(e,a,o){var u=a(e);return Yt(e)?u:se(u,o(e))}function Ct(e){return e==null?e===void 0?S:I:ct&&ct in Object(e)?gt(e):qe(e)}function Ve(e){return ht(e)&&Ct(e)==d}function Xe(e,a,o,u,O){return e===a?!0:e==null||a==null||!ht(e)&&!ht(a)?e!==e&&a!==a:un(e,a,o,u,Xe,O)}function un(e,a,o,u,O,w){var C=Yt(e),D=Yt(a),G=C?M:dt(e),F=D?M:dt(a);G=G==d?_:G,F=F==d?_:F;var V=G==_,Q=F==_,B=G==F;if(B&&Vt(e)){if(!Vt(a))return!1;C=!0,V=!1}if(B&&!V)return w||(w=new pt),C||er(e)?ge(e,a,o,u,O,w):dn(e,a,G,o,u,O,w);if(!(o&s)){var X=V&&at.call(e,"__wrapped__"),K=Q&&at.call(a,"__wrapped__");if(X||K){var wt=X?e.value():e,_t=K?a.value():a;return w||(w=new pt),O(wt,_t,o,u,w)}}return B?(w||(w=new pt),hn(e,a,o,u,O,w)):!1}function ln(e){if(!tr(e)||gn(e))return!1;var a=Qe(e)?Nr:st;return a.test(Z(e))}function fn(e){return ht(e)&&Ie(e.length)&&!!H[Ct(e)]}function pn(e){if(!_n(e))return Pt(e);var a=[];for(var o in Object(e))at.call(e,o)&&o!="constructor"&&a.push(o);return a}function ge(e,a,o,u,O,w){var C=o&s,D=e.length,G=a.length;if(D!=G&&!(C&&G>D))return!1;var F=w.get(e);if(F&&w.get(a))return F==a;var V=-1,Q=!0,B=o&c?new Bt:void 0;for(w.set(e,a),w.set(a,e);++V<D;){var X=e[V],K=a[V];if(u)var wt=C?u(K,X,V,a,e,w):u(X,K,V,e,a,w);if(wt!==void 0){if(wt)continue;Q=!1;break}if(B){if(!He(a,function(_t,Rt){if(!Nt(B,Rt)&&(X===_t||O(X,_t,o,u,w)))return B.push(Rt)})){Q=!1;break}}else if(!(X===K||O(X,K,o,u,w))){Q=!1;break}}return w.delete(e),w.delete(a),Q}function dn(e,a,o,u,O,w,C){switch(o){case T:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case k:return!(e.byteLength!=a.byteLength||!w(new Be(e),new Be(a)));case E:case U:case y:return Ze(+e,+a);case b:return e.name==a.name&&e.message==a.message;case j:case v:return e==a+"";case l:var D=Ue;case x:var G=u&s;if(D||(D=ft),e.size!=a.size&&!G)return!1;var F=C.get(e);if(F)return F==a;u|=c,C.set(e,a);var V=ge(D(e),D(a),u,O,w,C);return C.delete(e),V;case P:if(ye)return ye.call(e)==ye.call(a)}return!1}function hn(e,a,o,u,O,w){var C=o&s,D=jt(e),G=D.length,F=jt(a),V=F.length;if(G!=V&&!C)return!1;for(var Q=G;Q--;){var B=D[Q];if(!(C?B in a:at.call(a,B)))return!1}var X=w.get(e);if(X&&w.get(a))return X==a;var K=!0;w.set(e,a),w.set(a,e);for(var wt=C;++Q<G;){B=D[Q];var _t=e[B],Rt=a[B];if(u)var ui=C?u(Rt,_t,B,a,e,w):u(_t,Rt,B,e,a,w);if(!(ui===void 0?_t===Rt||O(_t,Rt,o,u,w):ui)){K=!1;break}wt||(wt=B=="constructor")}if(K&&!wt){var rr=e.constructor,nr=a.constructor;rr!=nr&&"constructor"in e&&"constructor"in a&&!(typeof rr=="function"&&rr instanceof rr&&typeof nr=="function"&&nr instanceof nr)&&(K=!1)}return w.delete(e),w.delete(a),K}function jt(e){return be(e,ve,yn)}function ut(e,a){var o=e.__data__;return bn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function bt(e,a){var o=oe(e,a);return ln(o)?o:void 0}function gt(e){var a=at.call(e,ct),o=e[ct];try{e[ct]=void 0;var u=!0}catch{}var O=We.call(e);return u&&(a?e[ct]=o:delete e[ct]),O}var yn=Wt?function(e){return e==null?[]:(e=Object(e),Ne(Wt(e),function(a){return Gt.call(e,a)}))}:vn,dt=Ct;(fe&&dt(new fe(new ArrayBuffer(1)))!=T||Dt&&dt(new Dt)!=l||pe&&dt(pe.resolve())!=m||de&&dt(new de)!=x||he&&dt(new he)!=R)&&(dt=function(e){var a=Ct(e),o=a==_?e.constructor:void 0,u=o?Z(o):"";if(u)switch(u){case $e:return T;case mt:return l;case Hr:return m;case Ur:return x;case Lr:return R}return a});function mn(e,a){return a=a??f,!!a&&(typeof e=="number"||Ce.test(e))&&e>-1&&e%1==0&&e<a}function bn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function gn(e){return!!Ge&&Ge in e}function _n(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||xt;return e===o}function qe(e){return We.call(e)}function Z(e){if(e!=null){try{return ce.call(e)}catch{}try{return e+""}catch{}}return""}function Ze(e,a){return e===a||e!==e&&a!==a}var Je=Ve(function(){return arguments}())?Ve:function(e){return ht(e)&&at.call(e,"callee")&&!Gt.call(e,"callee")},Yt=Array.isArray;function _e(e){return e!=null&&Ie(e.length)&&!Qe(e)}var Vt=le||Sn;function In(e,a){return Xe(e,a)}function Qe(e){if(!tr(e))return!1;var a=Ct(e);return a==p||a==h||a==z||a==g}function Ie(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=f}function tr(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function ht(e){return e!=null&&typeof e=="object"}var er=ae?Fr(ae):fn;function ve(e){return _e(e)?cn(e):pn(e)}function vn(){return[]}function Sn(){return!1}t.exports=In}(ke,ke.exports);var vi=ke.exports;const it=fr(vi);var Ee={exports:{}};Ee.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",f="[object Array]",d="[object Boolean]",M="[object Date]",z="[object Error]",E="[object Function]",U="[object GeneratorFunction]",b="[object Map]",p="[object Number]",h="[object Object]",l="[object Promise]",y="[object RegExp]",I="[object Set]",_="[object String]",m="[object Symbol]",g="[object WeakMap]",j="[object ArrayBuffer]",x="[object DataView]",v="[object Float32Array]",P="[object Float64Array]",S="[object Int8Array]",R="[object Int16Array]",k="[object Int32Array]",T="[object Uint8Array]",L="[object Uint8ClampedArray]",vt="[object Uint16Array]",De="[object Uint32Array]",Or=/[\\^$.*+?()[\]{}|]/g,xr=/\w*$/,Mr=/^\[object .+?Constructor\]$/,Pr=/^(?:0|[1-9]\d*)$/,N={};N[c]=N[f]=N[j]=N[x]=N[d]=N[M]=N[v]=N[P]=N[S]=N[R]=N[k]=N[b]=N[p]=N[h]=N[y]=N[I]=N[_]=N[m]=N[T]=N[L]=N[vt]=N[De]=!0,N[z]=N[E]=N[g]=!1;var Dr=typeof nt=="object"&&nt&&nt.Object===Object&&nt,Cr=typeof self=="object"&&self&&self.Object===Object&&self,st=Dr||Cr||Function("return this")(),Ce=r&&!r.nodeType&&r,H=Ce&&!0&&t&&!t.nodeType&&t,je=H&&H.exports===Ce;function jr(e,a){return e.set(a[0],a[1]),e}function ot(e,a){return e.add(a),e}function Re(e,a){for(var o=-1,u=e?e.length:0;++o<u&&a(e[o],o,e)!==!1;);return e}function Fe(e,a){for(var o=-1,u=a.length,O=e.length;++o<u;)e[O+o]=a[o];return e}function ne(e,a,o,u){for(var O=-1,w=e?e.length:0;++O<w;)o=a(o,e[O],O,e);return o}function ie(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function ze(e,a){return e==null?void 0:e[a]}function ae(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function Ne(e){var a=-1,o=Array(e.size);return e.forEach(function(u,O){o[++a]=[O,u]}),o}function se(e,a){return function(o){return e(a(o))}}function He(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Rr=Array.prototype,Fr=Function.prototype,Nt=Object.prototype,oe=st["__core-js_shared__"],Ue=function(){var e=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Le=Fr.toString,ft=Nt.hasOwnProperty,Ht=Nt.toString,zr=RegExp("^"+Le.call(ft).replace(Or,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xt=je?st.Buffer:void 0,Ut=st.Symbol,ce=st.Uint8Array,at=se(Object.getPrototypeOf,Object),Ge=Object.create,We=Nt.propertyIsEnumerable,Nr=Rr.splice,ue=Object.getOwnPropertySymbols,Lt=xt?xt.isBuffer:void 0,Be=se(Object.keys,Object),Gt=ut(st,"DataView"),Mt=ut(st,"Map"),ct=ut(st,"Promise"),Wt=ut(st,"Set"),le=ut(st,"WeakMap"),Pt=ut(Object,"create"),fe=Z(Gt),Dt=Z(Mt),pe=Z(ct),de=Z(Wt),he=Z(le),St=Ut?Ut.prototype:void 0,$e=St?St.valueOf:void 0;function mt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Hr(){this.__data__=Pt?Pt(null):{}}function Ur(e){return this.has(e)&&delete this.__data__[e]}function Lr(e){var a=this.__data__;if(Pt){var o=a[e];return o===i?void 0:o}return ft.call(a,e)?a[e]:void 0}function Ke(e){var a=this.__data__;return Pt?a[e]!==void 0:ft.call(a,e)}function ye(e,a){var o=this.__data__;return o[e]=Pt&&a===void 0?i:a,this}mt.prototype.clear=Hr,mt.prototype.delete=Ur,mt.prototype.get=Lr,mt.prototype.has=Ke,mt.prototype.set=ye;function $(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Gr(){this.__data__=[]}function Wr(e){var a=this.__data__,o=$t(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Nr.call(a,o,1),!0}function Br(e){var a=this.__data__,o=$t(a,e);return o<0?void 0:a[o][1]}function $r(e){return $t(this.__data__,e)>-1}function Kr(e,a){var o=this.__data__,u=$t(o,e);return u<0?o.push([e,a]):o[u][1]=a,this}$.prototype.clear=Gr,$.prototype.delete=Wr,$.prototype.get=Br,$.prototype.has=$r,$.prototype.set=Kr;function Y(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Yr(){this.__data__={hash:new mt,map:new(Mt||$),string:new mt}}function Vr(e){return jt(this,e).delete(e)}function Xr(e){return jt(this,e).get(e)}function qr(e){return jt(this,e).has(e)}function Zr(e,a){return jt(this,e).set(e,a),this}Y.prototype.clear=Yr,Y.prototype.delete=Vr,Y.prototype.get=Xr,Y.prototype.has=qr,Y.prototype.set=Zr;function J(e){this.__data__=new $(e)}function Jr(){this.__data__=new $}function Qr(e){return this.__data__.delete(e)}function tn(e){return this.__data__.get(e)}function en(e){return this.__data__.has(e)}function rn(e,a){var o=this.__data__;if(o instanceof $){var u=o.__data__;if(!Mt||u.length<n-1)return u.push([e,a]),this;o=this.__data__=new Y(u)}return o.set(e,a),this}J.prototype.clear=Jr,J.prototype.delete=Qr,J.prototype.get=tn,J.prototype.has=en,J.prototype.set=rn;function Bt(e,a){var o=_e(e)||Yt(e)?ie(e.length,String):[],u=o.length,O=!!u;for(var w in e)ft.call(e,w)&&!(O&&(w=="length"||bn(w,u)))&&o.push(w);return o}function Ye(e,a,o){var u=e[a];(!(ft.call(e,a)&&Je(u,o))||o===void 0&&!(a in e))&&(e[a]=o)}function $t(e,a){for(var o=e.length;o--;)if(Je(e[o][0],a))return o;return-1}function pt(e,a){return e&&ge(a,ve(a),e)}function me(e,a,o,u,O,w,C){var D;if(u&&(D=w?u(e,O,w,C):u(e)),D!==void 0)return D;if(!ht(e))return e;var G=_e(e);if(G){if(D=yn(e),!a)return pn(e,D)}else{var F=gt(e),V=F==E||F==U;if(Qe(e))return Kt(e,a);if(F==h||F==c||V&&!w){if(ae(e))return w?e:{};if(D=dt(V?{}:e),!a)return dn(e,pt(D,e))}else{if(!N[F])return w?e:{};D=mn(e,F,me,a)}}C||(C=new J);var Q=C.get(e);if(Q)return Q;if(C.set(e,D),!G)var B=o?hn(e):ve(e);return Re(B||e,function(X,K){B&&(K=X,X=e[K]),Ye(D,K,me(X,a,o,u,K,e,C))}),D}function nn(e){return ht(e)?Ge(e):{}}function an(e,a,o){var u=a(e);return _e(e)?u:Fe(u,o(e))}function sn(e){return Ht.call(e)}function on(e){if(!ht(e)||_n(e))return!1;var a=Ie(e)||ae(e)?zr:Mr;return a.test(Z(e))}function cn(e){if(!qe(e))return Be(e);var a=[];for(var o in Object(e))ft.call(e,o)&&o!="constructor"&&a.push(o);return a}function Kt(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function be(e){var a=new e.constructor(e.byteLength);return new ce(a).set(new ce(e)),a}function Ct(e,a){var o=a?be(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function Ve(e,a,o){var u=a?o(Ne(e),!0):Ne(e);return ne(u,jr,new e.constructor)}function Xe(e){var a=new e.constructor(e.source,xr.exec(e));return a.lastIndex=e.lastIndex,a}function un(e,a,o){var u=a?o(He(e),!0):He(e);return ne(u,ot,new e.constructor)}function ln(e){return $e?Object($e.call(e)):{}}function fn(e,a){var o=a?be(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function pn(e,a){var o=-1,u=e.length;for(a||(a=Array(u));++o<u;)a[o]=e[o];return a}function ge(e,a,o,u){o||(o={});for(var O=-1,w=a.length;++O<w;){var C=a[O],D=void 0;Ye(o,C,D===void 0?e[C]:D)}return o}function dn(e,a){return ge(e,bt(e),a)}function hn(e){return an(e,ve,bt)}function jt(e,a){var o=e.__data__;return gn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function ut(e,a){var o=ze(e,a);return on(o)?o:void 0}var bt=ue?se(ue,Object):vn,gt=sn;(Gt&>(new Gt(new ArrayBuffer(1)))!=x||Mt&>(new Mt)!=b||ct&>(ct.resolve())!=l||Wt&>(new Wt)!=I||le&>(new le)!=g)&&(gt=function(e){var a=Ht.call(e),o=a==h?e.constructor:void 0,u=o?Z(o):void 0;if(u)switch(u){case fe:return x;case Dt:return b;case pe:return l;case de:return I;case he:return g}return a});function yn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&ft.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function dt(e){return typeof e.constructor=="function"&&!qe(e)?nn(at(e)):{}}function mn(e,a,o,u){var O=e.constructor;switch(a){case j:return be(e);case d:case M:return new O(+e);case x:return Ct(e,u);case v:case P:case S:case R:case k:case T:case L:case vt:case De:return fn(e,u);case b:return Ve(e,u,o);case p:case _:return new O(e);case y:return Xe(e);case I:return un(e,u,o);case m:return ln(e)}}function bn(e,a){return a=a??s,!!a&&(typeof e=="number"||Pr.test(e))&&e>-1&&e%1==0&&e<a}function gn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function _n(e){return!!Ue&&Ue in e}function qe(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Nt;return e===o}function Z(e){if(e!=null){try{return Le.call(e)}catch{}try{return e+""}catch{}}return""}function Ze(e){return me(e,!0,!0)}function Je(e,a){return e===a||e!==e&&a!==a}function Yt(e){return In(e)&&ft.call(e,"callee")&&(!We.call(e,"callee")||Ht.call(e)==c)}var _e=Array.isArray;function Vt(e){return e!=null&&tr(e.length)&&!Ie(e)}function In(e){return er(e)&&Vt(e)}var Qe=Lt||Sn;function Ie(e){var a=ht(e)?Ht.call(e):"";return a==E||a==U}function tr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function ht(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function er(e){return!!e&&typeof e=="object"}function ve(e){return Vt(e)?Bt(e):cn(e)}function vn(){return[]}function Sn(){return!1}t.exports=Ze}(Ee,Ee.exports);var Si=Ee.exports;const tt=fr(Si),wi=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),Ti=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),ki=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,f=i.videoHeight;r({duration:s,width:c,height:f})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),Fn=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},pr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},Ae={color:"#000000",x:0,y:0,blur:0},Xt=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},zn=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function Oe(t,r){const n={x:t.size.width/2,y:t.size.height/2},i={x:r.width/2,y:r.height/2},s=Math.min(t.size.width/r.width,t.size.height/r.height),c=n.x-i.x;return{top:`${n.y-i.y}px`,left:`${c}px`,transform:`scale(${s})`}}const Nn=async(t,r)=>{const n=t.details.src,i=await ki(n),s=Oe(r,{...i}),c=zn(t.trim,{duration:i.duration}),f={width:i.width,height:i.height,duration:i.duration,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||Ae,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg"};return{...t,trim:c,type:"video",name:"video",details:f,playbackRate:t.playbackRate||1,display:Xt(t.display,{duration:i.duration,trim:c})}},Hn=async t=>{const r=t.id,n=t.details,s=(await Ti(n.src)).duration,c=zn(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:Xt(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,duration:s,volume:n.volume??100},metadata:{...t.metadata}}},Un=async(t,r)=>{const n=t.details,i=await wi(n.src),s=Oe(r,i);return{id:t.id,type:"image",name:"image",display:Xt(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||Ae,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg"},metadata:t.metadata||{}}},Ln=async(t,r)=>{const n=t;n.details.fontUrl&&await pr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=Wn(s),f=Fn(n.details.text,c),d=Oe(r,{width:c.width,height:f});return{id:i,name:"caption",type:"caption",display:Xt(n.display),details:{...c,text:s.text||"",height:f,fontUrl:s.fontUrl,top:c.top||d.top,left:c.left||d.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||Ae,words:s.words||[]},metadata:{}}},Gn=async(t,r)=>{t.details.fontUrl&&await pr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=Wn(i),c=Fn(t.details.text,s),f=Oe(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:Xt(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||f.top,left:s.left||f.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||Ae},metadata:{}}},Wn=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top||"0px",left:t.left||"0px",textTransform:t.textTransform||"none",transform:t.transform||"none"}),Ei="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let dr=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Ei[n[t]&63];return r};function Ai(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0)return i})}function Bn(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=dr(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const zt=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0);function Oi(t){const r=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.DESIGN_PREFIX))),n=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.ADD_PREFIX))),i=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.LAYER_PREFIX))),s=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.HISTORY_PREFIX))),c=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.ACTIVE_PREFIX))),f=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.EDIT_PREFIX))),d=r.subscribe(async p=>{var h,l;if(p.key===A.DESIGN_LOAD){const y=(h=p.value)==null?void 0:h.payload,I=y.size,_=y.trackItemIds,m=y.trackItemsMap,g=y.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");const j=_.map(async v=>{var P;try{const S=g[v],R=m[v];if(S.type==="image"){const k=await Un({id:v,details:S.details,...R},{size:I}),{details:T,...L}=k;g[v]={type:"image",details:T},m[v]=L}else if(S.type==="video"){const k=tt((P=p.value)==null?void 0:P.payload.trackItemsMap[v]),T=await Nn({...S,...k,...R},{size:I}),{details:L,...vt}=T;g[v]={type:"video",details:L},m[v]=vt}else if(S.type==="audio"){const k=await Hn({id:v,details:S.details,...R}),{details:T,...L}=k;g[v]={type:"audio",details:T},m[v]=L}else if(S.type==="caption"){const k=await Ln({id:v,details:S.details,...R},{size:I}),{details:T,...L}=k;g[v]={type:"caption",details:T},m[v]=L}else if(S.type==="text"){const k=await Gn({id:v,details:S.details,...R},{size:I}),{details:T,...L}=k;g[v]={type:"text",details:T},m[v]=L}return!0}catch{return!1}});await Promise.all(j);const x=zt(m);t.updateState({...y,trackItemsMap:m,duration:x})}if(p.key===A.DESIGN_RESIZE){const y=(l=p.value)==null?void 0:l.payload;t.updateState({size:y})}}),M=s.subscribe(p=>{if(p.key===A.HISTORY_UNDO)return t.undo();if(p.key===A.HISTORY_REDO)return t.redo()}),z=i.subscribe(p=>{var l,y,I;const h=[];if((l=p.value)!=null&&l.payload.trackItemIds&&(h.push((y=p.value)==null?void 0:y.payload.trackItemIds),t.updateState({activeIds:h})),p.key===A.LAYER_DELETE){const _=(I=p.value)==null?void 0:I.payload.trackItemIds,m=tt(t.getState()),g=_&&_.length?_:m.activeIds,j=m.trackItemIds,x=m.trackItemDetailsMap,v=j.filter(T=>!g.includes(T)),P=Object.fromEntries(Object.entries(x).filter(([T])=>!g.includes(T))),S=Ai(m.tracks,g),R=Object.fromEntries(Object.entries(m.trackItemsMap).filter(([T])=>!g.includes(T))),k=zt(R);t.updateState({trackItemIds:v,trackItemDetailsMap:P,activeIds:[],trackItemsMap:R,tracks:S,duration:k},{updateHistory:!0,kind:"remove"})}}),E=n.subscribe(async p=>{var _,m,g,j,x;const h=tt(t.getState());let l=[],y="text";if(p.key===A.ADD_CAPTION){y="caption";const v=(_=p.value)==null?void 0:_.payload,P=[];for(const k of v){const T=Ln(k,{size:h.size});P.push(T)}const S=await Promise.all(P),R=[];for(const k of S){const T=k.id;R.push(T);const{details:L,...vt}=k;h.trackItemDetailsMap[T]={type:y,details:L},h.trackItemsMap[T]=vt,h.trackItemIds.push(T)}l=R}if(p.key===A.ADD_TEXT){y="text";const v=await Gn((m=p.value)==null?void 0:m.payload,{size:h.size}),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}if(p.key===A.ADD_IMAGE){y="image";const v=await Un((g=p.value)==null?void 0:g.payload,{size:h.size}),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}if(p.key===A.ADD_AUDIO){y="audio";const v=await Hn((j=p.value)==null?void 0:j.payload),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}if(p.key===A.ADD_VIDEO){y="video";const v=await Nn((x=p.value)==null?void 0:x.payload,{size:h.size}),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}h.tracks.unshift({id:dr(),accepts:["text","audio","helper","video","image","caption"],type:y,items:l,magnetic:!1,static:!1});const I=zt(h.trackItemsMap);t.updateState({trackItemIds:h.trackItemIds,trackItemDetailsMap:h.trackItemDetailsMap,trackItemsMap:h.trackItemsMap,tracks:h.tracks,duration:I},{updateHistory:!0,kind:"add"})}),U=c.subscribe(async p=>{var h;if(p.key===A.ACTIVE_SPLIT){const l=tt(t.getState()),y=(h=p.value)==null?void 0:h.options.time;if(l.activeIds.length===1){const I=l.activeIds[0],_=l.trackItemsMap[I];if(y>=_.display.to||y<=_.display.from)return;const m=l.trackItemDetailsMap[I],g=Bn(),j={..._,id:g,display:{from:y,to:_.display.to},trim:{from:y,to:_.display.to}};l.trackItemsMap[I].display.to=y,l.trackItemsMap[g]=j,l.trackItemIds.push(g),l.trackItemDetailsMap[g]=m,l.tracks.forEach(x=>{x.items.includes(I)&&x.items.push(g)}),t.updateState({trackItemDetailsMap:l.trackItemDetailsMap,tracks:l.tracks,trackItemIds:l.trackItemIds,trackItemsMap:l.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(p.key===A.ACTIVE_CLONE){const l=tt(t.getState());if(l.activeIds.length){const y=l.activeIds,I=[],_={activeIds:y,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};y.forEach(g=>{_.trackItemDetailsMap[g]=l.trackItemDetailsMap[g],_.trackItemsMap[g]=l.trackItemsMap[g],I.push(l.tracks.find(j=>j.items.includes(g)))});const m=new Set;I.filter(g=>m.has(g.id)?!1:(m.add(g),!0)),_.tracks=Array.from(m.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(_))}}if(p.key===A.ACTIVE_PASTE){const l=localStorage.getItem("DesignComboTemp");if(!l)return;const y=tt(t.getState()),I=JSON.parse(l),_={},m=I.trackItemsMap,g=I.trackItemDetailsMap,j=I.tracks,x=[],v=I.activeIds.map(async P=>{const S=g[P];(S.type==="caption"||S.type==="text")&&S.details.fontUrl&&await pr([{fontFamily:S.details.fontFamily,url:S.details.fontUrl}]);const R=Bn();return _[P]=R,y.trackItemsMap[R]={...m[P],id:R},y.trackItemDetailsMap[R]=S,y.trackItemIds.push(R),!0});await Promise.all(v),j.forEach(P=>{const S=P.items.map(k=>_[k]),R={...P,items:S,id:dr()};x.push(R)}),y.tracks=[...y.tracks,...x],t.updateState({trackItemDetailsMap:y.trackItemDetailsMap,tracks:y.tracks,trackItemIds:y.trackItemIds,trackItemsMap:y.trackItemsMap},{updateHistory:!0,kind:"update"})}}),b=f.subscribe(p=>{var h,l;if(p.key===A.EDIT_OBJECT){const y=tt(t.getState()),I=y.trackItemDetailsMap,_=y.trackItemsMap,m=Object.keys((h=p.value)==null?void 0:h.payload);if(!m.length)return;const g=(l=p.value)==null?void 0:l.payload;m.forEach(x=>{const v=g[x];v.details?I[x].details={...I[x].details,...v.details}:v.playbackRate&&(_[x].playbackRate=v.playbackRate)});const j=zt(_);t.updateState({trackItemDetailsMap:{...I},trackItemsMap:{..._},duration:j},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{E.unsubscribe(),U.unsubscribe(),b.unsubscribe(),M.unsubscribe(),z.unsubscribe(),d.unsubscribe()}}}const xi={Date:!0,RegExp:!0,String:!0,Number:!0};function $n(t,r,n={cyclesFix:!0},i=[]){var d,M;let s=[];const c=Array.isArray(t);for(const z in t){const E=t[z],U=c?+z:z;if(!(z in r)){s.push({type:"REMOVE",path:[U],oldValue:t[z]});continue}const b=r[z],p=typeof E=="object"&&typeof b=="object"&&Array.isArray(E)===Array.isArray(b);if(E&&b&&p&&!xi[(M=(d=Object.getPrototypeOf(E))==null?void 0:d.constructor)==null?void 0:M.name]&&(!n.cyclesFix||!i.includes(E))){const h=$n(E,b,n,n.cyclesFix?i.concat([E]):[]);s.push.apply(s,h.map(l=>(l.path.unshift(U),l)))}else E!==b&&!(Number.isNaN(E)&&Number.isNaN(b))&&!(p&&(isNaN(E)?E+""==b+"":+E==+b))&&s.push({path:[U],type:"CHANGE",value:b,oldValue:E})}const f=Array.isArray(r);for(const z in r)z in t||s.push({type:"CREATE",path:[f?+z:z],value:r[z]});return s}var hr=Symbol.for("immer-nothing"),qt=Symbol.for("immer-draftable"),et=Symbol.for("immer-state"),Kn=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function W(t,...r){if(process.env.NODE_ENV!=="production"){const n=Kn[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Tt=Object.getPrototypeOf;function kt(t){return!!t&&!!t[et]}function It(t){var r;return t?Yn(t)||Array.isArray(t)||!!t[qt]||!!((r=t.constructor)!=null&&r[qt])||Qt(t)||te(t):!1}var Mi=Object.prototype.constructor.toString();function Yn(t){if(!t||typeof t!="object")return!1;const r=Tt(t);if(r===null)return!0;const n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Mi}function Zt(t,r){Et(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function Et(t){const r=t[et];return r?r.type_:Array.isArray(t)?1:Qt(t)?2:te(t)?3:0}function Jt(t,r){return Et(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function yr(t,r){return Et(t)===2?t.get(r):t[r]}function Vn(t,r,n){const i=Et(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function Pi(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Qt(t){return t instanceof Map}function te(t){return t instanceof Set}function At(t){return t.copy_||t.base_}function mr(t,r){if(Qt(t))return new Map(t);if(te(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Yn(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[et];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const f=s[c],d=i[f];d.writable===!1&&(d.writable=!0,d.configurable=!0),(d.get||d.set)&&(i[f]={configurable:!0,writable:!0,enumerable:d.enumerable,value:t[f]})}return Object.create(Tt(t),i)}else{const i=Tt(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function br(t,r=!1){return xe(t)||kt(t)||!It(t)||(Et(t)>1&&(t.set=t.add=t.clear=t.delete=Di),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>br(i,!0))),t}function Di(){W(2)}function xe(t){return Object.isFrozen(t)}var gr={};function Ot(t){const r=gr[t];return r||W(0,t),r}function Ci(t,r){gr[t]||(gr[t]=r)}var ee;function Xn(){return ee}function ji(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function qn(t,r){r&&(Ot("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function _r(t){Ir(t),t.drafts_.forEach(Ri),t.drafts_=null}function Ir(t){t===ee&&(ee=t.parent_)}function Zn(t){return ee=ji(ee,t)}function Ri(t){const r=t[et];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Jn(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[et].modified_&&(_r(r),W(4)),It(t)&&(t=Me(r,t),r.parent_||Pe(r,t)),r.patches_&&Ot("Patches").generateReplacementPatches_(n[et].base_,t,r.patches_,r.inversePatches_)):t=Me(r,n,[]),_r(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==hr?t:void 0}function Me(t,r,n){if(xe(r))return r;const i=r[et];if(!i)return Zt(r,(s,c)=>Qn(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return Pe(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,f=!1;i.type_===3&&(c=new Set(s),s.clear(),f=!0),Zt(c,(d,M)=>Qn(t,i,s,d,M,n,f)),Pe(t,s,!1),n&&t.patches_&&Ot("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Qn(t,r,n,i,s,c,f){if(process.env.NODE_ENV!=="production"&&s===n&&W(5),kt(s)){const d=c&&r&&r.type_!==3&&!Jt(r.assigned_,i)?c.concat(i):void 0,M=Me(t,s,d);if(Vn(n,i,M),kt(M))t.canAutoFreeze_=!1;else return}else f&&n.add(s);if(It(s)&&!xe(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;Me(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&Pe(t,s)}}function Pe(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&br(r,n)}function Fi(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Xn(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=vr;n&&(s=[i],c=re);const{revoke:f,proxy:d}=Proxy.revocable(s,c);return i.draft_=d,i.revoke_=f,d}var vr={get(t,r){if(r===et)return t;const n=At(t);if(!Jt(n,r))return zi(t,n,r);const i=n[r];return t.finalized_||!It(i)?i:i===Sr(t.base_,r)?(Tr(t),t.copy_[r]=kr(i,t)):i},has(t,r){return r in At(t)},ownKeys(t){return Reflect.ownKeys(At(t))},set(t,r,n){const i=ti(At(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=Sr(At(t),r),c=s==null?void 0:s[et];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Pi(n,s)&&(n!==void 0||Jt(t.base_,r)))return!0;Tr(t),wr(t)}return t.copy_[r]===n&&(n!==void 0||r in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[r])||(t.copy_[r]=n,t.assigned_[r]=!0),!0},deleteProperty(t,r){return Sr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Tr(t),wr(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=At(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){W(11)},getPrototypeOf(t){return Tt(t.base_)},setPrototypeOf(){W(12)}},re={};Zt(vr,(t,r)=>{re[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),re.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&W(13),re.set.call(this,t,r,void 0)},re.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&W(14),vr.set.call(this,t[0],r,n,t[0])};function Sr(t,r){const n=t[et];return(n?At(n):t)[r]}function zi(t,r,n){var s;const i=ti(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function ti(t,r){if(!(r in t))return;let n=Tt(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=Tt(n)}}function wr(t){t.modified_||(t.modified_=!0,t.parent_&&wr(t.parent_))}function Tr(t){t.copy_||(t.copy_=mr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Ni=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const f=this;return function(M=c,...z){return f.produce(M,E=>n.call(this,E,...z))}}typeof n!="function"&&W(6),i!==void 0&&typeof i!="function"&&W(7);let s;if(It(r)){const c=Zn(this),f=kr(r,void 0);let d=!0;try{s=n(f),d=!1}finally{d?_r(c):Ir(c)}return qn(c,i),Jn(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===hr&&(s=void 0),this.autoFreeze_&&br(s,!0),i){const c=[],f=[];Ot("Patches").generateReplacementPatches_(r,s,c,f),i(c,f)}return s}else W(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(f,...d)=>this.produceWithPatches(f,M=>r(M,...d));let i,s;return[this.produce(r,n,(f,d)=>{i=f,s=d}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){It(t)||W(8),kt(t)&&(t=Hi(t));const r=Zn(this),n=kr(t,void 0);return n[et].isManual_=!0,Ir(r),n}finishDraft(t,r){const n=t&&t[et];(!n||!n.isManual_)&&W(9);const{scope_:i}=n;return qn(i,r),Jn(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=Ot("Patches").applyPatches_;return kt(t)?i(t,r):this.produce(t,s=>i(s,r))}};function kr(t,r){const n=Qt(t)?Ot("MapSet").proxyMap_(t,r):te(t)?Ot("MapSet").proxySet_(t,r):Fi(t,r);return(r?r.scope_:Xn()).drafts_.push(n),n}function Hi(t){return kt(t)||W(10,t),ei(t)}function ei(t){if(!It(t)||xe(t))return t;const r=t[et];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=mr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=mr(t,!0);return Zt(n,(i,s)=>{Vn(n,i,ei(s))}),r&&(r.finalized_=!1),n}function ri(){process.env.NODE_ENV!=="production"&&Kn.push('Sets cannot have "replace" patches.',function(b){return"Unsupported patch operation: "+b},function(b){return"Cannot apply patch, path doesn't resolve: "+b},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(b,p,h,l){switch(b.type_){case 0:case 2:return f(b,p,h,l);case 1:return c(b,p,h,l);case 3:return d(b,p,h,l)}}function c(b,p,h,l){let{base_:y,assigned_:I}=b,_=b.copy_;_.length<y.length&&([y,_]=[_,y],[h,l]=[l,h]);for(let m=0;m<y.length;m++)if(I[m]&&_[m]!==y[m]){const g=p.concat([m]);h.push({op:r,path:g,value:U(_[m])}),l.push({op:r,path:g,value:U(y[m])})}for(let m=y.length;m<_.length;m++){const g=p.concat([m]);h.push({op:n,path:g,value:U(_[m])})}for(let m=_.length-1;y.length<=m;--m){const g=p.concat([m]);l.push({op:i,path:g})}}function f(b,p,h,l){const{base_:y,copy_:I}=b;Zt(b.assigned_,(_,m)=>{const g=yr(y,_),j=yr(I,_),x=m?Jt(y,_)?r:n:i;if(g===j&&x===r)return;const v=p.concat(_);h.push(x===i?{op:x,path:v}:{op:x,path:v,value:j}),l.push(x===n?{op:i,path:v}:x===i?{op:n,path:v,value:U(g)}:{op:r,path:v,value:U(g)})})}function d(b,p,h,l){let{base_:y,copy_:I}=b,_=0;y.forEach(m=>{if(!I.has(m)){const g=p.concat([_]);h.push({op:i,path:g,value:m}),l.unshift({op:n,path:g,value:m})}_++}),_=0,I.forEach(m=>{if(!y.has(m)){const g=p.concat([_]);h.push({op:n,path:g,value:m}),l.unshift({op:i,path:g,value:m})}_++})}function M(b,p,h,l){h.push({op:r,path:[],value:p===hr?void 0:p}),l.push({op:r,path:[],value:b})}function z(b,p){return p.forEach(h=>{const{path:l,op:y}=h;let I=b;for(let j=0;j<l.length-1;j++){const x=Et(I);let v=l[j];typeof v!="string"&&typeof v!="number"&&(v=""+v),(x===0||x===1)&&(v==="__proto__"||v==="constructor")&&W(19),typeof I=="function"&&v==="prototype"&&W(19),I=yr(I,v),typeof I!="object"&&W(18,l.join("/"))}const _=Et(I),m=E(h.value),g=l[l.length-1];switch(y){case r:switch(_){case 2:return I.set(g,m);case 3:W(16);default:return I[g]=m}case n:switch(_){case 1:return g==="-"?I.push(m):I.splice(g,0,m);case 2:return I.set(g,m);case 3:return I.add(m);default:return I[g]=m}case i:switch(_){case 1:return I.splice(g,1);case 2:return I.delete(g);case 3:return I.delete(h.value);default:return delete I[g]}default:W(17,y)}}),b}function E(b){if(!It(b))return b;if(Array.isArray(b))return b.map(E);if(Qt(b))return new Map(Array.from(b.entries()).map(([h,l])=>[h,E(l)]));if(te(b))return new Set(Array.from(b).map(E));const p=Object.create(Tt(b));for(const h in b)p[h]=E(b[h]);return Jt(b,qt)&&(p[qt]=b[qt]),p}function U(b){return kt(b)?E(b):b}Ci("Patches",{applyPatches_:z,generatePatches_:s,generateReplacementPatches_:M})}var rt=new Ni,Ui=rt.produce;rt.produceWithPatches.bind(rt),rt.setAutoFreeze.bind(rt),rt.setUseStrictShallowCopy.bind(rt);var Li=rt.applyPatches.bind(rt);rt.createDraft.bind(rt),rt.finishDraft.bind(rt);var Gi=1/0,Wi=9007199254740991,Bi="[object Arguments]",$i="[object Function]",Ki="[object GeneratorFunction]",Yi="[object Symbol]",Vi=typeof nt=="object"&&nt&&nt.Object===Object&&nt,Xi=typeof self=="object"&&self&&self.Object===Object&&self,qi=Vi||Xi||Function("return this")();function Zi(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function Ji(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function Qi(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var Er=Object.prototype,ta=Er.hasOwnProperty,Ar=Er.toString,ni=qi.Symbol,ea=Er.propertyIsEnumerable,ii=ni?ni.isConcatSpreadable:void 0,ai=Math.max;function ra(t,r,n,i,s){var c=-1,f=t.length;for(n||(n=sa),s||(s=[]);++c<f;){var d=t[c];n(d)?Qi(s,d):s[s.length]=d}return s}function na(t,r){return t=Object(t),ia(t,r,function(n,i){return i in t})}function ia(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var f=r[i],d=t[f];n(d,f)&&(c[f]=d)}return c}function aa(t,r){return r=ai(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=ai(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var f=Array(r+1);++i<r;)f[i]=n[i];return f[r]=c,Zi(t,this,f)}}function sa(t){return ua(t)||ca(t)||!!(ii&&t&&t[ii])}function oa(t){if(typeof t=="string"||ya(t))return t;var r=t+"";return r=="0"&&1/t==-Gi?"-0":r}function ca(t){return fa(t)&&ta.call(t,"callee")&&(!ea.call(t,"callee")||Ar.call(t)==Bi)}var ua=Array.isArray;function la(t){return t!=null&&da(t.length)&&!pa(t)}function fa(t){return si(t)&&la(t)}function pa(t){var r=ha(t)?Ar.call(t):"";return r==$i||r==Ki}function da(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Wi}function ha(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function si(t){return!!t&&typeof t=="object"}function ya(t){return typeof t=="symbol"||si(t)&&Ar.call(t)==Yi}var ma=aa(function(t,r){return t==null?{}:na(t,Ji(ra(r),oa))}),ba=ma;const oi=fr(ba),ga={size:{width:1080,height:1920},tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1},duration:0,activeIds:[],trackItemDetailsMap:{}},ci=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class _a{constructor(r){Ft(this,"stateSubject");Ft(this,"stateHistorySubject");Ft(this,"prevState");Ft(this,"undos",[]);Ft(this,"redos",[]);Ft(this,"listener");const n=r||ga;this.stateSubject=new Rn(n),this.stateHistorySubject=new Rn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Oi(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=oi(r,ci),s=oi(this.getState(),ci),c=$n(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};it(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemIds,this.prevState.trackItemIds)||r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!it(n.tracks,this.prevState.tracks)||!it(n.trackItemIds,this.prevState.trackItemIds)||!it(n.trackItemsMap,this.prevState.trackItemsMap)||!it(n.transitionIds,this.prevState.transitionIds)||!it(n.transitionsMap,this.prevState.transitionsMap))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;ri();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}=this.getState(),E=tt({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}),U=[],b=[],p=[],h=[],l=[],y=[];n.forEach(k=>{let T;const L=k.path.slice(1);k.type==="CREATE"?T={path:L,op:"remove",value:k.value}:k.type==="CHANGE"?T={path:L,op:"replace",value:k.oldValue}:T={path:L,op:"add",value:k.oldValue},k.path.includes("trackItemIds")?p.push(T):k.path.includes("transitionIds")?b.push(T):k.path.includes("trackItemsMap")?l.push(T):k.path.includes("transitionsMap")?h.push(T):k.path.includes("tracks")?U.push(T):k.path.includes("trackItemDetailsMap")&&y.push(T)});const I=this.applyPatch(E.tracks,U),_=this.applyPatch(E.transitionIds,b),m=this.applyPatch(E.trackItemIds,p),g=this.applyPatch(E.transitionsMap,h),j=this.applyPatch(E.trackItemsMap,l),x=this.applyPatch(E.trackItemDetailsMap,y),v=tt({tracks:I,transitionIds:_,trackItemIds:m,transitionsMap:g,trackItemsMap:j,trackItemDetailsMap:x}),P=tt(this.getState()),S={...P,...v};this.prevState=P,this.redos.push({redos:n,type:i});const R=zt(S.trackItemsMap);this.stateSubject.next({...S,duration:R}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>Ui(i,c=>{Li(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;ri();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}=this.getState(),E=tt({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}),U=[],b=[],p=[],h=[],l=[],y=[];n.forEach(k=>{let T;const L=k.path.slice(1);k.type==="CREATE"?T={path:L,op:"add",value:k.value}:k.type==="CHANGE"?T={path:L,op:"replace",value:k.value}:T={path:L,op:"remove",value:k.oldValue},k.path.includes("trackItemIds")?p.push(T):k.path.includes("transitionIds")?b.push(T):k.path.includes("trackItemsMap")?l.push(T):k.path.includes("transitionsMap")?h.push(T):k.path.includes("trackItemDetailsMap")?y.push(T):U.push(T)});const I=this.applyPatch(E.tracks,U),_=this.applyPatch(E.transitionIds,b),m=this.applyPatch(E.trackItemIds,p),g=this.applyPatch(E.transitionsMap,h),j=this.applyPatch(E.trackItemsMap,l),x=this.applyPatch(E.trackItemDetailsMap,y),v=tt({tracks:I,transitionIds:_,trackItemIds:m,transitionsMap:g,trackItemsMap:j,trackItemDetailsMap:x}),P=tt(this.getState()),S={...P,...v};this.prevState=P,this.undos.push({undos:n,type:i});const R=zt(S.trackItemsMap);this.stateSubject.next({...S,duration:R}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}return _a});
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function cr(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Se=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var f=this._parentage;if(f)if(this._parentage=null,Array.isArray(f))try{for(var d=ir(f),M=d.next();!M.done;M=d.next()){var z=M.value;z.remove(this)}}catch(l){r={error:l}}finally{try{M&&!M.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}else f.remove(this);var E=this.initialTeardown;if(yt(E))try{E()}catch(l){c=l instanceof or?l.errors:[l]}var U=this._finalizers;if(U){this._finalizers=null;try{for(var b=ir(U),p=b.next();!p.done;p=b.next()){var h=p.value;try{En(h)}catch(l){c=c??[],l instanceof or?c=sr(sr([],ar(c)),ar(l.errors)):c.push(l)}}}catch(l){i={error:l}}finally{try{p&&!p.done&&(s=b.return)&&s.call(b)}finally{if(i)throw i.error}}}if(c)throw new or(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)En(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(r)}},t.prototype._hasParent=function(r){var n=this._parentage;return n===r||Array.isArray(n)&&n.includes(r)},t.prototype._addParent=function(r){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(r),n):n?[n,r]:r},t.prototype._removeParent=function(r){var n=this._parentage;n===r?this._parentage=null:Array.isArray(n)&&cr(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&cr(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),Tn=Se.EMPTY;function kn(t){return t instanceof Se||t&&"closed"in t&&yt(t.remove)&&yt(t.add)&&yt(t.unsubscribe)}function En(t){yt(t)?t():t.unsubscribe()}var An={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},On={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,sr([t,r],ar(n)))},clearTimeout:function(t){var r=On.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function li(t){On.setTimeout(function(){throw t})}function xn(){}function we(t){t()}var Mn=function(t){lt(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,kn(n)&&n.add(i)):i.destination=hi,i}return r.create=function(n,i,s){return new lr(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Se),fi=Function.prototype.bind;function ur(t,r){return fi.call(t,r)}var pi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){Te(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){Te(i)}else Te(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){Te(n)}},t}(),lr=function(t){lt(r,t);function r(n,i,s){var c=t.call(this)||this,f;if(yt(n)||!n)f={next:n??void 0,error:i??void 0,complete:s??void 0};else{var d;c&&An.useDeprecatedNextContext?(d=Object.create(n),d.unsubscribe=function(){return c.unsubscribe()},f={next:n.next&&ur(n.next,d),error:n.error&&ur(n.error,d),complete:n.complete&&ur(n.complete,d)}):f=n}return c.destination=new pi(f),c}return r}(Mn);function Te(t){li(t)}function di(t){throw t}var hi={closed:!0,next:xn,error:di,complete:xn},yi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function mi(t){return t}function bi(t){return t.length===0?mi:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var Pn=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=_i(r)?r:new lr(r,n,i);return we(function(){var f=s,d=f.operator,M=f.source;c.add(d?d.call(c,M):M?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Dn(n),new n(function(s,c){var f=new lr({next:function(d){try{r(d)}catch(M){c(M),f.unsubscribe()}},error:c,complete:s});i.subscribe(f)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[yi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return bi(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Dn(r),new r(function(i,s){var c;n.subscribe(function(f){return c=f},function(f){return s(f)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Dn(t){var r;return(r=t??An.Promise)!==null&&r!==void 0?r:Promise}function gi(t){return t&&yt(t.next)&&yt(t.error)&&yt(t.complete)}function _i(t){return t&&t instanceof Mn||gi(t)&&kn(t)}var Ii=wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Cn=function(t){lt(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new jn(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new Ii},r.prototype.next=function(n){var i=this;we(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var f=ir(i.currentObservers),d=f.next();!d.done;d=f.next()){var M=d.value;M.next(n)}}catch(z){s={error:z}}finally{try{d&&!d.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;we(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;we(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,f=s.isStopped,d=s.observers;return c||f?Tn:(this.currentObservers=null,d.push(n),new Se(function(){i.currentObservers=null,cr(d,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,f=i.isStopped;s?n.error(c):f&&n.complete()},r.prototype.asObservable=function(){var n=new Pn;return n.source=this,n},r.create=function(n,i){return new jn(n,i)},r}(Pn),jn=function(t){lt(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:Tn},r}(Cn),Rn=function(t){lt(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Cn),nt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ke={exports:{}};ke.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,f=9007199254740991,d="[object Arguments]",M="[object Array]",z="[object AsyncFunction]",E="[object Boolean]",U="[object Date]",b="[object Error]",p="[object Function]",h="[object GeneratorFunction]",l="[object Map]",y="[object Number]",I="[object Null]",_="[object Object]",m="[object Promise]",g="[object Proxy]",j="[object RegExp]",x="[object Set]",v="[object String]",P="[object Symbol]",S="[object Undefined]",R="[object WeakMap]",k="[object ArrayBuffer]",T="[object DataView]",L="[object Float32Array]",vt="[object Float64Array]",De="[object Int8Array]",Or="[object Int16Array]",xr="[object Int32Array]",Mr="[object Uint8Array]",Pr="[object Uint8ClampedArray]",N="[object Uint16Array]",Dr="[object Uint32Array]",Cr=/[\\^$.*+?()[\]{}|]/g,st=/^\[object .+?Constructor\]$/,Ce=/^(?:0|[1-9]\d*)$/,H={};H[L]=H[vt]=H[De]=H[Or]=H[xr]=H[Mr]=H[Pr]=H[N]=H[Dr]=!0,H[d]=H[M]=H[k]=H[E]=H[T]=H[U]=H[b]=H[p]=H[l]=H[y]=H[_]=H[j]=H[x]=H[v]=H[R]=!1;var je=typeof nt=="object"&&nt&&nt.Object===Object&&nt,jr=typeof self=="object"&&self&&self.Object===Object&&self,ot=je||jr||Function("return this")(),Re=r&&!r.nodeType&&r,Fe=Re&&!0&&t&&!t.nodeType&&t,ne=Fe&&Fe.exports===Re,ie=ne&&je.process,ze=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),ae=ze&&ze.isTypedArray;function Ne(e,a){for(var o=-1,u=e==null?0:e.length,O=0,w=[];++o<u;){var C=e[o];a(C,o,e)&&(w[O++]=C)}return w}function se(e,a){for(var o=-1,u=a.length,O=e.length;++o<u;)e[O+o]=a[o];return e}function He(e,a){for(var o=-1,u=e==null?0:e.length;++o<u;)if(a(e[o],o,e))return!0;return!1}function Rr(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function Fr(e){return function(a){return e(a)}}function Nt(e,a){return e.has(a)}function oe(e,a){return e==null?void 0:e[a]}function Ue(e){var a=-1,o=Array(e.size);return e.forEach(function(u,O){o[++a]=[O,u]}),o}function Le(e,a){return function(o){return e(a(o))}}function ft(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Ht=Array.prototype,zr=Function.prototype,xt=Object.prototype,Ut=ot["__core-js_shared__"],ce=zr.toString,at=xt.hasOwnProperty,Ge=function(){var e=/[^.]+$/.exec(Ut&&Ut.keys&&Ut.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),We=xt.toString,Nr=RegExp("^"+ce.call(at).replace(Cr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ue=ne?ot.Buffer:void 0,Lt=ot.Symbol,Be=ot.Uint8Array,Gt=xt.propertyIsEnumerable,Mt=Ht.splice,ct=Lt?Lt.toStringTag:void 0,Wt=Object.getOwnPropertySymbols,le=ue?ue.isBuffer:void 0,Pt=Le(Object.keys,Object),fe=bt(ot,"DataView"),Dt=bt(ot,"Map"),pe=bt(ot,"Promise"),de=bt(ot,"Set"),he=bt(ot,"WeakMap"),St=bt(Object,"create"),$e=Z(fe),mt=Z(Dt),Hr=Z(pe),Ur=Z(de),Lr=Z(he),Ke=Lt?Lt.prototype:void 0,ye=Ke?Ke.valueOf:void 0;function $(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Gr(){this.__data__=St?St(null):{},this.size=0}function Wr(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function Br(e){var a=this.__data__;if(St){var o=a[e];return o===i?void 0:o}return at.call(a,e)?a[e]:void 0}function $r(e){var a=this.__data__;return St?a[e]!==void 0:at.call(a,e)}function Kr(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=St&&a===void 0?i:a,this}$.prototype.clear=Gr,$.prototype.delete=Wr,$.prototype.get=Br,$.prototype.has=$r,$.prototype.set=Kr;function Y(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Yr(){this.__data__=[],this.size=0}function Vr(e){var a=this.__data__,o=Kt(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Mt.call(a,o,1),--this.size,!0}function Xr(e){var a=this.__data__,o=Kt(a,e);return o<0?void 0:a[o][1]}function qr(e){return Kt(this.__data__,e)>-1}function Zr(e,a){var o=this.__data__,u=Kt(o,e);return u<0?(++this.size,o.push([e,a])):o[u][1]=a,this}Y.prototype.clear=Yr,Y.prototype.delete=Vr,Y.prototype.get=Xr,Y.prototype.has=qr,Y.prototype.set=Zr;function J(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Jr(){this.size=0,this.__data__={hash:new $,map:new(Dt||Y),string:new $}}function Qr(e){var a=ut(this,e).delete(e);return this.size-=a?1:0,a}function tn(e){return ut(this,e).get(e)}function en(e){return ut(this,e).has(e)}function rn(e,a){var o=ut(this,e),u=o.size;return o.set(e,a),this.size+=o.size==u?0:1,this}J.prototype.clear=Jr,J.prototype.delete=Qr,J.prototype.get=tn,J.prototype.has=en,J.prototype.set=rn;function Bt(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new J;++a<o;)this.add(e[a])}function Ye(e){return this.__data__.set(e,i),this}function $t(e){return this.__data__.has(e)}Bt.prototype.add=Bt.prototype.push=Ye,Bt.prototype.has=$t;function pt(e){var a=this.__data__=new Y(e);this.size=a.size}function me(){this.__data__=new Y,this.size=0}function nn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function an(e){return this.__data__.get(e)}function sn(e){return this.__data__.has(e)}function on(e,a){var o=this.__data__;if(o instanceof Y){var u=o.__data__;if(!Dt||u.length<n-1)return u.push([e,a]),this.size=++o.size,this;o=this.__data__=new J(u)}return o.set(e,a),this.size=o.size,this}pt.prototype.clear=me,pt.prototype.delete=nn,pt.prototype.get=an,pt.prototype.has=sn,pt.prototype.set=on;function cn(e,a){var o=Yt(e),u=!o&&Je(e),O=!o&&!u&&Vt(e),w=!o&&!u&&!O&&er(e),C=o||u||O||w,D=C?Rr(e.length,String):[],G=D.length;for(var F in e)at.call(e,F)&&!(C&&(F=="length"||O&&(F=="offset"||F=="parent")||w&&(F=="buffer"||F=="byteLength"||F=="byteOffset")||mn(F,G)))&&D.push(F);return D}function Kt(e,a){for(var o=e.length;o--;)if(Ze(e[o][0],a))return o;return-1}function be(e,a,o){var u=a(e);return Yt(e)?u:se(u,o(e))}function Ct(e){return e==null?e===void 0?S:I:ct&&ct in Object(e)?gt(e):qe(e)}function Ve(e){return ht(e)&&Ct(e)==d}function Xe(e,a,o,u,O){return e===a?!0:e==null||a==null||!ht(e)&&!ht(a)?e!==e&&a!==a:un(e,a,o,u,Xe,O)}function un(e,a,o,u,O,w){var C=Yt(e),D=Yt(a),G=C?M:dt(e),F=D?M:dt(a);G=G==d?_:G,F=F==d?_:F;var V=G==_,Q=F==_,B=G==F;if(B&&Vt(e)){if(!Vt(a))return!1;C=!0,V=!1}if(B&&!V)return w||(w=new pt),C||er(e)?ge(e,a,o,u,O,w):dn(e,a,G,o,u,O,w);if(!(o&s)){var X=V&&at.call(e,"__wrapped__"),K=Q&&at.call(a,"__wrapped__");if(X||K){var wt=X?e.value():e,_t=K?a.value():a;return w||(w=new pt),O(wt,_t,o,u,w)}}return B?(w||(w=new pt),hn(e,a,o,u,O,w)):!1}function ln(e){if(!tr(e)||gn(e))return!1;var a=Qe(e)?Nr:st;return a.test(Z(e))}function fn(e){return ht(e)&&Ie(e.length)&&!!H[Ct(e)]}function pn(e){if(!_n(e))return Pt(e);var a=[];for(var o in Object(e))at.call(e,o)&&o!="constructor"&&a.push(o);return a}function ge(e,a,o,u,O,w){var C=o&s,D=e.length,G=a.length;if(D!=G&&!(C&&G>D))return!1;var F=w.get(e);if(F&&w.get(a))return F==a;var V=-1,Q=!0,B=o&c?new Bt:void 0;for(w.set(e,a),w.set(a,e);++V<D;){var X=e[V],K=a[V];if(u)var wt=C?u(K,X,V,a,e,w):u(X,K,V,e,a,w);if(wt!==void 0){if(wt)continue;Q=!1;break}if(B){if(!He(a,function(_t,Rt){if(!Nt(B,Rt)&&(X===_t||O(X,_t,o,u,w)))return B.push(Rt)})){Q=!1;break}}else if(!(X===K||O(X,K,o,u,w))){Q=!1;break}}return w.delete(e),w.delete(a),Q}function dn(e,a,o,u,O,w,C){switch(o){case T:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case k:return!(e.byteLength!=a.byteLength||!w(new Be(e),new Be(a)));case E:case U:case y:return Ze(+e,+a);case b:return e.name==a.name&&e.message==a.message;case j:case v:return e==a+"";case l:var D=Ue;case x:var G=u&s;if(D||(D=ft),e.size!=a.size&&!G)return!1;var F=C.get(e);if(F)return F==a;u|=c,C.set(e,a);var V=ge(D(e),D(a),u,O,w,C);return C.delete(e),V;case P:if(ye)return ye.call(e)==ye.call(a)}return!1}function hn(e,a,o,u,O,w){var C=o&s,D=jt(e),G=D.length,F=jt(a),V=F.length;if(G!=V&&!C)return!1;for(var Q=G;Q--;){var B=D[Q];if(!(C?B in a:at.call(a,B)))return!1}var X=w.get(e);if(X&&w.get(a))return X==a;var K=!0;w.set(e,a),w.set(a,e);for(var wt=C;++Q<G;){B=D[Q];var _t=e[B],Rt=a[B];if(u)var ui=C?u(Rt,_t,B,a,e,w):u(_t,Rt,B,e,a,w);if(!(ui===void 0?_t===Rt||O(_t,Rt,o,u,w):ui)){K=!1;break}wt||(wt=B=="constructor")}if(K&&!wt){var rr=e.constructor,nr=a.constructor;rr!=nr&&"constructor"in e&&"constructor"in a&&!(typeof rr=="function"&&rr instanceof rr&&typeof nr=="function"&&nr instanceof nr)&&(K=!1)}return w.delete(e),w.delete(a),K}function jt(e){return be(e,ve,yn)}function ut(e,a){var o=e.__data__;return bn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function bt(e,a){var o=oe(e,a);return ln(o)?o:void 0}function gt(e){var a=at.call(e,ct),o=e[ct];try{e[ct]=void 0;var u=!0}catch{}var O=We.call(e);return u&&(a?e[ct]=o:delete e[ct]),O}var yn=Wt?function(e){return e==null?[]:(e=Object(e),Ne(Wt(e),function(a){return Gt.call(e,a)}))}:vn,dt=Ct;(fe&&dt(new fe(new ArrayBuffer(1)))!=T||Dt&&dt(new Dt)!=l||pe&&dt(pe.resolve())!=m||de&&dt(new de)!=x||he&&dt(new he)!=R)&&(dt=function(e){var a=Ct(e),o=a==_?e.constructor:void 0,u=o?Z(o):"";if(u)switch(u){case $e:return T;case mt:return l;case Hr:return m;case Ur:return x;case Lr:return R}return a});function mn(e,a){return a=a??f,!!a&&(typeof e=="number"||Ce.test(e))&&e>-1&&e%1==0&&e<a}function bn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function gn(e){return!!Ge&&Ge in e}function _n(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||xt;return e===o}function qe(e){return We.call(e)}function Z(e){if(e!=null){try{return ce.call(e)}catch{}try{return e+""}catch{}}return""}function Ze(e,a){return e===a||e!==e&&a!==a}var Je=Ve(function(){return arguments}())?Ve:function(e){return ht(e)&&at.call(e,"callee")&&!Gt.call(e,"callee")},Yt=Array.isArray;function _e(e){return e!=null&&Ie(e.length)&&!Qe(e)}var Vt=le||Sn;function In(e,a){return Xe(e,a)}function Qe(e){if(!tr(e))return!1;var a=Ct(e);return a==p||a==h||a==z||a==g}function Ie(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=f}function tr(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function ht(e){return e!=null&&typeof e=="object"}var er=ae?Fr(ae):fn;function ve(e){return _e(e)?cn(e):pn(e)}function vn(){return[]}function Sn(){return!1}t.exports=In}(ke,ke.exports);var vi=ke.exports;const it=fr(vi);var Ee={exports:{}};Ee.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",f="[object Array]",d="[object Boolean]",M="[object Date]",z="[object Error]",E="[object Function]",U="[object GeneratorFunction]",b="[object Map]",p="[object Number]",h="[object Object]",l="[object Promise]",y="[object RegExp]",I="[object Set]",_="[object String]",m="[object Symbol]",g="[object WeakMap]",j="[object ArrayBuffer]",x="[object DataView]",v="[object Float32Array]",P="[object Float64Array]",S="[object Int8Array]",R="[object Int16Array]",k="[object Int32Array]",T="[object Uint8Array]",L="[object Uint8ClampedArray]",vt="[object Uint16Array]",De="[object Uint32Array]",Or=/[\\^$.*+?()[\]{}|]/g,xr=/\w*$/,Mr=/^\[object .+?Constructor\]$/,Pr=/^(?:0|[1-9]\d*)$/,N={};N[c]=N[f]=N[j]=N[x]=N[d]=N[M]=N[v]=N[P]=N[S]=N[R]=N[k]=N[b]=N[p]=N[h]=N[y]=N[I]=N[_]=N[m]=N[T]=N[L]=N[vt]=N[De]=!0,N[z]=N[E]=N[g]=!1;var Dr=typeof nt=="object"&&nt&&nt.Object===Object&&nt,Cr=typeof self=="object"&&self&&self.Object===Object&&self,st=Dr||Cr||Function("return this")(),Ce=r&&!r.nodeType&&r,H=Ce&&!0&&t&&!t.nodeType&&t,je=H&&H.exports===Ce;function jr(e,a){return e.set(a[0],a[1]),e}function ot(e,a){return e.add(a),e}function Re(e,a){for(var o=-1,u=e?e.length:0;++o<u&&a(e[o],o,e)!==!1;);return e}function Fe(e,a){for(var o=-1,u=a.length,O=e.length;++o<u;)e[O+o]=a[o];return e}function ne(e,a,o,u){for(var O=-1,w=e?e.length:0;++O<w;)o=a(o,e[O],O,e);return o}function ie(e,a){for(var o=-1,u=Array(e);++o<e;)u[o]=a(o);return u}function ze(e,a){return e==null?void 0:e[a]}function ae(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function Ne(e){var a=-1,o=Array(e.size);return e.forEach(function(u,O){o[++a]=[O,u]}),o}function se(e,a){return function(o){return e(a(o))}}function He(e){var a=-1,o=Array(e.size);return e.forEach(function(u){o[++a]=u}),o}var Rr=Array.prototype,Fr=Function.prototype,Nt=Object.prototype,oe=st["__core-js_shared__"],Ue=function(){var e=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Le=Fr.toString,ft=Nt.hasOwnProperty,Ht=Nt.toString,zr=RegExp("^"+Le.call(ft).replace(Or,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xt=je?st.Buffer:void 0,Ut=st.Symbol,ce=st.Uint8Array,at=se(Object.getPrototypeOf,Object),Ge=Object.create,We=Nt.propertyIsEnumerable,Nr=Rr.splice,ue=Object.getOwnPropertySymbols,Lt=xt?xt.isBuffer:void 0,Be=se(Object.keys,Object),Gt=ut(st,"DataView"),Mt=ut(st,"Map"),ct=ut(st,"Promise"),Wt=ut(st,"Set"),le=ut(st,"WeakMap"),Pt=ut(Object,"create"),fe=Z(Gt),Dt=Z(Mt),pe=Z(ct),de=Z(Wt),he=Z(le),St=Ut?Ut.prototype:void 0,$e=St?St.valueOf:void 0;function mt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Hr(){this.__data__=Pt?Pt(null):{}}function Ur(e){return this.has(e)&&delete this.__data__[e]}function Lr(e){var a=this.__data__;if(Pt){var o=a[e];return o===i?void 0:o}return ft.call(a,e)?a[e]:void 0}function Ke(e){var a=this.__data__;return Pt?a[e]!==void 0:ft.call(a,e)}function ye(e,a){var o=this.__data__;return o[e]=Pt&&a===void 0?i:a,this}mt.prototype.clear=Hr,mt.prototype.delete=Ur,mt.prototype.get=Lr,mt.prototype.has=Ke,mt.prototype.set=ye;function $(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Gr(){this.__data__=[]}function Wr(e){var a=this.__data__,o=$t(a,e);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():Nr.call(a,o,1),!0}function Br(e){var a=this.__data__,o=$t(a,e);return o<0?void 0:a[o][1]}function $r(e){return $t(this.__data__,e)>-1}function Kr(e,a){var o=this.__data__,u=$t(o,e);return u<0?o.push([e,a]):o[u][1]=a,this}$.prototype.clear=Gr,$.prototype.delete=Wr,$.prototype.get=Br,$.prototype.has=$r,$.prototype.set=Kr;function Y(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var u=e[a];this.set(u[0],u[1])}}function Yr(){this.__data__={hash:new mt,map:new(Mt||$),string:new mt}}function Vr(e){return jt(this,e).delete(e)}function Xr(e){return jt(this,e).get(e)}function qr(e){return jt(this,e).has(e)}function Zr(e,a){return jt(this,e).set(e,a),this}Y.prototype.clear=Yr,Y.prototype.delete=Vr,Y.prototype.get=Xr,Y.prototype.has=qr,Y.prototype.set=Zr;function J(e){this.__data__=new $(e)}function Jr(){this.__data__=new $}function Qr(e){return this.__data__.delete(e)}function tn(e){return this.__data__.get(e)}function en(e){return this.__data__.has(e)}function rn(e,a){var o=this.__data__;if(o instanceof $){var u=o.__data__;if(!Mt||u.length<n-1)return u.push([e,a]),this;o=this.__data__=new Y(u)}return o.set(e,a),this}J.prototype.clear=Jr,J.prototype.delete=Qr,J.prototype.get=tn,J.prototype.has=en,J.prototype.set=rn;function Bt(e,a){var o=_e(e)||Yt(e)?ie(e.length,String):[],u=o.length,O=!!u;for(var w in e)ft.call(e,w)&&!(O&&(w=="length"||bn(w,u)))&&o.push(w);return o}function Ye(e,a,o){var u=e[a];(!(ft.call(e,a)&&Je(u,o))||o===void 0&&!(a in e))&&(e[a]=o)}function $t(e,a){for(var o=e.length;o--;)if(Je(e[o][0],a))return o;return-1}function pt(e,a){return e&&ge(a,ve(a),e)}function me(e,a,o,u,O,w,C){var D;if(u&&(D=w?u(e,O,w,C):u(e)),D!==void 0)return D;if(!ht(e))return e;var G=_e(e);if(G){if(D=yn(e),!a)return pn(e,D)}else{var F=gt(e),V=F==E||F==U;if(Qe(e))return Kt(e,a);if(F==h||F==c||V&&!w){if(ae(e))return w?e:{};if(D=dt(V?{}:e),!a)return dn(e,pt(D,e))}else{if(!N[F])return w?e:{};D=mn(e,F,me,a)}}C||(C=new J);var Q=C.get(e);if(Q)return Q;if(C.set(e,D),!G)var B=o?hn(e):ve(e);return Re(B||e,function(X,K){B&&(K=X,X=e[K]),Ye(D,K,me(X,a,o,u,K,e,C))}),D}function nn(e){return ht(e)?Ge(e):{}}function an(e,a,o){var u=a(e);return _e(e)?u:Fe(u,o(e))}function sn(e){return Ht.call(e)}function on(e){if(!ht(e)||_n(e))return!1;var a=Ie(e)||ae(e)?zr:Mr;return a.test(Z(e))}function cn(e){if(!qe(e))return Be(e);var a=[];for(var o in Object(e))ft.call(e,o)&&o!="constructor"&&a.push(o);return a}function Kt(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function be(e){var a=new e.constructor(e.byteLength);return new ce(a).set(new ce(e)),a}function Ct(e,a){var o=a?be(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function Ve(e,a,o){var u=a?o(Ne(e),!0):Ne(e);return ne(u,jr,new e.constructor)}function Xe(e){var a=new e.constructor(e.source,xr.exec(e));return a.lastIndex=e.lastIndex,a}function un(e,a,o){var u=a?o(He(e),!0):He(e);return ne(u,ot,new e.constructor)}function ln(e){return $e?Object($e.call(e)):{}}function fn(e,a){var o=a?be(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function pn(e,a){var o=-1,u=e.length;for(a||(a=Array(u));++o<u;)a[o]=e[o];return a}function ge(e,a,o,u){o||(o={});for(var O=-1,w=a.length;++O<w;){var C=a[O],D=void 0;Ye(o,C,D===void 0?e[C]:D)}return o}function dn(e,a){return ge(e,bt(e),a)}function hn(e){return an(e,ve,bt)}function jt(e,a){var o=e.__data__;return gn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function ut(e,a){var o=ze(e,a);return on(o)?o:void 0}var bt=ue?se(ue,Object):vn,gt=sn;(Gt&>(new Gt(new ArrayBuffer(1)))!=x||Mt&>(new Mt)!=b||ct&>(ct.resolve())!=l||Wt&>(new Wt)!=I||le&>(new le)!=g)&&(gt=function(e){var a=Ht.call(e),o=a==h?e.constructor:void 0,u=o?Z(o):void 0;if(u)switch(u){case fe:return x;case Dt:return b;case pe:return l;case de:return I;case he:return g}return a});function yn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&ft.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function dt(e){return typeof e.constructor=="function"&&!qe(e)?nn(at(e)):{}}function mn(e,a,o,u){var O=e.constructor;switch(a){case j:return be(e);case d:case M:return new O(+e);case x:return Ct(e,u);case v:case P:case S:case R:case k:case T:case L:case vt:case De:return fn(e,u);case b:return Ve(e,u,o);case p:case _:return new O(e);case y:return Xe(e);case I:return un(e,u,o);case m:return ln(e)}}function bn(e,a){return a=a??s,!!a&&(typeof e=="number"||Pr.test(e))&&e>-1&&e%1==0&&e<a}function gn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function _n(e){return!!Ue&&Ue in e}function qe(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Nt;return e===o}function Z(e){if(e!=null){try{return Le.call(e)}catch{}try{return e+""}catch{}}return""}function Ze(e){return me(e,!0,!0)}function Je(e,a){return e===a||e!==e&&a!==a}function Yt(e){return In(e)&&ft.call(e,"callee")&&(!We.call(e,"callee")||Ht.call(e)==c)}var _e=Array.isArray;function Vt(e){return e!=null&&tr(e.length)&&!Ie(e)}function In(e){return er(e)&&Vt(e)}var Qe=Lt||Sn;function Ie(e){var a=ht(e)?Ht.call(e):"";return a==E||a==U}function tr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function ht(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function er(e){return!!e&&typeof e=="object"}function ve(e){return Vt(e)?Bt(e):cn(e)}function vn(){return[]}function Sn(){return!1}t.exports=Ze}(Ee,Ee.exports);var Si=Ee.exports;const tt=fr(Si),wi=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),Ti=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),ki=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,f=i.videoHeight;r({duration:s,width:c,height:f})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),Fn=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},pr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},Ae={color:"#000000",x:0,y:0,blur:0},Xt=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},zn=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function Oe(t,r){const n={x:t.size.width/2,y:t.size.height/2},i={x:r.width/2,y:r.height/2},s=Math.min(t.size.width/r.width,t.size.height/r.height),c=n.x-i.x;return{top:`${n.y-i.y}px`,left:`${c}px`,transform:`scale(${s})`}}const Nn=async(t,r)=>{const n=t.details.src,i=await ki(n),s=Oe(r,{...i}),c=zn(t.trim,{duration:i.duration}),f={width:i.width,height:i.height,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||Ae,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg"};return{...t,trim:c,type:"video",name:"video",details:f,playbackRate:t.playbackRate||1,display:Xt(t.display,{duration:i.duration,trim:c}),duration:i.duration}},Hn=async t=>{const r=t.id,n=t.details,s=(await Ti(n.src)).duration,c=zn(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:Xt(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,volume:n.volume??100},metadata:{...t.metadata},duration:s}},Un=async(t,r)=>{const n=t.details,i=await wi(n.src),s=Oe(r,i);return{id:t.id,type:"image",name:"image",display:Xt(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||Ae,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg"},metadata:t.metadata||{}}},Ln=async(t,r)=>{const n=t;n.details.fontUrl&&await pr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=Wn(s),f=Fn(n.details.text,c),d=Oe(r,{width:c.width,height:f});return{id:i,name:"caption",type:"caption",display:Xt(n.display),details:{...c,text:s.text||"",height:f,fontUrl:s.fontUrl,top:c.top||d.top,left:c.left||d.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||Ae,words:s.words||[]},metadata:{}}},Gn=async(t,r)=>{t.details.fontUrl&&await pr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=Wn(i),c=Fn(t.details.text,s),f=Oe(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:Xt(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||f.top,left:s.left||f.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||Ae},metadata:{}}},Wn=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top||"0px",left:t.left||"0px",textTransform:t.textTransform||"none",transform:t.transform||"none"}),Ei="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let dr=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Ei[n[t]&63];return r};function Ai(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0)return i})}function Bn(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=dr(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const zt=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0);function Oi(t){const r=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.DESIGN_PREFIX))),n=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.ADD_PREFIX))),i=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.LAYER_PREFIX))),s=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.HISTORY_PREFIX))),c=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.ACTIVE_PREFIX))),f=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.EDIT_PREFIX))),d=r.subscribe(async p=>{var h,l;if(p.key===A.DESIGN_LOAD){const y=(h=p.value)==null?void 0:h.payload,I=y.size,_=y.trackItemIds,m=y.trackItemsMap,g=y.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");const j=_.map(async v=>{var P;try{const S=g[v],R=m[v];if(S.type==="image"){const k=await Un({id:v,details:S.details,...R},{size:I}),{details:T,...L}=k;g[v]={type:"image",details:T},m[v]=L}else if(S.type==="video"){const k=tt((P=p.value)==null?void 0:P.payload.trackItemsMap[v]),T=await Nn({...S,...k,...R},{size:I}),{details:L,...vt}=T;g[v]={type:"video",details:L},m[v]=vt}else if(S.type==="audio"){const k=await Hn({id:v,details:S.details,...R}),{details:T,...L}=k;g[v]={type:"audio",details:T},m[v]=L}else if(S.type==="caption"){const k=await Ln({id:v,details:S.details,...R},{size:I}),{details:T,...L}=k;g[v]={type:"caption",details:T},m[v]=L}else if(S.type==="text"){const k=await Gn({id:v,details:S.details,...R},{size:I}),{details:T,...L}=k;g[v]={type:"text",details:T},m[v]=L}return!0}catch{return!1}});await Promise.all(j);const x=zt(m);t.updateState({...y,trackItemsMap:m,duration:x})}if(p.key===A.DESIGN_RESIZE){const y=(l=p.value)==null?void 0:l.payload;t.updateState({size:y})}}),M=s.subscribe(p=>{if(p.key===A.HISTORY_UNDO)return t.undo();if(p.key===A.HISTORY_REDO)return t.redo()}),z=i.subscribe(p=>{var l,y,I;const h=[];if((l=p.value)!=null&&l.payload.trackItemIds&&(h.push((y=p.value)==null?void 0:y.payload.trackItemIds),t.updateState({activeIds:h})),p.key===A.LAYER_DELETE){const _=(I=p.value)==null?void 0:I.payload.trackItemIds,m=tt(t.getState()),g=_&&_.length?_:m.activeIds,j=m.trackItemIds,x=m.trackItemDetailsMap,v=j.filter(T=>!g.includes(T)),P=Object.fromEntries(Object.entries(x).filter(([T])=>!g.includes(T))),S=Ai(m.tracks,g),R=Object.fromEntries(Object.entries(m.trackItemsMap).filter(([T])=>!g.includes(T))),k=zt(R);t.updateState({trackItemIds:v,trackItemDetailsMap:P,activeIds:[],trackItemsMap:R,tracks:S,duration:k},{updateHistory:!0,kind:"remove"})}}),E=n.subscribe(async p=>{var _,m,g,j,x;const h=tt(t.getState());let l=[],y="text";if(p.key===A.ADD_CAPTION){y="caption";const v=(_=p.value)==null?void 0:_.payload,P=[];for(const k of v){const T=Ln(k,{size:h.size});P.push(T)}const S=await Promise.all(P),R=[];for(const k of S){const T=k.id;R.push(T);const{details:L,...vt}=k;h.trackItemDetailsMap[T]={type:y,details:L},h.trackItemsMap[T]=vt,h.trackItemIds.push(T)}l=R}if(p.key===A.ADD_TEXT){y="text";const v=await Gn((m=p.value)==null?void 0:m.payload,{size:h.size}),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}if(p.key===A.ADD_IMAGE){y="image";const v=await Un((g=p.value)==null?void 0:g.payload,{size:h.size}),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}if(p.key===A.ADD_AUDIO){y="audio";const v=await Hn((j=p.value)==null?void 0:j.payload),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}if(p.key===A.ADD_VIDEO){y="video";const v=await Nn((x=p.value)==null?void 0:x.payload,{size:h.size}),{details:P,...S}=v;h.trackItemDetailsMap[S.id]={type:y,details:P},h.trackItemsMap[S.id]=S,h.trackItemIds.push(S.id),l=[S.id]}h.tracks.unshift({id:dr(),accepts:["text","audio","helper","video","image","caption"],type:y,items:l,magnetic:!1,static:!1});const I=zt(h.trackItemsMap);t.updateState({trackItemIds:h.trackItemIds,trackItemDetailsMap:h.trackItemDetailsMap,trackItemsMap:h.trackItemsMap,tracks:h.tracks,duration:I},{updateHistory:!0,kind:"add"})}),U=c.subscribe(async p=>{var h;if(p.key===A.ACTIVE_SPLIT){const l=tt(t.getState()),y=(h=p.value)==null?void 0:h.options.time;if(l.activeIds.length===1){const I=l.activeIds[0],_=l.trackItemsMap[I];if(y>=_.display.to||y<=_.display.from)return;const m=l.trackItemDetailsMap[I],g=Bn(),j={..._,id:g,display:{from:y,to:_.display.to},trim:{from:y,to:_.display.to}};l.trackItemsMap[I].display.to=y,l.trackItemsMap[g]=j,l.trackItemIds.push(g),l.trackItemDetailsMap[g]=m,l.tracks.forEach(x=>{x.items.includes(I)&&x.items.push(g)}),t.updateState({trackItemDetailsMap:l.trackItemDetailsMap,tracks:l.tracks,trackItemIds:l.trackItemIds,trackItemsMap:l.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(p.key===A.ACTIVE_CLONE){const l=tt(t.getState());if(l.activeIds.length){const y=l.activeIds,I=[],_={activeIds:y,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};y.forEach(g=>{_.trackItemDetailsMap[g]=l.trackItemDetailsMap[g],_.trackItemsMap[g]=l.trackItemsMap[g],I.push(l.tracks.find(j=>j.items.includes(g)))});const m=new Set;I.filter(g=>m.has(g.id)?!1:(m.add(g),!0)),_.tracks=Array.from(m.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(_))}}if(p.key===A.ACTIVE_PASTE){const l=localStorage.getItem("DesignComboTemp");if(!l)return;const y=tt(t.getState()),I=JSON.parse(l),_={},m=I.trackItemsMap,g=I.trackItemDetailsMap,j=I.tracks,x=[],v=I.activeIds.map(async P=>{const S=g[P];(S.type==="caption"||S.type==="text")&&S.details.fontUrl&&await pr([{fontFamily:S.details.fontFamily,url:S.details.fontUrl}]);const R=Bn();return _[P]=R,y.trackItemsMap[R]={...m[P],id:R},y.trackItemDetailsMap[R]=S,y.trackItemIds.push(R),!0});await Promise.all(v),j.forEach(P=>{const S=P.items.map(k=>_[k]),R={...P,items:S,id:dr()};x.push(R)}),y.tracks=[...y.tracks,...x],t.updateState({trackItemDetailsMap:y.trackItemDetailsMap,tracks:y.tracks,trackItemIds:y.trackItemIds,trackItemsMap:y.trackItemsMap},{updateHistory:!0,kind:"update"})}}),b=f.subscribe(p=>{var h,l;if(p.key===A.EDIT_OBJECT){const y=tt(t.getState()),I=y.trackItemDetailsMap,_=y.trackItemsMap,m=Object.keys((h=p.value)==null?void 0:h.payload);if(!m.length)return;const g=(l=p.value)==null?void 0:l.payload;m.forEach(x=>{const v=g[x];v.details?I[x].details={...I[x].details,...v.details}:v.playbackRate&&(_[x].playbackRate=v.playbackRate)});const j=zt(_);t.updateState({trackItemDetailsMap:{...I},trackItemsMap:{..._},duration:j},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{E.unsubscribe(),U.unsubscribe(),b.unsubscribe(),M.unsubscribe(),z.unsubscribe(),d.unsubscribe()}}}const xi={Date:!0,RegExp:!0,String:!0,Number:!0};function $n(t,r,n={cyclesFix:!0},i=[]){var d,M;let s=[];const c=Array.isArray(t);for(const z in t){const E=t[z],U=c?+z:z;if(!(z in r)){s.push({type:"REMOVE",path:[U],oldValue:t[z]});continue}const b=r[z],p=typeof E=="object"&&typeof b=="object"&&Array.isArray(E)===Array.isArray(b);if(E&&b&&p&&!xi[(M=(d=Object.getPrototypeOf(E))==null?void 0:d.constructor)==null?void 0:M.name]&&(!n.cyclesFix||!i.includes(E))){const h=$n(E,b,n,n.cyclesFix?i.concat([E]):[]);s.push.apply(s,h.map(l=>(l.path.unshift(U),l)))}else E!==b&&!(Number.isNaN(E)&&Number.isNaN(b))&&!(p&&(isNaN(E)?E+""==b+"":+E==+b))&&s.push({path:[U],type:"CHANGE",value:b,oldValue:E})}const f=Array.isArray(r);for(const z in r)z in t||s.push({type:"CREATE",path:[f?+z:z],value:r[z]});return s}var hr=Symbol.for("immer-nothing"),qt=Symbol.for("immer-draftable"),et=Symbol.for("immer-state"),Kn=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function W(t,...r){if(process.env.NODE_ENV!=="production"){const n=Kn[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Tt=Object.getPrototypeOf;function kt(t){return!!t&&!!t[et]}function It(t){var r;return t?Yn(t)||Array.isArray(t)||!!t[qt]||!!((r=t.constructor)!=null&&r[qt])||Qt(t)||te(t):!1}var Mi=Object.prototype.constructor.toString();function Yn(t){if(!t||typeof t!="object")return!1;const r=Tt(t);if(r===null)return!0;const n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Mi}function Zt(t,r){Et(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function Et(t){const r=t[et];return r?r.type_:Array.isArray(t)?1:Qt(t)?2:te(t)?3:0}function Jt(t,r){return Et(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function yr(t,r){return Et(t)===2?t.get(r):t[r]}function Vn(t,r,n){const i=Et(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function Pi(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Qt(t){return t instanceof Map}function te(t){return t instanceof Set}function At(t){return t.copy_||t.base_}function mr(t,r){if(Qt(t))return new Map(t);if(te(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Yn(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[et];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const f=s[c],d=i[f];d.writable===!1&&(d.writable=!0,d.configurable=!0),(d.get||d.set)&&(i[f]={configurable:!0,writable:!0,enumerable:d.enumerable,value:t[f]})}return Object.create(Tt(t),i)}else{const i=Tt(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function br(t,r=!1){return xe(t)||kt(t)||!It(t)||(Et(t)>1&&(t.set=t.add=t.clear=t.delete=Di),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>br(i,!0))),t}function Di(){W(2)}function xe(t){return Object.isFrozen(t)}var gr={};function Ot(t){const r=gr[t];return r||W(0,t),r}function Ci(t,r){gr[t]||(gr[t]=r)}var ee;function Xn(){return ee}function ji(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function qn(t,r){r&&(Ot("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function _r(t){Ir(t),t.drafts_.forEach(Ri),t.drafts_=null}function Ir(t){t===ee&&(ee=t.parent_)}function Zn(t){return ee=ji(ee,t)}function Ri(t){const r=t[et];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Jn(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[et].modified_&&(_r(r),W(4)),It(t)&&(t=Me(r,t),r.parent_||Pe(r,t)),r.patches_&&Ot("Patches").generateReplacementPatches_(n[et].base_,t,r.patches_,r.inversePatches_)):t=Me(r,n,[]),_r(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==hr?t:void 0}function Me(t,r,n){if(xe(r))return r;const i=r[et];if(!i)return Zt(r,(s,c)=>Qn(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return Pe(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,f=!1;i.type_===3&&(c=new Set(s),s.clear(),f=!0),Zt(c,(d,M)=>Qn(t,i,s,d,M,n,f)),Pe(t,s,!1),n&&t.patches_&&Ot("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Qn(t,r,n,i,s,c,f){if(process.env.NODE_ENV!=="production"&&s===n&&W(5),kt(s)){const d=c&&r&&r.type_!==3&&!Jt(r.assigned_,i)?c.concat(i):void 0,M=Me(t,s,d);if(Vn(n,i,M),kt(M))t.canAutoFreeze_=!1;else return}else f&&n.add(s);if(It(s)&&!xe(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;Me(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&Pe(t,s)}}function Pe(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&br(r,n)}function Fi(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Xn(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=vr;n&&(s=[i],c=re);const{revoke:f,proxy:d}=Proxy.revocable(s,c);return i.draft_=d,i.revoke_=f,d}var vr={get(t,r){if(r===et)return t;const n=At(t);if(!Jt(n,r))return zi(t,n,r);const i=n[r];return t.finalized_||!It(i)?i:i===Sr(t.base_,r)?(Tr(t),t.copy_[r]=kr(i,t)):i},has(t,r){return r in At(t)},ownKeys(t){return Reflect.ownKeys(At(t))},set(t,r,n){const i=ti(At(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=Sr(At(t),r),c=s==null?void 0:s[et];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Pi(n,s)&&(n!==void 0||Jt(t.base_,r)))return!0;Tr(t),wr(t)}return t.copy_[r]===n&&(n!==void 0||r in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[r])||(t.copy_[r]=n,t.assigned_[r]=!0),!0},deleteProperty(t,r){return Sr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Tr(t),wr(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=At(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){W(11)},getPrototypeOf(t){return Tt(t.base_)},setPrototypeOf(){W(12)}},re={};Zt(vr,(t,r)=>{re[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),re.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&W(13),re.set.call(this,t,r,void 0)},re.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&W(14),vr.set.call(this,t[0],r,n,t[0])};function Sr(t,r){const n=t[et];return(n?At(n):t)[r]}function zi(t,r,n){var s;const i=ti(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function ti(t,r){if(!(r in t))return;let n=Tt(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=Tt(n)}}function wr(t){t.modified_||(t.modified_=!0,t.parent_&&wr(t.parent_))}function Tr(t){t.copy_||(t.copy_=mr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Ni=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const f=this;return function(M=c,...z){return f.produce(M,E=>n.call(this,E,...z))}}typeof n!="function"&&W(6),i!==void 0&&typeof i!="function"&&W(7);let s;if(It(r)){const c=Zn(this),f=kr(r,void 0);let d=!0;try{s=n(f),d=!1}finally{d?_r(c):Ir(c)}return qn(c,i),Jn(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===hr&&(s=void 0),this.autoFreeze_&&br(s,!0),i){const c=[],f=[];Ot("Patches").generateReplacementPatches_(r,s,c,f),i(c,f)}return s}else W(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(f,...d)=>this.produceWithPatches(f,M=>r(M,...d));let i,s;return[this.produce(r,n,(f,d)=>{i=f,s=d}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){It(t)||W(8),kt(t)&&(t=Hi(t));const r=Zn(this),n=kr(t,void 0);return n[et].isManual_=!0,Ir(r),n}finishDraft(t,r){const n=t&&t[et];(!n||!n.isManual_)&&W(9);const{scope_:i}=n;return qn(i,r),Jn(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=Ot("Patches").applyPatches_;return kt(t)?i(t,r):this.produce(t,s=>i(s,r))}};function kr(t,r){const n=Qt(t)?Ot("MapSet").proxyMap_(t,r):te(t)?Ot("MapSet").proxySet_(t,r):Fi(t,r);return(r?r.scope_:Xn()).drafts_.push(n),n}function Hi(t){return kt(t)||W(10,t),ei(t)}function ei(t){if(!It(t)||xe(t))return t;const r=t[et];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=mr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=mr(t,!0);return Zt(n,(i,s)=>{Vn(n,i,ei(s))}),r&&(r.finalized_=!1),n}function ri(){process.env.NODE_ENV!=="production"&&Kn.push('Sets cannot have "replace" patches.',function(b){return"Unsupported patch operation: "+b},function(b){return"Cannot apply patch, path doesn't resolve: "+b},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(b,p,h,l){switch(b.type_){case 0:case 2:return f(b,p,h,l);case 1:return c(b,p,h,l);case 3:return d(b,p,h,l)}}function c(b,p,h,l){let{base_:y,assigned_:I}=b,_=b.copy_;_.length<y.length&&([y,_]=[_,y],[h,l]=[l,h]);for(let m=0;m<y.length;m++)if(I[m]&&_[m]!==y[m]){const g=p.concat([m]);h.push({op:r,path:g,value:U(_[m])}),l.push({op:r,path:g,value:U(y[m])})}for(let m=y.length;m<_.length;m++){const g=p.concat([m]);h.push({op:n,path:g,value:U(_[m])})}for(let m=_.length-1;y.length<=m;--m){const g=p.concat([m]);l.push({op:i,path:g})}}function f(b,p,h,l){const{base_:y,copy_:I}=b;Zt(b.assigned_,(_,m)=>{const g=yr(y,_),j=yr(I,_),x=m?Jt(y,_)?r:n:i;if(g===j&&x===r)return;const v=p.concat(_);h.push(x===i?{op:x,path:v}:{op:x,path:v,value:j}),l.push(x===n?{op:i,path:v}:x===i?{op:n,path:v,value:U(g)}:{op:r,path:v,value:U(g)})})}function d(b,p,h,l){let{base_:y,copy_:I}=b,_=0;y.forEach(m=>{if(!I.has(m)){const g=p.concat([_]);h.push({op:i,path:g,value:m}),l.unshift({op:n,path:g,value:m})}_++}),_=0,I.forEach(m=>{if(!y.has(m)){const g=p.concat([_]);h.push({op:n,path:g,value:m}),l.unshift({op:i,path:g,value:m})}_++})}function M(b,p,h,l){h.push({op:r,path:[],value:p===hr?void 0:p}),l.push({op:r,path:[],value:b})}function z(b,p){return p.forEach(h=>{const{path:l,op:y}=h;let I=b;for(let j=0;j<l.length-1;j++){const x=Et(I);let v=l[j];typeof v!="string"&&typeof v!="number"&&(v=""+v),(x===0||x===1)&&(v==="__proto__"||v==="constructor")&&W(19),typeof I=="function"&&v==="prototype"&&W(19),I=yr(I,v),typeof I!="object"&&W(18,l.join("/"))}const _=Et(I),m=E(h.value),g=l[l.length-1];switch(y){case r:switch(_){case 2:return I.set(g,m);case 3:W(16);default:return I[g]=m}case n:switch(_){case 1:return g==="-"?I.push(m):I.splice(g,0,m);case 2:return I.set(g,m);case 3:return I.add(m);default:return I[g]=m}case i:switch(_){case 1:return I.splice(g,1);case 2:return I.delete(g);case 3:return I.delete(h.value);default:return delete I[g]}default:W(17,y)}}),b}function E(b){if(!It(b))return b;if(Array.isArray(b))return b.map(E);if(Qt(b))return new Map(Array.from(b.entries()).map(([h,l])=>[h,E(l)]));if(te(b))return new Set(Array.from(b).map(E));const p=Object.create(Tt(b));for(const h in b)p[h]=E(b[h]);return Jt(b,qt)&&(p[qt]=b[qt]),p}function U(b){return kt(b)?E(b):b}Ci("Patches",{applyPatches_:z,generatePatches_:s,generateReplacementPatches_:M})}var rt=new Ni,Ui=rt.produce;rt.produceWithPatches.bind(rt),rt.setAutoFreeze.bind(rt),rt.setUseStrictShallowCopy.bind(rt);var Li=rt.applyPatches.bind(rt);rt.createDraft.bind(rt),rt.finishDraft.bind(rt);var Gi=1/0,Wi=9007199254740991,Bi="[object Arguments]",$i="[object Function]",Ki="[object GeneratorFunction]",Yi="[object Symbol]",Vi=typeof nt=="object"&&nt&&nt.Object===Object&&nt,Xi=typeof self=="object"&&self&&self.Object===Object&&self,qi=Vi||Xi||Function("return this")();function Zi(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function Ji(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function Qi(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var Er=Object.prototype,ta=Er.hasOwnProperty,Ar=Er.toString,ni=qi.Symbol,ea=Er.propertyIsEnumerable,ii=ni?ni.isConcatSpreadable:void 0,ai=Math.max;function ra(t,r,n,i,s){var c=-1,f=t.length;for(n||(n=sa),s||(s=[]);++c<f;){var d=t[c];n(d)?Qi(s,d):s[s.length]=d}return s}function na(t,r){return t=Object(t),ia(t,r,function(n,i){return i in t})}function ia(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var f=r[i],d=t[f];n(d,f)&&(c[f]=d)}return c}function aa(t,r){return r=ai(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=ai(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var f=Array(r+1);++i<r;)f[i]=n[i];return f[r]=c,Zi(t,this,f)}}function sa(t){return ua(t)||ca(t)||!!(ii&&t&&t[ii])}function oa(t){if(typeof t=="string"||ya(t))return t;var r=t+"";return r=="0"&&1/t==-Gi?"-0":r}function ca(t){return fa(t)&&ta.call(t,"callee")&&(!ea.call(t,"callee")||Ar.call(t)==Bi)}var ua=Array.isArray;function la(t){return t!=null&&da(t.length)&&!pa(t)}function fa(t){return si(t)&&la(t)}function pa(t){var r=ha(t)?Ar.call(t):"";return r==$i||r==Ki}function da(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Wi}function ha(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function si(t){return!!t&&typeof t=="object"}function ya(t){return typeof t=="symbol"||si(t)&&Ar.call(t)==Yi}var ma=aa(function(t,r){return t==null?{}:na(t,Ji(ra(r),oa))}),ba=ma;const oi=fr(ba),ga={size:{width:1080,height:1920},tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{}},ci=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class _a{constructor(r){Ft(this,"stateSubject");Ft(this,"stateHistorySubject");Ft(this,"prevState");Ft(this,"undos",[]);Ft(this,"redos",[]);Ft(this,"listener");const n=r||ga;this.stateSubject=new Rn(n),this.stateHistorySubject=new Rn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Oi(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=oi(r,ci),s=oi(this.getState(),ci),c=$n(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};it(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemIds,this.prevState.trackItemIds)||r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!it(n.tracks,this.prevState.tracks)||!it(n.trackItemIds,this.prevState.trackItemIds)||!it(n.trackItemsMap,this.prevState.trackItemsMap)||!it(n.transitionIds,this.prevState.transitionIds)||!it(n.transitionsMap,this.prevState.transitionsMap))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;ri();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}=this.getState(),E=tt({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}),U=[],b=[],p=[],h=[],l=[],y=[];n.forEach(k=>{let T;const L=k.path.slice(1);k.type==="CREATE"?T={path:L,op:"remove",value:k.value}:k.type==="CHANGE"?T={path:L,op:"replace",value:k.oldValue}:T={path:L,op:"add",value:k.oldValue},k.path.includes("trackItemIds")?p.push(T):k.path.includes("transitionIds")?b.push(T):k.path.includes("trackItemsMap")?l.push(T):k.path.includes("transitionsMap")?h.push(T):k.path.includes("tracks")?U.push(T):k.path.includes("trackItemDetailsMap")&&y.push(T)});const I=this.applyPatch(E.tracks,U),_=this.applyPatch(E.transitionIds,b),m=this.applyPatch(E.trackItemIds,p),g=this.applyPatch(E.transitionsMap,h),j=this.applyPatch(E.trackItemsMap,l),x=this.applyPatch(E.trackItemDetailsMap,y),v=tt({tracks:I,transitionIds:_,trackItemIds:m,transitionsMap:g,trackItemsMap:j,trackItemDetailsMap:x}),P=tt(this.getState()),S={...P,...v};this.prevState=P,this.redos.push({redos:n,type:i});const R=zt(S.trackItemsMap);this.stateSubject.next({...S,duration:R}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>Ui(i,c=>{Li(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;ri();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}=this.getState(),E=tt({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:d,transitionsMap:M,trackItemsMap:z}),U=[],b=[],p=[],h=[],l=[],y=[];n.forEach(k=>{let T;const L=k.path.slice(1);k.type==="CREATE"?T={path:L,op:"add",value:k.value}:k.type==="CHANGE"?T={path:L,op:"replace",value:k.value}:T={path:L,op:"remove",value:k.oldValue},k.path.includes("trackItemIds")?p.push(T):k.path.includes("transitionIds")?b.push(T):k.path.includes("trackItemsMap")?l.push(T):k.path.includes("transitionsMap")?h.push(T):k.path.includes("trackItemDetailsMap")?y.push(T):U.push(T)});const I=this.applyPatch(E.tracks,U),_=this.applyPatch(E.transitionIds,b),m=this.applyPatch(E.trackItemIds,p),g=this.applyPatch(E.transitionsMap,h),j=this.applyPatch(E.trackItemsMap,l),x=this.applyPatch(E.trackItemDetailsMap,y),v=tt({tracks:I,transitionIds:_,trackItemIds:m,transitionsMap:g,trackItemsMap:j,trackItemDetailsMap:x}),P=tt(this.getState()),S={...P,...v};this.prevState=P,this.undos.push({undos:n,type:i});const R=zt(S.trackItemsMap);this.stateSubject.next({...S,duration:R}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}return _a});
|
@@ -14,6 +14,7 @@ export declare const loadVideoItem: (layer: ITrackItem & IVideo, options: Partia
|
|
14
14
|
details: IVideoDetails;
|
15
15
|
playbackRate: number;
|
16
16
|
display: IDisplay;
|
17
|
+
duration: number;
|
17
18
|
id: string;
|
18
19
|
preview?: string;
|
19
20
|
position?: import('@designcombo/types').IPosition | null;
|
@@ -30,12 +31,12 @@ export declare const loadAudioItem: (payload: ITrackItem & IAudio) => Promise<{
|
|
30
31
|
playbackRate: number;
|
31
32
|
details: {
|
32
33
|
src: string;
|
33
|
-
duration: number;
|
34
34
|
volume: number;
|
35
35
|
};
|
36
36
|
metadata: {
|
37
37
|
[x: string]: any;
|
38
38
|
};
|
39
|
+
duration: number;
|
39
40
|
}>;
|
40
41
|
export declare const loadImageItem: (payload: ITrackItem & IImage, options: {
|
41
42
|
origin?: number;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@designcombo/state",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.27",
|
4
4
|
"private": false,
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -24,8 +24,8 @@
|
|
24
24
|
"typescript": "^5.3.3",
|
25
25
|
"vite": "^5.2.0",
|
26
26
|
"vite-plugin-dts": "^3.9.1",
|
27
|
-
"@designcombo/events": "0.1.
|
28
|
-
"@designcombo/types": "0.1.
|
27
|
+
"@designcombo/events": "0.1.27",
|
28
|
+
"@designcombo/types": "0.1.27",
|
29
29
|
"@designcombo/typescript-config": "0.0.0"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
@@ -38,8 +38,8 @@
|
|
38
38
|
"nanoid": "^5.0.7"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
|
-
"@designcombo/events": "0.1.
|
42
|
-
"@designcombo/types": "0.1.
|
41
|
+
"@designcombo/events": "0.1.27",
|
42
|
+
"@designcombo/types": "0.1.27"
|
43
43
|
},
|
44
44
|
"scripts": {
|
45
45
|
"dev": "vite",
|