@vezham/start 0.3.1 → 0.3.2

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