@mobielnl/elements 0.12.24 → 0.12.25

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.
@@ -1,1763 +0,0 @@
1
- "use client";
2
- import { n as j, i as N, m as Z, r as ze, h as qe, a as Lt, w as Q, b as pe, c as Ce, d as Xe, e as oe, f as Pe, t as O, g as Nt, j as G, v as Gt, k as $, M as H, K as Ye, l as $t, o as Ht, p as ge, q as Wt, s as _t, u as jt, x as Je, y as Ut, z as zt, A as qt, B as ke, C as Fe, D as z, E as Oe, F as Xt, V as Yt, G as Jt, H as Zt, I as Qt, J as en, L as tn, N as Ze, O as nn, P as sn, Q as rn, R as an, S as on, T as Qe, U as et, W as tt, X as nt, Y as ln } from "./index-D3B78uDJ.js";
3
- import { Fragment as un } from "react";
4
- var Bt = typeof globalThis < "u" && globalThis.process ? globalThis.process : { env: { NODE_ENV: "production" } };
5
- // @__NO_SIDE_EFFECTS__
6
- function ye(t) {
7
- let e;
8
- return () => (e === void 0 && (e = t()), e);
9
- }
10
- const cn = (t, e) => (n) => e(t(n)), ee = (...t) => t.reduce(cn), it = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
11
- const i = e - t;
12
- return i === 0 ? 1 : (n - t) / i;
13
- }, F = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, k = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3, st = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, fn = 1e-7, hn = 12;
14
- function dn(t, e, n, i, s) {
15
- let r, o, a = 0;
16
- do
17
- o = e + (n - e) / 2, r = st(o, i, s) - t, r > 0 ? n = o : e = o;
18
- while (Math.abs(r) > fn && ++a < hn);
19
- return o;
20
- }
21
- function U(t, e, n, i) {
22
- if (t === e && n === i)
23
- return j;
24
- const s = (r) => dn(r, 0, 1, t, n);
25
- return (r) => r === 0 || r === 1 ? r : st(s(r), e, i);
26
- }
27
- const rt = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, at = (t) => (e) => 1 - t(1 - e), ot = /* @__PURE__ */ U(0.33, 1.53, 0.69, 0.99), Te = /* @__PURE__ */ at(ot), lt = /* @__PURE__ */ rt(Te), ut = (t) => (t *= 2) < 1 ? 0.5 * Te(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), be = (t) => 1 - Math.sin(Math.acos(t)), mn = at(be), ct = rt(be), pn = /* @__PURE__ */ U(0.42, 0, 1, 1), gn = /* @__PURE__ */ U(0, 0, 0.58, 1), ft = /* @__PURE__ */ U(0.42, 0, 0.58, 1), yn = (t) => Array.isArray(t) && typeof t[0] != "number", ht = (t) => Array.isArray(t) && typeof t[0] == "number", Ie = {
28
- linear: j,
29
- easeIn: pn,
30
- easeInOut: ft,
31
- easeOut: gn,
32
- circIn: be,
33
- circInOut: ct,
34
- circOut: mn,
35
- backIn: Te,
36
- backInOut: lt,
37
- backOut: ot,
38
- anticipate: ut
39
- }, Tn = (t) => typeof t == "string", Ke = (t) => {
40
- if (ht(t)) {
41
- N(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
42
- const [e, n, i, s] = t;
43
- return U(e, n, i, s);
44
- } else if (Tn(t))
45
- return N(Ie[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), Ie[t];
46
- return t;
47
- };
48
- function te(t, e, n) {
49
- 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;
50
- }
51
- function bn({ hue: t, saturation: e, lightness: n, alpha: i }) {
52
- t /= 360, e /= 100, n /= 100;
53
- let s = 0, r = 0, o = 0;
54
- if (!e)
55
- s = r = o = n;
56
- else {
57
- const a = n < 0.5 ? n * (1 + e) : n + e - n * e, c = 2 * n - a;
58
- s = te(c, a, t + 1 / 3), r = te(c, a, t), o = te(c, a, t - 1 / 3);
59
- }
60
- return {
61
- red: Math.round(s * 255),
62
- green: Math.round(r * 255),
63
- blue: Math.round(o * 255),
64
- alpha: i
65
- };
66
- }
67
- function X(t, e) {
68
- return (n) => n > 0 ? e : t;
69
- }
70
- const ne = (t, e, n) => {
71
- const i = t * t, s = n * (e * e - i) + i;
72
- return s < 0 ? 0 : Math.sqrt(s);
73
- }, vn = [Lt, ze, qe], An = (t) => vn.find((e) => e.test(t));
74
- function Re(t) {
75
- const e = An(t);
76
- if (Q(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
77
- return !1;
78
- let n = e.parse(t);
79
- return e === qe && (n = bn(n)), n;
80
- }
81
- const Ee = (t, e) => {
82
- const n = Re(t), i = Re(e);
83
- if (!n || !i)
84
- return X(t, e);
85
- const s = { ...n };
86
- return (r) => (s.red = ne(n.red, i.red, r), s.green = ne(n.green, i.green, r), s.blue = ne(n.blue, i.blue, r), s.alpha = Z(n.alpha, i.alpha, r), ze.transform(s));
87
- }, le = /* @__PURE__ */ new Set(["none", "hidden"]);
88
- function xn(t, e) {
89
- return le.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
90
- }
91
- function Sn(t, e) {
92
- return (n) => Z(t, e, n);
93
- }
94
- function ve(t) {
95
- return typeof t == "number" ? Sn : typeof t == "string" ? pe(t) ? X : Ce.test(t) ? Ee : Mn : Array.isArray(t) ? dt : typeof t == "object" ? Ce.test(t) ? Ee : wn : X;
96
- }
97
- function dt(t, e) {
98
- const n = [...t], i = n.length, s = t.map((r, o) => ve(r)(r, e[o]));
99
- return (r) => {
100
- for (let o = 0; o < i; o++)
101
- n[o] = s[o](r);
102
- return n;
103
- };
104
- }
105
- function wn(t, e) {
106
- const n = { ...t, ...e }, i = {};
107
- for (const s in n)
108
- t[s] !== void 0 && e[s] !== void 0 && (i[s] = ve(t[s])(t[s], e[s]));
109
- return (s) => {
110
- for (const r in i)
111
- n[r] = i[r](s);
112
- return n;
113
- };
114
- }
115
- function Vn(t, e) {
116
- const n = [], i = { color: 0, var: 0, number: 0 };
117
- for (let s = 0; s < e.values.length; s++) {
118
- const r = e.types[s], o = t.indexes[r][i[r]], a = t.values[o] ?? 0;
119
- n[s] = a, i[r]++;
120
- }
121
- return n;
122
- }
123
- const Mn = (t, e) => {
124
- const n = Xe.createTransformer(e), i = oe(t), s = oe(e);
125
- return i.indexes.var.length === s.indexes.var.length && i.indexes.color.length === s.indexes.color.length && i.indexes.number.length >= s.indexes.number.length ? le.has(t) && !s.values.length || le.has(e) && !i.values.length ? xn(t, e) : ee(dt(Vn(i, s), s.values), n) : (Q(!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"), X(t, e));
126
- };
127
- function mt(t, e, n) {
128
- return typeof t == "number" && typeof e == "number" && typeof n == "number" ? Z(t, e, n) : ve(t)(t, e);
129
- }
130
- const Dn = (t) => {
131
- const e = ({ timestamp: n }) => t(n);
132
- return {
133
- start: (n = !0) => G.update(e, n),
134
- stop: () => Nt(e),
135
- /**
136
- * If we're processing this frame we can use the
137
- * framelocked timestamp to keep things in sync.
138
- */
139
- now: () => Pe.isProcessing ? Pe.timestamp : O.now()
140
- };
141
- }, pt = (t, e, n = 10) => {
142
- let i = "";
143
- const s = Math.max(Math.round(e / n), 2);
144
- for (let r = 0; r < s; r++)
145
- i += Math.round(t(r / (s - 1)) * 1e4) / 1e4 + ", ";
146
- return `linear(${i.substring(0, i.length - 2)})`;
147
- }, Y = 2e4;
148
- function Ae(t) {
149
- let e = 0;
150
- const n = 50;
151
- let i = t.next(e);
152
- for (; !i.done && e < Y; )
153
- e += n, i = t.next(e);
154
- return e >= Y ? 1 / 0 : e;
155
- }
156
- function Cn(t, e = 100, n) {
157
- const i = n({ ...t, keyframes: [0, e] }), s = Math.min(Ae(i), Y);
158
- return {
159
- type: "keyframes",
160
- ease: (r) => i.next(s * r).value / e,
161
- duration: /* @__PURE__ */ k(s)
162
- };
163
- }
164
- const Pn = 5;
165
- function gt(t, e, n) {
166
- const i = Math.max(e - Pn, 0);
167
- return Gt(n - t(i), e - i);
168
- }
169
- const S = {
170
- // Default spring physics
171
- stiffness: 100,
172
- damping: 10,
173
- mass: 1,
174
- velocity: 0,
175
- // Default duration/bounce-based options
176
- duration: 800,
177
- // in ms
178
- bounce: 0.3,
179
- visualDuration: 0.3,
180
- // in seconds
181
- // Rest thresholds
182
- restSpeed: {
183
- granular: 0.01,
184
- default: 2
185
- },
186
- restDelta: {
187
- granular: 5e-3,
188
- default: 0.5
189
- },
190
- // Limits
191
- minDuration: 0.01,
192
- // in seconds
193
- maxDuration: 10,
194
- // in seconds
195
- minDamping: 0.05,
196
- maxDamping: 1
197
- }, ie = 1e-3;
198
- function kn({ duration: t = S.duration, bounce: e = S.bounce, velocity: n = S.velocity, mass: i = S.mass }) {
199
- let s, r;
200
- Q(t <= /* @__PURE__ */ F(S.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
201
- let o = 1 - e;
202
- o = $(S.minDamping, S.maxDamping, o), t = $(S.minDuration, S.maxDuration, /* @__PURE__ */ k(t)), o < 1 ? (s = (l) => {
203
- const u = l * o, f = u * t, h = u - n, p = ue(l, o), v = Math.exp(-f);
204
- return ie - h / p * v;
205
- }, r = (l) => {
206
- const f = l * o * t, h = f * n + n, p = Math.pow(o, 2) * Math.pow(l, 2) * t, v = Math.exp(-f), y = ue(Math.pow(l, 2), o);
207
- return (-s(l) + ie > 0 ? -1 : 1) * ((h - p) * v) / y;
208
- }) : (s = (l) => {
209
- const u = Math.exp(-l * t), f = (l - n) * t + 1;
210
- return -ie + u * f;
211
- }, r = (l) => {
212
- const u = Math.exp(-l * t), f = (n - l) * (t * t);
213
- return u * f;
214
- });
215
- const a = 5 / t, c = On(s, r, a);
216
- if (t = /* @__PURE__ */ F(t), isNaN(c))
217
- return {
218
- stiffness: S.stiffness,
219
- damping: S.damping,
220
- duration: t
221
- };
222
- {
223
- const l = Math.pow(c, 2) * i;
224
- return {
225
- stiffness: l,
226
- damping: o * 2 * Math.sqrt(i * l),
227
- duration: t
228
- };
229
- }
230
- }
231
- const Fn = 12;
232
- function On(t, e, n) {
233
- let i = n;
234
- for (let s = 1; s < Fn; s++)
235
- i = i - t(i) / e(i);
236
- return i;
237
- }
238
- function ue(t, e) {
239
- return t * Math.sqrt(1 - e * e);
240
- }
241
- const In = ["duration", "bounce"], Kn = ["stiffness", "damping", "mass"];
242
- function Be(t, e) {
243
- return e.some((n) => t[n] !== void 0);
244
- }
245
- function Rn(t) {
246
- let e = {
247
- velocity: S.velocity,
248
- stiffness: S.stiffness,
249
- damping: S.damping,
250
- mass: S.mass,
251
- isResolvedFromDuration: !1,
252
- ...t
253
- };
254
- if (!Be(t, Kn) && Be(t, In))
255
- if (t.visualDuration) {
256
- const n = t.visualDuration, i = 2 * Math.PI / (n * 1.2), s = i * i, r = 2 * $(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(s);
257
- e = {
258
- ...e,
259
- mass: S.mass,
260
- stiffness: s,
261
- damping: r
262
- };
263
- } else {
264
- const n = kn(t);
265
- e = {
266
- ...e,
267
- ...n,
268
- mass: S.mass
269
- }, e.isResolvedFromDuration = !0;
270
- }
271
- return e;
272
- }
273
- function J(t = S.visualDuration, e = S.bounce) {
274
- const n = typeof t != "object" ? {
275
- visualDuration: t,
276
- keyframes: [0, 1],
277
- bounce: e
278
- } : t;
279
- let { restSpeed: i, restDelta: s } = n;
280
- const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: r }, { stiffness: c, damping: l, mass: u, duration: f, velocity: h, isResolvedFromDuration: p } = Rn({
281
- ...n,
282
- velocity: -/* @__PURE__ */ k(n.velocity || 0)
283
- }), v = h || 0, y = l / (2 * Math.sqrt(c * u)), T = o - r, d = /* @__PURE__ */ k(Math.sqrt(c / u)), A = Math.abs(T) < 5;
284
- i || (i = A ? S.restSpeed.granular : S.restSpeed.default), s || (s = A ? S.restDelta.granular : S.restDelta.default);
285
- let b;
286
- if (y < 1) {
287
- const m = ue(d, y);
288
- b = (x) => {
289
- const w = Math.exp(-y * d * x);
290
- return o - w * ((v + y * d * T) / m * Math.sin(m * x) + T * Math.cos(m * x));
291
- };
292
- } else if (y === 1)
293
- b = (m) => o - Math.exp(-d * m) * (T + (v + d * T) * m);
294
- else {
295
- const m = d * Math.sqrt(y * y - 1);
296
- b = (x) => {
297
- const w = Math.exp(-y * d * x), g = Math.min(m * x, 300);
298
- return o - w * ((v + y * d * T) * Math.sinh(g) + m * T * Math.cosh(g)) / m;
299
- };
300
- }
301
- const M = {
302
- calculatedDuration: p && f || null,
303
- next: (m) => {
304
- const x = b(m);
305
- if (p)
306
- a.done = m >= f;
307
- else {
308
- let w = m === 0 ? v : 0;
309
- y < 1 && (w = m === 0 ? /* @__PURE__ */ F(v) : gt(b, m, x));
310
- const g = Math.abs(w) <= i, D = Math.abs(o - x) <= s;
311
- a.done = g && D;
312
- }
313
- return a.value = a.done ? o : x, a;
314
- },
315
- toString: () => {
316
- const m = Math.min(Ae(M), Y), x = pt((w) => M.next(m * w).value, m, 30);
317
- return m + "ms " + x;
318
- },
319
- toTransition: () => {
320
- }
321
- };
322
- return M;
323
- }
324
- J.applyToOptions = (t) => {
325
- const e = Cn(t, 100, J);
326
- return t.ease = e.ease, t.duration = /* @__PURE__ */ F(e.duration), t.type = "keyframes", t;
327
- };
328
- function ce({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: i = 325, bounceDamping: s = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: c, restDelta: l = 0.5, restSpeed: u }) {
329
- const f = t[0], h = {
330
- done: !1,
331
- value: f
332
- }, p = (g) => a !== void 0 && g < a || c !== void 0 && g > c, v = (g) => a === void 0 ? c : c === void 0 || Math.abs(a - g) < Math.abs(c - g) ? a : c;
333
- let y = n * e;
334
- const T = f + y, d = o === void 0 ? T : o(T);
335
- d !== T && (y = d - f);
336
- const A = (g) => -y * Math.exp(-g / i), b = (g) => d + A(g), M = (g) => {
337
- const D = A(g), C = b(g);
338
- h.done = Math.abs(D) <= l, h.value = h.done ? d : C;
339
- };
340
- let m, x;
341
- const w = (g) => {
342
- p(h.value) && (m = g, x = J({
343
- keyframes: [h.value, v(h.value)],
344
- velocity: gt(b, g, h.value),
345
- // TODO: This should be passing * 1000
346
- damping: s,
347
- stiffness: r,
348
- restDelta: l,
349
- restSpeed: u
350
- }));
351
- };
352
- return w(0), {
353
- calculatedDuration: null,
354
- next: (g) => {
355
- let D = !1;
356
- return !x && m === void 0 && (D = !0, M(g), w(g)), m !== void 0 && g >= m ? x.next(g - m) : (!D && M(g), h);
357
- }
358
- };
359
- }
360
- function En(t, e, n) {
361
- const i = [], s = n || H.mix || mt, r = t.length - 1;
362
- for (let o = 0; o < r; o++) {
363
- let a = s(t[o], t[o + 1]);
364
- if (e) {
365
- const c = Array.isArray(e) ? e[o] || j : e;
366
- a = ee(c, a);
367
- }
368
- i.push(a);
369
- }
370
- return i;
371
- }
372
- function Bn(t, e, { clamp: n = !0, ease: i, mixer: s } = {}) {
373
- const r = t.length;
374
- if (N(r === e.length, "Both input and output ranges must be the same length", "range-length"), r === 1)
375
- return () => e[0];
376
- if (r === 2 && e[0] === e[1])
377
- return () => e[1];
378
- const o = t[0] === t[1];
379
- t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
380
- const a = En(e, i, s), c = a.length, l = (u) => {
381
- if (o && u < t[0])
382
- return e[0];
383
- let f = 0;
384
- if (c > 1)
385
- for (; f < t.length - 2 && !(u < t[f + 1]); f++)
386
- ;
387
- const h = /* @__PURE__ */ it(t[f], t[f + 1], u);
388
- return a[f](h);
389
- };
390
- return n ? (u) => l($(t[0], t[r - 1], u)) : l;
391
- }
392
- function Ln(t, e) {
393
- const n = t[t.length - 1];
394
- for (let i = 1; i <= e; i++) {
395
- const s = /* @__PURE__ */ it(0, e, i);
396
- t.push(Z(n, 1, s));
397
- }
398
- }
399
- function Nn(t) {
400
- const e = [0];
401
- return Ln(e, t.length - 1), e;
402
- }
403
- function Gn(t, e) {
404
- return t.map((n) => n * e);
405
- }
406
- function $n(t, e) {
407
- return t.map(() => e || ft).splice(0, t.length - 1);
408
- }
409
- function B({ duration: t = 300, keyframes: e, times: n, ease: i = "easeInOut" }) {
410
- const s = yn(i) ? i.map(Ke) : Ke(i), r = {
411
- done: !1,
412
- value: e[0]
413
- }, o = Gn(
414
- // Only use the provided offsets if they're the correct length
415
- // TODO Maybe we should warn here if there's a length mismatch
416
- n && n.length === e.length ? n : Nn(e),
417
- t
418
- ), a = Bn(o, e, {
419
- ease: Array.isArray(s) ? s : $n(e, s)
420
- });
421
- return {
422
- calculatedDuration: t,
423
- next: (c) => (r.value = a(c), r.done = c >= t, r)
424
- };
425
- }
426
- const Hn = (t) => t !== null;
427
- function xe(t, { repeat: e, repeatType: n = "loop" }, i, s = 1) {
428
- const r = t.filter(Hn), a = s < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
429
- return !a || i === void 0 ? r[a] : i;
430
- }
431
- const Wn = {
432
- decay: ce,
433
- inertia: ce,
434
- tween: B,
435
- keyframes: B,
436
- spring: J
437
- };
438
- function yt(t) {
439
- typeof t.type == "string" && (t.type = Wn[t.type]);
440
- }
441
- class Se {
442
- constructor() {
443
- this.updateFinished();
444
- }
445
- get finished() {
446
- return this._finished;
447
- }
448
- updateFinished() {
449
- this._finished = new Promise((e) => {
450
- this.resolve = e;
451
- });
452
- }
453
- notifyFinished() {
454
- this.resolve();
455
- }
456
- /**
457
- * Allows the animation to be awaited.
458
- *
459
- * @deprecated Use `finished` instead.
460
- */
461
- then(e, n) {
462
- return this.finished.then(e, n);
463
- }
464
- }
465
- const _n = (t) => t / 100;
466
- class we extends Se {
467
- constructor(e) {
468
- super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
469
- const { motionValue: n } = this.options;
470
- n && n.updatedAt !== O.now() && this.tick(O.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
471
- }, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
472
- }
473
- initAnimation() {
474
- const { options: e } = this;
475
- yt(e);
476
- const { type: n = B, repeat: i = 0, repeatDelay: s = 0, repeatType: r, velocity: o = 0 } = e;
477
- let { keyframes: a } = e;
478
- const c = n || B;
479
- Bt.env.NODE_ENV !== "production" && c !== B && N(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), c !== B && typeof a[0] != "number" && (this.mixKeyframes = ee(_n, mt(a[0], a[1])), a = [0, 100]);
480
- const l = c({ ...e, keyframes: a });
481
- r === "mirror" && (this.mirroredGenerator = c({
482
- ...e,
483
- keyframes: [...a].reverse(),
484
- velocity: -o
485
- })), l.calculatedDuration === null && (l.calculatedDuration = Ae(l));
486
- const { calculatedDuration: u } = l;
487
- this.calculatedDuration = u, this.resolvedDuration = u + s, this.totalDuration = this.resolvedDuration * (i + 1) - s, this.generator = l;
488
- }
489
- updateTime(e) {
490
- const n = Math.round(e - this.startTime) * this.playbackSpeed;
491
- this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
492
- }
493
- tick(e, n = !1) {
494
- const { generator: i, totalDuration: s, mixKeyframes: r, mirroredGenerator: o, resolvedDuration: a, calculatedDuration: c } = this;
495
- if (this.startTime === null)
496
- return i.next(0);
497
- const { delay: l = 0, keyframes: u, repeat: f, repeatType: h, repeatDelay: p, type: v, onUpdate: y, finalKeyframe: T } = this.options;
498
- this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - s / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e);
499
- const d = this.currentTime - l * (this.playbackSpeed >= 0 ? 1 : -1), A = this.playbackSpeed >= 0 ? d < 0 : d > s;
500
- this.currentTime = Math.max(d, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = s);
501
- let b = this.currentTime, M = i;
502
- if (f) {
503
- const g = Math.min(this.currentTime, s) / a;
504
- let D = Math.floor(g), C = g % 1;
505
- !C && g >= 1 && (C = 1), C === 1 && D--, D = Math.min(D, f + 1), D % 2 && (h === "reverse" ? (C = 1 - C, p && (C -= p / a)) : h === "mirror" && (M = o)), b = $(0, 1, C) * a;
506
- }
507
- const m = A ? { done: !1, value: u[0] } : M.next(b);
508
- r && (m.value = r(m.value));
509
- let { done: x } = m;
510
- !A && c !== null && (x = this.playbackSpeed >= 0 ? this.currentTime >= s : this.currentTime <= 0);
511
- const w = this.holdTime === null && (this.state === "finished" || this.state === "running" && x);
512
- return w && v !== ce && (m.value = xe(u, this.options, T, this.speed)), y && y(m.value), w && this.finish(), m;
513
- }
514
- /**
515
- * Allows the returned animation to be awaited or promise-chained. Currently
516
- * resolves when the animation finishes at all but in a future update could/should
517
- * reject if its cancels.
518
- */
519
- then(e, n) {
520
- return this.finished.then(e, n);
521
- }
522
- get duration() {
523
- return /* @__PURE__ */ k(this.calculatedDuration);
524
- }
525
- get iterationDuration() {
526
- const { delay: e = 0 } = this.options || {};
527
- return this.duration + /* @__PURE__ */ k(e);
528
- }
529
- get time() {
530
- return /* @__PURE__ */ k(this.currentTime);
531
- }
532
- set time(e) {
533
- 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), this.driver?.start(!1);
534
- }
535
- get speed() {
536
- return this.playbackSpeed;
537
- }
538
- set speed(e) {
539
- this.updateTime(O.now());
540
- const n = this.playbackSpeed !== e;
541
- this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ k(this.currentTime));
542
- }
543
- play() {
544
- if (this.isStopped)
545
- return;
546
- const { driver: e = Dn, startTime: n } = this.options;
547
- this.driver || (this.driver = e((s) => this.tick(s))), this.options.onPlay?.();
548
- const i = this.driver.now();
549
- this.state === "finished" ? (this.updateFinished(), this.startTime = i) : this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime || (this.startTime = n ?? i), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
550
- }
551
- pause() {
552
- this.state = "paused", this.updateTime(O.now()), this.holdTime = this.currentTime;
553
- }
554
- complete() {
555
- this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
556
- }
557
- finish() {
558
- this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
559
- }
560
- cancel() {
561
- this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
562
- }
563
- teardown() {
564
- this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
565
- }
566
- stopDriver() {
567
- this.driver && (this.driver.stop(), this.driver = void 0);
568
- }
569
- sample(e) {
570
- return this.startTime = 0, this.tick(e, !0);
571
- }
572
- attachTimeline(e) {
573
- return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
574
- }
575
- }
576
- const jn = (t) => t.startsWith("--");
577
- function Un(t, e, n) {
578
- jn(e) ? t.style.setProperty(e, n) : t.style[e] = n;
579
- }
580
- const zn = /* @__PURE__ */ ye(() => window.ScrollTimeline !== void 0), qn = {};
581
- function Xn(t, e) {
582
- const n = /* @__PURE__ */ ye(t);
583
- return () => qn[e] ?? n();
584
- }
585
- const Tt = /* @__PURE__ */ Xn(() => {
586
- try {
587
- document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
588
- } catch {
589
- return !1;
590
- }
591
- return !0;
592
- }, "linearEasing"), _ = ([t, e, n, i]) => `cubic-bezier(${t}, ${e}, ${n}, ${i})`, Le = {
593
- linear: "linear",
594
- ease: "ease",
595
- easeIn: "ease-in",
596
- easeOut: "ease-out",
597
- easeInOut: "ease-in-out",
598
- circIn: /* @__PURE__ */ _([0, 0.65, 0.55, 1]),
599
- circOut: /* @__PURE__ */ _([0.55, 0, 1, 0.45]),
600
- backIn: /* @__PURE__ */ _([0.31, 0.01, 0.66, -0.59]),
601
- backOut: /* @__PURE__ */ _([0.33, 1.53, 0.69, 0.99])
602
- };
603
- function bt(t, e) {
604
- if (t)
605
- return typeof t == "function" ? Tt() ? pt(t, e) : "ease-out" : ht(t) ? _(t) : Array.isArray(t) ? t.map((n) => bt(n, e) || Le.easeOut) : Le[t];
606
- }
607
- function Yn(t, e, n, { delay: i = 0, duration: s = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeOut", times: c } = {}, l = void 0) {
608
- const u = {
609
- [e]: n
610
- };
611
- c && (u.offset = c);
612
- const f = bt(a, s);
613
- Array.isArray(f) && (u.easing = f);
614
- const h = {
615
- delay: i,
616
- duration: s,
617
- easing: Array.isArray(f) ? "linear" : f,
618
- fill: "both",
619
- iterations: r + 1,
620
- direction: o === "reverse" ? "alternate" : "normal"
621
- };
622
- return l && (h.pseudoElement = l), t.animate(u, h);
623
- }
624
- function vt(t) {
625
- return typeof t == "function" && "applyToOptions" in t;
626
- }
627
- function Jn({ type: t, ...e }) {
628
- return vt(t) && Tt() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
629
- }
630
- class Zn extends Se {
631
- constructor(e) {
632
- if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !e)
633
- return;
634
- const { element: n, name: i, keyframes: s, pseudoElement: r, allowFlatten: o = !1, finalKeyframe: a, onComplete: c } = e;
635
- this.isPseudoElement = !!r, this.allowFlatten = o, this.options = e, N(typeof e.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
636
- const l = Jn(e);
637
- this.animation = Yn(n, i, s, l, r), l.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
638
- if (this.finishedTime = this.time, !r) {
639
- const u = xe(s, this.options, a, this.speed);
640
- this.updateMotionValue ? this.updateMotionValue(u) : Un(n, i, u), this.animation.cancel();
641
- }
642
- c?.(), this.notifyFinished();
643
- };
644
- }
645
- play() {
646
- this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished());
647
- }
648
- pause() {
649
- this.animation.pause();
650
- }
651
- complete() {
652
- this.animation.finish?.();
653
- }
654
- cancel() {
655
- try {
656
- this.animation.cancel();
657
- } catch {
658
- }
659
- }
660
- stop() {
661
- if (this.isStopped)
662
- return;
663
- this.isStopped = !0;
664
- const { state: e } = this;
665
- e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
666
- }
667
- /**
668
- * WAAPI doesn't natively have any interruption capabilities.
669
- *
670
- * In this method, we commit styles back to the DOM before cancelling
671
- * the animation.
672
- *
673
- * This is designed to be overridden by NativeAnimationExtended, which
674
- * will create a renderless JS animation and sample it twice to calculate
675
- * its current value, "previous" value, and therefore allow
676
- * Motion to also correctly calculate velocity for any subsequent animation
677
- * while deferring the commit until the next animation frame.
678
- */
679
- commitStyles() {
680
- this.isPseudoElement || this.animation.commitStyles?.();
681
- }
682
- get duration() {
683
- const e = this.animation.effect?.getComputedTiming?.().duration || 0;
684
- return /* @__PURE__ */ k(Number(e));
685
- }
686
- get iterationDuration() {
687
- const { delay: e = 0 } = this.options || {};
688
- return this.duration + /* @__PURE__ */ k(e);
689
- }
690
- get time() {
691
- return /* @__PURE__ */ k(Number(this.animation.currentTime) || 0);
692
- }
693
- set time(e) {
694
- this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ F(e);
695
- }
696
- /**
697
- * The playback speed of the animation.
698
- * 1 = normal speed, 2 = double speed, 0.5 = half speed.
699
- */
700
- get speed() {
701
- return this.animation.playbackRate;
702
- }
703
- set speed(e) {
704
- e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
705
- }
706
- get state() {
707
- return this.finishedTime !== null ? "finished" : this.animation.playState;
708
- }
709
- get startTime() {
710
- return this.manualStartTime ?? Number(this.animation.startTime);
711
- }
712
- set startTime(e) {
713
- this.manualStartTime = this.animation.startTime = e;
714
- }
715
- /**
716
- * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
717
- */
718
- attachTimeline({ timeline: e, observe: n }) {
719
- return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && zn() ? (this.animation.timeline = e, j) : n(this);
720
- }
721
- }
722
- const At = {
723
- anticipate: ut,
724
- backInOut: lt,
725
- circInOut: ct
726
- };
727
- function Qn(t) {
728
- return t in At;
729
- }
730
- function ei(t) {
731
- typeof t.ease == "string" && Qn(t.ease) && (t.ease = At[t.ease]);
732
- }
733
- const se = 10;
734
- class ti extends Zn {
735
- constructor(e) {
736
- ei(e), yt(e), super(e), e.startTime !== void 0 && (this.startTime = e.startTime), this.options = e;
737
- }
738
- /**
739
- * WAAPI doesn't natively have any interruption capabilities.
740
- *
741
- * Rather than read committed styles back out of the DOM, we can
742
- * create a renderless JS animation and sample it twice to calculate
743
- * its current value, "previous" value, and therefore allow
744
- * Motion to calculate velocity for any subsequent animation.
745
- */
746
- updateMotionValue(e) {
747
- const { motionValue: n, onUpdate: i, onComplete: s, element: r, ...o } = this.options;
748
- if (!n)
749
- return;
750
- if (e !== void 0) {
751
- n.set(e);
752
- return;
753
- }
754
- const a = new we({
755
- ...o,
756
- autoplay: !1
757
- }), c = Math.max(se, O.now() - this.startTime), l = $(0, se, c - se);
758
- n.setWithVelocity(a.sample(Math.max(0, c - l)).value, a.sample(c).value, l), a.stop();
759
- }
760
- }
761
- const Ne = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
762
- (Xe.test(t) || t === "0") && // And it contains numbers and/or colors
763
- !t.startsWith("url("));
764
- function ni(t) {
765
- const e = t[0];
766
- if (t.length === 1)
767
- return !0;
768
- for (let n = 0; n < t.length; n++)
769
- if (t[n] !== e)
770
- return !0;
771
- }
772
- function ii(t, e, n, i) {
773
- const s = t[0];
774
- if (s === null)
775
- return !1;
776
- if (e === "display" || e === "visibility")
777
- return !0;
778
- const r = t[t.length - 1], o = Ne(s, e), a = Ne(r, e);
779
- return Q(o === a, `You are trying to animate ${e} from "${s}" to "${r}". "${o ? r : s}" is not an animatable value.`, "value-not-animatable"), !o || !a ? !1 : ni(t) || (n === "spring" || vt(n)) && i;
780
- }
781
- function fe(t) {
782
- t.duration = 0, t.type = "keyframes";
783
- }
784
- const si = /* @__PURE__ */ new Set([
785
- "opacity",
786
- "clipPath",
787
- "filter",
788
- "transform"
789
- // TODO: Could be re-enabled now we have support for linear() easing
790
- // "background-color"
791
- ]), ri = /* @__PURE__ */ ye(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
792
- function ai(t) {
793
- const { motionValue: e, name: n, repeatDelay: i, repeatType: s, damping: r, type: o } = t;
794
- if (!(e?.owner?.current instanceof HTMLElement))
795
- return !1;
796
- const { onUpdate: c, transformTemplate: l } = e.owner.getProps();
797
- return ri() && n && si.has(n) && (n !== "transform" || !l) && /**
798
- * If we're outputting values to onUpdate then we can't use WAAPI as there's
799
- * no way to read the value from WAAPI every frame.
800
- */
801
- !c && !i && s !== "mirror" && r !== 0 && o !== "inertia";
802
- }
803
- const oi = 40;
804
- class li extends Se {
805
- constructor({ autoplay: e = !0, delay: n = 0, type: i = "keyframes", repeat: s = 0, repeatDelay: r = 0, repeatType: o = "loop", keyframes: a, name: c, motionValue: l, element: u, ...f }) {
806
- super(), this.stop = () => {
807
- this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
808
- }, this.createdAt = O.now();
809
- const h = {
810
- autoplay: e,
811
- delay: n,
812
- type: i,
813
- repeat: s,
814
- repeatDelay: r,
815
- repeatType: o,
816
- name: c,
817
- motionValue: l,
818
- element: u,
819
- ...f
820
- }, p = u?.KeyframeResolver || Ye;
821
- this.keyframeResolver = new p(a, (v, y, T) => this.onKeyframesResolved(v, y, h, !T), c, l, u), this.keyframeResolver?.scheduleResolve();
822
- }
823
- onKeyframesResolved(e, n, i, s) {
824
- this.keyframeResolver = void 0;
825
- const { name: r, type: o, velocity: a, delay: c, isHandoff: l, onUpdate: u } = i;
826
- this.resolvedAt = O.now(), ii(e, r, o, a) || ((H.instantAnimations || !c) && u?.(xe(e, i, n)), e[0] = e[e.length - 1], fe(i), i.repeat = 0);
827
- const h = {
828
- startTime: s ? this.resolvedAt ? this.resolvedAt - this.createdAt > oi ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
829
- finalKeyframe: n,
830
- ...i,
831
- keyframes: e
832
- }, p = !l && ai(h), v = h.motionValue?.owner?.current, y = p ? new ti({
833
- ...h,
834
- element: v
835
- }) : new we(h);
836
- y.finished.then(() => {
837
- this.notifyFinished();
838
- }).catch(j), this.pendingTimeline && (this.stopTimeline = y.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = y;
839
- }
840
- get finished() {
841
- return this._animation ? this.animation.finished : this._finished;
842
- }
843
- then(e, n) {
844
- return this.finished.finally(e).then(() => {
845
- });
846
- }
847
- get animation() {
848
- return this._animation || (this.keyframeResolver?.resume(), $t()), this._animation;
849
- }
850
- get duration() {
851
- return this.animation.duration;
852
- }
853
- get iterationDuration() {
854
- return this.animation.iterationDuration;
855
- }
856
- get time() {
857
- return this.animation.time;
858
- }
859
- set time(e) {
860
- this.animation.time = e;
861
- }
862
- get speed() {
863
- return this.animation.speed;
864
- }
865
- get state() {
866
- return this.animation.state;
867
- }
868
- set speed(e) {
869
- this.animation.speed = e;
870
- }
871
- get startTime() {
872
- return this.animation.startTime;
873
- }
874
- attachTimeline(e) {
875
- return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
876
- }
877
- play() {
878
- this.animation.play();
879
- }
880
- pause() {
881
- this.animation.pause();
882
- }
883
- complete() {
884
- this.animation.complete();
885
- }
886
- cancel() {
887
- this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
888
- }
889
- }
890
- function xt(t, e, n, i = 0, s = 1) {
891
- const r = Array.from(t).sort((l, u) => l.sortNodePosition(u)).indexOf(e), o = t.size, a = (o - 1) * i;
892
- return typeof n == "function" ? n(r, o) : s === 1 ? r * i : a - r * i;
893
- }
894
- const ui = (
895
- // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
896
- /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
897
- );
898
- function ci(t) {
899
- const e = ui.exec(t);
900
- if (!e)
901
- return [,];
902
- const [, n, i, s] = e;
903
- return [`--${n ?? i}`, s];
904
- }
905
- const fi = 4;
906
- function St(t, e, n = 1) {
907
- N(n <= fi, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
908
- const [i, s] = ci(t);
909
- if (!i)
910
- return;
911
- const r = window.getComputedStyle(e).getPropertyValue(i);
912
- if (r) {
913
- const o = r.trim();
914
- return Ht(o) ? parseFloat(o) : o;
915
- }
916
- return pe(s) ? St(s, e, n + 1) : s;
917
- }
918
- const hi = {
919
- type: "spring",
920
- stiffness: 500,
921
- damping: 25,
922
- restSpeed: 10
923
- }, di = (t) => ({
924
- type: "spring",
925
- stiffness: 550,
926
- damping: t === 0 ? 2 * Math.sqrt(550) : 30,
927
- restSpeed: 10
928
- }), mi = {
929
- type: "keyframes",
930
- duration: 0.8
931
- }, pi = {
932
- type: "keyframes",
933
- ease: [0.25, 0.1, 0.35, 1],
934
- duration: 0.3
935
- }, gi = (t, { keyframes: e }) => e.length > 2 ? mi : ge.has(t) ? t.startsWith("scale") ? di(e[1]) : hi : pi, yi = (t) => t !== null;
936
- function Ti(t, { repeat: e, repeatType: n = "loop" }, i) {
937
- const s = t.filter(yi), r = e && n !== "loop" && e % 2 === 1 ? 0 : s.length - 1;
938
- return s[r];
939
- }
940
- function wt(t, e) {
941
- return t?.[e] ?? t?.default ?? t;
942
- }
943
- function bi({ when: t, delay: e, delayChildren: n, staggerChildren: i, staggerDirection: s, repeat: r, repeatType: o, repeatDelay: a, from: c, elapsed: l, ...u }) {
944
- return !!Object.keys(u).length;
945
- }
946
- const vi = (t, e, n, i = {}, s, r) => (o) => {
947
- const a = wt(i, t) || {}, c = a.delay || i.delay || 0;
948
- let { elapsed: l = 0 } = i;
949
- l = l - /* @__PURE__ */ F(c);
950
- const u = {
951
- keyframes: Array.isArray(n) ? n : [null, n],
952
- ease: "easeOut",
953
- velocity: e.getVelocity(),
954
- ...a,
955
- delay: -l,
956
- onUpdate: (h) => {
957
- e.set(h), a.onUpdate && a.onUpdate(h);
958
- },
959
- onComplete: () => {
960
- o(), a.onComplete && a.onComplete();
961
- },
962
- name: t,
963
- motionValue: e,
964
- element: r ? void 0 : s
965
- };
966
- bi(a) || Object.assign(u, gi(t, u)), u.duration && (u.duration = /* @__PURE__ */ F(u.duration)), u.repeatDelay && (u.repeatDelay = /* @__PURE__ */ F(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
967
- let f = !1;
968
- if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (fe(u), u.delay === 0 && (f = !0)), (H.instantAnimations || H.skipAnimations) && (f = !0, fe(u), u.delay = 0), u.allowFlatten = !a.type && !a.ease, f && !r && e.get() !== void 0) {
969
- const h = Ti(u.keyframes, a);
970
- if (h !== void 0) {
971
- G.update(() => {
972
- u.onUpdate(h), u.onComplete();
973
- });
974
- return;
975
- }
976
- }
977
- return a.isSync ? new we(u) : new li(u);
978
- };
979
- function L(t, e, n) {
980
- const i = t.getProps();
981
- return Wt(i, e, n !== void 0 ? n : i.custom, t);
982
- }
983
- const Vt = /* @__PURE__ */ new Set([
984
- "width",
985
- "height",
986
- "top",
987
- "left",
988
- "right",
989
- "bottom",
990
- ..._t
991
- ]), he = (t) => Array.isArray(t);
992
- function Ai(t, e, n) {
993
- t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, jt(n));
994
- }
995
- function xi(t) {
996
- return he(t) ? t[t.length - 1] || 0 : t;
997
- }
998
- function Si(t, e) {
999
- const n = L(t, e);
1000
- let { transitionEnd: i = {}, transition: s = {}, ...r } = n || {};
1001
- r = { ...r, ...i };
1002
- for (const o in r) {
1003
- const a = xi(r[o]);
1004
- Ai(t, o, a);
1005
- }
1006
- }
1007
- function wi(t) {
1008
- return !!(Je(t) && t.add);
1009
- }
1010
- function Vi(t, e) {
1011
- const n = t.getValue("willChange");
1012
- if (wi(n))
1013
- return n.add(e);
1014
- if (!n && H.WillChange) {
1015
- const i = new H.WillChange("auto");
1016
- t.addValue("willChange", i), i.add(e);
1017
- }
1018
- }
1019
- function Mi(t) {
1020
- return t.props[Ut];
1021
- }
1022
- function Di({ protectedKeys: t, needsAnimating: e }, n) {
1023
- const i = t.hasOwnProperty(n) && e[n] !== !0;
1024
- return e[n] = !1, i;
1025
- }
1026
- function Mt(t, e, { delay: n = 0, transitionOverride: i, type: s } = {}) {
1027
- let { transition: r = t.getDefaultTransition(), transitionEnd: o, ...a } = e;
1028
- const c = r?.reduceMotion;
1029
- i && (r = i);
1030
- const l = [], u = s && t.animationState && t.animationState.getState()[s];
1031
- for (const f in a) {
1032
- const h = t.getValue(f, t.latestValues[f] ?? null), p = a[f];
1033
- if (p === void 0 || u && Di(u, f))
1034
- continue;
1035
- const v = {
1036
- delay: n,
1037
- ...wt(r || {}, f)
1038
- }, y = h.get();
1039
- if (y !== void 0 && !h.isAnimating && !Array.isArray(p) && p === y && !v.velocity)
1040
- continue;
1041
- let T = !1;
1042
- if (window.MotionHandoffAnimation) {
1043
- const b = Mi(t);
1044
- if (b) {
1045
- const M = window.MotionHandoffAnimation(b, f, G);
1046
- M !== null && (v.startTime = M, T = !0);
1047
- }
1048
- }
1049
- Vi(t, f);
1050
- const d = c ?? t.shouldReduceMotion;
1051
- h.start(vi(f, h, p, d && Vt.has(f) ? { type: !1 } : v, t, T));
1052
- const A = h.animation;
1053
- A && l.push(A);
1054
- }
1055
- return o && Promise.all(l).then(() => {
1056
- G.update(() => {
1057
- o && Si(t, o);
1058
- });
1059
- }), l;
1060
- }
1061
- function de(t, e, n = {}) {
1062
- const i = L(t, e, n.type === "exit" ? t.presenceContext?.custom : void 0);
1063
- let { transition: s = t.getDefaultTransition() || {} } = i || {};
1064
- n.transitionOverride && (s = n.transitionOverride);
1065
- const r = i ? () => Promise.all(Mt(t, i, n)) : () => Promise.resolve(), o = t.variantChildren && t.variantChildren.size ? (c = 0) => {
1066
- const { delayChildren: l = 0, staggerChildren: u, staggerDirection: f } = s;
1067
- return Ci(t, e, c, l, u, f, n);
1068
- } : () => Promise.resolve(), { when: a } = s;
1069
- if (a) {
1070
- const [c, l] = a === "beforeChildren" ? [r, o] : [o, r];
1071
- return c().then(() => l());
1072
- } else
1073
- return Promise.all([r(), o(n.delay)]);
1074
- }
1075
- function Ci(t, e, n = 0, i = 0, s = 0, r = 1, o) {
1076
- const a = [];
1077
- for (const c of t.variantChildren)
1078
- c.notify("AnimationStart", e), a.push(de(c, e, {
1079
- ...o,
1080
- delay: n + (typeof i == "function" ? 0 : i) + xt(t.variantChildren, c, i, s, r)
1081
- }).then(() => c.notify("AnimationComplete", e)));
1082
- return Promise.all(a);
1083
- }
1084
- function Pi(t, e, n = {}) {
1085
- t.notify("AnimationStart", e);
1086
- let i;
1087
- if (Array.isArray(e)) {
1088
- const s = e.map((r) => de(t, r, n));
1089
- i = Promise.all(s);
1090
- } else if (typeof e == "string")
1091
- i = de(t, e, n);
1092
- else {
1093
- const s = typeof e == "function" ? L(t, e, n.custom) : e;
1094
- i = Promise.all(Mt(t, s, n));
1095
- }
1096
- return i.then(() => {
1097
- t.notify("AnimationComplete", e);
1098
- });
1099
- }
1100
- function ki(t) {
1101
- return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || zt(t) : !0;
1102
- }
1103
- const Fi = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1104
- function Oi(t, e, n) {
1105
- let i = 0, s;
1106
- for (; i < t.length && !s; ) {
1107
- const r = t[i];
1108
- typeof r == "string" && !Fi.has(r) && oe(r).values.length && (s = t[i]), i++;
1109
- }
1110
- if (s && n)
1111
- for (const r of e)
1112
- t[r] = qt(n, s);
1113
- }
1114
- class Ii extends Ye {
1115
- constructor(e, n, i, s, r) {
1116
- super(e, n, i, s, r, !0);
1117
- }
1118
- readKeyframes() {
1119
- const { unresolvedKeyframes: e, element: n, name: i } = this;
1120
- if (!n || !n.current)
1121
- return;
1122
- super.readKeyframes();
1123
- for (let u = 0; u < e.length; u++) {
1124
- let f = e[u];
1125
- if (typeof f == "string" && (f = f.trim(), pe(f))) {
1126
- const h = St(f, n.current);
1127
- h !== void 0 && (e[u] = h), u === e.length - 1 && (this.finalKeyframe = f);
1128
- }
1129
- }
1130
- if (this.resolveNoneKeyframes(), !Vt.has(i) || e.length !== 2)
1131
- return;
1132
- const [s, r] = e, o = ke(s), a = ke(r), c = Fe(s), l = Fe(r);
1133
- if (c !== l && z[i]) {
1134
- this.needsMeasurement = !0;
1135
- return;
1136
- }
1137
- if (o !== a)
1138
- if (Oe(o) && Oe(a))
1139
- for (let u = 0; u < e.length; u++) {
1140
- const f = e[u];
1141
- typeof f == "string" && (e[u] = parseFloat(f));
1142
- }
1143
- else z[i] && (this.needsMeasurement = !0);
1144
- }
1145
- resolveNoneKeyframes() {
1146
- const { unresolvedKeyframes: e, name: n } = this, i = [];
1147
- for (let s = 0; s < e.length; s++)
1148
- (e[s] === null || ki(e[s])) && i.push(s);
1149
- i.length && Oi(e, i, n);
1150
- }
1151
- measureInitialState() {
1152
- const { element: e, unresolvedKeyframes: n, name: i } = this;
1153
- if (!e || !e.current)
1154
- return;
1155
- i === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = z[i](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
1156
- const s = n[n.length - 1];
1157
- s !== void 0 && e.getValue(i, s).jump(s, !1);
1158
- }
1159
- measureEndState() {
1160
- const { element: e, name: n, unresolvedKeyframes: i } = this;
1161
- if (!e || !e.current)
1162
- return;
1163
- const s = e.getValue(n);
1164
- s && s.jump(this.measuredOrigin, !1);
1165
- const r = i.length - 1, o = i[r];
1166
- i[r] = z[n](e.measureViewportBox(), window.getComputedStyle(e.current)), o !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = o), this.removedTransforms?.length && this.removedTransforms.forEach(([a, c]) => {
1167
- e.getValue(a).set(c);
1168
- }), this.resolveNoneKeyframes();
1169
- }
1170
- }
1171
- function Ki(t, e, n) {
1172
- if (t == null)
1173
- return [];
1174
- if (t instanceof EventTarget)
1175
- return [t];
1176
- if (typeof t == "string") {
1177
- let i = document;
1178
- const s = n?.[t] ?? i.querySelectorAll(t);
1179
- return s ? Array.from(s) : [];
1180
- }
1181
- return Array.from(t).filter((i) => i != null);
1182
- }
1183
- const Ri = {
1184
- y: !1
1185
- };
1186
- function Ei() {
1187
- return Ri.y;
1188
- }
1189
- function Dt(t, e) {
1190
- const n = Ki(t), i = new AbortController(), s = {
1191
- passive: !0,
1192
- ...e,
1193
- signal: i.signal
1194
- };
1195
- return [n, s, () => i.abort()];
1196
- }
1197
- function Ge(t) {
1198
- return !(t.pointerType === "touch" || Ei());
1199
- }
1200
- function Bi(t, e, n = {}) {
1201
- const [i, s, r] = Dt(t, n), o = (a) => {
1202
- if (!Ge(a))
1203
- return;
1204
- const { target: c } = a, l = e(c, a);
1205
- if (typeof l != "function" || !c)
1206
- return;
1207
- const u = (f) => {
1208
- Ge(f) && (l(f), c.removeEventListener("pointerleave", u));
1209
- };
1210
- c.addEventListener("pointerleave", u, s);
1211
- };
1212
- return i.forEach((a) => {
1213
- a.addEventListener("pointerenter", o, s);
1214
- }), r;
1215
- }
1216
- const Ct = (t, e) => e ? t === e ? !0 : Ct(t, e.parentElement) : !1, Li = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Ni = /* @__PURE__ */ new Set([
1217
- "BUTTON",
1218
- "INPUT",
1219
- "SELECT",
1220
- "TEXTAREA",
1221
- "A"
1222
- ]);
1223
- function Gi(t) {
1224
- return Ni.has(t.tagName) || t.isContentEditable === !0;
1225
- }
1226
- const q = /* @__PURE__ */ new WeakSet();
1227
- function $e(t) {
1228
- return (e) => {
1229
- e.key === "Enter" && t(e);
1230
- };
1231
- }
1232
- function re(t, e) {
1233
- t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
1234
- }
1235
- const $i = (t, e) => {
1236
- const n = t.currentTarget;
1237
- if (!n)
1238
- return;
1239
- const i = $e(() => {
1240
- if (q.has(n))
1241
- return;
1242
- re(n, "down");
1243
- const s = $e(() => {
1244
- re(n, "up");
1245
- }), r = () => re(n, "cancel");
1246
- n.addEventListener("keyup", s, e), n.addEventListener("blur", r, e);
1247
- });
1248
- n.addEventListener("keydown", i, e), n.addEventListener("blur", () => n.removeEventListener("keydown", i), e);
1249
- };
1250
- function He(t) {
1251
- return Li(t) && !0;
1252
- }
1253
- function Hi(t, e, n = {}) {
1254
- const [i, s, r] = Dt(t, n), o = (a) => {
1255
- const c = a.currentTarget;
1256
- if (!He(a))
1257
- return;
1258
- q.add(c);
1259
- const l = e(c, a), u = (p, v) => {
1260
- window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", h), q.has(c) && q.delete(c), He(p) && typeof l == "function" && l(p, { success: v });
1261
- }, f = (p) => {
1262
- u(p, c === window || c === document || n.useGlobalTarget || Ct(c, p.target));
1263
- }, h = (p) => {
1264
- u(p, !1);
1265
- };
1266
- window.addEventListener("pointerup", f, s), window.addEventListener("pointercancel", h, s);
1267
- };
1268
- return i.forEach((a) => {
1269
- (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, s), Xt(a) && (a.addEventListener("focus", (l) => $i(l, s)), !Gi(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
1270
- }), r;
1271
- }
1272
- class Pt extends Yt {
1273
- constructor() {
1274
- super(...arguments), this.KeyframeResolver = Ii;
1275
- }
1276
- sortInstanceNodePosition(e, n) {
1277
- return e.compareDocumentPosition(n) & 2 ? 1 : -1;
1278
- }
1279
- getBaseTargetFromProps(e, n) {
1280
- const i = e.style;
1281
- return i ? i[n] : void 0;
1282
- }
1283
- removeValueFromRenderState(e, { vars: n, style: i }) {
1284
- delete n[e], delete i[e];
1285
- }
1286
- handleChildMotionValue() {
1287
- this.childSubscription && (this.childSubscription(), delete this.childSubscription);
1288
- const { children: e } = this.props;
1289
- Je(e) && (this.childSubscription = e.on("change", (n) => {
1290
- this.current && (this.current.textContent = `${n}`);
1291
- }));
1292
- }
1293
- }
1294
- class W {
1295
- constructor(e) {
1296
- this.isMounted = !1, this.node = e;
1297
- }
1298
- update() {
1299
- }
1300
- }
1301
- function Wi({ top: t, left: e, right: n, bottom: i }) {
1302
- return {
1303
- x: { min: e, max: n },
1304
- y: { min: t, max: i }
1305
- };
1306
- }
1307
- function _i(t, e) {
1308
- if (!e)
1309
- return t;
1310
- const n = e({ x: t.left, y: t.top }), i = e({ x: t.right, y: t.bottom });
1311
- return {
1312
- top: n.y,
1313
- left: n.x,
1314
- bottom: i.y,
1315
- right: i.x
1316
- };
1317
- }
1318
- function ji(t, e) {
1319
- return Wi(_i(t.getBoundingClientRect(), e));
1320
- }
1321
- function kt(t, { style: e, vars: n }, i, s) {
1322
- const r = t.style;
1323
- let o;
1324
- for (o in e)
1325
- r[o] = e[o];
1326
- s?.applyProjectionStyles(r, i);
1327
- for (o in n)
1328
- r.setProperty(o, n[o]);
1329
- }
1330
- function Ui(t) {
1331
- return window.getComputedStyle(t);
1332
- }
1333
- class zi extends Pt {
1334
- constructor() {
1335
- super(...arguments), this.type = "html", this.renderInstance = kt;
1336
- }
1337
- readValueFromInstance(e, n) {
1338
- if (ge.has(n))
1339
- return this.projection?.isProjecting ? Jt(n) : Zt(e, n);
1340
- {
1341
- const i = Ui(e), s = (Qt(n) ? i.getPropertyValue(n) : i[n]) || 0;
1342
- return typeof s == "string" ? s.trim() : s;
1343
- }
1344
- }
1345
- measureInstanceViewportBox(e, { transformPagePoint: n }) {
1346
- return ji(e, n);
1347
- }
1348
- build(e, n, i) {
1349
- en(e, n, i.transformTemplate);
1350
- }
1351
- scrapeMotionValuesFromProps(e, n, i) {
1352
- return tn(e, n, i);
1353
- }
1354
- }
1355
- const Ft = /* @__PURE__ */ new Set([
1356
- "baseFrequency",
1357
- "diffuseConstant",
1358
- "kernelMatrix",
1359
- "kernelUnitLength",
1360
- "keySplines",
1361
- "keyTimes",
1362
- "limitingConeAngle",
1363
- "markerHeight",
1364
- "markerWidth",
1365
- "numOctaves",
1366
- "targetX",
1367
- "targetY",
1368
- "surfaceScale",
1369
- "specularConstant",
1370
- "specularExponent",
1371
- "stdDeviation",
1372
- "tableValues",
1373
- "viewBox",
1374
- "gradientTransform",
1375
- "pathLength",
1376
- "startOffset",
1377
- "textLength",
1378
- "lengthAdjust"
1379
- ]);
1380
- function qi(t, e, n, i) {
1381
- kt(t, e, void 0, i);
1382
- for (const s in e.attrs)
1383
- t.setAttribute(Ft.has(s) ? s : Ze(s), e.attrs[s]);
1384
- }
1385
- class Xi extends Pt {
1386
- constructor() {
1387
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = nn;
1388
- }
1389
- getBaseTargetFromProps(e, n) {
1390
- return e[n];
1391
- }
1392
- readValueFromInstance(e, n) {
1393
- if (ge.has(n)) {
1394
- const i = on(n);
1395
- return i && i.default || 0;
1396
- }
1397
- return n = Ft.has(n) ? n : Ze(n), e.getAttribute(n);
1398
- }
1399
- scrapeMotionValuesFromProps(e, n, i) {
1400
- return sn(e, n, i);
1401
- }
1402
- build(e, n, i) {
1403
- rn(e, n, this.isSVGTag, i.transformTemplate, i.style);
1404
- }
1405
- renderInstance(e, n, i, s) {
1406
- qi(e, n, i, s);
1407
- }
1408
- mount(e) {
1409
- this.isSVGTag = an(e.tagName), super.mount(e);
1410
- }
1411
- }
1412
- const Yi = et.length;
1413
- function Ot(t) {
1414
- if (!t)
1415
- return;
1416
- if (!t.isControllingVariants) {
1417
- const n = t.parent ? Ot(t.parent) || {} : {};
1418
- return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
1419
- }
1420
- const e = {};
1421
- for (let n = 0; n < Yi; n++) {
1422
- const i = et[n], s = t.props[i];
1423
- (Qe(s) || s === !1) && (e[i] = s);
1424
- }
1425
- return e;
1426
- }
1427
- function It(t, e) {
1428
- if (!Array.isArray(e))
1429
- return !1;
1430
- const n = e.length;
1431
- if (n !== t.length)
1432
- return !1;
1433
- for (let i = 0; i < n; i++)
1434
- if (e[i] !== t[i])
1435
- return !1;
1436
- return !0;
1437
- }
1438
- const Ji = [...nt].reverse(), Zi = nt.length;
1439
- function Qi(t) {
1440
- return (e) => Promise.all(e.map(({ animation: n, options: i }) => Pi(t, n, i)));
1441
- }
1442
- function es(t) {
1443
- let e = Qi(t), n = We(), i = !0;
1444
- const s = (c) => (l, u) => {
1445
- const f = L(t, u, c === "exit" ? t.presenceContext?.custom : void 0);
1446
- if (f) {
1447
- const { transition: h, transitionEnd: p, ...v } = f;
1448
- l = { ...l, ...v, ...p };
1449
- }
1450
- return l;
1451
- };
1452
- function r(c) {
1453
- e = c(t);
1454
- }
1455
- function o(c) {
1456
- const { props: l } = t, u = Ot(t.parent) || {}, f = [], h = /* @__PURE__ */ new Set();
1457
- let p = {}, v = 1 / 0;
1458
- for (let T = 0; T < Zi; T++) {
1459
- const d = Ji[T], A = n[d], b = l[d] !== void 0 ? l[d] : u[d], M = Qe(b), m = d === c ? A.isActive : null;
1460
- m === !1 && (v = T);
1461
- let x = b === u[d] && b !== l[d] && M;
1462
- if (x && i && t.manuallyAnimateOnMount && (x = !1), A.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
1463
- !A.isActive && m === null || // If we didn't and don't have any defined prop for this animation type
1464
- !b && !A.prevProp || // Or if the prop doesn't define an animation
1465
- tt(b) || typeof b == "boolean")
1466
- continue;
1467
- const w = ts(A.prevProp, b);
1468
- let g = w || // If we're making this variant active, we want to always make it active
1469
- d === c && A.isActive && !x && M || // If we removed a higher-priority variant (i is in reverse order)
1470
- T > v && M, D = !1;
1471
- const C = Array.isArray(b) ? b : [b];
1472
- let R = C.reduce(s(d), {});
1473
- m === !1 && (R = {});
1474
- const { prevResolvedValues: Ve = {} } = A, Rt = {
1475
- ...Ve,
1476
- ...R
1477
- }, Me = (V) => {
1478
- g = !0, h.has(V) && (D = !0, h.delete(V)), A.needsAnimating[V] = !0;
1479
- const P = t.getValue(V);
1480
- P && (P.liveStyle = !1);
1481
- };
1482
- for (const V in Rt) {
1483
- const P = R[V], I = Ve[V];
1484
- if (p.hasOwnProperty(V))
1485
- continue;
1486
- let E = !1;
1487
- he(P) && he(I) ? E = !It(P, I) : E = P !== I, E ? P != null ? Me(V) : h.add(V) : P !== void 0 && h.has(V) ? Me(V) : A.protectedKeys[V] = !0;
1488
- }
1489
- A.prevProp = b, A.prevResolvedValues = R, A.isActive && (p = { ...p, ...R }), i && t.blockInitialAnimation && (g = !1);
1490
- const De = x && w;
1491
- g && (!De || D) && f.push(...C.map((V) => {
1492
- const P = { type: d };
1493
- if (typeof V == "string" && i && !De && t.manuallyAnimateOnMount && t.parent) {
1494
- const { parent: I } = t, E = L(I, V);
1495
- if (I.enteringChildren && E) {
1496
- const { delayChildren: Et } = E.transition || {};
1497
- P.delay = xt(I.enteringChildren, t, Et);
1498
- }
1499
- }
1500
- return {
1501
- animation: V,
1502
- options: P
1503
- };
1504
- }));
1505
- }
1506
- if (h.size) {
1507
- const T = {};
1508
- if (typeof l.initial != "boolean") {
1509
- const d = L(t, Array.isArray(l.initial) ? l.initial[0] : l.initial);
1510
- d && d.transition && (T.transition = d.transition);
1511
- }
1512
- h.forEach((d) => {
1513
- const A = t.getBaseTarget(d), b = t.getValue(d);
1514
- b && (b.liveStyle = !0), T[d] = A ?? null;
1515
- }), f.push({ animation: T });
1516
- }
1517
- let y = !!f.length;
1518
- return i && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (y = !1), i = !1, y ? e(f) : Promise.resolve();
1519
- }
1520
- function a(c, l) {
1521
- if (n[c].isActive === l)
1522
- return Promise.resolve();
1523
- t.variantChildren?.forEach((f) => f.animationState?.setActive(c, l)), n[c].isActive = l;
1524
- const u = o(c);
1525
- for (const f in n)
1526
- n[f].protectedKeys = {};
1527
- return u;
1528
- }
1529
- return {
1530
- animateChanges: o,
1531
- setActive: a,
1532
- setAnimateFunction: r,
1533
- getState: () => n,
1534
- reset: () => {
1535
- n = We();
1536
- }
1537
- };
1538
- }
1539
- function ts(t, e) {
1540
- return typeof e == "string" ? e !== t : Array.isArray(e) ? !It(e, t) : !1;
1541
- }
1542
- function K(t = !1) {
1543
- return {
1544
- isActive: t,
1545
- protectedKeys: {},
1546
- needsAnimating: {},
1547
- prevResolvedValues: {}
1548
- };
1549
- }
1550
- function We() {
1551
- return {
1552
- animate: K(!0),
1553
- whileInView: K(),
1554
- whileHover: K(),
1555
- whileTap: K(),
1556
- whileDrag: K(),
1557
- whileFocus: K(),
1558
- exit: K()
1559
- };
1560
- }
1561
- function _e(t, e, n, i = { passive: !0 }) {
1562
- return t.addEventListener(e, n, i), () => t.removeEventListener(e, n);
1563
- }
1564
- const ns = (t, e) => e.isSVG ?? ln(t) ? new Xi(e) : new zi(e, {
1565
- allowProjection: t !== un
1566
- });
1567
- class is extends W {
1568
- /**
1569
- * We dynamically generate the AnimationState manager as it contains a reference
1570
- * to the underlying animation library. We only want to load that if we load this,
1571
- * so people can optionally code split it out using the `m` component.
1572
- */
1573
- constructor(e) {
1574
- super(e), e.animationState || (e.animationState = es(e));
1575
- }
1576
- updateAnimationControlsSubscription() {
1577
- const { animate: e } = this.node.getProps();
1578
- tt(e) && (this.unmountControls = e.subscribe(this.node));
1579
- }
1580
- /**
1581
- * Subscribe any provided AnimationControls to the component's VisualElement
1582
- */
1583
- mount() {
1584
- this.updateAnimationControlsSubscription();
1585
- }
1586
- update() {
1587
- const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
1588
- e !== n && this.updateAnimationControlsSubscription();
1589
- }
1590
- unmount() {
1591
- this.node.animationState.reset(), this.unmountControls?.();
1592
- }
1593
- }
1594
- let ss = 0;
1595
- class rs extends W {
1596
- constructor() {
1597
- super(...arguments), this.id = ss++;
1598
- }
1599
- update() {
1600
- if (!this.node.presenceContext)
1601
- return;
1602
- const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
1603
- if (!this.node.animationState || e === i)
1604
- return;
1605
- const s = this.node.animationState.setActive("exit", !e);
1606
- n && !e && s.then(() => {
1607
- n(this.id);
1608
- });
1609
- }
1610
- mount() {
1611
- const { register: e, onExitComplete: n } = this.node.presenceContext || {};
1612
- n && n(this.id), e && (this.unmount = e(this.id));
1613
- }
1614
- unmount() {
1615
- }
1616
- }
1617
- const as = {
1618
- animation: {
1619
- Feature: is
1620
- },
1621
- exit: {
1622
- Feature: rs
1623
- }
1624
- };
1625
- function Kt(t) {
1626
- return {
1627
- point: {
1628
- x: t.pageX,
1629
- y: t.pageY
1630
- }
1631
- };
1632
- }
1633
- function je(t, e, n) {
1634
- const { props: i } = t;
1635
- t.animationState && i.whileHover && t.animationState.setActive("whileHover", n === "Start");
1636
- const s = "onHover" + n, r = i[s];
1637
- r && G.postRender(() => r(e, Kt(e)));
1638
- }
1639
- class os extends W {
1640
- mount() {
1641
- const { current: e } = this.node;
1642
- e && (this.unmount = Bi(e, (n, i) => (je(this.node, i, "Start"), (s) => je(this.node, s, "End"))));
1643
- }
1644
- unmount() {
1645
- }
1646
- }
1647
- class ls extends W {
1648
- constructor() {
1649
- super(...arguments), this.isActive = !1;
1650
- }
1651
- onFocus() {
1652
- let e = !1;
1653
- try {
1654
- e = this.node.current.matches(":focus-visible");
1655
- } catch {
1656
- e = !0;
1657
- }
1658
- !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
1659
- }
1660
- onBlur() {
1661
- !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
1662
- }
1663
- mount() {
1664
- this.unmount = ee(_e(this.node.current, "focus", () => this.onFocus()), _e(this.node.current, "blur", () => this.onBlur()));
1665
- }
1666
- unmount() {
1667
- }
1668
- }
1669
- function Ue(t, e, n) {
1670
- const { props: i } = t;
1671
- if (t.current instanceof HTMLButtonElement && t.current.disabled)
1672
- return;
1673
- t.animationState && i.whileTap && t.animationState.setActive("whileTap", n === "Start");
1674
- const s = "onTap" + (n === "End" ? "" : n), r = i[s];
1675
- r && G.postRender(() => r(e, Kt(e)));
1676
- }
1677
- class us extends W {
1678
- mount() {
1679
- const { current: e } = this.node;
1680
- e && (this.unmount = Hi(e, (n, i) => (Ue(this.node, i, "Start"), (s, { success: r }) => Ue(this.node, s, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
1681
- }
1682
- unmount() {
1683
- }
1684
- }
1685
- const me = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), cs = (t) => {
1686
- const e = me.get(t.target);
1687
- e && e(t);
1688
- }, fs = (t) => {
1689
- t.forEach(cs);
1690
- };
1691
- function hs({ root: t, ...e }) {
1692
- const n = t || document;
1693
- ae.has(n) || ae.set(n, {});
1694
- const i = ae.get(n), s = JSON.stringify(e);
1695
- return i[s] || (i[s] = new IntersectionObserver(fs, { root: t, ...e })), i[s];
1696
- }
1697
- function ds(t, e, n) {
1698
- const i = hs(e);
1699
- return me.set(t, n), i.observe(t), () => {
1700
- me.delete(t), i.unobserve(t);
1701
- };
1702
- }
1703
- const ms = {
1704
- some: 0,
1705
- all: 1
1706
- };
1707
- class ps extends W {
1708
- constructor() {
1709
- super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
1710
- }
1711
- startObserver() {
1712
- this.unmount();
1713
- const { viewport: e = {} } = this.node.getProps(), { root: n, margin: i, amount: s = "some", once: r } = e, o = {
1714
- root: n ? n.current : void 0,
1715
- rootMargin: i,
1716
- threshold: typeof s == "number" ? s : ms[s]
1717
- }, a = (c) => {
1718
- const { isIntersecting: l } = c;
1719
- if (this.isInView === l || (this.isInView = l, r && !l && this.hasEnteredView))
1720
- return;
1721
- l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l);
1722
- const { onViewportEnter: u, onViewportLeave: f } = this.node.getProps(), h = l ? u : f;
1723
- h && h(c);
1724
- };
1725
- return ds(this.node.current, o, a);
1726
- }
1727
- mount() {
1728
- this.startObserver();
1729
- }
1730
- update() {
1731
- if (typeof IntersectionObserver > "u")
1732
- return;
1733
- const { props: e, prevProps: n } = this.node;
1734
- ["amount", "margin", "root"].some(gs(e, n)) && this.startObserver();
1735
- }
1736
- unmount() {
1737
- }
1738
- }
1739
- function gs({ viewport: t = {} }, { viewport: e = {} } = {}) {
1740
- return (n) => t[n] !== e[n];
1741
- }
1742
- const ys = {
1743
- inView: {
1744
- Feature: ps
1745
- },
1746
- tap: {
1747
- Feature: us
1748
- },
1749
- focus: {
1750
- Feature: ls
1751
- },
1752
- hover: {
1753
- Feature: os
1754
- }
1755
- }, Ts = {
1756
- renderer: ns,
1757
- ...as,
1758
- ...ys
1759
- };
1760
- var xs = Ts;
1761
- export {
1762
- xs as default
1763
- };