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