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