@spear-ai/spectral 1.4.22 → 1.4.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tabs/TabsBase.d.ts +11 -2
- package/dist/Tabs/TabsBase.js +154 -103
- package/dist/Tabs.d.ts +12 -10
- package/dist/Tabs.js +46 -52
- package/dist/Tray.js +63 -4912
- package/dist/index-BvRlXSJj.js +4859 -0
- package/dist/styles/main.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,4859 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import { jsx as ht, Fragment as Er, jsxs as Rr } from "react/jsx-runtime";
|
|
3
|
+
import * as ne from "react";
|
|
4
|
+
import { createContext as Pt, useRef as _, useLayoutEffect as Lr, useEffect as Q, useId as He, useContext as B, useInsertionEffect as _i, useMemo as tt, useCallback as Gi, Children as kr, isValidElement as Fr, useState as Pe, Fragment as Xi, createElement as Br, forwardRef as Ir, Component as Or } from "react";
|
|
5
|
+
const _e = Pt({});
|
|
6
|
+
function Ge(t) {
|
|
7
|
+
const e = _(null);
|
|
8
|
+
return e.current === null && (e.current = t()), e.current;
|
|
9
|
+
}
|
|
10
|
+
const Xe = typeof window < "u", Yi = Xe ? Lr : Q, ie = /* @__PURE__ */ Pt(null);
|
|
11
|
+
function Ye(t, e) {
|
|
12
|
+
t.indexOf(e) === -1 && t.push(e);
|
|
13
|
+
}
|
|
14
|
+
function qe(t, e) {
|
|
15
|
+
const n = t.indexOf(e);
|
|
16
|
+
n > -1 && t.splice(n, 1);
|
|
17
|
+
}
|
|
18
|
+
const X = (t, e, n) => n > e ? e : n < t ? t : n;
|
|
19
|
+
function be(t, e) {
|
|
20
|
+
return e ? `${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}` : t;
|
|
21
|
+
}
|
|
22
|
+
let bt = () => {
|
|
23
|
+
}, Y = () => {
|
|
24
|
+
};
|
|
25
|
+
process.env.NODE_ENV !== "production" && (bt = (t, e, n) => {
|
|
26
|
+
!t && typeof console < "u" && console.warn(be(e, n));
|
|
27
|
+
}, Y = (t, e, n) => {
|
|
28
|
+
if (!t)
|
|
29
|
+
throw new Error(be(e, n));
|
|
30
|
+
});
|
|
31
|
+
const q = {}, qi = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);
|
|
32
|
+
function Zi(t) {
|
|
33
|
+
return typeof t == "object" && t !== null;
|
|
34
|
+
}
|
|
35
|
+
const Ji = (t) => /^0[^.\s]+$/u.test(t);
|
|
36
|
+
// @__NO_SIDE_EFFECTS__
|
|
37
|
+
function Ze(t) {
|
|
38
|
+
let e;
|
|
39
|
+
return () => (e === void 0 && (e = t()), e);
|
|
40
|
+
}
|
|
41
|
+
const $ = /* @__NO_SIDE_EFFECTS__ */ (t) => t, jr = (t, e) => (n) => e(t(n)), jt = (...t) => t.reduce(jr), Lt = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
|
|
42
|
+
const i = e - t;
|
|
43
|
+
return i === 0 ? 1 : (n - t) / i;
|
|
44
|
+
};
|
|
45
|
+
class Je {
|
|
46
|
+
constructor() {
|
|
47
|
+
this.subscriptions = [];
|
|
48
|
+
}
|
|
49
|
+
add(e) {
|
|
50
|
+
return Ye(this.subscriptions, e), () => qe(this.subscriptions, e);
|
|
51
|
+
}
|
|
52
|
+
notify(e, n, i) {
|
|
53
|
+
const s = this.subscriptions.length;
|
|
54
|
+
if (s)
|
|
55
|
+
if (s === 1)
|
|
56
|
+
this.subscriptions[0](e, n, i);
|
|
57
|
+
else
|
|
58
|
+
for (let o = 0; o < s; o++) {
|
|
59
|
+
const r = this.subscriptions[o];
|
|
60
|
+
r && r(e, n, i);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
getSize() {
|
|
64
|
+
return this.subscriptions.length;
|
|
65
|
+
}
|
|
66
|
+
clear() {
|
|
67
|
+
this.subscriptions.length = 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const H = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, W = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
|
|
71
|
+
function Qi(t, e) {
|
|
72
|
+
return e ? t * (1e3 / e) : 0;
|
|
73
|
+
}
|
|
74
|
+
const En = /* @__PURE__ */ new Set();
|
|
75
|
+
function Qe(t, e, n) {
|
|
76
|
+
t || En.has(e) || (console.warn(be(e, n)), En.add(e));
|
|
77
|
+
}
|
|
78
|
+
const ts = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Nr = 1e-7, Ur = 12;
|
|
79
|
+
function Wr(t, e, n, i, s) {
|
|
80
|
+
let o, r, a = 0;
|
|
81
|
+
do
|
|
82
|
+
r = e + (n - e) / 2, o = ts(r, i, s) - t, o > 0 ? n = r : e = r;
|
|
83
|
+
while (Math.abs(o) > Nr && ++a < Ur);
|
|
84
|
+
return r;
|
|
85
|
+
}
|
|
86
|
+
function Nt(t, e, n, i) {
|
|
87
|
+
if (t === e && n === i)
|
|
88
|
+
return $;
|
|
89
|
+
const s = (o) => Wr(o, 0, 1, t, n);
|
|
90
|
+
return (o) => o === 0 || o === 1 ? o : ts(s(o), e, i);
|
|
91
|
+
}
|
|
92
|
+
const es = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, ns = (t) => (e) => 1 - t(1 - e), is = /* @__PURE__ */ Nt(0.33, 1.53, 0.69, 0.99), tn = /* @__PURE__ */ ns(is), ss = /* @__PURE__ */ es(tn), rs = (t) => (t *= 2) < 1 ? 0.5 * tn(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), en = (t) => 1 - Math.sin(Math.acos(t)), os = ns(en), as = es(en), $r = /* @__PURE__ */ Nt(0.42, 0, 1, 1), Kr = /* @__PURE__ */ Nt(0, 0, 0.58, 1), ls = /* @__PURE__ */ Nt(0.42, 0, 0.58, 1), zr = (t) => Array.isArray(t) && typeof t[0] != "number", cs = (t) => Array.isArray(t) && typeof t[0] == "number", Rn = {
|
|
93
|
+
linear: $,
|
|
94
|
+
easeIn: $r,
|
|
95
|
+
easeInOut: ls,
|
|
96
|
+
easeOut: Kr,
|
|
97
|
+
circIn: en,
|
|
98
|
+
circInOut: as,
|
|
99
|
+
circOut: os,
|
|
100
|
+
backIn: tn,
|
|
101
|
+
backInOut: ss,
|
|
102
|
+
backOut: is,
|
|
103
|
+
anticipate: rs
|
|
104
|
+
}, Hr = (t) => typeof t == "string", Ln = (t) => {
|
|
105
|
+
if (cs(t)) {
|
|
106
|
+
Y(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
|
|
107
|
+
const [e, n, i, s] = t;
|
|
108
|
+
return Nt(e, n, i, s);
|
|
109
|
+
} else if (Hr(t))
|
|
110
|
+
return Y(Rn[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), Rn[t];
|
|
111
|
+
return t;
|
|
112
|
+
}, $t = [
|
|
113
|
+
"setup",
|
|
114
|
+
// Compute
|
|
115
|
+
"read",
|
|
116
|
+
// Read
|
|
117
|
+
"resolveKeyframes",
|
|
118
|
+
// Write/Read/Write/Read
|
|
119
|
+
"preUpdate",
|
|
120
|
+
// Compute
|
|
121
|
+
"update",
|
|
122
|
+
// Compute
|
|
123
|
+
"preRender",
|
|
124
|
+
// Compute
|
|
125
|
+
"render",
|
|
126
|
+
// Write
|
|
127
|
+
"postRender"
|
|
128
|
+
// Compute
|
|
129
|
+
];
|
|
130
|
+
function _r(t, e) {
|
|
131
|
+
let n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = !1, o = !1;
|
|
132
|
+
const r = /* @__PURE__ */ new WeakSet();
|
|
133
|
+
let a = {
|
|
134
|
+
delta: 0,
|
|
135
|
+
timestamp: 0,
|
|
136
|
+
isProcessing: !1
|
|
137
|
+
};
|
|
138
|
+
function l(c) {
|
|
139
|
+
r.has(c) && (u.schedule(c), t()), c(a);
|
|
140
|
+
}
|
|
141
|
+
const u = {
|
|
142
|
+
/**
|
|
143
|
+
* Schedule a process to run on the next frame.
|
|
144
|
+
*/
|
|
145
|
+
schedule: (c, h = !1, f = !1) => {
|
|
146
|
+
const m = f && s ? n : i;
|
|
147
|
+
return h && r.add(c), m.has(c) || m.add(c), c;
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* Cancel the provided callback from running on the next frame.
|
|
151
|
+
*/
|
|
152
|
+
cancel: (c) => {
|
|
153
|
+
i.delete(c), r.delete(c);
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* Execute all schedule callbacks.
|
|
157
|
+
*/
|
|
158
|
+
process: (c) => {
|
|
159
|
+
if (a = c, s) {
|
|
160
|
+
o = !0;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
s = !0, [n, i] = [i, n], n.forEach(l), n.clear(), s = !1, o && (o = !1, u.process(c));
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return u;
|
|
167
|
+
}
|
|
168
|
+
const Gr = 40;
|
|
169
|
+
function us(t, e) {
|
|
170
|
+
let n = !1, i = !0;
|
|
171
|
+
const s = {
|
|
172
|
+
delta: 0,
|
|
173
|
+
timestamp: 0,
|
|
174
|
+
isProcessing: !1
|
|
175
|
+
}, o = () => n = !0, r = $t.reduce((y, b) => (y[b] = _r(o), y), {}), { setup: a, read: l, resolveKeyframes: u, preUpdate: c, update: h, preRender: f, render: d, postRender: m } = r, g = () => {
|
|
176
|
+
const y = q.useManualTiming ? s.timestamp : performance.now();
|
|
177
|
+
n = !1, q.useManualTiming || (s.delta = i ? 1e3 / 60 : Math.max(Math.min(y - s.timestamp, Gr), 1)), s.timestamp = y, s.isProcessing = !0, a.process(s), l.process(s), u.process(s), c.process(s), h.process(s), f.process(s), d.process(s), m.process(s), s.isProcessing = !1, n && e && (i = !1, t(g));
|
|
178
|
+
}, T = () => {
|
|
179
|
+
n = !0, i = !0, s.isProcessing || t(g);
|
|
180
|
+
};
|
|
181
|
+
return { schedule: $t.reduce((y, b) => {
|
|
182
|
+
const x = r[b];
|
|
183
|
+
return y[b] = (S, A = !1, P = !1) => (n || T(), x.schedule(S, A, P)), y;
|
|
184
|
+
}, {}), cancel: (y) => {
|
|
185
|
+
for (let b = 0; b < $t.length; b++)
|
|
186
|
+
r[$t[b]].cancel(y);
|
|
187
|
+
}, state: s, steps: r };
|
|
188
|
+
}
|
|
189
|
+
const { schedule: V, cancel: et, state: F, steps: ae } = /* @__PURE__ */ us(typeof requestAnimationFrame < "u" ? requestAnimationFrame : $, !0);
|
|
190
|
+
let _t;
|
|
191
|
+
function Xr() {
|
|
192
|
+
_t = void 0;
|
|
193
|
+
}
|
|
194
|
+
const j = {
|
|
195
|
+
now: () => (_t === void 0 && j.set(F.isProcessing || q.useManualTiming ? F.timestamp : performance.now()), _t),
|
|
196
|
+
set: (t) => {
|
|
197
|
+
_t = t, queueMicrotask(Xr);
|
|
198
|
+
}
|
|
199
|
+
}, hs = (t) => (e) => typeof e == "string" && e.startsWith(t), nn = /* @__PURE__ */ hs("--"), Yr = /* @__PURE__ */ hs("var(--"), sn = (t) => Yr(t) ? qr.test(t.split("/*")[0].trim()) : !1, qr = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, St = {
|
|
200
|
+
test: (t) => typeof t == "number",
|
|
201
|
+
parse: parseFloat,
|
|
202
|
+
transform: (t) => t
|
|
203
|
+
}, kt = {
|
|
204
|
+
...St,
|
|
205
|
+
transform: (t) => X(0, 1, t)
|
|
206
|
+
}, Kt = {
|
|
207
|
+
...St,
|
|
208
|
+
default: 1
|
|
209
|
+
}, Mt = (t) => Math.round(t * 1e5) / 1e5, rn = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
|
|
210
|
+
function Zr(t) {
|
|
211
|
+
return t == null;
|
|
212
|
+
}
|
|
213
|
+
const Jr = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, on = (t, e) => (n) => !!(typeof n == "string" && Jr.test(n) && n.startsWith(t) || e && !Zr(n) && Object.prototype.hasOwnProperty.call(n, e)), fs = (t, e, n) => (i) => {
|
|
214
|
+
if (typeof i != "string")
|
|
215
|
+
return i;
|
|
216
|
+
const [s, o, r, a] = i.match(rn);
|
|
217
|
+
return {
|
|
218
|
+
[t]: parseFloat(s),
|
|
219
|
+
[e]: parseFloat(o),
|
|
220
|
+
[n]: parseFloat(r),
|
|
221
|
+
alpha: a !== void 0 ? parseFloat(a) : 1
|
|
222
|
+
};
|
|
223
|
+
}, Qr = (t) => X(0, 255, t), le = {
|
|
224
|
+
...St,
|
|
225
|
+
transform: (t) => Math.round(Qr(t))
|
|
226
|
+
}, at = {
|
|
227
|
+
test: /* @__PURE__ */ on("rgb", "red"),
|
|
228
|
+
parse: /* @__PURE__ */ fs("red", "green", "blue"),
|
|
229
|
+
transform: ({ red: t, green: e, blue: n, alpha: i = 1 }) => "rgba(" + le.transform(t) + ", " + le.transform(e) + ", " + le.transform(n) + ", " + Mt(kt.transform(i)) + ")"
|
|
230
|
+
};
|
|
231
|
+
function to(t) {
|
|
232
|
+
let e = "", n = "", i = "", s = "";
|
|
233
|
+
return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), i = t.substring(5, 7), s = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), i = t.substring(3, 4), s = t.substring(4, 5), e += e, n += n, i += i, s += s), {
|
|
234
|
+
red: parseInt(e, 16),
|
|
235
|
+
green: parseInt(n, 16),
|
|
236
|
+
blue: parseInt(i, 16),
|
|
237
|
+
alpha: s ? parseInt(s, 16) / 255 : 1
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const Se = {
|
|
241
|
+
test: /* @__PURE__ */ on("#"),
|
|
242
|
+
parse: to,
|
|
243
|
+
transform: at.transform
|
|
244
|
+
}, Ut = /* @__NO_SIDE_EFFECTS__ */ (t) => ({
|
|
245
|
+
test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
|
|
246
|
+
parse: parseFloat,
|
|
247
|
+
transform: (e) => `${e}${t}`
|
|
248
|
+
}), J = /* @__PURE__ */ Ut("deg"), G = /* @__PURE__ */ Ut("%"), w = /* @__PURE__ */ Ut("px"), eo = /* @__PURE__ */ Ut("vh"), no = /* @__PURE__ */ Ut("vw"), kn = {
|
|
249
|
+
...G,
|
|
250
|
+
parse: (t) => G.parse(t) / 100,
|
|
251
|
+
transform: (t) => G.transform(t * 100)
|
|
252
|
+
}, dt = {
|
|
253
|
+
test: /* @__PURE__ */ on("hsl", "hue"),
|
|
254
|
+
parse: /* @__PURE__ */ fs("hue", "saturation", "lightness"),
|
|
255
|
+
transform: ({ hue: t, saturation: e, lightness: n, alpha: i = 1 }) => "hsla(" + Math.round(t) + ", " + G.transform(Mt(e)) + ", " + G.transform(Mt(n)) + ", " + Mt(kt.transform(i)) + ")"
|
|
256
|
+
}, R = {
|
|
257
|
+
test: (t) => at.test(t) || Se.test(t) || dt.test(t),
|
|
258
|
+
parse: (t) => at.test(t) ? at.parse(t) : dt.test(t) ? dt.parse(t) : Se.parse(t),
|
|
259
|
+
transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? at.transform(t) : dt.transform(t),
|
|
260
|
+
getAnimatableNone: (t) => {
|
|
261
|
+
const e = R.parse(t);
|
|
262
|
+
return e.alpha = 0, R.transform(e);
|
|
263
|
+
}
|
|
264
|
+
}, io = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
|
|
265
|
+
function so(t) {
|
|
266
|
+
return isNaN(t) && typeof t == "string" && (t.match(rn)?.length || 0) + (t.match(io)?.length || 0) > 0;
|
|
267
|
+
}
|
|
268
|
+
const ds = "number", ms = "color", ro = "var", oo = "var(", Fn = "${}", ao = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
|
|
269
|
+
function Ft(t) {
|
|
270
|
+
const e = t.toString(), n = [], i = {
|
|
271
|
+
color: [],
|
|
272
|
+
number: [],
|
|
273
|
+
var: []
|
|
274
|
+
}, s = [];
|
|
275
|
+
let o = 0;
|
|
276
|
+
const a = e.replace(ao, (l) => (R.test(l) ? (i.color.push(o), s.push(ms), n.push(R.parse(l))) : l.startsWith(oo) ? (i.var.push(o), s.push(ro), n.push(l)) : (i.number.push(o), s.push(ds), n.push(parseFloat(l))), ++o, Fn)).split(Fn);
|
|
277
|
+
return { values: n, split: a, indexes: i, types: s };
|
|
278
|
+
}
|
|
279
|
+
function ps(t) {
|
|
280
|
+
return Ft(t).values;
|
|
281
|
+
}
|
|
282
|
+
function gs(t) {
|
|
283
|
+
const { split: e, types: n } = Ft(t), i = e.length;
|
|
284
|
+
return (s) => {
|
|
285
|
+
let o = "";
|
|
286
|
+
for (let r = 0; r < i; r++)
|
|
287
|
+
if (o += e[r], s[r] !== void 0) {
|
|
288
|
+
const a = n[r];
|
|
289
|
+
a === ds ? o += Mt(s[r]) : a === ms ? o += R.transform(s[r]) : o += s[r];
|
|
290
|
+
}
|
|
291
|
+
return o;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
const lo = (t) => typeof t == "number" ? 0 : R.test(t) ? R.getAnimatableNone(t) : t;
|
|
295
|
+
function co(t) {
|
|
296
|
+
const e = ps(t);
|
|
297
|
+
return gs(t)(e.map(lo));
|
|
298
|
+
}
|
|
299
|
+
const nt = {
|
|
300
|
+
test: so,
|
|
301
|
+
parse: ps,
|
|
302
|
+
createTransformer: gs,
|
|
303
|
+
getAnimatableNone: co
|
|
304
|
+
};
|
|
305
|
+
function ce(t, e, n) {
|
|
306
|
+
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
|
|
307
|
+
}
|
|
308
|
+
function uo({ hue: t, saturation: e, lightness: n, alpha: i }) {
|
|
309
|
+
t /= 360, e /= 100, n /= 100;
|
|
310
|
+
let s = 0, o = 0, r = 0;
|
|
311
|
+
if (!e)
|
|
312
|
+
s = o = r = n;
|
|
313
|
+
else {
|
|
314
|
+
const a = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - a;
|
|
315
|
+
s = ce(l, a, t + 1 / 3), o = ce(l, a, t), r = ce(l, a, t - 1 / 3);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
red: Math.round(s * 255),
|
|
319
|
+
green: Math.round(o * 255),
|
|
320
|
+
blue: Math.round(r * 255),
|
|
321
|
+
alpha: i
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function qt(t, e) {
|
|
325
|
+
return (n) => n > 0 ? e : t;
|
|
326
|
+
}
|
|
327
|
+
const D = (t, e, n) => t + (e - t) * n, ue = (t, e, n) => {
|
|
328
|
+
const i = t * t, s = n * (e * e - i) + i;
|
|
329
|
+
return s < 0 ? 0 : Math.sqrt(s);
|
|
330
|
+
}, ho = [Se, at, dt], fo = (t) => ho.find((e) => e.test(t));
|
|
331
|
+
function Bn(t) {
|
|
332
|
+
const e = fo(t);
|
|
333
|
+
if (bt(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
|
|
334
|
+
return !1;
|
|
335
|
+
let n = e.parse(t);
|
|
336
|
+
return e === dt && (n = uo(n)), n;
|
|
337
|
+
}
|
|
338
|
+
const In = (t, e) => {
|
|
339
|
+
const n = Bn(t), i = Bn(e);
|
|
340
|
+
if (!n || !i)
|
|
341
|
+
return qt(t, e);
|
|
342
|
+
const s = { ...n };
|
|
343
|
+
return (o) => (s.red = ue(n.red, i.red, o), s.green = ue(n.green, i.green, o), s.blue = ue(n.blue, i.blue, o), s.alpha = D(n.alpha, i.alpha, o), at.transform(s));
|
|
344
|
+
}, Ae = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
345
|
+
function mo(t, e) {
|
|
346
|
+
return Ae.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
|
|
347
|
+
}
|
|
348
|
+
function po(t, e) {
|
|
349
|
+
return (n) => D(t, e, n);
|
|
350
|
+
}
|
|
351
|
+
function an(t) {
|
|
352
|
+
return typeof t == "number" ? po : typeof t == "string" ? sn(t) ? qt : R.test(t) ? In : vo : Array.isArray(t) ? ys : typeof t == "object" ? R.test(t) ? In : go : qt;
|
|
353
|
+
}
|
|
354
|
+
function ys(t, e) {
|
|
355
|
+
const n = [...t], i = n.length, s = t.map((o, r) => an(o)(o, e[r]));
|
|
356
|
+
return (o) => {
|
|
357
|
+
for (let r = 0; r < i; r++)
|
|
358
|
+
n[r] = s[r](o);
|
|
359
|
+
return n;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function go(t, e) {
|
|
363
|
+
const n = { ...t, ...e }, i = {};
|
|
364
|
+
for (const s in n)
|
|
365
|
+
t[s] !== void 0 && e[s] !== void 0 && (i[s] = an(t[s])(t[s], e[s]));
|
|
366
|
+
return (s) => {
|
|
367
|
+
for (const o in i)
|
|
368
|
+
n[o] = i[o](s);
|
|
369
|
+
return n;
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function yo(t, e) {
|
|
373
|
+
const n = [], i = { color: 0, var: 0, number: 0 };
|
|
374
|
+
for (let s = 0; s < e.values.length; s++) {
|
|
375
|
+
const o = e.types[s], r = t.indexes[o][i[o]], a = t.values[r] ?? 0;
|
|
376
|
+
n[s] = a, i[o]++;
|
|
377
|
+
}
|
|
378
|
+
return n;
|
|
379
|
+
}
|
|
380
|
+
const vo = (t, e) => {
|
|
381
|
+
const n = nt.createTransformer(e), i = Ft(t), s = Ft(e);
|
|
382
|
+
return i.indexes.var.length === s.indexes.var.length && i.indexes.color.length === s.indexes.color.length && i.indexes.number.length >= s.indexes.number.length ? Ae.has(t) && !s.values.length || Ae.has(e) && !i.values.length ? mo(t, e) : jt(ys(yo(i, s), s.values), n) : (bt(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), qt(t, e));
|
|
383
|
+
};
|
|
384
|
+
function vs(t, e, n) {
|
|
385
|
+
return typeof t == "number" && typeof e == "number" && typeof n == "number" ? D(t, e, n) : an(t)(t, e);
|
|
386
|
+
}
|
|
387
|
+
const To = (t) => {
|
|
388
|
+
const e = ({ timestamp: n }) => t(n);
|
|
389
|
+
return {
|
|
390
|
+
start: (n = !0) => V.update(e, n),
|
|
391
|
+
stop: () => et(e),
|
|
392
|
+
/**
|
|
393
|
+
* If we're processing this frame we can use the
|
|
394
|
+
* framelocked timestamp to keep things in sync.
|
|
395
|
+
*/
|
|
396
|
+
now: () => F.isProcessing ? F.timestamp : j.now()
|
|
397
|
+
};
|
|
398
|
+
}, Ts = (t, e, n = 10) => {
|
|
399
|
+
let i = "";
|
|
400
|
+
const s = Math.max(Math.round(e / n), 2);
|
|
401
|
+
for (let o = 0; o < s; o++)
|
|
402
|
+
i += Math.round(t(o / (s - 1)) * 1e4) / 1e4 + ", ";
|
|
403
|
+
return `linear(${i.substring(0, i.length - 2)})`;
|
|
404
|
+
}, Zt = 2e4;
|
|
405
|
+
function ln(t) {
|
|
406
|
+
let e = 0;
|
|
407
|
+
const n = 50;
|
|
408
|
+
let i = t.next(e);
|
|
409
|
+
for (; !i.done && e < Zt; )
|
|
410
|
+
e += n, i = t.next(e);
|
|
411
|
+
return e >= Zt ? 1 / 0 : e;
|
|
412
|
+
}
|
|
413
|
+
function xo(t, e = 100, n) {
|
|
414
|
+
const i = n({ ...t, keyframes: [0, e] }), s = Math.min(ln(i), Zt);
|
|
415
|
+
return {
|
|
416
|
+
type: "keyframes",
|
|
417
|
+
ease: (o) => i.next(s * o).value / e,
|
|
418
|
+
duration: /* @__PURE__ */ W(s)
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
const wo = 5;
|
|
422
|
+
function xs(t, e, n) {
|
|
423
|
+
const i = Math.max(e - wo, 0);
|
|
424
|
+
return Qi(n - t(i), e - i);
|
|
425
|
+
}
|
|
426
|
+
const C = {
|
|
427
|
+
// Default spring physics
|
|
428
|
+
stiffness: 100,
|
|
429
|
+
damping: 10,
|
|
430
|
+
mass: 1,
|
|
431
|
+
velocity: 0,
|
|
432
|
+
// Default duration/bounce-based options
|
|
433
|
+
duration: 800,
|
|
434
|
+
// in ms
|
|
435
|
+
bounce: 0.3,
|
|
436
|
+
visualDuration: 0.3,
|
|
437
|
+
// in seconds
|
|
438
|
+
// Rest thresholds
|
|
439
|
+
restSpeed: {
|
|
440
|
+
granular: 0.01,
|
|
441
|
+
default: 2
|
|
442
|
+
},
|
|
443
|
+
restDelta: {
|
|
444
|
+
granular: 5e-3,
|
|
445
|
+
default: 0.5
|
|
446
|
+
},
|
|
447
|
+
// Limits
|
|
448
|
+
minDuration: 0.01,
|
|
449
|
+
// in seconds
|
|
450
|
+
maxDuration: 10,
|
|
451
|
+
// in seconds
|
|
452
|
+
minDamping: 0.05,
|
|
453
|
+
maxDamping: 1
|
|
454
|
+
}, he = 1e-3;
|
|
455
|
+
function Po({ duration: t = C.duration, bounce: e = C.bounce, velocity: n = C.velocity, mass: i = C.mass }) {
|
|
456
|
+
let s, o;
|
|
457
|
+
bt(t <= /* @__PURE__ */ H(C.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
458
|
+
let r = 1 - e;
|
|
459
|
+
r = X(C.minDamping, C.maxDamping, r), t = X(C.minDuration, C.maxDuration, /* @__PURE__ */ W(t)), r < 1 ? (s = (u) => {
|
|
460
|
+
const c = u * r, h = c * t, f = c - n, d = Ve(u, r), m = Math.exp(-h);
|
|
461
|
+
return he - f / d * m;
|
|
462
|
+
}, o = (u) => {
|
|
463
|
+
const h = u * r * t, f = h * n + n, d = Math.pow(r, 2) * Math.pow(u, 2) * t, m = Math.exp(-h), g = Ve(Math.pow(u, 2), r);
|
|
464
|
+
return (-s(u) + he > 0 ? -1 : 1) * ((f - d) * m) / g;
|
|
465
|
+
}) : (s = (u) => {
|
|
466
|
+
const c = Math.exp(-u * t), h = (u - n) * t + 1;
|
|
467
|
+
return -he + c * h;
|
|
468
|
+
}, o = (u) => {
|
|
469
|
+
const c = Math.exp(-u * t), h = (n - u) * (t * t);
|
|
470
|
+
return c * h;
|
|
471
|
+
});
|
|
472
|
+
const a = 5 / t, l = So(s, o, a);
|
|
473
|
+
if (t = /* @__PURE__ */ H(t), isNaN(l))
|
|
474
|
+
return {
|
|
475
|
+
stiffness: C.stiffness,
|
|
476
|
+
damping: C.damping,
|
|
477
|
+
duration: t
|
|
478
|
+
};
|
|
479
|
+
{
|
|
480
|
+
const u = Math.pow(l, 2) * i;
|
|
481
|
+
return {
|
|
482
|
+
stiffness: u,
|
|
483
|
+
damping: r * 2 * Math.sqrt(i * u),
|
|
484
|
+
duration: t
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
const bo = 12;
|
|
489
|
+
function So(t, e, n) {
|
|
490
|
+
let i = n;
|
|
491
|
+
for (let s = 1; s < bo; s++)
|
|
492
|
+
i = i - t(i) / e(i);
|
|
493
|
+
return i;
|
|
494
|
+
}
|
|
495
|
+
function Ve(t, e) {
|
|
496
|
+
return t * Math.sqrt(1 - e * e);
|
|
497
|
+
}
|
|
498
|
+
const Ao = ["duration", "bounce"], Vo = ["stiffness", "damping", "mass"];
|
|
499
|
+
function On(t, e) {
|
|
500
|
+
return e.some((n) => t[n] !== void 0);
|
|
501
|
+
}
|
|
502
|
+
function Co(t) {
|
|
503
|
+
let e = {
|
|
504
|
+
velocity: C.velocity,
|
|
505
|
+
stiffness: C.stiffness,
|
|
506
|
+
damping: C.damping,
|
|
507
|
+
mass: C.mass,
|
|
508
|
+
isResolvedFromDuration: !1,
|
|
509
|
+
...t
|
|
510
|
+
};
|
|
511
|
+
if (!On(t, Vo) && On(t, Ao))
|
|
512
|
+
if (t.visualDuration) {
|
|
513
|
+
const n = t.visualDuration, i = 2 * Math.PI / (n * 1.2), s = i * i, o = 2 * X(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(s);
|
|
514
|
+
e = {
|
|
515
|
+
...e,
|
|
516
|
+
mass: C.mass,
|
|
517
|
+
stiffness: s,
|
|
518
|
+
damping: o
|
|
519
|
+
};
|
|
520
|
+
} else {
|
|
521
|
+
const n = Po(t);
|
|
522
|
+
e = {
|
|
523
|
+
...e,
|
|
524
|
+
...n,
|
|
525
|
+
mass: C.mass
|
|
526
|
+
}, e.isResolvedFromDuration = !0;
|
|
527
|
+
}
|
|
528
|
+
return e;
|
|
529
|
+
}
|
|
530
|
+
function Jt(t = C.visualDuration, e = C.bounce) {
|
|
531
|
+
const n = typeof t != "object" ? {
|
|
532
|
+
visualDuration: t,
|
|
533
|
+
keyframes: [0, 1],
|
|
534
|
+
bounce: e
|
|
535
|
+
} : t;
|
|
536
|
+
let { restSpeed: i, restDelta: s } = n;
|
|
537
|
+
const o = n.keyframes[0], r = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: o }, { stiffness: l, damping: u, mass: c, duration: h, velocity: f, isResolvedFromDuration: d } = Co({
|
|
538
|
+
...n,
|
|
539
|
+
velocity: -/* @__PURE__ */ W(n.velocity || 0)
|
|
540
|
+
}), m = f || 0, g = u / (2 * Math.sqrt(l * c)), T = r - o, p = /* @__PURE__ */ W(Math.sqrt(l / c)), v = Math.abs(T) < 5;
|
|
541
|
+
i || (i = v ? C.restSpeed.granular : C.restSpeed.default), s || (s = v ? C.restDelta.granular : C.restDelta.default);
|
|
542
|
+
let y;
|
|
543
|
+
if (g < 1) {
|
|
544
|
+
const x = Ve(p, g);
|
|
545
|
+
y = (S) => {
|
|
546
|
+
const A = Math.exp(-g * p * S);
|
|
547
|
+
return r - A * ((m + g * p * T) / x * Math.sin(x * S) + T * Math.cos(x * S));
|
|
548
|
+
};
|
|
549
|
+
} else if (g === 1)
|
|
550
|
+
y = (x) => r - Math.exp(-p * x) * (T + (m + p * T) * x);
|
|
551
|
+
else {
|
|
552
|
+
const x = p * Math.sqrt(g * g - 1);
|
|
553
|
+
y = (S) => {
|
|
554
|
+
const A = Math.exp(-g * p * S), P = Math.min(x * S, 300);
|
|
555
|
+
return r - A * ((m + g * p * T) * Math.sinh(P) + x * T * Math.cosh(P)) / x;
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
const b = {
|
|
559
|
+
calculatedDuration: d && h || null,
|
|
560
|
+
next: (x) => {
|
|
561
|
+
const S = y(x);
|
|
562
|
+
if (d)
|
|
563
|
+
a.done = x >= h;
|
|
564
|
+
else {
|
|
565
|
+
let A = x === 0 ? m : 0;
|
|
566
|
+
g < 1 && (A = x === 0 ? /* @__PURE__ */ H(m) : xs(y, x, S));
|
|
567
|
+
const P = Math.abs(A) <= i, E = Math.abs(r - S) <= s;
|
|
568
|
+
a.done = P && E;
|
|
569
|
+
}
|
|
570
|
+
return a.value = a.done ? r : S, a;
|
|
571
|
+
},
|
|
572
|
+
toString: () => {
|
|
573
|
+
const x = Math.min(ln(b), Zt), S = Ts((A) => b.next(x * A).value, x, 30);
|
|
574
|
+
return x + "ms " + S;
|
|
575
|
+
},
|
|
576
|
+
toTransition: () => {
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
return b;
|
|
580
|
+
}
|
|
581
|
+
Jt.applyToOptions = (t) => {
|
|
582
|
+
const e = xo(t, 100, Jt);
|
|
583
|
+
return t.ease = e.ease, t.duration = /* @__PURE__ */ H(e.duration), t.type = "keyframes", t;
|
|
584
|
+
};
|
|
585
|
+
function Ce({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: i = 325, bounceDamping: s = 10, bounceStiffness: o = 500, modifyTarget: r, min: a, max: l, restDelta: u = 0.5, restSpeed: c }) {
|
|
586
|
+
const h = t[0], f = {
|
|
587
|
+
done: !1,
|
|
588
|
+
value: h
|
|
589
|
+
}, d = (P) => a !== void 0 && P < a || l !== void 0 && P > l, m = (P) => a === void 0 ? l : l === void 0 || Math.abs(a - P) < Math.abs(l - P) ? a : l;
|
|
590
|
+
let g = n * e;
|
|
591
|
+
const T = h + g, p = r === void 0 ? T : r(T);
|
|
592
|
+
p !== T && (g = p - h);
|
|
593
|
+
const v = (P) => -g * Math.exp(-P / i), y = (P) => p + v(P), b = (P) => {
|
|
594
|
+
const E = v(P), M = y(P);
|
|
595
|
+
f.done = Math.abs(E) <= u, f.value = f.done ? p : M;
|
|
596
|
+
};
|
|
597
|
+
let x, S;
|
|
598
|
+
const A = (P) => {
|
|
599
|
+
d(f.value) && (x = P, S = Jt({
|
|
600
|
+
keyframes: [f.value, m(f.value)],
|
|
601
|
+
velocity: xs(y, P, f.value),
|
|
602
|
+
// TODO: This should be passing * 1000
|
|
603
|
+
damping: s,
|
|
604
|
+
stiffness: o,
|
|
605
|
+
restDelta: u,
|
|
606
|
+
restSpeed: c
|
|
607
|
+
}));
|
|
608
|
+
};
|
|
609
|
+
return A(0), {
|
|
610
|
+
calculatedDuration: null,
|
|
611
|
+
next: (P) => {
|
|
612
|
+
let E = !1;
|
|
613
|
+
return !S && x === void 0 && (E = !0, b(P), A(P)), x !== void 0 && P >= x ? S.next(P - x) : (!E && b(P), f);
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function Do(t, e, n) {
|
|
618
|
+
const i = [], s = n || q.mix || vs, o = t.length - 1;
|
|
619
|
+
for (let r = 0; r < o; r++) {
|
|
620
|
+
let a = s(t[r], t[r + 1]);
|
|
621
|
+
if (e) {
|
|
622
|
+
const l = Array.isArray(e) ? e[r] || $ : e;
|
|
623
|
+
a = jt(l, a);
|
|
624
|
+
}
|
|
625
|
+
i.push(a);
|
|
626
|
+
}
|
|
627
|
+
return i;
|
|
628
|
+
}
|
|
629
|
+
function Mo(t, e, { clamp: n = !0, ease: i, mixer: s } = {}) {
|
|
630
|
+
const o = t.length;
|
|
631
|
+
if (Y(o === e.length, "Both input and output ranges must be the same length", "range-length"), o === 1)
|
|
632
|
+
return () => e[0];
|
|
633
|
+
if (o === 2 && e[0] === e[1])
|
|
634
|
+
return () => e[1];
|
|
635
|
+
const r = t[0] === t[1];
|
|
636
|
+
t[0] > t[o - 1] && (t = [...t].reverse(), e = [...e].reverse());
|
|
637
|
+
const a = Do(e, i, s), l = a.length, u = (c) => {
|
|
638
|
+
if (r && c < t[0])
|
|
639
|
+
return e[0];
|
|
640
|
+
let h = 0;
|
|
641
|
+
if (l > 1)
|
|
642
|
+
for (; h < t.length - 2 && !(c < t[h + 1]); h++)
|
|
643
|
+
;
|
|
644
|
+
const f = /* @__PURE__ */ Lt(t[h], t[h + 1], c);
|
|
645
|
+
return a[h](f);
|
|
646
|
+
};
|
|
647
|
+
return n ? (c) => u(X(t[0], t[o - 1], c)) : u;
|
|
648
|
+
}
|
|
649
|
+
function Eo(t, e) {
|
|
650
|
+
const n = t[t.length - 1];
|
|
651
|
+
for (let i = 1; i <= e; i++) {
|
|
652
|
+
const s = /* @__PURE__ */ Lt(0, e, i);
|
|
653
|
+
t.push(D(n, 1, s));
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
function Ro(t) {
|
|
657
|
+
const e = [0];
|
|
658
|
+
return Eo(e, t.length - 1), e;
|
|
659
|
+
}
|
|
660
|
+
function Lo(t, e) {
|
|
661
|
+
return t.map((n) => n * e);
|
|
662
|
+
}
|
|
663
|
+
function ko(t, e) {
|
|
664
|
+
return t.map(() => e || ls).splice(0, t.length - 1);
|
|
665
|
+
}
|
|
666
|
+
function mt({ duration: t = 300, keyframes: e, times: n, ease: i = "easeInOut" }) {
|
|
667
|
+
const s = zr(i) ? i.map(Ln) : Ln(i), o = {
|
|
668
|
+
done: !1,
|
|
669
|
+
value: e[0]
|
|
670
|
+
}, r = Lo(
|
|
671
|
+
// Only use the provided offsets if they're the correct length
|
|
672
|
+
// TODO Maybe we should warn here if there's a length mismatch
|
|
673
|
+
n && n.length === e.length ? n : Ro(e),
|
|
674
|
+
t
|
|
675
|
+
), a = Mo(r, e, {
|
|
676
|
+
ease: Array.isArray(s) ? s : ko(e, s)
|
|
677
|
+
});
|
|
678
|
+
return {
|
|
679
|
+
calculatedDuration: t,
|
|
680
|
+
next: (l) => (o.value = a(l), o.done = l >= t, o)
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
const Fo = (t) => t !== null;
|
|
684
|
+
function cn(t, { repeat: e, repeatType: n = "loop" }, i, s = 1) {
|
|
685
|
+
const o = t.filter(Fo), a = s < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : o.length - 1;
|
|
686
|
+
return !a || i === void 0 ? o[a] : i;
|
|
687
|
+
}
|
|
688
|
+
const Bo = {
|
|
689
|
+
decay: Ce,
|
|
690
|
+
inertia: Ce,
|
|
691
|
+
tween: mt,
|
|
692
|
+
keyframes: mt,
|
|
693
|
+
spring: Jt
|
|
694
|
+
};
|
|
695
|
+
function ws(t) {
|
|
696
|
+
typeof t.type == "string" && (t.type = Bo[t.type]);
|
|
697
|
+
}
|
|
698
|
+
class un {
|
|
699
|
+
constructor() {
|
|
700
|
+
this.updateFinished();
|
|
701
|
+
}
|
|
702
|
+
get finished() {
|
|
703
|
+
return this._finished;
|
|
704
|
+
}
|
|
705
|
+
updateFinished() {
|
|
706
|
+
this._finished = new Promise((e) => {
|
|
707
|
+
this.resolve = e;
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
notifyFinished() {
|
|
711
|
+
this.resolve();
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Allows the animation to be awaited.
|
|
715
|
+
*
|
|
716
|
+
* @deprecated Use `finished` instead.
|
|
717
|
+
*/
|
|
718
|
+
then(e, n) {
|
|
719
|
+
return this.finished.then(e, n);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
const Io = (t) => t / 100;
|
|
723
|
+
class hn extends un {
|
|
724
|
+
constructor(e) {
|
|
725
|
+
super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
|
|
726
|
+
const { motionValue: n } = this.options;
|
|
727
|
+
n && n.updatedAt !== j.now() && this.tick(j.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
|
|
728
|
+
}, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
|
|
729
|
+
}
|
|
730
|
+
initAnimation() {
|
|
731
|
+
const { options: e } = this;
|
|
732
|
+
ws(e);
|
|
733
|
+
const { type: n = mt, repeat: i = 0, repeatDelay: s = 0, repeatType: o, velocity: r = 0 } = e;
|
|
734
|
+
let { keyframes: a } = e;
|
|
735
|
+
const l = n || mt;
|
|
736
|
+
process.env.NODE_ENV !== "production" && l !== mt && Y(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), l !== mt && typeof a[0] != "number" && (this.mixKeyframes = jt(Io, vs(a[0], a[1])), a = [0, 100]);
|
|
737
|
+
const u = l({ ...e, keyframes: a });
|
|
738
|
+
o === "mirror" && (this.mirroredGenerator = l({
|
|
739
|
+
...e,
|
|
740
|
+
keyframes: [...a].reverse(),
|
|
741
|
+
velocity: -r
|
|
742
|
+
})), u.calculatedDuration === null && (u.calculatedDuration = ln(u));
|
|
743
|
+
const { calculatedDuration: c } = u;
|
|
744
|
+
this.calculatedDuration = c, this.resolvedDuration = c + s, this.totalDuration = this.resolvedDuration * (i + 1) - s, this.generator = u;
|
|
745
|
+
}
|
|
746
|
+
updateTime(e) {
|
|
747
|
+
const n = Math.round(e - this.startTime) * this.playbackSpeed;
|
|
748
|
+
this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
|
|
749
|
+
}
|
|
750
|
+
tick(e, n = !1) {
|
|
751
|
+
const { generator: i, totalDuration: s, mixKeyframes: o, mirroredGenerator: r, resolvedDuration: a, calculatedDuration: l } = this;
|
|
752
|
+
if (this.startTime === null)
|
|
753
|
+
return i.next(0);
|
|
754
|
+
const { delay: u = 0, keyframes: c, repeat: h, repeatType: f, repeatDelay: d, type: m, onUpdate: g, finalKeyframe: T } = this.options;
|
|
755
|
+
this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - s / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e);
|
|
756
|
+
const p = this.currentTime - u * (this.playbackSpeed >= 0 ? 1 : -1), v = this.playbackSpeed >= 0 ? p < 0 : p > s;
|
|
757
|
+
this.currentTime = Math.max(p, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = s);
|
|
758
|
+
let y = this.currentTime, b = i;
|
|
759
|
+
if (h) {
|
|
760
|
+
const P = Math.min(this.currentTime, s) / a;
|
|
761
|
+
let E = Math.floor(P), M = P % 1;
|
|
762
|
+
!M && P >= 1 && (M = 1), M === 1 && E--, E = Math.min(E, h + 1), !!(E % 2) && (f === "reverse" ? (M = 1 - M, d && (M -= d / a)) : f === "mirror" && (b = r)), y = X(0, 1, M) * a;
|
|
763
|
+
}
|
|
764
|
+
const x = v ? { done: !1, value: c[0] } : b.next(y);
|
|
765
|
+
o && (x.value = o(x.value));
|
|
766
|
+
let { done: S } = x;
|
|
767
|
+
!v && l !== null && (S = this.playbackSpeed >= 0 ? this.currentTime >= s : this.currentTime <= 0);
|
|
768
|
+
const A = this.holdTime === null && (this.state === "finished" || this.state === "running" && S);
|
|
769
|
+
return A && m !== Ce && (x.value = cn(c, this.options, T, this.speed)), g && g(x.value), A && this.finish(), x;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
773
|
+
* resolves when the animation finishes at all but in a future update could/should
|
|
774
|
+
* reject if its cancels.
|
|
775
|
+
*/
|
|
776
|
+
then(e, n) {
|
|
777
|
+
return this.finished.then(e, n);
|
|
778
|
+
}
|
|
779
|
+
get duration() {
|
|
780
|
+
return /* @__PURE__ */ W(this.calculatedDuration);
|
|
781
|
+
}
|
|
782
|
+
get iterationDuration() {
|
|
783
|
+
const { delay: e = 0 } = this.options || {};
|
|
784
|
+
return this.duration + /* @__PURE__ */ W(e);
|
|
785
|
+
}
|
|
786
|
+
get time() {
|
|
787
|
+
return /* @__PURE__ */ W(this.currentTime);
|
|
788
|
+
}
|
|
789
|
+
set time(e) {
|
|
790
|
+
e = /* @__PURE__ */ H(e), this.currentTime = e, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.playbackSpeed), this.driver?.start(!1);
|
|
791
|
+
}
|
|
792
|
+
get speed() {
|
|
793
|
+
return this.playbackSpeed;
|
|
794
|
+
}
|
|
795
|
+
set speed(e) {
|
|
796
|
+
this.updateTime(j.now());
|
|
797
|
+
const n = this.playbackSpeed !== e;
|
|
798
|
+
this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ W(this.currentTime));
|
|
799
|
+
}
|
|
800
|
+
play() {
|
|
801
|
+
if (this.isStopped)
|
|
802
|
+
return;
|
|
803
|
+
const { driver: e = To, startTime: n } = this.options;
|
|
804
|
+
this.driver || (this.driver = e((s) => this.tick(s))), this.options.onPlay?.();
|
|
805
|
+
const i = this.driver.now();
|
|
806
|
+
this.state === "finished" ? (this.updateFinished(), this.startTime = i) : this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime || (this.startTime = n ?? i), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
|
|
807
|
+
}
|
|
808
|
+
pause() {
|
|
809
|
+
this.state = "paused", this.updateTime(j.now()), this.holdTime = this.currentTime;
|
|
810
|
+
}
|
|
811
|
+
complete() {
|
|
812
|
+
this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
|
|
813
|
+
}
|
|
814
|
+
finish() {
|
|
815
|
+
this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
|
|
816
|
+
}
|
|
817
|
+
cancel() {
|
|
818
|
+
this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
|
|
819
|
+
}
|
|
820
|
+
teardown() {
|
|
821
|
+
this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
|
|
822
|
+
}
|
|
823
|
+
stopDriver() {
|
|
824
|
+
this.driver && (this.driver.stop(), this.driver = void 0);
|
|
825
|
+
}
|
|
826
|
+
sample(e) {
|
|
827
|
+
return this.startTime = 0, this.tick(e, !0);
|
|
828
|
+
}
|
|
829
|
+
attachTimeline(e) {
|
|
830
|
+
return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
function Oo(t) {
|
|
834
|
+
for (let e = 1; e < t.length; e++)
|
|
835
|
+
t[e] ?? (t[e] = t[e - 1]);
|
|
836
|
+
}
|
|
837
|
+
const lt = (t) => t * 180 / Math.PI, De = (t) => {
|
|
838
|
+
const e = lt(Math.atan2(t[1], t[0]));
|
|
839
|
+
return Me(e);
|
|
840
|
+
}, jo = {
|
|
841
|
+
x: 4,
|
|
842
|
+
y: 5,
|
|
843
|
+
translateX: 4,
|
|
844
|
+
translateY: 5,
|
|
845
|
+
scaleX: 0,
|
|
846
|
+
scaleY: 3,
|
|
847
|
+
scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
|
|
848
|
+
rotate: De,
|
|
849
|
+
rotateZ: De,
|
|
850
|
+
skewX: (t) => lt(Math.atan(t[1])),
|
|
851
|
+
skewY: (t) => lt(Math.atan(t[2])),
|
|
852
|
+
skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
|
|
853
|
+
}, Me = (t) => (t = t % 360, t < 0 && (t += 360), t), jn = De, Nn = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), Un = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), No = {
|
|
854
|
+
x: 12,
|
|
855
|
+
y: 13,
|
|
856
|
+
z: 14,
|
|
857
|
+
translateX: 12,
|
|
858
|
+
translateY: 13,
|
|
859
|
+
translateZ: 14,
|
|
860
|
+
scaleX: Nn,
|
|
861
|
+
scaleY: Un,
|
|
862
|
+
scale: (t) => (Nn(t) + Un(t)) / 2,
|
|
863
|
+
rotateX: (t) => Me(lt(Math.atan2(t[6], t[5]))),
|
|
864
|
+
rotateY: (t) => Me(lt(Math.atan2(-t[2], t[0]))),
|
|
865
|
+
rotateZ: jn,
|
|
866
|
+
rotate: jn,
|
|
867
|
+
skewX: (t) => lt(Math.atan(t[4])),
|
|
868
|
+
skewY: (t) => lt(Math.atan(t[1])),
|
|
869
|
+
skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
|
|
870
|
+
};
|
|
871
|
+
function Ee(t) {
|
|
872
|
+
return t.includes("scale") ? 1 : 0;
|
|
873
|
+
}
|
|
874
|
+
function Re(t, e) {
|
|
875
|
+
if (!t || t === "none")
|
|
876
|
+
return Ee(e);
|
|
877
|
+
const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
878
|
+
let i, s;
|
|
879
|
+
if (n)
|
|
880
|
+
i = No, s = n;
|
|
881
|
+
else {
|
|
882
|
+
const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
883
|
+
i = jo, s = a;
|
|
884
|
+
}
|
|
885
|
+
if (!s)
|
|
886
|
+
return Ee(e);
|
|
887
|
+
const o = i[e], r = s[1].split(",").map(Wo);
|
|
888
|
+
return typeof o == "function" ? o(r) : r[o];
|
|
889
|
+
}
|
|
890
|
+
const Uo = (t, e) => {
|
|
891
|
+
const { transform: n = "none" } = getComputedStyle(t);
|
|
892
|
+
return Re(n, e);
|
|
893
|
+
};
|
|
894
|
+
function Wo(t) {
|
|
895
|
+
return parseFloat(t.trim());
|
|
896
|
+
}
|
|
897
|
+
const At = [
|
|
898
|
+
"transformPerspective",
|
|
899
|
+
"x",
|
|
900
|
+
"y",
|
|
901
|
+
"z",
|
|
902
|
+
"translateX",
|
|
903
|
+
"translateY",
|
|
904
|
+
"translateZ",
|
|
905
|
+
"scale",
|
|
906
|
+
"scaleX",
|
|
907
|
+
"scaleY",
|
|
908
|
+
"rotate",
|
|
909
|
+
"rotateX",
|
|
910
|
+
"rotateY",
|
|
911
|
+
"rotateZ",
|
|
912
|
+
"skew",
|
|
913
|
+
"skewX",
|
|
914
|
+
"skewY"
|
|
915
|
+
], Vt = new Set(At), Wn = (t) => t === St || t === w, $o = /* @__PURE__ */ new Set(["x", "y", "z"]), Ko = At.filter((t) => !$o.has(t));
|
|
916
|
+
function zo(t) {
|
|
917
|
+
const e = [];
|
|
918
|
+
return Ko.forEach((n) => {
|
|
919
|
+
const i = t.getValue(n);
|
|
920
|
+
i !== void 0 && (e.push([n, i.get()]), i.set(n.startsWith("scale") ? 1 : 0));
|
|
921
|
+
}), e;
|
|
922
|
+
}
|
|
923
|
+
const ct = {
|
|
924
|
+
// Dimensions
|
|
925
|
+
width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
926
|
+
height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
927
|
+
top: (t, { top: e }) => parseFloat(e),
|
|
928
|
+
left: (t, { left: e }) => parseFloat(e),
|
|
929
|
+
bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
|
|
930
|
+
right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
|
|
931
|
+
// Transform
|
|
932
|
+
x: (t, { transform: e }) => Re(e, "x"),
|
|
933
|
+
y: (t, { transform: e }) => Re(e, "y")
|
|
934
|
+
};
|
|
935
|
+
ct.translateX = ct.x;
|
|
936
|
+
ct.translateY = ct.y;
|
|
937
|
+
const ut = /* @__PURE__ */ new Set();
|
|
938
|
+
let Le = !1, ke = !1, Fe = !1;
|
|
939
|
+
function Ps() {
|
|
940
|
+
if (ke) {
|
|
941
|
+
const t = Array.from(ut).filter((i) => i.needsMeasurement), e = new Set(t.map((i) => i.element)), n = /* @__PURE__ */ new Map();
|
|
942
|
+
e.forEach((i) => {
|
|
943
|
+
const s = zo(i);
|
|
944
|
+
s.length && (n.set(i, s), i.render());
|
|
945
|
+
}), t.forEach((i) => i.measureInitialState()), e.forEach((i) => {
|
|
946
|
+
i.render();
|
|
947
|
+
const s = n.get(i);
|
|
948
|
+
s && s.forEach(([o, r]) => {
|
|
949
|
+
i.getValue(o)?.set(r);
|
|
950
|
+
});
|
|
951
|
+
}), t.forEach((i) => i.measureEndState()), t.forEach((i) => {
|
|
952
|
+
i.suspendedScrollY !== void 0 && window.scrollTo(0, i.suspendedScrollY);
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
ke = !1, Le = !1, ut.forEach((t) => t.complete(Fe)), ut.clear();
|
|
956
|
+
}
|
|
957
|
+
function bs() {
|
|
958
|
+
ut.forEach((t) => {
|
|
959
|
+
t.readKeyframes(), t.needsMeasurement && (ke = !0);
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
function Ho() {
|
|
963
|
+
Fe = !0, bs(), Ps(), Fe = !1;
|
|
964
|
+
}
|
|
965
|
+
class fn {
|
|
966
|
+
constructor(e, n, i, s, o, r = !1) {
|
|
967
|
+
this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = i, this.motionValue = s, this.element = o, this.isAsync = r;
|
|
968
|
+
}
|
|
969
|
+
scheduleResolve() {
|
|
970
|
+
this.state = "scheduled", this.isAsync ? (ut.add(this), Le || (Le = !0, V.read(bs), V.resolveKeyframes(Ps))) : (this.readKeyframes(), this.complete());
|
|
971
|
+
}
|
|
972
|
+
readKeyframes() {
|
|
973
|
+
const { unresolvedKeyframes: e, name: n, element: i, motionValue: s } = this;
|
|
974
|
+
if (e[0] === null) {
|
|
975
|
+
const o = s?.get(), r = e[e.length - 1];
|
|
976
|
+
if (o !== void 0)
|
|
977
|
+
e[0] = o;
|
|
978
|
+
else if (i && n) {
|
|
979
|
+
const a = i.readValue(n, r);
|
|
980
|
+
a != null && (e[0] = a);
|
|
981
|
+
}
|
|
982
|
+
e[0] === void 0 && (e[0] = r), s && o === void 0 && s.set(e[0]);
|
|
983
|
+
}
|
|
984
|
+
Oo(e);
|
|
985
|
+
}
|
|
986
|
+
setFinalKeyframe() {
|
|
987
|
+
}
|
|
988
|
+
measureInitialState() {
|
|
989
|
+
}
|
|
990
|
+
renderEndStyles() {
|
|
991
|
+
}
|
|
992
|
+
measureEndState() {
|
|
993
|
+
}
|
|
994
|
+
complete(e = !1) {
|
|
995
|
+
this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), ut.delete(this);
|
|
996
|
+
}
|
|
997
|
+
cancel() {
|
|
998
|
+
this.state === "scheduled" && (ut.delete(this), this.state = "pending");
|
|
999
|
+
}
|
|
1000
|
+
resume() {
|
|
1001
|
+
this.state === "pending" && this.scheduleResolve();
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
const _o = (t) => t.startsWith("--");
|
|
1005
|
+
function Go(t, e, n) {
|
|
1006
|
+
_o(e) ? t.style.setProperty(e, n) : t.style[e] = n;
|
|
1007
|
+
}
|
|
1008
|
+
const Xo = /* @__PURE__ */ Ze(() => window.ScrollTimeline !== void 0), Yo = {};
|
|
1009
|
+
function qo(t, e) {
|
|
1010
|
+
const n = /* @__PURE__ */ Ze(t);
|
|
1011
|
+
return () => Yo[e] ?? n();
|
|
1012
|
+
}
|
|
1013
|
+
const Ss = /* @__PURE__ */ qo(() => {
|
|
1014
|
+
try {
|
|
1015
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
1016
|
+
} catch {
|
|
1017
|
+
return !1;
|
|
1018
|
+
}
|
|
1019
|
+
return !0;
|
|
1020
|
+
}, "linearEasing"), Dt = ([t, e, n, i]) => `cubic-bezier(${t}, ${e}, ${n}, ${i})`, $n = {
|
|
1021
|
+
linear: "linear",
|
|
1022
|
+
ease: "ease",
|
|
1023
|
+
easeIn: "ease-in",
|
|
1024
|
+
easeOut: "ease-out",
|
|
1025
|
+
easeInOut: "ease-in-out",
|
|
1026
|
+
circIn: /* @__PURE__ */ Dt([0, 0.65, 0.55, 1]),
|
|
1027
|
+
circOut: /* @__PURE__ */ Dt([0.55, 0, 1, 0.45]),
|
|
1028
|
+
backIn: /* @__PURE__ */ Dt([0.31, 0.01, 0.66, -0.59]),
|
|
1029
|
+
backOut: /* @__PURE__ */ Dt([0.33, 1.53, 0.69, 0.99])
|
|
1030
|
+
};
|
|
1031
|
+
function As(t, e) {
|
|
1032
|
+
if (t)
|
|
1033
|
+
return typeof t == "function" ? Ss() ? Ts(t, e) : "ease-out" : cs(t) ? Dt(t) : Array.isArray(t) ? t.map((n) => As(n, e) || $n.easeOut) : $n[t];
|
|
1034
|
+
}
|
|
1035
|
+
function Zo(t, e, n, { delay: i = 0, duration: s = 300, repeat: o = 0, repeatType: r = "loop", ease: a = "easeOut", times: l } = {}, u = void 0) {
|
|
1036
|
+
const c = {
|
|
1037
|
+
[e]: n
|
|
1038
|
+
};
|
|
1039
|
+
l && (c.offset = l);
|
|
1040
|
+
const h = As(a, s);
|
|
1041
|
+
Array.isArray(h) && (c.easing = h);
|
|
1042
|
+
const f = {
|
|
1043
|
+
delay: i,
|
|
1044
|
+
duration: s,
|
|
1045
|
+
easing: Array.isArray(h) ? "linear" : h,
|
|
1046
|
+
fill: "both",
|
|
1047
|
+
iterations: o + 1,
|
|
1048
|
+
direction: r === "reverse" ? "alternate" : "normal"
|
|
1049
|
+
};
|
|
1050
|
+
return u && (f.pseudoElement = u), t.animate(c, f);
|
|
1051
|
+
}
|
|
1052
|
+
function Vs(t) {
|
|
1053
|
+
return typeof t == "function" && "applyToOptions" in t;
|
|
1054
|
+
}
|
|
1055
|
+
function Jo({ type: t, ...e }) {
|
|
1056
|
+
return Vs(t) && Ss() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
|
|
1057
|
+
}
|
|
1058
|
+
class Qo extends un {
|
|
1059
|
+
constructor(e) {
|
|
1060
|
+
if (super(), this.finishedTime = null, this.isStopped = !1, !e)
|
|
1061
|
+
return;
|
|
1062
|
+
const { element: n, name: i, keyframes: s, pseudoElement: o, allowFlatten: r = !1, finalKeyframe: a, onComplete: l } = e;
|
|
1063
|
+
this.isPseudoElement = !!o, this.allowFlatten = r, this.options = e, Y(typeof e.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
|
|
1064
|
+
const u = Jo(e);
|
|
1065
|
+
this.animation = Zo(n, i, s, u, o), u.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
|
|
1066
|
+
if (this.finishedTime = this.time, !o) {
|
|
1067
|
+
const c = cn(s, this.options, a, this.speed);
|
|
1068
|
+
this.updateMotionValue ? this.updateMotionValue(c) : Go(n, i, c), this.animation.cancel();
|
|
1069
|
+
}
|
|
1070
|
+
l?.(), this.notifyFinished();
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
play() {
|
|
1074
|
+
this.isStopped || (this.animation.play(), this.state === "finished" && this.updateFinished());
|
|
1075
|
+
}
|
|
1076
|
+
pause() {
|
|
1077
|
+
this.animation.pause();
|
|
1078
|
+
}
|
|
1079
|
+
complete() {
|
|
1080
|
+
this.animation.finish?.();
|
|
1081
|
+
}
|
|
1082
|
+
cancel() {
|
|
1083
|
+
try {
|
|
1084
|
+
this.animation.cancel();
|
|
1085
|
+
} catch {
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
stop() {
|
|
1089
|
+
if (this.isStopped)
|
|
1090
|
+
return;
|
|
1091
|
+
this.isStopped = !0;
|
|
1092
|
+
const { state: e } = this;
|
|
1093
|
+
e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
1097
|
+
*
|
|
1098
|
+
* In this method, we commit styles back to the DOM before cancelling
|
|
1099
|
+
* the animation.
|
|
1100
|
+
*
|
|
1101
|
+
* This is designed to be overridden by NativeAnimationExtended, which
|
|
1102
|
+
* will create a renderless JS animation and sample it twice to calculate
|
|
1103
|
+
* its current value, "previous" value, and therefore allow
|
|
1104
|
+
* Motion to also correctly calculate velocity for any subsequent animation
|
|
1105
|
+
* while deferring the commit until the next animation frame.
|
|
1106
|
+
*/
|
|
1107
|
+
commitStyles() {
|
|
1108
|
+
this.isPseudoElement || this.animation.commitStyles?.();
|
|
1109
|
+
}
|
|
1110
|
+
get duration() {
|
|
1111
|
+
const e = this.animation.effect?.getComputedTiming?.().duration || 0;
|
|
1112
|
+
return /* @__PURE__ */ W(Number(e));
|
|
1113
|
+
}
|
|
1114
|
+
get iterationDuration() {
|
|
1115
|
+
const { delay: e = 0 } = this.options || {};
|
|
1116
|
+
return this.duration + /* @__PURE__ */ W(e);
|
|
1117
|
+
}
|
|
1118
|
+
get time() {
|
|
1119
|
+
return /* @__PURE__ */ W(Number(this.animation.currentTime) || 0);
|
|
1120
|
+
}
|
|
1121
|
+
set time(e) {
|
|
1122
|
+
this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ H(e);
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* The playback speed of the animation.
|
|
1126
|
+
* 1 = normal speed, 2 = double speed, 0.5 = half speed.
|
|
1127
|
+
*/
|
|
1128
|
+
get speed() {
|
|
1129
|
+
return this.animation.playbackRate;
|
|
1130
|
+
}
|
|
1131
|
+
set speed(e) {
|
|
1132
|
+
e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
|
|
1133
|
+
}
|
|
1134
|
+
get state() {
|
|
1135
|
+
return this.finishedTime !== null ? "finished" : this.animation.playState;
|
|
1136
|
+
}
|
|
1137
|
+
get startTime() {
|
|
1138
|
+
return Number(this.animation.startTime);
|
|
1139
|
+
}
|
|
1140
|
+
set startTime(e) {
|
|
1141
|
+
this.animation.startTime = e;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Attaches a timeline to the animation, for instance the `ScrollTimeline`.
|
|
1145
|
+
*/
|
|
1146
|
+
attachTimeline({ timeline: e, observe: n }) {
|
|
1147
|
+
return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && Xo() ? (this.animation.timeline = e, $) : n(this);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
const Cs = {
|
|
1151
|
+
anticipate: rs,
|
|
1152
|
+
backInOut: ss,
|
|
1153
|
+
circInOut: as
|
|
1154
|
+
};
|
|
1155
|
+
function ta(t) {
|
|
1156
|
+
return t in Cs;
|
|
1157
|
+
}
|
|
1158
|
+
function ea(t) {
|
|
1159
|
+
typeof t.ease == "string" && ta(t.ease) && (t.ease = Cs[t.ease]);
|
|
1160
|
+
}
|
|
1161
|
+
const Kn = 10;
|
|
1162
|
+
class na extends Qo {
|
|
1163
|
+
constructor(e) {
|
|
1164
|
+
ea(e), ws(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e;
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
1168
|
+
*
|
|
1169
|
+
* Rather than read commited styles back out of the DOM, we can
|
|
1170
|
+
* create a renderless JS animation and sample it twice to calculate
|
|
1171
|
+
* its current value, "previous" value, and therefore allow
|
|
1172
|
+
* Motion to calculate velocity for any subsequent animation.
|
|
1173
|
+
*/
|
|
1174
|
+
updateMotionValue(e) {
|
|
1175
|
+
const { motionValue: n, onUpdate: i, onComplete: s, element: o, ...r } = this.options;
|
|
1176
|
+
if (!n)
|
|
1177
|
+
return;
|
|
1178
|
+
if (e !== void 0) {
|
|
1179
|
+
n.set(e);
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
const a = new hn({
|
|
1183
|
+
...r,
|
|
1184
|
+
autoplay: !1
|
|
1185
|
+
}), l = /* @__PURE__ */ H(this.finishedTime ?? this.time);
|
|
1186
|
+
n.setWithVelocity(a.sample(l - Kn).value, a.sample(l).value, Kn), a.stop();
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
const zn = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
|
|
1190
|
+
(nt.test(t) || t === "0") && // And it contains numbers and/or colors
|
|
1191
|
+
!t.startsWith("url("));
|
|
1192
|
+
function ia(t) {
|
|
1193
|
+
const e = t[0];
|
|
1194
|
+
if (t.length === 1)
|
|
1195
|
+
return !0;
|
|
1196
|
+
for (let n = 0; n < t.length; n++)
|
|
1197
|
+
if (t[n] !== e)
|
|
1198
|
+
return !0;
|
|
1199
|
+
}
|
|
1200
|
+
function sa(t, e, n, i) {
|
|
1201
|
+
const s = t[0];
|
|
1202
|
+
if (s === null)
|
|
1203
|
+
return !1;
|
|
1204
|
+
if (e === "display" || e === "visibility")
|
|
1205
|
+
return !0;
|
|
1206
|
+
const o = t[t.length - 1], r = zn(s, e), a = zn(o, e);
|
|
1207
|
+
return bt(r === a, `You are trying to animate ${e} from "${s}" to "${o}". "${r ? o : s}" is not an animatable value.`, "value-not-animatable"), !r || !a ? !1 : ia(t) || (n === "spring" || Vs(n)) && i;
|
|
1208
|
+
}
|
|
1209
|
+
function Be(t) {
|
|
1210
|
+
t.duration = 0, t.type = "keyframes";
|
|
1211
|
+
}
|
|
1212
|
+
const ra = /* @__PURE__ */ new Set([
|
|
1213
|
+
"opacity",
|
|
1214
|
+
"clipPath",
|
|
1215
|
+
"filter",
|
|
1216
|
+
"transform"
|
|
1217
|
+
// TODO: Could be re-enabled now we have support for linear() easing
|
|
1218
|
+
// "background-color"
|
|
1219
|
+
]), oa = /* @__PURE__ */ Ze(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
1220
|
+
function aa(t) {
|
|
1221
|
+
const { motionValue: e, name: n, repeatDelay: i, repeatType: s, damping: o, type: r } = t;
|
|
1222
|
+
if (!(e?.owner?.current instanceof HTMLElement))
|
|
1223
|
+
return !1;
|
|
1224
|
+
const { onUpdate: l, transformTemplate: u } = e.owner.getProps();
|
|
1225
|
+
return oa() && n && ra.has(n) && (n !== "transform" || !u) && /**
|
|
1226
|
+
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
1227
|
+
* no way to read the value from WAAPI every frame.
|
|
1228
|
+
*/
|
|
1229
|
+
!l && !i && s !== "mirror" && o !== 0 && r !== "inertia";
|
|
1230
|
+
}
|
|
1231
|
+
const la = 40;
|
|
1232
|
+
class ca extends un {
|
|
1233
|
+
constructor({ autoplay: e = !0, delay: n = 0, type: i = "keyframes", repeat: s = 0, repeatDelay: o = 0, repeatType: r = "loop", keyframes: a, name: l, motionValue: u, element: c, ...h }) {
|
|
1234
|
+
super(), this.stop = () => {
|
|
1235
|
+
this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
|
|
1236
|
+
}, this.createdAt = j.now();
|
|
1237
|
+
const f = {
|
|
1238
|
+
autoplay: e,
|
|
1239
|
+
delay: n,
|
|
1240
|
+
type: i,
|
|
1241
|
+
repeat: s,
|
|
1242
|
+
repeatDelay: o,
|
|
1243
|
+
repeatType: r,
|
|
1244
|
+
name: l,
|
|
1245
|
+
motionValue: u,
|
|
1246
|
+
element: c,
|
|
1247
|
+
...h
|
|
1248
|
+
}, d = c?.KeyframeResolver || fn;
|
|
1249
|
+
this.keyframeResolver = new d(a, (m, g, T) => this.onKeyframesResolved(m, g, f, !T), l, u, c), this.keyframeResolver?.scheduleResolve();
|
|
1250
|
+
}
|
|
1251
|
+
onKeyframesResolved(e, n, i, s) {
|
|
1252
|
+
this.keyframeResolver = void 0;
|
|
1253
|
+
const { name: o, type: r, velocity: a, delay: l, isHandoff: u, onUpdate: c } = i;
|
|
1254
|
+
this.resolvedAt = j.now(), sa(e, o, r, a) || ((q.instantAnimations || !l) && c?.(cn(e, i, n)), e[0] = e[e.length - 1], Be(i), i.repeat = 0);
|
|
1255
|
+
const f = {
|
|
1256
|
+
startTime: s ? this.resolvedAt ? this.resolvedAt - this.createdAt > la ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
|
|
1257
|
+
finalKeyframe: n,
|
|
1258
|
+
...i,
|
|
1259
|
+
keyframes: e
|
|
1260
|
+
}, d = !u && aa(f) ? new na({
|
|
1261
|
+
...f,
|
|
1262
|
+
element: f.motionValue.owner.current
|
|
1263
|
+
}) : new hn(f);
|
|
1264
|
+
d.finished.then(() => this.notifyFinished()).catch($), this.pendingTimeline && (this.stopTimeline = d.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = d;
|
|
1265
|
+
}
|
|
1266
|
+
get finished() {
|
|
1267
|
+
return this._animation ? this.animation.finished : this._finished;
|
|
1268
|
+
}
|
|
1269
|
+
then(e, n) {
|
|
1270
|
+
return this.finished.finally(e).then(() => {
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
get animation() {
|
|
1274
|
+
return this._animation || (this.keyframeResolver?.resume(), Ho()), this._animation;
|
|
1275
|
+
}
|
|
1276
|
+
get duration() {
|
|
1277
|
+
return this.animation.duration;
|
|
1278
|
+
}
|
|
1279
|
+
get iterationDuration() {
|
|
1280
|
+
return this.animation.iterationDuration;
|
|
1281
|
+
}
|
|
1282
|
+
get time() {
|
|
1283
|
+
return this.animation.time;
|
|
1284
|
+
}
|
|
1285
|
+
set time(e) {
|
|
1286
|
+
this.animation.time = e;
|
|
1287
|
+
}
|
|
1288
|
+
get speed() {
|
|
1289
|
+
return this.animation.speed;
|
|
1290
|
+
}
|
|
1291
|
+
get state() {
|
|
1292
|
+
return this.animation.state;
|
|
1293
|
+
}
|
|
1294
|
+
set speed(e) {
|
|
1295
|
+
this.animation.speed = e;
|
|
1296
|
+
}
|
|
1297
|
+
get startTime() {
|
|
1298
|
+
return this.animation.startTime;
|
|
1299
|
+
}
|
|
1300
|
+
attachTimeline(e) {
|
|
1301
|
+
return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
|
|
1302
|
+
}
|
|
1303
|
+
play() {
|
|
1304
|
+
this.animation.play();
|
|
1305
|
+
}
|
|
1306
|
+
pause() {
|
|
1307
|
+
this.animation.pause();
|
|
1308
|
+
}
|
|
1309
|
+
complete() {
|
|
1310
|
+
this.animation.complete();
|
|
1311
|
+
}
|
|
1312
|
+
cancel() {
|
|
1313
|
+
this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
const ua = (
|
|
1317
|
+
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
|
|
1318
|
+
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
|
|
1319
|
+
);
|
|
1320
|
+
function ha(t) {
|
|
1321
|
+
const e = ua.exec(t);
|
|
1322
|
+
if (!e)
|
|
1323
|
+
return [,];
|
|
1324
|
+
const [, n, i, s] = e;
|
|
1325
|
+
return [`--${n ?? i}`, s];
|
|
1326
|
+
}
|
|
1327
|
+
const fa = 4;
|
|
1328
|
+
function Ds(t, e, n = 1) {
|
|
1329
|
+
Y(n <= fa, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
1330
|
+
const [i, s] = ha(t);
|
|
1331
|
+
if (!i)
|
|
1332
|
+
return;
|
|
1333
|
+
const o = window.getComputedStyle(e).getPropertyValue(i);
|
|
1334
|
+
if (o) {
|
|
1335
|
+
const r = o.trim();
|
|
1336
|
+
return qi(r) ? parseFloat(r) : r;
|
|
1337
|
+
}
|
|
1338
|
+
return sn(s) ? Ds(s, e, n + 1) : s;
|
|
1339
|
+
}
|
|
1340
|
+
function dn(t, e) {
|
|
1341
|
+
return t?.[e] ?? t?.default ?? t;
|
|
1342
|
+
}
|
|
1343
|
+
const Ms = /* @__PURE__ */ new Set([
|
|
1344
|
+
"width",
|
|
1345
|
+
"height",
|
|
1346
|
+
"top",
|
|
1347
|
+
"left",
|
|
1348
|
+
"right",
|
|
1349
|
+
"bottom",
|
|
1350
|
+
...At
|
|
1351
|
+
]), da = {
|
|
1352
|
+
test: (t) => t === "auto",
|
|
1353
|
+
parse: (t) => t
|
|
1354
|
+
}, Es = (t) => (e) => e.test(t), Rs = [St, w, G, J, no, eo, da], Hn = (t) => Rs.find(Es(t));
|
|
1355
|
+
function ma(t) {
|
|
1356
|
+
return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Ji(t) : !0;
|
|
1357
|
+
}
|
|
1358
|
+
const pa = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
1359
|
+
function ga(t) {
|
|
1360
|
+
const [e, n] = t.slice(0, -1).split("(");
|
|
1361
|
+
if (e === "drop-shadow")
|
|
1362
|
+
return t;
|
|
1363
|
+
const [i] = n.match(rn) || [];
|
|
1364
|
+
if (!i)
|
|
1365
|
+
return t;
|
|
1366
|
+
const s = n.replace(i, "");
|
|
1367
|
+
let o = pa.has(e) ? 1 : 0;
|
|
1368
|
+
return i !== n && (o *= 100), e + "(" + o + s + ")";
|
|
1369
|
+
}
|
|
1370
|
+
const ya = /\b([a-z-]*)\(.*?\)/gu, Ie = {
|
|
1371
|
+
...nt,
|
|
1372
|
+
getAnimatableNone: (t) => {
|
|
1373
|
+
const e = t.match(ya);
|
|
1374
|
+
return e ? e.map(ga).join(" ") : t;
|
|
1375
|
+
}
|
|
1376
|
+
}, _n = {
|
|
1377
|
+
...St,
|
|
1378
|
+
transform: Math.round
|
|
1379
|
+
}, va = {
|
|
1380
|
+
rotate: J,
|
|
1381
|
+
rotateX: J,
|
|
1382
|
+
rotateY: J,
|
|
1383
|
+
rotateZ: J,
|
|
1384
|
+
scale: Kt,
|
|
1385
|
+
scaleX: Kt,
|
|
1386
|
+
scaleY: Kt,
|
|
1387
|
+
scaleZ: Kt,
|
|
1388
|
+
skew: J,
|
|
1389
|
+
skewX: J,
|
|
1390
|
+
skewY: J,
|
|
1391
|
+
distance: w,
|
|
1392
|
+
translateX: w,
|
|
1393
|
+
translateY: w,
|
|
1394
|
+
translateZ: w,
|
|
1395
|
+
x: w,
|
|
1396
|
+
y: w,
|
|
1397
|
+
z: w,
|
|
1398
|
+
perspective: w,
|
|
1399
|
+
transformPerspective: w,
|
|
1400
|
+
opacity: kt,
|
|
1401
|
+
originX: kn,
|
|
1402
|
+
originY: kn,
|
|
1403
|
+
originZ: w
|
|
1404
|
+
}, mn = {
|
|
1405
|
+
// Border props
|
|
1406
|
+
borderWidth: w,
|
|
1407
|
+
borderTopWidth: w,
|
|
1408
|
+
borderRightWidth: w,
|
|
1409
|
+
borderBottomWidth: w,
|
|
1410
|
+
borderLeftWidth: w,
|
|
1411
|
+
borderRadius: w,
|
|
1412
|
+
radius: w,
|
|
1413
|
+
borderTopLeftRadius: w,
|
|
1414
|
+
borderTopRightRadius: w,
|
|
1415
|
+
borderBottomRightRadius: w,
|
|
1416
|
+
borderBottomLeftRadius: w,
|
|
1417
|
+
// Positioning props
|
|
1418
|
+
width: w,
|
|
1419
|
+
maxWidth: w,
|
|
1420
|
+
height: w,
|
|
1421
|
+
maxHeight: w,
|
|
1422
|
+
top: w,
|
|
1423
|
+
right: w,
|
|
1424
|
+
bottom: w,
|
|
1425
|
+
left: w,
|
|
1426
|
+
// Spacing props
|
|
1427
|
+
padding: w,
|
|
1428
|
+
paddingTop: w,
|
|
1429
|
+
paddingRight: w,
|
|
1430
|
+
paddingBottom: w,
|
|
1431
|
+
paddingLeft: w,
|
|
1432
|
+
margin: w,
|
|
1433
|
+
marginTop: w,
|
|
1434
|
+
marginRight: w,
|
|
1435
|
+
marginBottom: w,
|
|
1436
|
+
marginLeft: w,
|
|
1437
|
+
// Misc
|
|
1438
|
+
backgroundPositionX: w,
|
|
1439
|
+
backgroundPositionY: w,
|
|
1440
|
+
...va,
|
|
1441
|
+
zIndex: _n,
|
|
1442
|
+
// SVG
|
|
1443
|
+
fillOpacity: kt,
|
|
1444
|
+
strokeOpacity: kt,
|
|
1445
|
+
numOctaves: _n
|
|
1446
|
+
}, Ta = {
|
|
1447
|
+
...mn,
|
|
1448
|
+
// Color props
|
|
1449
|
+
color: R,
|
|
1450
|
+
backgroundColor: R,
|
|
1451
|
+
outlineColor: R,
|
|
1452
|
+
fill: R,
|
|
1453
|
+
stroke: R,
|
|
1454
|
+
// Border props
|
|
1455
|
+
borderColor: R,
|
|
1456
|
+
borderTopColor: R,
|
|
1457
|
+
borderRightColor: R,
|
|
1458
|
+
borderBottomColor: R,
|
|
1459
|
+
borderLeftColor: R,
|
|
1460
|
+
filter: Ie,
|
|
1461
|
+
WebkitFilter: Ie
|
|
1462
|
+
}, Ls = (t) => Ta[t];
|
|
1463
|
+
function ks(t, e) {
|
|
1464
|
+
let n = Ls(t);
|
|
1465
|
+
return n !== Ie && (n = nt), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
|
|
1466
|
+
}
|
|
1467
|
+
const xa = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
1468
|
+
function wa(t, e, n) {
|
|
1469
|
+
let i = 0, s;
|
|
1470
|
+
for (; i < t.length && !s; ) {
|
|
1471
|
+
const o = t[i];
|
|
1472
|
+
typeof o == "string" && !xa.has(o) && Ft(o).values.length && (s = t[i]), i++;
|
|
1473
|
+
}
|
|
1474
|
+
if (s && n)
|
|
1475
|
+
for (const o of e)
|
|
1476
|
+
t[o] = ks(n, s);
|
|
1477
|
+
}
|
|
1478
|
+
class Pa extends fn {
|
|
1479
|
+
constructor(e, n, i, s, o) {
|
|
1480
|
+
super(e, n, i, s, o, !0);
|
|
1481
|
+
}
|
|
1482
|
+
readKeyframes() {
|
|
1483
|
+
const { unresolvedKeyframes: e, element: n, name: i } = this;
|
|
1484
|
+
if (!n || !n.current)
|
|
1485
|
+
return;
|
|
1486
|
+
super.readKeyframes();
|
|
1487
|
+
for (let l = 0; l < e.length; l++) {
|
|
1488
|
+
let u = e[l];
|
|
1489
|
+
if (typeof u == "string" && (u = u.trim(), sn(u))) {
|
|
1490
|
+
const c = Ds(u, n.current);
|
|
1491
|
+
c !== void 0 && (e[l] = c), l === e.length - 1 && (this.finalKeyframe = u);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
if (this.resolveNoneKeyframes(), !Ms.has(i) || e.length !== 2)
|
|
1495
|
+
return;
|
|
1496
|
+
const [s, o] = e, r = Hn(s), a = Hn(o);
|
|
1497
|
+
if (r !== a)
|
|
1498
|
+
if (Wn(r) && Wn(a))
|
|
1499
|
+
for (let l = 0; l < e.length; l++) {
|
|
1500
|
+
const u = e[l];
|
|
1501
|
+
typeof u == "string" && (e[l] = parseFloat(u));
|
|
1502
|
+
}
|
|
1503
|
+
else ct[i] && (this.needsMeasurement = !0);
|
|
1504
|
+
}
|
|
1505
|
+
resolveNoneKeyframes() {
|
|
1506
|
+
const { unresolvedKeyframes: e, name: n } = this, i = [];
|
|
1507
|
+
for (let s = 0; s < e.length; s++)
|
|
1508
|
+
(e[s] === null || ma(e[s])) && i.push(s);
|
|
1509
|
+
i.length && wa(e, i, n);
|
|
1510
|
+
}
|
|
1511
|
+
measureInitialState() {
|
|
1512
|
+
const { element: e, unresolvedKeyframes: n, name: i } = this;
|
|
1513
|
+
if (!e || !e.current)
|
|
1514
|
+
return;
|
|
1515
|
+
i === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = ct[i](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
|
|
1516
|
+
const s = n[n.length - 1];
|
|
1517
|
+
s !== void 0 && e.getValue(i, s).jump(s, !1);
|
|
1518
|
+
}
|
|
1519
|
+
measureEndState() {
|
|
1520
|
+
const { element: e, name: n, unresolvedKeyframes: i } = this;
|
|
1521
|
+
if (!e || !e.current)
|
|
1522
|
+
return;
|
|
1523
|
+
const s = e.getValue(n);
|
|
1524
|
+
s && s.jump(this.measuredOrigin, !1);
|
|
1525
|
+
const o = i.length - 1, r = i[o];
|
|
1526
|
+
i[o] = ct[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = r), this.removedTransforms?.length && this.removedTransforms.forEach(([a, l]) => {
|
|
1527
|
+
e.getValue(a).set(l);
|
|
1528
|
+
}), this.resolveNoneKeyframes();
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
function ba(t, e, n) {
|
|
1532
|
+
if (t instanceof EventTarget)
|
|
1533
|
+
return [t];
|
|
1534
|
+
if (typeof t == "string") {
|
|
1535
|
+
let i = document;
|
|
1536
|
+
const s = n?.[t] ?? i.querySelectorAll(t);
|
|
1537
|
+
return s ? Array.from(s) : [];
|
|
1538
|
+
}
|
|
1539
|
+
return Array.from(t);
|
|
1540
|
+
}
|
|
1541
|
+
const Fs = (t, e) => e && typeof t == "number" ? e.transform(t) : t;
|
|
1542
|
+
function Bs(t) {
|
|
1543
|
+
return Zi(t) && "offsetHeight" in t;
|
|
1544
|
+
}
|
|
1545
|
+
const Gn = 30, Sa = (t) => !isNaN(parseFloat(t));
|
|
1546
|
+
class Aa {
|
|
1547
|
+
/**
|
|
1548
|
+
* @param init - The initiating value
|
|
1549
|
+
* @param config - Optional configuration options
|
|
1550
|
+
*
|
|
1551
|
+
* - `transformer`: A function to transform incoming values with.
|
|
1552
|
+
*/
|
|
1553
|
+
constructor(e, n = {}) {
|
|
1554
|
+
this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (i) => {
|
|
1555
|
+
const s = j.now();
|
|
1556
|
+
if (this.updatedAt !== s && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(i), this.current !== this.prev && (this.events.change?.notify(this.current), this.dependents))
|
|
1557
|
+
for (const o of this.dependents)
|
|
1558
|
+
o.dirty();
|
|
1559
|
+
}, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
|
|
1560
|
+
}
|
|
1561
|
+
setCurrent(e) {
|
|
1562
|
+
this.current = e, this.updatedAt = j.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = Sa(this.current));
|
|
1563
|
+
}
|
|
1564
|
+
setPrevFrameValue(e = this.current) {
|
|
1565
|
+
this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
1569
|
+
*
|
|
1570
|
+
* It returns a function that, when called, will cancel the subscription.
|
|
1571
|
+
*
|
|
1572
|
+
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
1573
|
+
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
1574
|
+
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
1575
|
+
*
|
|
1576
|
+
* ```jsx
|
|
1577
|
+
* export const MyComponent = () => {
|
|
1578
|
+
* const x = useMotionValue(0)
|
|
1579
|
+
* const y = useMotionValue(0)
|
|
1580
|
+
* const opacity = useMotionValue(1)
|
|
1581
|
+
*
|
|
1582
|
+
* useEffect(() => {
|
|
1583
|
+
* function updateOpacity() {
|
|
1584
|
+
* const maxXY = Math.max(x.get(), y.get())
|
|
1585
|
+
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
1586
|
+
* opacity.set(newOpacity)
|
|
1587
|
+
* }
|
|
1588
|
+
*
|
|
1589
|
+
* const unsubscribeX = x.on("change", updateOpacity)
|
|
1590
|
+
* const unsubscribeY = y.on("change", updateOpacity)
|
|
1591
|
+
*
|
|
1592
|
+
* return () => {
|
|
1593
|
+
* unsubscribeX()
|
|
1594
|
+
* unsubscribeY()
|
|
1595
|
+
* }
|
|
1596
|
+
* }, [])
|
|
1597
|
+
*
|
|
1598
|
+
* return <motion.div style={{ x }} />
|
|
1599
|
+
* }
|
|
1600
|
+
* ```
|
|
1601
|
+
*
|
|
1602
|
+
* @param subscriber - A function that receives the latest value.
|
|
1603
|
+
* @returns A function that, when called, will cancel this subscription.
|
|
1604
|
+
*
|
|
1605
|
+
* @deprecated
|
|
1606
|
+
*/
|
|
1607
|
+
onChange(e) {
|
|
1608
|
+
return process.env.NODE_ENV !== "production" && Qe(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
|
|
1609
|
+
}
|
|
1610
|
+
on(e, n) {
|
|
1611
|
+
this.events[e] || (this.events[e] = new Je());
|
|
1612
|
+
const i = this.events[e].add(n);
|
|
1613
|
+
return e === "change" ? () => {
|
|
1614
|
+
i(), V.read(() => {
|
|
1615
|
+
this.events.change.getSize() || this.stop();
|
|
1616
|
+
});
|
|
1617
|
+
} : i;
|
|
1618
|
+
}
|
|
1619
|
+
clearListeners() {
|
|
1620
|
+
for (const e in this.events)
|
|
1621
|
+
this.events[e].clear();
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Attaches a passive effect to the `MotionValue`.
|
|
1625
|
+
*/
|
|
1626
|
+
attach(e, n) {
|
|
1627
|
+
this.passiveEffect = e, this.stopPassiveEffect = n;
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Sets the state of the `MotionValue`.
|
|
1631
|
+
*
|
|
1632
|
+
* @remarks
|
|
1633
|
+
*
|
|
1634
|
+
* ```jsx
|
|
1635
|
+
* const x = useMotionValue(0)
|
|
1636
|
+
* x.set(10)
|
|
1637
|
+
* ```
|
|
1638
|
+
*
|
|
1639
|
+
* @param latest - Latest value to set.
|
|
1640
|
+
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
1641
|
+
*
|
|
1642
|
+
* @public
|
|
1643
|
+
*/
|
|
1644
|
+
set(e) {
|
|
1645
|
+
this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
|
|
1646
|
+
}
|
|
1647
|
+
setWithVelocity(e, n, i) {
|
|
1648
|
+
this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - i;
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Set the state of the `MotionValue`, stopping any active animations,
|
|
1652
|
+
* effects, and resets velocity to `0`.
|
|
1653
|
+
*/
|
|
1654
|
+
jump(e, n = !0) {
|
|
1655
|
+
this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1656
|
+
}
|
|
1657
|
+
dirty() {
|
|
1658
|
+
this.events.change?.notify(this.current);
|
|
1659
|
+
}
|
|
1660
|
+
addDependent(e) {
|
|
1661
|
+
this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(e);
|
|
1662
|
+
}
|
|
1663
|
+
removeDependent(e) {
|
|
1664
|
+
this.dependents && this.dependents.delete(e);
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Returns the latest state of `MotionValue`
|
|
1668
|
+
*
|
|
1669
|
+
* @returns - The latest state of `MotionValue`
|
|
1670
|
+
*
|
|
1671
|
+
* @public
|
|
1672
|
+
*/
|
|
1673
|
+
get() {
|
|
1674
|
+
return this.current;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* @public
|
|
1678
|
+
*/
|
|
1679
|
+
getPrevious() {
|
|
1680
|
+
return this.prev;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Returns the latest velocity of `MotionValue`
|
|
1684
|
+
*
|
|
1685
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
1686
|
+
*
|
|
1687
|
+
* @public
|
|
1688
|
+
*/
|
|
1689
|
+
getVelocity() {
|
|
1690
|
+
const e = j.now();
|
|
1691
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > Gn)
|
|
1692
|
+
return 0;
|
|
1693
|
+
const n = Math.min(this.updatedAt - this.prevUpdatedAt, Gn);
|
|
1694
|
+
return Qi(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* Registers a new animation to control this `MotionValue`. Only one
|
|
1698
|
+
* animation can drive a `MotionValue` at one time.
|
|
1699
|
+
*
|
|
1700
|
+
* ```jsx
|
|
1701
|
+
* value.start()
|
|
1702
|
+
* ```
|
|
1703
|
+
*
|
|
1704
|
+
* @param animation - A function that starts the provided animation
|
|
1705
|
+
*/
|
|
1706
|
+
start(e) {
|
|
1707
|
+
return this.stop(), new Promise((n) => {
|
|
1708
|
+
this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
|
|
1709
|
+
}).then(() => {
|
|
1710
|
+
this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Stop the currently active animation.
|
|
1715
|
+
*
|
|
1716
|
+
* @public
|
|
1717
|
+
*/
|
|
1718
|
+
stop() {
|
|
1719
|
+
this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
|
|
1720
|
+
}
|
|
1721
|
+
/**
|
|
1722
|
+
* Returns `true` if this value is currently animating.
|
|
1723
|
+
*
|
|
1724
|
+
* @public
|
|
1725
|
+
*/
|
|
1726
|
+
isAnimating() {
|
|
1727
|
+
return !!this.animation;
|
|
1728
|
+
}
|
|
1729
|
+
clearAnimation() {
|
|
1730
|
+
delete this.animation;
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
1734
|
+
*
|
|
1735
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
1736
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
1737
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
1738
|
+
*
|
|
1739
|
+
* @public
|
|
1740
|
+
*/
|
|
1741
|
+
destroy() {
|
|
1742
|
+
this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
function xt(t, e) {
|
|
1746
|
+
return new Aa(t, e);
|
|
1747
|
+
}
|
|
1748
|
+
const { schedule: pn } = /* @__PURE__ */ us(queueMicrotask, !1), z = {
|
|
1749
|
+
x: !1,
|
|
1750
|
+
y: !1
|
|
1751
|
+
};
|
|
1752
|
+
function Is() {
|
|
1753
|
+
return z.x || z.y;
|
|
1754
|
+
}
|
|
1755
|
+
function Va(t) {
|
|
1756
|
+
return t === "x" || t === "y" ? z[t] ? null : (z[t] = !0, () => {
|
|
1757
|
+
z[t] = !1;
|
|
1758
|
+
}) : z.x || z.y ? null : (z.x = z.y = !0, () => {
|
|
1759
|
+
z.x = z.y = !1;
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
function Os(t, e) {
|
|
1763
|
+
const n = ba(t), i = new AbortController(), s = {
|
|
1764
|
+
passive: !0,
|
|
1765
|
+
...e,
|
|
1766
|
+
signal: i.signal
|
|
1767
|
+
};
|
|
1768
|
+
return [n, s, () => i.abort()];
|
|
1769
|
+
}
|
|
1770
|
+
function Xn(t) {
|
|
1771
|
+
return !(t.pointerType === "touch" || Is());
|
|
1772
|
+
}
|
|
1773
|
+
function Ca(t, e, n = {}) {
|
|
1774
|
+
const [i, s, o] = Os(t, n), r = (a) => {
|
|
1775
|
+
if (!Xn(a))
|
|
1776
|
+
return;
|
|
1777
|
+
const { target: l } = a, u = e(l, a);
|
|
1778
|
+
if (typeof u != "function" || !l)
|
|
1779
|
+
return;
|
|
1780
|
+
const c = (h) => {
|
|
1781
|
+
Xn(h) && (u(h), l.removeEventListener("pointerleave", c));
|
|
1782
|
+
};
|
|
1783
|
+
l.addEventListener("pointerleave", c, s);
|
|
1784
|
+
};
|
|
1785
|
+
return i.forEach((a) => {
|
|
1786
|
+
a.addEventListener("pointerenter", r, s);
|
|
1787
|
+
}), o;
|
|
1788
|
+
}
|
|
1789
|
+
const js = (t, e) => e ? t === e ? !0 : js(t, e.parentElement) : !1, gn = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Da = /* @__PURE__ */ new Set([
|
|
1790
|
+
"BUTTON",
|
|
1791
|
+
"INPUT",
|
|
1792
|
+
"SELECT",
|
|
1793
|
+
"TEXTAREA",
|
|
1794
|
+
"A"
|
|
1795
|
+
]);
|
|
1796
|
+
function Ma(t) {
|
|
1797
|
+
return Da.has(t.tagName) || t.tabIndex !== -1;
|
|
1798
|
+
}
|
|
1799
|
+
const Gt = /* @__PURE__ */ new WeakSet();
|
|
1800
|
+
function Yn(t) {
|
|
1801
|
+
return (e) => {
|
|
1802
|
+
e.key === "Enter" && t(e);
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
function fe(t, e) {
|
|
1806
|
+
t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
|
|
1807
|
+
}
|
|
1808
|
+
const Ea = (t, e) => {
|
|
1809
|
+
const n = t.currentTarget;
|
|
1810
|
+
if (!n)
|
|
1811
|
+
return;
|
|
1812
|
+
const i = Yn(() => {
|
|
1813
|
+
if (Gt.has(n))
|
|
1814
|
+
return;
|
|
1815
|
+
fe(n, "down");
|
|
1816
|
+
const s = Yn(() => {
|
|
1817
|
+
fe(n, "up");
|
|
1818
|
+
}), o = () => fe(n, "cancel");
|
|
1819
|
+
n.addEventListener("keyup", s, e), n.addEventListener("blur", o, e);
|
|
1820
|
+
});
|
|
1821
|
+
n.addEventListener("keydown", i, e), n.addEventListener("blur", () => n.removeEventListener("keydown", i), e);
|
|
1822
|
+
};
|
|
1823
|
+
function qn(t) {
|
|
1824
|
+
return gn(t) && !Is();
|
|
1825
|
+
}
|
|
1826
|
+
function Ra(t, e, n = {}) {
|
|
1827
|
+
const [i, s, o] = Os(t, n), r = (a) => {
|
|
1828
|
+
const l = a.currentTarget;
|
|
1829
|
+
if (!qn(a))
|
|
1830
|
+
return;
|
|
1831
|
+
Gt.add(l);
|
|
1832
|
+
const u = e(l, a), c = (d, m) => {
|
|
1833
|
+
window.removeEventListener("pointerup", h), window.removeEventListener("pointercancel", f), Gt.has(l) && Gt.delete(l), qn(d) && typeof u == "function" && u(d, { success: m });
|
|
1834
|
+
}, h = (d) => {
|
|
1835
|
+
c(d, l === window || l === document || n.useGlobalTarget || js(l, d.target));
|
|
1836
|
+
}, f = (d) => {
|
|
1837
|
+
c(d, !1);
|
|
1838
|
+
};
|
|
1839
|
+
window.addEventListener("pointerup", h, s), window.addEventListener("pointercancel", f, s);
|
|
1840
|
+
};
|
|
1841
|
+
return i.forEach((a) => {
|
|
1842
|
+
(n.useGlobalTarget ? window : a).addEventListener("pointerdown", r, s), Bs(a) && (a.addEventListener("focus", (u) => Ea(u, s)), !Ma(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
|
|
1843
|
+
}), o;
|
|
1844
|
+
}
|
|
1845
|
+
function Ns(t) {
|
|
1846
|
+
return Zi(t) && "ownerSVGElement" in t;
|
|
1847
|
+
}
|
|
1848
|
+
function La(t) {
|
|
1849
|
+
return Ns(t) && t.tagName === "svg";
|
|
1850
|
+
}
|
|
1851
|
+
const I = (t) => !!(t && t.getVelocity), ka = [...Rs, R, nt], Fa = (t) => ka.find(Es(t)), yn = Pt({
|
|
1852
|
+
transformPagePoint: (t) => t,
|
|
1853
|
+
isStatic: !1,
|
|
1854
|
+
reducedMotion: "never"
|
|
1855
|
+
});
|
|
1856
|
+
function Zn(t, e) {
|
|
1857
|
+
if (typeof t == "function")
|
|
1858
|
+
return t(e);
|
|
1859
|
+
t != null && (t.current = e);
|
|
1860
|
+
}
|
|
1861
|
+
function Ba(...t) {
|
|
1862
|
+
return (e) => {
|
|
1863
|
+
let n = !1;
|
|
1864
|
+
const i = t.map((s) => {
|
|
1865
|
+
const o = Zn(s, e);
|
|
1866
|
+
return !n && typeof o == "function" && (n = !0), o;
|
|
1867
|
+
});
|
|
1868
|
+
if (n)
|
|
1869
|
+
return () => {
|
|
1870
|
+
for (let s = 0; s < i.length; s++) {
|
|
1871
|
+
const o = i[s];
|
|
1872
|
+
typeof o == "function" ? o() : Zn(t[s], null);
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
function Ia(...t) {
|
|
1878
|
+
return ne.useCallback(Ba(...t), t);
|
|
1879
|
+
}
|
|
1880
|
+
class Oa extends ne.Component {
|
|
1881
|
+
getSnapshotBeforeUpdate(e) {
|
|
1882
|
+
const n = this.props.childRef.current;
|
|
1883
|
+
if (n && e.isPresent && !this.props.isPresent) {
|
|
1884
|
+
const i = n.offsetParent, s = Bs(i) && i.offsetWidth || 0, o = this.props.sizeRef.current;
|
|
1885
|
+
o.height = n.offsetHeight || 0, o.width = n.offsetWidth || 0, o.top = n.offsetTop, o.left = n.offsetLeft, o.right = s - o.width - o.left;
|
|
1886
|
+
}
|
|
1887
|
+
return null;
|
|
1888
|
+
}
|
|
1889
|
+
/**
|
|
1890
|
+
* Required with getSnapshotBeforeUpdate to stop React complaining.
|
|
1891
|
+
*/
|
|
1892
|
+
componentDidUpdate() {
|
|
1893
|
+
}
|
|
1894
|
+
render() {
|
|
1895
|
+
return this.props.children;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
function ja({ children: t, isPresent: e, anchorX: n, root: i }) {
|
|
1899
|
+
const s = He(), o = _(null), r = _({
|
|
1900
|
+
width: 0,
|
|
1901
|
+
height: 0,
|
|
1902
|
+
top: 0,
|
|
1903
|
+
left: 0,
|
|
1904
|
+
right: 0
|
|
1905
|
+
}), { nonce: a } = B(yn), l = Ia(o, t?.ref);
|
|
1906
|
+
return _i(() => {
|
|
1907
|
+
const { width: u, height: c, top: h, left: f, right: d } = r.current;
|
|
1908
|
+
if (e || !o.current || !u || !c)
|
|
1909
|
+
return;
|
|
1910
|
+
const m = n === "left" ? `left: ${f}` : `right: ${d}`;
|
|
1911
|
+
o.current.dataset.motionPopId = s;
|
|
1912
|
+
const g = document.createElement("style");
|
|
1913
|
+
a && (g.nonce = a);
|
|
1914
|
+
const T = i ?? document.head;
|
|
1915
|
+
return T.appendChild(g), g.sheet && g.sheet.insertRule(`
|
|
1916
|
+
[data-motion-pop-id="${s}"] {
|
|
1917
|
+
position: absolute !important;
|
|
1918
|
+
width: ${u}px !important;
|
|
1919
|
+
height: ${c}px !important;
|
|
1920
|
+
${m}px !important;
|
|
1921
|
+
top: ${h}px !important;
|
|
1922
|
+
}
|
|
1923
|
+
`), () => {
|
|
1924
|
+
T.contains(g) && T.removeChild(g);
|
|
1925
|
+
};
|
|
1926
|
+
}, [e]), ht(Oa, { isPresent: e, childRef: o, sizeRef: r, children: ne.cloneElement(t, { ref: l }) });
|
|
1927
|
+
}
|
|
1928
|
+
const Na = ({ children: t, initial: e, isPresent: n, onExitComplete: i, custom: s, presenceAffectsLayout: o, mode: r, anchorX: a, root: l }) => {
|
|
1929
|
+
const u = Ge(Ua), c = He();
|
|
1930
|
+
let h = !0, f = tt(() => (h = !1, {
|
|
1931
|
+
id: c,
|
|
1932
|
+
initial: e,
|
|
1933
|
+
isPresent: n,
|
|
1934
|
+
custom: s,
|
|
1935
|
+
onExitComplete: (d) => {
|
|
1936
|
+
u.set(d, !0);
|
|
1937
|
+
for (const m of u.values())
|
|
1938
|
+
if (!m)
|
|
1939
|
+
return;
|
|
1940
|
+
i && i();
|
|
1941
|
+
},
|
|
1942
|
+
register: (d) => (u.set(d, !1), () => u.delete(d))
|
|
1943
|
+
}), [n, u, i]);
|
|
1944
|
+
return o && h && (f = { ...f }), tt(() => {
|
|
1945
|
+
u.forEach((d, m) => u.set(m, !1));
|
|
1946
|
+
}, [n]), ne.useEffect(() => {
|
|
1947
|
+
!n && !u.size && i && i();
|
|
1948
|
+
}, [n]), r === "popLayout" && (t = ht(ja, { isPresent: n, anchorX: a, root: l, children: t })), ht(ie.Provider, { value: f, children: t });
|
|
1949
|
+
};
|
|
1950
|
+
function Ua() {
|
|
1951
|
+
return /* @__PURE__ */ new Map();
|
|
1952
|
+
}
|
|
1953
|
+
function Us(t = !0) {
|
|
1954
|
+
const e = B(ie);
|
|
1955
|
+
if (e === null)
|
|
1956
|
+
return [!0, null];
|
|
1957
|
+
const { isPresent: n, onExitComplete: i, register: s } = e, o = He();
|
|
1958
|
+
Q(() => {
|
|
1959
|
+
if (t)
|
|
1960
|
+
return s(o);
|
|
1961
|
+
}, [t]);
|
|
1962
|
+
const r = Gi(() => t && i && i(o), [o, i, t]);
|
|
1963
|
+
return !n && i ? [!1, r] : [!0];
|
|
1964
|
+
}
|
|
1965
|
+
const zt = (t) => t.key || "";
|
|
1966
|
+
function Jn(t) {
|
|
1967
|
+
const e = [];
|
|
1968
|
+
return kr.forEach(t, (n) => {
|
|
1969
|
+
Fr(n) && e.push(n);
|
|
1970
|
+
}), e;
|
|
1971
|
+
}
|
|
1972
|
+
const Vu = ({ children: t, custom: e, initial: n = !0, onExitComplete: i, presenceAffectsLayout: s = !0, mode: o = "sync", propagate: r = !1, anchorX: a = "left", root: l }) => {
|
|
1973
|
+
const [u, c] = Us(r), h = tt(() => Jn(t), [t]), f = r && !u ? [] : h.map(zt), d = _(!0), m = _(h), g = Ge(() => /* @__PURE__ */ new Map()), [T, p] = Pe(h), [v, y] = Pe(h);
|
|
1974
|
+
Yi(() => {
|
|
1975
|
+
d.current = !1, m.current = h;
|
|
1976
|
+
for (let S = 0; S < v.length; S++) {
|
|
1977
|
+
const A = zt(v[S]);
|
|
1978
|
+
f.includes(A) ? g.delete(A) : g.get(A) !== !0 && g.set(A, !1);
|
|
1979
|
+
}
|
|
1980
|
+
}, [v, f.length, f.join("-")]);
|
|
1981
|
+
const b = [];
|
|
1982
|
+
if (h !== T) {
|
|
1983
|
+
let S = [...h];
|
|
1984
|
+
for (let A = 0; A < v.length; A++) {
|
|
1985
|
+
const P = v[A], E = zt(P);
|
|
1986
|
+
f.includes(E) || (S.splice(A, 0, P), b.push(P));
|
|
1987
|
+
}
|
|
1988
|
+
return o === "wait" && b.length && (S = b), y(Jn(S)), p(h), null;
|
|
1989
|
+
}
|
|
1990
|
+
process.env.NODE_ENV !== "production" && o === "wait" && v.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
1991
|
+
const { forceRender: x } = B(_e);
|
|
1992
|
+
return ht(Er, { children: v.map((S) => {
|
|
1993
|
+
const A = zt(S), P = r && !u ? !1 : h === v || f.includes(A), E = () => {
|
|
1994
|
+
if (g.has(A))
|
|
1995
|
+
g.set(A, !0);
|
|
1996
|
+
else
|
|
1997
|
+
return;
|
|
1998
|
+
let M = !0;
|
|
1999
|
+
g.forEach((Z) => {
|
|
2000
|
+
Z || (M = !1);
|
|
2001
|
+
}), M && (x?.(), y(m.current), r && c?.(), i && i());
|
|
2002
|
+
};
|
|
2003
|
+
return ht(Na, { isPresent: P, initial: !d.current || n ? void 0 : !1, custom: e, presenceAffectsLayout: s, mode: o, root: l, onExitComplete: P ? void 0 : E, anchorX: a, children: S }, A);
|
|
2004
|
+
}) });
|
|
2005
|
+
}, Ws = Pt({ strict: !1 }), Qn = {
|
|
2006
|
+
animation: [
|
|
2007
|
+
"animate",
|
|
2008
|
+
"variants",
|
|
2009
|
+
"whileHover",
|
|
2010
|
+
"whileTap",
|
|
2011
|
+
"exit",
|
|
2012
|
+
"whileInView",
|
|
2013
|
+
"whileFocus",
|
|
2014
|
+
"whileDrag"
|
|
2015
|
+
],
|
|
2016
|
+
exit: ["exit"],
|
|
2017
|
+
drag: ["drag", "dragControls"],
|
|
2018
|
+
focus: ["whileFocus"],
|
|
2019
|
+
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
|
|
2020
|
+
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
|
|
2021
|
+
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
|
|
2022
|
+
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
|
|
2023
|
+
layout: ["layout", "layoutId"]
|
|
2024
|
+
}, wt = {};
|
|
2025
|
+
for (const t in Qn)
|
|
2026
|
+
wt[t] = {
|
|
2027
|
+
isEnabled: (e) => Qn[t].some((n) => !!e[n])
|
|
2028
|
+
};
|
|
2029
|
+
function Wa(t) {
|
|
2030
|
+
for (const e in t)
|
|
2031
|
+
wt[e] = {
|
|
2032
|
+
...wt[e],
|
|
2033
|
+
...t[e]
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
const $a = /* @__PURE__ */ new Set([
|
|
2037
|
+
"animate",
|
|
2038
|
+
"exit",
|
|
2039
|
+
"variants",
|
|
2040
|
+
"initial",
|
|
2041
|
+
"style",
|
|
2042
|
+
"values",
|
|
2043
|
+
"variants",
|
|
2044
|
+
"transition",
|
|
2045
|
+
"transformTemplate",
|
|
2046
|
+
"custom",
|
|
2047
|
+
"inherit",
|
|
2048
|
+
"onBeforeLayoutMeasure",
|
|
2049
|
+
"onAnimationStart",
|
|
2050
|
+
"onAnimationComplete",
|
|
2051
|
+
"onUpdate",
|
|
2052
|
+
"onDragStart",
|
|
2053
|
+
"onDrag",
|
|
2054
|
+
"onDragEnd",
|
|
2055
|
+
"onMeasureDragConstraints",
|
|
2056
|
+
"onDirectionLock",
|
|
2057
|
+
"onDragTransitionEnd",
|
|
2058
|
+
"_dragX",
|
|
2059
|
+
"_dragY",
|
|
2060
|
+
"onHoverStart",
|
|
2061
|
+
"onHoverEnd",
|
|
2062
|
+
"onViewportEnter",
|
|
2063
|
+
"onViewportLeave",
|
|
2064
|
+
"globalTapTarget",
|
|
2065
|
+
"ignoreStrict",
|
|
2066
|
+
"viewport"
|
|
2067
|
+
]);
|
|
2068
|
+
function Qt(t) {
|
|
2069
|
+
return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || $a.has(t);
|
|
2070
|
+
}
|
|
2071
|
+
let $s = (t) => !Qt(t);
|
|
2072
|
+
function Ka(t) {
|
|
2073
|
+
typeof t == "function" && ($s = (e) => e.startsWith("on") ? !Qt(e) : t(e));
|
|
2074
|
+
}
|
|
2075
|
+
try {
|
|
2076
|
+
Ka(require("@emotion/is-prop-valid").default);
|
|
2077
|
+
} catch {
|
|
2078
|
+
}
|
|
2079
|
+
function za(t, e, n) {
|
|
2080
|
+
const i = {};
|
|
2081
|
+
for (const s in t)
|
|
2082
|
+
s === "values" && typeof t.values == "object" || ($s(s) || n === !0 && Qt(s) || !e && !Qt(s) || // If trying to use native HTML drag events, forward drag listeners
|
|
2083
|
+
t.draggable && s.startsWith("onDrag")) && (i[s] = t[s]);
|
|
2084
|
+
return i;
|
|
2085
|
+
}
|
|
2086
|
+
const se = /* @__PURE__ */ Pt({});
|
|
2087
|
+
function re(t) {
|
|
2088
|
+
return t !== null && typeof t == "object" && typeof t.start == "function";
|
|
2089
|
+
}
|
|
2090
|
+
function Bt(t) {
|
|
2091
|
+
return typeof t == "string" || Array.isArray(t);
|
|
2092
|
+
}
|
|
2093
|
+
const vn = [
|
|
2094
|
+
"animate",
|
|
2095
|
+
"whileInView",
|
|
2096
|
+
"whileFocus",
|
|
2097
|
+
"whileHover",
|
|
2098
|
+
"whileTap",
|
|
2099
|
+
"whileDrag",
|
|
2100
|
+
"exit"
|
|
2101
|
+
], Tn = ["initial", ...vn];
|
|
2102
|
+
function oe(t) {
|
|
2103
|
+
return re(t.animate) || Tn.some((e) => Bt(t[e]));
|
|
2104
|
+
}
|
|
2105
|
+
function Ks(t) {
|
|
2106
|
+
return !!(oe(t) || t.variants);
|
|
2107
|
+
}
|
|
2108
|
+
function Ha(t, e) {
|
|
2109
|
+
if (oe(t)) {
|
|
2110
|
+
const { initial: n, animate: i } = t;
|
|
2111
|
+
return {
|
|
2112
|
+
initial: n === !1 || Bt(n) ? n : void 0,
|
|
2113
|
+
animate: Bt(i) ? i : void 0
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
return t.inherit !== !1 ? e : {};
|
|
2117
|
+
}
|
|
2118
|
+
function _a(t) {
|
|
2119
|
+
const { initial: e, animate: n } = Ha(t, B(se));
|
|
2120
|
+
return tt(() => ({ initial: e, animate: n }), [ti(e), ti(n)]);
|
|
2121
|
+
}
|
|
2122
|
+
function ti(t) {
|
|
2123
|
+
return Array.isArray(t) ? t.join(" ") : t;
|
|
2124
|
+
}
|
|
2125
|
+
const It = {};
|
|
2126
|
+
function Ga(t) {
|
|
2127
|
+
for (const e in t)
|
|
2128
|
+
It[e] = t[e], nn(e) && (It[e].isCSSVariable = !0);
|
|
2129
|
+
}
|
|
2130
|
+
function zs(t, { layout: e, layoutId: n }) {
|
|
2131
|
+
return Vt.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!It[t] || t === "opacity");
|
|
2132
|
+
}
|
|
2133
|
+
const Xa = {
|
|
2134
|
+
x: "translateX",
|
|
2135
|
+
y: "translateY",
|
|
2136
|
+
z: "translateZ",
|
|
2137
|
+
transformPerspective: "perspective"
|
|
2138
|
+
}, Ya = At.length;
|
|
2139
|
+
function qa(t, e, n) {
|
|
2140
|
+
let i = "", s = !0;
|
|
2141
|
+
for (let o = 0; o < Ya; o++) {
|
|
2142
|
+
const r = At[o], a = t[r];
|
|
2143
|
+
if (a === void 0)
|
|
2144
|
+
continue;
|
|
2145
|
+
let l = !0;
|
|
2146
|
+
if (typeof a == "number" ? l = a === (r.startsWith("scale") ? 1 : 0) : l = parseFloat(a) === 0, !l || n) {
|
|
2147
|
+
const u = Fs(a, mn[r]);
|
|
2148
|
+
if (!l) {
|
|
2149
|
+
s = !1;
|
|
2150
|
+
const c = Xa[r] || r;
|
|
2151
|
+
i += `${c}(${u}) `;
|
|
2152
|
+
}
|
|
2153
|
+
n && (e[r] = u);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
return i = i.trim(), n ? i = n(e, s ? "" : i) : s && (i = "none"), i;
|
|
2157
|
+
}
|
|
2158
|
+
function xn(t, e, n) {
|
|
2159
|
+
const { style: i, vars: s, transformOrigin: o } = t;
|
|
2160
|
+
let r = !1, a = !1;
|
|
2161
|
+
for (const l in e) {
|
|
2162
|
+
const u = e[l];
|
|
2163
|
+
if (Vt.has(l)) {
|
|
2164
|
+
r = !0;
|
|
2165
|
+
continue;
|
|
2166
|
+
} else if (nn(l)) {
|
|
2167
|
+
s[l] = u;
|
|
2168
|
+
continue;
|
|
2169
|
+
} else {
|
|
2170
|
+
const c = Fs(u, mn[l]);
|
|
2171
|
+
l.startsWith("origin") ? (a = !0, o[l] = c) : i[l] = c;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
if (e.transform || (r || n ? i.transform = qa(e, t.transform, n) : i.transform && (i.transform = "none")), a) {
|
|
2175
|
+
const { originX: l = "50%", originY: u = "50%", originZ: c = 0 } = o;
|
|
2176
|
+
i.transformOrigin = `${l} ${u} ${c}`;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
const wn = () => ({
|
|
2180
|
+
style: {},
|
|
2181
|
+
transform: {},
|
|
2182
|
+
transformOrigin: {},
|
|
2183
|
+
vars: {}
|
|
2184
|
+
});
|
|
2185
|
+
function Hs(t, e, n) {
|
|
2186
|
+
for (const i in e)
|
|
2187
|
+
!I(e[i]) && !zs(i, n) && (t[i] = e[i]);
|
|
2188
|
+
}
|
|
2189
|
+
function Za({ transformTemplate: t }, e) {
|
|
2190
|
+
return tt(() => {
|
|
2191
|
+
const n = wn();
|
|
2192
|
+
return xn(n, e, t), Object.assign({}, n.vars, n.style);
|
|
2193
|
+
}, [e]);
|
|
2194
|
+
}
|
|
2195
|
+
function Ja(t, e) {
|
|
2196
|
+
const n = t.style || {}, i = {};
|
|
2197
|
+
return Hs(i, n, t), Object.assign(i, Za(t, e)), i;
|
|
2198
|
+
}
|
|
2199
|
+
function Qa(t, e) {
|
|
2200
|
+
const n = {}, i = Ja(t, e);
|
|
2201
|
+
return t.drag && t.dragListener !== !1 && (n.draggable = !1, i.userSelect = i.WebkitUserSelect = i.WebkitTouchCallout = "none", i.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = i, n;
|
|
2202
|
+
}
|
|
2203
|
+
const tl = {
|
|
2204
|
+
offset: "stroke-dashoffset",
|
|
2205
|
+
array: "stroke-dasharray"
|
|
2206
|
+
}, el = {
|
|
2207
|
+
offset: "strokeDashoffset",
|
|
2208
|
+
array: "strokeDasharray"
|
|
2209
|
+
};
|
|
2210
|
+
function nl(t, e, n = 1, i = 0, s = !0) {
|
|
2211
|
+
t.pathLength = 1;
|
|
2212
|
+
const o = s ? tl : el;
|
|
2213
|
+
t[o.offset] = w.transform(-i);
|
|
2214
|
+
const r = w.transform(e), a = w.transform(n);
|
|
2215
|
+
t[o.array] = `${r} ${a}`;
|
|
2216
|
+
}
|
|
2217
|
+
function _s(t, {
|
|
2218
|
+
attrX: e,
|
|
2219
|
+
attrY: n,
|
|
2220
|
+
attrScale: i,
|
|
2221
|
+
pathLength: s,
|
|
2222
|
+
pathSpacing: o = 1,
|
|
2223
|
+
pathOffset: r = 0,
|
|
2224
|
+
// This is object creation, which we try to avoid per-frame.
|
|
2225
|
+
...a
|
|
2226
|
+
}, l, u, c) {
|
|
2227
|
+
if (xn(t, a, u), l) {
|
|
2228
|
+
t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
t.attrs = t.style, t.style = {};
|
|
2232
|
+
const { attrs: h, style: f } = t;
|
|
2233
|
+
h.transform && (f.transform = h.transform, delete h.transform), (f.transform || h.transformOrigin) && (f.transformOrigin = h.transformOrigin ?? "50% 50%", delete h.transformOrigin), f.transform && (f.transformBox = c?.transformBox ?? "fill-box", delete h.transformBox), e !== void 0 && (h.x = e), n !== void 0 && (h.y = n), i !== void 0 && (h.scale = i), s !== void 0 && nl(h, s, o, r, !1);
|
|
2234
|
+
}
|
|
2235
|
+
const Gs = () => ({
|
|
2236
|
+
...wn(),
|
|
2237
|
+
attrs: {}
|
|
2238
|
+
}), Xs = (t) => typeof t == "string" && t.toLowerCase() === "svg";
|
|
2239
|
+
function il(t, e, n, i) {
|
|
2240
|
+
const s = tt(() => {
|
|
2241
|
+
const o = Gs();
|
|
2242
|
+
return _s(o, e, Xs(i), t.transformTemplate, t.style), {
|
|
2243
|
+
...o.attrs,
|
|
2244
|
+
style: { ...o.style }
|
|
2245
|
+
};
|
|
2246
|
+
}, [e]);
|
|
2247
|
+
if (t.style) {
|
|
2248
|
+
const o = {};
|
|
2249
|
+
Hs(o, t.style, t), s.style = { ...o, ...s.style };
|
|
2250
|
+
}
|
|
2251
|
+
return s;
|
|
2252
|
+
}
|
|
2253
|
+
const sl = [
|
|
2254
|
+
"animate",
|
|
2255
|
+
"circle",
|
|
2256
|
+
"defs",
|
|
2257
|
+
"desc",
|
|
2258
|
+
"ellipse",
|
|
2259
|
+
"g",
|
|
2260
|
+
"image",
|
|
2261
|
+
"line",
|
|
2262
|
+
"filter",
|
|
2263
|
+
"marker",
|
|
2264
|
+
"mask",
|
|
2265
|
+
"metadata",
|
|
2266
|
+
"path",
|
|
2267
|
+
"pattern",
|
|
2268
|
+
"polygon",
|
|
2269
|
+
"polyline",
|
|
2270
|
+
"rect",
|
|
2271
|
+
"stop",
|
|
2272
|
+
"switch",
|
|
2273
|
+
"symbol",
|
|
2274
|
+
"svg",
|
|
2275
|
+
"text",
|
|
2276
|
+
"tspan",
|
|
2277
|
+
"use",
|
|
2278
|
+
"view"
|
|
2279
|
+
];
|
|
2280
|
+
function Pn(t) {
|
|
2281
|
+
return (
|
|
2282
|
+
/**
|
|
2283
|
+
* If it's not a string, it's a custom React component. Currently we only support
|
|
2284
|
+
* HTML custom React components.
|
|
2285
|
+
*/
|
|
2286
|
+
typeof t != "string" || /**
|
|
2287
|
+
* If it contains a dash, the element is a custom HTML webcomponent.
|
|
2288
|
+
*/
|
|
2289
|
+
t.includes("-") ? !1 : (
|
|
2290
|
+
/**
|
|
2291
|
+
* If it's in our list of lowercase SVG tags, it's an SVG component
|
|
2292
|
+
*/
|
|
2293
|
+
!!(sl.indexOf(t) > -1 || /**
|
|
2294
|
+
* If it contains a capital letter, it's an SVG component
|
|
2295
|
+
*/
|
|
2296
|
+
/[A-Z]/u.test(t))
|
|
2297
|
+
)
|
|
2298
|
+
);
|
|
2299
|
+
}
|
|
2300
|
+
function rl(t, e, n, { latestValues: i }, s, o = !1) {
|
|
2301
|
+
const a = (Pn(t) ? il : Qa)(e, i, s, t), l = za(e, typeof t == "string", o), u = t !== Xi ? { ...l, ...a, ref: n } : {}, { children: c } = e, h = tt(() => I(c) ? c.get() : c, [c]);
|
|
2302
|
+
return Br(t, {
|
|
2303
|
+
...u,
|
|
2304
|
+
children: h
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
function ei(t) {
|
|
2308
|
+
const e = [{}, {}];
|
|
2309
|
+
return t?.values.forEach((n, i) => {
|
|
2310
|
+
e[0][i] = n.get(), e[1][i] = n.getVelocity();
|
|
2311
|
+
}), e;
|
|
2312
|
+
}
|
|
2313
|
+
function bn(t, e, n, i) {
|
|
2314
|
+
if (typeof e == "function") {
|
|
2315
|
+
const [s, o] = ei(i);
|
|
2316
|
+
e = e(n !== void 0 ? n : t.custom, s, o);
|
|
2317
|
+
}
|
|
2318
|
+
if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
|
|
2319
|
+
const [s, o] = ei(i);
|
|
2320
|
+
e = e(n !== void 0 ? n : t.custom, s, o);
|
|
2321
|
+
}
|
|
2322
|
+
return e;
|
|
2323
|
+
}
|
|
2324
|
+
function Xt(t) {
|
|
2325
|
+
return I(t) ? t.get() : t;
|
|
2326
|
+
}
|
|
2327
|
+
function ol({ scrapeMotionValuesFromProps: t, createRenderState: e }, n, i, s) {
|
|
2328
|
+
return {
|
|
2329
|
+
latestValues: al(n, i, s, t),
|
|
2330
|
+
renderState: e()
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
function al(t, e, n, i) {
|
|
2334
|
+
const s = {}, o = i(t, {});
|
|
2335
|
+
for (const f in o)
|
|
2336
|
+
s[f] = Xt(o[f]);
|
|
2337
|
+
let { initial: r, animate: a } = t;
|
|
2338
|
+
const l = oe(t), u = Ks(t);
|
|
2339
|
+
e && u && !l && t.inherit !== !1 && (r === void 0 && (r = e.initial), a === void 0 && (a = e.animate));
|
|
2340
|
+
let c = n ? n.initial === !1 : !1;
|
|
2341
|
+
c = c || r === !1;
|
|
2342
|
+
const h = c ? a : r;
|
|
2343
|
+
if (h && typeof h != "boolean" && !re(h)) {
|
|
2344
|
+
const f = Array.isArray(h) ? h : [h];
|
|
2345
|
+
for (let d = 0; d < f.length; d++) {
|
|
2346
|
+
const m = bn(t, f[d]);
|
|
2347
|
+
if (m) {
|
|
2348
|
+
const { transitionEnd: g, transition: T, ...p } = m;
|
|
2349
|
+
for (const v in p) {
|
|
2350
|
+
let y = p[v];
|
|
2351
|
+
if (Array.isArray(y)) {
|
|
2352
|
+
const b = c ? y.length - 1 : 0;
|
|
2353
|
+
y = y[b];
|
|
2354
|
+
}
|
|
2355
|
+
y !== null && (s[v] = y);
|
|
2356
|
+
}
|
|
2357
|
+
for (const v in g)
|
|
2358
|
+
s[v] = g[v];
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
return s;
|
|
2363
|
+
}
|
|
2364
|
+
const Ys = (t) => (e, n) => {
|
|
2365
|
+
const i = B(se), s = B(ie), o = () => ol(t, e, i, s);
|
|
2366
|
+
return n ? o() : Ge(o);
|
|
2367
|
+
};
|
|
2368
|
+
function Sn(t, e, n) {
|
|
2369
|
+
const { style: i } = t, s = {};
|
|
2370
|
+
for (const o in i)
|
|
2371
|
+
(I(i[o]) || e.style && I(e.style[o]) || zs(o, t) || n?.getValue(o)?.liveStyle !== void 0) && (s[o] = i[o]);
|
|
2372
|
+
return s;
|
|
2373
|
+
}
|
|
2374
|
+
const ll = /* @__PURE__ */ Ys({
|
|
2375
|
+
scrapeMotionValuesFromProps: Sn,
|
|
2376
|
+
createRenderState: wn
|
|
2377
|
+
});
|
|
2378
|
+
function qs(t, e, n) {
|
|
2379
|
+
const i = Sn(t, e, n);
|
|
2380
|
+
for (const s in t)
|
|
2381
|
+
if (I(t[s]) || I(e[s])) {
|
|
2382
|
+
const o = At.indexOf(s) !== -1 ? "attr" + s.charAt(0).toUpperCase() + s.substring(1) : s;
|
|
2383
|
+
i[o] = t[s];
|
|
2384
|
+
}
|
|
2385
|
+
return i;
|
|
2386
|
+
}
|
|
2387
|
+
const cl = /* @__PURE__ */ Ys({
|
|
2388
|
+
scrapeMotionValuesFromProps: qs,
|
|
2389
|
+
createRenderState: Gs
|
|
2390
|
+
}), ul = Symbol.for("motionComponentSymbol");
|
|
2391
|
+
function pt(t) {
|
|
2392
|
+
return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
|
|
2393
|
+
}
|
|
2394
|
+
function hl(t, e, n) {
|
|
2395
|
+
return Gi(
|
|
2396
|
+
(i) => {
|
|
2397
|
+
i && t.onMount && t.onMount(i), e && (i ? e.mount(i) : e.unmount()), n && (typeof n == "function" ? n(i) : pt(n) && (n.current = i));
|
|
2398
|
+
},
|
|
2399
|
+
/**
|
|
2400
|
+
* Include externalRef in dependencies to ensure the callback updates
|
|
2401
|
+
* when the ref changes, allowing proper ref forwarding.
|
|
2402
|
+
*/
|
|
2403
|
+
[e]
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
const An = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), fl = "framerAppearId", Zs = "data-" + An(fl), Js = Pt({});
|
|
2407
|
+
function dl(t, e, n, i, s) {
|
|
2408
|
+
const { visualElement: o } = B(se), r = B(Ws), a = B(ie), l = B(yn).reducedMotion, u = _(null);
|
|
2409
|
+
i = i || r.renderer, !u.current && i && (u.current = i(t, {
|
|
2410
|
+
visualState: e,
|
|
2411
|
+
parent: o,
|
|
2412
|
+
props: n,
|
|
2413
|
+
presenceContext: a,
|
|
2414
|
+
blockInitialAnimation: a ? a.initial === !1 : !1,
|
|
2415
|
+
reducedMotionConfig: l
|
|
2416
|
+
}));
|
|
2417
|
+
const c = u.current, h = B(Js);
|
|
2418
|
+
c && !c.projection && s && (c.type === "html" || c.type === "svg") && ml(u.current, n, s, h);
|
|
2419
|
+
const f = _(!1);
|
|
2420
|
+
_i(() => {
|
|
2421
|
+
c && f.current && c.update(n, a);
|
|
2422
|
+
});
|
|
2423
|
+
const d = n[Zs], m = _(!!d && !window.MotionHandoffIsComplete?.(d) && window.MotionHasOptimisedAnimation?.(d));
|
|
2424
|
+
return Yi(() => {
|
|
2425
|
+
c && (f.current = !0, window.MotionIsMounted = !0, c.updateFeatures(), c.scheduleRenderMicrotask(), m.current && c.animationState && c.animationState.animateChanges());
|
|
2426
|
+
}), Q(() => {
|
|
2427
|
+
c && (!m.current && c.animationState && c.animationState.animateChanges(), m.current && (queueMicrotask(() => {
|
|
2428
|
+
window.MotionHandoffMarkAsComplete?.(d);
|
|
2429
|
+
}), m.current = !1), c.enteringChildren = void 0);
|
|
2430
|
+
}), c;
|
|
2431
|
+
}
|
|
2432
|
+
function ml(t, e, n, i) {
|
|
2433
|
+
const { layoutId: s, layout: o, drag: r, dragConstraints: a, layoutScroll: l, layoutRoot: u, layoutCrossfade: c } = e;
|
|
2434
|
+
t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : Qs(t.parent)), t.projection.setOptions({
|
|
2435
|
+
layoutId: s,
|
|
2436
|
+
layout: o,
|
|
2437
|
+
alwaysMeasureLayout: !!r || a && pt(a),
|
|
2438
|
+
visualElement: t,
|
|
2439
|
+
/**
|
|
2440
|
+
* TODO: Update options in an effect. This could be tricky as it'll be too late
|
|
2441
|
+
* to update by the time layout animations run.
|
|
2442
|
+
* We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
|
|
2443
|
+
* ensuring it gets called if there's no potential layout animations.
|
|
2444
|
+
*
|
|
2445
|
+
*/
|
|
2446
|
+
animationType: typeof o == "string" ? o : "both",
|
|
2447
|
+
initialPromotionConfig: i,
|
|
2448
|
+
crossfade: c,
|
|
2449
|
+
layoutScroll: l,
|
|
2450
|
+
layoutRoot: u
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
function Qs(t) {
|
|
2454
|
+
if (t)
|
|
2455
|
+
return t.options.allowProjection !== !1 ? t.projection : Qs(t.parent);
|
|
2456
|
+
}
|
|
2457
|
+
function de(t, { forwardMotionProps: e = !1 } = {}, n, i) {
|
|
2458
|
+
n && Wa(n);
|
|
2459
|
+
const s = Pn(t) ? cl : ll;
|
|
2460
|
+
function o(a, l) {
|
|
2461
|
+
let u;
|
|
2462
|
+
const c = {
|
|
2463
|
+
...B(yn),
|
|
2464
|
+
...a,
|
|
2465
|
+
layoutId: pl(a)
|
|
2466
|
+
}, { isStatic: h } = c, f = _a(a), d = s(a, h);
|
|
2467
|
+
if (!h && Xe) {
|
|
2468
|
+
gl(c, n);
|
|
2469
|
+
const m = yl(c);
|
|
2470
|
+
u = m.MeasureLayout, f.visualElement = dl(t, d, c, i, m.ProjectionNode);
|
|
2471
|
+
}
|
|
2472
|
+
return Rr(se.Provider, { value: f, children: [u && f.visualElement ? ht(u, { visualElement: f.visualElement, ...c }) : null, rl(t, a, hl(d, f.visualElement, l), d, h, e)] });
|
|
2473
|
+
}
|
|
2474
|
+
o.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
|
|
2475
|
+
const r = Ir(o);
|
|
2476
|
+
return r[ul] = t, r;
|
|
2477
|
+
}
|
|
2478
|
+
function pl({ layoutId: t }) {
|
|
2479
|
+
const e = B(_e).id;
|
|
2480
|
+
return e && t !== void 0 ? e + "-" + t : t;
|
|
2481
|
+
}
|
|
2482
|
+
function gl(t, e) {
|
|
2483
|
+
const n = B(Ws).strict;
|
|
2484
|
+
if (process.env.NODE_ENV !== "production" && e && n) {
|
|
2485
|
+
const i = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
|
|
2486
|
+
t.ignoreStrict ? bt(!1, i, "lazy-strict-mode") : Y(!1, i, "lazy-strict-mode");
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
function yl(t) {
|
|
2490
|
+
const { drag: e, layout: n } = wt;
|
|
2491
|
+
if (!e && !n)
|
|
2492
|
+
return {};
|
|
2493
|
+
const i = { ...e, ...n };
|
|
2494
|
+
return {
|
|
2495
|
+
MeasureLayout: e?.isEnabled(t) || n?.isEnabled(t) ? i.MeasureLayout : void 0,
|
|
2496
|
+
ProjectionNode: i.ProjectionNode
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
function vl(t, e) {
|
|
2500
|
+
if (typeof Proxy > "u")
|
|
2501
|
+
return de;
|
|
2502
|
+
const n = /* @__PURE__ */ new Map(), i = (o, r) => de(o, r, t, e), s = (o, r) => (process.env.NODE_ENV !== "production" && Qe(!1, "motion() is deprecated. Use motion.create() instead."), i(o, r));
|
|
2503
|
+
return new Proxy(s, {
|
|
2504
|
+
/**
|
|
2505
|
+
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
|
|
2506
|
+
* The prop name is passed through as `key` and we can use that to generate a `motion`
|
|
2507
|
+
* DOM component with that name.
|
|
2508
|
+
*/
|
|
2509
|
+
get: (o, r) => r === "create" ? i : (n.has(r) || n.set(r, de(r, void 0, t, e)), n.get(r))
|
|
2510
|
+
});
|
|
2511
|
+
}
|
|
2512
|
+
function tr({ top: t, left: e, right: n, bottom: i }) {
|
|
2513
|
+
return {
|
|
2514
|
+
x: { min: e, max: n },
|
|
2515
|
+
y: { min: t, max: i }
|
|
2516
|
+
};
|
|
2517
|
+
}
|
|
2518
|
+
function Tl({ x: t, y: e }) {
|
|
2519
|
+
return { top: e.min, right: t.max, bottom: e.max, left: t.min };
|
|
2520
|
+
}
|
|
2521
|
+
function xl(t, e) {
|
|
2522
|
+
if (!e)
|
|
2523
|
+
return t;
|
|
2524
|
+
const n = e({ x: t.left, y: t.top }), i = e({ x: t.right, y: t.bottom });
|
|
2525
|
+
return {
|
|
2526
|
+
top: n.y,
|
|
2527
|
+
left: n.x,
|
|
2528
|
+
bottom: i.y,
|
|
2529
|
+
right: i.x
|
|
2530
|
+
};
|
|
2531
|
+
}
|
|
2532
|
+
function me(t) {
|
|
2533
|
+
return t === void 0 || t === 1;
|
|
2534
|
+
}
|
|
2535
|
+
function Oe({ scale: t, scaleX: e, scaleY: n }) {
|
|
2536
|
+
return !me(t) || !me(e) || !me(n);
|
|
2537
|
+
}
|
|
2538
|
+
function ot(t) {
|
|
2539
|
+
return Oe(t) || er(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY;
|
|
2540
|
+
}
|
|
2541
|
+
function er(t) {
|
|
2542
|
+
return ni(t.x) || ni(t.y);
|
|
2543
|
+
}
|
|
2544
|
+
function ni(t) {
|
|
2545
|
+
return t && t !== "0%";
|
|
2546
|
+
}
|
|
2547
|
+
function te(t, e, n) {
|
|
2548
|
+
const i = t - n, s = e * i;
|
|
2549
|
+
return n + s;
|
|
2550
|
+
}
|
|
2551
|
+
function ii(t, e, n, i, s) {
|
|
2552
|
+
return s !== void 0 && (t = te(t, s, i)), te(t, n, i) + e;
|
|
2553
|
+
}
|
|
2554
|
+
function je(t, e = 0, n = 1, i, s) {
|
|
2555
|
+
t.min = ii(t.min, e, n, i, s), t.max = ii(t.max, e, n, i, s);
|
|
2556
|
+
}
|
|
2557
|
+
function nr(t, { x: e, y: n }) {
|
|
2558
|
+
je(t.x, e.translate, e.scale, e.originPoint), je(t.y, n.translate, n.scale, n.originPoint);
|
|
2559
|
+
}
|
|
2560
|
+
const si = 0.999999999999, ri = 1.0000000000001;
|
|
2561
|
+
function wl(t, e, n, i = !1) {
|
|
2562
|
+
const s = n.length;
|
|
2563
|
+
if (!s)
|
|
2564
|
+
return;
|
|
2565
|
+
e.x = e.y = 1;
|
|
2566
|
+
let o, r;
|
|
2567
|
+
for (let a = 0; a < s; a++) {
|
|
2568
|
+
o = n[a], r = o.projectionDelta;
|
|
2569
|
+
const { visualElement: l } = o.options;
|
|
2570
|
+
l && l.props.style && l.props.style.display === "contents" || (i && o.options.layoutScroll && o.scroll && o !== o.root && yt(t, {
|
|
2571
|
+
x: -o.scroll.offset.x,
|
|
2572
|
+
y: -o.scroll.offset.y
|
|
2573
|
+
}), r && (e.x *= r.x.scale, e.y *= r.y.scale, nr(t, r)), i && ot(o.latestValues) && yt(t, o.latestValues));
|
|
2574
|
+
}
|
|
2575
|
+
e.x < ri && e.x > si && (e.x = 1), e.y < ri && e.y > si && (e.y = 1);
|
|
2576
|
+
}
|
|
2577
|
+
function gt(t, e) {
|
|
2578
|
+
t.min = t.min + e, t.max = t.max + e;
|
|
2579
|
+
}
|
|
2580
|
+
function oi(t, e, n, i, s = 0.5) {
|
|
2581
|
+
const o = D(t.min, t.max, s);
|
|
2582
|
+
je(t, e, n, o, i);
|
|
2583
|
+
}
|
|
2584
|
+
function yt(t, e) {
|
|
2585
|
+
oi(t.x, e.x, e.scaleX, e.scale, e.originX), oi(t.y, e.y, e.scaleY, e.scale, e.originY);
|
|
2586
|
+
}
|
|
2587
|
+
function ir(t, e) {
|
|
2588
|
+
return tr(xl(t.getBoundingClientRect(), e));
|
|
2589
|
+
}
|
|
2590
|
+
function Pl(t, e, n) {
|
|
2591
|
+
const i = ir(t, n), { scroll: s } = e;
|
|
2592
|
+
return s && (gt(i.x, s.offset.x), gt(i.y, s.offset.y)), i;
|
|
2593
|
+
}
|
|
2594
|
+
const ai = () => ({
|
|
2595
|
+
translate: 0,
|
|
2596
|
+
scale: 1,
|
|
2597
|
+
origin: 0,
|
|
2598
|
+
originPoint: 0
|
|
2599
|
+
}), vt = () => ({
|
|
2600
|
+
x: ai(),
|
|
2601
|
+
y: ai()
|
|
2602
|
+
}), li = () => ({ min: 0, max: 0 }), L = () => ({
|
|
2603
|
+
x: li(),
|
|
2604
|
+
y: li()
|
|
2605
|
+
}), Ne = { current: null }, sr = { current: !1 };
|
|
2606
|
+
function bl() {
|
|
2607
|
+
if (sr.current = !0, !!Xe)
|
|
2608
|
+
if (window.matchMedia) {
|
|
2609
|
+
const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Ne.current = t.matches;
|
|
2610
|
+
t.addEventListener("change", e), e();
|
|
2611
|
+
} else
|
|
2612
|
+
Ne.current = !1;
|
|
2613
|
+
}
|
|
2614
|
+
const Sl = /* @__PURE__ */ new WeakMap();
|
|
2615
|
+
function Al(t, e, n) {
|
|
2616
|
+
for (const i in e) {
|
|
2617
|
+
const s = e[i], o = n[i];
|
|
2618
|
+
if (I(s))
|
|
2619
|
+
t.addValue(i, s);
|
|
2620
|
+
else if (I(o))
|
|
2621
|
+
t.addValue(i, xt(s, { owner: t }));
|
|
2622
|
+
else if (o !== s)
|
|
2623
|
+
if (t.hasValue(i)) {
|
|
2624
|
+
const r = t.getValue(i);
|
|
2625
|
+
r.liveStyle === !0 ? r.jump(s) : r.hasAnimated || r.set(s);
|
|
2626
|
+
} else {
|
|
2627
|
+
const r = t.getStaticValue(i);
|
|
2628
|
+
t.addValue(i, xt(r !== void 0 ? r : s, { owner: t }));
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
for (const i in n)
|
|
2632
|
+
e[i] === void 0 && t.removeValue(i);
|
|
2633
|
+
return e;
|
|
2634
|
+
}
|
|
2635
|
+
const ci = [
|
|
2636
|
+
"AnimationStart",
|
|
2637
|
+
"AnimationComplete",
|
|
2638
|
+
"Update",
|
|
2639
|
+
"BeforeLayoutMeasure",
|
|
2640
|
+
"LayoutMeasure",
|
|
2641
|
+
"LayoutAnimationStart",
|
|
2642
|
+
"LayoutAnimationComplete"
|
|
2643
|
+
];
|
|
2644
|
+
class Vl {
|
|
2645
|
+
/**
|
|
2646
|
+
* This method takes React props and returns found MotionValues. For example, HTML
|
|
2647
|
+
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
|
|
2648
|
+
*
|
|
2649
|
+
* This isn't an abstract method as it needs calling in the constructor, but it is
|
|
2650
|
+
* intended to be one.
|
|
2651
|
+
*/
|
|
2652
|
+
scrapeMotionValuesFromProps(e, n, i) {
|
|
2653
|
+
return {};
|
|
2654
|
+
}
|
|
2655
|
+
constructor({ parent: e, props: n, presenceContext: i, reducedMotionConfig: s, blockInitialAnimation: o, visualState: r }, a = {}) {
|
|
2656
|
+
this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = fn, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
|
|
2657
|
+
this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
|
|
2658
|
+
}, this.renderScheduledAt = 0, this.scheduleRender = () => {
|
|
2659
|
+
const f = j.now();
|
|
2660
|
+
this.renderScheduledAt < f && (this.renderScheduledAt = f, V.render(this.render, !1, !0));
|
|
2661
|
+
};
|
|
2662
|
+
const { latestValues: l, renderState: u } = r;
|
|
2663
|
+
this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = u, this.parent = e, this.props = n, this.presenceContext = i, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = s, this.options = a, this.blockInitialAnimation = !!o, this.isControllingVariants = oe(n), this.isVariantNode = Ks(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
|
|
2664
|
+
const { willChange: c, ...h } = this.scrapeMotionValuesFromProps(n, {}, this);
|
|
2665
|
+
for (const f in h) {
|
|
2666
|
+
const d = h[f];
|
|
2667
|
+
l[f] !== void 0 && I(d) && d.set(l[f]);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
mount(e) {
|
|
2671
|
+
this.current = e, Sl.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, i) => this.bindToMotionValue(i, n)), sr.current || bl(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Ne.current, process.env.NODE_ENV !== "production" && Qe(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), this.parent?.addChild(this), this.update(this.props, this.presenceContext);
|
|
2672
|
+
}
|
|
2673
|
+
unmount() {
|
|
2674
|
+
this.projection && this.projection.unmount(), et(this.notifyUpdate), et(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this);
|
|
2675
|
+
for (const e in this.events)
|
|
2676
|
+
this.events[e].clear();
|
|
2677
|
+
for (const e in this.features) {
|
|
2678
|
+
const n = this.features[e];
|
|
2679
|
+
n && (n.unmount(), n.isMounted = !1);
|
|
2680
|
+
}
|
|
2681
|
+
this.current = null;
|
|
2682
|
+
}
|
|
2683
|
+
addChild(e) {
|
|
2684
|
+
this.children.add(e), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(e);
|
|
2685
|
+
}
|
|
2686
|
+
removeChild(e) {
|
|
2687
|
+
this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
|
|
2688
|
+
}
|
|
2689
|
+
bindToMotionValue(e, n) {
|
|
2690
|
+
this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
|
|
2691
|
+
const i = Vt.has(e);
|
|
2692
|
+
i && this.onBindTransform && this.onBindTransform();
|
|
2693
|
+
const s = n.on("change", (r) => {
|
|
2694
|
+
this.latestValues[e] = r, this.props.onUpdate && V.preRender(this.notifyUpdate), i && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
|
|
2695
|
+
});
|
|
2696
|
+
let o;
|
|
2697
|
+
window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
|
|
2698
|
+
s(), o && o(), n.owner && n.stop();
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
sortNodePosition(e) {
|
|
2702
|
+
return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
|
|
2703
|
+
}
|
|
2704
|
+
updateFeatures() {
|
|
2705
|
+
let e = "animation";
|
|
2706
|
+
for (e in wt) {
|
|
2707
|
+
const n = wt[e];
|
|
2708
|
+
if (!n)
|
|
2709
|
+
continue;
|
|
2710
|
+
const { isEnabled: i, Feature: s } = n;
|
|
2711
|
+
if (!this.features[e] && s && i(this.props) && (this.features[e] = new s(this)), this.features[e]) {
|
|
2712
|
+
const o = this.features[e];
|
|
2713
|
+
o.isMounted ? o.update() : (o.mount(), o.isMounted = !0);
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
triggerBuild() {
|
|
2718
|
+
this.build(this.renderState, this.latestValues, this.props);
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* Measure the current viewport box with or without transforms.
|
|
2722
|
+
* Only measures axis-aligned boxes, rotate and skew must be manually
|
|
2723
|
+
* removed with a re-render to work.
|
|
2724
|
+
*/
|
|
2725
|
+
measureViewportBox() {
|
|
2726
|
+
return this.current ? this.measureInstanceViewportBox(this.current, this.props) : L();
|
|
2727
|
+
}
|
|
2728
|
+
getStaticValue(e) {
|
|
2729
|
+
return this.latestValues[e];
|
|
2730
|
+
}
|
|
2731
|
+
setStaticValue(e, n) {
|
|
2732
|
+
this.latestValues[e] = n;
|
|
2733
|
+
}
|
|
2734
|
+
/**
|
|
2735
|
+
* Update the provided props. Ensure any newly-added motion values are
|
|
2736
|
+
* added to our map, old ones removed, and listeners updated.
|
|
2737
|
+
*/
|
|
2738
|
+
update(e, n) {
|
|
2739
|
+
(e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
|
|
2740
|
+
for (let i = 0; i < ci.length; i++) {
|
|
2741
|
+
const s = ci[i];
|
|
2742
|
+
this.propEventSubscriptions[s] && (this.propEventSubscriptions[s](), delete this.propEventSubscriptions[s]);
|
|
2743
|
+
const o = "on" + s, r = e[o];
|
|
2744
|
+
r && (this.propEventSubscriptions[s] = this.on(s, r));
|
|
2745
|
+
}
|
|
2746
|
+
this.prevMotionValues = Al(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
|
|
2747
|
+
}
|
|
2748
|
+
getProps() {
|
|
2749
|
+
return this.props;
|
|
2750
|
+
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Returns the variant definition with a given name.
|
|
2753
|
+
*/
|
|
2754
|
+
getVariant(e) {
|
|
2755
|
+
return this.props.variants ? this.props.variants[e] : void 0;
|
|
2756
|
+
}
|
|
2757
|
+
/**
|
|
2758
|
+
* Returns the defined default transition on this component.
|
|
2759
|
+
*/
|
|
2760
|
+
getDefaultTransition() {
|
|
2761
|
+
return this.props.transition;
|
|
2762
|
+
}
|
|
2763
|
+
getTransformPagePoint() {
|
|
2764
|
+
return this.props.transformPagePoint;
|
|
2765
|
+
}
|
|
2766
|
+
getClosestVariantNode() {
|
|
2767
|
+
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
2768
|
+
}
|
|
2769
|
+
/**
|
|
2770
|
+
* Add a child visual element to our set of children.
|
|
2771
|
+
*/
|
|
2772
|
+
addVariantChild(e) {
|
|
2773
|
+
const n = this.getClosestVariantNode();
|
|
2774
|
+
if (n)
|
|
2775
|
+
return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* Add a motion value and bind it to this visual element.
|
|
2779
|
+
*/
|
|
2780
|
+
addValue(e, n) {
|
|
2781
|
+
const i = this.values.get(e);
|
|
2782
|
+
n !== i && (i && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Remove a motion value and unbind any active subscriptions.
|
|
2786
|
+
*/
|
|
2787
|
+
removeValue(e) {
|
|
2788
|
+
this.values.delete(e);
|
|
2789
|
+
const n = this.valueSubscriptions.get(e);
|
|
2790
|
+
n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Check whether we have a motion value for this key
|
|
2794
|
+
*/
|
|
2795
|
+
hasValue(e) {
|
|
2796
|
+
return this.values.has(e);
|
|
2797
|
+
}
|
|
2798
|
+
getValue(e, n) {
|
|
2799
|
+
if (this.props.values && this.props.values[e])
|
|
2800
|
+
return this.props.values[e];
|
|
2801
|
+
let i = this.values.get(e);
|
|
2802
|
+
return i === void 0 && n !== void 0 && (i = xt(n === null ? void 0 : n, { owner: this }), this.addValue(e, i)), i;
|
|
2803
|
+
}
|
|
2804
|
+
/**
|
|
2805
|
+
* If we're trying to animate to a previously unencountered value,
|
|
2806
|
+
* we need to check for it in our state and as a last resort read it
|
|
2807
|
+
* directly from the instance (which might have performance implications).
|
|
2808
|
+
*/
|
|
2809
|
+
readValue(e, n) {
|
|
2810
|
+
let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
|
|
2811
|
+
return i != null && (typeof i == "string" && (qi(i) || Ji(i)) ? i = parseFloat(i) : !Fa(i) && nt.test(n) && (i = ks(e, n)), this.setBaseTarget(e, I(i) ? i.get() : i)), I(i) ? i.get() : i;
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* Set the base target to later animate back to. This is currently
|
|
2815
|
+
* only hydrated on creation and when we first read a value.
|
|
2816
|
+
*/
|
|
2817
|
+
setBaseTarget(e, n) {
|
|
2818
|
+
this.baseTarget[e] = n;
|
|
2819
|
+
}
|
|
2820
|
+
/**
|
|
2821
|
+
* Find the base target for a value thats been removed from all animation
|
|
2822
|
+
* props.
|
|
2823
|
+
*/
|
|
2824
|
+
getBaseTarget(e) {
|
|
2825
|
+
const { initial: n } = this.props;
|
|
2826
|
+
let i;
|
|
2827
|
+
if (typeof n == "string" || typeof n == "object") {
|
|
2828
|
+
const o = bn(this.props, n, this.presenceContext?.custom);
|
|
2829
|
+
o && (i = o[e]);
|
|
2830
|
+
}
|
|
2831
|
+
if (n && i !== void 0)
|
|
2832
|
+
return i;
|
|
2833
|
+
const s = this.getBaseTargetFromProps(this.props, e);
|
|
2834
|
+
return s !== void 0 && !I(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
|
|
2835
|
+
}
|
|
2836
|
+
on(e, n) {
|
|
2837
|
+
return this.events[e] || (this.events[e] = new Je()), this.events[e].add(n);
|
|
2838
|
+
}
|
|
2839
|
+
notify(e, ...n) {
|
|
2840
|
+
this.events[e] && this.events[e].notify(...n);
|
|
2841
|
+
}
|
|
2842
|
+
scheduleRenderMicrotask() {
|
|
2843
|
+
pn.render(this.render);
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
class rr extends Vl {
|
|
2847
|
+
constructor() {
|
|
2848
|
+
super(...arguments), this.KeyframeResolver = Pa;
|
|
2849
|
+
}
|
|
2850
|
+
sortInstanceNodePosition(e, n) {
|
|
2851
|
+
return e.compareDocumentPosition(n) & 2 ? 1 : -1;
|
|
2852
|
+
}
|
|
2853
|
+
getBaseTargetFromProps(e, n) {
|
|
2854
|
+
return e.style ? e.style[n] : void 0;
|
|
2855
|
+
}
|
|
2856
|
+
removeValueFromRenderState(e, { vars: n, style: i }) {
|
|
2857
|
+
delete n[e], delete i[e];
|
|
2858
|
+
}
|
|
2859
|
+
handleChildMotionValue() {
|
|
2860
|
+
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
|
2861
|
+
const { children: e } = this.props;
|
|
2862
|
+
I(e) && (this.childSubscription = e.on("change", (n) => {
|
|
2863
|
+
this.current && (this.current.textContent = `${n}`);
|
|
2864
|
+
}));
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
function or(t, { style: e, vars: n }, i, s) {
|
|
2868
|
+
const o = t.style;
|
|
2869
|
+
let r;
|
|
2870
|
+
for (r in e)
|
|
2871
|
+
o[r] = e[r];
|
|
2872
|
+
s?.applyProjectionStyles(o, i);
|
|
2873
|
+
for (r in n)
|
|
2874
|
+
o.setProperty(r, n[r]);
|
|
2875
|
+
}
|
|
2876
|
+
function Cl(t) {
|
|
2877
|
+
return window.getComputedStyle(t);
|
|
2878
|
+
}
|
|
2879
|
+
class Dl extends rr {
|
|
2880
|
+
constructor() {
|
|
2881
|
+
super(...arguments), this.type = "html", this.renderInstance = or;
|
|
2882
|
+
}
|
|
2883
|
+
readValueFromInstance(e, n) {
|
|
2884
|
+
if (Vt.has(n))
|
|
2885
|
+
return this.projection?.isProjecting ? Ee(n) : Uo(e, n);
|
|
2886
|
+
{
|
|
2887
|
+
const i = Cl(e), s = (nn(n) ? i.getPropertyValue(n) : i[n]) || 0;
|
|
2888
|
+
return typeof s == "string" ? s.trim() : s;
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
measureInstanceViewportBox(e, { transformPagePoint: n }) {
|
|
2892
|
+
return ir(e, n);
|
|
2893
|
+
}
|
|
2894
|
+
build(e, n, i) {
|
|
2895
|
+
xn(e, n, i.transformTemplate);
|
|
2896
|
+
}
|
|
2897
|
+
scrapeMotionValuesFromProps(e, n, i) {
|
|
2898
|
+
return Sn(e, n, i);
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
const ar = /* @__PURE__ */ new Set([
|
|
2902
|
+
"baseFrequency",
|
|
2903
|
+
"diffuseConstant",
|
|
2904
|
+
"kernelMatrix",
|
|
2905
|
+
"kernelUnitLength",
|
|
2906
|
+
"keySplines",
|
|
2907
|
+
"keyTimes",
|
|
2908
|
+
"limitingConeAngle",
|
|
2909
|
+
"markerHeight",
|
|
2910
|
+
"markerWidth",
|
|
2911
|
+
"numOctaves",
|
|
2912
|
+
"targetX",
|
|
2913
|
+
"targetY",
|
|
2914
|
+
"surfaceScale",
|
|
2915
|
+
"specularConstant",
|
|
2916
|
+
"specularExponent",
|
|
2917
|
+
"stdDeviation",
|
|
2918
|
+
"tableValues",
|
|
2919
|
+
"viewBox",
|
|
2920
|
+
"gradientTransform",
|
|
2921
|
+
"pathLength",
|
|
2922
|
+
"startOffset",
|
|
2923
|
+
"textLength",
|
|
2924
|
+
"lengthAdjust"
|
|
2925
|
+
]);
|
|
2926
|
+
function Ml(t, e, n, i) {
|
|
2927
|
+
or(t, e, void 0, i);
|
|
2928
|
+
for (const s in e.attrs)
|
|
2929
|
+
t.setAttribute(ar.has(s) ? s : An(s), e.attrs[s]);
|
|
2930
|
+
}
|
|
2931
|
+
class El extends rr {
|
|
2932
|
+
constructor() {
|
|
2933
|
+
super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = L;
|
|
2934
|
+
}
|
|
2935
|
+
getBaseTargetFromProps(e, n) {
|
|
2936
|
+
return e[n];
|
|
2937
|
+
}
|
|
2938
|
+
readValueFromInstance(e, n) {
|
|
2939
|
+
if (Vt.has(n)) {
|
|
2940
|
+
const i = Ls(n);
|
|
2941
|
+
return i && i.default || 0;
|
|
2942
|
+
}
|
|
2943
|
+
return n = ar.has(n) ? n : An(n), e.getAttribute(n);
|
|
2944
|
+
}
|
|
2945
|
+
scrapeMotionValuesFromProps(e, n, i) {
|
|
2946
|
+
return qs(e, n, i);
|
|
2947
|
+
}
|
|
2948
|
+
build(e, n, i) {
|
|
2949
|
+
_s(e, n, this.isSVGTag, i.transformTemplate, i.style);
|
|
2950
|
+
}
|
|
2951
|
+
renderInstance(e, n, i, s) {
|
|
2952
|
+
Ml(e, n, i, s);
|
|
2953
|
+
}
|
|
2954
|
+
mount(e) {
|
|
2955
|
+
this.isSVGTag = Xs(e.tagName), super.mount(e);
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
const Rl = (t, e) => Pn(t) ? new El(e) : new Dl(e, {
|
|
2959
|
+
allowProjection: t !== Xi
|
|
2960
|
+
});
|
|
2961
|
+
function Tt(t, e, n) {
|
|
2962
|
+
const i = t.getProps();
|
|
2963
|
+
return bn(i, e, n !== void 0 ? n : i.custom, t);
|
|
2964
|
+
}
|
|
2965
|
+
const Ue = (t) => Array.isArray(t);
|
|
2966
|
+
function Ll(t, e, n) {
|
|
2967
|
+
t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, xt(n));
|
|
2968
|
+
}
|
|
2969
|
+
function kl(t) {
|
|
2970
|
+
return Ue(t) ? t[t.length - 1] || 0 : t;
|
|
2971
|
+
}
|
|
2972
|
+
function Fl(t, e) {
|
|
2973
|
+
const n = Tt(t, e);
|
|
2974
|
+
let { transitionEnd: i = {}, transition: s = {}, ...o } = n || {};
|
|
2975
|
+
o = { ...o, ...i };
|
|
2976
|
+
for (const r in o) {
|
|
2977
|
+
const a = kl(o[r]);
|
|
2978
|
+
Ll(t, r, a);
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
function Bl(t) {
|
|
2982
|
+
return !!(I(t) && t.add);
|
|
2983
|
+
}
|
|
2984
|
+
function We(t, e) {
|
|
2985
|
+
const n = t.getValue("willChange");
|
|
2986
|
+
if (Bl(n))
|
|
2987
|
+
return n.add(e);
|
|
2988
|
+
if (!n && q.WillChange) {
|
|
2989
|
+
const i = new q.WillChange("auto");
|
|
2990
|
+
t.addValue("willChange", i), i.add(e);
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
function lr(t) {
|
|
2994
|
+
return t.props[Zs];
|
|
2995
|
+
}
|
|
2996
|
+
const Il = (t) => t !== null;
|
|
2997
|
+
function Ol(t, { repeat: e, repeatType: n = "loop" }, i) {
|
|
2998
|
+
const s = t.filter(Il), o = e && n !== "loop" && e % 2 === 1 ? 0 : s.length - 1;
|
|
2999
|
+
return s[o];
|
|
3000
|
+
}
|
|
3001
|
+
const jl = {
|
|
3002
|
+
type: "spring",
|
|
3003
|
+
stiffness: 500,
|
|
3004
|
+
damping: 25,
|
|
3005
|
+
restSpeed: 10
|
|
3006
|
+
}, Nl = (t) => ({
|
|
3007
|
+
type: "spring",
|
|
3008
|
+
stiffness: 550,
|
|
3009
|
+
damping: t === 0 ? 2 * Math.sqrt(550) : 30,
|
|
3010
|
+
restSpeed: 10
|
|
3011
|
+
}), Ul = {
|
|
3012
|
+
type: "keyframes",
|
|
3013
|
+
duration: 0.8
|
|
3014
|
+
}, Wl = {
|
|
3015
|
+
type: "keyframes",
|
|
3016
|
+
ease: [0.25, 0.1, 0.35, 1],
|
|
3017
|
+
duration: 0.3
|
|
3018
|
+
}, $l = (t, { keyframes: e }) => e.length > 2 ? Ul : Vt.has(t) ? t.startsWith("scale") ? Nl(e[1]) : jl : Wl;
|
|
3019
|
+
function Kl({ when: t, delay: e, delayChildren: n, staggerChildren: i, staggerDirection: s, repeat: o, repeatType: r, repeatDelay: a, from: l, elapsed: u, ...c }) {
|
|
3020
|
+
return !!Object.keys(c).length;
|
|
3021
|
+
}
|
|
3022
|
+
const Vn = (t, e, n, i = {}, s, o) => (r) => {
|
|
3023
|
+
const a = dn(i, t) || {}, l = a.delay || i.delay || 0;
|
|
3024
|
+
let { elapsed: u = 0 } = i;
|
|
3025
|
+
u = u - /* @__PURE__ */ H(l);
|
|
3026
|
+
const c = {
|
|
3027
|
+
keyframes: Array.isArray(n) ? n : [null, n],
|
|
3028
|
+
ease: "easeOut",
|
|
3029
|
+
velocity: e.getVelocity(),
|
|
3030
|
+
...a,
|
|
3031
|
+
delay: -u,
|
|
3032
|
+
onUpdate: (f) => {
|
|
3033
|
+
e.set(f), a.onUpdate && a.onUpdate(f);
|
|
3034
|
+
},
|
|
3035
|
+
onComplete: () => {
|
|
3036
|
+
r(), a.onComplete && a.onComplete();
|
|
3037
|
+
},
|
|
3038
|
+
name: t,
|
|
3039
|
+
motionValue: e,
|
|
3040
|
+
element: o ? void 0 : s
|
|
3041
|
+
};
|
|
3042
|
+
Kl(a) || Object.assign(c, $l(t, c)), c.duration && (c.duration = /* @__PURE__ */ H(c.duration)), c.repeatDelay && (c.repeatDelay = /* @__PURE__ */ H(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
|
|
3043
|
+
let h = !1;
|
|
3044
|
+
if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (Be(c), c.delay === 0 && (h = !0)), (q.instantAnimations || q.skipAnimations) && (h = !0, Be(c), c.delay = 0), c.allowFlatten = !a.type && !a.ease, h && !o && e.get() !== void 0) {
|
|
3045
|
+
const f = Ol(c.keyframes, a);
|
|
3046
|
+
if (f !== void 0) {
|
|
3047
|
+
V.update(() => {
|
|
3048
|
+
c.onUpdate(f), c.onComplete();
|
|
3049
|
+
});
|
|
3050
|
+
return;
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
return a.isSync ? new hn(c) : new ca(c);
|
|
3054
|
+
};
|
|
3055
|
+
function zl({ protectedKeys: t, needsAnimating: e }, n) {
|
|
3056
|
+
const i = t.hasOwnProperty(n) && e[n] !== !0;
|
|
3057
|
+
return e[n] = !1, i;
|
|
3058
|
+
}
|
|
3059
|
+
function cr(t, e, { delay: n = 0, transitionOverride: i, type: s } = {}) {
|
|
3060
|
+
let { transition: o = t.getDefaultTransition(), transitionEnd: r, ...a } = e;
|
|
3061
|
+
i && (o = i);
|
|
3062
|
+
const l = [], u = s && t.animationState && t.animationState.getState()[s];
|
|
3063
|
+
for (const c in a) {
|
|
3064
|
+
const h = t.getValue(c, t.latestValues[c] ?? null), f = a[c];
|
|
3065
|
+
if (f === void 0 || u && zl(u, c))
|
|
3066
|
+
continue;
|
|
3067
|
+
const d = {
|
|
3068
|
+
delay: n,
|
|
3069
|
+
...dn(o || {}, c)
|
|
3070
|
+
}, m = h.get();
|
|
3071
|
+
if (m !== void 0 && !h.isAnimating && !Array.isArray(f) && f === m && !d.velocity)
|
|
3072
|
+
continue;
|
|
3073
|
+
let g = !1;
|
|
3074
|
+
if (window.MotionHandoffAnimation) {
|
|
3075
|
+
const p = lr(t);
|
|
3076
|
+
if (p) {
|
|
3077
|
+
const v = window.MotionHandoffAnimation(p, c, V);
|
|
3078
|
+
v !== null && (d.startTime = v, g = !0);
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
We(t, c), h.start(Vn(c, h, f, t.shouldReduceMotion && Ms.has(c) ? { type: !1 } : d, t, g));
|
|
3082
|
+
const T = h.animation;
|
|
3083
|
+
T && l.push(T);
|
|
3084
|
+
}
|
|
3085
|
+
return r && Promise.all(l).then(() => {
|
|
3086
|
+
V.update(() => {
|
|
3087
|
+
r && Fl(t, r);
|
|
3088
|
+
});
|
|
3089
|
+
}), l;
|
|
3090
|
+
}
|
|
3091
|
+
function ur(t, e, n, i = 0, s = 1) {
|
|
3092
|
+
const o = Array.from(t).sort((u, c) => u.sortNodePosition(c)).indexOf(e), r = t.size, a = (r - 1) * i;
|
|
3093
|
+
return typeof n == "function" ? n(o, r) : s === 1 ? o * i : a - o * i;
|
|
3094
|
+
}
|
|
3095
|
+
function $e(t, e, n = {}) {
|
|
3096
|
+
const i = Tt(t, e, n.type === "exit" ? t.presenceContext?.custom : void 0);
|
|
3097
|
+
let { transition: s = t.getDefaultTransition() || {} } = i || {};
|
|
3098
|
+
n.transitionOverride && (s = n.transitionOverride);
|
|
3099
|
+
const o = i ? () => Promise.all(cr(t, i, n)) : () => Promise.resolve(), r = t.variantChildren && t.variantChildren.size ? (l = 0) => {
|
|
3100
|
+
const { delayChildren: u = 0, staggerChildren: c, staggerDirection: h } = s;
|
|
3101
|
+
return Hl(t, e, l, u, c, h, n);
|
|
3102
|
+
} : () => Promise.resolve(), { when: a } = s;
|
|
3103
|
+
if (a) {
|
|
3104
|
+
const [l, u] = a === "beforeChildren" ? [o, r] : [r, o];
|
|
3105
|
+
return l().then(() => u());
|
|
3106
|
+
} else
|
|
3107
|
+
return Promise.all([o(), r(n.delay)]);
|
|
3108
|
+
}
|
|
3109
|
+
function Hl(t, e, n = 0, i = 0, s = 0, o = 1, r) {
|
|
3110
|
+
const a = [];
|
|
3111
|
+
for (const l of t.variantChildren)
|
|
3112
|
+
l.notify("AnimationStart", e), a.push($e(l, e, {
|
|
3113
|
+
...r,
|
|
3114
|
+
delay: n + (typeof i == "function" ? 0 : i) + ur(t.variantChildren, l, i, s, o)
|
|
3115
|
+
}).then(() => l.notify("AnimationComplete", e)));
|
|
3116
|
+
return Promise.all(a);
|
|
3117
|
+
}
|
|
3118
|
+
function _l(t, e, n = {}) {
|
|
3119
|
+
t.notify("AnimationStart", e);
|
|
3120
|
+
let i;
|
|
3121
|
+
if (Array.isArray(e)) {
|
|
3122
|
+
const s = e.map((o) => $e(t, o, n));
|
|
3123
|
+
i = Promise.all(s);
|
|
3124
|
+
} else if (typeof e == "string")
|
|
3125
|
+
i = $e(t, e, n);
|
|
3126
|
+
else {
|
|
3127
|
+
const s = typeof e == "function" ? Tt(t, e, n.custom) : e;
|
|
3128
|
+
i = Promise.all(cr(t, s, n));
|
|
3129
|
+
}
|
|
3130
|
+
return i.then(() => {
|
|
3131
|
+
t.notify("AnimationComplete", e);
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
function hr(t, e) {
|
|
3135
|
+
if (!Array.isArray(e))
|
|
3136
|
+
return !1;
|
|
3137
|
+
const n = e.length;
|
|
3138
|
+
if (n !== t.length)
|
|
3139
|
+
return !1;
|
|
3140
|
+
for (let i = 0; i < n; i++)
|
|
3141
|
+
if (e[i] !== t[i])
|
|
3142
|
+
return !1;
|
|
3143
|
+
return !0;
|
|
3144
|
+
}
|
|
3145
|
+
const Gl = Tn.length;
|
|
3146
|
+
function fr(t) {
|
|
3147
|
+
if (!t)
|
|
3148
|
+
return;
|
|
3149
|
+
if (!t.isControllingVariants) {
|
|
3150
|
+
const n = t.parent ? fr(t.parent) || {} : {};
|
|
3151
|
+
return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
|
|
3152
|
+
}
|
|
3153
|
+
const e = {};
|
|
3154
|
+
for (let n = 0; n < Gl; n++) {
|
|
3155
|
+
const i = Tn[n], s = t.props[i];
|
|
3156
|
+
(Bt(s) || s === !1) && (e[i] = s);
|
|
3157
|
+
}
|
|
3158
|
+
return e;
|
|
3159
|
+
}
|
|
3160
|
+
const Xl = [...vn].reverse(), Yl = vn.length;
|
|
3161
|
+
function ql(t) {
|
|
3162
|
+
return (e) => Promise.all(e.map(({ animation: n, options: i }) => _l(t, n, i)));
|
|
3163
|
+
}
|
|
3164
|
+
function Zl(t) {
|
|
3165
|
+
let e = ql(t), n = ui(), i = !0;
|
|
3166
|
+
const s = (l) => (u, c) => {
|
|
3167
|
+
const h = Tt(t, c, l === "exit" ? t.presenceContext?.custom : void 0);
|
|
3168
|
+
if (h) {
|
|
3169
|
+
const { transition: f, transitionEnd: d, ...m } = h;
|
|
3170
|
+
u = { ...u, ...m, ...d };
|
|
3171
|
+
}
|
|
3172
|
+
return u;
|
|
3173
|
+
};
|
|
3174
|
+
function o(l) {
|
|
3175
|
+
e = l(t);
|
|
3176
|
+
}
|
|
3177
|
+
function r(l) {
|
|
3178
|
+
const { props: u } = t, c = fr(t.parent) || {}, h = [], f = /* @__PURE__ */ new Set();
|
|
3179
|
+
let d = {}, m = 1 / 0;
|
|
3180
|
+
for (let T = 0; T < Yl; T++) {
|
|
3181
|
+
const p = Xl[T], v = n[p], y = u[p] !== void 0 ? u[p] : c[p], b = Bt(y), x = p === l ? v.isActive : null;
|
|
3182
|
+
x === !1 && (m = T);
|
|
3183
|
+
let S = y === c[p] && y !== u[p] && b;
|
|
3184
|
+
if (S && i && t.manuallyAnimateOnMount && (S = !1), v.protectedKeys = { ...d }, // If it isn't active and hasn't *just* been set as inactive
|
|
3185
|
+
!v.isActive && x === null || // If we didn't and don't have any defined prop for this animation type
|
|
3186
|
+
!y && !v.prevProp || // Or if the prop doesn't define an animation
|
|
3187
|
+
re(y) || typeof y == "boolean")
|
|
3188
|
+
continue;
|
|
3189
|
+
const A = Jl(v.prevProp, y);
|
|
3190
|
+
let P = A || // If we're making this variant active, we want to always make it active
|
|
3191
|
+
p === l && v.isActive && !S && b || // If we removed a higher-priority variant (i is in reverse order)
|
|
3192
|
+
T > m && b, E = !1;
|
|
3193
|
+
const M = Array.isArray(y) ? y : [y];
|
|
3194
|
+
let Z = M.reduce(s(p), {});
|
|
3195
|
+
x === !1 && (Z = {});
|
|
3196
|
+
const { prevResolvedValues: Cn = {} } = v, Dr = {
|
|
3197
|
+
...Cn,
|
|
3198
|
+
...Z
|
|
3199
|
+
}, Dn = (k) => {
|
|
3200
|
+
P = !0, f.has(k) && (E = !0, f.delete(k)), v.needsAnimating[k] = !0;
|
|
3201
|
+
const N = t.getValue(k);
|
|
3202
|
+
N && (N.liveStyle = !1);
|
|
3203
|
+
};
|
|
3204
|
+
for (const k in Dr) {
|
|
3205
|
+
const N = Z[k], st = Cn[k];
|
|
3206
|
+
if (d.hasOwnProperty(k))
|
|
3207
|
+
continue;
|
|
3208
|
+
let ft = !1;
|
|
3209
|
+
Ue(N) && Ue(st) ? ft = !hr(N, st) : ft = N !== st, ft ? N != null ? Dn(k) : f.add(k) : N !== void 0 && f.has(k) ? Dn(k) : v.protectedKeys[k] = !0;
|
|
3210
|
+
}
|
|
3211
|
+
v.prevProp = y, v.prevResolvedValues = Z, v.isActive && (d = { ...d, ...Z }), i && t.blockInitialAnimation && (P = !1);
|
|
3212
|
+
const Mn = S && A;
|
|
3213
|
+
P && (!Mn || E) && h.push(...M.map((k) => {
|
|
3214
|
+
const N = { type: p };
|
|
3215
|
+
if (typeof k == "string" && i && !Mn && t.manuallyAnimateOnMount && t.parent) {
|
|
3216
|
+
const { parent: st } = t, ft = Tt(st, k);
|
|
3217
|
+
if (st.enteringChildren && ft) {
|
|
3218
|
+
const { delayChildren: Mr } = ft.transition || {};
|
|
3219
|
+
N.delay = ur(st.enteringChildren, t, Mr);
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
return {
|
|
3223
|
+
animation: k,
|
|
3224
|
+
options: N
|
|
3225
|
+
};
|
|
3226
|
+
}));
|
|
3227
|
+
}
|
|
3228
|
+
if (f.size) {
|
|
3229
|
+
const T = {};
|
|
3230
|
+
if (typeof u.initial != "boolean") {
|
|
3231
|
+
const p = Tt(t, Array.isArray(u.initial) ? u.initial[0] : u.initial);
|
|
3232
|
+
p && p.transition && (T.transition = p.transition);
|
|
3233
|
+
}
|
|
3234
|
+
f.forEach((p) => {
|
|
3235
|
+
const v = t.getBaseTarget(p), y = t.getValue(p);
|
|
3236
|
+
y && (y.liveStyle = !0), T[p] = v ?? null;
|
|
3237
|
+
}), h.push({ animation: T });
|
|
3238
|
+
}
|
|
3239
|
+
let g = !!h.length;
|
|
3240
|
+
return i && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (g = !1), i = !1, g ? e(h) : Promise.resolve();
|
|
3241
|
+
}
|
|
3242
|
+
function a(l, u) {
|
|
3243
|
+
if (n[l].isActive === u)
|
|
3244
|
+
return Promise.resolve();
|
|
3245
|
+
t.variantChildren?.forEach((h) => h.animationState?.setActive(l, u)), n[l].isActive = u;
|
|
3246
|
+
const c = r(l);
|
|
3247
|
+
for (const h in n)
|
|
3248
|
+
n[h].protectedKeys = {};
|
|
3249
|
+
return c;
|
|
3250
|
+
}
|
|
3251
|
+
return {
|
|
3252
|
+
animateChanges: r,
|
|
3253
|
+
setActive: a,
|
|
3254
|
+
setAnimateFunction: o,
|
|
3255
|
+
getState: () => n,
|
|
3256
|
+
reset: () => {
|
|
3257
|
+
n = ui();
|
|
3258
|
+
}
|
|
3259
|
+
};
|
|
3260
|
+
}
|
|
3261
|
+
function Jl(t, e) {
|
|
3262
|
+
return typeof e == "string" ? e !== t : Array.isArray(e) ? !hr(e, t) : !1;
|
|
3263
|
+
}
|
|
3264
|
+
function rt(t = !1) {
|
|
3265
|
+
return {
|
|
3266
|
+
isActive: t,
|
|
3267
|
+
protectedKeys: {},
|
|
3268
|
+
needsAnimating: {},
|
|
3269
|
+
prevResolvedValues: {}
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
function ui() {
|
|
3273
|
+
return {
|
|
3274
|
+
animate: rt(!0),
|
|
3275
|
+
whileInView: rt(),
|
|
3276
|
+
whileHover: rt(),
|
|
3277
|
+
whileTap: rt(),
|
|
3278
|
+
whileDrag: rt(),
|
|
3279
|
+
whileFocus: rt(),
|
|
3280
|
+
exit: rt()
|
|
3281
|
+
};
|
|
3282
|
+
}
|
|
3283
|
+
class it {
|
|
3284
|
+
constructor(e) {
|
|
3285
|
+
this.isMounted = !1, this.node = e;
|
|
3286
|
+
}
|
|
3287
|
+
update() {
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
class Ql extends it {
|
|
3291
|
+
/**
|
|
3292
|
+
* We dynamically generate the AnimationState manager as it contains a reference
|
|
3293
|
+
* to the underlying animation library. We only want to load that if we load this,
|
|
3294
|
+
* so people can optionally code split it out using the `m` component.
|
|
3295
|
+
*/
|
|
3296
|
+
constructor(e) {
|
|
3297
|
+
super(e), e.animationState || (e.animationState = Zl(e));
|
|
3298
|
+
}
|
|
3299
|
+
updateAnimationControlsSubscription() {
|
|
3300
|
+
const { animate: e } = this.node.getProps();
|
|
3301
|
+
re(e) && (this.unmountControls = e.subscribe(this.node));
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Subscribe any provided AnimationControls to the component's VisualElement
|
|
3305
|
+
*/
|
|
3306
|
+
mount() {
|
|
3307
|
+
this.updateAnimationControlsSubscription();
|
|
3308
|
+
}
|
|
3309
|
+
update() {
|
|
3310
|
+
const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
|
|
3311
|
+
e !== n && this.updateAnimationControlsSubscription();
|
|
3312
|
+
}
|
|
3313
|
+
unmount() {
|
|
3314
|
+
this.node.animationState.reset(), this.unmountControls?.();
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
let tc = 0;
|
|
3318
|
+
class ec extends it {
|
|
3319
|
+
constructor() {
|
|
3320
|
+
super(...arguments), this.id = tc++;
|
|
3321
|
+
}
|
|
3322
|
+
update() {
|
|
3323
|
+
if (!this.node.presenceContext)
|
|
3324
|
+
return;
|
|
3325
|
+
const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
|
|
3326
|
+
if (!this.node.animationState || e === i)
|
|
3327
|
+
return;
|
|
3328
|
+
const s = this.node.animationState.setActive("exit", !e);
|
|
3329
|
+
n && !e && s.then(() => {
|
|
3330
|
+
n(this.id);
|
|
3331
|
+
});
|
|
3332
|
+
}
|
|
3333
|
+
mount() {
|
|
3334
|
+
const { register: e, onExitComplete: n } = this.node.presenceContext || {};
|
|
3335
|
+
n && n(this.id), e && (this.unmount = e(this.id));
|
|
3336
|
+
}
|
|
3337
|
+
unmount() {
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
const nc = {
|
|
3341
|
+
animation: {
|
|
3342
|
+
Feature: Ql
|
|
3343
|
+
},
|
|
3344
|
+
exit: {
|
|
3345
|
+
Feature: ec
|
|
3346
|
+
}
|
|
3347
|
+
};
|
|
3348
|
+
function Ot(t, e, n, i = { passive: !0 }) {
|
|
3349
|
+
return t.addEventListener(e, n, i), () => t.removeEventListener(e, n);
|
|
3350
|
+
}
|
|
3351
|
+
function Wt(t) {
|
|
3352
|
+
return {
|
|
3353
|
+
point: {
|
|
3354
|
+
x: t.pageX,
|
|
3355
|
+
y: t.pageY
|
|
3356
|
+
}
|
|
3357
|
+
};
|
|
3358
|
+
}
|
|
3359
|
+
const ic = (t) => (e) => gn(e) && t(e, Wt(e));
|
|
3360
|
+
function Et(t, e, n, i) {
|
|
3361
|
+
return Ot(t, e, ic(n), i);
|
|
3362
|
+
}
|
|
3363
|
+
const dr = 1e-4, sc = 1 - dr, rc = 1 + dr, mr = 0.01, oc = 0 - mr, ac = 0 + mr;
|
|
3364
|
+
function O(t) {
|
|
3365
|
+
return t.max - t.min;
|
|
3366
|
+
}
|
|
3367
|
+
function lc(t, e, n) {
|
|
3368
|
+
return Math.abs(t - e) <= n;
|
|
3369
|
+
}
|
|
3370
|
+
function hi(t, e, n, i = 0.5) {
|
|
3371
|
+
t.origin = i, t.originPoint = D(e.min, e.max, t.origin), t.scale = O(n) / O(e), t.translate = D(n.min, n.max, t.origin) - t.originPoint, (t.scale >= sc && t.scale <= rc || isNaN(t.scale)) && (t.scale = 1), (t.translate >= oc && t.translate <= ac || isNaN(t.translate)) && (t.translate = 0);
|
|
3372
|
+
}
|
|
3373
|
+
function Rt(t, e, n, i) {
|
|
3374
|
+
hi(t.x, e.x, n.x, i ? i.originX : void 0), hi(t.y, e.y, n.y, i ? i.originY : void 0);
|
|
3375
|
+
}
|
|
3376
|
+
function fi(t, e, n) {
|
|
3377
|
+
t.min = n.min + e.min, t.max = t.min + O(e);
|
|
3378
|
+
}
|
|
3379
|
+
function cc(t, e, n) {
|
|
3380
|
+
fi(t.x, e.x, n.x), fi(t.y, e.y, n.y);
|
|
3381
|
+
}
|
|
3382
|
+
function di(t, e, n) {
|
|
3383
|
+
t.min = e.min - n.min, t.max = t.min + O(e);
|
|
3384
|
+
}
|
|
3385
|
+
function ee(t, e, n) {
|
|
3386
|
+
di(t.x, e.x, n.x), di(t.y, e.y, n.y);
|
|
3387
|
+
}
|
|
3388
|
+
function U(t) {
|
|
3389
|
+
return [t("x"), t("y")];
|
|
3390
|
+
}
|
|
3391
|
+
const pr = ({ current: t }) => t ? t.ownerDocument.defaultView : null, mi = (t, e) => Math.abs(t - e);
|
|
3392
|
+
function uc(t, e) {
|
|
3393
|
+
const n = mi(t.x, e.x), i = mi(t.y, e.y);
|
|
3394
|
+
return Math.sqrt(n ** 2 + i ** 2);
|
|
3395
|
+
}
|
|
3396
|
+
class gr {
|
|
3397
|
+
constructor(e, n, { transformPagePoint: i, contextWindow: s = window, dragSnapToOrigin: o = !1, distanceThreshold: r = 3 } = {}) {
|
|
3398
|
+
if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
|
|
3399
|
+
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
3400
|
+
return;
|
|
3401
|
+
const f = ge(this.lastMoveEventInfo, this.history), d = this.startEvent !== null, m = uc(f.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
|
|
3402
|
+
if (!d && !m)
|
|
3403
|
+
return;
|
|
3404
|
+
const { point: g } = f, { timestamp: T } = F;
|
|
3405
|
+
this.history.push({ ...g, timestamp: T });
|
|
3406
|
+
const { onStart: p, onMove: v } = this.handlers;
|
|
3407
|
+
d || (p && p(this.lastMoveEvent, f), this.startEvent = this.lastMoveEvent), v && v(this.lastMoveEvent, f);
|
|
3408
|
+
}, this.handlePointerMove = (f, d) => {
|
|
3409
|
+
this.lastMoveEvent = f, this.lastMoveEventInfo = pe(d, this.transformPagePoint), V.update(this.updatePoint, !0);
|
|
3410
|
+
}, this.handlePointerUp = (f, d) => {
|
|
3411
|
+
this.end();
|
|
3412
|
+
const { onEnd: m, onSessionEnd: g, resumeAnimation: T } = this.handlers;
|
|
3413
|
+
if (this.dragSnapToOrigin && T && T(), !(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
3414
|
+
return;
|
|
3415
|
+
const p = ge(f.type === "pointercancel" ? this.lastMoveEventInfo : pe(d, this.transformPagePoint), this.history);
|
|
3416
|
+
this.startEvent && m && m(f, p), g && g(f, p);
|
|
3417
|
+
}, !gn(e))
|
|
3418
|
+
return;
|
|
3419
|
+
this.dragSnapToOrigin = o, this.handlers = n, this.transformPagePoint = i, this.distanceThreshold = r, this.contextWindow = s || window;
|
|
3420
|
+
const a = Wt(e), l = pe(a, this.transformPagePoint), { point: u } = l, { timestamp: c } = F;
|
|
3421
|
+
this.history = [{ ...u, timestamp: c }];
|
|
3422
|
+
const { onSessionStart: h } = n;
|
|
3423
|
+
h && h(e, ge(l, this.history)), this.removeListeners = jt(Et(this.contextWindow, "pointermove", this.handlePointerMove), Et(this.contextWindow, "pointerup", this.handlePointerUp), Et(this.contextWindow, "pointercancel", this.handlePointerUp));
|
|
3424
|
+
}
|
|
3425
|
+
updateHandlers(e) {
|
|
3426
|
+
this.handlers = e;
|
|
3427
|
+
}
|
|
3428
|
+
end() {
|
|
3429
|
+
this.removeListeners && this.removeListeners(), et(this.updatePoint);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
function pe(t, e) {
|
|
3433
|
+
return e ? { point: e(t.point) } : t;
|
|
3434
|
+
}
|
|
3435
|
+
function pi(t, e) {
|
|
3436
|
+
return { x: t.x - e.x, y: t.y - e.y };
|
|
3437
|
+
}
|
|
3438
|
+
function ge({ point: t }, e) {
|
|
3439
|
+
return {
|
|
3440
|
+
point: t,
|
|
3441
|
+
delta: pi(t, yr(e)),
|
|
3442
|
+
offset: pi(t, hc(e)),
|
|
3443
|
+
velocity: fc(e, 0.1)
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
function hc(t) {
|
|
3447
|
+
return t[0];
|
|
3448
|
+
}
|
|
3449
|
+
function yr(t) {
|
|
3450
|
+
return t[t.length - 1];
|
|
3451
|
+
}
|
|
3452
|
+
function fc(t, e) {
|
|
3453
|
+
if (t.length < 2)
|
|
3454
|
+
return { x: 0, y: 0 };
|
|
3455
|
+
let n = t.length - 1, i = null;
|
|
3456
|
+
const s = yr(t);
|
|
3457
|
+
for (; n >= 0 && (i = t[n], !(s.timestamp - i.timestamp > /* @__PURE__ */ H(e))); )
|
|
3458
|
+
n--;
|
|
3459
|
+
if (!i)
|
|
3460
|
+
return { x: 0, y: 0 };
|
|
3461
|
+
const o = /* @__PURE__ */ W(s.timestamp - i.timestamp);
|
|
3462
|
+
if (o === 0)
|
|
3463
|
+
return { x: 0, y: 0 };
|
|
3464
|
+
const r = {
|
|
3465
|
+
x: (s.x - i.x) / o,
|
|
3466
|
+
y: (s.y - i.y) / o
|
|
3467
|
+
};
|
|
3468
|
+
return r.x === 1 / 0 && (r.x = 0), r.y === 1 / 0 && (r.y = 0), r;
|
|
3469
|
+
}
|
|
3470
|
+
function dc(t, { min: e, max: n }, i) {
|
|
3471
|
+
return e !== void 0 && t < e ? t = i ? D(e, t, i.min) : Math.max(t, e) : n !== void 0 && t > n && (t = i ? D(n, t, i.max) : Math.min(t, n)), t;
|
|
3472
|
+
}
|
|
3473
|
+
function gi(t, e, n) {
|
|
3474
|
+
return {
|
|
3475
|
+
min: e !== void 0 ? t.min + e : void 0,
|
|
3476
|
+
max: n !== void 0 ? t.max + n - (t.max - t.min) : void 0
|
|
3477
|
+
};
|
|
3478
|
+
}
|
|
3479
|
+
function mc(t, { top: e, left: n, bottom: i, right: s }) {
|
|
3480
|
+
return {
|
|
3481
|
+
x: gi(t.x, n, s),
|
|
3482
|
+
y: gi(t.y, e, i)
|
|
3483
|
+
};
|
|
3484
|
+
}
|
|
3485
|
+
function yi(t, e) {
|
|
3486
|
+
let n = e.min - t.min, i = e.max - t.max;
|
|
3487
|
+
return e.max - e.min < t.max - t.min && ([n, i] = [i, n]), { min: n, max: i };
|
|
3488
|
+
}
|
|
3489
|
+
function pc(t, e) {
|
|
3490
|
+
return {
|
|
3491
|
+
x: yi(t.x, e.x),
|
|
3492
|
+
y: yi(t.y, e.y)
|
|
3493
|
+
};
|
|
3494
|
+
}
|
|
3495
|
+
function gc(t, e) {
|
|
3496
|
+
let n = 0.5;
|
|
3497
|
+
const i = O(t), s = O(e);
|
|
3498
|
+
return s > i ? n = /* @__PURE__ */ Lt(e.min, e.max - i, t.min) : i > s && (n = /* @__PURE__ */ Lt(t.min, t.max - s, e.min)), X(0, 1, n);
|
|
3499
|
+
}
|
|
3500
|
+
function yc(t, e) {
|
|
3501
|
+
const n = {};
|
|
3502
|
+
return e.min !== void 0 && (n.min = e.min - t.min), e.max !== void 0 && (n.max = e.max - t.min), n;
|
|
3503
|
+
}
|
|
3504
|
+
const Ke = 0.35;
|
|
3505
|
+
function vc(t = Ke) {
|
|
3506
|
+
return t === !1 ? t = 0 : t === !0 && (t = Ke), {
|
|
3507
|
+
x: vi(t, "left", "right"),
|
|
3508
|
+
y: vi(t, "top", "bottom")
|
|
3509
|
+
};
|
|
3510
|
+
}
|
|
3511
|
+
function vi(t, e, n) {
|
|
3512
|
+
return {
|
|
3513
|
+
min: Ti(t, e),
|
|
3514
|
+
max: Ti(t, n)
|
|
3515
|
+
};
|
|
3516
|
+
}
|
|
3517
|
+
function Ti(t, e) {
|
|
3518
|
+
return typeof t == "number" ? t : t[e] || 0;
|
|
3519
|
+
}
|
|
3520
|
+
const Tc = /* @__PURE__ */ new WeakMap();
|
|
3521
|
+
class xc {
|
|
3522
|
+
constructor(e) {
|
|
3523
|
+
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = L(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
|
|
3524
|
+
}
|
|
3525
|
+
start(e, { snapToCursor: n = !1, distanceThreshold: i } = {}) {
|
|
3526
|
+
const { presenceContext: s } = this.visualElement;
|
|
3527
|
+
if (s && s.isPresent === !1)
|
|
3528
|
+
return;
|
|
3529
|
+
const o = (h) => {
|
|
3530
|
+
const { dragSnapToOrigin: f } = this.getProps();
|
|
3531
|
+
f ? this.pauseAnimation() : this.stopAnimation(), n && this.snapToCursor(Wt(h).point);
|
|
3532
|
+
}, r = (h, f) => {
|
|
3533
|
+
const { drag: d, dragPropagation: m, onDragStart: g } = this.getProps();
|
|
3534
|
+
if (d && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = Va(d), !this.openDragLock))
|
|
3535
|
+
return;
|
|
3536
|
+
this.latestPointerEvent = h, this.latestPanInfo = f, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), U((p) => {
|
|
3537
|
+
let v = this.getAxisMotionValue(p).get() || 0;
|
|
3538
|
+
if (G.test(v)) {
|
|
3539
|
+
const { projection: y } = this.visualElement;
|
|
3540
|
+
if (y && y.layout) {
|
|
3541
|
+
const b = y.layout.layoutBox[p];
|
|
3542
|
+
b && (v = O(b) * (parseFloat(v) / 100));
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
this.originPoint[p] = v;
|
|
3546
|
+
}), g && V.postRender(() => g(h, f)), We(this.visualElement, "transform");
|
|
3547
|
+
const { animationState: T } = this.visualElement;
|
|
3548
|
+
T && T.setActive("whileDrag", !0);
|
|
3549
|
+
}, a = (h, f) => {
|
|
3550
|
+
this.latestPointerEvent = h, this.latestPanInfo = f;
|
|
3551
|
+
const { dragPropagation: d, dragDirectionLock: m, onDirectionLock: g, onDrag: T } = this.getProps();
|
|
3552
|
+
if (!d && !this.openDragLock)
|
|
3553
|
+
return;
|
|
3554
|
+
const { offset: p } = f;
|
|
3555
|
+
if (m && this.currentDirection === null) {
|
|
3556
|
+
this.currentDirection = wc(p), this.currentDirection !== null && g && g(this.currentDirection);
|
|
3557
|
+
return;
|
|
3558
|
+
}
|
|
3559
|
+
this.updateAxis("x", f.point, p), this.updateAxis("y", f.point, p), this.visualElement.render(), T && T(h, f);
|
|
3560
|
+
}, l = (h, f) => {
|
|
3561
|
+
this.latestPointerEvent = h, this.latestPanInfo = f, this.stop(h, f), this.latestPointerEvent = null, this.latestPanInfo = null;
|
|
3562
|
+
}, u = () => U((h) => this.getAnimationState(h) === "paused" && this.getAxisMotionValue(h).animation?.play()), { dragSnapToOrigin: c } = this.getProps();
|
|
3563
|
+
this.panSession = new gr(e, {
|
|
3564
|
+
onSessionStart: o,
|
|
3565
|
+
onStart: r,
|
|
3566
|
+
onMove: a,
|
|
3567
|
+
onSessionEnd: l,
|
|
3568
|
+
resumeAnimation: u
|
|
3569
|
+
}, {
|
|
3570
|
+
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
3571
|
+
dragSnapToOrigin: c,
|
|
3572
|
+
distanceThreshold: i,
|
|
3573
|
+
contextWindow: pr(this.visualElement)
|
|
3574
|
+
});
|
|
3575
|
+
}
|
|
3576
|
+
/**
|
|
3577
|
+
* @internal
|
|
3578
|
+
*/
|
|
3579
|
+
stop(e, n) {
|
|
3580
|
+
const i = e || this.latestPointerEvent, s = n || this.latestPanInfo, o = this.isDragging;
|
|
3581
|
+
if (this.cancel(), !o || !s || !i)
|
|
3582
|
+
return;
|
|
3583
|
+
const { velocity: r } = s;
|
|
3584
|
+
this.startAnimation(r);
|
|
3585
|
+
const { onDragEnd: a } = this.getProps();
|
|
3586
|
+
a && V.postRender(() => a(i, s));
|
|
3587
|
+
}
|
|
3588
|
+
/**
|
|
3589
|
+
* @internal
|
|
3590
|
+
*/
|
|
3591
|
+
cancel() {
|
|
3592
|
+
this.isDragging = !1;
|
|
3593
|
+
const { projection: e, animationState: n } = this.visualElement;
|
|
3594
|
+
e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
|
|
3595
|
+
const { dragPropagation: i } = this.getProps();
|
|
3596
|
+
!i && this.openDragLock && (this.openDragLock(), this.openDragLock = null), n && n.setActive("whileDrag", !1);
|
|
3597
|
+
}
|
|
3598
|
+
updateAxis(e, n, i) {
|
|
3599
|
+
const { drag: s } = this.getProps();
|
|
3600
|
+
if (!i || !Ht(e, s, this.currentDirection))
|
|
3601
|
+
return;
|
|
3602
|
+
const o = this.getAxisMotionValue(e);
|
|
3603
|
+
let r = this.originPoint[e] + i[e];
|
|
3604
|
+
this.constraints && this.constraints[e] && (r = dc(r, this.constraints[e], this.elastic[e])), o.set(r);
|
|
3605
|
+
}
|
|
3606
|
+
resolveConstraints() {
|
|
3607
|
+
const { dragConstraints: e, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, s = this.constraints;
|
|
3608
|
+
e && pt(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && i ? this.constraints = mc(i.layoutBox, e) : this.constraints = !1, this.elastic = vc(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && U((o) => {
|
|
3609
|
+
this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = yc(i.layoutBox[o], this.constraints[o]));
|
|
3610
|
+
});
|
|
3611
|
+
}
|
|
3612
|
+
resolveRefConstraints() {
|
|
3613
|
+
const { dragConstraints: e, onMeasureDragConstraints: n } = this.getProps();
|
|
3614
|
+
if (!e || !pt(e))
|
|
3615
|
+
return !1;
|
|
3616
|
+
const i = e.current;
|
|
3617
|
+
Y(i !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
|
|
3618
|
+
const { projection: s } = this.visualElement;
|
|
3619
|
+
if (!s || !s.layout)
|
|
3620
|
+
return !1;
|
|
3621
|
+
const o = Pl(i, s.root, this.visualElement.getTransformPagePoint());
|
|
3622
|
+
let r = pc(s.layout.layoutBox, o);
|
|
3623
|
+
if (n) {
|
|
3624
|
+
const a = n(Tl(r));
|
|
3625
|
+
this.hasMutatedConstraints = !!a, a && (r = tr(a));
|
|
3626
|
+
}
|
|
3627
|
+
return r;
|
|
3628
|
+
}
|
|
3629
|
+
startAnimation(e) {
|
|
3630
|
+
const { drag: n, dragMomentum: i, dragElastic: s, dragTransition: o, dragSnapToOrigin: r, onDragTransitionEnd: a } = this.getProps(), l = this.constraints || {}, u = U((c) => {
|
|
3631
|
+
if (!Ht(c, n, this.currentDirection))
|
|
3632
|
+
return;
|
|
3633
|
+
let h = l && l[c] || {};
|
|
3634
|
+
r && (h = { min: 0, max: 0 });
|
|
3635
|
+
const f = s ? 200 : 1e6, d = s ? 40 : 1e7, m = {
|
|
3636
|
+
type: "inertia",
|
|
3637
|
+
velocity: i ? e[c] : 0,
|
|
3638
|
+
bounceStiffness: f,
|
|
3639
|
+
bounceDamping: d,
|
|
3640
|
+
timeConstant: 750,
|
|
3641
|
+
restDelta: 1,
|
|
3642
|
+
restSpeed: 10,
|
|
3643
|
+
...o,
|
|
3644
|
+
...h
|
|
3645
|
+
};
|
|
3646
|
+
return this.startAxisValueAnimation(c, m);
|
|
3647
|
+
});
|
|
3648
|
+
return Promise.all(u).then(a);
|
|
3649
|
+
}
|
|
3650
|
+
startAxisValueAnimation(e, n) {
|
|
3651
|
+
const i = this.getAxisMotionValue(e);
|
|
3652
|
+
return We(this.visualElement, e), i.start(Vn(e, i, 0, n, this.visualElement, !1));
|
|
3653
|
+
}
|
|
3654
|
+
stopAnimation() {
|
|
3655
|
+
U((e) => this.getAxisMotionValue(e).stop());
|
|
3656
|
+
}
|
|
3657
|
+
pauseAnimation() {
|
|
3658
|
+
U((e) => this.getAxisMotionValue(e).animation?.pause());
|
|
3659
|
+
}
|
|
3660
|
+
getAnimationState(e) {
|
|
3661
|
+
return this.getAxisMotionValue(e).animation?.state;
|
|
3662
|
+
}
|
|
3663
|
+
/**
|
|
3664
|
+
* Drag works differently depending on which props are provided.
|
|
3665
|
+
*
|
|
3666
|
+
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
|
|
3667
|
+
* - Otherwise, we apply the delta to the x/y motion values.
|
|
3668
|
+
*/
|
|
3669
|
+
getAxisMotionValue(e) {
|
|
3670
|
+
const n = `_drag${e.toUpperCase()}`, i = this.visualElement.getProps(), s = i[n];
|
|
3671
|
+
return s || this.visualElement.getValue(e, (i.initial ? i.initial[e] : void 0) || 0);
|
|
3672
|
+
}
|
|
3673
|
+
snapToCursor(e) {
|
|
3674
|
+
U((n) => {
|
|
3675
|
+
const { drag: i } = this.getProps();
|
|
3676
|
+
if (!Ht(n, i, this.currentDirection))
|
|
3677
|
+
return;
|
|
3678
|
+
const { projection: s } = this.visualElement, o = this.getAxisMotionValue(n);
|
|
3679
|
+
if (s && s.layout) {
|
|
3680
|
+
const { min: r, max: a } = s.layout.layoutBox[n];
|
|
3681
|
+
o.set(e[n] - D(r, a, 0.5));
|
|
3682
|
+
}
|
|
3683
|
+
});
|
|
3684
|
+
}
|
|
3685
|
+
/**
|
|
3686
|
+
* When the viewport resizes we want to check if the measured constraints
|
|
3687
|
+
* have changed and, if so, reposition the element within those new constraints
|
|
3688
|
+
* relative to where it was before the resize.
|
|
3689
|
+
*/
|
|
3690
|
+
scalePositionWithinConstraints() {
|
|
3691
|
+
if (!this.visualElement.current)
|
|
3692
|
+
return;
|
|
3693
|
+
const { drag: e, dragConstraints: n } = this.getProps(), { projection: i } = this.visualElement;
|
|
3694
|
+
if (!pt(n) || !i || !this.constraints)
|
|
3695
|
+
return;
|
|
3696
|
+
this.stopAnimation();
|
|
3697
|
+
const s = { x: 0, y: 0 };
|
|
3698
|
+
U((r) => {
|
|
3699
|
+
const a = this.getAxisMotionValue(r);
|
|
3700
|
+
if (a && this.constraints !== !1) {
|
|
3701
|
+
const l = a.get();
|
|
3702
|
+
s[r] = gc({ min: l, max: l }, this.constraints[r]);
|
|
3703
|
+
}
|
|
3704
|
+
});
|
|
3705
|
+
const { transformTemplate: o } = this.visualElement.getProps();
|
|
3706
|
+
this.visualElement.current.style.transform = o ? o({}, "") : "none", i.root && i.root.updateScroll(), i.updateLayout(), this.resolveConstraints(), U((r) => {
|
|
3707
|
+
if (!Ht(r, e, null))
|
|
3708
|
+
return;
|
|
3709
|
+
const a = this.getAxisMotionValue(r), { min: l, max: u } = this.constraints[r];
|
|
3710
|
+
a.set(D(l, u, s[r]));
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
addListeners() {
|
|
3714
|
+
if (!this.visualElement.current)
|
|
3715
|
+
return;
|
|
3716
|
+
Tc.set(this.visualElement, this);
|
|
3717
|
+
const e = this.visualElement.current, n = Et(e, "pointerdown", (l) => {
|
|
3718
|
+
const { drag: u, dragListener: c = !0 } = this.getProps();
|
|
3719
|
+
u && c && this.start(l);
|
|
3720
|
+
}), i = () => {
|
|
3721
|
+
const { dragConstraints: l } = this.getProps();
|
|
3722
|
+
pt(l) && l.current && (this.constraints = this.resolveRefConstraints());
|
|
3723
|
+
}, { projection: s } = this.visualElement, o = s.addEventListener("measure", i);
|
|
3724
|
+
s && !s.layout && (s.root && s.root.updateScroll(), s.updateLayout()), V.read(i);
|
|
3725
|
+
const r = Ot(window, "resize", () => this.scalePositionWithinConstraints()), a = s.addEventListener("didUpdate", (({ delta: l, hasLayoutChanged: u }) => {
|
|
3726
|
+
this.isDragging && u && (U((c) => {
|
|
3727
|
+
const h = this.getAxisMotionValue(c);
|
|
3728
|
+
h && (this.originPoint[c] += l[c].translate, h.set(h.get() + l[c].translate));
|
|
3729
|
+
}), this.visualElement.render());
|
|
3730
|
+
}));
|
|
3731
|
+
return () => {
|
|
3732
|
+
r(), n(), o(), a && a();
|
|
3733
|
+
};
|
|
3734
|
+
}
|
|
3735
|
+
getProps() {
|
|
3736
|
+
const e = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: i = !1, dragPropagation: s = !1, dragConstraints: o = !1, dragElastic: r = Ke, dragMomentum: a = !0 } = e;
|
|
3737
|
+
return {
|
|
3738
|
+
...e,
|
|
3739
|
+
drag: n,
|
|
3740
|
+
dragDirectionLock: i,
|
|
3741
|
+
dragPropagation: s,
|
|
3742
|
+
dragConstraints: o,
|
|
3743
|
+
dragElastic: r,
|
|
3744
|
+
dragMomentum: a
|
|
3745
|
+
};
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
function Ht(t, e, n) {
|
|
3749
|
+
return (e === !0 || e === t) && (n === null || n === t);
|
|
3750
|
+
}
|
|
3751
|
+
function wc(t, e = 10) {
|
|
3752
|
+
let n = null;
|
|
3753
|
+
return Math.abs(t.y) > e ? n = "y" : Math.abs(t.x) > e && (n = "x"), n;
|
|
3754
|
+
}
|
|
3755
|
+
class Pc extends it {
|
|
3756
|
+
constructor(e) {
|
|
3757
|
+
super(e), this.removeGroupControls = $, this.removeListeners = $, this.controls = new xc(e);
|
|
3758
|
+
}
|
|
3759
|
+
mount() {
|
|
3760
|
+
const { dragControls: e } = this.node.getProps();
|
|
3761
|
+
e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || $;
|
|
3762
|
+
}
|
|
3763
|
+
unmount() {
|
|
3764
|
+
this.removeGroupControls(), this.removeListeners();
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
const xi = (t) => (e, n) => {
|
|
3768
|
+
t && V.postRender(() => t(e, n));
|
|
3769
|
+
};
|
|
3770
|
+
class bc extends it {
|
|
3771
|
+
constructor() {
|
|
3772
|
+
super(...arguments), this.removePointerDownListener = $;
|
|
3773
|
+
}
|
|
3774
|
+
onPointerDown(e) {
|
|
3775
|
+
this.session = new gr(e, this.createPanHandlers(), {
|
|
3776
|
+
transformPagePoint: this.node.getTransformPagePoint(),
|
|
3777
|
+
contextWindow: pr(this.node)
|
|
3778
|
+
});
|
|
3779
|
+
}
|
|
3780
|
+
createPanHandlers() {
|
|
3781
|
+
const { onPanSessionStart: e, onPanStart: n, onPan: i, onPanEnd: s } = this.node.getProps();
|
|
3782
|
+
return {
|
|
3783
|
+
onSessionStart: xi(e),
|
|
3784
|
+
onStart: xi(n),
|
|
3785
|
+
onMove: i,
|
|
3786
|
+
onEnd: (o, r) => {
|
|
3787
|
+
delete this.session, s && V.postRender(() => s(o, r));
|
|
3788
|
+
}
|
|
3789
|
+
};
|
|
3790
|
+
}
|
|
3791
|
+
mount() {
|
|
3792
|
+
this.removePointerDownListener = Et(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
|
|
3793
|
+
}
|
|
3794
|
+
update() {
|
|
3795
|
+
this.session && this.session.updateHandlers(this.createPanHandlers());
|
|
3796
|
+
}
|
|
3797
|
+
unmount() {
|
|
3798
|
+
this.removePointerDownListener(), this.session && this.session.end();
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
const Yt = {
|
|
3802
|
+
/**
|
|
3803
|
+
* Global flag as to whether the tree has animated since the last time
|
|
3804
|
+
* we resized the window
|
|
3805
|
+
*/
|
|
3806
|
+
hasAnimatedSinceResize: !0,
|
|
3807
|
+
/**
|
|
3808
|
+
* We set this to true once, on the first update. Any nodes added to the tree beyond that
|
|
3809
|
+
* update will be given a `data-projection-id` attribute.
|
|
3810
|
+
*/
|
|
3811
|
+
hasEverUpdated: !1
|
|
3812
|
+
};
|
|
3813
|
+
function wi(t, e) {
|
|
3814
|
+
return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
|
|
3815
|
+
}
|
|
3816
|
+
const Ct = {
|
|
3817
|
+
correct: (t, e) => {
|
|
3818
|
+
if (!e.target)
|
|
3819
|
+
return t;
|
|
3820
|
+
if (typeof t == "string")
|
|
3821
|
+
if (w.test(t))
|
|
3822
|
+
t = parseFloat(t);
|
|
3823
|
+
else
|
|
3824
|
+
return t;
|
|
3825
|
+
const n = wi(t, e.target.x), i = wi(t, e.target.y);
|
|
3826
|
+
return `${n}% ${i}%`;
|
|
3827
|
+
}
|
|
3828
|
+
}, Sc = {
|
|
3829
|
+
correct: (t, { treeScale: e, projectionDelta: n }) => {
|
|
3830
|
+
const i = t, s = nt.parse(t);
|
|
3831
|
+
if (s.length > 5)
|
|
3832
|
+
return i;
|
|
3833
|
+
const o = nt.createTransformer(t), r = typeof s[0] != "number" ? 1 : 0, a = n.x.scale * e.x, l = n.y.scale * e.y;
|
|
3834
|
+
s[0 + r] /= a, s[1 + r] /= l;
|
|
3835
|
+
const u = D(a, l, 0.5);
|
|
3836
|
+
return typeof s[2 + r] == "number" && (s[2 + r] /= u), typeof s[3 + r] == "number" && (s[3 + r] /= u), o(s);
|
|
3837
|
+
}
|
|
3838
|
+
};
|
|
3839
|
+
let ye = !1;
|
|
3840
|
+
class Ac extends Or {
|
|
3841
|
+
/**
|
|
3842
|
+
* This only mounts projection nodes for components that
|
|
3843
|
+
* need measuring, we might want to do it for all components
|
|
3844
|
+
* in order to incorporate transforms
|
|
3845
|
+
*/
|
|
3846
|
+
componentDidMount() {
|
|
3847
|
+
const { visualElement: e, layoutGroup: n, switchLayoutGroup: i, layoutId: s } = this.props, { projection: o } = e;
|
|
3848
|
+
Ga(Vc), o && (n.group && n.group.add(o), i && i.register && s && i.register(o), ye && o.root.didUpdate(), o.addEventListener("animationComplete", () => {
|
|
3849
|
+
this.safeToRemove();
|
|
3850
|
+
}), o.setOptions({
|
|
3851
|
+
...o.options,
|
|
3852
|
+
onExitComplete: () => this.safeToRemove()
|
|
3853
|
+
})), Yt.hasEverUpdated = !0;
|
|
3854
|
+
}
|
|
3855
|
+
getSnapshotBeforeUpdate(e) {
|
|
3856
|
+
const { layoutDependency: n, visualElement: i, drag: s, isPresent: o } = this.props, { projection: r } = i;
|
|
3857
|
+
return r && (r.isPresent = o, ye = !0, s || e.layoutDependency !== n || n === void 0 || e.isPresent !== o ? r.willUpdate() : this.safeToRemove(), e.isPresent !== o && (o ? r.promote() : r.relegate() || V.postRender(() => {
|
|
3858
|
+
const a = r.getStack();
|
|
3859
|
+
(!a || !a.members.length) && this.safeToRemove();
|
|
3860
|
+
}))), null;
|
|
3861
|
+
}
|
|
3862
|
+
componentDidUpdate() {
|
|
3863
|
+
const { projection: e } = this.props.visualElement;
|
|
3864
|
+
e && (e.root.didUpdate(), pn.postRender(() => {
|
|
3865
|
+
!e.currentAnimation && e.isLead() && this.safeToRemove();
|
|
3866
|
+
}));
|
|
3867
|
+
}
|
|
3868
|
+
componentWillUnmount() {
|
|
3869
|
+
const { visualElement: e, layoutGroup: n, switchLayoutGroup: i } = this.props, { projection: s } = e;
|
|
3870
|
+
ye = !0, s && (s.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(s), i && i.deregister && i.deregister(s));
|
|
3871
|
+
}
|
|
3872
|
+
safeToRemove() {
|
|
3873
|
+
const { safeToRemove: e } = this.props;
|
|
3874
|
+
e && e();
|
|
3875
|
+
}
|
|
3876
|
+
render() {
|
|
3877
|
+
return null;
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
function vr(t) {
|
|
3881
|
+
const [e, n] = Us(), i = B(_e);
|
|
3882
|
+
return ht(Ac, { ...t, layoutGroup: i, switchLayoutGroup: B(Js), isPresent: e, safeToRemove: n });
|
|
3883
|
+
}
|
|
3884
|
+
const Vc = {
|
|
3885
|
+
borderRadius: {
|
|
3886
|
+
...Ct,
|
|
3887
|
+
applyTo: [
|
|
3888
|
+
"borderTopLeftRadius",
|
|
3889
|
+
"borderTopRightRadius",
|
|
3890
|
+
"borderBottomLeftRadius",
|
|
3891
|
+
"borderBottomRightRadius"
|
|
3892
|
+
]
|
|
3893
|
+
},
|
|
3894
|
+
borderTopLeftRadius: Ct,
|
|
3895
|
+
borderTopRightRadius: Ct,
|
|
3896
|
+
borderBottomLeftRadius: Ct,
|
|
3897
|
+
borderBottomRightRadius: Ct,
|
|
3898
|
+
boxShadow: Sc
|
|
3899
|
+
};
|
|
3900
|
+
function Cc(t, e, n) {
|
|
3901
|
+
const i = I(t) ? t : xt(t);
|
|
3902
|
+
return i.start(Vn("", i, e, n)), i.animation;
|
|
3903
|
+
}
|
|
3904
|
+
const Dc = (t, e) => t.depth - e.depth;
|
|
3905
|
+
class Mc {
|
|
3906
|
+
constructor() {
|
|
3907
|
+
this.children = [], this.isDirty = !1;
|
|
3908
|
+
}
|
|
3909
|
+
add(e) {
|
|
3910
|
+
Ye(this.children, e), this.isDirty = !0;
|
|
3911
|
+
}
|
|
3912
|
+
remove(e) {
|
|
3913
|
+
qe(this.children, e), this.isDirty = !0;
|
|
3914
|
+
}
|
|
3915
|
+
forEach(e) {
|
|
3916
|
+
this.isDirty && this.children.sort(Dc), this.isDirty = !1, this.children.forEach(e);
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
function Ec(t, e) {
|
|
3920
|
+
const n = j.now(), i = ({ timestamp: s }) => {
|
|
3921
|
+
const o = s - n;
|
|
3922
|
+
o >= e && (et(i), t(o - e));
|
|
3923
|
+
};
|
|
3924
|
+
return V.setup(i, !0), () => et(i);
|
|
3925
|
+
}
|
|
3926
|
+
const Tr = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], Rc = Tr.length, Pi = (t) => typeof t == "string" ? parseFloat(t) : t, bi = (t) => typeof t == "number" || w.test(t);
|
|
3927
|
+
function Lc(t, e, n, i, s, o) {
|
|
3928
|
+
s ? (t.opacity = D(0, n.opacity ?? 1, kc(i)), t.opacityExit = D(e.opacity ?? 1, 0, Fc(i))) : o && (t.opacity = D(e.opacity ?? 1, n.opacity ?? 1, i));
|
|
3929
|
+
for (let r = 0; r < Rc; r++) {
|
|
3930
|
+
const a = `border${Tr[r]}Radius`;
|
|
3931
|
+
let l = Si(e, a), u = Si(n, a);
|
|
3932
|
+
if (l === void 0 && u === void 0)
|
|
3933
|
+
continue;
|
|
3934
|
+
l || (l = 0), u || (u = 0), l === 0 || u === 0 || bi(l) === bi(u) ? (t[a] = Math.max(D(Pi(l), Pi(u), i), 0), (G.test(u) || G.test(l)) && (t[a] += "%")) : t[a] = u;
|
|
3935
|
+
}
|
|
3936
|
+
(e.rotate || n.rotate) && (t.rotate = D(e.rotate || 0, n.rotate || 0, i));
|
|
3937
|
+
}
|
|
3938
|
+
function Si(t, e) {
|
|
3939
|
+
return t[e] !== void 0 ? t[e] : t.borderRadius;
|
|
3940
|
+
}
|
|
3941
|
+
const kc = /* @__PURE__ */ xr(0, 0.5, os), Fc = /* @__PURE__ */ xr(0.5, 0.95, $);
|
|
3942
|
+
function xr(t, e, n) {
|
|
3943
|
+
return (i) => i < t ? 0 : i > e ? 1 : n(/* @__PURE__ */ Lt(t, e, i));
|
|
3944
|
+
}
|
|
3945
|
+
function Ai(t, e) {
|
|
3946
|
+
t.min = e.min, t.max = e.max;
|
|
3947
|
+
}
|
|
3948
|
+
function K(t, e) {
|
|
3949
|
+
Ai(t.x, e.x), Ai(t.y, e.y);
|
|
3950
|
+
}
|
|
3951
|
+
function Vi(t, e) {
|
|
3952
|
+
t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
|
|
3953
|
+
}
|
|
3954
|
+
function Ci(t, e, n, i, s) {
|
|
3955
|
+
return t -= e, t = te(t, 1 / n, i), s !== void 0 && (t = te(t, 1 / s, i)), t;
|
|
3956
|
+
}
|
|
3957
|
+
function Bc(t, e = 0, n = 1, i = 0.5, s, o = t, r = t) {
|
|
3958
|
+
if (G.test(e) && (e = parseFloat(e), e = D(r.min, r.max, e / 100) - r.min), typeof e != "number")
|
|
3959
|
+
return;
|
|
3960
|
+
let a = D(o.min, o.max, i);
|
|
3961
|
+
t === o && (a -= e), t.min = Ci(t.min, e, n, a, s), t.max = Ci(t.max, e, n, a, s);
|
|
3962
|
+
}
|
|
3963
|
+
function Di(t, e, [n, i, s], o, r) {
|
|
3964
|
+
Bc(t, e[n], e[i], e[s], e.scale, o, r);
|
|
3965
|
+
}
|
|
3966
|
+
const Ic = ["x", "scaleX", "originX"], Oc = ["y", "scaleY", "originY"];
|
|
3967
|
+
function Mi(t, e, n, i) {
|
|
3968
|
+
Di(t.x, e, Ic, n ? n.x : void 0, i ? i.x : void 0), Di(t.y, e, Oc, n ? n.y : void 0, i ? i.y : void 0);
|
|
3969
|
+
}
|
|
3970
|
+
function Ei(t) {
|
|
3971
|
+
return t.translate === 0 && t.scale === 1;
|
|
3972
|
+
}
|
|
3973
|
+
function wr(t) {
|
|
3974
|
+
return Ei(t.x) && Ei(t.y);
|
|
3975
|
+
}
|
|
3976
|
+
function Ri(t, e) {
|
|
3977
|
+
return t.min === e.min && t.max === e.max;
|
|
3978
|
+
}
|
|
3979
|
+
function jc(t, e) {
|
|
3980
|
+
return Ri(t.x, e.x) && Ri(t.y, e.y);
|
|
3981
|
+
}
|
|
3982
|
+
function Li(t, e) {
|
|
3983
|
+
return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
|
|
3984
|
+
}
|
|
3985
|
+
function Pr(t, e) {
|
|
3986
|
+
return Li(t.x, e.x) && Li(t.y, e.y);
|
|
3987
|
+
}
|
|
3988
|
+
function ki(t) {
|
|
3989
|
+
return O(t.x) / O(t.y);
|
|
3990
|
+
}
|
|
3991
|
+
function Fi(t, e) {
|
|
3992
|
+
return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
|
|
3993
|
+
}
|
|
3994
|
+
class Nc {
|
|
3995
|
+
constructor() {
|
|
3996
|
+
this.members = [];
|
|
3997
|
+
}
|
|
3998
|
+
add(e) {
|
|
3999
|
+
Ye(this.members, e), e.scheduleRender();
|
|
4000
|
+
}
|
|
4001
|
+
remove(e) {
|
|
4002
|
+
if (qe(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
|
|
4003
|
+
const n = this.members[this.members.length - 1];
|
|
4004
|
+
n && this.promote(n);
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
relegate(e) {
|
|
4008
|
+
const n = this.members.findIndex((s) => e === s);
|
|
4009
|
+
if (n === 0)
|
|
4010
|
+
return !1;
|
|
4011
|
+
let i;
|
|
4012
|
+
for (let s = n; s >= 0; s--) {
|
|
4013
|
+
const o = this.members[s];
|
|
4014
|
+
if (o.isPresent !== !1) {
|
|
4015
|
+
i = o;
|
|
4016
|
+
break;
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
return i ? (this.promote(i), !0) : !1;
|
|
4020
|
+
}
|
|
4021
|
+
promote(e, n) {
|
|
4022
|
+
const i = this.lead;
|
|
4023
|
+
if (e !== i && (this.prevLead = i, this.lead = e, e.show(), i)) {
|
|
4024
|
+
i.instance && i.scheduleRender(), e.scheduleRender(), e.resumeFrom = i, n && (e.resumeFrom.preserveOpacity = !0), i.snapshot && (e.snapshot = i.snapshot, e.snapshot.latestValues = i.animationValues || i.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
|
|
4025
|
+
const { crossfade: s } = e.options;
|
|
4026
|
+
s === !1 && i.hide();
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
exitAnimationComplete() {
|
|
4030
|
+
this.members.forEach((e) => {
|
|
4031
|
+
const { options: n, resumingFrom: i } = e;
|
|
4032
|
+
n.onExitComplete && n.onExitComplete(), i && i.options.onExitComplete && i.options.onExitComplete();
|
|
4033
|
+
});
|
|
4034
|
+
}
|
|
4035
|
+
scheduleRender() {
|
|
4036
|
+
this.members.forEach((e) => {
|
|
4037
|
+
e.instance && e.scheduleRender(!1);
|
|
4038
|
+
});
|
|
4039
|
+
}
|
|
4040
|
+
/**
|
|
4041
|
+
* Clear any leads that have been removed this render to prevent them from being
|
|
4042
|
+
* used in future animations and to prevent memory leaks
|
|
4043
|
+
*/
|
|
4044
|
+
removeLeadSnapshot() {
|
|
4045
|
+
this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
function Uc(t, e, n) {
|
|
4049
|
+
let i = "";
|
|
4050
|
+
const s = t.x.translate / e.x, o = t.y.translate / e.y, r = n?.z || 0;
|
|
4051
|
+
if ((s || o || r) && (i = `translate3d(${s}px, ${o}px, ${r}px) `), (e.x !== 1 || e.y !== 1) && (i += `scale(${1 / e.x}, ${1 / e.y}) `), n) {
|
|
4052
|
+
const { transformPerspective: u, rotate: c, rotateX: h, rotateY: f, skewX: d, skewY: m } = n;
|
|
4053
|
+
u && (i = `perspective(${u}px) ${i}`), c && (i += `rotate(${c}deg) `), h && (i += `rotateX(${h}deg) `), f && (i += `rotateY(${f}deg) `), d && (i += `skewX(${d}deg) `), m && (i += `skewY(${m}deg) `);
|
|
4054
|
+
}
|
|
4055
|
+
const a = t.x.scale * e.x, l = t.y.scale * e.y;
|
|
4056
|
+
return (a !== 1 || l !== 1) && (i += `scale(${a}, ${l})`), i || "none";
|
|
4057
|
+
}
|
|
4058
|
+
const ve = ["", "X", "Y", "Z"], Wc = 1e3;
|
|
4059
|
+
let $c = 0;
|
|
4060
|
+
function Te(t, e, n, i) {
|
|
4061
|
+
const { latestValues: s } = e;
|
|
4062
|
+
s[t] && (n[t] = s[t], e.setStaticValue(t, 0), i && (i[t] = 0));
|
|
4063
|
+
}
|
|
4064
|
+
function br(t) {
|
|
4065
|
+
if (t.hasCheckedOptimisedAppear = !0, t.root === t)
|
|
4066
|
+
return;
|
|
4067
|
+
const { visualElement: e } = t.options;
|
|
4068
|
+
if (!e)
|
|
4069
|
+
return;
|
|
4070
|
+
const n = lr(e);
|
|
4071
|
+
if (window.MotionHasOptimisedAnimation(n, "transform")) {
|
|
4072
|
+
const { layout: s, layoutId: o } = t.options;
|
|
4073
|
+
window.MotionCancelOptimisedAnimation(n, "transform", V, !(s || o));
|
|
4074
|
+
}
|
|
4075
|
+
const { parent: i } = t;
|
|
4076
|
+
i && !i.hasCheckedOptimisedAppear && br(i);
|
|
4077
|
+
}
|
|
4078
|
+
function Sr({ attachResizeListener: t, defaultParent: e, measureScroll: n, checkIsScrollRoot: i, resetTransform: s }) {
|
|
4079
|
+
return class {
|
|
4080
|
+
constructor(r = {}, a = e?.()) {
|
|
4081
|
+
this.id = $c++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
|
|
4082
|
+
this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
|
|
4083
|
+
}, this.updateProjection = () => {
|
|
4084
|
+
this.projectionUpdateScheduled = !1, this.nodes.forEach(Hc), this.nodes.forEach(Yc), this.nodes.forEach(qc), this.nodes.forEach(_c);
|
|
4085
|
+
}, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = r, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0;
|
|
4086
|
+
for (let l = 0; l < this.path.length; l++)
|
|
4087
|
+
this.path[l].shouldResetTransform = !0;
|
|
4088
|
+
this.root === this && (this.nodes = new Mc());
|
|
4089
|
+
}
|
|
4090
|
+
addEventListener(r, a) {
|
|
4091
|
+
return this.eventHandlers.has(r) || this.eventHandlers.set(r, new Je()), this.eventHandlers.get(r).add(a);
|
|
4092
|
+
}
|
|
4093
|
+
notifyListeners(r, ...a) {
|
|
4094
|
+
const l = this.eventHandlers.get(r);
|
|
4095
|
+
l && l.notify(...a);
|
|
4096
|
+
}
|
|
4097
|
+
hasListeners(r) {
|
|
4098
|
+
return this.eventHandlers.has(r);
|
|
4099
|
+
}
|
|
4100
|
+
/**
|
|
4101
|
+
* Lifecycles
|
|
4102
|
+
*/
|
|
4103
|
+
mount(r) {
|
|
4104
|
+
if (this.instance)
|
|
4105
|
+
return;
|
|
4106
|
+
this.isSVG = Ns(r) && !La(r), this.instance = r;
|
|
4107
|
+
const { layoutId: a, layout: l, visualElement: u } = this.options;
|
|
4108
|
+
if (u && !u.current && u.mount(r), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (l || a) && (this.isLayoutDirty = !0), t) {
|
|
4109
|
+
let c, h = 0;
|
|
4110
|
+
const f = () => this.root.updateBlockedByResize = !1;
|
|
4111
|
+
V.read(() => {
|
|
4112
|
+
h = window.innerWidth;
|
|
4113
|
+
}), t(r, () => {
|
|
4114
|
+
const d = window.innerWidth;
|
|
4115
|
+
d !== h && (h = d, this.root.updateBlockedByResize = !0, c && c(), c = Ec(f, 250), Yt.hasAnimatedSinceResize && (Yt.hasAnimatedSinceResize = !1, this.nodes.forEach(Oi)));
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
4118
|
+
a && this.root.registerSharedNode(a, this), this.options.animate !== !1 && u && (a || l) && this.addEventListener("didUpdate", ({ delta: c, hasLayoutChanged: h, hasRelativeLayoutChanged: f, layout: d }) => {
|
|
4119
|
+
if (this.isTreeAnimationBlocked()) {
|
|
4120
|
+
this.target = void 0, this.relativeTarget = void 0;
|
|
4121
|
+
return;
|
|
4122
|
+
}
|
|
4123
|
+
const m = this.options.transition || u.getDefaultTransition() || eu, { onLayoutAnimationStart: g, onLayoutAnimationComplete: T } = u.getProps(), p = !this.targetLayout || !Pr(this.targetLayout, d), v = !h && f;
|
|
4124
|
+
if (this.options.layoutRoot || this.resumeFrom || v || h && (p || !this.currentAnimation)) {
|
|
4125
|
+
this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
|
|
4126
|
+
const y = {
|
|
4127
|
+
...dn(m, "layout"),
|
|
4128
|
+
onPlay: g,
|
|
4129
|
+
onComplete: T
|
|
4130
|
+
};
|
|
4131
|
+
(u.shouldReduceMotion || this.options.layoutRoot) && (y.delay = 0, y.type = !1), this.startAnimation(y), this.setAnimationOrigin(c, v);
|
|
4132
|
+
} else
|
|
4133
|
+
h || Oi(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
|
|
4134
|
+
this.targetLayout = d;
|
|
4135
|
+
});
|
|
4136
|
+
}
|
|
4137
|
+
unmount() {
|
|
4138
|
+
this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
|
|
4139
|
+
const r = this.getStack();
|
|
4140
|
+
r && r.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), et(this.updateProjection);
|
|
4141
|
+
}
|
|
4142
|
+
// only on the root
|
|
4143
|
+
blockUpdate() {
|
|
4144
|
+
this.updateManuallyBlocked = !0;
|
|
4145
|
+
}
|
|
4146
|
+
unblockUpdate() {
|
|
4147
|
+
this.updateManuallyBlocked = !1;
|
|
4148
|
+
}
|
|
4149
|
+
isUpdateBlocked() {
|
|
4150
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
4151
|
+
}
|
|
4152
|
+
isTreeAnimationBlocked() {
|
|
4153
|
+
return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
|
|
4154
|
+
}
|
|
4155
|
+
// Note: currently only running on root node
|
|
4156
|
+
startUpdate() {
|
|
4157
|
+
this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Zc), this.animationId++);
|
|
4158
|
+
}
|
|
4159
|
+
getTransformTemplate() {
|
|
4160
|
+
const { visualElement: r } = this.options;
|
|
4161
|
+
return r && r.getProps().transformTemplate;
|
|
4162
|
+
}
|
|
4163
|
+
willUpdate(r = !0) {
|
|
4164
|
+
if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
|
|
4165
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
4166
|
+
return;
|
|
4167
|
+
}
|
|
4168
|
+
if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && br(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
|
|
4169
|
+
return;
|
|
4170
|
+
this.isLayoutDirty = !0;
|
|
4171
|
+
for (let c = 0; c < this.path.length; c++) {
|
|
4172
|
+
const h = this.path[c];
|
|
4173
|
+
h.shouldResetTransform = !0, h.updateScroll("snapshot"), h.options.layoutRoot && h.willUpdate(!1);
|
|
4174
|
+
}
|
|
4175
|
+
const { layoutId: a, layout: l } = this.options;
|
|
4176
|
+
if (a === void 0 && !l)
|
|
4177
|
+
return;
|
|
4178
|
+
const u = this.getTransformTemplate();
|
|
4179
|
+
this.prevTransformTemplateValue = u ? u(this.latestValues, "") : void 0, this.updateSnapshot(), r && this.notifyListeners("willUpdate");
|
|
4180
|
+
}
|
|
4181
|
+
update() {
|
|
4182
|
+
if (this.updateScheduled = !1, this.isUpdateBlocked()) {
|
|
4183
|
+
this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(Bi);
|
|
4184
|
+
return;
|
|
4185
|
+
}
|
|
4186
|
+
if (this.animationId <= this.animationCommitId) {
|
|
4187
|
+
this.nodes.forEach(Ii);
|
|
4188
|
+
return;
|
|
4189
|
+
}
|
|
4190
|
+
this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(Xc), this.nodes.forEach(Kc), this.nodes.forEach(zc)) : this.nodes.forEach(Ii), this.clearAllSnapshots();
|
|
4191
|
+
const a = j.now();
|
|
4192
|
+
F.delta = X(0, 1e3 / 60, a - F.timestamp), F.timestamp = a, F.isProcessing = !0, ae.update.process(F), ae.preRender.process(F), ae.render.process(F), F.isProcessing = !1;
|
|
4193
|
+
}
|
|
4194
|
+
didUpdate() {
|
|
4195
|
+
this.updateScheduled || (this.updateScheduled = !0, pn.read(this.scheduleUpdate));
|
|
4196
|
+
}
|
|
4197
|
+
clearAllSnapshots() {
|
|
4198
|
+
this.nodes.forEach(Gc), this.sharedNodes.forEach(Jc);
|
|
4199
|
+
}
|
|
4200
|
+
scheduleUpdateProjection() {
|
|
4201
|
+
this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, V.preRender(this.updateProjection, !1, !0));
|
|
4202
|
+
}
|
|
4203
|
+
scheduleCheckAfterUnmount() {
|
|
4204
|
+
V.postRender(() => {
|
|
4205
|
+
this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
|
|
4206
|
+
});
|
|
4207
|
+
}
|
|
4208
|
+
/**
|
|
4209
|
+
* Update measurements
|
|
4210
|
+
*/
|
|
4211
|
+
updateSnapshot() {
|
|
4212
|
+
this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !O(this.snapshot.measuredBox.x) && !O(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
|
|
4213
|
+
}
|
|
4214
|
+
updateLayout() {
|
|
4215
|
+
if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
|
|
4216
|
+
return;
|
|
4217
|
+
if (this.resumeFrom && !this.resumeFrom.instance)
|
|
4218
|
+
for (let l = 0; l < this.path.length; l++)
|
|
4219
|
+
this.path[l].updateScroll();
|
|
4220
|
+
const r = this.layout;
|
|
4221
|
+
this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected = L(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
|
|
4222
|
+
const { visualElement: a } = this.options;
|
|
4223
|
+
a && a.notify("LayoutMeasure", this.layout.layoutBox, r ? r.layoutBox : void 0);
|
|
4224
|
+
}
|
|
4225
|
+
updateScroll(r = "measure") {
|
|
4226
|
+
let a = !!(this.options.layoutScroll && this.instance);
|
|
4227
|
+
if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === r && (a = !1), a && this.instance) {
|
|
4228
|
+
const l = i(this.instance);
|
|
4229
|
+
this.scroll = {
|
|
4230
|
+
animationId: this.root.animationId,
|
|
4231
|
+
phase: r,
|
|
4232
|
+
isRoot: l,
|
|
4233
|
+
offset: n(this.instance),
|
|
4234
|
+
wasRoot: this.scroll ? this.scroll.isRoot : l
|
|
4235
|
+
};
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
resetTransform() {
|
|
4239
|
+
if (!s)
|
|
4240
|
+
return;
|
|
4241
|
+
const r = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !wr(this.projectionDelta), l = this.getTransformTemplate(), u = l ? l(this.latestValues, "") : void 0, c = u !== this.prevTransformTemplateValue;
|
|
4242
|
+
r && this.instance && (a || ot(this.latestValues) || c) && (s(this.instance, u), this.shouldResetTransform = !1, this.scheduleRender());
|
|
4243
|
+
}
|
|
4244
|
+
measure(r = !0) {
|
|
4245
|
+
const a = this.measurePageBox();
|
|
4246
|
+
let l = this.removeElementScroll(a);
|
|
4247
|
+
return r && (l = this.removeTransform(l)), nu(l), {
|
|
4248
|
+
animationId: this.root.animationId,
|
|
4249
|
+
measuredBox: a,
|
|
4250
|
+
layoutBox: l,
|
|
4251
|
+
latestValues: {},
|
|
4252
|
+
source: this.id
|
|
4253
|
+
};
|
|
4254
|
+
}
|
|
4255
|
+
measurePageBox() {
|
|
4256
|
+
const { visualElement: r } = this.options;
|
|
4257
|
+
if (!r)
|
|
4258
|
+
return L();
|
|
4259
|
+
const a = r.measureViewportBox();
|
|
4260
|
+
if (!(this.scroll?.wasRoot || this.path.some(iu))) {
|
|
4261
|
+
const { scroll: u } = this.root;
|
|
4262
|
+
u && (gt(a.x, u.offset.x), gt(a.y, u.offset.y));
|
|
4263
|
+
}
|
|
4264
|
+
return a;
|
|
4265
|
+
}
|
|
4266
|
+
removeElementScroll(r) {
|
|
4267
|
+
const a = L();
|
|
4268
|
+
if (K(a, r), this.scroll?.wasRoot)
|
|
4269
|
+
return a;
|
|
4270
|
+
for (let l = 0; l < this.path.length; l++) {
|
|
4271
|
+
const u = this.path[l], { scroll: c, options: h } = u;
|
|
4272
|
+
u !== this.root && c && h.layoutScroll && (c.wasRoot && K(a, r), gt(a.x, c.offset.x), gt(a.y, c.offset.y));
|
|
4273
|
+
}
|
|
4274
|
+
return a;
|
|
4275
|
+
}
|
|
4276
|
+
applyTransform(r, a = !1) {
|
|
4277
|
+
const l = L();
|
|
4278
|
+
K(l, r);
|
|
4279
|
+
for (let u = 0; u < this.path.length; u++) {
|
|
4280
|
+
const c = this.path[u];
|
|
4281
|
+
!a && c.options.layoutScroll && c.scroll && c !== c.root && yt(l, {
|
|
4282
|
+
x: -c.scroll.offset.x,
|
|
4283
|
+
y: -c.scroll.offset.y
|
|
4284
|
+
}), ot(c.latestValues) && yt(l, c.latestValues);
|
|
4285
|
+
}
|
|
4286
|
+
return ot(this.latestValues) && yt(l, this.latestValues), l;
|
|
4287
|
+
}
|
|
4288
|
+
removeTransform(r) {
|
|
4289
|
+
const a = L();
|
|
4290
|
+
K(a, r);
|
|
4291
|
+
for (let l = 0; l < this.path.length; l++) {
|
|
4292
|
+
const u = this.path[l];
|
|
4293
|
+
if (!u.instance || !ot(u.latestValues))
|
|
4294
|
+
continue;
|
|
4295
|
+
Oe(u.latestValues) && u.updateSnapshot();
|
|
4296
|
+
const c = L(), h = u.measurePageBox();
|
|
4297
|
+
K(c, h), Mi(a, u.latestValues, u.snapshot ? u.snapshot.layoutBox : void 0, c);
|
|
4298
|
+
}
|
|
4299
|
+
return ot(this.latestValues) && Mi(a, this.latestValues), a;
|
|
4300
|
+
}
|
|
4301
|
+
setTargetDelta(r) {
|
|
4302
|
+
this.targetDelta = r, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
|
|
4303
|
+
}
|
|
4304
|
+
setOptions(r) {
|
|
4305
|
+
this.options = {
|
|
4306
|
+
...this.options,
|
|
4307
|
+
...r,
|
|
4308
|
+
crossfade: r.crossfade !== void 0 ? r.crossfade : !0
|
|
4309
|
+
};
|
|
4310
|
+
}
|
|
4311
|
+
clearMeasurements() {
|
|
4312
|
+
this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
|
|
4313
|
+
}
|
|
4314
|
+
forceRelativeParentToResolveTarget() {
|
|
4315
|
+
this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== F.timestamp && this.relativeParent.resolveTargetDelta(!0);
|
|
4316
|
+
}
|
|
4317
|
+
resolveTargetDelta(r = !1) {
|
|
4318
|
+
const a = this.getLead();
|
|
4319
|
+
this.isProjectionDirty || (this.isProjectionDirty = a.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = a.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = a.isSharedProjectionDirty);
|
|
4320
|
+
const l = !!this.resumingFrom || this !== a;
|
|
4321
|
+
if (!(r || l && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
|
|
4322
|
+
return;
|
|
4323
|
+
const { layout: c, layoutId: h } = this.options;
|
|
4324
|
+
if (!this.layout || !(c || h))
|
|
4325
|
+
return;
|
|
4326
|
+
this.resolvedRelativeTargetAt = F.timestamp;
|
|
4327
|
+
const f = this.getClosestProjectingParent();
|
|
4328
|
+
f && this.linkedParentVersion !== f.layoutVersion && !f.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (f && f.layout ? this.createRelativeTarget(f, this.layout.layoutBox, f.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = L(), this.targetWithTransforms = L()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), cc(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : K(this.target, this.layout.layoutBox), nr(this.target, this.targetDelta)) : K(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? this.createRelativeTarget(f, this.target, f.target) : this.relativeParent = this.relativeTarget = void 0));
|
|
4329
|
+
}
|
|
4330
|
+
getClosestProjectingParent() {
|
|
4331
|
+
if (!(!this.parent || Oe(this.parent.latestValues) || er(this.parent.latestValues)))
|
|
4332
|
+
return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
|
|
4333
|
+
}
|
|
4334
|
+
isProjecting() {
|
|
4335
|
+
return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
4336
|
+
}
|
|
4337
|
+
createRelativeTarget(r, a, l) {
|
|
4338
|
+
this.relativeParent = r, this.linkedParentVersion = r.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = L(), this.relativeTargetOrigin = L(), ee(this.relativeTargetOrigin, a, l), K(this.relativeTarget, this.relativeTargetOrigin);
|
|
4339
|
+
}
|
|
4340
|
+
removeRelativeTarget() {
|
|
4341
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
4342
|
+
}
|
|
4343
|
+
calcProjection() {
|
|
4344
|
+
const r = this.getLead(), a = !!this.resumingFrom || this !== r;
|
|
4345
|
+
let l = !0;
|
|
4346
|
+
if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (l = !1), a && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === F.timestamp && (l = !1), l)
|
|
4347
|
+
return;
|
|
4348
|
+
const { layout: u, layoutId: c } = this.options;
|
|
4349
|
+
if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(u || c))
|
|
4350
|
+
return;
|
|
4351
|
+
K(this.layoutCorrected, this.layout.layoutBox);
|
|
4352
|
+
const h = this.treeScale.x, f = this.treeScale.y;
|
|
4353
|
+
wl(this.layoutCorrected, this.treeScale, this.path, a), r.layout && !r.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (r.target = r.layout.layoutBox, r.targetWithTransforms = L());
|
|
4354
|
+
const { target: d } = r;
|
|
4355
|
+
if (!d) {
|
|
4356
|
+
this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
|
|
4357
|
+
return;
|
|
4358
|
+
}
|
|
4359
|
+
!this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (Vi(this.prevProjectionDelta.x, this.projectionDelta.x), Vi(this.prevProjectionDelta.y, this.projectionDelta.y)), Rt(this.projectionDelta, this.layoutCorrected, d, this.latestValues), (this.treeScale.x !== h || this.treeScale.y !== f || !Fi(this.projectionDelta.x, this.prevProjectionDelta.x) || !Fi(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", d));
|
|
4360
|
+
}
|
|
4361
|
+
hide() {
|
|
4362
|
+
this.isVisible = !1;
|
|
4363
|
+
}
|
|
4364
|
+
show() {
|
|
4365
|
+
this.isVisible = !0;
|
|
4366
|
+
}
|
|
4367
|
+
scheduleRender(r = !0) {
|
|
4368
|
+
if (this.options.visualElement?.scheduleRender(), r) {
|
|
4369
|
+
const a = this.getStack();
|
|
4370
|
+
a && a.scheduleRender();
|
|
4371
|
+
}
|
|
4372
|
+
this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
|
|
4373
|
+
}
|
|
4374
|
+
createProjectionDeltas() {
|
|
4375
|
+
this.prevProjectionDelta = vt(), this.projectionDelta = vt(), this.projectionDeltaWithTransform = vt();
|
|
4376
|
+
}
|
|
4377
|
+
setAnimationOrigin(r, a = !1) {
|
|
4378
|
+
const l = this.snapshot, u = l ? l.latestValues : {}, c = { ...this.latestValues }, h = vt();
|
|
4379
|
+
(!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
|
|
4380
|
+
const f = L(), d = l ? l.source : void 0, m = this.layout ? this.layout.source : void 0, g = d !== m, T = this.getStack(), p = !T || T.members.length <= 1, v = !!(g && !p && this.options.crossfade === !0 && !this.path.some(tu));
|
|
4381
|
+
this.animationProgress = 0;
|
|
4382
|
+
let y;
|
|
4383
|
+
this.mixTargetDelta = (b) => {
|
|
4384
|
+
const x = b / 1e3;
|
|
4385
|
+
ji(h.x, r.x, x), ji(h.y, r.y, x), this.setTargetDelta(h), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (ee(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Qc(this.relativeTarget, this.relativeTargetOrigin, f, x), y && jc(this.relativeTarget, y) && (this.isProjectionDirty = !1), y || (y = L()), K(y, this.relativeTarget)), g && (this.animationValues = c, Lc(c, u, this.latestValues, x, v, p)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = x;
|
|
4386
|
+
}, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
4387
|
+
}
|
|
4388
|
+
startAnimation(r) {
|
|
4389
|
+
this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (et(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = V.update(() => {
|
|
4390
|
+
Yt.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = xt(0)), this.currentAnimation = Cc(this.motionValue, [0, 1e3], {
|
|
4391
|
+
...r,
|
|
4392
|
+
velocity: 0,
|
|
4393
|
+
isSync: !0,
|
|
4394
|
+
onUpdate: (a) => {
|
|
4395
|
+
this.mixTargetDelta(a), r.onUpdate && r.onUpdate(a);
|
|
4396
|
+
},
|
|
4397
|
+
onStop: () => {
|
|
4398
|
+
},
|
|
4399
|
+
onComplete: () => {
|
|
4400
|
+
r.onComplete && r.onComplete(), this.completeAnimation();
|
|
4401
|
+
}
|
|
4402
|
+
}), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
|
|
4403
|
+
});
|
|
4404
|
+
}
|
|
4405
|
+
completeAnimation() {
|
|
4406
|
+
this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
|
|
4407
|
+
const r = this.getStack();
|
|
4408
|
+
r && r.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
|
|
4409
|
+
}
|
|
4410
|
+
finishAnimation() {
|
|
4411
|
+
this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(Wc), this.currentAnimation.stop()), this.completeAnimation();
|
|
4412
|
+
}
|
|
4413
|
+
applyTransformsToTarget() {
|
|
4414
|
+
const r = this.getLead();
|
|
4415
|
+
let { targetWithTransforms: a, target: l, layout: u, latestValues: c } = r;
|
|
4416
|
+
if (!(!a || !l || !u)) {
|
|
4417
|
+
if (this !== r && this.layout && u && Ar(this.options.animationType, this.layout.layoutBox, u.layoutBox)) {
|
|
4418
|
+
l = this.target || L();
|
|
4419
|
+
const h = O(this.layout.layoutBox.x);
|
|
4420
|
+
l.x.min = r.target.x.min, l.x.max = l.x.min + h;
|
|
4421
|
+
const f = O(this.layout.layoutBox.y);
|
|
4422
|
+
l.y.min = r.target.y.min, l.y.max = l.y.min + f;
|
|
4423
|
+
}
|
|
4424
|
+
K(a, l), yt(a, c), Rt(this.projectionDeltaWithTransform, this.layoutCorrected, a, c);
|
|
4425
|
+
}
|
|
4426
|
+
}
|
|
4427
|
+
registerSharedNode(r, a) {
|
|
4428
|
+
this.sharedNodes.has(r) || this.sharedNodes.set(r, new Nc()), this.sharedNodes.get(r).add(a);
|
|
4429
|
+
const u = a.options.initialPromotionConfig;
|
|
4430
|
+
a.promote({
|
|
4431
|
+
transition: u ? u.transition : void 0,
|
|
4432
|
+
preserveFollowOpacity: u && u.shouldPreserveFollowOpacity ? u.shouldPreserveFollowOpacity(a) : void 0
|
|
4433
|
+
});
|
|
4434
|
+
}
|
|
4435
|
+
isLead() {
|
|
4436
|
+
const r = this.getStack();
|
|
4437
|
+
return r ? r.lead === this : !0;
|
|
4438
|
+
}
|
|
4439
|
+
getLead() {
|
|
4440
|
+
const { layoutId: r } = this.options;
|
|
4441
|
+
return r ? this.getStack()?.lead || this : this;
|
|
4442
|
+
}
|
|
4443
|
+
getPrevLead() {
|
|
4444
|
+
const { layoutId: r } = this.options;
|
|
4445
|
+
return r ? this.getStack()?.prevLead : void 0;
|
|
4446
|
+
}
|
|
4447
|
+
getStack() {
|
|
4448
|
+
const { layoutId: r } = this.options;
|
|
4449
|
+
if (r)
|
|
4450
|
+
return this.root.sharedNodes.get(r);
|
|
4451
|
+
}
|
|
4452
|
+
promote({ needsReset: r, transition: a, preserveFollowOpacity: l } = {}) {
|
|
4453
|
+
const u = this.getStack();
|
|
4454
|
+
u && u.promote(this, l), r && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a });
|
|
4455
|
+
}
|
|
4456
|
+
relegate() {
|
|
4457
|
+
const r = this.getStack();
|
|
4458
|
+
return r ? r.relegate(this) : !1;
|
|
4459
|
+
}
|
|
4460
|
+
resetSkewAndRotation() {
|
|
4461
|
+
const { visualElement: r } = this.options;
|
|
4462
|
+
if (!r)
|
|
4463
|
+
return;
|
|
4464
|
+
let a = !1;
|
|
4465
|
+
const { latestValues: l } = r;
|
|
4466
|
+
if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (a = !0), !a)
|
|
4467
|
+
return;
|
|
4468
|
+
const u = {};
|
|
4469
|
+
l.z && Te("z", r, u, this.animationValues);
|
|
4470
|
+
for (let c = 0; c < ve.length; c++)
|
|
4471
|
+
Te(`rotate${ve[c]}`, r, u, this.animationValues), Te(`skew${ve[c]}`, r, u, this.animationValues);
|
|
4472
|
+
r.render();
|
|
4473
|
+
for (const c in u)
|
|
4474
|
+
r.setStaticValue(c, u[c]), this.animationValues && (this.animationValues[c] = u[c]);
|
|
4475
|
+
r.scheduleRender();
|
|
4476
|
+
}
|
|
4477
|
+
applyProjectionStyles(r, a) {
|
|
4478
|
+
if (!this.instance || this.isSVG)
|
|
4479
|
+
return;
|
|
4480
|
+
if (!this.isVisible) {
|
|
4481
|
+
r.visibility = "hidden";
|
|
4482
|
+
return;
|
|
4483
|
+
}
|
|
4484
|
+
const l = this.getTransformTemplate();
|
|
4485
|
+
if (this.needsReset) {
|
|
4486
|
+
this.needsReset = !1, r.visibility = "", r.opacity = "", r.pointerEvents = Xt(a?.pointerEvents) || "", r.transform = l ? l(this.latestValues, "") : "none";
|
|
4487
|
+
return;
|
|
4488
|
+
}
|
|
4489
|
+
const u = this.getLead();
|
|
4490
|
+
if (!this.projectionDelta || !this.layout || !u.target) {
|
|
4491
|
+
this.options.layoutId && (r.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, r.pointerEvents = Xt(a?.pointerEvents) || ""), this.hasProjected && !ot(this.latestValues) && (r.transform = l ? l({}, "") : "none", this.hasProjected = !1);
|
|
4492
|
+
return;
|
|
4493
|
+
}
|
|
4494
|
+
r.visibility = "";
|
|
4495
|
+
const c = u.animationValues || u.latestValues;
|
|
4496
|
+
this.applyTransformsToTarget();
|
|
4497
|
+
let h = Uc(this.projectionDeltaWithTransform, this.treeScale, c);
|
|
4498
|
+
l && (h = l(c, h)), r.transform = h;
|
|
4499
|
+
const { x: f, y: d } = this.projectionDelta;
|
|
4500
|
+
r.transformOrigin = `${f.origin * 100}% ${d.origin * 100}% 0`, u.animationValues ? r.opacity = u === this ? c.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : c.opacityExit : r.opacity = u === this ? c.opacity !== void 0 ? c.opacity : "" : c.opacityExit !== void 0 ? c.opacityExit : 0;
|
|
4501
|
+
for (const m in It) {
|
|
4502
|
+
if (c[m] === void 0)
|
|
4503
|
+
continue;
|
|
4504
|
+
const { correct: g, applyTo: T, isCSSVariable: p } = It[m], v = h === "none" ? c[m] : g(c[m], u);
|
|
4505
|
+
if (T) {
|
|
4506
|
+
const y = T.length;
|
|
4507
|
+
for (let b = 0; b < y; b++)
|
|
4508
|
+
r[T[b]] = v;
|
|
4509
|
+
} else
|
|
4510
|
+
p ? this.options.visualElement.renderState.vars[m] = v : r[m] = v;
|
|
4511
|
+
}
|
|
4512
|
+
this.options.layoutId && (r.pointerEvents = u === this ? Xt(a?.pointerEvents) || "" : "none");
|
|
4513
|
+
}
|
|
4514
|
+
clearSnapshot() {
|
|
4515
|
+
this.resumeFrom = this.snapshot = void 0;
|
|
4516
|
+
}
|
|
4517
|
+
// Only run on root
|
|
4518
|
+
resetTree() {
|
|
4519
|
+
this.root.nodes.forEach((r) => r.currentAnimation?.stop()), this.root.nodes.forEach(Bi), this.root.sharedNodes.clear();
|
|
4520
|
+
}
|
|
4521
|
+
};
|
|
4522
|
+
}
|
|
4523
|
+
function Kc(t) {
|
|
4524
|
+
t.updateLayout();
|
|
4525
|
+
}
|
|
4526
|
+
function zc(t) {
|
|
4527
|
+
const e = t.resumeFrom?.snapshot || t.snapshot;
|
|
4528
|
+
if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
|
|
4529
|
+
const { layoutBox: n, measuredBox: i } = t.layout, { animationType: s } = t.options, o = e.source !== t.layout.source;
|
|
4530
|
+
s === "size" ? U((c) => {
|
|
4531
|
+
const h = o ? e.measuredBox[c] : e.layoutBox[c], f = O(h);
|
|
4532
|
+
h.min = n[c].min, h.max = h.min + f;
|
|
4533
|
+
}) : Ar(s, e.layoutBox, n) && U((c) => {
|
|
4534
|
+
const h = o ? e.measuredBox[c] : e.layoutBox[c], f = O(n[c]);
|
|
4535
|
+
h.max = h.min + f, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[c].max = t.relativeTarget[c].min + f);
|
|
4536
|
+
});
|
|
4537
|
+
const r = vt();
|
|
4538
|
+
Rt(r, n, e.layoutBox);
|
|
4539
|
+
const a = vt();
|
|
4540
|
+
o ? Rt(a, t.applyTransform(i, !0), e.measuredBox) : Rt(a, n, e.layoutBox);
|
|
4541
|
+
const l = !wr(r);
|
|
4542
|
+
let u = !1;
|
|
4543
|
+
if (!t.resumeFrom) {
|
|
4544
|
+
const c = t.getClosestProjectingParent();
|
|
4545
|
+
if (c && !c.resumeFrom) {
|
|
4546
|
+
const { snapshot: h, layout: f } = c;
|
|
4547
|
+
if (h && f) {
|
|
4548
|
+
const d = L();
|
|
4549
|
+
ee(d, e.layoutBox, h.layoutBox);
|
|
4550
|
+
const m = L();
|
|
4551
|
+
ee(m, n, f.layoutBox), Pr(d, m) || (u = !0), c.options.layoutRoot && (t.relativeTarget = m, t.relativeTargetOrigin = d, t.relativeParent = c);
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4555
|
+
t.notifyListeners("didUpdate", {
|
|
4556
|
+
layout: n,
|
|
4557
|
+
snapshot: e,
|
|
4558
|
+
delta: a,
|
|
4559
|
+
layoutDelta: r,
|
|
4560
|
+
hasLayoutChanged: l,
|
|
4561
|
+
hasRelativeLayoutChanged: u
|
|
4562
|
+
});
|
|
4563
|
+
} else if (t.isLead()) {
|
|
4564
|
+
const { onExitComplete: n } = t.options;
|
|
4565
|
+
n && n();
|
|
4566
|
+
}
|
|
4567
|
+
t.options.transition = void 0;
|
|
4568
|
+
}
|
|
4569
|
+
function Hc(t) {
|
|
4570
|
+
t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
|
|
4571
|
+
}
|
|
4572
|
+
function _c(t) {
|
|
4573
|
+
t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
|
|
4574
|
+
}
|
|
4575
|
+
function Gc(t) {
|
|
4576
|
+
t.clearSnapshot();
|
|
4577
|
+
}
|
|
4578
|
+
function Bi(t) {
|
|
4579
|
+
t.clearMeasurements();
|
|
4580
|
+
}
|
|
4581
|
+
function Ii(t) {
|
|
4582
|
+
t.isLayoutDirty = !1;
|
|
4583
|
+
}
|
|
4584
|
+
function Xc(t) {
|
|
4585
|
+
const { visualElement: e } = t.options;
|
|
4586
|
+
e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
|
|
4587
|
+
}
|
|
4588
|
+
function Oi(t) {
|
|
4589
|
+
t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
|
|
4590
|
+
}
|
|
4591
|
+
function Yc(t) {
|
|
4592
|
+
t.resolveTargetDelta();
|
|
4593
|
+
}
|
|
4594
|
+
function qc(t) {
|
|
4595
|
+
t.calcProjection();
|
|
4596
|
+
}
|
|
4597
|
+
function Zc(t) {
|
|
4598
|
+
t.resetSkewAndRotation();
|
|
4599
|
+
}
|
|
4600
|
+
function Jc(t) {
|
|
4601
|
+
t.removeLeadSnapshot();
|
|
4602
|
+
}
|
|
4603
|
+
function ji(t, e, n) {
|
|
4604
|
+
t.translate = D(e.translate, 0, n), t.scale = D(e.scale, 1, n), t.origin = e.origin, t.originPoint = e.originPoint;
|
|
4605
|
+
}
|
|
4606
|
+
function Ni(t, e, n, i) {
|
|
4607
|
+
t.min = D(e.min, n.min, i), t.max = D(e.max, n.max, i);
|
|
4608
|
+
}
|
|
4609
|
+
function Qc(t, e, n, i) {
|
|
4610
|
+
Ni(t.x, e.x, n.x, i), Ni(t.y, e.y, n.y, i);
|
|
4611
|
+
}
|
|
4612
|
+
function tu(t) {
|
|
4613
|
+
return t.animationValues && t.animationValues.opacityExit !== void 0;
|
|
4614
|
+
}
|
|
4615
|
+
const eu = {
|
|
4616
|
+
duration: 0.45,
|
|
4617
|
+
ease: [0.4, 0, 0.1, 1]
|
|
4618
|
+
}, Ui = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Wi = Ui("applewebkit/") && !Ui("chrome/") ? Math.round : $;
|
|
4619
|
+
function $i(t) {
|
|
4620
|
+
t.min = Wi(t.min), t.max = Wi(t.max);
|
|
4621
|
+
}
|
|
4622
|
+
function nu(t) {
|
|
4623
|
+
$i(t.x), $i(t.y);
|
|
4624
|
+
}
|
|
4625
|
+
function Ar(t, e, n) {
|
|
4626
|
+
return t === "position" || t === "preserve-aspect" && !lc(ki(e), ki(n), 0.2);
|
|
4627
|
+
}
|
|
4628
|
+
function iu(t) {
|
|
4629
|
+
return t !== t.root && t.scroll?.wasRoot;
|
|
4630
|
+
}
|
|
4631
|
+
const su = Sr({
|
|
4632
|
+
attachResizeListener: (t, e) => Ot(t, "resize", e),
|
|
4633
|
+
measureScroll: () => ({
|
|
4634
|
+
x: document.documentElement.scrollLeft || document.body.scrollLeft,
|
|
4635
|
+
y: document.documentElement.scrollTop || document.body.scrollTop
|
|
4636
|
+
}),
|
|
4637
|
+
checkIsScrollRoot: () => !0
|
|
4638
|
+
}), xe = {
|
|
4639
|
+
current: void 0
|
|
4640
|
+
}, Vr = Sr({
|
|
4641
|
+
measureScroll: (t) => ({
|
|
4642
|
+
x: t.scrollLeft,
|
|
4643
|
+
y: t.scrollTop
|
|
4644
|
+
}),
|
|
4645
|
+
defaultParent: () => {
|
|
4646
|
+
if (!xe.current) {
|
|
4647
|
+
const t = new su({});
|
|
4648
|
+
t.mount(window), t.setOptions({ layoutScroll: !0 }), xe.current = t;
|
|
4649
|
+
}
|
|
4650
|
+
return xe.current;
|
|
4651
|
+
},
|
|
4652
|
+
resetTransform: (t, e) => {
|
|
4653
|
+
t.style.transform = e !== void 0 ? e : "none";
|
|
4654
|
+
},
|
|
4655
|
+
checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
|
|
4656
|
+
}), ru = {
|
|
4657
|
+
pan: {
|
|
4658
|
+
Feature: bc
|
|
4659
|
+
},
|
|
4660
|
+
drag: {
|
|
4661
|
+
Feature: Pc,
|
|
4662
|
+
ProjectionNode: Vr,
|
|
4663
|
+
MeasureLayout: vr
|
|
4664
|
+
}
|
|
4665
|
+
};
|
|
4666
|
+
function Ki(t, e, n) {
|
|
4667
|
+
const { props: i } = t;
|
|
4668
|
+
t.animationState && i.whileHover && t.animationState.setActive("whileHover", n === "Start");
|
|
4669
|
+
const s = "onHover" + n, o = i[s];
|
|
4670
|
+
o && V.postRender(() => o(e, Wt(e)));
|
|
4671
|
+
}
|
|
4672
|
+
class ou extends it {
|
|
4673
|
+
mount() {
|
|
4674
|
+
const { current: e } = this.node;
|
|
4675
|
+
e && (this.unmount = Ca(e, (n, i) => (Ki(this.node, i, "Start"), (s) => Ki(this.node, s, "End"))));
|
|
4676
|
+
}
|
|
4677
|
+
unmount() {
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
class au extends it {
|
|
4681
|
+
constructor() {
|
|
4682
|
+
super(...arguments), this.isActive = !1;
|
|
4683
|
+
}
|
|
4684
|
+
onFocus() {
|
|
4685
|
+
let e = !1;
|
|
4686
|
+
try {
|
|
4687
|
+
e = this.node.current.matches(":focus-visible");
|
|
4688
|
+
} catch {
|
|
4689
|
+
e = !0;
|
|
4690
|
+
}
|
|
4691
|
+
!e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
|
|
4692
|
+
}
|
|
4693
|
+
onBlur() {
|
|
4694
|
+
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
|
|
4695
|
+
}
|
|
4696
|
+
mount() {
|
|
4697
|
+
this.unmount = jt(Ot(this.node.current, "focus", () => this.onFocus()), Ot(this.node.current, "blur", () => this.onBlur()));
|
|
4698
|
+
}
|
|
4699
|
+
unmount() {
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
function zi(t, e, n) {
|
|
4703
|
+
const { props: i } = t;
|
|
4704
|
+
if (t.current instanceof HTMLButtonElement && t.current.disabled)
|
|
4705
|
+
return;
|
|
4706
|
+
t.animationState && i.whileTap && t.animationState.setActive("whileTap", n === "Start");
|
|
4707
|
+
const s = "onTap" + (n === "End" ? "" : n), o = i[s];
|
|
4708
|
+
o && V.postRender(() => o(e, Wt(e)));
|
|
4709
|
+
}
|
|
4710
|
+
class lu extends it {
|
|
4711
|
+
mount() {
|
|
4712
|
+
const { current: e } = this.node;
|
|
4713
|
+
e && (this.unmount = Ra(e, (n, i) => (zi(this.node, i, "Start"), (s, { success: o }) => zi(this.node, s, o ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
|
|
4714
|
+
}
|
|
4715
|
+
unmount() {
|
|
4716
|
+
}
|
|
4717
|
+
}
|
|
4718
|
+
const ze = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakMap(), cu = (t) => {
|
|
4719
|
+
const e = ze.get(t.target);
|
|
4720
|
+
e && e(t);
|
|
4721
|
+
}, uu = (t) => {
|
|
4722
|
+
t.forEach(cu);
|
|
4723
|
+
};
|
|
4724
|
+
function hu({ root: t, ...e }) {
|
|
4725
|
+
const n = t || document;
|
|
4726
|
+
we.has(n) || we.set(n, {});
|
|
4727
|
+
const i = we.get(n), s = JSON.stringify(e);
|
|
4728
|
+
return i[s] || (i[s] = new IntersectionObserver(uu, { root: t, ...e })), i[s];
|
|
4729
|
+
}
|
|
4730
|
+
function fu(t, e, n) {
|
|
4731
|
+
const i = hu(e);
|
|
4732
|
+
return ze.set(t, n), i.observe(t), () => {
|
|
4733
|
+
ze.delete(t), i.unobserve(t);
|
|
4734
|
+
};
|
|
4735
|
+
}
|
|
4736
|
+
const du = {
|
|
4737
|
+
some: 0,
|
|
4738
|
+
all: 1
|
|
4739
|
+
};
|
|
4740
|
+
class mu extends it {
|
|
4741
|
+
constructor() {
|
|
4742
|
+
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
|
|
4743
|
+
}
|
|
4744
|
+
startObserver() {
|
|
4745
|
+
this.unmount();
|
|
4746
|
+
const { viewport: e = {} } = this.node.getProps(), { root: n, margin: i, amount: s = "some", once: o } = e, r = {
|
|
4747
|
+
root: n ? n.current : void 0,
|
|
4748
|
+
rootMargin: i,
|
|
4749
|
+
threshold: typeof s == "number" ? s : du[s]
|
|
4750
|
+
}, a = (l) => {
|
|
4751
|
+
const { isIntersecting: u } = l;
|
|
4752
|
+
if (this.isInView === u || (this.isInView = u, o && !u && this.hasEnteredView))
|
|
4753
|
+
return;
|
|
4754
|
+
u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
|
|
4755
|
+
const { onViewportEnter: c, onViewportLeave: h } = this.node.getProps(), f = u ? c : h;
|
|
4756
|
+
f && f(l);
|
|
4757
|
+
};
|
|
4758
|
+
return fu(this.node.current, r, a);
|
|
4759
|
+
}
|
|
4760
|
+
mount() {
|
|
4761
|
+
this.startObserver();
|
|
4762
|
+
}
|
|
4763
|
+
update() {
|
|
4764
|
+
if (typeof IntersectionObserver > "u")
|
|
4765
|
+
return;
|
|
4766
|
+
const { props: e, prevProps: n } = this.node;
|
|
4767
|
+
["amount", "margin", "root"].some(pu(e, n)) && this.startObserver();
|
|
4768
|
+
}
|
|
4769
|
+
unmount() {
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
function pu({ viewport: t = {} }, { viewport: e = {} } = {}) {
|
|
4773
|
+
return (n) => t[n] !== e[n];
|
|
4774
|
+
}
|
|
4775
|
+
const gu = {
|
|
4776
|
+
inView: {
|
|
4777
|
+
Feature: mu
|
|
4778
|
+
},
|
|
4779
|
+
tap: {
|
|
4780
|
+
Feature: lu
|
|
4781
|
+
},
|
|
4782
|
+
focus: {
|
|
4783
|
+
Feature: au
|
|
4784
|
+
},
|
|
4785
|
+
hover: {
|
|
4786
|
+
Feature: ou
|
|
4787
|
+
}
|
|
4788
|
+
}, yu = {
|
|
4789
|
+
layout: {
|
|
4790
|
+
ProjectionNode: Vr,
|
|
4791
|
+
MeasureLayout: vr
|
|
4792
|
+
}
|
|
4793
|
+
}, vu = {
|
|
4794
|
+
...nc,
|
|
4795
|
+
...gu,
|
|
4796
|
+
...ru,
|
|
4797
|
+
...yu
|
|
4798
|
+
}, Du = /* @__PURE__ */ vl(vu, Rl);
|
|
4799
|
+
function Hi(t, e) {
|
|
4800
|
+
let n;
|
|
4801
|
+
return (...i) => {
|
|
4802
|
+
window.clearTimeout(n), n = window.setTimeout(() => t(...i), e);
|
|
4803
|
+
};
|
|
4804
|
+
}
|
|
4805
|
+
function Mu({ debounce: t, scroll: e, polyfill: n, offsetSize: i } = { debounce: 0, scroll: !1, offsetSize: !1 }) {
|
|
4806
|
+
const s = n || (typeof window > "u" ? class {
|
|
4807
|
+
} : window.ResizeObserver);
|
|
4808
|
+
if (!s) throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
|
|
4809
|
+
const [o, r] = Pe({ left: 0, top: 0, width: 0, height: 0, bottom: 0, right: 0, x: 0, y: 0 }), a = _({ element: null, scrollContainers: null, resizeObserver: null, lastBounds: o, orientationHandler: null }), l = t ? typeof t == "number" ? t : t.scroll : null, u = t ? typeof t == "number" ? t : t.resize : null, c = _(!1);
|
|
4810
|
+
Q(() => (c.current = !0, () => void (c.current = !1)));
|
|
4811
|
+
const [h, f, d] = tt(() => {
|
|
4812
|
+
const p = () => {
|
|
4813
|
+
if (!a.current.element) return;
|
|
4814
|
+
const { left: v, top: y, width: b, height: x, bottom: S, right: A, x: P, y: E } = a.current.element.getBoundingClientRect(), M = { left: v, top: y, width: b, height: x, bottom: S, right: A, x: P, y: E };
|
|
4815
|
+
a.current.element instanceof HTMLElement && i && (M.height = a.current.element.offsetHeight, M.width = a.current.element.offsetWidth), Object.freeze(M), c.current && !Pu(a.current.lastBounds, M) && r(a.current.lastBounds = M);
|
|
4816
|
+
};
|
|
4817
|
+
return [p, u ? Hi(p, u) : p, l ? Hi(p, l) : p];
|
|
4818
|
+
}, [r, i, l, u]);
|
|
4819
|
+
function m() {
|
|
4820
|
+
a.current.scrollContainers && (a.current.scrollContainers.forEach((p) => p.removeEventListener("scroll", d, !0)), a.current.scrollContainers = null), a.current.resizeObserver && (a.current.resizeObserver.disconnect(), a.current.resizeObserver = null), a.current.orientationHandler && ("orientation" in screen && "removeEventListener" in screen.orientation ? screen.orientation.removeEventListener("change", a.current.orientationHandler) : "onorientationchange" in window && window.removeEventListener("orientationchange", a.current.orientationHandler));
|
|
4821
|
+
}
|
|
4822
|
+
function g() {
|
|
4823
|
+
a.current.element && (a.current.resizeObserver = new s(d), a.current.resizeObserver.observe(a.current.element), e && a.current.scrollContainers && a.current.scrollContainers.forEach((p) => p.addEventListener("scroll", d, { capture: !0, passive: !0 })), a.current.orientationHandler = () => {
|
|
4824
|
+
d();
|
|
4825
|
+
}, "orientation" in screen && "addEventListener" in screen.orientation ? screen.orientation.addEventListener("change", a.current.orientationHandler) : "onorientationchange" in window && window.addEventListener("orientationchange", a.current.orientationHandler));
|
|
4826
|
+
}
|
|
4827
|
+
const T = (p) => {
|
|
4828
|
+
!p || p === a.current.element || (m(), a.current.element = p, a.current.scrollContainers = Cr(p), g());
|
|
4829
|
+
};
|
|
4830
|
+
return xu(d, !!e), Tu(f), Q(() => {
|
|
4831
|
+
m(), g();
|
|
4832
|
+
}, [e, d, f]), Q(() => m, []), [T, o, h];
|
|
4833
|
+
}
|
|
4834
|
+
function Tu(t) {
|
|
4835
|
+
Q(() => {
|
|
4836
|
+
const e = t;
|
|
4837
|
+
return window.addEventListener("resize", e), () => void window.removeEventListener("resize", e);
|
|
4838
|
+
}, [t]);
|
|
4839
|
+
}
|
|
4840
|
+
function xu(t, e) {
|
|
4841
|
+
Q(() => {
|
|
4842
|
+
if (e) {
|
|
4843
|
+
const n = t;
|
|
4844
|
+
return window.addEventListener("scroll", n, { capture: !0, passive: !0 }), () => void window.removeEventListener("scroll", n, !0);
|
|
4845
|
+
}
|
|
4846
|
+
}, [t, e]);
|
|
4847
|
+
}
|
|
4848
|
+
function Cr(t) {
|
|
4849
|
+
const e = [];
|
|
4850
|
+
if (!t || t === document.body) return e;
|
|
4851
|
+
const { overflow: n, overflowX: i, overflowY: s } = window.getComputedStyle(t);
|
|
4852
|
+
return [n, i, s].some((o) => o === "auto" || o === "scroll") && e.push(t), [...e, ...Cr(t.parentElement)];
|
|
4853
|
+
}
|
|
4854
|
+
const wu = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Pu = (t, e) => wu.every((n) => t[n] === e[n]);
|
|
4855
|
+
export {
|
|
4856
|
+
Vu as A,
|
|
4857
|
+
Mu as j,
|
|
4858
|
+
Du as m
|
|
4859
|
+
};
|