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