@telegraph/tag 0.0.90 → 0.0.92

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