globalfy-design-system 1.54.0 → 1.55.0

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