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