@infinilabs/filter 0.0.0
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/README.md +31 -0
- package/dist/filter.cjs +14 -0
- package/dist/filter.js +4709 -0
- package/dist/index.d.ts +64 -0
- package/package.json +50 -0
package/dist/filter.js
ADDED
|
@@ -0,0 +1,4709 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Children, Component, Fragment, createContext, createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { BrushCleaning, ChevronDown, SquareMinus, SquarePlus } from "lucide-react";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
import { Checkbox, ColorPicker, Input, Select, Slider } from "antd";
|
|
7
|
+
var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __hasOwnProp = Object.prototype.hasOwnProperty, __esmMin = (e, _) => () => (e && (_ = e(e = 0)), _), __commonJSMin = (e, _) => () => (_ || e((_ = { exports: {} }).exports, _), _.exports), __export = (e) => {
|
|
8
|
+
let _ = {};
|
|
9
|
+
for (var v in e) __defProp(_, v, {
|
|
10
|
+
get: e[v],
|
|
11
|
+
enumerable: !0
|
|
12
|
+
});
|
|
13
|
+
return _;
|
|
14
|
+
}, __copyProps = (e, _, v, y) => {
|
|
15
|
+
if (_ && typeof _ == "object" || typeof _ == "function") for (var b = __getOwnPropNames(_), x = 0, S = b.length, C; x < S; x++) C = b[x], !__hasOwnProp.call(e, C) && C !== v && __defProp(e, C, {
|
|
16
|
+
get: ((e) => _[e]).bind(null, C),
|
|
17
|
+
enumerable: !(y = __getOwnPropDesc(_, C)) || y.enumerable
|
|
18
|
+
});
|
|
19
|
+
return e;
|
|
20
|
+
}, __toCommonJS = (e) => __copyProps(__defProp({}, "__esModule", { value: !0 }), e), __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, _) => (typeof require < "u" ? require : e)[_] }) : e)(function(e) {
|
|
21
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
22
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function.");
|
|
23
|
+
}), require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
24
|
+
var _ = Symbol.for("react.transitional.element"), v = Symbol.for("react.fragment");
|
|
25
|
+
function y(e, v, y) {
|
|
26
|
+
var b = null;
|
|
27
|
+
if (y !== void 0 && (b = "" + y), v.key !== void 0 && (b = "" + v.key), "key" in v) for (var x in y = {}, v) x !== "key" && (y[x] = v[x]);
|
|
28
|
+
else y = v;
|
|
29
|
+
return v = y.ref, {
|
|
30
|
+
$$typeof: _,
|
|
31
|
+
type: e,
|
|
32
|
+
key: b,
|
|
33
|
+
ref: v === void 0 ? null : v,
|
|
34
|
+
props: y
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
e.Fragment = v, e.jsx = y, e.jsxs = y;
|
|
38
|
+
})), require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
39
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
40
|
+
function _(e) {
|
|
41
|
+
if (e == null) return null;
|
|
42
|
+
if (typeof e == "function") return e.$$typeof === W ? null : e.displayName || e.name || null;
|
|
43
|
+
if (typeof e == "string") return e;
|
|
44
|
+
switch (e) {
|
|
45
|
+
case N: return "Fragment";
|
|
46
|
+
case F: return "Profiler";
|
|
47
|
+
case P: return "StrictMode";
|
|
48
|
+
case z: return "Suspense";
|
|
49
|
+
case B: return "SuspenseList";
|
|
50
|
+
case U: return "Activity";
|
|
51
|
+
}
|
|
52
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
53
|
+
case M: return "Portal";
|
|
54
|
+
case L: return e.displayName || "Context";
|
|
55
|
+
case I: return (e._context.displayName || "Context") + ".Consumer";
|
|
56
|
+
case R:
|
|
57
|
+
var v = e.render;
|
|
58
|
+
return e = e.displayName, e ||= (e = v.displayName || v.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
59
|
+
case V: return v = e.displayName || null, v === null ? _(e.type) || "Memo" : v;
|
|
60
|
+
case H:
|
|
61
|
+
v = e._payload, e = e._init;
|
|
62
|
+
try {
|
|
63
|
+
return _(e(v));
|
|
64
|
+
} catch {}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function v(e) {
|
|
69
|
+
return "" + e;
|
|
70
|
+
}
|
|
71
|
+
function y(e) {
|
|
72
|
+
try {
|
|
73
|
+
v(e);
|
|
74
|
+
var _ = !1;
|
|
75
|
+
} catch {
|
|
76
|
+
_ = !0;
|
|
77
|
+
}
|
|
78
|
+
if (_) {
|
|
79
|
+
_ = console;
|
|
80
|
+
var y = _.error, b = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
81
|
+
return y.call(_, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", b), v(e);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function b(e) {
|
|
85
|
+
if (e === N) return "<>";
|
|
86
|
+
if (typeof e == "object" && e && e.$$typeof === H) return "<...>";
|
|
87
|
+
try {
|
|
88
|
+
var v = _(e);
|
|
89
|
+
return v ? "<" + v + ">" : "<...>";
|
|
90
|
+
} catch {
|
|
91
|
+
return "<...>";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function x() {
|
|
95
|
+
var e = G.A;
|
|
96
|
+
return e === null ? null : e.getOwner();
|
|
97
|
+
}
|
|
98
|
+
function S() {
|
|
99
|
+
return Error("react-stack-top-frame");
|
|
100
|
+
}
|
|
101
|
+
function C(e) {
|
|
102
|
+
if (K.call(e, "key")) {
|
|
103
|
+
var _ = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
104
|
+
if (_ && _.isReactWarning) return !1;
|
|
105
|
+
}
|
|
106
|
+
return e.key !== void 0;
|
|
107
|
+
}
|
|
108
|
+
function w(e, _) {
|
|
109
|
+
function v() {
|
|
110
|
+
Y || (Y = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", _));
|
|
111
|
+
}
|
|
112
|
+
v.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
113
|
+
get: v,
|
|
114
|
+
configurable: !0
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function T() {
|
|
118
|
+
var e = _(this.type);
|
|
119
|
+
return X[e] || (X[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
120
|
+
}
|
|
121
|
+
function E(e, _, v, y, b, x) {
|
|
122
|
+
var S = v.ref;
|
|
123
|
+
return e = {
|
|
124
|
+
$$typeof: j,
|
|
125
|
+
type: e,
|
|
126
|
+
key: _,
|
|
127
|
+
props: v,
|
|
128
|
+
_owner: y
|
|
129
|
+
}, (S === void 0 ? null : S) === null ? Object.defineProperty(e, "ref", {
|
|
130
|
+
enumerable: !1,
|
|
131
|
+
value: null
|
|
132
|
+
}) : Object.defineProperty(e, "ref", {
|
|
133
|
+
enumerable: !1,
|
|
134
|
+
get: T
|
|
135
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
136
|
+
configurable: !1,
|
|
137
|
+
enumerable: !1,
|
|
138
|
+
writable: !0,
|
|
139
|
+
value: 0
|
|
140
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
141
|
+
configurable: !1,
|
|
142
|
+
enumerable: !1,
|
|
143
|
+
writable: !0,
|
|
144
|
+
value: null
|
|
145
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
146
|
+
configurable: !1,
|
|
147
|
+
enumerable: !1,
|
|
148
|
+
writable: !0,
|
|
149
|
+
value: b
|
|
150
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
151
|
+
configurable: !1,
|
|
152
|
+
enumerable: !1,
|
|
153
|
+
writable: !0,
|
|
154
|
+
value: x
|
|
155
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
156
|
+
}
|
|
157
|
+
function D(e, v, b, S, T, D) {
|
|
158
|
+
var k = v.children;
|
|
159
|
+
if (k !== void 0) if (S) if (q(k)) {
|
|
160
|
+
for (S = 0; S < k.length; S++) O(k[S]);
|
|
161
|
+
Object.freeze && Object.freeze(k);
|
|
162
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
163
|
+
else O(k);
|
|
164
|
+
if (K.call(v, "key")) {
|
|
165
|
+
k = _(e);
|
|
166
|
+
var A = Object.keys(v).filter(function(e) {
|
|
167
|
+
return e !== "key";
|
|
168
|
+
});
|
|
169
|
+
S = 0 < A.length ? "{key: someKey, " + A.join(": ..., ") + ": ...}" : "{key: someKey}", $[k + S] || (A = 0 < A.length ? "{" + A.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", S, k, A, k), $[k + S] = !0);
|
|
170
|
+
}
|
|
171
|
+
if (k = null, b !== void 0 && (y(b), k = "" + b), C(v) && (y(v.key), k = "" + v.key), "key" in v) for (var j in b = {}, v) j !== "key" && (b[j] = v[j]);
|
|
172
|
+
else b = v;
|
|
173
|
+
return k && w(b, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), E(e, k, b, x(), T, D);
|
|
174
|
+
}
|
|
175
|
+
function O(e) {
|
|
176
|
+
k(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === H && (e._payload.status === "fulfilled" ? k(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
177
|
+
}
|
|
178
|
+
function k(e) {
|
|
179
|
+
return typeof e == "object" && !!e && e.$$typeof === j;
|
|
180
|
+
}
|
|
181
|
+
var A = __require("react"), j = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), I = Symbol.for("react.consumer"), L = Symbol.for("react.context"), R = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), V = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), U = Symbol.for("react.activity"), W = Symbol.for("react.client.reference"), G = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, q = Array.isArray, J = console.createTask ? console.createTask : function() {
|
|
182
|
+
return null;
|
|
183
|
+
};
|
|
184
|
+
A = { react_stack_bottom_frame: function(e) {
|
|
185
|
+
return e();
|
|
186
|
+
} };
|
|
187
|
+
var Y, X = {}, Z = A.react_stack_bottom_frame.bind(A, S)(), Q = J(b(S)), $ = {};
|
|
188
|
+
e.Fragment = N, e.jsx = function(e, _, v) {
|
|
189
|
+
var y = 1e4 > G.recentlyCreatedOwnerStacks++;
|
|
190
|
+
return D(e, _, v, !1, y ? Error("react-stack-top-frame") : Z, y ? J(b(e)) : Q);
|
|
191
|
+
}, e.jsxs = function(e, _, v) {
|
|
192
|
+
var y = 1e4 > G.recentlyCreatedOwnerStacks++;
|
|
193
|
+
return D(e, _, v, !0, y ? Error("react-stack-top-frame") : Z, y ? J(b(e)) : Q);
|
|
194
|
+
};
|
|
195
|
+
})();
|
|
196
|
+
})), require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((e, _) => {
|
|
197
|
+
process.env.NODE_ENV === "production" ? _.exports = require_react_jsx_runtime_production() : _.exports = require_react_jsx_runtime_development();
|
|
198
|
+
})), LayoutGroupContext = createContext({});
|
|
199
|
+
function useConstant(e) {
|
|
200
|
+
let _ = useRef(null);
|
|
201
|
+
return _.current === null && (_.current = e()), _.current;
|
|
202
|
+
}
|
|
203
|
+
var isBrowser = typeof window < "u", useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect, PresenceContext = /* @__PURE__ */ createContext(null);
|
|
204
|
+
function addUniqueItem(e, _) {
|
|
205
|
+
e.indexOf(_) === -1 && e.push(_);
|
|
206
|
+
}
|
|
207
|
+
function removeItem(e, _) {
|
|
208
|
+
let v = e.indexOf(_);
|
|
209
|
+
v > -1 && e.splice(v, 1);
|
|
210
|
+
}
|
|
211
|
+
var clamp = (e, _, v) => v > _ ? _ : v < e ? e : v;
|
|
212
|
+
function formatErrorMessage(e, _) {
|
|
213
|
+
return _ ? `${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${_}` : e;
|
|
214
|
+
}
|
|
215
|
+
var warning = () => {}, invariant = () => {};
|
|
216
|
+
process.env.NODE_ENV !== "production" && (warning = (e, _, v) => {
|
|
217
|
+
!e && typeof console < "u" && console.warn(formatErrorMessage(_, v));
|
|
218
|
+
}, invariant = (e, _, v) => {
|
|
219
|
+
if (!e) throw Error(formatErrorMessage(_, v));
|
|
220
|
+
});
|
|
221
|
+
var MotionGlobalConfig = {}, isNumericalString = (e) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);
|
|
222
|
+
function isObject(e) {
|
|
223
|
+
return typeof e == "object" && !!e;
|
|
224
|
+
}
|
|
225
|
+
var isZeroValueString = (e) => /^0[^.\s]+$/u.test(e);
|
|
226
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
227
|
+
function memo(e) {
|
|
228
|
+
let _;
|
|
229
|
+
return () => (_ === void 0 && (_ = e()), _);
|
|
230
|
+
}
|
|
231
|
+
var noop = /* @__NO_SIDE_EFFECTS__ */ (e) => e, combineFunctions = (e, _) => (v) => _(e(v)), pipe = (...e) => e.reduce(combineFunctions), progress = /* @__NO_SIDE_EFFECTS__ */ (e, _, v) => {
|
|
232
|
+
let y = _ - e;
|
|
233
|
+
return y === 0 ? 1 : (v - e) / y;
|
|
234
|
+
}, SubscriptionManager = class {
|
|
235
|
+
constructor() {
|
|
236
|
+
this.subscriptions = [];
|
|
237
|
+
}
|
|
238
|
+
add(e) {
|
|
239
|
+
return addUniqueItem(this.subscriptions, e), () => removeItem(this.subscriptions, e);
|
|
240
|
+
}
|
|
241
|
+
notify(e, _, v) {
|
|
242
|
+
let y = this.subscriptions.length;
|
|
243
|
+
if (y) if (y === 1) this.subscriptions[0](e, _, v);
|
|
244
|
+
else for (let b = 0; b < y; b++) {
|
|
245
|
+
let y = this.subscriptions[b];
|
|
246
|
+
y && y(e, _, v);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
getSize() {
|
|
250
|
+
return this.subscriptions.length;
|
|
251
|
+
}
|
|
252
|
+
clear() {
|
|
253
|
+
this.subscriptions.length = 0;
|
|
254
|
+
}
|
|
255
|
+
}, secondsToMilliseconds = /* @__NO_SIDE_EFFECTS__ */ (e) => e * 1e3, millisecondsToSeconds = /* @__NO_SIDE_EFFECTS__ */ (e) => e / 1e3;
|
|
256
|
+
function velocityPerSecond(e, _) {
|
|
257
|
+
return _ ? e * (1e3 / _) : 0;
|
|
258
|
+
}
|
|
259
|
+
var warned = /* @__PURE__ */ new Set();
|
|
260
|
+
function warnOnce(e, _, v) {
|
|
261
|
+
e || warned.has(_) || (console.warn(formatErrorMessage(_, v)), warned.add(_));
|
|
262
|
+
}
|
|
263
|
+
var calcBezier = (e, _, v) => (((1 - 3 * v + 3 * _) * e + (3 * v - 6 * _)) * e + 3 * _) * e, subdivisionPrecision = 1e-7, subdivisionMaxIterations = 12;
|
|
264
|
+
function binarySubdivide(e, _, v, y, b) {
|
|
265
|
+
let x, S, C = 0;
|
|
266
|
+
do
|
|
267
|
+
S = _ + (v - _) / 2, x = calcBezier(S, y, b) - e, x > 0 ? v = S : _ = S;
|
|
268
|
+
while (Math.abs(x) > subdivisionPrecision && ++C < subdivisionMaxIterations);
|
|
269
|
+
return S;
|
|
270
|
+
}
|
|
271
|
+
function cubicBezier(e, _, v, y) {
|
|
272
|
+
if (e === _ && v === y) return noop;
|
|
273
|
+
let b = (_) => binarySubdivide(_, 0, 1, e, v);
|
|
274
|
+
return (e) => e === 0 || e === 1 ? e : calcBezier(b(e), _, y);
|
|
275
|
+
}
|
|
276
|
+
var mirrorEasing = (e) => (_) => _ <= .5 ? e(2 * _) / 2 : (2 - e(2 * (1 - _))) / 2, reverseEasing = (e) => (_) => 1 - e(1 - _), backOut = /* @__PURE__ */ cubicBezier(.33, 1.53, .69, .99), backIn = /* @__PURE__ */ reverseEasing(backOut), backInOut = /* @__PURE__ */ mirrorEasing(backIn), anticipate = (e) => (e *= 2) < 1 ? .5 * backIn(e) : .5 * (2 - 2 ** (-10 * (e - 1))), circIn = (e) => 1 - Math.sin(Math.acos(e)), circOut = reverseEasing(circIn), circInOut = mirrorEasing(circIn), easeIn = /* @__PURE__ */ cubicBezier(.42, 0, 1, 1), easeOut = /* @__PURE__ */ cubicBezier(0, 0, .58, 1), easeInOut = /* @__PURE__ */ cubicBezier(.42, 0, .58, 1), isEasingArray = (e) => Array.isArray(e) && typeof e[0] != "number", isBezierDefinition = (e) => Array.isArray(e) && typeof e[0] == "number", easingLookup = {
|
|
277
|
+
linear: noop,
|
|
278
|
+
easeIn,
|
|
279
|
+
easeInOut,
|
|
280
|
+
easeOut,
|
|
281
|
+
circIn,
|
|
282
|
+
circInOut,
|
|
283
|
+
circOut,
|
|
284
|
+
backIn,
|
|
285
|
+
backInOut,
|
|
286
|
+
backOut,
|
|
287
|
+
anticipate
|
|
288
|
+
}, isValidEasing = (e) => typeof e == "string", easingDefinitionToFunction = (e) => {
|
|
289
|
+
if (isBezierDefinition(e)) {
|
|
290
|
+
invariant(e.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
|
|
291
|
+
let [_, v, y, b] = e;
|
|
292
|
+
return cubicBezier(_, v, y, b);
|
|
293
|
+
} else if (isValidEasing(e)) return invariant(easingLookup[e] !== void 0, `Invalid easing type '${e}'`, "invalid-easing-type"), easingLookup[e];
|
|
294
|
+
return e;
|
|
295
|
+
}, stepsOrder = [
|
|
296
|
+
"setup",
|
|
297
|
+
"read",
|
|
298
|
+
"resolveKeyframes",
|
|
299
|
+
"preUpdate",
|
|
300
|
+
"update",
|
|
301
|
+
"preRender",
|
|
302
|
+
"render",
|
|
303
|
+
"postRender"
|
|
304
|
+
], statsBuffer = {
|
|
305
|
+
value: null,
|
|
306
|
+
addProjectionMetrics: null
|
|
307
|
+
};
|
|
308
|
+
function createRenderStep(e, _) {
|
|
309
|
+
let v = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), b = !1, x = !1, S = /* @__PURE__ */ new WeakSet(), C = {
|
|
310
|
+
delta: 0,
|
|
311
|
+
timestamp: 0,
|
|
312
|
+
isProcessing: !1
|
|
313
|
+
}, w = 0;
|
|
314
|
+
function T(_) {
|
|
315
|
+
S.has(_) && (E.schedule(_), e()), w++, _(C);
|
|
316
|
+
}
|
|
317
|
+
let E = {
|
|
318
|
+
schedule: (e, _ = !1, x = !1) => {
|
|
319
|
+
let C = x && b ? v : y;
|
|
320
|
+
return _ && S.add(e), C.has(e) || C.add(e), e;
|
|
321
|
+
},
|
|
322
|
+
cancel: (e) => {
|
|
323
|
+
y.delete(e), S.delete(e);
|
|
324
|
+
},
|
|
325
|
+
process: (e) => {
|
|
326
|
+
if (C = e, b) {
|
|
327
|
+
x = !0;
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
b = !0, [v, y] = [y, v], v.forEach(T), _ && statsBuffer.value && statsBuffer.value.frameloop[_].push(w), w = 0, v.clear(), b = !1, x && (x = !1, E.process(e));
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
return E;
|
|
334
|
+
}
|
|
335
|
+
var maxElapsed = 40;
|
|
336
|
+
function createRenderBatcher(e, _) {
|
|
337
|
+
let v = !1, y = !0, b = {
|
|
338
|
+
delta: 0,
|
|
339
|
+
timestamp: 0,
|
|
340
|
+
isProcessing: !1
|
|
341
|
+
}, x = () => v = !0, S = stepsOrder.reduce((e, v) => (e[v] = createRenderStep(x, _ ? v : void 0), e), {}), { setup: C, read: w, resolveKeyframes: T, preUpdate: E, update: D, preRender: O, render: k, postRender: A } = S, j = () => {
|
|
342
|
+
let x = MotionGlobalConfig.useManualTiming ? b.timestamp : performance.now();
|
|
343
|
+
v = !1, MotionGlobalConfig.useManualTiming || (b.delta = y ? 1e3 / 60 : Math.max(Math.min(x - b.timestamp, maxElapsed), 1)), b.timestamp = x, b.isProcessing = !0, C.process(b), w.process(b), T.process(b), E.process(b), D.process(b), O.process(b), k.process(b), A.process(b), b.isProcessing = !1, v && _ && (y = !1, e(j));
|
|
344
|
+
}, M = () => {
|
|
345
|
+
v = !0, y = !0, b.isProcessing || e(j);
|
|
346
|
+
};
|
|
347
|
+
return {
|
|
348
|
+
schedule: stepsOrder.reduce((e, _) => {
|
|
349
|
+
let y = S[_];
|
|
350
|
+
return e[_] = (e, _ = !1, b = !1) => (v || M(), y.schedule(e, _, b)), e;
|
|
351
|
+
}, {}),
|
|
352
|
+
cancel: (e) => {
|
|
353
|
+
for (let _ = 0; _ < stepsOrder.length; _++) S[stepsOrder[_]].cancel(e);
|
|
354
|
+
},
|
|
355
|
+
state: b,
|
|
356
|
+
steps: S
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
var { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame < "u" ? requestAnimationFrame : noop, !0), now;
|
|
360
|
+
function clearTime() {
|
|
361
|
+
now = void 0;
|
|
362
|
+
}
|
|
363
|
+
var time = {
|
|
364
|
+
now: () => (now === void 0 && time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now()), now),
|
|
365
|
+
set: (e) => {
|
|
366
|
+
now = e, queueMicrotask(clearTime);
|
|
367
|
+
}
|
|
368
|
+
}, activeAnimations = {
|
|
369
|
+
layout: 0,
|
|
370
|
+
mainThread: 0,
|
|
371
|
+
waapi: 0
|
|
372
|
+
}, checkStringStartsWith = (e) => (_) => typeof _ == "string" && _.startsWith(e), isCSSVariableName = /* @__PURE__ */ checkStringStartsWith("--"), startsAsVariableToken = /* @__PURE__ */ checkStringStartsWith("var(--"), isCSSVariableToken = (e) => startsAsVariableToken(e) ? singleCssVariableRegex.test(e.split("/*")[0].trim()) : !1, singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, number = {
|
|
373
|
+
test: (e) => typeof e == "number",
|
|
374
|
+
parse: parseFloat,
|
|
375
|
+
transform: (e) => e
|
|
376
|
+
}, alpha = {
|
|
377
|
+
...number,
|
|
378
|
+
transform: (e) => clamp(0, 1, e)
|
|
379
|
+
}, scale = {
|
|
380
|
+
...number,
|
|
381
|
+
default: 1
|
|
382
|
+
}, sanitize = (e) => Math.round(e * 1e5) / 1e5, floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
|
|
383
|
+
function isNullish(e) {
|
|
384
|
+
return e == null;
|
|
385
|
+
}
|
|
386
|
+
var singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, isColorString = (e, _) => (v) => !!(typeof v == "string" && singleColorRegex.test(v) && v.startsWith(e) || _ && !isNullish(v) && Object.prototype.hasOwnProperty.call(v, _)), splitColor = (e, _, v) => (y) => {
|
|
387
|
+
if (typeof y != "string") return y;
|
|
388
|
+
let [b, x, S, C] = y.match(floatRegex);
|
|
389
|
+
return {
|
|
390
|
+
[e]: parseFloat(b),
|
|
391
|
+
[_]: parseFloat(x),
|
|
392
|
+
[v]: parseFloat(S),
|
|
393
|
+
alpha: C === void 0 ? 1 : parseFloat(C)
|
|
394
|
+
};
|
|
395
|
+
}, clampRgbUnit = (e) => clamp(0, 255, e), rgbUnit = {
|
|
396
|
+
...number,
|
|
397
|
+
transform: (e) => Math.round(clampRgbUnit(e))
|
|
398
|
+
}, rgba = {
|
|
399
|
+
test: /* @__PURE__ */ isColorString("rgb", "red"),
|
|
400
|
+
parse: /* @__PURE__ */ splitColor("red", "green", "blue"),
|
|
401
|
+
transform: ({ red: e, green: _, blue: v, alpha: y = 1 }) => "rgba(" + rgbUnit.transform(e) + ", " + rgbUnit.transform(_) + ", " + rgbUnit.transform(v) + ", " + sanitize(alpha.transform(y)) + ")"
|
|
402
|
+
};
|
|
403
|
+
function parseHex(e) {
|
|
404
|
+
let _ = "", v = "", y = "", b = "";
|
|
405
|
+
return e.length > 5 ? (_ = e.substring(1, 3), v = e.substring(3, 5), y = e.substring(5, 7), b = e.substring(7, 9)) : (_ = e.substring(1, 2), v = e.substring(2, 3), y = e.substring(3, 4), b = e.substring(4, 5), _ += _, v += v, y += y, b += b), {
|
|
406
|
+
red: parseInt(_, 16),
|
|
407
|
+
green: parseInt(v, 16),
|
|
408
|
+
blue: parseInt(y, 16),
|
|
409
|
+
alpha: b ? parseInt(b, 16) / 255 : 1
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
var hex = {
|
|
413
|
+
test: /* @__PURE__ */ isColorString("#"),
|
|
414
|
+
parse: parseHex,
|
|
415
|
+
transform: rgba.transform
|
|
416
|
+
}, createUnitType = /* @__NO_SIDE_EFFECTS__ */ (e) => ({
|
|
417
|
+
test: (_) => typeof _ == "string" && _.endsWith(e) && _.split(" ").length === 1,
|
|
418
|
+
parse: parseFloat,
|
|
419
|
+
transform: (_) => `${_}${e}`
|
|
420
|
+
}), degrees = /* @__PURE__ */ createUnitType("deg"), percent = /* @__PURE__ */ createUnitType("%"), px = /* @__PURE__ */ createUnitType("px"), vh = /* @__PURE__ */ createUnitType("vh"), vw = /* @__PURE__ */ createUnitType("vw"), progressPercentage = /* @__PURE__ */ (() => ({
|
|
421
|
+
...percent,
|
|
422
|
+
parse: (e) => percent.parse(e) / 100,
|
|
423
|
+
transform: (e) => percent.transform(e * 100)
|
|
424
|
+
}))(), hsla = {
|
|
425
|
+
test: /* @__PURE__ */ isColorString("hsl", "hue"),
|
|
426
|
+
parse: /* @__PURE__ */ splitColor("hue", "saturation", "lightness"),
|
|
427
|
+
transform: ({ hue: e, saturation: _, lightness: v, alpha: y = 1 }) => "hsla(" + Math.round(e) + ", " + percent.transform(sanitize(_)) + ", " + percent.transform(sanitize(v)) + ", " + sanitize(alpha.transform(y)) + ")"
|
|
428
|
+
}, color = {
|
|
429
|
+
test: (e) => rgba.test(e) || hex.test(e) || hsla.test(e),
|
|
430
|
+
parse: (e) => rgba.test(e) ? rgba.parse(e) : hsla.test(e) ? hsla.parse(e) : hex.parse(e),
|
|
431
|
+
transform: (e) => typeof e == "string" ? e : e.hasOwnProperty("red") ? rgba.transform(e) : hsla.transform(e),
|
|
432
|
+
getAnimatableNone: (e) => {
|
|
433
|
+
let _ = color.parse(e);
|
|
434
|
+
return _.alpha = 0, color.transform(_);
|
|
435
|
+
}
|
|
436
|
+
}, colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
|
|
437
|
+
function test(e) {
|
|
438
|
+
return isNaN(e) && typeof e == "string" && (e.match(floatRegex)?.length || 0) + (e.match(colorRegex)?.length || 0) > 0;
|
|
439
|
+
}
|
|
440
|
+
var NUMBER_TOKEN = "number", COLOR_TOKEN = "color", VAR_TOKEN = "var", VAR_FUNCTION_TOKEN = "var(", SPLIT_TOKEN = "${}", complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
|
|
441
|
+
function analyseComplexValue(e) {
|
|
442
|
+
let _ = e.toString(), v = [], y = {
|
|
443
|
+
color: [],
|
|
444
|
+
number: [],
|
|
445
|
+
var: []
|
|
446
|
+
}, b = [], x = 0;
|
|
447
|
+
return {
|
|
448
|
+
values: v,
|
|
449
|
+
split: _.replace(complexRegex, (e) => (color.test(e) ? (y.color.push(x), b.push(COLOR_TOKEN), v.push(color.parse(e))) : e.startsWith(VAR_FUNCTION_TOKEN) ? (y.var.push(x), b.push(VAR_TOKEN), v.push(e)) : (y.number.push(x), b.push(NUMBER_TOKEN), v.push(parseFloat(e))), ++x, SPLIT_TOKEN)).split(SPLIT_TOKEN),
|
|
450
|
+
indexes: y,
|
|
451
|
+
types: b
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function parseComplexValue(e) {
|
|
455
|
+
return analyseComplexValue(e).values;
|
|
456
|
+
}
|
|
457
|
+
function createTransformer(e) {
|
|
458
|
+
let { split: _, types: v } = analyseComplexValue(e), y = _.length;
|
|
459
|
+
return (e) => {
|
|
460
|
+
let b = "";
|
|
461
|
+
for (let x = 0; x < y; x++) if (b += _[x], e[x] !== void 0) {
|
|
462
|
+
let _ = v[x];
|
|
463
|
+
_ === NUMBER_TOKEN ? b += sanitize(e[x]) : _ === COLOR_TOKEN ? b += color.transform(e[x]) : b += e[x];
|
|
464
|
+
}
|
|
465
|
+
return b;
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
var convertNumbersToZero = (e) => typeof e == "number" ? 0 : color.test(e) ? color.getAnimatableNone(e) : e;
|
|
469
|
+
function getAnimatableNone$1(e) {
|
|
470
|
+
let _ = parseComplexValue(e);
|
|
471
|
+
return createTransformer(e)(_.map(convertNumbersToZero));
|
|
472
|
+
}
|
|
473
|
+
var complex = {
|
|
474
|
+
test,
|
|
475
|
+
parse: parseComplexValue,
|
|
476
|
+
createTransformer,
|
|
477
|
+
getAnimatableNone: getAnimatableNone$1
|
|
478
|
+
};
|
|
479
|
+
function hueToRgb(e, _, v) {
|
|
480
|
+
return v < 0 && (v += 1), v > 1 && --v, v < 1 / 6 ? e + (_ - e) * 6 * v : v < 1 / 2 ? _ : v < 2 / 3 ? e + (_ - e) * (2 / 3 - v) * 6 : e;
|
|
481
|
+
}
|
|
482
|
+
function hslaToRgba({ hue: e, saturation: _, lightness: v, alpha: y }) {
|
|
483
|
+
e /= 360, _ /= 100, v /= 100;
|
|
484
|
+
let b = 0, x = 0, S = 0;
|
|
485
|
+
if (!_) b = x = S = v;
|
|
486
|
+
else {
|
|
487
|
+
let y = v < .5 ? v * (1 + _) : v + _ - v * _, C = 2 * v - y;
|
|
488
|
+
b = hueToRgb(C, y, e + 1 / 3), x = hueToRgb(C, y, e), S = hueToRgb(C, y, e - 1 / 3);
|
|
489
|
+
}
|
|
490
|
+
return {
|
|
491
|
+
red: Math.round(b * 255),
|
|
492
|
+
green: Math.round(x * 255),
|
|
493
|
+
blue: Math.round(S * 255),
|
|
494
|
+
alpha: y
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function mixImmediate(e, _) {
|
|
498
|
+
return (v) => v > 0 ? _ : e;
|
|
499
|
+
}
|
|
500
|
+
var mixNumber = (e, _, v) => e + (_ - e) * v, mixLinearColor = (e, _, v) => {
|
|
501
|
+
let y = e * e, b = v * (_ * _ - y) + y;
|
|
502
|
+
return b < 0 ? 0 : Math.sqrt(b);
|
|
503
|
+
}, colorTypes = [
|
|
504
|
+
hex,
|
|
505
|
+
rgba,
|
|
506
|
+
hsla
|
|
507
|
+
], getColorType = (e) => colorTypes.find((_) => _.test(e));
|
|
508
|
+
function asRGBA(e) {
|
|
509
|
+
let _ = getColorType(e);
|
|
510
|
+
if (warning(!!_, `'${e}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !_) return !1;
|
|
511
|
+
let v = _.parse(e);
|
|
512
|
+
return _ === hsla && (v = hslaToRgba(v)), v;
|
|
513
|
+
}
|
|
514
|
+
var mixColor = (e, _) => {
|
|
515
|
+
let v = asRGBA(e), y = asRGBA(_);
|
|
516
|
+
if (!v || !y) return mixImmediate(e, _);
|
|
517
|
+
let b = { ...v };
|
|
518
|
+
return (e) => (b.red = mixLinearColor(v.red, y.red, e), b.green = mixLinearColor(v.green, y.green, e), b.blue = mixLinearColor(v.blue, y.blue, e), b.alpha = mixNumber(v.alpha, y.alpha, e), rgba.transform(b));
|
|
519
|
+
}, invisibleValues = new Set(["none", "hidden"]);
|
|
520
|
+
function mixVisibility(e, _) {
|
|
521
|
+
return invisibleValues.has(e) ? (v) => v <= 0 ? e : _ : (v) => v >= 1 ? _ : e;
|
|
522
|
+
}
|
|
523
|
+
function mixNumber$1(e, _) {
|
|
524
|
+
return (v) => mixNumber(e, _, v);
|
|
525
|
+
}
|
|
526
|
+
function getMixer(e) {
|
|
527
|
+
return typeof e == "number" ? mixNumber$1 : typeof e == "string" ? isCSSVariableToken(e) ? mixImmediate : color.test(e) ? mixColor : mixComplex : Array.isArray(e) ? mixArray : typeof e == "object" ? color.test(e) ? mixColor : mixObject : mixImmediate;
|
|
528
|
+
}
|
|
529
|
+
function mixArray(e, _) {
|
|
530
|
+
let v = [...e], y = v.length, b = e.map((e, v) => getMixer(e)(e, _[v]));
|
|
531
|
+
return (e) => {
|
|
532
|
+
for (let _ = 0; _ < y; _++) v[_] = b[_](e);
|
|
533
|
+
return v;
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function mixObject(e, _) {
|
|
537
|
+
let v = {
|
|
538
|
+
...e,
|
|
539
|
+
..._
|
|
540
|
+
}, y = {};
|
|
541
|
+
for (let b in v) e[b] !== void 0 && _[b] !== void 0 && (y[b] = getMixer(e[b])(e[b], _[b]));
|
|
542
|
+
return (e) => {
|
|
543
|
+
for (let _ in y) v[_] = y[_](e);
|
|
544
|
+
return v;
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
function matchOrder(e, _) {
|
|
548
|
+
let v = [], y = {
|
|
549
|
+
color: 0,
|
|
550
|
+
var: 0,
|
|
551
|
+
number: 0
|
|
552
|
+
};
|
|
553
|
+
for (let b = 0; b < _.values.length; b++) {
|
|
554
|
+
let x = _.types[b], S = e.indexes[x][y[x]];
|
|
555
|
+
v[b] = e.values[S] ?? 0, y[x]++;
|
|
556
|
+
}
|
|
557
|
+
return v;
|
|
558
|
+
}
|
|
559
|
+
var mixComplex = (e, _) => {
|
|
560
|
+
let v = complex.createTransformer(_), y = analyseComplexValue(e), b = analyseComplexValue(_);
|
|
561
|
+
return y.indexes.var.length === b.indexes.var.length && y.indexes.color.length === b.indexes.color.length && y.indexes.number.length >= b.indexes.number.length ? invisibleValues.has(e) && !b.values.length || invisibleValues.has(_) && !y.values.length ? mixVisibility(e, _) : pipe(mixArray(matchOrder(y, b), b.values), v) : (warning(!0, `Complex values '${e}' and '${_}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), mixImmediate(e, _));
|
|
562
|
+
};
|
|
563
|
+
function mix(e, _, v) {
|
|
564
|
+
return typeof e == "number" && typeof _ == "number" && typeof v == "number" ? mixNumber(e, _, v) : getMixer(e)(e, _);
|
|
565
|
+
}
|
|
566
|
+
var frameloopDriver = (e) => {
|
|
567
|
+
let _ = ({ timestamp: _ }) => e(_);
|
|
568
|
+
return {
|
|
569
|
+
start: (e = !0) => frame.update(_, e),
|
|
570
|
+
stop: () => cancelFrame(_),
|
|
571
|
+
now: () => frameData.isProcessing ? frameData.timestamp : time.now()
|
|
572
|
+
};
|
|
573
|
+
}, generateLinearEasing = (e, _, v = 10) => {
|
|
574
|
+
let y = "", b = Math.max(Math.round(_ / v), 2);
|
|
575
|
+
for (let _ = 0; _ < b; _++) y += Math.round(e(_ / (b - 1)) * 1e4) / 1e4 + ", ";
|
|
576
|
+
return `linear(${y.substring(0, y.length - 2)})`;
|
|
577
|
+
}, maxGeneratorDuration = 2e4;
|
|
578
|
+
function calcGeneratorDuration(e) {
|
|
579
|
+
let _ = 0, v = e.next(_);
|
|
580
|
+
for (; !v.done && _ < 2e4;) _ += 50, v = e.next(_);
|
|
581
|
+
return _ >= 2e4 ? Infinity : _;
|
|
582
|
+
}
|
|
583
|
+
function createGeneratorEasing(e, _ = 100, v) {
|
|
584
|
+
let y = v({
|
|
585
|
+
...e,
|
|
586
|
+
keyframes: [0, _]
|
|
587
|
+
}), b = Math.min(calcGeneratorDuration(y), maxGeneratorDuration);
|
|
588
|
+
return {
|
|
589
|
+
type: "keyframes",
|
|
590
|
+
ease: (e) => y.next(b * e).value / _,
|
|
591
|
+
duration: /* @__PURE__ */ millisecondsToSeconds(b)
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
var velocitySampleDuration = 5;
|
|
595
|
+
function calcGeneratorVelocity(e, _, v) {
|
|
596
|
+
let y = Math.max(_ - velocitySampleDuration, 0);
|
|
597
|
+
return velocityPerSecond(v - e(y), _ - y);
|
|
598
|
+
}
|
|
599
|
+
var springDefaults = {
|
|
600
|
+
stiffness: 100,
|
|
601
|
+
damping: 10,
|
|
602
|
+
mass: 1,
|
|
603
|
+
velocity: 0,
|
|
604
|
+
duration: 800,
|
|
605
|
+
bounce: .3,
|
|
606
|
+
visualDuration: .3,
|
|
607
|
+
restSpeed: {
|
|
608
|
+
granular: .01,
|
|
609
|
+
default: 2
|
|
610
|
+
},
|
|
611
|
+
restDelta: {
|
|
612
|
+
granular: .005,
|
|
613
|
+
default: .5
|
|
614
|
+
},
|
|
615
|
+
minDuration: .01,
|
|
616
|
+
maxDuration: 10,
|
|
617
|
+
minDamping: .05,
|
|
618
|
+
maxDamping: 1
|
|
619
|
+
}, safeMin = .001;
|
|
620
|
+
function findSpring({ duration: e = springDefaults.duration, bounce: _ = springDefaults.bounce, velocity: v = springDefaults.velocity, mass: y = springDefaults.mass }) {
|
|
621
|
+
let b, x;
|
|
622
|
+
warning(e <= /* @__PURE__ */ secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
623
|
+
let S = 1 - _;
|
|
624
|
+
S = clamp(springDefaults.minDamping, springDefaults.maxDamping, S), e = clamp(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(e)), S < 1 ? (b = (_) => {
|
|
625
|
+
let y = _ * S, b = y * e, x = y - v, C = calcAngularFreq(_, S), w = Math.exp(-b);
|
|
626
|
+
return safeMin - x / C * w;
|
|
627
|
+
}, x = (_) => {
|
|
628
|
+
let y = _ * S * e, x = y * v + v, C = S ** 2 * _ ** 2 * e, w = Math.exp(-y), T = calcAngularFreq(_ ** 2, S);
|
|
629
|
+
return (-b(_) + safeMin > 0 ? -1 : 1) * ((x - C) * w) / T;
|
|
630
|
+
}) : (b = (_) => {
|
|
631
|
+
let y = Math.exp(-_ * e), b = (_ - v) * e + 1;
|
|
632
|
+
return -safeMin + y * b;
|
|
633
|
+
}, x = (_) => Math.exp(-_ * e) * ((v - _) * (e * e)));
|
|
634
|
+
let C = 5 / e, w = approximateRoot(b, x, C);
|
|
635
|
+
if (e = /* @__PURE__ */ secondsToMilliseconds(e), isNaN(w)) return {
|
|
636
|
+
stiffness: springDefaults.stiffness,
|
|
637
|
+
damping: springDefaults.damping,
|
|
638
|
+
duration: e
|
|
639
|
+
};
|
|
640
|
+
{
|
|
641
|
+
let _ = w ** 2 * y;
|
|
642
|
+
return {
|
|
643
|
+
stiffness: _,
|
|
644
|
+
damping: S * 2 * Math.sqrt(y * _),
|
|
645
|
+
duration: e
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
var rootIterations = 12;
|
|
650
|
+
function approximateRoot(e, _, v) {
|
|
651
|
+
let y = v;
|
|
652
|
+
for (let v = 1; v < rootIterations; v++) y -= e(y) / _(y);
|
|
653
|
+
return y;
|
|
654
|
+
}
|
|
655
|
+
function calcAngularFreq(e, _) {
|
|
656
|
+
return e * Math.sqrt(1 - _ * _);
|
|
657
|
+
}
|
|
658
|
+
var durationKeys = ["duration", "bounce"], physicsKeys = [
|
|
659
|
+
"stiffness",
|
|
660
|
+
"damping",
|
|
661
|
+
"mass"
|
|
662
|
+
];
|
|
663
|
+
function isSpringType(e, _) {
|
|
664
|
+
return _.some((_) => e[_] !== void 0);
|
|
665
|
+
}
|
|
666
|
+
function getSpringOptions(e) {
|
|
667
|
+
let _ = {
|
|
668
|
+
velocity: springDefaults.velocity,
|
|
669
|
+
stiffness: springDefaults.stiffness,
|
|
670
|
+
damping: springDefaults.damping,
|
|
671
|
+
mass: springDefaults.mass,
|
|
672
|
+
isResolvedFromDuration: !1,
|
|
673
|
+
...e
|
|
674
|
+
};
|
|
675
|
+
if (!isSpringType(e, physicsKeys) && isSpringType(e, durationKeys)) if (e.visualDuration) {
|
|
676
|
+
let v = e.visualDuration, y = 2 * Math.PI / (v * 1.2), b = y * y, x = 2 * clamp(.05, 1, 1 - (e.bounce || 0)) * Math.sqrt(b);
|
|
677
|
+
_ = {
|
|
678
|
+
..._,
|
|
679
|
+
mass: springDefaults.mass,
|
|
680
|
+
stiffness: b,
|
|
681
|
+
damping: x
|
|
682
|
+
};
|
|
683
|
+
} else {
|
|
684
|
+
let v = findSpring(e);
|
|
685
|
+
_ = {
|
|
686
|
+
..._,
|
|
687
|
+
...v,
|
|
688
|
+
mass: springDefaults.mass
|
|
689
|
+
}, _.isResolvedFromDuration = !0;
|
|
690
|
+
}
|
|
691
|
+
return _;
|
|
692
|
+
}
|
|
693
|
+
function spring(e = springDefaults.visualDuration, _ = springDefaults.bounce) {
|
|
694
|
+
let v = typeof e == "object" ? e : {
|
|
695
|
+
visualDuration: e,
|
|
696
|
+
keyframes: [0, 1],
|
|
697
|
+
bounce: _
|
|
698
|
+
}, { restSpeed: y, restDelta: b } = v, x = v.keyframes[0], S = v.keyframes[v.keyframes.length - 1], C = {
|
|
699
|
+
done: !1,
|
|
700
|
+
value: x
|
|
701
|
+
}, { stiffness: w, damping: T, mass: E, duration: D, velocity: O, isResolvedFromDuration: k } = getSpringOptions({
|
|
702
|
+
...v,
|
|
703
|
+
velocity: -/* @__PURE__ */ millisecondsToSeconds(v.velocity || 0)
|
|
704
|
+
}), A = O || 0, j = T / (2 * Math.sqrt(w * E)), M = S - x, N = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(w / E)), P = Math.abs(M) < 5;
|
|
705
|
+
y ||= P ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, b ||= P ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
706
|
+
let F;
|
|
707
|
+
if (j < 1) {
|
|
708
|
+
let e = calcAngularFreq(N, j);
|
|
709
|
+
F = (_) => S - Math.exp(-j * N * _) * ((A + j * N * M) / e * Math.sin(e * _) + M * Math.cos(e * _));
|
|
710
|
+
} else if (j === 1) F = (e) => S - Math.exp(-N * e) * (M + (A + N * M) * e);
|
|
711
|
+
else {
|
|
712
|
+
let e = N * Math.sqrt(j * j - 1);
|
|
713
|
+
F = (_) => {
|
|
714
|
+
let v = Math.exp(-j * N * _), y = Math.min(e * _, 300);
|
|
715
|
+
return S - v * ((A + j * N * M) * Math.sinh(y) + e * M * Math.cosh(y)) / e;
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
let I = {
|
|
719
|
+
calculatedDuration: k && D || null,
|
|
720
|
+
next: (e) => {
|
|
721
|
+
let _ = F(e);
|
|
722
|
+
if (k) C.done = e >= D;
|
|
723
|
+
else {
|
|
724
|
+
let v = e === 0 ? A : 0;
|
|
725
|
+
j < 1 && (v = e === 0 ? /* @__PURE__ */ secondsToMilliseconds(A) : calcGeneratorVelocity(F, e, _));
|
|
726
|
+
let x = Math.abs(v) <= y, w = Math.abs(S - _) <= b;
|
|
727
|
+
C.done = x && w;
|
|
728
|
+
}
|
|
729
|
+
return C.value = C.done ? S : _, C;
|
|
730
|
+
},
|
|
731
|
+
toString: () => {
|
|
732
|
+
let e = Math.min(calcGeneratorDuration(I), maxGeneratorDuration), _ = generateLinearEasing((_) => I.next(e * _).value, e, 30);
|
|
733
|
+
return e + "ms " + _;
|
|
734
|
+
},
|
|
735
|
+
toTransition: () => {}
|
|
736
|
+
};
|
|
737
|
+
return I;
|
|
738
|
+
}
|
|
739
|
+
spring.applyToOptions = (e) => {
|
|
740
|
+
let _ = createGeneratorEasing(e, 100, spring);
|
|
741
|
+
return e.ease = _.ease, e.duration = /* @__PURE__ */ secondsToMilliseconds(_.duration), e.type = "keyframes", e;
|
|
742
|
+
};
|
|
743
|
+
function inertia({ keyframes: e, velocity: _ = 0, power: v = .8, timeConstant: y = 325, bounceDamping: b = 10, bounceStiffness: x = 500, modifyTarget: S, min: C, max: w, restDelta: T = .5, restSpeed: E }) {
|
|
744
|
+
let D = e[0], O = {
|
|
745
|
+
done: !1,
|
|
746
|
+
value: D
|
|
747
|
+
}, k = (e) => C !== void 0 && e < C || w !== void 0 && e > w, A = (e) => C === void 0 ? w : w === void 0 || Math.abs(C - e) < Math.abs(w - e) ? C : w, j = v * _, M = D + j, N = S === void 0 ? M : S(M);
|
|
748
|
+
N !== M && (j = N - D);
|
|
749
|
+
let P = (e) => -j * Math.exp(-e / y), F = (e) => N + P(e), I = (e) => {
|
|
750
|
+
let _ = P(e), v = F(e);
|
|
751
|
+
O.done = Math.abs(_) <= T, O.value = O.done ? N : v;
|
|
752
|
+
}, L, R, z = (e) => {
|
|
753
|
+
k(O.value) && (L = e, R = spring({
|
|
754
|
+
keyframes: [O.value, A(O.value)],
|
|
755
|
+
velocity: calcGeneratorVelocity(F, e, O.value),
|
|
756
|
+
damping: b,
|
|
757
|
+
stiffness: x,
|
|
758
|
+
restDelta: T,
|
|
759
|
+
restSpeed: E
|
|
760
|
+
}));
|
|
761
|
+
};
|
|
762
|
+
return z(0), {
|
|
763
|
+
calculatedDuration: null,
|
|
764
|
+
next: (e) => {
|
|
765
|
+
let _ = !1;
|
|
766
|
+
return !R && L === void 0 && (_ = !0, I(e), z(e)), L !== void 0 && e >= L ? R.next(e - L) : (!_ && I(e), O);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
function createMixers(e, _, v) {
|
|
771
|
+
let y = [], b = v || MotionGlobalConfig.mix || mix, x = e.length - 1;
|
|
772
|
+
for (let v = 0; v < x; v++) {
|
|
773
|
+
let x = b(e[v], e[v + 1]);
|
|
774
|
+
_ && (x = pipe(Array.isArray(_) ? _[v] || noop : _, x)), y.push(x);
|
|
775
|
+
}
|
|
776
|
+
return y;
|
|
777
|
+
}
|
|
778
|
+
function interpolate(e, _, { clamp: v = !0, ease: y, mixer: b } = {}) {
|
|
779
|
+
let x = e.length;
|
|
780
|
+
if (invariant(x === _.length, "Both input and output ranges must be the same length", "range-length"), x === 1) return () => _[0];
|
|
781
|
+
if (x === 2 && _[0] === _[1]) return () => _[1];
|
|
782
|
+
let S = e[0] === e[1];
|
|
783
|
+
e[0] > e[x - 1] && (e = [...e].reverse(), _ = [..._].reverse());
|
|
784
|
+
let C = createMixers(_, y, b), w = C.length, T = (v) => {
|
|
785
|
+
if (S && v < e[0]) return _[0];
|
|
786
|
+
let y = 0;
|
|
787
|
+
if (w > 1) for (; y < e.length - 2 && !(v < e[y + 1]); y++);
|
|
788
|
+
let b = /* @__PURE__ */ progress(e[y], e[y + 1], v);
|
|
789
|
+
return C[y](b);
|
|
790
|
+
};
|
|
791
|
+
return v ? (_) => T(clamp(e[0], e[x - 1], _)) : T;
|
|
792
|
+
}
|
|
793
|
+
function fillOffset(e, _) {
|
|
794
|
+
let v = e[e.length - 1];
|
|
795
|
+
for (let y = 1; y <= _; y++) {
|
|
796
|
+
let b = /* @__PURE__ */ progress(0, _, y);
|
|
797
|
+
e.push(mixNumber(v, 1, b));
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function defaultOffset(e) {
|
|
801
|
+
let _ = [0];
|
|
802
|
+
return fillOffset(_, e.length - 1), _;
|
|
803
|
+
}
|
|
804
|
+
function convertOffsetToTimes(e, _) {
|
|
805
|
+
return e.map((e) => e * _);
|
|
806
|
+
}
|
|
807
|
+
function defaultEasing(e, _) {
|
|
808
|
+
return e.map(() => _ || easeInOut).splice(0, e.length - 1);
|
|
809
|
+
}
|
|
810
|
+
function keyframes({ duration: e = 300, keyframes: _, times: v, ease: y = "easeInOut" }) {
|
|
811
|
+
let b = isEasingArray(y) ? y.map(easingDefinitionToFunction) : easingDefinitionToFunction(y), x = {
|
|
812
|
+
done: !1,
|
|
813
|
+
value: _[0]
|
|
814
|
+
}, S = interpolate(convertOffsetToTimes(v && v.length === _.length ? v : defaultOffset(_), e), _, { ease: Array.isArray(b) ? b : defaultEasing(_, b) });
|
|
815
|
+
return {
|
|
816
|
+
calculatedDuration: e,
|
|
817
|
+
next: (_) => (x.value = S(_), x.done = _ >= e, x)
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
var isNotNull$1 = (e) => e !== null;
|
|
821
|
+
function getFinalKeyframe$1(e, { repeat: _, repeatType: v = "loop" }, y, b = 1) {
|
|
822
|
+
let x = e.filter(isNotNull$1), S = b < 0 || _ && v !== "loop" && _ % 2 == 1 ? 0 : x.length - 1;
|
|
823
|
+
return !S || y === void 0 ? x[S] : y;
|
|
824
|
+
}
|
|
825
|
+
var transitionTypeMap = {
|
|
826
|
+
decay: inertia,
|
|
827
|
+
inertia,
|
|
828
|
+
tween: keyframes,
|
|
829
|
+
keyframes,
|
|
830
|
+
spring
|
|
831
|
+
};
|
|
832
|
+
function replaceTransitionType(e) {
|
|
833
|
+
typeof e.type == "string" && (e.type = transitionTypeMap[e.type]);
|
|
834
|
+
}
|
|
835
|
+
var WithPromise = class {
|
|
836
|
+
constructor() {
|
|
837
|
+
this.updateFinished();
|
|
838
|
+
}
|
|
839
|
+
get finished() {
|
|
840
|
+
return this._finished;
|
|
841
|
+
}
|
|
842
|
+
updateFinished() {
|
|
843
|
+
this._finished = new Promise((e) => {
|
|
844
|
+
this.resolve = e;
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
notifyFinished() {
|
|
848
|
+
this.resolve();
|
|
849
|
+
}
|
|
850
|
+
then(e, _) {
|
|
851
|
+
return this.finished.then(e, _);
|
|
852
|
+
}
|
|
853
|
+
}, percentToProgress = (e) => e / 100, JSAnimation = class extends WithPromise {
|
|
854
|
+
constructor(e) {
|
|
855
|
+
super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
|
|
856
|
+
let { motionValue: e } = this.options;
|
|
857
|
+
e && e.updatedAt !== time.now() && this.tick(time.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
|
|
858
|
+
}, activeAnimations.mainThread++, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
|
|
859
|
+
}
|
|
860
|
+
initAnimation() {
|
|
861
|
+
let { options: e } = this;
|
|
862
|
+
replaceTransitionType(e);
|
|
863
|
+
let { type: _ = keyframes, repeat: v = 0, repeatDelay: y = 0, repeatType: b, velocity: x = 0 } = e, { keyframes: S } = e, C = _ || keyframes;
|
|
864
|
+
process.env.NODE_ENV !== "production" && C !== keyframes && invariant(S.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${S}`, "spring-two-frames"), C !== keyframes && typeof S[0] != "number" && (this.mixKeyframes = pipe(percentToProgress, mix(S[0], S[1])), S = [0, 100]);
|
|
865
|
+
let w = C({
|
|
866
|
+
...e,
|
|
867
|
+
keyframes: S
|
|
868
|
+
});
|
|
869
|
+
b === "mirror" && (this.mirroredGenerator = C({
|
|
870
|
+
...e,
|
|
871
|
+
keyframes: [...S].reverse(),
|
|
872
|
+
velocity: -x
|
|
873
|
+
})), w.calculatedDuration === null && (w.calculatedDuration = calcGeneratorDuration(w));
|
|
874
|
+
let { calculatedDuration: T } = w;
|
|
875
|
+
this.calculatedDuration = T, this.resolvedDuration = T + y, this.totalDuration = this.resolvedDuration * (v + 1) - y, this.generator = w;
|
|
876
|
+
}
|
|
877
|
+
updateTime(e) {
|
|
878
|
+
let _ = Math.round(e - this.startTime) * this.playbackSpeed;
|
|
879
|
+
this.holdTime === null ? this.currentTime = _ : this.currentTime = this.holdTime;
|
|
880
|
+
}
|
|
881
|
+
tick(e, _ = !1) {
|
|
882
|
+
let { generator: v, totalDuration: y, mixKeyframes: b, mirroredGenerator: x, resolvedDuration: S, calculatedDuration: C } = this;
|
|
883
|
+
if (this.startTime === null) return v.next(0);
|
|
884
|
+
let { delay: w = 0, keyframes: T, repeat: E, repeatType: D, repeatDelay: O, type: k, onUpdate: A, finalKeyframe: j } = this.options;
|
|
885
|
+
this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - y / this.speed, this.startTime)), _ ? this.currentTime = e : this.updateTime(e);
|
|
886
|
+
let M = this.currentTime - w * (this.playbackSpeed >= 0 ? 1 : -1), N = this.playbackSpeed >= 0 ? M < 0 : M > y;
|
|
887
|
+
this.currentTime = Math.max(M, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = y);
|
|
888
|
+
let P = this.currentTime, F = v;
|
|
889
|
+
if (E) {
|
|
890
|
+
let e = Math.min(this.currentTime, y) / S, _ = Math.floor(e), v = e % 1;
|
|
891
|
+
!v && e >= 1 && (v = 1), v === 1 && _--, _ = Math.min(_, E + 1), _ % 2 && (D === "reverse" ? (v = 1 - v, O && (v -= O / S)) : D === "mirror" && (F = x)), P = clamp(0, 1, v) * S;
|
|
892
|
+
}
|
|
893
|
+
let I = N ? {
|
|
894
|
+
done: !1,
|
|
895
|
+
value: T[0]
|
|
896
|
+
} : F.next(P);
|
|
897
|
+
b && (I.value = b(I.value));
|
|
898
|
+
let { done: L } = I;
|
|
899
|
+
!N && C !== null && (L = this.playbackSpeed >= 0 ? this.currentTime >= y : this.currentTime <= 0);
|
|
900
|
+
let R = this.holdTime === null && (this.state === "finished" || this.state === "running" && L);
|
|
901
|
+
return R && k !== inertia && (I.value = getFinalKeyframe$1(T, this.options, j, this.speed)), A && A(I.value), R && this.finish(), I;
|
|
902
|
+
}
|
|
903
|
+
then(e, _) {
|
|
904
|
+
return this.finished.then(e, _);
|
|
905
|
+
}
|
|
906
|
+
get duration() {
|
|
907
|
+
return /* @__PURE__ */ millisecondsToSeconds(this.calculatedDuration);
|
|
908
|
+
}
|
|
909
|
+
get iterationDuration() {
|
|
910
|
+
let { delay: e = 0 } = this.options || {};
|
|
911
|
+
return this.duration + /* @__PURE__ */ millisecondsToSeconds(e);
|
|
912
|
+
}
|
|
913
|
+
get time() {
|
|
914
|
+
return /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
|
|
915
|
+
}
|
|
916
|
+
set time(e) {
|
|
917
|
+
e = /* @__PURE__ */ secondsToMilliseconds(e), this.currentTime = e, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.playbackSpeed), this.driver?.start(!1);
|
|
918
|
+
}
|
|
919
|
+
get speed() {
|
|
920
|
+
return this.playbackSpeed;
|
|
921
|
+
}
|
|
922
|
+
set speed(e) {
|
|
923
|
+
this.updateTime(time.now());
|
|
924
|
+
let _ = this.playbackSpeed !== e;
|
|
925
|
+
this.playbackSpeed = e, _ && (this.time = /* @__PURE__ */ millisecondsToSeconds(this.currentTime));
|
|
926
|
+
}
|
|
927
|
+
play() {
|
|
928
|
+
if (this.isStopped) return;
|
|
929
|
+
let { driver: e = frameloopDriver, startTime: _ } = this.options;
|
|
930
|
+
this.driver ||= e((e) => this.tick(e)), this.options.onPlay?.();
|
|
931
|
+
let v = this.driver.now();
|
|
932
|
+
this.state === "finished" ? (this.updateFinished(), this.startTime = v) : this.holdTime === null ? this.startTime ||= _ ?? v : this.startTime = v - this.holdTime, this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
|
|
933
|
+
}
|
|
934
|
+
pause() {
|
|
935
|
+
this.state = "paused", this.updateTime(time.now()), this.holdTime = this.currentTime;
|
|
936
|
+
}
|
|
937
|
+
complete() {
|
|
938
|
+
this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
|
|
939
|
+
}
|
|
940
|
+
finish() {
|
|
941
|
+
this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
|
|
942
|
+
}
|
|
943
|
+
cancel() {
|
|
944
|
+
this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
|
|
945
|
+
}
|
|
946
|
+
teardown() {
|
|
947
|
+
this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null, activeAnimations.mainThread--;
|
|
948
|
+
}
|
|
949
|
+
stopDriver() {
|
|
950
|
+
this.driver &&= (this.driver.stop(), void 0);
|
|
951
|
+
}
|
|
952
|
+
sample(e) {
|
|
953
|
+
return this.startTime = 0, this.tick(e, !0);
|
|
954
|
+
}
|
|
955
|
+
attachTimeline(e) {
|
|
956
|
+
return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
function fillWildcards(e) {
|
|
960
|
+
for (let _ = 1; _ < e.length; _++) e[_] ?? (e[_] = e[_ - 1]);
|
|
961
|
+
}
|
|
962
|
+
var radToDeg = (e) => e * 180 / Math.PI, rotate = (e) => rebaseAngle(radToDeg(Math.atan2(e[1], e[0]))), matrix2dParsers = {
|
|
963
|
+
x: 4,
|
|
964
|
+
y: 5,
|
|
965
|
+
translateX: 4,
|
|
966
|
+
translateY: 5,
|
|
967
|
+
scaleX: 0,
|
|
968
|
+
scaleY: 3,
|
|
969
|
+
scale: (e) => (Math.abs(e[0]) + Math.abs(e[3])) / 2,
|
|
970
|
+
rotate,
|
|
971
|
+
rotateZ: rotate,
|
|
972
|
+
skewX: (e) => radToDeg(Math.atan(e[1])),
|
|
973
|
+
skewY: (e) => radToDeg(Math.atan(e[2])),
|
|
974
|
+
skew: (e) => (Math.abs(e[1]) + Math.abs(e[2])) / 2
|
|
975
|
+
}, rebaseAngle = (e) => (e %= 360, e < 0 && (e += 360), e), rotateZ = rotate, scaleX = (e) => Math.sqrt(e[0] * e[0] + e[1] * e[1]), scaleY = (e) => Math.sqrt(e[4] * e[4] + e[5] * e[5]), matrix3dParsers = {
|
|
976
|
+
x: 12,
|
|
977
|
+
y: 13,
|
|
978
|
+
z: 14,
|
|
979
|
+
translateX: 12,
|
|
980
|
+
translateY: 13,
|
|
981
|
+
translateZ: 14,
|
|
982
|
+
scaleX,
|
|
983
|
+
scaleY,
|
|
984
|
+
scale: (e) => (scaleX(e) + scaleY(e)) / 2,
|
|
985
|
+
rotateX: (e) => rebaseAngle(radToDeg(Math.atan2(e[6], e[5]))),
|
|
986
|
+
rotateY: (e) => rebaseAngle(radToDeg(Math.atan2(-e[2], e[0]))),
|
|
987
|
+
rotateZ,
|
|
988
|
+
rotate: rotateZ,
|
|
989
|
+
skewX: (e) => radToDeg(Math.atan(e[4])),
|
|
990
|
+
skewY: (e) => radToDeg(Math.atan(e[1])),
|
|
991
|
+
skew: (e) => (Math.abs(e[1]) + Math.abs(e[4])) / 2
|
|
992
|
+
};
|
|
993
|
+
function defaultTransformValue(e) {
|
|
994
|
+
return e.includes("scale") ? 1 : 0;
|
|
995
|
+
}
|
|
996
|
+
function parseValueFromTransform(e, _) {
|
|
997
|
+
if (!e || e === "none") return defaultTransformValue(_);
|
|
998
|
+
let v = e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u), y, b;
|
|
999
|
+
if (v) y = matrix3dParsers, b = v;
|
|
1000
|
+
else {
|
|
1001
|
+
let _ = e.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
1002
|
+
y = matrix2dParsers, b = _;
|
|
1003
|
+
}
|
|
1004
|
+
if (!b) return defaultTransformValue(_);
|
|
1005
|
+
let x = y[_], S = b[1].split(",").map(convertTransformToNumber);
|
|
1006
|
+
return typeof x == "function" ? x(S) : S[x];
|
|
1007
|
+
}
|
|
1008
|
+
var readTransformValue = (e, _) => {
|
|
1009
|
+
let { transform: v = "none" } = getComputedStyle(e);
|
|
1010
|
+
return parseValueFromTransform(v, _);
|
|
1011
|
+
};
|
|
1012
|
+
function convertTransformToNumber(e) {
|
|
1013
|
+
return parseFloat(e.trim());
|
|
1014
|
+
}
|
|
1015
|
+
var transformPropOrder = [
|
|
1016
|
+
"transformPerspective",
|
|
1017
|
+
"x",
|
|
1018
|
+
"y",
|
|
1019
|
+
"z",
|
|
1020
|
+
"translateX",
|
|
1021
|
+
"translateY",
|
|
1022
|
+
"translateZ",
|
|
1023
|
+
"scale",
|
|
1024
|
+
"scaleX",
|
|
1025
|
+
"scaleY",
|
|
1026
|
+
"rotate",
|
|
1027
|
+
"rotateX",
|
|
1028
|
+
"rotateY",
|
|
1029
|
+
"rotateZ",
|
|
1030
|
+
"skew",
|
|
1031
|
+
"skewX",
|
|
1032
|
+
"skewY"
|
|
1033
|
+
], transformProps = /* @__PURE__ */ (() => new Set(transformPropOrder))(), isNumOrPxType = (e) => e === number || e === px, transformKeys = new Set([
|
|
1034
|
+
"x",
|
|
1035
|
+
"y",
|
|
1036
|
+
"z"
|
|
1037
|
+
]), nonTranslationalTransformKeys = transformPropOrder.filter((e) => !transformKeys.has(e));
|
|
1038
|
+
function removeNonTranslationalTransform(e) {
|
|
1039
|
+
let _ = [];
|
|
1040
|
+
return nonTranslationalTransformKeys.forEach((v) => {
|
|
1041
|
+
let y = e.getValue(v);
|
|
1042
|
+
y !== void 0 && (_.push([v, y.get()]), y.set(v.startsWith("scale") ? 1 : 0));
|
|
1043
|
+
}), _;
|
|
1044
|
+
}
|
|
1045
|
+
var positionalValues = {
|
|
1046
|
+
width: ({ x: e }, { paddingLeft: _ = "0", paddingRight: v = "0" }) => e.max - e.min - parseFloat(_) - parseFloat(v),
|
|
1047
|
+
height: ({ y: e }, { paddingTop: _ = "0", paddingBottom: v = "0" }) => e.max - e.min - parseFloat(_) - parseFloat(v),
|
|
1048
|
+
top: (e, { top: _ }) => parseFloat(_),
|
|
1049
|
+
left: (e, { left: _ }) => parseFloat(_),
|
|
1050
|
+
bottom: ({ y: e }, { top: _ }) => parseFloat(_) + (e.max - e.min),
|
|
1051
|
+
right: ({ x: e }, { left: _ }) => parseFloat(_) + (e.max - e.min),
|
|
1052
|
+
x: (e, { transform: _ }) => parseValueFromTransform(_, "x"),
|
|
1053
|
+
y: (e, { transform: _ }) => parseValueFromTransform(_, "y")
|
|
1054
|
+
};
|
|
1055
|
+
positionalValues.translateX = positionalValues.x, positionalValues.translateY = positionalValues.y;
|
|
1056
|
+
var toResolve = /* @__PURE__ */ new Set(), isScheduled = !1, anyNeedsMeasurement = !1, isForced = !1;
|
|
1057
|
+
function measureAllKeyframes() {
|
|
1058
|
+
if (anyNeedsMeasurement) {
|
|
1059
|
+
let e = Array.from(toResolve).filter((e) => e.needsMeasurement), _ = new Set(e.map((e) => e.element)), v = /* @__PURE__ */ new Map();
|
|
1060
|
+
_.forEach((e) => {
|
|
1061
|
+
let _ = removeNonTranslationalTransform(e);
|
|
1062
|
+
_.length && (v.set(e, _), e.render());
|
|
1063
|
+
}), e.forEach((e) => e.measureInitialState()), _.forEach((e) => {
|
|
1064
|
+
e.render();
|
|
1065
|
+
let _ = v.get(e);
|
|
1066
|
+
_ && _.forEach(([_, v]) => {
|
|
1067
|
+
e.getValue(_)?.set(v);
|
|
1068
|
+
});
|
|
1069
|
+
}), e.forEach((e) => e.measureEndState()), e.forEach((e) => {
|
|
1070
|
+
e.suspendedScrollY !== void 0 && window.scrollTo(0, e.suspendedScrollY);
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
anyNeedsMeasurement = !1, isScheduled = !1, toResolve.forEach((e) => e.complete(isForced)), toResolve.clear();
|
|
1074
|
+
}
|
|
1075
|
+
function readAllKeyframes() {
|
|
1076
|
+
toResolve.forEach((e) => {
|
|
1077
|
+
e.readKeyframes(), e.needsMeasurement && (anyNeedsMeasurement = !0);
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
function flushKeyframeResolvers() {
|
|
1081
|
+
isForced = !0, readAllKeyframes(), measureAllKeyframes(), isForced = !1;
|
|
1082
|
+
}
|
|
1083
|
+
var KeyframeResolver = class {
|
|
1084
|
+
constructor(e, _, v, y, b, x = !1) {
|
|
1085
|
+
this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = _, this.name = v, this.motionValue = y, this.element = b, this.isAsync = x;
|
|
1086
|
+
}
|
|
1087
|
+
scheduleResolve() {
|
|
1088
|
+
this.state = "scheduled", this.isAsync ? (toResolve.add(this), isScheduled || (isScheduled = !0, frame.read(readAllKeyframes), frame.resolveKeyframes(measureAllKeyframes))) : (this.readKeyframes(), this.complete());
|
|
1089
|
+
}
|
|
1090
|
+
readKeyframes() {
|
|
1091
|
+
let { unresolvedKeyframes: e, name: _, element: v, motionValue: y } = this;
|
|
1092
|
+
if (e[0] === null) {
|
|
1093
|
+
let b = y?.get(), x = e[e.length - 1];
|
|
1094
|
+
if (b !== void 0) e[0] = b;
|
|
1095
|
+
else if (v && _) {
|
|
1096
|
+
let y = v.readValue(_, x);
|
|
1097
|
+
y != null && (e[0] = y);
|
|
1098
|
+
}
|
|
1099
|
+
e[0] === void 0 && (e[0] = x), y && b === void 0 && y.set(e[0]);
|
|
1100
|
+
}
|
|
1101
|
+
fillWildcards(e);
|
|
1102
|
+
}
|
|
1103
|
+
setFinalKeyframe() {}
|
|
1104
|
+
measureInitialState() {}
|
|
1105
|
+
renderEndStyles() {}
|
|
1106
|
+
measureEndState() {}
|
|
1107
|
+
complete(e = !1) {
|
|
1108
|
+
this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), toResolve.delete(this);
|
|
1109
|
+
}
|
|
1110
|
+
cancel() {
|
|
1111
|
+
this.state === "scheduled" && (toResolve.delete(this), this.state = "pending");
|
|
1112
|
+
}
|
|
1113
|
+
resume() {
|
|
1114
|
+
this.state === "pending" && this.scheduleResolve();
|
|
1115
|
+
}
|
|
1116
|
+
}, isCSSVar = (e) => e.startsWith("--");
|
|
1117
|
+
function setStyle(e, _, v) {
|
|
1118
|
+
isCSSVar(_) ? e.style.setProperty(_, v) : e.style[_] = v;
|
|
1119
|
+
}
|
|
1120
|
+
var supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0), supportsFlags = {};
|
|
1121
|
+
function memoSupports(e, _) {
|
|
1122
|
+
let v = /* @__PURE__ */ memo(e);
|
|
1123
|
+
return () => supportsFlags[_] ?? v();
|
|
1124
|
+
}
|
|
1125
|
+
var supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
1126
|
+
try {
|
|
1127
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
1128
|
+
} catch {
|
|
1129
|
+
return !1;
|
|
1130
|
+
}
|
|
1131
|
+
return !0;
|
|
1132
|
+
}, "linearEasing"), cubicBezierAsString = ([e, _, v, y]) => `cubic-bezier(${e}, ${_}, ${v}, ${y})`, supportedWaapiEasing = {
|
|
1133
|
+
linear: "linear",
|
|
1134
|
+
ease: "ease",
|
|
1135
|
+
easeIn: "ease-in",
|
|
1136
|
+
easeOut: "ease-out",
|
|
1137
|
+
easeInOut: "ease-in-out",
|
|
1138
|
+
circIn: /* @__PURE__ */ cubicBezierAsString([
|
|
1139
|
+
0,
|
|
1140
|
+
.65,
|
|
1141
|
+
.55,
|
|
1142
|
+
1
|
|
1143
|
+
]),
|
|
1144
|
+
circOut: /* @__PURE__ */ cubicBezierAsString([
|
|
1145
|
+
.55,
|
|
1146
|
+
0,
|
|
1147
|
+
1,
|
|
1148
|
+
.45
|
|
1149
|
+
]),
|
|
1150
|
+
backIn: /* @__PURE__ */ cubicBezierAsString([
|
|
1151
|
+
.31,
|
|
1152
|
+
.01,
|
|
1153
|
+
.66,
|
|
1154
|
+
-.59
|
|
1155
|
+
]),
|
|
1156
|
+
backOut: /* @__PURE__ */ cubicBezierAsString([
|
|
1157
|
+
.33,
|
|
1158
|
+
1.53,
|
|
1159
|
+
.69,
|
|
1160
|
+
.99
|
|
1161
|
+
])
|
|
1162
|
+
};
|
|
1163
|
+
function mapEasingToNativeEasing(e, _) {
|
|
1164
|
+
if (e) return typeof e == "function" ? supportsLinearEasing() ? generateLinearEasing(e, _) : "ease-out" : isBezierDefinition(e) ? cubicBezierAsString(e) : Array.isArray(e) ? e.map((e) => mapEasingToNativeEasing(e, _) || supportedWaapiEasing.easeOut) : supportedWaapiEasing[e];
|
|
1165
|
+
}
|
|
1166
|
+
function startWaapiAnimation(e, _, v, { delay: y = 0, duration: b = 300, repeat: x = 0, repeatType: S = "loop", ease: C = "easeOut", times: w } = {}, T = void 0) {
|
|
1167
|
+
let E = { [_]: v };
|
|
1168
|
+
w && (E.offset = w);
|
|
1169
|
+
let D = mapEasingToNativeEasing(C, b);
|
|
1170
|
+
Array.isArray(D) && (E.easing = D), statsBuffer.value && activeAnimations.waapi++;
|
|
1171
|
+
let O = {
|
|
1172
|
+
delay: y,
|
|
1173
|
+
duration: b,
|
|
1174
|
+
easing: Array.isArray(D) ? "linear" : D,
|
|
1175
|
+
fill: "both",
|
|
1176
|
+
iterations: x + 1,
|
|
1177
|
+
direction: S === "reverse" ? "alternate" : "normal"
|
|
1178
|
+
};
|
|
1179
|
+
T && (O.pseudoElement = T);
|
|
1180
|
+
let k = e.animate(E, O);
|
|
1181
|
+
return statsBuffer.value && k.finished.finally(() => {
|
|
1182
|
+
activeAnimations.waapi--;
|
|
1183
|
+
}), k;
|
|
1184
|
+
}
|
|
1185
|
+
function isGenerator(e) {
|
|
1186
|
+
return typeof e == "function" && "applyToOptions" in e;
|
|
1187
|
+
}
|
|
1188
|
+
function applyGeneratorOptions({ type: e, ..._ }) {
|
|
1189
|
+
return isGenerator(e) && supportsLinearEasing() ? e.applyToOptions(_) : (_.duration ??= 300, _.ease ??= "easeOut", _);
|
|
1190
|
+
}
|
|
1191
|
+
var NativeAnimation = class extends WithPromise {
|
|
1192
|
+
constructor(e) {
|
|
1193
|
+
if (super(), this.finishedTime = null, this.isStopped = !1, !e) return;
|
|
1194
|
+
let { element: _, name: v, keyframes: y, pseudoElement: b, allowFlatten: x = !1, finalKeyframe: S, onComplete: C } = e;
|
|
1195
|
+
this.isPseudoElement = !!b, this.allowFlatten = x, this.options = e, invariant(typeof e.type != "string", "Mini animate() doesn't support \"type\" as a string.", "mini-spring");
|
|
1196
|
+
let w = applyGeneratorOptions(e);
|
|
1197
|
+
this.animation = startWaapiAnimation(_, v, y, w, b), w.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
|
|
1198
|
+
if (this.finishedTime = this.time, !b) {
|
|
1199
|
+
let e = getFinalKeyframe$1(y, this.options, S, this.speed);
|
|
1200
|
+
this.updateMotionValue ? this.updateMotionValue(e) : setStyle(_, v, e), this.animation.cancel();
|
|
1201
|
+
}
|
|
1202
|
+
C?.(), this.notifyFinished();
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
play() {
|
|
1206
|
+
this.isStopped || (this.animation.play(), this.state === "finished" && this.updateFinished());
|
|
1207
|
+
}
|
|
1208
|
+
pause() {
|
|
1209
|
+
this.animation.pause();
|
|
1210
|
+
}
|
|
1211
|
+
complete() {
|
|
1212
|
+
this.animation.finish?.();
|
|
1213
|
+
}
|
|
1214
|
+
cancel() {
|
|
1215
|
+
try {
|
|
1216
|
+
this.animation.cancel();
|
|
1217
|
+
} catch {}
|
|
1218
|
+
}
|
|
1219
|
+
stop() {
|
|
1220
|
+
if (this.isStopped) return;
|
|
1221
|
+
this.isStopped = !0;
|
|
1222
|
+
let { state: e } = this;
|
|
1223
|
+
e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
|
|
1224
|
+
}
|
|
1225
|
+
commitStyles() {
|
|
1226
|
+
this.isPseudoElement || this.animation.commitStyles?.();
|
|
1227
|
+
}
|
|
1228
|
+
get duration() {
|
|
1229
|
+
let e = this.animation.effect?.getComputedTiming?.().duration || 0;
|
|
1230
|
+
return /* @__PURE__ */ millisecondsToSeconds(Number(e));
|
|
1231
|
+
}
|
|
1232
|
+
get iterationDuration() {
|
|
1233
|
+
let { delay: e = 0 } = this.options || {};
|
|
1234
|
+
return this.duration + /* @__PURE__ */ millisecondsToSeconds(e);
|
|
1235
|
+
}
|
|
1236
|
+
get time() {
|
|
1237
|
+
return /* @__PURE__ */ millisecondsToSeconds(Number(this.animation.currentTime) || 0);
|
|
1238
|
+
}
|
|
1239
|
+
set time(e) {
|
|
1240
|
+
this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ secondsToMilliseconds(e);
|
|
1241
|
+
}
|
|
1242
|
+
get speed() {
|
|
1243
|
+
return this.animation.playbackRate;
|
|
1244
|
+
}
|
|
1245
|
+
set speed(e) {
|
|
1246
|
+
e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
|
|
1247
|
+
}
|
|
1248
|
+
get state() {
|
|
1249
|
+
return this.finishedTime === null ? this.animation.playState : "finished";
|
|
1250
|
+
}
|
|
1251
|
+
get startTime() {
|
|
1252
|
+
return Number(this.animation.startTime);
|
|
1253
|
+
}
|
|
1254
|
+
set startTime(e) {
|
|
1255
|
+
this.animation.startTime = e;
|
|
1256
|
+
}
|
|
1257
|
+
attachTimeline({ timeline: e, observe: _ }) {
|
|
1258
|
+
return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && supportsScrollTimeline() ? (this.animation.timeline = e, noop) : _(this);
|
|
1259
|
+
}
|
|
1260
|
+
}, unsupportedEasingFunctions = {
|
|
1261
|
+
anticipate,
|
|
1262
|
+
backInOut,
|
|
1263
|
+
circInOut
|
|
1264
|
+
};
|
|
1265
|
+
function isUnsupportedEase(e) {
|
|
1266
|
+
return e in unsupportedEasingFunctions;
|
|
1267
|
+
}
|
|
1268
|
+
function replaceStringEasing(e) {
|
|
1269
|
+
typeof e.ease == "string" && isUnsupportedEase(e.ease) && (e.ease = unsupportedEasingFunctions[e.ease]);
|
|
1270
|
+
}
|
|
1271
|
+
var sampleDelta = 10, NativeAnimationExtended = class extends NativeAnimation {
|
|
1272
|
+
constructor(e) {
|
|
1273
|
+
replaceStringEasing(e), replaceTransitionType(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e;
|
|
1274
|
+
}
|
|
1275
|
+
updateMotionValue(e) {
|
|
1276
|
+
let { motionValue: _, onUpdate: v, onComplete: y, element: b, ...x } = this.options;
|
|
1277
|
+
if (!_) return;
|
|
1278
|
+
if (e !== void 0) {
|
|
1279
|
+
_.set(e);
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
let S = new JSAnimation({
|
|
1283
|
+
...x,
|
|
1284
|
+
autoplay: !1
|
|
1285
|
+
}), C = /* @__PURE__ */ secondsToMilliseconds(this.finishedTime ?? this.time);
|
|
1286
|
+
_.setWithVelocity(S.sample(C - sampleDelta).value, S.sample(C).value, sampleDelta), S.stop();
|
|
1287
|
+
}
|
|
1288
|
+
}, isAnimatable = (e, _) => _ === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && (complex.test(e) || e === "0") && !e.startsWith("url("));
|
|
1289
|
+
function hasKeyframesChanged(e) {
|
|
1290
|
+
let _ = e[0];
|
|
1291
|
+
if (e.length === 1) return !0;
|
|
1292
|
+
for (let v = 0; v < e.length; v++) if (e[v] !== _) return !0;
|
|
1293
|
+
}
|
|
1294
|
+
function canAnimate(e, _, v, y) {
|
|
1295
|
+
let b = e[0];
|
|
1296
|
+
if (b === null) return !1;
|
|
1297
|
+
if (_ === "display" || _ === "visibility") return !0;
|
|
1298
|
+
let x = e[e.length - 1], S = isAnimatable(b, _), C = isAnimatable(x, _);
|
|
1299
|
+
return warning(S === C, `You are trying to animate ${_} from "${b}" to "${x}". "${S ? x : b}" is not an animatable value.`, "value-not-animatable"), !S || !C ? !1 : hasKeyframesChanged(e) || (v === "spring" || isGenerator(v)) && y;
|
|
1300
|
+
}
|
|
1301
|
+
function makeAnimationInstant(e) {
|
|
1302
|
+
e.duration = 0, e.type = "keyframes";
|
|
1303
|
+
}
|
|
1304
|
+
var acceleratedValues = new Set([
|
|
1305
|
+
"opacity",
|
|
1306
|
+
"clipPath",
|
|
1307
|
+
"filter",
|
|
1308
|
+
"transform"
|
|
1309
|
+
]), supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
1310
|
+
function supportsBrowserAnimation(e) {
|
|
1311
|
+
let { motionValue: _, name: v, repeatDelay: y, repeatType: b, damping: x, type: S } = e;
|
|
1312
|
+
if (!(_?.owner?.current instanceof HTMLElement)) return !1;
|
|
1313
|
+
let { onUpdate: C, transformTemplate: w } = _.owner.getProps();
|
|
1314
|
+
return supportsWaapi() && v && acceleratedValues.has(v) && (v !== "transform" || !w) && !C && !y && b !== "mirror" && x !== 0 && S !== "inertia";
|
|
1315
|
+
}
|
|
1316
|
+
var MAX_RESOLVE_DELAY = 40, AsyncMotionValueAnimation = class extends WithPromise {
|
|
1317
|
+
constructor({ autoplay: e = !0, delay: _ = 0, type: v = "keyframes", repeat: y = 0, repeatDelay: b = 0, repeatType: x = "loop", keyframes: S, name: C, motionValue: w, element: T, ...E }) {
|
|
1318
|
+
super(), this.stop = () => {
|
|
1319
|
+
this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
|
|
1320
|
+
}, this.createdAt = time.now();
|
|
1321
|
+
let D = {
|
|
1322
|
+
autoplay: e,
|
|
1323
|
+
delay: _,
|
|
1324
|
+
type: v,
|
|
1325
|
+
repeat: y,
|
|
1326
|
+
repeatDelay: b,
|
|
1327
|
+
repeatType: x,
|
|
1328
|
+
name: C,
|
|
1329
|
+
motionValue: w,
|
|
1330
|
+
element: T,
|
|
1331
|
+
...E
|
|
1332
|
+
};
|
|
1333
|
+
this.keyframeResolver = new (T?.KeyframeResolver || KeyframeResolver)(S, (e, _, v) => this.onKeyframesResolved(e, _, D, !v), C, w, T), this.keyframeResolver?.scheduleResolve();
|
|
1334
|
+
}
|
|
1335
|
+
onKeyframesResolved(e, _, v, y) {
|
|
1336
|
+
this.keyframeResolver = void 0;
|
|
1337
|
+
let { name: b, type: x, velocity: S, delay: C, isHandoff: w, onUpdate: T } = v;
|
|
1338
|
+
this.resolvedAt = time.now(), canAnimate(e, b, x, S) || ((MotionGlobalConfig.instantAnimations || !C) && T?.(getFinalKeyframe$1(e, v, _)), e[0] = e[e.length - 1], makeAnimationInstant(v), v.repeat = 0);
|
|
1339
|
+
let E = {
|
|
1340
|
+
startTime: y ? this.resolvedAt && this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY ? this.resolvedAt : this.createdAt : void 0,
|
|
1341
|
+
finalKeyframe: _,
|
|
1342
|
+
...v,
|
|
1343
|
+
keyframes: e
|
|
1344
|
+
}, D = !w && supportsBrowserAnimation(E) ? new NativeAnimationExtended({
|
|
1345
|
+
...E,
|
|
1346
|
+
element: E.motionValue.owner.current
|
|
1347
|
+
}) : new JSAnimation(E);
|
|
1348
|
+
D.finished.then(() => this.notifyFinished()).catch(noop), this.pendingTimeline &&= (this.stopTimeline = D.attachTimeline(this.pendingTimeline), void 0), this._animation = D;
|
|
1349
|
+
}
|
|
1350
|
+
get finished() {
|
|
1351
|
+
return this._animation ? this.animation.finished : this._finished;
|
|
1352
|
+
}
|
|
1353
|
+
then(e, _) {
|
|
1354
|
+
return this.finished.finally(e).then(() => {});
|
|
1355
|
+
}
|
|
1356
|
+
get animation() {
|
|
1357
|
+
return this._animation || (this.keyframeResolver?.resume(), flushKeyframeResolvers()), this._animation;
|
|
1358
|
+
}
|
|
1359
|
+
get duration() {
|
|
1360
|
+
return this.animation.duration;
|
|
1361
|
+
}
|
|
1362
|
+
get iterationDuration() {
|
|
1363
|
+
return this.animation.iterationDuration;
|
|
1364
|
+
}
|
|
1365
|
+
get time() {
|
|
1366
|
+
return this.animation.time;
|
|
1367
|
+
}
|
|
1368
|
+
set time(e) {
|
|
1369
|
+
this.animation.time = e;
|
|
1370
|
+
}
|
|
1371
|
+
get speed() {
|
|
1372
|
+
return this.animation.speed;
|
|
1373
|
+
}
|
|
1374
|
+
get state() {
|
|
1375
|
+
return this.animation.state;
|
|
1376
|
+
}
|
|
1377
|
+
set speed(e) {
|
|
1378
|
+
this.animation.speed = e;
|
|
1379
|
+
}
|
|
1380
|
+
get startTime() {
|
|
1381
|
+
return this.animation.startTime;
|
|
1382
|
+
}
|
|
1383
|
+
attachTimeline(e) {
|
|
1384
|
+
return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
|
|
1385
|
+
}
|
|
1386
|
+
play() {
|
|
1387
|
+
this.animation.play();
|
|
1388
|
+
}
|
|
1389
|
+
pause() {
|
|
1390
|
+
this.animation.pause();
|
|
1391
|
+
}
|
|
1392
|
+
complete() {
|
|
1393
|
+
this.animation.complete();
|
|
1394
|
+
}
|
|
1395
|
+
cancel() {
|
|
1396
|
+
this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
|
|
1397
|
+
}
|
|
1398
|
+
}, splitCSSVariableRegex = /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
|
|
1399
|
+
function parseCSSVariable(e) {
|
|
1400
|
+
let _ = splitCSSVariableRegex.exec(e);
|
|
1401
|
+
if (!_) return [,];
|
|
1402
|
+
let [, v, y, b] = _;
|
|
1403
|
+
return [`--${v ?? y}`, b];
|
|
1404
|
+
}
|
|
1405
|
+
var maxDepth = 4;
|
|
1406
|
+
function getVariableValue(e, _, v = 1) {
|
|
1407
|
+
invariant(v <= maxDepth, `Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
1408
|
+
let [y, b] = parseCSSVariable(e);
|
|
1409
|
+
if (!y) return;
|
|
1410
|
+
let x = window.getComputedStyle(_).getPropertyValue(y);
|
|
1411
|
+
if (x) {
|
|
1412
|
+
let e = x.trim();
|
|
1413
|
+
return isNumericalString(e) ? parseFloat(e) : e;
|
|
1414
|
+
}
|
|
1415
|
+
return isCSSVariableToken(b) ? getVariableValue(b, _, v + 1) : b;
|
|
1416
|
+
}
|
|
1417
|
+
function getValueTransition(e, _) {
|
|
1418
|
+
return e?.[_] ?? e?.default ?? e;
|
|
1419
|
+
}
|
|
1420
|
+
var positionalKeys = new Set([
|
|
1421
|
+
"width",
|
|
1422
|
+
"height",
|
|
1423
|
+
"top",
|
|
1424
|
+
"left",
|
|
1425
|
+
"right",
|
|
1426
|
+
"bottom",
|
|
1427
|
+
...transformPropOrder
|
|
1428
|
+
]), auto = {
|
|
1429
|
+
test: (e) => e === "auto",
|
|
1430
|
+
parse: (e) => e
|
|
1431
|
+
}, testValueType = (e) => (_) => _.test(e), dimensionValueTypes = [
|
|
1432
|
+
number,
|
|
1433
|
+
px,
|
|
1434
|
+
percent,
|
|
1435
|
+
degrees,
|
|
1436
|
+
vw,
|
|
1437
|
+
vh,
|
|
1438
|
+
auto
|
|
1439
|
+
], findDimensionValueType = (e) => dimensionValueTypes.find(testValueType(e));
|
|
1440
|
+
function isNone(e) {
|
|
1441
|
+
return typeof e == "number" ? e === 0 : e === null ? !0 : e === "none" || e === "0" || isZeroValueString(e);
|
|
1442
|
+
}
|
|
1443
|
+
var maxDefaults = new Set([
|
|
1444
|
+
"brightness",
|
|
1445
|
+
"contrast",
|
|
1446
|
+
"saturate",
|
|
1447
|
+
"opacity"
|
|
1448
|
+
]);
|
|
1449
|
+
function applyDefaultFilter(e) {
|
|
1450
|
+
let [_, v] = e.slice(0, -1).split("(");
|
|
1451
|
+
if (_ === "drop-shadow") return e;
|
|
1452
|
+
let [y] = v.match(floatRegex) || [];
|
|
1453
|
+
if (!y) return e;
|
|
1454
|
+
let b = v.replace(y, ""), x = maxDefaults.has(_) ? 1 : 0;
|
|
1455
|
+
return y !== v && (x *= 100), _ + "(" + x + b + ")";
|
|
1456
|
+
}
|
|
1457
|
+
var functionRegex = /\b([a-z-]*)\(.*?\)/gu, filter = {
|
|
1458
|
+
...complex,
|
|
1459
|
+
getAnimatableNone: (e) => {
|
|
1460
|
+
let _ = e.match(functionRegex);
|
|
1461
|
+
return _ ? _.map(applyDefaultFilter).join(" ") : e;
|
|
1462
|
+
}
|
|
1463
|
+
}, int = {
|
|
1464
|
+
...number,
|
|
1465
|
+
transform: Math.round
|
|
1466
|
+
}, numberValueTypes = {
|
|
1467
|
+
borderWidth: px,
|
|
1468
|
+
borderTopWidth: px,
|
|
1469
|
+
borderRightWidth: px,
|
|
1470
|
+
borderBottomWidth: px,
|
|
1471
|
+
borderLeftWidth: px,
|
|
1472
|
+
borderRadius: px,
|
|
1473
|
+
radius: px,
|
|
1474
|
+
borderTopLeftRadius: px,
|
|
1475
|
+
borderTopRightRadius: px,
|
|
1476
|
+
borderBottomRightRadius: px,
|
|
1477
|
+
borderBottomLeftRadius: px,
|
|
1478
|
+
width: px,
|
|
1479
|
+
maxWidth: px,
|
|
1480
|
+
height: px,
|
|
1481
|
+
maxHeight: px,
|
|
1482
|
+
top: px,
|
|
1483
|
+
right: px,
|
|
1484
|
+
bottom: px,
|
|
1485
|
+
left: px,
|
|
1486
|
+
padding: px,
|
|
1487
|
+
paddingTop: px,
|
|
1488
|
+
paddingRight: px,
|
|
1489
|
+
paddingBottom: px,
|
|
1490
|
+
paddingLeft: px,
|
|
1491
|
+
margin: px,
|
|
1492
|
+
marginTop: px,
|
|
1493
|
+
marginRight: px,
|
|
1494
|
+
marginBottom: px,
|
|
1495
|
+
marginLeft: px,
|
|
1496
|
+
backgroundPositionX: px,
|
|
1497
|
+
backgroundPositionY: px,
|
|
1498
|
+
rotate: degrees,
|
|
1499
|
+
rotateX: degrees,
|
|
1500
|
+
rotateY: degrees,
|
|
1501
|
+
rotateZ: degrees,
|
|
1502
|
+
scale,
|
|
1503
|
+
scaleX: scale,
|
|
1504
|
+
scaleY: scale,
|
|
1505
|
+
scaleZ: scale,
|
|
1506
|
+
skew: degrees,
|
|
1507
|
+
skewX: degrees,
|
|
1508
|
+
skewY: degrees,
|
|
1509
|
+
distance: px,
|
|
1510
|
+
translateX: px,
|
|
1511
|
+
translateY: px,
|
|
1512
|
+
translateZ: px,
|
|
1513
|
+
x: px,
|
|
1514
|
+
y: px,
|
|
1515
|
+
z: px,
|
|
1516
|
+
perspective: px,
|
|
1517
|
+
transformPerspective: px,
|
|
1518
|
+
opacity: alpha,
|
|
1519
|
+
originX: progressPercentage,
|
|
1520
|
+
originY: progressPercentage,
|
|
1521
|
+
originZ: px,
|
|
1522
|
+
zIndex: int,
|
|
1523
|
+
fillOpacity: alpha,
|
|
1524
|
+
strokeOpacity: alpha,
|
|
1525
|
+
numOctaves: int
|
|
1526
|
+
}, defaultValueTypes = {
|
|
1527
|
+
...numberValueTypes,
|
|
1528
|
+
color,
|
|
1529
|
+
backgroundColor: color,
|
|
1530
|
+
outlineColor: color,
|
|
1531
|
+
fill: color,
|
|
1532
|
+
stroke: color,
|
|
1533
|
+
borderColor: color,
|
|
1534
|
+
borderTopColor: color,
|
|
1535
|
+
borderRightColor: color,
|
|
1536
|
+
borderBottomColor: color,
|
|
1537
|
+
borderLeftColor: color,
|
|
1538
|
+
filter,
|
|
1539
|
+
WebkitFilter: filter
|
|
1540
|
+
}, getDefaultValueType = (e) => defaultValueTypes[e];
|
|
1541
|
+
function getAnimatableNone(e, _) {
|
|
1542
|
+
let v = getDefaultValueType(e);
|
|
1543
|
+
return v !== filter && (v = complex), v.getAnimatableNone ? v.getAnimatableNone(_) : void 0;
|
|
1544
|
+
}
|
|
1545
|
+
var invalidTemplates = new Set([
|
|
1546
|
+
"auto",
|
|
1547
|
+
"none",
|
|
1548
|
+
"0"
|
|
1549
|
+
]);
|
|
1550
|
+
function makeNoneKeyframesAnimatable(e, _, v) {
|
|
1551
|
+
let y = 0, b;
|
|
1552
|
+
for (; y < e.length && !b;) {
|
|
1553
|
+
let _ = e[y];
|
|
1554
|
+
typeof _ == "string" && !invalidTemplates.has(_) && analyseComplexValue(_).values.length && (b = e[y]), y++;
|
|
1555
|
+
}
|
|
1556
|
+
if (b && v) for (let y of _) e[y] = getAnimatableNone(v, b);
|
|
1557
|
+
}
|
|
1558
|
+
var DOMKeyframesResolver = class extends KeyframeResolver {
|
|
1559
|
+
constructor(e, _, v, y, b) {
|
|
1560
|
+
super(e, _, v, y, b, !0);
|
|
1561
|
+
}
|
|
1562
|
+
readKeyframes() {
|
|
1563
|
+
let { unresolvedKeyframes: e, element: _, name: v } = this;
|
|
1564
|
+
if (!_ || !_.current) return;
|
|
1565
|
+
super.readKeyframes();
|
|
1566
|
+
for (let v = 0; v < e.length; v++) {
|
|
1567
|
+
let y = e[v];
|
|
1568
|
+
if (typeof y == "string" && (y = y.trim(), isCSSVariableToken(y))) {
|
|
1569
|
+
let b = getVariableValue(y, _.current);
|
|
1570
|
+
b !== void 0 && (e[v] = b), v === e.length - 1 && (this.finalKeyframe = y);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
if (this.resolveNoneKeyframes(), !positionalKeys.has(v) || e.length !== 2) return;
|
|
1574
|
+
let [y, b] = e, x = findDimensionValueType(y), S = findDimensionValueType(b);
|
|
1575
|
+
if (x !== S) if (isNumOrPxType(x) && isNumOrPxType(S)) for (let _ = 0; _ < e.length; _++) {
|
|
1576
|
+
let v = e[_];
|
|
1577
|
+
typeof v == "string" && (e[_] = parseFloat(v));
|
|
1578
|
+
}
|
|
1579
|
+
else positionalValues[v] && (this.needsMeasurement = !0);
|
|
1580
|
+
}
|
|
1581
|
+
resolveNoneKeyframes() {
|
|
1582
|
+
let { unresolvedKeyframes: e, name: _ } = this, v = [];
|
|
1583
|
+
for (let _ = 0; _ < e.length; _++) (e[_] === null || isNone(e[_])) && v.push(_);
|
|
1584
|
+
v.length && makeNoneKeyframesAnimatable(e, v, _);
|
|
1585
|
+
}
|
|
1586
|
+
measureInitialState() {
|
|
1587
|
+
let { element: e, unresolvedKeyframes: _, name: v } = this;
|
|
1588
|
+
if (!e || !e.current) return;
|
|
1589
|
+
v === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = positionalValues[v](e.measureViewportBox(), window.getComputedStyle(e.current)), _[0] = this.measuredOrigin;
|
|
1590
|
+
let y = _[_.length - 1];
|
|
1591
|
+
y !== void 0 && e.getValue(v, y).jump(y, !1);
|
|
1592
|
+
}
|
|
1593
|
+
measureEndState() {
|
|
1594
|
+
let { element: e, name: _, unresolvedKeyframes: v } = this;
|
|
1595
|
+
if (!e || !e.current) return;
|
|
1596
|
+
let y = e.getValue(_);
|
|
1597
|
+
y && y.jump(this.measuredOrigin, !1);
|
|
1598
|
+
let b = v.length - 1, x = v[b];
|
|
1599
|
+
v[b] = positionalValues[_](e.measureViewportBox(), window.getComputedStyle(e.current)), x !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = x), this.removedTransforms?.length && this.removedTransforms.forEach(([_, v]) => {
|
|
1600
|
+
e.getValue(_).set(v);
|
|
1601
|
+
}), this.resolveNoneKeyframes();
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
function resolveElements(e, _, v) {
|
|
1605
|
+
if (e instanceof EventTarget) return [e];
|
|
1606
|
+
if (typeof e == "string") {
|
|
1607
|
+
let y = document;
|
|
1608
|
+
_ && (y = _.current);
|
|
1609
|
+
let b = v?.[e] ?? y.querySelectorAll(e);
|
|
1610
|
+
return b ? Array.from(b) : [];
|
|
1611
|
+
}
|
|
1612
|
+
return Array.from(e);
|
|
1613
|
+
}
|
|
1614
|
+
var getValueAsType = (e, _) => _ && typeof e == "number" ? _.transform(e) : e;
|
|
1615
|
+
function isHTMLElement(e) {
|
|
1616
|
+
return isObject(e) && "offsetHeight" in e;
|
|
1617
|
+
}
|
|
1618
|
+
var MAX_VELOCITY_DELTA = 30, isFloat = (e) => !isNaN(parseFloat(e)), collectMotionValues = { current: void 0 }, MotionValue = class {
|
|
1619
|
+
constructor(e, _ = {}) {
|
|
1620
|
+
this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (e) => {
|
|
1621
|
+
let _ = time.now();
|
|
1622
|
+
if (this.updatedAt !== _ && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(e), this.current !== this.prev && (this.events.change?.notify(this.current), this.dependents)) for (let e of this.dependents) e.dirty();
|
|
1623
|
+
}, this.hasAnimated = !1, this.setCurrent(e), this.owner = _.owner;
|
|
1624
|
+
}
|
|
1625
|
+
setCurrent(e) {
|
|
1626
|
+
this.current = e, this.updatedAt = time.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = isFloat(this.current));
|
|
1627
|
+
}
|
|
1628
|
+
setPrevFrameValue(e = this.current) {
|
|
1629
|
+
this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
|
|
1630
|
+
}
|
|
1631
|
+
onChange(e) {
|
|
1632
|
+
return process.env.NODE_ENV !== "production" && warnOnce(!1, "value.onChange(callback) is deprecated. Switch to value.on(\"change\", callback)."), this.on("change", e);
|
|
1633
|
+
}
|
|
1634
|
+
on(e, _) {
|
|
1635
|
+
this.events[e] || (this.events[e] = new SubscriptionManager());
|
|
1636
|
+
let v = this.events[e].add(_);
|
|
1637
|
+
return e === "change" ? () => {
|
|
1638
|
+
v(), frame.read(() => {
|
|
1639
|
+
this.events.change.getSize() || this.stop();
|
|
1640
|
+
});
|
|
1641
|
+
} : v;
|
|
1642
|
+
}
|
|
1643
|
+
clearListeners() {
|
|
1644
|
+
for (let e in this.events) this.events[e].clear();
|
|
1645
|
+
}
|
|
1646
|
+
attach(e, _) {
|
|
1647
|
+
this.passiveEffect = e, this.stopPassiveEffect = _;
|
|
1648
|
+
}
|
|
1649
|
+
set(e) {
|
|
1650
|
+
this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
|
|
1651
|
+
}
|
|
1652
|
+
setWithVelocity(e, _, v) {
|
|
1653
|
+
this.set(_), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - v;
|
|
1654
|
+
}
|
|
1655
|
+
jump(e, _ = !0) {
|
|
1656
|
+
this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, _ && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1657
|
+
}
|
|
1658
|
+
dirty() {
|
|
1659
|
+
this.events.change?.notify(this.current);
|
|
1660
|
+
}
|
|
1661
|
+
addDependent(e) {
|
|
1662
|
+
this.dependents ||= /* @__PURE__ */ new Set(), this.dependents.add(e);
|
|
1663
|
+
}
|
|
1664
|
+
removeDependent(e) {
|
|
1665
|
+
this.dependents && this.dependents.delete(e);
|
|
1666
|
+
}
|
|
1667
|
+
get() {
|
|
1668
|
+
return collectMotionValues.current && collectMotionValues.current.push(this), this.current;
|
|
1669
|
+
}
|
|
1670
|
+
getPrevious() {
|
|
1671
|
+
return this.prev;
|
|
1672
|
+
}
|
|
1673
|
+
getVelocity() {
|
|
1674
|
+
let e = time.now();
|
|
1675
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > MAX_VELOCITY_DELTA) return 0;
|
|
1676
|
+
let _ = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
1677
|
+
return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), _);
|
|
1678
|
+
}
|
|
1679
|
+
start(e) {
|
|
1680
|
+
return this.stop(), new Promise((_) => {
|
|
1681
|
+
this.hasAnimated = !0, this.animation = e(_), this.events.animationStart && this.events.animationStart.notify();
|
|
1682
|
+
}).then(() => {
|
|
1683
|
+
this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
stop() {
|
|
1687
|
+
this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
|
|
1688
|
+
}
|
|
1689
|
+
isAnimating() {
|
|
1690
|
+
return !!this.animation;
|
|
1691
|
+
}
|
|
1692
|
+
clearAnimation() {
|
|
1693
|
+
delete this.animation;
|
|
1694
|
+
}
|
|
1695
|
+
destroy() {
|
|
1696
|
+
this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1697
|
+
}
|
|
1698
|
+
};
|
|
1699
|
+
function motionValue(e, _) {
|
|
1700
|
+
return new MotionValue(e, _);
|
|
1701
|
+
}
|
|
1702
|
+
var { schedule: microtask, cancel: cancelMicrotask } = /* @__PURE__ */ createRenderBatcher(queueMicrotask, !1), isDragging = {
|
|
1703
|
+
x: !1,
|
|
1704
|
+
y: !1
|
|
1705
|
+
};
|
|
1706
|
+
function isDragActive() {
|
|
1707
|
+
return isDragging.x || isDragging.y;
|
|
1708
|
+
}
|
|
1709
|
+
function setDragLock(e) {
|
|
1710
|
+
return e === "x" || e === "y" ? isDragging[e] ? null : (isDragging[e] = !0, () => {
|
|
1711
|
+
isDragging[e] = !1;
|
|
1712
|
+
}) : isDragging.x || isDragging.y ? null : (isDragging.x = isDragging.y = !0, () => {
|
|
1713
|
+
isDragging.x = isDragging.y = !1;
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
function setupGesture(e, _) {
|
|
1717
|
+
let v = resolveElements(e), y = new AbortController();
|
|
1718
|
+
return [
|
|
1719
|
+
v,
|
|
1720
|
+
{
|
|
1721
|
+
passive: !0,
|
|
1722
|
+
..._,
|
|
1723
|
+
signal: y.signal
|
|
1724
|
+
},
|
|
1725
|
+
() => y.abort()
|
|
1726
|
+
];
|
|
1727
|
+
}
|
|
1728
|
+
function isValidHover(e) {
|
|
1729
|
+
return !(e.pointerType === "touch" || isDragActive());
|
|
1730
|
+
}
|
|
1731
|
+
function hover(e, _, v = {}) {
|
|
1732
|
+
let [y, b, x] = setupGesture(e, v), S = (e) => {
|
|
1733
|
+
if (!isValidHover(e)) return;
|
|
1734
|
+
let { target: v } = e, y = _(v, e);
|
|
1735
|
+
if (typeof y != "function" || !v) return;
|
|
1736
|
+
let x = (e) => {
|
|
1737
|
+
isValidHover(e) && (y(e), v.removeEventListener("pointerleave", x));
|
|
1738
|
+
};
|
|
1739
|
+
v.addEventListener("pointerleave", x, b);
|
|
1740
|
+
};
|
|
1741
|
+
return y.forEach((e) => {
|
|
1742
|
+
e.addEventListener("pointerenter", S, b);
|
|
1743
|
+
}), x;
|
|
1744
|
+
}
|
|
1745
|
+
var isNodeOrChild = (e, _) => _ ? e === _ ? !0 : isNodeOrChild(e, _.parentElement) : !1, isPrimaryPointer = (e) => e.pointerType === "mouse" ? typeof e.button != "number" || e.button <= 0 : e.isPrimary !== !1, focusableElements = new Set([
|
|
1746
|
+
"BUTTON",
|
|
1747
|
+
"INPUT",
|
|
1748
|
+
"SELECT",
|
|
1749
|
+
"TEXTAREA",
|
|
1750
|
+
"A"
|
|
1751
|
+
]);
|
|
1752
|
+
function isElementKeyboardAccessible(e) {
|
|
1753
|
+
return focusableElements.has(e.tagName) || e.tabIndex !== -1;
|
|
1754
|
+
}
|
|
1755
|
+
var isPressing = /* @__PURE__ */ new WeakSet();
|
|
1756
|
+
function filterEvents(e) {
|
|
1757
|
+
return (_) => {
|
|
1758
|
+
_.key === "Enter" && e(_);
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
function firePointerEvent(e, _) {
|
|
1762
|
+
e.dispatchEvent(new PointerEvent("pointer" + _, {
|
|
1763
|
+
isPrimary: !0,
|
|
1764
|
+
bubbles: !0
|
|
1765
|
+
}));
|
|
1766
|
+
}
|
|
1767
|
+
var enableKeyboardPress = (e, _) => {
|
|
1768
|
+
let v = e.currentTarget;
|
|
1769
|
+
if (!v) return;
|
|
1770
|
+
let y = filterEvents(() => {
|
|
1771
|
+
if (isPressing.has(v)) return;
|
|
1772
|
+
firePointerEvent(v, "down");
|
|
1773
|
+
let e = filterEvents(() => {
|
|
1774
|
+
firePointerEvent(v, "up");
|
|
1775
|
+
});
|
|
1776
|
+
v.addEventListener("keyup", e, _), v.addEventListener("blur", () => firePointerEvent(v, "cancel"), _);
|
|
1777
|
+
});
|
|
1778
|
+
v.addEventListener("keydown", y, _), v.addEventListener("blur", () => v.removeEventListener("keydown", y), _);
|
|
1779
|
+
};
|
|
1780
|
+
function isValidPressEvent(e) {
|
|
1781
|
+
return isPrimaryPointer(e) && !isDragActive();
|
|
1782
|
+
}
|
|
1783
|
+
function press(e, _, v = {}) {
|
|
1784
|
+
let [y, b, x] = setupGesture(e, v), S = (e) => {
|
|
1785
|
+
let y = e.currentTarget;
|
|
1786
|
+
if (!isValidPressEvent(e)) return;
|
|
1787
|
+
isPressing.add(y);
|
|
1788
|
+
let x = _(y, e), S = (e, _) => {
|
|
1789
|
+
window.removeEventListener("pointerup", C), window.removeEventListener("pointercancel", w), isPressing.has(y) && isPressing.delete(y), isValidPressEvent(e) && typeof x == "function" && x(e, { success: _ });
|
|
1790
|
+
}, C = (e) => {
|
|
1791
|
+
S(e, y === window || y === document || v.useGlobalTarget || isNodeOrChild(y, e.target));
|
|
1792
|
+
}, w = (e) => {
|
|
1793
|
+
S(e, !1);
|
|
1794
|
+
};
|
|
1795
|
+
window.addEventListener("pointerup", C, b), window.addEventListener("pointercancel", w, b);
|
|
1796
|
+
};
|
|
1797
|
+
return y.forEach((e) => {
|
|
1798
|
+
(v.useGlobalTarget ? window : e).addEventListener("pointerdown", S, b), isHTMLElement(e) && (e.addEventListener("focus", (e) => enableKeyboardPress(e, b)), !isElementKeyboardAccessible(e) && !e.hasAttribute("tabindex") && (e.tabIndex = 0));
|
|
1799
|
+
}), x;
|
|
1800
|
+
}
|
|
1801
|
+
function isSVGElement(e) {
|
|
1802
|
+
return isObject(e) && "ownerSVGElement" in e;
|
|
1803
|
+
}
|
|
1804
|
+
function isSVGSVGElement(e) {
|
|
1805
|
+
return isSVGElement(e) && e.tagName === "svg";
|
|
1806
|
+
}
|
|
1807
|
+
var isMotionValue = (e) => !!(e && e.getVelocity), valueTypes = [
|
|
1808
|
+
...dimensionValueTypes,
|
|
1809
|
+
color,
|
|
1810
|
+
complex
|
|
1811
|
+
], findValueType = (e) => valueTypes.find(testValueType(e)), MotionConfigContext = createContext({
|
|
1812
|
+
transformPagePoint: (e) => e,
|
|
1813
|
+
isStatic: !1,
|
|
1814
|
+
reducedMotion: "never"
|
|
1815
|
+
});
|
|
1816
|
+
function setRef(e, _) {
|
|
1817
|
+
if (typeof e == "function") return e(_);
|
|
1818
|
+
e != null && (e.current = _);
|
|
1819
|
+
}
|
|
1820
|
+
function composeRefs(...e) {
|
|
1821
|
+
return (_) => {
|
|
1822
|
+
let v = !1, y = e.map((e) => {
|
|
1823
|
+
let y = setRef(e, _);
|
|
1824
|
+
return !v && typeof y == "function" && (v = !0), y;
|
|
1825
|
+
});
|
|
1826
|
+
if (v) return () => {
|
|
1827
|
+
for (let _ = 0; _ < y.length; _++) {
|
|
1828
|
+
let v = y[_];
|
|
1829
|
+
typeof v == "function" ? v() : setRef(e[_], null);
|
|
1830
|
+
}
|
|
1831
|
+
};
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
function useComposedRefs(..._) {
|
|
1835
|
+
return React.useCallback(composeRefs(..._), _);
|
|
1836
|
+
}
|
|
1837
|
+
var import_jsx_runtime = require_jsx_runtime(), PopChildMeasure = class extends React.Component {
|
|
1838
|
+
getSnapshotBeforeUpdate(e) {
|
|
1839
|
+
let _ = this.props.childRef.current;
|
|
1840
|
+
if (_ && e.isPresent && !this.props.isPresent) {
|
|
1841
|
+
let e = _.offsetParent, v = isHTMLElement(e) && e.offsetWidth || 0, y = this.props.sizeRef.current;
|
|
1842
|
+
y.height = _.offsetHeight || 0, y.width = _.offsetWidth || 0, y.top = _.offsetTop, y.left = _.offsetLeft, y.right = v - y.width - y.left;
|
|
1843
|
+
}
|
|
1844
|
+
return null;
|
|
1845
|
+
}
|
|
1846
|
+
componentDidUpdate() {}
|
|
1847
|
+
render() {
|
|
1848
|
+
return this.props.children;
|
|
1849
|
+
}
|
|
1850
|
+
};
|
|
1851
|
+
function PopChild({ children: _, isPresent: v, anchorX: y, root: b }) {
|
|
1852
|
+
let x = useId(), S = useRef(null), C = useRef({
|
|
1853
|
+
width: 0,
|
|
1854
|
+
height: 0,
|
|
1855
|
+
top: 0,
|
|
1856
|
+
left: 0,
|
|
1857
|
+
right: 0
|
|
1858
|
+
}), { nonce: w } = useContext(MotionConfigContext), E = useComposedRefs(S, _?.ref);
|
|
1859
|
+
return useInsertionEffect(() => {
|
|
1860
|
+
let { width: e, height: _, top: T, left: E, right: D } = C.current;
|
|
1861
|
+
if (v || !S.current || !e || !_) return;
|
|
1862
|
+
let O = y === "left" ? `left: ${E}` : `right: ${D}`;
|
|
1863
|
+
S.current.dataset.motionPopId = x;
|
|
1864
|
+
let k = document.createElement("style");
|
|
1865
|
+
w && (k.nonce = w);
|
|
1866
|
+
let A = b ?? document.head;
|
|
1867
|
+
return A.appendChild(k), k.sheet && k.sheet.insertRule(`
|
|
1868
|
+
[data-motion-pop-id="${x}"] {
|
|
1869
|
+
position: absolute !important;
|
|
1870
|
+
width: ${e}px !important;
|
|
1871
|
+
height: ${_}px !important;
|
|
1872
|
+
${O}px !important;
|
|
1873
|
+
top: ${T}px !important;
|
|
1874
|
+
}
|
|
1875
|
+
`), () => {
|
|
1876
|
+
A.contains(k) && A.removeChild(k);
|
|
1877
|
+
};
|
|
1878
|
+
}, [v]), (0, import_jsx_runtime.jsx)(PopChildMeasure, {
|
|
1879
|
+
isPresent: v,
|
|
1880
|
+
childRef: S,
|
|
1881
|
+
sizeRef: C,
|
|
1882
|
+
children: React.cloneElement(_, { ref: E })
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
var PresenceChild = ({ children: _, initial: v, isPresent: y, onExitComplete: b, custom: x, presenceAffectsLayout: S, mode: C, anchorX: w, root: T }) => {
|
|
1886
|
+
let E = useConstant(newChildrenMap), O = useId(), k = !0, j = useMemo(() => (k = !1, {
|
|
1887
|
+
id: O,
|
|
1888
|
+
initial: v,
|
|
1889
|
+
isPresent: y,
|
|
1890
|
+
custom: x,
|
|
1891
|
+
onExitComplete: (e) => {
|
|
1892
|
+
E.set(e, !0);
|
|
1893
|
+
for (let e of E.values()) if (!e) return;
|
|
1894
|
+
b && b();
|
|
1895
|
+
},
|
|
1896
|
+
register: (e) => (E.set(e, !1), () => E.delete(e))
|
|
1897
|
+
}), [
|
|
1898
|
+
y,
|
|
1899
|
+
E,
|
|
1900
|
+
b
|
|
1901
|
+
]);
|
|
1902
|
+
return S && k && (j = { ...j }), useMemo(() => {
|
|
1903
|
+
E.forEach((e, _) => E.set(_, !1));
|
|
1904
|
+
}, [y]), React.useEffect(() => {
|
|
1905
|
+
!y && !E.size && b && b();
|
|
1906
|
+
}, [y]), C === "popLayout" && (_ = (0, import_jsx_runtime.jsx)(PopChild, {
|
|
1907
|
+
isPresent: y,
|
|
1908
|
+
anchorX: w,
|
|
1909
|
+
root: T,
|
|
1910
|
+
children: _
|
|
1911
|
+
})), (0, import_jsx_runtime.jsx)(PresenceContext.Provider, {
|
|
1912
|
+
value: j,
|
|
1913
|
+
children: _
|
|
1914
|
+
});
|
|
1915
|
+
};
|
|
1916
|
+
function newChildrenMap() {
|
|
1917
|
+
return /* @__PURE__ */ new Map();
|
|
1918
|
+
}
|
|
1919
|
+
function usePresence(e = !0) {
|
|
1920
|
+
let _ = useContext(PresenceContext);
|
|
1921
|
+
if (_ === null) return [!0, null];
|
|
1922
|
+
let { isPresent: v, onExitComplete: y, register: b } = _, x = useId();
|
|
1923
|
+
useEffect(() => {
|
|
1924
|
+
if (e) return b(x);
|
|
1925
|
+
}, [e]);
|
|
1926
|
+
let S = useCallback(() => e && y && y(x), [
|
|
1927
|
+
x,
|
|
1928
|
+
y,
|
|
1929
|
+
e
|
|
1930
|
+
]);
|
|
1931
|
+
return !v && y ? [!1, S] : [!0];
|
|
1932
|
+
}
|
|
1933
|
+
var getChildKey = (e) => e.key || "";
|
|
1934
|
+
function onlyElements(e) {
|
|
1935
|
+
let v = [];
|
|
1936
|
+
return Children.forEach(e, (e) => {
|
|
1937
|
+
isValidElement(e) && v.push(e);
|
|
1938
|
+
}), v;
|
|
1939
|
+
}
|
|
1940
|
+
var AnimatePresence = ({ children: e, custom: _, initial: v = !0, onExitComplete: y, presenceAffectsLayout: b = !0, mode: x = "sync", propagate: S = !1, anchorX: C = "left", root: w }) => {
|
|
1941
|
+
let [E, D] = usePresence(S), O = useMemo(() => onlyElements(e), [e]), k = S && !E ? [] : O.map(getChildKey), N = useRef(!0), P = useRef(O), F = useConstant(() => /* @__PURE__ */ new Map()), [I, L] = useState(O), [R, z] = useState(O);
|
|
1942
|
+
useIsomorphicLayoutEffect(() => {
|
|
1943
|
+
N.current = !1, P.current = O;
|
|
1944
|
+
for (let e = 0; e < R.length; e++) {
|
|
1945
|
+
let _ = getChildKey(R[e]);
|
|
1946
|
+
k.includes(_) ? F.delete(_) : F.get(_) !== !0 && F.set(_, !1);
|
|
1947
|
+
}
|
|
1948
|
+
}, [
|
|
1949
|
+
R,
|
|
1950
|
+
k.length,
|
|
1951
|
+
k.join("-")
|
|
1952
|
+
]);
|
|
1953
|
+
let B = [];
|
|
1954
|
+
if (O !== I) {
|
|
1955
|
+
let e = [...O];
|
|
1956
|
+
for (let _ = 0; _ < R.length; _++) {
|
|
1957
|
+
let v = R[_], y = getChildKey(v);
|
|
1958
|
+
k.includes(y) || (e.splice(_, 0, v), B.push(v));
|
|
1959
|
+
}
|
|
1960
|
+
return x === "wait" && B.length && (e = B), z(onlyElements(e)), L(O), null;
|
|
1961
|
+
}
|
|
1962
|
+
process.env.NODE_ENV !== "production" && x === "wait" && R.length > 1 && console.warn("You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.");
|
|
1963
|
+
let { forceRender: V } = useContext(LayoutGroupContext);
|
|
1964
|
+
return (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: R.map((e) => {
|
|
1965
|
+
let T = getChildKey(e), A = S && !E ? !1 : O === R || k.includes(T);
|
|
1966
|
+
return (0, import_jsx_runtime.jsx)(PresenceChild, {
|
|
1967
|
+
isPresent: A,
|
|
1968
|
+
initial: !N.current || v ? void 0 : !1,
|
|
1969
|
+
custom: _,
|
|
1970
|
+
presenceAffectsLayout: b,
|
|
1971
|
+
mode: x,
|
|
1972
|
+
root: w,
|
|
1973
|
+
onExitComplete: A ? void 0 : () => {
|
|
1974
|
+
if (F.has(T)) F.set(T, !0);
|
|
1975
|
+
else return;
|
|
1976
|
+
let e = !0;
|
|
1977
|
+
F.forEach((_) => {
|
|
1978
|
+
_ || (e = !1);
|
|
1979
|
+
}), e && (V?.(), z(P.current), S && D?.(), y && y());
|
|
1980
|
+
},
|
|
1981
|
+
anchorX: C,
|
|
1982
|
+
children: e
|
|
1983
|
+
}, T);
|
|
1984
|
+
}) });
|
|
1985
|
+
}, LazyContext = createContext({ strict: !1 }), featureProps = {
|
|
1986
|
+
animation: [
|
|
1987
|
+
"animate",
|
|
1988
|
+
"variants",
|
|
1989
|
+
"whileHover",
|
|
1990
|
+
"whileTap",
|
|
1991
|
+
"exit",
|
|
1992
|
+
"whileInView",
|
|
1993
|
+
"whileFocus",
|
|
1994
|
+
"whileDrag"
|
|
1995
|
+
],
|
|
1996
|
+
exit: ["exit"],
|
|
1997
|
+
drag: ["drag", "dragControls"],
|
|
1998
|
+
focus: ["whileFocus"],
|
|
1999
|
+
hover: [
|
|
2000
|
+
"whileHover",
|
|
2001
|
+
"onHoverStart",
|
|
2002
|
+
"onHoverEnd"
|
|
2003
|
+
],
|
|
2004
|
+
tap: [
|
|
2005
|
+
"whileTap",
|
|
2006
|
+
"onTap",
|
|
2007
|
+
"onTapStart",
|
|
2008
|
+
"onTapCancel"
|
|
2009
|
+
],
|
|
2010
|
+
pan: [
|
|
2011
|
+
"onPan",
|
|
2012
|
+
"onPanStart",
|
|
2013
|
+
"onPanSessionStart",
|
|
2014
|
+
"onPanEnd"
|
|
2015
|
+
],
|
|
2016
|
+
inView: [
|
|
2017
|
+
"whileInView",
|
|
2018
|
+
"onViewportEnter",
|
|
2019
|
+
"onViewportLeave"
|
|
2020
|
+
],
|
|
2021
|
+
layout: ["layout", "layoutId"]
|
|
2022
|
+
}, featureDefinitions = {};
|
|
2023
|
+
for (let e in featureProps) featureDefinitions[e] = { isEnabled: (_) => featureProps[e].some((e) => !!_[e]) };
|
|
2024
|
+
function loadFeatures(e) {
|
|
2025
|
+
for (let _ in e) featureDefinitions[_] = {
|
|
2026
|
+
...featureDefinitions[_],
|
|
2027
|
+
...e[_]
|
|
2028
|
+
};
|
|
2029
|
+
}
|
|
2030
|
+
var validMotionProps = new Set(/* @__PURE__ */ "animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport".split("."));
|
|
2031
|
+
function isValidMotionProp(e) {
|
|
2032
|
+
return e.startsWith("while") || e.startsWith("drag") && e !== "draggable" || e.startsWith("layout") || e.startsWith("onTap") || e.startsWith("onPan") || e.startsWith("onLayout") || validMotionProps.has(e);
|
|
2033
|
+
}
|
|
2034
|
+
var is_prop_valid_framer_motion_exports = /* @__PURE__ */ __export({ default: () => is_prop_valid_framer_motion_default }), is_prop_valid_framer_motion_default, init_is_prop_valid_framer_motion = __esmMin((() => {
|
|
2035
|
+
throw is_prop_valid_framer_motion_default = {}, Error("Could not resolve \"@emotion/is-prop-valid\" imported by \"framer-motion\". Is it installed?");
|
|
2036
|
+
})), shouldForward = (e) => !isValidMotionProp(e);
|
|
2037
|
+
function loadExternalIsValidProp(e) {
|
|
2038
|
+
typeof e == "function" && (shouldForward = (_) => _.startsWith("on") ? !isValidMotionProp(_) : e(_));
|
|
2039
|
+
}
|
|
2040
|
+
try {
|
|
2041
|
+
loadExternalIsValidProp((init_is_prop_valid_framer_motion(), __toCommonJS(is_prop_valid_framer_motion_exports)).default);
|
|
2042
|
+
} catch {}
|
|
2043
|
+
function filterProps(e, _, v) {
|
|
2044
|
+
let y = {};
|
|
2045
|
+
for (let b in e) b === "values" && typeof e.values == "object" || (shouldForward(b) || v === !0 && isValidMotionProp(b) || !_ && !isValidMotionProp(b) || e.draggable && b.startsWith("onDrag")) && (y[b] = e[b]);
|
|
2046
|
+
return y;
|
|
2047
|
+
}
|
|
2048
|
+
var MotionContext = /* @__PURE__ */ createContext({});
|
|
2049
|
+
function isAnimationControls(e) {
|
|
2050
|
+
return typeof e == "object" && !!e && typeof e.start == "function";
|
|
2051
|
+
}
|
|
2052
|
+
function isVariantLabel(e) {
|
|
2053
|
+
return typeof e == "string" || Array.isArray(e);
|
|
2054
|
+
}
|
|
2055
|
+
var variantPriorityOrder = [
|
|
2056
|
+
"animate",
|
|
2057
|
+
"whileInView",
|
|
2058
|
+
"whileFocus",
|
|
2059
|
+
"whileHover",
|
|
2060
|
+
"whileTap",
|
|
2061
|
+
"whileDrag",
|
|
2062
|
+
"exit"
|
|
2063
|
+
], variantProps = ["initial", ...variantPriorityOrder];
|
|
2064
|
+
function isControllingVariants(e) {
|
|
2065
|
+
return isAnimationControls(e.animate) || variantProps.some((_) => isVariantLabel(e[_]));
|
|
2066
|
+
}
|
|
2067
|
+
function isVariantNode(e) {
|
|
2068
|
+
return !!(isControllingVariants(e) || e.variants);
|
|
2069
|
+
}
|
|
2070
|
+
function getCurrentTreeVariants(e, _) {
|
|
2071
|
+
if (isControllingVariants(e)) {
|
|
2072
|
+
let { initial: _, animate: v } = e;
|
|
2073
|
+
return {
|
|
2074
|
+
initial: _ === !1 || isVariantLabel(_) ? _ : void 0,
|
|
2075
|
+
animate: isVariantLabel(v) ? v : void 0
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2078
|
+
return e.inherit === !1 ? {} : _;
|
|
2079
|
+
}
|
|
2080
|
+
function useCreateMotionContext(e) {
|
|
2081
|
+
let { initial: _, animate: v } = getCurrentTreeVariants(e, useContext(MotionContext));
|
|
2082
|
+
return useMemo(() => ({
|
|
2083
|
+
initial: _,
|
|
2084
|
+
animate: v
|
|
2085
|
+
}), [variantLabelsAsDependency(_), variantLabelsAsDependency(v)]);
|
|
2086
|
+
}
|
|
2087
|
+
function variantLabelsAsDependency(e) {
|
|
2088
|
+
return Array.isArray(e) ? e.join(" ") : e;
|
|
2089
|
+
}
|
|
2090
|
+
function pixelsToPercent(e, _) {
|
|
2091
|
+
return _.max === _.min ? 0 : e / (_.max - _.min) * 100;
|
|
2092
|
+
}
|
|
2093
|
+
var correctBorderRadius = { correct: (e, _) => {
|
|
2094
|
+
if (!_.target) return e;
|
|
2095
|
+
if (typeof e == "string") if (px.test(e)) e = parseFloat(e);
|
|
2096
|
+
else return e;
|
|
2097
|
+
return `${pixelsToPercent(e, _.target.x)}% ${pixelsToPercent(e, _.target.y)}%`;
|
|
2098
|
+
} }, correctBoxShadow = { correct: (e, { treeScale: _, projectionDelta: v }) => {
|
|
2099
|
+
let y = e, b = complex.parse(e);
|
|
2100
|
+
if (b.length > 5) return y;
|
|
2101
|
+
let x = complex.createTransformer(e), S = typeof b[0] == "number" ? 0 : 1, C = v.x.scale * _.x, w = v.y.scale * _.y;
|
|
2102
|
+
b[0 + S] /= C, b[1 + S] /= w;
|
|
2103
|
+
let T = mixNumber(C, w, .5);
|
|
2104
|
+
return typeof b[2 + S] == "number" && (b[2 + S] /= T), typeof b[3 + S] == "number" && (b[3 + S] /= T), x(b);
|
|
2105
|
+
} }, scaleCorrectors = {
|
|
2106
|
+
borderRadius: {
|
|
2107
|
+
...correctBorderRadius,
|
|
2108
|
+
applyTo: [
|
|
2109
|
+
"borderTopLeftRadius",
|
|
2110
|
+
"borderTopRightRadius",
|
|
2111
|
+
"borderBottomLeftRadius",
|
|
2112
|
+
"borderBottomRightRadius"
|
|
2113
|
+
]
|
|
2114
|
+
},
|
|
2115
|
+
borderTopLeftRadius: correctBorderRadius,
|
|
2116
|
+
borderTopRightRadius: correctBorderRadius,
|
|
2117
|
+
borderBottomLeftRadius: correctBorderRadius,
|
|
2118
|
+
borderBottomRightRadius: correctBorderRadius,
|
|
2119
|
+
boxShadow: correctBoxShadow
|
|
2120
|
+
};
|
|
2121
|
+
function isForcedMotionValue(e, { layout: _, layoutId: v }) {
|
|
2122
|
+
return transformProps.has(e) || e.startsWith("origin") || (_ || v !== void 0) && (!!scaleCorrectors[e] || e === "opacity");
|
|
2123
|
+
}
|
|
2124
|
+
var translateAlias = {
|
|
2125
|
+
x: "translateX",
|
|
2126
|
+
y: "translateY",
|
|
2127
|
+
z: "translateZ",
|
|
2128
|
+
transformPerspective: "perspective"
|
|
2129
|
+
}, numTransforms = transformPropOrder.length;
|
|
2130
|
+
function buildTransform(e, _, v) {
|
|
2131
|
+
let y = "", b = !0;
|
|
2132
|
+
for (let x = 0; x < numTransforms; x++) {
|
|
2133
|
+
let S = transformPropOrder[x], C = e[S];
|
|
2134
|
+
if (C === void 0) continue;
|
|
2135
|
+
let w = !0;
|
|
2136
|
+
if (w = typeof C == "number" ? C === (S.startsWith("scale") ? 1 : 0) : parseFloat(C) === 0, !w || v) {
|
|
2137
|
+
let e = getValueAsType(C, numberValueTypes[S]);
|
|
2138
|
+
if (!w) {
|
|
2139
|
+
b = !1;
|
|
2140
|
+
let _ = translateAlias[S] || S;
|
|
2141
|
+
y += `${_}(${e}) `;
|
|
2142
|
+
}
|
|
2143
|
+
v && (_[S] = e);
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
return y = y.trim(), v ? y = v(_, b ? "" : y) : b && (y = "none"), y;
|
|
2147
|
+
}
|
|
2148
|
+
function buildHTMLStyles(e, _, v) {
|
|
2149
|
+
let { style: y, vars: b, transformOrigin: x } = e, S = !1, C = !1;
|
|
2150
|
+
for (let e in _) {
|
|
2151
|
+
let v = _[e];
|
|
2152
|
+
if (transformProps.has(e)) {
|
|
2153
|
+
S = !0;
|
|
2154
|
+
continue;
|
|
2155
|
+
} else if (isCSSVariableName(e)) {
|
|
2156
|
+
b[e] = v;
|
|
2157
|
+
continue;
|
|
2158
|
+
} else {
|
|
2159
|
+
let _ = getValueAsType(v, numberValueTypes[e]);
|
|
2160
|
+
e.startsWith("origin") ? (C = !0, x[e] = _) : y[e] = _;
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
if (_.transform || (S || v ? y.transform = buildTransform(_, e.transform, v) : y.transform &&= "none"), C) {
|
|
2164
|
+
let { originX: e = "50%", originY: _ = "50%", originZ: v = 0 } = x;
|
|
2165
|
+
y.transformOrigin = `${e} ${_} ${v}`;
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
var createHtmlRenderState = () => ({
|
|
2169
|
+
style: {},
|
|
2170
|
+
transform: {},
|
|
2171
|
+
transformOrigin: {},
|
|
2172
|
+
vars: {}
|
|
2173
|
+
});
|
|
2174
|
+
function copyRawValuesOnly(e, _, v) {
|
|
2175
|
+
for (let y in _) !isMotionValue(_[y]) && !isForcedMotionValue(y, v) && (e[y] = _[y]);
|
|
2176
|
+
}
|
|
2177
|
+
function useInitialMotionValues({ transformTemplate: e }, _) {
|
|
2178
|
+
return useMemo(() => {
|
|
2179
|
+
let v = createHtmlRenderState();
|
|
2180
|
+
return buildHTMLStyles(v, _, e), Object.assign({}, v.vars, v.style);
|
|
2181
|
+
}, [_]);
|
|
2182
|
+
}
|
|
2183
|
+
function useStyle(e, _) {
|
|
2184
|
+
let v = e.style || {}, y = {};
|
|
2185
|
+
return copyRawValuesOnly(y, v, e), Object.assign(y, useInitialMotionValues(e, _)), y;
|
|
2186
|
+
}
|
|
2187
|
+
function useHTMLProps(e, _) {
|
|
2188
|
+
let v = {}, y = useStyle(e, _);
|
|
2189
|
+
return e.drag && e.dragListener !== !1 && (v.draggable = !1, y.userSelect = y.WebkitUserSelect = y.WebkitTouchCallout = "none", y.touchAction = e.drag === !0 ? "none" : `pan-${e.drag === "x" ? "y" : "x"}`), e.tabIndex === void 0 && (e.onTap || e.onTapStart || e.whileTap) && (v.tabIndex = 0), v.style = y, v;
|
|
2190
|
+
}
|
|
2191
|
+
var dashKeys = {
|
|
2192
|
+
offset: "stroke-dashoffset",
|
|
2193
|
+
array: "stroke-dasharray"
|
|
2194
|
+
}, camelKeys = {
|
|
2195
|
+
offset: "strokeDashoffset",
|
|
2196
|
+
array: "strokeDasharray"
|
|
2197
|
+
};
|
|
2198
|
+
function buildSVGPath(e, _, v = 1, y = 0, b = !0) {
|
|
2199
|
+
e.pathLength = 1;
|
|
2200
|
+
let x = b ? dashKeys : camelKeys;
|
|
2201
|
+
e[x.offset] = px.transform(-y);
|
|
2202
|
+
let S = px.transform(_), C = px.transform(v);
|
|
2203
|
+
e[x.array] = `${S} ${C}`;
|
|
2204
|
+
}
|
|
2205
|
+
function buildSVGAttrs(e, { attrX: _, attrY: v, attrScale: y, pathLength: b, pathSpacing: x = 1, pathOffset: S = 0, ...C }, w, T, E) {
|
|
2206
|
+
if (buildHTMLStyles(e, C, T), w) {
|
|
2207
|
+
e.style.viewBox && (e.attrs.viewBox = e.style.viewBox);
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
e.attrs = e.style, e.style = {};
|
|
2211
|
+
let { attrs: D, style: O } = e;
|
|
2212
|
+
D.transform && (O.transform = D.transform, delete D.transform), (O.transform || D.transformOrigin) && (O.transformOrigin = D.transformOrigin ?? "50% 50%", delete D.transformOrigin), O.transform && (O.transformBox = E?.transformBox ?? "fill-box", delete D.transformBox), _ !== void 0 && (D.x = _), v !== void 0 && (D.y = v), y !== void 0 && (D.scale = y), b !== void 0 && buildSVGPath(D, b, x, S, !1);
|
|
2213
|
+
}
|
|
2214
|
+
var createSvgRenderState = () => ({
|
|
2215
|
+
...createHtmlRenderState(),
|
|
2216
|
+
attrs: {}
|
|
2217
|
+
}), isSVGTag = (e) => typeof e == "string" && e.toLowerCase() === "svg";
|
|
2218
|
+
function useSVGProps(e, _, v, y) {
|
|
2219
|
+
let b = useMemo(() => {
|
|
2220
|
+
let v = createSvgRenderState();
|
|
2221
|
+
return buildSVGAttrs(v, _, isSVGTag(y), e.transformTemplate, e.style), {
|
|
2222
|
+
...v.attrs,
|
|
2223
|
+
style: { ...v.style }
|
|
2224
|
+
};
|
|
2225
|
+
}, [_]);
|
|
2226
|
+
if (e.style) {
|
|
2227
|
+
let _ = {};
|
|
2228
|
+
copyRawValuesOnly(_, e.style, e), b.style = {
|
|
2229
|
+
..._,
|
|
2230
|
+
...b.style
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
return b;
|
|
2234
|
+
}
|
|
2235
|
+
var lowercaseSVGElements = [
|
|
2236
|
+
"animate",
|
|
2237
|
+
"circle",
|
|
2238
|
+
"defs",
|
|
2239
|
+
"desc",
|
|
2240
|
+
"ellipse",
|
|
2241
|
+
"g",
|
|
2242
|
+
"image",
|
|
2243
|
+
"line",
|
|
2244
|
+
"filter",
|
|
2245
|
+
"marker",
|
|
2246
|
+
"mask",
|
|
2247
|
+
"metadata",
|
|
2248
|
+
"path",
|
|
2249
|
+
"pattern",
|
|
2250
|
+
"polygon",
|
|
2251
|
+
"polyline",
|
|
2252
|
+
"rect",
|
|
2253
|
+
"stop",
|
|
2254
|
+
"switch",
|
|
2255
|
+
"symbol",
|
|
2256
|
+
"svg",
|
|
2257
|
+
"text",
|
|
2258
|
+
"tspan",
|
|
2259
|
+
"use",
|
|
2260
|
+
"view"
|
|
2261
|
+
];
|
|
2262
|
+
function isSVGComponent(e) {
|
|
2263
|
+
return typeof e != "string" || e.includes("-") ? !1 : !!(lowercaseSVGElements.indexOf(e) > -1 || /[A-Z]/u.test(e));
|
|
2264
|
+
}
|
|
2265
|
+
function useRender(e, _, v, { latestValues: b }, S, C = !1) {
|
|
2266
|
+
let w = (isSVGComponent(e) ? useSVGProps : useHTMLProps)(_, b, S, e), T = filterProps(_, typeof e == "string", C), E = e === Fragment ? {} : {
|
|
2267
|
+
...T,
|
|
2268
|
+
...w,
|
|
2269
|
+
ref: v
|
|
2270
|
+
}, { children: D } = _, O = useMemo(() => isMotionValue(D) ? D.get() : D, [D]);
|
|
2271
|
+
return createElement(e, {
|
|
2272
|
+
...E,
|
|
2273
|
+
children: O
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
function getValueState(e) {
|
|
2277
|
+
let _ = [{}, {}];
|
|
2278
|
+
return e?.values.forEach((e, v) => {
|
|
2279
|
+
_[0][v] = e.get(), _[1][v] = e.getVelocity();
|
|
2280
|
+
}), _;
|
|
2281
|
+
}
|
|
2282
|
+
function resolveVariantFromProps(e, _, v, y) {
|
|
2283
|
+
if (typeof _ == "function") {
|
|
2284
|
+
let [b, x] = getValueState(y);
|
|
2285
|
+
_ = _(v === void 0 ? e.custom : v, b, x);
|
|
2286
|
+
}
|
|
2287
|
+
if (typeof _ == "string" && (_ = e.variants && e.variants[_]), typeof _ == "function") {
|
|
2288
|
+
let [b, x] = getValueState(y);
|
|
2289
|
+
_ = _(v === void 0 ? e.custom : v, b, x);
|
|
2290
|
+
}
|
|
2291
|
+
return _;
|
|
2292
|
+
}
|
|
2293
|
+
function resolveMotionValue(e) {
|
|
2294
|
+
return isMotionValue(e) ? e.get() : e;
|
|
2295
|
+
}
|
|
2296
|
+
function makeState({ scrapeMotionValuesFromProps: e, createRenderState: _ }, v, y, b) {
|
|
2297
|
+
return {
|
|
2298
|
+
latestValues: makeLatestValues(v, y, b, e),
|
|
2299
|
+
renderState: _()
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
function makeLatestValues(e, _, v, y) {
|
|
2303
|
+
let b = {}, x = y(e, {});
|
|
2304
|
+
for (let e in x) b[e] = resolveMotionValue(x[e]);
|
|
2305
|
+
let { initial: S, animate: C } = e, w = isControllingVariants(e), T = isVariantNode(e);
|
|
2306
|
+
_ && T && !w && e.inherit !== !1 && (S === void 0 && (S = _.initial), C === void 0 && (C = _.animate));
|
|
2307
|
+
let E = v ? v.initial === !1 : !1;
|
|
2308
|
+
E ||= S === !1;
|
|
2309
|
+
let D = E ? C : S;
|
|
2310
|
+
if (D && typeof D != "boolean" && !isAnimationControls(D)) {
|
|
2311
|
+
let _ = Array.isArray(D) ? D : [D];
|
|
2312
|
+
for (let v = 0; v < _.length; v++) {
|
|
2313
|
+
let y = resolveVariantFromProps(e, _[v]);
|
|
2314
|
+
if (y) {
|
|
2315
|
+
let { transitionEnd: e, transition: _, ...v } = y;
|
|
2316
|
+
for (let e in v) {
|
|
2317
|
+
let _ = v[e];
|
|
2318
|
+
if (Array.isArray(_)) {
|
|
2319
|
+
let e = E ? _.length - 1 : 0;
|
|
2320
|
+
_ = _[e];
|
|
2321
|
+
}
|
|
2322
|
+
_ !== null && (b[e] = _);
|
|
2323
|
+
}
|
|
2324
|
+
for (let _ in e) b[_] = e[_];
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
return b;
|
|
2329
|
+
}
|
|
2330
|
+
var makeUseVisualState = (e) => (_, v) => {
|
|
2331
|
+
let y = useContext(MotionContext), b = useContext(PresenceContext), x = () => makeState(e, _, y, b);
|
|
2332
|
+
return v ? x() : useConstant(x);
|
|
2333
|
+
};
|
|
2334
|
+
function scrapeMotionValuesFromProps$1(e, _, v) {
|
|
2335
|
+
let { style: y } = e, b = {};
|
|
2336
|
+
for (let x in y) (isMotionValue(y[x]) || _.style && isMotionValue(_.style[x]) || isForcedMotionValue(x, e) || v?.getValue(x)?.liveStyle !== void 0) && (b[x] = y[x]);
|
|
2337
|
+
return b;
|
|
2338
|
+
}
|
|
2339
|
+
var useHTMLVisualState = /* @__PURE__ */ makeUseVisualState({
|
|
2340
|
+
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
|
|
2341
|
+
createRenderState: createHtmlRenderState
|
|
2342
|
+
});
|
|
2343
|
+
function scrapeMotionValuesFromProps(e, _, v) {
|
|
2344
|
+
let y = scrapeMotionValuesFromProps$1(e, _, v);
|
|
2345
|
+
for (let v in e) if (isMotionValue(e[v]) || isMotionValue(_[v])) {
|
|
2346
|
+
let _ = transformPropOrder.indexOf(v) === -1 ? v : "attr" + v.charAt(0).toUpperCase() + v.substring(1);
|
|
2347
|
+
y[_] = e[v];
|
|
2348
|
+
}
|
|
2349
|
+
return y;
|
|
2350
|
+
}
|
|
2351
|
+
var useSVGVisualState = /* @__PURE__ */ makeUseVisualState({
|
|
2352
|
+
scrapeMotionValuesFromProps,
|
|
2353
|
+
createRenderState: createSvgRenderState
|
|
2354
|
+
}), motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
2355
|
+
function isRefObject(e) {
|
|
2356
|
+
return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "current");
|
|
2357
|
+
}
|
|
2358
|
+
function useMotionRef(e, _, v) {
|
|
2359
|
+
return useCallback((y) => {
|
|
2360
|
+
y && e.onMount && e.onMount(y), _ && (y ? _.mount(y) : _.unmount()), v && (typeof v == "function" ? v(y) : isRefObject(v) && (v.current = y));
|
|
2361
|
+
}, [_]);
|
|
2362
|
+
}
|
|
2363
|
+
var camelToDash = (e) => e.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), optimizedAppearDataAttribute = "data-" + camelToDash("framerAppearId"), SwitchLayoutGroupContext = createContext({});
|
|
2364
|
+
function useVisualElement(e, _, v, y, b) {
|
|
2365
|
+
let { visualElement: x } = useContext(MotionContext), S = useContext(LazyContext), C = useContext(PresenceContext), w = useContext(MotionConfigContext).reducedMotion, D = useRef(null);
|
|
2366
|
+
y ||= S.renderer, !D.current && y && (D.current = y(e, {
|
|
2367
|
+
visualState: _,
|
|
2368
|
+
parent: x,
|
|
2369
|
+
props: v,
|
|
2370
|
+
presenceContext: C,
|
|
2371
|
+
blockInitialAnimation: C ? C.initial === !1 : !1,
|
|
2372
|
+
reducedMotionConfig: w
|
|
2373
|
+
}));
|
|
2374
|
+
let k = D.current, A = useContext(SwitchLayoutGroupContext);
|
|
2375
|
+
k && !k.projection && b && (k.type === "html" || k.type === "svg") && createProjectionNode$1(D.current, v, b, A);
|
|
2376
|
+
let M = useRef(!1);
|
|
2377
|
+
useInsertionEffect(() => {
|
|
2378
|
+
k && M.current && k.update(v, C);
|
|
2379
|
+
});
|
|
2380
|
+
let N = v[optimizedAppearDataAttribute], P = useRef(!!N && !window.MotionHandoffIsComplete?.(N) && window.MotionHasOptimisedAnimation?.(N));
|
|
2381
|
+
return useIsomorphicLayoutEffect(() => {
|
|
2382
|
+
k && (M.current = !0, window.MotionIsMounted = !0, k.updateFeatures(), k.scheduleRenderMicrotask(), P.current && k.animationState && k.animationState.animateChanges());
|
|
2383
|
+
}), useEffect(() => {
|
|
2384
|
+
k && (!P.current && k.animationState && k.animationState.animateChanges(), P.current &&= (queueMicrotask(() => {
|
|
2385
|
+
window.MotionHandoffMarkAsComplete?.(N);
|
|
2386
|
+
}), !1), k.enteringChildren = void 0);
|
|
2387
|
+
}), k;
|
|
2388
|
+
}
|
|
2389
|
+
function createProjectionNode$1(e, _, v, y) {
|
|
2390
|
+
let { layoutId: b, layout: x, drag: S, dragConstraints: C, layoutScroll: w, layoutRoot: T, layoutCrossfade: E } = _;
|
|
2391
|
+
e.projection = new v(e.latestValues, _["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(e.parent)), e.projection.setOptions({
|
|
2392
|
+
layoutId: b,
|
|
2393
|
+
layout: x,
|
|
2394
|
+
alwaysMeasureLayout: !!S || C && isRefObject(C),
|
|
2395
|
+
visualElement: e,
|
|
2396
|
+
animationType: typeof x == "string" ? x : "both",
|
|
2397
|
+
initialPromotionConfig: y,
|
|
2398
|
+
crossfade: E,
|
|
2399
|
+
layoutScroll: w,
|
|
2400
|
+
layoutRoot: T
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2403
|
+
function getClosestProjectingNode(e) {
|
|
2404
|
+
if (e) return e.options.allowProjection === !1 ? getClosestProjectingNode(e.parent) : e.projection;
|
|
2405
|
+
}
|
|
2406
|
+
function createMotionComponent(e, { forwardMotionProps: _ = !1 } = {}, v, y) {
|
|
2407
|
+
v && loadFeatures(v);
|
|
2408
|
+
let b = isSVGComponent(e) ? useSVGVisualState : useHTMLVisualState;
|
|
2409
|
+
function x(x, S) {
|
|
2410
|
+
let C, w = {
|
|
2411
|
+
...useContext(MotionConfigContext),
|
|
2412
|
+
...x,
|
|
2413
|
+
layoutId: useLayoutId(x)
|
|
2414
|
+
}, { isStatic: E } = w, D = useCreateMotionContext(x), O = b(x, E);
|
|
2415
|
+
if (!E && isBrowser) {
|
|
2416
|
+
useStrictMode(w, v);
|
|
2417
|
+
let _ = getProjectionFunctionality(w);
|
|
2418
|
+
C = _.MeasureLayout, D.visualElement = useVisualElement(e, O, w, y, _.ProjectionNode);
|
|
2419
|
+
}
|
|
2420
|
+
return (0, import_jsx_runtime.jsxs)(MotionContext.Provider, {
|
|
2421
|
+
value: D,
|
|
2422
|
+
children: [C && D.visualElement ? (0, import_jsx_runtime.jsx)(C, {
|
|
2423
|
+
visualElement: D.visualElement,
|
|
2424
|
+
...w
|
|
2425
|
+
}) : null, useRender(e, x, useMotionRef(O, D.visualElement, S), O, E, _)]
|
|
2426
|
+
});
|
|
2427
|
+
}
|
|
2428
|
+
x.displayName = `motion.${typeof e == "string" ? e : `create(${e.displayName ?? e.name ?? ""})`}`;
|
|
2429
|
+
let C = forwardRef(x);
|
|
2430
|
+
return C[motionComponentSymbol] = e, C;
|
|
2431
|
+
}
|
|
2432
|
+
function useLayoutId({ layoutId: e }) {
|
|
2433
|
+
let _ = useContext(LayoutGroupContext).id;
|
|
2434
|
+
return _ && e !== void 0 ? _ + "-" + e : e;
|
|
2435
|
+
}
|
|
2436
|
+
function useStrictMode(e, _) {
|
|
2437
|
+
let v = useContext(LazyContext).strict;
|
|
2438
|
+
if (process.env.NODE_ENV !== "production" && _ && v) {
|
|
2439
|
+
let _ = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
|
|
2440
|
+
e.ignoreStrict ? warning(!1, _, "lazy-strict-mode") : invariant(!1, _, "lazy-strict-mode");
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
function getProjectionFunctionality(e) {
|
|
2444
|
+
let { drag: _, layout: v } = featureDefinitions;
|
|
2445
|
+
if (!_ && !v) return {};
|
|
2446
|
+
let y = {
|
|
2447
|
+
..._,
|
|
2448
|
+
...v
|
|
2449
|
+
};
|
|
2450
|
+
return {
|
|
2451
|
+
MeasureLayout: _?.isEnabled(e) || v?.isEnabled(e) ? y.MeasureLayout : void 0,
|
|
2452
|
+
ProjectionNode: y.ProjectionNode
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
function createMotionProxy(e, _) {
|
|
2456
|
+
if (typeof Proxy > "u") return createMotionComponent;
|
|
2457
|
+
let v = /* @__PURE__ */ new Map(), y = (v, y) => createMotionComponent(v, y, e, _);
|
|
2458
|
+
return new Proxy((e, _) => (process.env.NODE_ENV !== "production" && warnOnce(!1, "motion() is deprecated. Use motion.create() instead."), y(e, _)), { get: (b, x) => x === "create" ? y : (v.has(x) || v.set(x, createMotionComponent(x, void 0, e, _)), v.get(x)) });
|
|
2459
|
+
}
|
|
2460
|
+
function convertBoundingBoxToBox({ top: e, left: _, right: v, bottom: y }) {
|
|
2461
|
+
return {
|
|
2462
|
+
x: {
|
|
2463
|
+
min: _,
|
|
2464
|
+
max: v
|
|
2465
|
+
},
|
|
2466
|
+
y: {
|
|
2467
|
+
min: e,
|
|
2468
|
+
max: y
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
}
|
|
2472
|
+
function convertBoxToBoundingBox({ x: e, y: _ }) {
|
|
2473
|
+
return {
|
|
2474
|
+
top: _.min,
|
|
2475
|
+
right: e.max,
|
|
2476
|
+
bottom: _.max,
|
|
2477
|
+
left: e.min
|
|
2478
|
+
};
|
|
2479
|
+
}
|
|
2480
|
+
function transformBoxPoints(e, _) {
|
|
2481
|
+
if (!_) return e;
|
|
2482
|
+
let v = _({
|
|
2483
|
+
x: e.left,
|
|
2484
|
+
y: e.top
|
|
2485
|
+
}), y = _({
|
|
2486
|
+
x: e.right,
|
|
2487
|
+
y: e.bottom
|
|
2488
|
+
});
|
|
2489
|
+
return {
|
|
2490
|
+
top: v.y,
|
|
2491
|
+
left: v.x,
|
|
2492
|
+
bottom: y.y,
|
|
2493
|
+
right: y.x
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
function isIdentityScale(e) {
|
|
2497
|
+
return e === void 0 || e === 1;
|
|
2498
|
+
}
|
|
2499
|
+
function hasScale({ scale: e, scaleX: _, scaleY: v }) {
|
|
2500
|
+
return !isIdentityScale(e) || !isIdentityScale(_) || !isIdentityScale(v);
|
|
2501
|
+
}
|
|
2502
|
+
function hasTransform(e) {
|
|
2503
|
+
return hasScale(e) || has2DTranslate(e) || e.z || e.rotate || e.rotateX || e.rotateY || e.skewX || e.skewY;
|
|
2504
|
+
}
|
|
2505
|
+
function has2DTranslate(e) {
|
|
2506
|
+
return is2DTranslate(e.x) || is2DTranslate(e.y);
|
|
2507
|
+
}
|
|
2508
|
+
function is2DTranslate(e) {
|
|
2509
|
+
return e && e !== "0%";
|
|
2510
|
+
}
|
|
2511
|
+
function scalePoint(e, _, v) {
|
|
2512
|
+
return v + _ * (e - v);
|
|
2513
|
+
}
|
|
2514
|
+
function applyPointDelta(e, _, v, y, b) {
|
|
2515
|
+
return b !== void 0 && (e = scalePoint(e, b, y)), scalePoint(e, v, y) + _;
|
|
2516
|
+
}
|
|
2517
|
+
function applyAxisDelta(e, _ = 0, v = 1, y, b) {
|
|
2518
|
+
e.min = applyPointDelta(e.min, _, v, y, b), e.max = applyPointDelta(e.max, _, v, y, b);
|
|
2519
|
+
}
|
|
2520
|
+
function applyBoxDelta(e, { x: _, y: v }) {
|
|
2521
|
+
applyAxisDelta(e.x, _.translate, _.scale, _.originPoint), applyAxisDelta(e.y, v.translate, v.scale, v.originPoint);
|
|
2522
|
+
}
|
|
2523
|
+
var TREE_SCALE_SNAP_MIN = .999999999999, TREE_SCALE_SNAP_MAX = 1.0000000000001;
|
|
2524
|
+
function applyTreeDeltas(e, _, v, y = !1) {
|
|
2525
|
+
let b = v.length;
|
|
2526
|
+
if (!b) return;
|
|
2527
|
+
_.x = _.y = 1;
|
|
2528
|
+
let x, S;
|
|
2529
|
+
for (let C = 0; C < b; C++) {
|
|
2530
|
+
x = v[C], S = x.projectionDelta;
|
|
2531
|
+
let { visualElement: b } = x.options;
|
|
2532
|
+
b && b.props.style && b.props.style.display === "contents" || (y && x.options.layoutScroll && x.scroll && x !== x.root && transformBox(e, {
|
|
2533
|
+
x: -x.scroll.offset.x,
|
|
2534
|
+
y: -x.scroll.offset.y
|
|
2535
|
+
}), S && (_.x *= S.x.scale, _.y *= S.y.scale, applyBoxDelta(e, S)), y && hasTransform(x.latestValues) && transformBox(e, x.latestValues));
|
|
2536
|
+
}
|
|
2537
|
+
_.x < TREE_SCALE_SNAP_MAX && _.x > TREE_SCALE_SNAP_MIN && (_.x = 1), _.y < TREE_SCALE_SNAP_MAX && _.y > TREE_SCALE_SNAP_MIN && (_.y = 1);
|
|
2538
|
+
}
|
|
2539
|
+
function translateAxis(e, _) {
|
|
2540
|
+
e.min += _, e.max += _;
|
|
2541
|
+
}
|
|
2542
|
+
function transformAxis(e, _, v, y, b = .5) {
|
|
2543
|
+
applyAxisDelta(e, _, v, mixNumber(e.min, e.max, b), y);
|
|
2544
|
+
}
|
|
2545
|
+
function transformBox(e, _) {
|
|
2546
|
+
transformAxis(e.x, _.x, _.scaleX, _.scale, _.originX), transformAxis(e.y, _.y, _.scaleY, _.scale, _.originY);
|
|
2547
|
+
}
|
|
2548
|
+
function measureViewportBox(e, _) {
|
|
2549
|
+
return convertBoundingBoxToBox(transformBoxPoints(e.getBoundingClientRect(), _));
|
|
2550
|
+
}
|
|
2551
|
+
function measurePageBox(e, _, v) {
|
|
2552
|
+
let y = measureViewportBox(e, v), { scroll: b } = _;
|
|
2553
|
+
return b && (translateAxis(y.x, b.offset.x), translateAxis(y.y, b.offset.y)), y;
|
|
2554
|
+
}
|
|
2555
|
+
var createAxisDelta = () => ({
|
|
2556
|
+
translate: 0,
|
|
2557
|
+
scale: 1,
|
|
2558
|
+
origin: 0,
|
|
2559
|
+
originPoint: 0
|
|
2560
|
+
}), createDelta = () => ({
|
|
2561
|
+
x: createAxisDelta(),
|
|
2562
|
+
y: createAxisDelta()
|
|
2563
|
+
}), createAxis = () => ({
|
|
2564
|
+
min: 0,
|
|
2565
|
+
max: 0
|
|
2566
|
+
}), createBox = () => ({
|
|
2567
|
+
x: createAxis(),
|
|
2568
|
+
y: createAxis()
|
|
2569
|
+
}), prefersReducedMotion = { current: null }, hasReducedMotionListener = { current: !1 };
|
|
2570
|
+
function initPrefersReducedMotion() {
|
|
2571
|
+
if (hasReducedMotionListener.current = !0, isBrowser) if (window.matchMedia) {
|
|
2572
|
+
let e = window.matchMedia("(prefers-reduced-motion)"), _ = () => prefersReducedMotion.current = e.matches;
|
|
2573
|
+
e.addEventListener("change", _), _();
|
|
2574
|
+
} else prefersReducedMotion.current = !1;
|
|
2575
|
+
}
|
|
2576
|
+
var visualElementStore = /* @__PURE__ */ new WeakMap();
|
|
2577
|
+
function updateMotionValuesFromProps(e, _, v) {
|
|
2578
|
+
for (let y in _) {
|
|
2579
|
+
let b = _[y], x = v[y];
|
|
2580
|
+
if (isMotionValue(b)) e.addValue(y, b);
|
|
2581
|
+
else if (isMotionValue(x)) e.addValue(y, motionValue(b, { owner: e }));
|
|
2582
|
+
else if (x !== b) if (e.hasValue(y)) {
|
|
2583
|
+
let _ = e.getValue(y);
|
|
2584
|
+
_.liveStyle === !0 ? _.jump(b) : _.hasAnimated || _.set(b);
|
|
2585
|
+
} else {
|
|
2586
|
+
let _ = e.getStaticValue(y);
|
|
2587
|
+
e.addValue(y, motionValue(_ === void 0 ? b : _, { owner: e }));
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
for (let y in v) _[y] === void 0 && e.removeValue(y);
|
|
2591
|
+
return _;
|
|
2592
|
+
}
|
|
2593
|
+
var propEventHandlers = [
|
|
2594
|
+
"AnimationStart",
|
|
2595
|
+
"AnimationComplete",
|
|
2596
|
+
"Update",
|
|
2597
|
+
"BeforeLayoutMeasure",
|
|
2598
|
+
"LayoutMeasure",
|
|
2599
|
+
"LayoutAnimationStart",
|
|
2600
|
+
"LayoutAnimationComplete"
|
|
2601
|
+
], VisualElement = class {
|
|
2602
|
+
scrapeMotionValuesFromProps(e, _, v) {
|
|
2603
|
+
return {};
|
|
2604
|
+
}
|
|
2605
|
+
constructor({ parent: e, props: _, presenceContext: v, reducedMotionConfig: y, blockInitialAnimation: b, visualState: x }, S = {}) {
|
|
2606
|
+
this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = KeyframeResolver, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
|
|
2607
|
+
this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
|
|
2608
|
+
}, this.renderScheduledAt = 0, this.scheduleRender = () => {
|
|
2609
|
+
let e = time.now();
|
|
2610
|
+
this.renderScheduledAt < e && (this.renderScheduledAt = e, frame.render(this.render, !1, !0));
|
|
2611
|
+
};
|
|
2612
|
+
let { latestValues: C, renderState: w } = x;
|
|
2613
|
+
this.latestValues = C, this.baseTarget = { ...C }, this.initialValues = _.initial ? { ...C } : {}, this.renderState = w, this.parent = e, this.props = _, this.presenceContext = v, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = y, this.options = S, this.blockInitialAnimation = !!b, this.isControllingVariants = isControllingVariants(_), this.isVariantNode = isVariantNode(_), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
|
|
2614
|
+
let { willChange: T, ...E } = this.scrapeMotionValuesFromProps(_, {}, this);
|
|
2615
|
+
for (let e in E) {
|
|
2616
|
+
let _ = E[e];
|
|
2617
|
+
C[e] !== void 0 && isMotionValue(_) && _.set(C[e]);
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
mount(e) {
|
|
2621
|
+
this.current = e, visualElementStore.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((e, _) => this.bindToMotionValue(_, e)), hasReducedMotionListener.current || initPrefersReducedMotion(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : prefersReducedMotion.current, process.env.NODE_ENV !== "production" && warnOnce(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), this.parent?.addChild(this), this.update(this.props, this.presenceContext);
|
|
2622
|
+
}
|
|
2623
|
+
unmount() {
|
|
2624
|
+
for (let e in this.projection && this.projection.unmount(), cancelFrame(this.notifyUpdate), cancelFrame(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this), this.events) this.events[e].clear();
|
|
2625
|
+
for (let e in this.features) {
|
|
2626
|
+
let _ = this.features[e];
|
|
2627
|
+
_ && (_.unmount(), _.isMounted = !1);
|
|
2628
|
+
}
|
|
2629
|
+
this.current = null;
|
|
2630
|
+
}
|
|
2631
|
+
addChild(e) {
|
|
2632
|
+
this.children.add(e), this.enteringChildren ??= /* @__PURE__ */ new Set(), this.enteringChildren.add(e);
|
|
2633
|
+
}
|
|
2634
|
+
removeChild(e) {
|
|
2635
|
+
this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
|
|
2636
|
+
}
|
|
2637
|
+
bindToMotionValue(e, _) {
|
|
2638
|
+
this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
|
|
2639
|
+
let v = transformProps.has(e);
|
|
2640
|
+
v && this.onBindTransform && this.onBindTransform();
|
|
2641
|
+
let y = _.on("change", (_) => {
|
|
2642
|
+
this.latestValues[e] = _, this.props.onUpdate && frame.preRender(this.notifyUpdate), v && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
|
|
2643
|
+
}), b;
|
|
2644
|
+
window.MotionCheckAppearSync && (b = window.MotionCheckAppearSync(this, e, _)), this.valueSubscriptions.set(e, () => {
|
|
2645
|
+
y(), b && b(), _.owner && _.stop();
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
sortNodePosition(e) {
|
|
2649
|
+
return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
|
|
2650
|
+
}
|
|
2651
|
+
updateFeatures() {
|
|
2652
|
+
let e = "animation";
|
|
2653
|
+
for (e in featureDefinitions) {
|
|
2654
|
+
let _ = featureDefinitions[e];
|
|
2655
|
+
if (!_) continue;
|
|
2656
|
+
let { isEnabled: v, Feature: y } = _;
|
|
2657
|
+
if (!this.features[e] && y && v(this.props) && (this.features[e] = new y(this)), this.features[e]) {
|
|
2658
|
+
let _ = this.features[e];
|
|
2659
|
+
_.isMounted ? _.update() : (_.mount(), _.isMounted = !0);
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
triggerBuild() {
|
|
2664
|
+
this.build(this.renderState, this.latestValues, this.props);
|
|
2665
|
+
}
|
|
2666
|
+
measureViewportBox() {
|
|
2667
|
+
return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox();
|
|
2668
|
+
}
|
|
2669
|
+
getStaticValue(e) {
|
|
2670
|
+
return this.latestValues[e];
|
|
2671
|
+
}
|
|
2672
|
+
setStaticValue(e, _) {
|
|
2673
|
+
this.latestValues[e] = _;
|
|
2674
|
+
}
|
|
2675
|
+
update(e, _) {
|
|
2676
|
+
(e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = _;
|
|
2677
|
+
for (let _ = 0; _ < propEventHandlers.length; _++) {
|
|
2678
|
+
let v = propEventHandlers[_];
|
|
2679
|
+
this.propEventSubscriptions[v] && (this.propEventSubscriptions[v](), delete this.propEventSubscriptions[v]);
|
|
2680
|
+
let y = e["on" + v];
|
|
2681
|
+
y && (this.propEventSubscriptions[v] = this.on(v, y));
|
|
2682
|
+
}
|
|
2683
|
+
this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
|
|
2684
|
+
}
|
|
2685
|
+
getProps() {
|
|
2686
|
+
return this.props;
|
|
2687
|
+
}
|
|
2688
|
+
getVariant(e) {
|
|
2689
|
+
return this.props.variants ? this.props.variants[e] : void 0;
|
|
2690
|
+
}
|
|
2691
|
+
getDefaultTransition() {
|
|
2692
|
+
return this.props.transition;
|
|
2693
|
+
}
|
|
2694
|
+
getTransformPagePoint() {
|
|
2695
|
+
return this.props.transformPagePoint;
|
|
2696
|
+
}
|
|
2697
|
+
getClosestVariantNode() {
|
|
2698
|
+
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
2699
|
+
}
|
|
2700
|
+
addVariantChild(e) {
|
|
2701
|
+
let _ = this.getClosestVariantNode();
|
|
2702
|
+
if (_) return _.variantChildren && _.variantChildren.add(e), () => _.variantChildren.delete(e);
|
|
2703
|
+
}
|
|
2704
|
+
addValue(e, _) {
|
|
2705
|
+
let v = this.values.get(e);
|
|
2706
|
+
_ !== v && (v && this.removeValue(e), this.bindToMotionValue(e, _), this.values.set(e, _), this.latestValues[e] = _.get());
|
|
2707
|
+
}
|
|
2708
|
+
removeValue(e) {
|
|
2709
|
+
this.values.delete(e);
|
|
2710
|
+
let _ = this.valueSubscriptions.get(e);
|
|
2711
|
+
_ && (_(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
|
|
2712
|
+
}
|
|
2713
|
+
hasValue(e) {
|
|
2714
|
+
return this.values.has(e);
|
|
2715
|
+
}
|
|
2716
|
+
getValue(e, _) {
|
|
2717
|
+
if (this.props.values && this.props.values[e]) return this.props.values[e];
|
|
2718
|
+
let v = this.values.get(e);
|
|
2719
|
+
return v === void 0 && _ !== void 0 && (v = motionValue(_ === null ? void 0 : _, { owner: this }), this.addValue(e, v)), v;
|
|
2720
|
+
}
|
|
2721
|
+
readValue(e, _) {
|
|
2722
|
+
let v = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
|
|
2723
|
+
return v != null && (typeof v == "string" && (isNumericalString(v) || isZeroValueString(v)) ? v = parseFloat(v) : !findValueType(v) && complex.test(_) && (v = getAnimatableNone(e, _)), this.setBaseTarget(e, isMotionValue(v) ? v.get() : v)), isMotionValue(v) ? v.get() : v;
|
|
2724
|
+
}
|
|
2725
|
+
setBaseTarget(e, _) {
|
|
2726
|
+
this.baseTarget[e] = _;
|
|
2727
|
+
}
|
|
2728
|
+
getBaseTarget(e) {
|
|
2729
|
+
let { initial: _ } = this.props, v;
|
|
2730
|
+
if (typeof _ == "string" || typeof _ == "object") {
|
|
2731
|
+
let y = resolveVariantFromProps(this.props, _, this.presenceContext?.custom);
|
|
2732
|
+
y && (v = y[e]);
|
|
2733
|
+
}
|
|
2734
|
+
if (_ && v !== void 0) return v;
|
|
2735
|
+
let y = this.getBaseTargetFromProps(this.props, e);
|
|
2736
|
+
return y !== void 0 && !isMotionValue(y) ? y : this.initialValues[e] !== void 0 && v === void 0 ? void 0 : this.baseTarget[e];
|
|
2737
|
+
}
|
|
2738
|
+
on(e, _) {
|
|
2739
|
+
return this.events[e] || (this.events[e] = new SubscriptionManager()), this.events[e].add(_);
|
|
2740
|
+
}
|
|
2741
|
+
notify(e, ..._) {
|
|
2742
|
+
this.events[e] && this.events[e].notify(..._);
|
|
2743
|
+
}
|
|
2744
|
+
scheduleRenderMicrotask() {
|
|
2745
|
+
microtask.render(this.render);
|
|
2746
|
+
}
|
|
2747
|
+
}, DOMVisualElement = class extends VisualElement {
|
|
2748
|
+
constructor() {
|
|
2749
|
+
super(...arguments), this.KeyframeResolver = DOMKeyframesResolver;
|
|
2750
|
+
}
|
|
2751
|
+
sortInstanceNodePosition(e, _) {
|
|
2752
|
+
return e.compareDocumentPosition(_) & 2 ? 1 : -1;
|
|
2753
|
+
}
|
|
2754
|
+
getBaseTargetFromProps(e, _) {
|
|
2755
|
+
return e.style ? e.style[_] : void 0;
|
|
2756
|
+
}
|
|
2757
|
+
removeValueFromRenderState(e, { vars: _, style: v }) {
|
|
2758
|
+
delete _[e], delete v[e];
|
|
2759
|
+
}
|
|
2760
|
+
handleChildMotionValue() {
|
|
2761
|
+
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
|
2762
|
+
let { children: e } = this.props;
|
|
2763
|
+
isMotionValue(e) && (this.childSubscription = e.on("change", (e) => {
|
|
2764
|
+
this.current && (this.current.textContent = `${e}`);
|
|
2765
|
+
}));
|
|
2766
|
+
}
|
|
2767
|
+
};
|
|
2768
|
+
function renderHTML(e, { style: _, vars: v }, y, b) {
|
|
2769
|
+
let x = e.style, S;
|
|
2770
|
+
for (S in _) x[S] = _[S];
|
|
2771
|
+
for (S in b?.applyProjectionStyles(x, y), v) x.setProperty(S, v[S]);
|
|
2772
|
+
}
|
|
2773
|
+
function getComputedStyle$1(e) {
|
|
2774
|
+
return window.getComputedStyle(e);
|
|
2775
|
+
}
|
|
2776
|
+
var HTMLVisualElement = class extends DOMVisualElement {
|
|
2777
|
+
constructor() {
|
|
2778
|
+
super(...arguments), this.type = "html", this.renderInstance = renderHTML;
|
|
2779
|
+
}
|
|
2780
|
+
readValueFromInstance(e, _) {
|
|
2781
|
+
if (transformProps.has(_)) return this.projection?.isProjecting ? defaultTransformValue(_) : readTransformValue(e, _);
|
|
2782
|
+
{
|
|
2783
|
+
let v = getComputedStyle$1(e), y = (isCSSVariableName(_) ? v.getPropertyValue(_) : v[_]) || 0;
|
|
2784
|
+
return typeof y == "string" ? y.trim() : y;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
measureInstanceViewportBox(e, { transformPagePoint: _ }) {
|
|
2788
|
+
return measureViewportBox(e, _);
|
|
2789
|
+
}
|
|
2790
|
+
build(e, _, v) {
|
|
2791
|
+
buildHTMLStyles(e, _, v.transformTemplate);
|
|
2792
|
+
}
|
|
2793
|
+
scrapeMotionValuesFromProps(e, _, v) {
|
|
2794
|
+
return scrapeMotionValuesFromProps$1(e, _, v);
|
|
2795
|
+
}
|
|
2796
|
+
}, camelCaseAttributes = new Set([
|
|
2797
|
+
"baseFrequency",
|
|
2798
|
+
"diffuseConstant",
|
|
2799
|
+
"kernelMatrix",
|
|
2800
|
+
"kernelUnitLength",
|
|
2801
|
+
"keySplines",
|
|
2802
|
+
"keyTimes",
|
|
2803
|
+
"limitingConeAngle",
|
|
2804
|
+
"markerHeight",
|
|
2805
|
+
"markerWidth",
|
|
2806
|
+
"numOctaves",
|
|
2807
|
+
"targetX",
|
|
2808
|
+
"targetY",
|
|
2809
|
+
"surfaceScale",
|
|
2810
|
+
"specularConstant",
|
|
2811
|
+
"specularExponent",
|
|
2812
|
+
"stdDeviation",
|
|
2813
|
+
"tableValues",
|
|
2814
|
+
"viewBox",
|
|
2815
|
+
"gradientTransform",
|
|
2816
|
+
"pathLength",
|
|
2817
|
+
"startOffset",
|
|
2818
|
+
"textLength",
|
|
2819
|
+
"lengthAdjust"
|
|
2820
|
+
]);
|
|
2821
|
+
function renderSVG(e, _, v, y) {
|
|
2822
|
+
for (let v in renderHTML(e, _, void 0, y), _.attrs) e.setAttribute(camelCaseAttributes.has(v) ? v : camelToDash(v), _.attrs[v]);
|
|
2823
|
+
}
|
|
2824
|
+
var SVGVisualElement = class extends DOMVisualElement {
|
|
2825
|
+
constructor() {
|
|
2826
|
+
super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = createBox;
|
|
2827
|
+
}
|
|
2828
|
+
getBaseTargetFromProps(e, _) {
|
|
2829
|
+
return e[_];
|
|
2830
|
+
}
|
|
2831
|
+
readValueFromInstance(e, _) {
|
|
2832
|
+
if (transformProps.has(_)) {
|
|
2833
|
+
let e = getDefaultValueType(_);
|
|
2834
|
+
return e && e.default || 0;
|
|
2835
|
+
}
|
|
2836
|
+
return _ = camelCaseAttributes.has(_) ? _ : camelToDash(_), e.getAttribute(_);
|
|
2837
|
+
}
|
|
2838
|
+
scrapeMotionValuesFromProps(e, _, v) {
|
|
2839
|
+
return scrapeMotionValuesFromProps(e, _, v);
|
|
2840
|
+
}
|
|
2841
|
+
build(e, _, v) {
|
|
2842
|
+
buildSVGAttrs(e, _, this.isSVGTag, v.transformTemplate, v.style);
|
|
2843
|
+
}
|
|
2844
|
+
renderInstance(e, _, v, y) {
|
|
2845
|
+
renderSVG(e, _, v, y);
|
|
2846
|
+
}
|
|
2847
|
+
mount(e) {
|
|
2848
|
+
this.isSVGTag = isSVGTag(e.tagName), super.mount(e);
|
|
2849
|
+
}
|
|
2850
|
+
}, createDomVisualElement = (e, _) => isSVGComponent(e) ? new SVGVisualElement(_) : new HTMLVisualElement(_, { allowProjection: e !== Fragment });
|
|
2851
|
+
function resolveVariant(e, _, v) {
|
|
2852
|
+
let y = e.getProps();
|
|
2853
|
+
return resolveVariantFromProps(y, _, v === void 0 ? y.custom : v, e);
|
|
2854
|
+
}
|
|
2855
|
+
var isKeyframesTarget = (e) => Array.isArray(e);
|
|
2856
|
+
function setMotionValue(e, _, v) {
|
|
2857
|
+
e.hasValue(_) ? e.getValue(_).set(v) : e.addValue(_, motionValue(v));
|
|
2858
|
+
}
|
|
2859
|
+
function resolveFinalValueInKeyframes(e) {
|
|
2860
|
+
return isKeyframesTarget(e) ? e[e.length - 1] || 0 : e;
|
|
2861
|
+
}
|
|
2862
|
+
function setTarget(e, _) {
|
|
2863
|
+
let { transitionEnd: v = {}, transition: y = {}, ...b } = resolveVariant(e, _) || {};
|
|
2864
|
+
for (let _ in b = {
|
|
2865
|
+
...b,
|
|
2866
|
+
...v
|
|
2867
|
+
}, b) setMotionValue(e, _, resolveFinalValueInKeyframes(b[_]));
|
|
2868
|
+
}
|
|
2869
|
+
function isWillChangeMotionValue(e) {
|
|
2870
|
+
return !!(isMotionValue(e) && e.add);
|
|
2871
|
+
}
|
|
2872
|
+
function addValueToWillChange(e, _) {
|
|
2873
|
+
let v = e.getValue("willChange");
|
|
2874
|
+
if (isWillChangeMotionValue(v)) return v.add(_);
|
|
2875
|
+
if (!v && MotionGlobalConfig.WillChange) {
|
|
2876
|
+
let v = new MotionGlobalConfig.WillChange("auto");
|
|
2877
|
+
e.addValue("willChange", v), v.add(_);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
function getOptimisedAppearId(e) {
|
|
2881
|
+
return e.props[optimizedAppearDataAttribute];
|
|
2882
|
+
}
|
|
2883
|
+
var isNotNull = (e) => e !== null;
|
|
2884
|
+
function getFinalKeyframe(e, { repeat: _, repeatType: v = "loop" }, y) {
|
|
2885
|
+
let b = e.filter(isNotNull), x = _ && v !== "loop" && _ % 2 == 1 ? 0 : b.length - 1;
|
|
2886
|
+
return !x || y === void 0 ? b[x] : y;
|
|
2887
|
+
}
|
|
2888
|
+
var underDampedSpring = {
|
|
2889
|
+
type: "spring",
|
|
2890
|
+
stiffness: 500,
|
|
2891
|
+
damping: 25,
|
|
2892
|
+
restSpeed: 10
|
|
2893
|
+
}, criticallyDampedSpring = (e) => ({
|
|
2894
|
+
type: "spring",
|
|
2895
|
+
stiffness: 550,
|
|
2896
|
+
damping: e === 0 ? 2 * Math.sqrt(550) : 30,
|
|
2897
|
+
restSpeed: 10
|
|
2898
|
+
}), keyframesTransition = {
|
|
2899
|
+
type: "keyframes",
|
|
2900
|
+
duration: .8
|
|
2901
|
+
}, ease = {
|
|
2902
|
+
type: "keyframes",
|
|
2903
|
+
ease: [
|
|
2904
|
+
.25,
|
|
2905
|
+
.1,
|
|
2906
|
+
.35,
|
|
2907
|
+
1
|
|
2908
|
+
],
|
|
2909
|
+
duration: .3
|
|
2910
|
+
}, getDefaultTransition = (e, { keyframes: _ }) => _.length > 2 ? keyframesTransition : transformProps.has(e) ? e.startsWith("scale") ? criticallyDampedSpring(_[1]) : underDampedSpring : ease;
|
|
2911
|
+
function isTransitionDefined({ when: e, delay: _, delayChildren: v, staggerChildren: y, staggerDirection: b, repeat: x, repeatType: S, repeatDelay: C, from: w, elapsed: T, ...E }) {
|
|
2912
|
+
return !!Object.keys(E).length;
|
|
2913
|
+
}
|
|
2914
|
+
var animateMotionValue = (e, _, v, y = {}, b, x) => (S) => {
|
|
2915
|
+
let C = getValueTransition(y, e) || {}, w = C.delay || y.delay || 0, { elapsed: T = 0 } = y;
|
|
2916
|
+
T -= /* @__PURE__ */ secondsToMilliseconds(w);
|
|
2917
|
+
let E = {
|
|
2918
|
+
keyframes: Array.isArray(v) ? v : [null, v],
|
|
2919
|
+
ease: "easeOut",
|
|
2920
|
+
velocity: _.getVelocity(),
|
|
2921
|
+
...C,
|
|
2922
|
+
delay: -T,
|
|
2923
|
+
onUpdate: (e) => {
|
|
2924
|
+
_.set(e), C.onUpdate && C.onUpdate(e);
|
|
2925
|
+
},
|
|
2926
|
+
onComplete: () => {
|
|
2927
|
+
S(), C.onComplete && C.onComplete();
|
|
2928
|
+
},
|
|
2929
|
+
name: e,
|
|
2930
|
+
motionValue: _,
|
|
2931
|
+
element: x ? void 0 : b
|
|
2932
|
+
};
|
|
2933
|
+
isTransitionDefined(C) || Object.assign(E, getDefaultTransition(e, E)), E.duration &&= /* @__PURE__ */ secondsToMilliseconds(E.duration), E.repeatDelay &&= /* @__PURE__ */ secondsToMilliseconds(E.repeatDelay), E.from !== void 0 && (E.keyframes[0] = E.from);
|
|
2934
|
+
let D = !1;
|
|
2935
|
+
if ((E.type === !1 || E.duration === 0 && !E.repeatDelay) && (makeAnimationInstant(E), E.delay === 0 && (D = !0)), (MotionGlobalConfig.instantAnimations || MotionGlobalConfig.skipAnimations) && (D = !0, makeAnimationInstant(E), E.delay = 0), E.allowFlatten = !C.type && !C.ease, D && !x && _.get() !== void 0) {
|
|
2936
|
+
let e = getFinalKeyframe(E.keyframes, C);
|
|
2937
|
+
if (e !== void 0) {
|
|
2938
|
+
frame.update(() => {
|
|
2939
|
+
E.onUpdate(e), E.onComplete();
|
|
2940
|
+
});
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
return C.isSync ? new JSAnimation(E) : new AsyncMotionValueAnimation(E);
|
|
2945
|
+
};
|
|
2946
|
+
function shouldBlockAnimation({ protectedKeys: e, needsAnimating: _ }, v) {
|
|
2947
|
+
let y = e.hasOwnProperty(v) && _[v] !== !0;
|
|
2948
|
+
return _[v] = !1, y;
|
|
2949
|
+
}
|
|
2950
|
+
function animateTarget(e, _, { delay: v = 0, transitionOverride: y, type: b } = {}) {
|
|
2951
|
+
let { transition: x = e.getDefaultTransition(), transitionEnd: S, ...C } = _;
|
|
2952
|
+
y && (x = y);
|
|
2953
|
+
let w = [], T = b && e.animationState && e.animationState.getState()[b];
|
|
2954
|
+
for (let _ in C) {
|
|
2955
|
+
let y = e.getValue(_, e.latestValues[_] ?? null), b = C[_];
|
|
2956
|
+
if (b === void 0 || T && shouldBlockAnimation(T, _)) continue;
|
|
2957
|
+
let S = {
|
|
2958
|
+
delay: v,
|
|
2959
|
+
...getValueTransition(x || {}, _)
|
|
2960
|
+
}, E = y.get();
|
|
2961
|
+
if (E !== void 0 && !y.isAnimating && !Array.isArray(b) && b === E && !S.velocity) continue;
|
|
2962
|
+
let D = !1;
|
|
2963
|
+
if (window.MotionHandoffAnimation) {
|
|
2964
|
+
let v = getOptimisedAppearId(e);
|
|
2965
|
+
if (v) {
|
|
2966
|
+
let e = window.MotionHandoffAnimation(v, _, frame);
|
|
2967
|
+
e !== null && (S.startTime = e, D = !0);
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
addValueToWillChange(e, _), y.start(animateMotionValue(_, y, b, e.shouldReduceMotion && positionalKeys.has(_) ? { type: !1 } : S, e, D));
|
|
2971
|
+
let O = y.animation;
|
|
2972
|
+
O && w.push(O);
|
|
2973
|
+
}
|
|
2974
|
+
return S && Promise.all(w).then(() => {
|
|
2975
|
+
frame.update(() => {
|
|
2976
|
+
S && setTarget(e, S);
|
|
2977
|
+
});
|
|
2978
|
+
}), w;
|
|
2979
|
+
}
|
|
2980
|
+
function calcChildStagger(e, _, v, y = 0, b = 1) {
|
|
2981
|
+
let x = Array.from(e).sort((e, _) => e.sortNodePosition(_)).indexOf(_), S = e.size, C = (S - 1) * y;
|
|
2982
|
+
return typeof v == "function" ? v(x, S) : b === 1 ? x * y : C - x * y;
|
|
2983
|
+
}
|
|
2984
|
+
function animateVariant(e, _, v = {}) {
|
|
2985
|
+
let y = resolveVariant(e, _, v.type === "exit" ? e.presenceContext?.custom : void 0), { transition: b = e.getDefaultTransition() || {} } = y || {};
|
|
2986
|
+
v.transitionOverride && (b = v.transitionOverride);
|
|
2987
|
+
let x = y ? () => Promise.all(animateTarget(e, y, v)) : () => Promise.resolve(), S = e.variantChildren && e.variantChildren.size ? (y = 0) => {
|
|
2988
|
+
let { delayChildren: x = 0, staggerChildren: S, staggerDirection: C } = b;
|
|
2989
|
+
return animateChildren(e, _, y, x, S, C, v);
|
|
2990
|
+
} : () => Promise.resolve(), { when: C } = b;
|
|
2991
|
+
if (C) {
|
|
2992
|
+
let [e, _] = C === "beforeChildren" ? [x, S] : [S, x];
|
|
2993
|
+
return e().then(() => _());
|
|
2994
|
+
} else return Promise.all([x(), S(v.delay)]);
|
|
2995
|
+
}
|
|
2996
|
+
function animateChildren(e, _, v = 0, y = 0, b = 0, x = 1, S) {
|
|
2997
|
+
let C = [];
|
|
2998
|
+
for (let w of e.variantChildren) w.notify("AnimationStart", _), C.push(animateVariant(w, _, {
|
|
2999
|
+
...S,
|
|
3000
|
+
delay: v + (typeof y == "function" ? 0 : y) + calcChildStagger(e.variantChildren, w, y, b, x)
|
|
3001
|
+
}).then(() => w.notify("AnimationComplete", _)));
|
|
3002
|
+
return Promise.all(C);
|
|
3003
|
+
}
|
|
3004
|
+
function animateVisualElement(e, _, v = {}) {
|
|
3005
|
+
e.notify("AnimationStart", _);
|
|
3006
|
+
let y;
|
|
3007
|
+
if (Array.isArray(_)) {
|
|
3008
|
+
let b = _.map((_) => animateVariant(e, _, v));
|
|
3009
|
+
y = Promise.all(b);
|
|
3010
|
+
} else if (typeof _ == "string") y = animateVariant(e, _, v);
|
|
3011
|
+
else {
|
|
3012
|
+
let b = typeof _ == "function" ? resolveVariant(e, _, v.custom) : _;
|
|
3013
|
+
y = Promise.all(animateTarget(e, b, v));
|
|
3014
|
+
}
|
|
3015
|
+
return y.then(() => {
|
|
3016
|
+
e.notify("AnimationComplete", _);
|
|
3017
|
+
});
|
|
3018
|
+
}
|
|
3019
|
+
function shallowCompare(e, _) {
|
|
3020
|
+
if (!Array.isArray(_)) return !1;
|
|
3021
|
+
let v = _.length;
|
|
3022
|
+
if (v !== e.length) return !1;
|
|
3023
|
+
for (let y = 0; y < v; y++) if (_[y] !== e[y]) return !1;
|
|
3024
|
+
return !0;
|
|
3025
|
+
}
|
|
3026
|
+
var numVariantProps = variantProps.length;
|
|
3027
|
+
function getVariantContext(e) {
|
|
3028
|
+
if (!e) return;
|
|
3029
|
+
if (!e.isControllingVariants) {
|
|
3030
|
+
let _ = e.parent && getVariantContext(e.parent) || {};
|
|
3031
|
+
return e.props.initial !== void 0 && (_.initial = e.props.initial), _;
|
|
3032
|
+
}
|
|
3033
|
+
let _ = {};
|
|
3034
|
+
for (let v = 0; v < numVariantProps; v++) {
|
|
3035
|
+
let y = variantProps[v], b = e.props[y];
|
|
3036
|
+
(isVariantLabel(b) || b === !1) && (_[y] = b);
|
|
3037
|
+
}
|
|
3038
|
+
return _;
|
|
3039
|
+
}
|
|
3040
|
+
var reversePriorityOrder = [...variantPriorityOrder].reverse(), numAnimationTypes = variantPriorityOrder.length;
|
|
3041
|
+
function animateList(e) {
|
|
3042
|
+
return (_) => Promise.all(_.map(({ animation: _, options: v }) => animateVisualElement(e, _, v)));
|
|
3043
|
+
}
|
|
3044
|
+
function createAnimationState(e) {
|
|
3045
|
+
let _ = animateList(e), v = createState(), y = !0, b = (_) => (v, y) => {
|
|
3046
|
+
let b = resolveVariant(e, y, _ === "exit" ? e.presenceContext?.custom : void 0);
|
|
3047
|
+
if (b) {
|
|
3048
|
+
let { transition: e, transitionEnd: _, ...y } = b;
|
|
3049
|
+
v = {
|
|
3050
|
+
...v,
|
|
3051
|
+
...y,
|
|
3052
|
+
..._
|
|
3053
|
+
};
|
|
3054
|
+
}
|
|
3055
|
+
return v;
|
|
3056
|
+
};
|
|
3057
|
+
function x(v) {
|
|
3058
|
+
_ = v(e);
|
|
3059
|
+
}
|
|
3060
|
+
function S(x) {
|
|
3061
|
+
let { props: S } = e, C = getVariantContext(e.parent) || {}, w = [], T = /* @__PURE__ */ new Set(), E = {}, D = Infinity;
|
|
3062
|
+
for (let _ = 0; _ < numAnimationTypes; _++) {
|
|
3063
|
+
let O = reversePriorityOrder[_], k = v[O], A = S[O] === void 0 ? C[O] : S[O], j = isVariantLabel(A), M = O === x ? k.isActive : null;
|
|
3064
|
+
M === !1 && (D = _);
|
|
3065
|
+
let N = A === C[O] && A !== S[O] && j;
|
|
3066
|
+
if (N && y && e.manuallyAnimateOnMount && (N = !1), k.protectedKeys = { ...E }, !k.isActive && M === null || !A && !k.prevProp || isAnimationControls(A) || typeof A == "boolean") continue;
|
|
3067
|
+
let P = checkVariantsDidChange(k.prevProp, A), F = P || O === x && k.isActive && !N && j || _ > D && j, I = !1, L = Array.isArray(A) ? A : [A], R = L.reduce(b(O), {});
|
|
3068
|
+
M === !1 && (R = {});
|
|
3069
|
+
let { prevResolvedValues: z = {} } = k, B = {
|
|
3070
|
+
...z,
|
|
3071
|
+
...R
|
|
3072
|
+
}, V = (_) => {
|
|
3073
|
+
F = !0, T.has(_) && (I = !0, T.delete(_)), k.needsAnimating[_] = !0;
|
|
3074
|
+
let v = e.getValue(_);
|
|
3075
|
+
v && (v.liveStyle = !1);
|
|
3076
|
+
};
|
|
3077
|
+
for (let e in B) {
|
|
3078
|
+
let _ = R[e], v = z[e];
|
|
3079
|
+
if (E.hasOwnProperty(e)) continue;
|
|
3080
|
+
let y = !1;
|
|
3081
|
+
y = isKeyframesTarget(_) && isKeyframesTarget(v) ? !shallowCompare(_, v) : _ !== v, y ? _ == null ? T.add(e) : V(e) : _ !== void 0 && T.has(e) ? V(e) : k.protectedKeys[e] = !0;
|
|
3082
|
+
}
|
|
3083
|
+
k.prevProp = A, k.prevResolvedValues = R, k.isActive && (E = {
|
|
3084
|
+
...E,
|
|
3085
|
+
...R
|
|
3086
|
+
}), y && e.blockInitialAnimation && (F = !1);
|
|
3087
|
+
let H = N && P;
|
|
3088
|
+
F && (!H || I) && w.push(...L.map((_) => {
|
|
3089
|
+
let v = { type: O };
|
|
3090
|
+
if (typeof _ == "string" && y && !H && e.manuallyAnimateOnMount && e.parent) {
|
|
3091
|
+
let { parent: y } = e, b = resolveVariant(y, _);
|
|
3092
|
+
if (y.enteringChildren && b) {
|
|
3093
|
+
let { delayChildren: _ } = b.transition || {};
|
|
3094
|
+
v.delay = calcChildStagger(y.enteringChildren, e, _);
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
return {
|
|
3098
|
+
animation: _,
|
|
3099
|
+
options: v
|
|
3100
|
+
};
|
|
3101
|
+
}));
|
|
3102
|
+
}
|
|
3103
|
+
if (T.size) {
|
|
3104
|
+
let _ = {};
|
|
3105
|
+
if (typeof S.initial != "boolean") {
|
|
3106
|
+
let v = resolveVariant(e, Array.isArray(S.initial) ? S.initial[0] : S.initial);
|
|
3107
|
+
v && v.transition && (_.transition = v.transition);
|
|
3108
|
+
}
|
|
3109
|
+
T.forEach((v) => {
|
|
3110
|
+
let y = e.getBaseTarget(v), b = e.getValue(v);
|
|
3111
|
+
b && (b.liveStyle = !0), _[v] = y ?? null;
|
|
3112
|
+
}), w.push({ animation: _ });
|
|
3113
|
+
}
|
|
3114
|
+
let O = !!w.length;
|
|
3115
|
+
return y && (S.initial === !1 || S.initial === S.animate) && !e.manuallyAnimateOnMount && (O = !1), y = !1, O ? _(w) : Promise.resolve();
|
|
3116
|
+
}
|
|
3117
|
+
function C(_, y) {
|
|
3118
|
+
if (v[_].isActive === y) return Promise.resolve();
|
|
3119
|
+
e.variantChildren?.forEach((e) => e.animationState?.setActive(_, y)), v[_].isActive = y;
|
|
3120
|
+
let b = S(_);
|
|
3121
|
+
for (let e in v) v[e].protectedKeys = {};
|
|
3122
|
+
return b;
|
|
3123
|
+
}
|
|
3124
|
+
return {
|
|
3125
|
+
animateChanges: S,
|
|
3126
|
+
setActive: C,
|
|
3127
|
+
setAnimateFunction: x,
|
|
3128
|
+
getState: () => v,
|
|
3129
|
+
reset: () => {
|
|
3130
|
+
v = createState();
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
}
|
|
3134
|
+
function checkVariantsDidChange(e, _) {
|
|
3135
|
+
return typeof _ == "string" ? _ !== e : Array.isArray(_) ? !shallowCompare(_, e) : !1;
|
|
3136
|
+
}
|
|
3137
|
+
function createTypeState(e = !1) {
|
|
3138
|
+
return {
|
|
3139
|
+
isActive: e,
|
|
3140
|
+
protectedKeys: {},
|
|
3141
|
+
needsAnimating: {},
|
|
3142
|
+
prevResolvedValues: {}
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
function createState() {
|
|
3146
|
+
return {
|
|
3147
|
+
animate: createTypeState(!0),
|
|
3148
|
+
whileInView: createTypeState(),
|
|
3149
|
+
whileHover: createTypeState(),
|
|
3150
|
+
whileTap: createTypeState(),
|
|
3151
|
+
whileDrag: createTypeState(),
|
|
3152
|
+
whileFocus: createTypeState(),
|
|
3153
|
+
exit: createTypeState()
|
|
3154
|
+
};
|
|
3155
|
+
}
|
|
3156
|
+
var Feature = class {
|
|
3157
|
+
constructor(e) {
|
|
3158
|
+
this.isMounted = !1, this.node = e;
|
|
3159
|
+
}
|
|
3160
|
+
update() {}
|
|
3161
|
+
}, AnimationFeature = class extends Feature {
|
|
3162
|
+
constructor(e) {
|
|
3163
|
+
super(e), e.animationState ||= createAnimationState(e);
|
|
3164
|
+
}
|
|
3165
|
+
updateAnimationControlsSubscription() {
|
|
3166
|
+
let { animate: e } = this.node.getProps();
|
|
3167
|
+
isAnimationControls(e) && (this.unmountControls = e.subscribe(this.node));
|
|
3168
|
+
}
|
|
3169
|
+
mount() {
|
|
3170
|
+
this.updateAnimationControlsSubscription();
|
|
3171
|
+
}
|
|
3172
|
+
update() {
|
|
3173
|
+
let { animate: e } = this.node.getProps(), { animate: _ } = this.node.prevProps || {};
|
|
3174
|
+
e !== _ && this.updateAnimationControlsSubscription();
|
|
3175
|
+
}
|
|
3176
|
+
unmount() {
|
|
3177
|
+
this.node.animationState.reset(), this.unmountControls?.();
|
|
3178
|
+
}
|
|
3179
|
+
}, id$1 = 0, animations = {
|
|
3180
|
+
animation: { Feature: AnimationFeature },
|
|
3181
|
+
exit: { Feature: class extends Feature {
|
|
3182
|
+
constructor() {
|
|
3183
|
+
super(...arguments), this.id = id$1++;
|
|
3184
|
+
}
|
|
3185
|
+
update() {
|
|
3186
|
+
if (!this.node.presenceContext) return;
|
|
3187
|
+
let { isPresent: e, onExitComplete: _ } = this.node.presenceContext, { isPresent: v } = this.node.prevPresenceContext || {};
|
|
3188
|
+
if (!this.node.animationState || e === v) return;
|
|
3189
|
+
let y = this.node.animationState.setActive("exit", !e);
|
|
3190
|
+
_ && !e && y.then(() => {
|
|
3191
|
+
_(this.id);
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
mount() {
|
|
3195
|
+
let { register: e, onExitComplete: _ } = this.node.presenceContext || {};
|
|
3196
|
+
_ && _(this.id), e && (this.unmount = e(this.id));
|
|
3197
|
+
}
|
|
3198
|
+
unmount() {}
|
|
3199
|
+
} }
|
|
3200
|
+
};
|
|
3201
|
+
function addDomEvent(e, _, v, y = { passive: !0 }) {
|
|
3202
|
+
return e.addEventListener(_, v, y), () => e.removeEventListener(_, v);
|
|
3203
|
+
}
|
|
3204
|
+
function extractEventInfo(e) {
|
|
3205
|
+
return { point: {
|
|
3206
|
+
x: e.pageX,
|
|
3207
|
+
y: e.pageY
|
|
3208
|
+
} };
|
|
3209
|
+
}
|
|
3210
|
+
var addPointerInfo = (e) => (_) => isPrimaryPointer(_) && e(_, extractEventInfo(_));
|
|
3211
|
+
function addPointerEvent(e, _, v, y) {
|
|
3212
|
+
return addDomEvent(e, _, addPointerInfo(v), y);
|
|
3213
|
+
}
|
|
3214
|
+
var SCALE_PRECISION = 1e-4, SCALE_MIN = 1 - SCALE_PRECISION, SCALE_MAX = 1 + SCALE_PRECISION, TRANSLATE_PRECISION = .01, TRANSLATE_MIN = 0 - TRANSLATE_PRECISION, TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;
|
|
3215
|
+
function calcLength(e) {
|
|
3216
|
+
return e.max - e.min;
|
|
3217
|
+
}
|
|
3218
|
+
function isNear(e, _, v) {
|
|
3219
|
+
return Math.abs(e - _) <= v;
|
|
3220
|
+
}
|
|
3221
|
+
function calcAxisDelta(e, _, v, y = .5) {
|
|
3222
|
+
e.origin = y, e.originPoint = mixNumber(_.min, _.max, e.origin), e.scale = calcLength(v) / calcLength(_), e.translate = mixNumber(v.min, v.max, e.origin) - e.originPoint, (e.scale >= SCALE_MIN && e.scale <= SCALE_MAX || isNaN(e.scale)) && (e.scale = 1), (e.translate >= TRANSLATE_MIN && e.translate <= TRANSLATE_MAX || isNaN(e.translate)) && (e.translate = 0);
|
|
3223
|
+
}
|
|
3224
|
+
function calcBoxDelta(e, _, v, y) {
|
|
3225
|
+
calcAxisDelta(e.x, _.x, v.x, y ? y.originX : void 0), calcAxisDelta(e.y, _.y, v.y, y ? y.originY : void 0);
|
|
3226
|
+
}
|
|
3227
|
+
function calcRelativeAxis(e, _, v) {
|
|
3228
|
+
e.min = v.min + _.min, e.max = e.min + calcLength(_);
|
|
3229
|
+
}
|
|
3230
|
+
function calcRelativeBox(e, _, v) {
|
|
3231
|
+
calcRelativeAxis(e.x, _.x, v.x), calcRelativeAxis(e.y, _.y, v.y);
|
|
3232
|
+
}
|
|
3233
|
+
function calcRelativeAxisPosition(e, _, v) {
|
|
3234
|
+
e.min = _.min - v.min, e.max = e.min + calcLength(_);
|
|
3235
|
+
}
|
|
3236
|
+
function calcRelativePosition(e, _, v) {
|
|
3237
|
+
calcRelativeAxisPosition(e.x, _.x, v.x), calcRelativeAxisPosition(e.y, _.y, v.y);
|
|
3238
|
+
}
|
|
3239
|
+
function eachAxis(e) {
|
|
3240
|
+
return [e("x"), e("y")];
|
|
3241
|
+
}
|
|
3242
|
+
var getContextWindow = ({ current: e }) => e ? e.ownerDocument.defaultView : null, distance = (e, _) => Math.abs(e - _);
|
|
3243
|
+
function distance2D(e, _) {
|
|
3244
|
+
let v = distance(e.x, _.x), y = distance(e.y, _.y);
|
|
3245
|
+
return Math.sqrt(v ** 2 + y ** 2);
|
|
3246
|
+
}
|
|
3247
|
+
var PanSession = class {
|
|
3248
|
+
constructor(e, _, { transformPagePoint: v, contextWindow: y = window, dragSnapToOrigin: b = !1, distanceThreshold: x = 3 } = {}) {
|
|
3249
|
+
if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
|
|
3250
|
+
if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return;
|
|
3251
|
+
let e = getPanInfo(this.lastMoveEventInfo, this.history), _ = this.startEvent !== null, v = distance2D(e.offset, {
|
|
3252
|
+
x: 0,
|
|
3253
|
+
y: 0
|
|
3254
|
+
}) >= this.distanceThreshold;
|
|
3255
|
+
if (!_ && !v) return;
|
|
3256
|
+
let { point: y } = e, { timestamp: b } = frameData;
|
|
3257
|
+
this.history.push({
|
|
3258
|
+
...y,
|
|
3259
|
+
timestamp: b
|
|
3260
|
+
});
|
|
3261
|
+
let { onStart: x, onMove: S } = this.handlers;
|
|
3262
|
+
_ || (x && x(this.lastMoveEvent, e), this.startEvent = this.lastMoveEvent), S && S(this.lastMoveEvent, e);
|
|
3263
|
+
}, this.handlePointerMove = (e, _) => {
|
|
3264
|
+
this.lastMoveEvent = e, this.lastMoveEventInfo = transformPoint(_, this.transformPagePoint), frame.update(this.updatePoint, !0);
|
|
3265
|
+
}, this.handlePointerUp = (e, _) => {
|
|
3266
|
+
this.end();
|
|
3267
|
+
let { onEnd: v, onSessionEnd: y, resumeAnimation: b } = this.handlers;
|
|
3268
|
+
if (this.dragSnapToOrigin && b && b(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return;
|
|
3269
|
+
let x = getPanInfo(e.type === "pointercancel" ? this.lastMoveEventInfo : transformPoint(_, this.transformPagePoint), this.history);
|
|
3270
|
+
this.startEvent && v && v(e, x), y && y(e, x);
|
|
3271
|
+
}, !isPrimaryPointer(e)) return;
|
|
3272
|
+
this.dragSnapToOrigin = b, this.handlers = _, this.transformPagePoint = v, this.distanceThreshold = x, this.contextWindow = y || window;
|
|
3273
|
+
let S = transformPoint(extractEventInfo(e), this.transformPagePoint), { point: C } = S, { timestamp: w } = frameData;
|
|
3274
|
+
this.history = [{
|
|
3275
|
+
...C,
|
|
3276
|
+
timestamp: w
|
|
3277
|
+
}];
|
|
3278
|
+
let { onSessionStart: T } = _;
|
|
3279
|
+
T && T(e, getPanInfo(S, this.history)), this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
|
|
3280
|
+
}
|
|
3281
|
+
updateHandlers(e) {
|
|
3282
|
+
this.handlers = e;
|
|
3283
|
+
}
|
|
3284
|
+
end() {
|
|
3285
|
+
this.removeListeners && this.removeListeners(), cancelFrame(this.updatePoint);
|
|
3286
|
+
}
|
|
3287
|
+
};
|
|
3288
|
+
function transformPoint(e, _) {
|
|
3289
|
+
return _ ? { point: _(e.point) } : e;
|
|
3290
|
+
}
|
|
3291
|
+
function subtractPoint(e, _) {
|
|
3292
|
+
return {
|
|
3293
|
+
x: e.x - _.x,
|
|
3294
|
+
y: e.y - _.y
|
|
3295
|
+
};
|
|
3296
|
+
}
|
|
3297
|
+
function getPanInfo({ point: e }, _) {
|
|
3298
|
+
return {
|
|
3299
|
+
point: e,
|
|
3300
|
+
delta: subtractPoint(e, lastDevicePoint(_)),
|
|
3301
|
+
offset: subtractPoint(e, startDevicePoint(_)),
|
|
3302
|
+
velocity: getVelocity(_, .1)
|
|
3303
|
+
};
|
|
3304
|
+
}
|
|
3305
|
+
function startDevicePoint(e) {
|
|
3306
|
+
return e[0];
|
|
3307
|
+
}
|
|
3308
|
+
function lastDevicePoint(e) {
|
|
3309
|
+
return e[e.length - 1];
|
|
3310
|
+
}
|
|
3311
|
+
function getVelocity(e, _) {
|
|
3312
|
+
if (e.length < 2) return {
|
|
3313
|
+
x: 0,
|
|
3314
|
+
y: 0
|
|
3315
|
+
};
|
|
3316
|
+
let v = e.length - 1, y = null, b = lastDevicePoint(e);
|
|
3317
|
+
for (; v >= 0 && (y = e[v], !(b.timestamp - y.timestamp > /* @__PURE__ */ secondsToMilliseconds(_)));) v--;
|
|
3318
|
+
if (!y) return {
|
|
3319
|
+
x: 0,
|
|
3320
|
+
y: 0
|
|
3321
|
+
};
|
|
3322
|
+
let x = /* @__PURE__ */ millisecondsToSeconds(b.timestamp - y.timestamp);
|
|
3323
|
+
if (x === 0) return {
|
|
3324
|
+
x: 0,
|
|
3325
|
+
y: 0
|
|
3326
|
+
};
|
|
3327
|
+
let S = {
|
|
3328
|
+
x: (b.x - y.x) / x,
|
|
3329
|
+
y: (b.y - y.y) / x
|
|
3330
|
+
};
|
|
3331
|
+
return S.x === Infinity && (S.x = 0), S.y === Infinity && (S.y = 0), S;
|
|
3332
|
+
}
|
|
3333
|
+
function applyConstraints(e, { min: _, max: v }, y) {
|
|
3334
|
+
return _ !== void 0 && e < _ ? e = y ? mixNumber(_, e, y.min) : Math.max(e, _) : v !== void 0 && e > v && (e = y ? mixNumber(v, e, y.max) : Math.min(e, v)), e;
|
|
3335
|
+
}
|
|
3336
|
+
function calcRelativeAxisConstraints(e, _, v) {
|
|
3337
|
+
return {
|
|
3338
|
+
min: _ === void 0 ? void 0 : e.min + _,
|
|
3339
|
+
max: v === void 0 ? void 0 : e.max + v - (e.max - e.min)
|
|
3340
|
+
};
|
|
3341
|
+
}
|
|
3342
|
+
function calcRelativeConstraints(e, { top: _, left: v, bottom: y, right: b }) {
|
|
3343
|
+
return {
|
|
3344
|
+
x: calcRelativeAxisConstraints(e.x, v, b),
|
|
3345
|
+
y: calcRelativeAxisConstraints(e.y, _, y)
|
|
3346
|
+
};
|
|
3347
|
+
}
|
|
3348
|
+
function calcViewportAxisConstraints(e, _) {
|
|
3349
|
+
let v = _.min - e.min, y = _.max - e.max;
|
|
3350
|
+
return _.max - _.min < e.max - e.min && ([v, y] = [y, v]), {
|
|
3351
|
+
min: v,
|
|
3352
|
+
max: y
|
|
3353
|
+
};
|
|
3354
|
+
}
|
|
3355
|
+
function calcViewportConstraints(e, _) {
|
|
3356
|
+
return {
|
|
3357
|
+
x: calcViewportAxisConstraints(e.x, _.x),
|
|
3358
|
+
y: calcViewportAxisConstraints(e.y, _.y)
|
|
3359
|
+
};
|
|
3360
|
+
}
|
|
3361
|
+
function calcOrigin(e, _) {
|
|
3362
|
+
let v = .5, y = calcLength(e), b = calcLength(_);
|
|
3363
|
+
return b > y ? v = /* @__PURE__ */ progress(_.min, _.max - y, e.min) : y > b && (v = /* @__PURE__ */ progress(e.min, e.max - b, _.min)), clamp(0, 1, v);
|
|
3364
|
+
}
|
|
3365
|
+
function rebaseAxisConstraints(e, _) {
|
|
3366
|
+
let v = {};
|
|
3367
|
+
return _.min !== void 0 && (v.min = _.min - e.min), _.max !== void 0 && (v.max = _.max - e.min), v;
|
|
3368
|
+
}
|
|
3369
|
+
var defaultElastic = .35;
|
|
3370
|
+
function resolveDragElastic(e = defaultElastic) {
|
|
3371
|
+
return e === !1 ? e = 0 : e === !0 && (e = defaultElastic), {
|
|
3372
|
+
x: resolveAxisElastic(e, "left", "right"),
|
|
3373
|
+
y: resolveAxisElastic(e, "top", "bottom")
|
|
3374
|
+
};
|
|
3375
|
+
}
|
|
3376
|
+
function resolveAxisElastic(e, _, v) {
|
|
3377
|
+
return {
|
|
3378
|
+
min: resolvePointElastic(e, _),
|
|
3379
|
+
max: resolvePointElastic(e, v)
|
|
3380
|
+
};
|
|
3381
|
+
}
|
|
3382
|
+
function resolvePointElastic(e, _) {
|
|
3383
|
+
return typeof e == "number" ? e : e[_] || 0;
|
|
3384
|
+
}
|
|
3385
|
+
var elementDragControls = /* @__PURE__ */ new WeakMap(), VisualElementDragControls = class {
|
|
3386
|
+
constructor(e) {
|
|
3387
|
+
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = {
|
|
3388
|
+
x: 0,
|
|
3389
|
+
y: 0
|
|
3390
|
+
}, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = createBox(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
|
|
3391
|
+
}
|
|
3392
|
+
start(e, { snapToCursor: _ = !1, distanceThreshold: v } = {}) {
|
|
3393
|
+
let { presenceContext: y } = this.visualElement;
|
|
3394
|
+
if (y && y.isPresent === !1) return;
|
|
3395
|
+
let b = (e) => {
|
|
3396
|
+
let { dragSnapToOrigin: v } = this.getProps();
|
|
3397
|
+
v ? this.pauseAnimation() : this.stopAnimation(), _ && this.snapToCursor(extractEventInfo(e).point);
|
|
3398
|
+
}, x = (e, _) => {
|
|
3399
|
+
let { drag: v, dragPropagation: y, onDragStart: b } = this.getProps();
|
|
3400
|
+
if (v && !y && (this.openDragLock && this.openDragLock(), this.openDragLock = setDragLock(v), !this.openDragLock)) return;
|
|
3401
|
+
this.latestPointerEvent = e, this.latestPanInfo = _, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), eachAxis((e) => {
|
|
3402
|
+
let _ = this.getAxisMotionValue(e).get() || 0;
|
|
3403
|
+
if (percent.test(_)) {
|
|
3404
|
+
let { projection: v } = this.visualElement;
|
|
3405
|
+
if (v && v.layout) {
|
|
3406
|
+
let y = v.layout.layoutBox[e];
|
|
3407
|
+
y && (_ = calcLength(y) * (parseFloat(_) / 100));
|
|
3408
|
+
}
|
|
3409
|
+
}
|
|
3410
|
+
this.originPoint[e] = _;
|
|
3411
|
+
}), b && frame.postRender(() => b(e, _)), addValueToWillChange(this.visualElement, "transform");
|
|
3412
|
+
let { animationState: x } = this.visualElement;
|
|
3413
|
+
x && x.setActive("whileDrag", !0);
|
|
3414
|
+
}, S = (e, _) => {
|
|
3415
|
+
this.latestPointerEvent = e, this.latestPanInfo = _;
|
|
3416
|
+
let { dragPropagation: v, dragDirectionLock: y, onDirectionLock: b, onDrag: x } = this.getProps();
|
|
3417
|
+
if (!v && !this.openDragLock) return;
|
|
3418
|
+
let { offset: S } = _;
|
|
3419
|
+
if (y && this.currentDirection === null) {
|
|
3420
|
+
this.currentDirection = getCurrentDirection(S), this.currentDirection !== null && b && b(this.currentDirection);
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3423
|
+
this.updateAxis("x", _.point, S), this.updateAxis("y", _.point, S), this.visualElement.render(), x && x(e, _);
|
|
3424
|
+
}, C = (e, _) => {
|
|
3425
|
+
this.latestPointerEvent = e, this.latestPanInfo = _, this.stop(e, _), this.latestPointerEvent = null, this.latestPanInfo = null;
|
|
3426
|
+
}, w = () => eachAxis((e) => this.getAnimationState(e) === "paused" && this.getAxisMotionValue(e).animation?.play()), { dragSnapToOrigin: T } = this.getProps();
|
|
3427
|
+
this.panSession = new PanSession(e, {
|
|
3428
|
+
onSessionStart: b,
|
|
3429
|
+
onStart: x,
|
|
3430
|
+
onMove: S,
|
|
3431
|
+
onSessionEnd: C,
|
|
3432
|
+
resumeAnimation: w
|
|
3433
|
+
}, {
|
|
3434
|
+
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
3435
|
+
dragSnapToOrigin: T,
|
|
3436
|
+
distanceThreshold: v,
|
|
3437
|
+
contextWindow: getContextWindow(this.visualElement)
|
|
3438
|
+
});
|
|
3439
|
+
}
|
|
3440
|
+
stop(e, _) {
|
|
3441
|
+
let v = e || this.latestPointerEvent, y = _ || this.latestPanInfo, b = this.isDragging;
|
|
3442
|
+
if (this.cancel(), !b || !y || !v) return;
|
|
3443
|
+
let { velocity: x } = y;
|
|
3444
|
+
this.startAnimation(x);
|
|
3445
|
+
let { onDragEnd: S } = this.getProps();
|
|
3446
|
+
S && frame.postRender(() => S(v, y));
|
|
3447
|
+
}
|
|
3448
|
+
cancel() {
|
|
3449
|
+
this.isDragging = !1;
|
|
3450
|
+
let { projection: e, animationState: _ } = this.visualElement;
|
|
3451
|
+
e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
|
|
3452
|
+
let { dragPropagation: v } = this.getProps();
|
|
3453
|
+
!v && this.openDragLock && (this.openDragLock(), this.openDragLock = null), _ && _.setActive("whileDrag", !1);
|
|
3454
|
+
}
|
|
3455
|
+
updateAxis(e, _, v) {
|
|
3456
|
+
let { drag: y } = this.getProps();
|
|
3457
|
+
if (!v || !shouldDrag(e, y, this.currentDirection)) return;
|
|
3458
|
+
let b = this.getAxisMotionValue(e), x = this.originPoint[e] + v[e];
|
|
3459
|
+
this.constraints && this.constraints[e] && (x = applyConstraints(x, this.constraints[e], this.elastic[e])), b.set(x);
|
|
3460
|
+
}
|
|
3461
|
+
resolveConstraints() {
|
|
3462
|
+
let { dragConstraints: e, dragElastic: _ } = this.getProps(), v = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, y = this.constraints;
|
|
3463
|
+
e && isRefObject(e) ? this.constraints ||= this.resolveRefConstraints() : e && v ? this.constraints = calcRelativeConstraints(v.layoutBox, e) : this.constraints = !1, this.elastic = resolveDragElastic(_), y !== this.constraints && v && this.constraints && !this.hasMutatedConstraints && eachAxis((e) => {
|
|
3464
|
+
this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] = rebaseAxisConstraints(v.layoutBox[e], this.constraints[e]));
|
|
3465
|
+
});
|
|
3466
|
+
}
|
|
3467
|
+
resolveRefConstraints() {
|
|
3468
|
+
let { dragConstraints: e, onMeasureDragConstraints: _ } = this.getProps();
|
|
3469
|
+
if (!e || !isRefObject(e)) return !1;
|
|
3470
|
+
let v = e.current;
|
|
3471
|
+
invariant(v !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
|
|
3472
|
+
let { projection: y } = this.visualElement;
|
|
3473
|
+
if (!y || !y.layout) return !1;
|
|
3474
|
+
let b = measurePageBox(v, y.root, this.visualElement.getTransformPagePoint()), x = calcViewportConstraints(y.layout.layoutBox, b);
|
|
3475
|
+
if (_) {
|
|
3476
|
+
let e = _(convertBoxToBoundingBox(x));
|
|
3477
|
+
this.hasMutatedConstraints = !!e, e && (x = convertBoundingBoxToBox(e));
|
|
3478
|
+
}
|
|
3479
|
+
return x;
|
|
3480
|
+
}
|
|
3481
|
+
startAnimation(e) {
|
|
3482
|
+
let { drag: _, dragMomentum: v, dragElastic: y, dragTransition: b, dragSnapToOrigin: x, onDragTransitionEnd: S } = this.getProps(), C = this.constraints || {}, w = eachAxis((S) => {
|
|
3483
|
+
if (!shouldDrag(S, _, this.currentDirection)) return;
|
|
3484
|
+
let w = C && C[S] || {};
|
|
3485
|
+
x && (w = {
|
|
3486
|
+
min: 0,
|
|
3487
|
+
max: 0
|
|
3488
|
+
});
|
|
3489
|
+
let T = y ? 200 : 1e6, E = y ? 40 : 1e7, D = {
|
|
3490
|
+
type: "inertia",
|
|
3491
|
+
velocity: v ? e[S] : 0,
|
|
3492
|
+
bounceStiffness: T,
|
|
3493
|
+
bounceDamping: E,
|
|
3494
|
+
timeConstant: 750,
|
|
3495
|
+
restDelta: 1,
|
|
3496
|
+
restSpeed: 10,
|
|
3497
|
+
...b,
|
|
3498
|
+
...w
|
|
3499
|
+
};
|
|
3500
|
+
return this.startAxisValueAnimation(S, D);
|
|
3501
|
+
});
|
|
3502
|
+
return Promise.all(w).then(S);
|
|
3503
|
+
}
|
|
3504
|
+
startAxisValueAnimation(e, _) {
|
|
3505
|
+
let v = this.getAxisMotionValue(e);
|
|
3506
|
+
return addValueToWillChange(this.visualElement, e), v.start(animateMotionValue(e, v, 0, _, this.visualElement, !1));
|
|
3507
|
+
}
|
|
3508
|
+
stopAnimation() {
|
|
3509
|
+
eachAxis((e) => this.getAxisMotionValue(e).stop());
|
|
3510
|
+
}
|
|
3511
|
+
pauseAnimation() {
|
|
3512
|
+
eachAxis((e) => this.getAxisMotionValue(e).animation?.pause());
|
|
3513
|
+
}
|
|
3514
|
+
getAnimationState(e) {
|
|
3515
|
+
return this.getAxisMotionValue(e).animation?.state;
|
|
3516
|
+
}
|
|
3517
|
+
getAxisMotionValue(e) {
|
|
3518
|
+
let _ = `_drag${e.toUpperCase()}`, v = this.visualElement.getProps();
|
|
3519
|
+
return v[_] || this.visualElement.getValue(e, (v.initial ? v.initial[e] : void 0) || 0);
|
|
3520
|
+
}
|
|
3521
|
+
snapToCursor(e) {
|
|
3522
|
+
eachAxis((_) => {
|
|
3523
|
+
let { drag: v } = this.getProps();
|
|
3524
|
+
if (!shouldDrag(_, v, this.currentDirection)) return;
|
|
3525
|
+
let { projection: y } = this.visualElement, b = this.getAxisMotionValue(_);
|
|
3526
|
+
if (y && y.layout) {
|
|
3527
|
+
let { min: v, max: x } = y.layout.layoutBox[_];
|
|
3528
|
+
b.set(e[_] - mixNumber(v, x, .5));
|
|
3529
|
+
}
|
|
3530
|
+
});
|
|
3531
|
+
}
|
|
3532
|
+
scalePositionWithinConstraints() {
|
|
3533
|
+
if (!this.visualElement.current) return;
|
|
3534
|
+
let { drag: e, dragConstraints: _ } = this.getProps(), { projection: v } = this.visualElement;
|
|
3535
|
+
if (!isRefObject(_) || !v || !this.constraints) return;
|
|
3536
|
+
this.stopAnimation();
|
|
3537
|
+
let y = {
|
|
3538
|
+
x: 0,
|
|
3539
|
+
y: 0
|
|
3540
|
+
};
|
|
3541
|
+
eachAxis((e) => {
|
|
3542
|
+
let _ = this.getAxisMotionValue(e);
|
|
3543
|
+
if (_ && this.constraints !== !1) {
|
|
3544
|
+
let v = _.get();
|
|
3545
|
+
y[e] = calcOrigin({
|
|
3546
|
+
min: v,
|
|
3547
|
+
max: v
|
|
3548
|
+
}, this.constraints[e]);
|
|
3549
|
+
}
|
|
3550
|
+
});
|
|
3551
|
+
let { transformTemplate: b } = this.visualElement.getProps();
|
|
3552
|
+
this.visualElement.current.style.transform = b ? b({}, "") : "none", v.root && v.root.updateScroll(), v.updateLayout(), this.resolveConstraints(), eachAxis((_) => {
|
|
3553
|
+
if (!shouldDrag(_, e, null)) return;
|
|
3554
|
+
let v = this.getAxisMotionValue(_), { min: b, max: x } = this.constraints[_];
|
|
3555
|
+
v.set(mixNumber(b, x, y[_]));
|
|
3556
|
+
});
|
|
3557
|
+
}
|
|
3558
|
+
addListeners() {
|
|
3559
|
+
if (!this.visualElement.current) return;
|
|
3560
|
+
elementDragControls.set(this.visualElement, this);
|
|
3561
|
+
let e = this.visualElement.current, _ = addPointerEvent(e, "pointerdown", (e) => {
|
|
3562
|
+
let { drag: _, dragListener: v = !0 } = this.getProps();
|
|
3563
|
+
_ && v && this.start(e);
|
|
3564
|
+
}), v = () => {
|
|
3565
|
+
let { dragConstraints: e } = this.getProps();
|
|
3566
|
+
isRefObject(e) && e.current && (this.constraints = this.resolveRefConstraints());
|
|
3567
|
+
}, { projection: y } = this.visualElement, b = y.addEventListener("measure", v);
|
|
3568
|
+
y && !y.layout && (y.root && y.root.updateScroll(), y.updateLayout()), frame.read(v);
|
|
3569
|
+
let x = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints()), S = y.addEventListener("didUpdate", (({ delta: e, hasLayoutChanged: _ }) => {
|
|
3570
|
+
this.isDragging && _ && (eachAxis((_) => {
|
|
3571
|
+
let v = this.getAxisMotionValue(_);
|
|
3572
|
+
v && (this.originPoint[_] += e[_].translate, v.set(v.get() + e[_].translate));
|
|
3573
|
+
}), this.visualElement.render());
|
|
3574
|
+
}));
|
|
3575
|
+
return () => {
|
|
3576
|
+
x(), _(), b(), S && S();
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
getProps() {
|
|
3580
|
+
let e = this.visualElement.getProps(), { drag: _ = !1, dragDirectionLock: v = !1, dragPropagation: y = !1, dragConstraints: b = !1, dragElastic: x = defaultElastic, dragMomentum: S = !0 } = e;
|
|
3581
|
+
return {
|
|
3582
|
+
...e,
|
|
3583
|
+
drag: _,
|
|
3584
|
+
dragDirectionLock: v,
|
|
3585
|
+
dragPropagation: y,
|
|
3586
|
+
dragConstraints: b,
|
|
3587
|
+
dragElastic: x,
|
|
3588
|
+
dragMomentum: S
|
|
3589
|
+
};
|
|
3590
|
+
}
|
|
3591
|
+
};
|
|
3592
|
+
function shouldDrag(e, _, v) {
|
|
3593
|
+
return (_ === !0 || _ === e) && (v === null || v === e);
|
|
3594
|
+
}
|
|
3595
|
+
function getCurrentDirection(e, _ = 10) {
|
|
3596
|
+
let v = null;
|
|
3597
|
+
return Math.abs(e.y) > _ ? v = "y" : Math.abs(e.x) > _ && (v = "x"), v;
|
|
3598
|
+
}
|
|
3599
|
+
var DragGesture = class extends Feature {
|
|
3600
|
+
constructor(e) {
|
|
3601
|
+
super(e), this.removeGroupControls = noop, this.removeListeners = noop, this.controls = new VisualElementDragControls(e);
|
|
3602
|
+
}
|
|
3603
|
+
mount() {
|
|
3604
|
+
let { dragControls: e } = this.node.getProps();
|
|
3605
|
+
e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || noop;
|
|
3606
|
+
}
|
|
3607
|
+
unmount() {
|
|
3608
|
+
this.removeGroupControls(), this.removeListeners();
|
|
3609
|
+
}
|
|
3610
|
+
}, asyncHandler = (e) => (_, v) => {
|
|
3611
|
+
e && frame.postRender(() => e(_, v));
|
|
3612
|
+
}, PanGesture = class extends Feature {
|
|
3613
|
+
constructor() {
|
|
3614
|
+
super(...arguments), this.removePointerDownListener = noop;
|
|
3615
|
+
}
|
|
3616
|
+
onPointerDown(e) {
|
|
3617
|
+
this.session = new PanSession(e, this.createPanHandlers(), {
|
|
3618
|
+
transformPagePoint: this.node.getTransformPagePoint(),
|
|
3619
|
+
contextWindow: getContextWindow(this.node)
|
|
3620
|
+
});
|
|
3621
|
+
}
|
|
3622
|
+
createPanHandlers() {
|
|
3623
|
+
let { onPanSessionStart: e, onPanStart: _, onPan: v, onPanEnd: y } = this.node.getProps();
|
|
3624
|
+
return {
|
|
3625
|
+
onSessionStart: asyncHandler(e),
|
|
3626
|
+
onStart: asyncHandler(_),
|
|
3627
|
+
onMove: v,
|
|
3628
|
+
onEnd: (e, _) => {
|
|
3629
|
+
delete this.session, y && frame.postRender(() => y(e, _));
|
|
3630
|
+
}
|
|
3631
|
+
};
|
|
3632
|
+
}
|
|
3633
|
+
mount() {
|
|
3634
|
+
this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
|
|
3635
|
+
}
|
|
3636
|
+
update() {
|
|
3637
|
+
this.session && this.session.updateHandlers(this.createPanHandlers());
|
|
3638
|
+
}
|
|
3639
|
+
unmount() {
|
|
3640
|
+
this.removePointerDownListener(), this.session && this.session.end();
|
|
3641
|
+
}
|
|
3642
|
+
}, globalProjectionState = {
|
|
3643
|
+
hasAnimatedSinceResize: !0,
|
|
3644
|
+
hasEverUpdated: !1
|
|
3645
|
+
}, hasTakenAnySnapshot = !1, MeasureLayoutWithContext = class extends Component {
|
|
3646
|
+
componentDidMount() {
|
|
3647
|
+
let { visualElement: e, layoutGroup: _, switchLayoutGroup: v, layoutId: y } = this.props, { projection: b } = e;
|
|
3648
|
+
b && (_.group && _.group.add(b), v && v.register && y && v.register(b), hasTakenAnySnapshot && b.root.didUpdate(), b.addEventListener("animationComplete", () => {
|
|
3649
|
+
this.safeToRemove();
|
|
3650
|
+
}), b.setOptions({
|
|
3651
|
+
...b.options,
|
|
3652
|
+
onExitComplete: () => this.safeToRemove()
|
|
3653
|
+
})), globalProjectionState.hasEverUpdated = !0;
|
|
3654
|
+
}
|
|
3655
|
+
getSnapshotBeforeUpdate(e) {
|
|
3656
|
+
let { layoutDependency: _, visualElement: v, drag: y, isPresent: b } = this.props, { projection: x } = v;
|
|
3657
|
+
return x ? (x.isPresent = b, hasTakenAnySnapshot = !0, y || e.layoutDependency !== _ || _ === void 0 || e.isPresent !== b ? x.willUpdate() : this.safeToRemove(), e.isPresent !== b && (b ? x.promote() : x.relegate() || frame.postRender(() => {
|
|
3658
|
+
let e = x.getStack();
|
|
3659
|
+
(!e || !e.members.length) && this.safeToRemove();
|
|
3660
|
+
})), null) : null;
|
|
3661
|
+
}
|
|
3662
|
+
componentDidUpdate() {
|
|
3663
|
+
let { projection: e } = this.props.visualElement;
|
|
3664
|
+
e && (e.root.didUpdate(), microtask.postRender(() => {
|
|
3665
|
+
!e.currentAnimation && e.isLead() && this.safeToRemove();
|
|
3666
|
+
}));
|
|
3667
|
+
}
|
|
3668
|
+
componentWillUnmount() {
|
|
3669
|
+
let { visualElement: e, layoutGroup: _, switchLayoutGroup: v } = this.props, { projection: y } = e;
|
|
3670
|
+
hasTakenAnySnapshot = !0, y && (y.scheduleCheckAfterUnmount(), _ && _.group && _.group.remove(y), v && v.deregister && v.deregister(y));
|
|
3671
|
+
}
|
|
3672
|
+
safeToRemove() {
|
|
3673
|
+
let { safeToRemove: e } = this.props;
|
|
3674
|
+
e && e();
|
|
3675
|
+
}
|
|
3676
|
+
render() {
|
|
3677
|
+
return null;
|
|
3678
|
+
}
|
|
3679
|
+
};
|
|
3680
|
+
function MeasureLayout(e) {
|
|
3681
|
+
let [_, v] = usePresence(), y = useContext(LayoutGroupContext);
|
|
3682
|
+
return (0, import_jsx_runtime.jsx)(MeasureLayoutWithContext, {
|
|
3683
|
+
...e,
|
|
3684
|
+
layoutGroup: y,
|
|
3685
|
+
switchLayoutGroup: useContext(SwitchLayoutGroupContext),
|
|
3686
|
+
isPresent: _,
|
|
3687
|
+
safeToRemove: v
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
function animateSingleValue(e, _, v) {
|
|
3691
|
+
let y = isMotionValue(e) ? e : motionValue(e);
|
|
3692
|
+
return y.start(animateMotionValue("", y, _, v)), y.animation;
|
|
3693
|
+
}
|
|
3694
|
+
var compareByDepth = (e, _) => e.depth - _.depth, FlatTree = class {
|
|
3695
|
+
constructor() {
|
|
3696
|
+
this.children = [], this.isDirty = !1;
|
|
3697
|
+
}
|
|
3698
|
+
add(e) {
|
|
3699
|
+
addUniqueItem(this.children, e), this.isDirty = !0;
|
|
3700
|
+
}
|
|
3701
|
+
remove(e) {
|
|
3702
|
+
removeItem(this.children, e), this.isDirty = !0;
|
|
3703
|
+
}
|
|
3704
|
+
forEach(e) {
|
|
3705
|
+
this.isDirty && this.children.sort(compareByDepth), this.isDirty = !1, this.children.forEach(e);
|
|
3706
|
+
}
|
|
3707
|
+
};
|
|
3708
|
+
function delay(e, _) {
|
|
3709
|
+
let v = time.now(), y = ({ timestamp: b }) => {
|
|
3710
|
+
let x = b - v;
|
|
3711
|
+
x >= _ && (cancelFrame(y), e(x - _));
|
|
3712
|
+
};
|
|
3713
|
+
return frame.setup(y, !0), () => cancelFrame(y);
|
|
3714
|
+
}
|
|
3715
|
+
var borders = [
|
|
3716
|
+
"TopLeft",
|
|
3717
|
+
"TopRight",
|
|
3718
|
+
"BottomLeft",
|
|
3719
|
+
"BottomRight"
|
|
3720
|
+
], numBorders = borders.length, asNumber = (e) => typeof e == "string" ? parseFloat(e) : e, isPx = (e) => typeof e == "number" || px.test(e);
|
|
3721
|
+
function mixValues(e, _, v, y, b, x) {
|
|
3722
|
+
b ? (e.opacity = mixNumber(0, v.opacity ?? 1, easeCrossfadeIn(y)), e.opacityExit = mixNumber(_.opacity ?? 1, 0, easeCrossfadeOut(y))) : x && (e.opacity = mixNumber(_.opacity ?? 1, v.opacity ?? 1, y));
|
|
3723
|
+
for (let b = 0; b < numBorders; b++) {
|
|
3724
|
+
let x = `border${borders[b]}Radius`, S = getRadius(_, x), C = getRadius(v, x);
|
|
3725
|
+
S === void 0 && C === void 0 || (S ||= 0, C ||= 0, S === 0 || C === 0 || isPx(S) === isPx(C) ? (e[x] = Math.max(mixNumber(asNumber(S), asNumber(C), y), 0), (percent.test(C) || percent.test(S)) && (e[x] += "%")) : e[x] = C);
|
|
3726
|
+
}
|
|
3727
|
+
(_.rotate || v.rotate) && (e.rotate = mixNumber(_.rotate || 0, v.rotate || 0, y));
|
|
3728
|
+
}
|
|
3729
|
+
function getRadius(e, _) {
|
|
3730
|
+
return e[_] === void 0 ? e.borderRadius : e[_];
|
|
3731
|
+
}
|
|
3732
|
+
var easeCrossfadeIn = /* @__PURE__ */ compress(0, .5, circOut), easeCrossfadeOut = /* @__PURE__ */ compress(.5, .95, noop);
|
|
3733
|
+
function compress(e, _, v) {
|
|
3734
|
+
return (y) => y < e ? 0 : y > _ ? 1 : v(/* @__PURE__ */ progress(e, _, y));
|
|
3735
|
+
}
|
|
3736
|
+
function copyAxisInto(e, _) {
|
|
3737
|
+
e.min = _.min, e.max = _.max;
|
|
3738
|
+
}
|
|
3739
|
+
function copyBoxInto(e, _) {
|
|
3740
|
+
copyAxisInto(e.x, _.x), copyAxisInto(e.y, _.y);
|
|
3741
|
+
}
|
|
3742
|
+
function copyAxisDeltaInto(e, _) {
|
|
3743
|
+
e.translate = _.translate, e.scale = _.scale, e.originPoint = _.originPoint, e.origin = _.origin;
|
|
3744
|
+
}
|
|
3745
|
+
function removePointDelta(e, _, v, y, b) {
|
|
3746
|
+
return e -= _, e = scalePoint(e, 1 / v, y), b !== void 0 && (e = scalePoint(e, 1 / b, y)), e;
|
|
3747
|
+
}
|
|
3748
|
+
function removeAxisDelta(e, _ = 0, v = 1, y = .5, b, x = e, S = e) {
|
|
3749
|
+
if (percent.test(_) && (_ = parseFloat(_), _ = mixNumber(S.min, S.max, _ / 100) - S.min), typeof _ != "number") return;
|
|
3750
|
+
let C = mixNumber(x.min, x.max, y);
|
|
3751
|
+
e === x && (C -= _), e.min = removePointDelta(e.min, _, v, C, b), e.max = removePointDelta(e.max, _, v, C, b);
|
|
3752
|
+
}
|
|
3753
|
+
function removeAxisTransforms(e, _, [v, y, b], x, S) {
|
|
3754
|
+
removeAxisDelta(e, _[v], _[y], _[b], _.scale, x, S);
|
|
3755
|
+
}
|
|
3756
|
+
var xKeys = [
|
|
3757
|
+
"x",
|
|
3758
|
+
"scaleX",
|
|
3759
|
+
"originX"
|
|
3760
|
+
], yKeys = [
|
|
3761
|
+
"y",
|
|
3762
|
+
"scaleY",
|
|
3763
|
+
"originY"
|
|
3764
|
+
];
|
|
3765
|
+
function removeBoxTransforms(e, _, v, y) {
|
|
3766
|
+
removeAxisTransforms(e.x, _, xKeys, v ? v.x : void 0, y ? y.x : void 0), removeAxisTransforms(e.y, _, yKeys, v ? v.y : void 0, y ? y.y : void 0);
|
|
3767
|
+
}
|
|
3768
|
+
function isAxisDeltaZero(e) {
|
|
3769
|
+
return e.translate === 0 && e.scale === 1;
|
|
3770
|
+
}
|
|
3771
|
+
function isDeltaZero(e) {
|
|
3772
|
+
return isAxisDeltaZero(e.x) && isAxisDeltaZero(e.y);
|
|
3773
|
+
}
|
|
3774
|
+
function axisEquals(e, _) {
|
|
3775
|
+
return e.min === _.min && e.max === _.max;
|
|
3776
|
+
}
|
|
3777
|
+
function boxEquals(e, _) {
|
|
3778
|
+
return axisEquals(e.x, _.x) && axisEquals(e.y, _.y);
|
|
3779
|
+
}
|
|
3780
|
+
function axisEqualsRounded(e, _) {
|
|
3781
|
+
return Math.round(e.min) === Math.round(_.min) && Math.round(e.max) === Math.round(_.max);
|
|
3782
|
+
}
|
|
3783
|
+
function boxEqualsRounded(e, _) {
|
|
3784
|
+
return axisEqualsRounded(e.x, _.x) && axisEqualsRounded(e.y, _.y);
|
|
3785
|
+
}
|
|
3786
|
+
function aspectRatio(e) {
|
|
3787
|
+
return calcLength(e.x) / calcLength(e.y);
|
|
3788
|
+
}
|
|
3789
|
+
function axisDeltaEquals(e, _) {
|
|
3790
|
+
return e.translate === _.translate && e.scale === _.scale && e.originPoint === _.originPoint;
|
|
3791
|
+
}
|
|
3792
|
+
var NodeStack = class {
|
|
3793
|
+
constructor() {
|
|
3794
|
+
this.members = [];
|
|
3795
|
+
}
|
|
3796
|
+
add(e) {
|
|
3797
|
+
addUniqueItem(this.members, e), e.scheduleRender();
|
|
3798
|
+
}
|
|
3799
|
+
remove(e) {
|
|
3800
|
+
if (removeItem(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
|
|
3801
|
+
let e = this.members[this.members.length - 1];
|
|
3802
|
+
e && this.promote(e);
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
relegate(e) {
|
|
3806
|
+
let _ = this.members.findIndex((_) => e === _);
|
|
3807
|
+
if (_ === 0) return !1;
|
|
3808
|
+
let v;
|
|
3809
|
+
for (let e = _; e >= 0; e--) {
|
|
3810
|
+
let _ = this.members[e];
|
|
3811
|
+
if (_.isPresent !== !1) {
|
|
3812
|
+
v = _;
|
|
3813
|
+
break;
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
return v ? (this.promote(v), !0) : !1;
|
|
3817
|
+
}
|
|
3818
|
+
promote(e, _) {
|
|
3819
|
+
let v = this.lead;
|
|
3820
|
+
if (e !== v && (this.prevLead = v, this.lead = e, e.show(), v)) {
|
|
3821
|
+
v.instance && v.scheduleRender(), e.scheduleRender(), e.resumeFrom = v, _ && (e.resumeFrom.preserveOpacity = !0), v.snapshot && (e.snapshot = v.snapshot, e.snapshot.latestValues = v.animationValues || v.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
|
|
3822
|
+
let { crossfade: y } = e.options;
|
|
3823
|
+
y === !1 && v.hide();
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
exitAnimationComplete() {
|
|
3827
|
+
this.members.forEach((e) => {
|
|
3828
|
+
let { options: _, resumingFrom: v } = e;
|
|
3829
|
+
_.onExitComplete && _.onExitComplete(), v && v.options.onExitComplete && v.options.onExitComplete();
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3832
|
+
scheduleRender() {
|
|
3833
|
+
this.members.forEach((e) => {
|
|
3834
|
+
e.instance && e.scheduleRender(!1);
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3837
|
+
removeLeadSnapshot() {
|
|
3838
|
+
this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
|
|
3839
|
+
}
|
|
3840
|
+
};
|
|
3841
|
+
function buildProjectionTransform(e, _, v) {
|
|
3842
|
+
let y = "", b = e.x.translate / _.x, x = e.y.translate / _.y, S = v?.z || 0;
|
|
3843
|
+
if ((b || x || S) && (y = `translate3d(${b}px, ${x}px, ${S}px) `), (_.x !== 1 || _.y !== 1) && (y += `scale(${1 / _.x}, ${1 / _.y}) `), v) {
|
|
3844
|
+
let { transformPerspective: e, rotate: _, rotateX: b, rotateY: x, skewX: S, skewY: C } = v;
|
|
3845
|
+
e && (y = `perspective(${e}px) ${y}`), _ && (y += `rotate(${_}deg) `), b && (y += `rotateX(${b}deg) `), x && (y += `rotateY(${x}deg) `), S && (y += `skewX(${S}deg) `), C && (y += `skewY(${C}deg) `);
|
|
3846
|
+
}
|
|
3847
|
+
let C = e.x.scale * _.x, w = e.y.scale * _.y;
|
|
3848
|
+
return (C !== 1 || w !== 1) && (y += `scale(${C}, ${w})`), y || "none";
|
|
3849
|
+
}
|
|
3850
|
+
var metrics = {
|
|
3851
|
+
nodes: 0,
|
|
3852
|
+
calculatedTargetDeltas: 0,
|
|
3853
|
+
calculatedProjections: 0
|
|
3854
|
+
}, transformAxes = [
|
|
3855
|
+
"",
|
|
3856
|
+
"X",
|
|
3857
|
+
"Y",
|
|
3858
|
+
"Z"
|
|
3859
|
+
], animationTarget = 1e3, id = 0;
|
|
3860
|
+
function resetDistortingTransform(e, _, v, y) {
|
|
3861
|
+
let { latestValues: b } = _;
|
|
3862
|
+
b[e] && (v[e] = b[e], _.setStaticValue(e, 0), y && (y[e] = 0));
|
|
3863
|
+
}
|
|
3864
|
+
function cancelTreeOptimisedTransformAnimations(e) {
|
|
3865
|
+
if (e.hasCheckedOptimisedAppear = !0, e.root === e) return;
|
|
3866
|
+
let { visualElement: _ } = e.options;
|
|
3867
|
+
if (!_) return;
|
|
3868
|
+
let v = getOptimisedAppearId(_);
|
|
3869
|
+
if (window.MotionHasOptimisedAnimation(v, "transform")) {
|
|
3870
|
+
let { layout: _, layoutId: y } = e.options;
|
|
3871
|
+
window.MotionCancelOptimisedAnimation(v, "transform", frame, !(_ || y));
|
|
3872
|
+
}
|
|
3873
|
+
let { parent: y } = e;
|
|
3874
|
+
y && !y.hasCheckedOptimisedAppear && cancelTreeOptimisedTransformAnimations(y);
|
|
3875
|
+
}
|
|
3876
|
+
function createProjectionNode({ attachResizeListener: e, defaultParent: _, measureScroll: v, checkIsScrollRoot: y, resetTransform: b }) {
|
|
3877
|
+
return class {
|
|
3878
|
+
constructor(e = {}, v = _?.()) {
|
|
3879
|
+
this.id = id++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = {
|
|
3880
|
+
x: 1,
|
|
3881
|
+
y: 1
|
|
3882
|
+
}, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
|
|
3883
|
+
this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
|
|
3884
|
+
}, this.updateProjection = () => {
|
|
3885
|
+
this.projectionUpdateScheduled = !1, statsBuffer.value && (metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0), this.nodes.forEach(propagateDirtyNodes), this.nodes.forEach(resolveTargetDelta), this.nodes.forEach(calcProjection), this.nodes.forEach(cleanDirtyNodes), statsBuffer.addProjectionMetrics && statsBuffer.addProjectionMetrics(metrics);
|
|
3886
|
+
}, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = e, this.root = v ? v.root || v : this, this.path = v ? [...v.path, v] : [], this.parent = v, this.depth = v ? v.depth + 1 : 0;
|
|
3887
|
+
for (let e = 0; e < this.path.length; e++) this.path[e].shouldResetTransform = !0;
|
|
3888
|
+
this.root === this && (this.nodes = new FlatTree());
|
|
3889
|
+
}
|
|
3890
|
+
addEventListener(e, _) {
|
|
3891
|
+
return this.eventHandlers.has(e) || this.eventHandlers.set(e, new SubscriptionManager()), this.eventHandlers.get(e).add(_);
|
|
3892
|
+
}
|
|
3893
|
+
notifyListeners(e, ..._) {
|
|
3894
|
+
let v = this.eventHandlers.get(e);
|
|
3895
|
+
v && v.notify(..._);
|
|
3896
|
+
}
|
|
3897
|
+
hasListeners(e) {
|
|
3898
|
+
return this.eventHandlers.has(e);
|
|
3899
|
+
}
|
|
3900
|
+
mount(_) {
|
|
3901
|
+
if (this.instance) return;
|
|
3902
|
+
this.isSVG = isSVGElement(_) && !isSVGSVGElement(_), this.instance = _;
|
|
3903
|
+
let { layoutId: v, layout: y, visualElement: b } = this.options;
|
|
3904
|
+
if (b && !b.current && b.mount(_), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (y || v) && (this.isLayoutDirty = !0), e) {
|
|
3905
|
+
let v, y = 0, b = () => this.root.updateBlockedByResize = !1;
|
|
3906
|
+
frame.read(() => {
|
|
3907
|
+
y = window.innerWidth;
|
|
3908
|
+
}), e(_, () => {
|
|
3909
|
+
let e = window.innerWidth;
|
|
3910
|
+
e !== y && (y = e, this.root.updateBlockedByResize = !0, v && v(), v = delay(b, 250), globalProjectionState.hasAnimatedSinceResize && (globalProjectionState.hasAnimatedSinceResize = !1, this.nodes.forEach(finishAnimation)));
|
|
3911
|
+
});
|
|
3912
|
+
}
|
|
3913
|
+
v && this.root.registerSharedNode(v, this), this.options.animate !== !1 && b && (v || y) && this.addEventListener("didUpdate", ({ delta: e, hasLayoutChanged: _, hasRelativeLayoutChanged: v, layout: y }) => {
|
|
3914
|
+
if (this.isTreeAnimationBlocked()) {
|
|
3915
|
+
this.target = void 0, this.relativeTarget = void 0;
|
|
3916
|
+
return;
|
|
3917
|
+
}
|
|
3918
|
+
let x = this.options.transition || b.getDefaultTransition() || defaultLayoutTransition, { onLayoutAnimationStart: S, onLayoutAnimationComplete: C } = b.getProps(), w = !this.targetLayout || !boxEqualsRounded(this.targetLayout, y), T = !_ && v;
|
|
3919
|
+
if (this.options.layoutRoot || this.resumeFrom || T || _ && (w || !this.currentAnimation)) {
|
|
3920
|
+
this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
|
|
3921
|
+
let _ = {
|
|
3922
|
+
...getValueTransition(x, "layout"),
|
|
3923
|
+
onPlay: S,
|
|
3924
|
+
onComplete: C
|
|
3925
|
+
};
|
|
3926
|
+
(b.shouldReduceMotion || this.options.layoutRoot) && (_.delay = 0, _.type = !1), this.startAnimation(_), this.setAnimationOrigin(e, T);
|
|
3927
|
+
} else _ || finishAnimation(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
|
|
3928
|
+
this.targetLayout = y;
|
|
3929
|
+
});
|
|
3930
|
+
}
|
|
3931
|
+
unmount() {
|
|
3932
|
+
this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
|
|
3933
|
+
let e = this.getStack();
|
|
3934
|
+
e && e.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), cancelFrame(this.updateProjection);
|
|
3935
|
+
}
|
|
3936
|
+
blockUpdate() {
|
|
3937
|
+
this.updateManuallyBlocked = !0;
|
|
3938
|
+
}
|
|
3939
|
+
unblockUpdate() {
|
|
3940
|
+
this.updateManuallyBlocked = !1;
|
|
3941
|
+
}
|
|
3942
|
+
isUpdateBlocked() {
|
|
3943
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
3944
|
+
}
|
|
3945
|
+
isTreeAnimationBlocked() {
|
|
3946
|
+
return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
|
|
3947
|
+
}
|
|
3948
|
+
startUpdate() {
|
|
3949
|
+
this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(resetSkewAndRotation), this.animationId++);
|
|
3950
|
+
}
|
|
3951
|
+
getTransformTemplate() {
|
|
3952
|
+
let { visualElement: e } = this.options;
|
|
3953
|
+
return e && e.getProps().transformTemplate;
|
|
3954
|
+
}
|
|
3955
|
+
willUpdate(e = !0) {
|
|
3956
|
+
if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
|
|
3957
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
3958
|
+
return;
|
|
3959
|
+
}
|
|
3960
|
+
if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && cancelTreeOptimisedTransformAnimations(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return;
|
|
3961
|
+
this.isLayoutDirty = !0;
|
|
3962
|
+
for (let e = 0; e < this.path.length; e++) {
|
|
3963
|
+
let _ = this.path[e];
|
|
3964
|
+
_.shouldResetTransform = !0, _.updateScroll("snapshot"), _.options.layoutRoot && _.willUpdate(!1);
|
|
3965
|
+
}
|
|
3966
|
+
let { layoutId: _, layout: v } = this.options;
|
|
3967
|
+
if (_ === void 0 && !v) return;
|
|
3968
|
+
let y = this.getTransformTemplate();
|
|
3969
|
+
this.prevTransformTemplateValue = y ? y(this.latestValues, "") : void 0, this.updateSnapshot(), e && this.notifyListeners("willUpdate");
|
|
3970
|
+
}
|
|
3971
|
+
update() {
|
|
3972
|
+
if (this.updateScheduled = !1, this.isUpdateBlocked()) {
|
|
3973
|
+
this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(clearMeasurements);
|
|
3974
|
+
return;
|
|
3975
|
+
}
|
|
3976
|
+
if (this.animationId <= this.animationCommitId) {
|
|
3977
|
+
this.nodes.forEach(clearIsLayoutDirty);
|
|
3978
|
+
return;
|
|
3979
|
+
}
|
|
3980
|
+
this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(resetTransformStyle), this.nodes.forEach(updateLayout), this.nodes.forEach(notifyLayoutUpdate)) : this.nodes.forEach(clearIsLayoutDirty), this.clearAllSnapshots();
|
|
3981
|
+
let e = time.now();
|
|
3982
|
+
frameData.delta = clamp(0, 1e3 / 60, e - frameData.timestamp), frameData.timestamp = e, frameData.isProcessing = !0, frameSteps.update.process(frameData), frameSteps.preRender.process(frameData), frameSteps.render.process(frameData), frameData.isProcessing = !1;
|
|
3983
|
+
}
|
|
3984
|
+
didUpdate() {
|
|
3985
|
+
this.updateScheduled || (this.updateScheduled = !0, microtask.read(this.scheduleUpdate));
|
|
3986
|
+
}
|
|
3987
|
+
clearAllSnapshots() {
|
|
3988
|
+
this.nodes.forEach(clearSnapshot), this.sharedNodes.forEach(removeLeadSnapshots);
|
|
3989
|
+
}
|
|
3990
|
+
scheduleUpdateProjection() {
|
|
3991
|
+
this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, frame.preRender(this.updateProjection, !1, !0));
|
|
3992
|
+
}
|
|
3993
|
+
scheduleCheckAfterUnmount() {
|
|
3994
|
+
frame.postRender(() => {
|
|
3995
|
+
this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
|
|
3996
|
+
});
|
|
3997
|
+
}
|
|
3998
|
+
updateSnapshot() {
|
|
3999
|
+
this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !calcLength(this.snapshot.measuredBox.x) && !calcLength(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
|
|
4000
|
+
}
|
|
4001
|
+
updateLayout() {
|
|
4002
|
+
if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty)) return;
|
|
4003
|
+
if (this.resumeFrom && !this.resumeFrom.instance) for (let e = 0; e < this.path.length; e++) this.path[e].updateScroll();
|
|
4004
|
+
let e = this.layout;
|
|
4005
|
+
this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected = createBox(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
|
|
4006
|
+
let { visualElement: _ } = this.options;
|
|
4007
|
+
_ && _.notify("LayoutMeasure", this.layout.layoutBox, e ? e.layoutBox : void 0);
|
|
4008
|
+
}
|
|
4009
|
+
updateScroll(e = "measure") {
|
|
4010
|
+
let _ = !!(this.options.layoutScroll && this.instance);
|
|
4011
|
+
if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === e && (_ = !1), _ && this.instance) {
|
|
4012
|
+
let _ = y(this.instance);
|
|
4013
|
+
this.scroll = {
|
|
4014
|
+
animationId: this.root.animationId,
|
|
4015
|
+
phase: e,
|
|
4016
|
+
isRoot: _,
|
|
4017
|
+
offset: v(this.instance),
|
|
4018
|
+
wasRoot: this.scroll ? this.scroll.isRoot : _
|
|
4019
|
+
};
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
resetTransform() {
|
|
4023
|
+
if (!b) return;
|
|
4024
|
+
let e = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, _ = this.projectionDelta && !isDeltaZero(this.projectionDelta), v = this.getTransformTemplate(), y = v ? v(this.latestValues, "") : void 0, x = y !== this.prevTransformTemplateValue;
|
|
4025
|
+
e && this.instance && (_ || hasTransform(this.latestValues) || x) && (b(this.instance, y), this.shouldResetTransform = !1, this.scheduleRender());
|
|
4026
|
+
}
|
|
4027
|
+
measure(e = !0) {
|
|
4028
|
+
let _ = this.measurePageBox(), v = this.removeElementScroll(_);
|
|
4029
|
+
return e && (v = this.removeTransform(v)), roundBox(v), {
|
|
4030
|
+
animationId: this.root.animationId,
|
|
4031
|
+
measuredBox: _,
|
|
4032
|
+
layoutBox: v,
|
|
4033
|
+
latestValues: {},
|
|
4034
|
+
source: this.id
|
|
4035
|
+
};
|
|
4036
|
+
}
|
|
4037
|
+
measurePageBox() {
|
|
4038
|
+
let { visualElement: e } = this.options;
|
|
4039
|
+
if (!e) return createBox();
|
|
4040
|
+
let _ = e.measureViewportBox();
|
|
4041
|
+
if (!(this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot))) {
|
|
4042
|
+
let { scroll: e } = this.root;
|
|
4043
|
+
e && (translateAxis(_.x, e.offset.x), translateAxis(_.y, e.offset.y));
|
|
4044
|
+
}
|
|
4045
|
+
return _;
|
|
4046
|
+
}
|
|
4047
|
+
removeElementScroll(e) {
|
|
4048
|
+
let _ = createBox();
|
|
4049
|
+
if (copyBoxInto(_, e), this.scroll?.wasRoot) return _;
|
|
4050
|
+
for (let v = 0; v < this.path.length; v++) {
|
|
4051
|
+
let y = this.path[v], { scroll: b, options: x } = y;
|
|
4052
|
+
y !== this.root && b && x.layoutScroll && (b.wasRoot && copyBoxInto(_, e), translateAxis(_.x, b.offset.x), translateAxis(_.y, b.offset.y));
|
|
4053
|
+
}
|
|
4054
|
+
return _;
|
|
4055
|
+
}
|
|
4056
|
+
applyTransform(e, _ = !1) {
|
|
4057
|
+
let v = createBox();
|
|
4058
|
+
copyBoxInto(v, e);
|
|
4059
|
+
for (let e = 0; e < this.path.length; e++) {
|
|
4060
|
+
let y = this.path[e];
|
|
4061
|
+
!_ && y.options.layoutScroll && y.scroll && y !== y.root && transformBox(v, {
|
|
4062
|
+
x: -y.scroll.offset.x,
|
|
4063
|
+
y: -y.scroll.offset.y
|
|
4064
|
+
}), hasTransform(y.latestValues) && transformBox(v, y.latestValues);
|
|
4065
|
+
}
|
|
4066
|
+
return hasTransform(this.latestValues) && transformBox(v, this.latestValues), v;
|
|
4067
|
+
}
|
|
4068
|
+
removeTransform(e) {
|
|
4069
|
+
let _ = createBox();
|
|
4070
|
+
copyBoxInto(_, e);
|
|
4071
|
+
for (let e = 0; e < this.path.length; e++) {
|
|
4072
|
+
let v = this.path[e];
|
|
4073
|
+
if (!v.instance || !hasTransform(v.latestValues)) continue;
|
|
4074
|
+
hasScale(v.latestValues) && v.updateSnapshot();
|
|
4075
|
+
let y = createBox();
|
|
4076
|
+
copyBoxInto(y, v.measurePageBox()), removeBoxTransforms(_, v.latestValues, v.snapshot ? v.snapshot.layoutBox : void 0, y);
|
|
4077
|
+
}
|
|
4078
|
+
return hasTransform(this.latestValues) && removeBoxTransforms(_, this.latestValues), _;
|
|
4079
|
+
}
|
|
4080
|
+
setTargetDelta(e) {
|
|
4081
|
+
this.targetDelta = e, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
|
|
4082
|
+
}
|
|
4083
|
+
setOptions(e) {
|
|
4084
|
+
this.options = {
|
|
4085
|
+
...this.options,
|
|
4086
|
+
...e,
|
|
4087
|
+
crossfade: e.crossfade === void 0 ? !0 : e.crossfade
|
|
4088
|
+
};
|
|
4089
|
+
}
|
|
4090
|
+
clearMeasurements() {
|
|
4091
|
+
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;
|
|
4092
|
+
}
|
|
4093
|
+
forceRelativeParentToResolveTarget() {
|
|
4094
|
+
this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp && this.relativeParent.resolveTargetDelta(!0);
|
|
4095
|
+
}
|
|
4096
|
+
resolveTargetDelta(e = !1) {
|
|
4097
|
+
let _ = this.getLead();
|
|
4098
|
+
this.isProjectionDirty ||= _.isProjectionDirty, this.isTransformDirty ||= _.isTransformDirty, this.isSharedProjectionDirty ||= _.isSharedProjectionDirty;
|
|
4099
|
+
let v = !!this.resumingFrom || this !== _;
|
|
4100
|
+
if (!(e || v && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) return;
|
|
4101
|
+
let { layout: y, layoutId: b } = this.options;
|
|
4102
|
+
if (!this.layout || !(y || b)) return;
|
|
4103
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
4104
|
+
let x = this.getClosestProjectingParent();
|
|
4105
|
+
x && this.linkedParentVersion !== x.layoutVersion && !x.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (x && x.layout ? this.createRelativeTarget(x, this.layout.layoutBox, x.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = createBox(), this.targetWithTransforms = createBox()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : copyBoxInto(this.target, this.layout.layoutBox), applyBoxDelta(this.target, this.targetDelta)) : copyBoxInto(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, x && !!x.resumingFrom == !!this.resumingFrom && !x.options.layoutScroll && x.target && this.animationProgress !== 1 ? this.createRelativeTarget(x, this.target, x.target) : this.relativeParent = this.relativeTarget = void 0), statsBuffer.value && metrics.calculatedTargetDeltas++);
|
|
4106
|
+
}
|
|
4107
|
+
getClosestProjectingParent() {
|
|
4108
|
+
if (!(!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
|
|
4109
|
+
}
|
|
4110
|
+
isProjecting() {
|
|
4111
|
+
return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
4112
|
+
}
|
|
4113
|
+
createRelativeTarget(e, _, v) {
|
|
4114
|
+
this.relativeParent = e, this.linkedParentVersion = e.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = createBox(), this.relativeTargetOrigin = createBox(), calcRelativePosition(this.relativeTargetOrigin, _, v), copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
4115
|
+
}
|
|
4116
|
+
removeRelativeTarget() {
|
|
4117
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
4118
|
+
}
|
|
4119
|
+
calcProjection() {
|
|
4120
|
+
let e = this.getLead(), _ = !!this.resumingFrom || this !== e, v = !0;
|
|
4121
|
+
if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (v = !1), _ && (this.isSharedProjectionDirty || this.isTransformDirty) && (v = !1), this.resolvedRelativeTargetAt === frameData.timestamp && (v = !1), v) return;
|
|
4122
|
+
let { layout: y, layoutId: b } = this.options;
|
|
4123
|
+
if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(y || b)) return;
|
|
4124
|
+
copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
|
|
4125
|
+
let x = this.treeScale.x, S = this.treeScale.y;
|
|
4126
|
+
applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, _), e.layout && !e.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (e.target = e.layout.layoutBox, e.targetWithTransforms = createBox());
|
|
4127
|
+
let { target: C } = e;
|
|
4128
|
+
if (!C) {
|
|
4129
|
+
this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
|
|
4130
|
+
return;
|
|
4131
|
+
}
|
|
4132
|
+
!this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x), copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y)), calcBoxDelta(this.projectionDelta, this.layoutCorrected, C, this.latestValues), (this.treeScale.x !== x || this.treeScale.y !== S || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", C)), statsBuffer.value && metrics.calculatedProjections++;
|
|
4133
|
+
}
|
|
4134
|
+
hide() {
|
|
4135
|
+
this.isVisible = !1;
|
|
4136
|
+
}
|
|
4137
|
+
show() {
|
|
4138
|
+
this.isVisible = !0;
|
|
4139
|
+
}
|
|
4140
|
+
scheduleRender(e = !0) {
|
|
4141
|
+
if (this.options.visualElement?.scheduleRender(), e) {
|
|
4142
|
+
let e = this.getStack();
|
|
4143
|
+
e && e.scheduleRender();
|
|
4144
|
+
}
|
|
4145
|
+
this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
|
|
4146
|
+
}
|
|
4147
|
+
createProjectionDeltas() {
|
|
4148
|
+
this.prevProjectionDelta = createDelta(), this.projectionDelta = createDelta(), this.projectionDeltaWithTransform = createDelta();
|
|
4149
|
+
}
|
|
4150
|
+
setAnimationOrigin(e, _ = !1) {
|
|
4151
|
+
let v = this.snapshot, y = v ? v.latestValues : {}, b = { ...this.latestValues }, x = createDelta();
|
|
4152
|
+
(!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !_;
|
|
4153
|
+
let S = createBox(), C = (v ? v.source : void 0) !== (this.layout ? this.layout.source : void 0), w = this.getStack(), T = !w || w.members.length <= 1, E = !!(C && !T && this.options.crossfade === !0 && !this.path.some(hasOpacityCrossfade));
|
|
4154
|
+
this.animationProgress = 0;
|
|
4155
|
+
let D;
|
|
4156
|
+
this.mixTargetDelta = (_) => {
|
|
4157
|
+
let v = _ / 1e3;
|
|
4158
|
+
mixAxisDelta(x.x, e.x, v), mixAxisDelta(x.y, e.y, v), this.setTargetDelta(x), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (calcRelativePosition(S, this.layout.layoutBox, this.relativeParent.layout.layoutBox), mixBox(this.relativeTarget, this.relativeTargetOrigin, S, v), D && boxEquals(this.relativeTarget, D) && (this.isProjectionDirty = !1), D ||= createBox(), copyBoxInto(D, this.relativeTarget)), C && (this.animationValues = b, mixValues(b, y, this.latestValues, v, E, T)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = v;
|
|
4159
|
+
}, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
4160
|
+
}
|
|
4161
|
+
startAnimation(e) {
|
|
4162
|
+
this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation &&= (cancelFrame(this.pendingAnimation), void 0), this.pendingAnimation = frame.update(() => {
|
|
4163
|
+
globalProjectionState.hasAnimatedSinceResize = !0, activeAnimations.layout++, this.motionValue ||= motionValue(0), this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], {
|
|
4164
|
+
...e,
|
|
4165
|
+
velocity: 0,
|
|
4166
|
+
isSync: !0,
|
|
4167
|
+
onUpdate: (_) => {
|
|
4168
|
+
this.mixTargetDelta(_), e.onUpdate && e.onUpdate(_);
|
|
4169
|
+
},
|
|
4170
|
+
onStop: () => {
|
|
4171
|
+
activeAnimations.layout--;
|
|
4172
|
+
},
|
|
4173
|
+
onComplete: () => {
|
|
4174
|
+
activeAnimations.layout--, e.onComplete && e.onComplete(), this.completeAnimation();
|
|
4175
|
+
}
|
|
4176
|
+
}), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
completeAnimation() {
|
|
4180
|
+
this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
|
|
4181
|
+
let e = this.getStack();
|
|
4182
|
+
e && e.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
|
|
4183
|
+
}
|
|
4184
|
+
finishAnimation() {
|
|
4185
|
+
this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(animationTarget), this.currentAnimation.stop()), this.completeAnimation();
|
|
4186
|
+
}
|
|
4187
|
+
applyTransformsToTarget() {
|
|
4188
|
+
let e = this.getLead(), { targetWithTransforms: _, target: v, layout: y, latestValues: b } = e;
|
|
4189
|
+
if (!(!_ || !v || !y)) {
|
|
4190
|
+
if (this !== e && this.layout && y && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, y.layoutBox)) {
|
|
4191
|
+
v = this.target || createBox();
|
|
4192
|
+
let _ = calcLength(this.layout.layoutBox.x);
|
|
4193
|
+
v.x.min = e.target.x.min, v.x.max = v.x.min + _;
|
|
4194
|
+
let y = calcLength(this.layout.layoutBox.y);
|
|
4195
|
+
v.y.min = e.target.y.min, v.y.max = v.y.min + y;
|
|
4196
|
+
}
|
|
4197
|
+
copyBoxInto(_, v), transformBox(_, b), calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, _, b);
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
registerSharedNode(e, _) {
|
|
4201
|
+
this.sharedNodes.has(e) || this.sharedNodes.set(e, new NodeStack()), this.sharedNodes.get(e).add(_);
|
|
4202
|
+
let v = _.options.initialPromotionConfig;
|
|
4203
|
+
_.promote({
|
|
4204
|
+
transition: v ? v.transition : void 0,
|
|
4205
|
+
preserveFollowOpacity: v && v.shouldPreserveFollowOpacity ? v.shouldPreserveFollowOpacity(_) : void 0
|
|
4206
|
+
});
|
|
4207
|
+
}
|
|
4208
|
+
isLead() {
|
|
4209
|
+
let e = this.getStack();
|
|
4210
|
+
return e ? e.lead === this : !0;
|
|
4211
|
+
}
|
|
4212
|
+
getLead() {
|
|
4213
|
+
let { layoutId: e } = this.options;
|
|
4214
|
+
return e && this.getStack()?.lead || this;
|
|
4215
|
+
}
|
|
4216
|
+
getPrevLead() {
|
|
4217
|
+
let { layoutId: e } = this.options;
|
|
4218
|
+
return e ? this.getStack()?.prevLead : void 0;
|
|
4219
|
+
}
|
|
4220
|
+
getStack() {
|
|
4221
|
+
let { layoutId: e } = this.options;
|
|
4222
|
+
if (e) return this.root.sharedNodes.get(e);
|
|
4223
|
+
}
|
|
4224
|
+
promote({ needsReset: e, transition: _, preserveFollowOpacity: v } = {}) {
|
|
4225
|
+
let y = this.getStack();
|
|
4226
|
+
y && y.promote(this, v), e && (this.projectionDelta = void 0, this.needsReset = !0), _ && this.setOptions({ transition: _ });
|
|
4227
|
+
}
|
|
4228
|
+
relegate() {
|
|
4229
|
+
let e = this.getStack();
|
|
4230
|
+
return e ? e.relegate(this) : !1;
|
|
4231
|
+
}
|
|
4232
|
+
resetSkewAndRotation() {
|
|
4233
|
+
let { visualElement: e } = this.options;
|
|
4234
|
+
if (!e) return;
|
|
4235
|
+
let _ = !1, { latestValues: v } = e;
|
|
4236
|
+
if ((v.z || v.rotate || v.rotateX || v.rotateY || v.rotateZ || v.skewX || v.skewY) && (_ = !0), !_) return;
|
|
4237
|
+
let y = {};
|
|
4238
|
+
v.z && resetDistortingTransform("z", e, y, this.animationValues);
|
|
4239
|
+
for (let _ = 0; _ < transformAxes.length; _++) resetDistortingTransform(`rotate${transformAxes[_]}`, e, y, this.animationValues), resetDistortingTransform(`skew${transformAxes[_]}`, e, y, this.animationValues);
|
|
4240
|
+
for (let _ in e.render(), y) e.setStaticValue(_, y[_]), this.animationValues && (this.animationValues[_] = y[_]);
|
|
4241
|
+
e.scheduleRender();
|
|
4242
|
+
}
|
|
4243
|
+
applyProjectionStyles(e, _) {
|
|
4244
|
+
if (!this.instance || this.isSVG) return;
|
|
4245
|
+
if (!this.isVisible) {
|
|
4246
|
+
e.visibility = "hidden";
|
|
4247
|
+
return;
|
|
4248
|
+
}
|
|
4249
|
+
let v = this.getTransformTemplate();
|
|
4250
|
+
if (this.needsReset) {
|
|
4251
|
+
this.needsReset = !1, e.visibility = "", e.opacity = "", e.pointerEvents = resolveMotionValue(_?.pointerEvents) || "", e.transform = v ? v(this.latestValues, "") : "none";
|
|
4252
|
+
return;
|
|
4253
|
+
}
|
|
4254
|
+
let y = this.getLead();
|
|
4255
|
+
if (!this.projectionDelta || !this.layout || !y.target) {
|
|
4256
|
+
this.options.layoutId && (e.opacity = this.latestValues.opacity === void 0 ? 1 : this.latestValues.opacity, e.pointerEvents = resolveMotionValue(_?.pointerEvents) || ""), this.hasProjected && !hasTransform(this.latestValues) && (e.transform = v ? v({}, "") : "none", this.hasProjected = !1);
|
|
4257
|
+
return;
|
|
4258
|
+
}
|
|
4259
|
+
e.visibility = "";
|
|
4260
|
+
let b = y.animationValues || y.latestValues;
|
|
4261
|
+
this.applyTransformsToTarget();
|
|
4262
|
+
let x = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, b);
|
|
4263
|
+
v && (x = v(b, x)), e.transform = x;
|
|
4264
|
+
let { x: S, y: C } = this.projectionDelta;
|
|
4265
|
+
for (let _ in e.transformOrigin = `${S.origin * 100}% ${C.origin * 100}% 0`, y.animationValues ? e.opacity = y === this ? b.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : b.opacityExit : e.opacity = y === this ? b.opacity === void 0 ? "" : b.opacity : b.opacityExit === void 0 ? 0 : b.opacityExit, scaleCorrectors) {
|
|
4266
|
+
if (b[_] === void 0) continue;
|
|
4267
|
+
let { correct: v, applyTo: S, isCSSVariable: C } = scaleCorrectors[_], w = x === "none" ? b[_] : v(b[_], y);
|
|
4268
|
+
if (S) {
|
|
4269
|
+
let _ = S.length;
|
|
4270
|
+
for (let v = 0; v < _; v++) e[S[v]] = w;
|
|
4271
|
+
} else C ? this.options.visualElement.renderState.vars[_] = w : e[_] = w;
|
|
4272
|
+
}
|
|
4273
|
+
this.options.layoutId && (e.pointerEvents = y === this ? resolveMotionValue(_?.pointerEvents) || "" : "none");
|
|
4274
|
+
}
|
|
4275
|
+
clearSnapshot() {
|
|
4276
|
+
this.resumeFrom = this.snapshot = void 0;
|
|
4277
|
+
}
|
|
4278
|
+
resetTree() {
|
|
4279
|
+
this.root.nodes.forEach((e) => e.currentAnimation?.stop()), this.root.nodes.forEach(clearMeasurements), this.root.sharedNodes.clear();
|
|
4280
|
+
}
|
|
4281
|
+
};
|
|
4282
|
+
}
|
|
4283
|
+
function updateLayout(e) {
|
|
4284
|
+
e.updateLayout();
|
|
4285
|
+
}
|
|
4286
|
+
function notifyLayoutUpdate(e) {
|
|
4287
|
+
let _ = e.resumeFrom?.snapshot || e.snapshot;
|
|
4288
|
+
if (e.isLead() && e.layout && _ && e.hasListeners("didUpdate")) {
|
|
4289
|
+
let { layoutBox: v, measuredBox: y } = e.layout, { animationType: b } = e.options, x = _.source !== e.layout.source;
|
|
4290
|
+
b === "size" ? eachAxis((e) => {
|
|
4291
|
+
let y = x ? _.measuredBox[e] : _.layoutBox[e], b = calcLength(y);
|
|
4292
|
+
y.min = v[e].min, y.max = y.min + b;
|
|
4293
|
+
}) : shouldAnimatePositionOnly(b, _.layoutBox, v) && eachAxis((y) => {
|
|
4294
|
+
let b = x ? _.measuredBox[y] : _.layoutBox[y], S = calcLength(v[y]);
|
|
4295
|
+
b.max = b.min + S, e.relativeTarget && !e.currentAnimation && (e.isProjectionDirty = !0, e.relativeTarget[y].max = e.relativeTarget[y].min + S);
|
|
4296
|
+
});
|
|
4297
|
+
let S = createDelta();
|
|
4298
|
+
calcBoxDelta(S, v, _.layoutBox);
|
|
4299
|
+
let C = createDelta();
|
|
4300
|
+
x ? calcBoxDelta(C, e.applyTransform(y, !0), _.measuredBox) : calcBoxDelta(C, v, _.layoutBox);
|
|
4301
|
+
let w = !isDeltaZero(S), T = !1;
|
|
4302
|
+
if (!e.resumeFrom) {
|
|
4303
|
+
let y = e.getClosestProjectingParent();
|
|
4304
|
+
if (y && !y.resumeFrom) {
|
|
4305
|
+
let { snapshot: b, layout: x } = y;
|
|
4306
|
+
if (b && x) {
|
|
4307
|
+
let S = createBox();
|
|
4308
|
+
calcRelativePosition(S, _.layoutBox, b.layoutBox);
|
|
4309
|
+
let C = createBox();
|
|
4310
|
+
calcRelativePosition(C, v, x.layoutBox), boxEqualsRounded(S, C) || (T = !0), y.options.layoutRoot && (e.relativeTarget = C, e.relativeTargetOrigin = S, e.relativeParent = y);
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
e.notifyListeners("didUpdate", {
|
|
4315
|
+
layout: v,
|
|
4316
|
+
snapshot: _,
|
|
4317
|
+
delta: C,
|
|
4318
|
+
layoutDelta: S,
|
|
4319
|
+
hasLayoutChanged: w,
|
|
4320
|
+
hasRelativeLayoutChanged: T
|
|
4321
|
+
});
|
|
4322
|
+
} else if (e.isLead()) {
|
|
4323
|
+
let { onExitComplete: _ } = e.options;
|
|
4324
|
+
_ && _();
|
|
4325
|
+
}
|
|
4326
|
+
e.options.transition = void 0;
|
|
4327
|
+
}
|
|
4328
|
+
function propagateDirtyNodes(e) {
|
|
4329
|
+
statsBuffer.value && metrics.nodes++, e.parent && (e.isProjecting() || (e.isProjectionDirty = e.parent.isProjectionDirty), e.isSharedProjectionDirty ||= !!(e.isProjectionDirty || e.parent.isProjectionDirty || e.parent.isSharedProjectionDirty), e.isTransformDirty ||= e.parent.isTransformDirty);
|
|
4330
|
+
}
|
|
4331
|
+
function cleanDirtyNodes(e) {
|
|
4332
|
+
e.isProjectionDirty = e.isSharedProjectionDirty = e.isTransformDirty = !1;
|
|
4333
|
+
}
|
|
4334
|
+
function clearSnapshot(e) {
|
|
4335
|
+
e.clearSnapshot();
|
|
4336
|
+
}
|
|
4337
|
+
function clearMeasurements(e) {
|
|
4338
|
+
e.clearMeasurements();
|
|
4339
|
+
}
|
|
4340
|
+
function clearIsLayoutDirty(e) {
|
|
4341
|
+
e.isLayoutDirty = !1;
|
|
4342
|
+
}
|
|
4343
|
+
function resetTransformStyle(e) {
|
|
4344
|
+
let { visualElement: _ } = e.options;
|
|
4345
|
+
_ && _.getProps().onBeforeLayoutMeasure && _.notify("BeforeLayoutMeasure"), e.resetTransform();
|
|
4346
|
+
}
|
|
4347
|
+
function finishAnimation(e) {
|
|
4348
|
+
e.finishAnimation(), e.targetDelta = e.relativeTarget = e.target = void 0, e.isProjectionDirty = !0;
|
|
4349
|
+
}
|
|
4350
|
+
function resolveTargetDelta(e) {
|
|
4351
|
+
e.resolveTargetDelta();
|
|
4352
|
+
}
|
|
4353
|
+
function calcProjection(e) {
|
|
4354
|
+
e.calcProjection();
|
|
4355
|
+
}
|
|
4356
|
+
function resetSkewAndRotation(e) {
|
|
4357
|
+
e.resetSkewAndRotation();
|
|
4358
|
+
}
|
|
4359
|
+
function removeLeadSnapshots(e) {
|
|
4360
|
+
e.removeLeadSnapshot();
|
|
4361
|
+
}
|
|
4362
|
+
function mixAxisDelta(e, _, v) {
|
|
4363
|
+
e.translate = mixNumber(_.translate, 0, v), e.scale = mixNumber(_.scale, 1, v), e.origin = _.origin, e.originPoint = _.originPoint;
|
|
4364
|
+
}
|
|
4365
|
+
function mixAxis(e, _, v, y) {
|
|
4366
|
+
e.min = mixNumber(_.min, v.min, y), e.max = mixNumber(_.max, v.max, y);
|
|
4367
|
+
}
|
|
4368
|
+
function mixBox(e, _, v, y) {
|
|
4369
|
+
mixAxis(e.x, _.x, v.x, y), mixAxis(e.y, _.y, v.y, y);
|
|
4370
|
+
}
|
|
4371
|
+
function hasOpacityCrossfade(e) {
|
|
4372
|
+
return e.animationValues && e.animationValues.opacityExit !== void 0;
|
|
4373
|
+
}
|
|
4374
|
+
var defaultLayoutTransition = {
|
|
4375
|
+
duration: .45,
|
|
4376
|
+
ease: [
|
|
4377
|
+
.4,
|
|
4378
|
+
0,
|
|
4379
|
+
.1,
|
|
4380
|
+
1
|
|
4381
|
+
]
|
|
4382
|
+
}, userAgentContains = (e) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(e), roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop;
|
|
4383
|
+
function roundAxis(e) {
|
|
4384
|
+
e.min = roundPoint(e.min), e.max = roundPoint(e.max);
|
|
4385
|
+
}
|
|
4386
|
+
function roundBox(e) {
|
|
4387
|
+
roundAxis(e.x), roundAxis(e.y);
|
|
4388
|
+
}
|
|
4389
|
+
function shouldAnimatePositionOnly(e, _, v) {
|
|
4390
|
+
return e === "position" || e === "preserve-aspect" && !isNear(aspectRatio(_), aspectRatio(v), .2);
|
|
4391
|
+
}
|
|
4392
|
+
function checkNodeWasScrollRoot(e) {
|
|
4393
|
+
return e !== e.root && e.scroll?.wasRoot;
|
|
4394
|
+
}
|
|
4395
|
+
var DocumentProjectionNode = createProjectionNode({
|
|
4396
|
+
attachResizeListener: (e, _) => addDomEvent(e, "resize", _),
|
|
4397
|
+
measureScroll: () => ({
|
|
4398
|
+
x: document.documentElement.scrollLeft || document.body.scrollLeft,
|
|
4399
|
+
y: document.documentElement.scrollTop || document.body.scrollTop
|
|
4400
|
+
}),
|
|
4401
|
+
checkIsScrollRoot: () => !0
|
|
4402
|
+
}), rootProjectionNode = { current: void 0 }, HTMLProjectionNode = createProjectionNode({
|
|
4403
|
+
measureScroll: (e) => ({
|
|
4404
|
+
x: e.scrollLeft,
|
|
4405
|
+
y: e.scrollTop
|
|
4406
|
+
}),
|
|
4407
|
+
defaultParent: () => {
|
|
4408
|
+
if (!rootProjectionNode.current) {
|
|
4409
|
+
let e = new DocumentProjectionNode({});
|
|
4410
|
+
e.mount(window), e.setOptions({ layoutScroll: !0 }), rootProjectionNode.current = e;
|
|
4411
|
+
}
|
|
4412
|
+
return rootProjectionNode.current;
|
|
4413
|
+
},
|
|
4414
|
+
resetTransform: (e, _) => {
|
|
4415
|
+
e.style.transform = _ === void 0 ? "none" : _;
|
|
4416
|
+
},
|
|
4417
|
+
checkIsScrollRoot: (e) => window.getComputedStyle(e).position === "fixed"
|
|
4418
|
+
}), drag = {
|
|
4419
|
+
pan: { Feature: PanGesture },
|
|
4420
|
+
drag: {
|
|
4421
|
+
Feature: DragGesture,
|
|
4422
|
+
ProjectionNode: HTMLProjectionNode,
|
|
4423
|
+
MeasureLayout
|
|
4424
|
+
}
|
|
4425
|
+
};
|
|
4426
|
+
function handleHoverEvent(e, _, v) {
|
|
4427
|
+
let { props: y } = e;
|
|
4428
|
+
e.animationState && y.whileHover && e.animationState.setActive("whileHover", v === "Start");
|
|
4429
|
+
let b = y["onHover" + v];
|
|
4430
|
+
b && frame.postRender(() => b(_, extractEventInfo(_)));
|
|
4431
|
+
}
|
|
4432
|
+
var HoverGesture = class extends Feature {
|
|
4433
|
+
mount() {
|
|
4434
|
+
let { current: e } = this.node;
|
|
4435
|
+
e && (this.unmount = hover(e, (e, _) => (handleHoverEvent(this.node, _, "Start"), (e) => handleHoverEvent(this.node, e, "End"))));
|
|
4436
|
+
}
|
|
4437
|
+
unmount() {}
|
|
4438
|
+
}, FocusGesture = class extends Feature {
|
|
4439
|
+
constructor() {
|
|
4440
|
+
super(...arguments), this.isActive = !1;
|
|
4441
|
+
}
|
|
4442
|
+
onFocus() {
|
|
4443
|
+
let e = !1;
|
|
4444
|
+
try {
|
|
4445
|
+
e = this.node.current.matches(":focus-visible");
|
|
4446
|
+
} catch {
|
|
4447
|
+
e = !0;
|
|
4448
|
+
}
|
|
4449
|
+
!e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
|
|
4450
|
+
}
|
|
4451
|
+
onBlur() {
|
|
4452
|
+
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
|
|
4453
|
+
}
|
|
4454
|
+
mount() {
|
|
4455
|
+
this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
|
|
4456
|
+
}
|
|
4457
|
+
unmount() {}
|
|
4458
|
+
};
|
|
4459
|
+
function handlePressEvent(e, _, v) {
|
|
4460
|
+
let { props: y } = e;
|
|
4461
|
+
if (e.current instanceof HTMLButtonElement && e.current.disabled) return;
|
|
4462
|
+
e.animationState && y.whileTap && e.animationState.setActive("whileTap", v === "Start");
|
|
4463
|
+
let b = y["onTap" + (v === "End" ? "" : v)];
|
|
4464
|
+
b && frame.postRender(() => b(_, extractEventInfo(_)));
|
|
4465
|
+
}
|
|
4466
|
+
var PressGesture = class extends Feature {
|
|
4467
|
+
mount() {
|
|
4468
|
+
let { current: e } = this.node;
|
|
4469
|
+
e && (this.unmount = press(e, (e, _) => (handlePressEvent(this.node, _, "Start"), (e, { success: _ }) => handlePressEvent(this.node, e, _ ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
|
|
4470
|
+
}
|
|
4471
|
+
unmount() {}
|
|
4472
|
+
}, observerCallbacks = /* @__PURE__ */ new WeakMap(), observers = /* @__PURE__ */ new WeakMap(), fireObserverCallback = (e) => {
|
|
4473
|
+
let _ = observerCallbacks.get(e.target);
|
|
4474
|
+
_ && _(e);
|
|
4475
|
+
}, fireAllObserverCallbacks = (e) => {
|
|
4476
|
+
e.forEach(fireObserverCallback);
|
|
4477
|
+
};
|
|
4478
|
+
function initIntersectionObserver({ root: e, ..._ }) {
|
|
4479
|
+
let v = e || document;
|
|
4480
|
+
observers.has(v) || observers.set(v, {});
|
|
4481
|
+
let y = observers.get(v), b = JSON.stringify(_);
|
|
4482
|
+
return y[b] || (y[b] = new IntersectionObserver(fireAllObserverCallbacks, {
|
|
4483
|
+
root: e,
|
|
4484
|
+
..._
|
|
4485
|
+
})), y[b];
|
|
4486
|
+
}
|
|
4487
|
+
function observeIntersection(e, _, v) {
|
|
4488
|
+
let y = initIntersectionObserver(_);
|
|
4489
|
+
return observerCallbacks.set(e, v), y.observe(e), () => {
|
|
4490
|
+
observerCallbacks.delete(e), y.unobserve(e);
|
|
4491
|
+
};
|
|
4492
|
+
}
|
|
4493
|
+
var thresholdNames = {
|
|
4494
|
+
some: 0,
|
|
4495
|
+
all: 1
|
|
4496
|
+
}, InViewFeature = class extends Feature {
|
|
4497
|
+
constructor() {
|
|
4498
|
+
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
|
|
4499
|
+
}
|
|
4500
|
+
startObserver() {
|
|
4501
|
+
this.unmount();
|
|
4502
|
+
let { viewport: e = {} } = this.node.getProps(), { root: _, margin: v, amount: y = "some", once: b } = e, x = {
|
|
4503
|
+
root: _ ? _.current : void 0,
|
|
4504
|
+
rootMargin: v,
|
|
4505
|
+
threshold: typeof y == "number" ? y : thresholdNames[y]
|
|
4506
|
+
};
|
|
4507
|
+
return observeIntersection(this.node.current, x, (e) => {
|
|
4508
|
+
let { isIntersecting: _ } = e;
|
|
4509
|
+
if (this.isInView === _ || (this.isInView = _, b && !_ && this.hasEnteredView)) return;
|
|
4510
|
+
_ && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", _);
|
|
4511
|
+
let { onViewportEnter: v, onViewportLeave: y } = this.node.getProps(), x = _ ? v : y;
|
|
4512
|
+
x && x(e);
|
|
4513
|
+
});
|
|
4514
|
+
}
|
|
4515
|
+
mount() {
|
|
4516
|
+
this.startObserver();
|
|
4517
|
+
}
|
|
4518
|
+
update() {
|
|
4519
|
+
if (typeof IntersectionObserver > "u") return;
|
|
4520
|
+
let { props: e, prevProps: _ } = this.node;
|
|
4521
|
+
[
|
|
4522
|
+
"amount",
|
|
4523
|
+
"margin",
|
|
4524
|
+
"root"
|
|
4525
|
+
].some(hasViewportOptionChanged(e, _)) && this.startObserver();
|
|
4526
|
+
}
|
|
4527
|
+
unmount() {}
|
|
4528
|
+
};
|
|
4529
|
+
function hasViewportOptionChanged({ viewport: e = {} }, { viewport: _ = {} } = {}) {
|
|
4530
|
+
return (v) => e[v] !== _[v];
|
|
4531
|
+
}
|
|
4532
|
+
var gestureAnimations = {
|
|
4533
|
+
inView: { Feature: InViewFeature },
|
|
4534
|
+
tap: { Feature: PressGesture },
|
|
4535
|
+
focus: { Feature: FocusGesture },
|
|
4536
|
+
hover: { Feature: HoverGesture }
|
|
4537
|
+
}, layout = { layout: {
|
|
4538
|
+
ProjectionNode: HTMLProjectionNode,
|
|
4539
|
+
MeasureLayout
|
|
4540
|
+
} }, motion = /* @__PURE__ */ createMotionProxy({
|
|
4541
|
+
...animations,
|
|
4542
|
+
...gestureAnimations,
|
|
4543
|
+
...drag,
|
|
4544
|
+
...layout
|
|
4545
|
+
}, createDomVisualElement), Collapse_default = (e) => {
|
|
4546
|
+
let { defaultExpand: _, title: v, children: y, onClear: b } = e, [x, S] = useState(_ ?? !1);
|
|
4547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
4548
|
+
className: "text-sm",
|
|
4549
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
4550
|
+
className: "flex items-center justify-between cursor-pointer",
|
|
4551
|
+
onClick: () => {
|
|
4552
|
+
S((e) => !e);
|
|
4553
|
+
},
|
|
4554
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
4555
|
+
className: "flex items-center gap-2",
|
|
4556
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
4557
|
+
className: "relative size-4 children:absolute children:inset-0",
|
|
4558
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(motion.div, {
|
|
4559
|
+
initial: { opacity: 1 },
|
|
4560
|
+
animate: { opacity: x ? 0 : 1 },
|
|
4561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SquarePlus, { className: "size-4" })
|
|
4562
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(motion.div, {
|
|
4563
|
+
initial: { opacity: 0 },
|
|
4564
|
+
animate: { opacity: x ? 1 : 0 },
|
|
4565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SquareMinus, { className: "size-4" })
|
|
4566
|
+
})]
|
|
4567
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: v })]
|
|
4568
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BrushCleaning, {
|
|
4569
|
+
className: "size-4",
|
|
4570
|
+
onClick: (e) => {
|
|
4571
|
+
e.stopPropagation(), b?.(e);
|
|
4572
|
+
}
|
|
4573
|
+
})]
|
|
4574
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(motion.div, {
|
|
4575
|
+
initial: {
|
|
4576
|
+
height: 0,
|
|
4577
|
+
opacity: 0
|
|
4578
|
+
},
|
|
4579
|
+
animate: {
|
|
4580
|
+
height: x ? "auto" : 0,
|
|
4581
|
+
opacity: x ? 1 : 0
|
|
4582
|
+
},
|
|
4583
|
+
className: "overflow-hidden",
|
|
4584
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4585
|
+
className: "pt-4",
|
|
4586
|
+
children: y
|
|
4587
|
+
})
|
|
4588
|
+
})]
|
|
4589
|
+
});
|
|
4590
|
+
};
|
|
4591
|
+
const cn = (...e) => twMerge(clsx(e));
|
|
4592
|
+
var Tags_default = (e) => {
|
|
4593
|
+
let { value: _, options: v, onChange: y, ...b } = e, x = v.filter((e) => !e.icon), S = v.filter((e) => e.icon), C = (e) => {
|
|
4594
|
+
_.includes(e) ? y?.(_.filter((_) => _ !== e)) : y?.([..._, e]);
|
|
4595
|
+
};
|
|
4596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Collapse_default, {
|
|
4597
|
+
...b,
|
|
4598
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4599
|
+
className: "flex flex-wrap gap-2",
|
|
4600
|
+
children: x.map((e) => {
|
|
4601
|
+
let { label: v, value: y } = e;
|
|
4602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4603
|
+
className: cn("inline-flex items-center h-6 px-3 cursor-pointer b-default rounded-full hover:border-primary transition-colors", { "border-primary bg-primary-bg": _.includes(y) }),
|
|
4604
|
+
onClick: () => {
|
|
4605
|
+
C(y);
|
|
4606
|
+
},
|
|
4607
|
+
children: v
|
|
4608
|
+
}, y);
|
|
4609
|
+
})
|
|
4610
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4611
|
+
className: "flex flex-wrap gap-2 mt-2",
|
|
4612
|
+
children: S.map((e) => {
|
|
4613
|
+
let { label: v, value: y, icon: b } = e;
|
|
4614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4615
|
+
className: cn("size-12 rounded-full overflow-hidden cursor-pointer b-default b-2 border-transparent hover:border-primary transition-colors", { "border-primary": _.includes(y) }),
|
|
4616
|
+
onClick: () => {
|
|
4617
|
+
C(y);
|
|
4618
|
+
},
|
|
4619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
4620
|
+
src: b,
|
|
4621
|
+
alt: v,
|
|
4622
|
+
className: "size-full"
|
|
4623
|
+
})
|
|
4624
|
+
}, y);
|
|
4625
|
+
})
|
|
4626
|
+
})]
|
|
4627
|
+
});
|
|
4628
|
+
}, CheckboxGroup_default = (e) => {
|
|
4629
|
+
let { options: _, value: v, onChange: y, ...b } = e, [x, S] = useState(!1), C = (e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4630
|
+
className: "flex flex-col gap-4",
|
|
4631
|
+
children: e.map((e) => {
|
|
4632
|
+
let { label: _, value: b, icon: x, count: S } = e;
|
|
4633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
4634
|
+
className: "flex items-center justify-between",
|
|
4635
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, {
|
|
4636
|
+
checked: v.includes(b),
|
|
4637
|
+
onChange: (e) => {
|
|
4638
|
+
e.target.checked ? y?.([...v, b]) : y?.(v.filter((e) => e !== b));
|
|
4639
|
+
},
|
|
4640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
4641
|
+
className: "flex items-center gap-1",
|
|
4642
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
4643
|
+
src: x,
|
|
4644
|
+
alt: _,
|
|
4645
|
+
className: "size-4"
|
|
4646
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: _ })]
|
|
4647
|
+
})
|
|
4648
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: S })]
|
|
4649
|
+
}, b);
|
|
4650
|
+
})
|
|
4651
|
+
}), w = () => {
|
|
4652
|
+
S((e) => !e);
|
|
4653
|
+
};
|
|
4654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Collapse_default, {
|
|
4655
|
+
...b,
|
|
4656
|
+
children: [
|
|
4657
|
+
C(_.slice(0, 5)),
|
|
4658
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatePresence, { children: x && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(motion.div, {
|
|
4659
|
+
initial: {
|
|
4660
|
+
height: 0,
|
|
4661
|
+
opacity: 0
|
|
4662
|
+
},
|
|
4663
|
+
animate: {
|
|
4664
|
+
height: "auto",
|
|
4665
|
+
opacity: 1
|
|
4666
|
+
},
|
|
4667
|
+
exit: {
|
|
4668
|
+
height: 0,
|
|
4669
|
+
opacity: 0
|
|
4670
|
+
},
|
|
4671
|
+
className: "overflow-hidden",
|
|
4672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4673
|
+
className: "mt-4",
|
|
4674
|
+
children: C(_.slice(5))
|
|
4675
|
+
})
|
|
4676
|
+
}) }),
|
|
4677
|
+
_.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
4678
|
+
className: "inline-flex items-center mt-4 text-primary cursor-pointer",
|
|
4679
|
+
onClick: w,
|
|
4680
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "更多" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: cn("size-4 transition", { "-scale-y-100": x }) })]
|
|
4681
|
+
})
|
|
4682
|
+
]
|
|
4683
|
+
});
|
|
4684
|
+
}, Select_default = (e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapse_default, {
|
|
4685
|
+
...e,
|
|
4686
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4687
|
+
className: "px-0.5 pb-0.5",
|
|
4688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select, {
|
|
4689
|
+
className: "w-full",
|
|
4690
|
+
...e
|
|
4691
|
+
})
|
|
4692
|
+
})
|
|
4693
|
+
}), ColorPicker_default = (e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapse_default, {
|
|
4694
|
+
...e,
|
|
4695
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ColorPicker, { ...e })
|
|
4696
|
+
}), Slider_default = (e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapse_default, {
|
|
4697
|
+
...e,
|
|
4698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4699
|
+
className: "px-2",
|
|
4700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slider, { ...e })
|
|
4701
|
+
})
|
|
4702
|
+
}), Input_default = (e) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapse_default, {
|
|
4703
|
+
...e,
|
|
4704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
4705
|
+
className: "px-0.5 pb-0.5",
|
|
4706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { ...e })
|
|
4707
|
+
})
|
|
4708
|
+
});
|
|
4709
|
+
export { CheckboxGroup_default as FilterCheckboxGroup, Collapse_default as FilterCollapse, ColorPicker_default as FilterColorPicker, Input_default as FilterInput, Select_default as FilterSelect, Slider_default as FilterSlider, Tags_default as FilterTags };
|