@mobielnl/elements 0.11.0 → 0.12.0
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/elements.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.umd.cjs +67 -67
- package/dist/index-DvroE0jz.js +1763 -0
- package/dist/{index-BWGnaurV.js → index-mlCkaaRU.js} +12249 -11397
- package/package.json +29 -28
- package/dist/index-BTccuk-X.js +0 -2525
package/dist/index-BTccuk-X.js
DELETED
|
@@ -1,2525 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { i as H, m as oe, r as bt, h as xn, a as Tt, w as ue, b as Ke, c as P, d as z, e as ye, f as q, n as Vt, p as St, t as wt, g as Mn, j as Cn, v as Pn, k as Fn, l as Dn, o as En, q as Ye, s as At, u as On, x as In, y as K, z as Rn, A as kn, B as le, C as Xe, D as xt, E as Kn, F as Nn, G as Bn, H as Mt, I as Ln, J as Gn, K as _n, L as jn, M as Un, N as Ct, O as Pt, P as Ft, Q as Dt } from "./index-BWGnaurV.js";
|
|
3
|
-
import { Fragment as $n } from "react";
|
|
4
|
-
var ke = typeof globalThis < "u" && globalThis.process ? globalThis.process : { env: { NODE_ENV: "production" } };
|
|
5
|
-
function Wn(t, e) {
|
|
6
|
-
t.indexOf(e) === -1 && t.push(e);
|
|
7
|
-
}
|
|
8
|
-
function Hn(t, e) {
|
|
9
|
-
const n = t.indexOf(e);
|
|
10
|
-
n > -1 && t.splice(n, 1);
|
|
11
|
-
}
|
|
12
|
-
const k = {}, Et = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), Ot = (t) => /^0[^.\s]+$/u.test(t);
|
|
13
|
-
// @__NO_SIDE_EFFECTS__
|
|
14
|
-
function Ne(t) {
|
|
15
|
-
let e;
|
|
16
|
-
return () => (e === void 0 && (e = t()), e);
|
|
17
|
-
}
|
|
18
|
-
const Y = /* @__NO_SIDE_EFFECTS__ */ (t) => t, qn = (t, e) => (n) => e(t(n)), ce = (...t) => t.reduce(qn), It = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
|
|
19
|
-
const s = e - t;
|
|
20
|
-
return s === 0 ? 1 : (n - t) / s;
|
|
21
|
-
};
|
|
22
|
-
class Rt {
|
|
23
|
-
constructor() {
|
|
24
|
-
this.subscriptions = [];
|
|
25
|
-
}
|
|
26
|
-
add(e) {
|
|
27
|
-
return Wn(this.subscriptions, e), () => Hn(this.subscriptions, e);
|
|
28
|
-
}
|
|
29
|
-
notify(e, n, s) {
|
|
30
|
-
const i = this.subscriptions.length;
|
|
31
|
-
if (i)
|
|
32
|
-
if (i === 1)
|
|
33
|
-
this.subscriptions[0](e, n, s);
|
|
34
|
-
else
|
|
35
|
-
for (let r = 0; r < i; r++) {
|
|
36
|
-
const a = this.subscriptions[r];
|
|
37
|
-
a && a(e, n, s);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
getSize() {
|
|
41
|
-
return this.subscriptions.length;
|
|
42
|
-
}
|
|
43
|
-
clear() {
|
|
44
|
-
this.subscriptions.length = 0;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const R = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, O = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
|
|
48
|
-
function kt(t, e) {
|
|
49
|
-
return e ? t * (1e3 / e) : 0;
|
|
50
|
-
}
|
|
51
|
-
const Kt = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, zn = 1e-7, Yn = 12;
|
|
52
|
-
function Xn(t, e, n, s, i) {
|
|
53
|
-
let r, a, o = 0;
|
|
54
|
-
do
|
|
55
|
-
a = e + (n - e) / 2, r = Kt(a, s, i) - t, r > 0 ? n = a : e = a;
|
|
56
|
-
while (Math.abs(r) > zn && ++o < Yn);
|
|
57
|
-
return a;
|
|
58
|
-
}
|
|
59
|
-
function J(t, e, n, s) {
|
|
60
|
-
if (t === e && n === s)
|
|
61
|
-
return Y;
|
|
62
|
-
const i = (r) => Xn(r, 0, 1, t, n);
|
|
63
|
-
return (r) => r === 0 || r === 1 ? r : Kt(i(r), e, s);
|
|
64
|
-
}
|
|
65
|
-
const Nt = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, Bt = (t) => (e) => 1 - t(1 - e), Lt = /* @__PURE__ */ J(0.33, 1.53, 0.69, 0.99), Be = /* @__PURE__ */ Bt(Lt), Gt = /* @__PURE__ */ Nt(Be), _t = (t) => (t *= 2) < 1 ? 0.5 * Be(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Le = (t) => 1 - Math.sin(Math.acos(t)), Zn = Bt(Le), jt = Nt(Le), Jn = /* @__PURE__ */ J(0.42, 0, 1, 1), Qn = /* @__PURE__ */ J(0, 0, 0.58, 1), Ut = /* @__PURE__ */ J(0.42, 0, 0.58, 1), es = (t) => Array.isArray(t) && typeof t[0] != "number", $t = (t) => Array.isArray(t) && typeof t[0] == "number", Ze = {
|
|
66
|
-
linear: Y,
|
|
67
|
-
easeIn: Jn,
|
|
68
|
-
easeInOut: Ut,
|
|
69
|
-
easeOut: Qn,
|
|
70
|
-
circIn: Le,
|
|
71
|
-
circInOut: jt,
|
|
72
|
-
circOut: Zn,
|
|
73
|
-
backIn: Be,
|
|
74
|
-
backInOut: Gt,
|
|
75
|
-
backOut: Lt,
|
|
76
|
-
anticipate: _t
|
|
77
|
-
}, ts = (t) => typeof t == "string", Je = (t) => {
|
|
78
|
-
if ($t(t)) {
|
|
79
|
-
H(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
|
|
80
|
-
const [e, n, s, i] = t;
|
|
81
|
-
return J(e, n, s, i);
|
|
82
|
-
} else if (ts(t))
|
|
83
|
-
return H(Ze[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), Ze[t];
|
|
84
|
-
return t;
|
|
85
|
-
}, Q = [
|
|
86
|
-
"setup",
|
|
87
|
-
// Compute
|
|
88
|
-
"read",
|
|
89
|
-
// Read
|
|
90
|
-
"resolveKeyframes",
|
|
91
|
-
// Write/Read/Write/Read
|
|
92
|
-
"preUpdate",
|
|
93
|
-
// Compute
|
|
94
|
-
"update",
|
|
95
|
-
// Compute
|
|
96
|
-
"preRender",
|
|
97
|
-
// Compute
|
|
98
|
-
"render",
|
|
99
|
-
// Write
|
|
100
|
-
"postRender"
|
|
101
|
-
// Compute
|
|
102
|
-
];
|
|
103
|
-
function ns(t, e) {
|
|
104
|
-
let n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = !1, r = !1;
|
|
105
|
-
const a = /* @__PURE__ */ new WeakSet();
|
|
106
|
-
let o = {
|
|
107
|
-
delta: 0,
|
|
108
|
-
timestamp: 0,
|
|
109
|
-
isProcessing: !1
|
|
110
|
-
};
|
|
111
|
-
function l(u) {
|
|
112
|
-
a.has(u) && (c.schedule(u), t()), u(o);
|
|
113
|
-
}
|
|
114
|
-
const c = {
|
|
115
|
-
/**
|
|
116
|
-
* Schedule a process to run on the next frame.
|
|
117
|
-
*/
|
|
118
|
-
schedule: (u, h = !1, d = !1) => {
|
|
119
|
-
const b = d && i ? n : s;
|
|
120
|
-
return h && a.add(u), b.has(u) || b.add(u), u;
|
|
121
|
-
},
|
|
122
|
-
/**
|
|
123
|
-
* Cancel the provided callback from running on the next frame.
|
|
124
|
-
*/
|
|
125
|
-
cancel: (u) => {
|
|
126
|
-
s.delete(u), a.delete(u);
|
|
127
|
-
},
|
|
128
|
-
/**
|
|
129
|
-
* Execute all schedule callbacks.
|
|
130
|
-
*/
|
|
131
|
-
process: (u) => {
|
|
132
|
-
if (o = u, i) {
|
|
133
|
-
r = !0;
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
i = !0, [n, s] = [s, n], n.forEach(l), n.clear(), i = !1, r && (r = !1, c.process(u));
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
return c;
|
|
140
|
-
}
|
|
141
|
-
const ss = 40;
|
|
142
|
-
function Wt(t, e) {
|
|
143
|
-
let n = !1, s = !0;
|
|
144
|
-
const i = {
|
|
145
|
-
delta: 0,
|
|
146
|
-
timestamp: 0,
|
|
147
|
-
isProcessing: !1
|
|
148
|
-
}, r = () => n = !0, a = Q.reduce((g, A) => (g[A] = ns(r), g), {}), { setup: o, read: l, resolveKeyframes: c, preUpdate: u, update: h, preRender: d, render: f, postRender: b } = a, T = () => {
|
|
149
|
-
const g = k.useManualTiming ? i.timestamp : performance.now();
|
|
150
|
-
n = !1, k.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(g - i.timestamp, ss), 1)), i.timestamp = g, i.isProcessing = !0, o.process(i), l.process(i), c.process(i), u.process(i), h.process(i), d.process(i), f.process(i), b.process(i), i.isProcessing = !1, n && e && (s = !1, t(T));
|
|
151
|
-
}, v = () => {
|
|
152
|
-
n = !0, s = !0, i.isProcessing || t(T);
|
|
153
|
-
};
|
|
154
|
-
return { schedule: Q.reduce((g, A) => {
|
|
155
|
-
const m = a[A];
|
|
156
|
-
return g[A] = (S, x = !1, y = !1) => (n || v(), m.schedule(S, x, y)), g;
|
|
157
|
-
}, {}), cancel: (g) => {
|
|
158
|
-
for (let A = 0; A < Q.length; A++)
|
|
159
|
-
a[Q[A]].cancel(g);
|
|
160
|
-
}, state: i, steps: a };
|
|
161
|
-
}
|
|
162
|
-
const { schedule: I, cancel: ve, state: ne } = /* @__PURE__ */ Wt(typeof requestAnimationFrame < "u" ? requestAnimationFrame : Y, !0);
|
|
163
|
-
let ee;
|
|
164
|
-
function is() {
|
|
165
|
-
ee = void 0;
|
|
166
|
-
}
|
|
167
|
-
const F = {
|
|
168
|
-
now: () => (ee === void 0 && F.set(ne.isProcessing || k.useManualTiming ? ne.timestamp : performance.now()), ee),
|
|
169
|
-
set: (t) => {
|
|
170
|
-
ee = t, queueMicrotask(is);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
function he(t, e, n) {
|
|
174
|
-
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;
|
|
175
|
-
}
|
|
176
|
-
function rs({ hue: t, saturation: e, lightness: n, alpha: s }) {
|
|
177
|
-
t /= 360, e /= 100, n /= 100;
|
|
178
|
-
let i = 0, r = 0, a = 0;
|
|
179
|
-
if (!e)
|
|
180
|
-
i = r = a = n;
|
|
181
|
-
else {
|
|
182
|
-
const o = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - o;
|
|
183
|
-
i = he(l, o, t + 1 / 3), r = he(l, o, t), a = he(l, o, t - 1 / 3);
|
|
184
|
-
}
|
|
185
|
-
return {
|
|
186
|
-
red: Math.round(i * 255),
|
|
187
|
-
green: Math.round(r * 255),
|
|
188
|
-
blue: Math.round(a * 255),
|
|
189
|
-
alpha: s
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function se(t, e) {
|
|
193
|
-
return (n) => n > 0 ? e : t;
|
|
194
|
-
}
|
|
195
|
-
const de = (t, e, n) => {
|
|
196
|
-
const s = t * t, i = n * (e * e - s) + s;
|
|
197
|
-
return i < 0 ? 0 : Math.sqrt(i);
|
|
198
|
-
}, as = [xn, bt, Tt], os = (t) => as.find((e) => e.test(t));
|
|
199
|
-
function Qe(t) {
|
|
200
|
-
const e = os(t);
|
|
201
|
-
if (ue(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
|
|
202
|
-
return !1;
|
|
203
|
-
let n = e.parse(t);
|
|
204
|
-
return e === Tt && (n = rs(n)), n;
|
|
205
|
-
}
|
|
206
|
-
const et = (t, e) => {
|
|
207
|
-
const n = Qe(t), s = Qe(e);
|
|
208
|
-
if (!n || !s)
|
|
209
|
-
return se(t, e);
|
|
210
|
-
const i = { ...n };
|
|
211
|
-
return (r) => (i.red = de(n.red, s.red, r), i.green = de(n.green, s.green, r), i.blue = de(n.blue, s.blue, r), i.alpha = oe(n.alpha, s.alpha, r), bt.transform(i));
|
|
212
|
-
}, be = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
213
|
-
function us(t, e) {
|
|
214
|
-
return be.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
|
|
215
|
-
}
|
|
216
|
-
function ls(t, e) {
|
|
217
|
-
return (n) => oe(t, e, n);
|
|
218
|
-
}
|
|
219
|
-
function Ge(t) {
|
|
220
|
-
return typeof t == "number" ? ls : typeof t == "string" ? Ke(t) ? se : P.test(t) ? et : ds : Array.isArray(t) ? Ht : typeof t == "object" ? P.test(t) ? et : cs : se;
|
|
221
|
-
}
|
|
222
|
-
function Ht(t, e) {
|
|
223
|
-
const n = [...t], s = n.length, i = t.map((r, a) => Ge(r)(r, e[a]));
|
|
224
|
-
return (r) => {
|
|
225
|
-
for (let a = 0; a < s; a++)
|
|
226
|
-
n[a] = i[a](r);
|
|
227
|
-
return n;
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function cs(t, e) {
|
|
231
|
-
const n = { ...t, ...e }, s = {};
|
|
232
|
-
for (const i in n)
|
|
233
|
-
t[i] !== void 0 && e[i] !== void 0 && (s[i] = Ge(t[i])(t[i], e[i]));
|
|
234
|
-
return (i) => {
|
|
235
|
-
for (const r in s)
|
|
236
|
-
n[r] = s[r](i);
|
|
237
|
-
return n;
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
function hs(t, e) {
|
|
241
|
-
const n = [], s = { color: 0, var: 0, number: 0 };
|
|
242
|
-
for (let i = 0; i < e.values.length; i++) {
|
|
243
|
-
const r = e.types[i], a = t.indexes[r][s[r]], o = t.values[a] ?? 0;
|
|
244
|
-
n[i] = o, s[r]++;
|
|
245
|
-
}
|
|
246
|
-
return n;
|
|
247
|
-
}
|
|
248
|
-
const ds = (t, e) => {
|
|
249
|
-
const n = z.createTransformer(e), s = ye(t), i = ye(e);
|
|
250
|
-
return s.indexes.var.length === i.indexes.var.length && s.indexes.color.length === i.indexes.color.length && s.indexes.number.length >= i.indexes.number.length ? be.has(t) && !i.values.length || be.has(e) && !s.values.length ? us(t, e) : ce(Ht(hs(s, i), i.values), n) : (ue(!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"), se(t, e));
|
|
251
|
-
};
|
|
252
|
-
function qt(t, e, n) {
|
|
253
|
-
return typeof t == "number" && typeof e == "number" && typeof n == "number" ? oe(t, e, n) : Ge(t)(t, e);
|
|
254
|
-
}
|
|
255
|
-
const fs = (t) => {
|
|
256
|
-
const e = ({ timestamp: n }) => t(n);
|
|
257
|
-
return {
|
|
258
|
-
start: (n = !0) => I.update(e, n),
|
|
259
|
-
stop: () => ve(e),
|
|
260
|
-
/**
|
|
261
|
-
* If we're processing this frame we can use the
|
|
262
|
-
* framelocked timestamp to keep things in sync.
|
|
263
|
-
*/
|
|
264
|
-
now: () => ne.isProcessing ? ne.timestamp : F.now()
|
|
265
|
-
};
|
|
266
|
-
}, zt = (t, e, n = 10) => {
|
|
267
|
-
let s = "";
|
|
268
|
-
const i = Math.max(Math.round(e / n), 2);
|
|
269
|
-
for (let r = 0; r < i; r++)
|
|
270
|
-
s += Math.round(t(r / (i - 1)) * 1e4) / 1e4 + ", ";
|
|
271
|
-
return `linear(${s.substring(0, s.length - 2)})`;
|
|
272
|
-
}, ie = 2e4;
|
|
273
|
-
function _e(t) {
|
|
274
|
-
let e = 0;
|
|
275
|
-
const n = 50;
|
|
276
|
-
let s = t.next(e);
|
|
277
|
-
for (; !s.done && e < ie; )
|
|
278
|
-
e += n, s = t.next(e);
|
|
279
|
-
return e >= ie ? 1 / 0 : e;
|
|
280
|
-
}
|
|
281
|
-
function ps(t, e = 100, n) {
|
|
282
|
-
const s = n({ ...t, keyframes: [0, e] }), i = Math.min(_e(s), ie);
|
|
283
|
-
return {
|
|
284
|
-
type: "keyframes",
|
|
285
|
-
ease: (r) => s.next(i * r).value / e,
|
|
286
|
-
duration: /* @__PURE__ */ O(i)
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
const ms = 5;
|
|
290
|
-
function Yt(t, e, n) {
|
|
291
|
-
const s = Math.max(e - ms, 0);
|
|
292
|
-
return kt(n - t(s), e - s);
|
|
293
|
-
}
|
|
294
|
-
const w = {
|
|
295
|
-
// Default spring physics
|
|
296
|
-
stiffness: 100,
|
|
297
|
-
damping: 10,
|
|
298
|
-
mass: 1,
|
|
299
|
-
velocity: 0,
|
|
300
|
-
// Default duration/bounce-based options
|
|
301
|
-
duration: 800,
|
|
302
|
-
// in ms
|
|
303
|
-
bounce: 0.3,
|
|
304
|
-
visualDuration: 0.3,
|
|
305
|
-
// in seconds
|
|
306
|
-
// Rest thresholds
|
|
307
|
-
restSpeed: {
|
|
308
|
-
granular: 0.01,
|
|
309
|
-
default: 2
|
|
310
|
-
},
|
|
311
|
-
restDelta: {
|
|
312
|
-
granular: 5e-3,
|
|
313
|
-
default: 0.5
|
|
314
|
-
},
|
|
315
|
-
// Limits
|
|
316
|
-
minDuration: 0.01,
|
|
317
|
-
// in seconds
|
|
318
|
-
maxDuration: 10,
|
|
319
|
-
// in seconds
|
|
320
|
-
minDamping: 0.05,
|
|
321
|
-
maxDamping: 1
|
|
322
|
-
}, fe = 1e-3;
|
|
323
|
-
function gs({ duration: t = w.duration, bounce: e = w.bounce, velocity: n = w.velocity, mass: s = w.mass }) {
|
|
324
|
-
let i, r;
|
|
325
|
-
ue(t <= /* @__PURE__ */ R(w.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
326
|
-
let a = 1 - e;
|
|
327
|
-
a = q(w.minDamping, w.maxDamping, a), t = q(w.minDuration, w.maxDuration, /* @__PURE__ */ O(t)), a < 1 ? (i = (c) => {
|
|
328
|
-
const u = c * a, h = u * t, d = u - n, f = Te(c, a), b = Math.exp(-h);
|
|
329
|
-
return fe - d / f * b;
|
|
330
|
-
}, r = (c) => {
|
|
331
|
-
const h = c * a * t, d = h * n + n, f = Math.pow(a, 2) * Math.pow(c, 2) * t, b = Math.exp(-h), T = Te(Math.pow(c, 2), a);
|
|
332
|
-
return (-i(c) + fe > 0 ? -1 : 1) * ((d - f) * b) / T;
|
|
333
|
-
}) : (i = (c) => {
|
|
334
|
-
const u = Math.exp(-c * t), h = (c - n) * t + 1;
|
|
335
|
-
return -fe + u * h;
|
|
336
|
-
}, r = (c) => {
|
|
337
|
-
const u = Math.exp(-c * t), h = (n - c) * (t * t);
|
|
338
|
-
return u * h;
|
|
339
|
-
});
|
|
340
|
-
const o = 5 / t, l = vs(i, r, o);
|
|
341
|
-
if (t = /* @__PURE__ */ R(t), isNaN(l))
|
|
342
|
-
return {
|
|
343
|
-
stiffness: w.stiffness,
|
|
344
|
-
damping: w.damping,
|
|
345
|
-
duration: t
|
|
346
|
-
};
|
|
347
|
-
{
|
|
348
|
-
const c = Math.pow(l, 2) * s;
|
|
349
|
-
return {
|
|
350
|
-
stiffness: c,
|
|
351
|
-
damping: a * 2 * Math.sqrt(s * c),
|
|
352
|
-
duration: t
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
const ys = 12;
|
|
357
|
-
function vs(t, e, n) {
|
|
358
|
-
let s = n;
|
|
359
|
-
for (let i = 1; i < ys; i++)
|
|
360
|
-
s = s - t(s) / e(s);
|
|
361
|
-
return s;
|
|
362
|
-
}
|
|
363
|
-
function Te(t, e) {
|
|
364
|
-
return t * Math.sqrt(1 - e * e);
|
|
365
|
-
}
|
|
366
|
-
const bs = ["duration", "bounce"], Ts = ["stiffness", "damping", "mass"];
|
|
367
|
-
function tt(t, e) {
|
|
368
|
-
return e.some((n) => t[n] !== void 0);
|
|
369
|
-
}
|
|
370
|
-
function Vs(t) {
|
|
371
|
-
let e = {
|
|
372
|
-
velocity: w.velocity,
|
|
373
|
-
stiffness: w.stiffness,
|
|
374
|
-
damping: w.damping,
|
|
375
|
-
mass: w.mass,
|
|
376
|
-
isResolvedFromDuration: !1,
|
|
377
|
-
...t
|
|
378
|
-
};
|
|
379
|
-
if (!tt(t, Ts) && tt(t, bs))
|
|
380
|
-
if (t.visualDuration) {
|
|
381
|
-
const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * q(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(i);
|
|
382
|
-
e = {
|
|
383
|
-
...e,
|
|
384
|
-
mass: w.mass,
|
|
385
|
-
stiffness: i,
|
|
386
|
-
damping: r
|
|
387
|
-
};
|
|
388
|
-
} else {
|
|
389
|
-
const n = gs(t);
|
|
390
|
-
e = {
|
|
391
|
-
...e,
|
|
392
|
-
...n,
|
|
393
|
-
mass: w.mass
|
|
394
|
-
}, e.isResolvedFromDuration = !0;
|
|
395
|
-
}
|
|
396
|
-
return e;
|
|
397
|
-
}
|
|
398
|
-
function re(t = w.visualDuration, e = w.bounce) {
|
|
399
|
-
const n = typeof t != "object" ? {
|
|
400
|
-
visualDuration: t,
|
|
401
|
-
keyframes: [0, 1],
|
|
402
|
-
bounce: e
|
|
403
|
-
} : t;
|
|
404
|
-
let { restSpeed: s, restDelta: i } = n;
|
|
405
|
-
const r = n.keyframes[0], a = n.keyframes[n.keyframes.length - 1], o = { done: !1, value: r }, { stiffness: l, damping: c, mass: u, duration: h, velocity: d, isResolvedFromDuration: f } = Vs({
|
|
406
|
-
...n,
|
|
407
|
-
velocity: -/* @__PURE__ */ O(n.velocity || 0)
|
|
408
|
-
}), b = d || 0, T = c / (2 * Math.sqrt(l * u)), v = a - r, p = /* @__PURE__ */ O(Math.sqrt(l / u)), V = Math.abs(v) < 5;
|
|
409
|
-
s || (s = V ? w.restSpeed.granular : w.restSpeed.default), i || (i = V ? w.restDelta.granular : w.restDelta.default);
|
|
410
|
-
let g;
|
|
411
|
-
if (T < 1) {
|
|
412
|
-
const m = Te(p, T);
|
|
413
|
-
g = (S) => {
|
|
414
|
-
const x = Math.exp(-T * p * S);
|
|
415
|
-
return a - x * ((b + T * p * v) / m * Math.sin(m * S) + v * Math.cos(m * S));
|
|
416
|
-
};
|
|
417
|
-
} else if (T === 1)
|
|
418
|
-
g = (m) => a - Math.exp(-p * m) * (v + (b + p * v) * m);
|
|
419
|
-
else {
|
|
420
|
-
const m = p * Math.sqrt(T * T - 1);
|
|
421
|
-
g = (S) => {
|
|
422
|
-
const x = Math.exp(-T * p * S), y = Math.min(m * S, 300);
|
|
423
|
-
return a - x * ((b + T * p * v) * Math.sinh(y) + m * v * Math.cosh(y)) / m;
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
const A = {
|
|
427
|
-
calculatedDuration: f && h || null,
|
|
428
|
-
next: (m) => {
|
|
429
|
-
const S = g(m);
|
|
430
|
-
if (f)
|
|
431
|
-
o.done = m >= h;
|
|
432
|
-
else {
|
|
433
|
-
let x = m === 0 ? b : 0;
|
|
434
|
-
T < 1 && (x = m === 0 ? /* @__PURE__ */ R(b) : Yt(g, m, S));
|
|
435
|
-
const y = Math.abs(x) <= s, C = Math.abs(a - S) <= i;
|
|
436
|
-
o.done = y && C;
|
|
437
|
-
}
|
|
438
|
-
return o.value = o.done ? a : S, o;
|
|
439
|
-
},
|
|
440
|
-
toString: () => {
|
|
441
|
-
const m = Math.min(_e(A), ie), S = zt((x) => A.next(m * x).value, m, 30);
|
|
442
|
-
return m + "ms " + S;
|
|
443
|
-
},
|
|
444
|
-
toTransition: () => {
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
return A;
|
|
448
|
-
}
|
|
449
|
-
re.applyToOptions = (t) => {
|
|
450
|
-
const e = ps(t, 100, re);
|
|
451
|
-
return t.ease = e.ease, t.duration = /* @__PURE__ */ R(e.duration), t.type = "keyframes", t;
|
|
452
|
-
};
|
|
453
|
-
function Ve({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: a, min: o, max: l, restDelta: c = 0.5, restSpeed: u }) {
|
|
454
|
-
const h = t[0], d = {
|
|
455
|
-
done: !1,
|
|
456
|
-
value: h
|
|
457
|
-
}, f = (y) => o !== void 0 && y < o || l !== void 0 && y > l, b = (y) => o === void 0 ? l : l === void 0 || Math.abs(o - y) < Math.abs(l - y) ? o : l;
|
|
458
|
-
let T = n * e;
|
|
459
|
-
const v = h + T, p = a === void 0 ? v : a(v);
|
|
460
|
-
p !== v && (T = p - h);
|
|
461
|
-
const V = (y) => -T * Math.exp(-y / s), g = (y) => p + V(y), A = (y) => {
|
|
462
|
-
const C = V(y), D = g(y);
|
|
463
|
-
d.done = Math.abs(C) <= c, d.value = d.done ? p : D;
|
|
464
|
-
};
|
|
465
|
-
let m, S;
|
|
466
|
-
const x = (y) => {
|
|
467
|
-
f(d.value) && (m = y, S = re({
|
|
468
|
-
keyframes: [d.value, b(d.value)],
|
|
469
|
-
velocity: Yt(g, y, d.value),
|
|
470
|
-
// TODO: This should be passing * 1000
|
|
471
|
-
damping: i,
|
|
472
|
-
stiffness: r,
|
|
473
|
-
restDelta: c,
|
|
474
|
-
restSpeed: u
|
|
475
|
-
}));
|
|
476
|
-
};
|
|
477
|
-
return x(0), {
|
|
478
|
-
calculatedDuration: null,
|
|
479
|
-
next: (y) => {
|
|
480
|
-
let C = !1;
|
|
481
|
-
return !S && m === void 0 && (C = !0, A(y), x(y)), m !== void 0 && y >= m ? S.next(y - m) : (!C && A(y), d);
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
function Ss(t, e, n) {
|
|
486
|
-
const s = [], i = n || k.mix || qt, r = t.length - 1;
|
|
487
|
-
for (let a = 0; a < r; a++) {
|
|
488
|
-
let o = i(t[a], t[a + 1]);
|
|
489
|
-
if (e) {
|
|
490
|
-
const l = Array.isArray(e) ? e[a] || Y : e;
|
|
491
|
-
o = ce(l, o);
|
|
492
|
-
}
|
|
493
|
-
s.push(o);
|
|
494
|
-
}
|
|
495
|
-
return s;
|
|
496
|
-
}
|
|
497
|
-
function ws(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
|
|
498
|
-
const r = t.length;
|
|
499
|
-
if (H(r === e.length, "Both input and output ranges must be the same length", "range-length"), r === 1)
|
|
500
|
-
return () => e[0];
|
|
501
|
-
if (r === 2 && e[0] === e[1])
|
|
502
|
-
return () => e[1];
|
|
503
|
-
const a = t[0] === t[1];
|
|
504
|
-
t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
|
|
505
|
-
const o = Ss(e, s, i), l = o.length, c = (u) => {
|
|
506
|
-
if (a && u < t[0])
|
|
507
|
-
return e[0];
|
|
508
|
-
let h = 0;
|
|
509
|
-
if (l > 1)
|
|
510
|
-
for (; h < t.length - 2 && !(u < t[h + 1]); h++)
|
|
511
|
-
;
|
|
512
|
-
const d = /* @__PURE__ */ It(t[h], t[h + 1], u);
|
|
513
|
-
return o[h](d);
|
|
514
|
-
};
|
|
515
|
-
return n ? (u) => c(q(t[0], t[r - 1], u)) : c;
|
|
516
|
-
}
|
|
517
|
-
function As(t, e) {
|
|
518
|
-
const n = t[t.length - 1];
|
|
519
|
-
for (let s = 1; s <= e; s++) {
|
|
520
|
-
const i = /* @__PURE__ */ It(0, e, s);
|
|
521
|
-
t.push(oe(n, 1, i));
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
function xs(t) {
|
|
525
|
-
const e = [0];
|
|
526
|
-
return As(e, t.length - 1), e;
|
|
527
|
-
}
|
|
528
|
-
function Ms(t, e) {
|
|
529
|
-
return t.map((n) => n * e);
|
|
530
|
-
}
|
|
531
|
-
function Cs(t, e) {
|
|
532
|
-
return t.map(() => e || Ut).splice(0, t.length - 1);
|
|
533
|
-
}
|
|
534
|
-
function $({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
|
|
535
|
-
const i = es(s) ? s.map(Je) : Je(s), r = {
|
|
536
|
-
done: !1,
|
|
537
|
-
value: e[0]
|
|
538
|
-
}, a = Ms(
|
|
539
|
-
// Only use the provided offsets if they're the correct length
|
|
540
|
-
// TODO Maybe we should warn here if there's a length mismatch
|
|
541
|
-
n && n.length === e.length ? n : xs(e),
|
|
542
|
-
t
|
|
543
|
-
), o = ws(a, e, {
|
|
544
|
-
ease: Array.isArray(i) ? i : Cs(e, i)
|
|
545
|
-
});
|
|
546
|
-
return {
|
|
547
|
-
calculatedDuration: t,
|
|
548
|
-
next: (l) => (r.value = o(l), r.done = l >= t, r)
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
const Ps = (t) => t !== null;
|
|
552
|
-
function je(t, { repeat: e, repeatType: n = "loop" }, s, i = 1) {
|
|
553
|
-
const r = t.filter(Ps), o = i < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
|
|
554
|
-
return !o || s === void 0 ? r[o] : s;
|
|
555
|
-
}
|
|
556
|
-
const Fs = {
|
|
557
|
-
decay: Ve,
|
|
558
|
-
inertia: Ve,
|
|
559
|
-
tween: $,
|
|
560
|
-
keyframes: $,
|
|
561
|
-
spring: re
|
|
562
|
-
};
|
|
563
|
-
function Xt(t) {
|
|
564
|
-
typeof t.type == "string" && (t.type = Fs[t.type]);
|
|
565
|
-
}
|
|
566
|
-
class Ue {
|
|
567
|
-
constructor() {
|
|
568
|
-
this.updateFinished();
|
|
569
|
-
}
|
|
570
|
-
get finished() {
|
|
571
|
-
return this._finished;
|
|
572
|
-
}
|
|
573
|
-
updateFinished() {
|
|
574
|
-
this._finished = new Promise((e) => {
|
|
575
|
-
this.resolve = e;
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
notifyFinished() {
|
|
579
|
-
this.resolve();
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Allows the animation to be awaited.
|
|
583
|
-
*
|
|
584
|
-
* @deprecated Use `finished` instead.
|
|
585
|
-
*/
|
|
586
|
-
then(e, n) {
|
|
587
|
-
return this.finished.then(e, n);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
const Ds = (t) => t / 100;
|
|
591
|
-
class $e extends Ue {
|
|
592
|
-
constructor(e) {
|
|
593
|
-
super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
|
|
594
|
-
const { motionValue: n } = this.options;
|
|
595
|
-
n && n.updatedAt !== F.now() && this.tick(F.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
|
|
596
|
-
}, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
|
|
597
|
-
}
|
|
598
|
-
initAnimation() {
|
|
599
|
-
const { options: e } = this;
|
|
600
|
-
Xt(e);
|
|
601
|
-
const { type: n = $, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: a = 0 } = e;
|
|
602
|
-
let { keyframes: o } = e;
|
|
603
|
-
const l = n || $;
|
|
604
|
-
ke.env.NODE_ENV !== "production" && l !== $ && H(o.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`, "spring-two-frames"), l !== $ && typeof o[0] != "number" && (this.mixKeyframes = ce(Ds, qt(o[0], o[1])), o = [0, 100]);
|
|
605
|
-
const c = l({ ...e, keyframes: o });
|
|
606
|
-
r === "mirror" && (this.mirroredGenerator = l({
|
|
607
|
-
...e,
|
|
608
|
-
keyframes: [...o].reverse(),
|
|
609
|
-
velocity: -a
|
|
610
|
-
})), c.calculatedDuration === null && (c.calculatedDuration = _e(c));
|
|
611
|
-
const { calculatedDuration: u } = c;
|
|
612
|
-
this.calculatedDuration = u, this.resolvedDuration = u + i, this.totalDuration = this.resolvedDuration * (s + 1) - i, this.generator = c;
|
|
613
|
-
}
|
|
614
|
-
updateTime(e) {
|
|
615
|
-
const n = Math.round(e - this.startTime) * this.playbackSpeed;
|
|
616
|
-
this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
|
|
617
|
-
}
|
|
618
|
-
tick(e, n = !1) {
|
|
619
|
-
const { generator: s, totalDuration: i, mixKeyframes: r, mirroredGenerator: a, resolvedDuration: o, calculatedDuration: l } = this;
|
|
620
|
-
if (this.startTime === null)
|
|
621
|
-
return s.next(0);
|
|
622
|
-
const { delay: c = 0, keyframes: u, repeat: h, repeatType: d, repeatDelay: f, type: b, onUpdate: T, finalKeyframe: v } = this.options;
|
|
623
|
-
this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - i / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e);
|
|
624
|
-
const p = this.currentTime - c * (this.playbackSpeed >= 0 ? 1 : -1), V = this.playbackSpeed >= 0 ? p < 0 : p > i;
|
|
625
|
-
this.currentTime = Math.max(p, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i);
|
|
626
|
-
let g = this.currentTime, A = s;
|
|
627
|
-
if (h) {
|
|
628
|
-
const y = Math.min(this.currentTime, i) / o;
|
|
629
|
-
let C = Math.floor(y), D = y % 1;
|
|
630
|
-
!D && y >= 1 && (D = 1), D === 1 && C--, C = Math.min(C, h + 1), !!(C % 2) && (d === "reverse" ? (D = 1 - D, f && (D -= f / o)) : d === "mirror" && (A = a)), g = q(0, 1, D) * o;
|
|
631
|
-
}
|
|
632
|
-
const m = V ? { done: !1, value: u[0] } : A.next(g);
|
|
633
|
-
r && (m.value = r(m.value));
|
|
634
|
-
let { done: S } = m;
|
|
635
|
-
!V && l !== null && (S = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
|
|
636
|
-
const x = this.holdTime === null && (this.state === "finished" || this.state === "running" && S);
|
|
637
|
-
return x && b !== Ve && (m.value = je(u, this.options, v, this.speed)), T && T(m.value), x && this.finish(), m;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
641
|
-
* resolves when the animation finishes at all but in a future update could/should
|
|
642
|
-
* reject if its cancels.
|
|
643
|
-
*/
|
|
644
|
-
then(e, n) {
|
|
645
|
-
return this.finished.then(e, n);
|
|
646
|
-
}
|
|
647
|
-
get duration() {
|
|
648
|
-
return /* @__PURE__ */ O(this.calculatedDuration);
|
|
649
|
-
}
|
|
650
|
-
get iterationDuration() {
|
|
651
|
-
const { delay: e = 0 } = this.options || {};
|
|
652
|
-
return this.duration + /* @__PURE__ */ O(e);
|
|
653
|
-
}
|
|
654
|
-
get time() {
|
|
655
|
-
return /* @__PURE__ */ O(this.currentTime);
|
|
656
|
-
}
|
|
657
|
-
set time(e) {
|
|
658
|
-
e = /* @__PURE__ */ R(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);
|
|
659
|
-
}
|
|
660
|
-
get speed() {
|
|
661
|
-
return this.playbackSpeed;
|
|
662
|
-
}
|
|
663
|
-
set speed(e) {
|
|
664
|
-
this.updateTime(F.now());
|
|
665
|
-
const n = this.playbackSpeed !== e;
|
|
666
|
-
this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ O(this.currentTime));
|
|
667
|
-
}
|
|
668
|
-
play() {
|
|
669
|
-
if (this.isStopped)
|
|
670
|
-
return;
|
|
671
|
-
const { driver: e = fs, startTime: n } = this.options;
|
|
672
|
-
this.driver || (this.driver = e((i) => this.tick(i))), this.options.onPlay?.();
|
|
673
|
-
const s = this.driver.now();
|
|
674
|
-
this.state === "finished" ? (this.updateFinished(), this.startTime = s) : this.holdTime !== null ? this.startTime = s - this.holdTime : this.startTime || (this.startTime = n ?? s), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
|
|
675
|
-
}
|
|
676
|
-
pause() {
|
|
677
|
-
this.state = "paused", this.updateTime(F.now()), this.holdTime = this.currentTime;
|
|
678
|
-
}
|
|
679
|
-
complete() {
|
|
680
|
-
this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
|
|
681
|
-
}
|
|
682
|
-
finish() {
|
|
683
|
-
this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
|
|
684
|
-
}
|
|
685
|
-
cancel() {
|
|
686
|
-
this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
|
|
687
|
-
}
|
|
688
|
-
teardown() {
|
|
689
|
-
this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
|
|
690
|
-
}
|
|
691
|
-
stopDriver() {
|
|
692
|
-
this.driver && (this.driver.stop(), this.driver = void 0);
|
|
693
|
-
}
|
|
694
|
-
sample(e) {
|
|
695
|
-
return this.startTime = 0, this.tick(e, !0);
|
|
696
|
-
}
|
|
697
|
-
attachTimeline(e) {
|
|
698
|
-
return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
function Es(t) {
|
|
702
|
-
for (let e = 1; e < t.length; e++)
|
|
703
|
-
t[e] ?? (t[e] = t[e - 1]);
|
|
704
|
-
}
|
|
705
|
-
const G = (t) => t * 180 / Math.PI, Se = (t) => {
|
|
706
|
-
const e = G(Math.atan2(t[1], t[0]));
|
|
707
|
-
return we(e);
|
|
708
|
-
}, Os = {
|
|
709
|
-
x: 4,
|
|
710
|
-
y: 5,
|
|
711
|
-
translateX: 4,
|
|
712
|
-
translateY: 5,
|
|
713
|
-
scaleX: 0,
|
|
714
|
-
scaleY: 3,
|
|
715
|
-
scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
|
|
716
|
-
rotate: Se,
|
|
717
|
-
rotateZ: Se,
|
|
718
|
-
skewX: (t) => G(Math.atan(t[1])),
|
|
719
|
-
skewY: (t) => G(Math.atan(t[2])),
|
|
720
|
-
skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
|
|
721
|
-
}, we = (t) => (t = t % 360, t < 0 && (t += 360), t), nt = Se, st = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), it = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), Is = {
|
|
722
|
-
x: 12,
|
|
723
|
-
y: 13,
|
|
724
|
-
z: 14,
|
|
725
|
-
translateX: 12,
|
|
726
|
-
translateY: 13,
|
|
727
|
-
translateZ: 14,
|
|
728
|
-
scaleX: st,
|
|
729
|
-
scaleY: it,
|
|
730
|
-
scale: (t) => (st(t) + it(t)) / 2,
|
|
731
|
-
rotateX: (t) => we(G(Math.atan2(t[6], t[5]))),
|
|
732
|
-
rotateY: (t) => we(G(Math.atan2(-t[2], t[0]))),
|
|
733
|
-
rotateZ: nt,
|
|
734
|
-
rotate: nt,
|
|
735
|
-
skewX: (t) => G(Math.atan(t[4])),
|
|
736
|
-
skewY: (t) => G(Math.atan(t[1])),
|
|
737
|
-
skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
|
|
738
|
-
};
|
|
739
|
-
function Ae(t) {
|
|
740
|
-
return t.includes("scale") ? 1 : 0;
|
|
741
|
-
}
|
|
742
|
-
function xe(t, e) {
|
|
743
|
-
if (!t || t === "none")
|
|
744
|
-
return Ae(e);
|
|
745
|
-
const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
746
|
-
let s, i;
|
|
747
|
-
if (n)
|
|
748
|
-
s = Is, i = n;
|
|
749
|
-
else {
|
|
750
|
-
const o = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
751
|
-
s = Os, i = o;
|
|
752
|
-
}
|
|
753
|
-
if (!i)
|
|
754
|
-
return Ae(e);
|
|
755
|
-
const r = s[e], a = i[1].split(",").map(ks);
|
|
756
|
-
return typeof r == "function" ? r(a) : a[r];
|
|
757
|
-
}
|
|
758
|
-
const Rs = (t, e) => {
|
|
759
|
-
const { transform: n = "none" } = getComputedStyle(t);
|
|
760
|
-
return xe(n, e);
|
|
761
|
-
};
|
|
762
|
-
function ks(t) {
|
|
763
|
-
return parseFloat(t.trim());
|
|
764
|
-
}
|
|
765
|
-
const rt = (t) => t === Vt || t === St, Ks = /* @__PURE__ */ new Set(["x", "y", "z"]), Ns = wt.filter((t) => !Ks.has(t));
|
|
766
|
-
function Bs(t) {
|
|
767
|
-
const e = [];
|
|
768
|
-
return Ns.forEach((n) => {
|
|
769
|
-
const s = t.getValue(n);
|
|
770
|
-
s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
|
|
771
|
-
}), e;
|
|
772
|
-
}
|
|
773
|
-
const N = {
|
|
774
|
-
// Dimensions
|
|
775
|
-
width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
776
|
-
height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
|
|
777
|
-
top: (t, { top: e }) => parseFloat(e),
|
|
778
|
-
left: (t, { left: e }) => parseFloat(e),
|
|
779
|
-
bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
|
|
780
|
-
right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
|
|
781
|
-
// Transform
|
|
782
|
-
x: (t, { transform: e }) => xe(e, "x"),
|
|
783
|
-
y: (t, { transform: e }) => xe(e, "y")
|
|
784
|
-
};
|
|
785
|
-
N.translateX = N.x;
|
|
786
|
-
N.translateY = N.y;
|
|
787
|
-
const _ = /* @__PURE__ */ new Set();
|
|
788
|
-
let Me = !1, Ce = !1, Pe = !1;
|
|
789
|
-
function Zt() {
|
|
790
|
-
if (Ce) {
|
|
791
|
-
const t = Array.from(_).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
|
|
792
|
-
e.forEach((s) => {
|
|
793
|
-
const i = Bs(s);
|
|
794
|
-
i.length && (n.set(s, i), s.render());
|
|
795
|
-
}), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
|
|
796
|
-
s.render();
|
|
797
|
-
const i = n.get(s);
|
|
798
|
-
i && i.forEach(([r, a]) => {
|
|
799
|
-
s.getValue(r)?.set(a);
|
|
800
|
-
});
|
|
801
|
-
}), t.forEach((s) => s.measureEndState()), t.forEach((s) => {
|
|
802
|
-
s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
Ce = !1, Me = !1, _.forEach((t) => t.complete(Pe)), _.clear();
|
|
806
|
-
}
|
|
807
|
-
function Jt() {
|
|
808
|
-
_.forEach((t) => {
|
|
809
|
-
t.readKeyframes(), t.needsMeasurement && (Ce = !0);
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
function Ls() {
|
|
813
|
-
Pe = !0, Jt(), Zt(), Pe = !1;
|
|
814
|
-
}
|
|
815
|
-
class We {
|
|
816
|
-
constructor(e, n, s, i, r, a = !1) {
|
|
817
|
-
this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = a;
|
|
818
|
-
}
|
|
819
|
-
scheduleResolve() {
|
|
820
|
-
this.state = "scheduled", this.isAsync ? (_.add(this), Me || (Me = !0, I.read(Jt), I.resolveKeyframes(Zt))) : (this.readKeyframes(), this.complete());
|
|
821
|
-
}
|
|
822
|
-
readKeyframes() {
|
|
823
|
-
const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
|
|
824
|
-
if (e[0] === null) {
|
|
825
|
-
const r = i?.get(), a = e[e.length - 1];
|
|
826
|
-
if (r !== void 0)
|
|
827
|
-
e[0] = r;
|
|
828
|
-
else if (s && n) {
|
|
829
|
-
const o = s.readValue(n, a);
|
|
830
|
-
o != null && (e[0] = o);
|
|
831
|
-
}
|
|
832
|
-
e[0] === void 0 && (e[0] = a), i && r === void 0 && i.set(e[0]);
|
|
833
|
-
}
|
|
834
|
-
Es(e);
|
|
835
|
-
}
|
|
836
|
-
setFinalKeyframe() {
|
|
837
|
-
}
|
|
838
|
-
measureInitialState() {
|
|
839
|
-
}
|
|
840
|
-
renderEndStyles() {
|
|
841
|
-
}
|
|
842
|
-
measureEndState() {
|
|
843
|
-
}
|
|
844
|
-
complete(e = !1) {
|
|
845
|
-
this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), _.delete(this);
|
|
846
|
-
}
|
|
847
|
-
cancel() {
|
|
848
|
-
this.state === "scheduled" && (_.delete(this), this.state = "pending");
|
|
849
|
-
}
|
|
850
|
-
resume() {
|
|
851
|
-
this.state === "pending" && this.scheduleResolve();
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
const Gs = (t) => t.startsWith("--");
|
|
855
|
-
function _s(t, e, n) {
|
|
856
|
-
Gs(e) ? t.style.setProperty(e, n) : t.style[e] = n;
|
|
857
|
-
}
|
|
858
|
-
const js = /* @__PURE__ */ Ne(() => window.ScrollTimeline !== void 0), Us = {};
|
|
859
|
-
function $s(t, e) {
|
|
860
|
-
const n = /* @__PURE__ */ Ne(t);
|
|
861
|
-
return () => Us[e] ?? n();
|
|
862
|
-
}
|
|
863
|
-
const Qt = /* @__PURE__ */ $s(() => {
|
|
864
|
-
try {
|
|
865
|
-
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
866
|
-
} catch {
|
|
867
|
-
return !1;
|
|
868
|
-
}
|
|
869
|
-
return !0;
|
|
870
|
-
}, "linearEasing"), Z = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, at = {
|
|
871
|
-
linear: "linear",
|
|
872
|
-
ease: "ease",
|
|
873
|
-
easeIn: "ease-in",
|
|
874
|
-
easeOut: "ease-out",
|
|
875
|
-
easeInOut: "ease-in-out",
|
|
876
|
-
circIn: /* @__PURE__ */ Z([0, 0.65, 0.55, 1]),
|
|
877
|
-
circOut: /* @__PURE__ */ Z([0.55, 0, 1, 0.45]),
|
|
878
|
-
backIn: /* @__PURE__ */ Z([0.31, 0.01, 0.66, -0.59]),
|
|
879
|
-
backOut: /* @__PURE__ */ Z([0.33, 1.53, 0.69, 0.99])
|
|
880
|
-
};
|
|
881
|
-
function en(t, e) {
|
|
882
|
-
if (t)
|
|
883
|
-
return typeof t == "function" ? Qt() ? zt(t, e) : "ease-out" : $t(t) ? Z(t) : Array.isArray(t) ? t.map((n) => en(n, e) || at.easeOut) : at[t];
|
|
884
|
-
}
|
|
885
|
-
function Ws(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: a = "loop", ease: o = "easeOut", times: l } = {}, c = void 0) {
|
|
886
|
-
const u = {
|
|
887
|
-
[e]: n
|
|
888
|
-
};
|
|
889
|
-
l && (u.offset = l);
|
|
890
|
-
const h = en(o, i);
|
|
891
|
-
Array.isArray(h) && (u.easing = h);
|
|
892
|
-
const d = {
|
|
893
|
-
delay: s,
|
|
894
|
-
duration: i,
|
|
895
|
-
easing: Array.isArray(h) ? "linear" : h,
|
|
896
|
-
fill: "both",
|
|
897
|
-
iterations: r + 1,
|
|
898
|
-
direction: a === "reverse" ? "alternate" : "normal"
|
|
899
|
-
};
|
|
900
|
-
return c && (d.pseudoElement = c), t.animate(u, d);
|
|
901
|
-
}
|
|
902
|
-
function tn(t) {
|
|
903
|
-
return typeof t == "function" && "applyToOptions" in t;
|
|
904
|
-
}
|
|
905
|
-
function Hs({ type: t, ...e }) {
|
|
906
|
-
return tn(t) && Qt() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
|
|
907
|
-
}
|
|
908
|
-
class qs extends Ue {
|
|
909
|
-
constructor(e) {
|
|
910
|
-
if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !e)
|
|
911
|
-
return;
|
|
912
|
-
const { element: n, name: s, keyframes: i, pseudoElement: r, allowFlatten: a = !1, finalKeyframe: o, onComplete: l } = e;
|
|
913
|
-
this.isPseudoElement = !!r, this.allowFlatten = a, this.options = e, H(typeof e.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
|
|
914
|
-
const c = Hs(e);
|
|
915
|
-
this.animation = Ws(n, s, i, c, r), c.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
|
|
916
|
-
if (this.finishedTime = this.time, !r) {
|
|
917
|
-
const u = je(i, this.options, o, this.speed);
|
|
918
|
-
this.updateMotionValue ? this.updateMotionValue(u) : _s(n, s, u), this.animation.cancel();
|
|
919
|
-
}
|
|
920
|
-
l?.(), this.notifyFinished();
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
play() {
|
|
924
|
-
this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished());
|
|
925
|
-
}
|
|
926
|
-
pause() {
|
|
927
|
-
this.animation.pause();
|
|
928
|
-
}
|
|
929
|
-
complete() {
|
|
930
|
-
this.animation.finish?.();
|
|
931
|
-
}
|
|
932
|
-
cancel() {
|
|
933
|
-
try {
|
|
934
|
-
this.animation.cancel();
|
|
935
|
-
} catch {
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
stop() {
|
|
939
|
-
if (this.isStopped)
|
|
940
|
-
return;
|
|
941
|
-
this.isStopped = !0;
|
|
942
|
-
const { state: e } = this;
|
|
943
|
-
e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
|
|
944
|
-
}
|
|
945
|
-
/**
|
|
946
|
-
* WAAPI doesn't natively have any interruption capabilities.
|
|
947
|
-
*
|
|
948
|
-
* In this method, we commit styles back to the DOM before cancelling
|
|
949
|
-
* the animation.
|
|
950
|
-
*
|
|
951
|
-
* This is designed to be overridden by NativeAnimationExtended, which
|
|
952
|
-
* will create a renderless JS animation and sample it twice to calculate
|
|
953
|
-
* its current value, "previous" value, and therefore allow
|
|
954
|
-
* Motion to also correctly calculate velocity for any subsequent animation
|
|
955
|
-
* while deferring the commit until the next animation frame.
|
|
956
|
-
*/
|
|
957
|
-
commitStyles() {
|
|
958
|
-
this.isPseudoElement || this.animation.commitStyles?.();
|
|
959
|
-
}
|
|
960
|
-
get duration() {
|
|
961
|
-
const e = this.animation.effect?.getComputedTiming?.().duration || 0;
|
|
962
|
-
return /* @__PURE__ */ O(Number(e));
|
|
963
|
-
}
|
|
964
|
-
get iterationDuration() {
|
|
965
|
-
const { delay: e = 0 } = this.options || {};
|
|
966
|
-
return this.duration + /* @__PURE__ */ O(e);
|
|
967
|
-
}
|
|
968
|
-
get time() {
|
|
969
|
-
return /* @__PURE__ */ O(Number(this.animation.currentTime) || 0);
|
|
970
|
-
}
|
|
971
|
-
set time(e) {
|
|
972
|
-
this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ R(e);
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* The playback speed of the animation.
|
|
976
|
-
* 1 = normal speed, 2 = double speed, 0.5 = half speed.
|
|
977
|
-
*/
|
|
978
|
-
get speed() {
|
|
979
|
-
return this.animation.playbackRate;
|
|
980
|
-
}
|
|
981
|
-
set speed(e) {
|
|
982
|
-
e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
|
|
983
|
-
}
|
|
984
|
-
get state() {
|
|
985
|
-
return this.finishedTime !== null ? "finished" : this.animation.playState;
|
|
986
|
-
}
|
|
987
|
-
get startTime() {
|
|
988
|
-
return this.manualStartTime ?? Number(this.animation.startTime);
|
|
989
|
-
}
|
|
990
|
-
set startTime(e) {
|
|
991
|
-
this.manualStartTime = this.animation.startTime = e;
|
|
992
|
-
}
|
|
993
|
-
/**
|
|
994
|
-
* Attaches a timeline to the animation, for instance the `ScrollTimeline`.
|
|
995
|
-
*/
|
|
996
|
-
attachTimeline({ timeline: e, observe: n }) {
|
|
997
|
-
return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && js() ? (this.animation.timeline = e, Y) : n(this);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
const nn = {
|
|
1001
|
-
anticipate: _t,
|
|
1002
|
-
backInOut: Gt,
|
|
1003
|
-
circInOut: jt
|
|
1004
|
-
};
|
|
1005
|
-
function zs(t) {
|
|
1006
|
-
return t in nn;
|
|
1007
|
-
}
|
|
1008
|
-
function Ys(t) {
|
|
1009
|
-
typeof t.ease == "string" && zs(t.ease) && (t.ease = nn[t.ease]);
|
|
1010
|
-
}
|
|
1011
|
-
const pe = 10;
|
|
1012
|
-
class Xs extends qs {
|
|
1013
|
-
constructor(e) {
|
|
1014
|
-
Ys(e), Xt(e), super(e), e.startTime !== void 0 && (this.startTime = e.startTime), this.options = e;
|
|
1015
|
-
}
|
|
1016
|
-
/**
|
|
1017
|
-
* WAAPI doesn't natively have any interruption capabilities.
|
|
1018
|
-
*
|
|
1019
|
-
* Rather than read committed styles back out of the DOM, we can
|
|
1020
|
-
* create a renderless JS animation and sample it twice to calculate
|
|
1021
|
-
* its current value, "previous" value, and therefore allow
|
|
1022
|
-
* Motion to calculate velocity for any subsequent animation.
|
|
1023
|
-
*/
|
|
1024
|
-
updateMotionValue(e) {
|
|
1025
|
-
const { motionValue: n, onUpdate: s, onComplete: i, element: r, ...a } = this.options;
|
|
1026
|
-
if (!n)
|
|
1027
|
-
return;
|
|
1028
|
-
if (e !== void 0) {
|
|
1029
|
-
n.set(e);
|
|
1030
|
-
return;
|
|
1031
|
-
}
|
|
1032
|
-
const o = new $e({
|
|
1033
|
-
...a,
|
|
1034
|
-
autoplay: !1
|
|
1035
|
-
}), l = Math.max(pe, F.now() - this.startTime), c = q(0, pe, l - pe);
|
|
1036
|
-
n.setWithVelocity(o.sample(Math.max(0, l - c)).value, o.sample(l).value, c), o.stop();
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
const ot = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
|
|
1040
|
-
(z.test(t) || t === "0") && // And it contains numbers and/or colors
|
|
1041
|
-
!t.startsWith("url("));
|
|
1042
|
-
function Zs(t) {
|
|
1043
|
-
const e = t[0];
|
|
1044
|
-
if (t.length === 1)
|
|
1045
|
-
return !0;
|
|
1046
|
-
for (let n = 0; n < t.length; n++)
|
|
1047
|
-
if (t[n] !== e)
|
|
1048
|
-
return !0;
|
|
1049
|
-
}
|
|
1050
|
-
function Js(t, e, n, s) {
|
|
1051
|
-
const i = t[0];
|
|
1052
|
-
if (i === null)
|
|
1053
|
-
return !1;
|
|
1054
|
-
if (e === "display" || e === "visibility")
|
|
1055
|
-
return !0;
|
|
1056
|
-
const r = t[t.length - 1], a = ot(i, e), o = ot(r, e);
|
|
1057
|
-
return ue(a === o, `You are trying to animate ${e} from "${i}" to "${r}". "${a ? r : i}" is not an animatable value.`, "value-not-animatable"), !a || !o ? !1 : Zs(t) || (n === "spring" || tn(n)) && s;
|
|
1058
|
-
}
|
|
1059
|
-
function Fe(t) {
|
|
1060
|
-
t.duration = 0, t.type = "keyframes";
|
|
1061
|
-
}
|
|
1062
|
-
const Qs = /* @__PURE__ */ new Set([
|
|
1063
|
-
"opacity",
|
|
1064
|
-
"clipPath",
|
|
1065
|
-
"filter",
|
|
1066
|
-
"transform"
|
|
1067
|
-
// TODO: Could be re-enabled now we have support for linear() easing
|
|
1068
|
-
// "background-color"
|
|
1069
|
-
]), ei = /* @__PURE__ */ Ne(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
1070
|
-
function ti(t) {
|
|
1071
|
-
const { motionValue: e, name: n, repeatDelay: s, repeatType: i, damping: r, type: a } = t;
|
|
1072
|
-
if (!(e?.owner?.current instanceof HTMLElement))
|
|
1073
|
-
return !1;
|
|
1074
|
-
const { onUpdate: l, transformTemplate: c } = e.owner.getProps();
|
|
1075
|
-
return ei() && n && Qs.has(n) && (n !== "transform" || !c) && /**
|
|
1076
|
-
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
1077
|
-
* no way to read the value from WAAPI every frame.
|
|
1078
|
-
*/
|
|
1079
|
-
!l && !s && i !== "mirror" && r !== 0 && a !== "inertia";
|
|
1080
|
-
}
|
|
1081
|
-
const ni = 40;
|
|
1082
|
-
class si extends Ue {
|
|
1083
|
-
constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: a = "loop", keyframes: o, name: l, motionValue: c, element: u, ...h }) {
|
|
1084
|
-
super(), this.stop = () => {
|
|
1085
|
-
this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
|
|
1086
|
-
}, this.createdAt = F.now();
|
|
1087
|
-
const d = {
|
|
1088
|
-
autoplay: e,
|
|
1089
|
-
delay: n,
|
|
1090
|
-
type: s,
|
|
1091
|
-
repeat: i,
|
|
1092
|
-
repeatDelay: r,
|
|
1093
|
-
repeatType: a,
|
|
1094
|
-
name: l,
|
|
1095
|
-
motionValue: c,
|
|
1096
|
-
element: u,
|
|
1097
|
-
...h
|
|
1098
|
-
}, f = u?.KeyframeResolver || We;
|
|
1099
|
-
this.keyframeResolver = new f(o, (b, T, v) => this.onKeyframesResolved(b, T, d, !v), l, c, u), this.keyframeResolver?.scheduleResolve();
|
|
1100
|
-
}
|
|
1101
|
-
onKeyframesResolved(e, n, s, i) {
|
|
1102
|
-
this.keyframeResolver = void 0;
|
|
1103
|
-
const { name: r, type: a, velocity: o, delay: l, isHandoff: c, onUpdate: u } = s;
|
|
1104
|
-
this.resolvedAt = F.now(), Js(e, r, a, o) || ((k.instantAnimations || !l) && u?.(je(e, s, n)), e[0] = e[e.length - 1], Fe(s), s.repeat = 0);
|
|
1105
|
-
const d = {
|
|
1106
|
-
startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > ni ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
|
|
1107
|
-
finalKeyframe: n,
|
|
1108
|
-
...s,
|
|
1109
|
-
keyframes: e
|
|
1110
|
-
}, f = !c && ti(d) ? new Xs({
|
|
1111
|
-
...d,
|
|
1112
|
-
element: d.motionValue.owner.current
|
|
1113
|
-
}) : new $e(d);
|
|
1114
|
-
f.finished.then(() => this.notifyFinished()).catch(Y), this.pendingTimeline && (this.stopTimeline = f.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = f;
|
|
1115
|
-
}
|
|
1116
|
-
get finished() {
|
|
1117
|
-
return this._animation ? this.animation.finished : this._finished;
|
|
1118
|
-
}
|
|
1119
|
-
then(e, n) {
|
|
1120
|
-
return this.finished.finally(e).then(() => {
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
get animation() {
|
|
1124
|
-
return this._animation || (this.keyframeResolver?.resume(), Ls()), this._animation;
|
|
1125
|
-
}
|
|
1126
|
-
get duration() {
|
|
1127
|
-
return this.animation.duration;
|
|
1128
|
-
}
|
|
1129
|
-
get iterationDuration() {
|
|
1130
|
-
return this.animation.iterationDuration;
|
|
1131
|
-
}
|
|
1132
|
-
get time() {
|
|
1133
|
-
return this.animation.time;
|
|
1134
|
-
}
|
|
1135
|
-
set time(e) {
|
|
1136
|
-
this.animation.time = e;
|
|
1137
|
-
}
|
|
1138
|
-
get speed() {
|
|
1139
|
-
return this.animation.speed;
|
|
1140
|
-
}
|
|
1141
|
-
get state() {
|
|
1142
|
-
return this.animation.state;
|
|
1143
|
-
}
|
|
1144
|
-
set speed(e) {
|
|
1145
|
-
this.animation.speed = e;
|
|
1146
|
-
}
|
|
1147
|
-
get startTime() {
|
|
1148
|
-
return this.animation.startTime;
|
|
1149
|
-
}
|
|
1150
|
-
attachTimeline(e) {
|
|
1151
|
-
return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
|
|
1152
|
-
}
|
|
1153
|
-
play() {
|
|
1154
|
-
this.animation.play();
|
|
1155
|
-
}
|
|
1156
|
-
pause() {
|
|
1157
|
-
this.animation.pause();
|
|
1158
|
-
}
|
|
1159
|
-
complete() {
|
|
1160
|
-
this.animation.complete();
|
|
1161
|
-
}
|
|
1162
|
-
cancel() {
|
|
1163
|
-
this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
const ii = (
|
|
1167
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
|
|
1168
|
-
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
|
|
1169
|
-
);
|
|
1170
|
-
function ri(t) {
|
|
1171
|
-
const e = ii.exec(t);
|
|
1172
|
-
if (!e)
|
|
1173
|
-
return [,];
|
|
1174
|
-
const [, n, s, i] = e;
|
|
1175
|
-
return [`--${n ?? s}`, i];
|
|
1176
|
-
}
|
|
1177
|
-
const ai = 4;
|
|
1178
|
-
function sn(t, e, n = 1) {
|
|
1179
|
-
H(n <= ai, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
1180
|
-
const [s, i] = ri(t);
|
|
1181
|
-
if (!s)
|
|
1182
|
-
return;
|
|
1183
|
-
const r = window.getComputedStyle(e).getPropertyValue(s);
|
|
1184
|
-
if (r) {
|
|
1185
|
-
const a = r.trim();
|
|
1186
|
-
return Et(a) ? parseFloat(a) : a;
|
|
1187
|
-
}
|
|
1188
|
-
return Ke(i) ? sn(i, e, n + 1) : i;
|
|
1189
|
-
}
|
|
1190
|
-
function rn(t, e) {
|
|
1191
|
-
return t?.[e] ?? t?.default ?? t;
|
|
1192
|
-
}
|
|
1193
|
-
const an = /* @__PURE__ */ new Set([
|
|
1194
|
-
"width",
|
|
1195
|
-
"height",
|
|
1196
|
-
"top",
|
|
1197
|
-
"left",
|
|
1198
|
-
"right",
|
|
1199
|
-
"bottom",
|
|
1200
|
-
...wt
|
|
1201
|
-
]), oi = {
|
|
1202
|
-
test: (t) => t === "auto",
|
|
1203
|
-
parse: (t) => t
|
|
1204
|
-
}, on = (t) => (e) => e.test(t), un = [Vt, St, Mn, Cn, Pn, Fn, oi], ut = (t) => un.find(on(t));
|
|
1205
|
-
function ui(t) {
|
|
1206
|
-
return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Ot(t) : !0;
|
|
1207
|
-
}
|
|
1208
|
-
const li = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
1209
|
-
function ci(t) {
|
|
1210
|
-
const [e, n] = t.slice(0, -1).split("(");
|
|
1211
|
-
if (e === "drop-shadow")
|
|
1212
|
-
return t;
|
|
1213
|
-
const [s] = n.match(Dn) || [];
|
|
1214
|
-
if (!s)
|
|
1215
|
-
return t;
|
|
1216
|
-
const i = n.replace(s, "");
|
|
1217
|
-
let r = li.has(e) ? 1 : 0;
|
|
1218
|
-
return s !== n && (r *= 100), e + "(" + r + i + ")";
|
|
1219
|
-
}
|
|
1220
|
-
const hi = /\b([a-z-]*)\(.*?\)/gu, De = {
|
|
1221
|
-
...z,
|
|
1222
|
-
getAnimatableNone: (t) => {
|
|
1223
|
-
const e = t.match(hi);
|
|
1224
|
-
return e ? e.map(ci).join(" ") : t;
|
|
1225
|
-
}
|
|
1226
|
-
}, di = {
|
|
1227
|
-
...En,
|
|
1228
|
-
// Color props
|
|
1229
|
-
color: P,
|
|
1230
|
-
backgroundColor: P,
|
|
1231
|
-
outlineColor: P,
|
|
1232
|
-
fill: P,
|
|
1233
|
-
stroke: P,
|
|
1234
|
-
// Border props
|
|
1235
|
-
borderColor: P,
|
|
1236
|
-
borderTopColor: P,
|
|
1237
|
-
borderRightColor: P,
|
|
1238
|
-
borderBottomColor: P,
|
|
1239
|
-
borderLeftColor: P,
|
|
1240
|
-
filter: De,
|
|
1241
|
-
WebkitFilter: De
|
|
1242
|
-
}, ln = (t) => di[t];
|
|
1243
|
-
function cn(t, e) {
|
|
1244
|
-
let n = ln(t);
|
|
1245
|
-
return n !== De && (n = z), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
|
|
1246
|
-
}
|
|
1247
|
-
const fi = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
1248
|
-
function pi(t, e, n) {
|
|
1249
|
-
let s = 0, i;
|
|
1250
|
-
for (; s < t.length && !i; ) {
|
|
1251
|
-
const r = t[s];
|
|
1252
|
-
typeof r == "string" && !fi.has(r) && ye(r).values.length && (i = t[s]), s++;
|
|
1253
|
-
}
|
|
1254
|
-
if (i && n)
|
|
1255
|
-
for (const r of e)
|
|
1256
|
-
t[r] = cn(n, i);
|
|
1257
|
-
}
|
|
1258
|
-
class mi extends We {
|
|
1259
|
-
constructor(e, n, s, i, r) {
|
|
1260
|
-
super(e, n, s, i, r, !0);
|
|
1261
|
-
}
|
|
1262
|
-
readKeyframes() {
|
|
1263
|
-
const { unresolvedKeyframes: e, element: n, name: s } = this;
|
|
1264
|
-
if (!n || !n.current)
|
|
1265
|
-
return;
|
|
1266
|
-
super.readKeyframes();
|
|
1267
|
-
for (let u = 0; u < e.length; u++) {
|
|
1268
|
-
let h = e[u];
|
|
1269
|
-
if (typeof h == "string" && (h = h.trim(), Ke(h))) {
|
|
1270
|
-
const d = sn(h, n.current);
|
|
1271
|
-
d !== void 0 && (e[u] = d), u === e.length - 1 && (this.finalKeyframe = h);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
if (this.resolveNoneKeyframes(), !an.has(s) || e.length !== 2)
|
|
1275
|
-
return;
|
|
1276
|
-
const [i, r] = e, a = ut(i), o = ut(r), l = Ye(i), c = Ye(r);
|
|
1277
|
-
if (l !== c && N[s]) {
|
|
1278
|
-
this.needsMeasurement = !0;
|
|
1279
|
-
return;
|
|
1280
|
-
}
|
|
1281
|
-
if (a !== o)
|
|
1282
|
-
if (rt(a) && rt(o))
|
|
1283
|
-
for (let u = 0; u < e.length; u++) {
|
|
1284
|
-
const h = e[u];
|
|
1285
|
-
typeof h == "string" && (e[u] = parseFloat(h));
|
|
1286
|
-
}
|
|
1287
|
-
else N[s] && (this.needsMeasurement = !0);
|
|
1288
|
-
}
|
|
1289
|
-
resolveNoneKeyframes() {
|
|
1290
|
-
const { unresolvedKeyframes: e, name: n } = this, s = [];
|
|
1291
|
-
for (let i = 0; i < e.length; i++)
|
|
1292
|
-
(e[i] === null || ui(e[i])) && s.push(i);
|
|
1293
|
-
s.length && pi(e, s, n);
|
|
1294
|
-
}
|
|
1295
|
-
measureInitialState() {
|
|
1296
|
-
const { element: e, unresolvedKeyframes: n, name: s } = this;
|
|
1297
|
-
if (!e || !e.current)
|
|
1298
|
-
return;
|
|
1299
|
-
s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = N[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
|
|
1300
|
-
const i = n[n.length - 1];
|
|
1301
|
-
i !== void 0 && e.getValue(s, i).jump(i, !1);
|
|
1302
|
-
}
|
|
1303
|
-
measureEndState() {
|
|
1304
|
-
const { element: e, name: n, unresolvedKeyframes: s } = this;
|
|
1305
|
-
if (!e || !e.current)
|
|
1306
|
-
return;
|
|
1307
|
-
const i = e.getValue(n);
|
|
1308
|
-
i && i.jump(this.measuredOrigin, !1);
|
|
1309
|
-
const r = s.length - 1, a = s[r];
|
|
1310
|
-
s[r] = N[n](e.measureViewportBox(), window.getComputedStyle(e.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), this.removedTransforms?.length && this.removedTransforms.forEach(([o, l]) => {
|
|
1311
|
-
e.getValue(o).set(l);
|
|
1312
|
-
}), this.resolveNoneKeyframes();
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
function gi(t, e, n) {
|
|
1316
|
-
if (t instanceof EventTarget)
|
|
1317
|
-
return [t];
|
|
1318
|
-
if (typeof t == "string") {
|
|
1319
|
-
let s = document;
|
|
1320
|
-
const i = n?.[t] ?? s.querySelectorAll(t);
|
|
1321
|
-
return i ? Array.from(i) : [];
|
|
1322
|
-
}
|
|
1323
|
-
return Array.from(t);
|
|
1324
|
-
}
|
|
1325
|
-
const lt = 30, yi = (t) => !isNaN(parseFloat(t));
|
|
1326
|
-
class vi {
|
|
1327
|
-
/**
|
|
1328
|
-
* @param init - The initiating value
|
|
1329
|
-
* @param config - Optional configuration options
|
|
1330
|
-
*
|
|
1331
|
-
* - `transformer`: A function to transform incoming values with.
|
|
1332
|
-
*/
|
|
1333
|
-
constructor(e, n = {}) {
|
|
1334
|
-
this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s) => {
|
|
1335
|
-
const i = F.now();
|
|
1336
|
-
if (this.updatedAt !== i && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && (this.events.change?.notify(this.current), this.dependents))
|
|
1337
|
-
for (const r of this.dependents)
|
|
1338
|
-
r.dirty();
|
|
1339
|
-
}, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
|
|
1340
|
-
}
|
|
1341
|
-
setCurrent(e) {
|
|
1342
|
-
this.current = e, this.updatedAt = F.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = yi(this.current));
|
|
1343
|
-
}
|
|
1344
|
-
setPrevFrameValue(e = this.current) {
|
|
1345
|
-
this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
|
|
1346
|
-
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
1349
|
-
*
|
|
1350
|
-
* It returns a function that, when called, will cancel the subscription.
|
|
1351
|
-
*
|
|
1352
|
-
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
1353
|
-
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
1354
|
-
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
1355
|
-
*
|
|
1356
|
-
* ```jsx
|
|
1357
|
-
* export const MyComponent = () => {
|
|
1358
|
-
* const x = useMotionValue(0)
|
|
1359
|
-
* const y = useMotionValue(0)
|
|
1360
|
-
* const opacity = useMotionValue(1)
|
|
1361
|
-
*
|
|
1362
|
-
* useEffect(() => {
|
|
1363
|
-
* function updateOpacity() {
|
|
1364
|
-
* const maxXY = Math.max(x.get(), y.get())
|
|
1365
|
-
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
1366
|
-
* opacity.set(newOpacity)
|
|
1367
|
-
* }
|
|
1368
|
-
*
|
|
1369
|
-
* const unsubscribeX = x.on("change", updateOpacity)
|
|
1370
|
-
* const unsubscribeY = y.on("change", updateOpacity)
|
|
1371
|
-
*
|
|
1372
|
-
* return () => {
|
|
1373
|
-
* unsubscribeX()
|
|
1374
|
-
* unsubscribeY()
|
|
1375
|
-
* }
|
|
1376
|
-
* }, [])
|
|
1377
|
-
*
|
|
1378
|
-
* return <motion.div style={{ x }} />
|
|
1379
|
-
* }
|
|
1380
|
-
* ```
|
|
1381
|
-
*
|
|
1382
|
-
* @param subscriber - A function that receives the latest value.
|
|
1383
|
-
* @returns A function that, when called, will cancel this subscription.
|
|
1384
|
-
*
|
|
1385
|
-
* @deprecated
|
|
1386
|
-
*/
|
|
1387
|
-
onChange(e) {
|
|
1388
|
-
return ke.env.NODE_ENV !== "production" && At(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
|
|
1389
|
-
}
|
|
1390
|
-
on(e, n) {
|
|
1391
|
-
this.events[e] || (this.events[e] = new Rt());
|
|
1392
|
-
const s = this.events[e].add(n);
|
|
1393
|
-
return e === "change" ? () => {
|
|
1394
|
-
s(), I.read(() => {
|
|
1395
|
-
this.events.change.getSize() || this.stop();
|
|
1396
|
-
});
|
|
1397
|
-
} : s;
|
|
1398
|
-
}
|
|
1399
|
-
clearListeners() {
|
|
1400
|
-
for (const e in this.events)
|
|
1401
|
-
this.events[e].clear();
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* Attaches a passive effect to the `MotionValue`.
|
|
1405
|
-
*/
|
|
1406
|
-
attach(e, n) {
|
|
1407
|
-
this.passiveEffect = e, this.stopPassiveEffect = n;
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Sets the state of the `MotionValue`.
|
|
1411
|
-
*
|
|
1412
|
-
* @remarks
|
|
1413
|
-
*
|
|
1414
|
-
* ```jsx
|
|
1415
|
-
* const x = useMotionValue(0)
|
|
1416
|
-
* x.set(10)
|
|
1417
|
-
* ```
|
|
1418
|
-
*
|
|
1419
|
-
* @param latest - Latest value to set.
|
|
1420
|
-
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
1421
|
-
*
|
|
1422
|
-
* @public
|
|
1423
|
-
*/
|
|
1424
|
-
set(e) {
|
|
1425
|
-
this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
|
|
1426
|
-
}
|
|
1427
|
-
setWithVelocity(e, n, s) {
|
|
1428
|
-
this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
|
|
1429
|
-
}
|
|
1430
|
-
/**
|
|
1431
|
-
* Set the state of the `MotionValue`, stopping any active animations,
|
|
1432
|
-
* effects, and resets velocity to `0`.
|
|
1433
|
-
*/
|
|
1434
|
-
jump(e, n = !0) {
|
|
1435
|
-
this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1436
|
-
}
|
|
1437
|
-
dirty() {
|
|
1438
|
-
this.events.change?.notify(this.current);
|
|
1439
|
-
}
|
|
1440
|
-
addDependent(e) {
|
|
1441
|
-
this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(e);
|
|
1442
|
-
}
|
|
1443
|
-
removeDependent(e) {
|
|
1444
|
-
this.dependents && this.dependents.delete(e);
|
|
1445
|
-
}
|
|
1446
|
-
/**
|
|
1447
|
-
* Returns the latest state of `MotionValue`
|
|
1448
|
-
*
|
|
1449
|
-
* @returns - The latest state of `MotionValue`
|
|
1450
|
-
*
|
|
1451
|
-
* @public
|
|
1452
|
-
*/
|
|
1453
|
-
get() {
|
|
1454
|
-
return this.current;
|
|
1455
|
-
}
|
|
1456
|
-
/**
|
|
1457
|
-
* @public
|
|
1458
|
-
*/
|
|
1459
|
-
getPrevious() {
|
|
1460
|
-
return this.prev;
|
|
1461
|
-
}
|
|
1462
|
-
/**
|
|
1463
|
-
* Returns the latest velocity of `MotionValue`
|
|
1464
|
-
*
|
|
1465
|
-
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
1466
|
-
*
|
|
1467
|
-
* @public
|
|
1468
|
-
*/
|
|
1469
|
-
getVelocity() {
|
|
1470
|
-
const e = F.now();
|
|
1471
|
-
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > lt)
|
|
1472
|
-
return 0;
|
|
1473
|
-
const n = Math.min(this.updatedAt - this.prevUpdatedAt, lt);
|
|
1474
|
-
return kt(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Registers a new animation to control this `MotionValue`. Only one
|
|
1478
|
-
* animation can drive a `MotionValue` at one time.
|
|
1479
|
-
*
|
|
1480
|
-
* ```jsx
|
|
1481
|
-
* value.start()
|
|
1482
|
-
* ```
|
|
1483
|
-
*
|
|
1484
|
-
* @param animation - A function that starts the provided animation
|
|
1485
|
-
*/
|
|
1486
|
-
start(e) {
|
|
1487
|
-
return this.stop(), new Promise((n) => {
|
|
1488
|
-
this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
|
|
1489
|
-
}).then(() => {
|
|
1490
|
-
this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
/**
|
|
1494
|
-
* Stop the currently active animation.
|
|
1495
|
-
*
|
|
1496
|
-
* @public
|
|
1497
|
-
*/
|
|
1498
|
-
stop() {
|
|
1499
|
-
this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
|
|
1500
|
-
}
|
|
1501
|
-
/**
|
|
1502
|
-
* Returns `true` if this value is currently animating.
|
|
1503
|
-
*
|
|
1504
|
-
* @public
|
|
1505
|
-
*/
|
|
1506
|
-
isAnimating() {
|
|
1507
|
-
return !!this.animation;
|
|
1508
|
-
}
|
|
1509
|
-
clearAnimation() {
|
|
1510
|
-
delete this.animation;
|
|
1511
|
-
}
|
|
1512
|
-
/**
|
|
1513
|
-
* Destroy and clean up subscribers to this `MotionValue`.
|
|
1514
|
-
*
|
|
1515
|
-
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
1516
|
-
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
1517
|
-
* created a `MotionValue` via the `motionValue` function.
|
|
1518
|
-
*
|
|
1519
|
-
* @public
|
|
1520
|
-
*/
|
|
1521
|
-
destroy() {
|
|
1522
|
-
this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
function ae(t, e) {
|
|
1526
|
-
return new vi(t, e);
|
|
1527
|
-
}
|
|
1528
|
-
const { schedule: bi } = /* @__PURE__ */ Wt(queueMicrotask, !1), Ti = {
|
|
1529
|
-
y: !1
|
|
1530
|
-
};
|
|
1531
|
-
function Vi() {
|
|
1532
|
-
return Ti.y;
|
|
1533
|
-
}
|
|
1534
|
-
function hn(t, e) {
|
|
1535
|
-
const n = gi(t), s = new AbortController(), i = {
|
|
1536
|
-
passive: !0,
|
|
1537
|
-
...e,
|
|
1538
|
-
signal: s.signal
|
|
1539
|
-
};
|
|
1540
|
-
return [n, i, () => s.abort()];
|
|
1541
|
-
}
|
|
1542
|
-
function ct(t) {
|
|
1543
|
-
return !(t.pointerType === "touch" || Vi());
|
|
1544
|
-
}
|
|
1545
|
-
function Si(t, e, n = {}) {
|
|
1546
|
-
const [s, i, r] = hn(t, n), a = (o) => {
|
|
1547
|
-
if (!ct(o))
|
|
1548
|
-
return;
|
|
1549
|
-
const { target: l } = o, c = e(l, o);
|
|
1550
|
-
if (typeof c != "function" || !l)
|
|
1551
|
-
return;
|
|
1552
|
-
const u = (h) => {
|
|
1553
|
-
ct(h) && (c(h), l.removeEventListener("pointerleave", u));
|
|
1554
|
-
};
|
|
1555
|
-
l.addEventListener("pointerleave", u, i);
|
|
1556
|
-
};
|
|
1557
|
-
return s.forEach((o) => {
|
|
1558
|
-
o.addEventListener("pointerenter", a, i);
|
|
1559
|
-
}), r;
|
|
1560
|
-
}
|
|
1561
|
-
const dn = (t, e) => e ? t === e ? !0 : dn(t, e.parentElement) : !1, wi = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Ai = /* @__PURE__ */ new Set([
|
|
1562
|
-
"BUTTON",
|
|
1563
|
-
"INPUT",
|
|
1564
|
-
"SELECT",
|
|
1565
|
-
"TEXTAREA",
|
|
1566
|
-
"A"
|
|
1567
|
-
]);
|
|
1568
|
-
function xi(t) {
|
|
1569
|
-
return Ai.has(t.tagName) || t.isContentEditable === !0;
|
|
1570
|
-
}
|
|
1571
|
-
const te = /* @__PURE__ */ new WeakSet();
|
|
1572
|
-
function ht(t) {
|
|
1573
|
-
return (e) => {
|
|
1574
|
-
e.key === "Enter" && t(e);
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
|
-
function me(t, e) {
|
|
1578
|
-
t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
|
|
1579
|
-
}
|
|
1580
|
-
const Mi = (t, e) => {
|
|
1581
|
-
const n = t.currentTarget;
|
|
1582
|
-
if (!n)
|
|
1583
|
-
return;
|
|
1584
|
-
const s = ht(() => {
|
|
1585
|
-
if (te.has(n))
|
|
1586
|
-
return;
|
|
1587
|
-
me(n, "down");
|
|
1588
|
-
const i = ht(() => {
|
|
1589
|
-
me(n, "up");
|
|
1590
|
-
}), r = () => me(n, "cancel");
|
|
1591
|
-
n.addEventListener("keyup", i, e), n.addEventListener("blur", r, e);
|
|
1592
|
-
});
|
|
1593
|
-
n.addEventListener("keydown", s, e), n.addEventListener("blur", () => n.removeEventListener("keydown", s), e);
|
|
1594
|
-
};
|
|
1595
|
-
function dt(t) {
|
|
1596
|
-
return wi(t) && !0;
|
|
1597
|
-
}
|
|
1598
|
-
function Ci(t, e, n = {}) {
|
|
1599
|
-
const [s, i, r] = hn(t, n), a = (o) => {
|
|
1600
|
-
const l = o.currentTarget;
|
|
1601
|
-
if (!dt(o))
|
|
1602
|
-
return;
|
|
1603
|
-
te.add(l);
|
|
1604
|
-
const c = e(l, o), u = (f, b) => {
|
|
1605
|
-
window.removeEventListener("pointerup", h), window.removeEventListener("pointercancel", d), te.has(l) && te.delete(l), dt(f) && typeof c == "function" && c(f, { success: b });
|
|
1606
|
-
}, h = (f) => {
|
|
1607
|
-
u(f, l === window || l === document || n.useGlobalTarget || dn(l, f.target));
|
|
1608
|
-
}, d = (f) => {
|
|
1609
|
-
u(f, !1);
|
|
1610
|
-
};
|
|
1611
|
-
window.addEventListener("pointerup", h, i), window.addEventListener("pointercancel", d, i);
|
|
1612
|
-
};
|
|
1613
|
-
return s.forEach((o) => {
|
|
1614
|
-
(n.useGlobalTarget ? window : o).addEventListener("pointerdown", a, i), On(o) && (o.addEventListener("focus", (c) => Mi(c, i)), !xi(o) && !o.hasAttribute("tabindex") && (o.tabIndex = 0));
|
|
1615
|
-
}), r;
|
|
1616
|
-
}
|
|
1617
|
-
const Pi = [...un, P, z], Fi = (t) => Pi.find(on(t));
|
|
1618
|
-
function Di({ top: t, left: e, right: n, bottom: s }) {
|
|
1619
|
-
return {
|
|
1620
|
-
x: { min: e, max: n },
|
|
1621
|
-
y: { min: t, max: s }
|
|
1622
|
-
};
|
|
1623
|
-
}
|
|
1624
|
-
function Ei(t, e) {
|
|
1625
|
-
if (!e)
|
|
1626
|
-
return t;
|
|
1627
|
-
const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
|
|
1628
|
-
return {
|
|
1629
|
-
top: n.y,
|
|
1630
|
-
left: n.x,
|
|
1631
|
-
bottom: s.y,
|
|
1632
|
-
right: s.x
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
function Oi(t, e) {
|
|
1636
|
-
return Di(Ei(t.getBoundingClientRect(), e));
|
|
1637
|
-
}
|
|
1638
|
-
const ft = () => ({ min: 0, max: 0 }), fn = () => ({
|
|
1639
|
-
x: ft(),
|
|
1640
|
-
y: ft()
|
|
1641
|
-
}), Ee = { current: null }, pn = { current: !1 };
|
|
1642
|
-
function Ii() {
|
|
1643
|
-
if (pn.current = !0, !!In)
|
|
1644
|
-
if (window.matchMedia) {
|
|
1645
|
-
const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Ee.current = t.matches;
|
|
1646
|
-
t.addEventListener("change", e), e();
|
|
1647
|
-
} else
|
|
1648
|
-
Ee.current = !1;
|
|
1649
|
-
}
|
|
1650
|
-
const Ri = /* @__PURE__ */ new WeakMap();
|
|
1651
|
-
function ki(t, e, n) {
|
|
1652
|
-
for (const s in e) {
|
|
1653
|
-
const i = e[s], r = n[s];
|
|
1654
|
-
if (K(i))
|
|
1655
|
-
t.addValue(s, i);
|
|
1656
|
-
else if (K(r))
|
|
1657
|
-
t.addValue(s, ae(i, { owner: t }));
|
|
1658
|
-
else if (r !== i)
|
|
1659
|
-
if (t.hasValue(s)) {
|
|
1660
|
-
const a = t.getValue(s);
|
|
1661
|
-
a.liveStyle === !0 ? a.jump(i) : a.hasAnimated || a.set(i);
|
|
1662
|
-
} else {
|
|
1663
|
-
const a = t.getStaticValue(s);
|
|
1664
|
-
t.addValue(s, ae(a !== void 0 ? a : i, { owner: t }));
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
for (const s in n)
|
|
1668
|
-
e[s] === void 0 && t.removeValue(s);
|
|
1669
|
-
return e;
|
|
1670
|
-
}
|
|
1671
|
-
const pt = [
|
|
1672
|
-
"AnimationStart",
|
|
1673
|
-
"AnimationComplete",
|
|
1674
|
-
"Update",
|
|
1675
|
-
"BeforeLayoutMeasure",
|
|
1676
|
-
"LayoutMeasure",
|
|
1677
|
-
"LayoutAnimationStart",
|
|
1678
|
-
"LayoutAnimationComplete"
|
|
1679
|
-
];
|
|
1680
|
-
class Ki {
|
|
1681
|
-
/**
|
|
1682
|
-
* This method takes React props and returns found MotionValues. For example, HTML
|
|
1683
|
-
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
|
|
1684
|
-
*
|
|
1685
|
-
* This isn't an abstract method as it needs calling in the constructor, but it is
|
|
1686
|
-
* intended to be one.
|
|
1687
|
-
*/
|
|
1688
|
-
scrapeMotionValuesFromProps(e, n, s) {
|
|
1689
|
-
return {};
|
|
1690
|
-
}
|
|
1691
|
-
constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: a }, o = {}) {
|
|
1692
|
-
this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = We, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
|
|
1693
|
-
this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
|
|
1694
|
-
}, this.renderScheduledAt = 0, this.scheduleRender = () => {
|
|
1695
|
-
const d = F.now();
|
|
1696
|
-
this.renderScheduledAt < d && (this.renderScheduledAt = d, I.render(this.render, !1, !0));
|
|
1697
|
-
};
|
|
1698
|
-
const { latestValues: l, renderState: c } = a;
|
|
1699
|
-
this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = c, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = o, this.blockInitialAnimation = !!r, this.isControllingVariants = Rn(n), this.isVariantNode = kn(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
|
|
1700
|
-
const { willChange: u, ...h } = this.scrapeMotionValuesFromProps(n, {}, this);
|
|
1701
|
-
for (const d in h) {
|
|
1702
|
-
const f = h[d];
|
|
1703
|
-
l[d] !== void 0 && K(f) && f.set(l[d]);
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
mount(e) {
|
|
1707
|
-
this.current = e, Ri.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, s) => this.bindToMotionValue(s, n)), this.reducedMotionConfig === "never" ? this.shouldReduceMotion = !1 : this.reducedMotionConfig === "always" ? this.shouldReduceMotion = !0 : (pn.current || Ii(), this.shouldReduceMotion = Ee.current), ke.env.NODE_ENV !== "production" && At(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);
|
|
1708
|
-
}
|
|
1709
|
-
unmount() {
|
|
1710
|
-
this.projection && this.projection.unmount(), ve(this.notifyUpdate), ve(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this);
|
|
1711
|
-
for (const e in this.events)
|
|
1712
|
-
this.events[e].clear();
|
|
1713
|
-
for (const e in this.features) {
|
|
1714
|
-
const n = this.features[e];
|
|
1715
|
-
n && (n.unmount(), n.isMounted = !1);
|
|
1716
|
-
}
|
|
1717
|
-
this.current = null;
|
|
1718
|
-
}
|
|
1719
|
-
addChild(e) {
|
|
1720
|
-
this.children.add(e), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(e);
|
|
1721
|
-
}
|
|
1722
|
-
removeChild(e) {
|
|
1723
|
-
this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
|
|
1724
|
-
}
|
|
1725
|
-
bindToMotionValue(e, n) {
|
|
1726
|
-
this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
|
|
1727
|
-
const s = le.has(e);
|
|
1728
|
-
s && this.onBindTransform && this.onBindTransform();
|
|
1729
|
-
const i = n.on("change", (a) => {
|
|
1730
|
-
this.latestValues[e] = a, this.props.onUpdate && I.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
|
|
1731
|
-
});
|
|
1732
|
-
let r;
|
|
1733
|
-
window.MotionCheckAppearSync && (r = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
|
|
1734
|
-
i(), r && r(), n.owner && n.stop();
|
|
1735
|
-
});
|
|
1736
|
-
}
|
|
1737
|
-
sortNodePosition(e) {
|
|
1738
|
-
return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
|
|
1739
|
-
}
|
|
1740
|
-
updateFeatures() {
|
|
1741
|
-
let e = "animation";
|
|
1742
|
-
for (e in Xe) {
|
|
1743
|
-
const n = Xe[e];
|
|
1744
|
-
if (!n)
|
|
1745
|
-
continue;
|
|
1746
|
-
const { isEnabled: s, Feature: i } = n;
|
|
1747
|
-
if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
|
|
1748
|
-
const r = this.features[e];
|
|
1749
|
-
r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
triggerBuild() {
|
|
1754
|
-
this.build(this.renderState, this.latestValues, this.props);
|
|
1755
|
-
}
|
|
1756
|
-
/**
|
|
1757
|
-
* Measure the current viewport box with or without transforms.
|
|
1758
|
-
* Only measures axis-aligned boxes, rotate and skew must be manually
|
|
1759
|
-
* removed with a re-render to work.
|
|
1760
|
-
*/
|
|
1761
|
-
measureViewportBox() {
|
|
1762
|
-
return this.current ? this.measureInstanceViewportBox(this.current, this.props) : fn();
|
|
1763
|
-
}
|
|
1764
|
-
getStaticValue(e) {
|
|
1765
|
-
return this.latestValues[e];
|
|
1766
|
-
}
|
|
1767
|
-
setStaticValue(e, n) {
|
|
1768
|
-
this.latestValues[e] = n;
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* Update the provided props. Ensure any newly-added motion values are
|
|
1772
|
-
* added to our map, old ones removed, and listeners updated.
|
|
1773
|
-
*/
|
|
1774
|
-
update(e, n) {
|
|
1775
|
-
(e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
|
|
1776
|
-
for (let s = 0; s < pt.length; s++) {
|
|
1777
|
-
const i = pt[s];
|
|
1778
|
-
this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
|
|
1779
|
-
const r = "on" + i, a = e[r];
|
|
1780
|
-
a && (this.propEventSubscriptions[i] = this.on(i, a));
|
|
1781
|
-
}
|
|
1782
|
-
this.prevMotionValues = ki(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
|
|
1783
|
-
}
|
|
1784
|
-
getProps() {
|
|
1785
|
-
return this.props;
|
|
1786
|
-
}
|
|
1787
|
-
/**
|
|
1788
|
-
* Returns the variant definition with a given name.
|
|
1789
|
-
*/
|
|
1790
|
-
getVariant(e) {
|
|
1791
|
-
return this.props.variants ? this.props.variants[e] : void 0;
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* Returns the defined default transition on this component.
|
|
1795
|
-
*/
|
|
1796
|
-
getDefaultTransition() {
|
|
1797
|
-
return this.props.transition;
|
|
1798
|
-
}
|
|
1799
|
-
getTransformPagePoint() {
|
|
1800
|
-
return this.props.transformPagePoint;
|
|
1801
|
-
}
|
|
1802
|
-
getClosestVariantNode() {
|
|
1803
|
-
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
1804
|
-
}
|
|
1805
|
-
/**
|
|
1806
|
-
* Add a child visual element to our set of children.
|
|
1807
|
-
*/
|
|
1808
|
-
addVariantChild(e) {
|
|
1809
|
-
const n = this.getClosestVariantNode();
|
|
1810
|
-
if (n)
|
|
1811
|
-
return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
|
|
1812
|
-
}
|
|
1813
|
-
/**
|
|
1814
|
-
* Add a motion value and bind it to this visual element.
|
|
1815
|
-
*/
|
|
1816
|
-
addValue(e, n) {
|
|
1817
|
-
const s = this.values.get(e);
|
|
1818
|
-
n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
|
|
1819
|
-
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Remove a motion value and unbind any active subscriptions.
|
|
1822
|
-
*/
|
|
1823
|
-
removeValue(e) {
|
|
1824
|
-
this.values.delete(e);
|
|
1825
|
-
const n = this.valueSubscriptions.get(e);
|
|
1826
|
-
n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
|
|
1827
|
-
}
|
|
1828
|
-
/**
|
|
1829
|
-
* Check whether we have a motion value for this key
|
|
1830
|
-
*/
|
|
1831
|
-
hasValue(e) {
|
|
1832
|
-
return this.values.has(e);
|
|
1833
|
-
}
|
|
1834
|
-
getValue(e, n) {
|
|
1835
|
-
if (this.props.values && this.props.values[e])
|
|
1836
|
-
return this.props.values[e];
|
|
1837
|
-
let s = this.values.get(e);
|
|
1838
|
-
return s === void 0 && n !== void 0 && (s = ae(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
|
|
1839
|
-
}
|
|
1840
|
-
/**
|
|
1841
|
-
* If we're trying to animate to a previously unencountered value,
|
|
1842
|
-
* we need to check for it in our state and as a last resort read it
|
|
1843
|
-
* directly from the instance (which might have performance implications).
|
|
1844
|
-
*/
|
|
1845
|
-
readValue(e, n) {
|
|
1846
|
-
let s = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
|
|
1847
|
-
return s != null && (typeof s == "string" && (Et(s) || Ot(s)) ? s = parseFloat(s) : !Fi(s) && z.test(n) && (s = cn(e, n)), this.setBaseTarget(e, K(s) ? s.get() : s)), K(s) ? s.get() : s;
|
|
1848
|
-
}
|
|
1849
|
-
/**
|
|
1850
|
-
* Set the base target to later animate back to. This is currently
|
|
1851
|
-
* only hydrated on creation and when we first read a value.
|
|
1852
|
-
*/
|
|
1853
|
-
setBaseTarget(e, n) {
|
|
1854
|
-
this.baseTarget[e] = n;
|
|
1855
|
-
}
|
|
1856
|
-
/**
|
|
1857
|
-
* Find the base target for a value thats been removed from all animation
|
|
1858
|
-
* props.
|
|
1859
|
-
*/
|
|
1860
|
-
getBaseTarget(e) {
|
|
1861
|
-
const { initial: n } = this.props;
|
|
1862
|
-
let s;
|
|
1863
|
-
if (typeof n == "string" || typeof n == "object") {
|
|
1864
|
-
const r = xt(this.props, n, this.presenceContext?.custom);
|
|
1865
|
-
r && (s = r[e]);
|
|
1866
|
-
}
|
|
1867
|
-
if (n && s !== void 0)
|
|
1868
|
-
return s;
|
|
1869
|
-
const i = this.getBaseTargetFromProps(this.props, e);
|
|
1870
|
-
return i !== void 0 && !K(i) ? i : this.initialValues[e] !== void 0 && s === void 0 ? void 0 : this.baseTarget[e];
|
|
1871
|
-
}
|
|
1872
|
-
on(e, n) {
|
|
1873
|
-
return this.events[e] || (this.events[e] = new Rt()), this.events[e].add(n);
|
|
1874
|
-
}
|
|
1875
|
-
notify(e, ...n) {
|
|
1876
|
-
this.events[e] && this.events[e].notify(...n);
|
|
1877
|
-
}
|
|
1878
|
-
scheduleRenderMicrotask() {
|
|
1879
|
-
bi.render(this.render);
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
class mn extends Ki {
|
|
1883
|
-
constructor() {
|
|
1884
|
-
super(...arguments), this.KeyframeResolver = mi;
|
|
1885
|
-
}
|
|
1886
|
-
sortInstanceNodePosition(e, n) {
|
|
1887
|
-
return e.compareDocumentPosition(n) & 2 ? 1 : -1;
|
|
1888
|
-
}
|
|
1889
|
-
getBaseTargetFromProps(e, n) {
|
|
1890
|
-
return e.style ? e.style[n] : void 0;
|
|
1891
|
-
}
|
|
1892
|
-
removeValueFromRenderState(e, { vars: n, style: s }) {
|
|
1893
|
-
delete n[e], delete s[e];
|
|
1894
|
-
}
|
|
1895
|
-
handleChildMotionValue() {
|
|
1896
|
-
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
|
1897
|
-
const { children: e } = this.props;
|
|
1898
|
-
K(e) && (this.childSubscription = e.on("change", (n) => {
|
|
1899
|
-
this.current && (this.current.textContent = `${n}`);
|
|
1900
|
-
}));
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
function gn(t, { style: e, vars: n }, s, i) {
|
|
1904
|
-
const r = t.style;
|
|
1905
|
-
let a;
|
|
1906
|
-
for (a in e)
|
|
1907
|
-
r[a] = e[a];
|
|
1908
|
-
i?.applyProjectionStyles(r, s);
|
|
1909
|
-
for (a in n)
|
|
1910
|
-
r.setProperty(a, n[a]);
|
|
1911
|
-
}
|
|
1912
|
-
function Ni(t) {
|
|
1913
|
-
return window.getComputedStyle(t);
|
|
1914
|
-
}
|
|
1915
|
-
class Bi extends mn {
|
|
1916
|
-
constructor() {
|
|
1917
|
-
super(...arguments), this.type = "html", this.renderInstance = gn;
|
|
1918
|
-
}
|
|
1919
|
-
readValueFromInstance(e, n) {
|
|
1920
|
-
if (le.has(n))
|
|
1921
|
-
return this.projection?.isProjecting ? Ae(n) : Rs(e, n);
|
|
1922
|
-
{
|
|
1923
|
-
const s = Ni(e), i = (Kn(n) ? s.getPropertyValue(n) : s[n]) || 0;
|
|
1924
|
-
return typeof i == "string" ? i.trim() : i;
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
measureInstanceViewportBox(e, { transformPagePoint: n }) {
|
|
1928
|
-
return Oi(e, n);
|
|
1929
|
-
}
|
|
1930
|
-
build(e, n, s) {
|
|
1931
|
-
Nn(e, n, s.transformTemplate);
|
|
1932
|
-
}
|
|
1933
|
-
scrapeMotionValuesFromProps(e, n, s) {
|
|
1934
|
-
return Bn(e, n, s);
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
const yn = /* @__PURE__ */ new Set([
|
|
1938
|
-
"baseFrequency",
|
|
1939
|
-
"diffuseConstant",
|
|
1940
|
-
"kernelMatrix",
|
|
1941
|
-
"kernelUnitLength",
|
|
1942
|
-
"keySplines",
|
|
1943
|
-
"keyTimes",
|
|
1944
|
-
"limitingConeAngle",
|
|
1945
|
-
"markerHeight",
|
|
1946
|
-
"markerWidth",
|
|
1947
|
-
"numOctaves",
|
|
1948
|
-
"targetX",
|
|
1949
|
-
"targetY",
|
|
1950
|
-
"surfaceScale",
|
|
1951
|
-
"specularConstant",
|
|
1952
|
-
"specularExponent",
|
|
1953
|
-
"stdDeviation",
|
|
1954
|
-
"tableValues",
|
|
1955
|
-
"viewBox",
|
|
1956
|
-
"gradientTransform",
|
|
1957
|
-
"pathLength",
|
|
1958
|
-
"startOffset",
|
|
1959
|
-
"textLength",
|
|
1960
|
-
"lengthAdjust"
|
|
1961
|
-
]);
|
|
1962
|
-
function Li(t, e, n, s) {
|
|
1963
|
-
gn(t, e, void 0, s);
|
|
1964
|
-
for (const i in e.attrs)
|
|
1965
|
-
t.setAttribute(yn.has(i) ? i : Mt(i), e.attrs[i]);
|
|
1966
|
-
}
|
|
1967
|
-
class Gi extends mn {
|
|
1968
|
-
constructor() {
|
|
1969
|
-
super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = fn;
|
|
1970
|
-
}
|
|
1971
|
-
getBaseTargetFromProps(e, n) {
|
|
1972
|
-
return e[n];
|
|
1973
|
-
}
|
|
1974
|
-
readValueFromInstance(e, n) {
|
|
1975
|
-
if (le.has(n)) {
|
|
1976
|
-
const s = ln(n);
|
|
1977
|
-
return s && s.default || 0;
|
|
1978
|
-
}
|
|
1979
|
-
return n = yn.has(n) ? n : Mt(n), e.getAttribute(n);
|
|
1980
|
-
}
|
|
1981
|
-
scrapeMotionValuesFromProps(e, n, s) {
|
|
1982
|
-
return Ln(e, n, s);
|
|
1983
|
-
}
|
|
1984
|
-
build(e, n, s) {
|
|
1985
|
-
Gn(e, n, this.isSVGTag, s.transformTemplate, s.style);
|
|
1986
|
-
}
|
|
1987
|
-
renderInstance(e, n, s, i) {
|
|
1988
|
-
Li(e, n, s, i);
|
|
1989
|
-
}
|
|
1990
|
-
mount(e) {
|
|
1991
|
-
this.isSVGTag = _n(e.tagName), super.mount(e);
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
const _i = (t, e) => e.isSVG ?? jn(t) ? new Gi(e) : new Bi(e, {
|
|
1995
|
-
allowProjection: t !== $n
|
|
1996
|
-
});
|
|
1997
|
-
function W(t, e, n) {
|
|
1998
|
-
const s = t.getProps();
|
|
1999
|
-
return xt(s, e, n !== void 0 ? n : s.custom, t);
|
|
2000
|
-
}
|
|
2001
|
-
const Oe = (t) => Array.isArray(t);
|
|
2002
|
-
function ji(t, e, n) {
|
|
2003
|
-
t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, ae(n));
|
|
2004
|
-
}
|
|
2005
|
-
function Ui(t) {
|
|
2006
|
-
return Oe(t) ? t[t.length - 1] || 0 : t;
|
|
2007
|
-
}
|
|
2008
|
-
function $i(t, e) {
|
|
2009
|
-
const n = W(t, e);
|
|
2010
|
-
let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
|
|
2011
|
-
r = { ...r, ...s };
|
|
2012
|
-
for (const a in r) {
|
|
2013
|
-
const o = Ui(r[a]);
|
|
2014
|
-
ji(t, a, o);
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
function Wi(t) {
|
|
2018
|
-
return !!(K(t) && t.add);
|
|
2019
|
-
}
|
|
2020
|
-
function Hi(t, e) {
|
|
2021
|
-
const n = t.getValue("willChange");
|
|
2022
|
-
if (Wi(n))
|
|
2023
|
-
return n.add(e);
|
|
2024
|
-
if (!n && k.WillChange) {
|
|
2025
|
-
const s = new k.WillChange("auto");
|
|
2026
|
-
t.addValue("willChange", s), s.add(e);
|
|
2027
|
-
}
|
|
2028
|
-
}
|
|
2029
|
-
function qi(t) {
|
|
2030
|
-
return t.props[Un];
|
|
2031
|
-
}
|
|
2032
|
-
const zi = (t) => t !== null;
|
|
2033
|
-
function Yi(t, { repeat: e, repeatType: n = "loop" }, s) {
|
|
2034
|
-
const i = t.filter(zi), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
|
|
2035
|
-
return i[r];
|
|
2036
|
-
}
|
|
2037
|
-
const Xi = {
|
|
2038
|
-
type: "spring",
|
|
2039
|
-
stiffness: 500,
|
|
2040
|
-
damping: 25,
|
|
2041
|
-
restSpeed: 10
|
|
2042
|
-
}, Zi = (t) => ({
|
|
2043
|
-
type: "spring",
|
|
2044
|
-
stiffness: 550,
|
|
2045
|
-
damping: t === 0 ? 2 * Math.sqrt(550) : 30,
|
|
2046
|
-
restSpeed: 10
|
|
2047
|
-
}), Ji = {
|
|
2048
|
-
type: "keyframes",
|
|
2049
|
-
duration: 0.8
|
|
2050
|
-
}, Qi = {
|
|
2051
|
-
type: "keyframes",
|
|
2052
|
-
ease: [0.25, 0.1, 0.35, 1],
|
|
2053
|
-
duration: 0.3
|
|
2054
|
-
}, er = (t, { keyframes: e }) => e.length > 2 ? Ji : le.has(t) ? t.startsWith("scale") ? Zi(e[1]) : Xi : Qi;
|
|
2055
|
-
function tr({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: a, repeatDelay: o, from: l, elapsed: c, ...u }) {
|
|
2056
|
-
return !!Object.keys(u).length;
|
|
2057
|
-
}
|
|
2058
|
-
const nr = (t, e, n, s = {}, i, r) => (a) => {
|
|
2059
|
-
const o = rn(s, t) || {}, l = o.delay || s.delay || 0;
|
|
2060
|
-
let { elapsed: c = 0 } = s;
|
|
2061
|
-
c = c - /* @__PURE__ */ R(l);
|
|
2062
|
-
const u = {
|
|
2063
|
-
keyframes: Array.isArray(n) ? n : [null, n],
|
|
2064
|
-
ease: "easeOut",
|
|
2065
|
-
velocity: e.getVelocity(),
|
|
2066
|
-
...o,
|
|
2067
|
-
delay: -c,
|
|
2068
|
-
onUpdate: (d) => {
|
|
2069
|
-
e.set(d), o.onUpdate && o.onUpdate(d);
|
|
2070
|
-
},
|
|
2071
|
-
onComplete: () => {
|
|
2072
|
-
a(), o.onComplete && o.onComplete();
|
|
2073
|
-
},
|
|
2074
|
-
name: t,
|
|
2075
|
-
motionValue: e,
|
|
2076
|
-
element: r ? void 0 : i
|
|
2077
|
-
};
|
|
2078
|
-
tr(o) || Object.assign(u, er(t, u)), u.duration && (u.duration = /* @__PURE__ */ R(u.duration)), u.repeatDelay && (u.repeatDelay = /* @__PURE__ */ R(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
|
|
2079
|
-
let h = !1;
|
|
2080
|
-
if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (Fe(u), u.delay === 0 && (h = !0)), (k.instantAnimations || k.skipAnimations) && (h = !0, Fe(u), u.delay = 0), u.allowFlatten = !o.type && !o.ease, h && !r && e.get() !== void 0) {
|
|
2081
|
-
const d = Yi(u.keyframes, o);
|
|
2082
|
-
if (d !== void 0) {
|
|
2083
|
-
I.update(() => {
|
|
2084
|
-
u.onUpdate(d), u.onComplete();
|
|
2085
|
-
});
|
|
2086
|
-
return;
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
return o.isSync ? new $e(u) : new si(u);
|
|
2090
|
-
};
|
|
2091
|
-
function sr({ protectedKeys: t, needsAnimating: e }, n) {
|
|
2092
|
-
const s = t.hasOwnProperty(n) && e[n] !== !0;
|
|
2093
|
-
return e[n] = !1, s;
|
|
2094
|
-
}
|
|
2095
|
-
function vn(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
|
|
2096
|
-
let { transition: r = t.getDefaultTransition(), transitionEnd: a, ...o } = e;
|
|
2097
|
-
s && (r = s);
|
|
2098
|
-
const l = [], c = i && t.animationState && t.animationState.getState()[i];
|
|
2099
|
-
for (const u in o) {
|
|
2100
|
-
const h = t.getValue(u, t.latestValues[u] ?? null), d = o[u];
|
|
2101
|
-
if (d === void 0 || c && sr(c, u))
|
|
2102
|
-
continue;
|
|
2103
|
-
const f = {
|
|
2104
|
-
delay: n,
|
|
2105
|
-
...rn(r || {}, u)
|
|
2106
|
-
}, b = h.get();
|
|
2107
|
-
if (b !== void 0 && !h.isAnimating && !Array.isArray(d) && d === b && !f.velocity)
|
|
2108
|
-
continue;
|
|
2109
|
-
let T = !1;
|
|
2110
|
-
if (window.MotionHandoffAnimation) {
|
|
2111
|
-
const p = qi(t);
|
|
2112
|
-
if (p) {
|
|
2113
|
-
const V = window.MotionHandoffAnimation(p, u, I);
|
|
2114
|
-
V !== null && (f.startTime = V, T = !0);
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
Hi(t, u), h.start(nr(u, h, d, t.shouldReduceMotion && an.has(u) ? { type: !1 } : f, t, T));
|
|
2118
|
-
const v = h.animation;
|
|
2119
|
-
v && l.push(v);
|
|
2120
|
-
}
|
|
2121
|
-
return a && Promise.all(l).then(() => {
|
|
2122
|
-
I.update(() => {
|
|
2123
|
-
a && $i(t, a);
|
|
2124
|
-
});
|
|
2125
|
-
}), l;
|
|
2126
|
-
}
|
|
2127
|
-
function bn(t, e, n, s = 0, i = 1) {
|
|
2128
|
-
const r = Array.from(t).sort((c, u) => c.sortNodePosition(u)).indexOf(e), a = t.size, o = (a - 1) * s;
|
|
2129
|
-
return typeof n == "function" ? n(r, a) : i === 1 ? r * s : o - r * s;
|
|
2130
|
-
}
|
|
2131
|
-
function Ie(t, e, n = {}) {
|
|
2132
|
-
const s = W(t, e, n.type === "exit" ? t.presenceContext?.custom : void 0);
|
|
2133
|
-
let { transition: i = t.getDefaultTransition() || {} } = s || {};
|
|
2134
|
-
n.transitionOverride && (i = n.transitionOverride);
|
|
2135
|
-
const r = s ? () => Promise.all(vn(t, s, n)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => {
|
|
2136
|
-
const { delayChildren: c = 0, staggerChildren: u, staggerDirection: h } = i;
|
|
2137
|
-
return ir(t, e, l, c, u, h, n);
|
|
2138
|
-
} : () => Promise.resolve(), { when: o } = i;
|
|
2139
|
-
if (o) {
|
|
2140
|
-
const [l, c] = o === "beforeChildren" ? [r, a] : [a, r];
|
|
2141
|
-
return l().then(() => c());
|
|
2142
|
-
} else
|
|
2143
|
-
return Promise.all([r(), a(n.delay)]);
|
|
2144
|
-
}
|
|
2145
|
-
function ir(t, e, n = 0, s = 0, i = 0, r = 1, a) {
|
|
2146
|
-
const o = [];
|
|
2147
|
-
for (const l of t.variantChildren)
|
|
2148
|
-
l.notify("AnimationStart", e), o.push(Ie(l, e, {
|
|
2149
|
-
...a,
|
|
2150
|
-
delay: n + (typeof s == "function" ? 0 : s) + bn(t.variantChildren, l, s, i, r)
|
|
2151
|
-
}).then(() => l.notify("AnimationComplete", e)));
|
|
2152
|
-
return Promise.all(o);
|
|
2153
|
-
}
|
|
2154
|
-
function rr(t, e, n = {}) {
|
|
2155
|
-
t.notify("AnimationStart", e);
|
|
2156
|
-
let s;
|
|
2157
|
-
if (Array.isArray(e)) {
|
|
2158
|
-
const i = e.map((r) => Ie(t, r, n));
|
|
2159
|
-
s = Promise.all(i);
|
|
2160
|
-
} else if (typeof e == "string")
|
|
2161
|
-
s = Ie(t, e, n);
|
|
2162
|
-
else {
|
|
2163
|
-
const i = typeof e == "function" ? W(t, e, n.custom) : e;
|
|
2164
|
-
s = Promise.all(vn(t, i, n));
|
|
2165
|
-
}
|
|
2166
|
-
return s.then(() => {
|
|
2167
|
-
t.notify("AnimationComplete", e);
|
|
2168
|
-
});
|
|
2169
|
-
}
|
|
2170
|
-
function Tn(t, e) {
|
|
2171
|
-
if (!Array.isArray(e))
|
|
2172
|
-
return !1;
|
|
2173
|
-
const n = e.length;
|
|
2174
|
-
if (n !== t.length)
|
|
2175
|
-
return !1;
|
|
2176
|
-
for (let s = 0; s < n; s++)
|
|
2177
|
-
if (e[s] !== t[s])
|
|
2178
|
-
return !1;
|
|
2179
|
-
return !0;
|
|
2180
|
-
}
|
|
2181
|
-
const ar = Pt.length;
|
|
2182
|
-
function Vn(t) {
|
|
2183
|
-
if (!t)
|
|
2184
|
-
return;
|
|
2185
|
-
if (!t.isControllingVariants) {
|
|
2186
|
-
const n = t.parent ? Vn(t.parent) || {} : {};
|
|
2187
|
-
return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
|
|
2188
|
-
}
|
|
2189
|
-
const e = {};
|
|
2190
|
-
for (let n = 0; n < ar; n++) {
|
|
2191
|
-
const s = Pt[n], i = t.props[s];
|
|
2192
|
-
(Ct(i) || i === !1) && (e[s] = i);
|
|
2193
|
-
}
|
|
2194
|
-
return e;
|
|
2195
|
-
}
|
|
2196
|
-
const or = [...Dt].reverse(), ur = Dt.length;
|
|
2197
|
-
function lr(t) {
|
|
2198
|
-
return (e) => Promise.all(e.map(({ animation: n, options: s }) => rr(t, n, s)));
|
|
2199
|
-
}
|
|
2200
|
-
function cr(t) {
|
|
2201
|
-
let e = lr(t), n = mt(), s = !0;
|
|
2202
|
-
const i = (l) => (c, u) => {
|
|
2203
|
-
const h = W(t, u, l === "exit" ? t.presenceContext?.custom : void 0);
|
|
2204
|
-
if (h) {
|
|
2205
|
-
const { transition: d, transitionEnd: f, ...b } = h;
|
|
2206
|
-
c = { ...c, ...b, ...f };
|
|
2207
|
-
}
|
|
2208
|
-
return c;
|
|
2209
|
-
};
|
|
2210
|
-
function r(l) {
|
|
2211
|
-
e = l(t);
|
|
2212
|
-
}
|
|
2213
|
-
function a(l) {
|
|
2214
|
-
const { props: c } = t, u = Vn(t.parent) || {}, h = [], d = /* @__PURE__ */ new Set();
|
|
2215
|
-
let f = {}, b = 1 / 0;
|
|
2216
|
-
for (let v = 0; v < ur; v++) {
|
|
2217
|
-
const p = or[v], V = n[p], g = c[p] !== void 0 ? c[p] : u[p], A = Ct(g), m = p === l ? V.isActive : null;
|
|
2218
|
-
m === !1 && (b = v);
|
|
2219
|
-
let S = g === u[p] && g !== c[p] && A;
|
|
2220
|
-
if (S && s && t.manuallyAnimateOnMount && (S = !1), V.protectedKeys = { ...f }, // If it isn't active and hasn't *just* been set as inactive
|
|
2221
|
-
!V.isActive && m === null || // If we didn't and don't have any defined prop for this animation type
|
|
2222
|
-
!g && !V.prevProp || // Or if the prop doesn't define an animation
|
|
2223
|
-
Ft(g) || typeof g == "boolean")
|
|
2224
|
-
continue;
|
|
2225
|
-
const x = hr(V.prevProp, g);
|
|
2226
|
-
let y = x || // If we're making this variant active, we want to always make it active
|
|
2227
|
-
p === l && V.isActive && !S && A || // If we removed a higher-priority variant (i is in reverse order)
|
|
2228
|
-
v > b && A, C = !1;
|
|
2229
|
-
const D = Array.isArray(g) ? g : [g];
|
|
2230
|
-
let j = D.reduce(i(p), {});
|
|
2231
|
-
m === !1 && (j = {});
|
|
2232
|
-
const { prevResolvedValues: He = {} } = V, wn = {
|
|
2233
|
-
...He,
|
|
2234
|
-
...j
|
|
2235
|
-
}, qe = (M) => {
|
|
2236
|
-
y = !0, d.has(M) && (C = !0, d.delete(M)), V.needsAnimating[M] = !0;
|
|
2237
|
-
const E = t.getValue(M);
|
|
2238
|
-
E && (E.liveStyle = !1);
|
|
2239
|
-
};
|
|
2240
|
-
for (const M in wn) {
|
|
2241
|
-
const E = j[M], B = He[M];
|
|
2242
|
-
if (f.hasOwnProperty(M))
|
|
2243
|
-
continue;
|
|
2244
|
-
let U = !1;
|
|
2245
|
-
Oe(E) && Oe(B) ? U = !Tn(E, B) : U = E !== B, U ? E != null ? qe(M) : d.add(M) : E !== void 0 && d.has(M) ? qe(M) : V.protectedKeys[M] = !0;
|
|
2246
|
-
}
|
|
2247
|
-
V.prevProp = g, V.prevResolvedValues = j, V.isActive && (f = { ...f, ...j }), s && t.blockInitialAnimation && (y = !1);
|
|
2248
|
-
const ze = S && x;
|
|
2249
|
-
y && (!ze || C) && h.push(...D.map((M) => {
|
|
2250
|
-
const E = { type: p };
|
|
2251
|
-
if (typeof M == "string" && s && !ze && t.manuallyAnimateOnMount && t.parent) {
|
|
2252
|
-
const { parent: B } = t, U = W(B, M);
|
|
2253
|
-
if (B.enteringChildren && U) {
|
|
2254
|
-
const { delayChildren: An } = U.transition || {};
|
|
2255
|
-
E.delay = bn(B.enteringChildren, t, An);
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
return {
|
|
2259
|
-
animation: M,
|
|
2260
|
-
options: E
|
|
2261
|
-
};
|
|
2262
|
-
}));
|
|
2263
|
-
}
|
|
2264
|
-
if (d.size) {
|
|
2265
|
-
const v = {};
|
|
2266
|
-
if (typeof c.initial != "boolean") {
|
|
2267
|
-
const p = W(t, Array.isArray(c.initial) ? c.initial[0] : c.initial);
|
|
2268
|
-
p && p.transition && (v.transition = p.transition);
|
|
2269
|
-
}
|
|
2270
|
-
d.forEach((p) => {
|
|
2271
|
-
const V = t.getBaseTarget(p), g = t.getValue(p);
|
|
2272
|
-
g && (g.liveStyle = !0), v[p] = V ?? null;
|
|
2273
|
-
}), h.push({ animation: v });
|
|
2274
|
-
}
|
|
2275
|
-
let T = !!h.length;
|
|
2276
|
-
return s && (c.initial === !1 || c.initial === c.animate) && !t.manuallyAnimateOnMount && (T = !1), s = !1, T ? e(h) : Promise.resolve();
|
|
2277
|
-
}
|
|
2278
|
-
function o(l, c) {
|
|
2279
|
-
if (n[l].isActive === c)
|
|
2280
|
-
return Promise.resolve();
|
|
2281
|
-
t.variantChildren?.forEach((h) => h.animationState?.setActive(l, c)), n[l].isActive = c;
|
|
2282
|
-
const u = a(l);
|
|
2283
|
-
for (const h in n)
|
|
2284
|
-
n[h].protectedKeys = {};
|
|
2285
|
-
return u;
|
|
2286
|
-
}
|
|
2287
|
-
return {
|
|
2288
|
-
animateChanges: a,
|
|
2289
|
-
setActive: o,
|
|
2290
|
-
setAnimateFunction: r,
|
|
2291
|
-
getState: () => n,
|
|
2292
|
-
reset: () => {
|
|
2293
|
-
n = mt();
|
|
2294
|
-
}
|
|
2295
|
-
};
|
|
2296
|
-
}
|
|
2297
|
-
function hr(t, e) {
|
|
2298
|
-
return typeof e == "string" ? e !== t : Array.isArray(e) ? !Tn(e, t) : !1;
|
|
2299
|
-
}
|
|
2300
|
-
function L(t = !1) {
|
|
2301
|
-
return {
|
|
2302
|
-
isActive: t,
|
|
2303
|
-
protectedKeys: {},
|
|
2304
|
-
needsAnimating: {},
|
|
2305
|
-
prevResolvedValues: {}
|
|
2306
|
-
};
|
|
2307
|
-
}
|
|
2308
|
-
function mt() {
|
|
2309
|
-
return {
|
|
2310
|
-
animate: L(!0),
|
|
2311
|
-
whileInView: L(),
|
|
2312
|
-
whileHover: L(),
|
|
2313
|
-
whileTap: L(),
|
|
2314
|
-
whileDrag: L(),
|
|
2315
|
-
whileFocus: L(),
|
|
2316
|
-
exit: L()
|
|
2317
|
-
};
|
|
2318
|
-
}
|
|
2319
|
-
class X {
|
|
2320
|
-
constructor(e) {
|
|
2321
|
-
this.isMounted = !1, this.node = e;
|
|
2322
|
-
}
|
|
2323
|
-
update() {
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
class dr extends X {
|
|
2327
|
-
/**
|
|
2328
|
-
* We dynamically generate the AnimationState manager as it contains a reference
|
|
2329
|
-
* to the underlying animation library. We only want to load that if we load this,
|
|
2330
|
-
* so people can optionally code split it out using the `m` component.
|
|
2331
|
-
*/
|
|
2332
|
-
constructor(e) {
|
|
2333
|
-
super(e), e.animationState || (e.animationState = cr(e));
|
|
2334
|
-
}
|
|
2335
|
-
updateAnimationControlsSubscription() {
|
|
2336
|
-
const { animate: e } = this.node.getProps();
|
|
2337
|
-
Ft(e) && (this.unmountControls = e.subscribe(this.node));
|
|
2338
|
-
}
|
|
2339
|
-
/**
|
|
2340
|
-
* Subscribe any provided AnimationControls to the component's VisualElement
|
|
2341
|
-
*/
|
|
2342
|
-
mount() {
|
|
2343
|
-
this.updateAnimationControlsSubscription();
|
|
2344
|
-
}
|
|
2345
|
-
update() {
|
|
2346
|
-
const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
|
|
2347
|
-
e !== n && this.updateAnimationControlsSubscription();
|
|
2348
|
-
}
|
|
2349
|
-
unmount() {
|
|
2350
|
-
this.node.animationState.reset(), this.unmountControls?.();
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
let fr = 0;
|
|
2354
|
-
class pr extends X {
|
|
2355
|
-
constructor() {
|
|
2356
|
-
super(...arguments), this.id = fr++;
|
|
2357
|
-
}
|
|
2358
|
-
update() {
|
|
2359
|
-
if (!this.node.presenceContext)
|
|
2360
|
-
return;
|
|
2361
|
-
const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
|
|
2362
|
-
if (!this.node.animationState || e === s)
|
|
2363
|
-
return;
|
|
2364
|
-
const i = this.node.animationState.setActive("exit", !e);
|
|
2365
|
-
n && !e && i.then(() => {
|
|
2366
|
-
n(this.id);
|
|
2367
|
-
});
|
|
2368
|
-
}
|
|
2369
|
-
mount() {
|
|
2370
|
-
const { register: e, onExitComplete: n } = this.node.presenceContext || {};
|
|
2371
|
-
n && n(this.id), e && (this.unmount = e(this.id));
|
|
2372
|
-
}
|
|
2373
|
-
unmount() {
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
const mr = {
|
|
2377
|
-
animation: {
|
|
2378
|
-
Feature: dr
|
|
2379
|
-
},
|
|
2380
|
-
exit: {
|
|
2381
|
-
Feature: pr
|
|
2382
|
-
}
|
|
2383
|
-
};
|
|
2384
|
-
function gt(t, e, n, s = { passive: !0 }) {
|
|
2385
|
-
return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
|
|
2386
|
-
}
|
|
2387
|
-
function Sn(t) {
|
|
2388
|
-
return {
|
|
2389
|
-
point: {
|
|
2390
|
-
x: t.pageX,
|
|
2391
|
-
y: t.pageY
|
|
2392
|
-
}
|
|
2393
|
-
};
|
|
2394
|
-
}
|
|
2395
|
-
function yt(t, e, n) {
|
|
2396
|
-
const { props: s } = t;
|
|
2397
|
-
t.animationState && s.whileHover && t.animationState.setActive("whileHover", n === "Start");
|
|
2398
|
-
const i = "onHover" + n, r = s[i];
|
|
2399
|
-
r && I.postRender(() => r(e, Sn(e)));
|
|
2400
|
-
}
|
|
2401
|
-
class gr extends X {
|
|
2402
|
-
mount() {
|
|
2403
|
-
const { current: e } = this.node;
|
|
2404
|
-
e && (this.unmount = Si(e, (n, s) => (yt(this.node, s, "Start"), (i) => yt(this.node, i, "End"))));
|
|
2405
|
-
}
|
|
2406
|
-
unmount() {
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
class yr extends X {
|
|
2410
|
-
constructor() {
|
|
2411
|
-
super(...arguments), this.isActive = !1;
|
|
2412
|
-
}
|
|
2413
|
-
onFocus() {
|
|
2414
|
-
let e = !1;
|
|
2415
|
-
try {
|
|
2416
|
-
e = this.node.current.matches(":focus-visible");
|
|
2417
|
-
} catch {
|
|
2418
|
-
e = !0;
|
|
2419
|
-
}
|
|
2420
|
-
!e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
|
|
2421
|
-
}
|
|
2422
|
-
onBlur() {
|
|
2423
|
-
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
|
|
2424
|
-
}
|
|
2425
|
-
mount() {
|
|
2426
|
-
this.unmount = ce(gt(this.node.current, "focus", () => this.onFocus()), gt(this.node.current, "blur", () => this.onBlur()));
|
|
2427
|
-
}
|
|
2428
|
-
unmount() {
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
function vt(t, e, n) {
|
|
2432
|
-
const { props: s } = t;
|
|
2433
|
-
if (t.current instanceof HTMLButtonElement && t.current.disabled)
|
|
2434
|
-
return;
|
|
2435
|
-
t.animationState && s.whileTap && t.animationState.setActive("whileTap", n === "Start");
|
|
2436
|
-
const i = "onTap" + (n === "End" ? "" : n), r = s[i];
|
|
2437
|
-
r && I.postRender(() => r(e, Sn(e)));
|
|
2438
|
-
}
|
|
2439
|
-
class vr extends X {
|
|
2440
|
-
mount() {
|
|
2441
|
-
const { current: e } = this.node;
|
|
2442
|
-
e && (this.unmount = Ci(e, (n, s) => (vt(this.node, s, "Start"), (i, { success: r }) => vt(this.node, i, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
|
|
2443
|
-
}
|
|
2444
|
-
unmount() {
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
const Re = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), br = (t) => {
|
|
2448
|
-
const e = Re.get(t.target);
|
|
2449
|
-
e && e(t);
|
|
2450
|
-
}, Tr = (t) => {
|
|
2451
|
-
t.forEach(br);
|
|
2452
|
-
};
|
|
2453
|
-
function Vr({ root: t, ...e }) {
|
|
2454
|
-
const n = t || document;
|
|
2455
|
-
ge.has(n) || ge.set(n, {});
|
|
2456
|
-
const s = ge.get(n), i = JSON.stringify(e);
|
|
2457
|
-
return s[i] || (s[i] = new IntersectionObserver(Tr, { root: t, ...e })), s[i];
|
|
2458
|
-
}
|
|
2459
|
-
function Sr(t, e, n) {
|
|
2460
|
-
const s = Vr(e);
|
|
2461
|
-
return Re.set(t, n), s.observe(t), () => {
|
|
2462
|
-
Re.delete(t), s.unobserve(t);
|
|
2463
|
-
};
|
|
2464
|
-
}
|
|
2465
|
-
const wr = {
|
|
2466
|
-
some: 0,
|
|
2467
|
-
all: 1
|
|
2468
|
-
};
|
|
2469
|
-
class Ar extends X {
|
|
2470
|
-
constructor() {
|
|
2471
|
-
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
|
|
2472
|
-
}
|
|
2473
|
-
startObserver() {
|
|
2474
|
-
this.unmount();
|
|
2475
|
-
const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, a = {
|
|
2476
|
-
root: n ? n.current : void 0,
|
|
2477
|
-
rootMargin: s,
|
|
2478
|
-
threshold: typeof i == "number" ? i : wr[i]
|
|
2479
|
-
}, o = (l) => {
|
|
2480
|
-
const { isIntersecting: c } = l;
|
|
2481
|
-
if (this.isInView === c || (this.isInView = c, r && !c && this.hasEnteredView))
|
|
2482
|
-
return;
|
|
2483
|
-
c && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", c);
|
|
2484
|
-
const { onViewportEnter: u, onViewportLeave: h } = this.node.getProps(), d = c ? u : h;
|
|
2485
|
-
d && d(l);
|
|
2486
|
-
};
|
|
2487
|
-
return Sr(this.node.current, a, o);
|
|
2488
|
-
}
|
|
2489
|
-
mount() {
|
|
2490
|
-
this.startObserver();
|
|
2491
|
-
}
|
|
2492
|
-
update() {
|
|
2493
|
-
if (typeof IntersectionObserver > "u")
|
|
2494
|
-
return;
|
|
2495
|
-
const { props: e, prevProps: n } = this.node;
|
|
2496
|
-
["amount", "margin", "root"].some(xr(e, n)) && this.startObserver();
|
|
2497
|
-
}
|
|
2498
|
-
unmount() {
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
function xr({ viewport: t = {} }, { viewport: e = {} } = {}) {
|
|
2502
|
-
return (n) => t[n] !== e[n];
|
|
2503
|
-
}
|
|
2504
|
-
const Mr = {
|
|
2505
|
-
inView: {
|
|
2506
|
-
Feature: Ar
|
|
2507
|
-
},
|
|
2508
|
-
tap: {
|
|
2509
|
-
Feature: vr
|
|
2510
|
-
},
|
|
2511
|
-
focus: {
|
|
2512
|
-
Feature: yr
|
|
2513
|
-
},
|
|
2514
|
-
hover: {
|
|
2515
|
-
Feature: gr
|
|
2516
|
-
}
|
|
2517
|
-
}, Cr = {
|
|
2518
|
-
renderer: _i,
|
|
2519
|
-
...mr,
|
|
2520
|
-
...Mr
|
|
2521
|
-
};
|
|
2522
|
-
var Er = Cr;
|
|
2523
|
-
export {
|
|
2524
|
-
Er as default
|
|
2525
|
-
};
|