@courtneyring/components-library 1.0.0 → 1.0.1

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.
Files changed (39) hide show
  1. package/dist/animations/FadeInMotion.js +4785 -0
  2. package/dist/assets/Background.css +1 -1
  3. package/dist/assets/Banner.css +1 -1
  4. package/dist/assets/BorderedBackground.css +1 -1
  5. package/dist/assets/Button.css +1 -1
  6. package/dist/assets/Container.css +1 -1
  7. package/dist/assets/Fifty.css +1 -1
  8. package/dist/assets/Footer.css +1 -1
  9. package/dist/assets/ImageTextBlock.css +1 -1
  10. package/dist/assets/List.css +1 -1
  11. package/dist/assets/MenuButton.css +1 -0
  12. package/dist/assets/Navbar.css +1 -0
  13. package/dist/assets/Note.css +1 -1
  14. package/dist/assets/Overlay.css +1 -0
  15. package/dist/assets/OverlayHero.css +1 -1
  16. package/dist/assets/PageContainer.css +1 -1
  17. package/dist/assets/Promo.css +1 -0
  18. package/dist/assets/PromoGroup.css +1 -0
  19. package/dist/assets/Timeline.css +1 -1
  20. package/dist/components/Background/Background.js +5 -4
  21. package/dist/components/Banner/Banner.js +11 -10
  22. package/dist/components/BorderedBackground/BorderedBackground.js +27 -31
  23. package/dist/components/Button/Button.js +22 -21
  24. package/dist/components/Container/Container.js +2 -2
  25. package/dist/components/Fifty/Fifty.js +16 -16
  26. package/dist/components/Footer/Footer.js +6 -6
  27. package/dist/components/ImageTextBlock/ImageTextBlock.js +31 -19
  28. package/dist/components/List/List.js +3 -3
  29. package/dist/components/MenuButton/MenuButton.js +18 -0
  30. package/dist/components/Navbar/Navbar.js +416 -0
  31. package/dist/components/Note/Note.js +21 -16
  32. package/dist/components/Overlay/Overlay.js +31 -0
  33. package/dist/components/OverlayHero/OverlayHero.js +14 -14
  34. package/dist/components/PageContainer/PageContainer.js +5 -5
  35. package/dist/components/Promo/Promo.js +24 -0
  36. package/dist/components/PromoGroup/PromoGroup.js +9 -0
  37. package/dist/components/Timeline/Timeline.js +19 -19
  38. package/dist/main.js +19 -13
  39. package/package.json +5 -4
