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