@@ -0,0 +1,4785 @@
1
+ import { jsxs as br, jsx as Ue } from "react/jsx-runtime";
2
+ import { createContext as yt, useRef as mt, useLayoutEffect as Vr, useEffect as We, useContext as O, useId as Ar, useCallback as Oi, useMemo as Zt, Fragment as ji, createElement as Dr, useInsertionEffect as Ni, forwardRef as Mr, Component as Cr } from "react";
3
+ const Ui = yt({});
4
+ function Er(t) {
5
+ const e = mt(null);
6
+ return e.current === null && (e.current = t()), e.current;
7
+ }
8
+ const Wi = typeof window < "u", Rr = Wi ? Vr : We, Ke = /* @__PURE__ */ yt(null);
9
+ function $e(t, e) {
10
+ t.indexOf(e) === -1 && t.push(e);
11
+ }
12
+ function Ge(t, e) {
13
+ const n = t.indexOf(e);
14
+ n > -1 && t.splice(n, 1);
15
+ }
16
+ const z = (t, e, n) => n > e ? e : n < t ? t : n;
17
+ function ye(t, e) {
18
+ return e ? `${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}` : t;
19
+ }
20
+ let vt = () => {
21
+ }, Y = () => {
22
+ };
23
+ typeof process < "u" && process.env?.NODE_ENV !== "production" && (vt = (t, e, n) => {
24
+ !t && typeof console < "u" && console.warn(ye(e, n));
25
+ }, Y = (t, e, n) => {
26
+ if (!t)
27
+ throw new Error(ye(e, n));
28
+ });
29
+ const X = {}, Ki = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);
30
+ function $i(t) {
31
+ return typeof t == "object" && t !== null;
32
+ }
33
+ const Gi = (t) => /^0[^.\s]+$/u.test(t);
34
+ // @__NO_SIDE_EFFECTS__
35
+ function _e(t) {
36
+ let e;
37
+ return () => (e === void 0 && (e = t()), e);
38
+ }
39
+ const K = /* @__NO_SIDE_EFFECTS__ */ (t) => t, Lr = (t, e) => (n) => e(t(n)), kt = (...t) => t.reduce(Lr), Mt = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
40
+ const i = e - t;
41
+ return i === 0 ? 1 : (n - t) / i;
42
+ };
43
+ class He {
44
+ constructor() {
45
+ this.subscriptions = [];
46
+ }
47
+ add(e) {
48
+ return $e(this.subscriptions, e), () => Ge(this.subscriptions, e);
49
+ }
50
+ notify(e, n, i) {
51
+ const s = this.subscriptions.length;
52
+ if (s)
53
+ if (s === 1)
54
+ this.subscriptions[0](e, n, i);
55
+ else
56
+ for (let o = 0; o < s; o++) {
57
+ const r = this.subscriptions[o];
58
+ r && r(e, n, i);
59
+ }
60
+ }
61
+ getSize() {
62
+ return this.subscriptions.length;
63
+ }
64
+ clear() {
65
+ this.subscriptions.length = 0;
66
+ }
67
+ }
68
+ const _ = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, W = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
69
+ function _i(t, e) {
70
+ return e ? t * (1e3 / e) : 0;
71
+ }
72
+ const Sn = /* @__PURE__ */ new Set();
73
+ function ze(t, e, n) {
74
+ t || Sn.has(e) || (console.warn(ye(e, n)), Sn.add(e));
75
+ }
76
+ const Hi = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, kr = 1e-7, Fr = 12;
77
+ function Ir(t, e, n, i, s) {
78
+ let o, r, a = 0;
79
+ do
80
+ r = e + (n - e) / 2, o = Hi(r, i, s) - t, o > 0 ? n = r : e = r;
81
+ while (Math.abs(o) > kr && ++a < Fr);
82
+ return r;
83
+ }
84
+ function Ft(t, e, n, i) {
85
+ if (t === e && n === i)
86
+ return K;
87
+ const s = (o) => Ir(o, 0, 1, t, n);
88
+ return (o) => o === 0 || o === 1 ? o : Hi(s(o), e, i);
89
+ }
90
+ const zi = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, Yi = (t) => (e) => 1 - t(1 - e), Xi = /* @__PURE__ */ Ft(0.33, 1.53, 0.69, 0.99), Ye = /* @__PURE__ */ Yi(Xi), qi = /* @__PURE__ */ zi(Ye), Zi = (t) => (t *= 2) < 1 ? 0.5 * Ye(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Xe = (t) => 1 - Math.sin(Math.acos(t)), Ji = Yi(Xe), Qi = zi(Xe), Br = /* @__PURE__ */ Ft(0.42, 0, 1, 1), Or = /* @__PURE__ */ Ft(0, 0, 0.58, 1), ts = /* @__PURE__ */ Ft(0.42, 0, 0.58, 1), jr = (t) => Array.isArray(t) && typeof t[0] != "number", es = (t) => Array.isArray(t) && typeof t[0] == "number", wn = {
91
+ linear: K,
92
+ easeIn: Br,
93
+ easeInOut: ts,
94
+ easeOut: Or,
95
+ circIn: Xe,
96
+ circInOut: Qi,
97
+ circOut: Ji,
98
+ backIn: Ye,
99
+ backInOut: qi,
100
+ backOut: Xi,
101
+ anticipate: Zi
102
+ }, Nr = (t) => typeof t == "string", bn = (t) => {
103
+ if (es(t)) {
104
+ Y(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
105
+ const [e, n, i, s] = t;
106
+ return Ft(e, n, i, s);
107
+ } else if (Nr(t))
108
+ return Y(wn[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), wn[t];
109
+ return t;
110
+ }, Ot = [
111
+ "setup",
112
+ // Compute
113
+ "read",
114
+ // Read
115
+ "resolveKeyframes",
116
+ // Write/Read/Write/Read
117
+ "preUpdate",
118
+ // Compute
119
+ "update",
120
+ // Compute
121
+ "preRender",
122
+ // Compute
123
+ "render",
124
+ // Write
125
+ "postRender"
126
+ // Compute
127
+ ];
128
+ function Ur(t, e) {
129
+ let n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = !1, o = !1;
130
+ const r = /* @__PURE__ */ new WeakSet();
131
+ let a = {
132
+ delta: 0,
133
+ timestamp: 0,
134
+ isProcessing: !1
135
+ };
136
+ function l(u) {
137
+ r.has(u) && (c.schedule(u), t()), u(a);
138
+ }
139
+ const c = {
140
+ /**
141
+ * Schedule a process to run on the next frame.
142
+ */
143
+ schedule: (u, h = !1, f = !1) => {
144
+ const m = f && s ? n : i;
145
+ return h && r.add(u), m.has(u) || m.add(u), u;
146
+ },
147
+ /**
148
+ * Cancel the provided callback from running on the next frame.
149
+ */
150
+ cancel: (u) => {
151
+ i.delete(u), r.delete(u);
152
+ },
153
+ /**
154
+ * Execute all schedule callbacks.
155
+ */
156
+ process: (u) => {
157
+ if (a = u, s) {
158
+ o = !0;
159
+ return;
160
+ }
161
+ s = !0, [n, i] = [i, n], n.forEach(l), n.clear(), s = !1, o && (o = !1, c.process(u));
162
+ }
163
+ };
164
+ return c;
165
+ }
166
+ const Wr = 40;
167
+ function ns(t, e) {
168
+ let n = !1, i = !0;
169
+ const s = {
170
+ delta: 0,
171
+ timestamp: 0,
172
+ isProcessing: !1
173
+ }, o = () => n = !0, r = Ot.reduce((y, w) => (y[w] = Ur(o), y), {}), { setup: a, read: l, resolveKeyframes: c, preUpdate: u, update: h, preRender: f, render: d, postRender: m } = r, v = () => {
174
+ const y = X.useManualTiming ? s.timestamp : performance.now();
175
+ n = !1, X.useManualTiming || (s.delta = i ? 1e3 / 60 : Math.max(Math.min(y - s.timestamp, Wr), 1)), s.timestamp = y, s.isProcessing = !0, a.process(s), l.process(s), c.process(s), u.process(s), h.process(s), f.process(s), d.process(s), m.process(s), s.isProcessing = !1, n && e && (i = !1, t(v));
176
+ }, T = () => {
177
+ n = !0, i = !0, s.isProcessing || t(v);
178
+ };
179
+ return { schedule: Ot.reduce((y, w) => {
180
+ const P = r[w];
181
+ return y[w] = (b, C = !1, S = !1) => (n || T(), P.schedule(b, C, S)), y;
182
+ }, {}), cancel: (y) => {
183
+ for (let w = 0; w < Ot.length; w++)
184
+ r[Ot[w]].cancel(y);
185
+ }, state: s, steps: r };
186
+ }
187
+ const { schedule: V, cancel: J, state: L, steps: ee } = /* @__PURE__ */ ns(typeof requestAnimationFrame < "u" ? requestAnimationFrame : K, !0);
188
+ let Ut;
189
+ function Kr() {
190
+ Ut = void 0;
191
+ }
192
+ const F = {
193
+ now: () => (Ut === void 0 && F.set(L.isProcessing || X.useManualTiming ? L.timestamp : performance.now()), Ut),
194
+ set: (t) => {
195
+ Ut = t, queueMicrotask(Kr);
196
+ }
197
+ }, is = (t) => (e) => typeof e == "string" && e.startsWith(t), ss = /* @__PURE__ */ is("--"), $r = /* @__PURE__ */ is("var(--"), qe = (t) => $r(t) ? Gr.test(t.split("/*")[0].trim()) : !1, Gr = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
198
+ function Vn(t) {
199
+ return typeof t != "string" ? !1 : t.split("/*")[0].includes("var(--");
200
+ }
201
+ const Tt = {
202
+ test: (t) => typeof t == "number",
203
+ parse: parseFloat,
204
+ transform: (t) => t
205
+ }, Ct = {
206
+ ...Tt,
207
+ transform: (t) => z(0, 1, t)
208
+ }, jt = {
209
+ ...Tt,
210
+ default: 1
211
+ }, Vt = (t) => Math.round(t * 1e5) / 1e5, Ze = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
212
+ function _r(t) {
213
+ return t == null;
214
+ }
215
+ const Hr = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Je = (t, e) => (n) => !!(typeof n == "string" && Hr.test(n) && n.startsWith(t) || e && !_r(n) && Object.prototype.hasOwnProperty.call(n, e)), rs = (t, e, n) => (i) => {
216
+ if (typeof i != "string")
217
+ return i;
218
+ const [s, o, r, a] = i.match(Ze);
219
+ return {
220
+ [t]: parseFloat(s),
221
+ [e]: parseFloat(o),
222
+ [n]: parseFloat(r),
223
+ alpha: a !== void 0 ? parseFloat(a) : 1
224
+ };
225
+ }, zr = (t) => z(0, 255, t), ne = {
226
+ ...Tt,
227
+ transform: (t) => Math.round(zr(t))
228
+ }, st = {
229
+ test: /* @__PURE__ */ Je("rgb", "red"),
230
+ parse: /* @__PURE__ */ rs("red", "green", "blue"),
231
+ transform: ({ red: t, green: e, blue: n, alpha: i = 1 }) => "rgba(" + ne.transform(t) + ", " + ne.transform(e) + ", " + ne.transform(n) + ", " + Vt(Ct.transform(i)) + ")"
232
+ };
233
+ function Yr(t) {
234
+ let e = "", n = "", i = "", s = "";
235
+ return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), i = t.substring(5, 7), s = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), i = t.substring(3, 4), s = t.substring(4, 5), e += e, n += n, i += i, s += s), {
236
+ red: parseInt(e, 16),
237
+ green: parseInt(n, 16),
238
+ blue: parseInt(i, 16),
239
+ alpha: s ? parseInt(s, 16) / 255 : 1
240
+ };
241
+ }
242
+ const ve = {
243
+ test: /* @__PURE__ */ Je("#"),
244
+ parse: Yr,
245
+ transform: st.transform
246
+ }, It = /* @__NO_SIDE_EFFECTS__ */ (t) => ({
247
+ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
248
+ parse: parseFloat,
249
+ transform: (e) => `${e}${t}`
250
+ }), q = /* @__PURE__ */ It("deg"), H = /* @__PURE__ */ It("%"), p = /* @__PURE__ */ It("px"), Xr = /* @__PURE__ */ It("vh"), qr = /* @__PURE__ */ It("vw"), An = {
251
+ ...H,
252
+ parse: (t) => H.parse(t) / 100,
253
+ transform: (t) => H.transform(t * 100)
254
+ }, ut = {
255
+ test: /* @__PURE__ */ Je("hsl", "hue"),
256
+ parse: /* @__PURE__ */ rs("hue", "saturation", "lightness"),
257
+ transform: ({ hue: t, saturation: e, lightness: n, alpha: i = 1 }) => "hsla(" + Math.round(t) + ", " + H.transform(Vt(e)) + ", " + H.transform(Vt(n)) + ", " + Vt(Ct.transform(i)) + ")"
258
+ }, M = {
259
+ test: (t) => st.test(t) || ve.test(t) || ut.test(t),
260
+ parse: (t) => st.test(t) ? st.parse(t) : ut.test(t) ? ut.parse(t) : ve.parse(t),
261
+ transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? st.transform(t) : ut.transform(t),
262
+ getAnimatableNone: (t) => {
263
+ const e = M.parse(t);
264
+ return e.alpha = 0, M.transform(e);
265
+ }
266
+ }, Zr = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
267
+ function Jr(t) {
268
+ return isNaN(t) && typeof t == "string" && (t.match(Ze)?.length || 0) + (t.match(Zr)?.length || 0) > 0;
269
+ }
270
+ const os = "number", as = "color", Qr = "var", to = "var(", Dn = "${}", eo = /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;
271
+ function Et(t) {
272
+ const e = t.toString(), n = [], i = {
273
+ color: [],
274
+ number: [],
275
+ var: []
276
+ }, s = [];
277
+ let o = 0;
278
+ const a = e.replace(eo, (l) => (M.test(l) ? (i.color.push(o), s.push(as), n.push(M.parse(l))) : l.startsWith(to) ? (i.var.push(o), s.push(Qr), n.push(l)) : (i.number.push(o), s.push(os), n.push(parseFloat(l))), ++o, Dn)).split(Dn);
279
+ return { values: n, split: a, indexes: i, types: s };
280
+ }
281
+ function ls(t) {
282
+ return Et(t).values;
283
+ }
284
+ function us(t) {
285
+ const { split: e, types: n } = Et(t), i = e.length;
286
+ return (s) => {
287
+ let o = "";
288
+ for (let r = 0; r < i; r++)
289
+ if (o += e[r], s[r] !== void 0) {
290
+ const a = n[r];
291
+ a === os ? o += Vt(s[r]) : a === as ? o += M.transform(s[r]) : o += s[r];
292
+ }
293
+ return o;
294
+ };
295
+ }
296
+ const no = (t) => typeof t == "number" ? 0 : M.test(t) ? M.getAnimatableNone(t) : t;
297
+ function io(t) {
298
+ const e = ls(t);
299
+ return us(t)(e.map(no));
300
+ }
301
+ const Q = {
302
+ test: Jr,
303
+ parse: ls,
304
+ createTransformer: us,
305
+ getAnimatableNone: io
306
+ };
307
+ function ie(t, e, n) {
308
+ 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;
309
+ }
310
+ function so({ hue: t, saturation: e, lightness: n, alpha: i }) {
311
+ t /= 360, e /= 100, n /= 100;
312
+ let s = 0, o = 0, r = 0;
313
+ if (!e)
314
+ s = o = r = n;
315
+ else {
316
+ const a = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - a;
317
+ s = ie(l, a, t + 1 / 3), o = ie(l, a, t), r = ie(l, a, t - 1 / 3);
318
+ }
319
+ return {
320
+ red: Math.round(s * 255),
321
+ green: Math.round(o * 255),
322
+ blue: Math.round(r * 255),
323
+ alpha: i
324
+ };
325
+ }
326
+ function Gt(t, e) {
327
+ return (n) => n > 0 ? e : t;
328
+ }
329
+ const D = (t, e, n) => t + (e - t) * n, se = (t, e, n) => {
330
+ const i = t * t, s = n * (e * e - i) + i;
331
+ return s < 0 ? 0 : Math.sqrt(s);
332
+ }, ro = [ve, st, ut], oo = (t) => ro.find((e) => e.test(t));
333
+ function Mn(t) {
334
+ const e = oo(t);
335
+ if (vt(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
336
+ return !1;
337
+ let n = e.parse(t);
338
+ return e === ut && (n = so(n)), n;
339
+ }
340
+ const Cn = (t, e) => {
341
+ const n = Mn(t), i = Mn(e);
342
+ if (!n || !i)
343
+ return Gt(t, e);
344
+ const s = { ...n };
345
+ return (o) => (s.red = se(n.red, i.red, o), s.green = se(n.green, i.green, o), s.blue = se(n.blue, i.blue, o), s.alpha = D(n.alpha, i.alpha, o), st.transform(s));
346
+ }, Te = /* @__PURE__ */ new Set(["none", "hidden"]);
347
+ function ao(t, e) {
348
+ return Te.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
349
+ }
350
+ function lo(t, e) {
351
+ return (n) => D(t, e, n);
352
+ }
353
+ function Qe(t) {
354
+ return typeof t == "number" ? lo : typeof t == "string" ? qe(t) ? Gt : M.test(t) ? Cn : ho : Array.isArray(t) ? cs : typeof t == "object" ? M.test(t) ? Cn : uo : Gt;
355
+ }
356
+ function cs(t, e) {
357
+ const n = [...t], i = n.length, s = t.map((o, r) => Qe(o)(o, e[r]));
358
+ return (o) => {
359
+ for (let r = 0; r < i; r++)
360
+ n[r] = s[r](o);
361
+ return n;
362
+ };
363
+ }
364
+ function uo(t, e) {
365
+ const n = { ...t, ...e }, i = {};
366
+ for (const s in n)
367
+ t[s] !== void 0 && e[s] !== void 0 && (i[s] = Qe(t[s])(t[s], e[s]));
368
+ return (s) => {
369
+ for (const o in i)
370
+ n[o] = i[o](s);
371
+ return n;
372
+ };
373
+ }
374
+ function co(t, e) {
375
+ const n = [], i = { color: 0, var: 0, number: 0 };
376
+ for (let s = 0; s < e.values.length; s++) {
377
+ const o = e.types[s], r = t.indexes[o][i[o]], a = t.values[r] ?? 0;
378
+ n[s] = a, i[o]++;
379
+ }
380
+ return n;
381
+ }
382
+ const ho = (t, e) => {
383
+ const n = Q.createTransformer(e), i = Et(t), s = Et(e);
384
+ return i.indexes.var.length === s.indexes.var.length && i.indexes.color.length === s.indexes.color.length && i.indexes.number.length >= s.indexes.number.length ? Te.has(t) && !s.values.length || Te.has(e) && !i.values.length ? ao(t, e) : kt(cs(co(i, s), s.values), n) : (vt(!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"), Gt(t, e));
385
+ };
386
+ function hs(t, e, n) {
387
+ return typeof t == "number" && typeof e == "number" && typeof n == "number" ? D(t, e, n) : Qe(t)(t, e);
388
+ }
389
+ const fo = (t) => {
390
+ const e = ({ timestamp: n }) => t(n);
391
+ return {
392
+ start: (n = !0) => V.update(e, n),
393
+ stop: () => J(e),
394
+ /**
395
+ * If we're processing this frame we can use the
396
+ * framelocked timestamp to keep things in sync.
397
+ */
398
+ now: () => L.isProcessing ? L.timestamp : F.now()
399
+ };
400
+ }, fs = (t, e, n = 10) => {
401
+ let i = "";
402
+ const s = Math.max(Math.round(e / n), 2);
403
+ for (let o = 0; o < s; o++)
404
+ i += Math.round(t(o / (s - 1)) * 1e4) / 1e4 + ", ";
405
+ return `linear(${i.substring(0, i.length - 2)})`;
406
+ }, _t = 2e4;
407
+ function tn(t) {
408
+ let e = 0;
409
+ const n = 50;
410
+ let i = t.next(e);
411
+ for (; !i.done && e < _t; )
412
+ e += n, i = t.next(e);
413
+ return e >= _t ? 1 / 0 : e;
414
+ }
415
+ function mo(t, e = 100, n) {
416
+ const i = n({ ...t, keyframes: [0, e] }), s = Math.min(tn(i), _t);
417
+ return {
418
+ type: "keyframes",
419
+ ease: (o) => i.next(s * o).value / e,
420
+ duration: /* @__PURE__ */ W(s)
421
+ };
422
+ }
423
+ const po = 5;
424
+ function ds(t, e, n) {
425
+ const i = Math.max(e - po, 0);
426
+ return _i(n - t(i), e - i);
427
+ }
428
+ const A = {
429
+ // Default spring physics
430
+ stiffness: 100,
431
+ damping: 10,
432
+ mass: 1,
433
+ velocity: 0,
434
+ // Default duration/bounce-based options
435
+ duration: 800,
436
+ // in ms
437
+ bounce: 0.3,
438
+ visualDuration: 0.3,
439
+ // in seconds
440
+ // Rest thresholds
441
+ restSpeed: {
442
+ granular: 0.01,
443
+ default: 2
444
+ },
445
+ restDelta: {
446
+ granular: 5e-3,
447
+ default: 0.5
448
+ },
449
+ // Limits
450
+ minDuration: 0.01,
451
+ // in seconds
452
+ maxDuration: 10,
453
+ // in seconds
454
+ minDamping: 0.05,
455
+ maxDamping: 1
456
+ }, re = 1e-3;
457
+ function go({ duration: t = A.duration, bounce: e = A.bounce, velocity: n = A.velocity, mass: i = A.mass }) {
458
+ let s, o;
459
+ vt(t <= /* @__PURE__ */ _(A.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
460
+ let r = 1 - e;
461
+ r = z(A.minDamping, A.maxDamping, r), t = z(A.minDuration, A.maxDuration, /* @__PURE__ */ W(t)), r < 1 ? (s = (c) => {
462
+ const u = c * r, h = u * t, f = u - n, d = xe(c, r), m = Math.exp(-h);
463
+ return re - f / d * m;
464
+ }, o = (c) => {
465
+ const h = c * r * t, f = h * n + n, d = Math.pow(r, 2) * Math.pow(c, 2) * t, m = Math.exp(-h), v = xe(Math.pow(c, 2), r);
466
+ return (-s(c) + re > 0 ? -1 : 1) * ((f - d) * m) / v;
467
+ }) : (s = (c) => {
468
+ const u = Math.exp(-c * t), h = (c - n) * t + 1;
469
+ return -re + u * h;
470
+ }, o = (c) => {
471
+ const u = Math.exp(-c * t), h = (n - c) * (t * t);
472
+ return u * h;
473
+ });
474
+ const a = 5 / t, l = vo(s, o, a);
475
+ if (t = /* @__PURE__ */ _(t), isNaN(l))
476
+ return {
477
+ stiffness: A.stiffness,
478
+ damping: A.damping,
479
+ duration: t
480
+ };
481
+ {
482
+ const c = Math.pow(l, 2) * i;
483
+ return {
484
+ stiffness: c,
485
+ damping: r * 2 * Math.sqrt(i * c),
486
+ duration: t
487
+ };
488
+ }
489
+ }
490
+ const yo = 12;
491
+ function vo(t, e, n) {
492
+ let i = n;
493
+ for (let s = 1; s < yo; s++)
494
+ i = i - t(i) / e(i);
495
+ return i;
496
+ }
497
+ function xe(t, e) {
498
+ return t * Math.sqrt(1 - e * e);
499
+ }
500
+ const To = ["duration", "bounce"], xo = ["stiffness", "damping", "mass"];
501
+ function En(t, e) {
502
+ return e.some((n) => t[n] !== void 0);
503
+ }
504
+ function Po(t) {
505
+ let e = {
506
+ velocity: A.velocity,
507
+ stiffness: A.stiffness,
508
+ damping: A.damping,
509
+ mass: A.mass,
510
+ isResolvedFromDuration: !1,
511
+ ...t
512
+ };
513
+ if (!En(t, xo) && En(t, To))
514
+ if (t.visualDuration) {
515
+ const n = t.visualDuration, i = 2 * Math.PI / (n * 1.2), s = i * i, o = 2 * z(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(s);
516
+ e = {
517
+ ...e,
518
+ mass: A.mass,
519
+ stiffness: s,
520
+ damping: o
521
+ };
522
+ } else {
523
+ const n = go(t);
524
+ e = {
525
+ ...e,
526
+ ...n,
527
+ mass: A.mass
528
+ }, e.isResolvedFromDuration = !0;
529
+ }
530
+ return e;
531
+ }
532
+ function Ht(t = A.visualDuration, e = A.bounce) {
533
+ const n = typeof t != "object" ? {
534
+ visualDuration: t,
535
+ keyframes: [0, 1],
536
+ bounce: e
537
+ } : t;
538
+ let { restSpeed: i, restDelta: s } = n;
539
+ const o = n.keyframes[0], r = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: o }, { stiffness: l, damping: c, mass: u, duration: h, velocity: f, isResolvedFromDuration: d } = Po({
540
+ ...n,
541
+ velocity: -/* @__PURE__ */ W(n.velocity || 0)
542
+ }), m = f || 0, v = c / (2 * Math.sqrt(l * u)), T = r - o, g = /* @__PURE__ */ W(Math.sqrt(l / u)), x = Math.abs(T) < 5;
543
+ i || (i = x ? A.restSpeed.granular : A.restSpeed.default), s || (s = x ? A.restDelta.granular : A.restDelta.default);
544
+ let y;
545
+ if (v < 1) {
546
+ const P = xe(g, v);
547
+ y = (b) => {
548
+ const C = Math.exp(-v * g * b);
549
+ return r - C * ((m + v * g * T) / P * Math.sin(P * b) + T * Math.cos(P * b));
550
+ };
551
+ } else if (v === 1)
552
+ y = (P) => r - Math.exp(-g * P) * (T + (m + g * T) * P);
553
+ else {
554
+ const P = g * Math.sqrt(v * v - 1);
555
+ y = (b) => {
556
+ const C = Math.exp(-v * g * b), S = Math.min(P * b, 300);
557
+ return r - C * ((m + v * g * T) * Math.sinh(S) + P * T * Math.cosh(S)) / P;
558
+ };
559
+ }
560
+ const w = {
561
+ calculatedDuration: d && h || null,
562
+ next: (P) => {
563
+ const b = y(P);
564
+ if (d)
565
+ a.done = P >= h;
566
+ else {
567
+ let C = P === 0 ? m : 0;
568
+ v < 1 && (C = P === 0 ? /* @__PURE__ */ _(m) : ds(y, P, b));
569
+ const S = Math.abs(C) <= i, B = Math.abs(r - b) <= s;
570
+ a.done = S && B;
571
+ }
572
+ return a.value = a.done ? r : b, a;
573
+ },
574
+ toString: () => {
575
+ const P = Math.min(tn(w), _t), b = fs((C) => w.next(P * C).value, P, 30);
576
+ return P + "ms " + b;
577
+ },
578
+ toTransition: () => {
579
+ }
580
+ };
581
+ return w;
582
+ }
583
+ Ht.applyToOptions = (t) => {
584
+ const e = mo(t, 100, Ht);
585
+ return t.ease = e.ease, t.duration = /* @__PURE__ */ _(e.duration), t.type = "keyframes", t;
586
+ };
587
+ function Pe({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: i = 325, bounceDamping: s = 10, bounceStiffness: o = 500, modifyTarget: r, min: a, max: l, restDelta: c = 0.5, restSpeed: u }) {
588
+ const h = t[0], f = {
589
+ done: !1,
590
+ value: h
591
+ }, d = (S) => a !== void 0 && S < a || l !== void 0 && S > l, m = (S) => a === void 0 ? l : l === void 0 || Math.abs(a - S) < Math.abs(l - S) ? a : l;
592
+ let v = n * e;
593
+ const T = h + v, g = r === void 0 ? T : r(T);
594
+ g !== T && (v = g - h);
595
+ const x = (S) => -v * Math.exp(-S / i), y = (S) => g + x(S), w = (S) => {
596
+ const B = x(S), j = y(S);
597
+ f.done = Math.abs(B) <= c, f.value = f.done ? g : j;
598
+ };
599
+ let P, b;
600
+ const C = (S) => {
601
+ d(f.value) && (P = S, b = Ht({
602
+ keyframes: [f.value, m(f.value)],
603
+ velocity: ds(y, S, f.value),
604
+ // TODO: This should be passing * 1000
605
+ damping: s,
606
+ stiffness: o,
607
+ restDelta: c,
608
+ restSpeed: u
609
+ }));
610
+ };
611
+ return C(0), {
612
+ calculatedDuration: null,
613
+ next: (S) => {
614
+ let B = !1;
615
+ return !b && P === void 0 && (B = !0, w(S), C(S)), P !== void 0 && S >= P ? b.next(S - P) : (!B && w(S), f);
616
+ }
617
+ };
618
+ }
619
+ function So(t, e, n) {
620
+ const i = [], s = n || X.mix || hs, o = t.length - 1;
621
+ for (let r = 0; r < o; r++) {
622
+ let a = s(t[r], t[r + 1]);
623
+ if (e) {
624
+ const l = Array.isArray(e) ? e[r] || K : e;
625
+ a = kt(l, a);
626
+ }
627
+ i.push(a);
628
+ }
629
+ return i;
630
+ }
631
+ function wo(t, e, { clamp: n = !0, ease: i, mixer: s } = {}) {
632
+ const o = t.length;
633
+ if (Y(o === e.length, "Both input and output ranges must be the same length", "range-length"), o === 1)
634
+ return () => e[0];
635
+ if (o === 2 && e[0] === e[1])
636
+ return () => e[1];
637
+ const r = t[0] === t[1];
638
+ t[0] > t[o - 1] && (t = [...t].reverse(), e = [...e].reverse());
639
+ const a = So(e, i, s), l = a.length, c = (u) => {
640
+ if (r && u < t[0])
641
+ return e[0];
642
+ let h = 0;
643
+ if (l > 1)
644
+ for (; h < t.length - 2 && !(u < t[h + 1]); h++)
645
+ ;
646
+ const f = /* @__PURE__ */ Mt(t[h], t[h + 1], u);
647
+ return a[h](f);
648
+ };
649
+ return n ? (u) => c(z(t[0], t[o - 1], u)) : c;
650
+ }
651
+ function bo(t, e) {
652
+ const n = t[t.length - 1];
653
+ for (let i = 1; i <= e; i++) {
654
+ const s = /* @__PURE__ */ Mt(0, e, i);
655
+ t.push(D(n, 1, s));
656
+ }
657
+ }
658
+ function Vo(t) {
659
+ const e = [0];
660
+ return bo(e, t.length - 1), e;
661
+ }
662
+ function Ao(t, e) {
663
+ return t.map((n) => n * e);
664
+ }
665
+ function Do(t, e) {
666
+ return t.map(() => e || ts).splice(0, t.length - 1);
667
+ }
668
+ function ct({ duration: t = 300, keyframes: e, times: n, ease: i = "easeInOut" }) {
669
+ const s = jr(i) ? i.map(bn) : bn(i), o = {
670
+ done: !1,
671
+ value: e[0]
672
+ }, r = Ao(
673
+ // Only use the provided offsets if they're the correct length
674
+ // TODO Maybe we should warn here if there's a length mismatch
675
+ n && n.length === e.length ? n : Vo(e),
676
+ t
677
+ ), a = wo(r, e, {
678
+ ease: Array.isArray(s) ? s : Do(e, s)
679
+ });
680
+ return {
681
+ calculatedDuration: t,
682
+ next: (l) => (o.value = a(l), o.done = l >= t, o)
683
+ };
684
+ }
685
+ const Mo = (t) => t !== null;
686
+ function en(t, { repeat: e, repeatType: n = "loop" }, i, s = 1) {
687
+ const o = t.filter(Mo), a = s < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : o.length - 1;
688
+ return !a || i === void 0 ? o[a] : i;
689
+ }
690
+ const Co = {
691
+ decay: Pe,
692
+ inertia: Pe,
693
+ tween: ct,
694
+ keyframes: ct,
695
+ spring: Ht
696
+ };
697
+ function ms(t) {
698
+ typeof t.type == "string" && (t.type = Co[t.type]);
699
+ }
700
+ class nn {
701
+ constructor() {
702
+ this.updateFinished();
703
+ }
704
+ get finished() {
705
+ return this._finished;
706
+ }
707
+ updateFinished() {
708
+ this._finished = new Promise((e) => {
709
+ this.resolve = e;
710
+ });
711
+ }
712
+ notifyFinished() {
713
+ this.resolve();
714
+ }
715
+ /**
716
+ * Allows the animation to be awaited.
717
+ *
718
+ * @deprecated Use `finished` instead.
719
+ */
720
+ then(e, n) {
721
+ return this.finished.then(e, n);
722
+ }
723
+ }
724
+ const Eo = (t) => t / 100;
725
+ class sn extends nn {
726
+ constructor(e) {
727
+ super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
728
+ const { motionValue: n } = this.options;
729
+ n && n.updatedAt !== F.now() && this.tick(F.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
730
+ }, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
731
+ }
732
+ initAnimation() {
733
+ const { options: e } = this;
734
+ ms(e);
735
+ const { type: n = ct, repeat: i = 0, repeatDelay: s = 0, repeatType: o, velocity: r = 0 } = e;
736
+ let { keyframes: a } = e;
737
+ const l = n || ct;
738
+ process.env.NODE_ENV !== "production" && l !== ct && Y(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), l !== ct && typeof a[0] != "number" && (this.mixKeyframes = kt(Eo, hs(a[0], a[1])), a = [0, 100]);
739
+ const c = l({ ...e, keyframes: a });
740
+ o === "mirror" && (this.mirroredGenerator = l({
741
+ ...e,
742
+ keyframes: [...a].reverse(),
743
+ velocity: -r
744
+ })), c.calculatedDuration === null && (c.calculatedDuration = tn(c));
745
+ const { calculatedDuration: u } = c;
746
+ this.calculatedDuration = u, this.resolvedDuration = u + s, this.totalDuration = this.resolvedDuration * (i + 1) - s, this.generator = c;
747
+ }
748
+ updateTime(e) {
749
+ const n = Math.round(e - this.startTime) * this.playbackSpeed;
750
+ this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
751
+ }
752
+ tick(e, n = !1) {
753
+ const { generator: i, totalDuration: s, mixKeyframes: o, mirroredGenerator: r, resolvedDuration: a, calculatedDuration: l } = this;
754
+ if (this.startTime === null)
755
+ return i.next(0);
756
+ const { delay: c = 0, keyframes: u, repeat: h, repeatType: f, repeatDelay: d, type: m, onUpdate: v, finalKeyframe: T } = this.options;
757
+ this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - s / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e);
758
+ const g = this.currentTime - c * (this.playbackSpeed >= 0 ? 1 : -1), x = this.playbackSpeed >= 0 ? g < 0 : g > s;
759
+ this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = s);
760
+ let y = this.currentTime, w = i;
761
+ if (h) {
762
+ const S = Math.min(this.currentTime, s) / a;
763
+ let B = Math.floor(S), j = S % 1;
764
+ !j && S >= 1 && (j = 1), j === 1 && B--, B = Math.min(B, h + 1), !!(B % 2) && (f === "reverse" ? (j = 1 - j, d && (j -= d / a)) : f === "mirror" && (w = r)), y = z(0, 1, j) * a;
765
+ }
766
+ const P = x ? { done: !1, value: u[0] } : w.next(y);
767
+ o && (P.value = o(P.value));
768
+ let { done: b } = P;
769
+ !x && l !== null && (b = this.playbackSpeed >= 0 ? this.currentTime >= s : this.currentTime <= 0);
770
+ const C = this.holdTime === null && (this.state === "finished" || this.state === "running" && b);
771
+ return C && m !== Pe && (P.value = en(u, this.options, T, this.speed)), v && v(P.value), C && this.finish(), P;
772
+ }
773
+ /**
774
+ * Allows the returned animation to be awaited or promise-chained. Currently
775
+ * resolves when the animation finishes at all but in a future update could/should
776
+ * reject if its cancels.
777
+ */
778
+ then(e, n) {
779
+ return this.finished.then(e, n);
780
+ }
781
+ get duration() {
782
+ return /* @__PURE__ */ W(this.calculatedDuration);
783
+ }
784
+ get iterationDuration() {
785
+ const { delay: e = 0 } = this.options || {};
786
+ return this.duration + /* @__PURE__ */ W(e);
787
+ }
788
+ get time() {
789
+ return /* @__PURE__ */ W(this.currentTime);
790
+ }
791
+ set time(e) {
792
+ e = /* @__PURE__ */ _(e), this.currentTime = e, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.playbackSpeed), this.driver?.start(!1);
793
+ }
794
+ get speed() {
795
+ return this.playbackSpeed;
796
+ }
797
+ set speed(e) {
798
+ this.updateTime(F.now());
799
+ const n = this.playbackSpeed !== e;
800
+ this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ W(this.currentTime));
801
+ }
802
+ play() {
803
+ if (this.isStopped)
804
+ return;
805
+ const { driver: e = fo, startTime: n } = this.options;
806
+ this.driver || (this.driver = e((s) => this.tick(s))), this.options.onPlay?.();
807
+ const i = this.driver.now();
808
+ this.state === "finished" ? (this.updateFinished(), this.startTime = i) : this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime || (this.startTime = n ?? i), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
809
+ }
810
+ pause() {
811
+ this.state = "paused", this.updateTime(F.now()), this.holdTime = this.currentTime;
812
+ }
813
+ complete() {
814
+ this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
815
+ }
816
+ finish() {
817
+ this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
818
+ }
819
+ cancel() {
820
+ this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
821
+ }
822
+ teardown() {
823
+ this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
824
+ }
825
+ stopDriver() {
826
+ this.driver && (this.driver.stop(), this.driver = void 0);
827
+ }
828
+ sample(e) {
829
+ return this.startTime = 0, this.tick(e, !0);
830
+ }
831
+ attachTimeline(e) {
832
+ return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
833
+ }
834
+ }
835
+ function Ro(t) {
836
+ for (let e = 1; e < t.length; e++)
837
+ t[e] ?? (t[e] = t[e - 1]);
838
+ }
839
+ const rt = (t) => t * 180 / Math.PI, Se = (t) => {
840
+ const e = rt(Math.atan2(t[1], t[0]));
841
+ return we(e);
842
+ }, Lo = {
843
+ x: 4,
844
+ y: 5,
845
+ translateX: 4,
846
+ translateY: 5,
847
+ scaleX: 0,
848
+ scaleY: 3,
849
+ scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
850
+ rotate: Se,
851
+ rotateZ: Se,
852
+ skewX: (t) => rt(Math.atan(t[1])),
853
+ skewY: (t) => rt(Math.atan(t[2])),
854
+ skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
855
+ }, we = (t) => (t = t % 360, t < 0 && (t += 360), t), Rn = Se, Ln = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), kn = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), ko = {
856
+ x: 12,
857
+ y: 13,
858
+ z: 14,
859
+ translateX: 12,
860
+ translateY: 13,
861
+ translateZ: 14,
862
+ scaleX: Ln,
863
+ scaleY: kn,
864
+ scale: (t) => (Ln(t) + kn(t)) / 2,
865
+ rotateX: (t) => we(rt(Math.atan2(t[6], t[5]))),
866
+ rotateY: (t) => we(rt(Math.atan2(-t[2], t[0]))),
867
+ rotateZ: Rn,
868
+ rotate: Rn,
869
+ skewX: (t) => rt(Math.atan(t[4])),
870
+ skewY: (t) => rt(Math.atan(t[1])),
871
+ skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
872
+ };
873
+ function be(t) {
874
+ return t.includes("scale") ? 1 : 0;
875
+ }
876
+ function Ve(t, e) {
877
+ if (!t || t === "none")
878
+ return be(e);
879
+ const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
880
+ let i, s;
881
+ if (n)
882
+ i = ko, s = n;
883
+ else {
884
+ const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
885
+ i = Lo, s = a;
886
+ }
887
+ if (!s)
888
+ return be(e);
889
+ const o = i[e], r = s[1].split(",").map(Io);
890
+ return typeof o == "function" ? o(r) : r[o];
891
+ }
892
+ const Fo = (t, e) => {
893
+ const { transform: n = "none" } = getComputedStyle(t);
894
+ return Ve(n, e);
895
+ };
896
+ function Io(t) {
897
+ return parseFloat(t.trim());
898
+ }
899
+ const xt = [
900
+ "transformPerspective",
901
+ "x",
902
+ "y",
903
+ "z",
904
+ "translateX",
905
+ "translateY",
906
+ "translateZ",
907
+ "scale",
908
+ "scaleX",
909
+ "scaleY",
910
+ "rotate",
911
+ "rotateX",
912
+ "rotateY",
913
+ "rotateZ",
914
+ "skew",
915
+ "skewX",
916
+ "skewY"
917
+ ], Pt = new Set(xt), Fn = (t) => t === Tt || t === p, Bo = /* @__PURE__ */ new Set(["x", "y", "z"]), Oo = xt.filter((t) => !Bo.has(t));
918
+ function jo(t) {
919
+ const e = [];
920
+ return Oo.forEach((n) => {
921
+ const i = t.getValue(n);
922
+ i !== void 0 && (e.push([n, i.get()]), i.set(n.startsWith("scale") ? 1 : 0));
923
+ }), e;
924
+ }
925
+ const Z = {
926
+ // Dimensions
927
+ width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
928
+ height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
929
+ top: (t, { top: e }) => parseFloat(e),
930
+ left: (t, { left: e }) => parseFloat(e),
931
+ bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
932
+ right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
933
+ // Transform
934
+ x: (t, { transform: e }) => Ve(e, "x"),
935
+ y: (t, { transform: e }) => Ve(e, "y")
936
+ };
937
+ Z.translateX = Z.x;
938
+ Z.translateY = Z.y;
939
+ const ot = /* @__PURE__ */ new Set();
940
+ let Ae = !1, De = !1, Me = !1;
941
+ function ps() {
942
+ if (De) {
943
+ const t = Array.from(ot).filter((i) => i.needsMeasurement), e = new Set(t.map((i) => i.element)), n = /* @__PURE__ */ new Map();
944
+ e.forEach((i) => {
945
+ const s = jo(i);
946
+ s.length && (n.set(i, s), i.render());
947
+ }), t.forEach((i) => i.measureInitialState()), e.forEach((i) => {
948
+ i.render();
949
+ const s = n.get(i);
950
+ s && s.forEach(([o, r]) => {
951
+ i.getValue(o)?.set(r);
952
+ });
953
+ }), t.forEach((i) => i.measureEndState()), t.forEach((i) => {
954
+ i.suspendedScrollY !== void 0 && window.scrollTo(0, i.suspendedScrollY);
955
+ });
956
+ }
957
+ De = !1, Ae = !1, ot.forEach((t) => t.complete(Me)), ot.clear();
958
+ }
959
+ function gs() {
960
+ ot.forEach((t) => {
961
+ t.readKeyframes(), t.needsMeasurement && (De = !0);
962
+ });
963
+ }
964
+ function No() {
965
+ Me = !0, gs(), ps(), Me = !1;
966
+ }
967
+ class rn {
968
+ constructor(e, n, i, s, o, r = !1) {
969
+ this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = i, this.motionValue = s, this.element = o, this.isAsync = r;
970
+ }
971
+ scheduleResolve() {
972
+ this.state = "scheduled", this.isAsync ? (ot.add(this), Ae || (Ae = !0, V.read(gs), V.resolveKeyframes(ps))) : (this.readKeyframes(), this.complete());
973
+ }
974
+ readKeyframes() {
975
+ const { unresolvedKeyframes: e, name: n, element: i, motionValue: s } = this;
976
+ if (e[0] === null) {
977
+ const o = s?.get(), r = e[e.length - 1];
978
+ if (o !== void 0)
979
+ e[0] = o;
980
+ else if (i && n) {
981
+ const a = i.readValue(n, r);
982
+ a != null && (e[0] = a);
983
+ }
984
+ e[0] === void 0 && (e[0] = r), s && o === void 0 && s.set(e[0]);
985
+ }
986
+ Ro(e);
987
+ }
988
+ setFinalKeyframe() {
989
+ }
990
+ measureInitialState() {
991
+ }
992
+ renderEndStyles() {
993
+ }
994
+ measureEndState() {
995
+ }
996
+ complete(e = !1) {
997
+ this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), ot.delete(this);
998
+ }
999
+ cancel() {
1000
+ this.state === "scheduled" && (ot.delete(this), this.state = "pending");
1001
+ }
1002
+ resume() {
1003
+ this.state === "pending" && this.scheduleResolve();
1004
+ }
1005
+ }
1006
+ const Uo = (t) => t.startsWith("--");
1007
+ function Wo(t, e, n) {
1008
+ Uo(e) ? t.style.setProperty(e, n) : t.style[e] = n;
1009
+ }
1010
+ const Ko = /* @__PURE__ */ _e(() => window.ScrollTimeline !== void 0), $o = {};
1011
+ function Go(t, e) {
1012
+ const n = /* @__PURE__ */ _e(t);
1013
+ return () => $o[e] ?? n();
1014
+ }
1015
+ const ys = /* @__PURE__ */ Go(() => {
1016
+ try {
1017
+ document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1018
+ } catch {
1019
+ return !1;
1020
+ }
1021
+ return !0;
1022
+ }, "linearEasing"), wt = ([t, e, n, i]) => `cubic-bezier(${t}, ${e}, ${n}, ${i})`, In = {
1023
+ linear: "linear",
1024
+ ease: "ease",
1025
+ easeIn: "ease-in",
1026
+ easeOut: "ease-out",
1027
+ easeInOut: "ease-in-out",
1028
+ circIn: /* @__PURE__ */ wt([0, 0.65, 0.55, 1]),
1029
+ circOut: /* @__PURE__ */ wt([0.55, 0, 1, 0.45]),
1030
+ backIn: /* @__PURE__ */ wt([0.31, 0.01, 0.66, -0.59]),
1031
+ backOut: /* @__PURE__ */ wt([0.33, 1.53, 0.69, 0.99])
1032
+ };
1033
+ function vs(t, e) {
1034
+ if (t)
1035
+ return typeof t == "function" ? ys() ? fs(t, e) : "ease-out" : es(t) ? wt(t) : Array.isArray(t) ? t.map((n) => vs(n, e) || In.easeOut) : In[t];
1036
+ }
1037
+ function _o(t, e, n, { delay: i = 0, duration: s = 300, repeat: o = 0, repeatType: r = "loop", ease: a = "easeOut", times: l } = {}, c = void 0) {
1038
+ const u = {
1039
+ [e]: n
1040
+ };
1041
+ l && (u.offset = l);
1042
+ const h = vs(a, s);
1043
+ Array.isArray(h) && (u.easing = h);
1044
+ const f = {
1045
+ delay: i,
1046
+ duration: s,
1047
+ easing: Array.isArray(h) ? "linear" : h,
1048
+ fill: "both",
1049
+ iterations: o + 1,
1050
+ direction: r === "reverse" ? "alternate" : "normal"
1051
+ };
1052
+ return c && (f.pseudoElement = c), t.animate(u, f);
1053
+ }
1054
+ function Ts(t) {
1055
+ return typeof t == "function" && "applyToOptions" in t;
1056
+ }
1057
+ function Ho({ type: t, ...e }) {
1058
+ return Ts(t) && ys() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
1059
+ }
1060
+ class zo extends nn {
1061
+ constructor(e) {
1062
+ if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !e)
1063
+ return;
1064
+ const { element: n, name: i, keyframes: s, pseudoElement: o, allowFlatten: r = !1, finalKeyframe: a, onComplete: l } = e;
1065
+ this.isPseudoElement = !!o, this.allowFlatten = r, this.options = e, Y(typeof e.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
1066
+ const c = Ho(e);
1067
+ this.animation = _o(n, i, s, c, o), c.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
1068
+ if (this.finishedTime = this.time, !o) {
1069
+ const u = en(s, this.options, a, this.speed);
1070
+ this.updateMotionValue ? this.updateMotionValue(u) : Wo(n, i, u), this.animation.cancel();
1071
+ }
1072
+ l?.(), this.notifyFinished();
1073
+ };
1074
+ }
1075
+ play() {
1076
+ this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished());
1077
+ }
1078
+ pause() {
1079
+ this.animation.pause();
1080
+ }
1081
+ complete() {
1082
+ this.animation.finish?.();
1083
+ }
1084
+ cancel() {
1085
+ try {
1086
+ this.animation.cancel();
1087
+ } catch {
1088
+ }
1089
+ }
1090
+ stop() {
1091
+ if (this.isStopped)
1092
+ return;
1093
+ this.isStopped = !0;
1094
+ const { state: e } = this;
1095
+ e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
1096
+ }
1097
+ /**
1098
+ * WAAPI doesn't natively have any interruption capabilities.
1099
+ *
1100
+ * In this method, we commit styles back to the DOM before cancelling
1101
+ * the animation.
1102
+ *
1103
+ * This is designed to be overridden by NativeAnimationExtended, which
1104
+ * will create a renderless JS animation and sample it twice to calculate
1105
+ * its current value, "previous" value, and therefore allow
1106
+ * Motion to also correctly calculate velocity for any subsequent animation
1107
+ * while deferring the commit until the next animation frame.
1108
+ */
1109
+ commitStyles() {
1110
+ this.isPseudoElement || this.animation.commitStyles?.();
1111
+ }
1112
+ get duration() {
1113
+ const e = this.animation.effect?.getComputedTiming?.().duration || 0;
1114
+ return /* @__PURE__ */ W(Number(e));
1115
+ }
1116
+ get iterationDuration() {
1117
+ const { delay: e = 0 } = this.options || {};
1118
+ return this.duration + /* @__PURE__ */ W(e);
1119
+ }
1120
+ get time() {
1121
+ return /* @__PURE__ */ W(Number(this.animation.currentTime) || 0);
1122
+ }
1123
+ set time(e) {
1124
+ this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ _(e);
1125
+ }
1126
+ /**
1127
+ * The playback speed of the animation.
1128
+ * 1 = normal speed, 2 = double speed, 0.5 = half speed.
1129
+ */
1130
+ get speed() {
1131
+ return this.animation.playbackRate;
1132
+ }
1133
+ set speed(e) {
1134
+ e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
1135
+ }
1136
+ get state() {
1137
+ return this.finishedTime !== null ? "finished" : this.animation.playState;
1138
+ }
1139
+ get startTime() {
1140
+ return this.manualStartTime ?? Number(this.animation.startTime);
1141
+ }
1142
+ set startTime(e) {
1143
+ this.manualStartTime = this.animation.startTime = e;
1144
+ }
1145
+ /**
1146
+ * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
1147
+ */
1148
+ attachTimeline({ timeline: e, observe: n }) {
1149
+ return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && Ko() ? (this.animation.timeline = e, K) : n(this);
1150
+ }
1151
+ }
1152
+ const xs = {
1153
+ anticipate: Zi,
1154
+ backInOut: qi,
1155
+ circInOut: Qi
1156
+ };
1157
+ function Yo(t) {
1158
+ return t in xs;
1159
+ }
1160
+ function Xo(t) {
1161
+ typeof t.ease == "string" && Yo(t.ease) && (t.ease = xs[t.ease]);
1162
+ }
1163
+ const oe = 10;
1164
+ class qo extends zo {
1165
+ constructor(e) {
1166
+ Xo(e), ms(e), super(e), e.startTime !== void 0 && (this.startTime = e.startTime), this.options = e;
1167
+ }
1168
+ /**
1169
+ * WAAPI doesn't natively have any interruption capabilities.
1170
+ *
1171
+ * Rather than read committed styles back out of the DOM, we can
1172
+ * create a renderless JS animation and sample it twice to calculate
1173
+ * its current value, "previous" value, and therefore allow
1174
+ * Motion to calculate velocity for any subsequent animation.
1175
+ */
1176
+ updateMotionValue(e) {
1177
+ const { motionValue: n, onUpdate: i, onComplete: s, element: o, ...r } = this.options;
1178
+ if (!n)
1179
+ return;
1180
+ if (e !== void 0) {
1181
+ n.set(e);
1182
+ return;
1183
+ }
1184
+ const a = new sn({
1185
+ ...r,
1186
+ autoplay: !1
1187
+ }), l = Math.max(oe, F.now() - this.startTime), c = z(0, oe, l - oe);
1188
+ n.setWithVelocity(a.sample(Math.max(0, l - c)).value, a.sample(l).value, c), a.stop();
1189
+ }
1190
+ }
1191
+ const Bn = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
1192
+ (Q.test(t) || t === "0") && // And it contains numbers and/or colors
1193
+ !t.startsWith("url("));
1194
+ function Zo(t) {
1195
+ const e = t[0];
1196
+ if (t.length === 1)
1197
+ return !0;
1198
+ for (let n = 0; n < t.length; n++)
1199
+ if (t[n] !== e)
1200
+ return !0;
1201
+ }
1202
+ function Jo(t, e, n, i) {
1203
+ const s = t[0];
1204
+ if (s === null)
1205
+ return !1;
1206
+ if (e === "display" || e === "visibility")
1207
+ return !0;
1208
+ const o = t[t.length - 1], r = Bn(s, e), a = Bn(o, e);
1209
+ return vt(r === a, `You are trying to animate ${e} from "${s}" to "${o}". "${r ? o : s}" is not an animatable value.`, "value-not-animatable"), !r || !a ? !1 : Zo(t) || (n === "spring" || Ts(n)) && i;
1210
+ }
1211
+ function Ce(t) {
1212
+ t.duration = 0, t.type = "keyframes";
1213
+ }
1214
+ const Qo = /* @__PURE__ */ new Set([
1215
+ "opacity",
1216
+ "clipPath",
1217
+ "filter",
1218
+ "transform"
1219
+ // TODO: Could be re-enabled now we have support for linear() easing
1220
+ // "background-color"
1221
+ ]), ta = /* @__PURE__ */ _e(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1222
+ function ea(t) {
1223
+ const { motionValue: e, name: n, repeatDelay: i, repeatType: s, damping: o, type: r } = t;
1224
+ if (!(e?.owner?.current instanceof HTMLElement))
1225
+ return !1;
1226
+ const { onUpdate: l, transformTemplate: c } = e.owner.getProps();
1227
+ return ta() && n && Qo.has(n) && (n !== "transform" || !c) && /**
1228
+ * If we're outputting values to onUpdate then we can't use WAAPI as there's
1229
+ * no way to read the value from WAAPI every frame.
1230
+ */
1231
+ !l && !i && s !== "mirror" && o !== 0 && r !== "inertia";
1232
+ }
1233
+ const na = 40;
1234
+ class ia extends nn {
1235
+ constructor({ autoplay: e = !0, delay: n = 0, type: i = "keyframes", repeat: s = 0, repeatDelay: o = 0, repeatType: r = "loop", keyframes: a, name: l, motionValue: c, element: u, ...h }) {
1236
+ super(), this.stop = () => {
1237
+ this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
1238
+ }, this.createdAt = F.now();
1239
+ const f = {
1240
+ autoplay: e,
1241
+ delay: n,
1242
+ type: i,
1243
+ repeat: s,
1244
+ repeatDelay: o,
1245
+ repeatType: r,
1246
+ name: l,
1247
+ motionValue: c,
1248
+ element: u,
1249
+ ...h
1250
+ }, d = u?.KeyframeResolver || rn;
1251
+ this.keyframeResolver = new d(a, (m, v, T) => this.onKeyframesResolved(m, v, f, !T), l, c, u), this.keyframeResolver?.scheduleResolve();
1252
+ }
1253
+ onKeyframesResolved(e, n, i, s) {
1254
+ this.keyframeResolver = void 0;
1255
+ const { name: o, type: r, velocity: a, delay: l, isHandoff: c, onUpdate: u } = i;
1256
+ this.resolvedAt = F.now(), Jo(e, o, r, a) || ((X.instantAnimations || !l) && u?.(en(e, i, n)), e[0] = e[e.length - 1], Ce(i), i.repeat = 0);
1257
+ const f = {
1258
+ startTime: s ? this.resolvedAt ? this.resolvedAt - this.createdAt > na ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1259
+ finalKeyframe: n,
1260
+ ...i,
1261
+ keyframes: e
1262
+ }, d = !c && ea(f) ? new qo({
1263
+ ...f,
1264
+ element: f.motionValue.owner.current
1265
+ }) : new sn(f);
1266
+ d.finished.then(() => this.notifyFinished()).catch(K), this.pendingTimeline && (this.stopTimeline = d.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = d;
1267
+ }
1268
+ get finished() {
1269
+ return this._animation ? this.animation.finished : this._finished;
1270
+ }
1271
+ then(e, n) {
1272
+ return this.finished.finally(e).then(() => {
1273
+ });
1274
+ }
1275
+ get animation() {
1276
+ return this._animation || (this.keyframeResolver?.resume(), No()), this._animation;
1277
+ }
1278
+ get duration() {
1279
+ return this.animation.duration;
1280
+ }
1281
+ get iterationDuration() {
1282
+ return this.animation.iterationDuration;
1283
+ }
1284
+ get time() {
1285
+ return this.animation.time;
1286
+ }
1287
+ set time(e) {
1288
+ this.animation.time = e;
1289
+ }
1290
+ get speed() {
1291
+ return this.animation.speed;
1292
+ }
1293
+ get state() {
1294
+ return this.animation.state;
1295
+ }
1296
+ set speed(e) {
1297
+ this.animation.speed = e;
1298
+ }
1299
+ get startTime() {
1300
+ return this.animation.startTime;
1301
+ }
1302
+ attachTimeline(e) {
1303
+ return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
1304
+ }
1305
+ play() {
1306
+ this.animation.play();
1307
+ }
1308
+ pause() {
1309
+ this.animation.pause();
1310
+ }
1311
+ complete() {
1312
+ this.animation.complete();
1313
+ }
1314
+ cancel() {
1315
+ this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
1316
+ }
1317
+ }
1318
+ const sa = (
1319
+ // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
1320
+ /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
1321
+ );
1322
+ function ra(t) {
1323
+ const e = sa.exec(t);
1324
+ if (!e)
1325
+ return [,];
1326
+ const [, n, i, s] = e;
1327
+ return [`--${n ?? i}`, s];
1328
+ }
1329
+ const oa = 4;
1330
+ function Ps(t, e, n = 1) {
1331
+ Y(n <= oa, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
1332
+ const [i, s] = ra(t);
1333
+ if (!i)
1334
+ return;
1335
+ const o = window.getComputedStyle(e).getPropertyValue(i);
1336
+ if (o) {
1337
+ const r = o.trim();
1338
+ return Ki(r) ? parseFloat(r) : r;
1339
+ }
1340
+ return qe(s) ? Ps(s, e, n + 1) : s;
1341
+ }
1342
+ function on(t, e) {
1343
+ return t?.[e] ?? t?.default ?? t;
1344
+ }
1345
+ const aa = {
1346
+ type: "spring",
1347
+ stiffness: 500,
1348
+ damping: 25,
1349
+ restSpeed: 10
1350
+ }, la = (t) => ({
1351
+ type: "spring",
1352
+ stiffness: 550,
1353
+ damping: t === 0 ? 2 * Math.sqrt(550) : 30,
1354
+ restSpeed: 10
1355
+ }), ua = {
1356
+ type: "keyframes",
1357
+ duration: 0.8
1358
+ }, ca = {
1359
+ type: "keyframes",
1360
+ ease: [0.25, 0.1, 0.35, 1],
1361
+ duration: 0.3
1362
+ }, ha = (t, { keyframes: e }) => e.length > 2 ? ua : Pt.has(t) ? t.startsWith("scale") ? la(e[1]) : aa : ca;
1363
+ function fa({ when: t, delay: e, delayChildren: n, staggerChildren: i, staggerDirection: s, repeat: o, repeatType: r, repeatDelay: a, from: l, elapsed: c, ...u }) {
1364
+ return !!Object.keys(u).length;
1365
+ }
1366
+ const da = (t) => t !== null;
1367
+ function ma(t, { repeat: e, repeatType: n = "loop" }, i) {
1368
+ const s = t.filter(da), o = e && n !== "loop" && e % 2 === 1 ? 0 : s.length - 1;
1369
+ return s[o];
1370
+ }
1371
+ function Ss(t, e, n, i = 0, s = 1) {
1372
+ const o = Array.from(t).sort((c, u) => c.sortNodePosition(u)).indexOf(e), r = t.size, a = (r - 1) * i;
1373
+ return typeof n == "function" ? n(o, r) : s === 1 ? o * i : a - o * i;
1374
+ }
1375
+ const an = (t, e, n, i = {}, s, o) => (r) => {
1376
+ const a = on(i, t) || {}, l = a.delay || i.delay || 0;
1377
+ let { elapsed: c = 0 } = i;
1378
+ c = c - /* @__PURE__ */ _(l);
1379
+ const u = {
1380
+ keyframes: Array.isArray(n) ? n : [null, n],
1381
+ ease: "easeOut",
1382
+ velocity: e.getVelocity(),
1383
+ ...a,
1384
+ delay: -c,
1385
+ onUpdate: (f) => {
1386
+ e.set(f), a.onUpdate && a.onUpdate(f);
1387
+ },
1388
+ onComplete: () => {
1389
+ r(), a.onComplete && a.onComplete();
1390
+ },
1391
+ name: t,
1392
+ motionValue: e,
1393
+ element: o ? void 0 : s
1394
+ };
1395
+ fa(a) || Object.assign(u, ha(t, u)), u.duration && (u.duration = /* @__PURE__ */ _(u.duration)), u.repeatDelay && (u.repeatDelay = /* @__PURE__ */ _(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
1396
+ let h = !1;
1397
+ if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (Ce(u), u.delay === 0 && (h = !0)), (X.instantAnimations || X.skipAnimations) && (h = !0, Ce(u), u.delay = 0), u.allowFlatten = !a.type && !a.ease, h && !o && e.get() !== void 0) {
1398
+ const f = ma(u.keyframes, a);
1399
+ if (f !== void 0) {
1400
+ V.update(() => {
1401
+ u.onUpdate(f), u.onComplete();
1402
+ });
1403
+ return;
1404
+ }
1405
+ }
1406
+ return a.isSync ? new sn(u) : new ia(u);
1407
+ }, ws = /* @__PURE__ */ new Set([
1408
+ "width",
1409
+ "height",
1410
+ "top",
1411
+ "left",
1412
+ "right",
1413
+ "bottom",
1414
+ ...xt
1415
+ ]), On = 30, pa = (t) => !isNaN(parseFloat(t));
1416
+ class ga {
1417
+ /**
1418
+ * @param init - The initiating value
1419
+ * @param config - Optional configuration options
1420
+ *
1421
+ * - `transformer`: A function to transform incoming values with.
1422
+ */
1423
+ constructor(e, n = {}) {
1424
+ this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (i) => {
1425
+ const s = F.now();
1426
+ if (this.updatedAt !== s && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(i), this.current !== this.prev && (this.events.change?.notify(this.current), this.dependents))
1427
+ for (const o of this.dependents)
1428
+ o.dirty();
1429
+ }, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
1430
+ }
1431
+ setCurrent(e) {
1432
+ this.current = e, this.updatedAt = F.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = pa(this.current));
1433
+ }
1434
+ setPrevFrameValue(e = this.current) {
1435
+ this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
1436
+ }
1437
+ /**
1438
+ * Adds a function that will be notified when the `MotionValue` is updated.
1439
+ *
1440
+ * It returns a function that, when called, will cancel the subscription.
1441
+ *
1442
+ * When calling `onChange` inside a React component, it should be wrapped with the
1443
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
1444
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
1445
+ *
1446
+ * ```jsx
1447
+ * export const MyComponent = () => {
1448
+ * const x = useMotionValue(0)
1449
+ * const y = useMotionValue(0)
1450
+ * const opacity = useMotionValue(1)
1451
+ *
1452
+ * useEffect(() => {
1453
+ * function updateOpacity() {
1454
+ * const maxXY = Math.max(x.get(), y.get())
1455
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
1456
+ * opacity.set(newOpacity)
1457
+ * }
1458
+ *
1459
+ * const unsubscribeX = x.on("change", updateOpacity)
1460
+ * const unsubscribeY = y.on("change", updateOpacity)
1461
+ *
1462
+ * return () => {
1463
+ * unsubscribeX()
1464
+ * unsubscribeY()
1465
+ * }
1466
+ * }, [])
1467
+ *
1468
+ * return <motion.div style={{ x }} />
1469
+ * }
1470
+ * ```
1471
+ *
1472
+ * @param subscriber - A function that receives the latest value.
1473
+ * @returns A function that, when called, will cancel this subscription.
1474
+ *
1475
+ * @deprecated
1476
+ */
1477
+ onChange(e) {
1478
+ return process.env.NODE_ENV !== "production" && ze(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
1479
+ }
1480
+ on(e, n) {
1481
+ this.events[e] || (this.events[e] = new He());
1482
+ const i = this.events[e].add(n);
1483
+ return e === "change" ? () => {
1484
+ i(), V.read(() => {
1485
+ this.events.change.getSize() || this.stop();
1486
+ });
1487
+ } : i;
1488
+ }
1489
+ clearListeners() {
1490
+ for (const e in this.events)
1491
+ this.events[e].clear();
1492
+ }
1493
+ /**
1494
+ * Attaches a passive effect to the `MotionValue`.
1495
+ */
1496
+ attach(e, n) {
1497
+ this.passiveEffect = e, this.stopPassiveEffect = n;
1498
+ }
1499
+ /**
1500
+ * Sets the state of the `MotionValue`.
1501
+ *
1502
+ * @remarks
1503
+ *
1504
+ * ```jsx
1505
+ * const x = useMotionValue(0)
1506
+ * x.set(10)
1507
+ * ```
1508
+ *
1509
+ * @param latest - Latest value to set.
1510
+ * @param render - Whether to notify render subscribers. Defaults to `true`
1511
+ *
1512
+ * @public
1513
+ */
1514
+ set(e) {
1515
+ this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
1516
+ }
1517
+ setWithVelocity(e, n, i) {
1518
+ this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - i;
1519
+ }
1520
+ /**
1521
+ * Set the state of the `MotionValue`, stopping any active animations,
1522
+ * effects, and resets velocity to `0`.
1523
+ */
1524
+ jump(e, n = !0) {
1525
+ this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1526
+ }
1527
+ dirty() {
1528
+ this.events.change?.notify(this.current);
1529
+ }
1530
+ addDependent(e) {
1531
+ this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(e);
1532
+ }
1533
+ removeDependent(e) {
1534
+ this.dependents && this.dependents.delete(e);
1535
+ }
1536
+ /**
1537
+ * Returns the latest state of `MotionValue`
1538
+ *
1539
+ * @returns - The latest state of `MotionValue`
1540
+ *
1541
+ * @public
1542
+ */
1543
+ get() {
1544
+ return this.current;
1545
+ }
1546
+ /**
1547
+ * @public
1548
+ */
1549
+ getPrevious() {
1550
+ return this.prev;
1551
+ }
1552
+ /**
1553
+ * Returns the latest velocity of `MotionValue`
1554
+ *
1555
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
1556
+ *
1557
+ * @public
1558
+ */
1559
+ getVelocity() {
1560
+ const e = F.now();
1561
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > On)
1562
+ return 0;
1563
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, On);
1564
+ return _i(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1565
+ }
1566
+ /**
1567
+ * Registers a new animation to control this `MotionValue`. Only one
1568
+ * animation can drive a `MotionValue` at one time.
1569
+ *
1570
+ * ```jsx
1571
+ * value.start()
1572
+ * ```
1573
+ *
1574
+ * @param animation - A function that starts the provided animation
1575
+ */
1576
+ start(e) {
1577
+ return this.stop(), new Promise((n) => {
1578
+ this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
1579
+ }).then(() => {
1580
+ this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1581
+ });
1582
+ }
1583
+ /**
1584
+ * Stop the currently active animation.
1585
+ *
1586
+ * @public
1587
+ */
1588
+ stop() {
1589
+ this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1590
+ }
1591
+ /**
1592
+ * Returns `true` if this value is currently animating.
1593
+ *
1594
+ * @public
1595
+ */
1596
+ isAnimating() {
1597
+ return !!this.animation;
1598
+ }
1599
+ clearAnimation() {
1600
+ delete this.animation;
1601
+ }
1602
+ /**
1603
+ * Destroy and clean up subscribers to this `MotionValue`.
1604
+ *
1605
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
1606
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
1607
+ * created a `MotionValue` via the `motionValue` function.
1608
+ *
1609
+ * @public
1610
+ */
1611
+ destroy() {
1612
+ this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1613
+ }
1614
+ }
1615
+ function gt(t, e) {
1616
+ return new ga(t, e);
1617
+ }
1618
+ function jn(t) {
1619
+ const e = [{}, {}];
1620
+ return t?.values.forEach((n, i) => {
1621
+ e[0][i] = n.get(), e[1][i] = n.getVelocity();
1622
+ }), e;
1623
+ }
1624
+ function ln(t, e, n, i) {
1625
+ if (typeof e == "function") {
1626
+ const [s, o] = jn(i);
1627
+ e = e(n !== void 0 ? n : t.custom, s, o);
1628
+ }
1629
+ if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
1630
+ const [s, o] = jn(i);
1631
+ e = e(n !== void 0 ? n : t.custom, s, o);
1632
+ }
1633
+ return e;
1634
+ }
1635
+ function pt(t, e, n) {
1636
+ const i = t.getProps();
1637
+ return ln(i, e, n !== void 0 ? n : i.custom, t);
1638
+ }
1639
+ const Ee = (t) => Array.isArray(t);
1640
+ function ya(t, e, n) {
1641
+ t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, gt(n));
1642
+ }
1643
+ function va(t) {
1644
+ return Ee(t) ? t[t.length - 1] || 0 : t;
1645
+ }
1646
+ function Ta(t, e) {
1647
+ const n = pt(t, e);
1648
+ let { transitionEnd: i = {}, transition: s = {}, ...o } = n || {};
1649
+ o = { ...o, ...i };
1650
+ for (const r in o) {
1651
+ const a = va(o[r]);
1652
+ ya(t, r, a);
1653
+ }
1654
+ }
1655
+ const k = (t) => !!(t && t.getVelocity);
1656
+ function xa(t) {
1657
+ return !!(k(t) && t.add);
1658
+ }
1659
+ function Re(t, e) {
1660
+ const n = t.getValue("willChange");
1661
+ if (xa(n))
1662
+ return n.add(e);
1663
+ if (!n && X.WillChange) {
1664
+ const i = new X.WillChange("auto");
1665
+ t.addValue("willChange", i), i.add(e);
1666
+ }
1667
+ }
1668
+ function un(t) {
1669
+ return t.replace(/([A-Z])/g, (e) => `-${e.toLowerCase()}`);
1670
+ }
1671
+ const Pa = "framerAppearId", bs = "data-" + un(Pa);
1672
+ function Vs(t) {
1673
+ return t.props[bs];
1674
+ }
1675
+ function Sa({ protectedKeys: t, needsAnimating: e }, n) {
1676
+ const i = t.hasOwnProperty(n) && e[n] !== !0;
1677
+ return e[n] = !1, i;
1678
+ }
1679
+ function As(t, e, { delay: n = 0, transitionOverride: i, type: s } = {}) {
1680
+ let { transition: o = t.getDefaultTransition(), transitionEnd: r, ...a } = e;
1681
+ i && (o = i);
1682
+ const l = [], c = s && t.animationState && t.animationState.getState()[s];
1683
+ for (const u in a) {
1684
+ const h = t.getValue(u, t.latestValues[u] ?? null), f = a[u];
1685
+ if (f === void 0 || c && Sa(c, u))
1686
+ continue;
1687
+ const d = {
1688
+ delay: n,
1689
+ ...on(o || {}, u)
1690
+ }, m = h.get();
1691
+ if (m !== void 0 && !h.isAnimating && !Array.isArray(f) && f === m && !d.velocity)
1692
+ continue;
1693
+ let v = !1;
1694
+ if (window.MotionHandoffAnimation) {
1695
+ const g = Vs(t);
1696
+ if (g) {
1697
+ const x = window.MotionHandoffAnimation(g, u, V);
1698
+ x !== null && (d.startTime = x, v = !0);
1699
+ }
1700
+ }
1701
+ Re(t, u), h.start(an(u, h, f, t.shouldReduceMotion && ws.has(u) ? { type: !1 } : d, t, v));
1702
+ const T = h.animation;
1703
+ T && l.push(T);
1704
+ }
1705
+ return r && Promise.all(l).then(() => {
1706
+ V.update(() => {
1707
+ r && Ta(t, r);
1708
+ });
1709
+ }), l;
1710
+ }
1711
+ function Le(t, e, n = {}) {
1712
+ const i = pt(t, e, n.type === "exit" ? t.presenceContext?.custom : void 0);
1713
+ let { transition: s = t.getDefaultTransition() || {} } = i || {};
1714
+ n.transitionOverride && (s = n.transitionOverride);
1715
+ const o = i ? () => Promise.all(As(t, i, n)) : () => Promise.resolve(), r = t.variantChildren && t.variantChildren.size ? (l = 0) => {
1716
+ const { delayChildren: c = 0, staggerChildren: u, staggerDirection: h } = s;
1717
+ return wa(t, e, l, c, u, h, n);
1718
+ } : () => Promise.resolve(), { when: a } = s;
1719
+ if (a) {
1720
+ const [l, c] = a === "beforeChildren" ? [o, r] : [r, o];
1721
+ return l().then(() => c());
1722
+ } else
1723
+ return Promise.all([o(), r(n.delay)]);
1724
+ }
1725
+ function wa(t, e, n = 0, i = 0, s = 0, o = 1, r) {
1726
+ const a = [];
1727
+ for (const l of t.variantChildren)
1728
+ l.notify("AnimationStart", e), a.push(Le(l, e, {
1729
+ ...r,
1730
+ delay: n + (typeof i == "function" ? 0 : i) + Ss(t.variantChildren, l, i, s, o)
1731
+ }).then(() => l.notify("AnimationComplete", e)));
1732
+ return Promise.all(a);
1733
+ }
1734
+ function ba(t, e, n = {}) {
1735
+ t.notify("AnimationStart", e);
1736
+ let i;
1737
+ if (Array.isArray(e)) {
1738
+ const s = e.map((o) => Le(t, o, n));
1739
+ i = Promise.all(s);
1740
+ } else if (typeof e == "string")
1741
+ i = Le(t, e, n);
1742
+ else {
1743
+ const s = typeof e == "function" ? pt(t, e, n.custom) : e;
1744
+ i = Promise.all(As(t, s, n));
1745
+ }
1746
+ return i.then(() => {
1747
+ t.notify("AnimationComplete", e);
1748
+ });
1749
+ }
1750
+ const Va = {
1751
+ test: (t) => t === "auto",
1752
+ parse: (t) => t
1753
+ }, Ds = (t) => (e) => e.test(t), Ms = [Tt, p, H, q, qr, Xr, Va], Nn = (t) => Ms.find(Ds(t));
1754
+ function Aa(t) {
1755
+ return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Gi(t) : !0;
1756
+ }
1757
+ const Da = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1758
+ function Ma(t) {
1759
+ const [e, n] = t.slice(0, -1).split("(");
1760
+ if (e === "drop-shadow")
1761
+ return t;
1762
+ const [i] = n.match(Ze) || [];
1763
+ if (!i)
1764
+ return t;
1765
+ const s = n.replace(i, "");
1766
+ let o = Da.has(e) ? 1 : 0;
1767
+ return i !== n && (o *= 100), e + "(" + o + s + ")";
1768
+ }
1769
+ const Ca = /\b([a-z-]*)\(.*?\)/gu, ke = {
1770
+ ...Q,
1771
+ getAnimatableNone: (t) => {
1772
+ const e = t.match(Ca);
1773
+ return e ? e.map(Ma).join(" ") : t;
1774
+ }
1775
+ }, Un = {
1776
+ ...Tt,
1777
+ transform: Math.round
1778
+ }, Ea = {
1779
+ rotate: q,
1780
+ rotateX: q,
1781
+ rotateY: q,
1782
+ rotateZ: q,
1783
+ scale: jt,
1784
+ scaleX: jt,
1785
+ scaleY: jt,
1786
+ scaleZ: jt,
1787
+ skew: q,
1788
+ skewX: q,
1789
+ skewY: q,
1790
+ distance: p,
1791
+ translateX: p,
1792
+ translateY: p,
1793
+ translateZ: p,
1794
+ x: p,
1795
+ y: p,
1796
+ z: p,
1797
+ perspective: p,
1798
+ transformPerspective: p,
1799
+ opacity: Ct,
1800
+ originX: An,
1801
+ originY: An,
1802
+ originZ: p
1803
+ }, cn = {
1804
+ // Border props
1805
+ borderWidth: p,
1806
+ borderTopWidth: p,
1807
+ borderRightWidth: p,
1808
+ borderBottomWidth: p,
1809
+ borderLeftWidth: p,
1810
+ borderRadius: p,
1811
+ radius: p,
1812
+ borderTopLeftRadius: p,
1813
+ borderTopRightRadius: p,
1814
+ borderBottomRightRadius: p,
1815
+ borderBottomLeftRadius: p,
1816
+ // Positioning props
1817
+ width: p,
1818
+ maxWidth: p,
1819
+ height: p,
1820
+ maxHeight: p,
1821
+ top: p,
1822
+ right: p,
1823
+ bottom: p,
1824
+ left: p,
1825
+ inset: p,
1826
+ insetBlock: p,
1827
+ insetBlockStart: p,
1828
+ insetBlockEnd: p,
1829
+ insetInline: p,
1830
+ insetInlineStart: p,
1831
+ insetInlineEnd: p,
1832
+ // Spacing props
1833
+ padding: p,
1834
+ paddingTop: p,
1835
+ paddingRight: p,
1836
+ paddingBottom: p,
1837
+ paddingLeft: p,
1838
+ paddingBlock: p,
1839
+ paddingBlockStart: p,
1840
+ paddingBlockEnd: p,
1841
+ paddingInline: p,
1842
+ paddingInlineStart: p,
1843
+ paddingInlineEnd: p,
1844
+ margin: p,
1845
+ marginTop: p,
1846
+ marginRight: p,
1847
+ marginBottom: p,
1848
+ marginLeft: p,
1849
+ marginBlock: p,
1850
+ marginBlockStart: p,
1851
+ marginBlockEnd: p,
1852
+ marginInline: p,
1853
+ marginInlineStart: p,
1854
+ marginInlineEnd: p,
1855
+ // Misc
1856
+ backgroundPositionX: p,
1857
+ backgroundPositionY: p,
1858
+ ...Ea,
1859
+ zIndex: Un,
1860
+ // SVG
1861
+ fillOpacity: Ct,
1862
+ strokeOpacity: Ct,
1863
+ numOctaves: Un
1864
+ }, Ra = {
1865
+ ...cn,
1866
+ // Color props
1867
+ color: M,
1868
+ backgroundColor: M,
1869
+ outlineColor: M,
1870
+ fill: M,
1871
+ stroke: M,
1872
+ // Border props
1873
+ borderColor: M,
1874
+ borderTopColor: M,
1875
+ borderRightColor: M,
1876
+ borderBottomColor: M,
1877
+ borderLeftColor: M,
1878
+ filter: ke,
1879
+ WebkitFilter: ke
1880
+ }, Cs = (t) => Ra[t];
1881
+ function Es(t, e) {
1882
+ let n = Cs(t);
1883
+ return n !== ke && (n = Q), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
1884
+ }
1885
+ const La = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1886
+ function ka(t, e, n) {
1887
+ let i = 0, s;
1888
+ for (; i < t.length && !s; ) {
1889
+ const o = t[i];
1890
+ typeof o == "string" && !La.has(o) && Et(o).values.length && (s = t[i]), i++;
1891
+ }
1892
+ if (s && n)
1893
+ for (const o of e)
1894
+ t[o] = Es(n, s);
1895
+ }
1896
+ class Fa extends rn {
1897
+ constructor(e, n, i, s, o) {
1898
+ super(e, n, i, s, o, !0);
1899
+ }
1900
+ readKeyframes() {
1901
+ const { unresolvedKeyframes: e, element: n, name: i } = this;
1902
+ if (!n || !n.current)
1903
+ return;
1904
+ super.readKeyframes();
1905
+ for (let u = 0; u < e.length; u++) {
1906
+ let h = e[u];
1907
+ if (typeof h == "string" && (h = h.trim(), qe(h))) {
1908
+ const f = Ps(h, n.current);
1909
+ f !== void 0 && (e[u] = f), u === e.length - 1 && (this.finalKeyframe = h);
1910
+ }
1911
+ }
1912
+ if (this.resolveNoneKeyframes(), !ws.has(i) || e.length !== 2)
1913
+ return;
1914
+ const [s, o] = e, r = Nn(s), a = Nn(o), l = Vn(s), c = Vn(o);
1915
+ if (l !== c && Z[i]) {
1916
+ this.needsMeasurement = !0;
1917
+ return;
1918
+ }
1919
+ if (r !== a)
1920
+ if (Fn(r) && Fn(a))
1921
+ for (let u = 0; u < e.length; u++) {
1922
+ const h = e[u];
1923
+ typeof h == "string" && (e[u] = parseFloat(h));
1924
+ }
1925
+ else Z[i] && (this.needsMeasurement = !0);
1926
+ }
1927
+ resolveNoneKeyframes() {
1928
+ const { unresolvedKeyframes: e, name: n } = this, i = [];
1929
+ for (let s = 0; s < e.length; s++)
1930
+ (e[s] === null || Aa(e[s])) && i.push(s);
1931
+ i.length && ka(e, i, n);
1932
+ }
1933
+ measureInitialState() {
1934
+ const { element: e, unresolvedKeyframes: n, name: i } = this;
1935
+ if (!e || !e.current)
1936
+ return;
1937
+ i === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = Z[i](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
1938
+ const s = n[n.length - 1];
1939
+ s !== void 0 && e.getValue(i, s).jump(s, !1);
1940
+ }
1941
+ measureEndState() {
1942
+ const { element: e, name: n, unresolvedKeyframes: i } = this;
1943
+ if (!e || !e.current)
1944
+ return;
1945
+ const s = e.getValue(n);
1946
+ s && s.jump(this.measuredOrigin, !1);
1947
+ const o = i.length - 1, r = i[o];
1948
+ i[o] = Z[n](e.measureViewportBox(), window.getComputedStyle(e.current)), r !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = r), this.removedTransforms?.length && this.removedTransforms.forEach(([a, l]) => {
1949
+ e.getValue(a).set(l);
1950
+ }), this.resolveNoneKeyframes();
1951
+ }
1952
+ }
1953
+ function Ia(t, e, n) {
1954
+ if (t instanceof EventTarget)
1955
+ return [t];
1956
+ if (typeof t == "string") {
1957
+ let i = document;
1958
+ const s = n?.[t] ?? i.querySelectorAll(t);
1959
+ return s ? Array.from(s) : [];
1960
+ }
1961
+ return Array.from(t);
1962
+ }
1963
+ const Rs = (t, e) => e && typeof t == "number" ? e.transform(t) : t;
1964
+ function Ba(t) {
1965
+ return $i(t) && "offsetHeight" in t;
1966
+ }
1967
+ const { schedule: hn } = /* @__PURE__ */ ns(queueMicrotask, !1), G = {
1968
+ x: !1,
1969
+ y: !1
1970
+ };
1971
+ function Ls() {
1972
+ return G.x || G.y;
1973
+ }
1974
+ function Oa(t) {
1975
+ return t === "x" || t === "y" ? G[t] ? null : (G[t] = !0, () => {
1976
+ G[t] = !1;
1977
+ }) : G.x || G.y ? null : (G.x = G.y = !0, () => {
1978
+ G.x = G.y = !1;
1979
+ });
1980
+ }
1981
+ function ks(t, e) {
1982
+ const n = Ia(t), i = new AbortController(), s = {
1983
+ passive: !0,
1984
+ ...e,
1985
+ signal: i.signal
1986
+ };
1987
+ return [n, s, () => i.abort()];
1988
+ }
1989
+ function Wn(t) {
1990
+ return !(t.pointerType === "touch" || Ls());
1991
+ }
1992
+ function ja(t, e, n = {}) {
1993
+ const [i, s, o] = ks(t, n), r = (a) => {
1994
+ if (!Wn(a))
1995
+ return;
1996
+ const { target: l } = a, c = e(l, a);
1997
+ if (typeof c != "function" || !l)
1998
+ return;
1999
+ const u = (h) => {
2000
+ Wn(h) && (c(h), l.removeEventListener("pointerleave", u));
2001
+ };
2002
+ l.addEventListener("pointerleave", u, s);
2003
+ };
2004
+ return i.forEach((a) => {
2005
+ a.addEventListener("pointerenter", r, s);
2006
+ }), o;
2007
+ }
2008
+ const Fs = (t, e) => e ? t === e ? !0 : Fs(t, e.parentElement) : !1, fn = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Na = /* @__PURE__ */ new Set([
2009
+ "BUTTON",
2010
+ "INPUT",
2011
+ "SELECT",
2012
+ "TEXTAREA",
2013
+ "A"
2014
+ ]);
2015
+ function Is(t) {
2016
+ return Na.has(t.tagName) || t.isContentEditable === !0;
2017
+ }
2018
+ const Wt = /* @__PURE__ */ new WeakSet();
2019
+ function Kn(t) {
2020
+ return (e) => {
2021
+ e.key === "Enter" && t(e);
2022
+ };
2023
+ }
2024
+ function ae(t, e) {
2025
+ t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
2026
+ }
2027
+ const Ua = (t, e) => {
2028
+ const n = t.currentTarget;
2029
+ if (!n)
2030
+ return;
2031
+ const i = Kn(() => {
2032
+ if (Wt.has(n))
2033
+ return;
2034
+ ae(n, "down");
2035
+ const s = Kn(() => {
2036
+ ae(n, "up");
2037
+ }), o = () => ae(n, "cancel");
2038
+ n.addEventListener("keyup", s, e), n.addEventListener("blur", o, e);
2039
+ });
2040
+ n.addEventListener("keydown", i, e), n.addEventListener("blur", () => n.removeEventListener("keydown", i), e);
2041
+ };
2042
+ function $n(t) {
2043
+ return fn(t) && !Ls();
2044
+ }
2045
+ function Wa(t, e, n = {}) {
2046
+ const [i, s, o] = ks(t, n), r = (a) => {
2047
+ const l = a.currentTarget;
2048
+ if (!$n(a))
2049
+ return;
2050
+ Wt.add(l);
2051
+ const c = e(l, a), u = (d, m) => {
2052
+ window.removeEventListener("pointerup", h), window.removeEventListener("pointercancel", f), Wt.has(l) && Wt.delete(l), $n(d) && typeof c == "function" && c(d, { success: m });
2053
+ }, h = (d) => {
2054
+ u(d, l === window || l === document || n.useGlobalTarget || Fs(l, d.target));
2055
+ }, f = (d) => {
2056
+ u(d, !1);
2057
+ };
2058
+ window.addEventListener("pointerup", h, s), window.addEventListener("pointercancel", f, s);
2059
+ };
2060
+ return i.forEach((a) => {
2061
+ (n.useGlobalTarget ? window : a).addEventListener("pointerdown", r, s), Ba(a) && (a.addEventListener("focus", (c) => Ua(c, s)), !Is(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
2062
+ }), o;
2063
+ }
2064
+ function Bs(t) {
2065
+ return $i(t) && "ownerSVGElement" in t;
2066
+ }
2067
+ function Ka(t) {
2068
+ return Bs(t) && t.tagName === "svg";
2069
+ }
2070
+ const $a = [...Ms, M, Q], Ga = (t) => $a.find(Ds(t)), Gn = () => ({
2071
+ translate: 0,
2072
+ scale: 1,
2073
+ origin: 0,
2074
+ originPoint: 0
2075
+ }), ht = () => ({
2076
+ x: Gn(),
2077
+ y: Gn()
2078
+ }), _n = () => ({ min: 0, max: 0 }), E = () => ({
2079
+ x: _n(),
2080
+ y: _n()
2081
+ }), Fe = { current: null }, Os = { current: !1 }, _a = typeof window < "u";
2082
+ function Ha() {
2083
+ if (Os.current = !0, !!_a)
2084
+ if (window.matchMedia) {
2085
+ const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Fe.current = t.matches;
2086
+ t.addEventListener("change", e), e();
2087
+ } else
2088
+ Fe.current = !1;
2089
+ }
2090
+ const za = /* @__PURE__ */ new WeakMap();
2091
+ function Jt(t) {
2092
+ return t !== null && typeof t == "object" && typeof t.start == "function";
2093
+ }
2094
+ function Rt(t) {
2095
+ return typeof t == "string" || Array.isArray(t);
2096
+ }
2097
+ const dn = [
2098
+ "animate",
2099
+ "whileInView",
2100
+ "whileFocus",
2101
+ "whileHover",
2102
+ "whileTap",
2103
+ "whileDrag",
2104
+ "exit"
2105
+ ], mn = ["initial", ...dn];
2106
+ function Qt(t) {
2107
+ return Jt(t.animate) || mn.some((e) => Rt(t[e]));
2108
+ }
2109
+ function js(t) {
2110
+ return !!(Qt(t) || t.variants);
2111
+ }
2112
+ function Ya(t, e, n) {
2113
+ for (const i in e) {
2114
+ const s = e[i], o = n[i];
2115
+ if (k(s))
2116
+ t.addValue(i, s);
2117
+ else if (k(o))
2118
+ t.addValue(i, gt(s, { owner: t }));
2119
+ else if (o !== s)
2120
+ if (t.hasValue(i)) {
2121
+ const r = t.getValue(i);
2122
+ r.liveStyle === !0 ? r.jump(s) : r.hasAnimated || r.set(s);
2123
+ } else {
2124
+ const r = t.getStaticValue(i);
2125
+ t.addValue(i, gt(r !== void 0 ? r : s, { owner: t }));
2126
+ }
2127
+ }
2128
+ for (const i in n)
2129
+ e[i] === void 0 && t.removeValue(i);
2130
+ return e;
2131
+ }
2132
+ const Hn = [
2133
+ "AnimationStart",
2134
+ "AnimationComplete",
2135
+ "Update",
2136
+ "BeforeLayoutMeasure",
2137
+ "LayoutMeasure",
2138
+ "LayoutAnimationStart",
2139
+ "LayoutAnimationComplete"
2140
+ ];
2141
+ let zt = {};
2142
+ function Ns(t) {
2143
+ zt = t;
2144
+ }
2145
+ function Xa() {
2146
+ return zt;
2147
+ }
2148
+ class qa {
2149
+ /**
2150
+ * This method takes React props and returns found MotionValues. For example, HTML
2151
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2152
+ *
2153
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2154
+ * intended to be one.
2155
+ */
2156
+ scrapeMotionValuesFromProps(e, n, i) {
2157
+ return {};
2158
+ }
2159
+ constructor({ parent: e, props: n, presenceContext: i, reducedMotionConfig: s, blockInitialAnimation: o, visualState: r }, a = {}) {
2160
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = rn, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2161
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2162
+ }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2163
+ const f = F.now();
2164
+ this.renderScheduledAt < f && (this.renderScheduledAt = f, V.render(this.render, !1, !0));
2165
+ };
2166
+ const { latestValues: l, renderState: c } = r;
2167
+ this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = c, this.parent = e, this.props = n, this.presenceContext = i, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = s, this.options = a, this.blockInitialAnimation = !!o, this.isControllingVariants = Qt(n), this.isVariantNode = js(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
2168
+ const { willChange: u, ...h } = this.scrapeMotionValuesFromProps(n, {}, this);
2169
+ for (const f in h) {
2170
+ const d = h[f];
2171
+ l[f] !== void 0 && k(d) && d.set(l[f]);
2172
+ }
2173
+ }
2174
+ mount(e) {
2175
+ this.current = e, za.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, i) => this.bindToMotionValue(i, n)), this.reducedMotionConfig === "never" ? this.shouldReduceMotion = !1 : this.reducedMotionConfig === "always" ? this.shouldReduceMotion = !0 : (Os.current || Ha(), this.shouldReduceMotion = Fe.current), process.env.NODE_ENV !== "production" && ze(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), this.parent?.addChild(this), this.update(this.props, this.presenceContext);
2176
+ }
2177
+ unmount() {
2178
+ this.projection && this.projection.unmount(), J(this.notifyUpdate), J(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this);
2179
+ for (const e in this.events)
2180
+ this.events[e].clear();
2181
+ for (const e in this.features) {
2182
+ const n = this.features[e];
2183
+ n && (n.unmount(), n.isMounted = !1);
2184
+ }
2185
+ this.current = null;
2186
+ }
2187
+ addChild(e) {
2188
+ this.children.add(e), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(e);
2189
+ }
2190
+ removeChild(e) {
2191
+ this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
2192
+ }
2193
+ bindToMotionValue(e, n) {
2194
+ this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
2195
+ const i = Pt.has(e);
2196
+ i && this.onBindTransform && this.onBindTransform();
2197
+ const s = n.on("change", (r) => {
2198
+ this.latestValues[e] = r, this.props.onUpdate && V.preRender(this.notifyUpdate), i && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
2199
+ });
2200
+ let o;
2201
+ typeof window < "u" && window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
2202
+ s(), o && o(), n.owner && n.stop();
2203
+ });
2204
+ }
2205
+ sortNodePosition(e) {
2206
+ return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
2207
+ }
2208
+ updateFeatures() {
2209
+ let e = "animation";
2210
+ for (e in zt) {
2211
+ const n = zt[e];
2212
+ if (!n)
2213
+ continue;
2214
+ const { isEnabled: i, Feature: s } = n;
2215
+ if (!this.features[e] && s && i(this.props) && (this.features[e] = new s(this)), this.features[e]) {
2216
+ const o = this.features[e];
2217
+ o.isMounted ? o.update() : (o.mount(), o.isMounted = !0);
2218
+ }
2219
+ }
2220
+ }
2221
+ triggerBuild() {
2222
+ this.build(this.renderState, this.latestValues, this.props);
2223
+ }
2224
+ /**
2225
+ * Measure the current viewport box with or without transforms.
2226
+ * Only measures axis-aligned boxes, rotate and skew must be manually
2227
+ * removed with a re-render to work.
2228
+ */
2229
+ measureViewportBox() {
2230
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : E();
2231
+ }
2232
+ getStaticValue(e) {
2233
+ return this.latestValues[e];
2234
+ }
2235
+ setStaticValue(e, n) {
2236
+ this.latestValues[e] = n;
2237
+ }
2238
+ /**
2239
+ * Update the provided props. Ensure any newly-added motion values are
2240
+ * added to our map, old ones removed, and listeners updated.
2241
+ */
2242
+ update(e, n) {
2243
+ (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
2244
+ for (let i = 0; i < Hn.length; i++) {
2245
+ const s = Hn[i];
2246
+ this.propEventSubscriptions[s] && (this.propEventSubscriptions[s](), delete this.propEventSubscriptions[s]);
2247
+ const o = "on" + s, r = e[o];
2248
+ r && (this.propEventSubscriptions[s] = this.on(s, r));
2249
+ }
2250
+ this.prevMotionValues = Ya(this, this.scrapeMotionValuesFromProps(e, this.prevProps || {}, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
2251
+ }
2252
+ getProps() {
2253
+ return this.props;
2254
+ }
2255
+ /**
2256
+ * Returns the variant definition with a given name.
2257
+ */
2258
+ getVariant(e) {
2259
+ return this.props.variants ? this.props.variants[e] : void 0;
2260
+ }
2261
+ /**
2262
+ * Returns the defined default transition on this component.
2263
+ */
2264
+ getDefaultTransition() {
2265
+ return this.props.transition;
2266
+ }
2267
+ getTransformPagePoint() {
2268
+ return this.props.transformPagePoint;
2269
+ }
2270
+ getClosestVariantNode() {
2271
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
2272
+ }
2273
+ /**
2274
+ * Add a child visual element to our set of children.
2275
+ */
2276
+ addVariantChild(e) {
2277
+ const n = this.getClosestVariantNode();
2278
+ if (n)
2279
+ return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
2280
+ }
2281
+ /**
2282
+ * Add a motion value and bind it to this visual element.
2283
+ */
2284
+ addValue(e, n) {
2285
+ const i = this.values.get(e);
2286
+ n !== i && (i && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
2287
+ }
2288
+ /**
2289
+ * Remove a motion value and unbind any active subscriptions.
2290
+ */
2291
+ removeValue(e) {
2292
+ this.values.delete(e);
2293
+ const n = this.valueSubscriptions.get(e);
2294
+ n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
2295
+ }
2296
+ /**
2297
+ * Check whether we have a motion value for this key
2298
+ */
2299
+ hasValue(e) {
2300
+ return this.values.has(e);
2301
+ }
2302
+ getValue(e, n) {
2303
+ if (this.props.values && this.props.values[e])
2304
+ return this.props.values[e];
2305
+ let i = this.values.get(e);
2306
+ return i === void 0 && n !== void 0 && (i = gt(n === null ? void 0 : n, { owner: this }), this.addValue(e, i)), i;
2307
+ }
2308
+ /**
2309
+ * If we're trying to animate to a previously unencountered value,
2310
+ * we need to check for it in our state and as a last resort read it
2311
+ * directly from the instance (which might have performance implications).
2312
+ */
2313
+ readValue(e, n) {
2314
+ let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
2315
+ return i != null && (typeof i == "string" && (Ki(i) || Gi(i)) ? i = parseFloat(i) : !Ga(i) && Q.test(n) && (i = Es(e, n)), this.setBaseTarget(e, k(i) ? i.get() : i)), k(i) ? i.get() : i;
2316
+ }
2317
+ /**
2318
+ * Set the base target to later animate back to. This is currently
2319
+ * only hydrated on creation and when we first read a value.
2320
+ */
2321
+ setBaseTarget(e, n) {
2322
+ this.baseTarget[e] = n;
2323
+ }
2324
+ /**
2325
+ * Find the base target for a value thats been removed from all animation
2326
+ * props.
2327
+ */
2328
+ getBaseTarget(e) {
2329
+ const { initial: n } = this.props;
2330
+ let i;
2331
+ if (typeof n == "string" || typeof n == "object") {
2332
+ const o = ln(this.props, n, this.presenceContext?.custom);
2333
+ o && (i = o[e]);
2334
+ }
2335
+ if (n && i !== void 0)
2336
+ return i;
2337
+ const s = this.getBaseTargetFromProps(this.props, e);
2338
+ return s !== void 0 && !k(s) ? s : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
2339
+ }
2340
+ on(e, n) {
2341
+ return this.events[e] || (this.events[e] = new He()), this.events[e].add(n);
2342
+ }
2343
+ notify(e, ...n) {
2344
+ this.events[e] && this.events[e].notify(...n);
2345
+ }
2346
+ scheduleRenderMicrotask() {
2347
+ hn.render(this.render);
2348
+ }
2349
+ }
2350
+ class tt {
2351
+ constructor(e) {
2352
+ this.isMounted = !1, this.node = e;
2353
+ }
2354
+ update() {
2355
+ }
2356
+ }
2357
+ class Us extends qa {
2358
+ constructor() {
2359
+ super(...arguments), this.KeyframeResolver = Fa;
2360
+ }
2361
+ sortInstanceNodePosition(e, n) {
2362
+ return e.compareDocumentPosition(n) & 2 ? 1 : -1;
2363
+ }
2364
+ getBaseTargetFromProps(e, n) {
2365
+ const i = e.style;
2366
+ return i ? i[n] : void 0;
2367
+ }
2368
+ removeValueFromRenderState(e, { vars: n, style: i }) {
2369
+ delete n[e], delete i[e];
2370
+ }
2371
+ handleChildMotionValue() {
2372
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
2373
+ const { children: e } = this.props;
2374
+ k(e) && (this.childSubscription = e.on("change", (n) => {
2375
+ this.current && (this.current.textContent = `${n}`);
2376
+ }));
2377
+ }
2378
+ }
2379
+ function Ws({ top: t, left: e, right: n, bottom: i }) {
2380
+ return {
2381
+ x: { min: e, max: n },
2382
+ y: { min: t, max: i }
2383
+ };
2384
+ }
2385
+ function Za({ x: t, y: e }) {
2386
+ return { top: e.min, right: t.max, bottom: e.max, left: t.min };
2387
+ }
2388
+ function Ja(t, e) {
2389
+ if (!e)
2390
+ return t;
2391
+ const n = e({ x: t.left, y: t.top }), i = e({ x: t.right, y: t.bottom });
2392
+ return {
2393
+ top: n.y,
2394
+ left: n.x,
2395
+ bottom: i.y,
2396
+ right: i.x
2397
+ };
2398
+ }
2399
+ function le(t) {
2400
+ return t === void 0 || t === 1;
2401
+ }
2402
+ function Ie({ scale: t, scaleX: e, scaleY: n }) {
2403
+ return !le(t) || !le(e) || !le(n);
2404
+ }
2405
+ function it(t) {
2406
+ return Ie(t) || Ks(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY;
2407
+ }
2408
+ function Ks(t) {
2409
+ return zn(t.x) || zn(t.y);
2410
+ }
2411
+ function zn(t) {
2412
+ return t && t !== "0%";
2413
+ }
2414
+ function Yt(t, e, n) {
2415
+ const i = t - n, s = e * i;
2416
+ return n + s;
2417
+ }
2418
+ function Yn(t, e, n, i, s) {
2419
+ return s !== void 0 && (t = Yt(t, s, i)), Yt(t, n, i) + e;
2420
+ }
2421
+ function Be(t, e = 0, n = 1, i, s) {
2422
+ t.min = Yn(t.min, e, n, i, s), t.max = Yn(t.max, e, n, i, s);
2423
+ }
2424
+ function $s(t, { x: e, y: n }) {
2425
+ Be(t.x, e.translate, e.scale, e.originPoint), Be(t.y, n.translate, n.scale, n.originPoint);
2426
+ }
2427
+ const Xn = 0.999999999999, qn = 1.0000000000001;
2428
+ function Qa(t, e, n, i = !1) {
2429
+ const s = n.length;
2430
+ if (!s)
2431
+ return;
2432
+ e.x = e.y = 1;
2433
+ let o, r;
2434
+ for (let a = 0; a < s; a++) {
2435
+ o = n[a], r = o.projectionDelta;
2436
+ const { visualElement: l } = o.options;
2437
+ l && l.props.style && l.props.style.display === "contents" || (i && o.options.layoutScroll && o.scroll && o !== o.root && dt(t, {
2438
+ x: -o.scroll.offset.x,
2439
+ y: -o.scroll.offset.y
2440
+ }), r && (e.x *= r.x.scale, e.y *= r.y.scale, $s(t, r)), i && it(o.latestValues) && dt(t, o.latestValues));
2441
+ }
2442
+ e.x < qn && e.x > Xn && (e.x = 1), e.y < qn && e.y > Xn && (e.y = 1);
2443
+ }
2444
+ function ft(t, e) {
2445
+ t.min = t.min + e, t.max = t.max + e;
2446
+ }
2447
+ function Zn(t, e, n, i, s = 0.5) {
2448
+ const o = D(t.min, t.max, s);
2449
+ Be(t, e, n, o, i);
2450
+ }
2451
+ function dt(t, e) {
2452
+ Zn(t.x, e.x, e.scaleX, e.scale, e.originX), Zn(t.y, e.y, e.scaleY, e.scale, e.originY);
2453
+ }
2454
+ function Gs(t, e) {
2455
+ return Ws(Ja(t.getBoundingClientRect(), e));
2456
+ }
2457
+ function tl(t, e, n) {
2458
+ const i = Gs(t, n), { scroll: s } = e;
2459
+ return s && (ft(i.x, s.offset.x), ft(i.y, s.offset.y)), i;
2460
+ }
2461
+ const el = {
2462
+ x: "translateX",
2463
+ y: "translateY",
2464
+ z: "translateZ",
2465
+ transformPerspective: "perspective"
2466
+ }, nl = xt.length;
2467
+ function il(t, e, n) {
2468
+ let i = "", s = !0;
2469
+ for (let o = 0; o < nl; o++) {
2470
+ const r = xt[o], a = t[r];
2471
+ if (a === void 0)
2472
+ continue;
2473
+ let l = !0;
2474
+ if (typeof a == "number" ? l = a === (r.startsWith("scale") ? 1 : 0) : l = parseFloat(a) === 0, !l || n) {
2475
+ const c = Rs(a, cn[r]);
2476
+ if (!l) {
2477
+ s = !1;
2478
+ const u = el[r] || r;
2479
+ i += `${u}(${c}) `;
2480
+ }
2481
+ n && (e[r] = c);
2482
+ }
2483
+ }
2484
+ return i = i.trim(), n ? i = n(e, s ? "" : i) : s && (i = "none"), i;
2485
+ }
2486
+ function pn(t, e, n) {
2487
+ const { style: i, vars: s, transformOrigin: o } = t;
2488
+ let r = !1, a = !1;
2489
+ for (const l in e) {
2490
+ const c = e[l];
2491
+ if (Pt.has(l)) {
2492
+ r = !0;
2493
+ continue;
2494
+ } else if (ss(l)) {
2495
+ s[l] = c;
2496
+ continue;
2497
+ } else {
2498
+ const u = Rs(c, cn[l]);
2499
+ l.startsWith("origin") ? (a = !0, o[l] = u) : i[l] = u;
2500
+ }
2501
+ }
2502
+ if (e.transform || (r || n ? i.transform = il(e, t.transform, n) : i.transform && (i.transform = "none")), a) {
2503
+ const { originX: l = "50%", originY: c = "50%", originZ: u = 0 } = o;
2504
+ i.transformOrigin = `${l} ${c} ${u}`;
2505
+ }
2506
+ }
2507
+ function _s(t, { style: e, vars: n }, i, s) {
2508
+ const o = t.style;
2509
+ let r;
2510
+ for (r in e)
2511
+ o[r] = e[r];
2512
+ s?.applyProjectionStyles(o, i);
2513
+ for (r in n)
2514
+ o.setProperty(r, n[r]);
2515
+ }
2516
+ function Jn(t, e) {
2517
+ return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
2518
+ }
2519
+ const St = {
2520
+ correct: (t, e) => {
2521
+ if (!e.target)
2522
+ return t;
2523
+ if (typeof t == "string")
2524
+ if (p.test(t))
2525
+ t = parseFloat(t);
2526
+ else
2527
+ return t;
2528
+ const n = Jn(t, e.target.x), i = Jn(t, e.target.y);
2529
+ return `${n}% ${i}%`;
2530
+ }
2531
+ }, sl = {
2532
+ correct: (t, { treeScale: e, projectionDelta: n }) => {
2533
+ const i = t, s = Q.parse(t);
2534
+ if (s.length > 5)
2535
+ return i;
2536
+ const o = Q.createTransformer(t), r = typeof s[0] != "number" ? 1 : 0, a = n.x.scale * e.x, l = n.y.scale * e.y;
2537
+ s[0 + r] /= a, s[1 + r] /= l;
2538
+ const c = D(a, l, 0.5);
2539
+ return typeof s[2 + r] == "number" && (s[2 + r] /= c), typeof s[3 + r] == "number" && (s[3 + r] /= c), o(s);
2540
+ }
2541
+ }, Oe = {
2542
+ borderRadius: {
2543
+ ...St,
2544
+ applyTo: [
2545
+ "borderTopLeftRadius",
2546
+ "borderTopRightRadius",
2547
+ "borderBottomLeftRadius",
2548
+ "borderBottomRightRadius"
2549
+ ]
2550
+ },
2551
+ borderTopLeftRadius: St,
2552
+ borderTopRightRadius: St,
2553
+ borderBottomLeftRadius: St,
2554
+ borderBottomRightRadius: St,
2555
+ boxShadow: sl
2556
+ };
2557
+ function Hs(t, { layout: e, layoutId: n }) {
2558
+ return Pt.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!Oe[t] || t === "opacity");
2559
+ }
2560
+ function gn(t, e, n) {
2561
+ const i = t.style, s = e?.style, o = {};
2562
+ if (!i)
2563
+ return o;
2564
+ for (const r in i)
2565
+ (k(i[r]) || s && k(s[r]) || Hs(r, t) || n?.getValue(r)?.liveStyle !== void 0) && (o[r] = i[r]);
2566
+ return o;
2567
+ }
2568
+ function rl(t) {
2569
+ return window.getComputedStyle(t);
2570
+ }
2571
+ class ol extends Us {
2572
+ constructor() {
2573
+ super(...arguments), this.type = "html", this.renderInstance = _s;
2574
+ }
2575
+ readValueFromInstance(e, n) {
2576
+ if (Pt.has(n))
2577
+ return this.projection?.isProjecting ? be(n) : Fo(e, n);
2578
+ {
2579
+ const i = rl(e), s = (ss(n) ? i.getPropertyValue(n) : i[n]) || 0;
2580
+ return typeof s == "string" ? s.trim() : s;
2581
+ }
2582
+ }
2583
+ measureInstanceViewportBox(e, { transformPagePoint: n }) {
2584
+ return Gs(e, n);
2585
+ }
2586
+ build(e, n, i) {
2587
+ pn(e, n, i.transformTemplate);
2588
+ }
2589
+ scrapeMotionValuesFromProps(e, n, i) {
2590
+ return gn(e, n, i);
2591
+ }
2592
+ }
2593
+ const al = {
2594
+ offset: "stroke-dashoffset",
2595
+ array: "stroke-dasharray"
2596
+ }, ll = {
2597
+ offset: "strokeDashoffset",
2598
+ array: "strokeDasharray"
2599
+ };
2600
+ function ul(t, e, n = 1, i = 0, s = !0) {
2601
+ t.pathLength = 1;
2602
+ const o = s ? al : ll;
2603
+ t[o.offset] = p.transform(-i);
2604
+ const r = p.transform(e), a = p.transform(n);
2605
+ t[o.array] = `${r} ${a}`;
2606
+ }
2607
+ const cl = [
2608
+ "offsetDistance",
2609
+ "offsetPath",
2610
+ "offsetRotate",
2611
+ "offsetAnchor"
2612
+ ];
2613
+ function zs(t, {
2614
+ attrX: e,
2615
+ attrY: n,
2616
+ attrScale: i,
2617
+ pathLength: s,
2618
+ pathSpacing: o = 1,
2619
+ pathOffset: r = 0,
2620
+ // This is object creation, which we try to avoid per-frame.
2621
+ ...a
2622
+ }, l, c, u) {
2623
+ if (pn(t, a, c), l) {
2624
+ t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
2625
+ return;
2626
+ }
2627
+ t.attrs = t.style, t.style = {};
2628
+ const { attrs: h, style: f } = t;
2629
+ h.transform && (f.transform = h.transform, delete h.transform), (f.transform || h.transformOrigin) && (f.transformOrigin = h.transformOrigin ?? "50% 50%", delete h.transformOrigin), f.transform && (f.transformBox = u?.transformBox ?? "fill-box", delete h.transformBox);
2630
+ for (const d of cl)
2631
+ h[d] !== void 0 && (f[d] = h[d], delete h[d]);
2632
+ e !== void 0 && (h.x = e), n !== void 0 && (h.y = n), i !== void 0 && (h.scale = i), s !== void 0 && ul(h, s, o, r, !1);
2633
+ }
2634
+ const Ys = /* @__PURE__ */ new Set([
2635
+ "baseFrequency",
2636
+ "diffuseConstant",
2637
+ "kernelMatrix",
2638
+ "kernelUnitLength",
2639
+ "keySplines",
2640
+ "keyTimes",
2641
+ "limitingConeAngle",
2642
+ "markerHeight",
2643
+ "markerWidth",
2644
+ "numOctaves",
2645
+ "targetX",
2646
+ "targetY",
2647
+ "surfaceScale",
2648
+ "specularConstant",
2649
+ "specularExponent",
2650
+ "stdDeviation",
2651
+ "tableValues",
2652
+ "viewBox",
2653
+ "gradientTransform",
2654
+ "pathLength",
2655
+ "startOffset",
2656
+ "textLength",
2657
+ "lengthAdjust"
2658
+ ]), Xs = (t) => typeof t == "string" && t.toLowerCase() === "svg";
2659
+ function hl(t, e, n, i) {
2660
+ _s(t, e, void 0, i);
2661
+ for (const s in e.attrs)
2662
+ t.setAttribute(Ys.has(s) ? s : un(s), e.attrs[s]);
2663
+ }
2664
+ function qs(t, e, n) {
2665
+ const i = gn(t, e, n);
2666
+ for (const s in t)
2667
+ if (k(t[s]) || k(e[s])) {
2668
+ const o = xt.indexOf(s) !== -1 ? "attr" + s.charAt(0).toUpperCase() + s.substring(1) : s;
2669
+ i[o] = t[s];
2670
+ }
2671
+ return i;
2672
+ }
2673
+ class fl extends Us {
2674
+ constructor() {
2675
+ super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = E;
2676
+ }
2677
+ getBaseTargetFromProps(e, n) {
2678
+ return e[n];
2679
+ }
2680
+ readValueFromInstance(e, n) {
2681
+ if (Pt.has(n)) {
2682
+ const i = Cs(n);
2683
+ return i && i.default || 0;
2684
+ }
2685
+ return n = Ys.has(n) ? n : un(n), e.getAttribute(n);
2686
+ }
2687
+ scrapeMotionValuesFromProps(e, n, i) {
2688
+ return qs(e, n, i);
2689
+ }
2690
+ build(e, n, i) {
2691
+ zs(e, n, this.isSVGTag, i.transformTemplate, i.style);
2692
+ }
2693
+ renderInstance(e, n, i, s) {
2694
+ hl(e, n, i, s);
2695
+ }
2696
+ mount(e) {
2697
+ this.isSVGTag = Xs(e.tagName), super.mount(e);
2698
+ }
2699
+ }
2700
+ const dl = mn.length;
2701
+ function Zs(t) {
2702
+ if (!t)
2703
+ return;
2704
+ if (!t.isControllingVariants) {
2705
+ const n = t.parent ? Zs(t.parent) || {} : {};
2706
+ return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
2707
+ }
2708
+ const e = {};
2709
+ for (let n = 0; n < dl; n++) {
2710
+ const i = mn[n], s = t.props[i];
2711
+ (Rt(s) || s === !1) && (e[i] = s);
2712
+ }
2713
+ return e;
2714
+ }
2715
+ function Js(t, e) {
2716
+ if (!Array.isArray(e))
2717
+ return !1;
2718
+ const n = e.length;
2719
+ if (n !== t.length)
2720
+ return !1;
2721
+ for (let i = 0; i < n; i++)
2722
+ if (e[i] !== t[i])
2723
+ return !1;
2724
+ return !0;
2725
+ }
2726
+ const ml = [...dn].reverse(), pl = dn.length;
2727
+ function gl(t) {
2728
+ return (e) => Promise.all(e.map(({ animation: n, options: i }) => ba(t, n, i)));
2729
+ }
2730
+ function yl(t) {
2731
+ let e = gl(t), n = Qn(), i = !0;
2732
+ const s = (l) => (c, u) => {
2733
+ const h = pt(t, u, l === "exit" ? t.presenceContext?.custom : void 0);
2734
+ if (h) {
2735
+ const { transition: f, transitionEnd: d, ...m } = h;
2736
+ c = { ...c, ...m, ...d };
2737
+ }
2738
+ return c;
2739
+ };
2740
+ function o(l) {
2741
+ e = l(t);
2742
+ }
2743
+ function r(l) {
2744
+ const { props: c } = t, u = Zs(t.parent) || {}, h = [], f = /* @__PURE__ */ new Set();
2745
+ let d = {}, m = 1 / 0;
2746
+ for (let T = 0; T < pl; T++) {
2747
+ const g = ml[T], x = n[g], y = c[g] !== void 0 ? c[g] : u[g], w = Rt(y), P = g === l ? x.isActive : null;
2748
+ P === !1 && (m = T);
2749
+ let b = y === u[g] && y !== c[g] && w;
2750
+ if (b && i && t.manuallyAnimateOnMount && (b = !1), x.protectedKeys = { ...d }, // If it isn't active and hasn't *just* been set as inactive
2751
+ !x.isActive && P === null || // If we didn't and don't have any defined prop for this animation type
2752
+ !y && !x.prevProp || // Or if the prop doesn't define an animation
2753
+ Jt(y) || typeof y == "boolean")
2754
+ continue;
2755
+ const C = vl(x.prevProp, y);
2756
+ let S = C || // If we're making this variant active, we want to always make it active
2757
+ g === l && x.isActive && !b && w || // If we removed a higher-priority variant (i is in reverse order)
2758
+ T > m && w, B = !1;
2759
+ const j = Array.isArray(y) ? y : [y];
2760
+ let at = j.reduce(s(g), {});
2761
+ P === !1 && (at = {});
2762
+ const { prevResolvedValues: Tn = {} } = x, Sr = {
2763
+ ...Tn,
2764
+ ...at
2765
+ }, xn = (R) => {
2766
+ S = !0, f.has(R) && (B = !0, f.delete(R)), x.needsAnimating[R] = !0;
2767
+ const N = t.getValue(R);
2768
+ N && (N.liveStyle = !1);
2769
+ };
2770
+ for (const R in Sr) {
2771
+ const N = at[R], et = Tn[R];
2772
+ if (d.hasOwnProperty(R))
2773
+ continue;
2774
+ let lt = !1;
2775
+ Ee(N) && Ee(et) ? lt = !Js(N, et) : lt = N !== et, lt ? N != null ? xn(R) : f.add(R) : N !== void 0 && f.has(R) ? xn(R) : x.protectedKeys[R] = !0;
2776
+ }
2777
+ x.prevProp = y, x.prevResolvedValues = at, x.isActive && (d = { ...d, ...at }), i && t.blockInitialAnimation && (S = !1);
2778
+ const Pn = b && C;
2779
+ S && (!Pn || B) && h.push(...j.map((R) => {
2780
+ const N = { type: g };
2781
+ if (typeof R == "string" && i && !Pn && t.manuallyAnimateOnMount && t.parent) {
2782
+ const { parent: et } = t, lt = pt(et, R);
2783
+ if (et.enteringChildren && lt) {
2784
+ const { delayChildren: wr } = lt.transition || {};
2785
+ N.delay = Ss(et.enteringChildren, t, wr);
2786
+ }
2787
+ }
2788
+ return {
2789
+ animation: R,
2790
+ options: N
2791
+ };
2792
+ }));
2793
+ }
2794
+ if (f.size) {
2795
+ const T = {};
2796
+ if (typeof c.initial != "boolean") {
2797
+ const g = pt(t, Array.isArray(c.initial) ? c.initial[0] : c.initial);
2798
+ g && g.transition && (T.transition = g.transition);
2799
+ }
2800
+ f.forEach((g) => {
2801
+ const x = t.getBaseTarget(g), y = t.getValue(g);
2802
+ y && (y.liveStyle = !0), T[g] = x ?? null;
2803
+ }), h.push({ animation: T });
2804
+ }
2805
+ let v = !!h.length;
2806
+ return i && (c.initial === !1 || c.initial === c.animate) && !t.manuallyAnimateOnMount && (v = !1), i = !1, v ? e(h) : Promise.resolve();
2807
+ }
2808
+ function a(l, c) {
2809
+ if (n[l].isActive === c)
2810
+ return Promise.resolve();
2811
+ t.variantChildren?.forEach((h) => h.animationState?.setActive(l, c)), n[l].isActive = c;
2812
+ const u = r(l);
2813
+ for (const h in n)
2814
+ n[h].protectedKeys = {};
2815
+ return u;
2816
+ }
2817
+ return {
2818
+ animateChanges: r,
2819
+ setActive: a,
2820
+ setAnimateFunction: o,
2821
+ getState: () => n,
2822
+ reset: () => {
2823
+ n = Qn();
2824
+ }
2825
+ };
2826
+ }
2827
+ function vl(t, e) {
2828
+ return typeof e == "string" ? e !== t : Array.isArray(e) ? !Js(e, t) : !1;
2829
+ }
2830
+ function nt(t = !1) {
2831
+ return {
2832
+ isActive: t,
2833
+ protectedKeys: {},
2834
+ needsAnimating: {},
2835
+ prevResolvedValues: {}
2836
+ };
2837
+ }
2838
+ function Qn() {
2839
+ return {
2840
+ animate: nt(!0),
2841
+ whileInView: nt(),
2842
+ whileHover: nt(),
2843
+ whileTap: nt(),
2844
+ whileDrag: nt(),
2845
+ whileFocus: nt(),
2846
+ exit: nt()
2847
+ };
2848
+ }
2849
+ const Qs = 1e-4, Tl = 1 - Qs, xl = 1 + Qs, tr = 0.01, Pl = 0 - tr, Sl = 0 + tr;
2850
+ function I(t) {
2851
+ return t.max - t.min;
2852
+ }
2853
+ function wl(t, e, n) {
2854
+ return Math.abs(t - e) <= n;
2855
+ }
2856
+ function ti(t, e, n, i = 0.5) {
2857
+ t.origin = i, t.originPoint = D(e.min, e.max, t.origin), t.scale = I(n) / I(e), t.translate = D(n.min, n.max, t.origin) - t.originPoint, (t.scale >= Tl && t.scale <= xl || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Pl && t.translate <= Sl || isNaN(t.translate)) && (t.translate = 0);
2858
+ }
2859
+ function At(t, e, n, i) {
2860
+ ti(t.x, e.x, n.x, i ? i.originX : void 0), ti(t.y, e.y, n.y, i ? i.originY : void 0);
2861
+ }
2862
+ function ei(t, e, n) {
2863
+ t.min = n.min + e.min, t.max = t.min + I(e);
2864
+ }
2865
+ function bl(t, e, n) {
2866
+ ei(t.x, e.x, n.x), ei(t.y, e.y, n.y);
2867
+ }
2868
+ function ni(t, e, n) {
2869
+ t.min = e.min - n.min, t.max = t.min + I(e);
2870
+ }
2871
+ function Xt(t, e, n) {
2872
+ ni(t.x, e.x, n.x), ni(t.y, e.y, n.y);
2873
+ }
2874
+ function ii(t, e, n, i, s) {
2875
+ return t -= e, t = Yt(t, 1 / n, i), s !== void 0 && (t = Yt(t, 1 / s, i)), t;
2876
+ }
2877
+ function Vl(t, e = 0, n = 1, i = 0.5, s, o = t, r = t) {
2878
+ if (H.test(e) && (e = parseFloat(e), e = D(r.min, r.max, e / 100) - r.min), typeof e != "number")
2879
+ return;
2880
+ let a = D(o.min, o.max, i);
2881
+ t === o && (a -= e), t.min = ii(t.min, e, n, a, s), t.max = ii(t.max, e, n, a, s);
2882
+ }
2883
+ function si(t, e, [n, i, s], o, r) {
2884
+ Vl(t, e[n], e[i], e[s], e.scale, o, r);
2885
+ }
2886
+ const Al = ["x", "scaleX", "originX"], Dl = ["y", "scaleY", "originY"];
2887
+ function ri(t, e, n, i) {
2888
+ si(t.x, e, Al, n ? n.x : void 0, i ? i.x : void 0), si(t.y, e, Dl, n ? n.y : void 0, i ? i.y : void 0);
2889
+ }
2890
+ function oi(t, e) {
2891
+ t.min = e.min, t.max = e.max;
2892
+ }
2893
+ function $(t, e) {
2894
+ oi(t.x, e.x), oi(t.y, e.y);
2895
+ }
2896
+ function ai(t, e) {
2897
+ t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
2898
+ }
2899
+ function li(t) {
2900
+ return t.translate === 0 && t.scale === 1;
2901
+ }
2902
+ function er(t) {
2903
+ return li(t.x) && li(t.y);
2904
+ }
2905
+ function ui(t, e) {
2906
+ return t.min === e.min && t.max === e.max;
2907
+ }
2908
+ function Ml(t, e) {
2909
+ return ui(t.x, e.x) && ui(t.y, e.y);
2910
+ }
2911
+ function ci(t, e) {
2912
+ return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
2913
+ }
2914
+ function nr(t, e) {
2915
+ return ci(t.x, e.x) && ci(t.y, e.y);
2916
+ }
2917
+ function hi(t) {
2918
+ return I(t.x) / I(t.y);
2919
+ }
2920
+ function fi(t, e) {
2921
+ return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
2922
+ }
2923
+ function U(t) {
2924
+ return [t("x"), t("y")];
2925
+ }
2926
+ function Cl(t, e, n) {
2927
+ let i = "";
2928
+ const s = t.x.translate / e.x, o = t.y.translate / e.y, r = n?.z || 0;
2929
+ if ((s || o || r) && (i = `translate3d(${s}px, ${o}px, ${r}px) `), (e.x !== 1 || e.y !== 1) && (i += `scale(${1 / e.x}, ${1 / e.y}) `), n) {
2930
+ const { transformPerspective: c, rotate: u, rotateX: h, rotateY: f, skewX: d, skewY: m } = n;
2931
+ c && (i = `perspective(${c}px) ${i}`), u && (i += `rotate(${u}deg) `), h && (i += `rotateX(${h}deg) `), f && (i += `rotateY(${f}deg) `), d && (i += `skewX(${d}deg) `), m && (i += `skewY(${m}deg) `);
2932
+ }
2933
+ const a = t.x.scale * e.x, l = t.y.scale * e.y;
2934
+ return (a !== 1 || l !== 1) && (i += `scale(${a}, ${l})`), i || "none";
2935
+ }
2936
+ const ir = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], El = ir.length, di = (t) => typeof t == "string" ? parseFloat(t) : t, mi = (t) => typeof t == "number" || p.test(t);
2937
+ function Rl(t, e, n, i, s, o) {
2938
+ s ? (t.opacity = D(0, n.opacity ?? 1, Ll(i)), t.opacityExit = D(e.opacity ?? 1, 0, kl(i))) : o && (t.opacity = D(e.opacity ?? 1, n.opacity ?? 1, i));
2939
+ for (let r = 0; r < El; r++) {
2940
+ const a = `border${ir[r]}Radius`;
2941
+ let l = pi(e, a), c = pi(n, a);
2942
+ if (l === void 0 && c === void 0)
2943
+ continue;
2944
+ l || (l = 0), c || (c = 0), l === 0 || c === 0 || mi(l) === mi(c) ? (t[a] = Math.max(D(di(l), di(c), i), 0), (H.test(c) || H.test(l)) && (t[a] += "%")) : t[a] = c;
2945
+ }
2946
+ (e.rotate || n.rotate) && (t.rotate = D(e.rotate || 0, n.rotate || 0, i));
2947
+ }
2948
+ function pi(t, e) {
2949
+ return t[e] !== void 0 ? t[e] : t.borderRadius;
2950
+ }
2951
+ const Ll = /* @__PURE__ */ sr(0, 0.5, Ji), kl = /* @__PURE__ */ sr(0.5, 0.95, K);
2952
+ function sr(t, e, n) {
2953
+ return (i) => i < t ? 0 : i > e ? 1 : n(/* @__PURE__ */ Mt(t, e, i));
2954
+ }
2955
+ function Fl(t, e) {
2956
+ const n = F.now(), i = ({ timestamp: s }) => {
2957
+ const o = s - n;
2958
+ o >= e && (J(i), t(o - e));
2959
+ };
2960
+ return V.setup(i, !0), () => J(i);
2961
+ }
2962
+ function Lt(t, e, n, i = { passive: !0 }) {
2963
+ return t.addEventListener(e, n, i), () => t.removeEventListener(e, n);
2964
+ }
2965
+ function Kt(t) {
2966
+ return k(t) ? t.get() : t;
2967
+ }
2968
+ function Il(t, e, n) {
2969
+ const i = k(t) ? t : gt(t);
2970
+ return i.start(an("", i, e, n)), i.animation;
2971
+ }
2972
+ const Bl = (t, e) => t.depth - e.depth;
2973
+ class Ol {
2974
+ constructor() {
2975
+ this.children = [], this.isDirty = !1;
2976
+ }
2977
+ add(e) {
2978
+ $e(this.children, e), this.isDirty = !0;
2979
+ }
2980
+ remove(e) {
2981
+ Ge(this.children, e), this.isDirty = !0;
2982
+ }
2983
+ forEach(e) {
2984
+ this.isDirty && this.children.sort(Bl), this.isDirty = !1, this.children.forEach(e);
2985
+ }
2986
+ }
2987
+ class jl {
2988
+ constructor() {
2989
+ this.members = [];
2990
+ }
2991
+ add(e) {
2992
+ $e(this.members, e), e.scheduleRender();
2993
+ }
2994
+ remove(e) {
2995
+ if (Ge(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
2996
+ const n = this.members[this.members.length - 1];
2997
+ n && this.promote(n);
2998
+ }
2999
+ }
3000
+ relegate(e) {
3001
+ const n = this.members.findIndex((s) => e === s);
3002
+ if (n === 0)
3003
+ return !1;
3004
+ let i;
3005
+ for (let s = n; s >= 0; s--) {
3006
+ const o = this.members[s];
3007
+ if (o.isPresent !== !1) {
3008
+ i = o;
3009
+ break;
3010
+ }
3011
+ }
3012
+ return i ? (this.promote(i), !0) : !1;
3013
+ }
3014
+ promote(e, n) {
3015
+ const i = this.lead;
3016
+ if (e !== i && (this.prevLead = i, this.lead = e, e.show(), i)) {
3017
+ i.instance && i.scheduleRender(), e.scheduleRender(), e.resumeFrom = i, n && (e.resumeFrom.preserveOpacity = !0), i.snapshot && (e.snapshot = i.snapshot, e.snapshot.latestValues = i.animationValues || i.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
3018
+ const { crossfade: s } = e.options;
3019
+ s === !1 && i.hide();
3020
+ }
3021
+ }
3022
+ exitAnimationComplete() {
3023
+ this.members.forEach((e) => {
3024
+ const { options: n, resumingFrom: i } = e;
3025
+ n.onExitComplete && n.onExitComplete(), i && i.options.onExitComplete && i.options.onExitComplete();
3026
+ });
3027
+ }
3028
+ scheduleRender() {
3029
+ this.members.forEach((e) => {
3030
+ e.instance && e.scheduleRender(!1);
3031
+ });
3032
+ }
3033
+ /**
3034
+ * Clear any leads that have been removed this render to prevent them from being
3035
+ * used in future animations and to prevent memory leaks
3036
+ */
3037
+ removeLeadSnapshot() {
3038
+ this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
3039
+ }
3040
+ }
3041
+ const $t = {
3042
+ /**
3043
+ * Global flag as to whether the tree has animated since the last time
3044
+ * we resized the window
3045
+ */
3046
+ hasAnimatedSinceResize: !0,
3047
+ /**
3048
+ * We set this to true once, on the first update. Any nodes added to the tree beyond that
3049
+ * update will be given a `data-projection-id` attribute.
3050
+ */
3051
+ hasEverUpdated: !1
3052
+ }, ue = ["", "X", "Y", "Z"], Nl = 1e3;
3053
+ let Ul = 0;
3054
+ function ce(t, e, n, i) {
3055
+ const { latestValues: s } = e;
3056
+ s[t] && (n[t] = s[t], e.setStaticValue(t, 0), i && (i[t] = 0));
3057
+ }
3058
+ function rr(t) {
3059
+ if (t.hasCheckedOptimisedAppear = !0, t.root === t)
3060
+ return;
3061
+ const { visualElement: e } = t.options;
3062
+ if (!e)
3063
+ return;
3064
+ const n = Vs(e);
3065
+ if (window.MotionHasOptimisedAnimation(n, "transform")) {
3066
+ const { layout: s, layoutId: o } = t.options;
3067
+ window.MotionCancelOptimisedAnimation(n, "transform", V, !(s || o));
3068
+ }
3069
+ const { parent: i } = t;
3070
+ i && !i.hasCheckedOptimisedAppear && rr(i);
3071
+ }
3072
+ function or({ attachResizeListener: t, defaultParent: e, measureScroll: n, checkIsScrollRoot: i, resetTransform: s }) {
3073
+ return class {
3074
+ constructor(r = {}, a = e?.()) {
3075
+ this.id = Ul++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
3076
+ this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
3077
+ }, this.updateProjection = () => {
3078
+ this.projectionUpdateScheduled = !1, this.nodes.forEach($l), this.nodes.forEach(zl), this.nodes.forEach(Yl), this.nodes.forEach(Gl);
3079
+ }, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = r, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0;
3080
+ for (let l = 0; l < this.path.length; l++)
3081
+ this.path[l].shouldResetTransform = !0;
3082
+ this.root === this && (this.nodes = new Ol());
3083
+ }
3084
+ addEventListener(r, a) {
3085
+ return this.eventHandlers.has(r) || this.eventHandlers.set(r, new He()), this.eventHandlers.get(r).add(a);
3086
+ }
3087
+ notifyListeners(r, ...a) {
3088
+ const l = this.eventHandlers.get(r);
3089
+ l && l.notify(...a);
3090
+ }
3091
+ hasListeners(r) {
3092
+ return this.eventHandlers.has(r);
3093
+ }
3094
+ /**
3095
+ * Lifecycles
3096
+ */
3097
+ mount(r) {
3098
+ if (this.instance)
3099
+ return;
3100
+ this.isSVG = Bs(r) && !Ka(r), this.instance = r;
3101
+ const { layoutId: a, layout: l, visualElement: c } = this.options;
3102
+ if (c && !c.current && c.mount(r), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (l || a) && (this.isLayoutDirty = !0), t) {
3103
+ let u, h = 0;
3104
+ const f = () => this.root.updateBlockedByResize = !1;
3105
+ V.read(() => {
3106
+ h = window.innerWidth;
3107
+ }), t(r, () => {
3108
+ const d = window.innerWidth;
3109
+ d !== h && (h = d, this.root.updateBlockedByResize = !0, u && u(), u = Fl(f, 250), $t.hasAnimatedSinceResize && ($t.hasAnimatedSinceResize = !1, this.nodes.forEach(vi)));
3110
+ });
3111
+ }
3112
+ a && this.root.registerSharedNode(a, this), this.options.animate !== !1 && c && (a || l) && this.addEventListener("didUpdate", ({ delta: u, hasLayoutChanged: h, hasRelativeLayoutChanged: f, layout: d }) => {
3113
+ if (this.isTreeAnimationBlocked()) {
3114
+ this.target = void 0, this.relativeTarget = void 0;
3115
+ return;
3116
+ }
3117
+ const m = this.options.transition || c.getDefaultTransition() || Ql, { onLayoutAnimationStart: v, onLayoutAnimationComplete: T } = c.getProps(), g = !this.targetLayout || !nr(this.targetLayout, d), x = !h && f;
3118
+ if (this.options.layoutRoot || this.resumeFrom || x || h && (g || !this.currentAnimation)) {
3119
+ this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
3120
+ const y = {
3121
+ ...on(m, "layout"),
3122
+ onPlay: v,
3123
+ onComplete: T
3124
+ };
3125
+ (c.shouldReduceMotion || this.options.layoutRoot) && (y.delay = 0, y.type = !1), this.startAnimation(y), this.setAnimationOrigin(u, x);
3126
+ } else
3127
+ h || vi(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
3128
+ this.targetLayout = d;
3129
+ });
3130
+ }
3131
+ unmount() {
3132
+ this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
3133
+ const r = this.getStack();
3134
+ r && r.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), J(this.updateProjection);
3135
+ }
3136
+ // only on the root
3137
+ blockUpdate() {
3138
+ this.updateManuallyBlocked = !0;
3139
+ }
3140
+ unblockUpdate() {
3141
+ this.updateManuallyBlocked = !1;
3142
+ }
3143
+ isUpdateBlocked() {
3144
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
3145
+ }
3146
+ isTreeAnimationBlocked() {
3147
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
3148
+ }
3149
+ // Note: currently only running on root node
3150
+ startUpdate() {
3151
+ this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Xl), this.animationId++);
3152
+ }
3153
+ getTransformTemplate() {
3154
+ const { visualElement: r } = this.options;
3155
+ return r && r.getProps().transformTemplate;
3156
+ }
3157
+ willUpdate(r = !0) {
3158
+ if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
3159
+ this.options.onExitComplete && this.options.onExitComplete();
3160
+ return;
3161
+ }
3162
+ if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && rr(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
3163
+ return;
3164
+ this.isLayoutDirty = !0;
3165
+ for (let u = 0; u < this.path.length; u++) {
3166
+ const h = this.path[u];
3167
+ h.shouldResetTransform = !0, h.updateScroll("snapshot"), h.options.layoutRoot && h.willUpdate(!1);
3168
+ }
3169
+ const { layoutId: a, layout: l } = this.options;
3170
+ if (a === void 0 && !l)
3171
+ return;
3172
+ const c = this.getTransformTemplate();
3173
+ this.prevTransformTemplateValue = c ? c(this.latestValues, "") : void 0, this.updateSnapshot(), r && this.notifyListeners("willUpdate");
3174
+ }
3175
+ update() {
3176
+ if (this.updateScheduled = !1, this.isUpdateBlocked()) {
3177
+ this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(gi);
3178
+ return;
3179
+ }
3180
+ if (this.animationId <= this.animationCommitId) {
3181
+ this.nodes.forEach(yi);
3182
+ return;
3183
+ }
3184
+ this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(Hl), this.nodes.forEach(Wl), this.nodes.forEach(Kl)) : this.nodes.forEach(yi), this.clearAllSnapshots();
3185
+ const a = F.now();
3186
+ L.delta = z(0, 1e3 / 60, a - L.timestamp), L.timestamp = a, L.isProcessing = !0, ee.update.process(L), ee.preRender.process(L), ee.render.process(L), L.isProcessing = !1;
3187
+ }
3188
+ didUpdate() {
3189
+ this.updateScheduled || (this.updateScheduled = !0, hn.read(this.scheduleUpdate));
3190
+ }
3191
+ clearAllSnapshots() {
3192
+ this.nodes.forEach(_l), this.sharedNodes.forEach(ql);
3193
+ }
3194
+ scheduleUpdateProjection() {
3195
+ this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, V.preRender(this.updateProjection, !1, !0));
3196
+ }
3197
+ scheduleCheckAfterUnmount() {
3198
+ V.postRender(() => {
3199
+ this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
3200
+ });
3201
+ }
3202
+ /**
3203
+ * Update measurements
3204
+ */
3205
+ updateSnapshot() {
3206
+ this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !I(this.snapshot.measuredBox.x) && !I(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
3207
+ }
3208
+ updateLayout() {
3209
+ if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
3210
+ return;
3211
+ if (this.resumeFrom && !this.resumeFrom.instance)
3212
+ for (let l = 0; l < this.path.length; l++)
3213
+ this.path[l].updateScroll();
3214
+ const r = this.layout;
3215
+ this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected = E(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
3216
+ const { visualElement: a } = this.options;
3217
+ a && a.notify("LayoutMeasure", this.layout.layoutBox, r ? r.layoutBox : void 0);
3218
+ }
3219
+ updateScroll(r = "measure") {
3220
+ let a = !!(this.options.layoutScroll && this.instance);
3221
+ if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === r && (a = !1), a && this.instance) {
3222
+ const l = i(this.instance);
3223
+ this.scroll = {
3224
+ animationId: this.root.animationId,
3225
+ phase: r,
3226
+ isRoot: l,
3227
+ offset: n(this.instance),
3228
+ wasRoot: this.scroll ? this.scroll.isRoot : l
3229
+ };
3230
+ }
3231
+ }
3232
+ resetTransform() {
3233
+ if (!s)
3234
+ return;
3235
+ const r = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !er(this.projectionDelta), l = this.getTransformTemplate(), c = l ? l(this.latestValues, "") : void 0, u = c !== this.prevTransformTemplateValue;
3236
+ r && this.instance && (a || it(this.latestValues) || u) && (s(this.instance, c), this.shouldResetTransform = !1, this.scheduleRender());
3237
+ }
3238
+ measure(r = !0) {
3239
+ const a = this.measurePageBox();
3240
+ let l = this.removeElementScroll(a);
3241
+ return r && (l = this.removeTransform(l)), tu(l), {
3242
+ animationId: this.root.animationId,
3243
+ measuredBox: a,
3244
+ layoutBox: l,
3245
+ latestValues: {},
3246
+ source: this.id
3247
+ };
3248
+ }
3249
+ measurePageBox() {
3250
+ const { visualElement: r } = this.options;
3251
+ if (!r)
3252
+ return E();
3253
+ const a = r.measureViewportBox();
3254
+ if (!(this.scroll?.wasRoot || this.path.some(eu))) {
3255
+ const { scroll: c } = this.root;
3256
+ c && (ft(a.x, c.offset.x), ft(a.y, c.offset.y));
3257
+ }
3258
+ return a;
3259
+ }
3260
+ removeElementScroll(r) {
3261
+ const a = E();
3262
+ if ($(a, r), this.scroll?.wasRoot)
3263
+ return a;
3264
+ for (let l = 0; l < this.path.length; l++) {
3265
+ const c = this.path[l], { scroll: u, options: h } = c;
3266
+ c !== this.root && u && h.layoutScroll && (u.wasRoot && $(a, r), ft(a.x, u.offset.x), ft(a.y, u.offset.y));
3267
+ }
3268
+ return a;
3269
+ }
3270
+ applyTransform(r, a = !1) {
3271
+ const l = E();
3272
+ $(l, r);
3273
+ for (let c = 0; c < this.path.length; c++) {
3274
+ const u = this.path[c];
3275
+ !a && u.options.layoutScroll && u.scroll && u !== u.root && dt(l, {
3276
+ x: -u.scroll.offset.x,
3277
+ y: -u.scroll.offset.y
3278
+ }), it(u.latestValues) && dt(l, u.latestValues);
3279
+ }
3280
+ return it(this.latestValues) && dt(l, this.latestValues), l;
3281
+ }
3282
+ removeTransform(r) {
3283
+ const a = E();
3284
+ $(a, r);
3285
+ for (let l = 0; l < this.path.length; l++) {
3286
+ const c = this.path[l];
3287
+ if (!c.instance || !it(c.latestValues))
3288
+ continue;
3289
+ Ie(c.latestValues) && c.updateSnapshot();
3290
+ const u = E(), h = c.measurePageBox();
3291
+ $(u, h), ri(a, c.latestValues, c.snapshot ? c.snapshot.layoutBox : void 0, u);
3292
+ }
3293
+ return it(this.latestValues) && ri(a, this.latestValues), a;
3294
+ }
3295
+ setTargetDelta(r) {
3296
+ this.targetDelta = r, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
3297
+ }
3298
+ setOptions(r) {
3299
+ this.options = {
3300
+ ...this.options,
3301
+ ...r,
3302
+ crossfade: r.crossfade !== void 0 ? r.crossfade : !0
3303
+ };
3304
+ }
3305
+ clearMeasurements() {
3306
+ this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
3307
+ }
3308
+ forceRelativeParentToResolveTarget() {
3309
+ this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== L.timestamp && this.relativeParent.resolveTargetDelta(!0);
3310
+ }
3311
+ resolveTargetDelta(r = !1) {
3312
+ const a = this.getLead();
3313
+ this.isProjectionDirty || (this.isProjectionDirty = a.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = a.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = a.isSharedProjectionDirty);
3314
+ const l = !!this.resumingFrom || this !== a;
3315
+ if (!(r || l && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
3316
+ return;
3317
+ const { layout: u, layoutId: h } = this.options;
3318
+ if (!this.layout || !(u || h))
3319
+ return;
3320
+ this.resolvedRelativeTargetAt = L.timestamp;
3321
+ const f = this.getClosestProjectingParent();
3322
+ f && this.linkedParentVersion !== f.layoutVersion && !f.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (f && f.layout ? this.createRelativeTarget(f, this.layout.layoutBox, f.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = E(), this.targetWithTransforms = E()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), bl(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : $(this.target, this.layout.layoutBox), $s(this.target, this.targetDelta)) : $(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? this.createRelativeTarget(f, this.target, f.target) : this.relativeParent = this.relativeTarget = void 0));
3323
+ }
3324
+ getClosestProjectingParent() {
3325
+ if (!(!this.parent || Ie(this.parent.latestValues) || Ks(this.parent.latestValues)))
3326
+ return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
3327
+ }
3328
+ isProjecting() {
3329
+ return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
3330
+ }
3331
+ createRelativeTarget(r, a, l) {
3332
+ this.relativeParent = r, this.linkedParentVersion = r.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = E(), this.relativeTargetOrigin = E(), Xt(this.relativeTargetOrigin, a, l), $(this.relativeTarget, this.relativeTargetOrigin);
3333
+ }
3334
+ removeRelativeTarget() {
3335
+ this.relativeParent = this.relativeTarget = void 0;
3336
+ }
3337
+ calcProjection() {
3338
+ const r = this.getLead(), a = !!this.resumingFrom || this !== r;
3339
+ let l = !0;
3340
+ if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (l = !1), a && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === L.timestamp && (l = !1), l)
3341
+ return;
3342
+ const { layout: c, layoutId: u } = this.options;
3343
+ if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(c || u))
3344
+ return;
3345
+ $(this.layoutCorrected, this.layout.layoutBox);
3346
+ const h = this.treeScale.x, f = this.treeScale.y;
3347
+ Qa(this.layoutCorrected, this.treeScale, this.path, a), r.layout && !r.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (r.target = r.layout.layoutBox, r.targetWithTransforms = E());
3348
+ const { target: d } = r;
3349
+ if (!d) {
3350
+ this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
3351
+ return;
3352
+ }
3353
+ !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (ai(this.prevProjectionDelta.x, this.projectionDelta.x), ai(this.prevProjectionDelta.y, this.projectionDelta.y)), At(this.projectionDelta, this.layoutCorrected, d, this.latestValues), (this.treeScale.x !== h || this.treeScale.y !== f || !fi(this.projectionDelta.x, this.prevProjectionDelta.x) || !fi(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", d));
3354
+ }
3355
+ hide() {
3356
+ this.isVisible = !1;
3357
+ }
3358
+ show() {
3359
+ this.isVisible = !0;
3360
+ }
3361
+ scheduleRender(r = !0) {
3362
+ if (this.options.visualElement?.scheduleRender(), r) {
3363
+ const a = this.getStack();
3364
+ a && a.scheduleRender();
3365
+ }
3366
+ this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
3367
+ }
3368
+ createProjectionDeltas() {
3369
+ this.prevProjectionDelta = ht(), this.projectionDelta = ht(), this.projectionDeltaWithTransform = ht();
3370
+ }
3371
+ setAnimationOrigin(r, a = !1) {
3372
+ const l = this.snapshot, c = l ? l.latestValues : {}, u = { ...this.latestValues }, h = ht();
3373
+ (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
3374
+ const f = E(), d = l ? l.source : void 0, m = this.layout ? this.layout.source : void 0, v = d !== m, T = this.getStack(), g = !T || T.members.length <= 1, x = !!(v && !g && this.options.crossfade === !0 && !this.path.some(Jl));
3375
+ this.animationProgress = 0;
3376
+ let y;
3377
+ this.mixTargetDelta = (w) => {
3378
+ const P = w / 1e3;
3379
+ Ti(h.x, r.x, P), Ti(h.y, r.y, P), this.setTargetDelta(h), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (Xt(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Zl(this.relativeTarget, this.relativeTargetOrigin, f, P), y && Ml(this.relativeTarget, y) && (this.isProjectionDirty = !1), y || (y = E()), $(y, this.relativeTarget)), v && (this.animationValues = u, Rl(u, c, this.latestValues, P, x, g)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = P;
3380
+ }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
3381
+ }
3382
+ startAnimation(r) {
3383
+ this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (J(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = V.update(() => {
3384
+ $t.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = gt(0)), this.currentAnimation = Il(this.motionValue, [0, 1e3], {
3385
+ ...r,
3386
+ velocity: 0,
3387
+ isSync: !0,
3388
+ onUpdate: (a) => {
3389
+ this.mixTargetDelta(a), r.onUpdate && r.onUpdate(a);
3390
+ },
3391
+ onStop: () => {
3392
+ },
3393
+ onComplete: () => {
3394
+ r.onComplete && r.onComplete(), this.completeAnimation();
3395
+ }
3396
+ }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
3397
+ });
3398
+ }
3399
+ completeAnimation() {
3400
+ this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
3401
+ const r = this.getStack();
3402
+ r && r.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
3403
+ }
3404
+ finishAnimation() {
3405
+ this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(Nl), this.currentAnimation.stop()), this.completeAnimation();
3406
+ }
3407
+ applyTransformsToTarget() {
3408
+ const r = this.getLead();
3409
+ let { targetWithTransforms: a, target: l, layout: c, latestValues: u } = r;
3410
+ if (!(!a || !l || !c)) {
3411
+ if (this !== r && this.layout && c && ar(this.options.animationType, this.layout.layoutBox, c.layoutBox)) {
3412
+ l = this.target || E();
3413
+ const h = I(this.layout.layoutBox.x);
3414
+ l.x.min = r.target.x.min, l.x.max = l.x.min + h;
3415
+ const f = I(this.layout.layoutBox.y);
3416
+ l.y.min = r.target.y.min, l.y.max = l.y.min + f;
3417
+ }
3418
+ $(a, l), dt(a, u), At(this.projectionDeltaWithTransform, this.layoutCorrected, a, u);
3419
+ }
3420
+ }
3421
+ registerSharedNode(r, a) {
3422
+ this.sharedNodes.has(r) || this.sharedNodes.set(r, new jl()), this.sharedNodes.get(r).add(a);
3423
+ const c = a.options.initialPromotionConfig;
3424
+ a.promote({
3425
+ transition: c ? c.transition : void 0,
3426
+ preserveFollowOpacity: c && c.shouldPreserveFollowOpacity ? c.shouldPreserveFollowOpacity(a) : void 0
3427
+ });
3428
+ }
3429
+ isLead() {
3430
+ const r = this.getStack();
3431
+ return r ? r.lead === this : !0;
3432
+ }
3433
+ getLead() {
3434
+ const { layoutId: r } = this.options;
3435
+ return r ? this.getStack()?.lead || this : this;
3436
+ }
3437
+ getPrevLead() {
3438
+ const { layoutId: r } = this.options;
3439
+ return r ? this.getStack()?.prevLead : void 0;
3440
+ }
3441
+ getStack() {
3442
+ const { layoutId: r } = this.options;
3443
+ if (r)
3444
+ return this.root.sharedNodes.get(r);
3445
+ }
3446
+ promote({ needsReset: r, transition: a, preserveFollowOpacity: l } = {}) {
3447
+ const c = this.getStack();
3448
+ c && c.promote(this, l), r && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a });
3449
+ }
3450
+ relegate() {
3451
+ const r = this.getStack();
3452
+ return r ? r.relegate(this) : !1;
3453
+ }
3454
+ resetSkewAndRotation() {
3455
+ const { visualElement: r } = this.options;
3456
+ if (!r)
3457
+ return;
3458
+ let a = !1;
3459
+ const { latestValues: l } = r;
3460
+ if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (a = !0), !a)
3461
+ return;
3462
+ const c = {};
3463
+ l.z && ce("z", r, c, this.animationValues);
3464
+ for (let u = 0; u < ue.length; u++)
3465
+ ce(`rotate${ue[u]}`, r, c, this.animationValues), ce(`skew${ue[u]}`, r, c, this.animationValues);
3466
+ r.render();
3467
+ for (const u in c)
3468
+ r.setStaticValue(u, c[u]), this.animationValues && (this.animationValues[u] = c[u]);
3469
+ r.scheduleRender();
3470
+ }
3471
+ applyProjectionStyles(r, a) {
3472
+ if (!this.instance || this.isSVG)
3473
+ return;
3474
+ if (!this.isVisible) {
3475
+ r.visibility = "hidden";
3476
+ return;
3477
+ }
3478
+ const l = this.getTransformTemplate();
3479
+ if (this.needsReset) {
3480
+ this.needsReset = !1, r.visibility = "", r.opacity = "", r.pointerEvents = Kt(a?.pointerEvents) || "", r.transform = l ? l(this.latestValues, "") : "none";
3481
+ return;
3482
+ }
3483
+ const c = this.getLead();
3484
+ if (!this.projectionDelta || !this.layout || !c.target) {
3485
+ this.options.layoutId && (r.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, r.pointerEvents = Kt(a?.pointerEvents) || ""), this.hasProjected && !it(this.latestValues) && (r.transform = l ? l({}, "") : "none", this.hasProjected = !1);
3486
+ return;
3487
+ }
3488
+ r.visibility = "";
3489
+ const u = c.animationValues || c.latestValues;
3490
+ this.applyTransformsToTarget();
3491
+ let h = Cl(this.projectionDeltaWithTransform, this.treeScale, u);
3492
+ l && (h = l(u, h)), r.transform = h;
3493
+ const { x: f, y: d } = this.projectionDelta;
3494
+ r.transformOrigin = `${f.origin * 100}% ${d.origin * 100}% 0`, c.animationValues ? r.opacity = c === this ? u.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : u.opacityExit : r.opacity = c === this ? u.opacity !== void 0 ? u.opacity : "" : u.opacityExit !== void 0 ? u.opacityExit : 0;
3495
+ for (const m in Oe) {
3496
+ if (u[m] === void 0)
3497
+ continue;
3498
+ const { correct: v, applyTo: T, isCSSVariable: g } = Oe[m], x = h === "none" ? u[m] : v(u[m], c);
3499
+ if (T) {
3500
+ const y = T.length;
3501
+ for (let w = 0; w < y; w++)
3502
+ r[T[w]] = x;
3503
+ } else
3504
+ g ? this.options.visualElement.renderState.vars[m] = x : r[m] = x;
3505
+ }
3506
+ this.options.layoutId && (r.pointerEvents = c === this ? Kt(a?.pointerEvents) || "" : "none");
3507
+ }
3508
+ clearSnapshot() {
3509
+ this.resumeFrom = this.snapshot = void 0;
3510
+ }
3511
+ // Only run on root
3512
+ resetTree() {
3513
+ this.root.nodes.forEach((r) => r.currentAnimation?.stop()), this.root.nodes.forEach(gi), this.root.sharedNodes.clear();
3514
+ }
3515
+ };
3516
+ }
3517
+ function Wl(t) {
3518
+ t.updateLayout();
3519
+ }
3520
+ function Kl(t) {
3521
+ const e = t.resumeFrom?.snapshot || t.snapshot;
3522
+ if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
3523
+ const { layoutBox: n, measuredBox: i } = t.layout, { animationType: s } = t.options, o = e.source !== t.layout.source;
3524
+ s === "size" ? U((u) => {
3525
+ const h = o ? e.measuredBox[u] : e.layoutBox[u], f = I(h);
3526
+ h.min = n[u].min, h.max = h.min + f;
3527
+ }) : ar(s, e.layoutBox, n) && U((u) => {
3528
+ const h = o ? e.measuredBox[u] : e.layoutBox[u], f = I(n[u]);
3529
+ h.max = h.min + f, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[u].max = t.relativeTarget[u].min + f);
3530
+ });
3531
+ const r = ht();
3532
+ At(r, n, e.layoutBox);
3533
+ const a = ht();
3534
+ o ? At(a, t.applyTransform(i, !0), e.measuredBox) : At(a, n, e.layoutBox);
3535
+ const l = !er(r);
3536
+ let c = !1;
3537
+ if (!t.resumeFrom) {
3538
+ const u = t.getClosestProjectingParent();
3539
+ if (u && !u.resumeFrom) {
3540
+ const { snapshot: h, layout: f } = u;
3541
+ if (h && f) {
3542
+ const d = E();
3543
+ Xt(d, e.layoutBox, h.layoutBox);
3544
+ const m = E();
3545
+ Xt(m, n, f.layoutBox), nr(d, m) || (c = !0), u.options.layoutRoot && (t.relativeTarget = m, t.relativeTargetOrigin = d, t.relativeParent = u);
3546
+ }
3547
+ }
3548
+ }
3549
+ t.notifyListeners("didUpdate", {
3550
+ layout: n,
3551
+ snapshot: e,
3552
+ delta: a,
3553
+ layoutDelta: r,
3554
+ hasLayoutChanged: l,
3555
+ hasRelativeLayoutChanged: c
3556
+ });
3557
+ } else if (t.isLead()) {
3558
+ const { onExitComplete: n } = t.options;
3559
+ n && n();
3560
+ }
3561
+ t.options.transition = void 0;
3562
+ }
3563
+ function $l(t) {
3564
+ t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
3565
+ }
3566
+ function Gl(t) {
3567
+ t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
3568
+ }
3569
+ function _l(t) {
3570
+ t.clearSnapshot();
3571
+ }
3572
+ function gi(t) {
3573
+ t.clearMeasurements();
3574
+ }
3575
+ function yi(t) {
3576
+ t.isLayoutDirty = !1;
3577
+ }
3578
+ function Hl(t) {
3579
+ const { visualElement: e } = t.options;
3580
+ e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
3581
+ }
3582
+ function vi(t) {
3583
+ t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
3584
+ }
3585
+ function zl(t) {
3586
+ t.resolveTargetDelta();
3587
+ }
3588
+ function Yl(t) {
3589
+ t.calcProjection();
3590
+ }
3591
+ function Xl(t) {
3592
+ t.resetSkewAndRotation();
3593
+ }
3594
+ function ql(t) {
3595
+ t.removeLeadSnapshot();
3596
+ }
3597
+ function Ti(t, e, n) {
3598
+ t.translate = D(e.translate, 0, n), t.scale = D(e.scale, 1, n), t.origin = e.origin, t.originPoint = e.originPoint;
3599
+ }
3600
+ function xi(t, e, n, i) {
3601
+ t.min = D(e.min, n.min, i), t.max = D(e.max, n.max, i);
3602
+ }
3603
+ function Zl(t, e, n, i) {
3604
+ xi(t.x, e.x, n.x, i), xi(t.y, e.y, n.y, i);
3605
+ }
3606
+ function Jl(t) {
3607
+ return t.animationValues && t.animationValues.opacityExit !== void 0;
3608
+ }
3609
+ const Ql = {
3610
+ duration: 0.45,
3611
+ ease: [0.4, 0, 0.1, 1]
3612
+ }, Pi = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Si = Pi("applewebkit/") && !Pi("chrome/") ? Math.round : K;
3613
+ function wi(t) {
3614
+ t.min = Si(t.min), t.max = Si(t.max);
3615
+ }
3616
+ function tu(t) {
3617
+ wi(t.x), wi(t.y);
3618
+ }
3619
+ function ar(t, e, n) {
3620
+ return t === "position" || t === "preserve-aspect" && !wl(hi(e), hi(n), 0.2);
3621
+ }
3622
+ function eu(t) {
3623
+ return t !== t.root && t.scroll?.wasRoot;
3624
+ }
3625
+ const nu = or({
3626
+ attachResizeListener: (t, e) => Lt(t, "resize", e),
3627
+ measureScroll: () => ({
3628
+ x: document.documentElement.scrollLeft || document.body.scrollLeft,
3629
+ y: document.documentElement.scrollTop || document.body.scrollTop
3630
+ }),
3631
+ checkIsScrollRoot: () => !0
3632
+ }), he = {
3633
+ current: void 0
3634
+ }, lr = or({
3635
+ measureScroll: (t) => ({
3636
+ x: t.scrollLeft,
3637
+ y: t.scrollTop
3638
+ }),
3639
+ defaultParent: () => {
3640
+ if (!he.current) {
3641
+ const t = new nu({});
3642
+ t.mount(window), t.setOptions({ layoutScroll: !0 }), he.current = t;
3643
+ }
3644
+ return he.current;
3645
+ },
3646
+ resetTransform: (t, e) => {
3647
+ t.style.transform = e !== void 0 ? e : "none";
3648
+ },
3649
+ checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
3650
+ }), ur = yt({
3651
+ transformPagePoint: (t) => t,
3652
+ isStatic: !1,
3653
+ reducedMotion: "never"
3654
+ });
3655
+ function iu(t = !0) {
3656
+ const e = O(Ke);
3657
+ if (e === null)
3658
+ return [!0, null];
3659
+ const { isPresent: n, onExitComplete: i, register: s } = e, o = Ar();
3660
+ We(() => {
3661
+ if (t)
3662
+ return s(o);
3663
+ }, [t]);
3664
+ const r = Oi(() => t && i && i(o), [o, i, t]);
3665
+ return !n && i ? [!1, r] : [!0];
3666
+ }
3667
+ const cr = yt({ strict: !1 }), bi = {
3668
+ animation: [
3669
+ "animate",
3670
+ "variants",
3671
+ "whileHover",
3672
+ "whileTap",
3673
+ "exit",
3674
+ "whileInView",
3675
+ "whileFocus",
3676
+ "whileDrag"
3677
+ ],
3678
+ exit: ["exit"],
3679
+ drag: ["drag", "dragControls"],
3680
+ focus: ["whileFocus"],
3681
+ hover: ["whileHover", "onHoverStart", "onHoverEnd"],
3682
+ tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
3683
+ pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
3684
+ inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
3685
+ layout: ["layout", "layoutId"]
3686
+ };
3687
+ let Vi = !1;
3688
+ function su() {
3689
+ if (Vi)
3690
+ return;
3691
+ const t = {};
3692
+ for (const e in bi)
3693
+ t[e] = {
3694
+ isEnabled: (n) => bi[e].some((i) => !!n[i])
3695
+ };
3696
+ Ns(t), Vi = !0;
3697
+ }
3698
+ function hr() {
3699
+ return su(), Xa();
3700
+ }
3701
+ function ru(t) {
3702
+ const e = hr();
3703
+ for (const n in t)
3704
+ e[n] = {
3705
+ ...e[n],
3706
+ ...t[n]
3707
+ };
3708
+ Ns(e);
3709
+ }
3710
+ const ou = /* @__PURE__ */ new Set([
3711
+ "animate",
3712
+ "exit",
3713
+ "variants",
3714
+ "initial",
3715
+ "style",
3716
+ "values",
3717
+ "variants",
3718
+ "transition",
3719
+ "transformTemplate",
3720
+ "custom",
3721
+ "inherit",
3722
+ "onBeforeLayoutMeasure",
3723
+ "onAnimationStart",
3724
+ "onAnimationComplete",
3725
+ "onUpdate",
3726
+ "onDragStart",
3727
+ "onDrag",
3728
+ "onDragEnd",
3729
+ "onMeasureDragConstraints",
3730
+ "onDirectionLock",
3731
+ "onDragTransitionEnd",
3732
+ "_dragX",
3733
+ "_dragY",
3734
+ "onHoverStart",
3735
+ "onHoverEnd",
3736
+ "onViewportEnter",
3737
+ "onViewportLeave",
3738
+ "globalTapTarget",
3739
+ "ignoreStrict",
3740
+ "viewport"
3741
+ ]);
3742
+ function qt(t) {
3743
+ return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || ou.has(t);
3744
+ }
3745
+ let fr = (t) => !qt(t);
3746
+ function au(t) {
3747
+ typeof t == "function" && (fr = (e) => e.startsWith("on") ? !qt(e) : t(e));
3748
+ }
3749
+ try {
3750
+ au(require("@emotion/is-prop-valid").default);
3751
+ } catch {
3752
+ }
3753
+ function lu(t, e, n) {
3754
+ const i = {};
3755
+ for (const s in t)
3756
+ s === "values" && typeof t.values == "object" || (fr(s) || n === !0 && qt(s) || !e && !qt(s) || // If trying to use native HTML drag events, forward drag listeners
3757
+ t.draggable && s.startsWith("onDrag")) && (i[s] = t[s]);
3758
+ return i;
3759
+ }
3760
+ const te = /* @__PURE__ */ yt({});
3761
+ function uu(t, e) {
3762
+ if (Qt(t)) {
3763
+ const { initial: n, animate: i } = t;
3764
+ return {
3765
+ initial: n === !1 || Rt(n) ? n : void 0,
3766
+ animate: Rt(i) ? i : void 0
3767
+ };
3768
+ }
3769
+ return t.inherit !== !1 ? e : {};
3770
+ }
3771
+ function cu(t) {
3772
+ const { initial: e, animate: n } = uu(t, O(te));
3773
+ return Zt(() => ({ initial: e, animate: n }), [Ai(e), Ai(n)]);
3774
+ }
3775
+ function Ai(t) {
3776
+ return Array.isArray(t) ? t.join(" ") : t;
3777
+ }
3778
+ const yn = () => ({
3779
+ style: {},
3780
+ transform: {},
3781
+ transformOrigin: {},
3782
+ vars: {}
3783
+ });
3784
+ function dr(t, e, n) {
3785
+ for (const i in e)
3786
+ !k(e[i]) && !Hs(i, n) && (t[i] = e[i]);
3787
+ }
3788
+ function hu({ transformTemplate: t }, e) {
3789
+ return Zt(() => {
3790
+ const n = yn();
3791
+ return pn(n, e, t), Object.assign({}, n.vars, n.style);
3792
+ }, [e]);
3793
+ }
3794
+ function fu(t, e) {
3795
+ const n = t.style || {}, i = {};
3796
+ return dr(i, n, t), Object.assign(i, hu(t, e)), i;
3797
+ }
3798
+ function du(t, e) {
3799
+ const n = {}, i = fu(t, e);
3800
+ return t.drag && t.dragListener !== !1 && (n.draggable = !1, i.userSelect = i.WebkitUserSelect = i.WebkitTouchCallout = "none", i.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = i, n;
3801
+ }
3802
+ const mr = () => ({
3803
+ ...yn(),
3804
+ attrs: {}
3805
+ });
3806
+ function mu(t, e, n, i) {
3807
+ const s = Zt(() => {
3808
+ const o = mr();
3809
+ return zs(o, e, Xs(i), t.transformTemplate, t.style), {
3810
+ ...o.attrs,
3811
+ style: { ...o.style }
3812
+ };
3813
+ }, [e]);
3814
+ if (t.style) {
3815
+ const o = {};
3816
+ dr(o, t.style, t), s.style = { ...o, ...s.style };
3817
+ }
3818
+ return s;
3819
+ }
3820
+ const pu = [
3821
+ "animate",
3822
+ "circle",
3823
+ "defs",
3824
+ "desc",
3825
+ "ellipse",
3826
+ "g",
3827
+ "image",
3828
+ "line",
3829
+ "filter",
3830
+ "marker",
3831
+ "mask",
3832
+ "metadata",
3833
+ "path",
3834
+ "pattern",
3835
+ "polygon",
3836
+ "polyline",
3837
+ "rect",
3838
+ "stop",
3839
+ "switch",
3840
+ "symbol",
3841
+ "svg",
3842
+ "text",
3843
+ "tspan",
3844
+ "use",
3845
+ "view"
3846
+ ];
3847
+ function vn(t) {
3848
+ return (
3849
+ /**
3850
+ * If it's not a string, it's a custom React component. Currently we only support
3851
+ * HTML custom React components.
3852
+ */
3853
+ typeof t != "string" || /**
3854
+ * If it contains a dash, the element is a custom HTML webcomponent.
3855
+ */
3856
+ t.includes("-") ? !1 : (
3857
+ /**
3858
+ * If it's in our list of lowercase SVG tags, it's an SVG component
3859
+ */
3860
+ !!(pu.indexOf(t) > -1 || /**
3861
+ * If it contains a capital letter, it's an SVG component
3862
+ */
3863
+ /[A-Z]/u.test(t))
3864
+ )
3865
+ );
3866
+ }
3867
+ function gu(t, e, n, { latestValues: i }, s, o = !1, r) {
3868
+ const l = (r ?? vn(t) ? mu : du)(e, i, s, t), c = lu(e, typeof t == "string", o), u = t !== ji ? { ...c, ...l, ref: n } : {}, { children: h } = e, f = Zt(() => k(h) ? h.get() : h, [h]);
3869
+ return Dr(t, {
3870
+ ...u,
3871
+ children: f
3872
+ });
3873
+ }
3874
+ function yu({ scrapeMotionValuesFromProps: t, createRenderState: e }, n, i, s) {
3875
+ return {
3876
+ latestValues: vu(n, i, s, t),
3877
+ renderState: e()
3878
+ };
3879
+ }
3880
+ function vu(t, e, n, i) {
3881
+ const s = {}, o = i(t, {});
3882
+ for (const f in o)
3883
+ s[f] = Kt(o[f]);
3884
+ let { initial: r, animate: a } = t;
3885
+ const l = Qt(t), c = js(t);
3886
+ e && c && !l && t.inherit !== !1 && (r === void 0 && (r = e.initial), a === void 0 && (a = e.animate));
3887
+ let u = n ? n.initial === !1 : !1;
3888
+ u = u || r === !1;
3889
+ const h = u ? a : r;
3890
+ if (h && typeof h != "boolean" && !Jt(h)) {
3891
+ const f = Array.isArray(h) ? h : [h];
3892
+ for (let d = 0; d < f.length; d++) {
3893
+ const m = ln(t, f[d]);
3894
+ if (m) {
3895
+ const { transitionEnd: v, transition: T, ...g } = m;
3896
+ for (const x in g) {
3897
+ let y = g[x];
3898
+ if (Array.isArray(y)) {
3899
+ const w = u ? y.length - 1 : 0;
3900
+ y = y[w];
3901
+ }
3902
+ y !== null && (s[x] = y);
3903
+ }
3904
+ for (const x in v)
3905
+ s[x] = v[x];
3906
+ }
3907
+ }
3908
+ }
3909
+ return s;
3910
+ }
3911
+ const pr = (t) => (e, n) => {
3912
+ const i = O(te), s = O(Ke), o = () => yu(t, e, i, s);
3913
+ return n ? o() : Er(o);
3914
+ }, Tu = /* @__PURE__ */ pr({
3915
+ scrapeMotionValuesFromProps: gn,
3916
+ createRenderState: yn
3917
+ }), xu = /* @__PURE__ */ pr({
3918
+ scrapeMotionValuesFromProps: qs,
3919
+ createRenderState: mr
3920
+ }), Pu = Symbol.for("motionComponentSymbol");
3921
+ function Su(t, e, n) {
3922
+ const i = mt(n);
3923
+ Ni(() => {
3924
+ i.current = n;
3925
+ });
3926
+ const s = mt(null);
3927
+ return Oi((o) => {
3928
+ o && t.onMount?.(o), e && (o ? e.mount(o) : e.unmount());
3929
+ const r = i.current;
3930
+ if (typeof r == "function")
3931
+ if (o) {
3932
+ const a = r(o);
3933
+ typeof a == "function" && (s.current = a);
3934
+ } else s.current ? (s.current(), s.current = null) : r(o);
3935
+ else r && (r.current = o);
3936
+ }, [e]);
3937
+ }
3938
+ const gr = yt({});
3939
+ function bt(t) {
3940
+ return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
3941
+ }
3942
+ function wu(t, e, n, i, s, o) {
3943
+ const { visualElement: r } = O(te), a = O(cr), l = O(Ke), c = O(ur).reducedMotion, u = mt(null);
3944
+ i = i || a.renderer, !u.current && i && (u.current = i(t, {
3945
+ visualState: e,
3946
+ parent: r,
3947
+ props: n,
3948
+ presenceContext: l,
3949
+ blockInitialAnimation: l ? l.initial === !1 : !1,
3950
+ reducedMotionConfig: c,
3951
+ isSVG: o
3952
+ }));
3953
+ const h = u.current, f = O(gr);
3954
+ h && !h.projection && s && (h.type === "html" || h.type === "svg") && bu(u.current, n, s, f);
3955
+ const d = mt(!1);
3956
+ Ni(() => {
3957
+ h && d.current && h.update(n, l);
3958
+ });
3959
+ const m = n[bs], v = mt(!!m && !window.MotionHandoffIsComplete?.(m) && window.MotionHasOptimisedAnimation?.(m));
3960
+ return Rr(() => {
3961
+ h && (d.current = !0, window.MotionIsMounted = !0, h.updateFeatures(), h.scheduleRenderMicrotask(), v.current && h.animationState && h.animationState.animateChanges());
3962
+ }), We(() => {
3963
+ h && (!v.current && h.animationState && h.animationState.animateChanges(), v.current && (queueMicrotask(() => {
3964
+ window.MotionHandoffMarkAsComplete?.(m);
3965
+ }), v.current = !1), h.enteringChildren = void 0);
3966
+ }), h;
3967
+ }
3968
+ function bu(t, e, n, i) {
3969
+ const { layoutId: s, layout: o, drag: r, dragConstraints: a, layoutScroll: l, layoutRoot: c, layoutCrossfade: u } = e;
3970
+ t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : yr(t.parent)), t.projection.setOptions({
3971
+ layoutId: s,
3972
+ layout: o,
3973
+ alwaysMeasureLayout: !!r || a && bt(a),
3974
+ visualElement: t,
3975
+ /**
3976
+ * TODO: Update options in an effect. This could be tricky as it'll be too late
3977
+ * to update by the time layout animations run.
3978
+ * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
3979
+ * ensuring it gets called if there's no potential layout animations.
3980
+ *
3981
+ */
3982
+ animationType: typeof o == "string" ? o : "both",
3983
+ initialPromotionConfig: i,
3984
+ crossfade: u,
3985
+ layoutScroll: l,
3986
+ layoutRoot: c
3987
+ });
3988
+ }
3989
+ function yr(t) {
3990
+ if (t)
3991
+ return t.options.allowProjection !== !1 ? t.projection : yr(t.parent);
3992
+ }
3993
+ function fe(t, { forwardMotionProps: e = !1, type: n } = {}, i, s) {
3994
+ i && ru(i);
3995
+ const o = n ? n === "svg" : vn(t), r = o ? xu : Tu;
3996
+ function a(c, u) {
3997
+ let h;
3998
+ const f = {
3999
+ ...O(ur),
4000
+ ...c,
4001
+ layoutId: Vu(c)
4002
+ }, { isStatic: d } = f, m = cu(c), v = r(c, d);
4003
+ if (!d && Wi) {
4004
+ Au(f, i);
4005
+ const T = Du(f);
4006
+ h = T.MeasureLayout, m.visualElement = wu(t, v, f, s, T.ProjectionNode, o);
4007
+ }
4008
+ return br(te.Provider, { value: m, children: [h && m.visualElement ? Ue(h, { visualElement: m.visualElement, ...f }) : null, gu(t, c, Su(v, m.visualElement, u), v, d, e, o)] });
4009
+ }
4010
+ a.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
4011
+ const l = Mr(a);
4012
+ return l[Pu] = t, l;
4013
+ }
4014
+ function Vu({ layoutId: t }) {
4015
+ const e = O(Ui).id;
4016
+ return e && t !== void 0 ? e + "-" + t : t;
4017
+ }
4018
+ function Au(t, e) {
4019
+ const n = O(cr).strict;
4020
+ if (process.env.NODE_ENV !== "production" && e && n) {
4021
+ const i = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
4022
+ t.ignoreStrict ? vt(!1, i, "lazy-strict-mode") : Y(!1, i, "lazy-strict-mode");
4023
+ }
4024
+ }
4025
+ function Du(t) {
4026
+ const e = hr(), { drag: n, layout: i } = e;
4027
+ if (!n && !i)
4028
+ return {};
4029
+ const s = { ...n, ...i };
4030
+ return {
4031
+ MeasureLayout: n?.isEnabled(t) || i?.isEnabled(t) ? s.MeasureLayout : void 0,
4032
+ ProjectionNode: s.ProjectionNode
4033
+ };
4034
+ }
4035
+ function Mu(t, e) {
4036
+ if (typeof Proxy > "u")
4037
+ return fe;
4038
+ const n = /* @__PURE__ */ new Map(), i = (o, r) => fe(o, r, t, e), s = (o, r) => (process.env.NODE_ENV !== "production" && ze(!1, "motion() is deprecated. Use motion.create() instead."), i(o, r));
4039
+ return new Proxy(s, {
4040
+ /**
4041
+ * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
4042
+ * The prop name is passed through as `key` and we can use that to generate a `motion`
4043
+ * DOM component with that name.
4044
+ */
4045
+ get: (o, r) => r === "create" ? i : (n.has(r) || n.set(r, fe(r, void 0, t, e)), n.get(r))
4046
+ });
4047
+ }
4048
+ const Cu = (t, e) => e.isSVG ?? vn(t) ? new fl(e) : new ol(e, {
4049
+ allowProjection: t !== ji
4050
+ });
4051
+ class Eu extends tt {
4052
+ /**
4053
+ * We dynamically generate the AnimationState manager as it contains a reference
4054
+ * to the underlying animation library. We only want to load that if we load this,
4055
+ * so people can optionally code split it out using the `m` component.
4056
+ */
4057
+ constructor(e) {
4058
+ super(e), e.animationState || (e.animationState = yl(e));
4059
+ }
4060
+ updateAnimationControlsSubscription() {
4061
+ const { animate: e } = this.node.getProps();
4062
+ Jt(e) && (this.unmountControls = e.subscribe(this.node));
4063
+ }
4064
+ /**
4065
+ * Subscribe any provided AnimationControls to the component's VisualElement
4066
+ */
4067
+ mount() {
4068
+ this.updateAnimationControlsSubscription();
4069
+ }
4070
+ update() {
4071
+ const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
4072
+ e !== n && this.updateAnimationControlsSubscription();
4073
+ }
4074
+ unmount() {
4075
+ this.node.animationState.reset(), this.unmountControls?.();
4076
+ }
4077
+ }
4078
+ let Ru = 0;
4079
+ class Lu extends tt {
4080
+ constructor() {
4081
+ super(...arguments), this.id = Ru++;
4082
+ }
4083
+ update() {
4084
+ if (!this.node.presenceContext)
4085
+ return;
4086
+ const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
4087
+ if (!this.node.animationState || e === i)
4088
+ return;
4089
+ const s = this.node.animationState.setActive("exit", !e);
4090
+ n && !e && s.then(() => {
4091
+ n(this.id);
4092
+ });
4093
+ }
4094
+ mount() {
4095
+ const { register: e, onExitComplete: n } = this.node.presenceContext || {};
4096
+ n && n(this.id), e && (this.unmount = e(this.id));
4097
+ }
4098
+ unmount() {
4099
+ }
4100
+ }
4101
+ const ku = {
4102
+ animation: {
4103
+ Feature: Eu
4104
+ },
4105
+ exit: {
4106
+ Feature: Lu
4107
+ }
4108
+ };
4109
+ function Bt(t) {
4110
+ return {
4111
+ point: {
4112
+ x: t.pageX,
4113
+ y: t.pageY
4114
+ }
4115
+ };
4116
+ }
4117
+ const Fu = (t) => (e) => fn(e) && t(e, Bt(e));
4118
+ function Dt(t, e, n, i) {
4119
+ return Lt(t, e, Fu(n), i);
4120
+ }
4121
+ const vr = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Di = (t, e) => Math.abs(t - e);
4122
+ function Iu(t, e) {
4123
+ const n = Di(t.x, e.x), i = Di(t.y, e.y);
4124
+ return Math.sqrt(n ** 2 + i ** 2);
4125
+ }
4126
+ const Mi = /* @__PURE__ */ new Set(["auto", "scroll"]);
4127
+ class Tr {
4128
+ constructor(e, n, { transformPagePoint: i, contextWindow: s = window, dragSnapToOrigin: o = !1, distanceThreshold: r = 3, element: a } = {}) {
4129
+ if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.scrollPositions = /* @__PURE__ */ new Map(), this.removeScrollListeners = null, this.onElementScroll = (d) => {
4130
+ this.handleScroll(d.target);
4131
+ }, this.onWindowScroll = () => {
4132
+ this.handleScroll(window);
4133
+ }, this.updatePoint = () => {
4134
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
4135
+ return;
4136
+ const d = me(this.lastMoveEventInfo, this.history), m = this.startEvent !== null, v = Iu(d.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
4137
+ if (!m && !v)
4138
+ return;
4139
+ const { point: T } = d, { timestamp: g } = L;
4140
+ this.history.push({ ...T, timestamp: g });
4141
+ const { onStart: x, onMove: y } = this.handlers;
4142
+ m || (x && x(this.lastMoveEvent, d), this.startEvent = this.lastMoveEvent), y && y(this.lastMoveEvent, d);
4143
+ }, this.handlePointerMove = (d, m) => {
4144
+ this.lastMoveEvent = d, this.lastMoveEventInfo = de(m, this.transformPagePoint), V.update(this.updatePoint, !0);
4145
+ }, this.handlePointerUp = (d, m) => {
4146
+ this.end();
4147
+ const { onEnd: v, onSessionEnd: T, resumeAnimation: g } = this.handlers;
4148
+ if ((this.dragSnapToOrigin || !this.startEvent) && g && g(), !(this.lastMoveEvent && this.lastMoveEventInfo))
4149
+ return;
4150
+ const x = me(d.type === "pointercancel" ? this.lastMoveEventInfo : de(m, this.transformPagePoint), this.history);
4151
+ this.startEvent && v && v(d, x), T && T(d, x);
4152
+ }, !fn(e))
4153
+ return;
4154
+ this.dragSnapToOrigin = o, this.handlers = n, this.transformPagePoint = i, this.distanceThreshold = r, this.contextWindow = s || window;
4155
+ const l = Bt(e), c = de(l, this.transformPagePoint), { point: u } = c, { timestamp: h } = L;
4156
+ this.history = [{ ...u, timestamp: h }];
4157
+ const { onSessionStart: f } = n;
4158
+ f && f(e, me(c, this.history)), this.removeListeners = kt(Dt(this.contextWindow, "pointermove", this.handlePointerMove), Dt(this.contextWindow, "pointerup", this.handlePointerUp), Dt(this.contextWindow, "pointercancel", this.handlePointerUp)), a && this.startScrollTracking(a);
4159
+ }
4160
+ /**
4161
+ * Start tracking scroll on ancestors and window.
4162
+ */
4163
+ startScrollTracking(e) {
4164
+ let n = e.parentElement;
4165
+ for (; n; ) {
4166
+ const i = getComputedStyle(n);
4167
+ (Mi.has(i.overflowX) || Mi.has(i.overflowY)) && this.scrollPositions.set(n, {
4168
+ x: n.scrollLeft,
4169
+ y: n.scrollTop
4170
+ }), n = n.parentElement;
4171
+ }
4172
+ this.scrollPositions.set(window, {
4173
+ x: window.scrollX,
4174
+ y: window.scrollY
4175
+ }), window.addEventListener("scroll", this.onElementScroll, {
4176
+ capture: !0,
4177
+ passive: !0
4178
+ }), window.addEventListener("scroll", this.onWindowScroll, {
4179
+ passive: !0
4180
+ }), this.removeScrollListeners = () => {
4181
+ window.removeEventListener("scroll", this.onElementScroll, {
4182
+ capture: !0
4183
+ }), window.removeEventListener("scroll", this.onWindowScroll);
4184
+ };
4185
+ }
4186
+ /**
4187
+ * Handle scroll compensation during drag.
4188
+ *
4189
+ * For element scroll: adjusts history origin since pageX/pageY doesn't change.
4190
+ * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
4191
+ */
4192
+ handleScroll(e) {
4193
+ const n = this.scrollPositions.get(e);
4194
+ if (!n)
4195
+ return;
4196
+ const i = e === window, s = i ? { x: window.scrollX, y: window.scrollY } : {
4197
+ x: e.scrollLeft,
4198
+ y: e.scrollTop
4199
+ }, o = { x: s.x - n.x, y: s.y - n.y };
4200
+ o.x === 0 && o.y === 0 || (i ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += o.x, this.lastMoveEventInfo.point.y += o.y) : this.history.length > 0 && (this.history[0].x -= o.x, this.history[0].y -= o.y), this.scrollPositions.set(e, s), V.update(this.updatePoint, !0));
4201
+ }
4202
+ updateHandlers(e) {
4203
+ this.handlers = e;
4204
+ }
4205
+ end() {
4206
+ this.removeListeners && this.removeListeners(), this.removeScrollListeners && this.removeScrollListeners(), this.scrollPositions.clear(), J(this.updatePoint);
4207
+ }
4208
+ }
4209
+ function de(t, e) {
4210
+ return e ? { point: e(t.point) } : t;
4211
+ }
4212
+ function Ci(t, e) {
4213
+ return { x: t.x - e.x, y: t.y - e.y };
4214
+ }
4215
+ function me({ point: t }, e) {
4216
+ return {
4217
+ point: t,
4218
+ delta: Ci(t, xr(e)),
4219
+ offset: Ci(t, Bu(e)),
4220
+ velocity: Ou(e, 0.1)
4221
+ };
4222
+ }
4223
+ function Bu(t) {
4224
+ return t[0];
4225
+ }
4226
+ function xr(t) {
4227
+ return t[t.length - 1];
4228
+ }
4229
+ function Ou(t, e) {
4230
+ if (t.length < 2)
4231
+ return { x: 0, y: 0 };
4232
+ let n = t.length - 1, i = null;
4233
+ const s = xr(t);
4234
+ for (; n >= 0 && (i = t[n], !(s.timestamp - i.timestamp > /* @__PURE__ */ _(e))); )
4235
+ n--;
4236
+ if (!i)
4237
+ return { x: 0, y: 0 };
4238
+ const o = /* @__PURE__ */ W(s.timestamp - i.timestamp);
4239
+ if (o === 0)
4240
+ return { x: 0, y: 0 };
4241
+ const r = {
4242
+ x: (s.x - i.x) / o,
4243
+ y: (s.y - i.y) / o
4244
+ };
4245
+ return r.x === 1 / 0 && (r.x = 0), r.y === 1 / 0 && (r.y = 0), r;
4246
+ }
4247
+ function ju(t, { min: e, max: n }, i) {
4248
+ return e !== void 0 && t < e ? t = i ? D(e, t, i.min) : Math.max(t, e) : n !== void 0 && t > n && (t = i ? D(n, t, i.max) : Math.min(t, n)), t;
4249
+ }
4250
+ function Ei(t, e, n) {
4251
+ return {
4252
+ min: e !== void 0 ? t.min + e : void 0,
4253
+ max: n !== void 0 ? t.max + n - (t.max - t.min) : void 0
4254
+ };
4255
+ }
4256
+ function Nu(t, { top: e, left: n, bottom: i, right: s }) {
4257
+ return {
4258
+ x: Ei(t.x, n, s),
4259
+ y: Ei(t.y, e, i)
4260
+ };
4261
+ }
4262
+ function Ri(t, e) {
4263
+ let n = e.min - t.min, i = e.max - t.max;
4264
+ return e.max - e.min < t.max - t.min && ([n, i] = [i, n]), { min: n, max: i };
4265
+ }
4266
+ function Uu(t, e) {
4267
+ return {
4268
+ x: Ri(t.x, e.x),
4269
+ y: Ri(t.y, e.y)
4270
+ };
4271
+ }
4272
+ function Wu(t, e) {
4273
+ let n = 0.5;
4274
+ const i = I(t), s = I(e);
4275
+ return s > i ? n = /* @__PURE__ */ Mt(e.min, e.max - i, t.min) : i > s && (n = /* @__PURE__ */ Mt(t.min, t.max - s, e.min)), z(0, 1, n);
4276
+ }
4277
+ function Ku(t, e) {
4278
+ const n = {};
4279
+ return e.min !== void 0 && (n.min = e.min - t.min), e.max !== void 0 && (n.max = e.max - t.min), n;
4280
+ }
4281
+ const je = 0.35;
4282
+ function $u(t = je) {
4283
+ return t === !1 ? t = 0 : t === !0 && (t = je), {
4284
+ x: Li(t, "left", "right"),
4285
+ y: Li(t, "top", "bottom")
4286
+ };
4287
+ }
4288
+ function Li(t, e, n) {
4289
+ return {
4290
+ min: ki(t, e),
4291
+ max: ki(t, n)
4292
+ };
4293
+ }
4294
+ function ki(t, e) {
4295
+ return typeof t == "number" ? t : t[e] || 0;
4296
+ }
4297
+ const Gu = /* @__PURE__ */ new WeakMap();
4298
+ class _u {
4299
+ constructor(e) {
4300
+ this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = E(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
4301
+ }
4302
+ start(e, { snapToCursor: n = !1, distanceThreshold: i } = {}) {
4303
+ const { presenceContext: s } = this.visualElement;
4304
+ if (s && s.isPresent === !1)
4305
+ return;
4306
+ const o = (h) => {
4307
+ n ? (this.stopAnimation(), this.snapToCursor(Bt(h).point)) : this.pauseAnimation();
4308
+ }, r = (h, f) => {
4309
+ this.stopAnimation();
4310
+ const { drag: d, dragPropagation: m, onDragStart: v } = this.getProps();
4311
+ if (d && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = Oa(d), !this.openDragLock))
4312
+ return;
4313
+ this.latestPointerEvent = h, this.latestPanInfo = f, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), U((g) => {
4314
+ let x = this.getAxisMotionValue(g).get() || 0;
4315
+ if (H.test(x)) {
4316
+ const { projection: y } = this.visualElement;
4317
+ if (y && y.layout) {
4318
+ const w = y.layout.layoutBox[g];
4319
+ w && (x = I(w) * (parseFloat(x) / 100));
4320
+ }
4321
+ }
4322
+ this.originPoint[g] = x;
4323
+ }), v && V.postRender(() => v(h, f)), Re(this.visualElement, "transform");
4324
+ const { animationState: T } = this.visualElement;
4325
+ T && T.setActive("whileDrag", !0);
4326
+ }, a = (h, f) => {
4327
+ this.latestPointerEvent = h, this.latestPanInfo = f;
4328
+ const { dragPropagation: d, dragDirectionLock: m, onDirectionLock: v, onDrag: T } = this.getProps();
4329
+ if (!d && !this.openDragLock)
4330
+ return;
4331
+ const { offset: g } = f;
4332
+ if (m && this.currentDirection === null) {
4333
+ this.currentDirection = Hu(g), this.currentDirection !== null && v && v(this.currentDirection);
4334
+ return;
4335
+ }
4336
+ this.updateAxis("x", f.point, g), this.updateAxis("y", f.point, g), this.visualElement.render(), T && T(h, f);
4337
+ }, l = (h, f) => {
4338
+ this.latestPointerEvent = h, this.latestPanInfo = f, this.stop(h, f), this.latestPointerEvent = null, this.latestPanInfo = null;
4339
+ }, c = () => U((h) => this.getAnimationState(h) === "paused" && this.getAxisMotionValue(h).animation?.play()), { dragSnapToOrigin: u } = this.getProps();
4340
+ this.panSession = new Tr(e, {
4341
+ onSessionStart: o,
4342
+ onStart: r,
4343
+ onMove: a,
4344
+ onSessionEnd: l,
4345
+ resumeAnimation: c
4346
+ }, {
4347
+ transformPagePoint: this.visualElement.getTransformPagePoint(),
4348
+ dragSnapToOrigin: u,
4349
+ distanceThreshold: i,
4350
+ contextWindow: vr(this.visualElement),
4351
+ element: this.visualElement.current
4352
+ });
4353
+ }
4354
+ /**
4355
+ * @internal
4356
+ */
4357
+ stop(e, n) {
4358
+ const i = e || this.latestPointerEvent, s = n || this.latestPanInfo, o = this.isDragging;
4359
+ if (this.cancel(), !o || !s || !i)
4360
+ return;
4361
+ const { velocity: r } = s;
4362
+ this.startAnimation(r);
4363
+ const { onDragEnd: a } = this.getProps();
4364
+ a && V.postRender(() => a(i, s));
4365
+ }
4366
+ /**
4367
+ * @internal
4368
+ */
4369
+ cancel() {
4370
+ this.isDragging = !1;
4371
+ const { projection: e, animationState: n } = this.visualElement;
4372
+ e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
4373
+ const { dragPropagation: i } = this.getProps();
4374
+ !i && this.openDragLock && (this.openDragLock(), this.openDragLock = null), n && n.setActive("whileDrag", !1);
4375
+ }
4376
+ updateAxis(e, n, i) {
4377
+ const { drag: s } = this.getProps();
4378
+ if (!i || !Nt(e, s, this.currentDirection))
4379
+ return;
4380
+ const o = this.getAxisMotionValue(e);
4381
+ let r = this.originPoint[e] + i[e];
4382
+ this.constraints && this.constraints[e] && (r = ju(r, this.constraints[e], this.elastic[e])), o.set(r);
4383
+ }
4384
+ resolveConstraints() {
4385
+ const { dragConstraints: e, dragElastic: n } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, s = this.constraints;
4386
+ e && bt(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && i ? this.constraints = Nu(i.layoutBox, e) : this.constraints = !1, this.elastic = $u(n), s !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && U((o) => {
4387
+ this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = Ku(i.layoutBox[o], this.constraints[o]));
4388
+ });
4389
+ }
4390
+ resolveRefConstraints() {
4391
+ const { dragConstraints: e, onMeasureDragConstraints: n } = this.getProps();
4392
+ if (!e || !bt(e))
4393
+ return !1;
4394
+ const i = e.current;
4395
+ Y(i !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
4396
+ const { projection: s } = this.visualElement;
4397
+ if (!s || !s.layout)
4398
+ return !1;
4399
+ const o = tl(i, s.root, this.visualElement.getTransformPagePoint());
4400
+ let r = Uu(s.layout.layoutBox, o);
4401
+ if (n) {
4402
+ const a = n(Za(r));
4403
+ this.hasMutatedConstraints = !!a, a && (r = Ws(a));
4404
+ }
4405
+ return r;
4406
+ }
4407
+ startAnimation(e) {
4408
+ const { drag: n, dragMomentum: i, dragElastic: s, dragTransition: o, dragSnapToOrigin: r, onDragTransitionEnd: a } = this.getProps(), l = this.constraints || {}, c = U((u) => {
4409
+ if (!Nt(u, n, this.currentDirection))
4410
+ return;
4411
+ let h = l && l[u] || {};
4412
+ r && (h = { min: 0, max: 0 });
4413
+ const f = s ? 200 : 1e6, d = s ? 40 : 1e7, m = {
4414
+ type: "inertia",
4415
+ velocity: i ? e[u] : 0,
4416
+ bounceStiffness: f,
4417
+ bounceDamping: d,
4418
+ timeConstant: 750,
4419
+ restDelta: 1,
4420
+ restSpeed: 10,
4421
+ ...o,
4422
+ ...h
4423
+ };
4424
+ return this.startAxisValueAnimation(u, m);
4425
+ });
4426
+ return Promise.all(c).then(a);
4427
+ }
4428
+ startAxisValueAnimation(e, n) {
4429
+ const i = this.getAxisMotionValue(e);
4430
+ return Re(this.visualElement, e), i.start(an(e, i, 0, n, this.visualElement, !1));
4431
+ }
4432
+ stopAnimation() {
4433
+ U((e) => this.getAxisMotionValue(e).stop());
4434
+ }
4435
+ pauseAnimation() {
4436
+ U((e) => this.getAxisMotionValue(e).animation?.pause());
4437
+ }
4438
+ getAnimationState(e) {
4439
+ return this.getAxisMotionValue(e).animation?.state;
4440
+ }
4441
+ /**
4442
+ * Drag works differently depending on which props are provided.
4443
+ *
4444
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
4445
+ * - Otherwise, we apply the delta to the x/y motion values.
4446
+ */
4447
+ getAxisMotionValue(e) {
4448
+ const n = `_drag${e.toUpperCase()}`, i = this.visualElement.getProps(), s = i[n];
4449
+ return s || this.visualElement.getValue(e, (i.initial ? i.initial[e] : void 0) || 0);
4450
+ }
4451
+ snapToCursor(e) {
4452
+ U((n) => {
4453
+ const { drag: i } = this.getProps();
4454
+ if (!Nt(n, i, this.currentDirection))
4455
+ return;
4456
+ const { projection: s } = this.visualElement, o = this.getAxisMotionValue(n);
4457
+ if (s && s.layout) {
4458
+ const { min: r, max: a } = s.layout.layoutBox[n], l = o.get() || 0;
4459
+ o.set(e[n] - D(r, a, 0.5) + l);
4460
+ }
4461
+ });
4462
+ }
4463
+ /**
4464
+ * When the viewport resizes we want to check if the measured constraints
4465
+ * have changed and, if so, reposition the element within those new constraints
4466
+ * relative to where it was before the resize.
4467
+ */
4468
+ scalePositionWithinConstraints() {
4469
+ if (!this.visualElement.current)
4470
+ return;
4471
+ const { drag: e, dragConstraints: n } = this.getProps(), { projection: i } = this.visualElement;
4472
+ if (!bt(n) || !i || !this.constraints)
4473
+ return;
4474
+ this.stopAnimation();
4475
+ const s = { x: 0, y: 0 };
4476
+ U((r) => {
4477
+ const a = this.getAxisMotionValue(r);
4478
+ if (a && this.constraints !== !1) {
4479
+ const l = a.get();
4480
+ s[r] = Wu({ min: l, max: l }, this.constraints[r]);
4481
+ }
4482
+ });
4483
+ const { transformTemplate: o } = this.visualElement.getProps();
4484
+ this.visualElement.current.style.transform = o ? o({}, "") : "none", i.root && i.root.updateScroll(), i.updateLayout(), this.resolveConstraints(), U((r) => {
4485
+ if (!Nt(r, e, null))
4486
+ return;
4487
+ const a = this.getAxisMotionValue(r), { min: l, max: c } = this.constraints[r];
4488
+ a.set(D(l, c, s[r]));
4489
+ });
4490
+ }
4491
+ addListeners() {
4492
+ if (!this.visualElement.current)
4493
+ return;
4494
+ Gu.set(this.visualElement, this);
4495
+ const e = this.visualElement.current, n = Dt(e, "pointerdown", (l) => {
4496
+ const { drag: c, dragListener: u = !0 } = this.getProps();
4497
+ c && u && !Is(l.target) && this.start(l);
4498
+ }), i = () => {
4499
+ const { dragConstraints: l } = this.getProps();
4500
+ bt(l) && l.current && (this.constraints = this.resolveRefConstraints());
4501
+ }, { projection: s } = this.visualElement, o = s.addEventListener("measure", i);
4502
+ s && !s.layout && (s.root && s.root.updateScroll(), s.updateLayout()), V.read(i);
4503
+ const r = Lt(window, "resize", () => this.scalePositionWithinConstraints()), a = s.addEventListener("didUpdate", (({ delta: l, hasLayoutChanged: c }) => {
4504
+ this.isDragging && c && (U((u) => {
4505
+ const h = this.getAxisMotionValue(u);
4506
+ h && (this.originPoint[u] += l[u].translate, h.set(h.get() + l[u].translate));
4507
+ }), this.visualElement.render());
4508
+ }));
4509
+ return () => {
4510
+ r(), n(), o(), a && a();
4511
+ };
4512
+ }
4513
+ getProps() {
4514
+ const e = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: i = !1, dragPropagation: s = !1, dragConstraints: o = !1, dragElastic: r = je, dragMomentum: a = !0 } = e;
4515
+ return {
4516
+ ...e,
4517
+ drag: n,
4518
+ dragDirectionLock: i,
4519
+ dragPropagation: s,
4520
+ dragConstraints: o,
4521
+ dragElastic: r,
4522
+ dragMomentum: a
4523
+ };
4524
+ }
4525
+ }
4526
+ function Nt(t, e, n) {
4527
+ return (e === !0 || e === t) && (n === null || n === t);
4528
+ }
4529
+ function Hu(t, e = 10) {
4530
+ let n = null;
4531
+ return Math.abs(t.y) > e ? n = "y" : Math.abs(t.x) > e && (n = "x"), n;
4532
+ }
4533
+ class zu extends tt {
4534
+ constructor(e) {
4535
+ super(e), this.removeGroupControls = K, this.removeListeners = K, this.controls = new _u(e);
4536
+ }
4537
+ mount() {
4538
+ const { dragControls: e } = this.node.getProps();
4539
+ e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || K;
4540
+ }
4541
+ update() {
4542
+ const { dragControls: e } = this.node.getProps(), { dragControls: n } = this.node.prevProps || {};
4543
+ e !== n && (this.removeGroupControls(), e && (this.removeGroupControls = e.subscribe(this.controls)));
4544
+ }
4545
+ unmount() {
4546
+ this.removeGroupControls(), this.removeListeners();
4547
+ }
4548
+ }
4549
+ const Fi = (t) => (e, n) => {
4550
+ t && V.postRender(() => t(e, n));
4551
+ };
4552
+ class Yu extends tt {
4553
+ constructor() {
4554
+ super(...arguments), this.removePointerDownListener = K;
4555
+ }
4556
+ onPointerDown(e) {
4557
+ this.session = new Tr(e, this.createPanHandlers(), {
4558
+ transformPagePoint: this.node.getTransformPagePoint(),
4559
+ contextWindow: vr(this.node)
4560
+ });
4561
+ }
4562
+ createPanHandlers() {
4563
+ const { onPanSessionStart: e, onPanStart: n, onPan: i, onPanEnd: s } = this.node.getProps();
4564
+ return {
4565
+ onSessionStart: Fi(e),
4566
+ onStart: Fi(n),
4567
+ onMove: i,
4568
+ onEnd: (o, r) => {
4569
+ delete this.session, s && V.postRender(() => s(o, r));
4570
+ }
4571
+ };
4572
+ }
4573
+ mount() {
4574
+ this.removePointerDownListener = Dt(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
4575
+ }
4576
+ update() {
4577
+ this.session && this.session.updateHandlers(this.createPanHandlers());
4578
+ }
4579
+ unmount() {
4580
+ this.removePointerDownListener(), this.session && this.session.end();
4581
+ }
4582
+ }
4583
+ let pe = !1;
4584
+ class Xu extends Cr {
4585
+ /**
4586
+ * This only mounts projection nodes for components that
4587
+ * need measuring, we might want to do it for all components
4588
+ * in order to incorporate transforms
4589
+ */
4590
+ componentDidMount() {
4591
+ const { visualElement: e, layoutGroup: n, switchLayoutGroup: i, layoutId: s } = this.props, { projection: o } = e;
4592
+ o && (n.group && n.group.add(o), i && i.register && s && i.register(o), pe && o.root.didUpdate(), o.addEventListener("animationComplete", () => {
4593
+ this.safeToRemove();
4594
+ }), o.setOptions({
4595
+ ...o.options,
4596
+ onExitComplete: () => this.safeToRemove()
4597
+ })), $t.hasEverUpdated = !0;
4598
+ }
4599
+ getSnapshotBeforeUpdate(e) {
4600
+ const { layoutDependency: n, visualElement: i, drag: s, isPresent: o } = this.props, { projection: r } = i;
4601
+ return r && (r.isPresent = o, pe = !0, s || e.layoutDependency !== n || n === void 0 || e.isPresent !== o ? r.willUpdate() : this.safeToRemove(), e.isPresent !== o && (o ? r.promote() : r.relegate() || V.postRender(() => {
4602
+ const a = r.getStack();
4603
+ (!a || !a.members.length) && this.safeToRemove();
4604
+ }))), null;
4605
+ }
4606
+ componentDidUpdate() {
4607
+ const { projection: e } = this.props.visualElement;
4608
+ e && (e.root.didUpdate(), hn.postRender(() => {
4609
+ !e.currentAnimation && e.isLead() && this.safeToRemove();
4610
+ }));
4611
+ }
4612
+ componentWillUnmount() {
4613
+ const { visualElement: e, layoutGroup: n, switchLayoutGroup: i } = this.props, { projection: s } = e;
4614
+ pe = !0, s && (s.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(s), i && i.deregister && i.deregister(s));
4615
+ }
4616
+ safeToRemove() {
4617
+ const { safeToRemove: e } = this.props;
4618
+ e && e();
4619
+ }
4620
+ render() {
4621
+ return null;
4622
+ }
4623
+ }
4624
+ function Pr(t) {
4625
+ const [e, n] = iu(), i = O(Ui);
4626
+ return Ue(Xu, { ...t, layoutGroup: i, switchLayoutGroup: O(gr), isPresent: e, safeToRemove: n });
4627
+ }
4628
+ const qu = {
4629
+ pan: {
4630
+ Feature: Yu
4631
+ },
4632
+ drag: {
4633
+ Feature: zu,
4634
+ ProjectionNode: lr,
4635
+ MeasureLayout: Pr
4636
+ }
4637
+ };
4638
+ function Ii(t, e, n) {
4639
+ const { props: i } = t;
4640
+ t.animationState && i.whileHover && t.animationState.setActive("whileHover", n === "Start");
4641
+ const s = "onHover" + n, o = i[s];
4642
+ o && V.postRender(() => o(e, Bt(e)));
4643
+ }
4644
+ class Zu extends tt {
4645
+ mount() {
4646
+ const { current: e } = this.node;
4647
+ e && (this.unmount = ja(e, (n, i) => (Ii(this.node, i, "Start"), (s) => Ii(this.node, s, "End"))));
4648
+ }
4649
+ unmount() {
4650
+ }
4651
+ }
4652
+ class Ju extends tt {
4653
+ constructor() {
4654
+ super(...arguments), this.isActive = !1;
4655
+ }
4656
+ onFocus() {
4657
+ let e = !1;
4658
+ try {
4659
+ e = this.node.current.matches(":focus-visible");
4660
+ } catch {
4661
+ e = !0;
4662
+ }
4663
+ !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
4664
+ }
4665
+ onBlur() {
4666
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
4667
+ }
4668
+ mount() {
4669
+ this.unmount = kt(Lt(this.node.current, "focus", () => this.onFocus()), Lt(this.node.current, "blur", () => this.onBlur()));
4670
+ }
4671
+ unmount() {
4672
+ }
4673
+ }
4674
+ function Bi(t, e, n) {
4675
+ const { props: i } = t;
4676
+ if (t.current instanceof HTMLButtonElement && t.current.disabled)
4677
+ return;
4678
+ t.animationState && i.whileTap && t.animationState.setActive("whileTap", n === "Start");
4679
+ const s = "onTap" + (n === "End" ? "" : n), o = i[s];
4680
+ o && V.postRender(() => o(e, Bt(e)));
4681
+ }
4682
+ class Qu extends tt {
4683
+ mount() {
4684
+ const { current: e } = this.node;
4685
+ e && (this.unmount = Wa(e, (n, i) => (Bi(this.node, i, "Start"), (s, { success: o }) => Bi(this.node, s, o ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
4686
+ }
4687
+ unmount() {
4688
+ }
4689
+ }
4690
+ const Ne = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), tc = (t) => {
4691
+ const e = Ne.get(t.target);
4692
+ e && e(t);
4693
+ }, ec = (t) => {
4694
+ t.forEach(tc);
4695
+ };
4696
+ function nc({ root: t, ...e }) {
4697
+ const n = t || document;
4698
+ ge.has(n) || ge.set(n, {});
4699
+ const i = ge.get(n), s = JSON.stringify(e);
4700
+ return i[s] || (i[s] = new IntersectionObserver(ec, { root: t, ...e })), i[s];
4701
+ }
4702
+ function ic(t, e, n) {
4703
+ const i = nc(e);
4704
+ return Ne.set(t, n), i.observe(t), () => {
4705
+ Ne.delete(t), i.unobserve(t);
4706
+ };
4707
+ }
4708
+ const sc = {
4709
+ some: 0,
4710
+ all: 1
4711
+ };
4712
+ class rc extends tt {
4713
+ constructor() {
4714
+ super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
4715
+ }
4716
+ startObserver() {
4717
+ this.unmount();
4718
+ const { viewport: e = {} } = this.node.getProps(), { root: n, margin: i, amount: s = "some", once: o } = e, r = {
4719
+ root: n ? n.current : void 0,
4720
+ rootMargin: i,
4721
+ threshold: typeof s == "number" ? s : sc[s]
4722
+ }, a = (l) => {
4723
+ const { isIntersecting: c } = l;
4724
+ if (this.isInView === c || (this.isInView = c, o && !c && this.hasEnteredView))
4725
+ return;
4726
+ c && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", c);
4727
+ const { onViewportEnter: u, onViewportLeave: h } = this.node.getProps(), f = c ? u : h;
4728
+ f && f(l);
4729
+ };
4730
+ return ic(this.node.current, r, a);
4731
+ }
4732
+ mount() {
4733
+ this.startObserver();
4734
+ }
4735
+ update() {
4736
+ if (typeof IntersectionObserver > "u")
4737
+ return;
4738
+ const { props: e, prevProps: n } = this.node;
4739
+ ["amount", "margin", "root"].some(oc(e, n)) && this.startObserver();
4740
+ }
4741
+ unmount() {
4742
+ }
4743
+ }
4744
+ function oc({ viewport: t = {} }, { viewport: e = {} } = {}) {
4745
+ return (n) => t[n] !== e[n];
4746
+ }
4747
+ const ac = {
4748
+ inView: {
4749
+ Feature: rc
4750
+ },
4751
+ tap: {
4752
+ Feature: Qu
4753
+ },
4754
+ focus: {
4755
+ Feature: Ju
4756
+ },
4757
+ hover: {
4758
+ Feature: Zu
4759
+ }
4760
+ }, lc = {
4761
+ layout: {
4762
+ ProjectionNode: lr,
4763
+ MeasureLayout: Pr
4764
+ }
4765
+ }, uc = {
4766
+ ...ku,
4767
+ ...ac,
4768
+ ...qu,
4769
+ ...lc
4770
+ }, cc = /* @__PURE__ */ Mu(uc, Cu);
4771
+ function pc({ children: t }) {
4772
+ return /* @__PURE__ */ Ue(
4773
+ cc.div,
4774
+ {
4775
+ initial: { opacity: 0, y: 50 },
4776
+ whileInView: { opacity: 1, y: 0 },
4777
+ viewport: { once: !0, amount: 0.5 },
4778
+ transition: { duration: 0.8 },
4779
+ children: t
4780
+ }
4781
+ );
4782
+ }
4783
+ export {
4784
+ pc as default
4785
+ };